From 09e6ce77fe7c1dd5d7cd1bc2030eb1048cc781f8 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 21 Dec 2025 03:35:57 +1100 Subject: [PATCH 001/211] bugfix(network): Assign disconnect frame when quitting the game via the disconnection menu (#2020) --- Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 7b3450a960b..6e17e386dc0 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1771,6 +1771,7 @@ void ConnectionManager::quitGame() { // Need to do the NetDisconnectPlayerCommandMsg creation and sending here. NetDisconnectPlayerCommandMsg *disconnectMsg = newInstance(NetDisconnectPlayerCommandMsg); disconnectMsg->setDisconnectSlot(m_localSlot); + disconnectMsg->setDisconnectFrame(TheGameLogic->getFrame()); disconnectMsg->setPlayerID(m_localSlot); if (DoesCommandRequireACommandID(disconnectMsg->getNetCommandType())) { disconnectMsg->setID(GenerateNextCommandID()); From 529675f98bfceba107a0755944972534083341a8 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 20 Dec 2025 16:43:56 -0500 Subject: [PATCH 002/211] chore: Implement scripts for custom isEmpty() and singleton refs clang-tidy checks (#2010) --- scripts/clang-tidy-plugin/CMakeLists.txt | 63 +++++ .../GeneralsGameCodeTidyModule.cpp | 30 +++ .../GeneralsGameCodeTidyModule.h | 24 ++ scripts/clang-tidy-plugin/README.md | 250 +++++++++++++++++ .../readability/UseIsEmptyCheck.cpp | 254 ++++++++++++++++++ .../readability/UseIsEmptyCheck.h | 45 ++++ .../UseThisInsteadOfSingletonCheck.cpp | 225 ++++++++++++++++ .../UseThisInsteadOfSingletonCheck.h | 22 ++ scripts/run-clang-tidy.py | 131 ++++++++- 9 files changed, 1034 insertions(+), 10 deletions(-) create mode 100644 scripts/clang-tidy-plugin/CMakeLists.txt create mode 100644 scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.cpp create mode 100644 scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.h create mode 100644 scripts/clang-tidy-plugin/README.md create mode 100644 scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.cpp create mode 100644 scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.h create mode 100644 scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.cpp create mode 100644 scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.h diff --git a/scripts/clang-tidy-plugin/CMakeLists.txt b/scripts/clang-tidy-plugin/CMakeLists.txt new file mode 100644 index 00000000000..e8fdbd2581a --- /dev/null +++ b/scripts/clang-tidy-plugin/CMakeLists.txt @@ -0,0 +1,63 @@ +# Custom clang-tidy plugin for GeneralsGameCode +# This plugin provides checks for custom types like AsciiString and UnicodeString + +cmake_minimum_required(VERSION 3.20) +project(GeneralsGameCodeClangTidyPlugin) + +# Find LLVM and Clang +find_package(LLVM REQUIRED CONFIG) +find_package(Clang REQUIRED CONFIG) + +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") +message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}") + +# Set up include directories +include_directories(${LLVM_INCLUDE_DIRS}) +include_directories(${CLANG_INCLUDE_DIRS}) + +# Add definitions +add_definitions(${LLVM_DEFINITIONS}) +add_definitions(${CLANG_DEFINITIONS}) + +# Set C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Source files +set(SOURCES + GeneralsGameCodeTidyModule.cpp + readability/UseIsEmptyCheck.cpp + readability/UseThisInsteadOfSingletonCheck.cpp +) + +# Header files +set(HEADERS + GeneralsGameCodeTidyModule.h + readability/UseIsEmptyCheck.h + readability/UseThisInsteadOfSingletonCheck.h +) + +# Create the module library +add_library(GeneralsGameCodeClangTidyPlugin MODULE ${SOURCES} ${HEADERS}) + +# Link against required libraries +target_link_libraries(GeneralsGameCodeClangTidyPlugin + PRIVATE + clangTidy + clangTidyReadabilityModule + clangAST + clangASTMatchers + clangBasic + clangFrontend + clangLex + clangTooling + LLVMSupport +) + +# Set output directory +set_target_properties(GeneralsGameCodeClangTidyPlugin PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + diff --git a/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.cpp b/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.cpp new file mode 100644 index 00000000000..ff4222ccebb --- /dev/null +++ b/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.cpp @@ -0,0 +1,30 @@ +//===--- GeneralsGameCodeTidyModule.cpp - GeneralsGameCode Tidy Module ---===// +// +// Custom clang-tidy module for GeneralsGameCode +// Provides GeneralsGameCode-specific checks +// +//===----------------------------------------------------------------------===// + +#include "GeneralsGameCodeTidyModule.h" +#include "readability/UseIsEmptyCheck.h" +#include "readability/UseThisInsteadOfSingletonCheck.h" +#include "llvm/Support/Registry.h" + +namespace clang::tidy::generalsgamecode { + +void GeneralsGameCodeTidyModule::addCheckFactories( + ClangTidyCheckFactories &CheckFactories) { + CheckFactories.registerCheck( + "generals-use-is-empty"); + CheckFactories.registerCheck( + "generals-use-this-instead-of-singleton"); +} + +} // namespace clang::tidy::generalsgamecode + +static llvm::Registry<::clang::tidy::ClangTidyModule>::Add< + ::clang::tidy::generalsgamecode::GeneralsGameCodeTidyModule> + X("generalsgamecode", "GeneralsGameCode-specific checks"); + +volatile int GeneralsGameCodeTidyModuleAnchorSource = 0; + diff --git a/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.h b/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.h new file mode 100644 index 00000000000..f597578acb2 --- /dev/null +++ b/scripts/clang-tidy-plugin/GeneralsGameCodeTidyModule.h @@ -0,0 +1,24 @@ +//===--- GeneralsGameCodeTidyModule.h - GeneralsGameCode Tidy Module -----===// +// +// Custom clang-tidy module for GeneralsGameCode +// Provides checks for custom types like AsciiString and UnicodeString +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_GENERALSGAMECODETIDYMODULE_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_GENERALSGAMECODETIDYMODULE_H + +#include "clang-tidy/ClangTidyModule.h" + +namespace clang::tidy::generalsgamecode { + +/// This module is for GeneralsGameCode-specific checks. +class GeneralsGameCodeTidyModule : public ClangTidyModule { +public: + void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override; +}; + +} // namespace clang::tidy::generalsgamecode + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_GENERALSGAMECODETIDYMODULE_H + diff --git a/scripts/clang-tidy-plugin/README.md b/scripts/clang-tidy-plugin/README.md new file mode 100644 index 00000000000..cbd9a2f83ef --- /dev/null +++ b/scripts/clang-tidy-plugin/README.md @@ -0,0 +1,250 @@ +# GeneralsGameCode Clang-Tidy Custom Checks + +Custom clang-tidy checks for the GeneralsGameCode codebase. **This is primarily designed for Windows**, where checks are built directly into clang-tidy. Mac/Linux users can optionally use the plugin version. + +## Quick Start + +### Windows + +**Option 1: Use Pre-built clang-tidy** +- Precompiled binaries can be found at: https://github.com/TheSuperHackers/GeneralsTools + +**Option 2: Build It Yourself** + +Follow the manual steps in the [Windows: Building Checks Into clang-tidy](#windows-building-checks-into-clang-tidy) section below. + +**Usage** +```powershell +llvm-project\build\bin\clang-tidy.exe -p build/clang-tidy ` + --checks='-*,generals-use-is-empty,generals-use-this-instead-of-singleton' ` + file.cpp +``` + +### macOS/Linux (Plugin Version) + +If you prefer the plugin approach on macOS/Linux: + +```bash +# Build the plugin +cd scripts/clang-tidy-plugin +mkdir build && cd build +cmake .. -DLLVM_DIR=/path/to/llvm/lib/cmake/llvm +cmake --build . --config Release + +# Use with --load flag +clang-tidy -p build/clang-tidy \ + --checks='-*,generals-use-is-empty' \ + -load scripts/clang-tidy-plugin/build/lib/libGeneralsGameCodeClangTidyPlugin.so \ + file.cpp +``` + +**Note:** On Windows, plugin loading via `--load` is **not supported** due to DLL static initialization limitations. Windows users must use the built-in version. + +## Checks + +### `generals-use-is-empty` + +Finds uses of `getLength() == 0`, `getLength() > 0`, `compare("") == 0`, or `compareNoCase("") == 0` on `AsciiString` and `UnicodeString`, and `Get_Length() == 0` on `StringClass` and `WideStringClass`, and suggests using `isEmpty()`/`Is_Empty()` or `!isEmpty()`/`!Is_Empty()` instead. + +**Examples:** + +```cpp +// Before (AsciiString/UnicodeString) +if (str.getLength() == 0) { ... } +if (str.getLength() > 0) { ... } +if (str.compare("") == 0) { ... } +if (str.compareNoCase("") == 0) { ... } +if (str.compare(AsciiString::TheEmptyString) == 0) { ... } + +// After (AsciiString/UnicodeString) +if (str.isEmpty()) { ... } +if (!str.isEmpty()) { ... } +if (str.isEmpty()) { ... } +if (str.isEmpty()) { ... } +if (str.isEmpty()) { ... } + +// Before (StringClass/WideStringClass) +if (str.Get_Length() == 0) { ... } +if (str.Get_Length() > 0) { ... } + +// After (StringClass/WideStringClass) +if (str.Is_Empty()) { ... } +if (!str.Is_Empty()) { ... } +``` + +### `generals-use-this-instead-of-singleton` + +Finds uses of singleton global variables (like `TheGameLogic->method()` or `TheGlobalData->member`) inside member functions of the same class type, and suggests using the member directly (e.g., `method()` or `member`) instead of the singleton reference. + +**Examples:** + +```cpp +// Before +void GameLogic::update() { + UnsignedInt now = TheGameLogic->getFrame(); + TheGameLogic->setFrame(now + 1); + TheGameLogic->m_frame = 10; +} + +// After +void GameLogic::update() { + UnsignedInt now = getFrame(); + setFrame(now + 1); + m_frame = 10; +} +``` + +## Prerequisites + +Before using clang-tidy, you need to generate a compile commands database: + +```bash +cmake -B build/clang-tidy -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -G Ninja +``` + +This creates `build/clang-tidy/compile_commands.json` which tells clang-tidy how to compile each file. + +## Windows: Building Checks Into clang-tidy + +Since plugin loading via `--load` doesn't work on Windows, the checks are integrated directly into the clang-tidy source tree. This is the recommended approach for Windows. + +### Step 1: Clone and Build LLVM + +### Step 2: Copy Plugin Files to LLVM Source Tree + +```powershell +# Create the plugin directory in clang-tools-extra +mkdir llvm-project\clang-tools-extra\clang-tidy\plugins\generalsgamecode + +# Copy the plugin source files +cp -r scripts\clang-tidy-plugin\*.cpp llvm-project\clang-tools-extra\clang-tidy\plugins\generalsgamecode\ +cp -r scripts\clang-tidy-plugin\*.h llvm-project\clang-tools-extra\clang-tidy\plugins\generalsgamecode\ +cp -r scripts\clang-tidy-plugin\readability llvm-project\clang-tools-extra\clang-tidy\plugins\generalsgamecode\ +``` + +**Important:** After copying, you need to update the include paths in the headers: +- Change `#include "clang-tidy/ClangTidyCheck.h"` to `#include "../../../ClangTidyCheck.h"` +- Change `#include "clang-tidy/ClangTidyModule.h"` to `#include "../../ClangTidyModule.h"` + +### Step 3: Create CMakeLists.txt for the Module + +Create `llvm-project/clang-tools-extra/clang-tidy/plugins/generalsgamecode/CMakeLists.txt`: + +```cmake +add_clang_library(clangTidyGeneralsGameCodeModule STATIC + GeneralsGameCodeTidyModule.cpp + readability/UseIsEmptyCheck.cpp + readability/UseThisInsteadOfSingletonCheck.cpp + + LINK_LIBS + clangTidy + clangTidyUtils + ) + +clang_target_link_libraries(clangTidyGeneralsGameCodeModule + PRIVATE + clangAST + clangASTMatchers + clangBasic + clangLex + clangTooling + ) +``` + +### Step 4: Register the Module + +**Modify `llvm-project/clang-tools-extra/clang-tidy/CMakeLists.txt`:** + +Add the subdirectory: +```cmake +add_subdirectory(plugins/generalsgamecode) +``` + +Add to `ALL_CLANG_TIDY_CHECKS`: +```cmake +set(ALL_CLANG_TIDY_CHECKS + ... + clangTidyGeneralsGameCodeModule + ... +) +``` + +**Modify `llvm-project/clang-tools-extra/clang-tidy/ClangTidyForceLinker.h`:** + +Add the anchor to force linker inclusion: +```cpp +// This anchor is used to force the linker to link the GeneralsGameCodeModule. +extern volatile int GeneralsGameCodeModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED GeneralsGameCodeModuleAnchorDestination = + GeneralsGameCodeModuleAnchorSource; +``` + +**Modify `llvm-project/clang-tools-extra/clang-tidy/plugins/generalsgamecode/GeneralsGameCodeTidyModule.cpp`:** + +Ensure the anchor is defined: +```cpp +namespace clang::tidy { +// ... module registration ... + +// Force linker to include this module +volatile int GeneralsGameCodeModuleAnchorSource = 0; +} +``` + +### Step 5: Rebuild clang-tidy + +```powershell +cd llvm-project\build +ninja clang-tidy +``` + +### Step 6: Use the Built-in Checks + +Once rebuilt, the checks are always available - no `--load` flag needed: + +```powershell +llvm-project\build\bin\clang-tidy.exe -p build/clang-tidy ` + --checks='-*,generals-use-is-empty,generals-use-this-instead-of-singleton' ` + file.cpp +``` + + +## macOS/Linux: Building the Plugin + +If you're on macOS or Linux and want to use the plugin version: + +### Prerequisites + +**macOS:** +```bash +brew install llvm@21 +``` + +**Linux (Ubuntu/Debian):** +```bash +sudo apt-get install llvm-21-dev clang-21 libclang-21-dev +``` + +### Building the Plugin + +```bash +cd scripts/clang-tidy-plugin +mkdir build && cd build +cmake .. -DLLVM_DIR=/path/to/llvm/lib/cmake/llvm -DClang_DIR=/path/to/clang/lib/cmake/clang +cmake --build . --config Release +``` + +The plugin will be built as a shared library (`.so` on Linux, `.dylib` on macOS) in the `build/lib/` directory. + +### Using the Plugin + +```bash +clang-tidy -p build/clang-tidy \ + --checks='-*,generals-use-is-empty,generals-use-this-instead-of-singleton' \ + -load scripts/clang-tidy-plugin/build/lib/libGeneralsGameCodeClangTidyPlugin.so \ + file.cpp +``` + +**Important:** The plugin must be built with the same LLVM version as the `clang-tidy` executable in your PATH. The CMake build will display which LLVM version it found (e.g., `Found LLVM 21.1.7`). Verify this matches your `clang-tidy --version` output. + +- Windows plugins not working is a known limitation - see [GitHub issue #159710](https://github.com/llvm/llvm-project/issues/159710) and [LLVM Discourse discussion](https://discourse.llvm.org/t/clang-tidy-is-clang-tidy-out-of-tree-check-plugin-load-mechanism-guaranteed-to-work-with-msvc/84111) diff --git a/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.cpp b/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.cpp new file mode 100644 index 00000000000..fe70a15b5ed --- /dev/null +++ b/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.cpp @@ -0,0 +1,254 @@ +//===--- UseIsEmptyCheck.cpp - Use isEmpty() instead of getLength() == 0 -===// +// +// This check finds patterns like: +// - AsciiString::getLength() == 0 -> AsciiString::isEmpty() +// - AsciiString::getLength() > 0 -> !AsciiString::isEmpty() +// - UnicodeString::getLength() == 0 -> UnicodeString::isEmpty() +// - UnicodeString::getLength() > 0 -> !UnicodeString::isEmpty() +// - StringClass::Get_Length() == 0 -> StringClass::Is_Empty() +// - WideStringClass::Get_Length() == 0 -> WideStringClass::Is_Empty() +// - AsciiString::compare("") == 0 -> AsciiString::isEmpty() +// - UnicodeString::compare(L"") == 0 -> UnicodeString::isEmpty() +// - AsciiString::compare(AsciiString::TheEmptyString) == 0 -> AsciiString::isEmpty() +// - UnicodeString::compare(UnicodeString::TheEmptyString) == 0 -> UnicodeString::isEmpty() +// +//===----------------------------------------------------------------------===// + +#include "UseIsEmptyCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Lex/Lexer.h" + +using namespace clang::ast_matchers; + +namespace clang::tidy::generalsgamecode::readability { + +void UseIsEmptyCheck::registerMatchers(MatchFinder *Finder) { + // Matcher for AsciiString/UnicodeString with getLength() + auto GetLengthCall = cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("getLength"))), + on(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl( + hasAnyName("AsciiString", "UnicodeString")))))))); + + // Matcher for StringClass/WideStringClass with Get_Length() + auto GetLengthCallWWVegas = cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("Get_Length"))), + on(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl( + hasAnyName("StringClass", "WideStringClass")))))))); + + // Helper function to add matchers for a given GetLength call matcher + auto addMatchersForGetLength = [&](const auto &GetLengthMatcher) { + Finder->addMatcher( + binaryOperator( + hasOperatorName("=="), + hasLHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall"))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("!="), + hasLHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall"))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName(">"), + hasLHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall"))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("<="), + hasLHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall"))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("=="), + hasLHS(integerLiteral(equals(0)).bind("zero")), + hasRHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall")))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("!="), + hasLHS(integerLiteral(equals(0)).bind("zero")), + hasRHS(ignoringParenImpCasts(GetLengthMatcher.bind("getLengthCall")))) + .bind("comparison"), + this); + }; + + addMatchersForGetLength(GetLengthCall); + addMatchersForGetLength(GetLengthCallWWVegas); + + // Matcher for TheEmptyString static member access (AsciiString::TheEmptyString or UnicodeString::TheEmptyString) + auto TheEmptyStringRef = memberExpr( + member(hasName("TheEmptyString")), + hasObjectExpression(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl( + hasAnyName("AsciiString", "UnicodeString")))))))); + + // Matcher for AsciiString/UnicodeString with compare() - we'll check if argument is empty in check() + auto CompareCall = cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("compare"))), + on(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl( + hasAnyName("AsciiString", "UnicodeString"))))))), + hasArgument(0, anyOf( + stringLiteral().bind("stringLiteralArg"), + TheEmptyStringRef.bind("theEmptyStringArg")))); + + // Matcher for AsciiString/UnicodeString with compareNoCase() - we'll check if argument is empty in check() + auto CompareNoCaseCall = cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("compareNoCase"))), + on(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl( + hasAnyName("AsciiString", "UnicodeString"))))))), + hasArgument(0, anyOf( + stringLiteral().bind("stringLiteralArg"), + TheEmptyStringRef.bind("theEmptyStringArg")))); + + // Helper function to add matchers for compare() and compareNoCase() calls + auto addMatchersForCompare = [&](const auto &CompareMatcher, const char *BindingName) { + Finder->addMatcher( + binaryOperator( + hasOperatorName("=="), + hasLHS(ignoringParenImpCasts(CompareMatcher.bind(BindingName))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("!="), + hasLHS(ignoringParenImpCasts(CompareMatcher.bind(BindingName))), + hasRHS(integerLiteral(equals(0)).bind("zero"))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("=="), + hasLHS(integerLiteral(equals(0)).bind("zero")), + hasRHS(ignoringParenImpCasts(CompareMatcher.bind(BindingName)))) + .bind("comparison"), + this); + + Finder->addMatcher( + binaryOperator( + hasOperatorName("!="), + hasLHS(integerLiteral(equals(0)).bind("zero")), + hasRHS(ignoringParenImpCasts(CompareMatcher.bind(BindingName)))) + .bind("comparison"), + this); + }; + + addMatchersForCompare(CompareCall, "compareCall"); + addMatchersForCompare(CompareNoCaseCall, "compareNoCaseCall"); +} + +void UseIsEmptyCheck::check(const MatchFinder::MatchResult &Result) { + const auto *Comparison = Result.Nodes.getNodeAs("comparison"); + const auto *GetLengthCall = + Result.Nodes.getNodeAs("getLengthCall"); + const auto *CompareCall = + Result.Nodes.getNodeAs("compareCall"); + const auto *CompareNoCaseCall = + Result.Nodes.getNodeAs("compareNoCaseCall"); + + if (!Comparison) + return; + + const CXXMemberCallExpr *MethodCall = GetLengthCall ? GetLengthCall : + (CompareCall ? CompareCall : CompareNoCaseCall); + if (!MethodCall) + return; + + // For compare() and compareNoCase() calls, verify the argument is actually empty + if (CompareCall || CompareNoCaseCall) { + const auto *StringLit = Result.Nodes.getNodeAs("stringLiteralArg"); + const auto *TheEmptyString = Result.Nodes.getNodeAs("theEmptyStringArg"); + + if (StringLit) { + // Check if string literal is actually empty ("" or L"") + StringRef Str = StringLit->getString(); + if (!Str.empty()) { + return; // Not an empty string literal + } + } else if (!TheEmptyString) { + return; // Not matching empty string pattern + } + } + + const Expr *ObjectExpr = MethodCall->getImplicitObjectArgument(); + if (!ObjectExpr) + return; + + // Determine which method name to use based on the called method + StringRef MethodName = MethodCall->getMethodDecl()->getName(); + std::string IsEmptyMethodName; + std::string MethodNameStr; + + if (MethodName == "Get_Length") { + IsEmptyMethodName = "Is_Empty()"; + MethodNameStr = "Get_Length()"; + } else if (MethodName == "compare") { + IsEmptyMethodName = "isEmpty()"; + MethodNameStr = "compare()"; + } else if (MethodName == "compareNoCase") { + IsEmptyMethodName = "isEmpty()"; + MethodNameStr = "compareNoCase()"; + } else { + IsEmptyMethodName = "isEmpty()"; + MethodNameStr = "getLength()"; + } + + StringRef Operator = Comparison->getOpcodeStr(); + bool ShouldNegate = false; + + if (Operator == "==") { + ShouldNegate = false; + } else if (Operator == "!=") { + ShouldNegate = true; + } else if (Operator == ">") { + ShouldNegate = true; + } else if (Operator == "<=") { + ShouldNegate = false; + } else { + return; + } + + StringRef ObjectText = Lexer::getSourceText( + CharSourceRange::getTokenRange(ObjectExpr->getSourceRange()), + *Result.SourceManager, Result.Context->getLangOpts()); + + std::string Replacement; + if (ShouldNegate) { + Replacement = "!" + ObjectText.str() + "." + IsEmptyMethodName; + } else { + Replacement = ObjectText.str() + "." + IsEmptyMethodName; + } + + SourceLocation StartLoc = Comparison->getBeginLoc(); + SourceLocation EndLoc = Comparison->getEndLoc(); + + diag(Comparison->getBeginLoc(), + "use %0 instead of comparing %1 with 0") + << Replacement << MethodNameStr + << FixItHint::CreateReplacement( + CharSourceRange::getTokenRange(StartLoc, EndLoc), Replacement); +} + +} // namespace clang::tidy::generalsgamecode::readability diff --git a/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.h b/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.h new file mode 100644 index 00000000000..2d6dd84253d --- /dev/null +++ b/scripts/clang-tidy-plugin/readability/UseIsEmptyCheck.h @@ -0,0 +1,45 @@ +//===--- UseIsEmptyCheck.h - Use isEmpty() instead of getLength() == 0 ---===// +// +// This check finds patterns like: +// - AsciiString::getLength() == 0 -> AsciiString::isEmpty() +// - AsciiString::getLength() > 0 -> !AsciiString::isEmpty() +// - UnicodeString::getLength() == 0 -> UnicodeString::isEmpty() +// - UnicodeString::getLength() > 0 -> !UnicodeString::isEmpty() +// - StringClass::Get_Length() == 0 -> StringClass::Is_Empty() +// - WideStringClass::Get_Length() == 0 -> WideStringClass::Is_Empty() +// - AsciiString::compare("") == 0 -> AsciiString::isEmpty() +// - UnicodeString::compare(L"") == 0 -> UnicodeString::isEmpty() +// - AsciiString::compare(AsciiString::TheEmptyString) == 0 -> AsciiString::isEmpty() +// - UnicodeString::compare(UnicodeString::TheEmptyString) == 0 -> UnicodeString::isEmpty() +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_READABILITY_USEISEMPTYCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_READABILITY_USEISEMPTYCHECK_H + +#include "clang-tidy/ClangTidyCheck.h" + +namespace clang::tidy::generalsgamecode::readability { + +/// Finds uses of getLength() == 0 or getLength() > 0 on AsciiString and +/// UnicodeString, and Get_Length() == 0 on StringClass and WideStringClass, +/// and suggests using isEmpty()/Is_Empty() or !isEmpty()/!Is_Empty() instead. +/// Also finds uses of compare("") == 0 or compare(TheEmptyString) == 0 and +/// suggests using isEmpty() instead. +/// +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/generals-use-is-empty.html +class UseIsEmptyCheck : public ClangTidyCheck { +public: + UseIsEmptyCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { + return LangOpts.CPlusPlus; + } +}; + +} // namespace clang::tidy::generalsgamecode::readability + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_READABILITY_USEISEMPTYCHECK_H diff --git a/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.cpp b/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.cpp new file mode 100644 index 00000000000..51eff283ef6 --- /dev/null +++ b/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.cpp @@ -0,0 +1,225 @@ +#include "UseThisInsteadOfSingletonCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/AST/Decl.h" +#include "clang/AST/DeclCXX.h" +#include "clang/AST/Expr.h" +#include "clang/AST/ExprCXX.h" +#include "clang/AST/Type.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Lex/Lexer.h" + +using namespace clang; +using namespace clang::ast_matchers; + +namespace clang::tidy::generalsgamecode::readability { + + +static const CXXMethodDecl *getEnclosingMethod(ASTContext *Context, + const Stmt *S) { + const CXXMethodDecl *Method = nullptr; + + auto Parents = Context->getParents(*S); + while (!Parents.empty()) { + if (const auto *M = Parents[0].get()) { + if (!M->isStatic()) { + Method = M; + break; + } + } + Parents = Context->getParents(Parents[0]); + } + + return Method; +} + +static bool typesMatch(const QualType &SingletonType, + const CXXRecordDecl *EnclosingClass) { + if (!EnclosingClass) { + return false; + } + + const Type *TypePtr = SingletonType.getTypePtrOrNull(); + if (!TypePtr) { + return false; + } + + if (const PointerType *PtrType = TypePtr->getAs()) { + QualType PointeeType = PtrType->getPointeeType(); + if (const RecordType *RecordTy = PointeeType->getAs()) { + if (const CXXRecordDecl *RecordDecl = + dyn_cast(RecordTy->getDecl())) { + return RecordDecl->getCanonicalDecl() == + EnclosingClass->getCanonicalDecl(); + } + } + } + + return false; +} + +void UseThisInsteadOfSingletonCheck::registerMatchers(MatchFinder *Finder) { + auto MemberExprMatcher = memberExpr( + hasObjectExpression(ignoringParenImpCasts(declRefExpr(to(varDecl(anyOf(hasGlobalStorage(), hasExternalFormalLinkage())).bind("singletonVar"))))), + hasDeclaration(fieldDecl()), + unless(hasAncestor(cxxMemberCallExpr()))) + .bind("memberExpr"); + + auto MemberCallMatcher = cxxMemberCallExpr( + on(ignoringParenImpCasts(declRefExpr(to(varDecl(anyOf(hasGlobalStorage(), hasExternalFormalLinkage())).bind("singletonVarCall")))))) + .bind("memberCall"); + + Finder->addMatcher(MemberExprMatcher, this); + Finder->addMatcher(MemberCallMatcher, this); +} + +void UseThisInsteadOfSingletonCheck::check( + const MatchFinder::MatchResult &Result) { + const auto *MemExpr = Result.Nodes.getNodeAs("memberExpr"); + const auto *MemberCall = Result.Nodes.getNodeAs("memberCall"); + + if (!MemExpr && !MemberCall) { + return; + } + + const Stmt *TargetStmt = nullptr; + const VarDecl *FoundSingletonVar = nullptr; + bool IsCall = false; + + if (MemberCall) { + IsCall = true; + TargetStmt = MemberCall; + FoundSingletonVar = Result.Nodes.getNodeAs("singletonVarCall"); + if (!FoundSingletonVar) { + const Expr *ImplicitObject = MemberCall->getImplicitObjectArgument(); + if (ImplicitObject) { + ImplicitObject = ImplicitObject->IgnoreParenImpCasts(); + if (const DeclRefExpr *DRE = dyn_cast(ImplicitObject)) { + FoundSingletonVar = dyn_cast(DRE->getDecl()); + } + } + } + } else if (MemExpr) { + TargetStmt = MemExpr; + FoundSingletonVar = Result.Nodes.getNodeAs("singletonVar"); + } + + if (!TargetStmt || !FoundSingletonVar) { + return; + } + + StringRef SingletonName = FoundSingletonVar->getName(); + if (!SingletonName.starts_with("The") || SingletonName.size() <= 3 || + (SingletonName[3] < 'A' || SingletonName[3] > 'Z')) { + return; + } + + const ASTContext *Context = Result.Context; + + const CXXMethodDecl *EnclosingMethod = getEnclosingMethod( + const_cast(Context), TargetStmt); + if (!EnclosingMethod) { + return; + } + + const CXXRecordDecl *EnclosingClass = EnclosingMethod->getParent(); + if (!EnclosingClass) { + return; + } + + QualType SingletonType = FoundSingletonVar->getType(); + if (!typesMatch(SingletonType, EnclosingClass)) { + return; + } + + const ValueDecl *Member = nullptr; + StringRef MemberName; + SourceLocation StartLoc, EndLoc; + + if (IsCall && MemberCall) { + const CXXMethodDecl *Method = MemberCall->getMethodDecl(); + if (!Method) { + return; + } + if (Method->isStatic()) { + return; + } + if (EnclosingMethod->isConst() && !Method->isConst()) { + return; + } + Member = Method; + MemberName = Method->getName(); + StartLoc = MemberCall->getBeginLoc(); + EndLoc = MemberCall->getEndLoc(); + } else if (MemExpr) { + Member = MemExpr->getMemberDecl(); + if (!Member) { + return; + } + MemberName = Member->getName(); + StartLoc = MemExpr->getBeginLoc(); + EndLoc = MemExpr->getEndLoc(); + } else { + return; + } + + SourceManager &SM = *Result.SourceManager; + + std::string Replacement = std::string(MemberName); + + if (IsCall && MemberCall) { + SourceLocation RParenLoc = MemberCall->getRParenLoc(); + const Expr *Callee = MemberCall->getCallee(); + + if (RParenLoc.isValid() && Callee) { + SourceLocation CalleeEnd = Lexer::getLocForEndOfToken( + Callee->getEndLoc(), 0, SM, Result.Context->getLangOpts()); + + if (CalleeEnd.isValid() && CalleeEnd < RParenLoc) { + SourceLocation ArgsStart = CalleeEnd; + SourceLocation ArgsEnd = Lexer::getLocForEndOfToken( + RParenLoc, 0, SM, Result.Context->getLangOpts()); + + if (ArgsStart.isValid() && ArgsEnd.isValid() && ArgsStart < ArgsEnd) { + StringRef ArgsText = Lexer::getSourceText( + CharSourceRange::getCharRange(ArgsStart, ArgsEnd), SM, + Result.Context->getLangOpts()); + ArgsText = ArgsText.ltrim(); + if (!ArgsText.empty()) { + Replacement += ArgsText.str(); + } else { + Replacement += "()"; + } + } else { + Replacement += "()"; + } + } else { + SourceLocation CallEnd = Lexer::getLocForEndOfToken( + MemberCall->getEndLoc(), 0, SM, Result.Context->getLangOpts()); + if (CalleeEnd.isValid() && CallEnd.isValid() && CalleeEnd < CallEnd) { + StringRef ArgsText = Lexer::getSourceText( + CharSourceRange::getCharRange(CalleeEnd, CallEnd), SM, + Result.Context->getLangOpts()); + ArgsText = ArgsText.ltrim(); + if (!ArgsText.empty()) { + Replacement += ArgsText.str(); + } else { + Replacement += "()"; + } + } else { + Replacement += "()"; + } + } + } else { + Replacement += "()"; + } + } + + diag(StartLoc, "use '%0' instead of '%1->%2' when inside a member function") + << Replacement << FoundSingletonVar->getName() << MemberName + << FixItHint::CreateReplacement( + CharSourceRange::getTokenRange(StartLoc, EndLoc), Replacement); +} + +} // namespace clang::tidy::generalsgamecode::readability + diff --git a/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.h b/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.h new file mode 100644 index 00000000000..1005d5d84b5 --- /dev/null +++ b/scripts/clang-tidy-plugin/readability/UseThisInsteadOfSingletonCheck.h @@ -0,0 +1,22 @@ +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_READABILITY_USETHISINSTEADOFSINGLETONCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GENERALSGAMECODE_READABILITY_USETHISINSTEADOFSINGLETONCHECK_H + +#include "clang-tidy/ClangTidyCheck.h" + +namespace clang::tidy::generalsgamecode::readability { + +class UseThisInsteadOfSingletonCheck : public ClangTidyCheck { +public: + UseThisInsteadOfSingletonCheck(StringRef Name, ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + void registerMatchers(ast_matchers::MatchFinder *Finder) override; + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { + return LangOpts.CPlusPlus; + } +}; + +} // namespace clang::tidy::generalsgamecode::readability + +#endif + diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 49f06b4563a..71b41ab70ce 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -27,7 +27,7 @@ def find_clang_tidy() -> str: - """Find clang-tidy executable in PATH.""" + """Find clang-tidy executable in PATH or common locations.""" try: result = subprocess.run( ['clang-tidy', '--version'], @@ -40,8 +40,38 @@ def find_clang_tidy() -> str: except (FileNotFoundError, subprocess.TimeoutExpired): pass + import platform + if platform.system() == 'Darwin': + import glob + import re + possible_paths = glob.glob('/opt/homebrew/Cellar/llvm*/*/bin/clang-tidy') + possible_paths.extend(glob.glob('/usr/local/Cellar/llvm*/*/bin/clang-tidy')) + + def extract_version(path): + match = re.search(r'llvm@?(\d+)', path) + if match: + return int(match.group(1)) + match = re.search(r'/(\d+)\.(\d+)\.(\d+)', path) + if match: + return int(match.group(1)) * 10000 + int(match.group(2)) * 100 + int(match.group(3)) + return 0 + + for path in sorted(possible_paths, key=extract_version, reverse=True): + try: + result = subprocess.run( + [path, '--version'], + capture_output=True, + text=True, + timeout=5 + ) + if result.returncode == 0: + return path + except (FileNotFoundError, subprocess.TimeoutExpired): + continue + raise RuntimeError( "clang-tidy not found in PATH. Please install clang-tidy:\n" + " macOS: brew install llvm\n" " Windows: Install LLVM from https://llvm.org/builds/" ) @@ -56,6 +86,54 @@ def find_project_root() -> Path: raise RuntimeError("Could not find project root (no CMakeLists.txt found)") +def get_clang_tidy_version(clang_tidy_exe: str) -> Optional[str]: + """Get the version string from clang-tidy.""" + try: + result = subprocess.run( + [clang_tidy_exe, '--version'], + capture_output=True, + text=True, + timeout=5 + ) + if result.returncode == 0: + return result.stdout.strip() + except (FileNotFoundError, subprocess.TimeoutExpired): + pass + return None + + +def extract_llvm_version(version_string: str) -> Optional[str]: + """Extract LLVM version number from clang-tidy version string.""" + import re + patterns = [ + r'LLVM version (\d+\.\d+\.\d+)', + r'llvm version (\d+\.\d+\.\d+)', + r'Homebrew LLVM version (\d+\.\d+\.\d+)', + r'version (\d+\.\d+\.\d+)', + ] + for pattern in patterns: + match = re.search(pattern, version_string, re.IGNORECASE) + if match: + return match.group(1) + return None + + +def find_clang_tidy_plugin(project_root: Path) -> Optional[str]: + """Find the GeneralsGameCode clang-tidy plugin.""" + possible_paths = [ + project_root / "scripts" / "clang-tidy-plugin" / "build" / "lib" / "libGeneralsGameCodeClangTidyPlugin.so", + project_root / "scripts" / "clang-tidy-plugin" / "build" / "lib" / "libGeneralsGameCodeClangTidyPlugin.dylib", + project_root / "scripts" / "clang-tidy-plugin" / "build" / "lib" / "libGeneralsGameCodeClangTidyPlugin.dll", + project_root / "scripts" / "clang-tidy-plugin" / "build" / "bin" / "libGeneralsGameCodeClangTidyPlugin.dll", + ] + + for path in possible_paths: + if path.exists(): + return str(path) + + return None + + def find_compile_commands(build_dir: Optional[Path] = None) -> Path: """Find compile_commands.json from the clang-tidy analysis build.""" project_root = find_project_root() @@ -174,7 +252,7 @@ def _run_batch(args: Tuple) -> Tuple[int, Dict[str, List[str]]]: if is_warning_or_error or verbose: issues_by_file[file_key].append(line) - + return result.returncode, dict(issues_by_file) except FileNotFoundError: error_msg = "Error: clang-tidy not found. Please install LLVM/Clang." @@ -188,7 +266,8 @@ def run_clang_tidy(source_files: List[str], extra_args: List[str], fix: bool = False, jobs: int = 1, - verbose: bool = False) -> int: + verbose: bool = False, + load_plugin: bool = True) -> int: """Run clang-tidy on source files in batches, optionally in parallel.""" if not source_files: print("No source files to analyze.") @@ -196,17 +275,41 @@ def run_clang_tidy(source_files: List[str], clang_tidy_exe = find_clang_tidy() + project_root = find_project_root() + plugin_path = None + if load_plugin: + plugin_path = find_clang_tidy_plugin(project_root) + if plugin_path: + clang_tidy_version_str = get_clang_tidy_version(clang_tidy_exe) + if clang_tidy_version_str: + detected_version = extract_llvm_version(clang_tidy_version_str) + if detected_version: + if verbose: + print(f"Found clang-tidy plugin: {plugin_path}") + print(f"Using clang-tidy LLVM version: {detected_version}") + print("Note: Ensure the plugin was built with the same LLVM version (check CMake build output).\n") + else: + print(f"Note: Verify plugin was built with LLVM {detected_version} (check CMake build output)") + else: + if verbose: + print(f"Found clang-tidy plugin: {plugin_path}\n") + else: + if verbose: + print(f"Found clang-tidy plugin: {plugin_path}\n") + BATCH_SIZE = 50 total_files = len(source_files) batches = [source_files[i:i + BATCH_SIZE] for i in range(0, total_files, BATCH_SIZE)] - project_root = find_project_root() compile_commands_dir = compile_commands_path.parent all_issues = defaultdict(list) files_with_issues = set() total_issues = 0 + if plugin_path and '-load' not in ' '.join(extra_args): + extra_args = ['-load', plugin_path] + extra_args + if jobs > 1: if verbose: print(f"Running clang-tidy on {total_files} file(s) in {len(batches)} batch(es) with {jobs} workers...\n") @@ -232,7 +335,7 @@ def run_clang_tidy(source_files: List[str], all_issues[file_path].extend(file_issues) files_with_issues.add(file_path) total_issues += len(file_issues) - + if not verbose: print(" done.") except KeyboardInterrupt: @@ -249,7 +352,7 @@ def run_clang_tidy(source_files: List[str], try: if verbose: print(f"Batch {batch_num}/{len(batches)}: {len(batch)} file(s)...") - + returncode, issues = _run_batch((batch_num, batch, compile_commands_dir, fix, extra_args, project_root, clang_tidy_exe, verbose)) if returncode != 0: overall_returncode = returncode @@ -259,7 +362,7 @@ def run_clang_tidy(source_files: List[str], all_issues[file_path].extend(file_issues) files_with_issues.add(file_path) total_issues += len(file_issues) - + if not verbose and batch_num < len(batches): print('.', end='', flush=True) except KeyboardInterrupt: @@ -277,7 +380,7 @@ def run_clang_tidy(source_files: List[str], print(f"\n{file_path}:") for issue in all_issues[file_path]: print(f" {issue}") - + return overall_returncode @@ -355,6 +458,12 @@ def main(): help='Show detailed output for each file (default: only show warnings/errors)' ) + parser.add_argument( + '--no-plugin', + action='store_true', + help='Do not automatically load the GeneralsGameCode clang-tidy plugin' + ) + parser.add_argument( 'clang_tidy_args', nargs='*', @@ -390,7 +499,8 @@ def main(): clang_tidy_args, args.fix, args.jobs, - args.verbose + args.verbose, + load_plugin=not args.no_plugin ) compile_commands = load_compile_commands(compile_commands_path) @@ -423,7 +533,8 @@ def main(): clang_tidy_args, args.fix, args.jobs, - args.verbose + args.verbose, + load_plugin=not args.no_plugin ) except Exception as e: From 1f2c1a38b3d1cfdcffe2f523c770685baad2181c Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sun, 21 Dec 2025 04:44:36 -0500 Subject: [PATCH 003/211] bugfix(input): Replace frame-based timings with real-time timings in input system (#1835) --- .../GameEngine/Include/GameClient/Keyboard.h | 10 +++-- .../Include/GameClient/LookAtXlat.h | 4 +- .../GameEngine/Include/GameClient/Mouse.h | 9 +---- .../Source/GameClient/Input/Keyboard.cpp | 38 +++++++++---------- .../Source/GameClient/Input/Mouse.cpp | 29 ++------------ .../GameClient/MessageStream/LookAtXlat.cpp | 36 ++++++++++-------- .../GameClient/Win32DIKeyboard.cpp | 14 ++++--- .../Win32Device/GameClient/Win32DIMouse.cpp | 11 ++---- .../Win32Device/GameClient/Win32Mouse.cpp | 23 +---------- .../GameEngine/Include/GameClient/Keyboard.h | 10 +++-- .../Include/GameClient/LookAtXlat.h | 4 +- .../GameEngine/Include/GameClient/Mouse.h | 9 +---- .../Source/GameClient/Input/Keyboard.cpp | 36 ++++++++---------- .../Source/GameClient/Input/Mouse.cpp | 29 ++------------ .../GameClient/MessageStream/LookAtXlat.cpp | 36 ++++++++++-------- .../GameClient/Win32DIKeyboard.cpp | 14 ++++--- .../Win32Device/GameClient/Win32DIMouse.cpp | 11 ++---- .../Win32Device/GameClient/Win32Mouse.cpp | 23 +---------- 18 files changed, 128 insertions(+), 218 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h index e4ee92bf495..8e54ae6ac1c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h @@ -76,7 +76,7 @@ struct KeyboardIO UnsignedByte key; // KeyDefType, key data UnsignedByte status; // StatusType, above UnsignedShort state; // KEY_STATE_* in KeyDefs.h - UnsignedInt sequence; // sequence info from DirectX used for order + UnsignedInt keyDownTimeMsec; // real-time in milliseconds when key went down }; @@ -86,7 +86,11 @@ struct KeyboardIO class Keyboard : public SubsystemInterface { - enum { KEY_REPEAT_DELAY = 10 }; + enum + { + KEY_REPEAT_DELAY_MSEC = 333, // 10 frames at 30 FPS + KEY_REPEAT_INTERVAL_MSEC = 67 // ~2 frames at 30 FPS + }; public: @@ -133,7 +137,6 @@ class Keyboard : public SubsystemInterface Bool checkKeyRepeat( void ); ///< check for repeating keys UnsignedByte getKeyStatusData( KeyDefType key ); ///< get key status Bool getKeyStateBit( KeyDefType key, Int bit ); ///< get key state bit - UnsignedInt getKeySequenceData( KeyDefType key ); ///< get key sequence void setKeyStateData( KeyDefType key, UnsignedByte data ); ///< get key state UnsignedShort m_modifiers; @@ -161,7 +164,6 @@ class Keyboard : public SubsystemInterface WideChar shifted2; } m_keyNames[ KEY_COUNT ]; - UnsignedInt m_inputFrame; ///< frame input was gathered on }; diff --git a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h b/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h index 91522d87b1a..619f9bea85e 100644 --- a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h +++ b/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h @@ -76,12 +76,12 @@ class LookAtTranslator : public GameMessageTranslator Bool m_isRotating; // set to true if we are in the act of MMB rotating Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation Bool m_isChangingFOV; // set to true if we are in the act of changing the field of view - UnsignedInt m_timestamp; // set when button goes down + UnsignedInt m_middleButtonDownTimeMsec; // real-time in milliseconds when middle button goes down DrawableID m_lastPlaneID; ViewLocation m_viewLocation[ MAX_VIEW_LOCS ]; ScrollType m_scrollType; ScreenEdgeScrollMode m_screenEdgeScrollMode; - UnsignedInt m_lastMouseMoveFrame; + UnsignedInt m_lastMouseMoveTimeMsec; // real-time in milliseconds when mouse last moved void setScrolling( ScrollType scrollType ); void stopScrolling( void ); diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 92fd80497c6..07583b79f78 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -62,6 +62,7 @@ enum GameMode CPP_11(: Int); enum MouseButtonState CPP_11(: Int) { + MBS_None = -1, MBS_Up = 0, MBS_Down, MBS_DoubleClick, @@ -105,17 +106,14 @@ struct MouseIO user while - is down/toward user */ ICoord2D deltaPos; ///< overall change in mouse pointer this frame - MouseButtonState leftState; // button state: Up, Down, DoubleClick (Which is also down) + MouseButtonState leftState; // button state: None (no event), Up, Down, DoubleClick Int leftEvent; // Most important event this frame - Int leftFrame; // last frame button state changed MouseButtonState rightState; Int rightEvent; - Int rightFrame; MouseButtonState middleState; Int middleEvent; - Int middleFrame; }; class CursorInfo @@ -393,9 +391,6 @@ class Mouse : public SubsystemInterface Int m_minY; ///< mouse is locked to this region Int m_maxY; ///< mouse is locked to this region - UnsignedInt m_inputFrame; ///< frame input was gathered on - UnsignedInt m_deadInputFrame; ///< Frame which last input occured - Bool m_inputMovesAbsolute; /**< if TRUE, when processing mouse position chanages the movement will be done treating the coords as ABSOLUTE positions and NOT diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index 5eb6a69ccec..3e69d321a36 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -140,7 +140,12 @@ void Keyboard::updateKeys( void ) m_keyStatus[ m_keys[ index ].key ].state = m_keys[ index ].state; m_keyStatus[ m_keys[ index ].key ].status = m_keys[ index ].status; - m_keyStatus[ m_keys[ index ].key ].sequence = m_inputFrame; + + // Update key down time for new key presses + if( BitIsSet( m_keys[ index ].state, KEY_STATE_DOWN ) ) + { + m_keyStatus[ m_keys[ index ].key ].keyDownTimeMsec = m_keys[ index ].keyDownTimeMsec; + } // prevent ALT-TAB from causing a TAB event if( m_keys[ index ].key == KEY_TAB ) @@ -195,7 +200,7 @@ void Keyboard::updateKeys( void ) } //------------------------------------------------------------------------------------------------- -/** check key repeat sequences, TRUE is returned if repeat is occurring */ +/** check key repeat timing, TRUE is returned if repeat is occurring */ //------------------------------------------------------------------------------------------------- Bool Keyboard::checkKeyRepeat( void ) { @@ -220,7 +225,13 @@ Bool Keyboard::checkKeyRepeat( void ) if( BitIsSet( m_keyStatus[ key ].state, KEY_STATE_DOWN ) ) { - if( (m_inputFrame - m_keyStatus[ key ].sequence) > Keyboard::KEY_REPEAT_DELAY ) + const UnsignedInt now = timeGetTime(); + const UnsignedInt keyDownTime = m_keyStatus[ key ].keyDownTimeMsec; + + // Unsigned subtraction handles wraparound correctly + const UnsignedInt elapsedMsec = now - keyDownTime; + + if( elapsedMsec > Keyboard::KEY_REPEAT_DELAY_MSEC ) { // Add key to this frame m_keys[ index ].key = (UnsignedByte)key; @@ -232,10 +243,10 @@ Bool Keyboard::checkKeyRepeat( void ) // Set all keys as new to prevent multiple keys repeating for( index = 0; index< NUM_KEYS; index++ ) - m_keyStatus[ index ].sequence = m_inputFrame; + m_keyStatus[ index ].keyDownTimeMsec = now; - // Set repeated key so it will repeat again in two frames - m_keyStatus[ key ].sequence = m_inputFrame - (Keyboard::KEY_REPEAT_DELAY + 2); + // Set repeated key so it will repeat again after the interval + m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + Keyboard::KEY_REPEAT_INTERVAL_MSEC); retVal = TRUE; break; // exit for key @@ -694,7 +705,6 @@ Keyboard::Keyboard( void ) m_shift2Key = KEY_NONE; memset( m_keyNames, 0, sizeof( m_keyNames ) ); - m_inputFrame = 0; } @@ -714,9 +724,6 @@ void Keyboard::init( void ) // initialize the key names initKeyNames(); - // first input frame - m_inputFrame = 0; - } //------------------------------------------------------------------------------------------------- @@ -733,9 +740,6 @@ void Keyboard::reset( void ) void Keyboard::update( void ) { - // increment input frame - m_inputFrame++; - // update the key data updateKeys(); @@ -819,14 +823,6 @@ Bool Keyboard::getKeyStateBit( KeyDefType key, Int bit ) return (m_keyStatus[ key ].state & bit) ? 1 : 0; } -//------------------------------------------------------------------------------------------------- -/** return the sequence data for the given key */ -//------------------------------------------------------------------------------------------------- -UnsignedInt Keyboard::getKeySequenceData( KeyDefType key ) -{ - return m_keyStatus[ key ].sequence; -} - //------------------------------------------------------------------------------------------------- /** set the key status data */ //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 903a52b8a20..8f02f88d27a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -183,9 +183,6 @@ void Mouse::updateMouseData( ) else m_eventsThisFrame = 0; - if( index != 0 ) - m_deadInputFrame = m_inputFrame; - } //------------------------------------------------------------------------------------------------- @@ -221,7 +218,7 @@ void Mouse::processMouseEvent( Int index ) m_currMouse.wheelPos += m_mouseEvents[ index ].wheelPos; // Check Left Mouse State - if( m_mouseEvents[ index ].leftFrame ) + if( m_mouseEvents[ index ].leftState != MBS_None ) { if( m_currMouse.leftState != m_mouseEvents[ index ].leftState ) { @@ -231,21 +228,18 @@ void Mouse::processMouseEvent( Int index ) // Mouse Down m_currMouse.leftEvent = GWM_LEFT_DOWN; m_currMouse.leftState = MBS_Down; - m_currMouse.leftFrame = m_inputFrame; } else if ( m_mouseEvents[ index ].leftState == MBS_DoubleClick ) { // Mouse Double Click m_currMouse.leftEvent = GWM_LEFT_DOUBLE_CLICK; m_currMouse.leftState = MBS_DoubleClick; - m_currMouse.leftFrame = m_inputFrame; } else { // Mouse Up m_currMouse.leftEvent = GWM_LEFT_UP; m_currMouse.leftState = MBS_Up; - m_currMouse.leftFrame = m_inputFrame; } } } @@ -257,7 +251,7 @@ void Mouse::processMouseEvent( Int index ) } // Check Right Mouse State - if( m_mouseEvents[ index ].rightFrame ) + if( m_mouseEvents[ index ].rightState != MBS_None ) { if( m_currMouse.rightState != m_mouseEvents[ index ].rightState ) { @@ -267,21 +261,18 @@ void Mouse::processMouseEvent( Int index ) // Mouse Down m_currMouse.rightEvent = GWM_RIGHT_DOWN; m_currMouse.rightState = MBS_Down; - m_currMouse.rightFrame = m_inputFrame; } else if( m_mouseEvents[ index ].rightState == MBS_DoubleClick ) { // Mouse Double Click m_currMouse.rightEvent = GWM_RIGHT_DOUBLE_CLICK; m_currMouse.rightState = MBS_DoubleClick; - m_currMouse.rightFrame = m_inputFrame; } else { // Mouse Up m_currMouse.rightEvent = GWM_RIGHT_UP; m_currMouse.rightState = MBS_Up; - m_currMouse.rightFrame = m_inputFrame; } } } @@ -293,7 +284,7 @@ void Mouse::processMouseEvent( Int index ) } // Check Middle Mouse State - if( m_mouseEvents[ index ].middleFrame ) + if( m_mouseEvents[ index ].middleState != MBS_None ) { if( m_currMouse.middleState != m_mouseEvents[index].middleState ) { @@ -302,20 +293,17 @@ void Mouse::processMouseEvent( Int index ) { m_currMouse.middleEvent = GWM_MIDDLE_DOWN; m_currMouse.middleState = MBS_Down; - m_currMouse.middleFrame = m_inputFrame; } else if( m_mouseEvents[index].middleState == MBS_DoubleClick ) { m_currMouse.middleEvent = GWM_MIDDLE_DOUBLE_CLICK; m_currMouse.middleState = MBS_DoubleClick; - m_currMouse.middleFrame = m_inputFrame; } else { // Mouse Up m_currMouse.middleEvent = GWM_MIDDLE_UP; m_currMouse.middleState = MBS_Up; - m_currMouse.middleFrame = m_inputFrame; } } } @@ -328,7 +316,7 @@ void Mouse::processMouseEvent( Int index ) m_currMouse.deltaPos.x = m_currMouse.pos.x - m_prevMouse.pos.x; m_currMouse.deltaPos.y = m_currMouse.pos.y - m_prevMouse.pos.y; -// DEBUG_LOG(("Mouse dx %d, dy %d, index %d, frame %d", m_currMouse.deltaPos.x, m_currMouse.deltaPos.y, index, m_inputFrame)); +// DEBUG_LOG(("Mouse dx %d, dy %d, index %d", m_currMouse.deltaPos.x, m_currMouse.deltaPos.y, index)); // // check if mouse is still and flag tooltip // if( ((dx*dx) + (dy*dy)) < CURSOR_MOVE_TOL_SQ ) // { @@ -474,9 +462,6 @@ Mouse::Mouse( void ) m_maxY = 0; m_eventsThisFrame = 0; - m_inputFrame = 0; - m_deadInputFrame =0; - m_inputMovesAbsolute = FALSE; m_currentCursor = ARROW; @@ -590,9 +575,6 @@ void Mouse::init( void ) m_minY = 0; m_maxY = 599; - m_inputFrame = 0; - m_deadInputFrame =0; - m_inputMovesAbsolute = FALSE; m_eventsThisFrame = 0; @@ -676,9 +658,6 @@ void Mouse::reset( void ) void Mouse::update( void ) { - // increment input frame - m_inputFrame++; - // update the mouse data updateMouseData( ); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 1f0d4e7cc7a..761992f7438 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -137,9 +137,9 @@ LookAtTranslator::LookAtTranslator() : m_isRotating(false), m_isPitching(false), m_isChangingFOV(false), - m_timestamp(0), + m_middleButtonDownTimeMsec(0), m_lastPlaneID(INVALID_DRAWABLE_ID), - m_lastMouseMoveFrame(0), + m_lastMouseMoveTimeMsec(0), m_scrollType(SCROLL_NONE) { m_anchor.x = m_anchor.y = 0; @@ -171,13 +171,12 @@ const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) Bool LookAtTranslator::hasMouseMovedRecently( void ) { - if (m_lastMouseMoveFrame > TheGameLogic->getFrame()) - m_lastMouseMoveFrame = 0; // reset for new game + const UnsignedInt now = timeGetTime(); + const UnsignedInt lastMove = m_lastMouseMoveTimeMsec; - if (m_lastMouseMoveFrame + LOGICFRAMES_PER_SECOND < TheGameLogic->getFrame()) - return false; + const UnsignedInt elapsedMsec = now - lastMove; - return true; + return elapsedMsec <= MSEC_PER_SECOND; } void LookAtTranslator::setCurrentPos( const ICoord2D& pos ) @@ -256,7 +255,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); m_anchor = msg->getArgument( 0 )->pixel; m_currentPos = msg->getArgument( 0 )->pixel; @@ -272,7 +271,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); if (m_scrollType == SCROLL_RMB) { @@ -284,23 +283,25 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + const UnsignedInt now = timeGetTime(); + m_lastMouseMoveTimeMsec = now; + m_middleButtonDownTimeMsec = now; m_isRotating = true; m_anchor = msg->getArgument( 0 )->pixel; m_anchorAngle = TheTacticalView->getAngle(); m_originalAnchor = msg->getArgument( 0 )->pixel; m_currentPos = msg->getArgument( 0 )->pixel; - m_timestamp = TheGameClient->getFrame(); break; } //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + const UnsignedInt now = timeGetTime(); + m_lastMouseMoveTimeMsec = now; - const UnsignedInt CLICK_DURATION = 5; + const UnsignedInt CLICK_DURATION_MSEC = 167; const UnsignedInt PIXEL_OFFSET = 5; m_isRotating = false; @@ -308,8 +309,11 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage if (dx<0) dx = -dx; Int dy = m_currentPos.y-m_originalAnchor.y; Bool didMove = dx>PIXEL_OFFSET || dy>PIXEL_OFFSET; + + const UnsignedInt elapsedMsec = now - m_middleButtonDownTimeMsec; + // if middle button is "clicked", reset to "home" orientation - if (!didMove && TheGameClient->getFrame() - m_timestamp < CLICK_DURATION) + if (!didMove && elapsedMsec < CLICK_DURATION_MSEC) { TheTacticalView->setAngleAndPitchToDefault(); TheTacticalView->setZoomToDefault(); @@ -322,7 +326,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_RAW_MOUSE_POSITION: { if (m_currentPos.x != msg->getArgument( 0 )->pixel.x || m_currentPos.y != msg->getArgument( 0 )->pixel.y) - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); m_currentPos = msg->getArgument( 0 )->pixel; @@ -402,7 +406,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_WHEEL: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); Int spin = msg->getArgument( 1 )->integer; diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index 6bc06e14eaf..f0b7d39b155 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -251,7 +251,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) HRESULT hr; assert( key ); - key->sequence = 0; key->key = KEY_NONE; if( m_pKeyboardDevice ) @@ -315,15 +314,20 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) // set the key key->key = (UnsignedByte)(kbdat.dwOfs & 0xFF); - // sequence - key->sequence = kbdat.dwSequence; - // // state of key, note we are setting the key state here with an assignment // and not a bit set of the up/down state, this is the "start" // of building this "key" // - key->state = (( kbdat.dwData & 0x0080 ) ? KEY_STATE_DOWN : KEY_STATE_UP); + if( kbdat.dwData & 0x0080 ) + { + key->state = KEY_STATE_DOWN; + key->keyDownTimeMsec = kbdat.dwTimeStamp; + } + else + { + key->state = KEY_STATE_UP; + } // set status as unused (unprocessed) key->status = KeyboardIO::STATUS_UNUSED; diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 56eadc80fb2..0df595f04ca 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -202,7 +202,7 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) /* set these to defaults */ result->leftState = result->middleState = result->rightState = FALSE; - result->leftFrame = result->middleFrame = result->rightFrame = 0; + result->leftState = result->middleState = result->rightState = MBS_None; result->pos.x = result->pos.y = result->wheelPos = 0; if( m_pMouseDevice ) @@ -282,18 +282,15 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, switch( mdat->dwOfs ) { case DIMOFS_BUTTON0: - mouse->leftState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->leftFrame = mdat->dwSequence; + mouse->leftState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON1: - mouse->rightState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->rightFrame = mdat->dwSequence; + mouse->rightState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON2: - mouse->middleState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->middleFrame = mdat->dwSequence; + mouse->middleState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON3: diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index 5f84cca905b..533c0d908a9 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -85,21 +85,9 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) UINT msg = m_eventBuffer[ eventIndex ].msg; WPARAM wParam = m_eventBuffer[ eventIndex ].wParam; LPARAM lParam = m_eventBuffer[ eventIndex ].lParam; - UnsignedInt frame; - - // - // get the current input frame from the client, if we don't have - // a client (like in the GUI editor) we just use frame 1 so it - // registers with the system - // - if( TheGameClient ) - frame = TheGameClient->getFrame(); - else - frame = 1; // set these to defaults - result->leftState = result->middleState = result->rightState = MBS_Up; - result->leftFrame = result->middleFrame = result->rightFrame = 0; + result->leftState = result->middleState = result->rightState = MBS_None; result->pos.x = result->pos.y = result->wheelPos = 0; // Time is the same for all events @@ -113,7 +101,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_Down; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -125,7 +112,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_Up; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -137,7 +123,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_DoubleClick; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -149,7 +134,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_Down; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -161,7 +145,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_Up; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -173,7 +156,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_DoubleClick; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -185,7 +167,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_Down; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -197,7 +178,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_Up; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -209,7 +189,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_DoubleClick; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h index fa54abe2265..79a11a6d82d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h @@ -76,7 +76,7 @@ struct KeyboardIO UnsignedByte key; // KeyDefType, key data UnsignedByte status; // StatusType, above UnsignedShort state; // KEY_STATE_* in KeyDefs.h - UnsignedInt sequence; // sequence info from DirectX used for order + UnsignedInt keyDownTimeMsec; // real-time in milliseconds when key went down }; @@ -86,7 +86,11 @@ struct KeyboardIO class Keyboard : public SubsystemInterface { - enum { KEY_REPEAT_DELAY = 10 }; + enum + { + KEY_REPEAT_DELAY_MSEC = 333, // 10 frames at 30 FPS + KEY_REPEAT_INTERVAL_MSEC = 67 // ~2 frames at 30 FPS + }; public: @@ -133,7 +137,6 @@ class Keyboard : public SubsystemInterface Bool checkKeyRepeat( void ); ///< check for repeating keys UnsignedByte getKeyStatusData( KeyDefType key ); ///< get key status Bool getKeyStateBit( KeyDefType key, Int bit ); ///< get key state bit - UnsignedInt getKeySequenceData( KeyDefType key ); ///< get key sequence void setKeyStateData( KeyDefType key, UnsignedByte data ); ///< get key state UnsignedShort m_modifiers; @@ -161,7 +164,6 @@ class Keyboard : public SubsystemInterface WideChar shifted2; } m_keyNames[ KEY_COUNT ]; - UnsignedInt m_inputFrame; ///< frame input was gathered on }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h index e91b98f66ec..db162de3ede 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h @@ -76,12 +76,12 @@ class LookAtTranslator : public GameMessageTranslator Bool m_isRotating; // set to true if we are in the act of MMB rotating Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation Bool m_isChangingFOV; // set to true if we are in the act of changing the field of view - UnsignedInt m_timestamp; // set when button goes down + UnsignedInt m_middleButtonDownTimeMsec; // real-time in milliseconds when middle button goes down DrawableID m_lastPlaneID; ViewLocation m_viewLocation[ MAX_VIEW_LOCS ]; ScrollType m_scrollType; ScreenEdgeScrollMode m_screenEdgeScrollMode; - UnsignedInt m_lastMouseMoveFrame; + UnsignedInt m_lastMouseMoveTimeMsec; // real-time in milliseconds when mouse last moved void setScrolling( ScrollType scrollType ); void stopScrolling( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index abd5c0c403d..6170da909f1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -62,6 +62,7 @@ enum GameMode CPP_11(: Int); enum MouseButtonState CPP_11(: Int) { + MBS_None = -1, MBS_Up = 0, MBS_Down, MBS_DoubleClick, @@ -105,17 +106,14 @@ struct MouseIO user while - is down/toward user */ ICoord2D deltaPos; ///< overall change in mouse pointer this frame - MouseButtonState leftState; // button state: Up, Down, DoubleClick (Which is also down) + MouseButtonState leftState; // button state: None (no event), Up, Down, DoubleClick Int leftEvent; // Most important event this frame - Int leftFrame; // last frame button state changed MouseButtonState rightState; Int rightEvent; - Int rightFrame; MouseButtonState middleState; Int middleEvent; - Int middleFrame; }; class CursorInfo @@ -394,9 +392,6 @@ class Mouse : public SubsystemInterface Int m_minY; ///< mouse is locked to this region Int m_maxY; ///< mouse is locked to this region - UnsignedInt m_inputFrame; ///< frame input was gathered on - UnsignedInt m_deadInputFrame; ///< Frame which last input occured - Bool m_inputMovesAbsolute; /**< if TRUE, when processing mouse position chanages the movement will be done treating the coords as ABSOLUTE positions and NOT diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index bb151a18d78..9ef9c3b1423 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -140,7 +140,12 @@ void Keyboard::updateKeys( void ) m_keyStatus[ m_keys[ index ].key ].state = m_keys[ index ].state; m_keyStatus[ m_keys[ index ].key ].status = m_keys[ index ].status; - m_keyStatus[ m_keys[ index ].key ].sequence = m_inputFrame; + + // Update key down time for new key presses + if( BitIsSet( m_keys[ index ].state, KEY_STATE_DOWN ) ) + { + m_keyStatus[ m_keys[ index ].key ].keyDownTimeMsec = m_keys[ index ].keyDownTimeMsec; + } // prevent ALT-TAB from causing a TAB event if( m_keys[ index ].key == KEY_TAB ) @@ -195,7 +200,7 @@ void Keyboard::updateKeys( void ) } //------------------------------------------------------------------------------------------------- -/** check key repeat sequences, TRUE is returned if repeat is occurring */ +/** check key repeat timing, TRUE is returned if repeat is occurring */ //------------------------------------------------------------------------------------------------- Bool Keyboard::checkKeyRepeat( void ) { @@ -220,7 +225,11 @@ Bool Keyboard::checkKeyRepeat( void ) if( BitIsSet( m_keyStatus[ key ].state, KEY_STATE_DOWN ) ) { - if( (m_inputFrame - m_keyStatus[ key ].sequence) > Keyboard::KEY_REPEAT_DELAY ) + const UnsignedInt now = timeGetTime(); + const UnsignedInt keyDownTime = m_keyStatus[ key ].keyDownTimeMsec; + const UnsignedInt elapsedMsec = now - keyDownTime; + + if( elapsedMsec > Keyboard::KEY_REPEAT_DELAY_MSEC ) { // Add key to this frame m_keys[ index ].key = (UnsignedByte)key; @@ -232,10 +241,10 @@ Bool Keyboard::checkKeyRepeat( void ) // Set all keys as new to prevent multiple keys repeating for( index = 0; index< NUM_KEYS; index++ ) - m_keyStatus[ index ].sequence = m_inputFrame; + m_keyStatus[ index ].keyDownTimeMsec = now; - // Set repeated key so it will repeat again in two frames - m_keyStatus[ key ].sequence = m_inputFrame - (Keyboard::KEY_REPEAT_DELAY + 2); + // Set repeated key so it will repeat again after the interval + m_keyStatus[ key ].keyDownTimeMsec = now - (Keyboard::KEY_REPEAT_DELAY_MSEC + Keyboard::KEY_REPEAT_INTERVAL_MSEC); retVal = TRUE; break; // exit for key @@ -694,7 +703,6 @@ Keyboard::Keyboard( void ) m_shift2Key = KEY_NONE; memset( m_keyNames, 0, sizeof( m_keyNames ) ); - m_inputFrame = 0; } @@ -714,9 +722,6 @@ void Keyboard::init( void ) // initialize the key names initKeyNames(); - // first input frame - m_inputFrame = 0; - } //------------------------------------------------------------------------------------------------- @@ -733,9 +738,6 @@ void Keyboard::reset( void ) void Keyboard::update( void ) { - // increment input frame - m_inputFrame++; - // update the key data updateKeys(); @@ -819,14 +821,6 @@ Bool Keyboard::getKeyStateBit( KeyDefType key, Int bit ) return (m_keyStatus[ key ].state & bit) ? 1 : 0; } -//------------------------------------------------------------------------------------------------- -/** return the sequence data for the given key */ -//------------------------------------------------------------------------------------------------- -UnsignedInt Keyboard::getKeySequenceData( KeyDefType key ) -{ - return m_keyStatus[ key ].sequence; -} - //------------------------------------------------------------------------------------------------- /** set the key status data */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index db0e9c745f2..2310d9ccc6c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -183,9 +183,6 @@ void Mouse::updateMouseData( ) else m_eventsThisFrame = 0; - if( index != 0 ) - m_deadInputFrame = m_inputFrame; - } //------------------------------------------------------------------------------------------------- @@ -221,7 +218,7 @@ void Mouse::processMouseEvent( Int index ) m_currMouse.wheelPos += m_mouseEvents[ index ].wheelPos; // Check Left Mouse State - if( m_mouseEvents[ index ].leftFrame ) + if( m_mouseEvents[ index ].leftState != MBS_None ) { if( m_currMouse.leftState != m_mouseEvents[ index ].leftState ) { @@ -231,21 +228,18 @@ void Mouse::processMouseEvent( Int index ) // Mouse Down m_currMouse.leftEvent = GWM_LEFT_DOWN; m_currMouse.leftState = MBS_Down; - m_currMouse.leftFrame = m_inputFrame; } else if ( m_mouseEvents[ index ].leftState == MBS_DoubleClick ) { // Mouse Double Click m_currMouse.leftEvent = GWM_LEFT_DOUBLE_CLICK; m_currMouse.leftState = MBS_DoubleClick; - m_currMouse.leftFrame = m_inputFrame; } else { // Mouse Up m_currMouse.leftEvent = GWM_LEFT_UP; m_currMouse.leftState = MBS_Up; - m_currMouse.leftFrame = m_inputFrame; } } } @@ -257,7 +251,7 @@ void Mouse::processMouseEvent( Int index ) } // Check Right Mouse State - if( m_mouseEvents[ index ].rightFrame ) + if( m_mouseEvents[ index ].rightState != MBS_None ) { if( m_currMouse.rightState != m_mouseEvents[ index ].rightState ) { @@ -267,21 +261,18 @@ void Mouse::processMouseEvent( Int index ) // Mouse Down m_currMouse.rightEvent = GWM_RIGHT_DOWN; m_currMouse.rightState = MBS_Down; - m_currMouse.rightFrame = m_inputFrame; } else if( m_mouseEvents[ index ].rightState == MBS_DoubleClick ) { // Mouse Double Click m_currMouse.rightEvent = GWM_RIGHT_DOUBLE_CLICK; m_currMouse.rightState = MBS_DoubleClick; - m_currMouse.rightFrame = m_inputFrame; } else { // Mouse Up m_currMouse.rightEvent = GWM_RIGHT_UP; m_currMouse.rightState = MBS_Up; - m_currMouse.rightFrame = m_inputFrame; } } } @@ -293,7 +284,7 @@ void Mouse::processMouseEvent( Int index ) } // Check Middle Mouse State - if( m_mouseEvents[ index ].middleFrame ) + if( m_mouseEvents[ index ].middleState != MBS_None ) { if( m_currMouse.middleState != m_mouseEvents[index].middleState ) { @@ -302,20 +293,17 @@ void Mouse::processMouseEvent( Int index ) { m_currMouse.middleEvent = GWM_MIDDLE_DOWN; m_currMouse.middleState = MBS_Down; - m_currMouse.middleFrame = m_inputFrame; } else if( m_mouseEvents[index].middleState == MBS_DoubleClick ) { m_currMouse.middleEvent = GWM_MIDDLE_DOUBLE_CLICK; m_currMouse.middleState = MBS_DoubleClick; - m_currMouse.middleFrame = m_inputFrame; } else { // Mouse Up m_currMouse.middleEvent = GWM_MIDDLE_UP; m_currMouse.middleState = MBS_Up; - m_currMouse.middleFrame = m_inputFrame; } } } @@ -328,7 +316,7 @@ void Mouse::processMouseEvent( Int index ) m_currMouse.deltaPos.x = m_currMouse.pos.x - m_prevMouse.pos.x; m_currMouse.deltaPos.y = m_currMouse.pos.y - m_prevMouse.pos.y; -// DEBUG_LOG(("Mouse dx %d, dy %d, index %d, frame %d", m_currMouse.deltaPos.x, m_currMouse.deltaPos.y, index, m_inputFrame)); +// DEBUG_LOG(("Mouse dx %d, dy %d, index %d", m_currMouse.deltaPos.x, m_currMouse.deltaPos.y, index)); // // check if mouse is still and flag tooltip // if( ((dx*dx) + (dy*dy)) < CURSOR_MOVE_TOL_SQ ) // { @@ -474,9 +462,6 @@ Mouse::Mouse( void ) m_maxY = 0; m_eventsThisFrame = 0; - m_inputFrame = 0; - m_deadInputFrame =0; - m_inputMovesAbsolute = FALSE; m_currentCursor = ARROW; @@ -590,9 +575,6 @@ void Mouse::init( void ) m_minY = 0; m_maxY = 599; - m_inputFrame = 0; - m_deadInputFrame =0; - m_inputMovesAbsolute = FALSE; m_eventsThisFrame = 0; @@ -676,9 +658,6 @@ void Mouse::reset( void ) void Mouse::update( void ) { - // increment input frame - m_inputFrame++; - // update the mouse data updateMouseData( ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 8d900a3636e..6168f28233a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -137,9 +137,9 @@ LookAtTranslator::LookAtTranslator() : m_isRotating(false), m_isPitching(false), m_isChangingFOV(false), - m_timestamp(0), + m_middleButtonDownTimeMsec(0), m_lastPlaneID(INVALID_DRAWABLE_ID), - m_lastMouseMoveFrame(0), + m_lastMouseMoveTimeMsec(0), m_scrollType(SCROLL_NONE) { m_anchor.x = m_anchor.y = 0; @@ -171,13 +171,12 @@ const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) Bool LookAtTranslator::hasMouseMovedRecently( void ) { - if (m_lastMouseMoveFrame > TheGameLogic->getFrame()) - m_lastMouseMoveFrame = 0; // reset for new game + const UnsignedInt now = timeGetTime(); + const UnsignedInt lastMove = m_lastMouseMoveTimeMsec; - if (m_lastMouseMoveFrame + LOGICFRAMES_PER_SECOND < TheGameLogic->getFrame()) - return false; + const UnsignedInt elapsedMsec = now - lastMove; - return true; + return elapsedMsec <= MSEC_PER_SECOND; } void LookAtTranslator::setCurrentPos( const ICoord2D& pos ) @@ -256,7 +255,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); m_anchor = msg->getArgument( 0 )->pixel; m_currentPos = msg->getArgument( 0 )->pixel; @@ -271,7 +270,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); if (m_scrollType == SCROLL_RMB) { @@ -283,23 +282,25 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_DOWN: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + const UnsignedInt now = timeGetTime(); + m_lastMouseMoveTimeMsec = now; + m_middleButtonDownTimeMsec = now; m_isRotating = true; m_anchor = msg->getArgument( 0 )->pixel; m_anchorAngle = TheTacticalView->getAngle(); m_originalAnchor = msg->getArgument( 0 )->pixel; m_currentPos = msg->getArgument( 0 )->pixel; - m_timestamp = TheGameClient->getFrame(); break; } //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_MIDDLE_BUTTON_UP: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + const UnsignedInt now = timeGetTime(); + m_lastMouseMoveTimeMsec = now; - const UnsignedInt CLICK_DURATION = 5; + const UnsignedInt CLICK_DURATION_MSEC = 167; const UnsignedInt PIXEL_OFFSET = 5; m_isRotating = false; @@ -307,8 +308,11 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage if (dx<0) dx = -dx; Int dy = m_currentPos.y-m_originalAnchor.y; Bool didMove = dx>PIXEL_OFFSET || dy>PIXEL_OFFSET; + + const UnsignedInt elapsedMsec = now - m_middleButtonDownTimeMsec; + // if middle button is "clicked", reset to "home" orientation - if (!didMove && TheGameClient->getFrame() - m_timestamp < CLICK_DURATION) + if (!didMove && elapsedMsec < CLICK_DURATION_MSEC) { TheTacticalView->setAngleAndPitchToDefault(); TheTacticalView->setZoomToDefault(); @@ -321,7 +325,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_RAW_MOUSE_POSITION: { if (m_currentPos.x != msg->getArgument( 0 )->pixel.x || m_currentPos.y != msg->getArgument( 0 )->pixel.y) - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); m_currentPos = msg->getArgument( 0 )->pixel; @@ -401,7 +405,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_WHEEL: { - m_lastMouseMoveFrame = TheGameLogic->getFrame(); + m_lastMouseMoveTimeMsec = timeGetTime(); Int spin = msg->getArgument( 1 )->integer; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index 027a95f479d..0591902e29f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -251,7 +251,6 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) HRESULT hr; assert( key ); - key->sequence = 0; key->key = KEY_NONE; if( m_pKeyboardDevice ) @@ -315,15 +314,20 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) // set the key key->key = (UnsignedByte)(kbdat.dwOfs & 0xFF); - // sequence - key->sequence = kbdat.dwSequence; - // // state of key, note we are setting the key state here with an assignment // and not a bit set of the up/down state, this is the "start" // of building this "key" // - key->state = (( kbdat.dwData & 0x0080 ) ? KEY_STATE_DOWN : KEY_STATE_UP); + if( kbdat.dwData & 0x0080 ) + { + key->state = KEY_STATE_DOWN; + key->keyDownTimeMsec = kbdat.dwTimeStamp; + } + else + { + key->state = KEY_STATE_UP; + } // set status as unused (unprocessed) key->status = KeyboardIO::STATUS_UNUSED; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index e5b195fe6c1..c8b59e10e62 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -202,7 +202,7 @@ UnsignedByte DirectInputMouse::getMouseEvent( MouseIO *result, Bool flush ) /* set these to defaults */ result->leftState = result->middleState = result->rightState = FALSE; - result->leftFrame = result->middleFrame = result->rightFrame = 0; + result->leftState = result->middleState = result->rightState = MBS_None; result->pos.x = result->pos.y = result->wheelPos = 0; if( m_pMouseDevice ) @@ -282,18 +282,15 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, switch( mdat->dwOfs ) { case DIMOFS_BUTTON0: - mouse->leftState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->leftFrame = mdat->dwSequence; + mouse->leftState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON1: - mouse->rightState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->rightFrame = mdat->dwSequence; + mouse->rightState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON2: - mouse->middleState = (( mdat->dwData & 0x0080 ) ? TRUE : FALSE); - mouse->middleFrame = mdat->dwSequence; + mouse->middleState = (( mdat->dwData & 0x0080 ) ? MBS_Down : MBS_Up); break; case DIMOFS_BUTTON3: diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index 9b89deba00d..085bcd461d3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -85,21 +85,9 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) UINT msg = m_eventBuffer[ eventIndex ].msg; WPARAM wParam = m_eventBuffer[ eventIndex ].wParam; LPARAM lParam = m_eventBuffer[ eventIndex ].lParam; - UnsignedInt frame; - - // - // get the current input frame from the client, if we don't have - // a client (like in the GUI editor) we just use frame 1 so it - // registers with the system - // - if( TheGameClient ) - frame = TheGameClient->getFrame(); - else - frame = 1; // set these to defaults - result->leftState = result->middleState = result->rightState = MBS_Up; - result->leftFrame = result->middleFrame = result->rightFrame = 0; + result->leftState = result->middleState = result->rightState = MBS_None; result->pos.x = result->pos.y = result->wheelPos = 0; // Time is the same for all events @@ -113,7 +101,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_Down; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -125,7 +112,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_Up; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -137,7 +123,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->leftState = MBS_DoubleClick; - result->leftFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -149,7 +134,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_Down; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -161,7 +145,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_Up; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -173,7 +156,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->middleState = MBS_DoubleClick; - result->middleFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -185,7 +167,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_Down; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -197,7 +178,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_Up; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; @@ -209,7 +189,6 @@ void Win32Mouse::translateEvent( UnsignedInt eventIndex, MouseIO *result ) { result->rightState = MBS_DoubleClick; - result->rightFrame = frame; result->pos.x = LOWORD( lParam ); result->pos.y = HIWORD( lParam ); break; From 03b9ae8b3d198fa8672d02e09fa4a1faae22e358 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 21 Dec 2025 22:20:40 +1100 Subject: [PATCH 004/211] bugfix(aiupdate): Repairing Chinooks and Helixes no longer take off after evacuating all passengers (#1762) --- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 6 ++++++ .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index eff16860599..173c3f6a2bb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1123,8 +1123,14 @@ void ChinookAIUpdate::privateCombatDrop( Object* target, const Coord3D& pos, Com //------------------------------------------------------------------------------------------------- void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) { +#if RETAIL_COMPATIBLE_CRC // this gets reset every time a command is issued. setAirfieldForHealing(INVALID_ID); +#else + // TheSuperHackers @bugfix Stubbjax 31/10/2025 Don't leave healing state for evacuation commands. + if (parms->m_cmd != AICMD_EVACUATE && parms->m_cmd != AICMD_EXIT) + setAirfieldForHealing(INVALID_ID); +#endif if (!isAllowedToRespondToAiCommands(parms)) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 87f5b42d9db..4490a237dda 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1258,8 +1258,14 @@ void ChinookAIUpdate::privateCombatDrop( Object* target, const Coord3D& pos, Com //------------------------------------------------------------------------------------------------- void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) { +#if RETAIL_COMPATIBLE_CRC // this gets reset every time a command is issued. setAirfieldForHealing(INVALID_ID); +#else + // TheSuperHackers @bugfix Stubbjax 31/10/2025 Don't leave healing state for evacuation commands. + if (parms->m_cmd != AICMD_EVACUATE && parms->m_cmd != AICMD_EXIT) + setAirfieldForHealing(INVALID_ID); +#endif if (!isAllowedToRespondToAiCommands(parms)) return; From 646e3dddb681fe2e6bc0aee1ed3c0c8e58f7bf6e Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 21 Dec 2025 22:20:51 +1100 Subject: [PATCH 005/211] bugfix(aiupdate): Chinooks and Helixes no longer take off after repair if passengers want to board or exit (#1787) --- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 9 +++++++-- .../GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 173c3f6a2bb..60dbd2361e4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1002,9 +1002,16 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); + const ContainModuleInterface* contain = getObject()->getContain(); + const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + if (pp != NULL) { if (m_flightStatus == CHINOOK_LANDED && +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/11/2025 Prevent Chinooks from taking off while there are still units wanting to enter or exit. + !waitingToEnterOrExit && +#endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) { @@ -1026,10 +1033,8 @@ UpdateSleepTime ChinookAIUpdate::update() // when we have a pending command... if (SupplyTruckAIUpdate::isIdle()) { - ContainModuleInterface* contain = getObject()->getContain(); if( contain ) { - Bool waitingToEnterOrExit = contain->hasObjectsWantingToEnterOrExit(); if (m_hasPendingCommand) { AICommandParms parms(AICMD_MOVE_TO_POSITION, CMD_FROM_AI); // values don't matter, will be wiped by next line diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 4490a237dda..dd33e54cbde 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1064,9 +1064,16 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); + const ContainModuleInterface* contain = getObject()->getContain(); + const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); + if (pp != NULL) { if (m_flightStatus == CHINOOK_LANDED && +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 03/11/2025 Prevent Chinooks from taking off while there are still units wanting to enter or exit. + !waitingToEnterOrExit && +#endif !m_hasPendingCommand && getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth()) { @@ -1088,12 +1095,10 @@ UpdateSleepTime ChinookAIUpdate::update() // have to call our parent's isIdle, because we override it to never return true // when we have a pending command... - ContainModuleInterface* contain = getObject()->getContain(); if( contain ) { if (SupplyTruckAIUpdate::isIdle()) { - Bool waitingToEnterOrExit = contain->hasObjectsWantingToEnterOrExit(); if (m_hasPendingCommand) { AICommandParms parms(AICMD_MOVE_TO_POSITION, CMD_FROM_AI); // values don't matter, will be wiped by next line From b878990ab3d030763cabbf7ea777f4b42d73418a Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sun, 21 Dec 2025 12:30:34 -0500 Subject: [PATCH 006/211] refactor: Apply clang-tidy fixes for generals-use-this-instead-of-singleton (#2017) --- .../Source/GameNetwork/FirewallHelper.cpp | 2 +- .../GameSpy/StagingRoomGameInfo.cpp | 4 +- .../Source/GameNetwork/LANAPIhandlers.cpp | 2 +- .../GameClient/Water/W3DWaterTracks.cpp | 4 +- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 20 +- .../Include/GameLogic/PartitionManager.h | 4 +- .../GameEngine/Source/Common/GlobalData.cpp | 2 +- .../Common/System/SaveGame/GameState.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 10 +- .../GUI/ControlBar/ControlBarCommand.cpp | 2 +- .../ControlBarCommandProcessing.cpp | 2 +- .../ControlBarPopupDescription.cpp | 4 +- .../GameClient/GUI/GameWindowManager.cpp | 174 +++++++++--------- .../Source/GameClient/GameClient.cpp | 4 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 84 ++++----- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 2 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 6 +- .../GameLogic/Object/PartitionManager.cpp | 44 ++--- .../Source/GameLogic/Object/Weapon.cpp | 6 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 4 +- .../Source/GameLogic/System/GameLogic.cpp | 14 +- .../GameLogic/System/GameLogicDispatch.cpp | 54 +++--- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 4 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 34 ++-- .../Tools/GUIEdit/Source/HierarchyView.cpp | 2 +- Generals/Code/Tools/GUIEdit/Source/Save.cpp | 4 +- .../Include/GameLogic/PartitionManager.h | 4 +- .../GameEngine/Source/Common/GlobalData.cpp | 2 +- .../Common/System/SaveGame/GameState.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 18 +- .../GUI/ControlBar/ControlBarCommand.cpp | 8 +- .../ControlBarCommandProcessing.cpp | 2 +- .../ControlBarPopupDescription.cpp | 4 +- .../GameClient/GUI/GameWindowManager.cpp | 174 +++++++++--------- .../Source/GameClient/GameClient.cpp | 4 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 84 ++++----- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 2 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 6 +- .../GameLogic/Object/PartitionManager.cpp | 44 ++--- .../Source/GameLogic/Object/Weapon.cpp | 6 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 4 +- .../Source/GameLogic/System/GameLogic.cpp | 14 +- .../GameLogic/System/GameLogicDispatch.cpp | 54 +++--- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 4 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 34 ++-- .../Tools/GUIEdit/Source/HierarchyView.cpp | 2 +- GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp | 4 +- 49 files changed, 487 insertions(+), 487 deletions(-) diff --git a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp index 320b672ee9f..2f0db33a44a 100644 --- a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -508,7 +508,7 @@ void FirewallHelperClass::writeFirewallBehavior(void) numstr = num; (pref)["FirewallBehavior"] = numstr; - TheWritableGlobalData->m_firewallPortAllocationDelta = TheFirewallHelper->getSourcePortAllocationDelta(); + TheWritableGlobalData->m_firewallPortAllocationDelta = getSourcePortAllocationDelta(); num[0] = 0; itoa(TheGlobalData->m_firewallPortAllocationDelta, num, 10); numstr = num; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index dc0aea8b3f3..278f991793a 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -844,7 +844,7 @@ void GameSpyStagingRoom::launchGame( void ) // shutdown the top, but do not pop it off the stack // TheShell->hideShell(); // setup the Global Data with the Map and Seed - TheWritableGlobalData->m_pendingFile = TheGameSpyGame->getMap(); + TheWritableGlobalData->m_pendingFile = getMap(); // send a message to the logic for a new game GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); @@ -861,7 +861,7 @@ void GameSpyStagingRoom::launchGame( void ) req.buddyRequestType = BuddyRequest::BUDDYREQUEST_SETSTATUS; req.arg.status.status = GP_PLAYING; strcpy(req.arg.status.statusString, "Loading"); - sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(TheGameSpyGame->getGameName().str()).c_str()); + sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(getGameName().str()).c_str()); TheGameSpyBuddyMessageQueue->addRequest(req); delete TheNAT; diff --git a/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index d6dbba08238..61660ff964c 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -709,7 +709,7 @@ void LANAPI::handleInActive(LANMessage *msg, UnsignedInt senderIP) { } // don't want to unaccept the host, that's silly. They can't hit start alt-tabbed anyways. - if (senderIP == TheLAN->GetLocalIP()) { + if (senderIP == GetLocalIP()) { return; } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index afc6ed90131..6f34e7e7e78 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -1023,7 +1023,7 @@ void WaterTracksRenderSystem::loadTracks(void) goto tryagain; } - umod=TheWaterTracksRenderSystem->bindTrack(wtype); + umod=bindTrack(wtype); if (umod) { //umod->init(1.5f*MAP_XY_FACTOR,Vector2(0,0),Vector2(1,1),"wave256.tga"); flipU ^= 1; //toggle flip state @@ -1032,7 +1032,7 @@ void WaterTracksRenderSystem::loadTracks(void) if (waveTypeInfo[wtype].m_secondWaveTimeOffset) //check if we need a second wave to follow { - umod=TheWaterTracksRenderSystem->bindTrack(wtype); + umod=bindTrack(wtype); if (umod) { umod->init(waveTypeInfo[wtype].m_finalHeight,waveTypeInfo[wtype].m_finalWidth,startPos,endPos,waveTypeInfo[wtype].m_textureName,waveTypeInfo[wtype].m_secondWaveTimeOffset); diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index a113f4d7eab..d0abc547ba8 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -179,7 +179,7 @@ Bool ImagePacker::validateImages( void ) proceed = DialogBox( ApplicationHInstance, (LPCTSTR)IMAGE_ERRORS, - TheImagePacker->getWindowHandle(), + getWindowHandle(), (DLGPROC)ImageErrorProc ); } @@ -317,7 +317,7 @@ void ImagePacker::writeFinalTextures( void ) DialogBox( ApplicationHInstance, (LPCTSTR)PAGE_ERRORS, - TheImagePacker->getWindowHandle(), + getWindowHandle(), (DLGPROC)PageErrorProc ); } @@ -998,33 +998,33 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) Bool outputAlpha = FALSE; if( IsDlgButtonChecked( dialog, CHECK_ALPHA ) == BST_CHECKED ) outputAlpha = TRUE; - TheImagePacker->setOutputAlpha( outputAlpha ); + setOutputAlpha( outputAlpha ); // get create INI option Bool createINI = FALSE; if( IsDlgButtonChecked( dialog, CHECK_INI ) == BST_CHECKED ) createINI = TRUE; - TheImagePacker->setINICreate( createINI ); + setINICreate( createINI ); // get preview with image option Bool useBitmap = FALSE; if( IsDlgButtonChecked( dialog, CHECK_BITMAP_PREVIEW ) == BST_CHECKED ) useBitmap = TRUE; - TheImagePacker->setUseTexturePreview( useBitmap ); + setUseTexturePreview( useBitmap ); // get option to compress final textures Bool compress = FALSE; if( IsDlgButtonChecked( dialog, CHECK_COMPRESS ) == BST_CHECKED ) compress = TRUE; - TheImagePacker->setCompressTextures( compress ); + setCompressTextures( compress ); // get options for the gap options - TheImagePacker->clearGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB ); + clearGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB ); if( IsDlgButtonChecked( dialog, CHECK_GAP_EXTEND_RGB ) == BST_CHECKED ) - TheImagePacker->setGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB ); - TheImagePacker->clearGapMethod( ImagePacker::GAP_METHOD_GUTTER ); + setGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB ); + clearGapMethod( ImagePacker::GAP_METHOD_GUTTER ); if( IsDlgButtonChecked( dialog, CHECK_GAP_GUTTER ) == BST_CHECKED ) - TheImagePacker->setGapMethod( ImagePacker::GAP_METHOD_GUTTER ); + setGapMethod( ImagePacker::GAP_METHOD_GUTTER ); // get gutter size whether we are using that option or not Int gutter = GetDlgItemInt( dialog, EDIT_GUTTER, NULL, FALSE ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index 18e278bb715..6631616c306 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1321,7 +1321,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot void getCellCenterPos(Int x, Int y, Real& xx, Real& yy); // find the cell that covers the world coords (wx,wy) and return its coords. - void worldToCell(Real wx, Real wy, Int *cx, Int *cy); + void worldToCell(Real wx, Real wy, Int *cx, Int *cy) const; // given a distance in world coords, return the number of cells needed to cover that distance (rounding up) Int worldToCellDist(Real w); @@ -1494,7 +1494,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot }; // ----------------------------------------------------------------------------- -inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) +inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) const { *cx = REAL_TO_INT_FLOOR((wx - m_worldExtents.lo.x) * m_cellSizeInv); *cy = REAL_TO_INT_FLOOR((wy - m_worldExtents.lo.y) * m_cellSizeInv); diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 348374f57fe..24d13f14da8 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -1118,7 +1118,7 @@ void GlobalData::reset( void ) { // get next instance - GlobalData* next = TheWritableGlobalData->m_next; + GlobalData* next = m_next; // delete the head of the global data list (the latest override) delete TheWritableGlobalData; diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index 0d0229142d7..2fd84f01c3c 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -636,7 +636,7 @@ SaveCode GameState::missionSave( void ) desc.format( format, TheGameText->fetch( campaign->m_campaignNameLabel ).str(), missionNumber ); // do an automatic mission save - return TheGameState->saveGame( "", desc, SAVE_FILE_TYPE_MISSION ); + return saveGame( "", desc, SAVE_FILE_TYPE_MISSION ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index dfc5f077e13..75952a05f2b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -188,9 +188,9 @@ void ControlBar::populatePurchaseScience( Player* player ) player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3().isEmpty() || player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8().isEmpty()) return; - commandSet1 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING - commandSet3 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING - commandSet8 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet1 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet3 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet8 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) m_sciencePurchaseWindowsRank1[i]->winHide(TRUE); @@ -2712,7 +2712,7 @@ void ControlBar::showRallyPoint(const Coord3D* loc) marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML // set the marker colors to that of the local player - Player* player = TheControlBar->getCurrentlyViewedPlayer(); + Player* player = getCurrentlyViewedPlayer(); if (player) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) @@ -3258,7 +3258,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) // get command set if(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet().isEmpty() ) return; - commandSet = TheControlBar->findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet = findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING if(!commandSet) return; // populate the button with commands defined diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index f70dcc6612d..a02c6e7dd10 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -270,7 +270,7 @@ void ControlBar::populateCommand( Object *obj ) resetBuildQueueData(); // get command set - commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() ); + commandSet = findCommandSet( obj->getCommandSetString() ); // if no command set match is found hide all the buttons if( commandSet == NULL ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 86b32cd64ec..44f7f28fa00 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -125,7 +125,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // if the button is flashing, tell it to stop flashing commandButton->setFlashCount(0); - TheControlBar->setFlash( FALSE ); + setFlash( FALSE ); if( commandButton->getCommandType() != GUI_COMMAND_EXIT_CONTAINER ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 91483cdfafb..c658188dd09 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -518,7 +518,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, name = TheGameText->fetch("CONTROLBAR:Power"); descrip = TheGameText->fetch("CONTROLBAR:PowerDescription"); - Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer(); + Player* playerToDisplay = getCurrentlyViewedPlayer(); if( playerToDisplay && playerToDisplay->getEnergy() ) { @@ -598,7 +598,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, { return; } - TheControlBar->getBackgroundMarkerPos(&basePos.x, &basePos.y); + getBackgroundMarkerPos(&basePos.x, &basePos.y); ICoord2D curPos, offset; marker->winGetScreenPosition(&curPos.x,&curPos.y); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index de8aa1c0291..2d43ebcc48e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1584,7 +1584,7 @@ void GameWindowManager::winSetLoneWindow( GameWindow *window ) if( m_loneWindow == window ) return; if( m_loneWindow ) - TheWindowManager->winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); + winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); m_loneWindow = window; } @@ -1633,10 +1633,10 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("MessageBoxParent"); - parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); - TheWindowManager->winSetModal( trueParent ); - TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves - TheWindowManager->winSetFocus( parent ); + parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); + winSetModal( trueParent ); + winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + winSetFocus( parent ); // If the user wants the size to be different then the default float ratioX, ratioY = 1; @@ -1680,25 +1680,25 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("ButtonOk"); buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); + GameWindow *buttonOk = winGetWindowFromId(parent, buttonOkID); buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); tempName = menuName; tempName.concat("ButtonYes"); NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); + GameWindow *buttonYes = winGetWindowFromId(parent, buttonYesID); //buttonNo in the second position tempName = menuName; tempName.concat("ButtonNo"); NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); - GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); + GameWindow *buttonNo = winGetWindowFromId(parent, buttonNoID); buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); //and buttonCancel in the third tempName = menuName; tempName.concat("ButtonCancel"); NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); + GameWindow *buttonCancel = winGetWindowFromId(parent, buttonCancelID); buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); //we shouldn't have button OK and Yes on the same dialog @@ -1745,12 +1745,12 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("StaticTextTitle"); NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); + GameWindow *staticTextTitle = winGetWindowFromId(parent, staticTextTitleID); GadgetStaticTextSetText(staticTextTitle,titleString); tempName = menuName; tempName.concat("StaticTextMessage"); NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); + GameWindow *staticTextMessage = winGetWindowFromId(parent, staticTextMessageID); GadgetStaticTextSetText(staticTextMessage,bodyString); // create a structure that will pass the functions to @@ -1794,7 +1794,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, } // create the button window - button = TheWindowManager->winCreate( parent, status, + button = winCreate( parent, status, x, y, width, height, GadgetPushButtonSystem, instData ); @@ -1862,7 +1862,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, } // create the button window - checkbox = TheWindowManager->winCreate( parent, status, + checkbox = winCreate( parent, status, x, y, width, height, GadgetCheckBoxSystem, instData ); @@ -1929,7 +1929,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, } // create the button window - radioButton = TheWindowManager->winCreate( parent, status, + radioButton = winCreate( parent, status, x, y, width, height, GadgetRadioButtonSystem, instData ); @@ -2001,7 +2001,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, } // create the tab control window - tabControl = TheWindowManager->winCreate( parent, status, + tabControl = winCreate( parent, status, x, y, width, height, GadgetTabControlSystem, instData ); @@ -2395,7 +2395,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, // remove unwanted status bits. status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN); - fontHeight = TheWindowManager->winFontHeight( comboBox->winGetFont() ); + fontHeight = winFontHeight( comboBox->winGetFont() ); top = title ? (fontHeight + 1):0; bottom = title ? (height - (fontHeight + 1)):height; @@ -2418,7 +2418,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); comboBoxData->dropDownButton = - TheWindowManager->gogoGadgetPushButton( comboBox, + gogoGadgetPushButton( comboBox, status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth, 0, buttonWidth, height, @@ -2446,7 +2446,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, statusTextEntry = status | WIN_STATUS_NO_INPUT ;//| WIN_STATUS_NO_FOCUS; comboBoxData->entryData->drawTextFromStart = TRUE; } - comboBoxData->editBox = TheWindowManager->gogoGadgetTextEntry( comboBox, statusTextEntry , + comboBoxData->editBox = gogoGadgetTextEntry( comboBox, statusTextEntry , 0,0 , width - buttonWidth , height , &winInstData, comboBoxData->entryData, @@ -2468,7 +2468,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, BitSet( winInstData.m_style, WIN_STATUS_HIDDEN ); winInstData.m_style |= GWS_SCROLL_LISTBOX; status &= ~(WIN_STATUS_IMAGE); - comboBoxData->listBox = TheWindowManager->gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, + comboBoxData->listBox = gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, width, height, &winInstData, comboBoxData->listboxData, winInstData.m_font, FALSE ); @@ -2545,7 +2545,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, } // create the button window - progressBar = TheWindowManager->winCreate( parent, status, + progressBar = winCreate( parent, status, x, y, width, height, GadgetProgressBarSystem, instData ); @@ -2802,29 +2802,29 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, Bool assignVisual ) { UnsignedByte alpha = 255; - static Color red = TheWindowManager->winMakeColor( 255, 0, 0, alpha ); - static Color darkRed = TheWindowManager->winMakeColor( 128, 0, 0, alpha ); - static Color lightRed = TheWindowManager->winMakeColor( 255, 128, 128, alpha ); - static Color green = TheWindowManager->winMakeColor( 0, 255, 0, alpha ); - static Color darkGreen = TheWindowManager->winMakeColor( 0, 128, 0, alpha ); - static Color lightGreen = TheWindowManager->winMakeColor( 128, 255, 128, alpha ); - static Color blue = TheWindowManager->winMakeColor( 0, 0, 255, alpha ); - static Color darkBlue = TheWindowManager->winMakeColor( 0, 0, 128, alpha ); - static Color lightBlue = TheWindowManager->winMakeColor( 128, 128, 255, alpha ); - static Color purple = TheWindowManager->winMakeColor( 255, 0, 255, alpha ); - static Color darkPurple = TheWindowManager->winMakeColor( 128, 0, 128, alpha ); - static Color lightPurple= TheWindowManager->winMakeColor( 255, 128, 255, alpha ); - static Color yellow = TheWindowManager->winMakeColor( 255, 255, 0, alpha ); - static Color darkYellow = TheWindowManager->winMakeColor( 128, 128, 0, alpha ); - static Color lightYellow= TheWindowManager->winMakeColor( 255, 255, 128, alpha ); - static Color cyan = TheWindowManager->winMakeColor( 0, 255, 255, alpha ); - static Color darkCyan = TheWindowManager->winMakeColor( 64, 128, 128, alpha ); - static Color lightCyan = TheWindowManager->winMakeColor( 128, 255, 255, alpha ); - static Color gray = TheWindowManager->winMakeColor( 128, 128, 128, alpha ); - static Color darkGray = TheWindowManager->winMakeColor( 64, 64, 64, alpha ); - static Color lightGray = TheWindowManager->winMakeColor( 192, 192, 192, alpha ); - static Color black = TheWindowManager->winMakeColor( 0, 0, 0, alpha ); - static Color white = TheWindowManager->winMakeColor( 254, 254, 254, alpha ); + static Color red = winMakeColor( 255, 0, 0, alpha ); + static Color darkRed = winMakeColor( 128, 0, 0, alpha ); + static Color lightRed = winMakeColor( 255, 128, 128, alpha ); + static Color green = winMakeColor( 0, 255, 0, alpha ); + static Color darkGreen = winMakeColor( 0, 128, 0, alpha ); + static Color lightGreen = winMakeColor( 128, 255, 128, alpha ); + static Color blue = winMakeColor( 0, 0, 255, alpha ); + static Color darkBlue = winMakeColor( 0, 0, 128, alpha ); + static Color lightBlue = winMakeColor( 128, 128, 255, alpha ); + static Color purple = winMakeColor( 255, 0, 255, alpha ); + static Color darkPurple = winMakeColor( 128, 0, 128, alpha ); + static Color lightPurple= winMakeColor( 255, 128, 255, alpha ); + static Color yellow = winMakeColor( 255, 255, 0, alpha ); + static Color darkYellow = winMakeColor( 128, 128, 0, alpha ); + static Color lightYellow= winMakeColor( 255, 255, 128, alpha ); + static Color cyan = winMakeColor( 0, 255, 255, alpha ); + static Color darkCyan = winMakeColor( 64, 128, 128, alpha ); + static Color lightCyan = winMakeColor( 128, 255, 255, alpha ); + static Color gray = winMakeColor( 128, 128, 128, alpha ); + static Color darkGray = winMakeColor( 64, 64, 64, alpha ); + static Color lightGray = winMakeColor( 192, 192, 192, alpha ); + static Color black = winMakeColor( 0, 0, 0, alpha ); + static Color white = winMakeColor( 254, 254, 254, alpha ); static Color enabledText = white; static Color enabledTextBorder = darkGray; static Color disabledText = darkGray; @@ -2848,13 +2848,13 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, else { if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { gadget->winSetFont( TheWindowManager->winFindFont( + { gadget->winSetFont( winFindFont( TheGlobalLanguageData->m_defaultWindowFont.name, TheGlobalLanguageData->m_defaultWindowFont.size, TheGlobalLanguageData->m_defaultWindowFont.bold) ); } else - gadget->winSetFont( TheWindowManager->winFindFont( "Times New Roman", 14, FALSE ) ); + gadget->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); } // if we don't want to assign default colors/images get out of here @@ -3676,20 +3676,20 @@ Bool GameWindowManager::initTestGUI( void ) WinInstanceData instData; // make some windows inside each other in the upper left - window = TheWindowManager->winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 255, 254, 255, 255 ) ); - window->winSetEnabledBorderColor( 0 , TheWindowManager->winMakeColor( 0, 0, 0, 255 ) ); - window = TheWindowManager->winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); + window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); + window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); + window = winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 128, 128, 128, 255 ) ); - window->winSetEnabledBorderColor( 0 , TheWindowManager->winMakeColor( 0, 0, 0, 255 ) ); + window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); + window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "What Up?"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 100, 100, 30, @@ -3699,7 +3699,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Enabled"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, WIN_STATUS_ENABLED, 330, 100, 100, 30, @@ -3709,7 +3709,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Disabled"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, 0, 450, 100, 100, 30, @@ -3719,7 +3719,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = TheWindowManager->gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 150, @@ -3730,18 +3730,18 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = TheWindowManager->gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( NULL, WIN_STATUS_ENABLED, 330, 150, 100, 30, &instData, NULL, TRUE ); // make window to hold radio buttons - window = TheWindowManager->winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + window = winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, 200, 200, 250, 45, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 50, 50, 50, 200 ) ); - window->winSetEnabledBorderColor( 0, TheWindowManager->winMakeColor( 254, 254, 254, 255 ) ); + window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); + window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); // make a radio button GameWindow *radio; @@ -3750,7 +3750,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; instData.m_textLabelString = "Mama Said!"; rData.group = 1; - radio = TheWindowManager->gogoGadgetRadioButton( window, + radio = gogoGadgetRadioButton( window, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 10, 10, 100, 30, @@ -3761,7 +3761,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; instData.m_textLabelString = "On the Run"; - radio = TheWindowManager->gogoGadgetRadioButton( window, + radio = gogoGadgetRadioButton( window, WIN_STATUS_ENABLED, 130, 10, 100, 30, @@ -3784,24 +3784,24 @@ Bool GameWindowManager::initTestGUI( void ) listData.columnWidth = NULL; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetListBox( NULL, + window = gogoGadgetListBox( NULL, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, &listData, NULL, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", - TheWindowManager->winMakeColor( 255, 255, 255, 255 ), -1, 0 ); + winMakeColor( 255, 255, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"More text", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, 0 ); + winMakeColor( 105, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Nothing", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, 0 ); + winMakeColor( 105, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Seasons", - TheWindowManager->winMakeColor( 105, 205, 255, 255 ), -1, 0 ); + winMakeColor( 105, 205, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Misery", - TheWindowManager->winMakeColor( 235, 105, 255, 255 ), -1, 0 ); + winMakeColor( 235, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Natural", - TheWindowManager->winMakeColor( 105, 205, 45, 255 ), -1, 0 ); + winMakeColor( 105, 205, 45, 255 ), -1, 0 ); window->winSetFont( TheFontLibrary->getFont( "Times New Roman", 12, FALSE ) ); // make a listbox @@ -3817,24 +3817,24 @@ Bool GameWindowManager::initTestGUI( void ) listData.columnWidth = NULL; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetListBox( NULL, + window = gogoGadgetListBox( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, &listData, NULL, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", - TheWindowManager->winMakeColor( 255, 255, 255, 255 ), -1, -1 ); + winMakeColor( 255, 255, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"More text", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, -1 ); + winMakeColor( 105, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Nothing", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, -1 ); + winMakeColor( 105, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Seasons", - TheWindowManager->winMakeColor( 105, 205, 255, 255 ), -1, -1 ); + winMakeColor( 105, 205, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Misery", - TheWindowManager->winMakeColor( 235, 105, 255, 255 ), -1, -1 ); + winMakeColor( 235, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Natural", - TheWindowManager->winMakeColor( 105, 205, 45, 255 ), -1, -1 ); + winMakeColor( 105, 205, 45, 255 ), -1, -1 ); // make a vert slider SliderData sliderData; @@ -3845,7 +3845,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED, 360, 250, 11, 100, @@ -3860,7 +3860,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 400, 250, 11, 100, @@ -3875,7 +3875,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED, 200, 400, 200, 11, @@ -3890,7 +3890,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 420, 200, 11, @@ -3900,7 +3900,7 @@ Bool GameWindowManager::initTestGUI( void ) // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( NULL, WIN_STATUS_ENABLED, 200, 450, 250, 15, @@ -3909,7 +3909,7 @@ Bool GameWindowManager::initTestGUI( void ) // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 470, 250, 15, @@ -3921,7 +3921,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Centered Static Text"; - window = TheWindowManager->gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( NULL, WIN_STATUS_ENABLED, 200, 490, 300, 25, @@ -3933,14 +3933,14 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Not Centered Static Text"; - window = TheWindowManager->gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, &textData, NULL, TRUE ); - window->winSetEnabledTextColors( TheWindowManager->winMakeColor( 128, 128, 255, 255 ), - TheWindowManager->winMakeColor( 255, 255, 255, 255 ) ); + window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), + winMakeColor( 255, 255, 255, 255 ) ); // make some entry text EntryData entryData; @@ -3949,7 +3949,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = TheWindowManager->gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( NULL, WIN_STATUS_ENABLED, 450, 270, 400, 30, @@ -3962,7 +3962,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = TheWindowManager->gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 450, 310, 400, 30, diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 8f3a55c29cd..6dbf2756c05 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -1072,7 +1072,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) draw->preloadAssets( timeOfDay ); // destroy the drawable - TheGameClient->destroyDrawable( draw ); + destroyDrawable( draw ); } @@ -1496,7 +1496,7 @@ void GameClient::xfer( Xfer *xfer ) const ThingTemplate* drawTemplate = draw->getTemplate(); if (drawTemplate->getFinalOverride() != thingTemplate->getFinalOverride()) { - TheGameClient->destroyDrawable( draw ); + destroyDrawable( draw ); draw = TheThingFactory->newDrawable( thingTemplate ); TheGameLogic->bindObjectAndDrawable(object, draw); } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 32df1e7dd2a..34b0ab6320c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1588,7 +1588,7 @@ void InGameUI::handleBuildPlacements( void ) Int maxObjects = TheGlobalData->m_maxLineBuildObjects; // get the builder object that will be constructing things - Object *builderObject = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() ); + Object *builderObject = TheGameLogic->findObjectByID( getPendingPlaceSourceObjectID() ); // // given the start/end points in the world and the the angle of the wall, fill @@ -2621,7 +2621,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->resetTooltipDelay(); } - if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !TheInGameUI->getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) + if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) { if( m_mousedOverDrawableID != INVALID_DRAWABLE_ID ) { @@ -3359,7 +3359,7 @@ void InGameUI::deselectDrawable( Drawable *draw ) //------------------------------------------------------------------------------------------------- void InGameUI::deselectAllDrawables( Bool postMsg ) { - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables for ( DrawableListCIt it = selected->begin(); it != selected->end(); ) @@ -3369,7 +3369,7 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) Drawable* draw = *it++; // do the deselection - TheInGameUI->deselectDrawable( draw ); + deselectDrawable( draw ); } @@ -4101,38 +4101,38 @@ void InGameUI::displayCantBuildMessage( LegalBuildCode lbc ) //--------------------------------------------------------------------------------------------- case LBC_RESTRICTED_TERRAIN: - TheInGameUI->message( "GUI:CantBuildRestrictedTerrain" ); + message( "GUI:CantBuildRestrictedTerrain" ); break; //--------------------------------------------------------------------------------------------- case LBC_NOT_FLAT_ENOUGH: - TheInGameUI->message( "GUI:CantBuildNotFlatEnough" ); + message( "GUI:CantBuildNotFlatEnough" ); break; //--------------------------------------------------------------------------------------------- case LBC_OBJECTS_IN_THE_WAY: - TheInGameUI->message( "GUI:CantBuildObjectsInTheWay" ); + message( "GUI:CantBuildObjectsInTheWay" ); break; //--------------------------------------------------------------------------------------------- case LBC_TOO_CLOSE_TO_SUPPLIES: - TheInGameUI->message( "GUI:CantBuildTooCloseToSupplies" ); + message( "GUI:CantBuildTooCloseToSupplies" ); break; //--------------------------------------------------------------------------------------------- case LBC_NO_CLEAR_PATH: - TheInGameUI->message( "GUI:CantBuildNoClearPath" ); + message( "GUI:CantBuildNoClearPath" ); break; //--------------------------------------------------------------------------------------------- case LBC_SHROUD: - TheInGameUI->message( "GUI:CantBuildShroud" ); + message( "GUI:CantBuildShroud" ); break; //--------------------------------------------------------------------------------------------- default: - TheInGameUI->message( "GUI:CantBuildThere" ); + message( "GUI:CantBuildThere" ); break; } @@ -4164,7 +4164,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) const int messageTimeout = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * duration)/1000.0f); // disable tooltips until this frame, cause we don't want to collide with the military subtitles. - TheInGameUI->disableTooltipsUntil(messageTimeout); + disableTooltipsUntil(messageTimeout); // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplyer; @@ -4202,7 +4202,7 @@ void InGameUI::removeMilitarySubtitle( void ) if(!m_militarySubtitle) return; - TheInGameUI->clearTooltipsDisabled(); + clearTooltipsDisabled(); // loop through and free up the display strings for(UnsignedInt i = 0; i <= m_militarySubtitle->currentDisplayString; i ++) @@ -4221,7 +4221,7 @@ void InGameUI::removeMilitarySubtitle( void ) // ------------------------------------------------------------------------------------------------ Bool InGameUI::areSelectedObjectsControllable() const { - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables const Drawable *draw; @@ -4278,7 +4278,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4367,7 +4367,7 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4522,7 +4522,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c if (ignoreSelDraw) tmpList.push_back(ignoreSelDraw); - const DrawableList* selected = (!tmpList.empty()) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); + const DrawableList* selected = (!tmpList.empty()) ? &tmpList : getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4588,7 +4588,7 @@ Bool InGameUI::canSelectedObjectsOverrideSpecialPowerDestination( const Coord3D Int qualify = 0; // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables Drawable *other; @@ -4640,7 +4640,7 @@ Bool InGameUI::canSelectedObjectsEffectivelyUseWeapon( const CommandButton *comm } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4857,16 +4857,16 @@ Int InGameUI::selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfM Int numSelected = selectAllUnitsByTypeAcrossRegion(®ion, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } @@ -4891,16 +4891,16 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int numSelected = selectMatchingAcrossRegion(®ion); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } @@ -4912,22 +4912,22 @@ Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMask Int numSelected = selectAllUnitsByTypeAcrossRegion(NULL, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -4941,22 +4941,22 @@ Int InGameUI::selectMatchingAcrossMap() Int numSelected = selectMatchingAcrossRegion(NULL); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -5578,7 +5578,7 @@ void InGameUI::selectNextIdleWorker( void ) } else { - Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); + Drawable *selectedDrawable = getFirstSelectedDrawable(); // TheSuperHackers @tweak Stubbjax 22/07/2025 Idle worker iteration now correctly identifies and // iterates contained idle workers. Previous iteration logic would not go past contained workers, // and was not guaranteed to select top-level containers. diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 5e4c0e8b4de..4d8cd851e95 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -3057,7 +3057,7 @@ ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( Object* attachTo, Bool createSlaves ) { - ParticleSystem* pSystem = TheParticleSystemManager->createParticleSystem(sysTemplate, createSlaves); + ParticleSystem* pSystem = createParticleSystem(sysTemplate, createSlaves); if (pSystem && attachTo) pSystem->attachToObject(attachTo); return pSystem ? pSystem->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 430028eb38e..46ee5001a09 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -707,7 +707,7 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie Real distSqr = ThePartitionManager->getDistanceSquared(me, theEnemy, FROM_BOUNDINGSPHERE_2D); Real dist = sqrt(distSqr); - Int modifier = dist/TheAI->getAiData()->m_attackPriorityDistanceModifier; + Int modifier = dist/getAiData()->m_attackPriorityDistanceModifier; Int modPriority = curPriority-modifier; if (modPriority < 1) modPriority = 1; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index 685cd225583..2a1898c62d3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -2699,7 +2699,7 @@ void TerrainLogic::flattenTerrain(Object *obj) match = true; } if (match) { - totalHeight += TheTerrainLogic->getGroundHeight(testPt.X, testPt.Y); + totalHeight += getGroundHeight(testPt.X, testPt.Y); numSamples++; } } @@ -2710,7 +2710,7 @@ void TerrainLogic::flattenTerrain(Object *obj) // Compare to the height at the building's origin, because setRawMapHeight will only lower, // not raise. jba - Int centerHeight = REAL_TO_INT_FLOOR(TheTerrainLogic->getGroundHeight(pos->x, pos->y)/MAP_HEIGHT_SCALE); + Int centerHeight = REAL_TO_INT_FLOOR(getGroundHeight(pos->x, pos->y)/MAP_HEIGHT_SCALE); if (rawDataHeight>centerHeight) rawDataHeight = centerHeight; for (i=iMin.x; i<=iMax.x; i++) { @@ -2788,7 +2788,7 @@ void TerrainLogic::flattenTerrain(Object *obj) match = true; } if (match) { - totalHeight += TheTerrainLogic->getGroundHeight(testPt.X, testPt.Y); + totalHeight += getGroundHeight(testPt.X, testPt.Y); numSamples++; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 99867369657..cabb37d8144 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -2699,7 +2699,7 @@ void PartitionManager::reset() void PartitionManager::shutdown() { m_updatedSinceLastReset = false; - ThePartitionManager->removeAllDirtyModules(); + removeAllDirtyModules(); #ifdef RTS_DEBUG // the above *should* remove all the touched cells (via unRegisterObject), but let's check: @@ -3074,7 +3074,7 @@ CellShroudStatus PartitionManager::getShroudStatusForPlayer(Int playerIndex, con { Int x, y; - ThePartitionManager->worldToCell( loc->x, loc->y, &x, &y ); + worldToCell( loc->x, loc->y, &x, &y ); return getShroudStatusForPlayer( playerIndex, x, y ); } @@ -3085,7 +3085,7 @@ ObjectShroudStatus PartitionManager::getPropShroudStatusForPlayer(Int playerInde { Int x, y; - ThePartitionManager->worldToCell( loc->x - m_cellSize*0.5f, loc->y - m_cellSize*0.5f, &x, &y ); + worldToCell( loc->x - m_cellSize*0.5f, loc->y - m_cellSize*0.5f, &x, &y ); CellShroudStatus cellStat = getShroudStatusForPlayer( playerIndex, x, y ); if (cellStat != getShroudStatusForPlayer( playerIndex, x+1, y )) { @@ -3805,7 +3805,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, // very small sphere geometry around the point // GeometryInfo geometry( GEOMETRY_SPHERE, TRUE, 5.0f, 5.0f, 5.0f ); - ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( &pos, geometry, angle, true ); + ObjectIterator *iter = iteratePotentialCollisions( &pos, geometry, angle, true ); MemoryPoolObjectHolder hold( iter ); // Bool overlap = FALSE; @@ -3985,9 +3985,9 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, void PartitionManager::doShroudReveal(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4052,9 +4052,9 @@ void PartitionManager::resetPendingUndoShroudRevealQueue() void PartitionManager::undoShroudReveal(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4089,9 +4089,9 @@ void PartitionManager::queueUndoShroudReveal(Real centerX, Real centerY, Real ra void PartitionManager::doShroudCover(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4113,9 +4113,9 @@ void PartitionManager::doShroudCover(Real centerX, Real centerY, Real radius, Pl void PartitionManager::undoShroudCover(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4135,11 +4135,11 @@ void PartitionManager::undoShroudCover(Real centerX, Real centerY, Real radius, void PartitionManager::doThreatAffect( Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4168,11 +4168,11 @@ void PartitionManager::doThreatAffect( Real centerX, Real centerY, Real radius, void PartitionManager::undoThreatAffect( Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4201,11 +4201,11 @@ void PartitionManager::undoThreatAffect( Real centerX, Real centerY, Real radius void PartitionManager::doValueAffect( Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4234,11 +4234,11 @@ void PartitionManager::doValueAffect( Real centerX, Real centerY, Real radius, U void PartitionManager::undoValueAffect( Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4402,7 +4402,7 @@ Int PartitionManager::iterateCellsAlongLine(const Coord3D& pos, const Coord3D& p for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { - PartitionCell* cell = ThePartitionManager->getCellAt(x, y); // might be null if off the edge + PartitionCell* cell = getCellAt(x, y); // might be null if off the edge DEBUG_ASSERTCRASH(cell != NULL, ("off the map")); if (cell) { @@ -4435,7 +4435,7 @@ Int PartitionManager::iterateCellsBreadthFirst(const Coord3D *pos, CellBreadthFi // -1 means error, but we should add a define later for this. Int cellX, cellY; - ThePartitionManager->worldToCell(pos->x, pos->y, &cellX, &cellY); + worldToCell(pos->x, pos->y, &cellX, &cellY); // Note, bool. not Bool, cause bool will cause this to be a bitfield. std::vector bitField; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index d625c5c9ce6..ff1dbf4ed14 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1443,7 +1443,7 @@ WeaponStore::~WeaponStore() //------------------------------------------------------------------------------------------------- void WeaponStore::handleProjectileDetonation(const WeaponTemplate* wt, const Object *source, const Coord3D* pos, WeaponBonusConditionFlags extraBonusFlags) { - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireProjectileDetonationWeapon(source, pos, extraBonusFlags); deleteInstance(w); @@ -1454,7 +1454,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object { if (wt == NULL) return; - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireWeapon(source, pos); deleteInstance(w); @@ -1466,7 +1466,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object //CRCDEBUG_LOG(("WeaponStore::createAndFireTempWeapon() for %s", DescribeObject(source))); if (wt == NULL) return; - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireWeapon(source, target); deleteInstance(w); diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 3430b6352a7..5bb04e08179 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -5830,7 +5830,7 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) AsciiString typeArgument = pAction->getParameter(1)->getString(); // Our argument could be an individual type, or a list name. - const ObjectTypes *types = TheScriptEngine->getObjectTypes(typeArgument); + const ObjectTypes *types = getObjectTypes(typeArgument); if( !types ) { // Lookup failed, so it is just a single type @@ -6379,7 +6379,7 @@ void ScriptEngine::addObjectToCache(Object* pNewObject) if (it->second == NULL) { AsciiString newNameForDead; newNameForDead.format("Reassigning dead object's name '%s' to object (%d) of type '%s'", objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str()); - TheScriptEngine->AppendDebugMessage(newNameForDead, FALSE); + AppendDebugMessage(newNameForDead, FALSE); DEBUG_LOG((newNameForDead.str())); it->second = pNewObject; return; diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 03b6cfda0fb..dbfb2260785 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1540,8 +1540,8 @@ void GameLogic::startNewGame( Bool saveGame ) Region3D extent; TheTerrainLogic->getExtent( &extent ); - TheGameLogic->setWidth( extent.hi.x - extent.lo.x ); - TheGameLogic->setHeight( extent.hi.y - extent.lo.y ); + setWidth( extent.hi.x - extent.lo.x ); + setHeight( extent.hi.y - extent.lo.y ); // anytime the world's size changes, must reset the partition mgr ThePartitionManager->init(); @@ -2733,7 +2733,7 @@ void GameLogic::popSleepyUpdate() void GameLogic::friend_awakenUpdateModule(Object* obj, UpdateModulePtr u, UnsignedInt whenToWakeUp) { //USE_PERF_TIMER(friend_awakenUpdateModule) - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); DEBUG_ASSERTCRASH(whenToWakeUp >= now, ("setWakeFrame frame is in the past... are you sure this is what you want?")); if (u == m_curUpdateModule) @@ -3161,7 +3161,7 @@ void GameLogic::update( void ) } // send the current time to the GameClient - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); TheGameClient->setFrame(now); // update (execute) scripts @@ -3353,7 +3353,7 @@ void GameLogic::preUpdate() Bool pause = TRUE; Bool pauseMusic = FALSE; Bool pauseInput = FALSE; - TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput); + setGamePaused(pause, pauseMusic, pauseInput); } } @@ -3418,7 +3418,7 @@ void GameLogic::registerObject( Object *obj ) // add object to lookup table addObjectToLookupTable( obj ); - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); if (now == 0) now = 1; for (BehaviorModule** b = obj->getBehaviorModules(); *b; ++b) @@ -4637,7 +4637,7 @@ void GameLogic::loadPostProcess( void ) #ifdef ALLOW_NONSLEEPY_UPDATES m_normalUpdates.clear(); #else - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); if (now == 0) now = 1; #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index e556457319b..aa4af7eb541 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -311,7 +311,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank m_background->bringForward(); } m_background->getFirstWindow()->winClearStatus(WIN_STATUS_IMAGE); - TheGameLogic->setGameMode( gameMode ); + setGameMode( gameMode ); if (!TheGlobalData->m_pendingFile.isEmpty()) { TheWritableGlobalData->m_mapName = TheGlobalData->m_pendingFile; @@ -322,7 +322,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank DEBUG_LOG(("GameLogic::prepareNewGame() - m_rankPointsToAddAtGameStart = %d", m_rankPointsToAddAtGameStart)); // If we're about to start a game, hide the shell. - if(!TheGameLogic->isInShellGame()) + if(!isInShellGame()) TheShell->hideShell(); m_startNewGame = FALSE; @@ -457,7 +457,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } currentlySelectedGroup = NULL; - TheGameLogic->clearGameData(); + clearGameData(); break; } @@ -500,7 +500,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_SET_RALLY_POINT: { - Object *obj = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *obj = findObjectByID( msg->getArgument( 0 )->objectID ); Coord3D dest = msg->getArgument( 1 )->location; if (obj) { @@ -529,7 +529,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_COMBATDROP_AT_OBJECT: { - Object *targetObject = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *targetObject = findObjectByID( msg->getArgument( 0 )->objectID ); // issue command for either single object or for selected group if( currentlySelectedGroup ) @@ -581,7 +581,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // Lock the weapon choice to the right weapon, then give an attack command WeaponSlotType weaponSlot = (WeaponSlotType)msg->getArgument( 0 )->integer; - Object *targetObject = TheGameLogic->findObjectByID( msg->getArgument( 1 )->objectID ); + Object *targetObject = findObjectByID( msg->getArgument( 1 )->objectID ); Int maxShotsToFire = msg->getArgument( 2 )->integer; // sanity @@ -654,7 +654,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(2)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -689,14 +689,14 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // Object in way -- if applicable (some specials care, others don't) ObjectID objectID = msg->getArgument( 2 )->objectID; - Object *objectInWay = TheGameLogic->findObjectByID( objectID ); + Object *objectInWay = findObjectByID( objectID ); // Command button options -- special power may care about variance options UnsignedInt options = msg->getArgument( 3 )->integer; // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(4)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -728,7 +728,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // argument 2 is target object ObjectID targetID = msg->getArgument(1)->objectID; - Object *target = TheGameLogic->findObjectByID( targetID ); + Object *target = findObjectByID( targetID ); if( !target ) { break; @@ -739,7 +739,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(3)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -838,7 +838,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_GUARD_OBJECT: { - Object* obj = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object* obj = findObjectByID( msg->getArgument( 0 )->objectID ); if (!obj) break; @@ -972,7 +972,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_ENTER: { - Object *enter = TheGameLogic->findObjectByID( msg->getArgument( 1 )->objectID ); + Object *enter = findObjectByID( msg->getArgument( 1 )->objectID ); // sanity if( enter == NULL ) @@ -991,7 +991,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EXIT: { - Object *objectWantingToExit = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *objectWantingToExit = findObjectByID( msg->getArgument( 0 )->objectID ); #if RETAIL_COMPATIBLE_AIGROUP Object *objectContainingExiter = getSingleObjectFromSelection(currentlySelectedGroup); #else @@ -1081,7 +1081,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_REPAIRED: { - Object *repairDepot = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *repairDepot = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( repairDepot == NULL ) @@ -1098,7 +1098,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DOCK: { - Object *dockBuilding = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *dockBuilding = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( dockBuilding == NULL ) @@ -1115,7 +1115,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_HEALED: { - Object *healDest = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *healDest = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( healDest == NULL ) @@ -1132,7 +1132,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_REPAIR: { - Object *repairTarget = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *repairTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( repairTarget == NULL ) @@ -1152,7 +1152,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_RESUME_CONSTRUCTION: { - Object *constructTarget = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *constructTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( constructTarget == NULL ) @@ -1180,7 +1180,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) SpecialPowerType spType = (SpecialPowerType)msg->getArgument( 1 )->integer; ObjectID sourceID = msg->getArgument(2)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -1207,7 +1207,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACK_OBJECT: { - Object *enemy = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *enemy = findObjectByID( msg->getArgument( 0 )->objectID ); // Check enemy, as it is possible that he died this frame. if (enemy) @@ -1229,7 +1229,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_OBJECT: { - Object *enemy = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *enemy = findObjectByID( msg->getArgument( 0 )->objectID ); // Check enemy, as it is possible that he died this frame. if (enemy) @@ -1565,12 +1565,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Bool firstObject = TRUE; for (Int i = 1; i < msg->getArgumentCount(); ++i) { - Object *obj = TheGameLogic->findObjectByID( msg->getArgument( i )->objectID ); + Object *obj = findObjectByID( msg->getArgument( i )->objectID ); if (!obj) { continue; } - TheGameLogic->selectObject(obj, createNewGroup && firstObject, player->getPlayerMask()); + selectObject(obj, createNewGroup && firstObject, player->getPlayerMask()); firstObject = FALSE; } @@ -1590,12 +1590,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) for (Int i = 0; i < msg->getArgumentCount(); ++i) { ObjectID objID = msg->getArgument(i)->objectID; - Object *objToRemove = TheGameLogic->findObjectByID(objID); + Object *objToRemove = findObjectByID(objID); if (!objToRemove) { continue; } - TheGameLogic->deselectObject(objToRemove, player->getPlayerMask()); + deselectObject(objToRemove, player->getPlayerMask()); } break; @@ -1745,7 +1745,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { if (beacon->getControllingPlayer() == thisPlayer) { - TheGameLogic->destroyObject(beacon); // the owner is telling it to go away. such is life. + destroyObject(beacon); // the owner is telling it to go away. such is life. TheControlBar->markUIDirty(); // check if we should un-grey out the button } diff --git a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp index 7cb45b9e443..fcef3393402 100644 --- a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -658,7 +658,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // if we have ONE window selected and are close to an anchor corner // to resize it change the cursor to resize cursor // - TheEditWindow->handleResizeAvailable( x, y ); + handleResizeAvailable( x, y ); } @@ -894,7 +894,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, } // open right click menu - TheEditWindow->openPopupMenu( clickPos.x, clickPos.y ); + openPopupMenu( clickPos.x, clickPos.y ); break; diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index e5a350b1a91..2faba87eaf7 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -275,10 +275,10 @@ Bool GUIEdit::validateParentForCreate( GameWindow *parent ) // gadgets are units themselves and should have no user defined // children // - if( parent && TheEditor->windowIsGadget( parent ) ) + if( parent && windowIsGadget( parent ) ) { - MessageBox( TheEditor->getWindowHandle(), + MessageBox( getWindowHandle(), "You cannot make a new window as a child to a GUI Gadget Control", "Illegal Parent", MB_OK ); return FALSE; @@ -717,7 +717,7 @@ void GUIEdit::update( void ) TheMouse->update(); // process the mouse if we're in test mode - if( TheEditor->getMode() == MODE_TEST_RUN ) + if( getMode() == MODE_TEST_RUN ) { // send input through the window system and clear all messages after @@ -762,12 +762,12 @@ Bool GUIEdit::writeConfigFile( const char *filename ) backColor.red, backColor.green, backColor.blue, backColor.alpha ); // grid settings - fprintf( fp, "GRIDRESOLUTION = %d\n", TheEditor->getGridResolution() ); - RGBColorInt *gridColor = TheEditor->getGridColor(); + fprintf( fp, "GRIDRESOLUTION = %d\n", getGridResolution() ); + RGBColorInt *gridColor = getGridColor(); fprintf( fp, "GRIDCOLOR = %d %d %d %d\n", gridColor->red, gridColor->green, gridColor->blue, gridColor->alpha ); - fprintf( fp, "SNAPTOGRID = %d\n", TheEditor->isGridSnapOn() ); - fprintf( fp, "GRIDVISIBLE = %d\n", TheEditor->isGridVisible() ); + fprintf( fp, "SNAPTOGRID = %d\n", isGridSnapOn() ); + fprintf( fp, "GRIDVISIBLE = %d\n", isGridVisible() ); // write hierarchy position and size ICoord2D pos, size; @@ -817,15 +817,15 @@ Bool GUIEdit::readConfigFile( const char *filename ) // grid settings Int intData; fscanf( fp, "GRIDRESOLUTION = %d\n", &intData ); - TheEditor->setGridResolution( intData ); + setGridResolution( intData ); RGBColorInt gridColor; fscanf( fp, "GRIDCOLOR = %d %d %d %d\n", &gridColor.red, &gridColor.green, &gridColor.blue, &gridColor.alpha ); - TheEditor->setGridColor( &gridColor ); + setGridColor( &gridColor ); fscanf( fp, "SNAPTOGRID = %d\n", &intData ); - TheEditor->setGridSnap( intData ); + setGridSnap( intData ); fscanf( fp, "GRIDVISIBLE = %d\n", &intData ); - TheEditor->setGridVisible( intData ); + setGridVisible( intData ); // hierarchy view ICoord2D pos, size; @@ -3446,7 +3446,7 @@ Bool GUIEdit::menuExit( void ) Bool success; // save all our data - success = TheEditor->menuSave(); + success = menuSave(); // // if we were unable to save file ask them if it's still OK to @@ -4000,7 +4000,7 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) //============================================================================= void GUIEdit::deleteSelected( void ) { - Int count = TheEditor->selectionCount(); + Int count = selectionCount(); Int i; GameWindow **deleteList; WindowSelectionEntry *select; @@ -4042,7 +4042,7 @@ void GUIEdit::deleteSelected( void ) //============================================================================= void GUIEdit::bringSelectedToTop( void ) { - Int count = TheEditor->selectionCount(); + Int count = selectionCount(); // no-op if( count == 0 ) @@ -4118,8 +4118,8 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, moveLoc.y = origin.y + (dragDest->y - dragOrigin->y); // snap move location to grid if on - if( (TheEditor->getMode() == MODE_DRAG_MOVE) && TheEditor->isGridSnapOn() ) - TheEditor->gridSnapLocation( &moveLoc, &moveLoc ); + if( (getMode() == MODE_DRAG_MOVE) && isGridSnapOn() ) + gridSnapLocation( &moveLoc, &moveLoc ); // kee the location legal computeSafeLocation( window, moveLoc.x, moveLoc.y, &safeLoc.x, &safeLoc.y ); @@ -4523,7 +4523,7 @@ void GUIEdit::moveWindowTo( GameWindow *window, Int x, Int y ) window->winSetPosition( x, y ); // we've now made a change - TheEditor->setUnsaved( TRUE ); + setUnsaved( TRUE ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 45904e7c545..c28bdbb1bb1 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -1211,7 +1211,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) hitTest.pt.y = y; hitTest.hItem = NULL; hitTest.flags = TVHT_ONITEM; - return TreeView_HitTest( TheHierarchyView->getTreeHandle(), &hitTest ); + return TreeView_HitTest( getTreeHandle(), &hitTest ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index ad880c32114..ecac794fd7d 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -1124,7 +1124,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) } // check for a duplicate filename - if( TheEditor->isNameDuplicate( TheWindowManager->winGetWindowList(), + if( isNameDuplicate( TheWindowManager->winGetWindowList(), root, instData->m_decoratedNameString ) ) { @@ -1228,7 +1228,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) if( valid == FALSE ) { - MessageBox( TheEditor->getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); + MessageBox( getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); return FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index 010418a47c0..627f5494d51 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1358,7 +1358,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot void getCellCenterPos(Int x, Int y, Real& xx, Real& yy); // find the cell that covers the world coords (wx,wy) and return its coords. - void worldToCell(Real wx, Real wy, Int *cx, Int *cy); + void worldToCell(Real wx, Real wy, Int *cx, Int *cy) const; // given a distance in world coords, return the number of cells needed to cover that distance (rounding up) Int worldToCellDist(Real w); @@ -1531,7 +1531,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot }; // ----------------------------------------------------------------------------- -inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) +inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) const { *cx = REAL_TO_INT_FLOOR((wx - m_worldExtents.lo.x) * m_cellSizeInv); *cy = REAL_TO_INT_FLOOR((wy - m_worldExtents.lo.y) * m_cellSizeInv); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index 8da28802263..32808fab439 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -1155,7 +1155,7 @@ void GlobalData::reset( void ) { // get next instance - GlobalData* next = TheWritableGlobalData->m_next; + GlobalData* next = m_next; // delete the head of the global data list (the latest override) delete TheWritableGlobalData; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index b8add65553e..87a5934f403 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -636,7 +636,7 @@ SaveCode GameState::missionSave( void ) desc.format( format, TheGameText->fetch( campaign->m_campaignNameLabel ).str(), missionNumber ); // do an automatic mission save - return TheGameState->saveGame( "", desc, SAVE_FILE_TYPE_MISSION ); + return saveGame( "", desc, SAVE_FILE_TYPE_MISSION ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index c6f3972b40b..6eb90665160 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -189,9 +189,9 @@ void ControlBar::populatePurchaseScience( Player* player ) player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3().isEmpty() || player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8().isEmpty()) return; - commandSet1 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING - commandSet3 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING - commandSet8 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet1 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet3 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet8 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) m_sciencePurchaseWindowsRank1[i]->winHide(TRUE); @@ -2737,7 +2737,7 @@ void ControlBar::showRallyPoint(const Coord3D* loc) marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML // set the marker colors to that of the local player - Player* player = TheControlBar->getCurrentlyViewedPlayer(); + Player* player = getCurrentlyViewedPlayer(); if (player) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) @@ -3299,7 +3299,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) // get command set if(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet().isEmpty() ) return; - commandSet = TheControlBar->findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING + commandSet = findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING if(!commandSet) return; // populate the button with commands defined @@ -3403,9 +3403,9 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) { continue; } - commandSet1 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1() ); - commandSet3 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3() ); - commandSet8 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8() ); + commandSet1 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1() ); + commandSet3 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3() ); + commandSet8 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8() ); if( !commandSet1 || !commandSet3 || !commandSet8 ) { @@ -3617,7 +3617,7 @@ void ControlBar::updateSpecialPowerShortcut( void ) { //Ugh... hacky. //Look for a command button for a special power and if so, then get the command availability for it. - const CommandSet *commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() ); + const CommandSet *commandSet = findCommandSet( obj->getCommandSetString() ); if( commandSet ) { for( Int commandIndex = 0; commandIndex < MAX_COMMANDS_PER_SET; commandIndex++ ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index d76112978de..ca67c21b7e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -271,7 +271,7 @@ void ControlBar::populateCommand( Object *obj ) resetBuildQueueData(); // get command set - commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() ); + commandSet = findCommandSet( obj->getCommandSetString() ); // if no command set match is found hide all the buttons if( commandSet == NULL ) @@ -396,9 +396,9 @@ void ControlBar::populateCommand( Object *obj ) { continue; } - commandSet1 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1() ); - commandSet3 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3() ); - commandSet8 = TheControlBar->findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8() ); + commandSet1 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1() ); + commandSet3 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3() ); + commandSet8 = findCommandSet( player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8() ); if( !commandSet1 || !commandSet3 || !commandSet8 ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index dd1278d3bf2..37261a151d3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -162,7 +162,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // if the button is flashing, tell it to stop flashing commandButton->setFlashCount(0); - TheControlBar->setFlash( FALSE ); + setFlash( FALSE ); if( commandButton->getCommandType() != GUI_COMMAND_EXIT_CONTAINER ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 8d2659db831..3619dd01bbb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -567,7 +567,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, name = TheGameText->fetch("CONTROLBAR:Power"); descrip = TheGameText->fetch("CONTROLBAR:PowerDescription"); - Player* playerToDisplay = TheControlBar->getCurrentlyViewedPlayer(); + Player* playerToDisplay = getCurrentlyViewedPlayer(); if( playerToDisplay && playerToDisplay->getEnergy() ) { @@ -656,7 +656,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, { return; } - TheControlBar->getBackgroundMarkerPos(&basePos.x, &basePos.y); + getBackgroundMarkerPos(&basePos.x, &basePos.y); ICoord2D curPos, offset; marker->winGetScreenPosition(&curPos.x,&curPos.y); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 197fdd05ec9..bbe4bb38b91 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1584,7 +1584,7 @@ void GameWindowManager::winSetLoneWindow( GameWindow *window ) if( m_loneWindow == window ) return; if( m_loneWindow ) - TheWindowManager->winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); + winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); m_loneWindow = window; } @@ -1633,10 +1633,10 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("MessageBoxParent"); - parent = TheWindowManager->winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); - TheWindowManager->winSetModal( trueParent ); - TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves - TheWindowManager->winSetFocus( parent ); + parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); + winSetModal( trueParent ); + winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + winSetFocus( parent ); // If the user wants the size to be different then the default float ratioX, ratioY = 1; @@ -1680,25 +1680,25 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("ButtonOk"); buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); + GameWindow *buttonOk = winGetWindowFromId(parent, buttonOkID); buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); tempName = menuName; tempName.concat("ButtonYes"); NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); + GameWindow *buttonYes = winGetWindowFromId(parent, buttonYesID); //buttonNo in the second position tempName = menuName; tempName.concat("ButtonNo"); NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); - GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); + GameWindow *buttonNo = winGetWindowFromId(parent, buttonNoID); buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); //and buttonCancel in the third tempName = menuName; tempName.concat("ButtonCancel"); NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); + GameWindow *buttonCancel = winGetWindowFromId(parent, buttonCancelID); buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); //we shouldn't have button OK and Yes on the same dialog @@ -1745,12 +1745,12 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh tempName = menuName; tempName.concat("StaticTextTitle"); NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); + GameWindow *staticTextTitle = winGetWindowFromId(parent, staticTextTitleID); GadgetStaticTextSetText(staticTextTitle,titleString); tempName = menuName; tempName.concat("StaticTextMessage"); NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); + GameWindow *staticTextMessage = winGetWindowFromId(parent, staticTextMessageID); GadgetStaticTextSetText(staticTextMessage,bodyString); // create a structure that will pass the functions to @@ -1794,7 +1794,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, } // create the button window - button = TheWindowManager->winCreate( parent, status, + button = winCreate( parent, status, x, y, width, height, GadgetPushButtonSystem, instData ); @@ -1862,7 +1862,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, } // create the button window - checkbox = TheWindowManager->winCreate( parent, status, + checkbox = winCreate( parent, status, x, y, width, height, GadgetCheckBoxSystem, instData ); @@ -1929,7 +1929,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, } // create the button window - radioButton = TheWindowManager->winCreate( parent, status, + radioButton = winCreate( parent, status, x, y, width, height, GadgetRadioButtonSystem, instData ); @@ -2001,7 +2001,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, } // create the tab control window - tabControl = TheWindowManager->winCreate( parent, status, + tabControl = winCreate( parent, status, x, y, width, height, GadgetTabControlSystem, instData ); @@ -2395,7 +2395,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, // remove unwanted status bits. status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN); - fontHeight = TheWindowManager->winFontHeight( comboBox->winGetFont() ); + fontHeight = winFontHeight( comboBox->winGetFont() ); top = title ? (fontHeight + 1):0; bottom = title ? (height - (fontHeight + 1)):height; @@ -2418,7 +2418,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); comboBoxData->dropDownButton = - TheWindowManager->gogoGadgetPushButton( comboBox, + gogoGadgetPushButton( comboBox, status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth, 0, buttonWidth, height, @@ -2446,7 +2446,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, statusTextEntry = status | WIN_STATUS_NO_INPUT ;//| WIN_STATUS_NO_FOCUS; comboBoxData->entryData->drawTextFromStart = TRUE; } - comboBoxData->editBox = TheWindowManager->gogoGadgetTextEntry( comboBox, statusTextEntry , + comboBoxData->editBox = gogoGadgetTextEntry( comboBox, statusTextEntry , 0,0 , width - buttonWidth , height , &winInstData, comboBoxData->entryData, @@ -2468,7 +2468,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, BitSet( winInstData.m_style, WIN_STATUS_HIDDEN ); winInstData.m_style |= GWS_SCROLL_LISTBOX; status &= ~(WIN_STATUS_IMAGE); - comboBoxData->listBox = TheWindowManager->gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, + comboBoxData->listBox = gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, width, height, &winInstData, comboBoxData->listboxData, winInstData.m_font, FALSE ); @@ -2545,7 +2545,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, } // create the button window - progressBar = TheWindowManager->winCreate( parent, status, + progressBar = winCreate( parent, status, x, y, width, height, GadgetProgressBarSystem, instData ); @@ -2802,29 +2802,29 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, Bool assignVisual ) { UnsignedByte alpha = 255; - static Color red = TheWindowManager->winMakeColor( 255, 0, 0, alpha ); - static Color darkRed = TheWindowManager->winMakeColor( 128, 0, 0, alpha ); - static Color lightRed = TheWindowManager->winMakeColor( 255, 128, 128, alpha ); - static Color green = TheWindowManager->winMakeColor( 0, 255, 0, alpha ); - static Color darkGreen = TheWindowManager->winMakeColor( 0, 128, 0, alpha ); - static Color lightGreen = TheWindowManager->winMakeColor( 128, 255, 128, alpha ); - static Color blue = TheWindowManager->winMakeColor( 0, 0, 255, alpha ); - static Color darkBlue = TheWindowManager->winMakeColor( 0, 0, 128, alpha ); - static Color lightBlue = TheWindowManager->winMakeColor( 128, 128, 255, alpha ); - static Color purple = TheWindowManager->winMakeColor( 255, 0, 255, alpha ); - static Color darkPurple = TheWindowManager->winMakeColor( 128, 0, 128, alpha ); - static Color lightPurple= TheWindowManager->winMakeColor( 255, 128, 255, alpha ); - static Color yellow = TheWindowManager->winMakeColor( 255, 255, 0, alpha ); - static Color darkYellow = TheWindowManager->winMakeColor( 128, 128, 0, alpha ); - static Color lightYellow= TheWindowManager->winMakeColor( 255, 255, 128, alpha ); - static Color cyan = TheWindowManager->winMakeColor( 0, 255, 255, alpha ); - static Color darkCyan = TheWindowManager->winMakeColor( 64, 128, 128, alpha ); - static Color lightCyan = TheWindowManager->winMakeColor( 128, 255, 255, alpha ); - static Color gray = TheWindowManager->winMakeColor( 128, 128, 128, alpha ); - static Color darkGray = TheWindowManager->winMakeColor( 64, 64, 64, alpha ); - static Color lightGray = TheWindowManager->winMakeColor( 192, 192, 192, alpha ); - static Color black = TheWindowManager->winMakeColor( 0, 0, 0, alpha ); - static Color white = TheWindowManager->winMakeColor( 254, 254, 254, alpha ); + static Color red = winMakeColor( 255, 0, 0, alpha ); + static Color darkRed = winMakeColor( 128, 0, 0, alpha ); + static Color lightRed = winMakeColor( 255, 128, 128, alpha ); + static Color green = winMakeColor( 0, 255, 0, alpha ); + static Color darkGreen = winMakeColor( 0, 128, 0, alpha ); + static Color lightGreen = winMakeColor( 128, 255, 128, alpha ); + static Color blue = winMakeColor( 0, 0, 255, alpha ); + static Color darkBlue = winMakeColor( 0, 0, 128, alpha ); + static Color lightBlue = winMakeColor( 128, 128, 255, alpha ); + static Color purple = winMakeColor( 255, 0, 255, alpha ); + static Color darkPurple = winMakeColor( 128, 0, 128, alpha ); + static Color lightPurple= winMakeColor( 255, 128, 255, alpha ); + static Color yellow = winMakeColor( 255, 255, 0, alpha ); + static Color darkYellow = winMakeColor( 128, 128, 0, alpha ); + static Color lightYellow= winMakeColor( 255, 255, 128, alpha ); + static Color cyan = winMakeColor( 0, 255, 255, alpha ); + static Color darkCyan = winMakeColor( 64, 128, 128, alpha ); + static Color lightCyan = winMakeColor( 128, 255, 255, alpha ); + static Color gray = winMakeColor( 128, 128, 128, alpha ); + static Color darkGray = winMakeColor( 64, 64, 64, alpha ); + static Color lightGray = winMakeColor( 192, 192, 192, alpha ); + static Color black = winMakeColor( 0, 0, 0, alpha ); + static Color white = winMakeColor( 254, 254, 254, alpha ); static Color enabledText = white; static Color enabledTextBorder = darkGray; static Color disabledText = darkGray; @@ -2848,13 +2848,13 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, else { if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { gadget->winSetFont( TheWindowManager->winFindFont( + { gadget->winSetFont( winFindFont( TheGlobalLanguageData->m_defaultWindowFont.name, TheGlobalLanguageData->m_defaultWindowFont.size, TheGlobalLanguageData->m_defaultWindowFont.bold) ); } else - gadget->winSetFont( TheWindowManager->winFindFont( "Times New Roman", 14, FALSE ) ); + gadget->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); } // if we don't want to assign default colors/images get out of here @@ -3676,20 +3676,20 @@ Bool GameWindowManager::initTestGUI( void ) WinInstanceData instData; // make some windows inside each other in the upper left - window = TheWindowManager->winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 255, 254, 255, 255 ) ); - window->winSetEnabledBorderColor( 0 , TheWindowManager->winMakeColor( 0, 0, 0, 255 ) ); - window = TheWindowManager->winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); + window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); + window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); + window = winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 128, 128, 128, 255 ) ); - window->winSetEnabledBorderColor( 0 , TheWindowManager->winMakeColor( 0, 0, 0, 255 ) ); + window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); + window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "What Up?"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 100, 100, 30, @@ -3699,7 +3699,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Enabled"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, WIN_STATUS_ENABLED, 330, 100, 100, 30, @@ -3709,7 +3709,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Disabled"; - window = TheWindowManager->gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( NULL, 0, 450, 100, 100, 30, @@ -3719,7 +3719,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = TheWindowManager->gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 150, @@ -3730,18 +3730,18 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = TheWindowManager->gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( NULL, WIN_STATUS_ENABLED, 330, 150, 100, 30, &instData, NULL, TRUE ); // make window to hold radio buttons - window = TheWindowManager->winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + window = winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, 200, 200, 250, 45, NULL ); window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 50, 50, 50, 200 ) ); - window->winSetEnabledBorderColor( 0, TheWindowManager->winMakeColor( 254, 254, 254, 255 ) ); + window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); + window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); // make a radio button GameWindow *radio; @@ -3750,7 +3750,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; instData.m_textLabelString = "Mama Said!"; rData.group = 1; - radio = TheWindowManager->gogoGadgetRadioButton( window, + radio = gogoGadgetRadioButton( window, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 10, 10, 100, 30, @@ -3761,7 +3761,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; instData.m_textLabelString = "On the Run"; - radio = TheWindowManager->gogoGadgetRadioButton( window, + radio = gogoGadgetRadioButton( window, WIN_STATUS_ENABLED, 130, 10, 100, 30, @@ -3784,24 +3784,24 @@ Bool GameWindowManager::initTestGUI( void ) listData.columnWidth = NULL; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetListBox( NULL, + window = gogoGadgetListBox( NULL, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, &listData, NULL, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", - TheWindowManager->winMakeColor( 255, 255, 255, 255 ), -1, 0 ); + winMakeColor( 255, 255, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"More text", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, 0 ); + winMakeColor( 105, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Nothing", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, 0 ); + winMakeColor( 105, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Seasons", - TheWindowManager->winMakeColor( 105, 205, 255, 255 ), -1, 0 ); + winMakeColor( 105, 205, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Misery", - TheWindowManager->winMakeColor( 235, 105, 255, 255 ), -1, 0 ); + winMakeColor( 235, 105, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"Natural", - TheWindowManager->winMakeColor( 105, 205, 45, 255 ), -1, 0 ); + winMakeColor( 105, 205, 45, 255 ), -1, 0 ); window->winSetFont( TheFontLibrary->getFont( "Times New Roman", 12, FALSE ) ); // make a listbox @@ -3817,24 +3817,24 @@ Bool GameWindowManager::initTestGUI( void ) listData.columnWidth = NULL; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetListBox( NULL, + window = gogoGadgetListBox( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, &listData, NULL, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", - TheWindowManager->winMakeColor( 255, 255, 255, 255 ), -1, -1 ); + winMakeColor( 255, 255, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"More text", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, -1 ); + winMakeColor( 105, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Nothing", - TheWindowManager->winMakeColor( 105, 105, 255, 255 ), -1, -1 ); + winMakeColor( 105, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Seasons", - TheWindowManager->winMakeColor( 105, 205, 255, 255 ), -1, -1 ); + winMakeColor( 105, 205, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Misery", - TheWindowManager->winMakeColor( 235, 105, 255, 255 ), -1, -1 ); + winMakeColor( 235, 105, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"Natural", - TheWindowManager->winMakeColor( 105, 205, 45, 255 ), -1, -1 ); + winMakeColor( 105, 205, 45, 255 ), -1, -1 ); // make a vert slider SliderData sliderData; @@ -3845,7 +3845,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED, 360, 250, 11, 100, @@ -3860,7 +3860,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 400, 250, 11, 100, @@ -3875,7 +3875,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED, 200, 400, 200, 11, @@ -3890,7 +3890,7 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetSlider( NULL, + window = gogoGadgetSlider( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 420, 200, 11, @@ -3900,7 +3900,7 @@ Bool GameWindowManager::initTestGUI( void ) // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( NULL, WIN_STATUS_ENABLED, 200, 450, 250, 15, @@ -3909,7 +3909,7 @@ Bool GameWindowManager::initTestGUI( void ) // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = TheWindowManager->gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 470, 250, 15, @@ -3921,7 +3921,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Centered Static Text"; - window = TheWindowManager->gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( NULL, WIN_STATUS_ENABLED, 200, 490, 300, 25, @@ -3933,14 +3933,14 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Not Centered Static Text"; - window = TheWindowManager->gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, &textData, NULL, TRUE ); - window->winSetEnabledTextColors( TheWindowManager->winMakeColor( 128, 128, 255, 255 ), - TheWindowManager->winMakeColor( 255, 255, 255, 255 ) ); + window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), + winMakeColor( 255, 255, 255, 255 ) ); // make some entry text EntryData entryData; @@ -3949,7 +3949,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = TheWindowManager->gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( NULL, WIN_STATUS_ENABLED, 450, 270, 400, 30, @@ -3962,7 +3962,7 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = TheWindowManager->gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( NULL, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 450, 310, 400, 30, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 0c49c2a1410..4b8c9f00e9b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -1110,7 +1110,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay ) draw->preloadAssets( timeOfDay ); // destroy the drawable - TheGameClient->destroyDrawable( draw ); + destroyDrawable( draw ); } @@ -1534,7 +1534,7 @@ void GameClient::xfer( Xfer *xfer ) const ThingTemplate* drawTemplate = draw->getTemplate(); if (drawTemplate->getFinalOverride() != thingTemplate->getFinalOverride()) { - TheGameClient->destroyDrawable( draw ); + destroyDrawable( draw ); draw = TheThingFactory->newDrawable( thingTemplate ); TheGameLogic->bindObjectAndDrawable(object, draw); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index de61454f1d7..6d41373cb14 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1644,7 +1644,7 @@ void InGameUI::handleBuildPlacements( void ) Int maxObjects = TheGlobalData->m_maxLineBuildObjects; // get the builder object that will be constructing things - Object *builderObject = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() ); + Object *builderObject = TheGameLogic->findObjectByID( getPendingPlaceSourceObjectID() ); // // given the start/end points in the world and the the angle of the wall, fill @@ -2682,7 +2682,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->resetTooltipDelay(); } - if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !TheInGameUI->getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) + if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) { if( m_mousedOverDrawableID != INVALID_DRAWABLE_ID ) { @@ -3450,7 +3450,7 @@ void InGameUI::deselectDrawable( Drawable *draw ) //------------------------------------------------------------------------------------------------- void InGameUI::deselectAllDrawables( Bool postMsg ) { - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables for ( DrawableListCIt it = selected->begin(); it != selected->end(); ) @@ -3460,7 +3460,7 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) Drawable* draw = *it++; // do the deselection - TheInGameUI->deselectDrawable( draw ); + deselectDrawable( draw ); } @@ -4255,39 +4255,39 @@ void InGameUI::displayCantBuildMessage( LegalBuildCode lbc ) //--------------------------------------------------------------------------------------------- case LBC_RESTRICTED_TERRAIN: - TheInGameUI->message( "GUI:CantBuildRestrictedTerrain" ); + message( "GUI:CantBuildRestrictedTerrain" ); break; //--------------------------------------------------------------------------------------------- case LBC_NOT_FLAT_ENOUGH: - TheInGameUI->message( "GUI:CantBuildNotFlatEnough" ); + message( "GUI:CantBuildNotFlatEnough" ); break; //--------------------------------------------------------------------------------------------- case LBC_OBJECTS_IN_THE_WAY: - TheInGameUI->message( "GUI:CantBuildObjectsInTheWay" ); + message( "GUI:CantBuildObjectsInTheWay" ); break; //--------------------------------------------------------------------------------------------- case LBC_TOO_CLOSE_TO_SUPPLIES: - TheInGameUI->message( "GUI:CantBuildTooCloseToSupplies" ); + message( "GUI:CantBuildTooCloseToSupplies" ); break; //--------------------------------------------------------------------------------------------- case LBC_NO_CLEAR_PATH: - TheInGameUI->message( "GUI:CantBuildNoClearPath" ); + message( "GUI:CantBuildNoClearPath" ); break; //--------------------------------------------------------------------------------------------- case LBC_SHROUD: - TheInGameUI->message( "GUI:CantBuildShroud" ); + message( "GUI:CantBuildShroud" ); break; //--------------------------------------------------------------------------------------------- case LBC_GENERIC_FAILURE: default: - TheInGameUI->message( "GUI:CantBuildThere" ); + message( "GUI:CantBuildThere" ); break; } @@ -4319,7 +4319,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) const int messageTimeout = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * duration)/1000.0f); // disable tooltips until this frame, cause we don't want to collide with the military subtitles. - TheInGameUI->disableTooltipsUntil(messageTimeout); + disableTooltipsUntil(messageTimeout); // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplier; @@ -4357,7 +4357,7 @@ void InGameUI::removeMilitarySubtitle( void ) if(!m_militarySubtitle) return; - TheInGameUI->clearTooltipsDisabled(); + clearTooltipsDisabled(); // loop through and free up the display strings for(UnsignedInt i = 0; i <= m_militarySubtitle->currentDisplayString; i ++) @@ -4376,7 +4376,7 @@ void InGameUI::removeMilitarySubtitle( void ) // ------------------------------------------------------------------------------------------------ Bool InGameUI::areSelectedObjectsControllable() const { - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables const Drawable *draw; @@ -4438,7 +4438,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4537,7 +4537,7 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4695,7 +4695,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c if (ignoreSelDraw) tmpList.push_back(ignoreSelDraw); - const DrawableList* selected = (!tmpList.empty()) ? &tmpList : TheInGameUI->getAllSelectedDrawables(); + const DrawableList* selected = (!tmpList.empty()) ? &tmpList : getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4761,7 +4761,7 @@ Bool InGameUI::canSelectedObjectsOverrideSpecialPowerDestination( const Coord3D Int qualify = 0; // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables Drawable *other; @@ -4813,7 +4813,7 @@ Bool InGameUI::canSelectedObjectsEffectivelyUseWeapon( const CommandButton *comm } // get selected list of drawables - const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -5030,16 +5030,16 @@ Int InGameUI::selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfM Int numSelected = selectAllUnitsByTypeAcrossRegion(®ion, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } @@ -5064,16 +5064,16 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int numSelected = selectMatchingAcrossRegion(®ion); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } @@ -5085,22 +5085,22 @@ Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMask Int numSelected = selectAllUnitsByTypeAcrossRegion(NULL, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -5114,22 +5114,22 @@ Int InGameUI::selectMatchingAcrossMap() Int numSelected = selectMatchingAcrossRegion(NULL); if (numSelected == -1) { - UnicodeString message = TheGameText->fetch( "GUI:NothingSelected" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString message = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - TheInGameUI->message( message ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -5751,7 +5751,7 @@ void InGameUI::selectNextIdleWorker( void ) } else { - Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); + Drawable *selectedDrawable = getFirstSelectedDrawable(); // TheSuperHackers @tweak Stubbjax 22/07/2025 Idle worker iteration now correctly identifies and // iterates contained idle workers. Previous iteration logic would not go past contained workers, // and was not guaranteed to select top-level containers. diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index d847d9df59e..2cd89f13715 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2959,7 +2959,7 @@ ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( Object* attachTo, Bool createSlaves ) { - ParticleSystem* pSystem = TheParticleSystemManager->createParticleSystem(sysTemplate, createSlaves); + ParticleSystem* pSystem = createParticleSystem(sysTemplate, createSlaves); if (pSystem && attachTo) pSystem->attachToObject(attachTo); return pSystem ? pSystem->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 5cf8868c993..2f4713f51c7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -710,7 +710,7 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie Real distSqr = ThePartitionManager->getDistanceSquared(me, theEnemy, FROM_BOUNDINGSPHERE_2D); Real dist = sqrt(distSqr); - Int modifier = dist/TheAI->getAiData()->m_attackPriorityDistanceModifier; + Int modifier = dist/getAiData()->m_attackPriorityDistanceModifier; Int modPriority = curPriority-modifier; if (modPriority < 1) modPriority = 1; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index 6af3e05b1b3..daaa6f9f0d5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -2699,7 +2699,7 @@ void TerrainLogic::flattenTerrain(Object *obj) match = true; } if (match) { - totalHeight += TheTerrainLogic->getGroundHeight(testPt.X, testPt.Y); + totalHeight += getGroundHeight(testPt.X, testPt.Y); numSamples++; } } @@ -2710,7 +2710,7 @@ void TerrainLogic::flattenTerrain(Object *obj) // Compare to the height at the building's origin, because setRawMapHeight will only lower, // not raise. jba - Int centerHeight = REAL_TO_INT_FLOOR(TheTerrainLogic->getGroundHeight(pos->x, pos->y)/MAP_HEIGHT_SCALE); + Int centerHeight = REAL_TO_INT_FLOOR(getGroundHeight(pos->x, pos->y)/MAP_HEIGHT_SCALE); if (rawDataHeight>centerHeight) rawDataHeight = centerHeight; for (i=iMin.x; i<=iMax.x; i++) { @@ -2788,7 +2788,7 @@ void TerrainLogic::flattenTerrain(Object *obj) match = true; } if (match) { - totalHeight += TheTerrainLogic->getGroundHeight(testPt.X, testPt.Y); + totalHeight += getGroundHeight(testPt.X, testPt.Y); numSamples++; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index e92ad16f329..e5f48c12136 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -2706,7 +2706,7 @@ void PartitionManager::reset() void PartitionManager::shutdown() { m_updatedSinceLastReset = false; - ThePartitionManager->removeAllDirtyModules(); + removeAllDirtyModules(); #ifdef RTS_DEBUG // the above *should* remove all the touched cells (via unRegisterObject), but let's check: @@ -3081,7 +3081,7 @@ CellShroudStatus PartitionManager::getShroudStatusForPlayer(Int playerIndex, con { Int x, y; - ThePartitionManager->worldToCell( loc->x, loc->y, &x, &y ); + worldToCell( loc->x, loc->y, &x, &y ); return getShroudStatusForPlayer( playerIndex, x, y ); } @@ -3092,7 +3092,7 @@ ObjectShroudStatus PartitionManager::getPropShroudStatusForPlayer(Int playerInde { Int x, y; - ThePartitionManager->worldToCell( loc->x - m_cellSize*0.5f, loc->y - m_cellSize*0.5f, &x, &y ); + worldToCell( loc->x - m_cellSize*0.5f, loc->y - m_cellSize*0.5f, &x, &y ); CellShroudStatus cellStat = getShroudStatusForPlayer( playerIndex, x, y ); if (cellStat != getShroudStatusForPlayer( playerIndex, x+1, y )) { @@ -3815,7 +3815,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, // very small sphere geometry around the point // GeometryInfo geometry( GEOMETRY_SPHERE, TRUE, 5.0f, 5.0f, 5.0f ); - ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( &pos, geometry, angle, true ); + ObjectIterator *iter = iteratePotentialCollisions( &pos, geometry, angle, true ); MemoryPoolObjectHolder hold( iter ); // Bool overlap = FALSE; @@ -3995,9 +3995,9 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, void PartitionManager::doShroudReveal(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4062,9 +4062,9 @@ void PartitionManager::resetPendingUndoShroudRevealQueue() void PartitionManager::undoShroudReveal(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4099,9 +4099,9 @@ void PartitionManager::queueUndoShroudReveal(Real centerX, Real centerY, Real ra void PartitionManager::doShroudCover(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4123,9 +4123,9 @@ void PartitionManager::doShroudCover(Real centerX, Real centerY, Real radius, Pl void PartitionManager::undoShroudCover(Real centerX, Real centerY, Real radius, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4145,11 +4145,11 @@ void PartitionManager::undoShroudCover(Real centerX, Real centerY, Real radius, void PartitionManager::doThreatAffect( Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4178,11 +4178,11 @@ void PartitionManager::doThreatAffect( Real centerX, Real centerY, Real radius, void PartitionManager::undoThreatAffect( Real centerX, Real centerY, Real radius, UnsignedInt threatVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4211,11 +4211,11 @@ void PartitionManager::undoThreatAffect( Real centerX, Real centerY, Real radius void PartitionManager::doValueAffect( Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4244,11 +4244,11 @@ void PartitionManager::doValueAffect( Real centerX, Real centerY, Real radius, U void PartitionManager::undoValueAffect( Real centerX, Real centerY, Real radius, UnsignedInt valueVal, PlayerMaskType playerMask) { Int cellCenterX, cellCenterY; - ThePartitionManager->worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); + worldToCell(centerX, centerY, &cellCenterX, &cellCenterY); Real fCellCenterX = INT_TO_REAL(cellCenterX); Real fCellCenterY = INT_TO_REAL(cellCenterY); - Int cellRadius = ThePartitionManager->worldToCellDist(radius); + Int cellRadius = worldToCellDist(radius); if (cellRadius < 1) cellRadius = 1; @@ -4412,7 +4412,7 @@ Int PartitionManager::iterateCellsAlongLine(const Coord3D& pos, const Coord3D& p for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { - PartitionCell* cell = ThePartitionManager->getCellAt(x, y); // might be null if off the edge + PartitionCell* cell = getCellAt(x, y); // might be null if off the edge DEBUG_ASSERTCRASH(cell != NULL, ("off the map")); if (cell) { @@ -4445,7 +4445,7 @@ Int PartitionManager::iterateCellsBreadthFirst(const Coord3D *pos, CellBreadthFi // -1 means error, but we should add a define later for this. Int cellX, cellY; - ThePartitionManager->worldToCell(pos->x, pos->y, &cellX, &cellY); + worldToCell(pos->x, pos->y, &cellX, &cellY); // Note, bool. not Bool, cause bool will cause this to be a bitfield. std::vector bitField; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index fe0eed142d0..7720c5cc71b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1588,7 +1588,7 @@ WeaponStore::~WeaponStore() //------------------------------------------------------------------------------------------------- void WeaponStore::handleProjectileDetonation(const WeaponTemplate* wt, const Object *source, const Coord3D* pos, WeaponBonusConditionFlags extraBonusFlags, Bool inflictDamage ) { - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireProjectileDetonationWeapon( source, pos, extraBonusFlags, inflictDamage ); deleteInstance(w); @@ -1599,7 +1599,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object { if (wt == NULL) return; - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireWeapon(source, pos); deleteInstance(w); @@ -1611,7 +1611,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object //CRCDEBUG_LOG(("WeaponStore::createAndFireTempWeapon() for %s", DescribeObject(source))); if (wt == NULL) return; - Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); + Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); w->fireWeapon(source, target); deleteInstance(w); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 865d1bd2d89..1afe8e19c1e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -6551,7 +6551,7 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) AsciiString typeArgument = pAction->getParameter(1)->getString(); // Our argument could be an individual type, or a list name. - const ObjectTypes *types = TheScriptEngine->getObjectTypes(typeArgument); + const ObjectTypes *types = getObjectTypes(typeArgument); if( !types ) { // Lookup failed, so it is just a single type @@ -7100,7 +7100,7 @@ void ScriptEngine::addObjectToCache(Object* pNewObject) if (it->second == NULL) { AsciiString newNameForDead; newNameForDead.format("Reassigning dead object's name '%s' to object (%d) of type '%s'", objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str()); - TheScriptEngine->AppendDebugMessage(newNameForDead, FALSE); + AppendDebugMessage(newNameForDead, FALSE); DEBUG_LOG((newNameForDead.str())); it->second = pNewObject; return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index a6001e2206b..c729fb81cde 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1702,8 +1702,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) Region3D extent; TheTerrainLogic->getExtent( &extent ); - TheGameLogic->setWidth( extent.hi.x - extent.lo.x ); - TheGameLogic->setHeight( extent.hi.y - extent.lo.y ); + setWidth( extent.hi.x - extent.lo.x ); + setHeight( extent.hi.y - extent.lo.y ); // anytime the world's size changes, must reset the partition mgr ThePartitionManager->init(); @@ -3060,7 +3060,7 @@ void GameLogic::popSleepyUpdate() void GameLogic::friend_awakenUpdateModule(Object* obj, UpdateModulePtr u, UnsignedInt whenToWakeUp) { //USE_PERF_TIMER(friend_awakenUpdateModule) - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); DEBUG_ASSERTCRASH(whenToWakeUp >= now, ("setWakeFrame frame is in the past... are you sure this is what you want?")); if (u == m_curUpdateModule) @@ -3692,7 +3692,7 @@ void GameLogic::update( void ) } // send the current time to the GameClient - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); TheGameClient->setFrame(now); // update (execute) scripts @@ -3888,7 +3888,7 @@ void GameLogic::preUpdate() Bool pause = TRUE; Bool pauseMusic = FALSE; Bool pauseInput = FALSE; - TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput); + setGamePaused(pause, pauseMusic, pauseInput); } } @@ -3960,7 +3960,7 @@ void GameLogic::registerObject( Object *obj ) // add object to lookup table addObjectToLookupTable( obj ); - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); if (now == 0) now = 1; for (BehaviorModule** b = obj->getBehaviorModules(); *b; ++b) @@ -5206,7 +5206,7 @@ void GameLogic::loadPostProcess( void ) #ifdef ALLOW_NONSLEEPY_UPDATES m_normalUpdates.clear(); #else - UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt now = getFrame(); if (now == 0) now = 1; #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 23d726911af..07cdbb63b38 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -320,7 +320,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank m_background->bringForward(); } m_background->getFirstWindow()->winClearStatus(WIN_STATUS_IMAGE); - TheGameLogic->setGameMode( gameMode ); + setGameMode( gameMode ); if (!TheGlobalData->m_pendingFile.isEmpty()) { TheWritableGlobalData->m_mapName = TheGlobalData->m_pendingFile; @@ -331,7 +331,7 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank DEBUG_LOG(("GameLogic::prepareNewGame() - m_rankPointsToAddAtGameStart = %d", m_rankPointsToAddAtGameStart)); // If we're about to start a game, hide the shell. - if(!TheGameLogic->isInShellGame()) + if(!isInShellGame()) TheShell->hideShell(); m_startNewGame = FALSE; @@ -466,7 +466,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif } currentlySelectedGroup = NULL; - TheGameLogic->clearGameData(); + clearGameData(); break; } @@ -509,7 +509,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_SET_RALLY_POINT: { - Object *obj = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *obj = findObjectByID( msg->getArgument( 0 )->objectID ); Coord3D dest = msg->getArgument( 1 )->location; if (obj) { @@ -538,7 +538,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_COMBATDROP_AT_OBJECT: { - Object *targetObject = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *targetObject = findObjectByID( msg->getArgument( 0 )->objectID ); // issue command for either single object or for selected group if( currentlySelectedGroup ) @@ -590,7 +590,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // Lock the weapon choice to the right weapon, then give an attack command WeaponSlotType weaponSlot = (WeaponSlotType)msg->getArgument( 0 )->integer; - Object *targetObject = TheGameLogic->findObjectByID( msg->getArgument( 1 )->objectID ); + Object *targetObject = findObjectByID( msg->getArgument( 1 )->objectID ); Int maxShotsToFire = msg->getArgument( 2 )->integer; // sanity @@ -677,7 +677,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(2)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -715,14 +715,14 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // Object in way -- if applicable (some specials care, others don't) ObjectID objectID = msg->getArgument( 3 )->objectID; - Object *objectInWay = TheGameLogic->findObjectByID( objectID ); + Object *objectInWay = findObjectByID( objectID ); // Command button options -- special power may care about variance options UnsignedInt options = msg->getArgument( 4 )->integer; // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(5)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -754,7 +754,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // argument 2 is target object ObjectID targetID = msg->getArgument(1)->objectID; - Object *target = TheGameLogic->findObjectByID( targetID ); + Object *target = findObjectByID( targetID ); if( !target ) { break; @@ -765,7 +765,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(3)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -864,7 +864,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_GUARD_OBJECT: { - Object* obj = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object* obj = findObjectByID( msg->getArgument( 0 )->objectID ); if (!obj) break; @@ -1000,7 +1000,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_ENTER: { - Object *enter = TheGameLogic->findObjectByID( msg->getArgument( 1 )->objectID ); + Object *enter = findObjectByID( msg->getArgument( 1 )->objectID ); // sanity if( enter == NULL ) @@ -1019,7 +1019,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_EXIT: { - Object *objectWantingToExit = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *objectWantingToExit = findObjectByID( msg->getArgument( 0 )->objectID ); #if RETAIL_COMPATIBLE_AIGROUP Object *objectContainingExiter = getSingleObjectFromSelection(currentlySelectedGroup); #else @@ -1109,7 +1109,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_REPAIRED: { - Object *repairDepot = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *repairDepot = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( repairDepot == NULL ) @@ -1126,7 +1126,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DOCK: { - Object *dockBuilding = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *dockBuilding = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( dockBuilding == NULL ) @@ -1143,7 +1143,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_GET_HEALED: { - Object *healDest = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *healDest = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( healDest == NULL ) @@ -1160,7 +1160,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_REPAIR: { - Object *repairTarget = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *repairTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( repairTarget == NULL ) @@ -1180,7 +1180,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_RESUME_CONSTRUCTION: { - Object *constructTarget = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *constructTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity if( constructTarget == NULL ) @@ -1208,7 +1208,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) SpecialPowerType spType = (SpecialPowerType)msg->getArgument( 1 )->integer; ObjectID sourceID = msg->getArgument(2)->objectID; - Object* source = TheGameLogic->findObjectByID(sourceID); + Object* source = findObjectByID(sourceID); if (source != NULL) { AIGroupPtr theGroup = TheAI->createGroup(); @@ -1235,7 +1235,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_ATTACK_OBJECT: { - Object *enemy = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *enemy = findObjectByID( msg->getArgument( 0 )->objectID ); // Check enemy, as it is possible that he died this frame. if (enemy) @@ -1257,7 +1257,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_FORCE_ATTACK_OBJECT: { - Object *enemy = TheGameLogic->findObjectByID( msg->getArgument( 0 )->objectID ); + Object *enemy = findObjectByID( msg->getArgument( 0 )->objectID ); // Check enemy, as it is possible that he died this frame. if (enemy) @@ -1593,12 +1593,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Bool firstObject = TRUE; for (Int i = 1; i < msg->getArgumentCount(); ++i) { - Object *obj = TheGameLogic->findObjectByID( msg->getArgument( i )->objectID ); + Object *obj = findObjectByID( msg->getArgument( i )->objectID ); if (!obj) { continue; } - TheGameLogic->selectObject(obj, createNewGroup && firstObject, player->getPlayerMask()); + selectObject(obj, createNewGroup && firstObject, player->getPlayerMask()); firstObject = FALSE; } @@ -1618,12 +1618,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) for (Int i = 0; i < msg->getArgumentCount(); ++i) { ObjectID objID = msg->getArgument(i)->objectID; - Object *objToRemove = TheGameLogic->findObjectByID(objID); + Object *objToRemove = findObjectByID(objID); if (!objToRemove) { continue; } - TheGameLogic->deselectObject(objToRemove, player->getPlayerMask()); + deselectObject(objToRemove, player->getPlayerMask()); } break; @@ -1773,7 +1773,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { if (beacon->getControllingPlayer() == thisPlayer) { - TheGameLogic->destroyObject(beacon); // the owner is telling it to go away. such is life. + destroyObject(beacon); // the owner is telling it to go away. such is life. TheControlBar->markUIDirty(); // check if we should un-grey out the button } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index 9f43480cf33..d541e5d0006 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -658,7 +658,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // if we have ONE window selected and are close to an anchor corner // to resize it change the cursor to resize cursor // - TheEditWindow->handleResizeAvailable( x, y ); + handleResizeAvailable( x, y ); } @@ -896,7 +896,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, } // open right click menu - TheEditWindow->openPopupMenu( clickPos.x, clickPos.y ); + openPopupMenu( clickPos.x, clickPos.y ); break; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 401e29e8344..301dc0c86e1 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -275,10 +275,10 @@ Bool GUIEdit::validateParentForCreate( GameWindow *parent ) // gadgets are units themselves and should have no user defined // children // - if( parent && TheEditor->windowIsGadget( parent ) ) + if( parent && windowIsGadget( parent ) ) { - MessageBox( TheEditor->getWindowHandle(), + MessageBox( getWindowHandle(), "You cannot make a new window as a child to a GUI Gadget Control", "Illegal Parent", MB_OK ); return FALSE; @@ -717,7 +717,7 @@ void GUIEdit::update( void ) TheMouse->update(); // process the mouse if we're in test mode - if( TheEditor->getMode() == MODE_TEST_RUN ) + if( getMode() == MODE_TEST_RUN ) { // send input through the window system and clear all messages after @@ -762,12 +762,12 @@ Bool GUIEdit::writeConfigFile( const char *filename ) backColor.red, backColor.green, backColor.blue, backColor.alpha ); // grid settings - fprintf( fp, "GRIDRESOLUTION = %d\n", TheEditor->getGridResolution() ); - RGBColorInt *gridColor = TheEditor->getGridColor(); + fprintf( fp, "GRIDRESOLUTION = %d\n", getGridResolution() ); + RGBColorInt *gridColor = getGridColor(); fprintf( fp, "GRIDCOLOR = %d %d %d %d\n", gridColor->red, gridColor->green, gridColor->blue, gridColor->alpha ); - fprintf( fp, "SNAPTOGRID = %d\n", TheEditor->isGridSnapOn() ); - fprintf( fp, "GRIDVISIBLE = %d\n", TheEditor->isGridVisible() ); + fprintf( fp, "SNAPTOGRID = %d\n", isGridSnapOn() ); + fprintf( fp, "GRIDVISIBLE = %d\n", isGridVisible() ); // write hierarchy position and size ICoord2D pos, size; @@ -817,15 +817,15 @@ Bool GUIEdit::readConfigFile( const char *filename ) // grid settings Int intData; fscanf( fp, "GRIDRESOLUTION = %d\n", &intData ); - TheEditor->setGridResolution( intData ); + setGridResolution( intData ); RGBColorInt gridColor; fscanf( fp, "GRIDCOLOR = %d %d %d %d\n", &gridColor.red, &gridColor.green, &gridColor.blue, &gridColor.alpha ); - TheEditor->setGridColor( &gridColor ); + setGridColor( &gridColor ); fscanf( fp, "SNAPTOGRID = %d\n", &intData ); - TheEditor->setGridSnap( intData ); + setGridSnap( intData ); fscanf( fp, "GRIDVISIBLE = %d\n", &intData ); - TheEditor->setGridVisible( intData ); + setGridVisible( intData ); // hierarchy view ICoord2D pos, size; @@ -3446,7 +3446,7 @@ Bool GUIEdit::menuExit( void ) Bool success; // save all our data - success = TheEditor->menuSave(); + success = menuSave(); // // if we were unable to save file ask them if it's still OK to @@ -4000,7 +4000,7 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) //============================================================================= void GUIEdit::deleteSelected( void ) { - Int count = TheEditor->selectionCount(); + Int count = selectionCount(); Int i; GameWindow **deleteList; WindowSelectionEntry *select; @@ -4042,7 +4042,7 @@ void GUIEdit::deleteSelected( void ) //============================================================================= void GUIEdit::bringSelectedToTop( void ) { - Int count = TheEditor->selectionCount(); + Int count = selectionCount(); // no-op if( count == 0 ) @@ -4118,8 +4118,8 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, moveLoc.y = origin.y + (dragDest->y - dragOrigin->y); // snap move location to grid if on - if( (TheEditor->getMode() == MODE_DRAG_MOVE) && TheEditor->isGridSnapOn() ) - TheEditor->gridSnapLocation( &moveLoc, &moveLoc ); + if( (getMode() == MODE_DRAG_MOVE) && isGridSnapOn() ) + gridSnapLocation( &moveLoc, &moveLoc ); // kee the location legal computeSafeLocation( window, moveLoc.x, moveLoc.y, &safeLoc.x, &safeLoc.y ); @@ -4523,7 +4523,7 @@ void GUIEdit::moveWindowTo( GameWindow *window, Int x, Int y ) window->winSetPosition( x, y ); // we've now made a change - TheEditor->setUnsaved( TRUE ); + setUnsaved( TRUE ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 19451841527..98648b24f23 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -1231,7 +1231,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) hitTest.pt.y = y; hitTest.hItem = NULL; hitTest.flags = TVHT_ONITEM; - return TreeView_HitTest( TheHierarchyView->getTreeHandle(), &hitTest ); + return TreeView_HitTest( getTreeHandle(), &hitTest ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 7849582e6bd..0cafceb9661 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -1124,7 +1124,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) } // check for a duplicate filename - if( TheEditor->isNameDuplicate( TheWindowManager->winGetWindowList(), + if( isNameDuplicate( TheWindowManager->winGetWindowList(), root, instData->m_decoratedNameString ) ) { @@ -1228,7 +1228,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) if( valid == FALSE ) { - MessageBox( TheEditor->getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); + MessageBox( getWindowHandle(), offendingNames, "Window Name Error", MB_OK ); return FALSE; } From abd092c94729f4b8d25df1cd38ff25e529cec199 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 22 Dec 2025 14:33:04 -0500 Subject: [PATCH 007/211] refactor: Apply clang-tidy fixes for generals-use-is-empty (#2018) --- .../Source/Common/System/ArchiveFile.cpp | 14 +++++++------- .../Source/Common/System/ArchiveFileSystem.cpp | 2 +- .../Source/GameNetwork/ConnectionManager.cpp | 2 +- Core/GameEngine/Source/GameNetwork/GameInfo.cpp | 10 +++++----- Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp | 2 +- .../Win32Device/Common/Win32LocalFileSystem.cpp | 2 +- .../Source/WWVegas/WW3D2/animatedsoundmgr.cpp | 2 +- .../Source/WWVegas/WWAudio/AudibleSound.cpp | 2 +- Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp | 2 +- .../Libraries/Source/WWVegas/WWDebug/wwprofile.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWLib/textfile.cpp | 2 +- Core/Tools/W3DView/SoundEditDialog.cpp | 2 +- .../Code/GameEngine/Source/Common/CommandLine.cpp | 2 +- .../GUI/DisconnectMenu/DisconnectMenu.cpp | 6 +++--- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 2 +- .../GUICallbacks/Menus/NetworkDirectConnect.cpp | 2 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp | 2 +- .../Code/GameEngine/Source/Common/CommandLine.cpp | 2 +- .../GUI/DisconnectMenu/DisconnectMenu.cpp | 6 +++--- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 2 +- .../GUICallbacks/Menus/NetworkDirectConnect.cpp | 2 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp | 2 +- 25 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp index c10b42754cf..88cd6576469 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp @@ -39,13 +39,13 @@ // and ? is used to denote a single wildcard character. static Bool SearchStringMatches(AsciiString str, AsciiString searchString) { - if (str.getLength() == 0) { - if (searchString.getLength() == 0) { + if (str.isEmpty()) { + if (searchString.isEmpty()) { return TRUE; } return FALSE; } - if (searchString.getLength() == 0) { + if (searchString.isEmpty()) { return FALSE; } @@ -103,7 +103,7 @@ void ArchiveFile::addFile(const AsciiString& path, const ArchivedFileInfo *fileI tokenizer.toLower(); tokenizer.nextToken(&token, "\\/"); - while (token.getLength() > 0) + while (!token.isEmpty()) { DetailedArchivedDirectoryInfoMap::iterator tempiter = dirInfo->m_directories.find(token); if (tempiter == dirInfo->m_directories.end()) @@ -131,7 +131,7 @@ void ArchiveFile::getFileListInDirectory(const AsciiString& currentDirectory, co tokenizer.toLower(); tokenizer.nextToken(&token, "\\/"); - while (token.getLength() > 0) { + while (!token.isEmpty()) { DetailedArchivedDirectoryInfoMap::const_iterator it = dirInfo->m_directories.find(token); if (it != dirInfo->m_directories.end()) @@ -157,7 +157,7 @@ void ArchiveFile::getFileListInDirectory(const DetailedArchivedDirectoryInfo *di const DetailedArchivedDirectoryInfo *tempDirInfo = &(diriter->second); AsciiString tempdirname; tempdirname = currentDirectory; - if ((tempdirname.getLength() > 0) && (!tempdirname.endsWith("\\"))) { + if ((!tempdirname.isEmpty()) && (!tempdirname.endsWith("\\"))) { tempdirname.concat('\\'); } tempdirname.concat(tempDirInfo->m_directoryName); @@ -170,7 +170,7 @@ void ArchiveFile::getFileListInDirectory(const DetailedArchivedDirectoryInfo *di if (SearchStringMatches(fileiter->second.m_filename, searchName)) { AsciiString tempfilename; tempfilename = currentDirectory; - if ((tempfilename.getLength() > 0) && (!tempfilename.endsWith("\\"))) { + if ((!tempfilename.isEmpty()) && (!tempfilename.endsWith("\\"))) { tempfilename.concat('\\'); } tempfilename.concat(fileiter->second.m_filename); diff --git a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp index 1d8223a014c..b422e5cd1d0 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp @@ -305,7 +305,7 @@ Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileI return FALSE; } - if (filename.getLength() <= 0) { + if (filename.isEmpty()) { return FALSE; } diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 6e17e386dc0..cef851a74a4 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1714,7 +1714,7 @@ PlayerLeaveCode ConnectionManager::disconnectPlayer(Int slot) { UnicodeString unicodeName; unicodeName = getPlayerName(slot); - if (unicodeName.getLength() > 0 && m_connections[slot]) { + if (!unicodeName.isEmpty() && m_connections[slot]) { TheInGameUI->message("Network:PlayerLeftGame", unicodeName.str()); // People are boneheads. Also play a sound diff --git a/Core/GameEngine/Source/GameNetwork/GameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameInfo.cpp index 8551069daec..6b3298d6ef3 100644 --- a/Core/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -525,7 +525,7 @@ void GameInfo::setMap( AsciiString mapName ) } AsciiString newMapName; - if (mapName.getLength() > 0) + if (!mapName.isEmpty()) { AsciiString token; mapName.nextToken(&token, "\\/"); @@ -536,7 +536,7 @@ void GameInfo::setMap( AsciiString mapName ) // added onto it. while (mapName.find('\\') != NULL) { - if (newMapName.getLength() > 0) + if (!newMapName.isEmpty()) { newMapName.concat('/'); } @@ -896,7 +896,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game ) AsciiString mapName = game->getMap(); mapName = TheGameState->realMapPathToPortableMapPath(mapName); AsciiString newMapName; - if (mapName.getLength() > 0) + if (!mapName.isEmpty()) { AsciiString token; mapName.nextToken(&token, "\\/"); @@ -907,7 +907,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game ) // added onto it. while (mapName.find('\\') != NULL) { - if (newMapName.getLength() > 0) + if (!newMapName.isEmpty()) { newMapName.concat('/'); } @@ -1073,7 +1073,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) AsciiString token; tempstr = val.str()+2; tempstr.nextToken(&token, "\\/"); - while (tempstr.getLength() > 0) + while (!tempstr.isEmpty()) { mapName.concat(token); mapName.concat('\\'); diff --git a/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp index 4d04807d28c..d8f7b172c79 100644 --- a/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -84,7 +84,7 @@ UnsignedInt ResolveIP(AsciiString host) struct hostent *hostStruct; struct in_addr *hostNode; - if (host.getLength() == 0) + if (host.isEmpty()) { DEBUG_LOG(("ResolveIP(): Can't resolve NULL")); return 0; diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp index 84236de436b..424c446996d 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp @@ -206,7 +206,7 @@ Bool Win32LocalFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fi Bool Win32LocalFileSystem::createDirectory(AsciiString directory) { - if ((directory.getLength() > 0) && (directory.getLength() < _MAX_DIR)) { + if ((!directory.isEmpty()) && (directory.getLength() < _MAX_DIR)) { return (CreateDirectory(directory.str(), NULL) != 0); } return FALSE; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp index 8202d5ce2fb..a521e5679e5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp @@ -164,7 +164,7 @@ Build_List_From_String // // Add this entry to our list // - if ((entry_string.Get_Length () > 0) || (count == 0)) { + if ((!entry_string.Is_Empty()) || (count == 0)) { (*string_list)[count++] = entry_string; } } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp index 370b4537f06..19f416d4903 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp @@ -1780,7 +1780,7 @@ AudibleSoundClass::Load (ChunkLoadClass &cload) // // Reconstruct the sound buffer we had before we saved // - if (filename.Get_Length () > 0) { + if (!filename.Is_Empty()) { bool is_3d = (As_Sound3DClass () != NULL); SoundBufferClass *buffer = WWAudioClass::Get_Instance ()->Get_Sound_Buffer (filename, is_3d); Set_Buffer (buffer); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp index 6590cbe88c7..34b88f28b62 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -2267,7 +2267,7 @@ WWAudioClass::UnRegister_Text_Callback (LPFNTEXTCALLBACK callback) void WWAudioClass::Fire_Text_Callback (AudibleSoundClass *sound_obj, const StringClass &text) { - if (text.Get_Length () > 0) { + if (!text.Is_Empty()) { // // Loop over all the text-callbacks that have been registered diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp index c02c4e5dd59..d3a9e534781 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp @@ -221,7 +221,7 @@ void WWProfileHierachyNodeClass::Add_To_String_Compact(StringClass& string,int r if (Child) { StringClass work; Child->Add_To_String_Compact(work,recursion+1); - if (work.Get_Length()!=0) { + if (!work.Is_Empty()) { string+="{"; string+=work; string+="}"; diff --git a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp index f282d3ee306..9ebd2d2d356 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp @@ -402,7 +402,7 @@ int RawFileClass::Open(int rights) ** Verify that there is a filename associated with this file object. If not, then this is a ** big error condition. */ - if (Filename.Get_Length()==0) { + if (Filename.Is_Empty()) { Error(ENOENT, false); } @@ -492,7 +492,7 @@ int RawFileClass::Open(int rights) *=============================================================================================*/ bool RawFileClass::Is_Available(int forced) { - if (Filename.Get_Length()==0) return(false); + if (Filename.Is_Empty()) return(false); /* ** If the file is already open, then is must have already passed the availability check. diff --git a/Core/Libraries/Source/WWVegas/WWLib/textfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/textfile.cpp index 52d33f6f7d1..bc36014894c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/textfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/textfile.cpp @@ -130,7 +130,7 @@ TextFileClass::Read_Line (StringClass &string) } } - bool retval = (string.Get_Length () > 0); + bool retval = (!string.Is_Empty()); if (retval) { int len = string.Get_Length (); diff --git a/Core/Tools/W3DView/SoundEditDialog.cpp b/Core/Tools/W3DView/SoundEditDialog.cpp index 6ed5c3c6acf..b14bccb37e3 100644 --- a/Core/Tools/W3DView/SoundEditDialog.cpp +++ b/Core/Tools/W3DView/SoundEditDialog.cpp @@ -278,7 +278,7 @@ SoundEditDialogClass::OnOK (void) // // Update the asset manager with the new prototype // - if (OldName.Get_Length () > 0) { + if (!OldName.Is_Empty()) { WW3DAssetManager::Get_Instance()->Remove_Prototype (OldName); } WW3DAssetManager::Get_Instance()->Add_Prototype (prototype); diff --git a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp index 19678a6744d..0ec260b3861 100644 --- a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp @@ -83,7 +83,7 @@ static void ConvertShortMapPathToLongMapPath(AsciiString &mapName) return; } path.nextToken(&token, "\\/"); - while (!token.endsWithNoCase(".map") && (token.getLength() > 0)) + while (!token.endsWithNoCase(".map") && (!token.isEmpty())) { actualpath.concat(token); actualpath.concat('\\'); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index e249a7fe964..293a5b36ae4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -122,7 +122,7 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); if (control != NULL) { - if (name.getLength() > 0) { + if (!name.isEmpty()) { GadgetStaticTextSetText(control, name); // showPlayerControls(playerNum); } @@ -132,12 +132,12 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { control = TheWindowManager->winGetWindowFromId(NULL, id); if (control != NULL) { - if (name.getLength() > 0) { + if (!name.isEmpty()) { GadgetStaticTextSetText(control, L""); } } - if (name.getLength() > 0) { + if (!name.isEmpty()) { showPlayerControls(playerNum); } else { hidePlayerControls(playerNum); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 89e8efd6853..36467a3d0ff 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -233,7 +233,7 @@ UnicodeString LANPreferences::getRemoteIPEntry(Int i) asciientry.set(asciientry.str() + 1); // skip the ':' ret.translate(ipstr); - if (asciientry.getLength() > 0) + if (!asciientry.isEmpty()) { ret.concat(L"("); ret.concat(QuotedPrintableToUnicodeString(asciientry)); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index f9e73497799..8d3b77b289c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -285,7 +285,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) UnicodeString name; name = userprefs.getUserName(); - if (name.getLength() == 0) + if (name.isEmpty()) { name = TheGameText->fetch("GUI:Player"); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 4d9081decac..77b256438ef 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -504,7 +504,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W UnicodeString name; name = GadgetTextEntryGetText(textEntryGameName); name.trim(); - if(name.getLength() <= 0) + if(name.isEmpty()) { name.translate(TheGameSpyInfo->getLocalName()); GadgetTextEntrySetText(textEntryGameName, name); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index 27ea79983ce..f30f54eb303 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -300,7 +300,7 @@ static int Build_List_From_String // // Add this entry to our list // - if ((entry_string.Get_Length () > 0) || (count == 0)) { + if ((!entry_string.Is_Empty()) || (count == 0)) { (*string_list)[count++] = entry_string; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp index 19678a6744d..0ec260b3861 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp @@ -83,7 +83,7 @@ static void ConvertShortMapPathToLongMapPath(AsciiString &mapName) return; } path.nextToken(&token, "\\/"); - while (!token.endsWithNoCase(".map") && (token.getLength() > 0)) + while (!token.endsWithNoCase(".map") && (!token.isEmpty())) { actualpath.concat(token); actualpath.concat('\\'); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index 13c80807eaf..6c2ffe60e4a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -121,7 +121,7 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); if (control != NULL) { - if (name.getLength() > 0) { + if (!name.isEmpty()) { GadgetStaticTextSetText(control, name); // showPlayerControls(playerNum); } @@ -131,12 +131,12 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { control = TheWindowManager->winGetWindowFromId(NULL, id); if (control != NULL) { - if (name.getLength() > 0) { + if (!name.isEmpty()) { GadgetStaticTextSetText(control, L""); } } - if (name.getLength() > 0) { + if (!name.isEmpty()) { showPlayerControls(playerNum); } else { hidePlayerControls(playerNum); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 359d9da1011..58418c946df 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -233,7 +233,7 @@ UnicodeString LANPreferences::getRemoteIPEntry(Int i) asciientry.set(asciientry.str() + 1); // skip the ':' ret.translate(ipstr); - if (asciientry.getLength() > 0) + if (!asciientry.isEmpty()) { ret.concat(L"("); ret.concat(QuotedPrintableToUnicodeString(asciientry)); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index bd85e8826fd..c6132c56e49 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -285,7 +285,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) UnicodeString name; name = userprefs.getUserName(); - if (name.getLength() == 0) + if (name.isEmpty()) { name = TheGameText->fetch("GUI:Player"); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 76a55a69e95..9d55935b356 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -537,7 +537,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W UnicodeString name; name = GadgetTextEntryGetText(textEntryGameName); name.trim(); - if(name.getLength() <= 0) + if(name.isEmpty()) { name.translate(TheGameSpyInfo->getLocalName()); GadgetTextEntrySetText(textEntryGameName, name); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index af10ea6633e..0696c96d364 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -300,7 +300,7 @@ static int Build_List_From_String // // Add this entry to our list // - if ((entry_string.Get_Length () > 0) || (count == 0)) { + if ((!entry_string.Is_Empty()) || (count == 0)) { (*string_list)[count++] = entry_string; } } From e616d8217e614e074aae733c72a28bed54381cc9 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 22 Dec 2025 15:02:10 -0500 Subject: [PATCH 008/211] fix(logic): Fix unexpected return in GameLogic::logicMessageDispatcher's switch case MSG_CANCEL_UNIT_CREATE (#1881) --- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index aa4af7eb541..dc05ea60e69 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1387,7 +1387,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // get the unit production interface ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); if( pu == NULL ) - return; + break; // cancel the production pu->cancelUnitCreate( productionID ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 07cdbb63b38..ef0b9794c01 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1415,7 +1415,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // get the unit production interface ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); if( pu == NULL ) - return; + break; // cancel the production pu->cancelUnitCreate( productionID ); From 5dba2a08abf57175c8a66cc05f8a34fa85e39ba5 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 22 Dec 2025 15:02:39 -0500 Subject: [PATCH 009/211] perf(audio): Optimize fail condition order in AudioManager::addAudioEvent (#1843) --- Core/GameEngine/Source/Common/Audio/GameAudio.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 9917266a64a..8db82783b31 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -440,6 +440,11 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) return AHSV_NoSound; } + if (!eventToAdd->getUninterruptable()) { + if (!shouldPlayLocally(eventToAdd)) { + return AHSV_NotForLocal; + } + } AudioEventRTS *audioEvent = MSGNEW("AudioEventRTS") AudioEventRTS(*eventToAdd); // poolify audioEvent->setPlayingHandle( allocateNewHandle() ); @@ -455,13 +460,6 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) } } - if (!audioEvent->getUninterruptable()) { - if (!shouldPlayLocally(audioEvent)) { - releaseAudioEventRTS(audioEvent); - return AHSV_NotForLocal; - } - } - // cull muted audio if (audioEvent->getVolume() < m_audioSettings->m_minVolume) { #ifdef INTENSIVE_AUDIO_DEBUG From 2b37732cbe3f666ad5a437f2d3c204049ca9d39d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Dec 2025 16:41:20 +0100 Subject: [PATCH 010/211] refactor(audio): Simplify volume related code in AudioManager and MilesAudioManager (#2030) --- Core/GameEngine/Include/Common/GameAudio.h | 4 ++-- .../Source/Common/Audio/AudioEventRTS.cpp | 24 ++++++++----------- .../Source/Common/Audio/GameAudio.cpp | 18 +++++++------- .../MilesAudioDevice/MilesAudioManager.cpp | 18 +++++++++----- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameAudio.h b/Core/GameEngine/Include/Common/GameAudio.h index c88b9303aca..de19bb7fcc2 100644 --- a/Core/GameEngine/Include/Common/GameAudio.h +++ b/Core/GameEngine/Include/Common/GameAudio.h @@ -105,7 +105,7 @@ enum local player affiliation, etc. (The entire list of checks is contained in shouldPlayLocally()). In addition, the world and unit audio are never allowed to exceed their footprint, as specified - in the audio settings INI file. In order to accomodate this, the audio uses an audio cache. The + in the audio settings INI file. In order to accommodate this, the audio uses an audio cache. The audio cache will attempt to load a sample, assuming there is enough room. If there is not enough room, then it goes through and finds any samples that are lower priority, and kills them until enough room is present for the sample. If it cannot free enough room, nothing happens to the @@ -190,7 +190,7 @@ class AudioManager : public SubsystemInterface virtual void closeDevice( void ) = 0; virtual void *getDevice( void ) = 0; - // Debice Dependent notification functions + // Device Dependent notification functions virtual void notifyOfAudioCompletion( UnsignedInt audioCompleted, UnsignedInt flags ) = 0; // Device Dependent enumerate providers functions. It is okay for there to be only 1 provider (Miles provides a maximum of 64. diff --git a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp index eda40c71c7e..c15c26a570e 100644 --- a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp +++ b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp @@ -724,14 +724,13 @@ void AudioEventRTS::setVolume( Real vol ) //------------------------------------------------------------------------------------------------- const Coord3D *AudioEventRTS::getCurrentPosition( void ) { - if (m_ownerType == OT_Positional) + switch (m_ownerType) { + case OT_Positional: return &m_positionOfAudio; - } - else if (m_ownerType == OT_Object) - { - Object *obj = TheGameLogic->findObjectByID(m_objectID); - if (obj) + + case OT_Object: + if (Object *obj = TheGameLogic->findObjectByID(m_objectID)) { m_positionOfAudio.set( obj->getPosition() ); } @@ -740,11 +739,9 @@ const Coord3D *AudioEventRTS::getCurrentPosition( void ) m_ownerType = OT_Dead; } return &m_positionOfAudio; - } - else if (m_ownerType == OT_Drawable) - { - Drawable *draw = TheGameClient->findDrawableByID(m_drawableID); - if( draw ) + + case OT_Drawable: + if (Drawable *draw = TheGameClient->findDrawableByID(m_drawableID)) { m_positionOfAudio.set( draw->getPosition() ); } @@ -753,9 +750,8 @@ const Coord3D *AudioEventRTS::getCurrentPosition( void ) m_ownerType = OT_Dead; } return &m_positionOfAudio; - } - else if( m_ownerType == OT_Dead ) - { + + case OT_Dead: return &m_positionOfAudio; } diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 8db82783b31..23c944fd950 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -419,7 +419,12 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) } } - switch (eventToAdd->getAudioEventInfo()->m_soundType) + const AudioType soundType = eventToAdd->getAudioEventInfo()->m_soundType; + + // Check if audio type is on + // TheSuperHackers @info Zero audio volume is not a fail condition, because music, speech and sounds + // still need to be in flight in case the user raises the volume on runtime after the audio was already triggered. + switch (soundType) { case AT_Music: if (!isOn(AudioAffect_Music)) @@ -430,16 +435,14 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) return AHSV_NoSound; break; case AT_Streaming: + // if we're currently playing uninterruptable speech, then disallow the addition of this sample + if (getDisallowSpeech()) + return AHSV_NoSound; if (!isOn(AudioAffect_Speech)) return AHSV_NoSound; break; } - // if we're currently playing uninterruptable speech, then disallow the addition of this sample - if (getDisallowSpeech() && eventToAdd->getAudioEventInfo()->m_soundType == AT_Streaming) { - return AHSV_NoSound; - } - if (!eventToAdd->getUninterruptable()) { if (!shouldPlayLocally(eventToAdd)) { return AHSV_NotForLocal; @@ -469,8 +472,7 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) return AHSV_Muted; } - AudioType type = eventToAdd->getAudioEventInfo()->m_soundType; - if (type == AT_Music) + if (soundType == AT_Music) { m_music->addAudioEvent(audioEvent); } diff --git a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index 973669ed6b4..5a47735ca77 100644 --- a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -2677,25 +2677,29 @@ Bool MilesAudioManager::isOnScreen( const Coord3D *pos ) const //------------------------------------------------------------------------------------------------- Real MilesAudioManager::getEffectiveVolume(AudioEventRTS *event) const { - Real volume = 1.0f; - volume *= (event->getVolume() * event->getVolumeShift()); - if (event->getAudioEventInfo()->m_soundType == AT_Music) + Real volume = event->getVolume() * event->getVolumeShift(); + + switch (event->getAudioEventInfo()->m_soundType) + { + case AT_Music: { volume *= m_musicVolume; + break; } - else if (event->getAudioEventInfo()->m_soundType == AT_Streaming) + case AT_Streaming: { volume *= m_speechVolume; + break; } - else + case AT_SoundEffect: { if (event->isPositionalAudio()) { volume *= m_sound3DVolume; - Coord3D distance = m_listenerPosition; const Coord3D *pos = event->getCurrentPosition(); if (pos) { + Coord3D distance = m_listenerPosition; distance.sub(pos); Real objMinDistance; Real objMaxDistance; @@ -2730,6 +2734,8 @@ Real MilesAudioManager::getEffectiveVolume(AudioEventRTS *event) const { volume *= m_soundVolume; } + break; + } } return volume; From 20927af519499222a68ad50c5f270dbbccc88aca Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Tue, 30 Dec 2025 16:18:57 -0500 Subject: [PATCH 011/211] ci(vcpkg): Stabilize vcpkg binary caching; add compiler-aware keys and explicit cache path (#2028) --- .github/workflows/build-toolchain.yml | 86 +++++++++++++++++++++------ 1 file changed, 69 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-toolchain.yml b/.github/workflows/build-toolchain.yml index 5999ee132b5..6dcad70e0de 100644 --- a/.github/workflows/build-toolchain.yml +++ b/.github/workflows/build-toolchain.yml @@ -31,23 +31,16 @@ jobs: name: ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} runs-on: windows-2022 timeout-minutes: 30 + env: VCPKG_FILE_CACHE: ${{ github.workspace }}\vcpkg-bincache VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}\vcpkg-bincache,readwrite VCPKG_FEATURE_FLAGS: manifests,versions,binarycaching + steps: - name: Checkout Code uses: actions/checkout@v4 - - name: Cache vcpkg binary artifacts - uses: actions/cache@v4 - with: - path: ${{ github.workspace }}\vcpkg-bincache - key: vcpkg-bincache-${{ runner.os }}-${{ hashFiles('vcpkg.json','vcpkg-lock.json') }}-${{ inputs.preset }} - restore-keys: | - vcpkg-bincache-${{ runner.os }}-${{ hashFiles('vcpkg.json','vcpkg-lock.json') }}- - vcpkg-bincache-${{ runner.os }}- - - name: Cache VC6 Installation if: startsWith(inputs.preset, 'vc6') id: cache-vc6 @@ -112,15 +105,65 @@ jobs: with: arch: x86 + - name: Compute vcpkg cache key parts + if: startsWith(inputs.preset, 'win32') + id: vcpkg_key + shell: pwsh + run: | + $baseline = (Get-Content vcpkg.json | ConvertFrom-Json)."builtin-baseline" + + $msvc = $env:VCToolsVersion + if (-not $msvc) { $msvc = "unknown" } + + # Reduce churn: keep major.minor (e.g. 14.44) + $msvcMajorMinor = ($msvc -split '\.')[0..1] -join '.' + + $triplet = "x86-windows" + if ("${{ inputs.preset }}" -like "x64*") { $triplet = "x64-windows" } + + "baseline=$baseline" >> $env:GITHUB_OUTPUT + "msvc=$msvcMajorMinor" >> $env:GITHUB_OUTPUT + "triplet=$triplet" >> $env:GITHUB_OUTPUT + + Write-Host "vcpkg cache key parts: baseline=$baseline, msvc=$msvcMajorMinor, triplet=$triplet" + + - name: Restore vcpkg binary cache + if: startsWith(inputs.preset, 'win32') + id: vcpkg_cache + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}\vcpkg-bincache + key: vcpkg-bincache-v2-${{ runner.os }}-msvc${{ steps.vcpkg_key.outputs.msvc }}-baseline${{ steps.vcpkg_key.outputs.baseline }}-${{ steps.vcpkg_key.outputs.triplet }} + restore-keys: | + vcpkg-bincache-v2-${{ runner.os }}-msvc${{ steps.vcpkg_key.outputs.msvc }}-baseline${{ steps.vcpkg_key.outputs.baseline }}- + vcpkg-bincache-v2-${{ runner.os }}- + - name: Setup vcpkg uses: lukka/run-vcpkg@v11 + with: + runVcpkgInstall: false + doNotCache: true + + - name: Configure vcpkg to use cached directory + if: startsWith(inputs.preset, 'win32') + shell: pwsh + run: | + $cacheDir = "${{ github.workspace }}\vcpkg-bincache" + New-Item -ItemType Directory -Force -Path $cacheDir | Out-Null + + # lukka/run-vcpkg sets its own temp cache dir; override to force our cached dir + $env:VCPKG_DEFAULT_BINARY_CACHE = $cacheDir + $env:VCPKG_BINARY_SOURCES = "clear;files,$cacheDir,readwrite" + + "VCPKG_DEFAULT_BINARY_CACHE=$cacheDir" >> $env:GITHUB_ENV + "VCPKG_BINARY_SOURCES=$env:VCPKG_BINARY_SOURCES" >> $env:GITHUB_ENV - name: Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset shell: pwsh run: | $buildFlags = @( - "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}", - "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}" + "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}", + "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}" ) $gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}" @@ -130,7 +173,6 @@ jobs: $buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}" Write-Host "Build flags: $($buildFlags -join ' | ')" - cmake --preset ${{ inputs.preset }} $buildFlags - name: Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset @@ -138,19 +180,29 @@ jobs: run: | cmake --build --preset ${{ inputs.preset }} + - name: Save vcpkg binary cache + # Only one job should save to avoid "Unable to reserve cache" conflicts. + if: ${{ startsWith(inputs.preset, 'win32') && steps.vcpkg_cache.outputs.cache-hit != 'true' && inputs.game == 'Generals' && inputs.preset == 'win32-vcpkg-debug' }} + uses: actions/cache/save@v4 + with: + path: ${{ github.workspace }}\vcpkg-bincache + key: vcpkg-bincache-v2-${{ runner.os }}-msvc${{ steps.vcpkg_key.outputs.msvc }}-baseline${{ steps.vcpkg_key.outputs.baseline }}-${{ steps.vcpkg_key.outputs.triplet }} + - name: Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact shell: pwsh run: | $buildDir = "build\${{ inputs.preset }}" $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose - if ("${{ inputs.preset }}" -like "win32*") { - # For win32 preset, look in config-specific subdirectories + if ("${{ inputs.preset }}" -like "win32*") { $configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" } - $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose - } else { - $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose + $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | + Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose + } else { + $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | + Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose } + $files | Move-Item -Destination $artifactsDir -Verbose -Force - name: Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact From f5ccc9cb9550515f608cfeb980a0b79ea314a37b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 31 Dec 2025 20:55:19 +1100 Subject: [PATCH 012/211] bugfix(aiupdate): Invalidate build task of Dozers and Workers if the assigned target scaffold no longer exists (#1868) --- .../GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 5 +++++ .../GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp | 5 +++++ .../GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 5 +++++ .../GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 32aa3ece0fc..4ef21b66eb0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1594,9 +1594,14 @@ UpdateSleepTime DozerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 4721df43daa..54a92e76664 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -275,9 +275,14 @@ UpdateSleepTime WorkerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index e901fd9df84..40c16a53d47 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1599,9 +1599,14 @@ UpdateSleepTime DozerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index f36a83f720f..5233e93bf05 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -275,9 +275,14 @@ UpdateSleepTime WorkerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) From a4c76b980d5c2ebc8c3e289358f0fe9cf2bcbf57 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 31 Dec 2025 07:21:47 -0500 Subject: [PATCH 013/211] perf(contain): Optimize Object::isHero with cached hero counter (#1841) --- .../Include/GameLogic/Module/ContainModule.h | 1 + .../Include/GameLogic/Module/OpenContain.h | 3 ++ .../GameLogic/Object/Contain/OpenContain.cpp | 44 +++++++++++++++++-- .../Source/GameLogic/Object/Object.cpp | 16 +------ .../Include/GameLogic/Module/ContainModule.h | 1 + .../Include/GameLogic/Module/OpenContain.h | 3 ++ .../GameLogic/Object/Contain/OpenContain.cpp | 43 +++++++++++++++++- .../Source/GameLogic/Object/Object.cpp | 15 +------ 8 files changed, 94 insertions(+), 32 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h index a07b9a856bf..b62b2a7f244 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ContainModule.h @@ -155,6 +155,7 @@ class ContainModuleInterface virtual const Object *friend_getRider() const = 0; ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const = 0; virtual UnsignedInt getStealthUnitsContained() const = 0; + virtual UnsignedInt getHeroUnitsContained() const = 0; virtual Bool calcBestGarrisonPosition( Coord3D *sourcePos, const Coord3D *targetPos ) = 0; virtual Bool attemptBestFirePointPosition( Object *source, Weapon *weapon, Object *victim ) = 0; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index fecfaa2e131..a60d56c3ce4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -164,6 +164,7 @@ class OpenContain : public UpdateModule, virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const; virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; } + virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; } virtual PlayerMaskType getPlayerWhoEntered(void) const { return m_playerEnteredMask; } @@ -238,6 +239,8 @@ class OpenContain : public UpdateModule, ObjectEnterExitMap m_objectEnterExitInfo; UnsignedInt m_stealthUnitsContained; ///< number of stealth units that can't be seen by enemy players. + UnsignedInt m_heroUnitsContained; ///< cached hero count + XferVersion m_xferVersion; ///< version of loaded save file for loadPostProcess Int m_whichExitPath; ///< Cycles from 1 to n and is used only in modules whose data has numberOfExitPaths > 1. UnsignedInt m_doorCloseCountdown; ///< When should I shut my door. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 9cff8d09cdc..659ae112d51 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -125,6 +125,8 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM m_lastLoadSoundFrame = 0; m_containListSize = 0; m_stealthUnitsContained = 0; + m_heroUnitsContained = 0; + m_xferVersion = 1; m_doorCloseCountdown = 0; m_rallyPoint.zero(); @@ -352,6 +354,10 @@ void OpenContain::addToContainList( Object *rider ) { m_stealthUnitsContained++; } + if( rider->isKindOf( KINDOF_HERO ) ) + { + m_heroUnitsContained++; + } } //------------------------------------------------------------------------------------------------- @@ -532,6 +538,7 @@ void OpenContain::removeFromContainViaIterator( ContainedItemsList::iterator it, m_containListSize--; if( rider->isKindOf( KINDOF_STEALTH_GARRISON ) ) { + DEBUG_ASSERTCRASH( m_stealthUnitsContained > 0, ("OpenContain::removeFromContainViaIterator - Removing stealth unit but stealth count is %d", m_stealthUnitsContained) ); m_stealthUnitsContained--; if( exposeStealthUnits ) { @@ -542,6 +549,11 @@ void OpenContain::removeFromContainViaIterator( ContainedItemsList::iterator it, } } } + if( rider->isKindOf( KINDOF_HERO ) ) + { + DEBUG_ASSERTCRASH( m_heroUnitsContained > 0, ("OpenContain::removeFromContainViaIterator - Removing hero but hero count is %d", m_heroUnitsContained) ); + m_heroUnitsContained--; + } if (isEnclosingContainerFor( rider )) @@ -620,7 +632,7 @@ void OpenContain::scatterToNearbyPosition(Object* rider) } //------------------------------------------------------------------------------------------------- -void OpenContain::onContaining( Object * /*rider*/ ) +void OpenContain::onContaining( Object *rider ) { // Play audio if( m_loadSoundsEnabled ) @@ -1442,15 +1454,22 @@ void OpenContain::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Serialize hero units contained count + */ // ------------------------------------------------------------------------------------------------ void OpenContain::xfer( Xfer *xfer ) { // version - const XferVersion currentVersion = 1; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); + m_xferVersion = version; // extend base class UpdateModule::xfer( xfer ); @@ -1526,6 +1545,12 @@ void OpenContain::xfer( Xfer *xfer ) // stealth units contained xfer->xferUnsignedInt( &m_stealthUnitsContained ); + // hero units contained + if (version >= 2) + { + xfer->xferUnsignedInt( &m_heroUnitsContained ); + } + // door close countdown xfer->xferUnsignedInt( &m_doorCloseCountdown ); @@ -1658,6 +1683,19 @@ void OpenContain::loadPostProcess( void ) } + if (m_xferVersion < 2) + { + // Restore hero count by iterating hero objects for old save versions + m_heroUnitsContained = 0; + for( ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it ) + { + if( (*it)->isKindOf( KINDOF_HERO ) ) + { + m_heroUnitsContained++; + } + } + } + // sanity DEBUG_ASSERTCRASH( m_containListSize == m_containList.size(), ("OpenContain::loadPostProcess - contain list count mismatch") ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 49d49491de2..7634db8058f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -593,25 +593,13 @@ Object::~Object() } //------------------------------------------------------------------------------------------------- -void localIsHero( Object *obj, void* userData ) -{ - Bool *hero = (Bool*)userData; - - if( obj && obj->isKindOf( KINDOF_HERO ) ) - { - *hero = TRUE; - } -} - -//------------------------------------------------------------------------------------------------- +// TheSuperHackers @performance bobtista 13/11/2025 Use cached hero count for O(1) lookup instead of O(n) iteration. Bool Object::isHero() const { ContainModuleInterface *contain = getContain(); if( contain ) { - Bool heroInside = FALSE; - contain->iterateContained( localIsHero, (void*)(&heroInside), FALSE ); - if( heroInside ) + if( contain->getHeroUnitsContained() > 0 ) { return TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h index f85817f8315..5a2db53fd1a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h @@ -175,6 +175,7 @@ class ContainModuleInterface virtual const Object *friend_getRider() const = 0; ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const = 0; virtual UnsignedInt getStealthUnitsContained() const = 0; + virtual UnsignedInt getHeroUnitsContained() const = 0; virtual Bool calcBestGarrisonPosition( Coord3D *sourcePos, const Coord3D *targetPos ) = 0; virtual Bool attemptBestFirePointPosition( Object *source, Weapon *weapon, Object *victim ) = 0; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index 180fc86aac8..3af77883edb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -174,6 +174,7 @@ class OpenContain : public UpdateModule, virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const; virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; } + virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; } virtual PlayerMaskType getPlayerWhoEntered(void) const { return m_playerEnteredMask; } @@ -259,6 +260,8 @@ class OpenContain : public UpdateModule, ObjectEnterExitMap m_objectEnterExitInfo; UnsignedInt m_stealthUnitsContained; ///< number of stealth units that can't be seen by enemy players. + UnsignedInt m_heroUnitsContained; ///< cached hero count + XferVersion m_xferVersion; ///< version of loaded save file for loadPostProcess Int m_whichExitPath; ///< Cycles from 1 to n and is used only in modules whose data has numberOfExitPaths > 1. UnsignedInt m_doorCloseCountdown; ///< When should I shut my door. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 2f2bbea878c..51f088d961a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -129,6 +129,8 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM m_lastLoadSoundFrame = 0; m_containListSize = 0; m_stealthUnitsContained = 0; + m_heroUnitsContained = 0; + m_xferVersion = 1; m_doorCloseCountdown = 0; m_rallyPoint.zero(); @@ -374,6 +376,10 @@ void OpenContain::addToContainList( Object *rider ) { m_stealthUnitsContained++; } + if( rider->isKindOf( KINDOF_HERO ) ) + { + m_heroUnitsContained++; + } } //------------------------------------------------------------------------------------------------- @@ -650,6 +656,7 @@ void OpenContain::removeFromContainViaIterator( ContainedItemsList::iterator it, m_containListSize--; if( rider->isKindOf( KINDOF_STEALTH_GARRISON ) ) { + DEBUG_ASSERTCRASH( m_stealthUnitsContained > 0, ("OpenContain::removeFromContainViaIterator - Removing stealth unit but stealth count is %d", m_stealthUnitsContained) ); m_stealthUnitsContained--; if( exposeStealthUnits ) { @@ -660,6 +667,11 @@ void OpenContain::removeFromContainViaIterator( ContainedItemsList::iterator it, } } } + if( rider->isKindOf( KINDOF_HERO ) ) + { + DEBUG_ASSERTCRASH( m_heroUnitsContained > 0, ("OpenContain::removeFromContainViaIterator - Removing hero but hero count is %d", m_heroUnitsContained) ); + m_heroUnitsContained--; + } if (isEnclosingContainerFor( rider )) @@ -1667,15 +1679,23 @@ void OpenContain::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Added m_passengerAllowedToFire + * 3: TheSuperHackers @tweak Serialize hero units contained count + */ // ------------------------------------------------------------------------------------------------ void OpenContain::xfer( Xfer *xfer ) { // version - const XferVersion currentVersion = 2; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 2; +#else + XferVersion currentVersion = 3; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); + m_xferVersion = version; // extend base class UpdateModule::xfer( xfer ); @@ -1751,6 +1771,12 @@ void OpenContain::xfer( Xfer *xfer ) // stealth units contained xfer->xferUnsignedInt( &m_stealthUnitsContained ); + // hero units contained + if (version >= 3) + { + xfer->xferUnsignedInt( &m_heroUnitsContained ); + } + // door close countdown xfer->xferUnsignedInt( &m_doorCloseCountdown ); @@ -1890,6 +1916,19 @@ void OpenContain::loadPostProcess( void ) } + if (m_xferVersion < 3) + { + // Restore hero count by iterating hero objects for old save versions + m_heroUnitsContained = 0; + for( ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it ) + { + if( (*it)->isKindOf( KINDOF_HERO ) ) + { + m_heroUnitsContained++; + } + } + } + // sanity DEBUG_ASSERTCRASH( m_containListSize == m_containList.size(), ("OpenContain::loadPostProcess - contain list count mismatch") ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index bca7c39b872..7052147358b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2067,25 +2067,14 @@ Bool Object::isNonFactionStructure(void) const return isStructure() && !isFactionStructure(); } -void localIsHero( Object *obj, void* userData ) -{ - Bool *hero = (Bool*)userData; - - if( obj && obj->isKindOf( KINDOF_HERO ) ) - { - *hero = TRUE; - } -} - //------------------------------------------------------------------------------------------------- +// TheSuperHackers @performance bobtista 13/11/2025 Use cached hero count for O(1) lookup instead of O(n) iteration. Bool Object::isHero(void) const { ContainModuleInterface *contain = getContain(); if( contain ) { - Bool heroInside = FALSE; - contain->iterateContained( localIsHero, (void*)(&heroInside), FALSE ); - if( heroInside ) + if( contain->getHeroUnitsContained() > 0 ) { return TRUE; } From 5e8f1b8df3b97244185c4cbc9d6c3832acc14037 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 31 Dec 2025 07:25:23 -0500 Subject: [PATCH 014/211] refactor(network): Simplify error prone net packet size calculations with packed structs (#1675) --- Core/GameEngine/CMakeLists.txt | 1 + .../Include/GameNetwork/NetCommandMsg.h | 80 ++- .../Include/GameNetwork/NetPacket.h | 3 +- .../Include/GameNetwork/NetPacketStructs.h | 420 +++++++++++ .../System/GameMemoryInitPools_Generals.inl | 2 + .../System/GameMemoryInitPools_GeneralsMD.inl | 2 + .../Source/GameNetwork/ConnectionManager.cpp | 6 +- .../Source/GameNetwork/NetCommandMsg.cpp | 211 +++++- .../Source/GameNetwork/NetPacket.cpp | 650 ++---------------- 9 files changed, 781 insertions(+), 594 deletions(-) create mode 100644 Core/GameEngine/Include/GameNetwork/NetPacketStructs.h diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index cd3cb89e9eb..eb7b7541e14 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -546,6 +546,7 @@ set(GAMEENGINE_SRC Include/GameNetwork/NetCommandRef.h Include/GameNetwork/NetCommandWrapperList.h Include/GameNetwork/NetPacket.h + Include/GameNetwork/NetPacketStructs.h Include/GameNetwork/NetworkDefs.h Include/GameNetwork/NetworkInterface.h Include/GameNetwork/networkutil.h diff --git a/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h b/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h index 59b05f88e29..84eb1566689 100644 --- a/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h +++ b/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h @@ -44,12 +44,13 @@ class NetCommandMsg : public MemoryPoolObject void setExecutionFrame(UnsignedInt frame) { m_executionFrame = frame; } void setPlayerID(UnsignedInt playerID) { m_playerID = playerID; } void setID(UnsignedShort id) { m_id = id; } - UnsignedInt getExecutionFrame() { return m_executionFrame; } - UnsignedInt getPlayerID() { return m_playerID; } - UnsignedShort getID() { return m_id; } + UnsignedInt getExecutionFrame() const { return m_executionFrame; } + UnsignedInt getPlayerID() const { return m_playerID; } + UnsignedShort getID() const { return m_id; } void setNetCommandType(NetCommandType type) { m_commandType = type; } NetCommandType getNetCommandType() { return m_commandType; } virtual Int getSortNumber(); + virtual size_t getPackedByteCount() const = 0; void attach(); void detach(); @@ -76,10 +77,12 @@ class NetGameCommandMsg : public NetCommandMsg NetGameCommandMsg(GameMessage *msg); //virtual ~NetGameCommandMsg(); - GameMessage *constructGameMessage(); + GameMessage *constructGameMessage() const; void addArgument(const GameMessageArgumentDataType type, GameMessageArgumentType arg); void setGameMessageType(GameMessage::Type type); + virtual size_t getPackedByteCount() const; + protected: Int m_numArgs; Int m_argSize; @@ -106,6 +109,8 @@ class NetAckBothCommandMsg : public NetCommandMsg void setOriginalPlayerID(UnsignedByte originalPlayerID); virtual Int getSortNumber(); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_commandID; UnsignedByte m_originalPlayerID; @@ -130,6 +135,8 @@ class NetAckStage1CommandMsg : public NetCommandMsg void setOriginalPlayerID(UnsignedByte originalPlayerID); virtual Int getSortNumber(); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_commandID; UnsignedByte m_originalPlayerID; @@ -154,6 +161,8 @@ class NetAckStage2CommandMsg : public NetCommandMsg void setOriginalPlayerID(UnsignedByte originalPlayerID); virtual Int getSortNumber(); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_commandID; UnsignedByte m_originalPlayerID; @@ -170,6 +179,8 @@ class NetFrameCommandMsg : public NetCommandMsg void setCommandCount(UnsignedShort commandCount); UnsignedShort getCommandCount(); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_commandCount; }; @@ -185,6 +196,8 @@ class NetPlayerLeaveCommandMsg : public NetCommandMsg UnsignedByte getLeavingPlayerID(); void setLeavingPlayerID(UnsignedByte id); + virtual size_t getPackedByteCount() const; + protected: UnsignedByte m_leavingPlayerID; }; @@ -202,6 +215,8 @@ class NetRunAheadMetricsCommandMsg : public NetCommandMsg Int getAverageFps(); void setAverageFps(Int fps); + virtual size_t getPackedByteCount() const; + protected: Real m_averageLatency; Int m_averageFps; @@ -221,6 +236,8 @@ class NetRunAheadCommandMsg : public NetCommandMsg UnsignedByte getFrameRate(); void setFrameRate(UnsignedByte frameRate); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_runAhead; UnsignedByte m_frameRate; @@ -237,6 +254,8 @@ class NetDestroyPlayerCommandMsg : public NetCommandMsg UnsignedInt getPlayerIndex(); void setPlayerIndex(UnsignedInt playerIndex); + virtual size_t getPackedByteCount() const; + protected: UnsignedInt m_playerIndex; }; @@ -248,6 +267,8 @@ class NetKeepAliveCommandMsg : public NetCommandMsg public: NetKeepAliveCommandMsg(); //virtual ~NetKeepAliveCommandMsg(); + + virtual size_t getPackedByteCount() const; }; //----------------------------------------------------------------------------- @@ -257,6 +278,8 @@ class NetDisconnectKeepAliveCommandMsg : public NetCommandMsg public: NetDisconnectKeepAliveCommandMsg(); //virtual ~NetDisconnectKeepAliveCommandMsg(); + + virtual size_t getPackedByteCount() const; }; //----------------------------------------------------------------------------- @@ -273,6 +296,8 @@ class NetDisconnectPlayerCommandMsg : public NetCommandMsg UnsignedInt getDisconnectFrame(); void setDisconnectFrame(UnsignedInt frame); + virtual size_t getPackedByteCount() const; + protected: UnsignedByte m_disconnectSlot; UnsignedInt m_disconnectFrame; @@ -285,6 +310,8 @@ class NetPacketRouterQueryCommandMsg : public NetCommandMsg public: NetPacketRouterQueryCommandMsg(); //virtual ~NetPacketRouterQueryCommandMsg(); + + virtual size_t getPackedByteCount() const; }; //----------------------------------------------------------------------------- @@ -294,6 +321,8 @@ class NetPacketRouterAckCommandMsg : public NetCommandMsg public: NetPacketRouterAckCommandMsg(); //virtual ~NetPacketRouterAckCommandMsg(); + + virtual size_t getPackedByteCount() const; }; //----------------------------------------------------------------------------- @@ -307,6 +336,8 @@ class NetDisconnectChatCommandMsg : public NetCommandMsg UnicodeString getText(); void setText(UnicodeString text); + virtual size_t getPackedByteCount() const; + protected: UnicodeString m_text; }; @@ -325,6 +356,8 @@ class NetChatCommandMsg : public NetCommandMsg Int getPlayerMask( void ); void setPlayerMask( Int playerMask ); + virtual size_t getPackedByteCount() const; + protected: UnicodeString m_text; Int m_playerMask; @@ -344,6 +377,8 @@ class NetDisconnectVoteCommandMsg : public NetCommandMsg UnsignedInt getVoteFrame(); void setVoteFrame(UnsignedInt voteFrame); + virtual size_t getPackedByteCount() const; + protected: UnsignedByte m_slot; UnsignedInt m_voteFrame; @@ -359,6 +394,9 @@ class NetProgressCommandMsg: public NetCommandMsg UnsignedByte getPercentage(); void setPercentage( UnsignedByte percent ); + + virtual size_t getPackedByteCount() const; + protected: UnsignedByte m_percent; }; @@ -374,6 +412,8 @@ class NetWrapperCommandMsg : public NetCommandMsg UnsignedByte * getData(); void setData(UnsignedByte *data, UnsignedInt dataLength); + virtual size_t getPackedByteCount() const; + UnsignedInt getChunkNumber(); void setChunkNumber(UnsignedInt chunkNumber); @@ -421,6 +461,8 @@ class NetFileCommandMsg : public NetCommandMsg UnsignedByte * getFileData(); void setFileData(UnsignedByte *data, UnsignedInt dataLength); + virtual size_t getPackedByteCount() const; + protected: AsciiString m_portableFilename; @@ -448,6 +490,8 @@ class NetFileAnnounceCommandMsg : public NetCommandMsg UnsignedByte getPlayerMask(void); void setPlayerMask(UnsignedByte playerMask); + virtual size_t getPackedByteCount() const; + protected: AsciiString m_portableFilename; UnsignedShort m_fileID; @@ -468,6 +512,8 @@ class NetFileProgressCommandMsg : public NetCommandMsg Int getProgress(); void setProgress(Int val); + virtual size_t getPackedByteCount() const; + protected: UnsignedShort m_fileID; Int m_progress; @@ -483,6 +529,8 @@ class NetDisconnectFrameCommandMsg : public NetCommandMsg UnsignedInt getDisconnectFrame(); void setDisconnectFrame(UnsignedInt disconnectFrame); + virtual size_t getPackedByteCount() const; + protected: UnsignedInt m_disconnectFrame; }; @@ -497,6 +545,8 @@ class NetDisconnectScreenOffCommandMsg : public NetCommandMsg UnsignedInt getNewFrame(); void setNewFrame(UnsignedInt newFrame); + virtual size_t getPackedByteCount() const; + protected: UnsignedInt m_newFrame; }; @@ -511,6 +561,28 @@ class NetFrameResendRequestCommandMsg : public NetCommandMsg UnsignedInt getFrameToResend(); void setFrameToResend(UnsignedInt frame); + virtual size_t getPackedByteCount() const; + protected: UnsignedInt m_frameToResend; }; + +class NetLoadCompleteCommandMsg : public NetCommandMsg +{ + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NetLoadCompleteCommandMsg, "NetLoadCompleteCommandMsg") +public: + NetLoadCompleteCommandMsg(); + //virtual ~NetLoadCompleteCommandMsg(); + + virtual size_t getPackedByteCount() const; +}; + +class NetTimeOutGameStartCommandMsg : public NetCommandMsg +{ + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NetTimeOutGameStartCommandMsg, "NetTimeOutGameStartCommandMsg") +public: + NetTimeOutGameStartCommandMsg(); + //virtual ~NetTimeOutGameStartCommandMsg(); + + virtual size_t getPackedByteCount() const; +}; diff --git a/Core/GameEngine/Include/GameNetwork/NetPacket.h b/Core/GameEngine/Include/GameNetwork/NetPacket.h index f117df083ab..d4980a9eef0 100644 --- a/Core/GameEngine/Include/GameNetwork/NetPacket.h +++ b/Core/GameEngine/Include/GameNetwork/NetPacket.h @@ -69,10 +69,11 @@ class NetPacket : public MemoryPoolObject UnsignedInt getAddr(); UnsignedShort getPort(); -protected: static UnsignedInt GetBufferSizeNeededForCommand(NetCommandMsg *msg); static void FillBufferWithCommand(UnsignedByte *buffer, NetCommandRef *msg); +protected: + // These functions return the size of the command without any compression, repetition, etc. // i.e. All of the required fields are taken into account when returning the size. static UnsignedInt GetGameCommandSize(NetCommandMsg *msg); diff --git a/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h b/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h new file mode 100644 index 00000000000..35f5ce997a6 --- /dev/null +++ b/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h @@ -0,0 +1,420 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 TheSuperHackers +** +** 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +//////////////////////////////////////////////////////////////////////////////// +// +// TheSuperHackers @refactor BobTista 07/10/2025 +// Packed struct definitions for network packet serialization/deserialization. +// +//////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "GameNetwork/NetworkDefs.h" + +// Ensure structs are packed to 1-byte alignment for network protocol compatibility +#pragma pack(push, 1) + +//////////////////////////////////////////////////////////////////////////////// +// Network packet field type definitions +//////////////////////////////////////////////////////////////////////////////// + +// Network packet field type definitions +typedef UnsignedByte NetPacketFieldType; + +namespace NetPacketFieldTypes { + constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field + constexpr const NetPacketFieldType Relay = 'R'; // Relay field + constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field + constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field + constexpr const NetPacketFieldType Frame = 'F'; // Frame field + constexpr const NetPacketFieldType Data = 'D'; // Data payload field +} + +//////////////////////////////////////////////////////////////////////////////// +// Common packet field structures +//////////////////////////////////////////////////////////////////////////////// + +// Command Type field: 'T' + UnsignedByte +struct NetPacketCommandTypeField { + char header; + UnsignedByte commandType; +}; + +// Relay field: 'R' + UnsignedByte +struct NetPacketRelayField { + char header; + UnsignedByte relay; +}; + +// Player ID field: 'P' + UnsignedByte +struct NetPacketPlayerIdField { + char header; + UnsignedByte playerId; +}; + +// Frame field: 'F' + UnsignedInt +struct NetPacketFrameField { + char header; + UnsignedInt frame; +}; + +// Command ID field: 'C' + UnsignedShort +struct NetPacketCommandIdField { + char header; + UnsignedShort commandId; +}; + +// Data field header: 'D' (followed by variable-length data) +struct NetPacketDataFieldHeader { + char header; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Acknowledgment Command Packets +//////////////////////////////////////////////////////////////////////////////// + +// ACK command packet structure +// Fields: T + type, P + playerID, D + commandID + originalPlayerID +struct NetPacketAckCommand { + NetPacketCommandTypeField commandType; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; + UnsignedShort commandId; // Command ID being acknowledged + UnsignedByte originalPlayerId; // Original player who sent the command +}; + +//////////////////////////////////////////////////////////////////////////////// +// Frame Info Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Frame info command packet structure +// Fields: T + type, F + frame, R + relay, P + playerID, C + commandID, D + commandCount +struct NetPacketFrameCommand { + NetPacketCommandTypeField commandType; + NetPacketFrameField frame; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedShort commandCount; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Player Leave Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Player leave command packet structure +// Fields: T + type, R + relay, F + frame, P + playerID, C + commandID, D + leavingPlayerID +struct NetPacketPlayerLeaveCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketFrameField frame; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedByte leavingPlayerId; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Run Ahead Metrics Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Run ahead metrics command packet structure +// Fields: T + type, R + relay, P + playerID, C + commandID, D + averageLatency + averageFps +// TODO: averageFps should be UnsignedShort to match FillBufferWithRunAheadMetricsCommand, but +// original GetRunAheadMetricsCommandSize incorrectly counted it as UnsignedByte +struct NetPacketRunAheadMetricsCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + Real averageLatency; + UnsignedByte averageFps; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Run Ahead Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Run ahead command packet structure +// Fields: T + type, R + relay, F + frame, P + playerID, C + commandID, D + runAhead + frameRate +struct NetPacketRunAheadCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketFrameField frame; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedShort runAhead; + UnsignedByte frameRate; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Destroy Player Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Destroy player command packet structure +// Fields: T + type, R + relay, F + frame, P + playerID, C + commandID, D + playerIndex +struct NetPacketDestroyPlayerCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketFrameField frame; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedInt playerIndex; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Keep Alive Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Keep alive command packet structure +// Fields: T + type, R + relay, P + playerID, D +struct NetPacketKeepAliveCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Disconnect Keep Alive Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Disconnect keep alive command packet structure +// Fields: T + type, R + relay, P + playerID, D +struct NetPacketDisconnectKeepAliveCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Disconnect Player Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Disconnect player command packet structure +// Fields: T + type, R + relay, P + playerID, C + commandID, D + slot + disconnectFrame +struct NetPacketDisconnectPlayerCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedByte slot; + UnsignedInt disconnectFrame; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Packet Router Command Packets +//////////////////////////////////////////////////////////////////////////////// + +// Packet router query command packet +// Fields: T + type, R + relay, P + playerID, D +struct NetPacketRouterQueryCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +// Packet router ack command packet +// Fields: T + type, R + relay, P + playerID, D +struct NetPacketRouterAckCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Disconnect Vote Command Packet +//////////////////////////////////////////////////////////////////////////////// + +// Disconnect vote command +// Fields: T + type, R + relay, P + playerID, C + commandID, D + slot + voteFrame +struct NetPacketDisconnectVoteCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedByte slot; + UnsignedInt voteFrame; +}; + +//////////////////////////////////////////////////////////////////////////////// +// Packed Structs for getPackedByteCount() calculations +// These structs represent the fixed portion of variable-length command messages +//////////////////////////////////////////////////////////////////////////////// + +// Chat command packed struct +// Fixed fields: T + type, F + frame, R + relay, P + playerID, C + commandID, D +struct NetPacketChatCommand { + NetPacketCommandTypeField commandType; + NetPacketFrameField frame; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + // Variable fields: UnsignedByte textLength + UnsignedShort text[textLength] + Int playerMask +}; + +// Disconnect chat command packed struct +// Fixed fields: T + type, R + relay, P + playerID, D +struct NetPacketDisconnectChatCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; + // Variable fields: UnsignedByte textLength + UnsignedShort text[textLength] +}; + +// Game command packed struct +// Fixed fields: T + type, F + frame, R + relay, P + playerID, C + commandID, D +struct NetPacketGameCommand { + NetPacketCommandTypeField commandType; + NetPacketFrameField frame; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + // Variable fields: game message arguments +}; + +// Wrapper command packet (fixed size - contains metadata about wrapped command) +// Fields: T + type, R + relay, P + playerID, C + commandID, D + metadata +struct NetPacketWrapperCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedShort wrappedCommandId; + UnsignedInt chunkNumber; + UnsignedInt numChunks; + UnsignedInt totalDataLength; + UnsignedInt dataLength; + UnsignedInt dataOffset; +}; + +// File command packed struct +// Fixed fields: T + type, R + relay, P + playerID, C + commandID, D +struct NetPacketFileCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + // Variable fields: null-terminated filename + UnsignedInt fileDataLength + file data +}; + +// File announce command packed struct +// Fixed fields: T + type, R + relay, P + playerID, C + commandID, D +struct NetPacketFileAnnounceCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + // Variable fields: null-terminated filename + UnsignedShort fileID + UnsignedByte playerMask +}; + +// File progress command packet +// Fields: T + type, R + relay, P + playerID, C + commandID, D + fileID + progress +struct NetPacketFileProgressCommand { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketDataFieldHeader dataHeader; + UnsignedShort fileId; + Int progress; +}; + +// Progress message packet +// Fields: T + type, R + relay, P + playerID, D + percentage +struct NetPacketProgressMessage { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; + UnsignedByte percentage; +}; + +// Load complete message packet +// Fields: T + type, R + relay, P + playerID, D +// TODO: commandId field is missing. FillBufferWithLoadCompleteMessage writes it, but +// original GetLoadCompleteMessageSize did not count it +struct NetPacketLoadCompleteMessage { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +// Timeout game start message packet +// Fields: T + type, R + relay, P + playerID, D +// TODO: commandId field is missing. FillBufferWithTimeOutGameStartMessage writes it, but +// original GetTimeOutGameStartMessageSize did not count it +struct NetPacketTimeOutGameStartMessage { + NetPacketCommandTypeField commandType; + NetPacketRelayField relay; + NetPacketPlayerIdField playerId; + NetPacketDataFieldHeader dataHeader; +}; + +// Disconnect frame command packet +// Fields: T + type, P + playerID, C + commandID, R + relay, D + disconnectFrame +struct NetPacketDisconnectFrameCommand { + NetPacketCommandTypeField commandType; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketRelayField relay; + NetPacketDataFieldHeader dataHeader; + UnsignedInt disconnectFrame; +}; + +// Disconnect screen off command packet +// Fields: T + type, P + playerID, C + commandID, R + relay, D + newFrame +struct NetPacketDisconnectScreenOffCommand { + NetPacketCommandTypeField commandType; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketRelayField relay; + NetPacketDataFieldHeader dataHeader; + UnsignedInt newFrame; +}; + +// Frame resend request command packet +// Fields: T + type, P + playerID, C + commandID, R + relay, D + frameToResend +struct NetPacketFrameResendRequestCommand { + NetPacketCommandTypeField commandType; + NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; + NetPacketRelayField relay; + NetPacketDataFieldHeader dataHeader; + UnsignedInt frameToResend; +}; + +// Restore normal struct packing +#pragma pack(pop) diff --git a/Core/GameEngine/Source/Common/System/GameMemoryInitPools_Generals.inl b/Core/GameEngine/Source/Common/System/GameMemoryInitPools_Generals.inl index b049809df14..d8177c459d4 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryInitPools_Generals.inl +++ b/Core/GameEngine/Source/Common/System/GameMemoryInitPools_Generals.inl @@ -553,6 +553,8 @@ static PoolSizeRec PoolSizes[] = { "NetChatCommandMsg", 32, 32 }, { "NetDisconnectVoteCommandMsg", 32, 32 }, { "NetProgressCommandMsg", 32, 32 }, + { "NetLoadCompleteCommandMsg", 32, 32 }, + { "NetTimeOutGameStartCommandMsg", 32, 32 }, { "NetWrapperCommandMsg", 32, 32 }, { "NetFileCommandMsg", 32, 32 }, { "NetFileAnnounceCommandMsg", 32, 32 }, diff --git a/Core/GameEngine/Source/Common/System/GameMemoryInitPools_GeneralsMD.inl b/Core/GameEngine/Source/Common/System/GameMemoryInitPools_GeneralsMD.inl index 2bf2e64c151..f9f5b5a0a18 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryInitPools_GeneralsMD.inl +++ b/Core/GameEngine/Source/Common/System/GameMemoryInitPools_GeneralsMD.inl @@ -549,6 +549,8 @@ static PoolSizeRec PoolSizes[] = { "NetChatCommandMsg", 32, 32 }, { "NetDisconnectVoteCommandMsg", 32, 32 }, { "NetProgressCommandMsg", 32, 32 }, + { "NetLoadCompleteCommandMsg", 32, 32 }, + { "NetTimeOutGameStartCommandMsg", 32, 32 }, { "NetWrapperCommandMsg", 32, 32 }, { "NetFileCommandMsg", 32, 32 }, { "NetFileAnnounceCommandMsg", 32, 32 }, diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index cef851a74a4..49d4676ffb0 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -2270,12 +2270,11 @@ void ConnectionManager::updateLoadProgress( Int progress ) void ConnectionManager::loadProgressComplete() { - NetCommandMsg *msg = newInstance(NetCommandMsg); + NetLoadCompleteCommandMsg *msg = newInstance(NetLoadCompleteCommandMsg); msg->setPlayerID( m_localSlot ); if (DoesCommandRequireACommandID(msg->getNetCommandType()) == TRUE) { msg->setID(GenerateNextCommandID()); } - msg->setNetCommandType(NETCOMMANDTYPE_LOADCOMPLETE); processLoadComplete(msg); sendLocalCommand(msg, 0xff ^ (1 << m_localSlot)); @@ -2284,9 +2283,8 @@ void ConnectionManager::loadProgressComplete() void ConnectionManager::sendTimeOutGameStart() { - NetCommandMsg *msg = newInstance(NetCommandMsg); + NetTimeOutGameStartCommandMsg *msg = newInstance(NetTimeOutGameStartCommandMsg); msg->setPlayerID( m_localSlot ); - msg->setNetCommandType(NETCOMMANDTYPE_TIMEOUTSTART); if (DoesCommandRequireACommandID(msg->getNetCommandType()) == TRUE) { msg->setID(GenerateNextCommandID()); } diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index ea6d56b7285..951f3c8cf6a 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -26,6 +26,8 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #include "GameNetwork/NetCommandMsg.h" +#include "GameNetwork/NetPacketStructs.h" +#include "GameNetwork/GameMessageParser.h" #include "Common/GameState.h" #include "Common/PlayerList.h" #include "Common/Player.h" @@ -161,7 +163,7 @@ static Int indexFromMask(UnsignedInt mask) /** * Construct a new GameMessage object from the data in this object. */ -GameMessage *NetGameCommandMsg::constructGameMessage() +GameMessage *NetGameCommandMsg::constructGameMessage() const { GameMessage *retval = newInstance(GameMessage)(m_type); @@ -222,6 +224,72 @@ void NetGameCommandMsg::setGameMessageType(GameMessage::Type type) { m_type = type; } +size_t NetGameCommandMsg::getPackedByteCount() const { + UnsignedShort msglen = sizeof(NetPacketGameCommand); + + // Variable data portion + GameMessage *gmsg = constructGameMessage(); + GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); + + msglen += sizeof(GameMessage::Type); + msglen += sizeof(UnsignedByte); + + GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); + while (arg != NULL) { + msglen += sizeof(UnsignedByte); // argument type + msglen += sizeof(UnsignedByte); // argument count + GameMessageArgumentDataType type = arg->getType(); + + switch (type) { + + case ARGUMENTDATATYPE_INTEGER: + msglen += arg->getArgCount() * sizeof(Int); + break; + case ARGUMENTDATATYPE_REAL: + msglen += arg->getArgCount() * sizeof(Real); + break; + case ARGUMENTDATATYPE_BOOLEAN: + msglen += arg->getArgCount() * sizeof(Bool); + break; + case ARGUMENTDATATYPE_OBJECTID: + msglen += arg->getArgCount() * sizeof(ObjectID); + break; + case ARGUMENTDATATYPE_DRAWABLEID: + msglen += arg->getArgCount() * sizeof(DrawableID); + break; + case ARGUMENTDATATYPE_TEAMID: + msglen += arg->getArgCount() * sizeof(UnsignedInt); + break; + case ARGUMENTDATATYPE_LOCATION: + msglen += arg->getArgCount() * sizeof(Coord3D); + break; + case ARGUMENTDATATYPE_PIXEL: + msglen += arg->getArgCount() * sizeof(ICoord2D); + break; + case ARGUMENTDATATYPE_PIXELREGION: + msglen += arg->getArgCount() * sizeof(IRegion2D); + break; + case ARGUMENTDATATYPE_TIMESTAMP: + msglen += arg->getArgCount() * sizeof(UnsignedInt); + break; + case ARGUMENTDATATYPE_WIDECHAR: + msglen += arg->getArgCount() * sizeof(WideChar); + break; + + } + + arg = arg->getNext(); + } + + deleteInstance(parser); + parser = NULL; + + deleteInstance(gmsg); + gmsg = NULL; + + return msglen; +} + //------------------------- // NetAckBothCommandMsg //------------------------- @@ -279,6 +347,10 @@ Int NetAckBothCommandMsg::getSortNumber() { return m_commandID; } +size_t NetAckBothCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketAckCommand); +} + //------------------------- // NetAckStage1CommandMsg //------------------------- @@ -336,6 +408,10 @@ Int NetAckStage1CommandMsg::getSortNumber() { return m_commandID; } +size_t NetAckStage1CommandMsg::getPackedByteCount() const { + return sizeof(NetPacketAckCommand); +} + //------------------------- // NetAckStage2CommandMsg //------------------------- @@ -393,6 +469,10 @@ Int NetAckStage2CommandMsg::getSortNumber() { return m_commandID; } +size_t NetAckStage2CommandMsg::getPackedByteCount() const { + return sizeof(NetPacketAckCommand); +} + //------------------------- // NetFrameCommandMsg //------------------------- @@ -424,6 +504,10 @@ UnsignedShort NetFrameCommandMsg::getCommandCount() { return m_commandCount; } +size_t NetFrameCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketFrameCommand); +} + //------------------------- // NetPlayerLeaveCommandMsg //------------------------- @@ -455,6 +539,10 @@ void NetPlayerLeaveCommandMsg::setLeavingPlayerID(UnsignedByte id) { m_leavingPlayerID = id; } +size_t NetPlayerLeaveCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketPlayerLeaveCommand); +} + //------------------------- // NetRunAheadMetricsCommandMsg //------------------------- @@ -501,6 +589,10 @@ Int NetRunAheadMetricsCommandMsg::getAverageFps() { return m_averageFps; } +size_t NetRunAheadMetricsCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketRunAheadMetricsCommand); +} + //------------------------- // NetRunAheadCommandMsg //------------------------- @@ -529,6 +621,10 @@ void NetRunAheadCommandMsg::setFrameRate(UnsignedByte frameRate) { m_frameRate = frameRate; } +size_t NetRunAheadCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketRunAheadCommand); +} + //------------------------- // NetDestroyPlayerCommandMsg //------------------------- @@ -564,6 +660,10 @@ UnsignedInt NetDestroyPlayerCommandMsg::getPlayerIndex( void ) return m_playerIndex; } +size_t NetDestroyPlayerCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDestroyPlayerCommand); +} + //------------------------- // NetKeepAliveCommandMsg //------------------------- @@ -577,6 +677,10 @@ NetKeepAliveCommandMsg::NetKeepAliveCommandMsg() : NetCommandMsg() { NetKeepAliveCommandMsg::~NetKeepAliveCommandMsg() { } +size_t NetKeepAliveCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketKeepAliveCommand); +} + //------------------------- // NetDisconnectKeepAliveCommandMsg //------------------------- @@ -590,6 +694,10 @@ NetDisconnectKeepAliveCommandMsg::NetDisconnectKeepAliveCommandMsg() : NetComman NetDisconnectKeepAliveCommandMsg::~NetDisconnectKeepAliveCommandMsg() { } +size_t NetDisconnectKeepAliveCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDisconnectKeepAliveCommand); +} + //------------------------- // NetDisconnectPlayerCommandMsg //------------------------- @@ -635,6 +743,10 @@ UnsignedInt NetDisconnectPlayerCommandMsg::getDisconnectFrame() { return m_disconnectFrame; } +size_t NetDisconnectPlayerCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDisconnectPlayerCommand); +} + //------------------------- // NetPacketRouterQueryCommandMsg //------------------------- @@ -651,6 +763,10 @@ NetPacketRouterQueryCommandMsg::NetPacketRouterQueryCommandMsg() : NetCommandMsg NetPacketRouterQueryCommandMsg::~NetPacketRouterQueryCommandMsg() { } +size_t NetPacketRouterQueryCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketRouterQueryCommand); +} + //------------------------- // NetPacketRouterAckCommandMsg //------------------------- @@ -667,6 +783,10 @@ NetPacketRouterAckCommandMsg::NetPacketRouterAckCommandMsg() : NetCommandMsg() { NetPacketRouterAckCommandMsg::~NetPacketRouterAckCommandMsg() { } +size_t NetPacketRouterAckCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketRouterAckCommand); +} + //------------------------- // NetDisconnectChatCommandMsg //------------------------- @@ -748,6 +868,24 @@ void NetChatCommandMsg::setPlayerMask( Int playerMask ) m_playerMask = playerMask; } +size_t NetChatCommandMsg::getPackedByteCount() const +{ + return sizeof(NetPacketChatCommand) + + sizeof(UnsignedByte) // text length byte + + m_text.getByteCount() + + sizeof(m_playerMask); +} + +//------------------------- +// NetDisconnectChatCommandMsg +//------------------------- +size_t NetDisconnectChatCommandMsg::getPackedByteCount() const +{ + return sizeof(NetPacketDisconnectChatCommand) + + sizeof(UnsignedByte) // text length byte + + m_text.getByteCount(); +} + //------------------------- // NetDisconnectVoteCommandMsg //------------------------- @@ -793,6 +931,10 @@ void NetDisconnectVoteCommandMsg::setVoteFrame(UnsignedInt voteFrame) { m_voteFrame = voteFrame; } +size_t NetDisconnectVoteCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDisconnectVoteCommand); +} + //------------------------- // NetProgressCommandMsg //------------------------- @@ -814,6 +956,10 @@ void NetProgressCommandMsg::setPercentage( UnsignedByte percent ) m_percent = percent; } +size_t NetProgressCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketProgressMessage); +} + //------------------------- // NetWrapperCommandMsg //------------------------- @@ -889,6 +1035,10 @@ void NetWrapperCommandMsg::setWrappedCommandID(UnsignedShort wrappedCommandID) { m_wrappedCommandID = wrappedCommandID; } +size_t NetWrapperCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketWrapperCommand) + m_dataLength; +} + //------------------------- // NetFileCommandMsg //------------------------- @@ -929,6 +1079,14 @@ void NetFileCommandMsg::setFileData(UnsignedByte *data, UnsignedInt dataLength) memcpy(m_data, data, dataLength); } +size_t NetFileCommandMsg::getPackedByteCount() const +{ + return sizeof(NetPacketFileCommand) + + m_portableFilename.getLength() + 1 + + sizeof(m_dataLength) + + m_dataLength; +} + //------------------------- // NetFileAnnounceCommandMsg //------------------------- @@ -968,6 +1126,13 @@ void NetFileAnnounceCommandMsg::setPlayerMask(UnsignedByte playerMask) { m_playerMask = playerMask; } +size_t NetFileAnnounceCommandMsg::getPackedByteCount() const +{ + return sizeof(NetPacketFileAnnounceCommand) + + m_portableFilename.getLength() + 1 + + sizeof(m_fileID) + + sizeof(m_playerMask); +} //------------------------- // NetFileProgressCommandMsg @@ -997,6 +1162,10 @@ void NetFileProgressCommandMsg::setProgress(Int val) { m_progress = val; } +size_t NetFileProgressCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketFileProgressCommand); +} + //------------------------- // NetDisconnectFrameCommandMsg //------------------------- @@ -1016,6 +1185,10 @@ void NetDisconnectFrameCommandMsg::setDisconnectFrame(UnsignedInt disconnectFram m_disconnectFrame = disconnectFrame; } +size_t NetDisconnectFrameCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDisconnectFrameCommand); +} + //------------------------- // NetDisconnectScreenOffCommandMsg //------------------------- @@ -1035,6 +1208,10 @@ void NetDisconnectScreenOffCommandMsg::setNewFrame(UnsignedInt newFrame) { m_newFrame = newFrame; } +size_t NetDisconnectScreenOffCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketDisconnectScreenOffCommand); +} + //------------------------- // NetFrameResendRequestCommandMsg //------------------------- @@ -1053,3 +1230,35 @@ UnsignedInt NetFrameResendRequestCommandMsg::getFrameToResend() { void NetFrameResendRequestCommandMsg::setFrameToResend(UnsignedInt frame) { m_frameToResend = frame; } + +size_t NetFrameResendRequestCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketFrameResendRequestCommand); +} + +//------------------------- +// NetLoadCompleteCommandMsg +//------------------------- +NetLoadCompleteCommandMsg::NetLoadCompleteCommandMsg() : NetCommandMsg() { + m_commandType = NETCOMMANDTYPE_LOADCOMPLETE; +} + +NetLoadCompleteCommandMsg::~NetLoadCompleteCommandMsg() { +} + +size_t NetLoadCompleteCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketLoadCompleteMessage); +} + +//------------------------- +// NetTimeOutGameStartCommandMsg +//------------------------- +NetTimeOutGameStartCommandMsg::NetTimeOutGameStartCommandMsg() : NetCommandMsg() { + m_commandType = NETCOMMANDTYPE_TIMEOUTSTART; +} + +NetTimeOutGameStartCommandMsg::~NetTimeOutGameStartCommandMsg() { +} + +size_t NetTimeOutGameStartCommandMsg::getPackedByteCount() const { + return sizeof(NetPacketTimeOutGameStartMessage); +} diff --git a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp index be74404bae5..92ec1928595 100644 --- a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -31,18 +31,8 @@ #include "GameNetwork/NetworkDefs.h" #include "GameNetwork/networkutil.h" #include "GameNetwork/GameMessageParser.h" +#include "GameNetwork/NetPacketStructs.h" -// TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability -typedef UnsignedByte NetPacketFieldType; - -namespace NetPacketFieldTypes { - constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field - constexpr const NetPacketFieldType Relay = 'R'; // Relay field - constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field - constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field - constexpr const NetPacketFieldType Frame = 'F'; // Frame field - constexpr const NetPacketFieldType Data = 'D'; // Data payload field -} // This function assumes that all of the fields are either of default value or are // present in the raw data. @@ -287,520 +277,11 @@ UnsignedInt NetPacket::GetBufferSizeNeededForCommand(NetCommandMsg *msg) { if (msg == NULL) { return TRUE; // There was nothing to add, so it was successful. } - - switch(msg->getNetCommandType()) - { - case NETCOMMANDTYPE_GAMECOMMAND: - return GetGameCommandSize(msg); - case NETCOMMANDTYPE_ACKSTAGE1: - case NETCOMMANDTYPE_ACKSTAGE2: - case NETCOMMANDTYPE_ACKBOTH: - return GetAckCommandSize(msg); - case NETCOMMANDTYPE_FRAMEINFO: - return GetFrameCommandSize(msg); - case NETCOMMANDTYPE_PLAYERLEAVE: - return GetPlayerLeaveCommandSize(msg); - case NETCOMMANDTYPE_RUNAHEADMETRICS: - return GetRunAheadMetricsCommandSize(msg); - case NETCOMMANDTYPE_RUNAHEAD: - return GetRunAheadCommandSize(msg); - case NETCOMMANDTYPE_DESTROYPLAYER: - return GetDestroyPlayerCommandSize(msg); - case NETCOMMANDTYPE_KEEPALIVE: - return GetKeepAliveCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTKEEPALIVE: - return GetDisconnectKeepAliveCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTPLAYER: - return GetDisconnectPlayerCommandSize(msg); - case NETCOMMANDTYPE_PACKETROUTERQUERY: - return GetPacketRouterQueryCommandSize(msg); - case NETCOMMANDTYPE_PACKETROUTERACK: - return GetPacketRouterAckCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTCHAT: - return GetDisconnectChatCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTVOTE: - return GetDisconnectVoteCommandSize(msg); - case NETCOMMANDTYPE_CHAT: - return GetChatCommandSize(msg); - case NETCOMMANDTYPE_PROGRESS: - return GetProgressMessageSize(msg); - case NETCOMMANDTYPE_LOADCOMPLETE: - return GetLoadCompleteMessageSize(msg); - case NETCOMMANDTYPE_TIMEOUTSTART: - return GetTimeOutGameStartMessageSize(msg); - case NETCOMMANDTYPE_WRAPPER: - return GetWrapperCommandSize(msg); - case NETCOMMANDTYPE_FILE: - return GetFileCommandSize(msg); - case NETCOMMANDTYPE_FILEANNOUNCE: - return GetFileAnnounceCommandSize(msg); - case NETCOMMANDTYPE_FILEPROGRESS: - return GetFileProgressCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTFRAME: - return GetDisconnectFrameCommandSize(msg); - case NETCOMMANDTYPE_DISCONNECTSCREENOFF: - return GetDisconnectScreenOffCommandSize(msg); - case NETCOMMANDTYPE_FRAMERESENDREQUEST: - return GetFrameResendRequestCommandSize(msg); - default: - DEBUG_CRASH(("Unknown NETCOMMANDTYPE %d", msg->getNetCommandType())); - break; - } - - return 0; -} - -UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { - NetGameCommandMsg *cmdMsg = (NetGameCommandMsg *)msg; - - UnsignedShort msglen = 0; - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); // frame number - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // relay - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // command type - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); // command ID - msglen += sizeof(UnsignedByte); // the NetPacketFieldTypes::Data for the data section. - - GameMessage *gmsg = cmdMsg->constructGameMessage(); - GameMessageParser *parser = newInstance(GameMessageParser)(gmsg); - - msglen += sizeof(GameMessage::Type); - msglen += sizeof(UnsignedByte); -// Int numTypes = parser->getNumTypes(); - GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); - while (arg != NULL) { - msglen += 2 * sizeof(UnsignedByte); // for the type and number of args of that type declaration. - GameMessageArgumentDataType type = arg->getType(); - - switch (type) { - - case ARGUMENTDATATYPE_INTEGER: - msglen += arg->getArgCount() * sizeof(Int); - break; - case ARGUMENTDATATYPE_REAL: - msglen += arg->getArgCount() * sizeof(Real); - break; - case ARGUMENTDATATYPE_BOOLEAN: - msglen += arg->getArgCount() * sizeof(Bool); - break; - case ARGUMENTDATATYPE_OBJECTID: - msglen += arg->getArgCount() * sizeof(ObjectID); - break; - case ARGUMENTDATATYPE_DRAWABLEID: - msglen += arg->getArgCount() * sizeof(DrawableID); - break; - case ARGUMENTDATATYPE_TEAMID: - msglen += arg->getArgCount() * sizeof(UnsignedInt); - break; - case ARGUMENTDATATYPE_LOCATION: - msglen += arg->getArgCount() * sizeof(Coord3D); - break; - case ARGUMENTDATATYPE_PIXEL: - msglen += arg->getArgCount() * sizeof(ICoord2D); - break; - case ARGUMENTDATATYPE_PIXELREGION: - msglen += arg->getArgCount() * sizeof(IRegion2D); - break; - case ARGUMENTDATATYPE_TIMESTAMP: - msglen += arg->getArgCount() * sizeof(UnsignedInt); - break; - case ARGUMENTDATATYPE_WIDECHAR: - msglen += arg->getArgCount() * sizeof(WideChar); - break; - - } - - arg = arg->getNext(); - } - - deleteInstance(parser); - parser = NULL; - - deleteInstance(gmsg); - gmsg = NULL; - - return msglen; + // Use the virtual function for all command message types + return msg->getPackedByteCount(); } -UnsignedInt NetPacket::GetAckCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - ++msglen; - msglen += sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedShort); - msglen += sizeof(UnsignedByte); - - return msglen; -} - -UnsignedInt NetPacket::GetFrameCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; - msglen += sizeof(UnsignedShort); - - return msglen; -} - -UnsignedInt NetPacket::GetPlayerLeaveCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; - msglen += sizeof(UnsignedByte); - - return msglen; -} - -UnsignedInt NetPacket::GetRunAheadMetricsCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(Real); - - return msglen; -} - -UnsignedInt NetPacket::GetRunAheadCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; - msglen += sizeof(UnsignedShort); - msglen += sizeof(UnsignedByte); - - return msglen; -} - -UnsignedInt NetPacket::GetDestroyPlayerCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; - msglen += sizeof(UnsignedInt); - - return msglen; -} - -UnsignedInt NetPacket::GetKeepAliveCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // For the NetPacketFieldTypes::Data - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectKeepAliveCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // For the NetPacketFieldTypes::Data - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectPlayerCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - msglen += sizeof(UnsignedByte); // slot number - msglen += sizeof(UnsignedInt); // disconnect frame - - return msglen; -} - -UnsignedInt NetPacket::GetPacketRouterQueryCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - - return msglen; -} - -UnsignedInt NetPacket::GetPacketRouterAckCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectChatCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - NetDisconnectChatCommandMsg *cmdMsg = (NetDisconnectChatCommandMsg *)(msg); - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - msglen += sizeof(UnsignedByte); // string msglength - UnsignedByte textmsglen = cmdMsg->getText().getLength(); - msglen += textmsglen * sizeof(UnsignedShort); - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectVoteCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - msglen += sizeof(UnsignedByte); // slot number - msglen += sizeof(UnsignedInt); // vote frame. - - return msglen; -} - -UnsignedInt NetPacket::GetChatCommandSize(NetCommandMsg *msg) { - Int msglen = 0; - NetChatCommandMsg *cmdMsg = (NetChatCommandMsg *)(msg); - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedInt) + sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedShort) + sizeof(UnsignedByte); - - ++msglen; // the NetPacketFieldTypes::Data - msglen += sizeof(UnsignedByte); // string msglength - UnsignedByte textmsglen = cmdMsg->getText().getLength(); - msglen += textmsglen * sizeof(UnsignedShort); - msglen += sizeof(Int); // playerMask - - return msglen; -} - -UnsignedInt NetPacket::GetProgressMessageSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // For the NetPacketFieldTypes::Data - ++msglen; // percentage - - return msglen; -} - -UnsignedInt NetPacket::GetLoadCompleteMessageSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // For the NetPacketFieldTypes::Data - - return msglen; -} - -UnsignedInt NetPacket::GetTimeOutGameStartMessageSize(NetCommandMsg *msg) { - Int msglen = 0; - - ++msglen; - msglen += sizeof(UnsignedByte); - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); - ++msglen; - msglen += sizeof(UnsignedByte); - - ++msglen; // For the NetPacketFieldTypes::Data - - return msglen; -} - -// type, player, ID, relay, Data -UnsignedInt NetPacket::GetWrapperCommandSize(NetCommandMsg *msg) { - UnsignedInt msglen = 0; - - ++msglen; // NetPacketFieldTypes::CommandType - msglen += sizeof(UnsignedByte); // command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - ++msglen; // NetPacketFieldTypes::Data - - msglen += sizeof(UnsignedShort); // m_wrappedCommandID - msglen += sizeof(UnsignedInt); // m_chunkNumber - msglen += sizeof(UnsignedInt); // m_numChunks - msglen += sizeof(UnsignedInt); // m_totalDataLength - msglen += sizeof(UnsignedInt); // m_dataLength - msglen += sizeof(UnsignedInt); // m_dataOffset - - return msglen; -} - -UnsignedInt NetPacket::GetFileCommandSize(NetCommandMsg *msg) { - NetFileCommandMsg *filemsg = (NetFileCommandMsg *)msg; - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - - msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 - msglen += sizeof(UnsignedInt); // file data length - msglen += filemsg->getFileLength(); // the file data - - return msglen; -} - -UnsignedInt NetPacket::GetFileAnnounceCommandSize(NetCommandMsg *msg) { - NetFileAnnounceCommandMsg *filemsg = (NetFileAnnounceCommandMsg *)msg; - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - - msglen += filemsg->getPortableFilename().getLength() + 1; // PORTABLE filename and the terminating 0 - msglen += sizeof(UnsignedShort); // m_fileID - msglen += sizeof(UnsignedByte); // m_playerMask - - return msglen; -} - -UnsignedInt NetPacket::GetFileProgressCommandSize(NetCommandMsg *msg) { - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - - msglen += sizeof(UnsignedShort); // m_fileID - msglen += sizeof(Int); // m_progress - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectFrameCommandSize(NetCommandMsg *msg) { - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - msglen += sizeof(UnsignedInt); // disconnect frame - - return msglen; -} - -UnsignedInt NetPacket::GetDisconnectScreenOffCommandSize(NetCommandMsg *msg) { - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - msglen += sizeof(UnsignedInt); // new frame - - return msglen; -} - -UnsignedInt NetPacket::GetFrameResendRequestCommandSize(NetCommandMsg *msg) { - UnsignedInt msglen = 0; - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::CommandType and command type - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::PlayerId and player ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedShort); // NetPacketFieldTypes::CommandId and command ID - msglen += sizeof(UnsignedByte) + sizeof(UnsignedByte); // NetPacketFieldTypes::Relay and relay - - ++msglen; // NetPacketFieldTypes::Data - msglen += sizeof(UnsignedInt); // frame to resend - - return msglen; -} // this function assumes that buffer is already the correct size. void NetPacket::FillBufferWithCommand(UnsignedByte *buffer, NetCommandRef *ref) { @@ -889,7 +370,7 @@ void NetPacket::FillBufferWithCommand(UnsignedByte *buffer, NetCommandRef *ref) } void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetGameCommandMsg *cmdMsg = (NetGameCommandMsg *)(msg->getCommand()); + NetGameCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // get the game message from the NetCommandMsg GameMessage *gmsg = cmdMsg->constructGameMessage(); @@ -1078,7 +559,7 @@ void NetPacket::FillBufferWithAckCommand(UnsignedByte *buffer, NetCommandRef *ms } void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetFrameCommandMsg *cmdMsg = (NetFrameCommandMsg *)(msg->getCommand()); + NetFrameCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameCommand - adding frame command for frame %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getCommandCount(), cmdMsg->getID())); @@ -1131,7 +612,7 @@ void NetPacket::FillBufferWithFrameCommand(UnsignedByte *buffer, NetCommandRef * } void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetPlayerLeaveCommandMsg *cmdMsg = (NetPlayerLeaveCommandMsg *)(msg->getCommand()); + NetPlayerLeaveCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPlayerLeaveCommand - adding player leave command for player %d", cmdMsg->getLeavingPlayerID())); @@ -1181,7 +662,7 @@ void NetPacket::FillBufferWithPlayerLeaveCommand(UnsignedByte *buffer, NetComman } void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetRunAheadMetricsCommandMsg *cmdMsg = (NetRunAheadMetricsCommandMsg *)(msg->getCommand()); + NetRunAheadMetricsCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadMetricsCommand - adding run ahead metrics for player %d, fps = %d, latency = %f", cmdMsg->getPlayerID(), cmdMsg->getAverageFps(), cmdMsg->getAverageLatency())); @@ -1229,7 +710,7 @@ void NetPacket::FillBufferWithRunAheadMetricsCommand(UnsignedByte *buffer, NetCo } void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetRunAheadCommandMsg *cmdMsg = (NetRunAheadCommandMsg *)(msg->getCommand()); + NetRunAheadCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::FillBufferWithRunAheadCommand - adding run ahead command")); @@ -1285,7 +766,7 @@ void NetPacket::FillBufferWithRunAheadCommand(UnsignedByte *buffer, NetCommandRe } void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetDestroyPlayerCommandMsg *cmdMsg = (NetDestroyPlayerCommandMsg *)(msg->getCommand()); + NetDestroyPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadCommand - adding run ahead command")); @@ -1335,7 +816,7 @@ void NetPacket::FillBufferWithDestroyPlayerCommand(UnsignedByte *buffer, NetComm } void NetPacket::FillBufferWithKeepAliveCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetKeepAliveCommandMsg *cmdMsg = (NetKeepAliveCommandMsg *)(msg->getCommand()); + NetKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. @@ -1361,7 +842,7 @@ void NetPacket::FillBufferWithKeepAliveCommand(UnsignedByte *buffer, NetCommandR } void NetPacket::FillBufferWithDisconnectKeepAliveCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetDisconnectKeepAliveCommandMsg *cmdMsg = (NetDisconnectKeepAliveCommandMsg *)(msg->getCommand()); + NetDisconnectKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // Put the NetCommandType into the packet. @@ -1388,7 +869,7 @@ void NetPacket::FillBufferWithDisconnectKeepAliveCommand(UnsignedByte *buffer, N } void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetDisconnectPlayerCommandMsg *cmdMsg = (NetDisconnectPlayerCommandMsg *)(msg->getCommand()); + NetDisconnectPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - adding run ahead command")); @@ -1435,7 +916,7 @@ void NetPacket::FillBufferWithDisconnectPlayerCommand(UnsignedByte *buffer, NetC } void NetPacket::FillBufferWithPacketRouterQueryCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetPacketRouterQueryCommandMsg *cmdMsg = (NetPacketRouterQueryCommandMsg *)(msg->getCommand()); + NetPacketRouterQueryCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterQueryCommand - adding packet router query command")); @@ -1581,7 +1062,7 @@ void NetPacket::FillBufferWithDisconnectVoteCommand(UnsignedByte *buffer, NetCom } void NetPacket::FillBufferWithChatCommand(UnsignedByte *buffer, NetCommandRef *msg) { - NetChatCommandMsg *cmdMsg = (NetChatCommandMsg *)(msg->getCommand()); + NetChatCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); @@ -1669,7 +1150,7 @@ void NetPacket::FillBufferWithProgressMessage(UnsignedByte *buffer, NetCommandRe } void NetPacket::FillBufferWithLoadCompleteMessage(UnsignedByte *buffer, NetCommandRef *msg) { - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. @@ -1702,7 +1183,7 @@ void NetPacket::FillBufferWithLoadCompleteMessage(UnsignedByte *buffer, NetComma } void NetPacket::FillBufferWithTimeOutGameStartMessage(UnsignedByte *buffer, NetCommandRef *msg) { - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedShort offset = 0; // If necessary, put the NetCommandType into the packet. @@ -1734,7 +1215,7 @@ void NetPacket::FillBufferWithTimeOutGameStartMessage(UnsignedByte *buffer, NetC } void NetPacket::FillBufferWithFileMessage(UnsignedByte *buffer, NetCommandRef *msg) { - NetFileCommandMsg *cmdMsg = (NetFileCommandMsg *)(msg->getCommand()); + NetFileCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedInt offset = 0; // command type @@ -1783,7 +1264,7 @@ void NetPacket::FillBufferWithFileMessage(UnsignedByte *buffer, NetCommandRef *m } void NetPacket::FillBufferWithFileAnnounceMessage(UnsignedByte *buffer, NetCommandRef *msg) { - NetFileAnnounceCommandMsg *cmdMsg = (NetFileAnnounceCommandMsg *)(msg->getCommand()); + NetFileAnnounceCommandMsg *cmdMsg = static_cast(msg->getCommand()); UnsignedInt offset = 0; // command type @@ -2466,7 +1947,7 @@ Bool NetPacket::isRoomForDisconnectFrameMessage(NetCommandRef *msg) { Bool NetPacket::addFileCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForFileMessage(msg)) { - NetFileCommandMsg *cmdMsg = (NetFileCommandMsg *)(msg->getCommand()); + NetFileCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -2538,7 +2019,7 @@ Bool NetPacket::addFileCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForFileMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetFileCommandMsg *cmdMsg = (NetFileCommandMsg *)(msg->getCommand()); + NetFileCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { len += sizeof(UnsignedByte) + sizeof(UnsignedByte); } @@ -2553,7 +2034,7 @@ Bool NetPacket::isRoomForFileMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedInt); // filedata length len += cmdMsg->getFileLength(); @@ -2568,7 +2049,7 @@ Bool NetPacket::isRoomForFileMessage(NetCommandRef *msg) { Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForFileAnnounceMessage(msg)) { - NetFileAnnounceCommandMsg *cmdMsg = (NetFileAnnounceCommandMsg *)(msg->getCommand()); + NetFileAnnounceCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -2645,7 +2126,7 @@ Bool NetPacket::addFileAnnounceCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForFileAnnounceMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetFileAnnounceCommandMsg *cmdMsg = (NetFileAnnounceCommandMsg *)(msg->getCommand()); + NetFileAnnounceCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { len += sizeof(UnsignedByte) + sizeof(UnsignedByte); } @@ -2660,7 +2141,7 @@ Bool NetPacket::isRoomForFileAnnounceMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += cmdMsg->getPortableFilename().getLength() + 1; // PORTABLE filename + the terminating 0 len += sizeof(UnsignedShort); // m_fileID len += sizeof(UnsignedByte); // m_playerMask @@ -2760,7 +2241,7 @@ Bool NetPacket::isRoomForFileProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // m_fileID len += sizeof(Int); // m_progress @@ -2890,7 +2371,7 @@ Bool NetPacket::isRoomForWrapperMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } - ++len; // NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); // wrapped command ID len += sizeof(UnsignedInt); // chunk number len += sizeof(UnsignedInt); // number of chunks @@ -2912,7 +2393,7 @@ Bool NetPacket::isRoomForWrapperMessage(NetCommandRef *msg) { Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForLoadCompleteMessage(msg)) { - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -2976,7 +2457,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { */ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { Int len = 0; - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -2989,7 +2470,7 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3004,7 +2485,7 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForLoadCompleteMessage(msg)) { - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -3068,7 +2549,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { */ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { Int len = 0; - NetCommandMsg *cmdMsg = (NetCommandMsg *)(msg->getCommand()); + NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3081,7 +2562,7 @@ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3165,7 +2646,7 @@ Bool NetPacket::isRoomForProgressMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data ++len; // percentage if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; @@ -3276,7 +2757,7 @@ Bool NetPacket::isRoomForDisconnectVoteMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // vote frame @@ -3365,7 +2846,7 @@ Bool NetPacket::isRoomForDisconnectChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3378,7 +2859,7 @@ Bool NetPacket::isRoomForDisconnectChatMessage(NetCommandRef *msg) { Bool NetPacket::addChatCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForChatMessage(msg)) { - NetChatCommandMsg *cmdMsg = (NetChatCommandMsg *)(msg->getCommand()); + NetChatCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectChatCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. @@ -3468,7 +2949,7 @@ Bool NetPacket::addChatCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForChatMessage(NetCommandRef *msg) { Bool needNewCommandID = FALSE; Int len = 0; - NetChatCommandMsg *cmdMsg = (NetChatCommandMsg *)(msg->getCommand()); + NetChatCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3488,7 +2969,7 @@ Bool NetPacket::isRoomForChatMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // string length UnsignedByte textLen = cmdMsg->getText().getLength(); len += textLen * sizeof(UnsignedShort); @@ -3572,7 +3053,7 @@ Bool NetPacket::isRoomForPacketRouterAckMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3582,7 +3063,7 @@ Bool NetPacket::isRoomForPacketRouterAckMessage(NetCommandRef *msg) { Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { // need type, player id, relay, command id, slot number if (isRoomForPacketRouterQueryMessage(msg)) { - NetPacketRouterQueryCommandMsg *cmdMsg = (NetPacketRouterQueryCommandMsg *)(msg->getCommand()); + NetPacketRouterQueryCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPacketRouterQueryCommand - adding packet router query command")); // If necessary, put the NetCommandType into the packet. @@ -3639,7 +3120,7 @@ Bool NetPacket::addPacketRouterQueryCommand(NetCommandRef *msg) { */ Bool NetPacket::isRoomForPacketRouterQueryMessage(NetCommandRef *msg) { Int len = 0; - NetPacketRouterQueryCommandMsg *cmdMsg = (NetPacketRouterQueryCommandMsg *)(msg->getCommand()); + NetPacketRouterQueryCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3652,7 +3133,7 @@ Bool NetPacket::isRoomForPacketRouterQueryMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3665,7 +3146,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - entering...")); // need type, player id, relay, command id, slot number if (isRoomForDisconnectPlayerMessage(msg)) { - NetDisconnectPlayerCommandMsg *cmdMsg = (NetDisconnectPlayerCommandMsg *)(msg->getCommand()); + NetDisconnectPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addDisconnectPlayerCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. @@ -3743,7 +3224,7 @@ Bool NetPacket::addDisconnectPlayerCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForDisconnectPlayerMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetDisconnectPlayerCommandMsg *cmdMsg = (NetDisconnectPlayerCommandMsg *)(msg->getCommand()); + NetDisconnectPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3760,7 +3241,7 @@ Bool NetPacket::isRoomForDisconnectPlayerMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedByte); // slot number len += sizeof(UnsignedInt); // disconnectFrame if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -3775,7 +3256,7 @@ Bool NetPacket::isRoomForDisconnectPlayerMessage(NetCommandRef *msg) { */ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { if (isRoomForDisconnectKeepAliveMessage(msg)) { - NetDisconnectKeepAliveCommandMsg *cmdMsg = (NetDisconnectKeepAliveCommandMsg *)(msg->getCommand()); + NetDisconnectKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -3828,7 +3309,7 @@ Bool NetPacket::addDisconnectKeepAliveCommand(NetCommandRef *msg) { */ Bool NetPacket::isRoomForDisconnectKeepAliveMessage(NetCommandRef *msg) { Int len = 0; - NetDisconnectKeepAliveCommandMsg *cmdMsg = (NetDisconnectKeepAliveCommandMsg *)(msg->getCommand()); + NetDisconnectKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3841,7 +3322,7 @@ Bool NetPacket::isRoomForDisconnectKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3853,7 +3334,7 @@ Bool NetPacket::isRoomForDisconnectKeepAliveMessage(NetCommandRef *msg) { */ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { if (isRoomForKeepAliveMessage(msg)) { - NetKeepAliveCommandMsg *cmdMsg = (NetKeepAliveCommandMsg *)(msg->getCommand()); + NetKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -3906,7 +3387,7 @@ Bool NetPacket::addKeepAliveCommand(NetCommandRef *msg) { */ Bool NetPacket::isRoomForKeepAliveMessage(NetCommandRef *msg) { Int len = 0; - NetKeepAliveCommandMsg *cmdMsg = (NetKeepAliveCommandMsg *)(msg->getCommand()); + NetKeepAliveCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -3919,7 +3400,7 @@ Bool NetPacket::isRoomForKeepAliveMessage(NetCommandRef *msg) { len += sizeof(UnsignedByte); } - ++len; // For the NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data if ((len + m_packetLen) > MAX_PACKET_SIZE) { return FALSE; } @@ -3932,7 +3413,7 @@ Bool NetPacket::isRoomForKeepAliveMessage(NetCommandRef *msg) { Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForRunAheadMessage(msg)) { - NetRunAheadCommandMsg *cmdMsg = (NetRunAheadCommandMsg *)(msg->getCommand()); + NetRunAheadCommandMsg *cmdMsg = static_cast(msg->getCommand()); //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadCommand - adding run ahead command")); // If necessary, put the NetCommandType into the packet. @@ -4021,7 +3502,7 @@ Bool NetPacket::addRunAheadCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForRunAheadMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetRunAheadCommandMsg *cmdMsg = (NetRunAheadCommandMsg *)(msg->getCommand()); + NetRunAheadCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -4056,7 +3537,7 @@ Bool NetPacket::isRoomForRunAheadMessage(NetCommandRef *msg) { Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForDestroyPlayerMessage(msg)) { - NetDestroyPlayerCommandMsg *cmdMsg = (NetDestroyPlayerCommandMsg *)(msg->getCommand()); + NetDestroyPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. if (m_lastCommandType != cmdMsg->getNetCommandType()) { @@ -4140,7 +3621,7 @@ Bool NetPacket::addDestroyPlayerCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForDestroyPlayerMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetDestroyPlayerCommandMsg *cmdMsg = (NetDestroyPlayerCommandMsg *)(msg->getCommand()); + NetDestroyPlayerCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -4174,7 +3655,7 @@ Bool NetPacket::isRoomForDestroyPlayerMessage(NetCommandRef *msg) { Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForRunAheadMetricsMessage(msg)) { - NetRunAheadMetricsCommandMsg *cmdMsg = (NetRunAheadMetricsCommandMsg *)(msg->getCommand()); + NetRunAheadMetricsCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addRunAheadMetricsCommand - adding run ahead metrics for player %d, fps = %d, latency = %f", cmdMsg->getPlayerID(), cmdMsg->getAverageFps(), cmdMsg->getAverageLatency())); // If necessary, put the NetCommandType into the packet. @@ -4251,7 +3732,7 @@ Bool NetPacket::addRunAheadMetricsCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForRunAheadMetricsMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetRunAheadMetricsCommandMsg *cmdMsg = (NetRunAheadMetricsCommandMsg *)(msg->getCommand()); + NetRunAheadMetricsCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -4268,7 +3749,7 @@ Bool NetPacket::isRoomForRunAheadMetricsMessage(NetCommandRef *msg) { len += sizeof(UnsignedShort) + sizeof(UnsignedByte); } - ++len; // NetPacketFieldTypes::Data + ++len; // for NetPacketFieldTypes::Data len += sizeof(UnsignedShort); len += sizeof(Real); if ((len + m_packetLen) > MAX_PACKET_SIZE) { @@ -4284,7 +3765,7 @@ Bool NetPacket::isRoomForRunAheadMetricsMessage(NetCommandRef *msg) { Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { Bool needNewCommandID = FALSE; if (isRoomForPlayerLeaveMessage(msg)) { - NetPlayerLeaveCommandMsg *cmdMsg = (NetPlayerLeaveCommandMsg *)(msg->getCommand()); + NetPlayerLeaveCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addPlayerLeaveCommand - adding player leave command for player %d", cmdMsg->getLeavingPlayerID())); // If necessary, put the NetCommandType into the packet. @@ -4367,7 +3848,7 @@ Bool NetPacket::addPlayerLeaveCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForPlayerLeaveMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetPlayerLeaveCommandMsg *cmdMsg = (NetPlayerLeaveCommandMsg *)(msg->getCommand()); + NetPlayerLeaveCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -4417,7 +3898,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { return TRUE; } if (isRoomForFrameMessage(msg)) { - NetFrameCommandMsg *cmdMsg = (NetFrameCommandMsg *)(msg->getCommand()); + NetFrameCommandMsg *cmdMsg = static_cast(msg->getCommand()); // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addFrameCommand - adding frame command for frame %d, command count = %d, command id = %d", cmdMsg->getExecutionFrame(), cmdMsg->getCommandCount(), cmdMsg->getID())); // If necessary, put the NetCommandType into the packet. @@ -4503,7 +3984,7 @@ Bool NetPacket::addFrameCommand(NetCommandRef *msg) { Bool NetPacket::isRoomForFrameMessage(NetCommandRef *msg) { Int len = 0; Bool needNewCommandID = FALSE; - NetFrameCommandMsg *cmdMsg = (NetFrameCommandMsg *)(msg->getCommand()); + NetFrameCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; len += sizeof(UnsignedByte); @@ -4937,7 +4418,8 @@ Bool NetPacket::isRoomForGameMessage(NetCommandRef *msg, GameMessage *gmsg) { // Int numTypes = parser->getNumTypes(); GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); while (arg != NULL) { - msglen += 2 * sizeof(UnsignedByte); // for the type and number of args of that type declaration. + msglen += sizeof(UnsignedByte); // argument type + msglen += sizeof(UnsignedByte); // argument count GameMessageArgumentDataType type = arg->getType(); switch (type) { @@ -5746,12 +5228,12 @@ NetCommandMsg * NetPacket::readProgressMessage(UnsignedByte *data, Int &i) { } NetCommandMsg * NetPacket::readLoadCompleteMessage(UnsignedByte *data, Int &i) { - NetCommandMsg *msg = newInstance(NetCommandMsg); + NetLoadCompleteCommandMsg *msg = newInstance(NetLoadCompleteCommandMsg); return msg; } NetCommandMsg * NetPacket::readTimeOutGameStartMessage(UnsignedByte *data, Int &i) { - NetCommandMsg *msg = newInstance(NetCommandMsg); + NetTimeOutGameStartCommandMsg *msg = newInstance(NetTimeOutGameStartCommandMsg); return msg; } From ae2280930346e96576aca58cd2b75b75b0ca2bb4 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Fri, 2 Jan 2026 10:45:48 +0100 Subject: [PATCH 015/211] refactor(logic): Simplify code in GameLogic's init, reset, startNewGame (#2027) --- .../GameEngine/Include/GameLogic/GameLogic.h | 1 - .../Source/GameLogic/System/GameLogic.cpp | 141 ++++++----------- .../GameEngine/Include/GameLogic/GameLogic.h | 1 - .../Source/GameLogic/System/GameLogic.cpp | 144 ++++++------------ 4 files changed, 99 insertions(+), 188 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index 0993841d0a7..5a138b5c195 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -329,7 +329,6 @@ class GameLogic : public SubsystemInterface, public Snapshot ObjectID m_nextObjID; ///< For allocating object id's - void setDefaults( Bool saveGame ); ///< Set default values of class object void processDestroyList( void ); ///< Destroy all pending objects on the destroy list void destroyAllObjectsImmediate(); ///< destroy, and process destroy list immediately diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index dbfb2260785..1b2fa9b864a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -249,36 +249,6 @@ GameLogic::GameLogic( void ) #endif } -// ------------------------------------------------------------------------------------------------ -/** Utility function to set class variables to default values. */ -// ------------------------------------------------------------------------------------------------ -void GameLogic::setDefaults( Bool saveGame ) -{ - m_frame = 0; - m_hasUpdated = FALSE; - m_width = DEFAULT_WORLD_WIDTH; - m_height = DEFAULT_WORLD_HEIGHT; - m_objList = NULL; -#ifdef ALLOW_NONSLEEPY_UPDATES - m_normalUpdates.clear(); -#endif - for (std::vector::iterator it = m_sleepyUpdates.begin(); it != m_sleepyUpdates.end(); ++it) - { - (*it)->friend_setIndexInLogic(-1); - } - m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; - - // - // only reset the next object ID allocater counter when we're not loading a save game. - // for save games, we read this value out of the save game file and it is important - // that we preserve it as we load and execute the game - // - if( saveGame == FALSE ) - m_nextObjID = (ObjectID)1; - -} - //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Bool GameLogic::isInSinglePlayerGame( void ) @@ -370,9 +340,6 @@ void GameLogic::init( void ) setFPMode(); - /// @todo Clear object and destroy lists - setDefaults( FALSE ); - // create the partition manager ThePartitionManager = NEW PartitionManager; ThePartitionManager->init(); @@ -400,32 +367,8 @@ void GameLogic::init( void ) //DEBUG_ASSERTCRASH(ThePlayerList, ("null ThePlayerList")); //ThePlayerList->setLocalPlayer(0); - m_CRC = 0; - m_pauseFrame = 0; - m_gamePaused = FALSE; - m_pauseSound = FALSE; - m_pauseMusic = FALSE; - m_pauseInput = FALSE; - m_inputEnabledMemory = TRUE; - m_mouseVisibleMemory = TRUE; - m_logicTimeScaleEnabledMemory = FALSE; - - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressComplete[i] = FALSE; - m_progressCompleteTimeout[i] = 0; - } - m_forceGameStartByTimeOut = FALSE; - - m_isScoringEnabled = TRUE; - m_showBehindBuildingMarkers = TRUE; - m_drawIconUI = TRUE; - m_showDynamicLOD = TRUE; - m_scriptHulkMaxLifetimeOverride = -1; - + reset(); m_isInUpdate = FALSE; - - m_rankPointsToAddAtGameStart = 0; } //------------------------------------------------------------------------------------------------- @@ -482,7 +425,20 @@ void GameLogic::reset( void ) // clear any table of contents we have m_objectTOC.clear(); - setDefaults( FALSE ); + m_frame = 0; + m_hasUpdated = FALSE; + m_width = DEFAULT_WORLD_WIDTH; + m_height = DEFAULT_WORLD_HEIGHT; + m_objList = NULL; +#ifdef ALLOW_NONSLEEPY_UPDATES + m_normalUpdates.clear(); +#endif + for (std::vector::iterator it = m_sleepyUpdates.begin(); it != m_sleepyUpdates.end(); ++it) + { + (*it)->friend_setIndexInLogic(-1); + } + m_sleepyUpdates.clear(); + m_curUpdateModule = NULL; m_isScoringEnabled = TRUE; m_showBehindBuildingMarkers = TRUE; @@ -1076,17 +1032,19 @@ void GameLogic::startNewGame( Bool saveGame ) } m_rankLevelLimit = 1000; // this is reset every game. - setDefaults( saveGame ); + + // + // only reset the next object ID allocater counter when we're not loading a save game. + // for save games, we read this value out of the save game file and it is important + // that we preserve it as we load and execute the game + // + if( saveGame == FALSE ) + m_nextObjID = (ObjectID)1; + TheWritableGlobalData->m_loadScreenRender = TRUE; ///< mark it so only a few select things are rendered during load TheWritableGlobalData->m_TiVOFastMode = FALSE; //always disable the TIVO fast-forward mode at the start of a new game. - m_showBehindBuildingMarkers = TRUE; - m_drawIconUI = TRUE; - m_showDynamicLOD = TRUE; - m_scriptHulkMaxLifetimeOverride = -1; - // Fill in the game color and Factions before we do the Load Screen - GameInfo *game = NULL; TheGameInfo = NULL; Int localSlot = 0; if (TheNetwork) @@ -1094,41 +1052,40 @@ void GameLogic::startNewGame( Bool saveGame ) if (TheLAN) { DEBUG_LOG(("Starting network game")); - TheGameInfo = game = TheLAN->GetMyGame(); + TheGameInfo = TheLAN->GetMyGame(); } else { DEBUG_LOG(("Starting gamespy game")); - TheGameInfo = game = TheGameSpyGame; /// @todo: MDC add back in after demo + TheGameInfo = TheGameSpyGame; /// @todo: MDC add back in after demo } } else { if (TheRecorder && TheRecorder->isPlaybackMode()) { - TheGameInfo = game = TheRecorder->getGameInfo(); + TheGameInfo = TheRecorder->getGameInfo(); } else if(m_gameMode == GAME_SKIRMISH) { - TheGameInfo = game = TheSkirmishGameInfo; + TheGameInfo = TheSkirmishGameInfo; } } - checkForDuplicateColors( game ); + checkForDuplicateColors( TheGameInfo ); Bool isSkirmishOrSkirmishReplay = FALSE; - if (game) + if (TheGameInfo) { for (Int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!saveGame) { slot->saveOffOriginalInfo(); } if (slot->isAI()) { isSkirmishOrSkirmishReplay = TRUE; - continue; } } } else { @@ -1138,8 +1095,8 @@ void GameLogic::startNewGame( Bool saveGame ) } } - populateRandomSideAndColor( game ); - populateRandomStartPosition( game ); + populateRandomSideAndColor( TheGameInfo ); + populateRandomStartPosition( TheGameInfo ); //****************************// // Start the LoadScreen Now! // @@ -1152,7 +1109,7 @@ void GameLogic::startNewGame( Bool saveGame ) if(m_loadScreen && !TheGlobalData->m_headless) { TheMouse->setVisibility(FALSE); - m_loadScreen->init(game); + m_loadScreen->init(TheGameInfo); updateLoadProgress( LOAD_PROGRESS_START ); } @@ -1194,7 +1151,7 @@ void GameLogic::startNewGame( Bool saveGame ) #endif Int progressCount = LOAD_PROGRESS_SIDE_POPULATION; - if (game) + if (TheGameInfo) { if (TheGameEngine->isMultiplayerSession() || isSkirmishOrSkirmishReplay) @@ -1203,12 +1160,12 @@ void GameLogic::startNewGame( Bool saveGame ) TheSidesList->prepareForMP_or_Skirmish(); } - //DEBUG_LOG(("Starting LAN game with %d players", game->getNumPlayers())); + //DEBUG_LOG(("Starting LAN game with %d players", TheGameInfo->getNumPlayers())); Dict d; for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isHuman()) { @@ -1235,7 +1192,7 @@ void GameLogic::startNewGame( Bool saveGame ) d.setAsciiString(TheKey_playerFaction, KEYNAME(pt->getNameKey())); } - if (game->isPlayerPreorder(i)) + if (TheGameInfo->isPlayerPreorder(i)) { d.setBool(TheKey_playerIsPreorder, TRUE); } @@ -1245,7 +1202,7 @@ void GameLogic::startNewGame( Bool saveGame ) DEBUG_LOG(("Looking for allies of player %d, team %d", i, team)); for(int j=0; j < MAX_SLOTS; ++j) { - GameSlot *teamSlot = game->getSlot(j); + GameSlot *teamSlot = TheGameInfo->getSlot(j); // for check to see if we're trying to add ourselves if(i == j || !teamSlot->isOccupied()) continue; @@ -1299,7 +1256,7 @@ void GameLogic::startNewGame( Bool saveGame ) d.setInt(TheKey_multiplayerStartIndex, slot->getStartPos()); // d.setBool(TheKey_multiplayerIsLocal, slot->isLocalPlayer()); // d.setBool(TheKey_multiplayerIsLocal, slot->getIP() == game->getLocalIP()); - d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && (slot->getName().compare(game->getSlot(game->getLocalSlotNum())->getName().str()) == 0)); + d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && (slot->getName().compare(TheGameInfo->getSlot(TheGameInfo->getLocalSlotNum())->getName().str()) == 0)); /* if (slot->getIP() == game->getLocalIP()) @@ -1322,7 +1279,7 @@ void GameLogic::startNewGame( Bool saveGame ) AsciiString slotNameAscii; slotNameAscii.translate(slot->getName()); - if (slot->isHuman() && game->getSlotNum(slotNameAscii) == game->getLocalSlotNum()) { + if (slot->isHuman() && TheGameInfo->getSlotNum(slotNameAscii) == TheGameInfo->getLocalSlotNum()) { localSlot = i; } TheSidesList->addSide(&d); @@ -1392,11 +1349,11 @@ void GameLogic::startNewGame( Bool saveGame ) // if there are no other teams (happens for debugging) don't end the game immediately Int numTeams = 0; // this can be higher than expected, but is accurate for determining 0, 1, 2+ Int lastTeam = -1; - if (game) + if (TheGameInfo) { for (int i=0; igetConstSlot(i); + const GameSlot *slot = TheGameInfo->getConstSlot(i); if (slot->isOccupied() && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) { if (slot->getTeamNumber() == -1 || slot->getTeamNumber() != lastTeam) @@ -1625,11 +1582,11 @@ void GameLogic::startNewGame( Bool saveGame ) ThePartitionManager->revealMapForPlayerPermanently( observerPlayer->getPlayerIndex() ); DEBUG_LOG(("Reveal shroud for %ls whose index is %d", observerPlayer->getPlayerDisplayName().str(), observerPlayer->getPlayerIndex())); - if (game) + if (TheGameInfo) { for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isOccupied()) continue; @@ -1763,11 +1720,11 @@ void GameLogic::startNewGame( Bool saveGame ) progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; // place initial network buildings/units - if (game && !saveGame) + if (TheGameInfo && !saveGame) { for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isOccupied()) continue; @@ -1842,9 +1799,9 @@ void GameLogic::startNewGame( Bool saveGame ) // Note - We construct the multiplayer start spot name manually here, so change this if you // change TheKey_Player_1_Start etc. mdc AsciiString startingCamName = TheNameKeyGenerator->keyToName(TheKey_InitialCameraPosition); - if (game) + if (TheGameInfo) { - GameSlot *slot = game->getSlot(localSlot); + GameSlot *slot = TheGameInfo->getSlot(localSlot); DEBUG_ASSERTCRASH(slot, ("Starting a LAN game without ourselves!")); if (slot->isHuman()) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index 420142129b3..c4f7e130737 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -353,7 +353,6 @@ class GameLogic : public SubsystemInterface, public Snapshot ObjectID m_nextObjID; ///< For allocating object id's - void setDefaults( Bool loadSaveGame ); ///< Set default values of class object void processDestroyList( void ); ///< Destroy all pending objects on the destroy list void destroyAllObjectsImmediate(); ///< destroy, and process destroy list immediately diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index c729fb81cde..67a23d92c0d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -264,36 +264,6 @@ GameLogic::GameLogic( void ) m_clearingGameData = FALSE; } -// ------------------------------------------------------------------------------------------------ -/** Utility function to set class variables to default values. */ -// ------------------------------------------------------------------------------------------------ -void GameLogic::setDefaults( Bool loadingSaveGame ) -{ - m_frame = 0; - m_hasUpdated = FALSE; - m_width = DEFAULT_WORLD_WIDTH; - m_height = DEFAULT_WORLD_HEIGHT; - m_objList = NULL; -#ifdef ALLOW_NONSLEEPY_UPDATES - m_normalUpdates.clear(); -#endif - for (std::vector::iterator it = m_sleepyUpdates.begin(); it != m_sleepyUpdates.end(); ++it) - { - (*it)->friend_setIndexInLogic(-1); - } - m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; - - // - // only reset the next object ID allocater counter when we're not loading a save game. - // for save games, we read this value out of the save game file and it is important - // that we preserve it as we load and execute the game - // - if( loadingSaveGame == FALSE ) - m_nextObjID = (ObjectID)1; - -} - //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- Bool GameLogic::isInSinglePlayerGame( void ) @@ -385,9 +355,6 @@ void GameLogic::init( void ) setFPMode(); - /// @todo Clear object and destroy lists - setDefaults( FALSE ); - // create the partition manager ThePartitionManager = NEW PartitionManager; ThePartitionManager->init(); @@ -414,33 +381,8 @@ void GameLogic::init( void ) // create a team for the player //DEBUG_ASSERTCRASH(ThePlayerList, ("null ThePlayerList")); //ThePlayerList->setLocalPlayer(0); - - m_CRC = 0; - m_pauseFrame = 0; - m_gamePaused = FALSE; - m_pauseSound = FALSE; - m_pauseMusic = FALSE; - m_pauseInput = FALSE; - m_inputEnabledMemory = TRUE; - m_mouseVisibleMemory = TRUE; - m_logicTimeScaleEnabledMemory = FALSE; - - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressComplete[i] = FALSE; - m_progressCompleteTimeout[i] = 0; - } - m_forceGameStartByTimeOut = FALSE; - - m_isScoringEnabled = TRUE; - m_showBehindBuildingMarkers = TRUE; - m_drawIconUI = TRUE; - m_showDynamicLOD = TRUE; - m_scriptHulkMaxLifetimeOverride = -1; - + reset(); m_isInUpdate = FALSE; - - m_rankPointsToAddAtGameStart = 0; } //------------------------------------------------------------------------------------------------- @@ -495,7 +437,20 @@ void GameLogic::reset( void ) // clear any table of contents we have m_objectTOC.clear(); - setDefaults( FALSE ); + m_frame = 0; + m_hasUpdated = FALSE; + m_width = DEFAULT_WORLD_WIDTH; + m_height = DEFAULT_WORLD_HEIGHT; + m_objList = NULL; +#ifdef ALLOW_NONSLEEPY_UPDATES + m_normalUpdates.clear(); +#endif + for (std::vector::iterator it = m_sleepyUpdates.begin(); it != m_sleepyUpdates.end(); ++it) + { + (*it)->friend_setIndexInLogic(-1); + } + m_sleepyUpdates.clear(); + m_curUpdateModule = NULL; m_isScoringEnabled = TRUE; m_showBehindBuildingMarkers = TRUE; @@ -1215,20 +1170,22 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } m_rankLevelLimit = 1000; // this is reset every game. - setDefaults( loadingSaveGame ); + + // + // only reset the next object ID allocater counter when we're not loading a save game. + // for save games, we read this value out of the save game file and it is important + // that we preserve it as we load and execute the game + // + if( loadingSaveGame == FALSE ) + m_nextObjID = (ObjectID)1; + TheWritableGlobalData->m_loadScreenRender = TRUE; ///< mark it so only a few select things are rendered during load TheWritableGlobalData->m_TiVOFastMode = FALSE; //always disable the TIVO fast-forward mode at the start of a new game. - m_showBehindBuildingMarkers = TRUE; - m_drawIconUI = TRUE; - m_showDynamicLOD = TRUE; - m_scriptHulkMaxLifetimeOverride = -1; - Campaign* currentCampaign = TheCampaignManager->getCurrentCampaign(); Bool isChallengeCampaign = m_gameMode == GAME_SINGLE_PLAYER && currentCampaign && currentCampaign->m_isChallengeCampaign; // Fill in the game color and Factions before we do the Load Screen - GameInfo *game = NULL; TheGameInfo = NULL; Int localSlot = 0; if (TheNetwork) @@ -1236,27 +1193,27 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (TheLAN) { DEBUG_LOG(("Starting network game")); - TheGameInfo = game = TheLAN->GetMyGame(); + TheGameInfo = TheLAN->GetMyGame(); } else { DEBUG_LOG(("Starting gamespy game")); - TheGameInfo = game = TheGameSpyGame; /// @todo: MDC add back in after demo + TheGameInfo = TheGameSpyGame; /// @todo: MDC add back in after demo } } else { if (TheRecorder && TheRecorder->isPlaybackMode()) { - TheGameInfo = game = TheRecorder->getGameInfo(); + TheGameInfo = TheRecorder->getGameInfo(); } else if(m_gameMode == GAME_SKIRMISH) { - TheGameInfo = game = TheSkirmishGameInfo; + TheGameInfo = TheSkirmishGameInfo; } else if(isChallengeCampaign) { - TheGameInfo = game = TheChallengeGameInfo; + TheGameInfo = TheChallengeGameInfo; } } @@ -1276,21 +1233,20 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } } - checkForDuplicateColors( game ); + checkForDuplicateColors( TheGameInfo ); Bool isSkirmishOrSkirmishReplay = FALSE; - if (game) + if (TheGameInfo) { for (Int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!loadingSaveGame) { slot->saveOffOriginalInfo(); } if (slot->isAI()) { isSkirmishOrSkirmishReplay = TRUE; - continue; } } } else { @@ -1300,8 +1256,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } } - populateRandomSideAndColor( game ); - populateRandomStartPosition( game ); + populateRandomSideAndColor( TheGameInfo ); + populateRandomStartPosition( TheGameInfo ); //****************************// // Start the LoadScreen Now! // @@ -1314,7 +1270,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if(m_loadScreen) { TheMouse->setVisibility(FALSE); - m_loadScreen->init(game); + m_loadScreen->init(TheGameInfo); updateLoadProgress( LOAD_PROGRESS_START ); } @@ -1356,7 +1312,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) #endif Int progressCount = LOAD_PROGRESS_SIDE_POPULATION; - if (game) + if (TheGameInfo) { if (TheGameEngine->isMultiplayerSession() || isSkirmishOrSkirmishReplay) @@ -1370,7 +1326,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isHuman()) { @@ -1397,7 +1353,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) d.setAsciiString(TheKey_playerFaction, KEYNAME(pt->getNameKey())); } - if (game->isPlayerPreorder(i)) + if (TheGameInfo->isPlayerPreorder(i)) { d.setBool(TheKey_playerIsPreorder, TRUE); } @@ -1407,7 +1363,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) DEBUG_LOG(("Looking for allies of player %d, team %d", i, team)); for(int j=0; j < MAX_SLOTS; ++j) { - GameSlot *teamSlot = game->getSlot(j); + GameSlot *teamSlot = TheGameInfo->getSlot(j); // for check to see if we're trying to add ourselves if(i == j || !teamSlot->isOccupied()) continue; @@ -1461,7 +1417,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) d.setInt(TheKey_multiplayerStartIndex, slot->getStartPos()); // d.setBool(TheKey_multiplayerIsLocal, slot->isLocalPlayer()); // d.setBool(TheKey_multiplayerIsLocal, slot->getIP() == game->getLocalIP()); - d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && (slot->getName().compare(game->getSlot(game->getLocalSlotNum())->getName().str()) == 0)); + d.setBool(TheKey_multiplayerIsLocal, slot->isHuman() && (slot->getName().compare(TheGameInfo->getSlot(TheGameInfo->getLocalSlotNum())->getName().str()) == 0)); /* if (slot->getIP() == game->getLocalIP()) @@ -1484,7 +1440,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) AsciiString slotNameAscii; slotNameAscii.translate(slot->getName()); - if (slot->isHuman() && game->getSlotNum(slotNameAscii) == game->getLocalSlotNum()) { + if (slot->isHuman() && TheGameInfo->getSlotNum(slotNameAscii) == TheGameInfo->getLocalSlotNum()) { localSlot = i; } TheSidesList->addSide(&d); @@ -1554,11 +1510,11 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // if there are no other teams (happens for debugging) don't end the game immediately Int numTeams = 0; // this can be higher than expected, but is accurate for determining 0, 1, 2+ Int lastTeam = -1; - if (game) + if (TheGameInfo) { for (int i=0; igetConstSlot(i); + const GameSlot *slot = TheGameInfo->getConstSlot(i); if (slot->isOccupied() && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) { if (slot->getTeamNumber() == -1 || slot->getTeamNumber() != lastTeam) @@ -1787,11 +1743,11 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) ThePartitionManager->revealMapForPlayerPermanently( observerPlayer->getPlayerIndex() ); DEBUG_LOG(("Reveal shroud for %ls whose index is %d", observerPlayer->getPlayerDisplayName().str(), observerPlayer->getPlayerIndex())); - if (game) + if (TheGameInfo) { for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isOccupied()) continue; @@ -1977,11 +1933,11 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; // place initial network buildings/units - if (game && !loadingSaveGame) + if (TheGameInfo && !loadingSaveGame) { for (int i=0; igetSlot(i); + GameSlot *slot = TheGameInfo->getSlot(i); if (!slot || !slot->isOccupied()) continue; @@ -2032,7 +1988,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // Trouble was that skirmish games would get no command centers upon start, if this was set true in a GameSpyMenu if ( isInInternetGame() ) { - if ( game->oldFactionsOnly() && !pt->isOldFaction() ) + if ( TheGameInfo->oldFactionsOnly() && !pt->isOldFaction() ) continue; } @@ -2083,9 +2039,9 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // Note - We construct the multiplayer start spot name manually here, so change this if you // change TheKey_Player_1_Start etc. mdc AsciiString startingCamName = TheNameKeyGenerator->keyToName(TheKey_InitialCameraPosition); - if (game) + if (TheGameInfo) { - GameSlot *slot = game->getSlot(localSlot); + GameSlot *slot = TheGameInfo->getSlot(localSlot); DEBUG_ASSERTCRASH(slot, ("Starting a LAN game without ourselves!")); if (slot->isHuman()) From 224017e223a072c37a1ca3f278315af0bdab475d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 2 Jan 2026 11:06:21 +0100 Subject: [PATCH 016/211] bugfix(heightmap): Disable old uv adjument for cliffs (#2038) --- .../Source/W3DDevice/GameClient/WorldHeightMap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 52384dfed58..18d134fb532 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -1742,7 +1742,11 @@ Bool WorldHeightMap::getUVForTileIndex(Int ndx, Short tileNdx, float U[4], float return info.flip; } } -#define DO_OLD_UV + +// TheSuperHackers @bugfix xezon 11/12/2025 Disables the old uv adjustment for cliffs, +// because it produces bad uv tiles on steep terrain and is also not helping performance. +// @todo Delete this code when we are certain we never need this again. +//#define DO_OLD_UV #ifdef DO_OLD_UV // old uv adjustment for cliffs static Real STRETCH_LIMIT = 1.5f; // If it is stretching less than this, don't adjust. From 5deddce8fba8f4bd5995e2bf3d3f56ed33655222 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 2 Jan 2026 11:06:52 +0100 Subject: [PATCH 017/211] bugfix(heightmap): Fix dynamic lights on terrain (#2039) --- .../Source/W3DDevice/GameClient/HeightMap.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 55f228a81d2..57d0decba19 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1387,7 +1387,10 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap, //============================================================================= // HeightMapRenderObjClass::On_Frame_Update //============================================================================= -/** Updates the diffuse color values in the vertices as affected by the dynamic lights.*/ +// Updates the diffuse color values in the vertices as affected by the dynamic +// lights. +// TheSuperHackers @bugfix xezon 15/12/2025 Now draws the dynamic lights +// properly on the entirety of the drawable map region. //============================================================================= void HeightMapRenderObjClass::On_Frame_Update(void) { @@ -1418,10 +1421,10 @@ void HeightMapRenderObjClass::On_Frame_Update(void) Int numDynaLights=0; W3DDynamicLight *enabledLights[MAX_ENABLED_DYNAMIC_LIGHTS]; - Int yCoordMin = m_map->getDrawOrgY(); - Int yCoordMax = m_y+m_map->getDrawOrgY(); - Int xCoordMin = m_map->getDrawOrgX(); - Int xCoordMax = m_x+m_map->getDrawOrgX(); + const Int xCoordMin = m_map->getDrawOrgX() - m_map->getBorderSizeInline(); + const Int yCoordMin = m_map->getDrawOrgY() - m_map->getBorderSizeInline(); + const Int xCoordMax = xCoordMin + m_map->getDrawWidth(); + const Int yCoordMax = yCoordMin + m_map->getDrawHeight(); for (pDynamicLightsIterator.First(); !pDynamicLightsIterator.Is_Done(); pDynamicLightsIterator.Next()) { From 13de4270f8ccd088369bc66f2a02d9185c6f77fb Mon Sep 17 00:00:00 2001 From: IamInnocent3X Date: Sat, 3 Jan 2026 00:14:31 +0800 Subject: [PATCH 018/211] perf(weaponstore): Optimize WeaponStore::findWeaponTemplatePrivate with hash map lookup (#2042) --- Generals/Code/GameEngine/Include/GameLogic/Weapon.h | 5 +++++ .../Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 8 +++++--- GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h | 5 +++++ .../Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 8 +++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h index d75cb276f5a..6895677ba1a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h @@ -862,6 +862,11 @@ class WeaponStore : public SubsystemInterface }; std::vector m_weaponTemplateVector; + + // TheSuperHackers @performance IamInnocent 01/01/2026 - Now additionally stores the same weapon templates in a hash map to optimize lookups by name key + typedef std::hash_map, rts::equal_to > WeaponTemplateMap; + WeaponTemplateMap m_weaponTemplateHashMap; + std::list m_weaponDDI; }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index ff1dbf4ed14..86835e3872f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1438,6 +1438,7 @@ WeaponStore::~WeaponStore() deleteInstance(wt); } m_weaponTemplateVector.clear(); + m_weaponTemplateHashMap.clear(); } //------------------------------------------------------------------------------------------------- @@ -1496,9 +1497,9 @@ const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const { // search weapon list for name - for (size_t i = 0; i < m_weaponTemplateVector.size(); i++) - if( m_weaponTemplateVector[ i ]->getNameKey() == key ) - return m_weaponTemplateVector[i]; + WeaponTemplateMap::const_iterator it = m_weaponTemplateHashMap.find(key); + if(it != m_weaponTemplateHashMap.end()) + return it->second; return NULL; @@ -1517,6 +1518,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) wt->m_name = name; wt->m_nameKey = TheNameKeyGenerator->nameToKey( name ); m_weaponTemplateVector.push_back(wt); + m_weaponTemplateHashMap[wt->m_nameKey] = wt; return wt; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index 6b39c957585..3afebed868d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -887,6 +887,11 @@ class WeaponStore : public SubsystemInterface }; std::vector m_weaponTemplateVector; + + // TheSuperHackers @performance IamInnocent 01/01/2026 - Now additionally stores the same weapon templates in a hash map to optimize lookups by name key + typedef std::hash_map, rts::equal_to > WeaponTemplateMap; + WeaponTemplateMap m_weaponTemplateHashMap; + std::list m_weaponDDI; }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 7720c5cc71b..473f284ab41 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1583,6 +1583,7 @@ WeaponStore::~WeaponStore() deleteInstance(wt); } m_weaponTemplateVector.clear(); + m_weaponTemplateHashMap.clear(); } //------------------------------------------------------------------------------------------------- @@ -1641,9 +1642,9 @@ const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const { // search weapon list for name - for (size_t i = 0; i < m_weaponTemplateVector.size(); i++) - if( m_weaponTemplateVector[ i ]->getNameKey() == key ) - return m_weaponTemplateVector[i]; + WeaponTemplateMap::const_iterator it = m_weaponTemplateHashMap.find(key); + if(it != m_weaponTemplateHashMap.end()) + return it->second; return NULL; @@ -1662,6 +1663,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) wt->m_name = name; wt->m_nameKey = TheNameKeyGenerator->nameToKey( name ); m_weaponTemplateVector.push_back(wt); + m_weaponTemplateHashMap[wt->m_nameKey] = wt; return wt; } From 409fed26fcfc3ca9b5298f282d4669ef94cc3b8a Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:29:09 +0100 Subject: [PATCH 019/211] bugfix(thingfactory): Reset next ThingTemplate ID after clearing custom map template overrides to avoid CRC mismatch in the next multiplayer game session (#2034) --- .../Code/GameEngine/Source/Common/Thing/ThingFactory.cpp | 6 ++++++ .../Code/GameEngine/Source/Common/Thing/ThingFactory.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 22db98ea19d..42b9e4a120d 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -236,8 +236,14 @@ void ThingFactory::reset( void ) m_templateHashMap.erase(templateName); } + DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); + t = nextT; } + + // TheSuperHackers @bugfix Caball009 25/12/2025 Avoid mismatches by making m_nextTemplateID unique for a single match instead of unique since game launch. + DEBUG_ASSERTCRASH(m_firstTemplate && m_firstTemplate->getTemplateID() == m_templateHashMap.size(), ("Template ID is unexpected after deleting overrides")); + m_nextTemplateID = static_cast(m_firstTemplate->getTemplateID() + 1); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 1aa09afad2f..71a9e724fbf 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -236,8 +236,14 @@ void ThingFactory::reset( void ) m_templateHashMap.erase(templateName); } + DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); + t = nextT; } + + // TheSuperHackers @bugfix Caball009 25/12/2025 Avoid mismatches by making m_nextTemplateID unique for a single match instead of unique since game launch. + DEBUG_ASSERTCRASH(m_firstTemplate && m_firstTemplate->getTemplateID() == m_templateHashMap.size(), ("Template ID is unexpected after deleting overrides")); + m_nextTemplateID = static_cast(m_firstTemplate->getTemplateID() + 1); } //------------------------------------------------------------------------------------------------- From f2da2b6e13841de7f429c70a6c2a70ef4a1d53a1 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:30:52 +0100 Subject: [PATCH 020/211] tweak(drawable): Set correct model tint color after loading a save game (#2025) --- .../GameEngine/Source/GameClient/Drawable.cpp | 16 +++++++++++++-- .../GameEngine/Source/GameClient/Drawable.cpp | 20 +++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 10e680001be..b7284e0c45e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4248,13 +4248,18 @@ void Drawable::xferDrawableModules( Xfer *xfer ) * during the module xfer (CBD) * 4: Added m_ambientSoundEnabled flag * 5: save full mtx, not pos+orient. + * 6: TheSuperHackers @bugfix Removed m_prevTintStatus because loading its value is unnecessary and undesirable */ // ------------------------------------------------------------------------------------------------ void Drawable::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 5; +#else + const XferVersion currentVersion = 6; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -4414,8 +4419,15 @@ void Drawable::xfer( Xfer *xfer ) // tint status xfer->xferUnsignedInt( &m_tintStatus ); - // prev tint status - xfer->xferUnsignedInt( &m_prevTintStatus ); + if (version <= 5) + { + // prev tint status + xfer->xferUnsignedInt( &m_prevTintStatus ); + + // TheSuperHackers @bugfix Caball009 21/12/2025 Trigger tinting after loading a save game. + if (xfer->getXferMode() == XFER_LOAD) + m_prevTintStatus = 0; + } // fading mode xfer->xferUser( &m_fadeMode, sizeof( FadingMode ) ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 9f1f5f7eafe..f5dd995db0f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4904,15 +4904,20 @@ void Drawable::xferDrawableModules( Xfer *xfer ) * during the module xfer (CBD) * 4: Added m_ambientSoundEnabled flag * 5: save full mtx, not pos+orient. - * 6: Added m_ambientSoundEnabledFromScript flag - * 7: Save the customize ambient sound info + * 6: Added m_ambientSoundEnabledFromScript flag + * 7: Save the customize ambient sound info + * 8: TheSuperHackers @bugfix Removed m_prevTintStatus because loading its value is unnecessary and undesirable */ // ------------------------------------------------------------------------------------------------ void Drawable::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 7; +#else + const XferVersion currentVersion = 8; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -5072,8 +5077,15 @@ void Drawable::xfer( Xfer *xfer ) // tint status xfer->xferUnsignedInt( &m_tintStatus ); - // prev tint status - xfer->xferUnsignedInt( &m_prevTintStatus ); + if (version <= 7) + { + // prev tint status + xfer->xferUnsignedInt( &m_prevTintStatus ); + + // TheSuperHackers @bugfix Caball009 21/12/2025 Trigger tinting after loading a save game. + if (xfer->getXferMode() == XFER_LOAD) + m_prevTintStatus = 0; + } // fading mode xfer->xferUser( &m_fadeMode, sizeof( FadingMode ) ); From ae05f11ad104533ec167b7c4a4e3465e374dc813 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 4 Jan 2026 03:56:58 +1100 Subject: [PATCH 021/211] bugfix(aiupdate): Prevent manually ejecting rappelling Rangers during Chinook Combat Drop (#1789) --- .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 14 ++++++++++++++ .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 60dbd2361e4..cf48a89f970 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -587,6 +587,7 @@ class ChinookCombatDropState : public State Object* rappeller = getPotentialRappeller(obj); if (rappeller != NULL) { +#if RETAIL_COMPATIBLE_CRC ExitInterface *exitInterface = obj->getObjectExitInterface(); ExitDoorType exitDoor = exitInterface ? exitInterface->reserveDoorForExit(rappeller->getTemplate(), rappeller) : DOOR_NONE_AVAILABLE; if(exitDoor != DOOR_NONE_AVAILABLE) @@ -597,6 +598,15 @@ class ChinookCombatDropState : public State { DEBUG_CRASH(("rappeller is not free to exit... what?")); } +#else + // TheSuperHackers @bugfix 03/01/2026 Bypass door reservation as rappellers are always + // expected to be free to exit. This avoids prior rappel conditions in getAiFreeToExit + // from allowing rappellers to be freely 'dropped' from the Chinook during this state. + if (ExitInterface* exitInterface = obj->getObjectExitInterface()) + { + exitInterface->exitObjectViaDoor(rappeller, DOOR_1); + } +#endif rappeller->setTransformMatrix(&it->dropStartMtx); @@ -983,8 +993,12 @@ ObjectID ChinookAIUpdate::getBuildingToNotPathAround() const //------------------------------------------------------------------------------------------------- AIFreeToExitType ChinookAIUpdate::getAiFreeToExit(const Object* exiter) const { +#if RETAIL_COMPATIBLE_CRC if (m_flightStatus == CHINOOK_LANDED || (m_flightStatus == CHINOOK_DOING_COMBAT_DROP && exiter->isKindOf(KINDOF_CAN_RAPPEL))) +#else + if (m_flightStatus == CHINOOK_LANDED) +#endif return FREE_TO_EXIT; return WAIT_TO_EXIT; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index dd33e54cbde..afed8280036 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -588,6 +588,7 @@ class ChinookCombatDropState : public State Object* rappeller = getPotentialRappeller(obj); if (rappeller != NULL) { +#if RETAIL_COMPATIBLE_CRC ExitInterface *exitInterface = obj->getObjectExitInterface(); ExitDoorType exitDoor = exitInterface ? exitInterface->reserveDoorForExit(rappeller->getTemplate(), rappeller) : DOOR_NONE_AVAILABLE; if(exitDoor != DOOR_NONE_AVAILABLE) @@ -598,6 +599,15 @@ class ChinookCombatDropState : public State { DEBUG_CRASH(("rappeller is not free to exit... what?")); } +#else + // TheSuperHackers @bugfix 03/01/2026 Bypass door reservation as rappellers are always + // expected to be free to exit. This avoids prior rappel conditions in getAiFreeToExit + // from allowing rappellers to be freely 'dropped' from the Chinook during this state. + if (ExitInterface* exitInterface = obj->getObjectExitInterface()) + { + exitInterface->exitObjectViaDoor(rappeller, DOOR_1); + } +#endif rappeller->setTransformMatrix(&it->dropStartMtx); @@ -1045,8 +1055,12 @@ ObjectID ChinookAIUpdate::getBuildingToNotPathAround() const //------------------------------------------------------------------------------------------------- AIFreeToExitType ChinookAIUpdate::getAiFreeToExit(const Object* exiter) const { +#if RETAIL_COMPATIBLE_CRC if (m_flightStatus == CHINOOK_LANDED || (m_flightStatus == CHINOOK_DOING_COMBAT_DROP && exiter->isKindOf(KINDOF_CAN_RAPPEL))) +#else + if (m_flightStatus == CHINOOK_LANDED) +#endif return FREE_TO_EXIT; return WAIT_TO_EXIT; From afa8aa357c0890bd8d77303e0eba2adc34da79dc Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 4 Jan 2026 03:57:32 +1100 Subject: [PATCH 022/211] bugfix(ai): Undetected mines can now be approached when using a disarm weapon (#1883) --- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 12 +++++++++++- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 05ce1ea359b..9207bb5f34b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -2596,7 +2596,17 @@ StateReturnType AIAttackApproachTargetState::updateInternal() { if( victim->testStatus( OBJECT_STATUS_STEALTHED ) && !victim->testStatus( OBJECT_STATUS_DETECTED ) ) { - return STATE_FAILURE; // If obj is stealthed, can no longer approach. + // If obj is stealthed, can no longer approach. + // TheSuperHackers @bugfix Stubbjax 19/11/2025 Except when disarming stealthed mines. +#if RETAIL_COMPATIBLE_CRC + return STATE_FAILURE; +#else + const Bool isTargetingMine = weapon && weapon->getDamageType() == DAMAGE_DISARM && + (victim->isKindOf(KINDOF_MINE)); + + if (!isTargetingMine) + return STATE_FAILURE; +#endif } ai->setCurrentVictim(victim); // Attacking an object. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 63b34746626..c2468cbfcd5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -2682,7 +2682,17 @@ StateReturnType AIAttackApproachTargetState::updateInternal() } if( victim->testStatus( OBJECT_STATUS_STEALTHED ) && !victim->testStatus( OBJECT_STATUS_DETECTED ) && !victim->testStatus( OBJECT_STATUS_DISGUISED ) ) { - return STATE_FAILURE; // If obj is stealthed, can no longer approach. + // If obj is stealthed, can no longer approach. + // TheSuperHackers @bugfix Stubbjax 19/11/2025 Except when disarming stealthed mines or traps. +#if RETAIL_COMPATIBLE_CRC + return STATE_FAILURE; +#else + const Bool isTargetingMine = weapon && weapon->getDamageType() == DAMAGE_DISARM && + (victim->isKindOf(KINDOF_MINE) || victim->isKindOf(KINDOF_BOOBY_TRAP) || victim->isKindOf(KINDOF_DEMOTRAP)); + + if (!isTargetingMine) + return STATE_FAILURE; +#endif } ai->setCurrentVictim(victim); // Attacking an object. From 0d6c77621a76faeb3e7f9e78fdbf890adb975eea Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sun, 4 Jan 2026 01:25:54 -0800 Subject: [PATCH 023/211] bugfix(lobby): Properly sort CRC mismatched game rooms to the bottom of the lobby (#1845) --- Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 7ac0d39b852..1b72be479cd 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -474,8 +474,8 @@ struct GameSortStruct bool operator()(GameSpyStagingRoom *g1, GameSpyStagingRoom *g2) const { // sort CRC mismatches to the bottom - Bool g1Good = (g1->getExeCRC() != TheGlobalData->m_exeCRC || g1->getIniCRC() != TheGlobalData->m_iniCRC); - Bool g2Good = (g1->getExeCRC() != TheGlobalData->m_exeCRC || g1->getIniCRC() != TheGlobalData->m_iniCRC); + Bool g1Good = (g1->getExeCRC() == TheGlobalData->m_exeCRC && g1->getIniCRC() == TheGlobalData->m_iniCRC); + Bool g2Good = (g2->getExeCRC() == TheGlobalData->m_exeCRC && g2->getIniCRC() == TheGlobalData->m_iniCRC); if ( g1Good ^ g2Good ) { return g1Good; From 925ecf1bc83253d7e9f7242ccbaee009dacf83e5 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sun, 4 Jan 2026 01:26:23 -0800 Subject: [PATCH 024/211] perf(ai): Avoid a few std::vector copies when passing ai paths to functions (#1895) --- Dependencies/Utility/Utility/CppMacros.h | 24 +++++++++++++++++++ .../Code/GameEngine/Include/GameLogic/AI.h | 8 +++---- .../Include/GameLogic/AIStateMachine.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 4 ++-- .../Include/GameLogic/Module/JetAIUpdate.h | 4 ++-- .../Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../GameLogic/Object/Update/AIUpdate.cpp | 14 +++++++---- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 2 +- .../Code/GameEngine/Include/GameLogic/AI.h | 8 +++---- .../Include/GameLogic/AIStateMachine.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 4 ++-- .../Include/GameLogic/Module/JetAIUpdate.h | 4 ++-- .../Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../GameLogic/Object/Update/AIUpdate.cpp | 14 +++++++---- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 2 +- 15 files changed, 68 insertions(+), 32 deletions(-) diff --git a/Dependencies/Utility/Utility/CppMacros.h b/Dependencies/Utility/Utility/CppMacros.h index 8bfb0297f29..02ab1c0d098 100644 --- a/Dependencies/Utility/Utility/CppMacros.h +++ b/Dependencies/Utility/Utility/CppMacros.h @@ -19,6 +19,10 @@ // This file contains macros to help upgrade the code for newer cpp standards. #pragma once +#if __cplusplus >= 201103L +#include +#endif + #if __cplusplus >= 201703L #define NOEXCEPT_17 noexcept #define REGISTER @@ -44,3 +48,23 @@ #define constexpr #define nullptr 0 #endif + +namespace stl +{ + +// Helper to move-assign from reference: uses std::move in C++11, swap in C++98 +template +inline void move_or_swap(T& dest, T& src) +{ +#if __cplusplus >= 201103L + dest = std::move(src); +#else + // C++03 fallback: mimic move semantics + // dest gets src's value, src becomes empty + T empty; + dest.swap(src); + src.swap(empty); +#endif +} + +} // namespace stl diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index dc2053d4cc9..8d3646c2685 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -536,18 +536,18 @@ class AICommandInterface aiDoCommand(&parms); } - void aiFollowExitProductionPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) + void aiFollowExitProductionPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) { AICommandParms parms(AICMD_FOLLOW_EXITPRODUCTION_PATH, cmdSource); - parms.m_coords = *path; + stl::move_or_swap(parms.m_coords, *path); parms.m_obj = ignoreObject; aiDoCommand(&parms); } - void aiFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) + void aiFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) { AICommandParms parms(AICMD_FOLLOW_PATH, cmdSource); - parms.m_coords = *path; + stl::move_or_swap(parms.m_coords, *path); parms.m_obj = ignoreObject; aiDoCommand(&parms); } diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h index 03f0de0e733..7e39c8ec7c5 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -138,7 +138,7 @@ class AIStateMachine : public StateMachine virtual StateReturnType setState( StateID newStateID ); /// @todo Rethink state parameter passing. Continuing in this fashion will have a pile of params in the machine (MSB) - void setGoalPath( const std::vector* path ); + void setGoalPath( std::vector* path ); void addToGoalPath( const Coord3D *pathPoint ); const Coord3D *getGoalPathPosition( Int i ) const; ///< return path position at index "i" Int getGoalPathSize() const { return m_goalPath.size(); } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 0482f737aa2..b47f353ecfa 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -244,7 +244,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual void privateFollowWaypointPathAsTeam( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point virtual void privateFollowWaypointPathExact( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point virtual void privateFollowWaypointPathAsTeamExact( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point - virtual void privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points + virtual void privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points virtual void privateFollowPathAppend( const Coord3D *pos, CommandSourceType cmdSource ); virtual void privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); ///< attack given object virtual void privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); ///< attack given object @@ -338,7 +338,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual Bool isBusy() const; virtual void onObjectCreated(); - virtual void doQuickExit( const std::vector* path ); ///< get out of this Object + virtual void doQuickExit( std::vector* path ); ///< get out of this Object virtual void aiDoCommand(const AICommandParms* parms); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h index cc6f8c4e722..3c8579ebf11 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h @@ -104,7 +104,7 @@ class JetAIUpdate : public AIUpdateInterface Real friend_getMinHeight() const { return getJetAIUpdateModuleData()->m_minHeight; } Real friend_getParkingOffset() const { return getJetAIUpdateModuleData()->m_parkingOffset; } UnsignedInt friend_getTakeoffPause() const { return getJetAIUpdateModuleData()->m_takeoffPause; } - void friend_setGoalPath( const std::vector* path ) { getStateMachine()->setGoalPath(path); } + void friend_setGoalPath( std::vector* path ) { getStateMachine()->setGoalPath(path); } void friend_setTakeoffInProgress(Bool v) { setFlag(TAKEOFF_IN_PROGRESS, v); } void friend_setLandingInProgress(Bool v) { setFlag(LANDING_IN_PROGRESS, v); } void friend_setTaxiInProgress(Bool v) { setFlag(TAXI_IN_PROGRESS, v); } @@ -122,7 +122,7 @@ class JetAIUpdate : public AIUpdateInterface virtual AIStateMachine* makeStateMachine(); - virtual void privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points + virtual void privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points virtual void privateFollowPathAppend( const Coord3D *pos, CommandSourceType cmdSource ); virtual void privateEnter( Object *obj, CommandSourceType cmdSource ); ///< enter the given object virtual void privateGetRepaired( Object *repairDepot, CommandSourceType cmdSource );///< get repaired at repair depot diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 9207bb5f34b..e27d1e08fd8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -816,9 +816,9 @@ void AIStateMachine::loadPostProcess( void ) /** * Define a simple path */ -void AIStateMachine::setGoalPath( const std::vector* path ) +void AIStateMachine::setGoalPath( std::vector* path ) { - m_goalPath = *path; + stl::move_or_swap(m_goalPath, *path); } #ifdef STATE_MACHINE_DEBUG diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 67cedc7f376..2f09a4ff27b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -2619,14 +2619,20 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms) privateFollowWaypointPathAsTeamExact(parms->m_waypoint, parms->m_cmdSource); break; case AICMD_FOLLOW_PATH: - privateFollowPath(&parms->m_coords, parms->m_obj, parms->m_cmdSource, FALSE); + { + std::vector coords = parms->m_coords; + privateFollowPath(&coords, parms->m_obj, parms->m_cmdSource, FALSE); break; + } case AICMD_FOLLOW_PATH_APPEND: privateFollowPathAppend(&parms->m_pos, parms->m_cmdSource); break; case AICMD_FOLLOW_EXITPRODUCTION_PATH: - privateFollowPath(&parms->m_coords, parms->m_obj, parms->m_cmdSource, TRUE); + { + std::vector coords = parms->m_coords; + privateFollowPath(&coords, parms->m_obj, parms->m_cmdSource, TRUE); break; + } case AICMD_ATTACK_OBJECT: privateAttackObject(parms->m_obj, parms->m_intValue, parms->m_cmdSource); break; @@ -3240,7 +3246,7 @@ void AIUpdateInterface::privateFollowPathAppend( const Coord3D *pos, CommandSour /** * Follow the path defined by the given array of points */ -void AIUpdateInterface::privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) +void AIUpdateInterface::privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) { if (getObject()->isMobile() == FALSE) return; @@ -3681,7 +3687,7 @@ void AIUpdateInterface::privateExit( Object *objectToExit, CommandSourceType cmd /** * Get out of whatever it is inside of */ -void AIUpdateInterface::doQuickExit( const std::vector* path ) +void AIUpdateInterface::doQuickExit( std::vector* path ) { Bool locked = getStateMachine()->isLocked(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index f2642286188..1ce63cffc52 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2172,7 +2172,7 @@ Bool JetAIUpdate::getTreatAsAircraftForLocoDistToGoal() const /** * Follow the path defined by the given array of points */ -void JetAIUpdate::privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) +void JetAIUpdate::privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) { if (exitProduction) { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h index 23cf4f94f83..fc4a0be12d0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h @@ -550,18 +550,18 @@ class AICommandInterface aiDoCommand(&parms); } - void aiFollowExitProductionPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) + void aiFollowExitProductionPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) { AICommandParms parms(AICMD_FOLLOW_EXITPRODUCTION_PATH, cmdSource); - parms.m_coords = *path; + stl::move_or_swap(parms.m_coords, *path); parms.m_obj = ignoreObject; aiDoCommand(&parms); } - void aiFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) + void aiFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource ) { AICommandParms parms(AICMD_FOLLOW_PATH, cmdSource); - parms.m_coords = *path; + stl::move_or_swap(parms.m_coords, *path); parms.m_obj = ignoreObject; aiDoCommand(&parms); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h index 3171df36bcf..8d96e659972 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -141,7 +141,7 @@ class AIStateMachine : public StateMachine virtual StateReturnType setState( StateID newStateID ); /// @todo Rethink state parameter passing. Continuing in this fashion will have a pile of params in the machine (MSB) - void setGoalPath( const std::vector* path ); + void setGoalPath( std::vector* path ); void addToGoalPath( const Coord3D *pathPoint ); const Coord3D *getGoalPathPosition( Int i ) const; ///< return path position at index "i" Int getGoalPathSize() const { return m_goalPath.size(); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 423977192c1..32e562d23ab 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -249,7 +249,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual void privateFollowWaypointPathAsTeam( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point virtual void privateFollowWaypointPathExact( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point virtual void privateFollowWaypointPathAsTeamExact( const Waypoint *way, CommandSourceType cmdSource );///< start following the path from the given point - virtual void privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points + virtual void privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points virtual void privateFollowPathAppend( const Coord3D *pos, CommandSourceType cmdSource ); virtual void privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); ///< attack given object virtual void privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); ///< attack given object @@ -351,7 +351,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual Bool isBusy() const; virtual void onObjectCreated(); - virtual void doQuickExit( const std::vector* path ); ///< get out of this Object + virtual void doQuickExit( std::vector* path ); ///< get out of this Object virtual void aiDoCommand(const AICommandParms* parms); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h index 1840d30a4bf..a7cd1157aa1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetAIUpdate.h @@ -110,7 +110,7 @@ class JetAIUpdate : public AIUpdateInterface Real friend_getMinHeight() const { return getJetAIUpdateModuleData()->m_minHeight; } Real friend_getParkingOffset() const { return getJetAIUpdateModuleData()->m_parkingOffset; } UnsignedInt friend_getTakeoffPause() const { return getJetAIUpdateModuleData()->m_takeoffPause; } - void friend_setGoalPath( const std::vector* path ) { getStateMachine()->setGoalPath(path); } + void friend_setGoalPath( std::vector* path ) { getStateMachine()->setGoalPath(path); } void friend_setTakeoffInProgress(Bool v) { setFlag(TAKEOFF_IN_PROGRESS, v); } void friend_setLandingInProgress(Bool v) { setFlag(LANDING_IN_PROGRESS, v); } void friend_setTaxiInProgress(Bool v) { setFlag(TAXI_IN_PROGRESS, v); } @@ -131,7 +131,7 @@ class JetAIUpdate : public AIUpdateInterface virtual AIStateMachine* makeStateMachine(); - virtual void privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points + virtual void privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points virtual void privateFollowPathAppend( const Coord3D *pos, CommandSourceType cmdSource ); virtual void privateEnter( Object *obj, CommandSourceType cmdSource ); ///< enter the given object virtual void privateGetRepaired( Object *repairDepot, CommandSourceType cmdSource );///< get repaired at repair depot diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index c2468cbfcd5..019025d0126 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -821,9 +821,9 @@ void AIStateMachine::loadPostProcess( void ) /** * Define a simple path */ -void AIStateMachine::setGoalPath( const std::vector* path ) +void AIStateMachine::setGoalPath( std::vector* path ) { - m_goalPath = *path; + stl::move_or_swap(m_goalPath, *path); } #ifdef STATE_MACHINE_DEBUG diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 7bc310b7d61..821a56e7eb4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -2681,14 +2681,20 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms) privateFollowWaypointPathAsTeamExact(parms->m_waypoint, parms->m_cmdSource); break; case AICMD_FOLLOW_PATH: - privateFollowPath(&parms->m_coords, parms->m_obj, parms->m_cmdSource, FALSE); + { + std::vector coords = parms->m_coords; + privateFollowPath(&coords, parms->m_obj, parms->m_cmdSource, FALSE); break; + } case AICMD_FOLLOW_PATH_APPEND: privateFollowPathAppend(&parms->m_pos, parms->m_cmdSource); break; case AICMD_FOLLOW_EXITPRODUCTION_PATH: - privateFollowPath(&parms->m_coords, parms->m_obj, parms->m_cmdSource, TRUE); + { + std::vector coords = parms->m_coords; + privateFollowPath(&coords, parms->m_obj, parms->m_cmdSource, TRUE); break; + } case AICMD_ATTACK_OBJECT: privateAttackObject(parms->m_obj, parms->m_intValue, parms->m_cmdSource); break; @@ -3377,7 +3383,7 @@ void AIUpdateInterface::privateFollowPathAppend( const Coord3D *pos, CommandSour /** * Follow the path defined by the given array of points */ -void AIUpdateInterface::privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) +void AIUpdateInterface::privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) { if (getObject()->isMobile() == FALSE) return; @@ -3869,7 +3875,7 @@ void AIUpdateInterface::privateExitInstantly( Object *objectToExit, CommandSourc /** * Get out of whatever it is inside of */ -void AIUpdateInterface::doQuickExit( const std::vector* path ) +void AIUpdateInterface::doQuickExit( std::vector* path ) { Bool locked = getStateMachine()->isLocked(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 4e3b24a426c..dc2a4162b7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2399,7 +2399,7 @@ Bool JetAIUpdate::getTreatAsAircraftForLocoDistToGoal() const /** * Follow the path defined by the given array of points */ -void JetAIUpdate::privateFollowPath( const std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) +void JetAIUpdate::privateFollowPath( std::vector* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) { if (exitProduction) { From 8cbcd7874ac52986e326399888626098abedd778 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 4 Jan 2026 11:01:45 +0100 Subject: [PATCH 025/211] tweak(drawable): Decouple stealth detected opacity fade time step from render update (#2047) --- .../GameEngine/Source/GameClient/Drawable.cpp | 22 ++++++++++---- .../GameEngine/Source/GameClient/Drawable.cpp | 30 +++++++++++++------ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index b7284e0c45e..4d322225af4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -2163,15 +2163,25 @@ void Drawable::setStealthLook(StealthLookType look) //------------------------------------------------------------------------------------------------- void Drawable::draw() { - if ( getObject() && getObject()->isEffectivelyDead() ) - m_heatVisionOpacity = 0.0f;//dead folks don't stealth anyway - else if ( m_heatVisionOpacity > VERY_TRANSPARENT_HEATVISION )// keep fading any heatvision unless something has set it to zero - m_heatVisionOpacity *= HEATVISION_FADE_SCALAR; - else + { + //dead folks don't stealth anyway m_heatVisionOpacity = 0.0f; + } + else if ( m_heatVisionOpacity > VERY_TRANSPARENT_HEATVISION ) + { + // keep fading any added material unless something has set it to zero + // TheSuperHackers @tweak The stealth opacity fade time step is now decoupled from the render update. + static_assert(HEATVISION_FADE_SCALAR > 0.0f && HEATVISION_FADE_SCALAR < 1.0f, "HEATVISION_FADE_SCALAR must be between 0 and 1"); - + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); + const Real fadeScalar = 1.0f - (1.0f - HEATVISION_FADE_SCALAR) * timeScale; + m_heatVisionOpacity *= fadeScalar; + } + else + { + m_heatVisionOpacity = 0.0f; + } if (m_hidden || m_hiddenByStealth || getFullyObscuredByShroud()) return; // my, that was easy diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index f5dd995db0f..5071dcfa290 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -2607,16 +2607,28 @@ void Drawable::setStealthLook(StealthLookType look) //------------------------------------------------------------------------------------------------- void Drawable::draw() { - if ( testTintStatus( TINT_STATUS_FRENZY ) == FALSE ) - { - if ( getObject() && getObject()->isEffectivelyDead() ) - m_secondMaterialPassOpacity = 0.0f;//dead folks don't stealth anyway - else if ( m_secondMaterialPassOpacity > VERY_TRANSPARENT_MATERIAL_PASS_OPACITY )// keep fading any add'l material unless something has set it to zero - m_secondMaterialPassOpacity *= MATERIAL_PASS_OPACITY_FADE_SCALAR; - else - m_secondMaterialPassOpacity = 0.0f; - } + if ( testTintStatus( TINT_STATUS_FRENZY ) == FALSE ) + { + if ( getObject() && getObject()->isEffectivelyDead() ) + { + //dead folks don't stealth anyway + m_secondMaterialPassOpacity = 0.0f; + } + else if ( m_secondMaterialPassOpacity > VERY_TRANSPARENT_MATERIAL_PASS_OPACITY ) + { + // keep fading any added material unless something has set it to zero + // TheSuperHackers @tweak The stealth opacity fade time step is now decoupled from the render update. + static_assert(MATERIAL_PASS_OPACITY_FADE_SCALAR > 0.0f && MATERIAL_PASS_OPACITY_FADE_SCALAR < 1.0f, "MATERIAL_PASS_OPACITY_FADE_SCALAR must be between 0 and 1"); + const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); + const Real fadeScalar = 1.0f - (1.0f - MATERIAL_PASS_OPACITY_FADE_SCALAR) * timeScale; + m_secondMaterialPassOpacity *= fadeScalar; + } + else + { + m_secondMaterialPassOpacity = 0.0f; + } + } if (m_hidden || m_hiddenByStealth || getFullyObscuredByShroud()) return; // my, that was easy From 20adf33d4594bdd18e4d776a83f9d0e68cd81119 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 4 Jan 2026 21:33:21 +1100 Subject: [PATCH 026/211] bugfix(audio): UI audio no longer plays at maximum volume for a single frame when navigating between shell map menus (#2019) --- .../Source/MilesAudioDevice/MilesAudioManager.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index 5a47735ca77..53b4480aefc 100644 --- a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -2107,9 +2107,8 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n if (playing && playing->m_audioEventRTS->getEventName() == eventName) { // Adjust it playing->m_audioEventRTS->setVolume(newVolume); - Real desiredVolume = playing->m_audioEventRTS->getVolume() * playing->m_audioEventRTS->getVolumeShift(); AIL_sample_volume_pan(playing->m_sample, NULL, &pan); - AIL_set_sample_volume_pan(playing->m_sample, desiredVolume, pan); + AIL_set_sample_volume_pan(playing->m_sample, getEffectiveVolume(playing->m_audioEventRTS), pan); } } @@ -2118,8 +2117,7 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n if (playing && playing->m_audioEventRTS->getEventName() == eventName) { // Adjust it playing->m_audioEventRTS->setVolume(newVolume); - Real desiredVolume = playing->m_audioEventRTS->getVolume() * playing->m_audioEventRTS->getVolumeShift(); - AIL_set_3D_sample_volume(playing->m_3DSample, desiredVolume); + AIL_set_3D_sample_volume(playing->m_3DSample, getEffectiveVolume(playing->m_audioEventRTS)); } } @@ -2128,9 +2126,8 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n if (playing && playing->m_audioEventRTS->getEventName() == eventName) { // Adjust it playing->m_audioEventRTS->setVolume(newVolume); - Real desiredVolume = playing->m_audioEventRTS->getVolume() * playing->m_audioEventRTS->getVolumeShift(); AIL_stream_volume_pan(playing->m_stream, NULL, &pan); - AIL_set_stream_volume_pan(playing->m_stream, desiredVolume, pan); + AIL_set_stream_volume_pan(playing->m_stream, getEffectiveVolume(playing->m_audioEventRTS), pan); } } } From 3eea7151eef2380b1d5f7dd96fe2231885d3d4bd Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 4 Jan 2026 21:49:14 +1100 Subject: [PATCH 027/211] bugfix(object): Do not apply veterancy bonuses and animations for dead units (#1968) --- .../GameEngine/Include/GameLogic/Object.h | 1 + .../Source/GameLogic/Object/Object.cpp | 20 +++++++++++++++++-- .../GameEngine/Include/GameLogic/Object.h | 1 + .../Source/GameLogic/Object/Object.cpp | 20 +++++++++++++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 9f0f0869b30..48dd7545208 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -213,6 +213,7 @@ class Object : public Thing, public Snapshot void scoreTheKill( const Object *victim ); ///< I just killed this object. void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< I just achieved this level right this moment + void createVeterancyLevelFX(VeterancyLevel oldLevel, VeterancyLevel newLevel); ExperienceTracker* getExperienceTracker() {return m_experienceTracker;} const ExperienceTracker* getExperienceTracker() const {return m_experienceTracker;} VeterancyLevel getVeterancyLevel() const; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 7634db8058f..c426213d170 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2802,6 +2802,12 @@ Bool Object::hasSpecialPower( SpecialPowerType type ) const //------------------------------------------------------------------------------------------------- void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) { +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 10/12/2025 Do not apply veterancy bonuses and animations for dead units. + if (isEffectivelyDead()) + return; +#endif + updateUpgradeModules(); const UpgradeTemplate* up = TheUpgradeCenter->findVeterancyUpgrade(newLevel); @@ -2853,7 +2859,18 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne && !isKindOf(KINDOF_IGNORED_IN_GUI) && isLogicallyVisible(); - if( doAnimation && TheGameLogic->getDrawIconUI() ) + if (doAnimation) + createVeterancyLevelFX(oldLevel, newLevel); +} + +void Object::createVeterancyLevelFX(VeterancyLevel oldLevel, VeterancyLevel newLevel) +{ +#if RETAIL_COMPATIBLE_CRC + if (isEffectivelyDead()) + return; +#endif + + if (TheGameLogic->getDrawIconUI()) { if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE ) { @@ -2873,7 +2890,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne soundToPlay.setObjectID( getID() ); TheAudio->addAudioEvent( &soundToPlay ); } - } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 9c601848f69..01d2d26af76 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -229,6 +229,7 @@ class Object : public Thing, public Snapshot void scoreTheKill( const Object *victim ); ///< I just killed this object. void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = TRUE ); ///< I just achieved this level right this moment + void createVeterancyLevelFX(VeterancyLevel oldLevel, VeterancyLevel newLevel); ExperienceTracker* getExperienceTracker() {return m_experienceTracker;} const ExperienceTracker* getExperienceTracker() const {return m_experienceTracker;} VeterancyLevel getVeterancyLevel() const; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 7052147358b..7505e85e372 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3118,6 +3118,12 @@ Bool Object::hasAnySpecialPower() const //------------------------------------------------------------------------------------------------- void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback ) { +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 10/12/2025 Do not apply veterancy bonuses and animations for dead units. + if (isEffectivelyDead()) + return; +#endif + updateUpgradeModules(); const UpgradeTemplate* up = TheUpgradeCenter->findVeterancyUpgrade(newLevel); @@ -3169,7 +3175,18 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne && !isKindOf(KINDOF_IGNORED_IN_GUI) && isLogicallyVisible(); - if( doAnimation && TheGameLogic->getDrawIconUI() ) + if (doAnimation) + createVeterancyLevelFX(oldLevel, newLevel); +} + +void Object::createVeterancyLevelFX(VeterancyLevel oldLevel, VeterancyLevel newLevel) +{ +#if RETAIL_COMPATIBLE_CRC + if (isEffectivelyDead()) + return; +#endif + + if (TheGameLogic->getDrawIconUI()) { if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE ) { @@ -3189,7 +3206,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne soundToPlay.setObjectID( getID() ); TheAudio->addAudioEvent( &soundToPlay ); } - } //------------------------------------------------------------------------------------------------- From f6d7d1970f86a901ab9ba9c07658e3bc97d0049f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 6 Jan 2026 18:13:07 +0100 Subject: [PATCH 028/211] fix(xfer): Fix xfer retail compatibility code (#2024) --- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 4 +- .../Module/ParticleUplinkCannonUpdate.h | 2 + .../GameEngine/Source/Common/RTS/Money.cpp | 5 ++- .../GameEngine/Source/GameClient/Drawable.cpp | 4 +- .../Object/Behavior/PoisonedBehavior.cpp | 7 ++-- .../Object/Update/FlammableUpdate.cpp | 6 +-- .../Update/ParticleUplinkCannonUpdate.cpp | 40 ++++++++++-------- .../Module/ParticleUplinkCannonUpdate.h | 2 + .../GameEngine/Source/Common/RTS/Money.cpp | 5 ++- .../GameEngine/Source/GameClient/Drawable.cpp | 4 +- .../Object/Behavior/PoisonedBehavior.cpp | 7 ++-- .../Object/Update/FlammableUpdate.cpp | 6 +-- .../Update/ParticleUplinkCannonUpdate.cpp | 41 +++++++++++-------- 13 files changed, 80 insertions(+), 53 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 1b5ba203361..26fafc2cbe0 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -1924,7 +1924,9 @@ void W3DTreeBuffer::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Serialize sink frames as float instead of integer + */ // ------------------------------------------------------------------------------------------------ void W3DTreeBuffer::xfer( Xfer *xfer ) { diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h index f313a06f55c..9101cd2a58a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h @@ -228,6 +228,8 @@ class ParticleUplinkCannonUpdate : public UpdateModule, public SpecialPowerUpdat UnsignedInt m_lastDrivingClickFrame; UnsignedInt m_2ndLastDrivingClickFrame; + XferVersion m_xferVersion; + Bool m_upBonesCached; Bool m_defaultInfoCached; Bool m_invalidSettings; diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp index 00237714f5e..ee9932cb9cd 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -152,7 +152,8 @@ void Money::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Add saveload support for the cash per minute income tracking */ + * 2: TheSuperHackers @tweak Serialize income tracking + */ // ------------------------------------------------------------------------------------------------ void Money::xfer( Xfer *xfer ) { @@ -196,7 +197,7 @@ void Money::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void Money::parseMoneyAmount( INI *ini, void *instance, void *store, const void* userData ) { - // Someday, maybe, have mulitple fields like Gold:10000 Wood:1000 Tiberian:10 + // Someday, maybe, have multiple fields like Gold:10000 Wood:1000 Tiberian:10 Money * money = (Money *)store; UnsignedInt moneyAmount; INI::parseUnsignedInt( ini, instance, &moneyAmount, userData ); diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 4d322225af4..dcb9fc153f7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4880,7 +4880,9 @@ void TintEnvelope::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer Method * Version Info; - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Serialize sustain counter as float instead of integer + */ // ------------------------------------------------------------------------------------------------ void TintEnvelope::xfer( Xfer *xfer ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index d9c446f248b..931c5d80784 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -208,7 +208,10 @@ void PoisonedBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Serialize death type + * 3: TheSuperHackers @tweak Serialize poison source + */ // ------------------------------------------------------------------------------------------------ void PoisonedBehavior::xfer( Xfer *xfer ) { @@ -239,12 +242,10 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } -#if !RETAIL_COMPATIBLE_XFER_SAVE if (version >= 3) { xfer->xferObjectID(&m_poisonSource); } -#endif } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index e8e8f750e72..acbdde07dfd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -285,7 +285,9 @@ void FlammableUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2. TheSuperHackers @tweak Serialize flame source + */ // ------------------------------------------------------------------------------------------------ void FlammableUpdate::xfer( Xfer *xfer ) { @@ -320,12 +322,10 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); -#if !RETAIL_COMPATIBLE_XFER_SAVE if (version >= 2) { xfer->xferObjectID(&m_flameSource); } -#endif } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index ad7614d1f13..70860c672b7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -173,6 +173,7 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu m_defaultInfoCached = false; m_invalidSettings = false; m_manualTargetMode = false; + m_xferVersion = 1; m_initialTargetPosition.zero(); m_currentTargetPosition.zero(); m_overrideTargetDestination.zero(); @@ -1308,7 +1309,10 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Serialize decay frames + * 4: TheSuperHackers @tweak Serialize orbit to target laser radius + */ // ------------------------------------------------------------------------------------------------ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) { @@ -1322,6 +1326,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) #endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); + m_xferVersion = version; // extend base class UpdateModule::xfer( xfer ); @@ -1436,27 +1441,28 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -#if RETAIL_COMPATIBLE_XFER_SAVE - // TheSuperHackers @info xezon 17/05/2025 - // For retail game compatibility, this transfers the loaded visual laser radius - // settings from the Drawable's LaserUpdate to the local LaserRadiusUpdate. - if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) + if (m_xferVersion <= 3) { - Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); - if( drawable != NULL ) + // TheSuperHackers @info xezon 17/05/2025 + // For retail game compatibility, this transfers the loaded visual laser radius + // settings from the Drawable's LaserUpdate to the local LaserRadiusUpdate. + if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) { - static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); - LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); - if( update != NULL ) + Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); + if( drawable != NULL ) { - m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); + static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); + LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); + if( update != NULL ) + { + m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); + } + } + else + { + DEBUG_CRASH(( "ParticleUplinkCannonUpdate::loadPostProcess - Unable to find drawable for m_orbitToTargetBeamID" )); } - } - else - { - DEBUG_CRASH(( "ParticleUplinkCannonUpdate::loadPostProcess - Unable to find drawable for m_orbitToTargetBeamID" )); } } -#endif } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h index 015813b9a7a..a022329ba16 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h @@ -231,6 +231,8 @@ class ParticleUplinkCannonUpdate : public SpecialPowerUpdateModule UnsignedInt m_2ndLastDrivingClickFrame; UnsignedInt m_nextDestWaypointID; + XferVersion m_xferVersion; + Bool m_upBonesCached; Bool m_defaultInfoCached; Bool m_invalidSettings; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp index ed1a177ad38..7821340747d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -161,7 +161,8 @@ void Money::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Add saveload support for the cash per minute income tracking */ + * 2: TheSuperHackers @tweak Serialize income tracking + */ // ------------------------------------------------------------------------------------------------ void Money::xfer( Xfer *xfer ) { @@ -205,7 +206,7 @@ void Money::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void Money::parseMoneyAmount( INI *ini, void *instance, void *store, const void* userData ) { - // Someday, maybe, have mulitple fields like Gold:10000 Wood:1000 Tiberian:10 + // Someday, maybe, have multiple fields like Gold:10000 Wood:1000 Tiberian:10 Money * money = (Money *)store; UnsignedInt moneyAmount; INI::parseUnsignedInt( ini, instance, &moneyAmount, userData ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 5071dcfa290..c8f9b0f56ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -5639,7 +5639,9 @@ void TintEnvelope::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer Method * Version Info; - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Serialize sustain counter as float instead of integer + */ // ------------------------------------------------------------------------------------------------ void TintEnvelope::xfer( Xfer *xfer ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 3c32fe58a78..d7887ce1899 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -209,7 +209,10 @@ void PoisonedBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Serialize death type + * 3: TheSuperHackers @tweak Serialize poison source + */ // ------------------------------------------------------------------------------------------------ void PoisonedBehavior::xfer( Xfer *xfer ) { @@ -240,12 +243,10 @@ void PoisonedBehavior::xfer( Xfer *xfer ) xfer->xferUser(&m_deathType, sizeof(m_deathType)); } -#if !RETAIL_COMPATIBLE_XFER_SAVE if (version >= 3) { xfer->xferObjectID(&m_poisonSource); } -#endif } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index a665abaaa47..98b046391f2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -285,7 +285,9 @@ void FlammableUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2. TheSuperHackers @tweak Serialize flame source + */ // ------------------------------------------------------------------------------------------------ void FlammableUpdate::xfer( Xfer *xfer ) { @@ -320,12 +322,10 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); -#if !RETAIL_COMPATIBLE_XFER_SAVE if (version >= 2) { xfer->xferObjectID(&m_flameSource); } -#endif } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index d2d1d07928e..bb41f47e125 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -174,6 +174,7 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu m_manualTargetMode = FALSE; m_scriptedWaypointMode = FALSE; m_nextDestWaypointID = 0; + m_xferVersion = 1; m_initialTargetPosition.zero(); m_currentTargetPosition.zero(); m_overrideTargetDestination.zero(); @@ -1392,7 +1393,11 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Serialize decay frames + * 3: Serialize scripted waypoints (Added for Zero Hour) + * 4: TheSuperHackers @tweak Serialize orbit to target laser radius + */ // ------------------------------------------------------------------------------------------------ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) { @@ -1406,6 +1411,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer ) #endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); + m_xferVersion = version; // extend base class UpdateModule::xfer( xfer ); @@ -1527,27 +1533,28 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); -#if RETAIL_COMPATIBLE_XFER_SAVE - // TheSuperHackers @info xezon 17/05/2025 - // For retail game compatibility, this transfers the loaded visual laser radius - // settings from the Drawable's LaserUpdate to the local LaserRadiusUpdate. - if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) + if (m_xferVersion <= 3) { - Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); - if( drawable != NULL ) + // TheSuperHackers @info xezon 17/05/2025 + // For retail game compatibility, this transfers the loaded visual laser radius + // settings from the Drawable's LaserUpdate to the local LaserRadiusUpdate. + if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) { - static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); - LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); - if( update != NULL ) + Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); + if( drawable != NULL ) { - m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); + static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); + LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); + if( update != NULL ) + { + m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); + } + } + else + { + DEBUG_CRASH(( "ParticleUplinkCannonUpdate::loadPostProcess - Unable to find drawable for m_orbitToTargetBeamID" )); } - } - else - { - DEBUG_CRASH(( "ParticleUplinkCannonUpdate::loadPostProcess - Unable to find drawable for m_orbitToTargetBeamID" )); } } -#endif } From 0b4fd85eb9ee1e5254ca5eb7a492e4e32e74d5e6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 6 Jan 2026 18:14:46 +0100 Subject: [PATCH 029/211] refactor(audio): Use MilesAudioManager::getEffectiveVolume consistently (#2058) --- .../MilesAudioDevice/MilesAudioManager.h | 4 +-- .../MilesAudioDevice/MilesAudioManager.cpp | 29 ++++++------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h b/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h index 314a8b8770c..300f1147d35 100644 --- a/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h +++ b/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h @@ -273,8 +273,8 @@ class MilesAudioManager : public AudioManager void stopAllSpeech( void ); protected: - void initFilters( HSAMPLE sample, const AudioEventRTS *eventInfo ); - void initFilters3D( H3DSAMPLE sample, const AudioEventRTS *eventInfo, const Coord3D *pos ); + void initFilters( HSAMPLE sample, AudioEventRTS *eventInfo ); + void initFilters3D( H3DSAMPLE sample, AudioEventRTS *eventInfo, const Coord3D *pos ); protected: ProviderInfo m_provider3D[MAXPROVIDERS]; diff --git a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index 53b4480aefc..5945d38bcfa 100644 --- a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -684,14 +684,6 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) stopAllSpeech(); } - Real curVolume = 1.0; - if (info->m_soundType == AT_Music) { - curVolume = m_musicVolume; - } else { - curVolume = m_speechVolume; - } - curVolume *= event->getVolume(); - Bool foundSoundToReplace = false; if (handleToKill) { for (it = m_playingStreams.begin(); it != m_playingStreams.end(); ++it) { @@ -727,7 +719,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) if ((info->m_soundType == AT_Streaming) && event->getUninterruptable()) { setDisallowSpeech(TRUE); } - AIL_set_stream_volume_pan(stream, curVolume, 0.5f); + AIL_set_stream_volume_pan(stream, getEffectiveVolume(event), 0.5f); playStream(event, stream); m_playingStreams.push_back(audio); audio = NULL; @@ -1238,22 +1230,21 @@ H3DSAMPLE MilesAudioManager::getFirst3DSample( AudioEventRTS *event ) //------------------------------------------------------------------------------------------------- void MilesAudioManager::adjustPlayingVolume( PlayingAudio *audio ) { - Real desiredVolume = audio->m_audioEventRTS->getVolume() * audio->m_audioEventRTS->getVolumeShift(); Real pan; if (audio->m_type == PAT_Sample) { AIL_sample_volume_pan(audio->m_sample, NULL, &pan); - AIL_set_sample_volume_pan(audio->m_sample, m_soundVolume * desiredVolume, pan); + AIL_set_sample_volume_pan(audio->m_sample, getEffectiveVolume(audio->m_audioEventRTS), pan); } else if (audio->m_type == PAT_3DSample) { - AIL_set_3D_sample_volume(audio->m_3DSample, m_sound3DVolume * desiredVolume); + AIL_set_3D_sample_volume(audio->m_3DSample, getEffectiveVolume(audio->m_audioEventRTS)); } else if (audio->m_type == PAT_Stream) { AIL_stream_volume_pan(audio->m_stream, NULL, &pan); if (audio->m_audioEventRTS->getAudioEventInfo()->m_soundType == AT_Music ) { - AIL_set_stream_volume_pan(audio->m_stream, m_musicVolume * desiredVolume, pan); + AIL_set_stream_volume_pan(audio->m_stream, getEffectiveVolume(audio->m_audioEventRTS), pan); } else { - AIL_set_stream_volume_pan(audio->m_stream, m_speechVolume * desiredVolume, pan); + AIL_set_stream_volume_pan(audio->m_stream, getEffectiveVolume(audio->m_audioEventRTS), pan); } } @@ -1281,11 +1272,10 @@ void MilesAudioManager::stopAllSpeech( void ) } //------------------------------------------------------------------------------------------------- -void MilesAudioManager::initFilters( HSAMPLE sample, const AudioEventRTS *event ) +void MilesAudioManager::initFilters( HSAMPLE sample, AudioEventRTS *event ) { // set the sample volume - Real volume = event->getVolume() * event->getVolumeShift() * m_soundVolume; - AIL_set_sample_volume_pan(sample, volume, 0.5f); + AIL_set_sample_volume_pan(sample, getEffectiveVolume(event), 0.5f); // pitch shift Real pitchShift = event->getPitchShift(); @@ -1309,11 +1299,10 @@ void MilesAudioManager::initFilters( HSAMPLE sample, const AudioEventRTS *event } //------------------------------------------------------------------------------------------------- -void MilesAudioManager::initFilters3D( H3DSAMPLE sample, const AudioEventRTS *event, const Coord3D *pos ) +void MilesAudioManager::initFilters3D( H3DSAMPLE sample, AudioEventRTS *event, const Coord3D *pos ) { // set the sample volume - Real volume = event->getVolume() * event->getVolumeShift() * m_sound3DVolume; - AIL_set_3D_sample_volume(sample, volume); + AIL_set_3D_sample_volume(sample, getEffectiveVolume(event)); // pitch shift Real pitchShift = event->getPitchShift(); From b981e3128a0c3cef7061a8c192fa36501de51f74 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 6 Jan 2026 18:48:08 +0100 Subject: [PATCH 030/211] bugfix(worldbuilder): Initialize boolean in ScriptConditionsDlg::OnEditCondition to show logical condition (#2062) --- Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp | 2 +- GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index ab2d3abed18..dfee82c0275 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -130,7 +130,7 @@ void ScriptConditionsDlg::OnEditCondition() ScriptDialog::updateScriptWarning(m_script); pList->DeleteString(m_index); AsciiString label; - Bool first; + Bool first = false; if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { first = true; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index 95888335164..69914d25213 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -130,7 +130,7 @@ void ScriptConditionsDlg::OnEditCondition() ScriptDialog::updateScriptWarning(m_script); pList->DeleteString(m_index); AsciiString label; - Bool first; + Bool first = false; if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { first = true; } From dd50dba9f87c5c3687faa1d19d15b1905078bb13 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Wed, 7 Jan 2026 00:17:20 +0100 Subject: [PATCH 031/211] bugfix(worldbuilder): Avoid taking action on cancel button for script conditions and actions (#2065) --- .../WorldBuilder/src/ScriptActionsFalse.cpp | 12 ++++++---- .../WorldBuilder/src/ScriptActionsTrue.cpp | 12 ++++++---- .../WorldBuilder/src/ScriptConditions.cpp | 24 ++++++++++--------- .../WorldBuilder/src/ScriptActionsFalse.cpp | 12 ++++++---- .../WorldBuilder/src/ScriptActionsTrue.cpp | 12 ++++++---- .../WorldBuilder/src/ScriptConditions.cpp | 24 ++++++++++--------- 6 files changed, 54 insertions(+), 42 deletions(-) diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp index 8c226f8bf58..336773df565 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp @@ -116,11 +116,13 @@ void ScriptActionsFalse::OnEditAction() } EditAction cDlg; cDlg.setAction(m_falseAction); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - pList->InsertString(m_index, m_falseAction->getUiText().str()); - pList->SetCurSel(m_index); + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + pList->InsertString(m_index, m_falseAction->getUiText().str()); + pList->SetCurSel(m_index); + } } void ScriptActionsFalse::enableUI() diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp index 7513d0f669d..b81e71d3c3f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp @@ -116,11 +116,13 @@ void ScriptActionsTrue::OnEditAction() } EditAction cDlg; cDlg.setAction(m_action); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - pList->InsertString(m_index, m_action->getUiText().str()); - pList->SetCurSel(m_index); + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + pList->InsertString(m_index, m_action->getUiText().str()); + pList->SetCurSel(m_index); + } } void ScriptActionsTrue::enableUI() diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index dfee82c0275..639fb1aac32 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -126,18 +126,20 @@ void ScriptConditionsDlg::OnEditCondition() } EditCondition cDlg; cDlg.setCondition(m_condition); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - AsciiString label; - Bool first = false; - if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { - first = true; + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + AsciiString label; + Bool first = false; + if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { + first = true; + } + if (first) label = " "; + else label = " AND "; + label.concat(m_condition->getUiText()); + pList->InsertString(m_index, label.str()); } - if (first) label = " "; - else label = " AND "; - label.concat(m_condition->getUiText()); - pList->InsertString(m_index, label.str()); } void ScriptConditionsDlg::enableUI() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp index f57862fcbfc..e0189ef2c72 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp @@ -116,11 +116,13 @@ void ScriptActionsFalse::OnEditAction() } EditAction cDlg; cDlg.setAction(m_falseAction); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - pList->InsertString(m_index, m_falseAction->getUiText().str()); - pList->SetCurSel(m_index); + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + pList->InsertString(m_index, m_falseAction->getUiText().str()); + pList->SetCurSel(m_index); + } } void ScriptActionsFalse::enableUI() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp index 250f6d5815a..bef32638438 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp @@ -116,11 +116,13 @@ void ScriptActionsTrue::OnEditAction() } EditAction cDlg; cDlg.setAction(m_action); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - pList->InsertString(m_index, m_action->getUiText().str()); - pList->SetCurSel(m_index); + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + pList->InsertString(m_index, m_action->getUiText().str()); + pList->SetCurSel(m_index); + } } void ScriptActionsTrue::enableUI() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index 69914d25213..43259ab28fe 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -126,18 +126,20 @@ void ScriptConditionsDlg::OnEditCondition() } EditCondition cDlg; cDlg.setCondition(m_condition); - cDlg.DoModal(); - ScriptDialog::updateScriptWarning(m_script); - pList->DeleteString(m_index); - AsciiString label; - Bool first = false; - if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { - first = true; + if (cDlg.DoModal() == IDOK) + { + ScriptDialog::updateScriptWarning(m_script); + pList->DeleteString(m_index); + AsciiString label; + Bool first = false; + if (m_orCondition && m_orCondition->getFirstAndCondition() == m_condition) { + first = true; + } + if (first) label = " "; + else label = " AND "; + label.concat(m_condition->getUiText()); + pList->InsertString(m_index, label.str()); } - if (first) label = " "; - else label = " AND "; - label.concat(m_condition->getUiText()); - pList->InsertString(m_index, label.str()); } void ScriptConditionsDlg::enableUI() From 3e8c472e0161b3b0de06f0f10c0f74b3afb994ba Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 7 Jan 2026 12:21:34 -0800 Subject: [PATCH 032/211] bugfix(network): Fix packet size setup mistakes (#2040) --- .../Include/GameNetwork/NetPacketStructs.h | 14 +++++--------- Core/GameEngine/Source/GameNetwork/NetPacket.cpp | 12 +++++++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h b/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h index 35f5ce997a6..ef02ea83ed7 100644 --- a/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h +++ b/Core/GameEngine/Include/GameNetwork/NetPacketStructs.h @@ -137,8 +137,6 @@ struct NetPacketPlayerLeaveCommand { // Run ahead metrics command packet structure // Fields: T + type, R + relay, P + playerID, C + commandID, D + averageLatency + averageFps -// TODO: averageFps should be UnsignedShort to match FillBufferWithRunAheadMetricsCommand, but -// original GetRunAheadMetricsCommandSize incorrectly counted it as UnsignedByte struct NetPacketRunAheadMetricsCommand { NetPacketCommandTypeField commandType; NetPacketRelayField relay; @@ -146,7 +144,7 @@ struct NetPacketRunAheadMetricsCommand { NetPacketCommandIdField commandId; NetPacketDataFieldHeader dataHeader; Real averageLatency; - UnsignedByte averageFps; + UnsignedShort averageFps; }; //////////////////////////////////////////////////////////////////////////////// @@ -362,24 +360,22 @@ struct NetPacketProgressMessage { }; // Load complete message packet -// Fields: T + type, R + relay, P + playerID, D -// TODO: commandId field is missing. FillBufferWithLoadCompleteMessage writes it, but -// original GetLoadCompleteMessageSize did not count it +// Fields: T + type, R + relay, P + playerID, C + commandID, D struct NetPacketLoadCompleteMessage { NetPacketCommandTypeField commandType; NetPacketRelayField relay; NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; NetPacketDataFieldHeader dataHeader; }; // Timeout game start message packet -// Fields: T + type, R + relay, P + playerID, D -// TODO: commandId field is missing. FillBufferWithTimeOutGameStartMessage writes it, but -// original GetTimeOutGameStartMessageSize did not count it +// Fields: T + type, R + relay, P + playerID, C + commandID, D struct NetPacketTimeOutGameStartMessage { NetPacketCommandTypeField commandType; NetPacketRelayField relay; NetPacketPlayerIdField playerId; + NetPacketCommandIdField commandId; NetPacketDataFieldHeader dataHeader; }; diff --git a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp index 92ec1928595..51cf3bf1e74 100644 --- a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -2392,7 +2392,7 @@ Bool NetPacket::isRoomForWrapperMessage(NetCommandRef *msg) { */ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { Bool needNewCommandID = FALSE; - if (isRoomForLoadCompleteMessage(msg)) { + if (isRoomForTimeOutGameStartMessage(msg)) { NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); // If necessary, put the NetCommandType into the packet. @@ -2457,6 +2457,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) { */ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { Int len = 0; + Bool needNewCommandID = FALSE; NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; @@ -2468,6 +2469,10 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) { if (m_lastPlayerID != cmdMsg->getPlayerID()) { ++len; len += sizeof(UnsignedByte); + needNewCommandID = TRUE; + } + if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { + len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } ++len; // for NetPacketFieldTypes::Data @@ -2549,6 +2554,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) { */ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { Int len = 0; + Bool needNewCommandID = FALSE; NetCommandMsg *cmdMsg = static_cast(msg->getCommand()); if (m_lastCommandType != cmdMsg->getNetCommandType()) { ++len; @@ -2560,6 +2566,10 @@ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) { if (m_lastPlayerID != cmdMsg->getPlayerID()) { ++len; len += sizeof(UnsignedByte); + needNewCommandID = TRUE; + } + if (((m_lastCommandID + 1) != (UnsignedShort)(cmdMsg->getID())) || (needNewCommandID == TRUE)) { + len += sizeof(UnsignedByte) + sizeof(UnsignedShort); } ++len; // for NetPacketFieldTypes::Data From 8112dede3047ae2e8330bebf0a306e9fdaf4a64c Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 7 Jan 2026 21:23:50 +0100 Subject: [PATCH 033/211] refactor(heightmap): Remove HALF_RES_MESH because it was never used and is broken (#2076) --- .../W3DDevice/GameClient/WorldHeightMap.h | 8 +- .../W3DDevice/GameClient/BaseHeightMap.cpp | 4 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 87 +++---------------- .../W3DDevice/GameClient/WorldHeightMap.cpp | 77 +++++++--------- .../GameClient/Shadow/W3DProjectedShadow.cpp | 2 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 2 +- .../W3DDevice/GameClient/W3DCustomEdging.cpp | 2 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 2 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 2 +- .../W3DDevice/GameClient/W3DCustomEdging.cpp | 2 +- 10 files changed, 57 insertions(+), 131 deletions(-) diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h index 932edf2a7a5..281bff97a48 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h @@ -188,8 +188,8 @@ class WorldHeightMap : public RefCountClass, TileData *getSourceTile(UnsignedInt ndx) { if (ndxgetAlphaUVData(xNdx, yNdx, UA, VA, alpha, &flipForBlend, false); + m_map->getAlphaUVData(xNdx, yNdx, UA, VA, alpha, &flipForBlend); #endif if (flipForBlend) { *curIb++ = startVertex + j*yOffset + i+1; @@ -2089,7 +2089,7 @@ Int BaseHeightMapRenderObjClass::getStaticDiffuse(Int x, Int y) Vector3 l2r,n2f,normalAtTexel; Int vn0,un0,vp1,up1; - const Int cellOffset = 1; + constexpr const Int cellOffset = 1; vn0 = y-cellOffset; vp1 = y+cellOffset; diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 57d0decba19..b59123cc50f 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -95,8 +95,6 @@ #define no_OPTIMIZED_HEIGHTMAP_LIGHTING 01 // Doesn't work well. jba. -const Bool HALF_RES_MESH = false; - HeightMapRenderObjClass *TheHeightMap = NULL; //----------------------------------------------------------------------------- // Private Data @@ -308,12 +306,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int Int xCoord, yCoord; Int vn0,un0,vp1,up1; Vector3 l2r,n2f,normalAtTexel; - Int vertsPerRow=(VERTEX_BUFFER_TILE_LENGTH)*4; //vertices per row of VB - - Int cellOffset = 1; - if (HALF_RES_MESH) { - cellOffset = 2; - } + constexpr const Int vertsPerRow=(VERTEX_BUFFER_TILE_LENGTH)*4; //vertices per row of VB + constexpr const Int cellOffset = 1; REF_PTR_SET(m_map, pMap); //update our heightmap pointer in case it changed since last call. if (m_vertexBufferTiles && pMap) @@ -332,14 +326,9 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int for (j=y0; jgetDrawOrgY()) vn0=-pMap->getDrawOrgY(); @@ -350,9 +339,6 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int yCoord = getYWithOrigin(j)+pMap->getDrawOrgY(); for (i=x0; igetDrawOrgX()) un0=-pMap->getDrawOrgX(); @@ -368,8 +354,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int Bool flipForBlend = false; // True if the blend needs the triangles flipped. if (pMap) { - pMap->getUVData(getXWithOrigin(i),getYWithOrigin(j),U, V, HALF_RES_MESH); - pMap->getAlphaUVData(getXWithOrigin(i),getYWithOrigin(j), UA, VA, alpha, &flipForBlend, HALF_RES_MESH); + pMap->getUVData(getXWithOrigin(i),getYWithOrigin(j),U, V); + pMap->getAlphaUVData(getXWithOrigin(i),getYWithOrigin(j), UA, VA, alpha, &flipForBlend); } @@ -569,7 +555,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d Int i,j,k; Int vn0,un0,vp1,up1; Vector3 l2r,n2f,normalAtTexel; - Int vertsPerRow=(VERTEX_BUFFER_TILE_LENGTH)*4; //vertices per row of VB + constexpr const Int vertsPerRow=(VERTEX_BUFFER_TILE_LENGTH)*4; //vertices per row of VB if (m_vertexBufferTiles && m_map) { @@ -583,9 +569,6 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d for (j=y0; jgetDrawOrgY()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; kgetDrawOrgX()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; kgetDrawOrgY()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; kgetDrawOrgX()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; kGet_Transform(); @@ -1813,10 +1766,6 @@ void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjLis newOrgX = (visMaxX+visMinX)/2-m_x/2.0; newOrgY = (visMaxY+visMinY)/2-m_y/2.0; } - if (HALF_RES_MESH) { - newOrgX &= 0xFFFFFFFE; - newOrgY &= 0xFFFFFFFE; - } Int deltaX = newOrgX - m_map->getDrawOrgX(); Int deltaY = newOrgY - m_map->getDrawOrgY(); if (IABS(deltaX) > m_x/2 || IABS(deltaY)>m_x/2) { @@ -2069,10 +2018,6 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) count++; Int numPolys = VERTEX_BUFFER_TILE_LENGTH*VERTEX_BUFFER_TILE_LENGTH*2; Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2); - if (HALF_RES_MESH) { - numPolys /= 4; - numVertex /= 4; - } DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles[j*m_numVBTilesX+i]); #ifdef PRE_TRANSFORM_VERTEX if (m_xformedVertexBuffer && pass==0) { @@ -2207,10 +2152,6 @@ void HeightMapRenderObjClass::renderTerrainPass(CameraClass *pCamera) count++; Int numPolys = VERTEX_BUFFER_TILE_LENGTH*VERTEX_BUFFER_TILE_LENGTH*2; Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2); - if (HALF_RES_MESH) { - numPolys /= 4; - numVertex /= 4; - } DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles[j*m_numVBTilesX+i]); #ifdef PRE_TRANSFORM_VERTEX if (m_xformedVertexBuffer && pass==0) { diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 18d134fb532..613226083be 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -1577,7 +1577,7 @@ Int WorldHeightMap::updateTileTexturePositions(Int *edgeHeight) /** getUVData - Gets the texture coordinates to use. See getTerrainTexture. */ -void WorldHeightMap::getUVForNdx(Int tileNdx, float *minU, float *minV, float *maxU, float*maxV, Bool fullTile) +void WorldHeightMap::getUVForNdx(Int tileNdx, float *minU, float *minV, float *maxU, float*maxV) { Short baseNdx = tileNdx>>2; if (m_sourceTiles[baseNdx] == NULL) { @@ -1606,21 +1606,20 @@ void WorldHeightMap::getUVForNdx(Int tileNdx, float *minU, float *minV, float *m *minV/=m_terrainTexHeight; *maxU/=TEXTURE_WIDTH; *maxV/=m_terrainTexHeight; - if (!fullTile) { - // Tiles are 64x64 pixels, height grids map to 32x32. - // So get the proper quadrant of the tile. - Real midX = (*minU+*maxU)/2; - Real midY = (*minV+*maxV)/2; - if (tileNdx&2) { // y's are flipped. - *maxV = midY; - } else { - *minV = midY; - } - if (tileNdx&1) { - *minU = midX; - } else { - *maxU = midX; - } + + // Tiles are 64x64 pixels, height grids map to 32x32. + // So get the proper quadrant of the tile. + Real midX = (*minU+*maxU)/2; + Real midY = (*minV+*maxV)/2; + if (tileNdx&2) { // y's are flipped. + *maxV = midY; + } else { + *minV = midY; + } + if (tileNdx&1) { + *minU = midX; + } else { + *maxU = midX; } } @@ -1646,12 +1645,10 @@ Bool WorldHeightMap::isCliffMappedTexture(Int x, Int y) { }; /** getUVData - Gets the texture coordinates to use. See getTerrainTexture. - xIndex and yIndex are the integer coorddinates into the height map. - U and V are the texture coordiantes for the 4 corners of a height map cell. - fullTile is true if we are doing 1/2 resolution height map, and require a full - tile to texture a cell. Otherwise, we use quarter tiles per cell. + xIndex and yIndex are the integer coordinates into the height map. + U and V are the texture coordinates for the 4 corners of a height map cell. */ -Bool WorldHeightMap::getUVData(Int xIndex, Int yIndex, float U[4], float V[4], Bool fullTile) +Bool WorldHeightMap::getUVData(Int xIndex, Int yIndex, float U[4], float V[4]) { #define dont_SHOW_THE_TEXTURE_FOR_DEBUG 1 #if SHOW_THE_TEXTURE_FOR_DEBUG @@ -1678,7 +1675,7 @@ Bool WorldHeightMap::getUVData(Int xIndex, Int yIndex, float U[4], float V[4], B Int ndx = (yIndex*m_width)+xIndex; if ((ndxm_adjustCliffTextures) { @@ -1709,9 +1704,6 @@ Bool WorldHeightMap::getUVForTileIndex(Int ndx, Short tileNdx, float U[4], float if (nU==0.0) { return false; // missing texture. } - if (fullTile) { - return false; - } if (m_cliffInfoNdxes[ndx]) { TCliffInfo info = m_cliffInfo[m_cliffInfoNdxes[ndx]]; Bool tilesMatch = false; @@ -1763,7 +1755,7 @@ Bool WorldHeightMap::getUVForTileIndex(Int ndx, Short tileNdx, float U[4], float tilesPerRow *= 4; - getUVForNdx(tileNdx, &nU, &nV, &xU, &xV, fullTile); + getUVForNdx(tileNdx, &nU, &nV, &xU, &xV); U[0] = nU; U[1] = xU; U[2] = xU; U[3] = nU; V[0] = xV; V[1] = xV; V[2] = nV; V[3] = nV; if (TheGlobalData && !TheGlobalData->m_adjustCliffTextures) { @@ -1772,9 +1764,6 @@ Bool WorldHeightMap::getUVForTileIndex(Int ndx, Short tileNdx, float U[4], float if (nU==0.0) { return false; // missing texture. } - if (fullTile) { - return false; - } // check for excessive heights. if (ndx < this->m_dataSize - m_width - 1) { Int h0 = m_data[ndx]; @@ -1959,7 +1948,7 @@ Bool WorldHeightMap::getExtraAlphaUVData(Int xIndex, Int yIndex, float U[4], flo if (blendNdx == 0) { return FALSE; } else { - *cliff = getUVForTileIndex(ndx, m_blendedTiles[blendNdx].blendNdx, U, V, FALSE); + *cliff = getUVForTileIndex(ndx, m_blendedTiles[blendNdx].blendNdx, U, V); alpha[0] = alpha[1] = alpha[2] = alpha[3] = 0; if (m_blendedTiles[blendNdx].horiz) { // Horizontals don't need flipping unless forced because of 3way blend @@ -2026,16 +2015,13 @@ Bool WorldHeightMap::getExtraAlphaUVData(Int xIndex, Int yIndex, float U[4], flo return TRUE; } -/** getUVData - Gets the texture coordinates to use with the alpha texture. - xIndex and yIndex are the integer coorddinates into the height map. - U and V are the texture coordiantes for the 4 corners of a height map cell. - fullTile is true if we are doing 1/2 resolution height map, and require a full - tile to texture a cell. Otherwise, we use quarter tiles per cell. +/** getAlphaUVData - Gets the texture coordinates to use with the alpha texture. + xIndex and yIndex are the integer coordinates into the height map. + U and V are the texture coordinates for the 4 corners of a height map cell. flip is set if we need to flip the diagonal across the cell to make the alpha coordinates blend properly. Filling a square with 2 triangles is not symmetrical :) */ -void WorldHeightMap::getAlphaUVData(Int xIndex, Int yIndex, float U[4], float V[4], - UnsignedByte alpha[4], Bool *flip, Bool fullTile) +void WorldHeightMap::getAlphaUVData(Int xIndex, Int yIndex, float U[4], float V[4], UnsignedByte alpha[4], Bool *flip) { xIndex += m_drawOriginX; yIndex += m_drawOriginY; @@ -2045,14 +2031,13 @@ void WorldHeightMap::getAlphaUVData(Int xIndex, Int yIndex, float U[4], float V[ if ((ndx>3)] |= flipForBlend << (x & 0x7); DEBUG_ASSERTCRASH ((y*m_flipStateWidth+(x>>3)) < (m_flipStateWidth * m_height), ("Bad range")); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 49c3c00e9b5..7bf679d6c6c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -444,7 +444,7 @@ Int W3DProjectedShadowManager::renderProjectedTerrainShadow(W3DProjectedShadow * { for (i=rowStart,k=startX; kgetAlphaUVData(k, j, UA, VA, alpha, &flipForBlend, false); + hmap->getAlphaUVData(k, j, UA, VA, alpha, &flipForBlend); /* if (flipForBlend) { pvIndices[0]=i; pvIndices[1]=i+1; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 94caea0b449..592b75725ff 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -386,7 +386,7 @@ int W3DShadowGeometryHeightmapMesh::GetPolygonIndex (long dwPolyId, short *psInd UnsignedByte alpha[4]; float UA[4], VA[4]; Bool flipForBlend; - map->getAlphaUVData(column+m_patchOriginX, row+m_patchOriginY, UA, VA, alpha, &flipForBlend, false); + map->getAlphaUVData(column+m_patchOriginX, row+m_patchOriginY, UA, VA, alpha, &flipForBlend); if (flipForBlend) { if (dwPolyId &1) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp index 7c06301c917..2b07be5a2f1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp @@ -206,7 +206,7 @@ void W3DCustomEdging::loadEdgingsInVertexAndIndexBuffers(WorldHeightMap *pMap, I UnsignedByte alpha[4]; float UA[4], VA[4]; Bool flipForBlend; - pMap->getAlphaUVData(column-pMap->getDrawOrgX(), row-pMap->getDrawOrgY(), UA, VA, alpha, &flipForBlend, false); + pMap->getAlphaUVData(column-pMap->getDrawOrgX(), row-pMap->getDrawOrgY(), UA, VA, alpha, &flipForBlend); Int startVertex = m_curNumEdgingVertices; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 350082ebac2..54d75aa2c09 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -444,7 +444,7 @@ Int W3DProjectedShadowManager::renderProjectedTerrainShadow(W3DProjectedShadow * { for (i=rowStart,k=startX; kgetAlphaUVData(k, j, UA, VA, alpha, &flipForBlend, false); + hmap->getAlphaUVData(k, j, UA, VA, alpha, &flipForBlend); /* if (flipForBlend) { pvIndices[0]=i; pvIndices[1]=i+1; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 9bcf74d80ee..2171bfe538a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -406,7 +406,7 @@ int W3DShadowGeometryHeightmapMesh::GetPolygonIndex (long dwPolyId, short *psInd UnsignedByte alpha[4]; float UA[4], VA[4]; Bool flipForBlend; - map->getAlphaUVData(column+m_patchOriginX, row+m_patchOriginY, UA, VA, alpha, &flipForBlend, false); + map->getAlphaUVData(column+m_patchOriginX, row+m_patchOriginY, UA, VA, alpha, &flipForBlend); if (flipForBlend) { if (dwPolyId &1) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp index 3c259eedf5a..c3596341168 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp @@ -206,7 +206,7 @@ void W3DCustomEdging::loadEdgingsInVertexAndIndexBuffers(WorldHeightMap *pMap, I UnsignedByte alpha[4]; float UA[4], VA[4]; Bool flipForBlend; - pMap->getAlphaUVData(column-pMap->getDrawOrgX(), row-pMap->getDrawOrgY(), UA, VA, alpha, &flipForBlend, false); + pMap->getAlphaUVData(column-pMap->getDrawOrgX(), row-pMap->getDrawOrgY(), UA, VA, alpha, &flipForBlend); Int startVertex = m_curNumEdgingVertices; From 67b4e6a42cf90c8da019d91ca728e84a1c55e97c Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 9 Jan 2026 05:44:05 +1100 Subject: [PATCH 034/211] bugfix(actionmanager): Do not show false resume construction cursor for allied scaffolds (#2068) --- .../Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 6 ++---- .../Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index d588bc3cf89..71465d73471 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -454,10 +454,8 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, if( obj->isKindOf( KINDOF_DOZER ) == FALSE ) return FALSE; - Relationship r = obj->getRelationship(objectBeingConstructed); - - // only available to our allies - if( r != ALLIES ) + // TheSuperHackers @bugfix Stubbjax 06/01/2025 Ensure only the owner of the construction can resume it. + if (obj->getControllingPlayer() != objectBeingConstructed->getControllingPlayer()) return FALSE; // if the objectBeingConstructed is not actually under construction we can't resume that! diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index ee93d3a076b..600ee5ca255 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -458,10 +458,8 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, if( obj->isKindOf( KINDOF_DOZER ) == FALSE ) return FALSE; - Relationship r = obj->getRelationship(objectBeingConstructed); - - // only available to our allies - if( r != ALLIES ) + // TheSuperHackers @bugfix Stubbjax 06/01/2025 Ensure only the owner of the construction can resume it. + if (obj->getControllingPlayer() != objectBeingConstructed->getControllingPlayer()) return FALSE; // if the objectBeingConstructed is not actually under construction we can't resume that! From 67f97c52dfc1bda10efd202347d6de4f80e6643b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 9 Jan 2026 05:46:21 +1100 Subject: [PATCH 035/211] bugfix(render2d): Fix possible greyscale image rendering issues on hardware without DOT3 support (#2080) --- Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp | 3 +++ GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 1856a8c1ef6..08b2bfe3cdf 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -611,6 +611,9 @@ void Render2DClass::Render(void) DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG2, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLOROP, D3DTOP_MODULATE); + + // TheSuperHackers @bugfix Stubbjax 08/01/2025 Fix possible greyscale rendering issues on hardware without DOT3 support. + DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE); } } else diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 5272e27f406..acd1e195627 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -685,6 +685,9 @@ void Render2DClass::Render(void) DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG2, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLOROP, D3DTOP_MODULATE); + + // TheSuperHackers @bugfix Stubbjax 08/01/2025 Fix possible greyscale rendering issues on hardware without DOT3 support. + DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE); } } else From aa073667cab130935520b359c4d7451cb59f77d6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 8 Jan 2026 20:16:23 +0100 Subject: [PATCH 036/211] perf(heightmap): Reduce cost of min height loop in HeightMapRenderObjClass::updateCenter by 93% (#2077) --- .../Source/W3DDevice/GameClient/HeightMap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index b59123cc50f..81733af9e8e 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1677,8 +1677,8 @@ void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjLis Real intersectionZ; minHt = m_map->getMaxHeightValue(); - for (i=0; igetDisplayHeight(i,j); if (cur Date: Thu, 8 Jan 2026 20:44:20 +0100 Subject: [PATCH 037/211] fix(heightmap): Fix CENTER_LIMIT condition in HeightMapRenderObjClass::updateCenter (#2078) --- .../Source/W3DDevice/GameClient/HeightMap.cpp | 116 +++++++++--------- 1 file changed, 57 insertions(+), 59 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 81733af9e8e..c2947c0b644 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1777,68 +1777,66 @@ void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjLis return; } - if (abs(deltaX)>CENTER_LIMIT || abs(deltaY)>CENTER_LIMIT) { - if (abs(deltaY) >= CENTER_LIMIT) { - if (m_map->setDrawOrg(m_map->getDrawOrgX(), newOrgY)) { - Int minY = 0; - Int maxY = 0; - deltaY -= newOrgY - m_map->getDrawOrgY(); - m_originY += deltaY; - if (m_originY >= m_y-1) m_originY -= m_y-1; - if (deltaY<0) { - minY = m_originY; - maxY = m_originY-deltaY; - } else { - minY = m_originY - deltaY; - maxY = m_originY; - } - minY-=cellOffset; - if (m_originY < 0) m_originY += m_y-1; - if (minY<0) { - minY += m_y-1; - if (minY<0) minY = 0; - updateBlock(0, minY, m_x-1, m_y-1, m_map, pLightsIterator); - updateBlock(0, 0, m_x-1, maxY, m_map, pLightsIterator); - } else { - updateBlock(0, minY, m_x-1, maxY, m_map, pLightsIterator); - } + if (abs(deltaY) > CENTER_LIMIT) { + if (m_map->setDrawOrg(m_map->getDrawOrgX(), newOrgY)) { + Int minY = 0; + Int maxY = 0; + deltaY -= newOrgY - m_map->getDrawOrgY(); + m_originY += deltaY; + if (m_originY >= m_y-1) m_originY -= m_y-1; + if (deltaY<0) { + minY = m_originY; + maxY = m_originY-deltaY; + } else { + minY = m_originY - deltaY; + maxY = m_originY; } - // It is much more efficient to update a cople of columns one frame, and then - // a couple of rows. So if we aren't "jumping" to a new view, and have done X - // recently, return. - if (abs(deltaX) < BIG_JUMP && !m_doXNextTime) { - m_updating = false; - m_doXNextTime = true; - return; // Only do the y this frame. Do x next frame. jba. + minY-=cellOffset; + if (m_originY < 0) m_originY += m_y-1; + if (minY<0) { + minY += m_y-1; + if (minY<0) minY = 0; + updateBlock(0, minY, m_x-1, m_y-1, m_map, pLightsIterator); + updateBlock(0, 0, m_x-1, maxY, m_map, pLightsIterator); + } else { + updateBlock(0, minY, m_x-1, maxY, m_map, pLightsIterator); } } - if (abs(deltaX) > CENTER_LIMIT) { - m_doXNextTime = false; - newOrgX = m_map->getDrawOrgX() + deltaX; - if (m_map->setDrawOrg(newOrgX, m_map->getDrawOrgY())) { - Int minX = 0; - Int maxX = 0; - deltaX -= newOrgX - m_map->getDrawOrgX(); - m_originX += deltaX; - if (m_originX >= m_x-1) m_originX -= m_x-1; - if (deltaX<0) { - minX = m_originX; - maxX = m_originX-deltaX; - } else { - minX = m_originX - deltaX; - maxX = m_originX; - } - minX-=cellOffset; - maxX+=cellOffset; - if (m_originX < 0) m_originX += m_x-1; - if (minX<0) { - minX += m_x-1; - if (minX<0) minX = 0; - updateBlock(minX,0,m_x-1, m_y-1, m_map, pLightsIterator); - updateBlock(0,0,maxX, m_y-1, m_map, pLightsIterator); - } else { - updateBlock(minX,0,maxX, m_y-1, m_map, pLightsIterator); - } + // It is much more efficient to update a couple of columns one frame, and then + // a couple of rows. So if we aren't "jumping" to a new view, and have done X + // recently, return. + if (abs(deltaX) < BIG_JUMP && !m_doXNextTime) { + m_updating = false; + m_doXNextTime = true; + return; // Only do the y this frame. Do x next frame. jba. + } + } + if (abs(deltaX) > CENTER_LIMIT) { + m_doXNextTime = false; + newOrgX = m_map->getDrawOrgX() + deltaX; + if (m_map->setDrawOrg(newOrgX, m_map->getDrawOrgY())) { + Int minX = 0; + Int maxX = 0; + deltaX -= newOrgX - m_map->getDrawOrgX(); + m_originX += deltaX; + if (m_originX >= m_x-1) m_originX -= m_x-1; + if (deltaX<0) { + minX = m_originX; + maxX = m_originX-deltaX; + } else { + minX = m_originX - deltaX; + maxX = m_originX; + } + minX-=cellOffset; + maxX+=cellOffset; + if (m_originX < 0) m_originX += m_x-1; + if (minX<0) { + minX += m_x-1; + if (minX<0) minX = 0; + updateBlock(minX,0,m_x-1, m_y-1, m_map, pLightsIterator); + updateBlock(0,0,maxX, m_y-1, m_map, pLightsIterator); + } else { + updateBlock(minX,0,maxX, m_y-1, m_map, pLightsIterator); } } } From 8c560e60e1ad3db4eea2a1ead2a6c18fa7eebc8f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 8 Jan 2026 20:44:40 +0100 Subject: [PATCH 038/211] refactor(heightmap): Clarify magic numbers related to VERTEX_BUFFER_TILE_LENGTH (#2079) --- .../Include/W3DDevice/GameClient/HeightMap.h | 1 - .../Include/W3DDevice/GameClient/WorldHeightMap.h | 10 ++++++---- .../Source/W3DDevice/GameClient/BaseHeightMap.cpp | 2 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h index 4e35b067290..a0218322a74 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h @@ -37,7 +37,6 @@ #include "W3DDevice/GameClient/WorldHeightMap.h" #include "W3DDevice/GameClient/BaseHeightMap.h" -#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices). // Adjust the triangles to make cliff sides most attractive. jba. #define FLIP_TRIANGLES 1 diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h index 281bff97a48..389bff6f9e9 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h @@ -42,6 +42,8 @@ typedef std::vector VecICoord2D; /** MapObject class Not ref counted. Do not store pointers to this class. */ +#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices). + #define K_MIN_HEIGHT 0 #define K_MAX_HEIGHT 255 @@ -105,10 +107,10 @@ class WorldHeightMap : public RefCountClass, enum {TILE_4x4, TILE_6x6, TILE_8x8} m_tileMode; #endif enum { - NORMAL_DRAW_WIDTH = 129, - NORMAL_DRAW_HEIGHT = 129, - STRETCH_DRAW_WIDTH = 65, - STRETCH_DRAW_HEIGHT = 65 + NORMAL_DRAW_WIDTH = 1 + 4*VERTEX_BUFFER_TILE_LENGTH, + NORMAL_DRAW_HEIGHT = 1 + 4*VERTEX_BUFFER_TILE_LENGTH, + STRETCH_DRAW_WIDTH = 1 + 2*VERTEX_BUFFER_TILE_LENGTH, + STRETCH_DRAW_HEIGHT = 1 + 2*VERTEX_BUFFER_TILE_LENGTH, }; protected: diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index a1ffe603fc0..710e9ad375a 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -693,7 +693,7 @@ bool BaseHeightMapRenderObjClass::Cast_Ray(RayCollisionTestClass & raytest) Int EndCellX = 0; Int StartCellY = 0; Int EndCellY = 0; - const Int overhang = 2*32+m_map->getBorderSizeInline(); // Allow picking past the edge for scrolling & objects. + const Int overhang = 2*VERTEX_BUFFER_TILE_LENGTH + m_map->getBorderSizeInline(); // Allow picking past the edge for scrolling & objects. Vector3 minPt(MAP_XY_FACTOR*(-overhang), MAP_XY_FACTOR*(-overhang), -MAP_XY_FACTOR); Vector3 maxPt(MAP_XY_FACTOR*(m_map->getXExtent()+overhang), MAP_XY_FACTOR*(m_map->getYExtent()+overhang), MAP_HEIGHT_SCALE*m_map->getMaxHeightValue()+MAP_XY_FACTOR); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index c2947c0b644..575853e0f60 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -1170,8 +1170,8 @@ void HeightMapRenderObjClass::oversizeTerrain(Int tilesToOversize) Int height = WorldHeightMap::NORMAL_DRAW_HEIGHT; if (tilesToOversize>0 && tilesToOversize<5) { - width += 32*tilesToOversize; - height += 32*tilesToOversize; + width += VERTEX_BUFFER_TILE_LENGTH * tilesToOversize; + height += VERTEX_BUFFER_TILE_LENGTH * tilesToOversize; if (width>m_map->getXExtent()) width = m_map->getXExtent(); if (height>m_map->getYExtent()) From 25e3602907f2a1db35be0290c0190318aef534cb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 11 Jan 2026 22:19:35 +0100 Subject: [PATCH 039/211] build(cmake): Move most CppMacros.h includes into precompiled headers and make them available in all build targets (#2090) --- Core/CMakeLists.txt | 6 ++++ Core/GameEngine/Include/Common/Debug.h | 2 -- Core/Libraries/Include/Lib/BaseTypeCore.h | 1 - .../Source/Compression/CMakeLists.txt | 2 +- .../Source/WWVegas/WWLib/CMakeLists.txt | 1 + .../Libraries/Source/WWVegas/WWLib/STLUtils.h | 1 - .../Source/WWVegas/WWMath/CMakeLists.txt | 1 + .../Source/WWVegas/WWSaveLoad/CMakeLists.txt | 1 + Core/Libraries/Source/debug/CMakeLists.txt | 1 + Core/Libraries/Source/profile/CMakeLists.txt | 1 + Core/Libraries/Source/profile/internal.h | 1 - Core/Tools/Babylon/CMakeLists.txt | 1 + Core/Tools/CRCDiff/CMakeLists.txt | 1 + Core/Tools/DebugWindow/CMakeLists.txt | 1 + Core/Tools/DebugWindow/StdAfx.h | 2 ++ Core/Tools/W3DView/CMakeLists.txt | 1 + Core/Tools/WW3D/max2w3d/util.h | 22 +++++++-------- Core/Tools/WW3D/pluglib/CMakeLists.txt | 2 +- Core/Tools/assetcull/CMakeLists.txt | 1 + Core/Tools/buildVersionUpdate/CMakeLists.txt | 1 + Core/Tools/mangler/CMakeLists.txt | 2 +- Core/Tools/matchbot/CMakeLists.txt | 2 +- Core/Tools/textureCompress/CMakeLists.txt | 2 +- Core/Tools/timingTest/CMakeLists.txt | 2 +- Core/Tools/versionUpdate/CMakeLists.txt | 1 + Core/Tools/wolSetup/CMakeLists.txt | 1 + Dependencies/Utility/CMakeLists.txt | 7 ++++- Dependencies/Utility/Utility/CppMacros.h | 28 +++++++++++-------- Dependencies/Utility/Utility/endian_compat.h | 1 - Generals/Code/CMakeLists.txt | 12 ++++++-- Generals/Code/GameEngine/CMakeLists.txt | 5 +++- Generals/Code/GameEngineDevice/CMakeLists.txt | 5 ++-- .../Source/WWVegas/WW3D2/CMakeLists.txt | 2 ++ .../Source/WWVegas/WWAudio/CMakeLists.txt | 1 + .../Code/Tools/ParticleEditor/CMakeLists.txt | 12 ++------ Generals/Code/Tools/ParticleEditor/StdAfx.h | 2 ++ Generals/Code/Tools/W3DView/CMakeLists.txt | 6 ++-- .../Code/Tools/WorldBuilder/CMakeLists.txt | 1 + GeneralsMD/Code/CMakeLists.txt | 12 ++++++-- GeneralsMD/Code/GameEngine/CMakeLists.txt | 5 +++- .../Code/GameEngineDevice/CMakeLists.txt | 1 + .../Source/WWVegas/WW3D2/CMakeLists.txt | 2 ++ .../Source/WWVegas/WWAudio/CMakeLists.txt | 1 + .../Code/Tools/ParticleEditor/CMakeLists.txt | 8 ++---- GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h | 2 ++ GeneralsMD/Code/Tools/W3DView/CMakeLists.txt | 2 +- .../Code/Tools/WorldBuilder/CMakeLists.txt | 1 + GeneralsMD/Code/Tools/wdump/CMakeLists.txt | 2 +- 48 files changed, 112 insertions(+), 66 deletions(-) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 6f6f640b3a4..9bf7d20ccdb 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -5,6 +5,7 @@ add_library(corei_libraries_source_wwvegas INTERFACE) add_library(corei_libraries_source_wwvegas_wwlib INTERFACE) add_library(corei_main INTERFACE) add_library(corei_always INTERFACE) +add_library(corei_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(corei_gameengine_include INTERFACE "GameEngine/Include") target_include_directories(corei_libraries_include INTERFACE "Libraries/Include") @@ -17,6 +18,11 @@ target_link_libraries(corei_always INTERFACE corei_libraries_include resources ) +target_link_libraries(corei_always_no_pch INTERFACE + core_utility_no_pch + corei_libraries_include + resources +) # Set where the build results will end up set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Core/GameEngine/Include/Common/Debug.h b/Core/GameEngine/Include/Common/Debug.h index 673e7d58e7b..7288a753cda 100644 --- a/Core/GameEngine/Include/Common/Debug.h +++ b/Core/GameEngine/Include/Common/Debug.h @@ -45,8 +45,6 @@ #pragma once -#include - class AsciiString; #define NO_RELEASE_DEBUG_LOGGING diff --git a/Core/Libraries/Include/Lib/BaseTypeCore.h b/Core/Libraries/Include/Lib/BaseTypeCore.h index 550bdd5adf8..22bd6a6d1fc 100644 --- a/Core/Libraries/Include/Lib/BaseTypeCore.h +++ b/Core/Libraries/Include/Lib/BaseTypeCore.h @@ -33,7 +33,6 @@ #include // TheSuperHackers @build feliwir 07/04/2025 Adds utility macros for cross-platform compatibility #include -#include #include /* diff --git a/Core/Libraries/Source/Compression/CMakeLists.txt b/Core/Libraries/Source/Compression/CMakeLists.txt index 0f168201697..035ad7ca9e0 100644 --- a/Core/Libraries/Source/Compression/CMakeLists.txt +++ b/Core/Libraries/Source/Compression/CMakeLists.txt @@ -30,8 +30,8 @@ target_include_directories(core_compression INTERFACE target_link_libraries(core_compression PRIVATE core_config - core_utility corei_libraries_include + corei_always ) diff --git a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt index 997a6c02420..228506fee0e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWLib/CMakeLists.txt @@ -176,6 +176,7 @@ target_include_directories(core_wwlib PUBLIC ) target_precompile_headers(core_wwlib PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 always.h STLUtils.h win.h diff --git a/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h b/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h index ca92bf76c67..bb76c2f507f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h +++ b/Core/Libraries/Source/WWVegas/WWLib/STLUtils.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace stl { diff --git a/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt index d88eb09edb7..58f67690b28 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt @@ -87,6 +87,7 @@ target_sources(core_wwmath PRIVATE ${WWMATH_SRC}) target_link_libraries(core_wwmath PRIVATE core_wwcommon + corei_always ) # @todo Test its impact and see what to do with the legacy functions. diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWSaveLoad/CMakeLists.txt index bcb5af6819c..df618b0489a 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/CMakeLists.txt @@ -42,4 +42,5 @@ target_sources(core_wwsaveload PRIVATE ${WWSAVELOAD_SRC}) target_link_libraries(core_wwsaveload PRIVATE core_wwcommon + corei_always ) diff --git a/Core/Libraries/Source/debug/CMakeLists.txt b/Core/Libraries/Source/debug/CMakeLists.txt index 24890749443..61228d8fb95 100644 --- a/Core/Libraries/Source/debug/CMakeLists.txt +++ b/Core/Libraries/Source/debug/CMakeLists.txt @@ -30,6 +30,7 @@ target_include_directories(core_debug INTERFACE ) target_precompile_headers(core_debug PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 "debug.h" "internal.h" "internal_except.h" diff --git a/Core/Libraries/Source/profile/CMakeLists.txt b/Core/Libraries/Source/profile/CMakeLists.txt index e2457d80389..73ac03e5d54 100644 --- a/Core/Libraries/Source/profile/CMakeLists.txt +++ b/Core/Libraries/Source/profile/CMakeLists.txt @@ -25,6 +25,7 @@ target_include_directories(core_profile INTERFACE ) target_precompile_headers(core_profile PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 "profile.h" "internal.h" diff --git a/Core/Libraries/Source/profile/internal.h b/Core/Libraries/Source/profile/internal.h index b80d223baae..2bfd185182f 100644 --- a/Core/Libraries/Source/profile/internal.h +++ b/Core/Libraries/Source/profile/internal.h @@ -34,7 +34,6 @@ #include "internal_highlevel.h" #include "internal_cmd.h" #include "internal_result.h" -#include "Utility/CppMacros.h" #include #if !(defined(_MSC_VER) && _MSC_VER < 1300) diff --git a/Core/Tools/Babylon/CMakeLists.txt b/Core/Tools/Babylon/CMakeLists.txt index a85ee41a72c..6a04a610d78 100644 --- a/Core/Tools/Babylon/CMakeLists.txt +++ b/Core/Tools/Babylon/CMakeLists.txt @@ -58,6 +58,7 @@ target_sources(core_babylon PRIVATE ${BABYLON_SRC}) target_link_libraries(core_babylon PRIVATE core_config + corei_always ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/CRCDiff/CMakeLists.txt b/Core/Tools/CRCDiff/CMakeLists.txt index 4a01798a8e0..d630b7ab25e 100644 --- a/Core/Tools/CRCDiff/CMakeLists.txt +++ b/Core/Tools/CRCDiff/CMakeLists.txt @@ -17,6 +17,7 @@ target_sources(core_crcdiff PRIVATE ${CRCDIFF_SRC}) target_link_libraries(core_crcdiff PRIVATE core_config core_utility + corei_always stlport ) diff --git a/Core/Tools/DebugWindow/CMakeLists.txt b/Core/Tools/DebugWindow/CMakeLists.txt index d6514ca8ada..4405e253e4b 100644 --- a/Core/Tools/DebugWindow/CMakeLists.txt +++ b/Core/Tools/DebugWindow/CMakeLists.txt @@ -14,6 +14,7 @@ target_sources(core_debugwindow PRIVATE ${DEBUGWINDOW_SRC}) target_link_libraries(core_debugwindow PRIVATE core_config + corei_always_no_pch ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/DebugWindow/StdAfx.h b/Core/Tools/DebugWindow/StdAfx.h index 93949ef8247..a867c9d598c 100644 --- a/Core/Tools/DebugWindow/StdAfx.h +++ b/Core/Tools/DebugWindow/StdAfx.h @@ -56,3 +56,5 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#include diff --git a/Core/Tools/W3DView/CMakeLists.txt b/Core/Tools/W3DView/CMakeLists.txt index f8a8b9604c0..d835feaa6e3 100644 --- a/Core/Tools/W3DView/CMakeLists.txt +++ b/Core/Tools/W3DView/CMakeLists.txt @@ -171,6 +171,7 @@ add_library(corei_w3dview INTERFACE) target_sources(corei_w3dview INTERFACE ${W3DVIEW_SRC}) target_precompile_headers(corei_w3dview INTERFACE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 "StdAfx.h" [["always.h"]] [["STLUtils.h"]] diff --git a/Core/Tools/WW3D/max2w3d/util.h b/Core/Tools/WW3D/max2w3d/util.h index 96eb55e03ff..b90567e5aa8 100644 --- a/Core/Tools/WW3D/max2w3d/util.h +++ b/Core/Tools/WW3D/max2w3d/util.h @@ -99,14 +99,14 @@ INode *Find_Named_Node (char *nodename, INode *root); /* ** Macros */ -#define SAFE_DELETE(pobject) \ - if (pobject) { \ - delete pobject; \ - pobject = NULL; \ - } \ - -#define SAFE_DELETE_ARRAY(pobject) \ - if (pobject) { \ - delete [] pobject; \ - pobject = NULL; \ - } \ +#define SAFE_DELETE(pobject) \ + if (pobject) { \ + delete pobject; \ + pobject = NULL; \ + } + +#define SAFE_DELETE_ARRAY(pobject) \ + if (pobject) { \ + delete [] pobject; \ + pobject = NULL; \ + } diff --git a/Core/Tools/WW3D/pluglib/CMakeLists.txt b/Core/Tools/WW3D/pluglib/CMakeLists.txt index e329dd35b99..05a76d1950a 100644 --- a/Core/Tools/WW3D/pluglib/CMakeLists.txt +++ b/Core/Tools/WW3D/pluglib/CMakeLists.txt @@ -59,7 +59,7 @@ set_target_properties(core_pluglib PROPERTIES OUTPUT_NAME pluglib) target_sources(core_pluglib PRIVATE ${PLUGLIB_SRC}) target_link_libraries(core_pluglib PUBLIC - core_utility + corei_always ) target_link_libraries(core_pluglib PRIVATE diff --git a/Core/Tools/assetcull/CMakeLists.txt b/Core/Tools/assetcull/CMakeLists.txt index ce70dc9ab7f..e49a60fce79 100644 --- a/Core/Tools/assetcull/CMakeLists.txt +++ b/Core/Tools/assetcull/CMakeLists.txt @@ -9,6 +9,7 @@ target_sources(core_assetcull PRIVATE ${ASSETCULL_SRC}) target_link_libraries(core_assetcull PRIVATE core_config + corei_always ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/buildVersionUpdate/CMakeLists.txt b/Core/Tools/buildVersionUpdate/CMakeLists.txt index cad2418d55e..fc1a8c0bab2 100644 --- a/Core/Tools/buildVersionUpdate/CMakeLists.txt +++ b/Core/Tools/buildVersionUpdate/CMakeLists.txt @@ -10,4 +10,5 @@ target_sources(core_buildversionupdate PRIVATE ${BUILDVERSIONUPDATE_SRC}) target_link_libraries(core_buildversionupdate PRIVATE core_config core_wwlib + corei_always ) diff --git a/Core/Tools/mangler/CMakeLists.txt b/Core/Tools/mangler/CMakeLists.txt index ae7e3ded640..eab95cfced5 100644 --- a/Core/Tools/mangler/CMakeLists.txt +++ b/Core/Tools/mangler/CMakeLists.txt @@ -68,7 +68,7 @@ target_include_directories(core_manglerlib PRIVATE target_link_libraries(core_manglerlib PRIVATE wsock32) target_link_libraries(core_manglerlib PUBLIC core_config - core_utility + corei_always ) # mangler app diff --git a/Core/Tools/matchbot/CMakeLists.txt b/Core/Tools/matchbot/CMakeLists.txt index b37c128ccc6..54822e3ecbb 100644 --- a/Core/Tools/matchbot/CMakeLists.txt +++ b/Core/Tools/matchbot/CMakeLists.txt @@ -73,7 +73,7 @@ target_include_directories(core_matchbot PRIVATE target_link_libraries(core_matchbot PRIVATE gamespy::gamespy core_config - core_utility + corei_always stlport ) diff --git a/Core/Tools/textureCompress/CMakeLists.txt b/Core/Tools/textureCompress/CMakeLists.txt index 818499c6cc0..3792175b32f 100644 --- a/Core/Tools/textureCompress/CMakeLists.txt +++ b/Core/Tools/textureCompress/CMakeLists.txt @@ -10,8 +10,8 @@ target_sources(core_texturecompress PRIVATE ${TEXTURECOMPRESS_SRC}) target_link_libraries(core_texturecompress PRIVATE core_config - core_utility core_wwlib + corei_always ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/timingTest/CMakeLists.txt b/Core/Tools/timingTest/CMakeLists.txt index ac7207e0895..11cd8d7be64 100644 --- a/Core/Tools/timingTest/CMakeLists.txt +++ b/Core/Tools/timingTest/CMakeLists.txt @@ -11,7 +11,7 @@ target_sources(core_timingtest PRIVATE ${TIMINGTEST_SRC}) target_link_libraries(core_timingtest PRIVATE core_config - core_utility + corei_always winmm ) diff --git a/Core/Tools/versionUpdate/CMakeLists.txt b/Core/Tools/versionUpdate/CMakeLists.txt index e9d1f21dec5..e6b4597b89b 100644 --- a/Core/Tools/versionUpdate/CMakeLists.txt +++ b/Core/Tools/versionUpdate/CMakeLists.txt @@ -10,4 +10,5 @@ target_sources(core_versionupdate PRIVATE ${VERSIONUPDATE_SRC}) target_link_libraries(core_versionupdate PRIVATE core_config core_wwlib + corei_always ) diff --git a/Core/Tools/wolSetup/CMakeLists.txt b/Core/Tools/wolSetup/CMakeLists.txt index 01e253838f7..85182735765 100644 --- a/Core/Tools/wolSetup/CMakeLists.txt +++ b/Core/Tools/wolSetup/CMakeLists.txt @@ -22,6 +22,7 @@ target_sources(core_wolsetup PRIVATE ${WOLSETUP_SRC}) target_link_libraries(core_wolsetup PRIVATE core_config + corei_always Version ) diff --git a/Dependencies/Utility/CMakeLists.txt b/Dependencies/Utility/CMakeLists.txt index 1140f751c95..9d728be9a16 100644 --- a/Dependencies/Utility/CMakeLists.txt +++ b/Dependencies/Utility/CMakeLists.txt @@ -1,3 +1,8 @@ add_library(core_utility INTERFACE) +target_include_directories(core_utility INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_precompile_headers(core_utility INTERFACE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 +) -target_include_directories(core_utility INTERFACE ".") +add_library(core_utility_no_pch INTERFACE) +target_include_directories(core_utility_no_pch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Dependencies/Utility/Utility/CppMacros.h b/Dependencies/Utility/Utility/CppMacros.h index 02ab1c0d098..729106fa413 100644 --- a/Dependencies/Utility/Utility/CppMacros.h +++ b/Dependencies/Utility/Utility/CppMacros.h @@ -17,38 +17,41 @@ */ // This file contains macros to help upgrade the code for newer cpp standards. +// Must be C compliant + #pragma once #if __cplusplus >= 201103L #include #endif +#if __cplusplus >= 201103L +#define CPP_11(code) code +#else +#define CPP_11(code) +#define static_assert(expr, msg) +#define constexpr +#define nullptr 0 +#endif + #if __cplusplus >= 201703L -#define NOEXCEPT_17 noexcept +#define NOEXCEPT noexcept #define REGISTER #define FALLTHROUGH [[fallthrough]] #else -#define NOEXCEPT_17 +#define NOEXCEPT #define REGISTER register #define FALLTHROUGH #endif // noexcept for methods of IUNKNOWN interface #if defined(_MSC_VER) -#define IUNKNOWN_NOEXCEPT NOEXCEPT_17 +#define IUNKNOWN_NOEXCEPT NOEXCEPT #else #define IUNKNOWN_NOEXCEPT #endif -#if __cplusplus >= 201103L -#define CPP_11(code) code -#else -#define CPP_11(code) -#define static_assert(expr, msg) -#define constexpr -#define nullptr 0 -#endif - +#ifdef __cplusplus namespace stl { @@ -68,3 +71,4 @@ inline void move_or_swap(T& dest, T& src) } } // namespace stl +#endif diff --git a/Dependencies/Utility/Utility/endian_compat.h b/Dependencies/Utility/Utility/endian_compat.h index 08c6fdb16f4..d79ed176e8f 100644 --- a/Dependencies/Utility/Utility/endian_compat.h +++ b/Dependencies/Utility/Utility/endian_compat.h @@ -22,7 +22,6 @@ #ifndef ENDIAN_COMPAT_H #define ENDIAN_COMPAT_H -#include #include diff --git a/Generals/Code/CMakeLists.txt b/Generals/Code/CMakeLists.txt index 33576cba689..293ec60d85e 100644 --- a/Generals/Code/CMakeLists.txt +++ b/Generals/Code/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(gi_libraries_include INTERFACE) add_library(gi_libraries_source_wwvegas INTERFACE) add_library(gi_main INTERFACE) add_library(gi_always INTERFACE) +add_library(gi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(gi_gameengine_include INTERFACE "GameEngine/Include") target_link_libraries(gi_gameengine_include INTERFACE corei_gameengine_include) @@ -14,11 +15,16 @@ target_include_directories(gi_main INTERFACE "Main") target_compile_definitions(gi_always INTERFACE RTS_GENERALS=1 ) +target_compile_definitions(gi_always_no_pch INTERFACE + RTS_GENERALS=1 +) target_link_libraries(gi_always INTERFACE - core_utility gi_libraries_include - # Must stay below so headers from game are included first - corei_libraries_include + corei_always # Must stay below so headers from game are included first +) +target_link_libraries(gi_always_no_pch INTERFACE + gi_libraries_include + corei_always_no_pch # Must stay below so headers from game are included first ) # Contains internal libraries diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 9553884b67f..a6d33955a42 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -1096,4 +1096,7 @@ target_link_libraries(g_gameengine PUBLIC g_wwvegas ) -target_precompile_headers(g_gameengine PRIVATE Include/Precompiled/PreRTS.h) +target_precompile_headers(g_gameengine PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 + Include/Precompiled/PreRTS.h +) diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt index ab3d8f1d620..ca1022e3e61 100644 --- a/Generals/Code/GameEngineDevice/CMakeLists.txt +++ b/Generals/Code/GameEngineDevice/CMakeLists.txt @@ -190,6 +190,7 @@ target_include_directories(g_gameenginedevice PUBLIC ) target_precompile_headers(g_gameenginedevice PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 [["Common/STLTypedefs.h"]] [["Common/SubsystemInterface.h"]] [["INI.h"]] @@ -199,8 +200,8 @@ target_precompile_headers(g_gameenginedevice PRIVATE target_link_libraries(g_gameenginedevice PRIVATE corei_gameenginedevice_private - gi_always - gi_main + gi_always + gi_main ) target_link_libraries(g_gameenginedevice PUBLIC diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index 0a51c6d9648..3bc272b2e82 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -238,6 +238,7 @@ target_compile_definitions(g_ww3d2 PRIVATE ) target_precompile_headers(g_ww3d2 PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 dx8wrapper.h [["always.h"]] [["STLUtils.h"]] @@ -250,4 +251,5 @@ target_precompile_headers(g_ww3d2 PRIVATE target_link_libraries(g_ww3d2 PRIVATE corei_ww3d2 g_wwcommon + gi_always ) diff --git a/Generals/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt index 071eddc29bf..f1d4f7dbffe 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt +++ b/Generals/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt @@ -4,4 +4,5 @@ set_target_properties(g_wwaudio PROPERTIES OUTPUT_NAME wwaudio) target_link_libraries(g_wwaudio PRIVATE corei_wwaudio g_wwcommon + gi_always ) diff --git a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt index 0ea7325438a..093917ad690 100644 --- a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt @@ -36,25 +36,19 @@ target_include_directories(g_particleeditor PRIVATE res ) -target_compile_definitions(g_particleeditor PRIVATE _AFXDLL) - target_link_libraries(g_particleeditor PRIVATE + core_config corei_libraries_source_wwvegas corei_libraries_source_wwvegas_wwlib - d3d8lib + gi_always_no_pch gi_gameengine_include - gi_always gi_libraries_source_wwvegas - core_config - imm32 stlport - vfw32 - winmm ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") target_link_options(g_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) - + target_compile_definitions(g_particleeditor PRIVATE _AFXDLL) target_sources(g_particleeditor PRIVATE ParticleEditor.rc) set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) else() diff --git a/Generals/Code/Tools/ParticleEditor/StdAfx.h b/Generals/Code/Tools/ParticleEditor/StdAfx.h index 099ec6dbe05..31a9a456d21 100644 --- a/Generals/Code/Tools/ParticleEditor/StdAfx.h +++ b/Generals/Code/Tools/ParticleEditor/StdAfx.h @@ -70,3 +70,5 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#include diff --git a/Generals/Code/Tools/W3DView/CMakeLists.txt b/Generals/Code/Tools/W3DView/CMakeLists.txt index 7a3f14db37e..2e3ce338411 100644 --- a/Generals/Code/Tools/W3DView/CMakeLists.txt +++ b/Generals/Code/Tools/W3DView/CMakeLists.txt @@ -2,19 +2,19 @@ add_executable(g_w3dview WIN32) target_link_libraries(g_w3dview PRIVATE core_config - core_utility core_wwstub # avoid linking GameEngine corei_w3dview # this interface gets the source files for the tool d3d8 d3d8lib d3dx8 + g_wwaudio + g_wwvegas + gi_always imm32 milesstub Version vfw32 winmm - g_wwaudio - g_wwvegas ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt index 5550bbf9777..263cc6fe32b 100644 --- a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt +++ b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt @@ -205,6 +205,7 @@ target_include_directories(g_worldbuilder PRIVATE target_compile_definitions(g_worldbuilder PRIVATE _AFXDLL) target_precompile_headers(g_worldbuilder PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 [["always.h"]] [["Common/STLTypedefs.h"]] [["StdAfx.h"]] diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt index 6973be26073..0c4c21f934e 100644 --- a/GeneralsMD/Code/CMakeLists.txt +++ b/GeneralsMD/Code/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(zi_libraries_include INTERFACE) add_library(zi_libraries_source_wwvegas INTERFACE) add_library(zi_main INTERFACE) add_library(zi_always INTERFACE) +add_library(zi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(zi_gameengine_include INTERFACE "GameEngine/Include") target_link_libraries(zi_gameengine_include INTERFACE corei_gameengine_include) @@ -14,11 +15,16 @@ target_include_directories(zi_main INTERFACE "Main") target_compile_definitions(zi_always INTERFACE RTS_ZEROHOUR=1 ) +target_compile_definitions(zi_always_no_pch INTERFACE + RTS_ZEROHOUR=1 +) target_link_libraries(zi_always INTERFACE - core_utility zi_libraries_include - # Must stay below so headers from game are included first - corei_libraries_include + corei_always # Must stay below so headers from game are included first +) +target_link_libraries(zi_always_no_pch INTERFACE + zi_libraries_include + corei_always_no_pch # Must stay below so headers from game are included first ) # Contains internal libraries diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 648ea13dc8e..b9be6228a4a 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -1174,4 +1174,7 @@ target_link_libraries(z_gameengine PUBLIC z_wwvegas ) -target_precompile_headers(z_gameengine PRIVATE Include/Precompiled/PreRTS.h) +target_precompile_headers(z_gameengine PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 + Include/Precompiled/PreRTS.h +) diff --git a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt index 7b66d902b10..db9be4f3cdc 100644 --- a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt @@ -203,6 +203,7 @@ target_include_directories(z_gameenginedevice PUBLIC ) target_precompile_headers(z_gameenginedevice PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 [["Common/STLTypedefs.h"]] [["Common/SubsystemInterface.h"]] [["INI.h"]] diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index 13f5bc1ef6e..f3bfa78cdb7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -243,6 +243,7 @@ target_compile_definitions(z_ww3d2 PRIVATE ) target_precompile_headers(z_ww3d2 PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 dx8wrapper.h [["always.h"]] [["STLUtils.h"]] @@ -255,4 +256,5 @@ target_precompile_headers(z_ww3d2 PRIVATE target_link_libraries(z_ww3d2 PRIVATE corei_ww3d2 z_wwcommon + zi_always ) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt index 074502aa283..208ce48da05 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWAudio/CMakeLists.txt @@ -4,4 +4,5 @@ set_target_properties(z_wwaudio PROPERTIES OUTPUT_NAME wwaudio) target_link_libraries(z_wwaudio PRIVATE corei_wwaudio z_wwcommon + zi_always ) diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt index 4d09c98ec22..292fdebe0dd 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt @@ -37,18 +37,14 @@ target_include_directories(z_particleeditor PRIVATE ) target_link_libraries(z_particleeditor PRIVATE + core_config core_debug core_profile corei_libraries_source_wwvegas corei_libraries_source_wwvegas_wwlib - d3d8lib - imm32 - core_config stlport - vfw32 - winmm + zi_always_no_pch zi_gameengine_include - zi_always zi_libraries_source_wwvegas ) diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h b/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h index a5879cdae31..5f1176d1f6a 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h @@ -70,3 +70,5 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#include diff --git a/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt b/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt index 9f321bc93db..c723893f49f 100644 --- a/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt @@ -2,7 +2,6 @@ add_executable(z_w3dview WIN32) target_link_libraries(z_w3dview PRIVATE core_config - core_utility core_wwstub # avoid linking GameEngine corei_w3dview # this interface gets the source files for the tool d3d8 @@ -15,6 +14,7 @@ target_link_libraries(z_w3dview PRIVATE winmm z_wwaudio z_wwvegas + zi_always ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt index 2bab1c648c4..c6e309238db 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt @@ -210,6 +210,7 @@ target_include_directories(z_worldbuilder PRIVATE ) target_precompile_headers(z_worldbuilder PRIVATE + [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 [["always.h"]] [["Common/STLTypedefs.h"]] [["StdAfx.h"]] diff --git a/GeneralsMD/Code/Tools/wdump/CMakeLists.txt b/GeneralsMD/Code/Tools/wdump/CMakeLists.txt index 65d190703e4..2ab4457ec3e 100644 --- a/GeneralsMD/Code/Tools/wdump/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/wdump/CMakeLists.txt @@ -19,12 +19,12 @@ target_sources(z_wdump PRIVATE ${WDUMP_SRC}) target_link_libraries(z_wdump PRIVATE core_config - core_utility core_wwstub # avoid linking GameEngine imm32 vfw32 winmm z_wwvegas + zi_always ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") From f891c5f3e2829f6cc94d4d148a6b4ca8a481f37a Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 14 Jan 2026 13:41:58 -0500 Subject: [PATCH 040/211] refactor: Modernize NULL to nullptr (#1938) --- .../Include/Common/ArchiveFileSystem.h | 4 +- Core/GameEngine/Include/Common/AsciiString.h | 4 +- .../Include/Common/AudioEventInfo.h | 4 +- Core/GameEngine/Include/Common/GameAudio.h | 6 +- Core/GameEngine/Include/Common/GameMemory.h | 16 +- .../Include/Common/GameMemoryNull.h | 4 +- Core/GameEngine/Include/Common/LocalFile.h | 2 +- Core/GameEngine/Include/Common/RAMFile.h | 2 +- Core/GameEngine/Include/Common/Radar.h | 4 +- .../Include/Common/StreamingArchiveFile.h | 4 +- .../GameEngine/Include/Common/UnicodeString.h | 2 +- Core/GameEngine/Include/Common/file.h | 2 +- .../Include/GameClient/TerrainVisual.h | 14 +- .../Include/GameNetwork/ConnectionManager.h | 4 +- .../Include/GameNetwork/GameSpy/PeerThread.h | 2 +- .../Include/GameNetwork/GameSpyOverlay.h | 2 +- .../Include/GameNetwork/IPEnumeration.h | 2 +- Core/GameEngine/Include/GameNetwork/LANAPI.h | 2 +- .../Include/GameNetwork/LANGameInfo.h | 2 +- .../Include/GameNetwork/LANPlayer.h | 2 +- .../GameNetwork/WOLBrowser/FEBDispatch.h | 8 +- .../Source/Common/Audio/AudioEventRTS.cpp | 20 +- .../Source/Common/Audio/GameAudio.cpp | 146 +- .../Source/Common/Audio/GameMusic.cpp | 8 +- .../Source/Common/Audio/simpleplayer.cpp | 74 +- .../Source/Common/Audio/urllaunch.cpp | 40 +- Core/GameEngine/Source/Common/CRCDebug.cpp | 4 +- Core/GameEngine/Source/Common/FramePacer.cpp | 8 +- Core/GameEngine/Source/Common/GameUtility.cpp | 24 +- .../Source/Common/INI/INIAudioEventInfo.cpp | 40 +- .../Source/Common/INI/INIMiscAudio.cpp | 74 +- Core/GameEngine/Source/Common/RandomValue.cpp | 6 +- .../Source/Common/ReplaySimulation.cpp | 2 +- .../Source/Common/System/ArchiveFile.cpp | 14 +- .../Common/System/ArchiveFileSystem.cpp | 18 +- .../Source/Common/System/AsciiString.cpp | 28 +- .../GameEngine/Source/Common/System/Debug.cpp | 36 +- .../Source/Common/System/FileSystem.cpp | 14 +- .../Source/Common/System/GameMemory.cpp | 204 +-- .../Source/Common/System/GameMemoryInit.cpp | 6 +- .../Source/Common/System/GameMemoryNull.cpp | 24 +- .../Source/Common/System/LocalFile.cpp | 18 +- .../Source/Common/System/LocalFileSystem.cpp | 2 +- .../Source/Common/System/MiniDumper.cpp | 68 +- .../Common/System/ObjectStatusTypes.cpp | 2 +- .../Source/Common/System/RAMFile.cpp | 34 +- .../GameEngine/Source/Common/System/Radar.cpp | 116 +- .../Common/System/StreamingArchiveFile.cpp | 8 +- .../Source/Common/System/UnicodeString.cpp | 22 +- Core/GameEngine/Source/Common/System/Xfer.cpp | 8 +- .../Source/Common/System/XferCRC.cpp | 18 +- .../Source/Common/System/XferLoad.cpp | 20 +- .../Source/Common/System/XferSave.cpp | 32 +- .../Source/Common/WorkerProcess.cpp | 48 +- .../GameClient/GUI/WindowVideoManager.cpp | 26 +- Core/GameEngine/Source/GameClient/MapUtil.cpp | 62 +- Core/GameEngine/Source/GameClient/Snow.cpp | 38 +- .../System/Debug/AudioDebugDisplay.cpp | 4 +- .../Source/GameClient/System/Smudge.cpp | 8 +- .../GameClient/Terrain/TerrainRoads.cpp | 66 +- .../GameClient/Terrain/TerrainVisual.cpp | 4 +- .../Source/GameClient/VideoPlayer.cpp | 36 +- Core/GameEngine/Source/GameClient/View.cpp | 10 +- Core/GameEngine/Source/GameClient/Water.cpp | 54 +- .../Source/GameNetwork/Connection.cpp | 52 +- .../Source/GameNetwork/ConnectionManager.cpp | 226 +-- .../Source/GameNetwork/FileTransfer.cpp | 2 +- .../Source/GameNetwork/FirewallHelper.cpp | 28 +- .../Source/GameNetwork/FrameData.cpp | 14 +- .../Source/GameNetwork/FrameDataManager.cpp | 2 +- .../Source/GameNetwork/FrameMetrics.cpp | 6 +- .../Source/GameNetwork/GameInfo.cpp | 82 +- .../Source/GameNetwork/GameMessageParser.cpp | 12 +- .../Source/GameNetwork/GameSpy/Chat.cpp | 58 +- .../Source/GameNetwork/GameSpy/GSConfig.cpp | 2 +- .../Source/GameNetwork/GameSpy/LadderDefs.cpp | 24 +- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 88 +- .../GameNetwork/GameSpy/MainMenuUtils.cpp | 48 +- .../Source/GameNetwork/GameSpy/PeerDefs.cpp | 38 +- .../GameSpy/StagingRoomGameInfo.cpp | 26 +- .../GameSpy/Thread/BuddyThread.cpp | 6 +- .../GameSpy/Thread/GameResultsThread.cpp | 6 +- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 114 +- .../Thread/PersistentStorageThread.cpp | 18 +- .../GameNetwork/GameSpy/Thread/PingThread.cpp | 18 +- .../GameSpy/Thread/ThreadUtils.cpp | 10 +- .../Source/GameNetwork/GameSpyOverlay.cpp | 46 +- .../Source/GameNetwork/IPEnumeration.cpp | 18 +- Core/GameEngine/Source/GameNetwork/LANAPI.cpp | 62 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 18 +- .../Source/GameNetwork/LANAPIhandlers.cpp | 18 +- .../Source/GameNetwork/LANGameInfo.cpp | 14 +- Core/GameEngine/Source/GameNetwork/NAT.cpp | 122 +- .../Source/GameNetwork/NetCommandList.cpp | 106 +- .../Source/GameNetwork/NetCommandMsg.cpp | 30 +- .../Source/GameNetwork/NetCommandRef.cpp | 10 +- .../GameNetwork/NetCommandWrapperList.cpp | 44 +- .../Source/GameNetwork/NetMessageStream.cpp | 48 +- .../Source/GameNetwork/NetPacket.cpp | 82 +- .../GameEngine/Source/GameNetwork/Network.cpp | 66 +- .../Source/GameNetwork/NetworkUtil.cpp | 4 +- .../Source/GameNetwork/Transport.cpp | 10 +- .../GameNetwork/WOLBrowser/WebBrowser.cpp | 30 +- Core/GameEngine/Source/GameNetwork/udp.cpp | 8 +- .../MilesAudioDevice/MilesAudioManager.h | 6 +- .../Include/W3DDevice/GameClient/W3DWater.h | 2 +- .../W3DDevice/GameClient/WorldHeightMap.h | 6 +- .../MilesAudioDevice/MilesAudioManager.cpp | 144 +- .../Source/StdDevice/Common/StdBIGFile.cpp | 16 +- .../StdDevice/Common/StdBIGFileSystem.cpp | 16 +- .../StdDevice/Common/StdLocalFileSystem.cpp | 8 +- .../VideoDevice/Bink/BinkVideoPlayer.cpp | 20 +- .../W3DDevice/Common/System/W3DRadar.cpp | 42 +- .../W3DDevice/GameClient/BaseHeightMap.cpp | 103 +- .../GameClient/CameraShakeSystem.cpp | 2 +- .../GameClient/Drawable/Draw/W3DLaserDraw.cpp | 38 +- .../GameClient/Drawable/Draw/W3DPropDraw.cpp | 4 +- .../GameClient/Drawable/Draw/W3DTreeDraw.cpp | 42 +- .../W3DDevice/GameClient/FlatHeightMap.cpp | 39 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 76 +- .../W3DDevice/GameClient/TerrainTex.cpp | 32 +- .../W3DDevice/GameClient/W3DPropBuffer.cpp | 9 +- .../W3DDevice/GameClient/W3DShaderManager.cpp | 194 +-- .../Source/W3DDevice/GameClient/W3DSmudge.cpp | 10 +- .../Source/W3DDevice/GameClient/W3DSnow.cpp | 10 +- .../GameClient/W3DTerrainBackground.cpp | 39 +- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 44 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 54 +- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 47 +- .../W3DDevice/GameClient/W3DVideoBuffer.cpp | 24 +- .../Source/W3DDevice/GameClient/W3DView.cpp | 66 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 107 +- .../GameClient/Water/W3DWaterTracks.cpp | 50 +- .../W3DDevice/GameClient/WorldHeightMap.cpp | 106 +- .../Win32Device/Common/Win32BIGFile.cpp | 16 +- .../Win32Device/Common/Win32BIGFileSystem.cpp | 16 +- .../Common/Win32LocalFileSystem.cpp | 16 +- Core/Libraries/Include/Lib/BaseTypeCore.h | 5 - .../Source/Compression/CompressionManager.cpp | 10 +- .../Source/Compression/EAC/huffencode.cpp | 4 +- .../Compression/LZHCompress/NoxCompress.cpp | 32 +- .../Source/WWVegas/WW3D2/FramGrab.cpp | 14 +- .../Source/WWVegas/WW3D2/aabtree.cpp | 22 +- Core/Libraries/Source/WWVegas/WW3D2/aabtree.h | 12 +- .../Source/WWVegas/WW3D2/agg_def.cpp | 52 +- .../Source/WWVegas/WW3D2/animatedsoundmgr.cpp | 52 +- .../Source/WWVegas/WW3D2/animatedsoundmgr.h | 2 +- .../Source/WWVegas/WW3D2/bitmaphandler.cpp | 18 +- .../Source/WWVegas/WW3D2/collect.cpp | 24 +- Core/Libraries/Source/WWVegas/WW3D2/coltest.h | 2 +- .../Source/WWVegas/WW3D2/composite.cpp | 10 +- .../Source/WWVegas/WW3D2/decalsys.cpp | 20 +- .../Libraries/Source/WWVegas/WW3D2/decalsys.h | 2 +- .../Source/WWVegas/WW3D2/distlod.cpp | 66 +- Core/Libraries/Source/WWVegas/WW3D2/distlod.h | 2 +- .../Source/WWVegas/WW3D2/dx8texman.h | 6 +- .../Source/WWVegas/WW3D2/dx8webbrowser.cpp | 6 +- .../Source/WWVegas/WW3D2/dynamesh.cpp | 32 +- .../Libraries/Source/WWVegas/WW3D2/dynamesh.h | 8 +- .../Libraries/Source/WWVegas/WW3D2/font3d.cpp | 10 +- Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp | 44 +- Core/Libraries/Source/WWVegas/WW3D2/hanim.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 44 +- .../Source/WWVegas/WW3D2/hmdldef.cpp | 12 +- Core/Libraries/Source/WWVegas/WW3D2/htree.cpp | 64 +- .../Source/WWVegas/WW3D2/intersec.cpp | 4 +- Core/Libraries/Source/WWVegas/WW3D2/layer.cpp | 8 +- .../Libraries/Source/WWVegas/WW3D2/line3d.cpp | 2 +- .../Source/WWVegas/WW3D2/matinfo.cpp | 30 +- Core/Libraries/Source/WWVegas/WW3D2/matinfo.h | 8 +- .../Source/WWVegas/WW3D2/matpass.cpp | 8 +- .../Source/WWVegas/WW3D2/meshdam.cpp | 8 +- .../Source/WWVegas/WW3D2/metalmap.cpp | 14 +- .../Source/WWVegas/WW3D2/missingtexture.cpp | 18 +- Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp | 12 +- Core/Libraries/Source/WWVegas/WW3D2/pivot.h | 2 +- .../Source/WWVegas/WW3D2/pointgr.cpp | 68 +- Core/Libraries/Source/WWVegas/WW3D2/pointgr.h | 20 +- .../Source/WWVegas/WW3D2/predlod.cpp | 22 +- Core/Libraries/Source/WWVegas/WW3D2/proto.cpp | 12 +- Core/Libraries/Source/WWVegas/WW3D2/proto.h | 2 +- Core/Libraries/Source/WWVegas/WW3D2/rddesc.h | 6 +- .../Source/WWVegas/WW3D2/render2dsentence.cpp | 102 +- .../WWVegas/WW3D2/renderobjectrecycler.cpp | 12 +- .../Source/WWVegas/WW3D2/rendobj.cpp | 62 +- Core/Libraries/Source/WWVegas/WW3D2/rendobj.h | 20 +- .../Source/WWVegas/WW3D2/ringobj.cpp | 58 +- Core/Libraries/Source/WWVegas/WW3D2/ringobj.h | 2 +- .../Source/WWVegas/WW3D2/segline.cpp | 2 +- .../Source/WWVegas/WW3D2/seglinerenderer.cpp | 14 +- .../Source/WWVegas/WW3D2/shattersystem.cpp | 40 +- .../Source/WWVegas/WW3D2/soundrobj.cpp | 32 +- .../Source/WWVegas/WW3D2/soundrobj.h | 2 +- .../Source/WWVegas/WW3D2/sphereobj.cpp | 64 +- .../Source/WWVegas/WW3D2/sphereobj.h | 2 +- .../Source/WWVegas/WW3D2/statistics.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/streak.cpp | 4 +- Core/Libraries/Source/WWVegas/WW3D2/streak.h | 6 +- .../Source/WWVegas/WW3D2/streakRender.cpp | 12 +- .../Source/WWVegas/WW3D2/stripoptimizer.cpp | 42 +- .../Source/WWVegas/WW3D2/surfaceclass.cpp | 26 +- .../Source/WWVegas/WW3D2/texproject.cpp | 48 +- .../Source/WWVegas/WW3D2/texproject.h | 8 +- .../Source/WWVegas/WW3D2/texture.cpp | 68 +- Core/Libraries/Source/WWVegas/WW3D2/texture.h | 12 +- .../Source/WWVegas/WW3D2/textureloader.cpp | 118 +- .../Source/WWVegas/WW3D2/textureloader.h | 6 +- .../Source/WWVegas/WW3D2/texturethumbnail.cpp | 18 +- .../Source/WWVegas/WW3D2/visrasterizer.cpp | 30 +- .../Source/WWVegas/WW3D2/w3d_dep.cpp | 6 +- .../Source/WWVegas/WW3D2/w3d_obsolete.h | 12 +- .../Source/WWVegas/WW3D2/w3dexclusionlist.cpp | 4 +- .../WWVegas/WWAudio/AABTreeSoundCullClass.h | 2 +- .../Source/WWVegas/WWAudio/AudibleSound.cpp | 130 +- .../Source/WWVegas/WWAudio/AudioEvents.h | 4 +- .../Source/WWVegas/WWAudio/AudioSaveLoad.cpp | 8 +- .../Source/WWVegas/WWAudio/FilteredSound.cpp | 6 +- .../Source/WWVegas/WWAudio/Listener.cpp | 2 +- .../WWVegas/WWAudio/LogicalListener.cpp | 8 +- .../Source/WWVegas/WWAudio/LogicalSound.cpp | 8 +- .../Source/WWVegas/WWAudio/PriorityVector.h | 2 +- .../Source/WWVegas/WWAudio/Sound3D.cpp | 28 +- .../Source/WWVegas/WWAudio/SoundBuffer.cpp | 20 +- .../Source/WWVegas/WWAudio/SoundCullObj.h | 10 +- .../Source/WWVegas/WWAudio/SoundPseudo3D.cpp | 8 +- .../Source/WWVegas/WWAudio/SoundScene.cpp | 78 +- .../Source/WWVegas/WWAudio/SoundScene.h | 2 +- .../Source/WWVegas/WWAudio/SoundSceneObj.cpp | 28 +- .../Source/WWVegas/WWAudio/SoundSceneObj.h | 16 +- .../Source/WWVegas/WWAudio/Threads.cpp | 26 +- .../Source/WWVegas/WWAudio/Threads.h | 2 +- Core/Libraries/Source/WWVegas/WWAudio/Utils.h | 8 +- .../Source/WWVegas/WWAudio/WWAudio.cpp | 236 +-- .../Source/WWVegas/WWAudio/WWAudio.h | 16 +- .../Source/WWVegas/WWAudio/sound2dhandle.cpp | 12 +- .../Source/WWVegas/WWAudio/sound3dhandle.cpp | 12 +- .../Source/WWVegas/WWAudio/soundhandle.cpp | 6 +- .../Source/WWVegas/WWAudio/soundhandle.h | 14 +- .../WWVegas/WWAudio/soundstreamhandle.cpp | 12 +- .../Source/WWVegas/WWDebug/wwdebug.cpp | 42 +- .../Source/WWVegas/WWDebug/wwmemlog.cpp | 18 +- .../Source/WWVegas/WWDebug/wwprofile.cpp | 52 +- .../Source/WWVegas/WWDownload/Download.cpp | 8 +- .../Source/WWVegas/WWDownload/FTP.cpp | 42 +- .../Source/WWVegas/WWDownload/registry.cpp | 8 +- Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h | 2 +- .../Source/WWVegas/WWLib/DbgHelpLoader.cpp | 92 +- .../Libraries/Source/WWVegas/WWLib/Except.cpp | 90 +- Core/Libraries/Source/WWVegas/WWLib/Except.h | 2 +- .../Source/WWVegas/WWLib/FastAllocator.h | 18 +- .../Libraries/Source/WWVegas/WWLib/HASHLIST.h | 12 +- Core/Libraries/Source/WWVegas/WWLib/INDEX.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/INI.h | 10 +- .../Libraries/Source/WWVegas/WWLib/LISTNODE.h | 16 +- Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/SLIST.h | 62 +- Core/Libraries/Source/WWVegas/WWLib/SLNODE.h | 6 +- .../Libraries/Source/WWVegas/WWLib/Signaler.h | 6 +- Core/Libraries/Source/WWVegas/WWLib/TARGA.cpp | 72 +- Core/Libraries/Source/WWVegas/WWLib/TARGA.h | 8 +- Core/Libraries/Source/WWVegas/WWLib/Vector.h | 30 +- .../Source/WWVegas/WWLib/WWCOMUtil.cpp | 18 +- Core/Libraries/Source/WWVegas/WWLib/WWFILE.h | 6 +- Core/Libraries/Source/WWVegas/WWLib/XPIPE.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/always.h | 7 +- Core/Libraries/Source/WWVegas/WWLib/argv.cpp | 22 +- Core/Libraries/Source/WWVegas/WWLib/argv.h | 4 +- .../Source/WWVegas/WWLib/b64pipe.cpp | 2 +- .../Libraries/Source/WWVegas/WWLib/base64.cpp | 4 +- .../Libraries/Source/WWVegas/WWLib/bfiofile.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/binheap.h | 18 +- Core/Libraries/Source/WWVegas/WWLib/buff.cpp | 12 +- .../Source/WWVegas/WWLib/bufffile.cpp | 10 +- .../Source/WWVegas/WWLib/chunkio.cpp | 8 +- .../Source/WWVegas/WWLib/cpudetect.cpp | 4 +- Core/Libraries/Source/WWVegas/WWLib/crc.cpp | 2 +- .../Source/WWVegas/WWLib/crcstraw.cpp | 2 +- .../Libraries/Source/WWVegas/WWLib/cstraw.cpp | 2 +- .../Source/WWVegas/WWLib/ffactory.cpp | 14 +- Core/Libraries/Source/WWVegas/WWLib/hash.cpp | 22 +- Core/Libraries/Source/WWVegas/WWLib/hash.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/hashtab.h | 2 +- .../Source/WWVegas/WWLib/hashtemplate.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/ini.cpp | 158 +- Core/Libraries/Source/WWVegas/WWLib/inisup.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/lzo.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/lzo1x.h | 2 +- .../Libraries/Source/WWVegas/WWLib/lzo_conf.h | 2 +- .../Source/WWVegas/WWLib/lzopipe.cpp | 16 +- .../Source/WWVegas/WWLib/lzostraw.cpp | 14 +- Core/Libraries/Source/WWVegas/WWLib/mempool.h | 14 +- .../Source/WWVegas/WWLib/multilist.cpp | 8 +- .../Source/WWVegas/WWLib/multilist.h | 18 +- Core/Libraries/Source/WWVegas/WWLib/mutex.cpp | 6 +- Core/Libraries/Source/WWVegas/WWLib/mutex.h | 8 +- .../Libraries/Source/WWVegas/WWLib/notifier.h | 4 +- .../Source/WWVegas/WWLib/nstrdup.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/ntree.h | 52 +- Core/Libraries/Source/WWVegas/WWLib/pipe.cpp | 24 +- .../Source/WWVegas/WWLib/ramfile.cpp | 14 +- .../Source/WWVegas/WWLib/rawfile.cpp | 8 +- .../Libraries/Source/WWVegas/WWLib/rcfile.cpp | 12 +- Core/Libraries/Source/WWVegas/WWLib/rcfile.h | 4 +- .../Source/WWVegas/WWLib/readline.cpp | 4 +- .../Source/WWVegas/WWLib/realcrc.cpp | 4 +- Core/Libraries/Source/WWVegas/WWLib/ref_ptr.h | 2 +- .../Source/WWVegas/WWLib/refcount.cpp | 2 +- .../Source/WWVegas/WWLib/registry.cpp | 50 +- .../Libraries/Source/WWVegas/WWLib/registry.h | 6 +- Core/Libraries/Source/WWVegas/WWLib/search.h | 4 +- .../Libraries/Source/WWVegas/WWLib/sharebuf.h | 2 +- .../Source/WWVegas/WWLib/simplevec.h | 14 +- Core/Libraries/Source/WWVegas/WWLib/straw.cpp | 22 +- .../Source/WWVegas/WWLib/strtok_r.cpp | 4 +- .../Libraries/Source/WWVegas/WWLib/systimer.h | 2 +- .../Source/WWVegas/WWLib/tgatodxt.cpp | 14 +- .../Libraries/Source/WWVegas/WWLib/thread.cpp | 4 +- Core/Libraries/Source/WWVegas/WWLib/thread.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/trect.h | 6 +- Core/Libraries/Source/WWVegas/WWLib/uarray.h | 2 +- .../Libraries/Source/WWVegas/WWLib/vector.cpp | 2 +- .../Libraries/Source/WWVegas/WWLib/verchk.cpp | 8 +- .../Source/WWVegas/WWLib/widestring.cpp | 26 +- .../Source/WWVegas/WWLib/wwstring.cpp | 10 +- .../Libraries/Source/WWVegas/WWLib/wwstring.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/xpipe.cpp | 6 +- .../Libraries/Source/WWVegas/WWLib/xstraw.cpp | 6 +- Core/Libraries/Source/WWVegas/WWMath/aabox.h | 2 +- .../Source/WWVegas/WWMath/aabtreecull.cpp | 66 +- .../Source/WWVegas/WWMath/aabtreecull.h | 2 +- .../Source/WWVegas/WWMath/colmathaabtri.cpp | 4 +- .../Source/WWVegas/WWMath/cullsys.cpp | 24 +- .../Libraries/Source/WWVegas/WWMath/cullsys.h | 4 +- .../Libraries/Source/WWVegas/WWMath/curve.cpp | 10 +- Core/Libraries/Source/WWVegas/WWMath/curve.h | 2 +- .../Source/WWVegas/WWMath/gridcull.cpp | 40 +- .../Source/WWVegas/WWMath/gridcull.h | 6 +- .../Source/WWVegas/WWMath/lineseg.cpp | 4 +- .../Source/WWVegas/WWMath/lookuptable.cpp | 22 +- .../Source/WWVegas/WWMath/lookuptable.h | 4 +- .../Source/WWVegas/WWMath/matrix3d.cpp | 4 +- Core/Libraries/Source/WWVegas/WWMath/obbox.h | 2 +- Core/Libraries/Source/WWVegas/WWMath/ode.cpp | 10 +- Core/Libraries/Source/WWVegas/WWMath/ode.h | 2 +- Core/Libraries/Source/WWVegas/WWMath/quat.cpp | 2 +- Core/Libraries/Source/WWVegas/WWMath/quat.h | 2 +- .../Libraries/Source/WWVegas/WWMath/vector2.h | 2 +- .../Libraries/Source/WWVegas/WWMath/vector3.h | 6 +- .../WWVegas/WWSaveLoad/definitionfactory.cpp | 4 +- .../WWSaveLoad/definitionfactorymgr.cpp | 32 +- .../WWVegas/WWSaveLoad/definitionmgr.cpp | 80 +- .../Source/WWVegas/WWSaveLoad/definitionmgr.h | 2 +- .../Source/WWVegas/WWSaveLoad/editable.h | 2 +- .../Source/WWVegas/WWSaveLoad/parameter.cpp | 82 +- .../Source/WWVegas/WWSaveLoad/parameter.h | 16 +- .../Source/WWVegas/WWSaveLoad/parameterlist.h | 6 +- .../WWVegas/WWSaveLoad/persistfactory.cpp | 2 +- .../WWVegas/WWSaveLoad/persistfactory.h | 2 +- .../WWVegas/WWSaveLoad/pointerremap.cpp | 4 +- .../Source/WWVegas/WWSaveLoad/saveload.cpp | 54 +- .../Source/WWVegas/WWSaveLoad/saveload.h | 4 +- .../WWVegas/WWSaveLoad/saveloadsubsystem.cpp | 2 +- .../Source/WWVegas/WWSaveLoad/twiddler.cpp | 6 +- .../Source/WWVegas/WWStub/wwallocstub.cpp | 3 +- .../Source/WWVegas/WWStub/wwdebugstub.cpp | 3 +- Core/Libraries/Source/debug/debug_cmd.cpp | 6 +- Core/Libraries/Source/debug/debug_debug.cpp | 105 +- Core/Libraries/Source/debug/debug_debug.h | 8 +- .../Source/debug/debug_dlg/debug_dlg.cpp | 4 +- Core/Libraries/Source/debug/debug_except.cpp | 14 +- .../Libraries/Source/debug/debug_internal.cpp | 9 +- Core/Libraries/Source/debug/debug_io.h | 8 +- Core/Libraries/Source/debug/debug_io_con.cpp | 5 +- Core/Libraries/Source/debug/debug_io_flat.cpp | 33 +- Core/Libraries/Source/debug/debug_io_net.cpp | 23 +- Core/Libraries/Source/debug/debug_macro.h | 6 +- Core/Libraries/Source/debug/debug_stack.cpp | 11 +- Core/Libraries/Source/debug/debug_stack.h | 16 +- Core/Libraries/Source/debug/internal.h | 2 +- Core/Libraries/Source/debug/internal_io.h | 4 +- .../Source/debug/netserv/netserv.cpp | 38 +- Core/Libraries/Source/debug/test2/test2.cpp | 10 +- .../Source/profile/internal_funclevel.h | 6 +- .../Source/profile/internal_highlevel.h | 2 +- .../Source/profile/internal_result.h | 2 +- Core/Libraries/Source/profile/profile.cpp | 9 +- Core/Libraries/Source/profile/profile.h | 6 +- Core/Libraries/Source/profile/profile_cmd.cpp | 5 +- .../Source/profile/profile_funclevel.cpp | 41 +- .../Source/profile/profile_funclevel.h | 4 +- .../Source/profile/profile_highlevel.cpp | 27 +- .../Source/profile/profile_highlevel.h | 2 +- .../Source/profile/profile_result.cpp | 11 +- Core/Tools/Autorun/ARGS.cpp | 8 +- Core/Tools/Autorun/CDCNTRL.cpp | 22 +- Core/Tools/Autorun/CallbackHook.h | 2 +- Core/Tools/Autorun/DrawButton.cpp | 14 +- Core/Tools/Autorun/EZGIMEX.cpp | 6 +- Core/Tools/Autorun/GETCD.cpp | 26 +- Core/Tools/Autorun/GameText.cpp | 30 +- Core/Tools/Autorun/IGR.cpp | 8 +- Core/Tools/Autorun/Jsupport.cpp | 2 +- Core/Tools/Autorun/Locale_API.cpp | 30 +- Core/Tools/Autorun/Locale_API.h | 4 +- Core/Tools/Autorun/RECT.h | 6 +- Core/Tools/Autorun/TTFont.cpp | 98 +- Core/Tools/Autorun/TTFont.h | 8 +- Core/Tools/Autorun/Utils.cpp | 62 +- Core/Tools/Autorun/ViewHTML.cpp | 20 +- Core/Tools/Autorun/WSYS_FileSystem.cpp | 2 +- Core/Tools/Autorun/WSYS_FileSystem.h | 2 +- Core/Tools/Autorun/WSYS_RAMFile.cpp | 16 +- Core/Tools/Autorun/WSYS_StdFileSystem.cpp | 2 +- Core/Tools/Autorun/WSYS_file.h | 6 +- Core/Tools/Autorun/WinFix.cpp | 8 +- Core/Tools/Autorun/Wnd_file.cpp | 128 +- Core/Tools/Autorun/autorun.cpp | 276 ++-- Core/Tools/Autorun/autorun.h | 4 +- Core/Tools/Autorun/locale.cpp | 46 +- Core/Tools/Babylon/Babylon.cpp | 12 +- Core/Tools/Babylon/BabylonDlg.cpp | 51 +- Core/Tools/Babylon/BabylonDlg.h | 4 +- Core/Tools/Babylon/DlgProxy.cpp | 6 +- Core/Tools/Babylon/ExportDlg.cpp | 6 +- Core/Tools/Babylon/ExportDlg.h | 2 +- Core/Tools/Babylon/GenerateDlg.cpp | 2 +- Core/Tools/Babylon/GenerateDlg.h | 2 +- Core/Tools/Babylon/MatchDlg.cpp | 16 +- Core/Tools/Babylon/MatchDlg.h | 2 +- Core/Tools/Babylon/ProceedDlg.cpp | 2 +- Core/Tools/Babylon/ProceedDlg.h | 2 +- Core/Tools/Babylon/Report.cpp | 4 +- Core/Tools/Babylon/Report.h | 2 +- Core/Tools/Babylon/RetranslateDlg.cpp | 2 +- Core/Tools/Babylon/RetranslateDlg.h | 2 +- Core/Tools/Babylon/TransDB.cpp | 56 +- Core/Tools/Babylon/TransDB.h | 18 +- Core/Tools/Babylon/VIEWDBSII.cpp | 2 +- Core/Tools/Babylon/VIEWDBSII.h | 2 +- Core/Tools/Babylon/VerifyDlg.cpp | 10 +- Core/Tools/Babylon/VerifyDlg.h | 2 +- Core/Tools/Babylon/VerifyTextDlg.cpp | 2 +- Core/Tools/Babylon/VerifyTextDlg.h | 2 +- Core/Tools/Babylon/ViewDBsDlg.cpp | 2 +- Core/Tools/Babylon/XLStuff.cpp | 40 +- Core/Tools/Babylon/bin.cpp | 18 +- Core/Tools/Babylon/bin.h | 8 +- Core/Tools/Babylon/excel8.cpp | 1294 ++++++++--------- Core/Tools/Babylon/expimp.cpp | 20 +- Core/Tools/Babylon/expimp.h | 10 +- Core/Tools/Babylon/iff.cpp | 12 +- Core/Tools/Babylon/list.cpp | 14 +- Core/Tools/Babylon/loadsave.cpp | 24 +- Core/Tools/Babylon/loadsave.h | 2 +- Core/Tools/Babylon/olestring.cpp | 18 +- Core/Tools/CRCDiff/CRCDiff.cpp | 16 +- Core/Tools/DebugWindow/DebugWindow.cpp | 6 +- Core/Tools/DebugWindow/DebugWindowDialog.cpp | 2 +- Core/Tools/DebugWindow/DebugWindowDialog.h | 2 +- .../ImagePacker/Include/ImageDirectory.h | 6 +- Core/Tools/ImagePacker/Include/TexturePage.h | 2 +- Core/Tools/ImagePacker/Source/ImageInfo.cpp | 12 +- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 92 +- Core/Tools/ImagePacker/Source/TexturePage.cpp | 46 +- Core/Tools/ImagePacker/Source/WinMain.cpp | 12 +- .../WindowProcedures/DirectorySelect.cpp | 2 +- .../WindowProcedures/ImageErrorProc.cpp | 4 +- .../WindowProcedures/ImagePackerProc.cpp | 10 +- .../Source/WindowProcedures/PageErrorProc.cpp | 2 +- .../Source/WindowProcedures/PreviewProc.cpp | 26 +- Core/Tools/Launcher/BFISH.cpp | 4 +- Core/Tools/Launcher/DatGen/DatGen.cpp | 12 +- .../Launcher/Toolkit/Debug/DebugPrint.cpp | 24 +- Core/Tools/Launcher/Toolkit/Storage/File.cpp | 43 +- Core/Tools/Launcher/Toolkit/Support/RefPtr.h | 14 +- .../Toolkit/Support/StringConvert.cpp | 7 +- .../Launcher/Toolkit/Support/UString.cpp | 82 +- Core/Tools/Launcher/Toolkit/Support/UString.h | 2 +- Core/Tools/Launcher/Toolkit/Support/UTypes.h | 4 - Core/Tools/Launcher/configfile.cpp | 2 +- Core/Tools/Launcher/dialog.cpp | 2 +- Core/Tools/Launcher/dictionary.h | 50 +- Core/Tools/Launcher/filed.h | 2 +- Core/Tools/Launcher/findpatch.cpp | 6 +- Core/Tools/Launcher/loadbmp.cpp | 34 +- Core/Tools/Launcher/main.cpp | 20 +- Core/Tools/Launcher/monod.cpp | 12 +- Core/Tools/Launcher/patch.cpp | 75 +- Core/Tools/Launcher/process.cpp | 14 +- Core/Tools/Launcher/process.h | 4 +- Core/Tools/Launcher/streamer.cpp | 4 +- Core/Tools/Launcher/wdebug.cpp | 20 +- Core/Tools/Launcher/wdebug.h | 6 +- Core/Tools/Launcher/wstring.cpp | 46 +- Core/Tools/Launcher/wstypes.h | 4 - Core/Tools/MapCacheBuilder/Source/WinMain.cpp | 44 +- Core/Tools/PATCHGET/CHATAPI.cpp | 106 +- Core/Tools/PATCHGET/COMINIT.cpp | 4 +- Core/Tools/PATCHGET/DownloadManager.cpp | 2 +- Core/Tools/PATCHGET/PROCESS.cpp | 10 +- Core/Tools/PATCHGET/PROCESS.h | 2 +- Core/Tools/PATCHGET/WINBLOWS.cpp | 4 +- Core/Tools/PATCHGET/debug.cpp | 8 +- Core/Tools/PATCHGET/debug.h | 2 +- Core/Tools/PATCHGET/registry.cpp | 8 +- Core/Tools/W3DView/AddToLineupDialog.cpp | 6 +- Core/Tools/W3DView/AddToLineupDialog.h | 2 +- Core/Tools/W3DView/AdvancedAnimSheet.cpp | 16 +- Core/Tools/W3DView/AdvancedAnimSheet.h | 2 +- Core/Tools/W3DView/AggregateNameDialog.cpp | 2 +- Core/Tools/W3DView/AggregateNameDialog.h | 4 +- Core/Tools/W3DView/AmbientLightDialog.cpp | 2 +- Core/Tools/W3DView/AmbientLightDialog.h | 2 +- Core/Tools/W3DView/AnimMixingPage.cpp | 10 +- Core/Tools/W3DView/AnimMixingPage.h | 2 +- Core/Tools/W3DView/AnimReportPage.cpp | 4 +- Core/Tools/W3DView/AnimReportPage.h | 2 +- .../W3DView/AnimatedSoundOptionsDialog.cpp | 4 +- .../W3DView/AnimatedSoundOptionsDialog.h | 2 +- Core/Tools/W3DView/AnimationSpeed.h | 2 +- Core/Tools/W3DView/AssetInfo.cpp | 4 +- Core/Tools/W3DView/AssetInfo.h | 6 +- Core/Tools/W3DView/AssetPropertySheet.h | 6 +- Core/Tools/W3DView/BackgroundBMPDialog.cpp | 4 +- Core/Tools/W3DView/BackgroundBMPDialog.h | 2 +- Core/Tools/W3DView/BackgroundColorDialog.cpp | 2 +- Core/Tools/W3DView/BackgroundColorDialog.h | 2 +- Core/Tools/W3DView/BackgroundObjectDialog.cpp | 6 +- Core/Tools/W3DView/BackgroundObjectDialog.h | 2 +- Core/Tools/W3DView/BoneMgrDialog.cpp | 38 +- Core/Tools/W3DView/BoneMgrDialog.h | 2 +- Core/Tools/W3DView/CameraDistanceDialog.cpp | 4 +- Core/Tools/W3DView/CameraDistanceDialog.h | 2 +- Core/Tools/W3DView/CameraSettingsDialog.cpp | 8 +- Core/Tools/W3DView/CameraSettingsDialog.h | 2 +- Core/Tools/W3DView/ColorBar.cpp | 82 +- Core/Tools/W3DView/ColorBar.h | 2 +- Core/Tools/W3DView/ColorPicker.cpp | 62 +- Core/Tools/W3DView/ColorPicker.h | 2 +- Core/Tools/W3DView/ColorPickerDialogClass.cpp | 24 +- Core/Tools/W3DView/ColorPickerDialogClass.h | 2 +- Core/Tools/W3DView/ColorSelectionDialog.cpp | 2 +- Core/Tools/W3DView/ColorSelectionDialog.h | 2 +- Core/Tools/W3DView/ColorUtils.h | 2 +- Core/Tools/W3DView/DataTreeView.cpp | 178 +-- Core/Tools/W3DView/DataTreeView.h | 2 +- Core/Tools/W3DView/DeviceSelectionDialog.cpp | 2 +- Core/Tools/W3DView/DeviceSelectionDialog.h | 2 +- Core/Tools/W3DView/DirectoryDialog.cpp | 2 +- Core/Tools/W3DView/EditLODDialog.cpp | 4 +- Core/Tools/W3DView/EditLODDialog.h | 2 +- Core/Tools/W3DView/EmitterColorPropPage.cpp | 10 +- Core/Tools/W3DView/EmitterColorPropPage.h | 2 +- Core/Tools/W3DView/EmitterFramePropPage.cpp | 8 +- Core/Tools/W3DView/EmitterGeneralPropPage.cpp | 14 +- Core/Tools/W3DView/EmitterGeneralPropPage.h | 2 +- Core/Tools/W3DView/EmitterInstanceList.cpp | 8 +- .../W3DView/EmitterLineGroupPropPage.cpp | 8 +- Core/Tools/W3DView/EmitterLinePropPage.cpp | 6 +- .../Tools/W3DView/EmitterParticlePropPage.cpp | 6 +- Core/Tools/W3DView/EmitterParticlePropPage.h | 2 +- Core/Tools/W3DView/EmitterPhysicsPropPage.cpp | 10 +- Core/Tools/W3DView/EmitterPhysicsPropPage.h | 2 +- Core/Tools/W3DView/EmitterPropertySheet.cpp | 44 +- Core/Tools/W3DView/EmitterPropertySheet.h | 4 +- .../Tools/W3DView/EmitterRotationPropPage.cpp | 8 +- Core/Tools/W3DView/EmitterSizePropPage.cpp | 8 +- Core/Tools/W3DView/EmitterSizePropPage.h | 2 +- Core/Tools/W3DView/EmitterUserPropPage.cpp | 4 +- Core/Tools/W3DView/EmitterUserPropPage.h | 2 +- Core/Tools/W3DView/GammaDialog.cpp | 2 +- Core/Tools/W3DView/GammaDialog.h | 2 +- Core/Tools/W3DView/Globals.cpp | 2 +- Core/Tools/W3DView/GraphicView.cpp | 64 +- Core/Tools/W3DView/HierarchyPropPage.cpp | 4 +- Core/Tools/W3DView/MainFrm.cpp | 180 +-- Core/Tools/W3DView/MeshPropPage.cpp | 2 +- Core/Tools/W3DView/OpacitySettingsDialog.cpp | 2 +- Core/Tools/W3DView/OpacitySettingsDialog.h | 2 +- Core/Tools/W3DView/OpacityVectorDialog.cpp | 8 +- Core/Tools/W3DView/OpacityVectorDialog.h | 2 +- .../W3DView/ParticleBlurTimeKeyDialog.cpp | 2 +- .../Tools/W3DView/ParticleBlurTimeKeyDialog.h | 2 +- Core/Tools/W3DView/ParticleFrameKeyDialog.cpp | 4 +- Core/Tools/W3DView/ParticleFrameKeyDialog.h | 2 +- .../W3DView/ParticleRotationKeyDialog.cpp | 4 +- .../Tools/W3DView/ParticleRotationKeyDialog.h | 2 +- Core/Tools/W3DView/ParticleSizeDialog.cpp | 2 +- Core/Tools/W3DView/ParticleSizeDialog.h | 2 +- Core/Tools/W3DView/PlaySoundDialog.cpp | 14 +- Core/Tools/W3DView/PlaySoundDialog.h | 2 +- Core/Tools/W3DView/ResolutionDialog.cpp | 2 +- Core/Tools/W3DView/ResolutionDialog.h | 2 +- Core/Tools/W3DView/RestrictedFileDialog.h | 8 +- Core/Tools/W3DView/RingColorPropPage.cpp | 6 +- Core/Tools/W3DView/RingColorPropPage.h | 2 +- Core/Tools/W3DView/RingGeneralPropPage.cpp | 12 +- Core/Tools/W3DView/RingGeneralPropPage.h | 2 +- Core/Tools/W3DView/RingPropertySheet.cpp | 8 +- Core/Tools/W3DView/RingPropertySheet.h | 4 +- Core/Tools/W3DView/RingSizePropPage.cpp | 12 +- Core/Tools/W3DView/RingSizePropPage.h | 2 +- Core/Tools/W3DView/SaveSettingsDialog.cpp | 4 +- Core/Tools/W3DView/SaveSettingsDialog.h | 2 +- Core/Tools/W3DView/ScaleDialog.cpp | 2 +- Core/Tools/W3DView/ScaleDialog.h | 2 +- Core/Tools/W3DView/SceneLightDialog.cpp | 6 +- Core/Tools/W3DView/SceneLightDialog.h | 2 +- Core/Tools/W3DView/ScreenCursor.cpp | 20 +- Core/Tools/W3DView/SoundEditDialog.cpp | 16 +- Core/Tools/W3DView/SoundEditDialog.h | 2 +- Core/Tools/W3DView/SphereColorPropPage.cpp | 14 +- Core/Tools/W3DView/SphereColorPropPage.h | 2 +- Core/Tools/W3DView/SphereGeneralPropPage.cpp | 12 +- Core/Tools/W3DView/SphereGeneralPropPage.h | 2 +- Core/Tools/W3DView/SpherePropertySheet.cpp | 8 +- Core/Tools/W3DView/SpherePropertySheet.h | 4 +- Core/Tools/W3DView/SphereSizePropPage.cpp | 10 +- Core/Tools/W3DView/SphereSizePropPage.h | 2 +- Core/Tools/W3DView/SphereUtils.cpp | 8 +- Core/Tools/W3DView/SphereUtils.h | 2 +- Core/Tools/W3DView/TextureMgrDialog.cpp | 44 +- Core/Tools/W3DView/TextureMgrDialog.h | 14 +- Core/Tools/W3DView/TexturePathDialog.cpp | 2 +- Core/Tools/W3DView/TexturePathDialog.h | 2 +- Core/Tools/W3DView/TextureSettingsDialog.cpp | 40 +- Core/Tools/W3DView/TextureSettingsDialog.h | 2 +- Core/Tools/W3DView/Toolbar.cpp | 10 +- Core/Tools/W3DView/Utils.cpp | 56 +- Core/Tools/W3DView/Utils.h | 8 +- Core/Tools/W3DView/Vector3RndCombo.cpp | 4 +- Core/Tools/W3DView/ViewerScene.cpp | 2 +- Core/Tools/W3DView/VolumeRandomDialog.cpp | 4 +- Core/Tools/W3DView/VolumeRandomDialog.h | 2 +- Core/Tools/W3DView/W3DView.cpp | 26 +- Core/Tools/W3DView/W3DViewDoc.cpp | 256 ++-- Core/Tools/W3DView/W3DViewDoc.h | 18 +- Core/Tools/WW3D/max2w3d/AlphaModifier.cpp | 8 +- Core/Tools/WW3D/max2w3d/AlphaModifier.h | 4 +- Core/Tools/WW3D/max2w3d/AppData.cpp | 20 +- Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp | 16 +- Core/Tools/WW3D/max2w3d/FormClass.cpp | 16 +- Core/Tools/WW3D/max2w3d/FormClass.h | 4 +- Core/Tools/WW3D/max2w3d/GameMtl.cpp | 716 ++++----- Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp | 38 +- Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp | 8 +- Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp | 38 +- .../WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp | 18 +- Core/Tools/WW3D/max2w3d/InputDlg.cpp | 16 +- Core/Tools/WW3D/max2w3d/InputDlg.h | 2 +- Core/Tools/WW3D/max2w3d/MeshDeform.cpp | 84 +- Core/Tools/WW3D/max2w3d/MeshDeform.h | 18 +- Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp | 20 +- Core/Tools/WW3D/max2w3d/MeshDeformPanel.h | 10 +- Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp | 6 +- Core/Tools/WW3D/max2w3d/MeshDeformSave.h | 4 +- Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp | 12 +- Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h | 2 +- Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp | 8 +- Core/Tools/WW3D/max2w3d/MeshDeformSet.h | 12 +- Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp | 14 +- Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp | 4 +- Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp | 20 +- Core/Tools/WW3D/max2w3d/SkinCopy.cpp | 62 +- Core/Tools/WW3D/max2w3d/SnapPoints.cpp | 6 +- Core/Tools/WW3D/max2w3d/TARGA.cpp | 72 +- Core/Tools/WW3D/max2w3d/TARGA.h | 8 +- Core/Tools/WW3D/max2w3d/Utility.cpp | 2 +- Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp | 36 +- Core/Tools/WW3D/max2w3d/aabtreebuilder.h | 6 +- .../max2w3d/animationcompressionsettings.cpp | 10 +- .../max2w3d/animationcompressionsettings.h | 2 +- Core/Tools/WW3D/max2w3d/bchannel.cpp | 8 +- Core/Tools/WW3D/max2w3d/bpick.cpp | 12 +- Core/Tools/WW3D/max2w3d/bpick.h | 6 +- Core/Tools/WW3D/max2w3d/colboxsave.cpp | 2 +- Core/Tools/WW3D/max2w3d/dazzlesave.cpp | 6 +- Core/Tools/WW3D/max2w3d/dllmain.cpp | 12 +- Core/Tools/WW3D/max2w3d/exportlog.cpp | 14 +- Core/Tools/WW3D/max2w3d/floaterdialog.cpp | 16 +- Core/Tools/WW3D/max2w3d/gamemaps.cpp | 6 +- Core/Tools/WW3D/max2w3d/gamemaps.h | 4 +- .../WW3D/max2w3d/genlodextensiondialog.cpp | 8 +- Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp | 10 +- Core/Tools/WW3D/max2w3d/gennamesdialog.cpp | 10 +- .../WW3D/max2w3d/geometryexportcontext.h | 4 +- .../Tools/WW3D/max2w3d/geometryexporttask.cpp | 28 +- Core/Tools/WW3D/max2w3d/gmtldlg.cpp | 100 +- Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp | 10 +- Core/Tools/WW3D/max2w3d/hiersave.cpp | 24 +- Core/Tools/WW3D/max2w3d/hiersave.h | 4 +- Core/Tools/WW3D/max2w3d/hlodsave.cpp | 4 +- Core/Tools/WW3D/max2w3d/hlodsave.h | 4 +- Core/Tools/WW3D/max2w3d/logdlg.cpp | 10 +- Core/Tools/WW3D/max2w3d/maxworldinfo.h | 2 +- Core/Tools/WW3D/max2w3d/meshbuild.cpp | 26 +- Core/Tools/WW3D/max2w3d/meshcon.cpp | 2 +- Core/Tools/WW3D/max2w3d/meshcon.h | 10 +- Core/Tools/WW3D/max2w3d/meshsave.cpp | 70 +- Core/Tools/WW3D/max2w3d/meshsave.h | 2 +- Core/Tools/WW3D/max2w3d/motion.cpp | 16 +- Core/Tools/WW3D/max2w3d/namedsel.cpp | 4 +- Core/Tools/WW3D/max2w3d/nullsave.cpp | 2 +- .../max2w3d/presetexportoptionsdialog.cpp | 38 +- .../WW3D/max2w3d/presetexportoptionsdialog.h | 2 +- Core/Tools/WW3D/max2w3d/rcmenu.cpp | 2 +- Core/Tools/WW3D/max2w3d/simpdib.cpp | 12 +- Core/Tools/WW3D/max2w3d/skin.cpp | 156 +- Core/Tools/WW3D/max2w3d/skin.h | 2 +- Core/Tools/WW3D/max2w3d/util.cpp | 42 +- Core/Tools/WW3D/max2w3d/util.h | 4 +- Core/Tools/WW3D/max2w3d/vchannel.cpp | 16 +- Core/Tools/WW3D/max2w3d/vxl.cpp | 4 +- Core/Tools/WW3D/max2w3d/vxldbg.cpp | 14 +- Core/Tools/WW3D/max2w3d/w3d_file.h | 14 +- Core/Tools/WW3D/max2w3d/w3d_obsolete.h | 12 +- Core/Tools/WW3D/max2w3d/w3dappdata.cpp | 10 +- Core/Tools/WW3D/max2w3d/w3dappdata.h | 2 +- Core/Tools/WW3D/max2w3d/w3ddlg.cpp | 32 +- Core/Tools/WW3D/max2w3d/w3dexp.cpp | 126 +- Core/Tools/WW3D/max2w3d/w3dexp.h | 2 +- Core/Tools/WW3D/max2w3d/w3dmtl.cpp | 68 +- Core/Tools/WW3D/max2w3d/w3dmtl.h | 8 +- Core/Tools/WW3D/max2w3d/w3dutil.cpp | 116 +- Core/Tools/WW3D/pluglib/Vector.h | 18 +- Core/Tools/WW3D/pluglib/always.h | 4 - Core/Tools/WW3D/pluglib/chunkio.cpp | 8 +- Core/Tools/WW3D/pluglib/errclass.h | 10 +- Core/Tools/WW3D/pluglib/matrix3d.cpp | 2 +- Core/Tools/WW3D/pluglib/nodefilt.cpp | 8 +- Core/Tools/WW3D/pluglib/nodelist.cpp | 26 +- Core/Tools/WW3D/pluglib/nodelist.h | 8 +- Core/Tools/WW3D/pluglib/rawfile.cpp | 34 +- Core/Tools/WW3D/pluglib/rawfile.h | 10 +- Core/Tools/WW3D/pluglib/uarray.h | 4 +- Core/Tools/WW3D/pluglib/vector2.h | 2 +- Core/Tools/WW3D/pluglib/vector3.h | 8 +- Core/Tools/WW3D/pluglib/w3d_file.h | 18 +- Core/Tools/WW3D/pluglib/w3dquat.cpp | 2 +- Core/Tools/WW3D/pluglib/w3dquat.h | 2 +- Core/Tools/WW3D/pluglib/wwfile.h | 6 +- .../buildVersionUpdate/buildVersionUpdate.cpp | 16 +- Core/Tools/mangler/mangler.cpp | 4 +- Core/Tools/mangler/manglertest.cpp | 10 +- Core/Tools/mangler/wlib/arraylist.h | 8 +- Core/Tools/mangler/wlib/configfile.cpp | 4 +- Core/Tools/mangler/wlib/configfile.h | 26 +- Core/Tools/mangler/wlib/critsec.cpp | 2 +- Core/Tools/mangler/wlib/critsec.h | 2 +- Core/Tools/mangler/wlib/dictionary.h | 62 +- Core/Tools/mangler/wlib/filed.h | 2 +- Core/Tools/mangler/wlib/linkedlist.h | 34 +- Core/Tools/mangler/wlib/mboxd.h | 2 +- Core/Tools/mangler/wlib/monod.cpp | 12 +- Core/Tools/mangler/wlib/sem4.cpp | 6 +- Core/Tools/mangler/wlib/streamer.cpp | 4 +- Core/Tools/mangler/wlib/threadfac.cpp | 12 +- Core/Tools/mangler/wlib/wdebug.cpp | 24 +- Core/Tools/mangler/wlib/wstring.cpp | 52 +- Core/Tools/mangler/wlib/wstypes.h | 4 - Core/Tools/mangler/wlib/xtime.cpp | 2 +- Core/Tools/mangler/wnet/field.cpp | 20 +- Core/Tools/mangler/wnet/field.h | 2 + Core/Tools/mangler/wnet/packet.cpp | 6 +- Core/Tools/mangler/wnet/tcp.cpp | 20 +- Core/Tools/mangler/wnet/udp.cpp | 8 +- Core/Tools/matchbot/encrypt.cpp | 2 +- Core/Tools/matchbot/generals.cpp | 48 +- Core/Tools/matchbot/global.cpp | 2 +- Core/Tools/matchbot/main.cpp | 18 +- Core/Tools/matchbot/matcher.cpp | 12 +- Core/Tools/matchbot/mydebug.cpp | 8 +- Core/Tools/matchbot/wlib/arraylist.h | 8 +- Core/Tools/matchbot/wlib/configfile.cpp | 4 +- Core/Tools/matchbot/wlib/configfile.h | 26 +- Core/Tools/matchbot/wlib/critsec.cpp | 2 +- Core/Tools/matchbot/wlib/critsec.h | 2 +- Core/Tools/matchbot/wlib/dictionary.h | 62 +- Core/Tools/matchbot/wlib/filed.h | 2 +- Core/Tools/matchbot/wlib/linkedlist.h | 34 +- Core/Tools/matchbot/wlib/mboxd.h | 2 +- Core/Tools/matchbot/wlib/monod.cpp | 12 +- Core/Tools/matchbot/wlib/sem4.cpp | 6 +- Core/Tools/matchbot/wlib/streamer.cpp | 4 +- Core/Tools/matchbot/wlib/threadfac.cpp | 12 +- Core/Tools/matchbot/wlib/wdebug.cpp | 20 +- Core/Tools/matchbot/wlib/wstring.cpp | 52 +- Core/Tools/matchbot/wlib/wstypes.h | 4 - Core/Tools/matchbot/wlib/xtime.cpp | 2 +- Core/Tools/matchbot/wnet/field.cpp | 20 +- Core/Tools/matchbot/wnet/field.h | 2 + Core/Tools/matchbot/wnet/packet.cpp | 6 +- Core/Tools/matchbot/wnet/tcp.cpp | 20 +- Core/Tools/matchbot/wnet/udp.cpp | 8 +- .../Tools/textureCompress/textureCompress.cpp | 22 +- Core/Tools/versionUpdate/versionUpdate.cpp | 12 +- Core/Tools/wolSetup/WOLAPI/chatdefs.h | 2 +- Core/Tools/wolSetup/verchk.cpp | 2 +- Core/Tools/wolSetup/wolInit.cpp | 21 +- Core/Tools/wolSetup/wolSetup.cpp | 9 +- .../Code/GameEngine/Include/Common/BitFlags.h | 8 +- .../GameEngine/Include/Common/BitFlagsIO.h | 10 +- .../Include/Common/CriticalSection.h | 2 +- .../Code/GameEngine/Include/Common/DamageFX.h | 4 +- .../GameEngine/Include/Common/DataChunk.h | 10 +- .../Code/GameEngine/Include/Common/Dict.h | 10 +- .../GameEngine/Include/Common/DrawModule.h | 20 +- .../GameEngine/Include/Common/GameCommon.h | 6 +- .../Code/GameEngine/Include/Common/Geometry.h | 2 +- Generals/Code/GameEngine/Include/Common/INI.h | 4 +- .../GameEngine/Include/Common/INIException.h | 2 +- .../Code/GameEngine/Include/Common/Module.h | 2 +- .../GameEngine/Include/Common/ModuleFactory.h | 2 +- .../Include/Common/NameKeyGenerator.h | 2 +- .../GameEngine/Include/Common/Overridable.h | 8 +- .../Code/GameEngine/Include/Common/Override.h | 6 +- .../GameEngine/Include/Common/PerfTimer.h | 4 +- .../Code/GameEngine/Include/Common/Player.h | 8 +- .../GameEngine/Include/Common/PlayerList.h | 4 +- .../Include/Common/SparseMatchFinder.h | 10 +- .../GameEngine/Include/Common/StackDump.h | 4 +- .../GameEngine/Include/Common/StateMachine.h | 8 +- .../Include/Common/SubsystemInterface.h | 2 +- .../Code/GameEngine/Include/Common/Team.h | 8 +- .../GameEngine/Include/Common/TerrainTypes.h | 2 +- .../Code/GameEngine/Include/Common/Thing.h | 16 +- .../GameEngine/Include/Common/ThingSort.h | 2 +- .../GameEngine/Include/Common/ThingTemplate.h | 18 +- .../GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Include/GameClient/CommandXlat.h | 4 +- .../Include/GameClient/ControlBar.h | 48 +- .../GameEngine/Include/GameClient/Credits.h | 2 +- .../GameEngine/Include/GameClient/Display.h | 8 +- .../GameEngine/Include/GameClient/Drawable.h | 10 +- .../Include/GameClient/DrawableInfo.h | 2 +- .../GameEngine/Include/GameClient/FXList.h | 14 +- .../Include/GameClient/GadgetComboBox.h | 6 +- .../Include/GameClient/GadgetListBox.h | 6 +- .../Include/GameClient/GadgetPushButton.h | 12 +- .../Include/GameClient/GadgetSlider.h | 12 +- .../Include/GameClient/GameClient.h | 40 +- .../GameEngine/Include/GameClient/GameFont.h | 2 +- .../GameEngine/Include/GameClient/GameText.h | 4 +- .../Include/GameClient/GameWindow.h | 2 +- .../Include/GameClient/GameWindowManager.h | 50 +- .../GameClient/GameWindowTransitions.h | 4 +- .../GameEngine/Include/GameClient/Image.h | 4 +- .../GameEngine/Include/GameClient/InGameUI.h | 8 +- .../GameEngine/Include/GameClient/Keyboard.h | 2 +- .../GameEngine/Include/GameClient/Line2D.h | 4 +- .../GameEngine/Include/GameClient/MetaEvent.h | 10 +- .../GameEngine/Include/GameClient/Mouse.h | 2 +- .../Include/GameClient/ParticleSys.h | 30 +- .../GameEngine/Include/GameClient/Shadow.h | 2 +- .../Include/GameClient/WindowLayout.h | 6 +- .../Code/GameEngine/Include/GameLogic/AI.h | 6 +- .../GameEngine/Include/GameLogic/AIGuard.h | 4 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 20 +- .../GameEngine/Include/GameLogic/AIPlayer.h | 10 +- .../Include/GameLogic/AIStateMachine.h | 18 +- .../GameEngine/Include/GameLogic/AITNGuard.h | 4 +- .../Code/GameEngine/Include/GameLogic/Armor.h | 4 +- .../GameEngine/Include/GameLogic/ArmorSet.h | 4 +- .../GameEngine/Include/GameLogic/Damage.h | 4 +- .../GameEngine/Include/GameLogic/GameLogic.h | 4 +- .../GameEngine/Include/GameLogic/Locomotor.h | 8 +- .../Include/GameLogic/LocomotorSet.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 32 +- .../Module/AssaultTransportAIUpdate.h | 4 +- .../Module/AssistedTargetingUpdate.h | 4 +- .../GameLogic/Module/AutoDepositUpdate.h | 6 +- .../GameLogic/Module/AutoHealBehavior.h | 24 +- .../GameLogic/Module/BattlePlanUpdate.h | 2 +- .../Include/GameLogic/Module/BehaviorModule.h | 68 +- .../Include/GameLogic/Module/BodyModule.h | 6 +- .../Include/GameLogic/Module/BoneFXUpdate.h | 204 +-- .../Include/GameLogic/Module/CaveContain.h | 2 +- .../GameLogic/Module/CheckpointUpdate.h | 2 +- .../Include/GameLogic/Module/CollideModule.h | 2 +- .../Module/ConvertToCarBombCrateCollide.h | 4 +- .../Include/GameLogic/Module/CreateCrateDie.h | 2 +- .../Include/GameLogic/Module/CrushDie.h | 12 +- .../Include/GameLogic/Module/DamageModule.h | 2 +- .../Module/DefaultProductionExitUpdate.h | 6 +- .../Include/GameLogic/Module/DelayedUpgrade.h | 2 +- .../Include/GameLogic/Module/DeletionUpdate.h | 4 +- .../GameLogic/Module/DeliverPayloadAIUpdate.h | 24 +- .../GameLogic/Module/DeployStyleAIUpdate.h | 10 +- .../Include/GameLogic/Module/DockUpdate.h | 4 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 4 +- .../Include/GameLogic/Module/EMPUpdate.h | 24 +- .../GameLogic/Module/EnemyNearUpdate.h | 2 +- .../Include/GameLogic/Module/FXListDie.h | 6 +- .../GameLogic/Module/FireWeaponCollide.h | 2 +- .../Module/FireWeaponWhenDamagedBehavior.h | 38 +- .../Module/FireWeaponWhenDeadBehavior.h | 6 +- .../GameLogic/Module/GarrisonContain.h | 10 +- .../GameLogic/Module/HackInternetAIUpdate.h | 18 +- .../Include/GameLogic/Module/HijackerUpdate.h | 4 +- .../GameLogic/Module/HiveStructureBody.h | 4 +- .../Include/GameLogic/Module/HordeUpdate.h | 2 +- .../Include/GameLogic/Module/LifetimeUpdate.h | 4 +- .../Module/MissileLauncherBuildingUpdate.h | 26 +- .../GameLogic/Module/MobMemberSlavedUpdate.h | 8 +- .../GameLogic/Module/MoneyCrateCollide.h | 2 +- .../GameLogic/Module/OCLSpecialPower.h | 2 +- .../Include/GameLogic/Module/OpenContain.h | 4 +- .../GameLogic/Module/OverlordContain.h | 2 +- .../GameLogic/Module/POWTruckAIUpdate.h | 4 +- .../GameLogic/Module/ParkingPlaceBehavior.h | 14 +- .../Module/ParticleUplinkCannonUpdate.h | 2 +- .../Include/GameLogic/Module/PhysicsUpdate.h | 2 +- .../GameLogic/Module/PowerPlantUpdate.h | 2 +- .../GameLogic/Module/PrisonDockUpdate.h | 2 +- .../GameLogic/Module/ProductionUpdate.h | 2 +- .../Module/QueueProductionExitUpdate.h | 12 +- .../Include/GameLogic/Module/RadarUpdate.h | 2 +- .../GameLogic/Module/RadiusDecalUpdate.h | 4 +- .../Module/RailedTransportDockUpdate.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 36 +- .../GameLogic/Module/RebuildHoleBehavior.h | 2 +- .../GameLogic/Module/RepairDockUpdate.h | 2 +- .../GameLogic/Module/SalvageCrateCollide.h | 10 +- .../Include/GameLogic/Module/SlavedUpdate.h | 38 +- .../GameLogic/Module/SlowDeathBehavior.h | 2 +- .../Include/GameLogic/Module/SpawnBehavior.h | 20 +- .../Module/SpawnPointProductionExitUpdate.h | 4 +- .../GameLogic/Module/SpecialAbilityUpdate.h | 70 +- .../Module/SpecialPowerCompletionDie.h | 4 +- .../Module/SpecialPowerUpdateModule.h | 2 +- .../GameLogic/Module/StealthDetectorUpdate.h | 8 +- .../Include/GameLogic/Module/StealthUpdate.h | 8 +- .../GameLogic/Module/StickyBombUpdate.h | 4 +- .../GameLogic/Module/StructureToppleUpdate.h | 12 +- .../GameLogic/Module/SupplyCenterDockUpdate.h | 2 +- .../Module/SupplyCenterProductionExitUpdate.h | 6 +- .../GameLogic/Module/SupplyTruckAIUpdate.h | 10 +- .../Module/SupplyWarehouseDockUpdate.h | 2 +- .../GameLogic/Module/TransitionDamageFX.h | 228 +-- .../Include/GameLogic/Module/TunnelContain.h | 2 +- .../GameLogic/Module/UnitCrateCollide.h | 4 +- .../Include/GameLogic/Module/UpdateModule.h | 6 +- .../Include/GameLogic/Module/UpgradeDie.h | 2 +- .../Include/GameLogic/Module/UpgradeModule.h | 10 +- .../GameLogic/Module/VeterancyCrateCollide.h | 6 +- .../Include/GameLogic/Module/WorkerAIUpdate.h | 18 +- .../GameEngine/Include/GameLogic/Object.h | 12 +- .../Include/GameLogic/ObjectCreationList.h | 18 +- .../GameEngine/Include/GameLogic/ObjectIter.h | 8 +- .../Include/GameLogic/PartitionManager.h | 40 +- .../Include/GameLogic/PolygonTrigger.h | 4 +- .../GameEngine/Include/GameLogic/Powers.h | 2 +- .../Include/GameLogic/ScriptActions.h | 2 +- .../Include/GameLogic/ScriptEngine.h | 8 +- .../GameEngine/Include/GameLogic/Scripts.h | 6 +- .../GameEngine/Include/GameLogic/SidesList.h | 18 +- .../Include/GameLogic/TerrainLogic.h | 14 +- .../GameEngine/Include/GameLogic/TurretAI.h | 2 +- .../GameEngine/Include/GameLogic/Weapon.h | 28 +- .../GameEngine/Include/GameLogic/WeaponSet.h | 4 +- .../Include/GameNetwork/GameSpyChat.h | 2 +- .../GameEngine/Source/Common/BitFlags.cpp | 4 +- .../GameEngine/Source/Common/CommandLine.cpp | 18 +- .../GameEngine/Source/Common/DamageFX.cpp | 22 +- .../Code/GameEngine/Source/Common/Dict.cpp | 38 +- .../GameEngine/Source/Common/GameEngine.cpp | 126 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 84 +- .../GameEngine/Source/Common/GameMain.cpp | 4 +- .../GameEngine/Source/Common/GlobalData.cpp | 844 +++++------ .../Code/GameEngine/Source/Common/INI/INI.cpp | 72 +- .../Source/Common/INI/INIAnimation.cpp | 2 +- .../Source/Common/INI/INICommandButton.cpp | 2 +- .../Source/Common/INI/INIDrawGroupInfo.cpp | 30 +- .../Source/Common/INI/INIMapCache.cpp | 58 +- .../Source/Common/INI/INIMappedImage.cpp | 2 +- .../Source/Common/INI/INIMultiplayer.cpp | 2 +- .../Source/Common/INI/INIParticleSys.cpp | 2 +- .../Source/Common/INI/INITerrain.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 2 +- .../Source/Common/INI/INITerrainRoad.cpp | 2 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 6 +- .../Source/Common/INI/INIWebpageURL.cpp | 6 +- .../Source/Common/MessageStream.cpp | 50 +- .../Code/GameEngine/Source/Common/MiniLog.cpp | 2 +- .../Source/Common/MultiplayerSettings.cpp | 32 +- .../Source/Common/NameKeyGenerator.cpp | 6 +- .../GameEngine/Source/Common/PerfTimer.cpp | 30 +- .../Source/Common/RTS/ActionManager.cpp | 64 +- .../GameEngine/Source/Common/RTS/Energy.cpp | 14 +- .../GameEngine/Source/Common/RTS/Money.cpp | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 176 +-- .../Source/Common/RTS/PlayerList.cpp | 24 +- .../Source/Common/RTS/PlayerTemplate.cpp | 92 +- .../Common/RTS/ProductionPrerequisite.cpp | 8 +- .../Common/RTS/ResourceGatheringManager.cpp | 32 +- .../GameEngine/Source/Common/RTS/Science.cpp | 24 +- .../Source/Common/RTS/ScoreKeeper.cpp | 4 +- .../Source/Common/RTS/SpecialPower.cpp | 40 +- .../GameEngine/Source/Common/RTS/Team.cpp | 114 +- .../Source/Common/RTS/TunnelTracker.cpp | 18 +- .../GameEngine/Source/Common/Recorder.cpp | 82 +- .../GameEngine/Source/Common/StateMachine.cpp | 26 +- .../Source/Common/StatsCollector.cpp | 2 +- .../Source/Common/System/BuildAssistant.cpp | 74 +- .../Source/Common/System/CDManager.cpp | 6 +- .../Source/Common/System/CriticalSection.cpp | 10 +- .../Source/Common/System/DataChunk.cpp | 64 +- .../Source/Common/System/DisabledTypes.cpp | 2 +- .../Source/Common/System/FunctionLexicon.cpp | 48 +- .../Source/Common/System/GameCommon.cpp | 4 +- .../Source/Common/System/GameType.cpp | 4 +- .../Source/Common/System/KindOf.cpp | 2 +- .../GameEngine/Source/Common/System/List.cpp | 20 +- .../Common/System/SaveGame/GameState.cpp | 58 +- .../Common/System/SaveGame/GameStateMap.cpp | 18 +- .../Source/Common/System/StackDump.cpp | 46 +- .../Source/Common/System/Upgrade.cpp | 44 +- .../Source/Common/System/encrypt.cpp | 2 +- .../Source/Common/System/registry.cpp | 8 +- .../GameEngine/Source/Common/TerrainTypes.cpp | 18 +- .../GameEngine/Source/Common/Thing/Module.cpp | 6 +- .../Source/Common/Thing/ModuleFactory.cpp | 32 +- .../GameEngine/Source/Common/Thing/Thing.cpp | 4 +- .../Source/Common/Thing/ThingFactory.cpp | 24 +- .../Source/Common/Thing/ThingTemplate.cpp | 290 ++-- .../Source/Common/UserPreferences.cpp | 4 +- .../Code/GameEngine/Source/Common/version.cpp | 2 +- .../Source/GameClient/ClientInstance.cpp | 16 +- .../GameEngine/Source/GameClient/Credits.cpp | 34 +- .../GameEngine/Source/GameClient/Display.cpp | 36 +- .../Source/GameClient/DisplayString.cpp | 8 +- .../GameClient/DisplayStringManager.cpp | 12 +- .../Source/GameClient/DrawGroupInfo.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 234 +-- .../Drawable/Update/BeaconClientUpdate.cpp | 8 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 32 +- .../GameEngine/Source/GameClient/FXList.cpp | 136 +- .../GameClient/GUI/AnimateWindowManager.cpp | 14 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 420 +++--- .../GUI/ControlBar/ControlBarBeacon.cpp | 6 +- .../GUI/ControlBar/ControlBarCommand.cpp | 84 +- .../ControlBarCommandProcessing.cpp | 54 +- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 24 +- .../GUI/ControlBar/ControlBarOCLTimer.cpp | 6 +- .../GUI/ControlBar/ControlBarObserver.cpp | 56 +- .../ControlBar/ControlBarPrintPositions.cpp | 2 +- .../GUI/ControlBar/ControlBarResizer.cpp | 30 +- .../GUI/ControlBar/ControlBarScheme.cpp | 402 ++--- .../ControlBarStructureInventory.cpp | 2 +- .../ControlBarUnderConstruction.cpp | 4 +- .../GUI/DisconnectMenu/DisconnectMenu.cpp | 90 +- .../EstablishConnectionsMenu.cpp | 20 +- .../GUI/GUICallbacks/ControlBarCallback.cpp | 16 +- .../ControlBarPopupDescription.cpp | 28 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 60 +- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 16 +- .../GUI/GUICallbacks/GeneralsExpPoints.cpp | 2 +- .../GUI/GUICallbacks/IMECandidate.cpp | 12 +- .../GUI/GUICallbacks/InGameChat.cpp | 22 +- .../GUI/GUICallbacks/InGamePopupMessage.cpp | 8 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 6 +- .../GUICallbacks/Menus/DifficultySelect.cpp | 14 +- .../GUICallbacks/Menus/DisconnectWindow.cpp | 46 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 38 +- .../Menus/EstablishConnectionsWindow.cpp | 48 +- .../GUI/GUICallbacks/Menus/GameInfoWindow.cpp | 20 +- .../Menus/KeyboardOptionsMenu.cpp | 34 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 101 +- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 74 +- .../GUICallbacks/Menus/LanMapSelectMenu.cpp | 41 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 116 +- .../GUI/GUICallbacks/Menus/MapSelectMenu.cpp | 16 +- .../Menus/NetworkDirectConnect.cpp | 36 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 182 +-- .../GUICallbacks/Menus/PopupCommunicator.cpp | 8 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 30 +- .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 14 +- .../GUICallbacks/Menus/PopupLadderSelect.cpp | 34 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 182 +-- .../GUI/GUICallbacks/Menus/PopupReplay.cpp | 48 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 52 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 76 +- .../GUI/GUICallbacks/Menus/ReplayMenu.cpp | 70 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 66 +- .../GUICallbacks/Menus/SinglePlayerMenu.cpp | 8 +- .../Menus/SkirmishGameOptionsMenu.cpp | 126 +- .../Menus/SkirmishMapSelectMenu.cpp | 27 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 88 +- .../Menus/WOLCustomScoreScreen.cpp | 12 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 191 ++- .../GUICallbacks/Menus/WOLLadderScreen.cpp | 12 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 70 +- .../Menus/WOLLocaleSelectPopup.cpp | 12 +- .../GUI/GUICallbacks/Menus/WOLLoginMenu.cpp | 144 +- .../GUICallbacks/Menus/WOLMapSelectMenu.cpp | 33 +- .../GUICallbacks/Menus/WOLMessageWindow.cpp | 8 +- .../GUICallbacks/Menus/WOLQMScoreScreen.cpp | 14 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 98 +- .../GUI/GUICallbacks/Menus/WOLStatusMenu.cpp | 14 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 108 +- .../GUI/GUICallbacks/MessageBox.cpp | 16 +- .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 2 +- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 38 +- .../GUI/Gadget/GadgetHorizontalSlider.cpp | 4 +- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 78 +- .../GUI/Gadget/GadgetProgressBar.cpp | 2 +- .../GUI/Gadget/GadgetPushButton.cpp | 40 +- .../GUI/Gadget/GadgetRadioButton.cpp | 6 +- .../GUI/Gadget/GadgetStaticText.cpp | 2 +- .../GUI/Gadget/GadgetTabControl.cpp | 10 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 26 +- .../GUI/Gadget/GadgetVerticalSlider.cpp | 4 +- .../Source/GameClient/GUI/GameFont.cpp | 26 +- .../Source/GameClient/GUI/GameWindow.cpp | 62 +- .../GameClient/GUI/GameWindowGlobal.cpp | 6 +- .../GameClient/GUI/GameWindowManager.cpp | 354 ++--- .../GUI/GameWindowManagerScript.cpp | 330 ++--- .../GameClient/GUI/GameWindowTransitions.cpp | 92 +- .../GUI/GameWindowTransitionsStyles.cpp | 82 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 28 +- .../Source/GameClient/GUI/IMEManager.cpp | 92 +- .../Source/GameClient/GUI/LoadScreen.cpp | 162 +-- .../GameClient/GUI/ProcessAnimateWindow.cpp | 110 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 78 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 38 +- .../Source/GameClient/GUI/WinInstanceData.cpp | 28 +- .../Source/GameClient/GUI/WindowLayout.cpp | 40 +- .../Source/GameClient/GameClient.cpp | 92 +- .../GameEngine/Source/GameClient/GameText.cpp | 64 +- .../Source/GameClient/GlobalLanguage.cpp | 54 +- .../Source/GameClient/GraphDraw.cpp | 2 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 494 +++---- .../Source/GameClient/Input/Keyboard.cpp | 8 +- .../Source/GameClient/Input/Mouse.cpp | 104 +- .../Source/GameClient/LanguageFilter.cpp | 10 +- .../GameEngine/Source/GameClient/Line2D.cpp | 4 +- .../GameClient/MessageStream/CommandXlat.cpp | 192 +-- .../MessageStream/GUICommandTranslator.cpp | 36 +- .../GameClient/MessageStream/HotKey.cpp | 4 +- .../GameClient/MessageStream/LookAtXlat.cpp | 16 +- .../GameClient/MessageStream/MetaEvent.cpp | 14 +- .../MessageStream/PlaceEventTranslator.cpp | 16 +- .../MessageStream/SelectionXlat.cpp | 42 +- .../GameClient/MessageStream/WindowXlat.cpp | 4 +- .../Source/GameClient/RadiusDecal.cpp | 34 +- .../Source/GameClient/SelectionInfo.cpp | 12 +- .../Source/GameClient/System/Anim2D.cpp | 82 +- .../GameClient/System/CampaignManager.cpp | 72 +- .../Source/GameClient/System/Image.cpp | 24 +- .../Source/GameClient/System/ParticleSys.cpp | 304 ++-- .../Source/GameClient/System/RayEffect.cpp | 24 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 180 +-- .../GameEngine/Source/GameLogic/AI/AIDock.cpp | 80 +- .../Source/GameLogic/AI/AIGroup.cpp | 104 +- .../Source/GameLogic/AI/AIGuard.cpp | 42 +- .../Source/GameLogic/AI/AIPathfind.cpp | 588 ++++---- .../Source/GameLogic/AI/AIPlayer.cpp | 158 +- .../Source/GameLogic/AI/AISkirmishPlayer.cpp | 40 +- .../Source/GameLogic/AI/AIStates.cpp | 336 ++--- .../Source/GameLogic/AI/AITNGuard.cpp | 70 +- .../GameEngine/Source/GameLogic/AI/Squad.cpp | 2 +- .../Source/GameLogic/AI/TurretAI.cpp | 102 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 24 +- .../Source/GameLogic/Map/SidesList.cpp | 106 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 124 +- .../Source/GameLogic/Object/Armor.cpp | 6 +- .../Object/Behavior/AutoHealBehavior.cpp | 2 +- .../Object/Behavior/BridgeBehavior.cpp | 88 +- .../Behavior/BridgeScaffoldBehavior.cpp | 8 +- .../Object/Behavior/BridgeTowerBehavior.cpp | 26 +- .../Behavior/DumbProjectileBehavior.cpp | 42 +- .../FireWeaponWhenDamagedBehavior.cpp | 24 +- .../Behavior/GenerateMinefieldBehavior.cpp | 32 +- .../Object/Behavior/InstantDeathBehavior.cpp | 18 +- .../Object/Behavior/JetSlowDeathBehavior.cpp | 66 +- .../Object/Behavior/MinefieldBehavior.cpp | 30 +- .../Object/Behavior/OverchargeBehavior.cpp | 6 +- .../Object/Behavior/POWTruckBehavior.cpp | 4 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 42 +- .../Object/Behavior/PoisonedBehavior.cpp | 6 +- .../Object/Behavior/PrisonBehavior.cpp | 20 +- .../Behavior/PropagandaCenterBehavior.cpp | 6 +- .../Behavior/PropagandaTowerBehavior.cpp | 38 +- .../Object/Behavior/RebuildHoleBehavior.cpp | 40 +- .../Object/Behavior/SlowDeathBehavior.cpp | 48 +- .../Object/Behavior/SpawnBehavior.cpp | 48 +- .../SupplyWarehouseCripplingBehavior.cpp | 10 +- .../Object/Behavior/TechBuildingBehavior.cpp | 10 +- .../GameLogic/Object/Body/ActiveBody.cpp | 22 +- .../GameLogic/Object/Body/InactiveBody.cpp | 4 +- .../ConvertToHijackedVehicleCrateCollide.cpp | 2 +- .../Collide/CrateCollide/CrateCollide.cpp | 36 +- .../CrateCollide/SalvageCrateCollide.cpp | 4 +- .../Collide/CrateCollide/UnitCrateCollide.cpp | 2 +- .../CrateCollide/VeterancyCrateCollide.cpp | 4 +- .../Object/Collide/FireWeaponCollide.cpp | 18 +- .../Object/Collide/SquishCollide.cpp | 4 +- .../GameLogic/Object/Contain/CaveContain.cpp | 26 +- .../Object/Contain/GarrisonContain.cpp | 64 +- .../GameLogic/Object/Contain/HealContain.cpp | 4 +- .../Object/Contain/MobNexusContain.cpp | 24 +- .../GameLogic/Object/Contain/OpenContain.cpp | 70 +- .../Object/Contain/OverlordContain.cpp | 44 +- .../Object/Contain/ParachuteContain.cpp | 46 +- .../Object/Contain/RailedTransportContain.cpp | 10 +- .../Object/Contain/TransportContain.cpp | 32 +- .../Object/Contain/TunnelContain.cpp | 26 +- .../Object/Create/GrantUpgradeCreate.cpp | 6 +- .../Object/Create/SupplyCenterCreate.cpp | 6 +- .../Object/Create/SupplyWarehouseCreate.cpp | 6 +- .../Object/Create/VeterancyGainCreate.cpp | 4 +- .../GameLogic/Object/Damage/BoneFXDamage.cpp | 4 +- .../Object/Damage/TransitionDamageFX.cpp | 28 +- .../GameLogic/Object/Die/CreateCrateDie.cpp | 18 +- .../GameLogic/Object/Die/CreateObjectDie.cpp | 6 +- .../Source/GameLogic/Object/Die/CrushDie.cpp | 2 +- .../Source/GameLogic/Object/Die/DieModule.cpp | 10 +- .../GameLogic/Object/Die/EjectPilotDie.cpp | 12 +- .../Object/Die/RebuildHoleExposeDie.cpp | 8 +- .../Source/GameLogic/Object/FiringTracker.cpp | 2 +- .../Source/GameLogic/Object/GhostObject.cpp | 10 +- .../Source/GameLogic/Object/Locomotor.cpp | 144 +- .../Source/GameLogic/Object/Object.cpp | 204 +-- .../GameLogic/Object/ObjectCreationList.cpp | 236 +-- .../GameLogic/Object/PartitionManager.cpp | 214 +-- .../GameLogic/Object/SimpleObjectIterator.cpp | 20 +- .../SpecialPower/BaikonurLaunchPower.cpp | 4 +- .../Object/SpecialPower/CashBountyPower.cpp | 12 +- .../SpecialPower/CashHackSpecialPower.cpp | 12 +- .../Object/SpecialPower/CleanupAreaPower.cpp | 4 +- .../SpecialPower/DefectorSpecialPower.cpp | 4 +- .../SpecialPower/DemoralizeSpecialPower.cpp | 20 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 18 +- .../Object/SpecialPower/SpecialAbility.cpp | 2 +- .../SpecialPower/SpecialPowerModule.cpp | 34 +- .../SpecialPower/SpyVisionSpecialPower.cpp | 8 +- .../GameLogic/Object/Update/AIUpdate.cpp | 188 +-- .../AIUpdate/AssaultTransportAIUpdate.cpp | 10 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 80 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 76 +- .../Update/AIUpdate/DeployStyleAIUpdate.cpp | 10 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 118 +- .../Update/AIUpdate/HackInternetAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 124 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 60 +- .../Update/AIUpdate/POWTruckAIUpdate.cpp | 44 +- .../AIUpdate/RailedTransportAIUpdate.cpp | 18 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 40 +- .../Update/AIUpdate/SupplyTruckAIUpdate.cpp | 48 +- .../Update/AIUpdate/TransportAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 82 +- .../Object/Update/AssistedTargetingUpdate.cpp | 8 +- .../Object/Update/AutoFindHealingUpdate.cpp | 16 +- .../Object/Update/BaseRenerateUpdate.cpp | 2 +- .../Object/Update/BattlePlanUpdate.cpp | 72 +- .../GameLogic/Object/Update/BoneFXUpdate.cpp | 52 +- .../Object/Update/CheckpointUpdate.cpp | 6 +- .../Object/Update/CleanupHazardUpdate.cpp | 14 +- .../Object/Update/CommandButtonHuntUpdate.cpp | 36 +- .../Update/DelayedWeaponSetUpgradeUpdate.cpp | 2 +- .../Object/Update/DemoTrapUpdate.cpp | 18 +- .../Object/Update/DockUpdate/DockUpdate.cpp | 32 +- .../Update/DockUpdate/PrisonDockUpdate.cpp | 2 +- .../DockUpdate/RailedTransportDockUpdate.cpp | 22 +- .../Update/DockUpdate/RepairDockUpdate.cpp | 6 +- .../DockUpdate/SupplyCenterDockUpdate.cpp | 10 +- .../DockUpdate/SupplyWarehouseDockUpdate.cpp | 6 +- .../Update/DynamicGeometryInfoUpdate.cpp | 20 +- .../DynamicShroudClearingRangeUpdate.cpp | 18 +- .../GameLogic/Object/Update/EMPUpdate.cpp | 10 +- .../Object/Update/EnemyNearUpdate.cpp | 2 +- .../FireOCLAfterWeaponCooldownUpdate.cpp | 12 +- .../Object/Update/FireSpreadUpdate.cpp | 20 +- .../Object/Update/FireWeaponUpdate.cpp | 10 +- .../FirestormDynamicGeometryInfoUpdate.cpp | 52 +- .../Object/Update/FlammableUpdate.cpp | 22 +- .../GameLogic/Object/Update/FloatUpdate.cpp | 4 +- .../Object/Update/HeightDieUpdate.cpp | 18 +- .../Update/HelicopterSlowDeathUpdate.cpp | 86 +- .../Object/Update/HijackerUpdate.cpp | 12 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 26 +- .../GameLogic/Object/Update/LaserUpdate.cpp | 18 +- .../Object/Update/MobMemberSlavedUpdate.cpp | 8 +- .../Update/NeutronMissileSlowDeathUpdate.cpp | 198 +-- .../Object/Update/NeutronMissileUpdate.cpp | 54 +- .../GameLogic/Object/Update/OCLUpdate.cpp | 12 +- .../Update/ParticleUplinkCannonUpdate.cpp | 126 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 72 +- .../Object/Update/PilotFindVehicleUpdate.cpp | 14 +- .../Object/Update/PointDefenseLaserUpdate.cpp | 24 +- .../QueueProductionExitUpdate.cpp | 2 +- .../SpawnPointProductionExitUpdate.cpp | 8 +- .../Object/Update/ProductionUpdate.cpp | 78 +- .../Object/Update/ProjectileStreamUpdate.cpp | 4 +- .../GameLogic/Object/Update/ProneUpdate.cpp | 4 +- .../GameLogic/Object/Update/SlavedUpdate.cpp | 6 +- .../Object/Update/SpecialAbilityUpdate.cpp | 22 +- .../Object/Update/SpyVisionUpdate.cpp | 4 +- .../Object/Update/StealthDetectorUpdate.cpp | 38 +- .../GameLogic/Object/Update/StealthUpdate.cpp | 44 +- .../Object/Update/StickyBombUpdate.cpp | 2 +- .../Object/Update/StructureCollapseUpdate.cpp | 30 +- .../Object/Update/StructureToppleUpdate.cpp | 64 +- .../Object/Update/TensileFormationUpdate.cpp | 18 +- .../GameLogic/Object/Update/ToppleUpdate.cpp | 32 +- .../Object/Update/WaveGuideUpdate.cpp | 38 +- .../Object/Upgrade/ActiveShroudUpgrade.cpp | 4 +- .../Object/Upgrade/CommandSetUpgrade.cpp | 4 +- .../Object/Upgrade/CostModifierUpgrade.cpp | 6 +- .../Object/Upgrade/DelayedUpgrade.cpp | 4 +- .../Upgrade/ExperienceScalarUpgrade.cpp | 4 +- .../Object/Upgrade/MaxHealthUpgrade.cpp | 4 +- .../Object/Upgrade/ObjectCreationUpgrade.cpp | 8 +- .../GameLogic/Object/Upgrade/RadarUpgrade.cpp | 4 +- .../Object/Upgrade/StatusBitsUpgrade.cpp | 6 +- .../Object/Upgrade/SubObjectsUpgrade.cpp | 6 +- .../Upgrade/UnpauseSpecialPowerUpgrade.cpp | 6 +- .../Source/GameLogic/Object/Weapon.cpp | 274 ++-- .../Source/GameLogic/Object/WeaponSet.cpp | 62 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 152 +- .../ScriptEngine/ScriptConditions.cpp | 58 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 276 ++-- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 180 +-- .../ScriptEngine/VictoryConditions.cpp | 12 +- .../Source/GameLogic/System/CaveSystem.cpp | 18 +- .../Source/GameLogic/System/CrateSystem.cpp | 24 +- .../Source/GameLogic/System/GameLogic.cpp | 138 +- .../GameLogic/System/GameLogicDispatch.cpp | 98 +- .../Source/GameLogic/System/RankInfo.cpp | 14 +- .../GameEngine/Source/GameNetwork/GUIUtil.cpp | 12 +- .../GameEngine/Source/GameNetwork/GameSpy.cpp | 102 +- .../Source/GameNetwork/GameSpyChat.cpp | 2 +- .../Source/GameNetwork/GameSpyGP.cpp | 4 +- .../Source/GameNetwork/GameSpyGameInfo.cpp | 36 +- .../GameNetwork/GameSpyPersistentStorage.cpp | 8 +- .../GameClient/Module/W3DModelDraw.h | 2 +- .../W3DDevice/GameClient/W3DAssetManager.h | 2 +- .../W3DDevice/GameClient/W3DBufferManager.h | 4 +- .../Include/W3DDevice/GameClient/W3DShadow.h | 2 +- .../Include/W3DDevice/GameClient/W3DShroud.h | 2 +- .../GameClient/W3DVolumetricShadow.h | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.h | 4 +- .../Common/System/W3DFunctionLexicon.cpp | 4 +- .../Drawable/Draw/W3DDebrisDraw.cpp | 38 +- .../Drawable/Draw/W3DDefaultDraw.cpp | 8 +- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 4 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 270 ++-- .../Drawable/Draw/W3DOverlordTankDraw.cpp | 3 +- .../Drawable/Draw/W3DPoliceCarDraw.cpp | 11 +- .../Drawable/Draw/W3DProjectileStreamDraw.cpp | 20 +- .../Drawable/Draw/W3DScienceModelDraw.cpp | 4 +- .../Drawable/Draw/W3DSupplyDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 37 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 70 +- .../Drawable/Draw/W3DTracerDraw.cpp | 4 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 74 +- .../GUI/GUICallbacks/W3DControlBar.cpp | 27 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 14 +- .../GameClient/GUI/Gadget/W3DCheckBox.cpp | 4 +- .../GUI/Gadget/W3DHorizontalSlider.cpp | 8 +- .../GameClient/GUI/Gadget/W3DProgressBar.cpp | 8 +- .../GameClient/GUI/Gadget/W3DPushButton.cpp | 12 +- .../GameClient/GUI/Gadget/W3DRadioButton.cpp | 6 +- .../GameClient/GUI/Gadget/W3DStaticText.cpp | 2 +- .../GameClient/GUI/Gadget/W3DTabControl.cpp | 18 +- .../GameClient/GUI/Gadget/W3DTextEntry.cpp | 2 +- .../GUI/Gadget/W3DVerticalSlider.cpp | 4 +- .../W3DDevice/GameClient/GUI/W3DGameFont.cpp | 6 +- .../GameClient/GUI/W3DGameWindow.cpp | 8 +- .../GameClient/Shadow/W3DBufferManager.cpp | 78 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 178 +-- .../W3DDevice/GameClient/Shadow/W3DShadow.cpp | 12 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 206 +-- .../W3DDevice/GameClient/W3DAssetManager.cpp | 56 +- .../W3DDevice/GameClient/W3DBibBuffer.cpp | 7 +- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 83 +- .../W3DDevice/GameClient/W3DCustomEdging.cpp | 11 +- .../W3DDevice/GameClient/W3DDebugDisplay.cpp | 4 +- .../W3DDevice/GameClient/W3DDebugIcons.cpp | 10 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 88 +- .../W3DDevice/GameClient/W3DDisplayString.cpp | 8 +- .../GameClient/W3DDisplayStringManager.cpp | 16 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 16 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 6 +- .../W3DDevice/GameClient/W3DInGameUI.cpp | 30 +- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 34 +- .../W3DDevice/GameClient/W3DParticleSys.cpp | 16 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 113 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 62 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 38 +- .../W3DDevice/GameClient/W3DStatusCircle.cpp | 16 +- .../W3DDevice/GameClient/W3DWebBrowser.cpp | 4 +- .../GameClient/W3dWaypointBuffer.cpp | 7 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 76 +- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 4 +- .../Win32Device/Common/Win32CDManager.cpp | 2 +- .../Win32Device/Common/Win32GameEngine.cpp | 9 +- .../Win32Device/Common/Win32OSDisplay.cpp | 4 +- .../GameClient/Win32DIKeyboard.cpp | 18 +- .../Win32Device/GameClient/Win32DIMouse.cpp | 22 +- .../Win32Device/GameClient/Win32Mouse.cpp | 8 +- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 32 +- .../Source/WWVegas/WW3D2/aabtreebuilder.h | 6 +- .../Source/WWVegas/WW3D2/animobj.cpp | 60 +- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 2 +- .../Source/WWVegas/WW3D2/assetmgr.cpp | 98 +- .../Libraries/Source/WWVegas/WW3D2/assetmgr.h | 2 +- .../Source/WWVegas/WW3D2/boxrobj.cpp | 12 +- .../Libraries/Source/WWVegas/WW3D2/camera.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/camera.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 76 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.h | 4 +- .../Source/WWVegas/WW3D2/ddsfile.cpp | 11 +- .../Source/WWVegas/WW3D2/decalmsh.cpp | 4 +- .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 8 +- .../Source/WWVegas/WW3D2/dx8renderer.cpp | 132 +- .../Source/WWVegas/WW3D2/dx8renderer.h | 6 +- .../Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 22 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 286 ++-- .../Source/WWVegas/WW3D2/dx8wrapper.h | 8 +- .../Source/WWVegas/WW3D2/hanimmgr.cpp | 26 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 188 +-- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 56 +- .../Source/WWVegas/WW3D2/hrawanim.cpp | 96 +- .../Source/WWVegas/WW3D2/htreemgr.cpp | 16 +- .../Source/WWVegas/WW3D2/matrixmapper.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/mesh.cpp | 56 +- .../Libraries/Source/WWVegas/WW3D2/mesh.h | 2 +- .../Source/WWVegas/WW3D2/meshbuild.cpp | 22 +- .../Source/WWVegas/WW3D2/meshgeometry.cpp | 70 +- .../Source/WWVegas/WW3D2/meshgeometry.h | 6 +- .../Source/WWVegas/WW3D2/meshmatdesc.cpp | 106 +- .../Source/WWVegas/WW3D2/meshmatdesc.h | 48 +- .../Source/WWVegas/WW3D2/meshmdl.cpp | 58 +- .../Libraries/Source/WWVegas/WW3D2/meshmdl.h | 2 +- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 84 +- .../Source/WWVegas/WW3D2/motchan.cpp | 24 +- .../Source/WWVegas/WW3D2/part_buf.cpp | 287 ++-- .../Libraries/Source/WWVegas/WW3D2/part_buf.h | 6 +- .../Source/WWVegas/WW3D2/part_emt.cpp | 46 +- .../Libraries/Source/WWVegas/WW3D2/part_emt.h | 16 +- .../Source/WWVegas/WW3D2/part_ldr.cpp | 62 +- .../Source/WWVegas/WW3D2/render2d.cpp | 8 +- .../Libraries/Source/WWVegas/WW3D2/render2d.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/rinfo.cpp | 10 +- .../Libraries/Source/WWVegas/WW3D2/scene.cpp | 12 +- .../Source/WWVegas/WW3D2/sortingrenderer.cpp | 38 +- .../Source/WWVegas/WW3D2/vertmaterial.cpp | 30 +- .../Source/WWVegas/WW3D2/vertmaterial.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 42 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 4 +- Generals/Code/Main/WinMain.cpp | 46 +- .../Tools/GUIEdit/Include/GUIEditDisplay.h | 2 +- .../GUIEdit/Include/GUIEditWindowManager.h | 4 +- .../Dialog Procedures/CallbackEditor.cpp | 24 +- .../Dialog Procedures/CheckBoxProperties.cpp | 4 +- .../Source/Dialog Procedures/ColorDialog.cpp | 66 +- .../Dialog Procedures/ComboBoxProperties.cpp | 8 +- .../Dialog Procedures/GenericProperties.cpp | 10 +- .../Source/Dialog Procedures/GridSettings.cpp | 6 +- .../Dialog Procedures/ListboxProperties.cpp | 27 +- .../ProgressBarProperties.cpp | 4 +- .../PushButtonProperties.cpp | 4 +- .../RadioButtonProperties.cpp | 14 +- .../Dialog Procedures/SliderProperties.cpp | 10 +- .../StaticTextProperties.cpp | 4 +- .../TabControlProperties.cpp | 14 +- .../Dialog Procedures/TextEntryProperties.cpp | 6 +- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 64 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 236 +-- .../GUIEdit/Source/GUIEditWindowManager.cpp | 74 +- .../Tools/GUIEdit/Source/HierarchyView.cpp | 140 +- .../Tools/GUIEdit/Source/LayoutScheme.cpp | 70 +- .../Code/Tools/GUIEdit/Source/Properties.cpp | 630 ++++---- Generals/Code/Tools/GUIEdit/Source/Save.cpp | 32 +- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 28 +- .../Tools/ParticleEditor/CColorAlphaDialog.h | 2 +- .../ParticleEditor/CParticleEditorPage.h | 2 +- .../Tools/ParticleEditor/CSwitchesDialog.h | 2 +- .../Tools/ParticleEditor/EmissionTypePanels.h | 10 +- .../Tools/ParticleEditor/ISwapablePanel.h | 2 +- .../Tools/ParticleEditor/MoreParmsDialog.h | 2 +- .../Tools/ParticleEditor/ParticleEditor.cpp | 8 +- .../ParticleEditor/ParticleEditorDialog.cpp | 10 +- .../ParticleEditor/ParticleEditorDialog.h | 2 +- .../Tools/ParticleEditor/ParticleTypePanels.h | 6 +- .../Tools/ParticleEditor/VelocityTypePanels.h | 10 +- .../WorldBuilder/include/BaseBuildProps.h | 2 +- .../WorldBuilder/include/BlendMaterial.h | 2 +- .../Tools/WorldBuilder/include/BuildList.h | 2 +- .../include/CFixTeamOwnerDialog.h | 2 +- .../Tools/WorldBuilder/include/CUndoable.h | 4 +- .../WorldBuilder/include/CameraOptions.h | 2 +- .../Tools/WorldBuilder/include/CellWidth.h | 2 +- .../WorldBuilder/include/ContourOptions.h | 2 +- .../Tools/WorldBuilder/include/EditAction.h | 2 +- .../WorldBuilder/include/EditCondition.h | 2 +- .../WorldBuilder/include/EditCoordParameter.h | 2 +- .../Tools/WorldBuilder/include/EditGroup.h | 2 +- .../include/EditObjectParameter.h | 2 +- .../WorldBuilder/include/EditParameter.h | 4 +- .../include/ExportScriptsOptions.h | 2 +- .../WorldBuilder/include/FeatherOptions.h | 2 +- .../Tools/WorldBuilder/include/FenceOptions.h | 2 +- .../WorldBuilder/include/GlobalLightOptions.h | 2 +- .../Tools/WorldBuilder/include/GroveOptions.h | 2 +- .../WorldBuilder/include/ImpassableOptions.h | 2 +- .../Tools/WorldBuilder/include/LayersList.h | 8 +- .../Tools/WorldBuilder/include/LightOptions.h | 2 +- .../Tools/WorldBuilder/include/MapSettings.h | 2 +- .../WorldBuilder/include/MeshMoldOptions.h | 2 +- .../Tools/WorldBuilder/include/MoundOptions.h | 2 +- .../Tools/WorldBuilder/include/NewHeightMap.h | 2 +- .../WorldBuilder/include/ObjectOptions.h | 2 +- .../Code/Tools/WorldBuilder/include/OpenMap.h | 2 +- .../Tools/WorldBuilder/include/OptionsPanel.h | 2 +- .../WorldBuilder/include/PickUnitDialog.h | 6 +- .../Tools/WorldBuilder/include/RampOptions.h | 2 +- .../Tools/WorldBuilder/include/RoadOptions.h | 2 +- .../Code/Tools/WorldBuilder/include/SaveMap.h | 2 +- .../WorldBuilder/include/ScorchOptions.h | 2 +- .../Tools/WorldBuilder/include/ScriptDialog.h | 2 +- .../WorldBuilder/include/SelectMacrotexture.h | 2 +- .../WorldBuilder/include/ShadowOptions.h | 2 +- .../WorldBuilder/include/TerrainMaterial.h | 2 +- .../Tools/WorldBuilder/include/TerrainModal.h | 2 +- .../Code/Tools/WorldBuilder/include/Tool.h | 2 +- .../Tools/WorldBuilder/include/WBFrameWnd.h | 8 +- .../WorldBuilder/include/WHeightMapEdit.h | 6 +- .../Tools/WorldBuilder/include/WaterOptions.h | 2 +- .../WorldBuilder/include/WaypointOptions.h | 4 +- .../Tools/WorldBuilder/include/WorldBuilder.h | 2 +- .../WorldBuilder/include/WorldBuilderDoc.h | 2 +- .../WorldBuilder/include/WorldBuilderView.h | 2 +- .../WorldBuilder/include/addplayerdialog.h | 2 +- .../Tools/WorldBuilder/include/brushoptions.h | 2 +- .../Tools/WorldBuilder/include/euladialog.h | 2 +- .../WorldBuilder/include/mapobjectprops.h | 2 +- .../WorldBuilder/include/playerlistdlg.h | 2 +- .../Tools/WorldBuilder/include/propedit.h | 2 +- .../Tools/WorldBuilder/include/teamsdialog.h | 2 +- .../Code/Tools/WorldBuilder/include/wbview.h | 6 +- .../Tools/WorldBuilder/include/wbview3d.h | 2 +- .../Tools/WorldBuilder/src/BaseBuildProps.cpp | 2 +- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 12 +- .../Code/Tools/WorldBuilder/src/BrushTool.cpp | 4 +- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 50 +- .../Tools/WorldBuilder/src/BuildListTool.cpp | 28 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 140 +- .../Tools/WorldBuilder/src/CameraOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/CellWidth.cpp | 2 +- .../Tools/WorldBuilder/src/ContourOptions.cpp | 2 +- .../Tools/WorldBuilder/src/DrawObject.cpp | 94 +- .../Tools/WorldBuilder/src/EditAction.cpp | 2 +- .../Tools/WorldBuilder/src/EditCondition.cpp | 2 +- .../WorldBuilder/src/EditCoordParameter.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditGroup.cpp | 2 +- .../WorldBuilder/src/EditObjectParameter.cpp | 8 +- .../Tools/WorldBuilder/src/EditParameter.cpp | 98 +- .../Tools/WorldBuilder/src/EulaDialog.cpp | 2 +- .../WorldBuilder/src/ExportScriptsOptions.cpp | 2 +- .../Tools/WorldBuilder/src/FeatherOptions.cpp | 4 +- .../Tools/WorldBuilder/src/FeatherTool.cpp | 6 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 20 +- .../Code/Tools/WorldBuilder/src/FenceTool.cpp | 32 +- .../Tools/WorldBuilder/src/FloodFillTool.cpp | 4 +- .../WorldBuilder/src/GlobalLightOptions.cpp | 2 +- .../Tools/WorldBuilder/src/GroveOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/GroveTool.cpp | 34 +- .../Tools/WorldBuilder/src/LayersList.cpp | 24 +- .../Tools/WorldBuilder/src/LightOptions.cpp | 8 +- .../Code/Tools/WorldBuilder/src/MainFrm.cpp | 74 +- .../Tools/WorldBuilder/src/MapPreview.cpp | 2 +- .../Tools/WorldBuilder/src/MapSettings.cpp | 2 +- .../WorldBuilder/src/MeshMoldOptions.cpp | 8 +- .../Tools/WorldBuilder/src/MeshMoldTool.cpp | 8 +- .../Tools/WorldBuilder/src/MoundOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/MoundTool.cpp | 4 +- .../Code/Tools/WorldBuilder/src/MyToolbar.cpp | 10 +- .../Tools/WorldBuilder/src/NewHeightMap.cpp | 2 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 44 +- .../Tools/WorldBuilder/src/ObjectPreview.cpp | 16 +- .../Tools/WorldBuilder/src/ObjectTool.cpp | 14 +- .../Code/Tools/WorldBuilder/src/OpenMap.cpp | 12 +- .../Tools/WorldBuilder/src/OptionsPanel.cpp | 2 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 26 +- .../Tools/WorldBuilder/src/PointerTool.cpp | 30 +- .../Tools/WorldBuilder/src/PolygonTool.cpp | 32 +- .../Tools/WorldBuilder/src/RampOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/RampTool.cpp | 8 +- .../Tools/WorldBuilder/src/RoadOptions.cpp | 16 +- .../Code/Tools/WorldBuilder/src/RoadTool.cpp | 36 +- .../Code/Tools/WorldBuilder/src/SaveMap.cpp | 18 +- .../Tools/WorldBuilder/src/ScorchOptions.cpp | 10 +- .../Tools/WorldBuilder/src/ScorchTool.cpp | 6 +- .../WorldBuilder/src/ScriptActionsFalse.cpp | 16 +- .../WorldBuilder/src/ScriptActionsTrue.cpp | 16 +- .../WorldBuilder/src/ScriptConditions.cpp | 36 +- .../Tools/WorldBuilder/src/ScriptDialog.cpp | 114 +- .../WorldBuilder/src/ScriptProperties.cpp | 2 +- .../WorldBuilder/src/SelectMacrotexture.cpp | 4 +- .../Tools/WorldBuilder/src/ShadowOptions.cpp | 2 +- .../Tools/WorldBuilder/src/SplashScreen.cpp | 2 +- .../Tools/WorldBuilder/src/TeamGeneric.cpp | 8 +- .../WorldBuilder/src/TeamReinforcement.cpp | 2 +- .../WorldBuilder/src/TerrainMaterial.cpp | 16 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 12 +- .../Code/Tools/WorldBuilder/src/TileTool.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/Tool.cpp | 4 +- .../Tools/WorldBuilder/src/WBFrameWnd.cpp | 2 +- .../Tools/WorldBuilder/src/WBHeightMap.cpp | 2 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 26 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 98 +- .../Tools/WorldBuilder/src/WaterOptions.cpp | 8 +- .../Code/Tools/WorldBuilder/src/WaterTool.cpp | 4 +- .../WorldBuilder/src/WaypointOptions.cpp | 18 +- .../Tools/WorldBuilder/src/WaypointTool.cpp | 12 +- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 64 +- .../WorldBuilder/src/WorldBuilderDoc.cpp | 132 +- .../WorldBuilder/src/WorldBuilderView.cpp | 10 +- .../WorldBuilder/src/addplayerdialog.cpp | 2 +- .../Tools/WorldBuilder/src/brushoptions.cpp | 4 +- .../Tools/WorldBuilder/src/mapobjectprops.cpp | 28 +- .../Tools/WorldBuilder/src/playerlistdlg.cpp | 2 +- .../Tools/WorldBuilder/src/teamsdialog.cpp | 6 +- .../Code/Tools/WorldBuilder/src/wbview.cpp | 42 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 188 +-- .../Code/GameEngine/Include/Common/BitFlags.h | 8 +- .../GameEngine/Include/Common/BitFlagsIO.h | 10 +- .../Include/Common/CriticalSection.h | 2 +- .../Code/GameEngine/Include/Common/DamageFX.h | 4 +- .../GameEngine/Include/Common/DataChunk.h | 10 +- .../Code/GameEngine/Include/Common/Dict.h | 10 +- .../GameEngine/Include/Common/DrawModule.h | 20 +- .../GameEngine/Include/Common/GameCommon.h | 6 +- .../Code/GameEngine/Include/Common/Geometry.h | 2 +- .../Code/GameEngine/Include/Common/INI.h | 4 +- .../GameEngine/Include/Common/INIException.h | 2 +- .../Code/GameEngine/Include/Common/Module.h | 4 +- .../GameEngine/Include/Common/ModuleFactory.h | 2 +- .../Include/Common/NameKeyGenerator.h | 2 +- .../GameEngine/Include/Common/Overridable.h | 8 +- .../Code/GameEngine/Include/Common/Override.h | 6 +- .../GameEngine/Include/Common/PerfTimer.h | 4 +- .../Code/GameEngine/Include/Common/Player.h | 8 +- .../GameEngine/Include/Common/PlayerList.h | 4 +- .../Include/Common/SparseMatchFinder.h | 10 +- .../GameEngine/Include/Common/StackDump.h | 4 +- .../GameEngine/Include/Common/StateMachine.h | 8 +- .../Include/Common/SubsystemInterface.h | 2 +- .../Code/GameEngine/Include/Common/Team.h | 8 +- .../GameEngine/Include/Common/TerrainTypes.h | 2 +- .../Code/GameEngine/Include/Common/Thing.h | 16 +- .../GameEngine/Include/Common/ThingSort.h | 2 +- .../GameEngine/Include/Common/ThingTemplate.h | 20 +- .../GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Include/GameClient/ChallengeGenerals.h | 4 +- .../Include/GameClient/CommandXlat.h | 4 +- .../Include/GameClient/ControlBar.h | 50 +- .../GameEngine/Include/GameClient/Credits.h | 2 +- .../GameEngine/Include/GameClient/Display.h | 8 +- .../GameEngine/Include/GameClient/Drawable.h | 12 +- .../Include/GameClient/DrawableInfo.h | 2 +- .../GameEngine/Include/GameClient/FXList.h | 14 +- .../Include/GameClient/GadgetComboBox.h | 6 +- .../Include/GameClient/GadgetListBox.h | 6 +- .../Include/GameClient/GadgetPushButton.h | 12 +- .../Include/GameClient/GadgetSlider.h | 12 +- .../Include/GameClient/GameClient.h | 46 +- .../GameEngine/Include/GameClient/GameFont.h | 2 +- .../GameEngine/Include/GameClient/GameText.h | 4 +- .../Include/GameClient/GameWindow.h | 2 +- .../Include/GameClient/GameWindowManager.h | 50 +- .../GameClient/GameWindowTransitions.h | 4 +- .../GameEngine/Include/GameClient/Image.h | 4 +- .../GameEngine/Include/GameClient/InGameUI.h | 8 +- .../GameEngine/Include/GameClient/Keyboard.h | 2 +- .../GameEngine/Include/GameClient/Line2D.h | 4 +- .../GameEngine/Include/GameClient/MetaEvent.h | 10 +- .../GameEngine/Include/GameClient/Mouse.h | 2 +- .../Include/GameClient/ParticleSys.h | 28 +- .../GameEngine/Include/GameClient/Shadow.h | 2 +- .../Include/GameClient/WindowLayout.h | 6 +- .../Code/GameEngine/Include/GameLogic/AI.h | 6 +- .../GameEngine/Include/GameLogic/AIGuard.h | 6 +- .../Include/GameLogic/AIGuardRetaliate.h | 2 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 20 +- .../GameEngine/Include/GameLogic/AIPlayer.h | 10 +- .../Include/GameLogic/AIStateMachine.h | 20 +- .../GameEngine/Include/GameLogic/AITNGuard.h | 4 +- .../Code/GameEngine/Include/GameLogic/Armor.h | 4 +- .../GameEngine/Include/GameLogic/ArmorSet.h | 4 +- .../GameEngine/Include/GameLogic/Damage.h | 4 +- .../GameEngine/Include/GameLogic/GameLogic.h | 6 +- .../GameEngine/Include/GameLogic/Locomotor.h | 8 +- .../Include/GameLogic/LocomotorSet.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 36 +- .../Module/AnimationSteeringUpdate.h | 2 +- .../Module/AssaultTransportAIUpdate.h | 4 +- .../GameLogic/Module/AutoDepositUpdate.h | 10 +- .../GameLogic/Module/AutoHealBehavior.h | 28 +- .../GameLogic/Module/BattlePlanUpdate.h | 2 +- .../Include/GameLogic/Module/BehaviorModule.h | 76 +- .../Include/GameLogic/Module/BodyModule.h | 6 +- .../Include/GameLogic/Module/BoneFXUpdate.h | 204 +-- .../Include/GameLogic/Module/CaveContain.h | 2 +- .../GameLogic/Module/CheckpointUpdate.h | 2 +- .../Include/GameLogic/Module/CollideModule.h | 2 +- .../Module/ConvertToCarBombCrateCollide.h | 4 +- .../Module/CountermeasuresBehavior.h | 24 +- .../Include/GameLogic/Module/CreateCrateDie.h | 2 +- .../Include/GameLogic/Module/CrushDie.h | 12 +- .../Include/GameLogic/Module/DamageModule.h | 2 +- .../Module/DefaultProductionExitUpdate.h | 8 +- .../Include/GameLogic/Module/DeletionUpdate.h | 4 +- .../GameLogic/Module/DeliverPayloadAIUpdate.h | 24 +- .../GameLogic/Module/DeployStyleAIUpdate.h | 12 +- .../Include/GameLogic/Module/DockUpdate.h | 4 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 4 +- .../Include/GameLogic/Module/EMPUpdate.h | 42 +- .../GameLogic/Module/EnemyNearUpdate.h | 2 +- .../Include/GameLogic/Module/FXListDie.h | 8 +- .../GameLogic/Module/FireWeaponCollide.h | 2 +- .../Module/FireWeaponWhenDamagedBehavior.h | 38 +- .../Module/FireWeaponWhenDeadBehavior.h | 6 +- .../GameLogic/Module/FlightDeckBehavior.h | 6 +- .../GameLogic/Module/GarrisonContain.h | 12 +- .../GameLogic/Module/GrantStealthBehavior.h | 12 +- .../GameLogic/Module/HackInternetAIUpdate.h | 20 +- .../Include/GameLogic/Module/HijackerUpdate.h | 4 +- .../GameLogic/Module/HiveStructureBody.h | 4 +- .../Include/GameLogic/Module/HordeUpdate.h | 2 +- .../Include/GameLogic/Module/LifetimeUpdate.h | 4 +- .../Module/MissileLauncherBuildingUpdate.h | 26 +- .../GameLogic/Module/MobMemberSlavedUpdate.h | 8 +- .../GameLogic/Module/MoneyCrateCollide.h | 4 +- .../GameLogic/Module/NeutronBlastBehavior.h | 6 +- .../GameLogic/Module/OCLSpecialPower.h | 2 +- .../Include/GameLogic/Module/OpenContain.h | 4 +- .../GameLogic/Module/OverlordContain.h | 2 +- .../GameLogic/Module/POWTruckAIUpdate.h | 4 +- .../GameLogic/Module/ParkingPlaceBehavior.h | 24 +- .../Module/ParticleUplinkCannonUpdate.h | 2 +- .../Include/GameLogic/Module/PhysicsUpdate.h | 2 +- .../GameLogic/Module/PowerPlantUpdate.h | 2 +- .../GameLogic/Module/PrisonDockUpdate.h | 2 +- .../GameLogic/Module/ProductionUpdate.h | 2 +- .../Module/QueueProductionExitUpdate.h | 12 +- .../Include/GameLogic/Module/RadarUpdate.h | 2 +- .../GameLogic/Module/RadiusDecalUpdate.h | 4 +- .../Module/RailedTransportDockUpdate.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 36 +- .../GameLogic/Module/RebuildHoleBehavior.h | 2 +- .../GameLogic/Module/RepairDockUpdate.h | 2 +- .../SabotageInternetCenterCrateCollide.h | 2 +- .../SabotageMilitaryFactoryCrateCollide.h | 2 +- .../Module/SabotagePowerPlantCrateCollide.h | 2 +- .../Module/SabotageSupplyCenterCrateCollide.h | 2 +- .../SabotageSupplyDropzoneCrateCollide.h | 2 +- .../GameLogic/Module/SalvageCrateCollide.h | 10 +- .../Include/GameLogic/Module/SlavedUpdate.h | 38 +- .../GameLogic/Module/SlowDeathBehavior.h | 2 +- .../Module/SmartBombTargetHomingUpdate.h | 2 +- .../Include/GameLogic/Module/SpawnBehavior.h | 22 +- .../Module/SpawnPointProductionExitUpdate.h | 4 +- .../GameLogic/Module/SpecialAbilityUpdate.h | 76 +- .../Module/SpecialPowerCompletionDie.h | 4 +- .../GameLogic/Module/SpecialPowerModule.h | 2 +- .../Module/SpecialPowerUpdateModule.h | 4 +- .../Module/SpectreGunshipDeploymentUpdate.h | 2 +- .../GameLogic/Module/SpectreGunshipUpdate.h | 2 +- .../GameLogic/Module/SpyVisionUpdate.h | 10 +- .../GameLogic/Module/StealthDetectorUpdate.h | 8 +- .../Include/GameLogic/Module/StealthUpdate.h | 4 +- .../GameLogic/Module/StickyBombUpdate.h | 14 +- .../GameLogic/Module/StructureToppleUpdate.h | 12 +- .../GameLogic/Module/SupplyCenterDockUpdate.h | 2 +- .../Module/SupplyCenterProductionExitUpdate.h | 8 +- .../GameLogic/Module/SupplyTruckAIUpdate.h | 10 +- .../Module/SupplyWarehouseDockUpdate.h | 2 +- .../GameLogic/Module/TransitionDamageFX.h | 228 +-- .../Include/GameLogic/Module/TunnelContain.h | 2 +- .../GameLogic/Module/UnitCrateCollide.h | 4 +- .../Include/GameLogic/Module/UpdateModule.h | 6 +- .../Include/GameLogic/Module/UpgradeDie.h | 2 +- .../Include/GameLogic/Module/UpgradeModule.h | 12 +- .../GameLogic/Module/VeterancyCrateCollide.h | 6 +- .../Include/GameLogic/Module/WorkerAIUpdate.h | 20 +- .../GameEngine/Include/GameLogic/Object.h | 12 +- .../Include/GameLogic/ObjectCreationList.h | 18 +- .../GameEngine/Include/GameLogic/ObjectIter.h | 8 +- .../Include/GameLogic/PartitionManager.h | 40 +- .../Include/GameLogic/PolygonTrigger.h | 4 +- .../GameEngine/Include/GameLogic/Powers.h | 2 +- .../Include/GameLogic/ScriptActions.h | 2 +- .../Include/GameLogic/ScriptEngine.h | 8 +- .../GameEngine/Include/GameLogic/Scripts.h | 6 +- .../GameEngine/Include/GameLogic/SidesList.h | 18 +- .../Include/GameLogic/TerrainLogic.h | 14 +- .../GameEngine/Include/GameLogic/TurretAI.h | 2 +- .../GameEngine/Include/GameLogic/Weapon.h | 28 +- .../GameEngine/Include/GameLogic/WeaponSet.h | 6 +- .../Include/GameNetwork/GameSpyChat.h | 2 +- .../GameEngine/Source/Common/BitFlags.cpp | 4 +- .../GameEngine/Source/Common/CommandLine.cpp | 18 +- .../GameEngine/Source/Common/DamageFX.cpp | 22 +- .../Code/GameEngine/Source/Common/Dict.cpp | 38 +- .../GameEngine/Source/Common/GameEngine.cpp | 130 +- .../Code/GameEngine/Source/Common/GameLOD.cpp | 86 +- .../GameEngine/Source/Common/GameMain.cpp | 4 +- .../GameEngine/Source/Common/GlobalData.cpp | 842 +++++------ .../Code/GameEngine/Source/Common/INI/INI.cpp | 72 +- .../Source/Common/INI/INIAnimation.cpp | 2 +- .../Source/Common/INI/INICommandButton.cpp | 2 +- .../Source/Common/INI/INIDrawGroupInfo.cpp | 30 +- .../Source/Common/INI/INIMapCache.cpp | 58 +- .../Source/Common/INI/INIMappedImage.cpp | 2 +- .../Source/Common/INI/INIMultiplayer.cpp | 8 +- .../Source/Common/INI/INIParticleSys.cpp | 2 +- .../Source/Common/INI/INITerrain.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 2 +- .../Source/Common/INI/INITerrainRoad.cpp | 2 +- .../GameEngine/Source/Common/INI/INIWater.cpp | 6 +- .../Source/Common/INI/INIWebpageURL.cpp | 6 +- .../Source/Common/MessageStream.cpp | 50 +- .../Code/GameEngine/Source/Common/MiniLog.cpp | 2 +- .../Source/Common/MultiplayerSettings.cpp | 28 +- .../Source/Common/NameKeyGenerator.cpp | 6 +- .../GameEngine/Source/Common/PerfTimer.cpp | 30 +- .../Source/Common/RTS/AcademyStats.cpp | 12 +- .../Source/Common/RTS/ActionManager.cpp | 66 +- .../GameEngine/Source/Common/RTS/Energy.cpp | 14 +- .../GameEngine/Source/Common/RTS/Money.cpp | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 190 +-- .../Source/Common/RTS/PlayerList.cpp | 24 +- .../Source/Common/RTS/PlayerTemplate.cpp | 114 +- .../Common/RTS/ProductionPrerequisite.cpp | 8 +- .../Common/RTS/ResourceGatheringManager.cpp | 32 +- .../GameEngine/Source/Common/RTS/Science.cpp | 24 +- .../Source/Common/RTS/ScoreKeeper.cpp | 4 +- .../Source/Common/RTS/SpecialPower.cpp | 40 +- .../GameEngine/Source/Common/RTS/Team.cpp | 116 +- .../Source/Common/RTS/TunnelTracker.cpp | 18 +- .../GameEngine/Source/Common/Recorder.cpp | 82 +- .../GameEngine/Source/Common/StateMachine.cpp | 38 +- .../Source/Common/StatsCollector.cpp | 2 +- .../Source/Common/System/BuildAssistant.cpp | 76 +- .../Source/Common/System/CDManager.cpp | 6 +- .../Source/Common/System/CriticalSection.cpp | 10 +- .../Source/Common/System/DataChunk.cpp | 64 +- .../Source/Common/System/DisabledTypes.cpp | 2 +- .../Source/Common/System/FunctionLexicon.cpp | 48 +- .../Source/Common/System/GameCommon.cpp | 4 +- .../Source/Common/System/GameType.cpp | 4 +- .../Source/Common/System/KindOf.cpp | 2 +- .../GameEngine/Source/Common/System/List.cpp | 20 +- .../Common/System/SaveGame/GameState.cpp | 58 +- .../Common/System/SaveGame/GameStateMap.cpp | 18 +- .../Source/Common/System/StackDump.cpp | 46 +- .../Source/Common/System/Upgrade.cpp | 44 +- .../Source/Common/System/encrypt.cpp | 2 +- .../Source/Common/System/registry.cpp | 8 +- .../GameEngine/Source/Common/TerrainTypes.cpp | 18 +- .../GameEngine/Source/Common/Thing/Module.cpp | 6 +- .../Source/Common/Thing/ModuleFactory.cpp | 32 +- .../GameEngine/Source/Common/Thing/Thing.cpp | 4 +- .../Source/Common/Thing/ThingFactory.cpp | 24 +- .../Source/Common/Thing/ThingTemplate.cpp | 300 ++-- .../Source/Common/UserPreferences.cpp | 4 +- .../Code/GameEngine/Source/Common/version.cpp | 2 +- .../Source/GameClient/ClientInstance.cpp | 16 +- .../GameEngine/Source/GameClient/Credits.cpp | 34 +- .../GameEngine/Source/GameClient/Display.cpp | 36 +- .../Source/GameClient/DisplayString.cpp | 8 +- .../GameClient/DisplayStringManager.cpp | 12 +- .../Source/GameClient/DrawGroupInfo.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 274 ++-- .../Drawable/Update/BeaconClientUpdate.cpp | 8 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 32 +- .../GameEngine/Source/GameClient/FXList.cpp | 136 +- .../GameClient/GUI/AnimateWindowManager.cpp | 14 +- .../GameClient/GUI/ChallengeGenerals.cpp | 94 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 426 +++--- .../GUI/ControlBar/ControlBarBeacon.cpp | 6 +- .../GUI/ControlBar/ControlBarCommand.cpp | 84 +- .../ControlBarCommandProcessing.cpp | 52 +- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 24 +- .../GUI/ControlBar/ControlBarOCLTimer.cpp | 6 +- .../GUI/ControlBar/ControlBarObserver.cpp | 56 +- .../ControlBar/ControlBarPrintPositions.cpp | 2 +- .../GUI/ControlBar/ControlBarResizer.cpp | 30 +- .../GUI/ControlBar/ControlBarScheme.cpp | 410 +++--- .../ControlBarStructureInventory.cpp | 2 +- .../ControlBarUnderConstruction.cpp | 4 +- .../GUI/DisconnectMenu/DisconnectMenu.cpp | 90 +- .../EstablishConnectionsMenu.cpp | 20 +- .../GUI/GUICallbacks/ControlBarCallback.cpp | 16 +- .../ControlBarPopupDescription.cpp | 28 +- .../GameClient/GUI/GUICallbacks/Diplomacy.cpp | 60 +- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 16 +- .../GUI/GUICallbacks/GeneralsExpPoints.cpp | 2 +- .../GUI/GUICallbacks/IMECandidate.cpp | 12 +- .../GUI/GUICallbacks/InGameChat.cpp | 22 +- .../GUI/GUICallbacks/InGamePopupMessage.cpp | 8 +- .../GUI/GUICallbacks/Menus/ChallengeMenu.cpp | 56 +- .../GUI/GUICallbacks/Menus/CreditsMenu.cpp | 6 +- .../GUICallbacks/Menus/DifficultySelect.cpp | 14 +- .../GUICallbacks/Menus/DisconnectWindow.cpp | 46 +- .../GUI/GUICallbacks/Menus/DownloadMenu.cpp | 38 +- .../Menus/EstablishConnectionsWindow.cpp | 48 +- .../GUI/GUICallbacks/Menus/GameInfoWindow.cpp | 20 +- .../Menus/KeyboardOptionsMenu.cpp | 34 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 109 +- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 74 +- .../GUICallbacks/Menus/LanMapSelectMenu.cpp | 41 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 118 +- .../GUI/GUICallbacks/Menus/MapSelectMenu.cpp | 16 +- .../Menus/NetworkDirectConnect.cpp | 36 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 194 +-- .../GUICallbacks/Menus/PopupCommunicator.cpp | 8 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 34 +- .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 14 +- .../GUICallbacks/Menus/PopupLadderSelect.cpp | 34 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 208 +-- .../GUI/GUICallbacks/Menus/PopupReplay.cpp | 48 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 52 +- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 76 +- .../GUI/GUICallbacks/Menus/ReplayMenu.cpp | 70 +- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 80 +- .../GUICallbacks/Menus/SinglePlayerMenu.cpp | 8 +- .../Menus/SkirmishGameOptionsMenu.cpp | 130 +- .../Menus/SkirmishMapSelectMenu.cpp | 27 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 88 +- .../Menus/WOLCustomScoreScreen.cpp | 12 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 209 ++- .../GUICallbacks/Menus/WOLLadderScreen.cpp | 12 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 70 +- .../Menus/WOLLocaleSelectPopup.cpp | 12 +- .../GUI/GUICallbacks/Menus/WOLLoginMenu.cpp | 144 +- .../GUICallbacks/Menus/WOLMapSelectMenu.cpp | 33 +- .../GUICallbacks/Menus/WOLMessageWindow.cpp | 8 +- .../GUICallbacks/Menus/WOLQMScoreScreen.cpp | 14 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 98 +- .../GUI/GUICallbacks/Menus/WOLStatusMenu.cpp | 14 +- .../GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp | 100 +- .../GUI/GUICallbacks/MessageBox.cpp | 16 +- .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 2 +- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 38 +- .../GUI/Gadget/GadgetHorizontalSlider.cpp | 4 +- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 78 +- .../GUI/Gadget/GadgetProgressBar.cpp | 2 +- .../GUI/Gadget/GadgetPushButton.cpp | 40 +- .../GUI/Gadget/GadgetRadioButton.cpp | 6 +- .../GUI/Gadget/GadgetStaticText.cpp | 2 +- .../GUI/Gadget/GadgetTabControl.cpp | 10 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 26 +- .../GUI/Gadget/GadgetVerticalSlider.cpp | 4 +- .../Source/GameClient/GUI/GameFont.cpp | 26 +- .../Source/GameClient/GUI/GameWindow.cpp | 62 +- .../GameClient/GUI/GameWindowGlobal.cpp | 6 +- .../GameClient/GUI/GameWindowManager.cpp | 354 ++--- .../GUI/GameWindowManagerScript.cpp | 330 ++--- .../GameClient/GUI/GameWindowTransitions.cpp | 92 +- .../GUI/GameWindowTransitionsStyles.cpp | 82 +- .../Source/GameClient/GUI/HeaderTemplate.cpp | 28 +- .../Source/GameClient/GUI/IMEManager.cpp | 92 +- .../Source/GameClient/GUI/LoadScreen.cpp | 338 ++--- .../GameClient/GUI/ProcessAnimateWindow.cpp | 110 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 78 +- .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 38 +- .../Source/GameClient/GUI/WinInstanceData.cpp | 28 +- .../Source/GameClient/GUI/WindowLayout.cpp | 40 +- .../Source/GameClient/GameClient.cpp | 100 +- .../GameEngine/Source/GameClient/GameText.cpp | 64 +- .../Source/GameClient/GlobalLanguage.cpp | 56 +- .../Source/GameClient/GraphDraw.cpp | 2 +- .../GameEngine/Source/GameClient/InGameUI.cpp | 510 +++---- .../Source/GameClient/Input/Keyboard.cpp | 8 +- .../Source/GameClient/Input/Mouse.cpp | 104 +- .../Source/GameClient/LanguageFilter.cpp | 10 +- .../GameEngine/Source/GameClient/Line2D.cpp | 4 +- .../GameClient/MessageStream/CommandXlat.cpp | 200 +-- .../MessageStream/GUICommandTranslator.cpp | 36 +- .../GameClient/MessageStream/HotKey.cpp | 4 +- .../GameClient/MessageStream/LookAtXlat.cpp | 16 +- .../GameClient/MessageStream/MetaEvent.cpp | 14 +- .../MessageStream/PlaceEventTranslator.cpp | 18 +- .../MessageStream/SelectionXlat.cpp | 42 +- .../GameClient/MessageStream/WindowXlat.cpp | 4 +- .../Source/GameClient/RadiusDecal.cpp | 34 +- .../Source/GameClient/SelectionInfo.cpp | 12 +- .../Source/GameClient/System/Anim2D.cpp | 82 +- .../GameClient/System/CampaignManager.cpp | 82 +- .../Source/GameClient/System/Image.cpp | 24 +- .../Source/GameClient/System/ParticleSys.cpp | 292 ++-- .../Source/GameClient/System/RayEffect.cpp | 24 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 186 +-- .../GameEngine/Source/GameLogic/AI/AIDock.cpp | 80 +- .../Source/GameLogic/AI/AIGroup.cpp | 104 +- .../Source/GameLogic/AI/AIGuard.cpp | 46 +- .../Source/GameLogic/AI/AIGuardRetaliate.cpp | 44 +- .../Source/GameLogic/AI/AIPathfind.cpp | 592 ++++---- .../Source/GameLogic/AI/AIPlayer.cpp | 178 +-- .../Source/GameLogic/AI/AISkirmishPlayer.cpp | 44 +- .../Source/GameLogic/AI/AIStates.cpp | 352 ++--- .../Source/GameLogic/AI/AITNGuard.cpp | 70 +- .../GameEngine/Source/GameLogic/AI/Squad.cpp | 2 +- .../Source/GameLogic/AI/TurretAI.cpp | 102 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 24 +- .../Source/GameLogic/Map/SidesList.cpp | 106 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 124 +- .../Source/GameLogic/Object/Armor.cpp | 6 +- .../Object/Behavior/AutoHealBehavior.cpp | 2 +- .../Behavior/BattleBusSlowDeathBehavior.cpp | 30 +- .../Object/Behavior/BridgeBehavior.cpp | 88 +- .../Behavior/BridgeScaffoldBehavior.cpp | 8 +- .../Object/Behavior/BridgeTowerBehavior.cpp | 26 +- .../Object/Behavior/BunkerBusterBehavior.cpp | 34 +- .../Behavior/CountermeasuresBehavior.cpp | 6 +- .../Behavior/DumbProjectileBehavior.cpp | 42 +- .../FireWeaponWhenDamagedBehavior.cpp | 24 +- .../Object/Behavior/FlightDeckBehavior.cpp | 124 +- .../Behavior/GenerateMinefieldBehavior.cpp | 40 +- .../Object/Behavior/GrantStealthBehavior.cpp | 2 +- .../Object/Behavior/InstantDeathBehavior.cpp | 18 +- .../Object/Behavior/JetSlowDeathBehavior.cpp | 66 +- .../Object/Behavior/MinefieldBehavior.cpp | 34 +- .../Object/Behavior/NeutonBlastBehavior.cpp | 2 +- .../Object/Behavior/OverchargeBehavior.cpp | 6 +- .../Object/Behavior/POWTruckBehavior.cpp | 4 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 42 +- .../Object/Behavior/PoisonedBehavior.cpp | 6 +- .../Object/Behavior/PrisonBehavior.cpp | 20 +- .../Behavior/PropagandaCenterBehavior.cpp | 6 +- .../Behavior/PropagandaTowerBehavior.cpp | 40 +- .../Object/Behavior/RebuildHoleBehavior.cpp | 38 +- .../Object/Behavior/SlowDeathBehavior.cpp | 48 +- .../Object/Behavior/SpawnBehavior.cpp | 48 +- .../SupplyWarehouseCripplingBehavior.cpp | 10 +- .../Object/Behavior/TechBuildingBehavior.cpp | 10 +- .../GameLogic/Object/Body/ActiveBody.cpp | 34 +- .../GameLogic/Object/Body/InactiveBody.cpp | 4 +- .../GameLogic/Object/Body/UndeadBody.cpp | 8 +- .../ConvertToHijackedVehicleCrateCollide.cpp | 2 +- .../Collide/CrateCollide/CrateCollide.cpp | 36 +- .../CrateCollide/SalvageCrateCollide.cpp | 6 +- .../Collide/CrateCollide/UnitCrateCollide.cpp | 2 +- .../CrateCollide/VeterancyCrateCollide.cpp | 4 +- .../Object/Collide/FireWeaponCollide.cpp | 18 +- .../Object/Collide/SquishCollide.cpp | 4 +- .../GameLogic/Object/Contain/CaveContain.cpp | 26 +- .../Object/Contain/GarrisonContain.cpp | 74 +- .../GameLogic/Object/Contain/HealContain.cpp | 4 +- .../GameLogic/Object/Contain/HelixContain.cpp | 8 +- .../Object/Contain/InternetHackContain.cpp | 2 +- .../Object/Contain/MobNexusContain.cpp | 24 +- .../GameLogic/Object/Contain/OpenContain.cpp | 80 +- .../Object/Contain/OverlordContain.cpp | 50 +- .../Object/Contain/ParachuteContain.cpp | 46 +- .../Object/Contain/RailedTransportContain.cpp | 10 +- .../Object/Contain/RiderChangeContain.cpp | 24 +- .../Object/Contain/TransportContain.cpp | 44 +- .../Object/Contain/TunnelContain.cpp | 32 +- .../Object/Create/GrantUpgradeCreate.cpp | 6 +- .../Object/Create/LockWeaponCreate.cpp | 2 +- .../Object/Create/SupplyCenterCreate.cpp | 6 +- .../Object/Create/SupplyWarehouseCreate.cpp | 6 +- .../Object/Create/VeterancyGainCreate.cpp | 4 +- .../GameLogic/Object/Damage/BoneFXDamage.cpp | 4 +- .../Object/Damage/TransitionDamageFX.cpp | 28 +- .../GameLogic/Object/Die/CreateCrateDie.cpp | 18 +- .../GameLogic/Object/Die/CreateObjectDie.cpp | 10 +- .../Source/GameLogic/Object/Die/CrushDie.cpp | 2 +- .../Source/GameLogic/Object/Die/DieModule.cpp | 10 +- .../GameLogic/Object/Die/EjectPilotDie.cpp | 12 +- .../Object/Die/RebuildHoleExposeDie.cpp | 8 +- .../Source/GameLogic/Object/FiringTracker.cpp | 2 +- .../Source/GameLogic/Object/GhostObject.cpp | 10 +- .../Source/GameLogic/Object/Locomotor.cpp | 154 +- .../Source/GameLogic/Object/Object.cpp | 264 ++-- .../GameLogic/Object/ObjectCreationList.cpp | 240 +-- .../GameLogic/Object/PartitionManager.cpp | 214 +-- .../GameLogic/Object/SimpleObjectIterator.cpp | 20 +- .../SpecialPower/BaikonurLaunchPower.cpp | 4 +- .../Object/SpecialPower/CashBountyPower.cpp | 12 +- .../SpecialPower/CashHackSpecialPower.cpp | 12 +- .../Object/SpecialPower/CleanupAreaPower.cpp | 4 +- .../SpecialPower/DefectorSpecialPower.cpp | 4 +- .../SpecialPower/DemoralizeSpecialPower.cpp | 20 +- .../Object/SpecialPower/FireWeaponPower.cpp | 4 +- .../Object/SpecialPower/OCLSpecialPower.cpp | 22 +- .../Object/SpecialPower/SpecialAbility.cpp | 2 +- .../SpecialPower/SpecialPowerModule.cpp | 36 +- .../SpecialPower/SpyVisionSpecialPower.cpp | 8 +- .../GameLogic/Object/Update/AIUpdate.cpp | 194 +-- .../AIUpdate/AssaultTransportAIUpdate.cpp | 10 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 96 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 76 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 118 +- .../Update/AIUpdate/HackInternetAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 126 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 68 +- .../Update/AIUpdate/POWTruckAIUpdate.cpp | 44 +- .../AIUpdate/RailedTransportAIUpdate.cpp | 18 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 40 +- .../Update/AIUpdate/SupplyTruckAIUpdate.cpp | 46 +- .../Update/AIUpdate/TransportAIUpdate.cpp | 6 +- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 82 +- .../Object/Update/AssistedTargetingUpdate.cpp | 12 +- .../Object/Update/AutoFindHealingUpdate.cpp | 16 +- .../Object/Update/BaseRenerateUpdate.cpp | 2 +- .../Object/Update/BattlePlanUpdate.cpp | 72 +- .../GameLogic/Object/Update/BoneFXUpdate.cpp | 52 +- .../Object/Update/CheckpointUpdate.cpp | 6 +- .../Object/Update/CleanupHazardUpdate.cpp | 14 +- .../Object/Update/CommandButtonHuntUpdate.cpp | 36 +- .../Object/Update/DemoTrapUpdate.cpp | 18 +- .../Object/Update/DockUpdate/DockUpdate.cpp | 32 +- .../Update/DockUpdate/PrisonDockUpdate.cpp | 2 +- .../DockUpdate/RailedTransportDockUpdate.cpp | 24 +- .../Update/DockUpdate/RepairDockUpdate.cpp | 6 +- .../DockUpdate/SupplyCenterDockUpdate.cpp | 12 +- .../DockUpdate/SupplyWarehouseDockUpdate.cpp | 6 +- .../Update/DynamicGeometryInfoUpdate.cpp | 20 +- .../DynamicShroudClearingRangeUpdate.cpp | 18 +- .../GameLogic/Object/Update/EMPUpdate.cpp | 22 +- .../Object/Update/EnemyNearUpdate.cpp | 2 +- .../FireOCLAfterWeaponCooldownUpdate.cpp | 12 +- .../Object/Update/FireSpreadUpdate.cpp | 20 +- .../Object/Update/FireWeaponUpdate.cpp | 14 +- .../FirestormDynamicGeometryInfoUpdate.cpp | 52 +- .../Object/Update/FlammableUpdate.cpp | 22 +- .../GameLogic/Object/Update/FloatUpdate.cpp | 4 +- .../Object/Update/HeightDieUpdate.cpp | 18 +- .../Update/HelicopterSlowDeathUpdate.cpp | 86 +- .../Object/Update/HijackerUpdate.cpp | 12 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 26 +- .../GameLogic/Object/Update/LaserUpdate.cpp | 22 +- .../Object/Update/MobMemberSlavedUpdate.cpp | 8 +- .../Update/NeutronMissileSlowDeathUpdate.cpp | 198 +-- .../Object/Update/NeutronMissileUpdate.cpp | 54 +- .../GameLogic/Object/Update/OCLUpdate.cpp | 20 +- .../Update/ParticleUplinkCannonUpdate.cpp | 128 +- .../GameLogic/Object/Update/PhysicsUpdate.cpp | 80 +- .../Object/Update/PilotFindVehicleUpdate.cpp | 14 +- .../Object/Update/PointDefenseLaserUpdate.cpp | 24 +- .../QueueProductionExitUpdate.cpp | 2 +- .../SpawnPointProductionExitUpdate.cpp | 8 +- .../Object/Update/ProductionUpdate.cpp | 80 +- .../Object/Update/ProjectileStreamUpdate.cpp | 6 +- .../GameLogic/Object/Update/ProneUpdate.cpp | 4 +- .../GameLogic/Object/Update/SlavedUpdate.cpp | 6 +- .../Object/Update/SpecialAbilityUpdate.cpp | 22 +- .../Update/SpectreGunshipDeploymentUpdate.cpp | 20 +- .../Object/Update/SpectreGunshipUpdate.cpp | 60 +- .../Object/Update/SpyVisionUpdate.cpp | 2 +- .../Object/Update/StealthDetectorUpdate.cpp | 42 +- .../GameLogic/Object/Update/StealthUpdate.cpp | 64 +- .../Object/Update/StickyBombUpdate.cpp | 6 +- .../Object/Update/StructureCollapseUpdate.cpp | 30 +- .../Object/Update/StructureToppleUpdate.cpp | 64 +- .../Object/Update/TensileFormationUpdate.cpp | 18 +- .../GameLogic/Object/Update/ToppleUpdate.cpp | 32 +- .../Object/Update/WaveGuideUpdate.cpp | 38 +- .../Object/Update/WeaponBonusUpdate.cpp | 16 +- .../Object/Upgrade/ActiveShroudUpgrade.cpp | 4 +- .../Object/Upgrade/CommandSetUpgrade.cpp | 8 +- .../Object/Upgrade/CostModifierUpgrade.cpp | 6 +- .../Upgrade/ExperienceScalarUpgrade.cpp | 4 +- .../Object/Upgrade/GrantScienceUpgrade.cpp | 4 +- .../Object/Upgrade/MaxHealthUpgrade.cpp | 4 +- .../Object/Upgrade/ModelConditionUpgrade.cpp | 4 +- .../Object/Upgrade/ObjectCreationUpgrade.cpp | 8 +- .../GameLogic/Object/Upgrade/RadarUpgrade.cpp | 4 +- .../Object/Upgrade/ReplaceObjectUpgrade.cpp | 10 +- .../Object/Upgrade/StatusBitsUpgrade.cpp | 6 +- .../Object/Upgrade/SubObjectsUpgrade.cpp | 6 +- .../Upgrade/UnpauseSpecialPowerUpgrade.cpp | 6 +- .../Source/GameLogic/Object/Weapon.cpp | 296 ++-- .../Source/GameLogic/Object/WeaponSet.cpp | 62 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 172 +-- .../ScriptEngine/ScriptConditions.cpp | 56 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 282 ++-- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 182 +-- .../ScriptEngine/VictoryConditions.cpp | 12 +- .../Source/GameLogic/System/CaveSystem.cpp | 18 +- .../Source/GameLogic/System/CrateSystem.cpp | 24 +- .../Source/GameLogic/System/Damage.cpp | 2 +- .../Source/GameLogic/System/GameLogic.cpp | 156 +- .../GameLogic/System/GameLogicDispatch.cpp | 98 +- .../Source/GameLogic/System/RankInfo.cpp | 14 +- .../GameEngine/Source/GameNetwork/GUIUtil.cpp | 12 +- .../Source/GameNetwork/GameSpyChat.cpp | 2 +- .../Source/GameNetwork/GameSpyGP.cpp | 4 +- .../Source/GameNetwork/GameSpyGameInfo.cpp | 36 +- .../GameClient/Module/W3DModelDraw.h | 2 +- .../W3DDevice/GameClient/W3DAssetManager.h | 2 +- .../W3DDevice/GameClient/W3DBufferManager.h | 4 +- .../Include/W3DDevice/GameClient/W3DShadow.h | 2 +- .../Include/W3DDevice/GameClient/W3DShroud.h | 2 +- .../GameClient/W3DVolumetricShadow.h | 2 +- .../W3DDevice/GameLogic/W3DTerrainLogic.h | 4 +- .../Common/System/W3DFunctionLexicon.cpp | 4 +- .../Drawable/Draw/W3DDebrisDraw.cpp | 38 +- .../Drawable/Draw/W3DDefaultDraw.cpp | 8 +- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 272 ++-- .../Drawable/Draw/W3DOverlordAircraftDraw.cpp | 3 +- .../Drawable/Draw/W3DOverlordTankDraw.cpp | 3 +- .../Drawable/Draw/W3DOverlordTruckDraw.cpp | 3 +- .../Drawable/Draw/W3DPoliceCarDraw.cpp | 11 +- .../Drawable/Draw/W3DProjectileStreamDraw.cpp | 20 +- .../Drawable/Draw/W3DScienceModelDraw.cpp | 4 +- .../Drawable/Draw/W3DSupplyDraw.cpp | 6 +- .../GameClient/Drawable/Draw/W3DTankDraw.cpp | 37 +- .../Drawable/Draw/W3DTankTruckDraw.cpp | 70 +- .../Drawable/Draw/W3DTracerDraw.cpp | 4 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 74 +- .../GUI/GUICallbacks/W3DControlBar.cpp | 27 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 14 +- .../GameClient/GUI/Gadget/W3DCheckBox.cpp | 4 +- .../GUI/Gadget/W3DHorizontalSlider.cpp | 8 +- .../GameClient/GUI/Gadget/W3DProgressBar.cpp | 8 +- .../GameClient/GUI/Gadget/W3DPushButton.cpp | 12 +- .../GameClient/GUI/Gadget/W3DRadioButton.cpp | 6 +- .../GameClient/GUI/Gadget/W3DStaticText.cpp | 2 +- .../GameClient/GUI/Gadget/W3DTabControl.cpp | 18 +- .../GameClient/GUI/Gadget/W3DTextEntry.cpp | 2 +- .../GUI/Gadget/W3DVerticalSlider.cpp | 4 +- .../W3DDevice/GameClient/GUI/W3DGameFont.cpp | 6 +- .../GameClient/GUI/W3DGameWindow.cpp | 8 +- .../GameClient/Shadow/W3DBufferManager.cpp | 78 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 178 +-- .../W3DDevice/GameClient/Shadow/W3DShadow.cpp | 12 +- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 208 +-- .../W3DDevice/GameClient/W3DAssetManager.cpp | 56 +- .../W3DDevice/GameClient/W3DBibBuffer.cpp | 7 +- .../W3DDevice/GameClient/W3DBridgeBuffer.cpp | 83 +- .../W3DDevice/GameClient/W3DCustomEdging.cpp | 11 +- .../W3DDevice/GameClient/W3DDebugDisplay.cpp | 4 +- .../W3DDevice/GameClient/W3DDebugIcons.cpp | 10 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 88 +- .../W3DDevice/GameClient/W3DDisplayString.cpp | 8 +- .../GameClient/W3DDisplayStringManager.cpp | 16 +- .../W3DDevice/GameClient/W3DFileSystem.cpp | 16 +- .../W3DDevice/GameClient/W3DGameClient.cpp | 6 +- .../W3DDevice/GameClient/W3DInGameUI.cpp | 30 +- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 34 +- .../W3DDevice/GameClient/W3DParticleSys.cpp | 18 +- .../W3DDevice/GameClient/W3DRoadBuffer.cpp | 113 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 62 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 38 +- .../W3DDevice/GameClient/W3DStatusCircle.cpp | 16 +- .../W3DDevice/GameClient/W3DWebBrowser.cpp | 4 +- .../GameClient/W3dWaypointBuffer.cpp | 7 +- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 76 +- .../W3DDevice/GameLogic/W3DTerrainLogic.cpp | 4 +- .../Win32Device/Common/Win32CDManager.cpp | 2 +- .../Win32Device/Common/Win32GameEngine.cpp | 9 +- .../Win32Device/Common/Win32OSDisplay.cpp | 4 +- .../GameClient/Win32DIKeyboard.cpp | 18 +- .../Win32Device/GameClient/Win32DIMouse.cpp | 22 +- .../Win32Device/GameClient/Win32Mouse.cpp | 8 +- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 38 +- .../Source/WWVegas/WW3D2/aabtreebuilder.h | 6 +- .../Source/WWVegas/WW3D2/animobj.cpp | 60 +- .../Libraries/Source/WWVegas/WW3D2/animobj.h | 2 +- .../Source/WWVegas/WW3D2/assetmgr.cpp | 98 +- .../Libraries/Source/WWVegas/WW3D2/assetmgr.h | 2 +- .../Source/WWVegas/WW3D2/boxrobj.cpp | 12 +- .../Libraries/Source/WWVegas/WW3D2/camera.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/camera.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 78 +- .../Libraries/Source/WWVegas/WW3D2/dazzle.h | 4 +- .../Source/WWVegas/WW3D2/ddsfile.cpp | 11 +- .../Source/WWVegas/WW3D2/decalmsh.cpp | 4 +- .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 8 +- .../Source/WWVegas/WW3D2/dx8renderer.cpp | 148 +- .../Source/WWVegas/WW3D2/dx8renderer.h | 6 +- .../Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 22 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 286 ++-- .../Source/WWVegas/WW3D2/dx8wrapper.h | 10 +- .../Source/WWVegas/WW3D2/hanimmgr.cpp | 26 +- .../Libraries/Source/WWVegas/WW3D2/hlod.cpp | 188 +-- .../Source/WWVegas/WW3D2/hmorphanim.cpp | 56 +- .../Source/WWVegas/WW3D2/hrawanim.cpp | 96 +- .../Source/WWVegas/WW3D2/htreemgr.cpp | 16 +- .../Source/WWVegas/WW3D2/linegrp.cpp | 18 +- .../Libraries/Source/WWVegas/WW3D2/linegrp.h | 20 +- .../Source/WWVegas/WW3D2/matrixmapper.cpp | 4 +- .../Source/WWVegas/WW3D2/matrixmapper.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/mesh.cpp | 56 +- .../Libraries/Source/WWVegas/WW3D2/mesh.h | 2 +- .../Source/WWVegas/WW3D2/meshbuild.cpp | 22 +- .../Source/WWVegas/WW3D2/meshgeometry.cpp | 70 +- .../Source/WWVegas/WW3D2/meshgeometry.h | 6 +- .../Source/WWVegas/WW3D2/meshmatdesc.cpp | 106 +- .../Source/WWVegas/WW3D2/meshmatdesc.h | 48 +- .../Source/WWVegas/WW3D2/meshmdl.cpp | 58 +- .../Libraries/Source/WWVegas/WW3D2/meshmdl.h | 2 +- .../Source/WWVegas/WW3D2/meshmdlio.cpp | 84 +- .../Source/WWVegas/WW3D2/motchan.cpp | 30 +- .../Source/WWVegas/WW3D2/part_buf.cpp | 321 ++-- .../Libraries/Source/WWVegas/WW3D2/part_buf.h | 6 +- .../Source/WWVegas/WW3D2/part_emt.cpp | 52 +- .../Libraries/Source/WWVegas/WW3D2/part_emt.h | 16 +- .../Source/WWVegas/WW3D2/part_ldr.cpp | 62 +- .../Source/WWVegas/WW3D2/render2d.cpp | 8 +- .../Libraries/Source/WWVegas/WW3D2/render2d.h | 4 +- .../Libraries/Source/WWVegas/WW3D2/rinfo.cpp | 10 +- .../Libraries/Source/WWVegas/WW3D2/scene.cpp | 12 +- .../Libraries/Source/WWVegas/WW3D2/shader.cpp | 4 +- .../Source/WWVegas/WW3D2/sortingrenderer.cpp | 26 +- .../Source/WWVegas/WW3D2/vertmaterial.cpp | 30 +- .../Source/WWVegas/WW3D2/vertmaterial.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 42 +- .../Libraries/Source/WWVegas/WW3D2/ww3d.h | 4 +- GeneralsMD/Code/Main/WinMain.cpp | 44 +- .../Tools/GUIEdit/Include/GUIEditDisplay.h | 2 +- .../GUIEdit/Include/GUIEditWindowManager.h | 4 +- .../Dialog Procedures/CallbackEditor.cpp | 24 +- .../Dialog Procedures/CheckBoxProperties.cpp | 4 +- .../Source/Dialog Procedures/ColorDialog.cpp | 66 +- .../Dialog Procedures/ComboBoxProperties.cpp | 8 +- .../Dialog Procedures/GenericProperties.cpp | 10 +- .../Source/Dialog Procedures/GridSettings.cpp | 6 +- .../Dialog Procedures/ListboxProperties.cpp | 27 +- .../ProgressBarProperties.cpp | 4 +- .../PushButtonProperties.cpp | 4 +- .../RadioButtonProperties.cpp | 14 +- .../Dialog Procedures/SliderProperties.cpp | 10 +- .../StaticTextProperties.cpp | 4 +- .../TabControlProperties.cpp | 14 +- .../Dialog Procedures/TextEntryProperties.cpp | 6 +- .../Code/Tools/GUIEdit/Source/EditWindow.cpp | 64 +- .../Code/Tools/GUIEdit/Source/GUIEdit.cpp | 236 +-- .../GUIEdit/Source/GUIEditWindowManager.cpp | 74 +- .../Tools/GUIEdit/Source/HierarchyView.cpp | 140 +- .../Tools/GUIEdit/Source/LayoutScheme.cpp | 70 +- .../Code/Tools/GUIEdit/Source/Properties.cpp | 630 ++++---- GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp | 32 +- .../Code/Tools/GUIEdit/Source/WinMain.cpp | 28 +- .../Tools/ParticleEditor/CColorAlphaDialog.h | 2 +- .../ParticleEditor/CParticleEditorPage.h | 2 +- .../Tools/ParticleEditor/CSwitchesDialog.h | 2 +- .../Tools/ParticleEditor/EmissionTypePanels.h | 10 +- .../Tools/ParticleEditor/ISwapablePanel.h | 2 +- .../Tools/ParticleEditor/MoreParmsDialog.h | 2 +- .../Tools/ParticleEditor/ParticleEditor.cpp | 8 +- .../ParticleEditor/ParticleEditorDialog.cpp | 10 +- .../ParticleEditor/ParticleEditorDialog.h | 2 +- .../Tools/ParticleEditor/ParticleTypePanels.h | 6 +- .../Tools/ParticleEditor/VelocityTypePanels.h | 10 +- .../WorldBuilder/include/BaseBuildProps.h | 2 +- .../WorldBuilder/include/BlendMaterial.h | 2 +- .../Tools/WorldBuilder/include/BuildList.h | 2 +- .../include/CFixTeamOwnerDialog.h | 2 +- .../Tools/WorldBuilder/include/CUndoable.h | 4 +- .../WorldBuilder/include/CameraOptions.h | 2 +- .../Tools/WorldBuilder/include/CellWidth.h | 2 +- .../WorldBuilder/include/ContourOptions.h | 2 +- .../Tools/WorldBuilder/include/EditAction.h | 2 +- .../WorldBuilder/include/EditCondition.h | 2 +- .../WorldBuilder/include/EditCoordParameter.h | 2 +- .../Tools/WorldBuilder/include/EditGroup.h | 2 +- .../include/EditObjectParameter.h | 2 +- .../WorldBuilder/include/EditParameter.h | 4 +- .../include/ExportScriptsOptions.h | 2 +- .../WorldBuilder/include/FeatherOptions.h | 2 +- .../Tools/WorldBuilder/include/FenceOptions.h | 2 +- .../WorldBuilder/include/GlobalLightOptions.h | 2 +- .../Tools/WorldBuilder/include/GroveOptions.h | 2 +- .../WorldBuilder/include/ImpassableOptions.h | 2 +- .../Tools/WorldBuilder/include/LayersList.h | 12 +- .../Tools/WorldBuilder/include/LightOptions.h | 2 +- .../Tools/WorldBuilder/include/MapSettings.h | 2 +- .../WorldBuilder/include/MeshMoldOptions.h | 2 +- .../Tools/WorldBuilder/include/MoundOptions.h | 2 +- .../Tools/WorldBuilder/include/NewHeightMap.h | 2 +- .../WorldBuilder/include/ObjectOptions.h | 2 +- .../Code/Tools/WorldBuilder/include/OpenMap.h | 2 +- .../Tools/WorldBuilder/include/OptionsPanel.h | 2 +- .../WorldBuilder/include/PickUnitDialog.h | 6 +- .../Tools/WorldBuilder/include/RampOptions.h | 2 +- .../Tools/WorldBuilder/include/RoadOptions.h | 2 +- .../Tools/WorldBuilder/include/RulerOptions.h | 2 +- .../Code/Tools/WorldBuilder/include/SaveMap.h | 2 +- .../WorldBuilder/include/ScorchOptions.h | 2 +- .../Tools/WorldBuilder/include/ScriptDialog.h | 2 +- .../WorldBuilder/include/SelectMacrotexture.h | 2 +- .../WorldBuilder/include/ShadowOptions.h | 2 +- .../include/TeamObjectProperties.h | 2 +- .../WorldBuilder/include/TerrainMaterial.h | 2 +- .../Tools/WorldBuilder/include/TerrainModal.h | 2 +- .../Code/Tools/WorldBuilder/include/Tool.h | 2 +- .../Tools/WorldBuilder/include/WBFrameWnd.h | 8 +- .../WorldBuilder/include/WHeightMapEdit.h | 6 +- .../Tools/WorldBuilder/include/WaterOptions.h | 2 +- .../WorldBuilder/include/WaypointOptions.h | 4 +- .../Tools/WorldBuilder/include/WorldBuilder.h | 2 +- .../WorldBuilder/include/WorldBuilderDoc.h | 2 +- .../WorldBuilder/include/WorldBuilderView.h | 2 +- .../WorldBuilder/include/addplayerdialog.h | 2 +- .../Tools/WorldBuilder/include/brushoptions.h | 2 +- .../Tools/WorldBuilder/include/euladialog.h | 2 +- .../WorldBuilder/include/mapobjectprops.h | 2 +- .../WorldBuilder/include/playerlistdlg.h | 2 +- .../Tools/WorldBuilder/include/propedit.h | 2 +- .../Tools/WorldBuilder/include/teamsdialog.h | 2 +- .../Code/Tools/WorldBuilder/include/wbview.h | 6 +- .../Tools/WorldBuilder/include/wbview3d.h | 2 +- .../Tools/WorldBuilder/src/BaseBuildProps.cpp | 2 +- .../Tools/WorldBuilder/src/BlendMaterial.cpp | 12 +- .../Code/Tools/WorldBuilder/src/BrushTool.cpp | 5 +- .../Code/Tools/WorldBuilder/src/BuildList.cpp | 50 +- .../Tools/WorldBuilder/src/BuildListTool.cpp | 28 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 148 +- .../Tools/WorldBuilder/src/CameraOptions.cpp | 9 +- .../Code/Tools/WorldBuilder/src/CellWidth.cpp | 2 +- .../Tools/WorldBuilder/src/ContourOptions.cpp | 2 +- .../Tools/WorldBuilder/src/DrawObject.cpp | 114 +- .../Tools/WorldBuilder/src/EditAction.cpp | 6 +- .../Tools/WorldBuilder/src/EditCondition.cpp | 6 +- .../WorldBuilder/src/EditCoordParameter.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditGroup.cpp | 2 +- .../WorldBuilder/src/EditObjectParameter.cpp | 8 +- .../Tools/WorldBuilder/src/EditParameter.cpp | 104 +- .../Tools/WorldBuilder/src/EulaDialog.cpp | 2 +- .../WorldBuilder/src/ExportScriptsOptions.cpp | 2 +- .../Tools/WorldBuilder/src/FeatherOptions.cpp | 4 +- .../Tools/WorldBuilder/src/FeatherTool.cpp | 7 +- .../Tools/WorldBuilder/src/FenceOptions.cpp | 20 +- .../Code/Tools/WorldBuilder/src/FenceTool.cpp | 32 +- .../Tools/WorldBuilder/src/FloodFillTool.cpp | 5 +- .../WorldBuilder/src/GlobalLightOptions.cpp | 2 +- .../Tools/WorldBuilder/src/GroveOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/GroveTool.cpp | 34 +- .../Tools/WorldBuilder/src/LayersList.cpp | 34 +- .../Tools/WorldBuilder/src/LightOptions.cpp | 8 +- .../Code/Tools/WorldBuilder/src/MainFrm.cpp | 84 +- .../Tools/WorldBuilder/src/MapPreview.cpp | 2 +- .../Tools/WorldBuilder/src/MapSettings.cpp | 2 +- .../WorldBuilder/src/MeshMoldOptions.cpp | 8 +- .../Tools/WorldBuilder/src/MeshMoldTool.cpp | 9 +- .../Tools/WorldBuilder/src/MoundOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/MoundTool.cpp | 5 +- .../Code/Tools/WorldBuilder/src/MyToolbar.cpp | 10 +- .../Tools/WorldBuilder/src/NewHeightMap.cpp | 2 +- .../Tools/WorldBuilder/src/ObjectOptions.cpp | 44 +- .../Tools/WorldBuilder/src/ObjectPreview.cpp | 16 +- .../Tools/WorldBuilder/src/ObjectTool.cpp | 14 +- .../Code/Tools/WorldBuilder/src/OpenMap.cpp | 12 +- .../Tools/WorldBuilder/src/OptionsPanel.cpp | 2 +- .../Tools/WorldBuilder/src/PickUnitDialog.cpp | 26 +- .../Tools/WorldBuilder/src/PointerTool.cpp | 30 +- .../Tools/WorldBuilder/src/PolygonTool.cpp | 32 +- .../Tools/WorldBuilder/src/RampOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/RampTool.cpp | 10 +- .../Tools/WorldBuilder/src/RoadOptions.cpp | 16 +- .../Code/Tools/WorldBuilder/src/RoadTool.cpp | 36 +- .../Tools/WorldBuilder/src/RulerOptions.cpp | 4 +- .../Code/Tools/WorldBuilder/src/RulerTool.cpp | 15 +- .../Code/Tools/WorldBuilder/src/SaveMap.cpp | 18 +- .../Tools/WorldBuilder/src/ScorchOptions.cpp | 10 +- .../Tools/WorldBuilder/src/ScorchTool.cpp | 6 +- .../WorldBuilder/src/ScriptActionsFalse.cpp | 16 +- .../WorldBuilder/src/ScriptActionsTrue.cpp | 16 +- .../WorldBuilder/src/ScriptConditions.cpp | 36 +- .../Tools/WorldBuilder/src/ScriptDialog.cpp | 114 +- .../WorldBuilder/src/ScriptProperties.cpp | 2 +- .../WorldBuilder/src/SelectMacrotexture.cpp | 4 +- .../Tools/WorldBuilder/src/ShadowOptions.cpp | 2 +- .../Tools/WorldBuilder/src/SplashScreen.cpp | 2 +- .../Tools/WorldBuilder/src/TeamGeneric.cpp | 8 +- .../WorldBuilder/src/TeamObjectProperties.cpp | 4 +- .../WorldBuilder/src/TeamReinforcement.cpp | 2 +- .../WorldBuilder/src/TerrainMaterial.cpp | 16 +- .../Tools/WorldBuilder/src/TerrainModal.cpp | 12 +- .../Code/Tools/WorldBuilder/src/TileTool.cpp | 2 +- .../Code/Tools/WorldBuilder/src/Tool.cpp | 4 +- .../Tools/WorldBuilder/src/WBFrameWnd.cpp | 2 +- .../Tools/WorldBuilder/src/WBHeightMap.cpp | 2 +- .../Tools/WorldBuilder/src/WBPopupSlider.cpp | 26 +- .../Tools/WorldBuilder/src/WHeightMapEdit.cpp | 96 +- .../Tools/WorldBuilder/src/WaterOptions.cpp | 8 +- .../Code/Tools/WorldBuilder/src/WaterTool.cpp | 4 +- .../WorldBuilder/src/WaypointOptions.cpp | 18 +- .../Tools/WorldBuilder/src/WaypointTool.cpp | 12 +- .../Tools/WorldBuilder/src/WorldBuilder.cpp | 66 +- .../WorldBuilder/src/WorldBuilderDoc.cpp | 132 +- .../WorldBuilder/src/WorldBuilderView.cpp | 10 +- .../WorldBuilder/src/addplayerdialog.cpp | 2 +- .../Tools/WorldBuilder/src/brushoptions.cpp | 4 +- .../Tools/WorldBuilder/src/mapobjectprops.cpp | 194 +-- .../Tools/WorldBuilder/src/playerlistdlg.cpp | 2 +- .../Tools/WorldBuilder/src/teamsdialog.cpp | 6 +- .../Code/Tools/WorldBuilder/src/wbview.cpp | 48 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 202 +-- GeneralsMD/Code/Tools/wdump/FindDialog.cpp | 2 +- GeneralsMD/Code/Tools/wdump/FindDialog.h | 4 +- GeneralsMD/Code/Tools/wdump/chunk_d.cpp | 16 +- GeneralsMD/Code/Tools/wdump/rawfilem.cpp | 30 +- GeneralsMD/Code/Tools/wdump/rawfilem.h | 8 +- GeneralsMD/Code/Tools/wdump/wdeview.cpp | 4 +- GeneralsMD/Code/Tools/wdump/wdlview.cpp | 2 +- GeneralsMD/Code/Tools/wdump/wdtview.cpp | 40 +- GeneralsMD/Code/Tools/wdump/wdump.cpp | 14 +- GeneralsMD/Code/Tools/wdump/wdumpdoc.cpp | 16 +- 2510 files changed, 38144 insertions(+), 38204 deletions(-) diff --git a/Core/GameEngine/Include/Common/ArchiveFileSystem.h b/Core/GameEngine/Include/Common/ArchiveFileSystem.h index a482e593b99..f323b0f8295 100644 --- a/Core/GameEngine/Include/Common/ArchiveFileSystem.h +++ b/Core/GameEngine/Include/Common/ArchiveFileSystem.h @@ -156,8 +156,8 @@ class ArchiveFileSystem : public SubsystemInterface protected: struct ArchivedDirectoryInfoResult { - ArchivedDirectoryInfoResult() : dirInfo(NULL) {} - Bool valid() const { return dirInfo != NULL; } + ArchivedDirectoryInfoResult() : dirInfo(nullptr) {} + Bool valid() const { return dirInfo != nullptr; } ArchivedDirectoryInfo* dirInfo; AsciiString lastToken; ///< Synonymous for file name if the search directory was a file path diff --git a/Core/GameEngine/Include/Common/AsciiString.h b/Core/GameEngine/Include/Common/AsciiString.h index 5af9cbe130e..c53fa59ee15 100644 --- a/Core/GameEngine/Include/Common/AsciiString.h +++ b/Core/GameEngine/Include/Common/AsciiString.h @@ -353,7 +353,7 @@ class AsciiString token was found. (note that this modifies 'this' as well, stripping the token off!) */ - Bool nextToken(AsciiString* token, const char* seps = NULL); + Bool nextToken(AsciiString* token, const char* seps = nullptr); /** return true iff the string is "NONE" (case-insensitive). @@ -420,7 +420,7 @@ inline int AsciiString::getByteCount() const inline Bool AsciiString::isEmpty() const { validate(); - return m_data == NULL || peek()[0] == 0; + return m_data == nullptr || peek()[0] == 0; } // ----------------------------------------------------- diff --git a/Core/GameEngine/Include/Common/AudioEventInfo.h b/Core/GameEngine/Include/Common/AudioEventInfo.h index ff412fcb6f4..55b6a5b3207 100644 --- a/Core/GameEngine/Include/Common/AudioEventInfo.h +++ b/Core/GameEngine/Include/Common/AudioEventInfo.h @@ -123,8 +123,8 @@ struct AudioEventInfo : public MemoryPoolObject // DynamicAudioEventInfo interfacing functions virtual Bool isLevelSpecific() const { return false; } ///< If true, this sound is only defined on the current level and can be deleted when that level ends - virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class - virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class + virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class + virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class /// Is this a permenant sound? That is, if I start this sound up, will it ever end /// "on its own" or only if I explicitly kill it? diff --git a/Core/GameEngine/Include/Common/GameAudio.h b/Core/GameEngine/Include/Common/GameAudio.h index de19bb7fcc2..afa29245bb8 100644 --- a/Core/GameEngine/Include/Common/GameAudio.h +++ b/Core/GameEngine/Include/Common/GameAudio.h @@ -134,7 +134,7 @@ class AudioManager : public SubsystemInterface AudioManager(); virtual ~AudioManager(); #if defined(RTS_DEBUG) - virtual void audioDebugDisplay(DebugDisplayInterface *dd, void *userData, FILE *fp = NULL ) = 0; + virtual void audioDebugDisplay(DebugDisplayInterface *dd, void *userData, FILE *fp = nullptr ) = 0; #endif // From SubsystemInterface @@ -395,7 +395,7 @@ class AudioManagerDummy : public AudioManager virtual AsciiString getMusicTrackName() const { return ""; } virtual void openDevice() {} virtual void closeDevice() {} - virtual void* getDevice() { return NULL; } + virtual void* getDevice() { return nullptr; } virtual void notifyOfAudioCompletion(UnsignedInt audioCompleted, UnsignedInt flags) {} virtual UnsignedInt getProviderCount(void) const { return 0; }; virtual AsciiString getProviderName(UnsignedInt providerNum) const { return ""; } @@ -416,7 +416,7 @@ class AudioManagerDummy : public AudioManager virtual void removePlayingAudio(AsciiString eventName) {} virtual void removeAllDisabledAudio() {} virtual Bool has3DSensitiveStreamsPlaying(void) const { return false; } - virtual void* getHandleForBink(void) { return NULL; } + virtual void* getHandleForBink(void) { return nullptr; } virtual void releaseHandleForBink(void) {} virtual void friend_forcePlayAudioEventRTS(const AudioEventRTS* eventToPlay) {} virtual void setPreferredProvider(AsciiString providerNdx) {} diff --git a/Core/GameEngine/Include/Common/GameMemory.h b/Core/GameEngine/Include/Common/GameMemory.h index 1ea96161cea..0e901b9d4af 100644 --- a/Core/GameEngine/Include/Common/GameMemory.h +++ b/Core/GameEngine/Include/Common/GameMemory.h @@ -321,7 +321,7 @@ class MemoryPool void addToList(MemoryPool **pHead); ///< add this pool to head of the linked list void removeFromList(MemoryPool **pHead); ///< remove this pool from the linked list #ifdef MEMORYPOOL_DEBUG - static void debugPoolInfoReport( MemoryPool *pool, FILE *fp = NULL ); ///< dump a report about this pool to the logfile + static void debugPoolInfoReport( MemoryPool *pool, FILE *fp = nullptr ); ///< dump a report about this pool to the logfile const char *debugGetBlockTagString(void *pBlock); ///< return the tagstring for the given block (assumed to belong to this pool) void debugMemoryVerifyPool(); ///< perform internal consistency check on this pool. Int debugPoolReportLeaks( const char* owner ); @@ -421,7 +421,7 @@ class DynamicMemoryAllocator Int debugCalcRawBlockBytes(Int *numBlocks); ///< calculate the number of bytes in "raw" (non-subpool) blocks void debugMemoryVerifyDma(); ///< perform internal consistency check const char *debugGetBlockTagString(void *pBlock); ///< return the tagstring for the given block (assumed to belong to this dma) - void debugDmaInfoReport( FILE *fp = NULL ); ///< dump a report about this pool to the logfile + void debugDmaInfoReport( FILE *fp = nullptr ); ///< dump a report about this pool to the logfile Int debugDmaReportLeaks(); #endif #ifdef MEMORYPOOL_CHECKPOINTING @@ -545,7 +545,7 @@ class MemoryPoolFactory /// destroy the contents of all pools and dmas. (the pools and dma's are not destroyed, just reset) void reset(); - void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = NULL ); + void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = nullptr ); #ifdef MEMORYPOOL_DEBUG @@ -559,7 +559,7 @@ class MemoryPoolFactory const char *debugGetBlockTagString(void *pBlock); /// dump a report with the given options to the logfile. - void debugMemoryReport(Int flags, Int startCheckpoint, Int endCheckpoint, FILE *fp = NULL ); + void debugMemoryReport(Int flags, Int startCheckpoint, Int endCheckpoint, FILE *fp = nullptr ); void debugSetInitFillerIndex(Int index); @@ -589,7 +589,7 @@ private: \ order-of-execution problem for static variables, ensuring this is not executed \ prior to the initialization of TheMemoryPoolFactory. \ */ \ - DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is NULL")); \ + DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is null")); \ static MemoryPool *The##ARGCLASS##Pool = TheMemoryPoolFactory->findMemoryPool(ARGPOOLNAME); \ DEBUG_ASSERTCRASH(The##ARGCLASS##Pool, ("Pool \"%s\" not found (did you set it up in initMemoryPools?)", ARGPOOLNAME)); \ DEBUG_ASSERTCRASH(The##ARGCLASS##Pool->getAllocationSize() >= sizeof(ARGCLASS), ("Pool \"%s\" is too small for this class (currently %d, need %d)", ARGPOOLNAME, The##ARGCLASS##Pool->getAllocationSize(), sizeof(ARGCLASS))); \ @@ -608,7 +608,7 @@ private: \ order-of-execution problem for static variables, ensuring this is not executed \ prior to the initialization of TheMemoryPoolFactory. \ */ \ - DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is NULL")); \ + DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("TheMemoryPoolFactory is null")); \ static MemoryPool *The##ARGCLASS##Pool = TheMemoryPoolFactory->createMemoryPool(ARGPOOLNAME, sizeof(ARGCLASS), ARGINITIAL, ARGOVERFLOW); \ DEBUG_ASSERTCRASH(The##ARGCLASS##Pool, ("Pool \"%s\" not found (did you set it up in initMemoryPools?)", ARGPOOLNAME)); \ DEBUG_ASSERTCRASH(The##ARGCLASS##Pool->getAllocationSize() >= sizeof(ARGCLASS), ("Pool \"%s\" is too small for this class (currently %d, need %d)", ARGPOOLNAME, The##ARGCLASS##Pool->getAllocationSize(), sizeof(ARGCLASS))); \ @@ -902,9 +902,9 @@ class MemoryPoolObjectHolder private: MemoryPoolObject *m_mpo; public: - MemoryPoolObjectHolder(MemoryPoolObject *mpo = NULL) : m_mpo(mpo) { } + MemoryPoolObjectHolder(MemoryPoolObject *mpo = nullptr) : m_mpo(mpo) { } void hold(MemoryPoolObject *mpo) { DEBUG_ASSERTCRASH(!m_mpo, ("already holding")); m_mpo = mpo; } - void release() { m_mpo = NULL; } + void release() { m_mpo = nullptr; } ~MemoryPoolObjectHolder() { deleteInstance(m_mpo); } }; diff --git a/Core/GameEngine/Include/Common/GameMemoryNull.h b/Core/GameEngine/Include/Common/GameMemoryNull.h index 5babbf4553c..263f7a1dcb9 100644 --- a/Core/GameEngine/Include/Common/GameMemoryNull.h +++ b/Core/GameEngine/Include/Common/GameMemoryNull.h @@ -64,11 +64,11 @@ class MemoryPoolFactory { public: - void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = NULL ); + void memoryPoolUsageReport( const char* filename, FILE *appendToFileInstead = nullptr ); #ifdef MEMORYPOOL_DEBUG - void debugMemoryReport(Int flags, Int startCheckpoint, Int endCheckpoint, FILE *fp = NULL ); + void debugMemoryReport(Int flags, Int startCheckpoint, Int endCheckpoint, FILE *fp = nullptr ); void debugSetInitFillerIndex(Int index); #endif diff --git a/Core/GameEngine/Include/Common/LocalFile.h b/Core/GameEngine/Include/Common/LocalFile.h index db9568ee0e7..ce6b12a1465 100644 --- a/Core/GameEngine/Include/Common/LocalFile.h +++ b/Core/GameEngine/Include/Common/LocalFile.h @@ -103,7 +103,7 @@ class LocalFile : public File virtual Int writeChar( const WideChar* character ); ///< Write a wide character to the file virtual Int seek( Int new_pos, seekMode mode = CURRENT ); ///< Set file position: See File::seek virtual Bool flush(); ///< flush data to disk - virtual void nextLine(Char *buf = NULL, Int bufSize = 0); ///< moves file position to after the next new-line + virtual void nextLine(Char *buf = nullptr, Int bufSize = 0); ///< moves file position to after the next new-line virtual Bool scanInt(Int &newInt); ///< return what gets read in as an integer at the current file position. virtual Bool scanReal(Real &newReal); ///< return what gets read in as a float at the current file position. virtual Bool scanString(AsciiString &newString); ///< return what gets read in as a string at the current file position. diff --git a/Core/GameEngine/Include/Common/RAMFile.h b/Core/GameEngine/Include/Common/RAMFile.h index 084aa8d857e..4e37b260cab 100644 --- a/Core/GameEngine/Include/Common/RAMFile.h +++ b/Core/GameEngine/Include/Common/RAMFile.h @@ -94,7 +94,7 @@ class RAMFile : public File virtual Int writeChar( const WideChar* character ); ///< Write a wide character to the file virtual Int seek( Int new_pos, seekMode mode = CURRENT ); ///< Set file position: See File::seek virtual Bool flush(); ///< flush data to disk - virtual void nextLine(Char *buf = NULL, Int bufSize = 0); ///< moves current position to after the next new-line + virtual void nextLine(Char *buf = nullptr, Int bufSize = 0); ///< moves current position to after the next new-line virtual Bool scanInt(Int &newInt); ///< return what gets read as an integer from the current memory position. virtual Bool scanReal(Real &newReal); ///< return what gets read as a float from the current memory position. diff --git a/Core/GameEngine/Include/Common/Radar.h b/Core/GameEngine/Include/Common/Radar.h index 431cfbf1668..0e187c0c0b3 100644 --- a/Core/GameEngine/Include/Common/Radar.h +++ b/Core/GameEngine/Include/Common/Radar.h @@ -143,7 +143,7 @@ static const char *const RadarPriorityNames[] = "UNIT", // unit level drawing priority "LOCAL_UNIT_ONLY", // unit priority, but only on the radar if controlled by the local player - NULL + nullptr }; static_assert(ARRAY_SIZE(RadarPriorityNames) == RADAR_PRIORITY_NUM_PRIORITIES + 1, "Incorrect array size"); #endif // DEFINE_RADAR_PRIOTITY_NAMES @@ -165,7 +165,7 @@ class Radar : public Snapshot, virtual void update( void ); ///< subsystem per frame update // is the game window parameter the radar window - Bool isRadarWindow( GameWindow *window ) { return (m_radarWindow == window) && (m_radarWindow != NULL); } + Bool isRadarWindow( GameWindow *window ) { return (m_radarWindow == window) && (m_radarWindow != nullptr); } Bool radarToWorld( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point on terrain Bool radarToWorld2D( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point (x,y only!) diff --git a/Core/GameEngine/Include/Common/StreamingArchiveFile.h b/Core/GameEngine/Include/Common/StreamingArchiveFile.h index bf481b19784..270f94a4007 100644 --- a/Core/GameEngine/Include/Common/StreamingArchiveFile.h +++ b/Core/GameEngine/Include/Common/StreamingArchiveFile.h @@ -90,7 +90,7 @@ class StreamingArchiveFile : public RAMFile virtual Int seek( Int new_pos, seekMode mode = CURRENT ); ///< Set file position: See File::seek // Ini's should not be parsed with streaming files, that's just dumb. - virtual void nextLine(Char *buf = NULL, Int bufSize = 0) { DEBUG_CRASH(("Should not call nextLine on a streaming file.")); } + virtual void nextLine(Char *buf = nullptr, Int bufSize = 0) { DEBUG_CRASH(("Should not call nextLine on a streaming file.")); } virtual Bool scanInt(Int &newInt) { DEBUG_CRASH(("Should not call scanInt on a streaming file.")); return FALSE; } virtual Bool scanReal(Real &newReal) { DEBUG_CRASH(("Should not call scanReal on a streaming file.")); return FALSE; } virtual Bool scanString(AsciiString &newString) { DEBUG_CRASH(("Should not call scanString on a streaming file.")); return FALSE; } @@ -99,7 +99,7 @@ class StreamingArchiveFile : public RAMFile virtual Bool openFromArchive(File *archiveFile, const AsciiString& filename, Int offset, Int size); ///< copy file data from the given file at the given offset for the given size. virtual Bool copyDataToFile(File *localFile) { DEBUG_CRASH(("Are you sure you meant to copyDataToFile on a streaming file?")); return FALSE; } - virtual char* readEntireAndClose() { DEBUG_CRASH(("Are you sure you meant to readEntireAndClose on a streaming file?")); return NULL; } + virtual char* readEntireAndClose() { DEBUG_CRASH(("Are you sure you meant to readEntireAndClose on a streaming file?")); return nullptr; } virtual File* convertToRAMFile() { DEBUG_CRASH(("Are you sure you meant to readEntireAndClose on a streaming file?")); return this; } }; diff --git a/Core/GameEngine/Include/Common/UnicodeString.h b/Core/GameEngine/Include/Common/UnicodeString.h index ff66edfe478..1a3295f892e 100644 --- a/Core/GameEngine/Include/Common/UnicodeString.h +++ b/Core/GameEngine/Include/Common/UnicodeString.h @@ -394,7 +394,7 @@ inline int UnicodeString::getByteCount() const inline Bool UnicodeString::isEmpty() const { validate(); - return m_data == NULL || peek()[0] == 0; + return m_data == nullptr || peek()[0] == 0; } // ----------------------------------------------------- diff --git a/Core/GameEngine/Include/Common/file.h b/Core/GameEngine/Include/Common/file.h index 80e66445914..45e0ee9bf1c 100644 --- a/Core/GameEngine/Include/Common/file.h +++ b/Core/GameEngine/Include/Common/file.h @@ -183,7 +183,7 @@ class File : public MemoryPoolObject * END: means seek the specified number of bytes back from the end of the file */ virtual Bool flush() = 0; ///< flush data to disk - virtual void nextLine(Char *buf = NULL, Int bufSize = 0) = 0; ///< reads until it reaches a new-line character + virtual void nextLine(Char *buf = nullptr, Int bufSize = 0) = 0; ///< reads until it reaches a new-line character virtual Bool scanInt(Int &newInt) = 0; ///< read an integer from the current file position. virtual Bool scanReal(Real &newReal) = 0; ///< read a real number from the current file position. diff --git a/Core/GameEngine/Include/GameClient/TerrainVisual.h b/Core/GameEngine/Include/GameClient/TerrainVisual.h index 8463ff83ab1..d7ea15b5a5b 100644 --- a/Core/GameEngine/Include/GameClient/TerrainVisual.h +++ b/Core/GameEngine/Include/GameClient/TerrainVisual.h @@ -75,7 +75,7 @@ struct SeismicSimulationNode m_region.hi.x = 0; m_region.hi.y = 0; m_clean = FALSE; - callbackFilter = NULL; + callbackFilter = nullptr; m_life = 0; m_magnitude = DEFAULT_SEISMIC_SIMULATION_MAGNITUDE; @@ -95,7 +95,7 @@ struct SeismicSimulationNode m_magnitude = ssn.m_magnitude; } - SeismicSimulationNode( const Coord3D* ctr, Real rad, Real mag, SeismicSimulationFilterBase *cbf = NULL ) + SeismicSimulationNode( const Coord3D* ctr, Real rad, Real mag, SeismicSimulationFilterBase *cbf = nullptr ) { m_center.x = REAL_TO_INT_FLOOR(ctr->x/MAP_XY_FACTOR); m_center.y = REAL_TO_INT_FLOOR(ctr->y/MAP_XY_FACTOR); @@ -114,7 +114,7 @@ struct SeismicSimulationNode SeismicSimulationFilterBase::SeismicSimStatusCode handleFilterCallback( WorldHeightMapInterfaceClass *heightMap ) { - if ( callbackFilter == NULL ) + if ( callbackFilter == nullptr ) return SeismicSimulationFilterBase::SEISMIC_STATUS_INVALID; ++m_life; @@ -126,7 +126,7 @@ struct SeismicSimulationNode { DEBUG_ASSERTCRASH( callbackFilter, ("SeismicSimulationNode::applyGravity() has no callback filter!") ); - if ( callbackFilter == NULL ) + if ( callbackFilter == nullptr ) return velocityIn;//oops, we have no callback! return callbackFilter->applyGravityCallback( velocityIn ); @@ -186,7 +186,7 @@ static const char *const TerrainLODNames[] = "AUTOMATIC", "DISABLE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TerrainLODNames) == TERRAIN_LOD_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_LOD_NAMES @@ -285,8 +285,8 @@ class TerrainVisual : public Snapshot, virtual void updateSeismicSimulations( void ) = 0; /// walk the SeismicSimulationList and, well, do it. virtual void addSeismicSimulation( const SeismicSimulationNode& sim ) = 0; #endif - virtual WorldHeightMap* getLogicHeightMap( void ) {return NULL;}; - virtual WorldHeightMap* getClientHeightMap( void ) {return NULL;}; + virtual WorldHeightMap* getLogicHeightMap( void ) {return nullptr;}; + virtual WorldHeightMap* getClientHeightMap( void ) {return nullptr;}; //////////////////////////////////////////////////// //////////////////////////////////////////////////// //////////////////////////////////////////////////// diff --git a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h index 98b98fe36ef..b10b79d2d62 100644 --- a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h +++ b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h @@ -176,8 +176,8 @@ class ConnectionManager void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data. // The connections are set up like the slot list. The connection corresponding to the local - // player's position in the slot list will be NULL. Connections corresponding to slots that - // do not have a player will also be NULL. + // player's position in the slot list will be null. Connections corresponding to slots that + // do not have a player will also be null. Connection *m_connections[MAX_SLOTS]; Transport *m_transport; diff --git a/Core/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h b/Core/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h index 5178e7d36bb..67744cf75c7 100644 --- a/Core/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h +++ b/Core/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h @@ -147,7 +147,7 @@ class PeerRequest UnsignedInt ladderPassCRC; Int maxPing; Int maxDiscons, discons; - char pings[17]; // 8 servers (0-ff), 1 NULL + char pings[17]; // 8 servers (0-ff), 1 null terminator Int numPlayers; Int botID; Int roomID; diff --git a/Core/GameEngine/Include/GameNetwork/GameSpyOverlay.h b/Core/GameEngine/Include/GameNetwork/GameSpyOverlay.h index b6dd9035949..26976e9833d 100644 --- a/Core/GameEngine/Include/GameNetwork/GameSpyOverlay.h +++ b/Core/GameEngine/Include/GameNetwork/GameSpyOverlay.h @@ -36,7 +36,7 @@ #include "GameClient/GameWindowManager.h" void ClearGSMessageBoxes( void ); ///< Tear down any GS message boxes (e.g. in case we have a new one to put up) -void GSMessageBoxOk(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc okFunc = NULL); ///< Display a Message box with Ok button and track it +void GSMessageBoxOk(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc okFunc = nullptr); ///< Display a Message box with Ok button and track it void GSMessageBoxOkCancel(UnicodeString title, UnicodeString message, GameWinMsgBoxFunc okFunc, GameWinMsgBoxFunc cancelFunc); ///< Display a Message box with Ok/Cancel buttons and track it void GSMessageBoxYesNo(UnicodeString title, UnicodeString message, GameWinMsgBoxFunc yesFunc, GameWinMsgBoxFunc noFunc); ///< Display a Message box with Yes/No buttons and track it void RaiseGSMessageBox( void ); ///< Bring GS message box to the foreground (if we transition screens while a message box is up) diff --git a/Core/GameEngine/Include/GameNetwork/IPEnumeration.h b/Core/GameEngine/Include/GameNetwork/IPEnumeration.h index 0b2651d2484..dea7352a587 100644 --- a/Core/GameEngine/Include/GameNetwork/IPEnumeration.h +++ b/Core/GameEngine/Include/GameNetwork/IPEnumeration.h @@ -37,7 +37,7 @@ class EnumeratedIP : public MemoryPoolObject { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(EnumeratedIP, "EnumeratedIP") public: - EnumeratedIP() { m_IPstring = ""; m_next = NULL; m_IP = 0; } + EnumeratedIP() { m_IPstring = ""; m_next = nullptr; m_IP = 0; } // Access functions AsciiString getIPstring( void ) { return m_IPstring; } diff --git a/Core/GameEngine/Include/GameNetwork/LANAPI.h b/Core/GameEngine/Include/GameNetwork/LANAPI.h index eecd1eedbaf..9ea41bb6463 100644 --- a/Core/GameEngine/Include/GameNetwork/LANAPI.h +++ b/Core/GameEngine/Include/GameNetwork/LANAPI.h @@ -238,7 +238,7 @@ class LANAPI : public LANAPIInterface Bool m_isInLANMenu; ///< true while we are in a LAN menu (lobby, game options, direct connect) Bool m_inLobby; ///< Are we in the lobby (not in a game)? - LANGameInfo * m_currentGame; ///< Pointer to game (setup screen) we are currently in (NULL for lobby) + LANGameInfo * m_currentGame; ///< Pointer to game (setup screen) we are currently in (null for lobby) //LANGameInfo *m_currentGameInfo; ///< Pointer to game setup info we are currently in. UnsignedInt m_localIP; diff --git a/Core/GameEngine/Include/GameNetwork/LANGameInfo.h b/Core/GameEngine/Include/GameNetwork/LANGameInfo.h index dbdeb0dfc69..33d7a77d615 100644 --- a/Core/GameEngine/Include/GameNetwork/LANGameInfo.h +++ b/Core/GameEngine/Include/GameNetwork/LANGameInfo.h @@ -42,7 +42,7 @@ class LANGameSlot : public GameSlot public: LANGameSlot(); - LANPlayer *getUser( void ); ///< Get the User structure associated with the slot (NULL for non-humans) + LANPlayer *getUser( void ); ///< Get the User structure associated with the slot (null for non-humans) // Various tests Bool isUser( LANPlayer *user ); ///< Does this slot contain the given user? Based off user->name diff --git a/Core/GameEngine/Include/GameNetwork/LANPlayer.h b/Core/GameEngine/Include/GameNetwork/LANPlayer.h index f71e7b18a73..e7c4e2f1e16 100644 --- a/Core/GameEngine/Include/GameNetwork/LANPlayer.h +++ b/Core/GameEngine/Include/GameNetwork/LANPlayer.h @@ -35,7 +35,7 @@ class LANPlayer { public: - LANPlayer() { m_name = m_login = m_host = L""; m_lastHeard = 0; m_next = NULL; m_IP = 0; } + LANPlayer() { m_name = m_login = m_host = L""; m_lastHeard = 0; m_next = nullptr; m_IP = 0; } // Access functions UnicodeString getName( void ) { return m_name; } diff --git a/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h b/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h index e87de2eb6c2..1c60b0bf50a 100644 --- a/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h +++ b/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h @@ -51,15 +51,15 @@ public C FEBDispatch() { - m_ptinfo = NULL; - m_dispatch = NULL; + m_ptinfo = nullptr; + m_dispatch = nullptr; ITypeLib *ptlib; HRESULT hr; HRESULT TypeLibraryLoadResult; char filename[256]; - GetModuleFileName(NULL, filename, sizeof(filename)); + GetModuleFileName(nullptr, filename, sizeof(filename)); _bstr_t bstr(filename); TypeLibraryLoadResult = LoadTypeLib(bstr, &ptlib); @@ -81,7 +81,7 @@ public C } } - if ( m_dispatch == NULL ) + if ( m_dispatch == nullptr ) { DEBUG_LOG(("Error creating Dispatch for Web interface")); } diff --git a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp index c15c26a570e..fc0743c1f56 100644 --- a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp +++ b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp @@ -68,7 +68,7 @@ AudioEventRTS::AudioEventRTS() m_shouldFade(false), m_isLogicalAudio(false), m_filenameToLoad(AsciiString::TheEmptyString), - m_eventInfo(NULL), + m_eventInfo(nullptr), m_playingHandle(0), m_killThisHandle(0), m_pitchShift(1.0), @@ -95,7 +95,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName ) m_shouldFade(false), m_isLogicalAudio(false), m_filenameToLoad(AsciiString::TheEmptyString), - m_eventInfo(NULL), + m_eventInfo(nullptr), m_playingHandle(0), m_killThisHandle(0), m_pitchShift(1.0), @@ -123,7 +123,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, ObjectID ownerID ) m_shouldFade(false), m_isLogicalAudio(false), m_filenameToLoad(AsciiString::TheEmptyString), - m_eventInfo(NULL), + m_eventInfo(nullptr), m_playingHandle(0), m_killThisHandle(0), m_pitchShift(1.0), @@ -159,7 +159,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, DrawableID drawableI m_shouldFade(false), m_isLogicalAudio(false), m_filenameToLoad(AsciiString::TheEmptyString), - m_eventInfo(NULL), + m_eventInfo(nullptr), m_playingHandle(0), m_killThisHandle(0), m_pitchShift(1.0), @@ -194,7 +194,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, const Coord3D *posit m_shouldFade(false), m_isLogicalAudio(false), m_filenameToLoad(AsciiString::TheEmptyString), - m_eventInfo(NULL), + m_eventInfo(nullptr), m_playingHandle(0), m_killThisHandle(0), m_pitchShift(1.0), @@ -302,9 +302,9 @@ AudioEventRTS::~AudioEventRTS() //------------------------------------------------------------------------------------------------- void AudioEventRTS::setEventName( AsciiString name ) { - if ((name != m_eventName) && m_eventInfo != NULL) { + if ((name != m_eventName) && m_eventInfo != nullptr) { // Clear out the audio event info, cause its not valid for the new event. - m_eventInfo = NULL; + m_eventInfo = nullptr; } m_eventName = name; @@ -526,7 +526,7 @@ const AudioEventInfo *AudioEventRTS::getAudioEventInfo( void ) const if (m_eventInfo->m_audioName == m_eventName) { return m_eventInfo; } else { - m_eventInfo = NULL; + m_eventInfo = nullptr; } } @@ -568,7 +568,7 @@ const Coord3D* AudioEventRTS::getPosition( void ) return &m_positionOfAudio; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -755,7 +755,7 @@ const Coord3D *AudioEventRTS::getCurrentPosition( void ) return &m_positionOfAudio; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 23c944fd950..17dcb2f6ad6 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -80,7 +80,7 @@ static const char* TheSpeakerTypes[] = "4 Speaker", "5.1 Surround", "7.1 Surround", - NULL + nullptr }; static const Int TheSpeakerTypesCount = sizeof(TheSpeakerTypes) / sizeof(TheSpeakerTypes[0]); @@ -90,54 +90,54 @@ static void parseSpeakerType( INI *ini, void *instance, void *store, const void // Field Parse table for Audio Settings /////////////////////////////////////////////////////////// static const FieldParse audioSettingsFieldParseTable[] = { - { "AudioRoot", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_audioRoot) }, - { "SoundsFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_soundsFolder) }, - { "MusicFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_musicFolder) }, - { "StreamingFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_streamingFolder) }, - { "SoundsExtension", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_soundsExtension) }, - - { "UseDigital", INI::parseBool, NULL, offsetof( AudioSettings, m_useDigital) }, - { "UseMidi", INI::parseBool, NULL, offsetof( AudioSettings, m_useMidi) }, - { "OutputRate", INI::parseInt, NULL, offsetof( AudioSettings, m_outputRate) }, - { "OutputBits", INI::parseInt, NULL, offsetof( AudioSettings, m_outputBits) }, - { "OutputChannels", INI::parseInt, NULL, offsetof( AudioSettings, m_outputChannels) }, - { "SampleCount2D", INI::parseInt, NULL, offsetof( AudioSettings, m_sampleCount2D) }, - { "SampleCount3D", INI::parseInt, NULL, offsetof( AudioSettings, m_sampleCount3D) }, - { "StreamCount", INI::parseInt, NULL, offsetof( AudioSettings, m_streamCount) }, - - { "Preferred3DHW1", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[0]) }, - { "Preferred3DHW2", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[1]) }, - { "Preferred3DHW3", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[2]) }, - { "Preferred3DHW4", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[3]) }, - - { "Preferred3DSW", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[4]) }, - - { "Default2DSpeakerType", parseSpeakerType, NULL, offsetof( AudioSettings, m_defaultSpeakerType2D) }, - { "Default3DSpeakerType", parseSpeakerType, NULL, offsetof( AudioSettings, m_defaultSpeakerType3D) }, - - { "MinSampleVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_minVolume) }, - { "GlobalMinRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMinRange) }, - { "GlobalMaxRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMaxRange) }, - { "TimeBetweenDrawableSounds", INI::parseDurationUnsignedInt, NULL, offsetof( AudioSettings, m_drawableAmbientFrames) }, - { "TimeToFadeAudio", INI::parseDurationUnsignedInt, NULL, offsetof( AudioSettings, m_fadeAudioFrames) }, - { "AudioFootprintInBytes",INI::parseUnsignedInt, NULL, offsetof( AudioSettings, m_maxCacheSize) }, - { "Relative2DVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_relative2DVolume ) }, - { "DefaultSoundVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultSoundVolume) }, - { "Default3DSoundVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_default3DSoundVolume) }, - { "DefaultSpeechVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultSpeechVolume) }, - { "DefaultMusicVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultMusicVolume) }, - { "DefaultMoneyTransactionVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultMoneyTransactionVolume) }, - { "MicrophoneDesiredHeightAboveTerrain", INI::parseReal, NULL, offsetof( AudioSettings, m_microphoneDesiredHeightAboveTerrain ) }, - { "MicrophoneMaxPercentageBetweenGroundAndCamera", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_microphoneMaxPercentageBetweenGroundAndCamera ) }, - { "ZoomMinDistance", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMinDistance ) }, - { "ZoomMaxDistance", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMaxDistance ) }, - { "ZoomSoundVolumePercentageAmount", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_zoomSoundVolumePercentageAmount ) }, - - { NULL, NULL, NULL, NULL } + { "AudioRoot", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_audioRoot) }, + { "SoundsFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_soundsFolder) }, + { "MusicFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_musicFolder) }, + { "StreamingFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_streamingFolder) }, + { "SoundsExtension", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_soundsExtension) }, + + { "UseDigital", INI::parseBool, nullptr, offsetof( AudioSettings, m_useDigital) }, + { "UseMidi", INI::parseBool, nullptr, offsetof( AudioSettings, m_useMidi) }, + { "OutputRate", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputRate) }, + { "OutputBits", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputBits) }, + { "OutputChannels", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputChannels) }, + { "SampleCount2D", INI::parseInt, nullptr, offsetof( AudioSettings, m_sampleCount2D) }, + { "SampleCount3D", INI::parseInt, nullptr, offsetof( AudioSettings, m_sampleCount3D) }, + { "StreamCount", INI::parseInt, nullptr, offsetof( AudioSettings, m_streamCount) }, + + { "Preferred3DHW1", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[0]) }, + { "Preferred3DHW2", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[1]) }, + { "Preferred3DHW3", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[2]) }, + { "Preferred3DHW4", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[3]) }, + + { "Preferred3DSW", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[4]) }, + + { "Default2DSpeakerType", parseSpeakerType, nullptr, offsetof( AudioSettings, m_defaultSpeakerType2D) }, + { "Default3DSpeakerType", parseSpeakerType, nullptr, offsetof( AudioSettings, m_defaultSpeakerType3D) }, + + { "MinSampleVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_minVolume) }, + { "GlobalMinRange", INI::parseInt, nullptr, offsetof( AudioSettings, m_globalMinRange) }, + { "GlobalMaxRange", INI::parseInt, nullptr, offsetof( AudioSettings, m_globalMaxRange) }, + { "TimeBetweenDrawableSounds", INI::parseDurationUnsignedInt, nullptr, offsetof( AudioSettings, m_drawableAmbientFrames) }, + { "TimeToFadeAudio", INI::parseDurationUnsignedInt, nullptr, offsetof( AudioSettings, m_fadeAudioFrames) }, + { "AudioFootprintInBytes",INI::parseUnsignedInt, nullptr, offsetof( AudioSettings, m_maxCacheSize) }, + { "Relative2DVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_relative2DVolume ) }, + { "DefaultSoundVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultSoundVolume) }, + { "Default3DSoundVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_default3DSoundVolume) }, + { "DefaultSpeechVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultSpeechVolume) }, + { "DefaultMusicVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultMusicVolume) }, + { "DefaultMoneyTransactionVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultMoneyTransactionVolume) }, + { "MicrophoneDesiredHeightAboveTerrain", INI::parseReal, nullptr, offsetof( AudioSettings, m_microphoneDesiredHeightAboveTerrain ) }, + { "MicrophoneMaxPercentageBetweenGroundAndCamera", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_microphoneMaxPercentageBetweenGroundAndCamera ) }, + { "ZoomMinDistance", INI::parseReal, nullptr, offsetof( AudioSettings, m_zoomMinDistance ) }, + { "ZoomMaxDistance", INI::parseReal, nullptr, offsetof( AudioSettings, m_zoomMaxDistance ) }, + { "ZoomSoundVolumePercentageAmount", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_zoomSoundVolumePercentageAmount ) }, + + { nullptr, nullptr, nullptr, 0 } }; // Singleton TheAudio ///////////////////////////////////////////////////////////////////////////// -AudioManager *TheAudio = NULL; +AudioManager *TheAudio = nullptr; // AudioManager Device Independent functions ////////////////////////////////////////////////////// @@ -146,8 +146,8 @@ AudioManager::AudioManager() : m_sound3DOn(TRUE), m_musicOn(TRUE), m_speechOn(TRUE), - m_music(NULL), - m_sound(NULL), + m_music(nullptr), + m_sound(nullptr), m_surroundSpeakers(FALSE), m_hardwareAccel(FALSE), m_musicPlayingFromCD(FALSE) @@ -170,7 +170,7 @@ AudioManager::AudioManager() : m_audioSettings = NEW AudioSettings; m_miscAudio = NEW MiscAudio; m_silentAudioEvent = NEW AudioEventRTS; - m_savedValues = NULL; + m_savedValues = nullptr; m_disallowSpeech = FALSE; } @@ -186,19 +186,19 @@ AudioManager::~AudioManager() m_allAudioEventInfo.clear(); delete m_silentAudioEvent; - m_silentAudioEvent = NULL; + m_silentAudioEvent = nullptr; delete m_music; - m_music = NULL; + m_music = nullptr; delete m_sound; - m_sound = NULL; + m_sound = nullptr; delete m_miscAudio; - m_miscAudio = NULL; + m_miscAudio = nullptr; delete m_audioSettings; - m_audioSettings = NULL; + m_audioSettings = nullptr; delete [] m_savedValues; } @@ -207,22 +207,22 @@ AudioManager::~AudioManager() void AudioManager::init() { INI ini; - ini.loadFileDirectory( "Data\\INI\\AudioSettings", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\AudioSettings", INI_LOAD_OVERWRITE, nullptr); - ini.loadFileDirectory( "Data\\INI\\Default\\Music", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Music", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Music", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Music", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\Default\\SoundEffects", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\SoundEffects", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\SoundEffects", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\SoundEffects", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\Default\\Speech", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Speech", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Speech", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Speech", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\Default\\Voice", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Voice", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Voice", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Voice", INI_LOAD_OVERWRITE, nullptr ); // do the miscellaneous sound files last so that we find the AudioEventRTS associated with the events. - ini.loadFileDirectory( "Data\\INI\\MiscAudio", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\MiscAudio", INI_LOAD_OVERWRITE, nullptr); // determine if one of the music tracks exists. Since their now BIGd, one implies all. // If they don't exist, then attempt to load them from the CD. @@ -498,7 +498,7 @@ Bool AudioManager::isValidAudioEvent(const AudioEventRTS *eventToCheck) const getInfoForAudioEvent(eventToCheck); - return (eventToCheck->getAudioEventInfo() != NULL); + return (eventToCheck->getAudioEventInfo() != nullptr); } //------------------------------------------------------------------------------------------------- @@ -864,7 +864,7 @@ AudioEventInfo *AudioManager::findAudioEventInfo( AsciiString eventName ) const AudioEventInfoHash::const_iterator it; it = m_allAudioEventInfo.find(eventName); if (it == m_allAudioEventInfo.end()) { - return NULL; + return nullptr; } return (*it).second; @@ -951,7 +951,7 @@ Real AudioManager::getAudioLengthMS( const AudioEventRTS *event ) //------------------------------------------------------------------------------------------------- Bool AudioManager::isMusicAlreadyLoaded(void) const { - const AudioEventInfo *musicToLoad = NULL; + const AudioEventInfo *musicToLoad = nullptr; AudioEventInfoHash::const_iterator it; for (it = m_allAudioEventInfo.begin(); it != m_allAudioEventInfo.end(); ++it) { if (it->second) { @@ -1012,7 +1012,7 @@ Bool AudioManager::shouldPlayLocally(const AudioEventRTS *audioEvent) if( !localPlayer->isPlayerActive() ) { //We are dead, thus are observing. Get the player we are observing. It's - //possible that we're not looking at any player, therefore it can be NULL. + //possible that we're not looking at any player, therefore it can be null. localPlayer = TheControlBar->getObserverLookAtPlayer(); } @@ -1034,12 +1034,12 @@ Bool AudioManager::shouldPlayLocally(const AudioEventRTS *audioEvent) Player *owningPlayer = ThePlayerList->getNthPlayer(audioEvent->getPlayerIndex()); - if (BitIsSet(ei->m_type, ST_PLAYER) && BitIsSet(ei->m_type, ST_UI) && owningPlayer == NULL) { + if (BitIsSet(ei->m_type, ST_PLAYER) && BitIsSet(ei->m_type, ST_UI) && owningPlayer == nullptr) { DEBUG_ASSERTCRASH(!TheGameLogic->isInGameLogicUpdate(), ("Playing %s sound -- player-based UI sound without specifying a player.", ei->m_audioName.str())); return TRUE; } - if (owningPlayer == NULL) { + if (owningPlayer == nullptr) { DEBUG_CRASH(("Sound '%s' expects an owning player, but the audio event that created it didn't specify one.", ei->m_audioName.str())); return FALSE; } @@ -1050,7 +1050,7 @@ Bool AudioManager::shouldPlayLocally(const AudioEventRTS *audioEvent) } const Team *localTeam = localPlayer->getDefaultTeam(); - if (localTeam == NULL) { + if (localTeam == nullptr) { return FALSE; } @@ -1082,7 +1082,7 @@ AudioHandle AudioManager::allocateNewHandle( void ) void AudioManager::releaseAudioEventRTS( AudioEventRTS *&eventToRelease ) { delete eventToRelease; - eventToRelease = NULL; + eventToRelease = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1116,7 +1116,7 @@ void AudioManager::regainFocus( void ) // Now, blow away the old volumes. delete [] m_savedValues; - m_savedValues = NULL; + m_savedValues = nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Core/GameEngine/Source/Common/Audio/GameMusic.cpp b/Core/GameEngine/Source/Common/Audio/GameMusic.cpp index 1f0bbe18c02..5e05c6ee4d3 100644 --- a/Core/GameEngine/Source/Common/Audio/GameMusic.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameMusic.cpp @@ -75,10 +75,10 @@ const FieldParse MusicTrack::m_musicTrackFieldParseTable[] = { - { "Filename", INI::parseAsciiString, NULL, offsetof( MusicTrack, filename ) }, - { "Volume", INI::parsePercentToReal, NULL, offsetof( MusicTrack, volume ) }, - { "Ambient", INI::parseBool, NULL, offsetof( MusicTrack, ambient ) }, - { NULL, NULL, NULL, 0 }, + { "Filename", INI::parseAsciiString, nullptr, offsetof( MusicTrack, filename ) }, + { "Volume", INI::parsePercentToReal, nullptr, offsetof( MusicTrack, volume ) }, + { "Ambient", INI::parseBool, nullptr, offsetof( MusicTrack, ambient ) }, + { nullptr, nullptr, nullptr, 0 }, }; diff --git a/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp b/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp index 4af0d3a6a17..6357b7fbd0b 100644 --- a/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp +++ b/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp @@ -27,33 +27,33 @@ CSimplePlayer::CSimplePlayer( HRESULT* phr ) m_cRef = 1; m_cBuffersOutstanding = 0; - m_pReader = NULL; + m_pReader = nullptr; - m_pHeader = NULL; - m_hwo = NULL; + m_pHeader = nullptr; + m_hwo = nullptr; m_fEof = FALSE; - m_pszUrl = NULL; + m_pszUrl = nullptr; *phr = S_OK; - m_hOpenEvent = CreateEvent( NULL, FALSE, FALSE, SIMPLE_PLAYER_OPEN_EVENT ); - if ( NULL == m_hOpenEvent ) + m_hOpenEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_OPEN_EVENT ); + if ( nullptr == m_hOpenEvent ) { *phr = E_OUTOFMEMORY; } - m_hCloseEvent = CreateEvent( NULL, FALSE, FALSE, SIMPLE_PLAYER_CLOSE_EVENT ); - if ( NULL == m_hCloseEvent ) + m_hCloseEvent = CreateEvent( nullptr, FALSE, FALSE, SIMPLE_PLAYER_CLOSE_EVENT ); + if ( nullptr == m_hCloseEvent ) { *phr = E_OUTOFMEMORY; } m_hrOpen = S_OK; - m_hCompletionEvent = NULL; + m_hCompletionEvent = nullptr; InitializeCriticalSection( &m_CriSec ); - m_whdrHead = NULL; + m_whdrHead = nullptr; } @@ -70,19 +70,19 @@ CSimplePlayer::~CSimplePlayer() RemoveWaveHeaders(); DeleteCriticalSection( &m_CriSec ); - if( m_pHeader != NULL ) + if( m_pHeader != nullptr ) { m_pHeader->Release(); - m_pHeader = NULL; + m_pHeader = nullptr; } - if( m_pReader != NULL ) + if( m_pReader != nullptr ) { m_pReader->Release(); - m_pReader = NULL; + m_pReader = nullptr; } - if( m_hwo != NULL ) + if( m_hwo != nullptr ) { waveOutClose( m_hwo ); } @@ -164,7 +164,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnSample( LPWAVEHDR pwh = (LPWAVEHDR) new BYTE[ sizeof( WAVEHDR ) + cbData ]; - if( NULL == pwh ) + if( nullptr == pwh ) { DEBUG_LOG(( "OnSample OUT OF MEMORY! ")); @@ -233,7 +233,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple // LPWSTR pszCheck = _wfullpath( wszFullUrl, pszUrl, MAX_PATH ); - if( NULL == pszCheck ) + if( nullptr == pszCheck ) { DEBUG_LOG(( "internal error %lu" , GetLastError() )); return E_UNEXPECTED ; @@ -249,7 +249,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple m_pszUrl = new WCHAR[ wcslen( pszUrl ) + 1 ]; - if( NULL == m_pszUrl ) + if( nullptr == m_pszUrl ) { DEBUG_LOG(( "insufficient Memory" )) ; return( E_OUTOFMEMORY ); @@ -266,11 +266,11 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple #ifdef SUPPORT_DRM - hr = WMCreateReader( NULL, WMT_RIGHT_PLAYBACK, &m_pReader ); + hr = WMCreateReader( nullptr, WMT_RIGHT_PLAYBACK, &m_pReader ); #else - hr = WMCreateReader( NULL, 0, &m_pReader ); + hr = WMCreateReader( nullptr, 0, &m_pReader ); #endif @@ -283,7 +283,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple // // Open the file // - hr = m_pReader->Open( m_pszUrl, this, NULL ); + hr = m_pReader->Open( m_pszUrl, this, nullptr ); if ( SUCCEEDED( hr ) ) { WaitForSingleObject( m_hOpenEvent, INFINITE ); @@ -321,8 +321,8 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple return( hr ); } - WCHAR *pwszName = NULL; - BYTE *pValue = NULL; + WCHAR *pwszName = nullptr; + BYTE *pValue = nullptr; for ( i = 0; i < wAttrCnt ; i++ ) { @@ -331,7 +331,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple WMT_ATTR_DATATYPE type; WORD cbLength = 0; - hr = m_pHeader->GetAttributeByIndex( i, &wStream, NULL, &cchNamelen, &type, NULL, &cbLength ); + hr = m_pHeader->GetAttributeByIndex( i, &wStream, nullptr, &cchNamelen, &type, nullptr, &cbLength ); if ( FAILED( hr ) ) { DEBUG_LOG(( "GetAttributeByIndex Failed (hr=0x%08x)" , hr )); @@ -341,7 +341,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple pwszName = new WCHAR[ cchNamelen ]; pValue = new BYTE[ cbLength ]; - if( NULL == pwszName || NULL == pValue ) + if( nullptr == pwszName || nullptr == pValue ) { hr = E_OUTOFMEMORY; break; @@ -383,17 +383,17 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple } delete pwszName; - pwszName = NULL; + pwszName = nullptr; delete pValue; - pValue = NULL; + pValue = nullptr; } delete pwszName; - pwszName = NULL; + pwszName = nullptr; delete pValue; - pValue = NULL; + pValue = nullptr; if ( FAILED( hr ) ) { @@ -428,7 +428,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple DWORD cbBuffer = 0; - hr = pProps->GetMediaType( NULL, &cbBuffer ); + hr = pProps->GetMediaType( nullptr, &cbBuffer ); if ( FAILED( hr ) ) { pProps->Release( ); @@ -462,7 +462,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple memcpy( &m_wfx, pwfx, sizeof( WAVEFORMATEX ) + pwfx->cbSize ); delete[] (BYTE *)pMediaType ; - pMediaType = NULL ; + pMediaType = nullptr ; MMRESULT mmr; @@ -485,7 +485,7 @@ HRESULT CSimplePlayer::Play( LPCWSTR pszUrl, DWORD dwSecDuration, HANDLE hComple // Start reading the data (and rendering the audio) // QWORD cnsDuration = ( QWORD ) dwSecDuration * 10000000; - hr = m_pReader->Start( 0, cnsDuration, 1.0, NULL ); + hr = m_pReader->Start( 0, cnsDuration, 1.0, nullptr ); if( FAILED( hr ) ) { @@ -581,7 +581,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnStatus( case WMT_NO_RIGHTS: { - LPWSTR pwszEscapedURL = NULL; + LPWSTR pwszEscapedURL = nullptr; hr = MakeEscapedURL( m_pszUrl, &pwszEscapedURL ); @@ -599,7 +599,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnStatus( } delete [] pwszEscapedURL; - pwszEscapedURL = NULL ; + pwszEscapedURL = nullptr ; } } break; @@ -624,7 +624,7 @@ HRESULT CSimplePlayer::Close() { HRESULT hr = S_OK; - if( NULL != m_pReader ) + if( nullptr != m_pReader ) { hr = m_pReader->Close(); @@ -676,7 +676,7 @@ void CALLBACK CSimplePlayer::WaveProc( HRESULT CSimplePlayer::AddWaveHeader( LPWAVEHDR pwh ) { WAVEHDR_LIST *tmp = new WAVEHDR_LIST; - if( NULL == tmp ) + if( nullptr == tmp ) { return( E_OUTOFMEMORY ); } @@ -695,7 +695,7 @@ void CSimplePlayer::RemoveWaveHeaders( ) WAVEHDR_LIST *tmp; EnterCriticalSection( &m_CriSec ); - while( NULL != m_whdrHead ) + while( nullptr != m_whdrHead ) { tmp = m_whdrHead->next; DEBUG_ASSERTCRASH( m_whdrHead->pwh->dwFlags & WHDR_DONE, ("RemoveWaveHeaders!") ); diff --git a/Core/GameEngine/Source/Common/Audio/urllaunch.cpp b/Core/GameEngine/Source/Common/Audio/urllaunch.cpp index 6ac481a89c0..c66d21dfa47 100644 --- a/Core/GameEngine/Source/Common/Audio/urllaunch.cpp +++ b/Core/GameEngine/Source/Common/Audio/urllaunch.cpp @@ -25,7 +25,7 @@ /////////////////////////////////////////////////////////////////////////////// HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) { - if( ( NULL == pszInURL ) || ( NULL == ppszOutURL ) ) + if( ( nullptr == pszInURL ) || ( nullptr == ppszOutURL ) ) { return( E_INVALIDARG ); } @@ -45,7 +45,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) { LPWSTR pchToEscape = wcspbrk( pszTemp, L" #$%&\\+,;=@[]^{}" ); - if( NULL == pchToEscape ) + if( nullptr == pchToEscape ) { break; } @@ -67,7 +67,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) *ppszOutURL = new WCHAR[ cchNeeded ]; - if( NULL == *ppszOutURL ) + if( nullptr == *ppszOutURL ) { return( E_OUTOFMEMORY ); } @@ -89,7 +89,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) { LPWSTR pchToEscape = wcspbrk( pszTemp, L" #$%&\\+,;=@[]^{}" ); - if( NULL == pchToEscape ) + if( nullptr == pchToEscape ) { // // Copy the rest of the input string and get out @@ -127,8 +127,8 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma { LONG lResult; - HKEY hKey = NULL; - HKEY hFileKey = NULL; + HKEY hKey = nullptr; + HKEY hFileKey = nullptr; BOOL fFoundExtensionCommand = FALSE; @@ -148,7 +148,7 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma DWORD dwLength = sizeof( szFileType ); - lResult = RegQueryValueEx( hKey, NULL, 0, NULL, (BYTE *)szFileType, &dwLength ); + lResult = RegQueryValueEx( hKey, nullptr, 0, nullptr, (BYTE *)szFileType, &dwLength ); if( ERROR_SUCCESS != lResult ) { @@ -171,7 +171,7 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma dwLength = cbShellOpenCommand; - lResult = RegQueryValueEx( hFileKey, NULL, 0, NULL, (BYTE *)ptszShellOpenCommand, &dwLength ); + lResult = RegQueryValueEx( hFileKey, nullptr, 0, nullptr, (BYTE *)ptszShellOpenCommand, &dwLength ); if( 0 == lResult ) { @@ -186,7 +186,7 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma // if( !fFoundExtensionCommand ) { - if( NULL != hKey ) + if( nullptr != hKey ) { RegCloseKey( hKey ); } @@ -205,17 +205,17 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma DWORD dwLength = cbShellOpenCommand; - lResult = RegQueryValueEx( hKey, NULL, 0, NULL, (BYTE *)ptszShellOpenCommand, &dwLength ); + lResult = RegQueryValueEx( hKey, nullptr, 0, nullptr, (BYTE *)ptszShellOpenCommand, &dwLength ); } while( FALSE ); } - if( NULL != hKey ) + if( nullptr != hKey ) { RegCloseKey( hKey ); } - if( NULL != hFileKey ) + if( nullptr != hFileKey ) { RegCloseKey( hFileKey ); } @@ -248,12 +248,12 @@ HRESULT LaunchURL( LPCWSTR pszURL ) LPTSTR pszParam = _tcsstr( szShellOpenCommand, _T( "\"%1\"" ) ); - if( NULL == pszParam ) + if( nullptr == pszParam ) { pszParam = _tcsstr( szShellOpenCommand, _T( "\"%*\"" ) ); } - if( NULL != pszParam ) + if( nullptr != pszParam ) { *pszParam = _T( '\0' ) ; @@ -269,7 +269,7 @@ HRESULT LaunchURL( LPCWSTR pszURL ) // TCHAR szExe[ MAX_PATH * 2 ]; LPTSTR pchFirst = szShellOpenCommand; - LPTSTR pchNext = NULL; + LPTSTR pchNext = nullptr; while( _T( ' ' ) == *pchFirst ) { @@ -287,7 +287,7 @@ HRESULT LaunchURL( LPCWSTR pszURL ) pchNext = _tcschr( pchFirst + 1, _T( ' ' ) ); } - if( NULL == pchNext ) + if( nullptr == pchNext ) { pchNext = szShellOpenCommand + _tcslen( szShellOpenCommand ); } @@ -312,8 +312,8 @@ HRESULT LaunchURL( LPCWSTR pszURL ) StartUp.cb = sizeof(STARTUPINFO); - if( !CreateProcess( szExe, szLaunchCommand, NULL, NULL, - FALSE, 0, NULL, NULL, &StartUp, &ProcInfo) ) + if( !CreateProcess( szExe, szLaunchCommand, nullptr, nullptr, + FALSE, 0, nullptr, nullptr, &StartUp, &ProcInfo) ) { hr = HRESULT_FROM_WIN32( GetLastError() ); } @@ -323,12 +323,12 @@ HRESULT LaunchURL( LPCWSTR pszURL ) // CreateProcess succeeded and we do not need the handles to the thread // or the process, so close them now. // - if( NULL != ProcInfo.hThread ) + if( nullptr != ProcInfo.hThread ) { CloseHandle( ProcInfo.hThread ); } - if( NULL != ProcInfo.hProcess ) + if( nullptr != ProcInfo.hProcess ) { CloseHandle( ProcInfo.hProcess ); } diff --git a/Core/GameEngine/Source/Common/CRCDebug.cpp b/Core/GameEngine/Source/Common/CRCDebug.cpp index 6b46e248bbc..37ee13a87e6 100644 --- a/Core/GameEngine/Source/Common/CRCDebug.cpp +++ b/Core/GameEngine/Source/Common/CRCDebug.cpp @@ -120,7 +120,7 @@ void CRCDebugStartNewGame() if (g_saveDebugCRCPerFrame) { // Create folder for frame data, if it doesn't exist yet. - CreateDirectory(g_saveDebugCRCPerFrameDir.str(), NULL); + CreateDirectory(g_saveDebugCRCPerFrameDir.str(), nullptr); // Delete existing files FilenameList files; @@ -188,7 +188,7 @@ static AsciiString getFname(AsciiString path) static void addCRCDebugLineInternal(bool count, const char *fmt, va_list args) { - if (TheGameLogic == NULL || !(IS_FRAME_OK_TO_LOG)) + if (TheGameLogic == nullptr || !(IS_FRAME_OK_TO_LOG)) return; if (lastCRCDebugFrame != TheGameLogic->getFrame()) diff --git a/Core/GameEngine/Source/Common/FramePacer.cpp b/Core/GameEngine/Source/Common/FramePacer.cpp index d538af0677a..0ad42c944a3 100644 --- a/Core/GameEngine/Source/Common/FramePacer.cpp +++ b/Core/GameEngine/Source/Common/FramePacer.cpp @@ -28,7 +28,7 @@ #include "GameNetwork/NetworkInterface.h" -FramePacer* TheFramePacer = NULL; +FramePacer* TheFramePacer = nullptr; FramePacer::FramePacer() { @@ -83,12 +83,12 @@ Bool FramePacer::isActualFramesPerSecondLimitEnabled() const { Bool allowFpsLimit = true; - if (TheTacticalView != NULL) + if (TheTacticalView != nullptr) { allowFpsLimit &= TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast(); } - if (TheGameLogic != NULL) + if (TheGameLogic != nullptr) { #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode); @@ -177,7 +177,7 @@ Int FramePacer::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) const return 0; } - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { return TheNetwork->getFrameRate(); } diff --git a/Core/GameEngine/Source/Common/GameUtility.cpp b/Core/GameEngine/Source/Common/GameUtility.cpp index 386fefdb3e0..cffb87f4842 100644 --- a/Core/GameEngine/Source/Common/GameUtility.cpp +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -67,11 +67,11 @@ bool localPlayerHasRadar() Player* getObservedOrLocalPlayer() { - DEBUG_ASSERTCRASH(TheControlBar != NULL, ("TheControlBar is NULL")); + DEBUG_ASSERTCRASH(TheControlBar != nullptr, ("TheControlBar is null")); Player* player = TheControlBar->getObservedPlayer(); - if (player == NULL) + if (player == nullptr) { - DEBUG_ASSERTCRASH(ThePlayerList != NULL, ("ThePlayerList is NULL")); + DEBUG_ASSERTCRASH(ThePlayerList != nullptr, ("ThePlayerList is null")); player = ThePlayerList->getLocalPlayer(); } return player; @@ -79,13 +79,13 @@ Player* getObservedOrLocalPlayer() Player* getObservedOrLocalPlayer_Safe() { - Player* player = NULL; + Player* player = nullptr; - if (TheControlBar != NULL) + if (TheControlBar != nullptr) player = TheControlBar->getObservedPlayer(); - if (player == NULL) - if (ThePlayerList != NULL) + if (player == nullptr) + if (ThePlayerList != nullptr) player = ThePlayerList->getLocalPlayer(); return player; @@ -101,11 +101,11 @@ PlayerIndex getObservedOrLocalPlayerIndex_Safe() void changeLocalPlayer(Player* player) { - DEBUG_ASSERTCRASH(player != NULL, ("Player is NULL")); + DEBUG_ASSERTCRASH(player != nullptr, ("Player is null")); ThePlayerList->setLocalPlayer(player); - TheControlBar->setObserverLookAtPlayer(NULL); - TheControlBar->setObservedPlayer(NULL); + TheControlBar->setObserverLookAtPlayer(nullptr); + TheControlBar->setObservedPlayer(nullptr); TheControlBar->setControlBarSchemeByPlayer(player); TheControlBar->initSpecialPowershortcutBar(player); @@ -117,14 +117,14 @@ void changeObservedPlayer(Player* player) TheControlBar->setObserverLookAtPlayer(player); const Bool canBeginObservePlayer = TheGlobalData->m_enablePlayerObserver && TheGhostObjectManager->trackAllPlayers(); - const Bool canEndObservePlayer = TheControlBar->getObservedPlayer() != NULL && TheControlBar->getObserverLookAtPlayer() == NULL; + const Bool canEndObservePlayer = TheControlBar->getObservedPlayer() != nullptr && TheControlBar->getObserverLookAtPlayer() == nullptr; if (canBeginObservePlayer || canEndObservePlayer) { TheControlBar->setObservedPlayer(player); Player *becomePlayer = player; - if (becomePlayer == NULL) + if (becomePlayer == nullptr) becomePlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); detail::changePlayerCommon(becomePlayer); } diff --git a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp index e729c0a40c0..2420542bee7 100644 --- a/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp +++ b/Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp @@ -129,26 +129,26 @@ static void parsePitchShift( INI* ini, void *instance, void *store, const void* //------------------------------------------------------------------------------------------------- const FieldParse AudioEventInfo::m_audioEventInfo[] = { - { "Filename", INI::parseAsciiString, NULL, offsetof( AudioEventInfo, m_filename) }, - { "Volume", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_volume ) }, - { "VolumeShift", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_volumeShift ) }, - { "MinVolume", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_minVolume ) }, - { "PitchShift", parsePitchShift, NULL, 0 }, - { "Delay", parseDelay, NULL, 0 }, - { "Limit", INI::parseInt, NULL, offsetof( AudioEventInfo, m_limit ) }, - { "LoopCount", INI::parseInt, NULL, offsetof( AudioEventInfo, m_loopCount ) }, + { "Filename", INI::parseAsciiString, nullptr, offsetof( AudioEventInfo, m_filename) }, + { "Volume", INI::parsePercentToReal, nullptr, offsetof( AudioEventInfo, m_volume ) }, + { "VolumeShift", INI::parsePercentToReal, nullptr, offsetof( AudioEventInfo, m_volumeShift ) }, + { "MinVolume", INI::parsePercentToReal, nullptr, offsetof( AudioEventInfo, m_minVolume ) }, + { "PitchShift", parsePitchShift, nullptr, 0 }, + { "Delay", parseDelay, nullptr, 0 }, + { "Limit", INI::parseInt, nullptr, offsetof( AudioEventInfo, m_limit ) }, + { "LoopCount", INI::parseInt, nullptr, offsetof( AudioEventInfo, m_loopCount ) }, { "Priority", INI::parseIndexList, theAudioPriorityNames, offsetof( AudioEventInfo, m_priority ) }, { "Type", INI::parseBitString32, theSoundTypeNames, offsetof( AudioEventInfo, m_type ) }, { "Control", INI::parseBitString32, theAudioControlNames, offsetof( AudioEventInfo, m_control ) }, - { "Sounds", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_sounds ) }, - { "SoundsNight", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsNight ) }, - { "SoundsEvening", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsEvening ) }, - { "SoundsMorning", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsMorning ) }, - { "Attack", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_attackSounds ) }, - { "Decay", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_decaySounds ) }, - { "MinRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_minDistance) }, - { "MaxRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_maxDistance) }, - { "LowPassCutoff", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_lowPassFreq) }, + { "Sounds", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_sounds ) }, + { "SoundsNight", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_soundsNight ) }, + { "SoundsEvening", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_soundsEvening ) }, + { "SoundsMorning", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_soundsMorning ) }, + { "Attack", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_attackSounds ) }, + { "Decay", INI::parseSoundsList, nullptr, offsetof( AudioEventInfo, m_decaySounds ) }, + { "MinRange", INI::parseReal, nullptr, offsetof( AudioEventInfo, m_minDistance) }, + { "MaxRange", INI::parseReal, nullptr, offsetof( AudioEventInfo, m_maxDistance) }, + { "LowPassCutoff", INI::parsePercentToReal, nullptr, offsetof( AudioEventInfo, m_lowPassFreq) }, }; //------------------------------------------------------------------------------------------------- @@ -186,7 +186,7 @@ const char *const theAudioPriorityNames[] = "NORMAL", "HIGH", "CRITICAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(theAudioPriorityNames) == AP_COUNT + 1, "Incorrect array size"); @@ -201,7 +201,7 @@ const char *const theSoundTypeNames[] = "ALLIES", "ENEMIES", "EVERYONE", - NULL + nullptr }; const char *const theAudioControlNames[] = @@ -211,6 +211,6 @@ const char *const theAudioControlNames[] = "ALL", "POSTDELAY", "INTERRUPT", - NULL + nullptr }; diff --git a/Core/GameEngine/Source/Common/INI/INIMiscAudio.cpp b/Core/GameEngine/Source/Common/INI/INIMiscAudio.cpp index 442f9235043..92a19c0f411 100644 --- a/Core/GameEngine/Source/Common/INI/INIMiscAudio.cpp +++ b/Core/GameEngine/Source/Common/INI/INIMiscAudio.cpp @@ -30,44 +30,44 @@ const FieldParse MiscAudio::m_fieldParseTable[] = { - { "RadarNotifyUnitUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarUnitUnderAttackSound ) }, - { "RadarNotifyHarvesterUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarHarvesterUnderAttackSound ) }, - { "RadarNotifyStructureUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarStructureUnderAttackSound ) }, - { "RadarNotifyUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarUnderAttackSound ) }, - { "RadarNotifyInfiltrationSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarInfiltrationSound ) }, - { "RadarNotifyOnlineSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarOnlineSound ) }, - { "RadarNotifyOfflineSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarOfflineSound ) }, - { "DefectorTimerTickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_defectorTimerTickSound ) }, - { "DefectorTimerDingSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_defectorTimerDingSound ) }, - { "LockonTickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_lockonTickSound ) }, - { "AllCheerSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_allCheerSound ) }, - { "BattleCrySound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_battleCrySound ) }, - { "GUIClickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_guiClickSound ) }, - { "NoCanDoSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_noCanDoSound ) }, - { "StealthDiscoveredSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_stealthDiscoveredSound ) }, - { "StealthNeutralizedSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_stealthNeutralizedSound ) }, - { "MoneyDepositSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_moneyDepositSound ) }, - { "MoneyWithdrawSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_moneyWithdrawSound ) }, - { "BuildingDisabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_buildingDisabled ) }, - { "BuildingReenabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_buildingReenabled ) }, - { "VehicleDisabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_vehicleDisabled ) }, - { "VehicleReenabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_vehicleReenabled ) }, - { "SplatterVehiclePilotsBrain", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_splatterVehiclePilotsBrain ) }, - { "TerroristInCarMoveVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarMoveVoice ) }, - { "TerroristInCarAttackVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarAttackVoice ) }, - { "TerroristInCarSelectVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarSelectVoice ) }, - { "CrateHeal", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateHeal ) }, - { "CrateShroud", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateShroud ) }, - { "CrateSalvage", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateSalvage ) }, - { "CrateFreeUnit", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateFreeUnit ) }, - { "CrateMoney", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateMoney ) }, - { "UnitPromoted", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_unitPromoted ) }, - { "RepairSparks", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_repairSparks ) }, - { "SabotageShutDownBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageShutDownBuilding ) }, - { "SabotageResetTimeBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageResetTimerBuilding ) }, - { "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) }, + { "RadarNotifyUnitUnderAttackSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarUnitUnderAttackSound ) }, + { "RadarNotifyHarvesterUnderAttackSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarHarvesterUnderAttackSound ) }, + { "RadarNotifyStructureUnderAttackSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarStructureUnderAttackSound ) }, + { "RadarNotifyUnderAttackSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarUnderAttackSound ) }, + { "RadarNotifyInfiltrationSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarInfiltrationSound ) }, + { "RadarNotifyOnlineSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarOnlineSound ) }, + { "RadarNotifyOfflineSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_radarOfflineSound ) }, + { "DefectorTimerTickSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_defectorTimerTickSound ) }, + { "DefectorTimerDingSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_defectorTimerDingSound ) }, + { "LockonTickSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_lockonTickSound ) }, + { "AllCheerSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_allCheerSound ) }, + { "BattleCrySound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_battleCrySound ) }, + { "GUIClickSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_guiClickSound ) }, + { "NoCanDoSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_noCanDoSound ) }, + { "StealthDiscoveredSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_stealthDiscoveredSound ) }, + { "StealthNeutralizedSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_stealthNeutralizedSound ) }, + { "MoneyDepositSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_moneyDepositSound ) }, + { "MoneyWithdrawSound", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_moneyWithdrawSound ) }, + { "BuildingDisabled", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_buildingDisabled ) }, + { "BuildingReenabled", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_buildingReenabled ) }, + { "VehicleDisabled", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_vehicleDisabled ) }, + { "VehicleReenabled", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_vehicleReenabled ) }, + { "SplatterVehiclePilotsBrain", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_splatterVehiclePilotsBrain ) }, + { "TerroristInCarMoveVoice", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_terroristInCarMoveVoice ) }, + { "TerroristInCarAttackVoice", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_terroristInCarAttackVoice ) }, + { "TerroristInCarSelectVoice", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_terroristInCarSelectVoice ) }, + { "CrateHeal", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_crateHeal ) }, + { "CrateShroud", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_crateShroud ) }, + { "CrateSalvage", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_crateSalvage ) }, + { "CrateFreeUnit", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_crateFreeUnit ) }, + { "CrateMoney", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_crateMoney ) }, + { "UnitPromoted", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_unitPromoted ) }, + { "RepairSparks", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_repairSparks ) }, + { "SabotageShutDownBuilding", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_sabotageShutDownBuilding ) }, + { "SabotageResetTimeBuilding", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_sabotageResetTimerBuilding ) }, + { "AircraftWheelScreech", INI::parseAudioEventRTS, nullptr, offsetof( MiscAudio, m_aircraftWheelScreech ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; diff --git a/Core/GameEngine/Source/Common/RandomValue.cpp b/Core/GameEngine/Source/Common/RandomValue.cpp index f1c00982a86..c14816de3d5 100644 --- a/Core/GameEngine/Source/Common/RandomValue.cpp +++ b/Core/GameEngine/Source/Common/RandomValue.cpp @@ -157,7 +157,7 @@ void InitRandom( void ) seedRandom(0, theGameLogicSeed); theGameLogicBaseSeed = 0; #else - time_t seconds = time( NULL ); + time_t seconds = time( nullptr ); seedRandom(seconds, theGameAudioSeed); seedRandom(seconds, theGameClientSeed); @@ -352,7 +352,7 @@ DEBUG_LOG(( "%d: GetGameAudioRandomValueReal = %f, %s line %d", const char *const GameClientRandomVariable::DistributionTypeNames[] = { - "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL + "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", nullptr }; static_assert(ARRAY_SIZE(GameClientRandomVariable::DistributionTypeNames) == GameClientRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size"); @@ -398,7 +398,7 @@ Real GameClientRandomVariable::getValue( void ) const const char *const GameLogicRandomVariable::DistributionTypeNames[] = { - "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL + "CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", nullptr }; static_assert(ARRAY_SIZE(GameLogicRandomVariable::DistributionTypeNames) == GameLogicRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size"); diff --git a/Core/GameEngine/Source/Common/ReplaySimulation.cpp b/Core/GameEngine/Source/Common/ReplaySimulation.cpp index 354925c8fcd..7d18b5cb58f 100644 --- a/Core/GameEngine/Source/Common/ReplaySimulation.cpp +++ b/Core/GameEngine/Source/Common/ReplaySimulation.cpp @@ -134,7 +134,7 @@ int ReplaySimulation::simulateReplaysInWorkerProcesses(const std::vector processes; int filenamePositionStarted = 0; diff --git a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp index 88cd6576469..1f982b65a1d 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFile.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFile.cpp @@ -83,14 +83,14 @@ static Bool SearchStringMatches(AsciiString str, AsciiString searchString) ArchiveFile::~ArchiveFile() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } } ArchiveFile::ArchiveFile() - : m_file(NULL) + : m_file(nullptr) { } @@ -185,9 +185,9 @@ void ArchiveFile::getFileListInDirectory(const DetailedArchivedDirectoryInfo *di void ArchiveFile::attachFile(File *file) { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } m_file = file; } @@ -210,7 +210,7 @@ const ArchivedFileInfo * ArchiveFile::getArchivedFileInfo(const AsciiString& fil } else { - return NULL; + return nullptr; } tokenizer.nextToken(&token, "\\/"); @@ -223,7 +223,7 @@ const ArchivedFileInfo * ArchiveFile::getArchivedFileInfo(const AsciiString& fil } else { - return NULL; + return nullptr; } } diff --git a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp index b422e5cd1d0..77e9fde8df5 100644 --- a/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp @@ -79,7 +79,7 @@ // Public Data //---------------------------------------------------------------------------- -ArchiveFileSystem *TheArchiveFileSystem = NULL; +ArchiveFileSystem *TheArchiveFileSystem = nullptr; //---------------------------------------------------------------------------- @@ -216,7 +216,7 @@ void ArchiveFileSystem::loadMods() { ArchiveFile *archiveFile = openArchiveFile(TheGlobalData->m_modBIG.str()); - if (archiveFile != NULL) { + if (archiveFile != nullptr) { DEBUG_LOG(("ArchiveFileSystem::loadMods - loading %s into the directory tree.", TheGlobalData->m_modBIG.str())); loadIntoDirectoryTree(archiveFile, TRUE); m_archiveFileMap[TheGlobalData->m_modBIG] = archiveFile; @@ -278,7 +278,7 @@ ArchiveFileSystem::ArchivedDirectoryInfoResult ArchiveFileSystem::getArchivedDir else { // the directory doesn't exist - result.dirInfo = NULL; + result.dirInfo = nullptr; result.lastToken = AsciiString::TheEmptyString; return result; } @@ -293,15 +293,15 @@ File * ArchiveFileSystem::openFile(const Char *filename, Int access, FileInstanc { ArchiveFile* archive = getArchiveFile(filename, instance); - if (archive == NULL) - return NULL; + if (archive == nullptr) + return nullptr; return archive->openFile(filename, access); } Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance) const { - if (fileInfo == NULL) { + if (fileInfo == nullptr) { return FALSE; } @@ -311,7 +311,7 @@ Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileI ArchiveFile* archive = getArchiveFile(filename, instance); - if (archive == NULL) + if (archive == nullptr) return FALSE; return archive->getFileInfo(filename, fileInfo); @@ -322,12 +322,12 @@ ArchiveFile* ArchiveFileSystem::getArchiveFile(const AsciiString& filename, File ArchivedDirectoryInfoResult result = const_cast(this)->getArchivedDirectoryInfo(filename.str()); if (!result.valid()) - return NULL; + return nullptr; stl::const_range range = stl::get_range(result.dirInfo->m_files, result.lastToken, instance); if (!range.valid()) - return NULL; + return nullptr; return range.get()->second; } diff --git a/Core/GameEngine/Source/Common/System/AsciiString.cpp b/Core/GameEngine/Source/Common/System/AsciiString.cpp index 31567ec5335..7dc6dc207f5 100644 --- a/Core/GameEngine/Source/Common/System/AsciiString.cpp +++ b/Core/GameEngine/Source/Common/System/AsciiString.cpp @@ -54,7 +54,7 @@ //----------------------------------------------------------------------------- inline char* skipSeps(char* p, const char* seps) { - while (*p && strchr(seps, *p) != NULL) + while (*p && strchr(seps, *p) != nullptr) ++p; return p; } @@ -62,7 +62,7 @@ inline char* skipSeps(char* p, const char* seps) //----------------------------------------------------------------------------- inline char* skipNonSeps(char* p, const char* seps) { - while (*p && strchr(seps, *p) == NULL) + while (*p && strchr(seps, *p) == nullptr) ++p; return p; } @@ -144,7 +144,7 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData return; } - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("AsciiString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(AsciiStringData) + numCharsNeeded*sizeof(char); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); @@ -190,29 +190,29 @@ void AsciiString::releaseBuffer() { TheDynamicMemoryAllocator->freeBytes(m_data); } - m_data = 0; + m_data = nullptr; } validate(); } // ----------------------------------------------------- -AsciiString::AsciiString(const char* s) : m_data(NULL) +AsciiString::AsciiString(const char* s) : m_data(nullptr) { //DEBUG_ASSERTCRASH(isMemoryManagerOfficiallyInited(), ("Initializing AsciiStrings prior to main (ie, as static vars) can cause memory leak reporting problems. Are you sure you want to do this?")); int len = s ? (int)strlen(s) : 0; if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } validate(); } // ----------------------------------------------------- -AsciiString::AsciiString(const char* s, int len) : m_data(NULL) +AsciiString::AsciiString(const char* s, int len) : m_data(nullptr) { if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } validate(); } @@ -248,7 +248,7 @@ void AsciiString::set(const char* s, int len) { if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } else { @@ -263,7 +263,7 @@ char* AsciiString::getBufferForRead(Int len) { validate(); DEBUG_ASSERTCRASH(len>0, ("No need to allocate 0 len strings.")); - ensureUniqueBufferOfSize(len + 1, false, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, false, nullptr, nullptr); validate(); return peek(); } @@ -290,7 +290,7 @@ void AsciiString::concat(const char* s) if (m_data) { - ensureUniqueBufferOfSize(getLength() + addlen + 1, true, NULL, s); + ensureUniqueBufferOfSize(getLength() + addlen + 1, true, nullptr, s); } else { @@ -401,7 +401,7 @@ void AsciiString::truncateBy(const Int charCount) const size_t len = strlen(peek()); if (len > 0) { - ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, nullptr, nullptr); size_t count = charCount; if (charCount > len) { @@ -422,7 +422,7 @@ void AsciiString::truncateTo(const Int maxLength) const size_t len = strlen(peek()); if (len > maxLength) { - ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, nullptr, nullptr); peek()[maxLength] = 0; } } @@ -510,7 +510,7 @@ Bool AsciiString::nextToken(AsciiString* tok, const char* seps) if (this->isEmpty() || tok == this) return false; - if (seps == NULL) + if (seps == nullptr) seps = " \n\r\t"; char* start = skipSeps(peek(), seps); diff --git a/Core/GameEngine/Source/Common/System/Debug.cpp b/Core/GameEngine/Source/Common/System/Debug.cpp index 33ddbff4606..a78085fcdaa 100644 --- a/Core/GameEngine/Source/Common/System/Debug.cpp +++ b/Core/GameEngine/Source/Common/System/Debug.cpp @@ -107,7 +107,7 @@ extern const char *gAppPrefix; /// So WB can have a different log file name. // TheSuperHackers @info Must not use static RAII types when set in DebugInit, // because DebugInit can be called during static module initialization before the main function is called. #ifdef DEBUG_LOGGING -static FILE *theLogFile = NULL; +static FILE *theLogFile = nullptr; static char theLogFileName[ _MAX_PATH ]; static char theLogFileNamePrev[ _MAX_PATH ]; #endif @@ -119,7 +119,7 @@ static DWORD theMainThreadID = 0; // PUBLIC DATA // ---------------------------------------------------------------------------- -char* TheCurrentIgnoreCrashPtr = NULL; +char* TheCurrentIgnoreCrashPtr = nullptr; #ifdef DEBUG_LOGGING UnsignedInt DebugLevelMask = 0; const char *TheDebugLevels[DEBUG_LEVEL_MAX] = { @@ -167,7 +167,7 @@ inline Bool ignoringAsserts() // ---------------------------------------------------------------------------- inline HWND getThreadHWND() { - return (theMainThreadID == GetCurrentThreadId())?ApplicationHWnd:NULL; + return (theMainThreadID == GetCurrentThreadId())?ApplicationHWnd:nullptr; } // ---------------------------------------------------------------------------- @@ -359,7 +359,7 @@ static void whackFunnyCharacters(char *buf) void DebugInit(int flags) { // if (theDebugFlags != 0) -// ::MessageBox(NULL, "Debug already inited", "", MB_OK|MB_APPLMODAL); +// ::MessageBox(nullptr, "Debug already inited", "", MB_OK|MB_APPLMODAL); // just quietly allow multiple calls to this, so that static ctors can call it. if (theDebugFlags == 0) @@ -378,7 +378,7 @@ void DebugInit(int flags) return; char dirbuf[ _MAX_PATH ]; - ::GetModuleFileName( NULL, dirbuf, sizeof( dirbuf ) ); + ::GetModuleFileName( nullptr, dirbuf, sizeof( dirbuf ) ); if (char *pEnd = strrchr(dirbuf, '\\')) { *(pEnd + 1) = 0; @@ -421,7 +421,7 @@ void DebugInit(int flags) } theLogFile = fopen(theLogFileName, "w"); - if (theLogFile != NULL) + if (theLogFile != nullptr) { DebugLog("Log %s opened: %s", theLogFileName, getCurrentTimeString()); } @@ -553,7 +553,7 @@ void DebugCrash(const char *format, ...) const int result = doCrashBox(theCrashBuffer, useLogging); - if (result == IDIGNORE && TheCurrentIgnoreCrashPtr != NULL) + if (result == IDIGNORE && TheCurrentIgnoreCrashPtr != nullptr) { int yn; if (!ignoringAsserts()) @@ -592,7 +592,7 @@ void DebugShutdown() DebugLog("Log closed: %s", getCurrentTimeString()); fclose(theLogFile); } - theLogFile = NULL; + theLogFile = nullptr; #endif theDebugFlags = 0; } @@ -719,7 +719,7 @@ double SimpleProfiler::getAverageTime() #define RELEASECRASH_FILE_NAME "ReleaseCrashInfo.txt" #define RELEASECRASH_FILE_NAME_PREV "ReleaseCrashInfoPrev.txt" - static FILE *theReleaseCrashLogFile = NULL; + static FILE *theReleaseCrashLogFile = nullptr; static void releaseCrashLogOutput(const char *buffer) { @@ -761,7 +761,7 @@ void ReleaseCrash(const char *reason) char prevbuf[ _MAX_PATH ]; char curbuf[ _MAX_PATH ]; - if (TheGlobalData==NULL) { + if (TheGlobalData==nullptr) { return; // We are shutting down, and TheGlobalData has been freed. jba. [4/15/2003] } @@ -797,7 +797,7 @@ void ReleaseCrash(const char *reason) fflush(theReleaseCrashLogFile); fclose(theReleaseCrashLogFile); - theReleaseCrashLogFile = NULL; + theReleaseCrashLogFile = nullptr; } if (!DX8Wrapper_IsWindowed) { @@ -809,14 +809,14 @@ void ReleaseCrash(const char *reason) #if defined(RTS_DEBUG) /* static */ char buff[8192]; // not so static so we can be threadsafe snprintf(buff, 8192, "Sorry, a serious error occurred. (%s)", reason); - ::MessageBox(NULL, buff, "Technical Difficulties...", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); + ::MessageBox(nullptr, buff, "Technical Difficulties...", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); #else // crash error messaged changed 3/6/03 BGC -// ::MessageBox(NULL, "Sorry, a serious error occurred.", "Technical Difficulties...", MB_OK|MB_TASKMODAL|MB_ICONERROR); -// ::MessageBox(NULL, "You have encountered a serious error. Serious errors can be caused by many things including viruses, overheated hardware and hardware that does not meet the minimum specifications for the game. Please visit the forums at www.generals.ea.com for suggested courses of action or consult your manual for Technical Support contact information.", "Technical Difficulties...", MB_OK|MB_TASKMODAL|MB_ICONERROR); +// ::MessageBox(nullptr, "Sorry, a serious error occurred.", "Technical Difficulties...", MB_OK|MB_TASKMODAL|MB_ICONERROR); +// ::MessageBox(nullptr, "You have encountered a serious error. Serious errors can be caused by many things including viruses, overheated hardware and hardware that does not meet the minimum specifications for the game. Please visit the forums at www.generals.ea.com for suggested courses of action or consult your manual for Technical Support contact information.", "Technical Difficulties...", MB_OK|MB_TASKMODAL|MB_ICONERROR); // crash error message changed again 8/22/03 M Lorenzen... made this message box modal to the system so it will appear on top of any task-modal windows, splash-screen, etc. - ::MessageBox(NULL, "You have encountered a serious error. Serious errors can be caused by many things including viruses, overheated hardware and hardware that does not meet the minimum specifications for the game. Please visit the forums at www.generals.ea.com for suggested courses of action or consult your manual for Technical Support contact information.", + ::MessageBox(nullptr, "You have encountered a serious error. Serious errors can be caused by many things including viruses, overheated hardware and hardware that does not meet the minimum specifications for the game. Please visit the forums at www.generals.ea.com for suggested courses of action or consult your manual for Technical Support contact information.", "Technical Difficulties...", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); @@ -850,7 +850,7 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m) if (TheSystemIsUnicode) { - ::MessageBoxW(NULL, mesg.str(), prompt.str(), MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); + ::MessageBoxW(nullptr, mesg.str(), prompt.str(), MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); } else { @@ -861,7 +861,7 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m) mesgA.translate(mesg); //Make sure main window is not TOP_MOST ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0,SWP_NOSIZE |SWP_NOMOVE); - ::MessageBoxA(NULL, mesgA.str(), promptA.str(), MB_OK|MB_TASKMODAL|MB_ICONERROR); + ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), MB_OK|MB_TASKMODAL|MB_ICONERROR); } char prevbuf[ _MAX_PATH ]; @@ -899,7 +899,7 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m) fflush(theReleaseCrashLogFile); fclose(theReleaseCrashLogFile); - theReleaseCrashLogFile = NULL; + theReleaseCrashLogFile = nullptr; } _exit(1); diff --git a/Core/GameEngine/Source/Common/System/FileSystem.cpp b/Core/GameEngine/Source/Common/System/FileSystem.cpp index 46d468d4a05..ac180b0a335 100644 --- a/Core/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/FileSystem.cpp @@ -101,7 +101,7 @@ DECLARE_PERF_TIMER(FileSystem) */ //=============================== -FileSystem *TheFileSystem = NULL; +FileSystem *TheFileSystem = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -174,9 +174,9 @@ void FileSystem::reset( void ) File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize, FileInstance instance ) { USE_PERF_TIMER(FileSystem) - File *file = NULL; + File *file = nullptr; - if ( TheLocalFileSystem != NULL ) + if ( TheLocalFileSystem != nullptr ) { if (instance != 0) { @@ -190,7 +190,7 @@ File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize file = TheLocalFileSystem->openFile( filename, access, bufferSize ); #if ENABLE_FILESYSTEM_EXISTENCE_CACHE - if (file != NULL && (file->getAccess() & File::CREATE)) + if (file != nullptr && (file->getAccess() & File::CREATE)) { FastCriticalSectionClass::LockClass lock(m_fileExistMutex); FileExistMap::iterator it = m_fileExist.find(FileExistMap::key_type::temporary(filename)); @@ -209,7 +209,7 @@ File* FileSystem::openFile( const Char *filename, Int access, size_t bufferSize } } - if ( (TheArchiveFileSystem != NULL) && (file == NULL) ) + if ( (TheArchiveFileSystem != nullptr) && (file == nullptr) ) { // TheSuperHackers @todo Pass 'access' here? file = TheArchiveFileSystem->openFile( filename, 0, instance ); @@ -298,7 +298,7 @@ Bool FileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo, Fi // TheSuperHackers @todo Add file info cache? - if (fileInfo == NULL) { + if (fileInfo == nullptr) { return FALSE; } memset(fileInfo, 0, sizeof(*fileInfo)); @@ -324,7 +324,7 @@ Bool FileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo, Fi Bool FileSystem::createDirectory(AsciiString directory) { USE_PERF_TIMER(FileSystem) - if (TheLocalFileSystem != NULL) { + if (TheLocalFileSystem != nullptr) { return TheLocalFileSystem->createDirectory(directory); } return FALSE; diff --git a/Core/GameEngine/Source/Common/System/GameMemory.cpp b/Core/GameEngine/Source/Common/System/GameMemory.cpp index 2ede5c780b9..5c70904eb95 100644 --- a/Core/GameEngine/Source/Common/System/GameMemory.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemory.cpp @@ -397,7 +397,7 @@ class MemoryPoolSingleBlock { private: - MemoryPoolBlob *m_owningBlob; ///< will be NULL if the single block was allocated via sysAllocate() + MemoryPoolBlob *m_owningBlob; ///< will be null if the single block was allocated via sysAllocate() MemoryPoolSingleBlock *m_nextBlock; ///< if m_owningBlob is nonnull, this points to next free (unallocated) block in the blob; if m_owningBlob is null, this points to the next used (allocated) raw block in the pool. #ifdef MPSB_DLINK MemoryPoolSingleBlock *m_prevBlock; ///< if m_owningBlob is nonnull, this points to prev free (unallocated) block in the blob; if m_owningBlob is null, this points to the prev used (allocated) raw block in the pool. @@ -508,8 +508,8 @@ class MemoryPoolBlob // PUBLIC DATA // ---------------------------------------------------------------------------- -MemoryPoolFactory *TheMemoryPoolFactory = NULL; -DynamicMemoryAllocator *TheDynamicMemoryAllocator = NULL; +MemoryPoolFactory *TheMemoryPoolFactory = nullptr; +DynamicMemoryAllocator *TheDynamicMemoryAllocator = nullptr; // ---------------------------------------------------------------------------- // INLINES @@ -578,7 +578,7 @@ inline MemoryPoolBlob *MemoryPoolSingleBlock::getOwningBlob() */ inline MemoryPoolSingleBlock *MemoryPoolSingleBlock::getNextFreeBlock() { - DEBUG_ASSERTCRASH(m_owningBlob != NULL, ("must be called on blob block")); + DEBUG_ASSERTCRASH(m_owningBlob != nullptr, ("must be called on blob block")); return m_nextBlock; } @@ -589,9 +589,9 @@ inline MemoryPoolSingleBlock *MemoryPoolSingleBlock::getNextFreeBlock() */ inline void MemoryPoolSingleBlock::setNextFreeBlock(MemoryPoolSingleBlock *b) { - //DEBUG_ASSERTCRASH(m_owningBlob != NULL && b->m_owningBlob != NULL, ("must be called on blob block")); + //DEBUG_ASSERTCRASH(m_owningBlob != nullptr && b->m_owningBlob != nullptr, ("must be called on blob block")); // don't check the 'b' block -- we need to call this before 'b' is fully initialized. - DEBUG_ASSERTCRASH(m_owningBlob != NULL, ("must be called on blob block")); + DEBUG_ASSERTCRASH(m_owningBlob != nullptr, ("must be called on blob block")); this->m_nextBlock = b; #ifdef MPSB_DLINK if (b) { @@ -606,7 +606,7 @@ inline void MemoryPoolSingleBlock::setNextFreeBlock(MemoryPoolSingleBlock *b) */ inline MemoryPoolSingleBlock *MemoryPoolSingleBlock::getNextRawBlock() { - DEBUG_ASSERTCRASH(m_owningBlob == NULL, ("must be called on raw block")); + DEBUG_ASSERTCRASH(m_owningBlob == nullptr, ("must be called on raw block")); return m_nextBlock; } @@ -616,7 +616,7 @@ inline MemoryPoolSingleBlock *MemoryPoolSingleBlock::getNextRawBlock() */ inline void MemoryPoolSingleBlock::setNextRawBlock(MemoryPoolSingleBlock *b) { - DEBUG_ASSERTCRASH(m_owningBlob == NULL && (!b || b->m_owningBlob == NULL), ("must be called on raw block")); + DEBUG_ASSERTCRASH(m_owningBlob == nullptr && (!b || b->m_owningBlob == nullptr), ("must be called on raw block")); m_nextBlock = b; #ifdef MPSB_DLINK if (b) @@ -686,7 +686,7 @@ inline BlockCheckpointInfo *MemoryPoolSingleBlock::debugGetCheckpointInfo() */ inline void MemoryPoolSingleBlock::debugSetCheckpointInfo(BlockCheckpointInfo *bi) { - DEBUG_ASSERTCRASH(m_checkpointInfo == NULL, ("should be null")); + DEBUG_ASSERTCRASH(m_checkpointInfo == nullptr, ("should be null")); m_checkpointInfo = bi; } #endif @@ -698,7 +698,7 @@ inline void MemoryPoolSingleBlock::debugSetCheckpointInfo(BlockCheckpointInfo *b */ inline void MemoryPoolSingleBlock::debugResetCheckpoint() { - m_checkpointInfo = NULL; + m_checkpointInfo = nullptr; } #endif @@ -706,7 +706,7 @@ inline void MemoryPoolSingleBlock::debugResetCheckpoint() /// accessor inline MemoryPoolBlob *MemoryPoolBlob::getNextInList() { return m_nextBlob; } /// accessor -inline Bool MemoryPoolBlob::hasAnyFreeBlocks() { return m_firstFreeBlock != NULL; } +inline Bool MemoryPoolBlob::hasAnyFreeBlocks() { return m_firstFreeBlock != nullptr; } /// accessor inline MemoryPool *MemoryPoolBlob::getOwningPool() { return m_owningPool; } /// accessor @@ -795,7 +795,7 @@ Bool BlockCheckpointInfo::shouldBeInReport(Int flags, Int startCheckpoint, Int e ::sysFree((void *)p); p = n; } - *pHead = NULL; + *pHead = nullptr; } #endif @@ -815,15 +815,15 @@ Bool BlockCheckpointInfo::shouldBeInReport(Int flags, Int startCheckpoint, Int e { DEBUG_ASSERTCRASH(debugLiteralTagString != FREE_SINGLEBLOCK_TAG_STRING, ("bad tag string")); - BlockCheckpointInfo *freed = NULL; + BlockCheckpointInfo *freed = nullptr; try { freed = (BlockCheckpointInfo *)::sysAllocateDoNotZero(sizeof(BlockCheckpointInfo)); } catch (...) { - freed = NULL; + freed = nullptr; } if (freed) { - DEBUG_ASSERTCRASH(debugLiteralTagString != NULL, ("null tagstrings are not allowed")); + DEBUG_ASSERTCRASH(debugLiteralTagString != nullptr, ("null tagstrings are not allowed")); freed->m_debugLiteralTagString = debugLiteralTagString; freed->m_allocCheckpoint = allocCheckpoint; freed->m_freeCheckpoint = -1; @@ -858,7 +858,7 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo m_debugFlags = 0; if (!theMainInitFlag) debugIgnoreLeaksForThisBlock(); - DEBUG_ASSERTCRASH(debugLiteralTagString != NULL, ("null tagstrings are not allowed")); + DEBUG_ASSERTCRASH(debugLiteralTagString != nullptr, ("null tagstrings are not allowed")); m_debugLiteralTagString = debugLiteralTagString; m_logicalSize = logicalSize; m_wastedSize = 0; @@ -871,21 +871,21 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo } else { - m_stacktrace[0] = NULL; + m_stacktrace[0] = nullptr; } #endif } #endif // MEMORYPOOL_DEBUG #ifdef MEMORYPOOL_CHECKPOINTING - m_checkpointInfo = NULL; + m_checkpointInfo = nullptr; #endif - m_nextBlock = NULL; + m_nextBlock = nullptr; #ifdef MPSB_DLINK - m_prevBlock = NULL; + m_prevBlock = nullptr; #endif - m_owningBlob = owningBlob; // could be NULL + m_owningBlob = owningBlob; // could be null #ifdef MEMORYPOOL_BOUNDINGWALL m_wallPattern = theBoundingWallPattern++; @@ -902,7 +902,7 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo { DEBUG_ASSERTCRASH(pUserData, ("null pUserData")); if (!pUserData) - return NULL; + return nullptr; char* p = ((char*)pUserData) - sizeof(MemoryPoolSingleBlock); #ifdef MEMORYPOOL_BOUNDINGWALL p -= WALLSIZE; @@ -927,7 +927,7 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo DECLARE_LITERALSTRING_ARG2) { MemoryPoolSingleBlock *block = (MemoryPoolSingleBlock *)::sysAllocateDoNotZero(calcRawBlockSize(logicalSize)); - block->initBlock(logicalSize, NULL, owningFactory PASS_LITERALSTRING_ARG2); + block->initBlock(logicalSize, nullptr, owningFactory PASS_LITERALSTRING_ARG2); block->setNextRawBlock(*pRawListHead); *pRawListHead = block; return block; @@ -940,12 +940,12 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo */ void MemoryPoolSingleBlock::removeBlockFromList(MemoryPoolSingleBlock **pHead) { - DEBUG_ASSERTCRASH(this->m_owningBlob == NULL, ("this function should only be used on raw blocks")); + DEBUG_ASSERTCRASH(this->m_owningBlob == nullptr, ("this function should only be used on raw blocks")); #ifdef MPSB_DLINK - DEBUG_ASSERTCRASH(this->m_nextBlock == NULL || this->m_nextBlock->m_owningBlob == NULL, ("this function should only be used on raw blocks")); + DEBUG_ASSERTCRASH(this->m_nextBlock == nullptr || this->m_nextBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks")); if (this->m_prevBlock) { - DEBUG_ASSERTCRASH(this->m_prevBlock->m_owningBlob == NULL, ("this function should only be used on raw blocks")); + DEBUG_ASSERTCRASH(this->m_prevBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks")); DEBUG_ASSERTCRASH(*pHead != this, ("bad linkage")); this->m_prevBlock->m_nextBlock = this->m_nextBlock; } @@ -957,7 +957,7 @@ void MemoryPoolSingleBlock::removeBlockFromList(MemoryPoolSingleBlock **pHead) if (this->m_nextBlock) { - DEBUG_ASSERTCRASH(this->m_nextBlock->m_owningBlob == NULL, ("this function should only be used on raw blocks")); + DEBUG_ASSERTCRASH(this->m_nextBlock->m_owningBlob == nullptr, ("this function should only be used on raw blocks")); this->m_nextBlock->m_prevBlock = this->m_prevBlock; } #else @@ -965,10 +965,10 @@ void MemoryPoolSingleBlock::removeBlockFromList(MemoryPoolSingleBlock **pHead) // would require adding a back link, so I'd rather do some testing // first to see if it's really a speed issue in practice. (the only place // this is used is when freeing 'raw' blocks allocated via the DMA). - MemoryPoolSingleBlock *prev = NULL; + MemoryPoolSingleBlock *prev = nullptr; for (MemoryPoolSingleBlock *cur = *pHead; cur; cur = cur->m_nextBlock) { - DEBUG_ASSERTCRASH(cur->m_owningBlob == NULL, ("this function should only be used on raw blocks")); + DEBUG_ASSERTCRASH(cur->m_owningBlob == nullptr, ("this function should only be used on raw blocks")); if (cur == this) { if (prev) @@ -1005,7 +1005,7 @@ Int MemoryPoolSingleBlock::debugSingleBlockReportLeak(const char* owner) /** @todo srj -- we leak a bunch of these for some reason (probably due to leaking Win32LocalFile) so just ignore 'em for now... figure out later. */ } - else if (strstr(m_debugLiteralTagString, "Win32LocalFileSystem.cpp") != NULL) + else if (strstr(m_debugLiteralTagString, "Win32LocalFileSystem.cpp") != nullptr) { /** @todo srj -- we leak a bunch of these for some reason so just ignore 'em for now... figure out later. */ @@ -1035,14 +1035,14 @@ void MemoryPoolSingleBlock::debugVerifyBlock() DEBUG_ASSERTCRASH(this, ("null this")); DEBUG_ASSERTCRASH(m_magicCookie == SINGLEBLOCK_MAGIC_COOKIE, ("wrong cookie")); - DEBUG_ASSERTCRASH(m_debugLiteralTagString != NULL, ("bad tagstring")); + DEBUG_ASSERTCRASH(m_debugLiteralTagString != nullptr, ("bad tagstring")); /// @todo Put this check back in after the AI memory usage is under control (MSB) //DEBUG_ASSERTCRASH(m_logicalSize>0 && m_logicalSize < 0x00ffffff, ("unlikely value for m_logicalSize")); - DEBUG_ASSERTCRASH(m_nextBlock == NULL + DEBUG_ASSERTCRASH(m_nextBlock == nullptr || memcmp(&m_nextBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0 || m_nextBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch...")); #ifdef MPSB_DLINK - DEBUG_ASSERTCRASH(m_prevBlock == NULL + DEBUG_ASSERTCRASH(m_prevBlock == nullptr || memcmp(&m_prevBlock->m_owningBlob, &s_initFillerValue, sizeof(s_initFillerValue)) == 0 || m_prevBlock->m_owningBlob == m_owningBlob, ("owning blob mismatch...")); #endif @@ -1152,13 +1152,13 @@ void MemoryPoolSingleBlock::debugFillInWalls() fill in safe default values. */ MemoryPoolBlob::MemoryPoolBlob() : - m_owningPool(NULL), - m_nextBlob(NULL), - m_prevBlob(NULL), - m_firstFreeBlock(NULL), + m_owningPool(nullptr), + m_nextBlob(nullptr), + m_prevBlob(nullptr), + m_firstFreeBlock(nullptr), m_usedBlocksInBlob(0), m_totalBlocksInBlob(0), - m_blockData(NULL) + m_blockData(nullptr) { } @@ -1178,7 +1178,7 @@ MemoryPoolBlob::~MemoryPoolBlob() */ void MemoryPoolBlob::initBlob(MemoryPool *owningPool, Int allocationCount) { - DEBUG_ASSERTCRASH(m_blockData == NULL, ("unlikely init call")); + DEBUG_ASSERTCRASH(m_blockData == nullptr, ("unlikely init call")); m_owningPool = owningPool; m_totalBlocksInBlob = allocationCount; @@ -1198,7 +1198,7 @@ void MemoryPoolBlob::initBlob(MemoryPool *owningPool, Int allocationCount) #else block->initBlock(m_owningPool->getAllocationSize(), this, owningPool->getOwningFactory()); #endif - block->setNextFreeBlock((i > 0) ? next : NULL); + block->setNextFreeBlock((i > 0) ? next : nullptr); #ifdef MEMORYPOOL_DEBUG block->debugMarkBlockAsFree(); #endif @@ -1218,12 +1218,12 @@ void MemoryPoolBlob::initBlob(MemoryPool *owningPool, Int allocationCount) void MemoryPoolBlob::addBlobToList(MemoryPoolBlob **ppHead, MemoryPoolBlob **ppTail) { m_prevBlob = *ppTail; - m_nextBlob = NULL; + m_nextBlob = nullptr; - if (*ppTail != NULL) + if (*ppTail != nullptr) (*ppTail)->m_nextBlob = this; - if (*ppHead == NULL) + if (*ppHead == nullptr) *ppHead = this; *ppTail = this; @@ -1310,7 +1310,7 @@ void MemoryPoolBlob::debugMemoryVerifyBlob() { USE_PERF_TIMER(MemoryPoolDebugging) - DEBUG_ASSERTCRASH(m_owningPool != NULL, ("bad owner")); + DEBUG_ASSERTCRASH(m_owningPool != nullptr, ("bad owner")); DEBUG_ASSERTCRASH(m_usedBlocksInBlob >= 0 && m_usedBlocksInBlob <= m_totalBlocksInBlob, ("unlikely m_usedBlocksInBlob")); DEBUG_ASSERTCRASH(m_totalBlocksInBlob > 0, ("unlikely m_totalBlocksInBlob")); @@ -1392,7 +1392,7 @@ void MemoryPoolBlob::debugResetCheckpoints() init fields of Checkpointable to safe values. */ Checkpointable::Checkpointable() : - m_firstCheckpointInfo(NULL), + m_firstCheckpointInfo(nullptr), m_cpiEverFailed(false) { } @@ -1406,7 +1406,7 @@ Checkpointable::Checkpointable() : Checkpointable::~Checkpointable() { BlockCheckpointInfo::freeList(&m_firstCheckpointInfo); - m_firstCheckpointInfo = NULL; + m_firstCheckpointInfo = nullptr; m_cpiEverFailed = false; } #endif @@ -1439,7 +1439,7 @@ BlockCheckpointInfo *Checkpointable::debugAddCheckpointInfo( } else { - stacktrace[0] = NULL; + stacktrace[0] = nullptr; } #endif } @@ -1496,8 +1496,8 @@ void Checkpointable::debugResetCheckpoints() init to safe values. */ MemoryPool::MemoryPool() : - m_factory(NULL), - m_nextPoolInFactory(NULL), + m_factory(nullptr), + m_nextPoolInFactory(nullptr), m_poolName(""), m_allocationSize(0), m_initialAllocationCount(0), @@ -1505,9 +1505,9 @@ MemoryPool::MemoryPool() : m_usedBlocksInPool(0), m_totalBlocksInPool(0), m_peakUsedBlocksInPool(0), - m_firstBlob(NULL), - m_lastBlob(NULL), - m_firstBlobWithFreeBlocks(NULL) + m_firstBlob(nullptr), + m_lastBlob(nullptr), + m_firstBlobWithFreeBlocks(nullptr) { } @@ -1526,9 +1526,9 @@ void MemoryPool::init(MemoryPoolFactory *factory, const char *poolName, Int allo m_usedBlocksInPool = 0; m_totalBlocksInPool = 0; m_peakUsedBlocksInPool = 0; - m_firstBlob = NULL; - m_lastBlob = NULL; - m_firstBlobWithFreeBlocks = NULL; + m_firstBlob = nullptr; + m_lastBlob = nullptr; + m_firstBlobWithFreeBlocks = nullptr; // go ahead and init the initial block here (will throw on failure) createBlob(m_initialAllocationCount); @@ -1564,7 +1564,7 @@ MemoryPoolBlob* MemoryPool::createBlob(Int allocationCount) blob->addBlobToList(&m_firstBlob, &m_lastBlob); - DEBUG_ASSERTCRASH(m_firstBlobWithFreeBlocks == NULL, ("DO NOT IGNORE. Please call John McD - x36872 (m_firstBlobWithFreeBlocks != NULL)")); + DEBUG_ASSERTCRASH(m_firstBlobWithFreeBlocks == nullptr, ("DO NOT IGNORE. Please call John McD - x36872 (m_firstBlobWithFreeBlocks != nullptr)")); m_firstBlobWithFreeBlocks = blob; // bookkeeping @@ -1630,12 +1630,12 @@ void* MemoryPool::allocateBlockDoNotZeroImplementation(DECLARE_LITERALSTRING_ARG { ScopedCriticalSection scopedCriticalSection(TheMemoryPoolCriticalSection); - if (m_firstBlobWithFreeBlocks != NULL && !m_firstBlobWithFreeBlocks->hasAnyFreeBlocks()) + if (m_firstBlobWithFreeBlocks != nullptr && !m_firstBlobWithFreeBlocks->hasAnyFreeBlocks()) { // hmm... the current 'free' blob has nothing available. look and see if there // are any other existing blobs with freespace. MemoryPoolBlob *blob = m_firstBlob; - for (; blob != NULL; blob = blob->getNextInList()) + for (; blob != nullptr; blob = blob->getNextInList()) { if (blob->hasAnyFreeBlocks()) break; @@ -1648,7 +1648,7 @@ void* MemoryPool::allocateBlockDoNotZeroImplementation(DECLARE_LITERALSTRING_ARG // OK, if we are here then we have no blobs with freespace... darn. // allocate an overflow block. - if (m_firstBlobWithFreeBlocks == NULL) + if (m_firstBlobWithFreeBlocks == nullptr) { if (m_overflowAllocationCount == 0) { @@ -1801,9 +1801,9 @@ void MemoryPool::reset() { freeBlob(m_firstBlob); } - m_firstBlob = NULL; - m_lastBlob = NULL; - m_firstBlobWithFreeBlocks = NULL; + m_firstBlob = nullptr; + m_lastBlob = nullptr; + m_firstBlobWithFreeBlocks = nullptr; init(m_factory, m_poolName, m_allocationSize, m_initialAllocationCount, m_overflowAllocationCount); // will throw on failure @@ -1827,7 +1827,7 @@ void MemoryPool::removeFromList(MemoryPool **pHead) { // this isn't very efficient, but then, we rarely remove pools... // usually only at shutdown. so don't bother optimizing. - MemoryPool *prev = NULL; + MemoryPool *prev = nullptr; for (MemoryPool *cur = *pHead; cur; cur = cur->m_nextPoolInFactory) { if (cur == this) @@ -2002,14 +2002,14 @@ void MemoryPool::debugResetCheckpoints() init the DMA to safe values. */ DynamicMemoryAllocator::DynamicMemoryAllocator() : - m_factory(NULL), - m_nextDmaInFactory(NULL), + m_factory(nullptr), + m_nextDmaInFactory(nullptr), m_numPools(0), m_usedBlocksInDma(0), - m_rawBlocks(NULL) + m_rawBlocks(nullptr) { for (Int i = 0; i < MAX_DYNAMICMEMORYALLOCATOR_SUBPOOLS; i++) - m_pools[i] = 0; + m_pools[i] = nullptr; } //----------------------------------------------------------------------------- @@ -2029,7 +2029,7 @@ void DynamicMemoryAllocator::init(MemoryPoolFactory *factory, Int numSubPools, c { "dmaPool_1024", 1024, 64, 64 } }; - if (numSubPools == 0 || pParms == NULL) + if (numSubPools == 0 || pParms == nullptr) { // use the defaults... numSubPools = 7; @@ -2061,7 +2061,7 @@ DynamicMemoryAllocator::~DynamicMemoryAllocator() for (Int i = 0; i < m_numPools; i++) { m_factory->destroyMemoryPool(m_pools[i]); - m_pools[i] = NULL; + m_pools[i] = nullptr; } while (m_rawBlocks) @@ -2083,7 +2083,7 @@ MemoryPool *DynamicMemoryAllocator::findPoolForSize(Int allocSize) if (allocSize <= m_pools[i]->getAllocationSize()) return m_pools[i]; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -2104,7 +2104,7 @@ void DynamicMemoryAllocator::removeFromList(DynamicMemoryAllocator **pHead) { // this isn't very efficient, but then, we rarely remove these... // usually only at shutdown. so don't bother optimizing. - DynamicMemoryAllocator *prev = NULL; + DynamicMemoryAllocator *prev = nullptr; for (DynamicMemoryAllocator *cur = *pHead; cur; cur = cur->m_nextDmaInFactory) { if (cur == this) @@ -2163,15 +2163,15 @@ void *DynamicMemoryAllocator::allocateBytesDoNotZeroImplementation(Int numBytes { ScopedCriticalSection scopedCriticalSection(TheDmaCriticalSection); - void *result = NULL; + void *result = nullptr; #ifdef MEMORYPOOL_DEBUG - DEBUG_ASSERTCRASH(debugLiteralTagString != NULL, ("bad tagstring")); + DEBUG_ASSERTCRASH(debugLiteralTagString != nullptr, ("bad tagstring")); Int waste = 0; #endif MemoryPool *pool = findPoolForSize(numBytes); - if (pool != NULL) + if (pool != nullptr) { result = pool->allocateBlockDoNotZeroImplementation(PASS_LITERALSTRING_ARG1); #ifdef MEMORYPOOL_DEBUG @@ -2582,8 +2582,8 @@ void DynamicMemoryAllocator::debugDmaInfoReport( FILE *fp ) init the factory to safe values. */ MemoryPoolFactory::MemoryPoolFactory() : - m_firstPoolInFactory(NULL), - m_firstDmaInFactory(NULL) + m_firstPoolInFactory(nullptr), + m_firstDmaInFactory(nullptr) #ifdef MEMORYPOOL_CHECKPOINTING , m_curCheckpoint(0) #endif @@ -2687,7 +2687,7 @@ MemoryPool *MemoryPoolFactory::findMemoryPool(const char *poolName) return pool; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -2791,7 +2791,7 @@ static const char* s_specialPrefixes[MAX_SPECIAL_USED] = "W3A_", "STL_", "STR_", - NULL + nullptr }; #endif @@ -2815,7 +2815,7 @@ void MemoryPoolFactory::adjustTotals(const char* tagString, Int usedDelta, Int p int found = 0; // if no matches found, goes into slot zero for (int i = 1; i < MAX_SPECIAL_USED; ++i) // start at 1, not zero { - if (s_specialPrefixes[i] == NULL) + if (s_specialPrefixes[i] == nullptr) break; if (strncmp(tagString, s_specialPrefixes[i], strlen(s_specialPrefixes[i])) == 0) @@ -2867,7 +2867,7 @@ void MemoryPoolFactory::debugMemoryVerify() for (DynamicMemoryAllocator *dma = m_firstDmaInFactory; dma; dma = dma->getNextDmaInList()) { dma->debugMemoryVerifyDma(); - Int tmp = dma->debugCalcRawBlockBytes(NULL); + Int tmp = dma->debugCalcRawBlockBytes(nullptr); used += tmp; phys += tmp; } @@ -2969,7 +2969,7 @@ void MemoryPoolFactory::memoryPoolUsageReport( const char* filename, FILE *appen #ifdef MEMORYPOOL_DEBUG //USE_PERF_TIMER(MemoryPoolDebugging) skip end-of-run reporting stuff - FILE* perfStatsFile = NULL; + FILE* perfStatsFile = nullptr; Int totalNamedPoolPeak = 0; if( !appendToFileInstead ) @@ -2984,7 +2984,7 @@ void MemoryPoolFactory::memoryPoolUsageReport( const char* filename, FILE *appen perfStatsFile = appendToFileInstead; } - if (perfStatsFile == NULL) + if (perfStatsFile == nullptr) { DEBUG_CRASH(("could not open/create perf file %s -- is it open in another app?",filename)); return; @@ -3036,7 +3036,7 @@ void MemoryPoolFactory::memoryPoolUsageReport( const char* filename, FILE *appen } #endif - if (lineIdx < MAX_SPECIAL_USED && s_specialPrefixes[lineIdx] != NULL) + if (lineIdx < MAX_SPECIAL_USED && s_specialPrefixes[lineIdx] != nullptr) { fprintf(perfStatsFile, ",,,%s,%d",s_specialPrefixes[lineIdx],m_usedBytesSpecialPeak[lineIdx]/1024); keepGoing = true; @@ -3118,7 +3118,7 @@ void MemoryPoolFactory::debugMemoryReport(Int flags, Int startCheckpoint, Int en fprintf( fp, "Begin Pool Info Report\n" ); fprintf( fp, "------------------------------------------\n" ); } - MemoryPool::debugPoolInfoReport( NULL, fp ); + MemoryPool::debugPoolInfoReport( nullptr, fp ); for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList()) { MemoryPool::debugPoolInfoReport( pool, fp ); @@ -3210,7 +3210,7 @@ void MemoryPoolFactory::debugMemoryReport(Int flags, Int startCheckpoint, Int en DEBUG_LOG(("Options: Between checkpoints %d and %d, report on (%s)",startCheckpoint,endCheckpoint,buf)); DEBUG_LOG(("------------------------------------------")); - BlockCheckpointInfo::doBlockCheckpointReport( NULL, "", 0, 0, 0 ); + BlockCheckpointInfo::doBlockCheckpointReport( nullptr, "", 0, 0, 0 ); for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList()) { pool->debugCheckpointReport(flags, startCheckpoint, endCheckpoint, pool->getPoolName()); @@ -3243,7 +3243,7 @@ void* STLSpecialAlloc::allocate(size_t __n) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); return TheDynamicMemoryAllocator->allocateBytes(__n, "STL_"); } @@ -3252,7 +3252,7 @@ void STLSpecialAlloc::deallocate(void* __p, size_t) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); TheDynamicMemoryAllocator->freeBytes(__p); } @@ -3264,7 +3264,7 @@ void *operator new(size_t size) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); return TheDynamicMemoryAllocator->allocateBytes(size, "global operator new"); } @@ -3276,7 +3276,7 @@ void *operator new[](size_t size) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); return TheDynamicMemoryAllocator->allocateBytes(size, "global operator new[]"); } @@ -3288,7 +3288,7 @@ void operator delete(void *p) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator delete")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator delete")); TheDynamicMemoryAllocator->freeBytes(p); } @@ -3300,7 +3300,7 @@ void operator delete[](void *p) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator delete")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator delete")); TheDynamicMemoryAllocator->freeBytes(p); } @@ -3312,7 +3312,7 @@ void* operator new(size_t size, const char * fname, int) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); #ifdef MEMORYPOOL_DEBUG return TheDynamicMemoryAllocator->allocateBytesImplementation(size, fname); #else @@ -3328,7 +3328,7 @@ void operator delete(void * p, const char *, int) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator delete")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator delete")); TheDynamicMemoryAllocator->freeBytes(p); } @@ -3340,7 +3340,7 @@ void* operator new[](size_t size, const char * fname, int) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator new")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator new")); #ifdef MEMORYPOOL_DEBUG return TheDynamicMemoryAllocator->allocateBytesImplementation(size, fname); #else @@ -3356,7 +3356,7 @@ void operator delete[](void * p, const char *, int) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager before calling global operator delete")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager before calling global operator delete")); TheDynamicMemoryAllocator->freeBytes(p); } @@ -3366,7 +3366,7 @@ void *calloc(size_t a, size_t b) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager")); return TheDynamicMemoryAllocator->allocateBytes(a * b, "calloc"); } #endif @@ -3377,7 +3377,7 @@ void free(void * p) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager")); TheDynamicMemoryAllocator->freeBytes(p); } #endif @@ -3388,7 +3388,7 @@ void *malloc(size_t a) { ++theLinkTester; preMainInitMemoryManager(); - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("must init memory manager")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("must init memory manager")); return TheDynamicMemoryAllocator->allocateBytesDoNotZero(a, "malloc"); } #endif @@ -3408,7 +3408,7 @@ void *realloc(void *p, size_t s) */ void initMemoryManager() { - if (TheMemoryPoolFactory == NULL) + if (TheMemoryPoolFactory == nullptr) { Int numSubPools; const PoolInitRec *pParms; @@ -3482,7 +3482,7 @@ Bool isMemoryManagerOfficiallyInited() */ static void preMainInitMemoryManager() { - if (TheMemoryPoolFactory == NULL) + if (TheMemoryPoolFactory == nullptr) { Int numSubPools; @@ -3520,7 +3520,7 @@ void shutdownMemoryManager() DEBUG_ASSERTCRASH(TheMemoryPoolFactory, ("hmm, no factory")); if (TheMemoryPoolFactory) TheMemoryPoolFactory->destroyDynamicMemoryAllocator(TheDynamicMemoryAllocator); - TheDynamicMemoryAllocator = NULL; + TheDynamicMemoryAllocator = nullptr; } if (TheMemoryPoolFactory) @@ -3530,7 +3530,7 @@ void shutdownMemoryManager() // make an exception. TheMemoryPoolFactory->~MemoryPoolFactory(); ::sysFree((void *)TheMemoryPoolFactory); - TheMemoryPoolFactory = NULL; + TheMemoryPoolFactory = nullptr; } #ifdef MEMORYPOOL_DEBUG diff --git a/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp b/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp index d25872b98c6..6bdd7e65706 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemoryInit.cpp @@ -77,7 +77,7 @@ void userMemoryAdjustPoolSize(const char *poolName, Int& initialAllocationCount, if (initialAllocationCount > 0) return; - for (const PoolSizeRec* p = PoolSizes; p->name != NULL; ++p) + for (const PoolSizeRec* p = PoolSizes; p->name != nullptr; ++p) { if (strcmp(p->name, poolName) == 0) { @@ -112,7 +112,7 @@ void userMemoryManagerInitPools() // since we're called prior to main, the cur dir might not be what // we expect. so do it the hard way. char buf[_MAX_PATH]; - ::GetModuleFileName(NULL, buf, sizeof(buf)); + ::GetModuleFileName(nullptr, buf, sizeof(buf)); if (char* pEnd = strrchr(buf, '\\')) { *pEnd = 0; @@ -130,7 +130,7 @@ void userMemoryManagerInitPools() continue; if (sscanf(buf, "%s %d %d", poolName, &initial, &overflow ) == 3) { - for (PoolSizeRec* p = PoolSizes; p->name != NULL; ++p) + for (PoolSizeRec* p = PoolSizes; p->name != nullptr; ++p) { if (stricmp(p->name, poolName) == 0) { diff --git a/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp b/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp index 8520a77de9b..54f8fd770fe 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp @@ -28,8 +28,8 @@ static Bool theMainInitFlag = false; // PUBLIC DATA // ---------------------------------------------------------------------------- -MemoryPoolFactory *TheMemoryPoolFactory = NULL; -DynamicMemoryAllocator *TheDynamicMemoryAllocator = NULL; +MemoryPoolFactory *TheMemoryPoolFactory = nullptr; +DynamicMemoryAllocator *TheDynamicMemoryAllocator = nullptr; //----------------------------------------------------------------------------- // METHODS for DynamicMemoryAllocator @@ -45,7 +45,7 @@ DynamicMemoryAllocator *TheDynamicMemoryAllocator = NULL; void *DynamicMemoryAllocator::allocateBytesDoNotZeroImplementation(Int numBytes) { void *p = malloc(numBytes); - if (p == NULL) + if (p == nullptr) throw ERROR_OUT_OF_MEMORY; return p; } @@ -107,7 +107,7 @@ void MemoryPoolFactory::debugSetInitFillerIndex(Int index) */ void initMemoryManager() { - if (TheMemoryPoolFactory == NULL && TheDynamicMemoryAllocator == NULL) + if (TheMemoryPoolFactory == nullptr && TheDynamicMemoryAllocator == nullptr) { TheMemoryPoolFactory = new (malloc(sizeof MemoryPoolFactory)) MemoryPoolFactory; TheDynamicMemoryAllocator = new (malloc(sizeof DynamicMemoryAllocator)) DynamicMemoryAllocator; @@ -136,18 +136,18 @@ Bool isMemoryManagerOfficiallyInited() */ void shutdownMemoryManager() { - if (TheDynamicMemoryAllocator != NULL) + if (TheDynamicMemoryAllocator != nullptr) { TheDynamicMemoryAllocator->~DynamicMemoryAllocator(); free((void *)TheDynamicMemoryAllocator); - TheDynamicMemoryAllocator = NULL; + TheDynamicMemoryAllocator = nullptr; } - if (TheMemoryPoolFactory != NULL) + if (TheMemoryPoolFactory != nullptr) { TheMemoryPoolFactory->~MemoryPoolFactory(); free((void *)TheMemoryPoolFactory); - TheMemoryPoolFactory = NULL; + TheMemoryPoolFactory = nullptr; } theMainInitFlag = false; @@ -161,7 +161,7 @@ void shutdownMemoryManager() extern void * __cdecl operator new(size_t size) { void *p = malloc(size); - if (p == NULL) + if (p == nullptr) throw ERROR_OUT_OF_MEMORY; memset(p, 0, size); return p; @@ -175,7 +175,7 @@ extern void __cdecl operator delete(void *p) extern void * __cdecl operator new[](size_t size) { void *p = malloc(size); - if (p == NULL) + if (p == nullptr) throw ERROR_OUT_OF_MEMORY; memset(p, 0, size); return p; @@ -190,7 +190,7 @@ extern void __cdecl operator delete[](void *p) extern void* __cdecl operator new(size_t size, const char *, int) { void *p = malloc(size); - if (p == NULL) + if (p == nullptr) throw ERROR_OUT_OF_MEMORY; memset(p, 0, size); return p; @@ -204,7 +204,7 @@ extern void __cdecl operator delete(void *p, const char *, int) extern void* __cdecl operator new[](size_t size, const char *, int) { void *p = malloc(size); - if (p == NULL) + if (p == nullptr) throw ERROR_OUT_OF_MEMORY; memset(p, 0, size); return p; diff --git a/Core/GameEngine/Source/Common/System/LocalFile.cpp b/Core/GameEngine/Source/Common/System/LocalFile.cpp index 7ac8cd7a20b..ffe95f0752c 100644 --- a/Core/GameEngine/Source/Common/System/LocalFile.cpp +++ b/Core/GameEngine/Source/Common/System/LocalFile.cpp @@ -106,7 +106,7 @@ static Int s_totalOpen = 0; LocalFile::LocalFile() #if USE_BUFFERED_IO - : m_file(NULL) + : m_file(nullptr) #else : m_handle(-1) #endif @@ -165,7 +165,7 @@ Bool LocalFile::open( const Char *filename, Int access, size_t bufferSize ) const Bool truncate = (m_access & TRUNCATE) != 0; const Bool binary = (m_access & BINARY) != 0; - const Char *mode = NULL; + const Char *mode = nullptr; // Mode string selection (mimics _open flag combinations) // TEXT is implicit for fopen if 'b' is not present @@ -191,7 +191,7 @@ Bool LocalFile::open( const Char *filename, Int access, size_t bufferSize ) } m_file = fopen(filename, mode); - if (m_file == NULL) + if (m_file == nullptr) { goto error; } @@ -201,7 +201,7 @@ Bool LocalFile::open( const Char *filename, Int access, size_t bufferSize ) if (bufferSize == 0) { - result = setvbuf(m_file, NULL, _IONBF, 0); // Uses no buffering + result = setvbuf(m_file, nullptr, _IONBF, 0); // Uses no buffering } else { @@ -210,7 +210,7 @@ Bool LocalFile::open( const Char *filename, Int access, size_t bufferSize ) : _IOFBF; // Uses full buffering // Buffer is expected to lazy allocate on first read or write later - result = setvbuf(m_file, NULL, bufferMode, bufferSize); + result = setvbuf(m_file, nullptr, bufferMode, bufferSize); } DEBUG_ASSERTCRASH(result == 0, ("LocalFile::open - setvbuf failed")); @@ -315,7 +315,7 @@ void LocalFile::closeFile() if (m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; --s_totalOpen; } #else @@ -340,7 +340,7 @@ Int LocalFile::read( void *buffer, Int bytes ) return -1; } - if (buffer == NULL) + if (buffer == nullptr) { #if USE_BUFFERED_IO fseek(m_file, bytes, SEEK_CUR); @@ -669,7 +669,7 @@ void LocalFile::nextLine(Char *buf, Int bufSize) // seek to the next new-line. do { - if ((buf == NULL) || (i >= (bufSize-1))) { + if ((buf == nullptr) || (i >= (bufSize-1))) { #if USE_BUFFERED_IO val = fread(&c, 1, 1, m_file); #else @@ -686,7 +686,7 @@ void LocalFile::nextLine(Char *buf, Int bufSize) ++i; } while ((val != 0) && (c != '\n')); - if (buf != NULL) { + if (buf != nullptr) { if (i < bufSize) { buf[i] = 0; } else { diff --git a/Core/GameEngine/Source/Common/System/LocalFileSystem.cpp b/Core/GameEngine/Source/Common/System/LocalFileSystem.cpp index af6b19329b8..81373dc558f 100644 --- a/Core/GameEngine/Source/Common/System/LocalFileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/LocalFileSystem.cpp @@ -75,7 +75,7 @@ // Public Data //---------------------------------------------------------------------------- -LocalFileSystem *TheLocalFileSystem = NULL; +LocalFileSystem *TheLocalFileSystem = nullptr; //---------------------------------------------------------------------------- // Private Prototypes diff --git a/Core/GameEngine/Source/Common/System/MiniDumper.cpp b/Core/GameEngine/Source/Common/System/MiniDumper.cpp index 21ab80e578a..9c48e39d12c 100644 --- a/Core/GameEngine/Source/Common/System/MiniDumper.cpp +++ b/Core/GameEngine/Source/Common/System/MiniDumper.cpp @@ -24,10 +24,10 @@ #include "gitinfo.h" // Globals for storing the pointer to the exception -_EXCEPTION_POINTERS* g_dumpException = NULL; +_EXCEPTION_POINTERS* g_dumpException = nullptr; DWORD g_dumpExceptionThreadId = 0; -MiniDumper* TheMiniDumper = NULL; +MiniDumper* TheMiniDumper = nullptr; // Globals containing state about the current exception that's used for context in the mini dump. // These are populated by MiniDumper::DumpingExceptionFilter to store a copy of the exception in case it goes out of scope @@ -39,7 +39,7 @@ constexpr const char* DumpFileNamePrefix = "Crash"; void MiniDumper::initMiniDumper(const AsciiString& userDirPath) { - DEBUG_ASSERTCRASH(TheMiniDumper == NULL, ("MiniDumper::initMiniDumper called on already created instance")); + DEBUG_ASSERTCRASH(TheMiniDumper == nullptr, ("MiniDumper::initMiniDumper called on already created instance")); // Use placement new on the process heap so TheMiniDumper is placed outside the MemoryPoolFactory managed area. // If the crash is due to corrupted MemoryPoolFactory structures, try to mitigate the chances of MiniDumper memory also being corrupted @@ -53,8 +53,8 @@ void MiniDumper::shutdownMiniDumper() { TheMiniDumper->ShutDown(); TheMiniDumper->~MiniDumper(); - ::HeapFree(::GetProcessHeap(), NULL, TheMiniDumper); - TheMiniDumper = NULL; + ::HeapFree(::GetProcessHeap(), 0, TheMiniDumper); + TheMiniDumper = nullptr; } } @@ -63,10 +63,10 @@ MiniDumper::MiniDumper() m_miniDumpInitialized = false; m_loadedDbgHelp = false; m_requestedDumpType = DumpType_Minimal; - m_dumpRequested = NULL; - m_dumpComplete = NULL; - m_quitting = NULL; - m_dumpThread = NULL; + m_dumpRequested = nullptr; + m_dumpComplete = nullptr; + m_quitting = nullptr; + m_dumpThread = nullptr; m_dumpThreadId = 0; m_dumpDir[0] = 0; m_dumpFile[0] = 0; @@ -145,7 +145,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath) return; } - DWORD executableSize = ::GetModuleFileNameW(NULL, m_executablePath, ARRAY_SIZE(m_executablePath)); + DWORD executableSize = ::GetModuleFileNameW(nullptr, m_executablePath, ARRAY_SIZE(m_executablePath)); if (executableSize == 0 || executableSize == ARRAY_SIZE(m_executablePath)) { DEBUG_LOG(("MiniDumper::Initialize: Could not get executable file name. Returned value=%u", executableSize)); @@ -158,18 +158,18 @@ void MiniDumper::Initialize(const AsciiString& userDirPath) return; } - m_dumpRequested = CreateEvent(NULL, TRUE, FALSE, NULL); - m_dumpComplete = CreateEvent(NULL, TRUE, FALSE, NULL); - m_quitting = CreateEvent(NULL, TRUE, FALSE, NULL); + m_dumpRequested = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_dumpComplete = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_quitting = CreateEvent(nullptr, TRUE, FALSE, nullptr); - if (m_dumpRequested == NULL || m_dumpComplete == NULL || m_quitting == NULL) + if (m_dumpRequested == nullptr || m_dumpComplete == nullptr || m_quitting == nullptr) { // Something went wrong with the creation of the events.. DEBUG_LOG(("MiniDumper::Initialize: Unable to create events: error=%u", ::GetLastError())); return; } - m_dumpThread = ::CreateThread(NULL, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId); + m_dumpThread = ::CreateThread(nullptr, 0, MiniDumpThreadProc, this, CREATE_SUSPENDED, &m_dumpThreadId); if (!m_dumpThread) { DEBUG_LOG(("MiniDumper::Initialize: Unable to create thread: error=%u", ::GetLastError())); @@ -194,7 +194,7 @@ Bool MiniDumper::IsInitialized() const Bool MiniDumper::IsDumpThreadStillRunning() const { DWORD exitCode; - if (m_dumpThread != NULL && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE) + if (m_dumpThread != nullptr && ::GetExitCodeThread(m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE) { return true; } @@ -211,7 +211,7 @@ Bool MiniDumper::InitializeDumpDirectory(const AsciiString& userDirPath) strlcat(m_dumpDir, "CrashDumps\\", ARRAY_SIZE(m_dumpDir)); if (::_access(m_dumpDir, 0) != 0) { - if (!::CreateDirectory(m_dumpDir, NULL)) + if (!::CreateDirectory(m_dumpDir, nullptr)) { DEBUG_LOG(("MiniDumper::Initialize: Unable to create path for crash dumps at '%s': error=%u", m_dumpDir, ::GetLastError())); return false; @@ -229,7 +229,7 @@ void MiniDumper::ShutdownDumpThread() { if (IsDumpThreadStillRunning()) { - DEBUG_ASSERTCRASH(m_quitting != NULL, ("MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being NULL")); + DEBUG_ASSERTCRASH(m_quitting != nullptr, ("MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being null")); ::SetEvent(m_quitting); DWORD waitRet = ::WaitForSingleObject(m_dumpThread, 3000); @@ -256,29 +256,29 @@ void MiniDumper::ShutDown() { ShutdownDumpThread(); - if (m_dumpThread != NULL) + if (m_dumpThread != nullptr) { DEBUG_ASSERTCRASH(!IsDumpThreadStillRunning(), ("MiniDumper::ShutDown: ShutdownDumpThread() was unable to stop Dump thread")); ::CloseHandle(m_dumpThread); - m_dumpThread = NULL; + m_dumpThread = nullptr; } - if (m_quitting != NULL) + if (m_quitting != nullptr) { ::CloseHandle(m_quitting); - m_quitting = NULL; + m_quitting = nullptr; } - if (m_dumpComplete != NULL) + if (m_dumpComplete != nullptr) { ::CloseHandle(m_dumpComplete); - m_dumpComplete = NULL; + m_dumpComplete = nullptr; } - if (m_dumpRequested != NULL) + if (m_dumpRequested != nullptr) { ::CloseHandle(m_dumpRequested); - m_dumpRequested = NULL; + m_dumpRequested = nullptr; } if (m_loadedDbgHelp) @@ -320,9 +320,9 @@ DWORD MiniDumper::ThreadProcInternal() DWORD WINAPI MiniDumper::MiniDumpThreadProc(LPVOID lpParam) { - if (lpParam == NULL) + if (lpParam == nullptr) { - DEBUG_LOG(("MiniDumper::MiniDumpThreadProc: The provided parameter was NULL, exiting thread.")); + DEBUG_LOG(("MiniDumper::MiniDumpThreadProc: The provided parameter was null, exiting thread.")); return MiniDumperExitCode_FailureParam; } @@ -350,16 +350,16 @@ void MiniDumper::CreateMiniDump(DumpType dumpType) sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, GitShortSHA1, currentProcessId); - HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (dumpFile == NULL || dumpFile == INVALID_HANDLE_VALUE) + HANDLE dumpFile = ::CreateFile(m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + if (dumpFile == nullptr || dumpFile == INVALID_HANDLE_VALUE) { DEBUG_LOG(("MiniDumper::CreateMiniDump: Unable to create dump file '%s': error=%u", m_dumpFile, ::GetLastError())); return; } - PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = NULL; + PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = nullptr; MINIDUMP_EXCEPTION_INFORMATION exceptionInfo = { 0 }; - if (g_dumpException != NULL) + if (g_dumpException != nullptr) { exceptionInfo.ExceptionPointers = g_dumpException; exceptionInfo.ThreadId = g_dumpExceptionThreadId; @@ -386,8 +386,8 @@ void MiniDumper::CreateMiniDump(DumpType dumpType) dumpFile, miniDumpType, exceptionInfoPtr, - NULL, - NULL); + nullptr, + nullptr); if (!success) { diff --git a/Core/GameEngine/Source/Common/System/ObjectStatusTypes.cpp b/Core/GameEngine/Source/Common/System/ObjectStatusTypes.cpp index ab689ad343c..2a4f79b7da8 100644 --- a/Core/GameEngine/Source/Common/System/ObjectStatusTypes.cpp +++ b/Core/GameEngine/Source/Common/System/ObjectStatusTypes.cpp @@ -81,7 +81,7 @@ const char* const ObjectStatusMaskType::s_bitNameList[] = "IMMOBILE", "DISGUISED", "DEPLOYED", - NULL + nullptr }; static_assert(ARRAY_SIZE(ObjectStatusMaskType::s_bitNameList) == ObjectStatusMaskType::NumBits + 1, "Incorrect array size"); diff --git a/Core/GameEngine/Source/Common/System/RAMFile.cpp b/Core/GameEngine/Source/Common/System/RAMFile.cpp index 93d5994b451..7c909bee77c 100644 --- a/Core/GameEngine/Source/Common/System/RAMFile.cpp +++ b/Core/GameEngine/Source/Common/System/RAMFile.cpp @@ -103,7 +103,7 @@ RAMFile::RAMFile() : m_size(0), - m_data(NULL), + m_data(nullptr), m_pos(0) { @@ -143,7 +143,7 @@ Bool RAMFile::open( const Char *filename, Int access, size_t bufferSize ) File *file = TheFileSystem->openFile( filename, access, bufferSize ); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -162,9 +162,9 @@ Bool RAMFile::open( const Char *filename, Int access, size_t bufferSize ) Bool RAMFile::open( File *file ) { //USE_PERF_TIMER(RAMFile) - if ( file == NULL ) + if ( file == nullptr ) { - return NULL; + return FALSE; } const Int access = file->getAccess(); @@ -178,7 +178,7 @@ Bool RAMFile::open( File *file ) m_size = file->size(); m_data = MSGNEW("RAMFILE") char [ m_size ]; // pool[]ify - if ( m_data == NULL ) + if ( m_data == nullptr ) { return FALSE; } @@ -188,7 +188,7 @@ Bool RAMFile::open( File *file ) if ( m_size < 0 ) { delete [] m_data; - m_data = NULL; + m_data = nullptr; return FALSE; } @@ -203,7 +203,7 @@ Bool RAMFile::open( File *file ) Bool RAMFile::openFromArchive(File *archiveFile, const AsciiString& filename, Int offset, Int size) { //USE_PERF_TIMER(RAMFile) - if (archiveFile == NULL) { + if (archiveFile == nullptr) { return FALSE; } @@ -246,7 +246,7 @@ void RAMFile::close( void ) void RAMFile::closeFile() { delete [] m_data; - m_data = NULL; + m_data = nullptr; } //================================================================= @@ -255,7 +255,7 @@ void RAMFile::closeFile() // if buffer is null, just advance the current position by 'bytes' Int RAMFile::read( void *buffer, Int bytes ) { - if( m_data == NULL ) + if( m_data == nullptr ) { return -1; } @@ -267,7 +267,7 @@ Int RAMFile::read( void *buffer, Int bytes ) bytes = bytesLeft; } - if (( bytes > 0 ) && ( buffer != NULL )) + if (( bytes > 0 ) && ( buffer != nullptr )) { memcpy ( buffer, &m_data[m_pos], bytes ); } @@ -485,7 +485,7 @@ void RAMFile::nextLine(Char *buf, Int bufSize) Int i = 0; // seek to the next new-line character while ((m_pos < m_size) && (m_data[m_pos] != '\n')) { - if ((buf != NULL) && (i < (bufSize-1))) { + if ((buf != nullptr) && (i < (bufSize-1))) { buf[i] = m_data[m_pos]; ++i; } @@ -494,13 +494,13 @@ void RAMFile::nextLine(Char *buf, Int bufSize) // we got to the new-line character, now go one past it. if (m_pos < m_size) { - if ((buf != NULL) && (i < bufSize)) { + if ((buf != nullptr) && (i < bufSize)) { buf[i] = m_data[m_pos]; ++i; } ++m_pos; } - if (buf != NULL) { + if (buf != nullptr) { if (i < bufSize) { buf[i] = 0; } else { @@ -517,7 +517,7 @@ void RAMFile::nextLine(Char *buf, Int bufSize) //================================================================= Bool RAMFile::copyDataToFile(File *localFile) { - if (localFile == NULL) { + if (localFile == nullptr) { return FALSE; } @@ -549,14 +549,14 @@ File* RAMFile::convertToRAMFile() char* RAMFile::readEntireAndClose() { - if (m_data == NULL) + if (m_data == nullptr) { - DEBUG_CRASH(("m_data is NULL in RAMFile::readEntireAndClose -- should not happen!")); + DEBUG_CRASH(("m_data is null in RAMFile::readEntireAndClose -- should not happen!")); return NEW char[1]; // just to avoid crashing... } char* tmp = m_data; - m_data = NULL; // will belong to our caller! + m_data = nullptr; // will belong to our caller! close(); diff --git a/Core/GameEngine/Source/Common/System/Radar.cpp b/Core/GameEngine/Source/Common/System/Radar.cpp index 86ac2046b84..65dc21acee1 100644 --- a/Core/GameEngine/Source/Common/System/Radar.cpp +++ b/Core/GameEngine/Source/Common/System/Radar.cpp @@ -56,7 +56,7 @@ // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -Radar *TheRadar = NULL; ///< the radar global singleton +Radar *TheRadar = nullptr; ///< the radar global singleton // PRIVATE //////////////////////////////////////////////////////////////////////////////////////// #define RADAR_QUEUE_TERRAIN_REFRESH_DELAY (LOGICFRAMES_PER_SECOND * 3.0f) @@ -68,7 +68,7 @@ void Radar::deleteList( RadarObject **list ) while( *list ) { RadarObject *nextObject = (*list)->friend_getNext(); - (*list)->friend_getObject()->friend_setRadarData( NULL ); + (*list)->friend_getObject()->friend_setRadarData( nullptr ); deleteInstance(*list); *list = nextObject; } @@ -86,7 +86,7 @@ void Radar::deleteListResources( void ) #ifdef DEBUG_CRASHING for( Object *obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) { - DEBUG_ASSERTCRASH( obj->friend_getRadarData() == NULL, + DEBUG_ASSERTCRASH( obj->friend_getRadarData() == nullptr, ("Radar::deleteListResources: Unexpectedly an object still has radar data assigned") ); } #endif @@ -98,8 +98,8 @@ void Radar::deleteListResources( void ) RadarObject::RadarObject( void ) { - m_object = NULL; - m_next = NULL; + m_object = nullptr; + m_next = nullptr; m_color = GameMakeColor( 255, 255, 255, 255 ); } @@ -123,7 +123,7 @@ Bool RadarObject::isTemporarilyHidden() const Bool RadarObject::isTemporarilyHidden(const Object* obj) { Drawable* draw = obj->getDrawable(); - if (draw == NULL || draw->getStealthLook() == STEALTHLOOK_INVISIBLE || draw->isDrawableEffectivelyHidden()) + if (draw == nullptr || draw->getStealthLook() == STEALTHLOOK_INVISIBLE || draw->isDrawableEffectivelyHidden()) return true; return false; @@ -158,7 +158,7 @@ void RadarObject::xfer( Xfer *xfer ) // find the object and save m_object = TheGameLogic->findObjectByID( objectID ); - if( m_object == NULL ) + if( m_object == nullptr ) { DEBUG_CRASH(( "RadarObject::xfer - Unable to find object for radar data" )); @@ -189,10 +189,10 @@ void RadarObject::loadPostProcess( void ) Radar::Radar( void ) { - m_radarWindow = NULL; - m_objectList = NULL; - m_localObjectList = NULL; - m_localHeroObjectList = NULL; + m_radarWindow = nullptr; + m_objectList = nullptr; + m_localObjectList = nullptr; + m_localHeroObjectList = nullptr; std::fill(m_radarHidden, m_radarHidden + ARRAY_SIZE(m_radarHidden), false); std::fill(m_radarForceOn, m_radarForceOn + ARRAY_SIZE(m_radarForceOn), false); m_terrainAverageZ = 0.0f; @@ -320,7 +320,7 @@ void Radar::newMap( TerrainLogic *terrain ) // keep a pointer for our radar window Int id = NAMEKEY( "ControlBar.wnd:LeftHUD" ); - m_radarWindow = TheWindowManager->winGetWindowFromId( NULL, id ); + m_radarWindow = TheWindowManager->winGetWindowFromId( nullptr, id ); DEBUG_ASSERTCRASH( m_radarWindow, ("Radar::newMap - Unable to find radar game window") ); // reset all the data in the radar @@ -394,8 +394,8 @@ Bool Radar::addObject( Object *obj ) RadarObject *newObj; // sanity - DEBUG_ASSERTCRASH( obj->friend_getRadarData() == NULL, - ("Radar: addObject - non NULL radar data for '%s'", + DEBUG_ASSERTCRASH( obj->friend_getRadarData() == nullptr, + ("Radar: addObject - non null radar data for '%s'", obj->getTemplate()->getName().str()) ); // allocate a new object @@ -437,7 +437,7 @@ Bool Radar::addObject( Object *obj ) //------------------------------------------------------------------------------------------------- Bool Radar::deleteFromList( Object *obj, RadarObject **list ) { - RadarObject *radarObject, *prevObject = NULL; + RadarObject *radarObject, *prevObject = nullptr; // find the object in list for( radarObject = *list; radarObject; radarObject = radarObject->friend_getNext() ) @@ -447,13 +447,13 @@ Bool Radar::deleteFromList( Object *obj, RadarObject **list ) { // unlink the object from list - if( prevObject == NULL ) + if( prevObject == nullptr ) *list = radarObject->friend_getNext(); // removing head of list else prevObject->friend_setNext( radarObject->friend_getNext() ); - // set the object radar data to NULL - obj->friend_setRadarData( NULL ); + // set the object radar data to null + obj->friend_setRadarData( nullptr ); // delete the object instance deleteInstance(radarObject); @@ -480,7 +480,7 @@ Bool Radar::removeObject( Object *obj ) { // sanity - if( obj->friend_getRadarData() == NULL ) + if( obj->friend_getRadarData() == nullptr ) return FALSE; if( deleteFromList( obj, &m_localHeroObjectList ) == TRUE ) @@ -509,7 +509,7 @@ Bool Radar::radarToWorld2D( const ICoord2D *radar, Coord3D *world ) Int x, y; // sanity - if( radar == NULL || world == NULL ) + if( radar == nullptr || world == nullptr ) return FALSE; // get the coords @@ -559,7 +559,7 @@ Bool Radar::worldToRadar( const Coord3D *world, ICoord2D *radar ) { // sanity - if( world == NULL || radar == NULL ) + if( world == nullptr || radar == nullptr ) return FALSE; // sanity check the world position @@ -600,7 +600,7 @@ Bool Radar::localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ) { // sanity - if( pixel == NULL || radar == NULL ) + if( pixel == nullptr || radar == nullptr ) return FALSE; // get window size of the radar @@ -670,11 +670,11 @@ Bool Radar::screenPixelToWorld( const ICoord2D *pixel, Coord3D *world ) { // sanity - if( pixel == NULL || world == NULL ) + if( pixel == nullptr || world == nullptr ) return FALSE; // if we have no radar window can't do the conversion - if( m_radarWindow == NULL ) + if( m_radarWindow == nullptr ) return FALSE; // translate pixel coords to local pixel coords relative to the radar window @@ -702,16 +702,16 @@ Object *Radar::objectUnderRadarPixel( const ICoord2D *pixel ) { // sanity - if( pixel == NULL ) - return NULL; + if( pixel == nullptr ) + return nullptr; // convert pixel location to radar logical radar location ICoord2D radar; if( localPixelToRadar( pixel, &radar ) == FALSE ) - return NULL; + return nullptr; // object we will return - Object *obj = NULL; + Object *obj = nullptr; // // scan the objects on the radar list and return any object that maps its world location @@ -722,11 +722,11 @@ Object *Radar::objectUnderRadarPixel( const ICoord2D *pixel ) obj = searchListForRadarLocationMatch( m_localHeroObjectList, &radar ); // search the local object list if not found - if( obj == NULL ) + if( obj == nullptr ) obj = searchListForRadarLocationMatch( m_localObjectList, &radar ); // search all other objects if still not found - if( obj == NULL ) + if( obj == nullptr ) obj = searchListForRadarLocationMatch( m_objectList, &radar ); // return the object found (if any) @@ -741,8 +741,8 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D { // sanity - if( listHead == NULL || radarMatch == NULL ) - return NULL; + if( listHead == nullptr || radarMatch == nullptr ) + return nullptr; // scan the list RadarObject *radarObject; @@ -754,10 +754,10 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D Object *obj = radarObject->friend_getObject(); // sanity - if( obj == NULL ) + if( obj == nullptr ) { - DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - NULL object encountered in list" )); + DEBUG_CRASH(( "Radar::searchListForRadarLocationMatch - null object encountered in list" )); continue; } @@ -775,7 +775,7 @@ Object *Radar::searchListForRadarLocationMatch( RadarObject *listHead, ICoord2D } // no match found - return NULL; + return nullptr; } @@ -907,7 +907,7 @@ void Radar::createEvent( const Coord3D *world, RadarEventType type, Real seconds { // sanity - if( world == NULL ) + if( world == nullptr ) return; // lookup the colors we are to used based on the event @@ -952,7 +952,7 @@ void Radar::createPlayerEvent( Player *player, const Coord3D *world, { // sanity - if( player == NULL || world == NULL ) + if( player == nullptr || world == nullptr ) return; // figure out the two colors we should use @@ -995,7 +995,7 @@ void Radar::internalCreateEvent( const Coord3D *world, RadarEventType type, Real static Real secondsBeforeDieToFade = 0.5f; ///< this many seconds before we hit the die frame we start to fade away // sanity - if( world == NULL || color1 == NULL || color2 == NULL ) + if( world == nullptr || color1 == nullptr || color2 == nullptr ) return; // translate the world coord to radar coords @@ -1060,7 +1060,7 @@ void Radar::tryUnderAttackEvent( const Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // try to create the event @@ -1183,7 +1183,7 @@ Bool Radar::tryEvent( RadarEventType event, const Coord3D *pos ) { // sanity - if( event <= RADAR_EVENT_INVALID || event >= RADAR_EVENT_NUM_EVENTS || pos == NULL ) + if( event <= RADAR_EVENT_INVALID || event >= RADAR_EVENT_NUM_EVENTS || pos == nullptr ) return FALSE; // see if there was an event of this type within the given range within the given time @@ -1277,7 +1277,7 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) RadarObject *radarObject; // sanity - DEBUG_ASSERTCRASH( head != NULL, ("xferRadarObjectList - Invalid parameters" )); + DEBUG_ASSERTCRASH( head != nullptr, ("xferRadarObjectList - Invalid parameters" )); // version XferVersion currentVersion = 1; @@ -1308,7 +1308,7 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) { // the list should be empty at this point as we are loading it as a whole - if( *head != NULL ) + if( *head != nullptr ) { #if 1 // srj sez: yeah, it SHOULD be, but a few rogue things come into existence (via their ctor) preloaded @@ -1318,12 +1318,12 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) { if (!radarObject->friend_getObject()->isDestroyed()) { - DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, or contain only destroyed objects" )); + DEBUG_CRASH(( "xferRadarObjectList - List head should be null, or contain only destroyed objects" )); throw SC_INVALID_DATA; } } #else - DEBUG_CRASH(( "xferRadarObjectList - List head should be NULL, but isn't" )); + DEBUG_CRASH(( "xferRadarObjectList - List head should be null, but isn't" )); throw SC_INVALID_DATA; #endif } @@ -1336,13 +1336,13 @@ static void xferRadarObjectList( Xfer *xfer, RadarObject **head ) radarObject = newInstance(RadarObject); // link to the end of the list - if( *head == NULL ) + if( *head == nullptr ) *head = radarObject; else { RadarObject *other; - for( other = *head; other->friend_getNext() != NULL; other = other->friend_getNext() ) + for( other = *head; other->friend_getNext() != nullptr; other = other->friend_getNext() ) { } @@ -1413,10 +1413,10 @@ void Radar::xfer( Xfer *xfer ) // Transfer all local hero objects to local object list. RadarObject **fromList = &m_localHeroObjectList; RadarObject **toList = &m_localObjectList; - while (*fromList != NULL) + while (*fromList != nullptr) { RadarObject* nextObject = (*fromList)->friend_getNext(); - (*fromList)->friend_setNext(NULL); + (*fromList)->friend_setNext(nullptr); linkRadarObject(*fromList, toList); *fromList = nextObject; } @@ -1443,13 +1443,13 @@ void Radar::xfer( Xfer *xfer ) RadarObject *currObject; RadarObject *prevObject; RadarObject *nextObject; - prevObject = NULL; - for (currObject = *fromList; currObject != NULL; currObject = nextObject) + prevObject = nullptr; + for (currObject = *fromList; currObject != nullptr; currObject = nextObject) { nextObject = currObject->friend_getNext(); if (currObject->friend_getObject()->isHero()) { - if (prevObject != NULL) + if (prevObject != nullptr) { prevObject->friend_setNext(nextObject); } @@ -1457,7 +1457,7 @@ void Radar::xfer( Xfer *xfer ) { *fromList = nextObject; } - currObject->friend_setNext(NULL); + currObject->friend_setNext(nullptr); linkRadarObject(currObject, toList); continue; } @@ -1540,7 +1540,7 @@ Bool Radar::isPriorityVisible( RadarPriorityType priority ) // ------------------------------------------------------------------------------------------------ void Radar::linkRadarObject( RadarObject *newObj, RadarObject **list ) { - if( *list == NULL ) + if( *list == nullptr ) { // trivial case, an empty list *list = newObj; @@ -1554,9 +1554,9 @@ void Radar::linkRadarObject( RadarObject *newObj, RadarObject **list ) RadarObject *prevObject; RadarObject *nextObject; - DEBUG_ASSERTCRASH(newObj->friend_getNext() == NULL, ("newObj->friend_getNext is not NULL")); + DEBUG_ASSERTCRASH(newObj->friend_getNext() == nullptr, ("newObj->friend_getNext is not null")); - prevObject = NULL; + prevObject = nullptr; prevPriority = RADAR_PRIORITY_INVALID; for( currObject = *list; currObject; currObject = nextObject ) { @@ -1571,7 +1571,7 @@ void Radar::linkRadarObject( RadarObject *newObj, RadarObject **list ) // our new priority, and the current object in the list has a priority // higher than our equal to our own we need to be inserted here // - if( (prevObject == NULL || prevPriority < newPriority ) && (currPriority >= newPriority) ) + if( (prevObject == nullptr || prevPriority < newPriority ) && (currPriority >= newPriority) ) { // insert into the list just ahead of currObject if( prevObject ) @@ -1592,7 +1592,7 @@ void Radar::linkRadarObject( RadarObject *newObj, RadarObject **list ) } break; } - else if( nextObject == NULL ) + else if( nextObject == nullptr ) { // at the end of the list, put object here currObject->friend_setNext( newObj ); @@ -1644,7 +1644,7 @@ void Radar::assignObjectColorToRadarObject( RadarObject *radarObj, Object *obj ) useIndicatorColor = false; } - if( useIndicatorColor || (player == NULL) ) + if( useIndicatorColor || (player == nullptr) ) { radarObj->setColor( obj->getIndicatorColor() ); } diff --git a/Core/GameEngine/Source/Common/System/StreamingArchiveFile.cpp b/Core/GameEngine/Source/Common/System/StreamingArchiveFile.cpp index 1fc9f43b2ea..958ef2a3a2b 100644 --- a/Core/GameEngine/Source/Common/System/StreamingArchiveFile.cpp +++ b/Core/GameEngine/Source/Common/System/StreamingArchiveFile.cpp @@ -102,7 +102,7 @@ //================================================================= StreamingArchiveFile::StreamingArchiveFile() -: m_file(NULL), +: m_file(nullptr), m_startingPos(0), m_size(0), m_curPos(0) @@ -140,12 +140,12 @@ Bool StreamingArchiveFile::open( const Char *filename, Int access, size_t buffer //USE_PERF_TIMER(StreamingArchiveFile) File *file = TheFileSystem->openFile( filename, access, bufferSize ); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } - return (open( file ) != NULL); + return open( file ); } //============================================================================ @@ -163,7 +163,7 @@ Bool StreamingArchiveFile::open( File *file ) Bool StreamingArchiveFile::openFromArchive(File *archiveFile, const AsciiString& filename, Int offset, Int size) { //USE_PERF_TIMER(StreamingArchiveFile) - if (archiveFile == NULL) { + if (archiveFile == nullptr) { return FALSE; } diff --git a/Core/GameEngine/Source/Common/System/UnicodeString.cpp b/Core/GameEngine/Source/Common/System/UnicodeString.cpp index af1a6317e3f..64c509f7dde 100644 --- a/Core/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/Core/GameEngine/Source/Common/System/UnicodeString.cpp @@ -95,7 +95,7 @@ void UnicodeString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveDa return; } - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("UnicodeString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(UnicodeStringData) + numCharsNeeded*sizeof(WideChar); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); @@ -141,27 +141,27 @@ void UnicodeString::releaseBuffer() { TheDynamicMemoryAllocator->freeBytes(m_data); } - m_data = 0; + m_data = nullptr; } } // ----------------------------------------------------- -UnicodeString::UnicodeString(const WideChar* s) : m_data(NULL) +UnicodeString::UnicodeString(const WideChar* s) : m_data(nullptr) { int len = s ? (int)wcslen(s) : 0; if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } validate(); } // ----------------------------------------------------- -UnicodeString::UnicodeString(const WideChar* s, int len) : m_data(NULL) +UnicodeString::UnicodeString(const WideChar* s, int len) : m_data(nullptr) { if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } validate(); } @@ -197,7 +197,7 @@ void UnicodeString::set(const WideChar* s, int len) { if (len > 0) { - ensureUniqueBufferOfSize(len + 1, false, s, NULL); + ensureUniqueBufferOfSize(len + 1, false, s, nullptr); } else { @@ -212,7 +212,7 @@ WideChar* UnicodeString::getBufferForRead(Int len) { validate(); DEBUG_ASSERTCRASH(len>0, ("No need to allocate 0 len strings.")); - ensureUniqueBufferOfSize(len + 1, false, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, false, nullptr, nullptr); validate(); return peek(); } @@ -239,7 +239,7 @@ void UnicodeString::concat(const WideChar* s) if (m_data) { - ensureUniqueBufferOfSize(getLength() + addlen + 1, true, NULL, s); + ensureUniqueBufferOfSize(getLength() + addlen + 1, true, nullptr, s); } else { @@ -333,7 +333,7 @@ void UnicodeString::truncateBy(const Int charCount) const size_t len = wcslen(peek()); if (len > 0) { - ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, nullptr, nullptr); size_t count = charCount; if (charCount > len) { @@ -354,7 +354,7 @@ void UnicodeString::truncateTo(const Int maxLength) const size_t len = wcslen(peek()); if (len > maxLength) { - ensureUniqueBufferOfSize(len + 1, true, NULL, NULL); + ensureUniqueBufferOfSize(len + 1, true, nullptr, nullptr); peek()[maxLength] = 0; } } diff --git a/Core/GameEngine/Source/Common/System/Xfer.cpp b/Core/GameEngine/Source/Common/System/Xfer.cpp index 4427a7dd0a7..205504a19be 100644 --- a/Core/GameEngine/Source/Common/System/Xfer.cpp +++ b/Core/GameEngine/Source/Common/System/Xfer.cpp @@ -496,7 +496,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData ) { // sanity - if( intListData == NULL ) + if( intListData == nullptr ) return; // version @@ -562,7 +562,7 @@ void Xfer::xferScienceType( ScienceType *science ) { // sanity - DEBUG_ASSERTCRASH( science != NULL, ("xferScienceType - Invalid parameters") ); + DEBUG_ASSERTCRASH( science != nullptr, ("xferScienceType - Invalid parameters") ); AsciiString scienceName; @@ -611,7 +611,7 @@ void Xfer::xferScienceVec( ScienceVec *scienceVec ) { // sanity - DEBUG_ASSERTCRASH( scienceVec != NULL, ("xferScienceVec - Invalid parameters") ); + DEBUG_ASSERTCRASH( scienceVec != nullptr, ("xferScienceVec - Invalid parameters") ); // this deserves a version number const XferVersion currentVersion = 1; @@ -792,7 +792,7 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) // find this upgrade template upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); - if( upgradeTemplate == NULL ) + if( upgradeTemplate == nullptr ) { DEBUG_CRASH(( "Xfer::xferUpgradeMask - Unknown upgrade '%s'", upgradeName.str() )); diff --git a/Core/GameEngine/Source/Common/System/XferCRC.cpp b/Core/GameEngine/Source/Common/System/XferCRC.cpp index 520cd2cc4fc..2db597097d2 100644 --- a/Core/GameEngine/Source/Common/System/XferCRC.cpp +++ b/Core/GameEngine/Source/Common/System/XferCRC.cpp @@ -105,7 +105,7 @@ void XferCRC::addCRC( UnsignedInt val ) void XferCRC::xferSnapshot( Snapshot *snapshot ) { - if( snapshot == NULL ) + if( snapshot == nullptr ) { return; @@ -123,7 +123,7 @@ void XferCRC::xferSnapshot( Snapshot *snapshot ) void XferCRC::xferImplementation( void *data, Int dataSize ) { const UnsignedInt *uintPtr = (const UnsignedInt *) (data); - dataSize *= (data != NULL); + dataSize *= (data != nullptr); int dataBytes = (dataSize / 4); @@ -176,7 +176,7 @@ XferDeepCRC::XferDeepCRC( void ) { m_xferMode = XFER_SAVE; - m_fileFP = NULL; + m_fileFP = nullptr; } @@ -186,7 +186,7 @@ XferDeepCRC::~XferDeepCRC( void ) { // warn the user if a file was left open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); @@ -205,7 +205,7 @@ void XferDeepCRC::open( AsciiString identifier ) m_xferMode = XFER_SAVE; // sanity, check to see if we're already open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open", @@ -219,7 +219,7 @@ void XferDeepCRC::open( AsciiString identifier ) // open the file m_fileFP = fopen( identifier.str(), "w+b" ); - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "File '%s' not found", identifier.str() )); @@ -239,7 +239,7 @@ void XferDeepCRC::close( void ) { // sanity, if we don't have an open file we can do nothing - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "Xfer close called, but no file was open" )); @@ -249,7 +249,7 @@ void XferDeepCRC::close( void ) // close the file fclose( m_fileFP ); - m_fileFP = NULL; + m_fileFP = nullptr; // erase the filename m_identifier.clear(); @@ -268,7 +268,7 @@ void XferDeepCRC::xferImplementation( void *data, Int dataSize ) } // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferSave - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is null", m_identifier.str()) ); // write data to file diff --git a/Core/GameEngine/Source/Common/System/XferLoad.cpp b/Core/GameEngine/Source/Common/System/XferLoad.cpp index 9b1f1981b3c..8db6b24eb71 100644 --- a/Core/GameEngine/Source/Common/System/XferLoad.cpp +++ b/Core/GameEngine/Source/Common/System/XferLoad.cpp @@ -40,7 +40,7 @@ XferLoad::XferLoad( void ) { m_xferMode = XFER_LOAD; - m_fileFP = NULL; + m_fileFP = nullptr; } @@ -50,7 +50,7 @@ XferLoad::~XferLoad( void ) { // warn the user if a file was left open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); @@ -67,7 +67,7 @@ void XferLoad::open( AsciiString identifier ) { // sanity, check to see if we're already open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open", @@ -81,7 +81,7 @@ void XferLoad::open( AsciiString identifier ) // open the file m_fileFP = fopen( identifier.str(), "rb" ); - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "File '%s' not found", identifier.str() )); @@ -98,7 +98,7 @@ void XferLoad::close( void ) { // sanity, if we don't have an open file we can do nothing - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "Xfer close called, but no file was open" )); @@ -108,7 +108,7 @@ void XferLoad::close( void ) // close the file fclose( m_fileFP ); - m_fileFP = NULL; + m_fileFP = nullptr; // erase the filename m_identifier.clear(); @@ -122,7 +122,7 @@ Int XferLoad::beginBlock( void ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("Xfer begin block - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer begin block - file pointer for '%s' is null", m_identifier.str()) ); // read block size @@ -155,7 +155,7 @@ void XferLoad::skip( Int dataSize ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad::skip - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferLoad::skip - file pointer for '%s' is null", m_identifier.str()) ); // sanity @@ -174,7 +174,7 @@ void XferLoad::skip( Int dataSize ) void XferLoad::xferSnapshot( Snapshot *snapshot ) { - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_CRASH(( "XferLoad::xferSnapshot - Invalid parameters" )); @@ -244,7 +244,7 @@ void XferLoad::xferImplementation( void *data, Int dataSize ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferLoad - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferLoad - file pointer for '%s' is null", m_identifier.str()) ); // read data from file diff --git a/Core/GameEngine/Source/Common/System/XferSave.cpp b/Core/GameEngine/Source/Common/System/XferSave.cpp index 292cb6c8838..cb87191ad96 100644 --- a/Core/GameEngine/Source/Common/System/XferSave.cpp +++ b/Core/GameEngine/Source/Common/System/XferSave.cpp @@ -56,8 +56,8 @@ XferSave::XferSave( void ) { m_xferMode = XFER_SAVE; - m_fileFP = NULL; - m_blockStack = NULL; + m_fileFP = nullptr; + m_blockStack = nullptr; } @@ -67,7 +67,7 @@ XferSave::~XferSave( void ) { // warn the user if a file was left open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Warning: Xfer file '%s' was left open", m_identifier.str() )); @@ -79,11 +79,11 @@ XferSave::~XferSave( void ) // the block stack should be empty, if it's not that means we started blocks but never // called enough matching end blocks // - if( m_blockStack != NULL ) + if( m_blockStack != nullptr ) { // tell the user there is an error - DEBUG_CRASH(( "Warning: XferSave::~XferSave - m_blockStack was not NULL!" )); + DEBUG_CRASH(( "Warning: XferSave::~XferSave - m_blockStack was not null!" )); // delete the block stack XferBlockData *next; @@ -107,7 +107,7 @@ void XferSave::open( AsciiString identifier ) { // sanity, check to see if we're already open - if( m_fileFP != NULL ) + if( m_fileFP != nullptr ) { DEBUG_CRASH(( "Cannot open file '%s' cause we've already got '%s' open", @@ -121,7 +121,7 @@ void XferSave::open( AsciiString identifier ) // open the file m_fileFP = fopen( identifier.str(), "w+b" ); - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "File '%s' not found", identifier.str() )); @@ -138,7 +138,7 @@ void XferSave::close( void ) { // sanity, if we don't have an open file we can do nothing - if( m_fileFP == NULL ) + if( m_fileFP == nullptr ) { DEBUG_CRASH(( "Xfer close called, but no file was open" )); @@ -148,7 +148,7 @@ void XferSave::close( void ) // close the file fclose( m_fileFP ); - m_fileFP = NULL; + m_fileFP = nullptr; // erase the filename m_identifier.clear(); @@ -166,7 +166,7 @@ Int XferSave::beginBlock( void ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("Xfer begin block - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer begin block - file pointer for '%s' is null", m_identifier.str()) ); // get the current file position so we can back up here for the next end block call @@ -186,7 +186,7 @@ Int XferSave::beginBlock( void ) // save this block position on the top of the "stack" XferBlockData *top = newInstance(XferBlockData); // impossible -- exception will be thrown (srj) -// if( top == NULL ) +// if( top == nullptr ) // { // // DEBUG_CRASH(( "XferSave - Begin block, out of memory - can't save block stack data" )); @@ -211,11 +211,11 @@ void XferSave::endBlock( void ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("Xfer end block - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("Xfer end block - file pointer for '%s' is null", m_identifier.str()) ); // sanity, make sure we have a block started - if( m_blockStack == NULL ) + if( m_blockStack == nullptr ) { DEBUG_CRASH(( "Xfer end block called, but no matching begin block was found" )); @@ -258,7 +258,7 @@ void XferSave::skip( Int dataSize ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferSave - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is null", m_identifier.str()) ); @@ -273,7 +273,7 @@ void XferSave::skip( Int dataSize ) void XferSave::xferSnapshot( Snapshot *snapshot ) { - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_CRASH(( "XferSave::xferSnapshot - Invalid parameters" )); @@ -343,7 +343,7 @@ void XferSave::xferImplementation( void *data, Int dataSize ) { // sanity - DEBUG_ASSERTCRASH( m_fileFP != NULL, ("XferSave - file pointer for '%s' is NULL", + DEBUG_ASSERTCRASH( m_fileFP != nullptr, ("XferSave - file pointer for '%s' is null", m_identifier.str()) ); // write data to file diff --git a/Core/GameEngine/Source/Common/WorkerProcess.cpp b/Core/GameEngine/Source/Common/WorkerProcess.cpp index 5970225a383..0aaae1842a7 100644 --- a/Core/GameEngine/Source/Common/WorkerProcess.cpp +++ b/Core/GameEngine/Source/Common/WorkerProcess.cpp @@ -67,9 +67,9 @@ static PFN_AssignProcessToJobObject AssignProcessToJobObject = (PFN_AssignProces WorkerProcess::WorkerProcess() { - m_processHandle = NULL; - m_readHandle = NULL; - m_jobHandle = NULL; + m_processHandle = nullptr; + m_readHandle = nullptr; + m_jobHandle = nullptr; m_exitcode = 0; m_isDone = false; } @@ -82,7 +82,7 @@ bool WorkerProcess::startProcess(UnicodeString command) // Create pipe for reading console output SECURITY_ATTRIBUTES saAttr = { sizeof(SECURITY_ATTRIBUTES) }; saAttr.bInheritHandle = TRUE; - HANDLE writeHandle = NULL; + HANDLE writeHandle = nullptr; if (!CreatePipe(&m_readHandle, &writeHandle, &saAttr, 0)) return false; SetHandleInformation(m_readHandle, HANDLE_FLAG_INHERIT, 0); @@ -93,15 +93,15 @@ bool WorkerProcess::startProcess(UnicodeString command) si.hStdError = writeHandle; si.hStdOutput = writeHandle; - PROCESS_INFORMATION pi = { 0 }; + PROCESS_INFORMATION pi = { nullptr }; - if (!CreateProcessW(NULL, (LPWSTR)command.str(), - NULL, NULL, /*bInheritHandles=*/TRUE, 0, - NULL, 0, &si, &pi)) + if (!CreateProcessW(nullptr, (LPWSTR)command.str(), + nullptr, nullptr, /*bInheritHandles=*/TRUE, 0, + nullptr, nullptr, &si, &pi)) { CloseHandle(writeHandle); CloseHandle(m_readHandle); - m_readHandle = NULL; + m_readHandle = nullptr; return false; } @@ -111,8 +111,8 @@ bool WorkerProcess::startProcess(UnicodeString command) // We want to make sure that when our process is killed, our workers automatically terminate as well. // In Windows, the way to do this is to attach the worker to a job we own. - m_jobHandle = CreateJobObjectW != NULL ? CreateJobObjectW(NULL, NULL) : NULL; - if (m_jobHandle != NULL) + m_jobHandle = CreateJobObjectW != nullptr ? CreateJobObjectW(nullptr, nullptr) : nullptr; + if (m_jobHandle != nullptr) { JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo = { 0 }; jobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; @@ -125,7 +125,7 @@ bool WorkerProcess::startProcess(UnicodeString command) bool WorkerProcess::isRunning() const { - return m_processHandle != NULL; + return m_processHandle != nullptr; } bool WorkerProcess::isDone() const @@ -149,8 +149,8 @@ bool WorkerProcess::fetchStdOutput() { // Call PeekNamedPipe to make sure ReadFile won't block DWORD bytesAvailable = 0; - DEBUG_ASSERTCRASH(m_readHandle != NULL, ("Is not expected NULL")); - BOOL success = PeekNamedPipe(m_readHandle, NULL, 0, NULL, &bytesAvailable, NULL); + DEBUG_ASSERTCRASH(m_readHandle != nullptr, ("Is not expected null")); + BOOL success = PeekNamedPipe(m_readHandle, nullptr, 0, nullptr, &bytesAvailable, nullptr); if (!success) return true; if (bytesAvailable == 0) @@ -161,7 +161,7 @@ bool WorkerProcess::fetchStdOutput() DWORD readBytes = 0; char buffer[1024]; - success = ReadFile(m_readHandle, buffer, ARRAY_SIZE(buffer)-1, &readBytes, NULL); + success = ReadFile(m_readHandle, buffer, ARRAY_SIZE(buffer)-1, &readBytes, nullptr); if (!success) return true; DEBUG_ASSERTCRASH(readBytes != 0, ("expected readBytes to be non null")); @@ -190,13 +190,13 @@ void WorkerProcess::update() WaitForSingleObject(m_processHandle, INFINITE); GetExitCodeProcess(m_processHandle, &m_exitcode); CloseHandle(m_processHandle); - m_processHandle = NULL; + m_processHandle = nullptr; CloseHandle(m_readHandle); - m_readHandle = NULL; + m_readHandle = nullptr; CloseHandle(m_jobHandle); - m_jobHandle = NULL; + m_jobHandle = nullptr; m_isDone = true; } @@ -206,23 +206,23 @@ void WorkerProcess::kill() if (!isRunning()) return; - if (m_processHandle != NULL) + if (m_processHandle != nullptr) { TerminateProcess(m_processHandle, 1); CloseHandle(m_processHandle); - m_processHandle = NULL; + m_processHandle = nullptr; } - if (m_readHandle != NULL) + if (m_readHandle != nullptr) { CloseHandle(m_readHandle); - m_readHandle = NULL; + m_readHandle = nullptr; } - if (m_jobHandle != NULL) + if (m_jobHandle != nullptr) { CloseHandle(m_jobHandle); - m_jobHandle = NULL; + m_jobHandle = nullptr; } m_stdOutput.clear(); diff --git a/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp b/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp index 0bbbfde983e..d1578af7c7f 100644 --- a/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp +++ b/Core/GameEngine/Source/GameClient/GUI/WindowVideoManager.cpp @@ -82,9 +82,9 @@ WindowVideo::WindowVideo( void ) { m_playType = WINDOW_PLAY_MOVIE_ONCE; - m_win = NULL; - m_videoBuffer = NULL; - m_videoStream = NULL; + m_win = nullptr; + m_videoBuffer = nullptr; + m_videoStream = nullptr; m_movieName.clear(); m_state = WINDOW_VIDEO_STATE_STOP; @@ -92,18 +92,18 @@ WindowVideo::WindowVideo( void ) WindowVideo::~WindowVideo( void ) { - // Don't Delete the window, only set it's video buffer to NULL + // Don't Delete the window, only set it's video buffer to null if(m_win) - m_win->winGetInstanceData()->setVideoBuffer( NULL ); - m_win = NULL; + m_win->winGetInstanceData()->setVideoBuffer( nullptr ); + m_win = nullptr; delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } } @@ -126,7 +126,7 @@ void WindowVideo::setWindowState( WindowVideoStates state ) m_state = state; if(m_state == WINDOW_VIDEO_STATE_STOP && m_win) - m_win->winGetInstanceData()->setVideoBuffer( NULL ); + m_win->winGetInstanceData()->setVideoBuffer( nullptr ); if((m_state == WINDOW_VIDEO_STATE_PLAY || m_state == WINDOW_VIDEO_STATE_PAUSE )&& m_win) m_win->winGetInstanceData()->setVideoBuffer( m_videoBuffer ); @@ -258,26 +258,26 @@ void WindowVideoManager::playMovie( GameWindow *win, AsciiString movieName, Wind // create the new stream VideoStreamInterface *videoStream = TheVideoPlayer->open( movieName ); - if ( videoStream == NULL ) + if ( videoStream == nullptr ) { return; } // Create the new buffer VideoBuffer *videoBuffer = TheDisplay->createVideoBuffer(); - if ( videoBuffer == NULL || + if ( videoBuffer == nullptr || !videoBuffer->allocate( videoStream->width(), videoStream->height()) ) { // If we failed to create the buffer... delete videoBuffer; - videoBuffer = NULL; + videoBuffer = nullptr; if ( videoStream ) { videoStream->close(); - videoStream = NULL; + videoStream = nullptr; } return; diff --git a/Core/GameEngine/Source/GameClient/MapUtil.cpp b/Core/GameEngine/Source/GameClient/MapUtil.cpp index a99f1cdc36f..1aab4551571 100644 --- a/Core/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Core/GameEngine/Source/GameClient/MapUtil.cpp @@ -71,10 +71,10 @@ static Int m_height = 0; ///< Height map height (y size of array). static Int m_borderSize = 0; ///< Non-playable border area. static std::vector m_boundaries; ///< All the boundaries we use for the map static Int m_dataSize = 0; ///< size of m_data. -static UnsignedByte *m_data = 0; ///< array of z(height) values in the height map. +static UnsignedByte *m_data = nullptr; ///< array of z(height) values in the height map. static Dict worldDict = 0; -static WaypointMap *m_waypoints = 0; +static WaypointMap *m_waypoints = nullptr; static Coord3DList m_supplyPositions; static Coord3DList m_techPositions; @@ -101,7 +101,7 @@ static UnsignedInt calcCRC( AsciiString fname ) } fp->close(); - fp = NULL; + fp = nullptr; return theCRC.get(); } @@ -157,7 +157,7 @@ static Bool ParseObjectDataChunk(DataChunkInput &file, DataChunkInfo *info, void static Bool ParseObjectsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData) { - file.m_currentObject = NULL; + file.m_currentObject = nullptr; file.registerParser( "Object", info->label, ParseObjectDataChunk ); return (file.parse(userData)); } @@ -233,7 +233,7 @@ static Bool loadMap( AsciiString filename ) file.registerParser( "HeightMapData", AsciiString::TheEmptyString, ParseSizeOnlyInChunk ); file.registerParser( "WorldInfo", AsciiString::TheEmptyString, ParseWorldDictDataChunk ); file.registerParser( "ObjectsList", AsciiString::TheEmptyString, ParseObjectsDataChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { throw(ERROR_CORRUPT_FILE_FORMAT); } @@ -246,10 +246,10 @@ static Bool loadMap( AsciiString filename ) static void resetMap( void ) { delete[] m_data; - m_data = NULL; + m_data = nullptr; delete m_waypoints; - m_waypoints = NULL; + m_waypoints = nullptr; m_techPositions.clear(); m_supplyPositions.clear(); @@ -338,8 +338,8 @@ void MapCache::writeCacheINI( const AsciiString &mapDir ) filepath.concat(m_mapCacheName); FILE *fp = fopen(filepath.str(), "w"); - DEBUG_ASSERTCRASH(fp != NULL, ("Failed to create %s", filepath.str())); - if (fp == NULL) { + DEBUG_ASSERTCRASH(fp != nullptr, ("Failed to create %s", filepath.str())); + if (fp == nullptr) { return; } @@ -504,7 +504,7 @@ void MapCache::loadMapsFromMapCacheINI( const AsciiString &mapDir ) if (TheFileSystem->doesFileExist(fname.str())) { - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); + ini.load( fname, INI_LOAD_OVERWRITE, nullptr ); } } @@ -712,7 +712,7 @@ Bool MapCache::addMap( return TRUE; } -MapCache *TheMapCache = NULL; +MapCache *TheMapCache = nullptr; // PUBLIC FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -744,17 +744,17 @@ static void buildMapListForNumPlayers(MapNameList &outMapNames, MapDisplayToFile struct MapListBoxData { MapListBoxData() - : listbox(NULL) + : listbox(nullptr) , numLength(0) , numColumns(0) , w(10) , h(10) , color(GameMakeColor(255, 255, 255, 255)) - , battleHonors(NULL) - , easyImage(NULL) - , mediumImage(NULL) - , brutalImage(NULL) - , maxBrutalImage(NULL) + , battleHonors(nullptr) + , easyImage(nullptr) + , mediumImage(nullptr) + , brutalImage(nullptr) + , maxBrutalImage(nullptr) , mapToSelect() , selectionIndex(0) // always select *something* , isMultiplayer(false) @@ -802,7 +802,7 @@ static Bool addMapToMapListbox( if (numBrutal) { const Int maxBrutalSlots = mapMetaData.m_numPlayers - 1; - if (lbData.maxBrutalImage != NULL && numBrutal == maxBrutalSlots) + if (lbData.maxBrutalImage != nullptr && numBrutal == maxBrutalSlots) { index = GadgetListBoxAddEntryImage( lbData.listbox, lbData.maxBrutalImage, index, 0, lbData.w, lbData.h, TRUE); imageItemData = 4; @@ -826,7 +826,7 @@ static Bool addMapToMapListbox( else { imageItemData = 0; - index = GadgetListBoxAddEntryImage( lbData.listbox, NULL, index, 0, lbData.w, lbData.h, TRUE); + index = GadgetListBoxAddEntryImage( lbData.listbox, nullptr, index, 0, lbData.w, lbData.h, TRUE); } } @@ -963,7 +963,7 @@ Int populateMapListboxNoReset( GameWindow *listbox, Bool useSystemMaps, Bool isM } delete lbData.battleHonors; - lbData.battleHonors = NULL; + lbData.battleHonors = nullptr; GadgetListBoxSetSelected(listbox, &lbData.selectionIndex, 1); @@ -1083,7 +1083,7 @@ const MapMetaData *MapCache::findMap(AsciiString mapName) mapName.toLower(); MapCache::iterator it = find(mapName); if (it == end()) - return NULL; + return nullptr; return &(it->second); } @@ -1095,7 +1095,7 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf // open the map file File *file = TheFileSystem->openFile( infile.str(), File::READ | File::BINARY ); - if( file == NULL ) + if( file == nullptr ) { DEBUG_CRASH(( "copyFromBigToDir - Error opening source file '%s'", infile.str() )); throw SC_INVALID_DATA; @@ -1110,7 +1110,7 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf // allocate buffer big enough to hold the entire map file char *buffer = NEW char[ fileSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "copyFromBigToDir - Unable to allocate buffer for file '%s'", infile.str() )); throw SC_INVALID_DATA; @@ -1142,7 +1142,7 @@ static void copyFromBigToDir( const AsciiString& infile, const AsciiString& outf Image *getMapPreviewImage( AsciiString mapName ) { if(!TheGlobalData) - return NULL; + return nullptr; DEBUG_LOG(("%s Map Name", mapName.str())); AsciiString tgaName = mapName; AsciiString name; @@ -1174,7 +1174,7 @@ Image *getMapPreviewImage( AsciiString mapName ) { if(!TheFileSystem->doesFileExist(tgaName.str())) - return NULL; + return nullptr; AsciiString mapPreviewDir; mapPreviewDir.format(MAP_PREVIEW_DIR_PATH, TheGlobalData->getPath_UserData().str()); TheFileSystem->createDirectory(mapPreviewDir); @@ -1211,7 +1211,7 @@ Image *getMapPreviewImage( AsciiString mapName ) } else { - image = NULL; + image = nullptr; } } @@ -1222,7 +1222,7 @@ Image *getMapPreviewImage( AsciiString mapName ) /* // sanity if( mapName.isEmpty() ) - return NULL; + return nullptr; Region2D uv; mapPreviewImage = TheMappedImageCollection->findImageByName("MapPreview"); if(mapPreviewImage) @@ -1255,10 +1255,10 @@ Image *getMapPreviewImage( AsciiString mapName ) if (file.isValidFileType()) { // Backwards compatible files aren't valid data chunk files. // Read the waypoints. file.registerParser( "MapPreview", AsciiString::TheEmptyString, parseMapPreviewChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { DEBUG_ASSERTCRASH(false,("Unable to read MapPreview info.")); deleteInstance(mapPreviewImage); - return NULL; + return nullptr; } } theInputStream.close(); @@ -1266,14 +1266,14 @@ Image *getMapPreviewImage( AsciiString mapName ) else { deleteInstance(mapPreviewImage); - return NULL; + return nullptr; } return mapPreviewImage; */ - return NULL; + return nullptr; } Bool parseMapPreviewChunk(DataChunkInput &file, DataChunkInfo *info, void *userData) diff --git a/Core/GameEngine/Source/GameClient/Snow.cpp b/Core/GameEngine/Source/GameClient/Snow.cpp index 46615690a76..737ac561334 100644 --- a/Core/GameEngine/Source/GameClient/Snow.cpp +++ b/Core/GameEngine/Source/GameClient/Snow.cpp @@ -32,7 +32,7 @@ #include "GameClient/View.h" -SnowManager *TheSnowManager=NULL; +SnowManager *TheSnowManager=nullptr; SnowManager::SnowManager() { @@ -93,38 +93,38 @@ void SnowManager::reset(void) SnowManager::~SnowManager() { delete [] m_startingHeights; - m_startingHeights=NULL; + m_startingHeights=nullptr; // TheSuperHackers @fix Mauller 13/04/2025 Delete the instance of the weather settings deleteInstance((WeatherSetting*)TheWeatherSetting.getNonOverloadedPointer()); - TheWeatherSetting=NULL; + TheWeatherSetting=nullptr; } -OVERRIDE TheWeatherSetting = NULL; +OVERRIDE TheWeatherSetting = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// const FieldParse WeatherSetting::m_weatherSettingFieldParseTable[] = { - { "SnowTexture", INI::parseAsciiString,NULL, offsetof( WeatherSetting, m_snowTexture ) }, - { "SnowFrequencyScaleX", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowFrequencyScaleX ) }, - { "SnowFrequencyScaleY", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowFrequencyScaleY ) }, - { "SnowAmplitude", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowAmplitude ) }, - { "SnowPointSize", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowPointSize ) }, - { "SnowMaxPointSize", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowMaxPointSize ) }, - { "SnowMinPointSize", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowMinPointSize ) }, - { "SnowQuadSize", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowQuadSize ) }, - { "SnowBoxDimensions", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowBoxDimensions ) }, - { "SnowBoxDensity", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowBoxDensity ) }, - { "SnowVelocity", INI::parseReal,NULL, offsetof( WeatherSetting, m_snowVelocity ) }, - { "SnowPointSprites", INI::parseBool,NULL, offsetof( WeatherSetting, m_usePointSprites ) }, - { "SnowEnabled", INI::parseBool,NULL, offsetof( WeatherSetting, m_snowEnabled ) }, - { 0, 0, 0, 0 }, + { "SnowTexture", INI::parseAsciiString,nullptr, offsetof( WeatherSetting, m_snowTexture ) }, + { "SnowFrequencyScaleX", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowFrequencyScaleX ) }, + { "SnowFrequencyScaleY", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowFrequencyScaleY ) }, + { "SnowAmplitude", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowAmplitude ) }, + { "SnowPointSize", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowPointSize ) }, + { "SnowMaxPointSize", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowMaxPointSize ) }, + { "SnowMinPointSize", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowMinPointSize ) }, + { "SnowQuadSize", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowQuadSize ) }, + { "SnowBoxDimensions", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowBoxDimensions ) }, + { "SnowBoxDensity", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowBoxDensity ) }, + { "SnowVelocity", INI::parseReal,nullptr, offsetof( WeatherSetting, m_snowVelocity ) }, + { "SnowPointSprites", INI::parseBool,nullptr, offsetof( WeatherSetting, m_usePointSprites ) }, + { "SnowEnabled", INI::parseBool,nullptr, offsetof( WeatherSetting, m_snowEnabled ) }, + { nullptr, nullptr, nullptr, 0 }, }; //------------------------------------------------------------------------------------------------- void INI::parseWeatherDefinition( INI *ini ) { - if (TheWeatherSetting == NULL) { + if (TheWeatherSetting == nullptr) { TheWeatherSetting = newInstance(WeatherSetting); } else if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { WeatherSetting* ws = (WeatherSetting*) (TheWeatherSetting.getNonOverloadedPointer()); diff --git a/Core/GameEngine/Source/GameClient/System/Debug/AudioDebugDisplay.cpp b/Core/GameEngine/Source/GameClient/System/Debug/AudioDebugDisplay.cpp index 363cde812a7..9eefbefe9ae 100644 --- a/Core/GameEngine/Source/GameClient/System/Debug/AudioDebugDisplay.cpp +++ b/Core/GameEngine/Source/GameClient/System/Debug/AudioDebugDisplay.cpp @@ -106,9 +106,9 @@ static void printFunc( char *text ) //============================================================================ #if defined(RTS_DEBUG) -void AudioDebugDisplay ( DebugDisplayInterface *dd, void *, FILE *fp = NULL ) +void AudioDebugDisplay ( DebugDisplayInterface *dd, void *, FILE *fp = nullptr ) { - TheAudio->audioDebugDisplay( dd, NULL, fp ); + TheAudio->audioDebugDisplay( dd, nullptr, fp ); } #endif diff --git a/Core/GameEngine/Source/GameClient/System/Smudge.cpp b/Core/GameEngine/Source/GameClient/System/Smudge.cpp index 62b40b491f8..5c6cfc05fbb 100644 --- a/Core/GameEngine/Source/GameClient/System/Smudge.cpp +++ b/Core/GameEngine/Source/GameClient/System/Smudge.cpp @@ -46,14 +46,14 @@ SmudgeManager::~SmudgeManager() SmudgeSet* head; //free memory used by smudge sets - while ((head = m_freeSmudgeSetList.Head ()) != NULL) { + while ((head = m_freeSmudgeSetList.Head ()) != nullptr) { m_freeSmudgeSetList.Remove_Head (); delete head; } Smudge* head2; //free memory used by smudges - while ((head2 = SmudgeSet::m_freeSmudgeList.Head ()) != NULL) { + while ((head2 = SmudgeSet::m_freeSmudgeList.Head ()) != nullptr) { m_freeSmudgeSetList.Remove_Head (); delete head2; } @@ -69,7 +69,7 @@ void SmudgeManager::reset(void) SmudgeSet* head; //Return all smudgeSets back to free pool. - while ((head = m_usedSmudgeSetList.Head ()) != NULL) { + while ((head = m_usedSmudgeSetList.Head ()) != nullptr) { m_usedSmudgeSetList.Remove_Head (); head->reset(); //free all smudges. m_freeSmudgeSetList.Add_Tail(head); @@ -109,7 +109,7 @@ void SmudgeSet::reset(void) { Smudge* head; - while ((head = m_usedSmudgeList.Head ()) != NULL) { + while ((head = m_usedSmudgeList.Head ()) != nullptr) { m_usedSmudgeList.Remove_Head (); m_freeSmudgeList.Add_Head(head); //add to free list } diff --git a/Core/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp b/Core/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp index ceae1abd30e..bcc12bc8c6e 100644 --- a/Core/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp +++ b/Core/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp @@ -35,7 +35,7 @@ #include "GameClient/TerrainRoads.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -TerrainRoadCollection *TheTerrainRoads = NULL; +TerrainRoadCollection *TheTerrainRoads = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// UnsignedInt TerrainRoadCollection::m_idCounter = 0; @@ -45,11 +45,11 @@ UnsignedInt TerrainRoadCollection::m_idCounter = 0; const FieldParse TerrainRoadType::m_terrainRoadFieldParseTable[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_texture ) }, - { "RoadWidth", INI::parseReal, NULL, offsetof( TerrainRoadType, m_roadWidth ) }, - { "RoadWidthInTexture", INI::parseReal, NULL, offsetof( TerrainRoadType, m_roadWidthInTexture ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_texture ) }, + { "RoadWidth", INI::parseReal, nullptr, offsetof( TerrainRoadType, m_roadWidth ) }, + { "RoadWidthInTexture", INI::parseReal, nullptr, offsetof( TerrainRoadType, m_roadWidthInTexture ) }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; @@ -58,35 +58,35 @@ const FieldParse TerrainRoadType::m_terrainRoadFieldParseTable[] = const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] = { - { "BridgeScale", INI::parseReal, NULL, offsetof( TerrainRoadType, m_bridgeScale ) }, - { "ScaffoldObjectName", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_scaffoldObjectName ) }, - { "ScaffoldSupportObjectName", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_scaffoldSupportObjectName ) }, - { "RadarColor", INI::parseRGBColor, NULL, offsetof( TerrainRoadType, m_radarColor ) }, + { "BridgeScale", INI::parseReal, nullptr, offsetof( TerrainRoadType, m_bridgeScale ) }, + { "ScaffoldObjectName", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_scaffoldObjectName ) }, + { "ScaffoldSupportObjectName", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_scaffoldSupportObjectName ) }, + { "RadarColor", INI::parseRGBColor, nullptr, offsetof( TerrainRoadType, m_radarColor ) }, - { "TransitionEffectsHeight", INI::parseReal, NULL, offsetof( TerrainRoadType, m_transitionEffectsHeight ) }, - { "NumFXPerType", INI::parseInt, NULL, offsetof( TerrainRoadType, m_numFXPerType ) }, + { "TransitionEffectsHeight", INI::parseReal, nullptr, offsetof( TerrainRoadType, m_transitionEffectsHeight ) }, + { "NumFXPerType", INI::parseInt, nullptr, offsetof( TerrainRoadType, m_numFXPerType ) }, - { "BridgeModelName", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_bridgeModelName ) }, - { "Texture", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_texture ) }, - { "BridgeModelNameDamaged", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_bridgeModelNameDamaged ) }, - { "TextureDamaged", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_textureDamaged ) }, - { "BridgeModelNameReallyDamaged", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_bridgeModelNameReallyDamaged ) }, - { "TextureReallyDamaged", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_textureReallyDamaged ) }, - { "BridgeModelNameBroken", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_bridgeModelNameBroken ) }, - { "TextureBroken", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_textureBroken ) }, + { "BridgeModelName", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_bridgeModelName ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_texture ) }, + { "BridgeModelNameDamaged", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_bridgeModelNameDamaged ) }, + { "TextureDamaged", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_textureDamaged ) }, + { "BridgeModelNameReallyDamaged", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_bridgeModelNameReallyDamaged ) }, + { "TextureReallyDamaged", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_textureReallyDamaged ) }, + { "BridgeModelNameBroken", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_bridgeModelNameBroken ) }, + { "TextureBroken", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_textureBroken ) }, - { "TowerObjectNameFromLeft", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_FROM_LEFT ] ) }, - { "TowerObjectNameFromRight", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_FROM_RIGHT ] ) }, - { "TowerObjectNameToLeft", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_TO_LEFT ] ) }, - { "TowerObjectNameToRight", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_TO_RIGHT ] ) }, + { "TowerObjectNameFromLeft", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_FROM_LEFT ] ) }, + { "TowerObjectNameFromRight", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_FROM_RIGHT ] ) }, + { "TowerObjectNameToLeft", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_TO_LEFT ] ) }, + { "TowerObjectNameToRight", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_towerObjectName[ BRIDGE_TOWER_TO_RIGHT ] ) }, - { "DamagedToSound", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_damageToSoundString[ BODY_DAMAGED ] ) }, - { "RepairedToSound", INI::parseAsciiString, NULL, offsetof( TerrainRoadType, m_repairedToSoundString[ BODY_DAMAGED ] ) }, - { "TransitionToOCL", parseTransitionToOCL, NULL, NULL }, - { "TransitionToFX", parseTransitionToFX, NULL, NULL }, + { "DamagedToSound", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_damageToSoundString[ BODY_DAMAGED ] ) }, + { "RepairedToSound", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_repairedToSoundString[ BODY_DAMAGED ] ) }, + { "TransitionToOCL", parseTransitionToOCL, nullptr, 0 }, + { "TransitionToFX", parseTransitionToFX, nullptr, 0 }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; @@ -209,7 +209,7 @@ TerrainRoadType::TerrainRoadType( void ) m_isBridge = FALSE; m_id = 0; - m_next = NULL; + m_next = nullptr; m_roadWidth = 0.0f; m_roadWidthInTexture = 0.0f; m_bridgeScale = 1.0f; @@ -237,8 +237,8 @@ TerrainRoadType::~TerrainRoadType( void ) TerrainRoadCollection::TerrainRoadCollection( void ) { - m_roadList = NULL; - m_bridgeList = NULL; + m_roadList = nullptr; + m_bridgeList = nullptr; m_idCounter = 1; ///< MUST start this at 1. @@ -298,7 +298,7 @@ TerrainRoadType *TerrainRoadCollection::findRoad( AsciiString name ) } // not found - return NULL; + return nullptr; } @@ -318,7 +318,7 @@ TerrainRoadType *TerrainRoadCollection::findBridge( AsciiString name ) } // not found - return NULL; + return nullptr; } diff --git a/Core/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp b/Core/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp index 7b200f35d8c..01966f9dd76 100644 --- a/Core/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp +++ b/Core/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp @@ -36,7 +36,7 @@ // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -TerrainVisual *TheTerrainVisual = NULL; +TerrainVisual *TheTerrainVisual = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // DEFINITIONS @@ -135,7 +135,7 @@ SeismicSimulationFilterBase::SeismicSimStatusCode DomeStyleSeismicFilter::filter Int life = node->m_life; - if ( heightMap == NULL ) + if ( heightMap == nullptr ) return SEISMIC_STATUS_INVALID; diff --git a/Core/GameEngine/Source/GameClient/VideoPlayer.cpp b/Core/GameEngine/Source/GameClient/VideoPlayer.cpp index a756d3c4562..4653cc4f951 100644 --- a/Core/GameEngine/Source/GameClient/VideoPlayer.cpp +++ b/Core/GameEngine/Source/GameClient/VideoPlayer.cpp @@ -78,7 +78,7 @@ // Public Data //---------------------------------------------------------------------------- -VideoPlayerInterface *TheVideoPlayer = NULL; +VideoPlayerInterface *TheVideoPlayer = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -155,7 +155,7 @@ void VideoBuffer::free( void ) //============================================================================ VideoPlayer::VideoPlayer() -: m_firstStream(NULL) +: m_firstStream(nullptr) { } @@ -169,7 +169,7 @@ VideoPlayer::~VideoPlayer() deinit(); // Set the video player to null if its us. (WB requires this.) if (this == TheVideoPlayer) { - TheVideoPlayer = NULL; + TheVideoPlayer = nullptr; } } @@ -182,8 +182,8 @@ void VideoPlayer::init( void ) // Load this here so that WB doesn't have to link to BinkLib, costing us (potentially) // an extra license. INI ini; - ini.loadFileDirectory( "Data\\INI\\Default\\Video", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Video", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Video", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Video", INI_LOAD_OVERWRITE, nullptr ); } //============================================================================ @@ -244,7 +244,7 @@ void VideoPlayer::regainFocus( void ) VideoStreamInterface* VideoPlayer::open( AsciiString movieTitle ) { - return NULL; + return nullptr; } //============================================================================ @@ -253,7 +253,7 @@ VideoStreamInterface* VideoPlayer::open( AsciiString movieTitle ) VideoStreamInterface* VideoPlayer::load( AsciiString movieTitle ) { - return NULL; + return nullptr; } //============================================================================ @@ -273,7 +273,7 @@ void VideoPlayer::closeAllStreams( void ) { VideoStreamInterface *stream ; - while ( (stream = firstStream()) != 0 ) + while ( (stream = firstStream()) != nullptr ) { stream->close(); } @@ -285,10 +285,10 @@ void VideoPlayer::closeAllStreams( void ) void VideoPlayer::remove( VideoStream *stream_to_remove ) { - VideoStream *last = NULL; + VideoStream *last = nullptr; VideoStream *stream = (VideoStream*) firstStream(); - while ( stream != NULL && stream != stream_to_remove ) + while ( stream != nullptr && stream != stream_to_remove ) { last = stream; stream = (VideoStream*) stream->next(); @@ -354,7 +354,7 @@ const Video* VideoPlayer::getVideo( AsciiString movieTitle ) return &(*it); } } - return NULL; + return nullptr; } //============================================================================ @@ -363,7 +363,7 @@ const Video* VideoPlayer::getVideo( AsciiString movieTitle ) const Video* VideoPlayer::getVideo( Int index ) { if (index < 0 || index >= mVideosAvailableForPlay.size()) { - return NULL; + return nullptr; } return &mVideosAvailableForPlay[index]; @@ -374,8 +374,8 @@ const Video* VideoPlayer::getVideo( Int index ) //============================================================================ VideoStream::VideoStream() -: m_next(NULL), - m_player(NULL) +: m_next(nullptr), + m_player(nullptr) { } @@ -390,7 +390,7 @@ VideoStream::~VideoStream() if ( m_player ) { m_player->remove( this ); - m_player = NULL; + m_player = nullptr; } } @@ -505,8 +505,8 @@ Int VideoStream::width( void ) const FieldParse VideoPlayer::m_videoFieldParseTable[] = { - { "Filename", INI::parseAsciiString, NULL, offsetof( Video, m_filename) }, - { "Comment", INI::parseAsciiString, NULL, offsetof( Video, m_commentForWB) }, - { NULL, NULL, NULL, 0 }, + { "Filename", INI::parseAsciiString, nullptr, offsetof( Video, m_filename) }, + { "Comment", INI::parseAsciiString, nullptr, offsetof( Video, m_commentForWB) }, + { nullptr, nullptr, nullptr, 0 }, }; diff --git a/Core/GameEngine/Source/GameClient/View.cpp b/Core/GameEngine/Source/GameClient/View.cpp index 97945602086..d529ff7255e 100644 --- a/Core/GameEngine/Source/GameClient/View.cpp +++ b/Core/GameEngine/Source/GameClient/View.cpp @@ -36,7 +36,7 @@ UnsignedInt View::m_idNext = 1; // the tactical view singleton -View *TheTacticalView = NULL; +View *TheTacticalView = nullptr; View::View( void ) @@ -49,7 +49,7 @@ View::View( void ) m_lockDist = 0.0f; m_maxHeightAboveGround = 0.0f; m_minHeightAboveGround = 0.0f; - m_next = NULL; + m_next = nullptr; m_okToAdjustHeight = TRUE; m_originX = 0; m_originY = 0; @@ -63,7 +63,7 @@ View::View( void ) m_angle = 0.0f; m_pitchAngle = 0.0f; m_cameraLock = INVALID_ID; - m_cameraLockDrawable = NULL; + m_cameraLockDrawable = nullptr; m_zoomLimited = TRUE; // create unique view ID @@ -92,7 +92,7 @@ void View::init( void ) m_pos.y = 0; m_angle = 0.0f; m_cameraLock = INVALID_ID; - m_cameraLockDrawable = NULL; + m_cameraLockDrawable = nullptr; m_zoomLimited = TRUE; m_zoom = 1.0f; @@ -235,7 +235,7 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, Int viewHeight = getHeight(); // sanity - if( topLeft == NULL || topRight == NULL || bottomLeft == NULL || bottomRight == NULL ) + if( topLeft == nullptr || topRight == nullptr || bottomLeft == nullptr || bottomRight == nullptr ) return; // setup the screen coords for the 4 corners of the viewable display diff --git a/Core/GameEngine/Source/GameClient/Water.cpp b/Core/GameEngine/Source/GameClient/Water.cpp index ce17606d229..3382f11ce04 100644 --- a/Core/GameEngine/Source/GameClient/Water.cpp +++ b/Core/GameEngine/Source/GameClient/Water.cpp @@ -35,26 +35,26 @@ // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// WaterSetting WaterSettings[ TIME_OF_DAY_COUNT ]; -OVERRIDE TheWaterTransparency = NULL; +OVERRIDE TheWaterTransparency = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// const FieldParse WaterSetting::m_waterSettingFieldParseTable[] = { - { "SkyTexture", INI::parseAsciiString, NULL, offsetof( WaterSetting, m_skyTextureFile ) }, - { "WaterTexture", INI::parseAsciiString, NULL, offsetof( WaterSetting, m_waterTextureFile ) }, - { "Vertex00Color", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_vertex00Diffuse ) }, - { "Vertex10Color", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_vertex10Diffuse ) }, - { "Vertex01Color", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_vertex01Diffuse ) }, - { "Vertex11Color", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_vertex11Diffuse ) }, - { "DiffuseColor", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_waterDiffuseColor ) }, - { "TransparentDiffuseColor", INI::parseRGBAColorInt, NULL, offsetof( WaterSetting, m_transparentWaterDiffuse ) }, - { "UScrollPerMS", INI::parseReal, NULL, offsetof( WaterSetting, m_uScrollPerMs ) }, - { "VScrollPerMS", INI::parseReal, NULL, offsetof( WaterSetting, m_vScrollPerMs ) }, - { "SkyTexelsPerUnit", INI::parseReal, NULL, offsetof( WaterSetting, m_skyTexelsPerUnit ) }, - { "WaterRepeatCount", INI::parseInt, NULL, offsetof( WaterSetting, m_waterRepeatCount ) }, - - { NULL, NULL, NULL, 0 }, + { "SkyTexture", INI::parseAsciiString, nullptr, offsetof( WaterSetting, m_skyTextureFile ) }, + { "WaterTexture", INI::parseAsciiString, nullptr, offsetof( WaterSetting, m_waterTextureFile ) }, + { "Vertex00Color", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_vertex00Diffuse ) }, + { "Vertex10Color", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_vertex10Diffuse ) }, + { "Vertex01Color", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_vertex01Diffuse ) }, + { "Vertex11Color", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_vertex11Diffuse ) }, + { "DiffuseColor", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_waterDiffuseColor ) }, + { "TransparentDiffuseColor", INI::parseRGBAColorInt, nullptr, offsetof( WaterSetting, m_transparentWaterDiffuse ) }, + { "UScrollPerMS", INI::parseReal, nullptr, offsetof( WaterSetting, m_uScrollPerMs ) }, + { "VScrollPerMS", INI::parseReal, nullptr, offsetof( WaterSetting, m_vScrollPerMs ) }, + { "SkyTexelsPerUnit", INI::parseReal, nullptr, offsetof( WaterSetting, m_skyTexelsPerUnit ) }, + { "WaterRepeatCount", INI::parseInt, nullptr, offsetof( WaterSetting, m_waterRepeatCount ) }, + + { nullptr, nullptr, nullptr, 0 }, }; @@ -62,20 +62,20 @@ const FieldParse WaterSetting::m_waterSettingFieldParseTable[] = const FieldParse WaterTransparencySetting::m_waterTransparencySettingFieldParseTable[] = { - { "TransparentWaterDepth", INI::parseReal, NULL, offsetof( WaterTransparencySetting, m_transparentWaterDepth ) }, - { "TransparentWaterMinOpacity", INI::parseReal, NULL, offsetof( WaterTransparencySetting, m_minWaterOpacity ) }, - { "StandingWaterColor", INI::parseRGBColor, NULL, offsetof( WaterTransparencySetting, m_standingWaterColor ) }, - { "StandingWaterTexture",INI::parseAsciiString, NULL, offsetof( WaterTransparencySetting, m_standingWaterTexture ) }, - { "AdditiveBlending", INI::parseBool, NULL, offsetof( WaterTransparencySetting, m_additiveBlend) }, - { "RadarWaterColor", INI::parseRGBColor, NULL, offsetof( WaterTransparencySetting, m_radarColor) }, - { "SkyboxTextureN", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureN ) }, - { "SkyboxTextureE", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureE ) }, - { "SkyboxTextureS", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureS ) }, - { "SkyboxTextureW", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureW ) }, - { "SkyboxTextureT", INI::parseAsciiString,NULL, offsetof( WaterTransparencySetting, m_skyboxTextureT ) }, + { "TransparentWaterDepth", INI::parseReal, nullptr, offsetof( WaterTransparencySetting, m_transparentWaterDepth ) }, + { "TransparentWaterMinOpacity", INI::parseReal, nullptr, offsetof( WaterTransparencySetting, m_minWaterOpacity ) }, + { "StandingWaterColor", INI::parseRGBColor, nullptr, offsetof( WaterTransparencySetting, m_standingWaterColor ) }, + { "StandingWaterTexture",INI::parseAsciiString, nullptr, offsetof( WaterTransparencySetting, m_standingWaterTexture ) }, + { "AdditiveBlending", INI::parseBool, nullptr, offsetof( WaterTransparencySetting, m_additiveBlend) }, + { "RadarWaterColor", INI::parseRGBColor, nullptr, offsetof( WaterTransparencySetting, m_radarColor) }, + { "SkyboxTextureN", INI::parseAsciiString,nullptr, offsetof( WaterTransparencySetting, m_skyboxTextureN ) }, + { "SkyboxTextureE", INI::parseAsciiString,nullptr, offsetof( WaterTransparencySetting, m_skyboxTextureE ) }, + { "SkyboxTextureS", INI::parseAsciiString,nullptr, offsetof( WaterTransparencySetting, m_skyboxTextureS ) }, + { "SkyboxTextureW", INI::parseAsciiString,nullptr, offsetof( WaterTransparencySetting, m_skyboxTextureW ) }, + { "SkyboxTextureT", INI::parseAsciiString,nullptr, offsetof( WaterTransparencySetting, m_skyboxTextureT ) }, - { 0, 0, 0, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; diff --git a/Core/GameEngine/Source/GameNetwork/Connection.cpp b/Core/GameEngine/Source/GameNetwork/Connection.cpp index fe804e5ae86..eda39971126 100644 --- a/Core/GameEngine/Source/GameNetwork/Connection.cpp +++ b/Core/GameEngine/Source/GameNetwork/Connection.cpp @@ -35,9 +35,9 @@ enum { MaxQuitFlushTime = 30000 }; // wait this many milliseconds at most to ret * The constructor. */ Connection::Connection() { - m_transport = NULL; - m_user = NULL; - m_netCommandList = NULL; + m_transport = nullptr; + m_user = nullptr; + m_netCommandList = nullptr; m_retryTime = 2000; // set retry time to 2 seconds. m_lastTimeSent = 0; m_frameGrouping = 1; @@ -56,22 +56,22 @@ Connection::Connection() { */ Connection::~Connection() { deleteInstance(m_user); - m_user = NULL; + m_user = nullptr; deleteInstance(m_netCommandList); - m_netCommandList = NULL; + m_netCommandList = nullptr; } /** * Initialize the connection and any subsystems. */ void Connection::init() { - m_transport = NULL; + m_transport = nullptr; deleteInstance(m_user); - m_user = NULL; + m_user = nullptr; - if (m_netCommandList == NULL) { + if (m_netCommandList == nullptr) { m_netCommandList = newInstance(NetCommandList); m_netCommandList->init(); } @@ -131,10 +131,10 @@ User * Connection::getUser() { * The relay mostly has to do with the packet router. */ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { - static NetPacket *packet = NULL; + static NetPacket *packet = nullptr; // this is done so we don't have to allocate and delete a packet every time we send a message. - if (packet == NULL) { + if (packet == nullptr) { packet = newInstance(NetPacket); } @@ -142,7 +142,7 @@ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { if (m_isQuitting) return; - if (m_netCommandList != NULL) { + if (m_netCommandList != nullptr) { // check to see if this command will fit in a packet. If not, we need to split it up. // we are splitting up the command here so that the retry logic will not try to // resend the ENTIRE command (i.e. multiple packets work of data) and only do the retry @@ -153,7 +153,7 @@ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { Bool msgFits = packet->addCommand(tempref); deleteInstance(tempref); // delete the temporary reference. - tempref = NULL; + tempref = nullptr; if (!msgFits) { NetCommandRef *origref = NEW_NETCOMMANDREF(msg); @@ -167,7 +167,7 @@ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { NetCommandList *list = tempPacket->getCommandList(); NetCommandRef *ref1 = list->getFirstMessage(); - while (ref1 != NULL) { + while (ref1 != nullptr) { NetCommandRef *ref2 = m_netCommandList->addMessage(ref1->getCommand()); ref2->setRelay(relay); @@ -175,15 +175,15 @@ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { } deleteInstance(tempPacket); - tempPacket = NULL; + tempPacket = nullptr; ++tempPacketPtr; deleteInstance(list); - list = NULL; + list = nullptr; } deleteInstance(origref); - origref = NULL; + origref = nullptr; return; } @@ -191,7 +191,7 @@ void Connection::sendNetCommandMsg(NetCommandMsg *msg, UnsignedByte relay) { // the message fits in a packet, add to the command list normally. NetCommandRef *ref = m_netCommandList->addMessage(msg); - if (ref != NULL) { + if (ref != nullptr) { /* #if defined(RTS_DEBUG) @@ -231,7 +231,7 @@ void Connection::clearCommandsExceptFrom( Int playerIndex ) } Bool Connection::isQueueEmpty() { - if (m_netCommandList->getFirstMessage() == NULL) { + if (m_netCommandList->getFirstMessage() == nullptr) { return TRUE; } return FALSE; @@ -269,7 +269,7 @@ UnsignedInt Connection::doSend() { // iterate through all the messages and put them into a packet(s). NetCommandRef *msg = m_netCommandList->getFirstMessage(); - while ((msg != NULL) && couldQueue) { + while ((msg != nullptr) && couldQueue) { NetPacket *packet = newInstance(NetPacket); packet->init(); packet->setAddress(m_user->GetIPAddr(), m_user->GetPort()); @@ -277,7 +277,7 @@ UnsignedInt Connection::doSend() { Bool notDone = TRUE; // add the command messages until either we run out of messages or the packet is full. - while ((msg != NULL) && notDone) { + while ((msg != nullptr) && notDone) { NetCommandRef *next = msg->getNext(); // Need this since msg could be deleted time_t timeLastSent = msg->getTimeLastSent(); @@ -301,7 +301,7 @@ UnsignedInt Connection::doSend() { msg = next; } - if (msg != NULL) { + if (msg != nullptr) { DEBUG_LOG(("didn't finish sending all commands in connection")); } @@ -340,7 +340,7 @@ NetCommandRef * Connection::processAck(NetCommandMsg *msg) { return processAck(ackmsg); } - return NULL; + return nullptr; } /** @@ -349,14 +349,14 @@ NetCommandRef * Connection::processAck(NetCommandMsg *msg) { */ NetCommandRef * Connection::processAck(UnsignedShort commandID, UnsignedByte originalPlayerID) { NetCommandRef *temp = m_netCommandList->getFirstMessage(); - while ((temp != NULL) && ((temp->getCommand()->getID() != commandID) || (temp->getCommand()->getPlayerID() != originalPlayerID))) { + while ((temp != nullptr) && ((temp->getCommand()->getID() != commandID) || (temp->getCommand()->getPlayerID() != originalPlayerID))) { // cycle through the commands till we find the one we need to remove. // Need to check for both the command ID and the player ID. temp = temp->getNext(); } - if (temp == NULL) { - return NULL; + if (temp == nullptr) { + return nullptr; } #if defined(RTS_DEBUG) @@ -402,7 +402,7 @@ void Connection::doRetryMetrics() { #if defined(RTS_DEBUG) void Connection::debugPrintCommands() { NetCommandRef *ref = m_netCommandList->getFirstMessage(); - while (ref != NULL) { + while (ref != nullptr) { DEBUG_LOG(("Connection::debugPrintCommands - ID: %d\tType: %s\tRelay: 0x%X for frame %d", ref->getCommand()->getID(), GetNetCommandTypeAsString(ref->getCommand()->getNetCommandType()), ref->getRelay(), ref->getCommand()->getExecutionFrame())); diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 49d4676ffb0..a9745c4ec70 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -66,7 +66,7 @@ static Bool hasValidTransferFileExtension(const AsciiString& filePath) const char* fileExt = strrchr(filePath.str(), '.'); - if (fileExt == NULL || fileExt[1] == '\0') + if (fileExt == nullptr || fileExt[1] == '\0') { return false; } @@ -90,38 +90,38 @@ static Bool hasValidTransferFileExtension(const AsciiString& filePath) ConnectionManager::~ConnectionManager(void) { deleteInstance(m_localUser); - m_localUser = NULL; + m_localUser = nullptr; // Network will delete transports; we just forget them delete m_transport; - m_transport = NULL; + m_transport = nullptr; Int i = 0; for (; i < MAX_SLOTS; ++i) { deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; + m_frameData[i] = nullptr; } for (i = 0; i < NUM_CONNECTIONS; ++i) { deleteInstance(m_connections[i]); - m_connections[i] = NULL; + m_connections[i] = nullptr; } // This is done here since TheDisconnectMenu should only be there if we are in a network game. delete TheDisconnectMenu; - TheDisconnectMenu = NULL; + TheDisconnectMenu = nullptr; delete m_disconnectManager; - m_disconnectManager = NULL; + m_disconnectManager = nullptr; deleteInstance(m_pendingCommands); - m_pendingCommands = NULL; + m_pendingCommands = nullptr; deleteInstance(m_relayedCommands); - m_relayedCommands = NULL; + m_relayedCommands = nullptr; deleteInstance(m_netCommandWrapperList); - m_netCommandWrapperList = NULL; + m_netCommandWrapperList = nullptr; s_fileCommandMap.clear(); s_fileRecipientMaskMap.clear(); @@ -136,16 +136,16 @@ ConnectionManager::~ConnectionManager(void) ConnectionManager::ConnectionManager(void) { for (Int i = 0; i < MAX_SLOTS; ++i) { - m_frameData[i] = NULL; + m_frameData[i] = nullptr; } - m_transport = NULL; - m_disconnectManager = NULL; - m_pendingCommands = NULL; - m_relayedCommands = NULL; + m_transport = nullptr; + m_disconnectManager = nullptr; + m_pendingCommands = nullptr; + m_relayedCommands = nullptr; m_localAddr = 0; m_localPort = 0; - m_netCommandWrapperList = NULL; - m_localUser = NULL; + m_netCommandWrapperList = nullptr; + m_localUser = nullptr; m_localUser = newInstance(User); } @@ -154,23 +154,23 @@ ConnectionManager::ConnectionManager(void) */ void ConnectionManager::init() { -// if (m_transport == NULL) { +// if (m_transport == nullptr) { // m_transport = new Transport; // } // m_transport->reset(); UnsignedInt i = 0; for (; i < NUM_CONNECTIONS; ++i) { - m_connections[i] = NULL; + m_connections[i] = nullptr; } - if (m_pendingCommands == NULL) { + if (m_pendingCommands == nullptr) { m_pendingCommands = newInstance(NetCommandList); m_pendingCommands->init(); } m_pendingCommands->reset(); - if (m_relayedCommands == NULL) { + if (m_relayedCommands == nullptr) { m_relayedCommands = newInstance(NetCommandList); m_relayedCommands->init(); } @@ -187,7 +187,7 @@ void ConnectionManager::init() for (i = 0; i < MAX_SLOTS; ++i) { deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; + m_frameData[i] = nullptr; } // m_averageFps = 30; // since 30 fps is the desired rate, we'll start off at that. @@ -227,39 +227,39 @@ void ConnectionManager::init() */ void ConnectionManager::reset() { -// if (m_transport == NULL) { +// if (m_transport == nullptr) { // m_transport = new Transport; // } // m_transport->reset(); delete m_transport; - m_transport = NULL; + m_transport = nullptr; UnsignedInt i = 0; for (; i < (UnsignedInt)NUM_CONNECTIONS; ++i) { deleteInstance(m_connections[i]); - m_connections[i] = NULL; + m_connections[i] = nullptr; } for (i=0; i<(UnsignedInt)MAX_SLOTS; ++i) { deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; + m_frameData[i] = nullptr; } - if (m_pendingCommands == NULL) { + if (m_pendingCommands == nullptr) { m_pendingCommands = newInstance(NetCommandList); m_pendingCommands->init(); } m_pendingCommands->reset(); - if (m_relayedCommands == NULL) { + if (m_relayedCommands == nullptr) { m_relayedCommands = newInstance(NetCommandList); m_relayedCommands->init(); } m_relayedCommands->reset(); - if (m_netCommandWrapperList == NULL) { + if (m_netCommandWrapperList == nullptr) { m_netCommandWrapperList = newInstance(NetCommandWrapperList); m_netCommandWrapperList->init(); } @@ -316,7 +316,7 @@ void ConnectionManager::attachTransport(Transport *transport) { */ void ConnectionManager::zeroFrames(UnsignedInt startingFrame, UnsignedInt numFrames) { for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { + if (m_frameData[i] != nullptr) { // DEBUG_LOG(("Calling zeroFrames on player %d, starting frame %d, numFrames %d", i, startingFrame, numFrames)); m_frameData[i]->zeroFrames(startingFrame, numFrames); } @@ -331,7 +331,7 @@ void ConnectionManager::destroyGameMessages() { // Need to destroy these game messages because when the game ends, there are // still some game messages left over because of the run ahead aspect of // network play. - if (m_frameData[i] != NULL) { + if (m_frameData[i] != nullptr) { m_frameData[i]->destroyGameMessages(); } } @@ -347,7 +347,7 @@ void ConnectionManager::doRelay() { static Int numPackets = 0; static Int numCommands = 0; - NetPacket *packet = NULL; + NetPacket *packet = nullptr; for (Int i = 0; i < MAX_MESSAGES; ++i) { if (m_transport->m_inBuffer[i].length != 0) { @@ -364,7 +364,7 @@ void ConnectionManager::doRelay() { NetCommandRef *cmd = cmdList->getFirstMessage(); // Iterate through the commands in this packet and send them to the proper connections. - while (cmd != NULL) { + while (cmd != nullptr) { //DEBUG_LOG(("ConnectionManager::doRelay() - Looking at a command of type %s", //GetNetCommandTypeAsString(cmd->getCommand()->getNetCommandType()))); if (CommandRequiresAck(cmd->getCommand())) { @@ -381,10 +381,10 @@ void ConnectionManager::doRelay() { // Delete this packet since we won't be needing it anymore. deleteInstance(packet); - packet = NULL; + packet = nullptr; deleteInstance(cmdList); - cmdList = NULL; + cmdList = nullptr; // signal that this has been processed. m_transport->m_inBuffer[i].length = 0; @@ -393,7 +393,7 @@ void ConnectionManager::doRelay() { NetCommandList *cmdList = m_netCommandWrapperList->getReadyCommands(); NetCommandRef *cmd = cmdList->getFirstMessage(); - while (cmd != NULL) { + while (cmd != nullptr) { if (CommandRequiresAck(cmd->getCommand())) { ackCommand(cmd, m_localSlot); } @@ -408,10 +408,10 @@ void ConnectionManager::doRelay() { // Delete this packet since we won't be needing it anymore. deleteInstance(packet); - packet = NULL; + packet = nullptr; deleteInstance(cmdList); - cmdList = NULL; + cmdList = nullptr; } /** @@ -431,7 +431,7 @@ Bool ConnectionManager::processNetCommand(NetCommandRef *ref) { } // Early validation checks - if ((m_connections[msg->getPlayerID()] == NULL) && (msg->getPlayerID() != m_localSlot)) { + if ((m_connections[msg->getPlayerID()] == nullptr) && (msg->getPlayerID() != m_localSlot)) { // if this is from a player that is no longer in the game, then ignore them. return TRUE; } @@ -443,7 +443,7 @@ Bool ConnectionManager::processNetCommand(NetCommandRef *ref) { } if ((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS) && (msg->getPlayerID() != m_localSlot)) { - if (m_connections[msg->getPlayerID()] == NULL) { + if (m_connections[msg->getPlayerID()] == nullptr) { return TRUE; } } @@ -542,7 +542,7 @@ void ConnectionManager::processFrameResendRequest(NetFrameResendRequestCommandMs } // make sure this player is still in our game. - if ((m_connections[playerID] == NULL) || (m_connections[playerID]->isQuitting() == TRUE)) { + if ((m_connections[playerID] == nullptr) || (m_connections[playerID]->isQuitting() == TRUE)) { return; } @@ -638,10 +638,10 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg) //DEBUG_LOG(("processChat(): playerID = %d", playerID)); if (playerID == m_localSlot) { name = m_localUser->GetName(); - //DEBUG_LOG(("connection is NULL, using %ls", name.str())); - } else if (((m_connections[playerID] != NULL) && (m_connections[playerID]->isQuitting() == FALSE))) { + //DEBUG_LOG(("connection is null, using %ls", name.str())); + } else if (((m_connections[playerID] != nullptr) && (m_connections[playerID]->isQuitting() == FALSE))) { name = m_connections[playerID]->getUser()->GetName(); - //DEBUG_LOG(("connection is non-NULL, using %ls", name.str())); + //DEBUG_LOG(("connection is non-null, using %ls", name.str())); } unitext.format(L"[%ls] %ls", name.str(), msg->getText().str()); // DEBUG_LOG(("ConnectionManager::processChat - got message from player %d (mask %8.8X), message is %ls", playerID, msg->getPlayerMask(), unitext.str())); @@ -733,7 +733,7 @@ void ConnectionManager::processFile(NetFileCommandMsg *msg) { fp->write(buf, len); fp->close(); - fp = NULL; + fp = nullptr; DEBUG_LOG(("Wrote %d bytes to file %s!", len, realFileName.str())); } @@ -767,7 +767,7 @@ void ConnectionManager::processFile(NetFileCommandMsg *msg) if (deleteBuf) { delete[] buf; - buf = NULL; + buf = nullptr; } #endif // COMPRESS_TARGAS } @@ -823,7 +823,7 @@ void ConnectionManager::processFrameInfo(NetFrameCommandMsg *msg) { UnsignedInt playerID = msg->getPlayerID(); if ((playerID >= 0) && (playerID < MAX_SLOTS)) { - if (m_frameData[playerID] != NULL) { + if (m_frameData[playerID] != nullptr) { // DEBUG_LOG(("ConnectionManager::processFrameInfo - player %d, frame %d, command count %d, received on frame %d", playerID, msg->getExecutionFrame(), msg->getCommandCount(), TheGameLogic->getFrame())); m_frameData[playerID]->setFrameCommandCount(msg->getExecutionFrame(), msg->getCommandCount()); } @@ -840,7 +840,7 @@ void ConnectionManager::processAckStage1(NetCommandMsg *msg) { #endif UnsignedByte playerID = msg->getPlayerID(); - NetCommandRef *ref = NULL; + NetCommandRef *ref = nullptr; #if defined(RTS_DEBUG) if (doDebug == TRUE) { @@ -849,20 +849,20 @@ void ConnectionManager::processAckStage1(NetCommandMsg *msg) { #endif if ((playerID >= 0) && (playerID < NUM_CONNECTIONS)) { - if (m_connections[playerID] != NULL) { + if (m_connections[playerID] != nullptr) { ref = m_connections[playerID]->processAck(msg); } } else { DEBUG_ASSERTCRASH((playerID >= 0) && (playerID < NUM_CONNECTIONS), ("ConnectionManager::processAck - %d is an invalid player number", playerID)); } - if (ref != NULL) { + if (ref != nullptr) { if (ref->getCommand()->getNetCommandType() == NETCOMMANDTYPE_FRAMEINFO) { m_frameMetrics.processLatencyResponse(((NetFrameCommandMsg *)(ref->getCommand()))->getExecutionFrame()); } deleteInstance(ref); - ref = NULL; + ref = nullptr; } } @@ -884,18 +884,18 @@ void ConnectionManager::processAckStage2(NetCommandMsg *msg) { } NetCommandRef *ref = m_pendingCommands->findMessage(commandID, playerID); - if (ref != NULL) { + if (ref != nullptr) { //DEBUG_LOG(("ConnectionManager::processAckStage2 - removing command %d from the pending commands list.", commandID)); DEBUG_ASSERTCRASH((m_localSlot == playerID), ("Found a command in the pending commands list that wasn't originated by the local player")); m_pendingCommands->removeMessage(ref); deleteInstance(ref); - ref = NULL; + ref = nullptr; } else { //DEBUG_LOG(("ConnectionManager::processAckStage2 - Couldn't find command %d from player %d in the pending commands list.", commandID, playerID)); } ref = m_relayedCommands->findMessage(commandID, playerID); - if (ref != NULL) { + if (ref != nullptr) { //DEBUG_LOG(("ConnectionManager::processAckStage2 - found command ID %d from player %d in the relayed commands list.", commandID, playerID)); UnsignedByte prevRelay = ref->getRelay(); UnsignedByte relay = prevRelay & ~(1 << msg->getPlayerID()); @@ -906,10 +906,10 @@ void ConnectionManager::processAckStage2(NetCommandMsg *msg) { NetAckStage2CommandMsg *ackmsg = newInstance(NetAckStage2CommandMsg)(ref->getCommand()); sendLocalCommand(ackmsg, 1 << ackmsg->getOriginalPlayerID()); deleteInstance(ref); - ref = NULL; + ref = nullptr; ackmsg->detach(); - ackmsg = NULL; + ackmsg = nullptr; } else { ref->setRelay(relay); } @@ -940,12 +940,12 @@ void ConnectionManager::processAck(NetCommandMsg *msg) { */ PlayerLeaveCode ConnectionManager::processPlayerLeave(NetPlayerLeaveCommandMsg *msg) { UnsignedByte playerID = msg->getLeavingPlayerID(); - if ((playerID != m_localSlot) && (m_connections[playerID] != NULL)) { + if ((playerID != m_localSlot) && (m_connections[playerID] != nullptr)) { DEBUG_LOG(("ConnectionManager::processPlayerLeave() - setQuitting() on player %d on frame %d", playerID, TheGameLogic->getFrame())); m_connections[playerID]->setQuitting(); } DEBUG_ASSERTCRASH(m_frameData[playerID]->getIsQuitting() == FALSE, ("Player %d is already quitting", playerID)); - if ((playerID != m_localSlot) && (m_frameData[playerID] != NULL) && (m_frameData[playerID]->getIsQuitting() == FALSE)) { + if ((playerID != m_localSlot) && (m_frameData[playerID] != nullptr) && (m_frameData[playerID]->getIsQuitting() == FALSE)) { DEBUG_LOG(("ConnectionManager::processPlayerLeave - setQuitFrame on player %d for frame %d", playerID, TheGameLogic->getFrame()+1)); m_frameData[playerID]->setQuitFrame(TheGameLogic->getFrame() + FRAMES_TO_KEEP + 1); } @@ -986,7 +986,7 @@ UnsignedInt ConnectionManager::getPacketRouterSlot() { Bool ConnectionManager::areAllQueuesEmpty(void) { Bool retval = TRUE; for (Int i = 0; (i < MAX_SLOTS) && retval; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { if (m_connections[i]->isQueueEmpty() == FALSE) { //DEBUG_LOG(("ConnectionManager::areAllQueuesEmpty() - m_connections[%d] is not empty", i)); //m_connections[i]->debugPrintCommands(); @@ -1037,7 +1037,7 @@ void ConnectionManager::ackCommand(NetCommandRef *ref, UnsignedInt localSlot) { // Make send relay a bitmask for the connections that the relay will actually be sent to. This is // necessary to determine whether or not we have to wait to send a stage 2 ack. for (Int i = 0; i < MAX_SLOTS; ++i) { - if (((m_connections[i] != NULL) && (m_connections[i]->isQuitting() == FALSE))) { + if (((m_connections[i] != nullptr) && (m_connections[i]->isQuitting() == FALSE))) { sendRelay = sendRelay | (1 << i); } } @@ -1074,30 +1074,30 @@ void ConnectionManager::ackCommand(NetCommandRef *ref, UnsignedInt localSlot) { if (CommandRequiresDirectSend(msg) && CommandRequiresAck(msg)) { // Send this ack directly back to the sending player, don't go through the packet router. if ((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS)) { - if (m_connections[msg->getPlayerID()] != NULL) { + if (m_connections[msg->getPlayerID()] != nullptr) { m_connections[msg->getPlayerID()]->sendNetCommandMsg(ackmsg, 1 << msg->getPlayerID()); } } } else { - // The local connection may be the packet router, in that case, the connection would be NULL. So do something about it! + // The local connection may be the packet router, in that case, the connection would be null. So do something about it! if ((m_packetRouterSlot >= 0) && (m_packetRouterSlot < MAX_SLOTS)) { - if (m_connections[m_packetRouterSlot] != NULL) { + if (m_connections[m_packetRouterSlot] != nullptr) { // DEBUG_LOG(("ConnectionManager::ackCommand - acking command %d from player %d to packet router.", commandID, m_packetRouterSlot)); m_connections[m_packetRouterSlot]->sendNetCommandMsg(ackmsg, 1 << m_packetRouterSlot); } else if (m_localSlot == m_packetRouterSlot) { // we are the packet router, send the ack to the player that sent the command. if ((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS)) { - if (m_connections[msg->getPlayerID()] != NULL) { + if (m_connections[msg->getPlayerID()] != nullptr) { // DEBUG_LOG(("ConnectionManager::ackCommand - acking command %d from player %d directly to player.", commandID, msg->getPlayerID())); m_connections[msg->getPlayerID()]->sendNetCommandMsg(ackmsg, 1 << msg->getPlayerID()); } else { - // DEBUG_ASSERTCRASH(m_connections[msg->getPlayerID()] != NULL, ("Connection to player is NULL")); + // DEBUG_ASSERTCRASH(m_connections[msg->getPlayerID()] != nullptr, ("Connection to player is null")); } } else { DEBUG_ASSERTCRASH((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS), ("Command sent by an invalid player ID.")); } } else { - DEBUG_ASSERTCRASH(m_connections[m_packetRouterSlot] != NULL, ("Connection to packet router is NULL")); + DEBUG_ASSERTCRASH(m_connections[m_packetRouterSlot] != nullptr, ("Connection to packet router is null")); } } else { DEBUG_ASSERTCRASH((m_packetRouterSlot >= 0) && (m_packetRouterSlot < MAX_SLOTS), ("I don't know who the packet router is.")); @@ -1113,7 +1113,7 @@ void ConnectionManager::ackCommand(NetCommandRef *ref, UnsignedInt localSlot) { */ void ConnectionManager::sendRemoteCommand(NetCommandRef *msg) { UnsignedByte actualRelay = 0; - if (msg->getCommand() == NULL) { + if (msg->getCommand() == nullptr) { return; } @@ -1121,7 +1121,7 @@ void ConnectionManager::sendRemoteCommand(NetCommandRef *msg) { msg->getCommand()->getID(), GetNetCommandTypeAsString(msg->getCommand()->getNetCommandType()), msg->getCommand()->getPlayerID(), msg->getRelay())); UnsignedByte relay = msg->getRelay(); - if ((relay & (1 << m_localSlot)) && (m_frameData[msg->getCommand()->getPlayerID()] != NULL)) { + if ((relay & (1 << m_localSlot)) && (m_frameData[msg->getCommand()->getPlayerID()] != nullptr)) { if (IsCommandSynchronized(msg->getCommand()->getNetCommandType())) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendRemoteCommand - adding net command of type %s to player %d for frame %d", GetNetCommandTypeAsString(msg->getCommand()->getNetCommandType()), msg->getCommand()->getPlayerID(), msg->getCommand()->getExecutionFrame())); m_frameData[msg->getCommand()->getPlayerID()]->addNetCommandMsg(msg->getCommand()); @@ -1129,7 +1129,7 @@ void ConnectionManager::sendRemoteCommand(NetCommandRef *msg) { } for (Int i = 0; i < MAX_SLOTS; ++i) { - if ((relay & (1 << i)) && ((m_connections[i] != NULL) && (m_connections[i]->isQuitting() == FALSE))) { + if ((relay & (1 << i)) && ((m_connections[i] != nullptr) && (m_connections[i]->isQuitting() == FALSE))) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendRemoteCommand - relaying command %d to player %d", msg->getCommand()->getID(), i)); m_connections[i]->sendNetCommandMsg(msg->getCommand(), 1 << i); actualRelay = actualRelay | (1 << i); @@ -1138,7 +1138,7 @@ void ConnectionManager::sendRemoteCommand(NetCommandRef *msg) { if ((actualRelay != 0) && (CommandRequiresAck(msg->getCommand()) == TRUE)) { NetCommandRef *ref = m_relayedCommands->addMessage(msg->getCommand()); - if (ref != NULL) { + if (ref != nullptr) { ref->setRelay(actualRelay); //DEBUG_LOG(("ConnectionManager::sendRemoteCommand - command %d added to relayed commands with relay %d", msg->getCommand()->getID(), ref->getRelay())); } @@ -1191,7 +1191,7 @@ void ConnectionManager::update(Bool isInGame) { doKeepAlive(); for (Int i = 0; i < NUM_CONNECTIONS; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { /* if (m_connections[i]->isQueueEmpty() == FALSE) { // DEBUG_LOG(("ConnectionManager::update - calling doSend on connection %d", i)); @@ -1204,15 +1204,15 @@ void ConnectionManager::update(Bool isInGame) { { DEBUG_LOG(("ConnectionManager::update - deleting connection for slot %d", i)); deleteInstance(m_connections[i]); - m_connections[i] = NULL; + m_connections[i] = nullptr; } } - if ((m_frameData[i] != NULL) && (m_frameData[i]->getIsQuitting() == TRUE)) { + if ((m_frameData[i] != nullptr) && (m_frameData[i]->getIsQuitting() == TRUE)) { if (m_frameData[i]->getQuitFrame() == TheGameLogic->getFrame()) { DEBUG_LOG(("ConnectionManager::update - deleting frame data for slot %d on quitting frame %d", i, m_frameData[i]->getQuitFrame())); deleteInstance(m_frameData[i]); - m_frameData[i] = NULL; + m_frameData[i] = nullptr; } } } @@ -1378,7 +1378,7 @@ void ConnectionManager::getMinimumFps(Int &minFps, Int &minFpsPlayer) { minFpsPlayer = -1; // DEBUG_LOG_RAW(("ConnectionManager::getMinimumFps -")); for (Int i = 0; i < MAX_SLOTS; ++i) { - if ((m_connections[i] != NULL) || (i == m_localSlot)) { + if ((m_connections[i] != nullptr) || (i == m_localSlot)) { // DEBUG_LOG_RAW((" %d: %d,", i, m_fpsAverages[i])); if (m_fpsAverages[i] != -1) { if ((minFps == -1) || (m_fpsAverages[i] < minFps)) { @@ -1399,8 +1399,8 @@ UnsignedInt ConnectionManager::getMinimumCushion() { * The commands for the given frame are all ready, time to send out our command count for that frame. */ void ConnectionManager::processFrameTick(UnsignedInt frame) { - if ((m_frameData[m_localSlot] == NULL) || (m_frameData[m_localSlot]->getIsQuitting() == TRUE)) { - // if the local frame data stuff is NULL, we must be leaving the game. + if ((m_frameData[m_localSlot] == nullptr) || (m_frameData[m_localSlot]->getIsQuitting() == TRUE)) { + // if the local frame data stuff is null, we must be leaving the game. return; } UnsignedShort commandCount = m_frameData[m_localSlot]->getCommandCount(frame); @@ -1434,7 +1434,7 @@ void ConnectionManager::setLocalAddress(UnsignedInt ip, UnsignedInt port) { * Initialize the transport object */ void ConnectionManager::initTransport() { - DEBUG_ASSERTCRASH((m_transport == NULL), ("m_transport already exists when trying to init it.")); + DEBUG_ASSERTCRASH((m_transport == nullptr), ("m_transport already exists when trying to init it.")); DEBUG_LOG(("ConnectionManager::initTransport - Initializing Transport")); delete m_transport; @@ -1469,7 +1469,7 @@ void ConnectionManager::sendLocalGameMessage(GameMessage *msg, UnsignedInt frame * in the relay field. Commands sent in this way go through the packet router. */ void ConnectionManager::sendLocalCommand(NetCommandMsg *msg, UnsignedByte relay /* = 0xff by default*/) { - if (CommandRequiresDirectSend(msg) || (m_packetRouterSlot < 0) || (m_packetRouterSlot >= MAX_SLOTS) || (m_connections[m_packetRouterSlot] == NULL)) { + if (CommandRequiresDirectSend(msg) || (m_packetRouterSlot < 0) || (m_packetRouterSlot >= MAX_SLOTS) || (m_connections[m_packetRouterSlot] == nullptr)) { sendLocalCommandDirect(msg, relay); return; } @@ -1488,7 +1488,7 @@ void ConnectionManager::sendLocalCommand(NetCommandMsg *msg, UnsignedByte relay // I am the packet router, I need to send this packet to everyone individually. for (Int i = 0; i < MAX_SLOTS; ++i) { // Send it to all open connections. - if (((m_connections[i] != NULL) && (m_connections[i]->isQuitting() == FALSE)) && (relay & (1 << i))) { + if (((m_connections[i] != nullptr) && (m_connections[i]->isQuitting() == FALSE)) && (relay & (1 << i))) { // Set the relay mask to only go to this player so he knows not to relay it to anyone else. UnsignedByte temprelay = 1 << i; m_connections[i]->sendNetCommandMsg(msg, temprelay); // This will create a new copy of netmsg for this connection. @@ -1505,7 +1505,7 @@ void ConnectionManager::sendLocalCommand(NetCommandMsg *msg, UnsignedByte relay if (CommandRequiresAck(msg)) { NetCommandRef *ref = m_pendingCommands->addMessage(msg); //DEBUG_LOG(("ConnectionManager::sendLocalCommand - added command %d to pending commands list.", msg->getID())); - if (ref != NULL) { + if (ref != nullptr) { ref->setRelay(temprelay); } } @@ -1521,7 +1521,7 @@ void ConnectionManager::sendLocalCommand(NetCommandMsg *msg, UnsignedByte relay void ConnectionManager::sendLocalCommandDirect(NetCommandMsg *msg, UnsignedByte relay) { msg->attach(); - if (((relay & (1 << m_localSlot)) != 0) && (m_frameData[m_localSlot] != NULL)) { + if (((relay & (1 << m_localSlot)) != 0) && (m_frameData[m_localSlot] != nullptr)) { if (IsCommandSynchronized(msg->getNetCommandType()) == TRUE) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendLocalCommandDirect - adding net command of type %s to player %d for frame %d", GetNetCommandTypeAsString(msg->getNetCommandType()), msg->getPlayerID(), msg->getExecutionFrame())); m_frameData[m_localSlot]->addNetCommandMsg(msg); @@ -1530,7 +1530,7 @@ void ConnectionManager::sendLocalCommandDirect(NetCommandMsg *msg, UnsignedByte for (Int i = 0; i < MAX_SLOTS; ++i) { if ((relay & (1 << i)) != 0) { - if ((m_connections[i] != NULL) && (m_connections[i]->isQuitting() == FALSE)) { + if ((m_connections[i] != nullptr) && (m_connections[i]->isQuitting() == FALSE)) { UnsignedByte temprelay = 1 << i; m_connections[i]->sendNetCommandMsg(msg, temprelay); DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendLocalCommandDirect - Sending direct command %d of type %s to player %d", msg->getID(), GetNetCommandTypeAsString(msg->getNetCommandType()), i)); @@ -1552,7 +1552,7 @@ Bool ConnectionManager::allCommandsReady(UnsignedInt frame, Bool justTesting /* // retval = FALSE; // ****for testing purposes only!!!!!!**** Int i = 0; for (; (i < MAX_SLOTS) && retval; ++i) { - if ((m_frameData[i] != NULL) && (m_frameData[i]->getIsQuitting() == FALSE)) { + if ((m_frameData[i] != nullptr) && (m_frameData[i]->getIsQuitting() == FALSE)) { /* if (!(m_frameData[i]->allCommandsReady(frame, (frame != commandsReadyDebugSpewage) && (justTesting == FALSE)))) { if ((frame != commandsReadyDebugSpewage) && (justTesting == FALSE)) { @@ -1578,7 +1578,7 @@ Bool ConnectionManager::allCommandsReady(UnsignedInt frame, Bool justTesting /* if (frameRetVal == FRAMEDATA_RESEND) { // this frame's data is really screwed up, we need to clean it out so it can be resent to us. for (i = 0; i < MAX_SLOTS; ++i) { - if ((m_frameData[i] != NULL) && (i != m_localSlot)) { + if ((m_frameData[i] != nullptr) && (i != m_localSlot)) { m_frameData[i]->resetFrame(frame, FALSE); } } @@ -1614,7 +1614,7 @@ NetCommandList *ConnectionManager::getFrameCommandList(UnsignedInt frame) retlist->init(); for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_frameData[i] != NULL) { + if (m_frameData[i] != nullptr) { retlist->appendList(m_frameData[i]->getFrameCommandList(frame)); if (frame > FRAMES_TO_KEEP) { m_frameData[i]->resetFrame(frame - FRAMES_TO_KEEP); // After getting the commands for that frame from this @@ -1637,7 +1637,7 @@ void ConnectionManager::setFrameGrouping(time_t frameGrouping) { frameGrouping = frameGrouping / 2; } for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { m_connections[i]->setFrameGrouping(frameGrouping); } } @@ -1648,7 +1648,7 @@ void ConnectionManager::determineRouterFallbackPlan() { memset(m_packetRouterFallback, 0, sizeof(m_packetRouterFallback)); Int curnum = 1; for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { m_packetRouterFallback[i] = curnum; if (curnum == 1) { m_packetRouterSlot = i; @@ -1674,7 +1674,7 @@ void ConnectionManager::doKeepAlive() { while ((nextIndex <= numSeconds) && (nextIndex < MAX_SLOTS)) { // DEBUG_LOG(("ConnectionManager::doKeepAlive - trying to send keep alive message to player %d", nextIndex)); - if (m_connections[nextIndex] != NULL) { + if (m_connections[nextIndex] != nullptr) { NetKeepAliveCommandMsg *msg = newInstance(NetKeepAliveCommandMsg); msg->setPlayerID(m_localSlot); if (DoesCommandRequireACommandID(msg->getNetCommandType()) == TRUE) { @@ -1722,16 +1722,16 @@ PlayerLeaveCode ConnectionManager::disconnectPlayer(Int slot) { TheAudio->addAudioEvent(&leftGameSound); } - if ((m_frameData[slot] != NULL) && (m_frameData[slot]->getIsQuitting() == FALSE)) { + if ((m_frameData[slot] != nullptr) && (m_frameData[slot]->getIsQuitting() == FALSE)) { DEBUG_LOG(("ConnectionManager::disconnectPlayer - deleting player %d frame data", slot)); deleteInstance(m_frameData[slot]); - m_frameData[slot] = NULL; + m_frameData[slot] = nullptr; } - if (m_connections[slot] != NULL && !m_connections[slot]->isQuitting()) { + if (m_connections[slot] != nullptr && !m_connections[slot]->isQuitting()) { DEBUG_LOG(("ConnectionManager::disconnectPlayer - deleting player %d connection", slot)); deleteInstance(m_connections[slot]); - m_connections[slot] = NULL; + m_connections[slot] = nullptr; } // if (playerID == m_localSlot) { @@ -1819,7 +1819,7 @@ void ConnectionManager::disconnectLocalPlayer() { */ void ConnectionManager::flushConnections() { for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { // DEBUG_LOG(("ConnectionManager::flushConnections - flushing connection to player %d", i)); /* if (m_connections[i]->isQueueEmpty()) { @@ -1830,19 +1830,19 @@ void ConnectionManager::flushConnections() { } } - if (m_transport != NULL) { + if (m_transport != nullptr) { m_transport->doSend(); } } void ConnectionManager::resendPendingCommands() { //DEBUG_LOG(("ConnectionManager::resendPendingCommands()")); - if (m_pendingCommands == NULL) { + if (m_pendingCommands == nullptr) { return; } NetCommandRef *ref = m_pendingCommands->getFirstMessage(); - while (ref != NULL) { + while (ref != nullptr) { //DEBUG_LOG(("ConnectionManager::resendPendingCommands - resending command %d", ref->getCommand()->getID())); sendLocalCommand(ref->getCommand(), ref->getRelay()); ref = ref->getNext(); @@ -1857,7 +1857,7 @@ UnicodeString ConnectionManager::getPlayerName(Int playerNum) { UnicodeString retval; if( playerNum == m_localSlot ) { retval = m_localUser->GetName(); - } else if (((m_connections[playerNum] != NULL) && (m_connections[playerNum]->isQuitting() == FALSE))) { + } else if (((m_connections[playerNum] != nullptr) && (m_connections[playerNum]->isQuitting() == FALSE))) { retval = m_connections[playerNum]->getUser()->GetName(); } return retval; @@ -1947,14 +1947,14 @@ void ConnectionManager::parseUserList(const GameInfo *game) m_localPort)); int numUsers = 0; - while ( (userStr=strtok_r(listPtr, ",", &listPos)) != NULL ) + while ( (userStr=strtok_r(listPtr, ",", &listPos)) != nullptr ) { - listPtr = NULL; - char *pos = NULL; + listPtr = nullptr; + char *pos = nullptr; nameStr = strtok_r(userStr, "@", &pos); - addrStr = strtok_r(NULL, "@:", &pos); - portStr = strtok_r(NULL, ": ", &pos); + addrStr = strtok_r(nullptr, "@:", &pos); + portStr = strtok_r(nullptr, ": ", &pos); if (!portStr || numUsers >= MAX_SLOTS) { @@ -2000,7 +2000,7 @@ void ConnectionManager::parseUserList(const GameInfo *game) } free(list); // from the strdup above. - list = NULL; + list = nullptr; */ } @@ -2168,7 +2168,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi // compress Targas #ifdef COMPRESS_TARGAS - char *compressedBuf = NULL; + char *compressedBuf = nullptr; Int compressedLen = path.endsWith(".tga")?CompressionManager::getMaxCompressedSize(len, CompressionManager::getPreferredCompression()):0; Int compressedSize = 0; if (compressedLen) @@ -2178,7 +2178,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi if (!compressedSize) { delete[] compressedBuf; - compressedBuf = NULL; + compressedBuf = nullptr; } #endif // COMPRESS_TARGAS @@ -2203,10 +2203,10 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi fileMsg->getID(), fileMsg->getRealFilename().str(), playerMask, fileMsg->getPlayerID(), fileMsg->getFileLength())); delete[] buf; - buf = NULL; + buf = nullptr; #ifdef COMPRESS_TARGAS delete[] compressedBuf; - compressedBuf = NULL; + compressedBuf = nullptr; #endif // COMPRESS_TARGAS DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("Sending file: '%s', len %d, to %X", path.str(), len, playerMask)); @@ -2236,7 +2236,7 @@ Int ConnectionManager::getFileTransferProgress(Int playerID, AsciiString path) void ConnectionManager::voteForPlayerDisconnect(Int slot) { - if (m_disconnectManager != NULL) { + if (m_disconnectManager != nullptr) { m_disconnectManager->voteForPlayerDisconnect(slot, this); } } @@ -2320,7 +2320,7 @@ Int ConnectionManager::getSlotAverageFPS(Int slot) { void ConnectionManager::debugPrintConnectionCommands() { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::debugPrintConnectionCommands - begin commands")); for (Int i = 0; i < MAX_SLOTS; ++i) { - if (m_connections[i] != NULL) { + if (m_connections[i] != nullptr) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::debugPrintConnectionCommands - commands for connection %d", i)); m_connections[i]->debugPrintCommands(); } @@ -2389,11 +2389,11 @@ void ConnectionManager::sendSingleFrameToPlayer(UnsignedInt playerID, UnsignedIn DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendFrameDataToPlayer - sending data for frame %d", frame)); for (Int i = 0; i < MAX_SLOTS; ++i) { - if ((m_frameData[i] != NULL) && (i != playerID)) { // no need to send his own commands to him. + if ((m_frameData[i] != nullptr) && (i != playerID)) { // no need to send his own commands to him. NetCommandList *list = m_frameData[i]->getFrameCommandList(frame); - if (list != NULL) { + if (list != nullptr) { NetCommandRef *ref = list->getFirstMessage(); - while (ref != NULL) { + while (ref != nullptr) { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("ConnectionManager::sendFrameDataToPlayer - sending command %d from player %d to player %d using relay 0x%x", ref->getCommand()->getID(), i, playerID, relay)); sendLocalCommandDirect(ref->getCommand(), relay); ref = ref->getNext(); diff --git a/Core/GameEngine/Source/GameNetwork/FileTransfer.cpp b/Core/GameEngine/Source/GameNetwork/FileTransfer.cpp index c64f3118adb..5d9cc7dfe64 100644 --- a/Core/GameEngine/Source/GameNetwork/FileTransfer.cpp +++ b/Core/GameEngine/Source/GameNetwork/FileTransfer.cpp @@ -276,7 +276,7 @@ Bool DoAnyMapTransfers(GameInfo *game) if (ok) ok = doFileTransfer(game->getMap(), ls, mask); delete ls; - ls = NULL; + ls = nullptr; if (!ok) TheShell->showShell(); return ok; diff --git a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp index 2f0db33a44a..f4f7bf4ab34 100644 --- a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -57,7 +57,7 @@ #include "GameNetwork/GameSpy/GSConfig.h" -FirewallHelperClass *TheFirewallHelper = NULL; +FirewallHelperClass *TheFirewallHelper = nullptr; FirewallHelperClass * createFirewallHelper() { @@ -360,8 +360,8 @@ Bool FirewallHelperClass::sendToManglerFromPort(UnsignedInt address, UnsignedSho // DEBUG_LOG(("PacketID = %u", packetID)); // DEBUG_LOG(("OriginalPortNumber = %u", port)); - if (spareSocket == NULL) { - DEBUG_ASSERTCRASH(spareSocket != NULL, ("Could not find spare socket for send.")); + if (spareSocket == nullptr) { + DEBUG_ASSERTCRASH(spareSocket != nullptr, ("Could not find spare socket for send.")); DEBUG_LOG(("FirewallHelperClass::sendToManglerFromPort - failed to find the spare socket for port %d", port)); return FALSE; } @@ -382,7 +382,7 @@ SpareSocketStruct * FirewallHelperClass::findSpareSocketByPort(UnsignedShort por } DEBUG_LOG(("FirewallHelperClass::findSpareSocketByPort - didn't find it")); - return NULL; + return nullptr; } ManglerMessage * FirewallHelperClass::findEmptyMessage() { @@ -391,7 +391,7 @@ ManglerMessage * FirewallHelperClass::findEmptyMessage() { return &(m_messages[i]); } } - return NULL; + return nullptr; } void FirewallHelperClass::byteAdjust(ManglerData *data) { @@ -422,17 +422,17 @@ void FirewallHelperClass::byteAdjust(ManglerData *data) { *=============================================================================================*/ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, Int time) { - ManglerMessage *msg = NULL; + ManglerMessage *msg = nullptr; -// SpareSocketStruct *spareSocket = NULL; +// SpareSocketStruct *spareSocket = nullptr; sockaddr_in addr; Int i = 0; for (; i < MAX_SPARE_SOCKETS; ++i) { - if (m_spareSockets[i].udp != NULL) { + if (m_spareSockets[i].udp != nullptr) { ManglerMessage *message = findEmptyMessage(); - if (message == NULL) { + if (message == nullptr) { break; } Int retval = m_spareSockets[i].udp->Read((unsigned char *)message, sizeof(ManglerData), &addr); @@ -462,7 +462,7 @@ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, In } // See if we have already received it and saved it. - if (msg == NULL) { + if (msg == nullptr) { for (i = 0; i < MAX_SPARE_SOCKETS; ++i) { if ((m_messages[i].length != 0) && (m_messages[i].data.PacketID == packetID)) { msg = &(m_messages[i]); @@ -471,7 +471,7 @@ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, In } } - if (msg == NULL) { + if (msg == nullptr) { return 0; } @@ -1522,7 +1522,7 @@ Bool FirewallHelperClass::openSpareSocket(UnsignedShort port) { } m_spareSockets[i].udp = NEW UDP(); - if (m_spareSockets[i].udp == NULL) { + if (m_spareSockets[i].udp == nullptr) { DEBUG_LOG(("FirewallHelperClass::openSpareSocket - failed to create UDP object")); return FALSE; } @@ -1544,7 +1544,7 @@ void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { if (m_spareSockets[i].port == port) { delete m_spareSockets[i].udp; - m_spareSockets[i].udp = NULL; + m_spareSockets[i].udp = nullptr; m_spareSockets[i].port = 0; break; } @@ -1557,7 +1557,7 @@ void FirewallHelperClass::closeSpareSocket(UnsignedShort port) { void FirewallHelperClass::closeAllSpareSockets() { for (Int i = 0; i < MAX_SPARE_SOCKETS; ++i) { delete (m_spareSockets[i].udp); - m_spareSockets[i].udp = NULL; + m_spareSockets[i].udp = nullptr; m_spareSockets[i].port = 0; } } diff --git a/Core/GameEngine/Source/GameNetwork/FrameData.cpp b/Core/GameEngine/Source/GameNetwork/FrameData.cpp index da5fef6e767..88b980f33f5 100644 --- a/Core/GameEngine/Source/GameNetwork/FrameData.cpp +++ b/Core/GameEngine/Source/GameNetwork/FrameData.cpp @@ -34,7 +34,7 @@ FrameData::FrameData() { m_frame = 0; - m_commandList = NULL; + m_commandList = nullptr; m_commandCount = 0; m_frameCommandCount = -1; m_lastFailedCC = 0; @@ -47,7 +47,7 @@ FrameData::FrameData() FrameData::~FrameData() { deleteInstance(m_commandList); - m_commandList = NULL; + m_commandList = nullptr; } /** @@ -56,7 +56,7 @@ FrameData::~FrameData() void FrameData::init() { m_frame = 0; - if (m_commandList == NULL) { + if (m_commandList == nullptr) { m_commandList = newInstance(NetCommandList); m_commandList->init(); } @@ -117,7 +117,7 @@ FrameDataReturnType FrameData::allCommandsReady(Bool debugSpewage) { if (m_commandCount > m_frameCommandCount) { DEBUG_LOG(("FrameData::allCommandsReady - There are more commands than there should be (%d, should be %d). Commands in command list are...", m_commandCount, m_frameCommandCount)); NetCommandRef *ref = m_commandList->getFirstMessage(); - while (ref != NULL) { + while (ref != nullptr) { DEBUG_LOG(("%s, frame = %d, id = %d", GetNetCommandTypeAsString(ref->getCommand()->getNetCommandType()), ref->getCommand()->getExecutionFrame(), ref->getCommand()->getID())); ref = ref->getNext(); } @@ -157,12 +157,12 @@ UnsignedInt FrameData::getCommandCount() { */ void FrameData::addCommand(NetCommandMsg *msg) { // need to add the message in order of command ID - if (m_commandList == NULL) { + if (m_commandList == nullptr) { init(); } // We don't need to worry about setting the relay since its not getting sent anywhere. - if (m_commandList->findMessage(msg) != NULL) { + if (m_commandList->findMessage(msg) != nullptr) { // We don't want to add the same command twice. return; } @@ -191,7 +191,7 @@ void FrameData::zeroFrame() { * destroy all the commands in this frame. */ void FrameData::destroyGameMessages() { - if (m_commandList == NULL) { + if (m_commandList == nullptr) { return; } diff --git a/Core/GameEngine/Source/GameNetwork/FrameDataManager.cpp b/Core/GameEngine/Source/GameNetwork/FrameDataManager.cpp index 0bc84f74bec..1dfc3349306 100644 --- a/Core/GameEngine/Source/GameNetwork/FrameDataManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/FrameDataManager.cpp @@ -48,7 +48,7 @@ FrameDataManager::~FrameDataManager() { m_frameData[i].reset(); } delete[] m_frameData; - m_frameData = NULL; + m_frameData = nullptr; } /** diff --git a/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp b/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp index a9a9aca66e5..00cd5836ef5 100644 --- a/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp +++ b/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp @@ -48,13 +48,13 @@ FrameMetrics::FrameMetrics() FrameMetrics::~FrameMetrics() { delete m_fpsList; - m_fpsList = NULL; + m_fpsList = nullptr; delete m_latencyList; - m_latencyList = NULL; + m_latencyList = nullptr; delete[] m_pendingLatencies; - m_pendingLatencies = NULL; + m_pendingLatencies = nullptr; } void FrameMetrics::init() { diff --git a/Core/GameEngine/Source/GameNetwork/GameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameInfo.cpp index 6b3298d6ef3..0b5370f0947 100644 --- a/Core/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -47,7 +47,7 @@ -GameInfo *TheGameInfo = NULL; +GameInfo *TheGameInfo = nullptr; // GameSlot ---------------------------------------- @@ -285,7 +285,7 @@ GameInfo::GameInfo() { for (int i=0; i= MAX_SLOTS) return; - DEBUG_ASSERTCRASH( m_slot[slotNum], ("NULL slot pointer")); + DEBUG_ASSERTCRASH( m_slot[slotNum], ("null slot pointer")); if (!m_slot[slotNum]) return; @@ -443,9 +443,9 @@ GameSlot* GameInfo::getSlot( Int slotNum ) { DEBUG_ASSERTCRASH( slotNum >= 0 && slotNum < MAX_SLOTS, ("GameInfo::getSlot - Invalid slot number")); if (slotNum < 0 || slotNum >= MAX_SLOTS) - return NULL; + return nullptr; - DEBUG_ASSERTCRASH( m_slot[slotNum], ("NULL slot pointer") ); + DEBUG_ASSERTCRASH( m_slot[slotNum], ("null slot pointer") ); return m_slot[slotNum]; } @@ -453,9 +453,9 @@ const GameSlot* GameInfo::getConstSlot( Int slotNum ) const { DEBUG_ASSERTCRASH( slotNum >= 0 && slotNum < MAX_SLOTS, ("GameInfo::getSlot - Invalid slot number")); if (slotNum < 0 || slotNum >= MAX_SLOTS) - return NULL; + return nullptr; - DEBUG_ASSERTCRASH( m_slot[slotNum], ("NULL slot pointer") ); + DEBUG_ASSERTCRASH( m_slot[slotNum], ("null slot pointer") ); return m_slot[slotNum]; } @@ -468,7 +468,7 @@ Int GameInfo::getLocalSlotNum( void ) const for (Int i=0; iisPlayer(m_localIP)) @@ -521,7 +521,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 2; fp->close(); - fp = NULL; + fp = nullptr; } AsciiString newMapName; @@ -534,7 +534,7 @@ void GameInfo::setMap( AsciiString mapName ) // directory name, we can do this since the filename // is just the directory name with the file extention // added onto it. - while (mapName.find('\\') != NULL) + while (mapName.find('\\') != nullptr) { if (!newMapName.isEmpty()) { @@ -551,7 +551,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 4; fp->close(); - fp = NULL; + fp = nullptr; } path = GetStrFileFromMap(m_mapName); @@ -561,7 +561,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 8; fp->close(); - fp = NULL; + fp = nullptr; } path = GetSoloINIFromMap(m_mapName); @@ -571,7 +571,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 16; fp->close(); - fp = NULL; + fp = nullptr; } path = GetAssetUsageFromMap(m_mapName); @@ -581,7 +581,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 32; fp->close(); - fp = NULL; + fp = nullptr; } path = GetReadmeFromMap(m_mapName); @@ -591,7 +591,7 @@ void GameInfo::setMap( AsciiString mapName ) { m_mapMask |= 64; fp->close(); - fp = NULL; + fp = nullptr; } } else @@ -737,11 +737,11 @@ void GameInfo::resetAccepted( void ) void GameInfo::resetStartSpots() { - GameSlot *slot = NULL; + GameSlot *slot = nullptr; for (Int i = 0; i < MAX_SLOTS; ++i) { slot = getSlot(i); - if (slot != NULL) + if (slot != nullptr) { slot->setStartPos(-1); } @@ -754,7 +754,7 @@ void GameInfo::resetStartSpots() void GameInfo::adjustSlotsForMap() { const MapMetaData *md = TheMapCache->findMap(m_mapName); - if (md != NULL) + if (md != nullptr) { // get the number of players allowed from the map. Int numPlayers = md->m_numPlayers; @@ -905,7 +905,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game ) // directory name, we can do this since the filename // is just the directory name with the file extention // added onto it. - while (mapName.find('\\') != NULL) + while (mapName.find('\\') != nullptr) { if (!newMapName.isEmpty()) { @@ -997,7 +997,7 @@ static Int grabHexInt(const char *s) char tmp[5] = "0xff"; tmp[2] = s[0]; tmp[3] = s[1]; - Int b = strtol(tmp, NULL, 16); + Int b = strtol(tmp, nullptr, 16); return b; } Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) @@ -1033,15 +1033,15 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) DEBUG_LOG(("ParseAsciiStringToGameInfo - parsing [%s]", options.str())); - while ( (keyValPair = strtok_r(bufPtr, ";", &strPos)) != NULL ) + while ( (keyValPair = strtok_r(bufPtr, ";", &strPos)) != nullptr ) { - bufPtr = NULL; // strtok within the same string + bufPtr = nullptr; // strtok within the same string AsciiString key, val; - char *pos = NULL; + char *pos = nullptr; char *keyPtr, *valPtr; keyPtr = (strtok_r(keyValPair, "=", &pos)); - valPtr = (strtok_r(NULL, "\n", &pos)); + valPtr = (strtok_r(nullptr, "\n", &pos)); if (keyPtr) key = keyPtr; if (valPtr) @@ -1127,7 +1127,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) } else if (key.compare("SC") == 0 ) { - UnsignedInt startingCashAmount = strtoul( val.str(), NULL, 10 ); + UnsignedInt startingCashAmount = strtoul( val.str(), nullptr, 10 ); startingCash.init(); startingCash.deposit( startingCashAmount, FALSE, FALSE ); sawStartingCash = TRUE; @@ -1142,7 +1142,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) sawSlotlist = true; /// @TODO: Need to read in all the slot info... big mess right now. char *rawSlotBuf = strdup(val.str()); - char *freeMe = NULL; + char *freeMe = nullptr; AsciiString rawSlot; // Bool slotsOk = true; //flag that lets us know whether or not the slot list is good. @@ -1152,13 +1152,13 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) rawSlot = strtok_r(rawSlotBuf,":",&pos); if( rawSlotBuf ) freeMe = rawSlotBuf; - rawSlotBuf = NULL; + rawSlotBuf = nullptr; switch (*rawSlot.str()) { case 'H': { // DEBUG_LOG(("ParseAsciiStringToGameInfo - Human player")); - char *slotPos = NULL; + char *slotPos = nullptr; //Parse out the Name AsciiString slotValue(strtok_r((char *)rawSlot.str(),",",&slotPos)); if(slotValue.isEmpty()) @@ -1173,7 +1173,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - name is %s", slotValue.str()+1)); //Parse out the IP - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1188,7 +1188,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) newSlot[i].setState(SLOT_PLAYER, name, playerIP); // parse out the port - slotValue = strtok_r(NULL, ",", &slotPos); + slotValue = strtok_r(nullptr, ",", &slotPos); if (slotValue.isEmpty()) { optionsOk = false; @@ -1201,7 +1201,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) DEBUG_LOG(("ParseAsciiStringToGameInfo - port is %d", playerPort)); //Read if it's accepted or not - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.getLength() != 2) { optionsOk = false; @@ -1226,7 +1226,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) } //Read color index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1244,7 +1244,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - player color set to %d", color)); //Read playerTemplate index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1262,7 +1262,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - player template is %d", playerTemplate)); //Read start position index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1280,7 +1280,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - player start position is %d", startPos)); //Read team index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1298,7 +1298,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - team number is %d", team)); // Read the NAT behavior - slotValue = strtok_r(NULL, ",",&slotPos); + slotValue = strtok_r(nullptr, ",",&slotPos); if (slotValue.isEmpty()) { optionsOk = false; @@ -1319,7 +1319,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) case 'C': { DEBUG_LOG(("ParseAsciiStringToGameInfo - AI player")); - char *slotPos = NULL; + char *slotPos = nullptr; //Parse out the Name AsciiString slotValue(strtok_r((char *)rawSlot.str(),",",&slotPos)); if(slotValue.isEmpty()) @@ -1358,7 +1358,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) } //Read color index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1376,7 +1376,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - player color set to %d", color)); //Read playerTemplate index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1394,7 +1394,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - player template is %d", playerTemplate)); //Read start pos - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; @@ -1424,7 +1424,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) //DEBUG_LOG(("ParseAsciiStringToGameInfo - start spot is %d", startPos)); //Read team index - slotValue = strtok_r(NULL,",",&slotPos); + slotValue = strtok_r(nullptr,",",&slotPos); if(slotValue.isEmpty()) { optionsOk = false; diff --git a/Core/GameEngine/Source/GameNetwork/GameMessageParser.cpp b/Core/GameEngine/Source/GameNetwork/GameMessageParser.cpp index 9b289c450e5..3c7d4092425 100644 --- a/Core/GameEngine/Source/GameNetwork/GameMessageParser.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameMessageParser.cpp @@ -30,14 +30,14 @@ //---------------------------------------------------------------------------- GameMessageParser::GameMessageParser() { - m_first = NULL; + m_first = nullptr; m_argTypeCount = 0; } //---------------------------------------------------------------------------- GameMessageParser::GameMessageParser(GameMessage *msg) { - m_first = NULL; + m_first = nullptr; m_argTypeCount = 0; UnsignedByte argCount = msg->getArgumentCount(); @@ -65,8 +65,8 @@ GameMessageParser::GameMessageParser(GameMessage *msg) //---------------------------------------------------------------------------- GameMessageParser::~GameMessageParser() { - GameMessageParserArgumentType *temp = NULL; - while (m_first != NULL) { + GameMessageParserArgumentType *temp = nullptr; + while (m_first != nullptr) { temp = m_first->getNext(); deleteInstance(m_first); m_first = temp; @@ -76,7 +76,7 @@ GameMessageParser::~GameMessageParser() //---------------------------------------------------------------------------- void GameMessageParser::addArgType(GameMessageArgumentDataType type, Int argCount) { - if (m_first == NULL) { + if (m_first == nullptr) { m_first = newInstance(GameMessageParserArgumentType)(type, argCount); m_last = m_first; return; @@ -89,7 +89,7 @@ void GameMessageParser::addArgType(GameMessageArgumentDataType type, Int argCoun //---------------------------------------------------------------------------- GameMessageParserArgumentType::GameMessageParserArgumentType(GameMessageArgumentDataType type, Int argCount) { - m_next = NULL; + m_next = nullptr; m_type = type; m_argCount = argCount; } diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp index e3089d6fb6e..c9928461183 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Chat.cpp @@ -42,35 +42,35 @@ static const FieldParse GameSpyColorFieldParse[] = { - { "Default", INI::parseColorInt, NULL, OFFSET(GSCOLOR_DEFAULT) }, - { "CurrentRoom", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CURRENTROOM) }, - { "ChatRoom", INI::parseColorInt, NULL, OFFSET(GSCOLOR_ROOM) }, - { "Game", INI::parseColorInt, NULL, OFFSET(GSCOLOR_GAME) }, - { "GameFull", INI::parseColorInt, NULL, OFFSET(GSCOLOR_GAME_FULL) }, - { "GameCRCMismatch", INI::parseColorInt, NULL, OFFSET(GSCOLOR_GAME_CRCMISMATCH) }, - { "PlayerNormal", INI::parseColorInt, NULL, OFFSET(GSCOLOR_PLAYER_NORMAL) }, - { "PlayerOwner", INI::parseColorInt, NULL, OFFSET(GSCOLOR_PLAYER_OWNER) }, - { "PlayerBuddy", INI::parseColorInt, NULL, OFFSET(GSCOLOR_PLAYER_BUDDY) }, - { "PlayerSelf", INI::parseColorInt, NULL, OFFSET(GSCOLOR_PLAYER_SELF) }, - { "PlayerIgnored", INI::parseColorInt, NULL, OFFSET(GSCOLOR_PLAYER_IGNORED) }, - { "ChatNormal", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_NORMAL) }, - { "ChatEmote", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_EMOTE) }, - { "ChatOwner", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_OWNER) }, - { "ChatOwnerEmote", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_OWNER_EMOTE) }, - { "ChatPriv", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_PRIVATE) }, - { "ChatPrivEmote", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_PRIVATE_EMOTE) }, - { "ChatPrivOwner", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_PRIVATE_OWNER) }, - { "ChatPrivOwnerEmote", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_PRIVATE_OWNER_EMOTE) }, - { "ChatBuddy", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_BUDDY) }, - { "ChatSelf", INI::parseColorInt, NULL, OFFSET(GSCOLOR_CHAT_SELF) }, - { "AcceptTrue", INI::parseColorInt, NULL, OFFSET(GSCOLOR_ACCEPT_TRUE) }, - { "AcceptFalse", INI::parseColorInt, NULL, OFFSET(GSCOLOR_ACCEPT_FALSE) }, - { "MapSelected", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MAP_SELECTED) }, - { "MapUnselected", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MAP_UNSELECTED) }, - { "MOTD", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD) }, - { "MOTDHeading", INI::parseColorInt, NULL, OFFSET(GSCOLOR_MOTD_HEADING) }, - - { NULL, NULL, NULL, 0 } + { "Default", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_DEFAULT) }, + { "CurrentRoom", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CURRENTROOM) }, + { "ChatRoom", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_ROOM) }, + { "Game", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_GAME) }, + { "GameFull", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_GAME_FULL) }, + { "GameCRCMismatch", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_GAME_CRCMISMATCH) }, + { "PlayerNormal", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_PLAYER_NORMAL) }, + { "PlayerOwner", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_PLAYER_OWNER) }, + { "PlayerBuddy", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_PLAYER_BUDDY) }, + { "PlayerSelf", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_PLAYER_SELF) }, + { "PlayerIgnored", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_PLAYER_IGNORED) }, + { "ChatNormal", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_NORMAL) }, + { "ChatEmote", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_EMOTE) }, + { "ChatOwner", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_OWNER) }, + { "ChatOwnerEmote", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_OWNER_EMOTE) }, + { "ChatPriv", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_PRIVATE) }, + { "ChatPrivEmote", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_PRIVATE_EMOTE) }, + { "ChatPrivOwner", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_PRIVATE_OWNER) }, + { "ChatPrivOwnerEmote", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_PRIVATE_OWNER_EMOTE) }, + { "ChatBuddy", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_BUDDY) }, + { "ChatSelf", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_CHAT_SELF) }, + { "AcceptTrue", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_ACCEPT_TRUE) }, + { "AcceptFalse", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_ACCEPT_FALSE) }, + { "MapSelected", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_MAP_SELECTED) }, + { "MapUnselected", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_MAP_UNSELECTED) }, + { "MOTD", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_MOTD) }, + { "MOTDHeading", INI::parseColorInt, nullptr, OFFSET(GSCOLOR_MOTD_HEADING) }, + + { nullptr, nullptr, nullptr, 0 } }; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp index bc2360883a2..c4d593bbe1a 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp @@ -39,7 +39,7 @@ /////////////////////////////////////////////////////////////////////////////////////// -GameSpyConfigInterface *TheGameSpyConfig = NULL; +GameSpyConfigInterface *TheGameSpyConfig = nullptr; class GameSpyConfig : public GameSpyConfigInterface { diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp index c59f0613a2f..7fad1cbb3d6 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp @@ -40,7 +40,7 @@ #include "GameClient/MapUtil.h" -LadderList *TheLadderList = NULL; +LadderList *TheLadderList = nullptr; LadderInfo::LadderInfo() { @@ -59,7 +59,7 @@ LadderInfo::LadderInfo() static LadderInfo *parseLadder(AsciiString raw) { DEBUG_LOG(("Looking at ladder:\n%s", raw.str())); - LadderInfo *lad = NULL; + LadderInfo *lad = nullptr; AsciiString line; while (raw.nextToken(&line, "\n")) { @@ -212,8 +212,8 @@ static LadderInfo *parseLadder(AsciiString raw) { // no maps? don't play on it! delete lad; - lad = NULL; - return NULL; + lad = nullptr; + return nullptr; } } else if ( lad && line.startsWith("Map ") ) @@ -240,12 +240,12 @@ static LadderInfo *parseLadder(AsciiString raw) { // bad ladder - kill it delete lad; - lad = NULL; + lad = nullptr; } } delete lad; - return NULL; + return nullptr; } LadderList::LadderList() @@ -257,7 +257,7 @@ LadderList::LadderList() Bool inLadders = FALSE; Bool inSpecialLadders = FALSE; Bool inLadder = FALSE; - LadderInfo *lad = NULL; + LadderInfo *lad = nullptr; Int index = 1; AsciiString rawLadder; @@ -303,7 +303,7 @@ LadderList::LadderList() inLadder = FALSE; rawLadder.concat(line); rawLadder.concat('\n'); - if ((lad = parseLadder(rawLadder)) != NULL) + if ((lad = parseLadder(rawLadder)) != nullptr) { lad->index = index++; if (inLadders) @@ -384,13 +384,13 @@ const LadderInfo* LadderList::findLadder( const AsciiString& addr, UnsignedShort } } - return NULL; + return nullptr; } const LadderInfo* LadderList::findLadderByIndex( Int index ) { if (index == 0) - return NULL; + return nullptr; LadderInfoList::const_iterator cit; @@ -421,7 +421,7 @@ const LadderInfo* LadderList::findLadderByIndex( Int index ) } } - return NULL; + return nullptr; } const LadderInfoList* LadderList::getSpecialLadders( void ) @@ -475,7 +475,7 @@ void LadderList::checkLadder( AsciiString fname, Int index ) rawData.concat(buf); } fp->close(); - fp = NULL; + fp = nullptr; } DEBUG_LOG(("Read %d bytes from '%s'", rawData.getLength(), fname.str())); diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 1b72be479cd..fa26e2e8c66 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -85,12 +85,12 @@ static NameKeyType windowSortAlphaID = NAMEKEY_INVALID; static NameKeyType windowSortPingID = NAMEKEY_INVALID; static NameKeyType windowSortBuddiesID = NAMEKEY_INVALID; -static GameWindow *buttonSortAlpha = NULL; -static GameWindow *buttonSortPing = NULL; -static GameWindow *buttonSortBuddies = NULL; -static GameWindow *windowSortAlpha = NULL; -static GameWindow *windowSortPing = NULL; -static GameWindow *windowSortBuddies = NULL; +static GameWindow *buttonSortAlpha = nullptr; +static GameWindow *buttonSortPing = nullptr; +static GameWindow *buttonSortBuddies = nullptr; +static GameWindow *windowSortAlpha = nullptr; +static GameWindow *windowSortPing = nullptr; +static GameWindow *windowSortBuddies = nullptr; static GameSortType theGameSortType = GAMESORT_ALPHA_ASCENDING; static Bool sortBuddies = TRUE; @@ -184,14 +184,14 @@ static NameKeyType listboxLobbyGamesLargeID = NAMEKEY_INVALID; //static NameKeyType listboxLobbyGameInfoID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = NULL; -//static GameWindow *parentGameListSmall = NULL; -static GameWindow *parentGameListLarge = NULL; - //GameWindow *listboxLobbyGamesSmall = NULL; - GameWindow *listboxLobbyGamesLarge = NULL; - //GameWindow *listboxLobbyGameInfo = NULL; +static GameWindow *parent = nullptr; +//static GameWindow *parentGameListSmall = nullptr; +static GameWindow *parentGameListLarge = nullptr; + //GameWindow *listboxLobbyGamesSmall = nullptr; + GameWindow *listboxLobbyGamesLarge = nullptr; + //GameWindow *listboxLobbyGameInfo = nullptr; -static const Image *pingImages[3] = { NULL, NULL, NULL }; +static const Image *pingImages[3] = { nullptr, nullptr, nullptr }; static void gameTooltip(GameWindow *window, WinInstanceData *instData, @@ -225,15 +225,15 @@ static void gameTooltip(GameWindow *window, room->getPingAsInt(), TheGameSpyConfig->getPingCutoffGood(), TheGameSpyConfig->getPingCutoffBad(), TheGameSpyInfo->getPingString().str(), room->getPingString().str() ); - TheMouse->setCursorTooltip( s, 10, NULL, 2.0f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( s, 10, nullptr, 2.0f ); // the text and width are the only params used. the others are the default values. #else - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:PingInfo"), 10, NULL, 2.0f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:PingInfo"), 10, nullptr, 2.0f ); // the text and width are the only params used. the others are the default values. #endif return; } if (col == COLUMN_NUMPLAYERS) { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:NumberOfPlayers"), 10, NULL, 2.0f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:NumberOfPlayers"), 10, nullptr, 2.0f ); // the text and width are the only params used. the others are the default values. return; } if (col == COLUMN_PASSWORD) @@ -243,7 +243,7 @@ static void gameTooltip(GameWindow *window, UnicodeString checkTooltip =TheGameText->fetch("TOOTIP:Password"); if(!checkTooltip.compare(L"Password required to joing game")) checkTooltip.set(L"Password required to join game"); - TheMouse->setCursorTooltip( checkTooltip, 10, NULL, 2.0f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( checkTooltip, 10, nullptr, 2.0f ); // the text and width are the only params used. the others are the default values. } else TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); @@ -342,7 +342,7 @@ static void gameTooltip(GameWindow *window, } DEBUG_ASSERTCRASH(numPlayers, ("Tooltipping a 0-player game!")); - TheMouse->setCursorTooltip( tooltip, 10, NULL, 2.0f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( tooltip, 10, nullptr, 2.0f ); // the text and width are the only params used. the others are the default values. } static Bool isSmall = TRUE; @@ -354,7 +354,7 @@ GameWindow *GetGameListBox( void ) GameWindow *GetGameInfoListBox( void ) { - return NULL; + return nullptr; } NameKeyType GetGameListBoxID( void ) @@ -371,7 +371,7 @@ void GrabWindowInfo( void ) { isSmall = TRUE; parentID = NAMEKEY( "WOLCustomLobby.wnd:WOLLobbyMenuParent" ); - parent = TheWindowManager->winGetWindowFromId(NULL, parentID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); pingImages[0] = TheMappedImageCollection->findImageByName("Ping03"); pingImages[1] = TheMappedImageCollection->findImageByName("Ping02"); @@ -381,21 +381,21 @@ void GrabWindowInfo( void ) DEBUG_ASSERTCRASH(pingImages[2], ("Can't find ping image!")); // parentGameListSmallID = NAMEKEY( "WOLCustomLobby.wnd:ParentGameListSmall" ); -// parentGameListSmall = TheWindowManager->winGetWindowFromId(NULL, parentGameListSmallID); +// parentGameListSmall = TheWindowManager->winGetWindowFromId(nullptr, parentGameListSmallID); parentGameListLargeID = NAMEKEY( "WOLCustomLobby.wnd:ParentGameListLarge" ); - parentGameListLarge = TheWindowManager->winGetWindowFromId(NULL, parentGameListLargeID); + parentGameListLarge = TheWindowManager->winGetWindowFromId(nullptr, parentGameListLargeID); listboxLobbyGamesSmallID = NAMEKEY( "WOLCustomLobby.wnd:ListboxGames" ); -// listboxLobbyGamesSmall = TheWindowManager->winGetWindowFromId(NULL, listboxLobbyGamesSmallID); +// listboxLobbyGamesSmall = TheWindowManager->winGetWindowFromId(nullptr, listboxLobbyGamesSmallID); // listboxLobbyGamesSmall->winSetTooltipFunc(gameTooltip); listboxLobbyGamesLargeID = NAMEKEY( "WOLCustomLobby.wnd:ListboxGamesLarge" ); - listboxLobbyGamesLarge = TheWindowManager->winGetWindowFromId(NULL, listboxLobbyGamesLargeID); + listboxLobbyGamesLarge = TheWindowManager->winGetWindowFromId(nullptr, listboxLobbyGamesLargeID); listboxLobbyGamesLarge->winSetTooltipFunc(gameTooltip); // // listboxLobbyGameInfoID = NAMEKEY( "WOLCustomLobby.wnd:ListboxGameInfo" ); -// listboxLobbyGameInfo = TheWindowManager->winGetWindowFromId(NULL, listboxLobbyGameInfoID); +// listboxLobbyGameInfo = TheWindowManager->winGetWindowFromId(nullptr, listboxLobbyGameInfoID); buttonSortAlphaID = NAMEKEY("WOLCustomLobby.wnd:ButtonSortAlpha"); buttonSortPingID = NAMEKEY("WOLCustomLobby.wnd:ButtonSortPing"); @@ -417,23 +417,23 @@ void GrabWindowInfo( void ) void ReleaseWindowInfo( void ) { isSmall = TRUE; - parent = NULL; -// parentGameListSmall = NULL; - parentGameListLarge = NULL; -// listboxLobbyGamesSmall = NULL; - listboxLobbyGamesLarge = NULL; -// listboxLobbyGameInfo = NULL; - - buttonSortAlpha = NULL; - buttonSortPing = NULL; - buttonSortBuddies = NULL; - windowSortAlpha = NULL; - windowSortPing = NULL; - windowSortBuddies = NULL; + parent = nullptr; +// parentGameListSmall = nullptr; + parentGameListLarge = nullptr; +// listboxLobbyGamesSmall = nullptr; + listboxLobbyGamesLarge = nullptr; +// listboxLobbyGameInfo = nullptr; + + buttonSortAlpha = nullptr; + buttonSortPing = nullptr; + buttonSortBuddies = nullptr; + windowSortAlpha = nullptr; + windowSortPing = nullptr; + windowSortBuddies = nullptr; } typedef std::set BuddyGameSet; -static BuddyGameSet *theBuddyGames = NULL; +static BuddyGameSet *theBuddyGames = nullptr; static void populateBuddyGames(void) { BuddyInfoMap *m = TheGameSpyInfo->getBuddyMap(); @@ -466,7 +466,7 @@ static void populateBuddyGames(void) static void clearBuddyGames(void) { delete theBuddyGames; - theBuddyGames = NULL; + theBuddyGames = nullptr; } struct GameSortStruct @@ -482,8 +482,8 @@ struct GameSortStruct } // sort games with private ladders to the bottom - Bool g1UnknownLadder = (g1->getLadderPort() && TheLadderList->findLadder(g1->getLadderIP(), g1->getLadderPort()) == NULL); - Bool g2UnknownLadder = (g2->getLadderPort() && TheLadderList->findLadder(g2->getLadderIP(), g2->getLadderPort()) == NULL); + Bool g1UnknownLadder = (g1->getLadderPort() && TheLadderList->findLadder(g1->getLadderIP(), g1->getLadderPort()) == nullptr); + Bool g2UnknownLadder = (g2->getLadderPort() && TheLadderList->findLadder(g2->getLadderIP(), g2->getLadderPort()) == nullptr); if ( g1UnknownLadder ^ g2UnknownLadder ) { return g2UnknownLadder; @@ -736,7 +736,7 @@ void RefreshGameListBox( GameWindow *win, Bool showMap ) if (indexToSelect < 0 && selectedID) { - TheWindowManager->winSetLoneWindow(NULL); + TheWindowManager->winSetLoneWindow(nullptr); } } @@ -856,7 +856,7 @@ void RefreshGameListBoxes( void ) GameWindow *main = GetGameListBox(); GameWindow *info = GetGameInfoListBox(); - RefreshGameListBox( main, (info == NULL) ); + RefreshGameListBox( main, (info == nullptr) ); if (info) { diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp index c6585cef93e..9cb427a9870 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp @@ -64,14 +64,14 @@ static Bool mustDownloadPatch = FALSE; static Bool cantConnectBeforeOnline = FALSE; static std::list queuedDownloads; -static char *MOTDBuffer = NULL; -static char *configBuffer = NULL; -GameWindow *onlineCancelWindow = NULL; +static char *MOTDBuffer = nullptr; +static char *configBuffer = nullptr; +GameWindow *onlineCancelWindow = nullptr; static Bool s_asyncDNSThreadDone = TRUE; static Bool s_asyncDNSThreadSucceeded = FALSE; static Bool s_asyncDNSLookupInProgress = FALSE; -static HANDLE s_asyncDNSThreadHandle = NULL; +static HANDLE s_asyncDNSThreadHandle = nullptr; enum { LOOKUP_INPROGRESS, LOOKUP_FAILED, @@ -181,7 +181,7 @@ static void startOnline( void ) if (onlineCancelWindow) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } if (cantConnectBeforeOnline) @@ -222,10 +222,10 @@ static void startOnline( void ) SetUpGameSpy(MOTDBuffer, configBuffer); delete[] MOTDBuffer; - MOTDBuffer = NULL; + MOTDBuffer = nullptr; delete[] configBuffer; - configBuffer = NULL; + configBuffer = nullptr; #ifdef ALLOW_NON_PROFILED_LOGIN UserPreferences pref; @@ -326,7 +326,7 @@ static GHTTPBool motdCallback( GHTTPRequest request, GHTTPResult result, if (onlineCancelWindow && !checksLeftBeforeOnline) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } DEBUG_LOG(("------- Got MOTD before going online -------")); @@ -352,7 +352,7 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result, } delete[] configBuffer; - configBuffer = NULL; + configBuffer = nullptr; if (result != GHTTPSuccess || bufferLen < 100) { @@ -362,7 +362,7 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result, if (onlineCancelWindow && !checksLeftBeforeOnline) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } cantConnectBeforeOnline = TRUE; if (!checksLeftBeforeOnline) @@ -390,7 +390,7 @@ static GHTTPBool configCallback( GHTTPRequest request, GHTTPResult result, if (onlineCancelWindow && !checksLeftBeforeOnline) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } DEBUG_LOG(("Got Config before going online")); @@ -449,11 +449,11 @@ static GHTTPBool configHeadCallback( GHTTPRequest request, GHTTPResult result, if (onlineCancelWindow && !checksLeftBeforeOnline) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } delete[] configBuffer; - configBuffer = NULL; + configBuffer = nullptr; AsciiString fname; fname.format("%sGeneralsOnline\\Config.txt", TheGlobalData->getPath_UserData().str()); @@ -561,15 +561,15 @@ void CancelPatchCheckCallback( void ) if (onlineCancelWindow) { TheWindowManager->winDestroy(onlineCancelWindow); - onlineCancelWindow = NULL; + onlineCancelWindow = nullptr; } queuedDownloads.clear(); delete[] MOTDBuffer; - MOTDBuffer = NULL; + MOTDBuffer = nullptr; delete[] configBuffer; - configBuffer = NULL; + configBuffer = nullptr; } /////////////////////////////////////////////////////////////////////////////////////// @@ -588,7 +588,7 @@ static GHTTPBool overallStatsCallback( GHTTPRequest request, GHTTPResult result, Int state = STATS_MAX; // STATS_MAX == none AsciiString line; - OverallStats *stats = NULL; + OverallStats *stats = nullptr; while (message.nextToken(&line, "\n")) { line.trim(); @@ -646,7 +646,7 @@ static GHTTPBool overallStatsCallback( GHTTPRequest request, GHTTPResult result, stats->losses[state] = atoi(lossesLine.str()); } - stats = NULL; + stats = nullptr; } } @@ -694,7 +694,7 @@ void CheckOverallStats( void ) #elif RTS_ZEROHOUR const char *const url = "http://gamestats.gamespy.com/ccgenzh/display.html"; #endif - ghttpGet(url, GHTTPFalse, overallStatsCallback, NULL); + ghttpGet(url, GHTTPFalse, overallStatsCallback, nullptr); } /////////////////////////////////////////////////////////////////////////////////////// @@ -706,7 +706,7 @@ void CheckNumPlayersOnline( void ) #elif RTS_ZEROHOUR const char *const url = "http://launch.gamespyarcade.com/software/launch/arcadecount2.dll?svcname=ccgenzh"; #endif - ghttpGet(url, GHTTPFalse, numPlayersOnlineCallback, NULL); + ghttpGet(url, GHTTPFalse, numPlayersOnlineCallback, nullptr); } /////////////////////////////////////////////////////////////////////////////////////// @@ -739,9 +739,9 @@ int asyncGethostbyname(char * szName) { /* Kick off gethostname thread */ s_asyncDNSThreadDone = FALSE; - s_asyncDNSThreadHandle = CreateThread( NULL, 0, asyncGethostbynameThreadFunc, szName, 0, &threadid ); + s_asyncDNSThreadHandle = CreateThread( nullptr, 0, asyncGethostbynameThreadFunc, szName, 0, &threadid ); - if( s_asyncDNSThreadHandle == NULL ) + if( s_asyncDNSThreadHandle == nullptr ) { return( LOOKUP_FAILED ); } @@ -754,7 +754,7 @@ int asyncGethostbyname(char * szName) /* Thread finished */ stat = 0; s_asyncDNSLookupInProgress = FALSE; - s_asyncDNSThreadHandle = NULL; + s_asyncDNSThreadHandle = nullptr; return( (s_asyncDNSThreadSucceeded)?LOOKUP_SUCCEEDED:LOOKUP_FAILED ); } } @@ -814,7 +814,7 @@ void StopAsyncDNSCheck( void ) TerminateThread(s_asyncDNSThreadHandle,0); DEBUG_ASSERTCRASH(res, ("Could not terminate the Async DNS Lookup thread!")); // Thread still not killed! } - s_asyncDNSThreadHandle = NULL; + s_asyncDNSThreadHandle = nullptr; s_asyncDNSLookupInProgress = FALSE; } diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index cd67390e83f..7a244e736f1 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -47,8 +47,8 @@ #include "GameLogic/GameLogic.h" -GameSpyInfoInterface *TheGameSpyInfo = NULL; -extern GameSpyStagingRoom *TheGameSpyGame = NULL; +GameSpyInfoInterface *TheGameSpyInfo = nullptr; +extern GameSpyStagingRoom *TheGameSpyGame = nullptr; void deleteNotificationBox( void ); bool AsciiComparator::operator()(AsciiString s1, AsciiString s2) const @@ -65,7 +65,7 @@ GameSpyInfo::GameSpyInfo() GameSpyInfo::~GameSpyInfo() { - TheGameSpyGame = NULL; + TheGameSpyGame = nullptr; reset(); } @@ -157,7 +157,7 @@ GameSpyStagingRoom* GameSpyInfo::getCurrentStagingRoom( void ) if (it != m_stagingRooms.end()) return it->second; - return NULL; + return nullptr; } void GameSpyInfo::setGameOptions( void ) @@ -408,12 +408,12 @@ void GameSpyInfo::joinBestGroupRoom( void ) } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSGroupRoomJoinFail"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSGroupRoomJoinFail"), nullptr); } } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSGroupRoomJoinFail"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSGroupRoomJoinFail"), nullptr); } } @@ -498,7 +498,7 @@ GameSpyStagingRoom* GameSpyInfo::findStagingRoomByID( Int id ) if (it != m_stagingRooms.end()) return it->second; - return NULL; + return nullptr; } void GameSpyInfo::leaveStagingRoom( void ) @@ -605,11 +605,11 @@ void SetUpGameSpy( const char *motdBuffer, const char *configBuffer ) TearDownGameSpy(); AsciiString dir = TheGlobalData->getPath_UserData(); - CreateDirectory(dir.str(), NULL); + CreateDirectory(dir.str(), nullptr); dir.format("%sGeneralsOnline", TheGlobalData->getPath_UserData().str()); - CreateDirectory(dir.str(), NULL); + CreateDirectory(dir.str(), nullptr); dir.format("%sGeneralsOnline\\Ladders", TheGlobalData->getPath_UserData().str()); - CreateDirectory(dir.str(), NULL); + CreateDirectory(dir.str(), nullptr); TheGameSpyBuddyMessageQueue = GameSpyBuddyMessageQueueInterface::createNewMessageQueue(); TheGameSpyBuddyMessageQueue->startThread(); @@ -671,16 +671,16 @@ void TearDownGameSpy( void ) ThePinger->endThreads(); delete TheRankPointValues; - TheRankPointValues = NULL; + TheRankPointValues = nullptr; delete TheGameSpyPSMessageQueue; - TheGameSpyPSMessageQueue = NULL; + TheGameSpyPSMessageQueue = nullptr; delete TheGameSpyBuddyMessageQueue; - TheGameSpyBuddyMessageQueue = NULL; + TheGameSpyBuddyMessageQueue = nullptr; delete TheGameSpyPeerMessageQueue; - TheGameSpyPeerMessageQueue = NULL; + TheGameSpyPeerMessageQueue = nullptr; if (TheGameSpyInfo) { @@ -690,17 +690,17 @@ void TearDownGameSpy( void ) SignalUIInteraction(SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGOUT); } delete TheGameSpyInfo; - TheGameSpyInfo = NULL; + TheGameSpyInfo = nullptr; } delete ThePinger; - ThePinger = NULL; + ThePinger = nullptr; delete TheLadderList; - TheLadderList = NULL; + TheLadderList = nullptr; delete TheGameSpyConfig; - TheGameSpyConfig = NULL; + TheGameSpyConfig = nullptr; // make sure the notification box doesn't exist deleteNotificationBox(); @@ -758,7 +758,7 @@ static Int grabHexInt(const char *s) char tmp[5] = "0xff"; tmp[2] = s[0]; tmp[3] = s[1]; - Int b = strtol(tmp, NULL, 16); + Int b = strtol(tmp, nullptr, 16); return b; } diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index 278f991793a..7c94d2ca628 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -191,7 +191,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load INETMIB1.DLL")); HINSTANCE mib_ii_dll = LoadLibrary("inetmib1.dll"); - if (mib_ii_dll == NULL) { + if (mib_ii_dll == nullptr) { DEBUG_LOG(("Failed to load INETMIB1.DLL")); return(false); } @@ -199,7 +199,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load SNMPAPI.DLL")); HINSTANCE snmpapi_dll = LoadLibrary("snmpapi.dll"); - if (snmpapi_dll == NULL) { + if (snmpapi_dll == nullptr) { DEBUG_LOG(("Failed to load SNMPAPI.DLL")); FreeLibrary(mib_ii_dll); return(false); @@ -212,7 +212,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP SnmpExtensionQueryPtr = (int (__stdcall *)(unsigned char,SnmpVarBindList *,long *,long *)) GetProcAddress(mib_ii_dll, "SnmpExtensionQuery"); SnmpUtilMemAllocPtr = (void *(__stdcall *)(unsigned long)) GetProcAddress(snmpapi_dll, "SnmpUtilMemAlloc"); SnmpUtilMemFreePtr = (void (__stdcall *)(void *)) GetProcAddress(snmpapi_dll, "SnmpUtilMemFree"); - if (SnmpExtensionInitPtr == NULL || SnmpExtensionQueryPtr == NULL || SnmpUtilMemAllocPtr == NULL || SnmpUtilMemFreePtr == NULL) { + if (SnmpExtensionInitPtr == nullptr || SnmpExtensionQueryPtr == nullptr || SnmpUtilMemAllocPtr == nullptr || SnmpUtilMemFreePtr == nullptr) { DEBUG_LOG(("Failed to get proc addresses for linked functions")); FreeLibrary(snmpapi_dll); FreeLibrary(mib_ii_dll); @@ -448,7 +448,7 @@ GameSpyStagingRoom::GameSpyStagingRoom() cleanUpSlotPointers(); setLocalIP(0); - m_transport = NULL; + m_transport = nullptr; m_localName = "localhost"; @@ -514,7 +514,7 @@ Int GameSpyStagingRoom::getLocalSlotNum( void ) const for (Int i=0; iisPlayer(localName)) @@ -527,14 +527,14 @@ void GameSpyStagingRoom::startGame(Int gameID) { DEBUG_ASSERTCRASH(m_inGame, ("Starting a game while not in game")); DEBUG_LOG(("GameSpyStagingRoom::startGame - game id = %d", gameID)); - DEBUG_ASSERTCRASH(m_transport == NULL, ("m_transport is not NULL when it should be")); - DEBUG_ASSERTCRASH(TheNAT == NULL, ("TheNAT is not NULL when it should be")); + DEBUG_ASSERTCRASH(m_transport == nullptr, ("m_transport is not null when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not null when it should be")); UnsignedInt localIP = TheGameSpyInfo->getInternalIP(); setLocalIP(localIP); delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; // fill in GS-specific info Int numHumans = 0; @@ -800,10 +800,10 @@ void GameSpyStagingRoom::launchGame( void ) // Set up the game network AsciiString user; AsciiString userList; - DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); + DEBUG_ASSERTCRASH(TheNetwork == nullptr, ("For some reason TheNetwork isn't null at the start of this game. Better look into that.")); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; // Time to initialize TheNetwork for this game. TheNetwork = NetworkInterface::createNetwork(); @@ -826,12 +826,12 @@ void GameSpyStagingRoom::launchGame( void ) // see if we really have the map. if not, back out. TheMapCache->updateCache(); - if (!filesOk || TheMapCache->findMap(getMap()) == NULL) + if (!filesOk || TheMapCache->findMap(getMap()) == nullptr) { DEBUG_LOG(("After transfer, we didn't really have the map. Bailing...")); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:CouldNotTransferMap")); @@ -865,7 +865,7 @@ void GameSpyStagingRoom::launchGame( void ) TheGameSpyBuddyMessageQueue->addRequest(req); delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; } void GameSpyStagingRoom::reset(void) diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp index da36009076c..50e2180d83d 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/BuddyThread.cpp @@ -126,7 +126,7 @@ enum CallbackType void callbackWrapper( GPConnection *con, void *arg, void *param ) { CallbackType info = (CallbackType)(Int)param; - BuddyThreadClass *thread = MESSAGE_QUEUE->getThread() ? MESSAGE_QUEUE->getThread() : NULL /*(TheGameSpyBuddyMessageQueue)?TheGameSpyBuddyMessageQueue->getThread():NULL*/; + BuddyThreadClass *thread = MESSAGE_QUEUE->getThread() ? MESSAGE_QUEUE->getThread() : nullptr /*(TheGameSpyBuddyMessageQueue)?TheGameSpyBuddyMessageQueue->getThread():nullptr*/; if (!thread) return; @@ -154,7 +154,7 @@ void callbackWrapper( GPConnection *con, void *arg, void *param ) GameSpyBuddyMessageQueue::GameSpyBuddyMessageQueue() { - m_thread = NULL; + m_thread = nullptr; } GameSpyBuddyMessageQueue::~GameSpyBuddyMessageQueue() @@ -181,7 +181,7 @@ void GameSpyBuddyMessageQueue::startThread( void ) void GameSpyBuddyMessageQueue::endThread( void ) { delete m_thread; - m_thread = NULL; + m_thread = nullptr; } Bool GameSpyBuddyMessageQueue::isThreadRunning( void ) diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp index 6d8cc679b22..6c13e2561bc 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/GameResultsThread.cpp @@ -105,7 +105,7 @@ GameResultsQueue::GameResultsQueue() : m_requestCount(0), m_responseCount(0) { for (Int i=0; ikeyvals) { DEBUG_CRASH(("Referencing a missing server!")); - return 0; + return nullptr; } return it->second; } - return 0; + return nullptr; } Int PeerThreadClass::findServer( SBServer server ) @@ -457,7 +457,7 @@ Int PeerThreadClass::findServer( SBServer server ) UnsignedShort newPrivatePort = SBServerGetPrivateQueryPort(server); UnsignedInt newPublicIP = SBServerGetPublicInetAddress(server); - SBServer serverToRemove = NULL; + SBServer serverToRemove = nullptr; for (std::map::iterator it = m_stagingServers.begin(); it != m_stagingServers.end(); ++it) { @@ -511,7 +511,7 @@ void connectCallbackWrapper( PEER peer, PEERBool success, int failureReason, voi DEBUG_LOG(("In connectCallbackWrapper()")); CheckServers(peer); #endif // SERVER_DEBUGGING - if (param != NULL) + if (param != nullptr) { ((PeerThreadClass *)param)->connectCallback( peer, success ); } @@ -519,7 +519,7 @@ void connectCallbackWrapper( PEER peer, PEERBool success, int failureReason, voi void nickErrorCallbackWrapper( PEER peer, Int type, const char *nick, int numSuggestedNicks, const gsi_char** suggestedNicks, void *param ) { - if (param != NULL) + if (param != nullptr) { ((PeerThreadClass *)param)->nickErrorCallback( peer, type, nick ); } @@ -531,7 +531,7 @@ static void joinRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, GameSpyPeerMessageQueue::GameSpyPeerMessageQueue() { - m_thread = NULL; + m_thread = nullptr; m_serialAuth = SERIAL_OK; } @@ -559,7 +559,7 @@ void GameSpyPeerMessageQueue::startThread( void ) void GameSpyPeerMessageQueue::endThread( void ) { delete m_thread; - m_thread = NULL; + m_thread = nullptr; } Bool GameSpyPeerMessageQueue::isThreadRunning( void ) @@ -1135,7 +1135,7 @@ void checkQR2Queries( PEER peer, SOCKET sock ) while (1) { - error = select(FD_SETSIZE, &set, NULL, NULL, &timeout); + error = select(FD_SETSIZE, &set, nullptr, nullptr, &timeout); if (SOCKET_ERROR == error || 0 == error) return; //else we have data @@ -1191,7 +1191,7 @@ void PeerThreadClass::Thread_Function() m_qmGroupRoom = 0; peer = peerInitialize( &callbacks ); - DEBUG_ASSERTCRASH( peer != NULL, ("NULL peer!") ); + DEBUG_ASSERTCRASH( peer != nullptr, ("null peer!") ); m_isConnected = m_isConnecting = false; qr2_register_key(EXECRC_KEY, EXECRC_STR); @@ -1322,7 +1322,7 @@ void PeerThreadClass::Thread_Function() { DEBUG_CRASH(("Error setting title")); peerShutdown( peer ); - peer = NULL; + peer = nullptr; return; } @@ -1406,8 +1406,8 @@ void PeerThreadClass::Thread_Function() s_lastStateChangedHeartbeat = 0; s_wantStateChangedHeartbeat = FALSE; peerStopGame( peer ); - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); if (qr2Sock != INVALID_SOCKET) { closesocket(qr2Sock); @@ -1422,16 +1422,16 @@ void PeerThreadClass::Thread_Function() case PeerRequest::PEERREQUEST_LEAVEGROUPROOM: m_groupRoomID = 0; updateBuddyStatus( BUDDY_ONLINE ); - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); m_isHosting = false; + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); m_isHosting = false; break; case PeerRequest::PEERREQUEST_JOINSTAGINGROOM: { m_groupRoomID = 0; updateBuddyStatus( BUDDY_ONLINE ); - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); m_isHosting = false; + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); m_isHosting = false; SBServer server = findServerByID(incomingRequest.stagingRoom.id); m_localStagingServerName = incomingRequest.text; DEBUG_LOG(("Setting m_localStagingServerName to [%ls]", m_localStagingServerName.c_str())); @@ -1456,8 +1456,8 @@ void PeerThreadClass::Thread_Function() case PeerRequest::PEERREQUEST_LEAVESTAGINGROOM: m_groupRoomID = 0; updateBuddyStatus( BUDDY_ONLINE ); - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); isThreadHosting = 0; // debugging s_lastStateChangedHeartbeat = 0; s_wantStateChangedHeartbeat = FALSE; @@ -1513,8 +1513,8 @@ void PeerThreadClass::Thread_Function() snprintf(values[4], 20, "%d", incomingRequest.statsToPush.side); snprintf(values[5], 20, "%d", incomingRequest.statsToPush.preorder); peerSetGlobalKeys(peer, 6, (const char **)keys, (const char **)values); - peerSetGlobalWatchKeys(peer, GroupRoom, 0, NULL, PEERFalse); - peerSetGlobalWatchKeys(peer, StagingRoom, 0, NULL, PEERFalse); + peerSetGlobalWatchKeys(peer, GroupRoom, 0, nullptr, PEERFalse); + peerSetGlobalWatchKeys(peer, StagingRoom, 0, nullptr, PEERFalse); peerSetGlobalWatchKeys(peer, GroupRoom, 6, keys, PEERTrue); peerSetGlobalWatchKeys(peer, StagingRoom, 6, keys, PEERTrue); #endif @@ -1578,8 +1578,8 @@ void PeerThreadClass::Thread_Function() updateBuddyStatus( BUDDY_ONLINE ); if (!incomingRequest.stagingRoomCreation.restrictGameList) { - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); } m_isHosting = TRUE; @@ -1631,7 +1631,7 @@ void PeerThreadClass::Thread_Function() DEBUG_LOG(("Requesting to join room %d", m_localRoomID)); if (incomingRequest.stagingRoomCreation.restrictGameList) { - peerLeaveRoom( peer, StagingRoom, NULL ); + peerLeaveRoom( peer, StagingRoom, nullptr ); } else { @@ -1645,7 +1645,7 @@ void PeerThreadClass::Thread_Function() { if (incomingRequest.stagingRoomCreation.restrictGameList) { - peerLeaveRoom( peer, GroupRoom, NULL ); + peerLeaveRoom( peer, GroupRoom, nullptr ); } isThreadHosting = 1; // debugging s_lastStateChangedHeartbeat = timeGetTime(); // wait the full interval before updating state @@ -1696,7 +1696,7 @@ void PeerThreadClass::Thread_Function() resp.stagingRoom.percentComplete = 0; clearServers(); TheGameSpyPeerMessageQueue->addResponse(resp); - peerStartListingGames( peer, allKeysArray, NumKeys, (incomingRequest.gameList.restrictGameList?"~":NULL), listingGamesCallback, this ); + peerStartListingGames( peer, allKeysArray, NumKeys, (incomingRequest.gameList.restrictGameList?"~":nullptr), listingGamesCallback, this ); } break; @@ -1708,7 +1708,7 @@ void PeerThreadClass::Thread_Function() case PeerRequest::PEERREQUEST_STARTGAME: { - peerStartGame( peer, NULL, PEER_STOP_REPORTING); + peerStartGame( peer, nullptr, PEER_STOP_REPORTING); } break; @@ -1804,7 +1804,7 @@ static Int matchbotProfileID = 0; void quickmatchEnumPlayersCallback( PEER peer, PEERBool success, RoomType roomType, int index, const char * nick, int flags, void * param ) { PeerThreadClass *t = (PeerThreadClass *)param; - if (!t || !success || nick == NULL || nick[0] == '\0') + if (!t || !success || nick == nullptr || nick[0] == '\0') { t->sawEndOfEnumPlayers(); return; @@ -1958,8 +1958,8 @@ void PeerThreadClass::doQuickMatch( PEER peer ) TheGameSpyPeerMessageQueue->addResponse(resp); m_groupRoomID = m_qmGroupRoom; - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); m_isHosting = false; + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); m_isHosting = false; m_localRoomID = m_groupRoomID; m_roomJoined = false; DEBUG_LOG(("Requesting to join room %d in thread %X", m_localRoomID, this)); @@ -2064,8 +2064,8 @@ void PeerThreadClass::doQuickMatch( PEER peer ) case QM_MATCHED: { // leave QM channel, and clean up. Our work here is done. - peerLeaveRoom( peer, GroupRoom, NULL ); - peerLeaveRoom( peer, StagingRoom, NULL ); m_isHosting = false; + peerLeaveRoom( peer, GroupRoom, nullptr ); + peerLeaveRoom( peer, StagingRoom, nullptr ); m_isHosting = false; m_qmStatus = QM_STOPPED; peerLeaveRoom(peer, GroupRoom, ""); @@ -2101,7 +2101,7 @@ void PeerThreadClass::doQuickMatch( PEER peer ) static void getPlayerProfileIDCallback(PEER peer, PEERBool success, const char * nick, int profileID, void * param) { - if (success && param != NULL) + if (success && param != nullptr) { *((Int *)param) = profileID; } @@ -2204,7 +2204,7 @@ static void joinRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, // Gets called once for each group room when listing group rooms. // After this has been called for each group room, it will be -// called one more time with groupID==0 and name==NULL. +// called one more time with groupID==0 and name==nullptr. ///////////////////////////////////////////////////////////////// static void listGroupRoomsCallback(PEER peer, PEERBool success, int groupID, SBServer server, @@ -2287,7 +2287,7 @@ void PeerThreadClass::connectCallback( PEER peer, PEERBool success ) DEBUG_LOG(("Before peerListGroupRooms()")); CheckServers(peer); #endif // SERVER_DEBUGGING - peerListGroupRooms( peer, NULL, listGroupRoomsCallback, this, PEERTrue ); + peerListGroupRooms( peer, nullptr, listGroupRoomsCallback, this, PEERTrue ); #ifdef SERVER_DEBUGGING DEBUG_LOG(("After peerListGroupRooms()")); CheckServers(peer); @@ -2329,7 +2329,7 @@ void PeerThreadClass::nickErrorCallback( PEER peer, Int type, const char *nick ) TheGameSpyPeerMessageQueue->addResponse(resp); // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); } } else @@ -2340,7 +2340,7 @@ void PeerThreadClass::nickErrorCallback( PEER peer, Int type, const char *nick ) TheGameSpyPeerMessageQueue->addResponse(resp); // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); } } @@ -2391,7 +2391,7 @@ void roomMessageCallback(PEER peer, RoomType roomType, const char * nick, const { if (resp.message.profileID == matchbotProfileID) { - char *lastStr = NULL; + char *lastStr = nullptr; char *cmd = strtok_r((char *)message, " ", &lastStr); if ( cmd && strcmp(cmd, "MBOT:POOLSIZE") == 0 ) { @@ -2399,8 +2399,8 @@ void roomMessageCallback(PEER peer, RoomType roomType, const char * nick, const while (1) { - char *poolStr = strtok_r(NULL, " ", &lastStr); - char *sizeStr = strtok_r(NULL, " ", &lastStr); + char *poolStr = strtok_r(nullptr, " ", &lastStr); + char *sizeStr = strtok_r(nullptr, " ", &lastStr); if (poolStr && sizeStr) { Int pool = atoi(poolStr); @@ -2451,12 +2451,12 @@ void playerMessageCallback(PEER peer, const char * nick, const char * message, M { if (resp.message.isPrivate && resp.message.profileID == matchbotProfileID) { - char *lastStr = NULL; + char *lastStr = nullptr; char *cmd = strtok_r((char *)message, " ", &lastStr); if ( cmd && strcmp(cmd, "MBOT:MATCHED") == 0 ) { - char *mapNumStr = strtok_r(NULL, " ", &lastStr); - char *seedStr = strtok_r(NULL, " ", &lastStr); + char *mapNumStr = strtok_r(nullptr, " ", &lastStr); + char *seedStr = strtok_r(nullptr, " ", &lastStr); char *playerStr[MAX_SLOTS]; char *playerIPStr[MAX_SLOTS]; char *playerSideStr[MAX_SLOTS]; @@ -2465,22 +2465,22 @@ void playerMessageCallback(PEER peer, const char * nick, const char * message, M Int numPlayers = 0; for (Int i=0; i 0) { char *dest = NEW char[len]; - WideCharToMultiByte( CP_UTF8, 0, orig, -1, dest, len, NULL, NULL ); + WideCharToMultiByte( CP_UTF8, 0, orig, -1, dest, len, nullptr, nullptr ); dest[len-1] = 0; ret = dest; delete[] dest; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp b/Core/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp index 10af680e1b0..209e1d3bed8 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpyOverlay.cpp @@ -44,9 +44,9 @@ void deleteNotificationBox( void ); static void raiseOverlays( void ); // Message boxes ------------------------------------- -static GameWindow *messageBoxWindow = NULL; -static GameWinMsgBoxFunc okFunc = NULL; -static GameWinMsgBoxFunc cancelFunc = NULL; +static GameWindow *messageBoxWindow = nullptr; +static GameWinMsgBoxFunc okFunc = nullptr; +static GameWinMsgBoxFunc cancelFunc = nullptr; static Bool reOpenPlayerInfoFlag = FALSE; /** * messageBoxOK is called when a message box is destroyed @@ -55,11 +55,11 @@ static Bool reOpenPlayerInfoFlag = FALSE; static void messageBoxOK( void ) { DEBUG_ASSERTCRASH(messageBoxWindow, ("Message box window went away without being there in the first place!")); - messageBoxWindow = NULL; + messageBoxWindow = nullptr; if (okFunc) { okFunc(); - okFunc = NULL; + okFunc = nullptr; } } @@ -70,11 +70,11 @@ static void messageBoxOK( void ) static void messageBoxCancel( void ) { DEBUG_ASSERTCRASH(messageBoxWindow, ("Message box window went away without being there in the first place!")); - messageBoxWindow = NULL; + messageBoxWindow = nullptr; if (cancelFunc) { cancelFunc(); - cancelFunc = NULL; + cancelFunc = nullptr; } } @@ -88,17 +88,17 @@ void ClearGSMessageBoxes( void ) if (messageBoxWindow) { TheWindowManager->winDestroy(messageBoxWindow); - messageBoxWindow = NULL; + messageBoxWindow = nullptr; } if (okFunc) { - okFunc = NULL; + okFunc = nullptr; } if (cancelFunc) { - cancelFunc = NULL; + cancelFunc = nullptr; } } @@ -172,15 +172,15 @@ static const char * gsOverlays[GSOVERLAY_MAX] = static WindowLayout *overlayLayouts[GSOVERLAY_MAX] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, }; static void buddyTryReconnect( void ) @@ -200,12 +200,12 @@ void GameSpyOpenOverlay( GSOverlayType overlay ) if (TheGameSpyBuddyMessageQueue->getLocalProfileID()) { // used to be connected - GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, NULL); + GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, nullptr); } else { // no profile - GSMessageBoxOk(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPNoProfile"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPNoProfile"), nullptr); } return; } @@ -268,13 +268,13 @@ void GameSpyCloseOverlay( GSOverlayType overlay ) overlayLayouts[overlay]->runShutdown(); overlayLayouts[overlay]->destroyWindows(); deleteInstance(overlayLayouts[overlay]); - overlayLayouts[overlay] = NULL; + overlayLayouts[overlay] = nullptr; } } Bool GameSpyIsOverlayOpen( GSOverlayType overlay ) { - return (overlayLayouts[overlay] != NULL); + return (overlayLayouts[overlay] != nullptr); } void GameSpyToggleOverlay( GSOverlayType overlay ) diff --git a/Core/GameEngine/Source/GameNetwork/IPEnumeration.cpp b/Core/GameEngine/Source/GameNetwork/IPEnumeration.cpp index 9336b820640..4bc28109463 100644 --- a/Core/GameEngine/Source/GameNetwork/IPEnumeration.cpp +++ b/Core/GameEngine/Source/GameNetwork/IPEnumeration.cpp @@ -30,7 +30,7 @@ IPEnumeration::IPEnumeration( void ) { - m_IPlist = NULL; + m_IPlist = nullptr; m_isWinsockInitialized = false; } @@ -63,12 +63,12 @@ EnumeratedIP * IPEnumeration::getAddresses( void ) int err = WSAStartup(verReq, &wsadata); if (err != 0) { - return NULL; + return nullptr; } if ((LOBYTE(wsadata.wVersion) != 2) || (HIBYTE(wsadata.wVersion) !=2)) { WSACleanup(); - return NULL; + return nullptr; } m_isWinsockInitialized = true; } @@ -78,23 +78,23 @@ EnumeratedIP * IPEnumeration::getAddresses( void ) if (gethostname(hostname, sizeof(hostname))) { DEBUG_LOG(("Failed call to gethostname; WSAGetLastError returned %d", WSAGetLastError())); - return NULL; + return nullptr; } DEBUG_LOG(("Hostname is '%s'", hostname)); // get host information from the host name HOSTENT* hostEnt = gethostbyname(hostname); - if (hostEnt == NULL) + if (hostEnt == nullptr) { DEBUG_LOG(("Failed call to gethostbyname; WSAGetLastError returned %d", WSAGetLastError())); - return NULL; + return nullptr; } // sanity-check the length of the IP adress if (hostEnt->h_length != 4) { DEBUG_LOG(("gethostbyname returns oddly-sized IP addresses!")); - return NULL; + return nullptr; } // TheSuperHackers @feature Add one unique local host IP address for each multi client instance. @@ -111,7 +111,7 @@ EnumeratedIP * IPEnumeration::getAddresses( void ) // construct a list of addresses int numAddresses = 0; char *entry; - while ( (entry = hostEnt->h_addr_list[numAddresses++]) != 0 ) + while ( (entry = hostEnt->h_addr_list[numAddresses++]) != nullptr ) { addNewIP( (UnsignedByte)entry[0], @@ -141,7 +141,7 @@ void IPEnumeration::addNewIP( UnsignedByte a, UnsignedByte b, UnsignedByte c, Un if (!m_IPlist) { m_IPlist = newIP; - newIP->setNext(NULL); + newIP->setNext(nullptr); } else { diff --git a/Core/GameEngine/Source/GameNetwork/LANAPI.cpp b/Core/GameEngine/Source/GameNetwork/LANAPI.cpp index 86db49cbc7d..6c4ebe15b43 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -58,29 +58,29 @@ LANGame::LANGame( void ) } m_lastHeard = 0; m_inProgress = false; - m_next = NULL; + m_next = nullptr; } */ -LANAPI::LANAPI( void ) : m_transport(NULL) +LANAPI::LANAPI( void ) : m_transport(nullptr) { DEBUG_LOG(("LANAPI::LANAPI() - max game option size is %d, sizeof(LANMessage)=%d, MAX_PACKET_SIZE=%d", m_lanMaxOptionsLength, sizeof(LANMessage), MAX_PACKET_SIZE)); m_lastResendTime = 0; // - m_lobbyPlayers = NULL; - m_games = NULL; + m_lobbyPlayers = nullptr; + m_games = nullptr; m_name = L""; // safe default? m_pendingAction = ACT_NONE; m_expiration = 0; m_localIP = 0; m_inLobby = true; m_isInLANMenu = TRUE; - m_currentGame = NULL; + m_currentGame = nullptr; m_broadcastAddr = INADDR_BROADCAST; m_directConnectRemoteIP = 0; m_actionTimeout = 5000; // ms @@ -107,7 +107,7 @@ void LANAPI::init( void ) m_expiration = 0; m_inLobby = true; m_isInLANMenu = TRUE; - m_currentGame = NULL; + m_currentGame = nullptr; m_directConnectRemoteIP = 0; m_lastGameopt = ""; @@ -149,7 +149,7 @@ void LANAPI::reset( void ) m_transport->update(); LANGameInfo *theGame = m_games; - LANGameInfo *deletableGame = NULL; + LANGameInfo *deletableGame = nullptr; while (theGame) { @@ -159,7 +159,7 @@ void LANAPI::reset( void ) } LANPlayer *thePlayer = m_lobbyPlayers; - LANPlayer *deletablePlayer = NULL; + LANPlayer *deletablePlayer = nullptr; while (thePlayer) { @@ -168,14 +168,14 @@ void LANAPI::reset( void ) delete deletablePlayer; } - m_games = NULL; - m_lobbyPlayers = NULL; + m_games = nullptr; + m_lobbyPlayers = nullptr; m_directConnectRemoteIP = 0; m_pendingAction = ACT_NONE; m_expiration = 0; m_inLobby = true; m_isInLANMenu = TRUE; - m_currentGame = NULL; + m_currentGame = nullptr; } @@ -185,14 +185,14 @@ void LANAPI::sendMessage(LANMessage *msg, UnsignedInt ip /* = 0 */) { m_transport->queueSend(ip, lobbyPort, (unsigned char *)msg, sizeof(LANMessage) /*, 0, 0 */); } - else if ((m_currentGame != NULL) && (m_currentGame->getIsDirectConnect())) + else if ((m_currentGame != nullptr) && (m_currentGame->getIsDirectConnect())) { Int localSlot = m_currentGame->getLocalSlotNum(); for (Int i = 0; i < MAX_SLOTS; ++i) { if (i != localSlot) { GameSlot *slot = m_currentGame->getSlot(i); - if ((slot != NULL) && (slot->isHuman())) { + if ((slot != nullptr) && (slot->isHuman())) { m_transport->queueSend(slot->getIP(), lobbyPort, (unsigned char *)msg, sizeof(LANMessage) /*, 0, 0 */); } } @@ -561,21 +561,21 @@ void LANAPI::update( void ) switch (m_pendingAction) { case ACT_JOIN: - OnGameJoin(RET_TIMEOUT, NULL); + OnGameJoin(RET_TIMEOUT, nullptr); m_pendingAction = ACT_NONE; - m_currentGame = NULL; + m_currentGame = nullptr; m_inLobby = true; break; case ACT_LEAVE: OnPlayerLeave(m_name); m_pendingAction = ACT_NONE; - m_currentGame = NULL; + m_currentGame = nullptr; m_inLobby = true; break; case ACT_JOINDIRECTCONNECT: - OnGameJoin(RET_TIMEOUT, NULL); + OnGameJoin(RET_TIMEOUT, nullptr); m_pendingAction = ACT_NONE; - m_currentGame = NULL; + m_currentGame = nullptr; m_inLobby = true; break; default: @@ -621,13 +621,13 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ ) { if ((m_pendingAction != ACT_NONE) && (m_pendingAction != ACT_JOINDIRECTCONNECT)) { - OnGameJoin( RET_BUSY, NULL ); + OnGameJoin( RET_BUSY, nullptr ); return; } if (!game) { - OnGameJoin( RET_GAME_GONE, NULL ); + OnGameJoin( RET_GAME_GONE, nullptr ); return; } @@ -652,13 +652,13 @@ void LANAPI::RequestGameJoinDirectConnect(UnsignedInt ipaddress) { if (m_pendingAction != ACT_NONE) { - OnGameJoin( RET_BUSY, NULL ); + OnGameJoin( RET_BUSY, nullptr ); return; } if (ipaddress == 0) { - OnGameJoin( RET_GAME_GONE, NULL ); + OnGameJoin( RET_GAME_GONE, nullptr ); return; } @@ -690,7 +690,7 @@ void LANAPI::RequestGameLeave( void ) // Exit out immediately if we're hosting OnPlayerLeave(m_name); removeGame(m_currentGame); - m_currentGame = NULL; + m_currentGame = nullptr; m_inLobby = true; } else @@ -907,7 +907,7 @@ void LANAPI::RequestGameCreate( UnicodeString gameName, Bool isDirectConnect ) newSlot.setHost(m_hostName); myGame->setSlot(0,newSlot); - myGame->setNext(NULL); + myGame->setNext(nullptr); LANPreferences pref; AsciiString mapName = pref.getPreferredMap(); @@ -1094,7 +1094,7 @@ LANGameInfo * LANAPI::LookupGame( UnicodeString gameName ) theGame = theGame->getNext(); } - return theGame; // NULL means we didn't find anything. + return theGame; // null means we didn't find anything. } LANGameInfo * LANAPI::LookupGameByListOffset( Int offset ) @@ -1102,14 +1102,14 @@ LANGameInfo * LANAPI::LookupGameByListOffset( Int offset ) LANGameInfo *theGame = m_games; if (offset < 0) - return NULL; + return nullptr; while (offset-- && theGame) { theGame = theGame->getNext(); } - return theGame; // NULL means we didn't find anything. + return theGame; // null means we didn't find anything. } void LANAPI::removeGame( LANGameInfo *game ) @@ -1150,7 +1150,7 @@ LANPlayer * LANAPI::LookupPlayer( UnsignedInt playerIP ) thePlayer = thePlayer->getNext(); } - return thePlayer; // NULL means we didn't find anything. + return thePlayer; // null means we didn't find anything. } void LANAPI::removePlayer( LANPlayer *player ) @@ -1187,7 +1187,7 @@ void LANAPI::addGame( LANGameInfo *game ) if (!m_games) { m_games = game; - game->setNext(NULL); + game->setNext(nullptr); return; } else @@ -1217,7 +1217,7 @@ void LANAPI::addPlayer( LANPlayer *player ) if (!m_lobbyPlayers) { m_lobbyPlayers = player; - player->setNext(NULL); + player->setNext(nullptr); return; } else @@ -1270,7 +1270,7 @@ void LANAPI::setIsActive(Bool isActive) { if (isActive != m_isActive) { DEBUG_LOG(("LANAPI::setIsActive - m_isActive changed to %s", isActive ? "TRUE" : "FALSE")); if (isActive == FALSE) { - if ((m_inLobby == FALSE) && (m_currentGame != NULL)) { + if ((m_inLobby == FALSE) && (m_currentGame != nullptr)) { LANMessage msg; fillInLANMessage( &msg ); msg.messageType = LANMessage::MSG_INACTIVE; diff --git a/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp b/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp index ee3c87e3bf6..2c344553f76 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp @@ -47,7 +47,7 @@ #include "GameNetwork/LANAPICallbacks.h" #include "GameNetwork/networkutil.h" -LANAPI *TheLAN = NULL; +LANAPI *TheLAN = nullptr; extern Bool LANbuttonPushed; @@ -208,10 +208,10 @@ void LANAPI::OnGameStart( void ) //m_currentGame->startGame(0); // Set up the game network - DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); + DEBUG_ASSERTCRASH(TheNetwork == nullptr, ("For some reason TheNetwork isn't null at the start of this game. Better look into that.")); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; // Time to initialize TheNetwork for this game. TheNetwork = NetworkInterface::createNetwork(); @@ -228,16 +228,16 @@ void LANAPI::OnGameStart( void ) // see if we really have the map. if not, back out. TheMapCache->updateCache(); - if (!filesOk || TheMapCache->findMap(m_currentGame->getMap()) == NULL) + if (!filesOk || TheMapCache->findMap(m_currentGame->getMap()) == nullptr) { DEBUG_LOG(("After transfer, we didn't really have the map. Bailing...")); OnPlayerLeave(m_name); removeGame(m_currentGame); - m_currentGame = NULL; + m_currentGame = nullptr; m_inLobby = TRUE; delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; OnChat(UnicodeString::TheEmptyString, 0, TheGameText->fetch("GUI:CouldNotTransferMap"), LANCHAT_SYSTEM); return; @@ -528,7 +528,7 @@ void LANAPI::OnGameJoin( ReturnType ret, LANGameInfo *theGame ) UnicodeString title, body; title = TheGameText->fetch("LAN:JoinFailed"); body = getErrorStringFromReturnType(ret); - MessageBoxOk(title, body, NULL); + MessageBoxOk(title, body, nullptr); } } @@ -665,7 +665,7 @@ void LANAPI::OnInActive(UnsignedInt IP) { void LANAPI::OnChat( UnicodeString player, UnsignedInt ip, UnicodeString message, ChatType format ) { - GameWindow *chatWindow = NULL; + GameWindow *chatWindow = nullptr; if (m_inLobby) { @@ -679,7 +679,7 @@ void LANAPI::OnChat( UnicodeString player, UnsignedInt ip, UnicodeString message { chatWindow = listboxChatWindowLanGame; } - if (chatWindow == NULL) + if (chatWindow == nullptr) return; Int index = -1; UnicodeString unicodeChat; diff --git a/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp index 61660ff964c..0f44f1d681d 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp @@ -109,7 +109,7 @@ void LANAPI::handleGameAnnounce( LANMessage *msg, UnsignedInt senderIP ) else if (senderIP == m_directConnectRemoteIP) { - if (m_currentGame == NULL) + if (m_currentGame == nullptr) { LANGameInfo *game = LookupGame(UnicodeString(msg->GameInfo.gameName)); if (!game) @@ -150,7 +150,7 @@ void LANAPI::handleGameAnnounce( LANMessage *msg, UnsignedInt senderIP ) // remove from list removeGame(game); delete game; - game = NULL; + game = nullptr; } OnGameList( m_games ); @@ -226,7 +226,7 @@ static Bool IsSpaceCharacter(const WideChar c) static Bool ContainsInvalidChars(const WideChar* playerName) { - DEBUG_ASSERTCRASH(playerName != NULL, ("playerName is NULL")); + DEBUG_ASSERTCRASH(playerName != nullptr, ("playerName is null")); while (*playerName) { if (IsInvalidCharForPlayerName(*playerName++)) @@ -238,7 +238,7 @@ static Bool ContainsInvalidChars(const WideChar* playerName) static Bool ContainsAnyReadableChars(const WideChar* playerName) { - DEBUG_ASSERTCRASH(playerName != NULL, ("playerName is NULL")); + DEBUG_ASSERTCRASH(playerName != nullptr, ("playerName is null")); while (*playerName) { if (!IsSpaceCharacter(*playerName++)) @@ -433,7 +433,7 @@ void LANAPI::handleJoinAccept( LANMessage *msg, UnsignedInt senderIP ) if (!m_currentGame) { DEBUG_ASSERTCRASH(false, ("Could not find game to join!")); - OnGameJoin(RET_UNKNOWN, NULL); + OnGameJoin(RET_UNKNOWN, nullptr); } else { @@ -499,7 +499,7 @@ void LANAPI::handleRequestGameLeave( LANMessage *msg, UnsignedInt senderIP ) OnHostLeave(); removeGame(m_currentGame); delete m_currentGame; - m_currentGame = NULL; + m_currentGame = nullptr; /// @todo re-add myself to lobby? Or just keep me there all the time? If we send a LOBBY_ANNOUNCE things'll work out... LANPlayer *lanPlayer = LookupPlayer(m_localIP); @@ -621,7 +621,7 @@ void LANAPI::handleChat( LANMessage *msg, UnsignedInt senderIP ) if (m_inLobby) { LANPlayer *player; - if((player=LookupPlayer(senderIP)) != 0) + if((player=LookupPlayer(senderIP)) != nullptr) { OnChat(UnicodeString(player->getName()), player->getIP(), UnicodeString(msg->Chat.message), msg->Chat.chatType); player->setLastHeard(timeGetTime()); @@ -684,7 +684,7 @@ void LANAPI::handleGameOptions( LANMessage *msg, UnsignedInt senderIP ) } void LANAPI::handleInActive(LANMessage *msg, UnsignedInt senderIP) { - if (m_inLobby || (m_currentGame == NULL) || (m_currentGame->isGameInProgress())) { + if (m_inLobby || (m_currentGame == nullptr) || (m_currentGame->isGameInProgress())) { return; } @@ -700,7 +700,7 @@ void LANAPI::handleInActive(LANMessage *msg, UnsignedInt senderIP) { if (slotNum < 0) return; GameSlot *slot = m_currentGame->getSlot(slotNum); - if (slot == NULL) { + if (slot == nullptr) { return; } diff --git a/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp b/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp index a34b6ea0e74..638681e4420 100644 --- a/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp @@ -45,7 +45,7 @@ // Singleton ------------------------------------------ -LANGameInfo *TheLANGameInfo = NULL; +LANGameInfo *TheLANGameInfo = nullptr; // LANGameSlot ---------------------------------------- @@ -62,10 +62,10 @@ LANPlayer * LANGameSlot::getUser( void ) m_user.setIP(getIP()); m_user.setLastHeard(getLastHeard()); m_user.setName(getName()); - m_user.setNext(NULL); + m_user.setNext(nullptr); return &m_user; } - return NULL; + return nullptr; } // Various tests @@ -89,7 +89,7 @@ Bool LANGameSlot::isLocalPlayer( void ) const LANGameInfo::LANGameInfo() { m_lastHeard = 0; - m_next = NULL; + m_next = nullptr; m_isDirectConnect = false; // for (Int i = 0; i< MAX_SLOTS; ++i) @@ -117,7 +117,7 @@ LANGameSlot* LANGameInfo::getLANSlot( Int slotNum ) { DEBUG_ASSERTCRASH( slotNum >= 0 && slotNum < MAX_SLOTS, ("LANGameInfo::getLANSlot - Invalid slot number")); if (slotNum < 0 || slotNum >= MAX_SLOTS) - return NULL; + return nullptr; return &m_LANSlot[slotNum]; } @@ -126,7 +126,7 @@ const LANGameSlot* LANGameInfo::getConstLANSlot( Int slotNum ) const { DEBUG_ASSERTCRASH( slotNum >= 0 && slotNum < MAX_SLOTS, ("LANGameInfo::getConstLANSlot - Invalid slot number")); if (slotNum < 0 || slotNum >= MAX_SLOTS) - return NULL; + return nullptr; return &m_LANSlot[slotNum]; } @@ -198,7 +198,7 @@ void LANGameInfo::resetAccepted( void ) void LANDisplayGameList( GameWindow *gameListbox, LANGameInfo *gameList ) { - LANGameInfo *selectedPtr = NULL; + LANGameInfo *selectedPtr = nullptr; Int selectedIndex = -1; Int indexToSelect = -1; if (gameListbox) diff --git a/Core/GameEngine/Source/GameNetwork/NAT.cpp b/Core/GameEngine/Source/GameNetwork/NAT.cpp index 03e58556756..be06e97ee3f 100644 --- a/Core/GameEngine/Source/GameNetwork/NAT.cpp +++ b/Core/GameEngine/Source/GameNetwork/NAT.cpp @@ -140,7 +140,7 @@ /* static */ time_t NAT::m_timeToWaitForPort = 15000; // wait for 15 seconds for the other player's port number. /* static */ time_t NAT::m_timeForRoundTimeout = 15000; // wait for at most 15 seconds for each connection round to finish. -NAT *TheNAT = NULL; +NAT *TheNAT = nullptr; NAT::NAT() { @@ -159,8 +159,8 @@ NAT::NAT() m_spareSocketPort = 0; m_startingPortNumber = 0; m_targetNodeNumber = 0; - m_transport = NULL; - m_slotList = NULL; + m_transport = nullptr; + m_slotList = nullptr; m_roundTimeout = 0; m_maxNumRetriesAllowed = 10; m_packetID = 0x7f00; @@ -212,7 +212,7 @@ NATStateType NAT::update() { TheEstablishConnectionsMenu->endMenu(); delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } } else if (m_NATState == NATSTATE_DOCONNECTIONPATHS) { if (allConnectionsDoneThisRound() == TRUE) { @@ -238,7 +238,7 @@ NATStateType NAT::update() { TheEstablishConnectionsMenu->endMenu(); delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; */ } else { doThisConnectionRound(); @@ -256,7 +256,7 @@ NATStateType NAT::update() { // if we fail m_NATState = NATSTATE_FAILED; TheEstablishConnectionsMenu->endMenu(); - if (TheFirewallHelper != NULL) { + if (TheFirewallHelper != nullptr) { // we failed NAT negotiation, perhaps we need to redetect our firewall settings. // We don't trust the user to do it for themselves so we force them to do it next time // the log in. @@ -268,11 +268,11 @@ NATStateType NAT::update() { // TheFirewallHelper->writeFirewallBehavior(); delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } // we failed to connect, so we don't have to pass on the transport to the network. delete m_transport; - m_transport = NULL; + m_transport = nullptr; } } return m_NATState; @@ -286,7 +286,7 @@ NATStateType NAT::update() { // if we didn't get a response, check to see if its time to send another packet to it NATConnectionState NAT::connectionUpdate() { - GameSlot *targetSlot = NULL; + GameSlot *targetSlot = nullptr; if (m_targetNodeNumber >= 0) { targetSlot = m_slotList[m_connectionNodes[m_targetNodeNumber].m_slotIndex]; } else { @@ -309,8 +309,8 @@ NATConnectionState NAT::connectionUpdate() { // we've made this connection, send a keepalive. Int slotIndex = m_connectionNodes[node].m_slotIndex; GameSlot *slot = m_slotList[slotIndex]; - DEBUG_ASSERTCRASH(slot != NULL, ("Trying to send keepalive to a NULL slot")); - if (slot != NULL) { + DEBUG_ASSERTCRASH(slot != nullptr, ("Trying to send keepalive to a null slot")); + if (slot != nullptr) { UnsignedInt ip = slot->getIP(); DEBUG_LOG(("NAT::connectionUpdate - sending keep alive to node %d at %d.%d.%d.%d:%d", node, PRINTF_IP_AS_4_INTS(ip), slot->getPort())); @@ -398,7 +398,7 @@ NATConnectionState NAT::connectionUpdate() { // we are waiting for a response from the mangler to tell us what port we're using. if (m_connectionStates[m_localNodeNumber] == NATCONNECTIONSTATE_WAITINGFORMANGLERRESPONSE) { UnsignedShort mangledPort = 0; - if (TheFirewallHelper != NULL) { + if (TheFirewallHelper != nullptr) { mangledPort = TheFirewallHelper->getManglerResponse(m_packetID); } if (mangledPort != 0) { @@ -420,7 +420,7 @@ NATConnectionState NAT::connectionUpdate() { m_sourcePorts[m_targetNodeNumber] = getSlotPort(m_connectionNodes[m_localNodeNumber].m_slotIndex); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_WAITINGFORRESPONSE); } else { - if (TheFirewallHelper != NULL) { + if (TheFirewallHelper != nullptr) { DEBUG_LOG(("NAT::connectionUpdate - trying to send to the mangler again. mangler address: %d.%d.%d.%d, from port: %d, packet ID:%d", PRINTF_IP_AS_4_INTS(m_manglerAddress), m_spareSocketPort, m_packetID)); TheFirewallHelper->sendToManglerFromPort(m_manglerAddress, m_spareSocketPort, m_packetID); @@ -451,17 +451,17 @@ void NAT::establishConnectionPaths() { DEBUG_LOG(("NAT::establishConnectionPaths - entering")); m_NATState = NATSTATE_DOCONNECTIONPATHS; DEBUG_LOG(("NAT::establishConnectionPaths - using %d as our starting port number", m_startingPortNumber)); - if (TheEstablishConnectionsMenu == NULL) { + if (TheEstablishConnectionsMenu == nullptr) { TheEstablishConnectionsMenu = NEW EstablishConnectionsMenu; } TheEstablishConnectionsMenu->initMenu(); - if (TheFirewallHelper == NULL) { + if (TheFirewallHelper == nullptr) { TheFirewallHelper = createFirewallHelper(); } - DEBUG_ASSERTCRASH(m_slotList != NULL, ("NAT::establishConnectionPaths - don't have a slot list")); - if (m_slotList == NULL) { + DEBUG_ASSERTCRASH(m_slotList != nullptr, ("NAT::establishConnectionPaths - don't have a slot list")); + if (m_slotList == nullptr) { return; } @@ -469,7 +469,7 @@ void NAT::establishConnectionPaths() { m_numNodes = 0; Int i = 0; for (; i < MAX_SLOTS; ++i) { - if (m_slotList[i] != NULL) { + if (m_slotList[i] != nullptr) { if (m_slotList[i]->isHuman()) { DEBUG_LOG(("NAT::establishConnectionPaths - slot %d is %ls", i, m_slotList[i]->getName().str())); ++m_numNodes; @@ -509,7 +509,7 @@ void NAT::establishConnectionPaths() { DEBUG_LOG(("NAT::establishConnectionPaths - doing the netgear stuff")); UnsignedInt otherNetgearNum = -1; for (i = 0; i < MAX_SLOTS; ++i) { - if ((m_slotList != NULL) && (m_slotList[i] != NULL)) { + if ((m_slotList != nullptr) && (m_slotList[i] != nullptr)) { if ((m_slotList[i]->getNATBehavior() & FirewallHelperClass::FIREWALL_TYPE_NETGEAR_BUG) != 0) { if (otherNetgearNum == -1) { // this is the start of a new pair, put it in as the first non -1 node connection pair thing. @@ -545,7 +545,7 @@ void NAT::establishConnectionPaths() { if (connectionAssigned[i] == TRUE) { continue; } - if (m_slotList[i] == NULL) { + if (m_slotList[i] == nullptr) { continue; } if (!(m_slotList[i]->isHuman())) { @@ -581,7 +581,7 @@ void NAT::establishConnectionPaths() { // set up the names in the connection window. Int playerNum = 0; for (i = 0; i < MAX_SLOTS; ++i) { - while ((i < MAX_SLOTS) && (m_slotList[i] != NULL) && !(m_slotList[i]->isHuman())) { + while ((i < MAX_SLOTS) && (m_slotList[i] != nullptr) && !(m_slotList[i]->isHuman())) { ++i; } if (i >= MAX_SLOTS) { @@ -617,7 +617,7 @@ void NAT::attachSlotList(GameSlot *slotList[], Int localSlot, UnsignedInt localI Int NAT::getSlotPort(Int slot) { // return (slot + m_startingPortNumber); - if (m_slotList[slot] != NULL) { + if (m_slotList[slot] != nullptr) { return m_slotList[slot]->getPort(); } return 0; @@ -625,7 +625,7 @@ Int NAT::getSlotPort(Int slot) { void NAT::generatePortNumbers(GameSlot *slotList[], Int localSlot) { for (UnsignedInt i = 0; i < (UnsignedInt)MAX_SLOTS; ++i) { - if (slotList[i] != NULL) { + if (slotList[i] != nullptr) { if ((i == localSlot) && (TheWritableGlobalData->m_firewallPortOverride != 0)) { slotList[i]->setPort(TheWritableGlobalData->m_firewallPortOverride); } else { @@ -666,8 +666,8 @@ void NAT::doThisConnectionRound() { GameSlot *targetSlot = m_slotList[targetSlotIndex]; GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("local slot is NULL")); - DEBUG_ASSERTCRASH(targetSlot != NULL, ("trying to negotiate with a NULL target slot, slot is %d", m_connectionPairs[m_connectionPairIndex][m_connectionRound][i])); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("local slot is null")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("trying to negotiate with a null target slot, slot is %d", m_connectionPairs[m_connectionPairIndex][m_connectionRound][i])); DEBUG_LOG(("NAT::doThisConnectionRound - Target slot index = %d (%ls)", targetSlotIndex, m_slotList[targetSlotIndex]->getName().str())); DEBUG_LOG(("NAT::doThisConnectionRound - Target slot has NAT behavior 0x%8X, local slot has NAT behavior 0x%8X", targetSlot->getNATBehavior(), localSlot->getNATBehavior())); @@ -729,17 +729,17 @@ void NAT::sendMangledSourcePort() { FirewallHelperClass::tFirewallBehaviorType fwType = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]->getNATBehavior(); GameSlot *targetSlot = m_slotList[m_connectionNodes[m_targetNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(targetSlot != NULL, ("NAT::sendMangledSourcePort - targetSlot is NULL")); - if (targetSlot == NULL) { - DEBUG_LOG(("NAT::sendMangledSourcePort - targetSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("NAT::sendMangledSourcePort - targetSlot is null")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::sendMangledSourcePort - targetSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::sendMangledSourcePort - localSlot is NULL, WTF?")); - if (localSlot == NULL) { - DEBUG_LOG(("NAT::sendMangledSourcePort - localSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::sendMangledSourcePort - localSlot is null, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::sendMangledSourcePort - localSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -803,7 +803,7 @@ void NAT::sendMangledSourcePort() { DEBUG_LOG(("NAT::sendMangledSourcePort - about to call gethostbyname for mangler at %s", manglerName)); struct hostent *hostInfo = gethostbyname(manglerName); - if (hostInfo == NULL) { + if (hostInfo == nullptr) { DEBUG_LOG(("NAT::sendMangledSourcePort - gethostbyname failed for mangler address %s", manglerName)); // can't find the mangler, we're screwed so just send the source port. sendMangledPortNumberToTarget(sourcePort, targetSlot); @@ -823,7 +823,7 @@ void NAT::sendMangledSourcePort() { m_manglerRetryTime = m_manglerRetryTimeInterval + timeGetTime(); m_manglerRetries = 0; - if (TheFirewallHelper != NULL) { + if (TheFirewallHelper != nullptr) { m_spareSocketPort = TheFirewallHelper->getNextTemporarySourcePort(0); TheFirewallHelper->openSpareSocket(m_spareSocketPort); TheFirewallHelper->sendToManglerFromPort(m_manglerAddress, m_spareSocketPort, m_packetID); @@ -838,9 +838,9 @@ void NAT::processManglerResponse(UnsignedShort mangledPort) { DEBUG_LOG(("NAT::processManglerResponse - Work out what my NAT'd port will be")); GameSlot *targetSlot = m_slotList[m_connectionNodes[m_targetNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(targetSlot != NULL, ("NAT::processManglerResponse - targetSlot is NULL")); - if (targetSlot == NULL) { - DEBUG_LOG(("NAT::processManglerResponse - targetSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("NAT::processManglerResponse - targetSlot is null")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::processManglerResponse - targetSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -931,9 +931,9 @@ void NAT::connectionFailed(Int slotIndex) { // I have been probed by the target. void NAT::probed(Int nodeNumber) { GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::probed - localSlot is NULL, WTF?")); - if (localSlot == NULL) { - DEBUG_LOG(("NAT::probed - localSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::probed - localSlot is null, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::probed - localSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -944,9 +944,9 @@ void NAT::probed(Int nodeNumber) { if ((localSlot->getNATBehavior() & FirewallHelperClass::FIREWALL_TYPE_NETGEAR_BUG) != 0) { DEBUG_LOG(("NAT::probed - we have a NETGEAR and we were just probed for the first time")); GameSlot *targetSlot = m_slotList[m_connectionNodes[m_targetNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(targetSlot != NULL, ("NAT::probed - targetSlot is NULL")); - if (targetSlot == NULL) { - DEBUG_LOG(("NAT::probed - targetSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("NAT::probed - targetSlot is null")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::probed - targetSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -974,17 +974,17 @@ void NAT::gotMangledPort(Int nodeNumber, UnsignedShort mangledPort) { } GameSlot *targetSlot = m_slotList[m_connectionNodes[m_targetNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(targetSlot != NULL, ("NAT::gotMangledPort - targetSlot is NULL")); - if (targetSlot == NULL) { - DEBUG_LOG(("NAT::gotMangledPort - targetSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("NAT::gotMangledPort - targetSlot is null")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::gotMangledPort - targetSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::gotMangledPort - localSlot is NULL, WTF?")); - if (localSlot == NULL) { - DEBUG_LOG(("NAT::gotMangledPort - localSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::gotMangledPort - localSlot is null, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::gotMangledPort - localSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -1014,14 +1014,14 @@ void NAT::gotMangledPort(Int nodeNumber, UnsignedShort mangledPort) { void NAT::gotInternalAddress(Int nodeNumber, UnsignedInt address) { GameSlot *targetSlot = m_slotList[m_connectionNodes[nodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(targetSlot != NULL, ("NAT::gotInternalAddress - targetSlot is NULL")); - if (targetSlot == NULL) { + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("NAT::gotInternalAddress - targetSlot is null")); + if (targetSlot == nullptr) { return; } GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::gotInternalAddress - localSlot is NULL, WTF?")); - if (localSlot == NULL) { + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::gotInternalAddress - localSlot is null, WTF?")); + if (localSlot == nullptr) { return; } @@ -1055,9 +1055,9 @@ void NAT::notifyTargetOfProbe(GameSlot *targetSlot) { void NAT::notifyUsersOfConnectionDone(Int nodeIndex) { GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::notifyUsersOfConnectionDone - localSlot is NULL, WTF?")); - if (localSlot == NULL) { - DEBUG_LOG(("NAT::notifyUsersOfConnectionDone - localSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::notifyUsersOfConnectionDone - localSlot is null, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::notifyUsersOfConnectionDone - localSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -1076,7 +1076,7 @@ void NAT::notifyUsersOfConnectionDone(Int nodeIndex) { continue; } - if ((m_slotList[i] == NULL) || (m_slotList[i]->isHuman() == FALSE)) { + if ((m_slotList[i] == nullptr) || (m_slotList[i]->isHuman() == FALSE)) { continue; } @@ -1097,9 +1097,9 @@ void NAT::notifyUsersOfConnectionDone(Int nodeIndex) { void NAT::notifyUsersOfConnectionFailed(Int nodeIndex) { GameSlot *localSlot = m_slotList[m_connectionNodes[m_localNodeNumber].m_slotIndex]; - DEBUG_ASSERTCRASH(localSlot != NULL, ("NAT::notifyUsersOfConnectionFailed - localSlot is NULL, WTF?")); - if (localSlot == NULL) { - DEBUG_LOG(("NAT::notifyUsersOfConnectionFailed - localSlot is NULL, failed this connection")); + DEBUG_ASSERTCRASH(localSlot != nullptr, ("NAT::notifyUsersOfConnectionFailed - localSlot is null, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::notifyUsersOfConnectionFailed - localSlot is null, failed this connection")); setConnectionState(m_localNodeNumber, NATCONNECTIONSTATE_FAILED); return; } @@ -1126,7 +1126,7 @@ void NAT::notifyUsersOfConnectionFailed(Int nodeIndex) { continue; } - if ((m_slotList[i] == NULL) || (m_slotList[i]->isHuman() == FALSE)) { + if ((m_slotList[i] == nullptr) || (m_slotList[i]->isHuman() == FALSE)) { continue; } @@ -1271,7 +1271,7 @@ void NAT::setConnectionState(Int nodeNumber, NATConnectionState state) { Int slot = 0; Int i = 0; for (; i < MAX_SLOTS; ++i) { - if (m_slotList[i] != NULL) { + if (m_slotList[i] != nullptr) { if (m_slotList[i]->isHuman()) { if (i != m_connectionNodes[m_localNodeNumber].m_slotIndex) { if (i == slotIndex) { diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp index 9df51d77e99..b6a834c987b 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp @@ -32,9 +32,9 @@ * Constructor. */ NetCommandList::NetCommandList() { - m_first = NULL; - m_last = NULL; - m_lastMessageInserted = NULL; + m_first = nullptr; + m_last = nullptr; + m_lastMessageInserted = nullptr; } /** @@ -48,17 +48,17 @@ NetCommandList::~NetCommandList() { * Append the given list of commands to this list. */ void NetCommandList::appendList(NetCommandList *list) { - if (list == NULL) { + if (list == nullptr) { return; } // Need to do it this way because of the reference counting that needs to happen in appendMessage. NetCommandRef *msg = list->getFirstMessage(); - NetCommandRef *next = NULL; - while (msg != NULL) { + NetCommandRef *next = nullptr; + while (msg != nullptr) { next = msg->getNext(); NetCommandRef *temp = addMessage(msg->getCommand()); - if (temp != NULL) { + if (temp != nullptr) { temp->setRelay(msg->getRelay()); } @@ -81,10 +81,10 @@ void NetCommandList::removeMessage(NetCommandRef *msg) { m_lastMessageInserted = msg->getNext(); } - if (msg->getPrev() != NULL) { + if (msg->getPrev() != nullptr) { msg->getPrev()->setNext(msg->getNext()); } - if (msg->getNext() != NULL) { + if (msg->getNext() != nullptr) { msg->getNext()->setPrev(msg->getPrev()); } @@ -95,8 +95,8 @@ void NetCommandList::removeMessage(NetCommandRef *msg) { m_last = msg->getPrev(); } - msg->setNext(NULL); - msg->setPrev(NULL); + msg->setNext(nullptr); + msg->setPrev(nullptr); } /** @@ -111,15 +111,15 @@ void NetCommandList::init() { */ void NetCommandList::reset() { NetCommandRef *temp = m_first; - while (m_first != NULL) { + while (m_first != nullptr) { temp = m_first->getNext(); - m_first->setNext(NULL); - m_first->setPrev(NULL); + m_first->setNext(nullptr); + m_first->setPrev(nullptr); deleteInstance(m_first); m_first = temp; } - m_last = NULL; - m_lastMessageInserted = NULL; + m_last = nullptr; + m_lastMessageInserted = nullptr; } /** @@ -127,16 +127,16 @@ void NetCommandList::reset() { * The message is sorted in based first on command type, then player id, and then command id. */ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { - if (cmdMsg == NULL) { - DEBUG_ASSERTCRASH(cmdMsg != NULL, ("NetCommandList::addMessage - command message was NULL")); - return NULL; + if (cmdMsg == nullptr) { + DEBUG_ASSERTCRASH(cmdMsg != nullptr, ("NetCommandList::addMessage - command message was null")); + return nullptr; } // UnsignedInt id = cmdMsg->getID(); NetCommandRef *msg = NEW_NETCOMMANDREF(cmdMsg); - if (m_first == NULL) { + if (m_first == nullptr) { // this is the first node, so we don't have to worry about ordering it. m_first = msg; m_last = msg; @@ -144,7 +144,7 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { return msg; } - if (m_lastMessageInserted != NULL) { + if (m_lastMessageInserted != nullptr) { // Messages that are inserted in order should just be put in one right after the other. // So saving the placement of the last message inserted can give us a huge boost in // efficiency. @@ -152,7 +152,7 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { if ((m_lastMessageInserted->getCommand()->getNetCommandType() == msg->getCommand()->getNetCommandType()) && (m_lastMessageInserted->getCommand()->getPlayerID() == msg->getCommand()->getPlayerID()) && (m_lastMessageInserted->getCommand()->getID() < msg->getCommand()->getID()) && - ((theNext == NULL) || ((theNext->getCommand()->getNetCommandType() > msg->getCommand()->getNetCommandType()) || + ((theNext == nullptr) || ((theNext->getCommand()->getNetCommandType() > msg->getCommand()->getNetCommandType()) || (theNext->getCommand()->getPlayerID() > msg->getCommand()->getPlayerID()) || (theNext->getCommand()->getID() > msg->getCommand()->getID())))) { @@ -161,11 +161,11 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } - if (theNext == NULL) { + if (theNext == nullptr) { // this means that m_lastMessageInserted == m_last, so m_last should point to the msg that is being inserted. msg->setNext(m_lastMessageInserted->getNext()); msg->setPrev(m_lastMessageInserted); @@ -192,12 +192,12 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } msg->setPrev(m_last); - msg->setNext(NULL); + msg->setNext(nullptr); m_last->setNext(msg); m_last = msg; m_lastMessageInserted = msg; @@ -210,13 +210,13 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } // The command goes at the head of the list. msg->setNext(m_first); - msg->setPrev(NULL); + msg->setPrev(nullptr); m_first->setPrev(msg); m_first = msg; m_lastMessageInserted = msg; @@ -226,23 +226,23 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // Find the start of the command type we're looking for. NetCommandRef *tempmsg = m_first; - while ((tempmsg != NULL) && (msg->getCommand()->getNetCommandType() > tempmsg->getCommand()->getNetCommandType())) { + while ((tempmsg != nullptr) && (msg->getCommand()->getNetCommandType() > tempmsg->getCommand()->getNetCommandType())) { tempmsg = tempmsg->getNext(); } - if (tempmsg == NULL) { + if (tempmsg == nullptr) { // Make sure this command isn't already in the list. if (isEqualCommandMsg(m_last->getCommand(), msg->getCommand())) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } // message goes at the end of the list. msg->setPrev(m_last); - msg->setNext(NULL); + msg->setNext(nullptr); m_last->setNext(msg); m_last = msg; m_lastMessageInserted = msg; @@ -250,23 +250,23 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { } // Now find the player position. munkee. - while ((tempmsg != NULL) && (msg->getCommand()->getNetCommandType() == tempmsg->getCommand()->getNetCommandType()) && (msg->getCommand()->getPlayerID() > tempmsg->getCommand()->getPlayerID())) { + while ((tempmsg != nullptr) && (msg->getCommand()->getNetCommandType() == tempmsg->getCommand()->getNetCommandType()) && (msg->getCommand()->getPlayerID() > tempmsg->getCommand()->getPlayerID())) { tempmsg = tempmsg->getNext(); } - if (tempmsg == NULL) { + if (tempmsg == nullptr) { // Make sure this command isn't already in the list. if (isEqualCommandMsg(m_last->getCommand(), msg->getCommand())) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } // message goes at the end of the list. msg->setPrev(m_last); - msg->setNext(NULL); + msg->setNext(nullptr); m_last->setNext(msg); m_last = msg; m_lastMessageInserted = msg; @@ -275,23 +275,23 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // Find the position within the player's section based on the command ID. // If the command type doesn't require a command ID, sort by whatever it should be sorted by. - while ((tempmsg != NULL) && (msg->getCommand()->getNetCommandType() == tempmsg->getCommand()->getNetCommandType()) && (msg->getCommand()->getPlayerID() == tempmsg->getCommand()->getPlayerID()) && (msg->getCommand()->getSortNumber() > tempmsg->getCommand()->getSortNumber())) { + while ((tempmsg != nullptr) && (msg->getCommand()->getNetCommandType() == tempmsg->getCommand()->getNetCommandType()) && (msg->getCommand()->getPlayerID() == tempmsg->getCommand()->getPlayerID()) && (msg->getCommand()->getSortNumber() > tempmsg->getCommand()->getSortNumber())) { tempmsg = tempmsg->getNext(); } - if (tempmsg == NULL) { + if (tempmsg == nullptr) { // Make sure this command isn't already in the list. if (isEqualCommandMsg(m_last->getCommand(), msg->getCommand())) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } // This message goes at the end of the list. msg->setPrev(m_last); - msg->setNext(NULL); + msg->setNext(nullptr); m_last->setNext(msg); m_last = msg; m_lastMessageInserted = msg; @@ -304,12 +304,12 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - return NULL; + return nullptr; } // This message goes at the head of the list. msg->setNext(m_first); - msg->setPrev(NULL); + msg->setPrev(nullptr); m_first->setPrev(msg); m_first = msg; m_lastMessageInserted = msg; @@ -321,8 +321,8 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { // This command is already in the list, don't duplicate it. deleteInstance(msg); - msg = NULL; - return NULL; + msg = nullptr; + return nullptr; } // Insert message before tempmsg. @@ -338,7 +338,7 @@ NetCommandRef * NetCommandList::addMessage(NetCommandMsg *cmdMsg) { Int NetCommandList::length() { Int retval = 0; NetCommandRef *temp = m_first; - while (temp != NULL) { + while (temp != nullptr) { ++retval; temp = temp->getNext(); } @@ -351,7 +351,7 @@ Int NetCommandList::length() { */ NetCommandRef * NetCommandList::findMessage(NetCommandMsg *msg) { NetCommandRef *retval = m_first; - while ((retval != NULL) && (isEqualCommandMsg(retval->getCommand(), msg) == FALSE)) { + while ((retval != nullptr) && (isEqualCommandMsg(retval->getCommand(), msg) == FALSE)) { retval = retval->getNext(); } return retval; @@ -359,7 +359,7 @@ NetCommandRef * NetCommandList::findMessage(NetCommandMsg *msg) { NetCommandRef * NetCommandList::findMessage(UnsignedShort commandID, UnsignedByte playerID) { NetCommandRef *retval = m_first; - while (retval != NULL) { + while (retval != nullptr) { if (DoesCommandRequireACommandID(retval->getCommand()->getNetCommandType())) { if ((retval->getCommand()->getID() == commandID) && (retval->getCommand()->getPlayerID() == playerID)) { return retval; diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index 951f3c8cf6a..c8ba4b73ded 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -92,8 +92,8 @@ NetGameCommandMsg::NetGameCommandMsg() : NetCommandMsg() { m_numArgs = 0; m_type = (GameMessage::Type)0; m_commandType = NETCOMMANDTYPE_GAMECOMMAND; - m_argList = NULL; - m_argTail = NULL; + m_argList = nullptr; + m_argTail = nullptr; } /** @@ -115,7 +115,7 @@ NetGameCommandMsg::NetGameCommandMsg(GameMessage *msg) : NetCommandMsg() { */ NetGameCommandMsg::~NetGameCommandMsg() { GameMessageArgument *arg = m_argList; - while (arg != NULL) { + while (arg != nullptr) { m_argList = m_argList->m_next; deleteInstance(arg); arg = m_argList; @@ -127,19 +127,19 @@ NetGameCommandMsg::~NetGameCommandMsg() { */ void NetGameCommandMsg::addArgument(const GameMessageArgumentDataType type, GameMessageArgumentType arg) { - if (m_argTail == NULL) { + if (m_argTail == nullptr) { m_argList = newInstance(GameMessageArgument); m_argTail = m_argList; m_argList->m_data = arg; m_argList->m_type = type; - m_argList->m_next = NULL; + m_argList->m_next = nullptr; return; } GameMessageArgument *newArg = newInstance(GameMessageArgument); newArg->m_data = arg; newArg->m_type = type; - newArg->m_next = NULL; + newArg->m_next = nullptr; m_argTail->m_next = newArg; m_argTail = newArg; } @@ -147,7 +147,7 @@ void NetGameCommandMsg::addArgument(const GameMessageArgumentDataType type, Game // here's where we figure out which slot corresponds to which player static Int indexFromMask(UnsignedInt mask) { - Player *player = NULL; + Player *player = nullptr; Int i; for( i = 0; i < MAX_PLAYER_COUNT; i++ ) @@ -172,7 +172,7 @@ GameMessage *NetGameCommandMsg::constructGameMessage() const retval->friend_setPlayerIndex( ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name))->getPlayerIndex()); GameMessageArgument *arg = m_argList; - while (arg != NULL) { + while (arg != nullptr) { switch (arg->m_type) { @@ -235,7 +235,7 @@ size_t NetGameCommandMsg::getPackedByteCount() const { msglen += sizeof(UnsignedByte); GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); - while (arg != NULL) { + while (arg != nullptr) { msglen += sizeof(UnsignedByte); // argument type msglen += sizeof(UnsignedByte); // argument count GameMessageArgumentDataType type = arg->getType(); @@ -282,10 +282,10 @@ size_t NetGameCommandMsg::getPackedByteCount() const { } deleteInstance(parser); - parser = NULL; + parser = nullptr; deleteInstance(gmsg); - gmsg = NULL; + gmsg = nullptr; return msglen; } @@ -966,7 +966,7 @@ size_t NetProgressCommandMsg::getPackedByteCount() const { NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { m_commandType = NETCOMMANDTYPE_WRAPPER; m_numChunks = 0; - m_data = NULL; + m_data = nullptr; m_totalDataLength = 0; m_chunkNumber = 0; m_dataLength = 0; @@ -976,7 +976,7 @@ NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { NetWrapperCommandMsg::~NetWrapperCommandMsg() { delete m_data; - m_data = NULL; + m_data = nullptr; } UnsignedByte * NetWrapperCommandMsg::getData() { @@ -1044,14 +1044,14 @@ size_t NetWrapperCommandMsg::getPackedByteCount() const { //------------------------- NetFileCommandMsg::NetFileCommandMsg() : NetCommandMsg() { m_commandType = NETCOMMANDTYPE_FILE; - m_data = NULL; + m_data = nullptr; m_portableFilename.clear(); m_dataLength = 0; } NetFileCommandMsg::~NetFileCommandMsg() { delete[] m_data; - m_data = NULL; + m_data = nullptr; } AsciiString NetFileCommandMsg::getRealFilename() diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandRef.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandRef.cpp index 6e767e961ae..470a387ff77 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandRef.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandRef.cpp @@ -41,8 +41,8 @@ NetCommandRef::NetCommandRef(NetCommandMsg *msg) #endif { m_msg = msg; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; m_msg->attach(); m_timeLastSent = -1; @@ -57,12 +57,12 @@ NetCommandRef::NetCommandRef(NetCommandMsg *msg) */ NetCommandRef::~NetCommandRef() { - if (m_msg != NULL) + if (m_msg != nullptr) { m_msg->detach(); } - DEBUG_ASSERTCRASH(m_next == NULL, ("NetCommandRef::~NetCommandRef - m_next != NULL")); - DEBUG_ASSERTCRASH(m_prev == NULL, ("NetCommandRef::~NetCommandRef - m_prev != NULL")); + DEBUG_ASSERTCRASH(m_next == nullptr, ("NetCommandRef::~NetCommandRef - m_next != nullptr")); + DEBUG_ASSERTCRASH(m_prev == nullptr, ("NetCommandRef::~NetCommandRef - m_prev != nullptr")); #ifdef DEBUG_NETCOMMANDREF DEBUG_LOG(("NetCommandRef %d deleted", m_id)); diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp index 86333e90168..6ff3e142c2e 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandWrapperList.cpp @@ -36,7 +36,7 @@ NetCommandWrapperListNode::NetCommandWrapperListNode(NetWrapperCommandMsg *msg) { - m_next = NULL; + m_next = nullptr; m_numChunks = msg->getNumChunks(); m_chunksPresent = NEW Bool[m_numChunks]; // pool[]ify m_numChunksPresent = 0; @@ -53,10 +53,10 @@ NetCommandWrapperListNode::NetCommandWrapperListNode(NetWrapperCommandMsg *msg) NetCommandWrapperListNode::~NetCommandWrapperListNode() { delete[] m_chunksPresent; - m_chunksPresent = NULL; + m_chunksPresent = nullptr; delete[] m_data; - m_data = NULL; + m_data = nullptr; } Bool NetCommandWrapperListNode::isComplete() { @@ -79,7 +79,7 @@ UnsignedInt NetCommandWrapperListNode::getRawDataLength() { } void NetCommandWrapperListNode::copyChunkData(NetWrapperCommandMsg *msg) { - if (msg == NULL) { + if (msg == nullptr) { DEBUG_CRASH(("Trying to copy data from a non-existent wrapper command message")); return; } @@ -132,12 +132,12 @@ UnsignedByte * NetCommandWrapperListNode::getRawData() { //////////////////////////////////////////////////////////////////////////////////////////////////// NetCommandWrapperList::NetCommandWrapperList() { - m_list = NULL; + m_list = nullptr; } NetCommandWrapperList::~NetCommandWrapperList() { NetCommandWrapperListNode *temp; - while (m_list != NULL) { + while (m_list != nullptr) { temp = m_list->m_next; deleteInstance(m_list); m_list = temp; @@ -145,12 +145,12 @@ NetCommandWrapperList::~NetCommandWrapperList() { } void NetCommandWrapperList::init() { - m_list = NULL; + m_list = nullptr; } void NetCommandWrapperList::reset() { NetCommandWrapperListNode *temp; - while (m_list != NULL) { + while (m_list != nullptr) { temp = m_list->m_next; deleteInstance(m_list); m_list = temp; @@ -161,7 +161,7 @@ Int NetCommandWrapperList::getPercentComplete(UnsignedShort wrappedCommandID) { NetCommandWrapperListNode *temp = m_list; - while ((temp != NULL) && (temp->getCommandID() != wrappedCommandID)) { + while ((temp != nullptr) && (temp->getCommandID() != wrappedCommandID)) { temp = temp->m_next; } @@ -175,11 +175,11 @@ void NetCommandWrapperList::processWrapper(NetCommandRef *ref) { NetCommandWrapperListNode *temp = m_list; NetWrapperCommandMsg *msg = (NetWrapperCommandMsg *)(ref->getCommand()); - while ((temp != NULL) && (temp->getCommandID() != msg->getWrappedCommandID())) { + while ((temp != nullptr) && (temp->getCommandID() != msg->getWrappedCommandID())) { temp = temp->m_next; } - if (temp == NULL) { + if (temp == nullptr) { temp = newInstance(NetCommandWrapperListNode)(msg); temp->m_next = m_list; m_list = temp; @@ -194,9 +194,9 @@ NetCommandList * NetCommandWrapperList::getReadyCommands() retlist->init(); NetCommandWrapperListNode *temp = m_list; - NetCommandWrapperListNode *next = NULL; + NetCommandWrapperListNode *next = nullptr; - while (temp != NULL) { + while (temp != nullptr) { next = temp->m_next; if (temp->isComplete()) { NetCommandRef *msg = NetPacket::ConstructNetCommandMsgFromRawData(temp->getRawData(), temp->getRawDataLength()); @@ -204,10 +204,10 @@ NetCommandList * NetCommandWrapperList::getReadyCommands() ret->setRelay(msg->getRelay()); deleteInstance(msg); - msg = NULL; + msg = nullptr; removeFromList(temp); - temp = NULL; + temp = nullptr; } temp = next; } @@ -216,29 +216,29 @@ NetCommandList * NetCommandWrapperList::getReadyCommands() } void NetCommandWrapperList::removeFromList(NetCommandWrapperListNode *node) { - if (node == NULL) { + if (node == nullptr) { return; } NetCommandWrapperListNode *temp = m_list; - NetCommandWrapperListNode *prev = NULL; + NetCommandWrapperListNode *prev = nullptr; - while ((temp != NULL) && (temp->getCommandID() != node->getCommandID())) { + while ((temp != nullptr) && (temp->getCommandID() != node->getCommandID())) { prev = temp; temp = temp->m_next; } - if (temp == NULL) { + if (temp == nullptr) { return; } - if (prev == NULL) { + if (prev == nullptr) { m_list = temp->m_next; deleteInstance(temp); - temp = NULL; + temp = nullptr; } else { prev->m_next = temp->m_next; deleteInstance(temp); - temp = NULL; + temp = nullptr; } } diff --git a/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp b/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp index 43f5cd6da28..920e9d641cb 100644 --- a/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp @@ -43,24 +43,24 @@ // The per-player pointers for the list of commands static CommandMsg *CommandHead[MAX_SLOTS] = { /// @todo: remove static initialization - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr }; static CommandMsg *CommandTail[MAX_SLOTS] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr }; /** @@ -75,7 +75,7 @@ static Bool AddToNetCommandList(GameMessage *msg, UnsignedInt timestamp, Command return false; } - if (CommandTail == NULL) + if (CommandTail == nullptr) { CommandHead = cmdMsg; CommandTail = cmdMsg; @@ -104,32 +104,32 @@ Bool AddToNetCommandList(Int playerNum, GameMessage *msg, UnsignedInt timestamp) /** * GetCommandMsg returns a GameMessage (deleting its CommandMsg wrapper) that is valid - * for the current frame, or NULL. + * for the current frame, or nullptr. * static GameMessage * GetCommandMsg(UnsignedInt timestamp, CommandMsg *& CommandHead, CommandMsg *& CommandTail) { if (!CommandHead) - return NULL; + return nullptr; if (CommandHead->GetTimestamp() < timestamp) { DEBUG_LOG(("Time is %d, yet message timestamp is %d!", timestamp, CommandHead->GetTimestamp())); - return NULL; + return nullptr; } if (CommandHead->GetTimestamp() != timestamp) - return NULL; + return nullptr; CommandMsg *theMsg = CommandHead; if (CommandHead->GetNextCommandMsg()) { - CommandHead->GetNextCommandMsg()->SetPrevCommandMsg(NULL); + CommandHead->GetNextCommandMsg()->SetPrevCommandMsg(nullptr); CommandHead = CommandHead->GetNextCommandMsg(); } else { - CommandHead = CommandTail = NULL; + CommandHead = CommandTail = nullptr; } GameMessage *msg = theMsg->GetGameMessage(); @@ -143,7 +143,7 @@ static GameMessage * GetCommandMsg(UnsignedInt timestamp, CommandMsg *& CommandH GameMessage * GetCommandMsg(UnsignedInt timestamp, Int playerNum) { if (playerNum < 0 || playerNum >= MAX_SLOTS) - return NULL; + return nullptr; //DEBUG_LOG(("Adding msg to NetCommandList %d", playerNum)); return GetCommandMsg(timestamp, CommandHead[playerNum], CommandTail[playerNum]); diff --git a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp index 51cf3bf1e74..d22233746c2 100644 --- a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -44,8 +44,8 @@ NetCommandRef * NetPacket::ConstructNetCommandMsgFromRawData(UnsignedByte *data, UnsignedByte relay = 0; Int offset = 0; - NetCommandRef *ref = NULL; - NetCommandMsg *msg = NULL; + NetCommandRef *ref = nullptr; + NetCommandMsg *msg = nullptr; while (offset < (Int)dataLength) { @@ -180,7 +180,7 @@ NetCommandRef * NetPacket::ConstructNetCommandMsgFromRawData(UnsignedByte *data, ref->setRelay(relay); msg->detach(); - msg = NULL; + msg = nullptr; return ref; @@ -203,7 +203,7 @@ NetPacketList NetPacket::ConstructBigCommandPacketList(NetCommandRef *ref) { } UnsignedInt bufferSize = GetBufferSizeNeededForCommand(msg); // need to implement. I have a drinking problem. - UnsignedByte *bigPacketData = NULL; + UnsignedByte *bigPacketData = nullptr; NetPacketList packetList; @@ -258,15 +258,15 @@ NetPacketList NetPacket::ConstructBigCommandPacketList(NetCommandRef *ref) { packetList.push_back(packet); deleteInstance(ref); - ref = NULL; + ref = nullptr; ++currentChunk; } wrapperMsg->detach(); - wrapperMsg = NULL; + wrapperMsg = nullptr; delete[] bigPacketData; - bigPacketData = NULL; + bigPacketData = nullptr; return packetList; } @@ -274,7 +274,7 @@ NetPacketList NetPacket::ConstructBigCommandPacketList(NetCommandRef *ref) { UnsignedInt NetPacket::GetBufferSizeNeededForCommand(NetCommandMsg *msg) { // This is where the fun begins... - if (msg == NULL) { + if (msg == nullptr) { return TRUE; // There was nothing to add, so it was successful. } // Use the virtual function for all command message types @@ -425,7 +425,7 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m offset += sizeof(numTypes); GameMessageParserArgumentType *argType = parser->getFirstArgumentType(); - while (argType != NULL) { + while (argType != nullptr) { UnsignedByte type = (UnsignedByte)(argType->getType()); memcpy(buffer + offset, &type, sizeof(type)); offset += sizeof(type); @@ -493,12 +493,12 @@ void NetPacket::FillBufferWithGameCommand(UnsignedByte *buffer, NetCommandRef *m } deleteInstance(parser); - parser = NULL; + parser = nullptr; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addGameMessage - added game message, frame %d, player %d, command ID %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); deleteInstance(gmsg); - gmsg = NULL; + gmsg = nullptr; } void NetPacket::FillBufferWithAckCommand(UnsignedByte *buffer, NetCommandRef *msg) { @@ -1494,7 +1494,7 @@ NetPacket::NetPacket(TransportMessage *msg) { */ NetPacket::~NetPacket() { deleteInstance(m_lastCommand); - m_lastCommand = NULL; + m_lastCommand = nullptr; } /** @@ -1513,12 +1513,12 @@ void NetPacket::init() { m_lastCommandType = 0; m_lastRelay = 0; - m_lastCommand = NULL; + m_lastCommand = nullptr; } void NetPacket::reset() { deleteInstance(m_lastCommand); - m_lastCommand = NULL; + m_lastCommand = nullptr; init(); } @@ -1540,7 +1540,7 @@ Bool NetPacket::addCommand(NetCommandRef *msg) { NetCommandMsg *cmdMsg = msg->getCommand(); - if (msg == NULL) { + if (msg == nullptr) { return TRUE; // There was nothing to add, so it was successful. } @@ -4023,7 +4023,7 @@ Bool NetPacket::isRoomForFrameMessage(NetCommandRef *msg) { } Bool NetPacket::isFrameRepeat(NetCommandRef *msg) { - if (m_lastCommand == NULL) { + if (m_lastCommand == nullptr) { return FALSE; } if (m_lastCommand->getCommand()->getNetCommandType() != NETCOMMANDTYPE_FRAMEINFO) { @@ -4153,7 +4153,7 @@ Bool NetPacket::isRoomForAckMessage(NetCommandRef *msg) { } Bool NetPacket::isAckRepeat(NetCommandRef *msg) { - if (m_lastCommand == NULL) { + if (m_lastCommand == nullptr) { return FALSE; } if (m_lastCommand->getCommand()->getNetCommandType() != msg->getCommand()->getNetCommandType()) { @@ -4301,7 +4301,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { m_packetLen += sizeof(numTypes); GameMessageParserArgumentType *argType = parser->getFirstArgumentType(); - while (argType != NULL) { + while (argType != nullptr) { UnsignedByte type = (UnsignedByte)(argType->getType()); memcpy(m_packet + m_packetLen, &type, sizeof(type)); m_packetLen += sizeof(type); @@ -4321,7 +4321,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { } deleteInstance(parser); - parser = NULL; + parser = nullptr; // DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::addGameMessage - added game message, frame %d, player %d, command ID %d", m_lastFrame, m_lastPlayerID, m_lastCommandID)); @@ -4335,7 +4335,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { } deleteInstance(gmsg); - gmsg = NULL; + gmsg = nullptr; return retval; } @@ -4427,7 +4427,7 @@ Bool NetPacket::isRoomForGameMessage(NetCommandRef *msg, GameMessage *gmsg) { msglen += sizeof(UnsignedByte); // Int numTypes = parser->getNumTypes(); GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); - while (arg != NULL) { + while (arg != nullptr) { msglen += sizeof(UnsignedByte); // argument type msglen += sizeof(UnsignedByte); // argument count GameMessageArgumentDataType type = arg->getType(); @@ -4475,7 +4475,7 @@ Bool NetPacket::isRoomForGameMessage(NetCommandRef *msg, GameMessage *gmsg) { } deleteInstance(parser); - parser = NULL; + parser = nullptr; // Is there enough room in the packet for this message? if (msglen > (MAX_PACKET_SIZE - m_packetLen)) { @@ -4498,7 +4498,7 @@ NetCommandList * NetPacket::getCommandList() { UnsignedShort commandID = 1; // The first command is going to be UnsignedByte commandType = 0; UnsignedByte relay = 0; - NetCommandRef *lastCommand = NULL; + NetCommandRef *lastCommand = nullptr; Int i = 0; while (i < m_packetLen) { @@ -4533,7 +4533,7 @@ NetCommandList * NetPacket::getCommandList() { case NetPacketFieldTypes::Data: { ++i; - NetCommandMsg *msg = NULL; + NetCommandMsg *msg = nullptr; //DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::getCommandList() - command of type %d(%s)", commandType, GetNetCommandTypeAsString((NetCommandType)commandType))); @@ -4648,7 +4648,7 @@ NetCommandList * NetPacket::getCommandList() { break; } - if (msg == NULL) { + if (msg == nullptr) { DEBUG_CRASH(("Didn't read a message from the packet. Things are about to go wrong.")); continue; } @@ -4668,7 +4668,7 @@ NetCommandList * NetPacket::getCommandList() { // add the message to the list. NetCommandRef *ref = retval->addMessage(msg); - if (ref != NULL) { + if (ref != nullptr) { ref->setRelay(relay); } else { DEBUG_LOG_LEVEL(DEBUG_LEVEL_NET, ("NetPacket::getCommandList - failed to set relay for message %d", msg->getID())); @@ -4679,8 +4679,8 @@ NetCommandList * NetPacket::getCommandList() { msg->detach(); // Need to detach from new NetCommandMsg created by the "readXMessage" above. - // since the message is part of the list now, we don't have to keep track of it. So we'll just set it to NULL. - msg = NULL; + // since the message is part of the list now, we don't have to keep track of it. So we'll just set it to null. + msg = nullptr; break; } @@ -4688,11 +4688,11 @@ NetCommandList * NetPacket::getCommandList() { ++i; // Repeat the last command, doing some funky cool byte-saving stuff - if (lastCommand == NULL) { + if (lastCommand == nullptr) { DEBUG_CRASH(("Got a repeat command with no command to repeat.")); } - NetCommandMsg *msg = NULL; + NetCommandMsg *msg = nullptr; switch(commandType) { @@ -4744,7 +4744,7 @@ NetCommandList * NetPacket::getCommandList() { // add the message to the list. NetCommandRef *ref = retval->addMessage(msg); - if (ref != NULL) { + if (ref != nullptr) { ref->setRelay(relay); } @@ -4754,8 +4754,8 @@ NetCommandList * NetPacket::getCommandList() { msg->detach(); // Need to detach from new NetCommandMsg created by the "readXMessage" above. - // since the message is part of the list now, we don't have to keep track of it. So we'll just set it to NULL. - msg = NULL; + // since the message is part of the list now, we don't have to keep track of it. So we'll just set it to null. + msg = nullptr; break; } @@ -4772,7 +4772,7 @@ NetCommandList * NetPacket::getCommandList() { } deleteInstance(lastCommand); - lastCommand = NULL; + lastCommand = nullptr; return retval; } @@ -4817,7 +4817,7 @@ NetCommandMsg * NetPacket::readGameMessage(UnsignedByte *data, Int &i) GameMessageParserArgumentType *parserArgType = parser->getFirstArgumentType(); GameMessageArgumentDataType lasttype = ARGUMENTDATATYPE_UNKNOWN; Int argsLeftForType = 0; - if (parserArgType != NULL) { + if (parserArgType != nullptr) { lasttype = parserArgType->getType(); argsLeftForType = parserArgType->getArgCount(); } @@ -4826,14 +4826,14 @@ NetCommandMsg * NetPacket::readGameMessage(UnsignedByte *data, Int &i) --argsLeftForType; if (argsLeftForType == 0) { - DEBUG_ASSERTCRASH(parserArgType != NULL, ("parserArgType was NULL when it shouldn't have been.")); - if (parserArgType == NULL) { - return NULL; + DEBUG_ASSERTCRASH(parserArgType != nullptr, ("parserArgType was null when it shouldn't have been.")); + if (parserArgType == nullptr) { + return nullptr; } parserArgType = parserArgType->getNext(); - // parserArgType is allowed to be NULL here - if (parserArgType != NULL) { + // parserArgType is allowed to be null here + if (parserArgType != nullptr) { argsLeftForType = parserArgType->getArgCount(); lasttype = parserArgType->getType(); } @@ -4841,7 +4841,7 @@ NetCommandMsg * NetPacket::readGameMessage(UnsignedByte *data, Int &i) } deleteInstance(parser); - parser = NULL; + parser = nullptr; return (NetCommandMsg *)msg; } diff --git a/Core/GameEngine/Source/GameNetwork/Network.cpp b/Core/GameEngine/Source/GameNetwork/Network.cpp index 71d672cfed3..a308536ffc8 100644 --- a/Core/GameEngine/Source/GameNetwork/Network.cpp +++ b/Core/GameEngine/Source/GameNetwork/Network.cpp @@ -90,7 +90,7 @@ static const int CmdMsgLen = 6; //< Minimum size of a command packet (Int + Unsi // PUBLIC DATA //////////////////////////////////////////////////////////////// /// The Network singleton instance -NetworkInterface *TheNetwork = NULL; +NetworkInterface *TheNetwork = nullptr; // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -270,8 +270,8 @@ Network::Network() m_frameDataReady = FALSE; m_isStalling = FALSE; m_sawCRCMismatch = FALSE; - m_conMgr = NULL; - m_messageWindow = NULL; + m_conMgr = nullptr; + m_messageWindow = nullptr; #if defined(RTS_DEBUG) m_networkOn = TRUE; @@ -295,11 +295,11 @@ Bool Network::deinit( void ) { m_conMgr->destroyGameMessages(); delete m_conMgr; - m_conMgr = NULL; + m_conMgr = nullptr; } if (m_messageWindow) { TheWindowManager->winDestroy(m_messageWindow); - m_messageWindow = NULL; + m_messageWindow = nullptr; } return true; @@ -403,7 +403,7 @@ void Network::parseUserList( const GameInfo *game ) { if (!game) { - DEBUG_LOG(("FAILED parseUserList with a NULL game")); + DEBUG_LOG(("FAILED parseUserList with a null game")); return; } @@ -425,8 +425,8 @@ void Network::startGame() { * it explicitly, but regardless, this is the one we're going to use. */ void Network::setLocalAddress(UnsignedInt ip, UnsignedInt port) { - DEBUG_ASSERTCRASH(m_conMgr != NULL, ("Connection manager does not exist.")); - if (m_conMgr != NULL) { + DEBUG_ASSERTCRASH(m_conMgr != nullptr, ("Connection manager does not exist.")); + if (m_conMgr != nullptr) { m_conMgr->setLocalAddress(ip, port); } } @@ -435,15 +435,15 @@ void Network::setLocalAddress(UnsignedInt ip, UnsignedInt port) { * Tell the network to initialize the transport object */ void Network::initTransport() { - DEBUG_ASSERTCRASH(m_conMgr != NULL, ("Connection manager does not exist.")); - if (m_conMgr != NULL) { + DEBUG_ASSERTCRASH(m_conMgr != nullptr, ("Connection manager does not exist.")); + if (m_conMgr != nullptr) { m_conMgr->initTransport(); } } void Network::attachTransport(Transport *transport) { - DEBUG_ASSERTCRASH(m_conMgr != NULL, ("Connection manager does not exist.")); - if (m_conMgr != NULL) { + DEBUG_ASSERTCRASH(m_conMgr != nullptr, ("Connection manager does not exist.")); + if (m_conMgr != nullptr) { m_conMgr->attachTransport(transport); } } @@ -452,7 +452,7 @@ void Network::attachTransport(Transport *transport) { * Does this command need to be transfered to the other game clients? */ Bool Network::isTransferCommand(GameMessage *msg) { - if ((msg != NULL) && ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES))) { + if ((msg != nullptr) && ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES))) { return TRUE; } return FALSE; @@ -463,8 +463,8 @@ Bool Network::isTransferCommand(GameMessage *msg) { */ void Network::GetCommandsFromCommandList() { GameMessage *msg = TheCommandList->getFirstMessage(); - GameMessage *next = NULL; - while (msg != NULL) { + GameMessage *next = nullptr; + while (msg != nullptr) { next = msg->next(); if (isTransferCommand(msg)) { // Is this something we should be sending to the other players? if (m_localStatus == NETLOCALSTATUS_INGAME) { @@ -559,7 +559,7 @@ Bool Network::processCommand(GameMessage *msg) * returns true if all the commands are ready for the given frame. */ Bool Network::AllCommandsReady(UnsignedInt frame) { - if (m_conMgr == NULL) { + if (m_conMgr == nullptr) { return TRUE; } @@ -579,13 +579,13 @@ Bool Network::AllCommandsReady(UnsignedInt frame) { * The commands need to be put on in the same order across all clients. */ void Network::RelayCommandsToCommandList(UnsignedInt frame) { - if ((m_conMgr == NULL) || (m_localStatus == NETLOCALSTATUS_PREGAME)) { + if ((m_conMgr == nullptr) || (m_localStatus == NETLOCALSTATUS_PREGAME)) { return; } m_checkCRCsThisFrame = FALSE; NetCommandList *netcmdlist = m_conMgr->getFrameCommandList(frame); NetCommandRef *msg = netcmdlist->getFirstMessage(); - while (msg != NULL) { + while (msg != nullptr) { NetCommandType cmdType = msg->getCommand()->getNetCommandType(); if (cmdType == NETCOMMANDTYPE_GAMECOMMAND) { //DEBUG_LOG(("Network::RelayCommandsToCommandList - appending command %d of type %s to command list on frame %d", msg->getCommand()->getID(), ((NetGameCommandMsg *)msg->getCommand())->constructGameMessage()->getCommandAsString(), TheGameLogic->getFrame())); @@ -700,7 +700,7 @@ void Network::update( void ) #endif GetCommandsFromCommandList(); // Remove commands from TheCommandList and send them to the connection manager. - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { if (m_localStatus == NETLOCALSTATUS_INGAME) { m_conMgr->updateRunAhead(m_runAhead, m_frameRate, m_didSelfSlug, getExecutionFrame()); m_didSelfSlug = FALSE; @@ -738,7 +738,7 @@ void Network::liteupdate() { } #endif - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { if (m_localStatus == NETLOCALSTATUS_PREGAME) { m_conMgr->update(FALSE); } else { @@ -748,7 +748,7 @@ void Network::liteupdate() { } void Network::endOfGameCheck() { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { if (m_conMgr->canILeave()) { m_conMgr->disconnectLocalPlayer(); TheGameLogic->exitGame(); @@ -774,7 +774,7 @@ Bool Network::timeForNewFrame() { * to avoid being frozen by spikes in network lag. This will happen if another user's computer is * running too far behind us, so we need to slow down to let them catch up. */ - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { Real cushion = m_conMgr->getMinimumCushion(); Real runAheadPercentage = m_runAhead * (TheGlobalData->m_networkRunAheadSlack / (Real)100.0); // If we are at least 50% into our slack, we need to slow down. if (cushion < runAheadPercentage) { @@ -938,7 +938,7 @@ Bool Network::areAllQueuesEmpty(void) * Quit the game now. This should only be called from the disconnect screen. */ void Network::quitGame() { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->quitGame(); } @@ -968,28 +968,28 @@ Bool Network::isPacketRouter( void ) * Register a vote towards a player being disconnected. */ void Network::voteForPlayerDisconnect(Int slot) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->voteForPlayerDisconnect(slot); } } void Network::updateLoadProgress( Int percent ) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->updateLoadProgress( percent ); } } void Network::loadProgressComplete( void ) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->loadProgressComplete(); } } void Network::sendTimeOutGameStart( void ) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->sendTimeOutGameStart(); } } @@ -997,7 +997,7 @@ void Network::sendTimeOutGameStart( void ) UnsignedInt Network::getLocalPlayerID() { -if (m_conMgr != NULL) { +if (m_conMgr != nullptr) { return m_conMgr->getLocalPlayerID(); } return 49; @@ -1009,21 +1009,21 @@ UnicodeString Network::getPlayerName(Int playerNum) return UnicodeString::TheEmptyString; } } - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { return m_conMgr->getPlayerName( playerNum ); } return UnicodeString::TheEmptyString; } Int Network::getNumPlayers() { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { return m_conMgr->getNumPlayers(); } return -1; } Int Network::getSlotAverageFPS(Int slot) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { return m_conMgr->getSlotAverageFPS(slot); } return -1; @@ -1040,13 +1040,13 @@ void Network::toggleNetworkOn() { #endif void Network::notifyOthersOfCurrentFrame() { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->notifyOthersOfCurrentFrame(TheGameLogic->getFrame()); } } void Network::notifyOthersOfNewFrame(UnsignedInt frame) { - if (m_conMgr != NULL) { + if (m_conMgr != nullptr) { m_conMgr->notifyOthersOfNewFrame(frame); } } diff --git a/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp index d8f7b172c79..174599cc97c 100644 --- a/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp @@ -86,7 +86,7 @@ UnsignedInt ResolveIP(AsciiString host) if (host.isEmpty()) { - DEBUG_LOG(("ResolveIP(): Can't resolve NULL")); + DEBUG_LOG(("ResolveIP(): Can't resolve null")); return 0; } @@ -98,7 +98,7 @@ UnsignedInt ResolveIP(AsciiString host) // String such as "localhost" hostStruct = gethostbyname(host.str()); - if (hostStruct == NULL) + if (hostStruct == nullptr) { DEBUG_LOG(("ResolveIP(): Can't resolve %s", host.str())); return 0; diff --git a/Core/GameEngine/Source/GameNetwork/Transport.cpp b/Core/GameEngine/Source/GameNetwork/Transport.cpp index 26c459f161b..2a4e0c31d1d 100644 --- a/Core/GameEngine/Source/GameNetwork/Transport.cpp +++ b/Core/GameEngine/Source/GameNetwork/Transport.cpp @@ -70,7 +70,7 @@ static inline void decryptBuf( unsigned char *buf, Int len ) Transport::Transport(void) { m_winsockInit = false; - m_udpsock = NULL; + m_udpsock = nullptr; } Transport::~Transport(void) @@ -120,7 +120,7 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) DEBUG_CRASH(("Could not bind to 0x%8.8X:%d", ip, port)); DEBUG_LOG(("Transport::init - Failure to bind socket with error code %x", retval)); delete m_udpsock; - m_udpsock = NULL; + m_udpsock = nullptr; return false; } @@ -162,7 +162,7 @@ Bool Transport::init( UnsignedInt ip, UnsignedShort port ) void Transport::reset( void ) { delete m_udpsock; - m_udpsock = NULL; + m_udpsock = nullptr; if (m_winsockInit) { @@ -190,7 +190,7 @@ Bool Transport::update( void ) Bool Transport::doSend() { if (!m_udpsock) { - DEBUG_LOG(("Transport::doSend() - m_udpSock is NULL!")); + DEBUG_LOG(("Transport::doSend() - m_udpSock is null!")); return FALSE; } @@ -270,7 +270,7 @@ Bool Transport::doRecv() { if (!m_udpsock) { - DEBUG_LOG(("Transport::doRecv() - m_udpSock is NULL!")); + DEBUG_LOG(("Transport::doRecv() - m_udpSock is null!")); return FALSE; } diff --git a/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp b/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp index d644725d483..ca18a2de9ef 100644 --- a/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp +++ b/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp @@ -57,7 +57,7 @@ class OLEInitializer OLEInitializer() { // Initialize this instance - OleInitialize(NULL); + OleInitialize(nullptr); } ~OLEInitializer() { @@ -67,7 +67,7 @@ class OLEInitializer OLEInitializer g_OLEInitializer; CComModule _Module; -CComObject * TheWebBrowser = NULL; +CComObject * TheWebBrowser = nullptr; /****************************************************************************** @@ -90,7 +90,7 @@ WebBrowser::WebBrowser() : mRefCount(1) { DEBUG_LOG(("Instantiating embedded WebBrowser")); - m_urlList = NULL; + m_urlList = nullptr; } @@ -114,15 +114,15 @@ WebBrowser::~WebBrowser() { DEBUG_LOG(("Destructing embedded WebBrowser")); if (this == TheWebBrowser) { - DEBUG_LOG(("WebBrowser::~WebBrowser - setting TheWebBrowser to NULL")); - TheWebBrowser = NULL; + DEBUG_LOG(("WebBrowser::~WebBrowser - setting TheWebBrowser to null")); + TheWebBrowser = nullptr; } WebBrowserURL *url = m_urlList; - while (url != NULL) { + while (url != nullptr) { WebBrowserURL *temp = url; url = url->m_next; deleteInstance(temp); - temp = NULL; + temp = nullptr; } } @@ -132,14 +132,14 @@ WebBrowser::~WebBrowser() const FieldParse WebBrowserURL::m_URLFieldParseTable[] = { - { "URL", INI::parseAsciiString, NULL, offsetof( WebBrowserURL, m_url ) }, - { NULL, NULL, NULL, 0 }, + { "URL", INI::parseAsciiString, nullptr, offsetof( WebBrowserURL, m_url ) }, + { nullptr, nullptr, nullptr, 0 }, }; WebBrowserURL::WebBrowserURL() { - m_next = NULL; + m_next = nullptr; m_tag.clear(); m_url.clear(); } @@ -165,9 +165,9 @@ WebBrowserURL::~WebBrowserURL() void WebBrowser::init() { - m_urlList = NULL; + m_urlList = nullptr; INI ini; - ini.loadFileDirectory( "Data\\INI\\Webpages", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Webpages", INI_LOAD_OVERWRITE, nullptr ); } /****************************************************************************** @@ -198,7 +198,7 @@ WebBrowserURL * WebBrowser::findURL(AsciiString tag) { WebBrowserURL *retval = m_urlList; - while ((retval != NULL) && tag.compareNoCase(retval->m_tag.str())) + while ((retval != nullptr) && tag.compareNoCase(retval->m_tag.str())) { retval = retval->m_next; } @@ -234,7 +234,7 @@ WebBrowserURL * WebBrowser::makeNewURL(AsciiString tag) STDMETHODIMP WebBrowser::QueryInterface(REFIID iid, void** ppv) IUNKNOWN_NOEXCEPT { - *ppv = NULL; + *ppv = nullptr; if ((iid == IID_IUnknown) || (iid == IID_IBrowserDispatch)) { @@ -294,7 +294,7 @@ ULONG STDMETHODCALLTYPE WebBrowser::Release(void) IUNKNOWN_NOEXCEPT { DEBUG_LOG(("WebBrowser::Release - all references released, deleting the object.")); if (this == TheWebBrowser) { - TheWebBrowser = NULL; + TheWebBrowser = nullptr; } delete this; return 0; diff --git a/Core/GameEngine/Source/GameNetwork/udp.cpp b/Core/GameEngine/Source/GameNetwork/udp.cpp index fd21c6e066a..cc4c087d0b4 100644 --- a/Core/GameEngine/Source/GameNetwork/udp.cpp +++ b/Core/GameEngine/Source/GameNetwork/udp.cpp @@ -134,7 +134,7 @@ Int UDP::Bind(const char *Host,UnsignedShort port) return ( Bind( ntohl(inet_addr(Host)), port) ); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( Bind(ntohl(hostNode->s_addr),port) ); @@ -264,7 +264,7 @@ Int UDP::Read(unsigned char *msg,UnsignedInt len,sockaddr_in *from) Int retval; int alen=sizeof(sockaddr_in); - if (from!=NULL) + if (from!=nullptr) { retval=recvfrom(fd,(char *)msg,len,0,(struct sockaddr *)from,&alen); #ifdef _WIN32 @@ -287,7 +287,7 @@ Int UDP::Read(unsigned char *msg,UnsignedInt len,sockaddr_in *from) } else { - retval=recvfrom(fd,(char *)msg,len,0,NULL,NULL); + retval=recvfrom(fd,(char *)msg,len,0,nullptr,nullptr); #ifdef _WIN32 if (retval==SOCKET_ERROR) { @@ -434,7 +434,7 @@ int UDP::Wait(Int sec,Int usec,fd_set &givenSet,fd_set &returnSet) while( ! done) { if (noTimeout) - retval=select(givenMax+1,&returnSet,0,0,NULL); + retval=select(givenMax+1,&returnSet,0,0,nullptr); else { timeout.GetTimevalMT(tv); diff --git a/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h b/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h index 300f1147d35..6d6f52f2d55 100644 --- a/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h +++ b/Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h @@ -70,10 +70,10 @@ struct PlayingAudio PlayingAudio() : m_type(PAT_INVALID), - m_audioEventRTS(NULL), + m_audioEventRTS(nullptr), m_requestStop(false), m_cleanupAudioEventRTS(true), - m_sample(NULL), + m_sample(nullptr), m_framesFaded(0) { } }; @@ -137,7 +137,7 @@ class MilesAudioManager : public AudioManager public: #if defined(RTS_DEBUG) - virtual void audioDebugDisplay(DebugDisplayInterface *dd, void *, FILE *fp = NULL ); + virtual void audioDebugDisplay(DebugDisplayInterface *dd, void *, FILE *fp = nullptr ); virtual AudioHandle addAudioEvent( const AudioEventRTS *eventToAdd ); ///< Add an audio event (event must be declared in an INI file) #endif diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h index 86c15a96ef6..46e304634ac 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWater.h @@ -205,7 +205,7 @@ class WaterRenderObjClass : public Snapshot, Real m_riverVOrigin; TextureClass *m_riverTexture; - TextureClass *m_whiteTexture; ///< a texture containing only white used for NULL pixel shader stages. + TextureClass *m_whiteTexture; ///< a texture containing only white used for null pixel shader stages. TextureClass *m_waterNoiseTexture; DWORD m_waterPixelShader; ///m_audioEventRTS); dd->printf("%2d: %-20s - (%s) Volume: %d (2D)\n", i, playing->m_audioEventRTS->getEventName().str(), filenameNoSlashes.str(), REAL_TO_INT(volume)); - playingArray[i] = NULL; + playingArray[i] = nullptr; } } if( fp ) @@ -348,7 +348,7 @@ void MilesAudioManager::audioDebugDisplay(DebugDisplayInterface *dd, void *, FIL dd->printf("%2d: %-20s - (%s) Volume: %d, Dist: %s, %s\n", i, playing->m_audioEventRTS->getEventName().str(), filenameNoSlashes.str(), REAL_TO_INT(volume), distStr, str ); - playingArray[i] = NULL; + playingArray[i] = nullptr; } } if( fp ) @@ -499,12 +499,12 @@ void MilesAudioManager::stopAudio( AudioAffect which ) std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; if (BitIsSet(which, AudioAffect_Sound)) { for (it = m_playingSounds.begin(); it != m_playingSounds.end(); ++it) { playing = *it; if (playing) { - AIL_register_EOS_callback(playing->m_sample, NULL); + AIL_register_EOS_callback(playing->m_sample, nullptr); AIL_stop_sample(playing->m_sample); playing->m_status = PS_Stopped; } @@ -515,7 +515,7 @@ void MilesAudioManager::stopAudio( AudioAffect which ) for (it = m_playing3DSounds.begin(); it != m_playing3DSounds.end(); ++it) { playing = *it; if (playing) { - AIL_register_3D_EOS_callback(playing->m_3DSample, NULL); + AIL_register_3D_EOS_callback(playing->m_3DSample, nullptr); AIL_stop_3D_sample(playing->m_3DSample); playing->m_status = PS_Stopped; } @@ -535,7 +535,7 @@ void MilesAudioManager::stopAudio( AudioAffect which ) continue; } } - AIL_register_stream_callback(playing->m_stream, NULL); + AIL_register_stream_callback(playing->m_stream, nullptr); AIL_pause_stream(playing->m_stream, 1); playing->m_status = PS_Stopped; } @@ -548,7 +548,7 @@ void MilesAudioManager::pauseAudio( AudioAffect which ) { std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; if (BitIsSet(which, AudioAffect_Sound)) { for (it = m_playingSounds.begin(); it != m_playingSounds.end(); ++it) { playing = *it; @@ -609,7 +609,7 @@ void MilesAudioManager::resumeAudio( AudioAffect which ) { std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; if (BitIsSet(which, AudioAffect_Sound)) { for (it = m_playingSounds.begin(); it != m_playingSounds.end(); ++it) { playing = *it; @@ -665,7 +665,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; AudioHandle handleToKill = event->getHandleToKill(); @@ -707,7 +707,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) if (!handleToKill || foundSoundToReplace) { stream = AIL_open_stream(m_digitalHandle, fileToPlay.str(), 0); } else { - stream = NULL; + stream = nullptr; } // Put this on here, so that the audio event RTS will be cleaned up regardless. @@ -722,7 +722,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) AIL_set_stream_volume_pan(stream, getEffectiveVolume(event), 0.5f); playStream(event, stream); m_playingStreams.push_back(audio); - audio = NULL; + audio = nullptr; } break; } @@ -777,12 +777,12 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } else { - sample3D = NULL; + sample3D = nullptr; } // Push it onto the list of playing things audio->m_audioEventRTS = event; audio->m_3DSample = sample3D; - audio->m_file = NULL; + audio->m_file = nullptr; audio->m_type = PAT_3DSample; m_playing3DSounds.push_back(audio); @@ -800,7 +800,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } else { - audio = NULL; + audio = nullptr; #ifdef INTENSIVE_AUDIO_DEBUG DEBUG_LOG((" Playing.")); #endif @@ -847,13 +847,13 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } else { - sample = NULL; + sample = nullptr; } // Push it onto the list of playing things audio->m_audioEventRTS = event; audio->m_sample = sample; - audio->m_file = NULL; + audio->m_file = nullptr; audio->m_type = PAT_Sample; m_playingSounds.push_back(audio); @@ -868,7 +868,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) #endif m_playingSounds.pop_back(); } else { - audio = NULL; + audio = nullptr; } #ifdef INTENSIVE_AUDIO_DEBUG @@ -879,8 +879,8 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } } - // If we were able to successfully play audio, then we set it to NULL above. (And it will be freed - // later. However, if audio is non-NULL at this point, then it must be freed. + // If we were able to successfully play audio, then we set it to null above. (And it will be freed + // later. However, if audio is non-null at this point, then it must be freed. if (audio) { releasePlayingAudio(audio); } @@ -1068,7 +1068,7 @@ void MilesAudioManager::releaseMilesHandles( PlayingAudio *release ) case PAT_Sample: { if (release->m_sample) { - AIL_register_EOS_callback(release->m_sample, NULL); + AIL_register_EOS_callback(release->m_sample, nullptr); AIL_stop_sample(release->m_sample); m_availableSamples.push_back(release->m_sample); } @@ -1077,7 +1077,7 @@ void MilesAudioManager::releaseMilesHandles( PlayingAudio *release ) case PAT_3DSample: { if (release->m_3DSample) { - AIL_register_3D_EOS_callback(release->m_3DSample, NULL); + AIL_register_3D_EOS_callback(release->m_3DSample, nullptr); AIL_stop_3D_sample(release->m_3DSample); m_available3DSamples.push_back(release->m_3DSample); } @@ -1086,7 +1086,7 @@ void MilesAudioManager::releaseMilesHandles( PlayingAudio *release ) case PAT_Stream: { if (release->m_stream) { - AIL_register_stream_callback(release->m_stream, NULL); + AIL_register_stream_callback(release->m_stream, nullptr); AIL_close_stream(release->m_stream); } break; @@ -1115,7 +1115,7 @@ void MilesAudioManager::releasePlayingAudio( PlayingAudio *release ) releaseAudioEventRTS(release->m_audioEventRTS); } delete release; - release = NULL; + release = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1211,7 +1211,7 @@ HSAMPLE MilesAudioManager::getFirst2DSample( AudioEventRTS *event ) // Find the first sample of lower priority than my augmented priority that is interruptable and take its handle - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1224,7 +1224,7 @@ H3DSAMPLE MilesAudioManager::getFirst3DSample( AudioEventRTS *event ) } // Find the first sample of lower priority than my augmented priority that is interruptable and take its handle - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1232,14 +1232,14 @@ void MilesAudioManager::adjustPlayingVolume( PlayingAudio *audio ) { Real pan; if (audio->m_type == PAT_Sample) { - AIL_sample_volume_pan(audio->m_sample, NULL, &pan); + AIL_sample_volume_pan(audio->m_sample, nullptr, &pan); AIL_set_sample_volume_pan(audio->m_sample, getEffectiveVolume(audio->m_audioEventRTS), pan); } else if (audio->m_type == PAT_3DSample) { AIL_set_3D_sample_volume(audio->m_3DSample, getEffectiveVolume(audio->m_audioEventRTS)); } else if (audio->m_type == PAT_Stream) { - AIL_stream_volume_pan(audio->m_stream, NULL, &pan); + AIL_stream_volume_pan(audio->m_stream, nullptr, &pan); if (audio->m_audioEventRTS->getAudioEventInfo()->m_soundType == AT_Music ) { AIL_set_stream_volume_pan(audio->m_stream, getEffectiveVolume(audio->m_audioEventRTS), pan); @@ -1443,7 +1443,7 @@ void MilesAudioManager::openDevice( void ) retval = AIL_quick_startup(audioSettings->m_useDigital, audioSettings->m_useMidi, audioSettings->m_outputRate, audioSettings->m_outputBits, audioSettings->m_outputChannels); // Quick handles tells us where to store the various devices. For now, we're only interested in the digital handle. - AIL_quick_handles(&m_digitalHandle, NULL, NULL); + AIL_quick_handles(&m_digitalHandle, nullptr, nullptr); if (retval) { buildProviderList(); @@ -1501,7 +1501,7 @@ Bool MilesAudioManager::isCurrentlyPlaying( AudioHandle handle ) // if something is requested, it is also considered playing std::list::iterator ait; - AudioRequest *req = NULL; + AudioRequest *req = nullptr; for (ait = m_audioRequests.begin(); ait != m_audioRequests.end(); ++ait) { req = *ait; if (req && req->m_usePendingEvent && req->m_pendingEvent->getPlayingHandle() == handle) { @@ -1610,7 +1610,7 @@ PlayingAudio *MilesAudioManager::findPlayingAudioFrom( UnsignedInt audioComplete } } - return NULL; + return nullptr; } @@ -1662,7 +1662,7 @@ void MilesAudioManager::selectProvider( UnsignedInt providerNdx ) } LPDIRECTSOUND lpDirectSoundInfo; - AIL_get_DirectSound_info( NULL, (void**)&lpDirectSoundInfo, NULL ); + AIL_get_DirectSound_info( nullptr, (void**)&lpDirectSoundInfo, nullptr ); Bool useDolby = FALSE; if( lpDirectSoundInfo ) { @@ -1754,7 +1754,7 @@ void MilesAudioManager::unselectProvider( void ) TheVideoPlayer->notifyVideoPlayerOfNewProvider(FALSE); } AIL_close_3D_listener(m_listener); - m_listener = NULL; + m_listener = nullptr; AIL_close_3D_provider(m_provider3D[m_selectedProvider].id); m_lastProvider = m_selectedProvider; @@ -1847,7 +1847,7 @@ Bool MilesAudioManager::doesViolateLimit( AudioEventRTS *event ) const std::list::const_iterator arIt; for (arIt = m_audioRequests.begin(); arIt != m_audioRequests.end(); ++arIt) { AudioRequest *req = (*arIt); - if (req == NULL) { + if (req == nullptr) { continue; } if( req->m_usePendingEvent ) @@ -1947,9 +1947,9 @@ AudioEventRTS* MilesAudioManager::findLowestPrioritySound( AudioEventRTS *event { //If the event we pass in is the lowest priority, don't bother checking because //there is nothing lower priority than lowest. - return NULL; + return nullptr; } - AudioEventRTS *lowestPriorityEvent = NULL; + AudioEventRTS *lowestPriorityEvent = nullptr; AudioPriority lowestPriority; std::list::const_iterator it; @@ -2090,13 +2090,13 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n Real pan; std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; for (it = m_playingSounds.begin(); it != m_playingSounds.end(); ++it) { playing = *it; if (playing && playing->m_audioEventRTS->getEventName() == eventName) { // Adjust it playing->m_audioEventRTS->setVolume(newVolume); - AIL_sample_volume_pan(playing->m_sample, NULL, &pan); + AIL_sample_volume_pan(playing->m_sample, nullptr, &pan); AIL_set_sample_volume_pan(playing->m_sample, getEffectiveVolume(playing->m_audioEventRTS), pan); } } @@ -2115,7 +2115,7 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n if (playing && playing->m_audioEventRTS->getEventName() == eventName) { // Adjust it playing->m_audioEventRTS->setVolume(newVolume); - AIL_stream_volume_pan(playing->m_stream, NULL, &pan); + AIL_stream_volume_pan(playing->m_stream, nullptr, &pan); AIL_set_stream_volume_pan(playing->m_stream, getEffectiveVolume(playing->m_audioEventRTS), pan); } } @@ -2127,7 +2127,7 @@ void MilesAudioManager::removePlayingAudio( AsciiString eventName ) { std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; for( it = m_playingSounds.begin(); it != m_playingSounds.end(); ) { playing = *it; @@ -2176,7 +2176,7 @@ void MilesAudioManager::removeAllDisabledAudio() { std::list::iterator it; - PlayingAudio *playing = NULL; + PlayingAudio *playing = nullptr; for( it = m_playingSounds.begin(); it != m_playingSounds.end(); ) { playing = *it; @@ -2226,7 +2226,7 @@ void MilesAudioManager::processRequestList( void ) std::list::iterator it; for (it = m_audioRequests.begin(); it != m_audioRequests.end(); /* empty */) { AudioRequest *req = (*it); - if (req == NULL) { + if (req == nullptr) { continue; } @@ -2316,7 +2316,7 @@ void MilesAudioManager::processPlayingList( void ) if( volForConsideration < m_audioSettings->m_minVolume && !playAnyways ) { // don't want to get an additional callback for this sample - AIL_register_3D_EOS_callback(playing->m_3DSample, NULL); + AIL_register_3D_EOS_callback(playing->m_3DSample, nullptr); //m_stoppedAudio.push_back(playing); releasePlayingAudio( playing ); it = m_playing3DSounds.erase(it); @@ -2333,7 +2333,7 @@ void MilesAudioManager::processPlayingList( void ) } else { - AIL_register_3D_EOS_callback(playing->m_3DSample, NULL); + AIL_register_3D_EOS_callback(playing->m_3DSample, nullptr); //m_stoppedAudio.push_back(playing); releasePlayingAudio( playing ); it = m_playing3DSounds.erase(it); @@ -2511,7 +2511,7 @@ Bool MilesAudioManager::checkForSample( AudioRequest *req ) return true; } - if ( req->m_pendingEvent->getAudioEventInfo() == NULL ) + if ( req->m_pendingEvent->getAudioEventInfo() == nullptr ) { // Fill in event info getInfoForAudioEvent( req->m_pendingEvent ); @@ -2587,7 +2587,7 @@ Real MilesAudioManager::getFileLengthMS( AsciiString strToLoad ) const } long retVal; - AIL_stream_ms_position(stream, &retVal, NULL); + AIL_stream_ms_position(stream, &retVal, nullptr); // Now close the stream AIL_close_stream(stream); @@ -2646,7 +2646,7 @@ void MilesAudioManager::setDeviceListenerPosition( void ) const Coord3D *MilesAudioManager::getCurrentPositionFromEvent( AudioEventRTS *event ) { if (!event->isPositionalAudio()) { - return NULL; + return nullptr; } return event->getCurrentPosition(); @@ -2731,7 +2731,7 @@ Real MilesAudioManager::getEffectiveVolume(AudioEventRTS *event) const Bool MilesAudioManager::startNextLoop( PlayingAudio *looping ) { closeFile(looping->m_file); - looping->m_file = NULL; + looping->m_file = nullptr; if (looping->m_requestStop) { return false; @@ -2762,7 +2762,7 @@ Bool MilesAudioManager::startNextLoop( PlayingAudio *looping ) looping->m_file = playSample(looping->m_audioEventRTS, looping->m_sample); } - return looping->m_file != NULL; + return looping->m_file != nullptr; } return false; } @@ -2792,7 +2792,7 @@ void *MilesAudioManager::playSample( AudioEventRTS *event, HSAMPLE sample ) initFilters(sample, event); // Load the file in - void *fileBuffer = NULL; + void *fileBuffer = nullptr; fileBuffer = loadFileForRead(event); if (fileBuffer) { AIL_set_sample_file(sample, fileBuffer, 0); @@ -2837,7 +2837,7 @@ void *MilesAudioManager::playSample3D( AudioEventRTS *event, H3DSAMPLE sample3D return fileBuffer; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -2869,7 +2869,7 @@ void MilesAudioManager::createListener( void ) //------------------------------------------------------------------------------------------------- void MilesAudioManager::initDelayFilter( void ) { - if (m_delayFilter != NULL) { + if (m_delayFilter != nullptr) { return; } @@ -2950,7 +2950,7 @@ void MilesAudioManager::processRequest( AudioRequest *req ) //------------------------------------------------------------------------------------------------- void *MilesAudioManager::getHandleForBink( void ) { - if (m_binkHandle == NULL) { + if (m_binkHandle == nullptr) { PlayingAudio *aud = allocatePlayingAudio(); aud->m_audioEventRTS = NEW AudioEventRTS("BinkHandle"); // poolify getInfoForAudioEvent(aud->m_audioEventRTS); @@ -2959,14 +2959,14 @@ void *MilesAudioManager::getHandleForBink( void ) if (!aud->m_sample) { releasePlayingAudio(aud); - return NULL; + return nullptr; } m_binkHandle = aud; } AILLPDIRECTSOUND lpDS; - AIL_get_DirectSound_info(m_binkHandle->m_sample, &lpDS, NULL); + AIL_get_DirectSound_info(m_binkHandle->m_sample, &lpDS, nullptr); return lpDS; } @@ -2975,7 +2975,7 @@ void MilesAudioManager::releaseHandleForBink( void ) { if (m_binkHandle) { releasePlayingAudio(m_binkHandle); - m_binkHandle = NULL; + m_binkHandle = nullptr; } } @@ -3059,7 +3059,7 @@ U32 AILCALLBACK streamingFileOpen(char const *fileName, void **file_handle) #endif (*file_handle) = (void *) TheFileSystem->openFile(fileName, File::READ | File::STREAMING); - return ((*file_handle) != 0); + return ((*file_handle) != nullptr); } //------------------------------------------------------------------------------------------------- @@ -3085,7 +3085,7 @@ U32 AILCALLBACK streamingFileRead(void *file_handle, void *buffer, U32 bytes) //------------------------------------------------------------------------------------------------- AudioFileCache::AudioFileCache() : m_maxSize(0), m_currentlyUsedSize(0), m_mutexName("AudioFileCacheMutex") { - m_mutex = CreateMutex(NULL, FALSE, m_mutexName); + m_mutex = CreateMutex(nullptr, FALSE, m_mutexName); } //------------------------------------------------------------------------------------------------- @@ -3129,7 +3129,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) strToFind = eventToOpenFrom->getDecayFilename(); break; case PP_Done: - return NULL; + return nullptr; } OpenFilesHash::iterator it; @@ -3144,7 +3144,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) File *file = TheFileSystem->openFile(strToFind.str()); if (!file) { DEBUG_ASSERTLOG(strToFind.isEmpty(), ("Missing Audio File: '%s'", strToFind.str())); - return NULL; + return nullptr; } UnsignedInt fileSize = file->size(); @@ -3160,7 +3160,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) if (soundInfo.channels > 1) { DEBUG_CRASH(("Requested Positional Play of audio '%s', but it is in stereo.", strToFind.str())); delete [] buffer; - return NULL; + return nullptr; } } @@ -3183,7 +3183,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) DEBUG_CRASH(("Unexpected compression type in '%s'", strToFind.str())); // prevent leaks delete [] buffer; - return NULL; + return nullptr; } openedAudioFile.m_fileSize = fileSize; @@ -3193,7 +3193,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) if (!freeEnoughSpaceForSample(openedAudioFile)) { m_currentlyUsedSize -= openedAudioFile.m_fileSize; releaseOpenAudioFile(&openedAudioFile); - return NULL; + return nullptr; } } @@ -3245,8 +3245,8 @@ void AudioFileCache::releaseOpenAudioFile( OpenAudioFile *fileToRelease ) // Otherwise, we read it, we own it, blow it away. delete [] fileToRelease->m_file; } - fileToRelease->m_file = NULL; - fileToRelease->m_eventInfo = NULL; + fileToRelease->m_file = nullptr; + fileToRelease->m_eventInfo = nullptr; } } @@ -3373,6 +3373,6 @@ void MilesAudioManager::dumpAllAssetsUsed() } fprintf(logfile, "\nAudio Asset Report - END\n"); fclose(logfile); - logfile = NULL; + logfile = nullptr; } #endif diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp index 1c988d12987..1f4148a251e 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFile.cpp @@ -62,11 +62,11 @@ File* StdBIGFile::openFile( const Char *filename, Int access ) { const ArchivedFileInfo *fileInfo = getArchivedFileInfo(AsciiString(filename)); - if (fileInfo == NULL) { - return NULL; + if (fileInfo == nullptr) { + return nullptr; } - RAMFile *ramFile = NULL; + RAMFile *ramFile = nullptr; if (BitIsSet(access, File::STREAMING)) ramFile = newInstance( StreamingArchiveFile ); @@ -76,8 +76,8 @@ File* StdBIGFile::openFile( const Char *filename, Int access ) ramFile->deleteOnClose(); if (ramFile->openFromArchive(m_file, fileInfo->m_filename, fileInfo->m_offset, fileInfo->m_size) == FALSE) { ramFile->close(); - ramFile = NULL; - return NULL; + ramFile = nullptr; + return nullptr; } if ((access & File::WRITE) == 0) { @@ -90,12 +90,12 @@ File* StdBIGFile::openFile( const Char *filename, Int access ) constexpr size_t bufferSize = 0; File *localFile = TheLocalFileSystem->openFile(filename, access, bufferSize); - if (localFile != NULL) { + if (localFile != nullptr) { ramFile->copyDataToFile(localFile); } ramFile->close(); - ramFile = NULL; + ramFile = nullptr; return localFile; } @@ -153,7 +153,7 @@ Bool StdBIGFile::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) co { const ArchivedFileInfo *tempFileInfo = getArchivedFileInfo(filename); - if (tempFileInfo == NULL) { + if (tempFileInfo == nullptr) { return FALSE; } diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp index 13f7045bb86..ffd0150f4c5 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp @@ -51,8 +51,8 @@ StdBIGFileSystem::~StdBIGFileSystem() { } void StdBIGFileSystem::init() { - DEBUG_ASSERTCRASH(TheLocalFileSystem != NULL, ("TheLocalFileSystem must be initialized before TheArchiveFileSystem.")); - if (TheLocalFileSystem == NULL) { + DEBUG_ASSERTCRASH(TheLocalFileSystem != nullptr, ("TheLocalFileSystem must be initialized before TheArchiveFileSystem.")); + if (TheLocalFileSystem == nullptr) { return; } @@ -90,9 +90,9 @@ ArchiveFile * StdBIGFileSystem::openArchiveFile(const Char *filename) { DEBUG_LOG(("StdBIGFileSystem::openArchiveFile - opening BIG file %s", filename)); - if (fp == NULL) { + if (fp == nullptr) { DEBUG_CRASH(("Could not open archive file %s for parsing", filename)); - return NULL; + return nullptr; } AsciiString asciibuf; @@ -102,8 +102,8 @@ ArchiveFile * StdBIGFileSystem::openArchiveFile(const Char *filename) { if (strcmp(buffer, BIGFileIdentifier) != 0) { DEBUG_CRASH(("Error reading BIG file identifier in file %s", filename)); fp->close(); - fp = NULL; - return NULL; + fp = nullptr; + return nullptr; } // read in the file size. @@ -173,7 +173,7 @@ ArchiveFile * StdBIGFileSystem::openArchiveFile(const Char *filename) { archiveFile->attachFile(fp); delete fileInfo; - fileInfo = NULL; + fileInfo = nullptr; // leave fp open as the archive file will be using it. @@ -227,7 +227,7 @@ Bool StdBIGFileSystem::loadBigFilesFromDirectory(AsciiString dir, AsciiString fi ArchiveFile *archiveFile = openArchiveFile((*it).str()); - if (archiveFile != NULL) { + if (archiveFile != nullptr) { DEBUG_LOG(("StdBIGFileSystem::loadBigFilesFromDirectory - loading %s into the directory tree.", (*it).str())); loadIntoDirectoryTree(archiveFile, overwrite); m_archiveFileMap[(*it)] = archiveFile; diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp index 119cd94a353..d47e473f4d2 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp @@ -131,13 +131,13 @@ File * StdLocalFileSystem::openFile(const Char *filename, Int access, size_t buf // sanity check if (strlen(filename) <= 0) { - return NULL; + return nullptr; } std::filesystem::path path = fixFilenameFromWindowsPath(filename, access); if (path.empty()) { - return NULL; + return nullptr; } if (access & File::WRITE) { @@ -148,7 +148,7 @@ File * StdLocalFileSystem::openFile(const Char *filename, Int access, size_t buf if (!std::filesystem::exists(dir, ec) || ec) { if(!std::filesystem::create_directories(dir, ec) || ec) { DEBUG_LOG(("StdLocalFileSystem::openFile - Error creating directory %s", dir.string().c_str())); - return NULL; + return nullptr; } } } @@ -157,7 +157,7 @@ File * StdLocalFileSystem::openFile(const Char *filename, Int access, size_t buf if (file->open(path.string().c_str(), access, bufferSize) == FALSE) { deleteInstance(file); - file = NULL; + file = nullptr; } else { file->deleteOnClose(); } diff --git a/Core/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp b/Core/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp index 09e9c85f229..b6860e520bf 100644 --- a/Core/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp +++ b/Core/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp @@ -187,9 +187,9 @@ void BinkVideoPlayer::regainFocus( void ) VideoStreamInterface* BinkVideoPlayer::createStream( HBINK handle ) { - if ( handle == NULL ) + if ( handle == nullptr ) { - return NULL; + return nullptr; } BinkVideoStream *stream = NEW BinkVideoStream; @@ -220,7 +220,7 @@ VideoStreamInterface* BinkVideoPlayer::createStream( HBINK handle ) VideoStreamInterface* BinkVideoPlayer::open( AsciiString movieTitle ) { - VideoStreamInterface* stream = NULL; + VideoStreamInterface* stream = nullptr; const Video* pVideo = getVideo(movieTitle); if (pVideo) { @@ -272,7 +272,7 @@ void BinkVideoPlayer::notifyVideoPlayerOfNewProvider( Bool nowHasValid ) { if (!nowHasValid) { TheAudio->releaseHandleForBink(); - BinkSetSoundTrack(0, 0); + BinkSetSoundTrack(0, nullptr); } else { initializeBinkWithMiles(); } @@ -291,7 +291,7 @@ void BinkVideoPlayer::initializeBinkWithMiles() } if( !driver || retVal == 0) { - BinkSetSoundTrack ( 0,0 ); + BinkSetSoundTrack ( 0,nullptr ); } } @@ -300,7 +300,7 @@ void BinkVideoPlayer::initializeBinkWithMiles() //============================================================================ BinkVideoStream::BinkVideoStream() -: m_handle(NULL) +: m_handle(nullptr) { } @@ -311,10 +311,10 @@ BinkVideoStream::BinkVideoStream() BinkVideoStream::~BinkVideoStream() { - if ( m_handle != NULL ) + if ( m_handle != nullptr ) { BinkClose( m_handle ); - m_handle = NULL; + m_handle = nullptr; } } @@ -379,7 +379,7 @@ void BinkVideoStream::frameRender( VideoBuffer *buffer ) return; } - if ( mem != NULL ) + if ( mem != nullptr ) { BinkCopyToBuffer ( m_handle, mem, buffer->pitch(), buffer->height(), @@ -423,7 +423,7 @@ Int BinkVideoStream::frameCount( void ) void BinkVideoStream::frameGoto( Int index ) { - BinkGoto(m_handle, index, NULL ); + BinkGoto(m_handle, index, 0 ); } //============================================================================ diff --git a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 21aea05038e..6c04bbc415b 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -142,30 +142,30 @@ void W3DRadar::deleteResources( void ) // if( m_terrainTexture ) m_terrainTexture->Release_Ref(); - m_terrainTexture = NULL; + m_terrainTexture = nullptr; deleteInstance(m_terrainImage); - m_terrainImage = NULL; + m_terrainImage = nullptr; // // delete overlay resources used // if( m_overlayTexture ) m_overlayTexture->Release_Ref(); - m_overlayTexture = NULL; + m_overlayTexture = nullptr; deleteInstance(m_overlayImage); - m_overlayImage = NULL; + m_overlayImage = nullptr; // // delete shroud resources used // if( m_shroudTexture ) m_shroudTexture->Release_Ref(); - m_shroudTexture = NULL; + m_shroudTexture = nullptr; deleteInstance(m_shroudImage); - m_shroudImage = NULL; + m_shroudImage = nullptr; } @@ -235,7 +235,7 @@ void W3DRadar::radarToPixel( const ICoord2D *radar, ICoord2D *pixel, { // sanity - if( radar == NULL || pixel == NULL ) + if( radar == nullptr || pixel == nullptr ) return; pixel->x = (radar->x * radarWidth / RADAR_CELL_WIDTH) + radarUpperLeftX; @@ -252,7 +252,7 @@ void W3DRadar::drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, cons { // get the hero icon image static const Image *image = (Image *)TheMappedImageCollection->findImageByName("HeroReticle"); - if (image != NULL) + if (image != nullptr) { // convert world to radar coords ICoord2D ulRadar; @@ -682,7 +682,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text { // sanity - if( listHead == NULL || texture == NULL ) + if( listHead == nullptr || texture == nullptr ) return; // get surface for texture to render into @@ -834,16 +834,16 @@ W3DRadar::W3DRadar( void ) { m_terrainTextureFormat = WW3D_FORMAT_UNKNOWN; - m_terrainImage = NULL; - m_terrainTexture = NULL; + m_terrainImage = nullptr; + m_terrainTexture = nullptr; m_overlayTextureFormat = WW3D_FORMAT_UNKNOWN; - m_overlayImage = NULL; - m_overlayTexture = NULL; + m_overlayImage = nullptr; + m_overlayTexture = nullptr; m_shroudTextureFormat = WW3D_FORMAT_UNKNOWN; - m_shroudImage = NULL; - m_shroudTexture = NULL; + m_shroudImage = nullptr; + m_shroudTexture = nullptr; m_textureWidth = RADAR_CELL_WIDTH; m_textureHeight = RADAR_CELL_HEIGHT; @@ -1025,7 +1025,7 @@ void W3DRadar::newMap( TerrainLogic *terrain ) Radar::newMap( terrain ); // sanity - if( terrain == NULL ) + if( terrain == nullptr ) return; // build terrain texture @@ -1074,7 +1074,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) // check to see if this point is part of a working bridge Bool workingBridge = FALSE; bridge = TheTerrainLogic->findBridgeAt( &worldPoint ); - if( bridge != NULL ) + if( bridge != nullptr ) { Object *obj = TheGameLogic->findObjectByID( bridge->peekBridgeInfo()->bridgeObjectID ); @@ -1118,7 +1118,7 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) // get color for this Z and add to our sample color Real underwaterZ; - if( terrain->isUnderwater( worldPoint.x, worldPoint.y, NULL, &underwaterZ ) ) + if( terrain->isUnderwater( worldPoint.x, worldPoint.y, nullptr, &underwaterZ ) ) { // this is our "color" for water color = waterColor; @@ -1297,7 +1297,7 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting return; #endif - W3DShroud* shroud = TheTerrainRenderObject ? TheTerrainRenderObject->getShroud() : NULL; + W3DShroud* shroud = TheTerrainRenderObject ? TheTerrainRenderObject->getShroud() : nullptr; if (!shroud) return; @@ -1466,7 +1466,7 @@ void W3DRadar::refreshObjects() { if constexpr (OVERLAY_REFRESH_RATE > 1) { - if (m_overlayTexture != NULL) + if (m_overlayTexture != nullptr) { updateObjectTexture(m_overlayTexture); } @@ -1484,7 +1484,7 @@ void W3DRadar::refreshObjects() { // sanity - if( listHead == NULL || texture == NULL ) + if( listHead == nullptr || texture == nullptr ) return; // get surface for texture to render into diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index 710e9ad375a..b3edd458603 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -55,6 +55,7 @@ #include #include #include + #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/Xfer.h" @@ -112,7 +113,7 @@ static ShaderClass detailOpaqueShader(SC_DETAIL_BLEND); // Global Functions & Data //----------------------------------------------------------------------------- /// The one-of for the terrain rendering object. -BaseHeightMapRenderObjClass *TheTerrainRenderObject=NULL; +BaseHeightMapRenderObjClass *TheTerrainRenderObject=nullptr; /** Entry point so that trees can be drawn at the appropriate point in the rendering pipe for transparent objects. */ @@ -201,33 +202,33 @@ BaseHeightMapRenderObjClass::~BaseHeightMapRenderObjClass(void) freeMapResources(); delete m_treeBuffer; - m_treeBuffer = NULL; + m_treeBuffer = nullptr; delete m_propBuffer; - m_propBuffer = NULL; + m_propBuffer = nullptr; delete m_bibBuffer; - m_bibBuffer = NULL; + m_bibBuffer = nullptr; #ifdef DO_ROADS delete m_roadBuffer; - m_roadBuffer = NULL; + m_roadBuffer = nullptr; #endif delete m_bridgeBuffer; - m_bridgeBuffer = NULL; + m_bridgeBuffer = nullptr; delete m_waypointBuffer; - m_waypointBuffer = NULL; + m_waypointBuffer = nullptr; delete m_shroud; - m_shroud = NULL; + m_shroud = nullptr; delete [] m_shoreLineTilePositions; - m_shoreLineTilePositions = NULL; + m_shoreLineTilePositions = nullptr; delete [] m_shoreLineSortInfos; - m_shoreLineSortInfos = NULL; + m_shoreLineSortInfos = nullptr; } //============================================================================= @@ -246,9 +247,9 @@ BaseHeightMapRenderObjClass::BaseHeightMapRenderObjClass(void) //We should refine this with actual value. m_maxHeight=(pow(256.0, sizeof(HeightSampleType))-1.0)*MAP_HEIGHT_SCALE; m_minHeight=0; - m_shoreLineTilePositions=NULL; + m_shoreLineTilePositions=nullptr; m_numShoreLineTiles=0; - m_shoreLineSortInfos=NULL; + m_shoreLineSortInfos=nullptr; m_shoreLineSortInfosSize=0; m_shoreLineSortInfosXMajor=TRUE; m_shoreLineTileSortMaxCoordinate=0; @@ -257,13 +258,13 @@ BaseHeightMapRenderObjClass::BaseHeightMapRenderObjClass(void) m_shoreLineTilePositionsSize=0; m_currentMinWaterOpacity = -1.0f; - m_vertexMaterialClass=NULL; - m_stageZeroTexture=NULL; - m_stageOneTexture=NULL; - m_stageTwoTexture=NULL; - m_stageThreeTexture=NULL; - m_destAlphaTexture=NULL; - m_map=NULL; + m_vertexMaterialClass=nullptr; + m_stageZeroTexture=nullptr; + m_stageOneTexture=nullptr; + m_stageTwoTexture=nullptr; + m_stageThreeTexture=nullptr; + m_destAlphaTexture=nullptr; + m_map=nullptr; m_depthFade.X = 0.0f; m_depthFade.Y = 0.0f; m_depthFade.Z = 0.0f; @@ -271,20 +272,20 @@ BaseHeightMapRenderObjClass::BaseHeightMapRenderObjClass(void) m_disableTextures = false; TheTerrainRenderObject = this; - m_treeBuffer = NULL; - m_propBuffer = NULL; - m_bibBuffer = NULL; - m_bridgeBuffer = NULL; - m_waypointBuffer = NULL; + m_treeBuffer = nullptr; + m_propBuffer = nullptr; + m_bibBuffer = nullptr; + m_bridgeBuffer = nullptr; + m_waypointBuffer = nullptr; #ifdef DO_ROADS - m_roadBuffer = NULL; + m_roadBuffer = nullptr; #endif #ifdef DO_SCORCH - m_vertexScorch = NULL; - m_indexScorch = NULL; - m_scorchTexture = NULL; + m_vertexScorch = nullptr; + m_indexScorch = nullptr; + m_scorchTexture = nullptr; clearAllScorches(); - m_shroud = NULL; + m_shroud = nullptr; #endif m_bridgeBuffer = NEW W3DBridgeBuffer; @@ -334,24 +335,24 @@ void BaseHeightMapRenderObjClass::adjustTerrainLOD(Int adj) TheWritableGlobalData->m_terrainLOD=TERRAIN_LOD_MAX; } - if (m_map==NULL) return; + if (m_map==nullptr) return; if (m_shroud) m_shroud->reset(); //need reset here since initHeightData will load new shroud. - BaseHeightMapRenderObjClass *newROBJ = NULL; + BaseHeightMapRenderObjClass *newROBJ = nullptr; if (TheGlobalData->m_terrainLOD==7) { newROBJ = TheHeightMap; - if (newROBJ==NULL) { + if (newROBJ==nullptr) { newROBJ = NEW_REF( HeightMapRenderObjClass, () ); } } else { newROBJ = TheFlatHeightMap; - if (newROBJ==NULL) { + if (newROBJ==nullptr) { newROBJ = NEW_REF( FlatHeightMapRenderObjClass, () ); } } if (TheGlobalData->m_terrainLOD == 5) - newROBJ = NULL; + newROBJ = nullptr; RTS3DScene *pMyScene = (RTS3DScene *)Scene; if (pMyScene) { pMyScene->Remove_Render_Object(this); @@ -368,7 +369,7 @@ void BaseHeightMapRenderObjClass::adjustTerrainLOD(Int adj) newROBJ->initHeightData( m_map->getDrawWidth(), m_map->getDrawHeight(), m_map, - NULL); + nullptr); TheTerrainRenderObject = newROBJ; newROBJ->staticLightingChanged(); newROBJ->m_roadBuffer->loadRoads(); @@ -401,7 +402,7 @@ void BaseHeightMapRenderObjClass::ReleaseResources(void) m_waypointBuffer->freeWaypointBuffers(); } // We need to save the map. - WorldHeightMap *pMap=NULL; + WorldHeightMap *pMap=nullptr; REF_PTR_SET(pMap, m_map); freeMapResources(); m_map = pMap; // ref_ptr_set has already incremented the ref count. @@ -453,7 +454,7 @@ void BaseHeightMapRenderObjClass::ReAcquireResources(void) if (m_map) { - this->initHeightData(m_x,m_y,m_map, NULL); + this->initHeightData(m_x,m_y,m_map, nullptr); // Tell lights to update next time through. m_needFullUpdate = true; } @@ -997,7 +998,7 @@ Real BaseHeightMapRenderObjClass::getHeightMapHeight(Real x, Real y, Coord3D* no //============================================================================= Bool BaseHeightMapRenderObjClass::isClearLineOfSight(const Coord3D& pos, const Coord3D& posOther) const { - if (m_map == NULL) + if (m_map == nullptr) return false; // doh. should not happen. WorldHeightMap *logicHeightMap = TheTerrainVisual?TheTerrainVisual->getLogicHeightMap():m_map; @@ -1156,7 +1157,7 @@ Bool BaseHeightMapRenderObjClass::isClearLineOfSight(const Coord3D& pos, const C Real fzinc = fdz * fnsInv; while (numSteps--) { - Real terrainHeight = getHeightMapHeight( fx, fy, NULL ); + Real terrainHeight = getHeightMapHeight( fx, fy, nullptr ); // if terrainHeight > fz, we can't see, so punt. // add a little fudge to account for slop. @@ -1200,7 +1201,7 @@ Real BaseHeightMapRenderObjClass::getMaxCellHeight(Real x, Real y) const // 0-----1 //Find surrounding grid points - if (m_map == NULL) + if (m_map == nullptr) { //sample point is not on the heightmap return 0.0f; //return default height } @@ -1243,7 +1244,7 @@ Real BaseHeightMapRenderObjClass::getMaxCellHeight(Real x, Real y) const Bool BaseHeightMapRenderObjClass::isCliffCell(Real x, Real y) { - if (m_map == NULL) + if (m_map == nullptr) { //sample point is not on the heightmap return false; } @@ -1269,7 +1270,7 @@ Bool BaseHeightMapRenderObjClass::isCliffCell(Real x, Real y) //============================================================================= Bool BaseHeightMapRenderObjClass::showAsVisibleCliff(Int xIndex, Int yIndex) const { - if (m_map == NULL) + if (m_map == nullptr) { return false; } @@ -1428,7 +1429,7 @@ Int BaseHeightMapRenderObjClass::Class_ID(void) const RenderObjClass * BaseHeightMapRenderObjClass::Clone(void) const { assert(false); - return NULL; + return nullptr; } //============================================================================= @@ -1780,7 +1781,7 @@ Int BaseHeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pM if (m_roadBuffer) m_roadBuffer->setMap(m_map); #endif - HeightSampleType *data = NULL; + HeightSampleType *data = nullptr; if (pMap) { data = pMap->getDataPtr(); } @@ -1833,7 +1834,7 @@ Int BaseHeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pM m_curNumScorchIndices=0; // If the textures aren't allocated (usually because of a hardware reset) need to allocate. Bool needToAllocate = false; - if (m_stageTwoTexture == NULL && m_treeBuffer) { + if (m_stageTwoTexture == nullptr && m_treeBuffer) { needToAllocate = true; } if (data && needToAllocate) @@ -2083,7 +2084,7 @@ Int BaseHeightMapRenderObjClass::getStaticDiffuse(Int x, Int y) if (y >= m_map->getYExtent()) y=m_map->getYExtent()-1; - if (m_map == NULL) { + if (m_map == nullptr) { return(0); } @@ -2134,10 +2135,10 @@ Int BaseHeightMapRenderObjClass::getStaticDiffuse(Int x, Int y) doTheLight(&vertex, lightRay, &normalAtTexel, it, 1.0f); if (it) { pMyScene->destroyLightsIterator(it); - it = NULL; + it = nullptr; } } else { - doTheLight(&vertex, lightRay, &normalAtTexel, NULL, 1.0f); + doTheLight(&vertex, lightRay, &normalAtTexel, nullptr, 1.0f); } return vertex.diffuse; } @@ -2399,7 +2400,7 @@ is rendered. */ //============================================================================= void BaseHeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjListIterator *pLightsIterator) { - if (m_map==NULL) { + if (m_map==nullptr) { return; } if (m_updating) { @@ -2960,8 +2961,8 @@ void BaseHeightMapRenderObjClass::renderTrees(CameraClass * camera) return; } #endif - if (m_map==NULL) return; - if (Scene==NULL) return; + if (m_map==nullptr) return; + if (Scene==nullptr) return; if (m_treeBuffer) { Matrix3D tm(Transform); DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/CameraShakeSystem.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/CameraShakeSystem.cpp index 71d7124a479..140e83450f4 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/CameraShakeSystem.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/CameraShakeSystem.cpp @@ -135,7 +135,7 @@ CameraShakeSystemClass::CameraShakerClass::~CameraShakerClass(void) void CameraShakeSystemClass::CameraShakerClass::Compute_Rotations(const Vector3 & camera_position, Vector3 * set_angles) { - WWASSERT(set_angles != NULL); + WWASSERT(set_angles != nullptr); /* ** We want several different sinusiods, each with a different phase shift and diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp index 5fa25f6e275..f376ff843f3 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp @@ -86,21 +86,21 @@ void W3DLaserDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "NumBeams", INI::parseUnsignedInt, NULL, offsetof( W3DLaserDrawModuleData, m_numBeams ) }, - { "InnerBeamWidth", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_innerBeamWidth ) }, - { "OuterBeamWidth", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_outerBeamWidth ) }, - { "InnerColor", INI::parseColorInt, NULL, offsetof( W3DLaserDrawModuleData, m_innerColor ) }, - { "OuterColor", INI::parseColorInt, NULL, offsetof( W3DLaserDrawModuleData, m_outerColor ) }, - { "MaxIntensityLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( W3DLaserDrawModuleData, m_maxIntensityFrames ) }, - { "FadeLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( W3DLaserDrawModuleData, m_fadeFrames ) }, - { "Texture", INI::parseAsciiString, NULL, offsetof( W3DLaserDrawModuleData, m_textureName ) }, - { "ScrollRate", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_scrollRate ) }, - { "Tile", INI::parseBool, NULL, offsetof( W3DLaserDrawModuleData, m_tile ) }, - { "Segments", INI::parseUnsignedInt, NULL, offsetof( W3DLaserDrawModuleData, m_segments ) }, - { "ArcHeight", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_arcHeight ) }, - { "SegmentOverlapRatio", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_segmentOverlapRatio ) }, - { "TilingScalar", INI::parseReal, NULL, offsetof( W3DLaserDrawModuleData, m_tilingScalar ) }, - { 0, 0, 0, 0 } + { "NumBeams", INI::parseUnsignedInt, nullptr, offsetof( W3DLaserDrawModuleData, m_numBeams ) }, + { "InnerBeamWidth", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_innerBeamWidth ) }, + { "OuterBeamWidth", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_outerBeamWidth ) }, + { "InnerColor", INI::parseColorInt, nullptr, offsetof( W3DLaserDrawModuleData, m_innerColor ) }, + { "OuterColor", INI::parseColorInt, nullptr, offsetof( W3DLaserDrawModuleData, m_outerColor ) }, + { "MaxIntensityLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( W3DLaserDrawModuleData, m_maxIntensityFrames ) }, + { "FadeLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( W3DLaserDrawModuleData, m_fadeFrames ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( W3DLaserDrawModuleData, m_textureName ) }, + { "ScrollRate", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_scrollRate ) }, + { "Tile", INI::parseBool, nullptr, offsetof( W3DLaserDrawModuleData, m_tile ) }, + { "Segments", INI::parseUnsignedInt, nullptr, offsetof( W3DLaserDrawModuleData, m_segments ) }, + { "ArcHeight", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_arcHeight ) }, + { "SegmentOverlapRatio", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_segmentOverlapRatio ) }, + { "TilingScalar", INI::parseReal, nullptr, offsetof( W3DLaserDrawModuleData, m_tilingScalar ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -110,8 +110,8 @@ void W3DLaserDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- W3DLaserDraw::W3DLaserDraw( Thing *thing, const ModuleData* moduleData ) : DrawModule( thing, moduleData ), - m_line3D(NULL), - m_texture(NULL), + m_line3D(nullptr), + m_texture(nullptr), m_textureAspectRatio(1.0f), m_selfDirty(TRUE) { @@ -200,7 +200,7 @@ W3DLaserDraw::W3DLaserDraw( Thing *thing, const ModuleData* moduleData ) : } // add to scene - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object( line ); //add it to our scene so it gets rendered with other objects. // hide the render object until the first time we come to draw it and @@ -225,7 +225,7 @@ W3DLaserDraw::~W3DLaserDraw( void ) { // remove line from scene - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Remove_Render_Object( m_line3D[ i ] ); // delete line diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp index 1347418903d..d26b5e9b1fa 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPropDraw.cpp @@ -55,9 +55,9 @@ void W3DPropDrawModuleData::buildFieldParse(MultiIniFieldParse& p) ModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ModelName", INI::parseAsciiString, NULL, offsetof(W3DPropDrawModuleData, m_modelName) }, + { "ModelName", INI::parseAsciiString, nullptr, offsetof(W3DPropDrawModuleData, m_modelName) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp index 81fff438779..7978ec8d17b 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp @@ -52,8 +52,8 @@ m_maxOutwardMovement(1.0f) const Real START_ACCEL_PERCENT = 0.01f; const Real VELOCITY_BOUNCE_PERCENT = 0.3f; // multiply the velocity by this when you bounce const Real MINIMUM_TOPPLE_SPEED = 0.5f; // Won't let trees fall slower than this - m_toppleFX = NULL; - m_bounceFX = NULL; + m_toppleFX = nullptr; + m_bounceFX = nullptr; m_stumpName.clear(); m_killWhenToppled = true; m_doTopple = false; @@ -78,27 +78,27 @@ void W3DTreeDrawModuleData::buildFieldParse(MultiIniFieldParse& p) ModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ModelName", INI::parseAsciiString, NULL, offsetof(W3DTreeDrawModuleData, m_modelName) }, - { "TextureName", INI::parseAsciiString, NULL, offsetof(W3DTreeDrawModuleData, m_textureName) }, - { "MoveOutwardTime", INI::parseDurationUnsignedInt, NULL, offsetof(W3DTreeDrawModuleData, m_framesToMoveOutward) }, - { "MoveInwardTime", INI::parseDurationUnsignedInt, NULL, offsetof(W3DTreeDrawModuleData, m_framesToMoveInward) }, - { "MoveOutwardDistanceFactor", INI::parseReal, NULL, offsetof(W3DTreeDrawModuleData, m_maxOutwardMovement) }, - { "DarkeningFactor", INI::parseReal, NULL, offsetof(W3DTreeDrawModuleData, m_darkening) }, + { "ModelName", INI::parseAsciiString, nullptr, offsetof(W3DTreeDrawModuleData, m_modelName) }, + { "TextureName", INI::parseAsciiString, nullptr, offsetof(W3DTreeDrawModuleData, m_textureName) }, + { "MoveOutwardTime", INI::parseDurationUnsignedInt, nullptr, offsetof(W3DTreeDrawModuleData, m_framesToMoveOutward) }, + { "MoveInwardTime", INI::parseDurationUnsignedInt, nullptr, offsetof(W3DTreeDrawModuleData, m_framesToMoveInward) }, + { "MoveOutwardDistanceFactor", INI::parseReal, nullptr, offsetof(W3DTreeDrawModuleData, m_maxOutwardMovement) }, + { "DarkeningFactor", INI::parseReal, nullptr, offsetof(W3DTreeDrawModuleData, m_darkening) }, // Topple parameters [7/7/2003] - { "ToppleFX", INI::parseFXList, NULL, offsetof( W3DTreeDrawModuleData, m_toppleFX ) }, - { "BounceFX", INI::parseFXList, NULL, offsetof( W3DTreeDrawModuleData, m_bounceFX ) }, - { "StumpName", INI::parseAsciiString, NULL, offsetof( W3DTreeDrawModuleData, m_stumpName ) }, - { "KillWhenFinishedToppling", INI::parseBool, NULL, offsetof( W3DTreeDrawModuleData, m_killWhenToppled ) }, - { "DoTopple", INI::parseBool, NULL, offsetof( W3DTreeDrawModuleData, m_doTopple ) }, - { "InitialVelocityPercent", INI::parsePercentToReal, NULL, offsetof( W3DTreeDrawModuleData, m_initialVelocityPercent ) }, - { "InitialAccelPercent", INI::parsePercentToReal, NULL, offsetof( W3DTreeDrawModuleData, m_initialAccelPercent ) }, - { "BounceVelocityPercent", INI::parsePercentToReal, NULL, offsetof( W3DTreeDrawModuleData, m_bounceVelocityPercent ) }, - { "MinimumToppleSpeed", INI::parsePositiveNonZeroReal, NULL, offsetof( W3DTreeDrawModuleData, m_minimumToppleSpeed ) }, - { "SinkDistance", INI::parsePositiveNonZeroReal, NULL, offsetof( W3DTreeDrawModuleData, m_sinkDistance ) }, - { "SinkTime", INI::parseDurationUnsignedInt, NULL, offsetof(W3DTreeDrawModuleData, m_sinkFrames) }, - { "DoShadow", INI::parseBool, NULL, offsetof( W3DTreeDrawModuleData, m_doShadow ) }, - { 0, 0, 0, 0 } + { "ToppleFX", INI::parseFXList, nullptr, offsetof( W3DTreeDrawModuleData, m_toppleFX ) }, + { "BounceFX", INI::parseFXList, nullptr, offsetof( W3DTreeDrawModuleData, m_bounceFX ) }, + { "StumpName", INI::parseAsciiString, nullptr, offsetof( W3DTreeDrawModuleData, m_stumpName ) }, + { "KillWhenFinishedToppling", INI::parseBool, nullptr, offsetof( W3DTreeDrawModuleData, m_killWhenToppled ) }, + { "DoTopple", INI::parseBool, nullptr, offsetof( W3DTreeDrawModuleData, m_doTopple ) }, + { "InitialVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( W3DTreeDrawModuleData, m_initialVelocityPercent ) }, + { "InitialAccelPercent", INI::parsePercentToReal, nullptr, offsetof( W3DTreeDrawModuleData, m_initialAccelPercent ) }, + { "BounceVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( W3DTreeDrawModuleData, m_bounceVelocityPercent ) }, + { "MinimumToppleSpeed", INI::parsePositiveNonZeroReal, nullptr, offsetof( W3DTreeDrawModuleData, m_minimumToppleSpeed ) }, + { "SinkDistance", INI::parsePositiveNonZeroReal, nullptr, offsetof( W3DTreeDrawModuleData, m_sinkDistance ) }, + { "SinkTime", INI::parseDurationUnsignedInt, nullptr, offsetof(W3DTreeDrawModuleData, m_sinkFrames) }, + { "DoShadow", INI::parseBool, nullptr, offsetof( W3DTreeDrawModuleData, m_doShadow ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp index 7f4ebc785ea..e3f3902c59b 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/FlatHeightMap.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/FlatHeightMap.h" #include @@ -90,7 +91,7 @@ #include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba. -FlatHeightMapRenderObjClass *TheFlatHeightMap = NULL; +FlatHeightMapRenderObjClass *TheFlatHeightMap = nullptr; //----------------------------------------------------------------------------- // Private Data @@ -142,7 +143,7 @@ Int FlatHeightMapRenderObjClass::freeMapResources(void) FlatHeightMapRenderObjClass::~FlatHeightMapRenderObjClass(void) { releaseTiles(); - TheFlatHeightMap = NULL; + TheFlatHeightMap = nullptr; } //============================================================================= @@ -151,7 +152,7 @@ FlatHeightMapRenderObjClass::~FlatHeightMapRenderObjClass(void) /** Constructor. Mostly nulls out the member variables. */ //============================================================================= FlatHeightMapRenderObjClass::FlatHeightMapRenderObjClass(void): -m_tiles(NULL), +m_tiles(nullptr), m_tilesWidth(0), m_tilesHeight(0), m_numTiles(0), @@ -273,7 +274,7 @@ void FlatHeightMapRenderObjClass::doPartialUpdate(const IRegion2D &partialRange, void FlatHeightMapRenderObjClass::releaseTiles(void) { delete [] m_tiles; - m_tiles = NULL; + m_tiles = nullptr; m_tilesWidth = 0; m_tilesHeight = 0; @@ -377,7 +378,7 @@ void FlatHeightMapRenderObjClass::On_Frame_Update(void) void FlatHeightMapRenderObjClass::staticLightingChanged( void ) { BaseHeightMapRenderObjClass::staticLightingChanged(); - if (m_map==NULL) { + if (m_map==nullptr) { return; } Int i, j; @@ -487,8 +488,8 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) // Force shaders to update. m_stageTwoTexture->restore(); - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); ShaderClass::Invalidate(); // tm.Scale(ObjSpaceExtent); @@ -530,7 +531,7 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) W3DShaderManager::setTexture(0,TheTerrainRenderObject->getShroud()->getShroudTexture()); } - W3DShaderManager::setTexture(1,NULL); // Set by the tile later. [3/31/2003] + W3DShaderManager::setTexture(1,nullptr); // Set by the tile later. [3/31/2003] W3DShaderManager::setTexture(2,m_stageTwoTexture); //cloud W3DShaderManager::setTexture(3,m_stageThreeTexture);//noise //Disable writes to destination alpha channel (if there is one) @@ -547,7 +548,7 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) Bool disableTex = m_disableTextures; if (m_disableTextures ) { DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaque2DShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); } else { W3DShaderManager::setShader(st, pass); } @@ -586,8 +587,8 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) renderShoreLines(&rinfo.Camera); #ifdef DO_ROADS - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); @@ -596,15 +597,15 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) if (Scene) { RTS3DScene *pMyScene = (RTS3DScene *)Scene; RefRenderObjListIterator pDynamicLightsIterator(pMyScene->getDynamicLights()); - m_roadBuffer->drawRoads(&rinfo.Camera, doCloud?m_stageTwoTexture:NULL, TheGlobalData->m_useLightMap?m_stageThreeTexture:NULL, + m_roadBuffer->drawRoads(&rinfo.Camera, doCloud?m_stageTwoTexture:nullptr, TheGlobalData->m_useLightMap?m_stageThreeTexture:nullptr, m_disableTextures,xCoordMin-m_map->getBorderSizeInline(), xCoordMax-m_map->getBorderSizeInline(), yCoordMin-m_map->getBorderSizeInline(), yCoordMax-m_map->getBorderSizeInline(), &pDynamicLightsIterator); } } #endif #ifdef DO_SCORCH - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); @@ -612,8 +613,8 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) drawScorches(); } #endif - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); DX8Wrapper::Apply_Render_State_Changes(); @@ -631,11 +632,11 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo) m_bibBuffer->renderBibs(); #endif // We do some custom blending, so tell the shader class to reset everything. - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); - DX8Wrapper::Set_Material(NULL); + DX8Wrapper::Set_Material(nullptr); } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index 575853e0f60..b7297fb3cde 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -95,7 +95,7 @@ #define no_OPTIMIZED_HEIGHTMAP_LIGHTING 01 // Doesn't work well. jba. -HeightMapRenderObjClass *TheHeightMap = NULL; +HeightMapRenderObjClass *TheHeightMap = nullptr; //----------------------------------------------------------------------------- // Private Data //----------------------------------------------------------------------------- @@ -129,13 +129,13 @@ void HeightMapRenderObjClass::freeIndexVertexBuffers(void) for (int i=0; igetTerrainTexture()); REF_PTR_SET(m_stageOneTexture, pMap->getAlphaTerrainTexture()); } @@ -1026,7 +1026,7 @@ HeightMapRenderObjClass::~HeightMapRenderObjClass(void) freeMapResources(); delete [] m_extraBlendTilePositions; - m_extraBlendTilePositions = NULL; + m_extraBlendTilePositions = nullptr; } //============================================================================= @@ -1035,15 +1035,15 @@ HeightMapRenderObjClass::~HeightMapRenderObjClass(void) /** Constructor. Mostly nulls out the member variables. */ //============================================================================= HeightMapRenderObjClass::HeightMapRenderObjClass(void): -m_extraBlendTilePositions(NULL), +m_extraBlendTilePositions(nullptr), m_numExtraBlendTiles(0), m_numVisibleExtraBlendTiles(0), m_extraBlendTilePositionsSize(0), -m_vertexBufferTiles(NULL), -m_vertexBufferBackup(NULL), +m_vertexBufferTiles(nullptr), +m_vertexBufferBackup(nullptr), m_originX(0), m_originY(0), -m_indexBuffer(NULL), +m_indexBuffer(nullptr), m_numVBTilesX(0), m_numVBTilesY(0), m_numVertexBufferTiles(0), @@ -1115,12 +1115,12 @@ void HeightMapRenderObjClass::adjustTerrainLOD(Int adj) TheWritableGlobalData->m_useHalfHeightMap = false; break; } - if (m_map==NULL) return; + if (m_map==nullptr) return; m_map->setDrawOrg(m_map->getDrawOrgX(), m_map->getDrawOrgX()); if (m_shroud) m_shroud->reset(); //need reset here since initHeightData will load new shroud. this->initHeightData(m_map->getDrawWidth(), - m_map->getDrawHeight(), m_map, NULL); + m_map->getDrawHeight(), m_map, nullptr); staticLightingChanged(); if (TheTacticalView) { TheTacticalView->setAngle(TheTacticalView->getAngle() + 1); @@ -1193,8 +1193,8 @@ void HeightMapRenderObjClass::oversizeTerrain(Int tilesToOversize) if (m_shroud) m_shroud->reset(); //delete m_shroud; - //m_shroud = NULL; - initHeightData(m_map->getDrawWidth(), m_map->getDrawHeight(), m_map, NULL, FALSE); + //m_shroud = nullptr; + initHeightData(m_map->getDrawWidth(), m_map->getDrawHeight(), m_map, nullptr, FALSE); m_needFullUpdate = true; } @@ -1215,7 +1215,7 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap, // Int vertsPerRow=x*2-2; // Int vertsPerColumn=y*2-2; - HeightSampleType *data = NULL; + HeightSampleType *data = nullptr; if (pMap) { data = pMap->getDataPtr(); } @@ -1267,10 +1267,10 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap, // If the size changed, we need to allocate. Bool needToAllocate = (x != m_x || y != m_y); // If the textures aren't allocated (usually because of a hardware reset) need to allocate. - if (m_stageOneTexture == NULL) { + if (m_stageOneTexture == nullptr) { needToAllocate = true; } - if (data && needToAllocate && m_treeBuffer != NULL) + if (data && needToAllocate && m_treeBuffer != nullptr) { //requested heightmap different from old one. freeIndexVertexBuffers(); //Create static index buffers. These will index the vertex buffers holding the map. @@ -1353,12 +1353,12 @@ void HeightMapRenderObjClass::On_Frame_Update(void) Int i,j,k; DX8VertexBufferClass **pVB; Int originX,originY; - if (Scene==NULL) return; + if (Scene==nullptr) return; RTS3DScene *pMyScene = (RTS3DScene *)Scene; RefRenderObjListIterator pDynamicLightsIterator(pMyScene->getDynamicLights()); - if (m_map == NULL) { + if (m_map == nullptr) { return; } @@ -1633,13 +1633,13 @@ is rendered. */ //============================================================================= void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjListIterator *pLightsIterator) { - if (m_map==NULL) { + if (m_map==nullptr) { return; } if (m_updating) { return; } - if (m_vertexBufferTiles ==NULL) + if (m_vertexBufferTiles ==nullptr) return; //did not initialize resources yet. BaseHeightMapRenderObjClass::updateCenter(camera, pLightsIterator); @@ -1904,8 +1904,8 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) // Force shaders to update. m_stageTwoTexture->restore(); - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); ShaderClass::Invalidate(); // tm.Scale(ObjSpaceExtent); @@ -2003,7 +2003,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) { if (m_disableTextures ) { DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaque2DShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); } else { W3DShaderManager::setShader(st, pass); } @@ -2059,15 +2059,15 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) Int xCoordMax = m_x+m_map->getDrawOrgX()-1; #ifdef TEST_CUSTOM_EDGING // Draw edging just before last pass. - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); m_customEdging->drawEdging(m_map, xCoordMin, xCoordMax, yCoordMin, yCoordMax, - m_stageZeroTexture, doCloud?m_stageTwoTexture:NULL, TheGlobalData->m_useLightMap?m_stageThreeTexture:NULL); + m_stageZeroTexture, doCloud?m_stageTwoTexture: nullptr, TheGlobalData->m_useLightMap?m_stageThreeTexture: nullptr); #endif #ifdef DO_ROADS - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); @@ -2076,7 +2076,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) if (Scene) { RTS3DScene *pMyScene = (RTS3DScene *)Scene; RefRenderObjListIterator pDynamicLightsIterator(pMyScene->getDynamicLights()); - m_roadBuffer->drawRoads(&rinfo.Camera, doCloud?m_stageTwoTexture:NULL, TheGlobalData->m_useLightMap?m_stageThreeTexture:NULL, + m_roadBuffer->drawRoads(&rinfo.Camera, doCloud?m_stageTwoTexture:nullptr, TheGlobalData->m_useLightMap?m_stageThreeTexture:nullptr, m_disableTextures,xCoordMin-m_map->getBorderSizeInline(), xCoordMax-m_map->getBorderSizeInline(), yCoordMin-m_map->getBorderSizeInline(), yCoordMax-m_map->getBorderSizeInline(), &pDynamicLightsIterator); } } @@ -2085,8 +2085,8 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) m_propBuffer->drawProps(rinfo); } #ifdef DO_SCORCH - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); @@ -2094,13 +2094,13 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) drawScorches(); } #endif - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); DX8Wrapper::Apply_Render_State_Changes(); - m_bridgeBuffer->drawBridges(&rinfo.Camera, m_disableTextures, doCloud?m_stageTwoTexture:NULL); + m_bridgeBuffer->drawBridges(&rinfo.Camera, m_disableTextures, doCloud?m_stageTwoTexture:nullptr); if (TheTerrainTracksRenderObjClassSystem) TheTerrainTracksRenderObjClassSystem->flush(); @@ -2124,11 +2124,11 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) m_bibBuffer->renderBibs(); // We do some custom blending, so tell the shader class to reset everything. - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); m_stageTwoTexture->restore(); ShaderClass::Invalidate(); - DX8Wrapper::Set_Material(NULL); + DX8Wrapper::Set_Material(nullptr); } @@ -2341,7 +2341,7 @@ void HeightMapRenderObjClass::renderExtraBlendTiles(void) shader.Set_Primary_Gradient(ShaderClass::GRADIENT_DISABLE); //disable lighting. shader.Set_Texturing(ShaderClass::TEXTURING_DISABLE); //disable texturing. DX8Wrapper::Set_Shader(shader); - DX8Wrapper::Set_Texture(0,NULL); //debug mode which draws terrain tiles in white. + DX8Wrapper::Set_Texture(0,nullptr); //debug mode which draws terrain tiles in white. if (Is_Hidden() == 0) { DX8Wrapper::Draw_Triangles( 0,indexCount/3, 0, vertexCount); //draw a quad, 2 triangles, 4 verts m_numVisibleExtraBlendTiles += indexCount/6; diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp index 9e923b1d6dd..d9e0016badc 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp @@ -107,7 +107,7 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) return 0; } - DX8_ErrorCode(surface_level->LockRect(&locked_rect, NULL, 0)); + DX8_ErrorCode(surface_level->LockRect(&locked_rect, nullptr, 0)); Int tilePixelExtent = TILE_PIXEL_EXTENT; Int tilesPerRow = surface_desc.Width/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); @@ -195,7 +195,7 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) } surface_level->UnlockRect(); surface_level->Release(); - DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), nullptr, 0, D3DX_FILTER_BOX)); if (WW3D::Get_Texture_Reduction()) { Peek_D3D_Texture()->SetLOD(WW3D::Get_Texture_Reduction()); } @@ -227,7 +227,7 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) return false; } - DX8_ErrorCode(surface_level->LockRect(&locked_rect, NULL, 0)); + DX8_ErrorCode(surface_level->LockRect(&locked_rect, nullptr, 0)); Int tilePixelExtent = TILE_PIXEL_EXTENT; Int tilesPerRow = surface_desc.Width/(2*TILE_PIXEL_EXTENT+TILE_OFFSET); @@ -352,7 +352,7 @@ int TerrainTextureClass::update(WorldHeightMap *htMap) } surface_level->UnlockRect(); surface_level->Release(); - DX8_ErrorCode(D3DXFilterTexture(D3DTexture, NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(D3DTexture, nullptr, 0, D3DX_FILTER_BOX)); return(surface_desc.Height); } #endif @@ -388,7 +388,7 @@ Bool TerrainTextureClass::updateFlat(WorldHeightMap *htMap, Int xCell, Int yCell return false; } - DX8_ErrorCode(surface_level->LockRect(&locked_rect, NULL, 0)); + DX8_ErrorCode(surface_level->LockRect(&locked_rect, nullptr, 0)); if (surface_desc.Format == D3DFMT_A1R5G5B5) { @@ -408,7 +408,7 @@ Bool TerrainTextureClass::updateFlat(WorldHeightMap *htMap, Int xCell, Int yCell for (cellY = 0; cellY < cellWidth; cellY++) { UnsignedByte *pBGRX_data = ((UnsignedByte*)locked_rect.pBits); UnsignedByte *pBGR = htMap->getPointerToTileData(xCell+cellX, yCell+cellY, pixelsPerCell); - if (pBGR == NULL) continue; // past end of defined terrain. [3/24/2003] + if (pBGR == nullptr) continue; // past end of defined terrain. [3/24/2003] Int k, l; for (k=pixelsPerCell-1; k>=0; k--) { UnsignedByte *pBGRX = pBGRX_data + (pixelsPerCell*(cellWidth-cellY-1)+k)*surface_desc.Width*pixelBytes + @@ -425,7 +425,7 @@ Bool TerrainTextureClass::updateFlat(WorldHeightMap *htMap, Int xCell, Int yCell surface_level->UnlockRect(); surface_level->Release(); - DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), nullptr, 0, D3DX_FILTER_BOX)); return(surface_desc.Height); } @@ -564,7 +564,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG1, D3DTA_TFACTOR | D3DTA_COMPLEMENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(2, NULL); + DX8Wrapper::Set_DX8_Texture(2, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_TEXCOORDINDEX, 2); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE); @@ -573,7 +573,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(3, NULL); + DX8Wrapper::Set_DX8_Texture(3, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_COLOROP, D3DTOP_SELECTARG1); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_TEXCOORDINDEX, 3); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_COLORARG1, D3DTA_DIFFUSE | 0 | D3DTA_ALPHAREPLICATE); @@ -582,7 +582,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(4, NULL); + DX8Wrapper::Set_DX8_Texture(4, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_TEXCOORDINDEX, 4); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_COLORARG1, D3DTA_CURRENT); @@ -591,7 +591,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_ALPHAARG1, D3DTA_CURRENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); - DX8Wrapper::Set_DX8_Texture(5, NULL); + DX8Wrapper::Set_DX8_Texture(5, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_COLOROP, D3DTOP_ADD); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_TEXCOORDINDEX, 5); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_COLORARG1, D3DTA_DIFFUSE); @@ -600,7 +600,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_ALPHAARG1, D3DTA_TFACTOR | D3DTA_COMPLEMENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(6, NULL); + DX8Wrapper::Set_DX8_Texture(6, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_TEXCOORDINDEX, 6); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_COLORARG1, D3DTA_TFACTOR); @@ -609,7 +609,7 @@ void AlphaTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(7, NULL); + DX8Wrapper::Set_DX8_Texture(7, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_COLOROP, D3DTOP_SELECTARG1); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_TEXCOORDINDEX, 7); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_COLORARG1, D3DTA_TFACTOR); @@ -775,7 +775,7 @@ int AlphaEdgeTextureClass::update(WorldHeightMap *htMap) D3DSURFACE_DESC surface_desc; D3DLOCKED_RECT locked_rect; DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(0, &surface_level)); - DX8_ErrorCode(surface_level->LockRect(&locked_rect, NULL, 0)); + DX8_ErrorCode(surface_level->LockRect(&locked_rect, nullptr, 0)); DX8_ErrorCode(surface_level->GetDesc(&surface_desc)); Int tilePixelExtent = TILE_PIXEL_EXTENT; // blend tiles are 1/4 tiles. @@ -837,7 +837,7 @@ int AlphaEdgeTextureClass::update(WorldHeightMap *htMap) } surface_level->UnlockRect(); surface_level->Release(); - DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), nullptr, 0, D3DX_FILTER_BOX)); return(surface_desc.Height); } @@ -1070,7 +1070,7 @@ void CloudMapTerrainTextureClass::restore(void) DX8Wrapper::Set_DX8_Texture_Stage_State( i, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); DX8Wrapper::Set_DX8_Texture_Stage_State( i, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); - DX8Wrapper::Set_DX8_Texture(i, NULL); + DX8Wrapper::Set_DX8_Texture(i, nullptr); } } } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp index fe936811b86..1f607d54fdb 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPropBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DPropBuffer.h" #include @@ -157,7 +158,7 @@ Int W3DPropBuffer::addPropType(const AsciiString &modelName) } m_propTypes[m_numPropTypes].m_robj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(modelName.str()); - if (m_propTypes[m_numPropTypes].m_robj==NULL) { + if (m_propTypes[m_numPropTypes].m_robj==nullptr) { DEBUG_CRASH(("Unable to find model for prop %s", modelName.str())); return -1; } @@ -277,7 +278,7 @@ void W3DPropBuffer::removePropsForConstruction(const Coord3D* pos, const Geometr // Just iterate all trees, as even non-collidable ones get removed. jba. [7/11/2003] Int i; for (i=0; iRender(rinfo); } } - rinfo.light_environment = NULL; + rinfo.light_environment = nullptr; } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 6ae6394e28f..69397ece6c5 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -88,8 +88,8 @@ class W3DShaderInterface ///do any custom resetting necessary to bring W3D in sync. virtual void reset(void) { ShaderClass::Invalidate(); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL);}; + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr);}; virtual Int init(void) = 0; ///SetTexture(0,NULL); //previously rendered frame inside this texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,nullptr); //previously rendered frame inside this texture DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -270,7 +270,7 @@ W3DFilterInterface *ScreenBWFilterList[]= { &screenBWFilter, &screenBWFilterDOT3, //slower version for older cards without pixel shaders. - NULL + nullptr }; Int ScreenBWFilter::init(void) @@ -278,7 +278,7 @@ Int ScreenBWFilter::init(void) Int res; HRESULT hr; - m_dwBWPixelShader = NULL; + m_dwBWPixelShader = 0; m_curFadeFrame = 0; if (!W3DShaderManager::canRenderToTexture()) { @@ -416,7 +416,7 @@ Int ScreenBWFilter::set(FilterModes mode) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); //no need to keep a reference since it's a preset. DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_ALWAYS); @@ -468,7 +468,7 @@ Int ScreenBWFilter::set(FilterModes mode) void ScreenBWFilter::reset(void) { - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,NULL); //previously rendered frame inside this texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,nullptr); //previously rendered frame inside this texture DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); //turn off pixel shader DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -478,7 +478,7 @@ Int ScreenBWFilter::shutdown(void) if (m_dwBWPixelShader) DX8Wrapper::_Get_D3D_Device8()->DeletePixelShader(m_dwBWPixelShader); - m_dwBWPixelShader=NULL; + m_dwBWPixelShader=0; return TRUE; } @@ -638,7 +638,7 @@ Int ScreenBWFilterDOT3::set(FilterModes mode) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); //no need to keep a reference since it's a preset. DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_ALWAYS); @@ -652,7 +652,7 @@ Int ScreenBWFilterDOT3::set(FilterModes mode) void ScreenBWFilterDOT3::reset(void) { - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,NULL); //previously rendered frame inside this texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,nullptr); //previously rendered frame inside this texture DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -668,7 +668,7 @@ Int ScreenCrossFadeFilter::m_fadeFrames; Int ScreenCrossFadeFilter::m_curFadeFrame; Real ScreenCrossFadeFilter::m_curFadeValue; Int ScreenCrossFadeFilter::m_fadeDirection; -TextureClass *ScreenCrossFadeFilter::m_fadePatternTexture=NULL; +TextureClass *ScreenCrossFadeFilter::m_fadePatternTexture=nullptr; Bool ScreenCrossFadeFilter::m_skipRender = FALSE; ScreenCrossFadeFilter screenCrossFadeFilter; @@ -678,7 +678,7 @@ ScreenCrossFadeFilter screenCrossFadeFilter; W3DFilterInterface *ScreenCrossFadeFilterList[]= { &screenCrossFadeFilter, - NULL + nullptr }; Int ScreenCrossFadeFilter::init(void) @@ -858,8 +858,8 @@ Int ScreenCrossFadeFilter::set(FilterModes mode) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); //no need to keep a reference since it's a preset. DX8Wrapper::Set_Shader(ShaderClass::_PresetAlphaShader); - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); @@ -891,7 +891,7 @@ void ScreenCrossFadeFilter::reset(void) { DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,NULL); //previously rendered frame inside this texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,nullptr); //previously rendered frame inside this texture DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -921,7 +921,7 @@ m_skipRender(false) W3DFilterInterface *ScreenMotionBlurFilterList[]= { &screenMotionBlurFilter, - NULL + nullptr }; Int ScreenMotionBlurFilter::init(void) @@ -1148,8 +1148,8 @@ Int ScreenMotionBlurFilter::set(FilterModes mode) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); //no need to keep a reference since it's a preset. DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_ALWAYS); @@ -1161,7 +1161,7 @@ Int ScreenMotionBlurFilter::set(FilterModes mode) void ScreenMotionBlurFilter::reset(void) { - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,NULL); //previously rendered frame inside this texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0,nullptr); //previously rendered frame inside this texture DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -1187,7 +1187,7 @@ class ShroudTextureShader : public W3DShaderInterface W3DShaderInterface *ShroudShaderList[]= { &shroudTextureShader, - NULL + nullptr }; //#define SHROUD_STRETCH_FACTOR (1.0f/MAP_XY_FACTOR) //1 texel per heightmap cell width @@ -1229,7 +1229,7 @@ Int ShroudTextureShader::set(Int stage) //We need to scale so shroud texel stretches over one full terrain cell. Each texel //is 1/128 the size of full texture. (assuming 128x128 vid-mem texture). W3DShroud *shroud; - if ((shroud=TheTerrainRenderObject->getShroud()) != 0) + if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { ///@todo: All this code really only need to be done once per camera/view. Find a way to optimize it out. D3DXMATRIX inv; float det; @@ -1269,7 +1269,7 @@ Int ShroudTextureShader::set(Int stage) void ShroudTextureShader::reset(void) { - DX8Wrapper::Set_Texture(m_stageOfSet,NULL); + DX8Wrapper::Set_Texture(m_stageOfSet,nullptr); DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_LESSEQUAL); DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXCOORDINDEX, m_stageOfSet); DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); @@ -1288,7 +1288,7 @@ class FlatShroudTextureShader : public W3DShaderInterface W3DShaderInterface *FlatShroudShaderList[]= { &flatShroudTextureShader, - NULL + nullptr }; //#define SHROUD_STRETCH_FACTOR (1.0f/MAP_XY_FACTOR) //1 texel per heightmap cell width @@ -1322,7 +1322,7 @@ Int FlatShroudTextureShader::set(Int stage) //We need to scale so shroud texel stretches over one full terrain cell. Each texel //is 1/128 the size of full texture. (assuming 128x128 vid-mem texture). W3DShroud *shroud; - if ((shroud=TheTerrainRenderObject->getShroud()) != 0) + if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { ///@todo: All this code really only need to be done once per camera/view. Find a way to optimize it out. D3DXMATRIX inv; float det; @@ -1363,7 +1363,7 @@ Int FlatShroudTextureShader::set(Int stage) void FlatShroudTextureShader::reset(void) { if (m_stageOfSet < MAX_TEXTURE_STAGES) - DX8Wrapper::Set_Texture(m_stageOfSet,NULL); + DX8Wrapper::Set_Texture(m_stageOfSet,nullptr); DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_LESSEQUAL); DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXCOORDINDEX, m_stageOfSet); DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); @@ -1381,7 +1381,7 @@ class MaskTextureShader : public W3DShaderInterface W3DShaderInterface *MaskShaderList[]= { &maskTextureShader, - NULL + nullptr }; Int MaskTextureShader::init(void) @@ -1467,7 +1467,7 @@ Int MaskTextureShader::set(Int pass) void MaskTextureShader::reset(void) { - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_TEXCOORDINDEX, 0); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); } @@ -1547,7 +1547,7 @@ W3DShaderInterface *TerrainShaderList[]= &terrainShaderPixelShader, &terrainShader8Stage, &terrainShader2Stage, - NULL + nullptr }; ///List of different terrain shader implementations in order of preference @@ -1555,7 +1555,7 @@ W3DShaderInterface *FlatTerrainShaderList[]= { &flatTerrainShaderPixelShader, &flatTerrainShader2Stage, - NULL + nullptr }; Int TerrainShader2Stage::init( void ) @@ -1585,8 +1585,8 @@ void TerrainShader2Stage::reset(void) ShaderClass::Invalidate(); //Free references to textures - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|0); @@ -1848,7 +1848,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG1, D3DTA_TFACTOR | D3DTA_COMPLEMENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(2, NULL); + DX8Wrapper::Set_DX8_Texture(2, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_TEXCOORDINDEX, 2); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE); @@ -1857,7 +1857,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(3, NULL); + DX8Wrapper::Set_DX8_Texture(3, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_COLOROP, D3DTOP_SELECTARG1); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_TEXCOORDINDEX, 3); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_COLORARG1, D3DTA_DIFFUSE | 0 | D3DTA_ALPHAREPLICATE); @@ -1866,7 +1866,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 3, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(4, NULL); + DX8Wrapper::Set_DX8_Texture(4, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_TEXCOORDINDEX, 4); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_COLORARG1, D3DTA_CURRENT); @@ -1875,7 +1875,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_ALPHAARG1, D3DTA_CURRENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); - DX8Wrapper::Set_DX8_Texture(5, NULL); + DX8Wrapper::Set_DX8_Texture(5, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_COLOROP, D3DTOP_ADD); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_TEXCOORDINDEX, 5); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_COLORARG1, D3DTA_DIFFUSE); @@ -1884,7 +1884,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_ALPHAARG1, D3DTA_TFACTOR | D3DTA_COMPLEMENT); DX8Wrapper::Set_DX8_Texture_Stage_State( 5, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(6, NULL); + DX8Wrapper::Set_DX8_Texture(6, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_COLOROP, D3DTOP_MODULATE); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_TEXCOORDINDEX, 6); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_COLORARG1, D3DTA_TFACTOR); @@ -1893,7 +1893,7 @@ Int TerrainShader8Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); DX8Wrapper::Set_DX8_Texture_Stage_State( 6, D3DTSS_ALPHAARG2, D3DTA_TFACTOR); - DX8Wrapper::Set_DX8_Texture(7, NULL); + DX8Wrapper::Set_DX8_Texture(7, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_COLOROP, D3DTOP_SELECTARG1); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_TEXCOORDINDEX, 7); DX8Wrapper::Set_DX8_Texture_Stage_State( 7, D3DTSS_COLORARG1, D3DTA_TFACTOR); @@ -1924,8 +1924,8 @@ void TerrainShader8Stage::reset(void) DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_COLOROP, D3DTOP_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( 4, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr); DX8Wrapper::Invalidate_Cached_Render_States(); } @@ -1940,9 +1940,9 @@ Int TerrainShaderPixelShader::shutdown(void) if (m_dwBaseNoise2PixelShader) DX8Wrapper::_Get_D3D_Device8()->DeletePixelShader(m_dwBaseNoise2PixelShader); - m_dwBasePixelShader=NULL; - m_dwBaseNoise1PixelShader=NULL; - m_dwBaseNoise2PixelShader=NULL; + m_dwBasePixelShader=0; + m_dwBaseNoise1PixelShader=0; + m_dwBaseNoise2PixelShader=0; return TRUE; } @@ -2107,13 +2107,13 @@ Int TerrainShaderPixelShader::set(Int pass) void TerrainShaderPixelShader::reset(void) { - DX8Wrapper::_Get_D3D_Device8()->SetTexture(2,NULL); //release reference to any texture - DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,NULL); //release reference to any texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(2,nullptr); //release reference to any texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,nullptr); //release reference to any texture DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); //turn off pixel shader - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|0); @@ -2144,7 +2144,7 @@ class CloudTextureShader : public W3DShaderInterface W3DShaderInterface *CloudShaderList[]= { &cloudTextureShader, - NULL + nullptr }; Int CloudTextureShader::init(void) @@ -2193,7 +2193,7 @@ Int CloudTextureShader::set(Int stage) void CloudTextureShader::reset(void) { //Free reference to texture - DX8Wrapper::_Get_D3D_Device8()->SetTexture(m_stageOfSet, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(m_stageOfSet, nullptr); //Turn off texture projection DX8Wrapper::Set_DX8_Texture_Stage_State( m_stageOfSet, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( m_stageOfSet, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|m_stageOfSet); @@ -2228,7 +2228,7 @@ W3DShaderInterface *RoadShaderList[]= { &roadShaderPixelShader, &roadShader2Stage, - NULL + nullptr }; Int RoadShaderPixelShader::shutdown(void) @@ -2236,7 +2236,7 @@ Int RoadShaderPixelShader::shutdown(void) if (m_dwBaseNoise2PixelShader) DX8Wrapper::_Get_D3D_Device8()->DeletePixelShader(m_dwBaseNoise2PixelShader); - m_dwBaseNoise2PixelShader=NULL; + m_dwBaseNoise2PixelShader=0; return TRUE; } @@ -2545,7 +2545,7 @@ W3DShaderInterface **MasterShaderList[]= MaskShaderList, CloudShaderList, FlatTerrainShaderList, - NULL + nullptr }; /** List of all custom filter lists - each list in this list contains variations of the same @@ -2557,7 +2557,7 @@ W3DFilterInterface **MasterFilterList[]= ScreenBWFilterList, ScreenMotionBlurFilterList, ScreenCrossFadeFilterList, - NULL + nullptr }; // W3DShaderManager::W3DShaderManager ========================================= @@ -2567,22 +2567,22 @@ W3DShaderManager::W3DShaderManager(void) { m_currentShader = ST_INVALID; m_currentFilter = FT_NULL_FILTER; - m_oldRenderSurface = NULL; - m_renderTexture = NULL; - m_newRenderSurface = NULL; - m_oldDepthSurface = NULL; + m_oldRenderSurface = nullptr; + m_renderTexture = nullptr; + m_newRenderSurface = nullptr; + m_oldDepthSurface = nullptr; m_renderingToTexture = false; Int i; for (i=0; iRelease(); - m_oldRenderSurface = NULL; - m_renderTexture = NULL; + m_oldRenderSurface = nullptr; + m_renderTexture = nullptr; } else { hr = m_renderTexture->GetSurfaceLevel(0, &m_newRenderSurface); if (hr != S_OK) { if (m_renderTexture) m_renderTexture->Release(); - m_renderTexture = NULL; - m_newRenderSurface = NULL; + m_renderTexture = nullptr; + m_newRenderSurface = nullptr; } else { hr = DX8Wrapper::_Get_D3D_Device8()->GetDepthStencilSurface(&m_oldDepthSurface); if (hr != S_OK) { if (m_newRenderSurface) m_newRenderSurface->Release(); if (m_renderTexture) m_renderTexture->Release(); - m_renderTexture = NULL; - m_newRenderSurface = NULL; - m_oldDepthSurface = NULL; + m_renderTexture = nullptr; + m_newRenderSurface = nullptr; + m_oldDepthSurface = nullptr; } } } @@ -2637,10 +2637,10 @@ void W3DShaderManager::init(void) W3DShaderInterface **shaders; - for (i=0; MasterShaderList[i] != NULL; i++) + for (i=0; MasterShaderList[i] != nullptr; i++) { shaders=MasterShaderList[i]; - for (j=0; shaders[j] != NULL; j++) + for (j=0; shaders[j] != nullptr; j++) { if (shaders[j]->init()) break; //found a working shader @@ -2648,10 +2648,10 @@ void W3DShaderManager::init(void) } W3DFilterInterface **filters; - for (i=0; MasterFilterList[i] != NULL; i++) + for (i=0; MasterFilterList[i] != nullptr; i++) { filters=MasterFilterList[i]; - for (j=0; filters[j] != NULL; j++) + for (j=0; filters[j] != nullptr; j++) { if (filters[j]->init()) break; //found a working shader @@ -2670,10 +2670,10 @@ void W3DShaderManager::shutdown(void) if (m_renderTexture) m_renderTexture->Release(); if (m_oldRenderSurface) m_oldRenderSurface->Release(); if (m_oldDepthSurface) m_oldDepthSurface->Release(); - m_renderTexture = NULL; - m_newRenderSurface = NULL; - m_oldDepthSurface = NULL; - m_oldRenderSurface = NULL; + m_renderTexture = nullptr; + m_newRenderSurface = nullptr; + m_oldDepthSurface = nullptr; + m_oldRenderSurface = nullptr; m_currentShader = ST_INVALID; m_currentFilter = FT_NULL_FILTER; //release any assets associated with a shader (vertex/pixel shaders, textures, etc.) @@ -2830,7 +2830,7 @@ void W3DShaderManager::startRenderToTexture(void) { DEBUG_ASSERTCRASH(!m_renderingToTexture, ("Already rendering to texture - cannot nest calls.")); - if (m_renderingToTexture || m_newRenderSurface==NULL || m_oldDepthSurface==NULL) return; + if (m_renderingToTexture || m_newRenderSurface==nullptr || m_oldDepthSurface==nullptr) return; HRESULT hr = DX8Wrapper::_Get_D3D_Device8()->SetRenderTarget(m_newRenderSurface,m_oldDepthSurface); DEBUG_ASSERTCRASH(hr==S_OK, ("Set target failed unexpectedly.")); if (hr != S_OK) @@ -2866,7 +2866,7 @@ void W3DShaderManager::startRenderToTexture(void) IDirect3DTexture8 *W3DShaderManager::endRenderToTexture(void) { DEBUG_ASSERTCRASH(m_renderingToTexture, ("Not rendering to texture.")); - if (!m_renderingToTexture) return NULL; + if (!m_renderingToTexture) return nullptr; HRESULT hr = DX8Wrapper::_Get_D3D_Device8()->SetRenderTarget(m_oldRenderSurface,m_oldDepthSurface); //restore original render target DEBUG_ASSERTCRASH(hr==S_OK, ("Set target failed unexpectedly.")); if (hr == S_OK) @@ -3005,11 +3005,11 @@ HRESULT W3DShaderManager::LoadAndCreateD3DShader(const char* strFilePath, const try { - File *file = NULL; + File *file = nullptr; HRESULT hr; file = TheFileSystem->openFile(strFilePath, File::READ | File::BINARY); - if (file == NULL) + if (file == nullptr) { OutputDebugString("Could not find file \n" ); return E_FAIL; @@ -3029,7 +3029,7 @@ HRESULT W3DShaderManager::LoadAndCreateD3DShader(const char* strFilePath, const file->read((void *)pShader, dwFileSize); file->close(); - file = NULL; + file = nullptr; if (ShaderType) // SHADERTYPE_VERTEX { @@ -3187,7 +3187,7 @@ Int W3DShaderManager::setShroudTex(Int stage) //We need to scale so shroud texel stretches over one full terrain cell. Each texel //is 1/128 the size of full texture. (assuming 128x128 vid-mem texture). W3DShroud *shroud; - if ((shroud=TheTerrainRenderObject->getShroud()) != 0) + if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { DX8Wrapper::Set_Texture(stage, shroud->getShroudTexture()); @@ -3258,8 +3258,8 @@ void FlatTerrainShader2Stage::reset(void) ShaderClass::Invalidate(); //Free references to textures - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|0); @@ -3316,7 +3316,7 @@ Int FlatTerrainShader2Stage::set(Int pass) //We need to scale so shroud texel stretches over one full terrain cell. Each texel //is 1/128 the size of full texture. (assuming 128x128 vid-mem texture). W3DShroud *shroud; - if ((shroud=TheTerrainRenderObject->getShroud()) != 0) + if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { D3DXMATRIX inv; float det; @@ -3476,10 +3476,10 @@ Int FlatTerrainShaderPixelShader::shutdown(void) if (m_dwBaseNoise2PixelShader) DX8Wrapper::_Get_D3D_Device8()->DeletePixelShader(m_dwBaseNoise2PixelShader); - m_dwBasePixelShader=NULL; - m_dwBase0PixelShader=NULL; - m_dwBaseNoise1PixelShader=NULL; - m_dwBaseNoise2PixelShader=NULL; + m_dwBasePixelShader=0; + m_dwBase0PixelShader=0; + m_dwBaseNoise1PixelShader=0; + m_dwBaseNoise2PixelShader=0; return TRUE; } @@ -3699,13 +3699,13 @@ Int FlatTerrainShaderPixelShader::set(Int pass) void FlatTerrainShaderPixelShader::reset(void) { - DX8Wrapper::_Get_D3D_Device8()->SetTexture(2,NULL); //release reference to any texture - DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,NULL); //release reference to any texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(2,nullptr); //release reference to any texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,nullptr); //release reference to any texture DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); //turn off pixel shader - DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, NULL); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, NULL); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, nullptr); + DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|0); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp index d11d305123f..bc21f22e6d6 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp @@ -42,7 +42,7 @@ #include "WW3D2/sortingrenderer.h" -SmudgeManager *TheSmudgeManager=NULL; +SmudgeManager *TheSmudgeManager=nullptr; W3DSmudgeManager::W3DSmudgeManager(void) { @@ -133,8 +133,8 @@ void W3DSmudgeManager::ReAcquireResources(void) /*Copies a portion of the current render target into a specified buffer*/ Int copyRect(unsigned char *buf, Int bufSize, int oX, int oY, int width, int height) { - IDirect3DSurface8 *surface=NULL; ///LockRect(&lrect,NULL,D3DLOCK_READONLY); + hr=tempSurface->LockRect(&lrect,nullptr,D3DLOCK_READONLY); if (hr != S_OK) goto error; @@ -224,7 +224,7 @@ Bool W3DSmudgeManager::testHardwareSupport(void) shader.Set_Depth_Compare(ShaderClass::PASS_ALWAYS); shader.Set_Depth_Mask(ShaderClass::DEPTH_WRITE_DISABLE); DX8Wrapper::Set_Shader(shader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices struct _TRANS_LIT_TEX_VERTEX { diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp index bed66d1c65d..f12a9c9733d 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp @@ -39,9 +39,9 @@ struct POINTVERTEX W3DSnowManager::W3DSnowManager(void) { - m_indexBuffer=NULL; - m_snowTexture=NULL; - m_VertexBufferD3D=NULL; + m_indexBuffer=nullptr; + m_snowTexture=nullptr; + m_VertexBufferD3D=nullptr; } W3DSnowManager::~W3DSnowManager() @@ -63,7 +63,7 @@ void W3DSnowManager::ReleaseResources(void) if (m_VertexBufferD3D) m_VertexBufferD3D->Release(); - m_VertexBufferD3D=NULL; + m_VertexBufferD3D=nullptr; REF_PTR_RELEASE(m_indexBuffer); } @@ -82,7 +82,7 @@ Bool W3DSnowManager::ReAcquireResources(void) DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DSnowManager without device")); - if (m_VertexBufferD3D == NULL) + if (m_VertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(m_pDev->CreateVertexBuffer diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp index d7691c63168..57413590474 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainBackground.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DTerrainBackground.h" #include @@ -83,7 +84,7 @@ const Int PIXELS_PER_GRID = 8; // default tex resolution allocated for each tile //============================================================================= void W3DTerrainBackground::setFlip(WorldHeightMap *htMap) { - if (m_map==NULL) return; + if (m_map==nullptr) return; if (htMap) { REF_PTR_SET(m_map, htMap); } @@ -107,7 +108,7 @@ The vertex coordinates and texture coordinates, as well as static lighting are u */ void W3DTerrainBackground::doPartialUpdate(const IRegion2D &partialRange, WorldHeightMap *htMap, Bool doTextures ) { - if (m_map==NULL) return; + if (m_map==nullptr) return; if (htMap) { REF_PTR_SET(m_map, htMap); } @@ -120,7 +121,7 @@ void W3DTerrainBackground::doPartialUpdate(const IRegion2D &partialRange, WorldH return; Int requiredVertexSize = (m_width+1) * (m_width+1) + 6; - if (m_vertexTerrainSizegetFlatTexture(m_xOrigin, m_yOrigin, m_width, 4*PIXELS_PER_GRID); m_terrainTexture4X->Get_Filter().Set_U_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); m_terrainTexture4X->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); } } else if (m_texMultiplier == TEX2X) { REF_PTR_RELEASE(m_terrainTexture4X); - if (m_terrainTexture2X == NULL) { + if (m_terrainTexture2X == nullptr) { m_terrainTexture2X = m_map->getFlatTexture(m_xOrigin, m_yOrigin, m_width, 2*PIXELS_PER_GRID); m_terrainTexture2X->Get_Filter().Set_U_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); m_terrainTexture2X->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index 83a391b5d78..1c3cc9e9bee 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -79,7 +79,7 @@ TerrainTracksRenderObjClass::~TerrainTracksRenderObjClass(void) //============================================================================= TerrainTracksRenderObjClass::TerrainTracksRenderObjClass(void) { - m_stageZeroTexture=NULL; + m_stageZeroTexture=nullptr; m_lastAnchor=Vector3(0,1,2.25); m_haveAnchor=false; m_haveCap=true; @@ -88,7 +88,7 @@ TerrainTracksRenderObjClass::TerrainTracksRenderObjClass(void) m_activeEdgeCount=0; m_totalEdgesAdded=0; m_bound=false; - m_ownerDrawable = NULL; + m_ownerDrawable = nullptr; } //============================================================================= @@ -129,7 +129,7 @@ Int TerrainTracksRenderObjClass::Class_ID(void) const RenderObjClass * TerrainTracksRenderObjClass::Clone(void) const { assert(false); - return NULL; + return nullptr; } //============================================================================= @@ -146,7 +146,7 @@ Int TerrainTracksRenderObjClass::freeTerrainTracksResources(void) m_bottomIndex=0; m_activeEdgeCount=0; m_totalEdgesAdded=0; - m_ownerDrawable = NULL; + m_ownerDrawable = nullptr; return 0; } @@ -455,7 +455,7 @@ static Real computeTrackSpacing(RenderObjClass *renderObj) //============================================================================= //TerrainTracksRenderObjClassSystem::bindTrack //============================================================================= -/** Grab a track from the free store. If no free tracks exist, return NULL. +/** Grab a track from the free store. If no free tracks exist, return null. As long as a track is bound to an object (like a tank) it is ready to accept updates with additional edges. Once it is unbound, it will expire and return to the free store once all tracks have faded out. @@ -482,7 +482,7 @@ TerrainTracksRenderObjClass *TerrainTracksRenderObjClassSystem::bindTrack( Rende m_freeModules = mod->m_nextSystem; // put module on the used list - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_usedModules; if( m_usedModules ) m_usedModules->m_prevSystem = mod; @@ -510,7 +510,7 @@ void TerrainTracksRenderObjClassSystem::unbindTrack( TerrainTracksRenderObjClass //this object should return to free store as soon as there is nothing //left to render. mod->m_bound=false; - mod->m_ownerDrawable = NULL; + mod->m_ownerDrawable = nullptr; } //============================================================================= @@ -520,7 +520,7 @@ void TerrainTracksRenderObjClassSystem::unbindTrack( TerrainTracksRenderObjClass */ void TerrainTracksRenderObjClassSystem::releaseTrack( TerrainTracksRenderObjClass *mod ) { - if (mod==NULL) + if (mod==nullptr) return; DEBUG_ASSERTCRASH(mod->m_bound == false, ("mod is bound.")); @@ -534,7 +534,7 @@ void TerrainTracksRenderObjClassSystem::releaseTrack( TerrainTracksRenderObjClas m_usedModules = mod->m_nextSystem; // add module to free list - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -550,13 +550,13 @@ void TerrainTracksRenderObjClassSystem::releaseTrack( TerrainTracksRenderObjClas //============================================================================= TerrainTracksRenderObjClassSystem::TerrainTracksRenderObjClassSystem() { - m_usedModules = NULL; - m_freeModules = NULL; - m_TerrainTracksScene = NULL; + m_usedModules = nullptr; + m_freeModules = nullptr; + m_TerrainTracksScene = nullptr; m_edgesToFlush = 0; - m_indexBuffer = NULL; - m_vertexMaterialClass = NULL; - m_vertexBuffer = NULL; + m_indexBuffer = nullptr; + m_vertexMaterialClass = nullptr; + m_vertexBuffer = nullptr; m_maxTankTrackEdges=TheGlobalData->m_maxTankTrackEdges; m_maxTankTrackOpaqueEdges=TheGlobalData->m_maxTankTrackOpaqueEdges; @@ -574,8 +574,8 @@ TerrainTracksRenderObjClassSystem::~TerrainTracksRenderObjClassSystem( void ) // free all data shutdown(); - m_vertexMaterialClass=NULL; - m_TerrainTracksScene=NULL; + m_vertexMaterialClass=nullptr; + m_TerrainTracksScene=nullptr; } @@ -666,7 +666,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) mod = NEW_REF( TerrainTracksRenderObjClass, () ); - if( mod == NULL ) + if( mod == nullptr ) { // unable to allocate modules needed @@ -675,7 +675,7 @@ void TerrainTracksRenderObjClassSystem::init( SceneClass *TerrainTracksScene ) } - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -709,7 +709,7 @@ void TerrainTracksRenderObjClassSystem::shutdown( void ) // free all attached things and used modules - assert( m_usedModules == NULL ); + assert( m_usedModules == nullptr ); // free all module storage while( m_freeModules ) @@ -930,7 +930,7 @@ void TerrainTracksRenderObjClassSystem::Reset(void) // free all attached things and used modules - assert( m_usedModules == NULL ); + assert( m_usedModules == nullptr ); m_edgesToFlush=0; } @@ -971,4 +971,4 @@ void TerrainTracksRenderObjClassSystem::setDetail(void) ReAcquireResources(); }; -TerrainTracksRenderObjClassSystem *TheTerrainTracksRenderObjClassSystem=NULL; ///< singleton for track drawing system. +TerrainTracksRenderObjClassSystem *TheTerrainTracksRenderObjClassSystem=nullptr; ///< singleton for track drawing system. diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 77935049c58..a8f9d899495 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -75,7 +75,7 @@ class TestSeismicFilter : public SeismicSimulationFilterBase Int life = node->m_life; - if ( heightMap == NULL ) + if ( heightMap == nullptr ) return SEISMIC_STATUS_INVALID; @@ -159,14 +159,14 @@ static TestSeismicFilter testSeismicFilter; W3DTerrainVisual::W3DTerrainVisual() { - m_terrainRenderObject = NULL; - m_waterRenderObject = NULL; - TheWaterRenderObj = NULL; + m_terrainRenderObject = nullptr; + m_waterRenderObject = nullptr; + TheWaterRenderObj = nullptr; - m_logicHeightMap = NULL; + m_logicHeightMap = nullptr; #ifdef DO_SEISMIC_SIMULATIONS - m_clientHeightMap = NULL; + m_clientHeightMap = nullptr; #endif } @@ -177,20 +177,20 @@ W3DTerrainVisual::~W3DTerrainVisual() { // release our render object if (TheTerrainRenderObject == m_terrainRenderObject) { - TheTerrainRenderObject = NULL; + TheTerrainRenderObject = nullptr; } delete TheTerrainTracksRenderObjClassSystem; - TheTerrainTracksRenderObjClassSystem=NULL; + TheTerrainTracksRenderObjClassSystem=nullptr; delete TheW3DShadowManager; - TheW3DShadowManager=NULL; + TheW3DShadowManager=nullptr; delete TheSmudgeManager; - TheSmudgeManager=NULL; + TheSmudgeManager=nullptr; REF_PTR_RELEASE( m_waterRenderObject ); - TheWaterRenderObj=NULL; + TheWaterRenderObj=nullptr; REF_PTR_RELEASE( m_terrainRenderObject ); REF_PTR_RELEASE( m_logicHeightMap ); @@ -251,19 +251,19 @@ void W3DTerrainVisual::init( void ) // set the vertex animated water properties Int waterSettingIndex = 0; // use index 0 settings by default - TheTerrainVisual->setWaterGridHeightClamps( NULL, + TheTerrainVisual->setWaterGridHeightClamps( nullptr, TheGlobalData->m_vertexWaterHeightClampLow[ waterSettingIndex ], TheGlobalData->m_vertexWaterHeightClampHi[ waterSettingIndex ] ); - TheTerrainVisual->setWaterTransform( NULL, + TheTerrainVisual->setWaterTransform( nullptr, TheGlobalData->m_vertexWaterAngle[ waterSettingIndex ], TheGlobalData->m_vertexWaterXPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterYPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterZPosition[ waterSettingIndex ] ); - TheTerrainVisual->setWaterGridResolution( NULL, + TheTerrainVisual->setWaterGridResolution( nullptr, TheGlobalData->m_vertexWaterXGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterYGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterGridSize[ waterSettingIndex ] ); - TheTerrainVisual->setWaterAttenuationFactors( NULL, + TheTerrainVisual->setWaterAttenuationFactors( nullptr, TheGlobalData->m_vertexWaterAttenuationA[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationB[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationC[ waterSettingIndex ], @@ -446,13 +446,13 @@ void W3DTerrainVisual::handleSeismicSimulations( void ) void W3DTerrainVisual::updateSeismicSimulations( void ) { - if (m_logicHeightMap==NULL) + if (m_logicHeightMap==nullptr) return; - if (m_clientHeightMap==NULL) + if (m_clientHeightMap==nullptr) return; - if (m_terrainRenderObject==NULL) + if (m_terrainRenderObject==nullptr) return; if ( ! m_seismicSimulationList.empty() ) @@ -548,7 +548,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) } - if( m_terrainRenderObject == NULL ) + if( m_terrainRenderObject == nullptr ) return FALSE; @@ -579,7 +579,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) Coord3D loc = *pMapObj->getLocation(); if (loc.z < 0) { Vector3 vec; - loc.z = m_terrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z = m_terrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); loc.z += d->getReal(TheKey_lightHeightAboveTerrain); } // It is a light, and handled at the device level. jba. @@ -602,7 +602,7 @@ Bool W3DTerrainVisual::load( AsciiString filename ) } - RefRenderObjListIterator *it = W3DDisplay::m_3DScene ? W3DDisplay::m_3DScene->createLightsIterator() : NULL; + RefRenderObjListIterator *it = W3DDisplay::m_3DScene ? W3DDisplay::m_3DScene->createLightsIterator() : nullptr; // apply the heightmap to the terrain render object #ifdef DO_SEISMIC_SIMULATIONS @@ -620,15 +620,15 @@ Bool W3DTerrainVisual::load( AsciiString filename ) if (it) { W3DDisplay::m_3DScene->destroyLightsIterator(it); - it = NULL; + it = nullptr; } // add our terrain render object to the scene - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object( m_terrainRenderObject ); #if defined(RTS_DEBUG) // Icon drawing utility object for pathfinding. - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) { W3DDebugIcons *icons = NEW W3DDebugIcons; W3DDisplay::m_3DScene->Add_Render_Object( icons ); @@ -696,7 +696,7 @@ Bool W3DTerrainVisual::intersectTerrain( Coord3D *rayStart, Bool hit = FALSE; // sanity - if( rayStart == NULL || rayEnd == NULL ) + if( rayStart == nullptr || rayEnd == nullptr ) return hit; if( m_terrainRenderObject ) @@ -743,7 +743,7 @@ void W3DTerrainVisual::getTerrainColorAt( Real x, Real y, RGBColor *pColor ) //------------------------------------------------------------------------------------------------- TerrainType *W3DTerrainVisual::getTerrainTile( Real x, Real y ) { - TerrainType *tile = NULL; + TerrainType *tile = nullptr; #ifdef DO_SEISMIC_SIMULATIONS if( m_clientHeightMap ) @@ -1079,7 +1079,7 @@ void W3DTerrainVisual::addProp(const ThingTemplate *tTemplate, const Coord3D *po if (mi.getCount() > 0) { const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; if (md) { modelName = md->getBestModelNameForWB(state); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 26fafc2cbe0..461fa527315 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -54,6 +54,7 @@ enum //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DTreeBuffer.h" #include @@ -137,7 +138,7 @@ int W3DTreeBuffer::W3DTreeTextureClass::update(W3DTreeBuffer *buffer) DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(0, &surface_level)); DX8_ErrorCode(surface_level->GetDesc(&surface_desc)); - DX8_ErrorCode(surface_level->LockRect(&locked_rect, NULL, 0)); + DX8_ErrorCode(surface_level->LockRect(&locked_rect, nullptr, 0)); Int tilePixelExtent = TILE_PIXEL_EXTENT; // Int numRows = surface_desc.Height/(tilePixelExtent+TILE_OFFSET); @@ -188,7 +189,7 @@ int W3DTreeBuffer::W3DTreeTextureClass::update(W3DTreeBuffer *buffer) } DX8_ErrorCode(surface_level->UnlockRect()); surface_level->Release(); - DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), NULL, (UINT)0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(Peek_D3D_Texture(), nullptr, (UINT)0, D3DX_FILTER_BOX)); if (WW3D::Get_Texture_Reduction()) { DX8_ErrorCode(Peek_D3D_Texture()->SetLOD((DWORD)WW3D::Get_Texture_Reduction())); } @@ -418,7 +419,7 @@ class GDIFileStream2 : public InputStream protected: File* m_file; public: - GDIFileStream2():m_file(NULL) {}; + GDIFileStream2():m_file(nullptr) {}; GDIFileStream2(File* pFile):m_file(pFile) {}; virtual Int read(void *pData, Int numBytes) { return(m_file?m_file->read(pData, numBytes):0); @@ -453,17 +454,17 @@ void W3DTreeBuffer::updateTexture(void) REF_PTR_RELEASE (m_sourceTiles[i]); } m_numTiles = 0; - File *theFile = NULL; + File *theFile = nullptr; for (i=0; im_textureName.str() ); theFile = TheFileSystem->openFile( texturePath, File::READ|File::BINARY); - if (theFile==NULL) { + if (theFile==nullptr) { sprintf( texturePath, "%s%s", TGA_DIR_PATH, m_treeTypes[i].m_data->m_textureName.str() ); theFile = TheFileSystem->openFile( texturePath, File::READ|File::BINARY); } - if (theFile != NULL) { + if (theFile != nullptr) { GDIFileStream2 theStream(theFile); InputStream *pStr = &theStream; Bool halfTile; @@ -521,7 +522,7 @@ void W3DTreeBuffer::updateTexture(void) if (m_textureWidth>MAX_TEX_WIDTH) { m_textureWidth = 64; m_textureHeight = 64; - if (m_treeTexture==NULL) { + if (m_treeTexture==nullptr) { m_treeTexture = new TextureClass("missing.tga"); } DEBUG_CRASH(("Too many trees in a scene.")); @@ -694,7 +695,7 @@ void W3DTreeBuffer::loadTreesInVertexAndIndexBuffers(RefRenderObjListIterator *p return; } - if (m_shadow == NULL && TheW3DProjectedShadowManager) { + if (m_shadow == nullptr && TheW3DProjectedShadowManager) { Shadow::ShadowTypeInfo shadowInfo; shadowInfo.m_ShadowName[0] = 0; shadowInfo.allowUpdates=FALSE; //shadow image will never update @@ -751,7 +752,7 @@ void W3DTreeBuffer::loadTreesInVertexAndIndexBuffers(RefRenderObjListIterator *p Vector3 loc = m_trees[curTree].location; Real theSin = m_trees[curTree].sin; Real theCos = m_trees[curTree].cos; - if (type<0 || m_treeTypes[type].m_mesh == 0) { + if (type<0 || m_treeTypes[type].m_mesh == nullptr) { continue; } @@ -806,7 +807,7 @@ void W3DTreeBuffer::loadTreesInVertexAndIndexBuffers(RefRenderObjListIterator *p const unsigned *vecDiffuse = m_treeTypes[type].m_mesh->Peek_Model()->Get_Color_Array(0, false); Int diffuse = 0; - if (normals == NULL) { + if (normals == nullptr) { doVertexLighting = false; Vector3 normal(0.0f,0.0f,1.0f); diffuse = doLighting(&normal, objectLighting, &emissive, 0xFFFFFFFF, 1.0f); @@ -1014,7 +1015,7 @@ void W3DTreeBuffer::updateVertexBuffer(void) Vector3 loc = m_trees[curTree].location; Real theSin = m_trees[curTree].sin; Real theCos = m_trees[curTree].cos; - if (type<0 || m_treeTypes[type].m_mesh == 0) { + if (type<0 || m_treeTypes[type].m_mesh == nullptr) { type = 0; } @@ -1078,7 +1079,7 @@ W3DTreeBuffer::~W3DTreeBuffer(void) } delete m_shadow; - m_shadow = NULL; + m_shadow = nullptr; } //============================================================================= @@ -1092,12 +1093,12 @@ W3DTreeBuffer::W3DTreeBuffer(void) m_initialized = false; Int i; for (i=0; iCreate_Render_Obj(data->m_modelName.str()); - if (robj==NULL) { + if (robj==nullptr) { DEBUG_CRASH(("Unable to find model for tree %s", data->m_modelName.str())); return 0; } @@ -1357,7 +1358,7 @@ Int W3DTreeBuffer::addTreeType(const W3DTreeDrawModuleData *data) if (robj->Class_ID() == RenderObjClass::CLASSID_MESH) m_treeTypes[m_numTreeTypes].m_mesh = (MeshClass*)robj; - if (m_treeTypes[m_numTreeTypes].m_mesh==NULL) { + if (m_treeTypes[m_numTreeTypes].m_mesh==nullptr) { DEBUG_CRASH(("Tree %s is not simple mesh. Tell artist to re-export. Don't Ignore!!!", data->m_modelName.str())); return 0; } @@ -1565,7 +1566,7 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD m_needToUpdateTexture = false; updateTexture(); } - if (m_treeTexture==NULL) { + if (m_treeTexture==nullptr) { return; } if (m_updateAllKeys) { @@ -1707,7 +1708,7 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD DX8Wrapper::Set_Shader(detailAlphaShader); DX8Wrapper::Set_Texture(0,m_treeTexture); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(1,nullptr); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_TEXCOORDINDEX, 0); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_TEXCOORDINDEX, 1); // Draw all the trees. @@ -1737,7 +1738,7 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD } W3DShroud *shroud; - if ((shroud=TheTerrainRenderObject->getShroud()) != 0) { + if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { // Setup shroud texture info [6/6/2003] float xoffset = 0; float yoffset = 0; @@ -1793,7 +1794,7 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD } DX8Wrapper::Set_Vertex_Shader(DX8_FVF_XYZNDUV1); - DX8Wrapper::Set_Pixel_Shader(NULL); + DX8Wrapper::Set_Pixel_Shader(0); DX8Wrapper::Invalidate_Cached_Render_States(); //code above mucks around with W3D states so make sure we reset } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DVideoBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DVideoBuffer.cpp index 6f190d0063f..7f41e93e62f 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DVideoBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DVideoBuffer.cpp @@ -103,8 +103,8 @@ W3DVideoBuffer::W3DVideoBuffer( VideoBuffer::Type format ) : VideoBuffer(format), - m_texture(NULL), - m_surface(NULL) + m_texture(nullptr), + m_surface(nullptr) { } @@ -129,17 +129,17 @@ Bool W3DVideoBuffer::allocate( UnsignedInt width, UnsignedInt height ) if ( w3dFormat == WW3D_FORMAT_UNKNOWN ) { - return NULL; + return FALSE; } m_texture = MSGNEW("TextureClass") TextureClass ( m_textureWidth, m_textureHeight, w3dFormat, MIP_LEVELS_1 ); - if ( m_texture == NULL ) + if ( m_texture == nullptr ) { return FALSE; } - if ( lock() == NULL ) + if ( lock() == nullptr ) { free(); return FALSE; @@ -166,9 +166,9 @@ W3DVideoBuffer::~W3DVideoBuffer() void* W3DVideoBuffer::lock( void ) { - void *mem = NULL; + void *mem = nullptr; - if ( m_surface != NULL ) + if ( m_surface != nullptr ) { unlock(); } @@ -189,11 +189,11 @@ void* W3DVideoBuffer::lock( void ) void W3DVideoBuffer::unlock( void ) { - if ( m_surface != NULL ) + if ( m_surface != nullptr ) { m_surface->Unlock(); m_surface->Release_Ref(); - m_surface = NULL; + m_surface = nullptr; } } @@ -203,7 +203,7 @@ void W3DVideoBuffer::unlock( void ) Bool W3DVideoBuffer::valid( void ) { - return m_texture != NULL; + return m_texture != nullptr; } //============================================================================ @@ -218,9 +218,9 @@ void W3DVideoBuffer::free( void ) { unlock(); m_texture->Release_Ref(); - m_texture = NULL; + m_texture = nullptr; } - m_surface = NULL; + m_surface = nullptr; VideoBuffer::free(); } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 704f000e259..aee8d750782 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -145,8 +145,8 @@ static Real getHeightAroundPos(Real x, Real y) W3DView::W3DView() { - m_3DCamera = NULL; - m_2DCamera = NULL; + m_3DCamera = nullptr; + m_2DCamera = nullptr; m_groundLevel = 10.0; m_cameraOffset.z = TheGlobalData->m_cameraHeight; m_cameraOffset.y = -(m_cameraOffset.z / tan(TheGlobalData->m_cameraPitch * (PI / 180.0))); @@ -425,10 +425,10 @@ void W3DView::buildCameraTransform( Matrix3D *transform ) // find object named m_cameraSlaveObjectName Object * obj = TheScriptEngine->getUnitNamed(m_cameraSlaveObjectName); - if (obj != NULL) { + if (obj != nullptr) { // dig out the drawable Drawable * draw = obj->getDrawable(); - if (draw != NULL) { + if (draw != nullptr) { // dig out the first draw module with an ObjectDrawInterface for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) { @@ -621,7 +621,7 @@ void W3DView::setCameraTransform( void ) if (it) { W3DDisplay::m_3DScene->destroyLightsIterator(it); - it = NULL; + it = nullptr; } } } @@ -899,7 +899,7 @@ static void drawAudioLocations( Drawable *draw, void *userData ) const ThingTemplate * thingTemplate = draw->getTemplate(); - if ( thingTemplate == NULL || thingTemplate->getEditorSorting() != ES_AUDIO ) + if ( thingTemplate == nullptr || thingTemplate->getEditorSorting() != ES_AUDIO ) { return; // All done } @@ -957,18 +957,18 @@ static void drawAudioRadii( const Drawable * drawable ) { const AudioEventInfo * ambientInfo = ambientSound->getAudioEventInfo(); - if ( ambientInfo == NULL ) + if ( ambientInfo == nullptr ) { // I don't think that's right... - OutputDebugString( ("Playing sound has NULL AudioEventInfo?\n" ) ); + OutputDebugString( ("Playing sound has null AudioEventInfo?\n" ) ); - if ( TheAudio != NULL ) + if ( TheAudio != nullptr ) { ambientInfo = TheAudio->findAudioEventInfo( ambientSound->getEventName() ); } } - if ( ambientInfo != NULL ) + if ( ambientInfo != nullptr ) { // Colors match those used in WorldBuilder drawDebugCircle( *drawable->getPosition(), ambientInfo->m_minDistance, 1.0f, GameMakeColor(0x00, 0x00, 0xFF, 0xFF) ); @@ -1135,7 +1135,7 @@ void W3DView::update(void) if (it) { W3DDisplay::m_3DScene->destroyLightsIterator(it); - it = NULL; + it = nullptr; } } @@ -1154,7 +1154,7 @@ void W3DView::update(void) Bool loseLock = false; // check if object has been destroyed or is dead -> lose lock - if (cameraLockObj == NULL) + if (cameraLockObj == nullptr) { loseLock = true; } @@ -1171,7 +1171,7 @@ void W3DView::update(void) if (loseLock) { setCameraLock(INVALID_ID); - setCameraLockDrawable(NULL); + setCameraLockDrawable(nullptr); followFactor = -1; } else @@ -1182,13 +1182,13 @@ void W3DView::update(void) followFactor += 0.05f; if (followFactor>1.0f) followFactor = 1.0f; } - if (getCameraLockDrawable() != NULL) + if (getCameraLockDrawable() != nullptr) { Drawable* cameraLockDrawable = (Drawable *)getCameraLockDrawable(); if (!cameraLockDrawable) { - setCameraLockDrawable(NULL); + setCameraLockDrawable(nullptr); } else { @@ -1406,7 +1406,7 @@ void W3DView::update(void) // render all of the visible Drawables /// @todo this needs to use a real region partition or something - TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, NULL ); + TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -1768,7 +1768,7 @@ void W3DView::draw( void ) // Draw audio radii for ALL drawables, not just those on screen const Drawable * drawable = TheGameClient->getDrawableList(); - while ( drawable != NULL ) + while ( drawable != nullptr ) { drawAudioRadii( drawable ); drawable = drawable->getNextDrawable(); @@ -2028,7 +2028,7 @@ void W3DView::setFieldOfView( Real angle ) View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICoord2D *s ) { // sanity - if( w == NULL || s == NULL ) + if( w == nullptr || s == nullptr ) return WTS_INVALID; if( m_3DCamera ) @@ -2079,7 +2079,7 @@ void W3DView::screenToWorld( const ICoord2D *s, Coord3D *w ) { // sanity - if( s == NULL || w == NULL ) + if( s == nullptr || w == nullptr ) return; if( m_3DCamera ) @@ -2134,12 +2134,12 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, } - Drawable *onlyDrawableToTest = NULL; + Drawable *onlyDrawableToTest = nullptr; if (regionIsPoint) { // Allow all drawables to be picked. onlyDrawableToTest = pickDrawable(&screenRegion->lo, TRUE, (PickType) getPickTypesForContext(TheInGameUI->isInForceAttackMode())); - if (onlyDrawableToTest == NULL) { + if (onlyDrawableToTest == nullptr) { return 0; } } @@ -2160,7 +2160,7 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, inside = FALSE; // no screen region, means all drawbles - if( screenRegion == NULL ) + if( screenRegion == nullptr ) inside = TRUE; else { @@ -2197,7 +2197,7 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, } // If onlyDrawableToTest, then we should bail out now. - if (onlyDrawableToTest != NULL) + if (onlyDrawableToTest != nullptr) break; } @@ -2213,16 +2213,16 @@ Int W3DView::iterateDrawablesInRegion( IRegion2D *screenRegion, //------------------------------------------------------------------------------------------------- Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ) { - RenderObjClass *renderObj = NULL; - Drawable *draw = NULL; - DrawableInfo *drawInfo = NULL; + RenderObjClass *renderObj = nullptr; + Drawable *draw = nullptr; + DrawableInfo *drawInfo = nullptr; // sanity - if( screen == NULL ) - return NULL; + if( screen == nullptr ) + return nullptr; // don't pick a drawable if there is a window under the cursor - GameWindow *window = NULL; + GameWindow *window = nullptr; if (TheWindowManager) window = TheWindowManager->getWindowUnderCursor(screen->x, screen->y); @@ -2230,7 +2230,7 @@ Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickT { // check to see if it or any of its parents are opaque. If so, we can't select anything. if (!BitIsSet( window->winGetStatus(), WIN_STATUS_SEE_THRU )) - return NULL; + return nullptr; window = window->winGetParent(); } @@ -2254,7 +2254,7 @@ Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickT // for right now there is no drawable data in a render object which is // if we've found a render object, return our drawable associated with it, - // the terrain, therefore the userdata is NULL + // the terrain, therefore the userdata is null /// @todo terrain and picking! if( renderObj ) drawInfo = (DrawableInfo *)renderObj->Get_User_Data(); @@ -2272,7 +2272,7 @@ Drawable *W3DView::pickDrawable( const ICoord2D *screen, Bool forceAttack, PickT void W3DView::screenToTerrain( const ICoord2D *screen, Coord3D *world ) { // sanity - if( screen == NULL || world == NULL || TheTerrainRenderObject == NULL ) + if( screen == nullptr || world == nullptr || TheTerrainRenderObject == nullptr ) return; if (m_cameraHasMovedSinceRequest) { @@ -2875,7 +2875,7 @@ void W3DView::moveCameraAlongWaypointPath(Waypoint *pWay, Int milliseconds, Int if (pWay->getNumLinks()>0) { pWay = pWay->getLink(0); } else { - pWay = NULL; + pWay = nullptr; } Vector2 dir(m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints].x-m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints-1].x, m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints].y-m_mcwpInfo.waypoints[m_mcwpInfo.numWaypoints-1].y); if (dir.Length()Release(); (p)=NULL; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } void doSkyBoxSet(Bool startDraw) { @@ -300,7 +301,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void) } delete [] m_meshData; - m_meshData = NULL; + m_meshData = nullptr; m_meshDataSize = 0; //Release strings allocated inside global water settings. @@ -309,7 +310,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void) WaterSettings[i].m_waterTextureFile.clear(); } deleteInstance((WaterTransparencySetting*)TheWaterTransparency.getNonOverloadedPointer()); - TheWaterTransparency = NULL; + TheWaterTransparency = nullptr; ReleaseResources(); delete m_waterTrackSystem; @@ -323,25 +324,25 @@ WaterRenderObjClass::WaterRenderObjClass(void) memset( &m_settings, 0, sizeof( m_settings ) ); m_dx=0; m_dy=0; - m_indexBuffer=NULL; - m_waterTrackSystem = NULL; + m_indexBuffer=nullptr; + m_waterTrackSystem = nullptr; m_doWaterGrid = FALSE; - m_meshVertexMaterialClass=NULL; - m_meshLight=NULL; - m_vertexMaterialClass=NULL; - m_alphaClippingTexture=NULL; + m_meshVertexMaterialClass=nullptr; + m_meshLight=nullptr; + m_vertexMaterialClass=nullptr; + m_alphaClippingTexture=nullptr; m_useCloudLayer=true; m_waterType = WATER_TYPE_0_TRANSLUCENT; m_tod=TIME_OF_DAY_AFTERNOON; - m_pReflectionTexture=NULL; - m_skyBox=NULL; - m_vertexBufferD3D=NULL; - m_indexBufferD3D=NULL; + m_pReflectionTexture=nullptr; + m_skyBox=nullptr; + m_vertexBufferD3D=nullptr; + m_indexBufferD3D=nullptr; m_vertexBufferD3DOffset=0; - m_dwWavePixelShader=NULL; - m_dwWaveVertexShader=NULL; - m_meshData=NULL; + m_dwWavePixelShader=0; + m_dwWaveVertexShader=0; + m_meshData=nullptr; m_meshDataSize = 0; m_meshInMotion = FALSE; m_gridOrigin=Vector2(0,0); @@ -356,17 +357,17 @@ WaterRenderObjClass::WaterRenderObjClass(void) Int i=NUM_BUMP_FRAMES; while (i--) - m_pBumpTexture[i]=NULL; + m_pBumpTexture[i]=nullptr; m_riverVOrigin=0; - m_riverTexture=NULL; - m_whiteTexture=NULL; - m_waterNoiseTexture=NULL; - m_riverAlphaEdge=NULL; + m_riverTexture=nullptr; + m_whiteTexture=nullptr; + m_waterNoiseTexture=nullptr; + m_riverAlphaEdge=nullptr; m_waterPixelShader=0; ///Get_Description(d3dsd); pSrc=(unsigned char *)surf->Lock((int *)&dwSrcPitch); - pTex[0]->LockRect( level, &d3dlr, 0, 0 ); + pTex[0]->LockRect( level, &d3dlr, nullptr, 0 ); DWORD dwDstPitch = (DWORD)d3dlr.Pitch; BYTE* pDst = (BYTE*)d3dlr.pBits; @@ -641,7 +642,7 @@ HRESULT WaterRenderObjClass::generateVertexBuffer( Int sizeX, Int sizeY, Int ver m_numVertices=sizeX*sizeY; } - if (m_vertexBufferD3D == NULL) + if (m_vertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(hr=m_pDev->CreateVertexBuffer @@ -916,7 +917,7 @@ void WaterRenderObjClass::ReAcquireResources(void) add r0.rgb, r0, t3\n\ +mul r0.a, r0, t3\n\ add r0.rgb, r0, r1\n"; - hr = D3DXAssembleShader( shader, strlen(shader), 0, NULL, &compiledShader, NULL); + hr = D3DXAssembleShader( shader, strlen(shader), 0, nullptr, &compiledShader, nullptr); if (hr==0) { hr = DX8Wrapper::_Get_D3D_Device8()->CreatePixelShader((DWORD*)compiledShader->GetBufferPointer(), &m_riverWaterPixelShader); compiledShader->Release(); @@ -929,7 +930,7 @@ void WaterRenderObjClass::ReAcquireResources(void) mul r0,v0,t0 ; blend vertex color into t0. \n\ mul r1.rgb,t2,c0 ; reduce t2 (environment mapped reflection) by constant\n\ add r0.rgb, r0, r1"; - hr = D3DXAssembleShader( shader, strlen(shader), 0, NULL, &compiledShader, NULL); + hr = D3DXAssembleShader( shader, strlen(shader), 0, nullptr, &compiledShader, nullptr); if (hr==0) { hr = DX8Wrapper::_Get_D3D_Device8()->CreatePixelShader((DWORD*)compiledShader->GetBufferPointer(), &m_waterPixelShader); compiledShader->Release(); @@ -944,7 +945,7 @@ void WaterRenderObjClass::ReAcquireResources(void) mad r0.rgb, t1, t2, r0 ; blend sparkles and noise \n\ mul r0.rgb, r0, t3 ; blend in black shroud \n\ ;\n"; - hr = D3DXAssembleShader( shader, strlen(shader), 0, NULL, &compiledShader, NULL); + hr = D3DXAssembleShader( shader, strlen(shader), 0, nullptr, &compiledShader, nullptr); if (hr==0) { hr = DX8Wrapper::_Get_D3D_Device8()->CreatePixelShader((DWORD*)compiledShader->GetBufferPointer(), &m_trapezoidWaterPixelShader); compiledShader->Release(); @@ -1107,7 +1108,7 @@ Int WaterRenderObjClass::init(Real waterLevel, Real dx, Real dy, SceneClass *par m_riverTexture=WW3DAssetManager::Get_Instance()->Get_Texture(TheWaterTransparency->m_standingWaterTexture.str()); - //For some reason setting a NULL texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture. + //For some reason setting a null texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture. m_whiteTexture=MSGNEW("TextureClass") TextureClass(1,1,WW3D_FORMAT_A4R4G4B4,MIP_LEVELS_1); SurfaceClass *surface=m_whiteTexture->Get_Surface_Level(); surface->DrawPixel(0,0,0xffffffff); @@ -1182,7 +1183,7 @@ void WaterRenderObjClass::enableWaterGrid(Bool state) m_drawingRiver = false; m_disableRiver = false; - if (state && m_meshData == NULL) + if (state && m_meshData == nullptr) { //water type has changed, must allocate necessary assets for new water. //contains the current deformed water surface z(height) values. With 1 vertex invisible border //around surface to speed up normal calculations. @@ -1348,7 +1349,7 @@ void WaterRenderObjClass::loadSetting( Setting *setting, TimeOfDay timeOfDay ) SurfaceClass::SurfaceDescription surfaceDesc; // sanity - DEBUG_ASSERTCRASH( setting, ("WaterRenderObjClass::loadSetting, NULL setting") ); + DEBUG_ASSERTCRASH( setting, ("WaterRenderObjClass::loadSetting, null setting") ); // textures setting->skyTexture = WW3DAssetManager::Get_Instance()->Get_Texture( WaterSettings[ timeOfDay ].m_skyTextureFile.str() ); @@ -1407,7 +1408,7 @@ void WaterRenderObjClass::loadSetting( Setting *setting, TimeOfDay timeOfDay ) //------------------------------------------------------------------------------------------------- void WaterRenderObjClass::updateRenderTargetTextures(CameraClass *cam) { - if (m_waterType == WATER_TYPE_2_PVSHADER && getClippedWaterPlane(cam, NULL) && + if (m_waterType == WATER_TYPE_2_PVSHADER && getClippedWaterPlane(cam, nullptr) && TheTerrainRenderObject && TheTerrainRenderObject->getMap()) renderMirror(cam); //generate texture containing reflected scene } @@ -1487,7 +1488,7 @@ void WaterRenderObjClass::renderMirror(CameraClass *cam) WW3D::End_Render(false); // Change the rendertarget back to the main backbuffer - DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)NULL); + DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)nullptr); } //------------------------------------------------------------------------------------------------- @@ -1716,7 +1717,7 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo) } //Clean up after any pixel shaders. - //Force render state apply so that the "NULL" texture gets applied to D3D, thus releasing shroud reference count. + //Force render state apply so that the null texture gets applied to D3D, thus releasing shroud reference count. DX8Wrapper::Apply_Render_State_Changes(); DX8Wrapper::Invalidate_Cached_Render_States(); @@ -1790,8 +1791,8 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) Matrix3D tm(Transform); DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); //position the water surface - DX8Wrapper::Set_Texture(0,NULL); //we'll be setting our own textures, so reset W3D - DX8Wrapper::Set_Texture(1,NULL); //we'll be setting our own textures, so reset W3D + DX8Wrapper::Set_Texture(0,nullptr); //we'll be setting our own textures, so reset W3D + DX8Wrapper::Set_Texture(1,nullptr); //we'll be setting our own textures, so reset W3D DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices @@ -1918,9 +1919,9 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) } // m_pDev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); m_pDev->SetRenderState(D3DRS_ALPHABLENDENABLE , FALSE); - m_pDev->SetTexture( 0, NULL); //release reference to bump texture - m_pDev->SetTexture( 1, NULL); //release reference to reflection texture - m_pDev->SetTexture( 2, NULL); //release reference to reflection texture + m_pDev->SetTexture( 0, nullptr); //release reference to bump texture + m_pDev->SetTexture( 1, nullptr); //release reference to reflection texture + m_pDev->SetTexture( 2, nullptr); //release reference to reflection texture m_pDev->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); m_pDev->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU|0); @@ -2379,9 +2380,9 @@ void WaterRenderObjClass::renderWaterMesh(void) DX8Wrapper::Set_Texture(1,setting->waterTexture); DX8Wrapper::Set_Light(0,*m_meshLight); - DX8Wrapper::Set_Light(1,NULL); - DX8Wrapper::Set_Light(2,NULL); - DX8Wrapper::Set_Light(3,NULL); + DX8Wrapper::Set_Light(1,nullptr); + DX8Wrapper::Set_Light(2,nullptr); + DX8Wrapper::Set_Light(3,nullptr); /* DX8Wrapper::Set_DX8_Render_State(D3DRS_AMBIENT,0); //turn off scene ambient DX8Wrapper::Set_DX8_Render_State(D3DRS_SPECULARENABLE,TRUE); @@ -2425,12 +2426,12 @@ void WaterRenderObjClass::renderWaterMesh(void) // m_pDev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); - if (m_trapezoidWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(NULL); + if (m_trapezoidWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); m_vertexBufferD3DOffset += mx*my; //advance past vertices already in buffer - DX8Wrapper::Set_Texture(0,NULL); - DX8Wrapper::Set_Texture(1,NULL); + DX8Wrapper::Set_Texture(0,nullptr); + DX8Wrapper::Set_Texture(1,nullptr); ShaderClass::Invalidate(); m_shaderClass.Set_Cull_Mode(oldCullMode); //water should be visible from both sides @@ -2624,7 +2625,7 @@ void WaterRenderObjClass::setGridResolution(Real gridCellsX, Real gridCellsY, Re { delete [] m_meshData;//free previously allocated grid and allocate new size - m_meshData = NULL; // must set to NULL so that we properly re-allocate + m_meshData = nullptr; // must set to null so that we properly re-allocate m_meshDataSize = 0; Bool enable = m_doWaterGrid; @@ -2657,7 +2658,7 @@ static Real wobble(Real baseV, Real offset, Bool wobble) /**Utility function used to query water heights in a manner that works in both RTS and WB.*/ Real WaterRenderObjClass::getWaterHeight(Real x, Real y) { - const WaterHandle *waterHandle = NULL; + const WaterHandle *waterHandle = nullptr; Real waterZ = 0.0f; ICoord3D iLoc; @@ -2901,7 +2902,7 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig) DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); } - if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(NULL); + if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); //restore blend mode to what W3D expects. if (TheWaterTransparency->m_additiveBlend) @@ -2955,8 +2956,8 @@ void WaterRenderObjClass::setupFlatWaterShader(void) DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL); } else - { //Assume no shroud, so stage 3 will be "NULL" texture but using actual white because - //pixel shader on GF4 generates random colors with SetTexture(3,NULL). + { //Assume no shroud, so stage 3 will be null texture but using actual white because + //pixel shader on GF4 generates random colors with SetTexture(3,nullptr). if (!m_whiteTexture->Is_Initialized()) { m_whiteTexture->Init(); SurfaceClass *surface=m_whiteTexture->Get_Surface_Level(); @@ -3298,7 +3299,7 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4]) DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); } - if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(NULL); + if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(0); //Restore alpha blend to default values since we may have changed them to feather edges. if (!TheWaterTransparency->m_additiveBlend) { DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); @@ -3315,7 +3316,7 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4]) if (m_trapezoidWaterPixelShader) { //shroud was applied in stage3 of main pass so just need to restore state here. W3DShaderManager::resetShader(W3DShaderManager::ST_SHROUD_TEXTURE); - DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,NULL); //free possible reference to shroud texture + DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,nullptr); //free possible reference to shroud texture DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); } else diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 6f34e7e7e78..7b811190f92 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -73,7 +73,7 @@ //#define DEFAULT_FINAL_WAVE_HEIGHT 18.0f //#define DEFAULT_SECOND_WAVE_TIME_OFFSET 6267 //should always be half of totalMs -WaterTracksRenderSystem *TheWaterTracksRenderSystem=NULL; ///< singleton for track drawing system. +WaterTracksRenderSystem *TheWaterTracksRenderSystem=nullptr; ///< singleton for track drawing system. static Bool pauseWaves=FALSE; @@ -131,7 +131,7 @@ WaterTracksObj::~WaterTracksObj(void) //============================================================================= WaterTracksObj::WaterTracksObj(void) { - m_stageZeroTexture=NULL; + m_stageZeroTexture=nullptr; m_bound=false; m_initTimeOffset=0; } @@ -482,7 +482,7 @@ Int WaterTracksObj::render(DX8VertexBufferClass *vertexBuffer, Int batchStart) //============================================================================= //WaterTracksRenderSystem::bindTrack //============================================================================= -/** Grab a track from the free store. If no free tracks exist, return NULL. +/** Grab a track from the free store. If no free tracks exist, return null. As long as a track is bound to an object (like a tank) it is ready to accept updates with additional edges. Once it is unbound, it will expire and return to the free store once all tracks have faded out. @@ -506,7 +506,7 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) mod->m_type=type; // put module on the used list (sorted next to similar types) - nextmod=NULL,prevmod=NULL; + nextmod=nullptr,prevmod=nullptr; for( nextmod = m_usedModules; nextmod; prevmod=nextmod,nextmod = nextmod->m_nextSystem ) { if (nextmod->m_type==type) @@ -523,7 +523,7 @@ WaterTracksObj *WaterTracksRenderSystem::bindTrack(waveType type) } } - if (nextmod==NULL) + if (nextmod==nullptr) { //shadow with new texture. Add to top of list. mod->m_nextSystem = m_usedModules; if (m_usedModules) @@ -570,7 +570,7 @@ void WaterTracksRenderSystem::unbindTrack( WaterTracksObj *mod ) */ void WaterTracksRenderSystem::releaseTrack( WaterTracksObj *mod ) { - if (mod==NULL) + if (mod==nullptr) return; assert(mod->m_bound == false); @@ -584,7 +584,7 @@ void WaterTracksRenderSystem::releaseTrack( WaterTracksObj *mod ) m_usedModules = mod->m_nextSystem; // add module to free list - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -599,11 +599,11 @@ void WaterTracksRenderSystem::releaseTrack( WaterTracksObj *mod ) //============================================================================= WaterTracksRenderSystem::WaterTracksRenderSystem() { - m_usedModules = NULL; - m_freeModules = NULL; - m_indexBuffer = NULL; - m_vertexMaterialClass = NULL; - m_vertexBuffer = NULL; + m_usedModules = nullptr; + m_freeModules = nullptr; + m_indexBuffer = nullptr; + m_vertexMaterialClass = nullptr; + m_vertexBuffer = nullptr; m_stripSizeX=WATER_STRIP_X; m_stripSizeY=WATER_STRIP_Y; m_batchStart=0; @@ -621,7 +621,7 @@ WaterTracksRenderSystem::~WaterTracksRenderSystem( void ) // free all data shutdown(); - m_vertexMaterialClass=NULL; + m_vertexMaterialClass=nullptr; } @@ -727,7 +727,7 @@ void WaterTracksRenderSystem::init(void) mod = NEW WaterTracksObj; - if( mod == NULL ) + if( mod == nullptr ) { // unable to allocate modules needed @@ -736,7 +736,7 @@ void WaterTracksRenderSystem::init(void) } - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -764,7 +764,7 @@ void WaterTracksRenderSystem::reset(void) // free all attached things and used modules - assert( m_usedModules == NULL ); + assert( m_usedModules == nullptr ); } //============================================================================= @@ -791,7 +791,7 @@ void WaterTracksRenderSystem::shutdown( void ) // free all attached things and used modules - assert( m_usedModules == NULL ); + assert( m_usedModules == nullptr ); // free all module storage while( m_freeModules ) @@ -949,7 +949,7 @@ WaterTracksObj *WaterTracksRenderSystem::findTrack(Vector2 &start, Vector2 &end, return mod; mod = mod->m_nextSystem; } - return NULL; + return nullptr; } void WaterTracksRenderSystem::saveTracks(void) { @@ -1086,7 +1086,7 @@ extern HWND ApplicationHWnd; static void TestWaterUpdate(void) { static Int doInit=1; - static WaterTracksObj *track=NULL,*track2=NULL; + static WaterTracksObj *track=nullptr,*track2=nullptr; static Int trackEditMode=0; static waveType currentWaveType = WaveTypeOcean; POINT screenPoint; @@ -1225,8 +1225,8 @@ static void TestWaterUpdate(void) TheWaterTracksRenderSystem->unbindTrack(track2); haveStart=0; //reset for next segment haveEnd=0; - track=NULL; - track2=NULL; + track=nullptr; + track2=nullptr; } } else @@ -1255,8 +1255,8 @@ static void TestWaterUpdate(void) TheWaterTracksRenderSystem->saveTracks(); haveStart=0; //reset for next segment haveEnd=0; - track=NULL; - track2=NULL; + track=nullptr; + track2=nullptr; UnicodeString string; string.format(L"Saved Tracks"); TheInGameUI->message(string); @@ -1273,8 +1273,8 @@ static void TestWaterUpdate(void) TheWaterTracksRenderSystem->loadTracks(); haveStart=0; //reset for next segment haveEnd=0; - track=NULL; - track2=NULL; + track=nullptr; + track2=nullptr; UnicodeString string; string.format(L"Loaded Tracks"); TheInGameUI->message(string); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index 613226083be..ca2485db1e0 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -80,7 +80,7 @@ class GDIFileStream : public InputStream /* ********* MapObject class ****************************/ -/*static*/ MapObject *MapObject::TheMapObjectListPtr = NULL; +/*static*/ MapObject *MapObject::TheMapObjectListPtr = nullptr; /*static*/ Dict MapObject::TheWorldDict; MapObject::MapObject(Coord3D loc, AsciiString name, Real angle, Int flags, const Dict* props, @@ -88,13 +88,13 @@ MapObject::MapObject(Coord3D loc, AsciiString name, Real angle, Int flags, const { m_objectName = validateName( name, flags ); m_thingTemplate = thingTemplate; - m_nextMapObject = NULL; + m_nextMapObject = nullptr; m_location = loc; m_angle = normalizeAngle(angle); m_color = (0xff)<<8; // Bright green. m_flags = flags; - m_renderObj = NULL; - m_shadowObj = NULL; + m_renderObj = nullptr; + m_shadowObj = nullptr; m_runtimeFlags = 0; // Note - do NOT set TheKey_objectSelectable on creation - allow it to follow the .ini value unless specified by user action. jba. [3/20/2003] if (props) @@ -113,27 +113,27 @@ MapObject::MapObject(Coord3D loc, AsciiString name, Real angle, Int flags, const } for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) - setBridgeRenderObject( (BridgeTowerType)i, NULL ); + setBridgeRenderObject( (BridgeTowerType)i, nullptr ); } MapObject::~MapObject(void) { - setRenderObj(NULL); - setShadowObj(NULL); + setRenderObj(nullptr); + setShadowObj(nullptr); if (m_nextMapObject) { MapObject *cur = m_nextMapObject; MapObject *next; while (cur) { next = cur->getNext(); - cur->setNextMap(NULL); // prevents recursion. + cur->setNextMap(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } } for( Int i = 0; i < BRIDGE_MAX_TOWERS; ++i ) - setBridgeRenderObject( (BridgeTowerType)i, NULL ); + setBridgeRenderObject( (BridgeTowerType)i, nullptr ); } @@ -163,7 +163,7 @@ RenderObjClass* MapObject::getBridgeRenderObject( BridgeTowerType type ) if( type >= 0 && type < BRIDGE_MAX_TOWERS ) return m_bridgeTowers[ type ]; - return NULL; + return nullptr; } @@ -360,13 +360,13 @@ const ThingTemplate *MapObject::getThingTemplate( void ) const if (m_thingTemplate) return (const ThingTemplate*) m_thingTemplate->getFinalOverride(); - return NULL; + return nullptr; } /* ********* WorldHeightMap class ****************************/ -TileData *WorldHeightMap::m_alphaTiles[NUM_ALPHA_TILES]={0,0,0,0,0,0,0,0,0,0,0,0}; +TileData *WorldHeightMap::m_alphaTiles[NUM_ALPHA_TILES]={0}; // // WorldHeightMap destructor . @@ -374,31 +374,31 @@ TileData *WorldHeightMap::m_alphaTiles[NUM_ALPHA_TILES]={0,0,0,0,0,0,0,0,0,0,0,0 WorldHeightMap::~WorldHeightMap(void) { delete[](m_data); - m_data = NULL; + m_data = nullptr; delete[](m_tileNdxes); - m_tileNdxes = NULL; + m_tileNdxes = nullptr; delete[](m_blendTileNdxes); - m_blendTileNdxes = NULL; + m_blendTileNdxes = nullptr; delete[](m_extraBlendTileNdxes); - m_extraBlendTileNdxes = NULL; + m_extraBlendTileNdxes = nullptr; delete[](m_cliffInfoNdxes); - m_cliffInfoNdxes = NULL; + m_cliffInfoNdxes = nullptr; delete[](m_cellFlipState); - m_cellFlipState = NULL; + m_cellFlipState = nullptr; delete[](m_seismicUpdateFlag); - m_seismicUpdateFlag = NULL; + m_seismicUpdateFlag = nullptr; delete[](m_seismicZVelocities); - m_seismicZVelocities = NULL; + m_seismicZVelocities = nullptr; delete[](m_cellCliffState); - m_cellCliffState = NULL; + m_cellCliffState = nullptr; int i; for (i=0; iclear(); } @@ -430,22 +430,22 @@ void WorldHeightMap::freeListOfMapObjects(void) transparent tile for non-blended tiles. */ WorldHeightMap::WorldHeightMap(): - m_width(0), m_height(0), m_dataSize(0), m_data(NULL), m_cellFlipState(NULL), m_seismicUpdateFlag(NULL), m_seismicZVelocities(NULL), + m_width(0), m_height(0), m_dataSize(0), m_data(nullptr), m_cellFlipState(nullptr), m_seismicUpdateFlag(nullptr), m_seismicZVelocities(nullptr), m_drawOriginX(0), m_drawOriginY(0), m_numTextureClasses(0), m_drawWidthX(NORMAL_DRAW_WIDTH), m_drawHeightY(NORMAL_DRAW_HEIGHT), - m_tileNdxes(NULL), m_blendTileNdxes(NULL), m_extraBlendTileNdxes(NULL), m_cliffInfoNdxes(NULL), - m_terrainTexHeight(1), m_alphaTexHeight(1), m_cellCliffState(NULL), + m_tileNdxes(nullptr), m_blendTileNdxes(nullptr), m_extraBlendTileNdxes(nullptr), m_cliffInfoNdxes(nullptr), + m_terrainTexHeight(1), m_alphaTexHeight(1), m_cellCliffState(nullptr), #ifdef EVAL_TILING_MODES m_tileMode(TILE_4x4), #endif m_numCliffInfo(1), - m_terrainTex(NULL), m_alphaTerrainTex(NULL), m_numBitmapTiles(0), m_numBlendedTiles(1) + m_terrainTex(nullptr), m_alphaTerrainTex(nullptr), m_numBitmapTiles(0), m_numBlendedTiles(1) { Int i; for (i=0; ivalidateSides(); @@ -469,23 +469,23 @@ static Bool ParseFunkyTilingDataChunk(DataChunkInput &file, DataChunkInfo *info, * */ WorldHeightMap::WorldHeightMap(ChunkInputStream *pStrm, Bool logicalDataOnly): - m_width(0), m_height(0), m_dataSize(0), m_data(NULL), m_cellFlipState(NULL), m_seismicUpdateFlag(NULL), m_seismicZVelocities(NULL), - m_drawOriginX(0), m_cellCliffState(NULL), m_drawOriginY(0), + m_width(0), m_height(0), m_dataSize(0), m_data(nullptr), m_cellFlipState(nullptr), m_seismicUpdateFlag(nullptr), m_seismicZVelocities(nullptr), + m_drawOriginX(0), m_cellCliffState(nullptr), m_drawOriginY(0), m_numTextureClasses(0), m_drawWidthX(NORMAL_DRAW_WIDTH), m_drawHeightY(NORMAL_DRAW_HEIGHT), - m_tileNdxes(NULL), m_blendTileNdxes(NULL), m_extraBlendTileNdxes(NULL), m_cliffInfoNdxes(NULL), + m_tileNdxes(nullptr), m_blendTileNdxes(nullptr), m_extraBlendTileNdxes(nullptr), m_cliffInfoNdxes(nullptr), m_terrainTexHeight(1), m_alphaTexHeight(1), #ifdef EVAL_TILING_MODES m_tileMode(TILE_4x4), #endif m_numCliffInfo(1), - m_terrainTex(NULL), m_alphaTerrainTex(NULL), m_numBitmapTiles(0), m_numBlendedTiles(1) + m_terrainTex(nullptr), m_alphaTerrainTex(nullptr), m_numBitmapTiles(0), m_numBlendedTiles(1) { int i; for (i=0; im_stretchTerrain) { m_drawWidthX=STRETCH_DRAW_WIDTH; @@ -829,7 +829,7 @@ Bool WorldHeightMap::ParseLightingDataChunk(DataChunkInput &file, DataChunkInfo */ Bool WorldHeightMap::ParseObjectsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData) { - file.m_currentObject = NULL; + file.m_currentObject = nullptr; file.registerParser( "Object", info->label, ParseObjectDataChunk ); return (file.parse(userData)); } @@ -991,12 +991,12 @@ void WorldHeightMap::readTexClass(TXTextureClass *texClass, TileData **tileData) { char path[_MAX_PATH]; path[0] = 0; - File *theFile = NULL; + File *theFile = nullptr; // get the file from the description in TheTerrainTypes TerrainType *terrain = TheTerrainTypes->findTerrain( texClass->name ); char texturePath[ _MAX_PATH ]; - if (terrain==NULL) + if (terrain==nullptr) { #ifdef LOAD_TEST_ASSETS theFile = TheFileSystem->openFile( texClass->name.str(), File::READ|File::BINARY); @@ -1008,7 +1008,7 @@ void WorldHeightMap::readTexClass(TXTextureClass *texClass, TileData **tileData) theFile = TheFileSystem->openFile( texturePath, File::READ|File::BINARY); } - if (theFile != NULL) { + if (theFile != nullptr) { GDIFileStream theStream(theFile); InputStream *pStr = &theStream; Int numTiles = WorldHeightMap::countTiles(pStr); @@ -1264,10 +1264,10 @@ Bool WorldHeightMap::ParseObjectData(DataChunkInput &file, DataChunkInfo *info, if (pPrevious) { - DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr != NULL && pPrevious->getNext() == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr != nullptr && pPrevious->getNext() == nullptr, ("Bad linkage.")); pPrevious->setNextMap(pThisOne); } else { - DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr == nullptr, ("Bad linkage.")); MapObject::TheMapObjectListPtr = pThisOne; } file.m_currentObject = pThisOne; @@ -1372,7 +1372,7 @@ Bool WorldHeightMap::readTiles(InputStream *pStr, TileData **tiles, Int numRows) if (bytesPerPixel > 4) return(false); int i; for (i=0; im_tileLocationInTexture.x = x; @@ -1562,7 +1562,7 @@ Int WorldHeightMap::updateTileTexturePositions(Int *edgeHeight) availableGrid[row+j][column+i] = false; Int baseNdx = m_edgeTextureClasses[texClass].firstTile + i + j*width; // In case we are just checking for room... - if (m_edgeTiles[baseNdx] == NULL) continue; + if (m_edgeTiles[baseNdx] == nullptr) continue; Int x = xOrigin + i*TILE_PIXEL_EXTENT; Int y = yOrigin + (width-j-1)*TILE_PIXEL_EXTENT; // Use negative offsets to differentiate between tiles & edges. @@ -1580,7 +1580,7 @@ Int WorldHeightMap::updateTileTexturePositions(Int *edgeHeight) void WorldHeightMap::getUVForNdx(Int tileNdx, float *minU, float *minV, float *maxU, float*maxV) { Short baseNdx = tileNdx>>2; - if (m_sourceTiles[baseNdx] == NULL) { + if (m_sourceTiles[baseNdx] == nullptr) { // Missing texture. *minU = *minV = *maxU = *maxV = 0.0f; return; @@ -2121,7 +2121,7 @@ void WorldHeightMap::setTextureLOD(Int lod) TextureClass *WorldHeightMap::getTerrainTexture(void) { - if (m_terrainTex == NULL) { + if (m_terrainTex == nullptr) { Int edgeHeight; Int height = updateTileTexturePositions(&edgeHeight); Int pow2Height = 1; @@ -2168,7 +2168,7 @@ TextureClass *WorldHeightMap::getTerrainTexture(void) TextureClass *WorldHeightMap::getAlphaTerrainTexture(void) { - if (m_alphaTerrainTex == NULL) { + if (m_alphaTerrainTex == nullptr) { getTerrainTexture(); } return m_alphaTerrainTex; @@ -2176,7 +2176,7 @@ TextureClass *WorldHeightMap::getAlphaTerrainTexture(void) TextureClass *WorldHeightMap::getEdgeTerrainTexture(void) { - if (m_alphaEdgeTex == NULL) { + if (m_alphaEdgeTex == nullptr) { getTerrainTexture(); } return m_alphaEdgeTex; @@ -2368,12 +2368,12 @@ UnsignedByte * WorldHeightMap::getPointerToTileData(Int xIndex, Int yIndex, Int { Int ndx = (yIndex*m_width)+xIndex; if (yIndex<0 || xIndex<0 || xIndex>=m_width || yIndex>=m_height) { - return NULL; + return nullptr; } if (ndx<0 || ndx>=m_dataSize) { - return NULL; + return nullptr; } - TBlendTileInfo *pBlend = NULL; + TBlendTileInfo *pBlend = nullptr; Short tileNdx = m_tileNdxes[ndx]; if (getRawTileData(tileNdx, width, s_buffer, DATA_LEN_BYTES)) { Short blendTileNdx = m_blendTileNdxes[ndx]; @@ -2402,7 +2402,7 @@ UnsignedByte * WorldHeightMap::getPointerToTileData(Int xIndex, Int yIndex, Int return(s_buffer); } - return(NULL); + return(nullptr); } #define K_HORIZ 0 @@ -2437,7 +2437,7 @@ UnsignedByte *WorldHeightMap::getRGBAlphaDataForWidth(Int width, TBlendTileInfo void WorldHeightMap::setupAlphaTiles(void) { TBlendTileInfo blendInfo; - if (m_alphaTiles[0] != NULL) return; + if (m_alphaTiles[0] != nullptr) return; Int k; for (k=0; kdeleteOnClose(); if (ramFile->openFromArchive(m_file, fileInfo->m_filename, fileInfo->m_offset, fileInfo->m_size) == FALSE) { ramFile->close(); - ramFile = NULL; - return NULL; + ramFile = nullptr; + return nullptr; } if ((access & File::WRITE) == 0) { @@ -90,12 +90,12 @@ File* Win32BIGFile::openFile( const Char *filename, Int access ) constexpr size_t bufferSize = 0; File *localFile = TheLocalFileSystem->openFile(filename, access, bufferSize); - if (localFile != NULL) { + if (localFile != nullptr) { ramFile->copyDataToFile(localFile); } ramFile->close(); - ramFile = NULL; + ramFile = nullptr; return localFile; } @@ -153,7 +153,7 @@ Bool Win32BIGFile::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) { const ArchivedFileInfo *tempFileInfo = getArchivedFileInfo(filename); - if (tempFileInfo == NULL) { + if (tempFileInfo == nullptr) { return FALSE; } diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp index 5aaedc2f1b8..64401c47eff 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp @@ -52,8 +52,8 @@ Win32BIGFileSystem::~Win32BIGFileSystem() { } void Win32BIGFileSystem::init() { - DEBUG_ASSERTCRASH(TheLocalFileSystem != NULL, ("TheLocalFileSystem must be initialized before TheArchiveFileSystem.")); - if (TheLocalFileSystem == NULL) { + DEBUG_ASSERTCRASH(TheLocalFileSystem != nullptr, ("TheLocalFileSystem must be initialized before TheArchiveFileSystem.")); + if (TheLocalFileSystem == nullptr) { return; } @@ -89,9 +89,9 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) { DEBUG_LOG(("Win32BIGFileSystem::openArchiveFile - opening BIG file %s", filename)); - if (fp == NULL) { + if (fp == nullptr) { DEBUG_CRASH(("Could not open archive file %s for parsing", filename)); - return NULL; + return nullptr; } AsciiString asciibuf; @@ -101,8 +101,8 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) { if (strcmp(buffer, BIGFileIdentifier) != 0) { DEBUG_CRASH(("Error reading BIG file identifier in file %s", filename)); fp->close(); - fp = NULL; - return NULL; + fp = nullptr; + return nullptr; } // read in the file size. @@ -174,7 +174,7 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) { archiveFile->attachFile(fp); delete fileInfo; - fileInfo = NULL; + fileInfo = nullptr; // leave fp open as the archive file will be using it. @@ -228,7 +228,7 @@ Bool Win32BIGFileSystem::loadBigFilesFromDirectory(AsciiString dir, AsciiString ArchiveFile *archiveFile = openArchiveFile((*it).str()); - if (archiveFile != NULL) { + if (archiveFile != nullptr) { DEBUG_LOG(("Win32BIGFileSystem::loadBigFilesFromDirectory - loading %s into the directory tree.", (*it).str())); loadIntoDirectoryTree(archiveFile, overwrite); m_archiveFileMap[(*it)] = archiveFile; diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp index 424c446996d..43a6ca5cbdd 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp @@ -48,7 +48,7 @@ File * Win32LocalFileSystem::openFile(const Char *filename, Int access, size_t b // sanity check if (strlen(filename) <= 0) { - return NULL; + return nullptr; } if (access & File::WRITE) { @@ -60,7 +60,7 @@ File * Win32LocalFileSystem::openFile(const Char *filename, Int access, size_t b AsciiString dirName; string.nextToken(&token, "\\/"); dirName = token; - while ((token.find('.') == NULL) || (string.find('.') != NULL)) { + while ((token.find('.') == nullptr) || (string.find('.') != nullptr)) { createDirectory(dirName); string.nextToken(&token, "\\/"); dirName.concat('\\'); @@ -73,7 +73,7 @@ File * Win32LocalFileSystem::openFile(const Char *filename, Int access, size_t b if (file->open(filename, access, bufferSize) == FALSE) { deleteInstance(file); - file = NULL; + file = nullptr; } else { file->deleteOnClose(); } @@ -124,7 +124,7 @@ Bool Win32LocalFileSystem::doesFileExist(const Char *filename) const void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList & filenameList, Bool searchSubdirectories) const { - HANDLE fileHandle = NULL; + HANDLE fileHandle = nullptr; WIN32_FIND_DATA findData; AsciiString asciisearch; @@ -187,7 +187,7 @@ void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDire Bool Win32LocalFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const { WIN32_FIND_DATA findData; - HANDLE findHandle = NULL; + HANDLE findHandle = nullptr; findHandle = FindFirstFile(filename.str(), &findData); if (findHandle == INVALID_HANDLE_VALUE) { @@ -207,14 +207,14 @@ Bool Win32LocalFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fi Bool Win32LocalFileSystem::createDirectory(AsciiString directory) { if ((!directory.isEmpty()) && (directory.getLength() < _MAX_DIR)) { - return (CreateDirectory(directory.str(), NULL) != 0); + return (CreateDirectory(directory.str(), nullptr) != 0); } return FALSE; } AsciiString Win32LocalFileSystem::normalizePath(const AsciiString& filePath) const { - DWORD retval = GetFullPathNameA(filePath.str(), 0, NULL, NULL); + DWORD retval = GetFullPathNameA(filePath.str(), 0, nullptr, nullptr); if (retval == 0) { DEBUG_LOG(("Unable to determine buffer size for normalized file path. Error=(%u).", GetLastError())); @@ -222,7 +222,7 @@ AsciiString Win32LocalFileSystem::normalizePath(const AsciiString& filePath) con } AsciiString normalizedFilePath; - retval = GetFullPathNameA(filePath.str(), retval, normalizedFilePath.getBufferForRead(retval - 1), NULL); + retval = GetFullPathNameA(filePath.str(), retval, normalizedFilePath.getBufferForRead(retval - 1), nullptr); if (retval == 0) { DEBUG_LOG(("Unable to normalize file path '%s'. Error=(%u).", filePath.str(), GetLastError())); diff --git a/Core/Libraries/Include/Lib/BaseTypeCore.h b/Core/Libraries/Include/Lib/BaseTypeCore.h index 22bd6a6d1fc..f173ade19b4 100644 --- a/Core/Libraries/Include/Lib/BaseTypeCore.h +++ b/Core/Libraries/Include/Lib/BaseTypeCore.h @@ -87,11 +87,6 @@ #define TWO_PI 6.28318530718f #endif -#ifndef NULL -//#define NULL ((void *)0) -#define NULL 0 // C++ doesn't like casting void *'s into other pointers -#endif - // MSVC math.h defines overloaded functions with this name... //#ifndef abs //#define abs(x) (((x) < 0) ? -(x) : (x)) diff --git a/Core/Libraries/Source/Compression/CompressionManager.cpp b/Core/Libraries/Source/Compression/CompressionManager.cpp index 0853a26745c..ca3343d6927 100644 --- a/Core/Libraries/Source/Compression/CompressionManager.cpp +++ b/Core/Libraries/Source/Compression/CompressionManager.cpp @@ -435,7 +435,7 @@ void DoCompressTest( void ) } delete compressedBuf; - compressedBuf = NULL; + compressedBuf = nullptr; } DEBUG_LOG(("d = %d -> %d", d.origSize, d.compressedSize[i])); @@ -443,10 +443,10 @@ void DoCompressTest( void ) DEBUG_LOG(("s_sizes[%s] = %d -> %d", it->first.str(), s_sizes[it->first].origSize, s_sizes[it->first].compressedSize[i])); delete[] buf; - buf = NULL; + buf = nullptr; delete[] uncompressedBuf; - uncompressedBuf = NULL; + uncompressedBuf = nullptr; } ++it; @@ -486,10 +486,10 @@ void DoCompressTest( void ) for (i = 0; i < COMPRESSION_MAX+1; ++i) { delete s_compressGathers[i]; - s_compressGathers[i] = NULL; + s_compressGathers[i] = nullptr; delete s_decompressGathers[i]; - s_decompressGathers[i] = NULL; + s_decompressGathers[i] = nullptr; } } diff --git a/Core/Libraries/Source/Compression/EAC/huffencode.cpp b/Core/Libraries/Source/Compression/EAC/huffencode.cpp index d01f8a99117..db2ab7c9b30 100644 --- a/Core/Libraries/Source/Compression/EAC/huffencode.cpp +++ b/Core/Libraries/Source/Compression/EAC/huffencode.cpp @@ -1181,8 +1181,8 @@ int GCALL HUFF_encode(void *compresseddata, const void *source, int sourcesize, int plen=0; struct HUFFMemStruct infile; struct HUFFMemStruct outfile; - struct HuffEncodeContext *EC=0; - void *deltabuf=0; + struct HuffEncodeContext *EC=nullptr; + void *deltabuf=nullptr; int opt=0; if (opts) opt = opts[0]; diff --git a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp index 224084152a1..638ab493c12 100644 --- a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp +++ b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp @@ -35,17 +35,17 @@ Bool DecompressFile (char *infile, char *outfile) { UnsignedInt rawSize = 0, compressedSize = 0; - FILE *inFilePtr = NULL; - FILE *outFilePtr= NULL; - char *inBlock = NULL; - char *outBlock = NULL; + FILE *inFilePtr = nullptr; + FILE *outFilePtr= nullptr; + char *inBlock = nullptr; + char *outBlock = nullptr; LZHL_DHANDLE decompress; Int ok = 0; size_t srcSz, dstSz; // Parameter checking - if (( infile == NULL ) || ( outfile == NULL )) + if (( infile == nullptr ) || ( outfile == nullptr )) return FALSE; inFilePtr = fopen( infile, "rb" ); @@ -67,7 +67,7 @@ Bool DecompressFile (char *infile, char *outfile) inBlock = (char *) DbgMalloc( compressedSize ); outBlock= (char *) DbgMalloc( rawSize ); - if (( inBlock == NULL ) || ( outBlock == NULL )) + if (( inBlock == nullptr ) || ( outBlock == nullptr )) { if (inBlock) DbgFree(inBlock); if (outBlock) DbgFree(outBlock); @@ -123,16 +123,16 @@ Bool CompressFile (char *infile, char *outfile) { UnsignedInt rawSize = 0; UnsignedInt compressedSize = 0, compressed = 0, i = 0; - FILE *inFilePtr = NULL; - FILE *outFilePtr= NULL; - char *inBlock = NULL; - char *outBlock = NULL; + FILE *inFilePtr = nullptr; + FILE *outFilePtr= nullptr; + char *inBlock = nullptr; + char *outBlock = nullptr; LZHL_CHANDLE compressor; UnsignedInt blocklen; // Parameter checking - if (( infile == NULL ) || ( outfile == NULL )) + if (( infile == nullptr ) || ( outfile == nullptr )) return FALSE; // Allocate the appropriate amount of memory @@ -148,7 +148,7 @@ Bool CompressFile (char *infile, char *outfile) inBlock = (char *) DbgMalloc(rawSize); outBlock= (char *) DbgMalloc( LZHLCompressorCalcMaxBuf( rawSize )); - if (( inBlock == NULL ) || ( outBlock == NULL )) + if (( inBlock == nullptr ) || ( outBlock == nullptr )) { DbgFree(inBlock); DbgFree(outBlock); @@ -193,7 +193,7 @@ Bool CompressPacket (char *inPacket, char *outPacket) { // Parameter checking - if (( inPacket == NULL ) || ( outPacket == NULL )) + if (( inPacket == nullptr ) || ( outPacket == nullptr )) return FALSE; return TRUE; @@ -204,7 +204,7 @@ Bool DecompressPacket (char *inPacket, char *outPacket) { // Parameter checking - if (( inPacket == NULL ) || ( outPacket == NULL )) + if (( inPacket == nullptr ) || ( outPacket == nullptr )) return FALSE; return TRUE; } @@ -226,7 +226,7 @@ Bool DecompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int // Parameter checking - if (( inBuffer == NULL ) || ( outBuffer == NULL ) || ( inSize < 4 ) || ( outSize == 0 )) + if (( inBuffer == nullptr ) || ( outBuffer == nullptr ) || ( inSize < 4 ) || ( outSize == 0 )) return FALSE; // Get compressed size of file. @@ -273,7 +273,7 @@ Bool CompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int& // Parameter checking - if (( inBuffer == NULL ) || ( outBuffer == NULL ) || ( inSize < 4 ) || ( outSize == 0 )) + if (( inBuffer == nullptr ) || ( outBuffer == nullptr ) || ( inSize < 4 ) || ( outSize == 0 )) return FALSE; rawSize = inSize; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/FramGrab.cpp b/Core/Libraries/Source/WWVegas/WW3D2/FramGrab.cpp index 0fb36d93ac3..f5338c0ec2b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/FramGrab.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/FramGrab.cpp @@ -37,8 +37,8 @@ FrameGrabClass::FrameGrabClass(const char *filename, MODE mode, int width, int h FrameRate = framerate; Counter = 0; - Stream = 0; - AVIFile = 0; + Stream = nullptr; + AVIFile = nullptr; if(Mode != AVI) return; @@ -54,7 +54,7 @@ FrameGrabClass::FrameGrabClass(const char *filename, MODE mode, int width, int h } while(result != -1); // Create new AVI file using AVIFileOpen. - hr = AVIFileOpen(&AVIFile, file, OF_WRITE | OF_CREATE, NULL); + hr = AVIFileOpen(&AVIFile, file, OF_WRITE | OF_CREATE, nullptr); if (hr != 0) { char buf[256]; sprintf(buf, "Unable to open %s\n", Filename); @@ -120,9 +120,9 @@ FrameGrabClass::~FrameGrabClass() } void FrameGrabClass::CleanupAVI() { - if(Bitmap != 0) { GlobalFreePtr(Bitmap); Bitmap = 0; } - if(Stream != 0) { AVIStreamRelease(Stream); Stream = 0; } - if(AVIFile != 0) { AVIFileRelease(AVIFile); AVIFile = 0; } + if(Bitmap != nullptr) { GlobalFreePtr(Bitmap); Bitmap = nullptr; } + if(Stream != nullptr) { AVIStreamRelease(Stream); Stream = nullptr; } + if(AVIFile != nullptr) { AVIFileRelease(AVIFile); AVIFile = nullptr; } AVIFileExit(); Mode = RAW; @@ -133,7 +133,7 @@ void FrameGrabClass::GrabAVI(void *BitmapPointer) // CompressDIB(&bi, lpOld, &biNew, lpNew); // Save the compressed data using AVIStreamWrite. - HRESULT hr = AVIStreamWrite(Stream, Counter++, 1, BitmapPointer, BitmapInfoHeader.biSizeImage, AVIIF_KEYFRAME, NULL, NULL); + HRESULT hr = AVIStreamWrite(Stream, Counter++, 1, BitmapPointer, BitmapInfoHeader.biSizeImage, AVIIF_KEYFRAME, nullptr, nullptr); if(hr != 0) { char buf[256]; sprintf(buf, "avi write error %x/%d\n", hr, hr); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp index 0dc4fb8cc29..7710545b3a2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp @@ -88,10 +88,10 @@ *=============================================================================================*/ AABTreeClass::AABTreeClass(void) : NodeCount(0), - Nodes(NULL), + Nodes(nullptr), PolyCount(0), - PolyIndices(NULL), - Mesh(NULL) + PolyIndices(nullptr), + Mesh(nullptr) { } @@ -137,10 +137,10 @@ AABTreeClass::AABTreeClass(AABTreeBuilderClass * builder) *=============================================================================================*/ AABTreeClass::AABTreeClass(const AABTreeClass & that) : NodeCount(0), - Nodes(NULL), + Nodes(nullptr), PolyCount(0), - PolyIndices(0), - Mesh(NULL) + PolyIndices(nullptr), + Mesh(nullptr) { *this = that; } @@ -212,13 +212,13 @@ void AABTreeClass::Reset(void) { NodeCount = 0; delete[] Nodes; - Nodes = NULL; + Nodes = nullptr; PolyCount = 0; delete[] PolyIndices; - PolyIndices = NULL; + PolyIndices = nullptr; - Mesh = NULL; + Mesh = nullptr; } /*********************************************************************************************** @@ -267,9 +267,9 @@ void AABTreeClass::Build_Tree_Recursive(AABTreeBuilderClass::CullNodeStruct * no /* ** If this is a non-leaf node, set up the child indices, otherwise set up the polygon indices */ - if (node->Front != NULL) { + if (node->Front != nullptr) { - WWASSERT(node->Back != NULL); // if we have one child, we better have both! + WWASSERT(node->Back != nullptr); // if we have one child, we better have both! newnode->Set_Front_Child(node->Front->Index); newnode->Set_Back_Child(node->Back->Index); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h index d38dc9d6d01..1e96e96cc1e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h @@ -224,7 +224,7 @@ inline int AABTreeClass::Compute_Ram_Size(void) inline bool AABTreeClass::Cast_Ray(RayCollisionTestClass & raytest) { - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); return Cast_Ray_Recursive(&(Nodes[0]),raytest); } @@ -241,7 +241,7 @@ inline int AABTreeClass::Cast_Semi_Infinite_Axis_Aligned_Ray(const Vector3 & sta static const int axis_1[6] = { 1, 1, 2, 2, 0, 0 }; static const int axis_2[6] = { 2, 2, 0, 0, 1, 1 }; static const int direction[6] = { 1, 0, 1, 0, 1, 0 }; - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); WWASSERT(axis_dir >= 0); WWASSERT(axis_dir < 6); @@ -255,25 +255,25 @@ inline int AABTreeClass::Cast_Semi_Infinite_Axis_Aligned_Ray(const Vector3 & sta inline bool AABTreeClass::Cast_AABox(AABoxCollisionTestClass & boxtest) { - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); return Cast_AABox_Recursive(&(Nodes[0]),boxtest); } inline bool AABTreeClass::Cast_OBBox(OBBoxCollisionTestClass & boxtest) { - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); return Cast_OBBox_Recursive(&(Nodes[0]),boxtest); } inline bool AABTreeClass::Intersect_OBBox(OBBoxIntersectionTestClass & boxtest) { - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); return Intersect_OBBox_Recursive(&(Nodes[0]),boxtest); } inline void AABTreeClass::Update_Bounding_Boxes(void) { - WWASSERT(Nodes != NULL); + WWASSERT(Nodes != nullptr); Update_Bounding_Boxes_Recursive(&(Nodes[0])); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp b/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp index 9353b289781..f65e97de9fb 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp @@ -65,7 +65,7 @@ AggregateLoaderClass _AggregateLoader; // AggregateDefClass // AggregateDefClass::AggregateDefClass (void) - : m_pName (NULL) + : m_pName (nullptr) { // Set our member data to default settings ::memset (&m_Info, 0, sizeof (m_Info)); @@ -80,7 +80,7 @@ AggregateDefClass::AggregateDefClass (void) // AggregateDefClass // AggregateDefClass::AggregateDefClass (const AggregateDefClass &src) - : m_pName (NULL) + : m_pName (nullptr) { // Set our member data to default settings ::memset (&m_Info, 0, sizeof (m_Info)); @@ -98,7 +98,7 @@ AggregateDefClass::AggregateDefClass (const AggregateDefClass &src) // AggregateDefClass // AggregateDefClass::AggregateDefClass (RenderObjClass &base_model) - : m_pName (NULL) + : m_pName (nullptr) { // Set our member data to default settings ::memset (&m_Info, 0, sizeof (m_Info)); @@ -117,11 +117,11 @@ AggregateDefClass::AggregateDefClass (RenderObjClass &base_model) AggregateDefClass::~AggregateDefClass (void) { // Free the name buffer if necessary - if (m_pName != NULL) { + if (m_pName != nullptr) { // free() is used because the buffer was allocated with ::_strdup(). ::free (m_pName); - m_pName = NULL; + m_pName = nullptr; } Free_Subobject_List (); @@ -139,9 +139,9 @@ AggregateDefClass::operator= (const AggregateDefClass &src) int index; // Free the name buffer if necessary - if (m_pName != NULL) { + if (m_pName != nullptr) { ::free (m_pName); - m_pName = NULL; + m_pName = nullptr; } // Start with a fresh set of data @@ -156,7 +156,7 @@ AggregateDefClass::operator= (const AggregateDefClass &src) // Loop through all the entries in the src object's subobj list for (index = 0; index < src.m_SubobjectList.Count (); index ++) { W3dAggregateSubobjectStruct *pinfo = src.m_SubobjectList[index]; - if (pinfo != NULL) { + if (pinfo != nullptr) { // Copy the src object's info for this subobj W3dAggregateSubobjectStruct *new_info = W3DNEW W3dAggregateSubobjectStruct; @@ -200,7 +200,7 @@ AggregateDefClass::Create (void) { // Attempt to create an instance of the hierarchy RenderObjClass *pmodel = Create_Render_Object (m_Info.BaseModelName); - if (pmodel != NULL) { + if (pmodel != nullptr) { // Perform the aggregation Attach_Subobjects (*pmodel); @@ -237,11 +237,11 @@ AggregateDefClass::Find_Subobject // Loop through all the models in our "path" until we've either failed // or found the exact mesh we were looking for... for (int index = 1; - (mesh_path[index][0] != 0) && (parent_model != NULL); + (mesh_path[index][0] != 0) && (parent_model != nullptr); index ++) { // Look one level deeper into the subobject chain... - RenderObjClass *sub_obj = NULL; + RenderObjClass *sub_obj = nullptr; if (bone_path[index][0] == 0) { sub_obj = parent_model->Get_Sub_Object_By_Name (mesh_path[index]); } else { @@ -250,11 +250,11 @@ AggregateDefClass::Find_Subobject int subobj_count = parent_model->Get_Num_Sub_Objects_On_Bone (bone_index); // Loop through all the subobjects on this bone - for (int subobj_index = 0; (subobj_index < subobj_count) && (sub_obj == NULL); subobj_index ++) { + for (int subobj_index = 0; (subobj_index < subobj_count) && (sub_obj == nullptr); subobj_index ++) { // Is this the subobject we were looking for? RenderObjClass *ptemp_obj = parent_model->Get_Sub_Object_On_Bone (subobj_index, bone_index); - if (ptemp_obj == NULL) + if (ptemp_obj == nullptr) continue; if (::lstrcmpi (ptemp_obj->Get_Name (), mesh_path[index]) == 0) { @@ -286,11 +286,11 @@ AggregateDefClass::Attach_Subobjects (RenderObjClass &base_model) // Now loop through all the subobjects and attach them to the appropriate bone for (int index = 0; index < m_SubobjectList.Count (); index ++) { W3dAggregateSubobjectStruct *psubobj_info = m_SubobjectList[index]; - if (psubobj_info != NULL) { + if (psubobj_info != nullptr) { // Now create this subobject and attach it to its bone. RenderObjClass *prender_obj = Create_Render_Object (psubobj_info->SubobjectName); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { // Attach this object to the requested bone if (base_model.Add_Sub_Object_To_Bone (prender_obj, psubobj_info->BoneName) == false) { @@ -317,14 +317,14 @@ RenderObjClass * AggregateDefClass::Create_Render_Object (const char *passet_name) { // Assume failure - RenderObjClass *prender_obj = NULL; + RenderObjClass *prender_obj = nullptr; // Attempt to get an instance of the render object from the asset manager prender_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (passet_name); // If we couldn't find the render object in the asset manager, then attempt to // load it from file - if ((prender_obj == NULL) && + if ((prender_obj == nullptr) && Load_Assets (passet_name)) { // It should be in the asset manager now, so attempt to get it again. @@ -347,7 +347,7 @@ AggregateDefClass::Load_Assets (const char *passet_name) bool retval = false; // Param OK? - if (passet_name != NULL) { + if (passet_name != nullptr) { // Determine what the current working directory is char path[MAX_PATH]; @@ -385,7 +385,7 @@ AggregateDefClass::Initialize (RenderObjClass &base_model) // Determine what the render objects original name was. const char *orig_model_name = base_model.Get_Base_Model_Name (); - orig_model_name = (orig_model_name == NULL) ? base_model.Get_Name () : orig_model_name; + orig_model_name = (orig_model_name == nullptr) ? base_model.Get_Name () : orig_model_name; // Record information about this base model ::lstrcpy (m_Info.BaseModelName, orig_model_name); @@ -437,7 +437,7 @@ AggregateDefClass::Build_Subobject_List index < original_model.Get_Num_Sub_Objects_On_Bone (bone_index); index ++) { RenderObjClass *psubobj = original_model.Get_Sub_Object_On_Bone (index, bone_index); - if (psubobj != NULL) { + if (psubobj != nullptr) { orig_node_list.Add (psubobj); } } @@ -448,7 +448,7 @@ AggregateDefClass::Build_Subobject_List index < model.Get_Num_Sub_Objects_On_Bone (bone_index); index ++) { RenderObjClass *psubobj = model.Get_Sub_Object_On_Bone (index, bone_index); - if (psubobj != NULL) { + if (psubobj != nullptr) { node_list.Add (psubobj); } } @@ -460,11 +460,11 @@ AggregateDefClass::Build_Subobject_List W3dAggregateSubobjectStruct subobj_info = { 0 }; for (int node_index = 0; node_index < node_count; node_index ++) { RenderObjClass *psubobject = node_list[node_index]; - WWASSERT (psubobject != NULL); + WWASSERT (psubobject != nullptr); // Is this subobject new? (i.e. not in a 'vanilla' instance?) const char *prototype_name = psubobject->Get_Name (); - if (psubobject != NULL && + if (psubobject != nullptr && (Is_Object_In_List (prototype_name, orig_node_list) == false)) { // Add this subobject to our list @@ -519,7 +519,7 @@ AggregateDefClass::Is_Object_In_List RenderObjClass *prender_obj = node_list[node_index]; // Is this the render object we were looking for? - if (prender_obj != NULL && + if (prender_obj != nullptr && ::lstrcmpi (prender_obj->Get_Name (), passet_name) == 0) { retval = true; } @@ -870,11 +870,11 @@ PrototypeClass * AggregateLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) { // Assume failure - AggregatePrototypeClass *pprototype = NULL; + AggregatePrototypeClass *pprototype = nullptr; // Create a definition object AggregateDefClass *pdefinition = W3DNEW AggregateDefClass; - if (pdefinition != NULL) { + if (pdefinition != nullptr) { // Ask the definition object to load the aggregate data if (pdefinition->Load_W3D (chunk_load) != WW3D_ERROR_OK) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp index a521e5679e5..dd5150377ad 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp @@ -58,7 +58,7 @@ ////////////////////////////////////////////////////////////////////// HashTemplateClass AnimatedSoundMgrClass::AnimationNameHash; DynamicVectorClass AnimatedSoundMgrClass::AnimSoundLists; -SoundLibraryBridgeClass* AnimatedSoundMgrClass::SoundLibrary = NULL; +SoundLibraryBridgeClass* AnimatedSoundMgrClass::SoundLibrary = nullptr; ////////////////////////////////////////////////////////////////////// // Local inlines @@ -66,7 +66,7 @@ SoundLibraryBridgeClass* AnimatedSoundMgrClass::SoundLibrary = N static WWINLINE INIClass * Get_INI (const char *filename) { - INIClass *ini = NULL; + INIClass *ini = nullptr; // // Get the file from our filefactory @@ -100,12 +100,12 @@ Build_List_From_String { int count = 0; - WWASSERT (buffer != NULL); - WWASSERT (delimiter != NULL); - WWASSERT (string_list != NULL); - if ((buffer != NULL) && - (delimiter != NULL) && - (string_list != NULL)) + WWASSERT (buffer != nullptr); + WWASSERT (delimiter != nullptr); + WWASSERT (string_list != nullptr); + if ((buffer != nullptr) && + (delimiter != nullptr) && + (string_list != nullptr)) { int delim_len = ::strlen (delimiter); @@ -114,7 +114,7 @@ Build_List_From_String // const char *entry = buffer; for (; - (entry != NULL) && (entry[1] != 0); + (entry != nullptr) && (entry[1] != 0); entry = ::strstr (entry, delimiter)) { @@ -141,7 +141,7 @@ Build_List_From_String // count = 0; for (entry = buffer; - (entry != NULL) && (entry[1] != 0); + (entry != nullptr) && (entry[1] != 0); entry = ::strstr (entry, delimiter)) { @@ -157,7 +157,7 @@ Build_List_From_String // StringClass entry_string = entry; char *delim_start = ::strstr (entry_string.Peek_Buffer(), delimiter); - if (delim_start != NULL) { + if (delim_start != nullptr) { delim_start[0] = 0; } @@ -195,8 +195,8 @@ Is_In_Param_List // // Check incoming parameters // - WWASSERT( param_list != NULL ); - if ( param_list == NULL ) + WWASSERT( param_list != nullptr ); + if ( param_list == nullptr ) { return( false ); } @@ -205,8 +205,8 @@ Is_In_Param_List { return( false ); } - WWASSERT( param_to_check != NULL ); - if ( param_to_check == NULL ) + WWASSERT( param_to_check != nullptr ); + if ( param_to_check == nullptr ) { return( false ); } @@ -226,7 +226,7 @@ Is_In_Param_List // OutputDebugString( "\n" ); // if ( stricmp( string.Peek_Buffer(), param_to_check ) == 0 ) // Breaks with whitespaces - if ( strstr( string.str(), param_to_check ) != 0 ) + if ( strstr( string.str(), param_to_check ) != nullptr ) { return( true ); } @@ -257,7 +257,7 @@ AnimatedSoundMgrClass::Initialize (const char *ini_filename) // Determine which filename to use // const char *filename_to_use = ini_filename; - if (filename_to_use == NULL) { + if (filename_to_use == nullptr) { filename_to_use = DEFAULT_INI_FILENAME; } @@ -265,14 +265,14 @@ AnimatedSoundMgrClass::Initialize (const char *ini_filename) // Get the INI file which contains the data for this viewer // INIClass *ini_file = ::Get_INI (filename_to_use); - if (ini_file != NULL) { + if (ini_file != nullptr) { // // Loop over all the sections in the INI // List §ion_list = ini_file->Get_Section_List (); for ( INISection *section = section_list.First (); - section != NULL && section->Is_Valid (); + section != nullptr && section->Is_Valid (); section = section->Next_Valid ()) { // @@ -332,7 +332,7 @@ AnimatedSoundMgrClass::Initialize (const char *ini_filename) // // Separate the parameters into an easy-to-handle data structure // - StringClass *param_list = NULL; + StringClass *param_list = nullptr; int param_count = ::Build_List_From_String (value, ",", ¶m_list); // if ((param_count >= 2) && (param_count <= 3)) @@ -437,12 +437,12 @@ AnimatedSoundMgrClass::Shutdown (void) const char* AnimatedSoundMgrClass::Get_Embedded_Sound_Name (HAnimClass *anim) { - if (anim == NULL) { - return NULL; + if (anim == nullptr) { + return nullptr; } ANIM_SOUND_LIST* list = Find_Sound_List (anim); - if (list == NULL) { - return NULL; + if (list == nullptr) { + return nullptr; } return list->BoneName.str(); @@ -491,7 +491,7 @@ AnimatedSoundMgrClass::Trigger_Sound const Matrix3D & tm ) { - if ((SoundLibrary == NULL) || (anim == NULL)) { + if ((SoundLibrary == nullptr) || (anim == nullptr)) { return old_frame; } @@ -502,7 +502,7 @@ AnimatedSoundMgrClass::Trigger_Sound // Lookup the sound list for this animation // ANIM_SOUND_LIST *sound_list = Find_Sound_List (anim); - if (sound_list != NULL) { + if (sound_list != nullptr) { for (int index = 0; index < sound_list->List.Count (); index ++) { int frame = sound_list->List[index]->Frame; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h index 980e259591b..785cc7f32f5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h @@ -68,7 +68,7 @@ class AnimatedSoundMgrClass // // Initialization and shutdown // - static void Initialize (const char *ini_filename = NULL); + static void Initialize (const char *ini_filename = nullptr); static void Shutdown (void); // diff --git a/Core/Libraries/Source/WWVegas/WW3D2/bitmaphandler.cpp b/Core/Libraries/Source/WWVegas/WW3D2/bitmaphandler.cpp index 3b387a4a433..9bba18e5f34 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/bitmaphandler.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/bitmaphandler.cpp @@ -113,16 +113,16 @@ void BitmapHandlerClass::Copy_Image_Generate_Mipmap( unsigned b8g8r8a8_10; unsigned b8g8r8a8_11; for (unsigned x=0;xSet_Container(NULL); + SubObjects[i]->Set_Container(nullptr); SubObjects[i]->Release_Ref(); - SubObjects[i] = NULL; + SubObjects[i] = nullptr; } SubObjects.Delete_All(); ProxyList.Delete_All (); @@ -531,7 +531,7 @@ int CollectionClass::Add_Sub_Object(RenderObjClass * subobj) *=============================================================================================*/ int CollectionClass::Remove_Sub_Object(RenderObjClass * robj) { - if (robj == NULL) return 0; + if (robj == nullptr) return 0; int res = 0; @@ -543,7 +543,7 @@ int CollectionClass::Remove_Sub_Object(RenderObjClass * robj) if (Is_In_Scene()) { SubObjects[i]->Notify_Removed(Scene); } - SubObjects[i]->Set_Container(NULL); + SubObjects[i]->Set_Container(nullptr); SubObjects[i]->Set_Transform(tm); SubObjects[i]->Release_Ref(); res = SubObjects.Delete(i); @@ -744,7 +744,7 @@ int CollectionClass::Snap_Point_Count(void) *=============================================================================================*/ void CollectionClass::Get_Snap_Point(int index,Vector3 * set) { - WWASSERT(set != NULL); + WWASSERT(set != nullptr); if (SnapPoints) { *set = (*SnapPoints)[index]; } else { @@ -929,7 +929,7 @@ int CollectionClass::Get_Proxy_Count (void) const *=============================================================================================*/ CollectionDefClass::CollectionDefClass(void) { - SnapPoints = NULL; + SnapPoints = nullptr; } @@ -1088,15 +1088,15 @@ PrototypeClass * CollectionLoaderClass::Load_W3D(ChunkLoadClass & cload) { CollectionDefClass * def = W3DNEW CollectionDefClass; - if (def == NULL) { - return NULL; + if (def == nullptr) { + return nullptr; } if (def->Load(cload) != WW3D_ERROR_OK) { // load failed, delete the model and return an error delete def; - return NULL; + return nullptr; } else { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/coltest.h b/Core/Libraries/Source/WWVegas/WW3D2/coltest.h index 0601a819470..5d86e248b33 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/coltest.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/coltest.h @@ -98,7 +98,7 @@ class CollisionTestClass inline CollisionTestClass::CollisionTestClass(CastResultStruct * res,int collision_type) : Result(res), CollisionType(collision_type), - CollidedRenderObj(NULL) + CollidedRenderObj(nullptr) { } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/composite.cpp b/Core/Libraries/Source/WWVegas/WW3D2/composite.cpp index 5924b3d8151..76fd7d37f1e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/composite.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/composite.cpp @@ -206,10 +206,10 @@ void CompositeRenderObjClass::Set_Name(const char * name) *=============================================================================================*/ void CompositeRenderObjClass::Set_Base_Model_Name(const char *name) { - // NULL is a legal value for BaseModelName. Unfortunately, + // null is a legal value for BaseModelName. Unfortunately, // StringClass::operator= does not modify the string when - // assigning NULL, so we explicitly handle that case here. - if (name != 0) { + // assigning null, so we explicitly handle that case here. + if (name != nullptr) { BaseModelName = name; } else { BaseModelName = ""; @@ -479,7 +479,7 @@ void CompositeRenderObjClass::Delete_Decal(uint32 decal_id) void CompositeRenderObjClass::Update_Obj_Space_Bounding_Volumes(void) { int i; - RenderObjClass * robj = NULL; + RenderObjClass * robj = nullptr; // if we don't have any sub objects, just set default bounds if (Get_Num_Sub_Objects() <= 0) { @@ -553,7 +553,7 @@ void CompositeRenderObjClass::Set_User_Data(void *value, bool recursive) const char * CompositeRenderObjClass::Get_Base_Model_Name (void) const { if (BaseModelName.Is_Empty()) { - return NULL; + return nullptr; } return BaseModelName; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp index 6ea694d29d9..04a1835731c 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp @@ -174,12 +174,12 @@ DecalGeneratorClass::DecalGeneratorClass(uint32 id,DecalSystemClass * system) : System(system), BackfaceVal(0.0f), ApplyToTranslucentMeshes(false), - Material(NULL) + Material(nullptr) { Material = NEW_REF(MaterialPassClass,()); - WWASSERT(System != NULL); - WWASSERT(Material != NULL); + WWASSERT(System != nullptr); + WWASSERT(Material != nullptr); } @@ -277,7 +277,7 @@ void DecalGeneratorClass::Set_Mesh_Transform(const Matrix3D & mesh_transform) if (WW3D::Is_Texturing_Enabled()) { float texsize = 64.0f; TextureClass * tex = Material->Peek_Texture(); - WWASSERT(tex != NULL); + WWASSERT(tex != nullptr); if (tex) { // SurfaceClass::SurfaceDescription surface_desc; // tex->Get_Level_Description(surface_desc); @@ -295,7 +295,7 @@ void DecalGeneratorClass::Set_Mesh_Transform(const Matrix3D & mesh_transform) */ MultiFixedPoolDecalSystemClass::MultiFixedPoolDecalSystemClass(uint32 num_pools, const uint32 *pool_sizes) : - Pools(0), + Pools(nullptr), PoolCount(num_pools), Generator_PoolID(0), Generator_SlotID(0) @@ -312,7 +312,7 @@ MultiFixedPoolDecalSystemClass::MultiFixedPoolDecalSystemClass(uint32 num_pools, } MultiFixedPoolDecalSystemClass::MultiFixedPoolDecalSystemClass(const MultiFixedPoolDecalSystemClass & that) : - Pools(0), + Pools(nullptr), PoolCount(that.PoolCount), Generator_PoolID(that.Generator_PoolID), Generator_SlotID(that.Generator_SlotID) @@ -330,7 +330,7 @@ MultiFixedPoolDecalSystemClass::MultiFixedPoolDecalSystemClass(const MultiFixedP MultiFixedPoolDecalSystemClass::~MultiFixedPoolDecalSystemClass(void) { delete [] Pools; - Pools = NULL; + Pools = nullptr; } // This clears the slot in addition to locking the generator, thus preventing any decal id @@ -461,7 +461,7 @@ void MultiFixedPoolDecalSystemClass::LogicalDecalClass::Clear(uint32 decal_id) */ MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::LogicalDecalPoolClass(void) : - Array(NULL), + Array(nullptr), Size(0) { } @@ -469,13 +469,13 @@ MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::LogicalDecalPoolClass(voi MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::~LogicalDecalPoolClass(void) { delete [] Array; - Array = NULL; + Array = nullptr; } void MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::Initialize(uint32 size) { delete [] Array; - Array = NULL; + Array = nullptr; Size = size; assert(Size); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h index 6d7cbc1aa6c..f16dde43b15 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h @@ -162,7 +162,7 @@ class DecalGeneratorClass : public ProjectorClass ** Material parameters: just grab a pointer the material pass and modify it. ** Remember to release your ref to it when you are done. */ - MaterialPassClass * Get_Material(void) { WWASSERT(Material != NULL); Material->Add_Ref(); return Material; } + MaterialPassClass * Get_Material(void) { WWASSERT(Material != nullptr); Material->Add_Ref(); return Material; } /* ** Decal generation support. Call Set_Mesh_Transform for the mesh you want to add diff --git a/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp b/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp index d64078d3f8f..c09dc6958a6 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp @@ -104,7 +104,7 @@ RenderObjClass * DistLODPrototypeClass::Create(void) // and destroy the DistLOD so that the models are "containerless". Also // invert the order of the models in the DistLOD char * name = nstrdup(dist->Get_Name()); - WWASSERT(name != NULL); + WWASSERT(name != nullptr); int count = dist->Get_Num_Sub_Objects(); RenderObjClass ** robj = W3DNEWARRAY RenderObjClass * [count]; @@ -112,7 +112,7 @@ RenderObjClass * DistLODPrototypeClass::Create(void) for (; iGet_Sub_Object(i); - WWASSERT(robj[count - 1 - i] != NULL); + WWASSERT(robj[count - 1 - i] != nullptr); } dist->Release_Ref(); @@ -135,16 +135,16 @@ PrototypeClass *DistLODLoaderClass::Load_W3D( ChunkLoadClass &cload ) { DistLODDefClass * pCDistLODClass = W3DNEW DistLODDefClass; - if (pCDistLODClass == NULL) + if (pCDistLODClass == nullptr) { - return NULL; + return nullptr; } if (pCDistLODClass->Load_W3D(cload) != WW3D_ERROR_OK) { // load failed, delete the model and return an error delete pCDistLODClass; - return NULL; + return nullptr; } else { @@ -169,9 +169,9 @@ PrototypeClass *DistLODLoaderClass::Load_W3D( ChunkLoadClass &cload ) * HISTORY: * *=============================================================================================*/ DistLODDefClass::DistLODDefClass(void) : - Name(NULL), + Name(nullptr), LodCount(0), - Lods(NULL) + Lods(nullptr) { } @@ -193,11 +193,11 @@ DistLODDefClass::DistLODDefClass(void) : * 7/15/98 GTH : Created. * *=============================================================================================*/ DistLODDefClass::DistLODDefClass(const char * name,int lodcount,DistLODNodeDefStruct * modeldefs) : - Name(NULL), + Name(nullptr), LodCount(0), - Lods(NULL) + Lods(nullptr) { - assert(name != NULL); + assert(name != nullptr); Name = nstrdup(name); LodCount = lodcount; @@ -243,14 +243,14 @@ DistLODDefClass::~DistLODDefClass(void) void DistLODDefClass::Free(void) { delete[] Name; - Name = NULL; + Name = nullptr; - if (Lods != NULL) { + if (Lods != nullptr) { for (int i=0; iCreate_Render_Obj(def.Lods[i].Name); - assert(Lods[i].Model != NULL); + assert(Lods[i].Model != nullptr); Lods[i].Model->Set_Container(this); // copy the distances @@ -429,7 +429,7 @@ DistLODClass::DistLODClass(const DistLODClass & that) : for (int i=0; iClone(); - assert(Lods[i].Model != NULL); + assert(Lods[i].Model != nullptr); Lods[i].Model->Set_Container(this); // copy the distances @@ -472,16 +472,16 @@ DistLODClass::~DistLODClass(void) *=============================================================================================*/ void DistLODClass::Free(void) { - if (Lods != NULL) { + if (Lods != nullptr) { for (int i=0; iSet_Container(NULL); + if (Lods[i].Model != nullptr) { + Lods[i].Model->Set_Container(nullptr); Lods[i].Model->Release_Ref(); - Lods[i].Model = NULL; + Lods[i].Model = nullptr; } } delete[] Lods; - Lods = NULL; + Lods = nullptr; } CurLod = 0; LodCount = 0; @@ -584,8 +584,8 @@ RenderObjClass * DistLODClass::Get_Sub_Object(int index) const assert(index >= 0); assert(index < LodCount); - if (Lods[index].Model == NULL) { - return NULL; + if (Lods[index].Model == nullptr) { + return nullptr; } else { Lods[index].Model->Add_Ref(); return Lods[index].Model; @@ -626,7 +626,7 @@ void DistLODClass::Set_Transform(const Matrix3D &m) { RenderObjClass::Set_Transform(m); for (int i=0; iSet_Transform(m); } } @@ -650,7 +650,7 @@ void DistLODClass::Set_Position(const Vector3 &v) { RenderObjClass::Set_Position(v); for (int i=0; iSet_Position(v); } } @@ -671,7 +671,7 @@ void DistLODClass::Set_Position(const Vector3 &v) void DistLODClass::Set_Animation( void ) { for (int i=0; iSet_Animation(); } } @@ -692,7 +692,7 @@ void DistLODClass::Set_Animation( void ) void DistLODClass::Set_Animation( HAnimClass * motion,float frame,int mode) { for (int i=0; iSet_Animation(motion,frame,mode); } } @@ -713,7 +713,7 @@ void DistLODClass::Set_Animation( HAnimClass * motion,float frame,int mode) void DistLODClass::Set_Animation( HAnimClass * motion0,float frame0,HAnimClass * motion1,float frame1,float percentage) { for (int i=0; iSet_Animation(motion0,frame0,motion1,frame1,percentage); } } @@ -734,7 +734,7 @@ void DistLODClass::Set_Animation( HAnimClass * motion0,float frame0,HAnimClass * void DistLODClass::Set_Animation( HAnimComboClass * anim_combo) { for (int i=0; iSet_Animation( anim_combo); } } @@ -866,7 +866,7 @@ const Matrix3D & DistLODClass::Get_Bone_Transform(int boneindex) void DistLODClass::Capture_Bone(int bindex) { for (int i=0; iCapture_Bone(bindex); } } @@ -887,7 +887,7 @@ void DistLODClass::Capture_Bone(int bindex) void DistLODClass::Release_Bone(int bindex) { for (int i=0; iRelease_Bone(bindex); } } @@ -927,7 +927,7 @@ bool DistLODClass::Is_Bone_Captured(int bindex) const void DistLODClass::Control_Bone(int bindex,const Matrix3D & tm,bool world_space_translation) { for (int i=0; iControl_Bone(bindex,tm,world_space_translation); } } @@ -1053,7 +1053,7 @@ void DistLODClass::Get_Snap_Point(int index,Vector3 * set) void DistLODClass::Scale(float scale) { for (int i=0; iScale(scale); } } @@ -1074,7 +1074,7 @@ void DistLODClass::Scale(float scale) void DistLODClass::Scale(float scalex, float scaley, float scalez) { for (int i=0; iScale(scalex,scaley,scalez); } } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/distlod.h b/Core/Libraries/Source/WWVegas/WW3D2/distlod.h index 01e39339b17..9cbcd6b3c72 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/distlod.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/distlod.h @@ -173,7 +173,7 @@ class DistLODLoaderClass : public PrototypeLoaderClass */ struct DistLODNodeDefStruct { - DistLODNodeDefStruct(void) : Name(NULL),ResDownDist(0.0f),ResUpDist(0.0f) {} + DistLODNodeDefStruct(void) : Name(nullptr),ResDownDist(0.0f),ResUpDist(0.0f) {} char * Name; float ResDownDist; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h b/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h index 378fdad9c2e..67d5077e1b2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h @@ -69,7 +69,7 @@ class TextureTrackerClass : public MultiListObjectClass void Release() { - Texture->Set_D3D_Base_Texture(NULL); + Texture->Set_D3D_Base_Texture(nullptr); } TextureBaseClass* Get_Texture() const { return Texture; } @@ -101,7 +101,7 @@ class DX8TextureTrackerClass : public TextureTrackerClass virtual void Recreate() const { - WWASSERT(Texture->Peek_D3D_Base_Texture()==NULL); + WWASSERT(Texture->Peek_D3D_Base_Texture()==nullptr); Texture->Poke_Texture ( DX8Wrapper::_Create_DX8_Texture @@ -138,7 +138,7 @@ class DX8ZTextureTrackerClass : public TextureTrackerClass virtual void Recreate() const { - WWASSERT(Texture->Peek_D3D_Base_Texture()==NULL); + WWASSERT(Texture->Peek_D3D_Base_Texture()==nullptr); Texture->Poke_Texture ( DX8Wrapper::_Create_DX8_ZTexture diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp b/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp index b8bfc7fb6b5..c3a5ef22b3a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp @@ -57,7 +57,7 @@ typedef _com_ptr_t<_com_IIID> I static IFEBrowserEngine2Ptr pBrowser = 0; -HWND DX8WebBrowser::hWnd = 0; +HWND DX8WebBrowser::hWnd = nullptr; bool DX8WebBrowser::Initialize( const char* badpageurl, const char* loadingpageurl, @@ -67,7 +67,7 @@ bool DX8WebBrowser::Initialize( const char* badpageurl, if(pBrowser == 0) { // Initialize COM - CoInitialize(0); + CoInitialize(nullptr); // Create an instance of the browser control HRESULT hr = pBrowser.CreateInstance(__uuidof(FEBrowserEngine2)); @@ -126,7 +126,7 @@ void DX8WebBrowser::Shutdown() // Release the smart pointer. pBrowser = 0; - hWnd = 0; + hWnd = nullptr; // Shut down COM CoUninitialize(); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp index 38d7c9a6787..441827de1c6 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp @@ -53,8 +53,8 @@ DynamicMeshModel::DynamicMeshModel(unsigned int max_polys, unsigned int max_vert MeshGeometryClass(), DynamicMeshPNum(0), DynamicMeshVNum(0), - MatDesc(NULL), - MatInfo(NULL) + MatDesc(nullptr), + MatInfo(nullptr) { MatInfo = NEW_REF(MaterialInfoClass, ()); @@ -69,8 +69,8 @@ DynamicMeshModel::DynamicMeshModel(unsigned int max_polys, unsigned int max_vert MeshGeometryClass(), DynamicMeshPNum(0), DynamicMeshVNum(0), - MatDesc(NULL), - MatInfo(NULL) + MatDesc(nullptr), + MatInfo(nullptr) { MatInfo = mat_info; MatInfo->Add_Ref(); @@ -86,8 +86,8 @@ DynamicMeshModel::DynamicMeshModel(const DynamicMeshModel &src) : MeshGeometryClass(src), DynamicMeshPNum(src.DynamicMeshPNum), DynamicMeshVNum(src.DynamicMeshVNum), - MatDesc(NULL), - MatInfo(NULL) + MatDesc(nullptr), + MatInfo(nullptr) { // Copy the material info structure. MatInfo = NEW_REF(MaterialInfoClass, (*(src.MatInfo))); @@ -105,7 +105,7 @@ DynamicMeshModel::DynamicMeshModel(const DynamicMeshModel &src) : DynamicMeshModel::~DynamicMeshModel(void) { delete MatDesc; - MatDesc = NULL; + MatDesc = nullptr; REF_PTR_RELEASE(MatInfo); } @@ -274,28 +274,28 @@ void DynamicMeshModel::Render(RenderInfoClass & rinfo) bool material_changed = false; bool shader_changed = false; - TextureClass **texture_array0 = NULL; + TextureClass **texture_array0 = nullptr; TexBufferClass * tex_buf = MatDesc->Get_Texture_Array(pass, 0, false); if (tex_buf) { texture_array0 = tex_buf->Get_Array(); } else { - texture_array0 = NULL; + texture_array0 = nullptr; } - TextureClass **texture_array1 = NULL; + TextureClass **texture_array1 = nullptr; TexBufferClass * tex_buf1 = MatDesc->Get_Texture_Array(pass, 1, false); if (tex_buf1) { texture_array1 = tex_buf1->Get_Array(); } else { - texture_array1 = NULL; + texture_array1 = nullptr; } - VertexMaterialClass **material_array = NULL; + VertexMaterialClass **material_array = nullptr; MatBufferClass * mat_buf = MatDesc->Get_Material_Array(pass, false); if (mat_buf) { material_array = mat_buf->Get_Array(); } else { - material_array = NULL; + material_array = nullptr; } ShaderClass *shader_array = MatDesc->Get_Shader_Array(pass, false); @@ -518,7 +518,7 @@ bool DynamicMeshClass::End_Vertex() ** *******************************************************************/ DynamicMeshClass::DynamicMeshClass(int max_poly, int max_vert) : - Model(NULL), + Model(nullptr), PolyCount(0), VertCount(0), TriVertexCount(0), @@ -544,7 +544,7 @@ DynamicMeshClass::DynamicMeshClass(int max_poly, int max_vert) : } DynamicMeshClass::DynamicMeshClass(int max_poly, int max_vert, MaterialInfoClass *mat_info) : - Model(NULL), + Model(nullptr), PolyCount(0), VertCount(0), TriVertexCount(0), @@ -571,7 +571,7 @@ DynamicMeshClass::DynamicMeshClass(int max_poly, int max_vert, MaterialInfoClass DynamicMeshClass::DynamicMeshClass(const DynamicMeshClass & src) : RenderObjClass(src), - Model(NULL), + Model(nullptr), PolyCount(src.PolyCount), VertCount(src.VertCount), TriVertexCount(src.TriVertexCount), diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h index 814c3aec385..5282531f922 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h @@ -90,8 +90,8 @@ class DynamicMeshModel : public MeshGeometryClass int Get_Pass_Count(void) const { return MatDesc->Get_Pass_Count(); } // Create the array (if it doesn't exist), fill it with the supplied value. - void Initialize_Texture_Array(int pass, int stage, TextureClass *texture = NULL); - void Initialize_Material_Array(int pass, VertexMaterialClass *vmat = NULL); + void Initialize_Texture_Array(int pass, int stage, TextureClass *texture = nullptr); + void Initialize_Material_Array(int pass, VertexMaterialClass *vmat = nullptr); // Accessors to material info: MaterialInfoClass *Peek_Material_Info(void) { return MatInfo; } @@ -456,7 +456,7 @@ inline TriIndex * DynamicMeshModel::Get_Non_Const_Polygon_Array(void) inline void DynamicMeshClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const { if (!Bounding_Volumes_Valid()) { - Model->Compute_Bounds(NULL); + Model->Compute_Bounds(nullptr); } Model->Get_Bounding_Sphere(&sphere); } @@ -464,7 +464,7 @@ inline void DynamicMeshClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere inline void DynamicMeshClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const { if (!Bounding_Volumes_Valid()) { - Model->Compute_Bounds(NULL); + Model->Compute_Bounds(nullptr); } Model->Get_Bounding_Box(&box); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp b/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp index cc78b9ba331..10524e509e6 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/font3d.cpp @@ -57,7 +57,7 @@ static SurfaceClass *_surface; ***********************************************************************************************/ Font3DDataClass::Font3DDataClass( const char *filename ) { - Texture = NULL; + Texture = nullptr; Load_Font_Image( filename); Name = strdup( filename); Name = strupr( Name); @@ -72,7 +72,7 @@ Font3DDataClass::Font3DDataClass( const char *filename ) Font3DDataClass::~Font3DDataClass(void) { free(Name); - Name = NULL; + Name = nullptr; REF_PTR_RELEASE(Texture); } @@ -232,7 +232,7 @@ SurfaceClass *Font3DDataClass::Make_Proportional( SurfaceClass *surface ) // now shink the image given the minimum char sizes // surface = Minimize_Font_Image( surface ); Minimize_Font_Image( _surface ); - return NULL; + return nullptr; } /*********************************************************************************************** @@ -302,7 +302,7 @@ bool Font3DDataClass::Load_Font_Image( const char *filename ) // convert the just created mon-spaced font to proportional (optional) // surface = Make_Proportional( surface ); _surface = surface; - surface = NULL; + surface = nullptr; Minimize_Font_Image( _surface ); } else { @@ -328,7 +328,7 @@ bool Font3DDataClass::Load_Font_Image( const char *filename ) // convert the just created mon-spaced font to proportional (optional) _surface = surface; - surface = NULL; + surface = nullptr; Make_Proportional( _surface ); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp index 479b6d764af..7e4f41e5981 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp @@ -62,7 +62,7 @@ NamedPivotMapClass::~NamedPivotMapClass(void) NamedPivotMapClass::WeightInfoStruct & NamedPivotMapClass::WeightInfoStruct::operator = (WeightInfoStruct const &that) { delete [] Name; - assert(that.Name != NULL); + assert(that.Name != nullptr); Name = nstrdup(that.Name); Weight = that.Weight; return *this; @@ -75,7 +75,7 @@ void NamedPivotMapClass::Add(const char *Name, float Weight) info.Name = (char *) Name; info.Weight = Weight; WeightInfo.Add(info); - info.Name = 0; + info.Name = nullptr; } // configure the base pivot map using the specified tree @@ -109,7 +109,7 @@ void NamedPivotMapClass::Update_Pivot_Map(const HTreeClass *Tree) DEFINE_AUTO_POOL(HAnimComboDataClass,256); HAnimComboDataClass::HAnimComboDataClass(bool shared) -: Shared(shared), HAnim(0), PivotMap(0), Frame(0), PrevFrame(0), Weight(1) +: Shared(shared), HAnim(nullptr), PivotMap(nullptr), Frame(0), PrevFrame(0), Weight(1) {} @@ -132,8 +132,8 @@ void HAnimComboDataClass::Copy(const HAnimComboDataClass *src) PrevFrame = src->Get_Prev_Frame(); Weight = src->Get_Weight(); } else { - HAnim = 0; - PivotMap = 0; + HAnim = nullptr; + PivotMap = nullptr; Frame = 0; PrevFrame = 0; Weight = 1; @@ -150,30 +150,30 @@ HAnimComboDataClass::~HAnimComboDataClass(void) void HAnimComboDataClass::Clear(void) { - if ( HAnim != NULL ) { + if ( HAnim != nullptr ) { HAnim->Release_Ref(); - HAnim = NULL; + HAnim = nullptr; } // not sure if the pivot map should be deleted or just have everything set to one. // removing it effectively sets it to one, so that's what I'm doing for now. if(PivotMap) { PivotMap->Release_Ref(); - PivotMap = NULL; + PivotMap = nullptr; } Frame = 0.0f; PrevFrame = 0.0f; Weight = 1.0; - PivotMap = NULL; + PivotMap = nullptr; } void HAnimComboDataClass::Set_HAnim(HAnimClass *motion) { - if ( motion != NULL ) { + if ( motion != nullptr ) { motion->Add_Ref(); } - if ( HAnim != NULL ) { + if ( HAnim != nullptr ) { HAnim->Release_Ref(); } HAnim = motion; @@ -182,10 +182,10 @@ void HAnimComboDataClass::Set_HAnim(HAnimClass *motion) void HAnimComboDataClass::Set_Pivot_Map(PivotMapClass *map) { - if ( map != NULL ) { + if ( map != nullptr ) { map->Add_Ref(); } - if ( PivotMap != NULL ) { + if ( PivotMap != nullptr ) { PivotMap->Release_Ref(); } PivotMap = map; @@ -197,11 +197,11 @@ void HAnimComboDataClass::Set_Pivot_Map(PivotMapClass *map) */ void HAnimComboDataClass::Build_Active_Pivot_Map(void) { - if ( PivotMap != NULL ) { + if ( PivotMap != nullptr ) { PivotMap->Release_Ref(); } - if(HAnim == NULL) { - PivotMap = 0; + if(HAnim == nullptr) { + PivotMap = nullptr; return; } @@ -284,7 +284,7 @@ bool HAnimComboClass::Normalize_Weights(void) int num_anim_pivots = 100000; for (anim_idx = 0; anim_idx < anim_count; anim_idx++ ) { num_anim_pivots = MIN(num_anim_pivots, Peek_Motion(anim_idx)->Get_Num_Pivots()); - bool has_pivot_map = Peek_Pivot_Weight_Map(anim_idx) != NULL; + bool has_pivot_map = Peek_Pivot_Weight_Map(anim_idx) != nullptr; all_pivot_maps &= has_pivot_map; none_pivot_maps &= !has_pivot_map; } @@ -297,7 +297,7 @@ bool HAnimComboClass::Normalize_Weights(void) // Calculate total weight of all active anims, ensure it is very close to 1. float weight_total = 0.0f; for (anim_idx = 0; anim_idx < anim_count; anim_idx++ ) { - if (Peek_Motion(anim_idx) != NULL ) { + if (Peek_Motion(anim_idx) != nullptr ) { float weight = Get_Weight(anim_idx); weight_total += weight; } @@ -307,7 +307,7 @@ bool HAnimComboClass::Normalize_Weights(void) if (weight_total != 0.0 && WWMath::Fabs( weight_total - 1.0 ) > WWMATH_EPSILON) { float oo_total = 1.0f / weight_total; for (anim_idx = 0; anim_idx < anim_count; anim_idx++ ) { - if (Peek_Motion(anim_idx) != NULL ) { + if (Peek_Motion(anim_idx) != nullptr ) { Set_Weight(anim_idx, Get_Weight(anim_idx) * oo_total); } } @@ -322,7 +322,7 @@ bool HAnimComboClass::Normalize_Weights(void) float weight_total = 0.0f; for (anim_idx = 0; anim_idx < anim_count; anim_idx++ ) { - if (Peek_Motion(anim_idx) != NULL ) { + if (Peek_Motion(anim_idx) != nullptr ) { float weight = Get_Weight(anim_idx) * (*Peek_Pivot_Weight_Map(anim_idx))[piv_idx]; weight_total += weight; } @@ -332,7 +332,7 @@ bool HAnimComboClass::Normalize_Weights(void) if (weight_total != 0.0 && WWMath::Fabs( weight_total - 1.0 ) > WWMATH_EPSILON) { float oo_total = 1.0f / weight_total; for (anim_idx = 0; anim_idx < anim_count; anim_idx++ ) { - if (Peek_Motion(anim_idx) != NULL ) { + if (Peek_Motion(anim_idx) != nullptr ) { PivotMapClass *pivot_map = Get_Pivot_Weight_Map(anim_idx); float new_weight = (*pivot_map)[piv_idx] * oo_total; (*pivot_map)[piv_idx] = new_weight; @@ -367,7 +367,7 @@ HAnimClass *HAnimComboClass::Get_Motion( int index ) HAnimClass *anim = data->Peek_HAnim(); - if ( anim != NULL ) { + if ( anim != nullptr ) { anim->Add_Ref(); } return anim; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hanim.h b/Core/Libraries/Source/WWVegas/WW3D2/hanim.h index a01069917cc..ddb1a69bc33 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hanim.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/hanim.h @@ -149,7 +149,7 @@ class NamedPivotMapClass : public PivotMapClass // This info is packaged into a struct to minimize DynamicVectorClass overhead struct WeightInfoStruct { - WeightInfoStruct() : Name(NULL) {} + WeightInfoStruct() : Name(nullptr) {} ~WeightInfoStruct() { delete [] Name; } char *Name; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp index 6813ca07851..7e69ad6bc2e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -108,12 +108,12 @@ struct NodeCompressedMotionStruct * HISTORY: * *=============================================================================================*/ NodeCompressedMotionStruct::NodeCompressedMotionStruct() : - Vis(NULL) + Vis(nullptr) { - vd.X = NULL; - vd.Y = NULL; - vd.Z = NULL; - vd.Q = NULL; + vd.X = nullptr; + vd.Y = nullptr; + vd.Z = nullptr; + vd.Q = nullptr; } @@ -174,7 +174,7 @@ HCompressedAnimClass::HCompressedAnimClass(void) : NumNodes(0), Flavor(0), FrameRate(0), - NodeMotion(NULL) + NodeMotion(nullptr) { memset(Name,0,W3D_NAME_LEN); memset(HierarchyName,0,W3D_NAME_LEN); @@ -214,7 +214,7 @@ HCompressedAnimClass::~HCompressedAnimClass(void) void HCompressedAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -261,14 +261,14 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) strlcat(Name, aheader.Name, ARRAY_SIZE(Name)); // TSS chasing crash bug 05/26/99 - WWASSERT(HierarchyName != NULL); - WWASSERT(aheader.HierarchyName != NULL); + WWASSERT(HierarchyName != nullptr); + WWASSERT(aheader.HierarchyName != nullptr); WWASSERT(sizeof(HierarchyName) >= W3D_NAME_LEN); static_assert(ARRAY_SIZE(HierarchyName) >= ARRAY_SIZE(aheader.HierarchyName), "Incorrect array size"); strcpy(HierarchyName, aheader.HierarchyName); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - if (base_pose == NULL) { + if (base_pose == nullptr) { goto Error; } NumNodes = base_pose->Num_Pivots(); @@ -281,7 +281,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) WWASSERT((Flavor == ANIM_FLAVOR_TIMECODED)||(Flavor == ANIM_FLAVOR_ADAPTIVE_DELTA)); NodeMotion = W3DNEWARRAY NodeCompressedMotionStruct[ NumNodes ]; - if (NodeMotion == NULL) { + if (NodeMotion == nullptr) { goto Error; } @@ -640,7 +640,7 @@ void HCompressedAnimClass::Get_Transform( Matrix3D& mtx, int pividx, float frame bool HCompressedAnimClass::Get_Visibility(int pividx,float frame) { - if (NodeMotion[pividx].Vis != NULL) { + if (NodeMotion[pividx].Vis != nullptr) { return (NodeMotion[pividx].Vis->Get_Bit((int)frame) == 1); } @@ -667,11 +667,11 @@ bool HCompressedAnimClass::Is_Node_Motion_Present(int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - if (NodeMotion[pividx].vd.X != NULL) return true; - if (NodeMotion[pividx].vd.Y != NULL) return true; - if (NodeMotion[pividx].vd.Z != NULL) return true; - if (NodeMotion[pividx].vd.Q != NULL) return true; - if (NodeMotion[pividx].Vis != NULL) return true; + if (NodeMotion[pividx].vd.X != nullptr) return true; + if (NodeMotion[pividx].vd.Y != nullptr) return true; + if (NodeMotion[pividx].vd.Z != nullptr) return true; + if (NodeMotion[pividx].vd.Q != nullptr) return true; + if (NodeMotion[pividx].Vis != nullptr) return true; return false; } @@ -679,31 +679,31 @@ bool HCompressedAnimClass::Is_Node_Motion_Present(int pividx) bool HCompressedAnimClass::Has_X_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].vd.X != NULL; + return NodeMotion[pividx].vd.X != nullptr; } bool HCompressedAnimClass::Has_Y_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].vd.Y != NULL; + return NodeMotion[pividx].vd.Y != nullptr; } bool HCompressedAnimClass::Has_Z_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].vd.Z != NULL; + return NodeMotion[pividx].vd.Z != nullptr; } bool HCompressedAnimClass::Has_Rotation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].vd.Q != NULL; + return NodeMotion[pividx].vd.Q != nullptr; } bool HCompressedAnimClass::Has_Visibility (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Vis != NULL; + return NodeMotion[pividx].Vis != nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp index 0a344c8e123..3d437456e19 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp @@ -57,8 +57,8 @@ *=============================================================================================*/ HModelDefClass::HModelDefClass(void) : SubObjectCount(0), - SubObjects(NULL), - SnapPoints(NULL) + SubObjects(nullptr), + SnapPoints(nullptr) { } @@ -95,12 +95,12 @@ HModelDefClass::~HModelDefClass(void) void HModelDefClass::Free(void) { delete[] SubObjects; - SubObjects = NULL; + SubObjects = nullptr; SubObjectCount = 0; - if (SnapPoints != NULL) { + if (SnapPoints != nullptr) { SnapPoints->Release_Ref(); - SnapPoints = NULL; + SnapPoints = nullptr; } } @@ -160,7 +160,7 @@ int HModelDefClass::Load_W3D(ChunkLoadClass & cload) */ SubObjectCount = header.NumConnections; SubObjects = W3DNEWARRAY HmdlNodeDefStruct[SubObjectCount]; - if (SubObjects == NULL) { + if (SubObjects == nullptr) { goto Error; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp index 63bc8f9acd3..231d50ea97a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp @@ -77,7 +77,7 @@ *=============================================================================================*/ HTreeClass::HTreeClass(void) : NumPivots(0), - Pivot(NULL), + Pivot(nullptr), ScaleFactor(1.0f) { } @@ -90,7 +90,7 @@ void HTreeClass::Init_Default(void) Pivot = MSGW3DNEWARRAY("HTreeClass::Pivot") PivotClass[NumPivots]; Pivot[0].Index = 0; - Pivot[0].Parent = NULL; + Pivot[0].Parent = nullptr; Pivot[0].BaseTransform.Make_Identity(); Pivot[0].Transform.Make_Identity(); Pivot[0].IsVisible = true; @@ -138,7 +138,7 @@ HTreeClass::~HTreeClass(void) *=============================================================================================*/ HTreeClass::HTreeClass(const HTreeClass & src) : NumPivots(0), - Pivot(NULL), + Pivot(nullptr), ScaleFactor(1.0f) { memcpy(&Name,&src.Name,sizeof(Name)); @@ -151,10 +151,10 @@ HTreeClass::HTreeClass(const HTreeClass & src) : for (int pi = 0; pi < NumPivots; pi++) { Pivot[pi] = src.Pivot[pi]; - if (src.Pivot[pi].Parent != NULL) { + if (src.Pivot[pi].Parent != nullptr) { Pivot[pi].Parent = &(Pivot[src.Pivot[pi].Parent->Index]); } else { - Pivot[pi].Parent = NULL; + Pivot[pi].Parent = nullptr; } } @@ -269,7 +269,7 @@ bool HTreeClass::read_pivots(ChunkLoadClass & cload,bool pre30) */ if (pre30) { Pivot[0].Index = 0; - Pivot[0].Parent = NULL; + Pivot[0].Parent = nullptr; Pivot[0].BaseTransform.Make_Identity(); Pivot[0].Transform.Make_Identity(); Pivot[0].IsVisible = true; @@ -325,10 +325,10 @@ bool HTreeClass::read_pivots(ChunkLoadClass & cload,bool pre30) /* ** Set the parent pointer. The first pivot will have a parent index - ** of -1 (in post-3.0 files) so set its parent to NULL. + ** of -1 (in post-3.0 files) so set its parent to nullptr. */ if (piv.ParentIdx == -1) { - Pivot[pidx].Parent = NULL; + Pivot[pidx].Parent = nullptr; assert(pidx == 0); } else { Pivot[pidx].Parent = &(Pivot[piv.ParentIdx]); @@ -358,7 +358,7 @@ bool HTreeClass::read_pivots(ChunkLoadClass & cload,bool pre30) void HTreeClass::Free(void) { delete[] Pivot; - Pivot = NULL; + Pivot = nullptr; NumPivots = 0; // Also clean up other members: @@ -390,8 +390,8 @@ bool HTreeClass::Simple_Evaluate_Pivot bool retval = false; end_tm->Make_Identity (); - if ( motion != NULL && - end_tm != NULL && + if ( motion != nullptr && + end_tm != nullptr && pivot_index >= 0 && pivot_index < NumPivots) { @@ -400,7 +400,7 @@ bool HTreeClass::Simple_Evaluate_Pivot // attached to and transform each. // for ( PivotClass *pivot = &Pivot[pivot_index]; - pivot != NULL && pivot->Parent != NULL; + pivot != nullptr && pivot->Parent != nullptr; pivot = pivot->Parent) { // @@ -474,7 +474,7 @@ bool HTreeClass::Simple_Evaluate_Pivot bool retval = false; end_tm->Make_Identity (); - if ( end_tm != NULL && + if ( end_tm != nullptr && pivot_index >= 0 && pivot_index < NumPivots) { @@ -483,7 +483,7 @@ bool HTreeClass::Simple_Evaluate_Pivot // attached to and transform each. // for ( PivotClass *pivot = &Pivot[pivot_index]; - pivot != NULL && pivot->Parent != NULL; + pivot != nullptr && pivot->Parent != nullptr; pivot = pivot->Parent) { // @@ -537,7 +537,7 @@ void HTreeClass::Base_Update(const Matrix3D & root) pivot = &Pivot[piv_idx]; - assert(pivot->Parent != NULL); + assert(pivot->Parent != nullptr); Matrix3D::Multiply(pivot->Parent->Transform, pivot->BaseTransform, &(pivot->Transform)); pivot->IsVisible = 1; @@ -571,7 +571,7 @@ void HTreeClass::Anim_Update(const Matrix3D & root,HAnimClass * motion,float fra pivot = &Pivot[piv_idx]; // base pose - assert(pivot->Parent != NULL); + assert(pivot->Parent != nullptr); Matrix3D::Multiply(pivot->Parent->Transform, pivot->BaseTransform, &(pivot->Transform)); // Don't update this pivot if the HTree doesn't have animation data for it... @@ -642,7 +642,7 @@ void HTreeClass::Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAni for (int piv_idx=1; pivot < endpivot; pivot++,nodeMotion++) { // base pose - assert(pivot->Parent != NULL); + assert(pivot->Parent != nullptr); Matrix3D::Multiply(pivot->Parent->Transform, pivot->BaseTransform, &(pivot->Transform)); // Don't update this pivot if the HTree doesn't have animation data for it... @@ -653,11 +653,11 @@ void HTreeClass::Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAni trans.Set(0.0f,0.0f,0.0f); Matrix3D *xform=&pivot->Transform; - if (nodeMotion->X != NULL) + if (nodeMotion->X != nullptr) nodeMotion->X->Get_Vector(iframe,&(trans[0])); - if (nodeMotion->Y != NULL) + if (nodeMotion->Y != nullptr) nodeMotion->Y->Get_Vector(iframe,&(trans[1])); - if (nodeMotion->Z != NULL) + if (nodeMotion->Z != nullptr) nodeMotion->Z->Get_Vector(iframe,&(trans[2])); if (ScaleFactor == 1.0f) @@ -665,7 +665,7 @@ void HTreeClass::Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAni else xform->Translate(trans*ScaleFactor); - if (nodeMotion->Q != NULL) + if (nodeMotion->Q != nullptr) { nodeMotion->Q->Get_Vector_As_Quat(iframe, q); #ifdef ALLOW_TEMPORARIES *xform = *xform * ::Build_Matrix3D(q,mtx); @@ -675,7 +675,7 @@ void HTreeClass::Anim_Update_Without_Interpolation(const Matrix3D & root,HRawAni } // visibility - if (nodeMotion->Vis != NULL) + if (nodeMotion->Vis != nullptr) pivot->IsVisible=(nodeMotion->Vis->Get_Bit(iframe) == 1); else pivot->IsVisible=1; @@ -724,7 +724,7 @@ void HTreeClass::Blend_Update pivot = &Pivot[piv_idx]; - assert(pivot->Parent != NULL); + assert(pivot->Parent != nullptr); Matrix3D::Multiply(pivot->Parent->Transform,pivot->BaseTransform,&(pivot->Transform)); if (piv_idx < num_anim_pivots) { @@ -797,7 +797,7 @@ void HTreeClass::Combo_Update for (int piv_idx=1; piv_idx < NumPivots; piv_idx++) { pivot = &Pivot[piv_idx]; - assert(pivot->Parent != NULL); + assert(pivot->Parent != nullptr); Matrix3D::Multiply(pivot->Parent->Transform,pivot->BaseTransform,&(pivot->Transform)); if (piv_idx < num_anim_pivots) { @@ -818,7 +818,7 @@ void HTreeClass::Combo_Update HAnimClass *motion = anim->Get_Motion( anim_num ); - if ( motion != NULL ) { + if ( motion != nullptr ) { float frame_num = anim->Get_Frame( anim_num ); @@ -828,7 +828,7 @@ void HTreeClass::Combo_Update float weight = anim->Get_Weight( anim_num ); - if ( pivot_map != NULL ) { + if ( pivot_map != nullptr ) { weight *= (*pivot_map)[piv_idx]; // GREG - Pivot maps are ref counted so shouldn't we // release the rivot map here? @@ -894,7 +894,7 @@ void HTreeClass::Combo_Update for ( anim_num = 0; (anim_num < anim->Get_Num_Anims()) && (!pivot->IsVisible); anim_num++ ) { HAnimClass *motion = anim->Get_Motion( anim_num ); - if ( motion != NULL ) { + if ( motion != nullptr ) { float frame_num = anim->Get_Frame( anim_num ); pivot->IsVisible |= motion->Get_Visibility(piv_idx,frame_num); @@ -976,7 +976,7 @@ int HTreeClass::Get_Parent_Index(int boneidx) const assert(boneidx >= 0); assert(boneidx < NumPivots); - if (Pivot[boneidx].Parent != NULL) { + if (Pivot[boneidx].Parent != nullptr) { return Pivot[boneidx].Parent->Index; } else { return 0; @@ -1009,7 +1009,7 @@ void HTreeClass::Capture_Bone(int boneindex) assert(boneindex >= 0); assert(boneindex < NumPivots); #ifdef LAZY_CAP_MTX_ALLOC - if (Pivot[boneindex].CapTransformPtr == NULL) + if (Pivot[boneindex].CapTransformPtr == nullptr) { Pivot[boneindex].CapTransformPtr = MSGW3DNEW("PivotClassCaptureBoneMtx") DynamicMatrix3D; Pivot[boneindex].CapTransformPtr->Mat.Make_Identity(); @@ -1025,7 +1025,7 @@ void HTreeClass::Release_Bone(int boneindex) assert(boneindex < NumPivots); #ifdef LAZY_CAP_MTX_ALLOC delete Pivot[boneindex].CapTransformPtr; - Pivot[boneindex].CapTransformPtr = NULL; + Pivot[boneindex].CapTransformPtr = nullptr; #else Pivot[boneindex].IsCaptured = false; #endif @@ -1045,7 +1045,7 @@ void HTreeClass::Control_Bone(int boneindex,const Matrix3D & relative_tm,bool wo assert(Pivot[boneindex].Is_Captured()); #ifdef LAZY_CAP_MTX_ALLOC - if (Pivot[boneindex].CapTransformPtr == NULL) + if (Pivot[boneindex].CapTransformPtr == nullptr) return; Pivot[boneindex].WorldSpaceTranslation = world_space_translation; Pivot[boneindex].CapTransformPtr->Mat = relative_tm; @@ -1080,7 +1080,7 @@ HTreeClass * HTreeClass::Alter_Avatar_HTree( const HTreeClass *tree, Vector3 &sc // being stretched out on the Y-axis instead of the Z-axis like the rest of the bodies. Hence, the list of pivots // below are ones that I will special case and scale them based on the Z-axis scaling factor instead of the Y-axis // scaling factor. - const char * flip_list[] = { " RIGHTFOREARM", " RIGHTHAND", " LEFTFOREARM", " LEFTHAND", "RIGHTINDEX", "RIGHTFINGERS", "RIGHTTHUMB", "LEFTINDEX", "LEFTFINGERS", "LEFTTHUMB", 0 }; + const char * flip_list[] = { " RIGHTFOREARM", " RIGHTHAND", " LEFTFOREARM", " LEFTHAND", "RIGHTINDEX", "RIGHTFINGERS", "RIGHTTHUMB", "LEFTINDEX", "LEFTFINGERS", "LEFTTHUMB", nullptr }; // Clone the new tree with the tree that is passed in HTreeClass * new_tree = new HTreeClass( *tree ); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp b/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp index 38fe2c904de..1709f956bb0 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/intersec.cpp @@ -60,7 +60,7 @@ bool IntersectionClass::Intersect_Screen_Point_RenderObject(float screen_x, floa bool IntersectionClass::Intersect_RenderObject(RenderObjClass *RObj, IntersectionResultClass *FinalResult) { - if(FinalResult == 0) + if(FinalResult == nullptr) FinalResult = &Result; return RObj->Intersect(this, FinalResult); @@ -347,7 +347,7 @@ RenderObjClass *IntersectionClass::Intersect_Sub_Object(float screenx, float scr if (Intersect_Screen_Point_RenderObject(screenx, screeny, layer, robj, result)) { return robj; } - return NULL; + return nullptr; } // finds the intersection of the nearest object in the array. diff --git a/Core/Libraries/Source/WWVegas/WW3D2/layer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/layer.cpp index 327075303c0..2f4c3e74cf5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/layer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/layer.cpp @@ -63,8 +63,8 @@ * 3/27/98 GTH : Created. * *=============================================================================================*/ LayerClass::LayerClass(void) : - Scene(NULL), - Camera(NULL), + Scene(nullptr), + Camera(nullptr), Clear(false), ClearZ(true), ClearColor(0,0,0) @@ -132,11 +132,11 @@ LayerClass::~LayerClass(void) { if (Scene) { Scene->Release_Ref(); - Scene=0; + Scene=nullptr; } if (Camera) { Camera->Release_Ref(); - Camera=0; + Camera=nullptr; } } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/line3d.cpp b/Core/Libraries/Source/WWVegas/WW3D2/line3d.cpp index d2ba6b4a041..e6ca062703b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/line3d.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/line3d.cpp @@ -268,7 +268,7 @@ void Line3DClass::Render(RenderInfoClass & rinfo) } DX8Wrapper::Set_Shader(Shader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); VertexMaterialClass *vm=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE); DX8Wrapper::Set_Material(vm); REF_PTR_RELEASE(vm); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp index 7a413efd890..bc938a38590 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp @@ -73,7 +73,7 @@ MaterialInfoClass * MaterialInfoClass::Clone(void) const int MaterialInfoClass::Add_Texture(TextureClass * tex) { - WWASSERT(tex != NULL); + WWASSERT(tex != nullptr); tex->Add_Ref(); int index = Textures.Count(); Textures.Add(tex); @@ -133,13 +133,13 @@ void MaterialInfoClass::Free(void) MaterialRemapperClass::MaterialRemapperClass(MaterialInfoClass * src,MaterialInfoClass * dest) : TextureCount(0), - TextureRemaps(NULL), + TextureRemaps(nullptr), VertexMaterialCount(0), - VertexMaterialRemaps(NULL), - LastSrcVmat(NULL), - LastDestVmat(NULL), - LastSrcTex(NULL), - LastDestTex(NULL) + VertexMaterialRemaps(nullptr), + LastSrcVmat(nullptr), + LastDestVmat(nullptr), + LastSrcTex(nullptr), + LastDestTex(nullptr) { WWASSERT(src); WWASSERT(dest); @@ -181,7 +181,7 @@ MaterialRemapperClass::~MaterialRemapperClass(void) TextureClass * MaterialRemapperClass::Remap_Texture(TextureClass * src) { - if (src == NULL) return src; + if (src == nullptr) return src; if (src == LastSrcTex) return LastDestTex; for (int i=0; iAdd_Ref(); } int index = VertexMaterials.Count(); @@ -251,7 +251,7 @@ inline VertexMaterialClass * MaterialInfoClass::Get_Vertex_Material(const char * { int index = Get_Vertex_Material_Index(name); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Vertex_Material(index); } @@ -268,7 +268,7 @@ inline VertexMaterialClass * MaterialInfoClass::Peek_Vertex_Material(const char { int index = Get_Vertex_Material_Index(name); if (index == -1) { - return NULL; + return nullptr; } else { return Peek_Vertex_Material(index); } @@ -308,7 +308,7 @@ inline TextureClass * MaterialInfoClass::Get_Texture(const char * name) { int index = Get_Texture_Index(name); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Texture(index); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp b/Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp index f8cc3e348f4..3146a4152b2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/matpass.cpp @@ -71,12 +71,12 @@ bool MaterialPassClass::EnablePerPolygonCulling = true; *=============================================================================================*/ MaterialPassClass::MaterialPassClass(void) : Shader(0), - Material(NULL), - CullVolume(NULL), + Material(nullptr), + CullVolume(nullptr), EnableOnTranslucentMeshes(true) { for (int i=0; i= MapCount) return 0; + if (id < 0 || id >= MapCount) return nullptr; Textures[id]->Add_Ref(); return Textures[id]; } @@ -284,7 +284,7 @@ void MetalMapManagerClass::Update_Textures(void) MetalParams &cur_params = MetalParameters[i]; // If shinyness > 1, apply it to specular value array - float *specular = 0; + float *specular = nullptr; float temp_specular[METALMAP_SIZE_2]; float shinyness = cur_params.Shininess; if (shinyness > 1.0f) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp b/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp index d2bfe954fa4..e857b831392 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp @@ -29,7 +29,7 @@ static unsigned missing_image_depth=24; extern unsigned int missing_image_palette[]; extern unsigned int missing_image_pixels[]; -static IDirect3DTexture8 * _MissingTexture = NULL; +static IDirect3DTexture8 * _MissingTexture = nullptr; IDirect3DTexture8* MissingTexture::_Get_Missing_Texture() { @@ -40,19 +40,19 @@ IDirect3DTexture8* MissingTexture::_Get_Missing_Texture() IDirect3DSurface8* MissingTexture::_Create_Missing_Surface() { - IDirect3DSurface8 *texture_surface = NULL; + IDirect3DSurface8 *texture_surface = nullptr; DX8_ErrorCode(_MissingTexture->GetSurfaceLevel(0, &texture_surface)); D3DSURFACE_DESC texture_surface_desc; ::ZeroMemory(&texture_surface_desc, sizeof(D3DSURFACE_DESC)); DX8_ErrorCode(texture_surface->GetDesc(&texture_surface_desc)); - IDirect3DSurface8 *surface = NULL; + IDirect3DSurface8 *surface = nullptr; DX8CALL(CreateImageSurface( texture_surface_desc.Width, texture_surface_desc.Height, texture_surface_desc.Format, &surface)); - DX8CALL(CopyRects(texture_surface, NULL, 0, surface, NULL)); + DX8CALL(CopyRects(texture_surface, nullptr, 0, surface, nullptr)); texture_surface->Release(); return surface; } @@ -104,11 +104,11 @@ void MissingTexture::_Init() DX8_ErrorCode(D3DXLoadSurfaceFromSurface( dst, - NULL, // palette - NULL, // rect + nullptr, // palette + nullptr, // rect src, - NULL, // palette - NULL, // rect + nullptr, // palette + nullptr, // rect D3DX_FILTER_BOX, // box is good for 2:1 filtering 0)); @@ -159,7 +159,7 @@ void MissingTexture::_Init() void MissingTexture::_Deinit() { _MissingTexture->Release(); - _MissingTexture=0; + _MissingTexture=nullptr; } static unsigned int missing_image_palette[]={ diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp b/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp index b7f1c700e66..11f53f27c9f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp @@ -55,11 +55,11 @@ * 07/24/1997 GH : Created. * *=============================================================================================*/ PivotClass::PivotClass(void) : - Parent(NULL), + Parent(nullptr), BaseTransform(1), Transform(1), #ifdef LAZY_CAP_MTX_ALLOC - CapTransformPtr(NULL), + CapTransformPtr(nullptr), Index(0), IsVisible(true), WorldSpaceTranslation(false) @@ -80,7 +80,7 @@ PivotClass::PivotClass(const PivotClass& that) : BaseTransform(that.BaseTransform), Transform(that.Transform), #ifdef LAZY_CAP_MTX_ALLOC - CapTransformPtr(NULL), + CapTransformPtr(nullptr), Index(that.Index), IsVisible(that.IsVisible), WorldSpaceTranslation(that.WorldSpaceTranslation) @@ -95,7 +95,7 @@ PivotClass::PivotClass(const PivotClass& that) : { memcpy(Name, that.Name, sizeof(Name)); #ifdef LAZY_CAP_MTX_ALLOC - if (that.CapTransformPtr != NULL) + if (that.CapTransformPtr != nullptr) { CapTransformPtr = MSGW3DNEW("PivotClassCaptureBoneMtx") DynamicMatrix3D; CapTransformPtr->Mat = that.CapTransformPtr->Mat; @@ -112,11 +112,11 @@ PivotClass& PivotClass::operator=(const PivotClass& that) BaseTransform = that.BaseTransform; Transform = that.Transform; #ifdef LAZY_CAP_MTX_ALLOC - CapTransformPtr = NULL; + CapTransformPtr = nullptr; Index = that.Index; IsVisible = that.IsVisible; WorldSpaceTranslation = that.WorldSpaceTranslation; - if (that.CapTransformPtr != NULL) + if (that.CapTransformPtr != nullptr) { CapTransformPtr = MSGW3DNEW("PivotClassCaptureBoneMtx") DynamicMatrix3D; CapTransformPtr->Mat = that.CapTransformPtr->Mat; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pivot.h b/Core/Libraries/Source/WWVegas/WW3D2/pivot.h index f8ab446df9d..bf753574b5b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pivot.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/pivot.h @@ -74,7 +74,7 @@ struct PivotClass bool Is_Captured() const { #ifdef LAZY_CAP_MTX_ALLOC - return CapTransformPtr != NULL; + return CapTransformPtr != nullptr; #else return IsCaptured; #endif diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp index 34efa1c77d9..17a7977c8b3 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp @@ -94,9 +94,9 @@ // static data members Vector3 PointGroupClass::_TriVertexLocationOrientationTable[256][3]; Vector3 PointGroupClass::_QuadVertexLocationOrientationTable[256][4]; -Vector2 *PointGroupClass::_TriVertexUVFrameTable[5] = { NULL, NULL, NULL, NULL, NULL}; -Vector2 *PointGroupClass::_QuadVertexUVFrameTable[5] = { NULL, NULL, NULL, NULL, NULL}; -VertexMaterialClass *PointGroupClass::PointMaterial=NULL; +Vector2 *PointGroupClass::_TriVertexUVFrameTable[5] = { nullptr, nullptr, nullptr, nullptr, nullptr}; +Vector2 *PointGroupClass::_QuadVertexUVFrameTable[5] = { nullptr, nullptr, nullptr, nullptr, nullptr}; +VertexMaterialClass *PointGroupClass::PointMaterial=nullptr; // Static arrays for intermediate calcs (never resized down, just up): VectorClass PointGroupClass::compressed_loc; // point locations 'compressed' by APT @@ -149,15 +149,15 @@ SortingIndexBufferClass *SortingTris, *SortingQuads; // Sorting index buffers. * 11/17/1998 NH : Created. * *========================================================================*/ PointGroupClass::PointGroupClass(void) : - PointLoc(NULL), - PointDiffuse(NULL), - APT(NULL), - PointSize(NULL), - PointOrientation(NULL), - PointFrame(NULL), + PointLoc(nullptr), + PointDiffuse(nullptr), + APT(nullptr), + PointSize(nullptr), + PointOrientation(nullptr), + PointFrame(nullptr), PointCount(0), FrameRowColumnCountLog2(0), - Texture(NULL), + Texture(nullptr), Flags(0), Shader(ShaderClass::_PresetAdditiveSpriteShader), PointMode(TRIS), @@ -189,31 +189,31 @@ PointGroupClass::~PointGroupClass(void) { if (PointLoc) { PointLoc->Release_Ref(); - PointLoc = NULL; + PointLoc = nullptr; } if (PointDiffuse) { PointDiffuse->Release_Ref(); - PointDiffuse=NULL; + PointDiffuse=nullptr; } if (APT) { APT->Release_Ref(); - APT = NULL; + APT = nullptr; } if (PointSize) { PointSize->Release_Ref(); - PointSize = NULL; + PointSize = nullptr; } if (PointOrientation) { PointOrientation->Release_Ref(); - PointOrientation = NULL; + PointOrientation = nullptr; } if (PointFrame) { PointFrame->Release_Ref(); - PointFrame = NULL; + PointFrame = nullptr; } if (Texture) { REF_PTR_RELEASE(Texture); - Texture = NULL; + Texture = nullptr; } } @@ -248,7 +248,7 @@ PointGroupClass & PointGroupClass::operator = (const PointGroupClass & that) * WARNINGS: * * * * NOTES: colors, alphas, APT, sizes, orientations and frames are * - * optional. active_point_count can also be used with a NULL apt.* + * optional. active_point_count can also be used with a nullptr apt.* * In this case active_point_count is ignored if it is -1 * * (default value) and otherwise it indicates the first N active * * points in the arrays. * @@ -626,7 +626,7 @@ TextureClass * PointGroupClass::Peek_Texture(void) * WARNINGS: the primary gradient will be set to MODULATE/DISABLE in * * the shader depending on whether a color or alpha array was * * passed in Set_Point_Arrays. also, texturing will be * - * enabled or disabled dependent on whether a non-NULL * + * enabled or disabled dependent on whether a non-null * * texture was set. * * these will override the primary gradient/texturing * * settings in the given shader. * @@ -788,11 +788,11 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) // if (Texture) Texture->Process_Reduction(); // Pointers which point into existing buffers (member or static): - Vector3 *current_loc = NULL; - Vector4 *current_diffuse = NULL; - float *current_size = NULL; - unsigned char *current_orient = NULL; - unsigned char *current_frame = NULL; + Vector3 *current_loc = nullptr; + Vector4 *current_diffuse = nullptr; + float *current_size = nullptr; + unsigned char *current_orient = nullptr; + unsigned char *current_frame = nullptr; // If there is a color or alpha array enable gradient in shader - otherwise disable. float value_255 = 0.9961f; //254 / 255 @@ -809,7 +809,7 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) Shader.Set_Primary_Gradient(ShaderClass::GRADIENT_DISABLE); } - // If Texture is non-NULL enable texturing in shader - otherwise disable. + // If Texture is non-null enable texturing in shader - otherwise disable. if (Texture) { Shader.Set_Texturing(ShaderClass::TEXTURING_ENABLE); } else { @@ -1041,9 +1041,9 @@ void PointGroupClass::Update_Arrays( if (VertexLoc.Length() < total_vnum) { // Resize arrays (2x guardband to prevent frequent reallocations). - VertexLoc.Resize(total_vnum * 2, NULL); - VertexUV.Resize(total_vnum * 2, NULL); - VertexDiffuse.Resize(total_vnum * 2, NULL); + VertexLoc.Resize(total_vnum * 2, nullptr); + VertexUV.Resize(total_vnum * 2, nullptr); + VertexDiffuse.Resize(total_vnum * 2, nullptr); } int vert, i, j; @@ -1660,11 +1660,11 @@ void PointGroupClass::RenderVolumeParticle(RenderInfoClass &rinfo, unsigned int WWASSERT(PointLoc && PointLoc->Get_Array()); // Pointers which point into existing buffers (member or static): - Vector3 *current_loc = NULL; - Vector4 *current_diffuse = NULL; - float *current_size = NULL; - unsigned char *current_orient = NULL; - unsigned char *current_frame = NULL; + Vector3 *current_loc = nullptr; + Vector4 *current_diffuse = nullptr; + float *current_size = nullptr; + unsigned char *current_orient = nullptr; + unsigned char *current_frame = nullptr; // If there is a color or alpha array enable gradient in shader - otherwise disable. float value_255 = 0.9961f; //254 / 255 @@ -1681,7 +1681,7 @@ void PointGroupClass::RenderVolumeParticle(RenderInfoClass &rinfo, unsigned int Shader.Set_Primary_Gradient(ShaderClass::GRADIENT_DISABLE); } - // If Texture is non-NULL enable texturing in shader - otherwise disable. + // If Texture is non-null enable texturing in shader - otherwise disable. if (Texture) { Shader.Set_Texturing(ShaderClass::TEXTURING_ENABLE); } else { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h index 021c56e5493..e0cce7d05be 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h @@ -78,11 +78,11 @@ class PointGroupClass // PointGroupClass interface: void Set_Arrays(ShareBufferClass *locs, - ShareBufferClass *diffuse = NULL, - ShareBufferClass *apt = NULL, - ShareBufferClass *sizes = NULL, - ShareBufferClass *orientations = NULL, - ShareBufferClass *frames = NULL, + ShareBufferClass *diffuse = nullptr, + ShareBufferClass *apt = nullptr, + ShareBufferClass *sizes = nullptr, + ShareBufferClass *orientations = nullptr, + ShareBufferClass *frames = nullptr, int active_point_count = -1, float vpxmin = 0.0f, float vpymin = 0.0f, float vpxmax = 0.0f, float vpymax = 0.0f); @@ -151,11 +151,11 @@ class PointGroupClass // number of possible frames must be a power of two - for this reason the number of frame rows // and columns, orientations, etc. are represented as the log base 2 of the actual number. ShareBufferClass * PointLoc; // World/cameraspace point locs - ShareBufferClass * PointDiffuse; // (NULL if not used) RGBA values - ShareBufferClass * APT; // (NULL if not used) active point table - ShareBufferClass * PointSize; // (NULL if not used) size override table - ShareBufferClass * PointOrientation; // (NULL if not used) orientation indices - ShareBufferClass * PointFrame; // (NULL if not used) frame indices + ShareBufferClass * PointDiffuse; // (null if not used) RGBA values + ShareBufferClass * APT; // (null if not used) active point table + ShareBufferClass * PointSize; // (null if not used) size override table + ShareBufferClass * PointOrientation; // (null if not used) orientation indices + ShareBufferClass * PointFrame; // (null if not used) frame indices int PointCount; // Active (if APT) or total point count // See comments for Get/Set_Frame_Row_Column_Count_Log2 above diff --git a/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp b/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp index dfe2a899629..d612bed5ab7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/predlod.cpp @@ -57,8 +57,8 @@ class LODHeapNode { public: - LODHeapNode(void) { Item = NULL; } - LODHeapNode (float key) { Item = NULL; Key = key; } + LODHeapNode(void) { Item = nullptr; } + LODHeapNode (float key) { Item = nullptr; Key = key; } LODHeapNode (RenderObjClass * item, float key) { Item = item; Key = key; } ~LODHeapNode(void) { } @@ -173,7 +173,7 @@ class LODHeap { }; // Static PredictiveLODOptimizerClass data members: -RenderObjClass ** PredictiveLODOptimizerClass::ObjectArray = NULL; +RenderObjClass ** PredictiveLODOptimizerClass::ObjectArray = nullptr; int PredictiveLODOptimizerClass::ArraySize = 0; int PredictiveLODOptimizerClass::NumObjects = 0; float PredictiveLODOptimizerClass::TotalCost = 0.0f; @@ -201,7 +201,7 @@ void PredictiveLODOptimizerClass::Clear(void) for (int i = 0; i < NumObjects; i++) { if (ObjectArray[i]) { ObjectArray[i]->Release_Ref(); - ObjectArray[i] = NULL; + ObjectArray[i] = nullptr; } } } @@ -296,8 +296,8 @@ void PredictiveLODOptimizerClass::Optimize_LODs(float max_cost) LODHeap min_current_value_queue(NumObjects, VisibleObjArray1); LODHeap max_post_increment_value_queue(NumObjects, VisibleObjArray2); // These memory areas now are pointed to within the heaps: -// visible_obj_array1 = NULL; -// visible_obj_array2 = NULL; +// visible_obj_array1 = nullptr; +// visible_obj_array2 = nullptr; // Main loop: iteratively increment/decrement tuples. bool done = false; @@ -305,8 +305,8 @@ void PredictiveLODOptimizerClass::Optimize_LODs(float max_cost) while (!done) { // Initialize max_data and min_data so comparison at end of loop uses correct values. - max_data = NULL; - min_data = NULL; + max_data = nullptr; + min_data = nullptr; // Increment incrementable tuple with maximum next value. if (TotalCost <= max_cost) { @@ -382,13 +382,13 @@ void PredictiveLODOptimizerClass::Free(void) Clear(); delete [] ObjectArray; - ObjectArray = NULL; + ObjectArray = nullptr; ArraySize = 0; // Only the array number one has been allocated... delete[] VisibleObjArray1; - VisibleObjArray1=NULL; - VisibleObjArray2=NULL; + VisibleObjArray1=nullptr; + VisibleObjArray2=nullptr; VisibleObjArraySize = 0; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/proto.cpp b/Core/Libraries/Source/WWVegas/WW3D2/proto.cpp index c19af3b2050..d899803ce62 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/proto.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/proto.cpp @@ -121,8 +121,8 @@ PrototypeClass * MeshLoaderClass::Load_W3D(ChunkLoadClass & cload) { MeshClass * mesh = NEW_REF( MeshClass, () ); - if (mesh == NULL) { - return NULL; + if (mesh == nullptr) { + return nullptr; } if (mesh->Load_W3D(cload) != WW3D_ERROR_OK) { @@ -130,7 +130,7 @@ PrototypeClass * MeshLoaderClass::Load_W3D(ChunkLoadClass & cload) // if the load failed, delete the mesh assert(mesh->Num_Refs() == 1); mesh->Release_Ref(); - return NULL; + return nullptr; } else { @@ -159,15 +159,15 @@ PrototypeClass * HModelLoaderClass::Load_W3D(ChunkLoadClass & cload) { HModelDefClass * hdef = W3DNEW HModelDefClass; - if (hdef == NULL) { - return NULL; + if (hdef == nullptr) { + return nullptr; } if (hdef->Load_W3D(cload) != HModelDefClass::OK) { // load failed, delete the model and return an error delete hdef; - return NULL; + return nullptr; } else { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/proto.h b/Core/Libraries/Source/WWVegas/WW3D2/proto.h index eb375602e23..d8f91de126c 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/proto.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/proto.h @@ -81,7 +81,7 @@ class PrototypeClass public: - PrototypeClass(void) : NextHash(NULL) {} + PrototypeClass(void) : NextHash(nullptr) {} virtual const char * Get_Name(void) const = 0; virtual int Get_Class_ID(void) const = 0; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h b/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h index 06fcbd4b510..ac305c9512f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h @@ -61,9 +61,9 @@ class RenderDeviceDescClass public: - RenderDeviceDescClass(void) : DeviceName(NULL), DeviceVendor(NULL), DevicePlatform(NULL), - DriverName(NULL), DriverVendor(NULL), DriverVersion(NULL), - HardwareName(NULL), HardwareVendor(NULL), HardwareChipset(NULL) + RenderDeviceDescClass(void) : DeviceName(), DeviceVendor(), DevicePlatform(), + DriverName(), DriverVendor(), DriverVersion(), + HardwareName(), HardwareVendor(), HardwareChipset() { } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp b/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp index e307f2e41f3..3b251ac3156 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp @@ -54,18 +54,18 @@ // //////////////////////////////////////////////////////////////////////////////////// Render2DSentenceClass::Render2DSentenceClass (void) : - Font (NULL), + Font (nullptr), Location (0.0F,0.0F), Cursor (0.0F,0.0F), TextureOffset (0, 0), TextureStartX (0), - CurSurface (NULL), + CurSurface (nullptr), CurrTextureSize (0), MonoSpaced (false), IsClippedEnabled (false), ClipRect (0, 0, 0, 0), BaseLocation (0, 0), - LockedPtr (NULL), + LockedPtr (nullptr), LockedStride (0), TextureSizeHint (0), WrapWidth (0), @@ -133,9 +133,9 @@ Render2DSentenceClass::Reset (void) // // Make sure we unlock the current surface (if necessary) // - if (LockedPtr != NULL) { + if (LockedPtr != nullptr) { CurSurface->Unlock (); - LockedPtr = NULL; + LockedPtr = nullptr; } // @@ -286,7 +286,7 @@ Render2DSentenceClass::Get_Text_Extents (const WCHAR *text) Vector2 Render2DSentenceClass::Get_Formatted_Text_Extents (const WCHAR *text) { - return Build_Sentence_Not_Centered(text, NULL, NULL, true); + return Build_Sentence_Not_Centered(text, nullptr, nullptr, true); } @@ -346,9 +346,9 @@ Render2DSentenceClass::Build_Textures (void) // // Make sure we unlock the current surface // - if (LockedPtr != NULL) { + if (LockedPtr != nullptr) { CurSurface->Unlock (); - LockedPtr = NULL; + LockedPtr = nullptr; } // @@ -386,7 +386,7 @@ Render2DSentenceClass::Build_Textures (void) // // Copy the contents of the texture from the surface // - DX8Wrapper::_Copy_DX8_Rects (curr_surface->Peek_D3D_Surface (), NULL, 0, texture_surface->Peek_D3D_Surface (), NULL); + DX8Wrapper::_Copy_DX8_Rects (curr_surface->Peek_D3D_Surface (), nullptr, 0, texture_surface->Peek_D3D_Surface (), nullptr); REF_PTR_RELEASE (texture_surface); // @@ -422,8 +422,8 @@ Render2DSentenceClass::Build_Textures (void) void Render2DSentenceClass::Draw_Sentence (uint32 color) { - Render2DClass *curr_renderer = NULL; - SurfaceClass *curr_surface = NULL; + Render2DClass *curr_renderer = nullptr; + SurfaceClass *curr_surface = nullptr; DrawExtents.Set (0, 0, 0, 0); @@ -631,9 +631,9 @@ Render2DSentenceClass::Allocate_New_Surface (const WCHAR *text, bool justCalcExt // // Unlock the last surface (if necessary) // - if (LockedPtr != NULL) { + if (LockedPtr != nullptr) { CurSurface->Unlock (); - LockedPtr = NULL; + LockedPtr = nullptr; } } @@ -697,7 +697,7 @@ Render2DSentenceClass::Allocate_New_Surface (const WCHAR *text, bool justCalcExt // Create the new surface // CurSurface = NEW_REF (SurfaceClass, (CurrTextureSize, CurrTextureSize, WW3D_FORMAT_A4R4G4B4)); - WWASSERT (CurSurface != NULL); + WWASSERT (CurSurface != nullptr); CurSurface->Add_Ref (); // @@ -743,7 +743,7 @@ void Render2DSentenceClass::Build_Sentence_Centered (const WCHAR *text, int *hkX // // Ensure we have a surface to start with // - if (CurSurface == NULL) { + if (CurSurface == nullptr) { Allocate_New_Surface (text); } @@ -926,9 +926,9 @@ void Render2DSentenceClass::Build_Sentence_Centered (const WCHAR *text, int *hkX // // Ensure the surface is locked // - if (LockedPtr == NULL) { + if (LockedPtr == nullptr) { LockedPtr = (uint16 *)CurSurface->Lock (&LockedStride); - WWASSERT (LockedPtr != NULL); + WWASSERT (LockedPtr != nullptr); } // @@ -998,7 +998,7 @@ Vector2 Render2DSentenceClass::Build_Sentence_Not_Centered (const WCHAR *text, i // // Ensure we have a surface to start with // - if (CurSurface == NULL) { + if (CurSurface == nullptr) { Allocate_New_Surface (text, justCalcExtents); } @@ -1010,7 +1010,7 @@ Vector2 Render2DSentenceClass::Build_Sentence_Not_Centered (const WCHAR *text, i // // Loop over all the characters in the string // - while (text != NULL) { + while (text != nullptr) { WCHAR ch = *text++; dontBlit = false; // @@ -1116,9 +1116,9 @@ Vector2 Render2DSentenceClass::Build_Sentence_Not_Centered (const WCHAR *text, i // if (!justCalcExtents) { - if (LockedPtr == NULL) { + if (LockedPtr == nullptr) { LockedPtr = (uint16 *)CurSurface->Lock (&LockedStride); - WWASSERT (LockedPtr != NULL); + WWASSERT (LockedPtr != nullptr); } } @@ -1163,11 +1163,11 @@ Vector2 Render2DSentenceClass::Build_Sentence_Not_Centered (const WCHAR *text, i void Render2DSentenceClass::Build_Sentence (const WCHAR *text, int *hkX, int *hkY) { - if (text == NULL) { + if (text == nullptr) { return ; } - if (Font == NULL) + if (Font == nullptr) return; if(Centered && (WrapWidth > 0 || wcschr(text,L'\n'))) @@ -1186,21 +1186,21 @@ Render2DSentenceClass::Build_Sentence (const WCHAR *text, int *hkX, int *hkY) // //////////////////////////////////////////////////////////////////////////////////// FontCharsClass::FontCharsClass (void) : - OldGDIFont( NULL ), - OldGDIBitmap( NULL ), - GDIFont( NULL ), - GDIBitmap( NULL ), - GDIBitmapBits ( NULL ), - MemDC( NULL ), + OldGDIFont( nullptr ), + OldGDIBitmap( nullptr ), + GDIFont( nullptr ), + GDIBitmap( nullptr ), + GDIBitmapBits ( nullptr ), + MemDC( nullptr ), CurrPixelOffset( 0 ), PointSize( 0 ), CharHeight( 0 ), - UnicodeCharArray( NULL ), + UnicodeCharArray( nullptr ), FirstUnicodeChar( 0xFFFF ), LastUnicodeChar( 0 ), IsBold (false) { - AlternateUnicodeFont = NULL; + AlternateUnicodeFont = nullptr; ::memset( ASCIICharArray, 0, sizeof (ASCIICharArray) ); return ; } @@ -1232,7 +1232,7 @@ FontCharsClass::~FontCharsClass (void) const FontCharsClassCharDataStruct * FontCharsClass::Get_Char_Data (WCHAR ch) { - const FontCharsClassCharDataStruct *retval = NULL; + const FontCharsClassCharDataStruct *retval = nullptr; if ( ch < 256 ) { @@ -1251,7 +1251,7 @@ FontCharsClass::Get_Char_Data (WCHAR ch) // // If the character wasn't found, then add it to our list // - if ( retval == NULL ) { + if ( retval == nullptr ) { retval = Store_GDI_Char( ch ); } @@ -1269,7 +1269,7 @@ int FontCharsClass::Get_Char_Width (WCHAR ch) { const FontCharsClassCharDataStruct * data = Get_Char_Data( ch ); - if ( data != NULL ) { + if ( data != nullptr ) { return data->Width; } @@ -1286,7 +1286,7 @@ int FontCharsClass::Get_Char_Spacing (WCHAR ch) { const FontCharsClassCharDataStruct * data = Get_Char_Data( ch ); - if ( data != NULL ) { + if ( data != nullptr ) { if ( data->Width != 0 ) { return data->Width - PixelOverlap - CharOverhang; } @@ -1305,7 +1305,7 @@ void FontCharsClass::Blit_Char (WCHAR ch, uint16 *dest_ptr, int dest_stride, int x, int y) { const FontCharsClassCharDataStruct * data = Get_Char_Data( ch ); - if ( data != NULL && data->Width != 0 ) { + if ( data != nullptr && data->Width != 0 ) { // // Setup the src and destination pointers @@ -1353,7 +1353,7 @@ FontCharsClass::Store_GDI_Char (WCHAR ch) if (ch == 'W') { xOrigin = 1; } - ::ExtTextOutW( MemDC, xOrigin, 0, ETO_OPAQUE, &rect, &ch, 1, NULL); + ::ExtTextOutW( MemDC, xOrigin, 0, ETO_OPAQUE, &rect, &ch, 1, nullptr); // // Get the size of the character we just drew @@ -1565,7 +1565,7 @@ FontCharsClass::Create_GDI_Font (const char *font_name) (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)&GDIBitmapBits, - NULL, + nullptr, 0L); // @@ -1598,7 +1598,7 @@ FontCharsClass::Create_GDI_Font (const char *font_name) CharOverhang = 0; } - return GDIFont != NULL && GDIBitmap != NULL; + return GDIFont != nullptr && GDIBitmap != nullptr; } @@ -1614,28 +1614,28 @@ FontCharsClass::Free_GDI_Font (void) // Select the old font back into the DC and delete // our font object // - if ( GDIFont != NULL ) { + if ( GDIFont != nullptr ) { ::SelectObject( MemDC, OldGDIFont ); ::DeleteObject( GDIFont ); - GDIFont = NULL; + GDIFont = nullptr; } // // Select the old bitmap back into the DC and delete // our bitmap object // - if ( GDIBitmap != NULL ) { + if ( GDIBitmap != nullptr ) { ::SelectObject( MemDC, OldGDIBitmap ); ::DeleteObject( GDIBitmap ); - GDIBitmap = NULL; + GDIBitmap = nullptr; } // // Delete our memory DC // - if ( MemDC != NULL ) { + if ( MemDC != nullptr ) { ::DeleteDC( MemDC ); - MemDC = NULL; + MemDC = nullptr; } return ; @@ -1728,7 +1728,7 @@ FontCharsClass::Grow_Unicode_Array (WCHAR ch) // // Copy the contents of the old array into the new array // - if ( UnicodeCharArray != NULL ) { + if ( UnicodeCharArray != nullptr ) { int start_offset = (FirstUnicodeChar - first_index); int old_count = (LastUnicodeChar - FirstUnicodeChar) + 1; ::memcpy (&new_array[start_offset], UnicodeCharArray, sizeof (FontCharsClassCharDataStruct *) * old_count); @@ -1737,7 +1737,7 @@ FontCharsClass::Grow_Unicode_Array (WCHAR ch) // Delete the old array // delete [] UnicodeCharArray; - UnicodeCharArray = NULL; + UnicodeCharArray = nullptr; } FirstUnicodeChar = first_index; @@ -1755,7 +1755,7 @@ FontCharsClass::Grow_Unicode_Array (WCHAR ch) void FontCharsClass::Free_Character_Arrays (void) { - if ( UnicodeCharArray != NULL ) { + if ( UnicodeCharArray != nullptr ) { int count = (LastUnicodeChar - FirstUnicodeChar) + 1; @@ -1764,14 +1764,14 @@ FontCharsClass::Free_Character_Arrays (void) // for (int index = 0; index < count; index ++) { delete UnicodeCharArray[index]; - UnicodeCharArray[index] = NULL; + UnicodeCharArray[index] = nullptr; } // // Delete the array itself // delete [] UnicodeCharArray; - UnicodeCharArray = NULL; + UnicodeCharArray = nullptr; } // @@ -1779,7 +1779,7 @@ FontCharsClass::Free_Character_Arrays (void) // for (int index = 0; index < 256; index ++) { delete ASCIICharArray[index]; - ASCIICharArray[index] = NULL; + ASCIICharArray[index] = nullptr; } return ; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp b/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp index f6d787fc139..f4eff41a166 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp @@ -82,7 +82,7 @@ RenderObjClass * RenderObjectRecyclerClass::Get_Render_Object(const char * name, { RefRenderObjListIterator it(&InactiveModels); - RenderObjClass * found = NULL; + RenderObjClass * found = nullptr; while (!it.Is_Done()) { if (stricmp(it.Peek_Obj()->Get_Name(),name) == 0) { found = it.Peek_Obj(); @@ -91,7 +91,7 @@ RenderObjClass * RenderObjectRecyclerClass::Get_Render_Object(const char * name, it.Next(); } - if (found != NULL) { + if (found != nullptr) { found->Add_Ref(); InactiveModels.Remove(found); found->Set_Transform(tm); @@ -101,13 +101,13 @@ RenderObjClass * RenderObjectRecyclerClass::Get_Render_Object(const char * name, } else { RenderObjClass * new_model = WW3DAssetManager::Get_Instance()->Create_Render_Obj(name); - if (new_model != NULL) { + if (new_model != nullptr) { new_model->Set_Transform(tm); return new_model; } } - return NULL; + return nullptr; } @@ -143,7 +143,7 @@ void RenderObjectRecyclerClass::Return_Render_Object(RenderObjClass * obj) *=============================================================================================*/ void RenderObjectRecyclerClass::Insert_Inactive_Model(RenderObjClass * obj) { - WWASSERT(obj != NULL); + WWASSERT(obj != nullptr); InactiveModels.Add(obj); } @@ -181,7 +181,7 @@ void RenderObjectRecyclerClass::Reset_Model(RenderObjClass * model) /* ** animated models must have their animation reset (if present) */ - if (model->Peek_Animation() != NULL) { + if (model->Peek_Animation() != nullptr) { model->Set_Animation(model->Peek_Animation(),0.0f,RenderObjClass::ANIM_MODE_ONCE); } } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp index b5d0671fc17..55b052fa54a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp @@ -103,7 +103,7 @@ StringClass Filename_From_Asset_Name (const char *asset_name) { StringClass filename; - if (asset_name != NULL) { + if (asset_name != nullptr) { // // Copy the model name into a new filename buffer @@ -114,7 +114,7 @@ Filename_From_Asset_Name (const char *asset_name) // Do we need to strip off the model's suffix? // char *suffix = ::strchr (filename.Peek_Buffer(), '.'); - if (suffix != NULL) { + if (suffix != nullptr) { suffix[0] = 0; } @@ -165,10 +165,10 @@ RenderObjClass::RenderObjClass(void) : Bits(DEFAULT_BITS), Transform(1), NativeScreenSize(WW3D::Get_Default_Native_Screen_Size()), - Scene(NULL), - Container(NULL), - User_Data(NULL), - RenderHook(NULL), + Scene(nullptr), + Container(nullptr), + User_Data(nullptr), + RenderHook(nullptr), ObjectScale(1.0), ObjectColor(0), CachedBoundingSphere(Vector3(0,0,0),1.0f), @@ -194,10 +194,10 @@ RenderObjClass::RenderObjClass(const RenderObjClass & src) : Bits(src.Bits), Transform(src.Transform), NativeScreenSize(src.NativeScreenSize), - Scene(NULL), - Container(NULL), - User_Data(NULL), - RenderHook(NULL), + Scene(nullptr), + Container(nullptr), + User_Data(nullptr), + RenderHook(nullptr), ObjectScale(1.0), ObjectColor(0), CachedBoundingSphere(src.CachedBoundingSphere), @@ -354,7 +354,7 @@ float RenderObjClass::Get_Screen_Size(CameraClass &camera) *=============================================================================================*/ SceneClass * RenderObjClass::Get_Scene(void) { - if (Scene != NULL) { + if (Scene != nullptr) { Scene->Add_Ref(); } return Scene; @@ -377,7 +377,7 @@ void RenderObjClass::Set_Container(RenderObjClass * con) { // Either we arent currently in a container or we are clearing our container, otherwise // Houston, there is a problem! - WWASSERT((con == NULL) || (Container == NULL)); + WWASSERT((con == nullptr) || (Container == nullptr)); Container = con; } @@ -463,11 +463,11 @@ void RenderObjClass::Validate_Transform(void) const */ RenderObjClass * con = Get_Container(); bool dirty = false; - if (con != NULL) + if (con != nullptr) { dirty = con->Are_Sub_Object_Transforms_Dirty(); - while (con->Get_Container() != NULL) + while (con->Get_Container() != nullptr) { dirty |= con->Are_Sub_Object_Transforms_Dirty(); con = con->Get_Container(); @@ -540,7 +540,7 @@ RenderObjClass * RenderObjClass::Get_Sub_Object_By_Name(const char * name, int * RenderObjClass * robj = Get_Sub_Object(i); if (robj) { const char * subobjname = strchr(robj->Get_Name(),'.'); - if (subobjname == NULL) { + if (subobjname == nullptr) { subobjname = robj->Get_Name(); } else { // skip past the period. @@ -556,7 +556,7 @@ RenderObjClass * RenderObjClass::Get_Sub_Object_By_Name(const char * name, int * } } - return NULL; + return nullptr; } @@ -789,7 +789,7 @@ void RenderObjClass::Update_Sub_Object_Transforms(void) void RenderObjClass::Add(SceneClass * scene) { WWASSERT(scene); - WWASSERT(Container == NULL); + WWASSERT(Container == nullptr); Scene = scene; Scene->Add_Render_Object(this); } @@ -810,10 +810,10 @@ void RenderObjClass::Add(SceneClass * scene) bool RenderObjClass::Remove(void) { // All render objects have their scene pointers set. To check if this is a "top level" - // object, (i.e. directly in the scene) you see if its Container pointer is NULL. + // object, (i.e. directly in the scene) you see if its Container pointer is null. #if 1 - if (Container == NULL) { - if (Scene != NULL) { + if (Container == nullptr) { + if (Scene != nullptr) { Scene->Remove_Render_Object(this); return true; } @@ -826,7 +826,7 @@ bool RenderObjClass::Remove(void) if (!Scene) return false; Scene->Remove_Render_Object(this); - Scene = NULL; + Scene = nullptr; return true; #endif } @@ -880,7 +880,7 @@ void RenderObjClass::Notify_Added(SceneClass * scene) *=============================================================================================*/ void RenderObjClass::Notify_Removed(SceneClass * scene) { - Scene = NULL; + Scene = nullptr; } @@ -1056,7 +1056,7 @@ bool RenderObjClass::Build_Dependency_List (DynamicVectorClass &fil // Ask this subobj to add all of its file dependencies to the list RenderObjClass *psub_obj = Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { psub_obj->Build_Dependency_List (file_list); psub_obj->Release_Ref (); } @@ -1101,7 +1101,7 @@ bool RenderObjClass::Build_Texture_List // Ask this subobj to add all of its texture file dependencies to the list // RenderObjClass *sub_obj = Get_Sub_Object (index); - if (sub_obj != NULL) { + if (sub_obj != nullptr) { sub_obj->Build_Texture_List (texture_file_list); sub_obj->Release_Ref (); } @@ -1150,7 +1150,7 @@ void RenderObjClass::Add_Dependencies_To_List // External hierarchy file // const HTreeClass *phtree = Get_HTree (); - if (phtree != NULL) { + if (phtree != nullptr) { const char *htree_name = phtree->Get_Name (); if (::lstrcmpi (htree_name, model_name) != 0) { @@ -1165,7 +1165,7 @@ void RenderObjClass::Add_Dependencies_To_List // Original W3D file (if an aggregate) // const char *base_model_name = Get_Base_Model_Name (); - if (base_model_name != NULL) { + if (base_model_name != nullptr) { // // Add this file to the list @@ -1216,7 +1216,7 @@ uint32 RenderObjPersistFactoryClass::Chunk_ID(void) const PersistClass * RenderObjPersistFactoryClass::Load(ChunkLoadClass & cload) const { - RenderObjClass * old_obj = NULL; + RenderObjClass * old_obj = nullptr; Matrix3D tm(1); char name[64]; name[0] = '\0'; @@ -1248,25 +1248,25 @@ PersistClass * RenderObjPersistFactoryClass::Load(ChunkLoadClass & cload) const static int count = 0; if ( count++ < 10 ) { WWDEBUG_SAY(("RenderObjPersistFactory attempted to load an un-named render object!")); - WWDEBUG_SAY(("Replacing it with a NULL render object!")); + WWDEBUG_SAY(("Replacing it with a null render object!")); } strcpy(name,"NULL"); } RenderObjClass * new_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(name); - if (new_obj == NULL) { + if (new_obj == nullptr) { static int count = 0; if ( count++ < 10 ) { WWDEBUG_SAY(("RenderObjPersistFactory failed to create object: %s!!",name)); WWDEBUG_SAY(("Either the asset for this object is gone or you tried to save a procedural object.")); - WWDEBUG_SAY(("Replacing it with a NULL render object!")); + WWDEBUG_SAY(("Replacing it with a null render object!")); } strcpy(name,"NULL"); new_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(name); } - WWASSERT(new_obj != NULL); + WWASSERT(new_obj != nullptr); if (new_obj) { new_obj->Set_Transform(tm); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h index fe1005ff48e..d629a7be3fb 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h @@ -228,7 +228,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL virtual int Class_ID(void) const { return CLASSID_UNKNOWN; } virtual const char * Get_Name(void) const { return "UNNAMED"; } virtual void Set_Name(const char * name) { } - virtual const char * Get_Base_Model_Name (void) const { return NULL; } + virtual const char * Get_Base_Model_Name (void) const { return nullptr; } virtual void Set_Base_Model_Name (const char *name) { } virtual int Get_Num_Polys(void) const { return 0; } @@ -286,13 +286,13 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL virtual void Notify_Removed(SceneClass * scene); virtual int Get_Num_Sub_Objects(void) const { return 0; } - virtual RenderObjClass * Get_Sub_Object(int index) const { return NULL; } + virtual RenderObjClass * Get_Sub_Object(int index) const { return nullptr; } virtual int Add_Sub_Object(RenderObjClass * subobj) { return 0; } virtual int Remove_Sub_Object(RenderObjClass * robj) { return 0; } - virtual RenderObjClass * Get_Sub_Object_By_Name(const char * name, int *index=NULL) const; + virtual RenderObjClass * Get_Sub_Object_By_Name(const char * name, int *index=nullptr) const; virtual int Get_Num_Sub_Objects_On_Bone(int boneindex) const { return 0; } - virtual RenderObjClass * Get_Sub_Object_On_Bone(int index,int boneindex) const { return NULL; } + virtual RenderObjClass * Get_Sub_Object_On_Bone(int index,int boneindex) const { return nullptr; } virtual int Get_Sub_Object_Bone_Index(RenderObjClass * subobj) const { return 0; } virtual int Get_Sub_Object_Bone_Index(int LodIndex, int ModelIndex) const { return 0; } virtual int Add_Sub_Object_To_Bone(RenderObjClass * subobj,int bone_index) { return 0; } @@ -329,9 +329,9 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL float percentage) { } virtual void Set_Animation( HAnimComboClass * anim_combo) { } - virtual HAnimClass * Peek_Animation( void ) { return NULL; } + virtual HAnimClass * Peek_Animation( void ) { return nullptr; } virtual int Get_Num_Bones(void) { return 0; } - virtual const char * Get_Bone_Name(int bone_index) { return NULL; } + virtual const char * Get_Bone_Name(int bone_index) { return nullptr; } virtual int Get_Bone_Index(const char * bonename) { return 0; } virtual const Matrix3D & Get_Bone_Transform(const char * bonename) { return Get_Transform(); } virtual const Matrix3D & Get_Bone_Transform(int boneindex) { return Get_Transform(); } @@ -341,7 +341,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL virtual void Release_Bone(int bindex) { } virtual bool Is_Bone_Captured(int bindex) const { return false; } virtual void Control_Bone(int bindex,const Matrix3D & objtm,bool world_space_translation = false) { } - virtual const HTreeClass * Get_HTree(void) const { return NULL; } + virtual const HTreeClass * Get_HTree(void) const { return nullptr; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Render Object Interface - Collision Detection @@ -422,7 +422,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Render Object Interface - Attributes, Options, Properties, etc /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - virtual MaterialInfoClass * Get_Material_Info(void) { return NULL; } + virtual MaterialInfoClass * Get_Material_Info(void) { return nullptr; } virtual void Set_User_Data(void *value, bool recursive = false) { User_Data = value; }; virtual void * Get_User_Data() { return User_Data; }; virtual int Get_Num_Snap_Points(void) { return 0; } @@ -465,7 +465,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL virtual int Get_Collision_Type(void) const { return (Bits & COLL_TYPE_MASK); } virtual void Set_Collision_Type(int type) { Bits &= ~COLL_TYPE_MASK; Bits |= (type & COLL_TYPE_MASK) | COLL_TYPE_ALL; } virtual bool Is_Complete(void) { return false; } - virtual bool Is_In_Scene(void) { return Scene != NULL; } + virtual bool Is_In_Scene(void) { return Scene != nullptr; } virtual float Get_Native_Screen_Size(void) const { return NativeScreenSize; } virtual void Set_Native_Screen_Size(float screensize) { NativeScreenSize = screensize; } @@ -643,7 +643,7 @@ static const char* const TheAnimModeNames[] = "LOOP_PINGPONG", "LOOP_BACKWARDS", "ONCE_BACKWARDS", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheAnimModeNames) == RenderObjClass::ANIM_MODE_COUNT + 1, "Incorrect array size"); #endif diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp index 5108aa7152a..ddfa8904b2e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp @@ -171,8 +171,8 @@ RingRenderObjClass::RingRenderObjClass(void) LODBias(1.0f), CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD AnimDuration (0.0F), - RingMaterial (NULL), - RingTexture (NULL), + RingMaterial (nullptr), + RingTexture (nullptr), Color (0.75F,0.75F,0.75F), InnerScale (1, 1), OuterScale (1, 1), @@ -214,8 +214,8 @@ RingRenderObjClass::RingRenderObjClass(const W3dRingStruct & def) LODBias(1.0f), CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD AnimDuration (0.0F), - RingMaterial (NULL), - RingTexture (NULL), + RingMaterial (nullptr), + RingTexture (nullptr), Color (0.75F,0.75F,0.75F), InnerScale (1, 1), OuterScale (1, 1), @@ -265,8 +265,8 @@ RingRenderObjClass::RingRenderObjClass(const RingRenderObjClass & src) LODBias(1.0f), CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD AnimDuration (0.0F), - RingMaterial (NULL), - RingTexture (NULL), + RingMaterial (nullptr), + RingTexture (nullptr), Color (0.75F,0.75F,0.75F), InnerScale (1, 1), OuterScale (1, 1), @@ -373,7 +373,7 @@ void RingRenderObjClass::Generate_Shared_Mesh_Arrays (void) float step = (RING_HIGHEST_LOD - RING_LOWEST_LOD); step /= RING_NUM_LOD; - // For NULL LOD set Cost to a small nonzero amount to avoid divisions by zero. + // For null LOD set Cost to a small nonzero amount to avoid divisions by zero. RingLODCosts[0] = 0.000001f; for(int i=0; i < RING_NUM_LOD; i++) { @@ -501,7 +501,7 @@ const char * RingRenderObjClass::Get_Name(void) const *=============================================================================================*/ void RingRenderObjClass::Set_Name(const char * name) { - WWASSERT(name != NULL); + WWASSERT(name != nullptr); const size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name)); (void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name)); } @@ -520,7 +520,7 @@ void RingRenderObjClass::Set_Name(const char * name) *=============================================================================================*/ void RingRenderObjClass::render_ring(RenderInfoClass & rinfo,const Vector3 & center,const Vector3 & extent) { - // Should never get here with NULL LOD + // Should never get here with null LOD if (CurrentLOD == 0) { WWASSERT(0); return; @@ -670,7 +670,7 @@ int RingRenderObjClass::Class_ID(void) const *=============================================================================================*/ void RingRenderObjClass::Render(RenderInfoClass & rinfo) { - // NULL LOD + // null LOD if (CurrentLOD == 0) return; if (Is_Not_Hidden_At_All() == false) { @@ -707,7 +707,7 @@ void RingRenderObjClass::Render(RenderInfoClass & rinfo) // // Make sure this mesh uses the correct UV tiling // - if (RingTexture != NULL) { + if (RingTexture != nullptr) { RingMeshArray[CurrentLOD - 1].Set_Tiling (TextureTileCount); } @@ -859,7 +859,7 @@ void RingRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) temp.Translate(Transform.Get_Translation()); if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Set_Model_Transform(temp); vis_render_ring(rinfo,ObjSpaceCenter,ObjSpaceExtent); } @@ -1228,10 +1228,10 @@ RingPrototypeClass::RingPrototypeClass(RingRenderObjClass *ring) // // Determine the texture name for this ring // - if (ring->RingTexture != NULL) { + if (ring->RingTexture != nullptr) { StringClass name = ring->RingTexture->Get_Full_Path(); const char *filename = ::strrchr (name, '\\'); - if (filename != NULL) { + if (filename != nullptr) { filename ++; } else { filename = name; @@ -1408,12 +1408,12 @@ RingMeshClass::RingMeshClass(float radius, int slices): Radius(radius), Slices(slices), Vertex_ct(0), // 1 vertex minimum, for center -vtx(NULL), -orig_vtx(NULL), -vtx_normal(NULL), -vtx_uv(NULL), +vtx(nullptr), +orig_vtx(nullptr), +vtx_normal(nullptr), +vtx_uv(nullptr), face_ct(0), -tri_poly(NULL), +tri_poly(nullptr), TileCount (5), InnerScale (1.0F, 1.0F), OuterScale (1.0F, 1.0F) @@ -1437,12 +1437,12 @@ RingMeshClass::RingMeshClass(void): Radius(0.0f), Slices(0), Vertex_ct(0), // 1 vertex minimum, for center -vtx(NULL), -orig_vtx(NULL), -vtx_normal(NULL), -vtx_uv(NULL), +vtx(nullptr), +orig_vtx(nullptr), +vtx_normal(nullptr), +vtx_uv(nullptr), face_ct(0), -tri_poly(NULL), +tri_poly(nullptr), TileCount (5), InnerScale (1.0F, 1.0F), OuterScale (1.0F, 1.0F) @@ -1635,11 +1635,11 @@ void RingMeshClass::Free(void) delete vtx_uv; delete tri_poly; - vtx = NULL; - orig_vtx = NULL; - vtx_normal = NULL; - vtx_uv = NULL; - tri_poly = NULL; + vtx = nullptr; + orig_vtx = nullptr; + vtx_normal = nullptr; + vtx_uv = nullptr; + tri_poly = nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h index b4ab20f4944..578effcfb3f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h @@ -87,7 +87,7 @@ struct W3dRingStruct // variable set of keyframes for each channel }; -// Note: RING_NUM_LOD does not include the NULL LOD. +// Note: RING_NUM_LOD does not include the null LOD. #define RING_NUM_LOD (20) #define RING_LOWEST_LOD (10) #define RING_HIGHEST_LOD (50) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/segline.cpp b/Core/Libraries/Source/WWVegas/WW3D2/segline.cpp index be885b61fd2..9ab535062e2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/segline.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/segline.cpp @@ -561,7 +561,7 @@ bool SegmentedLineClass::Cast_Ray(RayCollisionTestClass & raytest) Vector3 p0; Vector3 p1; - if (raytest.Ray.Find_Intersection (line_seg, &p0, &fraction, &p1, NULL)) { + if (raytest.Ray.Find_Intersection (line_seg, &p0, &fraction, &p1, nullptr)) { // // Determine if the ray was close enough to this line to be diff --git a/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp index 07245f20350..26cd46376ba 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp @@ -69,7 +69,7 @@ SegLineRendererClass::SegLineRendererClass(void) : - Texture(NULL), + Texture(nullptr), Shader(ShaderClass::_PresetAdditiveSpriteShader), Width(0.0f), Color(Vector3(1,1,1)), @@ -83,13 +83,13 @@ SegLineRendererClass::SegLineRendererClass(void) : UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), m_vertexBufferSize(0), - m_vertexBuffer(NULL) + m_vertexBuffer(nullptr) { // EMPTY } SegLineRendererClass::SegLineRendererClass(const SegLineRendererClass & that) : - Texture(NULL), + Texture(nullptr), Shader(ShaderClass::_PresetAdditiveSpriteShader), Width(0.0f), Color(Vector3(1,1,1)), @@ -103,7 +103,7 @@ SegLineRendererClass::SegLineRendererClass(const SegLineRendererClass & that) : UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), m_vertexBufferSize(0), - m_vertexBuffer(NULL) + m_vertexBuffer(nullptr) { *this = that; } @@ -173,7 +173,7 @@ void SegLineRendererClass::Set_Texture(TextureClass *texture) TextureClass * SegLineRendererClass::Get_Texture(void) const { - if (Texture != NULL) { + if (Texture != nullptr) { Texture->Add_Ref(); } return Texture; @@ -337,7 +337,7 @@ void SegLineRendererClass::Render Vector4 subdiv_rgbas[MAX_SEGLINE_POINT_BUFFER_SIZE]; unsigned int sub_point_cnt; - Vector4 *rgbasPointer = rgbas ? &rgbas[ chidx ] : NULL; + Vector4 *rgbasPointer = rgbas ? &rgbas[ chidx ] : nullptr; subdivision_util(point_cnt, xformed_pts, base_tex_v, &sub_point_cnt, xformed_subdiv_pts, subdiv_tex_v, rgbasPointer, subdiv_rgbas); @@ -1120,7 +1120,7 @@ void SegLineRendererClass::Render mat=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_NODIFFUSE); } - // If Texture is non-NULL enable texturing in shader - otherwise disable. + // If Texture is non-null enable texturing in shader - otherwise disable. if (Texture) { shader.Set_Texturing(ShaderClass::TEXTURING_ENABLE); } else { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp index 6a42f6586a2..9f43d6062d2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp @@ -687,8 +687,8 @@ bool PolygonClass::Salvage_Degenerate(void) BSPClass::BSPClass(HTreeClass * tree,int bone_index,int & leaf_index) : Plane(0,0,1,0), - Front(NULL), - Back(NULL), + Front(nullptr), + Back(nullptr), FrontLeafIndex(-1), BackLeafIndex(-1) { @@ -730,7 +730,7 @@ BSPClass::~BSPClass(void) { delete Front; delete Back; - Front = Back = NULL; + Front = Back = nullptr; } void BSPClass::Set_Plane_From_Transform(const Matrix3D & tm) @@ -759,7 +759,7 @@ void BSPClass::Clip_Polygon(const PolygonClass & polygon) // Process the front halfspace: Recurse if we have a child clipping plane, // otherwise add our polygons to our assigned clipping pool - if (Front == NULL) { + if (Front == nullptr) { // We're a leaf node so put the polygons into the mesh fragment arrays if (front_poly.Get_Vertex_Count() >= 3) { ClipPools[FrontLeafIndex].Add(front_poly); @@ -772,7 +772,7 @@ void BSPClass::Clip_Polygon(const PolygonClass & polygon) } // Process the back halfspace: - if (Back==NULL) { + if (Back==nullptr) { if (back_poly.Get_Vertex_Count() >= 3) { ClipPools[BackLeafIndex].Add(back_poly); } @@ -809,14 +809,14 @@ void ShatterSystem::Init(void) StringClass htree_name; htree_name.Format(SHATTER_PATTERN_FORMAT,0); - if (WW3DAssetManager::Get_Instance()==NULL) + if (WW3DAssetManager::Get_Instance()==nullptr) return; // WorldBuilderTool doesn't initialize the asset manager. jba. #if 1 - HTreeClass *htree = NULL; + HTreeClass *htree = nullptr; #else HTreeClass * htree = WW3DAssetManager::Get_Instance()->Get_HTree(htree_name); #endif - while (htree != NULL) { + while (htree != nullptr) { if ((htree->Num_Pivots() > 1) && (htree->Num_Pivots() < MAX_MESH_FRAGMENTS)) { int leaf_counter = 0; htree->Base_Update(Matrix3D(1)); @@ -995,24 +995,24 @@ void ShatterSystem::Shatter_Mesh(MeshClass * mesh,const Vector3 & point,const Ve SHATTER_DEBUG_SAY(("normal: %f %f %f",src_vnorms[vert_index].X,src_vnorms[vert_index].Y,src_vnorms[vert_index].Z)); for (ipass=0; ipassAdd_Ref(); } return MeshFragments[fragment_index]; @@ -1092,7 +1092,7 @@ void ShatterSystem::Process_Clip_Pools ** Grab the model */ MeshModelClass * model = mesh->Get_Model(); - WWASSERT(model != NULL); + WWASSERT(model != nullptr); /* ** Loop over all ClipPools and build a mesh for any that contain polygons @@ -1132,11 +1132,11 @@ void ShatterSystem::Process_Clip_Pools bool has_textures = false; for (ipass=0; ipassGet_Pass_Count(); ipass++) { - if (model->Peek_Single_Material(ipass) != NULL) { + if (model->Peek_Single_Material(ipass) != nullptr) { matinfo->Add_Vertex_Material(model->Peek_Single_Material(ipass)); } for (int istage=0; istagePeek_Single_Texture(ipass,istage) != NULL) { + if (model->Peek_Single_Texture(ipass,istage) != nullptr) { matinfo->Add_Texture(model->Peek_Single_Texture(ipass,istage)); has_textures = true; } @@ -1150,7 +1150,7 @@ void ShatterSystem::Process_Clip_Pools for (istage=0; istagePeek_Single_Texture(ipass,istage); - if (tex != NULL) { + if (tex != nullptr) { new_mesh->Peek_Model()->Set_Single_Texture(tex,ipass,istage); } } @@ -1192,7 +1192,7 @@ void ShatterSystem::Process_Clip_Pools ** If there were vertex colors for this pass in the original mesh, then ** copy the color out of the vertex into the new mesh. */ - if (mtl_params.DCG[ipass] != NULL) { + if (mtl_params.DCG[ipass] != nullptr) { SHATTER_DEBUG_SAY(("DCG: pass:%d: %f %f %f",ipass,vert.DCG[ipass].X,vert.DCG[ipass].Y,vert.DCG[ipass].Z)); /* OLD CODE new_mesh->DCG(Vector3(vert.DCG[ipass].X,vert.DCG[ipass].Y,vert.DCG[ipass].Z),ipass); @@ -1202,7 +1202,7 @@ void ShatterSystem::Process_Clip_Pools } // HY- Multiplying DIG with DCG as in meshmdlio - if (mtl_params.DIG[ipass] != NULL) { + if (mtl_params.DIG[ipass] != nullptr) { SHATTER_DEBUG_SAY(("DIG: pass:%d: %f %f %f",ipass,vert.DIG[ipass].X,vert.DIG[ipass].Y,vert.DIG[ipass].Z)); Vector4 mc=DX8Wrapper::Convert_Color(mycolor); Vector4 dc=DX8Wrapper::Convert_Color(vert.DIG[ipass]); @@ -1218,7 +1218,7 @@ void ShatterSystem::Process_Clip_Pools */ // #pragma MESSAGE("HY- Naty, will dynamesh support multiple stages of UV?") for (istage=0; istageUV(vert.TexCoord[ipass][istage],istage); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp index 4bd67a6eda9..f8285b6085a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp @@ -60,7 +60,7 @@ SoundRenderObjLoaderClass _SoundRenderObjLoader; ////////////////////////////////////////////////////////////////////////////////// SoundRenderObjClass::SoundRenderObjClass (void) : Flags (FLAG_STOP_WHEN_HIDDEN), - Sound (NULL), + Sound (nullptr), IsInitialized (false) { return ; @@ -74,7 +74,7 @@ SoundRenderObjClass::SoundRenderObjClass (void) ////////////////////////////////////////////////////////////////////////////////// SoundRenderObjClass::SoundRenderObjClass (const SoundRenderObjClass &src) : Flags (FLAG_STOP_WHEN_HIDDEN), - Sound (NULL), + Sound (nullptr), IsInitialized (false) { (*this) = src; @@ -92,8 +92,8 @@ SoundRenderObjClass::~SoundRenderObjClass (void) // // Remove the old sound from the world (if necessary) // - if (Sound != NULL) { - Sound->Attach_To_Object (NULL); + if (Sound != nullptr) { + Sound->Attach_To_Object (nullptr); Sound->Remove_From_Scene (); REF_PTR_RELEASE (Sound); } @@ -140,7 +140,7 @@ SoundRenderObjClass::Set_Sound (AudibleSoundDefinitionClass *definition) // // Remove the old sound from the world (if necessary) // - if (Sound != NULL) { + if (Sound != nullptr) { Sound->Remove_From_Scene (); REF_PTR_RELEASE (Sound); } @@ -148,7 +148,7 @@ SoundRenderObjClass::Set_Sound (AudibleSoundDefinitionClass *definition) // // Create the sound object from its definition // - if (definition != NULL) { + if (definition != nullptr) { Sound = (AudibleSoundClass *)definition->Create (); } @@ -167,11 +167,11 @@ SoundRenderObjClass::On_Frame_Update (void) // // Stop the sound from playing (if necessary) // - if ( Sound != NULL && + if ( Sound != nullptr && Sound->Is_In_Scene () && Sound->Is_Playing () == false) { - Sound->Attach_To_Object (NULL); + Sound->Attach_To_Object (nullptr); Sound->Remove_From_Scene (); } @@ -279,7 +279,7 @@ SoundRenderObjClass::Set_Force_Visible (int onoff) void SoundRenderObjClass::Update_On_Visibilty (void) { - if (Sound == NULL) { + if (Sound == nullptr) { return ; } @@ -295,7 +295,7 @@ SoundRenderObjClass::Update_On_Visibilty (void) // if ( Is_Not_Hidden_At_All () && Sound->Is_In_Scene () == false && - Peek_Scene () != NULL) + Peek_Scene () != nullptr) { // // Make sure the sound is properly attached to this render @@ -304,13 +304,13 @@ SoundRenderObjClass::Update_On_Visibilty (void) Sound->Attach_To_Object (this); Sound->Add_To_Scene (true); - } else if ((Is_Not_Hidden_At_All () == false) || (Peek_Scene () == NULL)) { + } else if ((Is_Not_Hidden_At_All () == false) || (Peek_Scene () == nullptr)) { // // Remove the sound from the scene (it will stop playing) // - if ((Flags & FLAG_STOP_WHEN_HIDDEN) != 0 || (Peek_Scene () == NULL)) { - Sound->Attach_To_Object (NULL); + if ((Flags & FLAG_STOP_WHEN_HIDDEN) != 0 || (Peek_Scene () == nullptr)) { + Sound->Attach_To_Object (nullptr); Sound->Remove_From_Scene (); } } @@ -327,7 +327,7 @@ SoundRenderObjClass::Update_On_Visibilty (void) AudibleSoundClass * SoundRenderObjClass::Get_Sound (void) const { - if (Sound != NULL) { + if (Sound != nullptr) { Sound->Add_Ref (); } @@ -742,13 +742,13 @@ SoundRenderObjDefClass::Write_Definition (ChunkSaveClass &csave) PrototypeClass * SoundRenderObjLoaderClass::Load_W3D (ChunkLoadClass &cload) { - SoundRenderObjPrototypeClass *prototype = NULL; + SoundRenderObjPrototypeClass *prototype = nullptr; // // Create a definition object // SoundRenderObjDefClass *definition = W3DNEW SoundRenderObjDefClass; - if (definition != NULL) { + if (definition != nullptr) { // // Ask the definition object to load the sound data diff --git a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h index c5ce0b6815a..c22687dba9d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h @@ -231,7 +231,7 @@ class SoundRenderObjPrototypeClass : public W3DMPO, public PrototypeClass // Public constructors/destructors /////////////////////////////////////////////////////////// SoundRenderObjPrototypeClass (SoundRenderObjDefClass *def) - : Definition (NULL) { Set_Definition (def); } + : Definition (nullptr) { Set_Definition (def); } /////////////////////////////////////////////////////////// // Public methods diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp index 3b24f5e09d4..94aaeb7a9e2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -119,8 +119,8 @@ SphereRenderObjClass::SphereRenderObjClass(void) LODBias(1.0f), CurrentLOD(SPHERE_NUM_LOD), // SPHERE_NUM_LOD does not include the null LOD AnimDuration (0.0F), - SphereMaterial (NULL), - SphereTexture (NULL), + SphereMaterial (nullptr), + SphereTexture (nullptr), CurrentColor(0.75f, 0.75f, 0.75F), CurrentAlpha(1.0f), CurrentScale(1.0f, 1.0f, 1.0f), @@ -161,8 +161,8 @@ SphereRenderObjClass::SphereRenderObjClass(const W3dSphereStruct & def) LODBias(1.0f), CurrentLOD(SPHERE_NUM_LOD), // SPHERE_NUM_LOD does not include the null LOD AnimDuration (0.0F), - SphereMaterial (NULL), - SphereTexture (NULL), + SphereMaterial (nullptr), + SphereTexture (nullptr), CurrentColor(0.75f, 0.75f, 0.75F), CurrentAlpha(1.0f), CurrentScale(1.0f, 1.0f, 1.0f), @@ -211,8 +211,8 @@ SphereRenderObjClass::SphereRenderObjClass(const SphereRenderObjClass & src) LODBias(1.0f), CurrentLOD(SPHERE_NUM_LOD), // SPHERE_NUM_LOD does not include the null LOD AnimDuration (0.0F), - SphereMaterial (NULL), - SphereTexture (NULL), + SphereMaterial (nullptr), + SphereTexture (nullptr), CurrentColor(0.75f, 0.75f, 0.75F), CurrentAlpha(1.0f), CurrentScale(1.0f, 1.0f, 1.0f), @@ -300,7 +300,7 @@ void SphereRenderObjClass::Generate_Shared_Mesh_Arrays (const AlphaVectorStruct float step = (SPHERE_HIGHEST_LOD - SPHERE_LOWEST_LOD); step /= SPHERE_NUM_LOD; - // For NULL LOD set Cost to a small nonzero amount to avoid divisions by zero. + // For null LOD set Cost to a small nonzero amount to avoid divisions by zero. SphereLODCosts[0] = 0.000001f; for(int i=0; i < SPHERE_NUM_LOD; i++) { @@ -436,7 +436,7 @@ const char * SphereRenderObjClass::Get_Name(void) const *=============================================================================================*/ void SphereRenderObjClass::Set_Name(const char * name) { - WWASSERT(name != NULL); + WWASSERT(name != nullptr); const size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name)); (void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name)); } @@ -457,7 +457,7 @@ void SphereRenderObjClass::Set_Name(const char * name) *=============================================================================================*/ void SphereRenderObjClass::render_sphere() { - // Should never get here with NULL LOD + // Should never get here with null LOD if (CurrentLOD == 0) { WWASSERT(0); return; @@ -600,7 +600,7 @@ int SphereRenderObjClass::Class_ID(void) const *=============================================================================================*/ void SphereRenderObjClass::Render(RenderInfoClass & rinfo) { - // NULL LOD + // null LOD if (CurrentLOD == 0) return; if (Is_Not_Hidden_At_All() == false) { @@ -702,7 +702,7 @@ void SphereRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) temp.Translate(Transform.Get_Translation()); if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Set_Model_Transform(temp); vis_render_sphere(rinfo,ObjSpaceCenter,ObjSpaceExtent); } @@ -1181,10 +1181,10 @@ SpherePrototypeClass::SpherePrototypeClass(SphereRenderObjClass *sphere) // // Determine the texture name for this sphere // - if (sphere->SphereTexture != NULL) { + if (sphere->SphereTexture != nullptr) { StringClass name = sphere->SphereTexture->Get_Full_Path(); const char *filename = ::strrchr (name, '\\'); - if (filename != NULL) { + if (filename != nullptr) { filename ++; } else { filename = name; @@ -1360,17 +1360,17 @@ Radius(radius), Slices(slices), Stacks(stacks), Vertex_ct(0), -vtx(NULL), -vtx_normal(NULL), -vtx_uv(NULL), +vtx(nullptr), +vtx_normal(nullptr), +vtx_uv(nullptr), strip_ct(0), strip_size(0), -strips(NULL), +strips(nullptr), fan_ct(0), fan_size(0), -fans(NULL), +fans(nullptr), face_ct(0), -tri_poly(NULL), +tri_poly(nullptr), inverse_alpha(false) { // compute # of vertices @@ -1397,17 +1397,17 @@ Radius(0.0f), Slices(0), Stacks(0), Vertex_ct(0), -vtx(NULL), -vtx_normal(NULL), -vtx_uv(NULL), +vtx(nullptr), +vtx_normal(nullptr), +vtx_uv(nullptr), strip_ct(0), strip_size(0), -strips(NULL), +strips(nullptr), fan_ct(0), fan_size(0), -fans(NULL), +fans(nullptr), face_ct(0), -tri_poly(NULL), +tri_poly(nullptr), inverse_alpha(false) { @@ -1736,13 +1736,13 @@ void SphereMeshClass::Free(void) delete [] fans; delete [] tri_poly; - vtx = NULL; - vtx_normal = NULL; - vtx_uv = NULL; - dcg = NULL; - strips = NULL; - fans = NULL; - tri_poly = NULL; + vtx = nullptr; + vtx_normal = nullptr; + vtx_uv = nullptr; + dcg = nullptr; + strips = nullptr; + fans = nullptr; + tri_poly = nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h index 5b854cf4fb0..57b8d1b9059 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h @@ -212,7 +212,7 @@ SphereMeshClass::Set_DCG (bool is_additive, int index, float value) return ; } -// Note: SPHERE_NUM_LOD does not include the NULL LOD. +// Note: SPHERE_NUM_LOD does not include the null LOD. #define SPHERE_NUM_LOD (10) #define SPHERE_LOWEST_LOD (7) #define SPHERE_HIGHEST_LOD (17) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/statistics.cpp b/Core/Libraries/Source/WWVegas/WW3D2/statistics.cpp index 09b0ce0fe03..e703c89e67b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/statistics.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/statistics.cpp @@ -75,7 +75,7 @@ static void Record_Texture_Begin() procedural_texture_count=0; record_count=0; texture_change_count=0; - latest_texture=NULL; + latest_texture=nullptr; texture_statistics.Resize(0); } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/streak.cpp b/Core/Libraries/Source/WWVegas/WW3D2/streak.cpp index 2c045a083e2..3eb75ae29f7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/streak.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/streak.cpp @@ -59,7 +59,7 @@ StreakLineClass::StreakLineClass(void) : MaxSubdivisionLevels(0), NormalizedScreenArea(0.0f) { - Personalities = NULL; + Personalities = nullptr; } @@ -715,7 +715,7 @@ bool StreakLineClass::Cast_Ray(RayCollisionTestClass & raytest) Vector3 p0; Vector3 p1; - if (raytest.Ray.Find_Intersection (line_seg, &p0, &fraction, &p1, NULL)) { + if (raytest.Ray.Find_Intersection (line_seg, &p0, &fraction, &p1, nullptr)) { // // Determine if the ray was close enough to this line to be diff --git a/Core/Libraries/Source/WWVegas/WW3D2/streak.h b/Core/Libraries/Source/WWVegas/WW3D2/streak.h index f0eb918425e..e6c4d2516ba 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/streak.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/streak.h @@ -163,9 +163,9 @@ class StreakLineClass : public RenderObjClass void Set_LocsWidthsColors( unsigned int num_points, Vector3 *locs, - float *widths = NULL, - Vector4 *colors = NULL, - unsigned int *personalities = NULL); + float *widths = nullptr, + Vector4 *colors = nullptr, + unsigned int *personalities = nullptr); protected: diff --git a/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp b/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp index 2fe4daf94bb..ed7eae37c18 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/streakRender.cpp @@ -55,7 +55,7 @@ StreakRendererClass::StreakRendererClass(void) : - Texture(NULL), + Texture(nullptr), Shader(ShaderClass::_PresetAdditiveSpriteShader), Width(0.0f), Color(Vector3(1,1,1)), @@ -69,13 +69,13 @@ StreakRendererClass::StreakRendererClass(void) : // UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), m_vertexBufferSize(0), - m_vertexBuffer(NULL) + m_vertexBuffer(nullptr) { // EMPTY } StreakRendererClass::StreakRendererClass(const StreakRendererClass & that) : - Texture(NULL), + Texture(nullptr), Shader(ShaderClass::_PresetAdditiveSpriteShader), Width(0.0f), Color(Vector3(1,1,1)), @@ -89,7 +89,7 @@ StreakRendererClass::StreakRendererClass(const StreakRendererClass & that) : // UVOffsetDeltaPerMS(0.0f, 0.0f), Bits(DEFAULT_BITS), m_vertexBufferSize(0), - m_vertexBuffer(NULL) + m_vertexBuffer(nullptr) { *this = that; } @@ -159,7 +159,7 @@ void StreakRendererClass::Set_Texture(TextureClass *texture) TextureClass * StreakRendererClass::Get_Texture(void) const { - if (Texture != NULL) { + if (Texture != nullptr) { Texture->Add_Ref(); } return Texture; @@ -1307,7 +1307,7 @@ void StreakRendererClass::RenderStreak DX8Wrapper::Set_Material(mat); REF_PTR_RELEASE(mat); - // If Texture is non-NULL enable texturing in shader - otherwise disable. + // If Texture is non-null enable texturing in shader - otherwise disable. if (Texture) { shader.Set_Texturing(ShaderClass::TEXTURING_ENABLE); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp index fdec676476a..26536668494 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp @@ -174,7 +174,7 @@ void StripOptimizerClass::Optimize_Strip_Order (int* strips, int strip_count) const int* prev = ss[0]; // previous strip o = Copy_Strip (o, ss[0]); // output first strip - ss[0] = 0; + ss[0] = nullptr; for (;;) { @@ -197,7 +197,7 @@ void StripOptimizerClass::Optimize_Strip_Order (int* strips, int strip_count) o = Copy_Strip(o, ss[bestIndex]); // copy the strip prev = ss[bestIndex]; // set to prev - ss[bestIndex] = NULL; // mark as selected + ss[bestIndex] = nullptr; // mark as selected } // WWASSERT((out+outSize)==o); // HUH? @@ -258,7 +258,7 @@ void StripOptimizerClass::Optimize_Triangle_Order (int *tris, int triangle_count Tri* prev = t[0]; *o++ = *prev; - t[0] = NULL; + t[0] = nullptr; for (;;) { @@ -284,7 +284,7 @@ void StripOptimizerClass::Optimize_Triangle_Order (int *tris, int triangle_count *o++ = *t[bestIndex]; prev = t[bestIndex]; - t[bestIndex] = NULL; + t[bestIndex] = nullptr; } @@ -407,14 +407,14 @@ struct Triangle { Triangle (void) { - m_neighbors[0] = 0; - m_neighbors[1] = 0; - m_neighbors[2] = 0; + m_neighbors[0] = nullptr; + m_neighbors[1] = nullptr; + m_neighbors[2] = nullptr; m_vertices[0] = 0; m_vertices[1] = 0; m_vertices[2] = 0; - m_prev = 0; - m_next = 0; + m_prev = nullptr; + m_next = nullptr; m_bin = -1; } @@ -497,7 +497,7 @@ namespace Strip * * Description: Returns pointer to triangle with smallest connectivity * - * Returns: pointer to triangle with smallest connectivity or NULL + * Returns: pointer to triangle with smallest connectivity or nullptr * if the queue is empty * *****************************************************************************/ @@ -507,7 +507,7 @@ inline Triangle* TriangleQueue::getTop (void) const for (int i = 0; i < 4; i++) if (m_bin[i]) return m_bin[i]; // return head - return 0; // end + return nullptr; // end } /***************************************************************************** @@ -548,7 +548,7 @@ inline TriangleQueue::~TriangleQueue () * Description: Internal function for recalculating a triangle's * connectivity * - * Parameters: t = pointer to triangle (non-NULL) + * Parameters: t = pointer to triangle (non-null) * *****************************************************************************/ @@ -570,7 +570,7 @@ inline void TriangleQueue::reinsert (Triangle* t) if (t->m_next) t->m_next->m_prev = t->m_prev; - t->m_prev = 0; + t->m_prev = nullptr; t->m_next = m_bin[w]; if (t->m_next) t->m_next->m_prev = t; @@ -585,7 +585,7 @@ inline void TriangleQueue::reinsert (Triangle* t) * * Description: Removes a triangle from the queue * - * Parameters: t = pointer to triangle (non-NULL) + * Parameters: t = pointer to triangle (non-null) * *****************************************************************************/ @@ -612,7 +612,7 @@ inline void TriangleQueue::removeTriangle (Triangle* t) for (i = 0; i < 3; i++) { - update[i] = 0; + update[i] = nullptr; if (t->m_neighbors[i]) { Triangle* n = t->m_neighbors[i]; @@ -621,8 +621,8 @@ inline void TriangleQueue::removeTriangle (Triangle* t) if (n->m_neighbors[k]==t) break; WWASSERT (k!=3); // WASS?? - n->m_neighbors[k] = 0; // reduce connection - t->m_neighbors[i] = 0; + n->m_neighbors[k] = nullptr; // reduce connection + t->m_neighbors[i] = nullptr; update[i] = n; } } @@ -656,7 +656,7 @@ inline TriangleQueue::TriangleQueue (Triangle* tris, int N) { int i; for (i = 0; i < 4; i++) - m_bin[i] = 0; // initialize to zero + m_bin[i] = nullptr; // initialize to zero int largestIndex = 0; @@ -680,7 +680,7 @@ inline TriangleQueue::TriangleQueue (Triangle* tris, int N) int w = t->getConnectivity(); WWASSERT(w>=0 && w <=3); WWASSERT(!t->m_prev && !t->m_next && t->m_bin==-1); // must not be in a bin - t->m_prev = 0; + t->m_prev = nullptr; t->m_next = m_bin[w]; if (t->m_next) t->m_next->m_prev = t; @@ -833,7 +833,7 @@ Triangle* Stripify::generateTriangleList (const Vector3i* inTris, int N) int* Stripify::stripify (const Vector3i* inTris, int N) { if (!inTris || N<=0) // boo! - return 0; + return nullptr; //-------------------------------------------------------------------- // Initial setup @@ -893,7 +893,7 @@ int* Stripify::stripify (const Vector3i* inTris, int N) for (;;) { - Triangle* next = 0; // find next triangle + Triangle* next = nullptr; // find next triangle int i; for (i = 0; i < 3; i++) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp index ae112b257bb..059900aabf3 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp @@ -213,7 +213,7 @@ void Convert_Pixel(unsigned char * pixel,const SurfaceClass::SurfaceDescription ** SurfaceClass *************************************************************************/ SurfaceClass::SurfaceClass(unsigned width, unsigned height, WW3DFormat format): - D3DSurface(NULL), + D3DSurface(nullptr), SurfaceFormat(format) { WWASSERT(width); @@ -222,7 +222,7 @@ SurfaceClass::SurfaceClass(unsigned width, unsigned height, WW3DFormat format): } SurfaceClass::SurfaceClass(const char *filename): - D3DSurface(NULL) + D3DSurface(nullptr) { D3DSurface = DX8Wrapper::_Create_DX8_Surface(filename); SurfaceDescription desc; @@ -231,7 +231,7 @@ SurfaceClass::SurfaceClass(const char *filename): } SurfaceClass::SurfaceClass(IDirect3DSurface8 *d3d_surface) : - D3DSurface (NULL) + D3DSurface (nullptr) { Attach (d3d_surface); SurfaceDescription desc; @@ -243,7 +243,7 @@ SurfaceClass::~SurfaceClass(void) { if (D3DSurface) { D3DSurface->Release(); - D3DSurface = NULL; + D3DSurface = nullptr; } } @@ -261,7 +261,7 @@ void * SurfaceClass::Lock(int * pitch) { D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect, 0, 0)); + DX8_ErrorCode(D3DSurface->LockRect(&lock_rect, nullptr, 0)); *pitch = lock_rect.Pitch; return (void *)lock_rect.pBits; } @@ -296,7 +296,7 @@ void SurfaceClass::Clear() D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,0,0)); + DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,nullptr,0)); unsigned int i; unsigned char *mem=(unsigned char *) lock_rect.pBits; @@ -335,7 +335,7 @@ void SurfaceClass::Copy(const unsigned char *other) D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,0,0)); + DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,nullptr,0)); unsigned int i; unsigned char *mem=(unsigned char *) lock_rect.pBits; @@ -425,7 +425,7 @@ unsigned char *SurfaceClass::CreateCopy(int *width,int *height,int*size,bool fli D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,0,D3DLOCK_READONLY)); + DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,nullptr,D3DLOCK_READONLY)); unsigned int i; unsigned char *mem=(unsigned char *) lock_rect.pBits; @@ -503,7 +503,7 @@ void SurfaceClass::Copy( if (dest.right>int(sd.Width)) dest.right=int(sd.Width); if (dest.bottom>int(sd.Height)) dest.bottom=int(sd.Height); - DX8_ErrorCode(D3DXLoadSurfaceFromSurface(D3DSurface,NULL,&dest,other->D3DSurface,NULL,&src,D3DX_FILTER_NONE,0)); + DX8_ErrorCode(D3DXLoadSurfaceFromSurface(D3DSurface,nullptr,&dest,other->D3DSurface,nullptr,&src,D3DX_FILTER_NONE,0)); } } @@ -545,7 +545,7 @@ void SurfaceClass::Stretch_Copy( dest.top=dsty; dest.bottom=dsty+dstheight; - DX8_ErrorCode(D3DXLoadSurfaceFromSurface(D3DSurface,NULL,&dest,other->D3DSurface,NULL,&src,D3DX_FILTER_TRIANGLE ,0)); + DX8_ErrorCode(D3DXLoadSurfaceFromSurface(D3DSurface,nullptr,&dest,other->D3DSurface,nullptr,&src,D3DX_FILTER_TRIANGLE ,0)); } /*********************************************************************************************** @@ -752,7 +752,7 @@ void SurfaceClass::Attach (IDirect3DSurface8 *surface) // // Lock a reference onto the object // - if (D3DSurface != NULL) { + if (D3DSurface != nullptr) { D3DSurface->AddRef (); } @@ -780,11 +780,11 @@ void SurfaceClass::Detach (void) // // Release the hold we have on the D3D object // - if (D3DSurface != NULL) { + if (D3DSurface != nullptr) { D3DSurface->Release (); } - D3DSurface = NULL; + D3DSurface = nullptr; return ; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp b/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp index 38b5ceee3e2..9c2e4b694e4 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp @@ -186,10 +186,10 @@ TexProjectClass::TexProjectClass(void) : DesiredIntensity(1.0f), Intensity(1.0f), Attenuation(1.0f), - MaterialPass(NULL), - Mapper1(NULL), - RenderTarget(NULL), - DepthStencilTarget(NULL), + MaterialPass(nullptr), + Mapper1(nullptr), + RenderTarget(nullptr), + DepthStencilTarget(nullptr), HFov(90.0f), VFov(90.0f), XMin(-10.0f), @@ -205,7 +205,7 @@ TexProjectClass::TexProjectClass(void) : // create a vertex material VertexMaterialClass * vmtl = NEW_REF(VertexMaterialClass,()); - WWASSERT(vmtl != NULL); + WWASSERT(vmtl != nullptr); // Plug our parent's mapper into our vertex material // the mapper for stage1 will be allocated as needed @@ -213,7 +213,7 @@ TexProjectClass::TexProjectClass(void) : MaterialPass->Set_Material(vmtl); vmtl->Release_Ref(); - vmtl = NULL; + vmtl = nullptr; // by default init our material pass to be multiplicative (shadow) Init_Multiplicative(); @@ -594,7 +594,7 @@ void TexProjectClass::Init_Multiplicative(void) /* ** remove the texture from the second stage */ - MaterialPass->Set_Texture(NULL,1); + MaterialPass->Set_Texture(nullptr,1); } #if (DEBUG_SHADOW_RENDERING) @@ -620,13 +620,13 @@ void TexProjectClass::Init_Multiplicative(void) ** Set up some mapper settings related to depth gradient */ if (Get_Flag(USE_DEPTH_GRADIENT)) { - if (Mapper1 == NULL) { + if (Mapper1 == nullptr) { Mapper1 = NEW_REF(MatrixMapperClass,(1)); } Mapper1->Set_Type(MatrixMapperClass::DEPTH_GRADIENT); vmtl->Set_Mapper(Mapper1,1); } else { - vmtl->Set_Mapper(NULL,1); + vmtl->Set_Mapper(nullptr,1); } } @@ -709,7 +709,7 @@ void TexProjectClass::Init_Additive(void) ** Set up some mapper settings related to depth gradient ** Additive texture projections always use the normal gradient */ - if (Mapper1 == NULL) { + if (Mapper1 == nullptr) { Mapper1 = NEW_REF(MatrixMapperClass,(1)); } Mapper1->Set_Type(MatrixMapperClass::NORMAL_GRADIENT); @@ -731,7 +731,7 @@ void TexProjectClass::Init_Additive(void) *=============================================================================================*/ void TexProjectClass::Set_Texture(TextureClass * texture) { - if (texture != NULL) + if (texture != nullptr) { texture->Get_Filter().Set_U_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); texture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); @@ -871,8 +871,8 @@ bool TexProjectClass::Compute_Perspective_Projection float zfar ) { - if (model == NULL) { - WWDEBUG_SAY(("Attempting to generate projection for a NULL model")); + if (model == nullptr) { + WWDEBUG_SAY(("Attempting to generate projection for a null model")); return false; } @@ -998,8 +998,8 @@ bool TexProjectClass::Compute_Ortho_Projection float zfar ) { - if (model == NULL) { - WWDEBUG_SAY(("Attempting to generate projection for a NULL model")); + if (model == nullptr) { + WWDEBUG_SAY(("Attempting to generate projection for a null model")); return false; } @@ -1118,19 +1118,19 @@ bool TexProjectClass::Compute_Texture SpecialRenderInfoClass * context ) { - if ((model == NULL) || (context == NULL)) + if ((model == nullptr) || (context == nullptr)) { return false; } /* ** Render to texture */ - TextureClass * rtarget=NULL; - ZTextureClass* ztarget=NULL; + TextureClass * rtarget=nullptr; + ZTextureClass* ztarget=nullptr; Peek_Render_Target(&rtarget,&ztarget); - if (rtarget != NULL) + if (rtarget != nullptr) { // set projector for render context KJM context->Texture_Projector=this; @@ -1153,7 +1153,7 @@ bool TexProjectClass::Compute_Texture color.Set(1.0f,1.0f,1.0f); } - bool zclear=ztarget!=NULL; + bool zclear=ztarget!=nullptr; bool snapshot=WW3D::Is_Snapshot_Activated(); SNAPSHOT_SAY(("TexProjectCLass::Begin_Render()")); @@ -1163,7 +1163,7 @@ bool TexProjectClass::Compute_Texture WW3D::End_Render(false); WW3D::Activate_Snapshot(snapshot); // End_Render() ends the shapsnot, so restore the state - DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)NULL); + DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)nullptr); } @@ -1176,7 +1176,7 @@ bool TexProjectClass::Compute_Texture bwr.Fill(0xff); context->BWRenderer = &bwr; model->Special_Render(*context); - context->BWRenderer = NULL; + context->BWRenderer = nullptr; #endif return true; } @@ -1243,12 +1243,12 @@ TextureClass* TexProjectClass::Peek_Render_Target ) { // some uses of this function just want to know if a render target exists - if (rtarget==NULL) return RenderTarget; + if (rtarget==nullptr) return RenderTarget; *rtarget=RenderTarget; // don't set if pointer isn't supplied - if (ztarget!=NULL) + if (ztarget!=nullptr) *ztarget=DepthStencilTarget; return RenderTarget; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texproject.h b/Core/Libraries/Source/WWVegas/WW3D2/texproject.h index 0489220f649..d14ff60ea41 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texproject.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/texproject.h @@ -158,8 +158,8 @@ class TexProjectClass : public ProjectorClass, public CullableClass, public Mult bool Compute_Ortho_Projection(const AABoxClass & obj_box,const Matrix3D & tm,const Vector3 & lightdir,float znear=-1.0f,float zfar=-1.0f); bool Needs_Render_Target(void); - void Set_Render_Target(TextureClass* render_target, ZTextureClass* ztarget=NULL); - TextureClass* Peek_Render_Target(TextureClass** rtarget=NULL, ZTextureClass** ztarget=NULL); + void Set_Render_Target(TextureClass* render_target, ZTextureClass* ztarget=nullptr); + TextureClass* Peek_Render_Target(TextureClass** rtarget=nullptr, ZTextureClass** ztarget=nullptr); bool Compute_Texture(RenderObjClass * model,SpecialRenderInfoClass * context); @@ -170,12 +170,12 @@ class TexProjectClass : public ProjectorClass, public CullableClass, public Mult /* ** virtual interface for getting the pointer of the object that generated this shadow. - ** defaults to returning NULL. This is implemented by some derived classes and used by + ** defaults to returning nullptr. This is implemented by some derived classes and used by ** the system to prevent a projection from being applied to the object that generated ** the projection... ** (gth) feels kludgy, this got a little messy when I moved this code into WW3D from WWPhys */ - virtual void * Get_Projection_Object_ID(void) const { return NULL; } + virtual void * Get_Projection_Object_ID(void) const { return nullptr; } protected: diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp b/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp index a87382f6478..f923fbec419 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp @@ -84,7 +84,7 @@ TextureBaseClass::TextureBaseClass bool reducible ) : MipLevelCount(mip_level_count), - D3DTexture(NULL), + D3DTexture(nullptr), Initialized(false), Name(""), FullPath(""), @@ -101,8 +101,8 @@ TextureBaseClass::TextureBaseClass Height(height), Pool(pool), Dirty(false), - TextureLoadTask(NULL), - ThumbnailLoadTask(NULL), + TextureLoadTask(nullptr), + ThumbnailLoadTask(nullptr), HSVShift(0.0f,0.0f,0.0f) { } @@ -115,14 +115,14 @@ TextureBaseClass::TextureBaseClass TextureBaseClass::~TextureBaseClass(void) { delete TextureLoadTask; - TextureLoadTask=NULL; + TextureLoadTask=nullptr; delete ThumbnailLoadTask; - ThumbnailLoadTask=NULL; + ThumbnailLoadTask=nullptr; if (D3DTexture) { D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } DX8TextureManagerClass::Remove(this); @@ -204,7 +204,7 @@ void TextureBaseClass::Invalidate() if (D3DTexture) { D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } Initialized=false; @@ -239,7 +239,7 @@ void TextureBaseClass::Invalidate() if (D3DTexture) { D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } Initialized=false; @@ -267,11 +267,11 @@ void TextureBaseClass::Set_D3D_Base_Texture(IDirect3DBaseTexture8* tex) // reset the access timer whenever someon messes with this pointer. LastAccessed=WW3D::Get_Sync_Time(); - if (D3DTexture != NULL) { + if (D3DTexture != nullptr) { D3DTexture->Release(); } D3DTexture = tex; - if (D3DTexture != NULL) { + if (D3DTexture != nullptr) { D3DTexture->AddRef(); } } @@ -285,7 +285,7 @@ void TextureBaseClass::Load_Locked_Surface() { WWPROFILE(("TextureClass::Load_Locked_Surface()")); if (D3DTexture) D3DTexture->Release(); - D3DTexture=0; + D3DTexture=nullptr; TextureLoader::Request_Thumbnail(this); Initialized=false; } @@ -332,7 +332,7 @@ unsigned int TextureBaseClass::Get_Priority(void) { if (!D3DTexture) { - WWASSERT_PRINT(0, "Get_Priority: D3DTexture is NULL!"); + WWASSERT_PRINT(0, "Get_Priority: D3DTexture is null!"); return 0; } @@ -352,7 +352,7 @@ unsigned int TextureBaseClass::Set_Priority(unsigned int priority) { if (!D3DTexture) { - WWASSERT_PRINT(0, "Set_Priority: D3DTexture is NULL!"); + WWASSERT_PRINT(0, "Set_Priority: D3DTexture is null!"); return 0; } @@ -390,13 +390,13 @@ unsigned TextureBaseClass::Get_Reduction() const //********************************************************************************************** -//! Apply NULL texture state +//! Apply null texture state /*! */ void TextureBaseClass::Apply_Null(unsigned int stage) { - // This function sets the render states for a "NULL" texture - DX8Wrapper::Set_DX8_Texture(stage, NULL); + // This function sets the render states for a "null" texture + DX8Wrapper::Set_DX8_Texture(stage, nullptr); } // ---------------------------------------------------------------------------- @@ -709,7 +709,7 @@ TextureClass::TextureClass default: break; } - WWASSERT_PRINT(name && name[0], "TextureClass CTor: NULL or empty texture name"); + WWASSERT_PRINT(name && name[0], "TextureClass CTor: null or empty texture name"); int len=strlen(name); for (int i=0;iGetSurfaceLevel(level, &d3d_surface)); SurfaceClass *surface = new SurfaceClass(d3d_surface); d3d_surface->Release(); @@ -1002,7 +1002,7 @@ SurfaceClass *TextureClass::Get_Surface_Level(unsigned int level) void TextureClass::Get_Level_Description( SurfaceClass::SurfaceDescription & desc, unsigned int level ) { SurfaceClass * surf = Get_Surface_Level(level); - if (surf != NULL) { + if (surf != nullptr) { surf->Get_Description(desc); } REF_PTR_RELEASE(surf); @@ -1016,11 +1016,11 @@ IDirect3DSurface8 *TextureClass::Get_D3D_Surface_Level(unsigned int level) { if (!Peek_D3D_Texture()) { - WWASSERT_PRINT(0, "Get_D3D_Surface_Level: D3DTexture is NULL!"); - return 0; + WWASSERT_PRINT(0, "Get_D3D_Surface_Level: D3DTexture is null!"); + return nullptr; } - IDirect3DSurface8 *d3d_surface = NULL; + IDirect3DSurface8 *d3d_surface = nullptr; DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(level, &d3d_surface)); return d3d_surface; } @@ -1047,7 +1047,7 @@ unsigned TextureClass::Get_Texture_Memory_Usage() const TextureClass* Load_Texture(ChunkLoadClass & cload) { // Assume failure - TextureClass *newtex = NULL; + TextureClass *newtex = nullptr; char name[256]; if (cload.Open_Chunk () && (cload.Cur_Chunk_ID () == W3D_CHUNK_TEXTURE)) @@ -1308,11 +1308,11 @@ IDirect3DSurface8* ZTextureClass::Get_D3D_Surface_Level(unsigned int level) { if (!Peek_D3D_Texture()) { - WWASSERT_PRINT(0, "Get_D3D_Surface_Level: D3DTexture is NULL!"); - return 0; + WWASSERT_PRINT(0, "Get_D3D_Surface_Level: D3DTexture is null!"); + return nullptr; } - IDirect3DSurface8 *d3d_surface = NULL; + IDirect3DSurface8 *d3d_surface = nullptr; DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(level, &d3d_surface)); return d3d_surface; } @@ -1454,7 +1454,7 @@ CubeTextureClass::CubeTextureClass default: break; } - WWASSERT_PRINT(name && name[0], "TextureClass CTor: NULL or empty texture name"); + WWASSERT_PRINT(name && name[0], "TextureClass CTor: null or empty texture name"); int len=strlen(name); for (int i=0;iNext == NULL && task->Prev == NULL); + WWASSERT(task != nullptr && task->Next == nullptr && task->Prev == nullptr); // update inserted task to point to list task->Next = Root.Next; @@ -95,7 +95,7 @@ void TextureLoadTaskListClass::Push_Front (TextureLoadTaskClass *task) void TextureLoadTaskListClass::Push_Back(TextureLoadTaskClass *task) { // task should be non-null and not on any list - WWASSERT(task != NULL && task->Next == NULL && task->Prev == NULL); + WWASSERT(task != nullptr && task->Next == nullptr && task->Prev == nullptr); // update inserted task to point to list task->Next = &Root; @@ -111,7 +111,7 @@ TextureLoadTaskClass *TextureLoadTaskListClass::Pop_Front(void) { // exit early if list is empty if (Is_Empty()) { - return 0; + return nullptr; } // otherwise, grab first task and remove it. @@ -125,7 +125,7 @@ TextureLoadTaskClass *TextureLoadTaskListClass::Pop_Back(void) { // exit early if list is empty if (Is_Empty()) { - return 0; + return nullptr; } // otherwise, grab last task and remove it. @@ -146,9 +146,9 @@ void TextureLoadTaskListClass::Remove(TextureLoadTaskClass *task) task->Next->Prev = task->Prev; // update task to no longer point at list - task->Prev = 0; - task->Next = 0; - task->List = 0; + task->Prev = nullptr; + task->Next = nullptr; + task->List = nullptr; } @@ -180,7 +180,7 @@ TextureLoadTaskClass *SynchronizedTextureLoadTaskListClass::Pop_Front(void) { // this duplicates code inside base class, but saves us an unnecessary lock. if (Is_Empty()) { - return 0; + return nullptr; } FastCriticalSectionClass::LockClass lock(CriticalSection); @@ -192,7 +192,7 @@ TextureLoadTaskClass *SynchronizedTextureLoadTaskListClass::Pop_Back(void) { // this duplicates code inside base class, but saves us an unnecessary lock. if (Is_Empty()) { - return 0; + return nullptr; } FastCriticalSectionClass::LockClass lock(CriticalSection); @@ -249,8 +249,8 @@ IDirect3DTexture8* Load_Compressed_Texture( // If DDS file isn't available, use TGA file to convert to DDS. DDSFileClass dds_file(filename,reduction_factor); - if (!dds_file.Is_Available()) return NULL; - if (!dds_file.Load()) return NULL; + if (!dds_file.Is_Available()) return nullptr; + if (!dds_file.Load()) return nullptr; unsigned width=dds_file.Get_Width(0); unsigned height=dds_file.Get_Height(0); @@ -269,7 +269,7 @@ IDirect3DTexture8* Load_Compressed_Texture( ); for (unsigned level=0;levelGetSurfaceLevel(level/*-reduction_factor*/,&d3d_surface)); dds_file.Copy_Level_To_Surface(level,d3d_surface); @@ -415,7 +415,7 @@ IDirect3DTexture8* TextureLoader::Load_Thumbnail(const StringClass& filename, co { WWASSERT(Is_DX8_Thread()); - ThumbnailClass* thumb=NULL; + ThumbnailClass* thumb=nullptr; thumb=ThumbnailManagerClass::Peek_Thumbnail_Instance_From_Any_Manager(filename); // If no thumb is found return a missing texture @@ -456,7 +456,7 @@ IDirect3DTexture8* TextureLoader::Load_Thumbnail(const StringClass& filename, co sysmem_texture->LockRect( level, &locked_rects[level], - NULL, + nullptr, 0)); } @@ -529,7 +529,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( if (compressed) { IDirect3DTexture8* comp_tex=Load_Compressed_Texture(filename,0,MIP_LEVELS_1,WW3D_FORMAT_UNKNOWN); if (comp_tex) { - IDirect3DSurface8* d3d_surface=NULL; + IDirect3DSurface8* d3d_surface=nullptr; DX8_ErrorCode(comp_tex->GetSurfaceLevel(0,&d3d_surface)); comp_tex->Release(); return d3d_surface; @@ -566,7 +566,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( unsigned char* src_surface=(unsigned char*)targa.GetImage(); // No paletted destination format allowed - unsigned char* converted_surface=NULL; + unsigned char* converted_surface=nullptr; if (src_format==WW3D_FORMAT_A1R5G5B5 || src_format==WW3D_FORMAT_R5G6B5 || src_format==WW3D_FORMAT_A4R4G4B4 || src_format==WW3D_FORMAT_P8 || src_format==WW3D_FORMAT_L8 || src_width!=width || src_height!=height) { converted_surface=W3DNEWARRAY unsigned char[width*height*4]; @@ -600,7 +600,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( DX8_ErrorCode( d3d_surface->LockRect( &locked_rect, - NULL, + nullptr, 0)); BitmapHandlerClass::Copy_Image( @@ -963,7 +963,7 @@ void TextureLoader::Load_Thumbnail(TextureBaseClass *tc) // release our reference to thumbnail texture d3d_texture->Release(); - d3d_texture = 0; + d3d_texture = nullptr; } @@ -1003,8 +1003,8 @@ void LoaderThreadClass::Thread_Function(void) //////////////////////////////////////////////////////////////////////////////// TextureLoadTaskClass::TextureLoadTaskClass() -: Texture (0), - D3DTexture (0), +: Texture (nullptr), + D3DTexture (nullptr), Format (WW3D_FORMAT_UNKNOWN), Width (0), Height (0), @@ -1020,7 +1020,7 @@ TextureLoadTaskClass::TextureLoadTaskClass() // is done by Init() and Deinit(). for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; LockedSurfacePitch[i] = 0; } } @@ -1038,7 +1038,7 @@ TextureLoadTaskClass *TextureLoadTaskClass::Create(TextureBaseClass *tc, TaskTyp // and priority, then associate the texture with the task. // pull a load task from front of free list - TextureLoadTaskClass *task = NULL; + TextureLoadTaskClass *task = nullptr; switch (tc->Get_Asset_Type()) { case TextureBaseClass::TEX_REGULAR : task=_TexLoadFreeList.Pop_Front(); break; @@ -1101,7 +1101,7 @@ void TextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, PriorityTyp Priority = priority; State = STATE_NONE; - D3DTexture = 0; + D3DTexture = nullptr; TextureClass* tex=Texture->As_TextureClass(); @@ -1123,19 +1123,19 @@ void TextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, PriorityTyp for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; LockedSurfacePitch[i] = 0; } switch (Type) { case TASK_THUMBNAIL: - WWASSERT(Texture->ThumbnailLoadTask == NULL); + WWASSERT(Texture->ThumbnailLoadTask == nullptr); Texture->ThumbnailLoadTask = this; break; case TASK_LOAD: - WWASSERT(Texture->TextureLoadTask == NULL); + WWASSERT(Texture->TextureLoadTask == nullptr); Texture->TextureLoadTask = this; break; } @@ -1145,25 +1145,25 @@ void TextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, PriorityTyp void TextureLoadTaskClass::Deinit() { // task should not be on any list when it is being detached from texture. - WWASSERT(Next == NULL); - WWASSERT(Prev == NULL); + WWASSERT(Next == nullptr); + WWASSERT(Prev == nullptr); - WWASSERT(D3DTexture == NULL); + WWASSERT(D3DTexture == nullptr); for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - WWASSERT(LockedSurfacePtr[i] == NULL); + WWASSERT(LockedSurfacePtr[i] == nullptr); } if (Texture) { switch (Type) { case TASK_THUMBNAIL: WWASSERT(Texture->ThumbnailLoadTask == this); - Texture->ThumbnailLoadTask = NULL; + Texture->ThumbnailLoadTask = nullptr; break; case TASK_LOAD: WWASSERT(Texture->TextureLoadTask == this); - Texture->TextureLoadTask = NULL; + Texture->TextureLoadTask = nullptr; break; } @@ -1287,13 +1287,13 @@ void TextureLoadTaskClass::Apply(bool initialize) // Verify that none of the mip levels are locked for (unsigned i=0;iApply_New_Surface(D3DTexture, initialize); D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } static bool Get_Texture_Information @@ -1786,7 +1786,7 @@ void TextureLoadTaskClass::Lock_Surfaces(void) ( i, &locked_rect, - NULL, + nullptr, 0 ) ); @@ -1805,7 +1805,7 @@ void TextureLoadTaskClass::Unlock_Surfaces(void) WWASSERT(ThreadClass::_Get_Current_Thread_ID() == DX8Wrapper::_Get_Main_Thread_ID()); DX8_ErrorCode(Peek_D3D_Texture()->UnlockRect(i)); } - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; } #ifndef USE_MANAGED_TEXTURES @@ -1899,7 +1899,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) } unsigned char * src_surface = (unsigned char*)targa.GetImage(); - unsigned char * converted_surface = NULL; + unsigned char * converted_surface = nullptr; // No paletted format allowed when generating mipmaps Vector3 hsv_shift=HSVShift; @@ -1956,7 +1956,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) src_height, src_pitch, src_format, - NULL, + nullptr, 0, true, hsv_shift); @@ -1982,7 +1982,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) src_height, src_pitch, src_format, - NULL, + nullptr, 0, true, hsv_shift); @@ -2042,7 +2042,7 @@ CubeTextureLoadTaskClass::CubeTextureLoadTaskClass() { for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedCubeSurfacePtr[f][i] = NULL; + LockedCubeSurfacePtr[f][i] = nullptr; LockedCubeSurfacePitch[f][i] = 0; } } @@ -2071,7 +2071,7 @@ void CubeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Priorit Priority = priority; State = STATE_NONE; - D3DTexture = 0; + D3DTexture = nullptr; CubeTextureClass* tex=Texture->As_CubeTextureClass(); @@ -2095,7 +2095,7 @@ void CubeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Priorit { for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedCubeSurfacePtr[f][i] = NULL; + LockedCubeSurfacePtr[f][i] = nullptr; LockedCubeSurfacePitch[f][i] = 0; } } @@ -2103,12 +2103,12 @@ void CubeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Priorit switch (Type) { case TASK_THUMBNAIL: - WWASSERT(Texture->ThumbnailLoadTask == NULL); + WWASSERT(Texture->ThumbnailLoadTask == nullptr); Texture->ThumbnailLoadTask = this; break; case TASK_LOAD: - WWASSERT(Texture->TextureLoadTask == NULL); + WWASSERT(Texture->TextureLoadTask == nullptr); Texture->TextureLoadTask = this; break; } @@ -2118,16 +2118,16 @@ void CubeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Priorit void CubeTextureLoadTaskClass::Deinit() { // task should not be on any list when it is being detached from texture. - WWASSERT(Next == NULL); - WWASSERT(Prev == NULL); + WWASSERT(Next == nullptr); + WWASSERT(Prev == nullptr); - WWASSERT(D3DTexture == NULL); + WWASSERT(D3DTexture == nullptr); for (int f=0; f<6; f++) { for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - WWASSERT(LockedCubeSurfacePtr[f][i] == NULL); + WWASSERT(LockedCubeSurfacePtr[f][i] == nullptr); } } @@ -2137,12 +2137,12 @@ void CubeTextureLoadTaskClass::Deinit() { case TASK_THUMBNAIL: WWASSERT(Texture->ThumbnailLoadTask == this); - Texture->ThumbnailLoadTask = NULL; + Texture->ThumbnailLoadTask = nullptr; break; case TASK_LOAD: WWASSERT(Texture->TextureLoadTask == this); - Texture->TextureLoadTask = NULL; + Texture->TextureLoadTask = nullptr; break; } @@ -2166,7 +2166,7 @@ void CubeTextureLoadTaskClass::Lock_Surfaces(void) (D3DCUBEMAP_FACES)f, i, &locked_rect, - NULL, + nullptr, 0 ) ); @@ -2190,7 +2190,7 @@ void CubeTextureLoadTaskClass::Unlock_Surfaces(void) Peek_D3D_Cube_Texture()->UnlockRect((D3DCUBEMAP_FACES)f,i) ); } - LockedCubeSurfacePtr[f][i] = NULL; + LockedCubeSurfacePtr[f][i] = nullptr; } } @@ -2454,7 +2454,7 @@ VolumeTextureLoadTaskClass::VolumeTextureLoadTaskClass() for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; LockedSurfacePitch[i] = 0; LockedSurfaceSlicePitch[i] = 0; } @@ -2482,7 +2482,7 @@ void VolumeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Prior Priority = priority; State = STATE_NONE; - D3DTexture = 0; + D3DTexture = nullptr; VolumeTextureClass* tex=Texture->As_VolumeTextureClass(); @@ -2505,7 +2505,7 @@ void VolumeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Prior for (int i = 0; i < MIP_LEVELS_MAX; ++i) { - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; LockedSurfacePitch[i] = 0; LockedSurfaceSlicePitch[i] = 0; } @@ -2513,12 +2513,12 @@ void VolumeTextureLoadTaskClass::Init(TextureBaseClass* tc, TaskType type, Prior switch (Type) { case TASK_THUMBNAIL: - WWASSERT(Texture->ThumbnailLoadTask == NULL); + WWASSERT(Texture->ThumbnailLoadTask == nullptr); Texture->ThumbnailLoadTask = this; break; case TASK_LOAD: - WWASSERT(Texture->TextureLoadTask == NULL); + WWASSERT(Texture->TextureLoadTask == nullptr); Texture->TextureLoadTask = this; break; } @@ -2535,7 +2535,7 @@ void VolumeTextureLoadTaskClass::Lock_Surfaces() ( i, &locked_box, - NULL, + nullptr, 0 ) ); @@ -2558,7 +2558,7 @@ void VolumeTextureLoadTaskClass::Unlock_Surfaces() Peek_D3D_Volume_Texture()->UnlockBox(i) ); } - LockedSurfacePtr[i] = NULL; + LockedSurfacePtr[i] = nullptr; } #ifndef USE_MANAGED_TEXTURES diff --git a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h index 38104d6495a..66c8576f14d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h @@ -78,7 +78,7 @@ class TextureLoader static void Request_Foreground_Loading(TextureBaseClass* tc); static void Flush_Pending_Load_Tasks(void); - static void Update(void(*network_callback)(void) = NULL); + static void Update(void(*network_callback)(void) = nullptr); // returns true if current thread of execution is allowed to make DX8 calls. static bool Is_DX8_Thread(void); @@ -134,10 +134,10 @@ class TextureLoadTaskListClass // Add a task to end of list void Push_Back (TextureLoadTaskClass *task); - // Remove and return a task from beginning of list, or NULL if list is empty. + // Remove and return a task from beginning of list, or null if list is empty. TextureLoadTaskClass * Pop_Front (void); - // Remove and return a task from end of list, or NULL if list is empty + // Remove and return a task from end of list, or null if list is empty TextureLoadTaskClass * Pop_Back (void); // Remove specified task from list, if present diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp b/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp index 03c803491af..5d05da9d44b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp @@ -102,7 +102,7 @@ ThumbnailClass::ThumbnailClass( ThumbnailClass::ThumbnailClass(ThumbnailManagerClass* manager, const StringClass& filename) : Manager(manager), - Bitmap(0), + Bitmap(nullptr), Name(filename), Allocated(false), Width(0), @@ -259,7 +259,7 @@ ThumbnailClass::~ThumbnailClass() // ---------------------------------------------------------------------------- ThumbnailManagerClass::ThumbnailManagerClass(const char* thumbnail_filename) : - ThumbnailMemory(NULL), + ThumbnailMemory(nullptr), ThumbnailFileName(thumbnail_filename), PerTextureTimeStampUsed(false), Changed(false), @@ -279,7 +279,7 @@ ThumbnailManagerClass::~ThumbnailManagerClass() } delete[] ThumbnailMemory; - ThumbnailMemory=NULL; + ThumbnailMemory=nullptr; } // ---------------------------------------------------------------------------- @@ -292,7 +292,7 @@ ThumbnailManagerClass* ThumbnailManagerClass::Peek_Thumbnail_Manager(const char* } if (GlobalThumbnailManager && GlobalThumbnailManager->ThumbnailFileName==thumbnail_filename) return GlobalThumbnailManager; - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -326,7 +326,7 @@ void ThumbnailManagerClass::Remove_Thumbnail_Manager(const char* thumbnail_filen if (GlobalThumbnailManager && GlobalThumbnailManager->ThumbnailFileName==thumbnail_filename) { delete GlobalThumbnailManager; - GlobalThumbnailManager=NULL; + GlobalThumbnailManager=nullptr; } } // ---------------------------------------------------------------------------- @@ -359,13 +359,13 @@ ThumbnailClass* ThumbnailManagerClass::Peek_Thumbnail_Instance_From_Any_Manager( ThumbnailClass* thumb=new ThumbnailClass(GlobalThumbnailManager,filename); if (!thumb->Peek_Bitmap()) { delete thumb; - thumb=NULL; + thumb=nullptr; } return thumb; } } - return NULL; + return nullptr; } @@ -394,7 +394,7 @@ void ThumbnailManagerClass::Remove_From_Hash(ThumbnailClass* thumb) void ThumbnailManagerClass::Init() { - WWASSERT(GlobalThumbnailManager == NULL); + WWASSERT(GlobalThumbnailManager == nullptr); GlobalThumbnailManager=new ThumbnailManagerClass(GLOBAL_THUMBNAIL_MANAGER_FILENAME); GlobalThumbnailManager->Enable_Per_Texture_Time_Stamp(true); } @@ -406,5 +406,5 @@ void ThumbnailManagerClass::Deinit() } delete GlobalThumbnailManager; - GlobalThumbnailManager=NULL; + GlobalThumbnailManager=nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp b/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp index 5c4bf51f9e9..413c0d0e253 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp @@ -145,7 +145,7 @@ static VisPolyClass _VisPoly1; VisRasterizerClass::VisRasterizerClass(void) : ModelTransform(1), - Camera(NULL), + Camera(nullptr), MVTransform(1) { } @@ -179,7 +179,7 @@ void VisRasterizerClass::Set_Camera(CameraClass * camera) CameraClass * VisRasterizerClass::Get_Camera(void) { - if (Camera != NULL) { + if (Camera != nullptr) { Camera->Add_Ref(); } return Camera; @@ -228,8 +228,8 @@ bool VisRasterizerClass::Render_Triangles AABoxClass & bounds ) { - WWASSERT(verts != NULL); - WWASSERT(tris != NULL); + WWASSERT(verts != nullptr); + WWASSERT(tris != nullptr); WWASSERT(vcount > 0); WWASSERT(tcount > 0); @@ -375,8 +375,8 @@ IDBufferClass::IDBufferClass(void) : PixelCounter(0), ResWidth(0), ResHeight(0), - IDBuffer(NULL), - ZBuffer(NULL) + IDBuffer(nullptr), + ZBuffer(nullptr) { } @@ -399,17 +399,17 @@ void IDBufferClass::Set_Resolution(int w,int h) void IDBufferClass::Get_Resolution(int * get_w,int * get_h) { - if (get_w != NULL) { *get_w = ResWidth; } - if (get_h != NULL) { *get_h = ResHeight; } + if (get_w != nullptr) { *get_w = ResWidth; } + if (get_h != nullptr) { *get_h = ResHeight; } } void IDBufferClass::Reset(void) { delete[] IDBuffer; - IDBuffer = NULL; + IDBuffer = nullptr; delete[] ZBuffer; - ZBuffer = NULL; + ZBuffer = nullptr; PixelCounter = 0; } @@ -431,8 +431,8 @@ void IDBufferClass::Clear(void) if ((ResWidth > 0) && (ResHeight > 0)) { int byte_count = ResWidth * ResWidth * sizeof(uint32); - WWASSERT(IDBuffer != NULL); - WWASSERT(ZBuffer != NULL); + WWASSERT(IDBuffer != nullptr); + WWASSERT(ZBuffer != nullptr); memset(IDBuffer,0,byte_count); memset(ZBuffer,0,byte_count); } @@ -511,7 +511,7 @@ struct EdgeStruct bool IDBufferClass::Render_Triangle(const Vector3 & p0,const Vector3 & p1,const Vector3 & p2) { - if ((ZBuffer == NULL) || (IDBuffer == NULL)) { + if ((ZBuffer == nullptr) || (IDBuffer == nullptr)) { return false; } @@ -593,8 +593,8 @@ bool IDBufferClass::Render_Triangle(const Vector3 & p0,const Vector3 & p1,const EdgeStruct top_to_middle_edge(grads,points,top,middle); EdgeStruct middle_to_bottom_edge(grads,points,middle,bottom); - EdgeStruct * left_edge = NULL; - EdgeStruct * right_edge = NULL; + EdgeStruct * left_edge = nullptr; + EdgeStruct * right_edge = nullptr; bool middle_is_left = false; if (bottom_for_compare > middle_for_compare) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp index 415b9fb8c53..5999cef031e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/w3d_dep.cpp @@ -109,7 +109,7 @@ bool Get_W3D_Dependencies (const char *w3d_filename, StringList &files) file->Open(); if ( ! file->Is_Open()) { _TheFileFactory->Return_File(file); - file=NULL; + file=nullptr; return false; } } else { @@ -131,7 +131,7 @@ bool Get_W3D_Dependencies (const char *w3d_filename, StringList &files) // Close the file. file->Close(); _TheFileFactory->Return_File(file); - file=NULL; + file=nullptr; // Sort the set of filenames, and remove any duplicates. files.sort(); @@ -275,7 +275,7 @@ static void Scan_Mesh_Textures (ChunkLoadClass &cload, StringList &files, const // We're interested in the TEXTURE_NAME sub-chunk. if (cload.Cur_Chunk_ID() == W3D_CHUNK_TEXTURE_NAME) { - // This chunk's data is a NULL-terminated string + // This chunk's data is a null-terminated string // which is the texture filename. Read it and // add it to the list of files referred to. char texture[_MAX_PATH]; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/w3d_obsolete.h b/Core/Libraries/Source/WWVegas/WW3D2/w3d_obsolete.h index eb9a537f99d..b6d268ad94b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/w3d_obsolete.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/w3d_obsolete.h @@ -80,9 +80,9 @@ enum ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterialStruct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; @@ -94,9 +94,9 @@ struct W3dMaterialStruct ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterial2Struct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/w3dexclusionlist.cpp b/Core/Libraries/Source/WWVegas/WW3D2/w3dexclusionlist.cpp index 800158e9456..68da606cdcc 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/w3dexclusionlist.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/w3dexclusionlist.cpp @@ -61,13 +61,13 @@ bool W3DExclusionListClass::Is_Excluded(PrototypeClass * proto) const char * root_name = copy.Peek_Buffer(); // don't preserve munged prototypes - if (strchr(root_name,'#') != NULL) { + if (strchr(root_name,'#') != nullptr) { return false; } // chop off the sub-object name if present ( char * tmp = strchr(root_name,'.'); - if (tmp != NULL) { + if (tmp != nullptr) { *tmp = 0; } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h b/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h index e5e41826521..bd97c067b34 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h @@ -53,7 +53,7 @@ class AABTreeSoundCullClass : public AABTreeCullClass // Public constructors/destructors ////////////////////////////////////////////////////////////////////// AABTreeSoundCullClass (void) - : AABTreeCullClass (NULL) { } + : AABTreeCullClass (nullptr) { } virtual ~AABTreeSoundCullClass (void) { } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp index 19f416d4903..caff7eba3a8 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp @@ -138,12 +138,12 @@ namespace AUDIBLE_SOUND_DEF_SAVELOAD AudibleSoundClass::AudibleSoundClass (void) : m_Priority (0.5F), m_RuntimePriority (0), - m_SoundHandle (NULL), + m_SoundHandle (nullptr), m_Length (0), m_CurrentPosition (0), m_Timestamp (0), m_State (STATE_STOPPED), - m_Buffer (NULL), + m_Buffer (nullptr), m_Volume (1.0F), m_Pan (0.5F), m_LoopCount (1), @@ -152,12 +152,12 @@ AudibleSoundClass::AudibleSoundClass (void) m_bDirty (true), m_DropOffRadius (1), m_IsCulled (true), - m_pConvertedFormat (NULL), + m_pConvertedFormat (nullptr), m_PrevTransform (1), m_Transform (1), m_ListenerTransform (1), - m_Definition (NULL), - m_LogicalSound (NULL), + m_Definition (nullptr), + m_LogicalSound (nullptr), m_StartOffset (0), m_PitchFactor (1.0F) { @@ -173,12 +173,12 @@ AudibleSoundClass::AudibleSoundClass (void) AudibleSoundClass::AudibleSoundClass (const AudibleSoundClass &src) : m_Priority (0.5F), m_RuntimePriority (0), - m_SoundHandle (NULL), + m_SoundHandle (nullptr), m_Length (0), m_CurrentPosition (0), m_Timestamp (0), m_State (STATE_STOPPED), - m_Buffer (NULL), + m_Buffer (nullptr), m_Volume (1.0F), m_Pan (0.5F), m_LoopCount (1), @@ -187,11 +187,11 @@ AudibleSoundClass::AudibleSoundClass (const AudibleSoundClass &src) m_bDirty (true), m_DropOffRadius (1), m_IsCulled (true), - m_pConvertedFormat (NULL), + m_pConvertedFormat (nullptr), m_PrevTransform (1), m_Transform (1), - m_Definition (NULL), - m_LogicalSound (NULL), + m_Definition (nullptr), + m_LogicalSound (nullptr), m_StartOffset (0), m_PitchFactor (1.0F) { @@ -215,9 +215,9 @@ AudibleSoundClass::~AudibleSoundClass (void) // Delay the release of the buffer (fixes a sync bug // with Miles internals). // - if (m_Buffer != NULL) { + if (m_Buffer != nullptr) { WWAudioThreadsClass::Add_Delayed_Release_Object (m_Buffer); - m_Buffer = NULL; + m_Buffer = nullptr; } Free_Miles_Handle (); @@ -269,9 +269,9 @@ AudibleSoundClass::Set_Buffer (SoundBufferClass *buffer) // Delay the release of the buffer (fixes a sync bug // with Miles internals). // - if (m_Buffer != NULL) { + if (m_Buffer != nullptr) { WWAudioThreadsClass::Add_Delayed_Release_Object (m_Buffer); - m_Buffer = NULL; + m_Buffer = nullptr; } REF_PTR_SET (m_Buffer, buffer); @@ -282,7 +282,7 @@ AudibleSoundClass::Set_Buffer (SoundBufferClass *buffer) } // Get the time (in ms) that this buffer will play for... - if (m_Buffer != NULL) { + if (m_Buffer != nullptr) { m_Length = m_Buffer->Get_Duration (); } @@ -337,7 +337,7 @@ AudibleSoundClass::Play (bool alloc_handle) MMSLockClass lock; // If we don't have a valid handle already, try to get one from miles - if (alloc_handle && (m_pConvertedFormat == NULL)) { + if (alloc_handle && (m_pConvertedFormat == nullptr)) { Allocate_Miles_Handle (); } @@ -349,7 +349,7 @@ AudibleSoundClass::Play (bool alloc_handle) m_LoopsLeft = m_LoopCount; // If we have a valid handle, then start playing the sample - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Start_Sample (); } @@ -365,14 +365,14 @@ AudibleSoundClass::Play (bool alloc_handle) // // Create the associate logical sound (if necessary) // - if (m_LogicalSound == NULL && m_Definition != NULL) { + if (m_LogicalSound == nullptr && m_Definition != nullptr) { m_LogicalSound = m_Definition->Create_Logical (); } // // Add this logical sound to the scene // - if (m_LogicalSound != NULL) { + if (m_LogicalSound != nullptr) { m_LogicalSound->Set_User_Data (m_UserObj, m_UserData); m_LogicalSound->Set_Transform (m_Transform); m_LogicalSound->Add_To_Scene (); @@ -381,7 +381,7 @@ AudibleSoundClass::Play (bool alloc_handle) // // Should we send off the text notification? // - if (m_IsCulled == false && m_Definition != NULL) { + if (m_IsCulled == false && m_Definition != nullptr) { const StringClass &text = m_Definition->Get_Display_Text (); WWAudioClass::Get_Instance ()->Fire_Text_Callback (this, text); } @@ -407,7 +407,7 @@ AudibleSoundClass::Pause (void) if (m_State == STATE_PLAYING) { // Pass the pause request onto miles - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Stop_Sample (); } @@ -437,7 +437,7 @@ AudibleSoundClass::Resume (void) if (m_State == STATE_PAUSED) { // Pass the resume request onto miles - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Resume_Sample (); } @@ -468,7 +468,7 @@ AudibleSoundClass::Stop (bool remove_from_playlist) (m_State == STATE_PLAYING)) { // Actually stop the sample from playing - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Stop_Sample (); } @@ -488,7 +488,7 @@ AudibleSoundClass::Stop (bool remove_from_playlist) // // Stop the logical portion of the sound // - if (m_LogicalSound != NULL && m_LogicalSound->Is_Single_Shot () == false) { + if (m_LogicalSound != nullptr && m_LogicalSound->Is_Single_Shot () == false) { m_LogicalSound->Remove_From_Scene (); } } @@ -518,7 +518,7 @@ AudibleSoundClass::Seek (unsigned long milliseconds) } // Update the actual sound data if we are playing the sound - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Set_Sample_MS_Position (m_CurrentPosition); } } @@ -543,7 +543,7 @@ AudibleSoundClass::Set_Miles_Handle (MILES_HANDLE handle) // // Is our data valid? // - if (handle != INVALID_MILES_HANDLE && m_Buffer != NULL) { + if (handle != INVALID_MILES_HANDLE && m_Buffer != nullptr) { // // Determine which type of sound handle to create, streaming or standard 2D @@ -587,7 +587,7 @@ AudibleSoundClass::Initialize_Miles_Handle (void) } // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Initialize the handle @@ -597,7 +597,7 @@ AudibleSoundClass::Initialize_Miles_Handle (void) // // Record the total length of the sample in milliseconds... // - m_SoundHandle->Get_Sample_MS_Position ((S32 *)&m_Length, NULL); + m_SoundHandle->Get_Sample_MS_Position ((S32 *)&m_Length, nullptr); // // Pass our cached settings onto miles @@ -655,24 +655,24 @@ AudibleSoundClass::Free_Miles_Handle (void) MMSLockClass lock; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Release our hold on this handle // - m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, NULL); + m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, nullptr); m_SoundHandle->End_Sample (); // // Remove the association between file handle and AudibleSoundClass object // - //m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, NULL); + //m_SoundHandle->Set_Sample_User_Data (INFO_OBJECT_PTR, nullptr); // // Free the sound handle object // delete m_SoundHandle; - m_SoundHandle = NULL; + m_SoundHandle = nullptr; } return ; @@ -692,7 +692,7 @@ AudibleSoundClass::Get_Pan (void) // // Do we have a valid sample handle from miles? // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_Pan = ((float)m_SoundHandle->Get_Sample_Pan ()) / 127.0F; } @@ -719,7 +719,7 @@ AudibleSoundClass::Set_Pan (float pan) // // Do we have a valid sample handle from miles? // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Set_Sample_Pan (int(m_Pan * 127.0F)); } @@ -742,9 +742,9 @@ AudibleSoundClass::Set_Pitch_Factor (float factor) // // Do we have a valid sample handle from miles? // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { - if (m_Buffer != NULL) { + if (m_Buffer != nullptr) { // // Get the base rate of the sound and scale our playback rate @@ -772,7 +772,7 @@ AudibleSoundClass::Get_Playback_Rate (void) int retval = 0; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { retval = m_SoundHandle->Get_Sample_Playback_Rate (); } @@ -791,7 +791,7 @@ AudibleSoundClass::Set_Playback_Rate (int rate_in_hz) MMSLockClass lock; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Set_Sample_Playback_Rate (rate_in_hz); } @@ -810,7 +810,7 @@ AudibleSoundClass::Get_Volume (void) MMSLockClass lock; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_Volume = ((float)m_SoundHandle->Get_Sample_Volume ()) / 127.0F; } @@ -834,7 +834,7 @@ AudibleSoundClass::Set_Volume (float volume) m_Volume = max (m_Volume, 0.0F); // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // Calculate the 'real' volume to set based on the global volume and the sound // effect volume. @@ -872,7 +872,7 @@ AudibleSoundClass::Set_Loop_Count (int count) m_LoopCount = count; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { m_SoundHandle->Set_Sample_Loop_Count (m_LoopCount); } @@ -915,14 +915,14 @@ AudibleSoundClass::On_Frame_Update (unsigned int milliseconds) Update_Play_Position (); } - if (m_pConvertedFormat != NULL) { + if (m_pConvertedFormat != nullptr) { m_pConvertedFormat->Re_Sync (*this); } // // Move the logical sound with the audible one... // - if (m_LogicalSound != NULL) { + if (m_LogicalSound != nullptr) { m_LogicalSound->Set_Transform (m_Transform); } @@ -973,7 +973,7 @@ AudibleSoundClass::Allocate_Miles_Handle (void) // // If we need to, get a play-handle from the audio system // - if (m_SoundHandle == NULL) { + if (m_SoundHandle == nullptr) { Set_Miles_Handle ((MILES_HANDLE)WWAudioClass::Get_Instance ()->Get_2D_Sample (*this)); } @@ -994,7 +994,7 @@ AudibleSoundClass::On_Loop_End (void) // Let the audio system know that we are done with this sound Stop (); - if (m_Scene != NULL) { + if (m_Scene != nullptr) { Remove_From_Scene (); } @@ -1039,8 +1039,8 @@ AudibleSoundClass::Determine_Real_Volume (void) const LPCTSTR AudibleSoundClass::Get_Filename (void) const { - LPCTSTR filename = NULL; - if (m_Buffer != NULL) { + LPCTSTR filename = nullptr; + if (m_Buffer != nullptr) { filename = m_Buffer->Get_Filename (); } @@ -1067,7 +1067,7 @@ AudibleSoundClass::Cull_Sound (bool culled) // Note: We also free the handle if a converted form // of the sound is currently playing. // - if (m_IsCulled || (m_pConvertedFormat != NULL)) { + if (m_IsCulled || (m_pConvertedFormat != nullptr)) { Free_Miles_Handle (); } else { Allocate_Miles_Handle (); @@ -1118,7 +1118,7 @@ void AudibleSoundClass::Add_To_Scene (bool start_playing) { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if ((scene != NULL) && (m_Scene == NULL)) { + if ((scene != nullptr) && (m_Scene == nullptr)) { // // Add this sound to the static culling system @@ -1139,14 +1139,14 @@ AudibleSoundClass::Add_To_Scene (bool start_playing) void AudibleSoundClass::Remove_From_Scene (void) { - if (m_Scene != NULL) { + if (m_Scene != nullptr) { // // Remove this sound from the static culling system // m_Scene->Remove_Static_Sound (this); - m_Scene = NULL; - m_PhysWrapper = NULL; + m_Scene = nullptr; + m_PhysWrapper = nullptr; } return ; @@ -1209,7 +1209,7 @@ AudibleSoundClass::Re_Sync (AudibleSoundClass &src) void AudibleSoundClass::Free_Conversion (void) { - if (m_pConvertedFormat != NULL) { + if (m_pConvertedFormat != nullptr) { m_pConvertedFormat->Stop (); REF_PTR_RELEASE (m_pConvertedFormat); } @@ -1233,7 +1233,7 @@ AudibleSoundClass::Free_Conversion (void) void AudibleSoundClass::Convert_To_Filtered (void) { - if (m_pConvertedFormat == NULL) { + if (m_pConvertedFormat == nullptr) { // // Make a copy of the sound in its new format @@ -1273,7 +1273,7 @@ AudibleSoundClass::Convert_To_Filtered (void) AudibleSoundClass * AudibleSoundClass::As_Converted_Format (void) { - if (m_pConvertedFormat == NULL) { + if (m_pConvertedFormat == nullptr) { Convert_To_Filtered (); } @@ -1382,7 +1382,7 @@ AudibleSoundDefinitionClass::Initialize_From_Sound (AudibleSoundClass *sound) // // Read the settings from the sound object // - if (sound != NULL) { + if (sound != nullptr) { Sound3DClass *sound_3d = sound->As_Sound3DClass (); // @@ -1402,14 +1402,14 @@ AudibleSoundDefinitionClass::Initialize_From_Sound (AudibleSoundClass *sound) m_Filename = sound->Get_Filename (); m_DropOffRadius = sound->Get_DropOff_Radius (); m_Priority = sound->Peek_Priority (); - m_Is3D = (sound_3d != NULL); + m_Is3D = (sound_3d != nullptr); m_Type = sound->Get_Type (); m_LoopCount = sound->Get_Loop_Count (); m_Volume = sound->Get_Volume (); m_StartOffset = sound->Get_Start_Offset (); m_PitchFactor = sound->Get_Pitch_Factor (); - if (sound_3d != NULL) { + if (sound_3d != nullptr) { m_MaxVolRadius = sound_3d->Get_Max_Vol_Radius (); } } @@ -1582,7 +1582,7 @@ AudibleSoundDefinitionClass::Create (void) const AudibleSoundClass * AudibleSoundDefinitionClass::Create_Sound (int classid_hint) const { - AudibleSoundClass *new_sound = NULL; + AudibleSoundClass *new_sound = nullptr; // // If this is a relative path, strip it off and assume @@ -1590,7 +1590,7 @@ AudibleSoundDefinitionClass::Create_Sound (int classid_hint) const // StringClass real_filename(m_Filename,true); const char *dir_delimiter = ::strrchr (m_Filename, '\\'); - if (dir_delimiter != NULL && m_Filename.Get_Length () > 2 && m_Filename[1] != ':') { + if (dir_delimiter != nullptr && m_Filename.Get_Length () > 2 && m_Filename[1] != ':') { real_filename = (dir_delimiter + 1); } @@ -1606,7 +1606,7 @@ AudibleSoundDefinitionClass::Create_Sound (int classid_hint) const // // Did we successfully create the sound? // - if (new_sound != NULL) { + if (new_sound != nullptr) { // // Configure the sound @@ -1637,7 +1637,7 @@ AudibleSoundDefinitionClass::Create_Sound (int classid_hint) const LogicalSoundClass * AudibleSoundDefinitionClass::Create_Logical (void) { - LogicalSoundClass *logical_sound = NULL; + LogicalSoundClass *logical_sound = nullptr; if (m_CreateLogical) { @@ -1699,7 +1699,7 @@ AudibleSoundClass::Save (ChunkSaveClass &csave) WRITE_MICRO_CHUNK (csave, VARID_PITCH_FACTOR, m_PitchFactor); WRITE_MICRO_CHUNK (csave, VARID_LISTENER_TRANSFORM, m_ListenerTransform); - if (m_Buffer != NULL) { + if (m_Buffer != nullptr) { WRITE_MICRO_CHUNK_STRING (csave, VARID_FILENAME, m_Buffer->Get_Filename ()); } @@ -1761,7 +1761,7 @@ AudibleSoundClass::Load (ChunkLoadClass &cload) case VARID_THIS_PTR: { - AudibleSoundClass *old_ptr = NULL; + AudibleSoundClass *old_ptr = nullptr; cload.Read(&old_ptr, sizeof (old_ptr)); SaveLoadSystemClass::Register_Pointer (old_ptr, this); } @@ -1781,7 +1781,7 @@ AudibleSoundClass::Load (ChunkLoadClass &cload) // Reconstruct the sound buffer we had before we saved // if (!filename.Is_Empty()) { - bool is_3d = (As_Sound3DClass () != NULL); + bool is_3d = (As_Sound3DClass () != nullptr); SoundBufferClass *buffer = WWAudioClass::Get_Instance ()->Get_Sound_Buffer (filename, is_3d); Set_Buffer (buffer); REF_PTR_RELEASE (buffer); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h b/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h index 0a268f93f4a..3141ff21630 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h @@ -129,7 +129,7 @@ struct AUDIO_CALLBACK_STRUCT uint32 user_data; AUDIO_CALLBACK_STRUCT (void) - : callback_ptr (NULL), user_data (0) {} + : callback_ptr (nullptr), user_data (0) {} AUDIO_CALLBACK_STRUCT (T _ptr, uint32 _data) : callback_ptr (_ptr), user_data (_data) {} @@ -182,7 +182,7 @@ AudioCallbackListClass::Add_Callback (T pointer, uint32 user_data) template T AudioCallbackListClass::Get_Callback (int index, uint32 *user_data) { - if (user_data != NULL) { + if (user_data != nullptr) { (*user_data) = Vector[index].user_data; } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudioSaveLoad.cpp b/Core/Libraries/Source/WWVegas/WWAudio/AudioSaveLoad.cpp index 3915556f3c0..af93ac2c62a 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudioSaveLoad.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudioSaveLoad.cpp @@ -112,7 +112,7 @@ StaticAudioSaveLoadClass::Save (ChunkSaveClass &csave) // Save the static sounds // SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if (scene != NULL) { + if (scene != nullptr) { csave.Begin_Chunk (CHUNKID_STATIC_SCENE); scene->Save_Static (csave); csave.End_Chunk (); @@ -142,7 +142,7 @@ StaticAudioSaveLoadClass::Load (ChunkLoadClass &cload) case CHUNKID_STATIC_SCENE: { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if (scene != NULL) { + if (scene != nullptr) { scene->Load_Static (cload); } } @@ -202,7 +202,7 @@ DynamicAudioSaveLoadClass::Save (ChunkSaveClass &csave) // Save the static sounds // SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if (scene != NULL) { + if (scene != nullptr) { csave.Begin_Chunk (CHUNKID_DYNAMIC_VARIABLES); float global_scale = LogicalListenerClass::Get_Global_Scale (); @@ -261,7 +261,7 @@ DynamicAudioSaveLoadClass::Load (ChunkLoadClass &cload) case CHUNKID_DYNAMIC_SCENE: { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if (scene != NULL) { + if (scene != nullptr) { scene->Load_Dynamic (cload); } } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp index 4228bb65b09..12be84b2cfc 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/FilteredSound.cpp @@ -112,7 +112,7 @@ FilteredSoundClass::Initialize_Miles_Handle (void) { SoundPseudo3DClass::Initialize_Miles_Handle (); m_hFilter = WWAudioClass::Get_Instance ()->Get_Reverb_Filter (); - if ((m_SoundHandle != NULL) && + if ((m_SoundHandle != nullptr) && (m_hFilter != (HPROVIDER)INVALID_MILES_HANDLE)) { // @@ -152,12 +152,12 @@ FilteredSoundClass::Initialize_Miles_Handle (void) void FilteredSoundClass::Update_Volume (void) { - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // Determine the listener's position and the sound's position SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); Listener3DClass *listener = scene->Peek_2nd_Listener (); - if (listener != NULL) { + if (listener != nullptr) { Vector3 listener_pos = listener->Get_Position (); Vector3 sound_pos = m_Transform.Get_Translation (); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp b/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp index 9797e5e8989..1a3cdf4a2e3 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Listener.cpp @@ -75,7 +75,7 @@ Listener3DClass::Initialize_Miles_Handle (void) MMSLockClass lock; // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { ::AIL_set_3D_position (m_SoundHandle->Get_H3DSAMPLE (), 0.0F, 0.0F, 0.0F); ::AIL_set_3D_orientation (m_SoundHandle->Get_H3DSAMPLE (), diff --git a/Core/Libraries/Source/WWVegas/WWAudio/LogicalListener.cpp b/Core/Libraries/Source/WWVegas/WWAudio/LogicalListener.cpp index d9227a7578b..8e2b3c15580 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/LogicalListener.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/LogicalListener.cpp @@ -107,7 +107,7 @@ void LogicalListenerClass::Add_To_Scene (bool /*start_playing*/) { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if ((scene != NULL) && (m_Scene == NULL)) { + if ((scene != nullptr) && (m_Scene == nullptr)) { // // Add this listener to the culling system @@ -128,14 +128,14 @@ LogicalListenerClass::Add_To_Scene (bool /*start_playing*/) void LogicalListenerClass::Remove_From_Scene (void) { - if (m_Scene != NULL) { + if (m_Scene != nullptr) { // // Remove this listener from the culling system // m_Scene->Remove_Logical_Listener (this); - m_Scene = NULL; - m_PhysWrapper = NULL; + m_Scene = nullptr; + m_PhysWrapper = nullptr; } return ; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/LogicalSound.cpp b/Core/Libraries/Source/WWVegas/WWAudio/LogicalSound.cpp index 593e407de80..55a7c18a2ae 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/LogicalSound.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/LogicalSound.cpp @@ -104,7 +104,7 @@ void LogicalSoundClass::Add_To_Scene (bool /*start_playing*/) { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if ((scene != NULL) && (m_Scene == NULL)) { + if ((scene != nullptr) && (m_Scene == nullptr)) { // // Add this sound to the culling system @@ -125,14 +125,14 @@ LogicalSoundClass::Add_To_Scene (bool /*start_playing*/) void LogicalSoundClass::Remove_From_Scene (void) { - if (m_Scene != NULL) { + if (m_Scene != nullptr) { // // Remove this sound from the culling system // m_Scene->Remove_Logical_Sound (this, m_IsSingleShot); - m_Scene = NULL; - m_PhysWrapper = NULL; + m_Scene = nullptr; + m_PhysWrapper = nullptr; m_LastNotification = 0; } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h b/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h index a7e4fa54e39..0649522a9b1 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h @@ -67,7 +67,7 @@ template __inline bool PriorityVectorClass::Process_Head (T &object) { bool retval = false; - if (Vector != NULL) { + if (Vector != nullptr) { // Pass the object back to the caller object = Vector[0]; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp b/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp index d8870718086..18be023ab38 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp @@ -168,7 +168,7 @@ Sound3DClass::On_Frame_Update (unsigned int milliseconds) { Matrix3D prev_tm = m_PrevTransform; - if (m_bDirty && (m_PhysWrapper != NULL)) { + if (m_bDirty && (m_PhysWrapper != nullptr)) { m_Scene->Update_Sound (m_PhysWrapper); m_bDirty = false; } @@ -285,7 +285,7 @@ Sound3DClass::Update_Miles_Transform (void) // // Do we have a valid miles handle? // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Build a matrix to transform coordinates from world-space to listener-space @@ -356,7 +356,7 @@ Sound3DClass::Set_Position (const Vector3 &position) m_IsTransformInitted = true; } - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Transform the sound's position into 'listener-space' @@ -393,7 +393,7 @@ Sound3DClass::Set_Velocity (const Vector3 &velocity) // // Pass the sound's velocity onto miles // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { //WWDEBUG_SAY (("Current Velocity: %.2f %.2f %.2f", m_CurrentVelocity.X, m_CurrentVelocity.Y, m_CurrentVelocity.Z)); ::AIL_set_3D_velocity_vector (m_SoundHandle->Get_H3DSAMPLE (), @@ -420,7 +420,7 @@ Sound3DClass::Set_DropOff_Radius (float radius) Set_Dirty (); // Pass attenuation settings onto miles - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { ::AIL_set_3D_sample_distances ( m_SoundHandle->Get_H3DSAMPLE (), m_DropOffRadius, (m_MaxVolRadius > 1.0F) ? m_MaxVolRadius : 1.0F); @@ -442,7 +442,7 @@ Sound3DClass::Set_Max_Vol_Radius (float radius) Set_Dirty (); // Pass attenuation settings onto miles - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { ::AIL_set_3D_sample_distances ( m_SoundHandle->Get_H3DSAMPLE (), m_DropOffRadius, (m_MaxVolRadius > 1.0F) ? m_MaxVolRadius : 1.0F); @@ -470,7 +470,7 @@ Sound3DClass::Initialize_Miles_Handle (void) } // Do we have a valid sample handle from miles? - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Pass the actual sound data onto the sample @@ -480,7 +480,7 @@ Sound3DClass::Initialize_Miles_Handle (void) // // Record the total length of the sample in milliseconds... // - m_SoundHandle->Get_Sample_MS_Position ((S32 *)&m_Length, NULL); + m_SoundHandle->Get_Sample_MS_Position ((S32 *)&m_Length, nullptr); // // Pass our cached settings onto miles @@ -552,7 +552,7 @@ Sound3DClass::Allocate_Miles_Handle (void) // // If we need to, get a play-handle from the audio system // - if (m_SoundHandle == NULL) { + if (m_SoundHandle == nullptr) { Set_Miles_Handle ((MILES_HANDLE)WWAudioClass::Get_Instance ()->Get_3D_Sample (*this)); } @@ -569,7 +569,7 @@ void Sound3DClass::Add_To_Scene (bool start_playing) { SoundSceneClass *scene = WWAudioClass::Get_Instance ()->Get_Sound_Scene (); - if ((scene != NULL) && (m_Scene == NULL)) { + if ((scene != nullptr) && (m_Scene == nullptr)) { // Determine what culling system this sound belongs to if (m_IsStatic) { @@ -592,7 +592,7 @@ Sound3DClass::Add_To_Scene (bool start_playing) void Sound3DClass::Remove_From_Scene (void) { - if (m_Scene != NULL) { + if (m_Scene != nullptr) { // Determine what culling system this sound belongs to if (m_IsStatic) { @@ -601,8 +601,8 @@ Sound3DClass::Remove_From_Scene (void) m_Scene->Remove_Sound (this); } - m_Scene = NULL; - m_PhysWrapper = NULL; + m_Scene = nullptr; + m_PhysWrapper = nullptr; } return ; @@ -718,7 +718,7 @@ Sound3DClass::Set_Miles_Handle (MILES_HANDLE handle) // // Is our data valid? // - if (handle != INVALID_MILES_HANDLE && m_Buffer != NULL) { + if (handle != INVALID_MILES_HANDLE && m_Buffer != nullptr) { // // Configure the sound handle diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp b/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp index 3896d68c5a4..95463cbdbbc 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp @@ -67,9 +67,9 @@ static DynamicVectorClass MappingList; // SoundBufferClass // SoundBufferClass::SoundBufferClass (void) - : m_Buffer (NULL), + : m_Buffer (nullptr), m_Length (0), - m_Filename (NULL), + m_Filename (nullptr), m_Duration (0), m_Rate (0), m_Bits (0), @@ -101,7 +101,7 @@ SoundBufferClass::Free_Buffer (void) { // Free the buffer's memory delete [] m_Buffer; - m_Buffer = NULL; + m_Buffer = nullptr; // Make sure we reset the length m_Length = 0L; @@ -126,7 +126,7 @@ SoundBufferClass::Determine_Stats (unsigned char *buffer) // Attempt to get statistical information about this sound AILSOUNDINFO info = { 0 }; - if ((buffer != NULL) && (::AIL_WAV_info (buffer, &info) != 0)) { + if ((buffer != nullptr) && (::AIL_WAV_info (buffer, &info) != 0)) { // Cache this information m_Rate = info.rate; @@ -151,7 +151,7 @@ void SoundBufferClass::Set_Filename (const char *name) { SAFE_FREE (m_Filename); - if (name != NULL) { + if (name != nullptr) { m_Filename = ::strdup (name); } @@ -170,8 +170,8 @@ SoundBufferClass::Load_From_File (const char *filename) bool retval = false; // Param OK? - WWASSERT (filename != NULL); - if (filename != NULL) { + WWASSERT (filename != nullptr); + if (filename != nullptr) { // Create a file object and pass it onto the appropriate function FileClass *file=_TheFileFactory->Get_File(filename); @@ -179,7 +179,7 @@ SoundBufferClass::Load_From_File (const char *filename) retval = Load_From_File(*file); _TheFileFactory->Return_File(file); } - file=NULL; + file=nullptr; } // Return the true/false result code @@ -257,9 +257,9 @@ SoundBufferClass::Load_From_Memory Set_Filename ("unknown.wav"); // Params OK? - WWASSERT (mem_buffer != NULL); + WWASSERT (mem_buffer != nullptr); WWASSERT (size > 0L); - if ((mem_buffer != NULL) && (size > 0L)) { + if ((mem_buffer != nullptr) && (size > 0L)) { // Allocate a new buffer of the correct length and copy the contents // into the buffer diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h b/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h index 299a37aac94..2a463cdc7b9 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h @@ -58,7 +58,7 @@ class SoundCullObjClass : public MultiListObjectClass, public CullableClass // Public constructors/destructors ////////////////////////////////////////////////////////////////////// SoundCullObjClass (void) - : m_SoundObj (NULL), + : m_SoundObj (nullptr), m_Transform (1) {} virtual ~SoundCullObjClass (void) { REF_PTR_RELEASE (m_SoundObj); } @@ -106,7 +106,7 @@ __inline const Matrix3D & SoundCullObjClass::Get_Transform (void) const { // Determine the transform to use - if (m_SoundObj != NULL) { + if (m_SoundObj != nullptr) { m_Transform = m_SoundObj->Get_Transform (); } @@ -121,7 +121,7 @@ SoundCullObjClass::Set_Transform (const Matrix3D &transform) m_Transform = transform; // Pass the tranform on - if (m_SoundObj != NULL) { + if (m_SoundObj != nullptr) { m_SoundObj->Set_Transform (m_Transform); Set_Cull_Box (Get_Bounding_Box ()); } @@ -136,7 +136,7 @@ SoundCullObjClass::Set_Sound_Obj (SoundSceneObjClass *sound_obj) // Start using this sound object REF_PTR_SET (m_SoundObj, sound_obj); //m_SoundObj = sound_obj; - if (m_SoundObj != NULL) { + if (m_SoundObj != nullptr) { m_Transform = m_SoundObj->Get_Transform (); Set_Cull_Box (Get_Bounding_Box ()); } @@ -149,7 +149,7 @@ __inline const AABoxClass & SoundCullObjClass::Get_Bounding_Box (void) const { // Get the 'real' values from the - if (m_SoundObj != NULL) { + if (m_SoundObj != nullptr) { m_Transform = m_SoundObj->Get_Transform (); m_AABox.Extent.X = m_SoundObj->Get_DropOff_Radius (); m_AABox.Extent.Y = m_SoundObj->Get_DropOff_Radius (); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundPseudo3D.cpp b/Core/Libraries/Source/WWVegas/WWAudio/SoundPseudo3D.cpp index bbb8385f585..c9c602a6d1c 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundPseudo3D.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundPseudo3D.cpp @@ -140,7 +140,7 @@ SoundPseudo3DClass::Update_Pseudo_Volume (float distance) // // Only do this if the sound is really playing // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { float volume_mod = Determine_Real_Volume (); float max_distance = Get_DropOff_Radius (); @@ -179,7 +179,7 @@ SoundPseudo3DClass::Update_Pseudo_Volume (void) MMSLockClass lock; // Only do this if the sound is really playing - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Find the difference in the sound position and its listener's position @@ -210,7 +210,7 @@ SoundPseudo3DClass::Update_Pseudo_Pan (void) // // Only do this if the sound is really playing // - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { // // Transform the sound's position into 'listener-space' @@ -272,7 +272,7 @@ SoundPseudo3DClass::On_Frame_Update (unsigned int milliseconds) { // If necessary, update the volume based on the distance // from the listener - if (m_SoundHandle != NULL) { + if (m_SoundHandle != nullptr) { Update_Pseudo_Volume (); Update_Pseudo_Pan (); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp index 9a8796b29d7..f343f101bb8 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp @@ -78,8 +78,8 @@ enum // //////////////////////////////////////////////////////////////////////////////////////////////// SoundSceneClass::SoundSceneClass (void) - : m_Listener (NULL), - m_2ndListener (NULL), + : m_Listener (nullptr), + m_2ndListener (nullptr), m_MinExtents (-500, -500, -500), m_MaxExtents (500, 500, 500), m_IsBatchMode (false) @@ -152,7 +152,7 @@ SoundSceneClass::Collect_Logical_Sounds (unsigned int milliseconds, int listener } PriorityMultiListIterator priority_queue (&m_LogicalListeners); - LogicalListenerClass *listener = NULL; + LogicalListenerClass *listener = nullptr; // // Loop over as many of the listeners as we want to process this @@ -179,7 +179,7 @@ SoundSceneClass::Collect_Logical_Sounds (unsigned int milliseconds, int listener // SoundCullObjClass * cull_obj; for ( cull_obj = m_LogicalCullingSystem.Get_First_Collected_Object(); - cull_obj != NULL; + cull_obj != nullptr; cull_obj = m_LogicalCullingSystem.Get_Next_Collected_Object (cull_obj)) { // @@ -262,9 +262,9 @@ SoundSceneClass::Collect_Audible_Sounds // they are 'really' audible. The culling systems just check bounding boxes // but we need to be able to check attenuation spheres. // - SoundCullObjClass * cull_obj = NULL; + SoundCullObjClass * cull_obj = nullptr; for ( cull_obj = m_DynamicCullingSystem.Get_First_Collected_Object(); - cull_obj != NULL; + cull_obj != nullptr; cull_obj = m_DynamicCullingSystem.Get_Next_Collected_Object(cull_obj)) { // Get a pointer to the current 'cull-sound' object @@ -297,7 +297,7 @@ SoundSceneClass::Collect_Audible_Sounds // but we need to be able to check attenuation spheres. // for ( cull_obj = m_StaticCullingSystem.Get_First_Collected_Object(); - cull_obj != NULL; + cull_obj != nullptr; cull_obj = m_StaticCullingSystem.Get_Next_Collected_Object(cull_obj)) { AudibleSoundClass *sound_obj = (AudibleSoundClass *)cull_obj->Peek_Sound_Obj (); @@ -347,7 +347,7 @@ SoundSceneClass::On_Frame_Update (unsigned int milliseconds) // // First, collect any auxiliary sounds that are audible // - if (m_2ndListener != NULL) { + if (m_2ndListener != nullptr) { m_2ndListener->On_Frame_Update (milliseconds); Collect_Audible_Sounds (m_2ndListener, auxiliary_sounds); } @@ -436,7 +436,7 @@ SoundSceneClass::On_Frame_Update (unsigned int milliseconds) // /*aux_info.sound_obj->Convert_To_Filtered (); AudibleSoundClass *tinny_sound = aux_info.sound_obj->As_Converted_Format (); - if (tinny_sound != NULL) { + if (tinny_sound != nullptr) { audible_sounds.Add (tinny_sound); }*/ @@ -480,7 +480,7 @@ SoundSceneClass::On_Frame_Update (unsigned int milliseconds) // // Make sure we cull the sound // - WWASSERT(sound_obj != NULL); + WWASSERT(sound_obj != nullptr); sound_obj->Cull_Sound (true); sound_obj->Set_Runtime_Priority (0); } @@ -527,8 +527,8 @@ SoundSceneClass::Add_Sound WWPROFILE ("Add_Sound"); WWMEMLOG(MEM_SOUND); - WWASSERT (sound_obj != NULL); - if (sound_obj != NULL && sound_obj->Is_In_Scene () == false) { + WWASSERT (sound_obj != nullptr); + if (sound_obj != nullptr && sound_obj->Is_In_Scene () == false) { bool cull_sound = true; @@ -598,7 +598,7 @@ SoundSceneClass::Remove_Sound { WWPROFILE ("Remove_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -613,7 +613,7 @@ SoundSceneClass::Remove_Sound // Is this sound really in the scene? // SoundCullObjClass *cull_obj = sound_obj->Peek_Cullable_Wrapper (); - if (cull_obj != NULL && m_DynamicSounds.Is_In_List (cull_obj)) { + if (cull_obj != nullptr && m_DynamicSounds.Is_In_List (cull_obj)) { // // Stop playing the sound if necessary @@ -625,7 +625,7 @@ SoundSceneClass::Remove_Sound // // Flush the sound's cull-wrapper since we are removing it from the scene // - sound_obj->Set_Cullable_Wrapper (NULL); + sound_obj->Set_Cullable_Wrapper (nullptr); // // Remove this sound from the dynamic culling system @@ -657,14 +657,14 @@ SoundSceneClass::Add_Static_Sound { WWPROFILE ("Add_Static_Sound"); - WWASSERT (sound_obj != NULL); - if (sound_obj != NULL) { + WWASSERT (sound_obj != nullptr); + if (sound_obj != nullptr) { // // Check to see if this sound is already in the scene // SoundCullObjClass *cull_obj = sound_obj->Peek_Cullable_Wrapper (); - if (cull_obj == NULL) { + if (cull_obj == nullptr) { // // Create a wrapper object for the sound that we can use @@ -738,7 +738,7 @@ SoundSceneClass::Remove_Static_Sound { WWPROFILE ("Remove_Static_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -753,7 +753,7 @@ SoundSceneClass::Remove_Static_Sound // Is this sound really in the scene? // SoundCullObjClass *cull_obj = sound_obj->Peek_Cullable_Wrapper (); - if (cull_obj != NULL && m_StaticSounds.Is_In_List (cull_obj)) { + if (cull_obj != nullptr && m_StaticSounds.Is_In_List (cull_obj)) { // // Stop playing the sound if necessary @@ -765,7 +765,7 @@ SoundSceneClass::Remove_Static_Sound // // Flush the sound's cull-wrapper since we are removing it from the scene // - sound_obj->Set_Cullable_Wrapper (NULL); + sound_obj->Set_Cullable_Wrapper (nullptr); // // Remove this sound from the static culling system @@ -797,8 +797,8 @@ SoundSceneClass::Add_Logical_Sound { WWPROFILE ("Add_Logical_Sound"); - WWASSERT (sound_obj != NULL); - if (sound_obj != NULL) { + WWASSERT (sound_obj != nullptr); + if (sound_obj != nullptr) { // // Check to make sure we don't add this sound twice @@ -860,7 +860,7 @@ SoundSceneClass::Remove_Logical_Sound { WWPROFILE ("Remove_Logical_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -887,7 +887,7 @@ SoundSceneClass::Remove_Logical_Sound // // Remove this sound obj's wrapper // - sound_obj->Set_Cullable_Wrapper (NULL); + sound_obj->Set_Cullable_Wrapper (nullptr); WWAudioThreadsClass::Add_Delayed_Release_Object (cull_obj); // @@ -919,7 +919,7 @@ SoundSceneClass::Remove_Logical_Sound // // Remove this sound obj's wrapper // - sound_obj->Set_Cullable_Wrapper (NULL); + sound_obj->Set_Cullable_Wrapper (nullptr); WWAudioThreadsClass::Add_Delayed_Release_Object (cull_obj); // @@ -943,8 +943,8 @@ SoundSceneClass::Add_Logical_Listener (LogicalListenerClass *listener_obj) { WWPROFILE ("Add_Logical_Listener"); - WWASSERT (listener_obj != NULL); - if (listener_obj != NULL) { + WWASSERT (listener_obj != nullptr); + if (listener_obj != nullptr) { // // Add the listener to the 'scene' if its in our list @@ -970,8 +970,8 @@ SoundSceneClass::Remove_Logical_Listener (LogicalListenerClass *listener_obj) { WWPROFILE ("Remove_Logical_Listener"); - WWASSERT (listener_obj != NULL); - if (listener_obj != NULL) { + WWASSERT (listener_obj != nullptr); + if (listener_obj != nullptr) { // // Remove the listener from the 'scene' if its in our list @@ -994,7 +994,7 @@ SoundSceneClass::Remove_Logical_Listener (LogicalListenerClass *listener_obj) void SoundSceneClass::Update_Sound (SoundCullObjClass *sound_obj) { - if (sound_obj != NULL) { + if (sound_obj != nullptr) { sound_obj->Set_Cull_Box(sound_obj->Get_Bounding_Box()); } @@ -1031,7 +1031,7 @@ SoundSceneClass::Is_Sound_In_Scene (AudibleSoundClass *sound_obj, bool all) // lists. // SoundCullObjClass *cull_obj = sound_obj->Peek_Cullable_Wrapper (); - if (cull_obj != NULL) { + if (cull_obj != nullptr) { retval = (m_DynamicSounds.Is_In_List (cull_obj) || m_StaticSounds.Is_In_List (cull_obj)); } @@ -1112,7 +1112,7 @@ SoundSceneClass::Save_Static_Sounds (ChunkSaveClass &csave) // Get the sound from its cull object // AudibleSoundClass *sound_obj = (AudibleSoundClass *)cull_obj->Peek_Sound_Obj (); - if (sound_obj != NULL) { + if (sound_obj != nullptr) { // // Have the sound's factory save it @@ -1141,9 +1141,9 @@ SoundSceneClass::Load_Static_Sounds (ChunkLoadClass &cload) // Load this sound from the chunk (if possible) // PersistFactoryClass *factory = SaveLoadSystemClass::Find_Persist_Factory (cload.Cur_Chunk_ID ()); - if (factory != NULL) { + if (factory != nullptr) { AudibleSoundClass *sound_obj = (AudibleSoundClass *)factory->Load (cload); - if (sound_obj != NULL) { + if (sound_obj != nullptr) { sound_obj->Add_To_Scene (true); REF_PTR_RELEASE (sound_obj); } @@ -1258,7 +1258,7 @@ SoundSceneClass::Flush_Scene (void) SoundCullObjClass *cull_obj = temp_static_it.Peek_Obj (); AudibleSoundClass *sound_obj = (AudibleSoundClass *)cull_obj->Peek_Sound_Obj (); - if (sound_obj != NULL) { + if (sound_obj != nullptr) { Remove_Static_Sound (sound_obj); } } @@ -1271,7 +1271,7 @@ SoundSceneClass::Flush_Scene (void) SoundCullObjClass *cull_obj = temp_dynamic_it.Peek_Obj (); AudibleSoundClass *sound_obj = (AudibleSoundClass *)cull_obj->Peek_Sound_Obj (); - if (sound_obj != NULL) { + if (sound_obj != nullptr) { Remove_Sound (sound_obj); } } @@ -1288,11 +1288,11 @@ SoundSceneClass::Flush_Scene (void) void SoundSceneClass::Set_2nd_Listener (Listener3DClass *listener) { - if (m_2ndListener != NULL) { + if (m_2ndListener != nullptr) { m_2ndListener->On_Removed_From_Scene (); } - if (listener != NULL) { + if (listener != nullptr) { listener->On_Added_To_Scene (); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h index ef2620e4da7..cbb8f10f3c4 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h @@ -177,7 +177,7 @@ class SoundSceneClass { public: AudibleInfoClass (void) - : sound_obj (NULL), + : sound_obj (nullptr), distance2 (0) { } AudibleInfoClass (AudibleSoundClass *obj, float dist2) diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp index e9aceda67e5..7e5f4fc6c2f 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp @@ -75,7 +75,7 @@ CriticalSectionClass SoundSceneObjClass::m_IDListMutex; class HandleMgrClass { public: - HandleMgrClass (void) { SoundSceneObjClass::m_IDListMutex = ::CreateMutex (NULL, FALSE, NULL); } + HandleMgrClass (void) { SoundSceneObjClass::m_IDListMutex = ::CreateMutex (nullptr, FALSE, nullptr); } ~HandleMgrClass (void) { ::CloseHandle (SoundSceneObjClass::m_IDListMutex); } }; @@ -89,12 +89,12 @@ HandleMgrClass _GlobalMutexHandleMgr; // //////////////////////////////////////////////////////////////////////////////////////////////// SoundSceneObjClass::SoundSceneObjClass (void) - : m_Scene (NULL), - m_PhysWrapper (NULL), - m_pCallback (NULL), - m_AttachedObject (NULL), + : m_Scene (nullptr), + m_PhysWrapper (nullptr), + m_pCallback (nullptr), + m_AttachedObject (nullptr), m_UserData (0), - m_UserObj (NULL), + m_UserObj (nullptr), m_ID (SOUND_OBJ_DEFAULT_ID), m_RegisteredEvents (AudioCallbackClass::EVENT_NONE) { @@ -111,12 +111,12 @@ SoundSceneObjClass::SoundSceneObjClass (void) // //////////////////////////////////////////////////////////////////////////////////////////////// SoundSceneObjClass::SoundSceneObjClass (const SoundSceneObjClass &src) - : m_Scene (NULL), - m_PhysWrapper (NULL), - m_pCallback (NULL), - m_AttachedObject (NULL), + : m_Scene (nullptr), + m_PhysWrapper (nullptr), + m_pCallback (nullptr), + m_AttachedObject (nullptr), m_UserData (0), - m_UserObj (NULL), + m_UserObj (nullptr), m_ID (SOUND_OBJ_DEFAULT_ID), m_RegisteredEvents (AudioCallbackClass::EVENT_NONE) { @@ -175,7 +175,7 @@ SoundSceneObjClass::Attach_To_Object { REF_PTR_SET (m_AttachedObject, render_obj); - if (m_AttachedObject != NULL && bone_name != NULL) { + if (m_AttachedObject != nullptr && bone_name != nullptr) { m_AttachedBone = m_AttachedObject->Get_Bone_Index (bone_name); } else { m_AttachedBone = -1; @@ -225,7 +225,7 @@ SoundSceneObjClass::Apply_Auto_Position (void) { // If the sound is attached to an object, then update its transform // based on this link. - if (m_AttachedObject != NULL) { + if (m_AttachedObject != nullptr) { // Determine which transform to use Matrix3D transform (1); @@ -336,7 +336,7 @@ SoundSceneObjClass::Load (ChunkLoadClass &cload) // We need to 'swizzle' the attached object pointer. We saved the pointer's // value, and need to map it (hopefully) to the new value. // - if (m_AttachedObject != NULL) { + if (m_AttachedObject != nullptr) { SaveLoadSystemClass::Request_Ref_Counted_Pointer_Remap ((RefCountClass **)&m_AttachedObject); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h index f0580edfb6a..0be511429e2 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h @@ -103,11 +103,11 @@ class SoundSceneObjClass : public MultiListObjectClass, public PersistClass, pub ////////////////////////////////////////////////////////////////////// // Conversion methods ////////////////////////////////////////////////////////////////////// - virtual Sound3DClass * As_Sound3DClass (void) { return NULL; } - virtual SoundPseudo3DClass * As_SoundPseudo3DClass (void) { return NULL; } - virtual FilteredSoundClass * As_FilteredSoundClass (void) { return NULL; } - virtual Listener3DClass * As_Listener3DClass (void) { return NULL; } - virtual AudibleSoundClass * As_AudibleSoundClass(void) { return NULL; } + virtual Sound3DClass * As_Sound3DClass (void) { return nullptr; } + virtual SoundPseudo3DClass * As_SoundPseudo3DClass (void) { return nullptr; } + virtual FilteredSoundClass * As_FilteredSoundClass (void) { return nullptr; } + virtual Listener3DClass * As_Listener3DClass (void) { return nullptr; } + virtual AudibleSoundClass * As_AudibleSoundClass(void) { return nullptr; } ////////////////////////////////////////////////////////////////////// // Identification methods @@ -145,7 +145,7 @@ class SoundSceneObjClass : public MultiListObjectClass, public PersistClass, pub ////////////////////////////////////////////////////////////////////// // User data methods ////////////////////////////////////////////////////////////////////// - virtual void Set_User_Data (RefCountClass *user_obj = NULL, uint32 user = 0) { REF_PTR_SET (m_UserObj, user_obj); m_UserData = user; } + virtual void Set_User_Data (RefCountClass *user_obj = nullptr, uint32 user = 0) { REF_PTR_SET (m_UserObj, user_obj); m_UserData = user; } virtual uint32 Get_User_Data (void) const { return m_UserData; } virtual RefCountClass *Peek_User_Obj (void) const { return m_UserObj; } @@ -163,7 +163,7 @@ class SoundSceneObjClass : public MultiListObjectClass, public PersistClass, pub ////////////////////////////////////////////////////////////////////// virtual void Add_To_Scene (bool start_playing = true) = 0; virtual void Remove_From_Scene (void) = 0; - virtual bool Is_In_Scene (void) const { return m_Scene != NULL; } + virtual bool Is_In_Scene (void) const { return m_Scene != nullptr; } ////////////////////////////////////////////////////////////////////// // Attenuation settings @@ -229,7 +229,7 @@ SoundSceneObjClass::On_Event uint32 param2 ) { - if ((m_pCallback != NULL) && (m_RegisteredEvents & event)) { + if ((m_pCallback != nullptr) && (m_RegisteredEvents & event)) { switch (event) { diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp b/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp index 65d62e83a84..28996c7f799 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp @@ -39,7 +39,7 @@ /////////////////////////////////////////////////////////////////////////////////////////// // Static member initialization /////////////////////////////////////////////////////////////////////////////////////////// -WWAudioThreadsClass::DELAYED_RELEASE_INFO * WWAudioThreadsClass::m_ReleaseListHead = NULL; +WWAudioThreadsClass::DELAYED_RELEASE_INFO * WWAudioThreadsClass::m_ReleaseListHead = nullptr; CriticalSectionClass WWAudioThreadsClass::m_ListMutex; HANDLE WWAudioThreadsClass::m_hDelayedReleaseThread = (HANDLE)-1; HANDLE WWAudioThreadsClass::m_hDelayedReleaseEvent = (HANDLE)-1; @@ -79,7 +79,7 @@ WWAudioThreadsClass::Create_Delayed_Release_Thread (LPVOID param) // If the thread isn't already running, then // if (m_hDelayedReleaseThread == (HANDLE)-1) { - m_hDelayedReleaseEvent = ::CreateEvent (NULL, FALSE, FALSE, NULL); + m_hDelayedReleaseEvent = ::CreateEvent (nullptr, FALSE, FALSE, nullptr); m_hDelayedReleaseThread = (HANDLE)::_beginthread (Delayed_Release_Thread_Proc, 0, param); } @@ -174,9 +174,9 @@ WWAudioThreadsClass::Flush_Delayed_Release_Objects (void) // Loop through all the objects in our delay list, and // free them now. // - DELAYED_RELEASE_INFO *info = NULL; - DELAYED_RELEASE_INFO *next = NULL; - for (info = m_ReleaseListHead; info != NULL; info = next) { + DELAYED_RELEASE_INFO *info = nullptr; + DELAYED_RELEASE_INFO *next = nullptr; + for (info = m_ReleaseListHead; info != nullptr; info = next) { next = info->next; // @@ -186,7 +186,7 @@ WWAudioThreadsClass::Flush_Delayed_Release_Objects (void) SAFE_DELETE (info); } - m_ReleaseListHead = NULL; + m_ReleaseListHead = nullptr; return ; } @@ -215,10 +215,10 @@ WWAudioThreadsClass::Delayed_Release_Thread_Proc (LPVOID /*param*/) // free any that have expired. // DWORD current_time = ::GetTickCount (); - DELAYED_RELEASE_INFO *curr = NULL; - DELAYED_RELEASE_INFO *prev = NULL; - DELAYED_RELEASE_INFO *next = NULL; - for (curr = m_ReleaseListHead; curr != NULL; curr = next) { + DELAYED_RELEASE_INFO *curr = nullptr; + DELAYED_RELEASE_INFO *prev = nullptr; + DELAYED_RELEASE_INFO *next = nullptr; + for (curr = m_ReleaseListHead; curr != nullptr; curr = next) { next = curr->next; // @@ -229,7 +229,7 @@ WWAudioThreadsClass::Delayed_Release_Thread_Proc (LPVOID /*param*/) // // Unlink the object // - if (prev == NULL) { + if (prev == nullptr) { m_ReleaseListHead = next; } else { prev->next = next; @@ -271,7 +271,7 @@ WWAudioThreadsClass::Begin_Modify_List (void) // // Wait for up to one second to modify the list object // - if (m_ListMutex != NULL) { + if (m_ListMutex != nullptr) { retval = (::WaitForSingleObject (m_ListMutex, 1000) == WAIT_OBJECT_0); WWASSERT (retval); } @@ -291,7 +291,7 @@ WWAudioThreadsClass::End_Modify_List (void) // // Release this thread's hold on the mutex object. // - if (m_ListMutex != NULL) { + if (m_ListMutex != nullptr) { ::ReleaseMutex (m_ListMutex); } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Threads.h b/Core/Libraries/Source/WWVegas/WWAudio/Threads.h index 17af4841b5e..c013bfdfb2c 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Threads.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Threads.h @@ -65,7 +65,7 @@ class WWAudioThreadsClass // // Delayed release mechanism // - static HANDLE Create_Delayed_Release_Thread (LPVOID param = NULL); + static HANDLE Create_Delayed_Release_Thread (LPVOID param = nullptr); static void End_Delayed_Release_Thread (DWORD timeout = 20000); static void Add_Delayed_Release_Object (RefCountClass *object, DWORD delay = 2000); static void Flush_Delayed_Release_Objects (void); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h index ffff71bff50..d8f3d311b67 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h @@ -44,11 +44,11 @@ // // Macros // -#define SAFE_DELETE(pobject) { delete pobject; pobject = NULL; } +#define SAFE_DELETE(pobject) { delete pobject; pobject = nullptr; } -#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = NULL; } +#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = nullptr; } -#define SAFE_FREE(pobject) { ::free (pobject); pobject = NULL; } +#define SAFE_FREE(pobject) { ::free (pobject); pobject = nullptr; } ///////////////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ Get_Filename_From_Path (LPCTSTR path) { // Find the last occurance of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); - if (filename != NULL) { + if (filename != nullptr) { // Increment past the directory deliminator filename ++; } else { diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp index 34b88f28b62..582632827df 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -65,8 +65,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////// // Static member initialization //////////////////////////////////////////////////////////////////////////////////////////////// -WWAudioClass *WWAudioClass::_theInstance = NULL; -HANDLE WWAudioClass::_TimerSyncEvent = NULL; +WWAudioClass *WWAudioClass::_theInstance = nullptr; +HANDLE WWAudioClass::_TimerSyncEvent = nullptr; //////////////////////////////////////////////////////////////////////////////////////////////// @@ -104,14 +104,14 @@ WWAudioClass::Is_OK_To_Give_Handle (const AudibleSoundClass &sound_obj) // //////////////////////////////////////////////////////////////////////////////////////////////// WWAudioClass::WWAudioClass (void) - : m_Driver2D (NULL), - m_Driver3D (NULL), + : m_Driver2D (nullptr), + m_Driver3D (nullptr), m_PlaybackRate (44100), m_PlaybackBits (16), m_PlaybackStereo (true), m_ReverbFilter ((HPROVIDER)INVALID_MILES_HANDLE), m_UpdateTimer (-1), - m_Driver3DPseudo (NULL), + m_Driver3DPseudo (nullptr), m_MusicVolume (DEF_MUSIC_VOL), m_SoundVolume (DEF_SFX_VOL), m_MaxCacheSize (DEF_CACHE_SIZE * 1024), @@ -120,10 +120,10 @@ WWAudioClass::WWAudioClass (void) m_Max3DSamples (DEF_3D_SAMPLE_COUNT), m_Max2DBufferSize (DEF_MAX_2D_BUFFER_SIZE), m_Max3DBufferSize (DEF_MAX_3D_BUFFER_SIZE), - m_SoundScene (NULL), + m_SoundScene (nullptr), m_IsMusicEnabled (true), m_AreSoundEffectsEnabled (true), - m_FileFactory (NULL), + m_FileFactory (nullptr), m_EffectsLevel (0), m_ReverbRoomType (ENVIRONMENT_GENERIC) { @@ -134,7 +134,7 @@ WWAudioClass::WWAudioClass (void) // AIL_startup (); _theInstance = this; - _TimerSyncEvent = ::CreateEvent (NULL, TRUE, FALSE, "WWAUDIO_TIMER_SYNC"); + _TimerSyncEvent = ::CreateEvent (nullptr, TRUE, FALSE, "WWAUDIO_TIMER_SYNC"); // // Set some default values @@ -162,9 +162,9 @@ WWAudioClass::~WWAudioClass (void) WWAudioThreadsClass::End_Delayed_Release_Thread (); Shutdown (); - _theInstance = NULL; + _theInstance = nullptr; ::CloseHandle(_TimerSyncEvent); - _TimerSyncEvent = NULL; + _TimerSyncEvent = nullptr; ::DeleteCriticalSection (&MMSLockClass::_MSSLockCriticalSection); @@ -238,11 +238,11 @@ WWAudioClass::Open_2D_Device (LPWAVEFORMAT format) WWASSERT (success == AIL_NO_ERROR); // Open the driver - success = ::AIL_waveOutOpen (&m_Driver2D, NULL, 0, format); + success = ::AIL_waveOutOpen (&m_Driver2D, nullptr, 0, format); // Do we need to switch from direct sound to waveout? if ((success == AIL_NO_ERROR) && - (m_Driver2D != NULL) && + (m_Driver2D != nullptr) && (m_Driver2D->emulated_ds == TRUE)) { ::AIL_waveOutClose (m_Driver2D); success = 2; @@ -258,7 +258,7 @@ WWAudioClass::Open_2D_Device (LPWAVEFORMAT format) WWASSERT (success == AIL_NO_ERROR); // Open the driver - success = ::AIL_waveOutOpen (&m_Driver2D, NULL, 0, format); + success = ::AIL_waveOutOpen (&m_Driver2D, nullptr, 0, format); WWASSERT (success == AIL_NO_ERROR); type = (success == AIL_NO_ERROR) ? DRIVER2D_WAVEOUT : DRIVER2D_ERROR; } @@ -337,13 +337,13 @@ WWAudioClass::Close_2D_Device (void) // // Do we have an open driver handle to close? // - if (m_Driver2D != NULL) { + if (m_Driver2D != nullptr) { // // Close the driver // ::AIL_waveOutClose (m_Driver2D); - m_Driver2D = NULL; + m_Driver2D = nullptr; retval = true; } @@ -366,9 +366,9 @@ WWAudioClass::Get_Sound_Buffer (const char *filename, bool is_3d) // Try to find the buffer in our cache, otherwise create a new buffer. // SoundBufferClass *buffer = Find_Cached_Buffer (filename); - if (buffer == NULL) { + if (buffer == nullptr) { FileClass *file = Get_File (filename); - if (file != NULL && file->Is_Available ()) { + if (file != nullptr && file->Is_Available ()) { buffer = Create_Sound_Buffer (*file, filename, is_3d); } else { static int count = 0; @@ -397,7 +397,7 @@ WWAudioClass::Get_Sound_Buffer (FileClass &file, const char *string_id, bool is_ // Try to find the buffer in our cache, otherwise create a new buffer. // SoundBufferClass *buffer = Find_Cached_Buffer (string_id); - if (buffer == NULL) { + if (buffer == nullptr) { buffer = Create_Sound_Buffer (file, string_id, is_3d); } @@ -413,11 +413,11 @@ WWAudioClass::Get_Sound_Buffer (FileClass &file, const char *string_id, bool is_ SoundBufferClass * WWAudioClass::Find_Cached_Buffer (const char *string_id) { - SoundBufferClass *sound_buffer = NULL; + SoundBufferClass *sound_buffer = nullptr; // Param OK? - WWASSERT (string_id != NULL); - if (string_id != NULL) { + WWASSERT (string_id != nullptr); + if (string_id != nullptr) { // // Determine which index in our hash table to use @@ -471,7 +471,7 @@ WWAudioClass::Free_Cache_Space (int bytes) // Can we free this cached buffer? CACHE_ENTRY_STRUCT &info = m_CachedBuffers[hash_index][index]; - if ((info.buffer != NULL) && (info.buffer->Num_Refs () == 1)) { + if ((info.buffer != nullptr) && (info.buffer->Num_Refs () == 1)) { // Add the size of this buffer to our count of bytes freed bytes_freed += info.buffer->Get_Raw_Length (); @@ -512,10 +512,10 @@ WWAudioClass::Cache_Buffer bool retval = false; // Params OK? - WWASSERT (buffer != NULL); - WWASSERT (string_id != NULL); - if ((buffer != NULL) && - (string_id != NULL) && + WWASSERT (buffer != nullptr); + WWASSERT (string_id != nullptr); + if ((buffer != nullptr) && + (string_id != nullptr) && (buffer->Get_Raw_Length () < (U32)(m_MaxCacheSize / 2))) { // Attempt to free space in the cache (if needed) @@ -565,7 +565,7 @@ WWAudioClass::Create_Sound_Buffer bool is_3d ) { - SoundBufferClass *sound_buffer = NULL; + SoundBufferClass *sound_buffer = nullptr; // // Determine how large this buffer can be @@ -591,8 +591,8 @@ WWAudioClass::Create_Sound_Buffer WWASSERT (success); // If we were successful in creating the sound buffer, then - // try to cache it as well, otherwise free the buffer and return NULL. - if (success && (string_id != NULL)) { + // try to cache it as well, otherwise free the buffer and return null. + if (success && (string_id != nullptr)) { Cache_Buffer (sound_buffer, string_id); } else if (success == false) { REF_PTR_RELEASE (sound_buffer); @@ -629,8 +629,8 @@ WWAudioClass::Create_Sound_Buffer WWASSERT (success); // If we were successful in creating the sound buffer, then - // try to cache it as well, otherwise free the buffer and return NULL. - if (success && (string_id != NULL)) { + // try to cache it as well, otherwise free the buffer and return null. + if (success && (string_id != nullptr)) { Cache_Buffer (sound_buffer, string_id); } else if (success == false) { REF_PTR_RELEASE (sound_buffer); @@ -675,12 +675,12 @@ AudibleSoundClass * WWAudioClass::Create_Sound_Effect (const char *filename) { // Assume failure - AudibleSoundClass *sound_obj = NULL; + AudibleSoundClass *sound_obj = nullptr; if (Is_Disabled () == false) { // Param OK? - WWASSERT (filename != NULL); - if (filename != NULL) { + WWASSERT (filename != nullptr); + if (filename != nullptr) { // Create a file object and pass it onto the appropriate function FileClass *file = Get_File (filename); @@ -718,7 +718,7 @@ WWAudioClass::Create_Sound_Effect // Try to find the buffer in our cache, otherwise create a new buffer. SoundBufferClass *buffer = Find_Cached_Buffer (string_id); - if (buffer == NULL) { + if (buffer == nullptr) { buffer = Create_Sound_Buffer (raw_wave_data, bytes, string_id, false); } @@ -740,7 +740,7 @@ WWAudioClass::Create_Sound_Effect Sound3DClass * WWAudioClass::Create_3D_Sound (FileClass &file, const char *string_id, int classid_hint) { - Sound3DClass *sound_obj = NULL; + Sound3DClass *sound_obj = nullptr; if (Is_Disabled () == false) { // Try to find the buffer in our cache, otherwise create a new buffer. @@ -755,7 +755,7 @@ WWAudioClass::Create_3D_Sound (FileClass &file, const char *string_id, int class { sound_obj = W3DNEW SoundPseudo3DClass; sound_obj->Set_Buffer (buffer); - } else if (buffer != NULL) { + } else if (buffer != nullptr) { sound_obj = W3DNEW Sound3DClass; sound_obj->Set_Buffer (buffer); } @@ -783,12 +783,12 @@ WWAudioClass::Create_3D_Sound WWMEMLOG(MEM_SOUND); // Assume failure - Sound3DClass *sound_obj = NULL; + Sound3DClass *sound_obj = nullptr; if (Is_Disabled () == false) { // Param OK? - WWASSERT (filename != NULL); - if (filename != NULL) { + WWASSERT (filename != nullptr); + if (filename != nullptr) { // Try to find the buffer in our cache, otherwise create a new buffer. SoundBufferClass *buffer = Get_Sound_Buffer (filename, true); @@ -802,7 +802,7 @@ WWAudioClass::Create_3D_Sound { sound_obj = W3DNEW SoundPseudo3DClass; sound_obj->Set_Buffer (buffer); - } else if (buffer != NULL) { + } else if (buffer != nullptr) { sound_obj = W3DNEW Sound3DClass; sound_obj->Set_Buffer (buffer); } else { @@ -835,14 +835,14 @@ WWAudioClass::Create_3D_Sound int classid_hint ) { - Sound3DClass *sound_obj = NULL; + Sound3DClass *sound_obj = nullptr; if (Is_Disabled () == false) { // // Try to find the buffer in our cache, otherwise create a new buffer. // SoundBufferClass *buffer = Find_Cached_Buffer (string_id); - if (buffer == NULL) { + if (buffer == nullptr) { buffer = Create_Sound_Buffer (raw_wave_data, bytes, string_id, true); } @@ -855,7 +855,7 @@ WWAudioClass::Create_3D_Sound { sound_obj = W3DNEW SoundPseudo3DClass; sound_obj->Set_Buffer (buffer); - } else if (buffer != NULL) { + } else if (buffer != nullptr) { sound_obj = W3DNEW Sound3DClass; sound_obj->Set_Buffer (buffer); } @@ -882,13 +882,13 @@ WWAudioClass::Create_Sound int classid_hint ) { - AudibleSoundClass *sound = NULL; + AudibleSoundClass *sound = nullptr; // // Find the definition // DefinitionClass *definition = DefinitionMgrClass::Find_Definition (definition_id); - if (definition != NULL ) { + if (definition != nullptr ) { // // Make sure this is really a sound definition @@ -901,7 +901,7 @@ WWAudioClass::Create_Sound // Create an instance of the sound // sound = sound_def->Create_Sound (classid_hint); - if (sound != NULL) { + if (sound != nullptr) { sound->Set_User_Data (user_obj, user_data); } } @@ -925,13 +925,13 @@ WWAudioClass::Create_Sound int classid_hint ) { - AudibleSoundClass *sound = NULL; + AudibleSoundClass *sound = nullptr; // // Find the definition // DefinitionClass *definition = DefinitionMgrClass::Find_Typed_Definition (def_name, CLASSID_SOUND, true); - if (definition != NULL ) { + if (definition != nullptr ) { // // Make sure this is really a sound definition @@ -944,7 +944,7 @@ WWAudioClass::Create_Sound // Create an instance of the sound // sound = sound_def->Create_Sound (classid_hint); - if (sound != NULL) { + if (sound != nullptr) { sound->Set_User_Data (user_obj, user_data); } } @@ -972,7 +972,7 @@ WWAudioClass::Create_Continuous_Sound // Create an instance of the sound and play it // AudibleSoundClass *sound = Create_Sound (definition_id, user_obj, user_data, classid_hint); - if (sound != NULL) { + if (sound != nullptr) { if (sound->Get_Loop_Count () != INFINITE_LOOPS) { WWDEBUG_SAY (("Audio Error: Creating a continuous sound with a finite loop count!")); @@ -1004,7 +1004,7 @@ WWAudioClass::Create_Instant_Sound // Create an instance of the sound and play it // AudibleSoundClass *sound = Create_Sound (definition_id, user_obj, user_data, classid_hint); - if (sound != NULL) { + if (sound != nullptr) { if (sound->Get_Loop_Count () == INFINITE_LOOPS) { WWDEBUG_SAY (("Audio Error: Creating an instant sound %s with an infinite loop count!",sound->Get_Definition()->Get_Name())); @@ -1038,7 +1038,7 @@ WWAudioClass::Create_Continuous_Sound // Create an instance of the sound and play it // AudibleSoundClass *sound = Create_Sound (def_name, user_obj, user_data, classid_hint); - if (sound != NULL) { + if (sound != nullptr) { if (sound->Get_Loop_Count () != INFINITE_LOOPS) { WWDEBUG_SAY (("Audio Error: Creating a continuous sound with a finite loop count!")); @@ -1071,7 +1071,7 @@ WWAudioClass::Create_Instant_Sound // Create an instance of the sound and play it // AudibleSoundClass *sound = Create_Sound (def_name, user_obj, user_data, classid_hint); - if (sound != NULL) { + if (sound != nullptr) { if (sound->Get_Loop_Count () == INFINITE_LOOPS) { WWDEBUG_SAY (("Audio Error: Creating an instant sound %s with an infinite loop count!",sound->Get_Definition()->Get_Name())); @@ -1124,7 +1124,7 @@ WWAudioClass::Free_Completed_Sounds (void) for (int index = 0; index < m_CompletedSounds.Count (); index ++) { AudibleSoundClass *sound_obj = m_CompletedSounds[index]; - WWASSERT(sound_obj != NULL); //TSS 05/24/99 + WWASSERT(sound_obj != nullptr); //TSS 05/24/99 // Remove this sound from the playlist bool found = false; @@ -1158,7 +1158,7 @@ WWAudioClass::Free_Completed_Sounds (void) AudibleSoundClass * WWAudioClass::Get_Playlist_Entry (int index) const { - AudibleSoundClass *sound_obj = NULL; + AudibleSoundClass *sound_obj = nullptr; // Params OK? WWASSERT (index >= 0 && index < m_Playlist.Count ()); @@ -1183,8 +1183,8 @@ WWAudioClass::Add_To_Playlist (AudibleSoundClass *sound) // Assume failure bool retval = false; - WWASSERT (sound != NULL); - if (sound != NULL) { + WWASSERT (sound != nullptr); + if (sound != nullptr) { // Loop through all the entries in the playlist bool already_added = false; @@ -1215,8 +1215,8 @@ WWAudioClass::Remove_From_Playlist (AudibleSoundClass *sound_obj) // Assume failure bool retval = false; - WWASSERT (sound_obj != NULL); - if (sound_obj != NULL) { + WWASSERT (sound_obj != nullptr); + if (sound_obj != nullptr) { // Loop through all the entries in the playlist int index = 0; @@ -1236,9 +1236,9 @@ WWAudioClass::Remove_From_Playlist (AudibleSoundClass *sound_obj) // if (sound_obj->Get_Loop_Count () != INFINITE_LOOPS) { for (index = 0; index < m_EOSCallbackList.Count (); index ++) { - uint32 user_data = NULL; + uint32 user_data = 0; LPFNEOSCALLBACK callback = m_EOSCallbackList.Get_Callback (index, &user_data); - if (callback != NULL) { + if (callback != nullptr) { (*callback) (sound_obj, user_data); } } @@ -1281,7 +1281,7 @@ WWAudioClass::Is_Sound_In_Playlist (AudibleSoundClass *sound_obj) void WWAudioClass::Reprioritize_Playlist (void) { - AudibleSoundClass *sound_to_get_handle = NULL; + AudibleSoundClass *sound_to_get_handle = nullptr; float hightest_priority = 0; // Loop through all the entries in the playlist @@ -1289,7 +1289,7 @@ WWAudioClass::Reprioritize_Playlist (void) // Is this the highest priority without a miles handle? AudibleSoundClass *sound_obj = m_Playlist[index]; - if ((sound_obj->Get_Miles_Handle () == NULL) && + if ((sound_obj->Get_Miles_Handle () == nullptr) && (sound_obj->Is_Sound_Culled () == false) && (sound_obj->Get_Priority () > hightest_priority)) { @@ -1301,7 +1301,7 @@ WWAudioClass::Reprioritize_Playlist (void) } // Get a new handle for this sound if necessary - if (sound_to_get_handle != NULL) { + if (sound_to_get_handle != nullptr) { sound_to_get_handle->Allocate_Miles_Handle (); } @@ -1322,7 +1322,7 @@ WWAudioClass::On_Frame_Update (unsigned int milliseconds) // Free_Completed_Sounds (); - if (m_SoundScene != NULL) { + if (m_SoundScene != nullptr) { m_SoundScene->On_Frame_Update (milliseconds); m_SoundScene->Collect_Logical_Sounds (milliseconds); } @@ -1356,7 +1356,7 @@ WWAudioClass::Release_2D_Handles (void) // Release our hold on all the samples we've allocated for (int index = 0; index < m_2DSampleHandles.Count (); index ++) { HSAMPLE sample = m_2DSampleHandles[index]; - if (sample != NULL) { + if (sample != nullptr) { ::AIL_release_sample_handle (sample); } } @@ -1379,13 +1379,13 @@ WWAudioClass::Allocate_2D_Handles (void) // Start fresh Release_2D_Handles (); - if (m_Driver2D != NULL) { + if (m_Driver2D != nullptr) { // Attempt to allocate our share of 2D sample handles for (int index = 0; index < m_Max2DSamples; index ++) { HSAMPLE sample = ::AIL_allocate_sample_handle (m_Driver2D); - if (sample != NULL) { - ::AIL_set_sample_user_data (sample, INFO_OBJECT_PTR, NULL); + if (sample != nullptr) { + ::AIL_set_sample_user_data (sample, INFO_OBJECT_PTR, nullptr); m_2DSampleHandles.Add (sample); } } @@ -1414,8 +1414,8 @@ WWAudioClass::Get_2D_Sample (const AudibleSoundClass &sound_obj) float lowest_priority = sound_obj.Get_Priority (); float lowest_runtime_priority = sound_obj.Get_Runtime_Priority (); - AudibleSoundClass *lowest_pri_sound = NULL; - HSAMPLE lowest_pri_sample = NULL; + AudibleSoundClass *lowest_pri_sound = nullptr; + HSAMPLE lowest_pri_sample = nullptr; HSAMPLE free_sample = (HSAMPLE)INVALID_MILES_HANDLE; // Loop through all the available sample handles and try to find @@ -1424,11 +1424,11 @@ WWAudioClass::Get_2D_Sample (const AudibleSoundClass &sound_obj) for (int index = 0; (index < m_2DSampleHandles.Count ()) && !found; index ++) { HSAMPLE sample = m_2DSampleHandles[index]; - if (sample != NULL) { + if (sample != nullptr) { // Get a pointer to the object that is currently using this sample AudibleSoundClass *sound_obj = (AudibleSoundClass *)::AIL_sample_user_data (sample, INFO_OBJECT_PTR); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { // Return this sample handle to the caller free_sample = sample; @@ -1456,7 +1456,7 @@ WWAudioClass::Get_2D_Sample (const AudibleSoundClass &sound_obj) // Steal the sample handle from the lower priority // sound and return the handle to the caller. - if ((found == false) && (lowest_pri_sound != NULL)) { + if ((found == false) && (lowest_pri_sound != nullptr)) { lowest_pri_sound->Free_Miles_Handle (); free_sample = lowest_pri_sample; } @@ -1482,8 +1482,8 @@ WWAudioClass::Get_3D_Sample (const Sound3DClass &sound_obj) float lowest_priority = sound_obj.Get_Priority (); float lowest_runtime_priority = sound_obj.Get_Runtime_Priority (); - AudibleSoundClass *lowest_pri_sound = NULL; - H3DSAMPLE lowest_pri_sample = NULL; + AudibleSoundClass *lowest_pri_sound = nullptr; + H3DSAMPLE lowest_pri_sample = nullptr; H3DSAMPLE free_sample = (H3DSAMPLE)INVALID_MILES_HANDLE; @@ -1493,11 +1493,11 @@ WWAudioClass::Get_3D_Sample (const Sound3DClass &sound_obj) for (int index = 0; (index < m_3DSampleHandles.Count ()) && !found; index ++) { H3DSAMPLE sample = m_3DSampleHandles[index]; - if (sample != NULL) { + if (sample != nullptr) { // Get a pointer to the object that is currently using this sample AudibleSoundClass *sound_obj = (AudibleSoundClass *)::AIL_3D_object_user_data (sample, INFO_OBJECT_PTR); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { // Return this sample handle to the caller free_sample = sample; @@ -1525,7 +1525,7 @@ WWAudioClass::Get_3D_Sample (const Sound3DClass &sound_obj) // Steal the sample handle from the lower priority // sound and return the handle to the caller. - if ((found == false) && (lowest_pri_sound != NULL)) { + if ((found == false) && (lowest_pri_sound != nullptr)) { lowest_pri_sound->Free_Miles_Handle (); free_sample = lowest_pri_sample; } @@ -1559,8 +1559,8 @@ WWAudioClass::Build_3D_Driver_List (void) MMSLockClass lock; HPROENUM next = HPROENUM_FIRST; - HPROVIDER provider = NULL; - char *name = NULL; + HPROVIDER provider = nullptr; + char *name = nullptr; while (::AIL_enumerate_3D_providers (&next, &provider, &name) > 0) { // Can we successfully open this provider? @@ -1616,21 +1616,21 @@ WWAudioClass::Free_3D_Driver_List (void) // for (int index = 0; index < m_Driver3DList.Count (); index ++) { DRIVER_INFO_STRUCT *info = m_Driver3DList[index]; - if (info != NULL) { + if (info != nullptr) { // // Free the information we have stored with this driver // - if (info->name != NULL) { + if (info->name != nullptr) { ::free (info->name); } delete info; } } - if (m_Driver3D != NULL) { + if (m_Driver3D != nullptr) { ::AIL_close_3D_provider (m_Driver3D); - m_Driver3D = NULL; + m_Driver3D = nullptr; } // @@ -1656,7 +1656,7 @@ WWAudioClass::Select_3D_Device (const char *device_name) // for (int index = 0; index < m_Driver3DList.Count (); index ++) { DRIVER_INFO_STRUCT *info = m_Driver3DList[index]; - if (info != NULL) { + if (info != nullptr) { // // Is this the device we were looking for? @@ -1681,7 +1681,7 @@ bool WWAudioClass::Select_3D_Device (const char *device_name, HPROVIDER provider) { bool retval = false; - if ((provider != NULL) && (provider != m_Driver3D)) { + if ((provider != nullptr) && (provider != m_Driver3D)) { // // Remove all the handles @@ -1692,9 +1692,9 @@ WWAudioClass::Select_3D_Device (const char *device_name, HPROVIDER provider) // // Close the previous driver if needs be // - if (m_Driver3D != NULL) { + if (m_Driver3D != nullptr) { ::AIL_close_3D_provider (m_Driver3D); - m_Driver3D = NULL; + m_Driver3D = nullptr; } // @@ -1711,7 +1711,7 @@ WWAudioClass::Select_3D_Device (const char *device_name, HPROVIDER provider) // StringClass lower_name = device_name; ::strlwr (lower_name.Peek_Buffer ()); - if (::strstr (device_name, "eax") != 0) { + if (::strstr (device_name, "eax") != nullptr) { m_EffectsLevel = 1.0F; } else { m_EffectsLevel = 0.0F; @@ -1802,10 +1802,10 @@ WWAudioClass::Find_3D_Device (DRIVER_TYPE_3D type) int driver_index = -1; for (int index = 0; (index < m_Driver3DList.Count ()) && (driver_index == -1); index ++) { DRIVER_INFO_STRUCT *info = m_Driver3DList[index]; - if ((info != NULL) && (info->name != NULL)) { + if ((info != nullptr) && (info->name != nullptr)) { // Is this the driver we were looking for? - if (::strstr (info->name, sub_string) != NULL) { + if (::strstr (info->name, sub_string) != nullptr) { driver_index = index; } } @@ -1829,13 +1829,13 @@ WWAudioClass::Allocate_3D_Handles (void) // Start fresh Release_3D_Handles (); - if (m_Driver3D != NULL) { + if (m_Driver3D != nullptr) { // Attempt to allocate our share of 3D sample handles for (int index = 0; index < m_Max3DSamples; index ++) { H3DSAMPLE sample = ::AIL_allocate_3D_sample_handle (m_Driver3D); - if (sample != NULL) { - ::AIL_set_3D_object_user_data (sample, INFO_OBJECT_PTR, NULL); + if (sample != nullptr) { + ::AIL_set_3D_object_user_data (sample, INFO_OBJECT_PTR, nullptr); m_3DSampleHandles.Add (sample); } } @@ -1860,7 +1860,7 @@ WWAudioClass::Release_3D_Handles (void) // for (int index = 0; index < m_3DSampleHandles.Count (); index ++) { H3DSAMPLE sample = m_3DSampleHandles[index]; - if (sample != NULL) { + if (sample != nullptr) { ::AIL_release_3D_sample_handle (sample); } } @@ -1883,7 +1883,7 @@ WWAudioClass::Validate_3D_Sound_Buffer (SoundBufferClass *buffer) // // 3D sound buffer MUST be uncompressed mono WAV data // - if ((buffer != NULL) && + if ((buffer != nullptr) && (buffer->Get_Channels () == 1) && (buffer->Get_Type () == WAVE_FORMAT_PCM) && (buffer->Is_Streaming () == false)) @@ -2102,7 +2102,7 @@ WWAudioClass::Initialize (const char *registry_subkey_name) // Grab the first (and only) filter for use with our 'tinny' effect. // HPROENUM next = HPROENUM_FIRST; - char *name = NULL; + char *name = nullptr; if (::AIL_enumerate_filters (&next, &m_ReverbFilter, &name) == 0) { m_ReverbFilter = (HPROVIDER)INVALID_MILES_HANDLE; } @@ -2141,7 +2141,7 @@ WWAudioClass::Initialize // Grab the first (and only) filter for use with our 'tinny' effect. // HPROENUM next = HPROENUM_FIRST; - char *name = NULL; + char *name = nullptr; if (::AIL_enumerate_filters (&next, &m_ReverbFilter, &name) == 0) { m_ReverbFilter = (HPROVIDER)INVALID_MILES_HANDLE; } @@ -2172,14 +2172,14 @@ WWAudioClass::Shutdown (void) // Wait for the timer callback function to end ::WaitForSingleObject (_TimerSyncEvent, 20000); ::CloseHandle (_TimerSyncEvent); - _TimerSyncEvent = NULL; + _TimerSyncEvent = nullptr; } // // Stop all sounds from playing // Flush_Playlist (); - if (m_SoundScene != NULL) { + if (m_SoundScene != nullptr) { m_SoundScene->Flush_Scene (); } @@ -2275,7 +2275,7 @@ WWAudioClass::Fire_Text_Callback (AudibleSoundClass *sound_obj, const StringClas for (int index = 0; index < m_TextCallbackList.Count (); index ++) { uint32 user_data = 0L; LPFNTEXTCALLBACK callback = m_TextCallbackList.Get_Callback (index, &user_data); - if (callback != NULL) { + if (callback != nullptr) { // // Fire the notification @@ -2375,13 +2375,13 @@ WWAudioClass::Simple_Play_2D_Sound_Effect { bool retval = false; AudibleSoundClass *sound = Create_Sound_Effect (filename); - if (sound != NULL) { + if (sound != nullptr) { sound->Set_Priority (priority); sound->Set_Loop_Count (1); sound->Set_Volume(volume); sound->Play (); sound->Release_Ref (); - sound = NULL; + sound = nullptr; retval = true; } @@ -2404,13 +2404,13 @@ WWAudioClass::Simple_Play_2D_Sound_Effect { bool retval = false; AudibleSoundClass *sound = Create_Sound_Effect (file); - if (sound != NULL) { + if (sound != nullptr) { sound->Set_Priority (priority); sound->Set_Loop_Count (1); sound->Set_Volume(volume); sound->Play (); sound->Release_Ref (); - sound = NULL; + sound = nullptr; retval = true; } @@ -2426,8 +2426,8 @@ WWAudioClass::Simple_Play_2D_Sound_Effect FileClass * WWAudioClass::Get_File (LPCTSTR filename) { - FileClass *file = NULL; - if (m_FileFactory != NULL) { + FileClass *file = nullptr; + if (m_FileFactory != nullptr) { file = m_FileFactory->Get_File (filename); } else { file = _TheFileFactory->Get_File(filename); @@ -2446,7 +2446,7 @@ WWAudioClass::Get_File (LPCTSTR filename) void WWAudioClass::Return_File (FileClass *file) { - if (m_FileFactory != NULL) { + if (m_FileFactory != nullptr) { m_FileFactory->Return_File (file); } else { SAFE_DELETE (file); @@ -2534,7 +2534,7 @@ WWAudioClass::Get_Logical_Type (int index, StringClass &name) SoundSceneObjClass * WWAudioClass::Find_Sound_Object (uint32 sound_obj_id) { - SoundSceneObjClass *sound_obj = NULL; + SoundSceneObjClass *sound_obj = nullptr; // // Lookup the sound object and return it to the caller @@ -2673,7 +2673,7 @@ WWAudioClass::Save_To_Registry (const char *subkey_name) // // Is this the device we were looking for? // - if (info != NULL && info->driver == m_Driver3D) { + if (info != nullptr && info->driver == m_Driver3D) { device_name = info->name; break; } @@ -2744,13 +2744,13 @@ WWAudioClass::File_Open_Callback (char const *filename, void **file_handle) { U32 retval = false; - if (Get_Instance () != NULL) { + if (Get_Instance () != nullptr) { // // Open the file // FileClass *file = Get_Instance ()->Get_File (filename); - if (file != NULL && file->Open ()) { + if (file != nullptr && file->Open ()) { (*file_handle) = (void *)file; retval = true; } @@ -2768,13 +2768,13 @@ WWAudioClass::File_Open_Callback (char const *filename, void **file_handle) void AILCALLBACK WWAudioClass::File_Close_Callback (void *file_handle) { - if (Get_Instance () != NULL) { + if (Get_Instance () != nullptr) { // // Close the file (if necessary) // FileClass *file = reinterpret_cast (file_handle); - if (file != NULL) { + if (file != nullptr) { Get_Instance ()->Return_File (file); } } @@ -2797,7 +2797,7 @@ WWAudioClass::File_Seek_Callback (void *file_handle, S32 offset, U32 type) // Convert the handle to a file handle type // FileClass *file = reinterpret_cast (file_handle); - if (file != NULL) { + if (file != nullptr) { // // Convert the Miles seek type to one of our own @@ -2842,7 +2842,7 @@ WWAudioClass::File_Read_Callback (void *file_handle, void *buffer, U32 bytes) // Convert the handle to a file handle type // FileClass *file = reinterpret_cast (file_handle); - if (file != NULL) { + if (file != nullptr) { // // Read the bytes from the file diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h index cc2f6a0c9ec..1b6a4ee5c8e 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h @@ -195,7 +195,7 @@ class WWAudioClass ////////////////////////////////////////////////////////////////////// // 2D Hardware/driver selection methods ////////////////////////////////////////////////////////////////////// - DRIVER_TYPE_2D Open_2D_Device (LPWAVEFORMAT format = NULL); + DRIVER_TYPE_2D Open_2D_Device (LPWAVEFORMAT format = nullptr); DRIVER_TYPE_2D Open_2D_Device (bool stereo, int bits, int hertz); bool Close_2D_Device (void); int Get_Playback_Rate (void) const { return m_PlaybackRate; } @@ -356,12 +356,12 @@ class WWAudioClass // // Sound creation methods // - int Create_Instant_Sound (int definition_id, const Matrix3D &tm, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); - int Create_Instant_Sound (const char *def_name, const Matrix3D &tm, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); - AudibleSoundClass * Create_Continuous_Sound (int definition_id, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); - AudibleSoundClass * Create_Continuous_Sound (const char *def_name, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); - AudibleSoundClass * Create_Sound (int definition_id, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); - AudibleSoundClass * Create_Sound (const char *def_name, RefCountClass *user_obj = NULL, uint32 user_data = 0, int classid_hint = CLASSID_3D); + int Create_Instant_Sound (int definition_id, const Matrix3D &tm, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); + int Create_Instant_Sound (const char *def_name, const Matrix3D &tm, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); + AudibleSoundClass * Create_Continuous_Sound (int definition_id, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); + AudibleSoundClass * Create_Continuous_Sound (const char *def_name, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); + AudibleSoundClass * Create_Sound (int definition_id, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); + AudibleSoundClass * Create_Sound (const char *def_name, RefCountClass *user_obj = nullptr, uint32 user_data = 0, int classid_hint = CLASSID_3D); ////////////////////////////////////////////////////////////////////// // Sound object lookup @@ -502,7 +502,7 @@ class WWAudioClass SoundBufferClass * buffer; _CACHE_ENTRY_STRUCT (void) - : string_id (0), buffer (NULL) {} + : string_id (0), buffer (nullptr) {} _CACHE_ENTRY_STRUCT &operator= (const _CACHE_ENTRY_STRUCT &src) { string_id = ::strdup (src.string_id); REF_PTR_SET (buffer, src.buffer); return *this; } bool operator== (const _CACHE_ENTRY_STRUCT &src) { return false; } diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp index 9ff5f7ecbb5..169b73fdcb7 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound2dhandle.cpp @@ -81,7 +81,7 @@ Sound2DHandleClass::Initialize (SoundBufferClass *buffer) // // Pass the actual sound data onto the sample // - if (Buffer != NULL) { + if (Buffer != nullptr) { ::AIL_set_named_sample_file (SampleHandle, (char *)Buffer->Get_Filename (), Buffer->Get_Raw_Buffer (), Buffer->Get_Raw_Length (), 0); } @@ -167,7 +167,7 @@ Sound2DHandleClass::Set_Sample_Pan (S32 pan) // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_set_sample_pan. // TheSuperHackers @todo Perhaps use float natively. float fVolume = 0.0F; - ::AIL_sample_volume_pan (SampleHandle, &fVolume, NULL); + ::AIL_sample_volume_pan (SampleHandle, &fVolume, nullptr); float fPan = pan / 127.0F; ::AIL_set_sample_volume_pan (SampleHandle, fVolume, fPan); } @@ -189,7 +189,7 @@ Sound2DHandleClass::Get_Sample_Pan (void) if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_sample_pan. float fPan = 0.5F; - ::AIL_sample_volume_pan (SampleHandle, NULL, &fPan); + ::AIL_sample_volume_pan (SampleHandle, nullptr, &fPan); retval = fPan * 127; } @@ -209,7 +209,7 @@ Sound2DHandleClass::Set_Sample_Volume (S32 volume) // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_set_sample_volume. // TheSuperHackers @todo Perhaps use float natively. float fPan = 0.5F; - ::AIL_sample_volume_pan (SampleHandle, NULL, &fPan); + ::AIL_sample_volume_pan (SampleHandle, nullptr, &fPan); float fVolume = volume / 127.0F; ::AIL_set_sample_volume_pan (SampleHandle, fVolume, fPan); } @@ -230,7 +230,7 @@ Sound2DHandleClass::Get_Sample_Volume (void) if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_sample_volume. float fVolume = 0.0F; - ::AIL_sample_volume_pan (SampleHandle, &fVolume, NULL); + ::AIL_sample_volume_pan (SampleHandle, &fVolume, nullptr); retval = fVolume * 127; } @@ -328,7 +328,7 @@ Sound2DHandleClass::Set_Sample_User_Data (S32 i, void *val) void * Sound2DHandleClass::Get_Sample_User_Data (S32 i) { - void *retval = NULL; + void *retval = nullptr; if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { retval = ::AIL_sample_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp index 2e281315239..9ea5335c4f3 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp @@ -71,7 +71,7 @@ Sound3DHandleClass::Initialize (SoundBufferClass *buffer) { SoundHandleClass::Initialize (buffer); - if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE && Buffer != NULL) { + if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE && Buffer != nullptr) { // // Configure the 3D sample @@ -260,7 +260,7 @@ Sound3DHandleClass::Set_Sample_MS_Position (U32 ms) { if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE) { - WWASSERT (Buffer != NULL); + WWASSERT (Buffer != nullptr); U32 bytes_per_sec = (Buffer->Get_Rate () * Buffer->Get_Bits ()) >> 3; U32 bytes = (ms * bytes_per_sec) / 1000; bytes += (bytes & 1); @@ -281,15 +281,15 @@ Sound3DHandleClass::Get_Sample_MS_Position (S32 *len, S32 *pos) { if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE) { - WWASSERT (Buffer != NULL); - if (pos != NULL) { + WWASSERT (Buffer != nullptr); + if (pos != nullptr) { U32 bytes = ::AIL_3D_sample_offset (SampleHandle); U32 bytes_per_sec = (Buffer->Get_Rate () * Buffer->Get_Bits ()) >> 3; U32 ms = (bytes * 1000) / bytes_per_sec; (*pos) = ms; } - if (len != NULL) { + if (len != nullptr) { U32 bytes = ::AIL_3D_sample_length (SampleHandle); U32 bytes_per_sec = (Buffer->Get_Rate () * Buffer->Get_Bits ()) >> 3; U32 ms = (bytes * 1000) / bytes_per_sec; @@ -324,7 +324,7 @@ Sound3DHandleClass::Set_Sample_User_Data (S32 i, void *val) void * Sound3DHandleClass::Get_Sample_User_Data (S32 i) { - void *retval = NULL; + void *retval = nullptr; if (SampleHandle != (H3DSAMPLE)INVALID_MILES_HANDLE) { retval = AIL_3D_object_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.cpp index 550d4445ded..15080f5d787 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.cpp @@ -44,7 +44,7 @@ // ////////////////////////////////////////////////////////////////////// SoundHandleClass::SoundHandleClass (void) : - Buffer (NULL) + Buffer (nullptr) { return ; } @@ -61,9 +61,9 @@ SoundHandleClass::~SoundHandleClass (void) // Delay the release of the buffer (fixes a sync bug // with Miles internals). // - if (Buffer != NULL) { + if (Buffer != nullptr) { WWAudioThreadsClass::Add_Delayed_Release_Object (Buffer); - Buffer = NULL; + Buffer = nullptr; } return ; diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h index 297a9ba2a38..ea5bf8a8c9e 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundhandle.h @@ -70,17 +70,17 @@ class SoundHandleClass // // RTTI // - virtual Sound3DHandleClass * As_Sound3DHandleClass (void) { return NULL; } - virtual Sound2DHandleClass * As_Sound2DHandleClass (void) { return NULL; } - virtual SoundStreamHandleClass * As_SoundStreamHandleClass (void) { return NULL; } - virtual ListenerHandleClass * As_ListenerHandleClass (void) { return NULL; } + virtual Sound3DHandleClass * As_Sound3DHandleClass (void) { return nullptr; } + virtual Sound2DHandleClass * As_Sound2DHandleClass (void) { return nullptr; } + virtual SoundStreamHandleClass * As_SoundStreamHandleClass (void) { return nullptr; } + virtual ListenerHandleClass * As_ListenerHandleClass (void) { return nullptr; } // // Handle access // - virtual H3DSAMPLE Get_H3DSAMPLE (void) { return NULL; } - virtual HSAMPLE Get_HSAMPLE (void) { return NULL; } - virtual HSTREAM Get_HSTREAM (void) { return NULL; } + virtual H3DSAMPLE Get_H3DSAMPLE (void) { return nullptr; } + virtual HSAMPLE Get_HSAMPLE (void) { return nullptr; } + virtual HSTREAM Get_HSTREAM (void) { return nullptr; } // // Initialization diff --git a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp index 5bc7ed4e862..f66b9f1073f 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/soundstreamhandle.cpp @@ -72,7 +72,7 @@ SoundStreamHandleClass::Initialize (SoundBufferClass *buffer) { SoundHandleClass::Initialize (buffer); - if (Buffer != NULL) { + if (Buffer != nullptr) { // // Create a stream @@ -164,7 +164,7 @@ SoundStreamHandleClass::Set_Sample_Pan (S32 pan) // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_set_stream_pan. // TheSuperHackers @todo Perhaps use float natively. float fVolume = 0.0F; - ::AIL_stream_volume_pan (StreamHandle, &fVolume, NULL); + ::AIL_stream_volume_pan (StreamHandle, &fVolume, nullptr); float fPan = pan / 127.0F; ::AIL_set_stream_volume_pan (StreamHandle, fVolume, fPan); } @@ -185,7 +185,7 @@ SoundStreamHandleClass::Get_Sample_Pan (void) if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) { // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_stream_pan. float fPan = 0.5F; - ::AIL_stream_volume_pan (StreamHandle, NULL, &fPan); + ::AIL_stream_volume_pan (StreamHandle, nullptr, &fPan); retval = fPan * 127; } @@ -205,7 +205,7 @@ SoundStreamHandleClass::Set_Sample_Volume (S32 volume) // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_set_stream_volume. // TheSuperHackers @todo Perhaps use float natively. float fPan = 0.5F; - ::AIL_stream_volume_pan (StreamHandle, NULL, &fPan); + ::AIL_stream_volume_pan (StreamHandle, nullptr, &fPan); float fVolume = volume / 127.0F; ::AIL_set_stream_volume_pan (StreamHandle, fVolume, fPan); } @@ -226,7 +226,7 @@ SoundStreamHandleClass::Get_Sample_Volume (void) if (StreamHandle != (HSTREAM)INVALID_MILES_HANDLE) { // TheSuperHackers @fix xezon 05/04/2025 Upgrades miles call from legacy AIL_stream_volume. float fVolume = 0.0F; - ::AIL_stream_volume_pan (StreamHandle, &fVolume, NULL); + ::AIL_stream_volume_pan (StreamHandle, &fVolume, nullptr); retval = fVolume * 127; } @@ -323,7 +323,7 @@ SoundStreamHandleClass::Set_Sample_User_Data (S32 i, void *val) void * SoundStreamHandleClass::Get_Sample_User_Data (S32 i) { - void *retval = NULL; + void *retval = nullptr; if (SampleHandle != (HSAMPLE)INVALID_MILES_HANDLE) { retval = ::AIL_sample_user_data (SampleHandle, i); diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp index e072d8a0115..6d46bb668f4 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp @@ -57,11 +57,11 @@ #include #endif -static PrintFunc _CurMessageHandler = NULL; -static AssertPrintFunc _CurAssertHandler = NULL; -static TriggerFunc _CurTriggerHandler = NULL; -static ProfileFunc _CurProfileStartHandler = NULL; -static ProfileFunc _CurProfileStopHandler = NULL; +static PrintFunc _CurMessageHandler = nullptr; +static AssertPrintFunc _CurAssertHandler = nullptr; +static TriggerFunc _CurTriggerHandler = nullptr; +static ProfileFunc _CurProfileStartHandler = nullptr; +static ProfileFunc _CurProfileStopHandler = nullptr; // Convert the latest system error into a string and return a pointer to // a static buffer containing the error string. @@ -71,12 +71,12 @@ void Convert_System_Error_To_String(int id, char* buffer, int buf_len) #ifndef _UNIX FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, id, 0, buffer, buf_len, - NULL); + nullptr); #endif } @@ -204,7 +204,7 @@ ProfileFunc WWDebug_Install_Profile_Stop_Handler(ProfileFunc func) void WWDebug_Printf(const char * format,...) { - if (_CurMessageHandler != NULL) { + if (_CurMessageHandler != nullptr) { va_list va; char buffer[4096]; @@ -234,7 +234,7 @@ void WWDebug_Printf(const char * format,...) void WWDebug_Printf_Warning(const char * format,...) { - if (_CurMessageHandler != NULL) { + if (_CurMessageHandler != nullptr) { va_list va; char buffer[4096]; @@ -264,7 +264,7 @@ void WWDebug_Printf_Warning(const char * format,...) void WWDebug_Printf_Error(const char * format,...) { - if (_CurMessageHandler != NULL) { + if (_CurMessageHandler != nullptr) { va_list va; char buffer[4096]; @@ -294,7 +294,7 @@ void WWDebug_Printf_Error(const char * format,...) #ifdef WWDEBUG void WWDebug_Assert_Fail(const char * expr,const char * file, int line) { - if (_CurAssertHandler != NULL) { + if (_CurAssertHandler != nullptr) { char buffer[4096]; sprintf(buffer,"%s (%d) Assert: %s\n",file,line,expr); @@ -312,7 +312,7 @@ void WWDebug_Assert_Fail(const char * expr,const char * file, int line) char assertbuf[4096]; sprintf(assertbuf, "Assert failed\n\n. File %s Line %d", file, line); - int code = MessageBoxA(NULL, assertbuf, "WWDebug_Assert_Fail", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); + int code = MessageBoxA(nullptr, assertbuf, "WWDebug_Assert_Fail", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); if (code == IDABORT) { raise(SIGABRT); @@ -374,7 +374,7 @@ void __cdecl _assert(void *expr, void *filename, unsigned lineno) #ifdef WWDEBUG void WWDebug_Assert_Fail_Print(const char * expr,const char * file, int line,const char * string) { - if (_CurAssertHandler != NULL) { + if (_CurAssertHandler != nullptr) { char buffer[4096]; sprintf(buffer,"%s (%d) Assert: %s %s\n",file,line,expr, string); @@ -403,7 +403,7 @@ void WWDebug_Assert_Fail_Print(const char * expr,const char * file, int line,con *=============================================================================================*/ bool WWDebug_Check_Trigger(int trigger_num) { - if (_CurTriggerHandler != NULL) { + if (_CurTriggerHandler != nullptr) { return _CurTriggerHandler(trigger_num); } else { return false; @@ -425,7 +425,7 @@ bool WWDebug_Check_Trigger(int trigger_num) *=============================================================================================*/ void WWDebug_Profile_Start( const char * title) { - if (_CurProfileStartHandler != NULL) { + if (_CurProfileStartHandler != nullptr) { _CurProfileStartHandler( title ); } } @@ -445,7 +445,7 @@ void WWDebug_Profile_Start( const char * title) *=============================================================================================*/ void WWDebug_Profile_Stop( const char * title) { - if (_CurProfileStopHandler != NULL) { + if (_CurProfileStopHandler != nullptr) { _CurProfileStopHandler( title ); } } @@ -477,7 +477,7 @@ void WWDebug_DBWin32_Message_Handler( const char * str ) heventDBWIN = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_BUFFER_READY"); if ( !heventDBWIN ) { - //MessageBox(NULL, "DBWIN_BUFFER_READY nonexistent", NULL, MB_OK); + //MessageBox(nullptr, "DBWIN_BUFFER_READY nonexistent", nullptr, MB_OK); return; } @@ -485,15 +485,15 @@ void WWDebug_DBWin32_Message_Handler( const char * str ) heventData = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_DATA_READY"); if ( !heventData ) { - // MessageBox(NULL, "DBWIN_DATA_READY nonexistent", NULL, MB_OK); + // MessageBox(nullptr, "DBWIN_DATA_READY nonexistent", nullptr, MB_OK); CloseHandle(heventDBWIN); return; } - hSharedFile = CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, 4096, "DBWIN_BUFFER"); + hSharedFile = CreateFileMapping((HANDLE)-1, nullptr, PAGE_READWRITE, 0, 4096, "DBWIN_BUFFER"); if (!hSharedFile) { - //MessageBox(NULL, "DebugTrace: Unable to create file mapping object DBWIN_BUFFER", "Error", MB_OK); + //MessageBox(nullptr, "DebugTrace: Unable to create file mapping object DBWIN_BUFFER", "Error", MB_OK); CloseHandle(heventDBWIN); CloseHandle(heventData); return; @@ -502,7 +502,7 @@ void WWDebug_DBWin32_Message_Handler( const char * str ) lpszSharedMem = (LPSTR)MapViewOfFile(hSharedFile, FILE_MAP_WRITE, 0, 0, 512); if (!lpszSharedMem) { - //MessageBox(NULL, "DebugTrace: Unable to map shared memory", "Error", MB_OK); + //MessageBox(nullptr, "DebugTrace: Unable to map shared memory", "Error", MB_OK); CloseHandle(heventDBWIN); CloseHandle(heventData); return; diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp index 31bd9b3cf5e..52644fa4984 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp @@ -248,11 +248,11 @@ class MemLogClass ** _MemLogMutex - handle to the mutex used to arbtirate access to the logging data structures ** _MemLogLockCounter - count of the active mutex locks. */ -static MemLogClass * _TheMemLog = NULL; +static MemLogClass * _TheMemLog = nullptr; static bool _MemLogAllocated = false; #if MEMLOG_USE_MUTEX -static void * _MemLogMutex = NULL; +static void * _MemLogMutex = nullptr; static int _MemLogLockCounter = 0; #endif @@ -272,8 +272,8 @@ WWINLINE void * Get_Mem_Log_Mutex(void) { #if MEMLOG_USE_MUTEX - if (_MemLogMutex == NULL) { - _MemLogMutex=CreateMutex(NULL,false,NULL); + if (_MemLogMutex == nullptr) { + _MemLogMutex=CreateMutex(nullptr,false,nullptr); WWASSERT(_MemLogMutex); } return _MemLogMutex; @@ -291,7 +291,7 @@ WWINLINE void * Get_Mem_Log_Mutex(void) #endif #if DISABLE_MEMLOG - return NULL; + return nullptr; #endif } @@ -531,7 +531,7 @@ void WWMemoryLogClass::Register_Memory_Released(int category,int size) static void _MemLogCleanup(void) { delete _TheMemLog; - _TheMemLog = NULL; + _TheMemLog = nullptr; } @@ -539,7 +539,7 @@ MemLogClass * WWMemoryLogClass::Get_Log(void) { MemLogMutexLockClass lock; - if (_TheMemLog == NULL) { + if (_TheMemLog == nullptr) { //assert(!_MemLogAllocated); _TheMemLog = W3DNEW MemLogClass; @@ -581,7 +581,7 @@ void WWMemoryLogClass::Release_Log(void) MemLogMutexLockClass lock; delete _TheMemLog; - _TheMemLog = NULL; + _TheMemLog = nullptr; } @@ -663,7 +663,7 @@ void * WWMemoryLogClass::Allocate_Memory(size_t size) */ void * ptr = ALLOC_MEMORY(size + sizeof(MemoryLogStruct)); - if (ptr != NULL) { + if (ptr != nullptr) { /* ** Record this allocation */ diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp index d3a9e534781..c3ed92b9e2f 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp @@ -129,8 +129,8 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( const char * name, WWPro StartTime( 0 ), RecursionCounter( 0 ), Parent( parent ), - Child( NULL ), - Sibling( NULL ) + Child( nullptr ), + Sibling( nullptr ) { Reset(); @@ -141,14 +141,14 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( const char * name, WWPro } WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( unsigned id, WWProfileHierachyNodeClass * parent ) : - Name( NULL ), + Name( nullptr ), TotalCalls( 0 ), TotalTime( 0 ), StartTime( 0 ), RecursionCounter( 0 ), Parent( parent ), - Child( NULL ), - Sibling( NULL ), + Child( nullptr ), + Sibling( nullptr ), ProfileStringID(id) { Reset(); @@ -346,7 +346,7 @@ bool WWProfileHierachyNodeClass::Return( void ) ** ***************************************************************************************************/ bool WWProfileManager::IsProfileEnabled=false; -WWProfileHierachyNodeClass WWProfileManager::Root( "Root", NULL ); +WWProfileHierachyNodeClass WWProfileManager::Root( "Root", nullptr ); WWProfileHierachyNodeClass * WWProfileManager::CurrentNode = &WWProfileManager::Root; WWProfileHierachyNodeClass * WWProfileManager::CurrentRootNode = &WWProfileManager::Root; int WWProfileManager::FrameCounter = 0; @@ -482,7 +482,7 @@ void WWProfileManager::Increment_Frame_Counter( void ) if (ProfileCollecting) { float time=Get_Time_Since_Reset(); TotalFrameTimes+=time; - WWProfileHierachyNodeClass* new_root=Root.Clone_Hierarchy(NULL); + WWProfileHierachyNodeClass* new_root=Root.Clone_Hierarchy(nullptr); new_root->Set_Total_Time(time); new_root->Set_Total_Calls(1); ProfileCollectVector.Add(new_root); @@ -564,7 +564,7 @@ void WWProfileManager::End_Collecting(const char* filename) int i; if (filename && ProfileCollectVector.Count()!=0) { FileClass * file= _TheWritingFileFactory->Get_File(filename); - if (file != NULL) { + if (file != nullptr) { // // Open or create the file // @@ -722,9 +722,9 @@ static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHi char statusstring[256]; unsigned framenumber=0; float frametime; - root=NULL; - WWProfileHierachyInfoClass* parent=NULL; - WWProfileHierachyInfoClass* latest=NULL; + root=nullptr; + WWProfileHierachyInfoClass* parent=nullptr; + WWProfileHierachyInfoClass* latest=nullptr; pos+=7; // "FRAME: " @@ -765,7 +765,7 @@ static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHi new_node->Set_Total_Time(time); new_node->Set_Total_Calls(count); latest=new_node; - if (root==NULL) root=new_node; + if (root==nullptr) root=new_node; } else if (memory[pos]=='{') { parent=latest; @@ -787,12 +787,12 @@ static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHi void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyInfoClass**& array, unsigned& count) { - array=NULL; + array=nullptr; count=0; unsigned i; FileClass * file= _TheFileFactory->Get_File(filename); - if (file != NULL && file->Is_Available()) { + if (file != nullptr && file->Is_Available()) { HashTemplateClass string_hash; HashTemplateClass id_hash; SimpleDynVecClass vec; @@ -819,7 +819,7 @@ void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyI id_hash.Insert(id,string); } else if (tmp[0]=='F' && tmp[1]=='R' && tmp[2]=='A' && tmp[3]=='M' && tmp[4]=='E' && tmp[5]==':') { - WWProfileHierachyInfoClass* node=NULL; + WWProfileHierachyInfoClass* node=nullptr; pos=Read_Frame(memory,pos,size,node,id_hash); if (node) { vec.Add(node); @@ -902,7 +902,7 @@ void WWProfileIterator::Next(void) bool WWProfileIterator::Is_Done(void) { - return CurrentChild == NULL; + return CurrentChild == nullptr; } void WWProfileIterator::Enter_Child( void ) @@ -914,12 +914,12 @@ void WWProfileIterator::Enter_Child( void ) void WWProfileIterator::Enter_Child( int index ) { CurrentChild = CurrentParent->Get_Child(); - while ( (CurrentChild != NULL) && (index != 0) ) { + while ( (CurrentChild != nullptr) && (index != 0) ) { index--; CurrentChild = CurrentChild->Get_Sibling(); } - if ( CurrentChild != NULL ) { + if ( CurrentChild != nullptr ) { CurrentParent = CurrentChild; CurrentChild = CurrentParent->Get_Child(); } @@ -927,7 +927,7 @@ void WWProfileIterator::Enter_Child( int index ) void WWProfileIterator::Enter_Parent( void ) { - if ( CurrentParent->Get_Parent() != NULL ) { + if ( CurrentParent->Get_Parent() != nullptr ) { CurrentParent = CurrentParent->Get_Parent(); } CurrentChild = CurrentParent->Get_Child(); @@ -958,13 +958,13 @@ void WWProfileInOrderIterator::Next(void) } else { // if not, go to my parent's sibling, or his....... // Find a parent with a sibling.... bool done = false; - while ( CurrentNode != NULL && !done ) { + while ( CurrentNode != nullptr && !done ) { // go to my parent CurrentNode = CurrentNode->Get_Parent(); // If I have a sibling, go there - if ( CurrentNode != NULL && CurrentNode->Get_Sibling() != NULL ) { + if ( CurrentNode != nullptr && CurrentNode->Get_Sibling() != nullptr ) { CurrentNode = CurrentNode->Get_Sibling(); done = true; } @@ -974,7 +974,7 @@ void WWProfileInOrderIterator::Next(void) bool WWProfileInOrderIterator::Is_Done(void) { - return CurrentNode == NULL; + return CurrentNode == nullptr; } /* @@ -1003,7 +1003,7 @@ WWTimeItClass::~WWTimeItClass( void ) */ WWMeasureItClass::WWMeasureItClass( float * p_result ) { - WWASSERT(p_result != NULL); + WWASSERT(p_result != nullptr); PResult = p_result; WWProfile_Get_Ticks( &Time ); } @@ -1013,7 +1013,7 @@ WWMeasureItClass::~WWMeasureItClass( void ) __int64 End; WWProfile_Get_Ticks( &End ); End -= Time; - WWASSERT(PResult != NULL); + WWASSERT(PResult != nullptr); *PResult = End * WWProfile_Get_Inv_Processor_Ticks_Per_Second(); } @@ -1098,8 +1098,8 @@ WWProfileHierachyInfoClass::WWProfileHierachyInfoClass( const char * name, WWPro TotalCalls( 0 ), TotalTime( 0 ), Parent( parent ), - Child( NULL ), - Sibling( NULL ) + Child( nullptr ), + Sibling( nullptr ) { } diff --git a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp index 8f8ab20e218..10d874a324a 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp @@ -57,9 +57,9 @@ HRESULT CDownload::DownloadFile(LPCSTR server, LPCSTR username, LPCSTR password, // Check all parameters are non-null. - if( ( server == NULL ) || ( username == NULL ) || - ( password == NULL ) || ( file == NULL ) || - ( localfile == NULL ) || ( regkey == NULL ) ) + if( ( server == nullptr ) || ( username == nullptr ) || + ( password == nullptr ) || ( file == nullptr ) || + ( localfile == nullptr ) || ( regkey == nullptr ) ) { //////////DBGMSG("Download Paramerror"); return( DOWNLOAD_PARAMERROR ); @@ -110,7 +110,7 @@ HRESULT CDownload::DownloadFile(LPCSTR server, LPCSTR username, LPCSTR password, // Get the local filename of the last file we requested to download.... // HRESULT CDownload::GetLastLocalFile(char *local_file, int maxlen) { - if (local_file==0) + if (local_file==nullptr) return(E_FAIL); strlcpy(local_file, m_LastLocalFile, maxlen); diff --git a/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp b/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp index 01e67957ea2..e900491f4e7 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp @@ -133,7 +133,7 @@ static bool Use_Non_Blocking_Mode(void) // Fetch the flag bufsiz=sizeof(value); type=REG_DWORD; - regRetval=RegQueryValueEx(regKey, "UseNonBlockingFTP", 0, &type, (BYTE*) &value, &bufsiz); + regRetval=RegQueryValueEx(regKey, "UseNonBlockingFTP", nullptr, &type, (BYTE*) &value, &bufsiz); RegCloseKey(regKey); @@ -198,7 +198,7 @@ Cftp::~Cftp() if (m_pfLocalFile) { fclose(m_pfLocalFile); - m_pfLocalFile = NULL; + m_pfLocalFile = nullptr; } } @@ -235,7 +235,7 @@ void Cftp::ZeroStuff(void) m_iFilePos = 0; m_iStatus = FTPSTAT_INIT; m_sendNewPortStatus = 0; - m_pfLocalFile = NULL; + m_pfLocalFile = nullptr; m_findStart = 0; memset(&m_CommandSockAddr, 0, sizeof(m_CommandSockAddr)); memset(&m_DataSockAddr, 0, sizeof(m_DataSockAddr)); @@ -269,7 +269,7 @@ int Cftp::AsyncGetHostByName(char * szName, struct sockaddr_in &address ) gThreadFlag = 0; memset(&gThreadAddress,0,sizeof(gThreadAddress)); - if( CreateThread( NULL, 0, gethostbynameA, szName, 0, &threadid ) == NULL ) + if( CreateThread( nullptr, 0, gethostbynameA, szName, 0, &threadid ) == nullptr ) { return( FTP_FAILED ); } @@ -426,7 +426,7 @@ HRESULT Cftp::ConnectToServer(LPCSTR szServerName) timeval tv; tv.tv_sec=0; tv.tv_usec=0; - int retval=select(m_iCommandSocket+1,0,&wset,&eset,&tv); + int retval=select(m_iCommandSocket+1,nullptr,&wset,&eset,&tv); if (retval == 0) // not ready yet.... return(FTP_TRYING); if (FD_ISSET(m_iCommandSocket, &eset)) { @@ -665,9 +665,9 @@ HRESULT Cftp::FindFile( LPCSTR szRemoteFileName, int * piSize ) char ext[ 10 ]; if (m_findStart==0) - m_findStart=time(NULL); + m_findStart=time(nullptr); - if((time(NULL)-m_findStart) > 30) // try for 30 seconds + if((time(nullptr)-m_findStart) > 30) // try for 30 seconds { /////////DBGMSG("FindFile: Tried for too long"); m_findStart=0; @@ -675,7 +675,7 @@ HRESULT Cftp::FindFile( LPCSTR szRemoteFileName, int * piSize ) } //strcpy(m_szRemoteFilePath, "/"); // start at home - _splitpath( szRemoteFileName, NULL, m_szRemoteFilePath+strlen(m_szRemoteFilePath), + _splitpath( szRemoteFileName, nullptr, m_szRemoteFilePath+strlen(m_szRemoteFilePath), m_szRemoteFileName, ext ); strlcat(m_szRemoteFileName, ext, ARRAY_SIZE(m_szRemoteFileName)); @@ -830,7 +830,7 @@ HRESULT Cftp::FindFile( LPCSTR szRemoteFileName, int * piSize ) if( sscanf( &listline[ 32 ], " %d ", &i ) == 1 ) { - if( piSize != NULL ) + if( piSize != nullptr ) { *piSize = i; m_iFileSize = i; @@ -949,7 +949,7 @@ HRESULT Cftp::RecvReply( LPCSTR pReplyBuffer, int iSize, int * piRetCode ) // Verify that this is a complete line, if not we will keep trying til // we have one. char *end=strstr(pc, "\r\n"); - if (end == 0) + if (end == nullptr) return(FTP_TRYING); // OK, we've got a line, pull it from the socket... @@ -1028,7 +1028,7 @@ unsigned long MyIPAddress( int sockfd ) pHE = gethostbyname( pBuffer ); - if( pHE == NULL ) + if( pHE == nullptr ) { return( FTP_FAILED ); } @@ -1039,7 +1039,7 @@ unsigned long MyIPAddress( int sockfd ) i = 0; - while( ( pAddr = pHE->h_addr_list[ i++ ] ) != NULL ) + while( ( pAddr = pHE->h_addr_list[ i++ ] ) != nullptr ) { ip = *((unsigned long *)pAddr ); @@ -1227,7 +1227,7 @@ int Cftp::OpenDataConnection() return( FTP_FAILED ); } - if( ( iNewSocket = accept( m_iDataSocket, NULL, 0 ) ) < 0 ) + if( ( iNewSocket = accept( m_iDataSocket, nullptr, nullptr ) ) < 0 ) { if( WSAGetLastError() != (WSAEWOULDBLOCK ) ) { @@ -1404,14 +1404,14 @@ HRESULT Cftp::GetNextFileBlock( LPCSTR szLocalFileName, int * piTotalRead ) { if( m_iFilePos == 0 ) { - if( ( m_pfLocalFile = fopen( downloadfilename, "wb" ) ) == NULL ) + if( ( m_pfLocalFile = fopen( downloadfilename, "wb" ) ) == nullptr ) { return( FTP_FAILED ); } } else { - if( ( m_pfLocalFile = fopen( downloadfilename, "ab" ) ) == NULL ) + if( ( m_pfLocalFile = fopen( downloadfilename, "ab" ) ) == nullptr ) { return( FTP_FAILED ); } @@ -1563,7 +1563,7 @@ HRESULT Cftp::GetNextFileBlock( LPCSTR szLocalFileName, int * piTotalRead ) m_iFilePos += totread; // update read position - if( piTotalRead != NULL ) + if( piTotalRead != nullptr ) *piTotalRead = m_iFilePos; @@ -1599,7 +1599,7 @@ HRESULT Cftp::GetNextFileBlock( LPCSTR szLocalFileName, int * piTotalRead ) if( m_iStatus == FTPSTAT_FILEDATACLOSED ) { CloseDataConnection(); fclose( m_pfLocalFile ); - m_pfLocalFile = NULL; + m_pfLocalFile = nullptr; /* * Move the file from the temporary download location to its @@ -1691,7 +1691,7 @@ HRESULT Cftp::FileRecoveryPosition( LPCSTR szLocalFileName, LPCSTR szRegistryRo GetDownloadFilename(szLocalFileName, downloadfilename); FILE *testfp = fopen( downloadfilename, "rb" ); - if( testfp == NULL ) + if( testfp == nullptr ) { m_iFilePos = 0; return 0; @@ -1711,7 +1711,7 @@ HRESULT Cftp::FileRecoveryPosition( LPCSTR szLocalFileName, LPCSTR szRegistryRo char regkey[ 512 ]; unsigned long t1, t2; - if( ( szRegistryRoot == NULL ) || ( szLocalFileName == NULL ) ) + if( ( szRegistryRoot == nullptr ) || ( szLocalFileName == nullptr ) ) { // Bail out return( 0 ); @@ -1760,7 +1760,7 @@ HRESULT Cftp::FileRecoveryPosition( LPCSTR szLocalFileName, LPCSTR szRegistryRo // File previously downloaded testfp = fopen( FTP_TEMPFILENAME, "rb" ); - if( testfp == NULL ) + if( testfp == nullptr ) { m_iFilePos = 0; RegCloseKey(hkey); @@ -1832,7 +1832,7 @@ bool Prepare_Directories(const char *rootdir, const char *filename) { strlcpy(tempstr,filename,cptr-filename + 1); sprintf(newdir,"%s\\%s",rootdir, tempstr); - if (!CreateDirectory(newdir, NULL)) + if (!CreateDirectory(newdir, nullptr)) return false; //if ((_mkdir(newdir) == -1) && ((errno == ENOENT || errno==EACCES))) //return(false); diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index 494e09ecb29..d553df93db3 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -37,7 +37,7 @@ bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::s if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.c_str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -60,7 +60,7 @@ bool getUnsignedIntFromRegistry(HKEY root, std::string path, std::string key, un if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.c_str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -81,7 +81,7 @@ bool setStringInRegistry( HKEY root, std::string path, std::string key, std::str int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_SZ; size = val.length()+1; @@ -100,7 +100,7 @@ bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, uns int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_DWORD; size = 4; diff --git a/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h b/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h index aed9a03a444..88d6885ae85 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h +++ b/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h @@ -64,5 +64,5 @@ T * Binary_Search(T * A, int n, T const & target) stride -= pivot + 1; } } - return (NULL); + return (nullptr); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp b/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp index 368bcd03ca7..dab6686125c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp @@ -19,24 +19,24 @@ #include "DbgHelpLoader.h" -DbgHelpLoader* DbgHelpLoader::Inst = NULL; +DbgHelpLoader* DbgHelpLoader::Inst = nullptr; CriticalSectionClass DbgHelpLoader::CriticalSection; DbgHelpLoader::DbgHelpLoader() - : m_symInitialize(NULL) - , m_symCleanup(NULL) - , m_symLoadModule(NULL) - , m_symUnloadModule(NULL) - , m_symGetModuleBase(NULL) - , m_symGetSymFromAddr(NULL) - , m_symGetLineFromAddr(NULL) - , m_symSetOptions(NULL) - , m_symFunctionTableAccess(NULL) - , m_stackWalk(NULL) + : m_symInitialize(nullptr) + , m_symCleanup(nullptr) + , m_symLoadModule(nullptr) + , m_symUnloadModule(nullptr) + , m_symGetModuleBase(nullptr) + , m_symGetSymFromAddr(nullptr) + , m_symGetLineFromAddr(nullptr) + , m_symSetOptions(nullptr) + , m_symFunctionTableAccess(nullptr) + , m_stackWalk(nullptr) #ifdef RTS_ENABLE_CRASHDUMP - , m_miniDumpWriteDump(NULL) + , m_miniDumpWriteDump(nullptr) #endif - , m_dllModule(HMODULE(0)) + , m_dllModule(HMODULE(nullptr)) , m_referenceCount(0) , m_failed(false) , m_loadedFromSystem(false) @@ -51,7 +51,7 @@ bool DbgHelpLoader::isLoaded() { CriticalSectionClass::LockClass lock(CriticalSection); - return Inst != NULL && Inst->m_dllModule != HMODULE(0); + return Inst != nullptr && Inst->m_dllModule != HMODULE(nullptr); } bool DbgHelpLoader::isLoadedFromSystem() @@ -65,14 +65,14 @@ bool DbgHelpLoader::isFailed() { CriticalSectionClass::LockClass lock(CriticalSection); - return Inst != NULL && Inst->m_failed; + return Inst != nullptr && Inst->m_failed; } bool DbgHelpLoader::load() { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst == NULL) + if (Inst == nullptr) { // Cannot use new/delete here when this is loaded during game memory initialization. void* p = GlobalAlloc(GMEM_FIXED, sizeof(DbgHelpLoader)); @@ -96,11 +96,11 @@ bool DbgHelpLoader::load() strlcat(dllFilename, "\\dbghelp.dll", ARRAY_SIZE(dllFilename)); Inst->m_dllModule = ::LoadLibraryA(dllFilename); - if (Inst->m_dllModule == HMODULE(0)) + if (Inst->m_dllModule == HMODULE(nullptr)) { // Not found. Try load dbghelp.dll from the work directory. Inst->m_dllModule = ::LoadLibraryA("dbghelp.dll"); - if (Inst->m_dllModule == HMODULE(0)) + if (Inst->m_dllModule == HMODULE(nullptr)) { Inst->m_failed = true; return false; @@ -125,7 +125,7 @@ bool DbgHelpLoader::load() Inst->m_miniDumpWriteDump = reinterpret_cast(::GetProcAddress(Inst->m_dllModule, "MiniDumpWriteDump")); #endif - if (Inst->m_symInitialize == NULL || Inst->m_symCleanup == NULL) + if (Inst->m_symInitialize == nullptr || Inst->m_symCleanup == nullptr) { freeResources(); Inst->m_failed = true; @@ -139,7 +139,7 @@ void DbgHelpLoader::unload() { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst == NULL) + if (Inst == nullptr) return; if (--Inst->m_referenceCount != 0) @@ -149,7 +149,7 @@ void DbgHelpLoader::unload() Inst->~DbgHelpLoader(); GlobalFree(Inst); - Inst = NULL; + Inst = nullptr; } void DbgHelpLoader::freeResources() @@ -161,24 +161,24 @@ void DbgHelpLoader::freeResources() symCleanup(*Inst->m_initializedProcesses.begin()); } - if (Inst->m_dllModule != HMODULE(0)) + if (Inst->m_dllModule != HMODULE(nullptr)) { ::FreeLibrary(Inst->m_dllModule); - Inst->m_dllModule = HMODULE(0); + Inst->m_dllModule = HMODULE(nullptr); } - Inst->m_symInitialize = NULL; - Inst->m_symCleanup = NULL; - Inst->m_symLoadModule = NULL; - Inst->m_symUnloadModule = NULL; - Inst->m_symGetModuleBase = NULL; - Inst->m_symGetSymFromAddr = NULL; - Inst->m_symGetLineFromAddr = NULL; - Inst->m_symSetOptions = NULL; - Inst->m_symFunctionTableAccess = NULL; - Inst->m_stackWalk = NULL; + Inst->m_symInitialize = nullptr; + Inst->m_symCleanup = nullptr; + Inst->m_symLoadModule = nullptr; + Inst->m_symUnloadModule = nullptr; + Inst->m_symGetModuleBase = nullptr; + Inst->m_symGetSymFromAddr = nullptr; + Inst->m_symGetLineFromAddr = nullptr; + Inst->m_symSetOptions = nullptr; + Inst->m_symFunctionTableAccess = nullptr; + Inst->m_stackWalk = nullptr; #ifdef RTS_ENABLE_CRASHDUMP - Inst->m_miniDumpWriteDump = NULL; + Inst->m_miniDumpWriteDump = nullptr; #endif Inst->m_loadedFromSystem = false; @@ -191,7 +191,7 @@ BOOL DbgHelpLoader::symInitialize( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst == NULL) + if (Inst == nullptr) return FALSE; if (Inst->m_initializedProcesses.find(hProcess) != Inst->m_initializedProcesses.end()) @@ -218,7 +218,7 @@ BOOL DbgHelpLoader::symCleanup( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst == NULL) + if (Inst == nullptr) return FALSE; if (stl::find_and_erase(Inst->m_initializedProcesses, hProcess)) @@ -242,7 +242,7 @@ BOOL DbgHelpLoader::symLoadModule( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symLoadModule) + if (Inst != nullptr && Inst->m_symLoadModule) return Inst->m_symLoadModule(hProcess, hFile, ImageName, ModuleName, BaseOfDll, SizeOfDll); return FALSE; @@ -254,7 +254,7 @@ DWORD DbgHelpLoader::symGetModuleBase( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symGetModuleBase) + if (Inst != nullptr && Inst->m_symGetModuleBase) return Inst->m_symGetModuleBase(hProcess, dwAddr); return 0u; @@ -266,7 +266,7 @@ BOOL DbgHelpLoader::symUnloadModule( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symUnloadModule) + if (Inst != nullptr && Inst->m_symUnloadModule) return Inst->m_symUnloadModule(hProcess, BaseOfDll); return FALSE; @@ -280,7 +280,7 @@ BOOL DbgHelpLoader::symGetSymFromAddr( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symGetSymFromAddr) + if (Inst != nullptr && Inst->m_symGetSymFromAddr) return Inst->m_symGetSymFromAddr(hProcess, Address, Displacement, Symbol); return FALSE; @@ -294,7 +294,7 @@ BOOL DbgHelpLoader::symGetLineFromAddr( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symGetLineFromAddr) + if (Inst != nullptr && Inst->m_symGetLineFromAddr) return Inst->m_symGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line); return FALSE; @@ -305,7 +305,7 @@ DWORD DbgHelpLoader::symSetOptions( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symSetOptions) + if (Inst != nullptr && Inst->m_symSetOptions) return Inst->m_symSetOptions(SymOptions); return 0u; @@ -317,10 +317,10 @@ LPVOID DbgHelpLoader::symFunctionTableAccess( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_symFunctionTableAccess) + if (Inst != nullptr && Inst->m_symFunctionTableAccess) return Inst->m_symFunctionTableAccess(hProcess, AddrBase); - return NULL; + return nullptr; } BOOL DbgHelpLoader::stackWalk( @@ -336,7 +336,7 @@ BOOL DbgHelpLoader::stackWalk( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_stackWalk) + if (Inst != nullptr && Inst->m_stackWalk) return Inst->m_stackWalk(MachineType, hProcess, hThread, StackFrame, ContextRecord, ReadMemoryRoutine, FunctionTableAccessRoutine, GetModuleBaseRoutine, TranslateAddress); return FALSE; @@ -354,7 +354,7 @@ BOOL DbgHelpLoader::miniDumpWriteDump( { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst != NULL && Inst->m_miniDumpWriteDump) + if (Inst != nullptr && Inst->m_miniDumpWriteDump) return Inst->m_miniDumpWriteDump(hProcess, ProcessId, hFile, DumpType, ExceptionParam, UserStreamParam, CallbackParam); return FALSE; diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp index e49d6ffb0eb..863f6ed63dd 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp @@ -85,8 +85,8 @@ static char ExceptionText [65536]; bool SymbolsAvailable = false; HINSTANCE ImageHelp = (HINSTANCE) -1; -void (*AppCallback)(void) = NULL; -char *(*AppVersionCallback)(void) = NULL; +void (*AppCallback)(void) = nullptr; +char *(*AppVersionCallback)(void) = nullptr; /* ** Flag to indicate we should exit when an exception occurs. @@ -127,15 +127,15 @@ typedef LPVOID (WINAPI *SymFunctionTableAccessType) (HANDLE hProcess, DWORD Addr typedef DWORD (WINAPI *SymGetModuleBaseType) (HANDLE hProcess, DWORD dwAddr); -static SymCleanupType _SymCleanup = NULL; -static SymGetSymFromAddrType _SymGetSymFromAddr = NULL; -static SymInitializeType _SymInitialize = NULL; -static SymLoadModuleType _SymLoadModule = NULL; -static SymSetOptionsType _SymSetOptions = NULL; -static SymUnloadModuleType _SymUnloadModule = NULL; -static StackWalkType _StackWalk = NULL; -static SymFunctionTableAccessType _SymFunctionTableAccess = NULL; -static SymGetModuleBaseType _SymGetModuleBase = NULL; +static SymCleanupType _SymCleanup = nullptr; +static SymGetSymFromAddrType _SymGetSymFromAddr = nullptr; +static SymInitializeType _SymInitialize = nullptr; +static SymLoadModuleType _SymLoadModule = nullptr; +static SymSetOptionsType _SymSetOptions = nullptr; +static SymUnloadModuleType _SymUnloadModule = nullptr; +static StackWalkType _StackWalk = nullptr; +static SymFunctionTableAccessType _SymFunctionTableAccess = nullptr; +static SymGetModuleBaseType _SymGetModuleBase = nullptr; static char const *const ImagehelpFunctionNames[] = { @@ -148,7 +148,7 @@ static char const *const ImagehelpFunctionNames[] = "StackWalk", "SymFunctionTableAccess", "SymGetModuleBaseType", - NULL + nullptr }; @@ -201,7 +201,7 @@ int __cdecl _purecall(void) char const * Last_Error_Text(void) { static char message_buffer[256]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &message_buffer[0], 256, NULL); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &message_buffer[0], 256, nullptr); return (message_buffer); } @@ -352,9 +352,9 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) */ HINSTANCE imagehelp = LoadLibrary("IMAGEHLP.DLL"); - if (imagehelp != NULL) { + if (imagehelp != nullptr) { DebugString ("Exception Handler: Found IMAGEHLP.DLL - linking to required functions\n"); - char const *function_name = NULL; + char const *function_name = nullptr; unsigned long *fptr = (unsigned long*) &_SymCleanup; int count = 0; @@ -374,14 +374,14 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) /* ** Retrieve the programs symbols if they are available */ - if (_SymSetOptions != NULL) { + if (_SymSetOptions != nullptr) { _SymSetOptions(SYMOPT_DEFERRED_LOADS); } int symload = 0; int symbols_available = false; - if (_SymInitialize != NULL && _SymInitialize (GetCurrentProcess(), NULL, false)) { + if (_SymInitialize != nullptr && _SymInitialize (GetCurrentProcess(), nullptr, false)) { DebugString("Exception Handler: Symbols are available\r\n\n"); symbols_available = true; } @@ -389,19 +389,19 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) if (!symbols_available) { DebugString ("Exception Handler: SymInitialize failed with code %d - %s\n", GetLastError(), Last_Error_Text()); } else { - if (_SymSetOptions != NULL) { + if (_SymSetOptions != nullptr) { _SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME); } char module_name[_MAX_PATH]; - GetModuleFileName(NULL, module_name, sizeof(module_name)); + GetModuleFileName(nullptr, module_name, sizeof(module_name)); - if (_SymLoadModule != NULL) { - symload = _SymLoadModule(GetCurrentProcess(), NULL, module_name, NULL, 0, 0); + if (_SymLoadModule != nullptr) { + symload = _SymLoadModule(GetCurrentProcess(), nullptr, module_name, nullptr, 0, 0); } if (!symload) { - assert(_SymLoadModule != NULL); + assert(_SymLoadModule != nullptr); DebugString ("Exception Handler: SymLoad failed for module %s with code %d - %s\n", module_name, GetLastError(), Last_Error_Text()); } } @@ -468,11 +468,11 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) symptr->Address = context->Eip; if (!IsBadCodePtr((FARPROC)context->Eip)) { - if (_SymGetSymFromAddr != NULL && _SymGetSymFromAddr (GetCurrentProcess(), context->Eip, &displacement, symptr)) { + if (_SymGetSymFromAddr != nullptr && _SymGetSymFromAddr (GetCurrentProcess(), context->Eip, &displacement, symptr)) { sprintf (scrap, "Exception occurred at %08X - %s + %08X\r\n", context->Eip, symptr->Name, displacement); } else { DebugString ("Exception Handler: Failed to get symbol for EIP\r\n"); - if (_SymGetSymFromAddr != NULL) { + if (_SymGetSymFromAddr != nullptr) { DebugString ("Exception Handler: SymGetSymFromAddr failed with code %d - %s\n", GetLastError(), Last_Error_Text()); } sprintf (scrap, "Exception occurred at %08X\r\n", context->Eip); @@ -507,7 +507,7 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) symptr->Size = 0; symptr->Address = temp_addr; - if (_SymGetSymFromAddr != NULL && _SymGetSymFromAddr (GetCurrentProcess(), temp_addr, &displacement, symptr)) { + if (_SymGetSymFromAddr != nullptr && _SymGetSymFromAddr (GetCurrentProcess(), temp_addr, &displacement, symptr)) { char symbuf[256]; sprintf(symbuf, "%s + %08X\r\n", symptr->Name, displacement); Add_Txt(symbuf); @@ -693,7 +693,7 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) symptr->Size = 0; symptr->Address = *stackptr; - if (_SymGetSymFromAddr != NULL && _SymGetSymFromAddr (GetCurrentProcess(), *stackptr, &displacement, symptr)) { + if (_SymGetSymFromAddr != nullptr && _SymGetSymFromAddr (GetCurrentProcess(), *stackptr, &displacement, symptr)) { char symbuf[256]; sprintf(symbuf, " - %s + %08X", symptr->Name, displacement); strlcat(scrap, symbuf, ARRAY_SIZE(scrap)); @@ -712,13 +712,13 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) ** Unload the symbols. */ if (symbols_available) { - if (_SymCleanup != NULL) { + if (_SymCleanup != nullptr) { _SymCleanup (GetCurrentProcess()); } if (symload) { - if (_SymUnloadModule != NULL) { - _SymUnloadModule(GetCurrentProcess(), NULL); + if (_SymUnloadModule != nullptr) { + _SymUnloadModule(GetCurrentProcess(), 0); } } @@ -810,9 +810,9 @@ int Exception_Handler(int exception_code, EXCEPTION_POINTERS *e_info) */ HANDLE debug_file; DWORD actual; - debug_file = CreateFile("_except.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + debug_file = CreateFile("_except.txt", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (debug_file != INVALID_HANDLE_VALUE){ - WriteFile(debug_file, ExceptionText, strlen(ExceptionText), &actual, NULL); + WriteFile(debug_file, ExceptionText, strlen(ExceptionText), &actual, nullptr); CloseHandle (debug_file); #if (0) @@ -1064,8 +1064,8 @@ void Load_Image_Helper(void) if (ImageHelp == (HINSTANCE)-1) { ImageHelp = LoadLibrary("IMAGEHLP.DLL"); - if (ImageHelp != NULL) { - char const *function_name = NULL; + if (ImageHelp != nullptr) { + char const *function_name = nullptr; unsigned long *fptr = (unsigned long *) &_SymCleanup; int count = 0; @@ -1083,29 +1083,29 @@ void Load_Image_Helper(void) /* ** Retrieve the programs symbols if they are available. This can be a .pdb or a .dbg file. */ - if (_SymSetOptions != NULL) { + if (_SymSetOptions != nullptr) { _SymSetOptions(SYMOPT_DEFERRED_LOADS); } int symload = 0; - if (_SymInitialize != NULL && _SymInitialize(GetCurrentProcess(), NULL, FALSE)) { + if (_SymInitialize != nullptr && _SymInitialize(GetCurrentProcess(), nullptr, FALSE)) { - if (_SymSetOptions != NULL) { + if (_SymSetOptions != nullptr) { _SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME); } char exe_name[_MAX_PATH]; - GetModuleFileName(NULL, exe_name, sizeof(exe_name)); + GetModuleFileName(nullptr, exe_name, sizeof(exe_name)); - if (_SymLoadModule != NULL) { - symload = _SymLoadModule(GetCurrentProcess(), NULL, exe_name, NULL, 0, 0); + if (_SymLoadModule != nullptr) { + symload = _SymLoadModule(GetCurrentProcess(), nullptr, exe_name, nullptr, 0, 0); } if (symload) { SymbolsAvailable = true; } else { - //assert (_SymLoadModule != NULL); + //assert (_SymLoadModule != nullptr); //DebugString ("SymLoad failed for module %s with code %d - %s\n", szModuleName, GetLastError(), Last_Error_Text()); } } @@ -1151,7 +1151,7 @@ bool Lookup_Symbol(void *code_ptr, char *symbol, int &displacement) /* ** Make sure symbols are available. */ - if (!SymbolsAvailable || _SymGetSymFromAddr == NULL) { + if (!SymbolsAvailable || _SymGetSymFromAddr == nullptr) { return(false); } @@ -1196,7 +1196,7 @@ bool Lookup_Symbol(void *code_ptr, char *symbol, int &displacement) * * * INPUT: Ptr to return address list * * Number of return addresses to fetch * - * Ptr to optional context. NULL means use current * + * Ptr to optional context. null means use current * * * * OUTPUT: Number of return addresses found * * * @@ -1220,7 +1220,7 @@ int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *cont /* ** If there is no debug support .dll available then we can't walk the stack. */ - if (ImageHelp == NULL) { + if (ImageHelp == nullptr) { return(0); } @@ -1262,12 +1262,12 @@ int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *cont ** Walk the stack by the requested number of return address iterations. */ for (int i = 0; i < num_addresses + 1; i++) { - if (_StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &stack_frame, NULL, NULL, _SymFunctionTableAccess, _SymGetModuleBase, NULL)) { + if (_StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &stack_frame, nullptr, nullptr, _SymFunctionTableAccess, _SymGetModuleBase, nullptr)) { /* ** First result will always be the return address we were called from. */ - if (i==0 && context == NULL) { + if (i==0 && context == nullptr) { continue; } unsigned long return_address = stack_frame.AddrReturn.Offset; diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.h b/Core/Libraries/Source/WWVegas/WWLib/Except.h index e67a4b1f64e..69a7bf3b6cc 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.h @@ -46,7 +46,7 @@ typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS; typedef struct _CONTEXT CONTEXT; int Exception_Handler(int exception_code, EXCEPTION_POINTERS *e_info); -int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *context = NULL); +int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *context = nullptr); bool Lookup_Symbol(void *code_ptr, char *symbol, int &displacement); void Load_Image_Helper(void); void Register_Thread_ID(unsigned long thread_id, char *thread_name, bool main = false); diff --git a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h index bf45cf9bc51..c2e72bcba99 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h +++ b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h @@ -129,7 +129,7 @@ class FastAllocatorGeneral; //Allocates and deletes items of any size. Can use template class StackAllocator{ public: - StackAllocator() : mnAllocCount(-1), mpTHeap(NULL){} + StackAllocator() : mnAllocCount(-1), mpTHeap(nullptr){} ~StackAllocator(){ if(mnAllocCount != -1){ //If there is anything to do... if(mpTHeap) @@ -159,7 +159,7 @@ class StackAllocator{ //Use the placement operator new. This simply calls the constructor //of T with 'this' set to the input address. Note that we don't put //a '()' after the T this is because () causes trivial types like int - //and class* to be assigned zero/NULL. We don't want that. + //and class* to be assigned zero/null. We don't want that. new(pTArray)T; ++pTArray; } @@ -187,7 +187,7 @@ class StackAllocator{ } else if(pT == mpTHeap){ //If the allocation came from our heap... delete[] mpTHeap; //The compiler will call the destructors here. - mpTHeap = NULL; //We clear these out so that we can possibly + mpTHeap = nullptr; //We clear these out so that we can possibly mnAllocCount = -1; // use the allocator again. } else //Else the allocation came from the external heap. @@ -196,7 +196,7 @@ class StackAllocator{ protected: int mnAllocCount; //Count of objects allocated. -1 means that nothing is allocated. We don't use zero because zero is a legal allocation count in C++. - T* mpTHeap; //This is normally NULL, but gets used of the allocation request is too high. + T* mpTHeap; //This is normally null, but gets used of the allocation request is too high. char mTArray[nStackCount*sizeof(T)]; //This is our stack memory. }; /////////////////////////////////////////////////////////////////////////////// @@ -492,8 +492,8 @@ WWINLINE void FastAllocatorGeneral::Free(void* pAlloc) } //ANSI C requires: -// (1) realloc(NULL, newsize) is equivalent to malloc(newsize). -// (2) realloc(pblock, 0) is equivalent to free(pblock) (except that NULL is returned). +// (1) realloc(nullptr, newsize) is equivalent to malloc(newsize). +// (2) realloc(pblock, 0) is equivalent to free(pblock) (except that nullptr is returned). // (3) if the realloc() fails, the object pointed to by pblock is left unchanged. // WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){ @@ -507,7 +507,7 @@ WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){ return pNewAlloc; } Free(pAlloc); - return NULL; + return nullptr; } @@ -544,7 +544,7 @@ WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){ T* address(T& t) const { return (&t); } //These two are slightly strange but const T* address(const T& t) const { return (&t); } //required functions. Just do it. - static T* allocate(size_t n, const void* =NULL) { return (T*)FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T)); } + static T* allocate(size_t n, const void* =nullptr) { return (T*)FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T)); } static void construct(T* ptr, const T& value) { new(ptr) T(value); } static void deallocate(void* ptr, size_t /*n*/) { FastAllocatorGeneral::Get_Allocator()->Free(ptr); } static void destroy(T* ptr) { ptr->~T(); } @@ -586,7 +586,7 @@ WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){ pointer address(reference x) const { return &x; } const_pointer address(const_reference x) const { return &x; } - T* allocate(size_type n, const void* = NULL) { return n != 0 ? static_cast(FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T))) : NULL; } + T* allocate(size_type n, const void* = nullptr) { return n != 0 ? static_cast(FastAllocatorGeneral::Get_Allocator()->Alloc(n*sizeof(T))) : nullptr; } void deallocate(pointer p, size_type n) { FastAllocatorGeneral::Get_Allocator()->Free(p); } size_type max_size() const { return size_t(-1) / sizeof(T); } void construct(pointer p, const T& val) { new(p) T(val); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h b/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h index f0758d72277..d916bc316fc 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h +++ b/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h @@ -50,10 +50,6 @@ #include "LISTNODE.h" #include -#ifndef NULL -#define NULL (0L) -#endif - #define A_LARGE_PRIME_NUMBER 257 // HashListClass<> and HashNodeClass<>: @@ -156,14 +152,14 @@ class HashNodeClass : public DataNode *>, public U if (next && next->Is_Valid()) { return(next); } - return(NULL); + return(nullptr); } HashNodeClass *Prev_Valid() { HashNodeClass *prev = Prev(); if (prev && prev->Is_Valid()) { return(prev); } - return(NULL); + return(nullptr); } // Get record that is in hash table. @@ -496,7 +492,7 @@ HashNodeClass *HashListClass::Find(unsigned key) assert(cur); assert(cur->Is_Valid()); } - return(NULL); + return(nullptr); } @@ -534,7 +530,7 @@ void HashListClass::Remove(HashNodeClass *node) if (Is_Last(node)) { // SKB: 2/20/01 - clear incase inserted in new list later. Clear_Last(node); - HashTable[hashidx] = NULL; + HashTable[hashidx] = nullptr; UsedValues--; } else { HashTable[hashidx] = node->Next_Valid(); diff --git a/Core/Libraries/Source/WWVegas/WWLib/INDEX.h b/Core/Libraries/Source/WWVegas/WWLib/INDEX.h index 8356c1762b5..219dc2c8536 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/INDEX.h +++ b/Core/Libraries/Source/WWVegas/WWLib/INDEX.h @@ -293,7 +293,7 @@ bool IndexClass::Increase_Table_Size(int amount) if (amount < 0) return(false); NodeElement * table = W3DNEWARRAY NodeElement[IndexSize + amount]; - if (table != NULL) { + if (table != nullptr) { /* ** Copy all valid nodes into the new table. @@ -680,7 +680,7 @@ int _USERENTRY IndexClass::search_compfunc(void const * ptr1, void con * INPUT: id -- The index ID to search for. * * * * OUTPUT: Returns with a pointer to the NodeElement that matches the index ID specified. If * - * no matching index could be found, then NULL is returned. * + * no matching index could be found, then nullptr is returned. * * * * WARNINGS: none * * * diff --git a/Core/Libraries/Source/WWVegas/WWLib/INI.h b/Core/Libraries/Source/WWVegas/WWLib/INI.h index dcfa6a631ce..9f3b2e3d9d8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/INI.h +++ b/Core/Libraries/Source/WWVegas/WWLib/INI.h @@ -63,10 +63,6 @@ template class TRect; template class List; template class IndexClass; -#ifndef NULL -#define NULL 0L -#endif - /* ** This is an INI database handler class. It handles a database with a disk format identical ** to the INI files commonly used by Windows. @@ -107,19 +103,19 @@ class INIClass { /* ** Erase all data within this INI file manager. */ - bool Clear(char const * section = NULL, char const * entry = NULL); + bool Clear(char const * section = nullptr, char const * entry = nullptr); // int Line_Count(char const * section) const; bool Is_Loaded(void) const; int Size(void) const; - bool Is_Present(char const * section, char const * entry = NULL) const {if (entry == 0) return(Find_Section(section) != 0);return(Find_Entry(section, entry) != 0);} + bool Is_Present(char const * section, char const * entry = nullptr) const {if (entry == 0) return(Find_Section(section) != 0);return(Find_Entry(section, entry) != 0);} /* ** Fetch the number of sections in the INI file or verify if a specific ** section is present. */ int Section_Count(void) const; - bool Section_Present(char const * section) const {return(Find_Section(section) != NULL);} + bool Section_Present(char const * section) const {return(Find_Section(section) != nullptr);} /* ** Fetch the number of entries in a section or get a particular entry in a section. diff --git a/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h b/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h index 159552c1e1a..fc510a9420b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h @@ -55,7 +55,7 @@ class GenericList; class GenericNode { public: - GenericNode(void) : NextNode(0), PrevNode(0) {} + GenericNode(void) : NextNode(nullptr), PrevNode(nullptr) {} virtual ~GenericNode(void) {Unlink();} GenericNode(GenericNode & node) {node.Link(this);} GenericNode & operator = (GenericNode & node) { @@ -73,8 +73,8 @@ class GenericNode { if (Is_Valid()) { PrevNode->NextNode = NextNode; NextNode->PrevNode = PrevNode; - PrevNode = 0; - NextNode = 0; + PrevNode = nullptr; + NextNode = nullptr; } } @@ -96,13 +96,13 @@ class GenericNode { GenericNode * Next(void) const {return(NextNode);} GenericNode * Next_Valid(void) const { - return ((NextNode && NextNode->NextNode) ? NextNode : (GenericNode *)0); + return ((NextNode && NextNode->NextNode) ? NextNode : (GenericNode *)nullptr); } GenericNode * Prev(void) const {return(PrevNode);} GenericNode * Prev_Valid(void) const { - return ((PrevNode && PrevNode->PrevNode) ? PrevNode : (GenericNode *)0); + return ((PrevNode && PrevNode->PrevNode) ? PrevNode : (GenericNode *)nullptr); } - bool Is_Valid(void) const {return(this != (GenericNode *)0 && NextNode != (GenericNode *)0 && PrevNode != (GenericNode *)0);} + bool Is_Valid(void) const {return(this != (GenericNode *)nullptr && NextNode != (GenericNode *)nullptr && PrevNode != (GenericNode *)nullptr);} protected: GenericNode * NextNode; @@ -131,14 +131,14 @@ class GenericList { GenericNode * First_Valid(void) const { GenericNode *node = FirstNode.Next(); - return (node->Next() ? node : (GenericNode *)0); + return (node->Next() ? node : (GenericNode *)nullptr); } GenericNode * Last(void) const {return(LastNode.Prev());} GenericNode * Last_Valid(void) const { GenericNode *node = LastNode.Prev(); - return (node->Prev() ? node : (GenericNode *)0); + return (node->Prev() ? node : (GenericNode *)nullptr); } bool Is_Empty(void) const {return(!FirstNode.Next()->Is_Valid());} diff --git a/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h b/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h index 969c5c7bfe5..99792dceb2d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h @@ -60,7 +60,7 @@ class RAMFileClass : public FileClass virtual void Close(void); virtual unsigned long Get_Date_Time(void) {return(0);} virtual bool Set_Date_Time(unsigned long ) {return(true);} - virtual void Error(int , int = false, char const * =NULL) {} + virtual void Error(int , int = false, char const * =nullptr) {} virtual void Bias(int start, int length=-1); operator char const * () {return File_Name();} diff --git a/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h b/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h index a770ca7ceed..3d6c17be7b1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h @@ -44,7 +44,7 @@ // #include "win.h" -#define NULL_HANDLE NULL +#define NULL_HANDLE nullptr #define HANDLE_TYPE FILE* #include "WWFILE.h" #include "wwstring.h" @@ -98,7 +98,7 @@ class RawFileClass : public FileClass virtual void Close(void); virtual unsigned long Get_Date_Time(void); virtual bool Set_Date_Time(unsigned long datetime); - virtual void Error(int error, int canretry = false, char const * filename=NULL); + virtual void Error(int error, int canretry = false, char const * filename=nullptr); virtual void Bias(int start, int length=-1); virtual void * Get_File_Handle(void) { return Handle; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/SLIST.h b/Core/Libraries/Source/WWVegas/WWLib/SLIST.h index f93695811a4..b27ca0d1025 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/SLIST.h +++ b/Core/Libraries/Source/WWVegas/WWLib/SLIST.h @@ -55,10 +55,6 @@ #include "SLNODE.h" -#ifndef NULL -#define NULL 0L -#endif - template class SList { private: @@ -73,8 +69,8 @@ class SList { // SList(void) { - HeadNode = NULL; - TailNode = NULL; + HeadNode = nullptr; + TailNode = nullptr; }; virtual ~SList(void) { Remove_All(); }; @@ -97,13 +93,13 @@ class SList { virtual bool Remove(T *element); // remove an individual element virtual void Remove_All(void); // Remove all nodes from list - // Insert before oldnode, if oldnode is NULL then before head node - virtual bool Insert_Before(T *newnode, T *oldnode = NULL); + // Insert before oldnode, if oldnode is null then before head node + virtual bool Insert_Before(T *newnode, T *oldnode = nullptr); // Could possibly implement an InsertBefore that operates on a whole list - // Insert after oldnode, if oldnode is NULL then insert at head - virtual bool Insert_After(T *newnode, T *oldnode = NULL); + // Insert after oldnode, if oldnode is null then insert at head + virtual bool Insert_After(T *newnode, T *oldnode = nullptr); // Could possibly implement an InsertAfter that operates on a whole list virtual bool Is_Empty(void) const; // True if list is empty @@ -131,11 +127,11 @@ template bool SList::Insert_Before(T *newnode, T *oldnode) { // if not adding anything then just skip the add. - if (newnode == NULL) + if (newnode == nullptr) return false; // if there is no head to the list then add it to head - if (oldnode == NULL || HeadNode == NULL || HeadNode->Data() == oldnode) { + if (oldnode == nullptr || HeadNode == nullptr || HeadNode->Data() == oldnode) { return(Add_Head(newnode)); } @@ -148,7 +144,7 @@ bool SList::Insert_Before(T *newnode, T *oldnode) // Verify that we found the entry as it might not have been in the list. // Note: Cur will be valid because it wont be assigned unless Next is // valid. - if (cur->Next() != NULL && cur->Next()->Data() == oldnode) { + if (cur->Next() != nullptr && cur->Next()->Data() == oldnode) { SLNode *temp = new SLNode (newnode); temp->Set_Next(cur->Next()); cur->Set_Next(temp); @@ -177,10 +173,10 @@ bool SList::Insert_Before(T *newnode, T *oldnode) template bool SList::Insert_After(T *newnode, T *oldnode) { - if (newnode == NULL) + if (newnode == nullptr) return false; - if (oldnode == NULL || HeadNode == NULL) { + if (oldnode == nullptr || HeadNode == nullptr) { return(Add_Head(newnode)); } @@ -189,7 +185,7 @@ bool SList::Insert_After(T *newnode, T *oldnode) for (cur = HeadNode; cur && cur->Data() != oldnode; cur = cur->Next()) {} // Did we find the data we want to insert after? - if (cur != NULL && cur->Data() == oldnode) { + if (cur != nullptr && cur->Data() == oldnode) { if (cur == TailNode) { // Inserting after tail return(Add_Tail(newnode)); } @@ -221,7 +217,7 @@ void SList::Remove_All(void) next = cur->Next(); delete cur; } - HeadNode = TailNode = NULL; + HeadNode = TailNode = nullptr; } /************************************************************************** @@ -240,12 +236,12 @@ template bool SList::Remove(T *element) { // if not adding anything then just skip the add. - if (element == NULL || HeadNode == NULL) + if (element == nullptr || HeadNode == nullptr) return false; // if the head is the element in question remove it if (HeadNode->Data() == element) { - return(Remove_Head() != NULL ? true : false); + return(Remove_Head() != nullptr ? true : false); } // now we need to walk the list in an attempt to add the @@ -257,7 +253,7 @@ bool SList::Remove(T *element) // Verify that we found the entry as it might not have been in the list. // Note: Cur will be valid because it wont be assigned unless Next is // valid. - if (cur->Next() != NULL && cur->Next()->Data() == element) { + if (cur->Next() != nullptr && cur->Next()->Data() == element) { SLNode *temp = cur->Next(); cur->Set_Next(temp->Next()); if (temp == TailNode) TailNode = cur; @@ -282,14 +278,14 @@ bool SList::Remove(T *element) template T *SList::Remove_Head(void) { - if (HeadNode == NULL) // Should make an assertion here instead! - return ((T* )NULL); + if (HeadNode == nullptr) // Should make an assertion here instead! + return ((T* )nullptr); SLNode *temp = HeadNode; HeadNode = HeadNode->Next(); - if (HeadNode == NULL) // Do we have empty list now? - TailNode = NULL; + if (HeadNode == nullptr) // Do we have empty list now? + TailNode = nullptr; T *data = temp->Data(); delete temp; @@ -320,11 +316,11 @@ T *SList::Remove_Head(void) template T *SList::Remove_Tail(void) { - if (HeadNode == NULL) // Should make an assertion here instead! - return ((T *)NULL); + if (HeadNode == nullptr) // Should make an assertion here instead! + return ((T *)nullptr); T* data = TailNode->Data(); - return (Remove(data) ? data : (T*)NULL); + return (Remove(data) ? data : (T*)nullptr); } @@ -401,7 +397,7 @@ inline SLNode *SList::Tail(void) const template inline bool SList::Is_Empty(void) const { - return( HeadNode == NULL ? true : false); + return( HeadNode == nullptr ? true : false); } @@ -446,10 +442,10 @@ bool SList::Add_Head(T *data) template bool SList::Add_Head(SList& list) { - if (list.HeadNode == NULL) return false; + if (list.HeadNode == nullptr) return false; // Save point for initial add of element. - SLNode *addpoint = NULL; + SLNode *addpoint = nullptr; // We traverse list backwards so nodes are added in right order. for (SLNode *cur = list.HeadNode; cur; cur = cur->Next()) @@ -480,11 +476,11 @@ bool SList::Add_Head(SList& list) template bool SList::Add_Tail(T *data) { - if (data == NULL) return false; + if (data == nullptr) return false; SLNode *temp = new SLNode (data); - if (HeadNode == NULL) { // empty list + if (HeadNode == nullptr) { // empty list HeadNode = TailNode = temp; } else { // non-empty list TailNode->Set_Next(temp); @@ -508,7 +504,7 @@ bool SList::Add_Tail(T *data) template bool SList::Add_Tail(SList& list) { - if (list.HeadNode == NULL) return false; + if (list.HeadNode == nullptr) return false; for (SLNode *cur = list.HeadNode; cur; cur = cur->Next()) Add_Tail(cur->Data()); diff --git a/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h b/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h index c49ce72101c..79255d0df1c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h @@ -37,10 +37,6 @@ #include "always.h" #include "mempool.h" -#ifndef NULL -#define NULL 0 -#endif - // Forward references for friend classes template class SList; @@ -64,7 +60,7 @@ class GenericSLNode : public AutoPoolClass // created from anything but a friend or parent class. // GenericSLNode(void *obj) - {NodeData = obj; NodeNext = 0; }; + {NodeData = obj; NodeNext = nullptr; }; // // You cannot declare a node class without giving it a data object. diff --git a/Core/Libraries/Source/WWVegas/WWLib/Signaler.h b/Core/Libraries/Source/WWVegas/WWLib/Signaler.h index 073d032498e..3ec7b961a87 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Signaler.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Signaler.h @@ -55,11 +55,11 @@ template class Signaler {} virtual void SignalDropped(Signaler& signaler) - {mConnection = NULL;} + {mConnection = nullptr;} protected: Signaler() : - mConnection(NULL) + mConnection(nullptr) {} virtual ~Signaler() @@ -69,7 +69,7 @@ template class Signaler {mConnection = &source;} void Disconnect(void) - {if (mConnection) {mConnection->SignalDropped(*this);} mConnection = NULL;} + {if (mConnection) {mConnection->SignalDropped(*this);} mConnection = nullptr;} // Prevent copy and assignment Signaler(const Signaler&); diff --git a/Core/Libraries/Source/WWVegas/WWLib/TARGA.cpp b/Core/Libraries/Source/WWVegas/WWLib/TARGA.cpp index de3d8773d1b..640cc5067cc 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/TARGA.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/TARGA.cpp @@ -102,8 +102,8 @@ Targa::Targa(void) { - mImage = NULL; - mPalette = NULL; + mImage = nullptr; + mPalette = nullptr; Clear_File(); mAccess = TGA_READMODE; mFlags = 0; @@ -138,11 +138,11 @@ Targa::~Targa(void) Close(); /* Free the palette buffer if we allocated it. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) free(mPalette); /* Free the image buffer if we allocated it. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) free(mImage); } @@ -317,7 +317,7 @@ void Targa::Close(void) if (TGAFile) { TGAFile->Close(); _TheFileFactory->Return_File(TGAFile); - TGAFile = NULL; + TGAFile = nullptr; } #else /* Close the file if it is open. */ @@ -341,7 +341,7 @@ void Targa::Close(void) * * FUNCTION * Open and load the Targa into the specified buffers. If either buffer -* pointer is NULL then that field will not be processed. +* pointer is nullptr then that field will not be processed. * * INPUTS * Name - Name of Targa image file to load. @@ -360,7 +360,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) long error = 0; /* Open the Targa */ - if (Open(name, TGA_READMODE) == NULL) { + if (Open(name, TGA_READMODE) == 0) { /* Process ColorMap (palette) */ if (Header.ColorMapType == 1) { @@ -371,7 +371,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) /* Load the palette from the TGA if a palette buffer is provided * otherwise we will skip it. */ - if ((palette != NULL) && (Header.CMapLength > 0)) { + if ((palette != nullptr) && (Header.CMapLength > 0)) { /* Adjust palette to the starting color entry. */ palette += (Header.CMapStart * depth); @@ -391,7 +391,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) /* Load the image data from the TGA if an image buffer is provided * otherwise we are done. */ - if (!error && (image != NULL)) { + if (!error && (image != nullptr)) { depth = TGA_BytesPerPixel(Header.PixelDepth); size = ((Header.Width * Header.Height) * depth); @@ -422,7 +422,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) break; case TGA_TRUECOLOR_ENCODED: - if ((error = DecodeImage()) == NULL) { + if ((error = DecodeImage()) == 0) { if (invert_image) InvertImage(); } break; @@ -499,21 +499,21 @@ long Targa::Load(const char* name, long flags, bool invert_image) if ((flags & TGAF_PAL) && (Header.ColorMapType == 1)) { /* Dispose of any previous palette. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) { + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) { free(mPalette); - mPalette = NULL; + mPalette = nullptr; mFlags &= ~TGAF_PAL; } /* Only allocate a palette if the client hasn't assigned one. */ - if ((mPalette == NULL) && !(mFlags & TGAF_PAL)) { + if ((mPalette == nullptr) && !(mFlags & TGAF_PAL)) { /* Compute the size of the palette from the targa header. */ size = (Header.CMapLength * (Header.CMapDepth >> 3)); if (size != 0) { /* Allocate memory for the palette. */ - if ((mPalette = (char *)malloc(size)) != NULL) { + if ((mPalette = (char *)malloc(size)) != nullptr) { mFlags |= TGAF_PAL; /* We allocated the palette. */ } else { error = TGAERR_NOMEM; @@ -526,20 +526,20 @@ long Targa::Load(const char* name, long flags, bool invert_image) if (!error && (flags & TGAF_IMAGE)) { /* Dispose of any previous image. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) { + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) { free(mImage); - mImage = NULL; + mImage = nullptr; mFlags &= ~TGAF_IMAGE; } /* Only allocate an image if the client hasn't assigned one. */ - if ((mImage == NULL) && !(mFlags & TGAF_IMAGE)) { + if ((mImage == nullptr) && !(mFlags & TGAF_IMAGE)) { /* Compute the size of the image data from the targa header. */ size = ((Header.Width * Header.Height) * TGA_BytesPerPixel(Header.PixelDepth)); if (size != 0) { /* Allocate memory for the image. */ - if ((mImage = (char *)malloc(size)) != NULL) { + if ((mImage = (char *)malloc(size)) != nullptr) { mFlags |= TGAF_IMAGE; /* We allocated the image. */ } else { error = TGAERR_NOMEM; @@ -598,7 +598,7 @@ long Targa::Save(const char* name, long flags, bool addextension) TGA2Footer footer; /* Open the Targa for write. */ - if (Open(name, TGA_WRITEMODE) == NULL) + if (Open(name, TGA_WRITEMODE) == 0) { Header.IDLength = 0; @@ -634,7 +634,7 @@ long Targa::Save(const char* name, long flags, bool addextension) /*----------------------------------------------------------------------- * WRITE THE COLORMAP (PALETTE) DATA SECTION *---------------------------------------------------------------------*/ - if (!error && (flags & TGAF_PAL) && (mPalette != NULL) + if (!error && (flags & TGAF_PAL) && (mPalette != nullptr) && (Header.CMapLength > 0)) { /* Adjust palette to the starting color entry. */ @@ -643,7 +643,7 @@ long Targa::Save(const char* name, long flags, bool addextension) size = (Header.CMapLength * depth); /* Allocate temporary buffer for palette manipulation. */ - if ((temppal = (char *)malloc(size)) != NULL) + if ((temppal = (char *)malloc(size)) != nullptr) { memcpy(temppal, palette, size); ptr = temppal; @@ -675,7 +675,7 @@ long Targa::Save(const char* name, long flags, bool addextension) /*----------------------------------------------------------------------- * WRITE THE IMAGE DATA SECTION *---------------------------------------------------------------------*/ - if (!error && (flags & TGAF_IMAGE) && (mImage != NULL)) + if (!error && (flags & TGAF_IMAGE) && (mImage != nullptr)) { bool imageinverted; @@ -935,18 +935,18 @@ void Targa::YFlip(void) char *Targa::SetImage(char *buffer) { - char *oldbuffer = NULL; + char *oldbuffer = nullptr; /* Free any image buffer before assigning another. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) { free(mImage); - mImage = NULL; + mImage = nullptr; mFlags &= ~TGAF_IMAGE; } /* Get the old user buffer. */ - if (mImage != NULL) + if (mImage != nullptr) oldbuffer = mImage; /* Assign the new image buffer. */ @@ -978,18 +978,18 @@ char *Targa::SetImage(char *buffer) char *Targa::SetPalette(char *buffer) { - char *oldbuffer = NULL; + char *oldbuffer = nullptr; /* Free any image buffer before assigning another. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) { free(mPalette); - mPalette = NULL; + mPalette = nullptr; mFlags &= ~TGAF_PAL; } /* Get the old user buffer. */ - if (mPalette != NULL) + if (mPalette != nullptr) oldbuffer = mPalette; /* Assign the new image buffer. */ @@ -1020,13 +1020,13 @@ bool Targa::IsCompressed(void) * * FUNCTION * Retrieve a pointer to the Targa 2.0 extension data area. If the file -* version is 1.0 OR there is no extensio area then a NULL will be returned. +* version is 1.0 OR there is no extensio area then a nullptr will be returned. * * INPUTS * NONE * * RESULT -* Ext - Pointer to Extension data, NULL if not available. +* Ext - Pointer to Extension data, nullptr if not available. * ****************************************************************************/ @@ -1035,7 +1035,7 @@ TGA2Extension *Targa::GetExtension(void) if (mFlags & TGAF_TGA2) return (&mExtension); - return (NULL); + return (nullptr); } @@ -1170,7 +1170,7 @@ long Targa::EncodeImage() depth = TGA_BytesPerPixel(Header.PixelDepth); /* Allocate packet buffer to hold maximum encoded data run. */ - if ((packet = (char *)malloc(128 * depth)) != NULL) + if ((packet = (char *)malloc(128 * depth)) != nullptr) { pixels = Header.Width * Header.Height; start = mImage; @@ -1339,7 +1339,7 @@ void Targa::InvertImage(void) void Targa::Clear_File(void) { #ifdef TGA_USES_WWLIB_FILE_CLASSES - TGAFile = NULL; + TGAFile = nullptr; #else mFH = -1; #endif @@ -1347,7 +1347,7 @@ void Targa::Clear_File(void) bool Targa::Is_File_Open(void) { #ifdef TGA_USES_WWLIB_FILE_CLASSES - return (TGAFile != NULL); + return (TGAFile != nullptr); #else return (mFH != -1); #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/TARGA.h b/Core/Libraries/Source/WWVegas/WWLib/TARGA.h index f0e082a3f28..603087b52cd 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/TARGA.h +++ b/Core/Libraries/Source/WWVegas/WWLib/TARGA.h @@ -197,13 +197,13 @@ typedef struct _TGA2Ratio * TGA2Footer. * * ExtSize - Extension area size. (495 bytes for 2.0) - * AuthName - Name of the person who created image (NULL terminated ASCII) - * AuthComment - Comments of the author (NULL terminated ASCII) + * AuthName - Name of the person who created image (null-terminated ASCII) + * AuthComment - Comments of the author (null-terminated ASCII) * DateStamp - Date the file was created. (See TGA2DateStamp) * TimeStamp - Time the file was created. (See TGA2TimeStamp) - * JobName - Name of job image belongs to (NULL terminated ASCII) + * JobName - Name of job image belongs to (null-terminated ASCII) * JobTime - Elapsed time of the job. - * SoftID - ID of software used to create image (NULL terminated ASCII) + * SoftID - ID of software used to create image (null-terminated ASCII) * SoftVer - Version number of software used. * KeyColor - Tranparent color value. * Aspect - Pixel aspect ratio. diff --git a/Core/Libraries/Source/WWVegas/WWLib/Vector.h b/Core/Libraries/Source/WWVegas/WWLib/Vector.h index 09c4b8b1c35..c610aea2201 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Vector.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Vector.h @@ -136,7 +136,7 @@ class VectorClass * * * This constructor for the vector class is passed the initial size of the vector and an * * optional pointer to a preallocated block of memory that the vector will be placed in. * - * If this optional pointer is NULL (or not provided), then the vector is allocated out * + * If this optional pointer is nullptr (or not provided), then the vector is allocated out * * of free store (with the "new" operator). * * * * INPUT: size -- The number of elements to initialize this vector to. * @@ -153,7 +153,7 @@ class VectorClass *=============================================================================================*/ template VectorClass::VectorClass(int size, T const * array) : - Vector(0), + Vector(nullptr), VectorMax(size), IsValid(true), IsAllocated(false) @@ -367,7 +367,7 @@ void VectorClass::Clear(void) { if (IsAllocated) { delete[] Vector; - Vector = 0; + Vector = nullptr; } IsAllocated = false; VectorMax = 0; @@ -426,7 +426,7 @@ bool VectorClass::Resize(int newsize, T const * array) ** If there is an old vector, then it must be copied (as much as is feasible) ** to the new vector. */ - if (Vector != NULL) { + if (Vector != nullptr) { /* ** Copy as much of the old vector into the new vector as possible. This @@ -446,7 +446,7 @@ bool VectorClass::Resize(int newsize, T const * array) */ if (IsAllocated) { delete[] Vector; - Vector = 0; + Vector = nullptr; } } @@ -489,14 +489,14 @@ class DynamicVectorClass : public VectorClass using VectorClass::Length; public: - DynamicVectorClass(unsigned size=0, T const * array=0); + DynamicVectorClass(unsigned size=0, T const * array=nullptr); // Stubbed equality operators so you can have dynamic vectors of dynamic vectors bool operator== (const DynamicVectorClass &src) { return false; } bool operator!= (const DynamicVectorClass &src) { return true; } // Change maximum size of vector. - virtual bool Resize(int newsize, T const * array=0); + virtual bool Resize(int newsize, T const * array=nullptr); // Resets and frees the vector array. virtual void Clear(void) {ActiveCount = 0;VectorClass::Clear();}; @@ -541,7 +541,7 @@ class DynamicVectorClass : public VectorClass // Uninitialized Add - does everything an Add does, except copying an // object into the 'new' spot in the array. It returns a pointer to - // the 'new' spot. (NULL if the Add failed). NOTE - you must then fill + // the 'new' spot. (null if the Add failed). NOTE - you must then fill // this memory area with a valid object (e.g. by using placement new), // or chaos will result! T * Uninitialized_Add(void); @@ -911,7 +911,7 @@ void DynamicVectorClass::Delete_All(void) * INPUT: none. * * * * OUTPUT: T *; Points to the empty space where the new object is to be created. (If the * - * space was not added successfully, returns NULL). * + * space was not added successfully, returns nullptr). * * * * WARNINGS: If memory area is left uninitialized, Very Bad Things will happen. * * * @@ -930,7 +930,7 @@ T * DynamicVectorClass::Uninitialized_Add(void) ** Failure to increase the size of the vector is an error condition. ** Return with the error value. */ - return(NULL); + return(nullptr); } } else { @@ -938,7 +938,7 @@ T * DynamicVectorClass::Uninitialized_Add(void) ** Increasing the size of this vector is not allowed! Bail this ** routine with the error value. */ - return(NULL); + return(nullptr); } } @@ -969,7 +969,7 @@ int First_False_Bit(void const * array); class BooleanVectorClass { public: - BooleanVectorClass(unsigned size=0, unsigned char * array=0); + BooleanVectorClass(unsigned size=0, unsigned char * array=nullptr); BooleanVectorClass(BooleanVectorClass const & vector); // Assignment operator. @@ -1083,7 +1083,7 @@ int Pointer_Vector_Add(T * ptr, VectorClass & vec) int id = 0; bool foundspot = false; for (int index = 0; index < vec.Length(); index++) { - if (vec[index] == NULL) { + if (vec[index] == nullptr) { id = index; foundspot = true; break; @@ -1093,7 +1093,7 @@ int Pointer_Vector_Add(T * ptr, VectorClass & vec) id = vec.Length(); vec.Resize((vec.Length()+1) * 2); for (int index = id; index < vec.Length(); index++) { - vec[index] = NULL; + vec[index] = nullptr; } } vec[id] = ptr; @@ -1106,7 +1106,7 @@ bool Pointer_Vector_Remove(T const * ptr, VectorClass & vec) { int id = vec.ID((T *)ptr); if (id != -1) { - vec[id] = NULL; + vec[id] = nullptr; return(true); } return(false); diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp b/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp index dc94b82bc9c..acfbe0138a6 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp @@ -67,10 +67,10 @@ STDMETHODIMP Dispatch_GetProperty(IDispatch* object, const OLECHAR* propName, if (SUCCEEDED(hr)) { // Get the property - DISPPARAMS params = {NULL, NULL, 0, 0}; + DISPPARAMS params = {nullptr, nullptr, 0, 0}; UINT argErr = 0; hr = object->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYGET, ¶ms, result, NULL, &argErr); + DISPATCH_PROPERTYGET, ¶ms, result, nullptr, &argErr); } return hr; @@ -107,7 +107,7 @@ STDMETHODIMP Dispatch_PutProperty(IDispatch* object, const OLECHAR* propName, if (SUCCEEDED(hr)) { // Get the property - DISPPARAMS params = {NULL, NULL, 0, 0}; + DISPPARAMS params = {nullptr, nullptr, 0, 0}; params.cArgs = 1; params.rgvarg = propValue; @@ -115,7 +115,7 @@ STDMETHODIMP Dispatch_PutProperty(IDispatch* object, const OLECHAR* propName, UINT argErr = 0; hr = object->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYPUT, ¶ms, &result, NULL, &argErr); + DISPATCH_PROPERTYPUT, ¶ms, &result, nullptr, &argErr); } return hr; @@ -153,7 +153,7 @@ STDMETHODIMP Dispatch_InvokeMethod(IDispatch* object, const OLECHAR* methodName, { UINT argErr = 0; hr = object->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_METHOD, params, result, NULL, &argErr); + DISPATCH_METHOD, params, result, nullptr, &argErr); } return hr; @@ -182,11 +182,11 @@ bool RegisterCOMServer(const char* dllName) HINSTANCE hInst = LoadLibrary(dllName); - if (hInst != NULL) + if (hInst != nullptr) { FARPROC regServerProc = GetProcAddress(hInst, "DllRegisterServer"); - if (regServerProc != NULL) + if (regServerProc != nullptr) { HRESULT hr = regServerProc(); success = SUCCEEDED(hr); @@ -221,11 +221,11 @@ bool UnregisterCOMServer(const char* dllName) HINSTANCE hInst = LoadLibrary(dllName); - if (hInst != NULL) + if (hInst != nullptr) { FARPROC unregServerProc = GetProcAddress(hInst, "DllUnregisterServer"); - if (unregServerProc != NULL) + if (unregServerProc != nullptr) { HRESULT hr = unregServerProc(); success = SUCCEEDED(hr); diff --git a/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h b/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h index 16b1bbfa0ac..490cf43078f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h @@ -49,10 +49,6 @@ #define SEEK_END 2 // Seek from end of file. #endif -#ifndef NULL - #define NULL 0 -#endif - class FileClass { @@ -82,7 +78,7 @@ class FileClass virtual void Close(void) = 0; virtual unsigned long Get_Date_Time(void) {return(0);} virtual bool Set_Date_Time(unsigned long ) {return(false);} -// virtual void Error(int error, int canretry = false, char const * filename=NULL) = 0; +// virtual void Error(int error, int canretry = false, char const * filename=nullptr) = 0; virtual void * Get_File_Handle(void) { return reinterpret_cast(-1); } // virtual void Bias(int start, int length=-1) = 0; diff --git a/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h b/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h index 2e68e3c044f..17f66ca9384 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h @@ -81,7 +81,7 @@ class FilePipe : public Pipe FileClass * File; bool HasOpened; - bool Valid_File(void) {return(File != NULL);} + bool Valid_File(void) {return(File != nullptr);} FilePipe(FilePipe & rvalue); FilePipe & operator = (FilePipe const & pipe); diff --git a/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h b/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h index f21e78f275b..d5aee44b866 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h +++ b/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h @@ -79,7 +79,7 @@ class FileStraw : public Straw FileClass * File; bool HasOpened; - bool Valid_File(void) {return(File != NULL);} + bool Valid_File(void) {return(File != nullptr);} FileStraw(FileStraw & rvalue); FileStraw & operator = (FileStraw const & pipe); }; diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index c58e6dd8e48..4644d5b93ae 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -158,7 +158,7 @@ class W3DMPO static void* getClassMemoryPool() { assert(0); // must replace this via W3DMPO_GLUE - return 0; + return nullptr; } protected: // we never call this; it is present to cause compile errors in descendent classes @@ -255,11 +255,6 @@ template T max(T a,T b) #endif -#ifndef NULL - #define NULL 0 -#endif - - #ifndef size_of #define size_of(typ,id) sizeof(((typ*)0)->id) #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp index 28958b3fbb8..e1d35885706 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp @@ -65,7 +65,7 @@ char *ArgvClass::Argv[MAX_ARGC]; *=============================================================================================*/ ArgvClass::ArgvClass(bool case_sensitive, bool exact_size): Flags(0), - LastArg(0), + LastArg(nullptr), CurrentPos(-1) { Case_Sensitive(case_sensitive); @@ -76,7 +76,7 @@ ArgvClass::ArgvClass(bool case_sensitive, bool exact_size): * *ArgvClass::Find_Again -- Search for a string given the flags. * * * * INPUT: * - * const char *arg - String to search for. If NULL, LastArg will be used. * + * const char *arg - String to search for. If nullptr, LastArg will be used. * * * * OUTPUT: * * const char *string found (null if not found) * @@ -135,7 +135,7 @@ const char *ArgvClass::Find_Again(const char *arg) } } } - return NULL; + return nullptr; } /*********************************************************************************************** @@ -299,7 +299,7 @@ void ArgvClass::Free() { for (int lp = 0; lp < Argc; lp++) { free(Argv[lp]); - Argv[lp] = 0; + Argv[lp] = nullptr; } Argc = -1; } @@ -325,7 +325,7 @@ const char *ArgvClass::Find_Value(const char *arg) return(Get_Cur_Value(strlen(arg))); } } - return(NULL); + return(nullptr); } /*********************************************************************************************** @@ -345,12 +345,12 @@ const char *ArgvClass::Get_Cur_Value(unsigned prefixlen, bool * val_in_next) { if (val_in_next) *val_in_next = false; if (CurrentPos < 0) { - return NULL; + return nullptr; } char *ptr = Argv[CurrentPos]; if (strlen(ptr) < prefixlen) { - return(NULL); + return(nullptr); } ptr += prefixlen; @@ -366,7 +366,7 @@ const char *ArgvClass::Get_Cur_Value(unsigned prefixlen, bool * val_in_next) // Goto next line to handle '-P data' case on command line. ptr = Argv[CurrentPos + 1]; if (!ptr) { - return NULL; + return nullptr; } while (*ptr) { @@ -376,7 +376,7 @@ const char *ArgvClass::Get_Cur_Value(unsigned prefixlen, bool * val_in_next) } ptr++; } - return (NULL); + return (nullptr); } @@ -398,7 +398,7 @@ const char *ArgvClass::Get_Cur_Value(unsigned prefixlen, bool * val_in_next) *=============================================================================================*/ void ArgvClass::Update_Value(const char *attrib, const char *value) { - if ((Find_Value(attrib))!=NULL) + if ((Find_Value(attrib))!=nullptr) { if (((CurrentPos+1) < Argc) && (Argv[CurrentPos+1][0] != '-')) // update old value { @@ -470,7 +470,7 @@ bool ArgvClass::Remove_Value(const char *attrib) { int removeCount=1; - if ((Find_Value(attrib))!=NULL) + if ((Find_Value(attrib))!=nullptr) { free(Argv[CurrentPos]); if (((CurrentPos+1) < Argc)&&(Argv[CurrentPos+1][0]!='-')) // value for this arg diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.h b/Core/Libraries/Source/WWVegas/WWLib/argv.h index a512b618619..898305094a3 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.h +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.h @@ -68,7 +68,7 @@ class ArgvClass CurrentPos = -1; return(Find_Again(arg)); } - // If NULL passed, original string will be used. + // If null passed, original string will be used. const char *Find_Again(const char *arg = 0L); // Return pointer to data after 'arg'. @@ -87,7 +87,7 @@ class ArgvClass void Update_Value(const char *attrib, const char *value); // Add a new attrib value pair (or just an option) - void Add_Value(const char *attrib, const char *value=NULL); + void Add_Value(const char *attrib, const char *value=nullptr); // Remove an option (and its value) bool Remove_Value(const char *attrib); diff --git a/Core/Libraries/Source/WWVegas/WWLib/b64pipe.cpp b/Core/Libraries/Source/WWVegas/WWLib/b64pipe.cpp index fe6c313ec5e..7381331796d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/b64pipe.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/b64pipe.cpp @@ -62,7 +62,7 @@ *=============================================================================================*/ int Base64Pipe::Put(void const * source, int slen) { - if (source == NULL || slen < 1) { + if (source == nullptr || slen < 1) { return(Pipe::Put(source, slen)); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/base64.cpp b/Core/Libraries/Source/WWVegas/WWLib/base64.cpp index 09fc0ce0212..3cc8ae9d686 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/base64.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/base64.cpp @@ -144,7 +144,7 @@ int Base64_Encode(void const * source, int slen, void * dest, int dlen) /* ** Check the parameters for legality. */ - if (source == NULL || slen == 0 || dest == NULL || dlen == 0) { + if (source == nullptr || slen == 0 || dest == nullptr || dlen == 0) { return(0); } @@ -245,7 +245,7 @@ int Base64_Decode(void const * source, int slen, void * dest, int dlen) /* ** Check the parameters for legality. */ - if (source == NULL || slen == 0 || dest == NULL || dlen == 0) { + if (source == nullptr || slen == 0 || dest == nullptr || dlen == 0) { return(0); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h b/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h index 8b144568ea1..523d45d4943 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h +++ b/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h @@ -53,7 +53,7 @@ class BufferIOFileClass : public RawFileClass BufferIOFileClass(void); virtual ~BufferIOFileClass(void); - bool Cache( long size=0, void * ptr=NULL); + bool Cache( long size=0, void * ptr=nullptr); void Free( void); bool Commit( void); virtual char const * Set_Name(char const * filename); diff --git a/Core/Libraries/Source/WWVegas/WWLib/binheap.h b/Core/Libraries/Source/WWVegas/WWLib/binheap.h index fa4aa9447ab..ea2dec99532 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/binheap.h +++ b/Core/Libraries/Source/WWVegas/WWLib/binheap.h @@ -65,7 +65,7 @@ class HeapNodeClass }; // WARNING! -// To reduce the number of compares, element [0] is a sentinel. It's key value must be the smallest or NULL. +// To reduce the number of compares, element [0] is a sentinel. It's key value must be the smallest or null. // Keeps track of pointers to objects. template class BinaryHeapClass @@ -88,7 +88,7 @@ class BinaryHeapClass BinaryHeapClass(unsigned int max_number_of_elements) : Max_Number_Of_Elements (max_number_of_elements), Number_Of_Elements (0), - Elements (NULL), + Elements (nullptr), Own_Array (false) { Resize_Array (max_number_of_elements); @@ -100,10 +100,10 @@ class BinaryHeapClass Release_Array (); } - // Reset all entries in the array to NULL + // Reset all entries in the array to null void Flush_Array (void) { - ::memset (Elements, NULL, sizeof (HeapNodeClass *) * Max_Number_Of_Elements); + ::memset (Elements, nullptr, sizeof (HeapNodeClass *) * Max_Number_Of_Elements); Number_Of_Elements = 0; } @@ -119,8 +119,8 @@ class BinaryHeapClass Number_Of_Elements = 0; Own_Array = true; - // Initialize to NULL - ::memset (Elements, NULL, sizeof (HeapNodeClass *) * new_size); + // Initialize to null + ::memset (Elements, nullptr, sizeof (HeapNodeClass *) * new_size); return ; } @@ -128,7 +128,7 @@ class BinaryHeapClass { if (Own_Array) { delete [] Elements; - Elements = NULL; + Elements = nullptr; Number_Of_Elements = 0; Max_Number_Of_Elements = 0; } @@ -206,7 +206,7 @@ class BinaryHeapClass HeapNodeClass* min_element; if (Number_Of_Elements == 0) { - return NULL; + return nullptr; } assert(Number_Of_Elements > 0); @@ -214,7 +214,7 @@ class BinaryHeapClass // The smallest element is always at this position. min_element = Elements[1]; - if (min_element != NULL) { + if (min_element != nullptr) { min_element->Set_Heap_Location (0); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/buff.cpp b/Core/Libraries/Source/WWVegas/WWLib/buff.cpp index ae14b73bc06..071b8768ba1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/buff.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/buff.cpp @@ -69,7 +69,7 @@ Buffer::Buffer(void * buffer, long size) : Size(size), IsAllocated(false) { - if (buffer == NULL && size > 0) { + if (buffer == nullptr && size > 0) { BufferPtr = W3DNEWARRAY char[size]; IsAllocated = true; } @@ -82,7 +82,7 @@ Buffer::Buffer(char * buffer, long size) : Size(size), IsAllocated(false) { - if (buffer == NULL && size > 0) { + if (buffer == nullptr && size > 0) { BufferPtr = W3DNEWARRAY char[size]; IsAllocated = true; } @@ -95,7 +95,7 @@ Buffer::Buffer(void const * buffer, long size) : Size(size), IsAllocated(false) { - if (buffer == NULL && size > 0) { + if (buffer == nullptr && size > 0) { BufferPtr = W3DNEWARRAY char[size]; IsAllocated = true; } @@ -114,13 +114,13 @@ Buffer::Buffer(void const * buffer, long size) : * OUTPUT: none * * * * WARNINGS: There is no way to tell if the allocation failed. To verify, call Get_Buffer * - * and compare with NULL. * + * and compare with nullptr. * * * * HISTORY: * * 07/29/1996 JLB : Created. * *=============================================================================================*/ Buffer::Buffer(long size) : - BufferPtr(NULL), + BufferPtr(nullptr), Size(size), IsAllocated(false) { @@ -225,7 +225,7 @@ void Buffer::Reset(void) if (IsAllocated) { delete [] BufferPtr; } - BufferPtr = NULL; + BufferPtr = nullptr; Size = 0; IsAllocated = false; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp b/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp index 6c16b1d31ca..090639514d3 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/bufffile.cpp @@ -45,7 +45,7 @@ int BufferedFileClass::_DesiredBufferSize = 1024*16; *=============================================================================================*/ BufferedFileClass::BufferedFileClass(void) : RawFileClass(), - Buffer( NULL ), + Buffer( nullptr ), BufferSize( 0 ), BufferAvailable( 0 ), BufferOffset( 0 ) @@ -57,7 +57,7 @@ BufferedFileClass::BufferedFileClass(void) : *=============================================================================================*/ BufferedFileClass::BufferedFileClass(char const * filename) : RawFileClass( filename ), - Buffer( NULL ), + Buffer( nullptr ), BufferSize( 0 ), BufferAvailable( 0 ), BufferOffset( 0 ) @@ -91,10 +91,10 @@ void BufferedFileClass::Close(void) * the file. This condition can result in fewer bytes being read than requested. Determine * * this by examining the return value. * * * - * INPUT: buffer -- Pointer to the buffer to read data into. If NULL is passed, no read * + * INPUT: buffer -- Pointer to the buffer to read data into. If nullptr is passed, no read * * is performed. * * * - * size -- The number of bytes to read. If NULL is passed, then no read is * + * size -- The number of bytes to read. If nullptr is passed, then no read is * * performed. * * * * OUTPUT: Returns with the number of bytes read into the buffer. If this number is less * @@ -242,7 +242,7 @@ int BufferedFileClass::Seek(int pos, int dir) void BufferedFileClass::Reset_Buffer( void ) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; BufferSize = 0; BufferAvailable = 0; BufferOffset = 0; diff --git a/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp b/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp index 6c8bbbdbc8e..0c0f6f6b0e4 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp @@ -732,7 +732,7 @@ uint32 ChunkLoadClass::Read(void * buf,uint32 nbytes) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector2Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -751,7 +751,7 @@ uint32 ChunkLoadClass::Read(IOVector2Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector3Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -770,7 +770,7 @@ uint32 ChunkLoadClass::Read(IOVector3Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector4Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -789,7 +789,7 @@ uint32 ChunkLoadClass::Read(IOVector4Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOQuaternionStruct * q) { - assert(q != NULL); + assert(q != nullptr); return Read(q,sizeof(q)); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp index 622753fa1a5..31d6c02d2ba 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp @@ -942,7 +942,7 @@ void CPUDetectClass::Init_OS() OSVersionExtraInfo = os.szCSDVersion; #else typedef LONG(WINAPI * RtlGetVersionPtr)(PRTL_OSVERSIONINFOW); - HMODULE ntdll = LoadLibraryExA("ntdll", NULL, 0); + HMODULE ntdll = LoadLibraryExA("ntdll", nullptr, 0); if (ntdll != nullptr) { RtlGetVersionPtr RtlGetVersion = (RtlGetVersionPtr)::GetProcAddress(ntdll, "RtlGetVersion"); @@ -1104,7 +1104,7 @@ void CPUDetectClass::Init_Compact_Log() GetTimeZoneInformation(&time_zone); COMPACTLOG(("%d\t", time_zone.Bias)); // get diff between local time and UTC #elif defined(_UNIX) - time_t t = time(NULL); + time_t t = time(nullptr); localtime(&t); COMPACTLOG(("%d\t", timezone)); #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/crc.cpp b/Core/Libraries/Source/WWVegas/WWLib/crc.cpp index 455af0d0833..8577f284d01 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/crc.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/crc.cpp @@ -90,7 +90,7 @@ void CRCEngine::operator() (char datum) *=============================================================================================*/ long CRCEngine::operator() (void const * buffer, int length) { - if (buffer != NULL && length > 0) { + if (buffer != nullptr && length > 0) { char const * dataptr = (char const *)buffer; int bytes_left = length; diff --git a/Core/Libraries/Source/WWVegas/WWLib/crcstraw.cpp b/Core/Libraries/Source/WWVegas/WWLib/crcstraw.cpp index ba173de5f59..aeddbe9bf4a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/crcstraw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/crcstraw.cpp @@ -62,7 +62,7 @@ *=============================================================================================*/ int CRCStraw::Get(void * source, int slen) { - if (source == NULL || slen < 1) { + if (source == nullptr || slen < 1) { return(0); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/cstraw.cpp b/Core/Libraries/Source/WWVegas/WWLib/cstraw.cpp index c65cd46c269..af3b0417415 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cstraw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cstraw.cpp @@ -64,7 +64,7 @@ int CacheStraw::Get(void * source, int slen) { int total = 0; - if (Is_Valid() && source != NULL && slen > 0) { + if (Is_Valid() && source != nullptr && slen > 0) { /* ** Keep processing the data request until there is no more data to supply or the request diff --git a/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp b/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp index 02ea652aea7..d019fc6ad20 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp @@ -43,7 +43,7 @@ /* ** Statics ** NOTE: If _TheFileFactory is ever changed to point to an object of a different class which does -** not derive from SimpleFileFactoryClass, _TheSimpleFileFactory should be set to NULL. +** not derive from SimpleFileFactoryClass, _TheSimpleFileFactory should be set to null. */ SimpleFileFactoryClass _DefaultFileFactory; FileFactoryClass * _TheFileFactory = &_DefaultFileFactory; @@ -56,11 +56,11 @@ RawFileFactoryClass * _TheWritingFileFactory = &_DefaultWritingFileFactory; ** */ file_auto_ptr::file_auto_ptr(FileFactoryClass *fac, const char *filename) : - _Ptr(NULL), _Fac(fac) + _Ptr(nullptr), _Fac(fac) { assert(_Fac); _Ptr=_Fac->Get_File(filename); - if ( _Ptr == NULL ) { + if ( _Ptr == nullptr ) { _Ptr = W3DNEW BufferedFileClass(); } } @@ -215,7 +215,7 @@ Is_Full_Path (const char *path) { bool retval = false; - if (path != NULL && path[0] != 0) { + if (path != nullptr && path[0] != 0) { // Check for drive designation retval = bool(path[1] == ':'); @@ -239,7 +239,7 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename ) if (IsStripPath) { const char * ptr = ::strrchr( filename, '\\' ); - if (ptr != 0) { + if (ptr != nullptr) { ptr++; stripped_name = ptr; } else { @@ -281,8 +281,8 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename ) { char *tokstart=subdir.Peek_Buffer(); const char *tok; - while((tok=strtok(tokstart, ";")) != NULL) { - tokstart=NULL; + while((tok=strtok(tokstart, ";")) != nullptr) { + tokstart=nullptr; new_name.Format("%s%s",tok,stripped_name.str()); file->Set_Name( new_name ); // Call Set_Name to force an allocated name if (file->Open()) { diff --git a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp index 441fe6bfe72..a5d8114ee32 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp @@ -57,35 +57,35 @@ HashTableClass::~HashTableClass( void ) { // If we need to, free the hash table delete [] HashTable; - HashTable = NULL; + HashTable = nullptr; } void HashTableClass::Reset( void ) { for ( int i = 0; i < HashTableSize; i++ ) { - HashTable[i] = NULL; + HashTable[i] = nullptr; } } void HashTableClass::Add( HashableClass * entry ) { - WWASSERT( entry != NULL); + WWASSERT( entry != nullptr); int index = Hash( entry->Get_Key() ); - WWASSERT( entry->NextHash == NULL ); + WWASSERT( entry->NextHash == nullptr ); entry->NextHash = HashTable[ index ]; HashTable[ index ] = entry; } bool HashTableClass::Remove( HashableClass * entry ) { - WWASSERT(entry != NULL); + WWASSERT(entry != nullptr); // Find in the hash table. const char *key = entry->Get_Key(); int index = Hash( key ); - if ( HashTable[ index ] != NULL ) { + if ( HashTable[ index ] != nullptr ) { // Special check for first entry if ( HashTable[ index ] == entry ) { @@ -95,7 +95,7 @@ bool HashTableClass::Remove( HashableClass * entry ) // Search the list for the entry, and remove it HashableClass * node = HashTable[ index ]; - while ( node->NextHash != NULL ) { + while ( node->NextHash != nullptr ) { if ( node->NextHash == entry ) { node->NextHash = entry->NextHash; return true; @@ -111,12 +111,12 @@ HashableClass * HashTableClass::Find( const char * key ) { // Find in the hash table. int index = Hash( key ); - for ( HashableClass * node = HashTable[ index ]; node != NULL; node = node->NextHash ) { + for ( HashableClass * node = HashTable[ index ]; node != nullptr; node = node->NextHash ) { if ( ::stricmp( node->Get_Key(), key ) == 0 ) { return node; } } - return NULL; + return nullptr; } int HashTableClass::Hash( const char * key ) @@ -139,7 +139,7 @@ void HashTableIteratorClass::First(void) void HashTableIteratorClass::Next(void) { CurrentEntry = NextEntry; - if ( NextEntry != NULL ) { + if ( NextEntry != nullptr ) { NextEntry = NextEntry->NextHash; Advance_Next(); } @@ -147,7 +147,7 @@ void HashTableIteratorClass::Next(void) void HashTableIteratorClass::Advance_Next(void) { - while ( NextEntry == NULL ) { + while ( NextEntry == nullptr ) { Index++; if ( Index >= Table.HashTableSize ) { return; // Done! diff --git a/Core/Libraries/Source/WWVegas/WWLib/hash.h b/Core/Libraries/Source/WWVegas/WWLib/hash.h index c91e48c5116..2ba8aa0af36 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.h @@ -48,7 +48,7 @@ class HashTableIteratorClass; class HashableClass { public: - HashableClass( void ) : NextHash( NULL ) {} + HashableClass( void ) : NextHash( nullptr ) {} virtual ~HashableClass( void ) {} virtual const char * Get_Key( void ) = 0; @@ -98,7 +98,7 @@ class HashTableIteratorClass void First( void ); void Next( void ); - bool Is_Done( void ) { return CurrentEntry == NULL; } + bool Is_Done( void ) { return CurrentEntry == nullptr; } HashableClass * Get_Current( void ) { return CurrentEntry; } private: diff --git a/Core/Libraries/Source/WWVegas/WWLib/hashtab.h b/Core/Libraries/Source/WWVegas/WWLib/hashtab.h index 7a66ce6bbc8..c888725121e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hashtab.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hashtab.h @@ -116,7 +116,7 @@ Object * HashTableClass::Find(Key * key) const } // couldn't find it - return NULL; + return nullptr; } #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h b/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h index 79de6a2cad0..7f0bd96e644 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h @@ -72,7 +72,7 @@ class HashTemplateClass enum { - NIL = -1 // internal enumeration for representing a NULL link + NIL = -1 // internal enumeration for representing a null link }; HashTemplateClass(void); diff --git a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp index 9a1f3c09feb..4d6df821bb0 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp @@ -124,15 +124,15 @@ const int INIClass::MAX_LINE_LENGTH = 4096; INIEntry::~INIEntry(void) { free(Entry); - Entry = NULL; + Entry = nullptr; free(Value); - Value = NULL; + Value = nullptr; } INISection::~INISection(void) { free(Section); - Section = 0; + Section = nullptr; EntryList.Delete(); } @@ -168,7 +168,7 @@ void INIClass::Shutdown(void) * HISTORY: * *=============================================================================================*/ INIClass::INIClass(void) -: Filename(0) +: Filename(nullptr) { Initialize(); } @@ -187,7 +187,7 @@ INIClass::INIClass(void) *=============================================================================================*/ INIClass::INIClass(FileClass & file) -: Filename(0) +: Filename(nullptr) { Initialize(); Load(file); @@ -209,7 +209,7 @@ INIClass::INIClass(FileClass & file) *=============================================================================================*/ INIClass::INIClass(const char *filename) -: Filename(0) +: Filename(nullptr) { Initialize(); FileClass *file=_TheFileFactory->Get_File(filename); @@ -250,7 +250,7 @@ INIClass::~INIClass(void) * then the entire INI data is cleared out. Optionally, this routine can be used to clear * * out just an individual entry in the specified section. * * * - * INPUT: section -- Pointer to the section to clear out [pass NULL to clear all]. * + * INPUT: section -- Pointer to the section to clear out [pass nullptr to clear all]. * * * * entry -- Pointer to optional entry specifier. If this parameter is specified, * * then only this specific entry (if found) will be cleared. Otherwise, * @@ -267,7 +267,7 @@ INIClass::~INIClass(void) *=============================================================================================*/ bool INIClass::Clear(char const * section, char const * entry) { - if (section == NULL) { + if (section == nullptr) { SectionList->Delete(); SectionIndex->Clear(); @@ -275,10 +275,10 @@ bool INIClass::Clear(char const * section, char const * entry) Filename = nstrdup(""); } else { INISection * secptr = Find_Section(section); - if (secptr != NULL) { - if (entry != NULL) { + if (secptr != nullptr) { + if (entry != nullptr) { INIEntry * entptr = secptr->Find_Entry(entry); - if (entptr != NULL) { + if (entptr != nullptr) { /* ** Remove the entry from the entry index list. */ @@ -411,7 +411,7 @@ int INIClass::Load(Straw & ffile) while (!end_of_file) { Read_Line(file, buffer, sizeof(buffer), end_of_file); if (end_of_file) return(false); - if (buffer[0] == '[' && strchr(buffer, ']') != NULL) break; + if (buffer[0] == '[' && strchr(buffer, ']') != nullptr) break; } if (merge) { @@ -427,7 +427,7 @@ int INIClass::Load(Straw & ffile) */ buffer[0] = ' '; char * ptr = strchr(buffer, ']'); - if (ptr != NULL) *ptr = '\0'; + if (ptr != nullptr) *ptr = '\0'; strtrim(buffer); char section[64]; strlcpy(section, buffer, ARRAY_SIZE(section)); @@ -443,7 +443,7 @@ int INIClass::Load(Straw & ffile) ** care of it. */ int len = Read_Line(file, buffer, sizeof(buffer), end_of_file); - if (buffer[0] == '[' && strchr(buffer, ']') != NULL) break; + if (buffer[0] == '[' && strchr(buffer, ']') != nullptr) break; /* ** Determine if this line is a comment or blank line. Throw it out if it is. @@ -491,10 +491,10 @@ int INIClass::Load(Straw & ffile) buffer[0] = ' '; char * ptr = strchr(buffer, ']'); - if (ptr != NULL) *ptr = '\0'; + if (ptr != nullptr) *ptr = '\0'; strtrim(buffer); INISection * secptr = W3DNEW INISection(strdup(buffer)); - if (secptr == NULL) { + if (secptr == nullptr) { Clear(); return(false); } @@ -510,7 +510,7 @@ int INIClass::Load(Straw & ffile) ** care of it. */ int len = Read_Line(file, buffer, sizeof(buffer), end_of_file); - if (buffer[0] == '[' && strchr(buffer, ']') != NULL) break; + if (buffer[0] == '[' && strchr(buffer, ']') != nullptr) break; /* ** Determine if this line is a comment or blank line. Throw it out if it is. @@ -546,7 +546,7 @@ int INIClass::Load(Straw & ffile) INIEntry * entryptr = W3DNEW INIEntry(strdup(buffer), strdup(divider)); - if (entryptr == NULL) { + if (entryptr == nullptr) { delete secptr; Clear(); return(false); @@ -626,7 +626,7 @@ int INIClass::Save(const char *filename) const retval=Save(*file); _TheWritingFileFactory->Return_File(file); } - file=NULL; + file=nullptr; delete[] Filename; Filename = nstrdup(filename); @@ -708,7 +708,7 @@ int INIClass::Save(Pipe & pipe) const * brackets. Case is NOT sensitive in the search. * * * * OUTPUT: Returns with a pointer to the INI section control structure if the section was * - * found. Otherwise, NULL is returned. * + * found. Otherwise, nullptr is returned. * * * * WARNINGS: none * * * @@ -719,7 +719,7 @@ int INIClass::Save(Pipe & pipe) const *=============================================================================================*/ INISection * INIClass::Find_Section(char const * section) const { - if (section != NULL) { + if (section != nullptr) { // long crc = CRCEngine()(section, strlen(section)); long crc = CRC(section); @@ -727,7 +727,7 @@ INISection * INIClass::Find_Section(char const * section) const return((*SectionIndex)[crc]); } } - return(NULL); + return(nullptr); } @@ -772,7 +772,7 @@ int INIClass::Section_Count(void) const int INIClass::Entry_Count(char const * section) const { INISection * secptr = Find_Section(section); - if (secptr != NULL) { + if (secptr != nullptr) { return(secptr->EntryIndex.Count()); } return(0); @@ -790,7 +790,7 @@ int INIClass::Entry_Count(char const * section) const * entry -- Pointer to the entry name to search for. * * * * OUTPUT: If the entry was found, then a pointer to the entry control structure will be * - * returned. Otherwise, NULL will be returned. * + * returned. Otherwise, nullptr will be returned. * * * * WARNINGS: none * * * @@ -800,10 +800,10 @@ int INIClass::Entry_Count(char const * section) const INIEntry * INIClass::Find_Entry(char const * section, char const * entry) const { INISection * secptr = Find_Section(section); - if (secptr != NULL) { + if (secptr != nullptr) { return(secptr->Find_Entry(entry)); } - return(NULL); + return(nullptr); } @@ -829,16 +829,16 @@ char const * INIClass::Get_Entry(char const * section, int index) const { INISection * secptr = Find_Section(section); - if (secptr != NULL && index < secptr->EntryIndex.Count()) { + if (secptr != nullptr && index < secptr->EntryIndex.Count()) { INIEntry * entryptr = secptr->EntryList.First(); - while (entryptr != NULL && entryptr->Is_Valid()) { + while (entryptr != nullptr && entryptr->Is_Valid()) { if (index == 0) return(entryptr->Entry); index--; entryptr = entryptr->Next(); } } - return(NULL); + return(nullptr); } @@ -900,7 +900,7 @@ unsigned INIClass::Enumerate_Entries(const char *Section, const char * Entry_Pre *=============================================================================================*/ bool INIClass::Put_UUBlock(char const * section, void const * block, int len) { - if (section == NULL || block == NULL || len < 1) return(false); + if (section == nullptr || block == nullptr || len < 1) return(false); Clear(section); @@ -952,7 +952,7 @@ bool INIClass::Put_UUBlock(char const * section, void const * block, int len) *=============================================================================================*/ int INIClass::Get_UUBlock(char const * section, void * block, int len) const { - if (section == NULL) return(0); + if (section == nullptr) return(0); Base64Pipe b64pipe(Base64Pipe::DECODE); BufferPipe bpipe(block, len); @@ -1034,7 +1034,7 @@ const WideStringClass& INIClass::Get_Wide_String(WideStringClass& new_string, ch *=============================================================================================*/ bool INIClass::Put_Wide_String(char const * section, char const * entry, wchar_t const * string) { - if (section == NULL || entry == NULL || string == NULL) { + if (section == nullptr || entry == nullptr || string == nullptr) { return(false); } @@ -1070,7 +1070,7 @@ bool INIClass::Put_Wide_String(char const * section, char const * entry, wchar_t bool INIClass::Put_UUBlock(char const * section, char const *entry, void const * block, int len) { - if (section == NULL || block == NULL || len < 1) return(false); + if (section == nullptr || block == nullptr || len < 1) return(false); BufferStraw straw(block, len); Base64Straw bstraw(Base64Straw::ENCODE); @@ -1092,8 +1092,8 @@ bool INIClass::Put_UUBlock(char const * section, char const *entry, void const * int INIClass::Get_UUBlock(char const * section, char const *entry, void * block, int len) const { - if (section == NULL) return(0); - if (entry == NULL) return(0); + if (section == nullptr) return(0); + if (entry == nullptr) return(0); Base64Pipe b64pipe(Base64Pipe::DECODE); BufferPipe bpipe(block, len); @@ -1140,12 +1140,12 @@ int INIClass::Get_UUBlock(char const * section, char const *entry, void * block, *=============================================================================================*/ bool INIClass::Put_TextBlock(char const * section, char const * text) { - if (section == NULL) return(false); + if (section == nullptr) return(false); Clear(section); int index = 1; - while (text != NULL && *text != 0) { + while (text != nullptr && *text != 0) { char buffer[128]; @@ -1316,10 +1316,10 @@ int INIClass::Get_Int(char const * section, char const * entry, int defvalue) co /* ** Verify that the parameters are nominally correct. */ - if (section == NULL || entry == NULL) return(defvalue); + if (section == nullptr || entry == nullptr) return(defvalue); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { if (*entryptr->Value == '$') { sscanf(entryptr->Value, "$%x", &defvalue); @@ -1453,10 +1453,10 @@ int INIClass::Get_Hex(char const * section, char const * entry, int defvalue) co /* ** Verify that the parameters are nominally correct. */ - if (section == NULL || entry == NULL) return(defvalue); + if (section == nullptr || entry == nullptr) return(defvalue); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { sscanf(entryptr->Value, "%x", &defvalue); } return(defvalue); @@ -1487,14 +1487,14 @@ float INIClass::Get_Float(char const * section, char const * entry, float defval /* ** Verify that the parameters are nominally correct. */ - if (section == NULL || entry == NULL) return(defvalue); + if (section == nullptr || entry == nullptr) return(defvalue); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr != NULL && entryptr->Value != NULL) { + if (entryptr != nullptr && entryptr->Value != nullptr) { float val = defvalue; sscanf(entryptr->Value, "%f", &val); defvalue = val; - if (strchr(entryptr->Value, '%') != NULL) { + if (strchr(entryptr->Value, '%') != nullptr) { defvalue /= 100.0f; } } @@ -1554,14 +1554,14 @@ double INIClass::Get_Double(char const * section, char const * entry, double def /* ** Verify that the parameters are nominally correct. */ - if (section == NULL || entry == NULL) return(defvalue); + if (section == nullptr || entry == nullptr) return(defvalue); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr != NULL && entryptr->Value != NULL) { + if (entryptr != nullptr && entryptr->Value != nullptr) { double val = defvalue; sscanf(entryptr->Value, "%lf", &val); defvalue = val; - if (strchr(entryptr->Value, '%') != NULL) { + if (strchr(entryptr->Value, '%') != nullptr) { defvalue /= 100.0f; } } @@ -1621,13 +1621,13 @@ bool INIClass::Put_Double(char const * section, char const * entry, double numbe *=============================================================================================*/ bool INIClass::Put_String(char const * section, char const * entry, char const * string) { - if (section == NULL || entry == NULL) return(false); + if (section == nullptr || entry == nullptr) return(false); INISection * secptr = Find_Section(section); - if (secptr == NULL) { + if (secptr == nullptr) { secptr = W3DNEW INISection(strdup(section)); - if (secptr == NULL) return(false); + if (secptr == nullptr) return(false); SectionList->Add_Tail(secptr); SectionIndex->Add_Index(secptr->Index_ID(), secptr); } @@ -1636,7 +1636,7 @@ bool INIClass::Put_String(char const * section, char const * entry, char const * ** Remove the old entry if found and print debug message */ INIEntry * entryptr = secptr->Find_Entry(entry); - if (entryptr != NULL) { + if (entryptr != nullptr) { if (strcmp(entryptr->Entry, entry) != 0) { DuplicateCRCError("INIClass::Put_String", section, entry); } else { @@ -1653,14 +1653,14 @@ bool INIClass::Put_String(char const * section, char const * entry, char const * /* ** Create and add the new entry. */ - if (string != NULL && strlen(string) > 0) { + if (string != nullptr && strlen(string) > 0) { entryptr = W3DNEW INIEntry(strdup(entry), strdup(string)); // If this assert fires, then the string will be truncated on load, because // there will not be enough room in the loading buffer! WWASSERT(strlen(string) < MAX_LINE_LENGTH); - if (entryptr == NULL) { + if (entryptr == nullptr) { return(false); } secptr->EntryList.Add_Tail(entryptr); @@ -1701,24 +1701,24 @@ int INIClass::Get_String(char const * section, char const * entry, char const * /* ** Verify that the parameters are nominally legal. */ -// if (buffer != NULL && size > 0) { +// if (buffer != nullptr && size > 0) { // buffer[0] = '\0'; // } - if (buffer == NULL || size < 2 || section == NULL || entry == NULL) return(0); + if (buffer == nullptr || size < 2 || section == nullptr || entry == nullptr) return(0); /* ** Fetch the entry string if it is present. If not, then the normal default ** value will be used as the entry value. */ INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr != NULL && entryptr->Value != NULL) { + if (entryptr != nullptr && entryptr->Value != nullptr) { defvalue = entryptr->Value; } /* ** Fill in the buffer with the entry value and return with the length of the string. */ - if (defvalue == NULL) { + if (defvalue == nullptr) { buffer[0] = '\0'; return(0); } else { @@ -1734,7 +1734,7 @@ int INIClass::Get_String(char const * section, char const * entry, char const * */ const StringClass& INIClass::Get_String(StringClass& new_string, char const * section, char const * entry, char const * defvalue) const { - if (section == NULL || entry == NULL) { + if (section == nullptr || entry == nullptr) { new_string=""; return new_string; } @@ -1744,11 +1744,11 @@ const StringClass& INIClass::Get_String(StringClass& new_string, char const * se ** value will be used as the entry value. */ INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr != NULL) { + if (entryptr != nullptr) { defvalue = entryptr->Value; } - if (defvalue == NULL) { + if (defvalue == nullptr) { new_string=""; return new_string; } @@ -1786,27 +1786,27 @@ const StringClass& INIClass::Get_String(StringClass& new_string, char const * se *=============================================================================================*/ char *INIClass::Get_Alloc_String(char const * section, char const * entry, char const * defvalue) const { - if (section == NULL || entry == NULL) return(NULL); + if (section == nullptr || entry == nullptr) return(nullptr); /* ** Fetch the entry string if it is present. If not, then the normal default ** value will be used as the entry value. */ INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr != NULL) { + if (entryptr != nullptr) { defvalue = entryptr->Value; } - if (defvalue == NULL) return NULL; + if (defvalue == nullptr) return nullptr; return(strdup(defvalue)); } int INIClass::Get_List_Index(char const * section, char const * entry, int const defvalue, char *list[]) { - if (section == NULL || entry == NULL) return(0); + if (section == nullptr || entry == nullptr) return(0); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr == NULL || entryptr->Value == NULL) { + if (entryptr == nullptr || entryptr->Value == nullptr) { return defvalue; } @@ -1822,7 +1822,7 @@ int INIClass::Get_Int_Bitfield(char const * section, char const * entry, int def { // if we can't find the entry or the entry is null just return the default value INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr == NULL || entryptr->Value == NULL) { + if (entryptr == nullptr || entryptr->Value == nullptr) { return defvalue; } @@ -1833,7 +1833,7 @@ int INIClass::Get_Int_Bitfield(char const * section, char const * entry, int def char *str = strdup(entryptr->Value); int lp; - for (char *token = strtok(str, "|+"); token; token = strtok(NULL, "|+")) { + for (char *token = strtok(str, "|+"); token; token = strtok(nullptr, "|+")) { for (lp = 0; list[lp]; lp++) { // if this list entry matches our string token then we need // to set this bit. @@ -1844,7 +1844,7 @@ int INIClass::Get_Int_Bitfield(char const * section, char const * entry, int def } // if we reached the end of the list and found nothing then we need // to assert since we have an unidentified value - if (list[lp] == NULL) assert(lp < 1000); + if (list[lp] == nullptr) assert(lp < 1000); } free(str); return retval; @@ -1852,10 +1852,10 @@ int INIClass::Get_Int_Bitfield(char const * section, char const * entry, int def int * INIClass::Get_Alloc_Int_Array(char const * section, char const * entry, int listend) { - int *retval = NULL; + int *retval = nullptr; INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr == NULL || entryptr->Value == NULL) { + if (entryptr == nullptr || entryptr->Value == nullptr) { retval = W3DNEWARRAY int[1]; retval[0] = listend; @@ -1867,7 +1867,7 @@ int * INIClass::Get_Alloc_Int_Array(char const * section, char const * entry, in int count = 0; char *str = strdup(entryptr->Value); char *token; - for (token = strtok(str, " "); token; token = strtok(NULL, " ")) { + for (token = strtok(str, " "); token; token = strtok(nullptr, " ")) { count++; } free(str); @@ -1877,7 +1877,7 @@ int * INIClass::Get_Alloc_Int_Array(char const * section, char const * entry, in retval = W3DNEWARRAY int[count+1]; count = 0; str = strdup(entryptr->Value); - for (token = strtok(str, " "); token; token = strtok(NULL, " ")) { + for (token = strtok(str, " "); token; token = strtok(nullptr, " ")) { retval[count] = atoi(token); count++; } @@ -1948,10 +1948,10 @@ bool INIClass::Get_Bool(char const * section, char const * entry, bool defvalue) /* ** Verify that the parameters are nominally correct. */ - if (section == NULL || entry == NULL) return(defvalue); + if (section == nullptr || entry == nullptr) return(defvalue); INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { switch (toupper(*entryptr->Value)) { case 'Y': case 'T': @@ -2188,7 +2188,7 @@ TPoint2D const INIClass::Get_Point(char const * section, char const * ent * INPUT: entry -- The entry to scan for. * * * * OUTPUT: Returns with a pointer to the entry control structure if the entry was found. * - * Otherwise it returns NULL. * + * Otherwise it returns nullptr. * * * * WARNINGS: none * * * @@ -2199,14 +2199,14 @@ TPoint2D const INIClass::Get_Point(char const * section, char const * ent *=============================================================================================*/ INIEntry * INISection::Find_Entry(char const * entry) const { - if (entry != NULL) { + if (entry != nullptr) { // int crc = CRCEngine()(entry, strlen(entry)); int crc = CRC::String(entry); if (EntryIndex.Is_Present(crc)) { return(EntryIndex[crc]); } } - return(NULL); + return(nullptr); } @@ -2227,7 +2227,7 @@ INIEntry * INISection::Find_Entry(char const * entry) const *=============================================================================================*/ void INIClass::Strip_Comments(char * buffer) { - if (buffer != NULL) { + if (buffer != nullptr) { char * comment = strchr(buffer, ';'); if (comment) { *comment = '\0'; @@ -2286,7 +2286,7 @@ void INIClass::DuplicateCRCError(const char *message, const char *section, const #ifdef RTS_RELEASE #ifdef _WIN32 - MessageBox(0, buffer, "Duplicate CRC in INI file.", MB_ICONSTOP | MB_OK); + MessageBox(nullptr, buffer, "Duplicate CRC in INI file.", MB_ICONSTOP | MB_OK); #endif #endif } diff --git a/Core/Libraries/Source/WWVegas/WWLib/inisup.h b/Core/Libraries/Source/WWVegas/WWLib/inisup.h index 1ed5b8477dc..e173b867f39 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/inisup.h +++ b/Core/Libraries/Source/WWVegas/WWLib/inisup.h @@ -52,9 +52,9 @@ ** The entry identifier and value string are combined into this object. */ struct INIEntry : public Node { - INIEntry(char * entry = NULL, char * value = NULL) : Entry(entry), Value(value) {} + INIEntry(char * entry = nullptr, char * value = nullptr) : Entry(entry), Value(value) {} ~INIEntry(void); -// ~INIEntry(void) {free(Entry);Entry = NULL;free(Value);Value = NULL;} +// ~INIEntry(void) {free(Entry);Entry = nullptr;free(Value);Value = nullptr;} // int Index_ID(void) const {return(CRCEngine()(Entry, strlen(Entry)));}; int Index_ID(void) const { return CRC::String(Entry);}; diff --git a/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp b/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp index cca880a9f37..ba763b35e41 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp @@ -111,5 +111,5 @@ int LZOCompressor::Decompress { CriticalSectionClass::LockClass m(mutex); - return lzo1x_decompress(in,in_len,out,out_len,NULL); + return lzo1x_decompress(in,in_len,out,out_len,nullptr); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/lzo1x.h b/Core/Libraries/Source/WWVegas/WWLib/lzo1x.h index cae5f0e368d..e880d47b73c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzo1x.h +++ b/Core/Libraries/Source/WWVegas/WWLib/lzo1x.h @@ -73,7 +73,7 @@ ************************************************************************/ /* Memory required for the wrkmem parameter. - * When the required size is 0, you can also pass a NULL pointer. + * When the required size is 0, you can also pass a nullptr pointer. */ #define LZO1X_MEM_COMPRESS ((lzo_uint) (16384L * sizeof(lzo_byte *))) diff --git a/Core/Libraries/Source/WWVegas/WWLib/lzo_conf.h b/Core/Libraries/Source/WWVegas/WWLib/lzo_conf.h index d1e3e2b84fa..597c4e2b50c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzo_conf.h +++ b/Core/Libraries/Source/WWVegas/WWLib/lzo_conf.h @@ -280,7 +280,7 @@ #else /* This is the safe (but slower) version */ #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_pos == NULL || (m_off = ip - m_pos) > max_offset) + (m_pos == nullptr || (m_off = ip - m_pos) > max_offset) #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp b/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp index 543aa56e257..eb6e8b50961 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp @@ -67,8 +67,8 @@ LZOPipe::LZOPipe(CompControl control, int blocksize) : Control(control), Counter(0), - Buffer(NULL), - Buffer2(NULL), + Buffer(nullptr), + Buffer2(nullptr), BlockSize(blocksize) { SafetyMargin = BlockSize; @@ -95,10 +95,10 @@ LZOPipe::LZOPipe(CompControl control, int blocksize) : LZOPipe::~LZOPipe(void) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; delete [] Buffer2; - Buffer2 = NULL; + Buffer2 = nullptr; } @@ -123,11 +123,11 @@ LZOPipe::~LZOPipe(void) *=============================================================================================*/ int LZOPipe::Put(void const * source, int slen) { - if (source == NULL || slen < 1) { + if (source == nullptr || slen < 1) { return(Pipe::Put(source, slen)); } - assert(Buffer != NULL); + assert(Buffer != nullptr); int total = 0; @@ -177,7 +177,7 @@ int LZOPipe::Put(void const * source, int slen) */ if (Counter == BlockHeader.CompCount) { unsigned int length = sizeof (Buffer2); - lzo1x_decompress ((unsigned char*)Buffer, BlockHeader.CompCount, (unsigned char*)Buffer2, &length, NULL); + lzo1x_decompress ((unsigned char*)Buffer, BlockHeader.CompCount, (unsigned char*)Buffer2, &length, nullptr); total += Pipe::Put(Buffer2, BlockHeader.UncompCount); Counter = 0; BlockHeader.CompCount = 0xFFFF; @@ -264,7 +264,7 @@ int LZOPipe::Put(void const * source, int slen) *=============================================================================================*/ int LZOPipe::Flush(void) { - assert(Buffer != NULL); + assert(Buffer != nullptr); int total = 0; diff --git a/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp b/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp index f6184547498..3b892300ef1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp @@ -66,8 +66,8 @@ LZOStraw::LZOStraw(CompControl control, int blocksize) : Control(control), Counter(0), - Buffer(NULL), - Buffer2(NULL), + Buffer(nullptr), + Buffer2(nullptr), BlockSize(blocksize) { SafetyMargin = BlockSize; @@ -95,10 +95,10 @@ LZOStraw::LZOStraw(CompControl control, int blocksize) : LZOStraw::~LZOStraw(void) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; delete [] Buffer2; - Buffer2 = NULL; + Buffer2 = nullptr; } @@ -125,14 +125,14 @@ LZOStraw::~LZOStraw(void) *=============================================================================================*/ int LZOStraw::Get(void * destbuf, int slen) { - assert(Buffer != NULL); + assert(Buffer != nullptr); int total = 0; /* ** Verify parameters for legality. */ - if (destbuf == NULL || slen < 1) { + if (destbuf == nullptr || slen < 1) { return(0); } @@ -164,7 +164,7 @@ int LZOStraw::Get(void * destbuf, int slen) incount = Straw::Get(staging_buffer, BlockHeader.CompCount); if (incount != BlockHeader.CompCount) break; unsigned int length = sizeof(Buffer); - lzo1x_decompress ((unsigned char*)staging_buffer, BlockHeader.CompCount, (unsigned char*)Buffer, &length, NULL); + lzo1x_decompress ((unsigned char*)staging_buffer, BlockHeader.CompCount, (unsigned char*)Buffer, &length, nullptr); delete [] staging_buffer; Counter = BlockHeader.UncompCount; } else { diff --git a/Core/Libraries/Source/WWVegas/WWLib/mempool.h b/Core/Libraries/Source/WWVegas/WWLib/mempool.h index 3eae0cf003a..fcf370bb6a6 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mempool.h +++ b/Core/Libraries/Source/WWVegas/WWLib/mempool.h @@ -176,8 +176,8 @@ ObjectPoolClass AutoPoolClass::Allocator = {} *=============================================================================================*/ template ObjectPoolClass::ObjectPoolClass(void) : - FreeListHead(NULL), - BlockListHead(NULL), + FreeListHead(nullptr), + BlockListHead(nullptr), FreeObjectCount(0), TotalObjectCount(0) { @@ -204,7 +204,7 @@ ObjectPoolClass::~ObjectPoolClass(void) // delete all of the blocks we allocated int block_count = 0; - while (BlockListHead != NULL) { + while (BlockListHead != nullptr) { uint32 * next_block = *(uint32 **)BlockListHead; ::operator delete(BlockListHead); BlockListHead = next_block; @@ -278,7 +278,7 @@ T * ObjectPoolClass::Allocate_Object_Memory(void) { FastCriticalSectionClass::LockClass lock(ObjectPoolCS); - if ( FreeListHead == 0 ) { + if ( FreeListHead == nullptr ) { // No free objects, allocate another block uint32 * tmp_block_head = BlockListHead; @@ -291,7 +291,7 @@ T * ObjectPoolClass::Allocate_Object_Memory(void) for ( int i = 0; i < BLOCK_SIZE; i++ ) { *(T**)(&(FreeListHead[i])) = &(FreeListHead[i+1]); // link up the elements } - *(T**)(&(FreeListHead[BLOCK_SIZE-1])) = 0; // Mark the end + *(T**)(&(FreeListHead[BLOCK_SIZE-1])) = nullptr; // Mark the end FreeObjectCount += BLOCK_SIZE; TotalObjectCount += BLOCK_SIZE; @@ -322,7 +322,7 @@ void ObjectPoolClass::Free_Object_Memory(T * obj) { FastCriticalSectionClass::LockClass lock(ObjectPoolCS); - WWASSERT(obj != NULL); + WWASSERT(obj != nullptr); *(T**)(obj) = FreeListHead; // Link to the Head FreeListHead = obj; // Set the Head FreeObjectCount++; @@ -364,6 +364,6 @@ void * AutoPoolClass::operator new( size_t size ) template void AutoPoolClass::operator delete( void * memory ) { - if ( memory == 0 ) return; + if ( memory == nullptr ) return; Allocator.Free_Object_Memory((T*)memory); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp b/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp index 8689e5bbca6..49461c67b89 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp @@ -168,7 +168,7 @@ bool GenericMultiListClass::Internal_Add_After(MultiListObjectClass * obj,const existing_node = existing_node->NextList; } - if (existing_node == NULL) { + if (existing_node == nullptr) { return false; // he's not in this list! } @@ -194,14 +194,14 @@ bool GenericMultiListClass::Internal_Remove(MultiListObjectClass *obj) { // find the list node in this object that belongs to this list MultiListNodeClass * lnode = obj->Get_List_Node(); - MultiListNodeClass * prevlnode = 0; + MultiListNodeClass * prevlnode = nullptr; while ((lnode) && (lnode->List != this)) { prevlnode = lnode; lnode = lnode->NextList; } - if (lnode == 0) { + if (lnode == nullptr) { return false; } @@ -227,7 +227,7 @@ bool GenericMultiListClass::Internal_Remove(MultiListObjectClass *obj) MultiListObjectClass * GenericMultiListClass::Internal_Remove_List_Head(void) { if (Head.Next == &Head) { - return 0; // no more objects + return nullptr; // no more objects } MultiListNodeClass * node = Head.Next; diff --git a/Core/Libraries/Source/WWVegas/WWLib/multilist.h b/Core/Libraries/Source/WWVegas/WWLib/multilist.h index f99c5613e5b..542c8ad6252 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/multilist.h +++ b/Core/Libraries/Source/WWVegas/WWLib/multilist.h @@ -72,7 +72,7 @@ class MultiListObjectClass { public: - MultiListObjectClass(void) : ListNode(NULL) { } + MultiListObjectClass(void) : ListNode(nullptr) { } virtual ~MultiListObjectClass(void); MultiListNodeClass * Get_List_Node() const { return ListNode; } @@ -262,7 +262,7 @@ class MultiListClass : public GenericMultiListClass void Reset_List() { - while (Get_Head() != NULL) { + while (Get_Head() != nullptr) { Remove_Head(); } } @@ -310,7 +310,7 @@ class MultiListIterator : public GenericMultiListIterator void Remove_Current_Object(void) { ObjectType * obj = Peek_Obj(); - if (obj != NULL) { + if (obj != nullptr) { Next(); ((MultiListClass *)List)->Remove(obj); } @@ -425,7 +425,7 @@ class RefMultiListClass : public GenericMultiListClass void Reset_List() { - while (Peek_Head() != NULL) { + while (Peek_Head() != nullptr) { Release_Head(); } } @@ -451,7 +451,7 @@ class RefMultiListIterator : public GenericMultiListIterator ObjectType * Get_Obj(void) { ObjectType * obj = (ObjectType*)Current_Object(); - if (obj != NULL) { + if (obj != nullptr) { obj->Add_Ref(); } return obj; @@ -465,7 +465,7 @@ class RefMultiListIterator : public GenericMultiListIterator void Remove_Current_Object(void) { ObjectType * obj = Peek_Obj(); - if (obj != NULL) { + if (obj != nullptr) { Next(); ((RefMultiListClass *)List)->Remove(obj); } @@ -494,7 +494,7 @@ class PriorityMultiListIterator : public MultiListIterator public: PriorityMultiListIterator(MultiListClass *list) - : OriginalHead (NULL), + : OriginalHead (nullptr), MultiListIterator(list) { First (); } bool @@ -504,8 +504,8 @@ class PriorityMultiListIterator : public MultiListIterator // Check to ensure we don't wrap around the list (stop after iterating // the list once). - if (CurNode != NULL && CurNode->Object != NULL && OriginalHead != CurNode) { - OriginalHead = (OriginalHead == NULL) ? CurNode : OriginalHead; + if (CurNode != nullptr && CurNode->Object != nullptr && OriginalHead != CurNode) { + OriginalHead = (OriginalHead == nullptr) ? CurNode : OriginalHead; (*object) = (ObjectType *)CurNode->Object; diff --git a/Core/Libraries/Source/WWVegas/WWLib/mutex.cpp b/Core/Libraries/Source/WWVegas/WWLib/mutex.cpp index 946090a282e..765b1857083 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mutex.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/mutex.cpp @@ -24,12 +24,12 @@ // ---------------------------------------------------------------------------- -MutexClass::MutexClass(const char* name) : handle(NULL), locked(false) +MutexClass::MutexClass(const char* name) : handle(nullptr), locked(false) { #ifdef _UNIX //assert(0); #else - handle=CreateMutex(NULL,false,name); + handle=CreateMutex(nullptr,false,name); WWASSERT(handle); #endif } @@ -90,7 +90,7 @@ MutexClass::LockClass::~LockClass() // ---------------------------------------------------------------------------- -CriticalSectionClass::CriticalSectionClass() : handle(NULL), locked(false) +CriticalSectionClass::CriticalSectionClass() : handle(nullptr), locked(false) { #ifdef _UNIX //assert(0); diff --git a/Core/Libraries/Source/WWVegas/WWLib/mutex.h b/Core/Libraries/Source/WWVegas/WWLib/mutex.h index cce5055f478..2c0c8cfbbe9 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mutex.h +++ b/Core/Libraries/Source/WWVegas/WWLib/mutex.h @@ -45,8 +45,8 @@ class MutexClass void Unlock(); public: - // Name can (and usually should) be NULL. Use name only if you wish to create a globally unique mutex - MutexClass(const char* name = NULL); + // Name can (and usually should) be nullptr. Use name only if you wish to create a globally unique mutex + MutexClass(const char* name = nullptr); ~MutexClass(); enum { @@ -89,7 +89,7 @@ class CriticalSectionClass void Unlock(); public: - // Name can (and usually should) be NULL. Use name only if you wish to create a globally unique mutex + // Name can (and usually should) be nullptr. Use name only if you wish to create a globally unique mutex CriticalSectionClass(); ~CriticalSectionClass(); @@ -123,7 +123,7 @@ class FastCriticalSectionClass #endif public: - // Name can (and usually should) be NULL. Use name only if you wish to create a globally unique mutex + // Name can (and usually should) be nullptr. Use name only if you wish to create a globally unique mutex FastCriticalSectionClass() #if defined(_MSC_VER) && _MSC_VER < 1300 : Flag(0) diff --git a/Core/Libraries/Source/WWVegas/WWLib/notifier.h b/Core/Libraries/Source/WWVegas/WWLib/notifier.h index 97aaca08316..2f4bf286d73 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/notifier.h +++ b/Core/Libraries/Source/WWVegas/WWLib/notifier.h @@ -60,7 +60,7 @@ template class Observer typedef std::vector< Notifier* > NotifierColl; Observer() : - mNotifiers(NULL) + mNotifiers() {} virtual ~Observer() @@ -91,7 +91,7 @@ template class Observer while (!mNotifiers.empty()) { Notifier* notifier = mNotifiers.back(); - assert(notifier && "ERROR: NULL pointer in collection."); + assert(notifier && "ERROR: null pointer in collection."); notifier->RemoveObserver(*this); } } diff --git a/Core/Libraries/Source/WWVegas/WWLib/nstrdup.cpp b/Core/Libraries/Source/WWVegas/WWLib/nstrdup.cpp index 82aee8ade4d..81b1d29802c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/nstrdup.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/nstrdup.cpp @@ -54,7 +54,7 @@ *========================================================================*/ char * nstrdup(const char *str) { - if(str == 0) return 0; + if(str == nullptr) return nullptr; // eventually should be replaced with NEW when we go to the wwnew stuff. char *retval = W3DNEWARRAY char [strlen(str) + 1]; diff --git a/Core/Libraries/Source/WWVegas/WWLib/ntree.h b/Core/Libraries/Source/WWVegas/WWLib/ntree.h index 075bfd9e0b8..7466d6712fe 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ntree.h +++ b/Core/Libraries/Source/WWVegas/WWLib/ntree.h @@ -61,7 +61,7 @@ class NTreeClass // Public constructors/destructors ////////////////////////////////////////////////////////////// NTreeClass (void) - : m_Root (NULL) { } + : m_Root (nullptr) { } virtual ~NTreeClass (void) { Reset (); } ////////////////////////////////////////////////////////////// @@ -92,9 +92,9 @@ class NTreeClass template NTreeLeafClass *NTreeClass::Add (const T &value) { - NTreeLeafClass *retval = NULL; + NTreeLeafClass *retval = nullptr; - if (m_Root == NULL) { + if (m_Root == nullptr) { // // Allocate a new root node @@ -121,13 +121,13 @@ NTreeLeafClass *NTreeClass::Add (const T &value) template void NTreeClass::Reset (void) { - if (m_Root != NULL) { + if (m_Root != nullptr) { // // Find the last leaf in the root // NTreeLeafClass *end_leaf = m_Root; - while (end_leaf->Peek_Next () != NULL) { + while (end_leaf->Peek_Next () != nullptr) { end_leaf = end_leaf->Peek_Next (); } @@ -137,7 +137,7 @@ void NTreeClass::Reset (void) // leaf along the way is guarenteed to have at least 1 // reference count on it. // - for (NTreeLeafClass *leaf = end_leaf; leaf != NULL; ) { + for (NTreeLeafClass *leaf = end_leaf; leaf != nullptr; ) { NTreeLeafClass *curr_leaf = leaf; leaf = leaf->Peek_Prev (); @@ -189,9 +189,9 @@ class SortedNTreeClass : public NTreeClass template SortedNTreeLeafClass *SortedNTreeClass::Add_Sorted (const T &value, const char *name) { - SortedNTreeLeafClass *retval = NULL; + SortedNTreeLeafClass *retval = nullptr; - if (m_Root == NULL) { + if (m_Root == nullptr) { // // Allocate a new root node @@ -213,7 +213,7 @@ SortedNTreeLeafClass *SortedNTreeClass::Add_Sorted (const T &value, const // Make sure our 'root' pointer is the first one in the list // NTreeLeafClass *prev = m_Root->Peek_Prev (); - if (prev != NULL) { + if (prev != nullptr) { REF_PTR_SET (m_Root, prev); } } @@ -236,10 +236,10 @@ class NTreeLeafClass : public RefCountClass // Public constructors/destructors ////////////////////////////////////////////////////////////// NTreeLeafClass (void) - : m_Parent (NULL), - m_Child (NULL), - m_PrevSibling (NULL), - m_NextSibling (NULL) { } + : m_Parent (nullptr), + m_Child (nullptr), + m_PrevSibling (nullptr), + m_NextSibling (nullptr) { } virtual ~NTreeLeafClass (void); @@ -319,7 +319,7 @@ NTreeLeafClass *NTreeLeafClass::Add_Child (const T &value) // // Link this new leaf into the hierarchy // - if (m_Child != NULL) { + if (m_Child != nullptr) { m_Child->Set_Prev (new_child); new_child->Set_Next (m_Child); } @@ -366,26 +366,26 @@ void NTreeLeafClass::Remove (void) // // Fixup the parent's child leaf object // - if (m_Parent != NULL && m_Parent->Peek_Child () == this) { + if (m_Parent != nullptr && m_Parent->Peek_Child () == this) { m_Parent->Set_Child (m_NextSibling); } // // Remove all our children // - while (m_Child != NULL) { + while (m_Child != nullptr) { m_Child->Remove (); } // // Unlink ourselves from our siblings // - if (m_NextSibling != NULL) { - m_NextSibling->Set_Prev (NULL); + if (m_NextSibling != nullptr) { + m_NextSibling->Set_Prev (nullptr); } - if (m_PrevSibling != NULL) { - m_PrevSibling->Set_Next (NULL); + if (m_PrevSibling != nullptr) { + m_PrevSibling->Set_Next (nullptr); } REF_PTR_RELEASE (m_Parent); @@ -454,7 +454,7 @@ SortedNTreeLeafClass *SortedNTreeLeafClass::Add_Sorted (const T &value, co // Find the first-most sibling // SortedNTreeLeafClass *start = this; - while (start->Peek_Prev () != NULL) { + while (start->Peek_Prev () != nullptr) { start = (SortedNTreeLeafClass *)start->Peek_Prev (); } @@ -484,7 +484,7 @@ SortedNTreeLeafClass *SortedNTreeLeafClass::Add_Child_Sorted (const T &val new_child->Set_Name (name); new_child->Set_Parent (this); - if (m_Child == NULL) { + if (m_Child == nullptr) { m_Child = new_child; } else { @@ -497,7 +497,7 @@ SortedNTreeLeafClass *SortedNTreeLeafClass::Add_Child_Sorted (const T &val // Make sure our 'child' pointer is the first one in the list // NTreeLeafClass *prev = m_Child->Peek_Prev (); - if (prev != NULL) { + if (prev != nullptr) { REF_PTR_SET (m_Child, prev); } @@ -523,7 +523,7 @@ void SortedNTreeLeafClass::Insertion_Sort (SortedNTreeLeafClass *start, So // bool inserted = false; for ( SortedNTreeLeafClass *leaf = start; - leaf != NULL && !inserted; + leaf != nullptr && !inserted; leaf = (SortedNTreeLeafClass *)leaf->Peek_Next ()) { // @@ -538,13 +538,13 @@ void SortedNTreeLeafClass::Insertion_Sort (SortedNTreeLeafClass *start, So new_sibling->Set_Prev (prev); new_sibling->Set_Next (leaf); leaf->Set_Prev (new_sibling); - if (prev != NULL) { + if (prev != nullptr) { prev->Set_Next (new_sibling); } inserted = true; - } else if (leaf->Peek_Next () == NULL) { + } else if (leaf->Peek_Next () == nullptr) { // // Put the new sibling on the end of the list diff --git a/Core/Libraries/Source/WWVegas/WWLib/pipe.cpp b/Core/Libraries/Source/WWVegas/WWLib/pipe.cpp index cbd752ee096..0a2845b756e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/pipe.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/pipe.cpp @@ -61,15 +61,15 @@ *=============================================================================================*/ Pipe::~Pipe(void) { - if (ChainTo != NULL) { + if (ChainTo != nullptr) { ChainTo->ChainFrom = ChainFrom; } - if (ChainFrom != NULL) { + if (ChainFrom != nullptr) { ChainFrom->Put_To(ChainTo); } - ChainFrom = NULL; - ChainTo = NULL; + ChainFrom = nullptr; + ChainTo = nullptr; } @@ -91,18 +91,18 @@ Pipe::~Pipe(void) void Pipe::Put_To(Pipe * pipe) { if (ChainTo != pipe) { - if (pipe != NULL && pipe->ChainFrom != NULL) { - pipe->ChainFrom->Put_To(NULL); - pipe->ChainFrom = NULL; + if (pipe != nullptr && pipe->ChainFrom != nullptr) { + pipe->ChainFrom->Put_To(nullptr); + pipe->ChainFrom = nullptr; } - if (ChainTo != NULL) { - ChainTo->ChainFrom = NULL; + if (ChainTo != nullptr) { + ChainTo->ChainFrom = nullptr; ChainTo->Flush(); } ChainTo = pipe; - if (ChainTo != NULL) { + if (ChainTo != nullptr) { ChainTo->ChainFrom = this; } } @@ -129,7 +129,7 @@ void Pipe::Put_To(Pipe * pipe) *=============================================================================================*/ int Pipe::Put(void const * source, int length) { - if (ChainTo != NULL) { + if (ChainTo != nullptr) { return(ChainTo->Put(source, length)); } return(length); @@ -156,7 +156,7 @@ int Pipe::Put(void const * source, int length) *=============================================================================================*/ int Pipe::Flush(void) { - if (ChainTo != NULL) { + if (ChainTo != nullptr) { return(ChainTo->Flush()); } return(0); diff --git a/Core/Libraries/Source/WWVegas/WWLib/ramfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/ramfile.cpp index 98de513cf4d..005830d1092 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ramfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ramfile.cpp @@ -62,7 +62,7 @@ * * * INPUT: buffer -- Pointer to the buffer to use for this file. The buffer will already * * contain data if the file is opened for READ. It will be considered * - * a scratch buffer if opened for WRITE. If the buffer pointer is NULL * + * a scratch buffer if opened for WRITE. If the buffer pointer is nullptr * * but the length parameter is not, then a buffer will be allocated * * of the specified length. This case is only useful for opening the * * file for WRITE. * @@ -85,7 +85,7 @@ RAMFileClass::RAMFileClass(void * buffer, int len) : IsOpen(false), IsAllocated(false) { - if (buffer == NULL && len > 0) { + if (buffer == nullptr && len > 0) { Buffer = W3DNEWARRAY char[len]; IsAllocated = true; } @@ -111,7 +111,7 @@ RAMFileClass::~RAMFileClass(void) Close(); if (IsAllocated) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; IsAllocated = false; } } @@ -250,7 +250,7 @@ int RAMFileClass::Open(char const *, int access) *=============================================================================================*/ int RAMFileClass::Open(int access) { - if (Buffer == NULL || Is_Open()) { + if (Buffer == nullptr || Is_Open()) { return(false); } @@ -297,7 +297,7 @@ int RAMFileClass::Open(int access) *=============================================================================================*/ int RAMFileClass::Read(void * buffer, int size) { - if (Buffer == NULL || buffer == NULL || size == 0) { + if (Buffer == nullptr || buffer == nullptr || size == 0) { return(0); } @@ -346,7 +346,7 @@ int RAMFileClass::Read(void * buffer, int size) *=============================================================================================*/ int RAMFileClass::Seek(int pos, int dir) { - if (Buffer == NULL || !Is_Open()) { + if (Buffer == nullptr || !Is_Open()) { return(Offset); } @@ -422,7 +422,7 @@ int RAMFileClass::Size(void) *=============================================================================================*/ int RAMFileClass::Write(void const * buffer, int size) { - if (Buffer == NULL || buffer == NULL || size == 0) { + if (Buffer == nullptr || buffer == nullptr || size == 0) { return(0); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp index 9ebd2d2d356..bcc20a10d89 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp @@ -290,11 +290,11 @@ void RawFileClass::Reset(void) * RawFileClass::File_Name -- Returns with the filename associate with the file object. * * * * Use this routine to determine what filename is associated with this file object. If no * - * filename has yet been assigned, then this routing will return NULL. * + * filename has yet been assigned, then this routing will return null. * * * * INPUT: none * * * - * OUTPUT: Returns with a pointer to the file name associated with this file object or NULL * + * OUTPUT: Returns with a pointer to the file name associated with this file object or nullptr * * if one doesn't exist. * * * * WARNINGS: none * @@ -587,10 +587,10 @@ void RawFileClass::Close(void) * the file. This condition can result in fewer bytes being read than requested. Determine * * this by examining the return value. * * * - * INPUT: buffer -- Pointer to the buffer to read data into. If NULL is passed, no read * + * INPUT: buffer -- Pointer to the buffer to read data into. If nullptr is passed, no read * * is performed. * * * - * size -- The number of bytes to read. If NULL is passed, then no read is * + * size -- The number of bytes to read. If nullptr is passed, then no read is * * performed. * * * * OUTPUT: Returns with the number of bytes read into the buffer. If this number is less * diff --git a/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp index 5462b803980..543dddfdfef 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rcfile.cpp @@ -42,11 +42,11 @@ const char * RESOURCE_FILE_TYPE_NAME = "File"; ResourceFileClass::ResourceFileClass(HMODULE hmodule, char const *filename) : - ResourceName(NULL), - hModule(NULL), - FileBytes(NULL), - FilePtr(NULL), - EndOfFile(NULL) + ResourceName(nullptr), + hModule(nullptr), + FileBytes(nullptr), + FilePtr(nullptr), + EndOfFile(nullptr) { Set_Name(filename); HRSRC hresource = FindResource(hmodule,ResourceName,RESOURCE_FILE_TYPE_NAME); @@ -71,7 +71,7 @@ ResourceFileClass::~ResourceFileClass(void) char const * ResourceFileClass::Set_Name(char const *filename) { free(ResourceName); - ResourceName = NULL; + ResourceName = nullptr; if (filename) { ResourceName = strdup(filename); diff --git a/Core/Libraries/Source/WWVegas/WWLib/rcfile.h b/Core/Libraries/Source/WWVegas/WWLib/rcfile.h index 6217f09062c..55740e7000a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rcfile.h +++ b/Core/Libraries/Source/WWVegas/WWLib/rcfile.h @@ -60,7 +60,7 @@ class ResourceFileClass : public FileClass virtual int Create(void) { return false; } virtual int Delete(void) { return false; } virtual bool Is_Available(int /*forced=false*/) { return Is_Open (); } - virtual bool Is_Open(void) const { return (FileBytes != NULL); } + virtual bool Is_Open(void) const { return (FileBytes != nullptr); } virtual int Open(char const * /*fname*/, int /*rights=READ*/) { return Is_Open(); } virtual int Open(int /*rights=READ*/) { return Is_Open(); } @@ -70,7 +70,7 @@ class ResourceFileClass : public FileClass virtual int Size(void); virtual int Write(void const * /*buffer*/, int /*size*/) { return 0; } virtual void Close(void) { } - virtual void Error(int error, int canretry = false, char const * filename=NULL); + virtual void Error(int error, int canretry = false, char const * filename=nullptr); virtual void Bias(int start, int length=-1) {} virtual unsigned char *Peek_Data(void) const { return FileBytes; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/readline.cpp b/Core/Libraries/Source/WWVegas/WWLib/readline.cpp index 25112a4745c..199fe30bcde 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/readline.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/readline.cpp @@ -101,7 +101,7 @@ int Read_Line(FileClass & file, char * buffer, int len, bool & eof) *=============================================================================================*/ int Read_Line(Straw & file, char * buffer, int len, bool & eof) { - if (len == 0 || buffer == NULL) return(0); + if (len == 0 || buffer == nullptr) return(0); int count = 0; for (;;) { @@ -125,7 +125,7 @@ int Read_Line(Straw & file, char * buffer, int len, bool & eof) int Read_Line(Straw & file, wchar_t * buffer, int len, bool & eof) { - if (len == 0 || buffer == NULL) return(0); + if (len == 0 || buffer == nullptr) return(0); int count = 0; for (;;) { diff --git a/Core/Libraries/Source/WWVegas/WWLib/realcrc.cpp b/Core/Libraries/Source/WWVegas/WWLib/realcrc.cpp index 9e7708c3860..d4ff35607fa 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/realcrc.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/realcrc.cpp @@ -33,7 +33,7 @@ *---------------------------------------------------------------------------------------------* * Functions: * * CRC_Memory -- calculates a CRC for a block of memory * - * CRC_String -- Calculates a CRC for a NULL-terminated string * + * CRC_String -- Calculates a CRC for a null-terminated string * * CRC_Stringi -- Calculates a CRC for a string, case-insensitive * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -134,7 +134,7 @@ unsigned long CRC_Memory( const unsigned char *data, unsigned long length, unsig /*********************************************************************************************** - * CRC_String -- Calculates a CRC for a NULL-terminated string * + * CRC_String -- Calculates a CRC for a null-terminated string * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWLib/ref_ptr.h b/Core/Libraries/Source/WWVegas/WWLib/ref_ptr.h index b7063138d0c..6401e53af1b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ref_ptr.h +++ b/Core/Libraries/Source/WWVegas/WWLib/ref_ptr.h @@ -219,7 +219,7 @@ class RefCountPtr // Is generally used for objects returned by operator new and "Get" functions. static RefCountPtr Create_NoAddRef(T *t) { - WWASSERT(t == NULL || t->Num_Refs() >= 1); + WWASSERT(t == nullptr || t->Num_Refs() >= 1); return RefCountPtr(t, RefCountPtr::GET); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp b/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp index 01f16cc45c1..d9f1e0de0fe 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp @@ -71,7 +71,7 @@ RefCountListClass RefCountClass::ActiveRefList; RefCountClass * RefCountClass::Add_Active_Ref(RefCountClass *obj) { ActiveRefList.Add_Head(&(obj->ActiveRefNode)); - obj->ActiveRefInfo.File = NULL; // default to no debug information added. + obj->ActiveRefInfo.File = nullptr; // default to no debug information added. obj->ActiveRefInfo.Line = 0; return obj; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/registry.cpp b/Core/Libraries/Source/WWVegas/WWLib/registry.cpp index 15ec71602fc..90b8d4f0316 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/registry.cpp @@ -71,8 +71,8 @@ RegistryClass::RegistryClass( const char * sub_key, bool create ) : if (create && !IsLocked) { DWORD disposition; - result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, sub_key, 0, NULL, 0, - KEY_ALL_ACCESS, NULL, &key, &disposition); + result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, sub_key, 0, nullptr, 0, + KEY_ALL_ACCESS, nullptr, &key, &disposition); } else { result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sub_key, 0, IsLocked ? KEY_READ : KEY_ALL_ACCESS, &key); } @@ -96,7 +96,7 @@ int RegistryClass::Get_Int( const char * name, int def_value ) { assert( IsValid ); DWORD type, data = 0, data_len = sizeof( data ); - if (( ::RegQueryValueEx( (HKEY)Key, name, NULL, &type, (LPBYTE)&data, &data_len ) == + if (( ::RegQueryValueEx( (HKEY)Key, name, nullptr, &type, (LPBYTE)&data, &data_len ) == ERROR_SUCCESS ) && ( type == REG_DWORD )) { } else { data = def_value; @@ -132,7 +132,7 @@ float RegistryClass::Get_Float( const char * name, float def_value ) assert( IsValid ); float data = 0; DWORD type, data_len = sizeof( data ); - if (( ::RegQueryValueEx( (HKEY)Key, name, NULL, &type, (LPBYTE)&data, &data_len ) == + if (( ::RegQueryValueEx( (HKEY)Key, name, nullptr, &type, (LPBYTE)&data, &data_len ) == ERROR_SUCCESS ) && ( type == REG_DWORD )) { } else { data = def_value; @@ -156,7 +156,7 @@ int RegistryClass::Get_Bin_Size( const char * name ) assert( IsValid ); unsigned long size = 0; - ::RegQueryValueEx( (HKEY)Key, name, NULL, NULL, NULL, &size ); + ::RegQueryValueEx( (HKEY)Key, name, nullptr, nullptr, nullptr, &size ); return size; } @@ -164,18 +164,18 @@ int RegistryClass::Get_Bin_Size( const char * name ) void RegistryClass::Get_Bin( const char * name, void *buffer, int buffer_size ) { assert( IsValid ); - assert( buffer != NULL ); + assert( buffer != nullptr ); assert( buffer_size > 0 ); unsigned long size = buffer_size; - ::RegQueryValueEx( (HKEY)Key, name, NULL, NULL, (LPBYTE)buffer, &size ); + ::RegQueryValueEx( (HKEY)Key, name, nullptr, nullptr, (LPBYTE)buffer, &size ); return ; } void RegistryClass::Set_Bin( const char * name, const void *buffer, int buffer_size ) { assert( IsValid ); - assert( buffer != NULL ); + assert( buffer != nullptr ); assert( buffer_size > 0 ); if (IsLocked) { @@ -188,20 +188,20 @@ void RegistryClass::Set_Bin( const char * name, const void *buffer, int buffer_s void RegistryClass::Get_String( const char * name, StringClass &string, const char *default_string ) { assert( IsValid ); - string = (default_string == NULL) ? "" : default_string; + string = (default_string == nullptr) ? "" : default_string; // // Get the size of the entry // DWORD data_size = 0; DWORD type = 0; - LONG result = ::RegQueryValueEx ((HKEY)Key, name, NULL, &type, NULL, &data_size); + LONG result = ::RegQueryValueEx ((HKEY)Key, name, nullptr, &type, nullptr, &data_size); if (result == ERROR_SUCCESS && type == REG_SZ) { // // Read the entry from the registry // - ::RegQueryValueEx ((HKEY)Key, name, NULL, &type, + ::RegQueryValueEx ((HKEY)Key, name, nullptr, &type, (LPBYTE)string.Get_Buffer (data_size), &data_size); } @@ -214,12 +214,12 @@ char *RegistryClass::Get_String( const char * name, char *value, int value_size, { assert( IsValid ); DWORD type = 0; - if (( ::RegQueryValueEx( (HKEY)Key, name, NULL, &type, (LPBYTE)value, (DWORD*)&value_size ) == + if (( ::RegQueryValueEx( (HKEY)Key, name, nullptr, &type, (LPBYTE)value, (DWORD*)&value_size ) == ERROR_SUCCESS ) && ( type == REG_SZ )) { } else { //*value = 0; //value = (char *) default_string; - if (default_string == NULL) { + if (default_string == nullptr) { *value = 0; } else { assert(strlen(default_string) < (unsigned int) value_size); @@ -232,7 +232,7 @@ char *RegistryClass::Get_String( const char * name, char *value, int value_size, void RegistryClass::Set_String( const char * name, const char *value ) { assert( IsValid ); - int size = strlen( value ) + 1; // must include NULL + int size = strlen( value ) + 1; // must include null terminator if (IsLocked) { return; } @@ -251,7 +251,7 @@ void RegistryClass::Get_Value_List( DynamicVectorClass &list ) int index = 0; unsigned long sizeof_name = sizeof (value_name); while (::RegEnumValue ((HKEY)Key, index ++, - value_name, &sizeof_name, 0, NULL, NULL, NULL) == ERROR_SUCCESS) + value_name, &sizeof_name, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS) { sizeof_name = sizeof (value_name); @@ -298,20 +298,20 @@ void RegistryClass::Deleta_All_Values( void ) void RegistryClass::Get_String( const WCHAR * name, WideStringClass &string, const WCHAR *default_string ) { assert( IsValid ); - string = (default_string == NULL) ? L"" : default_string; + string = (default_string == nullptr) ? L"" : default_string; // // Get the size of the entry // DWORD data_size = 0; DWORD type = 0; - LONG result = ::RegQueryValueExW ((HKEY)Key, name, NULL, &type, NULL, &data_size); + LONG result = ::RegQueryValueExW ((HKEY)Key, name, nullptr, &type, nullptr, &data_size); if (result == ERROR_SUCCESS && type == REG_SZ) { // // Read the entry from the registry // - ::RegQueryValueExW ((HKEY)Key, name, NULL, &type, + ::RegQueryValueExW ((HKEY)Key, name, nullptr, &type, (LPBYTE)string.Get_Buffer ((data_size / 2) + 1), &data_size); } @@ -376,7 +376,7 @@ void RegistryClass::Save_Registry_Values(HKEY key, char *path, INIClass *ini) char value_name[256]; unsigned long value_name_size = sizeof(value_name); - result = RegEnumValue(key, index, value_name, &value_name_size, 0, &type, data, &data_size); + result = RegEnumValue(key, index, value_name, &value_name_size, nullptr, &type, data, &data_size); if (result == ERROR_SUCCESS) { switch (type) { @@ -463,7 +463,7 @@ void RegistryClass::Save_Registry_Tree(char *path, INIClass *ini) while (result == ERROR_SUCCESS) { class_name_size = sizeof(class_name); name_size = sizeof(name); - result = RegEnumKeyEx(base_key, index, name, &name_size, 0, class_name, &class_name_size, &file_time); + result = RegEnumKeyEx(base_key, index, name, &name_size, nullptr, class_name, &class_name_size, &file_time); if (result == ERROR_SUCCESS) { /* @@ -479,7 +479,7 @@ void RegistryClass::Save_Registry_Tree(char *path, INIClass *ini) long new_result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, new_key_path, 0, KEY_ALL_ACCESS, &sub_key); if (new_result == ERROR_SUCCESS) { - new_result = RegQueryInfoKey(sub_key, NULL, NULL, 0, &num_subs, NULL, NULL, &num_values, NULL, NULL, NULL, NULL); + new_result = RegQueryInfoKey(sub_key, nullptr, nullptr, nullptr, &num_subs, nullptr, nullptr, &num_values, nullptr, nullptr, nullptr, nullptr); /* ** If there are sun keys then enumerate those. @@ -558,7 +558,7 @@ void RegistryClass::Load_Registry(const char *filename, char *old_path, char *ne List §ion_list = ini.Get_Section_List(); - for (INISection *section = section_list.First() ; section != NULL ; section = section->Next_Valid()) { + for (INISection *section = section_list.First() ; section != nullptr ; section = section->Next_Valid()) { /* ** Build the new path to use in the registry. @@ -637,7 +637,7 @@ void RegistryClass::Delete_Registry_Values(HKEY key) char value_name[256]; unsigned long value_name_size = sizeof(value_name); - result = RegEnumValue(key, index, value_name, &value_name_size, 0, &type, data, &data_size); + result = RegEnumValue(key, index, value_name, &value_name_size, nullptr, &type, data, &data_size); if (result == ERROR_SUCCESS) { result = RegDeleteValue(key, value_name); @@ -686,7 +686,7 @@ void RegistryClass::Delete_Registry_Tree(char *path) while (result == ERROR_SUCCESS) { class_name_size = sizeof(class_name); name_size = sizeof(name); - result = RegEnumKeyEx(base_key, index, name, &name_size, 0, class_name, &class_name_size, &file_time); + result = RegEnumKeyEx(base_key, index, name, &name_size, nullptr, class_name, &class_name_size, &file_time); if (result == ERROR_SUCCESS) { /* @@ -702,7 +702,7 @@ void RegistryClass::Delete_Registry_Tree(char *path) long new_result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, new_key_path, 0, KEY_ALL_ACCESS, &sub_key); if (new_result == ERROR_SUCCESS) { - new_result = RegQueryInfoKey(sub_key, NULL, NULL, 0, &num_subs, NULL, NULL, &num_values, NULL, NULL, NULL, NULL); + new_result = RegQueryInfoKey(sub_key, nullptr, nullptr, nullptr, &num_subs, nullptr, nullptr, &num_values, nullptr, nullptr, nullptr, nullptr); /* ** If there are sub keys then enumerate those. diff --git a/Core/Libraries/Source/WWVegas/WWLib/registry.h b/Core/Libraries/Source/WWVegas/WWLib/registry.h index 0e83f40f89c..75cefcf13d3 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/registry.h +++ b/Core/Libraries/Source/WWVegas/WWLib/registry.h @@ -69,12 +69,12 @@ class RegistryClass { // String data type access char *Get_String( const char * name, char *value, int value_size, - const char * default_string = NULL ); - void Get_String( const char * name, StringClass &string, const char *default_string = NULL); + const char * default_string = nullptr ); + void Get_String( const char * name, StringClass &string, const char *default_string = nullptr); void Set_String( const char * name, const char *value ); // Wide string data type access - void Get_String( const WCHAR * name, WideStringClass &string, const WCHAR *default_string = NULL); + void Get_String( const WCHAR * name, WideStringClass &string, const WCHAR *default_string = nullptr); void Set_String( const WCHAR * name, const WCHAR *value ); // Binary data type access diff --git a/Core/Libraries/Source/WWVegas/WWLib/search.h b/Core/Libraries/Source/WWVegas/WWLib/search.h index 35a7d9032e2..fbe7c0bc336 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/search.h +++ b/Core/Libraries/Source/WWVegas/WWLib/search.h @@ -291,7 +291,7 @@ bool IndexClass::Increase_Table_Size(int amount) if (amount < 0) return(false); NodeElement * table = W3DNEWARRAY NodeElement[IndexSize + amount]; - if (table != NULL) { + if (table != nullptr) { /* ** Copy all valid nodes into the new table. @@ -653,7 +653,7 @@ int _USERENTRY IndexClass::search_compfunc(void const * ptr1, void const * pt * INPUT: id -- The index ID to search for. * * * * OUTPUT: Returns with a pointer to the NodeElement that matches the index ID specified. If * - * no matching index could be found, then NULL is returned. * + * no matching index could be found, then nullptr is returned. * * * * WARNINGS: none * * * diff --git a/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h b/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h index 05f75027b6c..e2d0291cc49 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h +++ b/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h @@ -113,7 +113,7 @@ template ShareBufferClass::~ShareBufferClass(void) { delete[] Array; - Array = NULL; + Array = nullptr; } template diff --git a/Core/Libraries/Source/WWVegas/WWLib/simplevec.h b/Core/Libraries/Source/WWVegas/WWLib/simplevec.h index ae2c6bc5a75..3ecbd8b180c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/simplevec.h +++ b/Core/Libraries/Source/WWVegas/WWLib/simplevec.h @@ -77,7 +77,7 @@ template class SimpleVecClass int Length(void) const { return VectorMax; } virtual bool Resize(int newsize); virtual bool Uninitialised_Grow(int newsize); - void Zero_Memory(void) { if (Vector != NULL) { memset(Vector,0,VectorMax * sizeof(T)); } } + void Zero_Memory(void) { if (Vector != nullptr) { memset(Vector,0,VectorMax * sizeof(T)); } } protected: @@ -101,7 +101,7 @@ template class SimpleVecClass *=============================================================================================*/ template inline SimpleVecClass::SimpleVecClass(int size) : - Vector(NULL), + Vector(nullptr), VectorMax(0) { if (size > 0) { @@ -125,7 +125,7 @@ template inline SimpleVecClass::~SimpleVecClass(void) { delete[] Vector; - Vector = NULL; + Vector = nullptr; VectorMax = 0; } @@ -160,7 +160,7 @@ inline bool SimpleVecClass::Resize(int newsize) ** If there is an old vector, then it must be copied (as much as is feasible) ** to the new vector. */ - if (Vector != NULL) { + if (Vector != nullptr) { /* ** Mem copy as much of the old vector into the new vector as possible. @@ -172,7 +172,7 @@ inline bool SimpleVecClass::Resize(int newsize) ** Delete the old vector. */ delete[] Vector; - Vector = NULL; + Vector = nullptr; } /* @@ -187,7 +187,7 @@ inline bool SimpleVecClass::Resize(int newsize) ** Delete entire vector and reset counts */ delete[] Vector; - Vector = NULL; + Vector = nullptr; VectorMax = 0; } return true; @@ -321,7 +321,7 @@ template inline SimpleDynVecClass::~SimpleDynVecClass(void) { delete[] Vector; - Vector = NULL; + Vector = nullptr; } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WWLib/straw.cpp b/Core/Libraries/Source/WWVegas/WWLib/straw.cpp index a18068ad8e1..84ed8bf9f23 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/straw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/straw.cpp @@ -60,15 +60,15 @@ *=============================================================================================*/ Straw::~Straw(void) { - if (ChainTo != NULL) { + if (ChainTo != nullptr) { ChainTo->ChainFrom = ChainFrom; } - if (ChainFrom != NULL) { + if (ChainFrom != nullptr) { ChainFrom->Get_From(ChainTo); } - ChainFrom = NULL; - ChainTo = NULL; + ChainFrom = nullptr; + ChainTo = nullptr; } @@ -91,17 +91,17 @@ Straw::~Straw(void) void Straw::Get_From(Straw * straw) { if (ChainTo != straw) { - if (straw != NULL && straw->ChainFrom != NULL) { - straw->ChainFrom->Get_From(NULL); - straw->ChainFrom = NULL; + if (straw != nullptr && straw->ChainFrom != nullptr) { + straw->ChainFrom->Get_From(nullptr); + straw->ChainFrom = nullptr; } - if (ChainTo != NULL) { - ChainTo->ChainFrom = NULL; + if (ChainTo != nullptr) { + ChainTo->ChainFrom = nullptr; } ChainTo = straw; - if (ChainTo != NULL) { + if (ChainTo != nullptr) { ChainTo->ChainFrom = this; } } @@ -130,7 +130,7 @@ void Straw::Get_From(Straw * straw) *=============================================================================================*/ int Straw::Get(void * source, int slen) { - if (ChainTo != NULL) { + if (ChainTo != nullptr) { return(ChainTo->Get(source, slen)); } return(0); diff --git a/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp b/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp index e9c9faec05a..66d0a195753 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp @@ -55,7 +55,7 @@ char *strtok_r(char *strptr, const char *delimiters, char **lasts) *lasts=strptr; if ((*lasts)[0]==0) // 0 length string? - return(NULL); + return(nullptr); // // Note: strcspn & strspn are both called, they're opposites @@ -68,7 +68,7 @@ char *strtok_r(char *strptr, const char *delimiters, char **lasts) *lasts+=dend; if ((*lasts)[0]==0) // 0 length string? - return(NULL); + return(nullptr); dstart=strcspn(*lasts, delimiters); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/systimer.h b/Core/Libraries/Source/WWVegas/WWLib/systimer.h index 56db4c64b22..89676f2965e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/systimer.h +++ b/Core/Libraries/Source/WWVegas/WWLib/systimer.h @@ -51,7 +51,7 @@ inline unsigned long systimerGetMS(void) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp b/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp index d1db1743cf9..334fe55fc59 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp @@ -55,12 +55,12 @@ TGAToDXTClass _TGAToDXTConverter; // /////////////////////////////////////////////////////////////////////////////// TGAToDXTClass::TGAToDXTClass() - : WriteTimePtr (NULL), + : WriteTimePtr (nullptr), BufferSize (1024), BufferCount (0) { Buffer = new unsigned char [BufferSize]; - WWASSERT (Buffer != NULL); + WWASSERT (Buffer != nullptr); } @@ -207,15 +207,15 @@ void TGAToDXTClass::Write (const char *outputpathname) HANDLE hfile; DWORD bytecountwritten; - hfile = ::CreateFile (outputpathname, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0L, NULL); + hfile = ::CreateFile (outputpathname, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, 0L, nullptr); if (hfile != INVALID_HANDLE_VALUE) { LockFile (hfile, 0, 0, BufferCount, 0); - WriteFile (hfile, Buffer, BufferCount, &bytecountwritten, NULL); + WriteFile (hfile, Buffer, BufferCount, &bytecountwritten, nullptr); UnlockFile (hfile, 0, 0, BufferCount, 0); // Stamp the write time (if one has been supplied). - if (WriteTimePtr != NULL) { - SetFileTime (hfile, NULL, NULL, WriteTimePtr); + if (WriteTimePtr != nullptr) { + SetFileTime (hfile, nullptr, nullptr, WriteTimePtr); } CloseHandle (hfile); @@ -253,7 +253,7 @@ void WriteDTXnFile (DWORD datacount, void *data) newbuffersize = MAX (_TGAToDXTConverter.BufferSize * 2, _TGAToDXTConverter.BufferCount + datacount); newbuffer = new unsigned char [newbuffersize]; - WWASSERT (newbuffer != NULL); + WWASSERT (newbuffer != nullptr); memcpy (newbuffer, _TGAToDXTConverter.Buffer, _TGAToDXTConverter.BufferCount); delete [] _TGAToDXTConverter.Buffer; _TGAToDXTConverter.Buffer = newbuffer; diff --git a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp index aaad589d7f4..6bafc3314ad 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp @@ -57,7 +57,7 @@ void __cdecl ThreadClass::Internal_Thread_Function(void* params) #ifdef _WIN32 Register_Thread_ID(tc->ThreadID, tc->ThreadName); - if (tc->ExceptionHandler != NULL) { + if (tc->ExceptionHandler != nullptr) { __try { tc->Thread_Function(); } __except(tc->ExceptionHandler(GetExceptionCode(), GetExceptionInformation())) {}; @@ -126,7 +126,7 @@ void ThreadClass::Sleep_Ms(unsigned ms) } #ifndef _UNIX -HANDLE test_event = ::CreateEvent (NULL, FALSE, FALSE, ""); +HANDLE test_event = ::CreateEvent (nullptr, FALSE, FALSE, ""); #endif void ThreadClass::Switch_Thread() diff --git a/Core/Libraries/Source/WWVegas/WWLib/thread.h b/Core/Libraries/Source/WWVegas/WWLib/thread.h index 0f526274c68..2aae9fb4fe8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/thread.h +++ b/Core/Libraries/Source/WWVegas/WWLib/thread.h @@ -43,7 +43,7 @@ class ThreadClass public: typedef int (*ExceptionHandlerType)(int exception_code, struct _EXCEPTION_POINTERS *e_info); - ThreadClass(const char *name = NULL, ExceptionHandlerType exception_handler = NULL); + ThreadClass(const char *name = nullptr, ExceptionHandlerType exception_handler = nullptr); virtual ~ThreadClass(); // Execute Thread_Function(). Note that only one instance can be executed at a time. @@ -71,7 +71,7 @@ class ThreadClass const char *Get_Name(void) {return(ThreadName);}; // Get info about a registered thread by it's index. - static int Get_Thread_By_Index(int index, char *name_ptr = NULL); + static int Get_Thread_By_Index(int index, char *name_ptr = nullptr); protected: diff --git a/Core/Libraries/Source/WWVegas/WWLib/trect.h b/Core/Libraries/Source/WWVegas/WWLib/trect.h index b302888f5f6..0446753d2e5 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/trect.h +++ b/Core/Libraries/Source/WWVegas/WWLib/trect.h @@ -59,7 +59,7 @@ class TRect TRect const operator + (TPoint2D const & point) {return(TRect(X + point.X, Y + point.Y, Width, Height));} TRect const operator - (TPoint2D const & point) {return(TRect(X - point.X, Y - point.Y, Width, Height));} - TRect const Intersect(TRect const & rectangle, T * x=NULL, T * y=NULL) const; + TRect const Intersect(TRect const & rectangle, T * x=nullptr, T * y=nullptr) const; TRect const Union(TRect const & rect2) const; /* @@ -163,10 +163,10 @@ TRect const TRect::Intersect(TRect const & rectangle, T * x, T * y) con ** Adjust Height relative draw position according to Height new rectangle ** union. */ - if (x != NULL) { + if (x != nullptr) { *x -= (r.X-X); } - if (y != NULL) { + if (y != nullptr) { *y -= (r.Y-Y); } diff --git a/Core/Libraries/Source/WWVegas/WWLib/uarray.h b/Core/Libraries/Source/WWVegas/WWLib/uarray.h index ba630938249..50b7061e94a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/uarray.h +++ b/Core/Libraries/Source/WWVegas/WWLib/uarray.h @@ -146,7 +146,7 @@ template UniqueArrayClass::~UniqueArrayClass(void) { delete[] HashTable; - HashTable = NULL; + HashTable = nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WWLib/vector.cpp b/Core/Libraries/Source/WWVegas/WWLib/vector.cpp index f9333e06773..0d6b4800bde 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/vector.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/vector.cpp @@ -85,7 +85,7 @@ BooleanVectorClass::BooleanVectorClass(unsigned size, unsigned char * array) : BitCount(size), Copy(false), LastIndex(-1), - BitArray(0, 0) + BitArray(0, nullptr) { BitArray.Resize(((size + (8-1)) / 8), array); // LastIndex = -1; diff --git a/Core/Libraries/Source/WWVegas/WWLib/verchk.cpp b/Core/Libraries/Source/WWVegas/WWLib/verchk.cpp index 6aa6cc4af80..b555c48bbcf 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/verchk.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/verchk.cpp @@ -61,7 +61,7 @@ bool GetVersionInfo(char* filename, VS_FIXEDFILEINFO* fileInfo) { - if (filename == NULL || fileInfo == NULL) + if (filename == nullptr || fileInfo == nullptr) { return false; } @@ -121,7 +121,7 @@ bool GetFileCreationTime(char* filename, FILETIME* createTime) if (handle != INVALID_HANDLE_VALUE) { - if (GetFileTime(handle, NULL, NULL, createTime)) + if (GetFileTime(handle, nullptr, nullptr, createTime)) { return true; } @@ -173,7 +173,7 @@ Get_Image_File_Header (const char *filename, IMAGE_FILE_HEADER *file_header) } _TheFileFactory->Return_File(file); - file=NULL; + file=nullptr; return retval; } @@ -193,7 +193,7 @@ Get_Image_File_Header (HINSTANCE app_instance, IMAGE_FILE_HEADER *file_header) // Read the dos header (all PE exectuable files begin with this) // IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)app_instance; - if (dos_header != NULL) { + if (dos_header != nullptr) { // // Determine the offset where the image header resides diff --git a/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp b/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp index 41cbb495eaa..6fc6d12643d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp @@ -67,10 +67,10 @@ WCHAR * WideStringClass::m_FreeTempPtr[MAX_TEMP_STRING] = { }; WCHAR * WideStringClass::m_ResTempPtr[MAX_TEMP_STRING] = { - NULL, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr, + nullptr }; @@ -86,7 +86,7 @@ WideStringClass::Get_String (int length, bool is_temp) m_Buffer = m_EmptyString; } else { - WCHAR *string = NULL; + WCHAR *string = nullptr; // // Should we attempt to use a temp buffer for this string? @@ -103,14 +103,14 @@ WideStringClass::Get_String (int length, bool is_temp) // Try to find an available temporary buffer // for (int index = 0; index < MAX_TEMP_STRING; index ++) { - if (m_FreeTempPtr[index] != NULL) { + if (m_FreeTempPtr[index] != nullptr) { // // Grab this unused buffer for our string // string = m_FreeTempPtr[index]; m_ResTempPtr[index] = m_FreeTempPtr[index]; - m_FreeTempPtr[index] = NULL; + m_FreeTempPtr[index] = nullptr; Set_Buffer_And_Allocated_Length (string, MAX_TEMP_LEN); // @@ -122,7 +122,7 @@ WideStringClass::Get_String (int length, bool is_temp) } } - if (string == NULL) { + if (string == nullptr) { Set_Buffer_And_Allocated_Length (Allocate_Buffer (length), length); } } @@ -212,7 +212,7 @@ WideStringClass::Free_String (void) // m_Buffer[0] = 0; m_FreeTempPtr[index] = m_Buffer; - m_ResTempPtr[index] = 0; + m_ResTempPtr[index] = nullptr; m_UsedTempStringCount --; found = true; break; @@ -245,7 +245,7 @@ WideStringClass::Free_String (void) int _cdecl WideStringClass::Format_Args (const WCHAR *format, va_list arg_list ) { - if (format == NULL) { + if (format == nullptr) { return 0; } @@ -276,7 +276,7 @@ WideStringClass::Format_Args (const WCHAR *format, va_list arg_list ) int _cdecl WideStringClass::Format (const WCHAR *format, ...) { - if (format == NULL) { + if (format == nullptr) { return 0; } @@ -319,11 +319,11 @@ WideStringClass::Release_Resources (void) /////////////////////////////////////////////////////////////////// bool WideStringClass::Convert_From (const char *text) { - if (text != NULL) { + if (text != nullptr) { int length; - length = MultiByteToWideChar (CP_ACP, 0, text, -1, NULL, 0); + length = MultiByteToWideChar (CP_ACP, 0, text, -1, nullptr, 0); if (length > 0) { Uninitialised_Grow (length); diff --git a/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp b/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp index f4da1100c4a..3793688c440 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp @@ -71,7 +71,7 @@ StringClass::Get_String (int length, bool is_temp) return; } - TCHAR *string = NULL; + TCHAR *string = nullptr; // // Should we attempt to use a temp buffer for this string? @@ -113,7 +113,7 @@ StringClass::Get_String (int length, bool is_temp) } } - if (string == NULL) { + if (string == nullptr) { // // Allocate a new string as necessary @@ -316,16 +316,16 @@ StringClass::Release_Resources (void) /////////////////////////////////////////////////////////////////// bool StringClass::Copy_Wide (const WCHAR *source) { - if (source != NULL) { + if (source != nullptr) { int length; int unmapped; - length = WideCharToMultiByte (CP_ACP, 0 , source, -1, NULL, 0, NULL, &unmapped); + length = WideCharToMultiByte (CP_ACP, 0 , source, -1, nullptr, 0, nullptr, &unmapped); if (length > 0) { // Convert. - WideCharToMultiByte (CP_ACP, 0, source, -1, Get_Buffer (length), length, NULL, NULL); + WideCharToMultiByte (CP_ACP, 0, source, -1, Get_Buffer (length), length, nullptr, nullptr); // Update length. Store_Length (length - 1); diff --git a/Core/Libraries/Source/WWVegas/WWLib/wwstring.h b/Core/Libraries/Source/WWVegas/WWLib/wwstring.h index 3a5745163bd..56981c4fdf4 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/wwstring.h +++ b/Core/Libraries/Source/WWVegas/WWLib/wwstring.h @@ -497,7 +497,7 @@ inline void StringClass::Trim(void) inline const StringClass & StringClass::operator+= (const TCHAR *string) { - WWASSERT (string != NULL); + WWASSERT (string != nullptr); int cur_len = Get_Length (); int src_len = _tcslen (string); diff --git a/Core/Libraries/Source/WWVegas/WWLib/xpipe.cpp b/Core/Libraries/Source/WWVegas/WWLib/xpipe.cpp index 15e310c9e64..cceb4400f75 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/xpipe.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/xpipe.cpp @@ -70,7 +70,7 @@ int BufferPipe::Put(void const * source, int slen) { int total = 0; - if (Is_Valid() && source != NULL && slen > 0) { + if (Is_Valid() && source != nullptr && slen > 0) { int len = slen; if (BufferPtr.Get_Size() != 0) { int theoretical_max = BufferPtr.Get_Size() - Index; @@ -99,7 +99,7 @@ FilePipe::~FilePipe(void) if (Valid_File() && HasOpened) { HasOpened = false; File->Close(); - File = NULL; + File = nullptr; } } @@ -153,7 +153,7 @@ int FilePipe::End(void) *=============================================================================================*/ int FilePipe::Put(void const * source, int slen) { - if (Valid_File() && source != NULL && slen > 0) { + if (Valid_File() && source != nullptr && slen > 0) { if (!File->Is_Open()) { HasOpened = true; File->Open(FileClass::WRITE); diff --git a/Core/Libraries/Source/WWVegas/WWLib/xstraw.cpp b/Core/Libraries/Source/WWVegas/WWLib/xstraw.cpp index d567c0421ca..9e520096aca 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/xstraw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/xstraw.cpp @@ -68,7 +68,7 @@ int BufferStraw::Get(void * source, int slen) { int total = 0; - if (Is_Valid() && source != NULL && slen > 0) { + if (Is_Valid() && source != nullptr && slen > 0) { int len = slen; if (BufferPtr.Get_Size() != 0) { int theoretical_max = BufferPtr.Get_Size() - Index; @@ -113,7 +113,7 @@ int BufferStraw::Get(void * source, int slen) *=============================================================================================*/ int FileStraw::Get(void * source, int slen) { - if (Valid_File() && source != NULL && slen > 0) { + if (Valid_File() && source != nullptr && slen > 0) { if (!File->Is_Open()) { HasOpened = true; if (!File->Is_Available()) return(0); @@ -145,6 +145,6 @@ FileStraw::~FileStraw(void) if (Valid_File() && HasOpened) { File->Close(); HasOpened = false; - File = NULL; + File = nullptr; } } diff --git a/Core/Libraries/Source/WWVegas/WWMath/aabox.h b/Core/Libraries/Source/WWVegas/WWMath/aabox.h index eb0b29669fa..1ec34cc7afc 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabox.h +++ b/Core/Libraries/Source/WWVegas/WWMath/aabox.h @@ -518,7 +518,7 @@ WWINLINE bool AABoxClass::Contains(const Vector3 & point) const WWINLINE void MinMaxAABoxClass::Init(Vector3 * points,int num) { assert(num > 0); - assert(points != NULL); + assert(points != nullptr); MinCorner = points[0]; MaxCorner = points[0]; for (int i=0; iGet_Culling_System() == NULL), + (obj->Get_Culling_System() == nullptr), "AABTreeCullSystemClass::Add -- Object is already in another culling system!\n" ); @@ -172,9 +172,9 @@ void AABTreeCullSystemClass::Remove_Object_Internal(CullableClass * obj) WWASSERT(node); node->Remove_Object(obj); - link->Set_Culling_System(NULL); + link->Set_Culling_System(nullptr); delete link; - obj->Set_Cull_Link(NULL); + obj->Set_Cull_Link(nullptr); ObjectCount--; WWASSERT(ObjectCount >= 0); @@ -304,7 +304,7 @@ void AABTreeCullSystemClass::Add_Loaded_Object(AABTreeNodeClass * node,CullableC WWASSERT_PRINT ( - (obj->Get_Culling_System() == NULL), + (obj->Get_Culling_System() == nullptr), "AABTreeCullSystemClass::Add_Loaded_Object -- Object is already in another culling system!\n" ); @@ -381,7 +381,7 @@ void AABTreeCullSystemClass::Re_Partition(const AABoxClass & bounds,SimpleDynVec */ dummy_node->Box.Extent.Set(0,0,0); CullableClass * obj = get_first_object(dummy_node); - while (obj != NULL) { + while (obj != nullptr) { Update_Culling(obj); obj = get_first_object(dummy_node); } @@ -781,7 +781,7 @@ void AABTreeCullSystemClass::Load_Nodes(AABTreeNodeClass * node,ChunkLoadClass & // if we are supposed to have a front child, load it if (node_desc.Attributes & AABNODE_ATTRIBUTE_FRONT_CHILD) { - WWASSERT(node->Front == NULL); + WWASSERT(node->Front == nullptr); node->Front = new AABTreeNodeClass(); node->Front->Parent = node; Load_Nodes(node->Front,cload); @@ -789,7 +789,7 @@ void AABTreeCullSystemClass::Load_Nodes(AABTreeNodeClass * node,ChunkLoadClass & // if we have a back child, load it if (node_desc.Attributes & AABNODE_ATTRIBUTE_BACK_CHILD) { - WWASSERT(node->Back == NULL); + WWASSERT(node->Back == nullptr); node->Back = new AABTreeNodeClass(); node->Back->Parent = node; Load_Nodes(node->Back,cload); @@ -882,7 +882,7 @@ void AABTreeCullSystemClass::Save_Object_Linkage(ChunkSaveClass & csave,Cullable void AABTreeCullSystemClass::Re_Index_Nodes(void) { delete[] IndexedNodes; - IndexedNodes = NULL; + IndexedNodes = nullptr; NodeCount = Partition_Node_Count(); WWASSERT(NodeCount > 0); @@ -918,10 +918,10 @@ void AABTreeCullSystemClass::Re_Index_Nodes_Recursive(AABTreeNodeClass * node,in AABTreeNodeClass::AABTreeNodeClass(void) : Index(0), Box(Vector3(0,0,0),Vector3(0,0,0)), - Parent(NULL), - Front(NULL), - Back(NULL), - Object(NULL), + Parent(nullptr), + Front(nullptr), + Back(nullptr), + Object(nullptr), UserData(0) { } @@ -929,14 +929,14 @@ AABTreeNodeClass::AABTreeNodeClass(void) : AABTreeNodeClass::~AABTreeNodeClass(void) { // objects should be removed before deleting the partition tree - WWASSERT(Object == NULL); + WWASSERT(Object == nullptr); // delete our children delete Front; - Front = NULL; + Front = nullptr; delete Back; - Back = NULL; + Back = nullptr; } void AABTreeNodeClass::Compute_Bounding_Box(void) @@ -1000,7 +1000,7 @@ void AABTreeNodeClass::Add_Object(CullableClass * obj,bool update_bounds) if (update_bounds) { // if this is the only object and we have no children, just copy // the object's bounding box, otherwise, add it to what we have - if ((Object_Count() == 1) && (Front == NULL) && (Back == NULL)) { + if ((Object_Count() == 1) && (Front == nullptr) && (Back == nullptr)) { Box = obj->Get_Cull_Box(); } else { Box.Add_Box(obj->Get_Cull_Box()); @@ -1013,7 +1013,7 @@ void AABTreeNodeClass::Remove_Object(CullableClass * obj) WWASSERT(obj); // find the given object in our linked list - CullableClass * prevobj = NULL; + CullableClass * prevobj = nullptr; CullableClass * curobj = Object; while (curobj) { @@ -1029,8 +1029,8 @@ void AABTreeNodeClass::Remove_Object(CullableClass * obj) Object = link->NextObject; } - link->NextObject = NULL; - link->Node = NULL; + link->NextObject = nullptr; + link->Node = nullptr; return; } @@ -1076,7 +1076,7 @@ CullableClass * AABTreeNodeClass::Peek_Object(int index) { int count = 0; CullableClass * obj = Object; - WWASSERT(obj != NULL); + WWASSERT(obj != nullptr); while (obj && (count != index)) { count++; @@ -1107,7 +1107,7 @@ void AABTreeNodeClass::Partition(void) */ SimpleDynVecClass boxes(obj_count); CullableClass * obj = Object; - while (obj != NULL) { + while (obj != nullptr) { boxes.Add(obj->Get_Cull_Box()); obj = get_next_object(obj); } @@ -1144,7 +1144,7 @@ void AABTreeNodeClass::Partition(void) Front->Partition(); } else { delete front; - front = NULL; + front = nullptr; } /* @@ -1156,7 +1156,7 @@ void AABTreeNodeClass::Partition(void) Back->Partition(); } else { delete back; - back = NULL; + back = nullptr; } } @@ -1165,8 +1165,8 @@ void AABTreeNodeClass::Partition(void) void AABTreeNodeClass::Split_Objects(const AABTreeNodeClass::SplitChoiceStruct & sc,AABTreeNodeClass * front,AABTreeNodeClass * back) { // This function assumes that this node is a leaf - WWASSERT(Front == NULL); - WWASSERT(Back == NULL); + WWASSERT(Front == nullptr); + WWASSERT(Back == nullptr); WWASSERT(Object_Count() == sc.FrontCount + sc.BackCount); int fcount = 0; @@ -1255,7 +1255,7 @@ void AABTreeNodeClass::Partition(const AABoxClass & bounds,SimpleDynVecClassParent = this; Front->Partition(sc.FrontBox,frontboxes); } else { - Front = NULL; + Front = nullptr; } /* @@ -1266,7 +1266,7 @@ void AABTreeNodeClass::Partition(const AABoxClass & bounds,SimpleDynVecClassParent = this; Back->Partition(sc.BackBox,backboxes); } else { - Back = NULL; + Back = nullptr; } } @@ -1473,7 +1473,7 @@ AABTreeIterator::AABTreeIterator(AABTreeCullSystemClass * tree) : Tree(tree), CurNodeIndex(0) { - WWASSERT(Tree != NULL); + WWASSERT(Tree != nullptr); } void AABTreeIterator::Reset(void) @@ -1507,7 +1507,7 @@ bool AABTreeIterator::Enter_Sibling(void) /* ** if our parent doesn't have two children, we don't have a sibling */ - if ((parent_front == NULL) || (parent_back == NULL)) { + if ((parent_front == nullptr) || (parent_back == nullptr)) { return false; } @@ -1533,7 +1533,7 @@ bool AABTreeIterator::Enter_Sibling(void) bool AABTreeIterator::Has_Front_Child(void) { validate(); - return (Tree->IndexedNodes[CurNodeIndex]->Front != NULL); + return (Tree->IndexedNodes[CurNodeIndex]->Front != nullptr); } bool AABTreeIterator::Enter_Front_Child(void) @@ -1549,7 +1549,7 @@ bool AABTreeIterator::Enter_Front_Child(void) bool AABTreeIterator::Has_Back_Child(void) { validate(); - return (Tree->IndexedNodes[CurNodeIndex]->Back != NULL); + return (Tree->IndexedNodes[CurNodeIndex]->Back != nullptr); } bool AABTreeIterator::Enter_Back_Child(void) diff --git a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h index 7d0928bc5a0..fb075825bf3 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h +++ b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h @@ -326,7 +326,7 @@ class AABTreeNodeClass : public AutoPoolClass class AABTreeLinkClass : public CullLinkClass, public AutoPoolClass { public: - AABTreeLinkClass(AABTreeCullSystemClass * system) : CullLinkClass(system),Node(NULL), NextObject(NULL) { } + AABTreeLinkClass(AABTreeCullSystemClass * system) : CullLinkClass(system),Node(nullptr), NextObject(nullptr) { } AABTreeNodeClass * Node; // partition node containing this object CullableClass * NextObject; // next object in the node diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp index 66e63353cd9..3a94671a51e 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp @@ -860,8 +860,8 @@ bool CollisionMath::Collide struct AABTIntersectStruct { AABTIntersectStruct(void) : - Box(NULL), - Tri(NULL) + Box(nullptr), + Tri(nullptr) { } diff --git a/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp b/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp index ad0a8354794..74287a28877 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp @@ -45,8 +45,8 @@ ** *************************************************************************/ CullableClass::CullableClass(void) : - CullLink(NULL), - NextCollected(NULL) + CullLink(nullptr), + NextCollected(nullptr) { CullBox.Init(Vector3(0,0,0),Vector3(1,1,1)); } @@ -56,7 +56,7 @@ CullableClass::~CullableClass(void) // the cull system that contains us is responsible for any culling link // so we better be out of it and it should have cleared our pointer before // we are deleted. - WWASSERT(CullLink == NULL); + WWASSERT(CullLink == nullptr); } void CullableClass::Set_Cull_Box(const AABoxClass & box,bool just_loaded) @@ -70,7 +70,7 @@ void CullableClass::Set_Cull_Box(const AABoxClass & box,bool just_loaded) // so you know you're in the right node of the culling system... if (!just_loaded) { CullSystemClass * sys = Get_Culling_System(); - if (sys != NULL) { + if (sys != nullptr) { sys->Update_Culling(this); } } @@ -88,7 +88,7 @@ CullSystemClass * CullableClass::Get_Culling_System(void) const if (CullLink) { return CullLink->Get_Culling_System(); } - return NULL; + return nullptr; } @@ -101,7 +101,7 @@ CullSystemClass * CullableClass::Get_Culling_System(void) const ** *************************************************************************/ CullSystemClass::CullSystemClass(void) : - CollectionHead(NULL) + CollectionHead(nullptr) { } @@ -118,10 +118,10 @@ CullableClass * CullSystemClass::Get_First_Collected_Object_Internal(void) CullableClass * CullSystemClass::Get_Next_Collected_Object_Internal(CullableClass * obj) { - if (obj != NULL) { + if (obj != nullptr) { return obj->NextCollected; } - return NULL; + return nullptr; } CullableClass * CullSystemClass::Peek_First_Collected_Object_Internal(void) @@ -131,20 +131,20 @@ CullableClass * CullSystemClass::Peek_First_Collected_Object_Internal(void) CullableClass * CullSystemClass::Peek_Next_Collected_Object_Internal(CullableClass * obj) { - if (obj != NULL) { + if (obj != nullptr) { return obj->NextCollected; } - return NULL; + return nullptr; } void CullSystemClass::Reset_Collection(void) { - CollectionHead = NULL; + CollectionHead = nullptr; } void CullSystemClass::Add_To_Collection(CullableClass * obj) { - WWASSERT(obj != NULL); + WWASSERT(obj != nullptr); obj->NextCollected = CollectionHead; CollectionHead = obj; } diff --git a/Core/Libraries/Source/WWVegas/WWMath/cullsys.h b/Core/Libraries/Source/WWVegas/WWMath/cullsys.h index 38a201d8ba4..0593de20441 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/cullsys.h +++ b/Core/Libraries/Source/WWVegas/WWMath/cullsys.h @@ -55,7 +55,7 @@ class CullLinkClass { public: WWINLINE CullLinkClass(CullSystemClass * system) { System = system; WWASSERT(System); } - virtual ~CullLinkClass(void) { WWASSERT(System == NULL); } + virtual ~CullLinkClass(void) { WWASSERT(System == nullptr); } WWINLINE void Set_Culling_System(CullSystemClass * sys) { System = sys; } WWINLINE CullSystemClass * Get_Culling_System(void) { return System; } @@ -106,7 +106,7 @@ class CullableClass : public RefCountClass ** Each object can be linked into various types of culling systems. ** Each culling system can use its own linkage data structure (derived ** from CullLinkClass) to keep track of the object. The CullData pointer - ** will point to one of the culling link objects and NULL + ** will point to one of the culling link objects and nullptr ** if its not in any system. */ CullLinkClass * CullLink; diff --git a/Core/Libraries/Source/WWVegas/WWMath/curve.cpp b/Core/Libraries/Source/WWVegas/WWMath/curve.cpp index 353fa6d22fe..1ad94705ae0 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/curve.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/curve.cpp @@ -142,10 +142,10 @@ void Curve3DClass::Get_Key(int i,Vector3 * set_point,float * set_t) { assert(i >= 0); assert(i < Keys.Count()); - if (set_point != NULL) { + if (set_point != nullptr) { *set_point = Keys[i].Point; } - if (set_t != NULL) { + if (set_t != nullptr) { *set_t = Keys[i].Time; } } @@ -385,13 +385,13 @@ void Curve1DClass::Get_Key(int i,float * set_point,float * set_t,unsigned int * { assert(i >= 0); assert(i < Keys.Count()); - if (set_point != NULL) { + if (set_point != nullptr) { *set_point = Keys[i].Point; } - if (set_t != NULL) { + if (set_t != nullptr) { *set_t = Keys[i].Time; } - if (extra != NULL) { + if (extra != nullptr) { *extra = Keys[i].Extra; } } diff --git a/Core/Libraries/Source/WWVegas/WWMath/curve.h b/Core/Libraries/Source/WWVegas/WWMath/curve.h index 6fdad67be3b..40838a54457 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/curve.h +++ b/Core/Libraries/Source/WWVegas/WWMath/curve.h @@ -116,7 +116,7 @@ class Curve1DClass : public PersistClass virtual bool Is_Looping(void); virtual void Set_Looping(bool onoff); virtual int Key_Count(void); - virtual void Get_Key(int i,float * set_point,float * set_t,unsigned int * extra=NULL); + virtual void Get_Key(int i,float * set_point,float * set_t,unsigned int * extra=nullptr); virtual void Set_Key(int i,float point,unsigned int extra=0); virtual int Add_Key(float point,float t,unsigned int extra=0); virtual void Remove_Key(int i); diff --git a/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp b/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp index b4289656c6f..9f8cf831c87 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp @@ -116,8 +116,8 @@ static inline CullableClass * get_next_object(CullableClass * obj) GridLinkClass::GridLinkClass(GridCullSystemClass * system) : CullLinkClass(system), GridAddress(-1), - Prev(NULL), - Next(NULL) + Prev(nullptr), + Next(nullptr) { } @@ -153,8 +153,8 @@ GridCullSystemClass::GridCullSystemClass(void) : MaxObjExtent(15), Origin(-100,-100,-100), CellDim(10,10,10), - Cells(NULL), - NoGridList(NULL), + Cells(nullptr), + NoGridList(nullptr), ObjCount(0), TerminationCellCount(TERMINATION_CELL_COUNT) { @@ -179,7 +179,7 @@ GridCullSystemClass::GridCullSystemClass(void) : GridCullSystemClass::~GridCullSystemClass(void) { delete Cells; - Cells = NULL; + Cells = nullptr; } @@ -477,7 +477,7 @@ void GridCullSystemClass::Re_Partition(const Vector3 & input_min,const Vector3 & */ CullableClass * obj; for ( obj = Get_First_Collected_Object_Internal(); - obj != NULL; + obj != nullptr; obj = Get_Next_Collected_Object_Internal(obj)) { link_object(obj); @@ -639,7 +639,7 @@ void GridCullSystemClass::Load(ChunkLoadClass & cload) */ CullableClass * obj; for ( obj = Get_First_Collected_Object_Internal(); - obj != NULL; + obj != nullptr; obj = Get_Next_Collected_Object_Internal(obj)) { link_object(obj); @@ -749,7 +749,7 @@ const GridCullSystemClass::StatsStruct & GridCullSystemClass::Get_Statistics(voi void GridCullSystemClass::Add_Object_Internal(CullableClass * obj) { WWASSERT(obj); - WWASSERT(obj->Get_Culling_System() == NULL); + WWASSERT(obj->Get_Culling_System() == nullptr); GridLinkClass * link = new GridLinkClass(this); obj->Set_Cull_Link(link); @@ -779,9 +779,9 @@ void GridCullSystemClass::Remove_Object_Internal(CullableClass * obj) GridLinkClass * link = (GridLinkClass *)obj->Get_Cull_Link(); unlink_object(obj); - link->Set_Culling_System(NULL); + link->Set_Culling_System(nullptr); delete link; - obj->Set_Cull_Link(NULL); + obj->Set_Cull_Link(nullptr); ObjCount--; obj->Release_Ref(); @@ -816,7 +816,7 @@ void GridCullSystemClass::link_object(CullableClass * obj,int address) WWASSERT(obj); WWASSERT(obj->Get_Culling_System() == this); GridLinkClass * link = (GridLinkClass *)obj->Get_Cull_Link(); - WWASSERT(link != NULL); + WWASSERT(link != nullptr); /* ** if obj cannot be inserted into the grid, add it to the NoGridList @@ -886,11 +886,11 @@ void GridCullSystemClass::link_object_to_list(CullableClass ** head,CullableClas ** Insert this object as the new head of the list. */ link->Next = *head; - link->Prev = NULL; + link->Prev = nullptr; - if (link->Next != NULL) { + if (link->Next != nullptr) { GridLinkClass * next_link = (GridLinkClass *)link->Next->Get_Cull_Link(); - WWASSERT(next_link != NULL); + WWASSERT(next_link != nullptr); next_link->Prev = obj; } @@ -952,8 +952,8 @@ void GridCullSystemClass::unlink_object_from_list(CullableClass ** head,Cullable next_link->Prev = link->Prev; } - link->Prev = NULL; - link->Next = NULL; + link->Prev = nullptr; + link->Next = nullptr; } @@ -965,7 +965,7 @@ void GridCullSystemClass::unlink_object_from_list(CullableClass ** head,Cullable *************************************************************************/ void GridCullSystemClass::collect_objects_in_leaf(const Vector3 & point,CullableClass * head) { - if (head != NULL) { + if (head != nullptr) { GridListIterator it(head); for (;!it.Is_Done(); it.Next()) { CullableClass * obj = it.Peek_Obj(); @@ -978,7 +978,7 @@ void GridCullSystemClass::collect_objects_in_leaf(const Vector3 & point,Cullable void GridCullSystemClass::collect_objects_in_leaf(const AABoxClass & box,CullableClass * head) { - if (head != NULL) { + if (head != nullptr) { GridListIterator it(head); for (;!it.Is_Done(); it.Next()) { CullableClass * obj = it.Peek_Obj(); @@ -991,7 +991,7 @@ void GridCullSystemClass::collect_objects_in_leaf(const AABoxClass & box,Cullabl void GridCullSystemClass::collect_objects_in_leaf(const OBBoxClass & obbox,CullableClass * head) { - if (head != NULL) { + if (head != nullptr) { GridListIterator it(head); for (;!it.Is_Done(); it.Next()) { CullableClass * obj = it.Peek_Obj(); @@ -1004,7 +1004,7 @@ void GridCullSystemClass::collect_objects_in_leaf(const OBBoxClass & obbox,Culla void GridCullSystemClass::collect_objects_in_leaf(const FrustumClass & frustum,CullableClass * head) { - if (head != NULL) { + if (head != nullptr) { GridListIterator it(head); for (;!it.Is_Done(); it.Next()) { CullableClass * obj = it.Peek_Obj(); diff --git a/Core/Libraries/Source/WWVegas/WWMath/gridcull.h b/Core/Libraries/Source/WWVegas/WWMath/gridcull.h index 18d9d9f8865..21f04907c12 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/gridcull.h +++ b/Core/Libraries/Source/WWVegas/WWMath/gridcull.h @@ -270,7 +270,7 @@ class GridListIterator void First(void) { CurObj = Head; } void Next(void) { if (CurObj) { CurObj = ((GridLinkClass *)CurObj->Get_Cull_Link())->Next; } } void Prev(void) { if (CurObj) { CurObj = ((GridLinkClass *)CurObj->Get_Cull_Link())->Prev; } } - bool Is_Done(void) { return (CurObj == NULL); } + bool Is_Done(void) { return (CurObj == nullptr); } CullableClass * Get_Obj(void) { if (CurObj) { CurObj->Add_Ref(); } return CurObj; } CullableClass * Peek_Obj(void) { return CurObj; } @@ -412,7 +412,7 @@ WWINLINE int GridCullSystemClass::total_cell_count(void) *=============================================================================================*/ WWINLINE void GridCullSystemClass::compute_box(int i,int j,int k,AABoxClass * set_box) { - WWASSERT(set_box != NULL); + WWASSERT(set_box != nullptr); WWASSERT((i >= 0) && (j >= 0) && (k >= 0)); WWASSERT((i < CellCount[0]) && (j < CellCount[1]) && (k < CellCount[2])); @@ -444,7 +444,7 @@ WWINLINE void GridCullSystemClass::compute_box(int i,int j,int k,AABoxClass * se *=============================================================================================*/ WWINLINE void GridCullSystemClass::compute_box(const GridCullSystemClass::VolumeStruct & vol, AABoxClass * set_box) { - WWASSERT(set_box != NULL); + WWASSERT(set_box != nullptr); WWASSERT((vol.Min[0] >= 0) && (vol.Min[1] >= 0) && (vol.Min[2] >= 0)); WWASSERT((vol.Max[0] <= CellCount[0]) && (vol.Max[1] <= CellCount[1]) && (vol.Max[2] <= CellCount[2])); diff --git a/Core/Libraries/Source/WWVegas/WWMath/lineseg.cpp b/Core/Libraries/Source/WWVegas/WWMath/lineseg.cpp index e5f4150d6ea..13ad6c35e17 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/lineseg.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/lineseg.cpp @@ -215,11 +215,11 @@ LineSegClass::Find_Intersection // // Return the fractions if they caller wants them // - if (fraction1 != NULL) { + if (fraction1 != nullptr) { (*fraction1) = length1 / Length; } - if (fraction2 != NULL) { + if (fraction2 != nullptr) { (*fraction2) = length2 / Length; } diff --git a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp index 139c782cfd9..72eb2fa9891 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp @@ -83,8 +83,8 @@ void LookupTableClass::Init(const char * name,Curve1DClass * curve) Name = name; // Store the min and max input values for the table - curve->Get_Key(0,NULL,&MinInputValue,NULL); - curve->Get_Key(curve->Key_Count()-1,NULL,&MaxInputValue,NULL); + curve->Get_Key(0,nullptr,&MinInputValue,nullptr); + curve->Get_Key(curve->Key_Count()-1,nullptr,&MaxInputValue,nullptr); OOMaxMinusMin = 1.0f / (MaxInputValue - MinInputValue); // Sample the curve and store the output values @@ -125,7 +125,7 @@ void LookupTableMgrClass::Shutdown(void) void LookupTableMgrClass::Reset(void) { - while (Tables.Peek_Head() != NULL) { + while (Tables.Peek_Head() != nullptr) { Tables.Release_Head(); } } @@ -151,7 +151,7 @@ LookupTableClass * LookupTableMgrClass::Get_Table(const char * name,bool try_to_ } // otherwise we can try to load it. - LookupTableClass * new_table = NULL; + LookupTableClass * new_table = nullptr; if (try_to_load) { FileClass * file = _TheFileFactory->Get_File(name); @@ -159,9 +159,9 @@ LookupTableClass * LookupTableMgrClass::Get_Table(const char * name,bool try_to_ ChunkLoadClass cload(file); - Curve1DClass * curve = NULL; + Curve1DClass * curve = nullptr; Load_Table_Desc(cload,&curve); - if (curve != NULL) { + if (curve != nullptr) { new_table = NEW_REF(LookupTableClass,()); new_table->Init(name,curve); Add_Table(new_table); @@ -206,7 +206,7 @@ void LookupTableMgrClass::Load_Table_Desc Vector2 * set_max_corner ) { - *curve_ptr = NULL; + *curve_ptr = nullptr; PersistFactoryClass * factory; float xmin,xmax; @@ -218,8 +218,8 @@ void LookupTableMgrClass::Load_Table_Desc case LOOKUPTABLE_CHUNK_CURVE: cload.Open_Chunk(); factory = SaveLoadSystemClass::Find_Persist_Factory(cload.Cur_Chunk_ID()); - WWASSERT(factory != NULL); - if (factory != NULL) { + WWASSERT(factory != nullptr); + if (factory != nullptr) { *curve_ptr = (Curve1DClass *)factory->Load(cload); } cload.Close_Chunk(); @@ -238,10 +238,10 @@ void LookupTableMgrClass::Load_Table_Desc cload.Close_Chunk(); } - if (set_min_corner != NULL) { + if (set_min_corner != nullptr) { set_min_corner->Set(xmin,ymin); } - if (set_max_corner != NULL) { + if (set_max_corner != nullptr) { set_max_corner->Set(xmax,ymax); } } diff --git a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h index c37923f4d7e..650095aff4e 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h +++ b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h @@ -143,8 +143,8 @@ class LookupTableMgrClass static void Load_Table_Desc( ChunkLoadClass & cload, Curve1DClass ** curve_ptr, - Vector2 * set_min = NULL, - Vector2 * set_max = NULL ); + Vector2 * set_min = nullptr, + Vector2 * set_max = nullptr ); static void Reset(void); diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp index e3c3c46c105..6e4cfab78d8 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp @@ -638,7 +638,7 @@ void Matrix3D::Copy_3x3_Matrix(float matrix[3][3]) void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res) { - assert(set_res != NULL); + assert(set_res != nullptr); Matrix3D tmp; Matrix3D * Aptr; @@ -695,7 +695,7 @@ void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res #if 0 void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res) { - assert(set_res != NULL); + assert(set_res != nullptr); float tmp[12]; // Check for aliased parameters, copy the 'A' matrix into a temporary if the diff --git a/Core/Libraries/Source/WWVegas/WWMath/obbox.h b/Core/Libraries/Source/WWVegas/WWMath/obbox.h index 4e3f7f141ce..bd1c87a85d7 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/obbox.h +++ b/Core/Libraries/Source/WWVegas/WWMath/obbox.h @@ -211,7 +211,7 @@ inline void OBBoxClass::Compute_Point(float params[3],Vector3 * set_point) const *=============================================================================================*/ inline void OBBoxClass::Compute_Axis_Aligned_Extent(Vector3 * set_extent) const { - WWASSERT(set_extent != NULL); + WWASSERT(set_extent != nullptr); // x extent is the box projected onto the x axis set_extent->X = WWMath::Fabs(Extent[0] * Basis[0][0]) + diff --git a/Core/Libraries/Source/WWVegas/WWMath/ode.cpp b/Core/Libraries/Source/WWVegas/WWMath/ode.cpp index 4889b11c554..2d32f805c13 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/ode.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/ode.cpp @@ -71,7 +71,7 @@ static StateVectorClass _WorkVector7; *=============================================================================================*/ void IntegrationSystem::Euler_Integrate(ODESystemClass * sys, float dt) { - WWASSERT(sys != NULL); + WWASSERT(sys != nullptr); /* ** Get the current state @@ -90,7 +90,7 @@ void IntegrationSystem::Euler_Integrate(ODESystemClass * sys, float dt) ** Euler method, just evaluate the derivative, multiply ** by the time-step and add to the current state vector. */ - sys->Compute_Derivatives(0,NULL,&dydt); + sys->Compute_Derivatives(0,nullptr,&dydt); Y1.Resize(Y0.Count()); for (int i = 0; i < Y0.Count(); i++) { @@ -139,7 +139,7 @@ void IntegrationSystem::Midpoint_Integrate(ODESystemClass * sys,float dt) ** MidPoint method, first evaluate the derivitives of the ** state vector just like the Euler method. */ - sys->Compute_Derivatives(0.0f,NULL,&dydt); + sys->Compute_Derivatives(0.0f,nullptr,&dydt); /* ** Compute the midpoint between the Euler solution and @@ -208,7 +208,7 @@ void IntegrationSystem::Runge_Kutta_Integrate(ODESystemClass * sys,float dt) /* ** First Step */ - sys->Compute_Derivatives(0.0f,NULL,&dydt); + sys->Compute_Derivatives(0.0f,nullptr,&dydt); for (i=0; iCompute_Derivatives(0.0f,NULL,&dydt); + odesys->Compute_Derivatives(0.0f,nullptr,&dydt); for (i=0;iX = (a.X + (b.X - a.X)*t); set_result->Y = (a.Y + (b.Y - a.Y)*t); } diff --git a/Core/Libraries/Source/WWVegas/WWMath/vector3.h b/Core/Libraries/Source/WWVegas/WWMath/vector3.h index efd75af2fd3..5f5339d33d1 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector3.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector3.h @@ -534,7 +534,7 @@ WWINLINE void Swap(Vector3 & a,Vector3 & b) *=============================================================================================*/ WWINLINE void Vector3::Lerp(const Vector3 & a, const Vector3 & b, float alpha,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = (a.X + (b.X - a.X)*alpha); set_result->Y = (a.Y + (b.Y - a.Y)*alpha); set_result->Z = (a.Z + (b.Z - a.Z)*alpha); @@ -564,7 +564,7 @@ WWINLINE Vector3 Vector3::Lerp(const Vector3 & a, const Vector3 & b, float alpha *=============================================================================================*/ WWINLINE void Vector3::Add(const Vector3 &a,const Vector3 &b,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = a.X + b.X; set_result->Y = a.Y + b.Y; set_result->Z = a.Z + b.Z; @@ -585,7 +585,7 @@ WWINLINE void Vector3::Add(const Vector3 &a,const Vector3 &b,Vector3 * set_resul *=============================================================================================*/ WWINLINE void Vector3::Subtract(const Vector3 &a,const Vector3 &b,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = a.X - b.X; set_result->Y = a.Y - b.Y; set_result->Z = a.Z - b.Z; diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactory.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactory.cpp index eb0def89256..9d556877719 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactory.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactory.cpp @@ -44,8 +44,8 @@ // ///////////////////////////////////////////////////////// DefinitionFactoryClass::DefinitionFactoryClass (void) - : m_NextFactory (0), - m_PrevFactory (0) + : m_NextFactory (nullptr), + m_PrevFactory (nullptr) { DefinitionFactoryMgrClass::Register_Factory (this); return ; diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactorymgr.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactorymgr.cpp index bf883471fc5..8cc6313026a 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactorymgr.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionfactorymgr.cpp @@ -45,7 +45,7 @@ //////////////////////////////////////////////////////////////////////////// // Static member initialization //////////////////////////////////////////////////////////////////////////// -DefinitionFactoryClass *DefinitionFactoryMgrClass::_FactoryListHead = 0; +DefinitionFactoryClass *DefinitionFactoryMgrClass::_FactoryListHead = nullptr; //////////////////////////////////////////////////////////////////////////// @@ -56,14 +56,14 @@ DefinitionFactoryClass *DefinitionFactoryMgrClass::_FactoryListHead = 0; DefinitionFactoryClass * DefinitionFactoryMgrClass::Find_Factory (uint32 class_id) { - DefinitionFactoryClass *factory = 0; + DefinitionFactoryClass *factory = nullptr; // // Loop through all the factories and see if we can // find the one who owns the corresponding class-id. // for ( DefinitionFactoryClass *curr_factory = _FactoryListHead; - (factory == 0) && (curr_factory != 0); + (factory == nullptr) && (curr_factory != nullptr); curr_factory = curr_factory->m_NextFactory) { // @@ -86,14 +86,14 @@ DefinitionFactoryMgrClass::Find_Factory (uint32 class_id) DefinitionFactoryClass * DefinitionFactoryMgrClass::Find_Factory (const char *name) { - DefinitionFactoryClass *factory = 0; + DefinitionFactoryClass *factory = nullptr; // // Loop through all the factories and see if we can // find the one who owns the corresponding class-id. // for ( DefinitionFactoryClass *curr_factory = _FactoryListHead; - (factory == 0) && (curr_factory != 0); + (factory == nullptr) && (curr_factory != nullptr); curr_factory = curr_factory->m_NextFactory) { // @@ -116,14 +116,14 @@ DefinitionFactoryMgrClass::Find_Factory (const char *name) DefinitionFactoryClass * DefinitionFactoryMgrClass::Get_First (uint32 superclass_id) { - DefinitionFactoryClass *factory = 0; + DefinitionFactoryClass *factory = nullptr; // // Loop through all the factories and see if we can // find the next one that belongs to the given superclass // for ( DefinitionFactoryClass *curr_factory = _FactoryListHead; - (factory == 0) && (curr_factory != 0); + (factory == nullptr) && (curr_factory != nullptr); curr_factory = curr_factory->m_NextFactory) { // @@ -150,13 +150,13 @@ DefinitionFactoryMgrClass::Get_Next uint32 superclass_id ) { - DefinitionFactoryClass *factory = 0; + DefinitionFactoryClass *factory = nullptr; // // Loop through all the factories and see if we can // find the next one that belongs to the given superclass // - while ((factory == NULL) && ((curr_factory = curr_factory->m_NextFactory) != NULL)) { + while ((factory == nullptr) && ((curr_factory = curr_factory->m_NextFactory) != nullptr)) { // // Is this the factory we were looking for? @@ -190,12 +190,12 @@ DefinitionFactoryMgrClass::Get_First (void) DefinitionFactoryClass * DefinitionFactoryMgrClass::Get_Next (DefinitionFactoryClass *curr_factory) { - DefinitionFactoryClass *factory = 0; + DefinitionFactoryClass *factory = nullptr; // // Simply return the next factory in the chain // - if (curr_factory != NULL) { + if (curr_factory != nullptr) { factory = curr_factory->m_NextFactory; } @@ -247,7 +247,7 @@ DefinitionFactoryMgrClass::Link_Factory (DefinitionFactoryClass *factory) factory->m_NextFactory = _FactoryListHead; // If the list wasn't empty, link the next factory back to this factory - if (factory->m_NextFactory != 0) { + if (factory->m_NextFactory != nullptr) { factory->m_NextFactory->m_PrevFactory = factory; } @@ -268,7 +268,7 @@ DefinitionFactoryMgrClass::Unlink_Factory (DefinitionFactoryClass *factory) WWASSERT(factory != 0); // Handle the factory's prev pointer: - if (factory->m_PrevFactory == 0) { + if (factory->m_PrevFactory == nullptr) { // this factory is the head WWASSERT (_FactoryListHead == factory); @@ -282,14 +282,14 @@ DefinitionFactoryMgrClass::Unlink_Factory (DefinitionFactoryClass *factory) } // Handle the factory's next pointer if its not at the end of the list: - if (factory->m_NextFactory != 0) { + if (factory->m_NextFactory != nullptr) { factory->m_NextFactory->m_PrevFactory = factory->m_PrevFactory; } // factory is now un-linked - factory->m_NextFactory = 0; - factory->m_PrevFactory = 0; + factory->m_NextFactory = nullptr; + factory->m_PrevFactory = nullptr; return ; } diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp index 056180c0031..be38c957e50 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp @@ -73,7 +73,7 @@ enum ////////////////////////////////////////////////////////////////////////////////// // Static member initialization ////////////////////////////////////////////////////////////////////////////////// -DefinitionClass ** DefinitionMgrClass::_SortedDefinitionArray = NULL; +DefinitionClass ** DefinitionMgrClass::_SortedDefinitionArray = nullptr; int DefinitionMgrClass::_DefinitionCount = 0; int DefinitionMgrClass::_MaxDefinitionCount = 0; HashTemplateClass*>* DefinitionMgrClass::DefinitionHash; @@ -108,7 +108,7 @@ DefinitionMgrClass::~DefinitionMgrClass (void) DefinitionClass * DefinitionMgrClass::Find_Definition (uint32 id, bool twiddle) { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; int lower_index = 0; int upper_index = _DefinitionCount - 1; @@ -121,7 +121,7 @@ DefinitionMgrClass::Find_Definition (uint32 id, bool twiddle) while (keep_going) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - WWASSERT (curr_def != NULL); + WWASSERT (curr_def != nullptr); // // Is this the definition we are looking for? @@ -162,7 +162,7 @@ DefinitionMgrClass::Find_Definition (uint32 id, bool twiddle) // framework for definitions) // if ( twiddle && - definition != NULL && + definition != nullptr && definition->Get_Class_ID () == CLASSID_TWIDDLERS) { definition = ((TwiddlerClass *)definition)->Twiddle (); @@ -180,7 +180,7 @@ DefinitionMgrClass::Find_Definition (uint32 id, bool twiddle) DefinitionClass * DefinitionMgrClass::Find_Named_Definition (const char *name, bool twiddle) { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; // // Loop through all the definitions and see if we can @@ -192,7 +192,7 @@ DefinitionMgrClass::Find_Named_Definition (const char *name, bool twiddle) // // Is this the definition we were looking for? // - if (curr_def != NULL && ::stricmp (curr_def->Get_Name (), name) == 0) { + if (curr_def != nullptr && ::stricmp (curr_def->Get_Name (), name) == 0) { definition = curr_def; break; } @@ -203,7 +203,7 @@ DefinitionMgrClass::Find_Named_Definition (const char *name, bool twiddle) // framework for definitions) // if ( twiddle && - definition != NULL && + definition != nullptr && definition->Get_Class_ID () == CLASSID_TWIDDLERS) { definition = ((TwiddlerClass *)definition)->Twiddle (); @@ -225,12 +225,12 @@ DefinitionMgrClass::Find_Typed_Definition (const char *name, uint32 class_id, bo // // Sanity check // - if (DefinitionHash == NULL) { - WWDEBUG_SAY (("DefinitionMgrClass::Find_Typed_Definition () failed due to a NULL DefinitionHash.")); - return NULL; + if (DefinitionHash == nullptr) { + WWDEBUG_SAY (("DefinitionMgrClass::Find_Typed_Definition () failed due to a null DefinitionHash.")); + return nullptr; } - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; // Check the hash table first. The hash table is built as we need the definitions, so if definition is not // in the table, it will be added there. @@ -238,7 +238,7 @@ DefinitionMgrClass::Find_Typed_Definition (const char *name, uint32 class_id, bo // // TSS null deref on this sucker 08/03/01 // - WWASSERT(DefinitionHash != NULL); + WWASSERT(DefinitionHash != nullptr); StringClass lower_case_name(name,true); _strlwr(lower_case_name.Peek_Buffer()); @@ -266,7 +266,7 @@ DefinitionMgrClass::Find_Typed_Definition (const char *name, uint32 class_id, bo if (!definition) { for (int index = 0; index < _DefinitionCount; index ++) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - if (curr_def != NULL) { + if (curr_def != nullptr) { // // Is this the correct class of definition? @@ -299,7 +299,7 @@ DefinitionMgrClass::Find_Typed_Definition (const char *name, uint32 class_id, bo // framework for definitions) // if ( twiddle && - definition != NULL && + definition != nullptr && definition->Get_Class_ID () == CLASSID_TWIDDLERS) { definition = ((TwiddlerClass *)definition)->Twiddle (); @@ -323,7 +323,7 @@ DefinitionMgrClass::List_Available_Definitions (void) WWDEBUG_SAY(("Available definitions:")); for (int index = 0; index < _DefinitionCount; index ++) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - if (curr_def != NULL) { + if (curr_def != nullptr) { WWDEBUG_SAY((" >%s<", curr_def->Get_Name ())); } } @@ -344,9 +344,9 @@ DefinitionMgrClass::List_Available_Definitions (int superclass_id) // Loop through all the definitions and print the definition name // WWDEBUG_SAY(("Available superclass definitions for 0x%8X:", superclass_id)); - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; for ( definition = Get_First (superclass_id, DefinitionMgrClass::ID_SUPERCLASS); - definition != NULL; + definition != nullptr; definition = Get_Next (definition, superclass_id, DefinitionMgrClass::ID_SUPERCLASS)) { WWDEBUG_SAY((" >%s<", definition->Get_Name ())); @@ -364,18 +364,18 @@ DefinitionMgrClass::List_Available_Definitions (int superclass_id) DefinitionClass * DefinitionMgrClass::Get_First (uint32 id, ID_TYPE type) { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; // // Loop through all the definitions and find the first // one that belongs to the requested class // for ( int index = 0; - (definition == NULL) && (index < _DefinitionCount); + (definition == nullptr) && (index < _DefinitionCount); index ++) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - if (curr_def != NULL) { + if (curr_def != nullptr) { // // Is this the definition we were looking for? @@ -407,18 +407,18 @@ DefinitionMgrClass::Get_Next ID_TYPE type ) { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; // // Loop through all the definitions and find the first // one that belongs to the requested class // for ( int index = curr_def->m_DefinitionMgrLink + 1; - (definition == NULL) && (index < _DefinitionCount); + (definition == nullptr) && (index < _DefinitionCount); index ++) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - if (curr_def != NULL) { + if (curr_def != nullptr) { // // Is this the definition we were looking for? @@ -445,8 +445,8 @@ DefinitionMgrClass::Get_Next DefinitionClass * DefinitionMgrClass::Get_Next (DefinitionClass *curr_def) { - WWASSERT (curr_def != NULL); - DefinitionClass *definition = NULL; + WWASSERT (curr_def != nullptr); + DefinitionClass *definition = nullptr; int index = curr_def->m_DefinitionMgrLink + 1; if (index < _DefinitionCount) { @@ -475,13 +475,13 @@ DefinitionMgrClass::Free_Definitions (void) } DefinitionHash->Remove_All(); delete DefinitionHash; - DefinitionHash=NULL; + DefinitionHash=nullptr; } // // Free the definition array // - if (_SortedDefinitionArray != NULL) { + if (_SortedDefinitionArray != nullptr) { // // Free each of the definition objects // @@ -489,7 +489,7 @@ DefinitionMgrClass::Free_Definitions (void) delete _SortedDefinitionArray[index]; } delete [] _SortedDefinitionArray; - _SortedDefinitionArray = NULL; + _SortedDefinitionArray = nullptr; _MaxDefinitionCount = 0; _DefinitionCount = 0; } @@ -538,8 +538,8 @@ DefinitionMgrClass::Prepare_Definition_Array (void) void DefinitionMgrClass::Register_Definition (DefinitionClass *definition) { - WWASSERT (definition != NULL); - if (definition != NULL && definition->m_DefinitionMgrLink == -1 && definition->Get_ID () != 0) { + WWASSERT (definition != nullptr); + if (definition != nullptr && definition->m_DefinitionMgrLink == -1 && definition->Get_ID () != 0) { // // Make sure the definition array is large enough // @@ -559,7 +559,7 @@ DefinitionMgrClass::Register_Definition (DefinitionClass *definition) while (keep_going) { DefinitionClass *curr_def = _SortedDefinitionArray[index]; - WWASSERT (curr_def != NULL); + WWASSERT (curr_def != nullptr); // // Check to make sure we aren't trying to register a definition @@ -634,7 +634,7 @@ DefinitionMgrClass::Unregister_Definition (DefinitionClass *definition) WWASSERT (definition != 0); //WWASSERT (definition->m_DefinitionMgrLink >= 0 && definition->m_DefinitionMgrLink < _DefinitionCount); - if (definition != NULL && definition->m_DefinitionMgrLink != -1) { + if (definition != nullptr && definition->m_DefinitionMgrLink != -1) { // // Re-index the definitions that come after this definition in the list @@ -644,7 +644,7 @@ DefinitionMgrClass::Unregister_Definition (DefinitionClass *definition) _SortedDefinitionArray[index]->m_DefinitionMgrLink = index; } - _SortedDefinitionArray[_DefinitionCount - 1] = NULL; + _SortedDefinitionArray[_DefinitionCount - 1] = nullptr; definition->m_DefinitionMgrLink = -1; _DefinitionCount --; } @@ -741,7 +741,7 @@ DefinitionMgrClass::Save_Objects // for (int index = 0; index < _DefinitionCount; index ++) { DefinitionClass *definition = _SortedDefinitionArray[index]; - if (definition != NULL && definition->Is_Save_Enabled ()) { + if (definition != nullptr && definition->Is_Save_Enabled ()) { // // Save this definition object @@ -789,10 +789,10 @@ DefinitionMgrClass::Load_Objects (ChunkLoadClass &cload) // Load this definition from the chunk (if possible) // PersistFactoryClass *factory = SaveLoadSystemClass::Find_Persist_Factory (cload.Cur_Chunk_ID ()); - if (factory != NULL) { + if (factory != nullptr) { DefinitionClass *definition = (DefinitionClass *)factory->Load (cload); - if (definition != NULL) { + if (definition != nullptr) { // // Add this definition to our array @@ -868,7 +868,7 @@ DefinitionMgrClass::Get_New_ID (uint32 class_id) // for (int index = 0; index < _DefinitionCount; index ++) { DefinitionClass *definition = _SortedDefinitionArray[index]; - if (definition != NULL) { + if (definition != nullptr) { // // Get this definition's ID @@ -888,7 +888,7 @@ DefinitionMgrClass::Get_New_ID (uint32 class_id) // ID range. // DefinitionClass *next_definition = _SortedDefinitionArray[index + 1]; - if (next_definition != NULL && next_definition->Get_ID () > (curr_id + 1)) { + if (next_definition != nullptr && next_definition->Get_ID () > (curr_id + 1)) { is_ok = true; } @@ -923,8 +923,8 @@ DefinitionMgrClass::fnCompareDefinitionsCallback const void *elem2 ) { - WWASSERT (elem1 != NULL); - WWASSERT (elem2 != NULL); + WWASSERT (elem1 != nullptr); + WWASSERT (elem2 != nullptr); DefinitionClass *definition1 = *((DefinitionClass **)elem1); DefinitionClass *definition2 = *((DefinitionClass **)elem2); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h index ade932edbd9..aad040c795f 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h @@ -168,7 +168,7 @@ DefinitionMgrClass::Contains_Data (void) const inline DefinitionClass * DefinitionMgrClass::Get_First (void) { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; if (_DefinitionCount > 0) { definition = _SortedDefinitionArray[0]; } diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/editable.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/editable.h index 059b5dcf9ac..446d9ee4886 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/editable.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/editable.h @@ -87,7 +87,7 @@ inline ParameterClass * EditableClass::Lock_Parameter (int i) { WWASSERT (0); - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////// diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.cpp index 534e0ada3bb..e8adf404bcf 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.cpp @@ -55,7 +55,7 @@ ParameterClass * ParameterClass::Construct (Type type, void *data, const char *name) { - ParameterClass *new_param = NULL; + ParameterClass *new_param = nullptr; switch (type) { case TYPE_INT: @@ -211,7 +211,7 @@ StringParameterClass::StringParameterClass (StringClass *string) // ///////////////////////////////////////////////////////////////////// StringParameterClass::StringParameterClass (const StringParameterClass &src) - : m_String (NULL) + : m_String (nullptr) { (*this) = src; return ; @@ -242,7 +242,7 @@ StringParameterClass::operator== (const StringParameterClass &src) { bool retval = false; - if (m_String != NULL && src.m_String != NULL && + if (m_String != nullptr && src.m_String != nullptr && (m_String->Compare (*(src.m_String)) == 0)) { retval = true; } @@ -294,8 +294,8 @@ StringParameterClass::Copy_Value (const ParameterClass &src) const char * StringParameterClass::Get_String (void) const { - const char * string = NULL; - if (m_String != NULL) { + const char * string = nullptr; + if (m_String != nullptr) { string = (*m_String); } return string; @@ -310,7 +310,7 @@ StringParameterClass::Get_String (void) const void StringParameterClass::Set_String (const char * string) { - if (m_String != NULL) { + if (m_String != nullptr) { Set_Modified (); (*m_String) = string; } @@ -536,7 +536,7 @@ EnumParameterClass::EnumParameterClass (int *value) // ///////////////////////////////////////////////////////////////////// EnumParameterClass::EnumParameterClass (const EnumParameterClass &src) - : m_Value (NULL) + : m_Value (nullptr) { (*this) = src; return ; @@ -570,7 +570,7 @@ EnumParameterClass::operator== (const EnumParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -652,7 +652,7 @@ EnumParameterClass::Add_Values (const char *first_name, int first_value, ...) // Get the string param // const char *name = va_arg (arg_list, const char *); - if (name == NULL) { + if (name == nullptr) { more_params = false; } else { @@ -694,7 +694,7 @@ PhysDefParameterClass::PhysDefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// PhysDefParameterClass::PhysDefParameterClass (const PhysDefParameterClass &src) - : m_Value (NULL) + : m_Value (nullptr) { (*this) = src; return ; @@ -725,7 +725,7 @@ PhysDefParameterClass::operator== (const PhysDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -792,7 +792,7 @@ ModelDefParameterClass::ModelDefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// ModelDefParameterClass::ModelDefParameterClass (const ModelDefParameterClass &src) - : m_Value (NULL) + : m_Value (nullptr) { (*this) = src; return ; @@ -823,7 +823,7 @@ ModelDefParameterClass::operator== (const ModelDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -890,7 +890,7 @@ DefParameterClass::DefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// DefParameterClass::DefParameterClass (const DefParameterClass &src) - : m_Value (NULL) + : m_Value (nullptr) { (*this) = src; return ; @@ -921,7 +921,7 @@ DefParameterClass::operator== (const DefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1024,7 +1024,7 @@ GenericDefParameterClass::operator== (const GenericDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1124,7 +1124,7 @@ GameObjDefParameterClass::operator== (const GameObjDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1194,7 +1194,7 @@ WeaponObjDefParameterClass::WeaponObjDefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// WeaponObjDefParameterClass::WeaponObjDefParameterClass (const WeaponObjDefParameterClass &src) - : GameObjDefParameterClass (NULL) + : GameObjDefParameterClass (nullptr) { (*this) = src; return ; @@ -1225,7 +1225,7 @@ WeaponObjDefParameterClass::operator== (const WeaponObjDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1295,7 +1295,7 @@ AmmoObjDefParameterClass::AmmoObjDefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// AmmoObjDefParameterClass::AmmoObjDefParameterClass (const AmmoObjDefParameterClass &src) - : GameObjDefParameterClass (NULL) + : GameObjDefParameterClass (nullptr) { (*this) = src; return ; @@ -1326,7 +1326,7 @@ AmmoObjDefParameterClass::operator== (const AmmoObjDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1396,7 +1396,7 @@ ExplosionObjDefParameterClass::ExplosionObjDefParameterClass (int *id) // ///////////////////////////////////////////////////////////////////// ExplosionObjDefParameterClass::ExplosionObjDefParameterClass (const ExplosionObjDefParameterClass &src) - : GameObjDefParameterClass (NULL) + : GameObjDefParameterClass (nullptr) { (*this) = src; return ; @@ -1427,7 +1427,7 @@ ExplosionObjDefParameterClass::operator== (const ExplosionObjDefParameterClass & { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1526,7 +1526,7 @@ SoundDefParameterClass::operator== (const SoundDefParameterClass &src) { bool retval = false; - if (m_Value != NULL && src.m_Value != NULL && + if (m_Value != nullptr && src.m_Value != nullptr && (*m_Value) == (*src.m_Value)) { retval = true; @@ -1579,8 +1579,8 @@ ScriptParameterClass::ScriptParameterClass (StringClass *name, StringClass *para // ///////////////////////////////////////////////////////////////////// ScriptParameterClass::ScriptParameterClass (const ScriptParameterClass &src) - : m_ScriptName (NULL), - m_ScriptParams (NULL) + : m_ScriptName (nullptr), + m_ScriptParams (nullptr) { (*this) = src; return ; @@ -1615,8 +1615,8 @@ ScriptParameterClass::operator== (const ScriptParameterClass &src) // // Data valid? // - if ( (m_ScriptName != NULL) && (src.m_ScriptName != NULL) && - (m_ScriptParams != NULL) && (src.m_ScriptParams != NULL)) + if ( (m_ScriptName != nullptr) && (src.m_ScriptName != nullptr) && + (m_ScriptParams != nullptr) && (src.m_ScriptParams != nullptr)) { // @@ -1684,7 +1684,7 @@ ScriptParameterClass::Copy_Value (const ParameterClass &src) DefIDListParameterClass::DefIDListParameterClass (DynamicVectorClass *list) : m_IDList (list), m_ClassID (0), - m_SelectedClassID (NULL) + m_SelectedClassID (nullptr) { return ; } @@ -1696,9 +1696,9 @@ DefIDListParameterClass::DefIDListParameterClass (DynamicVectorClass *list) // ///////////////////////////////////////////////////////////////////// DefIDListParameterClass::DefIDListParameterClass (const DefIDListParameterClass &src) - : m_IDList (NULL), + : m_IDList (nullptr), m_ClassID (0), - m_SelectedClassID (NULL) + m_SelectedClassID (nullptr) { (*this) = src; return ; @@ -1735,7 +1735,7 @@ DefIDListParameterClass::operator== (const DefIDListParameterClass &src) // // Data valid? // - if ((m_IDList != NULL) && (src.m_IDList != NULL)) + if ((m_IDList != nullptr) && (src.m_IDList != nullptr)) { // // Class IDs the same? @@ -1793,7 +1793,7 @@ DefIDListParameterClass::Copy_Value (const ParameterClass &src) m_ClassID = real_src.m_ClassID; (*m_IDList) = (*real_src.m_IDList); - if (m_SelectedClassID != NULL && real_src.m_SelectedClassID != NULL) { + if (m_SelectedClassID != nullptr && real_src.m_SelectedClassID != nullptr) { (*m_SelectedClassID) = (*real_src.m_SelectedClassID); } } @@ -1828,7 +1828,7 @@ ZoneParameterClass::ZoneParameterClass (OBBoxClass *box) // ///////////////////////////////////////////////////////////////////// ZoneParameterClass::ZoneParameterClass (const ZoneParameterClass &src) - : m_OBBox (NULL) + : m_OBBox (nullptr) { (*this) = src; return ; @@ -1863,7 +1863,7 @@ ZoneParameterClass::operator== (const ZoneParameterClass &src) // // Are the OBBoxes the same? // - if ((m_OBBox != NULL) && (src.m_OBBox != NULL)) { + if ((m_OBBox != nullptr) && (src.m_OBBox != nullptr)) { retval = (*m_OBBox) == (*src.m_OBBox); } @@ -1933,7 +1933,7 @@ FilenameListParameterClass::FilenameListParameterClass (DynamicVectorClassCount (); int count2 = src.m_FilenameList->Count (); @@ -2054,8 +2054,8 @@ ScriptListParameterClass::ScriptListParameterClass // ///////////////////////////////////////////////////////////////////// ScriptListParameterClass::ScriptListParameterClass (const ScriptListParameterClass &src) - : m_NameList (NULL), - m_ParamList (NULL) + : m_NameList (nullptr), + m_ParamList (nullptr) { (*this) = src; return ; @@ -2091,8 +2091,8 @@ ScriptListParameterClass::operator== (const ScriptListParameterClass &src) // // Data valid? // - if ( (m_NameList != NULL) && (src.m_NameList != NULL) && - (m_ParamList != NULL) && (src.m_ParamList != NULL)) + if ( (m_NameList != nullptr) && (src.m_NameList != nullptr) && + (m_ParamList != nullptr) && (src.m_ParamList != nullptr)) { retval = Are_Lists_Identical (*m_NameList, *(src.m_NameList)); retval &= Are_Lists_Identical (*m_ParamList, *(src.m_ParamList)); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h index 686bf88c292..ac2d337a127 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h @@ -115,7 +115,7 @@ class ParameterClass ////////////////////////////////////////////////////////////////////////////// // RTTI - virtual DefParameterClass * As_DefParameterClass (void) { return NULL; } + virtual DefParameterClass * As_DefParameterClass (void) { return nullptr; } // Type identification (see paramtypes.h in wwsaveload) virtual Type Get_Type (void) const = 0; @@ -159,7 +159,7 @@ class ParameterClass ////////////////////////////////////////////////////////////////////////////////// inline ParameterClass::ParameterClass (void) - : m_Name (NULL), + : m_Name (nullptr), IsModified (false) { return ; @@ -170,7 +170,7 @@ ParameterClass::ParameterClass (void) ////////////////////////////////////////////////////////////////////////////////// inline ParameterClass::ParameterClass (const ParameterClass &src) - : m_Name (NULL), + : m_Name (nullptr), IsModified (false) { (*this) = src; @@ -183,7 +183,7 @@ ParameterClass::ParameterClass (const ParameterClass &src) inline ParameterClass::~ParameterClass (void) { - Set_Name (NULL); + Set_Name (nullptr); return ; } @@ -213,12 +213,12 @@ ParameterClass::Get_Name (void) const inline void ParameterClass::Set_Name (const char *new_name) { - if (m_Name != NULL) { + if (m_Name != nullptr) { ::free ((void *)m_Name); - m_Name = NULL; + m_Name = nullptr; } - if (new_name != NULL) { + if (new_name != nullptr) { m_Name = ::strdup (new_name); } @@ -468,7 +468,7 @@ class EnumParameterClass : public ParameterClass StringClass name; int value; - _ENUM_VALUE (const char *_name=NULL, int _value=0) : name (_name), value (_value) {} + _ENUM_VALUE (const char *_name=nullptr, int _value=0) : name (_name), value (_value) {} bool operator== (const _ENUM_VALUE &) { return false; } bool operator!= (const _ENUM_VALUE &) { return true; } } ENUM_VALUE; diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h index 80ba4a737fb..98167b5701a 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h @@ -103,8 +103,8 @@ ParameterListClass::Add (void *data, const char *param_name, ParameterClass::Typ // // Add the new paramter object to our list // - WWASSERT (new_param != NULL); - if (new_param != NULL) { + WWASSERT (new_param != nullptr); + if (new_param != nullptr) { DynamicVectorClass::Add (new_param); } @@ -120,7 +120,7 @@ ParameterListClass::Add (ParameterClass *new_param) // // Add the new paramter object to our list // - if (new_param != NULL) { + if (new_param != nullptr) { DynamicVectorClass::Add (new_param); } diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.cpp index ca81e905c5f..9dc1283f98f 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.cpp @@ -39,7 +39,7 @@ #include "saveload.h" PersistFactoryClass::PersistFactoryClass(void) : - NextFactory(NULL) + NextFactory(nullptr) { SaveLoadSystemClass::Register_Persist_Factory(this); } diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.h index 0599936a178..d45822f80d3 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/persistfactory.h @@ -100,7 +100,7 @@ template PersistClass * SimplePersistFactoryClass::Load(ChunkLoadClass & cload) const { T * new_obj = W3DNEW T; - T * old_obj = NULL; + T * old_obj = nullptr; cload.Open_Chunk(); WWASSERT(cload.Cur_Chunk_ID() == SIMPLEFACTORY_CHUNKID_OBJPOINTER); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/pointerremap.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/pointerremap.cpp index 21dc60f1bf4..a8033d14e97 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/pointerremap.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/pointerremap.cpp @@ -111,10 +111,10 @@ void PointerRemapClass::Process_Request_Table(DynamicVectorClass } else { // Failed to re-map the pointer. - // warn the user, set pointer to NULL, reset index to the pre_search_index. + // warn the user, set pointer to null, reset index to the pre_search_index. // If this happens, things could be going very wrong. (find out why its happening!) pair_index = pre_search_index; - *request_table[pointer_index].PointerToRemap = NULL; + *request_table[pointer_index].PointerToRemap = nullptr; #ifdef WWDEBUG const char * file = request_table[pointer_index].File; int line = request_table[pointer_index].Line; diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp index 004d09544cb..d2b8011e76d 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp @@ -50,8 +50,8 @@ #include "systimer.h" -SaveLoadSubSystemClass * SaveLoadSystemClass::SubSystemListHead = NULL; -PersistFactoryClass * SaveLoadSystemClass::FactoryListHead = NULL; +SaveLoadSubSystemClass * SaveLoadSystemClass::SubSystemListHead = nullptr; +PersistFactoryClass * SaveLoadSystemClass::FactoryListHead = nullptr; SList SaveLoadSystemClass::PostLoadList; PointerRemapClass SaveLoadSystemClass::PointerRemapper; @@ -82,7 +82,7 @@ bool SaveLoadSystemClass::Load (ChunkLoadClass &cload,bool auto_post_load) SaveLoadStatus::Inc_Status_Count(); // Count the sub systems loaded SaveLoadSubSystemClass *sys = Find_Sub_System(cload.Cur_Chunk_ID ()); WWLOG_INTERMEDIATE("Find_Sub_System"); - if (sys != NULL) { + if (sys != nullptr) { //WWRELEASE_SAY((" Name: %s",sys->Name())); INIT_SUB_STATUS(sys->Name()); ok &= sys->Load(cload); @@ -99,7 +99,7 @@ bool SaveLoadSystemClass::Load (ChunkLoadClass &cload,bool auto_post_load) // Call PostLoad on each PersistClass that wanted post-load if (auto_post_load) { - Post_Load_Processing(NULL); + Post_Load_Processing(nullptr); } WWLOG_INTERMEDIATE("PostLoadProcessing"); @@ -134,14 +134,14 @@ bool SaveLoadSystemClass::Post_Load_Processing (void(*network_callback)(void)) void SaveLoadSystemClass::Register_Sub_System (SaveLoadSubSystemClass * sys) { - WWASSERT(sys != NULL); + WWASSERT(sys != nullptr); Link_Sub_System(sys); } void SaveLoadSystemClass::Unregister_Sub_System (SaveLoadSubSystemClass * sys) { - WWASSERT(sys != NULL); + WWASSERT(sys != nullptr); Unlink_Sub_System(sys); } @@ -150,7 +150,7 @@ SaveLoadSubSystemClass * SaveLoadSystemClass::Find_Sub_System (uint32 chunk_id) { // TODO: need a d-s that gives fast searching based on chunk_id!! SaveLoadSubSystemClass * sys; - for ( sys = SubSystemListHead; sys != NULL; sys = sys->NextSubSystem ) { + for ( sys = SubSystemListHead; sys != nullptr; sys = sys->NextSubSystem ) { if ( sys->Chunk_ID() == chunk_id ) { break; } @@ -160,13 +160,13 @@ SaveLoadSubSystemClass * SaveLoadSystemClass::Find_Sub_System (uint32 chunk_id) void SaveLoadSystemClass::Register_Persist_Factory(PersistFactoryClass * factory) { - WWASSERT(factory != NULL); + WWASSERT(factory != nullptr); Link_Factory(factory); } void SaveLoadSystemClass::Unregister_Persist_Factory(PersistFactoryClass * factory) { - WWASSERT(factory != NULL); + WWASSERT(factory != nullptr); Unlink_Factory(factory); } @@ -174,7 +174,7 @@ PersistFactoryClass * SaveLoadSystemClass::Find_Persist_Factory(uint32 chunk_id) { // TODO: need a d-s that gives fast searching based on chunk_id!! PersistFactoryClass * fact; - for ( fact = FactoryListHead; fact != NULL; fact = fact->NextFactory ) { + for ( fact = FactoryListHead; fact != nullptr; fact = fact->NextFactory ) { if ( fact->Chunk_ID() == chunk_id ) { break; } @@ -187,9 +187,9 @@ bool SaveLoadSystemClass::Is_Post_Load_Callback_Registered(PostLoadableClass * o // obsolete! bool retval = false; - SLNode *list_node = NULL; + SLNode *list_node = nullptr; for ( list_node = PostLoadList.Head(); - retval == false && list_node != NULL; + retval == false && list_node != nullptr; list_node = list_node->Next()) { retval = (list_node->Data() == obj); @@ -200,7 +200,7 @@ bool SaveLoadSystemClass::Is_Post_Load_Callback_Registered(PostLoadableClass * o void SaveLoadSystemClass::Register_Post_Load_Callback(PostLoadableClass * obj) { - WWASSERT(obj != NULL); + WWASSERT(obj != nullptr); if (!obj->Is_Post_Load_Registered()) { obj->Set_Post_Load_Registered(true); PostLoadList.Add_Head(obj); @@ -240,9 +240,9 @@ void SaveLoadSystemClass::Request_Ref_Counted_Pointer_Remap (RefCountClass **poi void SaveLoadSystemClass::Link_Sub_System(SaveLoadSubSystemClass * sys) { - WWASSERT(sys != NULL); - if (sys != NULL) { - WWASSERT(sys->NextSubSystem == NULL); // sys should never be registered twice! + WWASSERT(sys != nullptr); + if (sys != nullptr) { + WWASSERT(sys->NextSubSystem == nullptr); // sys should never be registered twice! sys->NextSubSystem = SubSystemListHead; SubSystemListHead = sys; } @@ -250,30 +250,30 @@ void SaveLoadSystemClass::Link_Sub_System(SaveLoadSubSystemClass * sys) void SaveLoadSystemClass::Unlink_Sub_System(SaveLoadSubSystemClass * sys) { - WWASSERT(sys != NULL); + WWASSERT(sys != nullptr); SaveLoadSubSystemClass * cursys = SubSystemListHead; - SaveLoadSubSystemClass * prev = NULL; + SaveLoadSubSystemClass * prev = nullptr; while (cursys != sys) { prev = cursys; cursys = cursys->NextSubSystem; } - if (prev == NULL) { + if (prev == nullptr) { SubSystemListHead = sys->NextSubSystem; } else { prev->NextSubSystem = sys->NextSubSystem; } - sys->NextSubSystem = NULL; + sys->NextSubSystem = nullptr; } void SaveLoadSystemClass::Link_Factory(PersistFactoryClass * fact) { - WWASSERT(fact != NULL); - if (fact != NULL) { - WWASSERT(fact->NextFactory == NULL); // factories should never be registered twice! + WWASSERT(fact != nullptr); + if (fact != nullptr) { + WWASSERT(fact->NextFactory == nullptr); // factories should never be registered twice! fact->NextFactory = FactoryListHead; FactoryListHead = fact; } @@ -281,23 +281,23 @@ void SaveLoadSystemClass::Link_Factory(PersistFactoryClass * fact) void SaveLoadSystemClass::Unlink_Factory(PersistFactoryClass * fact) { - WWASSERT(fact != NULL); + WWASSERT(fact != nullptr); PersistFactoryClass * curfact = FactoryListHead; - PersistFactoryClass * prev = NULL; + PersistFactoryClass * prev = nullptr; while (curfact != fact) { prev = curfact; curfact = curfact->NextFactory; } - if (prev == NULL) { + if (prev == nullptr) { FactoryListHead = fact->NextFactory; } else { prev->NextFactory = fact->NextFactory; } - fact->NextFactory = NULL; + fact->NextFactory = nullptr; } void Force_Link_WWSaveLoad (void) diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h index 05ac8b6e08e..7bb19a0e9e0 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h @@ -160,8 +160,8 @@ class SaveLoadSystemClass static void Register_Pointer (void *old_pointer, void *new_pointer); #ifdef WWDEBUG - static void Request_Pointer_Remap (void **pointer_to_convert,const char * file = NULL,int line = 0); - static void Request_Ref_Counted_Pointer_Remap (RefCountClass **pointer_to_convert,const char * file = NULL,int line = 0); + static void Request_Pointer_Remap (void **pointer_to_convert,const char * file = nullptr,int line = 0); + static void Request_Ref_Counted_Pointer_Remap (RefCountClass **pointer_to_convert,const char * file = nullptr,int line = 0); #else static void Request_Pointer_Remap (void **pointer_to_convert); static void Request_Ref_Counted_Pointer_Remap (RefCountClass **pointer_to_convert); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveloadsubsystem.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveloadsubsystem.cpp index d45322be8a1..831ef841d70 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveloadsubsystem.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveloadsubsystem.cpp @@ -40,7 +40,7 @@ SaveLoadSubSystemClass::SaveLoadSubSystemClass(void) : - NextSubSystem(NULL) + NextSubSystem(nullptr) { // All Sub-Systems are automatically registered with the SaveLoadSystem SaveLoadSystemClass::Register_Sub_System (this); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/twiddler.cpp b/Core/Libraries/Source/WWVegas/WWSaveLoad/twiddler.cpp index 8e782eb186a..87a5807cfe7 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/twiddler.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/twiddler.cpp @@ -105,7 +105,7 @@ TwiddlerClass::~TwiddlerClass (void) DefinitionClass * TwiddlerClass::Twiddle (void) const { - DefinitionClass *definition = NULL; + DefinitionClass *definition = nullptr; if (m_DefinitionList.Count () > 0) { @@ -134,13 +134,13 @@ TwiddlerClass::Twiddle (void) const PersistClass * TwiddlerClass::Create (void) const { - PersistClass *retval = NULL; + PersistClass *retval = nullptr; // // Pick a random definition // DefinitionClass *definition = Twiddle (); - if (definition != NULL) { + if (definition != nullptr) { // // Indirect the creation to the definition we randomly selected diff --git a/Core/Libraries/Source/WWVegas/WWStub/wwallocstub.cpp b/Core/Libraries/Source/WWVegas/WWStub/wwallocstub.cpp index d250ae52f1e..eb4ea7ec38d 100644 --- a/Core/Libraries/Source/WWVegas/WWStub/wwallocstub.cpp +++ b/Core/Libraries/Source/WWVegas/WWStub/wwallocstub.cpp @@ -17,6 +17,7 @@ */ // TheSuperHackers @build feliwir 15/04/2025 Simple allocator implementation useful for tools + #include "always.h" #include @@ -66,7 +67,7 @@ void operator delete[](void * p, const char *, int) void* createW3DMemPool(const char *poolName, int allocationSize) { - return NULL; + return nullptr; } void* allocateFromW3DMemPool(void* pool, int allocationSize) diff --git a/Core/Libraries/Source/WWVegas/WWStub/wwdebugstub.cpp b/Core/Libraries/Source/WWVegas/WWStub/wwdebugstub.cpp index 3103aff21c3..903b170c453 100644 --- a/Core/Libraries/Source/WWVegas/WWStub/wwdebugstub.cpp +++ b/Core/Libraries/Source/WWVegas/WWStub/wwdebugstub.cpp @@ -17,12 +17,13 @@ */ // TheSuperHackers @build feliwir 15/04/2025 Simple debug implementation useful for tools + #include "wwdebug.h" #include #include #include -char* TheCurrentIgnoreCrashPtr = NULL; +char* TheCurrentIgnoreCrashPtr = nullptr; #ifdef DEBUG_LOGGING diff --git a/Core/Libraries/Source/debug/debug_cmd.cpp b/Core/Libraries/Source/debug/debug_cmd.cpp index 019e2e3f7d4..d6d2f8526c4 100644 --- a/Core/Libraries/Source/debug/debug_cmd.cpp +++ b/Core/Libraries/Source/debug/debug_cmd.cpp @@ -263,7 +263,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, if (cur->io) { cur->io->Delete(); - cur->io=NULL; + cur->io=nullptr; } return true; } @@ -276,7 +276,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, return true; } - cur->io->Execute(dbg,argn>1?argv[1]:NULL,!normalMode,argn>1?argn-2:0,argv+2); + cur->io->Execute(dbg,argn>1?argv[1]:nullptr,!normalMode,argn>1?argn-2:0,argv+2); } return true; } @@ -366,7 +366,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, dbg.lastPatternEntry=cur; } else - dbg.lastPatternEntry=NULL; + dbg.lastPatternEntry=nullptr; } if (strcmp(cmd,"add") == 0) { diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index 77049750322..dd637d166a6 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -26,6 +26,7 @@ // // Debug class implementation ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include "internal.h" #include "internal_except.h" @@ -84,21 +85,21 @@ void Debug::PreStaticInit(void) atexit(StaticExit); // init vars - Instance.hrTranslators=NULL; + Instance.hrTranslators=nullptr; Instance.numHrTranslators=0; - Instance.firstIOFactory=NULL; - Instance.firstCmdGroup=NULL; + Instance.firstIOFactory=nullptr; + Instance.firstCmdGroup=nullptr; memset(Instance.frameHash,0,sizeof(Instance.frameHash)); - Instance.nextUnusedFrameHash=NULL; + Instance.nextUnusedFrameHash=nullptr; Instance.numAvailableFrameHash=0; - Instance.firstLogGroup=NULL; + Instance.firstLogGroup=nullptr; memset(Instance.ioBuffer,0,sizeof(Instance.ioBuffer)); Instance.curType=DebugIOInterface::StringType::MAX; *Instance.curSource=0; Instance.disableAssertsEtc=0; - Instance.curFrameEntry=NULL; - Instance.firstPatternEntry=NULL; - Instance.lastPatternEntry=NULL; + Instance.curFrameEntry=nullptr; + Instance.firstPatternEntry=nullptr; + Instance.lastPatternEntry=nullptr; *Instance.curCommandGroup=0; Instance.alwaysFlush=false; Instance.timeStamp=false; @@ -124,25 +125,25 @@ void Debug::PostStaticInit(void) /// exec dbgcmd file char ioBuffer[2048]; - GetModuleFileName(NULL,ioBuffer,sizeof(ioBuffer)); + GetModuleFileName(nullptr,ioBuffer,sizeof(ioBuffer)); char *q=strrchr(ioBuffer,'.'); if (q) strcpy(q,".dbgcmd"); - HANDLE h=CreateFile(ioBuffer,GENERIC_READ,0,NULL,OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL,NULL); + HANDLE h=CreateFile(ioBuffer,GENERIC_READ,0,nullptr,OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL,nullptr); if (h==INVALID_HANDLE_VALUE) - h=CreateFile("default.dbgcmd",GENERIC_READ,0,NULL,OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL,NULL); + h=CreateFile("default.dbgcmd",GENERIC_READ,0,nullptr,OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL,nullptr); if (h!=INVALID_HANDLE_VALUE) { char cmdBuffer[512]; unsigned long ioCur=0,ioUsed=0,cmdCur=0; - ReadFile(h,ioBuffer,sizeof(ioBuffer),&ioUsed,NULL); + ReadFile(h,ioBuffer,sizeof(ioBuffer),&ioUsed,nullptr); for (;;) { if (ioCur==ioUsed) { - ReadFile(h,ioBuffer,sizeof(ioBuffer),&ioUsed,NULL); + ReadFile(h,ioBuffer,sizeof(ioBuffer),&ioUsed,nullptr); ioCur=0; } if (ioCur==ioUsed||ioBuffer[ioCur]=='\n'||ioBuffer[ioCur]=='\r') @@ -177,7 +178,7 @@ void Debug::PostStaticInit(void) if (p!=q) { Instance.ExecCommand(p,q); - p=*q?q+1:NULL; + p=*q?q+1:nullptr; } } } @@ -213,7 +214,7 @@ void Debug::StaticExit(void) if (io->io) { io->io->Delete(); - io->io=NULL; + io->io=nullptr; } // and command group interfaces... @@ -221,7 +222,7 @@ void Debug::StaticExit(void) if (cmd->cmdif) { cmd->cmdif->Delete(); - cmd->cmdif=NULL; + cmd->cmdif=nullptr; } } @@ -304,7 +305,7 @@ Debug& Debug::AssertBegin(const char *file, int line, const char *expr) Instance.FlushOutput(); // set new output - __ASSERT(Instance.curFrameEntry==NULL); + __ASSERT(Instance.curFrameEntry==nullptr); Instance.curFrameEntry=Instance.GetFrameEntry(curStackFrame,FrameTypeAssert,file,line); if (Instance.curFrameEntry->status==NoSkip) { @@ -332,7 +333,7 @@ bool Debug::AssertDone(void) // did we have an active assertion? if (curType==DebugIOInterface::StringType::Assert) { - __ASSERT(curFrameEntry!=NULL); + __ASSERT(curFrameEntry!=nullptr); // hit info? if (curFrameEntry->hits>1) @@ -369,12 +370,12 @@ bool Debug::AssertDone(void) /// @todo replace MessageBox with custom dialog w/ 4 options: abort, skip 1, skip all, break // now display message, wait for user input - int result=MessageBox(NULL,help,"Assertion failed", + int result=MessageBox(nullptr,help,"Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONSTOP|MB_TASKMODAL|MB_SETFOREGROUND); switch(result) { case IDABORT: - curFrameEntry=NULL; + curFrameEntry=nullptr; exit(1); break; case IDIGNORE: @@ -419,7 +420,7 @@ bool Debug::AssertDone(void) } } - curFrameEntry=NULL; + curFrameEntry=nullptr; return false; } @@ -433,7 +434,7 @@ Debug& Debug::CheckBegin(const char *file, int line, const char *expr) Instance.FlushOutput(); // set new output - __ASSERT(Instance.curFrameEntry==NULL); + __ASSERT(Instance.curFrameEntry==nullptr); Instance.curFrameEntry=Instance.GetFrameEntry(curStackFrame,FrameTypeCheck,file,line); if (Instance.curFrameEntry->status==NoSkip) { @@ -461,7 +462,7 @@ bool Debug::CheckDone(void) // did we have an active check? if (curType==DebugIOInterface::StringType::Check) { - __ASSERT(curFrameEntry!=NULL); + __ASSERT(curFrameEntry!=nullptr); // hit info? if (curFrameEntry->hits>1) @@ -502,7 +503,7 @@ bool Debug::CheckDone(void) } } - curFrameEntry=NULL; + curFrameEntry=nullptr; return false; } @@ -517,7 +518,7 @@ Debug& Debug::LogBegin(const char *fileOrGroup) Instance.FlushOutput(); // set new output - __ASSERT(Instance.curFrameEntry==NULL); + __ASSERT(Instance.curFrameEntry==nullptr); Instance.curFrameEntry=Instance.GetFrameEntry(curStackFrame,FrameTypeLog,fileOrGroup,0); if (Instance.curFrameEntry->status==NoSkip) { @@ -545,7 +546,7 @@ bool Debug::LogDone(void) // we're not flushing here on intention! - curFrameEntry=NULL; + curFrameEntry=nullptr; return false; } @@ -559,7 +560,7 @@ Debug& Debug::CrashBegin(const char *file, int line) Instance.FlushOutput(); // set new output - __ASSERT(Instance.curFrameEntry==NULL); + __ASSERT(Instance.curFrameEntry==nullptr); Instance.curFrameEntry=Instance.GetFrameEntry(curStackFrame,FrameTypeAssert,file,line); if (Instance.curFrameEntry->status==NoSkip) { @@ -589,7 +590,7 @@ bool Debug::CrashDone(bool die) // did we have an active assertion? if (curType==DebugIOInterface::StringType::Crash) { - __ASSERT(curFrameEntry!=NULL); + __ASSERT(curFrameEntry!=nullptr); // hit info? if (curFrameEntry->hits>1) @@ -637,12 +638,12 @@ bool Debug::CrashDone(bool die) /// @todo replace MessageBox with custom dialog w/ 4 options: abort, skip 1, skip all, break // now display message, wait for user input - int result=MessageBox(NULL,help,"Crash hit", + int result=MessageBox(nullptr,help,"Crash hit", MB_ABORTRETRYIGNORE|MB_ICONSTOP|MB_TASKMODAL|MB_SETFOREGROUND); switch(result) { case IDABORT: - curFrameEntry=NULL; + curFrameEntry=nullptr; exit(1); break; case IDIGNORE: @@ -689,14 +690,14 @@ bool Debug::CrashDone(bool die) else #endif { - MessageBox(NULL,help,"Game crash", + MessageBox(nullptr,help,"Game crash", MB_OK|MB_ICONSTOP|MB_TASKMODAL|MB_SETFOREGROUND); - curFrameEntry=NULL; + curFrameEntry=nullptr; _exit(1); } } - curFrameEntry=NULL; + curFrameEntry=nullptr; return false; } @@ -709,7 +710,7 @@ Debug& Debug::operator<<(const char *str) // buffer large enough? if (!str) - str="[NULL]"; + str="[null]"; else if (!*str) return *this; @@ -846,7 +847,7 @@ Debug& Debug::operator<<(const void *ptr) (*this) << "0x" << _ultoa((unsigned long)ptr,help,16); } else - (*this) << "NULL"; + (*this) << "null"; return *this; } @@ -1024,8 +1025,8 @@ bool Debug::AddIOFactory(const char *io_id, const char *descr, DebugIOInterface* entry->ioID=io_id; entry->descr=descr; entry->factory=func; - entry->io=NULL; - entry->input=NULL; + entry->io=nullptr; + entry->input=nullptr; entry->inputAlloc=0; entry->inputUsed=0; @@ -1054,7 +1055,7 @@ bool Debug::AddCommands(const char *cmdgroup, DebugCmdInterface *cmdif) // allocate & init new list entry CmdInterfaceListEntry *entry=(CmdInterfaceListEntry *) DebugAllocMemory(sizeof(CmdInterfaceListEntry)); - entry->next=NULL; + entry->next=nullptr; entry->group=cmdgroup; entry->cmdif=cmdif; @@ -1141,7 +1142,7 @@ void Debug::Update(void) Debug::FrameHashEntry* Debug::AddFrameEntry(unsigned addr, unsigned type, const char *fileOrGroup, int line) { - __ASSERT(LookupFrame(addr)==NULL); + __ASSERT(LookupFrame(addr)==nullptr); // get new entry if (!numAvailableFrameHash) @@ -1166,12 +1167,12 @@ Debug::FrameHashEntry* Debug::AddFrameEntry(unsigned addr, unsigned type, { // must add to list of known logs, // store translated name - e->fileOrGroup=AddLogGroup(fileOrGroup,NULL); + e->fileOrGroup=AddLogGroup(fileOrGroup,nullptr); } else { // no, just add file name (without path though) - e->fileOrGroup=fileOrGroup?strrchr(fileOrGroup,'\\'):NULL; + e->fileOrGroup=fileOrGroup?strrchr(fileOrGroup,'\\'):nullptr; e->fileOrGroup=e->fileOrGroup?e->fileOrGroup+1:fileOrGroup; } @@ -1348,7 +1349,7 @@ void Debug::FlushOutput(bool defaultLog) cur->io->Write(curType,curSource,ioBuffer[curType].buffer); if (alwaysFlush) - cur->io->Write(curType,curSource,NULL); + cur->io->Write(curType,curSource,nullptr); } // written nowhere? @@ -1357,11 +1358,11 @@ void Debug::FlushOutput(bool defaultLog) #ifdef HAS_LOGS // then force output to a very simple default log file // (non-Release builds only) - HANDLE h=CreateFile("default.log",GENERIC_WRITE,0,NULL, - OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - SetFilePointer(h,0,NULL,FILE_END); + HANDLE h=CreateFile("default.log",GENERIC_WRITE,0,nullptr, + OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,nullptr); + SetFilePointer(h,0,nullptr,FILE_END); DWORD dwDummy; - WriteFile(h,ioBuffer[curType].buffer,strlen(ioBuffer[curType].buffer),&dwDummy,NULL); + WriteFile(h,ioBuffer[curType].buffer,strlen(ioBuffer[curType].buffer),&dwDummy,nullptr); CloseHandle(h); #endif } @@ -1382,7 +1383,7 @@ void Debug::AddPatternEntry(unsigned types, bool isActive, const char *pattern) DebugAllocMemory(sizeof(PatternListEntry)); // init - cur->next=NULL; + cur->next=nullptr; cur->frameTypes=types; cur->isActive=isActive; cur->pattern=(char *)DebugAllocMemory(strlen(pattern)+1); @@ -1464,7 +1465,7 @@ void Debug::ExecCommand(const char *cmdstart, const char *cmdend) // just dropping the excess arguments char *parts[100]; int numParts=0; - char *lastNonWhitespace=NULL; + char *lastNonWhitespace=nullptr; char *cur=strbuf; // regular reply or structured reply? @@ -1504,7 +1505,7 @@ void Debug::ExecCommand(const char *cmdstart, const char *cmdend) { if (numParts0; // find main app window - HWND appHWnd=NULL; + HWND appHWnd=nullptr; EnumThreadWindows(GetCurrentThreadId(),EnumThreadWndProc,(LPARAM)&appHWnd); if (!appHWnd) { diff --git a/Core/Libraries/Source/debug/debug_debug.h b/Core/Libraries/Source/debug/debug_debug.h index 956fa6f2299..02deada8f42 100644 --- a/Core/Libraries/Source/debug/debug_debug.h +++ b/Core/Libraries/Source/debug/debug_debug.h @@ -365,7 +365,7 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); \param file file that contains DASSERT or DASSERT_MSG macro \param line line where assert macro can be found - \param expr expression that triggered the assertion, NULL for 'general failure' (\ref DFAIL) + \param expr expression that triggered the assertion, nullptr for 'general failure' (\ref DFAIL) \return reference to Debug instance */ static Debug &AssertBegin(const char *file, int line, const char *expr); @@ -439,7 +439,7 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); Starts building the crash string which will then be send to the active output destinations. - \param file file that contains DCRASH or DCRASH_RELEASE macro, if NULL + \param file file that contains DCRASH or DCRASH_RELEASE macro, if nullptr then no file info is given (used by DCRASH_RELEASE in release builds) \param line line where crash macro can be found, 0 if no line info should @@ -823,7 +823,7 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); /// factory function DebugIOInterface* (*factory)(void); - /// I/O interface (may be NULL) + /// I/O interface (may be null) DebugIOInterface *io; /// input buffer @@ -1040,7 +1040,7 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); Returns translated group name. \param fileOrGroup file or log group - \param descr description, may be NULL + \param descr description, may be nullptr \return translated log group name */ const char *AddLogGroup(const char *fileOrGroup, const char *descr); diff --git a/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp b/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp index c1e7c164570..2a0645f4592 100644 --- a/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp +++ b/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp @@ -138,7 +138,7 @@ BOOL CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) hf=CreateFont(13,0,0,0,FW_NORMAL, FALSE,FALSE,FALSE,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,NULL); + DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,nullptr); SendDlgItemMessage(hWnd,105,WM_SETFONT,(WPARAM)hf,MAKELPARAM(TRUE,0)); SendDlgItemMessage(hWnd,105,LB_ADDSTRING,0,(LPARAM)"EAX:0x00000666 EBX:0x7ffdf000 ECX:0x00000000"); SendDlgItemMessage(hWnd,105,LB_ADDSTRING,0,(LPARAM)"EDX:0x00422208 ESI:0x02100210 EDI:0x0012fec4"); @@ -180,7 +180,7 @@ int CALLBACK WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int) { // show dialog box first InitCommonControls(); - DialogBox(hInst,MAKEINTRESOURCE(100),NULL,DialogProc); + DialogBox(hInst,MAKEINTRESOURCE(100),nullptr,DialogProc); // write out resource data (if possible) FILE *f=fopen("..\\rc_exception.inl","wt"); diff --git a/Core/Libraries/Source/debug/debug_except.cpp b/Core/Libraries/Source/debug/debug_except.cpp index 098e1b9bf81..49df2d86be5 100644 --- a/Core/Libraries/Source/debug/debug_except.cpp +++ b/Core/Libraries/Source/debug/debug_except.cpp @@ -235,7 +235,7 @@ static BOOL CALLBACK ExceptionDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA SendDlgItemMessage(hWnd,105,WM_SETFONT,(WPARAM)CreateFont(13,0,0,0,FW_NORMAL, FALSE,FALSE,FALSE,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,NULL),MAKELPARAM(TRUE,0)); + DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,nullptr),MAKELPARAM(TRUE,0)); // exception type SendDlgItemMessage(hWnd,100,WM_SETTEXT,0,(LPARAM) @@ -324,19 +324,19 @@ static BOOL CALLBACK ExceptionDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA ListView_SetItem(list,&item); item.iSubItem++; - item.pszText=strtok(NULL,","); + item.pszText=strtok(nullptr,","); ListView_SetItem(list,&item); item.iSubItem++; - item.pszText=strtok(NULL,","); + item.pszText=strtok(nullptr,","); ListView_SetItem(list,&item); item.iSubItem++; - item.pszText=strtok(NULL,":"); + item.pszText=strtok(nullptr,":"); ListView_SetItem(list,&item); item.iSubItem++; - item.pszText=strtok(NULL,""); + item.pszText=strtok(nullptr,""); ListView_SetItem(list,&item); } } @@ -350,7 +350,7 @@ LONG __stdcall DebugExceptionhandler::ExceptionFilter(struct _EXCEPTION_POINTERS static bool inExceptionFilter; if (inExceptionFilter) { - MessageBox(NULL,"Exception in exception handler","Fatal error",MB_OK); + MessageBox(nullptr,"Exception in exception handler","Fatal error",MB_OK); return EXCEPTION_CONTINUE_SEARCH; } inExceptionFilter=true; @@ -411,7 +411,7 @@ LONG __stdcall DebugExceptionhandler::ExceptionFilter(struct _EXCEPTION_POINTERS // Show a dialog box InitCommonControls(); exPtrs=pExPtrs; - DialogBoxIndirect(NULL,(LPDLGTEMPLATE)rcException,NULL,ExceptionDlgProc); + DialogBoxIndirect(NULL,(LPDLGTEMPLATE)rcException,nullptr,ExceptionDlgProc); // Now die return EXCEPTION_EXECUTE_HANDLER; diff --git a/Core/Libraries/Source/debug/debug_internal.cpp b/Core/Libraries/Source/debug/debug_internal.cpp index 0f610562327..91ce90f1429 100644 --- a/Core/Libraries/Source/debug/debug_internal.cpp +++ b/Core/Libraries/Source/debug/debug_internal.cpp @@ -26,6 +26,7 @@ // // Implementation of internal code ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include @@ -35,7 +36,7 @@ void DebugInternalAssert(const char *file, int line, const char *expr) // module only we know how long stuff can get char buf[512]; wsprintf(buf,"File %s, line %i:\n%s",file,line,expr); - MessageBox(NULL,buf,"Internal assert failed", + MessageBox(nullptr,buf,"Internal assert failed", MB_OK|MB_ICONSTOP|MB_TASKMODAL|MB_SETFOREGROUND); // stop right now! @@ -52,15 +53,15 @@ void *DebugAllocMemory(unsigned numBytes) void *DebugReAllocMemory(void *oldPtr, unsigned newSize) { - // Windows doesn't like ReAlloc with NULL handle/ptr... + // Windows doesn't like ReAlloc with null handle/ptr... if (!oldPtr) - return newSize?DebugAllocMemory(newSize):0; + return newSize?DebugAllocMemory(newSize):nullptr; // Shrinking to 0 size is basically freeing memory if (!newSize) { GlobalFree((HGLOBAL)oldPtr); - return 0; + return nullptr; } // now try GlobalReAlloc first diff --git a/Core/Libraries/Source/debug/debug_io.h b/Core/Libraries/Source/debug/debug_io.h index f1d14a7ec5e..47a0681008f 100644 --- a/Core/Libraries/Source/debug/debug_io.h +++ b/Core/Libraries/Source/debug/debug_io.h @@ -106,19 +106,19 @@ class DebugIOInterface \brief Write out some characters differentiated by the log string type. \param type possible string type - \param src string source, may be NULL, content depends on type: + \param src string source, may be nullptr, content depends on type: - + - +
typesrc
Assertfile(line)
Checkfile(line)
Loglog group
Crashfile(line)
ExceptionNULL
Exceptionnullptr
CmdReplygroup.command
StructuredCmdReplygroup.command
OtherNULLOthernullptr
- \param str string to output, NUL delimited, if NULL then simply flush + \param str string to output, NUL delimited, if nullptr then simply flush output (if applicable) */ virtual void Write(StringType type, const char *src, const char *str)=0; diff --git a/Core/Libraries/Source/debug/debug_io_con.cpp b/Core/Libraries/Source/debug/debug_io_con.cpp index 0b9c2d605e7..bbd3d07974a 100644 --- a/Core/Libraries/Source/debug/debug_io_con.cpp +++ b/Core/Libraries/Source/debug/debug_io_con.cpp @@ -26,6 +26,7 @@ // // Debug I/O class con (console window) ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include "internal.h" #include "internal_io.h" @@ -59,7 +60,7 @@ DebugIOCon::DebugIOCon(void): ci.bVisible=FALSE; SetConsoleCursorInfo(h,&ci); - Write(StringType::Other,NULL,"\n\nEA/Debug console open\n\n"); + Write(StringType::Other,nullptr,"\n\nEA/Debug console open\n\n"); } } @@ -188,7 +189,7 @@ void DebugIOCon::Write(StringType type, const char *src, const char *str) return; DWORD dwDummy; - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),str,strlen(str),&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),str,strlen(str),&dwDummy,nullptr); } void DebugIOCon::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, diff --git a/Core/Libraries/Source/debug/debug_io_flat.cpp b/Core/Libraries/Source/debug/debug_io_flat.cpp index 7e7d00ca63c..35348073535 100644 --- a/Core/Libraries/Source/debug/debug_io_flat.cpp +++ b/Core/Libraries/Source/debug/debug_io_flat.cpp @@ -26,6 +26,7 @@ // // Debug I/O class flat (flat or split log file) ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include "debug_io.h" #include "internal.h" @@ -46,9 +47,9 @@ DebugIOFlat::OutputStream::OutputStream(const char *filename, unsigned maxSize): m_buffer=(char *)DebugAllocMemory(m_bufferSize); if (!m_limitedFileSize) - m_fileHandle=CreateFile(m_fileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS, + m_fileHandle=CreateFile(m_fileName,GENERIC_WRITE,0,nullptr,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, - NULL); + nullptr); } DebugIOFlat::OutputStream::~OutputStream() @@ -173,22 +174,22 @@ void DebugIOFlat::OutputStream::Flush(void) { // simple flush to file DWORD written; - WriteFile(m_fileHandle,m_buffer,m_bufferUsed,&written,NULL); + WriteFile(m_fileHandle,m_buffer,m_bufferUsed,&written,nullptr); m_bufferUsed=0; } else { // create file, write ring buffer - m_fileHandle=CreateFile(m_fileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS, + m_fileHandle=CreateFile(m_fileName,GENERIC_WRITE,0,nullptr,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, - NULL); + nullptr); DWORD written; if (m_bufferUsednext; DebugFreeMemory(kill); } - m_firstSplit=NULL; + m_firstSplit=nullptr; for (StreamListEntry *stream=m_firstStream;stream;) { @@ -414,15 +415,15 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, else if (strcmp(cmd,"add") == 0) { // add [ [ ] ] - __ASSERT(m_firstStream==NULL); + __ASSERT(m_firstStream==nullptr); strlcpy(m_baseFilename, argn?argv[0]:"*eMN", ARRAY_SIZE(m_baseFilename)); char fn[256]; - ExpandMagic(m_baseFilename,NULL,fn); + ExpandMagic(m_baseFilename,nullptr,fn); m_firstStream=(StreamListEntry *)DebugAllocMemory(sizeof(StreamListEntry)); - m_firstStream->next=NULL; + m_firstStream->next=nullptr; m_firstStream->stream=OutputStream::Create(fn,argn>1?atoi(argv[1])*1024:0); m_lastStreamPtr=&m_firstStream->next; } @@ -476,7 +477,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, { // must create new stream stream=(StreamListEntry *)DebugAllocMemory(sizeof(StreamListEntry)); - stream->next=NULL; + stream->next=nullptr; *m_lastStreamPtr=stream; m_lastStreamPtr=&stream->next; stream->stream=OutputStream::Create(fn,argn>3?atoi(argv[3])*1024:0); @@ -532,7 +533,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, m_firstSplit=cur; } else - m_firstSplit=NULL; + m_firstSplit=nullptr; } } diff --git a/Core/Libraries/Source/debug/debug_io_net.cpp b/Core/Libraries/Source/debug/debug_io_net.cpp index 52e31661021..37ecc4c1669 100644 --- a/Core/Libraries/Source/debug/debug_io_net.cpp +++ b/Core/Libraries/Source/debug/debug_io_net.cpp @@ -26,6 +26,7 @@ // // Debug I/O class net (Network destination via named pipe) ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include "internal.h" #include "internal_io.h" @@ -48,13 +49,13 @@ int DebugIONet::Read(char *buf, int maxchar) return 0; DWORD mode=PIPE_READMODE_MESSAGE|PIPE_NOWAIT; - SetNamedPipeHandleState(m_pipe,&mode,NULL,NULL); + SetNamedPipeHandleState(m_pipe,&mode,nullptr,nullptr); DWORD read; - if (!ReadFile(m_pipe,buf,maxchar-1,&read,NULL)) + if (!ReadFile(m_pipe,buf,maxchar-1,&read,nullptr)) read=0; mode=PIPE_READMODE_MESSAGE|PIPE_WAIT; - SetNamedPipeHandleState(m_pipe,&mode,NULL,NULL); + SetNamedPipeHandleState(m_pipe,&mode,nullptr,nullptr); return read; } @@ -65,18 +66,18 @@ void DebugIONet::Write(StringType type, const char *src, const char *str) return; DWORD dummy; - WriteFile(m_pipe,&type,1,&dummy,NULL); + WriteFile(m_pipe,&type,1,&dummy,nullptr); unsigned len; len=src?strlen(src):0; - WriteFile(m_pipe,&len,4,&dummy,NULL); + WriteFile(m_pipe,&len,4,&dummy,nullptr); if (len) - WriteFile(m_pipe,src,len,&dummy,NULL); + WriteFile(m_pipe,src,len,&dummy,nullptr); len=strlen(str); - WriteFile(m_pipe,&len,4,&dummy,NULL); + WriteFile(m_pipe,&len,4,&dummy,nullptr); if (len) - WriteFile(m_pipe,str,len,&dummy,NULL); + WriteFile(m_pipe,str,len,&dummy,nullptr); } void DebugIONet::EmergencyFlush(void) @@ -99,7 +100,7 @@ void DebugIONet::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, char buf[256]; wsprintf(buf,"\\\\%s\\pipe\\ea_debug_v1",machine); m_pipe=CreateFile(buf,GENERIC_READ|GENERIC_WRITE, - 0,NULL,OPEN_EXISTING,0,NULL); + 0,nullptr,OPEN_EXISTING,0,nullptr); if (m_pipe==INVALID_HANDLE_VALUE) { dbg << "Could not connect to given machine.\n"; @@ -108,14 +109,14 @@ void DebugIONet::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, // we're reading messages DWORD mode=PIPE_READMODE_MESSAGE; - SetNamedPipeHandleState(m_pipe,&mode,NULL,NULL); + SetNamedPipeHandleState(m_pipe,&mode,nullptr,nullptr); // write welcome message char comp[128]; mode=sizeof(comp); GetComputerName(comp,&mode); wsprintf(buf,"Client at %s\n",comp); - Write(Other,NULL,buf); + Write(Other,nullptr,buf); } } diff --git a/Core/Libraries/Source/debug/debug_macro.h b/Core/Libraries/Source/debug/debug_macro.h index b4b0f074008..1b95706b7cb 100644 --- a/Core/Libraries/Source/debug/debug_macro.h +++ b/Core/Libraries/Source/debug/debug_macro.h @@ -153,7 +153,7 @@ if (!DCHECK_MSG(!(cond),msg)) \endcode so it can be used e.g. like this: \code -DFAIL_IF_MSG(!ptrval,"pointer must not be NULL") return; +DFAIL_IF_MSG(!ptrval,"pointer must not be null") return; \endcode \param cond condition which is checked for failure @@ -328,7 +328,7 @@ DFAIL_IF_MSG(!ptrval,"pointer must not be NULL") return; (Debug::SkipNext(),(Debug::CrashBegin(__FILE__,__LINE__) << msg).CrashDone(true)) #define DFAIL() \ - Debug::AssertBegin(__FILE__,__LINE__,NULL).AssertDone() + Debug::AssertBegin(__FILE__,__LINE__,nullptr).AssertDone() #define D_ISLOG() \ Debug::IsLogEnabled(__FILE__) @@ -349,7 +349,7 @@ DFAIL_IF_MSG(!ptrval,"pointer must not be NULL") return; #define DLOG_GROUP(group,what) ((void)0) #define DLOG_GROUP_DESCR(g,d) #define DCRASH(msg) ((void)0) - #define DCRASH_RELEASE(msg) (Debug::SkipNext(),(Debug::CrashBegin(NULL,0) << msg).CrashDone(true)) + #define DCRASH_RELEASE(msg) (Debug::SkipNext(),(Debug::CrashBegin(nullptr,0) << msg).CrashDone(true)) #define DFAIL() ((void)0) #define D_ISLOG() false #define D_ISLOG_GROUP(group) false diff --git a/Core/Libraries/Source/debug/debug_stack.cpp b/Core/Libraries/Source/debug/debug_stack.cpp index 58645661339..50016506e1a 100644 --- a/Core/Libraries/Source/debug/debug_stack.cpp +++ b/Core/Libraries/Source/debug/debug_stack.cpp @@ -26,6 +26,7 @@ // // Stack walker ////////////////////////////////////////////////////////////////////////////// + #include "debug.h" #include "debug_stack.h" #include @@ -53,7 +54,7 @@ static union static char const *const DebughelpFunctionNames[] = { #include "debug_stack.inl" - NULL + nullptr }; #undef DBGHELP @@ -71,7 +72,7 @@ static void InitDbghelp(void) // firstly check for dbghelp.dll in the EXE directory char dbgHelpPath[256]; - if (GetModuleFileName(NULL,dbgHelpPath,sizeof(dbgHelpPath))) + if (GetModuleFileName(nullptr,dbgHelpPath,sizeof(dbgHelpPath))) { char *slash=strrchr(dbgHelpPath,'\\'); if (slash) @@ -100,7 +101,7 @@ static void InitDbghelp(void) { // not all functions found -> clear them all while (funcptr!=gDbg.funcPtr) - *--funcptr=NULL; + *--funcptr=0; } else { @@ -108,7 +109,7 @@ static void InitDbghelp(void) gDbg._SymSetOptions(gDbg._SymGetOptions()|SYMOPT_DEFERRED_LOADS|SYMOPT_LOAD_LINES); // Init module - gDbg._SymInitialize((HANDLE)GetCurrentProcessId(),NULL,TRUE); + gDbg._SymInitialize((HANDLE)GetCurrentProcessId(),nullptr,TRUE); // Check: are we using a newer version of dbghelp.dll? // (older versions have some serious issues.. err... bugs) @@ -380,7 +381,7 @@ int DebugStackwalk::StackWalk(Signature &sig, struct _CONTEXT *ctx) bool skipFirst=!ctx; while (sig.m_numAddr\n",11,&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),"\n\n",11,&dwDummy,nullptr); m_connected=true; m_state=0; } @@ -203,13 +203,13 @@ class Pipe void Write(char msg) { DWORD dummy; - if (!WriteFile(m_pipe,&msg,1,&dummy,NULL)||!dummy) + if (!WriteFile(m_pipe,&msg,1,&dummy,nullptr)||!dummy) { char sp[30]; wsprintf(sp,"%c:%i/%i\n",msg,dummy,GetLastError()); DWORD dwDummy; - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),sp,strlen(sp),&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),sp,strlen(sp),&dwDummy,nullptr); } } @@ -219,14 +219,14 @@ class Pipe switch(m_state) { case 0: - if (!ReadFile(m_pipe,&m_stringType,1,&read,NULL)) + if (!ReadFile(m_pipe,&m_stringType,1,&read,nullptr)) break; if (read==1) m_state++; - return NULL; + return nullptr; case 1: case 3: - if (!ReadFile(m_pipe,&m_len,4,&read,NULL)) + if (!ReadFile(m_pipe,&m_len,4,&read,nullptr)) break; if (read==4) { @@ -236,18 +236,18 @@ class Pipe m_str=(char *)realloc(m_str,m_len+1); m_state++; } - return NULL; + return nullptr; case 2: - if (!ReadFile(m_pipe,m_src,m_len,&read,NULL)) + if (!ReadFile(m_pipe,m_src,m_len,&read,nullptr)) break; if (read==m_len) { m_src[m_len]=0; m_state++; } - return NULL; + return nullptr; case 4: - if (!ReadFile(m_pipe,m_str,m_len,&read,NULL)) + if (!ReadFile(m_pipe,m_str,m_len,&read,nullptr)) break; if (read==m_len) { @@ -255,7 +255,7 @@ class Pipe m_state=0; return m_str; } - return NULL; + return nullptr; } if (GetLastError()==ERROR_BROKEN_PIPE) @@ -263,11 +263,11 @@ class Pipe DisconnectNamedPipe(m_pipe); DWORD dwDummy; - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),"\n\n",14,&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),"\n\n",14,&dwDummy,nullptr); m_connected=false; } - return NULL; + return nullptr; } }; @@ -280,7 +280,7 @@ int CALLBACK WinMain(HINSTANCE,HINSTANCE,LPSTR,int) GetComputerName(buf1,&dwDummy); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),buf2, wsprintf(buf2,"\n\nSimple debug.net Server ready. Enter 'quit' to exit.\n\nLocal machine: %s\n\n",buf1), - &dwDummy,NULL); + &dwDummy,nullptr); Pipe p[10]; for (int k=0;k<10;k++) @@ -288,7 +288,7 @@ int CALLBACK WinMain(HINSTANCE,HINSTANCE,LPSTR,int) { char msg[200]; wsprintf(msg,"Can't create named pipe (Code %i).",GetLastError()); - MessageBox(NULL,msg,"Error",MB_OK); + MessageBox(nullptr,msg,"Error",MB_OK); return 1; } @@ -310,7 +310,7 @@ int CALLBACK WinMain(HINSTANCE,HINSTANCE,LPSTR,int) if (msg) { DWORD dwDummy; - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),msg,strlen(msg),&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),msg,strlen(msg),&dwDummy,nullptr); } if (input) diff --git a/Core/Libraries/Source/debug/test2/test2.cpp b/Core/Libraries/Source/debug/test2/test2.cpp index 0980746ec03..6fae772f653 100644 --- a/Core/Libraries/Source/debug/test2/test2.cpp +++ b/Core/Libraries/Source/debug/test2/test2.cpp @@ -54,7 +54,7 @@ class TestCmdInterface: public DebugCmdInterface if (strcmp(cmd,"box") != 0) return false; - MessageBox(NULL,"Hello world!","Command",MB_OK); + MessageBox(nullptr,"Hello world!","Command",MB_OK); return true; } @@ -89,7 +89,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, Debug::Command("debug.io ; send via EXE, try test.box!"); // Main message loop: - while (GetMessage(&msg, NULL, 0, 0)) + while (GetMessage(&msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { @@ -128,7 +128,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TEST2); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_TEST2; wcex.lpszClassName = szWindowClass; @@ -154,7 +154,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); if (!hWnd) { @@ -162,7 +162,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) } // create a timer for calling Debug::Update - SetTimer(hWnd,1,100,NULL); + SetTimer(hWnd,1,100,nullptr); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); diff --git a/Core/Libraries/Source/profile/internal_funclevel.h b/Core/Libraries/Source/profile/internal_funclevel.h index e9229dbf22c..7d920f9832b 100644 --- a/Core/Libraries/Source/profile/internal_funclevel.h +++ b/Core/Libraries/Source/profile/internal_funclevel.h @@ -176,7 +176,7 @@ class ProfileFuncLevelTracer glob.tracer=tr; for (int k=0;knext) if (e->funcPtr->addr==addr) return e->funcPtr; - return NULL; + return nullptr; } diff --git a/Core/Libraries/Source/profile/internal_highlevel.h b/Core/Libraries/Source/profile/internal_highlevel.h index 2d9c572755e..f6f098ad147 100644 --- a/Core/Libraries/Source/profile/internal_highlevel.h +++ b/Core/Libraries/Source/profile/internal_highlevel.h @@ -57,7 +57,7 @@ class ProfileId /** Retrieves next profile ID. - \return next profile ID, NULL if none + \return next profile ID, nullptr if none */ ProfileId *GetNext(void) const { return m_next; } diff --git a/Core/Libraries/Source/profile/internal_result.h b/Core/Libraries/Source/profile/internal_result.h index a62f082a394..50ad507f8c3 100644 --- a/Core/Libraries/Source/profile/internal_result.h +++ b/Core/Libraries/Source/profile/internal_result.h @@ -66,7 +66,7 @@ class ProfileResultFileDOT: public ProfileResultInterface \brief Creates a class instance. \param fileName name of DOT file to generate (defaults to profile.dot) - \param frameName name of frame to use (NULL for global) + \param frameName name of frame to use (null for global) \param foldThreshold if the number of functions exceeds the given threshold then all functions belonging to the same source file will be folded into a single entry diff --git a/Core/Libraries/Source/profile/profile.cpp b/Core/Libraries/Source/profile/profile.cpp index 66981103b79..36a4ada2575 100644 --- a/Core/Libraries/Source/profile/profile.cpp +++ b/Core/Libraries/Source/profile/profile.cpp @@ -26,6 +26,7 @@ // // Profile module main code ////////////////////////////////////////////////////////////////////////////// + #include "profile.h" #include "internal.h" #include @@ -50,15 +51,15 @@ void *ProfileAllocMemory(unsigned numBytes) void *ProfileReAllocMemory(void *oldPtr, unsigned newSize) { - // Windows doesn't like ReAlloc with NULL handle/ptr... + // Windows doesn't like ReAlloc with null handle/ptr... if (!oldPtr) - return newSize?ProfileAllocMemory(newSize):0; + return newSize?ProfileAllocMemory(newSize):nullptr; // Shrinking to 0 size is basically freeing memory if (!newSize) { GlobalFree((HGLOBAL)oldPtr); - return 0; + return nullptr; } // now try GlobalReAlloc first @@ -323,7 +324,7 @@ unsigned Profile::GetFrameCount(void) const char *Profile::GetFrameName(unsigned frame) { - return frame>=m_rec?NULL:m_recNames[frame]; + return frame>=m_rec?nullptr:m_recNames[frame]; } void Profile::ClearTotals(void) diff --git a/Core/Libraries/Source/profile/profile.h b/Core/Libraries/Source/profile/profile.h index 92dde861b86..b087c8a6fa5 100644 --- a/Core/Libraries/Source/profile/profile.h +++ b/Core/Libraries/Source/profile/profile.h @@ -50,7 +50,7 @@ class Profile /** \brief Starts range recording. - \param range name of range to record, ==NULL for "frame" + \param range name of range to record, == nullptr for "frame" */ static void StartRange(const char *range=0); @@ -58,7 +58,7 @@ class Profile \brief Appends profile data to the last recorded frame of the given range. - \param range name of range to record, ==NULL for "frame" + \param range name of range to record, == nullptr for "frame" */ static void AppendRange(const char *range=0); @@ -68,7 +68,7 @@ class Profile \note After this call the recorded range data will be available as a new range frame. - \param range name of range to record, ==NULL for "frame" + \param range name of range to record, == nullptr for "frame" */ static void StopRange(const char *range=0); diff --git a/Core/Libraries/Source/profile/profile_cmd.cpp b/Core/Libraries/Source/profile/profile_cmd.cpp index 5eb0ef643f4..6fdeb4cf1e5 100644 --- a/Core/Libraries/Source/profile/profile_cmd.cpp +++ b/Core/Libraries/Source/profile/profile_cmd.cpp @@ -26,6 +26,7 @@ // // Profile module command interface ////////////////////////////////////////////////////////////////////////////// + #include "profile.h" #include "internal.h" @@ -211,7 +212,7 @@ bool ProfileCmdInterface::Execute(class Debug& dbg, const char *cmd, CommandMode Profile::lastPatternEntry=cur; } else - Profile::lastPatternEntry=NULL; + Profile::lastPatternEntry=nullptr; return true; } @@ -228,7 +229,7 @@ bool ProfileCmdInterface::Execute(class Debug& dbg, const char *cmd, CommandMode ProfileAllocMemory(sizeof(Profile::PatternListEntry)); // init - cur->next=NULL; + cur->next=nullptr; cur->isActive=*argv[0]=='+'; cur->pattern=(char *)ProfileAllocMemory(strlen(argv[1])+1); strcpy(cur->pattern,argv[1]); diff --git a/Core/Libraries/Source/profile/profile_funclevel.cpp b/Core/Libraries/Source/profile/profile_funclevel.cpp index 3c7110ca2ff..fe5129fe6ae 100644 --- a/Core/Libraries/Source/profile/profile_funclevel.cpp +++ b/Core/Libraries/Source/profile/profile_funclevel.cpp @@ -26,6 +26,7 @@ // // Function level profiling ////////////////////////////////////////////////////////////////////////////// + #include "profile.h" #include "internal.h" #include "../debug/debug.h" @@ -127,14 +128,14 @@ extern "C" void __declspec(naked) _cdecl _penter(void) } } -ProfileFuncLevelTracer *ProfileFuncLevelTracer::head=NULL; +ProfileFuncLevelTracer *ProfileFuncLevelTracer::head=nullptr; bool ProfileFuncLevelTracer::shuttingDown=false; int ProfileFuncLevelTracer::curFrame=0; unsigned ProfileFuncLevelTracer::frameRecordMask; bool ProfileFuncLevelTracer::recordCaller=false; ProfileFuncLevelTracer::ProfileFuncLevelTracer(void): - stack(NULL), usedStack(0), totalStack(0), maxDepth(0) + stack(nullptr), usedStack(0), totalStack(0), maxDepth(0) { ProfileFastCS::Lock lock(cs); @@ -297,7 +298,7 @@ int ProfileFuncLevelTracer::FrameStart(void) for (ProfileFuncLevelTracer *p=head;p;p=p->next) { Function *f; - for (int k=0;(f=p->func.Enumerate(k))!=NULL;k++) + for (int k=0;(f=p->func.Enumerate(k))!=nullptr;k++) { Profile &p=f->cur[i]; p.caller.Clear(); @@ -326,7 +327,7 @@ void ProfileFuncLevelTracer::FrameEnd(int which, int mixIndex) for (ProfileFuncLevelTracer *p=head;p;p=p->next) { Function *f; - for (int k=0;(f=p->func.Enumerate(k))!=NULL;k++) + for (int k=0;(f=p->func.Enumerate(k))!=nullptr;k++) { Profile &p=f->cur[which]; if (p.callCount) @@ -349,7 +350,7 @@ void ProfileFuncLevelTracer::ClearTotals(void) for (ProfileFuncLevelTracer *p=head;p;p=p->next) { Function *f; - for (int k=0;(f=p->func.Enumerate(k))!=NULL;k++) + for (int k=0;(f=p->func.Enumerate(k))!=nullptr;k++) { f->glob.caller.Clear(); f->glob.callCount=0; @@ -360,7 +361,7 @@ void ProfileFuncLevelTracer::ClearTotals(void) } ProfileFuncLevelTracer::UnsignedMap::UnsignedMap(void): - e(NULL), alloc(0), used(0), writeLock(false) + e(nullptr), alloc(0), used(0), writeLock(false) { memset(hash,0,sizeof(hash)); } @@ -373,7 +374,7 @@ ProfileFuncLevelTracer::UnsignedMap::~UnsignedMap() void ProfileFuncLevelTracer::UnsignedMap::Clear(void) { ProfileFreeMemory(e); - e=NULL; + e=nullptr; alloc=used=0; memset(hash,0,sizeof(hash)); } @@ -443,7 +444,7 @@ void ProfileFuncLevelTracer::UnsignedMap::MixIn(const UnsignedMap &src) } ProfileFuncLevelTracer::ProfileMap::ProfileMap(void): - root(NULL), tail(&root) + root(nullptr), tail(&root) { } @@ -462,7 +463,7 @@ ProfileFuncLevelTracer::Profile *ProfileFuncLevelTracer::ProfileMap::Find(int fr { List *p=root; for (;p&&p->framenext); - return p&&p->frame==frame?&p->p:NULL; + return p&&p->frame==frame?&p->p: nullptr; } void ProfileFuncLevelTracer::ProfileMap::Append(int frame, const Profile &p) @@ -471,7 +472,7 @@ void ProfileFuncLevelTracer::ProfileMap::Append(int frame, const Profile &p) new (newEntry) List; newEntry->frame=frame; newEntry->p.Copy(p); - newEntry->next=NULL; + newEntry->next=nullptr; *tail=newEntry; tail=&newEntry->next; } @@ -490,7 +491,7 @@ void ProfileFuncLevelTracer::ProfileMap::MixIn(int frame, const Profile &p) } ProfileFuncLevelTracer::FunctionMap::FunctionMap(void): - e(NULL), alloc(0), used(0) + e(nullptr), alloc(0), used(0) { memset(hash,0,sizeof(hash)); } @@ -539,7 +540,7 @@ void ProfileFuncLevelTracer::FunctionMap::Insert(Function *funcPtr) ProfileFuncLevelTracer::Function *ProfileFuncLevelTracer::FunctionMap::Enumerate(int index) { if (index<0||index>=(int)used) - return NULL; + return nullptr; return e[index].funcPtr; } @@ -565,7 +566,7 @@ bool ProfileFuncLevel::IdList::Enum(unsigned index, Id &id, unsigned *countPtr) const char *ProfileFuncLevel::Id::GetSource(void) const { if (!m_funcPtr) - return NULL; + return nullptr; ProfileFuncLevelTracer::Function *func=(ProfileFuncLevelTracer::Function *)m_funcPtr; if (!func->funcSource) @@ -573,9 +574,9 @@ const char *ProfileFuncLevel::Id::GetSource(void) const char helpFunc[256],helpFile[256]; unsigned ofsFunc; DebugStackwalk::Signature::GetSymbol(func->addr, - NULL,0,NULL, + nullptr,0,nullptr, helpFunc,sizeof(helpFunc),&ofsFunc, - helpFile,sizeof(helpFile),&func->funcLine,NULL); + helpFile,sizeof(helpFile),&func->funcLine,nullptr); char help[300]; wsprintf(help,ofsFunc?"%s+0x%x":"%s",helpFunc,ofsFunc); @@ -591,7 +592,7 @@ const char *ProfileFuncLevel::Id::GetSource(void) const const char *ProfileFuncLevel::Id::GetFunction(void) const { if (!m_funcPtr) - return NULL; + return nullptr; ProfileFuncLevelTracer::Function *func=(ProfileFuncLevelTracer::Function *)m_funcPtr; if (!func->funcSource) GetSource(); @@ -609,7 +610,7 @@ unsigned ProfileFuncLevel::Id::GetAddress(void) const unsigned ProfileFuncLevel::Id::GetLine(void) const { if (!m_funcPtr) - return NULL; + return 0; ProfileFuncLevelTracer::Function *func=(ProfileFuncLevelTracer::Function *)m_funcPtr; if (!func->funcSource) GetSource(); @@ -736,12 +737,12 @@ bool ProfileFuncLevel::IdList::Enum(unsigned index, Id &id, unsigned *) const const char *ProfileFuncLevel::Id::GetSource(void) const { - return NULL; + return nullptr; } const char *ProfileFuncLevel::Id::GetFunction(void) const { - return NULL; + return nullptr; } unsigned ProfileFuncLevel::Id::GetAddress(void) const @@ -791,4 +792,4 @@ ProfileFuncLevel::ProfileFuncLevel(void) #endif // !defined HAS_PROFILE ProfileFuncLevel ProfileFuncLevel::Instance; -HANDLE ProfileFastCS::testEvent=::CreateEvent(NULL,FALSE,FALSE,""); +HANDLE ProfileFastCS::testEvent=::CreateEvent(nullptr,FALSE,FALSE,""); diff --git a/Core/Libraries/Source/profile/profile_funclevel.h b/Core/Libraries/Source/profile/profile_funclevel.h index afe2227b0f3..b36d583cf9d 100644 --- a/Core/Libraries/Source/profile/profile_funclevel.h +++ b/Core/Libraries/Source/profile/profile_funclevel.h @@ -93,14 +93,14 @@ class ProfileFuncLevel /** \brief Returns the source file this Id is in. - \return source file name, may be NULL + \return source file name, may be nullptr */ const char *GetSource(void) const; /** \brief Returns the function name for this Id. - \return function name, may be NULL + \return function name, may be nullptr */ const char *GetFunction(void) const; diff --git a/Core/Libraries/Source/profile/profile_highlevel.cpp b/Core/Libraries/Source/profile/profile_highlevel.cpp index fa55293e935..a5524d83374 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.cpp +++ b/Core/Libraries/Source/profile/profile_highlevel.cpp @@ -26,6 +26,7 @@ // // High level profiling ////////////////////////////////////////////////////////////////////////////// + #include "profile.h" #include "internal.h" #include @@ -51,35 +52,35 @@ void ProfileHighLevel::Id::SetMax(double max) const char *ProfileHighLevel::Id::GetName(void) const { - return m_idPtr?m_idPtr->GetName():NULL; + return m_idPtr?m_idPtr->GetName():nullptr; } const char *ProfileHighLevel::Id::GetDescr(void) const { - return m_idPtr?m_idPtr->GetDescr():NULL; + return m_idPtr?m_idPtr->GetDescr():nullptr; } const char *ProfileHighLevel::Id::GetUnit(void) const { - return m_idPtr?m_idPtr->GetUnit():NULL; + return m_idPtr?m_idPtr->GetUnit():nullptr; } const char *ProfileHighLevel::Id::GetCurrentValue(void) const { - return m_idPtr?m_idPtr->AsString(m_idPtr->GetCurrentValue()):NULL; + return m_idPtr?m_idPtr->AsString(m_idPtr->GetCurrentValue()):nullptr; } const char *ProfileHighLevel::Id::GetValue(unsigned frame) const { double v; if (!m_idPtr||!m_idPtr->GetFrameValue(frame,v)) - return NULL; + return nullptr; return m_idPtr->AsString(v); } const char *ProfileHighLevel::Id::GetTotalValue(void) const { - return m_idPtr?m_idPtr->AsString(m_idPtr->GetTotalValue()):NULL; + return m_idPtr?m_idPtr->AsString(m_idPtr->GetTotalValue()):nullptr; } ////////////////////////////////////////////////////////////////////////////// @@ -89,12 +90,12 @@ ProfileHighLevel::Block::Block(const char *name) { DFAIL_IF(!name) return; - m_idTime=AddProfile(name,NULL,"msec",6,-4); + m_idTime=AddProfile(name,nullptr,"msec",6,-4); char help[256]; strlcpy(help, name, sizeof(help) - 2); strlcat(help, ".c", sizeof(help)); - AddProfile(help,NULL,"calls",6,0).Increment(); + AddProfile(help,nullptr,"calls",6,0).Increment(); ProfileGetTime(m_start); } @@ -129,18 +130,18 @@ ProfileId::ProfileId(const char *name, const char *descr, const char *unit, int strcpy(m_descr,descr); } else - m_descr=NULL; + m_descr=nullptr; if (unit) { m_unit=(char *)ProfileAllocMemory(strlen(unit)+1); strcpy(m_unit,unit); } else - m_unit=NULL; + m_unit=nullptr; m_precision=precision; m_exp10=exp10; m_curVal=m_totalVal=0.; - m_recFrameVal=NULL; + m_recFrameVal=nullptr; m_firstFrame=curFrame; m_valueMode=Unknown; } @@ -315,7 +316,7 @@ bool ProfileHighLevel::EnumProfile(unsigned index, Id &id) ProfileId *cur=ProfileId::GetFirst(); for (;cur&&index--;cur=cur->GetNext()); id.m_idPtr=cur; - return cur!=NULL; + return cur!=nullptr; } bool ProfileHighLevel::FindProfile(const char *name, Id &id) @@ -330,7 +331,7 @@ bool ProfileHighLevel::FindProfile(const char *name, Id &id) return true; } - id.m_idPtr=NULL; + id.m_idPtr=nullptr; return false; } diff --git a/Core/Libraries/Source/profile/profile_highlevel.h b/Core/Libraries/Source/profile/profile_highlevel.h index dea386181b5..41024847620 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.h +++ b/Core/Libraries/Source/profile/profile_highlevel.h @@ -119,7 +119,7 @@ class ProfileHighLevel any consecutive call to any profile module function. \param frame number of recorded frame/range - \return value at given frame, NULL if frame not found + \return value at given frame, nullptr if frame not found */ const char *GetValue(unsigned frame) const; diff --git a/Core/Libraries/Source/profile/profile_result.cpp b/Core/Libraries/Source/profile/profile_result.cpp index 13d55a679b9..a4b59fd3043 100644 --- a/Core/Libraries/Source/profile/profile_result.cpp +++ b/Core/Libraries/Source/profile/profile_result.cpp @@ -26,6 +26,7 @@ // // Result function interface and result functions ////////////////////////////////////////////////////////////////////////////// + #include "profile.h" #include "internal.h" #include @@ -145,9 +146,9 @@ void ProfileResultFileCSV::Delete(void) ProfileResultInterface *ProfileResultFileDOT::Create(int argn, const char * const *argv) { return new (ProfileAllocMemory(sizeof(ProfileResultFileDOT))) - ProfileResultFileDOT(argn>0?argv[0]:NULL, - argn>1?argv[1]:NULL, - argn>2?atoi(argv[2]):NULL); + ProfileResultFileDOT(argn>0?argv[0]:nullptr, + argn>1?argv[1]:nullptr, + argn>2?atoi(argv[2]): 0); } ProfileResultFileDOT::ProfileResultFileDOT(const char *fileName, const char *frameName, int foldThreshold) @@ -162,7 +163,7 @@ ProfileResultFileDOT::ProfileResultFileDOT(const char *fileName, const char *fra strcpy(m_frameName,frameName); } else - m_frameName=NULL; + m_frameName=nullptr; m_foldThreshold=foldThreshold; } @@ -226,7 +227,7 @@ void ProfileResultFileDOT::WriteResults(void) // folding version // build source code clusters first - FoldHelper *fold=NULL; + FoldHelper *fold=nullptr; for (k=0;tMax.EnumProfile(k,id);k++) { const char *source=id.GetSource(); diff --git a/Core/Tools/Autorun/ARGS.cpp b/Core/Tools/Autorun/ARGS.cpp index ce3ec5c4ee9..a9ece43f620 100644 --- a/Core/Tools/Autorun/ARGS.cpp +++ b/Core/Tools/Autorun/ARGS.cpp @@ -46,7 +46,7 @@ // GLOBALS //----------------------------------------------------------------------------- -Command_Line_Arguments *Args = NULL; +Command_Line_Arguments *Args = nullptr; //***************************************************************************** // COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS -- Constructor. @@ -69,7 +69,7 @@ Command_Line_Arguments::Command_Line_Arguments ( //-------------------------------------------------------------------------- // debug checks... //-------------------------------------------------------------------------- - assert( windows_command_line_string != NULL ); + assert( windows_command_line_string != nullptr ); //-------------------------------------------------------------------------- // reset all class data @@ -172,7 +172,7 @@ Command_Line_Arguments::Command_Line_Arguments ( HINSTANCE current_instance_hand //-------------------------------------------------------------------------- // debug checks... //-------------------------------------------------------------------------- - assert( windows_command_line_string != NULL ); + assert( windows_command_line_string != nullptr ); //-------------------------------------------------------------------------- // reset all class data @@ -329,7 +329,7 @@ const char *Command_Line_Arguments::Get_argv ( int argument_index ) void Command_Line_Arguments::Set_argv( int argument_index, char *arg ) { - if( arg == NULL || *arg == '\0' ) { + if( arg == nullptr || *arg == '\0' ) { return; } diff --git a/Core/Tools/Autorun/CDCNTRL.cpp b/Core/Tools/Autorun/CDCNTRL.cpp index 7d9f981a97b..621e1717264 100644 --- a/Core/Tools/Autorun/CDCNTRL.cpp +++ b/Core/Tools/Autorun/CDCNTRL.cpp @@ -220,7 +220,7 @@ HANDLE CDControlClass::Open_Removable_Volume( char drive ) ** Get a handle to the volume. */ _stprintf( volume_name, _TEXT( "\\\\.\\%c:" ), drive + 'A' ); - volume = CreateFile( volume_name, access_flags, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); + volume = CreateFile( volume_name, access_flags, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr ); // assert (volume != INVALID_HANDLE_VALUE); @@ -273,7 +273,7 @@ bool CDControlClass::Lock_Volume( HANDLE volume ) */ for ( int trycount = 0; trycount < LOCK_RETRIES; trycount++ ) { - if ( DeviceIoControl( volume, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL )) { + if ( DeviceIoControl( volume, FSCTL_LOCK_VOLUME, nullptr, 0, nullptr, 0, &bytes_returned, nullptr )) { return( true ); } // Msg( __LINE__, TEXT(__FILE__), TEXT("DeviceIoControl failed to lock volume. Error %d - %s"), GetLastError(), Last_Error_Text()); @@ -308,7 +308,7 @@ bool CDControlClass::Unlock_Volume(HANDLE volume) */ for ( int trycount = 0; trycount < LOCK_RETRIES; trycount++ ) { - if ( DeviceIoControl( volume, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL )) return( true ); + if ( DeviceIoControl( volume, FSCTL_UNLOCK_VOLUME, nullptr, 0, nullptr, 0, &bytes_returned, nullptr )) return( true ); // DebugString ("DeviceIoControl failed to unlock volume. Error %d - %s\n", GetLastError(), Last_Error_Text()); // Msg( __LINE__, __FILE__, "DeviceIoControl failed to unlock volume. Error %d - %s", GetLastError(), Last_Error_Text()); Last_Error_Text( _TEXT( "DeviceIoControl failed to unlock volume." ), GetLastError()); @@ -335,7 +335,7 @@ bool CDControlClass::Dismount_Volume(HANDLE volume) assert( WinVersion.Is_WinNT()); unsigned long bytes_returned; - bool result = ((DeviceIoControl( volume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &bytes_returned, NULL)) ? true : false ); + bool result = ((DeviceIoControl( volume, FSCTL_DISMOUNT_VOLUME, nullptr, 0, nullptr, 0, &bytes_returned, nullptr )) ? true : false ); if (result == false) { // DebugString ("DeviceIoControl failed to dismount volume. Error %d - %s\n", GetLastError(), Last_Error_Text()); @@ -367,7 +367,7 @@ bool CDControlClass::Prevent_Removal_Of_Volume( HANDLE volume, bool prevent ) pmrbuffer.PreventMediaRemoval = prevent; - bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_MEDIA_REMOVAL, &pmrbuffer, sizeof(PREVENT_MEDIA_REMOVAL), NULL, 0, &bytes_returned, NULL)) ? true : false); + bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_MEDIA_REMOVAL, &pmrbuffer, sizeof(PREVENT_MEDIA_REMOVAL), nullptr, 0, &bytes_returned, nullptr)) ? true : false); if (result == false) { // DebugString ("DeviceIoControl failed to prevent media removal. Error %d - %s\n", GetLastError(), Last_Error_Text()); @@ -393,7 +393,7 @@ bool CDControlClass::Auto_Eject_Volume(HANDLE volume) { assert (WinVersion.Is_WinNT()); unsigned long bytes_returned; - bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0, &bytes_returned, NULL)) ? true : false); + bool result = ((DeviceIoControl( volume, IOCTL_STORAGE_EJECT_MEDIA, nullptr, 0, nullptr, 0, &bytes_returned, nullptr )) ? true : false); if (result == false) { // DebugString ("DeviceIoControl failed to eject media. Error %d - %s\n", GetLastError(), Last_Error_Text()); @@ -911,7 +911,7 @@ bool CDControlClass::Auto_Eject_Volume_95 (HANDLE vwin32, char drive) HANDLE WINAPI CDControlClass::Open_VWin32 (void) { assert (WinVersion.Is_Win9x()); - HANDLE result = CreateFile ( TEXT("\\\\.\\vwin32"), 0, 0, NULL, 0, FILE_FLAG_DELETE_ON_CLOSE, NULL); + HANDLE result = CreateFile ( TEXT("\\\\.\\vwin32"), 0, 0, nullptr, 0, FILE_FLAG_DELETE_ON_CLOSE, nullptr); assert (result != INVALID_HANDLE_VALUE); return (result); } @@ -1086,7 +1086,7 @@ void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr ) if ( hr == S_OK ) { _stprintf( szDisplay, TEXT("%s"), szPrefix ); -// MessageBox( NULL, szDisplay, TEXT("Msg"),0 ); +// MessageBox( nullptr, szDisplay, TEXT("Msg"),0 ); return; } @@ -1095,17 +1095,17 @@ void Last_Error_Text ( LPCTSTR szPrefix, HRESULT hr ) } FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, hr, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR)&szMessage, 0, - NULL ); + nullptr ); _stprintf( szDisplay, TEXT( "%s: %s(%lx)" ), szPrefix, szMessage, hr ); Msg( __LINE__, TEXT(__FILE__), TEXT("GetLastError: %s"), szDisplay ); -// MessageBox( NULL, szDisplay, TEXT( "GetLastError" ), MB_OK ); +// MessageBox( nullptr, szDisplay, TEXT( "GetLastError" ), MB_OK ); LocalFree( szMessage ); diff --git a/Core/Tools/Autorun/CallbackHook.h b/Core/Tools/Autorun/CallbackHook.h index 1bbaac4a920..324e3827bcd 100644 --- a/Core/Tools/Autorun/CallbackHook.h +++ b/Core/Tools/Autorun/CallbackHook.h @@ -68,7 +68,7 @@ template class Callback : public CallbackHook virtual bool DoCallback(void) const { - if (mCallback != NULL) + if (mCallback != nullptr) { return mCallback(mUserData); } diff --git a/Core/Tools/Autorun/DrawButton.cpp b/Core/Tools/Autorun/DrawButton.cpp index edd7009682f..23dbc5ca2fd 100644 --- a/Core/Tools/Autorun/DrawButton.cpp +++ b/Core/Tools/Autorun/DrawButton.cpp @@ -113,7 +113,7 @@ DrawButton::DrawButton ( int id, RECT button_rect, const char *normal, const cha // Set the string variables. //-------------------------------------------------------------------------- memset( String, '\0', MAX_PATH ); -// if ( string != NULL ) { +// if ( string != nullptr ) { // wcscpy( String, Locale_GetString( string_num, String )); @@ -127,9 +127,9 @@ DrawButton::DrawButton ( int id, RECT button_rect, const char *normal, const cha //-------------------------------------------------------------------------- // Set the font pointer. //-------------------------------------------------------------------------- - MyFontPtr = NULL; + MyFontPtr = nullptr; - if ( fontptr != NULL ) { + if ( fontptr != nullptr ) { MyFontPtr = fontptr; } @@ -182,16 +182,16 @@ DrawButton::DrawButton ( int id, RECT button_rect, const char *normal, const cha // Set the string variables. //-------------------------------------------------------------------------- memset( String, '\0', MAX_PATH ); - if ( string != NULL ) { + if ( string != nullptr ) { wcscpy( String, string ); } //-------------------------------------------------------------------------- // Set the font pointer. //-------------------------------------------------------------------------- - MyFontPtr = NULL; + MyFontPtr = nullptr; - if ( fontptr != NULL ) { + if ( fontptr != nullptr ) { MyFontPtr = fontptr; } @@ -233,7 +233,7 @@ void DrawButton::Draw_Text ( HDC hDC ) RECT outline_rect; Rect rect; - if( hDC == NULL ) { + if( hDC == nullptr ) { return; } diff --git a/Core/Tools/Autorun/EZGIMEX.cpp b/Core/Tools/Autorun/EZGIMEX.cpp index 444b9ad9fd9..fd18ac35e94 100644 --- a/Core/Tools/Autorun/EZGIMEX.cpp +++ b/Core/Tools/Autorun/EZGIMEX.cpp @@ -49,7 +49,7 @@ /* And increase stream buffer */ /* - setvbuf(f, NULL, _IOFBF, FILE_BUFFER_SIZE); + setvbuf(f, nullptr, _IOFBF, FILE_BUFFER_SIZE); */ #define __NOINLINE__ 1 @@ -151,13 +151,13 @@ GSTREAM * GCALL gopen(const char *filename) handle = fopen( filename, "r+b" ); - Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != NULL )? 1 : 0 )); + Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != nullptr )? 1 : 0 )); if ( !handle ) { handle = fopen( filename, "rb" ); - Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != NULL )? 1 : 0 )); + Msg( __LINE__, __FILE__, "gopen:: handle = %d", (( handle != nullptr )? 1 : 0 )); } return((GSTREAM *) handle); } diff --git a/Core/Tools/Autorun/GETCD.cpp b/Core/Tools/Autorun/GETCD.cpp index fa8df05e26b..c033a23f674 100644 --- a/Core/Tools/Autorun/GETCD.cpp +++ b/Core/Tools/Autorun/GETCD.cpp @@ -184,10 +184,10 @@ int GetCDClass::Get_CD_Drive_For_This_Volume ( const char *volume_label ) (char const *)buffer, &volume_name[0], (unsigned long)sizeof(volume_name)-1, - (unsigned long *)NULL, + (unsigned long *)nullptr, (unsigned long *)&filename_length, (unsigned long *)&misc_dword, - (char *)NULL, + (char *)nullptr, (unsigned long)0 )) { //--------------------------------------------------------------------- @@ -212,12 +212,12 @@ int GetCDClass::Get_CD_Drive_For_This_Volume ( const char *volume_label ) FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); Msg( __LINE__, __FILE__, (LPTSTR)lpMsgBuf ); LocalFree( lpMsgBuf ); @@ -270,8 +270,8 @@ const char *GetCDClass::Get_Volume_For_This_CD_Drive ( const char *path, char *v unsigned filename_length; static char volume_label[ MAX_PATH ] = ""; // [OYO] add static - if ( path == NULL || volume_name == NULL ) { - return( NULL ); + if ( path == nullptr || volume_name == nullptr ) { + return( nullptr ); } memset( volume_name, '\0', sizeof( volume_name )); @@ -281,10 +281,10 @@ const char *GetCDClass::Get_Volume_For_This_CD_Drive ( const char *path, char *v (char const *)buffer, &volume_label[0], (unsigned long)sizeof(volume_label)-1, - (unsigned long *)NULL, + (unsigned long *)nullptr, (unsigned long *)&filename_length, (unsigned long *)&misc_dword, - (char *)NULL, + (char *)nullptr, (unsigned long)0 )) { strcpy( volume_name, volume_label ); @@ -296,12 +296,12 @@ const char *GetCDClass::Get_Volume_For_This_CD_Drive ( const char *path, char *v FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); Msg( __LINE__, __FILE__, (LPTSTR)lpMsgBuf ); LocalFree( lpMsgBuf ); @@ -361,10 +361,10 @@ bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_ (char const *)buffer, &volume_name[0], (unsigned long)sizeof(volume_name)-1, - (unsigned long *)NULL, + (unsigned long *)nullptr, (unsigned long *)&filename_length, (unsigned long *)&misc_dword, - (char *)NULL, + (char *)nullptr, (unsigned long)0 )) { /****************************************************************** @@ -381,7 +381,7 @@ bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_ volume_name[11] = '\0'; } - if ( volume_label != NULL ) { + if ( volume_label != nullptr ) { strncpy( volume_label, volume_name, 128 ); } diff --git a/Core/Tools/Autorun/GameText.cpp b/Core/Tools/Autorun/GameText.cpp index c2f990fc4eb..8da8eba308e 100644 --- a/Core/Tools/Autorun/GameText.cpp +++ b/Core/Tools/Autorun/GameText.cpp @@ -185,7 +185,7 @@ static int _cdecl compareLUT ( const void *, const void*); // Public Data //---------------------------------------------------------------------------- -GameTextInterface *TheGameText = NULL; +GameTextInterface *TheGameText = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -220,12 +220,12 @@ GameTextInterface* CreateGameTextInterface( void ) GameTextManager::GameTextManager() : m_textCount(0), m_maxLabelLen(0), - m_stringInfo(NULL), - m_stringLUT(NULL), + m_stringInfo(nullptr), + m_stringLUT(nullptr), m_initialized(FALSE), m_jabberWockie(FALSE), m_munkee(FALSE), - m_noStringList(NULL), + m_noStringList(nullptr), m_useStringFile(TRUE), m_failed(L"***FATAL*** String Manager failed to initialized properly") { @@ -294,7 +294,7 @@ void GameTextManager::init( void ) m_stringInfo = new StringInfo[m_textCount]; - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { deinit(); return; @@ -341,10 +341,10 @@ void GameTextManager::init( void ) void GameTextManager::deinit( void ) { delete [] m_stringInfo; - m_stringInfo = NULL; + m_stringInfo = nullptr; delete [] m_stringLUT; - m_stringLUT = NULL; + m_stringLUT = nullptr; m_textCount = 0; @@ -362,7 +362,7 @@ void GameTextManager::deinit( void ) DEBUG_LOG(("*** End missing strings ***")); DEBUG_LOG(("")); - m_noStringList = NULL; + m_noStringList = nullptr; m_initialized = FALSE; } @@ -474,7 +474,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -531,7 +531,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -634,7 +634,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) if ( m_jabberWockie ) { static Char buffer[MAX_UITEXT_LENGTH*2]; - Char *firstLetter = NULL, *lastLetter; + Char *firstLetter = nullptr, *lastLetter; Char *b = buffer; Int formatWord = FALSE; Char ch; @@ -650,7 +650,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) lastLetter = b-1; reverseWord ( firstLetter, lastLetter ); } - firstLetter = NULL; + firstLetter = nullptr; formatWord = FALSE; } *b++ = ch; @@ -1049,7 +1049,7 @@ const wchar_t * GameTextManager::fetch( const Char *label ) { DEBUG_ASSERTCRASH ( m_initialized, ("String Manager has not been m_initialized") ); - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { return m_failed.c_str(); } @@ -1058,12 +1058,12 @@ const wchar_t * GameTextManager::fetch( const Char *label ) StringLookUp key; std::string lb; lb = label; - key.info = NULL; + key.info = nullptr; key.label = &lb; lookUp = (StringLookUp *) bsearch( &key, (void*) m_stringLUT, m_textCount, sizeof(StringLookUp), compareLUT ); - if( lookUp == NULL ) + if( lookUp == nullptr ) { // See if we already have the missing string wchar_t tmp[256]; diff --git a/Core/Tools/Autorun/IGR.cpp b/Core/Tools/Autorun/IGR.cpp index 7ea522b0541..662a0d2c46f 100644 --- a/Core/Tools/Autorun/IGR.cpp +++ b/Core/Tools/Autorun/IGR.cpp @@ -29,7 +29,7 @@ #include "IGR.h" -IGROptionsClass *OnlineOptions = NULL; +IGROptionsClass *OnlineOptions = nullptr; /********************************************************************************************* @@ -66,7 +66,7 @@ bool IGROptionsClass::Init( void ) // If successful, get the options IGROptionsType ReadOptions = 0; - returnValue = RegQueryValueEx(handle, WOLAPI_REG_KEY_OPTIONS, NULL, + returnValue = RegQueryValueEx(handle, WOLAPI_REG_KEY_OPTIONS, nullptr, (unsigned long *) &type, (unsigned char *) &ReadOptions, (unsigned long *)&size); if (returnValue == ERROR_SUCCESS) { @@ -161,8 +161,8 @@ bool IGROptionsClass::Set_Options( IGROptionsType options ) if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &handle ) != ERROR_SUCCESS ) { // If not, make the WOLAPI key - if( RegCreateKeyEx( HKEY_LOCAL_MACHINE, key, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, - NULL, &handle, (unsigned long *)&disp ) != ERROR_SUCCESS ) + if( RegCreateKeyEx( HKEY_LOCAL_MACHINE, key, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, + nullptr, &handle, (unsigned long *)&disp ) != ERROR_SUCCESS ) return false; } diff --git a/Core/Tools/Autorun/Jsupport.cpp b/Core/Tools/Autorun/Jsupport.cpp index acfbeceef2a..6dbd211a694 100644 --- a/Core/Tools/Autorun/Jsupport.cpp +++ b/Core/Tools/Autorun/Jsupport.cpp @@ -88,7 +88,7 @@ int nGetWord( char *string, int fdbcs ) // If no string was passed in, exit. //-------------------------------------------------------------------------- if( !p || !( c0 = *p++ )) { -// if(( p == NULL ) || ( *p == '\0' )) { +// if(( p == nullptr ) || ( *p == '\0' )) { return 0; } // c0 = *p; diff --git a/Core/Tools/Autorun/Locale_API.cpp b/Core/Tools/Autorun/Locale_API.cpp index 73aa3aafbfd..5c743a32fd3 100644 --- a/Core/Tools/Autorun/Locale_API.cpp +++ b/Core/Tools/Autorun/Locale_API.cpp @@ -94,7 +94,7 @@ const wchar_t *localeStringsMissing[ MISSING_STRING_HINTS_MAX ] = /* GLOBAL VARIABLES */ /****************************************************************************/ char LanguageFile[ _MAX_PATH ]; -void * LocaleFile = NULL; +void * LocaleFile = nullptr; int CodePage = GetACP(); int LanguageID = 0; int PrimaryLanguage = LANG_NEUTRAL; @@ -144,7 +144,7 @@ int Locale_Init ( int language, char *file ) //------------------------------------------------------------------------- // Check for a file passed in. //------------------------------------------------------------------------- - if( file == NULL || file[0] == '/0' ) { + if( file == nullptr || file[0] == '/0' ) { return 0; } strcpy( LanguageFile, file ); @@ -176,7 +176,7 @@ int Locale_Init ( int language, char *file ) HRSRC hRsrc; HGLOBAL hGlobal; - HMODULE module = GetModuleHandle( NULL ); + HMODULE module = GetModuleHandle( nullptr ); //------------------------------------------------------------------------- // Find the string file in this program's resources. @@ -225,7 +225,7 @@ int Locale_Init ( int language, char *file ) } hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( PrimaryLanguage, SubLanguage )); - if ( hRsrc == NULL ) { + if ( hRsrc == nullptr ) { hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US )); } if ( hRsrc ) { @@ -247,11 +247,11 @@ int Locale_Init ( int language, char *file ) FreeResource( hGlobal ); } - if( LocaleFile == NULL ) { + if( LocaleFile == nullptr ) { LocaleFile = Load_File( LanguageFile, &filesize ); } - if( LocaleFile != NULL ) { + if( LocaleFile != nullptr ) { result = 1; } @@ -291,14 +291,14 @@ int Locale_Init ( int language, char *file ) void Locale_Restore ( void ) { delete TheGameText; - TheGameText = NULL; + TheGameText = nullptr; #if( USE_MULTI_FILE_FORMAT ) LOCALE_freetable(); LOCALE_restore(); #else free( LocaleFile ); - LocaleFile = NULL; + LocaleFile = nullptr; #endif } @@ -321,9 +321,9 @@ const char* Locale_GetString( int StringID, char *String ) #endif Remove_Quotes_Around_String( wide_buffer ); - WideCharToMultiByte( CodePage, 0, wide_buffer, _MAX_PATH, buffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wide_buffer, _MAX_PATH, buffer, _MAX_PATH, nullptr, nullptr ); - if( String != NULL ) { + if( String != nullptr ) { strncpy( String, buffer, _MAX_PATH ); } @@ -356,12 +356,12 @@ const wchar_t* Locale_GetString( int StringID, wchar_t *String ) wcscpy( wide_buffer, (wchar_t *)LOCALE_getstring( StringID )); #else - wchar_t *localeStr = NULL; + wchar_t *localeStr = nullptr; - if (TheGameText != NULL) + if (TheGameText != nullptr) localeStr = (wchar_t *)TheGameText->fetch( s_stringLabels[StringID] ); - if (localeStr == NULL) + if (localeStr == nullptr) { return localeStringsMissing[ min( MISSING_STRING_HINTS_MAX - 1, StringID ) ]; } @@ -373,7 +373,7 @@ const wchar_t* Locale_GetString( int StringID, wchar_t *String ) Remove_Quotes_Around_String( wide_buffer ); - if( String != NULL ) { + if( String != nullptr ) { wcsncpy( String, wide_buffer, _MAX_PATH ); } @@ -392,7 +392,7 @@ wchar_t *Remove_Quotes_Around_String ( wchar_t *old_string ) int length; //---------------------------------------------------------------------- - // If string is not NULL... + // If string is not null... //---------------------------------------------------------------------- if ( *letter == '"' ) { diff --git a/Core/Tools/Autorun/Locale_API.h b/Core/Tools/Autorun/Locale_API.h index 73cd605453e..2f8aa2c084b 100644 --- a/Core/Tools/Autorun/Locale_API.h +++ b/Core/Tools/Autorun/Locale_API.h @@ -53,10 +53,10 @@ extern int SubLanguage; /****************************************************************************/ int Locale_Init ( int language, char *file ); void Locale_Restore ( void ); -const wchar_t* Locale_GetString( const char *id, wchar_t *buffer = NULL, int size = _MAX_PATH ); +const wchar_t* Locale_GetString( const char *id, wchar_t *buffer = nullptr, int size = _MAX_PATH ); /* const char* Locale_GetString ( int StringID, char *String ); -const wchar_t* Locale_GetString ( int StringID, wchar_t *String=NULL ); +const wchar_t* Locale_GetString ( int StringID, wchar_t *String=nullptr ); */ bool Locale_Use_Multi_Language_Files ( void ); //int Locale_Get_Language_ID ( void ) { return LanguageID; }; diff --git a/Core/Tools/Autorun/RECT.h b/Core/Tools/Autorun/RECT.h index 0bd028d7cb2..02a010c38a2 100644 --- a/Core/Tools/Autorun/RECT.h +++ b/Core/Tools/Autorun/RECT.h @@ -257,10 +257,10 @@ TRect const Intersect(TRect const & bounding_rect, TRect const & draw_r ** Adjust Height relative draw position according to Height new draw_rect ** union. */ - if (x != NULL) { + if (x != nullptr) { *x -= T(new_draw_rect.X - draw_rect.X); } - if (y != NULL) { + if (y != nullptr) { *y -= T(new_draw_rect.Y - draw_rect.Y); } @@ -290,7 +290,7 @@ TRect const Intersect(TRect const & bounding_rect, TRect const & draw_r template TRect const Intersect(TRect const & rect1, TRect const & rect2) { - return(Intersect(rect1, rect2, (T*)NULL, (T*)NULL)); + return(Intersect(rect1, rect2, (T*)nullptr, (T*)nullptr)); } diff --git a/Core/Tools/Autorun/TTFont.cpp b/Core/Tools/Autorun/TTFont.cpp index 0c3652ec9a4..5dbf31207dc 100644 --- a/Core/Tools/Autorun/TTFont.cpp +++ b/Core/Tools/Autorun/TTFont.cpp @@ -68,14 +68,14 @@ //------------------------------------------------------------------------- // Text Fonts. //------------------------------------------------------------------------- -TTFontClass *TTButtonFontPtr = NULL; -TTFontClass *TTButtonFontPtrSmall = NULL; -TTFontClass *TTTextFontPtr = NULL; -TTFontClass *TTTextFontPtr640 = NULL; -TTFontClass *TTTextFontPtr800 = NULL; -TTFontClass *TTLicenseFontPtr = NULL; +TTFontClass *TTButtonFontPtr = nullptr; +TTFontClass *TTButtonFontPtrSmall = nullptr; +TTFontClass *TTTextFontPtr = nullptr; +TTFontClass *TTTextFontPtr640 = nullptr; +TTFontClass *TTTextFontPtr800 = nullptr; +TTFontClass *TTLicenseFontPtr = nullptr; -FontManagerClass * FontManager = NULL; +FontManagerClass * FontManager = nullptr; //unsigned long TEXT_COLOR = RGB( 247, 171, 11 ); //unsigned long SHADOW_COLOR = RGB( 40, 8, 8 ); @@ -142,7 +142,7 @@ TTFontClass::TTFontClass( //-------------------------------------------------------------------------- // Get or Set a Font filename. //-------------------------------------------------------------------------- - if (( filename == NULL ) || ( filename[0] == '\0' )) { + if (( filename == nullptr ) || ( filename[0] == '\0' )) { strcpy( szFilename, "Arial.ttf" ); } else { strcpy( szFilename, filename ); @@ -151,7 +151,7 @@ TTFontClass::TTFontClass( //-------------------------------------------------------------------------- // Get or Set a Font facename. //-------------------------------------------------------------------------- - if (( facename == NULL ) || ( facename[0] == '\0' )) { + if (( facename == nullptr ) || ( facename[0] == '\0' )) { strcpy( szFacename, "Arial" ); } else { strcpy( szFacename, facename ); @@ -180,7 +180,7 @@ TTFontClass::TTFontClass( pitchAndFamily, szFacename ); - if ( hdc && ( Font != NULL )) { + if ( hdc && ( Font != nullptr )) { //---------------------------------------------------------------------- // The GetTextFace function lets a program determine the face name of @@ -196,7 +196,7 @@ TTFontClass::TTFontClass( SelectObject( hdc, old_object ); DeleteObject( Font ); - Font = NULL; + Font = nullptr; Font = CreateFont( height, // height of font @@ -335,14 +335,14 @@ int TTFontClass::Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes //-------------------------------------------------------------------------- // These values must be passed in. //-------------------------------------------------------------------------- - if ( string == NULL || *string == '\0' || hdc == NULL ) { + if ( string == nullptr || *string == '\0' || hdc == nullptr ) { return( 0 ); } //-------------------------------------------------------------------------- // If this value is passed in, the set the default value (1=single). //-------------------------------------------------------------------------- - if ( num_bytes!= NULL ) { + if ( num_bytes!= nullptr ) { *num_bytes = 1; } @@ -378,7 +378,7 @@ int TTFontClass::Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes int TTFontClass::String_Pixel_Width( HDC hdc, char const * string ) const { - if ( string == NULL ) { + if ( string == nullptr ) { return(0); } @@ -392,7 +392,7 @@ int TTFontClass::String_Pixel_Width( HDC hdc, char const * string ) const size.cx = 0; - if ( localDC == NULL ) { + if ( localDC == nullptr ) { return( size.cx ); } @@ -432,11 +432,11 @@ void TTFontClass::String_Pixel_Bounds( HDC hdc, const char* string, Rect& bounds bounds.Width = 0; bounds.Height = 0; - if ( string == NULL ) { + if ( string == nullptr ) { return; } - if ( hdc == NULL ) { + if ( hdc == nullptr ) { return; } @@ -501,14 +501,14 @@ void TTFontClass::String_Pixel_Bounds( HDC hdc, const char* string, Rect& bounds // UINT TTFontClass::Get_Double_Byte_Char ( const char *string, int *num_bytes ) const { - if ( string == NULL || *string == '\0' ) { + if ( string == nullptr || *string == '\0' ) { return( 0 ); } const char *ptr = string; UINT c = *(BYTE *)ptr++; - if ( num_bytes != NULL ) { + if ( num_bytes != nullptr ) { *num_bytes = 1; } @@ -536,7 +536,7 @@ UINT TTFontClass::Get_Double_Byte_Char ( const char *string, int *num_bytes ) co //-------------------------------------------------------------------------- if( IsDBCSLeadByte( c )&& *ptr ) { // [OYO] c = ( c << 8 ) | *(BYTE *)ptr++; - if ( num_bytes != NULL ) { + if ( num_bytes != nullptr ) { *num_bytes = 2; } } @@ -677,7 +677,7 @@ Point2D TTFontClass::Print( int length = wcslen( string ); memset( buffer, '\0', _MAX_PATH ); - WideCharToMultiByte( CodePage, 0, string, length, buffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, string, length, buffer, _MAX_PATH, nullptr, nullptr ); return( Print( hdc, buffer, cliprect, forecolor, backcolor, flag, shadow )); } @@ -703,10 +703,10 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- // If no string, why continue? //-------------------------------------------------------------------------- - assert( string != NULL ); - assert( hdc != NULL ); + assert( string != nullptr ); + assert( hdc != nullptr ); - if (( string == NULL ) || ( string[0] == '\0' )) { + if (( string == nullptr ) || ( string[0] == '\0' )) { return( point ); } @@ -729,7 +729,7 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- if ( hdc ) { - assert( Font != NULL ); + assert( Font != nullptr ); old_object = SelectObject( hdc, Font ); @@ -747,7 +747,7 @@ Point2D TTFontClass::Print( // &rect, // optional dimensions // string, // string // length, // number of characters in string -// NULL // array of spacing values +// nullptr // array of spacing values // ); // result = TextOutW( @@ -817,10 +817,10 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- // If no string, why continue? //-------------------------------------------------------------------------- - assert( string != NULL ); - assert( hdc != NULL ); + assert( string != nullptr ); + assert( hdc != nullptr ); - if (( string == NULL ) || ( string[0] == '\0' )) { + if (( string == nullptr ) || ( string[0] == '\0' )) { return( point ); } @@ -848,7 +848,7 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- if ( hdc ) { - assert( Font != NULL ); + assert( Font != nullptr ); old_object = SelectObject( hdc, Font ); @@ -1047,14 +1047,14 @@ int TTFontClass::Find_Text_VLength( HDC hdc, char *str, int width ) bool make_dc = FALSE; HDC localDC = hdc; - if ( *str == '\0' || str == NULL ) { + if ( *str == '\0' || str == nullptr ) { return( 0 ); } //-------------------------------------------------------------------------- // If no DC was passed in, then we need to get one. //-------------------------------------------------------------------------- - if ( localDC == NULL ) { + if ( localDC == nullptr ) { return( 0 ); } @@ -1223,7 +1223,7 @@ FontManagerClass::FontManagerClass ( HDC hdc ) strcpy( szFacename, "Arial" ); strcpy( szPath, Args->Get_argv(0)); - _splitpath( szPath, drive, dir, NULL, NULL ); + _splitpath( szPath, drive, dir, nullptr, nullptr ); _makepath( szPath, drive, dir, "Setup\\Setup", ".ini" ); GetPrivateProfileString( "Fonts", "Font", "Arial.tff", szFile, MAX_PATH, szPath ); @@ -1351,37 +1351,37 @@ FontManagerClass::FontManagerClass ( HDC hdc ) //---------------------------------------------------------------------- // If we fell through... //---------------------------------------------------------------------- - if( TTButtonFontPtr == NULL || TTTextFontPtr == NULL ) { + if( TTButtonFontPtr == nullptr || TTTextFontPtr == nullptr ) { strcpy( szFile, "Arial.tff" ); strcpy( szFacename, "Arial" ); - if( TTButtonFontPtr == NULL ) { + if( TTButtonFontPtr == nullptr ) { TTButtonFontPtr = new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE ); } - if( TTButtonFontPtrSmall == NULL ) { + if( TTButtonFontPtrSmall == nullptr ) { TTButtonFontPtrSmall= new TTFontClass( hdc, szFile, szFacename, 22, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE ); } - if( TTTextFontPtr == NULL ) { + if( TTTextFontPtr == nullptr ) { TTTextFontPtr = new TTFontClass( hdc, szFile, szFacename, 16, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE ); } - if( TTTextFontPtr640 == NULL ) { + if( TTTextFontPtr640 == nullptr ) { TTTextFontPtr640 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE ); } - if( TTTextFontPtr800 == NULL ) { + if( TTTextFontPtr800 == nullptr ) { TTTextFontPtr800 = new TTFontClass( hdc, szFile, szFacename, 14, FW_SEMIBOLD, ANSI_CHARSET, 0, 0, 0, FALSE ); } - if( TTLicenseFontPtr == NULL ) { + if( TTLicenseFontPtr == nullptr ) { TTLicenseFontPtr = new TTFontClass( hdc, szFile, szFacename, 12, FW_MEDIUM, ANSI_CHARSET, 0, 0, 0, FALSE ); } } } - assert( TTTextFontPtr != NULL ); - assert( TTTextFontPtr640 != NULL ); - assert( TTTextFontPtr800 != NULL ); - assert( TTButtonFontPtr != NULL ); - assert( TTButtonFontPtrSmall != NULL ); - assert( TTLicenseFontPtr != NULL ); + assert( TTTextFontPtr != nullptr ); + assert( TTTextFontPtr640 != nullptr ); + assert( TTTextFontPtr800 != nullptr ); + assert( TTButtonFontPtr != nullptr ); + assert( TTButtonFontPtrSmall != nullptr ); + assert( TTLicenseFontPtr != nullptr ); } /*********************************************************************************************** @@ -1399,10 +1399,10 @@ FontManagerClass::FontManagerClass ( HDC hdc ) FontManagerClass::~FontManagerClass ( void ) { delete TTButtonFontPtr; - TTButtonFontPtr = NULL; + TTButtonFontPtr = nullptr; delete TTTextFontPtr; - TTTextFontPtr = NULL; + TTTextFontPtr = nullptr; } @@ -1423,7 +1423,7 @@ FontManagerClass::~FontManagerClass ( void ) *=============================================================================================*/ TTFontClass * Font_From_TPF ( TextPrintType flags ) { - TTFontClass *fontptr= NULL; + TTFontClass *fontptr= nullptr; switch (flags & 0x000F) { diff --git a/Core/Tools/Autorun/TTFont.h b/Core/Tools/Autorun/TTFont.h index 56138857bff..61ad52991be 100644 --- a/Core/Tools/Autorun/TTFont.h +++ b/Core/Tools/Autorun/TTFont.h @@ -204,15 +204,15 @@ class TTFontClass virtual ~TTFontClass(void) { - if ( Font != NULL ) { + if ( Font != nullptr ) { DeleteObject( Font ); - Font = NULL; + Font = nullptr; } RemoveFontResource( szFilename ); }; virtual int Char_Pixel_Width ( HDC hdc, UINT c ) const; - virtual int Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes=NULL ) const; + virtual int Char_Pixel_Width ( HDC hdc, char const * string, int *num_bytes=nullptr ) const; virtual int String_Pixel_Width ( HDC hdc, char const * string ) const; virtual void String_Pixel_Bounds ( HDC hdc, const char * string, Rect& bounds ) const; virtual int Get_Width ( void ) const; @@ -222,7 +222,7 @@ class TTFontClass virtual int Find_Text_VLength ( HDC hdc, char *str, int width ); virtual HFONT Get_Font_Ptr ( void ) { return Font; }; virtual int IsFontDBCS ( void ) const { return ((CharSet==SHIFTJIS_CHARSET)||(CharSet==HANGEUL_CHARSET)||(CharSet==CHINESEBIG5_CHARSET)); }; // [OYO] - virtual UINT Get_Double_Byte_Char ( const char *string, int *num_bytes=NULL ) const; + virtual UINT Get_Double_Byte_Char ( const char *string, int *num_bytes=nullptr ) const; virtual Point2D Print( HDC hdc, diff --git a/Core/Tools/Autorun/Utils.cpp b/Core/Tools/Autorun/Utils.cpp index e40fb229d74..565449b0f96 100644 --- a/Core/Tools/Autorun/Utils.cpp +++ b/Core/Tools/Autorun/Utils.cpp @@ -89,7 +89,7 @@ // Purpose: To replace each "&" with "&&" for display in a dialog. // Some dialogs mistake a single "&" for an accelerator key. // -// Input: pszString - any NULL terminated string. +// Input: pszString - any null-terminated string. // // Returns: VOID (returns nothing) // @@ -192,7 +192,7 @@ void Fix_Single_Ampersands ( wchar_t *pszString, bool upper_case ) // Purpose: To replace each "&&" with "&" for display in a dialog. // Some dialogs mistake a single "&" for an accelerator key. // -// Input: pszString - any NULL terminated string. +// Input: pszString - any null-terminated string. // // Returns: VOID (returns nothing) // @@ -254,7 +254,7 @@ void Fix_Double_Ampersands ( LPSTR pszString, bool upper_case ) void * Load_Alloc_Data( char *filename, long *filesize ) { int size, bytes_read; - void *ptr = NULL; + void *ptr = nullptr; StandardFileClass file; //------------------------------------------------------------------------- @@ -262,7 +262,7 @@ void * Load_Alloc_Data( char *filename, long *filesize ) //------------------------------------------------------------------------- file.Open( filename, MODE_READ_ONLY ); if ( !file.Query_Open()) { - return( NULL ); + return( nullptr ); } //------------------------------------------------------------------------- @@ -271,7 +271,7 @@ void * Load_Alloc_Data( char *filename, long *filesize ) size = file.Query_Size(); ptr = (void*)malloc(size + 1); if ( !ptr ) { - return( NULL ); + return( nullptr ); } //------------------------------------------------------------------------- @@ -287,10 +287,10 @@ void * Load_Alloc_Data( char *filename, long *filesize ) assert( bytes_read == size ); if ( bytes_read != size ) { free(ptr); - return( NULL ); + return( nullptr ); } - if ( filesize != NULL ) { + if ( filesize != nullptr ) { *filesize = (long)size; } return( ptr ); @@ -312,10 +312,10 @@ void * Load_Alloc_Data( char *filename, long *filesize ) void *Load_File ( char *filename, long *filesize ) { - void *ptr = NULL; + void *ptr = nullptr; - if ( filename == NULL || filename[0] == '\0' ) { - return( NULL ); + if ( filename == nullptr || filename[0] == '\0' ) { + return( nullptr ); } //------------------------------------------------------------------------- @@ -347,12 +347,12 @@ char *Make_Current_Path_To ( const char *filename, char *path ) char dir [ _MAX_DIR ]; strcpy( szPath, Args->Get_argv(0)); - _splitpath( szPath, drive, dir, NULL, NULL ); - _makepath( szPath, drive, dir, NULL, NULL ); + _splitpath( szPath, drive, dir, nullptr, nullptr ); + _makepath( szPath, drive, dir, nullptr, nullptr ); Path_Add_Back_Slash( szPath ); strcat( szPath, filename ); - if( path != NULL ) { + if( path != nullptr ) { strcpy( path, szPath ); } return( path ); @@ -365,12 +365,12 @@ wchar_t *Make_Current_Path_To ( const wchar_t *filename, wchar_t *path ) wchar_t dir [ _MAX_DIR ]; wcscpy( szPath, (wchar_t *)Args->Get_argv(0)); - _wsplitpath( szPath, drive, dir, NULL, NULL ); - _wmakepath( szPath, drive, dir, NULL, NULL ); + _wsplitpath( szPath, drive, dir, nullptr, nullptr ); + _wmakepath( szPath, drive, dir, nullptr, nullptr ); Path_Add_Back_Slash( szPath ); wcscat( szPath, filename ); - if( path != NULL ) { + if( path != nullptr ) { wcscpy( path, szPath ); } return( path ); @@ -392,7 +392,7 @@ wchar_t *Make_Current_Path_To ( const wchar_t *filename, wchar_t *path ) char *Path_Add_Back_Slash ( char *path ) { - if ( path != NULL && *path != '\0' ) { + if ( path != nullptr && *path != '\0' ) { if ( path[ strlen( path )-1 ] != '\\' ) { strcat( path, "\\" ); } @@ -402,7 +402,7 @@ char *Path_Add_Back_Slash ( char *path ) wchar_t *Path_Add_Back_Slash ( wchar_t *path ) { - if ( path != NULL && *path != '\0' ) { + if ( path != nullptr && *path != '\0' ) { if ( path[ wcslen( path )-1 ] != '\\' ) { wcscat( path, L"\\" ); } @@ -426,7 +426,7 @@ wchar_t *Path_Add_Back_Slash ( wchar_t *path ) char *Path_Remove_Back_Slash ( char *path ) { - if ( path != NULL && *path != '\0' ) { + if ( path != nullptr && *path != '\0' ) { if ( path[ strlen( path )-1 ] == '\\' ) { path[ strlen( path )-1 ] = '\0'; } @@ -436,7 +436,7 @@ char *Path_Remove_Back_Slash ( char *path ) wchar_t *Path_Remove_Back_Slash ( wchar_t *path ) { - if ( path != NULL && *path != '\0' ) { + if ( path != nullptr && *path != '\0' ) { if ( path[ wcslen( path )-1 ] == L'\\' ) { path[ wcslen( path )-1 ] = L'\0'; } @@ -460,10 +460,10 @@ void PlugInProductName ( char *szString, char *szName ) char szTextBuf[ MAX_PATH ]; char szOut[ MAX_PATH ]; char szProduct[ MAX_PATH ]; - char * temp = NULL; - char * next = NULL; + char * temp = nullptr; + char * next = nullptr; - if ( szName == NULL || szName[0] == '\0' ) { + if ( szName == nullptr || szName[0] == '\0' ) { return; } @@ -480,7 +480,7 @@ void PlugInProductName ( char *szString, char *szName ) // Substitute each "%P" with "%s". nStrReturn is the index // into the buffer where "%P" was found. //------------------------------------------------------------- - while ( temp != NULL && nCount < 6) { + while ( temp != nullptr && nCount < 6) { next = temp+1; nCount = nCount + 1; temp = strstr( next, "%s" ); @@ -533,8 +533,8 @@ void PlugInProductName( char *szString, int nName ) char szTextBuf[ MAX_PATH ]; char szOut[ MAX_PATH ]; char szProduct[ MAX_PATH ]; - char * temp = NULL; - char * next = NULL; + char * temp = nullptr; + char * next = nullptr; if ( nName <= STRNONE ) { nName = STRNONE; @@ -555,7 +555,7 @@ void PlugInProductName( char *szString, int nName ) // Substitute each "%P" with "%s". nStrReturn is the index // into the buffer where "%P" was found. //------------------------------------------------------------- - while ( temp != NULL && nCount < 6) { + while ( temp != nullptr && nCount < 6) { next = temp+1; nCount = nCount + 1; temp = strstr( next, "%s" ); @@ -608,10 +608,10 @@ void PlugInProductName ( wchar_t *szString, const wchar_t *szName ) wchar_t szTextBuf[ MAX_PATH ]; wchar_t szOut[ MAX_PATH ]; wchar_t szProduct[ MAX_PATH ]; - wchar_t *temp = NULL; - wchar_t *next = NULL; + wchar_t *temp = nullptr; + wchar_t *next = nullptr; - if ( szName == NULL || szName[0] == '\0' ) { + if ( szName == nullptr || szName[0] == '\0' ) { return; } @@ -628,7 +628,7 @@ void PlugInProductName ( wchar_t *szString, const wchar_t *szName ) // Substitute each "%P" with "%s". nStrReturn is the index // into the buffer where "%P" was found. //------------------------------------------------------------- - while ( temp != NULL && nCount < 6) { + while ( temp != nullptr && nCount < 6) { next = temp+1; nCount = nCount + 1; temp = wcsstr( next, L"%s" ); diff --git a/Core/Tools/Autorun/ViewHTML.cpp b/Core/Tools/Autorun/ViewHTML.cpp index dd0bc246c54..88794f35c84 100644 --- a/Core/Tools/Autorun/ViewHTML.cpp +++ b/Core/Tools/Autorun/ViewHTML.cpp @@ -53,7 +53,7 @@ * INPUTS * URL - Website address * Wait - Wait for user to close browser (default = false) -* Callback - User callback to invoke during wait (default = NULL callback) +* Callback - User callback to invoke during wait (default = nullptr callback) * * RESULT * Success - True if successful; otherwise false @@ -70,7 +70,7 @@ bool ViewHTML(const char* url, bool wait, const CallbackHook& callback) //-------------------------------------------------------------------------- // Just return if no URL specified //-------------------------------------------------------------------------- - if ((url == NULL) || (strlen(url) == 0)) + if ((url == nullptr) || (strlen(url) == 0)) { // DebugPrint("***** No URL specified.\n"); Msg( __LINE__, TEXT(__FILE__), TEXT("***** No URL specified." )); @@ -111,10 +111,10 @@ bool ViewHTML(const char* url, bool wait, const CallbackHook& callback) filename2, GENERIC_WRITE, 0, - NULL, + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL); + nullptr); if (file == INVALID_HANDLE_VALUE) { @@ -126,12 +126,12 @@ bool ViewHTML(const char* url, bool wait, const CallbackHook& callback) // Write generic contents const char* contents = "ViewHTML"; DWORD written; - WriteFile(file, contents, strlen(contents), &written, NULL); + WriteFile(file, contents, strlen(contents), &written, nullptr); CloseHandle(file); // Find the executable that can launch this file char exeName[MAX_PATH]; - HINSTANCE hInst = FindExecutable(filename2, NULL, exeName); + HINSTANCE hInst = FindExecutable(filename2, nullptr, exeName); // Delete temporary file DeleteFile(filename2); @@ -157,12 +157,12 @@ bool ViewHTML(const char* url, bool wait, const CallbackHook& callback) BOOL createSuccess = CreateProcess( exeName, commandLine, - NULL, - NULL, + nullptr, + nullptr, FALSE, 0, - NULL, - NULL, + nullptr, + nullptr, &startupInfo, &processInfo); diff --git a/Core/Tools/Autorun/WSYS_FileSystem.cpp b/Core/Tools/Autorun/WSYS_FileSystem.cpp index d98795e10db..9f7c92c64f9 100644 --- a/Core/Tools/Autorun/WSYS_FileSystem.cpp +++ b/Core/Tools/Autorun/WSYS_FileSystem.cpp @@ -86,7 +86,7 @@ */ //=============================== -FileSystem *TheFileSystem = NULL; +FileSystem *TheFileSystem = nullptr; //---------------------------------------------------------------------------- // Private Prototypes diff --git a/Core/Tools/Autorun/WSYS_FileSystem.h b/Core/Tools/Autorun/WSYS_FileSystem.h index 7906b70da70..7d27b583b4c 100644 --- a/Core/Tools/Autorun/WSYS_FileSystem.h +++ b/Core/Tools/Autorun/WSYS_FileSystem.h @@ -73,7 +73,7 @@ class FileSystem public: virtual ~FileSystem() {}; - virtual File* open( const Char *filename, Int access = 0 ) = NULL ; ///< opens a File interface to the specified file + virtual File* open( const Char *filename, Int access = 0 ) = 0 ; ///< opens a File interface to the specified file }; diff --git a/Core/Tools/Autorun/WSYS_RAMFile.cpp b/Core/Tools/Autorun/WSYS_RAMFile.cpp index 804fafc41b5..e35cd4cbf25 100644 --- a/Core/Tools/Autorun/WSYS_RAMFile.cpp +++ b/Core/Tools/Autorun/WSYS_RAMFile.cpp @@ -95,7 +95,7 @@ RAMFile::RAMFile() : m_size(0), - m_data(NULL) + m_data(nullptr) { } @@ -132,7 +132,7 @@ Bool RAMFile::open( const Char *filename, Int access ) { File *file = TheFileSystem->open( filename, access ); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -152,9 +152,9 @@ Bool RAMFile::open( const Char *filename, Int access ) Bool RAMFile::open( File *file ) { - if ( file == NULL ) + if ( file == nullptr ) { - return NULL; + return FALSE; } Int access = file->getAccess(); @@ -168,7 +168,7 @@ Bool RAMFile::open( File *file ) m_size = file->size(); m_data = new char [ m_size ]; - if ( m_data == NULL ) + if ( m_data == nullptr ) { return FALSE; } @@ -178,7 +178,7 @@ Bool RAMFile::open( File *file ) if ( m_size < 0 ) { delete [] m_data; - m_data = NULL; + m_data = nullptr; return FALSE; } @@ -199,7 +199,7 @@ Bool RAMFile::open( File *file ) void RAMFile::close( void ) { delete [] m_data; - m_data = NULL; + m_data = nullptr; File::close(); } @@ -210,7 +210,7 @@ void RAMFile::close( void ) Int RAMFile::read( void *buffer, Int bytes ) { - if( m_data == NULL ) + if( m_data == nullptr ) { return -1; } diff --git a/Core/Tools/Autorun/WSYS_StdFileSystem.cpp b/Core/Tools/Autorun/WSYS_StdFileSystem.cpp index 15698cd1c07..2f488696da1 100644 --- a/Core/Tools/Autorun/WSYS_StdFileSystem.cpp +++ b/Core/Tools/Autorun/WSYS_StdFileSystem.cpp @@ -115,7 +115,7 @@ File* StdFileSystem::open( const Char *filename, Int access ) else { delete file; - file = NULL; + file = nullptr; } return (File*) file; diff --git a/Core/Tools/Autorun/WSYS_file.h b/Core/Tools/Autorun/WSYS_file.h index 34cd965d822..c9d91fc0f91 100644 --- a/Core/Tools/Autorun/WSYS_file.h +++ b/Core/Tools/Autorun/WSYS_file.h @@ -111,15 +111,15 @@ class File virtual Bool open( const Char *filename, Int access = 0 ); ///< Open a file for access virtual void close( void ); ///< Close the file !!! File object no longer valid after this call !!! - virtual Int read( void *buffer, Int bytes ) = NULL ; /**< Read the specified number of bytes from the file in to the + virtual Int read( void *buffer, Int bytes ) = 0 ; /**< Read the specified number of bytes from the file in to the * memory pointed at by buffer. Returns the number of bytes read. * Returns -1 if an error occured. */ - virtual Int write( void *buffer, Int bytes ) = NULL ; /**< Write the specified number of bytes from the + virtual Int write( void *buffer, Int bytes ) = 0 ; /**< Write the specified number of bytes from the * memory pointed at by buffer to the file. Returns the number of bytes written. * Returns -1 if an error occured. */ - virtual Int seek( Int bytes, seekMode mode = CURRENT ) = NULL; /**< Sets the file position of the next read/write operation. Returns the new file + virtual Int seek( Int bytes, seekMode mode = CURRENT ) = 0; /**< Sets the file position of the next read/write operation. Returns the new file * position as the number of bytes from the start of the file. * Returns -1 if an error occured. * diff --git a/Core/Tools/Autorun/WinFix.cpp b/Core/Tools/Autorun/WinFix.cpp index 85e093aaa0f..0a3003b0406 100644 --- a/Core/Tools/Autorun/WinFix.cpp +++ b/Core/Tools/Autorun/WinFix.cpp @@ -93,9 +93,9 @@ WindowsVersionInfo::WindowsVersionInfo(void) : // Start recording messages. //-------------------------------------------------------------------------- Delete_Msg_File(); - Msg( __LINE__, __FILE__, "----------------------------------------------", NULL ); - Msg( __LINE__, __FILE__, "------------------ Setup -----------------", NULL ); - Msg( __LINE__, __FILE__, "----------------------------------------------", NULL ); + Msg( __LINE__, __FILE__, "----------------------------------------------", nullptr ); + Msg( __LINE__, __FILE__, "------------------ Setup -----------------", nullptr ); + Msg( __LINE__, __FILE__, "----------------------------------------------", nullptr ); //-------------------------------------------------------------------------- // Get the version info from the OS. @@ -191,7 +191,7 @@ WindowsVersionInfo::WindowsVersionInfo(void) : DWORD dwBufLen; RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_QUERY_VALUE, &hKey ); - RegQueryValueEx( hKey, "ProductType", NULL, NULL, (LPBYTE) szProductType, &dwBufLen); + RegQueryValueEx( hKey, "ProductType", nullptr, nullptr, (LPBYTE) szProductType, &dwBufLen); RegCloseKey( hKey ); if ( lstrcmpi( "WINNT", szProductType) == 0 ) diff --git a/Core/Tools/Autorun/Wnd_file.cpp b/Core/Tools/Autorun/Wnd_file.cpp index 0db0ade1841..3bba17df3f0 100644 --- a/Core/Tools/Autorun/Wnd_file.cpp +++ b/Core/Tools/Autorun/Wnd_file.cpp @@ -132,7 +132,7 @@ void __cdecl Msg( int line, const char *filename, const char *fmt, ... ) // Make filename. //---------------------------------------------------------------------- const char *temp = strrchr( filename, '\\' ); - if ( temp != NULL || temp[0] != '\0' ) { + if ( temp != nullptr || temp[0] != '\0' ) { temp++; strcpy( szFile, temp ); } @@ -203,10 +203,10 @@ void __cdecl Msg( int line, const char *filename, const wchar_t *fmt, UINT codep memset( szBuffer1, '\0', MAX_PATH * 3 ); memset( szBuffer2, '\0', MAX_PATH * 2 ); - if ( DebugFile == NULL ) { + if ( DebugFile == nullptr ) { return; } - if ( filename == NULL ) { + if ( filename == nullptr ) { return; } @@ -214,7 +214,7 @@ void __cdecl Msg( int line, const char *filename, const wchar_t *fmt, UINT codep // Make filename. //---------------------------------------------------------------------- const char *temp = strrchr( filename, '\\' ); - if ( temp != NULL || temp[0] != '\0' ) { + if ( temp != nullptr || temp[0] != '\0' ) { temp++; length = strlen( temp ); mbstowcs( szFile, temp, length ); @@ -240,7 +240,7 @@ void __cdecl Msg( int line, const char *filename, const wchar_t *fmt, UINT codep // 950 Chinese (Taiwan; Hong Kong SAR, PRC) // 1252 Windows 3.1 Latin 1 (US, Western Europe) //--------------------------------------------------------------------- - WideCharToMultiByte( codepage, 0, szBuffer1, -1, szBuffer3, MAX_PATH*3, NULL, NULL ); + WideCharToMultiByte( codepage, 0, szBuffer1, -1, szBuffer3, MAX_PATH*3, nullptr, nullptr ); length = strlen( szBuffer3 ); nBytes = file.Write( szBuffer3, length ); @@ -306,9 +306,9 @@ void Delete_Msg_File ( void ) wsprintf( buff, "===========================================================\r\n" ); nBytes = file.Write( buff, strlen( buff )); - GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, date, 50 ); -// GetTimeFormat( LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, time, 30 ); - GetTimeFormat( LOCALE_USER_DEFAULT, NULL, NULL, "hh':'mm':'ss tt", time, 30 ); + GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, nullptr, nullptr, date, 50 ); +// GetTimeFormat( LOCALE_USER_DEFAULT, TIME_NOSECONDS, nullptr, nullptr, time, 30 ); + GetTimeFormat( LOCALE_USER_DEFAULT, 0, nullptr, "hh':'mm':'ss tt", time, 30 ); wsprintf( buff, "SETUP: File: %s Date: %s Time: %s.\r\n", DebugFile, date, time ); nBytes = file.Write( buff, strlen( buff )); @@ -347,7 +347,7 @@ StandardFileClass::~StandardFileClass( void ) ASSERT( File_Handle == INVALID_FILE_HANDLE ); #endif #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr == NULL ); + ASSERT( File_Stream_Ptr == nullptr ); #endif ASSERT( Currently_Open == FALSE ); @@ -370,7 +370,7 @@ bool StandardFileClass::Open( const char *no_path_file_name, int open_mode ) // // debug checks... // - ASSERT( no_path_file_name != NULL ); + ASSERT( no_path_file_name != nullptr ); ASSERT( Currently_Open == FALSE ); ASSERT( strlen( no_path_file_name ) < MAX_PATH ); ASSERT( open_mode == MODE_READ_ONLY || @@ -418,7 +418,7 @@ bool StandardFileClass::Open( const char *no_path_file_name, int open_mode ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr == NULL ); + ASSERT( File_Stream_Ptr == nullptr ); // // "r" - open existing file for reading. @@ -475,7 +475,7 @@ bool StandardFileClass::Open( const char *no_path_file_name, int open_mode ) // // if not success with HD open, try CD // - if ( File_Stream_Ptr == NULL ) { + if ( File_Stream_Ptr == nullptr ) { // // try CD open @@ -488,7 +488,7 @@ bool StandardFileClass::Open( const char *no_path_file_name, int open_mode ) // // not successful? // - if ( File_Stream_Ptr == NULL ) { + if ( File_Stream_Ptr == nullptr ) { return( FALSE ); } @@ -569,12 +569,12 @@ bool StandardFileClass::Close( void ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // no success // @@ -591,7 +591,7 @@ bool StandardFileClass::Close( void ) // // reset file data // - File_Stream_Ptr = NULL; + File_Stream_Ptr = nullptr; Currently_Open = FALSE; // @@ -619,7 +619,7 @@ int StandardFileClass::Read( void *buffer, unsigned long int bytes_to_read ) // // debug checks ( Fails if condition is FALSE ). // - ASSERT( buffer != NULL ); + ASSERT( buffer != nullptr ); ASSERT( bytes_to_read > 0 ); ASSERT( Currently_Open == TRUE ); @@ -644,11 +644,11 @@ int StandardFileClass::Read( void *buffer, unsigned long int bytes_to_read ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // nothing read // @@ -690,11 +690,11 @@ int StandardFileClass::Write( void *buffer, unsigned long int bytes_to_write ) // // debug checks // - ASSERT( buffer != NULL ); + ASSERT( buffer != nullptr ); ASSERT( bytes_to_write > 0 ); ASSERT( Currently_Open == TRUE ); - if ( buffer == NULL ) { + if ( buffer == nullptr ) { return( 0 ); } if ( bytes_to_write < 1 ) { @@ -724,11 +724,11 @@ int StandardFileClass::Write( void *buffer, unsigned long int bytes_to_write ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // nothing written // @@ -788,12 +788,12 @@ bool StandardFileClass::Seek( int distance, int seek_file_position ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // error // @@ -853,11 +853,11 @@ int StandardFileClass::Tell( void ) #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // error // @@ -906,11 +906,11 @@ int StandardFileClass::Query_Size( void ) #endif #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); + ASSERT( File_Stream_Ptr != nullptr ); // // error? // - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { // // error // @@ -974,7 +974,7 @@ void StandardFileClass::Reset( void ) File_Handle = INVALID_FILE_HANDLE; #endif #if( SUPPORT_STREAMS ) - File_Stream_Ptr = NULL; + File_Stream_Ptr = nullptr; #endif Currently_Open = FALSE; File_Name[ 0 ] = '\0'; @@ -988,8 +988,8 @@ int StandardFileClass::End_Of_File ( void ) #endif #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + ASSERT( File_Stream_Ptr != nullptr ); + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { return( -1 ); } return( feof( File_Stream_Ptr )); @@ -999,8 +999,8 @@ int StandardFileClass::End_Of_File ( void ) int StandardFileClass::Flush ( void ) { #if( SUPPORT_STREAMS ) - ASSERT( File_Stream_Ptr != NULL ); - if ( File_Stream_Ptr == NULL || Currently_Open == FALSE ) { + ASSERT( File_Stream_Ptr != nullptr ); + if ( File_Stream_Ptr == nullptr || Currently_Open == FALSE ) { return( -1 ); } return( fflush( File_Stream_Ptr )); @@ -1031,7 +1031,7 @@ HANDLE Open_File( char const *file_name, int mode ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); // ASSERT( mode == READ || mode == WRITE ); ASSERT( mode == MODE_READ_ONLY || mode == MODE_WRITE_ONLY || @@ -1082,10 +1082,10 @@ HANDLE Open_File( char const *file_name, int mode ) windows_file_handle = CreateFile( file_name, access, share, - NULL, + nullptr, creation, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, - NULL ); + nullptr ); // // error? // @@ -1131,7 +1131,7 @@ bool Close_File( HANDLE handle ) // debug checks... // // ASSERT( handle > INVALID_FILE_HANDLE ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); ASSERT( handle != INVALID_FILE_HANDLE ); // @@ -1149,7 +1149,7 @@ bool Close_File( HANDLE handle ) // // free the entry // - // Windows_File_Handles[ handle ] = NULL; + // Windows_File_Handles[ handle ] = nullptr; // // return success or not @@ -1180,9 +1180,9 @@ int Read_File( HANDLE handle, void *buffer, unsigned long int bytes_to_read ) // debug checks... // ASSERT( handle > INVALID_FILE_HANDLE ); - ASSERT( buffer != NULL ); + ASSERT( buffer != nullptr ); // ASSERT( bytes_to_read > 0 ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); // Debug_Printf( "Reading file %d\r\n", handle ); @@ -1190,7 +1190,7 @@ int Read_File( HANDLE handle, void *buffer, unsigned long int bytes_to_read ) // (void *) buffer, // (DWORD) bytes_to_read, // (DWORD *) &bytes_actually_read, - // NULL ); + // nullptr ); // // &&& use real HANDLE @@ -1199,7 +1199,7 @@ int Read_File( HANDLE handle, void *buffer, unsigned long int bytes_to_read ) (void *) buffer, (DWORD) bytes_to_read, (DWORD *) &bytes_actually_read, - NULL ); + nullptr ); ASSERT( success == TRUE ); @@ -1226,9 +1226,9 @@ int Write_File( HANDLE handle, void const *buffer, unsigned long int bytes_to_wr // debug checks... // ASSERT( handle != INVALID_FILE_HANDLE ); - ASSERT( buffer != NULL ); + ASSERT( buffer != nullptr ); // ASSERT( bytes_to_write > 0 ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); // Debug_Printf( "Writing file %d\r\n", handle ); @@ -1236,7 +1236,7 @@ int Write_File( HANDLE handle, void const *buffer, unsigned long int bytes_to_wr // buffer, // (DWORD) bytes_to_write, // (DWORD *) &bytes_actually_written, - // NULL ); + // nullptr ); // // &&& make this a real handle @@ -1245,7 +1245,7 @@ int Write_File( HANDLE handle, void const *buffer, unsigned long int bytes_to_wr buffer, (DWORD) bytes_to_write, (DWORD *) &bytes_actually_written, - NULL ); + nullptr ); ASSERT( success == TRUE ); ASSERT( bytes_actually_written == bytes_to_write ); @@ -1277,7 +1277,7 @@ bool Seek_File( HANDLE handle, int distance, int seek_file_location ) ASSERT( seek_file_location == SEEK_SET || seek_file_location == SEEK_CUR || seek_file_location == SEEK_END ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); // // set the seek movement method @@ -1294,7 +1294,7 @@ bool Seek_File( HANDLE handle, int distance, int seek_file_location ) // success = SetFilePointer( Windows_File_Handles[ handle ], // distance, - // NULL, + // nullptr, // move_method ); // @@ -1302,7 +1302,7 @@ bool Seek_File( HANDLE handle, int distance, int seek_file_location ) // success = SetFilePointer( (HANDLE) handle, distance, - NULL, + nullptr, move_method ); if ( success == 0xFFFFFFFF ) { @@ -1324,7 +1324,7 @@ int Tell_File( HANDLE handle ) // debug checks... // ASSERT( handle != INVALID_FILE_HANDLE ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); // // set the seek movement method @@ -1336,7 +1336,7 @@ int Tell_File( HANDLE handle ) // pos = SetFilePointer( handle, 0, // distance to move - NULL, + nullptr, move_method ); if ( pos == 0xFFFFFFFF ) { @@ -1357,9 +1357,9 @@ int File_Size( HANDLE handle ) // debug checks... // ASSERT( handle != INVALID_FILE_HANDLE ); - // ASSERT( Windows_File_Handles[ handle ] != NULL ); + // ASSERT( Windows_File_Handles[ handle ] != nullptr ); - file_size = GetFileSize( handle, NULL ); + file_size = GetFileSize( handle, nullptr ); ASSERT( file_size != 0xFFFFFFFF ); // @@ -1386,7 +1386,7 @@ bool Full_Path_File_Exists( char const *file_name ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); // // if we can open the file for read, it exists... @@ -1424,7 +1424,7 @@ bool HD_File_Exists( char const *file_name ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); strcpy( full_path, HD_Path ); strcat( full_path, file_name ); @@ -1463,7 +1463,7 @@ bool CD_File_Exists( char const *file_name ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); strcpy( full_path, CD_Path ); strcat( full_path, file_name ); @@ -1517,7 +1517,7 @@ int Get_Internal_File_Handle( void ) // if ( ! _initialized ) { for ( i = 0; i < MAX_FILES_OPEN_AT_A_TIME; i ++ ) { - Windows_File_Handles[ i ] = NULL; + Windows_File_Handles[ i ] = nullptr; } _initialized = TRUE; } @@ -1526,7 +1526,7 @@ int Get_Internal_File_Handle( void ) // look for free slot // for ( i = 0; i < MAX_FILES_OPEN_AT_A_TIME; i ++ ) { - if ( Windows_File_Handles[ i ] == NULL ) { + if ( Windows_File_Handles[ i ] == nullptr ) { return( i ); } } @@ -1553,7 +1553,7 @@ bool Full_Path_File_Exists( char const *file_name ) FILE *file_stream_ptr; file_stream_ptr = fopen( file_name, "rb" ); - if ( file_stream_ptr != NULL ) { + if ( file_stream_ptr != nullptr ) { fclose( file_stream_ptr ); return( TRUE ); } @@ -1572,13 +1572,13 @@ bool HD_File_Exists( char const *file_name ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); strcpy( full_path, HD_Path ); strcat( full_path, file_name ); file_stream_ptr = fopen( full_path, "rb" ); - if ( file_stream_ptr != NULL ) { + if ( file_stream_ptr != nullptr ) { fclose( file_stream_ptr ); return( TRUE ); } @@ -1597,13 +1597,13 @@ bool CD_File_Exists( char const *file_name ) // // debug checks... // - ASSERT( file_name != NULL ); + ASSERT( file_name != nullptr ); strcpy( full_path, CD_Path ); strcat( full_path, file_name ); file_stream_ptr = fopen( full_path, "rb" ); - if ( file_stream_ptr != NULL ) { + if ( file_stream_ptr != nullptr ) { fclose( file_stream_ptr ); return( TRUE ); } diff --git a/Core/Tools/Autorun/autorun.cpp b/Core/Tools/Autorun/autorun.cpp index fefdd6ed6e4..2e5a428c2b3 100644 --- a/Core/Tools/Autorun/autorun.cpp +++ b/Core/Tools/Autorun/autorun.cpp @@ -182,7 +182,7 @@ // Global Variables //----------------------------------------------------------------------------- LaunchObjectClass LaunchObject; -MainWindow *GlobalMainWindow = NULL; +MainWindow *GlobalMainWindow = nullptr; int Language = 0; int LanguageToUse = 0; @@ -284,9 +284,9 @@ BOOL CDLocked = FALSE; int WindowsVersion = 0; int NumberArguments = 0; int SongNumber = 0; -HANDLE AppMutex = NULL; -HANDLE GameAppMutex = NULL; -HANDLE SetupAppMutex = NULL; +HANDLE AppMutex = nullptr; +HANDLE GameAppMutex = nullptr; +HANDLE SetupAppMutex = nullptr; @@ -304,7 +304,7 @@ extern ArchiveFileSystem *TheArchiveFileSystem; #endif // stuff needed to compile. -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; HINSTANCE ApplicationHInstance; ///< main application instance const char *g_strFile = "Autorun.str"; @@ -385,7 +385,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd ApplicationHInstance = hInstance; Main::hPrevInstance = hPrevInstance; Main::nCmdShow = nCmdShow; - Main::hModule = GetModuleHandle( NULL ); + Main::hModule = GetModuleHandle( nullptr ); memset( szSetupWindow, '\0', MAX_PATH ); memset( szGameWindow, '\0', MAX_PATH ); @@ -416,9 +416,9 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd // Init Args class. //------------------------------------------------------------------------- Args = new Command_Line_Arguments( hInstance, GetCommandLine()); - if ( Args == NULL ) { -// Error_Message( hInstance, IDS_ERROR, IDS_COMMAND_LINE_ERR, NULL ); - Error_Message( hInstance, "Autorun:Error", "Autorun:CommandLineError", NULL ); + if ( Args == nullptr ) { +// Error_Message( hInstance, IDS_ERROR, IDS_COMMAND_LINE_ERR, nullptr ); + Error_Message( hInstance, "Autorun:Error", "Autorun:CommandLineError", nullptr ); return( 0 ); } Msg( __LINE__, __FILE__, "Args Created." ); @@ -539,8 +539,8 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd // Save off the Current path for use by other stuff. //------------------------------------------------------------------------- _tcscpy( szArgvPath, Args->Get_argv(0)); - _tsplitpath( szArgvPath, drive, dir, NULL, NULL ); - _tmakepath ( szArgvPath, drive, dir, NULL, NULL ); + _tsplitpath( szArgvPath, drive, dir, nullptr, nullptr ); + _tmakepath ( szArgvPath, drive, dir, nullptr, nullptr ); Path_Add_Back_Slash( szArgvPath ); Msg( __LINE__, TEXT(__FILE__), TEXT("szArgvPath = %s."), szArgvPath ); @@ -558,7 +558,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd LoadString( Main::hInstance, IDS_CANT_FIND_FILE, szBuffer1, _MAX_PATH ); MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, _MAX_PATH, szWideBuffer0, _MAX_PATH ); sprintf( szBuffer2, szBuffer1, szWideBuffer0 ); - MessageBox( NULL, szBuffer2, "Autorun", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, szBuffer2, "Autorun", MB_APPLMODAL | MB_OK ); return 0; } */ @@ -583,7 +583,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd //Fix_Single_Ampersands( &szProductName[0], false ); //Fix_Single_Ampersands( &szFullProductName[0], false ); Msg( __LINE__, __FILE__, "szProductName = %s.", szProductName ); - WideCharToMultiByte( CodePage, 0, szProductName, _MAX_PATH, szProduct_Name, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, szProductName, _MAX_PATH, szProduct_Name, _MAX_PATH, nullptr, nullptr ); #else @@ -593,7 +593,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd Msg( __LINE__, __FILE__, "Full Product Name = %ls.", fullProductName.str() ); Msg( __LINE__, __FILE__, "szRegistryKey = %s.", szRegistryKey ); Msg( __LINE__, __FILE__, "szGameWindow = %s.", szGameWindow ); - WideCharToMultiByte( CodePage, 0, productName.str(), productName.getLength()+1, szProduct_Name, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, productName.str(), productName.getLength()+1, szProduct_Name, _MAX_PATH, nullptr, nullptr ); #endif @@ -613,7 +613,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd // If the named mutex object existed before the function call, the function returns // a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS. // Otherwise, the caller created the mutex. - // If the function fails, the return value is NULL. To get extended error + // If the function fails, the return value is null. To get extended error // information, call GetLastError. // // WARNING: DO NOT use this number for any other application except Autorun @@ -623,9 +623,9 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd } else { strcpy( szBuffer, AUTORUN_MUTEX_OBJECT ); } - AppMutex = CreateMutex( NULL, FALSE, szBuffer ); + AppMutex = CreateMutex( nullptr, FALSE, szBuffer ); - if ( AppMutex != NULL && ( GetLastError() == ERROR_ALREADY_EXISTS )) { + if ( AppMutex != nullptr && ( GetLastError() == ERROR_ALREADY_EXISTS )) { Msg( __LINE__, __FILE__, "AppMutex of %s already exists. Exit here.", szBuffer ); @@ -636,7 +636,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd //--------------------------------------------------------------------- // Check if Game/Setup is already running, and is looking for the CDRom. //--------------------------------------------------------------------- - HWND prev = FindWindow( szClassName, NULL ); + HWND prev = FindWindow( szClassName, nullptr ); if( prev ){ //if( IsIconic( prev )){ //ShowWindow( prev, SW_RESTORE ); @@ -648,9 +648,9 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd Msg( __LINE__, __FILE__, "AppMutex of %s created.", szBuffer ); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // if AppMutex was NULL, let through. Perhaps in future we want to trap it? + // if AppMutex was nullptr, let through. Perhaps in future we want to trap it? //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if ( AppMutex == NULL ) { + if ( AppMutex == nullptr ) { } //========================================================================= @@ -659,7 +659,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd // // Return Values // If the function succeeds, the return value is a handle to the mutex object. - // If the function fails, the return value is NULL. To get extended error + // If the function fails, the return value is null. To get extended error // information, call GetLastError. // // WARNING: DO NOT use this number for any other application except Game/Setup. @@ -671,12 +671,12 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd } GameAppMutex = OpenMutex( MUTEX_ALL_ACCESS, FALSE, szBuffer ); - if ( GameAppMutex != NULL ) { + if ( GameAppMutex != nullptr ) { Msg( __LINE__, TEXT(__FILE__), TEXT("Mutex Object of game found.")); Msg( __LINE__, TEXT(__FILE__), TEXT("Looking for Game Window.")); - HWND ccwindow = FindWindow( szGameWindow, NULL ); + HWND ccwindow = FindWindow( szGameWindow, nullptr ); if ( ccwindow ) { Msg( __LINE__, TEXT(__FILE__), TEXT("Found Game Window.")); @@ -690,7 +690,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd Msg( __LINE__, TEXT(__FILE__), TEXT("Looking for Setup Window.")); - ccwindow = FindWindow( szSetupWindow, NULL ); + ccwindow = FindWindow( szSetupWindow, nullptr ); if ( ccwindow ) { Msg( __LINE__, TEXT(__FILE__), TEXT("Found Setup Window.")); @@ -713,11 +713,11 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd //--------------------------------------------------------------------- // Check if Game/Setup is already running, and is looking for the CDRom. //--------------------------------------------------------------------- - HWND prev = FindWindow( szClassName, NULL ); - if ( prev == NULL ) { - prev = FindWindow( szGameWindow, NULL ); - if ( prev == NULL ) { - prev = FindWindow( szSetupWindow, NULL ); + HWND prev = FindWindow( szClassName, nullptr ); + if ( prev == nullptr ) { + prev = FindWindow( szGameWindow, nullptr ); + if ( prev == nullptr ) { + prev = FindWindow( szSetupWindow, nullptr ); } } if( prev ){ @@ -735,7 +735,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd // because we ask the user to insert CD-1 again at the end of the install // to prevent a crash on Windows ME where it tries to access CD-1 again. //--------------------------------------------------------------------- - prev = FindWindow( NULL,"InstallShield Wizard"); + prev = FindWindow( nullptr,"InstallShield Wizard"); if( prev ){ return 0; } @@ -761,7 +761,7 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmd Msg( __LINE__, __FILE__, "szWav[0] = %s.", szWavs[0] ); Msg( __LINE__, __FILE__, "szWav[1] = %s.", szWavs[1] ); - srand(( unsigned )time( NULL )); + srand(( unsigned )time( nullptr )); SongNumber = rand() & 1; // UseSounds = TRUE; @@ -874,32 +874,32 @@ void Prog_End ( void ) CDLocked = false; } - if( Args != NULL ) { + if( Args != nullptr ) { delete( Args ); - Args = NULL; + Args = nullptr; Msg( __LINE__, __FILE__, "Args deleted." ); } - if ( AppMutex != NULL ) { + if ( AppMutex != nullptr ) { CloseHandle( AppMutex ); - AppMutex = NULL; + AppMutex = nullptr; Msg( __LINE__, __FILE__, "AppMutex deleted." ); } - if ( GameAppMutex != NULL) { + if ( GameAppMutex != nullptr) { CloseHandle( GameAppMutex ); - GameAppMutex = NULL; + GameAppMutex = nullptr; } - if ( FontManager != NULL ) { + if ( FontManager != nullptr ) { delete( FontManager ); - FontManager = NULL; + FontManager = nullptr; Msg( __LINE__, __FILE__, "FontManager deleted." ); } - if ( OnlineOptions != NULL ) { + if ( OnlineOptions != nullptr ) { delete( OnlineOptions ); - OnlineOptions = NULL; + OnlineOptions = nullptr; Msg( __LINE__, __FILE__, "OnlineOptions deleted." ); } @@ -929,7 +929,7 @@ int Main::MessageLoop( void ) { MSG msg; - while( GetMessage( &msg, NULL, 0, 0 )) { + while( GetMessage( &msg, nullptr, 0, 0 )) { TranslateMessage( &msg ); DispatchMessage( &msg ); } @@ -998,7 +998,7 @@ void MainWindow::Register( void ) wndclass.hIcon = LoadIcon( Main::hInstance, MAKEINTRESOURCE(1)); // strcpy( szBuffer, "C&C2.ICO" ); -// wndclass.hIcon = (HICON)LoadImage( NULL, szBuffer, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE ); +// wndclass.hIcon = (HICON)LoadImage( nullptr, szBuffer, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE ); wndclass.hCursor = LoadCursor( Main::hInstance, MAKEINTRESOURCE(2) ); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); @@ -1013,12 +1013,12 @@ void MainWindow::Register( void ) FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR)&szMessage, 0, - NULL ); + nullptr ); _stprintf( szBuffer, TEXT( "%s(%lx)" ), szMessage, GetLastError()); Msg( __LINE__, TEXT(__FILE__), TEXT("GetLastError: %s"), szBuffer ); @@ -1048,11 +1048,11 @@ MainWindow::MainWindow( void ) #ifdef LEAN_AND_MEAN - WideCharToMultiByte( CodePage, 0, szFullProductName, _MAX_PATH, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, szFullProductName, _MAX_PATH, szBuffer, _MAX_PATH, nullptr, nullptr ); #else - WideCharToMultiByte( CodePage, 0, fullProductName.str(), fullProductName.getLength()+1, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, fullProductName.str(), fullProductName.getLength()+1, szBuffer, _MAX_PATH, nullptr, nullptr ); #endif @@ -1072,8 +1072,8 @@ MainWindow::MainWindow( void ) 0, 640, 480, - NULL, - NULL, + nullptr, + nullptr, Main::hInstance, (LPTSTR) this ); @@ -1139,7 +1139,7 @@ LRESULT MainWindow::Window_Proc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM decision = DialogBox( Main::hInstance, _TEXT( "BitmapDialog" ), hWnd, Dialog_Box_Proc ); delete( Args ); - Args = NULL; + Args = nullptr; Stop_Sound_Playing(); @@ -1271,7 +1271,7 @@ BOOL MainWindow::Is_Product_Registered( void ) // Get Full path\filename of product to execute ("Play"). //----------------------------------------------------------------------- Size = _MAX_PATH; - if ( RegQueryValueEx( phKey, INSTALL_PATH_KEY, NULL, &Type, (unsigned char *)szGamePath, &Size ) == ERROR_SUCCESS ) { + if ( RegQueryValueEx( phKey, INSTALL_PATH_KEY, nullptr, &Type, (unsigned char *)szGamePath, &Size ) == ERROR_SUCCESS ) { _tcscpy(szWorldbuilderPath, szGamePath); _tcscpy(szPatchgetPath, szGamePath); _tcscat(szGamePath, LAUNCHER_FILENAME); @@ -1302,20 +1302,20 @@ BOOL MainWindow::Is_Product_Registered( void ) if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, key, 0, KEY_ALL_ACCESS, &phKey ) == ERROR_SUCCESS ) { Size = _MAX_PATH; - if ( RegQueryValueEx( phKey, UNINSTALL_STRING_SUBKEY, NULL, &Type, (unsigned char *)aName, &Size ) == ERROR_SUCCESS ) + if ( RegQueryValueEx( phKey, UNINSTALL_STRING_SUBKEY, nullptr, &Type, (unsigned char *)aName, &Size ) == ERROR_SUCCESS ) { //------------------------------------------------------------------------------------------------------ // Look for the uninstall program. If found, set flag. // JFS... need to extract path and command line... 8/26/03 // JFS... further verify that we use a very limited uninstall based on the presence of "IDriver.exe" //------------------------------------------------------------------------------------------------------ - if(strstr(aName,UNINSTALL_EXECUTABLE) != NULL) + if(strstr(aName,UNINSTALL_EXECUTABLE) != nullptr) { char *sp; strcpy( szUninstallPath, aName ); sp = strchr(szUninstallPath,'/'); - if(*sp != NULL) + if(sp != nullptr && *sp != '\0') { strcpy( szUninstallCommandLine, sp ); strcpy( szUninstallPath, aName ); @@ -1368,7 +1368,7 @@ BOOL MainWindow::Is_Product_Registered( void ) // Get Full path\filename of product to execute ("Register.exe"). //----------------------------------------------------------------------- Size = _MAX_PATH; - if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, NULL, &Type, (unsigned char *)szRegisterPath, &Size ) == ERROR_SUCCESS ) { + if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, nullptr, &Type, (unsigned char *)szRegisterPath, &Size ) == ERROR_SUCCESS ) { //-------------------------------------------------------------------- // Check if this executable exists. @@ -1395,7 +1395,7 @@ BOOL MainWindow::Is_Product_Registered( void ) // Get Full path\filename of product to execute ("Register.exe"). //----------------------------------------------------------------------- Size = _MAX_PATH; - if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, NULL, &Type, (unsigned char *)szBuffer, &Size ) == ERROR_SUCCESS ) { + if ( RegQueryValueEx( phKey, INSTALLPATH_SUBKEY, nullptr, &Type, (unsigned char *)szBuffer, &Size ) == ERROR_SUCCESS ) { //-------------------------------------------------------------------- // Check if this executable exists. @@ -1458,8 +1458,8 @@ BOOL MainWindow::Run_Explorer( const char *szString, HWND hWnd, RECT *rect ) // Get current drive/directory from _argv[0]. //-------------------------------------------------------------------------- _tcscpy( szPath, szArgvPath ); - _tsplitpath( szPath, drive, dir, NULL, NULL ); - _tmakepath ( szPath, drive, dir, NULL, NULL ); + _tsplitpath( szPath, drive, dir, nullptr, nullptr ); + _tmakepath ( szPath, drive, dir, nullptr, nullptr ); //-------------------------------------------------------------------------- // Get Windows directory and build path to Explorer. Pas in szPath as @@ -1484,11 +1484,11 @@ BOOL MainWindow::Run_Explorer( const char *szString, HWND hWnd, RECT *rect ) result = CreateProcess( szWindowsPath, // address of module name lpszComLine, // address of command line - NULL, // address of process security attributes - NULL, // address of thread security attributes + nullptr, // address of process security attributes + nullptr, // address of thread security attributes FALSE, // new process inherits handles 0, // creation flags - NULL, // address of new environment block + nullptr, // address of new environment block szCurDir, // address of current directory name &startupinfo, // address of STARTUPINFO &processinfo ); // address of PROCESS_INFORMATION @@ -1539,7 +1539,7 @@ unsigned int MainWindow::Run_Game ( HWND hWnd, RECT *rect ) // Check if C&C is already running, and is looking for the CDRom. // The Autorun keeps asking to "Play" when this happens. //-------------------------------------------------------------------------- - HWND game_window = FindWindow ( szGameWindow, NULL ); + HWND game_window = FindWindow ( szGameWindow, nullptr ); if ( game_window ){ ShowWindow( game_window, SW_RESTORE ); SetForegroundWindow ( game_window ); @@ -1745,11 +1745,11 @@ unsigned int MainWindow::Run_OpenFile(int cd_drive, const char *filename, bool w while ((waiting == true) && (quit != true)) { Sleep(0); - while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // get the message - returnValue = GetMessage( &msg, NULL, 0, 0 ); + returnValue = GetMessage( &msg, nullptr, 0, 0 ); // check for quitting if( returnValue == 0 ) @@ -2059,8 +2059,8 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect ) FindClose( handle ); - _splitpath( szUninstallPath, drive, dir, NULL, NULL ); - _makepath ( szCurDir, drive, dir, NULL, NULL ); + _splitpath( szUninstallPath, drive, dir, nullptr, nullptr ); + _makepath ( szCurDir, drive, dir, nullptr, nullptr ); //======================================================================= // Setup the call @@ -2071,11 +2071,11 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect ) result = CreateProcess( szUninstallPath, // address of module name szUninstallCommandLine, // address of command line - NULL, // address of process security attributes - NULL, // address of thread security attributes + nullptr, // address of process security attributes + nullptr, // address of thread security attributes 0, // new process inherits handles 0, - NULL, // address of new environment block + nullptr, // address of new environment block szCurDir, &startupinfo, // address of STARTUPINFO &processinfo ); // address of PROCESS_INFORMATION @@ -2085,8 +2085,8 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect ) //-------------------------------------------------------------------------- if ( !result ) { - _tsplitpath( szUninstallPath, NULL, NULL, file, ext ); - _tmakepath ( szPath, NULL, NULL, file, ext ); + _tsplitpath( szUninstallPath, nullptr, nullptr, file, ext ); + _tmakepath ( szPath, nullptr, nullptr, file, ext ); Cant_Find_MessageBox ( Main::hInstance, szPath ); // #if(BACKGROUND_BITMAP) @@ -2117,7 +2117,7 @@ unsigned int MainWindow::Run_Uninstall( HWND hWnd, RECT *rect ) //----------------------------------------------------------------------- // Flush the Queue //----------------------------------------------------------------------- - while (PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) { + while (PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE )) { TranslateMessage( &msg ); // DispatchMessage( &msg ); } @@ -2216,7 +2216,7 @@ void MainWindow::Create_Buttons( HWND hWnd, RECT *dlg_rect ) for ( i = 0; i < NUM_BUTTONS; i++ ) { delete( ButtonList[i] ); - ButtonList[i] = NULL; + ButtonList[i] = nullptr; ButtonSizes[i].left = x_pos; // X position. ButtonSizes[i].top = y_pos; // Y position. ButtonSizes[i].right = width; // Button's width. @@ -2505,7 +2505,7 @@ LRESULT CALLBACK Wnd_Proc ( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lPa // msg is called. Then we use the GlobalMainWindow's WindowProc to // process all the individual msgs sent. //-------------------------------------------------------------------------- - if ( GlobalMainWindow == NULL ) { + if ( GlobalMainWindow == nullptr ) { if ( iMessage == WM_CREATE ) { LPCREATESTRUCT lpcs; @@ -2556,7 +2556,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param HDC hDC, memDC, buttonDC, licenseDC; BITMAP bm, fm, lm; -// LOGPALETTE * plgpl = NULL; +// LOGPALETTE * plgpl = nullptr; PAINTSTRUCT ps; static int bits_pixel = 0; static int idCtl = 0; @@ -2657,7 +2657,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param wideBuffer = TheGameText->fetch("Autorun:Title"); wideBuffer2.format(wideBuffer, fullProductName.str()); - WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer, _MAX_PATH, nullptr, nullptr ); #endif @@ -2689,7 +2689,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param HDC hdc = GetDC( window_handle ); FontManager = new FontManagerClass( hdc ); - assert( FontManager != NULL ); + assert( FontManager != nullptr ); ReleaseDC( window_handle, hdc ); //======================================================================= @@ -2870,7 +2870,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //----------------------------------------------------------------------- i = 0; while ( i < NUM_BUTTONS ) { - if ( ButtonList[i] == NULL ) { + if ( ButtonList[i] == nullptr ) { i++; } else { break; @@ -2891,7 +2891,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param // Msg( __LINE__, TEXT(__FILE__), TEXT("buttons_rect = [%d,%d,%d,%d]"), buttons_rect.left, buttons_rect.top, buttons_rect.right, buttons_rect.bottom ); for( j = 0; j < NUM_BUTTONS; j++ ) { - if ( ButtonList[j] != NULL ) { + if ( ButtonList[j] != nullptr ) { buttons_rect.left = __min( ButtonSizes[j].left , buttons_rect.left ); buttons_rect.top = __min( ButtonSizes[j].top , buttons_rect.top ); buttons_rect.right = __max( ButtonSizes[j].left + ButtonSizes[j].right , buttons_rect.right ); @@ -2963,7 +2963,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param // Who is the first button? //----------------------------------------------------------------------- while ( i < NUM_BUTTONS ) { - if ( ButtonList[i] == NULL ) { + if ( ButtonList[i] == nullptr ) { i++; } else { break; @@ -2983,7 +2983,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //------------------------------------------------------------------- // Make areas between the buttons. //------------------------------------------------------------------- - if ( ButtonList[index] != NULL && ButtonList[index+1] != NULL ) { + if ( ButtonList[index] != nullptr && ButtonList[index+1] != nullptr ) { // Area between buttons. BackgroundRect[j].top = ButtonList[index]->Return_Y_Pos() + ButtonList[index]->Return_Height(); @@ -2996,7 +2996,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //------------------------------------------------------------------- // Now look for areas in front of and behind each button. //------------------------------------------------------------------- - if ( ButtonList[index] != NULL ) { + if ( ButtonList[index] != nullptr ) { // Area in front of buttons. BackgroundRect[j].top = ButtonList[index]->Return_Y_Pos(); @@ -3044,8 +3044,8 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //======================================================================= // Set dialog's timer! 1000 = 1 second. //======================================================================= -// timer_id = SetTimer( window_handle, 1000, 250L, NULL ); - timer_id = SetTimer( window_handle, 1000, 500L, NULL ); +// timer_id = SetTimer( window_handle, 1000, 250L, nullptr ); + timer_id = SetTimer( window_handle, 1000, 500L, nullptr ); } return( TRUE ); @@ -3120,13 +3120,13 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param } GameAppMutex = OpenMutex( MUTEX_ALL_ACCESS, FALSE, szBuffer ); - if ( GameAppMutex != NULL ) { + if ( GameAppMutex != nullptr ) { //--------------------------------------------------------- // Handle(s) are closed in the ProgEnd(). //--------------------------------------------------------- - HWND ccwindow = FindWindow( szGameWindow, NULL ); + HWND ccwindow = FindWindow( szGameWindow, nullptr ); if ( ccwindow ) { if( IsIconic( ccwindow )){ ShowWindow( ccwindow, SW_RESTORE ); @@ -3135,7 +3135,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param } else { - ccwindow = FindWindow( szSetupWindow, NULL ); + ccwindow = FindWindow( szSetupWindow, nullptr ); if ( ccwindow ) { if( IsIconic( ccwindow )){ ShowWindow( ccwindow, SW_RESTORE ); @@ -3261,7 +3261,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param HGDIOBJ oldpen = SelectObject( hDC, pen ); SetBkMode( hDC, TRANSPARENT ); - MoveToEx( hDC, BackgroundRect[i].left+1, BackgroundRect[i].top+1, NULL ); + MoveToEx( hDC, BackgroundRect[i].left+1, BackgroundRect[i].top+1, nullptr ); LineTo( hDC, BackgroundRect[i].right-1, BackgroundRect[i].top+1 ); LineTo( hDC, BackgroundRect[i].right-1, BackgroundRect[i].bottom-1 ); LineTo( hDC, BackgroundRect[i].left+1, BackgroundRect[i].bottom-1 ); @@ -3337,7 +3337,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param HGDIOBJ oldpen = SelectObject( hDC, pen ); SetBkMode( hDC, TRANSPARENT ); - MoveToEx( hDC, flicker_rect.left+1, flicker_rect.top+1, NULL ); + MoveToEx( hDC, flicker_rect.left+1, flicker_rect.top+1, nullptr ); LineTo( hDC, flicker_rect.right-1, flicker_rect.top+1 ); LineTo( hDC, flicker_rect.right-1, flicker_rect.bottom-1 ); LineTo( hDC, flicker_rect.left+1, flicker_rect.bottom-1 ); @@ -3462,7 +3462,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param MoveToEx( hDC, // handle to device context outline_rect.left, // x-coordinate of new current position outline_rect.top, // y-coordinate of new current position - NULL ); // pointer to old current position + nullptr ); // pointer to old current position LineTo( hDC, // device context handle outline_rect.right, // x-coordinate of line's ending point @@ -3509,7 +3509,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param MoveToEx( hDC, ButtonList[i]->Return_X_Pos()-1, - ButtonList[i]->Return_Y_Pos()-1, NULL ); + ButtonList[i]->Return_Y_Pos()-1, nullptr ); LineTo( hDC, ButtonList[i]->Return_X_Pos() + ButtonList[i]->Return_Width() + 1, ButtonList[i]->Return_Y_Pos()-1 ); @@ -3560,7 +3560,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param // Print text at bottom of screen. //=================================================================== Rect text_rect; - TTFontClass *fontptr = NULL; + TTFontClass *fontptr = nullptr; if ( b640X480 ) { fontptr = TTTextFontPtr640; @@ -3674,7 +3674,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param //----------------------------------------------------------------------- if ( FirstTime ) { if( UseSounds ) { - PlaySound( szWavs[ SongNumber ], NULL, SND_ASYNC | SND_RESOURCE ); + PlaySound( szWavs[ SongNumber ], nullptr, SND_ASYNC | SND_RESOURCE ); } FirstTime = FALSE; } @@ -3736,10 +3736,10 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param std::wstring wideBuffer = TheGameText->fetch("Autorun:CantRunAVIs"); std::wstring wideBuffer2 = TheGameText->fetch("Autorun:Error"); int length = wideBuffer.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, nullptr, nullptr ); length = wideBuffer2.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL ); - MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, nullptr, nullptr ); + MessageBox( nullptr, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); } */ } @@ -3781,10 +3781,10 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param std::wstring wideBuffer = TheGameText->fetch("Autorun:CantRunHelp"); std::wstring wideBuffer2 = TheGameText->fetch("Autorun:Error"); int length = wideBuffer.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, nullptr, nullptr ); length = wideBuffer2.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL ); - MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, nullptr, nullptr ); + MessageBox( nullptr, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); } */ } @@ -3972,7 +3972,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param for ( i = 0; i < NUM_BUTTONS; i++ ) { delete( ButtonList[i] ); - ButtonList[i] = NULL; + ButtonList[i] = nullptr; } if ( hpal ) { DeleteObject( hpal ); @@ -4012,7 +4012,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param for ( i = 0; i < NUM_BUTTONS; i++ ) { delete( ButtonList[i] ); - ButtonList[i] = NULL; + ButtonList[i] = nullptr; } if ( hpal ) { DeleteObject( hpal ); @@ -4041,7 +4041,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param // Delete the arguments. //----------------------------------------------------------------------- delete( Args ); - Args = NULL; + Args = nullptr; KillTimer( window_handle, timer_id ); EndDialog( window_handle, w_param ); @@ -4092,7 +4092,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param UnrealizeObject( hStaticBrush ); // reset the origin of the brush next time used. point.x = point.y = 0; // create a point. ClientToScreen( window_handle, &point ); // translate into screen coordinates. - SetBrushOrgEx( (HDC)w_param, point.x, point.y, NULL ); // New Origin to use when next selected. + SetBrushOrgEx( (HDC)w_param, point.x, point.y, nullptr ); // New Origin to use when next selected. return((LRESULT) hStaticBrush ); } #endif @@ -4590,7 +4590,7 @@ BOOL CALLBACK Dialog_Box_Proc( HWND window_handle, UINT message, WPARAM w_param void Stop_Sound_Playing ( void ) { - PlaySound( NULL, NULL, SND_ASYNC | SND_FILENAME ); + PlaySound( nullptr, nullptr, SND_ASYNC | SND_FILENAME ); } //***************************************************************************** @@ -4650,7 +4650,7 @@ BOOL Options( Command_Line_Arguments *Orgs ) sprintf( szBuffer3, szBuffer, szVersion ); // strcpy( szBuffer, szRegistryKey ); - MessageBox( NULL, szBuffer3, "Autorun", MB_TASKMODAL | MB_OK ); + MessageBox( nullptr, szBuffer3, "Autorun", MB_TASKMODAL | MB_OK ); result = FALSE; } break; @@ -4807,10 +4807,10 @@ BOOL Valid_Environment ( void ) std::wstring wideBuffer = TheGameText->fetch("GUI:WindowsVersionText"); std::wstring wideBuffer2 = TheGameText->fetch("GUI:WindowsVersionTitle"); length = wideBuffer.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer.c_str(), length+1, szBuffer, _MAX_PATH, nullptr, nullptr ); length = wideBuffer2.length(); - WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, NULL, NULL ); - MessageBox( NULL, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.c_str(), length+1, szBuffer2, _MAX_PATH, nullptr, nullptr ); + MessageBox( nullptr, szBuffer, szBuffer2, MB_APPLMODAL | MB_OK ); } return( result ); @@ -4837,7 +4837,7 @@ HBITMAP LoadResourceBitmap( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR int iNumColors; HRSRC hRsrc; HGLOBAL hGlobal; - HBITMAP hBitmapFinal = NULL; + HBITMAP hBitmapFinal = nullptr; LPBITMAPINFOHEADER lpbi; hBitmapFinal = LoadBitmap( hInstance, lpString ); @@ -4901,7 +4901,7 @@ HPALETTE CreateDIBPalette ( LPBITMAPINFO lpbmi, LPINT lpiNumColors ) LPBITMAPINFOHEADER lpbi; LPLOGPALETTE lpPal; HANDLE hLogPal; - HPALETTE hPal = NULL; + HPALETTE hPal = nullptr; int i; lpbi = (LPBITMAPINFOHEADER) lpbmi; @@ -4976,7 +4976,7 @@ HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR int iNumColors; HRSRC hRsrc; HGLOBAL hGlobal; - HBITMAP hBitmapFinal = NULL; + HBITMAP hBitmapFinal = nullptr; LPBITMAPINFOHEADER lpbi; //-------------------------------------------------------------------------- @@ -4990,7 +4990,7 @@ HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR //----------------------------------------------------------------------- hGlobal = LoadResource( hInstance, hRsrc ); lpbi = (LPBITMAPINFOHEADER) LockResource( hGlobal ); - hdc = GetDC( NULL ); + hdc = GetDC( nullptr ); //-------------------------------------------------------------------------- // Set number of colors ( 2 to the nth ). @@ -5006,7 +5006,7 @@ HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR // Select to the DC and realize it in the System palette. //----------------------------------------------------------------------- // *lphPalette = CreateDIBPalette((LPBITMAPINFO) lpbi, &iNumColors ); - if ( lphPalette != NULL ) { + if ( lphPalette != nullptr ) { SelectPalette( hdc, lphPalette, FALSE ); RealizePalette( hdc ); } @@ -5025,7 +5025,7 @@ HBITMAP LoadResourceButton( HINSTANCE hInstance, LPCTSTR lpString, HPALETTE FAR //----------------------------------------------------------------------- // Free DS and memory used. //----------------------------------------------------------------------- - ReleaseDC( NULL, hdc ); + ReleaseDC( nullptr, hdc ); UnlockResource( hGlobal ); FreeResource( hGlobal ); } @@ -5063,7 +5063,7 @@ void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath ) MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, _MAX_PATH, szWideBuffer0, _MAX_PATH ); swprintf( szWideBuffer2, szWideBuffer, szWideBuffer0 ); - MessageBoxW( NULL, szWideBuffer2, szWideBuffer3, MB_APPLMODAL | MB_OK ); + MessageBoxW( nullptr, szWideBuffer2, szWideBuffer3, MB_APPLMODAL | MB_OK ); } #else @@ -5072,8 +5072,8 @@ void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath ) std::wstring wideBuffer2.format( wideBuffer.str(), productName.str() ); std::wstring wideBuffer3 = TheGameText->fetch("Autorun:CantFind"); - WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, NULL, NULL ); - WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, nullptr, nullptr ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, nullptr, nullptr ); sprintf( szBuffer1, szBuffer3, szPath ); @@ -5081,29 +5081,29 @@ void Cant_Find_MessageBox ( HINSTANCE hInstance, const char *szPath ) if ( strlen( szPath ) < 3 ) { - MessageBox( NULL, "The path specified in Cant_Find_MessageBox was blank", "Autorun", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, "The path specified in Cant_Find_MessageBox was blank", "Autorun", MB_APPLMODAL | MB_OK ); return; } if ( strlen( szBuffer1 ) < 3 && strlen( szBuffer3 ) < 3 ) { - MessageBox( NULL, "***MISSING MESSAGES***... IDS_AUTORUN_TITLE and IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, "***MISSING MESSAGES***... IDS_AUTORUN_TITLE and IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK ); return; } if ( strlen( szBuffer1 ) < 3 ) { - MessageBox( NULL, "***MISSING MESSAGE***... IDS_AUTORUN_TITLE", "Autorun", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, "***MISSING MESSAGE***... IDS_AUTORUN_TITLE", "Autorun", MB_APPLMODAL | MB_OK ); return; } if ( strlen( szBuffer3 ) < 3 ) { - MessageBox( NULL, "***MISSING MESSAGE***... IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, "***MISSING MESSAGE***... IDS_CANT_FIND", "Autorun", MB_APPLMODAL | MB_OK ); return; } - MessageBox( NULL, szBuffer1, szBuffer2, MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, szBuffer1, szBuffer2, MB_APPLMODAL | MB_OK ); #endif } @@ -5139,14 +5139,14 @@ void Error_Message ( HINSTANCE hInstance, const char * title, const char * strin wideBuffer3 = wideBuffer; // insert not provided } - WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, NULL, NULL ); - WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, wideBuffer2.str(), wideBuffer2.getLength()+1, szBuffer2, _MAX_PATH, nullptr, nullptr ); + WideCharToMultiByte( CodePage, 0, wideBuffer3.str(), wideBuffer3.getLength()+1, szBuffer3, _MAX_PATH, nullptr, nullptr ); - MessageBox( NULL, szBuffer3, szBuffer2, MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, szBuffer3, szBuffer2, MB_APPLMODAL | MB_OK ); #endif - MessageBox( NULL, "ERROR_UNDEFINED", "ERROR_UNDEFINED", MB_APPLMODAL | MB_OK ); + MessageBox( nullptr, "ERROR_UNDEFINED", "ERROR_UNDEFINED", MB_APPLMODAL | MB_OK ); } @@ -5161,17 +5161,17 @@ LaunchObjectClass::LaunchObjectClass ( char *path, char *args ) memset( szPath, '\0', _MAX_PATH ); memset( szArgs, '\0', _MAX_PATH ); - if( path != NULL && path[0] != '\0' ) { + if( path != nullptr && path[0] != '\0' ) { strcpy( szPath, path ); } - if( args != NULL && args[0] != '\0' ) { + if( args != nullptr && args[0] != '\0' ) { strcpy( szArgs, args ); } } void LaunchObjectClass::SetPath ( char *path ) { - if( path != NULL && path[0] != '\0' ) { + if( path != nullptr && path[0] != '\0' ) { memset( szPath, '\0', _MAX_PATH ); strcpy( szPath, path ); } @@ -5179,7 +5179,7 @@ void LaunchObjectClass::SetPath ( char *path ) void LaunchObjectClass::SetArgs ( char *args ) { - if( args != NULL && args[0] != '\0' ) { + if( args != nullptr && args[0] != '\0' ) { memset( szArgs, '\0', _MAX_PATH ); strcpy( szArgs, args ); } @@ -5214,7 +5214,7 @@ unsigned int LaunchObjectClass::Launch ( void ) // new working drive (1=A, 2=B, and so forth). This function changes only // the working drive; _chdir changes the working directory. //-------------------------------------------------------------------------- - _makepath( filepath, drive, dir, NULL, NULL ); + _makepath( filepath, drive, dir, nullptr, nullptr ); Path_Remove_Back_Slash( filepath ); abc = (unsigned)( toupper( filepath[0] ) - 'A' + 1 ); @@ -5250,12 +5250,12 @@ unsigned int LaunchObjectClass::Launch ( void ) result = CreateProcess( szPath, // address of module name lpszComLine, // address of command line - NULL, // address of process security attributes - NULL, // address of thread security attributes + nullptr, // address of process security attributes + nullptr, // address of thread security attributes FALSE, // new process inherits handles FALSE, - NULL, // address of new environment block - NULL, // address of current directory name + nullptr, // address of new environment block + nullptr, // address of current directory name &startupinfo, // address of STARTUPINFO &processinfo ); // address of PROCESS_INFORMATION @@ -5265,7 +5265,7 @@ unsigned int LaunchObjectClass::Launch ( void ) if ( !result ) { Msg( __LINE__, TEXT(__FILE__), TEXT("Launch of %s failed." ), lpszComLine ); - _makepath ( filepath, NULL, NULL, file, ext ); + _makepath ( filepath, nullptr, nullptr, file, ext ); Cant_Find_MessageBox ( Main::hInstance, filepath ); } Msg( __LINE__, TEXT(__FILE__), TEXT("Launch of %s succeeded." ), lpszComLine ); @@ -5428,7 +5428,7 @@ int Show_Message ( HWND window_handle, const char * message1, const char * messa wcscat( szString3, L" " ); wcscat( szString3, string2.str() ); - WideCharToMultiByte( CodePage, 0, szString3, _MAX_PATH, szBuffer, _MAX_PATH, NULL, NULL ); + WideCharToMultiByte( CodePage, 0, szString3, _MAX_PATH, szBuffer, _MAX_PATH, nullptr, nullptr ); result = MessageBox( window_handle, szBuffer, "Autorun", MB_RETRYCANCEL|MB_APPLMODAL|MB_SETFOREGROUND ); return( result ); @@ -5452,7 +5452,7 @@ void Reformat_Volume_Name ( const char *volume_name, char *new_volume_name ) temp_volume_name[11] = '\0'; } - if( new_volume_name != NULL ) { + if( new_volume_name != nullptr ) { strcpy( new_volume_name, temp_volume_name ); } } diff --git a/Core/Tools/Autorun/autorun.h b/Core/Tools/Autorun/autorun.h index 65a10e11240..6bc37e82884 100644 --- a/Core/Tools/Autorun/autorun.h +++ b/Core/Tools/Autorun/autorun.h @@ -165,7 +165,7 @@ typedef enum { class LaunchObjectClass { public: - LaunchObjectClass ( char *path=NULL, char *args=NULL ); + LaunchObjectClass ( char *path=nullptr, char *args=nullptr ); void SetPath ( char *path ); void SetArgs ( char *args ); @@ -228,7 +228,7 @@ class MainWindow : public Window static void Register ( void ); static void Reset_Class_Name ( char *string ) { - if ( string != NULL && string[0] != '\0' ) { + if ( string != nullptr && string[0] != '\0' ) { strcpy( szClassName, string ); } }; diff --git a/Core/Tools/Autorun/locale.cpp b/Core/Tools/Autorun/locale.cpp index 1abc9cf1035..422c35f5ff1 100644 --- a/Core/Tools/Autorun/locale.cpp +++ b/Core/Tools/Autorun/locale.cpp @@ -91,7 +91,7 @@ typedef struct INDEX* pIndex[LOCALE_BANK_COUNT]; /* array of string indices */ } LOCALE_INSTANCE; -static LOCALE_INSTANCE *lx = NULL; +static LOCALE_INSTANCE *lx = nullptr; /*************************************************************************/ /* initialization/restore */ @@ -100,10 +100,10 @@ static LOCALE_INSTANCE *lx = NULL; /* helper function to make assertions for initialization clearer */ int LOCALE_isinitialized( void ) { - if ( lx == NULL ) { + if ( lx == nullptr ) { // TRACE("LOCALE API is not initialized - call LOCALE_init before calling LOCALE functions\n"); } - return( lx != NULL ); + return( lx != nullptr ); } /* @@ -148,11 +148,11 @@ int LOCALE_init(void) int ok = 0; /* ensure locale module is NOT already initialized */ - ASSERT(lx == NULL); /* can only call LOCALE_init after a restore or once, cannot double init locale API */ + ASSERT(lx == nullptr); /* can only call LOCALE_init after a restore or once, cannot double init locale API */ /* allocate instance */ lx = (LOCALE_INSTANCE*)galloc(sizeof(LOCALE_INSTANCE)); - if (lx != NULL) { + if (lx != nullptr) { memset(lx, 0, sizeof(LOCALE_INSTANCE)); ok = 1; } @@ -198,10 +198,10 @@ void LOCALE_restore(void) { int i; - if( lx != NULL ) { + if( lx != nullptr ) { ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */ - ASSERT(lx != NULL); + ASSERT(lx != nullptr); /* free any language tables */ for (i = 0; i < LOCALE_BANK_COUNT; i++) { @@ -213,7 +213,7 @@ void LOCALE_restore(void) /* free instance */ gfree(lx); - lx = NULL; + lx = nullptr; } } @@ -508,7 +508,7 @@ static int readheader( GSTREAM* g ) static int readstrings( GSTREAM* g, int LanguageID ) { - Msg( __LINE__, __FILE__, "readstrings:: g ok? %d.", ((g!= NULL)?1:0)); + Msg( __LINE__, __FILE__, "readstrings:: g ok? %d.", ((g!= nullptr)?1:0)); int ok = 0; @@ -567,11 +567,11 @@ int LOCALE_loadtable(const char* PathName, int LanguageID) GSTREAM* g; ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */ - ASSERT(lx->pBank[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */ - ASSERT(lx->pIndex[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */ + ASSERT(lx->pBank[lx->BankIndex] == nullptr); /* bank must be empty before loading a new table */ + ASSERT(lx->pIndex[lx->BankIndex] == nullptr); /* bank must be empty before loading a new table */ g = gopen( PathName ); - if( g != NULL ) { + if( g != nullptr ) { Msg( __LINE__, __FILE__, "LOCALE_loadtable-- file opened." ); @@ -637,19 +637,19 @@ int LOCALE_loadtable(const char* PathName, int LanguageID) void LOCALE_freetable(void) { - if( lx != NULL ) { + if( lx != nullptr ) { ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */ ASSERT(lx->pBank[lx->BankIndex]); /* table must be loaded before calling this function */ /* free string bank */ gfree(lx->pBank[lx->BankIndex]); - lx->pBank[lx->BankIndex] = NULL; + lx->pBank[lx->BankIndex] = nullptr; /* if the bank has an index loaded, free that as well */ if (lx->pIndex[lx->BankIndex]) { gfree(lx->pIndex[lx->BankIndex]); - lx->pIndex[lx->BankIndex] = NULL; + lx->pIndex[lx->BankIndex] = nullptr; } } } @@ -714,12 +714,12 @@ static int getstringbyindex( unsigned short key, const INDEX* pIndex ) unsigned char* base; /* pointer to base of string id table */ ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */ - ASSERT(pIndex != NULL); /* index not loaded - .loc file must have index created (use -i option) */ + ASSERT(pIndex != nullptr); /* index not loaded - .loc file must have index created (use -i option) */ base = ((unsigned char*)pIndex) + LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET; result = (unsigned short*)bsearch((unsigned char *)&key, base, pIndex->StringCount, 4, compare); - if (result != NULL) { + if (result != nullptr) { /* index is the second unsigned short */ ++result; index = *result; @@ -731,14 +731,14 @@ static int getstringbyindex( unsigned short key, const INDEX* pIndex ) const char* LOCALE_getstring( int StringID ) { - const char* p; /* pointer to string, NULL if string cannot be found */ + const char* p; /* pointer to string, nullptr if string cannot be found */ Msg( __LINE__, __FILE__, "Locale_getstring::( %d ).", StringID ); ASSERT( LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */ /* get string array index from the index if it exists */ - if ( lx->pIndex[ lx->BankIndex ] != NULL ) { + if ( lx->pIndex[ lx->BankIndex ] != nullptr ) { StringID = getstringbyindex((unsigned short)StringID, lx->pIndex[lx->BankIndex]); } @@ -766,7 +766,7 @@ const char* LOCALE_getstring( int StringID ) } else { - p = NULL; + p = nullptr; } Msg( __LINE__, __FILE__, L"%s", 1252, (wchar_t *)p ); @@ -823,12 +823,12 @@ int LOCALElanguageid = 0; const char* LOCALE_getstr( const void* pLocFile, int StringID ) { - const char* p; /* pointer to string, NULL if string cannot be found */ + const char* p; /* pointer to string, nullptr if string cannot be found */ HEADER* pHeader; BANK* pBank; - ASSERT(pLocFile != NULL); + ASSERT(pLocFile != nullptr); pHeader = (LOCALEFILE_HEADERCHUNK*)(pLocFile); ASSERT(pHeader->ChunkID == LOCALEFILE_HEADERCHUNKID); @@ -856,7 +856,7 @@ const char* LOCALE_getstr( const void* pLocFile, int StringID ) p += offset; } else { - p = NULL; + p = nullptr; } return p; diff --git a/Core/Tools/Babylon/Babylon.cpp b/Core/Tools/Babylon/Babylon.cpp index 7354eefcb9a..2974163c51d 100644 --- a/Core/Tools/Babylon/Babylon.cpp +++ b/Core/Tools/Babylon/Babylon.cpp @@ -35,11 +35,11 @@ static char THIS_FILE[] = __FILE__; #endif char AppTitle[200]; -CBabylonDlg *MainDLG = NULL; +CBabylonDlg *MainDLG = nullptr; static const char *AppName = "Babylon:"; static int AlreadyRunning( void ); -static HWND FoundWindow = NULL; +static HWND FoundWindow = nullptr; ///////////////////////////////////////////////////////////////////////////// // CBabylonApp @@ -62,8 +62,8 @@ CBabylonApp::CBabylonApp() // The one and only CBabylonApp object CBabylonApp theApp; -TransDB *BabylonstrDB = NULL; -TransDB *MainDB = NULL; +TransDB *BabylonstrDB = nullptr; +TransDB *MainDB = nullptr; char BabylonstrFilename[_MAX_PATH]; char MainXLSFilename[_MAX_PATH]; char DialogPath[_MAX_PATH]; @@ -208,7 +208,7 @@ BOOL CALLBACK EnumAllWindowsProc(HWND hWnd, LPARAM lParam) return FALSE; } - FoundWindow = NULL; + FoundWindow = nullptr; return TRUE; } @@ -227,7 +227,7 @@ BOOL CALLBACK EnumAllWindowsProcExact(HWND hWnd, LPARAM lParam) return FALSE; } - FoundWindow = NULL; + FoundWindow = nullptr; return TRUE; } diff --git a/Core/Tools/Babylon/BabylonDlg.cpp b/Core/Tools/Babylon/BabylonDlg.cpp index 27706df01f2..a341ee732a0 100644 --- a/Core/Tools/Babylon/BabylonDlg.cpp +++ b/Core/Tools/Babylon/BabylonDlg.cpp @@ -196,7 +196,7 @@ END_MESSAGE_MAP() IMPLEMENT_DYNAMIC(CBabylonDlg, CDialog); -CBabylonDlg::CBabylonDlg(CWnd* pParent /*=NULL*/) +CBabylonDlg::CBabylonDlg(CWnd* pParent /*=nullptr*/) : CDialog(CBabylonDlg::IDD, pParent) { //{{AFX_DATA_INIT(CBabylonDlg) @@ -204,16 +204,16 @@ CBabylonDlg::CBabylonDlg(CWnd* pParent /*=NULL*/) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - m_pAutoProxy = NULL; + m_pAutoProxy = nullptr; } CBabylonDlg::~CBabylonDlg() { // If there is an automation proxy for this dialog, set - // its back pointer to this dialog to NULL, so it knows + // its back pointer to this dialog to nullptr, so it knows // the dialog has been deleted. - if (m_pAutoProxy != NULL) - m_pAutoProxy->m_pDialog = NULL; + if (m_pAutoProxy != nullptr) + m_pAutoProxy->m_pDialog = nullptr; } @@ -266,7 +266,7 @@ BOOL CBabylonDlg::OnInitDialog() ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) + if (pSysMenu != nullptr) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); @@ -427,7 +427,7 @@ BOOL CBabylonDlg::CanExit() // If the proxy object is still around, then the automation // controller is still holding on to this application. Leave // the dialog around, but hide its UI. - if (m_pAutoProxy != NULL) + if (m_pAutoProxy != nullptr) { ShowWindow(SW_HIDE); return FALSE; @@ -451,7 +451,7 @@ BOOL CBabylonDlg::CanExit() //DEL } //DEL else //DEL { -//DEL SelectFile ( NULL ); +//DEL SelectFile ( nullptr ); //DEL } //DEL delete dlg; //DEL } @@ -684,7 +684,7 @@ void CBabylonDlg::Status( const char *string, int log ) int CBabylonDlg::SaveLog() { - FILE *log = NULL; + FILE *log = nullptr; EDITSTREAM es; CRichEditCtrl *rec = (CRichEditCtrl *) GetDlgItem ( IDC_LOG ); int ok = FALSE; @@ -759,7 +759,7 @@ static int readToEndOfQuote( FILE *file, char *in, char *out, char *wavefile, in { if ( !(ch = *in++)) { - in = NULL; // have exhausted the input buffer + in = nullptr; // have exhausted the input buffer ch = getc ( file ); } } @@ -835,7 +835,7 @@ static int readToEndOfQuote( FILE *file, char *in, char *out, char *wavefile, in { if ( !(ch = *in++)) { - in = NULL; // have exhausted the input buffer + in = nullptr; // have exhausted the input buffer ch = getc ( file ); } } @@ -1037,8 +1037,8 @@ static int getLabelCount( char *filename ) int CBabylonDlg::LoadStrFile ( TransDB *db, const char *filename, void (*cb) ( void ) ) { - FILE *file = NULL; - BabylonLabel *label = NULL; + FILE *file = nullptr; + BabylonLabel *label = nullptr; int status = FALSE; int line_number = 0; int label_count = 0; @@ -1128,7 +1128,7 @@ int CBabylonDlg::LoadStrFile ( TransDB *db, const char *filename, void (*cb) ( v { cb (); } - label = NULL; + label = nullptr; } status = TRUE; @@ -1555,7 +1555,7 @@ int CBabylonDlg::UpdateLabel( BabylonLabel *source, BabylonLabel *destination, U if ( !stext->Matched () ) { int result; - BabylonText *match = NULL; + BabylonText *match = nullptr; if ( update && !skip ) { @@ -2076,7 +2076,7 @@ int CBabylonDlg::MatchText ( BabylonText *text, BabylonLabel *label, BabylonText CMatchDlg dlg; int result; - *match = NULL; + *match = nullptr; sprintf ( buffer, "Text: %s\n\nLabel:%s\n", text->GetSB (), label->NameSB () ); // TODO: Add your control notification handler code here @@ -2128,7 +2128,7 @@ void CBabylonDlg::OnImport() { if ( CanOperate ()) { - CFileDialog fd ( TRUE , NULL, "*.xls", OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ); + CFileDialog fd ( TRUE , nullptr, "*.xls", OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ); if ( fd.DoModal () == IDOK ) { @@ -2159,7 +2159,7 @@ int CBabylonDlg::ValidateStrFile( const char *filename) PROCESS_INFORMATION ProcessInfo; const char *results = "strcheck.rst"; int errors = 0; - FILE *file = NULL; + FILE *file = nullptr; StartupInfo.cb = sizeof(STARTUPINFO); StartupInfo.dwFlags = STARTF_USESHOWWINDOW; @@ -2175,15 +2175,14 @@ int CBabylonDlg::ValidateStrFile( const char *filename) sprintf ( buffer, "strcheck %s %s", filename, results ); - if (!CreateProcess( - NULL, + if (!CreateProcess( nullptr, buffer, - NULL, - NULL, + nullptr, + nullptr, FALSE, 0, - NULL, - NULL, + nullptr, + nullptr, &StartupInfo, &ProcessInfo)) { @@ -2497,7 +2496,7 @@ void CBabylonDlg::OnTranslations() void CBabylonDlg::OnSelchangeCombolang() { - LANGINFO *info = NULL; + LANGINFO *info = nullptr; int index; index = combo->GetCurSel (); @@ -2557,7 +2556,7 @@ void CBabylonDlg::OnSent() // TODO: Add your control notification handler code here if ( CanOperate ()) { - CFileDialog fd ( TRUE , NULL, "*.xls", OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ); + CFileDialog fd ( TRUE , nullptr, "*.xls", OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR ); if ( fd.DoModal () == IDOK ) { diff --git a/Core/Tools/Babylon/BabylonDlg.h b/Core/Tools/Babylon/BabylonDlg.h index 677e782611b..fbf9900e407 100644 --- a/Core/Tools/Babylon/BabylonDlg.h +++ b/Core/Tools/Babylon/BabylonDlg.h @@ -90,9 +90,9 @@ class CBabylonDlg : public CDialog int SaveLog ( void ); void Status ( const char *string, int log = TRUE); void Log ( const char *string, LogFormat format = NEW_LINE ); - CBabylonDlg(CWnd* pParent = NULL); // standard constructor + CBabylonDlg(CWnd* pParent = nullptr); // standard constructor virtual ~CBabylonDlg(); - int LoadStrFile ( TransDB *db, const char *fileaname, void (*cb ) (void ) = NULL ); + int LoadStrFile ( TransDB *db, const char *fileaname, void (*cb ) (void ) = nullptr ); void Ready ( void ) { Status ( "Ready", FALSE ); ProgressComplete(); }; // Dialog Data diff --git a/Core/Tools/Babylon/DlgProxy.cpp b/Core/Tools/Babylon/DlgProxy.cpp index 6442aa5c774..86a51df1034 100644 --- a/Core/Tools/Babylon/DlgProxy.cpp +++ b/Core/Tools/Babylon/DlgProxy.cpp @@ -47,7 +47,7 @@ CBabylonDlgAutoProxy::CBabylonDlgAutoProxy() // main window pointer. Set the proxy's internal pointer // to point to the dialog, and set the dialog's back pointer to // this proxy. - ASSERT (AfxGetApp()->m_pMainWnd != NULL); + ASSERT (AfxGetApp()->m_pMainWnd != nullptr); ASSERT_VALID (AfxGetApp()->m_pMainWnd); ASSERT_KINDOF(CBabylonDlg, AfxGetApp()->m_pMainWnd); m_pDialog = (CBabylonDlg*) AfxGetApp()->m_pMainWnd; @@ -59,8 +59,8 @@ CBabylonDlgAutoProxy::~CBabylonDlgAutoProxy() // To terminate the application when all objects created with // with automation, the destructor calls AfxOleUnlockApp. // Among other things, this will destroy the main dialog - if (m_pDialog != NULL) - m_pDialog->m_pAutoProxy = NULL; + if (m_pDialog != nullptr) + m_pDialog->m_pAutoProxy = nullptr; AfxOleUnlockApp(); } diff --git a/Core/Tools/Babylon/ExportDlg.cpp b/Core/Tools/Babylon/ExportDlg.cpp index 991bc7a803f..4fd6a980879 100644 --- a/Core/Tools/Babylon/ExportDlg.cpp +++ b/Core/Tools/Babylon/ExportDlg.cpp @@ -36,7 +36,7 @@ static int max_index; // CExportDlg dialog -CExportDlg::CExportDlg(CWnd* pParent /*=NULL*/) +CExportDlg::CExportDlg(CWnd* pParent /*=nullptr*/) : CDialog(CExportDlg::IDD, pParent) { //{{AFX_DATA_INIT(CExportDlg) @@ -149,7 +149,7 @@ BOOL CExportDlg::OnInitDialog() // TODO: Add extra initialization here combo = (CComboBox *) GetDlgItem ( IDC_COMBOLANG ); - combo->SetItemDataPtr ( 0, NULL ); + combo->SetItemDataPtr ( 0, nullptr ); options.filter = TR_CHANGES; options.include_comments = FALSE; @@ -198,7 +198,7 @@ BOOL CExportDlg::OnInitDialog() void CExportDlg::OnSelchangeCombolang() { // TODO: Add your control notification handler code here - LANGINFO *info = NULL; + LANGINFO *info = nullptr; int index; CButton *export_button = (CButton *) GetDlgItem ( IDOK ); CComboBox *combo = (CComboBox *) GetDlgItem ( IDC_COMBOLANG ); diff --git a/Core/Tools/Babylon/ExportDlg.h b/Core/Tools/Babylon/ExportDlg.h index af799753f60..63a9c5b9478 100644 --- a/Core/Tools/Babylon/ExportDlg.h +++ b/Core/Tools/Babylon/ExportDlg.h @@ -40,7 +40,7 @@ class CExportDlg : public CDialog char* Filename ( void ) { return filename; }; TROPTIONS* Options ( void ) { return &options; }; - CExportDlg(CWnd* pParent = NULL); // standard constructor + CExportDlg(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CExportDlg) diff --git a/Core/Tools/Babylon/GenerateDlg.cpp b/Core/Tools/Babylon/GenerateDlg.cpp index aa7adfa2f4e..b54905f3cff 100644 --- a/Core/Tools/Babylon/GenerateDlg.cpp +++ b/Core/Tools/Babylon/GenerateDlg.cpp @@ -34,7 +34,7 @@ static char THIS_FILE[] = __FILE__; // CGenerateDlg dialog -CGenerateDlg::CGenerateDlg(CWnd* pParent /*=NULL*/) +CGenerateDlg::CGenerateDlg(CWnd* pParent /*=nullptr*/) : CDialog(CGenerateDlg::IDD, pParent) { options.format = GN_UNICODE; diff --git a/Core/Tools/Babylon/GenerateDlg.h b/Core/Tools/Babylon/GenerateDlg.h index 1be84d2b50b..8e5248b99d3 100644 --- a/Core/Tools/Babylon/GenerateDlg.h +++ b/Core/Tools/Babylon/GenerateDlg.h @@ -43,7 +43,7 @@ class CGenerateDlg : public CDialog // Construction public: - CGenerateDlg(CWnd* pParent = NULL); // standard constructor + CGenerateDlg(CWnd* pParent = nullptr); // standard constructor char* FilePrefix ( void ) { return filename; }; GNOPTIONS* Options ( void ) { return &options; }; diff --git a/Core/Tools/Babylon/MatchDlg.cpp b/Core/Tools/Babylon/MatchDlg.cpp index a01c513aeb0..a0a14e78765 100644 --- a/Core/Tools/Babylon/MatchDlg.cpp +++ b/Core/Tools/Babylon/MatchDlg.cpp @@ -29,18 +29,18 @@ static char THIS_FILE[] = __FILE__; #endif -BabylonText *MatchingBabylonText = NULL; +BabylonText *MatchingBabylonText = nullptr; BabylonText *MatchOriginalText; BabylonLabel *MatchLabel; #define MAX_MATCH 256 -static BabylonText *current_match = NULL; +static BabylonText *current_match = nullptr; ///////////////////////////////////////////////////////////////////////////// // CMatchDlg dialog -CMatchDlg::CMatchDlg(CWnd* pParent /*=NULL*/) +CMatchDlg::CMatchDlg(CWnd* pParent /*=nullptr*/) : CDialog(CMatchDlg::IDD, pParent) { //{{AFX_DATA_INIT(CMatchDlg) @@ -74,14 +74,14 @@ void CMatchDlg::OnCancel() { // TODO: Add extra cleanup here - MatchingBabylonText = NULL; + MatchingBabylonText = nullptr; CDialog::OnCancel(); } void CMatchDlg::OnNomatch() { // TODO: Add your control notification handler code here - MatchingBabylonText = NULL; + MatchingBabylonText = nullptr; CDialog::OnOK (); } @@ -112,7 +112,7 @@ BOOL CMatchDlg::OnInitDialog() SetWindowText ( buffer ); CDialog::OnInitDialog(); - current_match = NULL; + current_match = nullptr; newtext = (CStatic *) GetDlgItem ( IDC_NEWTEXT ); newtext->SetWindowText ( MatchOriginalText->GetSB()); @@ -149,7 +149,7 @@ BOOL CMatchDlg::OnInitDialog() combo->SetCurSel ( 0 ); OnSelchangeMatchcombo(); - MatchingBabylonText = NULL; + MatchingBabylonText = nullptr; // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control @@ -173,7 +173,7 @@ void CMatchDlg::OnSelchangeMatchcombo() } else { - current_match = NULL; + current_match = nullptr; } } diff --git a/Core/Tools/Babylon/MatchDlg.h b/Core/Tools/Babylon/MatchDlg.h index 56fa8dacc05..d6bcd7f247e 100644 --- a/Core/Tools/Babylon/MatchDlg.h +++ b/Core/Tools/Babylon/MatchDlg.h @@ -31,7 +31,7 @@ class CMatchDlg : public CDialog { // Construction public: - CMatchDlg(CWnd* pParent = NULL); // standard constructor + CMatchDlg(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CMatchDlg) diff --git a/Core/Tools/Babylon/ProceedDlg.cpp b/Core/Tools/Babylon/ProceedDlg.cpp index 46bf943fd74..30ceb05a443 100644 --- a/Core/Tools/Babylon/ProceedDlg.cpp +++ b/Core/Tools/Babylon/ProceedDlg.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // ProceedDlg dialog -ProceedDlg::ProceedDlg(const char *nmessage, CWnd* pParent /*=NULL*/) +ProceedDlg::ProceedDlg(const char *nmessage, CWnd* pParent /*=nullptr*/) : CDialog(ProceedDlg::IDD, pParent) { //{{AFX_DATA_INIT(ProceedDlg) diff --git a/Core/Tools/Babylon/ProceedDlg.h b/Core/Tools/Babylon/ProceedDlg.h index ee42c7809be..5584d4368f3 100644 --- a/Core/Tools/Babylon/ProceedDlg.h +++ b/Core/Tools/Babylon/ProceedDlg.h @@ -30,7 +30,7 @@ class ProceedDlg : public CDialog // Construction const char *message; public: - ProceedDlg(const char *message, CWnd* pParent = NULL); // standard constructor + ProceedDlg(const char *message, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ProceedDlg) diff --git a/Core/Tools/Babylon/Report.cpp b/Core/Tools/Babylon/Report.cpp index 5fe3a770479..ac345d828f8 100644 --- a/Core/Tools/Babylon/Report.cpp +++ b/Core/Tools/Babylon/Report.cpp @@ -34,7 +34,7 @@ static char THIS_FILE[] = __FILE__; // CReport dialog -CReport::CReport(CWnd* pParent /*=NULL*/) +CReport::CReport(CWnd* pParent /*=nullptr*/) : CDialog(CReport::IDD, pParent) { @@ -170,7 +170,7 @@ void CReport::OnOK() } // get the filename - CFileDialog fd ( FALSE , NULL, "*.txt", OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR ); + CFileDialog fd ( FALSE , nullptr, "*.txt", OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR ); if ( fd.DoModal () != IDOK ) { diff --git a/Core/Tools/Babylon/Report.h b/Core/Tools/Babylon/Report.h index 93a66d12cd9..f159ef82dbc 100644 --- a/Core/Tools/Babylon/Report.h +++ b/Core/Tools/Babylon/Report.h @@ -44,7 +44,7 @@ class CReport : public CDialog // Construction public: - CReport(CWnd* pParent = NULL); // standard constructor + CReport(CWnd* pParent = nullptr); // standard constructor char* Filename ( void ) { return filename; }; RPOPTIONS* Options ( void ) { return &options; }; diff --git a/Core/Tools/Babylon/RetranslateDlg.cpp b/Core/Tools/Babylon/RetranslateDlg.cpp index d586c668a83..5b1506e1eb7 100644 --- a/Core/Tools/Babylon/RetranslateDlg.cpp +++ b/Core/Tools/Babylon/RetranslateDlg.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // RetranslateDlg dialog -RetranslateDlg::RetranslateDlg(CWnd* pParent /*=NULL*/) +RetranslateDlg::RetranslateDlg(CWnd* pParent /*=nullptr*/) : CDialog(RetranslateDlg::IDD, pParent) { //{{AFX_DATA_INIT(RetranslateDlg) diff --git a/Core/Tools/Babylon/RetranslateDlg.h b/Core/Tools/Babylon/RetranslateDlg.h index 4c7354ff65e..d7e451044c8 100644 --- a/Core/Tools/Babylon/RetranslateDlg.h +++ b/Core/Tools/Babylon/RetranslateDlg.h @@ -34,7 +34,7 @@ class RetranslateDlg : public CDialog BabylonText *newtext; BabylonText *oldtext; - RetranslateDlg(CWnd* pParent = NULL); // standard constructor + RetranslateDlg(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(RetranslateDlg) diff --git a/Core/Tools/Babylon/TransDB.cpp b/Core/Tools/Babylon/TransDB.cpp index 5ef14300b94..1e1ae4d0de4 100644 --- a/Core/Tools/Babylon/TransDB.cpp +++ b/Core/Tools/Babylon/TransDB.cpp @@ -44,7 +44,7 @@ static LANGINFO langinfo[] = { LANGID_KOREAN, "Korean", "ko", "k" }, { LANGID_CHINESE, "Chinese", "ch", "c" }, { LANGID_JABBER, "Jabberwockie", "jb", "e" }, - { LANGID_UNKNOWN, "Unknown", NULL, NULL } + { LANGID_UNKNOWN, "Unknown", nullptr, nullptr } }; LANGINFO *GetLangInfo ( int index ) @@ -55,7 +55,7 @@ LANGINFO *GetLangInfo ( int index ) return &langinfo[index]; } - return NULL; + return nullptr; } LANGINFO *GetLangInfo ( LangID langid ) @@ -73,7 +73,7 @@ LANGINFO *GetLangInfo ( LangID langid ) item++; } - return NULL; + return nullptr; } const char *GetLangName ( LangID langid ) @@ -103,7 +103,7 @@ LANGINFO *GetLangInfo ( char *language ) item++; } - return NULL; + return nullptr; } TransDB* FirstTransDB ( void ) @@ -115,7 +115,7 @@ TransDB* FirstTransDB ( void ) { return (TransDB *) first->Item (); } - return NULL; + return nullptr; } TransDB::TransDB ( const char *cname ) @@ -199,7 +199,7 @@ void TransDB::RemoveLabel ( BabylonLabel *label ) if ( (node = labels.Find ( label )) ) { node->Remove (); - label->SetDB ( NULL ); + label->SetDB ( nullptr ); label_bin->Remove ( label ); delete node; Changed (); @@ -263,7 +263,7 @@ BabylonLabel* TransDB::FirstLabel ( ListSearch& sh ) return (BabylonLabel *) node->Item (); } - return NULL; + return nullptr; } BabylonLabel* TransDB::NextLabel ( ListSearch& sh) @@ -275,7 +275,7 @@ BabylonLabel* TransDB::NextLabel ( ListSearch& sh) return (BabylonLabel *) node->Item (); } - return NULL; + return nullptr; } BabylonText* TransDB::FirstObsolete ( ListSearch& sh ) @@ -287,7 +287,7 @@ BabylonText* TransDB::FirstObsolete ( ListSearch& sh ) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonText* TransDB::NextObsolete ( ListSearch& sh) @@ -299,7 +299,7 @@ BabylonText* TransDB::NextObsolete ( ListSearch& sh) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonLabel* TransDB::FindLabel ( OLECHAR *name ) @@ -346,7 +346,7 @@ BabylonText* TransDB::FindSubText ( OLECHAR *pattern, int item ) label = NextLabel ( sh ); } - return NULL; + return nullptr; } @@ -537,17 +537,17 @@ TransDB* TransDB::Next ( void ) return (TransDB *) next->Item (); } - return NULL; + return nullptr; } void BabylonLabel::init ( void ) { - db = NULL; - comment = NULL; + db = nullptr; + comment = nullptr; line_number = -1; max_len = 0; - name = NULL; + name = nullptr; } BabylonLabel::BabylonLabel ( void ) @@ -587,9 +587,9 @@ void BabylonLabel::RemoveText ( BabylonText *txt ) if ( (node = text.Find ( txt )) ) { node->Remove (); - txt->SetDB ( NULL ); - txt->SetLabel ( NULL ); - txt->SetParent ( NULL ); + txt->SetDB ( nullptr ); + txt->SetLabel ( nullptr ); + txt->SetParent ( nullptr ); delete node; Changed (); } @@ -667,7 +667,7 @@ BabylonText* BabylonLabel::FirstText ( ListSearch& sh ) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonText* BabylonLabel::NextText ( ListSearch& sh) @@ -679,7 +679,7 @@ BabylonText* BabylonLabel::NextText ( ListSearch& sh) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } @@ -699,7 +699,7 @@ BabylonText* BabylonLabel::FindText ( OLECHAR *find_text ) txt = NextText ( sh ); } - return NULL; + return nullptr; } @@ -876,12 +876,12 @@ void BabylonLabel::AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes void BabylonText::init ( void ) { - db = NULL; - label = NULL; + db = nullptr; + label = nullptr; line_number = -1; revision = 1; - text = NULL; - wavefile = NULL; + text = nullptr; + wavefile = nullptr; id = -1; retranslate = FALSE; sent = FALSE; @@ -1087,7 +1087,7 @@ Translation* BabylonText::FirstTranslation ( ListSearch& sh ) return (Translation *) node->Item (); } - return NULL; + return nullptr; } Translation* BabylonText::NextTranslation ( ListSearch& sh) @@ -1099,7 +1099,7 @@ Translation* BabylonText::NextTranslation ( ListSearch& sh) return (Translation *) node->Item (); } - return NULL; + return nullptr; } Translation* BabylonText::GetTranslation ( LangID langid ) @@ -1471,7 +1471,7 @@ int TransDB::Warnings ( CBabylonDlg *dlg ) { if ( dlg ) { - sprintf ( buffer, "Warning:: text at line %5d is NULL", + sprintf ( buffer, "Warning:: text at line %5d is null", text->LineNumber()); dlg->Log ( buffer ); } diff --git a/Core/Tools/Babylon/TransDB.h b/Core/Tools/Babylon/TransDB.h index fd508f9e18c..813f2fafe2e 100644 --- a/Core/Tools/Babylon/TransDB.h +++ b/Core/Tools/Babylon/TransDB.h @@ -123,7 +123,7 @@ class DBAttribs public: - DBAttribs( void ) { parent = NULL; changed = FALSE; processed = FALSE; match = NULL; }; + DBAttribs( void ) { parent = nullptr; changed = FALSE; processed = FALSE; match = nullptr; }; void SetParent ( DBAttribs *new_parent ) { parent = new_parent; }; int IsChanged ( void ) { return changed; }; @@ -135,7 +135,7 @@ class DBAttribs void NotProcessed ( void ) { processed = FALSE; }; void* Matched ( void ) { return match; }; void Match ( void* new_match ) { match = new_match; }; - void NotMatched ( void ) { match = NULL; }; + void NotMatched ( void ) { match = nullptr; }; }; @@ -360,19 +360,19 @@ class TransDB : public DBAttribs ~TransDB ( ); void InvalidateDialog( LangID langid ); - void VerifyDialog( LangID langid, void (*cb) ( void ) = NULL ); - int ReportDialog( DLGREPORT *report, LangID langid, void (*print) ( const char *)= NULL, PMASK pmask= PMASK_ALL ); - int ReportTranslations( TRNREPORT *report, LangID langid, void (*print) ( const char *) = NULL, PMASK pmask = PMASK_ALL ); - void ReportDuplicates ( CBabylonDlg *dlg = NULL ); + void VerifyDialog( LangID langid, void (*cb) ( void ) = nullptr ); + int ReportDialog( DLGREPORT *report, LangID langid, void (*print) ( const char *)= nullptr, PMASK pmask= PMASK_ALL ); + int ReportTranslations( TRNREPORT *report, LangID langid, void (*print) ( const char *) = nullptr, PMASK pmask = PMASK_ALL ); + void ReportDuplicates ( CBabylonDlg *dlg = nullptr ); void AddLabel ( BabylonLabel *label ); void AddText ( BabylonText *text ); void AddObsolete ( BabylonText *text ); void RemoveLabel ( BabylonLabel *label ); void RemoveText ( BabylonText *text ); void RemoveObsolete ( BabylonText *text ); - int Errors ( CBabylonDlg *dlg = NULL ); + int Errors ( CBabylonDlg *dlg = nullptr ); int HasErrors ( void ) { return checked_for_errors ? last_error_count != 0 : FALSE; }; - int Warnings ( CBabylonDlg *dlg = NULL ); + int Warnings ( CBabylonDlg *dlg = nullptr ); int NumLabelsChanged ( void ); int NumLabels ( void ); int NumObsolete ( void ) { return num_obsolete; }; @@ -392,7 +392,7 @@ class TransDB : public DBAttribs void ClearProcessed ( void ); void ClearMatched ( void ); TransDB* Next ( void ); - void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE, void (*cb) ( void ) = NULL ); + void AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes = FALSE, void (*cb) ( void ) = nullptr ); char* Name ( void ) { return name;}; void EnableIDs ( void ) { next_string_id = START_STRING_ID; }; int NewID ( void ) { if ( next_string_id != -1) return next_string_id++; else return -1; }; diff --git a/Core/Tools/Babylon/VIEWDBSII.cpp b/Core/Tools/Babylon/VIEWDBSII.cpp index 98c051408de..bebb55de96a 100644 --- a/Core/Tools/Babylon/VIEWDBSII.cpp +++ b/Core/Tools/Babylon/VIEWDBSII.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // VIEWDBSII dialog -VIEWDBSII::VIEWDBSII(CWnd* pParent /*=NULL*/) +VIEWDBSII::VIEWDBSII(CWnd* pParent /*=nullptr*/) : CDialog(VIEWDBSII::IDD, pParent) { //{{AFX_DATA_INIT(VIEWDBSII) diff --git a/Core/Tools/Babylon/VIEWDBSII.h b/Core/Tools/Babylon/VIEWDBSII.h index a9ea386653b..0a1b31adc79 100644 --- a/Core/Tools/Babylon/VIEWDBSII.h +++ b/Core/Tools/Babylon/VIEWDBSII.h @@ -28,7 +28,7 @@ class VIEWDBSII : public CDialog { // Construction public: - VIEWDBSII(CWnd* pParent = NULL); // standard constructor + VIEWDBSII(CWnd* pParent = nullptr); // standard constructor void OnClose(); BOOL OnInitDialog(); diff --git a/Core/Tools/Babylon/VerifyDlg.cpp b/Core/Tools/Babylon/VerifyDlg.cpp index b339d9ce5dd..03ee23c5cb1 100644 --- a/Core/Tools/Babylon/VerifyDlg.cpp +++ b/Core/Tools/Babylon/VerifyDlg.cpp @@ -35,7 +35,7 @@ static char THIS_FILE[] = __FILE__; // VerifyDlg dialog -VerifyDlg::VerifyDlg( BabylonText *ntext, LangID langid, const char *path, CWnd* pParent /*=NULL*/) +VerifyDlg::VerifyDlg( BabylonText *ntext, LangID langid, const char *path, CWnd* pParent /*=nullptr*/) : CDialog(VerifyDlg::IDD, pParent) { //{{AFX_DATA_INIT(VerifyDlg) @@ -121,8 +121,8 @@ BOOL VerifyDlg::OnInitDialog() stream = AIL_open_stream ( dig, wavefile, 0 ); if ( stream ) { - timer = SetTimer( TIMERID, 300, NULL ); - AIL_stream_ms_position ( stream, &total, NULL ); + timer = SetTimer( TIMERID, 300, nullptr ); + AIL_stream_ms_position ( stream, &total, nullptr ); slider->SetRange ( 0, total ); } #endif @@ -211,7 +211,7 @@ void VerifyDlg::CloseAudio ( void ) if ( stream ) { AIL_close_stream ( stream ); - stream = NULL; + stream = nullptr; } #endif } @@ -225,7 +225,7 @@ void VerifyDlg::OnTimer(UINT nIDEvent) if ( stream ) { long current; - AIL_stream_ms_position ( stream, NULL, ¤t ); + AIL_stream_ms_position ( stream, nullptr, ¤t ); slider->SetPos ( current ); } #endif diff --git a/Core/Tools/Babylon/VerifyDlg.h b/Core/Tools/Babylon/VerifyDlg.h index 04964b6f3f4..0adb56bed2d 100644 --- a/Core/Tools/Babylon/VerifyDlg.h +++ b/Core/Tools/Babylon/VerifyDlg.h @@ -41,7 +41,7 @@ class VerifyDlg : public CDialog CSliderCtrl *slider; // Construction public: - VerifyDlg(BabylonText *ntext, LangID langid, const char *path, CWnd* pParent = NULL); // standard constructor + VerifyDlg(BabylonText *ntext, LangID langid, const char *path, CWnd* pParent = nullptr); // standard constructor void CloseAudio ( void ); // Dialog Data diff --git a/Core/Tools/Babylon/VerifyTextDlg.cpp b/Core/Tools/Babylon/VerifyTextDlg.cpp index 9725ad58ff1..3df24bf744c 100644 --- a/Core/Tools/Babylon/VerifyTextDlg.cpp +++ b/Core/Tools/Babylon/VerifyTextDlg.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // CVerifyTextDlg dialog -CVerifyTextDlg::CVerifyTextDlg( char *trans, char *orig, CWnd* pParent /*=NULL*/) +CVerifyTextDlg::CVerifyTextDlg( char *trans, char *orig, CWnd* pParent /*=nullptr*/) : CDialog(CVerifyTextDlg::IDD, pParent) { //{{AFX_DATA_INIT(CVerifyTextDlg) diff --git a/Core/Tools/Babylon/VerifyTextDlg.h b/Core/Tools/Babylon/VerifyTextDlg.h index fca1dda0fd1..27b28446d04 100644 --- a/Core/Tools/Babylon/VerifyTextDlg.h +++ b/Core/Tools/Babylon/VerifyTextDlg.h @@ -30,7 +30,7 @@ class CVerifyTextDlg : public CDialog char *m_trans; char *m_orig; public: - CVerifyTextDlg(char *trans, char *orig, CWnd* pParent = NULL); // standard constructor + CVerifyTextDlg(char *trans, char *orig, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CVerifyTextDlg) diff --git a/Core/Tools/Babylon/ViewDBsDlg.cpp b/Core/Tools/Babylon/ViewDBsDlg.cpp index 2fd32722ccc..fdc7d614f16 100644 --- a/Core/Tools/Babylon/ViewDBsDlg.cpp +++ b/Core/Tools/Babylon/ViewDBsDlg.cpp @@ -37,7 +37,7 @@ int ViewChanges = FALSE; // CViewDBsDlg dialog -VIEWDBSII::VIEWDBSII(CWnd* pParent /*=NULL*/) +VIEWDBSII::VIEWDBSII(CWnd* pParent /*=nullptr*/) : CDialog(VIEWDBSII::IDD, pParent) { //{{AFX_DATA_INIT(CViewDBsDlg) diff --git a/Core/Tools/Babylon/XLStuff.cpp b/Core/Tools/Babylon/XLStuff.cpp index 59be38979c7..e914708cd91 100644 --- a/Core/Tools/Babylon/XLStuff.cpp +++ b/Core/Tools/Babylon/XLStuff.cpp @@ -32,11 +32,11 @@ static const int xlWorkbookNormal = -4143; static const int xlNoChange = 1; static const int xlLocalSessionChanges = 2; static const int xlWBATWorksheet = -4167; -static _Workbook *workbook = NULL; -static _Application *xl = NULL; -static Workbooks *wbs = NULL; -static Range *range = NULL; -static _Worksheet *ws = NULL; +static _Workbook *workbook = nullptr; +static _Application *xl = nullptr; +static Workbooks *wbs = nullptr; +static Range *range = nullptr; +static _Worksheet *ws = nullptr; static OLECHAR buffer[100*1024]; static VARIANT no, yes, dummy, dummy0, nullstring, empty; @@ -165,8 +165,8 @@ int PutSeparator ( int row ) // .ColorIndex = xlAutomatic // End With int ok = FALSE; - Border *border = NULL; - Borders *borders = NULL; + Border *border = nullptr; + Borders *borders = nullptr; LPDISPATCH dispatch; OLECHAR cellname1[20]; OLECHAR cellname2[20]; @@ -237,15 +237,15 @@ int PutSection ( int row, OLECHAR *title ) { int ok = FALSE; - Range *range = NULL; - Border *border = NULL; - Borders *borders = NULL; - Interior *interior = NULL; + Range *range = nullptr; + Border *border = nullptr; + Borders *borders = nullptr; + Interior *interior = nullptr; LPDISPATCH dispatch; OLECHAR cellname1[20]; OLECHAR cellname2[20]; VARIANT cell1,cell2; - _Worksheet *ws = NULL; + _Worksheet *ws = nullptr; if ( !ws ) { @@ -293,7 +293,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetWeight ( thin ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeTop ); @@ -309,7 +309,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetWeight ( medium ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeRight ); @@ -323,7 +323,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetLineStyle ( none ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeLeft ); @@ -462,16 +462,16 @@ void CloseExcel ( void ) CloseWorkBook (); delete range; - range = NULL; + range = nullptr; delete ws; - ws = NULL; + ws = nullptr; if ( wbs ) { wbs->Close(); delete wbs; - wbs = NULL; + wbs = nullptr; } if ( xl ) @@ -479,7 +479,7 @@ void CloseExcel ( void ) xl->Quit(); xl->ReleaseDispatch (); delete xl; - xl = NULL; + xl = nullptr; } VariantClear ( &nullstring ); @@ -599,7 +599,7 @@ void CloseWorkBook ( void ) workbook->SetSaved ( TRUE ); workbook->Close ( no, nullstring, no ); delete workbook; - workbook = NULL; + workbook = nullptr; } } diff --git a/Core/Tools/Babylon/bin.cpp b/Core/Tools/Babylon/bin.cpp index 0116060b165..03af9d6910f 100644 --- a/Core/Tools/Babylon/bin.cpp +++ b/Core/Tools/Babylon/bin.cpp @@ -29,7 +29,7 @@ Bin::Bin ( int size ) { assert ( size > 0 ); num_buckets = size; - sh_item = NULL; + sh_item = nullptr; bucket = new List[size]; @@ -48,7 +48,7 @@ Bin::~Bin ( ) void Bin::Clear ( void ) { int count = num_buckets; - sh_item = NULL; + sh_item = nullptr; while ( count-- ) { List *head = &bucket[count]; @@ -71,7 +71,7 @@ void* Bin::Get ( OLECHAR *text1, OLECHAR *text2 ) return item->Item(); } - return NULL; + return nullptr; } void* Bin::GetNext ( void ) @@ -83,7 +83,7 @@ void* Bin::GetNext ( void ) return item->Item(); } - return NULL; + return nullptr; } void Bin::Add ( void *data, OLECHAR *text1, OLECHAR *text2 ) @@ -92,7 +92,7 @@ void Bin::Add ( void *data, OLECHAR *text1, OLECHAR *text2 ) List *list; int hash; - sh_item = NULL; + sh_item = nullptr; hash = calc_hash ( text1 ); item = new BinItem ( data, hash, text1, text2 ); @@ -149,7 +149,7 @@ BinItem* Bin::GetNextBinItem ( void ) BinItem* Bin::GetBinItem ( void *item ) { - BinItem *bitem = NULL; + BinItem *bitem = nullptr; int i; @@ -191,7 +191,7 @@ void Bin::Remove ( OLECHAR *text1, OLECHAR *text2 ) void Bin::Remove ( BinItem *item ) { - sh_item = NULL; + sh_item = nullptr; item->Remove (); delete item ; @@ -303,7 +303,7 @@ void* BinID::Get ( int id) return item->Item(); } - return NULL; + return nullptr; } void BinID::Add ( void *data, int id ) @@ -342,7 +342,7 @@ BinIDItem* BinID::GetBinIDItem ( int id ) BinIDItem* BinID::GetBinIDItem ( void *item ) { - BinIDItem *bitem = NULL; + BinIDItem *bitem = nullptr; int i; diff --git a/Core/Tools/Babylon/bin.h b/Core/Tools/Babylon/bin.h index f928b150337..728ae00ad6b 100644 --- a/Core/Tools/Babylon/bin.h +++ b/Core/Tools/Babylon/bin.h @@ -56,14 +56,14 @@ class Bin ~Bin (); void Clear ( void ); - void* Get ( OLECHAR *text1, OLECHAR *text2 = NULL ); + void* Get ( OLECHAR *text1, OLECHAR *text2 = nullptr ); void* GetNext ( void ); - void Add ( void *item, OLECHAR *text1, OLECHAR *text2 = NULL ); - BinItem* GetBinItem ( OLECHAR *text1, OLECHAR *text2 = NULL ); + void Add ( void *item, OLECHAR *text1, OLECHAR *text2 = nullptr ); + BinItem* GetBinItem ( OLECHAR *text1, OLECHAR *text2 = nullptr ); BinItem* GetBinItem ( void *item ); BinItem* GetNextBinItem ( void ); void Remove ( void *item ); - void Remove ( OLECHAR *text1, OLECHAR *text2 = NULL ); + void Remove ( OLECHAR *text1, OLECHAR *text2 = nullptr ); void Remove ( BinItem *item ); diff --git a/Core/Tools/Babylon/excel8.cpp b/Core/Tools/Babylon/excel8.cpp index 18bb32cb760..b3044ffde5c 100644 --- a/Core/Tools/Babylon/excel8.cpp +++ b/Core/Tools/Babylon/excel8.cpp @@ -37,21 +37,21 @@ static char THIS_FILE[] = __FILE__; LPDISPATCH Workbooks::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Workbooks::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH Workbooks::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -67,13 +67,13 @@ LPDISPATCH Workbooks::Add(const VARIANT& Template) void Workbooks::Close() { - InvokeHelper(0x115, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x115, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } long Workbooks::GetCount() { long result; - InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -90,7 +90,7 @@ LPDISPATCH Workbooks::GetItem(const VARIANT& Index) LPUNKNOWN Workbooks::Get_NewEnum() { LPUNKNOWN result; - InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL); + InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, nullptr); return result; } @@ -110,7 +110,7 @@ void Workbooks::OpenText(LPCTSTR Filename, const VARIANT& Origin, const VARIANT& { static BYTE parms[] = VTS_BSTR VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x2ab, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x2ab, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Filename, &Origin, &StartRow, &DataType, TextQualifier, &ConsecutiveDelimiter, &Tab, &Semicolon, &Comma, &Space, &Other, &OtherChar, &FieldInfo, &TextVisualLayout); } @@ -134,42 +134,42 @@ LPDISPATCH Workbooks::Get_Default(const VARIANT& Index) LPDISPATCH _Application::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Application::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetActiveCell() { LPDISPATCH result; - InvokeHelper(0x131, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x131, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetActiveChart() { LPDISPATCH result; - InvokeHelper(0xb7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xb7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } CString _Application::GetActivePrinter() { CString result; - InvokeHelper(0x132, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x132, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -177,82 +177,82 @@ void _Application::SetActivePrinter(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x132, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x132, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } LPDISPATCH _Application::GetActiveSheet() { LPDISPATCH result; - InvokeHelper(0x133, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x133, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetActiveWindow() { LPDISPATCH result; - InvokeHelper(0x2f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x2f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetActiveWorkbook() { LPDISPATCH result; - InvokeHelper(0x134, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x134, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetAddIns() { LPDISPATCH result; - InvokeHelper(0x225, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x225, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetAssistant() { LPDISPATCH result; - InvokeHelper(0x59e, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x59e, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void _Application::Calculate() { - InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Application::GetCells() { LPDISPATCH result; - InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetCharts() { LPDISPATCH result; - InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetColumns() { LPDISPATCH result; - InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetCommandBars() { LPDISPATCH result; - InvokeHelper(0x59f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x59f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Application::GetDDEAppReturnCode() { long result; - InvokeHelper(0x14c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x14c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -260,7 +260,7 @@ void _Application::DDEExecute(long Channel, LPCTSTR String) { static BYTE parms[] = VTS_I4 VTS_BSTR; - InvokeHelper(0x14d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x14d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Channel, String); } @@ -278,7 +278,7 @@ void _Application::DDEPoke(long Channel, const VARIANT& Item, const VARIANT& Dat { static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x14f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x14f, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Channel, &Item, &Data); } @@ -296,7 +296,7 @@ void _Application::DDETerminate(long Channel) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x151, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x151, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Channel); } @@ -346,7 +346,7 @@ LPDISPATCH _Application::Intersect(LPDISPATCH Arg1, LPDISPATCH Arg2, const VARIA LPDISPATCH _Application::GetNames() { LPDISPATCH result; - InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -363,7 +363,7 @@ LPDISPATCH _Application::GetRange(const VARIANT& Cell1, const VARIANT& Cell2) LPDISPATCH _Application::GetRows() { LPDISPATCH result; - InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -398,7 +398,7 @@ VARIANT _Application::_Run2(const VARIANT& Macro, const VARIANT& Arg1, const VAR LPDISPATCH _Application::GetSelection() { LPDISPATCH result; - InvokeHelper(0x93, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x93, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -406,21 +406,21 @@ void _Application::SendKeys(const VARIANT& Keys, const VARIANT& Wait) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x17f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x17f, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Keys, &Wait); } LPDISPATCH _Application::GetSheets() { LPDISPATCH result; - InvokeHelper(0x1e5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1e5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetThisWorkbook() { LPDISPATCH result; - InvokeHelper(0x30a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x30a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -440,42 +440,42 @@ LPDISPATCH _Application::Union(LPDISPATCH Arg1, LPDISPATCH Arg2, const VARIANT& LPDISPATCH _Application::GetWindows() { LPDISPATCH result; - InvokeHelper(0x1ae, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ae, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetWorkbooks() { LPDISPATCH result; - InvokeHelper(0x23c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x23c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetWorksheetFunction() { LPDISPATCH result; - InvokeHelper(0x5a0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x5a0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetWorksheets() { LPDISPATCH result; - InvokeHelper(0x1ee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetExcel4IntlMacroSheets() { LPDISPATCH result; - InvokeHelper(0x245, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x245, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetExcel4MacroSheets() { LPDISPATCH result; - InvokeHelper(0x243, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x243, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -483,7 +483,7 @@ void _Application::ActivateMicrosoftApp(long Index) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x447, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x447, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Index); } @@ -491,7 +491,7 @@ void _Application::AddChartAutoFormat(const VARIANT& Chart, LPCTSTR Name, const { static BYTE parms[] = VTS_VARIANT VTS_BSTR VTS_VARIANT; - InvokeHelper(0xd8, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xd8, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Chart, Name, &Description); } @@ -499,14 +499,14 @@ void _Application::AddCustomList(const VARIANT& ListArray, const VARIANT& ByRow) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x30c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x30c, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &ListArray, &ByRow); } BOOL _Application::GetAlertBeforeOverwriting() { BOOL result; - InvokeHelper(0x3a2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3a2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -514,14 +514,14 @@ void _Application::SetAlertBeforeOverwriting(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x3a2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3a2, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } CString _Application::GetAltStartupPath() { CString result; - InvokeHelper(0x139, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x139, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -529,14 +529,14 @@ void _Application::SetAltStartupPath(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x139, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x139, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } BOOL _Application::GetAskToUpdateLinks() { BOOL result; - InvokeHelper(0x3e0, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3e0, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -544,14 +544,14 @@ void _Application::SetAskToUpdateLinks(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x3e0, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3e0, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetEnableAnimations() { BOOL result; - InvokeHelper(0x49c, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x49c, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -559,28 +559,28 @@ void _Application::SetEnableAnimations(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x49c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x49c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } LPDISPATCH _Application::GetAutoCorrect() { LPDISPATCH result; - InvokeHelper(0x479, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x479, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Application::GetBuild() { long result; - InvokeHelper(0x13a, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x13a, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } BOOL _Application::GetCalculateBeforeSave() { BOOL result; - InvokeHelper(0x13b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x13b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -588,14 +588,14 @@ void _Application::SetCalculateBeforeSave(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x13b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x13b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetCalculation() { long result; - InvokeHelper(0x13c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x13c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -603,7 +603,7 @@ void _Application::SetCalculation(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x13c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x13c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } @@ -620,21 +620,21 @@ VARIANT _Application::GetCaller(const VARIANT& Index) BOOL _Application::GetCanPlaySounds() { BOOL result; - InvokeHelper(0x13e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x13e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Application::GetCanRecordSounds() { BOOL result; - InvokeHelper(0x13f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x13f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } CString _Application::GetCaption() { CString result; - InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -642,14 +642,14 @@ void _Application::SetCaption(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } BOOL _Application::GetCellDragAndDrop() { BOOL result; - InvokeHelper(0x140, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x140, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -657,7 +657,7 @@ void _Application::SetCellDragAndDrop(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x140, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x140, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -694,7 +694,7 @@ VARIANT _Application::GetClipboardFormats(const VARIANT& Index) BOOL _Application::GetDisplayClipboardWindow() { BOOL result; - InvokeHelper(0x142, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x142, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -702,14 +702,14 @@ void _Application::SetDisplayClipboardWindow(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x142, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x142, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetCommandUnderlines() { long result; - InvokeHelper(0x143, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x143, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -717,14 +717,14 @@ void _Application::SetCommandUnderlines(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x143, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x143, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetConstrainNumeric() { BOOL result; - InvokeHelper(0x144, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x144, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -732,7 +732,7 @@ void _Application::SetConstrainNumeric(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x144, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x144, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -749,7 +749,7 @@ VARIANT _Application::ConvertFormula(const VARIANT& Formula, long FromReferenceS BOOL _Application::GetCopyObjectsWithCells() { BOOL result; - InvokeHelper(0x3df, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3df, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -757,14 +757,14 @@ void _Application::SetCopyObjectsWithCells(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x3df, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3df, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetCursor() { long result; - InvokeHelper(0x489, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x489, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -772,21 +772,21 @@ void _Application::SetCursor(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x489, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x489, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetCustomListCount() { long result; - InvokeHelper(0x313, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x313, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } long _Application::GetCutCopyMode() { long result; - InvokeHelper(0x14a, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x14a, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -794,14 +794,14 @@ void _Application::SetCutCopyMode(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x14a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x14a, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetDataEntryMode() { long result; - InvokeHelper(0x14b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x14b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -809,21 +809,21 @@ void _Application::SetDataEntryMode(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x14b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x14b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } CString _Application::Get_Default() { CString result; - InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Application::GetDefaultFilePath() { CString result; - InvokeHelper(0x40e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x40e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -831,7 +831,7 @@ void _Application::SetDefaultFilePath(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x40e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x40e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } @@ -839,7 +839,7 @@ void _Application::DeleteChartAutoFormat(LPCTSTR Name) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0xd9, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xd9, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Name); } @@ -847,21 +847,21 @@ void _Application::DeleteCustomList(long ListNum) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x30f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x30f, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, ListNum); } LPDISPATCH _Application::GetDialogs() { LPDISPATCH result; - InvokeHelper(0x2f9, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x2f9, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Application::GetDisplayAlerts() { BOOL result; - InvokeHelper(0x157, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x157, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -869,14 +869,14 @@ void _Application::SetDisplayAlerts(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x157, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x157, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayFormulaBar() { BOOL result; - InvokeHelper(0x158, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x158, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -884,14 +884,14 @@ void _Application::SetDisplayFormulaBar(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x158, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x158, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayFullScreen() { BOOL result; - InvokeHelper(0x425, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x425, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -899,14 +899,14 @@ void _Application::SetDisplayFullScreen(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x425, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x425, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayNoteIndicator() { BOOL result; - InvokeHelper(0x159, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x159, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -914,14 +914,14 @@ void _Application::SetDisplayNoteIndicator(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x159, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x159, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetDisplayCommentIndicator() { long result; - InvokeHelper(0x4ac, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x4ac, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -929,14 +929,14 @@ void _Application::SetDisplayCommentIndicator(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x4ac, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4ac, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetDisplayExcel4Menus() { BOOL result; - InvokeHelper(0x39f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x39f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -944,14 +944,14 @@ void _Application::SetDisplayExcel4Menus(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x39f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x39f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayRecentFiles() { BOOL result; - InvokeHelper(0x39e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x39e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -959,14 +959,14 @@ void _Application::SetDisplayRecentFiles(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x39e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x39e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayScrollBars() { BOOL result; - InvokeHelper(0x15a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x15a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -974,14 +974,14 @@ void _Application::SetDisplayScrollBars(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x15a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x15a, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetDisplayStatusBar() { BOOL result; - InvokeHelper(0x15b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x15b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -989,19 +989,19 @@ void _Application::SetDisplayStatusBar(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x15b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x15b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } void _Application::DoubleClick() { - InvokeHelper(0x15d, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x15d, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Application::GetEditDirectlyInCell() { BOOL result; - InvokeHelper(0x3a1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3a1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1009,14 +1009,14 @@ void _Application::SetEditDirectlyInCell(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x3a1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3a1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetEnableAutoComplete() { BOOL result; - InvokeHelper(0x49b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x49b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1024,14 +1024,14 @@ void _Application::SetEnableAutoComplete(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x49b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x49b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetEnableCancelKey() { long result; - InvokeHelper(0x448, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x448, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1039,14 +1039,14 @@ void _Application::SetEnableCancelKey(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x448, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x448, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetEnableSound() { BOOL result; - InvokeHelper(0x4ad, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4ad, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1054,7 +1054,7 @@ void _Application::SetEnableSound(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4ad, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4ad, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1071,26 +1071,26 @@ VARIANT _Application::GetFileConverters(const VARIANT& Index1, const VARIANT& In LPDISPATCH _Application::GetFileSearch() { LPDISPATCH result; - InvokeHelper(0x4b0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4b0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetFileFind() { LPDISPATCH result; - InvokeHelper(0x4b1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4b1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void _Application::FindFile() { - InvokeHelper(0x42c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x42c, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Application::GetFixedDecimal() { BOOL result; - InvokeHelper(0x15f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x15f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1098,14 +1098,14 @@ void _Application::SetFixedDecimal(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x15f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x15f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetFixedDecimalPlaces() { long result; - InvokeHelper(0x160, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x160, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1113,7 +1113,7 @@ void _Application::SetFixedDecimalPlaces(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x160, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x160, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } @@ -1161,14 +1161,14 @@ void _Application::Goto(const VARIANT& Reference, const VARIANT& Scroll) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1db, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1db, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Reference, &Scroll); } double _Application::GetHeight() { double result; - InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1176,7 +1176,7 @@ void _Application::SetHeight(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } @@ -1184,14 +1184,14 @@ void _Application::Help(const VARIANT& HelpFile, const VARIANT& HelpContextID) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x162, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x162, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &HelpFile, &HelpContextID); } BOOL _Application::GetIgnoreRemoteRequests() { BOOL result; - InvokeHelper(0x164, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x164, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1199,7 +1199,7 @@ void _Application::SetIgnoreRemoteRequests(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x164, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x164, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1226,7 +1226,7 @@ VARIANT _Application::InputBox(LPCTSTR Prompt, const VARIANT& Title, const VARIA BOOL _Application::GetInteractive() { BOOL result; - InvokeHelper(0x169, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x169, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1234,7 +1234,7 @@ void _Application::SetInteractive(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x169, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x169, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1251,7 +1251,7 @@ VARIANT _Application::GetInternational(const VARIANT& Index) BOOL _Application::GetIteration() { BOOL result; - InvokeHelper(0x16b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x16b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1259,14 +1259,14 @@ void _Application::SetIteration(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x16b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x16b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } double _Application::GetLeft() { double result; - InvokeHelper(0x7f, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x7f, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1274,14 +1274,14 @@ void _Application::SetLeft(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x7f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x7f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } CString _Application::GetLibraryPath() { CString result; - InvokeHelper(0x16e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x16e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1290,48 +1290,48 @@ void _Application::MacroOptions(const VARIANT& Macro, const VARIANT& Description { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x46f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x46f, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Macro, &Description, &HasMenu, &MenuText, &HasShortcutKey, &ShortcutKey, &Category, &StatusBar, &HelpContextID, &HelpFile); } void _Application::MailLogoff() { - InvokeHelper(0x3b1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3b1, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Application::MailLogon(const VARIANT& Name, const VARIANT& Password, const VARIANT& DownloadNewMail) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x3af, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x3af, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Name, &Password, &DownloadNewMail); } VARIANT _Application::GetMailSession() { VARIANT result; - InvokeHelper(0x3ae, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x3ae, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } long _Application::GetMailSystem() { long result; - InvokeHelper(0x3cb, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x3cb, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } BOOL _Application::GetMathCoprocessorAvailable() { BOOL result; - InvokeHelper(0x16f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x16f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } double _Application::GetMaxChange() { double result; - InvokeHelper(0x170, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x170, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1339,14 +1339,14 @@ void _Application::SetMaxChange(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x170, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x170, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } long _Application::GetMaxIterations() { long result; - InvokeHelper(0x171, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x171, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1354,42 +1354,42 @@ void _Application::SetMaxIterations(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x171, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x171, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetMemoryFree() { long result; - InvokeHelper(0x172, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x172, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } long _Application::GetMemoryTotal() { long result; - InvokeHelper(0x173, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x173, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } long _Application::GetMemoryUsed() { long result; - InvokeHelper(0x174, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x174, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } BOOL _Application::GetMouseAvailable() { BOOL result; - InvokeHelper(0x175, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x175, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Application::GetMoveAfterReturn() { BOOL result; - InvokeHelper(0x176, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x176, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1397,14 +1397,14 @@ void _Application::SetMoveAfterReturn(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x176, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x176, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Application::GetMoveAfterReturnDirection() { long result; - InvokeHelper(0x478, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x478, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1412,49 +1412,49 @@ void _Application::SetMoveAfterReturnDirection(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x478, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x478, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } LPDISPATCH _Application::GetRecentFiles() { LPDISPATCH result; - InvokeHelper(0x4b2, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4b2, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } CString _Application::GetName() { CString result; - InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } LPDISPATCH _Application::NextLetter() { LPDISPATCH result; - InvokeHelper(0x3cc, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x3cc, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, nullptr); return result; } CString _Application::GetNetworkTemplatesPath() { CString result; - InvokeHelper(0x184, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x184, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetODBCErrors() { LPDISPATCH result; - InvokeHelper(0x4b3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4b3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Application::GetODBCTimeout() { long result; - InvokeHelper(0x4b4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x4b4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1462,7 +1462,7 @@ void _Application::SetODBCTimeout(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x4b4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b4, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } @@ -1470,7 +1470,7 @@ void _Application::OnKey(LPCTSTR Key, const VARIANT& Procedure) { static BYTE parms[] = VTS_BSTR VTS_VARIANT; - InvokeHelper(0x272, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x272, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Key, &Procedure); } @@ -1478,7 +1478,7 @@ void _Application::OnRepeat(LPCTSTR Text, LPCTSTR Procedure) { static BYTE parms[] = VTS_BSTR VTS_BSTR; - InvokeHelper(0x301, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x301, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Text, Procedure); } @@ -1486,7 +1486,7 @@ void _Application::OnTime(const VARIANT& EarliestTime, LPCTSTR Procedure, const { static BYTE parms[] = VTS_VARIANT VTS_BSTR VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x270, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x270, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &EarliestTime, Procedure, &LatestTime, &Schedule); } @@ -1494,14 +1494,14 @@ void _Application::OnUndo(LPCTSTR Text, LPCTSTR Procedure) { static BYTE parms[] = VTS_BSTR VTS_BSTR; - InvokeHelper(0x302, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x302, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Text, Procedure); } CString _Application::GetOnWindow() { CString result; - InvokeHelper(0x26f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x26f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1509,35 +1509,35 @@ void _Application::SetOnWindow(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x26f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x26f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } CString _Application::GetOperatingSystem() { CString result; - InvokeHelper(0x177, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x177, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Application::GetOrganizationName() { CString result; - InvokeHelper(0x178, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x178, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Application::GetPath() { CString result; - InvokeHelper(0x123, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x123, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Application::GetPathSeparator() { CString result; - InvokeHelper(0x179, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x179, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1554,7 +1554,7 @@ VARIANT _Application::GetPreviousSelections(const VARIANT& Index) BOOL _Application::GetPivotTableSelection() { BOOL result; - InvokeHelper(0x4b5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4b5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1562,14 +1562,14 @@ void _Application::SetPivotTableSelection(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4b5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b5, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetPromptForSummaryInfo() { BOOL result; - InvokeHelper(0x426, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x426, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1577,34 +1577,34 @@ void _Application::SetPromptForSummaryInfo(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x426, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x426, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } void _Application::Quit() { - InvokeHelper(0x12e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x12e, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Application::RecordMacro(const VARIANT& BasicCode, const VARIANT& XlmCode) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x305, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x305, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &BasicCode, &XlmCode); } BOOL _Application::GetRecordRelative() { BOOL result; - InvokeHelper(0x17b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x17b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } long _Application::GetReferenceStyle() { long result; - InvokeHelper(0x17c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x17c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1612,7 +1612,7 @@ void _Application::SetReferenceStyle(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x17c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x17c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } @@ -1638,13 +1638,13 @@ BOOL _Application::RegisterXLL(LPCTSTR Filename) void _Application::Repeat() { - InvokeHelper(0x12d, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x12d, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Application::GetRollZoom() { BOOL result; - InvokeHelper(0x4b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1652,7 +1652,7 @@ void _Application::SetRollZoom(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4b6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b6, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1660,14 +1660,14 @@ void _Application::SaveWorkspace(const VARIANT& Filename) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xd4, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xd4, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Filename); } BOOL _Application::GetScreenUpdating() { BOOL result; - InvokeHelper(0x17e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x17e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1675,7 +1675,7 @@ void _Application::SetScreenUpdating(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x17e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x17e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1683,14 +1683,14 @@ void _Application::SetDefaultChart(const VARIANT& FormatName, const VARIANT& Gal { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0xdb, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xdb, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &FormatName, &Gallery); } long _Application::GetSheetsInNewWorkbook() { long result; - InvokeHelper(0x3e1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x3e1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1698,14 +1698,14 @@ void _Application::SetSheetsInNewWorkbook(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x3e1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3e1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetShowChartTipNames() { BOOL result; - InvokeHelper(0x4b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1713,14 +1713,14 @@ void _Application::SetShowChartTipNames(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4b7, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b7, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Application::GetShowChartTipValues() { BOOL result; - InvokeHelper(0x4b8, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4b8, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1728,14 +1728,14 @@ void _Application::SetShowChartTipValues(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4b8, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b8, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } CString _Application::GetStandardFont() { CString result; - InvokeHelper(0x39c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x39c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1743,14 +1743,14 @@ void _Application::SetStandardFont(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x39c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x39c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } double _Application::GetStandardFontSize() { double result; - InvokeHelper(0x39d, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x39d, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1758,21 +1758,21 @@ void _Application::SetStandardFontSize(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x39d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x39d, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } CString _Application::GetStartupPath() { CString result; - InvokeHelper(0x181, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x181, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } VARIANT _Application::GetStatusBar() { VARIANT result; - InvokeHelper(0x182, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x182, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -1780,21 +1780,21 @@ void _Application::SetStatusBar(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x182, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x182, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } CString _Application::GetTemplatesPath() { CString result; - InvokeHelper(0x17d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x17d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } BOOL _Application::GetShowToolTips() { BOOL result; - InvokeHelper(0x183, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x183, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1802,14 +1802,14 @@ void _Application::SetShowToolTips(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x183, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x183, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } double _Application::GetTop() { double result; - InvokeHelper(0x7e, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x7e, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1817,14 +1817,14 @@ void _Application::SetTop(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x7e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x7e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } long _Application::GetDefaultSaveFormat() { long result; - InvokeHelper(0x4b9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x4b9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1832,14 +1832,14 @@ void _Application::SetDefaultSaveFormat(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x4b9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4b9, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } CString _Application::GetTransitionMenuKey() { CString result; - InvokeHelper(0x136, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x136, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1847,14 +1847,14 @@ void _Application::SetTransitionMenuKey(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x136, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x136, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } long _Application::GetTransitionMenuKeyAction() { long result; - InvokeHelper(0x137, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x137, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -1862,14 +1862,14 @@ void _Application::SetTransitionMenuKeyAction(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x137, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x137, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetTransitionNavigKeys() { BOOL result; - InvokeHelper(0x138, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x138, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1877,33 +1877,33 @@ void _Application::SetTransitionNavigKeys(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x138, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x138, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } void _Application::Undo() { - InvokeHelper(0x12f, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x12f, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } double _Application::GetUsableHeight() { double result; - InvokeHelper(0x185, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x185, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } double _Application::GetUsableWidth() { double result; - InvokeHelper(0x186, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x186, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } BOOL _Application::GetUserControl() { BOOL result; - InvokeHelper(0x4ba, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4ba, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1911,14 +1911,14 @@ void _Application::SetUserControl(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4ba, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4ba, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } CString _Application::GetUserName_() { CString result; - InvokeHelper(0x187, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x187, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -1926,35 +1926,35 @@ void _Application::SetUserName(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x187, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x187, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } CString _Application::GetValue() { CString result; - InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } LPDISPATCH _Application::GetVbe() { LPDISPATCH result; - InvokeHelper(0x4bb, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4bb, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } CString _Application::GetVersion() { CString result; - InvokeHelper(0x188, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x188, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } BOOL _Application::GetVisible() { BOOL result; - InvokeHelper(0x22e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x22e, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -1962,7 +1962,7 @@ void _Application::SetVisible(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x22e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x22e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -1970,7 +1970,7 @@ void _Application::Volatile(const VARIANT& Volatile) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x314, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x314, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Volatile); } @@ -1978,14 +1978,14 @@ void _Application::Wait(const VARIANT& Time) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x189, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x189, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Time); } double _Application::GetWidth() { double result; - InvokeHelper(0x7a, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x7a, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -1993,21 +1993,21 @@ void _Application::SetWidth(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x7a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x7a, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } BOOL _Application::GetWindowsForPens() { BOOL result; - InvokeHelper(0x18b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x18b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } long _Application::GetWindowState() { long result; - InvokeHelper(0x18c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x18c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2015,14 +2015,14 @@ void _Application::SetWindowState(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x18c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x18c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetUILanguage() { long result; - InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2030,14 +2030,14 @@ void _Application::SetUILanguage(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetDefaultSheetDirection() { long result; - InvokeHelper(0xe5, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0xe5, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2045,14 +2045,14 @@ void _Application::SetDefaultSheetDirection(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0xe5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xe5, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetCursorMovement() { long result; - InvokeHelper(0xe8, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0xe8, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2060,14 +2060,14 @@ void _Application::SetCursorMovement(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0xe8, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xe8, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } long _Application::GetControlCharacters() { long result; - InvokeHelper(0xe9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0xe9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2075,14 +2075,14 @@ void _Application::SetControlCharacters(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0xe9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xe9, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Application::GetEnableEvents() { BOOL result; - InvokeHelper(0x4bc, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x4bc, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2090,7 +2090,7 @@ void _Application::SetEnableEvents(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x4bc, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x4bc, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2104,28 +2104,28 @@ void _Application::SetEnableEvents(BOOL bNewValue) LPDISPATCH _Workbook::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Workbook::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetAcceptLabelsInFormulas() { BOOL result; - InvokeHelper(0x5a1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5a1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2133,33 +2133,33 @@ void _Workbook::SetAcceptLabelsInFormulas(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5a1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } void _Workbook::Activate() { - InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Workbook::GetActiveChart() { LPDISPATCH result; - InvokeHelper(0xb7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xb7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetActiveSheet() { LPDISPATCH result; - InvokeHelper(0x133, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x133, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Workbook::GetAutoUpdateFrequency() { long result; - InvokeHelper(0x5a2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x5a2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2167,14 +2167,14 @@ void _Workbook::SetAutoUpdateFrequency(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x5a2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a2, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Workbook::GetAutoUpdateSaveChanges() { BOOL result; - InvokeHelper(0x5a3, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5a3, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2182,14 +2182,14 @@ void _Workbook::SetAutoUpdateSaveChanges(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5a3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a3, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Workbook::GetChangeHistoryDuration() { long result; - InvokeHelper(0x5a4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x5a4, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2197,14 +2197,14 @@ void _Workbook::SetChangeHistoryDuration(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x5a4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a4, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } LPDISPATCH _Workbook::GetBuiltinDocumentProperties() { LPDISPATCH result; - InvokeHelper(0x498, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x498, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2212,7 +2212,7 @@ void _Workbook::ChangeFileAccess(long Mode, const VARIANT& WritePassword, const { static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x3dd, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x3dd, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Mode, &WritePassword, &Notify); } @@ -2220,14 +2220,14 @@ void _Workbook::ChangeLink(LPCTSTR Name, LPCTSTR NewName, long Type) { static BYTE parms[] = VTS_BSTR VTS_BSTR VTS_I4; - InvokeHelper(0x322, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x322, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Name, NewName, Type); } LPDISPATCH _Workbook::GetCharts() { LPDISPATCH result; - InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2235,21 +2235,21 @@ void _Workbook::Close(const VARIANT& SaveChanges, const VARIANT& Filename, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x115, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x115, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &SaveChanges, &Filename, &RouteWorkbook); } CString _Workbook::GetCodeName() { CString result; - InvokeHelper(0x55d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x55d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Workbook::Get_CodeName() { CString result; - InvokeHelper(0x80010000, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x80010000, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -2257,7 +2257,7 @@ void _Workbook::Set_CodeName(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x80010000, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x80010000, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } @@ -2275,21 +2275,21 @@ void _Workbook::SetColors(const VARIANT& Index, const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x11e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x11e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &Index, &newValue); } LPDISPATCH _Workbook::GetCommandBars() { LPDISPATCH result; - InvokeHelper(0x59f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x59f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Workbook::GetConflictResolution() { long result; - InvokeHelper(0x497, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x497, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2297,35 +2297,35 @@ void _Workbook::SetConflictResolution(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x497, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x497, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } LPDISPATCH _Workbook::GetContainer() { LPDISPATCH result; - InvokeHelper(0x4a6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x4a6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetCreateBackup() { BOOL result; - InvokeHelper(0x11f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x11f, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetCustomDocumentProperties() { LPDISPATCH result; - InvokeHelper(0x499, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x499, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetDate1904() { BOOL result; - InvokeHelper(0x193, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x193, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2333,7 +2333,7 @@ void _Workbook::SetDate1904(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x193, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x193, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2341,14 +2341,14 @@ void _Workbook::DeleteNumberFormat(LPCTSTR NumberFormat) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x18d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x18d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, NumberFormat); } long _Workbook::GetDisplayDrawingObjects() { long result; - InvokeHelper(0x194, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x194, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -2356,47 +2356,47 @@ void _Workbook::SetDisplayDrawingObjects(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x194, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x194, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Workbook::ExclusiveAccess() { BOOL result; - InvokeHelper(0x490, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x490, DISPATCH_METHOD, VT_BOOL, (void*)&result, nullptr); return result; } long _Workbook::GetFileFormat() { long result; - InvokeHelper(0x120, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x120, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } void _Workbook::ForwardMailer() { - InvokeHelper(0x3cd, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3cd, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } CString _Workbook::GetFullName() { CString result; - InvokeHelper(0x121, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x121, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } BOOL _Workbook::GetHasPassword() { BOOL result; - InvokeHelper(0x122, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x122, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Workbook::GetHasRoutingSlip() { BOOL result; - InvokeHelper(0x3b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2404,14 +2404,14 @@ void _Workbook::SetHasRoutingSlip(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x3b6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3b6, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Workbook::GetIsAddin() { BOOL result; - InvokeHelper(0x5a5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5a5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2419,7 +2419,7 @@ void _Workbook::SetIsAddin(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5a5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a5, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2446,7 +2446,7 @@ VARIANT _Workbook::LinkSources(const VARIANT& Type) LPDISPATCH _Workbook::GetMailer() { LPDISPATCH result; - InvokeHelper(0x3d3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x3d3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2454,35 +2454,35 @@ void _Workbook::MergeWorkbook(const VARIANT& Filename) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x5a6, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a6, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Filename); } BOOL _Workbook::GetMultiUserEditing() { BOOL result; - InvokeHelper(0x491, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x491, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } CString _Workbook::GetName() { CString result; - InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetNames() { LPDISPATCH result; - InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::NewWindow() { LPDISPATCH result; - InvokeHelper(0x118, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x118, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2490,21 +2490,21 @@ void _Workbook::OpenLinks(LPCTSTR Name, const VARIANT& ReadOnly, const VARIANT& { static BYTE parms[] = VTS_BSTR VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x323, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x323, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Name, &ReadOnly, &Type); } CString _Workbook::GetPath() { CString result; - InvokeHelper(0x123, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x123, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } BOOL _Workbook::GetPersonalViewListSettings() { BOOL result; - InvokeHelper(0x5a7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5a7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2512,14 +2512,14 @@ void _Workbook::SetPersonalViewListSettings(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5a7, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a7, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Workbook::GetPersonalViewPrintSettings() { BOOL result; - InvokeHelper(0x5a8, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5a8, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2527,14 +2527,14 @@ void _Workbook::SetPersonalViewPrintSettings(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5a8, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5a8, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } LPDISPATCH _Workbook::PivotCaches() { LPDISPATCH result; - InvokeHelper(0x5a9, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x5a9, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2542,14 +2542,14 @@ void _Workbook::Post(const VARIANT& DestName) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x48e, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x48e, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &DestName); } BOOL _Workbook::GetPrecisionAsDisplayed() { BOOL result; - InvokeHelper(0x195, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x195, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2557,7 +2557,7 @@ void _Workbook::SetPrecisionAsDisplayed(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x195, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x195, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2565,7 +2565,7 @@ void _Workbook::PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &From, &To, &Copies, &Preview, &ActivePrinter, &PrintToFile, &Collate); } @@ -2573,7 +2573,7 @@ void _Workbook::PrintPreview(const VARIANT& EnableChanges) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &EnableChanges); } @@ -2581,7 +2581,7 @@ void _Workbook::Protect(const VARIANT& Password, const VARIANT& Structure, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x11a, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11a, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Password, &Structure, &Windows); } @@ -2589,84 +2589,84 @@ void _Workbook::ProtectSharing(const VARIANT& Filename, const VARIANT& Password, { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x5aa, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5aa, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Filename, &Password, &WriteResPassword, &ReadOnlyRecommended, &CreateBackup, &SharingPassword); } BOOL _Workbook::GetProtectStructure() { BOOL result; - InvokeHelper(0x24c, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x24c, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Workbook::GetProtectWindows() { BOOL result; - InvokeHelper(0x127, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x127, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Workbook::GetReadOnly() { BOOL result; - InvokeHelper(0x128, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x128, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Workbook::GetReadOnlyRecommended() { BOOL result; - InvokeHelper(0x129, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x129, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } void _Workbook::RefreshAll() { - InvokeHelper(0x5ac, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x5ac, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Workbook::Reply() { - InvokeHelper(0x3d1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3d1, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Workbook::ReplyAll() { - InvokeHelper(0x3d2, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3d2, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Workbook::RemoveUser(long Index) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x5ad, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5ad, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Index); } long _Workbook::GetRevisionNumber() { long result; - InvokeHelper(0x494, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x494, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } void _Workbook::Route() { - InvokeHelper(0x3b2, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3b2, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Workbook::GetRouted() { BOOL result; - InvokeHelper(0x3b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x3b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetRoutingSlip() { LPDISPATCH result; - InvokeHelper(0x3b5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x3b5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2674,13 +2674,13 @@ void _Workbook::RunAutoMacros(long Which) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x27a, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x27a, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Which); } void _Workbook::Save() { - InvokeHelper(0x11b, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x11b, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Workbook::SaveAs(const VARIANT& Filename, const VARIANT& FileFormat, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& ReadOnlyRecommended, const VARIANT& CreateBackup, long AccessMode, const VARIANT& ConflictResolution, @@ -2688,7 +2688,7 @@ void _Workbook::SaveAs(const VARIANT& Filename, const VARIANT& FileFormat, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x11c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11c, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Filename, &FileFormat, &Password, &WriteResPassword, &ReadOnlyRecommended, &CreateBackup, AccessMode, &ConflictResolution, &AddToMru, &TextCodepage, &TextVisualLayout); } @@ -2696,14 +2696,14 @@ void _Workbook::SaveCopyAs(const VARIANT& Filename) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xaf, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xaf, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Filename); } BOOL _Workbook::GetSaved() { BOOL result; - InvokeHelper(0x12a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x12a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2711,14 +2711,14 @@ void _Workbook::SetSaved(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x12a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x12a, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Workbook::GetSaveLinkValues() { BOOL result; - InvokeHelper(0x196, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x196, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2726,7 +2726,7 @@ void _Workbook::SetSaveLinkValues(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x196, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x196, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2734,7 +2734,7 @@ void _Workbook::SendMail(const VARIANT& Recipients, const VARIANT& Subject, cons { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x3b3, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x3b3, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Recipients, &Subject, &ReturnReceipt); } @@ -2742,7 +2742,7 @@ void _Workbook::SendMailer(const VARIANT& FileFormat, long Priority) { static BYTE parms[] = VTS_VARIANT VTS_I4; - InvokeHelper(0x3d4, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x3d4, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &FileFormat, Priority); } @@ -2750,21 +2750,21 @@ void _Workbook::SetLinkOnData(LPCTSTR Name, const VARIANT& Procedure) { static BYTE parms[] = VTS_BSTR VTS_VARIANT; - InvokeHelper(0x329, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x329, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Name, &Procedure); } LPDISPATCH _Workbook::GetSheets() { LPDISPATCH result; - InvokeHelper(0x1e5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1e5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetShowConflictHistory() { BOOL result; - InvokeHelper(0x493, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x493, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2772,14 +2772,14 @@ void _Workbook::SetShowConflictHistory(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x493, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x493, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } LPDISPATCH _Workbook::GetStyles() { LPDISPATCH result; - InvokeHelper(0x1ed, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ed, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2787,7 +2787,7 @@ void _Workbook::Unprotect(const VARIANT& Password) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x11d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Password); } @@ -2795,27 +2795,27 @@ void _Workbook::UnprotectSharing(const VARIANT& SharingPassword) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x5af, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5af, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &SharingPassword); } void _Workbook::UpdateFromFile() { - InvokeHelper(0x3e3, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3e3, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Workbook::UpdateLink(const VARIANT& Name, const VARIANT& Type) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x324, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x324, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Name, &Type); } BOOL _Workbook::GetUpdateRemoteReferences() { BOOL result; - InvokeHelper(0x19b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x19b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2823,70 +2823,70 @@ void _Workbook::SetUpdateRemoteReferences(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x19b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x19b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } VARIANT _Workbook::GetUserStatus() { VARIANT result; - InvokeHelper(0x495, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x495, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetCustomViews() { LPDISPATCH result; - InvokeHelper(0x5b0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x5b0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetWindows() { LPDISPATCH result; - InvokeHelper(0x1ae, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ae, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetWorksheets() { LPDISPATCH result; - InvokeHelper(0x1ee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetWriteReserved() { BOOL result; - InvokeHelper(0x12b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x12b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } CString _Workbook::GetWriteReservedBy() { CString result; - InvokeHelper(0x12c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x12c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetExcel4IntlMacroSheets() { LPDISPATCH result; - InvokeHelper(0x245, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x245, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Workbook::GetExcel4MacroSheets() { LPDISPATCH result; - InvokeHelper(0x243, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x243, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Workbook::GetTemplateRemoveExtData() { BOOL result; - InvokeHelper(0x5b1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5b1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2894,7 +2894,7 @@ void _Workbook::SetTemplateRemoveExtData(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5b1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2902,14 +2902,14 @@ void _Workbook::HighlightChangesOptions(const VARIANT& When, const VARIANT& Who, { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x5b2, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b2, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &When, &Who, &Where); } BOOL _Workbook::GetHighlightChangesOnScreen() { BOOL result; - InvokeHelper(0x5b5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5b5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2917,14 +2917,14 @@ void _Workbook::SetHighlightChangesOnScreen(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5b5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b5, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Workbook::GetKeepChangeHistory() { BOOL result; - InvokeHelper(0x5b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5b6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2932,14 +2932,14 @@ void _Workbook::SetKeepChangeHistory(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5b6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b6, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Workbook::GetListChangesOnNewSheet() { BOOL result; - InvokeHelper(0x5b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x5b7, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -2947,7 +2947,7 @@ void _Workbook::SetListChangesOnNewSheet(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x5b7, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b7, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -2955,7 +2955,7 @@ void _Workbook::PurgeChangeHistoryNow(long Days, const VARIANT& SharingPassword) { static BYTE parms[] = VTS_I4 VTS_VARIANT; - InvokeHelper(0x5b8, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5b8, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Days, &SharingPassword); } @@ -2963,7 +2963,7 @@ void _Workbook::AcceptAllChanges(const VARIANT& When, const VARIANT& Who, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x5ba, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5ba, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &When, &Who, &Where); } @@ -2971,19 +2971,19 @@ void _Workbook::RejectAllChanges(const VARIANT& When, const VARIANT& Who, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x5bb, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5bb, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &When, &Who, &Where); } void _Workbook::ResetColors() { - InvokeHelper(0x5bc, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x5bc, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Workbook::GetVBProject() { LPDISPATCH result; - InvokeHelper(0x5bd, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x5bd, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -2991,19 +2991,19 @@ void _Workbook::FollowHyperlink(LPCTSTR Address, const VARIANT& SubAddress, cons { static BYTE parms[] = VTS_BSTR VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x5be, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x5be, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Address, &SubAddress, &NewWindow, &AddHistory, &ExtraInfo, &Method, &HeaderInfo); } void _Workbook::AddToFavorites() { - InvokeHelper(0x5c4, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x5c4, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Workbook::GetIsInplace() { BOOL result; - InvokeHelper(0x6f4, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x6f4, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3017,53 +3017,53 @@ BOOL _Workbook::GetIsInplace() LPDISPATCH _Worksheet::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Worksheet::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void _Worksheet::Activate() { - InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Worksheet::Copy(const VARIANT& Before, const VARIANT& After) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x227, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x227, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Before, &After); } void _Worksheet::Delete() { - InvokeHelper(0x75, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x75, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } CString _Worksheet::GetCodeName() { CString result; - InvokeHelper(0x55d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x55d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } CString _Worksheet::Get_CodeName() { CString result; - InvokeHelper(0x80010000, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x80010000, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -3071,14 +3071,14 @@ void _Worksheet::Set_CodeName(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x80010000, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x80010000, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } long _Worksheet::GetIndex() { long result; - InvokeHelper(0x1e6, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x1e6, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -3086,14 +3086,14 @@ void _Worksheet::Move(const VARIANT& Before, const VARIANT& After) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x27d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x27d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Before, &After); } CString _Worksheet::GetName() { CString result; - InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -3101,28 +3101,28 @@ void _Worksheet::SetName(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x6e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x6e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } LPDISPATCH _Worksheet::GetNext() { LPDISPATCH result; - InvokeHelper(0x1f6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1f6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetPageSetup() { LPDISPATCH result; - InvokeHelper(0x3e6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x3e6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetPrevious() { LPDISPATCH result; - InvokeHelper(0x1f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3130,7 +3130,7 @@ void _Worksheet::PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &From, &To, &Copies, &Preview, &ActivePrinter, &PrintToFile, &Collate); } @@ -3138,7 +3138,7 @@ void _Worksheet::PrintPreview(const VARIANT& EnableChanges) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &EnableChanges); } @@ -3146,35 +3146,35 @@ void _Worksheet::Protect(const VARIANT& Password, const VARIANT& DrawingObjects, { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x11a, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11a, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Password, &DrawingObjects, &Contents, &Scenarios, &UserInterfaceOnly); } BOOL _Worksheet::GetProtectContents() { BOOL result; - InvokeHelper(0x124, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x124, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetProtectDrawingObjects() { BOOL result; - InvokeHelper(0x125, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x125, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetProtectionMode() { BOOL result; - InvokeHelper(0x487, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x487, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetProtectScenarios() { BOOL result; - InvokeHelper(0x126, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x126, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3183,7 +3183,7 @@ void _Worksheet::SaveAs(LPCTSTR Filename, const VARIANT& FileFormat, const VARIA { static BYTE parms[] = VTS_BSTR VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x11c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11c, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Filename, &FileFormat, &Password, &WriteResPassword, &ReadOnlyRecommended, &CreateBackup, &AddToMru, &TextCodepage, &TextVisualLayout); } @@ -3191,7 +3191,7 @@ void _Worksheet::Select(const VARIANT& Replace) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xeb, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xeb, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Replace); } @@ -3199,14 +3199,14 @@ void _Worksheet::Unprotect(const VARIANT& Password) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x11d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x11d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Password); } long _Worksheet::GetVisible() { long result; - InvokeHelper(0x22e, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x22e, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -3214,21 +3214,21 @@ void _Worksheet::SetVisible(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x22e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x22e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } LPDISPATCH _Worksheet::GetShapes() { LPDISPATCH result; - InvokeHelper(0x561, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x561, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetTransitionExpEval() { BOOL result; - InvokeHelper(0x191, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x191, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3236,14 +3236,14 @@ void _Worksheet::SetTransitionExpEval(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x191, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x191, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Worksheet::GetAutoFilterMode() { BOOL result; - InvokeHelper(0x318, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x318, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3251,7 +3251,7 @@ void _Worksheet::SetAutoFilterMode(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x318, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x318, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -3259,19 +3259,19 @@ void _Worksheet::SetBackgroundPicture(LPCTSTR Filename) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x4a4, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x4a4, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Filename); } void _Worksheet::Calculate() { - InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL _Worksheet::GetEnableCalculation() { BOOL result; - InvokeHelper(0x590, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x590, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3279,14 +3279,14 @@ void _Worksheet::SetEnableCalculation(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x590, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x590, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } LPDISPATCH _Worksheet::GetCells() { LPDISPATCH result; - InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3304,54 +3304,54 @@ void _Worksheet::CheckSpelling(const VARIANT& CustomDictionary, const VARIANT& I { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1f9, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1f9, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &CustomDictionary, &IgnoreUppercase, &AlwaysSuggest, &IgnoreInitialAlefHamza, &IgnoreFinalYaa, &SpellScript); } LPDISPATCH _Worksheet::GetCircularReference() { LPDISPATCH result; - InvokeHelper(0x42d, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x42d, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void _Worksheet::ClearArrows() { - InvokeHelper(0x3ca, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x3ca, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Worksheet::GetColumns() { LPDISPATCH result; - InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long _Worksheet::GetConsolidationFunction() { long result; - InvokeHelper(0x315, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x315, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } VARIANT _Worksheet::GetConsolidationOptions() { VARIANT result; - InvokeHelper(0x316, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x316, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } VARIANT _Worksheet::GetConsolidationSources() { VARIANT result; - InvokeHelper(0x317, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x317, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetEnableAutoFilter() { BOOL result; - InvokeHelper(0x484, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x484, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3359,14 +3359,14 @@ void _Worksheet::SetEnableAutoFilter(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x484, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x484, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Worksheet::GetEnableSelection() { long result; - InvokeHelper(0x591, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x591, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -3374,14 +3374,14 @@ void _Worksheet::SetEnableSelection(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x591, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x591, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } BOOL _Worksheet::GetEnableOutlining() { BOOL result; - InvokeHelper(0x485, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x485, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3389,14 +3389,14 @@ void _Worksheet::SetEnableOutlining(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x485, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x485, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } BOOL _Worksheet::GetEnablePivotTable() { BOOL result; - InvokeHelper(0x486, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x486, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3404,7 +3404,7 @@ void _Worksheet::SetEnablePivotTable(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x486, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x486, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } @@ -3431,19 +3431,19 @@ VARIANT _Worksheet::_Evaluate(const VARIANT& Name) BOOL _Worksheet::GetFilterMode() { BOOL result; - InvokeHelper(0x320, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x320, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } void _Worksheet::ResetAllPageBreaks() { - InvokeHelper(0x592, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x592, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Worksheet::GetNames() { LPDISPATCH result; - InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1ba, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3460,7 +3460,7 @@ LPDISPATCH _Worksheet::OLEObjects(const VARIANT& Index) LPDISPATCH _Worksheet::GetOutline() { LPDISPATCH result; - InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3468,7 +3468,7 @@ void _Worksheet::Paste(const VARIANT& Destination, const VARIANT& Link) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0xd3, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xd3, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Destination, &Link); } @@ -3476,7 +3476,7 @@ void _Worksheet::PasteSpecial(const VARIANT& Format, const VARIANT& Link, const { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x403, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x403, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Format, &Link, &DisplayAsIcon, &IconFileName, &IconIndex, &IconLabel); } @@ -3515,7 +3515,7 @@ LPDISPATCH _Worksheet::GetRange(const VARIANT& Cell1, const VARIANT& Cell2) LPDISPATCH _Worksheet::GetRows() { LPDISPATCH result; - InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3532,7 +3532,7 @@ LPDISPATCH _Worksheet::Scenarios(const VARIANT& Index) CString _Worksheet::GetScrollArea() { CString result; - InvokeHelper(0x599, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL); + InvokeHelper(0x599, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, nullptr); return result; } @@ -3540,31 +3540,31 @@ void _Worksheet::SetScrollArea(LPCTSTR lpszNewValue) { static BYTE parms[] = VTS_BSTR; - InvokeHelper(0x599, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x599, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, lpszNewValue); } void _Worksheet::ShowAllData() { - InvokeHelper(0x31a, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x31a, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Worksheet::ShowDataForm() { - InvokeHelper(0x199, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x199, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } double _Worksheet::GetStandardHeight() { double result; - InvokeHelper(0x197, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x197, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } double _Worksheet::GetStandardWidth() { double result; - InvokeHelper(0x198, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL); + InvokeHelper(0x198, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, nullptr); return result; } @@ -3572,14 +3572,14 @@ void _Worksheet::SetStandardWidth(double newValue) { static BYTE parms[] = VTS_R8; - InvokeHelper(0x198, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x198, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue); } BOOL _Worksheet::GetTransitionFormEntry() { BOOL result; - InvokeHelper(0x192, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x192, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3587,49 +3587,49 @@ void _Worksheet::SetTransitionFormEntry(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x192, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x192, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } long _Worksheet::GetType() { long result; - InvokeHelper(0x6c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x6c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetUsedRange() { LPDISPATCH result; - InvokeHelper(0x19c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x19c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetHPageBreaks() { LPDISPATCH result; - InvokeHelper(0x58a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x58a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetVPageBreaks() { LPDISPATCH result; - InvokeHelper(0x58b, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x58b, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetQueryTables() { LPDISPATCH result; - InvokeHelper(0x59a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x59a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } BOOL _Worksheet::GetDisplayPageBreaks() { BOOL result; - InvokeHelper(0x59b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL); + InvokeHelper(0x59b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, nullptr); return result; } @@ -3637,38 +3637,38 @@ void _Worksheet::SetDisplayPageBreaks(BOOL bNewValue) { static BYTE parms[] = VTS_BOOL; - InvokeHelper(0x59b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x59b, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, bNewValue); } LPDISPATCH _Worksheet::GetComments() { LPDISPATCH result; - InvokeHelper(0x23f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x23f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH _Worksheet::GetHyperlinks() { LPDISPATCH result; - InvokeHelper(0x571, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x571, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void _Worksheet::ClearCircles() { - InvokeHelper(0x59c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x59c, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void _Worksheet::CircleInvalid() { - InvokeHelper(0x59d, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x59d, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH _Worksheet::GetAutoFilter() { LPDISPATCH result; - InvokeHelper(0x319, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x319, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3682,33 +3682,33 @@ LPDISPATCH _Worksheet::GetAutoFilter() LPDISPATCH Range::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Range::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void Range::Activate() { - InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x130, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } VARIANT Range::GetAddIndent() { VARIANT result; - InvokeHelper(0x427, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x427, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -3716,7 +3716,7 @@ void Range::SetAddIndent(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x427, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x427, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -3744,7 +3744,7 @@ void Range::AdvancedFilter(long Action, const VARIANT& CriteriaRange, const VARI { static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x36c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x36c, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Action, &CriteriaRange, &CopyToRange, &Unique); } @@ -3752,19 +3752,19 @@ void Range::ApplyNames(const VARIANT& Names, const VARIANT& IgnoreRelativeAbsolu { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT; - InvokeHelper(0x1b9, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1b9, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Names, &IgnoreRelativeAbsolute, &UseRowColumnNames, &OmitColumn, &OmitRow, Order, &AppendLast); } void Range::ApplyOutlineStyles() { - InvokeHelper(0x1c0, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x1c0, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH Range::GetAreas() { LPDISPATCH result; - InvokeHelper(0x238, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x238, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3782,7 +3782,7 @@ void Range::AutoFill(LPDISPATCH Destination, long Type) { static BYTE parms[] = VTS_DISPATCH VTS_I4; - InvokeHelper(0x1c1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1c1, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Destination, Type); } @@ -3790,52 +3790,52 @@ void Range::AutoFilter(const VARIANT& Field, const VARIANT& Criteria1, long Oper { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x319, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x319, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Field, &Criteria1, Operator, &Criteria2, &VisibleDropDown); } void Range::AutoFit() { - InvokeHelper(0xed, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xed, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::AutoFormat(long Format, const VARIANT& Number, const VARIANT& Font, const VARIANT& Alignment, const VARIANT& Border, const VARIANT& Pattern, const VARIANT& Width) { static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Format, &Number, &Font, &Alignment, &Border, &Pattern, &Width); } void Range::AutoOutline() { - InvokeHelper(0x40c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x40c, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::BorderAround(const VARIANT& LineStyle, long Weight, long ColorIndex, const VARIANT& Color) { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT; - InvokeHelper(0x42b, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x42b, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &LineStyle, Weight, ColorIndex, &Color); } LPDISPATCH Range::GetBorders() { LPDISPATCH result; - InvokeHelper(0x1b3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1b3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void Range::Calculate() { - InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x117, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH Range::GetCells() { LPDISPATCH result; - InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xee, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3853,39 +3853,39 @@ void Range::CheckSpelling(const VARIANT& CustomDictionary, const VARIANT& Ignore { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1f9, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1f9, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &CustomDictionary, &IgnoreUppercase, &AlwaysSuggest, &IgnoreInitialAlefHamza, &IgnoreFinalYaa, &SpellScript); } void Range::Clear() { - InvokeHelper(0x6f, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x6f, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ClearContents() { - InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ClearFormats() { - InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ClearNotes() { - InvokeHelper(0xef, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xef, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ClearOutline() { - InvokeHelper(0x40d, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x40d, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } long Range::GetColumn() { long result; - InvokeHelper(0xf0, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0xf0, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -3902,14 +3902,14 @@ LPDISPATCH Range::ColumnDifferences(const VARIANT& Comparison) LPDISPATCH Range::GetColumns() { LPDISPATCH result; - InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetColumnWidth() { VARIANT result; - InvokeHelper(0xf2, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xf2, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -3917,7 +3917,7 @@ void Range::SetColumnWidth(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xf2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xf2, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -3925,7 +3925,7 @@ void Range::Consolidate(const VARIANT& Sources, const VARIANT& Function, const V { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1e2, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1e2, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Sources, &Function, &TopRow, &LeftColumn, &CreateLinks); } @@ -3933,7 +3933,7 @@ void Range::Copy(const VARIANT& Destination) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x227, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x227, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Destination); } @@ -3951,14 +3951,14 @@ void Range::CopyPicture(long Appearance, long Format) { static BYTE parms[] = VTS_I4 VTS_I4; - InvokeHelper(0xd5, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xd5, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Appearance, Format); } long Range::GetCount() { long result; - InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -3966,7 +3966,7 @@ void Range::CreateNames(const VARIANT& Top, const VARIANT& Left, const VARIANT& { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1c9, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1c9, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Top, &Left, &Bottom, &Right); } @@ -3974,21 +3974,21 @@ void Range::CreatePublisher(const VARIANT& Edition, long Appearance, const VARIA { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1ca, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1ca, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Edition, Appearance, &ContainsPICT, &ContainsBIFF, &ContainsRTF, &ContainsVALU); } LPDISPATCH Range::GetCurrentArray() { LPDISPATCH result; - InvokeHelper(0x1f5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1f5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetCurrentRegion() { LPDISPATCH result; - InvokeHelper(0xf3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -3996,7 +3996,7 @@ void Range::Cut(const VARIANT& Destination) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x235, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x235, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Destination); } @@ -4004,7 +4004,7 @@ void Range::DataSeries(const VARIANT& Rowcol, long Type, long Date, const VARIAN { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1d0, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1d0, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Rowcol, Type, Date, &Step, &Stop, &Trend); } @@ -4022,7 +4022,7 @@ void Range::Set_Default(const VARIANT& RowIndex, const VARIANT& ColumnIndex, con { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x0, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x0, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &RowIndex, &ColumnIndex, &newValue); } @@ -4030,35 +4030,35 @@ void Range::Delete(const VARIANT& Shift) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x75, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x75, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Shift); } LPDISPATCH Range::GetDependents() { LPDISPATCH result; - InvokeHelper(0x21f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x21f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::DialogBox_() { VARIANT result; - InvokeHelper(0xf5, DISPATCH_METHOD, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xf5, DISPATCH_METHOD, VT_VARIANT, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetDirectDependents() { LPDISPATCH result; - InvokeHelper(0x221, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x221, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetDirectPrecedents() { LPDISPATCH result; - InvokeHelper(0x222, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x222, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4085,35 +4085,35 @@ LPDISPATCH Range::GetEnd(long Direction) LPDISPATCH Range::GetEntireColumn() { LPDISPATCH result; - InvokeHelper(0xf6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetEntireRow() { LPDISPATCH result; - InvokeHelper(0xf7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0xf7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void Range::FillDown() { - InvokeHelper(0xf8, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xf8, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::FillLeft() { - InvokeHelper(0xf9, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xf9, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::FillRight() { - InvokeHelper(0xfa, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xfa, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::FillUp() { - InvokeHelper(0xfb, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xfb, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH Range::Find(const VARIANT& What, const VARIANT& After, const VARIANT& LookIn, const VARIANT& LookAt, const VARIANT& SearchOrder, long SearchDirection, const VARIANT& MatchCase, const VARIANT& MatchByte, @@ -4150,14 +4150,14 @@ LPDISPATCH Range::FindPrevious(const VARIANT& After) LPDISPATCH Range::GetFont() { LPDISPATCH result; - InvokeHelper(0x92, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x92, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetFormula() { VARIANT result; - InvokeHelper(0x105, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x105, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4165,14 +4165,14 @@ void Range::SetFormula(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x105, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x105, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetFormulaArray() { VARIANT result; - InvokeHelper(0x24a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x24a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4180,14 +4180,14 @@ void Range::SetFormulaArray(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x24a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x24a, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } long Range::GetFormulaLabel() { long result; - InvokeHelper(0x564, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x564, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -4195,14 +4195,14 @@ void Range::SetFormulaLabel(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x564, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x564, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } VARIANT Range::GetFormulaHidden() { VARIANT result; - InvokeHelper(0x106, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x106, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4210,14 +4210,14 @@ void Range::SetFormulaHidden(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x106, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x106, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetFormulaLocal() { VARIANT result; - InvokeHelper(0x107, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x107, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4225,14 +4225,14 @@ void Range::SetFormulaLocal(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x107, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x107, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetFormulaR1C1() { VARIANT result; - InvokeHelper(0x108, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x108, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4240,14 +4240,14 @@ void Range::SetFormulaR1C1(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x108, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x108, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetFormulaR1C1Local() { VARIANT result; - InvokeHelper(0x109, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x109, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4255,13 +4255,13 @@ void Range::SetFormulaR1C1Local(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x109, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x109, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } void Range::FunctionWizard() { - InvokeHelper(0x23b, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x23b, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL Range::GoalSeek(const VARIANT& Goal, LPDISPATCH ChangingCell) @@ -4287,28 +4287,28 @@ VARIANT Range::Group(const VARIANT& Start, const VARIANT& End, const VARIANT& By VARIANT Range::GetHasArray() { VARIANT result; - InvokeHelper(0x10a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x10a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } VARIANT Range::GetHasFormula() { VARIANT result; - InvokeHelper(0x10b, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x10b, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } VARIANT Range::GetHeight() { VARIANT result; - InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } VARIANT Range::GetHidden() { VARIANT result; - InvokeHelper(0x10c, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x10c, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4316,14 +4316,14 @@ void Range::SetHidden(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x10c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x10c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetHorizontalAlignment() { VARIANT result; - InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4331,14 +4331,14 @@ void Range::SetHorizontalAlignment(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetIndentLevel() { VARIANT result; - InvokeHelper(0xc9, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xc9, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4346,7 +4346,7 @@ void Range::SetIndentLevel(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xc9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xc9, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4354,7 +4354,7 @@ void Range::InsertIndent(long InsertAmount) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x565, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x565, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, InsertAmount); } @@ -4362,14 +4362,14 @@ void Range::Insert(const VARIANT& Shift) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xfc, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0xfc, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Shift); } LPDISPATCH Range::GetInterior() { LPDISPATCH result; - InvokeHelper(0x81, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x81, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4387,45 +4387,45 @@ void Range::SetItem(const VARIANT& RowIndex, const VARIANT& ColumnIndex, const V { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0xaa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xaa, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &RowIndex, &ColumnIndex, &newValue); } void Range::Justify() { - InvokeHelper(0x1ef, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x1ef, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } VARIANT Range::GetLeft() { VARIANT result; - InvokeHelper(0x7f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x7f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } long Range::GetListHeaderRows() { long result; - InvokeHelper(0x4a3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x4a3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } void Range::ListNames() { - InvokeHelper(0xfd, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xfd, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } long Range::GetLocationInTable() { long result; - InvokeHelper(0x2b3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x2b3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } VARIANT Range::GetLocked() { VARIANT result; - InvokeHelper(0x10d, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x10d, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4433,7 +4433,7 @@ void Range::SetLocked(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x10d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x10d, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4441,26 +4441,26 @@ void Range::Merge(const VARIANT& Across) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x234, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x234, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Across); } void Range::UnMerge() { - InvokeHelper(0x568, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x568, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH Range::GetMergeArea() { LPDISPATCH result; - InvokeHelper(0x569, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x569, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetMergeCells() { VARIANT result; - InvokeHelper(0xd0, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xd0, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4468,14 +4468,14 @@ void Range::SetMergeCells(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xd0, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xd0, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetName() { VARIANT result; - InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x6e, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4483,7 +4483,7 @@ void Range::SetName(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x6e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x6e, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4491,21 +4491,21 @@ void Range::NavigateArrow(const VARIANT& TowardPrecedent, const VARIANT& ArrowNu { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x408, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x408, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &TowardPrecedent, &ArrowNumber, &LinkNumber); } LPUNKNOWN Range::Get_NewEnum() { LPUNKNOWN result; - InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL); + InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetNext() { LPDISPATCH result; - InvokeHelper(0x1f6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1f6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4522,7 +4522,7 @@ CString Range::NoteText(const VARIANT& Text, const VARIANT& Start, const VARIANT VARIANT Range::GetNumberFormat() { VARIANT result; - InvokeHelper(0xc1, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xc1, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4530,14 +4530,14 @@ void Range::SetNumberFormat(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xc1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xc1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetNumberFormatLocal() { VARIANT result; - InvokeHelper(0x449, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x449, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4545,7 +4545,7 @@ void Range::SetNumberFormatLocal(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x449, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x449, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4562,7 +4562,7 @@ LPDISPATCH Range::GetOffset(const VARIANT& RowOffset, const VARIANT& ColumnOffse VARIANT Range::GetOrientation() { VARIANT result; - InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4570,14 +4570,14 @@ void Range::SetOrientation(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetOutlineLevel() { VARIANT result; - InvokeHelper(0x10f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x10f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4585,14 +4585,14 @@ void Range::SetOutlineLevel(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x10f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x10f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } long Range::GetPageBreak() { long result; - InvokeHelper(0xff, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0xff, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -4600,7 +4600,7 @@ void Range::SetPageBreak(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0xff, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xff, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } @@ -4608,7 +4608,7 @@ void Range::Parse(const VARIANT& ParseLine, const VARIANT& Destination) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1dd, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1dd, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &ParseLine, &Destination); } @@ -4616,49 +4616,49 @@ void Range::PasteSpecial(long Paste, long Operation, const VARIANT& SkipBlanks, { static BYTE parms[] = VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x403, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x403, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Paste, Operation, &SkipBlanks, &Transpose); } LPDISPATCH Range::GetPivotField() { LPDISPATCH result; - InvokeHelper(0x2db, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x2db, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetPivotItem() { LPDISPATCH result; - InvokeHelper(0x2e4, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x2e4, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetPivotTable() { LPDISPATCH result; - InvokeHelper(0x2cc, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x2cc, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetPrecedents() { LPDISPATCH result; - InvokeHelper(0x220, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x220, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetPrefixCharacter() { VARIANT result; - InvokeHelper(0x1f8, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x1f8, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetPrevious() { LPDISPATCH result; - InvokeHelper(0x1f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x1f7, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4666,7 +4666,7 @@ void Range::PrintOut(const VARIANT& From, const VARIANT& To, const VARIANT& Copi { static BYTE parms[] = VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x389, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &From, &To, &Copies, &Preview, &ActivePrinter, &PrintToFile, &Collate); } @@ -4674,14 +4674,14 @@ void Range::PrintPreview(const VARIANT& EnableChanges) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x119, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &EnableChanges); } LPDISPATCH Range::GetQueryTable() { LPDISPATCH result; - InvokeHelper(0x56a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x56a, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4697,7 +4697,7 @@ LPDISPATCH Range::GetRange(const VARIANT& Cell1, const VARIANT& Cell2) void Range::RemoveSubtotal() { - InvokeHelper(0x373, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x373, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } BOOL Range::Replace(const VARIANT& What, const VARIANT& Replacement, const VARIANT& LookAt, const VARIANT& SearchOrder, const VARIANT& MatchCase, const VARIANT& MatchByte, const VARIANT& MatchControlCharacters, const VARIANT& MatchDiacritics, @@ -4724,7 +4724,7 @@ LPDISPATCH Range::GetResize(const VARIANT& RowSize, const VARIANT& ColumnSize) long Range::GetRow() { long result; - InvokeHelper(0x101, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x101, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -4741,7 +4741,7 @@ LPDISPATCH Range::RowDifferences(const VARIANT& Comparison) VARIANT Range::GetRowHeight() { VARIANT result; - InvokeHelper(0x110, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x110, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4749,14 +4749,14 @@ void Range::SetRowHeight(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x110, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x110, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } LPDISPATCH Range::GetRows() { LPDISPATCH result; - InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x102, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4775,26 +4775,26 @@ VARIANT Range::Run(const VARIANT& Arg1, const VARIANT& Arg2, const VARIANT& Arg3 void Range::Select() { - InvokeHelper(0xeb, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xeb, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::Show() { - InvokeHelper(0x1f0, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x1f0, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ShowDependents(const VARIANT& Remove) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x36d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x36d, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Remove); } VARIANT Range::GetShowDetail() { VARIANT result; - InvokeHelper(0x249, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x249, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4802,27 +4802,27 @@ void Range::SetShowDetail(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x249, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x249, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } void Range::ShowErrors() { - InvokeHelper(0x36e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x36e, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } void Range::ShowPrecedents(const VARIANT& Remove) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x36f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x36f, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Remove); } VARIANT Range::GetShrinkToFit() { VARIANT result; - InvokeHelper(0xd1, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0xd1, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4830,7 +4830,7 @@ void Range::SetShrinkToFit(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0xd1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0xd1, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4839,7 +4839,7 @@ void Range::Sort(const VARIANT& Key1, long Order1, const VARIANT& Key2, const VA { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x370, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x370, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Key1, Order1, &Key2, &Type, Order2, &Key3, Order3, Header, &OrderCustom, &MatchCase, Orientation, SortMethod, &IgnoreControlCharacters, &IgnoreDiacritics, &IgnoreKashida); } @@ -4847,14 +4847,14 @@ void Range::SortSpecial(long SortMethod, const VARIANT& Key1, long Order1, const { static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_I4 VTS_VARIANT VTS_VARIANT VTS_I4 VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_I4; - InvokeHelper(0x371, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x371, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, SortMethod, &Key1, Order1, &Type, &Key2, Order2, &Key3, Order3, Header, &OrderCustom, &MatchCase, Orientation); } LPDISPATCH Range::GetSoundNote() { LPDISPATCH result; - InvokeHelper(0x394, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x394, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -4871,7 +4871,7 @@ LPDISPATCH Range::SpecialCells(long Type, const VARIANT& Value) VARIANT Range::GetStyle() { VARIANT result; - InvokeHelper(0x104, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x104, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4879,7 +4879,7 @@ void Range::SetStyle(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x104, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x104, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -4887,7 +4887,7 @@ void Range::SubscribeTo(LPCTSTR Edition, long Format) { static BYTE parms[] = VTS_BSTR VTS_I4; - InvokeHelper(0x1e1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1e1, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, Edition, Format); } @@ -4895,14 +4895,14 @@ void Range::Subtotal(long GroupBy, long Function, const VARIANT& TotalList, cons { static BYTE parms[] = VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_I4; - InvokeHelper(0x372, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x372, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, GroupBy, Function, &TotalList, &Replace, &PageBreaks, SummaryBelowData); } VARIANT Range::GetSummary() { VARIANT result; - InvokeHelper(0x111, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x111, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4910,14 +4910,14 @@ void Range::Table(const VARIANT& RowInput, const VARIANT& ColumnInput) { static BYTE parms[] = VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x1f1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x1f1, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &RowInput, &ColumnInput); } VARIANT Range::GetText() { VARIANT result; - InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4926,26 +4926,26 @@ void Range::TextToColumns(const VARIANT& Destination, long DataType, long TextQu { static BYTE parms[] = VTS_VARIANT VTS_I4 VTS_I4 VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT; - InvokeHelper(0x410, DISPATCH_METHOD, VT_EMPTY, NULL, parms, + InvokeHelper(0x410, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, &Destination, DataType, TextQualifier, &ConsecutiveDelimiter, &Tab, &Semicolon, &Comma, &Space, &Other, &OtherChar, &FieldInfo); } VARIANT Range::GetTop() { VARIANT result; - InvokeHelper(0x7e, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x7e, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } void Range::Ungroup() { - InvokeHelper(0xf4, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0xf4, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } VARIANT Range::GetUseStandardHeight() { VARIANT result; - InvokeHelper(0x112, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x112, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4953,14 +4953,14 @@ void Range::SetUseStandardHeight(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x112, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x112, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetUseStandardWidth() { VARIANT result; - InvokeHelper(0x113, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x113, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4968,21 +4968,21 @@ void Range::SetUseStandardWidth(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x113, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x113, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } LPDISPATCH Range::GetValidation() { LPDISPATCH result; - InvokeHelper(0x56b, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x56b, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetValue() { VARIANT result; - InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -4990,14 +4990,14 @@ void Range::SetValue(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetValue2() { VARIANT result; - InvokeHelper(0x56c, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x56c, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5005,14 +5005,14 @@ void Range::SetValue2(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x56c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x56c, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetVerticalAlignment() { VARIANT result; - InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5020,28 +5020,28 @@ void Range::SetVerticalAlignment(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Range::GetWidth() { VARIANT result; - InvokeHelper(0x7a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x7a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetWorksheet() { LPDISPATCH result; - InvokeHelper(0x15c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x15c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Range::GetWrapText() { VARIANT result; - InvokeHelper(0x114, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x114, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5049,7 +5049,7 @@ void Range::SetWrapText(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x114, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x114, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -5066,33 +5066,33 @@ LPDISPATCH Range::AddComment(const VARIANT& Text) LPDISPATCH Range::GetComment() { LPDISPATCH result; - InvokeHelper(0x38e, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x38e, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } void Range::ClearComments() { - InvokeHelper(0x56e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL); + InvokeHelper(0x56e, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr); } LPDISPATCH Range::GetPhonetic() { LPDISPATCH result; - InvokeHelper(0x56f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x56f, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } LPDISPATCH Range::GetFormatConditions() { LPDISPATCH result; - InvokeHelper(0x570, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x570, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Range::GetReadingOrder() { long result; - InvokeHelper(0x3cf, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x3cf, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -5100,14 +5100,14 @@ void Range::SetReadingOrder(long nNewValue) { static BYTE parms[] = VTS_I4; - InvokeHelper(0x3cf, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x3cf, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, nNewValue); } LPDISPATCH Range::GetHyperlinks() { LPDISPATCH result; - InvokeHelper(0x571, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x571, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } @@ -5121,28 +5121,28 @@ LPDISPATCH Range::GetHyperlinks() LPDISPATCH Border::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Border::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH Border::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Border::GetColor() { VARIANT result; - InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5150,14 +5150,14 @@ void Border::SetColor(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Border::GetColorIndex() { VARIANT result; - InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5165,14 +5165,14 @@ void Border::SetColorIndex(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Border::GetLineStyle() { VARIANT result; - InvokeHelper(0x77, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x77, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5180,14 +5180,14 @@ void Border::SetLineStyle(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x77, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x77, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Border::GetWeight() { VARIANT result; - InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5195,7 +5195,7 @@ void Border::SetWeight(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -5209,28 +5209,28 @@ void Border::SetWeight(const VARIANT& newValue) LPDISPATCH Borders::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Borders::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH Borders::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Borders::GetColor() { VARIANT result; - InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5238,14 +5238,14 @@ void Borders::SetColor(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Borders::GetColorIndex() { VARIANT result; - InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5253,14 +5253,14 @@ void Borders::SetColorIndex(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } long Borders::GetCount() { long result; - InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x76, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } @@ -5277,7 +5277,7 @@ LPDISPATCH Borders::GetItem(long Index) VARIANT Borders::GetLineStyle() { VARIANT result; - InvokeHelper(0x77, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x77, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5285,21 +5285,21 @@ void Borders::SetLineStyle(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x77, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x77, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } LPUNKNOWN Borders::Get_NewEnum() { LPUNKNOWN result; - InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL); + InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, nullptr); return result; } VARIANT Borders::GetValue() { VARIANT result; - InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5307,14 +5307,14 @@ void Borders::SetValue(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Borders::GetWeight() { VARIANT result; - InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5322,7 +5322,7 @@ void Borders::SetWeight(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } @@ -5346,28 +5346,28 @@ LPDISPATCH Borders::Get_Default(long Index) LPDISPATCH Interior::GetApplication() { LPDISPATCH result; - InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x94, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } long Interior::GetCreator() { long result; - InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL); + InvokeHelper(0x95, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, nullptr); return result; } LPDISPATCH Interior::GetParent() { LPDISPATCH result; - InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL); + InvokeHelper(0x96, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, nullptr); return result; } VARIANT Interior::GetColor() { VARIANT result; - InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5375,14 +5375,14 @@ void Interior::SetColor(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x63, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Interior::GetColorIndex() { VARIANT result; - InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x61, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5390,14 +5390,14 @@ void Interior::SetColorIndex(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x61, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Interior::GetInvertIfNegative() { VARIANT result; - InvokeHelper(0x84, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x84, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5405,14 +5405,14 @@ void Interior::SetInvertIfNegative(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x84, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x84, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Interior::GetPattern() { VARIANT result; - InvokeHelper(0x5f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x5f, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5420,14 +5420,14 @@ void Interior::SetPattern(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x5f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x5f, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Interior::GetPatternColor() { VARIANT result; - InvokeHelper(0x64, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x64, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5435,14 +5435,14 @@ void Interior::SetPatternColor(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x64, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x64, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } VARIANT Interior::GetPatternColorIndex() { VARIANT result; - InvokeHelper(0x62, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL); + InvokeHelper(0x62, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, nullptr); return result; } @@ -5450,6 +5450,6 @@ void Interior::SetPatternColorIndex(const VARIANT& newValue) { static BYTE parms[] = VTS_VARIANT; - InvokeHelper(0x62, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, + InvokeHelper(0x62, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, &newValue); } diff --git a/Core/Tools/Babylon/expimp.cpp b/Core/Tools/Babylon/expimp.cpp index 1b933889d38..235651df502 100644 --- a/Core/Tools/Babylon/expimp.cpp +++ b/Core/Tools/Babylon/expimp.cpp @@ -102,7 +102,7 @@ static void translateCopy( OLECHAR *outbuf, OLECHAR *inbuf ) { static OLECHAR buffer[100*1024]; - OLECHAR *firstLetter = NULL, *lastLetter; + OLECHAR *firstLetter = nullptr, *lastLetter; OLECHAR *b = buffer; int formatWord = FALSE; OLECHAR ch; @@ -118,7 +118,7 @@ static void translateCopy( OLECHAR *outbuf, OLECHAR *inbuf ) lastLetter = b-1; reverseWord ( firstLetter, lastLetter ); } - firstLetter = NULL; + firstLetter = nullptr; formatWord = FALSE; } *b++ = ch; @@ -200,7 +200,7 @@ static void writeText ( BabylonText *text, int row ) wcscpy ( olebuf, text->Get()); EncodeFormat ( olebuf ); PutCell ( row, CELL_ENGLISH, olebuf , 0); - PutCell ( row, CELL_MAXLEN, NULL , maxlen ); + PutCell ( row, CELL_MAXLEN, nullptr , maxlen ); swprintf ( buffer, L"=LEN(%c%d)",'A' + CELL_LOCALIZED -1, row ); PutCell ( row, CELL_STRLEN, buffer , 0); @@ -394,8 +394,8 @@ static int export_trans ( TransDB *db, LangID langid, TROPTIONS *options, void ( if ( write ) { - PutCell ( row, CELL_STRINGID, NULL, -1 ); - PutCell ( ROW_COUNT, COLUMN_COUNT, NULL, count ); + PutCell ( row, CELL_STRINGID, nullptr, -1 ); + PutCell ( ROW_COUNT, COLUMN_COUNT, nullptr, count ); } return count; @@ -405,7 +405,7 @@ static int export_trans ( TransDB *db, LangID langid, TROPTIONS *options, void ( int ExportTranslations ( TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg ) { int exports ; - exports = export_trans ( db, langid, options, NULL, FALSE ); + exports = export_trans ( db, langid, options, nullptr, FALSE ); if ( !exports ) { @@ -563,7 +563,7 @@ static int import_trans ( TransDB *db, LangID langid, void (*cb) ( void ), CBaby BabylonText *text; - if ( (text = db->FindText ( id )) == NULL ) + if ( (text = db->FindText ( id )) == nullptr ) { // string is no longer in database stale_count++; @@ -757,7 +757,7 @@ static int update_sent_trans ( TransDB *db, LangID langid, void (*cb) ( void ), BabylonText *text; - if ( (text = db->FindText ( id )) == NULL ) + if ( (text = db->FindText ( id )) == nullptr ) { // string is no longer in database unmatched++; @@ -1408,7 +1408,7 @@ void ProcessWaves ( TransDB *db, const char *filename, CBabylonDlg *dlg ) int last_row = 1; int matches = 0; int unmatched = 0; - FILE *file = NULL; + FILE *file = nullptr; char *ptr; strcpy ( buffer, filename ); @@ -1483,7 +1483,7 @@ int GenerateReport ( TransDB *db, const char *filename, RPOPTIONS *options, Lang LangID langid; int count= 0 ; int num; - FILE *file = NULL; + FILE *file = nullptr; if ( dlg ) { diff --git a/Core/Tools/Babylon/expimp.h b/Core/Tools/Babylon/expimp.h index b15d0252dc9..78a94f44bb0 100644 --- a/Core/Tools/Babylon/expimp.h +++ b/Core/Tools/Babylon/expimp.h @@ -100,9 +100,9 @@ typedef struct } CSF_HEADER; -int ExportTranslations ( TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg = NULL ); -int ImportTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = NULL ); -int UpdateSentTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = NULL ); -int GenerateGameFiles ( TransDB *db, const char *filename, GNOPTIONS *option, LangID *languages, CBabylonDlg *dlg = NULL ); -int GenerateReport ( TransDB *db, const char *filename, RPOPTIONS *options, LangID *languages, CBabylonDlg *dlg = NULL ); +int ExportTranslations ( TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg = nullptr ); +int ImportTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = nullptr ); +int UpdateSentTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg = nullptr ); +int GenerateGameFiles ( TransDB *db, const char *filename, GNOPTIONS *option, LangID *languages, CBabylonDlg *dlg = nullptr ); +int GenerateReport ( TransDB *db, const char *filename, RPOPTIONS *options, LangID *languages, CBabylonDlg *dlg = nullptr ); void ProcessWaves ( TransDB *db, const char *filename, CBabylonDlg *dlg ); diff --git a/Core/Tools/Babylon/iff.cpp b/Core/Tools/Babylon/iff.cpp index d8fc596717b..36b12d77c1b 100644 --- a/Core/Tools/Babylon/iff.cpp +++ b/Core/Tools/Babylon/iff.cpp @@ -92,7 +92,7 @@ int IFF_seek ( IFF_FILE *iff, int pos, int mode ) IFF_FILE *IFF_Open ( const char *name ) { - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE)))) @@ -118,7 +118,7 @@ IFF_FILE *IFF_Open ( const char *name ) IFF_Close ( iff ); } - return NULL; + return nullptr; } /******************************************************************/ @@ -128,7 +128,7 @@ IFF_FILE *IFF_Open ( const char *name ) IFF_FILE *IFF_Load ( const char *name ) { - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE)))) { @@ -164,7 +164,7 @@ IFF_FILE *IFF_Load ( const char *name ) IFF_Close ( iff ); } - return NULL; + return nullptr; } /******************************************************************/ @@ -359,7 +359,7 @@ int IFF_Read ( IFF_FILE *iff, void *buff, int size ) IFF_FILE *IFF_New ( const char *name ) { - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; if ( ! (iff = (IFF_FILE *) malloc ( sizeof (IFF_FILE)))) @@ -384,7 +384,7 @@ IFF_FILE *IFF_New ( const char *name ) IFF_Close ( iff ); } - return NULL; + return nullptr; } /******************************************************************/ diff --git a/Core/Tools/Babylon/list.cpp b/Core/Tools/Babylon/list.cpp index 738a78f3d4f..bf076b0d89c 100644 --- a/Core/Tools/Babylon/list.cpp +++ b/Core/Tools/Babylon/list.cpp @@ -29,7 +29,7 @@ ListNode::ListNode ( void ) { prev = next = this; pri = NORMAL_PRIORITY; - item = NULL; + item = nullptr; } void ListNode::Append ( ListNode *new_node ) @@ -71,7 +71,7 @@ ListNode* ListNode::Next ( void ) { if ( next->IsHead ( ) ) { - return NULL; + return nullptr; } return next; @@ -81,7 +81,7 @@ ListNode* ListNode::Prev ( void ) { if ( prev->IsHead () ) { - return NULL; + return nullptr; } return prev; @@ -97,7 +97,7 @@ ListNode* ListNode::NextLoop ( void ) next_node = next_node->next; if ( next_node->IsHead ( )) { - return NULL; /* it is an empty list */ + return nullptr; /* it is an empty list */ } } @@ -115,7 +115,7 @@ ListNode* ListNode::PrevLoop ( void ) prev_node = prev_node->prev; if ( prev_node->IsHead ( )) { - return NULL; /* it is an empty list */ + return nullptr; /* it is an empty list */ } } @@ -265,7 +265,7 @@ void* List::Item ( int list_index ) return node->Item(); } - return NULL; + return nullptr; } ListNode* List::FirstNode ( void ) @@ -312,5 +312,5 @@ ListNode* List::Find ( void *item ) node = node->Next (); } - return NULL; + return nullptr; } diff --git a/Core/Tools/Babylon/loadsave.cpp b/Core/Tools/Babylon/loadsave.cpp index e3a7c30ebbd..f1a0e88963f 100644 --- a/Core/Tools/Babylon/loadsave.cpp +++ b/Core/Tools/Babylon/loadsave.cpp @@ -216,7 +216,7 @@ int WriteMainDB(TransDB *db, const char *filename, CBabylonDlg *dlg ) ListSearch sh_label; ListSearch sh_text; int count = 0; - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; DBINFO dbinfo; int ok = FALSE; @@ -339,11 +339,11 @@ int WriteMainDB(TransDB *db, const char *filename, CBabylonDlg *dlg ) int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) { - BabylonLabel *label = NULL; - BabylonText *text = NULL; - Translation *trans = NULL; + BabylonLabel *label = nullptr; + BabylonText *text = nullptr; + Translation *trans = nullptr; int count = 0; - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; DBINFO dbinfo; int ok = FALSE; @@ -393,14 +393,14 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) db->AddObsolete ( text ); } - text = NULL; + text = nullptr; } if ( label ) { count++; db->AddLabel ( label ); - label = NULL; + label = nullptr; if ( cb ) { cb (); @@ -459,7 +459,7 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) db->AddObsolete ( text ); } - text = NULL; + text = nullptr; } if ( ! (text = new BabylonText ())) @@ -547,7 +547,7 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) { delete trans; } - trans = NULL; + trans = nullptr; break; } @@ -565,14 +565,14 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) db->AddObsolete ( text ); } - text = NULL; + text = nullptr; } if ( label ) { count++; db->AddLabel ( label ); - label = NULL; + label = nullptr; if ( cb ) { cb (); @@ -605,7 +605,7 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) int GetLabelCountDB ( char *filename ) { - IFF_FILE *iff = NULL; + IFF_FILE *iff = nullptr; DBINFO dbinfo; int count = 0; diff --git a/Core/Tools/Babylon/loadsave.h b/Core/Tools/Babylon/loadsave.h index cde180af921..c69a3769904 100644 --- a/Core/Tools/Babylon/loadsave.h +++ b/Core/Tools/Babylon/loadsave.h @@ -23,5 +23,5 @@ #pragma once int WriteMainDB(TransDB *db, const char *filename, CBabylonDlg *dlg ); -int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void ) = NULL ); +int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void ) = nullptr ); int GetLabelCountDB ( char *filename ); diff --git a/Core/Tools/Babylon/olestring.cpp b/Core/Tools/Babylon/olestring.cpp index 1d5cd26a75c..762e063d775 100644 --- a/Core/Tools/Babylon/olestring.cpp +++ b/Core/Tools/Babylon/olestring.cpp @@ -62,8 +62,8 @@ template int IsFormatTypeChar ( text ch ) OLEString::OLEString ( void ) { - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = 0; Unlock (); @@ -75,8 +75,8 @@ OLEString::~OLEString ( ) { delete [] ole; delete [] sb; - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = 0; } @@ -88,8 +88,8 @@ void OLEString::Set ( OLECHAR *new_ole ) { delete [] ole; delete [] sb; - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = wcslen ( new_ole ); { @@ -109,8 +109,8 @@ void OLEString::Set ( const char *new_sb ) { delete [] ole; delete [] sb; - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = strlen ( new_sb ); @@ -207,7 +207,7 @@ void OLEString::FormatMetaString ( void ) Set ( string ); delete [] string; - string = NULL; + string = nullptr; } template void StripSpaces ( text *string ) diff --git a/Core/Tools/CRCDiff/CRCDiff.cpp b/Core/Tools/CRCDiff/CRCDiff.cpp index 62d57e993cb..36ed86871e6 100644 --- a/Core/Tools/CRCDiff/CRCDiff.cpp +++ b/Core/Tools/CRCDiff/CRCDiff.cpp @@ -45,7 +45,7 @@ static bool getNextLine(FILE *fp, char *line, int& frame, int& index) { return false; char buf[LINESIZE]; - while (fgets(buf, LINESIZE-1, fp) != NULL) + while (fgets(buf, LINESIZE-1, fp) != nullptr) { int len = strlen(buf); if (buf[len-1] == '\n') @@ -70,7 +70,7 @@ static std::string readInFile(const char *fname) { std::string ret; char buf[LINESIZE]; - while (fgets(buf, LINESIZE-1, fp) != NULL) + while (fgets(buf, LINESIZE-1, fp) != nullptr) { ret.append(buf); } @@ -81,7 +81,7 @@ static std::string readInFile(const char *fname) { //============================================================================= -static FILE *ofp = NULL; +static FILE *ofp = nullptr; void dumpQueued(void); @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) atexit(exitWait); const char *inFname[2]; const char *outFname = "out.html"; - FILE *ifp[2] = {NULL, NULL}; + FILE *ifp[2] = { nullptr, nullptr}; std::string header, footer; if (argc != 7) @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) if (seenRight && seenLeft) { outputLine(lastFrame[0], lastIndex[0], linkNum++, - "leftOnly", lastLine[0], NULL, NULL); + "leftOnly", lastLine[0], nullptr, nullptr); ++numDiffs; } lastFrame[0] = -1; @@ -278,7 +278,7 @@ int main(int argc, char *argv[]) if (seenRight && seenLeft) { outputLine(lastFrame[1], lastIndex[1], linkNum++, - NULL, NULL, "rightOnly", lastLine[1]); + nullptr, nullptr, "rightOnly", lastLine[1]); ++numDiffs; } lastFrame[1] = -1; @@ -329,7 +329,7 @@ int main(int argc, char *argv[]) if (seenRight && seenLeft) { outputLine(lastFrame[0], lastIndex[0], linkNum++, - "leftOnly", lastLine[0], NULL, NULL); + "leftOnly", lastLine[0], nullptr, nullptr); ++numDiffs; } lastFrame[0] = -1; @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) if (seenRight && seenLeft) { outputLine(lastFrame[1], lastIndex[1], linkNum++, - NULL, NULL, "rightOnly", lastLine[1]); + nullptr, nullptr, "rightOnly", lastLine[1]); ++numDiffs; } lastFrame[1] = -1; diff --git a/Core/Tools/DebugWindow/DebugWindow.cpp b/Core/Tools/DebugWindow/DebugWindow.cpp index bc15074c03e..c01d0418c00 100644 --- a/Core/Tools/DebugWindow/DebugWindow.cpp +++ b/Core/Tools/DebugWindow/DebugWindow.cpp @@ -73,7 +73,7 @@ CDebugWindowApp::CDebugWindowApp() { AfxInitialize(true); AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = NULL; + m_DialogWindow = nullptr; } DebugWindowDialog* CDebugWindowApp::GetDialogWindow(void) @@ -103,7 +103,7 @@ void __declspec(dllexport) CreateDebugDialog(void) DebugWindowDialog* tmpWnd; tmpWnd = new DebugWindowDialog; tmpWnd->Create(DebugWindowDialog::IDD); - tmpWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + tmpWnd->SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); tmpWnd->ShowWindow(SW_SHOW); if (tmpWnd->GetMainWndHWND()) { SetFocus(tmpWnd->GetMainWndHWND()); @@ -120,7 +120,7 @@ void __declspec(dllexport) DestroyDebugDialog(void) if (tmpWnd) { tmpWnd->DestroyWindow(); delete tmpWnd; - theApp.SetDialogWindow(NULL); + theApp.SetDialogWindow(nullptr); } } diff --git a/Core/Tools/DebugWindow/DebugWindowDialog.cpp b/Core/Tools/DebugWindow/DebugWindowDialog.cpp index 202f6e87584..91667ad4ac8 100644 --- a/Core/Tools/DebugWindow/DebugWindowDialog.cpp +++ b/Core/Tools/DebugWindow/DebugWindowDialog.cpp @@ -25,7 +25,7 @@ DebugWindowDialog::DebugWindowDialog(UINT nIDTemplate, CWnd* pParentWnd) : mStepping = false; mRunFast = false; mNumberOfStepsAllowed = -1; - mMainWndHWND = ::FindWindow(NULL, "Command & Conquer: Generals"); + mMainWndHWND = ::FindWindow(nullptr, "Command & Conquer: Generals"); } int DebugWindowDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) diff --git a/Core/Tools/DebugWindow/DebugWindowDialog.h b/Core/Tools/DebugWindow/DebugWindowDialog.h index 5fb09d0c01d..6e1751f9a72 100644 --- a/Core/Tools/DebugWindow/DebugWindowDialog.h +++ b/Core/Tools/DebugWindow/DebugWindowDialog.h @@ -34,7 +34,7 @@ class DebugWindowDialog : public CDialog { public: enum {IDD = IDD_DebugWindow}; - DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = NULL); + DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = nullptr); bool CanProceed(void); bool RunAppFast(void); diff --git a/Core/Tools/ImagePacker/Include/ImageDirectory.h b/Core/Tools/ImagePacker/Include/ImageDirectory.h index d2b64c33efe..2cece795979 100644 --- a/Core/Tools/ImagePacker/Include/ImageDirectory.h +++ b/Core/Tools/ImagePacker/Include/ImageDirectory.h @@ -72,9 +72,9 @@ class ImageDirectory inline ImageDirectory::~ImageDirectory( void ) { delete m_path; } inline ImageDirectory::ImageDirectory( void ) { - m_path = NULL; - m_next = NULL; - m_prev = NULL; + m_path = nullptr; + m_next = nullptr; + m_prev = nullptr; m_imageCount = 0; } diff --git a/Core/Tools/ImagePacker/Include/TexturePage.h b/Core/Tools/ImagePacker/Include/TexturePage.h index ab0cd5142b5..cc5e9d781a7 100644 --- a/Core/Tools/ImagePacker/Include/TexturePage.h +++ b/Core/Tools/ImagePacker/Include/TexturePage.h @@ -97,7 +97,7 @@ class TexturePage Int getHeight( void ); ///< get height of texture page // get rgb from final generated texture (putting this in for quick preview) - void getPixel( Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a = NULL ); + void getPixel( Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a = nullptr ); TexturePage *m_next; TexturePage *m_prev; diff --git a/Core/Tools/ImagePacker/Source/ImageInfo.cpp b/Core/Tools/ImagePacker/Source/ImageInfo.cpp index 46d483ac0cc..4a71bfe10ca 100644 --- a/Core/Tools/ImagePacker/Source/ImageInfo.cpp +++ b/Core/Tools/ImagePacker/Source/ImageInfo.cpp @@ -70,14 +70,14 @@ ImageInfo::ImageInfo( void ) m_colorDepth = 0; m_size.x = 0; m_size.y = 0; - m_path = NULL; - m_filenameOnly = NULL; - m_filenameOnlyNoExt = NULL; + m_path = nullptr; + m_filenameOnly = nullptr; + m_filenameOnlyNoExt = nullptr; m_status = UNPACKED; - m_page = NULL; - m_nextPageImage = NULL; - m_prevPageImage = NULL; + m_page = nullptr; + m_nextPageImage = nullptr; + m_prevPageImage = nullptr; m_pagePos.lo.x = 0; m_pagePos.lo.y = 0; m_pagePos.hi.x = 0; diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index d0abc547ba8..bed92b2f9c2 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -61,7 +61,7 @@ const char *gAppPrefix = "ip_"; // So IP can have a different debug log file nam /////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -ImagePacker *TheImagePacker = NULL; +ImagePacker *TheImagePacker = nullptr; // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -80,23 +80,23 @@ TexturePage *ImagePacker::createNewTexturePage( void ) // allocate new page page = new TexturePage( getTargetWidth(), getTargetHeight() ); - if( page == NULL ) + if( page == nullptr ) { DEBUG_ASSERTCRASH( page, ("Unable to allocate new texture page.") ); - return NULL; + return nullptr; } // link page to list - page->m_prev = NULL; + page->m_prev = nullptr; page->m_next = m_pageList; if( m_pageList ) m_pageList->m_prev = page; m_pageList = page; // add the tail pointer if this is the first page - if( m_pageTail == NULL ) + if( m_pageTail == nullptr ) m_pageTail = page; // we got a new page now @@ -134,10 +134,10 @@ Bool ImagePacker::validateImages( void ) image = m_imageList[ i ]; // sanity - if( image == NULL ) + if( image == nullptr ) { - DEBUG_ASSERTCRASH( image, ("Image in imagelist is NULL") ); + DEBUG_ASSERTCRASH( image, ("Image in imagelist is null") ); continue; // should never happen } @@ -195,8 +195,8 @@ Bool ImagePacker::validateImages( void ) Bool ImagePacker::packImages( void ) { UnsignedInt i; - TexturePage *page = NULL; - ImageInfo *image = NULL; + TexturePage *page = nullptr; + ImageInfo *image = nullptr; // // first sanity check all images loaded, if there are images that cannot @@ -238,11 +238,11 @@ Bool ImagePacker::packImages( void ) } // if image was not able to go on any existing page create a new page for it - if( page == NULL ) + if( page == nullptr ) { page = createNewTexturePage(); - if( page == NULL ) + if( page == nullptr ) return FALSE; // try to add the image to this page @@ -252,7 +252,7 @@ Bool ImagePacker::packImages( void ) sprintf( buffer, "Unable to add image '%s' to a brand new page!\n", image->m_path ); DEBUG_ASSERTCRASH( 0, (buffer) ); - MessageBox( NULL, buffer, "Internal Error", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; } @@ -363,7 +363,7 @@ void ImagePacker::addImagesInDirectory( char *dir ) { // sanity - if( dir == NULL ) + if( dir == nullptr ) return; char currDir[ _MAX_PATH ]; @@ -461,7 +461,7 @@ Bool ImagePacker::checkOutputDirectory( void ) GetCurrentDirectory( _MAX_PATH, currDir ); // create the output directory if it does not exist - CreateDirectory( m_outputDirectory, NULL ); + CreateDirectory( m_outputDirectory, nullptr ); // change into the output directory SetCurrentDirectory( m_outputDirectory ); @@ -504,7 +504,7 @@ Bool ImagePacker::checkOutputDirectory( void ) sprintf( buffer, "The output directory (%s) must be empty before proceeding. Delete '%d' files and continue with build process?", m_outputDirectory, fileCount ); - response = MessageBox( NULL, buffer, + response = MessageBox( nullptr, buffer, "Delete files to continue?", MB_YESNO | MB_ICONWARNING ); @@ -572,7 +572,7 @@ void ImagePacker::resetPageList( void ) } - m_pageTail = NULL; + m_pageTail = nullptr; m_pageCount = 0; m_targetPreviewPage = 1; @@ -606,7 +606,7 @@ void ImagePacker::resetImageList( void ) { delete [] m_imageList; - m_imageList = NULL; + m_imageList = nullptr; m_imageCount = 0; } @@ -625,7 +625,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) HANDLE hFile; // handle for search resources // santiy - if( path == NULL ) + if( path == nullptr ) return; // check to see if path is already in list @@ -643,10 +643,10 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) // image is not in list, make a new entry and link to the list dir = new ImageDirectory; - if( dir == NULL ) + if( dir == nullptr ) { - MessageBox( NULL, "Unable to allocate image directory", "Error", + MessageBox( nullptr, "Unable to allocate image directory", "Error", MB_OK | MB_ICONERROR ); return; @@ -656,10 +656,10 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) Int len = strlen( path ); dir->m_path = new char[ len + 1 ]; strcpy( dir->m_path, path ); - if( dir->m_path == NULL ) + if( dir->m_path == nullptr ) { - MessageBox( NULL, "Unable to allocate path for directory", "Error", + MessageBox( nullptr, "Unable to allocate path for directory", "Error", MB_OK | MB_ICONERROR ); delete dir; return; @@ -667,7 +667,7 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) } // tie to list - dir->m_prev = NULL; + dir->m_prev = nullptr; dir->m_next = m_dirList; if( m_dirList ) m_dirList->m_prev = dir; @@ -788,15 +788,15 @@ void ImagePacker::addImage( char *path ) { // sanity - if( path == NULL ) + if( path == nullptr ) return; // allocate a new entry ImageInfo *info = new ImageInfo; - if( info == NULL ) + if( info == nullptr ) { - MessageBox( NULL, "Unable to allocate image info", "Error", + MessageBox( nullptr, "Unable to allocate image info", "Error", MB_OK | MB_ICONERROR ); return; @@ -806,10 +806,10 @@ void ImagePacker::addImage( char *path ) Int len = strlen( path ); info->m_path = new char[ len + 1 ]; strcpy( info->m_path, path ); - if( info->m_path == NULL ) + if( info->m_path == nullptr ) { - MessageBox( NULL, "Unable to allcoate image path info", "Error", + MessageBox( nullptr, "Unable to allcoate image path info", "Error", MB_OK | MB_ICONERROR ); delete info; return; @@ -869,12 +869,12 @@ Bool ImagePacker::generateINIFile( void ) // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) { char buffer[ _MAX_PATH + 64 ]; sprintf( buffer, "Cannot open INI file '%s' for writing.", filename ); - MessageBox( NULL, buffer, "Error Opening File", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Error Opening File", MB_OK | MB_ICONERROR ); return FALSE; } @@ -948,7 +948,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) Int i; // sanity - if( dialog == NULL ) + if( dialog == nullptr ) return FALSE; // if we are using a user target image size, it must be a power of 2 @@ -957,7 +957,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) UnsignedInt size, val; Int bitCount = 0; - size = GetDlgItemInt( dialog, EDIT_WIDTH, NULL, FALSE ); + size = GetDlgItemInt( dialog, EDIT_WIDTH, nullptr, FALSE ); for( val = size; val; val >>= 1 ) if( BitIsSet( val, 0x1 ) ) bitCount++; @@ -969,7 +969,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) if( bitCount != 1 ) { - MessageBox( NULL, "The target image size must be a power of 2.", + MessageBox( nullptr, "The target image size must be a power of 2.", "Must Be Power Of 2", MB_OK | MB_ICONERROR ); return FALSE; @@ -988,7 +988,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) else { - MessageBox( NULL, "Internal Error. Target Size Unknown.", + MessageBox( nullptr, "Internal Error. Target Size Unknown.", "Error", MB_OK | MB_ICONERROR ); return FALSE; @@ -1027,7 +1027,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) setGapMethod( ImagePacker::GAP_METHOD_GUTTER ); // get gutter size whether we are using that option or not - Int gutter = GetDlgItemInt( dialog, EDIT_GUTTER, NULL, FALSE ); + Int gutter = GetDlgItemInt( dialog, EDIT_GUTTER, nullptr, FALSE ); if( gutter < 0 ) gutter = 0; setGutter( gutter ); @@ -1051,7 +1051,7 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) sprintf( buffer, "Output filename '%s' contains one or more of the following illegal characters:\n\n%s", m_outputFile, illegal ); - MessageBox( NULL, buffer, "Illegal Filename", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Illegal Filename", MB_OK | MB_ICONERROR ); return FALSE; } @@ -1095,20 +1095,20 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog ) ImagePacker::ImagePacker( void ) { - m_hWnd = NULL; + m_hWnd = nullptr; m_targetSize.x = DEFAULT_TARGET_SIZE; m_targetSize.y = DEFAULT_TARGET_SIZE; m_useSubFolders = TRUE; strcpy( m_outputFile, "" ); strcpy( m_outputDirectory, "" ); - m_dirList = NULL; + m_dirList = nullptr; m_dirCount = 0; m_imagesInDirs = 0; - m_imageList = NULL; + m_imageList = nullptr; m_imageCount = 0; strcpy( m_statusBuffer, "" ); - m_pageList = NULL; - m_pageTail = NULL; + m_pageList = nullptr; + m_pageTail = nullptr; m_pageCount = 0; m_gapMethod = GAP_METHOD_EXTEND_RGB; m_gutterSize = 1; @@ -1116,10 +1116,10 @@ ImagePacker::ImagePacker( void ) m_createINI = TRUE; m_targetPreviewPage = 1; - m_hWndPreview = NULL; + m_hWndPreview = nullptr; m_showTextureInPreview = FALSE; - m_targa = NULL; + m_targa = nullptr; m_compressTextures = FALSE; } @@ -1148,11 +1148,11 @@ Bool ImagePacker::init( void ) // allocate a targa to read the headers for the images m_targa = new Targa; - if( m_targa == NULL ) + if( m_targa == nullptr ) { DEBUG_ASSERTCRASH( m_targa, ("Unable to allocate targa header during init") ); - MessageBox( NULL, "ImagePacker can't init, unable to create targa", + MessageBox( nullptr, "ImagePacker can't init, unable to create targa", "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; @@ -1182,7 +1182,7 @@ Bool ImagePacker::process( void ) char currDir[ _MAX_PATH ]; GetCurrentDirectory( _MAX_PATH, currDir ); sprintf( m_outputDirectory, "%s\\ImagePackerOutput\\", currDir ); - CreateDirectory( m_outputDirectory, NULL ); + CreateDirectory( m_outputDirectory, nullptr ); // subdir of output directory based on output image name strlcat(m_outputDirectory, m_outputFile, ARRAY_SIZE(m_outputDirectory)); diff --git a/Core/Tools/ImagePacker/Source/TexturePage.cpp b/Core/Tools/ImagePacker/Source/TexturePage.cpp index e463a558f4b..64145a090c6 100644 --- a/Core/Tools/ImagePacker/Source/TexturePage.cpp +++ b/Core/Tools/ImagePacker/Source/TexturePage.cpp @@ -79,10 +79,10 @@ void TexturePage::extendToRowIfOpen( char *src, { char otherAlpha; char otherColor[ 3 ]; - char *row = NULL; + char *row = nullptr; // sanity - if( src == NULL ) + if( src == nullptr ) return; // @@ -229,7 +229,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, { // sanity - if( destBuffer == NULL || image == NULL ) + if( destBuffer == nullptr || image == nullptr ) return; // @@ -426,7 +426,7 @@ void TexturePage::extendImageEdges( Byte *destBuffer, // if( currPixel == TRUE ) { - char *dst = NULL; + char *dst = nullptr; // top left corner if( x == 0 && y == 0 && @@ -514,7 +514,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, { // sanity - if( destBuffer == NULL || image == NULL ) + if( destBuffer == nullptr || image == nullptr ) return FALSE; // load the real image data for the source @@ -525,7 +525,7 @@ Bool TexturePage::addImageData( Byte *destBuffer, sprintf( buffer, "Error loading source file '%s'\n", image->m_path ); DEBUG_ASSERTCRASH( 0, (buffer) ); - MessageBox( NULL, buffer, "Cannot Load Source File", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Cannot Load Source File", MB_OK | MB_ICONERROR ); return FALSE; } @@ -761,7 +761,7 @@ UnsignedInt TexturePage::buildFitRegion( IRegion2D *region, { // sanity - if( region == NULL || xGutter == NULL || yGutter == NULL ) + if( region == nullptr || xGutter == nullptr || yGutter == nullptr ) return 0; // @@ -853,12 +853,12 @@ TexturePage::TexturePage( Int width, Int height ) Int canvasSize; m_id = -1; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; m_size.x = width; m_size.y = height; - m_packedImage = NULL; - m_targa = NULL; + m_packedImage = nullptr; + m_targa = nullptr; // create a "canvas" to represent used and unused areas canvasSize = m_size.x * m_size.y; @@ -893,10 +893,10 @@ Bool TexturePage::addImage( ImageInfo *image ) IRegion2D region; // santiy - if( image == NULL ) + if( image == nullptr ) { - DEBUG_ASSERTCRASH( image, ("TexturePage::addImage: NULL image!") ); + DEBUG_ASSERTCRASH( image, ("TexturePage::addImage: null image!") ); return TRUE; // say it was added } @@ -1147,7 +1147,7 @@ Bool TexturePage::addImage( ImageInfo *image ) image->m_pagePos.hi.y -= yGutter; // link this image to the texture page - image->m_prevPageImage = NULL; + image->m_prevPageImage = nullptr; image->m_nextPageImage = m_imageList; if( m_imageList ) m_imageList->m_prevPageImage = image; @@ -1174,22 +1174,22 @@ Bool TexturePage::generateTexture( void ) { // sanity - if( m_imageList == NULL ) + if( m_imageList == nullptr ) return FALSE; // sanity - DEBUG_ASSERTCRASH( m_packedImage == NULL, ("The packed image list must be NULL before generating texture") ); - DEBUG_ASSERTCRASH( m_targa == NULL, ("The targa must be NULL before generating a new texture") ); + DEBUG_ASSERTCRASH( m_packedImage == nullptr, ("The packed image list must be null before generating texture") ); + DEBUG_ASSERTCRASH( m_targa == nullptr, ("The targa must be null before generating a new texture") ); // allocate targa to help us generate the final texture m_targa = new Targa; - if( m_targa == NULL ) + if( m_targa == nullptr ) { char buffer[ 128 ]; sprintf( buffer, "Unable to allocate new targa to generate texture\n" ); DEBUG_ASSERTCRASH( m_targa, (buffer) ); - MessageBox( NULL, buffer, "Internal Error", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Internal Error", MB_OK | MB_ICONERROR ); return FALSE; } @@ -1212,13 +1212,13 @@ Bool TexturePage::generateTexture( void ) // allocate a buffer for our final image Int bufferSize = m_size.x * m_size.y * bpp; m_packedImage = new Byte[ bufferSize ]; - if( m_packedImage == NULL ) + if( m_packedImage == nullptr ) { char buffer[ 128 ]; sprintf( buffer, "Unable to allocate final packed image buffer\n" ); DEBUG_ASSERTCRASH( m_packedImage, (buffer) ); - MessageBox( NULL, buffer, "Internal Error", MB_OK | MB_ICONERROR ); + MessageBox( nullptr, buffer, "Internal Error", MB_OK | MB_ICONERROR ); BitSet( m_status, PAGE_ERROR ); BitSet( m_status, CANT_ALLOCATE_PACKED_IMAGE ); return FALSE; @@ -1267,7 +1267,7 @@ Bool TexturePage::writeFile( char *baseFilename ) { // sanity - if( baseFilename == NULL || m_targa == NULL ) + if( baseFilename == nullptr || m_targa == nullptr ) { BitSet( m_status, PAGE_ERROR ); @@ -1311,7 +1311,7 @@ void TexturePage::getPixel( Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a ) { // do nothing if we have no image data - if( m_packedImage == NULL ) + if( m_packedImage == nullptr ) return; // how many bytes per pixel for the targa file format diff --git a/Core/Tools/ImagePacker/Source/WinMain.cpp b/Core/Tools/ImagePacker/Source/WinMain.cpp index e31f28f4573..5abd36edb0e 100644 --- a/Core/Tools/ImagePacker/Source/WinMain.cpp +++ b/Core/Tools/ImagePacker/Source/WinMain.cpp @@ -58,10 +58,10 @@ /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -HINSTANCE ApplicationHInstance = NULL; ///< our application instance +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance /// just to satisfy the game libraries we link to -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; @@ -92,7 +92,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, // allocate a new image packer system TheImagePacker = new ImagePacker; - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) return 0; // initialize the system @@ -100,18 +100,18 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, { delete TheImagePacker; - TheImagePacker = NULL; + TheImagePacker = nullptr; return 0; } // load the dialog box DialogBox( hInstance, (LPCTSTR)IMAGE_PACKER_DIALOG, - NULL, (DLGPROC)ImagePackerProc ); + nullptr, (DLGPROC)ImagePackerProc ); // delete the image packer delete TheImagePacker; - TheImagePacker = NULL; + TheImagePacker = nullptr; shutdownMemoryManager(); diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp index 190f3fd8a3e..2d299b44d1e 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cpp @@ -199,7 +199,7 @@ BOOL CALLBACK DirectorySelectProc( HWND hWndDialog, UINT message, char message[ _MAX_PATH + 32 ]; sprintf( message, "Ignoring folder '%s', already in list.", toAdd ); - MessageBox( NULL, message, "Folder Already In List", + MessageBox( nullptr, message, "Folder Already In List", MB_OK | MB_ICONINFORMATION ); continue; diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp index 93b08ff2143..94cf829e6b5 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp @@ -83,7 +83,7 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, // // sanity - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) return TRUE; // go through all images @@ -101,7 +101,7 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, image = TheImagePacker->getImage( i ); // sanity - if( image == NULL ) + if( image == nullptr ) continue; // if image can't be processed find out why diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp index 333f4e11c30..f0cbddc6242 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp @@ -78,10 +78,10 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, { // we must have our program interface to continue - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) { - MessageBox( NULL, "Internal Error, 'TheImagePacker' not initialized", + MessageBox( nullptr, "Internal Error, 'TheImagePacker' not initialized", "Internal Error", MB_OK ); EndDialog( hWndDialog, FALSE ); @@ -245,7 +245,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, // delete test display window DestroyWindow( preview ); - TheImagePacker->setPreviewWindow( NULL ); + TheImagePacker->setPreviewWindow( nullptr ); SetDlgItemText( hWndDialog, BUTTON_PREVIEW, "Open Preview" ); } @@ -288,7 +288,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, // get the directory listbox folderList = GetDlgItem( hWndDialog, LIST_FOLDERS ); - if( folderList == NULL ) + if( folderList == nullptr ) break; // get the selected item in the folder listbox @@ -297,7 +297,7 @@ BOOL CALLBACK ImagePackerProc( HWND hWndDialog, UINT message, if( selCount == 0 ) { - MessageBox( NULL, "You must first select a folder to remove it", + MessageBox( nullptr, "You must first select a folder to remove it", "Select Folder First", MB_OK | MB_ICONINFORMATION ); break; diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp index e96cd278ec9..b8301d23773 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp @@ -83,7 +83,7 @@ BOOL CALLBACK PageErrorProc( HWND hWndDialog, UINT message, // // sanity - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) return TRUE; // go through all pages diff --git a/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp b/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp index 24729b0f5e5..bd53e08d181 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp @@ -118,7 +118,7 @@ LRESULT CALLBACK PreviewProc( HWND hWnd, UINT message, prevPen = (HPEN)SelectObject( hdc, pen ); // draw ... what is the Win32 put pixel function??? - MoveToEx( hdc, x, y, NULL ); + MoveToEx( hdc, x, y, nullptr ); LineTo( hdc, x + 1, y ); // put the old pen back @@ -182,12 +182,12 @@ HWND MakePreviewDisplay( void ) wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = ApplicationHInstance; - wcex.hIcon = NULL; - wcex.hCursor = LoadCursor( NULL, IDC_ARROW ); + wcex.hIcon = nullptr; + wcex.hCursor = LoadCursor( nullptr, IDC_ARROW ); wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); - wcex.lpszMenuName = NULL; + wcex.lpszMenuName = nullptr; wcex.lpszClassName = className; - wcex.hIconSm = NULL; + wcex.hIconSm = nullptr; RegisterClassEx( &wcex ); @@ -200,13 +200,13 @@ HWND MakePreviewDisplay( void ) 30, // y position TheImagePacker->getTargetWidth(), TheImagePacker->getTargetHeight(), - NULL, // parent - NULL, // menu + nullptr, // parent + nullptr, // menu ApplicationHInstance, // instance - NULL ); // creation data + nullptr ); // creation data - if( hWnd == NULL ) - return NULL; + if( hWnd == nullptr ) + return nullptr; // display the window ShowWindow( hWnd, SW_SHOW ); @@ -223,14 +223,14 @@ void UpdatePreviewWindow( void ) HWND preview; // sanity - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) return; // get preview window preview = TheImagePacker->getPreviewWindow(); // if window not here don't bother - if( preview == NULL ) + if( preview == nullptr ) return; // make the title @@ -262,6 +262,6 @@ void UpdatePreviewWindow( void ) TRUE ); // invalidate the client area for redraw - InvalidateRect( preview, NULL, TRUE ); + InvalidateRect( preview, nullptr, TRUE ); } diff --git a/Core/Tools/Launcher/BFISH.cpp b/Core/Tools/Launcher/BFISH.cpp index a1cea422770..2137ece9146 100644 --- a/Core/Tools/Launcher/BFISH.cpp +++ b/Core/Tools/Launcher/BFISH.cpp @@ -81,7 +81,7 @@ typedef union { BlowfishEngine::~BlowfishEngine(void) { if (IsKeyed) { - Submit_Key(NULL, 0); + Submit_Key(nullptr, 0); } } @@ -95,7 +95,7 @@ BlowfishEngine::~BlowfishEngine(void) * indefinitely. The key must be 56 bytes or less in length. This is necessary because * * any keys longer than that will not correctly affect the encryption process. * * * - * If the key pointer is NULL, then the S-Box tables are reset to identity. This will * + * If the key pointer is null, then the S-Box tables are reset to identity. This will * * mask the previous key setting. Use this method to clear the engine after processing in * * order to gain a measure of security. * * * diff --git a/Core/Tools/Launcher/DatGen/DatGen.cpp b/Core/Tools/Launcher/DatGen/DatGen.cpp index f584e9468cc..8745d77a805 100644 --- a/Core/Tools/Launcher/DatGen/DatGen.cpp +++ b/Core/Tools/Launcher/DatGen/DatGen.cpp @@ -61,7 +61,7 @@ static void doIt(void) // Retrieve install path DWORD type; DWORD sizeOfBuffer = sizeof(installPath); - result = RegQueryValueEx(hKey, "InstallPath", NULL, &type, installPath, &sizeOfBuffer); + result = RegQueryValueEx(hKey, "InstallPath", nullptr, &type, installPath, &sizeOfBuffer); assert((result == ERROR_SUCCESS) && "Failed to obtain game install path!"); assert((strlen((const char*)installPath) > 0) && "Game install path invalid!"); @@ -69,14 +69,14 @@ static void doIt(void) // Retrieve Hard drive S/N char drive[8]; - _splitpath((const char*)installPath, drive, NULL, NULL, NULL); + _splitpath((const char*)installPath, drive, nullptr, nullptr, nullptr); strcat(drive, "\\"); DWORD volumeSerialNumber = 0; DWORD maxComponentLength; DWORD fileSystemFlags; - BOOL volInfoSuccess = GetVolumeInformation((const char*)drive, NULL, 0, - &volumeSerialNumber, &maxComponentLength, &fileSystemFlags, NULL, 0); + BOOL volInfoSuccess = GetVolumeInformation((const char*)drive, nullptr, 0, + &volumeSerialNumber, &maxComponentLength, &fileSystemFlags, nullptr, 0); if (volInfoSuccess == FALSE) { @@ -113,7 +113,7 @@ static void doIt(void) if (result == ERROR_SUCCESS) { - result = RegQueryValueEx(hKey, "", NULL, &type, gameSerialNumber, &sizeOfBuffer); + result = RegQueryValueEx(hKey, "", nullptr, &type, gameSerialNumber, &sizeOfBuffer); assert((result == ERROR_SUCCESS) && "Failed to obtain game serial number!"); assert((strlen((const char*)gameSerialNumber) > 0) && "Game serial number invalid!"); } @@ -137,7 +137,7 @@ static void doIt(void) DWORD type; DWORD sizeOfBuffer = sizeof(winProductID); - result = RegQueryValueEx(hKey, "ProductID", NULL, &type, winProductID, &sizeOfBuffer); + result = RegQueryValueEx(hKey, "ProductID", nullptr, &type, winProductID, &sizeOfBuffer); assert((result == ERROR_SUCCESS) && "Failed to obtain windows product ID!"); assert((strlen((const char*)winProductID) > 0) && "Invalid windows product ID"); diff --git a/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp b/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp index ac0c17cd674..dd732c272ed 100644 --- a/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp +++ b/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp @@ -66,7 +66,7 @@ void __cdecl DebugPrint(const char* string, ...) static char _buffer[1024]; static char _filename[512] = ""; - if (string != NULL) + if (string != nullptr) { // Format string va_list va; @@ -83,21 +83,21 @@ void __cdecl DebugPrint(const char* string, ...) char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; - GetModuleFileName(GetModuleHandle(NULL), &path[0], sizeof(path)); - _splitpath(path, drive, dir, NULL, NULL); + GetModuleFileName(GetModuleHandle(nullptr), &path[0], sizeof(path)); + _splitpath(path, drive, dir, nullptr, nullptr); _makepath(_filename, drive, dir, debugLogName, "txt"); OutputDebugString("Creating "); OutputDebugString(_filename); OutputDebugString("\n"); - file = CreateFile(_filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(_filename, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); } else { - file = CreateFile(_filename, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(_filename, GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); } // Send string to debugger @@ -131,10 +131,10 @@ void __cdecl DebugPrint(const char* string, ...) if (file != INVALID_HANDLE_VALUE) { - SetFilePointer(file, 0, NULL, FILE_END); + SetFilePointer(file, 0, nullptr, FILE_END); DWORD written; - WriteFile(file, &_buffer[0], strlen(_buffer), &written, NULL); + WriteFile(file, &_buffer[0], strlen(_buffer), &written, nullptr); CloseHandle(file); } @@ -162,7 +162,7 @@ void __cdecl PrintWin32Error(const char* string, ...) { static char _buffer[1024]; - if (string != NULL) + if (string != nullptr) { // Format string va_list va; @@ -172,8 +172,8 @@ void __cdecl PrintWin32Error(const char* string, ...) LPVOID lpMsgBuf; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL); + FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, nullptr); DebugPrint("***** Win32 Error: %s\n", _buffer); DebugPrint(" Reason: %s\n", (char*)lpMsgBuf); diff --git a/Core/Tools/Launcher/Toolkit/Storage/File.cpp b/Core/Tools/Launcher/Toolkit/Storage/File.cpp index cc497bcc355..9ca89863460 100644 --- a/Core/Tools/Launcher/Toolkit/Storage/File.cpp +++ b/Core/Tools/Launcher/Toolkit/Storage/File.cpp @@ -272,7 +272,7 @@ bool File::IsAvailable(bool force) // Attempt to open the file mHandle = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); // If the open failed then the file is not available. if (mHandle == INVALID_HANDLE) @@ -351,19 +351,18 @@ File::EFileError File::Open(ERights rights) // Read only access case Rights_ReadOnly: mHandle = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); break; // Write only access case Rights_WriteOnly: - mHandle = CreateFile(name, GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + mHandle = CreateFile(name, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); break; // Read and Write access case Rights_ReadWrite: mHandle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); break; // Unknown rights access violation @@ -549,7 +548,7 @@ File::EFileError File::Delete(void) File::EFileError File::Load(void*& outBuffer, UInt32& outSize) { - outBuffer = NULL; + outBuffer = nullptr; outSize = 0; // Enforce access control @@ -578,7 +577,7 @@ File::EFileError File::Load(void*& outBuffer, UInt32& outSize) } // Get the size of the file - UInt32 size = GetFileSize(mHandle, NULL); + UInt32 size = GetFileSize(mHandle, nullptr); if (size == 0xFFFFFFFF) { @@ -594,7 +593,7 @@ File::EFileError File::Load(void*& outBuffer, UInt32& outSize) outSize = size; // If allocation succeded then load file data. - if (outBuffer != NULL) + if (outBuffer != nullptr) { // Fill the buffer with the file contents while (size > 0) @@ -602,7 +601,7 @@ File::EFileError File::Load(void*& outBuffer, UInt32& outSize) unsigned long bytesRead = 0; // Read in some bytes. - if (ReadFile(mHandle, outBuffer, size, &bytesRead, NULL) == 0) + if (ReadFile(mHandle, outBuffer, size, &bytesRead, nullptr) == 0) { result = FileError_Read; @@ -686,7 +685,7 @@ File::EFileError File::Save(const void* buffer, UInt32 size) // Write the data to the file. unsigned long bytesWritten = 0; - if (WriteFile(mHandle, buffer, size, &bytesWritten, NULL) == 0) + if (WriteFile(mHandle, buffer, size, &bytesWritten, nullptr) == 0) { result = FileError_Write; OnFileError(result, false); @@ -780,7 +779,7 @@ UInt32 File::GetLength(void) openedHere = true; } - UInt32 length = GetFileSize(mHandle, NULL); + UInt32 length = GetFileSize(mHandle, nullptr); if (length == 0xFFFFFFFF) { @@ -816,15 +815,15 @@ UInt32 File::GetLength(void) void File::SetLength(UInt32 length) { // Get the current file position - UInt32 position = SetFilePointer(mHandle, 0, NULL, FILE_CURRENT); + UInt32 position = SetFilePointer(mHandle, 0, nullptr, FILE_CURRENT); // Extend the file size by positioning the Win32 file pointer to the // specified location then setting the end of file. - SetFilePointer(mHandle, length, NULL, FILE_BEGIN); + SetFilePointer(mHandle, length, nullptr, FILE_BEGIN); SetEndOfFile(mHandle); // Restore file position - SetFilePointer(mHandle, position, NULL, FILE_BEGIN); + SetFilePointer(mHandle, position, nullptr, FILE_BEGIN); } @@ -846,7 +845,7 @@ void File::SetLength(UInt32 length) UInt32 File::GetMarker(void) { - return SetFilePointer(mHandle, 0, NULL, FILE_CURRENT); + return SetFilePointer(mHandle, 0, nullptr, FILE_CURRENT); } @@ -894,7 +893,7 @@ void File::SetMarker(Int32 offset, EStreamFrom from) break; } - offset = SetFilePointer(mHandle, offset, NULL, dir); + offset = SetFilePointer(mHandle, offset, nullptr, dir); if (offset == 0xFFFFFFFF) { @@ -946,7 +945,7 @@ bool File::AtEnd(void) UInt32 File::GetBytes(void* ptr, UInt32 bytes) { // Parameter check; Null pointers are bad! - assert(ptr != NULL); + assert(ptr != nullptr); // Enforce rights control if (GetRights() == Rights_WriteOnly) @@ -972,7 +971,7 @@ UInt32 File::GetBytes(void* ptr, UInt32 bytes) { unsigned long read; - if (ReadFile(mHandle, ptr, bytesToRead, &read, NULL) == 0) + if (ReadFile(mHandle, ptr, bytesToRead, &read, nullptr) == 0) { if (OnFileError(FileError_Read, true) == false) { @@ -1015,7 +1014,7 @@ UInt32 File::GetBytes(void* ptr, UInt32 bytes) UInt32 File::PutBytes(const void* ptr, UInt32 bytes) { // Parameter check; Null pointers are bad! - assert(ptr != NULL); + assert(ptr != nullptr); // Enforce access control if (GetRights() == Rights_ReadOnly) @@ -1041,7 +1040,7 @@ UInt32 File::PutBytes(const void* ptr, UInt32 bytes) { unsigned long written; - if (WriteFile(mHandle, ptr, bytes, &written, NULL) == 0) + if (WriteFile(mHandle, ptr, bytes, &written, nullptr) == 0) { if (OnFileError(FileError_Write, true) == false) { @@ -1076,8 +1075,8 @@ UInt32 File::PutBytes(const void* ptr, UInt32 bytes) UInt32 File::PeekBytes(void* ptr, UInt32 bytes) { - // Parameter check; NULL pointers are bad! - assert(ptr != NULL); + // Parameter check; nullptr pointers are bad! + assert(ptr != nullptr); // Get current position UInt32 pos = GetMarker(); diff --git a/Core/Tools/Launcher/Toolkit/Support/RefPtr.h b/Core/Tools/Launcher/Toolkit/Support/RefPtr.h index 0e4e5c255d5..cfd0ba4aadf 100644 --- a/Core/Tools/Launcher/Toolkit/Support/RefPtr.h +++ b/Core/Tools/Launcher/Toolkit/Support/RefPtr.h @@ -34,9 +34,9 @@ * Reinterpret_Cast replaces reinterpret_cast and reinterpret_cast * Const_Cast replaces const_cast and const_cast * -* IsValid() replaces (x != NULL) +* IsValid() replaces (x != nullptr) * -* Member function Attach() or assigning RefPtr() will NULL a pointer. +* Member function Attach() or assigning RefPtr() will nullptr a pointer. * * Generally, RefPtr<> and RefPtrConst<> behave like their raw pointer * counterparts, except of course they are reference counted and will delete @@ -85,26 +85,26 @@ class RefPtrBase {return !operator==(rhs);} inline bool IsValid(void) const - {return (mRefObject != NULL);} + {return (mRefObject != nullptr);} inline void Detach(void) { if (IsValid()) { mRefObject->Release(); - mRefObject = NULL; + mRefObject = nullptr; } } protected: RefPtrBase() - : mRefObject(NULL) + : mRefObject(nullptr) {} RefPtrBase(RefCounted* object) : mRefObject(object) { - assert((mRefObject == NULL) || (mRefObject->mRefCount == 0)); + assert((mRefObject == nullptr) || (mRefObject->mRefCount == 0)); if (IsValid()) { @@ -140,7 +140,7 @@ class RefPtrBase if (object != mRefObject) { // Add reference to new object - if (object != NULL) + if (object != nullptr) { object->AddReference(); } diff --git a/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp b/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp index fecee38b55f..387dfadbb8e 100644 --- a/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp +++ b/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp @@ -84,16 +84,15 @@ Char* UStringToANSI(const UString& string, Char* buffer, UInt bufferLength) Char* UnicodeToANSI(const WChar* string, Char* buffer, UInt bufferLength) { - if ((string == NULL) || (buffer == NULL)) + if ((string == nullptr) || (buffer == nullptr)) { - return NULL; + return nullptr; } #ifdef RTS_DEBUG int result = #endif - WideCharToMultiByte(CP_ACP, 0, string, -1, buffer, bufferLength, - NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, string, -1, buffer, bufferLength, nullptr, nullptr); #ifdef RTS_DEBUG if (result == 0) diff --git a/Core/Tools/Launcher/Toolkit/Support/UString.cpp b/Core/Tools/Launcher/Toolkit/Support/UString.cpp index 12ccb8237f3..701caf6f13a 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UString.cpp +++ b/Core/Tools/Launcher/Toolkit/Support/UString.cpp @@ -67,7 +67,7 @@ template T CharToUpper(const T ch) // Check if character is one of the specified characters templatebool IsCharacter(WChar ch, const T* oneOf) { - assert(oneOf != NULL); + assert(oneOf != nullptr); int length = 0; @@ -146,7 +146,7 @@ template bool StripRight(WChar* string, const T* trimChars) ******************************************************************************/ UString::UString() - : mData(NULL), + : mData(nullptr), mCapacity(0) { } @@ -169,7 +169,7 @@ UString::UString() ******************************************************************************/ UString::UString(UInt capacity) - : mData(NULL), + : mData(nullptr), mCapacity(0) { AllocString(capacity); @@ -185,7 +185,7 @@ UString::UString(UInt capacity) * Create a new UString from an ANSI string literal * * INPUTS -* String - Pointer to a NULL terminated ANSI string +* String - Pointer to a null-terminated ANSI string * * RESULT * NONE @@ -193,7 +193,7 @@ UString::UString(UInt capacity) ******************************************************************************/ UString::UString(const Char* s) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(s); @@ -209,7 +209,7 @@ UString::UString(const Char* s) * Create a new UString from a UNICODE string literal * * INPUTS -* String - Pointer to a NULL terminated UNICODE string +* String - Pointer to a null-terminated UNICODE string * * RESULT * NONE @@ -217,7 +217,7 @@ UString::UString(const Char* s) ******************************************************************************/ UString::UString(const WChar* ws) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(ws); @@ -241,7 +241,7 @@ UString::UString(const WChar* ws) ******************************************************************************/ UString::UString(const UString& s) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(s); @@ -288,7 +288,7 @@ UString::~UString() UInt UString::Length(void) const { - if (mData == NULL) + if (mData == nullptr) { return 0; } @@ -315,7 +315,7 @@ UInt UString::Length(void) const void UString::Copy(const Char* s) { - assert(s != NULL); + assert(s != nullptr); UInt length = strlen(s); if (length == 0) @@ -360,7 +360,7 @@ void UString::Copy(const Char* s) void UString::Copy(const WChar* ws) { - assert(ws != NULL); + assert(ws != nullptr); UInt length = wcslen(ws); if (length == 0) @@ -419,7 +419,7 @@ void UString::Copy(const UString& s) void UString::Concat(const Char* s) { // Parameter check - assert(s != NULL); + assert(s != nullptr); UInt length = Length(); UInt additional = strlen(s); @@ -462,7 +462,7 @@ void UString::Concat(const Char* s) void UString::Concat(const WChar* ws) { - assert(ws != NULL); + assert(ws != nullptr); UInt length = (Length() + wcslen(ws)); if (Capacity() < length) @@ -516,11 +516,11 @@ void UString::Concat(const UString& s) Int UString::Compare(const Char* s) const { - // If comparing string is NULL and this string is NULL then strings are equal, + // If comparing string is nullptr and this string is nullptr then strings are equal, // otherwise comparing string is less than this string. - if (s == NULL) + if (s == nullptr) { - if (Get() == NULL) + if (Get() == nullptr) { return 0; } @@ -528,8 +528,8 @@ Int UString::Compare(const Char* s) const return -1; } - // If this string is NULL then comparing string is greater - if (Get() == NULL) + // If this string is nullptr then comparing string is greater + if (Get() == nullptr) { return 1; } @@ -632,11 +632,11 @@ Int UString::Compare(const UString& s) const Int UString::CompareNoCase(const Char* s) const { - // If comparing string is NULL and this string is NULL then strings are + // If comparing string is nullptr and this string is nullptr then strings are // equal, otherwise comparing string is less than this string. - if (s == NULL) + if (s == nullptr) { - if (Get() == NULL) + if (Get() == nullptr) { return 0; } @@ -644,8 +644,8 @@ Int UString::CompareNoCase(const Char* s) const return -1; } - // If this string is NULL then comparing string is greater. - if (Get() == NULL) + // If this string is nullptr then comparing string is greater. + if (Get() == nullptr) { return 1; } @@ -776,7 +776,7 @@ Int UString::Find(WChar c) const const WChar* ptr = wcschr(Get(), c); // Not found? - if (ptr == NULL) + if (ptr == nullptr) { return -1; } @@ -825,11 +825,11 @@ Int UString::FindLast(Char c) const Int UString::FindLast(WChar c) const { - assert(mData != NULL); + assert(mData != nullptr); WChar* ptr = wcsrchr(mData, (WChar)c); // Not found? - if (ptr == NULL) + if (ptr == nullptr) { return -1; } @@ -857,7 +857,7 @@ Int UString::FindLast(WChar c) const UString UString::SubString(const Char* s) { assert(false); - assert(s != NULL); + assert(s != nullptr); return UString(""); } @@ -865,7 +865,7 @@ UString UString::SubString(const Char* s) UString UString::SubString(const WChar* ws) { assert(false); - assert(ws != NULL); + assert(ws != nullptr); return UString(""); } @@ -990,7 +990,7 @@ UString UString::Right(UInt count) void UString::ToUpper(void) { - if (mData != NULL) + if (mData != nullptr) { wcsupr(mData); } @@ -1015,7 +1015,7 @@ void UString::ToUpper(void) void UString::ToLower(void) { - if (mData != NULL) + if (mData != nullptr) { wcslwr(mData); } @@ -1040,7 +1040,7 @@ void UString::ToLower(void) void UString::Reverse(void) { - if (mData != NULL) + if (mData != nullptr) { wcsrev(mData); } @@ -1105,7 +1105,7 @@ bool UString::Trim(const UString& trimChars) bool UString::TrimLeft(const Char* trimChars) { - if ((trimChars == NULL) || (strlen(trimChars) == 0)) + if ((trimChars == nullptr) || (strlen(trimChars) == 0)) { return false; } @@ -1116,7 +1116,7 @@ bool UString::TrimLeft(const Char* trimChars) bool UString::TrimLeft(const WChar* trimChars) { - if ((trimChars == NULL) || (wcslen(trimChars) == 0)) + if ((trimChars == nullptr) || (wcslen(trimChars) == 0)) { return false; } @@ -1149,7 +1149,7 @@ bool UString::TrimLeft(const UString& trimChars) bool UString::TrimRight(const Char* trimChars) { - if ((trimChars == NULL) || (strlen(trimChars) == 0)) + if ((trimChars == nullptr) || (strlen(trimChars) == 0)) { return false; } @@ -1160,7 +1160,7 @@ bool UString::TrimRight(const Char* trimChars) bool UString::TrimRight(const WChar* trimChars) { - if ((trimChars == NULL) || (wcslen(trimChars) == 0)) + if ((trimChars == nullptr) || (wcslen(trimChars) == 0)) { return false; } @@ -1216,7 +1216,7 @@ void UString::ConvertToANSI(Char* buffer, UInt bufferLength) const UInt UString::Size(void) const { - if (mData == NULL) + if (mData == nullptr) { return 0; } @@ -1268,15 +1268,15 @@ bool UString::Resize(UInt size) // Allocate new storage assert(size > 0); WChar* data = new WChar[size + 1]; - assert(data != NULL); + assert(data != nullptr); - if (data == NULL) + if (data == nullptr) { return false; } // Copy existing string into new storage buffer - if (mData != NULL) + if (mData != nullptr) { UInt minSize = __min(Capacity(), size); wcsncpy(data, mData, minSize); @@ -1311,9 +1311,9 @@ bool UString::Resize(UInt size) bool UString::AllocString(UInt size) { WChar* data = new WChar[size + 1]; - assert(data != NULL); + assert(data != nullptr); - if (data == NULL) + if (data == nullptr) { return false; } diff --git a/Core/Tools/Launcher/Toolkit/Support/UString.h b/Core/Tools/Launcher/Toolkit/Support/UString.h index a9b23e20f87..a5680006ba7 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UString.h +++ b/Core/Tools/Launcher/Toolkit/Support/UString.h @@ -136,7 +136,7 @@ class UString bool Resize(UInt size); const WChar* Get(void) const - {return (mData != NULL) ? mData : L"";} + {return (mData != nullptr) ? mData : L"";} //! Assignment operator UString operator=(const Char* s) diff --git a/Core/Tools/Launcher/Toolkit/Support/UTypes.h b/Core/Tools/Launcher/Toolkit/Support/UTypes.h index 77e5eaa8bab..f0a727c84cd 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UTypes.h +++ b/Core/Tools/Launcher/Toolkit/Support/UTypes.h @@ -85,7 +85,3 @@ typedef Float32 Float; //! TriState typedef enum {OFF = false, ON = true, PENDING = -1} TriState; -//! Empty pointer -#ifndef NULL -#define NULL (0L) -#endif diff --git a/Core/Tools/Launcher/configfile.cpp b/Core/Tools/Launcher/configfile.cpp index 7f2dc928e6c..81a9649063e 100644 --- a/Core/Tools/Launcher/configfile.cpp +++ b/Core/Tools/Launcher/configfile.cpp @@ -68,7 +68,7 @@ bit8 ConfigFile::readFile(FILE *in) cptr=Eat_Spaces(string); if ((*cptr==0)||(*cptr=='#')) // '#' signals a comment continue; - if (strchr(cptr,'=')==NULL) // All config entries must have a '=' + if (strchr(cptr,'=')==nullptr) // All config entries must have a '=' continue; key=cptr; key.truncate('='); diff --git a/Core/Tools/Launcher/dialog.cpp b/Core/Tools/Launcher/dialog.cpp index 7bd986abc3c..663a86d60b0 100644 --- a/Core/Tools/Launcher/dialog.cpp +++ b/Core/Tools/Launcher/dialog.cpp @@ -30,7 +30,7 @@ BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPar HWND Create_Patch_Dialog(void) { PatchDialog=CreateDialog(Global_instance, MAKEINTRESOURCE(IDD_PATCHPROGRESS), - NULL, (DLGPROC)Patch_Window_Proc); + nullptr, (DLGPROC)Patch_Window_Proc); ShowWindow(PatchDialog, SW_NORMAL); SetForegroundWindow(PatchDialog); diff --git a/Core/Tools/Launcher/dictionary.h b/Core/Tools/Launcher/dictionary.h index 640190a5b52..6fa576f1592 100644 --- a/Core/Tools/Launcher/dictionary.h +++ b/Core/Tools/Launcher/dictionary.h @@ -119,7 +119,7 @@ Dictionary::Dictionary(uint32 (* hashFn)(K &key)) : //Table is a pointer to a list of pointers (the hash table) table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); hashFunc=hashFn; @@ -143,13 +143,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -181,7 +181,7 @@ void Dictionary::print(IN FILE *out) const fprintf(out," |\n"); fprintf(out,"[ ]"); - while (temp!=NULL) + while (temp!=nullptr) { fprintf(out,"--[ ]"); temp=temp->hashNext; @@ -207,27 +207,27 @@ bit8 Dictionary::iterate(INOUT int &index,INOUT int &offset, return(FALSE); temp=table[index]; - while ((temp==NULL)&&((++index) < getSize())) + while ((temp==nullptr)&&((++index) < getSize())) { temp=table[index]; offset=0; } - if (temp==NULL) // no more slots with data + if (temp==nullptr) // no more slots with data return(FALSE); uint32 i=0; - while ((temp!=NULL) && (i < offset)) + while ((temp!=nullptr) && (i < offset)) { temp=temp->hashNext; i++; } - if (temp==NULL) // should never happen + if (temp==nullptr) // should never happen return(FALSE); value=temp->value; - if (temp->hashNext==NULL) + if (temp->hashNext==nullptr) { index++; offset=0; @@ -263,10 +263,10 @@ bit8 Dictionary::contains(IN K &key) node=table[offset]; - if (node==NULL) + if (node==nullptr) { return(FALSE); } // can't find it - while(node!=NULL) + while(node!=nullptr) { if ((node->key)==key) { return(TRUE); } @@ -300,7 +300,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) float percent; item=(DNode *)new DNode; - assert(item!=NULL); + assert(item!=nullptr); #ifdef KEY_MEM_OPS memcpy(&(item->key),&key,sizeof(K)); @@ -314,7 +314,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) item->value=value; #endif - item->hashNext=NULL; + item->hashNext=nullptr; //If key already exists, it will be overwritten remove(key); @@ -323,7 +323,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) node=table[offset]; - if (node==NULL) + if (node==nullptr) { table[offset]=item; } else { @@ -358,7 +358,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) node=table[offset]; last=node; - if (node==NULL) return(FALSE); + if (node==nullptr) return(FALSE); //special case table points to thing to delete @@ -384,7 +384,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) node=node->hashNext; //Now the case if the thing to delete is not the first - while (node!=NULL) + while (node!=nullptr) { #ifdef KEY_MEM_OPS if (0==memcmp(&(node->key),&key,sizeof(K))) @@ -437,7 +437,7 @@ bit8 Dictionary::removeAny(OUT K &key,OUT V &value) int i; offset=-1; for (i=0; i<(int)getSize(); i++) - if (table[i]!=NULL) + if (table[i]!=nullptr) { offset=i; break; @@ -479,16 +479,16 @@ bit8 Dictionary::getValue(IN K &key,OUT V &value) node=table[offset]; - if (node==NULL) return(FALSE); + if (node==nullptr) return(FALSE); #ifdef KEY_MEM_OPS - while ((node!=NULL)&&(memcmp(&(node->key),&key,sizeof(K)))) + while ((node!=nullptr)&&(memcmp(&(node->key),&key,sizeof(K)))) #else - while ((node!=NULL)&&( ! ((node->key)==key)) ) // odd syntax so you don't + while ((node!=nullptr)&&( ! ((node->key)==key)) ) // odd syntax so you don't #endif // have to do oper != { node=node->hashNext; } - if (node==NULL) + if (node==nullptr) { return(FALSE); } #ifdef VALUE_MEM_OPS @@ -524,13 +524,13 @@ void Dictionary::shrink(void) tableBits--; table=(DNode **)new DNode*[size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; @@ -563,13 +563,13 @@ void Dictionary::expand(void) tableBits++; table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; diff --git a/Core/Tools/Launcher/filed.h b/Core/Tools/Launcher/filed.h index f490b05d1c3..bb3ffd7e757 100644 --- a/Core/Tools/Launcher/filed.h +++ b/Core/Tools/Launcher/filed.h @@ -26,7 +26,7 @@ class FileD : public OutputDevice FileD(char *filename, bool outputDebug) : m_outputDebug(outputDebug) { out=fopen(filename,"w"); - if (out==NULL) + if (out==nullptr) out=fopen("FileDev.out","w"); } diff --git a/Core/Tools/Launcher/findpatch.cpp b/Core/Tools/Launcher/findpatch.cpp index 01715600afd..ed5687e4f7c 100644 --- a/Core/Tools/Launcher/findpatch.cpp +++ b/Core/Tools/Launcher/findpatch.cpp @@ -35,7 +35,7 @@ int Find_Patch(OUT char *filename,int maxlen, ConfigFile &config) WIN32_FIND_DATA findData; char string[128]; HANDLE hFile; - const char *extensions[]={"web","exe","exn","rtp",NULL}; + const char *extensions[]={"web","exe","exn","rtp", nullptr}; int i; int skuIndex=0; Wstring key; @@ -131,7 +131,7 @@ bit8 Get_App_Dir(OUT char *filename,int maxlen, ConfigFile &config,int index) } DWORD type; DWORD length=MAX_PATH; - regRetval=RegQueryValueEx(regKey,"InstallPath",NULL,&type,(uint8 *)gamePath, + regRetval=RegQueryValueEx(regKey,"InstallPath",nullptr,&type,(uint8 *)gamePath, &length); DBGMSG("GAME PATH = "<bmiColors, ((1< cutoffTime) + if (time(nullptr) > cutoffTime) { // The future is now! Just run the game. RunGame(argv[0], config, proc); @@ -315,8 +315,8 @@ void CreatePrimaryWin(const char *prefix) wc.cbWndExtra = 0; // No extra win data wc.hInstance = Global_instance; wc.hIcon=LoadIcon(Global_instance, MAKEINTRESOURCE(IDI_GENERALS)); - wc.hCursor = NULL; /////////LoadCursor( NULL, IDC_ARROW ); - wc.hbrBackground = NULL; + wc.hCursor = nullptr; /////////LoadCursor( nullptr, IDC_ARROW ); + wc.hbrBackground = nullptr; wc.lpszMenuName = name; wc.lpszClassName = name; RegisterClass(&wc); @@ -326,7 +326,7 @@ void CreatePrimaryWin(const char *prefix) */ HWND hwnd = CreateWindowEx(WS_EX_TOPMOST, name, name, WS_POPUP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), - NULL, NULL, Global_instance, NULL); + nullptr, nullptr, Global_instance, nullptr); if(!hwnd) { @@ -361,7 +361,7 @@ void myChdir(char *path) int abc; _splitpath( path, drive, dir, file, ext ); - _makepath ( filepath, drive, dir, NULL, NULL ); + _makepath ( filepath, drive, dir, nullptr, nullptr ); if ( filepath[ strlen( filepath ) - 1 ] == '\\' ) { diff --git a/Core/Tools/Launcher/monod.cpp b/Core/Tools/Launcher/monod.cpp index 8e05d8449d7..2ec8a047bec 100644 --- a/Core/Tools/Launcher/monod.cpp +++ b/Core/Tools/Launcher/monod.cpp @@ -22,12 +22,12 @@ MonoD::MonoD(void) { #ifdef _WIN32 unsigned long retval; - handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { - DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, + DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, nullptr, 0, nullptr, 0, &retval,0); } #endif @@ -37,7 +37,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +45,8 @@ int MonoD::print(const char *str, int len) { #ifdef _WIN32 unsigned long retval; - WriteFile(handle, str, len, &retval, NULL); - //DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, NULL, 0, + WriteFile(handle, str, len, &retval, nullptr); + //DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, nullptr, 0, // &retval,0); return(len); #else diff --git a/Core/Tools/Launcher/patch.cpp b/Core/Tools/Launcher/patch.cpp index 63c746aafbe..ef9e1bff7a9 100644 --- a/Core/Tools/Launcher/patch.cpp +++ b/Core/Tools/Launcher/patch.cpp @@ -49,7 +49,7 @@ BOOL CALLBACK Update_Info_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara case WM_INITDIALOG: { FILE *in = fopen("launcher.txt","r"); - if (in==NULL) + if (in==nullptr) { EndDialog(hwnd,-1); return(1); @@ -57,7 +57,7 @@ BOOL CALLBACK Update_Info_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara char line[270]; int lastsel=0; - char *cptr=NULL; + char *cptr=nullptr; while(fgets(line,255,in)) { //Get rid of any trailing junk @@ -76,7 +76,7 @@ BOOL CALLBACK Update_Info_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hwnd, IDC_TEXT, EM_SETSEL, (WPARAM)lastsel, (LPARAM)lastsel ); SendDlgItemMessage(hwnd, IDC_TEXT, EM_REPLACESEL, 0, (LPARAM)(line) ); - SendDlgItemMessage(hwnd, IDC_TEXT, EM_GETSEL, (WPARAM)NULL, (LPARAM)&lastsel ); + SendDlgItemMessage(hwnd, IDC_TEXT, EM_GETSEL, (WPARAM)nullptr, (LPARAM)&lastsel ); } unselectText=1; fclose(in); @@ -158,7 +158,7 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, - NULL, + nullptr, ®Key, ®Previous); @@ -167,21 +167,21 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) RegSetValueEx(regKey,"EXEPatch",0,REG_SZ,(const uint8*)patchfile,strlen(patchfile)+1); char message[256]; - LoadString(NULL,IDS_SYS_RESTART,message,256); + LoadString(nullptr,IDS_SYS_RESTART,message,256); char title[128]; - LoadString(NULL,IDS_SYS_RESTART_TITLE,title,128); + LoadString(nullptr,IDS_SYS_RESTART_TITLE,title,128); - MessageBox(NULL,message,title,MB_OK); + MessageBox(nullptr,message,title,MB_OK); Shutdown_Computer_Now(); } else { char message[256]; - LoadString(NULL,IDS_RUNONCE_ERR,message,256); + LoadString(nullptr,IDS_RUNONCE_ERR,message,256); char string[256]; sprintf(string,message,patchfile); - MessageBox(NULL,string,"ERROR",MB_OK); + MessageBox(nullptr,string,"ERROR",MB_OK); } } // @@ -191,21 +191,21 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) { MSG msg; HWND dialog=Create_Patch_Dialog(); - while(PeekMessage(&msg,NULL,0,0, PM_REMOVE)) + while(PeekMessage(&msg,nullptr,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } HINSTANCE hInst=LoadLibrary("patchw32.dll"); - if (hInst==NULL) + if (hInst==nullptr) { char message[256]; - LoadString(NULL,IDS_ERR_MISSING_FILE,message,256); + LoadString(nullptr,IDS_ERR_MISSING_FILE,message,256); char string[256]; sprintf(string,message,"patchw32.dll"); char title[128]; - LoadString(NULL,IDS_ERROR,title,128); - MessageBox(NULL,string,title,MB_OK); + LoadString(nullptr,IDS_ERROR,title,128); + MessageBox(nullptr,string,title,MB_OK); exit(-1); return; } @@ -215,13 +215,13 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) PATCHFUNC patchFunc; patchFunc=(PATCHFUNC)GetProcAddress(hInst,"RTPatchApply32@12"); - if (patchFunc==NULL) + if (patchFunc==nullptr) { char message[256]; - LoadString(NULL,IDS_BAD_LIBRARY,message,256); + LoadString(nullptr,IDS_BAD_LIBRARY,message,256); char title[128]; - LoadString(NULL,IDS_ERROR,title,128); - MessageBox(NULL,message,title,MB_OK); + LoadString(nullptr,IDS_ERROR,title,128); + MessageBox(nullptr,message,title,MB_OK); return; } @@ -248,7 +248,7 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) char *cptr=patchfile; char *tempPtr; DWORD version; - while( (tempPtr=strchr(cptr,'\\')) !=NULL) + while( (tempPtr=strchr(cptr,'\\')) !=nullptr) cptr=tempPtr+1; if (cptr) version=atol(cptr); @@ -300,7 +300,7 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) Wait_Process(notepad); } #else - DialogBox(Global_instance,MAKEINTRESOURCE(IDD_CHANGELOG),NULL,(DLGPROC)Update_Info_Proc); + DialogBox(Global_instance,MAKEINTRESOURCE(IDD_CHANGELOG),nullptr,(DLGPROC)Update_Info_Proc); #endif } // @@ -323,18 +323,18 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) else if (strcasecmp(patchfile+strlen(patchfile)-strlen(".web"),".web")==0) { char message[256]; - LoadString(NULL,IDS_WEBPATCH,message,256); + LoadString(nullptr,IDS_WEBPATCH,message,256); char title[128]; - LoadString(NULL,IDS_WEBPATCH_TITLE,title,128); - MessageBox(NULL,message,title,MB_OK); + LoadString(nullptr,IDS_WEBPATCH_TITLE,title,128); + MessageBox(nullptr,message,title,MB_OK); FILE *in=fopen(patchfile,"r"); - if (in!=NULL) + if (in!=nullptr) { char URL[256]; fgets(URL,255,in); fclose(in); - ShellExecute(NULL,NULL,URL,NULL,".",SW_SHOW); + ShellExecute(nullptr,nullptr,URL,nullptr,".",SW_SHOW); _unlink(patchfile); //// This is somewhat skanky, but we can't wait //// for the viewer to exit (I tried). @@ -342,7 +342,7 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) } else { - MessageBox(NULL,patchfile,"Patchfile vanished?",MB_OK); + MessageBox(nullptr,patchfile,"Patchfile vanished?",MB_OK); } } } @@ -362,15 +362,14 @@ void Shutdown_Computer_Now(void) } // Get the LUID for the shutdown privilege. - LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, - &tkp.Privileges[0].Luid); + LookupPrivilegeValue(nullptr, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); tkp.PrivilegeCount = 1; // one privilege to set tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; // Get the shutdown privilege for this process. AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, - (PTOKEN_PRIVILEGES)NULL, 0); + (PTOKEN_PRIVILEGES)nullptr, 0); // Cannot test the return value of AdjustTokenPrivileges. if (GetLastError() != ERROR_SUCCESS) @@ -383,13 +382,13 @@ void Shutdown_Computer_Now(void) { // Should never happen char restart[128]; - LoadString(NULL,IDS_MUST_RESTART,restart,128); - MessageBox(NULL,restart,"OK",MB_OK); + LoadString(nullptr,IDS_MUST_RESTART,restart,128); + MessageBox(nullptr,restart,"OK",MB_OK); exit(0); } MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) + while (GetMessage(&msg, nullptr, 0, 0)) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -410,7 +409,7 @@ __declspec(dllexport) LPVOID CALLBACK PatchCallBack(UINT Id, LPVOID Param) // Make sure our windows get updated MSG msg; int counter=0; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE )) + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE )) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -445,11 +444,11 @@ __declspec(dllexport) LPVOID CALLBACK PatchCallBack(UINT Id, LPVOID Param) // Error message header/text ///////*g_LogFile << (char *)Parm << endl; char errmsg[256]; - LoadString(NULL,IDS_ERR_PATCH,errmsg,256); - MessageBox(NULL,(char *)Param,errmsg,MB_OK); + LoadString(nullptr,IDS_ERR_PATCH,errmsg,256); + MessageBox(nullptr,(char *)Param,errmsg,MB_OK); { FILE *out=fopen("patch.err","a"); - time_t timet=time(NULL); + time_t timet=time(nullptr); fprintf(out,"\n\nPatch Error: %s\n",ctime(&timet)); fprintf(out,"%s\n",(char *)Param); fclose(out); @@ -507,7 +506,7 @@ __declspec(dllexport) LPVOID CALLBACK PatchCallBack(UINT Id, LPVOID Param) currFile++; char xofy[64]; - LoadString(NULL,IDS_FILE_X_OF_Y,xofy,64); + LoadString(nullptr,IDS_FILE_X_OF_Y,xofy,64); sprintf(string,xofy,currFile,fileCount); SetWindowText(GetDlgItem(PatchDialog,IDC_CAPTION),string); @@ -575,7 +574,7 @@ __declspec(dllexport) LPVOID CALLBACK PatchCallBack(UINT Id, LPVOID Param) } if(Abort) - return (NULL); + return (nullptr); else return (RetVal); } diff --git a/Core/Tools/Launcher/process.cpp b/Core/Tools/Launcher/process.cpp index 335dbb0f225..3069824821f 100644 --- a/Core/Tools/Launcher/process.cpp +++ b/Core/Tools/Launcher/process.cpp @@ -23,8 +23,8 @@ Process::Process() directory[0]=0; command[0]=0; args[0]=0; - hProcess=NULL; - hThread=NULL; + hProcess=nullptr; + hThread=nullptr; } // Create a process @@ -43,7 +43,7 @@ bit8 Create_Process(Process &process) DBGMSG("PROCESS CMD="<strlen(str)) pos=strlen(str); @@ -443,7 +443,7 @@ bit8 Wstring::replace(const char *replaceThis, const char *withThis) if(!dest.cat(src)) return(FALSE); - src=NULL; + src=nullptr; } } return(set(dest.get())); @@ -493,7 +493,7 @@ char Wstring::set(uint32 size, const char *string) return(FALSE); } - // Copy the bytes in the string, and NULL-terminate it. + // Copy the bytes in the string, and null-terminate it. strncpy(str, string, size); str[size] = 0; @@ -545,11 +545,11 @@ bit8 Wstring::truncate(char c) { sint32 len; - if (str==NULL) + if (str==nullptr) return(FALSE); char *cptr=strchr(str,c); - if (cptr==NULL) + if (cptr==nullptr) return(FALSE); len=(sint32)(cptr-str); truncate((uint32)len); @@ -564,7 +564,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) sint32 start; sint32 stop; for (i=offset; i<(int)length(); i++) { - if(strchr(delim,str[i])==NULL) + if(strchr(delim,str[i])==nullptr) break; } if (i>=(int)length()) @@ -572,7 +572,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) start=i; for (; i<(int)length(); i++) { - if(strchr(delim,str[i])!=NULL) + if(strchr(delim,str[i])!=nullptr) break; } stop=i-1; @@ -593,7 +593,7 @@ sint32 Wstring::getLine(int offset, Wstring &out) return(-1); for (; i<(int)length(); i++) { - if(strchr("\r\n",str[i])!=NULL) + if(strchr("\r\n",str[i])!=nullptr) break; } stop=i; diff --git a/Core/Tools/Launcher/wstypes.h b/Core/Tools/Launcher/wstypes.h index d521a5872a0..e74cd7a43fe 100644 --- a/Core/Tools/Launcher/wstypes.h +++ b/Core/Tools/Launcher/wstypes.h @@ -46,10 +46,6 @@ Standard type definitions for the sake of portability and readability. #define MAX(x,y) (((x)>(y))?(x):(y)) #endif -#ifndef NULL -#define NULL 0 -#endif - //These are used for readability purposes mostly, when a method takes a // pointer or reference these help specify what will happen to the data // that is sent in. diff --git a/Core/Tools/MapCacheBuilder/Source/WinMain.cpp b/Core/Tools/MapCacheBuilder/Source/WinMain.cpp index 9a2d0adca3f..f26f8952ee2 100644 --- a/Core/Tools/MapCacheBuilder/Source/WinMain.cpp +++ b/Core/Tools/MapCacheBuilder/Source/WinMain.cpp @@ -115,19 +115,19 @@ static SubsystemInterfaceList _TheSubsystemList; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = nullptr, const char* path2 = nullptr) { sysref = sys; - _TheSubsystemList.initSubsystem(sys, path1, path2, NULL); + _TheSubsystemList.initSubsystem(sys, path1, path2, nullptr); } /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -HINSTANCE ApplicationHInstance = NULL; ///< our application instance +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance /// just to satisfy the game libraries we link to -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; const char *gAppPrefix = "MC_"; @@ -143,14 +143,14 @@ const Char *g_csfFile = "data\\%s\\Generals.csf"; static char *nextParam(char *newSource, const char *seps) { - static char *source = NULL; + static char *source = nullptr; if (newSource) { source = newSource; } if (!source) { - return NULL; + return nullptr; } // find first separator @@ -186,15 +186,15 @@ static char *nextParam(char *newSource, const char *seps) *end = 0; if (!*source) - source = NULL; + source = nullptr; } else { - source = NULL; + source = nullptr; } if (first && !*first) - first = NULL; + first = nullptr; } return first; @@ -223,7 +223,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, // Set the current directory to the app directory. char buf[_MAX_PATH]; - GetModuleFileName(NULL, buf, sizeof(buf)); + GetModuleFileName(nullptr, buf, sizeof(buf)); if (char *pEnd = strrchr(buf, '\\')) { *pEnd = 0; } @@ -235,11 +235,11 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, std::list argvSet; char *token; token = nextParam(lpCmdLine, "\" "); - while (token != NULL) { + while (token != nullptr) { char * str = strtrim(token); argvSet.push_back(str); DEBUG_LOG(("Adding '%s'", str)); - token = nextParam(NULL, "\" "); + token = nextParam(nullptr, "\" "); } // not part of the subsystem list, because it should normally never be reset! @@ -263,16 +263,16 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(TheRankInfoStore, new RankInfoStore(), nullptr, "Data\\INI\\Rank"); initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheWeaponStore, new WeaponStore(), nullptr, "Data\\INI\\Weapon"); initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), nullptr, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), nullptr, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), nullptr, "Data\\INI\\Armor"); initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); @@ -294,23 +294,23 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, TheMapCache->updateCache(); delete TheMapCache; - TheMapCache = NULL; + TheMapCache = nullptr; // load the dialog box //DialogBox( hInstance, (LPCTSTR)IMAGE_PACKER_DIALOG, - // NULL, (DLGPROC)ImagePackerProc ); + // nullptr, (DLGPROC)ImagePackerProc ); // delete TheGlobalData //delete TheGlobalData; - //TheGlobalData = NULL; + //TheGlobalData = nullptr; _TheSubsystemList.shutdownAll(); delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; } catch (...) diff --git a/Core/Tools/PATCHGET/CHATAPI.cpp b/Core/Tools/PATCHGET/CHATAPI.cpp index bba0c3902d3..7e1df70c117 100644 --- a/Core/Tools/PATCHGET/CHATAPI.cpp +++ b/Core/Tools/PATCHGET/CHATAPI.cpp @@ -176,16 +176,16 @@ static void startOnline( void ) // Close that contacting window DestroyWindow(g_ContactWindow); - g_ContactWindow=NULL; + g_ContactWindow=nullptr; if (cantConnect) { - MessageBox(NULL, "Can't Connect", GAME_NAME, MB_OK); + MessageBox(nullptr, "Can't Connect", GAME_NAME, MB_OK); exit(0); } else if (queuedDownloads.size()) { - if (MessageBox(NULL, "Patches Available. Download?", GAME_NAME, MB_YESNO) == IDYES) + if (MessageBox(nullptr, "Patches Available. Download?", GAME_NAME, MB_YESNO) == IDYES) { DEBUG_LOG(("Downloading patches")); while (queuedDownloads.size()) @@ -210,7 +210,7 @@ static void startOnline( void ) } */ delete TheDownloadManager; - TheDownloadManager = NULL; + TheDownloadManager = nullptr; if (g_Finished != 1) { @@ -229,7 +229,7 @@ static void startOnline( void ) } else { - MessageBox(NULL, "No Patches Available", GAME_NAME, MB_OK); + MessageBox(nullptr, "No Patches Available", GAME_NAME, MB_OK); exit(0); } } @@ -278,7 +278,7 @@ static std::string getNextLine(std::string in, std::string& remainder) //----------------------------------------------------------------------------- inline const char* skipSeps(const char* p, const char* seps) { - while (*p && strchr(seps, *p) != NULL) + while (*p && strchr(seps, *p) != nullptr) ++p; return p; } @@ -286,18 +286,18 @@ inline const char* skipSeps(const char* p, const char* seps) //----------------------------------------------------------------------------- inline const char* skipNonSeps(const char* p, const char* seps) { - while (*p && strchr(seps, *p) == NULL) + while (*p && strchr(seps, *p) == nullptr) ++p; return p; } //----------------------------------------------------------------------------- -bool nextToken(std::string& base, std::string& tok, const char* seps = NULL) +bool nextToken(std::string& base, std::string& tok, const char* seps = nullptr) { if (base.empty()) return false; - if (seps == NULL) + if (seps == nullptr) seps = " \n\r\t"; const char* start = skipSeps(base.c_str(), seps); @@ -463,8 +463,8 @@ static void StartPatchCheck( void ) // check for a patch first checksLeft = 2; cantConnect = false; - ghttpGet(gameURL.c_str(), GHTTPFalse, patchCheckCallback, NULL); - ghttpGet(mapURL.c_str(), GHTTPFalse, patchCheckCallback, NULL); + ghttpGet(gameURL.c_str(), GHTTPFalse, patchCheckCallback, nullptr); + ghttpGet(mapURL.c_str(), GHTTPFalse, patchCheckCallback, nullptr); DEBUG_LOG(("Started looking for patches at '%s' && '%s'", gameURL.c_str(), mapURL.c_str())); } @@ -526,7 +526,7 @@ BOOL CALLBACK downloadDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM //sprintf(localfile,"%s\\%s",g_Update->localpath,g_Update->patchfile); // Create the directory - //CreateDirectory((char *)g_Update->localpath, NULL ); + //CreateDirectory((char *)g_Update->localpath, nullptr ); TheDownloadManager->downloadFile(TheDownload.server, TheDownload.userName, TheDownload.password, TheDownload.file, TheDownload.localFile, TheDownload.regKey, TheDownload.tryResume); @@ -537,7 +537,7 @@ BOOL CALLBACK downloadDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM */ g_DownloadWindow = hwndDlg; g_Finished = 0; - SetTimer( hwndDlg, 1, 200, NULL ); // was 50 + SetTimer( hwndDlg, 1, 200, nullptr ); // was 50 break; @@ -625,8 +625,8 @@ HWND CreatePrimaryWin(void) wc.cbWndExtra = 0; // No extra win data wc.hInstance = Global_instance; wc.hIcon=LoadIcon(Global_instance, MAKEINTRESOURCE(IDI_ICON1)); - wc.hCursor = NULL; /////////LoadCursor( NULL, IDC_ARROW ); - wc.hbrBackground = NULL; + wc.hCursor = nullptr; /////////LoadCursor( nullptr, IDC_ARROW ); + wc.hbrBackground = nullptr; wc.lpszMenuName = name; wc.lpszClassName = name; RegisterClass( &wc ); @@ -645,10 +645,10 @@ HWND CreatePrimaryWin(void) //GetSystemMetrics( SM_CYSCREEN ), 0,0, - NULL, - NULL, + nullptr, + nullptr, Global_instance, - NULL ); + nullptr ); SendMessage(hwnd,WM_SETICON,(WPARAM)ICON_SMALL, (LPARAM)LoadIcon(Global_instance, MAKEINTRESOURCE(IDI_ICON1))); @@ -667,7 +667,7 @@ void DispatchEvents(void) { MSG msg; int counter=0; - while(PeekMessage(&msg,NULL,0,0, PM_REMOVE)) + while(PeekMessage(&msg,nullptr,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -696,7 +696,7 @@ int main(int argc, char *argv[]) { char username[64]; valuesize=sizeof(username); - if (RegQueryValueEx(rKey,"UserName",NULL,&type,(uint8 *)username,&valuesize)==ERROR_SUCCESS) + if (RegQueryValueEx(rKey,"UserName",nullptr,&type,(uint8 *)username,&valuesize)==ERROR_SUCCESS) have_registered=true; RegCloseKey(rKey); } @@ -711,7 +711,7 @@ int main(int argc, char *argv[]) if (!have_registered) { - if (MessageBox(NULL,Fetch_String(TXT_REGNOW),Fetch_String(TXT_TITLE),MB_YESNO)==IDNO) + if (MessageBox(nullptr,Fetch_String(TXT_REGNOW),Fetch_String(TXT_TITLE),MB_YESNO)==IDNO) have_registered=true; // pretend they've alredy registered } @@ -723,7 +723,7 @@ int main(int argc, char *argv[]) { char regapp[300]; valuesize=sizeof(regapp); - if ((RegQueryValueEx(rKey,"InstallPath",NULL,&type,(uint8 *)regapp,&valuesize)==ERROR_SUCCESS)&& + if ((RegQueryValueEx(rKey,"InstallPath",nullptr,&type,(uint8 *)regapp,&valuesize)==ERROR_SUCCESS)&& (strlen(regapp) > 8)) { // Launch the process @@ -732,9 +732,9 @@ int main(int argc, char *argv[]) info.cbSize=sizeof(info); info.fMask=SEE_MASK_NOCLOSEPROCESS; info.hwnd=g_PrimaryWindow; - info.lpVerb=NULL; + info.lpVerb=nullptr; info.lpFile=regapp; - info.lpParameters=NULL; + info.lpParameters=nullptr; info.lpDirectory="."; info.nShow=SW_SHOW; ShellExecuteEx(&info); @@ -865,15 +865,15 @@ char const * Fetch_String(int id) /****** char resname[32]; sprintf(resname,"#%d",id); - HMODULE hmod=GetModuleHandle(NULL); + HMODULE hmod=GetModuleHandle(nullptr); HRSRC hrsrc=FindResourceEx(hmod, RT_STRING, MAKEINTRESOURCE(id), LANGID); if (hrsrc==0) { char message_buffer[256]; - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &message_buffer[0], 256, NULL ); + FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &message_buffer[0], 256, nullptr ); } - HGLOBAL resdata=LoadResource(NULL,hrsrc); + HGLOBAL resdata=LoadResource(nullptr,hrsrc); LPVOID vdata=LockResource(resdata); strcpy(stringptr,(char *)vdata); *********/ @@ -903,13 +903,13 @@ void Startup_Chat(void) /* //////CComObject* g_pChatSink; HRESULT hRes; - g_pChatSink=NULL; + g_pChatSink=nullptr; - CoCreateInstance(CLSID_Chat, NULL, CLSCTX_INPROC_SERVER, + CoCreateInstance(CLSID_Chat, nullptr, CLSCTX_INPROC_SERVER, IID_IChat, (void**)&pChat); - if (pChat==NULL) + if (pChat==nullptr) { char error[128]; char apimissing[256]; @@ -922,8 +922,8 @@ void Startup_Chat(void) g_pChatSink=new CChatEventSink; // Get a connection point from the chat class - IConnectionPoint *pConnectionPoint=NULL; - IConnectionPointContainer *pContainer=NULL; + IConnectionPoint *pConnectionPoint=nullptr; + IConnectionPointContainer *pContainer=nullptr; dwChatAdvise=0; hRes=pChat->QueryInterface(IID_IConnectionPointContainer,(void**)&pContainer); @@ -945,8 +945,8 @@ void Shutdown_Chat(void) /* /////AtlUnadvise(pChat, IID_IChatEvent, dwChatAdvise); - IConnectionPoint *pConnectionPoint=NULL; - IConnectionPointContainer *pContainer=NULL; + IConnectionPoint *pConnectionPoint=nullptr; + IConnectionPointContainer *pContainer=nullptr; HRESULT hRes; hRes=pChat->QueryInterface(IID_IConnectionPointContainer,(void**)&pContainer); @@ -976,7 +976,7 @@ void Update_If_Required(void) int i; // Create the events for (i=0; iRequestServerList(1000,262364,"register","regpas98",15); @@ -1034,7 +1034,7 @@ void Update_If_Required(void) { pChat->PumpMessages(); MSG msg; - while(PeekMessage(&msg,NULL,0,0, PM_REMOVE)) + while(PeekMessage(&msg,nullptr,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -1097,7 +1097,7 @@ CChatEventSink::QueryInterface(const IID& iid, void** ppv) } else { - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } (reinterpret_cast(*ppv))->AddRef() ; @@ -1157,7 +1157,7 @@ CDownloadEventSink::QueryInterface(const IID& iid, void** ppv) } else { - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } (reinterpret_cast(*ppv))->AddRef() ; @@ -1204,16 +1204,16 @@ void SetupDownload( void ) /* HRESULT hRes; - g_pDownloadSink=NULL; + g_pDownloadSink=nullptr; - CoCreateInstance(CLSID_Download, NULL, CLSCTX_INPROC_SERVER, + CoCreateInstance(CLSID_Download, nullptr, CLSCTX_INPROC_SERVER, IID_IDownload, (void**)&pDownload); _ASSERTE(pDownload); g_pDownloadSink=new CDownloadEventSink; // Get a connection point from the chat class - IConnectionPoint *pConnectionPoint=NULL; - IConnectionPointContainer *pContainer=NULL; + IConnectionPoint *pConnectionPoint=nullptr; + IConnectionPointContainer *pContainer=nullptr; dwDownloadAdvise = 0; hRes=pDownload->QueryInterface(IID_IConnectionPointContainer,(void**)&pContainer); @@ -1232,8 +1232,8 @@ void ClosedownDownload( void ) /* // AtlUnadvise(pDownload, IID_IDownloadEvent, dwDownloadAdvise); - IConnectionPoint *pConnectionPoint=NULL; - IConnectionPointContainer *pContainer=NULL; + IConnectionPoint *pConnectionPoint=nullptr; + IConnectionPointContainer *pContainer=nullptr; HRESULT hRes; hRes=pDownload->QueryInterface(IID_IConnectionPointContainer,(void**)&pContainer); @@ -1308,7 +1308,7 @@ BOOL CALLBACK Download_Dialog_Proc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR sprintf(localfile,"%s\\%s",g_Update->localpath,g_Update->patchfile); // Create the directory - CreateDirectory((char *)g_Update->localpath, NULL ); + CreateDirectory((char *)g_Update->localpath, nullptr ); res=pDownload->DownloadFile((char *)g_Update->server, (char *)g_Update->login, (char *)g_Update->password, fullpath, localfile, APP_REG_KEY); @@ -1316,7 +1316,7 @@ BOOL CALLBACK Download_Dialog_Proc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR */ g_DownloadWindow = hwndDlg; g_Finished = 0; - SetTimer( hwndDlg, 1, 200, NULL ); // was 50 + SetTimer( hwndDlg, 1, 200, nullptr ); // was 50 break; @@ -1474,7 +1474,7 @@ STDMETHODIMP CChatEventSink::OnServerList(HRESULT res, Server* servers) // If we get this, then we don't need to patch // Close that contacting window DestroyWindow(g_ContactWindow); - g_ContactWindow=NULL; + g_ContactWindow=nullptr; LogMsg("Server List"); @@ -1661,7 +1661,7 @@ STDMETHODIMP CChatEventSink::OnUpdateList(HRESULT r, Update * updates) // Close that contacting window DestroyWindow(g_ContactWindow); - g_ContactWindow=NULL; + g_ContactWindow=nullptr; if( FAILED(r) ) { @@ -1669,7 +1669,7 @@ STDMETHODIMP CChatEventSink::OnUpdateList(HRESULT r, Update * updates) SetEvent(Events[ABORT_EVENT]); // An error occurred, bail out } - if( updates == NULL ) // shouldn't happen + if( updates == nullptr ) // shouldn't happen return S_OK; @@ -1680,7 +1680,7 @@ STDMETHODIMP CChatEventSink::OnUpdateList(HRESULT r, Update * updates) // Count the updates; tmp = updates; - while( tmp != NULL ) + while( tmp != nullptr ) { tmp = tmp->next; numupdates++; @@ -1711,7 +1711,7 @@ STDMETHODIMP CChatEventSink::OnUpdateList(HRESULT r, Update * updates) } // Do the downloads - while( tmp != NULL ) + while( tmp != nullptr ) { g_Update = tmp; diff --git a/Core/Tools/PATCHGET/COMINIT.cpp b/Core/Tools/PATCHGET/COMINIT.cpp index 73efff26d9c..c592d606ac0 100644 --- a/Core/Tools/PATCHGET/COMINIT.cpp +++ b/Core/Tools/PATCHGET/COMINIT.cpp @@ -30,10 +30,10 @@ namespace patchget ComInit::ComInit() { - HRESULT hRes = CoInitialize(NULL); + HRESULT hRes = CoInitialize(nullptr); if (SUCCEEDED(hRes)==FALSE) { - MessageBox(NULL,"Can't initialize COM?!?!","Error:",MB_OK); + MessageBox(nullptr,"Can't initialize COM?!?!","Error:",MB_OK); exit(0); } } diff --git a/Core/Tools/PATCHGET/DownloadManager.cpp b/Core/Tools/PATCHGET/DownloadManager.cpp index c22268b6226..56d20eed39f 100644 --- a/Core/Tools/PATCHGET/DownloadManager.cpp +++ b/Core/Tools/PATCHGET/DownloadManager.cpp @@ -28,7 +28,7 @@ namespace patchget { -DownloadManager *TheDownloadManager = NULL; +DownloadManager *TheDownloadManager = nullptr; DownloadManager::DownloadManager() { diff --git a/Core/Tools/PATCHGET/PROCESS.cpp b/Core/Tools/PATCHGET/PROCESS.cpp index f59ad57a447..871073fcf95 100644 --- a/Core/Tools/PATCHGET/PROCESS.cpp +++ b/Core/Tools/PATCHGET/PROCESS.cpp @@ -26,8 +26,8 @@ Process::Process() directory[0]=0; command[0]=0; args[0]=0; - hProcess=NULL; - hThread=NULL; + hProcess=nullptr; + hThread=nullptr; } // Create a process @@ -44,7 +44,7 @@ bit8 Create_Process(Process &process) strcpy(cmdargs,process.command); strcat(cmdargs,process.args); - retval=CreateProcess(NULL,cmdargs,NULL,NULL,FALSE, 0 ,NULL, NULL/*process.directory*/,&si,&piProcess); + retval=CreateProcess(nullptr,cmdargs,nullptr,nullptr,FALSE, 0 ,nullptr, nullptr/*process.directory*/,&si,&piProcess); process.hProcess=piProcess.hProcess; process.hThread=piProcess.hThread; @@ -58,11 +58,11 @@ bit8 Wait_Process(Process &process, DWORD *exit_code) { DWORD retval; retval=WaitForSingleObject(process.hProcess,INFINITE); - if (exit_code != NULL) + if (exit_code != nullptr) *exit_code=-1; if (retval==WAIT_OBJECT_0) // process exited { - if (exit_code != NULL) + if (exit_code != nullptr) GetExitCodeProcess(process.hProcess,exit_code); return(TRUE); } diff --git a/Core/Tools/PATCHGET/PROCESS.h b/Core/Tools/PATCHGET/PROCESS.h index 26ccf044c82..57ce353c6fd 100644 --- a/Core/Tools/PATCHGET/PROCESS.h +++ b/Core/Tools/PATCHGET/PROCESS.h @@ -38,6 +38,6 @@ class Process //bit8 Read_Process_Info(ConfigFile &config,OUT Process &info); bit8 Create_Process(Process &process); -bit8 Wait_Process(Process &process, DWORD *exit_code=NULL); +bit8 Wait_Process(Process &process, DWORD *exit_code=nullptr); } // namespace patchget diff --git a/Core/Tools/PATCHGET/WINBLOWS.cpp b/Core/Tools/PATCHGET/WINBLOWS.cpp index 0e79559180b..fd99da0bcc1 100644 --- a/Core/Tools/PATCHGET/WINBLOWS.cpp +++ b/Core/Tools/PATCHGET/WINBLOWS.cpp @@ -30,8 +30,8 @@ // TheSuperHackers @fix xezon 13/03/2025 Fix debug linker errors by // adding "patchget" namespaces and these globals here. // just to satisfy the game libraries we link to -HINSTANCE ApplicationHInstance = NULL; ///< our application instance -HWND ApplicationHWnd = NULL; +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance +HWND ApplicationHWnd = nullptr; const char *g_strFile = "data\\Generals.str"; const char *g_csfFile = "data\\%s\\Generals.csf"; const char *gAppPrefix = "patchget_"; // prefix to the debug log. diff --git a/Core/Tools/PATCHGET/debug.cpp b/Core/Tools/PATCHGET/debug.cpp index d0809df4648..e6a4d04a280 100644 --- a/Core/Tools/PATCHGET/debug.cpp +++ b/Core/Tools/PATCHGET/debug.cpp @@ -37,7 +37,7 @@ static int doCrashBox(const char *buffer, bool logResult) { int result; - result = ::MessageBox(NULL, buffer, "Assertion Failure", MB_ABORTRETRYIGNORE|MB_APPLMODAL|MB_ICONWARNING); + result = ::MessageBox(nullptr, buffer, "Assertion Failure", MB_ABORTRETRYIGNORE|MB_APPLMODAL|MB_ICONWARNING); switch(result) { @@ -96,7 +96,7 @@ void DebugCrash(const char *format, ...) va_end(arg); if (strlen(theBuffer) >= sizeof(theBuffer)) - ::MessageBox(NULL, "String too long for debug buffers", "", MB_OK|MB_APPLMODAL); + ::MessageBox(nullptr, "String too long for debug buffers", "", MB_OK|MB_APPLMODAL); OutputDebugString(theBuffer); OutputDebugString("\n"); @@ -106,10 +106,10 @@ void DebugCrash(const char *format, ...) int result = doCrashBox(theBuffer, true); - if (result == IDIGNORE && TheCurrentIgnoreCrashPtr != NULL) + if (result == IDIGNORE && TheCurrentIgnoreCrashPtr != nullptr) { int yn; - yn = ::MessageBox(NULL, "Ignore this crash from now on?", "", MB_YESNO|MB_APPLMODAL); + yn = ::MessageBox(nullptr, "Ignore this crash from now on?", "", MB_YESNO|MB_APPLMODAL); if (yn == IDYES) *TheCurrentIgnoreCrashPtr = 1; } diff --git a/Core/Tools/PATCHGET/debug.h b/Core/Tools/PATCHGET/debug.h index e61a99033aa..90eb764def5 100644 --- a/Core/Tools/PATCHGET/debug.h +++ b/Core/Tools/PATCHGET/debug.h @@ -55,7 +55,7 @@ void DebugLog( const char *fmt, ... ); if (!ignoreCrash) { \ TheCurrentIgnoreCrashPtr = &ignoreCrash; \ DebugCrash m ; \ - TheCurrentIgnoreCrashPtr = NULL; \ + TheCurrentIgnoreCrashPtr = nullptr; \ } \ } \ } while (0) diff --git a/Core/Tools/PATCHGET/registry.cpp b/Core/Tools/PATCHGET/registry.cpp index 0640c0a9112..1da46d589ad 100644 --- a/Core/Tools/PATCHGET/registry.cpp +++ b/Core/Tools/PATCHGET/registry.cpp @@ -40,7 +40,7 @@ bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::s if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_ALL_ACCESS, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.c_str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -63,7 +63,7 @@ bool getUnsignedIntFromRegistry(HKEY root, std::string path, std::string key, un if ((returnValue = RegOpenKeyEx( root, path.c_str(), 0, KEY_ALL_ACCESS, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.c_str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.c_str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -84,7 +84,7 @@ bool setStringInRegistry( HKEY root, std::string path, std::string key, std::str int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_SZ; size = val.length()+1; @@ -103,7 +103,7 @@ bool setUnsignedIntInRegistry( HKEY root, std::string path, std::string key, uns int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.c_str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_DWORD; size = 4; diff --git a/Core/Tools/W3DView/AddToLineupDialog.cpp b/Core/Tools/W3DView/AddToLineupDialog.cpp index 94dc34e0414..06feb6e3616 100644 --- a/Core/Tools/W3DView/AddToLineupDialog.cpp +++ b/Core/Tools/W3DView/AddToLineupDialog.cpp @@ -38,7 +38,7 @@ static char THIS_FILE[] = __FILE__; // CAddToLineupDialog dialog -CAddToLineupDialog::CAddToLineupDialog(ViewerSceneClass *scene, CWnd* pParent /*=NULL*/) +CAddToLineupDialog::CAddToLineupDialog(ViewerSceneClass *scene, CWnd* pParent /*=nullptr*/) : CDialog(CAddToLineupDialog::IDD, pParent), m_pCScene(scene) { @@ -79,9 +79,9 @@ BOOL CAddToLineupDialog::OnInitDialog() // Populate the combo box with the names of the objects that // can be added to the lineup. WW3DAssetManager *assets = WW3DAssetManager::Get_Instance(); - ASSERT(assets != NULL); + ASSERT(assets != nullptr); RenderObjIterator *it = assets->Create_Render_Obj_Iterator(); - ASSERT(it != NULL); + ASSERT(it != nullptr); for (; !it->Is_Done(); it->Next()) { if (m_pCScene->Can_Line_Up(it->Current_Item_Class_ID())) diff --git a/Core/Tools/W3DView/AddToLineupDialog.h b/Core/Tools/W3DView/AddToLineupDialog.h index 5c331479da1..37c17c1f2db 100644 --- a/Core/Tools/W3DView/AddToLineupDialog.h +++ b/Core/Tools/W3DView/AddToLineupDialog.h @@ -30,7 +30,7 @@ class CAddToLineupDialog : public CDialog { // Construction public: - CAddToLineupDialog(ViewerSceneClass *scene, CWnd* pParent = NULL); // standard constructor + CAddToLineupDialog(ViewerSceneClass *scene, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CAddToLineupDialog) diff --git a/Core/Tools/W3DView/AdvancedAnimSheet.cpp b/Core/Tools/W3DView/AdvancedAnimSheet.cpp index 4c57a38b2d4..72b1ba5c7c1 100644 --- a/Core/Tools/W3DView/AdvancedAnimSheet.cpp +++ b/Core/Tools/W3DView/AdvancedAnimSheet.cpp @@ -42,8 +42,8 @@ static char THIS_FILE[] = __FILE__; // Will compare their names. static int anim_name_compare (const void *arg1, const void *arg2) { - ASSERT(arg1 != NULL); - ASSERT(arg2 != NULL); + ASSERT(arg1 != nullptr); + ASSERT(arg2 != nullptr); HAnimClass *a1 = *(HAnimClass**)arg1; HAnimClass *a2 = *(HAnimClass**)arg2; return _stricmp( a1->Get_Name(), a2->Get_Name() ); @@ -117,7 +117,7 @@ HAnimClass ** CAdvancedAnimSheet::GetAnims (void) LoadAnims(); // Return the array regardless of validity. If the entries are - // invalid, they'll all be NULL, but the array itself is cool. + // invalid, they'll all be nullptr, but the array itself is cool. return Anims; } @@ -127,10 +127,10 @@ void CAdvancedAnimSheet::LoadAnims (void) // Get the current render object and it's HTree. If it doesn't have // an HTree, then it's not animating and we're not interested. RenderObjClass *robj = ::GetCurrentDocument()->GetDisplayedObject(); - if (robj == NULL) + if (robj == nullptr) return; const HTreeClass *htree = robj->Get_HTree(); - if (htree == NULL) + if (htree == nullptr) return; const char *htree_name = htree->Get_Name(); @@ -142,7 +142,7 @@ void CAdvancedAnimSheet::LoadAnims (void) // Get an iterator from the asset manager that we can // use to enumerate the currently loaded assets AssetIterator *pAnimEnum = WW3DAssetManager::Get_Instance()->Create_HAnim_Iterator(); - ASSERT(pAnimEnum != NULL); + ASSERT(pAnimEnum != nullptr); if (pAnimEnum) { // Loop through all the animations in the manager @@ -153,7 +153,7 @@ void CAdvancedAnimSheet::LoadAnims (void) // Get an instance of the animation object HAnimClass *pHierarchyAnim = WW3DAssetManager::Get_Instance()->Get_HAnim(pszAnimName); - ASSERT(pHierarchyAnim != NULL); + ASSERT(pHierarchyAnim != nullptr); if (pHierarchyAnim) { // Does this animation apply to the current model's HTree? @@ -182,7 +182,7 @@ void CAdvancedAnimSheet::LoadAnims (void) // Free the object delete pAnimEnum; - pAnimEnum = NULL; + pAnimEnum = nullptr; } /* diff --git a/Core/Tools/W3DView/AdvancedAnimSheet.h b/Core/Tools/W3DView/AdvancedAnimSheet.h index 691787da8d1..236ea910e2a 100644 --- a/Core/Tools/W3DView/AdvancedAnimSheet.h +++ b/Core/Tools/W3DView/AdvancedAnimSheet.h @@ -37,7 +37,7 @@ class CAdvancedAnimSheet : public CPropertySheet // Construction public: - CAdvancedAnimSheet(CWnd *pParentWnd = NULL, UINT iSelectPage = 0); + CAdvancedAnimSheet(CWnd *pParentWnd = nullptr, UINT iSelectPage = 0); // Attributes public: diff --git a/Core/Tools/W3DView/AggregateNameDialog.cpp b/Core/Tools/W3DView/AggregateNameDialog.cpp index a8f1f1e8d4b..37b1a88093b 100644 --- a/Core/Tools/W3DView/AggregateNameDialog.cpp +++ b/Core/Tools/W3DView/AggregateNameDialog.cpp @@ -48,7 +48,7 @@ static char THIS_FILE[] = __FILE__; // // AggregateNameDialogClass // -AggregateNameDialogClass::AggregateNameDialogClass (CWnd* pParent /*=NULL*/) +AggregateNameDialogClass::AggregateNameDialogClass (CWnd* pParent /*=nullptr*/) : CDialog(AggregateNameDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(AggregateNameDialogClass) diff --git a/Core/Tools/W3DView/AggregateNameDialog.h b/Core/Tools/W3DView/AggregateNameDialog.h index 2d71d778dc0..ec9c700bb15 100644 --- a/Core/Tools/W3DView/AggregateNameDialog.h +++ b/Core/Tools/W3DView/AggregateNameDialog.h @@ -28,8 +28,8 @@ class AggregateNameDialogClass : public CDialog { // Construction public: - AggregateNameDialogClass(CWnd* pParent = NULL); - AggregateNameDialogClass(UINT resource_id, const CString &def_name, CWnd* pParent = NULL); + AggregateNameDialogClass(CWnd* pParent = nullptr); + AggregateNameDialogClass(UINT resource_id, const CString &def_name, CWnd* pParent = nullptr); // Dialog Data //{{AFX_DATA(AggregateNameDialogClass) diff --git a/Core/Tools/W3DView/AmbientLightDialog.cpp b/Core/Tools/W3DView/AmbientLightDialog.cpp index d5e1abc29dd..708d9cbe64a 100644 --- a/Core/Tools/W3DView/AmbientLightDialog.cpp +++ b/Core/Tools/W3DView/AmbientLightDialog.cpp @@ -39,7 +39,7 @@ static char THIS_FILE[] = __FILE__; // CAmbientLightDialog dialog -CAmbientLightDialog::CAmbientLightDialog(CWnd* pParent /*=NULL*/) +CAmbientLightDialog::CAmbientLightDialog(CWnd* pParent /*=nullptr*/) : CDialog(CAmbientLightDialog::IDD, pParent) { //{{AFX_DATA_INIT(CAmbientLightDialog) diff --git a/Core/Tools/W3DView/AmbientLightDialog.h b/Core/Tools/W3DView/AmbientLightDialog.h index 1ffd5dca663..7e6ae32f590 100644 --- a/Core/Tools/W3DView/AmbientLightDialog.h +++ b/Core/Tools/W3DView/AmbientLightDialog.h @@ -28,7 +28,7 @@ class CAmbientLightDialog : public CDialog { // Construction public: - CAmbientLightDialog(CWnd* pParent = NULL); // standard constructor + CAmbientLightDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CAmbientLightDialog) diff --git a/Core/Tools/W3DView/AnimMixingPage.cpp b/Core/Tools/W3DView/AnimMixingPage.cpp index 34ed1675f53..59e45261146 100644 --- a/Core/Tools/W3DView/AnimMixingPage.cpp +++ b/Core/Tools/W3DView/AnimMixingPage.cpp @@ -76,7 +76,7 @@ BOOL CAnimMixingPage::OnInitDialog() { CPropertyPage::OnInitDialog(); - ASSERT(m_Sheet != NULL); + ASSERT(m_Sheet != nullptr); FillListCtrl(); return TRUE; // return TRUE unless you set the focus to a control @@ -89,10 +89,10 @@ void CAnimMixingPage::FillListCtrl (void) // Get the current render object and it's HTree. If it doesn't have // an HTree, then it's not animating and we're not interested. RenderObjClass *robj = ::GetCurrentDocument()->GetDisplayedObject(); - if (robj == NULL) + if (robj == nullptr) return; const HTreeClass *htree = robj->Get_HTree(); - if (htree == NULL) + if (htree == nullptr) return; // Get a sorted array of animations that affect the currently active object. @@ -114,12 +114,12 @@ void CAnimMixingPage::OnOK() RenderObjClass *current_obj = ::GetCurrentDocument()->GetDisplayedObject(); const char *obj_name = current_obj->Get_Name(); RenderObjClass *robj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(obj_name); - if (num_selected > 0 && robj != NULL) + if (num_selected > 0 && robj != nullptr) { HAnimClass **anim = m_Sheet->GetAnims(); HAnimComboClass *combo = new HAnimComboClass(num_selected); - ASSERT(combo != NULL); + ASSERT(combo != nullptr); POSITION pos = m_AnimList.GetFirstSelectedItemPosition(); int array_idx, idx = 0; diff --git a/Core/Tools/W3DView/AnimMixingPage.h b/Core/Tools/W3DView/AnimMixingPage.h index 50c6c369d0b..77c1df481d2 100644 --- a/Core/Tools/W3DView/AnimMixingPage.h +++ b/Core/Tools/W3DView/AnimMixingPage.h @@ -32,7 +32,7 @@ class CAnimMixingPage : public CPropertyPage // Construction public: - CAnimMixingPage(CAdvancedAnimSheet *sheet = NULL); + CAnimMixingPage(CAdvancedAnimSheet *sheet = nullptr); ~CAnimMixingPage(); // Dialog Data diff --git a/Core/Tools/W3DView/AnimReportPage.cpp b/Core/Tools/W3DView/AnimReportPage.cpp index 1b5af2f3ce8..17286668dae 100644 --- a/Core/Tools/W3DView/AnimReportPage.cpp +++ b/Core/Tools/W3DView/AnimReportPage.cpp @@ -91,10 +91,10 @@ void CAnimReportPage::FillListControl() // Get the current render object and it's HTree. If it doesn't have // an HTree, then it's not animating and we're not interested. RenderObjClass *robj = ::GetCurrentDocument()->GetDisplayedObject(); - if (robj == NULL) + if (robj == nullptr) return; const HTreeClass *htree = robj->Get_HTree(); - if (htree == NULL) + if (htree == nullptr) return; // Get a sorted array of animations that affect the currently active object. diff --git a/Core/Tools/W3DView/AnimReportPage.h b/Core/Tools/W3DView/AnimReportPage.h index 8f5caac7406..d4933140e04 100644 --- a/Core/Tools/W3DView/AnimReportPage.h +++ b/Core/Tools/W3DView/AnimReportPage.h @@ -33,7 +33,7 @@ class CAnimReportPage : public CPropertyPage // Construction public: - CAnimReportPage(CAdvancedAnimSheet *sheet = NULL); + CAnimReportPage(CAdvancedAnimSheet *sheet = nullptr); ~CAnimReportPage(); // Dialog Data diff --git a/Core/Tools/W3DView/AnimatedSoundOptionsDialog.cpp b/Core/Tools/W3DView/AnimatedSoundOptionsDialog.cpp index 85584f00373..dea88570eca 100644 --- a/Core/Tools/W3DView/AnimatedSoundOptionsDialog.cpp +++ b/Core/Tools/W3DView/AnimatedSoundOptionsDialog.cpp @@ -44,7 +44,7 @@ static char THIS_FILE[] = __FILE__; // AnimatedSoundOptionsDialogClass dialog -AnimatedSoundOptionsDialogClass::AnimatedSoundOptionsDialogClass(CWnd* pParent /*=NULL*/) +AnimatedSoundOptionsDialogClass::AnimatedSoundOptionsDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(AnimatedSoundOptionsDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(AnimatedSoundOptionsDialogClass) @@ -204,7 +204,7 @@ AnimatedSoundOptionsDialogClass::Load_Animated_Sound_Settings (void) // Try to load the definitions into the definition mgr // FileClass *file = _TheFileFactory->Get_File (sound_def_lib_path); - if (file != NULL) { + if (file != nullptr) { file->Open (FileClass::READ); ChunkLoadClass cload (file); SaveLoadSystemClass::Load (cload); diff --git a/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h b/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h index 9024d742c38..b2afc10a5d1 100644 --- a/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h +++ b/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h @@ -28,7 +28,7 @@ class AnimatedSoundOptionsDialogClass : public CDialog { // Construction public: - AnimatedSoundOptionsDialogClass(CWnd* pParent = NULL); // standard constructor + AnimatedSoundOptionsDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(AnimatedSoundOptionsDialogClass) diff --git a/Core/Tools/W3DView/AnimationSpeed.h b/Core/Tools/W3DView/AnimationSpeed.h index 0cd1c8894b0..e0626c745ea 100644 --- a/Core/Tools/W3DView/AnimationSpeed.h +++ b/Core/Tools/W3DView/AnimationSpeed.h @@ -28,7 +28,7 @@ class CAnimationSpeed : public CDialog { // Construction public: - CAnimationSpeed(CWnd* pParent = NULL); // standard constructor + CAnimationSpeed(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CAnimationSpeed) diff --git a/Core/Tools/W3DView/AssetInfo.cpp b/Core/Tools/W3DView/AssetInfo.cpp index 3b7092dcc62..0abd6dc3688 100644 --- a/Core/Tools/W3DView/AssetInfo.cpp +++ b/Core/Tools/W3DView/AssetInfo.cpp @@ -57,11 +57,11 @@ AssetInfoClass::Initialize (void) prender_obj->Add_Ref(); // If we are wrapping an asset name, then create an instance of it. - if (prender_obj == NULL) { + if (prender_obj == nullptr) { prender_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (m_Name); } - if (prender_obj != NULL) { + if (prender_obj != nullptr) { // Get the hierarchy tree for this object (if one exists) const HTreeClass *phtree = prender_obj->Get_HTree (); diff --git a/Core/Tools/W3DView/AssetInfo.h b/Core/Tools/W3DView/AssetInfo.h index 1ba0adf5e0c..8655a3363b8 100644 --- a/Core/Tools/W3DView/AssetInfo.h +++ b/Core/Tools/W3DView/AssetInfo.h @@ -59,13 +59,13 @@ class AssetInfoClass AssetInfoClass (void) : m_AssetType (TypeUnknown), m_dwUserData (0L), - m_pRenderObj (NULL) { Initialize (); } + m_pRenderObj (nullptr) { Initialize (); } - AssetInfoClass (LPCTSTR passet_name, ASSET_TYPE type, RenderObjClass *prender_obj = NULL, DWORD user_data = 0L) + AssetInfoClass (LPCTSTR passet_name, ASSET_TYPE type, RenderObjClass *prender_obj = nullptr, DWORD user_data = 0L) : m_Name (passet_name), m_AssetType (type), m_dwUserData (user_data), - m_pRenderObj (NULL) { REF_PTR_SET (m_pRenderObj, prender_obj); Initialize (); } + m_pRenderObj (nullptr) { REF_PTR_SET (m_pRenderObj, prender_obj); Initialize (); } virtual ~AssetInfoClass (void) { REF_PTR_RELEASE (m_pRenderObj); } diff --git a/Core/Tools/W3DView/AssetPropertySheet.h b/Core/Tools/W3DView/AssetPropertySheet.h index cb9446b6d08..c770b2f5752 100644 --- a/Core/Tools/W3DView/AssetPropertySheet.h +++ b/Core/Tools/W3DView/AssetPropertySheet.h @@ -30,7 +30,7 @@ class CAssetPropertySheet : public CPropertySheet // Construction public: - CAssetPropertySheet (int iCaptionID, CPropertyPage *pCPropertyPage, CWnd *pCParentWnd = NULL); + CAssetPropertySheet (int iCaptionID, CPropertyPage *pCPropertyPage, CWnd *pCParentWnd = nullptr); // Attributes public: @@ -56,8 +56,8 @@ class CAssetPropertySheet : public CPropertySheet private: // Private constructors (shouldn't be called) - CAssetPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0) {} - CAssetPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0) {} + CAssetPropertySheet(UINT nIDCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0) {} + CAssetPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0) {} CPropertyPage *m_pCPropertyPage; }; diff --git a/Core/Tools/W3DView/BackgroundBMPDialog.cpp b/Core/Tools/W3DView/BackgroundBMPDialog.cpp index 6de5f2c192e..7fd50ca25db 100644 --- a/Core/Tools/W3DView/BackgroundBMPDialog.cpp +++ b/Core/Tools/W3DView/BackgroundBMPDialog.cpp @@ -39,7 +39,7 @@ static char THIS_FILE[] = __FILE__; // // CBackgroundBMPDialog // -CBackgroundBMPDialog::CBackgroundBMPDialog (CWnd* pParent /*=NULL*/) +CBackgroundBMPDialog::CBackgroundBMPDialog (CWnd* pParent /*=nullptr*/) : CDialog(CBackgroundBMPDialog::IDD, pParent) { //{{AFX_DATA_INIT(CBackgroundBMPDialog) @@ -121,7 +121,7 @@ CBackgroundBMPDialog::OnOK (void) else { // Ask the doc to clear any existing background BMP - pCDoc->SetBackgroundBMP (NULL); + pCDoc->SetBackgroundBMP (nullptr); } } diff --git a/Core/Tools/W3DView/BackgroundBMPDialog.h b/Core/Tools/W3DView/BackgroundBMPDialog.h index 71a86752a91..569995bb45f 100644 --- a/Core/Tools/W3DView/BackgroundBMPDialog.h +++ b/Core/Tools/W3DView/BackgroundBMPDialog.h @@ -28,7 +28,7 @@ class CBackgroundBMPDialog : public CDialog { // Construction public: - CBackgroundBMPDialog(CWnd* pParent = NULL); // standard constructor + CBackgroundBMPDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CBackgroundBMPDialog) diff --git a/Core/Tools/W3DView/BackgroundColorDialog.cpp b/Core/Tools/W3DView/BackgroundColorDialog.cpp index 45f066b5491..e8d2a71d3d1 100644 --- a/Core/Tools/W3DView/BackgroundColorDialog.cpp +++ b/Core/Tools/W3DView/BackgroundColorDialog.cpp @@ -37,7 +37,7 @@ static char THIS_FILE[] = __FILE__; // CBackgroundColorDialog dialog -CBackgroundColorDialog::CBackgroundColorDialog(CWnd* pParent /*=NULL*/) +CBackgroundColorDialog::CBackgroundColorDialog(CWnd* pParent /*=nullptr*/) : CDialog(CBackgroundColorDialog::IDD, pParent) { //{{AFX_DATA_INIT(CBackgroundColorDialog) diff --git a/Core/Tools/W3DView/BackgroundColorDialog.h b/Core/Tools/W3DView/BackgroundColorDialog.h index 5999e968f07..4b6a1f31a97 100644 --- a/Core/Tools/W3DView/BackgroundColorDialog.h +++ b/Core/Tools/W3DView/BackgroundColorDialog.h @@ -28,7 +28,7 @@ class CBackgroundColorDialog : public CDialog { // Construction public: - CBackgroundColorDialog(CWnd* pParent = NULL); // standard constructor + CBackgroundColorDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CBackgroundColorDialog) diff --git a/Core/Tools/W3DView/BackgroundObjectDialog.cpp b/Core/Tools/W3DView/BackgroundObjectDialog.cpp index dc4c28a0a8c..2117ce60470 100644 --- a/Core/Tools/W3DView/BackgroundObjectDialog.cpp +++ b/Core/Tools/W3DView/BackgroundObjectDialog.cpp @@ -38,7 +38,7 @@ static char THIS_FILE[] = __FILE__; // // CBackgroundObjectDialog // -CBackgroundObjectDialog::CBackgroundObjectDialog (CWnd* pParent /*=NULL*/) +CBackgroundObjectDialog::CBackgroundObjectDialog (CWnd* pParent /*=nullptr*/) : CDialog(CBackgroundObjectDialog::IDD, pParent) { //{{AFX_DATA_INIT(CBackgroundObjectDialog) @@ -114,7 +114,7 @@ CBackgroundObjectDialog::OnInitDialog (void) // Free the enumerator object we created earlier delete pObjEnum; - pObjEnum = NULL; + pObjEnum = nullptr; } // Get a pointer to the doc @@ -174,7 +174,7 @@ CBackgroundObjectDialog::OnOK (void) else { // Ask the doc to clear the background object - pCDoc->SetBackgroundObject (NULL); + pCDoc->SetBackgroundObject (nullptr); } // Allow the base class to process this message diff --git a/Core/Tools/W3DView/BackgroundObjectDialog.h b/Core/Tools/W3DView/BackgroundObjectDialog.h index 0032e55126e..2b8963d7fe9 100644 --- a/Core/Tools/W3DView/BackgroundObjectDialog.h +++ b/Core/Tools/W3DView/BackgroundObjectDialog.h @@ -28,7 +28,7 @@ class CBackgroundObjectDialog : public CDialog { // Construction public: - CBackgroundObjectDialog(CWnd* pParent = NULL); // standard constructor + CBackgroundObjectDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CBackgroundObjectDialog) diff --git a/Core/Tools/W3DView/BoneMgrDialog.cpp b/Core/Tools/W3DView/BoneMgrDialog.cpp index 57ed30814e9..d9eacf4f18f 100644 --- a/Core/Tools/W3DView/BoneMgrDialog.cpp +++ b/Core/Tools/W3DView/BoneMgrDialog.cpp @@ -47,7 +47,7 @@ BoneMgrDialogClass::BoneMgrDialogClass CWnd *pparent ) : m_pBaseModel (prender_obj), - m_pBackupModel (NULL), + m_pBackupModel (nullptr), m_bAttach (true), CDialog (BoneMgrDialogClass::IDD, pparent) { @@ -120,7 +120,7 @@ BoneMgrDialogClass::OnInitDialog (void) // Get the hierarchy tree for this model so we can enumerate bone's // and subobjects. - HTREEITEM hfirst_item = NULL; + HTREEITEM hfirst_item = nullptr; // Loop through all the bones in this model int bone_count = m_pBaseModel->Get_Num_Bones (); @@ -133,7 +133,7 @@ BoneMgrDialogClass::OnInitDialog (void) Fill_Bone_Item (hbone_item, index); // Is this the first item we've added to the tree? - if (hfirst_item == NULL) { + if (hfirst_item == nullptr) { hfirst_item = hbone_item; } } @@ -179,7 +179,7 @@ BoneMgrDialogClass::Fill_Bone_Item // to compare with the supplied hmodel and determine // which 'bones-models' are new. const char *orig_model_name = m_pBaseModel->Get_Base_Model_Name (); - orig_model_name = (orig_model_name == NULL) ? m_pBaseModel->Get_Name () : orig_model_name; + orig_model_name = (orig_model_name == nullptr) ? m_pBaseModel->Get_Name () : orig_model_name; RenderObjClass *porig_model = WW3DAssetManager::Get_Instance()->Create_Render_Obj (orig_model_name); // Build a list of nodes that are contained in the vanilla model @@ -189,7 +189,7 @@ BoneMgrDialogClass::Fill_Bone_Item index < porig_model->Get_Num_Sub_Objects_On_Bone (bone_index); index ++) { RenderObjClass *psubobj = porig_model->Get_Sub_Object_On_Bone (index, bone_index); - if (psubobj != NULL) { + if (psubobj != nullptr) { orig_node_list.Add (psubobj); } } @@ -200,7 +200,7 @@ BoneMgrDialogClass::Fill_Bone_Item index < m_pBaseModel->Get_Num_Sub_Objects_On_Bone (bone_index); index ++) { RenderObjClass *psubobj = m_pBaseModel->Get_Sub_Object_On_Bone (index, bone_index); - if (psubobj != NULL) { + if (psubobj != nullptr) { node_list.Add (psubobj); } } @@ -210,10 +210,10 @@ BoneMgrDialogClass::Fill_Bone_Item // Add the subobjects to the tree control for (int node_index = 0; node_index < node_list.Count (); node_index ++) { RenderObjClass *psubobject = node_list[node_index]; - ASSERT (psubobject != NULL); + ASSERT (psubobject != nullptr); // Is this subobject new? (i.e. not in a 'vanilla' instance?) - if (psubobject != NULL && + if (psubobject != nullptr && (Is_Object_In_List (psubobject->Get_Name (), orig_node_list) == false)) { m_BoneTree.InsertItem (psubobject->Get_Name (), 1, 1, hbone_item); } @@ -255,7 +255,7 @@ BoneMgrDialogClass::Is_Object_In_List RenderObjClass *prender_obj = node_list[node_index]; // Is this the render object we were looking for? - if (prender_obj != NULL && + if (prender_obj != nullptr && ::lstrcmpi (prender_obj->Get_Name (), passet_name) == 0) { retval = true; } @@ -324,12 +324,12 @@ BoneMgrDialogClass::Is_Render_Obj_Already_Attached (const CString &name) HTREEITEM htree_item = m_BoneTree.GetSelectedItem (); HTREEITEM hparent_item = m_BoneTree.GetParentItem (htree_item); - htree_item = (hparent_item != NULL) ? hparent_item : htree_item; - if (htree_item != NULL) { + htree_item = (hparent_item != nullptr) ? hparent_item : htree_item; + if (htree_item != nullptr) { // Loop through all the children of this bone for (HTREEITEM hchild_item = m_BoneTree.GetChildItem (htree_item); - (hchild_item != NULL) && (retval == false); + (hchild_item != nullptr) && (retval == false); hchild_item = m_BoneTree.GetNextSiblingItem (hchild_item)) { // Is this the render object we were looking for? @@ -354,7 +354,7 @@ BoneMgrDialogClass::Update_Controls (HTREEITEM selected_item) { // Get the name of the currently selected item CString name = m_BoneTree.GetItemText (selected_item); - bool bis_bone = (m_BoneTree.GetParentItem (selected_item) == NULL); + bool bis_bone = (m_BoneTree.GetParentItem (selected_item) == nullptr); // Did the user select a bone name? if (bis_bone) { @@ -388,7 +388,7 @@ BoneMgrDialogClass::OnDestroy (void) { // Free the state image list we associated with the control CImageList *pimagelist = m_BoneTree.GetImageList (TVSIL_NORMAL); - m_BoneTree.SetImageList (NULL, TVSIL_NORMAL); + m_BoneTree.SetImageList (nullptr, TVSIL_NORMAL); SAFE_DELETE (pimagelist); // Allow the base class to process this message @@ -456,7 +456,7 @@ BoneMgrDialogClass::OnAttachButton (void) // Create an instance of the render object and attach it to the bone RenderObjClass *prender_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (name); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { m_pBaseModel->Add_Sub_Object_To_Bone (prender_obj, m_BoneName); m_BoneTree.InsertItem (name, 1, 1, hbone_item); REF_PTR_RELEASE (prender_obj); @@ -472,7 +472,7 @@ BoneMgrDialogClass::OnAttachButton (void) // Is this the subobject we were looking for? RenderObjClass *psub_obj = m_pBaseModel->Get_Sub_Object_On_Bone (index, bone_index); - if ((psub_obj != NULL) && + if ((psub_obj != nullptr) && (::lstrcmpi (psub_obj->Get_Name (), name) == 0)) { // Remove this subobject from the bone @@ -489,7 +489,7 @@ BoneMgrDialogClass::OnAttachButton (void) } // Refresh the UI state - m_BoneTree.InvalidateRect (NULL, TRUE); + m_BoneTree.InvalidateRect (nullptr, TRUE); m_BoneTree.UpdateWindow (); Update_Controls (hbone_item); return ; @@ -508,7 +508,7 @@ BoneMgrDialogClass::Get_Current_Bone_Item (void) HTREEITEM hparent_item = m_BoneTree.GetParentItem (htree_item); // Return the bone item - return (hparent_item != NULL) ? hparent_item : htree_item; + return (hparent_item != nullptr) ? hparent_item : htree_item; } @@ -525,7 +525,7 @@ BoneMgrDialogClass::Remove_Object_From_Bone { // Loop through all the children of this bone for (HTREEITEM hchild_item = m_BoneTree.GetChildItem (bone_item); - (hchild_item != NULL); + (hchild_item != nullptr); hchild_item = m_BoneTree.GetNextSiblingItem (hchild_item)) { // Is this the render object we were looking for? diff --git a/Core/Tools/W3DView/BoneMgrDialog.h b/Core/Tools/W3DView/BoneMgrDialog.h index 33da2141434..b5b6adafaae 100644 --- a/Core/Tools/W3DView/BoneMgrDialog.h +++ b/Core/Tools/W3DView/BoneMgrDialog.h @@ -37,7 +37,7 @@ class BoneMgrDialogClass : public CDialog { // Construction public: - BoneMgrDialogClass (RenderObjClass *prender_obj, CWnd* pParent = NULL); + BoneMgrDialogClass (RenderObjClass *prender_obj, CWnd* pParent = nullptr); // Dialog Data //{{AFX_DATA(BoneMgrDialogClass) diff --git a/Core/Tools/W3DView/CameraDistanceDialog.cpp b/Core/Tools/W3DView/CameraDistanceDialog.cpp index 7064f0f35be..1c8b6b3a510 100644 --- a/Core/Tools/W3DView/CameraDistanceDialog.cpp +++ b/Core/Tools/W3DView/CameraDistanceDialog.cpp @@ -38,7 +38,7 @@ static char THIS_FILE[] = __FILE__; // CameraDistanceDialogClass // ///////////////////////////////////////////////////////////////////////////// -CameraDistanceDialogClass::CameraDistanceDialogClass(CWnd* pParent /*=NULL*/) +CameraDistanceDialogClass::CameraDistanceDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(CameraDistanceDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(CameraDistanceDialogClass) @@ -122,7 +122,7 @@ CameraDistanceDialogClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/CameraDistanceDialog.h b/Core/Tools/W3DView/CameraDistanceDialog.h index ffde9e0757a..9fb2f377479 100644 --- a/Core/Tools/W3DView/CameraDistanceDialog.h +++ b/Core/Tools/W3DView/CameraDistanceDialog.h @@ -29,7 +29,7 @@ class CameraDistanceDialogClass : public CDialog { // Construction public: - CameraDistanceDialogClass(CWnd* pParent = NULL); // standard constructor + CameraDistanceDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CameraDistanceDialogClass) diff --git a/Core/Tools/W3DView/CameraSettingsDialog.cpp b/Core/Tools/W3DView/CameraSettingsDialog.cpp index 31c2a6b50a0..5106424e8ba 100644 --- a/Core/Tools/W3DView/CameraSettingsDialog.cpp +++ b/Core/Tools/W3DView/CameraSettingsDialog.cpp @@ -41,7 +41,7 @@ static char THIS_FILE[] = __FILE__; // CameraSettingsDialogClass // ///////////////////////////////////////////////////////////////////////////// -CameraSettingsDialogClass::CameraSettingsDialogClass(CWnd* pParent /*=NULL*/) +CameraSettingsDialogClass::CameraSettingsDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(CameraSettingsDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(CameraSettingsDialogClass) @@ -179,7 +179,7 @@ CameraSettingsDialogClass::OnOK (void) // Refresh the camera settings // RenderObjClass *render_obj = doc->GetDisplayedObject (); - if (render_obj != NULL) { + if (render_obj != nullptr) { graphic_view->Reset_Camera_To_Display_Object (*render_obj); } @@ -241,7 +241,7 @@ CameraSettingsDialogClass::OnReset (void) graphic_view->Reset_FOV (); RenderObjClass *render_obj = doc->GetDisplayedObject (); - if (render_obj != NULL) { + if (render_obj != nullptr) { graphic_view->Reset_Camera_To_Display_Object (*render_obj); } @@ -289,7 +289,7 @@ CameraSettingsDialogClass::OnNotify // Update the spinner control if necessary // NMHDR *header = (NMHDR *)lParam; - if ((header != NULL) && (header->code == UDN_DELTAPOS)) { + if ((header != nullptr) && (header->code == UDN_DELTAPOS)) { LPNMUPDOWN updown_info = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (header->hwndFrom, updown_info->iDelta); diff --git a/Core/Tools/W3DView/CameraSettingsDialog.h b/Core/Tools/W3DView/CameraSettingsDialog.h index bd94ce278fc..15d96dae8ba 100644 --- a/Core/Tools/W3DView/CameraSettingsDialog.h +++ b/Core/Tools/W3DView/CameraSettingsDialog.h @@ -28,7 +28,7 @@ class CameraSettingsDialogClass : public CDialog { // Construction public: - CameraSettingsDialogClass(CWnd* pParent = NULL); // standard constructor + CameraSettingsDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CameraSettingsDialogClass) diff --git a/Core/Tools/W3DView/ColorBar.cpp b/Core/Tools/W3DView/ColorBar.cpp index 38ec40b1bd1..f77b56415b1 100644 --- a/Core/Tools/W3DView/ColorBar.cpp +++ b/Core/Tools/W3DView/ColorBar.cpp @@ -43,16 +43,16 @@ static char THIS_FILE[] = __FILE__; // ColorBarClass // ColorBarClass::ColorBarClass (void) - : m_hBitmap (NULL), + : m_hBitmap (nullptr), m_iBMPWidth (0), m_iBMPHeight (0), - m_pBits (NULL), - m_hMemDC (NULL), + m_pBits (nullptr), + m_hMemDC (nullptr), m_iColorPoints (0), m_iMarkerWidth (0), m_iMarkerHeight (0), - m_KeyFrameDIB (NULL), - m_pKeyFrameBits (NULL), + m_KeyFrameDIB (nullptr), + m_pKeyFrameBits (nullptr), m_iCurrentKey (0), m_MinPos (0), m_MaxPos (1), @@ -124,9 +124,9 @@ ColorBarClass::ColorBarClass (void) // ColorBarClass::~ColorBarClass (void) { - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { ::DeleteObject (m_hMemDC); - m_hMemDC = NULL; + m_hMemDC = nullptr; } Free_Marker_Bitmap (); @@ -170,7 +170,7 @@ RegisterColorBar (HINSTANCE hinst) wndclass.lpfnWndProc = fnColorBarProc; wndclass.hInstance = hinst; wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); - wndclass.hCursor = ::LoadCursor (NULL, IDC_ARROW); + wndclass.hCursor = ::LoadCursor (nullptr, IDC_ARROW); wndclass.lpszClassName = "WWCOLORBAR"; // Let the windows manager know about this global class @@ -199,12 +199,12 @@ fnColorBarProc case WM_CREATE: { LPCREATESTRUCT pcreate_info = (LPCREATESTRUCT)lparam; - if (pcreate_info != NULL) { + if (pcreate_info != nullptr) { // Should we create a new class manager for this window? ColorBarClass *pwnd = (ColorBarClass *)pcreate_info->lpCreateParams; BOOL created = FALSE; - if (pwnd == NULL) { + if (pwnd == nullptr) { pwnd = new ColorBarClass; created = TRUE; } @@ -218,7 +218,7 @@ fnColorBarProc WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr (); if (pOldWndProc) { WNDPROC pold_proc = (WNDPROC)::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)::AfxGetAfxWndProc ()); - ASSERT (pold_proc != NULL); + ASSERT (pold_proc != nullptr); (*pOldWndProc) = pold_proc; } @@ -235,18 +235,18 @@ fnColorBarProc ColorBarClass *pwnd = (ColorBarClass *)::GetProp (hwnd, "CLASSPOINTER"); BOOL created = (BOOL)::GetProp (hwnd, "CREATED"); - if (pwnd != NULL) { + if (pwnd != nullptr) { pwnd->Detach (); WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr (); if (pOldWndProc) { ::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)(*pOldWndProc)); - (*pOldWndProc) = NULL; + (*pOldWndProc) = nullptr; } if (created) { delete pwnd; - pwnd = NULL; + pwnd = nullptr; } } } @@ -268,7 +268,7 @@ ColorBarClass::OnCreate (LPCREATESTRUCT lpCreateStruct) if (CWnd::OnCreate (lpCreateStruct) == -1) return -1; - m_hMemDC = ::CreateCompatibleDC (NULL); + m_hMemDC = ::CreateCompatibleDC (nullptr); Create_Bitmap (); return 0; } @@ -291,7 +291,7 @@ ColorBarClass::Create ) { // Create the window (it will force the message map and everthing) - HWND hparent_wnd = (pparent_wnd != NULL) ? pparent_wnd->m_hWnd : NULL; + HWND hparent_wnd = (pparent_wnd != nullptr) ? pparent_wnd->m_hWnd : nullptr; HWND hwnd = ::CreateWindow ("WWCOLORBAR", lpszWindowName, dwStyle, @@ -305,7 +305,7 @@ ColorBarClass::Create this); // Return the true/false result code - return (hwnd != NULL); + return (hwnd != nullptr); } @@ -377,18 +377,18 @@ ColorBarClass::Create_Bitmap (void) bitmap_info.biClrImportant = 0; // Get a temporary screen DC - HDC hscreen_dc = ::GetDC (NULL); + HDC hscreen_dc = ::GetDC (nullptr); // Create a bitmap that we can access the bits directly of m_hBitmap = ::CreateDIBSection (hscreen_dc, (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)&m_pBits, - NULL, + nullptr, 0L); // Release our temporary screen DC - ::ReleaseDC (NULL, hscreen_dc); + ::ReleaseDC (nullptr, hscreen_dc); // Window's bitmaps are DWORD aligned, so make sure // we take that into account. @@ -409,10 +409,10 @@ ColorBarClass::Create_Bitmap (void) void ColorBarClass::Free_Bitmap (void) { - if (m_hBitmap != NULL) { + if (m_hBitmap != nullptr) { ::DeleteObject (m_hBitmap); - m_hBitmap = NULL; - m_pBits = NULL; + m_hBitmap = nullptr; + m_pBits = nullptr; } m_iBMPWidth = 0; @@ -675,7 +675,7 @@ ColorBarClass::Paint_DIB (void) // int x_pos = 0; int y_pos = 0; - int *position = NULL; + int *position = nullptr; int offset = 0; if (style & CBRS_HORZ) { @@ -736,7 +736,7 @@ ColorBarClass::OnPaint (void) void ColorBarClass::Paint_Screen (HDC hwnd_dc) { - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { // // Blit the actual color bar to the screen @@ -808,22 +808,22 @@ ColorBarClass::Get_Point if ((index >= 0) && (index < m_iColorPoints)) { // Return the position to the caller if requested - if (position != NULL) { + if (position != nullptr) { (*position) = m_MinPos + (m_ColorPoints[index].PosPercent * (m_MaxPos - m_MinPos)); } // Return the red value to the caller if requested - if (red != NULL) { + if (red != nullptr) { (*red) = m_ColorPoints[index].StartRed; } // Return the green value to the caller if requested - if (green != NULL) { + if (green != nullptr) { (*green) = m_ColorPoints[index].StartGreen; } // Return the blue value to the caller if requested - if (blue != NULL) { + if (blue != nullptr) { (*blue) = m_ColorPoints[index].StartBlue; } } @@ -1141,10 +1141,10 @@ ColorBarClass::Update_Point_Info (void) void ColorBarClass::Free_Marker_Bitmap (void) { - if (m_KeyFrameDIB != NULL) { + if (m_KeyFrameDIB != nullptr) { ::DeleteObject (m_KeyFrameDIB); - m_KeyFrameDIB = NULL; - m_pKeyFrameBits = NULL; + m_KeyFrameDIB = nullptr; + m_pKeyFrameBits = nullptr; } return ; @@ -1164,7 +1164,7 @@ ColorBarClass::Load_Key_Frame_BMP (void) // Load the appropriate BMP based on the barstyle // LONG style = ::GetWindowLong (m_hWnd, GWL_STYLE); - HBITMAP hbmp = NULL; + HBITMAP hbmp = nullptr; if (style & CBRS_HORZ) { hbmp = ::LoadBitmap (::AfxGetResourceHandle (), MAKEINTRESOURCE (IDB_KEYFRAME_V)); } else { @@ -1195,21 +1195,21 @@ ColorBarClass::Load_Key_Frame_BMP (void) bitmap_info.biClrImportant = 0; // Get a temporary screen DC - HDC hscreen_dc = ::GetDC (NULL); + HDC hscreen_dc = ::GetDC (nullptr); // Create a bitmap that we can access the bits directly of m_KeyFrameDIB = ::CreateDIBSection (hscreen_dc, (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)&m_pKeyFrameBits, - NULL, + nullptr, 0L); // Release our temporary screen DC - ::ReleaseDC (NULL, hscreen_dc); + ::ReleaseDC (nullptr, hscreen_dc); // Initialize 2 temp DCs so we can copy from the BMP to the DIB section - HDC htemp_dc = ::CreateCompatibleDC (NULL); + HDC htemp_dc = ::CreateCompatibleDC (nullptr); HBITMAP hold_bmp1 = (HBITMAP)::SelectObject (m_hMemDC, m_KeyFrameDIB); HBITMAP hold_bmp2 = (HBITMAP)::SelectObject (htemp_dc, hbmp); @@ -1239,7 +1239,7 @@ ColorBarClass::Paint_Key_Frame (int x_pos, int y_pos) int marker_scanline = (m_iMarkerWidth * 3) + alignment_offset; int width_in_bytes = m_iMarkerWidth * 3; - if ((m_pBits != NULL) && (m_pKeyFrameBits != NULL)) { + if ((m_pBits != nullptr) && (m_pKeyFrameBits != nullptr)) { int dest_index = (m_iScanlineSize * y_pos) + (x_pos * 3); int src_index = 0; @@ -1507,7 +1507,7 @@ ColorBarClass::Send_Notification (int code, int key) // Fill in the nofitication structure // LONG id = ::GetWindowLong (m_hWnd, GWL_ID); - CBR_NMHDR notify_hdr = { 0 }; + CBR_NMHDR notify_hdr = { nullptr }; notify_hdr.hdr.hwndFrom = m_hWnd; notify_hdr.hdr.idFrom = id; notify_hdr.hdr.code = code; @@ -1707,7 +1707,7 @@ ColorBarClass::Move_Selection (float new_pos, bool send_notify) // if (send_notify) { LONG id = ::GetWindowLong (m_hWnd, GWL_ID); - CBR_NMHDR notify_hdr = { 0 }; + CBR_NMHDR notify_hdr = { nullptr }; notify_hdr.hdr.hwndFrom = m_hWnd; notify_hdr.hdr.idFrom = id; notify_hdr.hdr.code = CBRN_SEL_CHANGED; @@ -1926,7 +1926,7 @@ ColorBarClass::Set_Redraw (bool redraw) void ColorBarClass::Repaint (void) { - InvalidateRect (NULL, FALSE); + InvalidateRect (nullptr, FALSE); if (m_bRedraw) { UpdateWindow (); } diff --git a/Core/Tools/W3DView/ColorBar.h b/Core/Tools/W3DView/ColorBar.h index a1efce422d8..595eb26bbf9 100644 --- a/Core/Tools/W3DView/ColorBar.h +++ b/Core/Tools/W3DView/ColorBar.h @@ -103,7 +103,7 @@ class ColorBarClass : public CWnd // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ColorBarClass) public: - virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); + virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = nullptr); //}}AFX_VIRTUAL // Implementation diff --git a/Core/Tools/W3DView/ColorPicker.cpp b/Core/Tools/W3DView/ColorPicker.cpp index ca4e95f7006..fdffa37a9c5 100644 --- a/Core/Tools/W3DView/ColorPicker.cpp +++ b/Core/Tools/W3DView/ColorPicker.cpp @@ -44,14 +44,14 @@ static char THIS_FILE[] = __FILE__; // ColorPickerClass // ColorPickerClass::ColorPickerClass (void) - : m_hBitmap (NULL), + : m_hBitmap (nullptr), m_iWidth (0), m_iHeight (0), m_CurrentPoint (0, 0), m_CurrentColor (0), m_bSelecting (false), - m_pBits (NULL), - m_hMemDC (NULL), + m_pBits (nullptr), + m_hMemDC (nullptr), m_CurrentHue (0), CWnd () { @@ -65,9 +65,9 @@ ColorPickerClass::ColorPickerClass (void) // ColorPickerClass::~ColorPickerClass (void) { - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { ::DeleteObject (m_hMemDC); - m_hMemDC = NULL; + m_hMemDC = nullptr; } Free_Bitmap (); @@ -97,7 +97,7 @@ ColorPickerClass::OnPaint (void) { CPaintDC dc (this); - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, m_hBitmap); @@ -132,7 +132,7 @@ RegisterColorPicker (HINSTANCE hinst) wndclass.lpfnWndProc = fnColorPickerProc; wndclass.hInstance = hinst; wndclass.hbrBackground = (HBRUSH)COLOR_3DFACE + 1; - wndclass.hCursor = ::LoadCursor (NULL, IDC_ARROW); + wndclass.hCursor = ::LoadCursor (nullptr, IDC_ARROW); wndclass.lpszClassName = "WWCOLORPICKER"; // Let the windows manager know about this global class @@ -158,7 +158,7 @@ fnColorPickerProc LPARAM lparam ) { - //static ColorPickerClass *pwnd = NULL; + //static ColorPickerClass *pwnd = nullptr; //static bool bcreated = false; switch (message) @@ -166,12 +166,12 @@ fnColorPickerProc case WM_CREATE: { LPCREATESTRUCT pcreate_info = (LPCREATESTRUCT)lparam; - if (pcreate_info != NULL) { + if (pcreate_info != nullptr) { // Should we create a new class manager for this window? ColorPickerClass *pwnd = (ColorPickerClass *)pcreate_info->lpCreateParams; BOOL created = FALSE; - if (pwnd == NULL) { + if (pwnd == nullptr) { pwnd = new ColorPickerClass; created = TRUE; } @@ -185,7 +185,7 @@ fnColorPickerProc WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr (); if (pOldWndProc) { WNDPROC pold_proc = (WNDPROC)::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)::AfxGetAfxWndProc ()); - ASSERT (pold_proc != NULL); + ASSERT (pold_proc != nullptr); (*pOldWndProc) = pold_proc; } @@ -203,30 +203,30 @@ fnColorPickerProc WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr (); if (pOldWndProc) { ::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)(*pOldWndProc)); - (*pOldWndProc) = NULL; + (*pOldWndProc) = nullptr; } if (bcreated) { delete pwnd; - pwnd = NULL; + pwnd = nullptr; }*/ // Get the creation information from the window handle ColorPickerClass *pwnd = (ColorPickerClass *)::GetProp (hwnd, "CLASSPOINTER"); BOOL created = (BOOL)::GetProp (hwnd, "CREATED"); - if (pwnd != NULL) { + if (pwnd != nullptr) { pwnd->Detach (); WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr (); if (pOldWndProc) { ::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)(*pOldWndProc)); - (*pOldWndProc) = NULL; + (*pOldWndProc) = nullptr; } if (created) { delete pwnd; - pwnd = NULL; + pwnd = nullptr; } } } @@ -249,7 +249,7 @@ ColorPickerClass::OnCreate (LPCREATESTRUCT lpCreateStruct) if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; - m_hMemDC = ::CreateCompatibleDC (NULL); + m_hMemDC = ::CreateCompatibleDC (nullptr); Create_Bitmap (); return 0; } @@ -273,7 +273,7 @@ ColorPickerClass::Create ) { // Create the window (it will force the message map and everthing) - HWND hparent_wnd = (pparent_wnd != NULL) ? pparent_wnd->m_hWnd : NULL; + HWND hparent_wnd = (pparent_wnd != nullptr) ? pparent_wnd->m_hWnd : nullptr; HWND hwnd = ::CreateWindow ("WWCOLORPICKER", lpszWindowName, dwStyle, @@ -287,7 +287,7 @@ ColorPickerClass::Create this); // Return the true/false result code - return (hwnd != NULL); + return (hwnd != nullptr); } @@ -322,18 +322,18 @@ ColorPickerClass::Create_Bitmap (void) bitmap_info.biClrImportant = 0; // Get a temporary screen DC - HDC hscreen_dc = ::GetDC (NULL); + HDC hscreen_dc = ::GetDC (nullptr); // Create a bitmap that we can access the bits directly of m_hBitmap = ::CreateDIBSection (hscreen_dc, (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)&m_pBits, - NULL, + nullptr, 0L); // Release our temporary screen DC - ::ReleaseDC (NULL, hscreen_dc); + ::ReleaseDC (nullptr, hscreen_dc); // Paint the color range into this bitmap Paint_DIB (m_iWidth, m_iHeight, m_pBits); @@ -695,10 +695,10 @@ ColorPickerClass::Paint_DIB void ColorPickerClass::Free_Bitmap (void) { - if (m_hBitmap != NULL) { + if (m_hBitmap != nullptr) { ::DeleteObject (m_hBitmap); - m_hBitmap = NULL; - m_pBits = NULL; + m_hBitmap = nullptr; + m_pBits = nullptr; } m_iWidth = 0; @@ -775,7 +775,7 @@ ColorPickerClass::OnLButtonDown // one of the keyframes // LONG id = ::GetWindowLong (m_hWnd, GWL_ID); - CP_NMHDR notify_hdr = { 0 }; + CP_NMHDR notify_hdr = { nullptr }; notify_hdr.hdr.hwndFrom = m_hWnd; notify_hdr.hdr.idFrom = id; notify_hdr.hdr.code = CPN_COLORCHANGE; @@ -809,7 +809,7 @@ ColorPickerClass::OnLButtonUp ) { if (m_bSelecting) { - ::ClipCursor (NULL); + ::ClipCursor (nullptr); ReleaseCapture (); m_bSelecting = false; } @@ -843,7 +843,7 @@ ColorPickerClass::OnMouseMove // one of the keyframes // LONG id = ::GetWindowLong (m_hWnd, GWL_ID); - CP_NMHDR notify_hdr = { 0 }; + CP_NMHDR notify_hdr = { nullptr }; notify_hdr.hdr.hwndFrom = m_hWnd; notify_hdr.hdr.idFrom = id; notify_hdr.hdr.code = CPN_COLORCHANGE; @@ -896,7 +896,7 @@ void ColorPickerClass::Erase_Marker (void) { HDC hdc = ::GetDC (m_hWnd); - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, m_hBitmap); @@ -929,7 +929,7 @@ void ColorPickerClass::Paint_Marker (void) { HDC hdc = ::GetDC (m_hWnd); - if (m_hMemDC != NULL) { + if (m_hMemDC != nullptr) { HBITMAP hmarker_bmp = ::LoadBitmap (::AfxGetResourceHandle (), MAKEINTRESOURCE (IDB_MARKER)); HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, hmarker_bmp); @@ -968,7 +968,7 @@ ColorPickerClass::Select_Color (int red, int green, int blue) m_CurrentColor = Color_From_Point (m_CurrentPoint.x, m_CurrentPoint.y); // Refresh the window - InvalidateRect (NULL, FALSE); + InvalidateRect (nullptr, FALSE); UpdateWindow (); return ; } diff --git a/Core/Tools/W3DView/ColorPicker.h b/Core/Tools/W3DView/ColorPicker.h index 6d4941b0a1b..35f96ee6c8f 100644 --- a/Core/Tools/W3DView/ColorPicker.h +++ b/Core/Tools/W3DView/ColorPicker.h @@ -77,7 +77,7 @@ class ColorPickerClass : public CWnd // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(ColorPickerClass) public: - virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); + virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = nullptr); //}}AFX_VIRTUAL // Implementation diff --git a/Core/Tools/W3DView/ColorPickerDialogClass.cpp b/Core/Tools/W3DView/ColorPickerDialogClass.cpp index 554595a4ad7..874aab91248 100644 --- a/Core/Tools/W3DView/ColorPickerDialogClass.cpp +++ b/Core/Tools/W3DView/ColorPickerDialogClass.cpp @@ -82,7 +82,7 @@ Get_Form_Color (HWND form_wnd, int *red, int *green, int *blue) BOOL retval = FALSE; ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS"); - if (dialog != NULL) { + if (dialog != nullptr) { (*red) = dialog->Get_Red (); (*green) = dialog->Get_Green (); (*blue) = dialog->Get_Blue (); @@ -101,7 +101,7 @@ Set_Form_Color (HWND form_wnd, int red, int green, int blue) BOOL retval = FALSE; ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS"); - if (dialog != NULL) { + if (dialog != nullptr) { dialog->Set_Color (red, green, blue); retval = TRUE; } @@ -118,7 +118,7 @@ Set_Form_Original_Color (HWND form_wnd, int red, int green, int blue) BOOL retval = FALSE; ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS"); - if (dialog != NULL) { + if (dialog != nullptr) { dialog->Set_Original_Color (red, green, blue); retval = TRUE; } @@ -154,7 +154,7 @@ Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg) BOOL retval = FALSE; ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS"); - if (dialog != NULL) { + if (dialog != nullptr) { dialog->Set_Update_Callback(callback, arg); retval = TRUE; } @@ -181,15 +181,15 @@ ColorPickerDialogClass::ColorPickerDialogClass m_CurrentRed ((float)red), m_CurrentGreen ((float)green), m_CurrentBlue ((float)blue), - m_CurrentColorBar (NULL), - m_OrigColorBar (NULL), - m_RedColorBar (NULL), - m_GreenColorBar (NULL), - m_BlueColorBar (NULL), - m_WhitenessColorBar (NULL), - m_HuePicker (NULL), + m_CurrentColorBar (nullptr), + m_OrigColorBar (nullptr), + m_RedColorBar (nullptr), + m_GreenColorBar (nullptr), + m_BlueColorBar (nullptr), + m_WhitenessColorBar (nullptr), + m_HuePicker (nullptr), m_bDeleteOnClose (false), - m_UpdateCallback(NULL), + m_UpdateCallback(nullptr), CDialog(res_id, pParent) { //{{AFX_DATA_INIT(ColorPickerDialogClass) diff --git a/Core/Tools/W3DView/ColorPickerDialogClass.h b/Core/Tools/W3DView/ColorPickerDialogClass.h index 64f6ea6e971..4bc428d4665 100644 --- a/Core/Tools/W3DView/ColorPickerDialogClass.h +++ b/Core/Tools/W3DView/ColorPickerDialogClass.h @@ -39,7 +39,7 @@ class ColorPickerDialogClass : public CDialog { // Construction public: - ColorPickerDialogClass (int red, int green, int blue, CWnd* pParent = NULL, UINT res_id = ColorPickerDialogClass::IDD); + ColorPickerDialogClass (int red, int green, int blue, CWnd* pParent = nullptr, UINT res_id = ColorPickerDialogClass::IDD); // Dialog Data //{{AFX_DATA(ColorPickerDialogClass) diff --git a/Core/Tools/W3DView/ColorSelectionDialog.cpp b/Core/Tools/W3DView/ColorSelectionDialog.cpp index 7c5c78d1369..6a70810eb87 100644 --- a/Core/Tools/W3DView/ColorSelectionDialog.cpp +++ b/Core/Tools/W3DView/ColorSelectionDialog.cpp @@ -202,7 +202,7 @@ ColorSelectionDialogClass::Paint_Color_Window (void) m_ColorWindow.ReleaseDC (pdc); // Let the window know it doesn't need to be repainted - m_ColorWindow.ValidateRect (NULL); + m_ColorWindow.ValidateRect (nullptr); return; } diff --git a/Core/Tools/W3DView/ColorSelectionDialog.h b/Core/Tools/W3DView/ColorSelectionDialog.h index 3c42553ed3a..166c0ed70cd 100644 --- a/Core/Tools/W3DView/ColorSelectionDialog.h +++ b/Core/Tools/W3DView/ColorSelectionDialog.h @@ -33,7 +33,7 @@ class ColorSelectionDialogClass : public CDialog { // Construction public: - ColorSelectionDialogClass (const Vector3 &def_color, CWnd *pParent = NULL); // standard constructor + ColorSelectionDialogClass (const Vector3 &def_color, CWnd *pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ColorSelectionDialogClass) diff --git a/Core/Tools/W3DView/ColorUtils.h b/Core/Tools/W3DView/ColorUtils.h index 2a440aafe3f..4883a70f7be 100644 --- a/Core/Tools/W3DView/ColorUtils.h +++ b/Core/Tools/W3DView/ColorUtils.h @@ -42,6 +42,6 @@ HWND Create_Color_Picker_Form (HWND parent, int red, int green, int blue); BOOL Get_Form_Color (HWND form_wnd, int *red, int *green, int *blue); BOOL Set_Form_Color (HWND form_wnd, int red, int green, int blue); BOOL Set_Form_Original_Color (HWND form_wnd, int red, int green, int blue); -BOOL Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg=NULL); +BOOL Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg=nullptr); void RegisterColorPicker (HINSTANCE hinst); void RegisterColorBar (HINSTANCE hinst); diff --git a/Core/Tools/W3DView/DataTreeView.cpp b/Core/Tools/W3DView/DataTreeView.cpp index 1b5a31d1634..895cdc0bb1a 100644 --- a/Core/Tools/W3DView/DataTreeView.cpp +++ b/Core/Tools/W3DView/DataTreeView.cpp @@ -81,14 +81,14 @@ IMPLEMENT_DYNCREATE(CDataTreeView, CTreeView) // //////////////////////////////////////////////////////////////////////////// CDataTreeView::CDataTreeView (void) - : m_hMaterialsRoot (NULL), - m_hMeshRoot (NULL), - m_hMeshCollectionRoot (NULL), - m_hAggregateRoot (NULL), - m_hPrimitivesRoot (NULL), - m_hEmitterRoot (NULL), - m_hLODRoot (NULL), - m_hSoundRoot (NULL), + : m_hMaterialsRoot (nullptr), + m_hMeshRoot (nullptr), + m_hMeshCollectionRoot (nullptr), + m_hAggregateRoot (nullptr), + m_hPrimitivesRoot (nullptr), + m_hEmitterRoot (nullptr), + m_hLODRoot (nullptr), + m_hSoundRoot (nullptr), m_iPrimitivesIcon (-1), m_iAnimationIcon (-1), m_iTCAnimationIcon(-1), @@ -263,16 +263,16 @@ CDataTreeView::Load_Materials_Into_Tree (void) TextureClass* ptexture=ite.Peek_Value(); LPCTSTR texture_name = ptexture->Get_Texture_Name(); - if ((ptexture != NULL) && - FindChildItem (m_hMaterialsRoot, texture_name) == NULL) { + if ((ptexture != nullptr) && + FindChildItem (m_hMaterialsRoot, texture_name) == nullptr) { // Add this entry to the tree HTREEITEM tree_item = GetTreeCtrl ().InsertItem (texture_name, m_iMaterialIcon, m_iMaterialIcon, m_hMaterialsRoot, TVI_SORT); - ASSERT (tree_item != NULL); + ASSERT (tree_item != nullptr); // Allocate a new asset information class to associate with this entry ptexture->Add_Ref (); - AssetInfoClass *asset_info = new AssetInfoClass (texture_name, TypeMaterial, NULL, (DWORD)ptexture); + AssetInfoClass *asset_info = new AssetInfoClass (texture_name, TypeMaterial, nullptr, (DWORD)ptexture); GetTreeCtrl ().SetItemData (tree_item, (ULONG)asset_info); } } @@ -309,7 +309,7 @@ CDataTreeView::LoadAssetsIntoTree (void) if (WW3DAssetManager::Get_Instance()->Render_Obj_Exists (pszItemName)) { BOOL bInsert = FALSE; - HTREEITEM hParentNode = NULL; + HTREEITEM hParentNode = nullptr; ASSET_TYPE assetType = TypeUnknown; int iIconIndex = -1; @@ -393,11 +393,11 @@ CDataTreeView::LoadAssetsIntoTree (void) } // If this object isn't already in the tree then add it - if (FindChildItem (hParentNode, pszItemName) == NULL) { + if (FindChildItem (hParentNode, pszItemName) == nullptr) { // Add this entry to the tree HTREEITEM hItem = GetTreeCtrl ().InsertItem (pszItemName, iIconIndex, iIconIndex, hParentNode, TVI_SORT); - ASSERT (hItem != NULL); + ASSERT (hItem != nullptr); // Allocate a new asset information class to associate with this entry AssetInfoClass *asset_info = new AssetInfoClass (pszItemName, assetType); @@ -415,7 +415,7 @@ CDataTreeView::LoadAssetsIntoTree (void) // to the new HLOD format for (int index = 0; index < dist_lod_list.Count (); index ++) { HLodClass *plod = (HLodClass *)WW3DAssetManager::Get_Instance ()->Create_Render_Obj (dist_lod_list[index]); - if (plod != NULL) { + if (plod != nullptr) { HLodDefClass *definition = new HLodDefClass (*plod); HLodPrototypeClass *prototype = new HLodPrototypeClass (definition); WW3DAssetManager::Get_Instance ()->Remove_Prototype (dist_lod_list[index]); @@ -468,16 +468,16 @@ CDataTreeView::LoadAnimationsIntoTree (void) HTREEITEM hNode; // Loop through all the hierarchies and add this animation to any pertinent ones for (hNode = FindFirstChildItemBasedOnHierarchyName (m_hHierarchyRoot, pszHierarchyName); - (hNode != NULL); + (hNode != nullptr); hNode = FindSiblingItemBasedOnHierarchyName (hNode, pszHierarchyName)) { // Is this animation already loaded into the tree? HTREEITEM hAnimationNode = FindChildItem (hNode, pszAnimName); - if (hAnimationNode == NULL) + if (hAnimationNode == nullptr) { // Add this animation as a child of the hierarchy hAnimationNode = GetTreeCtrl ().InsertItem (pszAnimName, m_iAnimationIcon, m_iAnimationIcon, hNode, TVI_SORT); - ASSERT (hAnimationNode != NULL); + ASSERT (hAnimationNode != nullptr); // Associate the items name with its entry GetTreeCtrl ().SetItemData (hAnimationNode, (ULONG)new AssetInfoClass (pszAnimName, TypeAnimation)); @@ -486,16 +486,16 @@ CDataTreeView::LoadAnimationsIntoTree (void) // Loop through all the aggregates and add this animation to any pertinent ones for (hNode = FindFirstChildItemBasedOnHierarchyName (m_hAggregateRoot, pszHierarchyName); - (hNode != NULL); + (hNode != nullptr); hNode = FindSiblingItemBasedOnHierarchyName (hNode, pszHierarchyName)) { // Is this animation already loaded into the tree? HTREEITEM hAnimationNode = FindChildItem (hNode, pszAnimName); - if (hAnimationNode == NULL) + if (hAnimationNode == nullptr) { // Add this animation as a child of the hierarchy hAnimationNode = GetTreeCtrl ().InsertItem (pszAnimName, m_iAnimationIcon, m_iAnimationIcon, hNode, TVI_SORT); - ASSERT (hAnimationNode != NULL); + ASSERT (hAnimationNode != nullptr); // Associate the items name with its entry GetTreeCtrl ().SetItemData (hAnimationNode, (ULONG)new AssetInfoClass (pszAnimName, TypeAnimation)); @@ -504,16 +504,16 @@ CDataTreeView::LoadAnimationsIntoTree (void) // Loop through all the hierarchies and add this animation to any pertinent ones for (hNode = FindFirstChildItemBasedOnHierarchyName (m_hLODRoot, pszHierarchyName); - (hNode != NULL); + (hNode != nullptr); hNode = FindSiblingItemBasedOnHierarchyName (hNode, pszHierarchyName)) { // Is this animation already loaded into the tree? HTREEITEM hAnimationNode = FindChildItem (hNode, pszAnimName); - if (hAnimationNode == NULL) + if (hAnimationNode == nullptr) { // Add this animation as a child of the hierarchy hAnimationNode = GetTreeCtrl ().InsertItem (pszAnimName, m_iAnimationIcon, m_iAnimationIcon, hNode, TVI_SORT); - ASSERT (hAnimationNode != NULL); + ASSERT (hAnimationNode != nullptr); // Associate the items name with its entry GetTreeCtrl ().SetItemData (hAnimationNode, (ULONG)new AssetInfoClass (pszAnimName, TypeAnimation)); @@ -527,7 +527,7 @@ CDataTreeView::LoadAnimationsIntoTree (void) // Free the object delete pAnimEnum; - pAnimEnum = NULL; + pAnimEnum = nullptr; } return ; @@ -542,7 +542,7 @@ CDataTreeView::LoadAnimationsIntoTree (HTREEITEM hItem) { // Get the data associated with this item AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (hItem); - ASSERT (asset_info != NULL); + ASSERT (asset_info != nullptr); // Get an iterator from the asset manager that we can // use to enumerate the currently loaded assets @@ -571,11 +571,11 @@ CDataTreeView::LoadAnimationsIntoTree (HTREEITEM hItem) { // Is this animation already loaded into the tree? HTREEITEM hAnimationNode = FindChildItem (hItem, pszAnimName); - if (hAnimationNode == NULL) + if (hAnimationNode == nullptr) { // Add this animation as a child of the hierarchy hAnimationNode = GetTreeCtrl ().InsertItem (pszAnimName, m_iAnimationIcon, m_iAnimationIcon, hItem, TVI_SORT); - ASSERT (hAnimationNode != NULL); + ASSERT (hAnimationNode != nullptr); // Associate the items name with its entry GetTreeCtrl ().SetItemData (hAnimationNode, (ULONG)new AssetInfoClass (pszAnimName, TypeAnimation)); @@ -589,7 +589,7 @@ CDataTreeView::LoadAnimationsIntoTree (HTREEITEM hItem) // Free the object delete pAnimEnum; - pAnimEnum = NULL; + pAnimEnum = nullptr; } return ; @@ -669,7 +669,7 @@ CDataTreeView::Determine_Tree_Location // // Is this an aggregate? // - if (render_obj.Get_Base_Model_Name () != NULL) { + if (render_obj.Get_Base_Model_Name () != nullptr) { hroot = m_hAggregateRoot; type = TypeAggregate; icon_index = m_iAggregateIcon; @@ -753,20 +753,20 @@ CDataTreeView::Add_Asset_To_Tree bool retval = false; // Param OK? - ASSERT (name != NULL); - if (name != NULL) { + ASSERT (name != nullptr); + if (name != nullptr) { // Turn off repainting GetTreeCtrl ().SetRedraw (FALSE); // Determime where this asset should go - HTREEITEM hparent = NULL; + HTREEITEM hparent = nullptr; int icon_index = 0; Determine_Tree_Location (type, hparent, icon_index); // Is this asset already in the tree? HTREEITEM htree_item = FindChildItem (hparent, name); - if (htree_item == NULL) { + if (htree_item == nullptr) { // Add this object to the tree htree_item = GetTreeCtrl ().InsertItem (name, @@ -785,7 +785,7 @@ CDataTreeView::Add_Asset_To_Tree } // Success! - retval = (htree_item != NULL); + retval = (htree_item != nullptr); } // Select the instance (if requested) @@ -819,11 +819,11 @@ CDataTreeView::FindChildItem ) { // Assume we won't find the item - HTREEITEM hchild_item = NULL; + HTREEITEM hchild_item = nullptr; // Loop through all the children of this node for (HTREEITEM htree_item = GetTreeCtrl ().GetChildItem (hParentItem); - (htree_item != NULL) && (hchild_item == NULL); + (htree_item != nullptr) && (hchild_item == nullptr); htree_item = GetTreeCtrl ().GetNextSiblingItem (htree_item)) { // Get the data associated with this item @@ -856,11 +856,11 @@ CDataTreeView::FindChildItem ) { // Assume we won't find the item - HTREEITEM hChildItem = NULL; + HTREEITEM hChildItem = nullptr; // Loop through all the children of this node for (HTREEITEM hTreeItem = GetTreeCtrl ().GetChildItem (hParentItem); - (hTreeItem != NULL) && (hChildItem == NULL); + (hTreeItem != nullptr) && (hChildItem == nullptr); hTreeItem = GetTreeCtrl ().GetNextSiblingItem (hTreeItem)) { // Is this the child item we were looking for? @@ -888,12 +888,12 @@ CDataTreeView::FindSiblingItemBasedOnHierarchyName ) { // Assume we won't find the item - HTREEITEM hSiblingItem = NULL; + HTREEITEM hSiblingItem = nullptr; // Loop through all the siblings of this node HTREEITEM hTreeItem = hCurrentItem; - while (((hTreeItem = GetTreeCtrl ().GetNextSiblingItem (hTreeItem)) != NULL) && - (hSiblingItem == NULL)) + while (((hTreeItem = GetTreeCtrl ().GetNextSiblingItem (hTreeItem)) != nullptr) && + (hSiblingItem == nullptr)) { // Get the data associated with this item AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (hTreeItem); @@ -924,11 +924,11 @@ CDataTreeView::FindFirstChildItemBasedOnHierarchyName ) { // Assume we won't find the item - HTREEITEM hChildItem = NULL; + HTREEITEM hChildItem = nullptr; // Loop through all the children of this node for (HTREEITEM hTreeItem = GetTreeCtrl ().GetChildItem (hParentItem); - (hTreeItem != NULL) && (hChildItem == NULL); + (hTreeItem != nullptr) && (hChildItem == nullptr); hTreeItem = GetTreeCtrl ().GetNextSiblingItem (hTreeItem)) { // Get the data associated with this item @@ -977,24 +977,24 @@ CDataTreeView::OnSelChanged void CDataTreeView::Display_Asset (HTREEITEM htree_item) { - if (htree_item == NULL) { + if (htree_item == nullptr) { htree_item = GetTreeCtrl ().GetSelectedItem (); } // // Get the object associated with this entry // - AssetInfoClass *asset_info = NULL; - if (htree_item != NULL) { + AssetInfoClass *asset_info = nullptr; + if (htree_item != nullptr) { asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); } - if (asset_info != NULL) { + if (asset_info != nullptr) { // Get the current document, so we can get a pointer to the scene CW3DViewDoc *pdoc = (CW3DViewDoc *)GetDocument (); - ASSERT (pdoc != NULL); - if (pdoc != NULL) { + ASSERT (pdoc != nullptr); + if (pdoc != nullptr) { // What type of asset is it? switch (asset_info->Get_Type ()) @@ -1003,7 +1003,7 @@ CDataTreeView::Display_Asset (HTREEITEM htree_item) case TypeAnimation: { HTREEITEM hParentItem = GetTreeCtrl ().GetParentItem (htree_item); - if (hParentItem != NULL) { + if (hParentItem != nullptr) { // Ask the document to start playing the animation for this object RenderObjClass *prender_obj = Create_Render_Obj_To_Display (hParentItem); @@ -1042,7 +1042,7 @@ CDataTreeView::Display_Asset (HTREEITEM htree_item) // Get the main window of our app CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) { + if (pCMainWnd != nullptr) { // Let the main window know our selection type has changed pCMainWnd->OnSelectionChanged (asset_info->Get_Type ()); @@ -1064,12 +1064,12 @@ CDataTreeView::Display_Asset (HTREEITEM htree_item) // Reset the display CW3DViewDoc* pdoc = (CW3DViewDoc *)GetDocument (); - ASSERT (pdoc != NULL); - if (pdoc != NULL) { - pdoc->DisplayObject ((RenderObjClass *)NULL); + ASSERT (pdoc != nullptr); + if (pdoc != nullptr) { + pdoc->DisplayObject ((RenderObjClass *)nullptr); CMainFrame *main_wnd = (CMainFrame *)::AfxGetMainWnd (); - if (main_wnd != NULL) { + if (main_wnd != nullptr) { main_wnd->OnSelectionChanged (TypeUnknown); } } @@ -1104,7 +1104,7 @@ CDataTreeView::OnDeleteItem SAFE_DELETE (asset_info); // Reset the data associated with this entry - GetTreeCtrl ().SetItemData (pNMTreeView->itemOld.hItem, NULL); + GetTreeCtrl ().SetItemData (pNMTreeView->itemOld.hItem, 0); (*pResult) = 0; return ; } @@ -1117,11 +1117,11 @@ CDataTreeView::OnDeleteItem AssetInfoClass * CDataTreeView::Get_Current_Asset_Info (void) const { - AssetInfoClass *asset_info = NULL; + AssetInfoClass *asset_info = nullptr; // Get the currently selected node from the tree control HTREEITEM htree_item = GetTreeCtrl ().GetSelectedItem (); - if (htree_item != NULL) { + if (htree_item != nullptr) { // Get the data associated with this item asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); @@ -1139,15 +1139,15 @@ CDataTreeView::Get_Current_Asset_Info (void) const RenderObjClass * CDataTreeView::Get_Current_Render_Obj (void) const { - RenderObjClass *prender_obj = NULL; + RenderObjClass *prender_obj = nullptr; // Get the currently selected node from the tree control HTREEITEM htree_item = GetTreeCtrl ().GetSelectedItem (); - if (htree_item != NULL) { + if (htree_item != nullptr) { // Get the data associated with this item AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { // Return the render object pointer prender_obj = asset_info->Peek_Render_Obj (); @@ -1166,15 +1166,15 @@ CDataTreeView::Get_Current_Render_Obj (void) const LPCTSTR CDataTreeView::GetCurrentSelectionName (void) { - LPCTSTR pname = NULL; + LPCTSTR pname = nullptr; // Get the currently selected node from the tree control HTREEITEM htree_item = GetTreeCtrl ().GetSelectedItem (); - if (htree_item != NULL) { + if (htree_item != nullptr) { // Get the data associated with this item AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { // Return the name of the asset to the caller pname = asset_info->Get_Name (); @@ -1196,11 +1196,11 @@ CDataTreeView::GetCurrentSelectionType (void) // Get the currently selected node from the tree control HTREEITEM htree_item = GetTreeCtrl ().GetSelectedItem (); - if (htree_item != NULL) { + if (htree_item != nullptr) { // Get the associated asset information for this node. AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { type = asset_info->Get_Type (); } } @@ -1222,7 +1222,7 @@ CDataTreeView::OnDblclk { // Get the main window of our app CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) + if (pCMainWnd != nullptr) { // Display the properties for the currently selected object //pCMainWnd->ShowObjectProperties (); @@ -1246,12 +1246,12 @@ CDataTreeView::Build_Render_Object_List { // Loop through all the children of this node for (HTREEITEM htree_item = GetTreeCtrl ().GetChildItem (hparent); - (htree_item != NULL); + (htree_item != nullptr); htree_item = GetTreeCtrl ().GetNextSiblingItem (htree_item)) { // Determine if this is an asset type we want to add to the list AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if ((asset_info != NULL) && + if ((asset_info != nullptr) && (asset_info->Get_Type () != TypeAnimation) && (asset_info->Get_Type () != TypeCompressedAnimation) && (asset_info->Get_Type () != TypeMaterial)) @@ -1278,18 +1278,18 @@ RenderObjClass * CDataTreeView::Create_Render_Obj_To_Display (HTREEITEM htree_item) { // Lookup the information object associated with this asset - RenderObjClass *render_obj = NULL; + RenderObjClass *render_obj = nullptr; AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { // Use the asset's instance if there is one, otherwise attempt to create one render_obj = asset_info->Get_Render_Obj (); - if (render_obj == NULL) { + if (render_obj == nullptr) { // If this is a texture, then create a special BMP obj from it if (asset_info->Get_Type () == TypeMaterial) { TextureClass *ptexture = (TextureClass *)asset_info->Get_User_Number (); - if (ptexture != NULL) { + if (ptexture != nullptr) { render_obj = new Bitmap2DObjClass (ptexture, 0.5F, 0.5F, true, false, false, true); } } @@ -1297,7 +1297,7 @@ CDataTreeView::Create_Render_Obj_To_Display (HTREEITEM htree_item) // // Finally, if we aren't successful, create a new instance based on its name // - if (render_obj == NULL) { + if (render_obj == nullptr) { render_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (asset_info->Get_Name ()); } } @@ -1306,7 +1306,7 @@ CDataTreeView::Create_Render_Obj_To_Display (HTREEITEM htree_item) // // Force the highest level LOD // - if ( render_obj != NULL && + if ( render_obj != nullptr && ::GetCurrentDocument ()->GetScene ()->Are_LODs_Switching () == false) { Set_Highest_LOD (render_obj); @@ -1329,26 +1329,26 @@ CDataTreeView::Refresh_Asset ) { // Params OK? - if ((new_name != NULL) && (old_name != NULL)) { + if ((new_name != nullptr) && (old_name != nullptr)) { // Turn off repainting GetTreeCtrl ().SetRedraw (FALSE); // Determime where this asset should go - HTREEITEM hparent = NULL; + HTREEITEM hparent = nullptr; int icon_index = 0; Determine_Tree_Location (type, hparent, icon_index); // Can we find the item we are supposed to refresh? HTREEITEM htree_item = FindChildItem (hparent, old_name); - if (htree_item != NULL) { + if (htree_item != nullptr) { // Refresh the item's text in the tree control GetTreeCtrl ().SetItemText (htree_item, new_name); // Refresh the associated asset info structure AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (htree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { asset_info->Set_Name (new_name); } } else { @@ -1380,13 +1380,13 @@ CDataTreeView::Select_Next (void) // Get the selected entry in the tree control // HTREEITEM hselected = GetTreeCtrl ().GetSelectedItem (); - if (hselected != NULL) { + if (hselected != nullptr) { // // Select the item that follows the currently selected item // HTREEITEM hitem = GetTreeCtrl ().GetNextItem (hselected, TVGN_NEXT); - if (hitem != NULL) { + if (hitem != nullptr) { GetTreeCtrl ().SelectItem (hitem); } } @@ -1406,13 +1406,13 @@ CDataTreeView::Select_Prev (void) // Get the selected entry in the tree control // HTREEITEM hselected = GetTreeCtrl ().GetSelectedItem (); - if (hselected != NULL) { + if (hselected != nullptr) { // // Select the item that follows the currently selected item // HTREEITEM hitem = GetTreeCtrl ().GetNextItem (hselected, TVGN_PREVIOUS); - if (hitem != NULL) { + if (hitem != nullptr) { GetTreeCtrl ().SelectItem (hitem); } } @@ -1448,14 +1448,14 @@ CDataTreeView::Free_Child_Models (HTREEITEM parent_item) // Loop through all the children of this node // for ( HTREEITEM tree_item = GetTreeCtrl ().GetChildItem (parent_item); - tree_item != NULL; + tree_item != nullptr; tree_item = GetTreeCtrl ().GetNextSiblingItem (tree_item)) { // // Get the data associated with this item // AssetInfoClass *asset_info = (AssetInfoClass *)GetTreeCtrl ().GetItemData (tree_item); - if (asset_info != NULL) { + if (asset_info != nullptr) { WW3DAssetManager::Get_Instance ()->Remove_Prototype (asset_info->Get_Name ()); } } @@ -1472,10 +1472,10 @@ CDataTreeView::Free_Child_Models (HTREEITEM parent_item) void Set_Highest_LOD (RenderObjClass *render_obj) { - if (render_obj != NULL) { + if (render_obj != nullptr) { for (int index = 0; index < render_obj->Get_Num_Sub_Objects (); index ++) { RenderObjClass *sub_obj = render_obj->Get_Sub_Object (index); - if (sub_obj != NULL) { + if (sub_obj != nullptr) { Set_Highest_LOD (sub_obj); } REF_PTR_RELEASE (sub_obj); diff --git a/Core/Tools/W3DView/DataTreeView.h b/Core/Tools/W3DView/DataTreeView.h index 2882cf719b4..a060943a31f 100644 --- a/Core/Tools/W3DView/DataTreeView.h +++ b/Core/Tools/W3DView/DataTreeView.h @@ -104,7 +104,7 @@ class CDataTreeView : public CTreeView // // Display methods // - void Display_Asset (HTREEITEM htree_item = NULL); + void Display_Asset (HTREEITEM htree_item = nullptr); void Select_Next (void); void Select_Prev (void); void Reload_Lightmap_Models (void); diff --git a/Core/Tools/W3DView/DeviceSelectionDialog.cpp b/Core/Tools/W3DView/DeviceSelectionDialog.cpp index fb5d7dd5275..8c0af94d1d7 100644 --- a/Core/Tools/W3DView/DeviceSelectionDialog.cpp +++ b/Core/Tools/W3DView/DeviceSelectionDialog.cpp @@ -45,7 +45,7 @@ static char THIS_FILE[] = __FILE__; CDeviceSelectionDialog::CDeviceSelectionDialog ( BOOL bLookupCachedInfo, - CWnd* pParent /*=NULL*/ + CWnd* pParent /*=nullptr*/ ) : m_iDeviceIndex (1), m_iBitsPerPixel (16), diff --git a/Core/Tools/W3DView/DeviceSelectionDialog.h b/Core/Tools/W3DView/DeviceSelectionDialog.h index 18d67c60ca5..c62f0380b84 100644 --- a/Core/Tools/W3DView/DeviceSelectionDialog.h +++ b/Core/Tools/W3DView/DeviceSelectionDialog.h @@ -28,7 +28,7 @@ class CDeviceSelectionDialog : public CDialog { // Construction public: - CDeviceSelectionDialog(BOOL bLookupCachedInfo = TRUE, CWnd* pParent = NULL); // standard constructor + CDeviceSelectionDialog(BOOL bLookupCachedInfo = TRUE, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CDeviceSelectionDialog) diff --git a/Core/Tools/W3DView/DirectoryDialog.cpp b/Core/Tools/W3DView/DirectoryDialog.cpp index efa0cf6c38b..a542bdac8c9 100644 --- a/Core/Tools/W3DView/DirectoryDialog.cpp +++ b/Core/Tools/W3DView/DirectoryDialog.cpp @@ -78,7 +78,7 @@ Browse_For_Folder (HWND parent_wnd, LPCTSTR initial_path, CString &path) { bool retval = false; - OPENFILENAME openfilename = { sizeof (OPENFILENAME), 0 }; + OPENFILENAME openfilename = { sizeof (OPENFILENAME), nullptr }; TCHAR filename[MAX_PATH] = { 0 }; openfilename.lpstrInitialDir = initial_path; diff --git a/Core/Tools/W3DView/EditLODDialog.cpp b/Core/Tools/W3DView/EditLODDialog.cpp index f00c487d6fa..a8e46a3fefc 100644 --- a/Core/Tools/W3DView/EditLODDialog.cpp +++ b/Core/Tools/W3DView/EditLODDialog.cpp @@ -47,7 +47,7 @@ const int COL_SWITCH_DN = 2; // // CEditLODDialog // -CEditLODDialog::CEditLODDialog(CWnd* pParent /*=NULL*/) +CEditLODDialog::CEditLODDialog(CWnd* pParent /*=nullptr*/) : m_spinIncrement (0.5F), CDialog(CEditLODDialog::IDD, pParent) { @@ -117,7 +117,7 @@ CEditLODDialog::OnInitDialog (void) m_hierarchyListCtrl.InsertColumn (COL_SWITCH_DN, "Switch Down"); RenderObjClass *pfirst_subobj = pLOD->Get_Sub_Object (0); - if (pfirst_subobj != NULL) { + if (pfirst_subobj != nullptr) { m_spinIncrement = pfirst_subobj->Get_Bounding_Sphere ().Radius / 5.0F; REF_PTR_RELEASE (pfirst_subobj); } diff --git a/Core/Tools/W3DView/EditLODDialog.h b/Core/Tools/W3DView/EditLODDialog.h index 94187d1ea46..67e00330a22 100644 --- a/Core/Tools/W3DView/EditLODDialog.h +++ b/Core/Tools/W3DView/EditLODDialog.h @@ -28,7 +28,7 @@ class CEditLODDialog : public CDialog { // Construction public: - CEditLODDialog(CWnd* pParent = NULL); // standard constructor + CEditLODDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CEditLODDialog) diff --git a/Core/Tools/W3DView/EmitterColorPropPage.cpp b/Core/Tools/W3DView/EmitterColorPropPage.cpp index e72c04317ab..50ab0d9c8d6 100644 --- a/Core/Tools/W3DView/EmitterColorPropPage.cpp +++ b/Core/Tools/W3DView/EmitterColorPropPage.cpp @@ -46,10 +46,10 @@ IMPLEMENT_DYNCREATE(EmitterColorPropPageClass, CPropertyPage) // ///////////////////////////////////////////////////////////// EmitterColorPropPageClass::EmitterColorPropPageClass (EmitterInstanceListClass *pemitter) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), m_bValid (true), - m_ColorBar (NULL), - m_OpacityBar (NULL), + m_ColorBar (nullptr), + m_OpacityBar (nullptr), m_Lifetime (0), CPropertyPage (EmitterColorPropPageClass::IDD) { @@ -133,7 +133,7 @@ EmitterColorPropPageClass::Initialize (void) SAFE_DELETE_ARRAY (m_CurrentOpacities.KeyTimes); SAFE_DELETE_ARRAY (m_CurrentOpacities.Values); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { m_Lifetime = m_pEmitterList->Get_Lifetime (); @@ -662,7 +662,7 @@ EmitterColorPropPageClass::On_Lifetime_Changed (float lifetime) m_pEmitterList->Set_Color_Keyframes (m_CurrentColors); m_pEmitterList->Set_Opacity_Keyframes (m_CurrentOpacities); m_Lifetime = lifetime; - /*if (m_hWnd != NULL) { + /*if (m_hWnd != nullptr) { Update_Colors (); Update_Opacities (); }*/ diff --git a/Core/Tools/W3DView/EmitterColorPropPage.h b/Core/Tools/W3DView/EmitterColorPropPage.h index 4c33199bbb6..f0a511c2f26 100644 --- a/Core/Tools/W3DView/EmitterColorPropPage.h +++ b/Core/Tools/W3DView/EmitterColorPropPage.h @@ -38,7 +38,7 @@ class EmitterColorPropPageClass : public CPropertyPage // Construction public: - EmitterColorPropPageClass (EmitterInstanceListClass *pemitter_list = NULL); + EmitterColorPropPageClass (EmitterInstanceListClass *pemitter_list = nullptr); ~EmitterColorPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/EmitterFramePropPage.cpp b/Core/Tools/W3DView/EmitterFramePropPage.cpp index 865536ae368..d18d01f9d86 100644 --- a/Core/Tools/W3DView/EmitterFramePropPage.cpp +++ b/Core/Tools/W3DView/EmitterFramePropPage.cpp @@ -44,9 +44,9 @@ IMPLEMENT_DYNCREATE(EmitterFramePropPageClass, CPropertyPage) ///////////////////////////////////////////////////////////// EmitterFramePropPageClass::EmitterFramePropPageClass() : CPropertyPage(EmitterFramePropPageClass::IDD), - m_pEmitterList(NULL), + m_pEmitterList(nullptr), m_bValid(true), - m_FrameBar(NULL), + m_FrameBar(nullptr), m_Lifetime(0), m_MinFrame(0), m_MaxFrame(1) @@ -103,7 +103,7 @@ EmitterFramePropPageClass::Initialize (void) SAFE_DELETE_ARRAY (m_Frames.KeyTimes); SAFE_DELETE_ARRAY (m_Frames.Values); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { m_Lifetime = m_pEmitterList->Get_Lifetime (); m_pEmitterList->Get_Frame_Keyframes (m_Frames); @@ -213,7 +213,7 @@ BOOL EmitterFramePropPageClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* // Update the spinner controls if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/EmitterGeneralPropPage.cpp b/Core/Tools/W3DView/EmitterGeneralPropPage.cpp index 20834f603de..852c078d3d9 100644 --- a/Core/Tools/W3DView/EmitterGeneralPropPage.cpp +++ b/Core/Tools/W3DView/EmitterGeneralPropPage.cpp @@ -46,8 +46,8 @@ IMPLEMENT_DYNCREATE(EmitterGeneralPropPageClass, CPropertyPage) // EmitterGeneralPropPageClass // EmitterGeneralPropPageClass::EmitterGeneralPropPageClass (EmitterInstanceListClass *pemitter) - : m_pEmitterList (NULL), - m_Parent (NULL), + : m_pEmitterList (nullptr), + m_Parent (nullptr), m_bValid (true), m_Lifetime (0), CPropertyPage(EmitterGeneralPropPageClass::IDD) @@ -105,7 +105,7 @@ END_MESSAGE_MAP() void EmitterGeneralPropPageClass::Initialize (void) { - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { // // Get the emitter's texture @@ -219,7 +219,7 @@ EmitterGeneralPropPageClass::OnApply (void) int index = SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETCURSEL); if (index != CB_ERR) { ShaderClass *shader = (ShaderClass *)SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETITEMDATA, (WPARAM)index); - if (shader != NULL) { + if (shader != nullptr) { m_Shader = (*shader); } } @@ -259,7 +259,7 @@ EmitterGeneralPropPageClass::OnBrowseButton (void) { CFileDialog openFileDialog (TRUE, ".tga", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "Textures files (*.tga)|*.tga||", ::AfxGetMainWnd ()); @@ -314,7 +314,7 @@ EmitterGeneralPropPageClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } @@ -377,7 +377,7 @@ EmitterGeneralPropPageClass::OnCommand case IDC_RENDER_MODE_COMBO: if (HIWORD (wParam) == CBN_SELCHANGE) { SetModified (); - if (m_Parent != NULL) { + if (m_Parent != nullptr) { int cur_mode = ::SendMessage ((HWND)lParam, CB_GETCURSEL, 0, 0); m_Parent->Notify_Render_Mode_Changed(cur_mode); } diff --git a/Core/Tools/W3DView/EmitterGeneralPropPage.h b/Core/Tools/W3DView/EmitterGeneralPropPage.h index bb81f4a261e..56894bd680e 100644 --- a/Core/Tools/W3DView/EmitterGeneralPropPage.h +++ b/Core/Tools/W3DView/EmitterGeneralPropPage.h @@ -38,7 +38,7 @@ class EmitterGeneralPropPageClass : public CPropertyPage // Construction public: - EmitterGeneralPropPageClass (EmitterInstanceListClass *pemitter_list = NULL); + EmitterGeneralPropPageClass (EmitterInstanceListClass *pemitter_list = nullptr); ~EmitterGeneralPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/EmitterInstanceList.cpp b/Core/Tools/W3DView/EmitterInstanceList.cpp index a4f66a0e971..a321224cf44 100644 --- a/Core/Tools/W3DView/EmitterInstanceList.cpp +++ b/Core/Tools/W3DView/EmitterInstanceList.cpp @@ -75,8 +75,8 @@ EmitterInstanceListClass::Free_List (void) void EmitterInstanceListClass::Add_Emitter (ParticleEmitterClass *emitter) { - ASSERT (emitter != NULL); - if (emitter != NULL) { + ASSERT (emitter != nullptr); + if (emitter != nullptr) { // // If this is the first emitter in the list, then initialize @@ -84,7 +84,7 @@ EmitterInstanceListClass::Add_Emitter (ParticleEmitterClass *emitter) // if (m_List.Count () == 0) { ParticleEmitterDefClass *def = emitter->Build_Definition (); - if (def != NULL) { + if (def != nullptr) { ParticleEmitterDefClass::operator= (*def); SAFE_DELETE (def); } @@ -216,7 +216,7 @@ void EmitterInstanceListClass::Set_Velocity_Random (Vector3Randomizer *randomizer) { ParticleEmitterDefClass::Set_Velocity_Random (randomizer); - if (randomizer != NULL) { + if (randomizer != nullptr) { // // Pass this setting onto the emitters immediately diff --git a/Core/Tools/W3DView/EmitterLineGroupPropPage.cpp b/Core/Tools/W3DView/EmitterLineGroupPropPage.cpp index 32a7faba177..1ee23a62c48 100644 --- a/Core/Tools/W3DView/EmitterLineGroupPropPage.cpp +++ b/Core/Tools/W3DView/EmitterLineGroupPropPage.cpp @@ -41,9 +41,9 @@ IMPLEMENT_DYNCREATE(EmitterLineGroupPropPageClass, CPropertyPage) EmitterLineGroupPropPageClass::EmitterLineGroupPropPageClass() : CPropertyPage(EmitterLineGroupPropPageClass::IDD), - m_pEmitterList(NULL), + m_pEmitterList(nullptr), m_bValid(true), - m_BlurTimeBar(NULL), + m_BlurTimeBar(nullptr), m_Lifetime(0), m_MinBlurTime(0), m_MaxBlurTime(1) @@ -89,7 +89,7 @@ EmitterLineGroupPropPageClass::Initialize (void) SAFE_DELETE_ARRAY (m_BlurTimes.KeyTimes); SAFE_DELETE_ARRAY (m_BlurTimes.Values); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { m_Lifetime = m_pEmitterList->Get_Lifetime (); m_pEmitterList->Get_Blur_Time_Keyframes (m_BlurTimes); @@ -259,7 +259,7 @@ BOOL EmitterLineGroupPropPageClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESU // Update the spinner controls if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/EmitterLinePropPage.cpp b/Core/Tools/W3DView/EmitterLinePropPage.cpp index 91c1a5a5fff..22f0bf79e58 100644 --- a/Core/Tools/W3DView/EmitterLinePropPage.cpp +++ b/Core/Tools/W3DView/EmitterLinePropPage.cpp @@ -39,7 +39,7 @@ IMPLEMENT_DYNCREATE(EmitterLinePropPageClass, CPropertyPage) EmitterLinePropPageClass::EmitterLinePropPageClass() : CPropertyPage(EmitterLinePropPageClass::IDD), - m_pEmitterList(NULL), + m_pEmitterList(nullptr), m_bValid(true), m_MappingMode(W3D_EMITTER_RENDER_MODE_TRI_PARTICLES), m_MergeIntersections(false), @@ -92,7 +92,7 @@ END_MESSAGE_MAP() void EmitterLinePropPageClass::Initialize (void) { - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { // // Read the settings from the emitter @@ -220,7 +220,7 @@ BOOL EmitterLinePropPageClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* p // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); SetModified (); diff --git a/Core/Tools/W3DView/EmitterParticlePropPage.cpp b/Core/Tools/W3DView/EmitterParticlePropPage.cpp index cff67fb2418..f07e646e1ee 100644 --- a/Core/Tools/W3DView/EmitterParticlePropPage.cpp +++ b/Core/Tools/W3DView/EmitterParticlePropPage.cpp @@ -50,7 +50,7 @@ EmitterParticlePropPageClass::EmitterParticlePropPageClass (EmitterInstanceListC m_Rate (0), m_BurstSize (0), m_MaxParticles (0), - m_Randomizer (NULL), + m_Randomizer (nullptr), CPropertyPage(EmitterParticlePropPageClass::IDD) { //{{AFX_DATA_INIT(EmitterParticlePropPageClass) @@ -105,7 +105,7 @@ void EmitterParticlePropPageClass::Initialize (void) { SAFE_DELETE (m_Randomizer); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { // // Read the settings from the emitter @@ -220,7 +220,7 @@ EmitterParticlePropPageClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); SetModified (); diff --git a/Core/Tools/W3DView/EmitterParticlePropPage.h b/Core/Tools/W3DView/EmitterParticlePropPage.h index ae3702d755b..bdb4135a1df 100644 --- a/Core/Tools/W3DView/EmitterParticlePropPage.h +++ b/Core/Tools/W3DView/EmitterParticlePropPage.h @@ -38,7 +38,7 @@ class EmitterParticlePropPageClass : public CPropertyPage // Construction public: - EmitterParticlePropPageClass (EmitterInstanceListClass *pemitter_list = NULL); + EmitterParticlePropPageClass (EmitterInstanceListClass *pemitter_list = nullptr); ~EmitterParticlePropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/EmitterPhysicsPropPage.cpp b/Core/Tools/W3DView/EmitterPhysicsPropPage.cpp index 465b9e64b11..7449f8e0c3e 100644 --- a/Core/Tools/W3DView/EmitterPhysicsPropPage.cpp +++ b/Core/Tools/W3DView/EmitterPhysicsPropPage.cpp @@ -44,13 +44,13 @@ IMPLEMENT_DYNCREATE(EmitterPhysicsPropPageClass, CPropertyPage) // ///////////////////////////////////////////////////////////// EmitterPhysicsPropPageClass::EmitterPhysicsPropPageClass (EmitterInstanceListClass *pemitter) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), m_bValid (true), m_Velocity (0, 0, 1), m_Acceleration (0, 0, 0), m_OutFactor (0), m_InheritanceFactor (0), - m_Randomizer (NULL), + m_Randomizer (nullptr), CPropertyPage(EmitterPhysicsPropPageClass::IDD) { //{{AFX_DATA_INIT(EmitterPhysicsPropPageClass) @@ -112,7 +112,7 @@ void EmitterPhysicsPropPageClass::Initialize (void) { SAFE_DELETE (m_Randomizer); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { // // Get the emitter's settings @@ -204,7 +204,7 @@ EmitterPhysicsPropPageClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); On_Setting_Changed (wParam); @@ -231,7 +231,7 @@ EmitterPhysicsPropPageClass::OnSpecifyVelocityRandom (void) // SAFE_DELETE (m_Randomizer); m_Randomizer = dialog.Get_Randomizer (); - if (m_Randomizer != NULL) { + if (m_Randomizer != nullptr) { m_pEmitterList->Set_Velocity_Random (m_Randomizer->Clone ()); SetModified (); } diff --git a/Core/Tools/W3DView/EmitterPhysicsPropPage.h b/Core/Tools/W3DView/EmitterPhysicsPropPage.h index 2b2c35cd60e..9900f7e835b 100644 --- a/Core/Tools/W3DView/EmitterPhysicsPropPage.h +++ b/Core/Tools/W3DView/EmitterPhysicsPropPage.h @@ -37,7 +37,7 @@ class EmitterPhysicsPropPageClass : public CPropertyPage // Construction public: - EmitterPhysicsPropPageClass (EmitterInstanceListClass *pemitter_list = NULL); + EmitterPhysicsPropPageClass (EmitterInstanceListClass *pemitter_list = nullptr); ~EmitterPhysicsPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/EmitterPropertySheet.cpp b/Core/Tools/W3DView/EmitterPropertySheet.cpp index 0b3eed55b27..9a013ea1c40 100644 --- a/Core/Tools/W3DView/EmitterPropertySheet.cpp +++ b/Core/Tools/W3DView/EmitterPropertySheet.cpp @@ -65,7 +65,7 @@ EmitterPropertySheetClass::EmitterPropertySheetClass UINT nIDCaption, CWnd *pParentWnd ) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), CPropertySheet (nIDCaption, pParentWnd, 0) { m_pEmitterList = emitter_list; @@ -84,7 +84,7 @@ EmitterPropertySheetClass::EmitterPropertySheetClass LPCTSTR pszCaption, CWnd *pParentWnd ) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), CPropertySheet (pszCaption, pParentWnd, 0) { m_pEmitterList = emitter_list; @@ -192,7 +192,7 @@ void EmitterPropertySheetClass::Add_Emitter_To_Viewer (void) { CW3DViewDoc *pdoc = ::GetCurrentDocument (); - if ((pdoc != NULL) && (m_pEmitterList != NULL)) { + if ((pdoc != nullptr) && (m_pEmitterList != nullptr)) { // // Create a new prototype for this emitter and add it to the asset manager @@ -286,7 +286,7 @@ EmitterPropertySheetClass::Update_Emitter (void) void EmitterPropertySheetClass::Initialize (void) { - if (m_pEmitterList == NULL) { + if (m_pEmitterList == nullptr) { Create_New_Emitter (); } else { m_LastSavedName = m_pEmitterList->Get_Name (); @@ -305,10 +305,10 @@ EmitterPropertySheetClass::Initialize (void) m_LineGroupPage.Set_Emitter (m_pEmitterList); // Initialize the user page with data from the prototype - /*if (m_pEmitter != NULL) { - ParticleEmitterPrototypeClass *proto = NULL; + /*if (m_pEmitter != nullptr) { + ParticleEmitterPrototypeClass *proto = nullptr; proto = (ParticleEmitterPrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pEmitter->Get_Name ()); - if (proto != NULL) { + if (proto != nullptr) { ParticleEmitterDefClass *definition = proto->Get_Definition (); m_UserPage.Set_Type (definition->Get_User_Type ()); m_UserPage.Set_String (definition->Get_User_String ()); @@ -382,7 +382,7 @@ EmitterPropertySheetClass::Create_Emitter (void) // // Load the texture // - TextureClass *ptexture = NULL; + TextureClass *ptexture = nullptr; if (texture_name.GetLength () > 0) { ptexture = WW3DAssetManager::Get_Instance()->Get_Texture (texture_name); } @@ -428,48 +428,48 @@ EmitterPropertySheetClass::Create_New_Emitter (void) color.Start = Vector3 (1, 1, 1); color.Rand.Set (0,0,0); color.NumKeyFrames = 0; - color.KeyTimes = NULL; - color.Values = NULL; + color.KeyTimes = nullptr; + color.Values = nullptr; ParticlePropertyStruct opacity; opacity.Start = 1.0F; opacity.Rand = 0.0F; opacity.NumKeyFrames = 0; - opacity.KeyTimes = NULL; - opacity.Values = NULL; + opacity.KeyTimes = nullptr; + opacity.Values = nullptr; ParticlePropertyStruct size; size.Start = 0.1F; size.Rand = 0.0F; size.NumKeyFrames = 0; - size.KeyTimes = NULL; - size.Values = NULL; + size.KeyTimes = nullptr; + size.Values = nullptr; ParticlePropertyStruct rotation; rotation.Start = 0.0f; rotation.Rand = 0.0f; rotation.NumKeyFrames = 0; - rotation.KeyTimes = NULL; - rotation.Values = NULL; + rotation.KeyTimes = nullptr; + rotation.Values = nullptr; ParticlePropertyStruct frames; frames.Start = 0.0f; frames.Rand = 0.0f; frames.NumKeyFrames = 0; - frames.KeyTimes = NULL; - frames.Values = NULL; + frames.KeyTimes = nullptr; + frames.Values = nullptr; ParticlePropertyStruct blurtimes; blurtimes.Start = 0.0f; blurtimes.Rand = 0.0f; blurtimes.NumKeyFrames = 0; - blurtimes.KeyTimes = NULL; - blurtimes.Values = NULL; + blurtimes.KeyTimes = nullptr; + blurtimes.Values = nullptr; // // Create the new emitter // - ParticleEmitterClass *emitter = NULL; + ParticleEmitterClass *emitter = nullptr; emitter = new ParticleEmitterClass (10, 1, new Vector3SolidBoxRandomizer(Vector3(0.1F, 0.1F, 0.1F)), @@ -487,7 +487,7 @@ EmitterPropertySheetClass::Create_New_Emitter (void) Vector3 (0, 0, 0), 1.0F, 0.0F, - NULL, + nullptr, ShaderClass::_PresetAdditiveSpriteShader, 0); diff --git a/Core/Tools/W3DView/EmitterPropertySheet.h b/Core/Tools/W3DView/EmitterPropertySheet.h index f0861029c8d..1430e719738 100644 --- a/Core/Tools/W3DView/EmitterPropertySheet.h +++ b/Core/Tools/W3DView/EmitterPropertySheet.h @@ -48,8 +48,8 @@ class EmitterPropertySheetClass : public CPropertySheet // Construction public: - EmitterPropertySheetClass (EmitterInstanceListClass *emitter_list, UINT nIDCaption, CWnd* pParentWnd = NULL); - EmitterPropertySheetClass (EmitterInstanceListClass *emitter_list, LPCTSTR pszCaption, CWnd* pParentWnd = NULL); + EmitterPropertySheetClass (EmitterInstanceListClass *emitter_list, UINT nIDCaption, CWnd* pParentWnd = nullptr); + EmitterPropertySheetClass (EmitterInstanceListClass *emitter_list, LPCTSTR pszCaption, CWnd* pParentWnd = nullptr); // Attributes public: diff --git a/Core/Tools/W3DView/EmitterRotationPropPage.cpp b/Core/Tools/W3DView/EmitterRotationPropPage.cpp index d3164102f8b..4c9dc0329cd 100644 --- a/Core/Tools/W3DView/EmitterRotationPropPage.cpp +++ b/Core/Tools/W3DView/EmitterRotationPropPage.cpp @@ -45,9 +45,9 @@ IMPLEMENT_DYNCREATE(EmitterRotationPropPageClass, CPropertyPage) ///////////////////////////////////////////////////////////// EmitterRotationPropPageClass::EmitterRotationPropPageClass() : CPropertyPage(EmitterRotationPropPageClass::IDD), - m_pEmitterList(NULL), + m_pEmitterList(nullptr), m_bValid(true), - m_RotationBar(NULL), + m_RotationBar(nullptr), m_Lifetime(0), m_MinRotation(0), m_MaxRotation(1), @@ -110,7 +110,7 @@ void EmitterRotationPropPageClass::Initialize (void) SAFE_DELETE_ARRAY (m_Rotations.KeyTimes); SAFE_DELETE_ARRAY (m_Rotations.Values); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { m_Lifetime = m_pEmitterList->Get_Lifetime (); m_pEmitterList->Get_Rotation_Keyframes (m_Rotations); m_InitialOrientationRandom = m_pEmitterList->Get_Initial_Orientation_Random(); @@ -190,7 +190,7 @@ BOOL EmitterRotationPropPageClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESUL // Update the spinner controls if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/EmitterSizePropPage.cpp b/Core/Tools/W3DView/EmitterSizePropPage.cpp index 11a6e7cce70..f5a5b4efe4e 100644 --- a/Core/Tools/W3DView/EmitterSizePropPage.cpp +++ b/Core/Tools/W3DView/EmitterSizePropPage.cpp @@ -44,9 +44,9 @@ IMPLEMENT_DYNCREATE(EmitterSizePropPageClass, CPropertyPage) // ///////////////////////////////////////////////////////////// EmitterSizePropPageClass::EmitterSizePropPageClass (EmitterInstanceListClass *pemitter) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), m_bValid (true), - m_SizeBar (NULL), + m_SizeBar (nullptr), m_Lifetime (0), CPropertyPage(EmitterSizePropPageClass::IDD) { @@ -114,7 +114,7 @@ EmitterSizePropPageClass::Initialize (void) SAFE_DELETE_ARRAY (m_CurrentSizes.KeyTimes); SAFE_DELETE_ARRAY (m_CurrentSizes.Values); - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { m_Lifetime = m_pEmitterList->Get_Lifetime (); m_pEmitterList->Get_Size_Keyframes (m_OrigSizes); m_pEmitterList->Get_Size_Keyframes (m_CurrentSizes); @@ -217,7 +217,7 @@ EmitterSizePropPageClass::OnNotify // Update the spinner controls if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/EmitterSizePropPage.h b/Core/Tools/W3DView/EmitterSizePropPage.h index 14e4ca369b9..b525e00392a 100644 --- a/Core/Tools/W3DView/EmitterSizePropPage.h +++ b/Core/Tools/W3DView/EmitterSizePropPage.h @@ -38,7 +38,7 @@ class EmitterSizePropPageClass : public CPropertyPage // Construction public: - EmitterSizePropPageClass(EmitterInstanceListClass *pemitter = NULL); + EmitterSizePropPageClass(EmitterInstanceListClass *pemitter = nullptr); ~EmitterSizePropPageClass(); // Dialog Data diff --git a/Core/Tools/W3DView/EmitterUserPropPage.cpp b/Core/Tools/W3DView/EmitterUserPropPage.cpp index 92a6a7ad176..bc5cf79ccf4 100644 --- a/Core/Tools/W3DView/EmitterUserPropPage.cpp +++ b/Core/Tools/W3DView/EmitterUserPropPage.cpp @@ -42,7 +42,7 @@ IMPLEMENT_DYNCREATE(EmitterUserPropPageClass, CPropertyPage) // EmitterUserPropPageClass // EmitterUserPropPageClass::EmitterUserPropPageClass (EmitterInstanceListClass *pemitter) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), m_bValid (true), m_iType (EMITTER_TYPEID_DEFAULT), CPropertyPage(EmitterUserPropPageClass::IDD) @@ -96,7 +96,7 @@ END_MESSAGE_MAP() void EmitterUserPropPageClass::Initialize (void) { - if (m_pEmitterList != NULL) { + if (m_pEmitterList != nullptr) { // Record the user information from the emitter (if it exists) m_iType = m_pEmitterList->Get_User_Type (); diff --git a/Core/Tools/W3DView/EmitterUserPropPage.h b/Core/Tools/W3DView/EmitterUserPropPage.h index 514c98ab920..e9edf67d60e 100644 --- a/Core/Tools/W3DView/EmitterUserPropPage.h +++ b/Core/Tools/W3DView/EmitterUserPropPage.h @@ -35,7 +35,7 @@ class EmitterUserPropPageClass : public CPropertyPage // Construction public: - EmitterUserPropPageClass (EmitterInstanceListClass *pemitter_list = NULL); + EmitterUserPropPageClass (EmitterInstanceListClass *pemitter_list = nullptr); ~EmitterUserPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/GammaDialog.cpp b/Core/Tools/W3DView/GammaDialog.cpp index 13f1e3a4cff..600c36fcdf7 100644 --- a/Core/Tools/W3DView/GammaDialog.cpp +++ b/Core/Tools/W3DView/GammaDialog.cpp @@ -34,7 +34,7 @@ static char THIS_FILE[] = __FILE__; // GammaDialogClass dialog -GammaDialogClass::GammaDialogClass(CWnd* pParent /*=NULL*/) +GammaDialogClass::GammaDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(GammaDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(GammaDialogClass) diff --git a/Core/Tools/W3DView/GammaDialog.h b/Core/Tools/W3DView/GammaDialog.h index 43adf086f45..6252b3d024b 100644 --- a/Core/Tools/W3DView/GammaDialog.h +++ b/Core/Tools/W3DView/GammaDialog.h @@ -28,7 +28,7 @@ class GammaDialogClass : public CDialog { // Construction public: - GammaDialogClass(CWnd* pParent = NULL); // standard constructor + GammaDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(GammaDialogClass) diff --git a/Core/Tools/W3DView/Globals.cpp b/Core/Tools/W3DView/Globals.cpp index 45dfd6d7a38..b0328e5920a 100644 --- a/Core/Tools/W3DView/Globals.cpp +++ b/Core/Tools/W3DView/Globals.cpp @@ -31,7 +31,7 @@ #include "ViewerAssetMgr.h" // Main asset manager for the application. -ViewerAssetMgrClass *_TheAssetMgr = NULL; +ViewerAssetMgrClass *_TheAssetMgr = nullptr; int g_iDeviceIndex = -1;//DEFAULT_DEVICEINDEX; diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index e32acee1289..1b5af956d85 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -71,7 +71,7 @@ IMPLEMENT_DYNCREATE(CGraphicView, CView) //////////////////////////////////////////////////////////////////////////// CGraphicView::CGraphicView (void) : m_bInitialized (FALSE), - m_pCamera (NULL), + m_pCamera (nullptr), m_TimerID (0), m_bMouseDown (FALSE), m_bRMouseDown (FALSE), @@ -83,7 +83,7 @@ CGraphicView::CGraphicView (void) m_objectRotation (NoRotation), m_LightRotation (NoRotation), m_bLightMeshInScene (false), - m_pLightMesh (NULL), + m_pLightMesh (nullptr), m_ParticleCountUpdate (0), m_CameraBonePosX (false), m_UpdateCounter (0), @@ -213,11 +213,11 @@ CGraphicView::InitializeGraphicView (void) m_iWindowed) == WW3D_ERROR_OK); ASSERT (bReturn); - if (bReturn && (m_pCamera == NULL)) + if (bReturn && (m_pCamera == nullptr)) { // Instantiate a new camera class m_pCamera = new CameraClass (); - bReturn = (m_pCamera != NULL); + bReturn = (m_pCamera != nullptr); // Were we successful in creating a camera? ASSERT (m_pCamera); @@ -239,13 +239,13 @@ CGraphicView::InitializeGraphicView (void) Reset_FOV (); - if (m_pLightMesh == NULL) + if (m_pLightMesh == nullptr) { - ResourceFileClass light_mesh_file (NULL, "Light.w3d"); + ResourceFileClass light_mesh_file (nullptr, "Light.w3d"); WW3DAssetManager::Get_Instance()->Load_3D_Assets (light_mesh_file); m_pLightMesh = WW3DAssetManager::Get_Instance()->Create_Render_Obj ("LIGHT"); - ASSERT (m_pLightMesh != NULL); + ASSERT (m_pLightMesh != nullptr); m_bLightMeshInScene = false; } @@ -324,7 +324,7 @@ CGraphicView::OnDestroy (void) // // Remove the listener from the camera // - WWAudioClass::Get_Instance ()->Get_Sound_Scene ()->Attach_Listener_To_Obj (NULL); + WWAudioClass::Get_Instance ()->Get_Sound_Scene ()->Attach_Listener_To_Obj (nullptr); // // Free the camera object @@ -382,10 +382,10 @@ CGraphicView::OnInitialUpdate (void) void Set_Lowest_LOD (RenderObjClass *render_obj) { - if (render_obj != NULL) { + if (render_obj != nullptr) { for (int index = 0; index < render_obj->Get_Num_Sub_Objects (); index ++) { RenderObjClass *psub_obj = render_obj->Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { Set_Lowest_LOD (psub_obj); } REF_PTR_RELEASE (psub_obj); @@ -489,7 +489,7 @@ CGraphicView::RepaintView // Reset the current lod to be the lowest possible LOD... RenderObjClass *prender_obj = doc->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (doc->GetScene ()->Are_LODs_Switching ())) { Set_Lowest_LOD (prender_obj); @@ -561,7 +561,7 @@ CGraphicView::RepaintView m_ParticleCountUpdate = cur_ticks; doc->Update_Particle_Count (); - int polys = (prender_obj != NULL) ? prender_obj->Get_Num_Polys () : 0; + int polys = (prender_obj != nullptr) ? prender_obj->Get_Num_Polys () : 0; ((CMainFrame *)::AfxGetMainWnd ())->UpdatePolygonCount (polys); } @@ -653,7 +653,7 @@ CGraphicView::WindowProc } RepaintView (FALSE); - ValidateRect (NULL); + ValidateRect (nullptr); return 0; } else if (message == WM_KEYDOWN) { @@ -694,11 +694,11 @@ fnTimerCallback ) { HWND hwnd = (HWND)dwUser; - if (hwnd != NULL) { + if (hwnd != nullptr) { // Send this event off to the view to process (hackish, but fine for now) - if ((GetProp (hwnd, "WaitingToProcess") == NULL) && - (GetProp (hwnd, "Inactive") == NULL)) { + if ((GetProp (hwnd, "WaitingToProcess") == nullptr) && + (GetProp (hwnd, "Inactive") == nullptr)) { SetProp (hwnd, "WaitingToProcess", (HANDLE)1); @@ -771,7 +771,7 @@ CGraphicView::OnLButtonUp } else { - ::SetCursor (::LoadCursor (NULL, MAKEINTRESOURCE (IDC_ARROW))); + ::SetCursor (::LoadCursor (nullptr, MAKEINTRESOURCE (IDC_ARROW))); ((CW3DViewDoc *)GetDocument())->Set_Cursor ("cursor.tga"); } @@ -847,7 +847,7 @@ CGraphicView::OnMouseMove else if ((nFlags & MK_CONTROL) && m_bMouseDown) { LightClass *pSceneLight = doc->GetSceneLight (); - if ((pSceneLight != NULL) && (m_pLightMesh != NULL)) + if ((pSceneLight != nullptr) && (m_pLightMesh != nullptr)) { RECT rect; GetClientRect (&rect); @@ -895,7 +895,7 @@ CGraphicView::OnMouseMove CW3DViewDoc *doc= (CW3DViewDoc *)GetDocument(); LightClass *pscene_light = doc->GetSceneLight (); RenderObjClass *prender_obj = doc->GetDisplayedObject (); - if ((pscene_light != NULL) && (prender_obj != NULL)) { + if ((pscene_light != nullptr) && (prender_obj != nullptr)) { // Calculate a light adjustment factor CRect rect; @@ -1070,7 +1070,7 @@ CGraphicView::OnMouseMove // Get the main window of our app CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) + if (pCMainWnd != nullptr) { // Ensure the background camera matches the main camera CW3DViewDoc *doc = (CW3DViewDoc *)GetDocument(); @@ -1079,7 +1079,7 @@ CGraphicView::OnMouseMove // Update the current object if necessary RenderObjClass *prender_obj = doc->GetDisplayedObject (); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { // Ensure the status bar is updated with the correct poly count pCMainWnd->UpdatePolygonCount (prender_obj->Get_Num_Polys ()); @@ -1214,7 +1214,7 @@ CGraphicView::Reset_Camera_To_Display_Sphere (SphereClass &sphere) // Make the same adjustment for the scene light CW3DViewDoc* doc = (CW3DViewDoc *)GetDocument(); LightClass *pSceneLight = doc->GetSceneLight (); - if ((m_pLightMesh != NULL) && (pSceneLight != NULL)) { + if ((m_pLightMesh != nullptr) && (pSceneLight != nullptr)) { // Reposition the light and its 'mesh' as appropriate transform.Make_Identity (); @@ -1252,7 +1252,7 @@ CGraphicView::Reset_Camera_To_Display_Sphere (SphereClass &sphere) // Update the camera distance in the status bar CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) { + if (pCMainWnd != nullptr) { pCMainWnd->UpdateCameraDistance (m_CameraDistance); pCMainWnd->UpdateFrameCount (0, 0, 0); } @@ -1298,7 +1298,7 @@ CGraphicView::Reset_Camera_To_Display_Object (RenderObjClass &render_object) // Update the polygon count in the main window CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) { + if (pCMainWnd != nullptr) { pCMainWnd->UpdatePolygonCount (render_object.Get_Num_Polys ()); } @@ -1318,11 +1318,11 @@ CGraphicView::Load_Default_Dat (void) { // Get the directory where this executable was run from TCHAR filename[MAX_PATH]; - ::GetModuleFileName (NULL, filename, sizeof (filename)); + ::GetModuleFileName (nullptr, filename, sizeof (filename)); // Strip the filename from the path LPTSTR ppath = ::strrchr (filename, '\\'); - if (ppath != NULL) { + if (ppath != nullptr) { ppath[0] = 0; } @@ -1334,7 +1334,7 @@ CGraphicView::Load_Default_Dat (void) // Ask the document to load the settings from this data file CW3DViewDoc *pCDoc = (CW3DViewDoc *)GetDocument (); - if (pCDoc != NULL) { + if (pCDoc != nullptr) { pCDoc->LoadSettings (filename); } } @@ -1361,7 +1361,7 @@ CGraphicView::OnRButtonUp if (m_bMouseDown) { ((CW3DViewDoc *)GetDocument())->Set_Cursor ("orbit.tga"); } else { - ::SetCursor (::LoadCursor (NULL, MAKEINTRESOURCE (IDC_ARROW))); + ::SetCursor (::LoadCursor (nullptr, MAKEINTRESOURCE (IDC_ARROW))); ((CW3DViewDoc *)GetDocument())->Set_Cursor ("cursor.tga"); ReleaseCapture (); } @@ -1530,7 +1530,7 @@ CGraphicView::SetCameraPos (CAMERA_POS cameraPos) // Get the main window of our app CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); - if (pCMainWnd != NULL) + if (pCMainWnd != nullptr) { CW3DViewDoc* doc = (CW3DViewDoc *)GetDocument(); @@ -1637,7 +1637,7 @@ CGraphicView::Rotate_Object (void) // Get the currently displayed object RenderObjClass *prender_obj = doc->GetDisplayedObject (); - if (prender_obj != NULL) + if (prender_obj != nullptr) { // Get the current transform for the object Matrix3D transform = prender_obj->Get_Transform (); @@ -1686,7 +1686,7 @@ CGraphicView::Rotate_Light (void) // Get the currently displayed object LightClass *pscene_light = doc->GetSceneLight (); RenderObjClass *prender_obj = doc->GetDisplayedObject (); - if ((pscene_light != NULL) && (prender_obj != NULL)) { + if ((pscene_light != nullptr) && (prender_obj != nullptr)) { Matrix3D rotation_matrix (1); // Build a rotation matrix that contains the x,y,z @@ -1818,7 +1818,7 @@ CGraphicView::Set_Camera_Distance (float dist) // Update the status bar // CMainFrame *main_wnd = (CMainFrame *)::AfxGetMainWnd (); - if (main_wnd != NULL) { + if (main_wnd != nullptr) { main_wnd->UpdateCameraDistance (m_CameraDistance); } diff --git a/Core/Tools/W3DView/HierarchyPropPage.cpp b/Core/Tools/W3DView/HierarchyPropPage.cpp index b52c698e0f6..c39fd171552 100644 --- a/Core/Tools/W3DView/HierarchyPropPage.cpp +++ b/Core/Tools/W3DView/HierarchyPropPage.cpp @@ -135,7 +135,7 @@ CHierarchyPropPage::OnInitDialog (void) // Free this object pCSubObject->Release_Ref (); - pCSubObject = NULL; + pCSubObject = nullptr; } } @@ -144,7 +144,7 @@ CHierarchyPropPage::OnInitDialog (void) // Free the object pCHierarchy->Release_Ref (); - pCHierarchy = NULL; + pCHierarchy = nullptr; } } diff --git a/Core/Tools/W3DView/MainFrm.cpp b/Core/Tools/W3DView/MainFrm.cpp index e27917e65f3..31b60e51929 100644 --- a/Core/Tools/W3DView/MainFrm.cpp +++ b/Core/Tools/W3DView/MainFrm.cpp @@ -464,7 +464,7 @@ CMainFrame::Restore_Window_State (void) if (is_max) { ::ShowWindow (m_hWnd, SW_MAXIMIZE); } else { - ::SetWindowPos (m_hWnd, NULL, rect.left, rect.top, rect.Width (), rect.Height (), SWP_NOZORDER); + ::SetWindowPos (m_hWnd, nullptr, rect.left, rect.top, rect.Width (), rect.Height (), SWP_NOZORDER); } } @@ -481,7 +481,7 @@ void CMainFrame::RestoreOriginalSize (void) { // Resize the window so its the same size it was when the application loaded - SetWindowPos (NULL, 0, 0, m_OrigRect.right-m_OrigRect.left, m_OrigRect.bottom-m_OrigRect.top, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos (nullptr, 0, 0, m_OrigRect.right-m_OrigRect.left, m_OrigRect.bottom-m_OrigRect.top, SWP_NOMOVE | SWP_NOZORDER); return ; } @@ -531,14 +531,14 @@ CMainFrame::OnCreateClient // Get a pointer to the 'graphic' pane's window CGraphicView *pCGraphicView = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - BOOL bReturn = (pCGraphicView != NULL); + BOOL bReturn = (pCGraphicView != nullptr); // Were we successful in view's getting the pointer? ASSERT (pCGraphicView); if (pCGraphicView) { TCHAR szFileName[MAX_PATH]; - ::GetModuleFileName (NULL, szFileName, sizeof (szFileName)); + ::GetModuleFileName (nullptr, szFileName, sizeof (szFileName)); LPTSTR pszPath = ::strrchr (szFileName, '\\'); if (pszPath) { pszPath[0] = 0; @@ -654,7 +654,7 @@ CMainFrame::WindowProc // We're closing the application so cleanup resources CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - if (pdoc != NULL) { + if (pdoc != nullptr) { // Ask the Doc to free its resources pdoc->CleanupResources (); @@ -677,11 +677,11 @@ CMainFrame::WindowProc // Get the directory where this executable was run from TCHAR filename[MAX_PATH]; - ::GetModuleFileName (NULL, filename, sizeof (filename)); + ::GetModuleFileName (nullptr, filename, sizeof (filename)); // Strip the filename from the path LPTSTR ppath = ::strrchr (filename, '\\'); - if (ppath != NULL) { + if (ppath != nullptr) { ppath[0] = 0; } @@ -695,7 +695,7 @@ CMainFrame::WindowProc // Ask the document to load the settings from this data file CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - if (pdoc != NULL) { + if (pdoc != nullptr) { pdoc->LoadSettings (full_path); } } @@ -733,7 +733,7 @@ CMainFrame::ShowObjectProperties (void) { // Get a pointer to the 'graphic' pane's window CDataTreeView *pCDataTreeView = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); - BOOL bReturn = (pCDataTreeView != NULL); + BOOL bReturn = (pCDataTreeView != nullptr); // Were we successful in getting the view's pointer? ASSERT (pCDataTreeView); @@ -806,14 +806,14 @@ CMainFrame::OnUpdateObjectProperties (CCmdUI* pCmdUI) { // Get a pointer to the 'graphic' pane's window CDataTreeView *pCDataTreeView = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); - BOOL bReturn = (pCDataTreeView != NULL); + BOOL bReturn = (pCDataTreeView != nullptr); // Were we successful in view's getting the pointer? ASSERT (pCDataTreeView); if (pCDataTreeView) { // Get the name of the currently selected object - pCmdUI->Enable (pCDataTreeView->GetCurrentSelectionName () != NULL); + pCmdUI->Enable (pCDataTreeView->GetCurrentSelectionName () != nullptr); } return ; @@ -982,8 +982,8 @@ CMainFrame::OnLodGenerate (void) CDataTreeView *ptree_view = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); // Were we successful in view's getting the pointer? - ASSERT (ptree_view != NULL); - if ((ptree_view != NULL) && + ASSERT (ptree_view != nullptr); + if ((ptree_view != nullptr) && ptree_view->GetCurrentSelectionName ()) { // Get the name of the currently selected hierarchy @@ -1004,13 +1004,13 @@ CMainFrame::OnLodGenerate (void) // Get a pointer to the document so we can create an LOD CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - ASSERT (pdoc != NULL); - if (pdoc != NULL) { + ASSERT (pdoc != nullptr); + if (pdoc != nullptr) { // Attempt to generate an LOD from the name of the // currently selected hierarchy HLodPrototypeClass *plod_prototype = pdoc->GenerateLOD (stringName, type); - if (plod_prototype != NULL) { + if (plod_prototype != nullptr) { // Add this prototype to the asset manager WW3DAssetManager::Get_Instance ()->Add_Prototype (plod_prototype); @@ -1093,7 +1093,7 @@ CMainFrame::Update_Frame_Time (DWORD clocks) // Update the resolution display CGraphicView *pCGraphicView = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - if (pCGraphicView != NULL) { + if (pCGraphicView != nullptr) { CRect rect; pCGraphicView->GetWindowRect(&rect); @@ -1186,13 +1186,13 @@ void CMainFrame::OnFileOpen (void) { CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); - if (doc == NULL) { + if (doc == nullptr) { return ; } CFileDialog openFileDialog (TRUE, ".w3d", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT | OFN_EXPLORER, "Westwood 3D Files (*.w3d)|*.w3d||", this); @@ -1206,11 +1206,11 @@ CMainFrame::OnFileOpen (void) if (openFileDialog.DoModal () == IDOK) { // Show the wait cursor while we load assets - SetCursor (::LoadCursor (NULL, IDC_WAIT)); + SetCursor (::LoadCursor (nullptr, IDC_WAIT)); // Loop through all the selected files POSITION pPos = openFileDialog.GetStartPosition (); - while (pPos != NULL) + while (pPos != nullptr) { // Ask the doc to load the assets from this file into memory CString stringFileName = openFileDialog.GetNextPathName (pPos); @@ -1228,7 +1228,7 @@ CMainFrame::OnFileOpen (void) } // Restore the arrow cursor - SetCursor (::LoadCursor (NULL, IDC_ARROW)); + SetCursor (::LoadCursor (nullptr, IDC_ARROW)); } return ; @@ -1701,7 +1701,7 @@ CMainFrame::OnLoadSettings (void) { CFileDialog openFileDialog (TRUE, ".dat", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "Settings data files (*.dat)|*.dat||", this); @@ -1744,7 +1744,7 @@ CMainFrame::OnLODSave (void) // Get the controlling doc object so we can have it save the // LOD for us. CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - if (pdoc != NULL) { + if (pdoc != nullptr) { pdoc->Save_Selected_LOD (); } @@ -2207,18 +2207,18 @@ CMainFrame::Select_Device (bool show_dlg) // // Check to ensure the drivers are valid if the user choose glide // - if (::strstr (driver_name, "glide2") != NULL) { + if (::strstr (driver_name, "glide2") != nullptr) { // Is this glide driver an acceptable version? float driver_version = ::atof (string_version); - bool is_voodoo2 = (::strstr (chipset , "VOODOO2") != NULL); + bool is_voodoo2 = (::strstr (chipset , "VOODOO2") != nullptr); if ((is_voodoo2 && (driver_version < 2.54F)) || ((is_voodoo2 == false) && (driver_version < 2.46F))) { // Let the user know we can't use these drivers CString message; message.LoadString (IDS_UNACCEPTABLE_GLIDE_MSG); - ::MessageBox (NULL, message, "Invalid Device", MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); + ::MessageBox (nullptr, message, "Invalid Device", MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); // Force the user to choose a new device Select_Device (true); @@ -2323,11 +2323,11 @@ CMainFrame::OnCreateEmitter (void) // Clear the current display CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); if (pdoc) { - pdoc->DisplayObject ((RenderObjClass *)NULL); + pdoc->DisplayObject ((RenderObjClass *)nullptr); } // Display the emitter property sheet - EmitterPropertySheetClass prop_sheet (NULL, + EmitterPropertySheetClass prop_sheet (nullptr, IDS_EMITTER_PROP_TITLE, this); prop_sheet.DoModal (); @@ -2345,7 +2345,7 @@ CMainFrame::OnEditEmitter (void) { // Get a pointer to the doc object CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - if (pdoc != NULL) { + if (pdoc != nullptr) { // // Make a list of emitters containing the currently displayed emitter @@ -2388,7 +2388,7 @@ CMainFrame::OnScaleEmitter (void) { // Get a pointer to the doc object CW3DViewDoc *pdoc = (CW3DViewDoc *)GetActiveDocument (); - if (pdoc != NULL) { + if (pdoc != nullptr) { // // Display a dialog that allows the user to choose the scaling factor @@ -2597,8 +2597,8 @@ void CMainFrame::OnObjectRotateYBack (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Y int rotation = (pgraphic_view->GetObjectRotation () ^ (CGraphicView::RotateYBack)); @@ -2619,8 +2619,8 @@ void CMainFrame::OnObjectRotateZBack (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Z int rotation = (pgraphic_view->GetObjectRotation () ^ (CGraphicView::RotateZBack)); @@ -2641,8 +2641,8 @@ void CMainFrame::OnLightRotateY (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Y int rotation = (pgraphic_view->Get_Light_Rotation () ^ (CGraphicView::RotateY)); @@ -2663,8 +2663,8 @@ void CMainFrame::OnLightRotateYBack (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Y int rotation = (pgraphic_view->Get_Light_Rotation () ^ (CGraphicView::RotateYBack)); @@ -2685,8 +2685,8 @@ void CMainFrame::OnLightRotateZ (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Z int rotation = (pgraphic_view->Get_Light_Rotation () ^ (CGraphicView::RotateZ)); @@ -2707,8 +2707,8 @@ void CMainFrame::OnLightRotateZBack (void) { CGraphicView *pgraphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - ASSERT (pgraphic_view != NULL); - if (pgraphic_view != NULL) { + ASSERT (pgraphic_view != nullptr); + if (pgraphic_view != nullptr) { // Start or stop the rotation around Y int rotation = (pgraphic_view->Get_Light_Rotation () ^ (CGraphicView::RotateZBack)); @@ -2767,7 +2767,7 @@ CMainFrame::OnDecLight (void) { CW3DViewDoc *pdoc = ::GetCurrentDocument (); LightClass *plight = pdoc->GetSceneLight (); - if (plight != NULL) { + if (plight != nullptr) { // Get the current light settings Vector3 diffuse; @@ -2796,7 +2796,7 @@ CMainFrame::OnIncLight (void) { CW3DViewDoc *pdoc = ::GetCurrentDocument (); LightClass *plight = pdoc->GetSceneLight (); - if (plight != NULL) { + if (plight != nullptr) { // Get the current light settings Vector3 diffuse; @@ -2824,7 +2824,7 @@ void CMainFrame::OnDecAmbientLight (void) { CW3DViewDoc *pdoc = ::GetCurrentDocument (); - if (pdoc->GetScene () != NULL) { + if (pdoc->GetScene () != nullptr) { // Get the current ambient light settings Vector3 color = pdoc->GetScene ()->Get_Ambient_Light (); @@ -2847,7 +2847,7 @@ void CMainFrame::OnIncAmbientLight (void) { CW3DViewDoc *pdoc = ::GetCurrentDocument (); - if (pdoc->GetScene () != NULL) { + if (pdoc->GetScene () != nullptr) { // Get the current ambient light settings Vector3 color = pdoc->GetScene ()->Get_Ambient_Light (); @@ -2886,7 +2886,7 @@ CMainFrame::OnMakeAggregate (void) CDataTreeView *pdata_tree = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); RenderObjClass *prender_obj = ::GetCurrentDocument ()->GetDisplayedObject (); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { // Build a definition object from the hierarchy AggregateDefClass *pdefinition = new AggregateDefClass (*prender_obj); @@ -2916,7 +2916,7 @@ CMainFrame::OnRenameAggregate (void) { // Get a pointer to the current aggregate RenderObjClass *prender_obj = (::GetCurrentDocument ())->GetDisplayedObject (); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { // Show the rename dialog to the user const char *old_name = prender_obj->Get_Name (); @@ -2996,7 +2996,7 @@ CMainFrame::OnCmdMsg // Hack to get MFC to enable the 'Editable Emitters List' submenu... if (nCode == CN_UPDATE_COMMAND_UI) { CCmdUI *pCmdUI = (CCmdUI *)pExtra; - if (pCmdUI != NULL && (pCmdUI->m_nID >= 1000) && (pCmdUI->m_nID < 1100)) { + if (pCmdUI != nullptr && (pCmdUI->m_nID >= 1000) && (pCmdUI->m_nID < 1100)) { pCmdUI->Enable (TRUE); return TRUE; } @@ -3016,7 +3016,7 @@ void CMainFrame::OnCrashApp (void) { // Usefull HACK to get the program to crash when needed... - LPTSTR hack = 0; + LPTSTR hack = nullptr; (*hack) = 0; return ; } @@ -3032,7 +3032,7 @@ CMainFrame::OnLODRecordScreenArea (void) { // Make sure the current object is an LOD RenderObjClass *prender_obj = ::GetCurrentDocument ()->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD)) { CGraphicView *graphic_view = (CGraphicView *)m_wndSplitter.GetPane (0, 1); @@ -3066,10 +3066,10 @@ CMainFrame::OnLODIncludeNull (void) { // Make sure the current object is an LOD RenderObjClass *prender_obj = ::GetCurrentDocument ()->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD)) { - // Toggle the NULL lod + // Toggle the nullptr lod bool include = ((HLodClass *)prender_obj)->Is_NULL_Lod_Included (); ((HLodClass *)prender_obj)->Include_NULL_Lod (!include); @@ -3091,7 +3091,7 @@ CMainFrame::OnUpdateLODIncludeNull (CCmdUI *pCmdUI) { // Make sure the current object is an LOD RenderObjClass *prender_obj = (::GetCurrentDocument ())->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD)) { // Check or uncheck the menu option depending on the state of the LOD @@ -3126,7 +3126,7 @@ CMainFrame::OnUpdateLodPrevLevel (CCmdUI *pCmdUI) { // Make sure the current object is an LOD RenderObjClass *prender_obj = (::GetCurrentDocument ())->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD)) { // Enable the menu option if there is a previous lod to display @@ -3161,7 +3161,7 @@ CMainFrame::OnUpdateLodNextLevel (CCmdUI *pCmdUI) { // Make sure the current object is an LOD RenderObjClass *prender_obj = (::GetCurrentDocument ())->GetDisplayedObject (); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD)) { // Enable the menu option if there is another lod to display @@ -3249,13 +3249,13 @@ CMainFrame::OnSaveScreenshot (void) { // Get the directory where this executable was run from TCHAR filename[MAX_PATH]; - ::GetModuleFileName (NULL, filename, sizeof (filename)); + ::GetModuleFileName (nullptr, filename, sizeof (filename)); // // Strip the filename from the path // LPTSTR ppath = ::strrchr (filename, '\\'); - if (ppath != NULL) { + if (ppath != nullptr) { ppath[0] = 0; } @@ -3294,7 +3294,7 @@ CMainFrame::Update_Emitters_List (void) } RenderObjClass *prender_obj = GetCurrentDocument ()->GetDisplayedObject (); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { DynamicVectorClass list; Build_Emitter_List (*prender_obj, list); @@ -3321,7 +3321,7 @@ void CMainFrame::OnSlideshowDown (void) { CDataTreeView *data_tree = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); - if (data_tree != NULL) { + if (data_tree != nullptr) { data_tree->Select_Next (); } @@ -3338,7 +3338,7 @@ void CMainFrame::OnSlideshowUp (void) { CDataTreeView *data_tree = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); - if (data_tree != NULL) { + if (data_tree != nullptr) { data_tree->Select_Prev (); } @@ -3470,13 +3470,13 @@ void CMainFrame::OnCopyAssets (void) { CString path; - if (::Browse_For_Folder (m_hWnd, NULL, path)) { + if (::Browse_For_Folder (m_hWnd, nullptr, path)) { // // Copy all dependent asset files to the selected directory // CW3DViewDoc *doc = ::GetCurrentDocument (); - if (doc != NULL) { + if (doc != nullptr) { doc->Copy_Assets_To_Dir (path); } } @@ -3494,12 +3494,12 @@ void CMainFrame::OnUpdateCopyAssets (CCmdUI *pCmdUI) { CW3DViewDoc *doc = ::GetCurrentDocument (); - if (doc != NULL) { + if (doc != nullptr) { // // Only enable this option if we are viewing an object // - pCmdUI->Enable (doc->GetDisplayedObject () != NULL); + pCmdUI->Enable (doc->GetDisplayedObject () != nullptr); } return ; @@ -3549,13 +3549,13 @@ CMainFrame::OnCreateSphere (void) // Clear the current display CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); if (doc) { - doc->DisplayObject ((RenderObjClass *)NULL); + doc->DisplayObject ((RenderObjClass *)nullptr); } // // Display the sphere property sheet // - SpherePropertySheetClass dialog (NULL, IDS_SPHERE_PROP_TITLE, this); + SpherePropertySheetClass dialog (nullptr, IDS_SPHERE_PROP_TITLE, this); dialog.DoModal (); return ; } @@ -3572,13 +3572,13 @@ CMainFrame::OnCreateRing (void) // Clear the current display CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); if (doc) { - doc->DisplayObject ((RenderObjClass *)NULL); + doc->DisplayObject ((RenderObjClass *)nullptr); } // // Display the ring property sheet // - RingPropertySheetClass dialog (NULL, IDS_RING_PROP_TITLE, this); + RingPropertySheetClass dialog (nullptr, IDS_RING_PROP_TITLE, this); dialog.DoModal (); return ; } @@ -3594,14 +3594,14 @@ CMainFrame::OnEditPrimitive (void) { // Get a pointer to the doc object CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); - if (doc != NULL) { + if (doc != nullptr) { // // Make a list of emitters containing the currently displayed emitter // RenderObjClass *render_obj = doc->GetDisplayedObject (); - if (render_obj != NULL) { + if (render_obj != nullptr) { if (render_obj->Class_ID () == RenderObjClass::CLASSID_SPHERE) { // @@ -3633,7 +3633,7 @@ void CMainFrame::OnUpdateEditPrimitive (CCmdUI *pCmdUI) { CDataTreeView *data_tree = (CDataTreeView *)m_wndSplitter.GetPane (0, 0); - if (data_tree != NULL && data_tree->GetCurrentSelectionType () == TypePrimitives) { + if (data_tree != nullptr && data_tree->GetCurrentSelectionType () == TypePrimitives) { pCmdUI->Enable (true); } else { pCmdUI->Enable (false); @@ -3679,7 +3679,7 @@ void CMainFrame::OnKillSceneLight() CW3DViewDoc *pdoc = ::GetCurrentDocument(); LightClass *plight = pdoc->GetSceneLight (); - if (plight != NULL) { + if (plight != nullptr) { const Vector3 black (0.0f, 0.0f, 0.0f); @@ -3827,7 +3827,7 @@ CMainFrame::OnAddToLineup (void) // that the objects we add in this manner are stacked in a horizontal // row, just like a lineup. CW3DViewDoc *pDoc = (CW3DViewDoc*)GetActiveDocument(); - ViewerSceneClass *pScene = NULL; + ViewerSceneClass *pScene = nullptr; if (pDoc) pScene = pDoc->GetScene(); CAddToLineupDialog dlg(pScene, this); @@ -3896,12 +3896,12 @@ CMainFrame::OnImportFacialAnims (void) // CW3DViewDoc *doc = ::GetCurrentDocument (); const HTreeClass *htree = doc->Get_Current_HTree (); - ASSERT (htree != NULL); - if (htree != NULL) { + ASSERT (htree != nullptr); + if (htree != nullptr) { CFileDialog dialog ( TRUE, ".txt", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT | OFN_EXPLORER, "Animation Description (*.txt)|*.txt||", this); @@ -3921,7 +3921,7 @@ CMainFrame::OnImportFacialAnims (void) // Loop over all the selected files // POSITION pos = dialog.GetStartPosition (); - while (pos != NULL) { + while (pos != nullptr) { // Ask the doc to load the assets from this file into memory CString filename = dialog.GetNextPathName (pos); @@ -3932,7 +3932,7 @@ CMainFrame::OnImportFacialAnims (void) // Re-load the data list to include all new assets // CDataTreeView *data_tree = doc->GetDataTreeView (); - if (data_tree != NULL) { + if (data_tree != nullptr) { data_tree->LoadAssetsIntoTree (); } } @@ -3951,14 +3951,14 @@ void CMainFrame::OnUpdateImportFacialAnims (CCmdUI *pCmdUI) { CW3DViewDoc *doc = ::GetCurrentDocument (); - if (doc != NULL) { + if (doc != nullptr) { // // Enable this command only if the user has an htree // currently selected // const HTreeClass *htree = doc->Get_Current_HTree (); - pCmdUI->Enable (htree != NULL); + pCmdUI->Enable (htree != nullptr); } return ; @@ -3974,7 +3974,7 @@ void CMainFrame::OnRestrictAnims (void) { CDataTreeView *data_tree = ::GetCurrentDocument ()->GetDataTreeView (); - if (data_tree != NULL) { + if (data_tree != nullptr) { bool enabled = data_tree->Are_Anims_Restricted (); data_tree->Restrict_Anims (!enabled); } @@ -3994,7 +3994,7 @@ CMainFrame::OnUpdateRestrictAnims (CCmdUI *pCmdUI) bool check = true; CDataTreeView *data_tree = ::GetCurrentDocument ()->GetDataTreeView (); - if (data_tree != NULL) { + if (data_tree != nullptr) { check = data_tree->Are_Anims_Restricted (); } @@ -4012,7 +4012,7 @@ void CMainFrame::OnBindSubobjectLod (void) { CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); - if (doc != NULL && doc->GetDisplayedObject () != NULL) { + if (doc != nullptr && doc->GetDisplayedObject () != nullptr) { // // Toggle the state of the currently displayed object @@ -4036,7 +4036,7 @@ void CMainFrame::OnUpdateBindSubobjectLod (CCmdUI *pCmdUI) { CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); - if (doc != NULL && doc->GetDisplayedObject () != NULL) { + if (doc != nullptr && doc->GetDisplayedObject () != nullptr) { // // Set the check if we are currenly forcing sub object matching @@ -4103,13 +4103,13 @@ CMainFrame::OnEditSoundObject (void) // Get a pointer to the doc object // CW3DViewDoc *doc = (CW3DViewDoc *)GetActiveDocument (); - if (doc != NULL) { + if (doc != nullptr) { // // Get a pointer to the currently displayed sound object // SoundRenderObjClass *sound_obj = (SoundRenderObjClass *)doc->GetDisplayedObject (); - if (sound_obj != NULL) { + if (sound_obj != nullptr) { // // Display the sound edit dialog @@ -4231,7 +4231,7 @@ void CMainFrame::OnCameraBonePosX() { CGraphicView *pCGraphicView = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - if (pCGraphicView != NULL) { + if (pCGraphicView != nullptr) { pCGraphicView->Set_Camera_Bone_Pos_X(!pCGraphicView->Is_Camera_Bone_Pos_X()); } } @@ -4246,7 +4246,7 @@ void CMainFrame::OnUpdateCameraBonePosX(CCmdUI* pCmdUI) { CGraphicView *pCGraphicView = (CGraphicView *)m_wndSplitter.GetPane (0, 1); - if (pCGraphicView != NULL) { + if (pCGraphicView != nullptr) { pCmdUI->SetCheck(pCGraphicView->Is_Camera_Bone_Pos_X()); } } diff --git a/Core/Tools/W3DView/MeshPropPage.cpp b/Core/Tools/W3DView/MeshPropPage.cpp index 701ead89ed8..fb766ddd8f7 100644 --- a/Core/Tools/W3DView/MeshPropPage.cpp +++ b/Core/Tools/W3DView/MeshPropPage.cpp @@ -169,7 +169,7 @@ CMeshPropPage::OnInitDialog (void) // Free the object pCMesh->Release_Ref (); - pCMesh = NULL; + pCMesh = nullptr; } } diff --git a/Core/Tools/W3DView/OpacitySettingsDialog.cpp b/Core/Tools/W3DView/OpacitySettingsDialog.cpp index 1651831971b..1d4faed13af 100644 --- a/Core/Tools/W3DView/OpacitySettingsDialog.cpp +++ b/Core/Tools/W3DView/OpacitySettingsDialog.cpp @@ -49,7 +49,7 @@ static char THIS_FILE[] = __FILE__; // ///////////////////////////////////////////////////////////////////////////// OpacitySettingsDialogClass::OpacitySettingsDialogClass (float opacity, CWnd *pParent) - : m_OpacityBar (NULL), + : m_OpacityBar (nullptr), m_Opacity (opacity), CDialog(OpacitySettingsDialogClass::IDD, pParent) { diff --git a/Core/Tools/W3DView/OpacitySettingsDialog.h b/Core/Tools/W3DView/OpacitySettingsDialog.h index f362a012e5b..216eeafdf90 100644 --- a/Core/Tools/W3DView/OpacitySettingsDialog.h +++ b/Core/Tools/W3DView/OpacitySettingsDialog.h @@ -31,7 +31,7 @@ class OpacitySettingsDialogClass : public CDialog { // Construction public: - OpacitySettingsDialogClass(float opacity, CWnd* pParent = NULL); // standard constructor + OpacitySettingsDialogClass(float opacity, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(OpacitySettingsDialogClass) diff --git a/Core/Tools/W3DView/OpacityVectorDialog.cpp b/Core/Tools/W3DView/OpacityVectorDialog.cpp index 39401fe94c4..8485ed1dbf1 100644 --- a/Core/Tools/W3DView/OpacityVectorDialog.cpp +++ b/Core/Tools/W3DView/OpacityVectorDialog.cpp @@ -42,9 +42,9 @@ static char THIS_FILE[] = __FILE__; // OpacityVectorDialogClass // ///////////////////////////////////////////////////////////////////////////// -OpacityVectorDialogClass::OpacityVectorDialogClass(CWnd* pParent /*=NULL*/) - : m_OpacityBar (NULL), - m_RenderObj (NULL), +OpacityVectorDialogClass::OpacityVectorDialogClass(CWnd* pParent /*=nullptr*/) + : m_OpacityBar (nullptr), + m_RenderObj (nullptr), m_KeyIndex (0), CDialog(OpacityVectorDialogClass::IDD, pParent) { @@ -244,7 +244,7 @@ OpacityVectorDialogClass::Update_Value (void) void OpacityVectorDialogClass::Update_Object (const AlphaVectorStruct &value) { - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { // // Determine what type of object this is diff --git a/Core/Tools/W3DView/OpacityVectorDialog.h b/Core/Tools/W3DView/OpacityVectorDialog.h index d2cc35fd877..cb074b87db6 100644 --- a/Core/Tools/W3DView/OpacityVectorDialog.h +++ b/Core/Tools/W3DView/OpacityVectorDialog.h @@ -34,7 +34,7 @@ class OpacityVectorDialogClass : public CDialog { // Construction public: - OpacityVectorDialogClass(CWnd* pParent = NULL); // standard constructor + OpacityVectorDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(OpacityVectorDialogClass) diff --git a/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.cpp b/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.cpp index 06aab5ef4e5..60f661d2ca4 100644 --- a/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.cpp +++ b/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.cpp @@ -78,7 +78,7 @@ BOOL ParticleBlurTimeKeyDialogClass::OnNotify(WPARAM wParam, LPARAM lParam, LRES // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h b/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h index 2339682a1e4..13b95fb09b4 100644 --- a/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h +++ b/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h @@ -28,7 +28,7 @@ class ParticleBlurTimeKeyDialogClass : public CDialog { // Construction public: - ParticleBlurTimeKeyDialogClass(float blur_time, CWnd* pParent = NULL); // standard constructor + ParticleBlurTimeKeyDialogClass(float blur_time, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ParticleBlurTimeKeyDialogClass) diff --git a/Core/Tools/W3DView/ParticleFrameKeyDialog.cpp b/Core/Tools/W3DView/ParticleFrameKeyDialog.cpp index 9a0c7da7a4c..32632555fa7 100644 --- a/Core/Tools/W3DView/ParticleFrameKeyDialog.cpp +++ b/Core/Tools/W3DView/ParticleFrameKeyDialog.cpp @@ -34,7 +34,7 @@ static char THIS_FILE[] = __FILE__; // ParticleFrameKeyDialogClass dialog -ParticleFrameKeyDialogClass::ParticleFrameKeyDialogClass(float frame,CWnd* pParent /*=NULL*/) : +ParticleFrameKeyDialogClass::ParticleFrameKeyDialogClass(float frame,CWnd* pParent /*=nullptr*/) : CDialog(ParticleFrameKeyDialogClass::IDD, pParent), m_Frame(frame) { @@ -85,7 +85,7 @@ BOOL ParticleFrameKeyDialogClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/ParticleFrameKeyDialog.h b/Core/Tools/W3DView/ParticleFrameKeyDialog.h index 03f045ec1ed..6491a749290 100644 --- a/Core/Tools/W3DView/ParticleFrameKeyDialog.h +++ b/Core/Tools/W3DView/ParticleFrameKeyDialog.h @@ -28,7 +28,7 @@ class ParticleFrameKeyDialogClass : public CDialog { // Construction public: - ParticleFrameKeyDialogClass(float frame,CWnd* pParent = NULL); // standard constructor + ParticleFrameKeyDialogClass(float frame,CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ParticleFrameKeyDialogClass) diff --git a/Core/Tools/W3DView/ParticleRotationKeyDialog.cpp b/Core/Tools/W3DView/ParticleRotationKeyDialog.cpp index 7607c77cec7..66b608c4b09 100644 --- a/Core/Tools/W3DView/ParticleRotationKeyDialog.cpp +++ b/Core/Tools/W3DView/ParticleRotationKeyDialog.cpp @@ -35,7 +35,7 @@ static char THIS_FILE[] = __FILE__; // ParticleRotationKeyDialogClass constructor // ///////////////////////////////////////////////////////////////////////////// -ParticleRotationKeyDialogClass::ParticleRotationKeyDialogClass(float rotation,CWnd* pParent /*=NULL*/) : +ParticleRotationKeyDialogClass::ParticleRotationKeyDialogClass(float rotation,CWnd* pParent /*=nullptr*/) : CDialog(ParticleRotationKeyDialogClass::IDD, pParent), m_Rotation(rotation) { @@ -108,7 +108,7 @@ BOOL ParticleRotationKeyDialogClass::OnNotify(WPARAM wParam, LPARAM lParam, LRES // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/ParticleRotationKeyDialog.h b/Core/Tools/W3DView/ParticleRotationKeyDialog.h index 37df1e0f41e..6df2856bec6 100644 --- a/Core/Tools/W3DView/ParticleRotationKeyDialog.h +++ b/Core/Tools/W3DView/ParticleRotationKeyDialog.h @@ -28,7 +28,7 @@ class ParticleRotationKeyDialogClass : public CDialog { // Construction public: - ParticleRotationKeyDialogClass(float rotation,CWnd* pParent = NULL); // standard constructor + ParticleRotationKeyDialogClass(float rotation,CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ParticleRotationKeyDialogClass) diff --git a/Core/Tools/W3DView/ParticleSizeDialog.cpp b/Core/Tools/W3DView/ParticleSizeDialog.cpp index c8a56a2be89..1506093d51f 100644 --- a/Core/Tools/W3DView/ParticleSizeDialog.cpp +++ b/Core/Tools/W3DView/ParticleSizeDialog.cpp @@ -118,7 +118,7 @@ ParticleSizeDialogClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/ParticleSizeDialog.h b/Core/Tools/W3DView/ParticleSizeDialog.h index 80bb2be66aa..86c664797c1 100644 --- a/Core/Tools/W3DView/ParticleSizeDialog.h +++ b/Core/Tools/W3DView/ParticleSizeDialog.h @@ -28,7 +28,7 @@ class ParticleSizeDialogClass : public CDialog { // Construction public: - ParticleSizeDialogClass (float size, CWnd* pParent = NULL); // standard constructor + ParticleSizeDialogClass (float size, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ParticleSizeDialogClass) diff --git a/Core/Tools/W3DView/PlaySoundDialog.cpp b/Core/Tools/W3DView/PlaySoundDialog.cpp index a15b28e23ac..b97ab602238 100644 --- a/Core/Tools/W3DView/PlaySoundDialog.cpp +++ b/Core/Tools/W3DView/PlaySoundDialog.cpp @@ -37,9 +37,9 @@ static char THIS_FILE[] = __FILE__; // PlaySoundDialogClass // ///////////////////////////////////////////////////////////////////////////// -PlaySoundDialogClass::PlaySoundDialogClass(LPCTSTR filename, CWnd* pParent /*=NULL*/) +PlaySoundDialogClass::PlaySoundDialogClass(LPCTSTR filename, CWnd* pParent /*=nullptr*/) : Filename (filename), - SoundObj (NULL), + SoundObj (nullptr), CDialog(PlaySoundDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(PlaySoundDialogClass) @@ -81,8 +81,8 @@ END_MESSAGE_MAP() void PlaySoundDialogClass::OnPlaySoundEffect (void) { - ASSERT (SoundObj != NULL); - if (SoundObj != NULL) { + ASSERT (SoundObj != nullptr); + if (SoundObj != nullptr) { SoundObj->Stop (); SoundObj->Play (); } @@ -126,7 +126,7 @@ PlaySoundDialogClass::OnInitDialog (void) // Create the sound effect so we can play it // SoundObj = WWAudioClass::Get_Instance ()->Create_Sound_Effect (Filename); - if (SoundObj == NULL) { + if (SoundObj == nullptr) { CString message; message.Format ("Cannot find sound file: %s!", (LPCTSTR)Filename, MB_OK); MessageBox (message, "File Not Found", MB_ICONEXCLAMATION | MB_OK); @@ -147,8 +147,8 @@ PlaySoundDialogClass::OnInitDialog (void) void PlaySoundDialogClass::OnStopSoundEffect (void) { - ASSERT (SoundObj != NULL); - if (SoundObj != NULL) { + ASSERT (SoundObj != nullptr); + if (SoundObj != nullptr) { SoundObj->Stop (); } diff --git a/Core/Tools/W3DView/PlaySoundDialog.h b/Core/Tools/W3DView/PlaySoundDialog.h index eed77d841bc..265b8878942 100644 --- a/Core/Tools/W3DView/PlaySoundDialog.h +++ b/Core/Tools/W3DView/PlaySoundDialog.h @@ -31,7 +31,7 @@ class PlaySoundDialogClass : public CDialog { // Construction public: - PlaySoundDialogClass(LPCTSTR filename, CWnd* pParent = NULL); // standard constructor + PlaySoundDialogClass(LPCTSTR filename, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(PlaySoundDialogClass) diff --git a/Core/Tools/W3DView/ResolutionDialog.cpp b/Core/Tools/W3DView/ResolutionDialog.cpp index 1846b3dcb83..05420b607ce 100644 --- a/Core/Tools/W3DView/ResolutionDialog.cpp +++ b/Core/Tools/W3DView/ResolutionDialog.cpp @@ -42,7 +42,7 @@ static char THIS_FILE[] = __FILE__; // ResolutionDialogClass // ///////////////////////////////////////////////////////////////////////////// -ResolutionDialogClass::ResolutionDialogClass(CWnd* pParent /*=NULL*/) +ResolutionDialogClass::ResolutionDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(ResolutionDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(ResolutionDialogClass) diff --git a/Core/Tools/W3DView/ResolutionDialog.h b/Core/Tools/W3DView/ResolutionDialog.h index b826814f73b..9882ff5b949 100644 --- a/Core/Tools/W3DView/ResolutionDialog.h +++ b/Core/Tools/W3DView/ResolutionDialog.h @@ -30,7 +30,7 @@ class ResolutionDialogClass : public CDialog { // Construction public: - ResolutionDialogClass(CWnd* pParent = NULL); // standard constructor + ResolutionDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ResolutionDialogClass) diff --git a/Core/Tools/W3DView/RestrictedFileDialog.h b/Core/Tools/W3DView/RestrictedFileDialog.h index 2c4e7640e5a..4aaed15232f 100644 --- a/Core/Tools/W3DView/RestrictedFileDialog.h +++ b/Core/Tools/W3DView/RestrictedFileDialog.h @@ -30,11 +30,11 @@ class RestrictedFileDialogClass : public CFileDialog public: RestrictedFileDialogClass(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, + LPCTSTR lpszDefExt = nullptr, + LPCTSTR lpszFileName = nullptr, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - LPCTSTR lpszFilter = NULL, - CWnd* pParentWnd = NULL); + LPCTSTR lpszFilter = nullptr, + CWnd* pParentWnd = nullptr); protected: //{{AFX_MSG(RestrictedFileDialogClass) diff --git a/Core/Tools/W3DView/RingColorPropPage.cpp b/Core/Tools/W3DView/RingColorPropPage.cpp index 383616d1aeb..e60863d5473 100644 --- a/Core/Tools/W3DView/RingColorPropPage.cpp +++ b/Core/Tools/W3DView/RingColorPropPage.cpp @@ -44,8 +44,8 @@ IMPLEMENT_DYNCREATE(RingColorPropPageClass, CPropertyPage) RingColorPropPageClass::RingColorPropPageClass (RingRenderObjClass *ring) : m_RenderObj (ring), m_bValid (true), - m_ColorBar (NULL), - m_OpacityBar (NULL), + m_ColorBar (nullptr), + m_OpacityBar (nullptr), CPropertyPage(RingColorPropPageClass::IDD) { //{{AFX_DATA_INIT(RingColorPropPageClass) @@ -104,7 +104,7 @@ RingColorPropPageClass::Initialize (void) m_AlphaChannel.Reset (); m_OrigAlphaChannel.Reset (); - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { m_ColorChannel = m_RenderObj->Get_Color_Channel (); m_OrigColorChannel = m_RenderObj->Get_Color_Channel (); diff --git a/Core/Tools/W3DView/RingColorPropPage.h b/Core/Tools/W3DView/RingColorPropPage.h index 63bd6d40a63..b39bd6303c2 100644 --- a/Core/Tools/W3DView/RingColorPropPage.h +++ b/Core/Tools/W3DView/RingColorPropPage.h @@ -36,7 +36,7 @@ class RingColorPropPageClass : public CPropertyPage // Construction public: - RingColorPropPageClass (RingRenderObjClass *ring = NULL); + RingColorPropPageClass (RingRenderObjClass *ring = nullptr); ~RingColorPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/RingGeneralPropPage.cpp b/Core/Tools/W3DView/RingGeneralPropPage.cpp index 25a931856aa..aec2b8bbf42 100644 --- a/Core/Tools/W3DView/RingGeneralPropPage.cpp +++ b/Core/Tools/W3DView/RingGeneralPropPage.cpp @@ -97,13 +97,13 @@ END_MESSAGE_MAP() void RingGeneralPropPageClass::Initialize (void) { - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { // // Get the object's texture // TextureClass *texture = m_RenderObj->Peek_Texture (); - if (texture != NULL) { + if (texture != nullptr) { m_TextureFilename = texture->Get_Texture_Name (); } @@ -212,7 +212,7 @@ RingGeneralPropPageClass::OnApply (void) int index = SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETCURSEL); if (index != CB_ERR) { ShaderClass *shader = (ShaderClass *)SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETITEMDATA, (WPARAM)index); - if (shader != NULL) { + if (shader != nullptr) { m_Shader = (*shader); } } @@ -227,7 +227,7 @@ RingGeneralPropPageClass::OnApply (void) // // Create a texture and pass it onto the object // - TextureClass *texture = NULL; + TextureClass *texture = nullptr; if (m_TextureFilename.GetLength () > 0) { texture = WW3DAssetManager::Get_Instance ()->Get_Texture (::Get_Filename_From_Path (m_TextureFilename)); } @@ -264,7 +264,7 @@ RingGeneralPropPageClass::OnBrowseButton (void) { CFileDialog dialog ( TRUE, ".tga", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "Textures files (*.tga)|*.tga||", ::AfxGetMainWnd ()); @@ -322,7 +322,7 @@ RingGeneralPropPageClass::OnNotify // Update the spinner control if necessary // NMHDR *header = (NMHDR *)lParam; - if ((header != NULL) && (header->code == UDN_DELTAPOS)) { + if ((header != nullptr) && (header->code == UDN_DELTAPOS)) { LPNMUPDOWN updown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (header->hwndFrom, updown->iDelta); } diff --git a/Core/Tools/W3DView/RingGeneralPropPage.h b/Core/Tools/W3DView/RingGeneralPropPage.h index c09517824a7..4881ed4eebd 100644 --- a/Core/Tools/W3DView/RingGeneralPropPage.h +++ b/Core/Tools/W3DView/RingGeneralPropPage.h @@ -36,7 +36,7 @@ class RingGeneralPropPageClass : public CPropertyPage // Construction public: - RingGeneralPropPageClass (RingRenderObjClass *ring = NULL); + RingGeneralPropPageClass (RingRenderObjClass *ring = nullptr); ~RingGeneralPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/RingPropertySheet.cpp b/Core/Tools/W3DView/RingPropertySheet.cpp index 51ca2e8a787..87d9710bf25 100644 --- a/Core/Tools/W3DView/RingPropertySheet.cpp +++ b/Core/Tools/W3DView/RingPropertySheet.cpp @@ -48,7 +48,7 @@ RingPropertySheetClass::RingPropertySheetClass CWnd * pParentWnd, UINT iSelectPage ) - : m_RenderObj (NULL), + : m_RenderObj (nullptr), CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { REF_PTR_SET (m_RenderObj, ring); @@ -69,7 +69,7 @@ RingPropertySheetClass::RingPropertySheetClass CWnd * pParentWnd, UINT iSelectPage ) - : m_RenderObj (NULL), + : m_RenderObj (nullptr), CPropertySheet(pszCaption, pParentWnd, iSelectPage) { REF_PTR_SET (m_RenderObj, ring); @@ -178,7 +178,7 @@ void RingPropertySheetClass::Add_Object_To_Viewer (void) { CW3DViewDoc *doc = ::GetCurrentDocument (); - if ((doc != NULL) && (m_RenderObj != NULL)) { + if ((doc != nullptr) && (m_RenderObj != nullptr)) { // // Create a new prototype for this object @@ -239,7 +239,7 @@ RingPropertySheetClass::Update_Object (void) void RingPropertySheetClass::Initialize (void) { - if (m_RenderObj == NULL) { + if (m_RenderObj == nullptr) { Create_New_Object (); } else { m_LastSavedName = m_RenderObj->Get_Name (); diff --git a/Core/Tools/W3DView/RingPropertySheet.h b/Core/Tools/W3DView/RingPropertySheet.h index d221010715d..5bef56bf104 100644 --- a/Core/Tools/W3DView/RingPropertySheet.h +++ b/Core/Tools/W3DView/RingPropertySheet.h @@ -58,8 +58,8 @@ class RingPropertySheetClass : public CPropertySheet // Construction public: - RingPropertySheetClass (RingRenderObjClass *ring, UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); - RingPropertySheetClass (RingRenderObjClass *ring, LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + RingPropertySheetClass (RingRenderObjClass *ring, UINT nIDCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0); + RingPropertySheetClass (RingRenderObjClass *ring, LPCTSTR pszCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0); // Attributes public: diff --git a/Core/Tools/W3DView/RingSizePropPage.cpp b/Core/Tools/W3DView/RingSizePropPage.cpp index bd2ce010146..c5d0c322823 100644 --- a/Core/Tools/W3DView/RingSizePropPage.cpp +++ b/Core/Tools/W3DView/RingSizePropPage.cpp @@ -50,10 +50,10 @@ static bool Is_LERP (float last_value, float last_time, float curr_value, float RingSizePropPageClass::RingSizePropPageClass (RingRenderObjClass *ring) : m_RenderObj (ring), m_bValid (true), - m_InnerScaleXBar (NULL), - m_InnerScaleYBar (NULL), - m_OuterScaleXBar (NULL), - m_OuterScaleYBar (NULL), + m_InnerScaleXBar (nullptr), + m_InnerScaleYBar (nullptr), + m_OuterScaleXBar (nullptr), + m_OuterScaleYBar (nullptr), m_InnerSize (0.5F, 0.5F), m_OuterSize (1.0F, 1.0F), CPropertyPage(RingSizePropPageClass::IDD) @@ -117,7 +117,7 @@ RingSizePropPageClass::Initialize (void) m_OuterScaleChannel.Reset (); m_OrigOuterScaleChannel.Reset (); - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { m_InnerSize = m_RenderObj->Get_Inner_Extent (); m_OuterSize = m_RenderObj->Get_Outer_Extent (); @@ -372,7 +372,7 @@ RingSizePropPageClass::OnNotify // // Determine the timeline bar which sent the notification // - ColorBarClass *timeline = NULL; + ColorBarClass *timeline = nullptr; if (color_bar_hdr->hdr.idFrom == IDC_INNER_SCALE_BAR_X) { timeline = m_InnerScaleXBar; } else if (color_bar_hdr->hdr.idFrom == IDC_INNER_SCALE_BAR_Y) { diff --git a/Core/Tools/W3DView/RingSizePropPage.h b/Core/Tools/W3DView/RingSizePropPage.h index 22def9c8f5a..384f310c62d 100644 --- a/Core/Tools/W3DView/RingSizePropPage.h +++ b/Core/Tools/W3DView/RingSizePropPage.h @@ -36,7 +36,7 @@ class RingSizePropPageClass : public CPropertyPage // Construction public: - RingSizePropPageClass(RingRenderObjClass *ring = NULL); + RingSizePropPageClass(RingRenderObjClass *ring = nullptr); ~RingSizePropPageClass(); // Dialog Data diff --git a/Core/Tools/W3DView/SaveSettingsDialog.cpp b/Core/Tools/W3DView/SaveSettingsDialog.cpp index 8746417aa0d..ac4ad7acdec 100644 --- a/Core/Tools/W3DView/SaveSettingsDialog.cpp +++ b/Core/Tools/W3DView/SaveSettingsDialog.cpp @@ -40,7 +40,7 @@ static char THIS_FILE[] = __FILE__; // // CSaveSettingsDialog // -CSaveSettingsDialog::CSaveSettingsDialog (CWnd* pParent /*=NULL*/) +CSaveSettingsDialog::CSaveSettingsDialog (CWnd* pParent /*=nullptr*/) : CDialog(CSaveSettingsDialog::IDD, pParent) { //{{AFX_DATA_INIT(CSaveSettingsDialog) @@ -100,7 +100,7 @@ void CSaveSettingsDialog::OnBrowseButton (void) { TCHAR szFileName[MAX_PATH]; - ::GetModuleFileName (NULL, szFileName, sizeof (szFileName)); + ::GetModuleFileName (nullptr, szFileName, sizeof (szFileName)); LPTSTR pszPath = ::strrchr (szFileName, '\\'); if (pszPath) { diff --git a/Core/Tools/W3DView/SaveSettingsDialog.h b/Core/Tools/W3DView/SaveSettingsDialog.h index 859caeda99f..744144a0577 100644 --- a/Core/Tools/W3DView/SaveSettingsDialog.h +++ b/Core/Tools/W3DView/SaveSettingsDialog.h @@ -28,7 +28,7 @@ class CSaveSettingsDialog : public CDialog { // Construction public: - CSaveSettingsDialog(CWnd* pParent = NULL); // standard constructor + CSaveSettingsDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CSaveSettingsDialog) diff --git a/Core/Tools/W3DView/ScaleDialog.cpp b/Core/Tools/W3DView/ScaleDialog.cpp index 287f7da9001..78525e285ba 100644 --- a/Core/Tools/W3DView/ScaleDialog.cpp +++ b/Core/Tools/W3DView/ScaleDialog.cpp @@ -138,7 +138,7 @@ ScaleDialogClass::OnNotify // Update the spinner control if necessary // NMHDR *header = (NMHDR *)lParam; - if ((header != NULL) && (header->code == UDN_DELTAPOS)) { + if ((header != nullptr) && (header->code == UDN_DELTAPOS)) { //LPNMUPDOWN updown = (LPNMUPDOWN)lParam; //::Update_Spinner_Buddy (header->hwndFrom, updown->iDelta); } diff --git a/Core/Tools/W3DView/ScaleDialog.h b/Core/Tools/W3DView/ScaleDialog.h index f01746b3c53..ad685ffa7b0 100644 --- a/Core/Tools/W3DView/ScaleDialog.h +++ b/Core/Tools/W3DView/ScaleDialog.h @@ -29,7 +29,7 @@ class ScaleDialogClass : public CDialog { // Construction public: - ScaleDialogClass (float scale, CWnd* pParent=NULL, const char *prompt_string=""); + ScaleDialogClass (float scale, CWnd* pParent=nullptr, const char *prompt_string=""); // Dialog Data //{{AFX_DATA(ScaleDialogClass) diff --git a/Core/Tools/W3DView/SceneLightDialog.cpp b/Core/Tools/W3DView/SceneLightDialog.cpp index 0a1ddd85d59..b379c0c3550 100644 --- a/Core/Tools/W3DView/SceneLightDialog.cpp +++ b/Core/Tools/W3DView/SceneLightDialog.cpp @@ -40,7 +40,7 @@ static char THIS_FILE[] = __FILE__; // // CSceneLightDialog // -CSceneLightDialog::CSceneLightDialog(CWnd* pParent /*=NULL*/) +CSceneLightDialog::CSceneLightDialog(CWnd* pParent /*=nullptr*/) : m_CurrentChannel (DIFFUSE), m_InitialStartAtten (0), m_InitialEndAtten (0), @@ -138,7 +138,7 @@ CSceneLightDialog::OnInitDialog (void) // Attempt to calculate the light's distance from the object float distance = 0; - if (pCDoc->GetDisplayedObject () != NULL) { + if (pCDoc->GetDisplayedObject () != nullptr) { // Get the position of the light and the displayed object Vector3 light_pos = pCDoc->GetSceneLight ()->Get_Position (); @@ -299,7 +299,7 @@ CSceneLightDialog::WindowProc { // Did this notification come from a spin control? NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; // Get the buddy window associated with this spin control diff --git a/Core/Tools/W3DView/SceneLightDialog.h b/Core/Tools/W3DView/SceneLightDialog.h index 0dc4c05a1d6..5f36ee64d4a 100644 --- a/Core/Tools/W3DView/SceneLightDialog.h +++ b/Core/Tools/W3DView/SceneLightDialog.h @@ -32,7 +32,7 @@ class CSceneLightDialog : public CDialog { // Construction public: - CSceneLightDialog(CWnd* pParent = NULL); // standard constructor + CSceneLightDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CSceneLightDialog) diff --git a/Core/Tools/W3DView/ScreenCursor.cpp b/Core/Tools/W3DView/ScreenCursor.cpp index 28917a34f4f..cc4d18f95ef 100644 --- a/Core/Tools/W3DView/ScreenCursor.cpp +++ b/Core/Tools/W3DView/ScreenCursor.cpp @@ -53,11 +53,11 @@ /////////////////////////////////////////////////////////////////// ScreenCursorClass::ScreenCursorClass (void) : m_ScreenPos (0, 0), - m_pTexture (NULL), - m_pVertMaterial (NULL), + m_pTexture (nullptr), + m_pVertMaterial (nullptr), m_Width (0), m_Height (0), - m_hWnd (NULL) + m_hWnd (nullptr) { Initialize (); return ; @@ -71,9 +71,9 @@ ScreenCursorClass::ScreenCursorClass (void) /////////////////////////////////////////////////////////////////// ScreenCursorClass::ScreenCursorClass (const ScreenCursorClass &src) : m_ScreenPos (0, 0), - m_pTexture (NULL), - m_hWnd (NULL), - m_pVertMaterial (NULL), + m_pTexture (nullptr), + m_hWnd (nullptr), + m_pVertMaterial (nullptr), m_Width (0), m_Height (0), RenderObjClass (src) @@ -156,7 +156,7 @@ ScreenCursorClass::Set_Texture (TextureClass *texture) REF_PTR_SET (m_pTexture, texture); // Find the dimensions of the texture: - if (m_pTexture != NULL) { + if (m_pTexture != nullptr) { m_Width = m_pTexture->Get_Width(); m_Height = m_pTexture->Get_Height(); } @@ -179,7 +179,7 @@ ScreenCursorClass::On_Frame_Update (void) POINT point = { 0 }; ::GetCursorPos (&point); - if (m_hWnd != NULL) { + if (m_hWnd != nullptr) { // // Normalize the screen position @@ -359,7 +359,7 @@ ScreenCursorClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const void ScreenCursorClass::Notify_Added (SceneClass * scene) { - if (scene != NULL) { + if (scene != nullptr) { scene->Register (this, SceneClass::ON_FRAME_UPDATE); } @@ -375,7 +375,7 @@ ScreenCursorClass::Notify_Added (SceneClass * scene) void ScreenCursorClass::Notify_Removed (SceneClass * scene) { - if (scene != NULL) { + if (scene != nullptr) { scene->Unregister (this, SceneClass::ON_FRAME_UPDATE); } diff --git a/Core/Tools/W3DView/SoundEditDialog.cpp b/Core/Tools/W3DView/SoundEditDialog.cpp index b14bccb37e3..43af96e09b7 100644 --- a/Core/Tools/W3DView/SoundEditDialog.cpp +++ b/Core/Tools/W3DView/SoundEditDialog.cpp @@ -59,7 +59,7 @@ static char THIS_FILE[] = __FILE__; // ///////////////////////////////////////////////////////////////////////////// SoundEditDialogClass::SoundEditDialogClass (CWnd *parent) - : SoundRObj (NULL), + : SoundRObj (nullptr), CDialog (SoundEditDialogClass::IDD, parent) { //{{AFX_DATA_INIT(SoundEditDialogClass) @@ -139,7 +139,7 @@ SoundEditDialogClass::OnInitDialog (void) // // Create the reneder object if we don't already have one // - if (SoundRObj == NULL) { + if (SoundRObj == nullptr) { SoundRObj = new SoundRenderObjClass; } @@ -161,18 +161,18 @@ SoundEditDialogClass::OnInitDialog (void) // Get the real settings from the sound object (if we have one) // AudibleSoundClass *sound = SoundRObj->Peek_Sound (); - if (sound != NULL) { + if (sound != nullptr) { Sound3DClass *sound_3d = sound->As_Sound3DClass (); filename = sound->Get_Filename (); drop_off_radius = sound->Get_DropOff_Radius (); priority = sound->Peek_Priority (); - is_3d = (sound_3d != NULL); + is_3d = (sound_3d != nullptr); is_music = (sound->Get_Type () == AudibleSoundClass::TYPE_MUSIC); loop_count = sound->Get_Loop_Count (); volume = sound->Get_Volume (); - if (sound_3d != NULL) { + if (sound_3d != nullptr) { max_vol_radius = sound_3d->Get_Max_Vol_Radius (); } } @@ -267,7 +267,7 @@ SoundEditDialogClass::OnOK (void) // Add this sound object to the viewer // CW3DViewDoc *doc = ::GetCurrentDocument (); - if (doc != NULL) { + if (doc != nullptr) { // // Create a new prototype for this emitter and add it to the asset manager @@ -309,7 +309,7 @@ SoundEditDialogClass::OnOK (void) AudibleSoundClass * SoundEditDialogClass::Create_Sound_Object (void) { - AudibleSoundClass *sound = NULL; + AudibleSoundClass *sound = nullptr; // // Get the filename @@ -328,7 +328,7 @@ SoundEditDialogClass::Create_Sound_Object (void) sound = WWAudioClass::Get_Instance ()->Create_Sound_Effect (filename); } - if (sound != NULL) { + if (sound != nullptr) { // // Pass the new volume and priority onto the sound diff --git a/Core/Tools/W3DView/SoundEditDialog.h b/Core/Tools/W3DView/SoundEditDialog.h index 6cf71c059f9..4540570a503 100644 --- a/Core/Tools/W3DView/SoundEditDialog.h +++ b/Core/Tools/W3DView/SoundEditDialog.h @@ -85,7 +85,7 @@ class SoundEditDialogClass : public CDialog // Public methods /////////////////////////////////////////////////////// void Set_Sound (SoundRenderObjClass *sound) { REF_PTR_SET (SoundRObj, sound); } - SoundRenderObjClass * Get_Sound (void) const { if (SoundRObj != NULL) SoundRObj->Add_Ref (); return SoundRObj; } + SoundRenderObjClass * Get_Sound (void) const { if (SoundRObj != nullptr) SoundRObj->Add_Ref (); return SoundRObj; } protected: diff --git a/Core/Tools/W3DView/SphereColorPropPage.cpp b/Core/Tools/W3DView/SphereColorPropPage.cpp index 51f2dc616f5..491648db456 100644 --- a/Core/Tools/W3DView/SphereColorPropPage.cpp +++ b/Core/Tools/W3DView/SphereColorPropPage.cpp @@ -44,8 +44,8 @@ IMPLEMENT_DYNCREATE(SphereColorPropPageClass, CPropertyPage) SphereColorPropPageClass::SphereColorPropPageClass (SphereRenderObjClass *sphere) : m_RenderObj (sphere), m_bValid (true), - m_ColorBar (NULL), - m_OpacityBar (NULL), + m_ColorBar (nullptr), + m_OpacityBar (nullptr), m_EnableOpactiyVector (false), m_InvertVector (false), CPropertyPage(SphereColorPropPageClass::IDD) @@ -110,7 +110,7 @@ SphereColorPropPageClass::Initialize (void) m_VectorChannel.Reset (); m_OrigVectorChannel.Reset (); - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { m_ColorChannel = m_RenderObj->Get_Color_Channel (); m_OrigColorChannel = m_RenderObj->Get_Color_Channel (); @@ -247,7 +247,7 @@ SphereColorPropPageClass::OnDestroy (void) int count = m_VectorBar->Get_Point_Count (); for (int index = 0; index < count; index ++) { AlphaVectorStruct *data = (AlphaVectorStruct *)m_VectorBar->Get_User_Data (index); - if (data != NULL) { + if (data != nullptr) { delete data; m_VectorBar->Set_User_Data (index, 0L); } @@ -354,7 +354,7 @@ SphereColorPropPageClass::OnNotify if (color_bar_hdr->hdr.code == CBRN_DBLCLK_POINT) { AlphaVectorStruct *data = (AlphaVectorStruct *)m_VectorBar->Get_User_Data (color_bar_hdr->key_index); - if (data != NULL) { + if (data != nullptr) { // // Set-up the dialog so the user can edit this keyframe @@ -385,7 +385,7 @@ SphereColorPropPageClass::OnNotify AlphaVectorStruct *next_data = (AlphaVectorStruct *)m_VectorBar->Get_User_Data (color_bar_hdr->key_index + 1); AlphaVectorStruct *new_data = new AlphaVectorStruct; - if (next_data == NULL) { + if (next_data == nullptr) { (*new_data) = (*prev_data); } else { @@ -542,7 +542,7 @@ SphereColorPropPageClass::Update_Vectors (void) m_VectorBar->Get_Point (index, &position, &red, &green, &blue); AlphaVectorStruct *data = (AlphaVectorStruct *)m_VectorBar->Get_User_Data (index); - if (data != NULL) { + if (data != nullptr) { m_VectorChannel.Add_Key (*data, position); } } diff --git a/Core/Tools/W3DView/SphereColorPropPage.h b/Core/Tools/W3DView/SphereColorPropPage.h index a461d862c78..aaf4b803f20 100644 --- a/Core/Tools/W3DView/SphereColorPropPage.h +++ b/Core/Tools/W3DView/SphereColorPropPage.h @@ -36,7 +36,7 @@ class SphereColorPropPageClass : public CPropertyPage // Construction public: - SphereColorPropPageClass (SphereRenderObjClass *sphere = NULL); + SphereColorPropPageClass (SphereRenderObjClass *sphere = nullptr); ~SphereColorPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/SphereGeneralPropPage.cpp b/Core/Tools/W3DView/SphereGeneralPropPage.cpp index 9e8b57fa5f7..0b0698c3f92 100644 --- a/Core/Tools/W3DView/SphereGeneralPropPage.cpp +++ b/Core/Tools/W3DView/SphereGeneralPropPage.cpp @@ -95,13 +95,13 @@ END_MESSAGE_MAP() void SphereGeneralPropPageClass::Initialize (void) { - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { // // Get the object's texture // TextureClass *texture = m_RenderObj->Peek_Texture (); - if (texture != NULL) { + if (texture != nullptr) { m_TextureFilename = texture->Get_Texture_Name(); } @@ -204,7 +204,7 @@ SphereGeneralPropPageClass::OnApply (void) int index = SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETCURSEL); if (index != CB_ERR) { ShaderClass *shader = (ShaderClass *)SendDlgItemMessage (IDC_SHADER_COMBO, CB_GETITEMDATA, (WPARAM)index); - if (shader != NULL) { + if (shader != nullptr) { m_Shader = (*shader); } } @@ -219,7 +219,7 @@ SphereGeneralPropPageClass::OnApply (void) // // Create a texture and pass it onto the object // - TextureClass *texture = NULL; + TextureClass *texture = nullptr; if (m_TextureFilename.GetLength () > 0) { texture = WW3DAssetManager::Get_Instance ()->Get_Texture (::Get_Filename_From_Path (m_TextureFilename)); } @@ -255,7 +255,7 @@ SphereGeneralPropPageClass::OnBrowseButton (void) { CFileDialog dialog ( TRUE, ".tga", - NULL, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, "Textures files (*.tga)|*.tga||", ::AfxGetMainWnd ()); @@ -313,7 +313,7 @@ SphereGeneralPropPageClass::OnNotify // Update the spinner control if necessary // NMHDR *header = (NMHDR *)lParam; - if ((header != NULL) && (header->code == UDN_DELTAPOS)) { + if ((header != nullptr) && (header->code == UDN_DELTAPOS)) { LPNMUPDOWN updown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (header->hwndFrom, updown->iDelta); } diff --git a/Core/Tools/W3DView/SphereGeneralPropPage.h b/Core/Tools/W3DView/SphereGeneralPropPage.h index f3e3c919edb..a4210a7d5fe 100644 --- a/Core/Tools/W3DView/SphereGeneralPropPage.h +++ b/Core/Tools/W3DView/SphereGeneralPropPage.h @@ -36,7 +36,7 @@ class SphereGeneralPropPageClass : public CPropertyPage // Construction public: - SphereGeneralPropPageClass (SphereRenderObjClass *sphere = NULL); + SphereGeneralPropPageClass (SphereRenderObjClass *sphere = nullptr); ~SphereGeneralPropPageClass (); // Dialog Data diff --git a/Core/Tools/W3DView/SpherePropertySheet.cpp b/Core/Tools/W3DView/SpherePropertySheet.cpp index 400f73d6311..28a4433dd94 100644 --- a/Core/Tools/W3DView/SpherePropertySheet.cpp +++ b/Core/Tools/W3DView/SpherePropertySheet.cpp @@ -48,7 +48,7 @@ SpherePropertySheetClass::SpherePropertySheetClass CWnd * pParentWnd, UINT iSelectPage ) - : m_RenderObj (NULL), + : m_RenderObj (nullptr), CPropertySheet(nIDCaption, pParentWnd, iSelectPage) { REF_PTR_SET (m_RenderObj, sphere); @@ -69,7 +69,7 @@ SpherePropertySheetClass::SpherePropertySheetClass CWnd * pParentWnd, UINT iSelectPage ) - : m_RenderObj (NULL), + : m_RenderObj (nullptr), CPropertySheet(pszCaption, pParentWnd, iSelectPage) { REF_PTR_SET (m_RenderObj, sphere); @@ -178,7 +178,7 @@ void SpherePropertySheetClass::Add_Object_To_Viewer (void) { CW3DViewDoc *doc = ::GetCurrentDocument (); - if ((doc != NULL) && (m_RenderObj != NULL)) { + if ((doc != nullptr) && (m_RenderObj != nullptr)) { // // Create a new prototype for this object @@ -239,7 +239,7 @@ SpherePropertySheetClass::Update_Object (void) void SpherePropertySheetClass::Initialize (void) { - if (m_RenderObj == NULL) { + if (m_RenderObj == nullptr) { Create_New_Object (); } else { m_LastSavedName = m_RenderObj->Get_Name (); diff --git a/Core/Tools/W3DView/SpherePropertySheet.h b/Core/Tools/W3DView/SpherePropertySheet.h index 65b9a5777c0..ce769f79074 100644 --- a/Core/Tools/W3DView/SpherePropertySheet.h +++ b/Core/Tools/W3DView/SpherePropertySheet.h @@ -58,8 +58,8 @@ class SpherePropertySheetClass : public CPropertySheet // Construction public: - SpherePropertySheetClass (SphereRenderObjClass *sphere, UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); - SpherePropertySheetClass (SphereRenderObjClass *sphere, LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + SpherePropertySheetClass (SphereRenderObjClass *sphere, UINT nIDCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0); + SpherePropertySheetClass (SphereRenderObjClass *sphere, LPCTSTR pszCaption, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0); // Attributes public: diff --git a/Core/Tools/W3DView/SphereSizePropPage.cpp b/Core/Tools/W3DView/SphereSizePropPage.cpp index 70cd13ac186..1372a20b63e 100644 --- a/Core/Tools/W3DView/SphereSizePropPage.cpp +++ b/Core/Tools/W3DView/SphereSizePropPage.cpp @@ -50,9 +50,9 @@ static bool Is_LERP (float last_value, float last_time, float curr_value, float SphereSizePropPageClass::SphereSizePropPageClass (SphereRenderObjClass *sphere) : m_RenderObj (sphere), m_bValid (true), - m_ScaleXBar (NULL), - m_ScaleYBar (NULL), - m_ScaleZBar (NULL), + m_ScaleXBar (nullptr), + m_ScaleYBar (nullptr), + m_ScaleZBar (nullptr), m_Size (0.5F, 0.5F, 0.5F), CPropertyPage(SphereSizePropPageClass::IDD) { @@ -112,7 +112,7 @@ SphereSizePropPageClass::Initialize (void) m_ScaleChannel.Reset (); m_OrigScaleChannel.Reset (); - if (m_RenderObj != NULL) { + if (m_RenderObj != nullptr) { m_Size = m_RenderObj->Get_Box ().Extent; m_ScaleChannel = m_RenderObj->Get_Scale_Channel (); m_OrigScaleChannel = m_RenderObj->Get_Scale_Channel (); @@ -306,7 +306,7 @@ SphereSizePropPageClass::OnNotify // // Determine the timeline bar which sent the notification // - ColorBarClass *timeline = NULL; + ColorBarClass *timeline = nullptr; if (color_bar_hdr->hdr.idFrom == IDC_SCALE_BAR_X) { timeline = m_ScaleXBar; } else if (color_bar_hdr->hdr.idFrom == IDC_SCALE_BAR_Y) { diff --git a/Core/Tools/W3DView/SphereSizePropPage.h b/Core/Tools/W3DView/SphereSizePropPage.h index ac6657054e6..5d7e859b087 100644 --- a/Core/Tools/W3DView/SphereSizePropPage.h +++ b/Core/Tools/W3DView/SphereSizePropPage.h @@ -36,7 +36,7 @@ class SphereSizePropPageClass : public CPropertyPage // Construction public: - SphereSizePropPageClass(SphereRenderObjClass *sphere = NULL); + SphereSizePropPageClass(SphereRenderObjClass *sphere = nullptr); ~SphereSizePropPageClass(); // Dialog Data diff --git a/Core/Tools/W3DView/SphereUtils.cpp b/Core/Tools/W3DView/SphereUtils.cpp index 6e055391724..660aacc2336 100644 --- a/Core/Tools/W3DView/SphereUtils.cpp +++ b/Core/Tools/W3DView/SphereUtils.cpp @@ -133,7 +133,7 @@ SphereKeysClass::Free_Keys (void) void SphereKeysClass::Detach (void) { - m_Keys = NULL; + m_Keys = nullptr; m_KeyCount = 0; m_MaxKeys = 0; return ; @@ -150,8 +150,8 @@ SphereKeysClass::Detach (void) static int Key_Compare (const void *arg1, const void *arg2) { - ASSERT (arg1 != NULL); - ASSERT (arg2 != NULL); + ASSERT (arg1 != nullptr); + ASSERT (arg2 != nullptr); W3dSphereKeyFrameStruct *key1 = (W3dSphereKeyFrameStruct *)arg1; W3dSphereKeyFrameStruct *key2 = (W3dSphereKeyFrameStruct *)arg2; @@ -177,7 +177,7 @@ Key_Compare (const void *arg1, const void *arg2) void SphereKeysClass::Sort (void) { - if (m_Keys != NULL && m_KeyCount > 0) { + if (m_Keys != nullptr && m_KeyCount > 0) { ::qsort (m_Keys, m_KeyCount, sizeof (W3dSphereKeyFrameStruct), Key_Compare); } diff --git a/Core/Tools/W3DView/SphereUtils.h b/Core/Tools/W3DView/SphereUtils.h index cb60d555450..7e8b2b1c1ea 100644 --- a/Core/Tools/W3DView/SphereUtils.h +++ b/Core/Tools/W3DView/SphereUtils.h @@ -51,7 +51,7 @@ class SphereKeysClass // Public constructors/destructors ///////////////////////////////////////////////////////////// SphereKeysClass (void) - : m_Keys (NULL), + : m_Keys (nullptr), m_KeyCount (0), m_MaxKeys (0) { } diff --git a/Core/Tools/W3DView/TextureMgrDialog.cpp b/Core/Tools/W3DView/TextureMgrDialog.cpp index a639372773b..32538cb4d21 100644 --- a/Core/Tools/W3DView/TextureMgrDialog.cpp +++ b/Core/Tools/W3DView/TextureMgrDialog.cpp @@ -79,10 +79,10 @@ TextureMgrDialogClass::TextureMgrDialogClass ) : m_pBaseModel (pbase_model), m_bContainsMeshes (true), - m_pImageList (NULL), - m_pImageListSmall (NULL), - m_pTextureImageList (NULL), - m_pTextureImageListSmall (NULL), + m_pImageList (nullptr), + m_pImageListSmall (nullptr), + m_pTextureImageList (nullptr), + m_pTextureImageListSmall (nullptr), CDialog (TextureMgrDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(TextureMgrDialogClass) @@ -225,9 +225,9 @@ TextureMgrDialogClass::OnInitDialog (void) CRect rect; ::GetWindowRect (::GetDlgItem (m_hWnd, IDC_TOOLBAR_SLOT), &rect); ScreenToClient (&rect); - m_Toolbar.SetWindowPos (NULL, rect.left, rect.top, rect.Width (), rect.Height (), SWP_NOZORDER); + m_Toolbar.SetWindowPos (nullptr, rect.left, rect.top, rect.Width (), rect.Height (), SWP_NOZORDER); - ASSERT (m_pBaseModel != NULL); + ASSERT (m_pBaseModel != nullptr); // Create an icon imagelist for the tree control m_pImageList = new CImageList; @@ -279,7 +279,7 @@ TextureMgrDialogClass::Add_Subobjs_To_List (RenderObjClass *prender_obj) // Get a pointer to this subobject RenderObjClass *psubobj = prender_obj->Get_Sub_Object (index); - if (psubobj != NULL) { + if (psubobj != nullptr) { // Recursively add subobjs to the list Add_Subobjs_To_List (psubobj); @@ -314,12 +314,12 @@ TextureMgrDialogClass::Add_Textures_To_Node ) { MaterialInfoClass *pmat_info = pmesh->Get_Material_Info (); - if (pmat_info != NULL) { + if (pmat_info != nullptr) { // Loop through all the textures and add them as subobjs for (int index = 0; index < pmat_info->Texture_Count (); index ++) { TextureClass *ptexture = pmat_info->Get_Texture (index); - if (ptexture != NULL) { + if (ptexture != nullptr) { // Create a node from this texture and add it to the mesh TextureListNodeClass *pnode = new TextureListNodeClass (ptexture, ::Get_Texture_Name (*ptexture)); @@ -408,7 +408,7 @@ TextureMgrDialogClass::OnDblclkMeshTextureListCtrl // Get the node associated with this entry TextureListNodeClass *pnode = (TextureListNodeClass *)m_ListCtrl.GetItemData (index); - if (pnode != NULL) { + if (pnode != nullptr) { // Is this a mesh or a texture? if (pnode->Get_Type () == TextureListNodeClass::TYPE_MESH) { @@ -425,12 +425,12 @@ TextureMgrDialogClass::OnDblclkMeshTextureListCtrl // try and find an original texture... TextureListNodeClass *pmesh_node = pnode->Get_Parent (); RenderObjClass *prender_obj = WW3DAssetManager::Get_Instance ()->Create_Render_Obj (pmesh_node->Get_Name ()); - TextureClass *poriginal_texture = NULL; - if (prender_obj != NULL) { + TextureClass *poriginal_texture = nullptr; + if (prender_obj != nullptr) { // Get the material information for this render object MaterialInfoClass *pmat_info = prender_obj->Get_Material_Info (); - if (pmat_info != NULL) { + if (pmat_info != nullptr) { // Attempt to find the original texture poriginal_texture = pmat_info->Get_Texture (pnode->Get_Texture_Index ()); @@ -506,8 +506,8 @@ void TextureMgrDialogClass::OnDestroy (void) { // Free the state image list we associated with the control - m_ListCtrl.SetImageList (NULL, LVSIL_NORMAL); - m_ListCtrl.SetImageList (NULL, LVSIL_SMALL); + m_ListCtrl.SetImageList (nullptr, LVSIL_NORMAL); + m_ListCtrl.SetImageList (nullptr, LVSIL_SMALL); SAFE_DELETE (m_pImageList); SAFE_DELETE (m_pImageListSmall); SAFE_DELETE (m_pTextureImageList); @@ -612,18 +612,18 @@ TextureMgrDialogClass::Get_Thumbnail (srTextureIFace *ptexture) // Create a windows bitmap from this texture HBITMAP hbmp = ::Make_Bitmap_From_Texture (*ptexture, TEXTURE_THUMB_X, TEXTURE_THUMB_Y); - if (hbmp != NULL) { + if (hbmp != nullptr) { // Insert this bitmap into our imagelist CBitmap temp_obj; temp_obj.Attach (hbmp); - icon_index = m_pTextureImageList->Add (&temp_obj, (CBitmap *)NULL); + icon_index = m_pTextureImageList->Add (&temp_obj, (CBitmap *)nullptr); // Create a smaller bitmap and insert it into the other imagelist HBITMAP hsmall_bitmap = (HBITMAP)::CopyImage (hbmp, IMAGE_BITMAP, TEXTURE_THUMBSMALL_X, TEXTURE_THUMBSMALL_Y, 0); CBitmap small_obj; small_obj.Attach (hsmall_bitmap); - m_pTextureImageListSmall->Add (&small_obj, (CBitmap *)NULL); + m_pTextureImageListSmall->Add (&small_obj, (CBitmap *)nullptr); // Add a name to our list to represent this texture m_TextureNames.Add (::Get_Texture_Name (*ptexture)); @@ -647,7 +647,7 @@ TextureMgrDialogClass::Insert_Texture_Details ) { TextureClass *ptexture = pnode->Peek_Texture (); - if ((index != -1) && (ptexture != NULL)) { + if ((index != -1) && (ptexture != nullptr)) { // Get the name of the texture (mark it differently if its an editable texture) CString texture_name = ::Get_Texture_Name (*ptexture); @@ -741,7 +741,7 @@ TextureMgrDialogClass::OnPropagate (void) // Does this node have the same number of replaceable textures as the src node? // TextureListNodeClass *curr_node = (TextureListNodeClass *)m_ListCtrl.GetItemData (counter); - if ( (curr_node != NULL) && + if ( (curr_node != nullptr) && (curr_node->Get_Subobj_List ().Count () == src_texture_count)) { TEXTURE_NODE_LIST &curr_texture_list = curr_node->Get_Subobj_List (); @@ -754,7 +754,7 @@ TextureMgrDialogClass::OnPropagate (void) TextureListNodeClass *curr_texture_node = curr_texture_list[texture_counter]; TextureListNodeClass *src_texture_node = src_texture_list[texture_counter]; - if (curr_texture_node != NULL && src_texture_node != NULL) { + if (curr_texture_node != nullptr && src_texture_node != nullptr) { TextureClass *curr_texture = curr_texture_node->Peek_Texture (); TextureClass *src_texture = src_texture_node->Peek_Texture (); @@ -762,7 +762,7 @@ TextureMgrDialogClass::OnPropagate (void) // // Are the textures both indirect textures? // - if ( curr_texture != NULL && src_texture != NULL && + if ( curr_texture != nullptr && src_texture != nullptr && curr_texture->getClassID () == ID_INDIRECT_TEXTURE_CLASS && src_texture->getClassID () == ID_INDIRECT_TEXTURE_CLASS) { diff --git a/Core/Tools/W3DView/TextureMgrDialog.h b/Core/Tools/W3DView/TextureMgrDialog.h index 1e109aa479b..2fd5e25ba37 100644 --- a/Core/Tools/W3DView/TextureMgrDialog.h +++ b/Core/Tools/W3DView/TextureMgrDialog.h @@ -77,18 +77,18 @@ class TextureListNodeClass // // Public constructors/destructors // - TextureListNodeClass (LPCTSTR name = NULL) - : m_pTexture (NULL), + TextureListNodeClass (LPCTSTR name = nullptr) + : m_pTexture (nullptr), m_Type (TYPE_MESH), - m_pParent (NULL), + m_pParent (nullptr), m_Name (name), m_TextureIndex (0), m_IconIndex (ICON_MESH) {} - TextureListNodeClass (TextureClass *ptexture, LPCTSTR name = NULL) - : m_pTexture (NULL), + TextureListNodeClass (TextureClass *ptexture, LPCTSTR name = nullptr) + : m_pTexture (nullptr), m_Type (TYPE_TEXTURE), - m_pParent (NULL), + m_pParent (nullptr), m_Name (name), m_TextureIndex (0), m_IconIndex (ICON_DEF_TEXTURE) { REF_PTR_SET (m_pTexture, ptexture); } @@ -173,7 +173,7 @@ class TextureMgrDialogClass : public CDialog // Construction public: - TextureMgrDialogClass (RenderObjClass *pbase_model, CWnd *pParent = NULL); + TextureMgrDialogClass (RenderObjClass *pbase_model, CWnd *pParent = nullptr); // Dialog Data //{{AFX_DATA(TextureMgrDialogClass) diff --git a/Core/Tools/W3DView/TexturePathDialog.cpp b/Core/Tools/W3DView/TexturePathDialog.cpp index 027e16792d4..d0d5a50d75c 100644 --- a/Core/Tools/W3DView/TexturePathDialog.cpp +++ b/Core/Tools/W3DView/TexturePathDialog.cpp @@ -38,7 +38,7 @@ static char THIS_FILE[] = __FILE__; // TexturePathDialogClass // ///////////////////////////////////////////////////////////////////////////// -TexturePathDialogClass::TexturePathDialogClass(CWnd* pParent /*=NULL*/) +TexturePathDialogClass::TexturePathDialogClass(CWnd* pParent /*=nullptr*/) : CDialog(TexturePathDialogClass::IDD, pParent) { //{{AFX_DATA_INIT(TexturePathDialogClass) diff --git a/Core/Tools/W3DView/TexturePathDialog.h b/Core/Tools/W3DView/TexturePathDialog.h index 0d83bfe3dfa..58082664864 100644 --- a/Core/Tools/W3DView/TexturePathDialog.h +++ b/Core/Tools/W3DView/TexturePathDialog.h @@ -28,7 +28,7 @@ class TexturePathDialogClass : public CDialog { // Construction public: - TexturePathDialogClass(CWnd* pParent = NULL); // standard constructor + TexturePathDialogClass(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(TexturePathDialogClass) diff --git a/Core/Tools/W3DView/TextureSettingsDialog.cpp b/Core/Tools/W3DView/TextureSettingsDialog.cpp index 6413def5885..1ee721e05cc 100644 --- a/Core/Tools/W3DView/TextureSettingsDialog.cpp +++ b/Core/Tools/W3DView/TextureSettingsDialog.cpp @@ -70,10 +70,10 @@ TextureSettingsDialogClass::TextureSettingsDialogClass IndirectTextureClass *poriginal_texture, CWnd *pParent ) - : m_pTexture (NULL), - m_pOriginalTexture (NULL), - m_pStartingTexture (NULL), - m_hThumbnail (NULL), + : m_pTexture (nullptr), + m_pOriginalTexture (nullptr), + m_pStartingTexture (nullptr), + m_hThumbnail (nullptr), m_bWereSettingsModified (false), CDialog(TextureSettingsDialogClass::IDD, pParent) { @@ -135,7 +135,7 @@ TextureSettingsDialogClass::OnInitDialog (void) { // Allow the base class to process this message CDialog::OnInitDialog (); - ASSERT (m_pTexture != NULL); + ASSERT (m_pTexture != nullptr); ASSERT (m_pTexture->getClassID () == ID_INDIRECT_TEXTURE_CLASS); // Determine what the starting texture was so we can restore on cancel (if necessary) @@ -153,7 +153,7 @@ TextureSettingsDialogClass::OnInitDialog (void) // Enable or disable the 'restore' button based on whether or not we // have an original texture to switch to... - ::EnableWindow (::GetDlgItem (m_hWnd, IDC_RESTORE), (m_pOriginalTexture != NULL)); + ::EnableWindow (::GetDlgItem (m_hWnd, IDC_RESTORE), (m_pOriginalTexture != nullptr)); ::EnableWindow (::GetDlgItem (m_hWnd, IDC_APPLY), FALSE); // Fill the dialog controls with data from the texture @@ -170,9 +170,9 @@ void TextureSettingsDialogClass::Load_Texture_Settings (void) { // Free the old thumbnail (if there was one) - if (m_hThumbnail != NULL) { + if (m_hThumbnail != nullptr) { DeleteObject (m_hThumbnail); - m_hThumbnail = NULL; + m_hThumbnail = nullptr; } // Get the actual texture... @@ -200,7 +200,7 @@ TextureSettingsDialogClass::Load_Texture_Settings (void) void TextureSettingsDialogClass::Fill_Controls (TextureClass *ptexture) { - srTexture *psource = NULL; + srTexture *psource = nullptr; // What type of texture is this? switch (ptexture->getClassID ()) @@ -217,7 +217,7 @@ TextureSettingsDialogClass::Fill_Controls (TextureClass *ptexture) psource = ((ResizeableTextureInstanceClass *)ptexture)->Peek_Source(); // Fill the 'filename' edit control - if (psource != NULL && (psource->getClassID () == ID_FILE_LIST_TEXTURE_CLASS)) { + if (psource != nullptr && (psource->getClassID () == ID_FILE_LIST_TEXTURE_CLASS)) { FileListTextureClass *pfile_list = static_cast(psource); SetDlgItemText (IDC_FILENAME_EDIT, pfile_list->Get_Filename (0)); } @@ -230,8 +230,8 @@ TextureSettingsDialogClass::Fill_Controls (TextureClass *ptexture) } // Set the checkboxes - ASSERT (psource != NULL); - if (psource != NULL) { + ASSERT (psource != nullptr); + if (psource != nullptr) { SendDlgItemMessage (IDC_MIPMAP_OFF_CHECK, BM_SETCHECK, (WPARAM)(psource->getMipmap () == srTextureIFace::MIPMAP_NONE)); SendDlgItemMessage (IDC_ALPHA_CHECK, BM_SETCHECK, (WPARAM)(psource->isHintEnabled(srTextureIFace::HINT_ALPHA_BITMASK))); SendDlgItemMessage (IDC_CLAMPU_CHECK, BM_SETCHECK, (WPARAM)(psource->Get_U_Addr_Mode() == TextureClass::TEXTURE_ADDRESS_CLAMP)); @@ -430,9 +430,9 @@ TextureSettingsDialogClass::WindowProc void TextureSettingsDialogClass::OnDestroy (void) { - if (m_hThumbnail != NULL) { + if (m_hThumbnail != nullptr) { ::DeleteObject (m_hThumbnail); - m_hThumbnail = NULL; + m_hThumbnail = nullptr; } // Allow the base class to process this message @@ -483,13 +483,13 @@ void TextureSettingsDialogClass::Paint_Thumbnail (void) { // Paint the thumbnail - if (m_hThumbnail != NULL) { + if (m_hThumbnail != nullptr) { // Get the misc crap windows requries before we can // paint to the screen HWND hchild_wnd = ::GetDlgItem (m_hWnd, IDC_TEXTURE_THUMBNAIL); HDC hdc = ::GetDC (hchild_wnd); - HDC hmem_dc = ::CreateCompatibleDC (NULL); + HDC hmem_dc = ::CreateCompatibleDC (nullptr); HBITMAP hold_bmp = (HBITMAP)::SelectObject (hmem_dc, m_hThumbnail); // Paint the thumbnail onto the dialog @@ -509,7 +509,7 @@ TextureSettingsDialogClass::Paint_Thumbnail (void) ::SelectObject (hmem_dc, hold_bmp); ::ReleaseDC (hchild_wnd, hmem_dc); ::DeleteDC (hmem_dc); - ::ValidateRect (hchild_wnd, NULL); + ::ValidateRect (hchild_wnd, nullptr); } return ; @@ -523,7 +523,7 @@ TextureSettingsDialogClass::Paint_Thumbnail (void) void TextureSettingsDialogClass::OnRestore (void) { - if (m_pOriginalTexture != NULL) { + if (m_pOriginalTexture != nullptr) { // Get the original texture TextureClass *pnew_texture = m_pOriginalTexture->Get_Texture (); @@ -609,8 +609,8 @@ TextureSettingsDialogClass::OnApply (void) //} } - ASSERT (pnew_texture != NULL); - if (pnew_texture != NULL) { + ASSERT (pnew_texture != nullptr); + if (pnew_texture != nullptr) { // Turn mipmapping off if necessary if (SendDlgItemMessage (IDC_MIPMAP_OFF_CHECK, BM_GETCHECK) == 1) { diff --git a/Core/Tools/W3DView/TextureSettingsDialog.h b/Core/Tools/W3DView/TextureSettingsDialog.h index ba443b4b0c4..637c143ba56 100644 --- a/Core/Tools/W3DView/TextureSettingsDialog.h +++ b/Core/Tools/W3DView/TextureSettingsDialog.h @@ -47,7 +47,7 @@ class TextureSettingsDialogClass : public CDialog { // Construction public: - TextureSettingsDialogClass (IndirectTextureClass *ptexture, IndirectTextureClass *poriginal_texture, CWnd *pParent = NULL); + TextureSettingsDialogClass (IndirectTextureClass *ptexture, IndirectTextureClass *poriginal_texture, CWnd *pParent = nullptr); virtual ~TextureSettingsDialogClass (void); // Dialog Data diff --git a/Core/Tools/W3DView/Toolbar.cpp b/Core/Tools/W3DView/Toolbar.cpp index b252d74647d..a2301d21174 100644 --- a/Core/Tools/W3DView/Toolbar.cpp +++ b/Core/Tools/W3DView/Toolbar.cpp @@ -71,14 +71,14 @@ CFancyToolbar::~CFancyToolbar (void) { // Free the BMP for this button ::DeleteObject (m_pButtonArray[iButton].hBMPUp); - m_pButtonArray[iButton].hBMPUp = NULL; + m_pButtonArray[iButton].hBMPUp = nullptr; } if (m_pButtonArray[iButton].hBMPDn) { // Free the BMP for this button ::DeleteObject (m_pButtonArray[iButton].hBMPDn); - m_pButtonArray[iButton].hBMPDn = NULL; + m_pButtonArray[iButton].hBMPDn = nullptr; } } @@ -101,7 +101,7 @@ CFancyToolbar::RegisterFancyToolbarClass (void) classInfo.style = CS_PARENTDC; classInfo.lpfnWndProc = ::DefWindowProc; classInfo.hInstance = ::AfxGetInstanceHandle (); - classInfo.hCursor = ::LoadCursor (NULL, IDC_ARROW); + classInfo.hCursor = ::LoadCursor (nullptr, IDC_ARROW); classInfo.hbrBackground = (HBRUSH)COLOR_BTNFACE; classInfo.lpszClassName = TOOLBAR_CLASS_NAME; @@ -260,7 +260,7 @@ CFancyToolbar::Paint (void) } // Let the window know its done painting - ::ValidateRect (m_hWnd, NULL); + ::ValidateRect (m_hWnd, nullptr); return ; } @@ -470,7 +470,7 @@ CFancyToolbar::SetButtonState { // Repaint the toolbar //Paint (); - InvalidateRect (NULL); + InvalidateRect (nullptr); UpdateWindow (); } diff --git a/Core/Tools/W3DView/Utils.cpp b/Core/Tools/W3DView/Utils.cpp index 95ed99ff0b8..b4ae48c2ae4 100644 --- a/Core/Tools/W3DView/Utils.cpp +++ b/Core/Tools/W3DView/Utils.cpp @@ -46,7 +46,7 @@ CW3DViewDoc * GetCurrentDocument (void) { // Assume failure - CW3DViewDoc *pCDoc = NULL; + CW3DViewDoc *pCDoc = nullptr; // Get a pointer to the main window CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); @@ -96,7 +96,7 @@ CenterDialogAroundTreeView (HWND hDlg) // Move the dialog so its centered in the data tree view ::SetWindowPos (hDlg, - NULL, + nullptr, rect.left + ((rect.right-rect.left) >> 1) - ((dialogRect.right-dialogRect.left) >> 1), rect.top + ((rect.bottom-rect.top) >> 1) - ((dialogRect.bottom-dialogRect.top) >> 1), 0, @@ -156,7 +156,7 @@ Paint_Gradient ::ReleaseDC (hWnd, hDC); // Validate the contents of the window so the control won't paint itself - ::ValidateRect (hWnd, NULL); + ::ValidateRect (hWnd, nullptr); return ; } @@ -226,7 +226,7 @@ Initialize_Spinner // Set the buddy's text accordingly // CWnd *buddy = ctrl.GetBuddy (); - if (buddy != NULL) { + if (buddy != nullptr) { ::SetWindowFloat (*buddy, pos); } @@ -246,7 +246,7 @@ Update_Spinner_Buddy (CSpinButtonCtrl &ctrl, int delta) // if ((::GetWindowLong (ctrl, GWL_STYLE) & UDS_SETBUDDYINT) == 0) { CWnd *buddy = ctrl.GetBuddy (); - if (buddy != NULL) { + if (buddy != nullptr) { // Get the current value, increment it, and put it back into the control float value = ::GetWindowFloat (*buddy); @@ -321,7 +321,7 @@ Enable_Dialog_Controls (HWND dlg,bool onoff) // Loop over all sub-windows enable/disabling everything except for // the static text controls // - for (HWND child = ::GetWindow(dlg,GW_CHILD) ; child != NULL ; child = ::GetWindow(child,GW_HWNDNEXT)) { + for (HWND child = ::GetWindow(dlg,GW_CHILD) ; child != nullptr ; child = ::GetWindow(child,GW_HWNDNEXT)) { char buf[64]; ::GetClassName(child,buf,sizeof(buf)); if (stricmp(buf,"STATIC") != 0) { @@ -416,7 +416,7 @@ Get_Filename_From_Path (LPCTSTR path) { // Find the last occurance of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); - if (filename != NULL) { + if (filename != nullptr) { // Increment past the directory deliminator filename ++; } else { @@ -441,7 +441,7 @@ Strip_Filename_From_Path (LPCTSTR path) // Find the last occurance of the directory deliminator LPTSTR filename = ::strrchr (temp_path, '\\'); - if (filename != NULL) { + if (filename != nullptr) { // Strip off the filename filename[0] = 0; } @@ -478,18 +478,18 @@ Create_DIB_Section bitmap_info.biClrImportant = 0; // Get a temporary screen DC - HDC hscreen_dc = ::GetDC (NULL); + HDC hscreen_dc = ::GetDC (nullptr); // Create a bitmap that we can access the bits directly of HBITMAP hbitmap = ::CreateDIBSection (hscreen_dc, (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)pbits, - NULL, + nullptr, 0L); // Release our temporary screen DC - ::ReleaseDC (NULL, hscreen_dc); + ::ReleaseDC (nullptr, hscreen_dc); return hbitmap; } @@ -502,7 +502,7 @@ HBITMAP Make_Bitmap_From_Texture (TextureClass &texture, int width, int height) { // TheSuperHackers @info Not implemented - HBITMAP hbitmap = NULL; + HBITMAP hbitmap = nullptr; // Return a handle to the bitmap return hbitmap; } @@ -538,7 +538,7 @@ Build_Emitter_List // Loop through all this render obj's sub-obj's for (int index = 0; index < render_obj.Get_Num_Sub_Objects (); index ++) { RenderObjClass *psub_obj = render_obj.Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { // Is this sub-obj an emitter? if (psub_obj->Class_ID () == RenderObjClass::CLASSID_PARTICLEEMITTER) { @@ -579,8 +579,8 @@ Is_Aggregate (const char *asset_name) // Check to see if this object is an aggregate RenderObjClass *prender_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (asset_name); - if ((prender_obj != NULL) && - (prender_obj->Get_Base_Model_Name () != NULL)) + if ((prender_obj != nullptr) && + (prender_obj->Get_Base_Model_Name () != nullptr)) { retval = true; } @@ -605,14 +605,14 @@ Rename_Aggregate_Prototype ) { // Params valid? - if ((old_name != NULL) && - (new_name != NULL) && + if ((old_name != nullptr) && + (new_name != nullptr) && (::lstrcmpi (old_name, new_name) != 0)) { // Get the prototype from the asset manager - AggregatePrototypeClass *proto = NULL; + AggregatePrototypeClass *proto = nullptr; proto = (AggregatePrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (old_name); - if (proto != NULL) { + if (proto != nullptr) { // Copy the definition from the prototype and remove the prototype AggregateDefClass *pdefinition = proto->Get_Definition (); @@ -642,7 +642,7 @@ Is_Real_LOD (const char *asset_name) // Check to see if this object is an aggregate RenderObjClass *prender_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj (asset_name); - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && (prender_obj->Class_ID () == RenderObjClass::CLASSID_HLOD) && (((HLodClass *)prender_obj)->Get_LOD_Count () > 1)) { retval = true; @@ -676,10 +676,10 @@ Get_File_Time HANDLE hfile = ::CreateFile (path, 0, 0, - NULL, + nullptr, OPEN_EXISTING, 0L, - NULL); + nullptr); ASSERT (hfile != INVALID_HANDLE_VALUE); if (hfile != INVALID_HANDLE_VALUE) { @@ -724,13 +724,13 @@ Are_Glide_Drivers_Acceptable (void) // Get the creation time of the glide2x driver FILETIME file_time = { 0 }; - if (::Get_File_Time (glide2x, NULL, NULL, &file_time)) { + if (::Get_File_Time (glide2x, nullptr, nullptr, &file_time)) { CTime time_obj (file_time); retval = ((time_obj.GetYear () == 1998) && (time_obj.GetMonth () == 12)) || (time_obj.GetYear () > 1998); } // Get the creation time of the glide3x driver - if (::Get_File_Time (glide3x, NULL, NULL, &file_time)) { + if (::Get_File_Time (glide3x, nullptr, nullptr, &file_time)) { CTime time_obj (file_time); retval = ((time_obj.GetYear () == 1998) && (time_obj.GetMonth () == 12)) || (time_obj.GetYear () > 1998); } @@ -748,7 +748,7 @@ Are_Glide_Drivers_Acceptable (void) TextureClass * Load_RC_Texture (LPCTSTR resource_name) { - TextureClass *texture = NULL; + TextureClass *texture = nullptr; // // Load the cursor file image from this binaries resources @@ -826,7 +826,7 @@ Copy_File bool force_copy ) { - SANITY_CHECK ((existing_filename != NULL && new_filename != NULL)) { + SANITY_CHECK ((existing_filename != nullptr && new_filename != nullptr)) { return false; } @@ -867,13 +867,13 @@ Copy_File CGraphicView * Get_Graphic_View (void) { - CGraphicView *view = NULL; + CGraphicView *view = nullptr; // // Get the view from the current document // CW3DViewDoc *doc = GetCurrentDocument (); - if (doc != NULL) { + if (doc != nullptr) { view = doc->GetGraphicView (); } diff --git a/Core/Tools/W3DView/Utils.h b/Core/Tools/W3DView/Utils.h index afd07056a7f..9d2b940466c 100644 --- a/Core/Tools/W3DView/Utils.h +++ b/Core/Tools/W3DView/Utils.h @@ -35,14 +35,14 @@ class RenderObjClass; // // Macros // -#define SAFE_DELETE(pobject) { delete pobject; pobject = NULL; } -#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = NULL; } +#define SAFE_DELETE(pobject) { delete pobject; pobject = nullptr; } +#define SAFE_DELETE_ARRAY(pobject) { delete [] pobject; pobject = nullptr; } #define COM_RELEASE(pobject) \ if (pobject) { \ pobject->Release (); \ } \ - pobject = NULL; \ + pobject = nullptr; \ #define SAFE_CLOSE(handle) \ if (handle != INVALID_HANDLE_VALUE) { \ @@ -114,7 +114,7 @@ CString Filename_From_Asset_Name (LPCTSTR asset_name); // // File routines // -bool Get_File_Time (LPCTSTR path, LPFILETIME pcreation_time, LPFILETIME paccess_time = NULL, LPFILETIME pwrite_time = NULL); +bool Get_File_Time (LPCTSTR path, LPFILETIME pcreation_time, LPFILETIME paccess_time = nullptr, LPFILETIME pwrite_time = nullptr); bool Are_Glide_Drivers_Acceptable (void); bool Copy_File (LPCTSTR existing_filename, LPCTSTR new_filename, bool bforce_copy = false); diff --git a/Core/Tools/W3DView/Vector3RndCombo.cpp b/Core/Tools/W3DView/Vector3RndCombo.cpp index 5cc5ca992d1..c923922acf6 100644 --- a/Core/Tools/W3DView/Vector3RndCombo.cpp +++ b/Core/Tools/W3DView/Vector3RndCombo.cpp @@ -74,7 +74,7 @@ int Combo_Index_From_Vector3_Rnd (Vector3Randomizer *randomizer) { int index = 0; - if (randomizer != NULL) { + if (randomizer != nullptr) { index = (int)randomizer->Class_ID (); } @@ -91,7 +91,7 @@ Combo_Index_From_Vector3_Rnd (Vector3Randomizer *randomizer) Vector3Randomizer * Vector3_Rnd_From_Combo_Index (int index, float value1, float value2, float value3) { - Vector3Randomizer *randomizer = NULL; + Vector3Randomizer *randomizer = nullptr; // // What type of randomizer should we create? diff --git a/Core/Tools/W3DView/ViewerScene.cpp b/Core/Tools/W3DView/ViewerScene.cpp index 2383988dce9..58a99220397 100644 --- a/Core/Tools/W3DView/ViewerScene.cpp +++ b/Core/Tools/W3DView/ViewerScene.cpp @@ -216,7 +216,7 @@ ViewerSceneClass::Clear_Lineup (void) { // Remove every object in the lineup from the scene, // and remove each object from the line up list. - RenderObjClass *obj = NULL; + RenderObjClass *obj = nullptr; while (obj = LineUpList.Remove_Head()) Remove_Render_Object(obj); } diff --git a/Core/Tools/W3DView/VolumeRandomDialog.cpp b/Core/Tools/W3DView/VolumeRandomDialog.cpp index 74efda04352..6c3de349a12 100644 --- a/Core/Tools/W3DView/VolumeRandomDialog.cpp +++ b/Core/Tools/W3DView/VolumeRandomDialog.cpp @@ -157,7 +157,7 @@ VolumeRandomDialogClass::OnInitDialog (void) // // Initialize from the provided randomizer // - if (m_Randomizer != NULL) { + if (m_Randomizer != nullptr) { // What type of randomizer is this? switch (m_Randomizer->Class_ID ()) @@ -315,7 +315,7 @@ VolumeRandomDialogClass::OnNotify // Update the spinner control if necessary // NMHDR *pheader = (NMHDR *)lParam; - if ((pheader != NULL) && (pheader->code == UDN_DELTAPOS)) { + if ((pheader != nullptr) && (pheader->code == UDN_DELTAPOS)) { LPNMUPDOWN pupdown = (LPNMUPDOWN)lParam; ::Update_Spinner_Buddy (pheader->hwndFrom, pupdown->iDelta); } diff --git a/Core/Tools/W3DView/VolumeRandomDialog.h b/Core/Tools/W3DView/VolumeRandomDialog.h index 10956f3122f..f1550b21428 100644 --- a/Core/Tools/W3DView/VolumeRandomDialog.h +++ b/Core/Tools/W3DView/VolumeRandomDialog.h @@ -33,7 +33,7 @@ class VolumeRandomDialogClass : public CDialog { // Construction public: - VolumeRandomDialogClass (Vector3Randomizer *randomizer, CWnd *pParent = NULL); // standard constructor + VolumeRandomDialogClass (Vector3Randomizer *randomizer, CWnd *pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(VolumeRandomDialogClass) diff --git a/Core/Tools/W3DView/W3DView.cpp b/Core/Tools/W3DView/W3DView.cpp index 89205622fd6..890673e4d36 100644 --- a/Core/Tools/W3DView/W3DView.cpp +++ b/Core/Tools/W3DView/W3DView.cpp @@ -47,10 +47,10 @@ static char THIS_FILE[] = __FILE__; #endif -HINSTANCE ApplicationHInstance = NULL; ///< our application instance +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance /// just to satisfy the game libraries we link to -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; const char *gAppPrefix = "w3_"; @@ -132,7 +132,7 @@ WinMain catch (...) { - ::MessageBox (NULL, "Internal Application Error", "Unrecoverable Error", MB_ICONERROR | MB_OK); + ::MessageBox (nullptr, "Internal Application Error", "Unrecoverable Error", MB_ICONERROR | MB_OK); } #endif //RTS_DEBUG @@ -149,7 +149,7 @@ void Do_Version_Check (void) { char curr_filename[MAX_PATH]; - ::GetModuleFileName (NULL, curr_filename, MAX_PATH); + ::GetModuleFileName (nullptr, curr_filename, MAX_PATH); CString filename = "\\\\cabal\\mis\\r&d\\w3d\\w3dview\\"; filename += ::Get_Filename_From_Path (curr_filename); @@ -159,7 +159,7 @@ Do_Version_Check (void) // against the version we are running. // if (Compare_EXE_Version ((int)::AfxGetInstanceHandle (), filename) < 0) { - ::MessageBox (NULL, "There is a newer version of the W3DViewer, please run W3DUpdate to upgrade your local copy.", "Version Info", MB_ICONEXCLAMATION | MB_OK | MB_SETFOREGROUND | MB_SYSTEMMODAL); + ::MessageBox (nullptr, "There is a newer version of the W3DViewer, please run W3DUpdate to upgrade your local copy.", "Version Info", MB_ICONEXCLAMATION | MB_OK | MB_SETFOREGROUND | MB_SYSTEMMODAL); } return ; @@ -189,9 +189,9 @@ BOOL CW3DViewApp::InitInstance (void) RegisterColorBar (::AfxGetInstanceHandle ()); // Is there already an instance of the viewer running? - HWND hprev_instance = NULL; + HWND hprev_instance = nullptr; ::EnumWindows (fnTopLevelWindowSearch, (LPARAM)&hprev_instance); - if (hprev_instance == NULL) { + if (hprev_instance == nullptr) { // Change the registry key under which our settings are stored. // You should modify this string to be something appropriate @@ -258,7 +258,7 @@ BOOL CW3DViewApp::InitInstance (void) ::SetForegroundWindow (hprev_instance); } - return (hprev_instance == NULL); + return (hprev_instance == nullptr); } ///////////////////////////////////////////////////////////////////////////// @@ -347,7 +347,7 @@ void Debug_Refs(void) strcmp(search_ref->File, ref->File) == 0 && (search_ref->Line == ref->Line) ) { count++; - } else if ( (ref->File == NULL) && (search_ref->File == NULL) ) { + } else if ( (ref->File == nullptr) && (search_ref->File == nullptr) ) { count++; } @@ -405,7 +405,7 @@ CW3DViewApp::ExitInstance() // Free the asset manager // delete _TheAssetMgr; - _TheAssetMgr = NULL; + _TheAssetMgr = nullptr; } Debug_Refs (); @@ -427,7 +427,7 @@ fnTopLevelWindowSearch BOOL bcontinue = TRUE; // Is this a viewer window? - if (::GetProp (hwnd, "WW3DVIEWER") != 0) { + if (::GetProp (hwnd, "WW3DVIEWER") != nullptr) { bcontinue = false; (*((HWND *)lParam)) = hwnd; } @@ -453,7 +453,7 @@ CAboutDlg::OnInitDialog (void) // Get the name and path of the currently executing application TCHAR filename[MAX_PATH]; - ::GetModuleFileName (NULL, filename, sizeof (filename)); + ::GetModuleFileName (nullptr, filename, sizeof (filename)); // Get the version information for this file DWORD dummy_var = 0; @@ -466,7 +466,7 @@ CAboutDlg::OnInitDialog (void) // Query the block for the file version information UINT version_len = 0; - VS_FIXEDFILEINFO *pversion_info = NULL; + VS_FIXEDFILEINFO *pversion_info = nullptr; if (::VerQueryValue (pblock, "\\", (LPVOID *)&pversion_info, &version_len)) { version_major = pversion_info->dwFileVersionMS; version_minor = pversion_info->dwFileVersionLS; diff --git a/Core/Tools/W3DView/W3DViewDoc.cpp b/Core/Tools/W3DView/W3DViewDoc.cpp index 1594b538590..7dc9eb19cac 100644 --- a/Core/Tools/W3DView/W3DViewDoc.cpp +++ b/Core/Tools/W3DView/W3DViewDoc.cpp @@ -89,25 +89,25 @@ END_MESSAGE_MAP() // CW3DViewDoc // CW3DViewDoc::CW3DViewDoc (void) - : m_pCScene (NULL), - m_pC2DScene (NULL), - m_pCursorScene (NULL), - m_pCBackObjectScene (NULL), - m_pDazzleLayer (NULL), - m_pCBackObjectCamera (NULL), - m_pCBackgroundObject (NULL), - m_pC2DCamera (NULL), - m_pCSceneLight (NULL), - m_pCRenderObj (NULL), - m_pCAnimation (NULL), - m_pCAnimCombo (NULL), - m_pCBackgroundBMP (NULL), + : m_pCScene (nullptr), + m_pC2DScene (nullptr), + m_pCursorScene (nullptr), + m_pCBackObjectScene (nullptr), + m_pDazzleLayer (nullptr), + m_pCBackObjectCamera (nullptr), + m_pCBackgroundObject (nullptr), + m_pC2DCamera (nullptr), + m_pCSceneLight (nullptr), + m_pCRenderObj (nullptr), + m_pCAnimation (nullptr), + m_pCAnimCombo (nullptr), + m_pCBackgroundBMP (nullptr), m_CurrentFrame (0), m_bAnimBlend (TRUE), m_bAnimateCamera (false), m_bAutoCameraReset (true), m_bOneTimeReset (true), - m_pCursor (NULL), + m_pCursor (nullptr), m_backgroundColor (0.5F, 0.5F, 0.5F), m_ManualFOV (false), m_ManualClipPlanes (false), @@ -153,7 +153,7 @@ CW3DViewDoc::CleanupResources (void) // Release the 2D scene we allocated to display background BMPs m_pC2DScene->Release_Ref (); - m_pC2DScene = NULL; + m_pC2DScene = nullptr; } if (m_pCBackObjectScene) @@ -166,10 +166,10 @@ CW3DViewDoc::CleanupResources (void) // Release the scene we allocated to display background objects m_pCBackObjectScene->Release_Ref (); - m_pCBackObjectScene = NULL; + m_pCBackObjectScene = nullptr; } - if (m_pCursor != NULL) { + if (m_pCursor != nullptr) { m_pCursor->Remove (); } REF_PTR_RELEASE (m_pCursorScene); @@ -193,19 +193,19 @@ CW3DViewDoc::CleanupResources (void) // Release the scene object we allocated earlier m_pCScene->Release_Ref (); - m_pCScene = NULL; + m_pCScene = nullptr; } // Was there a dazzle layer? delete m_pDazzleLayer; - m_pDazzleLayer = NULL; + m_pDazzleLayer = nullptr; // Was there a valid scene object? if (m_pCBackObjectScene) { // Free the scene object m_pCBackObjectScene->Release_Ref (); - m_pCBackObjectScene = NULL; + m_pCBackObjectScene = nullptr; } // Was there a valid 2D camera? @@ -213,7 +213,7 @@ CW3DViewDoc::CleanupResources (void) { // Free the camera object m_pC2DCamera->Release_Ref (); - m_pC2DCamera = NULL; + m_pC2DCamera = nullptr; } // Was there a valid background camera? @@ -221,21 +221,21 @@ CW3DViewDoc::CleanupResources (void) { // Free the camera object m_pCBackObjectCamera->Release_Ref (); - m_pCBackObjectCamera = NULL; + m_pCBackObjectCamera = nullptr; } // Was there a valid background BMP? if (m_pCBackgroundBMP) { m_pCBackgroundBMP->Release_Ref (); - m_pCBackgroundBMP = NULL; + m_pCBackgroundBMP = nullptr; } // Was there a valid scene light? if (m_pCSceneLight) { m_pCSceneLight->Release_Ref (); - m_pCSceneLight = NULL; + m_pCSceneLight = nullptr; } // Was there a valid display object? @@ -352,7 +352,7 @@ void CW3DViewDoc::Dump(CDumpContext& dc) const void CW3DViewDoc::InitScene (void) { - if (m_pCScene == NULL) { + if (m_pCScene == nullptr) { // // Make sure the emitters don't remove themselves from the scene @@ -362,7 +362,7 @@ CW3DViewDoc::InitScene (void) m_pCScene = new ViewerSceneClass; ASSERT (m_pCScene); - if (m_pCScene != NULL) { + if (m_pCScene != nullptr) { // Set some default ambient lighting m_pCScene->Set_Ambient_Light (Vector3 (0.5F, 0.5F, 0.5F)); @@ -374,7 +374,7 @@ CW3DViewDoc::InitScene (void) m_pCSceneLight = new LightClass; ASSERT (m_pCSceneLight); - if (m_pCSceneLight != NULL) { + if (m_pCSceneLight != nullptr) { // Create some default light settings m_pCSceneLight->Set_Position (Vector3 (0, 5000, 3000)); @@ -481,7 +481,7 @@ CW3DViewDoc::OnOpenDocument (LPCTSTR lpszPathName) // Don't allow repaints while the load is going on // CGraphicView *current_view = ::Get_Graphic_View (); - if (current_view != NULL) { + if (current_view != nullptr) { current_view->Allow_Update (false); } @@ -494,14 +494,14 @@ CW3DViewDoc::OnOpenDocument (LPCTSTR lpszPathName) // Re-load the data list to include all new assets // CDataTreeView *data_view = GetDataTreeView (); - if (data_view != NULL) { + if (data_view != nullptr) { data_view->LoadAssetsIntoTree (); } // // Turn repainting back on... // - if (current_view != NULL) { + if (current_view != nullptr) { current_view->Allow_Update (true); } @@ -517,7 +517,7 @@ CW3DViewDoc::OnOpenDocument (LPCTSTR lpszPathName) void CW3DViewDoc::LoadAssetsFromFile (LPCTSTR lpszPathName) { - if (m_pCScene == NULL) { + if (m_pCScene == nullptr) { InitScene (); } @@ -535,7 +535,7 @@ CW3DViewDoc::LoadAssetsFromFile (LPCTSTR lpszPathName) // Don't allow repaints while the load is going on // CGraphicView *current_view = ::Get_Graphic_View (); - if (current_view != NULL) { + if (current_view != nullptr) { current_view->Allow_Update (false); } @@ -555,7 +555,7 @@ CW3DViewDoc::LoadAssetsFromFile (LPCTSTR lpszPathName) // Load the texture file into the asset manager TextureClass *ptexture = WW3DAssetManager::Get_Instance()->Get_Texture (::Get_Filename_From_Path (lpszPathName)); - if (ptexture != NULL) { + if (ptexture != nullptr) { ptexture->Release_Ref(); } @@ -566,7 +566,7 @@ CW3DViewDoc::LoadAssetsFromFile (LPCTSTR lpszPathName) // // Turn repainting back on... // - if (current_view != NULL) { + if (current_view != nullptr) { current_view->Allow_Update (true); } @@ -606,23 +606,23 @@ CW3DViewDoc::Display_Emitter ASSERT (m_pCScene); // Data OK? - if (m_pCScene != NULL) { + if (m_pCScene != nullptr) { // Lose the animation SAFE_DELETE (m_pCAnimCombo); REF_PTR_RELEASE (m_pCAnimation); - if (m_pCRenderObj != NULL) { + if (m_pCRenderObj != nullptr) { // Remove this object from the scene Remove_Object_From_Scene (m_pCRenderObj); m_pCRenderObj->Release_Ref (); - m_pCRenderObj = NULL; + m_pCRenderObj = nullptr; } m_pCScene->Clear_Lineup(); // Do we have a new emitter to display? - if (pemitter != NULL) { + if (pemitter != nullptr) { // Add the emitter to the scene pemitter->Set_Transform (Matrix3D (1)); @@ -678,7 +678,7 @@ CW3DViewDoc::DisplayObject // Remove this object from the scene Remove_Object_From_Scene (m_pCRenderObj); m_pCRenderObj->Release_Ref (); - m_pCRenderObj = NULL; + m_pCRenderObj = nullptr; } } m_pCScene->Clear_Lineup(); @@ -770,7 +770,7 @@ CW3DViewDoc::DisplayObject void CW3DViewDoc::ResetAnimation (void) { - if (m_pCAnimation != NULL) { + if (m_pCAnimation != nullptr) { // // Reset the frame counter @@ -919,18 +919,18 @@ CW3DViewDoc::PlayAnimation void CW3DViewDoc::Play_Animation_Sound (void) { - if (m_pCAnimation != NULL) { + if (m_pCAnimation != nullptr) { CString animation_name = m_pCAnimation->Get_Name (); // // Play a sound with the animation // const char *separator = ::strchr (animation_name , '.'); - if (separator != NULL) { + if (separator != nullptr) { CString sound_filename = separator + 1; sound_filename += ".wav"; - ::PlaySound (NULL, NULL, SND_PURGE); - ::PlaySound (sound_filename, NULL, SND_FILENAME | SND_ASYNC | SND_NODEFAULT); + ::PlaySound (nullptr, nullptr, SND_PURGE); + ::PlaySound (sound_filename, nullptr, SND_FILENAME | SND_ASYNC | SND_NODEFAULT); } } @@ -1020,10 +1020,10 @@ Get_Camera_Transform (RenderObjClass *render_obj, Matrix3D &tm) { bool retval = false; - if (render_obj != NULL) { + if (render_obj != nullptr) { for (int index = 0; (index < render_obj->Get_Num_Sub_Objects ()) && !retval; index ++) { RenderObjClass *psub_obj = render_obj->Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { retval = Get_Camera_Transform (psub_obj, tm); } REF_PTR_RELEASE (psub_obj); @@ -1051,7 +1051,7 @@ void CW3DViewDoc::Update_Camera (void) { // Should we update the camera's position as well? - if (m_bAnimateCamera && m_pCRenderObj != NULL) { + if (m_bAnimateCamera && m_pCRenderObj != nullptr) { Matrix3D transform (1); if (Get_Camera_Transform (m_pCRenderObj, transform)) { @@ -1138,7 +1138,7 @@ CW3DViewDoc::UpdateFrame (float relativeTimeSlice) CDataTreeView * CW3DViewDoc::GetDataTreeView (void) { - CDataTreeView *pCDataTreeView = NULL; + CDataTreeView *pCDataTreeView = nullptr; // Get a pointer to the main window CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); @@ -1161,7 +1161,7 @@ CW3DViewDoc::GetDataTreeView (void) CGraphicView * CW3DViewDoc::GetGraphicView (void) { - CGraphicView *pCGrephicView = NULL; + CGraphicView *pCGrephicView = nullptr; // Get a pointer to the main window CMainFrame *pCMainWnd = (CMainFrame *)::AfxGetMainWnd (); @@ -1189,7 +1189,7 @@ CW3DViewDoc::GenerateLOD ) { // Assume failure - HLodPrototypeClass *plod_prototype = NULL; + HLodPrototypeClass *plod_prototype = nullptr; // Get an iterator from the asset manager that we can // use to enumerate the currently loaded assets @@ -1225,8 +1225,8 @@ CW3DViewDoc::GenerateLOD // Create an array of LOD models RenderObjClass **plod_array = new RenderObjClass *[lod_count]; - ASSERT (plod_array != NULL); - if (plod_array != NULL) { + ASSERT (plod_array != nullptr); + if (plod_array != nullptr) { // Loop through all the levels-of-detail and add them to our array int lod_index; @@ -1285,7 +1285,7 @@ CW3DViewDoc::SetBackgroundBMP (LPCTSTR pszBackgroundBMP) // and release its pointer m_pCBackgroundBMP->Remove (); m_pCBackgroundBMP->Release_Ref (); - m_pCBackgroundBMP = NULL; + m_pCBackgroundBMP = nullptr; } // Is this a new background BMP? @@ -1324,8 +1324,8 @@ CW3DViewDoc::LoadSettings (LPCTSTR filename) BOOL bReturn = FALSE; // Params OK? - ASSERT (filename != NULL); - if (filename != NULL) { + ASSERT (filename != nullptr); + if (filename != nullptr) { // Open the INI file FileClass * pini_file = _TheFileFactory->Get_File (filename); @@ -1505,25 +1505,25 @@ CW3DViewDoc::SaveSettings HANDLE hFile = ::CreateFile (pszFilename, 0, 0, - NULL, + nullptr, OPEN_ALWAYS, 0L, - NULL); + nullptr); - ASSERT (hFile != NULL); - if (hFile == NULL) + ASSERT (hFile != nullptr); + if (hFile == nullptr) { // Invalid file, let the user know ::AfxGetMainWnd ()->MessageBox ("Unable to open file for writing. Please select another filename.", "File Error", MB_ICONERROR | MB_OK); } else if (pszFilename && (dwSettingsMask != 0L) && - (m_pCScene != NULL)) + (m_pCScene != nullptr)) { CString stringCompleteFilename = pszFilename; // Does this filename contain a path? - if (::strrchr (pszFilename, '\\') == NULL) + if (::strrchr (pszFilename, '\\') == nullptr) { // Add the current directories path to the filename TCHAR szPath[MAX_PATH] = { 0 }; @@ -1731,7 +1731,7 @@ CW3DViewDoc::Save_Selected_LOD (void) bool retval = false; // Is this an emitter? - if ((m_pCRenderObj != NULL) && + if ((m_pCRenderObj != nullptr) && m_pCRenderObj->Class_ID () == RenderObjClass::CLASSID_HLOD) { // Build the default filename from the name of the LOD @@ -1771,15 +1771,15 @@ CW3DViewDoc::Save_Current_LOD (const CString &filename) bool retval = false; // Get the prototype for this aggregate - HLodPrototypeClass *proto = NULL; + HLodPrototypeClass *proto = nullptr; proto = (HLodPrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // Get the definition from the prototype HLodDefClass *pdefinition = proto->Get_Definition (); - ASSERT (pdefinition != NULL); - if (pdefinition != NULL) { + ASSERT (pdefinition != nullptr); + if (pdefinition != nullptr) { // Get a file object for the new file FileClass *pfile = _TheFileFactory->Get_File (filename); @@ -1827,7 +1827,7 @@ CW3DViewDoc::SetBackgroundObject (LPCTSTR pszBackgroundObjectName) // Free the object m_pCBackgroundObject->Release_Ref (); - m_pCBackgroundObject = NULL; + m_pCBackgroundObject = nullptr; } if (pszBackgroundObjectName) @@ -1877,8 +1877,8 @@ CW3DViewDoc::SetBackgroundObject (LPCTSTR pszBackgroundObjectName) void CW3DViewDoc::Remove_Object_From_Scene (RenderObjClass *prender_obj) { - // If the render object is NULL, then remove the current render object - if (prender_obj == NULL) { + // If the render object is null, then remove the current render object + if (prender_obj == nullptr) { prender_obj = m_pCRenderObj; } @@ -1886,14 +1886,14 @@ CW3DViewDoc::Remove_Object_From_Scene (RenderObjClass *prender_obj) //for (int index = 0; index < prender_obj->Get_Num_Sub_Objects (); index ++) { while (prender_obj->Get_Num_Sub_Objects () > 0) { RenderObjClass *psub_obj = prender_obj->Get_Sub_Object (0); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { Remove_Object_From_Scene (psub_obj); } REF_PTR_RELEASE (psub_obj); } // If this is an emitter, then remove its buffer - if ((prender_obj != NULL) && + if ((prender_obj != nullptr) && prender_obj->Class_ID () == RenderObjClass::CLASSID_PARTICLEEMITTER) { // Attempt to remove this emitter's buffer @@ -1903,7 +1903,7 @@ CW3DViewDoc::Remove_Object_From_Scene (RenderObjClass *prender_obj) } // Remove the render object from the scene (if we have a valid scene) - if (m_pCScene != NULL) { + if (m_pCScene != nullptr) { prender_obj->Remove (); } @@ -1923,7 +1923,7 @@ CW3DViewDoc::Save_Selected_Primitive (void) bool retval = false; // Is this an emitter? - if ((m_pCRenderObj != NULL) && + if ((m_pCRenderObj != nullptr) && (m_pCRenderObj->Class_ID () == RenderObjClass::CLASSID_SPHERE || m_pCRenderObj->Class_ID () == RenderObjClass::CLASSID_RING)) { @@ -1975,10 +1975,10 @@ CW3DViewDoc::Save_Current_Sphere (const CString &filename) // // Get the prototype for this object // - SpherePrototypeClass *proto = NULL; + SpherePrototypeClass *proto = nullptr; proto = (SpherePrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // // Get a file object for the new file @@ -2018,10 +2018,10 @@ CW3DViewDoc::Save_Current_Ring (const CString &filename) // // Get the prototype for this object // - RingPrototypeClass *proto = NULL; + RingPrototypeClass *proto = nullptr; proto = (RingPrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // // Get a file object for the new file @@ -2059,7 +2059,7 @@ CW3DViewDoc::Save_Selected_Emitter (void) bool retval = false; // Is this an emitter? - if ((m_pCRenderObj != NULL) && + if ((m_pCRenderObj != nullptr) && m_pCRenderObj->Class_ID () == RenderObjClass::CLASSID_PARTICLEEMITTER) { // Build the default filename from the name of the emitter @@ -2098,15 +2098,15 @@ CW3DViewDoc::Save_Current_Emitter (const CString &filename) // Assume failure bool retval = false; // Get the prototype for this aggregate - ParticleEmitterPrototypeClass *proto = NULL; + ParticleEmitterPrototypeClass *proto = nullptr; proto = (ParticleEmitterPrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // Get the definition from the prototype ParticleEmitterDefClass *pdefinition = proto->Get_Definition (); - ASSERT (pdefinition != NULL); - if (pdefinition != NULL) { + ASSERT (pdefinition != nullptr); + if (pdefinition != nullptr) { // Get a file object for the new file FileClass *pfile = _TheFileFactory->Get_File (filename); @@ -2143,7 +2143,7 @@ CW3DViewDoc::Save_Selected_Sound_Object (void) // // Is this a sound render object? // - if ((m_pCRenderObj != NULL) && + if ((m_pCRenderObj != nullptr) && m_pCRenderObj->Class_ID () == RenderObjClass::CLASSID_SOUND) { // @@ -2189,18 +2189,18 @@ CW3DViewDoc::Save_Current_Sound_Object (const CString &filename) // // Get the prototype for this sound object // - SoundRenderObjPrototypeClass *proto = NULL; + SoundRenderObjPrototypeClass *proto = nullptr; proto = (SoundRenderObjPrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // // Get the definition from the prototype // SoundRenderObjDefClass *definition = proto->Peek_Definition (); - ASSERT (definition != NULL); - if (definition != NULL) { + ASSERT (definition != nullptr); + if (definition != nullptr) { // // Get a file object for the new file @@ -2240,7 +2240,7 @@ CW3DViewDoc::Save_Current_Sound_Object (const CString &filename) void CW3DViewDoc::Auto_Assign_Bones (void) { - if (m_pCRenderObj != NULL) { + if (m_pCRenderObj != nullptr) { bool bupdate_prototype = false; // Loop through all the bones in this render object @@ -2280,7 +2280,7 @@ CW3DViewDoc::Save_Selected_Aggregate (void) bool retval = false; // Do we have a valid render object? - if (m_pCRenderObj != NULL) { + if (m_pCRenderObj != nullptr) { // Build the default filename from the name of render object CString default_filename = GetDataTreeView ()->GetCurrentSelectionName (); @@ -2318,15 +2318,15 @@ CW3DViewDoc::Save_Current_Aggregate (const CString &filename) // Assume failure bool retval = false; // Get the prototype for this aggregate - AggregatePrototypeClass *proto = NULL; + AggregatePrototypeClass *proto = nullptr; proto = (AggregatePrototypeClass *)WW3DAssetManager::Get_Instance ()->Find_Prototype (m_pCRenderObj->Get_Name ()); - ASSERT (proto != NULL); - if (proto != NULL) { + ASSERT (proto != nullptr); + if (proto != nullptr) { // Get the definition from the prototype AggregateDefClass *pdefinition = proto->Get_Definition (); - ASSERT (pdefinition != NULL); - if (pdefinition != NULL) { + ASSERT (pdefinition != nullptr); + if (pdefinition != nullptr) { // Get a file object for the new file FileClass *pfile = _TheFileFactory->Get_File (filename); @@ -2425,11 +2425,11 @@ CW3DViewDoc::Make_Movie (void) // Get the directory where this executable was run from TCHAR filename[MAX_PATH]; - ::GetModuleFileName (NULL, filename, sizeof (filename)); + ::GetModuleFileName (nullptr, filename, sizeof (filename)); // Strip the filename from the path LPTSTR ppath = ::strrchr (filename, '\\'); - if (ppath != NULL) { + if (ppath != nullptr) { ppath[0] = 0; } ::SetCurrentDirectory (filename); @@ -2522,9 +2522,9 @@ CW3DViewDoc::Build_Emitter_List ) { // - // If the render object is NULL, then start from the current render object + // If the render object is null, then start from the current render object // - if (render_obj == NULL) { + if (render_obj == nullptr) { render_obj = m_pCRenderObj; } @@ -2533,7 +2533,7 @@ CW3DViewDoc::Build_Emitter_List // for (int index = 0; index < render_obj->Get_Num_Sub_Objects (); index ++) { RenderObjClass *psub_obj = render_obj->Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { Build_Emitter_List (emitter_list, emitter_name, psub_obj); } REF_PTR_RELEASE (psub_obj); @@ -2542,7 +2542,7 @@ CW3DViewDoc::Build_Emitter_List // // Is this the emitter we are requesting? // - if ((render_obj != NULL) && + if ((render_obj != nullptr) && (render_obj->Class_ID () == RenderObjClass::CLASSID_PARTICLEEMITTER) && (::lstrcmpi (emitter_name, render_obj->Get_Name ()) == 0)) { @@ -2561,7 +2561,7 @@ CW3DViewDoc::Build_Emitter_List void CW3DViewDoc::Show_Cursor (bool onoff) { - if (m_pCursor == NULL) { + if (m_pCursor == nullptr) { Create_Cursor (); } @@ -2578,7 +2578,7 @@ CW3DViewDoc::Show_Cursor (bool onoff) bool CW3DViewDoc::Is_Cursor_Shown (void) const { - return m_pCursor != NULL && m_pCursor->Is_Not_Hidden_At_All (); + return m_pCursor != nullptr && m_pCursor->Is_Not_Hidden_At_All (); } @@ -2603,7 +2603,7 @@ CW3DViewDoc::Set_Cursor (LPCTSTR resource_name) void CW3DViewDoc::Create_Cursor (void) { - if (m_pCursor == NULL) { + if (m_pCursor == nullptr) { m_pCursor = new ScreenCursorClass; m_pCursor->Set_Window (GetGraphicView ()->m_hWnd); m_pCursor->Set_Texture (::Load_RC_Texture ("cursor.tga")); @@ -2624,19 +2624,19 @@ CW3DViewDoc::Count_Particles (RenderObjClass *render_obj) int count = 0; // - // If the render object is NULL, then start from the current render object + // If the render object is null, then start from the current render object // - if (render_obj == NULL) { + if (render_obj == nullptr) { render_obj = m_pCRenderObj; } // // Recursively walk through the subobjects // - if (render_obj != NULL) { + if (render_obj != nullptr) { for (int index = 0; index < render_obj->Get_Num_Sub_Objects (); index ++) { RenderObjClass *psub_obj = render_obj->Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { count += Count_Particles (psub_obj); } REF_PTR_RELEASE (psub_obj); @@ -2651,7 +2651,7 @@ CW3DViewDoc::Count_Particles (RenderObjClass *render_obj) // ParticleEmitterClass *emitter = static_cast (render_obj); ParticleBufferClass *buffer = emitter->Peek_Buffer (); - if (buffer != NULL) { + if (buffer != nullptr) { count += buffer->Get_Particle_Count (); } } @@ -2684,19 +2684,19 @@ void CW3DViewDoc::Switch_LOD (int increment, RenderObjClass *render_obj) { // - // If the render object is NULL, then start from the current render object + // If the render object is null, then start from the current render object // - if (render_obj == NULL) { + if (render_obj == nullptr) { render_obj = m_pCRenderObj; } // // Recursively walk through the subobjects // - if (render_obj != NULL) { + if (render_obj != nullptr) { for (int index = 0; index < render_obj->Get_Num_Sub_Objects (); index ++) { RenderObjClass *psub_obj = render_obj->Get_Sub_Object (index); - if (psub_obj != NULL) { + if (psub_obj != nullptr) { Switch_LOD (increment, psub_obj); } REF_PTR_RELEASE (psub_obj); @@ -2724,13 +2724,13 @@ void CW3DViewDoc::Toggle_Alternate_Materials(RenderObjClass * render_obj) { // - // If the render object is NULL, start from the current render object + // If the render object is null, start from the current render object // - if (render_obj == NULL) { + if (render_obj == nullptr) { render_obj = m_pCRenderObj; } - if (render_obj != NULL) { + if (render_obj != nullptr) { // // If this is a mesh, toggle the materials @@ -2793,7 +2793,7 @@ void CW3DViewDoc::Copy_Assets_To_Dir (LPCTSTR directory) { CDataTreeView *data_tree = GetDataTreeView (); - SANITY_CHECK ((m_pCRenderObj != NULL && data_tree != NULL)) { + SANITY_CHECK ((m_pCRenderObj != nullptr && data_tree != nullptr)) { return ; } @@ -2986,9 +2986,9 @@ CW3DViewDoc::Import_Facial_Animation (const CString &heirarchy_name, const CStri const HTreeClass * CW3DViewDoc::Get_Current_HTree (void) const { - const HTreeClass *htree = NULL; + const HTreeClass *htree = nullptr; - if (m_pCRenderObj != NULL) { + if (m_pCRenderObj != nullptr) { htree = m_pCRenderObj->Get_HTree (); } @@ -3009,7 +3009,7 @@ CW3DViewDoc::Save_Camera_Settings (void) CGraphicView *graphic_view = ::Get_Graphic_View (); CameraClass *camera = graphic_view->GetCamera (); - if (camera != NULL) { + if (camera != nullptr) { double hfov = camera->Get_Horizontal_FOV (); double vfov = camera->Get_Vertical_FOV (); @@ -3049,9 +3049,9 @@ CW3DViewDoc::Load_Camera_Settings (void) m_ManualClipPlanes = (theApp.GetProfileInt ("Config", "UseManualClipPlanes", 0) == TRUE); CGraphicView *graphic_view = GetGraphicView (); - if (graphic_view != NULL) { + if (graphic_view != nullptr) { CameraClass *camera = graphic_view->GetCamera (); - if (camera != NULL) { + if (camera != nullptr) { // // Should we load the FOV settings from the registry? @@ -3080,7 +3080,7 @@ CW3DViewDoc::Load_Camera_Settings (void) camera->Set_Clip_Planes (znear, zfar); - if (m_pCScene != NULL) { + if (m_pCScene != nullptr) { m_pCScene->Set_Fog_Range (znear, zfar); m_pCScene->Recalculate_Fog_Planes(); } @@ -3099,7 +3099,7 @@ CW3DViewDoc::Load_Camera_Settings (void) void CW3DViewDoc::Render_Dazzles (CameraClass * camera) { - if (m_pDazzleLayer != NULL) { + if (m_pDazzleLayer != nullptr) { m_pDazzleLayer->Render(camera); } } diff --git a/Core/Tools/W3DView/W3DViewDoc.h b/Core/Tools/W3DView/W3DViewDoc.h index cab9ffd9b1a..4c0d0b00592 100644 --- a/Core/Tools/W3DView/W3DViewDoc.h +++ b/Core/Tools/W3DView/W3DViewDoc.h @@ -130,14 +130,14 @@ class CW3DViewDoc : public CDocument bool Is_Initialized (void) { return m_IsInitialized; } void Reload_Displayed_Object (void); - void Display_Emitter (ParticleEmitterClass *pemitter = NULL, bool use_global_reset_flag = true, bool allow_reset = true); - void DisplayObject (RenderObjClass *pCModel = NULL, bool use_global_reset_flag = true, bool allow_reset = true, bool add_ghost = false); + void Display_Emitter (ParticleEmitterClass *pemitter = nullptr, bool use_global_reset_flag = true, bool allow_reset = true); + void DisplayObject (RenderObjClass *pCModel = nullptr, bool use_global_reset_flag = true, bool allow_reset = true, bool add_ghost = false); BOOL SaveSettings (LPCTSTR pszFilename, DWORD dwSettingsMask); BOOL LoadSettings (LPCTSTR pszFileName); CGraphicView * GetGraphicView (void); CDataTreeView * GetDataTreeView (void); - void Build_Emitter_List (EmitterInstanceListClass *emitter_list, LPCTSTR emitter_name, RenderObjClass *render_obj = NULL); + void Build_Emitter_List (EmitterInstanceListClass *emitter_list, LPCTSTR emitter_name, RenderObjClass *render_obj = nullptr); // // Animation methods @@ -145,7 +145,7 @@ class CW3DViewDoc : public CDocument void Make_Movie (void); void ResetAnimation (void); void StepAnimation (int frame_inc = 1); - void PlayAnimation (RenderObjClass *pobj, LPCTSTR panim_name = NULL, bool use_global_reset_flag = true, bool allow_reset = true); + void PlayAnimation (RenderObjClass *pobj, LPCTSTR panim_name = nullptr, bool use_global_reset_flag = true, bool allow_reset = true); void PlayAnimation (RenderObjClass *pobj, HAnimComboClass *pcombo, bool use_global_reset_flag = true, bool allow_reset = true); void UpdateFrame (float time_slice); void SetAnimationBlend (BOOL bBlend) { m_bAnimBlend = bBlend; } @@ -191,7 +191,7 @@ class CW3DViewDoc : public CDocument // // Scene methods // - void Remove_Object_From_Scene (RenderObjClass *prender_obj = NULL); + void Remove_Object_From_Scene (RenderObjClass *prender_obj = nullptr); // // Emitter serialization methods @@ -224,12 +224,12 @@ class CW3DViewDoc : public CDocument // bool Save_Current_LOD (const CString &filename); bool Save_Selected_LOD (void); - void Switch_LOD (int increment = 1, RenderObjClass *render_obj = NULL); + void Switch_LOD (int increment = 1, RenderObjClass *render_obj = nullptr); // // Alternate Material interface. // - void Toggle_Alternate_Materials(RenderObjClass * obj = NULL); + void Toggle_Alternate_Materials(RenderObjClass * obj = nullptr); // // Prototype methods @@ -248,7 +248,7 @@ class CW3DViewDoc : public CDocument // // Particle methods // - int Count_Particles (RenderObjClass *render_obj = NULL); + int Count_Particles (RenderObjClass *render_obj = nullptr); void Update_Particle_Count (void); // @@ -268,7 +268,7 @@ class CW3DViewDoc : public CDocument // void Copy_Assets_To_Dir (LPCTSTR directory); bool Lookup_Path (LPCTSTR asset_name, CString &path); - const char * Get_Last_Path (void) const { return (m_LastPath.IsEmpty () ? NULL : (const char *)m_LastPath); } + const char * Get_Last_Path (void) const { return (m_LastPath.IsEmpty () ? nullptr : (const char *)m_LastPath); } // // Texture search paths diff --git a/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp b/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp index dec1f6681a8..c9e6880c21a 100644 --- a/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp +++ b/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp @@ -67,7 +67,7 @@ void AlphaModifierClass::ModifyObject(TimeValue t, ModContext &mc, ObjectState * int numVert = mesh->getNumVerts(); int i = 0; - float *vdata = NULL; + float *vdata = nullptr; // Get parameters from pblock float sparam = 0.0f; @@ -248,7 +248,7 @@ static ParamBlockDesc2 alpha_param_blk ( //rollout 0, _T("AlphaModifierParams"), 0, &AlphaCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0, - IDD_ALPHA_MODIFIER, IDS_PARAMETERS, 0, 0, NULL, + IDD_ALPHA_MODIFIER, IDS_PARAMETERS, 0, 0, nullptr, // params @@ -398,7 +398,7 @@ Animatable* AlphaModifierClass::SubAnim(int i) switch (i) { case 0: return pblock; - default: return NULL; + default: return nullptr; } } @@ -418,7 +418,7 @@ RefTargetHandle AlphaModifierClass::GetReference(int i) case 0: return pblock; default: assert(TRUE); - return NULL; + return nullptr; } } diff --git a/Core/Tools/WW3D/max2w3d/AlphaModifier.h b/Core/Tools/WW3D/max2w3d/AlphaModifier.h index e698b0e20e3..775901a3c52 100644 --- a/Core/Tools/WW3D/max2w3d/AlphaModifier.h +++ b/Core/Tools/WW3D/max2w3d/AlphaModifier.h @@ -107,11 +107,11 @@ class AlphaModifierClass : public Modifier // Direct paramblock access int NumParamBlocks() {return 1;} IParamBlock2* GetParamBlock(int i) { return pblock;} - IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : NULL;} + IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : nullptr;} int GetParamBlockIndex(int id) {return id;} // Does not use createmouse callbacks - CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;} + CreateMouseCallBack* GetCreateMouseCallBack() {return nullptr;} // Load and unload our UI void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev); diff --git a/Core/Tools/WW3D/max2w3d/AppData.cpp b/Core/Tools/WW3D/max2w3d/AppData.cpp index 2290ed6d455..b707b56421d 100644 --- a/Core/Tools/WW3D/max2w3d/AppData.cpp +++ b/Core/Tools/WW3D/max2w3d/AppData.cpp @@ -82,11 +82,11 @@ Value * copy_app_data_cf (Value **arg_list, int count) ** Copy W3DAppData0Struct */ W3DAppData0Struct *app_data_0 = GetW3DAppData0(src_node); - if (app_data_0 != NULL) { + if (app_data_0 != nullptr) { // App Data 0 is now obsolete, not fatal if we don't find one W3DAppData0Struct *copy_data_0 = new W3DAppData0Struct; - if (copy_data_0 == NULL) + if (copy_data_0 == nullptr) throw RuntimeError("Out of memory."); // Copy the app data and give it to the target node. @@ -99,11 +99,11 @@ Value * copy_app_data_cf (Value **arg_list, int count) ** Copy W3DAppData1Struct */ W3DAppData1Struct *app_data_1 = GetW3DAppData1(src_node); - if (app_data_1 == NULL) + if (app_data_1 == nullptr) throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]); W3DAppData1Struct *copy_data_1 = new W3DAppData1Struct; - if (copy_data_1 == NULL) + if (copy_data_1 == nullptr) throw RuntimeError("Out of memory."); // Copy the app data and give it to the target node. @@ -116,11 +116,11 @@ Value * copy_app_data_cf (Value **arg_list, int count) ** Copy W3DAppData2Struct */ W3DAppData2Struct *app_data_2 = GetW3DAppData2(src_node); - if (app_data_2 == NULL) + if (app_data_2 == nullptr) throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]); W3DAppData2Struct *copy_data_2 = new W3DAppData2Struct; - if (copy_data_2 == NULL) + if (copy_data_2 == nullptr) throw RuntimeError("Out of memory."); // Copy the app data and give it to the target node. @@ -132,10 +132,10 @@ Value * copy_app_data_cf (Value **arg_list, int count) ** Copy W3DDazzleAppDataStruct if one is present. */ W3DDazzleAppDataStruct *dazzle_app_data = GetW3DDazzleAppData(src_node); - if (dazzle_app_data != NULL) { + if (dazzle_app_data != nullptr) { W3DDazzleAppDataStruct *copy_dazzle_data = new W3DDazzleAppDataStruct; - if (copy_dazzle_data == NULL) + if (copy_dazzle_data == nullptr) throw RuntimeError("Out of memory."); @@ -170,7 +170,7 @@ Value * set_origin_app_data_cf (Value **arg_list, int count) // Get the node's W3DAppData2Struct, and modify it accordingly. W3DAppData2Struct *data = GetW3DAppData2(origin); - if (data == NULL) + if (data == nullptr) throw RuntimeError("Unable to retrieve W3DAppData0Struct from object: ", arg_list[0]); // Turn off Export Geometry and Export Hierarchy. @@ -196,7 +196,7 @@ Value * get_hierarchy_file_cf (Value **arg_list, int count) check_arg_count("wwGetHierarchyFile", 0, count); // Retrieve the export options from the scene. - W3dExportOptionsStruct *options = NULL; + W3dExportOptionsStruct *options = nullptr; AppDataChunk * appdata = MAXScript_interface->GetScenePointer()->GetAppDataChunk(W3D_EXPORTER_CLASS_ID,SCENE_EXPORT_CLASS_ID,0); if (appdata) options = (W3dExportOptionsStruct*)(appdata->data); diff --git a/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp b/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp index 67ed5ccd8c3..7586fd38433 100644 --- a/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp @@ -56,8 +56,8 @@ ExportAllDlg::ExportAllDlg (Interface *max_interface) { m_Directory[0] = '\0'; m_Recursive = TRUE; - m_hWnd = NULL; - assert(max_interface != NULL); + m_hWnd = nullptr; + assert(max_interface != nullptr); m_MaxInterface = max_interface; } @@ -81,7 +81,7 @@ int ExportAllDlg::DoModal (void) BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static ExportAllDlg *dialog = NULL; + static ExportAllDlg *dialog = nullptr; if (uMsg == WM_INITDIALOG) { @@ -128,7 +128,7 @@ BOOL CALLBACK ExportAllDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPA if (OnOK() == FALSE) return TRUE; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); EndDialog(m_hWnd, 1); break; @@ -154,14 +154,14 @@ BOOL CALLBACK ExportAllDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPA void ExportAllDlg::OnInitDialog (void) { CenterWindow(m_hWnd, m_MaxInterface->GetMAXHWnd()); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // Set the check box state. CheckDlgButton(m_hWnd, IDC_RECURSIVE, m_Recursive); // Set the default directory. HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY); - assert(edit != NULL); + assert(edit != nullptr); SetWindowText(edit, m_Directory); } @@ -183,7 +183,7 @@ void ExportAllDlg::OnBrowse() if (SHGetPathFromIDList(il, folder_name)) { HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY); - assert(edit != NULL); + assert(edit != nullptr); SetWindowText(edit, folder_name); } else @@ -198,7 +198,7 @@ BOOL ExportAllDlg::OnOK (void) // freak on the user. char dir[_MAX_PATH]; HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY); - assert(edit != NULL); + assert(edit != nullptr); if (GetWindowText(edit, dir, sizeof(dir)) == 0) { // The edit box is empty, that's not a valid choice. diff --git a/Core/Tools/WW3D/max2w3d/FormClass.cpp b/Core/Tools/WW3D/max2w3d/FormClass.cpp index 28744373f69..84b3b6ff203 100644 --- a/Core/Tools/WW3D/max2w3d/FormClass.cpp +++ b/Core/Tools/WW3D/max2w3d/FormClass.cpp @@ -147,21 +147,21 @@ FormClass::fnFormProc BOOL FormClass::ExecuteDlgInit(LPCTSTR lpszResourceName) { // find resource handle - LPVOID lpResource = NULL; - HGLOBAL hResource = NULL; - if (lpszResourceName != NULL) + LPVOID lpResource = nullptr; + HGLOBAL hResource = nullptr; + if (lpszResourceName != nullptr) { HINSTANCE hInst = AppInstance; HRSRC hDlgInit = ::FindResource(hInst, lpszResourceName, RT_DLGINIT); - if (hDlgInit != NULL) + if (hDlgInit != nullptr) { // load it hResource = LoadResource(hInst, hDlgInit); - if (hResource == NULL) + if (hResource == nullptr) return FALSE; // lock it lpResource = LockResource(hResource); - assert(lpResource != NULL); + assert(lpResource != nullptr); } } @@ -169,7 +169,7 @@ BOOL FormClass::ExecuteDlgInit(LPCTSTR lpszResourceName) BOOL bResult = ExecuteDlgInit(lpResource); // cleanup - if (lpResource != NULL && hResource != NULL) + if (lpResource != nullptr && hResource != nullptr) { UnlockResource(hResource); FreeResource(hResource); @@ -195,7 +195,7 @@ BOOL FormClass::ExecuteDlgInit(LPCTSTR lpszResourceName) BOOL FormClass::ExecuteDlgInit(LPVOID lpResource) { BOOL bSuccess = TRUE; - if (lpResource != NULL) + if (lpResource != nullptr) { UNALIGNED WORD* lpnRes = (WORD*)lpResource; while (bSuccess && *lpnRes != 0) diff --git a/Core/Tools/WW3D/max2w3d/FormClass.h b/Core/Tools/WW3D/max2w3d/FormClass.h index 9f12c95df34..92ec1019a62 100644 --- a/Core/Tools/WW3D/max2w3d/FormClass.h +++ b/Core/Tools/WW3D/max2w3d/FormClass.h @@ -43,14 +43,14 @@ class FormClass : public ParamDlg { public: FormClass (void) - : m_hWnd (NULL) {} + : m_hWnd (nullptr) {} ~FormClass (void) {} HWND Create_Form (HWND parent_wnd, UINT template_id); void Show (bool show_flag = true) { ::ShowWindow (m_hWnd, show_flag ? SW_SHOW : SW_HIDE); } virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam) = 0; HWND Get_Hwnd(void) { return m_hWnd; } - virtual void Invalidate(void) { InvalidateRect(m_hWnd,NULL,0); } + virtual void Invalidate(void) { InvalidateRect(m_hWnd,nullptr,0); } protected: diff --git a/Core/Tools/WW3D/max2w3d/GameMtl.cpp b/Core/Tools/WW3D/max2w3d/GameMtl.cpp index 1010d91197f..9c0819fb59a 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtl.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtl.cpp @@ -216,7 +216,7 @@ class GameMtlPostLoad : public PostLoadCallback */ static ParamBlockDescID MainParameterBlockDesc[] = { - { TYPE_INT, NULL, FALSE, 0 }, // Pass Count + { TYPE_INT, nullptr, FALSE, 0 }, // Pass Count }; @@ -336,366 +336,366 @@ enum // Version 0 (old version) static ParamBlockDescID PassParameterBlockDescVer0[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - { TYPE_INT, NULL, FALSE, 20}, // DitherMask - { TYPE_INT, NULL, FALSE, 21}, // Shade Model - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_INT, nullptr, FALSE, 7 }, // Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + { TYPE_INT, nullptr, FALSE, 20}, // DitherMask + { TYPE_INT, nullptr, FALSE, 21}, // Shade Model + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type }; // Version 1 static ParamBlockDescID PassParameterBlockDescVer1[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1) - { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type - - { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) - - { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1) - { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_BOOL, nullptr, FALSE, 34}, // Copy specular to diffuse (new to version 1) + { TYPE_INT, nullptr, FALSE, 7 }, // Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 35}, // Stage0 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 39}, // Stage0 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 40}, // Stage1 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 44}, // Stage1 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) + + { TYPE_BOOL, nullptr, FALSE, 47}, // Alpha Test (new to version 1) + { TYPE_INT, nullptr, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) }; // Version 2 (old version) static ParamBlockDescID PassParameterBlockDescVer2[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1) - { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type - - { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) - - { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1) - { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A - { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B - { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C - { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_BOOL, nullptr, FALSE, 34}, // Copy specular to diffuse (new to version 1) + { TYPE_INT, nullptr, FALSE, 7 }, // Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 35}, // Stage0 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 39}, // Stage0 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 40}, // Stage1 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 44}, // Stage1 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) + + { TYPE_BOOL, nullptr, FALSE, 47}, // Alpha Test (new to version 1) + { TYPE_INT, nullptr, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 49}, // PS2 Shader Param A + { TYPE_INT, nullptr, FALSE, 50}, // PS2 Shader Param B + { TYPE_INT, nullptr, FALSE, 51}, // PS2 Shader Param C + { TYPE_INT, nullptr, FALSE, 52}, // PS2 Shader Param D }; // Version 3 (old version) static ParamBlockDescID PassParameterBlockDescVer3[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1) - { TYPE_INT, NULL, FALSE, 7 }, // Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type - - { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) - - { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1) - { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A - { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B - { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C - { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D - - { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel - { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_BOOL, nullptr, FALSE, 34}, // Copy specular to diffuse (new to version 1) + { TYPE_INT, nullptr, FALSE, 7 }, // Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 35}, // Stage0 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 39}, // Stage0 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 40}, // Stage1 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 44}, // Stage1 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) + + { TYPE_BOOL, nullptr, FALSE, 47}, // Alpha Test (new to version 1) + { TYPE_INT, nullptr, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 49}, // PS2 Shader Param A + { TYPE_INT, nullptr, FALSE, 50}, // PS2 Shader Param B + { TYPE_INT, nullptr, FALSE, 51}, // PS2 Shader Param C + { TYPE_INT, nullptr, FALSE, 52}, // PS2 Shader Param D + + { TYPE_INT, nullptr, FALSE, 53}, // Stage0 UV Channel + { TYPE_INT, nullptr, FALSE, 54}, // Stage1 UV Channel }; // Version 4 (old version) static ParamBlockDescID PassParameterBlockDescVer4[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1) - { TYPE_INT, NULL, FALSE, 7 }, // Stage0 Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) - { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type - - { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) - - { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1) - { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A - { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B - { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C - { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D - - { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel - { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel - - { TYPE_INT, NULL, FALSE, 9998}, // foo - { TYPE_INT, NULL, FALSE, 9999}, // bar - - { TYPE_INT, NULL, FALSE, 55}, // Stage1 Mapping Type (new to version 4) + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_BOOL, nullptr, FALSE, 34}, // Copy specular to diffuse (new to version 1) + { TYPE_INT, nullptr, FALSE, 7 }, // Stage0 Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 35}, // Stage0 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 39}, // Stage0 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 40}, // Stage1 Texture Resize (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 44}, // Stage1 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) + + { TYPE_BOOL, nullptr, FALSE, 47}, // Alpha Test (new to version 1) + { TYPE_INT, nullptr, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 49}, // PS2 Shader Param A + { TYPE_INT, nullptr, FALSE, 50}, // PS2 Shader Param B + { TYPE_INT, nullptr, FALSE, 51}, // PS2 Shader Param C + { TYPE_INT, nullptr, FALSE, 52}, // PS2 Shader Param D + + { TYPE_INT, nullptr, FALSE, 53}, // Stage0 UV Channel + { TYPE_INT, nullptr, FALSE, 54}, // Stage1 UV Channel + + { TYPE_INT, nullptr, FALSE, 9998}, // foo + { TYPE_INT, nullptr, FALSE, 9999}, // bar + + { TYPE_INT, nullptr, FALSE, 55}, // Stage1 Mapping Type (new to version 4) }; // Version 5 (current version) static ParamBlockDescID PassParameterBlockDescVer5[] = { - { TYPE_POINT3, NULL, TRUE, 0 }, // Ambient - { TYPE_POINT3, NULL, TRUE, 1 }, // Diffuse - { TYPE_POINT3, NULL, TRUE, 2 }, // Specular - { TYPE_POINT3, NULL, TRUE, 3 }, // Emissive - { TYPE_FLOAT, NULL, TRUE, 4 }, // Shininess - { TYPE_FLOAT, NULL, TRUE, 5 }, // Opacity - { TYPE_FLOAT, NULL, TRUE, 6 }, // Translucency - { TYPE_BOOL, NULL, FALSE, 34}, // Copy specular to diffuse (new to version 1) - { TYPE_INT, NULL, FALSE, 7 }, // Stage0 Mapping Type - { TYPE_INT, NULL, FALSE, 8 }, // PSX Translucency Type - { TYPE_BOOL, NULL, FALSE, 9 }, // PSX Lighting Flag - - { TYPE_INT, NULL, FALSE, 10}, // Depth Compare - { TYPE_INT, NULL, FALSE, 11}, // Depth Mask - { TYPE_INT, NULL, FALSE, 12}, // Color Mask (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 13}, // Dest Blend - { TYPE_INT, NULL, FALSE, 14}, // FogFunc (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 15}, // PriGradient - { TYPE_INT, NULL, FALSE, 16}, // SecGradient - { TYPE_INT, NULL, FALSE, 17}, // SrcBlend - { TYPE_INT, NULL, FALSE, 18}, // DetailColorFunc - { TYPE_INT, NULL, FALSE, 19}, // DetailAlphaFunc - - { TYPE_BOOL, NULL, FALSE, 22}, // Stage0 Texture Enable - { TYPE_BOOL, NULL, FALSE, 23}, // Stage0 Texture Publish - { TYPE_BOOL, NULL, FALSE, 35}, // Stage0 Texture Resize (new to version 1) OBSOLETE! - { TYPE_BOOL, NULL, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) OBSOLETE! - { TYPE_BOOL, NULL, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 39}, // Stage0 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 24}, // Stage0 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 25}, // Stage0 Frame Rate - { TYPE_INT, NULL, FALSE, 26}, // Stage0 Frame Count - { TYPE_INT, NULL, FALSE, 27}, // Stage0 Animation Type - - { TYPE_BOOL, NULL, FALSE, 28}, // Stage1 Texture Enable - { TYPE_BOOL, NULL, FALSE, 29}, // Stage1 Texture Publish - { TYPE_BOOL, NULL, FALSE, 40}, // Stage1 Texture Resize (new to version 1) OBSOLETE! - { TYPE_BOOL, NULL, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) OBSOLETE! - { TYPE_BOOL, NULL, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) - { TYPE_BOOL, NULL, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) - { TYPE_INT, NULL, FALSE, 44}, // Stage1 Texture Hint (new to version 1) - { TYPE_BOOL, NULL, FALSE, 30}, // Stage1 Texture Display (in viewport...) - { TYPE_FLOAT, NULL, FALSE, 31}, // Stage1 Frame Rate - { TYPE_INT, NULL, FALSE, 32}, // Stage1 Frame Count - { TYPE_INT, NULL, FALSE, 33}, // Stage1 Animation Type - - { TYPE_BOOL, NULL, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) - { TYPE_BOOL, NULL, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) - - { TYPE_BOOL, NULL, FALSE, 47}, // Alpha Test (new to version 1) - { TYPE_INT, NULL, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) - { TYPE_INT, NULL, FALSE, 49}, // PS2 Shader Param A - { TYPE_INT, NULL, FALSE, 50}, // PS2 Shader Param B - { TYPE_INT, NULL, FALSE, 51}, // PS2 Shader Param C - { TYPE_INT, NULL, FALSE, 52}, // PS2 Shader Param D - - { TYPE_INT, NULL, FALSE, 53}, // Stage0 UV Channel - { TYPE_INT, NULL, FALSE, 54}, // Stage1 UV Channel - - { TYPE_INT, NULL, FALSE, 55 }, // Stage1 Mapping Type (new to version 4) - - { TYPE_BOOL, NULL, FALSE, 56 }, // Stage0 no texture reduction (new to version 5) - { TYPE_BOOL, NULL, FALSE, 57 }, // Stage0 no texture reduction (new to version 5) + { TYPE_POINT3, nullptr, TRUE, 0 }, // Ambient + { TYPE_POINT3, nullptr, TRUE, 1 }, // Diffuse + { TYPE_POINT3, nullptr, TRUE, 2 }, // Specular + { TYPE_POINT3, nullptr, TRUE, 3 }, // Emissive + { TYPE_FLOAT, nullptr, TRUE, 4 }, // Shininess + { TYPE_FLOAT, nullptr, TRUE, 5 }, // Opacity + { TYPE_FLOAT, nullptr, TRUE, 6 }, // Translucency + { TYPE_BOOL, nullptr, FALSE, 34}, // Copy specular to diffuse (new to version 1) + { TYPE_INT, nullptr, FALSE, 7 }, // Stage0 Mapping Type + { TYPE_INT, nullptr, FALSE, 8 }, // PSX Translucency Type + { TYPE_BOOL, nullptr, FALSE, 9 }, // PSX Lighting Flag + + { TYPE_INT, nullptr, FALSE, 10}, // Depth Compare + { TYPE_INT, nullptr, FALSE, 11}, // Depth Mask + { TYPE_INT, nullptr, FALSE, 12}, // Color Mask (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 13}, // Dest Blend + { TYPE_INT, nullptr, FALSE, 14}, // FogFunc (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 15}, // PriGradient + { TYPE_INT, nullptr, FALSE, 16}, // SecGradient + { TYPE_INT, nullptr, FALSE, 17}, // SrcBlend + { TYPE_INT, nullptr, FALSE, 18}, // DetailColorFunc + { TYPE_INT, nullptr, FALSE, 19}, // DetailAlphaFunc + + { TYPE_BOOL, nullptr, FALSE, 22}, // Stage0 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 23}, // Stage0 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 35}, // Stage0 Texture Resize (new to version 1) OBSOLETE! + { TYPE_BOOL, nullptr, FALSE, 36}, // Stage0 Texture No Mipmap (new to version 1) OBSOLETE! + { TYPE_BOOL, nullptr, FALSE, 37}, // Stage0 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 38}, // Stage0 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 39}, // Stage0 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 24}, // Stage0 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 25}, // Stage0 Frame Rate + { TYPE_INT, nullptr, FALSE, 26}, // Stage0 Frame Count + { TYPE_INT, nullptr, FALSE, 27}, // Stage0 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 28}, // Stage1 Texture Enable + { TYPE_BOOL, nullptr, FALSE, 29}, // Stage1 Texture Publish + { TYPE_BOOL, nullptr, FALSE, 40}, // Stage1 Texture Resize (new to version 1) OBSOLETE! + { TYPE_BOOL, nullptr, FALSE, 41}, // Stage1 Texture No Mipmap (new to version 1) OBSOLETE! + { TYPE_BOOL, nullptr, FALSE, 42}, // Stage1 Texture Clamp U (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 43}, // Stage1 Texture Clamp V (new to version 1) + { TYPE_INT, nullptr, FALSE, 44}, // Stage1 Texture Hint (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 30}, // Stage1 Texture Display (in viewport...) + { TYPE_FLOAT, nullptr, FALSE, 31}, // Stage1 Frame Rate + { TYPE_INT, nullptr, FALSE, 32}, // Stage1 Frame Count + { TYPE_INT, nullptr, FALSE, 33}, // Stage1 Animation Type + + { TYPE_BOOL, nullptr, FALSE, 45}, // Stage0 Texture Alpha Bitmap (new to version 1) + { TYPE_BOOL, nullptr, FALSE, 46}, // Stage1 Texture Alpha Bitmap (new to version 1) + + { TYPE_BOOL, nullptr, FALSE, 47}, // Alpha Test (new to version 1) + { TYPE_INT, nullptr, FALSE, 48}, // Shader preset (new to version 1) (now obsolete and ignored) + { TYPE_INT, nullptr, FALSE, 49}, // PS2 Shader Param A + { TYPE_INT, nullptr, FALSE, 50}, // PS2 Shader Param B + { TYPE_INT, nullptr, FALSE, 51}, // PS2 Shader Param C + { TYPE_INT, nullptr, FALSE, 52}, // PS2 Shader Param D + + { TYPE_INT, nullptr, FALSE, 53}, // Stage0 UV Channel + { TYPE_INT, nullptr, FALSE, 54}, // Stage1 UV Channel + + { TYPE_INT, nullptr, FALSE, 55 }, // Stage1 Mapping Type (new to version 4) + + { TYPE_BOOL, nullptr, FALSE, 56 }, // Stage0 no texture reduction (new to version 5) + { TYPE_BOOL, nullptr, FALSE, 57 }, // Stage0 no texture reduction (new to version 5) }; // Array of old pass parameter block versions (for backwards compatibility) @@ -738,7 +738,7 @@ Color scale(const Color& a, const Color& b) *=============================================================================================*/ GameMtl::GameMtl(BOOL loading) { - MaterialDialog = NULL; + MaterialDialog = nullptr; SurfaceType = SURFACE_TYPE_DEFAULT; SortLevel = SORT_LEVEL_NONE; @@ -748,23 +748,23 @@ GameMtl::GameMtl(BOOL loading) Flags |= GAMEMTL_PASSCOUNT_ROLLUP_OPEN; Set_Flag(GAMEMTL_CONVERTED_TO_NOLOD,true); - DisplacementMap = NULL; + DisplacementMap = nullptr; DisplacementAmt = 0.0F; - Maps = NULL; - MainParameterBlock = NULL; + Maps = nullptr; + MainParameterBlock = nullptr; for (int pass=0; passReplaceReference(texture_ref_index(pass,stage),Texture[pass][stage]->Clone()); } else { - mnew->ReplaceReference(texture_ref_index(pass,stage),NULL); + mnew->ReplaceReference(texture_ref_index(pass,stage),nullptr); } // Copy mapper arg strings and lengths @@ -1120,7 +1120,7 @@ RefTargetHandle GameMtl::GetReference(int i) } } - return NULL; + return nullptr; } @@ -1178,9 +1178,9 @@ void GameMtl::SetSubTexmap(int i, Texmap * m) int pass,stage; texmap_index_to_pass_stage(i,&pass,&stage); - if (Texture[pass][stage] != NULL) { + if (Texture[pass][stage] != nullptr) { UVGen * uvgen = Texture[pass][stage]->GetTheUVGen(); - if (uvgen != NULL) { + if (uvgen != nullptr) { uvgen->SetMapChannel(Get_Map_Channel(pass,stage)); } } @@ -1249,7 +1249,7 @@ ParamDlg * GameMtl::CreateParamDlg(HWND hwnd_mtl_edit, IMtlParams *imp) void GameMtl::Notify_Changed(void) { NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); - if (MaterialDialog != NULL) { + if (MaterialDialog != nullptr) { MaterialDialog->Update_Display(); } } @@ -1283,7 +1283,7 @@ void GameMtl::Reset() ReplaceReference(pass_ref_index(pass), pblock); for (int stage = 0;stage < W3dMaterialClass::MAX_STAGES; stage++) { - ReplaceReference(texture_ref_index(pass,stage), NULL); + ReplaceReference(texture_ref_index(pass,stage), nullptr); Set_Texture_Enable(pass,stage,false); Set_Texture_Publish(pass,stage,false); @@ -1302,7 +1302,7 @@ void GameMtl::Reset() if (MapperArg[pass][stage]) { delete [] (MapperArg[pass][stage]); - MapperArg[pass][stage] = NULL; + MapperArg[pass][stage] = nullptr; MapperArgLen[pass][stage] = 0; } } @@ -1439,7 +1439,7 @@ IOResult GameMtl::Load(ILoad *iload) int len = 0; unsigned char tmp8; unsigned short tmp16; - char * tmpstring = NULL; + char * tmpstring = nullptr; float tmpfloat; IOResult res; @@ -3072,7 +3072,7 @@ void GameMtl::Set_Texture_Display(int pass,int stage,bool val) } else { SetMtlFlag( MTL_TEX_DISPLAY_ENABLED, FALSE ); - SetActiveTexmap(NULL); + SetActiveTexmap(nullptr); NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); } @@ -3176,9 +3176,9 @@ void GameMtl::Set_Map_Channel(int pass,int stage,int val) PassParameterBlock[pass]->SetValue(PB_STAGE1_MAP_CHANNEL, 0, val); } - if (Texture[pass][stage] != NULL) { + if (Texture[pass][stage] != nullptr) { UVGen * uvgen = Texture[pass][stage]->GetTheUVGen(); - if (uvgen != NULL) { + if (uvgen != nullptr) { uvgen->SetMapChannel(val); } } @@ -3204,7 +3204,7 @@ char * GameMtl::Get_Mapping_Arg_Buffer(int pass, int stage, unsigned int len) assert(strlen(MapperArg[pass][stage]) <= MapperArgLen[pass][stage]); strcpy(temp, MapperArg[pass][stage]); delete [] (MapperArg[pass][stage]); - MapperArg[pass][stage] = NULL; + MapperArg[pass][stage] = nullptr; } MapperArg[pass][stage] = temp; @@ -3229,7 +3229,7 @@ void GameMtl::texmap_index_to_pass_stage(int index,int * set_pass,int * set_stag float GameMtl::EvalDisplacement(ShadeContext& sc) { float displacement = 0.0F; - if (DisplacementMap != NULL) { + if (DisplacementMap != nullptr) { displacement = DisplacementMap->EvalMono(sc); displacement = displacement * DisplacementAmt; } @@ -3269,7 +3269,7 @@ void GameMtlPostLoad::proc(ILoad *iload) } } - m->ReplaceReference(GameMtl::REF_MAPS,NULL); + m->ReplaceReference(GameMtl::REF_MAPS,nullptr); } // older material formats did not save the map channel and will default to zero, diff --git a/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp index 67f066ab183..464d1699b3c 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp @@ -77,13 +77,13 @@ static int _Pass_Index_To_Flag[] = GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m) { HwndEdit = hwMtlEdit; - HwndPassCount = NULL; - HwndSurfaceType = NULL; - HwndDisplacementMap = NULL; - HpalOld = NULL; + HwndPassCount = nullptr; + HwndSurfaceType = nullptr; + HwndDisplacementMap = nullptr; + HpalOld = nullptr; for (int i=0; iUnRegisterDlgWnd(HwndSurfaceType); IParams->DeleteRollupPage(HwndSurfaceType); - HwndSurfaceType = NULL; + HwndSurfaceType = nullptr; #ifdef WANT_DISPLACEMENT_MAPS IParams->UnRegisterDlgWnd(HwndDisplacementMap); IParams->DeleteRollupPage(HwndDisplacementMap); - HwndDisplacementMap = NULL; + HwndDisplacementMap = nullptr; #endif //#ifdef WANT_DISPLACEMENT_MAPS IParams->UnRegisterDlgWnd(HwndPassCount); IParams->DeleteRollupPage(HwndPassCount); - HwndPassCount = NULL; + HwndPassCount = nullptr; for (int i=0; iSetParamDlg(NULL); + TheMtl->SetParamDlg(nullptr); } @@ -186,11 +186,11 @@ void GameMtlDlg::SetThing(ReferenceTarget *m) // destroy our old pass dialogs for (pass=0; passGet_Pass_Count();pass++) { delete PassDialog[pass]; - PassDialog[pass] = NULL; + PassDialog[pass] = nullptr; } // install the new material - TheMtl->SetParamDlg(NULL); + TheMtl->SetParamDlg(nullptr); TheMtl = (GameMtl *)m; TheMtl->SetParamDlg(this); @@ -303,13 +303,13 @@ void GameMtlDlg::ActivateDlg(BOOL onoff) *=============================================================================================*/ void GameMtlDlg::Invalidate() { - InvalidateRect(HwndSurfaceType,NULL,0); + InvalidateRect(HwndSurfaceType,nullptr,0); #ifdef WANT_DISPLACEMENT_MAPS - InvalidateRect(HwndDisplacementMap,NULL,0); + InvalidateRect(HwndDisplacementMap,nullptr,0); #endif //WANT_DISPLACEMENT_MAPS - InvalidateRect(HwndPassCount,NULL,0); + InvalidateRect(HwndPassCount,nullptr,0); } BOOL GameMtlDlg::DisplacementMapProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -327,7 +327,7 @@ BOOL GameMtlDlg::DisplacementMapProc(HWND hDlg, UINT message, WPARAM wParam, LPA SetupIntSpinner(hDlg, IDC_AMOUNT_SPIN, IDC_AMOUNT_EDIT, -999, 999, TheMtl->Get_Displacement_Amount () * 100); Texmap *map = TheMtl->Get_Displacement_Map (); - if (map != NULL) { + if (map != nullptr) { SetDlgItemText (hDlg, IDC_TEXTURE_BUTTON, map->GetFullName ()); } } @@ -496,7 +496,7 @@ static BOOL CALLBACK DisplacementMapDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara theDlg->HwndDisplacementMap = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -516,7 +516,7 @@ static BOOL CALLBACK SurfaceTypePanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar theDlg->HwndSurfaceType = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -536,7 +536,7 @@ static BOOL CALLBACK PassCountPanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam theDlg->HwndPassCount = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -572,7 +572,7 @@ void GameMtlDlg::Set_Pass_Count_Dialog(void) for(int i = 0; i < TheMtl->Get_Pass_Count(); i++) { delete PassDialog[i]; - PassDialog[i] = NULL; + PassDialog[i] = nullptr; } TheMtl->Set_Pass_Count(res); diff --git a/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp index 46db41bc60b..ace80d6fef3 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp @@ -87,7 +87,7 @@ static BOOL CALLBACK PassDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l theDlg->HwndPanel = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlPassDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlPassDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -145,7 +145,7 @@ GameMtlPassDlg::~GameMtlPassDlg() { TheMtl->Set_Flag(_Pass_Index_To_Flag[PassIndex],IParams->IsRollupPanelOpen(HwndPanel)); IParams->DeleteRollupPage(HwndPanel); - SetWindowLong(HwndPanel, GWL_USERDATA, NULL); + SetWindowLong(HwndPanel, GWL_USERDATA, nullptr); } @@ -208,7 +208,7 @@ BOOL GameMtlPassDlg::DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l // Loop through all the tabs in the property sheet // Get a pointer to this tab SetWindowPos( hwnd, - NULL, + nullptr, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); @@ -269,7 +269,7 @@ BOOL GameMtlPassDlg::DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l void GameMtlPassDlg::Invalidate() { Valid = FALSE; - InvalidateRect(HwndPanel,NULL,0); + InvalidateRect(HwndPanel,nullptr,0); } diff --git a/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp index 5137098f49d..d6fadac371d 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp @@ -75,23 +75,23 @@ GameMtlTextureDlg::GameMtlTextureDlg ) : GameMtlFormClass(imp,mtl,pass) { - Stage0FramesSpin = NULL; - Stage1FramesSpin = NULL; - Stage0RateSpin = NULL; - Stage1RateSpin = NULL; - - Stage0PublishButton = NULL; - Stage1PublishButton = NULL; - Stage0ClampUButton = NULL; - Stage1ClampUButton = NULL; - Stage0ClampVButton = NULL; - Stage1ClampVButton = NULL; - Stage0NoLODButton = NULL; - Stage1NoLODButton = NULL; - Stage0AlphaBitmapButton = NULL; - Stage1AlphaBitmapButton = NULL; - Stage0DisplayButton = NULL; - Stage1DisplayButton = NULL; + Stage0FramesSpin = nullptr; + Stage1FramesSpin = nullptr; + Stage0RateSpin = nullptr; + Stage1RateSpin = nullptr; + + Stage0PublishButton = nullptr; + Stage1PublishButton = nullptr; + Stage0ClampUButton = nullptr; + Stage1ClampUButton = nullptr; + Stage0ClampVButton = nullptr; + Stage1ClampVButton = nullptr; + Stage0NoLODButton = nullptr; + Stage1NoLODButton = nullptr; + Stage0AlphaBitmapButton = nullptr; + Stage1AlphaBitmapButton = nullptr; + Stage0DisplayButton = nullptr; + Stage1DisplayButton = nullptr; if (mtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) { Create_Form(parent,IDD_GAMEMTL_TEXTURES); @@ -651,7 +651,7 @@ void GameMtlTextureDlg::Update_Texture_Buttons(void) TSTR filename; if (texmap) { - SplitPathFile(texmap->GetFullName(),NULL,&filename); + SplitPathFile(texmap->GetFullName(),nullptr,&filename); SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,filename); } else { SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,Get_String(IDS_NONE)); @@ -659,7 +659,7 @@ void GameMtlTextureDlg::Update_Texture_Buttons(void) texmap = TheMtl->Get_Texture(PassIndex,1); if (texmap) { - SplitPathFile(texmap->GetFullName(),NULL,&filename); + SplitPathFile(texmap->GetFullName(),nullptr,&filename); SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,filename); } else { SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,Get_String(IDS_NONE)); diff --git a/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp b/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp index 2cf7923fad9..483b39fe8c0 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp @@ -67,17 +67,17 @@ GameMtlVertexMaterialDlg::GameMtlVertexMaterialDlg ) : GameMtlFormClass(imp,mtl,pass) { - AmbientSwatch = NULL; - DiffuseSwatch = NULL; - SpecularSwatch = NULL; - EmissiveSwatch = NULL; + AmbientSwatch = nullptr; + DiffuseSwatch = nullptr; + SpecularSwatch = nullptr; + EmissiveSwatch = nullptr; - OpacitySpin = NULL; - TranslucencySpin = NULL; - ShininessSpin = NULL; + OpacitySpin = nullptr; + TranslucencySpin = nullptr; + ShininessSpin = nullptr; for (int i=0; iobj->IsSubClassOf(triObjectClassID)); - MeshDeformModData *mod_data = NULL; - if (mod_context.localData == NULL) { + MeshDeformModData *mod_data = nullptr; + if (mod_context.localData == nullptr) { mod_data = new MeshDeformModData; mod_context.localData = mod_data; } else { @@ -141,7 +141,7 @@ MeshDeformClass::ModifyObject // Record the initial state of the mesh bool lock_sets = false; - if (m_pPanel != NULL) { + if (m_pPanel != nullptr) { lock_sets = (m_pPanel->Are_Sets_Tied () == TRUE); } mod_data->Record_Mesh_State (*tri_obj, m_DeformState, lock_sets); @@ -194,7 +194,7 @@ MeshDeformClass::NotifyRefChanged CreateMouseCallBack * MeshDeformClass::GetCreateMouseCallBack (void) { - return NULL; + return nullptr; } @@ -275,9 +275,9 @@ MeshDeformClass::EndEditParams ) { // Remove our deform rollup - if (m_hRollupWnd != NULL) { + if (m_hRollupWnd != nullptr) { max_interface->DeleteRollupPage (m_hRollupWnd); - m_hRollupWnd = NULL; + m_hRollupWnd = nullptr; } // @@ -297,8 +297,8 @@ MeshDeformClass::EndEditParams SAFE_DELETE (m_ModeSquash); // Release our hold on the max interface pointer - m_MaxInterface = NULL; - m_pPanel = NULL; + m_MaxInterface = nullptr; + m_pPanel = nullptr; return ; } @@ -396,11 +396,11 @@ MeshDeformClass::HitTest // Record all of the hits // for (MeshSubHitRec *hit_record = hitlist.First (); - hit_record != NULL; + hit_record != nullptr; hit_record = hit_record->Next ()) { // rec->index is the index of vertex which was hit! - viewport->LogHit (node, mod_context, hit_record->dist, hit_record->index, NULL); + viewport->LogHit (node, mod_context, hit_record->dist, hit_record->index, nullptr); } // Cleanup @@ -425,7 +425,7 @@ MeshDeformClass::SelectSubComponent ) { // Loop through all the hit records - for (; hit_record != NULL; hit_record = hit_record->Next ()) { + for (; hit_record != nullptr; hit_record = hit_record->Next ()) { // Peek at the vertex selection array for this hit record MeshDeformModData *mod_data = static_cast (hit_record->modContext->localData); @@ -529,7 +529,7 @@ MeshDeformClass::ClearSelection (int selLevel) MeshDeformModData *mod_data = static_cast (mod_context_list[i]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { mod_data->Peek_Mesh ()->vertSel.ClearAll (); } } @@ -577,7 +577,7 @@ MeshDeformClass::Move // Get the data we've cached for this modifier context MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array (); Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array (); @@ -650,7 +650,7 @@ MeshDeformClass::Scale // Get the data we've cached for this modifier context MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array (); Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array (); @@ -727,7 +727,7 @@ MeshDeformClass::Rotate // Get the data we've cached for this modifier context MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); const Point3 *vertex_array = mod_data->Peek_Orig_Vertex_Array (); Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array (); @@ -784,7 +784,7 @@ MeshDeformClass::Rotate void MeshDeformClass::TransformStart (TimeValue time_val) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { m_MaxInterface->LockAxisTripods (TRUE); } @@ -809,7 +809,7 @@ MeshDeformClass::TransformStart (TimeValue time_val) // Get the data we've cached for this modifier context MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); Point3 *opstart_array = mod_data->Peek_Vertex_OPStart_Array (); @@ -838,7 +838,7 @@ MeshDeformClass::TransformStart (TimeValue time_val) void MeshDeformClass::TransformFinish (TimeValue time_val) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { m_MaxInterface->LockAxisTripods (FALSE); } @@ -856,7 +856,7 @@ MeshDeformClass::TransformFinish (TimeValue time_val) void MeshDeformClass::TransformCancel (TimeValue time_val) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { m_MaxInterface->LockAxisTripods (FALSE); } @@ -874,11 +874,11 @@ MeshDeformClass::TransformCancel (TimeValue time_val) void MeshDeformClass::Set_Deform_State (float state) { - if ((m_MaxInterface != NULL) && (state != m_DeformState)) { + if ((m_MaxInterface != nullptr) && (state != m_DeformState)) { m_DeformState = state; NotifyDependents (FOREVER, PART_GEOM | PART_VERTCOLOR, REFMSG_CHANGE); m_MaxInterface->RedrawViews (m_MaxInterface->GetTime ()); - if (m_pPanel != NULL) { + if (m_pPanel != nullptr) { m_pPanel->Update_Vertex_Color (); } } @@ -895,7 +895,7 @@ MeshDeformClass::Set_Deform_State (float state) void MeshDeformClass::Set_Vertex_Color (const Point3 &color, bool button_up) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { INodeTab nodes; ModContextList mod_context_list; @@ -913,7 +913,7 @@ MeshDeformClass::Set_Vertex_Color (const Point3 &color, bool button_up) // Get the data we've cached for this modifier context MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); // @@ -978,7 +978,7 @@ MeshDeformClass::Get_Vertex_Color (Point3 &color) color.y = 0; color.z = 0; - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { INodeTab nodes; ModContextList mod_context_list; @@ -994,7 +994,7 @@ MeshDeformClass::Get_Vertex_Color (Point3 &color) // Get the data we've cached for this modifier context // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { Mesh *mesh = mod_data->Peek_Mesh (); // Only do this if the mesh is using vertex coloring @@ -1043,9 +1043,9 @@ MeshDeformClass::Get_Vertex_Color (Point3 &color) void MeshDeformClass::Update_UI (MeshDeformModData *mod_data) { - assert (mod_data != NULL); + assert (mod_data != nullptr); - if (m_pPanel != NULL) { + if (m_pPanel != nullptr) { Update_Set_Count (); m_CurrentSet = mod_data->Get_Current_Set (); @@ -1070,7 +1070,7 @@ MeshDeformClass::Update_UI (MeshDeformModData *mod_data) void MeshDeformClass::Auto_Apply (bool auto_apply) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { // Get a list of contexts that we are part of. INodeTab nodes; @@ -1084,7 +1084,7 @@ MeshDeformClass::Auto_Apply (bool auto_apply) // Let the mod context know what it's auto apply state is // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { mod_data->Auto_Apply (auto_apply); } } @@ -1113,7 +1113,7 @@ MeshDeformClass::Set_Max_Deform_Sets (int max) } m_MaxSets = max; - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { // Get a list of contexts that we are part of. INodeTab nodes; @@ -1127,7 +1127,7 @@ MeshDeformClass::Set_Max_Deform_Sets (int max) // Let the mod context know the max sets have changed // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { mod_data->Set_Max_Deform_Sets (max); } } @@ -1151,7 +1151,7 @@ void MeshDeformClass::Update_Set_Count (void) { m_MaxSets = 1; - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { // Get a list of contexts that we are part of. INodeTab nodes; @@ -1165,7 +1165,7 @@ MeshDeformClass::Update_Set_Count (void) // Get the count of sets for this context // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if ((mod_data != NULL) && (mod_data->Get_Set_Count () > m_MaxSets)) { + if ((mod_data != nullptr) && (mod_data->Get_Set_Count () > m_MaxSets)) { m_MaxSets = mod_data->Get_Set_Count (); } } @@ -1195,7 +1195,7 @@ MeshDeformClass::Set_Current_Set last_delta.z = 0; m_CurrentSet = index; - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { if (update_selection) { ClearSelection (1); } @@ -1212,7 +1212,7 @@ MeshDeformClass::Set_Current_Set // Have the mod context select the verts in its set // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { mod_data->Set_Current_Set (m_CurrentSet); if (update_selection) { mod_data->Select_Set (m_CurrentSet); @@ -1244,7 +1244,7 @@ MeshDeformClass::Set_Current_Set void MeshDeformClass::Update_Current_Set (void) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { // Get a list of contexts that we are part of. INodeTab nodes; @@ -1259,7 +1259,7 @@ MeshDeformClass::Update_Current_Set (void) // in the current set. // MeshDeformModData *mod_data = static_cast (mod_context_list[index]->localData); - if (mod_data != NULL) { + if (mod_data != nullptr) { //mod_data->Update_Set (m_CurrentSet); } } @@ -1281,7 +1281,7 @@ MeshDeformClass::Update_Current_Set (void) IOResult MeshDeformClass::SaveLocalData (ISave *save_obj, LocalModData *mod_context) { - assert (mod_context != NULL); + assert (mod_context != nullptr); return ((MeshDeformModData *)mod_context)->Save (save_obj); } @@ -1294,7 +1294,7 @@ MeshDeformClass::SaveLocalData (ISave *save_obj, LocalModData *mod_context) IOResult MeshDeformClass::LoadLocalData (ILoad *load_obj, LocalModData **mod_context) { - assert (mod_context != NULL); + assert (mod_context != nullptr); MeshDeformModData *mod_data = new MeshDeformModData; (*mod_context) = mod_data; return mod_data->Load (load_obj); @@ -1323,7 +1323,7 @@ void SkinModifierClass::SelectAll(int selLevel) SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData; - if (skindata==NULL) continue; + if (skindata==nullptr) continue; ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime()); TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel); @@ -1377,7 +1377,7 @@ void SkinModifierClass::InvertSelection(int selLevel) SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData; - if (skindata==NULL) continue; + if (skindata==nullptr) continue; ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime()); TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel); diff --git a/Core/Tools/WW3D/max2w3d/MeshDeform.h b/Core/Tools/WW3D/max2w3d/MeshDeform.h index 45ea857f2cc..2dd32be2f0d 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeform.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeform.h @@ -67,20 +67,20 @@ class MeshDeformClass : public OSModifier // Public constructors/destructors ////////////////////////////////////////////////////////////////////// MeshDeformClass (void) - : m_MaxInterface (NULL), - m_ModeMove (NULL), - m_ModeSelect (NULL), - m_ModeRotate (NULL), - m_ModeUScale (NULL), - m_ModeNUScale (NULL), - m_ModeSquash (NULL), + : m_MaxInterface (nullptr), + m_ModeMove (nullptr), + m_ModeSelect (nullptr), + m_ModeRotate (nullptr), + m_ModeUScale (nullptr), + m_ModeNUScale (nullptr), + m_ModeSquash (nullptr), m_DeformState (1.0F), - m_pPanel (NULL), + m_pPanel (nullptr), m_CurrentSet (0), m_bSetDirty (true), m_VertColorChanging (false), m_MaxSets (0), - m_hRollupWnd (NULL) { SetName ("WW Mesh Deformer"); Set_Max_Deform_Sets (1); } + m_hRollupWnd (nullptr) { SetName ("WW Mesh Deformer"); Set_Max_Deform_Sets (1); } virtual ~MeshDeformClass (void) { } #if defined W3D_MAX4 //defined as in the project (.dsp) diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp index e4cb34b7bda..a65c1823767 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp @@ -82,7 +82,7 @@ MeshDeformPanelClass::Message_Proc } // Pass the message onto the controlling panel-object - if (panel_obj != NULL) { + if (panel_obj != nullptr) { result = panel_obj->On_Message (message, wparam, lparam); } @@ -154,8 +154,8 @@ MeshDeformPanelClass::On_Message // // Ensure the sliders are repainted // - //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_STATE_SLIDER), NULL, TRUE); - //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_CURRENT_SET_SLIDER), NULL, TRUE); + //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_STATE_SLIDER), nullptr, TRUE); + //::InvalidateRect (::GetDlgItem (m_hWnd, IDC_CURRENT_SET_SLIDER), nullptr, TRUE); break; case WM_DESTROY: @@ -163,10 +163,10 @@ MeshDeformPanelClass::On_Message ::ReleaseICustEdit (m_pMaxSetsEdit); ::ReleaseISpinner (m_pMaxSetsSpin); //::ReleaseICustButton (m_pEditButton); - m_pColorSwatch = NULL; - m_pMaxSetsEdit = NULL; - m_pMaxSetsSpin = NULL; - //m_pEditButton = NULL; + m_pColorSwatch = nullptr; + m_pMaxSetsEdit = nullptr; + m_pMaxSetsSpin = nullptr; + //m_pEditButton = nullptr; break; case WM_COMMAND: @@ -285,7 +285,7 @@ MeshDeformPanelClass::Set_Deformer (MeshDeformClass *obj) void MeshDeformPanelClass::Update_Vertex_Color (void) { - if (m_pMeshDeformer != NULL) { + if (m_pMeshDeformer != nullptr) { // Update the color swatch with data from the deformer Point3 color; @@ -315,7 +315,7 @@ MeshDeformPanelClass::Set_Max_Sets if (notify == false) { m_pMaxSetsSpin->SetValue (max, TRUE); - } else if (m_pMeshDeformer != NULL) { + } else if (m_pMeshDeformer != nullptr) { // Update the deformer m_pMeshDeformer->Set_Max_Deform_Sets (max); @@ -342,7 +342,7 @@ MeshDeformPanelClass::Set_Current_Set if (notify == false) { ::SendDlgItemMessage (m_hWnd, IDC_CURRENT_SET_SLIDER, TBM_SETPOS, (WPARAM)TRUE, set + 1); - } else if (m_pMeshDeformer != NULL) { + } else if (m_pMeshDeformer != nullptr) { // Update the deformer m_pMeshDeformer->Set_Current_Set (set, true); diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h index 36322e413da..5b4fff3d268 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h @@ -56,11 +56,11 @@ class MeshDeformPanelClass ////////////////////////////////////////////////////////////////////// MeshDeformPanelClass (HWND hwnd) : m_hWnd (hwnd), - m_pColorSwatch (NULL), - m_pMaxSetsSpin (NULL), - m_pMeshDeformer (NULL), - m_pLockSetsButton (NULL), - m_pMaxSetsEdit (NULL) { } + m_pColorSwatch (nullptr), + m_pMaxSetsSpin (nullptr), + m_pMeshDeformer (nullptr), + m_pLockSetsButton (nullptr), + m_pMaxSetsEdit (nullptr) { } virtual ~MeshDeformPanelClass (void) { } ////////////////////////////////////////////////////////////////////// diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp index 20746a95e9a..52dc735ff6a 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp @@ -67,7 +67,7 @@ MeshDeformSaveClass::Initialize // int test = object->SuperClassID (); int test2 = GEN_DERIVOB_CLASS_ID; - if ((object != NULL) && + if ((object != nullptr) && (object->SuperClassID () == GEN_DERIVOB_CLASS_ID)) { // @@ -84,13 +84,13 @@ MeshDeformSaveClass::Initialize // data it contains. // Modifier *modifier = derived_object->GetModifier (index); - if ((modifier != NULL) && (modifier->ClassID () == _MeshDeformClassID)) { + if ((modifier != nullptr) && (modifier->ClassID () == _MeshDeformClassID)) { // // Attempt to get at the modifier data for this context // ModContext *mod_context = derived_object->GetModContext (index); - if ((mod_context != NULL) && (mod_context->localData != NULL)) { + if ((mod_context != nullptr) && (mod_context->localData != nullptr)) { MeshDeformModData *mod_data = static_cast (mod_context->localData); Initialize (builder, mesh, *mod_data, transform); } diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSave.h b/Core/Tools/WW3D/max2w3d/MeshDeformSave.h index e27ff6e08ea..66013ccb3c1 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSave.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSave.h @@ -75,8 +75,8 @@ class MeshDeformSaveClass ////////////////////////////////////////////////////////////////////// // Public methods ////////////////////////////////////////////////////////////////////// - void Initialize (MeshBuilderClass &builder, Object *object, Mesh &mesh, Matrix3 *transform = NULL); - void Initialize (MeshBuilderClass &builder, Mesh &mesh, MeshDeformModData &mod_data, Matrix3 *transform = NULL); + void Initialize (MeshBuilderClass &builder, Object *object, Mesh &mesh, Matrix3 *transform = nullptr); + void Initialize (MeshBuilderClass &builder, Mesh &mesh, MeshDeformModData &mod_data, Matrix3 *transform = nullptr); //void Re_Index (MeshBuilderClass &builder); bool Export (ChunkSaveClass &chunk_save); diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp index 54f747c9884..0494953b778 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp @@ -55,7 +55,7 @@ MeshDeformSaveSetClass::Reset (void) } m_DeformData.Delete_All (); - m_CurrentKeyFrame = NULL; + m_CurrentKeyFrame = nullptr; return ; } @@ -90,7 +90,7 @@ MeshDeformSaveSetClass::Begin_Keyframe (float state) void MeshDeformSaveSetClass::End_Keyframe (void) { - m_CurrentKeyFrame = NULL; + m_CurrentKeyFrame = nullptr; return ; } @@ -109,8 +109,8 @@ MeshDeformSaveSetClass::Add_Vert ) { // State OK? - assert (m_CurrentKeyFrame != NULL); - if (m_CurrentKeyFrame != NULL) { + assert (m_CurrentKeyFrame != nullptr); + if (m_CurrentKeyFrame != nullptr) { // // Create a structure that will hold the @@ -144,7 +144,7 @@ MeshDeformSaveSetClass::Replace_Deform_Data ) { KEYFRAME *key_frame = m_DeformData[keyframe_index]; - if (key_frame != NULL) { + if (key_frame != nullptr) { // // Replace the vertex deformation list for the keyframe @@ -171,7 +171,7 @@ MeshDeformSaveSetClass::Get_Deform_Count (void) const int count = 0; for (int index = 0; index < m_DeformData.Count (); index ++) { KEYFRAME *key_frame = m_DeformData[index]; - if (key_frame != NULL) { + if (key_frame != nullptr) { count += key_frame->deform_list.Count (); } } diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h index 13642bc8a07..fb0f5c0dc72 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h @@ -94,7 +94,7 @@ class MeshDeformSaveSetClass ////////////////////////////////////////////////////////////////////// MeshDeformSaveSetClass (void) : m_Flags (0), - m_CurrentKeyFrame (NULL) { } + m_CurrentKeyFrame (nullptr) { } ~MeshDeformSaveSetClass (void) { Reset (); } ////////////////////////////////////////////////////////////////////// diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp index 44dc3a5ea2d..165555a5dcd 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp @@ -685,7 +685,7 @@ MeshDeformSetClass::Apply_Position_Changes Point3 new_pos = info.value; // Transform the new position if necessary - if (transform != NULL) { + if (transform != nullptr) { new_pos = new_pos * (*transform); } @@ -708,7 +708,7 @@ MeshDeformSetClass::Apply_Position_Changes Point3 new_pos = info.value; // Transform the new position if necessary - if (transform != NULL) { + if (transform != nullptr) { new_pos = new_pos * (*transform); } @@ -899,7 +899,7 @@ MeshDeformSetClass::Update_Mesh (TriObject &tri_obj) Copy_Vertex_Array (tri_obj.mesh); // Should we update the mesh or copy it? - if (m_pMesh != NULL) { + if (m_pMesh != nullptr) { // // Copy the vertex colors from the triangle object @@ -1288,7 +1288,7 @@ MeshDeformSetClass::Save // Get the absolute color of this vertex // VertColor color (1, 1, 1); - if (mesh.vertCol != NULL) { + if (mesh.vertCol != nullptr) { int vert_col_index = w3d_vert.MaxVertColIndex; color = mesh.vertCol[vert_col_index]; Apply_Color_Changes (max_vert_index, vert_col_index, key_frame, color); diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h index 4451fb290a7..5e5bc62342e 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h @@ -64,10 +64,10 @@ class MeshDeformSetClass // Public constructors/destructors ////////////////////////////////////////////////////////////////////// MeshDeformSetClass (void) - : m_pMesh (NULL), - m_pVertexArray (NULL), - m_pVertexOPStartArray (NULL), - m_pVertexColors (NULL), + : m_pMesh (nullptr), + m_pVertexArray (nullptr), + m_pVertexOPStartArray (nullptr), + m_pVertexColors (nullptr), m_VertexColorCount (0), m_State (0), m_CurrentKeyFrame (0), @@ -123,7 +123,7 @@ class MeshDeformSetClass IOResult Save (ISave *save_obj); IOResult Load (ILoad *load_obj); - void Save (MeshBuilderClass &builder, Mesh &mesh, MeshDeformSaveSetClass &save_set, Matrix3 *transform = NULL); + void Save (MeshBuilderClass &builder, Mesh &mesh, MeshDeformSaveSetClass &save_set, Matrix3 *transform = nullptr); protected: @@ -139,7 +139,7 @@ class MeshDeformSetClass void Determine_Interpolation_Indicies (int key_frame, bool position, int &from, int &to, float &state); // Deformation application methods - void Apply_Position_Changes (UINT vert, int frame_to_check, Point3 &position, Matrix3 *transform = NULL); + void Apply_Position_Changes (UINT vert, int frame_to_check, Point3 &position, Matrix3 *transform = nullptr); void Apply_Color_Changes (UINT vert, int frame_to_check, Mesh &mesh); void Apply_Color_Changes (UINT vert_index, UINT vert_color_index, int frame_to_check, VertColor &color); diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp index 839072fabd4..394d1972ab2 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp @@ -58,7 +58,7 @@ VertexRestoreClass::VertexRestoreClass m_SetIndex (0), m_KeyframeIndex (0) { - assert (mesh != NULL); + assert (mesh != nullptr); // // Remember the deformer's current settings @@ -91,9 +91,9 @@ VertexRestoreClass::Free_Vertex_Array (void) void VertexRestoreClass::Restore (int is_undo) { - assert (m_pMesh != NULL); - assert (m_pModData != NULL); - assert (m_pModifier != NULL); + assert (m_pMesh != nullptr); + assert (m_pModData != nullptr); + assert (m_pModifier != nullptr); // Is this being called as part of an undo operation? if (is_undo != 0) { @@ -129,9 +129,9 @@ VertexRestoreClass::Restore (int is_undo) void VertexRestoreClass::Redo (void) { - assert (m_pMesh != NULL); - assert (m_pModData != NULL); - assert (m_pModifier != NULL); + assert (m_pMesh != nullptr); + assert (m_pModData != nullptr); + assert (m_pModifier != nullptr); // // Ensure the modifier is in the state it was when diff --git a/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp b/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp index c8b225e3ac1..f8fd31c4f2a 100644 --- a/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp +++ b/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp @@ -75,7 +75,7 @@ void PCToPS2MaterialClass::BeginEditParams(Interface *ip,IUtil *iu) // Since we don't need any window gadgets, we'll just go through all the materials right away. INode *root = ip->GetRootNode(); - INodeListClass *meshlist = NULL; + INodeListClass *meshlist = nullptr; // Change all materials associated with the mesh, starting with the root node. if (root) { @@ -88,7 +88,7 @@ void PCToPS2MaterialClass::BeginEditParams(Interface *ip,IUtil *iu) Mtl *nodemtl = ((*meshlist)[i])->GetMtl(); - if (nodemtl == NULL) { + if (nodemtl == nullptr) { // No material on this node, go to the next. continue; } diff --git a/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp b/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp index 89613c12c83..e0d267f4f5d 100644 --- a/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp @@ -58,9 +58,9 @@ SceneSetupDlg::SceneSetupDlg(Interface *max_interface) m_LodOffset = -100.0f; m_DamageProc = 3; m_LodProc = 3; - m_hWnd = NULL; + m_hWnd = nullptr; m_MaxInterface = max_interface; - assert(max_interface != NULL); + assert(max_interface != nullptr); } @@ -72,7 +72,7 @@ void SceneSetupDlg::SetEditInt (int control_id, int value) char buf[64]; sprintf(buf, "%d", value); HWND edit = GetDlgItem(m_hWnd, control_id); - assert(edit != NULL); + assert(edit != nullptr); SetWindowText(edit, buf); } @@ -81,7 +81,7 @@ void SceneSetupDlg::SetEditFloat (int control_id, float value) char buf[64]; sprintf(buf, "%.0f", value); HWND edit = GetDlgItem(m_hWnd, control_id); - assert(edit != NULL); + assert(edit != nullptr); SetWindowText(edit, buf); } @@ -89,7 +89,7 @@ int SceneSetupDlg::GetEditInt (int control_id) { char buf[64]; HWND edit = GetDlgItem(m_hWnd, control_id); - assert(edit != NULL); + assert(edit != nullptr); GetWindowText(edit, buf, sizeof(buf)); int value = 0; sscanf(buf, "%d", &value); @@ -100,7 +100,7 @@ float SceneSetupDlg::GetEditFloat (int control_id) { char buf[64]; HWND edit = GetDlgItem(m_hWnd, control_id); - assert(edit != NULL); + assert(edit != nullptr); GetWindowText(edit, buf, sizeof(buf)); float value = 0; sscanf(buf, "%f", &value); @@ -111,7 +111,7 @@ bool SceneSetupDlg::ValidateEditFloat (int control_id) { char buf[64]; HWND edit = GetDlgItem(m_hWnd, control_id); - assert(edit != NULL); + assert(edit != nullptr); GetWindowText(edit, buf, sizeof(buf)); float value = 0; if (sscanf(buf, "%f", &value) == 1) @@ -139,7 +139,7 @@ int SceneSetupDlg::DoModal (void) BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static SceneSetupDlg *dialog = NULL; + static SceneSetupDlg *dialog = nullptr; if (uMsg == WM_INITDIALOG) { @@ -186,7 +186,7 @@ BOOL CALLBACK SceneSetupDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LP if (OnOK() == FALSE) return TRUE; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); EndDialog(m_hWnd, 1); break; @@ -209,7 +209,7 @@ BOOL CALLBACK SceneSetupDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LP void SceneSetupDlg::OnInitDialog() { CenterWindow(m_hWnd, m_MaxInterface->GetMAXHWnd()); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // Select the appropriate radio buttons. switch (m_LodProc) diff --git a/Core/Tools/WW3D/max2w3d/SkinCopy.cpp b/Core/Tools/WW3D/max2w3d/SkinCopy.cpp index 71b95582948..765e7cecab2 100644 --- a/Core/Tools/WW3D/max2w3d/SkinCopy.cpp +++ b/Core/Tools/WW3D/max2w3d/SkinCopy.cpp @@ -138,13 +138,13 @@ Value * copy_skin_info_cf (Value **arg_list, int count) // Get the INode pointers that were passed in. INode *src_node = arg_list[0]->to_node(); INode *dest_node = arg_list[1]->to_node(); - INode *wsm_node = NULL; + INode *wsm_node = nullptr; INode *tree_root = arg_list[3]->to_node(); if (arg_list[2] == &undefined) { // Duplicate the WSM used by src_node. wsm_node = duplicate_wsm(find_skin_wsm(src_node), tree_root); - if (wsm_node == NULL) + if (wsm_node == nullptr) return &undefined; } else @@ -193,7 +193,7 @@ Value * dupe_skin_wsm_cf (Value **arg_list, int count) Value *find_skin_node_in_tree (INode *root) { - if (root == NULL) + if (root == nullptr) return &undefined; // Is this the node we're looking for? @@ -222,7 +222,7 @@ Value *find_skin_node_in_tree (INode *root) * * * INPUT: The skinned object. * * * - * OUTPUT: The skin modifier, or NULL if one doesn't exist. * + * OUTPUT: The skin modifier, or null if one doesn't exist. * * * * WARNINGS: * * * @@ -234,8 +234,8 @@ SkinModifierClass *find_skin_binding (INode *skinned_obj) // WWSkin Binding ties us to a space warp, so search the node's // WSM Derived Object for the WWSkin Binding modifier. IDerivedObject *dobj = skinned_obj->GetWSMDerivedObject(); - if (dobj == NULL) - return NULL; // not bound to a space warp + if (dobj == nullptr) + return nullptr; // not bound to a space warp // Search for the WWSkin Binding modifier on this derived object. for (int i = 0; i < dobj->NumModifiers(); i++) @@ -249,7 +249,7 @@ SkinModifierClass *find_skin_binding (INode *skinned_obj) } // Skin modifier not found. - return NULL; + return nullptr; } @@ -269,12 +269,12 @@ INode *find_skin_wsm (INode *skinned_obj) { // Find the skin modifier on this object. SkinModifierClass *skin_mod = find_skin_binding(skinned_obj); - if (skin_mod == NULL) - return NULL; + if (skin_mod == nullptr) + return nullptr; // Using the skin modifer, find the WSM's INode. INode *wsm = (INode*)( skin_mod->GetReference(SkinModifierClass::NODE_REF) ); - if (wsm == NULL) + if (wsm == nullptr) { char buf[256]; sprintf(buf, "%s has a WWSkin Binding, but I can't find its WWSkin WSM!", @@ -302,12 +302,12 @@ SkinWSMObjectClass *get_skin_wsm_obj (INode *wsm_node) { // We need a valid node. if (!wsm_node) - return NULL; + return nullptr; // The node must reference an object. Object *obj = wsm_node->GetObjectRef(); if (!obj) - return NULL; + return nullptr; // That BASE object must be a SkinWSMObject while (obj) @@ -320,7 +320,7 @@ SkinWSMObjectClass *get_skin_wsm_obj (INode *wsm_node) break; } if (obj->ClassID() != SKIN_OBJ_CLASS_ID) - return NULL; + return nullptr; // Return it. return (SkinWSMObjectClass*)obj; @@ -348,7 +348,7 @@ INode *duplicate_wsm (INode *wsm_node, INode *tree) SkinWSMObjectClass *wsm_obj = get_skin_wsm_obj(wsm_node); if (!wsm_node || !wsm_obj) - return NULL; + return nullptr; /* ** Duplicate the WSM. @@ -357,12 +357,12 @@ INode *duplicate_wsm (INode *wsm_node, INode *tree) SkinWSMObjectClass *new_wsm_obj = (SkinWSMObjectClass*)CreateInstance(WSM_OBJECT_CLASS_ID, SKIN_OBJ_CLASS_ID); if (!new_wsm_obj) - return NULL; + return nullptr; // Create a new node in the scene that points to the new WSM object. INode *new_wsm_node = MAXScript_interface->CreateObjectNode(new_wsm_obj); if (!new_wsm_node) - return NULL; + return nullptr; // Copy the bones from one to the other. for (int i = 0; i < wsm_obj->Num_Bones(); i++) @@ -370,7 +370,7 @@ INode *duplicate_wsm (INode *wsm_node, INode *tree) INode *src_bone = wsm_obj->Get_Bone(i); INode *dst_bone = find_equivalent_node(src_bone, tree); if (!src_bone || !dst_bone) - return NULL; + return nullptr; new_wsm_obj->Add_Bone(dst_bone); } @@ -386,7 +386,7 @@ INode *duplicate_wsm (INode *wsm_node, INode *tree) * INPUT: source - The node to search for an equivalent of. * * tree - The hierarchy to search in. * * * - * OUTPUT: The equivalent node, or NULL if none was found. * + * OUTPUT: The equivalent node, or null if none was found. * * * * WARNINGS: * * * @@ -397,7 +397,7 @@ INode *find_equivalent_node (INode *source, INode *tree, bool name_is_valid) { // We need a valid source and tree. if (!source || !tree) - return NULL; + return nullptr; // The name of the source object. We'll only evaluate this once as an easy optimization. static char src_name[W3D_NAME_LEN]; @@ -416,12 +416,12 @@ INode *find_equivalent_node (INode *source, INode *tree, bool name_is_valid) for (int i = 0; i < tree->NumberOfChildren(); i++) { INode *retval = find_equivalent_node(source, tree->GetChildNode(i), true); - if (retval != NULL) + if (retval != nullptr) return retval; // we found the node in our children } // No equivalent node was found. - return NULL; + return nullptr; } @@ -429,7 +429,7 @@ Value *copy_skin_info (INode *source, INode *target, INode *wsm) { // Get the "WWSkin Binding" modifier on the source object. SkinModifierClass *source_modifier = find_skin_binding(source); - if (source_modifier == NULL) + if (source_modifier == nullptr) return &undefined; // Get the WSMDerivedObject we can add our skin binding modifier to. @@ -437,7 +437,7 @@ Value *copy_skin_info (INode *source, INode *target, INode *wsm) // Create a new skin modifier and copy the source modifier's settings to it. SkinModifierClass *new_modifier = new SkinModifierClass(wsm, get_skin_wsm_obj(wsm)); - if (new_modifier == NULL) + if (new_modifier == nullptr) throw RuntimeError("Out of memory - Unable to allocate a new SkinModifierClass object!"); new_modifier->SubObjSelLevel = source_modifier->SubObjSelLevel; @@ -445,7 +445,7 @@ Value *copy_skin_info (INode *source, INode *target, INode *wsm) ModContext *source_context = find_skin_mod_context(source); ModContext *new_context = new ModContext(source_context->tm, source_context->box, source_context->localData); - if (new_context == NULL) + if (new_context == nullptr) throw RuntimeError("Out of memory - Unable to allocate a new ModContext object!"); // Add a new "WWSkin Binding" modifier to the target object to associate @@ -464,7 +464,7 @@ IDerivedObject *setup_wsm_derived_obj (INode *node) { // Check if the target object is already bound to a space warp. IDerivedObject *dobj = node->GetWSMDerivedObject(); - if (dobj != NULL) + if (dobj != nullptr) { // It's bound to a space warp. Check if WWSkin is one of the // space warp bindings. If so, remove it (we don't want to @@ -485,7 +485,7 @@ IDerivedObject *setup_wsm_derived_obj (INode *node) // This object isn't bound to a space warp. Create a // WSMDerivedObject for the node to play with. dobj = CreateWSDerivedObject(node->GetObjectRef()); - if (dobj == NULL) + if (dobj == nullptr) { char msg[128]; sprintf(msg, "Error setting up the WSMDerivedObject for %s", node->GetName()); @@ -501,14 +501,14 @@ IDerivedObject *setup_wsm_derived_obj (INode *node) ModContext *find_skin_mod_context (INode *node) { // We need a valid node - if (node == NULL) - return NULL; + if (node == nullptr) + return nullptr; // The node needs to be bound to a space warp (ie. must have // a WSMDerivedObject). IDerivedObject *dobj = node->GetWSMDerivedObject(); - if (dobj == NULL) - return NULL; + if (dobj == nullptr) + return nullptr; // It's bound to a space warp. Find the WWSkin modifier. for (int i = 0; i < dobj->NumModifiers(); i++) @@ -522,5 +522,5 @@ ModContext *find_skin_mod_context (INode *node) } // We didn't find a WWSkin binding. - return NULL; + return nullptr; } diff --git a/Core/Tools/WW3D/max2w3d/SnapPoints.cpp b/Core/Tools/WW3D/max2w3d/SnapPoints.cpp index 554cde3073d..7b97aa38e49 100644 --- a/Core/Tools/WW3D/max2w3d/SnapPoints.cpp +++ b/Core/Tools/WW3D/max2w3d/SnapPoints.cpp @@ -53,9 +53,9 @@ class PointFilterClass : public INodeFilterClass virtual BOOL Accept_Node(INode * node, TimeValue time) { - if (node == NULL) return FALSE; + if (node == nullptr) return FALSE; Object * obj = node->EvalWorldState(time).obj; - if (obj == NULL) return FALSE; + if (obj == nullptr) return FALSE; if ( @@ -73,7 +73,7 @@ class PointFilterClass : public INodeFilterClass void SnapPointsClass::Export_Points(INode * scene_root,TimeValue time,ChunkSaveClass & csave) { - if (scene_root == NULL) return; + if (scene_root == nullptr) return; PointFilterClass pointfilter; INodeListClass pointlist(scene_root,time,&pointfilter); diff --git a/Core/Tools/WW3D/max2w3d/TARGA.cpp b/Core/Tools/WW3D/max2w3d/TARGA.cpp index 8b0ffd2e417..dee2857c2e2 100644 --- a/Core/Tools/WW3D/max2w3d/TARGA.cpp +++ b/Core/Tools/WW3D/max2w3d/TARGA.cpp @@ -100,8 +100,8 @@ Targa::Targa(void) { - mImage = NULL; - mPalette = NULL; + mImage = nullptr; + mPalette = nullptr; Clear_File(); mAccess = TGA_READMODE; mFlags = 0; @@ -136,11 +136,11 @@ Targa::~Targa(void) Close(); /* Free the palette buffer if we allocated it. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) free(mPalette); /* Free the image buffer if we allocated it. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) free(mImage); } @@ -314,7 +314,7 @@ void Targa::Close(void) if (TGAFile) { TGAFile->Close(); _TheFileFactory->Return_File(TGAFile); - TGAFile = NULL; + TGAFile = nullptr; } #else /* Close the file if it is open. */ @@ -338,7 +338,7 @@ void Targa::Close(void) * * FUNCTION * Open and load the Targa into the specified buffers. If either buffer -* pointer is NULL then that field will not be processed. +* pointer is nullptr then that field will not be processed. * * INPUTS * Name - Name of Targa image file to load. @@ -357,7 +357,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) long error = 0; /* Open the Targa */ - if (Open(name, TGA_READMODE) == NULL) { + if (Open(name, TGA_READMODE) == nullptr) { /* Process ColorMap (palette) */ if (Header.ColorMapType == 1) { @@ -368,7 +368,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) /* Load the palette from the TGA if a palette buffer is provided * otherwise we will skip it. */ - if ((palette != NULL) && (Header.CMapLength > 0)) { + if ((palette != nullptr) && (Header.CMapLength > 0)) { /* Adjust palette to the starting color entry. */ palette += (Header.CMapStart * depth); @@ -388,7 +388,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) /* Load the image data from the TGA if an image buffer is provided * otherwise we are done. */ - if (!error && (image != NULL)) { + if (!error && (image != nullptr)) { depth = TGA_BytesPerPixel(Header.PixelDepth); size = ((Header.Width * Header.Height) * depth); @@ -419,7 +419,7 @@ long Targa::Load(const char* name, char* palette, char* image,bool invert_image) break; case TGA_TRUECOLOR_ENCODED: - if ((error = DecodeImage()) == NULL) { + if ((error = DecodeImage()) == nullptr) { if (invert_image) InvertImage(); } break; @@ -496,21 +496,21 @@ long Targa::Load(const char* name, long flags, bool invert_image) if ((flags & TGAF_PAL) && (Header.ColorMapType == 1)) { /* Dispose of any previous palette. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) { + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) { free(mPalette); - mPalette = NULL; + mPalette = nullptr; mFlags &= ~TGAF_PAL; } /* Only allocate a palette if the client hasn't assigned one. */ - if ((mPalette == NULL) && !(mFlags & TGAF_PAL)) { + if ((mPalette == nullptr) && !(mFlags & TGAF_PAL)) { /* Compute the size of the palette from the targa header. */ size = (Header.CMapLength * (Header.CMapDepth >> 3)); if (size != 0) { /* Allocate memory for the palette. */ - if ((mPalette = (char *)malloc(size)) != NULL) { + if ((mPalette = (char *)malloc(size)) != nullptr) { mFlags |= TGAF_PAL; /* We allocated the palette. */ } else { error = TGAERR_NOMEM; @@ -523,20 +523,20 @@ long Targa::Load(const char* name, long flags, bool invert_image) if (!error && (flags & TGAF_IMAGE)) { /* Dispose of any previous image. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) { + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) { free(mImage); - mImage = NULL; + mImage = nullptr; mFlags &= ~TGAF_IMAGE; } /* Only allocate an image if the client hasn't assigned one. */ - if ((mImage == NULL) && !(mFlags & TGAF_IMAGE)) { + if ((mImage == nullptr) && !(mFlags & TGAF_IMAGE)) { /* Compute the size of the image data from the targa header. */ size = ((Header.Width * Header.Height) * TGA_BytesPerPixel(Header.PixelDepth)); if (size != 0) { /* Allocate memory for the image. */ - if ((mImage = (char *)malloc(size)) != NULL) { + if ((mImage = (char *)malloc(size)) != nullptr) { mFlags |= TGAF_IMAGE; /* We allocated the image. */ } else { error = TGAERR_NOMEM; @@ -595,7 +595,7 @@ long Targa::Save(const char* name, long flags, bool addextension) TGA2Footer footer; /* Open the Targa for write. */ - if (Open(name, TGA_WRITEMODE) == NULL) + if (Open(name, TGA_WRITEMODE) == nullptr) { Header.IDLength = 0; @@ -631,7 +631,7 @@ long Targa::Save(const char* name, long flags, bool addextension) /*----------------------------------------------------------------------- * WRITE THE COLORMAP (PALETTE) DATA SECTION *---------------------------------------------------------------------*/ - if (!error && (flags & TGAF_PAL) && (mPalette != NULL) + if (!error && (flags & TGAF_PAL) && (mPalette != nullptr) && (Header.CMapLength > 0)) { /* Adjust palette to the starting color entry. */ @@ -640,7 +640,7 @@ long Targa::Save(const char* name, long flags, bool addextension) size = (Header.CMapLength * depth); /* Allocate temporary buffer for palette manipulation. */ - if ((temppal = (char *)malloc(size)) != NULL) + if ((temppal = (char *)malloc(size)) != nullptr) { memcpy(temppal, palette, size); ptr = temppal; @@ -672,7 +672,7 @@ long Targa::Save(const char* name, long flags, bool addextension) /*----------------------------------------------------------------------- * WRITE THE IMAGE DATA SECTION *---------------------------------------------------------------------*/ - if (!error && (flags & TGAF_IMAGE) && (mImage != NULL)) + if (!error && (flags & TGAF_IMAGE) && (mImage != nullptr)) { bool imageinverted; @@ -878,18 +878,18 @@ void Targa::YFlip(void) char *Targa::SetImage(char *buffer) { - char *oldbuffer = NULL; + char *oldbuffer = nullptr; /* Free any image buffer before assigning another. */ - if ((mImage != NULL) && (mFlags & TGAF_IMAGE)) + if ((mImage != nullptr) && (mFlags & TGAF_IMAGE)) { free(mImage); - mImage = NULL; + mImage = nullptr; mFlags &= ~TGAF_IMAGE; } /* Get the old user buffer. */ - if (mImage != NULL) + if (mImage != nullptr) oldbuffer = mImage; /* Assign the new image buffer. */ @@ -921,18 +921,18 @@ char *Targa::SetImage(char *buffer) char *Targa::SetPalette(char *buffer) { - char *oldbuffer = NULL; + char *oldbuffer = nullptr; /* Free any image buffer before assigning another. */ - if ((mPalette != NULL) && (mFlags & TGAF_PAL)) + if ((mPalette != nullptr) && (mFlags & TGAF_PAL)) { free(mPalette); - mPalette = NULL; + mPalette = nullptr; mFlags &= ~TGAF_PAL; } /* Get the old user buffer. */ - if (mPalette != NULL) + if (mPalette != nullptr) oldbuffer = mPalette; /* Assign the new image buffer. */ @@ -963,13 +963,13 @@ bool Targa::IsCompressed(void) * * FUNCTION * Retrieve a pointer to the Targa 2.0 extension data area. If the file -* version is 1.0 OR there is no extensio area then a NULL will be returned. +* version is 1.0 OR there is no extensio area then a nullptr will be returned. * * INPUTS * NONE * * RESULT -* Ext - Pointer to Extension data, NULL if not available. +* Ext - Pointer to Extension data, nullptr if not available. * ****************************************************************************/ @@ -978,7 +978,7 @@ TGA2Extension *Targa::GetExtension(void) if (mFlags & TGAF_TGA2) return (&mExtension); - return (NULL); + return (nullptr); } @@ -1113,7 +1113,7 @@ long Targa::EncodeImage() depth = TGA_BytesPerPixel(Header.PixelDepth); /* Allocate packet buffer to hold maximum encoded data run. */ - if ((packet = (char *)malloc(128 * depth)) != NULL) + if ((packet = (char *)malloc(128 * depth)) != nullptr) { pixels = Header.Width * Header.Height; start = mImage; @@ -1282,7 +1282,7 @@ void Targa::InvertImage(void) void Targa::Clear_File(void) { #ifdef TGA_USES_WWLIB_FILE_CLASSES - TGAFile = NULL; + TGAFile = nullptr; #else mFH = -1; #endif @@ -1290,7 +1290,7 @@ void Targa::Clear_File(void) bool Targa::Is_File_Open(void) { #ifdef TGA_USES_WWLIB_FILE_CLASSES - return (TGAFile != NULL); + return (TGAFile != nullptr); #else return (mFH != -1); #endif diff --git a/Core/Tools/WW3D/max2w3d/TARGA.h b/Core/Tools/WW3D/max2w3d/TARGA.h index 02cf38aee44..5384abf7015 100644 --- a/Core/Tools/WW3D/max2w3d/TARGA.h +++ b/Core/Tools/WW3D/max2w3d/TARGA.h @@ -197,13 +197,13 @@ typedef struct _TGA2Ratio * TGA2Footer. * * ExtSize - Extension area size. (495 bytes for 2.0) - * AuthName - Name of the person who created image (NULL terminated ASCII) - * AuthComment - Comments of the author (NULL terminated ASCII) + * AuthName - Name of the person who created image (null-terminated ASCII) + * AuthComment - Comments of the author (null-terminated ASCII) * DateStamp - Date the file was created. (See TGA2DateStamp) * TimeStamp - Time the file was created. (See TGA2TimeStamp) - * JobName - Name of job image belongs to (NULL terminated ASCII) + * JobName - Name of job image belongs to (null-terminated ASCII) * JobTime - Elapsed time of the job. - * SoftID - ID of software used to create image (NULL terminated ASCII) + * SoftID - ID of software used to create image (null-terminated ASCII) * SoftVer - Version number of software used. * KeyColor - Tranparent color value. * Aspect - Pixel aspect ratio. diff --git a/Core/Tools/WW3D/max2w3d/Utility.cpp b/Core/Tools/WW3D/max2w3d/Utility.cpp index 7a17225dd35..09a0f3a023c 100644 --- a/Core/Tools/WW3D/max2w3d/Utility.cpp +++ b/Core/Tools/WW3D/max2w3d/Utility.cpp @@ -112,7 +112,7 @@ Value * input_box_cf (Value **arg_list, int count) { // Create the input box (but don't show it yet). InputDlg input_box(MAXScript_interface->GetMAXHWnd()); - Value *param = NULL; + Value *param = nullptr; // Check the 'caption' parameter. param = key_arg(caption); diff --git a/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp index 5dce24bc68f..958d2cdea00 100644 --- a/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp +++ b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp @@ -80,12 +80,12 @@ const float COINCIDENCE_EPSILON = 0.001f; * HISTORY: * *=============================================================================================*/ AABTreeBuilderClass::AABTreeBuilderClass(void) : - Root(NULL), + Root(nullptr), CurPolyIndex(0), PolyCount(0), - Polys(NULL), + Polys(nullptr), VertCount(0), - Verts(NULL) + Verts(nullptr) { } @@ -123,17 +123,17 @@ AABTreeBuilderClass::~AABTreeBuilderClass(void) void AABTreeBuilderClass::Reset(void) { if (Root) { - delete Root; Root = NULL; + delete Root; Root = nullptr; } - if (Verts != NULL) { + if (Verts != nullptr) { delete[] Verts; - Verts = NULL; + Verts = nullptr; } - if (Polys != NULL) { + if (Polys != nullptr) { delete[] Polys; - Polys = NULL; + Polys = nullptr; } } @@ -153,8 +153,8 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertc { WWASSERT(polycount > 0); WWASSERT(vertcount > 0); - WWASSERT(polys != NULL); - WWASSERT(verts != NULL); + WWASSERT(polys != nullptr); + WWASSERT(verts != nullptr); /* ** If we already have allocated data, release it @@ -190,7 +190,7 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertc */ Root = new CullNodeStruct; Build_Tree(Root,PolyCount,polyindices); - polyindices = NULL; + polyindices = nullptr; /* ** fill in the remaining information needed in the tree: @@ -271,10 +271,10 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the poly array. */ if (arrays.FrontCount) { - WWASSERT(arrays.FrontPolys != NULL); + WWASSERT(arrays.FrontPolys != nullptr); node->Front = new CullNodeStruct; Build_Tree(node->Front,arrays.FrontCount,arrays.FrontPolys); - arrays.FrontPolys = NULL; + arrays.FrontPolys = nullptr; } /* @@ -282,11 +282,11 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the tile array. */ if (arrays.BackCount) { - WWASSERT(arrays.BackPolys != NULL); + WWASSERT(arrays.BackPolys != nullptr); node->Back = new CullNodeStruct; Build_Tree(node->Back,arrays.BackCount,arrays.BackPolys); - arrays.BackPolys = NULL; + arrays.BackPolys = nullptr; } } @@ -307,7 +307,7 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p AABTreeBuilderClass::SplitChoiceStruct AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { - WWASSERT(polyindices != NULL); + WWASSERT(polyindices != nullptr); const int NUM_TRYS = 50; @@ -894,9 +894,9 @@ void AABTreeBuilderClass::Build_W3D_AABTree_Recursive /* ** If this is a non-leaf node, set up the child indices, otherwise set up the polygon indices */ - if (node->Front != NULL) { + if (node->Front != nullptr) { - WWASSERT(node->Back != NULL); // if we have one child, we better have both! + WWASSERT(node->Back != nullptr); // if we have one child, we better have both! newnode->FrontOrPoly0 = node->Front->Index; newnode->BackOrPolyCount = node->Back->Index; diff --git a/Core/Tools/WW3D/max2w3d/aabtreebuilder.h b/Core/Tools/WW3D/max2w3d/aabtreebuilder.h index 604d8130c16..55ea1185fe5 100644 --- a/Core/Tools/WW3D/max2w3d/aabtreebuilder.h +++ b/Core/Tools/WW3D/max2w3d/aabtreebuilder.h @@ -84,7 +84,7 @@ class AABTreeBuilderClass */ struct CullNodeStruct { - CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(NULL),Back(NULL),PolyCount(0),PolyIndices(NULL) {} + CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(nullptr),Back(nullptr),PolyCount(0),PolyIndices(nullptr) {} ~CullNodeStruct(void) { if (Front) { delete Front; } @@ -133,8 +133,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys(nullptr) { } diff --git a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp index 8fc42511cc7..7f80c4bf9d5 100644 --- a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp +++ b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp @@ -50,8 +50,8 @@ //////////////////////////////////////////////////////////////////////////////////////// AnimationCompressionSettingsDialogClass::AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd) : MaxInterface (maxinterface), - Options (NULL), - Wnd (NULL), + Options (nullptr), + Wnd (nullptr), ParentWnd (parent_wnd) { return ; @@ -97,7 +97,7 @@ AnimationCompressionSettingsDialogClass::Real_Message_Proc LPARAM lparam ) { - AnimationCompressionSettingsDialogClass *dialog_obj = NULL; + AnimationCompressionSettingsDialogClass *dialog_obj = nullptr; // // Setup the framework we need so that the instance @@ -115,7 +115,7 @@ AnimationCompressionSettingsDialogClass::Real_Message_Proc // Allow the instance to handle the call // BOOL retval = FALSE; - if (dialog_obj != NULL) { + if (dialog_obj != nullptr) { retval = dialog_obj->Message_Proc (message, wparam, lparam); } @@ -158,7 +158,7 @@ AnimationCompressionSettingsDialogClass::Message_Proc ::GetWindowRect (Wnd, &rect); int width = parent_rect.right - parent_rect.left; int height = parent_rect.bottom - parent_rect.top; - ::SetWindowPos ( Wnd, NULL, + ::SetWindowPos ( Wnd, nullptr, parent_rect.left + (width / 2) - ((rect.right - rect.left) / 2), parent_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2), 0, 0, SWP_NOZORDER | SWP_NOSIZE); diff --git a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h index 921ad26d049..c3986b51111 100644 --- a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h +++ b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h @@ -55,7 +55,7 @@ class AnimationCompressionSettingsDialogClass ////////////////////////////////////////////////////////////////// // Public constructors/destructors ////////////////////////////////////////////////////////////////// - AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd = NULL); + AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd = nullptr); ~AnimationCompressionSettingsDialogClass (void); diff --git a/Core/Tools/WW3D/max2w3d/bchannel.cpp b/Core/Tools/WW3D/max2w3d/bchannel.cpp index 335f5cca220..69f09ff2935 100644 --- a/Core/Tools/WW3D/max2w3d/bchannel.cpp +++ b/Core/Tools/WW3D/max2w3d/bchannel.cpp @@ -114,7 +114,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) W3dTimeCodedBitChannelStruct * chn = (W3dTimeCodedBitChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -157,7 +157,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -183,7 +183,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) W3dBitChannelStruct * chn = (W3dBitChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -203,7 +203,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } diff --git a/Core/Tools/WW3D/max2w3d/bpick.cpp b/Core/Tools/WW3D/max2w3d/bpick.cpp index 7cea41c89c8..7915b6ade3f 100644 --- a/Core/Tools/WW3D/max2w3d/bpick.cpp +++ b/Core/Tools/WW3D/max2w3d/bpick.cpp @@ -64,7 +64,7 @@ BonePickerClass TheBonePicker; *=============================================================================================*/ BOOL BonePickerClass::Filter(INode *node) { - if (BoneList == NULL) { + if (BoneList == nullptr) { ObjectState os = node->EvalWorldState(0); if (os.obj) { return TRUE; @@ -124,8 +124,8 @@ BOOL BonePickerClass::Pick(IObjParam *ip,ViewExp *vpt) */ assert(User); User->User_Picked_Bone(node); - User = NULL; - BoneList = NULL; + User = nullptr; + BoneList = nullptr; } return TRUE; @@ -138,10 +138,10 @@ BOOL BonePickerClass::filter(INode * inode) void BonePickerClass::proc(INodeTab & nodetab) { - assert(User != NULL); + assert(User != nullptr); User->User_Picked_Bones(nodetab); - User = NULL; - BoneList = NULL; + User = nullptr; + BoneList = nullptr; } TCHAR * BonePickerClass::dialogTitle(void) diff --git a/Core/Tools/WW3D/max2w3d/bpick.h b/Core/Tools/WW3D/max2w3d/bpick.h index bb212890210..9963831bd5d 100644 --- a/Core/Tools/WW3D/max2w3d/bpick.h +++ b/Core/Tools/WW3D/max2w3d/bpick.h @@ -63,14 +63,14 @@ class BonePickerClass : public PickNodeCallback, public PickModeCallback, public { public: - BonePickerClass(void) : User(NULL), BoneList(NULL), SinglePick(FALSE) {} + BonePickerClass(void) : User(nullptr), BoneList(nullptr), SinglePick(FALSE) {} /* ** Tell this class who is using it and optionally the list ** of bones to allow the user to select from. ** Call this before giving this class to MAX... */ - void Set_User(BonePickerUserClass * user,int singlepick = FALSE, INodeTab * bonelist = NULL) { User = user; SinglePick = singlepick; BoneList = bonelist; } + void Set_User(BonePickerUserClass * user,int singlepick = FALSE, INodeTab * bonelist = nullptr) { User = user; SinglePick = singlepick; BoneList = bonelist; } /* ** From BonePickNodeCallback: @@ -111,7 +111,7 @@ class BonePickerClass : public PickNodeCallback, public PickModeCallback, public /* ** List of bones that the user is being allowed to pick from. - ** If this is NULL, then the user can pick any bone + ** If this is null, then the user can pick any bone */ INodeTab * BoneList; diff --git a/Core/Tools/WW3D/max2w3d/colboxsave.cpp b/Core/Tools/WW3D/max2w3d/colboxsave.cpp index 5e97c9d638c..de09cf1b41f 100644 --- a/Core/Tools/WW3D/max2w3d/colboxsave.cpp +++ b/Core/Tools/WW3D/max2w3d/colboxsave.cpp @@ -70,7 +70,7 @@ CollisionBoxSaveClass::CollisionBoxSaveClass memset(&BoxData,0,sizeof(BoxData)); BoxData.Version = W3D_BOX_CURRENT_VERSION; - if ((container_name != NULL) && (strlen(container_name) > 0)) { + if ((container_name != nullptr) && (strlen(container_name) > 0)) { strcpy(BoxData.Name,container_name); strcat(BoxData.Name,"."); } diff --git a/Core/Tools/WW3D/max2w3d/dazzlesave.cpp b/Core/Tools/WW3D/max2w3d/dazzlesave.cpp index 3f8ecc7b86d..4ed89fd6abb 100644 --- a/Core/Tools/WW3D/max2w3d/dazzlesave.cpp +++ b/Core/Tools/WW3D/max2w3d/dazzlesave.cpp @@ -54,14 +54,14 @@ DazzleSaveClass::DazzleSaveClass Progress_Meter_Class & meter ) { - assert(mesh_name != NULL); - assert(container_name != NULL); + assert(mesh_name != nullptr); + assert(container_name != nullptr); /* ** Set up the render object name */ memset(&W3DName,0,sizeof(W3DName)); - if ((container_name != NULL) && (strlen(container_name) > 0)) { + if ((container_name != nullptr) && (strlen(container_name) > 0)) { strcpy(W3DName,container_name); strcat(W3DName,"."); } diff --git a/Core/Tools/WW3D/max2w3d/dllmain.cpp b/Core/Tools/WW3D/max2w3d/dllmain.cpp index ce3727e08e6..46bc274f227 100644 --- a/Core/Tools/WW3D/max2w3d/dllmain.cpp +++ b/Core/Tools/WW3D/max2w3d/dllmain.cpp @@ -64,7 +64,7 @@ * Globals *****************************************************************************/ -HINSTANCE AppInstance = NULL; +HINSTANCE AppInstance = nullptr; static int ControlsInit = FALSE; static W3dClassDesc W3d_Export_Class_Descriptor; @@ -158,9 +158,9 @@ DLLEXPORT ClassDesc * LibClassDesc(int i) case 7: return Get_PS2_Material_Conversion(); break; case 8: return Get_Alpha_Desc(); break; //case 6: return Get_Mesh_Deform_Desc(); break; - //Moumine 7/24/2001 4:33:52 PM Removed #6 and shifted up instead of returning NULL - // NULL causes a crash in "File->Summary info->Plug-in ifo..." - default: return NULL; break; + //Moumine 7/24/2001 4:33:52 PM Removed #6 and shifted up instead of returning nullptr + // nullptr causes a crash in "File->Summary info->Plug-in ifo..." + default: return nullptr; break; } } @@ -199,8 +199,8 @@ TCHAR * Get_String( int id ) { static TCHAR buf[256]; if (AppInstance) - return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : NULL; - return NULL; + return LoadString(AppInstance, id, buf, sizeof(buf)) ? buf : nullptr; + return nullptr; } diff --git a/Core/Tools/WW3D/max2w3d/exportlog.cpp b/Core/Tools/WW3D/max2w3d/exportlog.cpp index 6f3aefbee80..800c3cfc94e 100644 --- a/Core/Tools/WW3D/max2w3d/exportlog.cpp +++ b/Core/Tools/WW3D/max2w3d/exportlog.cpp @@ -49,7 +49,7 @@ /* ** Static variables */ -LogDataDialogClass * _LogDialog = NULL; +LogDataDialogClass * _LogDialog = nullptr; /* @@ -73,7 +73,7 @@ LogDataDialogClass * _LogDialog = NULL; *=============================================================================================*/ void ExportLog::Init(HWND parent) { - assert(_LogDialog == NULL); + assert(_LogDialog == nullptr); _LogDialog = new LogDataDialogClass(parent); } @@ -93,14 +93,14 @@ void ExportLog::Init(HWND parent) *=============================================================================================*/ void ExportLog::Shutdown(bool wait_for_ok) { - if (_LogDialog != NULL) { + if (_LogDialog != nullptr) { if (wait_for_ok) { _LogDialog->Wait_OK(); } delete _LogDialog; - _LogDialog = NULL; + _LogDialog = nullptr; } } @@ -119,7 +119,7 @@ void ExportLog::Shutdown(bool wait_for_ok) *=============================================================================================*/ void ExportLog::printf(const char * format, ...) { - if (_LogDialog != NULL) { + if (_LogDialog != nullptr) { va_list arguments; va_start(arguments, format); _LogDialog->printf(format,arguments); @@ -141,7 +141,7 @@ void ExportLog::printf(const char * format, ...) *=============================================================================================*/ void ExportLog::rprintf(const char * format, ...) { - if (_LogDialog != NULL) { + if (_LogDialog != nullptr) { va_list arguments; va_start(arguments, format); _LogDialog->rprintf(format,arguments); @@ -163,7 +163,7 @@ void ExportLog::rprintf(const char * format, ...) *=============================================================================================*/ void ExportLog::updatebar(float position, float total) { - if (_LogDialog != NULL) { + if (_LogDialog != nullptr) { _LogDialog->updatebar(position,total); } } diff --git a/Core/Tools/WW3D/max2w3d/floaterdialog.cpp b/Core/Tools/WW3D/max2w3d/floaterdialog.cpp index 6079b238c7d..38eec49554b 100644 --- a/Core/Tools/WW3D/max2w3d/floaterdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/floaterdialog.cpp @@ -87,9 +87,9 @@ BOOL CALLBACK _floater_dialog_proc(HWND hwnd,UINT message,WPARAM wParam,LPARAM l * HISTORY: * *=============================================================================================*/ FloaterDialogClass::FloaterDialogClass(void) : - Hwnd(NULL), + Hwnd(nullptr), ChildDialogTemplateID(-1), - ChildDialogProc(NULL) + ChildDialogProc(nullptr) { } @@ -107,7 +107,7 @@ FloaterDialogClass::FloaterDialogClass(void) : *=============================================================================================*/ FloaterDialogClass::~FloaterDialogClass(void) { - if (Hwnd != NULL) { + if (Hwnd != nullptr) { ::DestroyWindow(Hwnd); } } @@ -127,7 +127,7 @@ FloaterDialogClass::~FloaterDialogClass(void) *=============================================================================================*/ bool FloaterDialogClass::Is_Created(void) { - return (Hwnd != NULL); + return (Hwnd != nullptr); } @@ -204,13 +204,13 @@ bool FloaterDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM ChildDialogProc, 0 ); - if (childhwnd!= NULL) { + if (childhwnd!= nullptr) { RECT rect; LONG style = ::GetWindowLong(hWnd,GWL_STYLE); ::GetWindowRect(childhwnd,&rect); ::AdjustWindowRect(&rect,style,FALSE); - ::SetWindowPos(hWnd,NULL,0,0,rect.right - rect.left,rect.bottom - rect.top,SWP_NOZORDER|SWP_NOMOVE); - ::SetWindowPos(childhwnd,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_SHOWWINDOW); + ::SetWindowPos(hWnd,nullptr,0,0,rect.right - rect.left,rect.bottom - rect.top,SWP_NOZORDER|SWP_NOMOVE); + ::SetWindowPos(childhwnd,nullptr,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_SHOWWINDOW); } } return 1; @@ -226,7 +226,7 @@ bool FloaterDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM case WM_DESTROY: ::GetCOREInterface()->UnRegisterDlgWnd(Hwnd); - Hwnd = NULL; + Hwnd = nullptr; break; } return 0; diff --git a/Core/Tools/WW3D/max2w3d/gamemaps.cpp b/Core/Tools/WW3D/max2w3d/gamemaps.cpp index 0be2207c5c5..3c0e5325352 100644 --- a/Core/Tools/WW3D/max2w3d/gamemaps.cpp +++ b/Core/Tools/WW3D/max2w3d/gamemaps.cpp @@ -89,7 +89,7 @@ class GameMapsClassDesc : public ClassDesc { public: int IsPublic() { return 0; } - void * Create(BOOL loading) { return new GameMapsClass(NULL); } + void * Create(BOOL loading) { return new GameMapsClass(nullptr); } const TCHAR * ClassName() { return _T("GameMaps"); } SClass_ID SuperClassID() { return REF_MAKER_CLASS_ID; } Class_ID ClassID() { return _GameMapsClassID; } @@ -183,11 +183,11 @@ RefResult GameMapsClass::NotifyRefChanged *=============================================================================================*/ RefTargetHandle GameMapsClass::Clone(RemapDir &remap) { - GameMapsClass *tm = new GameMapsClass(NULL); + GameMapsClass *tm = new GameMapsClass(nullptr); for (int i=0; iTextureSlot[i].MapOn = TextureSlot[i].MapOn; - tm->TextureSlot[i].Map = NULL; + tm->TextureSlot[i].Map = nullptr; if (TextureSlot[i].Map) { tm->ReplaceReference(i,remap.CloneRef(TextureSlot[i].Map)); diff --git a/Core/Tools/WW3D/max2w3d/gamemaps.h b/Core/Tools/WW3D/max2w3d/gamemaps.h index f94e728406d..3da8ebc3cdd 100644 --- a/Core/Tools/WW3D/max2w3d/gamemaps.h +++ b/Core/Tools/WW3D/max2w3d/gamemaps.h @@ -57,7 +57,7 @@ class TexmapSlotClass float Amount; Texmap * Map; - TexmapSlotClass() : MapOn(FALSE), Amount(1.0f), Map(NULL) {}; + TexmapSlotClass() : MapOn(FALSE), Amount(1.0f), Map(nullptr) {}; RGBA Eval(ShadeContext& sc) { return Map->EvalColor(sc); } float EvalMono(ShadeContext& sc) { return Map->EvalMono(sc); } @@ -84,7 +84,7 @@ class GameMapsClass: public ReferenceTarget MtlBase * Client; TexmapSlotClass TextureSlot[NTEXMAPS]; - GameMapsClass() { Client = NULL; } + GameMapsClass() { Client = nullptr; } GameMapsClass(MtlBase *mb) { Client = mb; } void DeleteThis() { delete this; } diff --git a/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp b/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp index ffc8b5c36eb..c30199832f2 100644 --- a/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp +++ b/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp @@ -67,10 +67,10 @@ * HISTORY: * *=============================================================================================*/ GenLodExtensionDialogClass::GenLodExtensionDialogClass(Interface * maxinterface) : - Hwnd(NULL), - Options(NULL), + Hwnd(nullptr), + Options(nullptr), MaxInterface(maxinterface), - LodIndexSpin(NULL) + LodIndexSpin(nullptr) { } @@ -189,7 +189,7 @@ bool GenLodExtensionDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wPara *=============================================================================================*/ static BOOL CALLBACK _gen_lod_ext_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) { - static GenLodExtensionDialogClass * dialog = NULL; + static GenLodExtensionDialogClass * dialog = nullptr; if (message == WM_INITDIALOG) { dialog = (GenLodExtensionDialogClass *)lparam; diff --git a/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp b/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp index 1347ccce465..8f625fee382 100644 --- a/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp @@ -70,10 +70,10 @@ static BOOL CALLBACK _gen_mtl_names_dialog_proc(HWND Hwnd,UINT message,WPARAM wP * HISTORY: * *=============================================================================================*/ GenMtlNamesDialogClass::GenMtlNamesDialogClass(Interface * maxinterface) : - Hwnd(NULL), - Options(NULL), + Hwnd(nullptr), + Options(nullptr), MaxInterface(maxinterface), - NameIndexSpin(NULL) + NameIndexSpin(nullptr) { } @@ -192,7 +192,7 @@ bool GenMtlNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LP // set initial name to root of the filename char buf[_MAX_FNAME]; - _splitpath(MaxInterface->GetCurFileName(),NULL,NULL,buf,NULL); + _splitpath(MaxInterface->GetCurFileName(),nullptr,nullptr,buf,nullptr); buf[MAX_ROOT_NAME_LEN+1] = 0; SetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf); @@ -244,7 +244,7 @@ bool GenMtlNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LP *=============================================================================================*/ static BOOL CALLBACK _gen_mtl_names_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) { - static GenMtlNamesDialogClass * dialog = NULL; + static GenMtlNamesDialogClass * dialog = nullptr; if (message == WM_INITDIALOG) { dialog = (GenMtlNamesDialogClass *)lparam; diff --git a/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp b/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp index c3328c7bce7..9ce03049351 100644 --- a/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp @@ -72,10 +72,10 @@ static BOOL CALLBACK _gen_names_dialog_proc(HWND Hwnd,UINT message,WPARAM wParam * HISTORY: * *=============================================================================================*/ GenNamesDialogClass::GenNamesDialogClass(Interface * maxinterface) : - Hwnd(NULL), - Options(NULL), + Hwnd(nullptr), + Options(nullptr), MaxInterface(maxinterface), - NameIndexSpin(NULL) + NameIndexSpin(nullptr) { } @@ -251,7 +251,7 @@ bool GenNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARA // set initial name to root of the filename char buf[_MAX_FNAME]; - _splitpath(MaxInterface->GetCurFileName(),NULL,NULL,buf,NULL); + _splitpath(MaxInterface->GetCurFileName(),nullptr,nullptr,buf,nullptr); buf[MAX_ROOT_NAME_LEN+1] = 0; SetWindowText(GetDlgItem(Hwnd,IDC_BASE_NAME_EDIT),buf); @@ -340,7 +340,7 @@ bool GenNamesDialogClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARA *=============================================================================================*/ static BOOL CALLBACK _gen_names_dialog_proc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) { - static GenNamesDialogClass * dialog = NULL; + static GenNamesDialogClass * dialog = nullptr; if (message == WM_INITDIALOG) { dialog = (GenNamesDialogClass *)lparam; diff --git a/Core/Tools/WW3D/max2w3d/geometryexportcontext.h b/Core/Tools/WW3D/max2w3d/geometryexportcontext.h index c1d83f18d8b..5315428c6b8 100644 --- a/Core/Tools/WW3D/max2w3d/geometryexportcontext.h +++ b/Core/Tools/WW3D/max2w3d/geometryexportcontext.h @@ -75,11 +75,11 @@ class GeometryExportContextClass OriginList(origin_list), Origin(origin), OriginTransform(1), - ProgressMeter(NULL), + ProgressMeter(nullptr), materialColors(materialColors), numMaterialColors(0), numHouseColors(0), - materialColorTexture(NULL) + materialColorTexture(nullptr) { ModelName = strdup(model_name); OriginTransform = Origin->GetNodeTM(CurTime); diff --git a/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp index 8a6a70a668c..b3042a8ce5e 100644 --- a/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp +++ b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp @@ -79,7 +79,7 @@ class MeshGeometryExportTaskClass : public GeometryExportTaskClass MeshGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) : GeometryExportTaskClass(node,context), NameDirty(false), - SingleMtl(NULL) + SingleMtl(nullptr) { /* ** Copy the export options @@ -271,7 +271,7 @@ class DazzleGeometryExportTaskClass : public GeometryExportTaskClass /** ** NullGeometryExportTaskClass -** Export task for INodes which are to generate W3D NULL objects. Note that this +** Export task for INodes which are to generate W3D null objects. Note that this ** does not do anything in the Export_Geometry call, these only create entries in ** any Hierarhcical model or collection object being exported. */ @@ -411,9 +411,9 @@ GeometryExportTaskClass::GeometryExportTaskClass(INode * node,GeometryExportCont /* ** Set up the bone index and export coordinate system. */ - if (context.HTree != NULL) { + if (context.HTree != nullptr) { if (!Is_Skin(node)) { - context.HTree->Get_Export_Coordinate_System(Node,&BoneIndex,NULL,&ExportSpace); + context.HTree->Get_Export_Coordinate_System(Node,&BoneIndex,nullptr,&ExportSpace); } else { BoneIndex = 0; ExportSpace = context.OriginTransform; @@ -506,7 +506,7 @@ GeometryExportTaskClass * GeometryExportTaskClass::Create_Task(INode * node,GeometryExportContextClass & context) { if (!::Is_Geometry(node)) { - return NULL; + return nullptr; } // NOTE: we *have* to check Is_Proxy first because it is tied to a naming convention @@ -535,7 +535,7 @@ GeometryExportTaskClass::Create_Task(INode * node,GeometryExportContextClass & c return new AggregateGeometryExportTaskClass(node,context); } - return NULL; + return nullptr; } @@ -703,9 +703,9 @@ void GeometryExportTaskClass::Generate_Name(char * root,int index,GeometryExport char * exterior_prefix = strchr(prefix,'#'); memset(Name,0,sizeof(Name)); - if (interior_prefix != NULL) { + if (interior_prefix != nullptr) { strncpy(Name,prefix,(int)(interior_prefix - prefix) + 1); - } else if (exterior_prefix != NULL) { + } else if (exterior_prefix != nullptr) { strncpy(Name,prefix,(int)(exterior_prefix - prefix) + 1); } @@ -741,15 +741,15 @@ void GeometryExportTaskClass::Generate_Name(char * root,int index,GeometryExport *=============================================================================================*/ void MeshGeometryExportTaskClass::Update_Cached_Data(void) { - SingleMtl = NULL; + SingleMtl = nullptr; Mtl * nodemtl = Node->GetMtl(); /* ** Set the SingleMtl pointer if this mesh uses only one material (again, even if its in a Multi-Sub) */ - if (nodemtl == NULL) { + if (nodemtl == nullptr) { - SingleMtl = NULL; + SingleMtl = nullptr; } else if (nodemtl->NumSubMtls() <= 1) { @@ -790,7 +790,7 @@ void MeshGeometryExportTaskClass::Update_Cached_Data(void) } if (mat_count > 1) { - SingleMtl = NULL; + SingleMtl = nullptr; } } @@ -838,7 +838,7 @@ void MeshGeometryExportTaskClass::Update_Cached_Data(void) *=============================================================================================*/ bool MeshGeometryExportTaskClass::Is_Single_Material(void) { - return ((SingleMtl != NULL) || (Node->GetMtl() == NULL)); + return ((SingleMtl != nullptr) || (Node->GetMtl() == nullptr)); } @@ -1016,7 +1016,7 @@ bool MeshGeometryExportTaskClass::Can_Combine_With(MeshGeometryExportTaskClass * ** Does the mesh use the same (single) material that we do? */ Mtl * other_mtl = other_mesh->Get_Single_Material(); - if (other_mtl == NULL) { + if (other_mtl == nullptr) { return false; } diff --git a/Core/Tools/WW3D/max2w3d/gmtldlg.cpp b/Core/Tools/WW3D/max2w3d/gmtldlg.cpp index f2ebcba44a1..cc244f72824 100644 --- a/Core/Tools/WW3D/max2w3d/gmtldlg.cpp +++ b/Core/Tools/WW3D/max2w3d/gmtldlg.cpp @@ -99,11 +99,11 @@ static inline int FracToPc(float f) GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m) { HwndEdit = hwMtlEdit; - HwndPanel = NULL; - HwndHints = NULL; - HwndPsx = NULL; - HwndNotes = NULL; - HpalOld = NULL; + HwndPanel = nullptr; + HwndHints = nullptr; + HwndPsx = nullptr; + HwndNotes = nullptr; + HpalOld = nullptr; TheMtl = m; IParams = imp; @@ -111,28 +111,28 @@ GameMtlDlg::GameMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m) IsActive = 0; InstCopy = FALSE; - DiffuseSwatch = NULL; - SpecularSwatch = NULL; + DiffuseSwatch = nullptr; + SpecularSwatch = nullptr; - AmbientCoeffSwatch = NULL; - DiffuseCoeffSwatch = NULL; - SpecularCoeffSwatch = NULL; - EmissiveCoeffSwatch = NULL; + AmbientCoeffSwatch = nullptr; + DiffuseCoeffSwatch = nullptr; + SpecularCoeffSwatch = nullptr; + EmissiveCoeffSwatch = nullptr; - DCTFramesSpin = NULL; - DITFramesSpin = NULL; - SCTFramesSpin = NULL; - SITFramesSpin = NULL; + DCTFramesSpin = nullptr; + DITFramesSpin = nullptr; + SCTFramesSpin = nullptr; + SITFramesSpin = nullptr; - DCTRateSpin = NULL; - DITRateSpin = NULL; - SCTRateSpin = NULL; - SITRateSpin = NULL; + DCTRateSpin = nullptr; + DITRateSpin = nullptr; + SCTRateSpin = nullptr; + SITRateSpin = nullptr; - OpacitySpin = NULL; - TranslucencySpin = NULL; - ShininessSpin = NULL; - FogSpin = NULL; + OpacitySpin = nullptr; + TranslucencySpin = nullptr; + ShininessSpin = nullptr; + FogSpin = nullptr; } /*********************************************************************************************** @@ -151,32 +151,32 @@ GameMtlDlg::~GameMtlDlg() { if (DiffuseSwatch) { ReleaseIColorSwatch(DiffuseSwatch); - DiffuseSwatch = NULL; + DiffuseSwatch = nullptr; } if (SpecularSwatch) { ReleaseIColorSwatch(SpecularSwatch); - SpecularSwatch = NULL; + SpecularSwatch = nullptr; } if (AmbientCoeffSwatch) { ReleaseIColorSwatch(AmbientCoeffSwatch); - AmbientCoeffSwatch = NULL; + AmbientCoeffSwatch = nullptr; } if (DiffuseCoeffSwatch) { ReleaseIColorSwatch(DiffuseCoeffSwatch); - DiffuseCoeffSwatch = NULL; + DiffuseCoeffSwatch = nullptr; } if (SpecularCoeffSwatch) { ReleaseIColorSwatch(SpecularCoeffSwatch); - SpecularCoeffSwatch = NULL; + SpecularCoeffSwatch = nullptr; } if (EmissiveCoeffSwatch) { ReleaseIColorSwatch(EmissiveCoeffSwatch); - EmissiveCoeffSwatch = NULL; + EmissiveCoeffSwatch = nullptr; } if (HwndPanel) { @@ -190,23 +190,23 @@ GameMtlDlg::~GameMtlDlg() TheMtl->SetFlag(GAMEMTL_ROLLUP3_OPEN,IParams->IsRollupPanelOpen(HwndHints)); TheMtl->SetFlag(GAMEMTL_ROLLUP4_OPEN,IParams->IsRollupPanelOpen(HwndNotes)); TheMtl->RollScroll = IParams->GetRollupScrollPos(); - TheMtl->SetParamDlg(NULL); + TheMtl->SetParamDlg(nullptr); IParams->UnRegisterDlgWnd(HwndPanel); IParams->DeleteRollupPage(HwndPanel); - HwndPanel = NULL; + HwndPanel = nullptr; IParams->UnRegisterDlgWnd(HwndPsx); IParams->DeleteRollupPage(HwndPsx); - HwndPsx = NULL; + HwndPsx = nullptr; IParams->UnRegisterDlgWnd(HwndHints); IParams->DeleteRollupPage(HwndHints); - HwndHints = NULL; + HwndHints = nullptr; IParams->UnRegisterDlgWnd(HwndNotes); IParams->DeleteRollupPage(HwndNotes); - HwndNotes = NULL; + HwndNotes = nullptr; } @@ -242,10 +242,10 @@ Class_ID GameMtlDlg::ClassID() void GameMtlDlg::Invalidate() { Valid = FALSE; - InvalidateRect(HwndPanel,NULL,0); - InvalidateRect(HwndPsx,NULL,0); - InvalidateRect(HwndHints,NULL,0); - InvalidateRect(HwndNotes,NULL,0); + InvalidateRect(HwndPanel,nullptr,0); + InvalidateRect(HwndPsx,nullptr,0); + InvalidateRect(HwndHints,nullptr,0); + InvalidateRect(HwndNotes,nullptr,0); } /*********************************************************************************************** @@ -436,28 +436,28 @@ BOOL GameMtlDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam case IDC_MAPON_DCT: TheMtl->EnableMap(ID_DI,GetCheckBox(hwndDlg, id)); - if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_DI,NULL); + if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_DI,nullptr); UpdateTexmapDisplay(ID_DI); UpdateMtlDisplay(); TheMtl->NotifyChanged(); break; case IDC_MAPON_DIT: TheMtl->EnableMap(ID_SI,GetCheckBox(hwndDlg, id)); - if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SI,NULL); + if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SI,nullptr); UpdateTexmapDisplay(ID_SI); UpdateMtlDisplay(); TheMtl->NotifyChanged(); break; case IDC_MAPON_SCT: TheMtl->EnableMap(ID_SP,GetCheckBox(hwndDlg, id)); - if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SP,NULL); + if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_SP,nullptr); UpdateTexmapDisplay(ID_SP); UpdateMtlDisplay(); TheMtl->NotifyChanged(); break; case IDC_MAPON_SIT: TheMtl->EnableMap(ID_RL,GetCheckBox(hwndDlg, id)); - if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_RL,NULL); + if (!GetCheckBox(hwndDlg,id)) TheMtl->SetSubTexmap(ID_RL,nullptr); UpdateTexmapDisplay(ID_RL); UpdateMtlDisplay(); TheMtl->NotifyChanged(); @@ -590,9 +590,9 @@ BOOL GameMtlDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ReleaseISpinner(ShininessSpin); ReleaseISpinner(FogSpin); - DCTFramesSpin = DITFramesSpin = SCTFramesSpin = SITFramesSpin = NULL; - DCTRateSpin = DITRateSpin = SCTRateSpin = SITRateSpin = NULL; - OpacitySpin = TranslucencySpin = ShininessSpin = FogSpin = NULL; + DCTFramesSpin = DITFramesSpin = SCTFramesSpin = SITFramesSpin = nullptr; + DCTRateSpin = DITRateSpin = SCTRateSpin = SITRateSpin = nullptr; + OpacitySpin = TranslucencySpin = ShininessSpin = FogSpin = nullptr; break; @@ -623,7 +623,7 @@ static BOOL CALLBACK PanelDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM theDlg->HwndPanel = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -694,7 +694,7 @@ static BOOL CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM theDlg->HwndNotes = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -787,7 +787,7 @@ static BOOL CALLBACK HintsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM theDlg->HwndHints = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -883,7 +883,7 @@ static BOOL CALLBACK PsxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP theDlg->HwndPsx = hwndDlg; SetWindowLong(hwndDlg, GWL_USERDATA,lParam); } else { - if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == NULL) { + if ((theDlg = (GameMtlDlg *)GetWindowLong(hwndDlg, GWL_USERDATA) ) == nullptr) { return FALSE; } } @@ -1100,7 +1100,7 @@ void GameMtlDlg::SetThing(ReferenceTarget *m) assert (m->ClassID()==GameMaterialClassID); if (TheMtl) { - TheMtl->ParamPanel = NULL; + TheMtl->ParamPanel = nullptr; } TheMtl = (GameMtl *)m; diff --git a/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp b/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp index f9aaf8773c3..cdca679defa 100644 --- a/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp +++ b/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp @@ -87,7 +87,7 @@ class GridSnapModifierClass : public SimpleMod2 // Direct paramblock access int NumParamBlocks() { return 1; } IParamBlock2* GetParamBlock(int i) { return pblock2; } - IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : NULL; } + IParamBlock2* GetParamBlockByID(BlockID id) { return (pblock2->ID() == id) ? pblock2 : nullptr; } // From simple mod Deformer& GetDeformer(TimeValue t,ModContext &mc,Matrix3& mat,Matrix3& invmat); @@ -177,7 +177,7 @@ static ParamBlockDesc2 _GridSnapParamBlockDesc GSM_PARAMS,_T("GridSnap Parameters"), 0, &_GridSnapModifierDesc, P_AUTO_CONSTRUCT + P_AUTO_UI, SIMPMOD_PBLOCKREF, // dialog box - IDD_GRIDSNAP_PARAMS, IDS_GRIDSNAP_TITLE, 0, 0, NULL, + IDD_GRIDSNAP_PARAMS, IDS_GRIDSNAP_TITLE, 0, 0, nullptr, // parameters GSM_PARAM_GRIDDIMENSION, _T("Grid Dimension"), TYPE_FLOAT, P_RESET_DEFAULT, IDS_GRID_DIMENSION, @@ -216,7 +216,7 @@ void GridSnapModifierClass::EndEditParams( IObjParam *ip,ULONG flags,Animatable SimpleMod2::EndEditParams(ip,flags,next); _GridSnapModifierDesc.EndEditParams(ip, this, flags, next); - this->ip = NULL; + this->ip = nullptr; } RefTargetHandle GridSnapModifierClass::Clone(RemapDir& remap) @@ -258,7 +258,7 @@ RefTargetHandle SimpleMod2::GetReference(int i) case 0: return tmControl; case 1: return posControl; case 2: return pblock2; - default: return NULL; + default: return nullptr; } } @@ -277,6 +277,6 @@ Animatable * SimpleMod2::SubAnim(int i) case 0: return posControl; case 1: return tmControl; case 2: return pblock2; - default: return NULL; + default: return nullptr; } } diff --git a/Core/Tools/WW3D/max2w3d/hiersave.cpp b/Core/Tools/WW3D/max2w3d/hiersave.cpp index 70066e54d31..5722baf25d4 100644 --- a/Core/Tools/WW3D/max2w3d/hiersave.cpp +++ b/Core/Tools/WW3D/max2w3d/hiersave.cpp @@ -116,7 +116,7 @@ HierarchySaveClass::HierarchySaveClass /* ** Build our tree from the given tree of nodes */ - int rootidx = add_node(NULL,-1); + int rootidx = add_node(nullptr,-1); assert(rootidx == 0); add_tree(root,rootidx); @@ -170,7 +170,7 @@ HierarchySaveClass::HierarchySaveClass /* ** Build the tree with all leaves of all of the nodes given */ - int rootidx = add_node(NULL,-1); + int rootidx = add_node(nullptr,-1); assert(rootidx == 0); for (unsigned int i = 0; i < rootlist->Num_Nodes(); i++) { @@ -199,7 +199,7 @@ HierarchySaveClass::HierarchySaveClass * 10/26/1997 GH : Created. * *=============================================================================================*/ HierarchySaveClass::HierarchySaveClass(): - Node(NULL), + Node(nullptr), CurNode(0), CurTime(0) { @@ -452,10 +452,10 @@ void HierarchySaveClass::Get_Export_Coordinate_System ** Nope, try the next parent */ pbone = pbone->GetParentNode(); - assert(pbone != NULL); + assert(pbone != nullptr); #if 0 - if (pbone == NULL) { + if (pbone == nullptr) { /* ** mesh isn't connected to a bone, use the root @@ -468,13 +468,13 @@ void HierarchySaveClass::Get_Export_Coordinate_System } } - if (set_bone_index != NULL) { + if (set_bone_index != nullptr) { *set_bone_index = boneidx; } - if (set_bone_node != NULL) { + if (set_bone_node != nullptr) { *set_bone_node = pbone; } - if (set_transform != NULL) { + if (set_transform != nullptr) { *set_transform = Get_Fixup_Transform(boneidx) * pbone->GetNodeTM(CurTime); } } @@ -678,11 +678,11 @@ int HierarchySaveClass::add_node(INode * node,int pidx) ** types of transforms and we want to apply the same ** changes to this tree. ** - ** Note that if FixupType is not "NONE", FixupTree must be NULL, + ** Note that if FixupType is not "NONE", FixupTree must be nullptr, */ - assert(!((FixupTree != NULL) && (FixupType != MATRIX_FIXUP_NONE))); + assert(!((FixupTree != nullptr) && (FixupType != MATRIX_FIXUP_NONE))); - if (FixupTree != NULL) { + if (FixupTree != nullptr) { int fi = FixupTree->Find_Named_Node(Node[CurNode].Pivot.Name); if (fi == -1) { char buf[128]; @@ -976,7 +976,7 @@ bool HierarchySaveClass::load_header(ChunkLoadClass & cload) bool HierarchySaveClass::load_pivots(ChunkLoadClass & cload) { for (uint32 i=0; i= 2) { EndDialog(Hwnd, 1); - Hwnd = NULL; + Hwnd = nullptr; } return TRUE; @@ -301,7 +301,7 @@ bool LogDataDialogClass::Dialog_Proc void LogDataDialogClass::Dialog_Init() { - SetCursor(LoadCursor (NULL, IDC_ARROW)); + SetCursor(LoadCursor (nullptr, IDC_ARROW)); RECT desktop; RECT ourwin; diff --git a/Core/Tools/WW3D/max2w3d/maxworldinfo.h b/Core/Tools/WW3D/max2w3d/maxworldinfo.h index d690edb50aa..cb4bc9e27e6 100644 --- a/Core/Tools/WW3D/max2w3d/maxworldinfo.h +++ b/Core/Tools/WW3D/max2w3d/maxworldinfo.h @@ -58,7 +58,7 @@ class MaxWorldInfoClass : public WorldInfoClass MaxWorldInfoClass(DynamicVectorClass & mesh_list) : MeshList (mesh_list), SmoothBetweenMeshes (true), - CurrentTask(NULL), + CurrentTask(nullptr), CurrentTime(0) { } virtual ~MaxWorldInfoClass(void) { } diff --git a/Core/Tools/WW3D/max2w3d/meshbuild.cpp b/Core/Tools/WW3D/max2w3d/meshbuild.cpp index 524b14c4b24..1d8c7e6ee07 100644 --- a/Core/Tools/WW3D/max2w3d/meshbuild.cpp +++ b/Core/Tools/WW3D/max2w3d/meshbuild.cpp @@ -161,7 +161,7 @@ class VertexArrayClass VertexArrayClass(int maxsize,int match_normals = 0) { - Verts = NULL; + Verts = nullptr; assert(maxsize > 0); Verts = new MeshBuilderClass::VertClass[maxsize]; assert(Verts); @@ -413,7 +413,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -560,16 +560,16 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ State(STATE_ACCEPTING_INPUT), PassCount(pass_count), FaceCount(0), - Faces(NULL), + Faces(nullptr), InputVertCount(0), VertCount(0), - Verts(NULL), + Verts(nullptr), CurFace(0), AllocFaceCount(0), AllocFaceGrowth(0), PolyOrderPass(0), PolyOrderStage(0), - WorldInfo (NULL) + WorldInfo(nullptr) { Reset(pass_count,face_count_guess,face_count_growth_rate); } @@ -589,7 +589,7 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ MeshBuilderClass::~MeshBuilderClass(void) { Free(); - Set_World_Info(NULL); + Set_World_Info(nullptr); } @@ -607,14 +607,14 @@ MeshBuilderClass::~MeshBuilderClass(void) *=============================================================================================*/ void MeshBuilderClass::Free(void) { - if (Faces != NULL) { + if (Faces != nullptr) { delete[] Faces; - Faces = NULL; + Faces = nullptr; } - if (Verts != NULL) { + if (Verts != nullptr) { delete Verts; - Verts = NULL; + Verts = nullptr; } FaceCount = 0; @@ -825,7 +825,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) /* ** Smooth this mesh with neighboring meshes! */ - if (WorldInfo != NULL && WorldInfo->Are_Meshes_Smoothed ()) { + if (WorldInfo != nullptr && WorldInfo->Are_Meshes_Smoothed ()) { for (vertidx = 0; vertidx < VertCount; vertidx++) { if (Verts[vertidx].ShadeIndex == vertidx) { Verts[vertidx].Normal += WorldInfo->Get_Shared_Vertex_Normal(Verts[vertidx].Position, Verts[vertidx].SharedSmGroup); @@ -1012,8 +1012,8 @@ void MeshBuilderClass::Compute_Bounding_Box(Vector3 * set_min,Vector3 * set_max) { int i; - assert(set_min != NULL); - assert(set_max != NULL); + assert(set_min != nullptr); + assert(set_max != nullptr); // Bounding Box // straightforward, axis-aligned bounding box. diff --git a/Core/Tools/WW3D/max2w3d/meshcon.cpp b/Core/Tools/WW3D/max2w3d/meshcon.cpp index 11cdd3845f7..420d52f5b1d 100644 --- a/Core/Tools/WW3D/max2w3d/meshcon.cpp +++ b/Core/Tools/WW3D/max2w3d/meshcon.cpp @@ -69,7 +69,7 @@ MeshConnectionsClass::MeshConnectionsClass Origin(context.Origin) { unsigned int i; - assert(Origin != NULL); + assert(Origin != nullptr); /* ** Set the name, count the sub-objects and aggregates diff --git a/Core/Tools/WW3D/max2w3d/meshcon.h b/Core/Tools/WW3D/max2w3d/meshcon.h index cae17047f13..8060c23a3ee 100644 --- a/Core/Tools/WW3D/max2w3d/meshcon.h +++ b/Core/Tools/WW3D/max2w3d/meshcon.h @@ -68,7 +68,7 @@ class GeometryExportContextClass; struct ConnectionStruct { - ConnectionStruct(void) : BoneIndex(0),MeshINode(NULL) + ConnectionStruct(void) : BoneIndex(0),MeshINode(nullptr) { memset(ObjectName,0,sizeof(ObjectName)); } @@ -116,11 +116,11 @@ class MeshConnectionsClass ** out_name - name of the mesh is passed back by setting the char* pointed to by this value. ** out_boneindex - the index of the bone used is passed back by setting the int pointed to by this value. ** out_inode - mesh INode is passed by setting the INode* pointed to by this value. If this - ** parameter is NULL, the value is not passed back. + ** parameter is null, the value is not passed back. */ - bool Get_Sub_Object_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL); - bool Get_Aggregate_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL); - bool Get_Proxy_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = NULL); + bool Get_Sub_Object_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = nullptr); + bool Get_Aggregate_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = nullptr); + bool Get_Proxy_Data(int index, char **out_name, int *out_boneindex, INode **out_inode = nullptr); /* ** Returns the origin node used by this model. diff --git a/Core/Tools/WW3D/max2w3d/meshsave.cpp b/Core/Tools/WW3D/max2w3d/meshsave.cpp index d1ff3513b1f..f2cc520e2e3 100644 --- a/Core/Tools/WW3D/max2w3d/meshsave.cpp +++ b/Core/Tools/WW3D/max2w3d/meshsave.cpp @@ -154,7 +154,7 @@ uint32 setup_mesh_attributes(INode * node) ** And, a mesh may have one or more types of collision detection enabled. ** W3D_MESH_FLAG_COLLISION_TYPE_PHYSICAL ** W3D_MESH_FLAG_COLLISION_TYPE_PROJECTILE - ** However, if the mesh is SKIN, SHADOW, ALIGNED, ORIENTED or NULL, don't let + ** However, if the mesh is SKIN, SHADOW, ALIGNED, ORIENTED or nullptr, don't let ** the collision bits get set... */ if ( attributes != W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN && @@ -252,9 +252,9 @@ MeshSaveClass::MeshSaveClass CurTime(curtime), ExportSpace(exportspace), HTree(htree), - UserText(NULL), - VertInfluences(NULL), - MaterialRemapTable(NULL) + UserText(nullptr), + VertInfluences(nullptr), + MaterialRemapTable(nullptr) { Mesh mesh = *input_mesh; // copy the mesh so we can modify it Mtl * nodemtl = inode->GetMtl(); @@ -296,8 +296,8 @@ MeshSaveClass::MeshSaveClass ////////////////////////////////////////////////////////////////////// // Prepare the mesh header. ////////////////////////////////////////////////////////////////////// - assert(mesh_name != NULL); - assert(container_name != NULL); + assert(mesh_name != nullptr); + assert(container_name != nullptr); memset(&Header,0,sizeof(Header)); Set_W3D_Name(Header.MeshName,mesh_name); @@ -342,7 +342,7 @@ MeshSaveClass::MeshSaveClass Header.VertexChannels |= W3D_VERTEX_CHANNEL_NORMAL; } - if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != NULL)) { + if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != nullptr)) { Header.VertexChannels |= W3D_VERTEX_CHANNEL_BONEID; } @@ -400,7 +400,7 @@ MeshSaveClass::MeshSaveClass ////////////////////////////////////////////////////////////////////// // If this is a skin, pre-deform the mesh. ////////////////////////////////////////////////////////////////////// - if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != NULL)) { + if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && (HTree != nullptr)) { inv_deform_mesh(); } @@ -434,17 +434,17 @@ MeshSaveClass::~MeshSaveClass(void) { if (UserText) { delete[] UserText; - UserText = NULL; + UserText = nullptr; } if (VertInfluences) { delete[] VertInfluences; - VertInfluences = NULL; + VertInfluences = nullptr; } if (MaterialRemapTable) { delete[] MaterialRemapTable; - MaterialRemapTable = NULL; + MaterialRemapTable = nullptr; } } @@ -494,28 +494,28 @@ void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materia int face_index; int pass; int stage; - float *vdata = NULL; + float *vdata = nullptr; int firstSolidColoredMaterial=-1; Builder.Reset(true,mesh.getNumFaces(),mesh.getNumFaces()/3); // Get a pointer to the channel that has alpha values entered by the artist. - // This pointer will be NULL if they didn't use the channel. + // This pointer will be null if they didn't use the channel. vdata = mesh.vertexFloat(ALPHA_VERTEX_CHANNEL); /* ** Get the skin info */ bool is_skin = false; - SkinDataClass * skindata = NULL; - SkinWSMObjectClass * skinobj = NULL; + SkinDataClass * skindata = nullptr; + SkinWSMObjectClass * skinobj = nullptr; get_skin_modifier_objects(&skindata,&skinobj); if ( ((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) == W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) && - (HTree != NULL) ) + (HTree != nullptr) ) { - is_skin = ((skindata != NULL) && (skinobj != NULL)); + is_skin = ((skindata != nullptr) && (skinobj != nullptr)); } /* @@ -555,11 +555,11 @@ void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materia ** Lookup this face's surface type */ Mtl *mtl_to_use = node_mtl; - if ((node_mtl != NULL) && (node_mtl->NumSubMtls() > 1)) { + if ((node_mtl != nullptr) && (node_mtl->NumSubMtls() > 1)) { mtl_to_use = node_mtl->GetSubMtl (maxface.getMatID() % node_mtl->NumSubMtls()); } - if ((mtl_to_use != NULL) && ((mtl_to_use->ClassID() == GameMaterialClassID) || + if ((mtl_to_use != nullptr) && ((mtl_to_use->ClassID() == GameMaterialClassID) || (mtl_to_use->ClassID() == PS2GameMaterialClassID))) { face.SurfaceType = ((GameMtl *)mtl_to_use)->Get_Surface_Type (); } @@ -659,7 +659,7 @@ void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materia ///@todo: MW: Forced ingoring of uv coordinates if no texture! Is this ok? W3dMapClass *map3d=MaterialDesc.Get_Texture(mat_index,pass,stage); - if (map3d && (uvarray != NULL) && (tvfacearray != NULL)) { + if (map3d && (uvarray != nullptr) && (tvfacearray != nullptr)) { int tvert_index = tvfacearray[face_index].t[max_vert_counter]; tvert = uvarray[tvert_index]; @@ -743,7 +743,7 @@ void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materia // If this is a valid bone, try to find the corresponding bone index in the HTree if ( (skin_bone_index != -1) && (skin_bone_index < skinobj->Num_Bones()) && - (skinobj->BoneTab[skin_bone_index] != NULL) ) + (skinobj->BoneTab[skin_bone_index] != nullptr) ) { face.Verts[vert_counter].BoneIndex = get_htree_bone_index_for_inode(skinobj->BoneTab[skin_bone_index]); } @@ -785,8 +785,8 @@ void MeshSaveClass::Build_Mesh(Mesh & mesh, Mtl *node_mtl, unsigned int *materia *=============================================================================================*/ void MeshSaveClass::get_skin_modifier_objects(SkinDataClass ** skin_data_ptr,SkinWSMObjectClass ** skin_obj_ptr) { - *skin_data_ptr = NULL; - *skin_obj_ptr = NULL; + *skin_data_ptr = nullptr; + *skin_obj_ptr = nullptr; // loop through the references that our node has for (int i = 0; i < MaxINode->NumRefs(); i++) { @@ -794,7 +794,7 @@ void MeshSaveClass::get_skin_modifier_objects(SkinDataClass ** skin_data_ptr,Ski ReferenceTarget *refTarg = MaxINode->GetReference(i); // if the reference is a WSM Derived Object. - if (refTarg != NULL && refTarg->ClassID() == Class_ID(WSM_DERIVOB_CLASS_ID,0)) { + if (refTarg != nullptr && refTarg->ClassID() == Class_ID(WSM_DERIVOB_CLASS_ID,0)) { IDerivedObject * wsm_der_obj = (IDerivedObject *)refTarg; @@ -1060,7 +1060,7 @@ int MeshSaveClass::write_header(ChunkSaveClass & csave) int MeshSaveClass::write_user_text(ChunkSaveClass & csave) { // If there's no user text, just don't write the chunk - if (UserText == NULL) { + if (UserText == nullptr) { return 0; } @@ -1068,7 +1068,7 @@ int MeshSaveClass::write_user_text(ChunkSaveClass & csave) return 1; } - // write the user text buffer (writing one extra byte to include the NULL) + // write the user text buffer (writing one extra byte to include the null terminator) if (csave.Write(UserText,strlen(UserText) + 1) != strlen(UserText) + 1) { return 1; } @@ -1204,7 +1204,7 @@ int MeshSaveClass::write_vert_influences(ChunkSaveClass & csave) { if (((Header.Attributes & W3D_MESH_FLAG_GEOMETRY_TYPE_MASK) != W3D_MESH_FLAG_GEOMETRY_TYPE_SKIN) || !(Header.VertexChannels & W3D_VERTEX_CHANNEL_BONEID) || - (VertInfluences == NULL)) { + (VertInfluences == nullptr)) { return 0; } @@ -1338,7 +1338,7 @@ int MeshSaveClass::write_vertex_materials(ChunkSaveClass & csave) // write the filename const char * name = MaterialDesc.Get_Vertex_Material_Name(i); - if (name != NULL) { + if (name != nullptr) { csave.Begin_Chunk(W3D_CHUNK_VERTEX_MATERIAL_NAME); if (csave.Write(name,strlen(name) + 1) != strlen(name) + 1) { return 1; @@ -1356,7 +1356,7 @@ int MeshSaveClass::write_vertex_materials(ChunkSaveClass & csave) // write the mapper args const char * args = MaterialDesc.Get_Mapper_Args(i, 0); - if (args != NULL) { + if (args != nullptr) { csave.Begin_Chunk(W3D_CHUNK_VERTEX_MAPPER_ARGS0); if (csave.Write(args,strlen(args) + 1) != strlen(args) + 1) { return 1; @@ -1364,7 +1364,7 @@ int MeshSaveClass::write_vertex_materials(ChunkSaveClass & csave) csave.End_Chunk(); } args = MaterialDesc.Get_Mapper_Args(i, 1); - if (args != NULL) { + if (args != nullptr) { csave.Begin_Chunk(W3D_CHUNK_VERTEX_MAPPER_ARGS1); if (csave.Write(args,strlen(args) + 1) != strlen(args) + 1) { return 1; @@ -1559,7 +1559,7 @@ int MeshSaveClass::write_textures(ChunkSaveClass & csave) csave.End_Chunk(); // optionally write an animation info chunk - if (map->AnimInfo != NULL) { + if (map->AnimInfo != nullptr) { csave.Begin_Chunk(W3D_CHUNK_TEXTURE_INFO); if (csave.Write(map->AnimInfo,sizeof(W3dTextureInfoStruct)) != sizeof(W3dTextureInfoStruct)) return 1; csave.End_Chunk(); @@ -1806,7 +1806,7 @@ int MeshSaveClass::scan_used_materials(Mesh & mesh,Mtl * nodemtl) int face_index; int mat_index; - if ((nodemtl == NULL) || (nodemtl->NumSubMtls() <= 1)) { + if ((nodemtl == nullptr) || (nodemtl->NumSubMtls() <= 1)) { MaterialRemapTable = new int[1]; MaterialRemapTable[0] = 0; @@ -1874,7 +1874,7 @@ int MeshSaveClass::getNumSolidMaterials(Mtl * nodemtl) int mat_index; int numSolid=0; - if ((nodemtl == NULL) || (nodemtl->NumSubMtls() <= 1)) + if ((nodemtl == nullptr) || (nodemtl->NumSubMtls() <= 1)) { //Check if diffuse texture present if (isTexturedMaterial(nodemtl)) return 00; @@ -2027,7 +2027,7 @@ void MeshSaveClass::create_materials(Mtl * nodemtl,DWORD wirecolor, char *materi if (isTexturedMaterial(nodemtl) == 0) mat.Init(nodemtl,materialColorTexture); else - mat.Init(nodemtl,NULL); + mat.Init(nodemtl,nullptr); W3dMaterialDescClass::ErrorType err; err = MaterialDesc.Add_Material(mat,nodemtl->GetName()); @@ -2053,7 +2053,7 @@ void MeshSaveClass::create_materials(Mtl * nodemtl,DWORD wirecolor, char *materi if (isTexturedMaterial(nodemtl->GetSubMtl(mi)) == 0) mat.Init(nodemtl->GetSubMtl(mi),materialColorTexture); else - mat.Init(nodemtl->GetSubMtl(mi),NULL); + mat.Init(nodemtl->GetSubMtl(mi),nullptr); char * name; W3dMaterialDescClass::ErrorType err; diff --git a/Core/Tools/WW3D/max2w3d/meshsave.h b/Core/Tools/WW3D/max2w3d/meshsave.h index db46e5549da..4777f987569 100644 --- a/Core/Tools/WW3D/max2w3d/meshsave.h +++ b/Core/Tools/WW3D/max2w3d/meshsave.h @@ -117,7 +117,7 @@ class MeshSaveClass int &numMaterialColors, int &numHouseColors, char * materialColorTexture, - WorldInfoClass * world_info = NULL + WorldInfoClass * world_info = nullptr ); ~MeshSaveClass(void); diff --git a/Core/Tools/WW3D/max2w3d/motion.cpp b/Core/Tools/WW3D/max2w3d/motion.cpp index c6877721475..c05df5c803d 100644 --- a/Core/Tools/WW3D/max2w3d/motion.cpp +++ b/Core/Tools/WW3D/max2w3d/motion.cpp @@ -88,7 +88,7 @@ MotionClass::MotionClass BasePose(basepose), Scene(scene), RootNode(rootnode), - RootList(NULL), + RootList(nullptr), StartFrame(options.StartFrame), EndFrame(options.EndFrame), ReduceAnimation(options.ReduceAnimation), @@ -135,7 +135,7 @@ MotionClass::MotionClass ): BasePose(basepose), Scene(scene), - RootNode(NULL), + RootNode(nullptr), RootList(rootlist), StartFrame(options.StartFrame), EndFrame(options.EndFrame), @@ -183,18 +183,18 @@ void MotionClass::init(void) ** and an XYZEulers per frame per node. */ MotionMatrix = new Matrix3 * [BasePose->Num_Nodes()]; - if (MotionMatrix == NULL) { + if (MotionMatrix == nullptr) { throw (ErrorClass("Out of Memory")); } EulerDelta = new Point3 * [BasePose->Num_Nodes()]; - if (EulerDelta == NULL) { + if (EulerDelta == nullptr) { throw (ErrorClass("Out of Memory")); } for (i=0; iNum_Nodes(); i++) { MotionMatrix[i] = new Matrix3[NumFrames]; - if (MotionMatrix[i] == NULL) { + if (MotionMatrix[i] == nullptr) { throw (ErrorClass("Out of Memory")); } @@ -208,7 +208,7 @@ void MotionClass::init(void) for (i=0; iNum_Nodes(); i++) { EulerDelta[i] = new Point3[NumFrames]; - if (EulerDelta[i] == NULL) { + if (EulerDelta[i] == nullptr) { throw (ErrorClass("Out of Memory")); } @@ -349,13 +349,13 @@ void MotionClass::compute_frame_motion(int frame) */ HierarchySaveClass * tree; - if (RootNode != NULL) { + if (RootNode != nullptr) { tree = new HierarchySaveClass(RootNode,frametime,*Meter,"NoName",false,BasePose); } else { tree = new HierarchySaveClass(RootList,frametime,*Meter,"NoName",false,BasePose,Offset); } - if (tree == NULL) { + if (tree == nullptr) { throw (ErrorClass("Out of memory!")); } diff --git a/Core/Tools/WW3D/max2w3d/namedsel.cpp b/Core/Tools/WW3D/max2w3d/namedsel.cpp index b3a831a9820..62f06758e76 100644 --- a/Core/Tools/WW3D/max2w3d/namedsel.cpp +++ b/Core/Tools/WW3D/max2w3d/namedsel.cpp @@ -43,9 +43,9 @@ NamedSelSetList::~NamedSelSetList() { for (int i=0; i 0)) { + if ((container_name != nullptr) && (strlen(container_name) > 0)) { strcpy(NullData.Name,container_name); strcat(NullData.Name,"."); } diff --git a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp index 1c420590cd7..28ef55aea63 100644 --- a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp @@ -58,8 +58,8 @@ static const char *BROWSE_FILTER = "W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\ //////////////////////////////////////////////////////////////////////////////////////// PresetExportOptionsDialogClass::PresetExportOptionsDialogClass (Interface *maxinterface, HWND parent_wnd) : MaxInterface (maxinterface), - Options (NULL), - Wnd (NULL), + Options (nullptr), + Wnd (nullptr), ParentWnd (parent_wnd), CurrentPane (-1) { @@ -107,7 +107,7 @@ PresetExportOptionsDialogClass::Real_Message_Proc LPARAM lparam ) { - PresetExportOptionsDialogClass *dialog_obj = NULL; + PresetExportOptionsDialogClass *dialog_obj = nullptr; // // Setup the framework we need so that the instance @@ -125,7 +125,7 @@ PresetExportOptionsDialogClass::Real_Message_Proc // Allow the instance to handle the call // BOOL retval = FALSE; - if (dialog_obj != NULL) { + if (dialog_obj != nullptr) { retval = dialog_obj->Message_Proc (message, wparam, lparam); } @@ -154,7 +154,7 @@ PresetExportOptionsDialogClass::Settings_Pane_Message_Proc LPARAM lparam ) { - PresetExportOptionsDialogClass *dialog_obj = NULL; + PresetExportOptionsDialogClass *dialog_obj = nullptr; // // Setup the framework we need so that the instance @@ -171,7 +171,7 @@ PresetExportOptionsDialogClass::Settings_Pane_Message_Proc // Allow the instance to handle the call // BOOL retval = FALSE; - if (dialog_obj != NULL) { + if (dialog_obj != nullptr) { retval = dialog_obj->Pane_Message_Proc (message, wparam, lparam); } @@ -213,7 +213,7 @@ PresetExportOptionsDialogClass::Pane_Message_Proc // Update the start frame // ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam); - if (edit_ctrl != NULL) { + if (edit_ctrl != nullptr) { Options->StartFrame = edit_ctrl->GetInt (); // @@ -234,7 +234,7 @@ PresetExportOptionsDialogClass::Pane_Message_Proc // Update the end frame // ICustEdit *edit_ctrl = GetICustEdit ((HWND)lparam); - if (edit_ctrl != NULL) { + if (edit_ctrl != nullptr) { Options->EndFrame = edit_ctrl->GetInt (); // @@ -255,7 +255,7 @@ PresetExportOptionsDialogClass::Pane_Message_Proc case CC_SPINNER_BUTTONUP: { ISpinnerControl *spin_ctrl = (ISpinnerControl *)lparam; - if (spin_ctrl != NULL) { + if (spin_ctrl != nullptr) { switch (LOWORD (wparam)) { @@ -406,7 +406,7 @@ PresetExportOptionsDialogClass::Message_Proc ::GetWindowRect (Wnd, &rect); int width = parent_rect.right - parent_rect.left; int height = parent_rect.bottom - parent_rect.top; - ::SetWindowPos ( Wnd, NULL, + ::SetWindowPos ( Wnd, nullptr, parent_rect.left + (width / 2) - ((rect.right - rect.left) / 2), parent_rect.top + (height / 2) - ((rect.bottom - rect.top) / 2), 0, 0, SWP_NOZORDER | SWP_NOSIZE); @@ -582,7 +582,7 @@ PresetExportOptionsDialogClass::Destroy_Settings_Panes (void) // for (int index = 0; index < PANE_MAX; index ++) { ::DestroyWindow (PaneWnds[index]); - PaneWnds[index] = NULL; + PaneWnds[index] = nullptr; } return ; @@ -696,10 +696,10 @@ PresetExportOptionsDialogClass::Initialize_Controls (void) // // Are there any animation controls on this pane to initialize? // - if (::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN) != NULL) { + if (::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN) != nullptr) { - ISpinnerControl *low_spin = NULL; - ISpinnerControl *high_spin = NULL; + ISpinnerControl *low_spin = nullptr; + ISpinnerControl *high_spin = nullptr; low_spin = ::SetupIntSpinner (pane_wnd, IDC_RANGE_LOW_SPIN, IDC_RANGE_LOW_EDIT, startframe, endframe, 0); @@ -746,7 +746,7 @@ PresetExportOptionsDialogClass::Update_Controls (void) // Enable/disable the compression settings button // HWND compress_settings_btn = ::GetDlgItem (pane_wnd, IDC_COMPRESSION_SETTINGS); - if (compress_settings_btn != NULL) { + if (compress_settings_btn != nullptr) { ::EnableWindow (compress_settings_btn, Options->CompressAnimation); } @@ -754,7 +754,7 @@ PresetExportOptionsDialogClass::Update_Controls (void) // Setup the skeleton browse button // HWND skeleten_browse_btn = ::GetDlgItem (pane_wnd, IDC_WHT_BROWSE_BUTTON); - if (skeleten_browse_btn != NULL) { + if (skeleten_browse_btn != nullptr) { // // Honor the relative path if it is present @@ -783,13 +783,13 @@ PresetExportOptionsDialogClass::Update_Controls (void) // HWND low_spin_wnd = ::GetDlgItem (pane_wnd, IDC_RANGE_LOW_SPIN); HWND high_spin_wnd = ::GetDlgItem (pane_wnd, IDC_RANGE_HIGH_SPIN); - if (low_spin_wnd != NULL && high_spin_wnd != NULL) { + if (low_spin_wnd != nullptr && high_spin_wnd != nullptr) { // // Peek at the spinner control objects // - ISpinnerControl *low_spin = NULL; - ISpinnerControl *high_spin = NULL; + ISpinnerControl *low_spin = nullptr; + ISpinnerControl *high_spin = nullptr; low_spin = (ISpinnerControl *)::GetProp (low_spin_wnd, "ISpinnerControl"); high_spin = (ISpinnerControl *)::GetProp (high_spin_wnd, "ISpinnerControl"); diff --git a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h index 96fa0d295b6..321fd501e7a 100644 --- a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h +++ b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h @@ -55,7 +55,7 @@ class PresetExportOptionsDialogClass ////////////////////////////////////////////////////////////////// // Public constructors/destructors ////////////////////////////////////////////////////////////////// - PresetExportOptionsDialogClass (Interface *maxinterface, HWND parent_wnd = NULL); + PresetExportOptionsDialogClass (Interface *maxinterface, HWND parent_wnd = nullptr); ~PresetExportOptionsDialogClass (void); diff --git a/Core/Tools/WW3D/max2w3d/rcmenu.cpp b/Core/Tools/WW3D/max2w3d/rcmenu.cpp index 2c8223e5d00..42dc3f852fb 100644 --- a/Core/Tools/WW3D/max2w3d/rcmenu.cpp +++ b/Core/Tools/WW3D/max2w3d/rcmenu.cpp @@ -73,7 +73,7 @@ void RCMenuClass::Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m) /* ** Add the menu separator */ - manager->AddMenu(this, MF_SEPARATOR, MENU_SEPARATOR, NULL); + manager->AddMenu(this, MF_SEPARATOR, MENU_SEPARATOR, nullptr); /* ** Add the Name of the object diff --git a/Core/Tools/WW3D/max2w3d/simpdib.cpp b/Core/Tools/WW3D/max2w3d/simpdib.cpp index 1c06d62cfcc..e90ac377740 100644 --- a/Core/Tools/WW3D/max2w3d/simpdib.cpp +++ b/Core/Tools/WW3D/max2w3d/simpdib.cpp @@ -39,18 +39,18 @@ SimpleDIBClass::SimpleDIBClass(HWND hwnd,int width,int height,PaletteClass & pal): IsZombie(false), - Info(NULL), + Info(nullptr), Handle(0), - Pixels(NULL), + Pixels(nullptr), Width(width), Height(height), - PixelBase(NULL), - Pitch(NULL) + PixelBase(nullptr), + Pitch(nullptr) { // Allocate a BITMAPINFO structure Info = (BITMAPINFO *) new char [sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD)]; - if (Info == NULL) { + if (Info == nullptr) { IsZombie = true; return; } @@ -78,7 +78,7 @@ SimpleDIBClass::SimpleDIBClass(HWND hwnd,int width,int height,PaletteClass & pal // Create the DIB. HDC hdc = GetDC(hwnd); - Handle = CreateDIBSection(hdc, Info, DIB_RGB_COLORS,(void**)&Pixels, NULL, 0); + Handle = CreateDIBSection(hdc, Info, DIB_RGB_COLORS,(void**)&Pixels, nullptr, 0); ReleaseDC(hwnd, hdc); if (!Handle) { diff --git a/Core/Tools/WW3D/max2w3d/skin.cpp b/Core/Tools/WW3D/max2w3d/skin.cpp index 044a219940b..ad43863ff46 100644 --- a/Core/Tools/WW3D/max2w3d/skin.cpp +++ b/Core/Tools/WW3D/max2w3d/skin.cpp @@ -63,13 +63,13 @@ static float Bone_Distance(INode * bone,TimeValue time,const Point3 & vertex); /* ** Static variables */ -HWND SkinWSMObjectClass::SotHWND = NULL; -HWND SkinWSMObjectClass::SkeletonHWND = NULL; -HWND SkinWSMObjectClass::BoneListHWND = NULL; -IObjParam * SkinWSMObjectClass::InterfacePtr = NULL; -ICustButton * SkinWSMObjectClass::AddBonesButton = NULL; -ICustButton * SkinWSMObjectClass::RemoveBonesButton = NULL; -ISpinnerControl * SkinWSMObjectClass::BasePoseSpin = NULL; +HWND SkinWSMObjectClass::SotHWND = nullptr; +HWND SkinWSMObjectClass::SkeletonHWND = nullptr; +HWND SkinWSMObjectClass::BoneListHWND = nullptr; +IObjParam * SkinWSMObjectClass::InterfacePtr = nullptr; +ICustButton * SkinWSMObjectClass::AddBonesButton = nullptr; +ICustButton * SkinWSMObjectClass::RemoveBonesButton = nullptr; +ISpinnerControl * SkinWSMObjectClass::BasePoseSpin = nullptr; /******************************************************************************* @@ -154,23 +154,23 @@ SkinWSMObjectClass::SkinWSMObjectClass() BoneTab.SetCount(0); BasePoseFrame = 0; - pblock = NULL; + pblock = nullptr; } SkinWSMObjectClass::~SkinWSMObjectClass(void) { - assert(!((InterfacePtr == NULL) && (SotHWND != NULL))); - if (SotHWND != NULL) { + assert(!((InterfacePtr == nullptr) && (SotHWND != nullptr))); + if (SotHWND != nullptr) { InterfacePtr->UnRegisterDlgWnd(SotHWND); InterfacePtr->DeleteRollupPage(SotHWND); - SotHWND = NULL; + SotHWND = nullptr; } - assert(!((InterfacePtr == NULL) && (SkeletonHWND != NULL))); - if (SkeletonHWND != NULL) { + assert(!((InterfacePtr == nullptr) && (SkeletonHWND != nullptr))); + if (SkeletonHWND != nullptr) { InterfacePtr->UnRegisterDlgWnd(SkeletonHWND); InterfacePtr->DeleteRollupPage(SkeletonHWND); - SkeletonHWND = NULL; + SkeletonHWND = nullptr; } } @@ -186,7 +186,7 @@ void SkinWSMObjectClass::BeginEditParams(IObjParam *ip, ULONG flags,Animatable /* ** Install the "supports objects of type" rollup */ - if (SotHWND == NULL) { + if (SotHWND == nullptr) { SotHWND = ip->AddRollupPage( AppInstance, MAKEINTRESOURCE(IDD_SKIN_SOT), @@ -201,7 +201,7 @@ void SkinWSMObjectClass::BeginEditParams(IObjParam *ip, ULONG flags,Animatable /* ** Install the skeleton rollup */ - if (SkeletonHWND == NULL) { + if (SkeletonHWND == nullptr) { SkeletonHWND = InterfacePtr->AddRollupPage( AppInstance, MAKEINTRESOURCE(IDD_SKELETON_PARAMETERS), @@ -224,26 +224,26 @@ void SkinWSMObjectClass::EndEditParams(IObjParam *ip, ULONG flags,Animatable *ne /* ** Remove the Sot rollup */ - if (SotHWND != NULL) { + if (SotHWND != nullptr) { InterfacePtr->UnRegisterDlgWnd(SotHWND); InterfacePtr->DeleteRollupPage(SotHWND); - SotHWND = NULL; + SotHWND = nullptr; } /* ** Remove the info rollup */ - if (SkeletonHWND != NULL) { + if (SkeletonHWND != nullptr) { InterfacePtr->UnRegisterDlgWnd(SkeletonHWND); InterfacePtr->DeleteRollupPage(SkeletonHWND); - SkeletonHWND = NULL; + SkeletonHWND = nullptr; } } /* ** get rid of our copy of the interface pointer */ - InterfacePtr = NULL; + InterfacePtr = nullptr; } RefTargetHandle SkinWSMObjectClass::Clone(RemapDir & remap) @@ -312,7 +312,7 @@ CreateMouseCallBack * SkinWSMObjectClass::GetCreateMouseCallBack(void) /* ** The "CreateMouseCallback" is used when creating the ** object. Since our object doesn't need an interactive - ** creation phase, we return NULL. + ** creation phase, we return null. */ return &_SkinCreateCB; } @@ -440,11 +440,11 @@ int SkinWSMObjectClass::Add_Bone(INode * node) } /* - ** Otherwise, look for a NULL bone and we'll re-use + ** Otherwise, look for a nullptr bone and we'll re-use ** its slot. This happens when a user removes a bone or ** a bone in the scene is deleted. */ - boneidx = Find_Bone(NULL); + boneidx = Find_Bone(nullptr); if (boneidx != -1) { refidx = To_Ref_Index(boneidx); MakeRefByID(FOREVER,refidx,node); @@ -476,7 +476,7 @@ void SkinWSMObjectClass::Remove_Bone(INode * node) { int boneidx = Find_Bone(node); if (boneidx != -1) { - BoneTab[boneidx] = NULL; + BoneTab[boneidx] = nullptr; DeleteReference(To_Ref_Index(boneidx)); } } @@ -493,7 +493,7 @@ void SkinWSMObjectClass::Remove_Bones(INodeTab & nodetab) void SkinWSMObjectClass::Update_Bone_List(void) { - assert(BoneListHWND != NULL); + assert(BoneListHWND != nullptr); /* ** remove all strings in the bone listbox @@ -504,7 +504,7 @@ void SkinWSMObjectClass::Update_Bone_List(void) ** loop through the bone tab and add the name of each */ for (int i=0; iGetName()); } } @@ -552,7 +552,7 @@ IOResult SkinWSMObjectClass::Load(ILoad * iload) res = iload->Read(&numbones,sizeof(numbones),&nb); BoneTab.SetCount(numbones); for (int i=0; iDeleteMode(SelectMode); if (SelectMode ) delete SelectMode; - SelectMode = NULL; + SelectMode = nullptr; /* ** Remove the rollup window(s) if needed @@ -702,7 +702,7 @@ void SkinModifierClass::EndEditParams(IObjParam *ip, ULONG flags,Animatable *nex /* ** Make sure we don't hang onto an invalid interface */ - InterfacePtr = NULL; + InterfacePtr = nullptr; } Interval SkinModifierClass::Get_Validity(TimeValue t) @@ -732,7 +732,7 @@ RefTargetHandle SkinModifierClass::GetReference(int i) switch (i) { case OBJ_REF: return WSMObjectRef; case NODE_REF: return WSMNodeRef; - default: return NULL; + default: return nullptr; } } @@ -780,7 +780,7 @@ void SkinModifierClass::ModifyObject(TimeValue t, ModContext & mc, ObjectState * ** If there is no skin data, allocate it ** Also, do an initial auto attach. */ - if (skindata == NULL) { + if (skindata == nullptr) { mc.localData = skindata = new SkinDataClass(&triobj->mesh); } @@ -813,8 +813,8 @@ void SkinModifierClass::ModifyObject(TimeValue t, ModContext & mc, ObjectState * // TODO: Allow multiple bone influences here... // issues - UI to set the weights, rebalance weights whenever - // a bone is deleted, should also then never get NULL bones - // and remove the need to check for NULL bones in this routine... + // a bone is deleted, should also then never get nullptr bones + // and remove the need to check for nullptr bones in this routine... /* ** Get a pointer to the bone that this vertex is attached to @@ -826,7 +826,7 @@ void SkinModifierClass::ModifyObject(TimeValue t, ModContext & mc, ObjectState * INode * bone = WSMObjectRef->Get_Bone(inf->BoneIdx[0]); - if (bone == NULL) { + if (bone == nullptr) { /* ** this bone has gone away for some reason so ** clear this vert's bone influence index @@ -932,7 +932,7 @@ IOResult SkinModifierClass::LoadLocalData(ILoad *iload, LocalModData **pld) /* ** Create a new SkinDataClass */ - if (*pld==NULL) { + if (*pld==nullptr) { *pld = (SkinDataClass *) new SkinDataClass(); } SkinDataClass * newskin = (SkinDataClass *)*pld; @@ -961,7 +961,7 @@ void SkinModifierClass::ActivateSubobjSel(int level, XFormModes & modes) break; case VERTEX_SEL_LEVEL: // Modifying Vertices - modes = XFormModes(NULL,NULL,NULL,NULL,NULL,SelectMode); + modes = XFormModes(nullptr,nullptr,nullptr,nullptr,nullptr,SelectMode); Install_Bone_Influence_Dialog(); break; } @@ -1048,7 +1048,7 @@ int SkinModifierClass::HitTest ** Remember that we are always turning on vertex hit testing; ** if we were testing for edges, index would be the edge index. */ - vpt->LogHit(inode,mc,rec->dist,rec->index,NULL); + vpt->LogHit(inode,mc,rec->dist,rec->index,nullptr); rec = rec->Next(); } @@ -1066,7 +1066,7 @@ int SkinModifierClass::HitTest void SkinModifierClass::SelectSubComponent(HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert) { - SkinDataClass * skindata = NULL; + SkinDataClass * skindata = nullptr; int count = 0; switch (SubObjSelLevel) { @@ -1129,7 +1129,7 @@ void SkinModifierClass::ClearSelection(int selLevel) SkinDataClass * skindata = (SkinDataClass *)mcList[i]->localData; - if (skindata==NULL) continue; + if (skindata==nullptr) continue; ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime()); TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel); @@ -1185,7 +1185,7 @@ void SkinModifierClass::SelectAll(int selLevel) SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData; - if (skindata==NULL) continue; + if (skindata==nullptr) continue; ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime()); TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel); @@ -1239,7 +1239,7 @@ void SkinModifierClass::InvertSelection(int selLevel) SkinDataClass * skindata = (SkinDataClass *)mclist[i]->localData; - if (skindata==NULL) continue; + if (skindata==nullptr) continue; ObjectState os = nodes[i]->EvalWorldState(InterfacePtr->GetTime()); TriObject * tobj = Get_Tri_Object(InterfacePtr->GetTime(),os,valid,needsdel); @@ -1283,13 +1283,13 @@ void SkinModifierClass::InvertSelection(int selLevel) void SkinModifierClass::User_Picked_Bone(INode * node) { - assert(InterfacePtr != NULL); + assert(InterfacePtr != nullptr); /* ** Get a pointer to the ModContext and SkinData for ** the mesh currently being messed with. */ - ModContext * mc = NULL; + ModContext * mc = nullptr; ModContextList mclist; INodeTab nodelist; @@ -1302,7 +1302,7 @@ void SkinModifierClass::User_Picked_Bone(INode * node) ** don't */ mc = mclist[0]; - assert(mc != NULL); + assert(mc != nullptr); SkinDataClass * skindata = (SkinDataClass *)(mc->localData); /* @@ -1340,7 +1340,7 @@ void SkinModifierClass::ActivateSubSelSet(TSTR & setname) ModContextList mclist; INodeTab nodes; - if (InterfacePtr == NULL) return; + if (InterfacePtr == nullptr) return; InterfacePtr->GetModContexts(mclist,nodes); @@ -1398,16 +1398,16 @@ void SkinModifierClass::Create_Named_Selection_Sets(void) ** This function creates a named selection set of vertices ** for each bone in the skeleton. */ - if (InterfacePtr == NULL) return; + if (InterfacePtr == nullptr) return; SkinWSMObjectClass * skinobj = WSMObjectRef; - if (skinobj == NULL) return; + if (skinobj == nullptr) return; ModContextList mclist; INodeTab nodes; InterfacePtr->GetModContexts(mclist,nodes); SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData; - if (skindata == NULL) return; + if (skindata == nullptr) return; /* ** Clear out the old selection sets @@ -1419,7 +1419,7 @@ void SkinModifierClass::Create_Named_Selection_Sets(void) */ for (int boneidx = 0; boneidx < skinobj->Num_Bones(); boneidx++) { - if (skinobj->Get_Bone(boneidx) != NULL) { + if (skinobj->Get_Bone(boneidx) != nullptr) { BitArray boneverts; boneverts.SetSize(skindata->VertData.Count()); @@ -1445,13 +1445,13 @@ void SkinModifierClass::Install_Named_Selection_Sets(void) ** If we are in sub-object selection mode add the sets ** to the drop down box. */ - if ((SubObjSelLevel == VERTEX_SEL_LEVEL) && (InterfacePtr != NULL)) { + if ((SubObjSelLevel == VERTEX_SEL_LEVEL) && (InterfacePtr != nullptr)) { ModContextList mclist; INodeTab nodes; InterfacePtr->GetModContexts(mclist,nodes); SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData; - if (skindata == NULL) return; + if (skindata == nullptr) return; InterfacePtr->ClearSubObjectNamedSelSets(); for (int i=0; i < skindata->VertSelSets.Count(); i++) { @@ -1473,13 +1473,13 @@ void SkinModifierClass::Auto_Attach_Verts(BOOL all) INodeTab nodes; InterfacePtr->GetModContexts(mclist,nodes); SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData; - if (skindata == NULL) return; + if (skindata == nullptr) return; /* ** get the skin WSM object. */ SkinWSMObjectClass * skinobj = WSMObjectRef; - if (skinobj == NULL) return; + if (skinobj == nullptr) return; /* ** Get a triobject representing the object state in the base pose. @@ -1536,7 +1536,7 @@ void SkinModifierClass::Unlink_Verts(void) INodeTab nodes; InterfacePtr->GetModContexts(mclist,nodes); SkinDataClass * skindata = (SkinDataClass *)mclist[0]->localData; - if (skindata == NULL) return; + if (skindata == nullptr) return; /* ** Unlink each selected vertex (give them bone index -1) @@ -1573,7 +1573,7 @@ void SkinModifierClass::Unlink_Verts(void) void SkinModifierClass::Install_Bone_Influence_Dialog(void) { - if (BoneInfluenceHWND != NULL) return; + if (BoneInfluenceHWND != nullptr) return; /* ** loading resource string for the name of the dialog @@ -1603,10 +1603,10 @@ void SkinModifierClass::Remove_Bone_Influence_Dialog(void) /* ** If it is currently up, remove the bone influences dialog */ - if (BoneInfluenceHWND != NULL) { + if (BoneInfluenceHWND != nullptr) { InterfacePtr->UnRegisterDlgWnd(BoneInfluenceHWND); InterfacePtr->DeleteRollupPage(BoneInfluenceHWND); - BoneInfluenceHWND = NULL; + BoneInfluenceHWND = nullptr; } } @@ -1692,10 +1692,10 @@ BOOL SkinWSMObjectClass::Skeleton_Dialog_Proc(HWND hWnd,UINT message,WPARAM wPar ReleaseICustButton(RemoveBonesButton); ReleaseISpinner(BasePoseSpin); - AddBonesButton = NULL; - RemoveBonesButton = NULL; - BasePoseSpin = NULL; - BoneListHWND = NULL; + AddBonesButton = nullptr; + RemoveBonesButton = nullptr; + BasePoseSpin = nullptr; + BoneListHWND = nullptr; return FALSE; @@ -1798,10 +1798,10 @@ BOOL SkinModifierClass::Bone_Influence_Dialog_Proc(HWND hWnd,UINT message,WPARAM ReleaseICustButton(AutoLinkButton); ReleaseICustButton(UnLinkButton); - LinkButton = NULL; - LinkByNameButton = NULL; - AutoLinkButton = NULL; - UnLinkButton = NULL; + LinkButton = nullptr; + LinkByNameButton = nullptr; + AutoLinkButton = nullptr; + UnLinkButton = nullptr; return FALSE; case WM_LBUTTONDOWN: @@ -1818,7 +1818,7 @@ BOOL SkinModifierClass::Bone_Influence_Dialog_Proc(HWND hWnd,UINT message,WPARAM /* ** user picks a bone out of the scene to link to. */ - assert(WSMObjectRef != NULL); + assert(WSMObjectRef != nullptr); INodeTab * bonetab = &(WSMObjectRef->Get_Bone_List()); TheBonePicker.Set_User(this,TRUE,bonetab); InterfacePtr->SetPickMode(&TheBonePicker); @@ -1830,7 +1830,7 @@ BOOL SkinModifierClass::Bone_Influence_Dialog_Proc(HWND hWnd,UINT message,WPARAM /* ** pop up a bone selection dialog */ - assert(WSMObjectRef != NULL); + assert(WSMObjectRef != nullptr); INodeTab * bonetab = &(WSMObjectRef->Get_Bone_List()); TheBonePicker.Set_User(this,TRUE,bonetab); InterfacePtr->DoHitByNameDialog(&TheBonePicker); @@ -1870,7 +1870,7 @@ static TriObject * Get_Tri_Object(TimeValue t,ObjectState & os,Interval & valid, return tobj; } } - return NULL; + return nullptr; } diff --git a/Core/Tools/WW3D/max2w3d/skin.h b/Core/Tools/WW3D/max2w3d/skin.h index ff5f7baf2a6..afc1fc941d9 100644 --- a/Core/Tools/WW3D/max2w3d/skin.h +++ b/Core/Tools/WW3D/max2w3d/skin.h @@ -237,7 +237,7 @@ class SkinModifierClass : public Modifier, BonePickerUserClass RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message); void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev); void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next); - CreateMouseCallBack * GetCreateMouseCallBack() { return NULL; } + CreateMouseCallBack * GetCreateMouseCallBack() { return nullptr; } /* ** From Reference Maker. These three functions give access to the "virtual array" of references. diff --git a/Core/Tools/WW3D/max2w3d/util.cpp b/Core/Tools/WW3D/max2w3d/util.cpp index d5946a9ea43..7877a9620fb 100644 --- a/Core/Tools/WW3D/max2w3d/util.cpp +++ b/Core/Tools/WW3D/max2w3d/util.cpp @@ -57,7 +57,7 @@ static char _string[256]; static int get_geometry_type(INode * node) { - assert(node != NULL); + assert(node != nullptr); return W3DAppData2Struct::Get_App_Data(node)->Get_Geometry_Type(); //return (get_w3d_bits(node) & GEO_TYPE_MASK); @@ -151,9 +151,9 @@ void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * se assert(strlen(name) < MAX_NODE_NAME_LEN); // Initialize - if (set_base != NULL) set_base[0] = 0; - if (set_exten != NULL) set_exten[0] = 0; - if (set_exten_index != NULL) *set_exten_index = 0; + if (set_base != nullptr) set_base[0] = 0; + if (set_exten != nullptr) set_exten[0] = 0; + if (set_exten_index != nullptr) *set_exten_index = 0; // Get the base name strncpy(buf,name,MAX_NODE_NAME_LEN); @@ -166,20 +166,20 @@ void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * se // copy what we have so far into set_base *ptr = 0; - if (set_base != NULL) strncpy(set_base,buf,MAX_NODE_NAME_LEN); + if (set_base != nullptr) strncpy(set_base,buf,MAX_NODE_NAME_LEN); // copy the rest back into the extension ptr++; - if (set_exten != NULL) strncpy(set_exten,ptr,MAX_NODE_NAME_LEN); + if (set_exten != nullptr) strncpy(set_exten,ptr,MAX_NODE_NAME_LEN); // now get the extension index ptr++; - if (set_exten_index != NULL) *set_exten_index = atoi(ptr); + if (set_exten_index != nullptr) *set_exten_index = atoi(ptr); } else { // no extension, just copy the base name - if (set_base != NULL) strncpy(set_base,buf,MAX_NODE_NAME_LEN); + if (set_base != nullptr) strncpy(set_base,buf,MAX_NODE_NAME_LEN); return; } } @@ -187,7 +187,7 @@ void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * se bool Append_Lod_Character (char *meshname, int lod_level, INodeListClass *origin_list) { - if (meshname == NULL || lod_level < 0) + if (meshname == nullptr || lod_level < 0) return false; if (!origin_list) @@ -200,7 +200,7 @@ bool Append_Lod_Character (char *meshname, int lod_level, INodeListClass *origin ** If there is, we will append the current LOD level digit to the name. ** If there is not, the name will not be modified. */ - INode *conflict = NULL, *cur_origin = NULL; + INode *conflict = nullptr, *cur_origin = nullptr; int i, lod; for (i = 0; i < num_lods; i++) { @@ -253,10 +253,10 @@ void Create_Full_Path(char *full_path, const char *curr, const char *rel_path) // Copy current dir to full path. If it doesn't end with a slash, add one. strcpy(full_path, curr); int curr_len = strlen(curr); - char *full_p = full_path + curr_len; // Point at the terminating NULL + char *full_p = full_path + curr_len; // Point at the terminating nullptr if (curr_len == 0 ||(*(full_p - 1) != '/' && *(full_p - 1) != '\\')) { *full_p = '\\'; - *(++full_p) = '\000'; // Point at the terminating NULL + *(++full_p) = '\000'; // Point at the terminating nullptr } // Scan "..\"s at the beginning of the rel path, scan backwards on the @@ -312,7 +312,7 @@ void Create_Relative_Path(char *rel_path, const char *curr, const char *full_pat goto end; } - // The first different character for each string can be: a NULL, a slash, + // The first different character for each string can be: a nullptr, a slash, // or an ordinary character. PathCharType full_type, curr_type; if (*full_p == '\000') { @@ -333,14 +333,14 @@ void Create_Relative_Path(char *rel_path, const char *curr, const char *full_pat curr_type = PLAIN_CHAR; } } - // If the last fullpath char is a NULL or both are slashes, we have an + // If the last fullpath char is a nullptr or both are slashes, we have an // error - return full path if (full_type == NULL_CHAR || (full_type == SLASH_CHAR && curr_type == SLASH_CHAR)) { strcpy(rel_path, up_full); goto end; } - // If the current path has ended (last char is a NULL) and the full path's + // If the current path has ended (last char is a nullptr) and the full path's // last char is a slash, then just copy the remainder of the full path // (w/o the slash) to the relative path, and exit. if (curr_type == NULL_CHAR && full_type == SLASH_CHAR) { @@ -351,7 +351,7 @@ void Create_Relative_Path(char *rel_path, const char *curr, const char *full_pat // If one of following holds: // 1) One of the last chars is a slash and the other is a plain char - // 2) The current path has ended (last char is NULL) and the last char + // 2) The current path has ended (last char is nullptr) and the last char // of the full path is a plain char // 3) The last char of both are plain chars and the previous char is not a // slash @@ -410,7 +410,7 @@ void Create_Relative_Path(char *rel_path, const char *curr, const char *full_pat bool Is_Full_Path(char * path) { // first scan for a drive letter (scan for a colon) - if (strchr(path,':') != NULL) { + if (strchr(path,':') != nullptr) { return true; } @@ -452,7 +452,7 @@ bool Is_Max_Tri_Mesh(INode * node) bool Is_Damage_Root(INode *node) { - if (node == NULL) + if (node == nullptr) return false; // Is the node's parent the scene root? @@ -584,11 +584,11 @@ int Get_Damage_State(INode *node) INode *Find_Named_Node(char *nodename, INode *root) { if (!root || !nodename) - return NULL; + return nullptr; // Perform a breadth-first search of the tree for a node // of the given name. - INode *child = NULL; + INode *child = nullptr; int i; char cur_name[W3D_NAME_LEN]; @@ -617,6 +617,6 @@ INode *Find_Named_Node(char *nodename, INode *root) } // Didn't find the node anywhere. - return NULL; + return nullptr; } diff --git a/Core/Tools/WW3D/max2w3d/util.h b/Core/Tools/WW3D/max2w3d/util.h index b90567e5aa8..bbeeab83597 100644 --- a/Core/Tools/WW3D/max2w3d/util.h +++ b/Core/Tools/WW3D/max2w3d/util.h @@ -102,11 +102,11 @@ INode *Find_Named_Node (char *nodename, INode *root); #define SAFE_DELETE(pobject) \ if (pobject) { \ delete pobject; \ - pobject = NULL; \ + pobject = nullptr; \ } #define SAFE_DELETE_ARRAY(pobject) \ if (pobject) { \ delete [] pobject; \ - pobject = NULL; \ + pobject = nullptr; \ } diff --git a/Core/Tools/WW3D/max2w3d/vchannel.cpp b/Core/Tools/WW3D/max2w3d/vchannel.cpp index 8392aaded4c..f0f9fe61a9c 100644 --- a/Core/Tools/WW3D/max2w3d/vchannel.cpp +++ b/Core/Tools/WW3D/max2w3d/vchannel.cpp @@ -85,8 +85,8 @@ VectorChannelClass::VectorChannelClass MaxFrames(maxframes), VectorLen(vectorlength), IsEmpty(true), - IdentVect(NULL), - Data(NULL), + IdentVect(nullptr), + Data(nullptr), Begin(0), End(0), ReduceAnimation(false), @@ -173,7 +173,7 @@ bool VectorChannelClass::SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass * W3dTimeCodedAnimChannelStruct * chn = (W3dTimeCodedAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -240,7 +240,7 @@ bool VectorChannelClass::SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass * return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -439,7 +439,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla W3dAdaptiveDeltaAnimChannelStruct * chn = (W3dAdaptiveDeltaAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -563,7 +563,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -629,7 +629,7 @@ bool VectorChannelClass::Save(ChunkSaveClass & csave, BitChannelClass *binmov) W3dAnimChannelStruct * chn = (W3dAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -652,7 +652,7 @@ bool VectorChannelClass::Save(ChunkSaveClass & csave, BitChannelClass *binmov) return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } diff --git a/Core/Tools/WW3D/max2w3d/vxl.cpp b/Core/Tools/WW3D/max2w3d/vxl.cpp index 969095a7b2d..1a0b35d4622 100644 --- a/Core/Tools/WW3D/max2w3d/vxl.cpp +++ b/Core/Tools/WW3D/max2w3d/vxl.cpp @@ -96,7 +96,7 @@ VoxelClass::VoxelClass // Allocate visibility flags array VisData = new uint8[XDim * YDim * ZDim]; - if (VisData == NULL) { + if (VisData == nullptr) { throw ErrorClass("out of memory!"); } @@ -163,7 +163,7 @@ VoxelClass::VoxelClass ************************************************************************/ VoxelClass::~VoxelClass() { - if (VisData != NULL) delete[] VisData; + if (VisData != nullptr) delete[] VisData; } diff --git a/Core/Tools/WW3D/max2w3d/vxldbg.cpp b/Core/Tools/WW3D/max2w3d/vxldbg.cpp index bbe844fa81d..a6c405c00a4 100644 --- a/Core/Tools/WW3D/max2w3d/vxldbg.cpp +++ b/Core/Tools/WW3D/max2w3d/vxldbg.cpp @@ -49,11 +49,11 @@ static PaletteClass _VoxelPalette; VoxelDebugWindowClass::VoxelDebugWindowClass(VoxelClass * vxl) : CurLayer(0), - Bitmap(NULL), + Bitmap(nullptr), Voxel(vxl), WindowHWND(0), ViewportHWND(0), - LayerSpin(NULL) + LayerSpin(nullptr) { _VoxelPalette[0] = RGBClass(0,0,0); _VoxelPalette[1] = RGBClass(128,255,128); @@ -70,7 +70,7 @@ void VoxelDebugWindowClass::Display_Window(void) ( AppInstance, MAKEINTRESOURCE (IDD_VOXEL_DEBUG_DIALOG), - NULL, + nullptr, (DLGPROC) _dialog_proc, (LPARAM) this ); @@ -120,7 +120,7 @@ bool VoxelDebugWindowClass::Dialog_Proc update_display(); - SetCursor(LoadCursor (NULL, IDC_ARROW)); + SetCursor(LoadCursor (nullptr, IDC_ARROW)); return 1; @@ -137,7 +137,7 @@ bool VoxelDebugWindowClass::Dialog_Proc case IDOK: // done! - SetCursor(LoadCursor (NULL, IDC_WAIT)); + SetCursor(LoadCursor (nullptr, IDC_WAIT)); EndDialog(hWnd, 1); break; } @@ -187,7 +187,7 @@ void VoxelDebugWindowClass::update_display(void) /* ** Bail out if everything isn't right */ - if ((Bitmap == NULL) || (Voxel == NULL)) { + if ((Bitmap == nullptr) || (Voxel == nullptr)) { return; } @@ -241,7 +241,7 @@ BOOL CALLBACK _dialog_proc LPARAM lParam ) { - static VoxelDebugWindowClass * window = NULL; + static VoxelDebugWindowClass * window = nullptr; if (message == WM_INITDIALOG) { window = (VoxelDebugWindowClass *) lParam; diff --git a/Core/Tools/WW3D/max2w3d/w3d_file.h b/Core/Tools/WW3D/max2w3d/w3d_file.h index 06e474e83af..5ce8ac79cf2 100644 --- a/Core/Tools/WW3D/max2w3d/w3d_file.h +++ b/Core/Tools/WW3D/max2w3d/w3d_file.h @@ -46,10 +46,10 @@ NAMING CONVENTIONS: - Typical render object name is 15 characters + NULL - Meshes have 31 + NULL character name formed from the concatenation of the "container" + Typical render object name is 15 characters + null terminator + Meshes have 31 + null terminator character name formed from the concatenation of the "container" model name and the mesh's name: "ContainerName.MeshName" - Animations have 31 + NULL character names formed from the concatenation of the Hierarchy tree + Animations have 31 + null terminator character names formed from the concatenation of the Hierarchy tree name with the animation name: "AnimationName.HierarchyName" Textures have unlimited name length. Typically you can determine which 'W3D' file a render object came from by looking @@ -352,14 +352,14 @@ enum { W3D_CHUNK_VERTEX_MATERIALS =0x0000002A, // wraps the vertex materials W3D_CHUNK_VERTEX_MATERIAL =0x0000002B, - W3D_CHUNK_VERTEX_MATERIAL_NAME =0x0000002C, // vertex material name (NULL-terminated string) + W3D_CHUNK_VERTEX_MATERIAL_NAME =0x0000002C, // vertex material name (null-terminated string) W3D_CHUNK_VERTEX_MATERIAL_INFO =0x0000002D, // W3dVertexMaterialStruct W3D_CHUNK_VERTEX_MAPPER_ARGS0 =0x0000002E, // Null-terminated string W3D_CHUNK_VERTEX_MAPPER_ARGS1 =0x0000002F, // Null-terminated string W3D_CHUNK_TEXTURES =0x00000030, // wraps all of the texture info W3D_CHUNK_TEXTURE =0x00000031, // wraps a texture definition - W3D_CHUNK_TEXTURE_NAME =0x00000032, // texture filename (NULL-terminated string) + W3D_CHUNK_TEXTURE_NAME =0x00000032, // texture filename (null-terminated string) W3D_CHUNK_TEXTURE_INFO =0x00000033, // optional W3dTextureInfoStruct W3D_CHUNK_MATERIAL_PASS =0x00000038, // wraps the information for a single material pass @@ -466,7 +466,7 @@ enum { W3D_CHUNK_SPHERE, W3D_CHUNK_RING, - W3D_CHUNK_NULL_OBJECT =0x00000750, // defines a NULL object (W3dNullObjectStruct) + W3D_CHUNK_NULL_OBJECT =0x00000750, // defines a null object (W3dNullObjectStruct) W3D_CHUNK_LIGHTSCAPE =0x00000800, // wrapper for lights created with Lightscape. W3D_CHUNK_LIGHTSCAPE_LIGHT, // definition of a light created with Lightscape. @@ -2006,7 +2006,7 @@ struct W3dBoxStruct /******************************************************************************** - NULL Objects + Null Objects Null objects are used by the LOD system to make meshes dissappear at lower levels of detail. diff --git a/Core/Tools/WW3D/max2w3d/w3d_obsolete.h b/Core/Tools/WW3D/max2w3d/w3d_obsolete.h index 6d36fd2ac2b..d9b6c901ea0 100644 --- a/Core/Tools/WW3D/max2w3d/w3d_obsolete.h +++ b/Core/Tools/WW3D/max2w3d/w3d_obsolete.h @@ -80,9 +80,9 @@ enum ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterialStruct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; @@ -94,9 +94,9 @@ struct W3dMaterialStruct ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterial2Struct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; diff --git a/Core/Tools/WW3D/max2w3d/w3dappdata.cpp b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp index 5800a967a90..5c544a7512d 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp @@ -213,7 +213,7 @@ W3DAppData2Struct * W3DAppData2Struct::Get_App_Data /* ** Try to get our AppData which has the export flags */ - W3DAppData2Struct * wdata = NULL; + W3DAppData2Struct * wdata = nullptr; AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,W3D_APPDATA_2); /* @@ -294,7 +294,7 @@ W3DDazzleAppDataStruct * W3DDazzleAppDataStruct::Get_App_Data(INode * node,bool /* ** Try to get the existing AppData chunk */ - W3DDazzleAppDataStruct * dazzledata = NULL; + W3DDazzleAppDataStruct * dazzledata = nullptr; AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,W3D_DAZZLE_APPDATA); if (appdata) { @@ -330,7 +330,7 @@ W3DDazzleAppDataStruct * W3DDazzleAppDataStruct::Get_App_Data(INode * node,bool static int get_geometry_type(INode * node) { - assert(node != NULL); + assert(node != nullptr); return W3DAppData2Struct::Get_App_Data(node)->Get_Geometry_Type(); } @@ -489,10 +489,10 @@ bool Is_Skin(INode * node) ReferenceTarget *refTarg = node->GetReference(i); - if (refTarg != NULL && refTarg->ClassID() == Class_ID(WSM_DERIVOB_CLASS_ID,0)) { + if (refTarg != nullptr && refTarg->ClassID() == Class_ID(WSM_DERIVOB_CLASS_ID,0)) { IDerivedObject * wsm_der_obj = (IDerivedObject *)refTarg; - //MessageBox(NULL, "WSM found", _T("WSM"), MB_OK); + //MessageBox(nullptr, "WSM found", _T("WSM"), MB_OK); for (int j = 0; j < wsm_der_obj->NumModifiers(); j++) { Modifier * mod = wsm_der_obj->GetModifier(j); diff --git a/Core/Tools/WW3D/max2w3d/w3dappdata.h b/Core/Tools/WW3D/max2w3d/w3dappdata.h index a79acf429ac..2ddbc3d0d9b 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.h +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.h @@ -118,7 +118,7 @@ bool Is_NPatchable(INode * node); */ inline bool Is_Proxy(INode &node) { - return (::strchr (node.GetName (), '~') != NULL); + return (::strchr (node.GetName (), '~') != nullptr); } diff --git a/Core/Tools/WW3D/max2w3d/w3ddlg.cpp b/Core/Tools/WW3D/max2w3d/w3ddlg.cpp index 081f736e44a..47a96169d22 100644 --- a/Core/Tools/WW3D/max2w3d/w3ddlg.cpp +++ b/Core/Tools/WW3D/max2w3d/w3ddlg.cpp @@ -80,8 +80,8 @@ W3dOptionsDialogClass::W3dOptionsDialogClass(Interface * maxinterface,ExpInterfa if (!_OfnInited) _init_ofn(); GotHierarchyFilename = false; - RangeLowSpin = NULL; - RangeHighSpin = NULL; + RangeLowSpin = nullptr; + RangeHighSpin = nullptr; GetMasterUnitInfo(&UnitsType, &UnitsScale); } @@ -171,7 +171,7 @@ bool W3dOptionsDialogClass::Dialog_Proc return 1; } - SetCursor(LoadCursor (NULL, IDC_WAIT)); + SetCursor(LoadCursor (nullptr, IDC_WAIT)); EndDialog(Hwnd, 1); break; @@ -211,7 +211,7 @@ bool W3dOptionsDialogClass::Dialog_Proc // use the open file common dialog to get a hierarchy filename. _HierarchyFileOFN.hwndOwner = Hwnd; - _HierarchyFileOFN.lpstrFileTitle = NULL; + _HierarchyFileOFN.lpstrFileTitle = nullptr; _HierarchyFileOFN.lpstrFile = Options->HierarchyFilename; if (GetOpenFileName(&_HierarchyFileOFN)) { @@ -234,7 +234,7 @@ bool W3dOptionsDialogClass::Dialog_Proc SetSaveRequiredFlag(true); } - _HierarchyFileOFN.lpstrFile = NULL; + _HierarchyFileOFN.lpstrFile = nullptr; break; } return 1; @@ -272,7 +272,7 @@ bool W3dOptionsDialogClass::Dialog_Proc void W3dOptionsDialogClass::Dialog_Init() { CenterWindow(Hwnd, GetParent(Hwnd)); - SetCursor(LoadCursor (NULL, IDC_ARROW)); + SetCursor(LoadCursor (nullptr, IDC_ARROW)); // initialize the export radio buttons if (Options->ExportHierarchy) { @@ -766,7 +766,7 @@ BOOL CALLBACK _options_dialog_proc LPARAM lParam ) { - static W3dOptionsDialogClass * optdialog = NULL; + static W3dOptionsDialogClass * optdialog = nullptr; if (message == WM_INITDIALOG) { optdialog = (W3dOptionsDialogClass *) lParam; @@ -798,25 +798,25 @@ void _init_ofn(void) static char _szhierarchyfilter[] = "W3D Files (*.W3D)\0*.W3D\0WHT Files (*.WHT)\0*.WHT\0\0"; _HierarchyFileOFN.lStructSize = sizeof(OPENFILENAME); - _HierarchyFileOFN.hwndOwner = NULL; - _HierarchyFileOFN.hInstance = NULL; + _HierarchyFileOFN.hwndOwner = nullptr; + _HierarchyFileOFN.hInstance = nullptr; _HierarchyFileOFN.lpstrFilter = _szhierarchyfilter; - _HierarchyFileOFN.lpstrCustomFilter = NULL; + _HierarchyFileOFN.lpstrCustomFilter = nullptr; _HierarchyFileOFN.nMaxCustFilter = 0; _HierarchyFileOFN.nFilterIndex = 0; - _HierarchyFileOFN.lpstrFile = NULL; + _HierarchyFileOFN.lpstrFile = nullptr; _HierarchyFileOFN.nMaxFile = _MAX_PATH; - _HierarchyFileOFN.lpstrFileTitle = NULL; + _HierarchyFileOFN.lpstrFileTitle = nullptr; _HierarchyFileOFN.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - _HierarchyFileOFN.lpstrInitialDir = NULL; - _HierarchyFileOFN.lpstrTitle = NULL; + _HierarchyFileOFN.lpstrInitialDir = nullptr; + _HierarchyFileOFN.lpstrTitle = nullptr; _HierarchyFileOFN.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; _HierarchyFileOFN.nFileOffset = 0; _HierarchyFileOFN.nFileExtension = 0; _HierarchyFileOFN.lpstrDefExt = "wht"; _HierarchyFileOFN.lCustData = 0L; - _HierarchyFileOFN.lpfnHook = NULL; - _HierarchyFileOFN.lpTemplateName = NULL; + _HierarchyFileOFN.lpfnHook = nullptr; + _HierarchyFileOFN.lpTemplateName = nullptr; _OfnInited = true; } diff --git a/Core/Tools/WW3D/max2w3d/w3dexp.cpp b/Core/Tools/WW3D/max2w3d/w3dexp.cpp index b1ade39381f..5b1a4867b04 100644 --- a/Core/Tools/WW3D/max2w3d/w3dexp.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dexp.cpp @@ -225,10 +225,10 @@ int W3dExportClass::DoExport { ExportInterface = do_export; MaxInterface = max; - RootNode = NULL; - OriginList = NULL; - DamageRootList = NULL; - HierarchyTree = NULL; + RootNode = nullptr; + OriginList = nullptr; + DamageRootList = nullptr; + HierarchyTree = nullptr; try { @@ -243,7 +243,7 @@ int W3dExportClass::DoExport char rootname[_MAX_FNAME + 1]; char drivename[_MAX_DRIVE + 1]; char dirname[_MAX_DIR + 1]; - _splitpath(filename, drivename, dirname, rootname, NULL); + _splitpath(filename, drivename, dirname, rootname, nullptr); sprintf(CurrentExportPath, "%s%s", drivename, dirname); /* @@ -251,7 +251,7 @@ int W3dExportClass::DoExport ** MAX file being exported. This is so that it can use the old relative pathname of the ** W3D file containing the hierarchy. */ - _splitpath(max->GetCurFilePath(), drivename, dirname, NULL, NULL); + _splitpath(max->GetCurFilePath(), drivename, dirname, nullptr, nullptr); sprintf(CurrentScenePath, "%s%s", drivename, dirname); /* @@ -271,7 +271,7 @@ int W3dExportClass::DoExport /* ** Initialize the logging system */ - ExportLog::Init(NULL); + ExportLog::Init(nullptr); /* ** Create a chunk saver to write the w3d file with @@ -279,7 +279,7 @@ int W3dExportClass::DoExport RawFileClass stream(filename); if (!stream.Open(FileClass::WRITE)) { - MessageBox(NULL,"Unable to open file.","Error",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,"Unable to open file.","Error",MB_OK | MB_SETFOREGROUND); return 1; } @@ -301,24 +301,24 @@ int W3dExportClass::DoExport */ stream.Close(); - if (HierarchyTree != NULL) { + if (HierarchyTree != nullptr) { delete HierarchyTree; - HierarchyTree = NULL; + HierarchyTree = nullptr; } - if (OriginList != NULL) { + if (OriginList != nullptr) { delete OriginList; - OriginList = NULL; + OriginList = nullptr; } - if (DamageRootList != NULL) { + if (DamageRootList != nullptr) { delete DamageRootList; - DamageRootList = NULL; + DamageRootList = nullptr; } } catch (ErrorClass error) { - MessageBox(NULL,error.error_message,"Error",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,error.error_message,"Error",MB_OK | MB_SETFOREGROUND); } ExportLog::Shutdown(ExportOptions.ReviewLog); @@ -350,7 +350,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) ** Build the damage root list. */ INodeListClass *damage_list = get_damage_root_list(); - assert(damage_list != NULL); + assert(damage_list != nullptr); /* ** Start the progress meter @@ -372,7 +372,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) bool is_base_object = false; INodeListClass *origin_list = get_origin_list(); unsigned int i, count = origin_list->Num_Nodes(); - INode *base_origin = NULL; + INode *base_origin = nullptr; for (i = 0; i < count; i++) { @@ -390,7 +390,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) Progress_Meter_Class treemeter(meter, meter.Increment); if (!Export_Hierarchy(rootname, csave, treemeter, base_origin)) { - MessageBox(NULL,"Hierarchy Export Failure!","Error",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,"Hierarchy Export Failure!","Error",MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -404,7 +404,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) Progress_Meter_Class animmeter(meter, meter.Increment); if (!Export_Animation(rootname, csave, animmeter, base_origin)) { - MessageBox(NULL,"Animation Export Failure!","Error",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,"Animation Export Failure!","Error",MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -420,7 +420,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) { if (!Export_Damage_Animations(rootname, csave, damagemeter, (*damage_list)[i])) { - MessageBox(NULL, "Damage Animation Export Failure!", "Error", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, "Damage Animation Export Failure!", "Error", MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -436,7 +436,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) MeshConnectionsClass **connections = new MeshConnectionsClass*[count]; if (!connections) { - MessageBox(NULL, "Memory allocation failure!", "Error", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, "Memory allocation failure!", "Error", MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -466,11 +466,11 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) /* ** Write each mesh (if needed) */ - MeshConnectionsClass *meshcon = NULL; + MeshConnectionsClass *meshcon = nullptr; Progress_Meter_Class meshmeter(meter, meter.Increment); if (!Export_Geometry(rootname, csave, meshmeter, origin, &meshcon)) { - MessageBox(NULL, "Geometry Export Failure!", "Error", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, "Geometry Export Failure!", "Error", MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -481,14 +481,14 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) ** the array in order of LOD (top-level last). */ int lod_level = Get_Lod_Level(origin); - if (lod_level >= count || connections[count - lod_level - 1] != NULL) + if (lod_level >= count || connections[count - lod_level - 1] != nullptr) { char text[256]; sprintf(text, "Origin Naming Error! There are %d models defined in this " "scene, therefore your origin names should be\n\"Origin.00\" through " "\"Origin.%02d\", 00 being the high-poly model and %02d being the " "lowest detail LOD.", count, count-1, count-1); - MessageBox(NULL, text, "Error", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, text, "Error", MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -506,7 +506,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) Progress_Meter_Class hlod_meter(meter, meter.Increment); if (!Export_HLod(rootname, htree->Get_Name(), csave, hlod_meter, connections, count)) { - MessageBox(NULL, "HLOD Generation Failure!", "Error", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, "HLOD Generation Failure!", "Error", MB_OK | MB_SETFOREGROUND); End_Progress_Bar(); return; } @@ -519,7 +519,7 @@ void W3dExportClass::DoOriginBasedExport(char *rootname,ChunkSaveClass &csave) */ for (i = 0; i < count; i++) { - if (connections[i] != NULL) + if (connections[i] != nullptr) delete connections[i]; } delete []connections; @@ -549,12 +549,12 @@ bool W3dExportClass::Export_Hierarchy(char *name,ChunkSaveClass & csave,Progress if (!ExportOptions.ExportHierarchy) return true; HierarchySaveClass::Enable_Terrain_Optimization(ExportOptions.EnableTerrainMode); - if (root == NULL) return false; + if (root == nullptr) return false; try { HierarchyTree = new HierarchySaveClass(root,CurTime,meter,name,FixupType); } catch (ErrorClass err) { - MessageBox(NULL, err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); return false; } @@ -584,11 +584,11 @@ bool W3dExportClass::Export_Animation(char * name,ChunkSaveClass & csave,Progres if (!ExportOptions.ExportAnimation) return true; HierarchySaveClass * htree = get_hierarchy_tree(); - if ((root == NULL) || (htree == NULL)) { + if ((root == nullptr) || (htree == nullptr)) { return false; } - MotionClass * motion = NULL; + MotionClass * motion = nullptr; try { motion = new MotionClass( ExportInterface->theScene, @@ -600,7 +600,7 @@ bool W3dExportClass::Export_Animation(char * name,ChunkSaveClass & csave,Progres MaxInterface->GetMAXHWnd(), name); } catch (ErrorClass err) { - MessageBox(NULL,err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); return false; } @@ -631,7 +631,7 @@ bool W3dExportClass::Export_Damage_Animations(char *name, ChunkSaveClass &csave, if (!ExportOptions.ExportAnimation) return true; HierarchySaveClass *htree = get_hierarchy_tree(); - if ((damage_root == NULL) || (htree == NULL)) + if ((damage_root == nullptr) || (htree == nullptr)) return false; int damage_state = Get_Damage_State(damage_root); @@ -664,7 +664,7 @@ bool W3dExportClass::Export_Damage_Animations(char *name, ChunkSaveClass &csave, sprintf(anim_name, "damage%d-%d", current_region, damage_state); // Export an animation for this damage region. - MotionClass *motion = NULL; + MotionClass *motion = nullptr; try { motion = new MotionClass( ExportInterface->theScene, @@ -679,11 +679,11 @@ bool W3dExportClass::Export_Damage_Animations(char *name, ChunkSaveClass &csave, } catch (ErrorClass err) { - MessageBox(NULL, err.error_message, "Error!", MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr, err.error_message, "Error!", MB_OK | MB_SETFOREGROUND); return false; } - assert(motion != NULL); + assert(motion != nullptr); motion->Save(csave); delete motion; @@ -691,7 +691,7 @@ bool W3dExportClass::Export_Damage_Animations(char *name, ChunkSaveClass &csave, if (num_damage_bones <= 0) { - MessageBox(NULL, "Warning: Your damage bones need to be given damage region numbers. " + MessageBox(nullptr, "Warning: Your damage bones need to be given damage region numbers. " "You can do this in the W3D Tools panel.", name, MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND); } @@ -724,22 +724,22 @@ bool W3dExportClass::Export_Geometry(char * name,ChunkSaveClass & csave,Progress { unsigned int i; - assert(root != NULL); + assert(root != nullptr); if (!ExportOptions.ExportGeometry) return true; /* ** If we're attaching the meshes to a hierarchy, get the tree */ - HierarchySaveClass * htree = NULL; + HierarchySaveClass * htree = nullptr; if (ExportOptions.LoadHierarchy || ExportOptions.ExportHierarchy) { htree = get_hierarchy_tree(); - if (htree == NULL) { + if (htree == nullptr) { return false; } } DynamicVectorClass export_tasks; - INodeListClass *geometry_list = NULL; + INodeListClass *geometry_list = nullptr; /* ** Create the lists of nodes that we're going to work with @@ -783,14 +783,14 @@ bool W3dExportClass::Export_Geometry(char * name,ChunkSaveClass & csave,Progress ** If we're only exporting geometry, only export the first mesh. (no more collections) */ int geometry_count = geometry_list->Num_Nodes(); - if ((htree == NULL) && (geometry_list->Num_Nodes() > 1)) { + if ((htree == nullptr) && (geometry_list->Num_Nodes() > 1)) { geometry_count = MIN(geometry_count,1); ExportLog::printf("\nDiscarding extra meshes since we are not exporting a hierarchical model.\n"); } for (i=0; iSet_Name(name); export_tasks[0]->Set_Container_Name(""); @@ -816,13 +816,13 @@ bool W3dExportClass::Export_Geometry(char * name,ChunkSaveClass & csave,Progress /* ** Generate the mesh-connections object to return to the caller */ - MeshConnectionsClass * meshcon = NULL; - if (htree != NULL) { + MeshConnectionsClass * meshcon = nullptr; + if (htree != nullptr) { Progress_Meter_Class mcmeter(meter,meter.Increment); try { meshcon = new MeshConnectionsClass(export_tasks,context); } catch (ErrorClass err) { - MessageBox(NULL,err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,err.error_message,"Error!",MB_OK | MB_SETFOREGROUND); return false; } *out_connection = meshcon; @@ -941,7 +941,7 @@ HierarchySaveClass * W3dExportClass::get_hierarchy_tree(void) /* ** If the hierarchy tree pointer has been initialized, just return it */ - if (HierarchyTree != NULL) return HierarchyTree; + if (HierarchyTree != nullptr) return HierarchyTree; /* ** If we are supposed to be loading a hierarchy from disk, then @@ -955,7 +955,7 @@ HierarchySaveClass * W3dExportClass::get_hierarchy_tree(void) char buf[256]; sprintf(buf,"Unable to load hierarchy file: %s\nIf this Max file has been moved, please re-select the hierarchy file.",HierarchyFilename); MessageBox(MaxInterface->GetMAXHWnd(),buf,"Error",MB_OK | MB_SETFOREGROUND); - return NULL; + return nullptr; } } @@ -965,7 +965,7 @@ HierarchySaveClass * W3dExportClass::get_hierarchy_tree(void) ** function failed to create a hierarchy tree for us. */ assert(0); - return NULL; + return nullptr; } @@ -983,7 +983,7 @@ HierarchySaveClass * W3dExportClass::get_hierarchy_tree(void) *=============================================================================================*/ INodeListClass * W3dExportClass::get_damage_root_list(void) { - if (DamageRootList != NULL) return DamageRootList; + if (DamageRootList != nullptr) return DamageRootList; /* ** Create a list of all damage root objects in the scene. @@ -1008,7 +1008,7 @@ INodeListClass * W3dExportClass::get_damage_root_list(void) *=============================================================================================*/ INodeListClass * W3dExportClass::get_origin_list(void) { - if (OriginList != NULL) return OriginList; + if (OriginList != nullptr) return OriginList; /* ** Create a list of all origins in the scene. @@ -1051,7 +1051,7 @@ bool W3dExportClass::get_export_options(BOOL suppress_prompts) // scene pointer. If there is no such AppDataChunk create one and set it // to default values. - W3dExportOptionsStruct *options = NULL; + W3dExportOptionsStruct *options = nullptr; AppDataChunk * appdata = MaxInterface->GetScenePointer()->GetAppDataChunk(W3D_EXPORTER_CLASS_ID,SCENE_EXPORT_CLASS_ID,0); @@ -1159,7 +1159,7 @@ void W3dExportClass::Start_Progress_Bar(void) "Processing Triangle Mesh", TRUE, progress_callback, - NULL); + nullptr); } /*********************************************************************************************** @@ -1192,7 +1192,7 @@ static bool dupe_check(const INodeListClass & list) if (stricmp(list[i]->GetName(),list[j]->GetName()) == 0) { char buf[256]; sprintf(buf,"Geometry Nodes with duplicated names found!\nDuplicated Name: %s\n",list[i]->GetName()); - MessageBox(NULL,buf,"Error",MB_OK | MB_SETFOREGROUND); + MessageBox(nullptr,buf,"Error",MB_OK | MB_SETFOREGROUND); return true; } } @@ -1205,12 +1205,12 @@ static bool check_lod_extensions (INodeListClass &list, INode *origin) { /* ** Assumptions: - ** - If origin == NULL, then we're just exporting a single model and don't need to + ** - If origin == nullptr, then we're just exporting a single model and don't need to ** worry about lod extensions at all. ** - If origin is the root of the scene, then we're just exporting a single model as well. ** - Otherwise origin actually points to an Origin and not just any INode. */ - if (origin == NULL) return true; + if (origin == nullptr) return true; if (origin->IsRootNode()) return true; char *extension = strrchr(origin->GetName(), '.'); @@ -1220,7 +1220,7 @@ static bool check_lod_extensions (INodeListClass &list, INode *origin) char *this_ext = strrchr(list[i]->GetName(), '.'); // Check for the existance of an extension in this node. - if (this_ext == NULL) + if (this_ext == nullptr) return false; // Check that the extensions are the same. @@ -1239,7 +1239,7 @@ bool W3dExportClass::get_base_object_tm (Matrix3 &tm) return false; unsigned int i, count = origin_list->Num_Nodes(); - INode *base_origin = NULL; + INode *base_origin = nullptr; for (i = 0; i < count; i++) { INode *node = (*origin_list)[i]; @@ -1265,12 +1265,12 @@ static DWORD WINAPI progress_callback( LPVOID arg ) static HierarchySaveClass * load_hierarchy_file(char * filename) { - HierarchySaveClass * hier = NULL; + HierarchySaveClass * hier = nullptr; RawFileClass file(filename); if (!file.Open()) { - return NULL; + return nullptr; } ChunkLoadClass cload(&file); @@ -1279,9 +1279,9 @@ static HierarchySaveClass * load_hierarchy_file(char * filename) hier = new HierarchySaveClass(); hier->Load(cload); } else { - hier = NULL; + hier = nullptr; file.Close(); - return NULL; + return nullptr; } cload.Close_Chunk(); diff --git a/Core/Tools/WW3D/max2w3d/w3dexp.h b/Core/Tools/WW3D/max2w3d/w3dexp.h index df69186b380..aaf57fed649 100644 --- a/Core/Tools/WW3D/max2w3d/w3dexp.h +++ b/Core/Tools/WW3D/max2w3d/w3dexp.h @@ -108,7 +108,7 @@ class W3dExportClass : public SceneExport bool Export_Hierarchy(char * name,ChunkSaveClass & csave,Progress_Meter_Class & meter,INode *root); bool Export_Animation(char * name,ChunkSaveClass & csave,Progress_Meter_Class & meter,INode *root); bool Export_Damage_Animations(char * name,ChunkSaveClass & csave,Progress_Meter_Class &meter,INode *damage_root); - bool Export_Geometry(char * name,ChunkSaveClass & csave,Progress_Meter_Class & meter,INode *root=NULL, MeshConnectionsClass **out_connection=NULL); + bool Export_Geometry(char * name,ChunkSaveClass & csave,Progress_Meter_Class & meter,INode *root=nullptr, MeshConnectionsClass **out_connection=nullptr); bool Export_HLod (char *name, const char *htree_name, ChunkSaveClass &csave, Progress_Meter_Class &meter, MeshConnectionsClass **connections, int lod_count); bool Export_Collection(const char * name,ChunkSaveClass & csave,DynamicVectorClass & objlist,INodeListClass & placeholder_list,INodeListClass & transform_node_list); diff --git a/Core/Tools/WW3D/max2w3d/w3dmtl.cpp b/Core/Tools/WW3D/max2w3d/w3dmtl.cpp index f86727e9d2d..163ca9d331f 100644 --- a/Core/Tools/WW3D/max2w3d/w3dmtl.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dmtl.cpp @@ -87,8 +87,8 @@ void W3dMapClass::Reset(void) { if (Filename) free(Filename); if (AnimInfo) delete AnimInfo; - Filename = NULL; - AnimInfo = NULL; + Filename = nullptr; + AnimInfo = nullptr; } void W3dMapClass::Set_Filename(const char * fullpath) @@ -101,25 +101,25 @@ void W3dMapClass::Set_Filename(const char * fullpath) char exten[_MAX_EXT]; char fname[_MAX_FNAME+_MAX_EXT+2]; - _splitpath(fullpath,NULL,NULL,name,exten); - _makepath(fname,NULL,NULL,name,exten); + _splitpath(fullpath,nullptr,nullptr,name,exten); + _makepath(fname,nullptr,nullptr,name,exten); //strupr(fname); (gth) need to preserve case since unix/PS2 is case sensitive... Filename = strdup(fname); } else { - Filename = NULL; + Filename = nullptr; } } void W3dMapClass::Set_Anim_Info(const W3dTextureInfoStruct * info) { - if (info == NULL) { + if (info == nullptr) { if (AnimInfo) { delete AnimInfo; - AnimInfo = NULL; + AnimInfo = nullptr; return; } } else { - if (AnimInfo == NULL) { + if (AnimInfo == nullptr) { AnimInfo = new W3dTextureInfoStruct; } *AnimInfo = *info; @@ -128,7 +128,7 @@ void W3dMapClass::Set_Anim_Info(const W3dTextureInfoStruct * info) void W3dMapClass::Set_Anim_Info(int framecount,float framerate) { - if (AnimInfo == NULL) { + if (AnimInfo == nullptr) { AnimInfo = new W3dTextureInfoStruct; } @@ -152,12 +152,12 @@ W3dMaterialClass::W3dMaterialClass(void) PassCount = 0; SortLevel = SORT_LEVEL_NONE; for (int pass = 0; pass < MAX_PASSES; pass++) { - Materials[pass] = NULL; + Materials[pass] = nullptr; W3d_Shader_Reset(&(Shaders[pass])); for (int stage = 0; stage < MAX_STAGES; stage++) { - Textures[pass][stage] = NULL; + Textures[pass][stage] = nullptr; MapChannel[pass][stage] = 1; - MapperArgs[pass][stage] = NULL; + MapperArgs[pass][stage] = nullptr; } } } @@ -173,18 +173,18 @@ void W3dMaterialClass::Free(void) if (Materials[pass]) { delete Materials[pass]; - Materials[pass] = NULL; + Materials[pass] = nullptr; } for (int stage = 0; stage < MAX_STAGES; stage++) { if (Textures[pass][stage]) { delete Textures[pass][stage]; - Textures[pass][stage] = NULL; + Textures[pass][stage] = nullptr; } if (MapperArgs[pass][stage]) { delete [] MapperArgs[pass][stage]; - MapperArgs[pass][stage] = NULL; + MapperArgs[pass][stage] = nullptr; } } } @@ -226,7 +226,7 @@ void W3dMaterialClass::Set_Vertex_Material(const W3dVertexMaterialStruct & vmat, assert(pass >= 0); assert(pass < PassCount); - if (Materials[pass] == NULL) { + if (Materials[pass] == nullptr) { Materials[pass] = new W3dVertexMaterialStruct; } *(Materials[pass]) = vmat; @@ -239,9 +239,9 @@ void W3dMaterialClass::Set_Mapper_Args(const char *args_buffer, int pass, int st assert(stage >= 0); assert(stage < MAX_STAGES); - if (MapperArgs[pass][stage] != NULL) { + if (MapperArgs[pass][stage] != nullptr) { delete [] MapperArgs[pass][stage]; - MapperArgs[pass][stage] = NULL; + MapperArgs[pass][stage] = nullptr; } if (args_buffer) { int len = strlen(args_buffer); @@ -263,7 +263,7 @@ void W3dMaterialClass::Set_Texture(const W3dMapClass & map,int pass,int stage) assert(pass >= 0); assert(pass < PassCount); - if (Textures[pass][stage] == NULL) { + if (Textures[pass][stage] == nullptr) { Textures[pass][stage] = new W3dMapClass; } *(Textures[pass][stage]) = map; @@ -583,7 +583,7 @@ void W3dMaterialClass::Init(GameMtl * gamemtl, char *materialColorTexture) ** install the two textures if present */ W3dMapClass w3dmap; - BitmapTex * tex = NULL; + BitmapTex * tex = nullptr; for (int stage=0; stage < MAX_STAGES; stage++) { @@ -679,10 +679,10 @@ bool W3dMaterialClass::Is_Multi_Pass_Transparent(void) const W3dMaterialDescClass::VertMatClass::VertMatClass(void) : PassIndex(-1), Crc(0), - Name(NULL) + Name(nullptr) { for (int stage=0; stage < W3dMaterialClass::MAX_STAGES; ++stage) { - MapperArgs[stage] = NULL; + MapperArgs[stage] = nullptr; } } @@ -693,7 +693,7 @@ W3dMaterialDescClass::VertMatClass::~VertMatClass(void) for (int stage=0; stage < W3dMaterialClass::MAX_STAGES; ++stage) { if (MapperArgs[stage]) { delete [] (MapperArgs[stage]); - MapperArgs[stage] = NULL; + MapperArgs[stage] = nullptr; } } } @@ -730,7 +730,7 @@ void W3dMaterialDescClass::VertMatClass::Set_Name(const char * name) if (name) { Name = strdup(name); } else { - Name = NULL; + Name = nullptr; } } @@ -738,7 +738,7 @@ void W3dMaterialDescClass::VertMatClass::Set_Mapper_Args(const char * args, int { if (MapperArgs[stage]) { delete [] (MapperArgs[stage]); - MapperArgs[stage] = NULL; + MapperArgs[stage] = nullptr; } if (args) { @@ -746,7 +746,7 @@ void W3dMaterialDescClass::VertMatClass::Set_Mapper_Args(const char * args, int MapperArgs[stage] = new char [len + 1]; strcpy(MapperArgs[stage], args); } else { - MapperArgs[stage] = NULL; + MapperArgs[stage] = nullptr; } } @@ -970,7 +970,7 @@ W3dVertexMaterialStruct * W3dMaterialDescClass::Get_Vertex_Material(int mat_inde { int index = Get_Vertex_Material_Index(mat_index,pass); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Vertex_Material(index); } @@ -980,7 +980,7 @@ const char * W3dMaterialDescClass::Get_Mapper_Args(int mat_index,int pass,int st { int index = Get_Vertex_Material_Index(mat_index,pass); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Mapper_Args(index,stage); } @@ -990,7 +990,7 @@ W3dShaderStruct * W3dMaterialDescClass::Get_Shader(int mat_index,int pass) { int index = Get_Shader_Index(mat_index,pass); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Shader(index); } @@ -1000,7 +1000,7 @@ W3dMapClass * W3dMaterialDescClass::Get_Texture(int mat_index,int pass,int stage { int index = Get_Texture_Index(mat_index,pass,stage); if (index == -1) { - return NULL; + return nullptr; } else { return Get_Texture(index); } @@ -1015,7 +1015,7 @@ const char * W3dMaterialDescClass::Get_Vertex_Material_Name(int mat_index,int pa { int index = Get_Vertex_Material_Index(mat_index,pass); if (index == -1) { - return NULL; + return nullptr; } else { return VertexMaterials[index].Name; } @@ -1087,7 +1087,7 @@ bool W3dMaterialDescClass::Pass_Uses_Alpha(int pass) int W3dMaterialDescClass::Add_Vertex_Material(W3dVertexMaterialStruct * vmat, const char *mapper_args0,const char *mapper_args1,int pass,const char * name) { - if (vmat == NULL) { + if (vmat == nullptr) { return -1; } @@ -1131,7 +1131,7 @@ int W3dMaterialDescClass::Add_Shader(const W3dShaderStruct & shader,int pass) int W3dMaterialDescClass::Add_Texture(W3dMapClass * map,int pass,int stage) { - if ((map == NULL) || (map->Filename == NULL)) { + if ((map == nullptr) || (map->Filename == nullptr)) { return -1; } @@ -1185,7 +1185,7 @@ unsigned long W3dMaterialDescClass::Compute_Crc(const W3dShaderStruct & shader) unsigned long W3dMaterialDescClass::Compute_Crc(const W3dMapClass & map) { unsigned long crc = 0; - if (map.AnimInfo != NULL) { + if (map.AnimInfo != nullptr) { crc = CRC_Memory((const unsigned char *)&map.AnimInfo->Attributes,sizeof(map.AnimInfo->Attributes),crc); crc = CRC_Memory((const unsigned char *)&map.AnimInfo->AnimType,sizeof(map.AnimInfo->AnimType),crc); crc = CRC_Memory((const unsigned char *)&map.AnimInfo->FrameCount,sizeof(map.AnimInfo->FrameCount),crc); diff --git a/Core/Tools/WW3D/max2w3d/w3dmtl.h b/Core/Tools/WW3D/max2w3d/w3dmtl.h index 54fb2bd9a13..9de097f5e3f 100644 --- a/Core/Tools/WW3D/max2w3d/w3dmtl.h +++ b/Core/Tools/WW3D/max2w3d/w3dmtl.h @@ -52,7 +52,7 @@ class ChunkSaveClass; class W3dMapClass { public: - W3dMapClass(void) : Filename(NULL), AnimInfo(NULL) {}; + W3dMapClass(void) : Filename(nullptr), AnimInfo(nullptr) {}; W3dMapClass(const W3dMapClass & that); ~W3dMapClass(void); @@ -88,8 +88,8 @@ class W3dMaterialClass /* ** Construction from Max materials */ - void Init(Mtl * mtl, char *materialColorTexture=NULL); - void Init(GameMtl * gamemtl, char *materialColorTexture=NULL); + void Init(Mtl * mtl, char *materialColorTexture=nullptr); + void Init(GameMtl * gamemtl, char *materialColorTexture=nullptr); /* ** Manual Construction @@ -163,7 +163,7 @@ class W3dMaterialDescClass ** order, then use their indices to find the remapped vertex materials, textures, ** and shaders... */ - ErrorType Add_Material(const W3dMaterialClass & mat,const char * name = NULL); + ErrorType Add_Material(const W3dMaterialClass & mat,const char * name = nullptr); /* ** Global Information. These methods give access to all of the unique vertex materials, diff --git a/Core/Tools/WW3D/max2w3d/w3dutil.cpp b/Core/Tools/WW3D/max2w3d/w3dutil.cpp index 7cf6ad3b1f8..a0fc1bcb735 100644 --- a/Core/Tools/WW3D/max2w3d/w3dutil.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dutil.cpp @@ -130,7 +130,7 @@ class SettingsFormClass void Init(void); void Destroy(void); void Disable_Controls(void); - void Update_Controls(INodeListClass * nodelist = NULL); + void Update_Controls(INodeListClass * nodelist = nullptr); HWND Hwnd; ISpinnerControl * RegionSpin; @@ -239,7 +239,7 @@ class W3DUtilityClass : public UtilityObj /* ** Update the controls in any active settings panels */ - static void update_settings_controls(INodeListClass * node_list = NULL); + static void update_settings_controls(INodeListClass * node_list = nullptr); /* ** Modify the state of all selected nodes @@ -332,9 +332,9 @@ ClassDesc * Get_W3D_Utility_Desc(void) **********************************************************************************************/ W3DUtilityClass::W3DUtilityClass(void) { - InterfacePtr = NULL; - SettingsPanelHWND = NULL; - ToolsPanelHWND = NULL; + InterfacePtr = nullptr; + SettingsPanelHWND = nullptr; + ToolsPanelHWND = nullptr; UpdateSpinnerValue = true; } @@ -372,13 +372,13 @@ void W3DUtilityClass::BeginEditParams(Interface *ip,IUtil *iu) void W3DUtilityClass::EndEditParams(Interface *ip,IUtil *iu) { - InterfacePtr = NULL; + InterfacePtr = nullptr; ip->DeleteRollupPage(SettingsPanelHWND); ip->DeleteRollupPage(ToolsPanelHWND); - SettingsPanelHWND = NULL; - ToolsPanelHWND = NULL; + SettingsPanelHWND = nullptr; + ToolsPanelHWND = nullptr; } void W3DUtilityClass::SelectionSetChanged(Interface *ip,IUtil *iu) @@ -741,7 +741,7 @@ void W3DUtilityClass::generate_lod_ext(INode * node) char *oldname = node->GetName(); char *ext = strrchr(oldname, '.'); int old_lod; - if ( (ext != NULL) && (sscanf(ext, ".%d", &old_lod) == 1) ) + if ( (ext != nullptr) && (sscanf(ext, ".%d", &old_lod) == 1) ) { /* ** An existing LOD index. If it's different than the new @@ -769,7 +769,7 @@ void W3DUtilityClass::generate_lod_ext(INode * node) "extension to \"%s\" will pass this limit! Please shorten its name.", W3D_NAME_LEN - 1, oldname); *ext = '.'; - MessageBox(NULL, msg, "Error", MB_OK); + MessageBox(nullptr, msg, "Error", MB_OK); } } else @@ -789,7 +789,7 @@ void W3DUtilityClass::generate_lod_ext(INode * node) sprintf(msg, "The maximum W3D object name is %d characters. Adding the LOD " "extension to \"%s\" will pass this limit! Please shorten its name.", W3D_NAME_LEN - 1, oldname); - MessageBox(NULL, msg, "Error", MB_OK); + MessageBox(nullptr, msg, "Error", MB_OK); } } } @@ -805,28 +805,28 @@ void W3DUtilityClass::export_with_standard_materials() char *convertingmessage = "Converting materials..."; // Count the no. of references to game materials. - MaterialReferenceMaker::ReferenceCount = convert_materials (GAME_REFERENCE_COUNT, NULL); + MaterialReferenceMaker::ReferenceCount = convert_materials (GAME_REFERENCE_COUNT, nullptr); - MaterialReferenceMaker *gamenodematerials = NULL; + MaterialReferenceMaker *gamenodematerials = nullptr; if (MaterialReferenceMaker::ReferenceCount > 0) { gamenodematerials = new MaterialReferenceMaker [MaterialReferenceMaker::ReferenceCount]; - assert (gamenodematerials != NULL); + assert (gamenodematerials != nullptr); } InterfacePtr->PushPrompt (convertingmessage); - SetCursor (LoadCursor (NULL, IDC_WAIT)); + SetCursor (LoadCursor (nullptr, IDC_WAIT)); convert_materials (GAME_TO_STANDARD, gamenodematerials); InterfacePtr->PopPrompt(); InterfacePtr->FileExport(); UpdateWindow (InterfacePtr->GetMAXHWnd()); InterfacePtr->PushPrompt (convertingmessage); - SetCursor (LoadCursor (NULL, IDC_WAIT)); + SetCursor (LoadCursor (nullptr, IDC_WAIT)); convert_materials (STANDARD_TO_GAME, gamenodematerials); InterfacePtr->PopPrompt(); // Clean-up. - if (gamenodematerials != NULL) delete [] gamenodematerials; + if (gamenodematerials != nullptr) delete [] gamenodematerials; } int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, MaterialReferenceMaker *gamenodematerials) @@ -834,17 +834,17 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater int gamenodematerialindex = 0; INode *rootnode = InterfacePtr->GetRootNode(); - if (rootnode != NULL) { + if (rootnode != nullptr) { INodeListClass *meshlist = new INodeListClass (rootnode, 0); - if (meshlist != NULL) { + if (meshlist != nullptr) { for (unsigned nodeindex = 0; nodeindex < meshlist->Num_Nodes(); nodeindex++) { Mtl *nodemtl = ((*meshlist) [nodeindex])->GetMtl(); // Is this a non-null material? - if (nodemtl != NULL) { + if (nodemtl != nullptr) { // Is this not a multi-material? if (!nodemtl->IsMultiMtl()) { @@ -853,7 +853,7 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater case GAME_REFERENCE_COUNT: if (nodemtl->ClassID() == GameMaterialClassID) { - assert (((GameMtl*) nodemtl)->Substitute_Material() == NULL); + assert (((GameMtl*) nodemtl)->Substitute_Material() == nullptr); } break; @@ -865,13 +865,13 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater gamenodematerials [gamenodematerialindex].MakeRefByID (FOREVER, gamenodematerialindex, nodemtl); // Does this material already have an equivalent standard material? - if (((GameMtl*) nodemtl)->Substitute_Material() == NULL) { + if (((GameMtl*) nodemtl)->Substitute_Material() == nullptr) { ((GameMtl*) nodemtl)->Set_Substitute_Material (new_standard_material ((GameMtl*) nodemtl)); } ((*meshlist) [nodeindex])->SetMtl (((GameMtl*) nodemtl)->Substitute_Material()); } else { - gamenodematerials [gamenodematerialindex].MaterialPtr = NULL; + gamenodematerials [gamenodematerialindex].MaterialPtr = nullptr; } break; @@ -879,9 +879,9 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater // Change materials to game materials if they were previously game materials before being // converted to standard materials. - if (gamenodematerials [gamenodematerialindex].MaterialPtr != NULL) { + if (gamenodematerials [gamenodematerialindex].MaterialPtr != nullptr) { ((*meshlist) [nodeindex])->SetMtl (gamenodematerials [gamenodematerialindex].MaterialPtr); - ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (NULL); + ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (nullptr); } break; } @@ -895,13 +895,13 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater Mtl *submaterial = nodemtl->GetSubMtl (materialindex); // Is this a non-null submaterial? - if (submaterial != NULL) { + if (submaterial != nullptr) { switch (conversion) { case GAME_REFERENCE_COUNT: if (submaterial->ClassID() == GameMaterialClassID) { - assert (((GameMtl*) submaterial)->Substitute_Material() == NULL); + assert (((GameMtl*) submaterial)->Substitute_Material() == nullptr); } break; @@ -913,13 +913,13 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater gamenodematerials [gamenodematerialindex].MakeRefByID (FOREVER, gamenodematerialindex, submaterial); // Does this material already have an equivalent standard material? - if (((GameMtl*) submaterial)->Substitute_Material() == NULL) { + if (((GameMtl*) submaterial)->Substitute_Material() == nullptr) { ((GameMtl*) submaterial)->Set_Substitute_Material (new_standard_material ((GameMtl*) submaterial)); } nodemtl->SetSubMtl (materialindex, ((GameMtl*) submaterial)->Substitute_Material()); } else { - gamenodematerials [gamenodematerialindex].MaterialPtr = NULL; + gamenodematerials [gamenodematerialindex].MaterialPtr = nullptr; } break; @@ -927,9 +927,9 @@ int W3DUtilityClass::convert_materials (MaterialConversionEnum conversion, Mater // Change materials to game materials if they were previously game materials before being // converted to standard materials. - if (gamenodematerials [gamenodematerialindex].MaterialPtr != NULL) { + if (gamenodematerials [gamenodematerialindex].MaterialPtr != nullptr) { nodemtl->SetSubMtl (materialindex, gamenodematerials [gamenodematerialindex].MaterialPtr); - ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (NULL); + ((GameMtl*) gamenodematerials [gamenodematerialindex].MaterialPtr)->Set_Substitute_Material (nullptr); } break; } @@ -975,7 +975,7 @@ StdMat *W3DUtilityClass::new_standard_material (GameMtl *gamemtl) void W3DUtilityClass::Select_Hierarchy(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_HIER); InterfacePtr->ForceCompleteRedraw(); @@ -983,7 +983,7 @@ void W3DUtilityClass::Select_Hierarchy(void) void W3DUtilityClass::Select_Geometry(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_GEOM); InterfacePtr->ForceCompleteRedraw(); @@ -991,7 +991,7 @@ void W3DUtilityClass::Select_Geometry(void) void W3DUtilityClass::Select_Alpha(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_ALPHA); InterfacePtr->ForceCompleteRedraw(); @@ -999,7 +999,7 @@ void W3DUtilityClass::Select_Alpha(void) void W3DUtilityClass::Select_Physical(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_PHYSICAL); InterfacePtr->ForceCompleteRedraw(); @@ -1007,7 +1007,7 @@ void W3DUtilityClass::Select_Physical(void) void W3DUtilityClass::Select_Projectile(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_PROJECTILE); InterfacePtr->ForceCompleteRedraw(); @@ -1015,7 +1015,7 @@ void W3DUtilityClass::Select_Projectile(void) void W3DUtilityClass::Select_Vis(void) { - InterfacePtr->SelectNode(NULL); + InterfacePtr->SelectNode(nullptr); INode * root = InterfacePtr->GetRootNode(); descend_tree(root,SELECT_VIS); InterfacePtr->ForceCompleteRedraw(); @@ -1134,7 +1134,7 @@ void W3DUtilityClass::select_vis_node(INode * node) bool W3DUtilityClass::is_alpha_material(Mtl * nodemtl) { - if (nodemtl == NULL) { + if (nodemtl == nullptr) { return false; } @@ -1165,13 +1165,13 @@ bool W3DUtilityClass::is_alpha_mesh(INode * node,Mtl * nodemtl) Object * obj = node->EvalWorldState(0).obj; TriObject * tri = (TriObject *)obj->ConvertToType(0, triObjectClassID); - if (tri != NULL) { + if (tri != nullptr) { Mesh & mesh = tri->mesh; int face_index; int mat_index; - if (nodemtl == NULL) { + if (nodemtl == nullptr) { return false; @@ -1260,7 +1260,7 @@ void W3DUtilityClass::generate_material_names_for_node(INode * node) void W3DUtilityClass::generate_material_names(Mtl * mtl) { - if (mtl == NULL) { + if (mtl == nullptr) { return; } @@ -1284,11 +1284,11 @@ W3DAppData0Struct * W3DUtilityClass::get_app_data_0(INode * node) /* ** Try to get our AppData which has the export flags */ - W3DAppData0Struct * wdata = NULL; + W3DAppData0Struct * wdata = nullptr; AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,0); /* - ** If there wasn't one, return NULL since this app data chunk is obsolete now. + ** If there wasn't one, return nullptr since this app data chunk is obsolete now. ** If there was one, get the data from it */ if (appdata) { @@ -1302,7 +1302,7 @@ W3DAppData0Struct * W3DUtilityClass::get_app_data_0(INode * node) W3DAppData1Struct * W3DUtilityClass::get_app_data_1(INode * node) { // Try to get our AppData which has the damage region - W3DAppData1Struct * wdata = NULL; + W3DAppData1Struct * wdata = nullptr; AppDataChunk * appdata = node->GetAppDataChunk(W3DUtilityClassID,UTILITY_CLASS_ID,1); // If there wasn't one, add one. If there was one, get the data from it @@ -1421,7 +1421,7 @@ static BOOL CALLBACK _w3d_utility_tools_dlg_proc(HWND hWnd, UINT msg, WPARAM wPa ** the window is destroyed. ** **********************************************************************************************/ -SettingsFormClass * SettingsFormClass::ActiveList = NULL; +SettingsFormClass * SettingsFormClass::ActiveList = nullptr; BOOL CALLBACK _settings_form_dlg_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -1445,7 +1445,7 @@ static void _settings_form_selection_changed_callback(void * param,NotifyInfo * SettingsFormClass::SettingsFormClass(HWND hwnd) : Hwnd(hwnd), - RegionSpin(NULL) + RegionSpin(nullptr) { /* ** Link into the active list @@ -1476,7 +1476,7 @@ SettingsFormClass::~SettingsFormClass(void) SettingsFormClass * prev = ActiveList; SettingsFormClass * cur = ActiveList->Next; - while ((cur != this) && (cur != NULL)) { + while ((cur != this) && (cur != nullptr)) { cur = cur->Next; prev = prev->Next; } @@ -1487,13 +1487,13 @@ SettingsFormClass::~SettingsFormClass(void) } } - Hwnd = NULL; + Hwnd = nullptr; } void SettingsFormClass::Update_All_Instances(void) { - if (ActiveList == NULL) { + if (ActiveList == nullptr) { return; } @@ -1508,7 +1508,7 @@ void SettingsFormClass::Update_All_Instances(void) ** Update all settings forms */ SettingsFormClass * form = ActiveList; - while (form != NULL) { + while (form != nullptr) { form->Update_Controls(&node_list); form = form->Next; } @@ -1520,11 +1520,11 @@ void SettingsFormClass::Init(void) // Initialize the contents of the dazzle combo // Reset the dazzle combo HWND dazzle_combo = GetDlgItem(Hwnd,IDC_DAZZLE_COMBO); - assert(dazzle_combo != NULL); + assert(dazzle_combo != nullptr); SendMessage(dazzle_combo,CB_RESETCONTENT,0,0); // Load the section of Dazzle.INI that defines all of the types. The windows function - // that I'm using here, reads in a NULL-terminated string for each entry in the section. Each + // that I'm using here, reads in a null-terminated string for each entry in the section. Each // string is of the form 'key=value'. Based on my testing, it appears that windows removes any white // space before or after the equal sign as well. char dllpath[_MAX_PATH]; @@ -1540,10 +1540,10 @@ void SettingsFormClass::Init(void) // Now we need to handle each string in the section buffer; skipping the 'key=' and adding // the dazzle type name into the combo box. char * entry = dazzle_types_buffer; - if (entry != NULL) { - while (*entry != NULL) { + if (entry != nullptr) { + while (*entry != nullptr) { entry = strchr(entry,'='); - if (entry != NULL) { + if (entry != nullptr) { entry++; ::SendMessage(dazzle_combo,CB_ADDSTRING,0,(LPARAM)entry); entry += strlen(entry) + 1; @@ -1573,7 +1573,7 @@ void SettingsFormClass::Init(void) void SettingsFormClass::Destroy(void) { ReleaseISpinner(RegionSpin); - RegionSpin = NULL; + RegionSpin = nullptr; } bool SettingsFormClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) @@ -1726,7 +1726,7 @@ bool SettingsFormClass::Dialog_Proc(HWND hWnd,UINT message,WPARAM wParam,LPARAM if (HIWORD(wParam) == CBN_SELCHANGE) { HWND dazzle_combo = GetDlgItem(hWnd,IDC_DAZZLE_COMBO); - if (dazzle_combo != NULL) { + if (dazzle_combo != nullptr) { char dazzle_type[128]; int cursel = ::SendMessage(dazzle_combo,CB_GETCURSEL,0,0); @@ -1801,7 +1801,7 @@ void SettingsFormClass::Update_Controls(INodeListClass * node_list) ** "Multiple" if more than one, "None" if no selected objs... */ ICustEdit * edit_ctrl = GetICustEdit(GetDlgItem(Hwnd,IDC_OBJ_NAME)); - if (edit_ctrl != NULL) { + if (edit_ctrl != nullptr) { if (node_list->Num_Nodes() == 0) { edit_ctrl->Enable(FALSE); edit_ctrl->SetText(Get_String(IDS_NO_OBJECT)); diff --git a/Core/Tools/WW3D/pluglib/Vector.h b/Core/Tools/WW3D/pluglib/Vector.h index aa2ce7b26f1..8f1d9e28fef 100644 --- a/Core/Tools/WW3D/pluglib/Vector.h +++ b/Core/Tools/WW3D/pluglib/Vector.h @@ -127,7 +127,7 @@ class VectorClass * * * This constructor for the vector class is passed the initial size of the vector and an * * optional pointer to a preallocated block of memory that the vector will be placed in. * - * If this optional pointer is NULL (or not provided), then the vector is allocated out * + * If this optional pointer is nullptr (or not provided), then the vector is allocated out * * of free store (with the "new" operator). * * * * INPUT: size -- The number of elements to initialize this vector to. * @@ -417,7 +417,7 @@ bool VectorClass::Resize(int newsize, T const * array) ** If there is an old vector, then it must be copied (as much as is feasible) ** to the new vector. */ - if (Vector != NULL) { + if (Vector != nullptr) { /* ** Copy as much of the old vector into the new vector as possible. This @@ -522,7 +522,7 @@ class DynamicVectorClass : public VectorClass // Uninitialized Add - does everything an Add does, except copying an // object into the 'new' spot in the array. It returns a pointer to - // the 'new' spot. (NULL if the Add failed). NOTE - you must then fill + // the 'new' spot. (null if the Add failed). NOTE - you must then fill // this memory area with a valid object (e.g. by using placement new), // or chaos will result! T * Uninitialized_Add(void); @@ -809,7 +809,7 @@ bool DynamicVectorClass::Delete(int index) * INPUT: none. * * * * OUTPUT: T *; Points to the empty space where the new object is to be created. (If the * - * space was not added succesfully, returns NULL). * + * space was not added succesfully, returns nullptr). * * * * WARNINGS: If memory area is left uninitialized, Very Bad Things will happen. * * * @@ -827,7 +827,7 @@ T * DynamicVectorClass::Uninitialized_Add(void) ** Failure to increase the size of the vector is an error condition. ** Return with the error value. */ - return(NULL); + return(nullptr); } } else { @@ -835,7 +835,7 @@ T * DynamicVectorClass::Uninitialized_Add(void) ** Increasing the size of this vector is not allowed! Bail this ** routine with the error value. */ - return(NULL); + return(nullptr); } } @@ -972,7 +972,7 @@ int Pointer_Vector_Add(T * ptr, VectorClass & vec) int id = 0; bool foundspot = false; for (int index = 0; index < vec.Length(); index++) { - if (vec[index] == NULL) { + if (vec[index] == nullptr) { id = index; foundspot = true; break; @@ -982,7 +982,7 @@ int Pointer_Vector_Add(T * ptr, VectorClass & vec) id = vec.Length(); vec.Resize((vec.Length()+1) * 2); for (int index = id; index < vec.Length(); index++) { - vec[index] = NULL; + vec[index] = nullptr; } } vec[id] = ptr; @@ -995,7 +995,7 @@ bool Pointer_Vector_Remove(T const * ptr, VectorClass & vec) { int id = vec.ID((T *)ptr); if (id != -1) { - vec[id] = NULL; + vec[id] = nullptr; return(true); } return(false); diff --git a/Core/Tools/WW3D/pluglib/always.h b/Core/Tools/WW3D/pluglib/always.h index 79a856d2386..228b25e2c32 100644 --- a/Core/Tools/WW3D/pluglib/always.h +++ b/Core/Tools/WW3D/pluglib/always.h @@ -146,10 +146,6 @@ template T max(T a,T b) #endif -#ifndef NULL - #define NULL 0 -#endif - /********************************************************************** ** This macro serves as a general way to determine the number of elements ** within an array. diff --git a/Core/Tools/WW3D/pluglib/chunkio.cpp b/Core/Tools/WW3D/pluglib/chunkio.cpp index 0a34f075264..26745513a42 100644 --- a/Core/Tools/WW3D/pluglib/chunkio.cpp +++ b/Core/Tools/WW3D/pluglib/chunkio.cpp @@ -733,7 +733,7 @@ uint32 ChunkLoadClass::Read(void * buf,uint32 nbytes) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector2Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -752,7 +752,7 @@ uint32 ChunkLoadClass::Read(IOVector2Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector3Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -771,7 +771,7 @@ uint32 ChunkLoadClass::Read(IOVector3Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector4Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -790,7 +790,7 @@ uint32 ChunkLoadClass::Read(IOVector4Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOQuaternionStruct * q) { - assert(q != NULL); + assert(q != nullptr); return Read(q,sizeof(q)); } diff --git a/Core/Tools/WW3D/pluglib/errclass.h b/Core/Tools/WW3D/pluglib/errclass.h index 60c26fa0cf2..ee641c9012c 100644 --- a/Core/Tools/WW3D/pluglib/errclass.h +++ b/Core/Tools/WW3D/pluglib/errclass.h @@ -45,7 +45,7 @@ class ErrorClass public: ErrorClass(char * format,...); ErrorClass(const ErrorClass & that); - ~ErrorClass(void) { if (error_message != NULL) free(error_message); } + ~ErrorClass(void) { if (error_message != nullptr) free(error_message); } ErrorClass & operator = (const ErrorClass & that); @@ -64,19 +64,19 @@ inline ErrorClass::ErrorClass(char * format,...) } inline ErrorClass::ErrorClass(const ErrorClass & that) : - error_message(NULL) + error_message(nullptr) { *this = that; } inline ErrorClass & ErrorClass::operator = (const ErrorClass & that) { - if (error_message != NULL) { + if (error_message != nullptr) { free(error_message); - error_message = NULL; + error_message = nullptr; } - if (that.error_message != NULL) { + if (that.error_message != nullptr) { error_message = strdup(that.error_message); } diff --git a/Core/Tools/WW3D/pluglib/matrix3d.cpp b/Core/Tools/WW3D/pluglib/matrix3d.cpp index 0b9afa7fcc5..a64d67d05e8 100644 --- a/Core/Tools/WW3D/pluglib/matrix3d.cpp +++ b/Core/Tools/WW3D/pluglib/matrix3d.cpp @@ -580,7 +580,7 @@ void Matrix3D::Copy_3x3_Matrix(float matrix[3][3]) //void print_matrix(const Matrix3D & m); void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res) { - assert(set_res != NULL); + assert(set_res != nullptr); Matrix3D tmp; Matrix3D * Aptr; diff --git a/Core/Tools/WW3D/pluglib/nodefilt.cpp b/Core/Tools/WW3D/pluglib/nodefilt.cpp index be1d3886fad..2d24c17e6fb 100644 --- a/Core/Tools/WW3D/pluglib/nodefilt.cpp +++ b/Core/Tools/WW3D/pluglib/nodefilt.cpp @@ -245,14 +245,14 @@ BOOL AnimatedINodeFilter::Accept_Node(INode * node, TimeValue time) Control * rotcon = node->GetTMController()->GetRotationController(); int numkeys = 0; - if (poscon != NULL) { + if (poscon != nullptr) { IKeyControl * poskeys = GetKeyControlInterface(poscon); - if (poskeys != NULL) numkeys += poskeys->GetNumKeys(); + if (poskeys != nullptr) numkeys += poskeys->GetNumKeys(); } - if (rotcon != NULL) { + if (rotcon != nullptr) { IKeyControl * rotkeys = GetKeyControlInterface(rotcon); - if (rotkeys != NULL) numkeys += rotkeys->GetNumKeys(); + if (rotkeys != nullptr) numkeys += rotkeys->GetNumKeys(); } if (obj && !node->IsHidden() && numkeys > 0) { diff --git a/Core/Tools/WW3D/pluglib/nodelist.cpp b/Core/Tools/WW3D/pluglib/nodelist.cpp index ef13af11c7d..9d4bc0b6da3 100644 --- a/Core/Tools/WW3D/pluglib/nodelist.cpp +++ b/Core/Tools/WW3D/pluglib/nodelist.cpp @@ -84,10 +84,10 @@ class INodeListEntryClass INodeListClass::INodeListClass(TimeValue time,INodeFilterClass * inodefilter) : NumNodes(0), Time(time), - ListHead(NULL), + ListHead(nullptr), INodeFilter(inodefilter) { - if (INodeFilter == NULL) { + if (INodeFilter == nullptr) { INodeFilter = &_AnyFilter; } } @@ -110,10 +110,10 @@ INodeListClass::INodeListClass(TimeValue time,INodeFilterClass * inodefilter) : INodeListClass::INodeListClass(IScene * scene,TimeValue time,INodeFilterClass * inodefilter) : NumNodes(0), Time(time), - ListHead(NULL), + ListHead(nullptr), INodeFilter(inodefilter) { - if (INodeFilter == NULL) { + if (INodeFilter == nullptr) { INodeFilter = &_AnyFilter; } scene->EnumTree(this); @@ -135,10 +135,10 @@ INodeListClass::INodeListClass(IScene * scene,TimeValue time,INodeFilterClass * INodeListClass::INodeListClass(INode * root,TimeValue time,INodeFilterClass * nodefilter) : NumNodes(0), Time(time), - ListHead(NULL), + ListHead(nullptr), INodeFilter(nodefilter) { - if (INodeFilter == NULL) { + if (INodeFilter == nullptr) { INodeFilter = &_AnyFilter; } Add_Tree(root); @@ -160,10 +160,10 @@ INodeListClass::INodeListClass(INode * root,TimeValue time,INodeFilterClass * no INodeListClass::INodeListClass(INodeListClass & copyfrom,TimeValue time,INodeFilterClass * inodefilter) : NumNodes(0), Time(time), - ListHead(NULL), + ListHead(nullptr), INodeFilter(inodefilter) { - if (INodeFilter == NULL) { + if (INodeFilter == nullptr) { INodeFilter = &_AnyFilter; } for (unsigned i=0; i 0 && entry != NULL ) + while (index > 0 && entry != nullptr ) { entry = entry->Next; index--; @@ -290,7 +290,7 @@ void INodeListClass::Remove(int i) } INodeListEntryClass * deleteme = prev->Next; - if (deleteme != NULL) { + if (deleteme != nullptr) { prev->Next = prev->Next->Next; delete deleteme; } @@ -311,7 +311,7 @@ void INodeListClass::Remove(int i) *=============================================================================================*/ void INodeListClass::Add_Tree(INode * root) { - if (root == NULL) return; + if (root == nullptr) return; Insert(root); for (int i=0; iNumberOfChildren(); i++) { @@ -363,7 +363,7 @@ void INodeListClass::Sort(const INodeCompareClass & node_compare) INodeListEntryClass * INodeListClass::get_nth_item(int index) { INodeListEntryClass * entry = ListHead; - while (index > 0 && entry != NULL ) + while (index > 0 && entry != nullptr ) { entry = entry->Next; index--; diff --git a/Core/Tools/WW3D/pluglib/nodelist.h b/Core/Tools/WW3D/pluglib/nodelist.h index e7adc255e38..b39a44dabf0 100644 --- a/Core/Tools/WW3D/pluglib/nodelist.h +++ b/Core/Tools/WW3D/pluglib/nodelist.h @@ -60,10 +60,10 @@ class INodeListClass : public ITreeEnumProc { public: - INodeListClass(TimeValue time,INodeFilterClass * nodefilter = NULL); - INodeListClass(IScene * scene,TimeValue time,INodeFilterClass * nodefilter = NULL); - INodeListClass(INode * root,TimeValue time,INodeFilterClass * nodefilter = NULL); - INodeListClass(INodeListClass & copyfrom,TimeValue time,INodeFilterClass * inodefilter = NULL); + INodeListClass(TimeValue time,INodeFilterClass * nodefilter = nullptr); + INodeListClass(IScene * scene,TimeValue time,INodeFilterClass * nodefilter = nullptr); + INodeListClass(INode * root,TimeValue time,INodeFilterClass * nodefilter = nullptr); + INodeListClass(INodeListClass & copyfrom,TimeValue time,INodeFilterClass * inodefilter = nullptr); ~INodeListClass(); void Set_Filter(INodeFilterClass * inodefilter) { INodeFilter = inodefilter; } diff --git a/Core/Tools/WW3D/pluglib/rawfile.cpp b/Core/Tools/WW3D/pluglib/rawfile.cpp index 996312b9f94..60bd1be9057 100644 --- a/Core/Tools/WW3D/pluglib/rawfile.cpp +++ b/Core/Tools/WW3D/pluglib/rawfile.cpp @@ -294,7 +294,7 @@ void RawFileClass::Reset(void) Close(); if (Allocated && Filename) { free((char *)Filename); - Filename = NULL; + Filename = nullptr; Allocated = false; } } @@ -321,18 +321,18 @@ void RawFileClass::Reset(void) *=============================================================================================*/ char const * RawFileClass::Set_Name(char const * filename) { - if (Filename != NULL && Allocated) { + if (Filename != nullptr && Allocated) { free((char *)Filename); - Filename = NULL; + Filename = nullptr; Allocated = false; } - if (filename == NULL) return(NULL); + if (filename == nullptr) return(nullptr); Bias(0); char *nameptr = strdup(filename); - if (nameptr == NULL) { + if (nameptr == nullptr) { Error(ENOMEM, false, filename); } @@ -409,7 +409,7 @@ int RawFileClass::Open(int rights) ** Verify that there is a filename associated with this file object. If not, then this is a ** big error condition. */ - if (Filename == NULL) { + if (Filename == nullptr) { Error(ENOENT, false); } @@ -442,7 +442,7 @@ int RawFileClass::Open(int rights) Handle = fopen(Filename, "r"); #else Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif break; @@ -451,7 +451,7 @@ int RawFileClass::Open(int rights) Handle = fopen(Filename, "w"); #else Handle = CreateFileA(Filename, GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif break; @@ -462,7 +462,7 @@ int RawFileClass::Open(int rights) // SKB 5/13/99 use OPEN_ALWAYS instead of CREATE_ALWAYS so that files // does not get destroyed. Handle = CreateFileA(Filename, GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif break; } @@ -511,7 +511,7 @@ int RawFileClass::Open(int rights) *=============================================================================================*/ bool RawFileClass::Is_Available(int forced) { - if (Filename == NULL) return(false); + if (Filename == nullptr) return(false); /* ** If the file is already open, then is must have already passed the availability check. @@ -540,7 +540,7 @@ bool RawFileClass::Is_Available(int forced) Handle=fopen(Filename,"r"); #else Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if (Handle == NULL_HANDLE) { @@ -620,10 +620,10 @@ void RawFileClass::Close(void) * the file. This condition can result in fewer bytes being read than requested. Determine * * this by examining the return value. * * * - * INPUT: buffer -- Pointer to the buffer to read data into. If NULL is passed, no read * + * INPUT: buffer -- Pointer to the buffer to read data into. If nullptr is passed, no read * * is performed. * * * - * size -- The number of bytes to read. If NULL is passed, then no read is * + * size -- The number of bytes to read. If nullptr is passed, then no read is * * performed. * * * * OUTPUT: Returns with the number of bytes read into the buffer. If this number is less * @@ -675,7 +675,7 @@ int RawFileClass::Read(void * buffer, int size) if ((bytesread == 0)&&( ! feof(Handle))) readok=ferror(Handle); #else - readok=ReadFile(Handle, buffer, size, &(unsigned long&)bytesread, NULL); + readok=ReadFile(Handle, buffer, size, &(unsigned long&)bytesread, nullptr); #endif @@ -741,7 +741,7 @@ int RawFileClass::Write(void const * buffer, int size) if (byteswritten != size) writeok = FALSE; #else - writeok=WriteFile(Handle, buffer, size, &(unsigned long&)byteswritten, NULL); + writeok=WriteFile(Handle, buffer, size, &(unsigned long&)byteswritten, nullptr); #endif if (! writeok) { @@ -891,7 +891,7 @@ int RawFileClass::Size(void) size=endpos-startpos; fsetpos(Handle,&curpos); #else - size = GetFileSize(Handle, NULL); + size = GetFileSize(Handle, nullptr); #endif /* @@ -1190,7 +1190,7 @@ int RawFileClass::Raw_Seek(int pos, int dir) dir = FILE_END; break; } - pos = SetFilePointer(Handle, pos, NULL, dir); + pos = SetFilePointer(Handle, pos, nullptr, dir); #endif /* diff --git a/Core/Tools/WW3D/pluglib/rawfile.h b/Core/Tools/WW3D/pluglib/rawfile.h index 40d81d696ae..61626403e42 100644 --- a/Core/Tools/WW3D/pluglib/rawfile.h +++ b/Core/Tools/WW3D/pluglib/rawfile.h @@ -47,7 +47,7 @@ #ifdef _UNIX #include #include "osdep.h" - #define NULL_HANDLE NULL + #define NULL_HANDLE nullptr #define HANDLE_TYPE FILE* #else #define NULL_HANDLE INVALID_HANDLE_VALUE @@ -105,7 +105,7 @@ class RawFileClass : public FileClass virtual void Close(void); virtual unsigned long Get_Date_Time(void); virtual bool Set_Date_Time(unsigned long datetime); - virtual void Error(int error, int canretry = false, char const * filename=NULL); + virtual void Error(int error, int canretry = false, char const * filename=nullptr); void Bias(int start, int length=-1); @@ -145,7 +145,7 @@ class RawFileClass : public FileClass #endif /* - ** This points to the filename as a NULL terminated string. It may point to either a + ** This points to the filename as a null-terminated string. It may point to either a ** constant or an allocated string as indicated by the "Allocated" flag. */ char const * Filename; @@ -179,11 +179,11 @@ class RawFileClass : public FileClass * RawFileClass::File_Name -- Returns with the filename associate with the file object. * * * * Use this routine to determine what filename is associated with this file object. If no * - * filename has yet been assigned, then this routing will return NULL. * + * filename has yet been assigned, then this routing will return null. * * * * INPUT: none * * * - * OUTPUT: Returns with a pointer to the file name associated with this file object or NULL * + * OUTPUT: Returns with a pointer to the file name associated with this file object or nullptr * * if one doesn't exist. * * * * WARNINGS: none * diff --git a/Core/Tools/WW3D/pluglib/uarray.h b/Core/Tools/WW3D/pluglib/uarray.h index 1b89db61b3d..8312c808019 100644 --- a/Core/Tools/WW3D/pluglib/uarray.h +++ b/Core/Tools/WW3D/pluglib/uarray.h @@ -151,9 +151,9 @@ UniqueArrayClass::UniqueArrayClass(int initial_size,int growth_rate,HashCalcu template UniqueArrayClass::~UniqueArrayClass(void) { - if (HashTable != NULL) { + if (HashTable != nullptr) { delete[] HashTable; - HashTable = NULL; + HashTable = nullptr; } } diff --git a/Core/Tools/WW3D/pluglib/vector2.h b/Core/Tools/WW3D/pluglib/vector2.h index 91ff7d7e937..e35f5e87ae7 100644 --- a/Core/Tools/WW3D/pluglib/vector2.h +++ b/Core/Tools/WW3D/pluglib/vector2.h @@ -625,7 +625,7 @@ inline float Distance(float x1, float y1, float x2, float y2) *=============================================================================================*/ inline void Vector2::Lerp(const Vector2 & a,const Vector2 & b,float t,Vector2 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = (a.X + (b.X - a.X)*t); set_result->Y = (a.Y + (b.Y - a.Y)*t); } diff --git a/Core/Tools/WW3D/pluglib/vector3.h b/Core/Tools/WW3D/pluglib/vector3.h index 9249b8a5c1a..ead1494f374 100644 --- a/Core/Tools/WW3D/pluglib/vector3.h +++ b/Core/Tools/WW3D/pluglib/vector3.h @@ -535,7 +535,7 @@ WWINLINE Vector3 Lerp(const Vector3 & a, const Vector3 & b, float alpha) *=============================================================================================*/ WWINLINE void Lerp(const Vector3 & a, const Vector3 & b, float alpha,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = (a.X + (b.X - a.X)*alpha); set_result->Y = (a.Y + (b.Y - a.Y)*alpha); set_result->Z = (a.Z + (b.Z - a.Z)*alpha); @@ -543,7 +543,7 @@ WWINLINE void Lerp(const Vector3 & a, const Vector3 & b, float alpha,Vector3 * s WWINLINE void Vector3::Lerp(const Vector3 & a, const Vector3 & b, float alpha,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = (a.X + (b.X - a.X)*alpha); set_result->Y = (a.Y + (b.Y - a.Y)*alpha); set_result->Z = (a.Z + (b.Z - a.Z)*alpha); @@ -563,7 +563,7 @@ WWINLINE void Vector3::Lerp(const Vector3 & a, const Vector3 & b, float alpha,Ve *=============================================================================================*/ WWINLINE void Vector3::Add(const Vector3 &a,const Vector3 &b,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = a.X + b.X; set_result->Y = a.Y + b.Y; set_result->Z = a.Z + b.Z; @@ -584,7 +584,7 @@ WWINLINE void Vector3::Add(const Vector3 &a,const Vector3 &b,Vector3 * set_resul *=============================================================================================*/ WWINLINE void Vector3::Subtract(const Vector3 &a,const Vector3 &b,Vector3 * set_result) { - assert(set_result != NULL); + assert(set_result != nullptr); set_result->X = a.X - b.X; set_result->Y = a.Y - b.Y; set_result->Z = a.Z - b.Z; diff --git a/Core/Tools/WW3D/pluglib/w3d_file.h b/Core/Tools/WW3D/pluglib/w3d_file.h index 98f09b88e07..644cfa4fa15 100644 --- a/Core/Tools/WW3D/pluglib/w3d_file.h +++ b/Core/Tools/WW3D/pluglib/w3d_file.h @@ -310,7 +310,7 @@ struct W3dChunkHeader make the importer faster, the triangles will also be stored in this format. The application can read whichever chunk it wants to. - The mesh user text chunk is a NULL-terminated text buffer. + The mesh user text chunk is a null-terminated text buffer. ********************************************************************************/ @@ -359,9 +359,9 @@ struct W3dRGBStruct ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterialStruct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; @@ -373,9 +373,9 @@ struct W3dMaterialStruct ///////////////////////////////////////////////////////////////////////////////////////////// struct W3dMaterial2Struct { - char MaterialName[W3D_NAME_LEN]; // name of the material (NULL terminated) - char PrimaryName[W3D_NAME_LEN]; // primary texture name (NULL terminated) - char SecondaryName[W3D_NAME_LEN]; // secondary texture name (NULL terminated) + char MaterialName[W3D_NAME_LEN]; // name of the material (null-terminated) + char PrimaryName[W3D_NAME_LEN]; // primary texture name (null-terminated) + char SecondaryName[W3D_NAME_LEN]; // secondary texture name (null-terminated) uint32 RenderFlags; // Rendering flags uint8 Red; // Rgb colors uint8 Green; @@ -788,8 +788,8 @@ struct W3dBitChannelStruct struct W3dHModelHeaderStruct { uint32 Version; - char Name[W3D_NAME_LEN]; // Name of this connection set (NULL terminated) - char HierarchyName[W3D_NAME_LEN]; // Name of hierarchy associated with these connections (NULL terminated) + char Name[W3D_NAME_LEN]; // Name of this connection set (null-terminated) + char HierarchyName[W3D_NAME_LEN]; // Name of hierarchy associated with these connections (null-terminated) uint16 NumConnections; }; diff --git a/Core/Tools/WW3D/pluglib/w3dquat.cpp b/Core/Tools/WW3D/pluglib/w3dquat.cpp index f50922fbe5a..f544ea304a7 100644 --- a/Core/Tools/WW3D/pluglib/w3dquat.cpp +++ b/Core/Tools/WW3D/pluglib/w3dquat.cpp @@ -337,7 +337,7 @@ void Slerp_Setup(const Quaternion & p,const Quaternion & q,SlerpInfoStruct * sle { float cos_t; - assert(slerpinfo != NULL); + assert(slerpinfo != nullptr); // cos theta = dot product of p and q cos_t = p.X * q.X + p.Y * q.Y + p.Z * q.Z + p.W * q.W; diff --git a/Core/Tools/WW3D/pluglib/w3dquat.h b/Core/Tools/WW3D/pluglib/w3dquat.h index b0ddb01e276..6ad98076d47 100644 --- a/Core/Tools/WW3D/pluglib/w3dquat.h +++ b/Core/Tools/WW3D/pluglib/w3dquat.h @@ -231,7 +231,7 @@ inline Vector3 Quaternion::Rotate_Vector(const Vector3 & v) const inline void Quaternion::Rotate_Vector(const Vector3 & v,Vector3 * result) const { - assert(result != NULL); + assert(result != nullptr); float x = W*v.X + (Y*v.Z - v.Y*Z); float y = W*v.Y - (X*v.Z - v.X*Z); diff --git a/Core/Tools/WW3D/pluglib/wwfile.h b/Core/Tools/WW3D/pluglib/wwfile.h index 1ae0e39403a..217d45b2ebb 100644 --- a/Core/Tools/WW3D/pluglib/wwfile.h +++ b/Core/Tools/WW3D/pluglib/wwfile.h @@ -53,10 +53,6 @@ #define SEEK_END 2 // Seek from end of file. #endif -#ifndef NULL - #define NULL 0 -#endif - class FileClass { @@ -86,7 +82,7 @@ class FileClass virtual void Close(void) = 0; virtual unsigned long Get_Date_Time(void) {return(0);} virtual bool Set_Date_Time(unsigned long ) {return(false);} - virtual void Error(int error, int canretry = false, char const * filename=NULL) = 0; + virtual void Error(int error, int canretry = false, char const * filename=nullptr) = 0; virtual void * Get_File_Handle(void) { return reinterpret_cast(-1); } operator char const * () diff --git a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp index 18de6bd75b7..f20719c7404 100644 --- a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp +++ b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp @@ -83,13 +83,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, */ int argc = 1; char * argv[20]; - argv[0] = NULL; + argv[0] = nullptr; char * token = strtok(lpCmdLine, " "); - while (argc < 20 && token != NULL) + while (argc < 20 && token != nullptr) { argv[argc++] = strtrim(token); - token = strtok(NULL, " "); + token = strtok(nullptr, " "); } int major = 1; @@ -110,27 +110,27 @@ int APIENTRY WinMain(HINSTANCE hInstance, if (filePtr) { char buffer[256]; - char *stringPtr = NULL; + char *stringPtr = nullptr; while (!feof(filePtr)) { fread(buffer, 256, 1, filePtr); - if ((stringPtr = strstr(buffer, VERSION_STRING)) != NULL) + if ((stringPtr = strstr(buffer, VERSION_STRING)) != nullptr) { char *ptr; // Looking for '#define VERSION "x.y.z"' ptr = strtok(stringPtr, " "); // The VERSION - ptr = strtok(NULL, "\n"); // The remainder + ptr = strtok(nullptr, "\n"); // The remainder if (*ptr == '\"') { ptr++; // Inc past the first " ptr = strtok(ptr, "."); // The first number major = atoi(ptr); - ptr = strtok(NULL, "."); // The second number + ptr = strtok(nullptr, "."); // The second number minor = atoi(ptr); - ptr = strtok(NULL, "\""); // The final number + ptr = strtok(nullptr, "\""); // The final number build = atoi(ptr); fclose(filePtr); diff --git a/Core/Tools/mangler/mangler.cpp b/Core/Tools/mangler/mangler.cpp index 5f758520f2a..86dcbf1707d 100644 --- a/Core/Tools/mangler/mangler.cpp +++ b/Core/Tools/mangler/mangler.cpp @@ -51,7 +51,7 @@ int main(int argc, char **argv) if( argc <= 1 ) { // No args - use a default config file - if ((conf = fopen("mangler.cfg", "r")) == NULL) { + if ((conf = fopen("mangler.cfg", "r")) == nullptr) { cout << "Cannot open mangler.cfg for reading." << endl; DisplayHelp(argv[0]); } @@ -64,7 +64,7 @@ int main(int argc, char **argv) else if( argc == 2 ) { // Use a user-supplied config file - if ((conf = fopen(argv[1], "r")) == NULL) { + if ((conf = fopen(argv[1], "r")) == nullptr) { cout << "Cannot open " << argv[1] << " for reading." << endl; DisplayHelp(argv[0]); } diff --git a/Core/Tools/mangler/manglertest.cpp b/Core/Tools/mangler/manglertest.cpp index 033359a3d18..cf13c9961e7 100644 --- a/Core/Tools/mangler/manglertest.cpp +++ b/Core/Tools/mangler/manglertest.cpp @@ -47,9 +47,9 @@ unsigned long ResolveIP(const char *Server) struct hostent *serverStruct; struct in_addr *serverNode; - if (Server == NULL) + if (Server == nullptr) { - ERRMSG("Can't resolve NULL"); + ERRMSG("Can't resolve null"); return 0; } @@ -59,7 +59,7 @@ unsigned long ResolveIP(const char *Server) strcpy(serverName, Server); serverStruct = gethostbyname(Server); - if (serverStruct == NULL) + if (serverStruct == nullptr) { ERRMSG("Can't resolve " << Server); return 0; @@ -82,7 +82,7 @@ int main(int argc, char **argv) if( argc <= 1 ) { // No args - use a default config file - if ((conf = fopen("manglertest.cfg", "r")) == NULL) { + if ((conf = fopen("manglertest.cfg", "r")) == nullptr) { cout << "Cannot open mangler.cfg for reading." << endl; DisplayHelp(argv[0]); } @@ -95,7 +95,7 @@ int main(int argc, char **argv) else if( argc == 2 ) { // Use a user-supplied config file - if ((conf = fopen(argv[1], "r")) == NULL) { + if ((conf = fopen(argv[1], "r")) == nullptr) { cout << "Cannot open " << argv[1] << " for reading." << endl; DisplayHelp(argv[0]); } diff --git a/Core/Tools/mangler/wlib/arraylist.h b/Core/Tools/mangler/wlib/arraylist.h index 58c8481842b..5b1d4356730 100644 --- a/Core/Tools/mangler/wlib/arraylist.h +++ b/Core/Tools/mangler/wlib/arraylist.h @@ -131,7 +131,7 @@ ArrayList::ArrayList() { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; } // copy constructor @@ -140,7 +140,7 @@ ArrayList::ArrayList(ArrayList &other) { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; (*this)=other; } @@ -653,7 +653,7 @@ bit8 ArrayList::growVector(void) T *newVector=(T *)(new uint8[newSlots * sizeof(T)]); memset(newVector,0,newSlots * sizeof(T)); // zero just to be safe - if (Vector_ != NULL) + if (Vector_ != nullptr) memcpy(newVector,Vector_,Entries_*sizeof(T)); delete[]((uint8 *)Vector_); // Get rid of the old vector without calling @@ -692,7 +692,7 @@ bit8 ArrayList::shrinkVector(void) // T *newVector=(T *)(new uint8[newSlots * sizeof(T)]); - if (Vector_ != NULL) // Vector_ better not be NULL! + if (Vector_ != nullptr) // Vector_ better not be nullptr! memcpy(newVector,Vector_,Entries_*sizeof(T)); delete[]((uint8 *)Vector_); // Get rid of the old vector without calling diff --git a/Core/Tools/mangler/wlib/configfile.cpp b/Core/Tools/mangler/wlib/configfile.cpp index b8d465b750a..ec38b358598 100644 --- a/Core/Tools/mangler/wlib/configfile.cpp +++ b/Core/Tools/mangler/wlib/configfile.cpp @@ -97,7 +97,7 @@ bit8 ConfigFile::readFile(FILE *in) continue; } - if (strchr(cptr,'=')==NULL) // All config entries must have a '=' + if (strchr(cptr,'=')==nullptr) // All config entries must have a '=' continue; key=cptr; key.truncate('='); @@ -152,7 +152,7 @@ bit8 ConfigFile::enumerate(int &index, int &offset, Wstring &key, Wstring &value } Critsec_.unlock(); - if (section==NULL) // no specified section, so any will do... + if (section==nullptr) // no specified section, so any will do... break; if (strlen(section)+2 >= strlen(key.get())) // key should have form: X[section] diff --git a/Core/Tools/mangler/wlib/configfile.h b/Core/Tools/mangler/wlib/configfile.h index eba5a02c811..cf793ca1e34 100644 --- a/Core/Tools/mangler/wlib/configfile.h +++ b/Core/Tools/mangler/wlib/configfile.h @@ -40,25 +40,25 @@ class ConfigFile ConfigFile(); ~ConfigFile(); bit8 readFile(FILE *config); - bit8 getString(IN Wstring &key,OUT Wstring &value, IN char *section=NULL) const; - bit8 getString(IN char *key,OUT Wstring &value, IN char *section=NULL) const; + bit8 getString(IN Wstring &key,OUT Wstring &value, IN char *section=nullptr) const; + bit8 getString(IN char *key,OUT Wstring &value, IN char *section=nullptr) const; - bit8 getInt(IN Wstring &key,OUT sint32 &value, IN char *section=NULL) const; - bit8 getInt(IN char *key,OUT sint32 &value, IN char *section=NULL) const; + bit8 getInt(IN Wstring &key,OUT sint32 &value, IN char *section=nullptr) const; + bit8 getInt(IN char *key,OUT sint32 &value, IN char *section=nullptr) const; - bit8 getInt(IN Wstring &key,OUT sint16 &value, IN char *section=NULL) const; - bit8 getInt(IN char *key,OUT sint16 &value, IN char *section=NULL) const; + bit8 getInt(IN Wstring &key,OUT sint16 &value, IN char *section=nullptr) const; + bit8 getInt(IN char *key,OUT sint16 &value, IN char *section=nullptr) const; // Enumerate through the config lines - bit8 enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section=NULL) const; + bit8 enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section=nullptr) const; // Manual update of config file - bit8 setString(IN Wstring &key,IN Wstring &value, IN char *section=NULL); - bit8 setString(IN char *key,IN Wstring &value, IN char *section=NULL); - bit8 setInt(IN Wstring &key,IN sint32 &value, IN char *section=NULL); - bit8 setInt(IN char *key,IN sint32 &value, IN char *section=NULL); - bit8 removeEntry(IN Wstring &key, IN char *section=NULL); - bit8 removeEntry(IN char *key, IN char *section=NULL); + bit8 setString(IN Wstring &key,IN Wstring &value, IN char *section=nullptr); + bit8 setString(IN char *key,IN Wstring &value, IN char *section=nullptr); + bit8 setInt(IN Wstring &key,IN sint32 &value, IN char *section=nullptr); + bit8 setInt(IN char *key,IN sint32 &value, IN char *section=nullptr); + bit8 removeEntry(IN Wstring &key, IN char *section=nullptr); + bit8 removeEntry(IN char *key, IN char *section=nullptr); bit8 writeFile(FILE *config); // Does not preserve comments, etc ArrayList sectionList; // stores the names of all sections diff --git a/Core/Tools/mangler/wlib/critsec.cpp b/Core/Tools/mangler/wlib/critsec.cpp index d02aae76c9b..f0df292f172 100644 --- a/Core/Tools/mangler/wlib/critsec.cpp +++ b/Core/Tools/mangler/wlib/critsec.cpp @@ -25,7 +25,7 @@ CritSec::CritSec() { #ifdef _UNIX - pthread_mutex_init(&Mutex_, NULL); + pthread_mutex_init(&Mutex_, nullptr); RefCount_ = 0; #elif defined(_WIN32) InitializeCriticalSection(&CritSec_); diff --git a/Core/Tools/mangler/wlib/critsec.h b/Core/Tools/mangler/wlib/critsec.h index 687667d74d8..07d21bee973 100644 --- a/Core/Tools/mangler/wlib/critsec.h +++ b/Core/Tools/mangler/wlib/critsec.h @@ -45,7 +45,7 @@ class CritSec CritSec(); ~CritSec(); - sint32 lock(int *refcount=NULL) RO; + sint32 lock(int *refcount=nullptr) RO; sint32 unlock(void) RO; protected: diff --git a/Core/Tools/mangler/wlib/dictionary.h b/Core/Tools/mangler/wlib/dictionary.h index 2a21b5273b3..fde42c3c4a7 100644 --- a/Core/Tools/mangler/wlib/dictionary.h +++ b/Core/Tools/mangler/wlib/dictionary.h @@ -83,7 +83,7 @@ Dictionary(uint32 (*hashFn)(const K &key)) : //Table is a pointer to a list of pointers (the hash table) table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); hashFunc=hashFn; @@ -151,13 +151,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -189,7 +189,7 @@ void Dictionary::print(FILE *out) RO fprintf(out," |\n"); fprintf(out,"[ ]"); - while (temp!=NULL) + while (temp!=nullptr) { fprintf(out,"--[ ]"); temp=temp->hashNext; @@ -223,27 +223,27 @@ bit8 Dictionary::iterate(INOUT int &index,INOUT int &offset, return(FALSE); temp=table[index]; - while ((temp==NULL)&&((++index) < (int)getSize())) + while ((temp==nullptr)&&((++index) < (int)getSize())) { temp=table[index]; offset=0; } - if (temp==NULL) // no more slots with data + if (temp==nullptr) // no more slots with data return(FALSE); uint32 i=0; - while ((temp!=NULL) && ((int)i < offset)) + while ((temp!=nullptr) && ((int)i < offset)) { temp=temp->hashNext; i++; } - if (temp==NULL) // should never happen + if (temp==nullptr) // should never happen return(FALSE); value=temp->value; - if (temp->hashNext==NULL) + if (temp->hashNext==nullptr) { index++; offset=0; @@ -272,28 +272,28 @@ bit8 Dictionary::iterate(INOUT int &index,INOUT int &offset, return(FALSE); temp=table[index]; - while ((temp==NULL)&&((++index) < (int)getSize())) + while ((temp==nullptr)&&((++index) < (int)getSize())) { temp=table[index]; offset=0; } - if (temp==NULL) // no more slots with data + if (temp==nullptr) // no more slots with data return(FALSE); uint32 i=0; - while ((temp!=NULL) && ((int)i < offset)) + while ((temp!=nullptr) && ((int)i < offset)) { temp=temp->hashNext; i++; } - if (temp==NULL) // should never happen + if (temp==nullptr) // should never happen return(FALSE); value=temp->value; key=temp->key; - if (temp->hashNext==NULL) + if (temp->hashNext==nullptr) { index++; offset=0; @@ -330,10 +330,10 @@ bit8 Dictionary::contains(IN K &key) RO node=table[offset]; - if (node==NULL) + if (node==nullptr) { return(FALSE); } // can't find it - while(node!=NULL) + while(node!=nullptr) { if ((node->key)==key) { return(TRUE); } @@ -367,7 +367,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) float percent; item=(DNode *)new DNode; - assert(item!=NULL); + assert(item!=nullptr); #ifdef KEY_MEM_OPS memcpy(&(item->key),&key,sizeof(K)); @@ -381,7 +381,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) item->value=value; #endif - item->hashNext=NULL; + item->hashNext=nullptr; //If key already exists, it will be overwritten remove(key); // Hopefully this will be false... @@ -390,7 +390,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) node=table[offset]; - if (node==NULL) + if (node==nullptr) { table[offset]=item; } else { @@ -425,7 +425,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) node=table[offset]; last=node; - if (node==NULL) + if (node==nullptr) return(FALSE); //special case table points to thing to delete @@ -454,7 +454,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) bit8 retval=FALSE; // wow, didn't add this for years... (DOH!) //Now the case if the thing to delete is not the first - while (node!=NULL) + while (node!=nullptr) { #ifdef KEY_MEM_OPS if (0==memcmp(&(node->key),&key,sizeof(K))) @@ -508,7 +508,7 @@ bit8 Dictionary::removeAny(OUT K &key,OUT V &value) int i; offset=-1; for (i=0; i<(int)getSize(); i++) - if (table[i]!=NULL) + if (table[i]!=nullptr) { offset=i; break; @@ -544,7 +544,7 @@ bit8 Dictionary::removeAny(OUT K &key,OUT V &value) template bool Dictionary::getValue(IN K &key,OUT V &value) RO { - V *valptr=NULL; + V *valptr=nullptr; bool retval=getPointer(key,&valptr); if (retval && valptr) { @@ -572,17 +572,17 @@ bool Dictionary::getPointer(IN K &key,OUT V **valptr) RO node=table[offset]; - if (node==NULL) + if (node==nullptr) return(FALSE); #ifdef KEY_MEM_OPS - while ((node!=NULL)&&(memcmp(&(node->key),&key,sizeof(K)))) + while ((node!=nullptr)&&(memcmp(&(node->key),&key,sizeof(K)))) #else - while ((node!=NULL)&&( ! ((node->key)==key)) ) // odd syntax so you don't + while ((node!=nullptr)&&( ! ((node->key)==key)) ) // odd syntax so you don't #endif // have to do oper != { node=node->hashNext; } - if (node==NULL) + if (node==nullptr) { return(FALSE); } *valptr=&(node->value); @@ -615,13 +615,13 @@ void Dictionary::shrink(void) tableBits--; table=(DNode **)new DNode*[size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; @@ -654,13 +654,13 @@ void Dictionary::expand(void) tableBits++; table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; diff --git a/Core/Tools/mangler/wlib/filed.h b/Core/Tools/mangler/wlib/filed.h index 2d00ab1afa3..4d2a6fa29cd 100644 --- a/Core/Tools/mangler/wlib/filed.h +++ b/Core/Tools/mangler/wlib/filed.h @@ -26,7 +26,7 @@ class FileD : public OutputDevice FileD(IN char *filename, IN char *mode = "w") { out=fopen(filename,mode); - if (out==NULL) + if (out==nullptr) out=fopen("FileDev.out",mode); } diff --git a/Core/Tools/mangler/wlib/linkedlist.h b/Core/Tools/mangler/wlib/linkedlist.h index 8589c3c45c3..a0cc1908348 100644 --- a/Core/Tools/mangler/wlib/linkedlist.h +++ b/Core/Tools/mangler/wlib/linkedlist.h @@ -63,9 +63,9 @@ class LinkedList void clear(void); // Add a node after the zero based 'pos' - bit8 add(IN T &node,sint32 pos, OUT T **newnodeptr=NULL); - bit8 addTail(IN T &node, OUT T **newnodeptr=NULL); - bit8 addHead(IN T &node, OUT T **newnodeptr=NULL); + bit8 add(IN T &node,sint32 pos, OUT T **newnodeptr=nullptr); + bit8 addTail(IN T &node, OUT T **newnodeptr=nullptr); + bit8 addHead(IN T &node, OUT T **newnodeptr=nullptr); // Remove a node bit8 remove(OUT T &node,sint32 pos); @@ -106,7 +106,7 @@ template LinkedList::LinkedList() { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries } @@ -115,7 +115,7 @@ template LinkedList::LinkedList(LinkedList &other) { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries (*this)=other; } @@ -156,7 +156,7 @@ void LinkedList::clear() } Entries=0; CurIndex=-1; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; } // When adding into a position, the new node goes at the zero based slot @@ -173,10 +173,10 @@ bit8 LinkedList::add(IN T &node,sint32 pos, OUT T **newnodeptr) pos=Entries; item=(LNode *)new LNode; - assert(item!=NULL); + assert(item!=nullptr); item->Node=node; // copy the passed in object - item->Prev=NULL; - item->Next=NULL; + item->Prev=nullptr; + item->Next=nullptr; if (newnodeptr) *newnodeptr=&(item->Node); @@ -228,7 +228,7 @@ bit8 LinkedList::add(IN T &node,sint32 pos, OUT T **newnodeptr) temp=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(temp!=NULL); + assert(temp!=nullptr); } item->Next=temp; item->Prev=temp->Prev; @@ -278,7 +278,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) if (pos==0) { item=Head; if (item->Next) - item->Next->Prev=NULL; + item->Next->Prev=nullptr; Head=item->Next; node=item->Node; Current=Head; @@ -287,7 +287,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) if (pos==Entries-1) { item=Tail; if (item->Prev) - item->Prev->Next=NULL; + item->Prev->Next=nullptr; Tail=item->Prev; node=item->Node; Current=Tail; @@ -297,10 +297,10 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) Entries--; if (Entries==0) { // Super paranoia check - assert(Current==NULL); + assert(Current==nullptr); assert(CurIndex==-1); - assert(Head==NULL); - assert(Tail==NULL); + assert(Head==nullptr); + assert(Tail==nullptr); } return(TRUE); } @@ -337,7 +337,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) item=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(item!=NULL); + assert(item!=nullptr); } item->Prev->Next=item->Next; @@ -441,7 +441,7 @@ bit8 LinkedList::getPointer(OUT T **node,sint32 pos) item=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(item!=NULL); + assert(item!=nullptr); } *node=&(item->Node); CurIndex=pos; diff --git a/Core/Tools/mangler/wlib/mboxd.h b/Core/Tools/mangler/wlib/mboxd.h index a45eff3700a..4f61e9ae7ca 100644 --- a/Core/Tools/mangler/wlib/mboxd.h +++ b/Core/Tools/mangler/wlib/mboxd.h @@ -29,7 +29,7 @@ class MboxD : public OutputDevice char *string=new char[len+1]; memset(string,0,len+1); memcpy(string,str,len); - MessageBox(NULL,string,"Debug Message", MB_OK | MB_ICONINFORMATION); + MessageBox(nullptr,string,"Debug Message", MB_OK | MB_ICONINFORMATION); delete[](string); return(len); } diff --git a/Core/Tools/mangler/wlib/monod.cpp b/Core/Tools/mangler/wlib/monod.cpp index 103409de5c2..ffda85ac28c 100644 --- a/Core/Tools/mangler/wlib/monod.cpp +++ b/Core/Tools/mangler/wlib/monod.cpp @@ -22,12 +22,12 @@ MonoD::MonoD(void) { #ifdef _WIN32 unsigned long retval; - handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { - DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, + DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, nullptr, 0, nullptr, 0, &retval,0); } #endif @@ -37,7 +37,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +45,8 @@ int MonoD::print(const char *str, int len) { #ifdef _WIN32 unsigned long retval; - WriteFile(handle, str, len, &retval, NULL); - ////DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, NULL, 0, + WriteFile(handle, str, len, &retval, nullptr); + ////DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, nullptr, 0, //// &retval,0); return(len); #else diff --git a/Core/Tools/mangler/wlib/sem4.cpp b/Core/Tools/mangler/wlib/sem4.cpp index e11b95a362f..12ccb5c6480 100644 --- a/Core/Tools/mangler/wlib/sem4.cpp +++ b/Core/Tools/mangler/wlib/sem4.cpp @@ -34,7 +34,7 @@ Sem4::Sem4() #ifndef _WIN32 sem_init(&sem,1,1); #else - sem = CreateSemaphore(NULL, 1, 1, NULL); + sem = CreateSemaphore(nullptr, 1, 1, nullptr); #endif } @@ -43,7 +43,7 @@ Sem4::Sem4(uint32 value) #ifndef _WIN32 sem_init(&sem,1,value); #else - sem = CreateSemaphore(NULL, value, value, NULL); + sem = CreateSemaphore(nullptr, value, value, nullptr); #endif } @@ -84,7 +84,7 @@ sint32 Sem4::Post(void) const #else if (!sem) return -1; - if (!ReleaseSemaphore(sem, 1 ,NULL)) + if (!ReleaseSemaphore(sem, 1 ,nullptr)) return -1; return 0; #endif diff --git a/Core/Tools/mangler/wlib/streamer.cpp b/Core/Tools/mangler/wlib/streamer.cpp index 061baad77db..f81be59597f 100644 --- a/Core/Tools/mangler/wlib/streamer.cpp +++ b/Core/Tools/mangler/wlib/streamer.cpp @@ -28,7 +28,7 @@ #define STREAMER_UNBUFFERED 0 #endif -Streamer::Streamer() : streambuf(), Output_Device(NULL), Buf(NULL) +Streamer::Streamer() : streambuf(), Output_Device(nullptr), Buf(nullptr) { #if defined(USING_STLPORT) || (defined(_MSC_VER) && _MSC_VER < 1300) int state=unbuffered(); @@ -101,7 +101,7 @@ int Streamer::underflow(void) int Streamer::doallocate() { - if (Buf==NULL) + if (Buf==nullptr) { Buf=new char[(2*STREAMER_BUFSIZ)]; // deleted by destructor memset(Buf,0,2*STREAMER_BUFSIZ); diff --git a/Core/Tools/mangler/wlib/threadfac.cpp b/Core/Tools/mangler/wlib/threadfac.cpp index e9934e71b6d..7ba7f3b65a1 100644 --- a/Core/Tools/mangler/wlib/threadfac.cpp +++ b/Core/Tools/mangler/wlib/threadfac.cpp @@ -73,8 +73,8 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) // use all the normal C library stuff. (IMPORTANT!!!) uint32 handle; uint32 stup1d; - handle=_beginthreadex(NULL,0, threadClassLauncher, tInfo, 0, &stup1d); - if (handle!=NULL) + handle=_beginthreadex(nullptr,0, threadClassLauncher, tInfo, 0, &stup1d); + if (handle!=nullptr) return(TRUE); else { @@ -92,7 +92,7 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) pthread_attr_init(&threadAttr); pthread_attr_setdetachstate(&threadAttr, PTHREAD_CREATE_DETACHED); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); - retval=pthread_create(NULL,&threadAttr, threadClassLauncher, tInfo); + retval=pthread_create(nullptr,&threadAttr, threadClassLauncher, tInfo); if (retval==0) return(TRUE); else @@ -126,8 +126,8 @@ bit8 ThreadFactory::startThread(void (*start_func)(void *), void *data) // use all the normal C library stuff. (IMPORTANT!!!) uint32 handle; unsigned temp; - handle=_beginthreadex(NULL,0, threadFuncLauncher, tInfo, 0, &temp); - if (handle!=NULL) + handle=_beginthreadex(nullptr,0, threadFuncLauncher, tInfo, 0, &temp); + if (handle!=nullptr) return(TRUE); return(FALSE); #else // UNIX @@ -137,7 +137,7 @@ bit8 ThreadFactory::startThread(void (*start_func)(void *), void *data) pthread_attr_init(&threadAttr); pthread_attr_setdetachstate(&threadAttr, PTHREAD_CREATE_DETACHED); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); - retval=pthread_create(NULL,&threadAttr, threadFuncLauncher, tInfo); + retval=pthread_create(nullptr,&threadAttr, threadFuncLauncher, tInfo); if (retval==0) return(TRUE); else diff --git a/Core/Tools/mangler/wlib/wdebug.cpp b/Core/Tools/mangler/wlib/wdebug.cpp index a7490a1bbb1..505b6330cc8 100644 --- a/Core/Tools/mangler/wlib/wdebug.cpp +++ b/Core/Tools/mangler/wlib/wdebug.cpp @@ -22,22 +22,22 @@ #include "odevice.h" -static MsgManager *msg_manager=NULL; +static MsgManager *msg_manager=nullptr; static int debug_enabled=0; -static ostream *debug_ostream=NULL; +static ostream *debug_ostream=nullptr; static Streamer debug_streamer; static int info_enabled=0; -static ostream *info_ostream=NULL; +static ostream *info_ostream=nullptr; static Streamer info_streamer; static int warn_enabled=0; -static ostream *warn_ostream=NULL; +static ostream *warn_ostream=nullptr; static Streamer warn_streamer; static int error_enabled=0; -static ostream *error_ostream=NULL; +static ostream *error_ostream=nullptr; static Streamer error_streamer; @@ -51,7 +51,7 @@ CritSec DebugLibSemaphore; int MsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -86,10 +86,10 @@ int MsgManager::ReplaceAllStreams(FileD * output_device, IN char *device_filenam delete(warn_ostream); delete(error_ostream); - if (output_device != NULL) + if (output_device != nullptr) { delete(output_device); - output_device = NULL; + output_device = nullptr; } rename(device_filename, copy_filename); @@ -117,7 +117,7 @@ int MsgManager::ReplaceAllStreams(FileD * output_device, IN char *device_filenam int MsgManager::setDebugStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -130,7 +130,7 @@ int MsgManager::setDebugStream(OutputDevice *device) int MsgManager::setInfoStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -143,7 +143,7 @@ int MsgManager::setInfoStream(OutputDevice *device) int MsgManager::setWarnStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -156,7 +156,7 @@ int MsgManager::setWarnStream(OutputDevice *device) int MsgManager::setErrorStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; diff --git a/Core/Tools/mangler/wlib/wstring.cpp b/Core/Tools/mangler/wlib/wstring.cpp index a19c9aaa002..2d19f92e19b 100644 --- a/Core/Tools/mangler/wlib/wstring.cpp +++ b/Core/Tools/mangler/wlib/wstring.cpp @@ -39,15 +39,15 @@ string to it's own memory (for assignment or construction). #define PADSIZE 32 // include a little padding on alloc for future growth -Wstring::Wstring() : str(NULL), strsize(0) +Wstring::Wstring() : str(nullptr), strsize(0) { } -Wstring::Wstring(const char *string):str(NULL), strsize(0) +Wstring::Wstring(const char *string):str(nullptr), strsize(0) { set(string); } -Wstring::Wstring(const Wstring &other):str(NULL), strsize(0) +Wstring::Wstring(const Wstring &other):str(nullptr), strsize(0) { - if (other.str!=NULL) + if (other.str!=nullptr) { str=new char[strlen(other.str)+PADSIZE+1]; strsize=strlen(other.str)+PADSIZE+1; @@ -62,10 +62,10 @@ Wstring::~Wstring() bool Wstring::operator<(const Wstring &other) const { - if (str == NULL && other.str == NULL) + if (str == nullptr && other.str == nullptr) return false; - if (str == NULL) + if (str == nullptr) return true; return ( strcmp(str, other.str) < 0 ); @@ -73,7 +73,7 @@ bool Wstring::operator<(const Wstring &other) const bit8 Wstring::operator==(const char *other) const { - if ((str==NULL)&&(other==NULL)) + if ((str==nullptr)&&(other==nullptr)) return(TRUE); if(strcmp(str, other) != 0) return(FALSE); @@ -83,10 +83,10 @@ bit8 Wstring::operator==(const char *other) const bit8 Wstring::operator==(const Wstring &other) const { - if((str == NULL) && (other.str == NULL)) + if((str == nullptr) && (other.str == nullptr)) return(TRUE); - if((str == NULL) || (other.str == NULL)) + if((str == nullptr) || (other.str == nullptr)) return(FALSE); if(strcmp(str, other.str) != 0) @@ -107,10 +107,10 @@ bit8 Wstring::operator!=(const char *other) const bit8 Wstring::operator!=(const Wstring &other) const { - if((str == NULL) && (other.str == NULL)) + if((str == nullptr) && (other.str == nullptr)) return(FALSE); - if((str == NULL) || (other.str == NULL)) + if((str == nullptr) || (other.str == nullptr)) return(TRUE); if(strcmp(str, other.str) != 0) @@ -141,7 +141,7 @@ bit8 Wstring::cat(const char *s) { uint32 len; - if (s==NULL) // it's OK to cat nothing + if (s==nullptr) // it's OK to cat nothing return(TRUE); // Determine the length of the resultant string. @@ -240,14 +240,14 @@ char Wstring::remove(sint32 pos,sint32 count) bit8 Wstring::removeChar(char c) { int len=0; - char *cptr=NULL; + char *cptr=nullptr; bit8 removed=FALSE; - if (str==NULL) + if (str==nullptr) return(FALSE); len=strlen(str); - while ((cptr=strchr(str,c)) !=NULL) + while ((cptr=strchr(str,c)) !=nullptr) { memmove(cptr,cptr+1,len-1-((int)(cptr-str))); len--; @@ -267,7 +267,7 @@ void Wstring::clear(void) { delete[](str); strsize=0; - str=NULL; + str=nullptr; } // This is usually used for raw storage instead of string ops... @@ -308,7 +308,7 @@ char Wstring::get(uint32 index) const uint32 Wstring::length(void) const { - if(str == NULL) + if(str == nullptr) return(0); return((uint32)strlen(str)); } @@ -317,7 +317,7 @@ uint32 Wstring::length(void) const // Insert at given position and shift old stuff to right bit8 Wstring::insert(const char *instring, uint32 pos) { - if (str==NULL) + if (str==nullptr) return(set(instring)); if (pos>strlen(str)) pos=strlen(str); @@ -397,7 +397,7 @@ bit8 Wstring::replace(const char *replaceThis,const char *withThis) if(!dest.cat(src)) return(FALSE); - src=NULL; + src=nullptr; } } return(set(dest.get())); @@ -445,7 +445,7 @@ char Wstring::set(uint32 size, const char *string) // work in all cases, but this should be good enough for 99% of Wstring usage. char Wstring::setFormatted(const char *msg, ...) { - if( msg == NULL || strlen(msg) <= 0 ) return FALSE; + if( msg == nullptr || strlen(msg) <= 0 ) return FALSE; char* string; va_list args; @@ -506,11 +506,11 @@ bit8 Wstring::truncate(char c) { sint32 len; - if (str==NULL) + if (str==nullptr) return(FALSE); char *cptr=strchr(str,c); - if (cptr==NULL) + if (cptr==nullptr) return(FALSE); len=(sint32)(cptr-str); truncate((uint32)len); @@ -529,7 +529,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const return(-1); for (i=offset; i<(int)length(); i++) { - if(strchr(delim,str[i])==NULL) + if(strchr(delim,str[i])==nullptr) break; } if (i>=(int)length()) @@ -537,7 +537,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const start=i; for (; i<(int)length(); i++) { - if(strchr(delim,str[i])!=NULL) + if(strchr(delim,str[i])!=nullptr) break; } stop=i-1; @@ -558,7 +558,7 @@ sint32 Wstring::getLine(int offset, Wstring &out) return(-1); for (; i<(int)length(); i++) { - if(strchr("\r\n",str[i])!=NULL) + if(strchr("\r\n",str[i])!=nullptr) break; } stop=i; @@ -575,7 +575,7 @@ sint32 Wstring::getLine(int offset, Wstring &out) // void Wstring::strgrow(int length) { - if (str==NULL) + if (str==nullptr) { str=new char[length+PADSIZE]; str[0]=0; diff --git a/Core/Tools/mangler/wlib/wstypes.h b/Core/Tools/mangler/wlib/wstypes.h index c13ef1fa3c8..f46fd77ab86 100644 --- a/Core/Tools/mangler/wlib/wstypes.h +++ b/Core/Tools/mangler/wlib/wstypes.h @@ -72,10 +72,6 @@ Standard type definitions for the sake of portability and readability. #define MAX(x,y) (((x)>(y))?(x):(y)) #endif -#ifndef NULL -#define NULL 0 -#endif - //These are used for readability purposes mostly, when a method takes a // pointer or reference these help specify what will happen to the data // that is sent in. diff --git a/Core/Tools/mangler/wlib/xtime.cpp b/Core/Tools/mangler/wlib/xtime.cpp index d36a7ec1875..95f6533d144 100644 --- a/Core/Tools/mangler/wlib/xtime.cpp +++ b/Core/Tools/mangler/wlib/xtime.cpp @@ -205,7 +205,7 @@ int main(int argc, char *argv[]) unixtime.tv_usec=0; //gettimeofday(&unixtime,&unixtzone); - //ttime=time(NULL); + //ttime=time(nullptr); tmtime=*gmtime(&ttime); printf("TIME->CTIME = %s\n",ctime(&ttime)); diff --git a/Core/Tools/mangler/wnet/field.cpp b/Core/Tools/mangler/wnet/field.cpp index 699b52507cd..a8f405bd145 100644 --- a/Core/Tools/mangler/wnet/field.cpp +++ b/Core/Tools/mangler/wnet/field.cpp @@ -51,56 +51,56 @@ void FieldClass::Clear(void) strcpy(ID,""); DataType=0; Size=0; - Data=NULL; - Next=NULL; + Data=nullptr; + Next=nullptr; } FieldClass::FieldClass(char *id, char data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned char data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, short data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned short data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, long data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned long data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, char *data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, void *data, int length) { - Data=NULL; + Data=nullptr; Set(id,data,length); } diff --git a/Core/Tools/mangler/wnet/field.h b/Core/Tools/mangler/wnet/field.h index de573ddbeec..da3e5d00d39 100644 --- a/Core/Tools/mangler/wnet/field.h +++ b/Core/Tools/mangler/wnet/field.h @@ -35,6 +35,8 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#pragma once + #define FIELD_HEADER_SIZE (sizeof(FieldClass) - (sizeof(void *) * 2)) #define TYPE_CHAR 1 diff --git a/Core/Tools/mangler/wnet/packet.cpp b/Core/Tools/mangler/wnet/packet.cpp index 8cda4f64b01..5426d75b6ae 100644 --- a/Core/Tools/mangler/wnet/packet.cpp +++ b/Core/Tools/mangler/wnet/packet.cpp @@ -114,7 +114,7 @@ PacketClass::PacketClass(char *curbuf) ID = *((short *)curbuf); curbuf += sizeof(unsigned short); ID = ntohs(ID); - Head = NULL; + Head = nullptr; // // Calculate the remaining size so that we can loop through the @@ -268,7 +268,7 @@ FieldClass *PacketClass::Find_Field(char *id) if ( strncmp(id, current->ID, 4) == 0) return current; } - return NULL; + return nullptr; } // gks 9/25/2000 @@ -280,7 +280,7 @@ FieldClass *PacketClass::Get_Field_At(int position) } if (current) return current; - else return NULL; + else return nullptr; } // gks 9/25/2000 diff --git a/Core/Tools/mangler/wnet/tcp.cpp b/Core/Tools/mangler/wnet/tcp.cpp index 66ea079c7af..f48622cd564 100644 --- a/Core/Tools/mangler/wnet/tcp.cpp +++ b/Core/Tools/mangler/wnet/tcp.cpp @@ -472,7 +472,7 @@ char *TCP::Gets(char *string,int n,int whichFD) whichFD=GetFD(); if (whichFD <= 0) - return(NULL); + return(nullptr); memset(string,0,n); @@ -485,7 +485,7 @@ char *TCP::Gets(char *string,int n,int whichFD) if (! FD_ISSET(whichFD,&fdSet)) { DBGMSG("Gets timeout: " << inputDelay); - return(NULL); + return(nullptr); } retval=Read((unsigned char *)&c,1,whichFD); @@ -499,7 +499,7 @@ char *TCP::Gets(char *string,int n,int whichFD) else if ((retval==0)&&(i==0)) { DBGMSG("Remote endpoint closed (1)"); - return(NULL); + return(nullptr); } else if (retval==0) return(string); @@ -551,8 +551,8 @@ sint32 TCP::TimedRead(uint8 *msg,uint32 len,int seconds,sint32 whichFD) sint32 bytes_read=0; sint32 retval; - time_t stop_time=time(NULL)+seconds; - while ((time(NULL)<=stop_time)&&((uint32)bytes_read=0) done=1; @@ -892,7 +892,7 @@ bit8 TCP::Bind(char *Host,uint16 port,bit8 reuseAddr) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( Bind(ntohl(hostNode->s_addr),port,reuseAddr) ); @@ -978,7 +978,7 @@ bit8 TCP::Connect(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) {ERRMSG("Can't resolve host");return (0);} hostNode = (struct in_addr *) hostStruct->h_addr; return ( Connect(ntohl(hostNode->s_addr),port) ); @@ -1064,7 +1064,7 @@ bit8 TCP::ConnectAsync(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( ConnectAsync(ntohl(hostNode->s_addr),port) ); diff --git a/Core/Tools/mangler/wnet/udp.cpp b/Core/Tools/mangler/wnet/udp.cpp index bba9479b658..96037517e29 100644 --- a/Core/Tools/mangler/wnet/udp.cpp +++ b/Core/Tools/mangler/wnet/udp.cpp @@ -40,7 +40,7 @@ sint32 UDP::Bind(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( Bind(ntohl(hostNode->s_addr),port) ); @@ -158,7 +158,7 @@ sint32 UDP::Read(uint8 *msg,uint32 len,sockaddr_in *from) sint32 retval; int alen=sizeof(sockaddr_in); - if (from!=NULL) + if (from!=nullptr) { retval=recvfrom(fd,(char *)msg,len,0,(struct sockaddr *)from,&alen); #ifdef _WIN32 @@ -168,7 +168,7 @@ sint32 UDP::Read(uint8 *msg,uint32 len,sockaddr_in *from) } else { - retval=recvfrom(fd,(char *)msg,len,0,NULL,NULL); + retval=recvfrom(fd,(char *)msg,len,0,nullptr,nullptr); #ifdef _WIN32 if (retval==SOCKET_ERROR) retval=-1; @@ -267,7 +267,7 @@ int UDP::Wait(sint32 sec,sint32 usec,fd_set &givenSet,fd_set &returnSet) while( ! done) { if (noTimeout) - retval=select(givenMax+1,&returnSet,0,0,NULL); + retval=select(givenMax+1,&returnSet,0,0,nullptr); else { timeout.GetTimevalMT(tv); diff --git a/Core/Tools/matchbot/encrypt.cpp b/Core/Tools/matchbot/encrypt.cpp index c0ed7b12e15..d4519c4d3dd 100644 --- a/Core/Tools/matchbot/encrypt.cpp +++ b/Core/Tools/matchbot/encrypt.cpp @@ -69,7 +69,7 @@ char *do_encrypt(char *String) for (Cnt = 0; Cnt < MAX_ENCRYPTED_STRING; Cnt++) Return_Buffer[Cnt] = Base_String[Temp_Buffer[Cnt] & 0x3F]; - Return_Buffer[Cnt] = NULL; + Return_Buffer[Cnt] = '\0'; return (Return_Buffer); } diff --git a/Core/Tools/matchbot/generals.cpp b/Core/Tools/matchbot/generals.cpp index 8c6837a8790..05ee3118536 100644 --- a/Core/Tools/matchbot/generals.cpp +++ b/Core/Tools/matchbot/generals.cpp @@ -135,7 +135,7 @@ GeneralsUser::GeneralsUser(void) minPoints = maxPoints = 100; country = color = -1; pseudoPing.clear(); - matchStart = time(NULL); + matchStart = time(nullptr); timeToWiden = 0; widened = false; numPlayers = 2; @@ -189,12 +189,12 @@ GeneralsMatcher::GeneralsMatcher() INFMSG("weightAvgPoints = " << weightAvgPoints); INFMSG("totalWeight = " << totalWeight); - Global.config.getInt("SecondsBetweenPoolSizeAnnouncements", m_secondsBetweenPoolSizeAnnouncements, NULL); + Global.config.getInt("SecondsBetweenPoolSizeAnnouncements", m_secondsBetweenPoolSizeAnnouncements, nullptr); if (m_secondsBetweenPoolSizeAnnouncements < 10) { m_secondsBetweenPoolSizeAnnouncements = 10; } - m_nextPoolSizeAnnouncement = time(NULL); + m_nextPoolSizeAnnouncement = time(nullptr); } void GeneralsMatcher::init(void) @@ -434,7 +434,7 @@ void GeneralsMatcher::sendMatchInfo(std::string name1, std::string name2, std::s void GeneralsMatcher::checkMatches(void) { bool showPoolSize = false; - time_t now = time(NULL); + time_t now = time(nullptr); if (now > m_nextPoolSizeAnnouncement) { m_nextPoolSizeAnnouncement = now + m_secondsBetweenPoolSizeAnnouncements; @@ -524,7 +524,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int UserMap::iterator i1, i2, i3, i4, i5, i6, i7, i8; GeneralsUser *u1, *u2, *u3, *u4, *u5, *u6, *u7, *u8; static const double fitnessThreshold = 0.3; - time_t now = time(NULL); + time_t now = time(nullptr); std::string s; if (showPoolSize) @@ -560,7 +560,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int if (u1->status != STATUS_WORKING) continue; - GeneralsUser *bestUser = NULL; + GeneralsUser *bestUser = nullptr; double bestMatchFitness = 0.0; std::string bestName = ""; @@ -619,7 +619,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int { // match 4 players sendMatchInfo(i1->first, i2->first, i3->first, i4->first, "", "", "", "", - u1, u2, u3, u4, NULL, NULL, NULL, NULL, 4, ladderID); + u1, u2, u3, u4, nullptr, nullptr, nullptr, nullptr, 4, ladderID); break; } else @@ -665,7 +665,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int { // match 6 players sendMatchInfo(i1->first, i2->first, i3->first, i4->first, i5->first, i6->first, "", "", - u1, u2, u3, u4, u5, u6, NULL, NULL, 6, ladderID); + u1, u2, u3, u4, u5, u6, nullptr, nullptr, 6, ladderID); break; } else @@ -749,7 +749,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int "\tping in ms: " << sqrt(1000000 * calcPingDelta(u1, bestUser) / (255*255*2)) << "\n" "\tprevious attempts: " << u1->widened << ", " << bestUser->widened); sendMatchInfo(i1->first, bestName, "", "", "", "", "", "", - u1, bestUser, NULL, NULL, NULL, NULL, NULL, NULL, 2, ladderID); + u1, bestUser, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 2, ladderID); break; } } @@ -814,7 +814,7 @@ bool GeneralsMatcher::handleUserInfo(const char *nick, const std::string& msg) { int val = atoi(v.c_str()); if (val > 0) - userInfo->timeToWiden = time(NULL) + val; + userInfo->timeToWiden = time(nullptr) + val; else userInfo->timeToWiden = 0; } @@ -911,7 +911,7 @@ bool GeneralsMatcher::handleUserInfo(const char *nick, const std::string& msg) { buf2[0] = *buf++; buf2[1] = *buf++; - ping = (int)strtol(buf2, NULL, 16); + ping = (int)strtol(buf2, nullptr, 16); userInfo->pseudoPing.push_back(ping); } } @@ -959,7 +959,7 @@ bool GeneralsMatcher::handleUserInfo(const char *nick, const std::string& msg) } userInfo->status = STATUS_WORKING; - userInfo->matchStart = time(NULL); + userInfo->matchStart = time(nullptr); peerMessagePlayer(m_peer, nick, s.c_str(), NormalMessage); DBGMSG("Player " << nick << " is matching now, ack was [" << s << "]"); @@ -979,7 +979,7 @@ GeneralsUser* GeneralsMatcher::findUser(const std::string& who) if (user) return user; - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::findUserInAnyLadder(const std::string& who) @@ -990,18 +990,18 @@ GeneralsUser* GeneralsMatcher::findUserInAnyLadder(const std::string& who) if (uIt != lIt->second.end()) return uIt->second; } - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::findUserInLadder(const std::string& who, int ladderID) { LadderMap::iterator lIt = m_ladders.find(ladderID); if (lIt == m_ladders.end()) - return NULL; + return nullptr; UserMap::iterator uIt = lIt->second.find(who); if (uIt == lIt->second.end()) - return NULL; + return nullptr; return uIt->second; } @@ -1024,14 +1024,14 @@ GeneralsUser* GeneralsMatcher::findNonLadderUser(const std::string& who) if (it != m_nonLadderUsers4v4.end()) return it->second; - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::findNonMatchingUser(const std::string& who) { UserMap::iterator it = m_nonMatchingUsers.find(who); if (it == m_nonMatchingUsers.end()) - return NULL; + return nullptr; return it->second; } @@ -1106,11 +1106,11 @@ GeneralsUser* GeneralsMatcher::removeUserInLadder(const std::string& who, int la { LadderMap::iterator lIt = m_ladders.find(ladderID); if (lIt == m_ladders.end()) - return NULL; + return nullptr; UserMap::iterator uIt = lIt->second.find(who); if (uIt == lIt->second.end()) - return NULL; + return nullptr; GeneralsUser *user = uIt->second; lIt->second.erase(uIt); @@ -1129,7 +1129,7 @@ GeneralsUser* GeneralsMatcher::removeUserInAnyLadder(const std::string& who) return user; } } - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::removeNonLadderUser(const std::string& who) @@ -1166,14 +1166,14 @@ GeneralsUser* GeneralsMatcher::removeNonLadderUser(const std::string& who) return user; } - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::removeNonMatchingUser(const std::string& who) { UserMap::iterator it = m_nonMatchingUsers.find(who); if (it == m_nonMatchingUsers.end()) - return NULL; + return nullptr; GeneralsUser *user = it->second; m_nonMatchingUsers.erase(it); @@ -1292,7 +1292,7 @@ GeneralsClientMatcher::GeneralsClientMatcher() void GeneralsClientMatcher::init(void) { - m_baseNick.setFormatted("qmBot%d", time(NULL)); + m_baseNick.setFormatted("qmBot%d", time(nullptr)); m_profileID = 0; } diff --git a/Core/Tools/matchbot/global.cpp b/Core/Tools/matchbot/global.cpp index 1abe63c1cf4..d6ea067d362 100644 --- a/Core/Tools/matchbot/global.cpp +++ b/Core/Tools/matchbot/global.cpp @@ -27,7 +27,7 @@ GlobalClass::GlobalClass(void) bool GlobalClass::ReadFile(const char *fname) { FILE *fp; - if ((fp = fopen(fname, "r")) == NULL) + if ((fp = fopen(fname, "r")) == nullptr) return false; config.readFile(fp); fclose(fp); diff --git a/Core/Tools/matchbot/main.cpp b/Core/Tools/matchbot/main.cpp index 8b0a78fb571..6365cab7ce8 100644 --- a/Core/Tools/matchbot/main.cpp +++ b/Core/Tools/matchbot/main.cpp @@ -56,8 +56,8 @@ static const char *Program_Usage = "A config filename can be given on the comman void logMonitor(void *); void paranoidLogMonitor(void *); -OutputDevice * output_device = NULL; -OutputDevice * paranoid_output_device = NULL; +OutputDevice * output_device = nullptr; +OutputDevice * paranoid_output_device = nullptr; void Signal_Quit(int) @@ -111,8 +111,8 @@ int VerifyFileDescriptors(int requested) -GeneralsMatcher *s_generalsMatcher = NULL; -GeneralsClientMatcher *s_generalsClientMatcher = NULL; +GeneralsMatcher *s_generalsMatcher = nullptr; +GeneralsClientMatcher *s_generalsClientMatcher = nullptr; int main(int argc, char ** argv) { @@ -124,7 +124,7 @@ int main(int argc, char ** argv) // Read the config file FILE *fp; - if ((fp = fopen(config_fname.get(), "r")) == NULL) + if ((fp = fopen(config_fname.get(), "r")) == nullptr) { cerr << "\nCan't open the config file '" << config_fname.get() << "'\n\n"; cerr << Program_Usage << endl; @@ -241,10 +241,10 @@ int main(int argc, char ** argv) } delete s_generalsMatcher; - s_generalsMatcher = NULL; + s_generalsMatcher = nullptr; delete s_generalsClientMatcher; - s_generalsClientMatcher = NULL; + s_generalsClientMatcher = nullptr; return 0; } @@ -269,7 +269,7 @@ void logMonitor(void *) return ; while (1) { - curtime = time(NULL); + curtime = time(nullptr); // get the number of seconds that have passed since midnight // of the current day. curtime -= TimezoneOffset(); @@ -345,7 +345,7 @@ void paranoidLogMonitor(void *) return ; while (1) { - curtime = time(NULL); + curtime = time(nullptr); // get the number of seconds that have passed since midnight // of the current day. curtime -= TimezoneOffset(); diff --git a/Core/Tools/matchbot/matcher.cpp b/Core/Tools/matchbot/matcher.cpp index 53f4c95a568..4d6e9d51c79 100644 --- a/Core/Tools/matchbot/matcher.cpp +++ b/Core/Tools/matchbot/matcher.cpp @@ -61,7 +61,7 @@ void MatcherClass::readLoop(void) do { static time_t lastLogTime = 0; - time_t now = time(NULL); + time_t now = time(nullptr); if (now > lastLogTime + 300) { lastLogTime = now; @@ -89,7 +89,7 @@ void MatcherClass::readLoop(void) #ifdef _UNIX Xtime xtime; time_t curtime; - curtime = time(NULL); + curtime = time(nullptr); // get the number of seconds that have passed since midnight // of the current day. curtime -= TimezoneOffset(); @@ -219,7 +219,7 @@ static void NickErrorCallback ( PEER peer, int type, const char * badNick, int n else { // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); MatcherClass *matcher = (MatcherClass *)param; if (matcher) matcher->handleNickError( badNick ); @@ -228,7 +228,7 @@ static void NickErrorCallback ( PEER peer, int type, const char * badNick, int n else { // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); MatcherClass *matcher = (MatcherClass *)param; if (matcher) matcher->handleNickError( badNick ); @@ -272,7 +272,7 @@ void MatcherClass::handleConnect( bool success ) m_connectSuccess = success; //DEBUG_LOG(("Enumerating chat channels")); - //chatEnumChannels( peerGetChat(m_peer), "", callbackEach, callbackAll, NULL, CHATTrue ); + //chatEnumChannels( peerGetChat(m_peer), "", callbackEach, callbackAll, nullptr, CHATTrue ); //DEBUG_LOG(("Done enumerating chat channels")); } @@ -396,7 +396,7 @@ void MatcherClass::connectAndLoop(void) } m_groupID = 0; - peerListGroupRooms(m_peer, NULL, ListGroupRoomsCallback, &m_groupID, PEERTrue); + peerListGroupRooms(m_peer, nullptr, ListGroupRoomsCallback, &m_groupID, PEERTrue); m_groupID = s_groupID; DBGMSG("QuickMatch room is " << m_groupID); diff --git a/Core/Tools/matchbot/mydebug.cpp b/Core/Tools/matchbot/mydebug.cpp index 3ad1e156e40..5ae6a702c12 100644 --- a/Core/Tools/matchbot/mydebug.cpp +++ b/Core/Tools/matchbot/mydebug.cpp @@ -22,10 +22,10 @@ #include "odevice.h" -// static MyMsgManager *msg_manager=NULL; +// static MyMsgManager *msg_manager=nullptr; // static int paranoid_enabled=0; -static ostream *paranoid_ostream=NULL; +static ostream *paranoid_ostream=nullptr; static Streamer paranoid_streamer; // Don't dare touch this semaphore in application code! @@ -38,7 +38,7 @@ CritSec MyDebugLibSemaphore; int MyMsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); MYDEBUGLOCK; @@ -54,7 +54,7 @@ int MyMsgManager::setAllStreams(OutputDevice *device) int MyMsgManager::setParanoidStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); MYDEBUGLOCK; diff --git a/Core/Tools/matchbot/wlib/arraylist.h b/Core/Tools/matchbot/wlib/arraylist.h index 58c8481842b..5b1d4356730 100644 --- a/Core/Tools/matchbot/wlib/arraylist.h +++ b/Core/Tools/matchbot/wlib/arraylist.h @@ -131,7 +131,7 @@ ArrayList::ArrayList() { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; } // copy constructor @@ -140,7 +140,7 @@ ArrayList::ArrayList(ArrayList &other) { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; (*this)=other; } @@ -653,7 +653,7 @@ bit8 ArrayList::growVector(void) T *newVector=(T *)(new uint8[newSlots * sizeof(T)]); memset(newVector,0,newSlots * sizeof(T)); // zero just to be safe - if (Vector_ != NULL) + if (Vector_ != nullptr) memcpy(newVector,Vector_,Entries_*sizeof(T)); delete[]((uint8 *)Vector_); // Get rid of the old vector without calling @@ -692,7 +692,7 @@ bit8 ArrayList::shrinkVector(void) // T *newVector=(T *)(new uint8[newSlots * sizeof(T)]); - if (Vector_ != NULL) // Vector_ better not be NULL! + if (Vector_ != nullptr) // Vector_ better not be nullptr! memcpy(newVector,Vector_,Entries_*sizeof(T)); delete[]((uint8 *)Vector_); // Get rid of the old vector without calling diff --git a/Core/Tools/matchbot/wlib/configfile.cpp b/Core/Tools/matchbot/wlib/configfile.cpp index b8d465b750a..ec38b358598 100644 --- a/Core/Tools/matchbot/wlib/configfile.cpp +++ b/Core/Tools/matchbot/wlib/configfile.cpp @@ -97,7 +97,7 @@ bit8 ConfigFile::readFile(FILE *in) continue; } - if (strchr(cptr,'=')==NULL) // All config entries must have a '=' + if (strchr(cptr,'=')==nullptr) // All config entries must have a '=' continue; key=cptr; key.truncate('='); @@ -152,7 +152,7 @@ bit8 ConfigFile::enumerate(int &index, int &offset, Wstring &key, Wstring &value } Critsec_.unlock(); - if (section==NULL) // no specified section, so any will do... + if (section==nullptr) // no specified section, so any will do... break; if (strlen(section)+2 >= strlen(key.get())) // key should have form: X[section] diff --git a/Core/Tools/matchbot/wlib/configfile.h b/Core/Tools/matchbot/wlib/configfile.h index eba5a02c811..cf793ca1e34 100644 --- a/Core/Tools/matchbot/wlib/configfile.h +++ b/Core/Tools/matchbot/wlib/configfile.h @@ -40,25 +40,25 @@ class ConfigFile ConfigFile(); ~ConfigFile(); bit8 readFile(FILE *config); - bit8 getString(IN Wstring &key,OUT Wstring &value, IN char *section=NULL) const; - bit8 getString(IN char *key,OUT Wstring &value, IN char *section=NULL) const; + bit8 getString(IN Wstring &key,OUT Wstring &value, IN char *section=nullptr) const; + bit8 getString(IN char *key,OUT Wstring &value, IN char *section=nullptr) const; - bit8 getInt(IN Wstring &key,OUT sint32 &value, IN char *section=NULL) const; - bit8 getInt(IN char *key,OUT sint32 &value, IN char *section=NULL) const; + bit8 getInt(IN Wstring &key,OUT sint32 &value, IN char *section=nullptr) const; + bit8 getInt(IN char *key,OUT sint32 &value, IN char *section=nullptr) const; - bit8 getInt(IN Wstring &key,OUT sint16 &value, IN char *section=NULL) const; - bit8 getInt(IN char *key,OUT sint16 &value, IN char *section=NULL) const; + bit8 getInt(IN Wstring &key,OUT sint16 &value, IN char *section=nullptr) const; + bit8 getInt(IN char *key,OUT sint16 &value, IN char *section=nullptr) const; // Enumerate through the config lines - bit8 enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section=NULL) const; + bit8 enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section=nullptr) const; // Manual update of config file - bit8 setString(IN Wstring &key,IN Wstring &value, IN char *section=NULL); - bit8 setString(IN char *key,IN Wstring &value, IN char *section=NULL); - bit8 setInt(IN Wstring &key,IN sint32 &value, IN char *section=NULL); - bit8 setInt(IN char *key,IN sint32 &value, IN char *section=NULL); - bit8 removeEntry(IN Wstring &key, IN char *section=NULL); - bit8 removeEntry(IN char *key, IN char *section=NULL); + bit8 setString(IN Wstring &key,IN Wstring &value, IN char *section=nullptr); + bit8 setString(IN char *key,IN Wstring &value, IN char *section=nullptr); + bit8 setInt(IN Wstring &key,IN sint32 &value, IN char *section=nullptr); + bit8 setInt(IN char *key,IN sint32 &value, IN char *section=nullptr); + bit8 removeEntry(IN Wstring &key, IN char *section=nullptr); + bit8 removeEntry(IN char *key, IN char *section=nullptr); bit8 writeFile(FILE *config); // Does not preserve comments, etc ArrayList sectionList; // stores the names of all sections diff --git a/Core/Tools/matchbot/wlib/critsec.cpp b/Core/Tools/matchbot/wlib/critsec.cpp index d02aae76c9b..f0df292f172 100644 --- a/Core/Tools/matchbot/wlib/critsec.cpp +++ b/Core/Tools/matchbot/wlib/critsec.cpp @@ -25,7 +25,7 @@ CritSec::CritSec() { #ifdef _UNIX - pthread_mutex_init(&Mutex_, NULL); + pthread_mutex_init(&Mutex_, nullptr); RefCount_ = 0; #elif defined(_WIN32) InitializeCriticalSection(&CritSec_); diff --git a/Core/Tools/matchbot/wlib/critsec.h b/Core/Tools/matchbot/wlib/critsec.h index 687667d74d8..07d21bee973 100644 --- a/Core/Tools/matchbot/wlib/critsec.h +++ b/Core/Tools/matchbot/wlib/critsec.h @@ -45,7 +45,7 @@ class CritSec CritSec(); ~CritSec(); - sint32 lock(int *refcount=NULL) RO; + sint32 lock(int *refcount=nullptr) RO; sint32 unlock(void) RO; protected: diff --git a/Core/Tools/matchbot/wlib/dictionary.h b/Core/Tools/matchbot/wlib/dictionary.h index 2a21b5273b3..fde42c3c4a7 100644 --- a/Core/Tools/matchbot/wlib/dictionary.h +++ b/Core/Tools/matchbot/wlib/dictionary.h @@ -83,7 +83,7 @@ Dictionary(uint32 (*hashFn)(const K &key)) : //Table is a pointer to a list of pointers (the hash table) table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); hashFunc=hashFn; @@ -151,13 +151,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -189,7 +189,7 @@ void Dictionary::print(FILE *out) RO fprintf(out," |\n"); fprintf(out,"[ ]"); - while (temp!=NULL) + while (temp!=nullptr) { fprintf(out,"--[ ]"); temp=temp->hashNext; @@ -223,27 +223,27 @@ bit8 Dictionary::iterate(INOUT int &index,INOUT int &offset, return(FALSE); temp=table[index]; - while ((temp==NULL)&&((++index) < (int)getSize())) + while ((temp==nullptr)&&((++index) < (int)getSize())) { temp=table[index]; offset=0; } - if (temp==NULL) // no more slots with data + if (temp==nullptr) // no more slots with data return(FALSE); uint32 i=0; - while ((temp!=NULL) && ((int)i < offset)) + while ((temp!=nullptr) && ((int)i < offset)) { temp=temp->hashNext; i++; } - if (temp==NULL) // should never happen + if (temp==nullptr) // should never happen return(FALSE); value=temp->value; - if (temp->hashNext==NULL) + if (temp->hashNext==nullptr) { index++; offset=0; @@ -272,28 +272,28 @@ bit8 Dictionary::iterate(INOUT int &index,INOUT int &offset, return(FALSE); temp=table[index]; - while ((temp==NULL)&&((++index) < (int)getSize())) + while ((temp==nullptr)&&((++index) < (int)getSize())) { temp=table[index]; offset=0; } - if (temp==NULL) // no more slots with data + if (temp==nullptr) // no more slots with data return(FALSE); uint32 i=0; - while ((temp!=NULL) && ((int)i < offset)) + while ((temp!=nullptr) && ((int)i < offset)) { temp=temp->hashNext; i++; } - if (temp==NULL) // should never happen + if (temp==nullptr) // should never happen return(FALSE); value=temp->value; key=temp->key; - if (temp->hashNext==NULL) + if (temp->hashNext==nullptr) { index++; offset=0; @@ -330,10 +330,10 @@ bit8 Dictionary::contains(IN K &key) RO node=table[offset]; - if (node==NULL) + if (node==nullptr) { return(FALSE); } // can't find it - while(node!=NULL) + while(node!=nullptr) { if ((node->key)==key) { return(TRUE); } @@ -367,7 +367,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) float percent; item=(DNode *)new DNode; - assert(item!=NULL); + assert(item!=nullptr); #ifdef KEY_MEM_OPS memcpy(&(item->key),&key,sizeof(K)); @@ -381,7 +381,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) item->value=value; #endif - item->hashNext=NULL; + item->hashNext=nullptr; //If key already exists, it will be overwritten remove(key); // Hopefully this will be false... @@ -390,7 +390,7 @@ bit8 Dictionary::add(IN K &key,IN V &value) node=table[offset]; - if (node==NULL) + if (node==nullptr) { table[offset]=item; } else { @@ -425,7 +425,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) node=table[offset]; last=node; - if (node==NULL) + if (node==nullptr) return(FALSE); //special case table points to thing to delete @@ -454,7 +454,7 @@ bit8 Dictionary::remove(IN K &key,OUT V &value) bit8 retval=FALSE; // wow, didn't add this for years... (DOH!) //Now the case if the thing to delete is not the first - while (node!=NULL) + while (node!=nullptr) { #ifdef KEY_MEM_OPS if (0==memcmp(&(node->key),&key,sizeof(K))) @@ -508,7 +508,7 @@ bit8 Dictionary::removeAny(OUT K &key,OUT V &value) int i; offset=-1; for (i=0; i<(int)getSize(); i++) - if (table[i]!=NULL) + if (table[i]!=nullptr) { offset=i; break; @@ -544,7 +544,7 @@ bit8 Dictionary::removeAny(OUT K &key,OUT V &value) template bool Dictionary::getValue(IN K &key,OUT V &value) RO { - V *valptr=NULL; + V *valptr=nullptr; bool retval=getPointer(key,&valptr); if (retval && valptr) { @@ -572,17 +572,17 @@ bool Dictionary::getPointer(IN K &key,OUT V **valptr) RO node=table[offset]; - if (node==NULL) + if (node==nullptr) return(FALSE); #ifdef KEY_MEM_OPS - while ((node!=NULL)&&(memcmp(&(node->key),&key,sizeof(K)))) + while ((node!=nullptr)&&(memcmp(&(node->key),&key,sizeof(K)))) #else - while ((node!=NULL)&&( ! ((node->key)==key)) ) // odd syntax so you don't + while ((node!=nullptr)&&( ! ((node->key)==key)) ) // odd syntax so you don't #endif // have to do oper != { node=node->hashNext; } - if (node==NULL) + if (node==nullptr) { return(FALSE); } *valptr=&(node->value); @@ -615,13 +615,13 @@ void Dictionary::shrink(void) tableBits--; table=(DNode **)new DNode*[size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; @@ -654,13 +654,13 @@ void Dictionary::expand(void) tableBits++; table=(DNode **)new DNode* [size]; - assert(table!=NULL); + assert(table!=nullptr); memset((void *)table,0,size*sizeof(void *)); for (i=0; ikey); first=table[offset]; diff --git a/Core/Tools/matchbot/wlib/filed.h b/Core/Tools/matchbot/wlib/filed.h index 2d00ab1afa3..4d2a6fa29cd 100644 --- a/Core/Tools/matchbot/wlib/filed.h +++ b/Core/Tools/matchbot/wlib/filed.h @@ -26,7 +26,7 @@ class FileD : public OutputDevice FileD(IN char *filename, IN char *mode = "w") { out=fopen(filename,mode); - if (out==NULL) + if (out==nullptr) out=fopen("FileDev.out",mode); } diff --git a/Core/Tools/matchbot/wlib/linkedlist.h b/Core/Tools/matchbot/wlib/linkedlist.h index 8589c3c45c3..a0cc1908348 100644 --- a/Core/Tools/matchbot/wlib/linkedlist.h +++ b/Core/Tools/matchbot/wlib/linkedlist.h @@ -63,9 +63,9 @@ class LinkedList void clear(void); // Add a node after the zero based 'pos' - bit8 add(IN T &node,sint32 pos, OUT T **newnodeptr=NULL); - bit8 addTail(IN T &node, OUT T **newnodeptr=NULL); - bit8 addHead(IN T &node, OUT T **newnodeptr=NULL); + bit8 add(IN T &node,sint32 pos, OUT T **newnodeptr=nullptr); + bit8 addTail(IN T &node, OUT T **newnodeptr=nullptr); + bit8 addHead(IN T &node, OUT T **newnodeptr=nullptr); // Remove a node bit8 remove(OUT T &node,sint32 pos); @@ -106,7 +106,7 @@ template LinkedList::LinkedList() { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries } @@ -115,7 +115,7 @@ template LinkedList::LinkedList(LinkedList &other) { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries (*this)=other; } @@ -156,7 +156,7 @@ void LinkedList::clear() } Entries=0; CurIndex=-1; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; } // When adding into a position, the new node goes at the zero based slot @@ -173,10 +173,10 @@ bit8 LinkedList::add(IN T &node,sint32 pos, OUT T **newnodeptr) pos=Entries; item=(LNode *)new LNode; - assert(item!=NULL); + assert(item!=nullptr); item->Node=node; // copy the passed in object - item->Prev=NULL; - item->Next=NULL; + item->Prev=nullptr; + item->Next=nullptr; if (newnodeptr) *newnodeptr=&(item->Node); @@ -228,7 +228,7 @@ bit8 LinkedList::add(IN T &node,sint32 pos, OUT T **newnodeptr) temp=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(temp!=NULL); + assert(temp!=nullptr); } item->Next=temp; item->Prev=temp->Prev; @@ -278,7 +278,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) if (pos==0) { item=Head; if (item->Next) - item->Next->Prev=NULL; + item->Next->Prev=nullptr; Head=item->Next; node=item->Node; Current=Head; @@ -287,7 +287,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) if (pos==Entries-1) { item=Tail; if (item->Prev) - item->Prev->Next=NULL; + item->Prev->Next=nullptr; Tail=item->Prev; node=item->Node; Current=Tail; @@ -297,10 +297,10 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) Entries--; if (Entries==0) { // Super paranoia check - assert(Current==NULL); + assert(Current==nullptr); assert(CurIndex==-1); - assert(Head==NULL); - assert(Tail==NULL); + assert(Head==nullptr); + assert(Tail==nullptr); } return(TRUE); } @@ -337,7 +337,7 @@ bit8 LinkedList::remove(OUT T &node, sint32 pos) item=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(item!=NULL); + assert(item!=nullptr); } item->Prev->Next=item->Next; @@ -441,7 +441,7 @@ bit8 LinkedList::getPointer(OUT T **node,sint32 pos) item=Head->Next; // Can start at node '1' because head was special cased for (int i=1; iNext; - assert(item!=NULL); + assert(item!=nullptr); } *node=&(item->Node); CurIndex=pos; diff --git a/Core/Tools/matchbot/wlib/mboxd.h b/Core/Tools/matchbot/wlib/mboxd.h index a45eff3700a..4f61e9ae7ca 100644 --- a/Core/Tools/matchbot/wlib/mboxd.h +++ b/Core/Tools/matchbot/wlib/mboxd.h @@ -29,7 +29,7 @@ class MboxD : public OutputDevice char *string=new char[len+1]; memset(string,0,len+1); memcpy(string,str,len); - MessageBox(NULL,string,"Debug Message", MB_OK | MB_ICONINFORMATION); + MessageBox(nullptr,string,"Debug Message", MB_OK | MB_ICONINFORMATION); delete[](string); return(len); } diff --git a/Core/Tools/matchbot/wlib/monod.cpp b/Core/Tools/matchbot/wlib/monod.cpp index 103409de5c2..ffda85ac28c 100644 --- a/Core/Tools/matchbot/wlib/monod.cpp +++ b/Core/Tools/matchbot/wlib/monod.cpp @@ -22,12 +22,12 @@ MonoD::MonoD(void) { #ifdef _WIN32 unsigned long retval; - handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { - DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, + DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, nullptr, 0, nullptr, 0, &retval,0); } #endif @@ -37,7 +37,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +45,8 @@ int MonoD::print(const char *str, int len) { #ifdef _WIN32 unsigned long retval; - WriteFile(handle, str, len, &retval, NULL); - ////DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, NULL, 0, + WriteFile(handle, str, len, &retval, nullptr); + ////DeviceIoControl(handle, (DWORD)IOCTL_MONO_PRINT_RAW, (void *)str, len, nullptr, 0, //// &retval,0); return(len); #else diff --git a/Core/Tools/matchbot/wlib/sem4.cpp b/Core/Tools/matchbot/wlib/sem4.cpp index e11b95a362f..12ccb5c6480 100644 --- a/Core/Tools/matchbot/wlib/sem4.cpp +++ b/Core/Tools/matchbot/wlib/sem4.cpp @@ -34,7 +34,7 @@ Sem4::Sem4() #ifndef _WIN32 sem_init(&sem,1,1); #else - sem = CreateSemaphore(NULL, 1, 1, NULL); + sem = CreateSemaphore(nullptr, 1, 1, nullptr); #endif } @@ -43,7 +43,7 @@ Sem4::Sem4(uint32 value) #ifndef _WIN32 sem_init(&sem,1,value); #else - sem = CreateSemaphore(NULL, value, value, NULL); + sem = CreateSemaphore(nullptr, value, value, nullptr); #endif } @@ -84,7 +84,7 @@ sint32 Sem4::Post(void) const #else if (!sem) return -1; - if (!ReleaseSemaphore(sem, 1 ,NULL)) + if (!ReleaseSemaphore(sem, 1 ,nullptr)) return -1; return 0; #endif diff --git a/Core/Tools/matchbot/wlib/streamer.cpp b/Core/Tools/matchbot/wlib/streamer.cpp index 061baad77db..f81be59597f 100644 --- a/Core/Tools/matchbot/wlib/streamer.cpp +++ b/Core/Tools/matchbot/wlib/streamer.cpp @@ -28,7 +28,7 @@ #define STREAMER_UNBUFFERED 0 #endif -Streamer::Streamer() : streambuf(), Output_Device(NULL), Buf(NULL) +Streamer::Streamer() : streambuf(), Output_Device(nullptr), Buf(nullptr) { #if defined(USING_STLPORT) || (defined(_MSC_VER) && _MSC_VER < 1300) int state=unbuffered(); @@ -101,7 +101,7 @@ int Streamer::underflow(void) int Streamer::doallocate() { - if (Buf==NULL) + if (Buf==nullptr) { Buf=new char[(2*STREAMER_BUFSIZ)]; // deleted by destructor memset(Buf,0,2*STREAMER_BUFSIZ); diff --git a/Core/Tools/matchbot/wlib/threadfac.cpp b/Core/Tools/matchbot/wlib/threadfac.cpp index e9934e71b6d..7ba7f3b65a1 100644 --- a/Core/Tools/matchbot/wlib/threadfac.cpp +++ b/Core/Tools/matchbot/wlib/threadfac.cpp @@ -73,8 +73,8 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) // use all the normal C library stuff. (IMPORTANT!!!) uint32 handle; uint32 stup1d; - handle=_beginthreadex(NULL,0, threadClassLauncher, tInfo, 0, &stup1d); - if (handle!=NULL) + handle=_beginthreadex(nullptr,0, threadClassLauncher, tInfo, 0, &stup1d); + if (handle!=nullptr) return(TRUE); else { @@ -92,7 +92,7 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) pthread_attr_init(&threadAttr); pthread_attr_setdetachstate(&threadAttr, PTHREAD_CREATE_DETACHED); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); - retval=pthread_create(NULL,&threadAttr, threadClassLauncher, tInfo); + retval=pthread_create(nullptr,&threadAttr, threadClassLauncher, tInfo); if (retval==0) return(TRUE); else @@ -126,8 +126,8 @@ bit8 ThreadFactory::startThread(void (*start_func)(void *), void *data) // use all the normal C library stuff. (IMPORTANT!!!) uint32 handle; unsigned temp; - handle=_beginthreadex(NULL,0, threadFuncLauncher, tInfo, 0, &temp); - if (handle!=NULL) + handle=_beginthreadex(nullptr,0, threadFuncLauncher, tInfo, 0, &temp); + if (handle!=nullptr) return(TRUE); return(FALSE); #else // UNIX @@ -137,7 +137,7 @@ bit8 ThreadFactory::startThread(void (*start_func)(void *), void *data) pthread_attr_init(&threadAttr); pthread_attr_setdetachstate(&threadAttr, PTHREAD_CREATE_DETACHED); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); - retval=pthread_create(NULL,&threadAttr, threadFuncLauncher, tInfo); + retval=pthread_create(nullptr,&threadAttr, threadFuncLauncher, tInfo); if (retval==0) return(TRUE); else diff --git a/Core/Tools/matchbot/wlib/wdebug.cpp b/Core/Tools/matchbot/wlib/wdebug.cpp index 8dd5005ecbc..f61cc34aadd 100644 --- a/Core/Tools/matchbot/wlib/wdebug.cpp +++ b/Core/Tools/matchbot/wlib/wdebug.cpp @@ -22,22 +22,22 @@ #include "odevice.h" -static MsgManager *msg_manager=NULL; +static MsgManager *msg_manager=nullptr; static int debug_enabled=0; -static ostream *debug_ostream=NULL; +static ostream *debug_ostream=nullptr; static Streamer debug_streamer; static int info_enabled=0; -static ostream *info_ostream=NULL; +static ostream *info_ostream=nullptr; static Streamer info_streamer; static int warn_enabled=0; -static ostream *warn_ostream=NULL; +static ostream *warn_ostream=nullptr; static Streamer warn_streamer; static int error_enabled=0; -static ostream *error_ostream=NULL; +static ostream *error_ostream=nullptr; static Streamer error_streamer; @@ -51,7 +51,7 @@ CritSec DebugLibSemaphore; int MsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -112,7 +112,7 @@ int MsgManager::ReplaceAllStreams(FileD * output_device, IN char *device_filenam int MsgManager::setDebugStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -125,7 +125,7 @@ int MsgManager::setDebugStream(OutputDevice *device) int MsgManager::setInfoStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -138,7 +138,7 @@ int MsgManager::setInfoStream(OutputDevice *device) int MsgManager::setWarnStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -151,7 +151,7 @@ int MsgManager::setWarnStream(OutputDevice *device) int MsgManager::setErrorStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; diff --git a/Core/Tools/matchbot/wlib/wstring.cpp b/Core/Tools/matchbot/wlib/wstring.cpp index a19c9aaa002..2d19f92e19b 100644 --- a/Core/Tools/matchbot/wlib/wstring.cpp +++ b/Core/Tools/matchbot/wlib/wstring.cpp @@ -39,15 +39,15 @@ string to it's own memory (for assignment or construction). #define PADSIZE 32 // include a little padding on alloc for future growth -Wstring::Wstring() : str(NULL), strsize(0) +Wstring::Wstring() : str(nullptr), strsize(0) { } -Wstring::Wstring(const char *string):str(NULL), strsize(0) +Wstring::Wstring(const char *string):str(nullptr), strsize(0) { set(string); } -Wstring::Wstring(const Wstring &other):str(NULL), strsize(0) +Wstring::Wstring(const Wstring &other):str(nullptr), strsize(0) { - if (other.str!=NULL) + if (other.str!=nullptr) { str=new char[strlen(other.str)+PADSIZE+1]; strsize=strlen(other.str)+PADSIZE+1; @@ -62,10 +62,10 @@ Wstring::~Wstring() bool Wstring::operator<(const Wstring &other) const { - if (str == NULL && other.str == NULL) + if (str == nullptr && other.str == nullptr) return false; - if (str == NULL) + if (str == nullptr) return true; return ( strcmp(str, other.str) < 0 ); @@ -73,7 +73,7 @@ bool Wstring::operator<(const Wstring &other) const bit8 Wstring::operator==(const char *other) const { - if ((str==NULL)&&(other==NULL)) + if ((str==nullptr)&&(other==nullptr)) return(TRUE); if(strcmp(str, other) != 0) return(FALSE); @@ -83,10 +83,10 @@ bit8 Wstring::operator==(const char *other) const bit8 Wstring::operator==(const Wstring &other) const { - if((str == NULL) && (other.str == NULL)) + if((str == nullptr) && (other.str == nullptr)) return(TRUE); - if((str == NULL) || (other.str == NULL)) + if((str == nullptr) || (other.str == nullptr)) return(FALSE); if(strcmp(str, other.str) != 0) @@ -107,10 +107,10 @@ bit8 Wstring::operator!=(const char *other) const bit8 Wstring::operator!=(const Wstring &other) const { - if((str == NULL) && (other.str == NULL)) + if((str == nullptr) && (other.str == nullptr)) return(FALSE); - if((str == NULL) || (other.str == NULL)) + if((str == nullptr) || (other.str == nullptr)) return(TRUE); if(strcmp(str, other.str) != 0) @@ -141,7 +141,7 @@ bit8 Wstring::cat(const char *s) { uint32 len; - if (s==NULL) // it's OK to cat nothing + if (s==nullptr) // it's OK to cat nothing return(TRUE); // Determine the length of the resultant string. @@ -240,14 +240,14 @@ char Wstring::remove(sint32 pos,sint32 count) bit8 Wstring::removeChar(char c) { int len=0; - char *cptr=NULL; + char *cptr=nullptr; bit8 removed=FALSE; - if (str==NULL) + if (str==nullptr) return(FALSE); len=strlen(str); - while ((cptr=strchr(str,c)) !=NULL) + while ((cptr=strchr(str,c)) !=nullptr) { memmove(cptr,cptr+1,len-1-((int)(cptr-str))); len--; @@ -267,7 +267,7 @@ void Wstring::clear(void) { delete[](str); strsize=0; - str=NULL; + str=nullptr; } // This is usually used for raw storage instead of string ops... @@ -308,7 +308,7 @@ char Wstring::get(uint32 index) const uint32 Wstring::length(void) const { - if(str == NULL) + if(str == nullptr) return(0); return((uint32)strlen(str)); } @@ -317,7 +317,7 @@ uint32 Wstring::length(void) const // Insert at given position and shift old stuff to right bit8 Wstring::insert(const char *instring, uint32 pos) { - if (str==NULL) + if (str==nullptr) return(set(instring)); if (pos>strlen(str)) pos=strlen(str); @@ -397,7 +397,7 @@ bit8 Wstring::replace(const char *replaceThis,const char *withThis) if(!dest.cat(src)) return(FALSE); - src=NULL; + src=nullptr; } } return(set(dest.get())); @@ -445,7 +445,7 @@ char Wstring::set(uint32 size, const char *string) // work in all cases, but this should be good enough for 99% of Wstring usage. char Wstring::setFormatted(const char *msg, ...) { - if( msg == NULL || strlen(msg) <= 0 ) return FALSE; + if( msg == nullptr || strlen(msg) <= 0 ) return FALSE; char* string; va_list args; @@ -506,11 +506,11 @@ bit8 Wstring::truncate(char c) { sint32 len; - if (str==NULL) + if (str==nullptr) return(FALSE); char *cptr=strchr(str,c); - if (cptr==NULL) + if (cptr==nullptr) return(FALSE); len=(sint32)(cptr-str); truncate((uint32)len); @@ -529,7 +529,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const return(-1); for (i=offset; i<(int)length(); i++) { - if(strchr(delim,str[i])==NULL) + if(strchr(delim,str[i])==nullptr) break; } if (i>=(int)length()) @@ -537,7 +537,7 @@ sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const start=i; for (; i<(int)length(); i++) { - if(strchr(delim,str[i])!=NULL) + if(strchr(delim,str[i])!=nullptr) break; } stop=i-1; @@ -558,7 +558,7 @@ sint32 Wstring::getLine(int offset, Wstring &out) return(-1); for (; i<(int)length(); i++) { - if(strchr("\r\n",str[i])!=NULL) + if(strchr("\r\n",str[i])!=nullptr) break; } stop=i; @@ -575,7 +575,7 @@ sint32 Wstring::getLine(int offset, Wstring &out) // void Wstring::strgrow(int length) { - if (str==NULL) + if (str==nullptr) { str=new char[length+PADSIZE]; str[0]=0; diff --git a/Core/Tools/matchbot/wlib/wstypes.h b/Core/Tools/matchbot/wlib/wstypes.h index c13ef1fa3c8..f46fd77ab86 100644 --- a/Core/Tools/matchbot/wlib/wstypes.h +++ b/Core/Tools/matchbot/wlib/wstypes.h @@ -72,10 +72,6 @@ Standard type definitions for the sake of portability and readability. #define MAX(x,y) (((x)>(y))?(x):(y)) #endif -#ifndef NULL -#define NULL 0 -#endif - //These are used for readability purposes mostly, when a method takes a // pointer or reference these help specify what will happen to the data // that is sent in. diff --git a/Core/Tools/matchbot/wlib/xtime.cpp b/Core/Tools/matchbot/wlib/xtime.cpp index d36a7ec1875..95f6533d144 100644 --- a/Core/Tools/matchbot/wlib/xtime.cpp +++ b/Core/Tools/matchbot/wlib/xtime.cpp @@ -205,7 +205,7 @@ int main(int argc, char *argv[]) unixtime.tv_usec=0; //gettimeofday(&unixtime,&unixtzone); - //ttime=time(NULL); + //ttime=time(nullptr); tmtime=*gmtime(&ttime); printf("TIME->CTIME = %s\n",ctime(&ttime)); diff --git a/Core/Tools/matchbot/wnet/field.cpp b/Core/Tools/matchbot/wnet/field.cpp index 699b52507cd..a8f405bd145 100644 --- a/Core/Tools/matchbot/wnet/field.cpp +++ b/Core/Tools/matchbot/wnet/field.cpp @@ -51,56 +51,56 @@ void FieldClass::Clear(void) strcpy(ID,""); DataType=0; Size=0; - Data=NULL; - Next=NULL; + Data=nullptr; + Next=nullptr; } FieldClass::FieldClass(char *id, char data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned char data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, short data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned short data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, long data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, unsigned long data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, char *data) { - Data=NULL; + Data=nullptr; Set(id,data); } FieldClass::FieldClass(char *id, void *data, int length) { - Data=NULL; + Data=nullptr; Set(id,data,length); } diff --git a/Core/Tools/matchbot/wnet/field.h b/Core/Tools/matchbot/wnet/field.h index de573ddbeec..da3e5d00d39 100644 --- a/Core/Tools/matchbot/wnet/field.h +++ b/Core/Tools/matchbot/wnet/field.h @@ -35,6 +35,8 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#pragma once + #define FIELD_HEADER_SIZE (sizeof(FieldClass) - (sizeof(void *) * 2)) #define TYPE_CHAR 1 diff --git a/Core/Tools/matchbot/wnet/packet.cpp b/Core/Tools/matchbot/wnet/packet.cpp index 8cda4f64b01..5426d75b6ae 100644 --- a/Core/Tools/matchbot/wnet/packet.cpp +++ b/Core/Tools/matchbot/wnet/packet.cpp @@ -114,7 +114,7 @@ PacketClass::PacketClass(char *curbuf) ID = *((short *)curbuf); curbuf += sizeof(unsigned short); ID = ntohs(ID); - Head = NULL; + Head = nullptr; // // Calculate the remaining size so that we can loop through the @@ -268,7 +268,7 @@ FieldClass *PacketClass::Find_Field(char *id) if ( strncmp(id, current->ID, 4) == 0) return current; } - return NULL; + return nullptr; } // gks 9/25/2000 @@ -280,7 +280,7 @@ FieldClass *PacketClass::Get_Field_At(int position) } if (current) return current; - else return NULL; + else return nullptr; } // gks 9/25/2000 diff --git a/Core/Tools/matchbot/wnet/tcp.cpp b/Core/Tools/matchbot/wnet/tcp.cpp index 66ea079c7af..f48622cd564 100644 --- a/Core/Tools/matchbot/wnet/tcp.cpp +++ b/Core/Tools/matchbot/wnet/tcp.cpp @@ -472,7 +472,7 @@ char *TCP::Gets(char *string,int n,int whichFD) whichFD=GetFD(); if (whichFD <= 0) - return(NULL); + return(nullptr); memset(string,0,n); @@ -485,7 +485,7 @@ char *TCP::Gets(char *string,int n,int whichFD) if (! FD_ISSET(whichFD,&fdSet)) { DBGMSG("Gets timeout: " << inputDelay); - return(NULL); + return(nullptr); } retval=Read((unsigned char *)&c,1,whichFD); @@ -499,7 +499,7 @@ char *TCP::Gets(char *string,int n,int whichFD) else if ((retval==0)&&(i==0)) { DBGMSG("Remote endpoint closed (1)"); - return(NULL); + return(nullptr); } else if (retval==0) return(string); @@ -551,8 +551,8 @@ sint32 TCP::TimedRead(uint8 *msg,uint32 len,int seconds,sint32 whichFD) sint32 bytes_read=0; sint32 retval; - time_t stop_time=time(NULL)+seconds; - while ((time(NULL)<=stop_time)&&((uint32)bytes_read=0) done=1; @@ -892,7 +892,7 @@ bit8 TCP::Bind(char *Host,uint16 port,bit8 reuseAddr) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( Bind(ntohl(hostNode->s_addr),port,reuseAddr) ); @@ -978,7 +978,7 @@ bit8 TCP::Connect(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) {ERRMSG("Can't resolve host");return (0);} hostNode = (struct in_addr *) hostStruct->h_addr; return ( Connect(ntohl(hostNode->s_addr),port) ); @@ -1064,7 +1064,7 @@ bit8 TCP::ConnectAsync(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( ConnectAsync(ntohl(hostNode->s_addr),port) ); diff --git a/Core/Tools/matchbot/wnet/udp.cpp b/Core/Tools/matchbot/wnet/udp.cpp index bba9479b658..96037517e29 100644 --- a/Core/Tools/matchbot/wnet/udp.cpp +++ b/Core/Tools/matchbot/wnet/udp.cpp @@ -40,7 +40,7 @@ sint32 UDP::Bind(char *Host,uint16 port) strcpy(hostName, Host); hostStruct = gethostbyname(Host); - if (hostStruct == NULL) + if (hostStruct == nullptr) return (0); hostNode = (struct in_addr *) hostStruct->h_addr; return ( Bind(ntohl(hostNode->s_addr),port) ); @@ -158,7 +158,7 @@ sint32 UDP::Read(uint8 *msg,uint32 len,sockaddr_in *from) sint32 retval; int alen=sizeof(sockaddr_in); - if (from!=NULL) + if (from!=nullptr) { retval=recvfrom(fd,(char *)msg,len,0,(struct sockaddr *)from,&alen); #ifdef _WIN32 @@ -168,7 +168,7 @@ sint32 UDP::Read(uint8 *msg,uint32 len,sockaddr_in *from) } else { - retval=recvfrom(fd,(char *)msg,len,0,NULL,NULL); + retval=recvfrom(fd,(char *)msg,len,0,nullptr,nullptr); #ifdef _WIN32 if (retval==SOCKET_ERROR) retval=-1; @@ -267,7 +267,7 @@ int UDP::Wait(sint32 sec,sint32 usec,fd_set &givenSet,fd_set &returnSet) while( ! done) { if (noTimeout) - retval=select(givenMax+1,&returnSet,0,0,NULL); + retval=select(givenMax+1,&returnSet,0,0,nullptr); else { timeout.GetTimevalMT(tv); diff --git a/Core/Tools/textureCompress/textureCompress.cpp b/Core/Tools/textureCompress/textureCompress.cpp index 0eefe77166c..b13a413c9ac 100644 --- a/Core/Tools/textureCompress/textureCompress.cpp +++ b/Core/Tools/textureCompress/textureCompress.cpp @@ -41,14 +41,14 @@ static const char *nodxtPrefix[] = { "zhca", "caust", - NULL, + nullptr, }; static const char *nodxtAnywhere[] = { "userinterface", "controlbar", "commandbar", - NULL, + nullptr, }; #define LOG(x) logStuff x @@ -61,7 +61,7 @@ static void logStuff(const char *fmt, ...) va_end( va ); puts(buffer); - ::MessageBox(NULL, buffer, "textureCompress", MB_OK); + ::MessageBox(nullptr, buffer, "textureCompress", MB_OK); } #ifdef RTS_DEBUG @@ -70,12 +70,12 @@ class DebugMunkee { public: DebugMunkee(const char *fname = "debugLog.txt") { m_fp = fopen(fname, "w"); } - ~DebugMunkee() { if (m_fp) fclose(m_fp); m_fp = NULL; } + ~DebugMunkee() { if (m_fp) fclose(m_fp); m_fp = nullptr; } FILE *m_fp; }; -static DebugMunkee *theDebugMunkee = NULL; +static DebugMunkee *theDebugMunkee = nullptr; #define DEBUG_LOG(x) debugLog x static void debugLog(const char *fmt, ...) @@ -317,7 +317,7 @@ void compressOrigFiles(const std::string& sourceDirName, const std::string& targ char tmpFname[_MAX_PATH] = "C:\\temp\\tmp.txt"; GetTempPath(_MAX_PATH, tmpPath); GetTempFileName(tmpPath, "tex", 0, tmpFname); - HANDLE h = CreateFile(tmpFname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL); + HANDLE h = CreateFile(tmpFname, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr); if (!h) { DEBUG_LOG(("Could not create temp file '%s'! Unable to compress textures!", tmpFname)); @@ -332,7 +332,7 @@ void compressOrigFiles(const std::string& sourceDirName, const std::string& targ tmp.append("\n"); DEBUG_LOG(("Compressing file: %s", tmp.c_str())); DWORD len; - WriteFile(h, tmp.c_str(), tmp.length(), &len, NULL); + WriteFile(h, tmp.c_str(), tmp.length(), &len, nullptr); } CloseHandle(h); @@ -596,13 +596,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, */ int argc = 1; char * argv[20]; - argv[0] = NULL; + argv[0] = nullptr; char * token = strtok(lpCmdLine, " "); - while (argc < 20 && token != NULL) + while (argc < 20 && token != nullptr) { argv[argc++] = strtrim(token); - token = strtok(NULL, " "); + token = strtok(nullptr, " "); } #else int main(int argc, const char **argv) @@ -633,7 +633,7 @@ int main(int argc, const char **argv) #ifdef RTS_DEBUG delete theDebugMunkee; - theDebugMunkee = NULL; + theDebugMunkee = nullptr; #endif } diff --git a/Core/Tools/versionUpdate/versionUpdate.cpp b/Core/Tools/versionUpdate/versionUpdate.cpp index e8c1a90929b..6e1bd19b250 100644 --- a/Core/Tools/versionUpdate/versionUpdate.cpp +++ b/Core/Tools/versionUpdate/versionUpdate.cpp @@ -99,13 +99,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, */ int argc = 1; char * argv[20]; - argv[0] = NULL; + argv[0] = nullptr; char * token = strtok(lpCmdLine, " "); - while (argc < 20 && token != NULL) + while (argc < 20 && token != nullptr) { argv[argc++] = strtrim(token); - token = strtok(NULL, " "); + token = strtok(nullptr, " "); } int build = 0; @@ -124,18 +124,18 @@ int APIENTRY WinMain(HINSTANCE hInstance, if (filePtr) { char buffer[256]; - char *stringPtr = NULL; + char *stringPtr = nullptr; while (!feof(filePtr)) { fread(buffer, 256, 1, filePtr); - if ((stringPtr = strstr(buffer, VERSION_STRING)) != NULL) + if ((stringPtr = strstr(buffer, VERSION_STRING)) != nullptr) { char *ptr; // Looking for '#define VERSION "x.y.z"' ptr = strtok(stringPtr, " "); // The VERSION - ptr = strtok(NULL, "\n"); // The remainder + ptr = strtok(nullptr, "\n"); // The remainder if (*ptr == '\"') { diff --git a/Core/Tools/wolSetup/WOLAPI/chatdefs.h b/Core/Tools/wolSetup/WOLAPI/chatdefs.h index e0175d75740..11fef9d3eee 100644 --- a/Core/Tools/wolSetup/WOLAPI/chatdefs.h +++ b/Core/Tools/wolSetup/WOLAPI/chatdefs.h @@ -123,7 +123,7 @@ #define CHAT_E_NOTIMPLEMENTED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 502) // The request was made while while a conflicting request was still pending #define CHAT_E_PENDINGREQUEST MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 503) -// Invalid parameter passed - usually a NULL pointer +// Invalid parameter passed - usually a nullptr pointer #define CHAT_E_PARAMERROR MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 504) // Tried to create or join a channel before leaving the previous one #define CHAT_E_LEAVECHANNEL MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 508) diff --git a/Core/Tools/wolSetup/verchk.cpp b/Core/Tools/wolSetup/verchk.cpp index 3f51d306aa5..eefabe20665 100644 --- a/Core/Tools/wolSetup/verchk.cpp +++ b/Core/Tools/wolSetup/verchk.cpp @@ -34,7 +34,7 @@ */ bool GetVersionInfo(char* filename, VS_FIXEDFILEINFO* fileInfo) { - if (filename == NULL || fileInfo == NULL) + if (filename == nullptr || fileInfo == nullptr) { return false; } diff --git a/Core/Tools/wolSetup/wolInit.cpp b/Core/Tools/wolSetup/wolInit.cpp index 912f470522f..a9dbe6cca09 100644 --- a/Core/Tools/wolSetup/wolInit.cpp +++ b/Core/Tools/wolSetup/wolInit.cpp @@ -20,9 +20,6 @@ // Westwood Online DLL/COM/ initialization/teardown // Author: Matthew D. Campbell, December 2001 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif #include #include @@ -78,7 +75,7 @@ void getPathsFromRegistry( void ) if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, GENERALS_REG_KEY_PATH, 0, KEY_ALL_ACCESS, &handle ) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, GENERALS_REG_KEY_INSTALLPATH, NULL, &type, (unsigned char *) &g_generalsFilename, &size); + returnValue = RegQueryValueEx(handle, GENERALS_REG_KEY_INSTALLPATH, nullptr, &type, (unsigned char *) &g_generalsFilename, &size); if (returnValue != ERROR_SUCCESS) { @@ -93,7 +90,7 @@ void getPathsFromRegistry( void ) if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, GENERALS_REG_KEY_PATH, 0, KEY_ALL_ACCESS, &handle ) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, GENERALS_REG_KEY_SERIAL, NULL, &type, (unsigned char *) &g_generalsSerial, &size); + returnValue = RegQueryValueEx(handle, GENERALS_REG_KEY_SERIAL, nullptr, &type, (unsigned char *) &g_generalsSerial, &size); if (returnValue != ERROR_SUCCESS) { @@ -109,7 +106,7 @@ void getPathsFromRegistry( void ) if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, WOLAPI_REG_KEY_PATH, 0, KEY_ALL_ACCESS, &handle ) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, WOLAPI_REG_KEY_INSTALLPATH, NULL, &type, (unsigned char *) &g_wolapiRegFilename, &size); + returnValue = RegQueryValueEx(handle, WOLAPI_REG_KEY_INSTALLPATH, nullptr, &type, (unsigned char *) &g_wolapiRegFilename, &size); if (returnValue != ERROR_SUCCESS) { @@ -125,7 +122,7 @@ void getPathsFromRegistry( void ) if (RegOpenKeyEx( HKEY_CLASSES_ROOT, DLL_REG_KEY_PATH, 0, KEY_ALL_ACCESS, &handle ) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, DLL_REG_KEY_LOCATION, NULL, &type, (unsigned char *) &g_wolapiRealFilename, &size); + returnValue = RegQueryValueEx(handle, DLL_REG_KEY_LOCATION, nullptr, &type, (unsigned char *) &g_wolapiRealFilename, &size); if (returnValue != ERROR_SUCCESS) { @@ -145,7 +142,7 @@ void setupGenerals( const char *genPath, const char *genSerial ) int size; char lpClass[] = "REG_NONE"; - if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, GENERALS_REG_KEY_PATH, 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &handle, NULL ) == ERROR_SUCCESS) { + if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, GENERALS_REG_KEY_PATH, 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &handle, nullptr ) == ERROR_SUCCESS) { type = REG_SZ; size = strlen(genPath)+1; @@ -177,13 +174,13 @@ void setupGenerals( const char *genPath, const char *genSerial ) class OLEInitializer { public: - OLEInitializer() { OleInitialize(NULL); } + OLEInitializer() { OleInitialize(nullptr); } ~OLEInitializer() { OleUninitialize(); } }; OLEInitializer g_OLEInitializer; CComModule _Module; -IChat *g_pChat = NULL; +IChat *g_pChat = nullptr; /** * checkInstalledWolapiVersion inits WOLAPI if possible and gets its version @@ -192,10 +189,10 @@ IChat *g_pChat = NULL; void checkInstalledWolapiVersion( void ) { // Initialize this instance - _Module.Init(NULL, g_hInst); + _Module.Init(nullptr, g_hInst); // Create the WOLAPI instance - CoCreateInstance(CLSID_Chat, NULL, CLSCTX_INPROC_SERVER, \ + CoCreateInstance(CLSID_Chat, nullptr, CLSCTX_INPROC_SERVER, \ IID_IChat, (void**)&g_pChat); if (g_pChat) diff --git a/Core/Tools/wolSetup/wolSetup.cpp b/Core/Tools/wolSetup/wolSetup.cpp index 5ef59825bf5..cb07f93dad5 100644 --- a/Core/Tools/wolSetup/wolSetup.cpp +++ b/Core/Tools/wolSetup/wolSetup.cpp @@ -20,9 +20,6 @@ // Defines the entry point for the application. // Author: Matthew D. Campbell, December 2001 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif #include #include #include @@ -44,7 +41,7 @@ void registerDLL(const char *dllName) // Find the entry point. (FARPROC&)lpDllEntryPoint = GetProcAddress(hLib, "DllRegisterServer"); - if (lpDllEntryPoint != NULL) + if (lpDllEntryPoint != nullptr) (*lpDllEntryPoint)(); else ;//unable to locate entry point @@ -52,7 +49,7 @@ void registerDLL(const char *dllName) -HINSTANCE g_hInst = NULL; +HINSTANCE g_hInst = nullptr; LRESULT CALLBACK MainDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); @@ -65,7 +62,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, checkInstalledWolapiVersion(); - DialogBox(g_hInst, (LPCTSTR)IDD_MAINBOX, NULL, (DLGPROC)MainDialogProc); + DialogBox(g_hInst, (LPCTSTR)IDD_MAINBOX, nullptr, (DLGPROC)MainDialogProc); return 0; } diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index 2616939a118..3637d382829 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -266,7 +266,7 @@ class BitFlags static const char* getNameFromSingleBit(Int i) { - return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : NULL; + return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : nullptr; } static Int getSingleBitFromName(const char* token) @@ -284,7 +284,7 @@ class BitFlags const char* getBitNameIfSet(Int i) const { - return test(i) ? s_bitNameList[i] : NULL; + return test(i) ? s_bitNameList[i] : nullptr; } Bool setBitByName(const char* token) @@ -309,14 +309,14 @@ class BitFlags void buildDescription( AsciiString* str ) const { - if ( str == NULL ) + if ( str == nullptr ) return;//sanity for( Int i = 0; i < size(); ++i ) { const char* bitName = getBitNameIfSet(i); - if (bitName != NULL) + if (bitName != nullptr) { str->concat( bitName ); str->concat( ",\n"); diff --git a/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h b/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h index 197c79f31fa..16306b2d023 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlagsIO.h @@ -39,14 +39,14 @@ template void BitFlags::buildDescription( AsciiString* str ) const { - if ( str == NULL ) + if ( str == nullptr ) return;//sanity for( Int i = 0; i < size(); ++i ) { const char* bitName = getBitNameIfSet(i); - if (bitName != NULL) + if (bitName != nullptr) { str->concat( bitName ); str->concat( ",\n"); @@ -67,7 +67,7 @@ void BitFlags::parse(INI* ini, AsciiString* str) Bool foundAddOrSub = false; // loop through all tokens - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (str) { @@ -132,7 +132,7 @@ void BitFlags::parse(INI* ini, AsciiString* str) template /*static*/ void BitFlags::parseFromINI(INI* ini, void* /*instance*/, void *store, const void* /*userData*/) { - ((BitFlags*)store)->parse(ini, NULL); + ((BitFlags*)store)->parse(ini, nullptr); } //------------------------------------------------------------------------------------------------- @@ -172,7 +172,7 @@ void BitFlags::xfer(Xfer* xfer) const char* bitName = getBitNameIfSet(i); // ignore if this kindof is not set in our mask data - if (bitName == NULL) + if (bitName == nullptr) continue; // this bit is set, write the string value diff --git a/Generals/Code/GameEngine/Include/Common/CriticalSection.h b/Generals/Code/GameEngine/Include/Common/CriticalSection.h index b44a88f2ffb..98b10c6af08 100644 --- a/Generals/Code/GameEngine/Include/Common/CriticalSection.h +++ b/Generals/Code/GameEngine/Include/Common/CriticalSection.h @@ -92,7 +92,7 @@ class ScopedCriticalSection } }; -// These should be NULL on creation then non-NULL in WinMain or equivalent. +// These should be null on creation then non-null in WinMain or equivalent. // This allows us to be silently non-threadsafe for WB and other single-threaded apps. extern CriticalSection *TheAsciiStringCriticalSection; extern CriticalSection *TheUnicodeStringCriticalSection; diff --git a/Generals/Code/GameEngine/Include/Common/DamageFX.h b/Generals/Code/GameEngine/Include/Common/DamageFX.h index 710a76e55cc..d41752782cf 100644 --- a/Generals/Code/GameEngine/Include/Common/DamageFX.h +++ b/Generals/Code/GameEngine/Include/Common/DamageFX.h @@ -116,8 +116,8 @@ class DamageFX void clear() { m_amountForMajorFX = 0.0f; - m_majorDamageFXList = NULL; - m_minorDamageFXList = NULL; + m_majorDamageFXList = nullptr; + m_minorDamageFXList = nullptr; m_damageFXThrottleTime = 0; } }; diff --git a/Generals/Code/GameEngine/Include/Common/DataChunk.h b/Generals/Code/GameEngine/Include/Common/DataChunk.h index 9c0e747d9c2..8e31ede5e6f 100644 --- a/Generals/Code/GameEngine/Include/Common/DataChunk.h +++ b/Generals/Code/GameEngine/Include/Common/DataChunk.h @@ -187,8 +187,8 @@ class DataChunkInput // to create an object, and a subsequent chunk to // parse values into that object. However, the second // chunk parser could also create and parse an object - // of its own if this pointer is NULL. - // The parser of the base class should NULL this pointer. + // of its own if this pointer is null. + // The parser of the base class should set this pointer to null. void *m_userData; // user data hook public: @@ -196,10 +196,10 @@ class DataChunkInput ~DataChunkInput(); // register a parser function for data chunks with labels matching "label", whose parent - // chunks labels match "parentLabel" (or NULL for global scope) - void registerParser( const AsciiString& label, const AsciiString& parentLabel, DataChunkParserPtr parser, void *userData = NULL ); + // chunks labels match "parentLabel" (or null for global scope) + void registerParser( const AsciiString& label, const AsciiString& parentLabel, DataChunkParserPtr parser, void *userData = nullptr ); - Bool parse( void *userData = NULL ); // parse the chunk stream using registered parsers + Bool parse( void *userData = nullptr ); // parse the chunk stream using registered parsers // assumed to be at the start of chunk when called // can be called recursively diff --git a/Generals/Code/GameEngine/Include/Common/Dict.h b/Generals/Code/GameEngine/Include/Common/Dict.h index 424fa3ae6bf..9bc7ffb12b3 100644 --- a/Generals/Code/GameEngine/Include/Common/Dict.h +++ b/Generals/Code/GameEngine/Include/Common/Dict.h @@ -141,31 +141,31 @@ class Dict if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Bool getBool(NameKeyType key, Bool* exists = NULL) const; + Bool getBool(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Int getInt(NameKeyType key, Bool* exists = NULL) const; + Int getInt(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Real getReal(NameKeyType key, Bool* exists = NULL) const; + Real getReal(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, "" is returned. */ - AsciiString getAsciiString(NameKeyType key, Bool* exists = NULL) const; + AsciiString getAsciiString(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, "" is returned. */ - UnicodeString getUnicodeString(NameKeyType key, Bool* exists = NULL) const; + UnicodeString getUnicodeString(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given index. diff --git a/Generals/Code/GameEngine/Include/Common/DrawModule.h b/Generals/Code/GameEngine/Include/Common/DrawModule.h index e13310fa187..5ddde9c6307 100644 --- a/Generals/Code/GameEngine/Include/Common/DrawModule.h +++ b/Generals/Code/GameEngine/Include/Common/DrawModule.h @@ -93,20 +93,20 @@ class DrawModule : public DrawableModule virtual Bool isLaser() const { return false; } // interface acquisition - virtual ObjectDrawInterface* getObjectDrawInterface() { return NULL; } - virtual const ObjectDrawInterface* getObjectDrawInterface() const { return NULL; } + virtual ObjectDrawInterface* getObjectDrawInterface() { return nullptr; } + virtual const ObjectDrawInterface* getObjectDrawInterface() const { return nullptr; } - virtual DebrisDrawInterface* getDebrisDrawInterface() { return NULL; } - virtual const DebrisDrawInterface* getDebrisDrawInterface() const { return NULL; } + virtual DebrisDrawInterface* getDebrisDrawInterface() { return nullptr; } + virtual const DebrisDrawInterface* getDebrisDrawInterface() const { return nullptr; } - virtual TracerDrawInterface* getTracerDrawInterface() { return NULL; } - virtual const TracerDrawInterface* getTracerDrawInterface() const { return NULL; } + virtual TracerDrawInterface* getTracerDrawInterface() { return nullptr; } + virtual const TracerDrawInterface* getTracerDrawInterface() const { return nullptr; } - virtual RopeDrawInterface* getRopeDrawInterface() { return NULL; } - virtual const RopeDrawInterface* getRopeDrawInterface() const { return NULL; } + virtual RopeDrawInterface* getRopeDrawInterface() { return nullptr; } + virtual const RopeDrawInterface* getRopeDrawInterface() const { return nullptr; } - virtual LaserDrawInterface* getLaserDrawInterface() { return NULL; } - virtual const LaserDrawInterface* getLaserDrawInterface() const { return NULL; } + virtual LaserDrawInterface* getLaserDrawInterface() { return nullptr; } + virtual const LaserDrawInterface* getLaserDrawInterface() const { return nullptr; } }; inline DrawModule::DrawModule( Thing *thing, const ModuleData* moduleData ) : DrawableModule( thing, moduleData ) { } diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 77d9eb99d8b..7163c0753c5 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -321,7 +321,7 @@ public: \ o->dlink_removeFrom_##LISTNAME(&m_dlinkhead_##LISTNAME.m_head); \ } \ typedef void (*RemoveAllProc_##LISTNAME)(OBJCLASS* o); \ - inline void removeAll_##LISTNAME(RemoveAllProc_##LISTNAME p = NULL) \ + inline void removeAll_##LISTNAME(RemoveAllProc_##LISTNAME p = nullptr) \ { \ while (m_dlinkhead_##LISTNAME.m_head) \ { \ @@ -334,7 +334,7 @@ public: \ inline void reverse_##LISTNAME() \ { \ OBJCLASS* cur = m_dlinkhead_##LISTNAME.m_head; \ - OBJCLASS* prev = NULL; \ + OBJCLASS* prev = nullptr; \ while (cur) \ { \ OBJCLASS* originalNext = cur->dlink_next_##LISTNAME(); \ @@ -438,7 +438,7 @@ class DLINK_ITERATOR Bool done() const { - return m_cur == NULL; + return m_cur == nullptr; } OBJCLASS* cur() const diff --git a/Generals/Code/GameEngine/Include/Common/Geometry.h b/Generals/Code/GameEngine/Include/Common/Geometry.h index 35930f6fa19..a1b2809103c 100644 --- a/Generals/Code/GameEngine/Include/Common/Geometry.h +++ b/Generals/Code/GameEngine/Include/Common/Geometry.h @@ -59,7 +59,7 @@ static const char *const GeometryNames[] = "SPHERE", "CYLINDER", "BOX", - NULL + nullptr }; static_assert(ARRAY_SIZE(GeometryNames) == GEOMETRY_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_GEOMETRY_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h index 0e48452dc53..3854f3f0480 100644 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ b/Generals/Code/GameEngine/Include/Common/INI.h @@ -324,14 +324,14 @@ class INI this will *never* return null; if there are no more tokens, an exception will be thrown. */ - const char* getNextToken(const char* seps = NULL); + const char* getNextToken(const char* seps = nullptr); /** just like getNextToken(), except that null is returned if no more tokens are present (rather than throwing an exception). usually you should call getNextToken(), but for some cases this is handier (ie, parsing a variable-length number of tokens). */ - const char* getNextTokenOrNull(const char* seps = NULL); + const char* getNextTokenOrNull(const char* seps = nullptr); /** This is called when the next thing you expect is something like: diff --git a/Generals/Code/GameEngine/Include/Common/INIException.h b/Generals/Code/GameEngine/Include/Common/INIException.h index 5afca81bc13..88300bc02bd 100644 --- a/Generals/Code/GameEngine/Include/Common/INIException.h +++ b/Generals/Code/GameEngine/Include/Common/INIException.h @@ -35,7 +35,7 @@ class INIException public: char *mFailureMessage; - INIException(const char* errorMessage) : mFailureMessage(NULL) + INIException(const char* errorMessage) : mFailureMessage(nullptr) { if (errorMessage) { mFailureMessage = new char[strlen(errorMessage) + 1]; diff --git a/Generals/Code/GameEngine/Include/Common/Module.h b/Generals/Code/GameEngine/Include/Common/Module.h index adc0e98e27f..7c36d5a83ee 100644 --- a/Generals/Code/GameEngine/Include/Common/Module.h +++ b/Generals/Code/GameEngine/Include/Common/Module.h @@ -108,7 +108,7 @@ class ModuleData : public Snapshot virtual Bool isAiModuleData() const { return false; } // ugh, hack - virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return NULL; } + virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return nullptr; } virtual StaticGameLODLevel getMinimumRequiredGameLOD() const { return (StaticGameLODLevel)0;} static void buildFieldParse(MultiIniFieldParse& p) diff --git a/Generals/Code/GameEngine/Include/Common/ModuleFactory.h b/Generals/Code/GameEngine/Include/Common/ModuleFactory.h index f3f4182f90f..84a46f043f8 100644 --- a/Generals/Code/GameEngine/Include/Common/ModuleFactory.h +++ b/Generals/Code/GameEngine/Include/Common/ModuleFactory.h @@ -91,7 +91,7 @@ class ModuleFactory : public SubsystemInterface, public Snapshot class ModuleTemplate { public: - ModuleTemplate() : m_createProc(NULL), m_createDataProc(NULL), m_whichInterfaces(0) + ModuleTemplate() : m_createProc(nullptr), m_createDataProc(nullptr), m_whichInterfaces(0) { } diff --git a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h index 2662543140c..5a5ed8a3693 100644 --- a/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -66,7 +66,7 @@ class Bucket : public MemoryPoolObject AsciiString m_nameString; }; -inline Bucket::Bucket() : m_nextInSocket(NULL), m_key(NAMEKEY_INVALID) { } +inline Bucket::Bucket() : m_nextInSocket(nullptr), m_key(NAMEKEY_INVALID) { } inline Bucket::~Bucket() { } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/Overridable.h b/Generals/Code/GameEngine/Include/Common/Overridable.h index f3951278843..98add739199 100644 --- a/Generals/Code/GameEngine/Include/Common/Overridable.h +++ b/Generals/Code/GameEngine/Include/Common/Overridable.h @@ -47,9 +47,9 @@ class Overridable : public MemoryPoolObject Bool m_isOverride; public: - Overridable() : m_nextOverride(NULL), m_isOverride(false) {} + Overridable() : m_nextOverride(nullptr), m_isOverride(false) {} - // return a constant version of m_nextOverride, which can be NULL if there is no + // return a constant version of m_nextOverride, which can be null if there is no // override const Overridable *getNextOverride( void ) const { @@ -99,14 +99,14 @@ class Overridable : public MemoryPoolObject m_isOverride = true; } - // used in factory reset() calls at the end of a game to clean up overrides. Can return NULL + // used in factory reset() calls at the end of a game to clean up overrides. Can return nullptr // if the first Overridable is itself an override Overridable *deleteOverrides( void ) { if ( m_isOverride ) { deleteInstance(this); - return NULL; + return nullptr; } else if ( m_nextOverride ) { diff --git a/Generals/Code/GameEngine/Include/Common/Override.h b/Generals/Code/GameEngine/Include/Common/Override.h index d89ee693241..2cbee07c1e9 100644 --- a/Generals/Code/GameEngine/Include/Common/Override.h +++ b/Generals/Code/GameEngine/Include/Common/Override.h @@ -50,7 +50,7 @@ template class OVERRIDE { public: // Provide useful constructores to go from a T* to an OVERRIDE - OVERRIDE(const T *overridable = NULL); + OVERRIDE(const T *overridable = nullptr); // Copy constructor OVERRIDE(OVERRIDE &overridable); // Operator= for copying from another OVERRIDE and T* @@ -107,7 +107,7 @@ template const T *OVERRIDE::operator->() const { if (!m_overridable) - return NULL; + return nullptr; return (T*) m_overridable->getFinalOverride(); } @@ -116,7 +116,7 @@ template const T *OVERRIDE::operator*() const { if (!m_overridable) - return NULL; + return nullptr; return (T*) m_overridable->getFinalOverride(); } diff --git a/Generals/Code/GameEngine/Include/Common/PerfTimer.h b/Generals/Code/GameEngine/Include/Common/PerfTimer.h index 071b35b3485..8f03af506d8 100644 --- a/Generals/Code/GameEngine/Include/Common/PerfTimer.h +++ b/Generals/Code/GameEngine/Include/Common/PerfTimer.h @@ -138,7 +138,7 @@ void PerfGather::startTimer() //------------------------------------------------------------------------------------------------- void PerfGather::stopTimer() { - DEBUG_ASSERTCRASH(this != NULL, ("I am null, uh oh")); + DEBUG_ASSERTCRASH(this != nullptr, ("I am null, uh oh")); Int64 runTime; GetPrecisionTimer(&runTime); @@ -151,7 +151,7 @@ void PerfGather::stopTimer() ++m_callCount; #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(*m_activeHead != NULL, ("m_activeHead is null, uh oh")); + DEBUG_ASSERTCRASH(*m_activeHead != nullptr, ("m_activeHead is null, uh oh")); DEBUG_ASSERTCRASH(*m_activeHead == this, ("I am not the active timer, uh oh")); DEBUG_ASSERTCRASH(m_activeHead >= &m_active[0] && m_activeHead <= &m_active[MAX_ACTIVE_STACK-1], ("active under/over flow")); #endif diff --git a/Generals/Code/GameEngine/Include/Common/Player.h b/Generals/Code/GameEngine/Include/Common/Player.h index 69327b447fa..3eeae7466cb 100644 --- a/Generals/Code/GameEngine/Include/Common/Player.h +++ b/Generals/Code/GameEngine/Include/Common/Player.h @@ -102,7 +102,7 @@ static const char *const ScienceAvailabilityNames[] = "Available", "Disabled", "Hidden", - NULL + nullptr }; static_assert(ARRAY_SIZE(ScienceAvailabilityNames) == SCIENCE_AVAILABILITY_COUNT + 1, "Incorrect array size"); #endif // end DEFINE_SCIENCE_AVAILABILITY_NAMES @@ -419,7 +419,7 @@ class Player : public Snapshot virtual void computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D *pos, Int playerNdx, Real weaponRadius); ///< Calculates best pos for weapon given radius. - /// Get the enemy an ai player is currently focused on. NOTE - Can be NULL. + /// Get the enemy an ai player is currently focused on. NOTE - Can be nullptr. Player *getCurrentEnemy( void ); /// Is this player a skirmish ai player? @@ -507,8 +507,8 @@ class Player : public Snapshot /** return this player's "default" team. */ - Team *getDefaultTeam() { DEBUG_ASSERTCRASH(m_defaultTeam!=NULL,("default team is null")); return m_defaultTeam; } - const Team *getDefaultTeam() const { DEBUG_ASSERTCRASH(m_defaultTeam!=NULL,("default team is null")); return m_defaultTeam; } + Team *getDefaultTeam() { DEBUG_ASSERTCRASH(m_defaultTeam!=nullptr,("default team is null")); return m_defaultTeam; } + const Team *getDefaultTeam() const { DEBUG_ASSERTCRASH(m_defaultTeam!=nullptr,("default team is null")); return m_defaultTeam; } void setBuildList(BuildListInfo *pBuildList); ///< sets the build list. BuildListInfo *getBuildList( void ) { return m_pBuildList; } ///< returns the build list. (build list might be modified by the solo AI) diff --git a/Generals/Code/GameEngine/Include/Common/PlayerList.h b/Generals/Code/GameEngine/Include/Common/PlayerList.h index 2f0362b4895..94db9062ccc 100644 --- a/Generals/Code/GameEngine/Include/Common/PlayerList.h +++ b/Generals/Code/GameEngine/Include/Common/PlayerList.h @@ -106,7 +106,7 @@ class PlayerList : public SubsystemInterface, all other players (this is so that everything can be associated with a nonnull Player, to simplify the universe). This will never return null. */ - Player *getNeutralPlayer() { DEBUG_ASSERTCRASH(m_players[0] != NULL, ("null neutral")); return m_players[0]; } + Player *getNeutralPlayer() { DEBUG_ASSERTCRASH(m_players[0] != nullptr, ("null neutral")); return m_players[0]; } /** return the Player with the given internal name, or null if none found. @@ -117,7 +117,7 @@ class PlayerList : public SubsystemInterface, Return the "local" player (ie, the human playing the game). This will never return null. */ - inline Player *getLocalPlayer() { DEBUG_ASSERTCRASH(m_local != NULL, ("null m_local")); return m_local; } + inline Player *getLocalPlayer() { DEBUG_ASSERTCRASH(m_local != nullptr, ("null m_local")); return m_local; } /** Set the local player. You cannot set it to null; if you pass null, you'll diff --git a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h index 38e3bbed4d3..e96bf0f9380 100644 --- a/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/Generals/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -123,7 +123,7 @@ class SparseMatchFinder //------------------------------------------------------------------------------------------------- const MATCHABLE* findBestInfoSlow(const std::vector& v, const BITSET& bits) const { - const MATCHABLE* result = NULL; + const MATCHABLE* result = nullptr; Int bestYesMatch = 0; // want to maximize this Int bestYesExtraneousBits = 999; // want to minimize this @@ -220,19 +220,19 @@ class SparseMatchFinder { typename MatchMap::const_iterator it = m_bestMatches.find(bits); - const MATCHABLE *first = NULL; + const MATCHABLE *first = nullptr; if (it != m_bestMatches.end()) { first = (*it).second; } - if (first != NULL) { + if (first != nullptr) { return first; } const MATCHABLE* info = findBestInfoSlow(v, bits); - DEBUG_ASSERTCRASH(info != NULL, ("no suitable match for criteria was found!")); - if (info != NULL) { + DEBUG_ASSERTCRASH(info != nullptr, ("no suitable match for criteria was found!")); + if (info != nullptr) { m_bestMatches[bits] = info; } diff --git a/Generals/Code/GameEngine/Include/Common/StackDump.h b/Generals/Code/GameEngine/Include/Common/StackDump.h index 9a0e836dcf2..24983d70d15 100644 --- a/Generals/Code/GameEngine/Include/Common/StackDump.h +++ b/Generals/Code/GameEngine/Include/Common/StackDump.h @@ -31,11 +31,11 @@ #if defined(RTS_DEBUG) || defined(IG_DEBUG_STACKTRACE) // Writes a stackdump (provide a callback : gets called per line) -// If callback is NULL then will write using OuputDebugString +// If callback is nullptr then will write using OuputDebugString void StackDump(void (*callback)(const char*)); // Writes a stackdump (provide a callback : gets called per line) -// If callback is NULL then will write using OuputDebugString +// If callback is nullptr then will write using OuputDebugString void StackDumpFromContext(DWORD eip,DWORD esp,DWORD ebp, void (*callback)(const char*)); // Gets count* addresses from the current stack diff --git a/Generals/Code/GameEngine/Include/Common/StateMachine.h b/Generals/Code/GameEngine/Include/Common/StateMachine.h index 964612308b1..bea16f4bf25 100644 --- a/Generals/Code/GameEngine/Include/Common/StateMachine.h +++ b/Generals/Code/GameEngine/Include/Common/StateMachine.h @@ -170,7 +170,7 @@ class State : public MemoryPoolObject, public Snapshot void friend_setID( StateID id ) { m_ID = id; } ///< define this state's id (for use only by StateMachine class) void friend_onSuccess( StateID toStateID ) { m_successStateID = toStateID; } ///< define which state to move to after successful completion void friend_onFailure( StateID toStateID ) { m_failureStateID = toStateID; } ///< define which state to move to after failure - void friend_onCondition( StateTransFuncPtr test, StateID toStateID, void* userData, const char* description = NULL ); ///< define when to change state + void friend_onCondition( StateTransFuncPtr test, StateID toStateID, void* userData, const char* description = nullptr ); ///< define when to change state StateReturnType friend_checkForTransitions( StateReturnType status ); ///< given a return code, handle state transitions StateReturnType friend_checkForSleepTransitions( StateReturnType status ); ///< given a return code, handle state transitions @@ -288,7 +288,7 @@ class StateMachine : public MemoryPoolObject, public Snapshot { m_locked = false; #ifdef STATE_MACHINE_DEBUG - m_lockedby = NULL; + m_lockedby = nullptr; #endif } @@ -349,7 +349,7 @@ class StateMachine : public MemoryPoolObject, public Snapshot void defineState( StateID id, State *state, StateID successID, StateID failureID, - const StateConditionInfo* conditions = NULL); + const StateConditionInfo* conditions = nullptr); State* internalGetState( StateID id ); @@ -478,6 +478,6 @@ EMPTY_DTOR(SleepState) // @todo Replace calls to deleteInstance with RefCountPtr when so appropriate. inline void deleteInstance(StateMachine* machine) { - if (machine != NULL) + if (machine != nullptr) machine->Release_Ref(); } diff --git a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h index 740accba46a..42296385138 100644 --- a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -52,7 +52,7 @@ class SubsystemInterface /** - Constructors should initialize any data to a valid state. That DOES NOT mean * the data has default values (something done in the init() method), only that * nothing is left pointing to garbage, un-initialized memory. In most cases - * this probably means just setting members to zero or NULL. + * this probably means just setting members to zero or nullptr. */ SubsystemInterface(); diff --git a/Generals/Code/GameEngine/Include/Common/Team.h b/Generals/Code/GameEngine/Include/Common/Team.h index d510d1cc5c9..4c1c7a81250 100644 --- a/Generals/Code/GameEngine/Include/Common/Team.h +++ b/Generals/Code/GameEngine/Include/Common/Team.h @@ -259,7 +259,7 @@ class Team : public MemoryPoolObject, Player *getControllingPlayer() const; /** - set the team's owner. (NULL is not allowed) + set the team's owner. (nullptr is not allowed) */ void setControllingPlayer(Player *newController); @@ -540,7 +540,7 @@ class TeamPrototype : public MemoryPoolObject, Team *findTeamByID( TeamID teamID ); /** - set the team's owner. (NULL is not allowed) + set the team's owner. (nullptr is not allowed) */ void setControllingPlayer(Player *newController); @@ -696,10 +696,10 @@ class TeamFactory : public SubsystemInterface, /// return the TeamPrototype with the given name. if none exists, return null. TeamPrototype *findTeamPrototype(const AsciiString& name); - /// return TeamPrototype with matching ID. if none exists NULL is returned + /// return TeamPrototype with matching ID. if none exists nullptr is returned TeamPrototype *findTeamPrototypeByID( TeamPrototypeID id ); - /// search all prototypes for the team with the matching id, if none found NULL is returned + /// search all prototypes for the team with the matching id, if none found nullptr is returned Team *findTeamByID( TeamID teamID ); // note that there is no way to directly destroy a specific TeamPrototype (or a Team); the only diff --git a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h index b0b2e2013e2..3333c3c05fa 100644 --- a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h @@ -99,7 +99,7 @@ static const char *const terrainTypeNames[] = "WOOD", "BLEND_EDGE", - NULL + nullptr }; static_assert(ARRAY_SIZE(terrainTypeNames) == TERRAIN_NUM_CLASSES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_TYPE_NAMES diff --git a/Generals/Code/GameEngine/Include/Common/Thing.h b/Generals/Code/GameEngine/Include/Common/Thing.h index 838480831ed..905ad0b7897 100644 --- a/Generals/Code/GameEngine/Include/Common/Thing.h +++ b/Generals/Code/GameEngine/Include/Common/Thing.h @@ -84,10 +84,10 @@ class Thing : public MemoryPoolObject { // note, it is explicitly OK to pass null for 'thing' here; // they will check for null and return null in these cases. - friend inline Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : NULL; } - friend inline Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; } - friend inline const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : NULL; } - friend inline const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; } + friend inline Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; } + friend inline Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; } + friend inline const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; } + friend inline const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; } MEMORY_POOL_GLUE_ABC(Thing) @@ -148,10 +148,10 @@ class Thing : public MemoryPoolObject // Virtual method since objects can be on bridges and need to calculate heigh above terrain differently. virtual Real calculateHeightAboveTerrain(void) const; // Calculates the actual height above terrain. Doesn't use cache. - virtual Object *asObjectMeth() { return NULL; } - virtual Drawable *asDrawableMeth() { return NULL; } - virtual const Object *asObjectMeth() const { return NULL; } - virtual const Drawable *asDrawableMeth() const { return NULL; } + virtual Object *asObjectMeth() { return nullptr; } + virtual Drawable *asDrawableMeth() { return nullptr; } + virtual const Object *asObjectMeth() const { return nullptr; } + virtual const Drawable *asDrawableMeth() const { return nullptr; } virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle) = 0; diff --git a/Generals/Code/GameEngine/Include/Common/ThingSort.h b/Generals/Code/GameEngine/Include/Common/ThingSort.h index e35702922c8..1accc3dd499 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingSort.h +++ b/Generals/Code/GameEngine/Include/Common/ThingSort.h @@ -71,7 +71,7 @@ static const char *const EditorSortingNames[] = "ROAD", "WAYPOINT", - NULL + nullptr }; static_assert(ARRAY_SIZE(EditorSortingNames) == ES_NUM_SORTING_TYPES + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index f01dc7038ea..28e14647e4b 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -149,7 +149,7 @@ class AudioArray AudioArray() { for (Int i = 0; i < TTAUDIO_COUNT; ++i) - m_audio[i] = NULL; + m_audio[i] = nullptr; } ~AudioArray() @@ -165,7 +165,7 @@ class AudioArray if (that.m_audio[i]) m_audio[i] = newInstance(DynamicAudioEventRTS)(*that.m_audio[i]); else - m_audio[i] = NULL; + m_audio[i] = nullptr; } } @@ -184,7 +184,7 @@ class AudioArray } else { - m_audio[i] = NULL; + m_audio[i] = nullptr; } } } @@ -210,7 +210,7 @@ static const char *const BuildCompletionNames[] = "APPEARS_AT_RALLY_POINT", "PLACED_BY_PLAYER", - NULL + nullptr }; static_assert(ARRAY_SIZE(BuildCompletionNames) == BC_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILD_COMPLETION_NAMES @@ -233,7 +233,7 @@ static const char *const BuildableStatusNames[] = "Ignore_Prerequisites", "No", "Only_By_AI", - NULL + nullptr }; static_assert(ARRAY_SIZE(BuildableStatusNames) == BSTATUS_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILDABLE_STATUS_NAMES @@ -288,7 +288,7 @@ class ModuleInfo Bool containsPartialName(const char* n) const { for (size_t i = 0; i < m_info.size(); i++) - if (strstr(m_info[i].first.str(), n) != NULL) + if (strstr(m_info[i].first.str(), n) != nullptr) return true; return false; } @@ -318,7 +318,7 @@ class ModuleInfo { return m_info[i].second; } - return NULL; + return nullptr; } // for use only by ThingTemplate::friend_getAIModuleInfo @@ -592,7 +592,7 @@ class ThingTemplate : public Overridable void setCopiedFromDefault(); - void setReskinnedFrom(const ThingTemplate* tt) { DEBUG_ASSERTCRASH(m_reskinnedFrom == NULL, ("should be null")); m_reskinnedFrom = tt; } + void setReskinnedFrom(const ThingTemplate* tt) { DEBUG_ASSERTCRASH(m_reskinnedFrom == nullptr, ("should be null")); m_reskinnedFrom = tt; } Bool isPrerequisite() const { return m_isPrerequisite; } @@ -698,7 +698,7 @@ class ThingTemplate : public Overridable // ---- Pointer-sized things ThingTemplate* m_nextThingTemplate; - const ThingTemplate* m_reskinnedFrom; ///< non NULL if we were generated via a reskin + const ThingTemplate* m_reskinnedFrom; ///< non nullptr if we were generated via a reskin const Image * m_selectedPortraitImage; /// portrait image when selected (to display in GUI) const Image * m_buttonImage; diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h index e3853a37102..8a4770cbe1c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h @@ -62,7 +62,7 @@ static const char *const Anim2DModeNames[] = "LOOP_BACKWARDS", "PING_PONG", "PING_PONG_BACKWARDS", - NULL + nullptr }; static_assert(ARRAY_SIZE(Anim2DModeNames) == ANIM_2D_NUM_MODES + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h b/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h index aebea584fa2..b31f48c28d4 100644 --- a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h +++ b/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h @@ -117,8 +117,8 @@ class PickAndPlayInfo Bool m_air; //Are we attacking an airborned target? Drawable *m_drawTarget; //Do we have an override draw target? - WeaponSlotType *m_weaponSlot; //Are we forcing a specific weapon slot? NULL if unspecified. + WeaponSlotType *m_weaponSlot; //Are we forcing a specific weapon slot? nullptr if unspecified. SpecialPowerType m_specialPowerType; //Which special power are use using? SPECIAL_INVALID if unspecified. }; -extern void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type msgType, PickAndPlayInfo *info = NULL ); +extern void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type msgType, PickAndPlayInfo *info = nullptr ); diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 19e6580aae9..c95f8a332bf 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -128,7 +128,7 @@ static const char *const TheCommandOptionNames[] = "IGNORES_UNDERPOWERED", "USES_MINE_CLEARING_WEAPONSET", - NULL + nullptr }; #endif // end DEFINE_COMMAND_OPTION_NAMES @@ -247,7 +247,7 @@ static const char *const TheGuiCommandNames[] = "PLACE_BEACON", "SPECIAL_POWER_FROM_COMMAND_CENTER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheGuiCommandNames) == GUI_COMMAND_NUM_COMMANDS + 1, "Incorrect array size"); #endif // end DEFINE_GUI_COMMAND_NAMES @@ -271,7 +271,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { "ACTION", COMMAND_BUTTON_BORDER_ACTION }, { "SYSTEM", COMMAND_BUTTON_BORDER_SYSTEM }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(CommandButtonMappedBorderTypeNames) == COMMAND_BUTTON_BORDER_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- @@ -300,7 +300,7 @@ class CommandButton : public Overridable Bool isValidObjectTarget(const Object* sourceObj, const Object* targetObj) const; Bool isValidObjectTarget(const Drawable* source, const Drawable* target) const; - // Note: It is perfectly valid for either (or both!) of targetObj and targetLocation to be NULL. + // Note: It is perfectly valid for either (or both!) of targetObj and targetLocation to be nullptr. // This is a convenience function to make several calls to other functions. Bool isValidToUseOn(const Object *sourceObj, const Object *targetObj, const Coord3D *targetLocation, CommandSourceType commandSource) const; Bool isReady(const Object *sourceObj) const; @@ -434,29 +434,29 @@ class SideSelectWindowData public: SideSelectWindowData(void) { - generalSpeak = NULL; + generalSpeak = nullptr; m_currColor = 0; - m_gereralsNameWin = NULL; + m_gereralsNameWin = nullptr; m_lastTime = 0; - m_pTemplate = NULL; - m_sideNameWin = NULL; + m_pTemplate = nullptr; + m_sideNameWin = nullptr; m_startTime = 0; m_state = 0; - m_upgradeImage1 = NULL; - m_upgradeImage1Win = NULL; - m_upgradeImage2 = NULL; - m_upgradeImage2Win = NULL; - m_upgradeImage3 = NULL; - m_upgradeImage3Win = NULL; - m_upgradeImage4 = NULL; - m_upgradeImage4Win = NULL; + m_upgradeImage1 = nullptr; + m_upgradeImage1Win = nullptr; + m_upgradeImage2 = nullptr; + m_upgradeImage2Win = nullptr; + m_upgradeImage3 = nullptr; + m_upgradeImage3Win = nullptr; + m_upgradeImage4 = nullptr; + m_upgradeImage4Win = nullptr; m_upgradeImageSize.x = m_upgradeImageSize.y = 0; - m_upgradeLabel1Win = NULL; - m_upgradeLabel2Win = NULL; - m_upgradeLabel3Win = NULL; - m_upgradeLabel4Win = NULL; - sideWindow = NULL; + m_upgradeLabel1Win = nullptr; + m_upgradeLabel2Win = nullptr; + m_upgradeLabel3Win = nullptr; + m_upgradeLabel4Win = nullptr; + sideWindow = nullptr; } ~SideSelectWindowData(void); @@ -727,7 +727,7 @@ class ControlBar : public SubsystemInterface void setObservedPlayer(Player *player); ///< Sets the observed player. Used to present the game world as if that player was the local player. Player *getObservedPlayer() const { return m_observedPlayer; } ///< Return the observed player. Can return null. - /// Returns the currently viewed player. May return NULL if no player is selected while observing. + /// Returns the currently viewed player. May return nullptr if no player is selected while observing. Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. Relationship getCurrentlyViewedPlayerRelationship(const Team* team); @@ -799,7 +799,7 @@ class ControlBar : public SubsystemInterface /// show/hide the portrait window image using the image from the object void setPortraitByObject( Object *obj ); - /// show rally point at world location, a NULL location will hide any visible rally point marker + /// show rally point at world location, a nullptr location will hide any visible rally point marker void showRallyPoint( const Coord3D *loc ); /// post process step, after all commands and command sets are loaded @@ -958,7 +958,7 @@ class ControlBar : public SubsystemInterface void hideBuildTooltipLayout( void ); void deleteBuildTooltipLayout( void ); Bool getShowBuildTooltipLayout( void ){return m_showBuildToolTipLayout; } - void populateBuildTooltipLayout( const CommandButton *commandButton, GameWindow *tooltipWin = NULL ); + void populateBuildTooltipLayout( const CommandButton *commandButton, GameWindow *tooltipWin = nullptr ); void repopulateBuildTooltipLayout( void ); private: diff --git a/Generals/Code/GameEngine/Include/GameClient/Credits.h b/Generals/Code/GameEngine/Include/GameClient/Credits.h index bba068bd64f..5055907b0dd 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Credits.h +++ b/Generals/Code/GameEngine/Include/GameClient/Credits.h @@ -81,7 +81,7 @@ static const LookupListRec CreditStyleNames[] = { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, // CREDIT_STYLE_BLANK - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(CreditStyleNames) == MAX_CREDIT_STYLES, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Include/GameClient/Display.h b/Generals/Code/GameEngine/Include/GameClient/Display.h index 3d6a9d857cc..1f213388e99 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Display.h +++ b/Generals/Code/GameEngine/Include/GameClient/Display.h @@ -84,7 +84,7 @@ class Display : public SubsystemInterface virtual Int getDisplayModeCount(void) {return 0;} ///getNextView(); - return NULL; + return nullptr; } virtual void drawViews( void ); ///< Render all views of the world @@ -153,7 +153,7 @@ class Display : public SubsystemInterface virtual Bool isMoviePlaying(void); /// Register debug display callback - virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = NULL ); + virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = nullptr ); virtual DebugDisplayCallback *getDebugDisplayCallback(); virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting ) = 0; ///< set shroud @@ -216,7 +216,7 @@ class Display : public SubsystemInterface // the singleton extern Display *TheDisplay; -extern void StatDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL ); +extern void StatDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = nullptr ); //Necessary for display resolution confirmation dialog box //Holds the previous and current display settings diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index 8d4c158d7c4..fff5c3f4466 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -383,7 +383,7 @@ class Drawable : public Thing, void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = 0 ); ///< flash a drawable in the color specified for a short time void colorTint( const RGBColor *color ); ///< tint this drawable the color specified void setTintEnvelope( const RGBColor *color, Real attack, Real decay ); ///< how to transition color - void flashAsSelected( const RGBColor *color = NULL ); ///< drawable takes care of the details if you spec no color + void flashAsSelected( const RGBColor *color = nullptr ); ///< drawable takes care of the details if you spec no color /// Return true if drawable has been marked as "selected" Bool isSelected( void ) const { return m_selected; } @@ -454,7 +454,7 @@ class Drawable : public Thing, // that the team is nonnull. void changedTeam(); - const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : NULL; } + const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : nullptr; } // this method must ONLY be called from the client, NEVER From the logic, not even indirectly. Bool clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform); @@ -478,7 +478,7 @@ class Drawable : public Thing, // this is a special-purpose call for W3DModelDraw. (srj) Bool getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const; - Bool getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = NULL) const; + Bool getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = nullptr) const; /** This call says, "I want the current animation (if any) to take n frames to complete a single cycle". @@ -555,9 +555,9 @@ class Drawable : public Thing, DrawableIconInfo* getIconInfo(); ///< lazily allocates, if necessary void killIcon(DrawableIconType t) { if (m_iconInfo) m_iconInfo->killIcon(t); } - Bool hasIconInfo() const { return m_iconInfo != NULL; } + Bool hasIconInfo() const { return m_iconInfo != nullptr; } - const AudioEventRTS * getAmbientSound() const { return m_ambientSound == NULL ? NULL : &m_ambientSound->m_event; } + const AudioEventRTS * getAmbientSound() const { return m_ambientSound == nullptr ? nullptr : &m_ambientSound->m_event; } protected: // snapshot methods diff --git a/Generals/Code/GameEngine/Include/GameClient/DrawableInfo.h b/Generals/Code/GameEngine/Include/GameClient/DrawableInfo.h index 1b469cc39c9..46b954fc1dd 100644 --- a/Generals/Code/GameEngine/Include/GameClient/DrawableInfo.h +++ b/Generals/Code/GameEngine/Include/GameClient/DrawableInfo.h @@ -46,7 +46,7 @@ struct DrawableInfo ERF_DELAYED_RENDER = ERF_IS_TRANSLUCENT|ERF_POTENTIAL_OCCLUDEE, }; - DrawableInfo(void) : m_shroudStatusObjectID(INVALID_ID), m_drawable(NULL), m_ghostObject(NULL), m_flags(ERF_IS_NORMAL) {} + DrawableInfo(void) : m_shroudStatusObjectID(INVALID_ID), m_drawable(nullptr), m_ghostObject(nullptr), m_flags(ERF_IS_NORMAL) {} ObjectID m_shroudStatusObjectID; ///doFXPos(primary, primaryMtx, primarySpeed, secondary, overrideRadius); } /// inline convenience method to avoid having to check for null. - inline static void doFXObj(const FXList* fx, const Object* primary, const Object* secondary = NULL) + inline static void doFXObj(const FXList* fx, const Object* primary, const Object* secondary = nullptr) { if (fx) { @@ -166,13 +166,13 @@ class FXList The main guts of the system: actually perform the sound and/or video effects needed. Note that primary and/or secondary can be null, so you must check for this. */ - void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f) const; + void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = nullptr, const Real primarySpeed = 0.0f, const Coord3D *secondary = nullptr, const Real overrideRadius = 0.0f) const; /** the object-based version... by default, just call the location-based implementation. Note that primary and/or secondary can be null, so you must check for this. */ - void doFXObj(const Object* primary, const Object* secondary = NULL) const; + void doFXObj(const Object* primary, const Object* secondary = nullptr) const; private: @@ -200,7 +200,7 @@ class FXListStore : public SubsystemInterface /** return the FXList with the given namekey. - return NULL if no such FXList exists. + return nullptr if no such FXList exists. */ const FXList *findFXList( const char* name ) const; diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h index 5619581ef57..0644183c913 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h +++ b/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h @@ -167,7 +167,7 @@ inline GameWindow *GadgetComboBoxGetDropDownButton( GameWindow *g ) if( comboBoxData && comboBoxData->dropDownButton ) return comboBoxData->dropDownButton; - return NULL; + return nullptr; } inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) { @@ -175,7 +175,7 @@ inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) if( comboBoxData && comboBoxData->listBox) return comboBoxData->listBox; - return NULL; + return nullptr; } @@ -185,7 +185,7 @@ inline GameWindow *GadgetComboBoxGetEditBox( GameWindow *g ) if( comboBoxData && comboBoxData->editBox) return comboBoxData->editBox; - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h index 02313409eef..d6349031d8b 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h +++ b/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h @@ -185,7 +185,7 @@ inline GameWindow *GadgetListBoxGetSlider( GameWindow *g ) if( listData && listData->slider ) return listData->slider; - return NULL; + return nullptr; } inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) { @@ -193,7 +193,7 @@ inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) if( listData && listData->upButton ) return listData->upButton; - return NULL; + return nullptr; } inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) { @@ -201,7 +201,7 @@ inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) if( listData && listData->downButton ) return listData->downButton; - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h index 5a8691a392b..017a4048b10 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h +++ b/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h @@ -81,10 +81,10 @@ void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) void GadgetButtonSetData(GameWindow *g, void *data); void *GadgetButtonGetData(GameWindow *g); void GadgetButtonSetAltSound( GameWindow *g, AsciiString altSound ); -inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } inline void GadgetButtonSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetEnabledSelectedColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } inline void GadgetButtonSetEnabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } inline const Image *GadgetButtonGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } @@ -94,10 +94,10 @@ inline const Image *GadgetButtonGetEnabledSelectedImage( GameWindow *g ) { r inline Color GadgetButtonGetEnabledSelectedColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } inline Color GadgetButtonGetEnabledSelectedBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } inline void GadgetButtonSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetDisabledSelectedColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } inline void GadgetButtonSetDisabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } inline const Image *GadgetButtonGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } @@ -107,10 +107,10 @@ inline const Image *GadgetButtonGetDisabledSelectedImage( GameWindow *g ) { inline Color GadgetButtonGetDisabledSelectedColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } inline Color GadgetButtonGetDisabledSelectedBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } inline void GadgetButtonSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetHiliteSelectedColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } inline void GadgetButtonSetHiliteSelectedBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } inline const Image *GadgetButtonGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h b/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h index 3ffc2a45007..1b3cfb034ab 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h +++ b/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h @@ -220,7 +220,7 @@ inline const Image *GadgetSliderGetEnabledThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetEnabledImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetEnabledThumbColor( GameWindow *g ) { @@ -244,7 +244,7 @@ inline const Image *GadgetSliderGetEnabledSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetEnabledSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetEnabledSelectedThumbColor( GameWindow *g ) { @@ -307,7 +307,7 @@ inline const Image *GadgetSliderGetDisabledThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetDisabledImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetDisabledThumbColor( GameWindow *g ) { @@ -331,7 +331,7 @@ inline const Image *GadgetSliderGetDisabledSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetDisabledSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetDisabledSelectedThumbColor( GameWindow *g ) { @@ -393,7 +393,7 @@ inline const Image *GadgetSliderGetHiliteThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetHiliteImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetHiliteThumbColor( GameWindow *g ) { @@ -417,7 +417,7 @@ inline const Image *GadgetSliderGetHiliteSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetHiliteSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetHiliteSelectedThumbColor( GameWindow *g ) { diff --git a/Generals/Code/GameEngine/Include/GameClient/GameClient.h b/Generals/Code/GameEngine/Include/GameClient/GameClient.h index 16b1f1d7a49..9f73f894b84 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameClient.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameClient.h @@ -215,7 +215,7 @@ class GameClient : public SubsystemInterface, do \ { \ Drawable* _xq_nextDrawable; \ - for (Drawable* DRAW = TheGameClient->firstDrawable(); DRAW != NULL; DRAW = _xq_nextDrawable ) \ + for (Drawable* DRAW = TheGameClient->firstDrawable(); DRAW != nullptr; DRAW = _xq_nextDrawable ) \ { \ _xq_nextDrawable = DRAW->getNextDrawable(); \ if (DRAW->getStatusFlags() & (STATUS)) \ @@ -246,29 +246,29 @@ extern GameClient *TheGameClient; // // GameEngine: // TheGameClient is partially disabled: -// TheKeyboard = NULL -// TheMouse = NULL +// TheKeyboard = nullptr +// TheMouse = nullptr // TheDisplay is partially disabled: -// m_3DInterfaceScene = NULL -// m_2DScene = NULL -// m_3DScene = NULL +// m_3DInterfaceScene = nullptr +// m_2DScene = nullptr +// m_3DScene = nullptr // (m_assetManager remains!) // TheWindowManager = GameWindowManagerDummy -// TheIMEManager = NULL +// TheIMEManager = nullptr // TheTerrainVisual is partially disabled: -// TheTerrainTracksRenderObjClassSystem = NULL -// TheW3DShadowManager = NULL -// TheWaterRenderObj = NULL -// TheSmudgeManager = NULL +// TheTerrainTracksRenderObjClassSystem = nullptr +// TheW3DShadowManager = nullptr +// TheWaterRenderObj = nullptr +// TheSmudgeManager = nullptr // TheTerrainRenderObject is partially disabled: -// m_treeBuffer = NULL -// m_propBuffer = NULL -// m_bibBuffer = NULL +// m_treeBuffer = nullptr +// m_propBuffer = nullptr +// m_bibBuffer = nullptr // m_bridgeBuffer is partially disabled: -// m_vertexBridge = NULL -// m_indexBridge = NULL -// m_vertexMaterial = NULL -// m_waypointBuffer = NULL -// m_roadBuffer = NULL -// m_shroud = NULL +// m_vertexBridge = nullptr +// m_indexBridge = nullptr +// m_vertexMaterial = nullptr +// m_waypointBuffer = nullptr +// m_roadBuffer = nullptr +// m_shroud = nullptr // TheRadar = RadarDummy diff --git a/Generals/Code/GameEngine/Include/GameClient/GameFont.h b/Generals/Code/GameEngine/Include/GameClient/GameFont.h index 2307e00547b..0119bcf2d8a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameFont.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameFont.h @@ -98,7 +98,7 @@ inline GameFont *FontLibrary::nextFont( GameFont *font ) { if( font ) return font->next; - return NULL; + return nullptr; } // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GameText.h b/Generals/Code/GameEngine/Include/GameClient/GameText.h index 65d9ce60fbf..11f530de6b7 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameText.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameText.h @@ -72,8 +72,8 @@ class GameTextInterface : public SubsystemInterface virtual ~GameTextInterface() {}; - virtual UnicodeString fetch( const Char *label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text - virtual UnicodeString fetch( AsciiString label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text ; TheSuperHackers @todo Remove + virtual UnicodeString fetch( const Char *label, Bool *exists = nullptr ) = 0; ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( AsciiString label, Bool *exists = nullptr ) = 0; ///< Returns the associated labeled unicode text ; TheSuperHackers @todo Remove virtual UnicodeString fetchFormat( const Char *label, ... ) = 0; // Do not call this directly, but use the FETCH_OR_SUBSTITUTE macro diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h index 05bcc41d18b..f9d27b3593c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h @@ -437,7 +437,7 @@ class GameWindowDummy : public GameWindow MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(GameWindowDummy, "GameWindowDummy") public: virtual void winDrawBorder() {} - virtual void* winGetUserData(void) { return NULL; } + virtual void* winGetUserData(void) { return nullptr; } }; // ModalWindow ---------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h index 6b14f7bba29..bdaa7863de4 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -197,7 +197,7 @@ friend class GameWindow; //--------------------------------------------------------------------------- // Creating windows /// create new window(s) from .wnd file ... see definition for what is returned - virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = NULL ); + virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = nullptr ); /// create new window(s) from .wnd file and wrap in a WindowLayout virtual WindowLayout *winCreateLayout( AsciiString filename ); @@ -209,7 +209,7 @@ friend class GameWindow; virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, Int x, Int y, Int width, Int height, GameWinSystemFunc system, - WinInstanceData *instData = NULL ); + WinInstanceData *instData = nullptr ); //--------------------------------------------------------------------------- // Manipulating windows in the system @@ -270,7 +270,7 @@ friend class GameWindow; WindowMsgData mData1, WindowMsgData mData2 ); /** get the window pointer from id, starting at 'window' and searching - down the heirarchy. If 'window' is NULL then all windows will + down the heirarchy. If 'window' is nullptr then all windows will be searched */ virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id ); virtual Int winCapture( GameWindow *window ); ///< captures the mouse @@ -389,26 +389,26 @@ class GameWindowManagerDummy : public GameWindowManager virtual GameWindow *allocateNewWindow() { return newInstance(GameWindowDummy); } - virtual GameWinDrawFunc getPushButtonImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getPushButtonDrawFunc() { return NULL; } - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getCheckBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getRadioButtonDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTabControlImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTabControlDrawFunc() { return NULL; } - virtual GameWinDrawFunc getListBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getListBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getComboBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getComboBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() { return NULL; } - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getVerticalSliderDrawFunc() { return NULL; } - virtual GameWinDrawFunc getProgressBarImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getProgressBarDrawFunc() { return NULL; } - virtual GameWinDrawFunc getStaticTextImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getStaticTextDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTextEntryImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTextEntryDrawFunc() { return NULL; } + virtual GameWinDrawFunc getPushButtonImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getPushButtonDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getCheckBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getCheckBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getRadioButtonImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getRadioButtonDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTabControlImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTabControlDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getListBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getListBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getComboBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getComboBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getHorizontalSliderDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getVerticalSliderDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getProgressBarImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getProgressBarDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getStaticTextImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getStaticTextDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTextEntryImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTextEntryDrawFunc() { return nullptr; } }; diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index c267fa9f03f..ce043f4a3b7 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -103,7 +103,7 @@ static const LookupListRec TransitionStyleNames[] = { "CONTROLBARARROW", CONTROL_BAR_ARROW_TRANSITION }, { "SCORESCALEUP", SCORE_SCALE_UP_TRANSITION }, { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TransitionStyleNames) == MAX_TRANSITION_WINDOW_STYLES + 1, "Incorrect array size"); @@ -122,7 +122,7 @@ class Transition virtual void skip( void ) = 0; - void unlinkGameWindow(GameWindow* win) { if ( m_win == win ) m_win = NULL; } + void unlinkGameWindow(GameWindow* win) { if ( m_win == win ) m_win = nullptr; } Bool isFinished( void ) { return m_isFinished; } Int getFrameLength( void ){ return m_frameLength; } protected: diff --git a/Generals/Code/GameEngine/Include/GameClient/Image.h b/Generals/Code/GameEngine/Include/GameClient/Image.h index 0f68b50949a..8b24a35a72c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Image.h +++ b/Generals/Code/GameEngine/Include/GameClient/Image.h @@ -53,7 +53,7 @@ static const char *const imageStatusNames[] = { "ROTATED_90_CLOCKWISE", "RAW_TEXTURE", - NULL + nullptr }; #endif // end DEFINE_IMAGE_STATUS_NAMES @@ -142,7 +142,7 @@ class ImageCollection : public SubsystemInterface for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) if (!index--) return i->second; - return NULL; + return nullptr; } protected: diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index 710b5efe419..0be94105846 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -130,7 +130,7 @@ static const char *const TheRadiusCursorNames[] = "RADAR", "SPYDRONE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); #endif @@ -447,7 +447,7 @@ friend class Drawable; // for selection/deselection transactions virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of virtual void setRadiusCursor(RadiusCursorType r, const SpecialPowerTemplate* sp, WeaponSlotType wslot); - virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, NULL, PRIMARY_WEAPON); } + virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, nullptr, PRIMARY_WEAPON); } virtual void setInputEnabled( Bool enable ); ///< Set the input enabled or disabled virtual Bool getInputEnabled( void ) { return m_inputEnabled; } ///< Get the current input status @@ -668,7 +668,7 @@ friend class Drawable; // for selection/deselection transactions void incrementSelectCount( void ) { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables void decrementSelectCount( void ) { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables virtual View *createView( void ) = 0; ///< Factory for Views - void evaluateSoloNexus( Drawable *newlyAddedDrawable = NULL ); + void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr ); /// expire a hint from of the specified type at the hint index void expireHint( HintType type, UnsignedInt hintIndex ); @@ -679,7 +679,7 @@ friend class Drawable; // for selection/deselection transactions void setMouseCursor(Mouse::MouseCursor c); - void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = NULL ); ///< internal workhorse for adding plain text for messages + void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr ); ///< internal workhorse for adding plain text for messages void removeMessageAtIndex( Int i ); ///< remove the message at index i void updateFloatingText( void ); ///< Update function to move our floating text diff --git a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h index 8e54ae6ac1c..86452c43e97 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h @@ -117,7 +117,7 @@ class Keyboard : public SubsystemInterface // access methods for key data void resetKeys( void ); ///< reset the state of the keys KeyboardIO *getFirstKey( void ); ///< get first key ready for processing - KeyboardIO *findKey( KeyDefType key, KeyboardIO::StatusType status ); ///< get key ready for processing, can return NULL + KeyboardIO *findKey( KeyDefType key, KeyboardIO::StatusType status ); ///< get key ready for processing, can return nullptr void setKeyStatusData( KeyDefType key, KeyboardIO::StatusType data ); ///< set key status WideChar translateKey( WideChar keyCode ); ///< translate key code to printable UNICODE char diff --git a/Generals/Code/GameEngine/Include/GameClient/Line2D.h b/Generals/Code/GameEngine/Include/GameClient/Line2D.h index 218ebb40b89..e212d4b2b07 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Line2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Line2D.h @@ -39,10 +39,10 @@ extern Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, ///< IntersectLine2D will take two segments delimited by ab and cd and will return whether ///< they intersect within the length of ab. They will also return the intersection point out -///< intersection if it is non-NULL. +///< intersection if it is non-null. extern Bool IntersectLine2D( const Coord2D *a, const Coord2D *b, const Coord2D *c, const Coord2D *d, - Coord2D *intersection = NULL); + Coord2D *intersection = nullptr); ///< PointInsideRect2D will return true iff inputPoint lies iside of the rectangle specified ///< by bl, tl, br, tr. diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index 497f78f9013..64e9291d724 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -55,7 +55,7 @@ static const LookupListRec CategoryListName[] = {"TEAM", CATEGORY_TEAM}, {"MISC", CATEGORY_MISC}, {"DEBUG", CATEGORY_DEBUG}, - {NULL, 0} + { nullptr, 0} }; @@ -258,7 +258,7 @@ static const LookupListRec KeyNames[] = { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, { "KEY_NONE", MK_NONE }, - { NULL, 0 } + { nullptr, 0 } }; // ------------------------------------------------------------------------------- @@ -276,7 +276,7 @@ static const LookupListRec TransitionNames[] = { "DOWN", DOWN }, { "UP", UP }, { "DOUBLEDOWN", DOUBLEDOWN }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TransitionNames) == MAPPABLE_KEY_TRANSITION_COUNT + 1, "Incorrect array size"); @@ -304,7 +304,7 @@ static const LookupListRec ModifierNames[] = { "SHIFT_CTRL", SHIFT_CTRL }, { "SHIFT_ALT", SHIFT_ALT }, { "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL }, - { NULL, 0 } + { nullptr, 0 } }; @@ -328,7 +328,7 @@ static const char* const TheCommandUsableInNames[] = "GAME", "OBSERVER", - NULL + nullptr }; // ------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 07583b79f78..376733a9680 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -295,7 +295,7 @@ class Mouse : public SubsystemInterface Int getCursorTooltipDelay() { return m_tooltipDelay; } void setCursorTooltipDelay(Int delay) { m_tooltipDelay = delay; } - void setCursorTooltip( UnicodeString tooltip, Int tooltipDelay = -1, const RGBColor *color = NULL, Real width = 1.0f ); ///< set tooltip string at cursor + void setCursorTooltip( UnicodeString tooltip, Int tooltipDelay = -1, const RGBColor *color = nullptr, Real width = 1.0f ); ///< set tooltip string at cursor void setMouseText( UnicodeString text, const RGBAColorInt *color, const RGBAColorInt *dropColor ); ///< set the cursor text, *NOT* the tooltip text virtual void setMouseLimits( void ); ///< update the limit extents the mouse can move in MouseCursor getMouseCursor(void) { return m_currentCursor; } ///< get the current mouse cursor image type diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index 8b2194f5332..0a6f2078b45 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -174,7 +174,7 @@ class Particle : public MemoryPoolObject, void doWindMotion( void ); ///< do wind motion (if present) from particle system void applyForce( const Coord3D *force ); ///< add the given acceleration - void detachDrawable( void ) { m_drawable = NULL; } ///< detach the Drawable pointer from this particle + void detachDrawable( void ) { m_drawable = nullptr; } ///< detach the Drawable pointer from this particle const Coord3D *getPosition( void ) { return &m_pos; } Real getSize( void ) { return m_size; } @@ -188,7 +188,7 @@ class Particle : public MemoryPoolObject, void setIsCulled (Bool enable) { m_isCulled = enable;} ///< set particle to not visible because it's outside view frustum void controlParticleSystem( ParticleSystem *sys ) { m_systemUnderControl = sys; } - void detachControlledParticleSystem( void ) { m_systemUnderControl = NULL; } + void detachControlledParticleSystem( void ) { m_systemUnderControl = nullptr; } // get priority of this particle ... which is the priority of the system it belongs to ParticlePriorityType getPriority( void ); @@ -455,37 +455,37 @@ class ParticleSystemInfo : public Snapshot static const char *const ParticleShaderTypeNames[] = { - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL + "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", nullptr }; static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); static const char *const ParticleTypeNames[] = { - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", NULL + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", nullptr }; static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); static const char *const EmissionVelocityTypeNames[] = { - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL + "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", nullptr }; static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); static const char *const EmissionVolumeTypeNames[] = { - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL + "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", nullptr }; static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); static const char *const ParticlePriorityNames[] = { - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL + "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", nullptr }; static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); static const char *const WindMotionNames[] = { - "NONE", "Unused", "PingPong", "Circular", NULL + "NONE", "Unused", "PingPong", "Circular", nullptr }; static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); @@ -504,7 +504,7 @@ class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystem AsciiString getName( void ) const { return m_name; } // This function was made const because of update modules' module data being all const. - ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-NULL, it is a slave system for use + ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-null, it is a slave system for use const FieldParse *getFieldParse( void ) const { return m_fieldParseTable; } ///< Parsing from INI access static void parseRGBColorKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); @@ -528,7 +528,7 @@ class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystem AsciiString m_name; ///< the name of this template // This has to be mutable because of the delayed initialization thing in createSlaveSystem - mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-NULL, use this to create a slave system + mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-null, use this to create a slave system // template attribute data inherited from ParticleSystemInfo class }; @@ -617,7 +617,7 @@ class ParticleSystem : public MemoryPoolObject, Bool isSaveable( void ) const { return m_isSaveable; } /// called when the particle this system is controlled by dies - void detachControlParticle( Particle *p ) { m_controlParticle = NULL; } + void detachControlParticle( Particle *p ) { m_controlParticle = nullptr; } /// called to merge two systems info. If slaveNeedsFullPromotion is true, then the slave needs to be aware of how many particles /// to generate as well. @@ -695,14 +695,14 @@ class ParticleSystem : public MemoryPoolObject, Coord3D m_pos; ///< this is the position to emit at. Coord3D m_lastPos; ///< this is the previous position we emitted at. - ParticleSystem * m_slaveSystem; ///< if non-NULL, another system this one has control of + ParticleSystem * m_slaveSystem; ///< if non-null, another system this one has control of ParticleSystemID m_slaveSystemID; ///< id of slave system (if present) - ParticleSystem * m_masterSystem; ///< if non-NULL, the system that controls this one + ParticleSystem * m_masterSystem; ///< if non-null, the system that controls this one ParticleSystemID m_masterSystemID; ///< master system id (if present); const ParticleSystemTemplate * m_template; ///< the template this system was constructed from - Particle * m_controlParticle; ///< if non-NULL, this system is controlled by this particle + Particle * m_controlParticle; ///< if non-null, this system is controlled by this particle Bool m_isLocalIdentity; ///< if true, the matrix can be ignored Bool m_isIdentity; ///< if true, the matrix can be ignored @@ -824,4 +824,4 @@ class ParticleSystemManager : public SubsystemInterface, extern ParticleSystemManager *TheParticleSystemManager; class DebugDisplayInterface; -extern void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL ); +extern void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = nullptr ); diff --git a/Generals/Code/GameEngine/Include/GameClient/Shadow.h b/Generals/Code/GameEngine/Include/GameClient/Shadow.h index 0ea345a84f8..2e40ea7ae3a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Shadow.h +++ b/Generals/Code/GameEngine/Include/GameClient/Shadow.h @@ -56,7 +56,7 @@ static const char* const TheShadowNames[] = "SHADOW_DIRECTIONAL_PROJECTION", "SHADOW_ALPHA_DECAL", "SHADOW_ADDITIVE_DECAL", - NULL + nullptr }; #endif // end DEFINE_SHADOW_NAMES diff --git a/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h b/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h index 155c6e91bbf..97362825638 100644 --- a/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h +++ b/Generals/Code/GameEngine/Include/GameClient/WindowLayout.h @@ -72,9 +72,9 @@ class WindowLayout : public MemoryPoolObject GameWindow *getFirstWindow( void ) const; ///< get first window in list for screen // accessing layout callbacks ------------------------------------------------------------------ - void runInit( void *userData = NULL ); ///< run the init method if available - void runUpdate( void *userData = NULL ); ///< run the update method if available - void runShutdown( void *userData = NULL ); ///< run the shutdown method if available + void runInit( void *userData = nullptr ); ///< run the init method if available + void runUpdate( void *userData = nullptr ); ///< run the update method if available + void runShutdown( void *userData = nullptr ); ///< run the shutdown method if available void setInit( WindowLayoutInitFunc init ); ///< set the init callback void setUpdate( WindowLayoutUpdateFunc update ); ///< set the update callback void setShutdown( WindowLayoutShutdownFunc shutdown); ///< set the shutdown callback diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index 8d3646c2685..1ac8581523a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -99,7 +99,7 @@ class AISideInfo : public MemoryPoolObject { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AISideInfo, "AISideInfo") public: - AISideInfo( void ) : m_easy(0), m_normal(1), m_hard(2), m_next(NULL) + AISideInfo( void ) : m_easy(0), m_normal(1), m_hard(2), m_next(nullptr) { m_side.clear(); m_baseDefenseStructure1.clear(); @@ -257,7 +257,7 @@ class AI : public SubsystemInterface, public Snapshot UNFOGGED = 1 << 5 }; Object *findClosestEnemy( const Object *me, Real range, UnsignedInt qualifiers, - const AttackPriorityInfo *info=NULL, PartitionFilter *optionalFilter=NULL); + const AttackPriorityInfo *info=nullptr, PartitionFilter *optionalFilter=nullptr); Object *findClosestRepulsor( const Object *me, Real range); @@ -332,7 +332,7 @@ static const char *const TheCommandSourceMaskNames[] = "FROM_AI", "FROM_DOZER", //don't use this - NULL + nullptr }; static_assert(ARRAY_SIZE(TheCommandSourceMaskNames) == COMMAND_SOURCE_TYPE_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIGuard.h b/Generals/Code/GameEngine/Include/GameLogic/AIGuard.h index 9672c5668f2..36d8a66dc1a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIGuard.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIGuard.h @@ -138,7 +138,7 @@ class AIGuardInnerState : public State public: AIGuardInnerState( StateMachine *machine ) : State( machine, "AIGuardInner" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); @@ -184,7 +184,7 @@ class AIGuardOuterState : public State public: AIGuardOuterState( StateMachine *machine ) : State( machine, "AIGuardOuter" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index a66480e02e8..a9bd8b2cd77 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -77,7 +77,7 @@ class PathNode : public MemoryPoolObject void setNextOptimized( PathNode *node ); - PathNode *getNextOptimized(Coord2D* dir = NULL, Real* dist = NULL) ///< return next node in optimized path + PathNode *getNextOptimized(Coord2D* dir = nullptr, Real* dist = nullptr) ///< return next node in optimized path { if (dir) *dir = m_nextOptiDirNorm2D; @@ -86,7 +86,7 @@ class PathNode : public MemoryPoolObject return m_nextOpti; } - const PathNode *getNextOptimized(Coord2D* dir = NULL, Real* dist = NULL) const ///< return next node in optimized path + const PathNode *getNextOptimized(Coord2D* dir = nullptr, Real* dist = nullptr) const ///< return next node in optimized path { if (dir) *dir = m_nextOptiDirNorm2D; @@ -317,7 +317,7 @@ class PathfindCell /// remove all cells from closed list. static Int releaseOpenList( PathfindCell *list ); - inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell:NULL;} + inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell: nullptr;} inline UnsignedShort getXIndex(void) const {return m_info->m_pos.x;} inline UnsignedShort getYIndex(void) const {return m_info->m_pos.y;} @@ -336,7 +336,7 @@ class PathfindCell void setParentCell(PathfindCell* parent); void clearParentCell(void); void setParentCellHierarchical(PathfindCell* parent); - inline PathfindCell* getParentCell(void) const {return m_info->m_pathParent?m_info->m_pathParent->m_cell:NULL;} + inline PathfindCell* getParentCell(void) const {return m_info->m_pathParent?m_info->m_pathParent->m_cell: nullptr;} Bool startPathfind( PathfindCell *goalCell ); Bool getPinched(void) const {return m_pinched;} @@ -344,7 +344,7 @@ class PathfindCell Bool allocateInfo(const ICoord2D &pos); void releaseInfo(void); - Bool hasInfo(void) const {return m_info!=NULL;} + Bool hasInfo(void) const {return m_info!=nullptr;} zoneStorageType getZone(void) const {return m_zone;} void setZone(zoneStorageType zone) {m_zone = zone;} void setGoalUnit(ObjectID unit, const ICoord2D &pos ); @@ -665,7 +665,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot void setIgnoreObstacleID( ObjectID objID ); ///< if non-zero, the pathfinder will ignore the given obstacle - Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell = NULL ); ///< Return true if given position is a valid movement location + Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell = nullptr ); ///< Return true if given position is a valid movement location Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Int x, Int y ); ///< Return true if given position is a valid movement location Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, const Coord3D *pos ); ///< Return true if given position is a valid movement location Bool validMovementTerrain( PathfindLayerEnum layer, const Locomotor* locomotor, const Coord3D *pos ); ///< Return true if given position is a valid movement location @@ -698,7 +698,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot // Adjusts the destination to a spot near dest that is not occupied by other units. Bool adjustDestination(Object *obj, const LocomotorSet& locomotorSet, - Coord3D *dest, const Coord3D *groupDest=NULL); + Coord3D *dest, const Coord3D *groupDest=nullptr); // Adjusts the destination to a spot near dest for landing that is not occupied by other units. Bool adjustToLandingDestination(Object *obj, Coord3D *dest); @@ -922,7 +922,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, Int x, Int y if (x >= m_extent.lo.x && x <= m_extent.hi.x && y >= m_extent.lo.y && y <= m_extent.hi.y) { - PathfindCell *cell = NULL; + PathfindCell *cell = nullptr; if (layer > LAYER_GROUND && layer <= LAYER_LAST) { cell = m_layers[layer].getCell(x, y); @@ -933,7 +933,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, Int x, Int y } else { - return NULL; + return nullptr; } } @@ -941,7 +941,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, const Coord3D { ICoord2D cell; Bool overflow = worldToCell( pos, &cell ); - if (overflow) return NULL; + if (overflow) return nullptr; return getCell( layer, cell.x, cell.y ); } diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h b/Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h index 1e42be06037..9c5d09d1e38 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPlayer.h @@ -50,7 +50,7 @@ class WorkOrder : public MemoryPoolObject, public: - WorkOrder():m_thing(NULL), m_factoryID(INVALID_ID), m_isResourceGatherer(false), m_numCompleted(0), m_numRequired(1), m_next(NULL) {}; + WorkOrder():m_thing(nullptr), m_factoryID(INVALID_ID), m_isResourceGatherer(false), m_numCompleted(0), m_numRequired(1), m_next(nullptr) {}; Bool isWaitingToBuild( void ); ///< return true if nothing is yet building this unit void validateFactory( Player *thisPlayer ); ///< verify factoryID still refers to an active object @@ -106,9 +106,9 @@ class TeamInQueue : public MemoryPoolObject, public: TeamInQueue() : - m_workOrders(NULL), - m_team(NULL), - m_nextTeamInQueue(NULL), + m_workOrders(nullptr), + m_team(nullptr), + m_nextTeamInQueue(nullptr), m_sentToStartLocation(false), m_reinforcement(false), m_stopQueueing(false), @@ -179,7 +179,7 @@ class AIPlayer : public MemoryPoolObject, virtual void recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadius); ///< Builds this team immediately. virtual Bool isSkirmishAI(void) {return false;} - virtual Player *getAiEnemy(void) {return NULL;} ///< Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba. + virtual Player *getAiEnemy(void) {return nullptr;} ///< Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba. virtual Bool checkBridges(Object *unit, Waypoint *way) {return false;} virtual void repairStructure(ObjectID structure); diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h index 7e39c8ec7c5..72f11a486cc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -649,7 +649,7 @@ class AIFollowWaypointPathExactState : public AIInternalMoveToState MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIFollowWaypointPathExactState, "AIFollowWaypointPathExactState") public: AIFollowWaypointPathExactState( StateMachine *machine, Bool asGroup ) : m_moveAsGroup(asGroup), - m_lastWaypoint(NULL), + m_lastWaypoint(nullptr), AIInternalMoveToState( machine, "AIFollowWaypointPathExactState" ) { } virtual StateReturnType onEnter(); virtual void onExit( StateExitType status ); @@ -1013,7 +1013,7 @@ class AIAttackSquadState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIAttackSquadState, "AIAttackSquadState") public: - AIAttackSquadState( StateMachine *machine, AttackExitConditionsInterface *attackParameters = NULL) : + AIAttackSquadState( StateMachine *machine, AttackExitConditionsInterface *attackParameters = nullptr) : State( machine , "AIAttackSquadState") { } //~AIAttackSquadState(); @@ -1058,7 +1058,7 @@ class AIDockState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIDockState, "AIDockState") public: - AIDockState( StateMachine *machine ) : State( machine, "AIDockState" ), m_dockMachine(NULL), m_usingPrecisionMovement(FALSE) { } + AIDockState( StateMachine *machine ) : State( machine, "AIDockState" ), m_dockMachine(nullptr), m_usingPrecisionMovement(FALSE) { } //~AIDockState(); virtual StateReturnType onEnter(); virtual void onExit( StateExitType status ); @@ -1126,9 +1126,9 @@ class AIGuardState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIGuardState, "AIGuardState") public: - AIGuardState( StateMachine *machine ) : State( machine, "AIGuardState" ), m_guardMachine(NULL) + AIGuardState( StateMachine *machine ) : State( machine, "AIGuardState" ), m_guardMachine(nullptr) { - m_guardMachine = NULL; + m_guardMachine = nullptr; } //~AIGuardState(); virtual StateReturnType onEnter(); @@ -1155,9 +1155,9 @@ class AITunnelNetworkGuardState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AITunnelNetworkGuardState, "AITunnelNetworkGuardState") public: - AITunnelNetworkGuardState( StateMachine *machine ) : State( machine, "AITunnelNetworkGuardState" ), m_guardMachine(NULL) + AITunnelNetworkGuardState( StateMachine *machine ) : State( machine, "AITunnelNetworkGuardState" ), m_guardMachine(nullptr) { - m_guardMachine = NULL; + m_guardMachine = nullptr; } //~AIGuardState(); virtual StateReturnType onEnter(); @@ -1184,7 +1184,7 @@ class AIHuntState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIHuntState, "AIHuntState") public: - AIHuntState( StateMachine *machine ) : State( machine, "AIHuntState" ), m_huntMachine(NULL) + AIHuntState( StateMachine *machine ) : State( machine, "AIHuntState" ), m_huntMachine(nullptr) { m_nextEnemyScanTime = 0; } @@ -1216,7 +1216,7 @@ class AIAttackAreaState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIAttackAreaState, "AIAttackAreaState") public: - AIAttackAreaState( StateMachine *machine ) : State( machine, "AIAttackAreaState" ), m_attackMachine(NULL), + AIAttackAreaState( StateMachine *machine ) : State( machine, "AIAttackAreaState" ), m_attackMachine(nullptr), m_nextEnemyScanTime(0) { } //~AIAttackAreaState(); virtual StateReturnType onEnter(); diff --git a/Generals/Code/GameEngine/Include/GameLogic/AITNGuard.h b/Generals/Code/GameEngine/Include/GameLogic/AITNGuard.h index ec7efe94237..7aad1370723 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AITNGuard.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AITNGuard.h @@ -120,7 +120,7 @@ class AITNGuardInnerState : public State public: AITNGuardInnerState( StateMachine *machine ) : State( machine, "AITNGuardInner" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); @@ -167,7 +167,7 @@ class AITNGuardOuterState : public State public: AITNGuardOuterState( StateMachine *machine ) : State( machine, "AITNGuardOuter" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Armor.h b/Generals/Code/GameEngine/Include/GameLogic/Armor.h index 829d1e84f1f..dacf23a594e 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Armor.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Armor.h @@ -70,7 +70,7 @@ class Armor { public: - inline Armor(const ArmorTemplate* tmpl = NULL) : m_template(tmpl) + inline Armor(const ArmorTemplate* tmpl = nullptr) : m_template(tmpl) { } @@ -81,7 +81,7 @@ class Armor inline void clear() { - m_template = NULL; + m_template = nullptr; } private: diff --git a/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h b/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h index d684bee3675..9242375d903 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ArmorSet.h @@ -71,8 +71,8 @@ class ArmorTemplateSet void clear() { m_types.clear(); - m_template = NULL; - m_fx = NULL; + m_template = nullptr; + m_fx = nullptr; } const ArmorTemplate* getArmorTemplate() const { return m_template; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Damage.h b/Generals/Code/GameEngine/Include/GameLogic/Damage.h index 452fde8ce2f..e4f5c9fc88c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Damage.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Damage.h @@ -132,7 +132,7 @@ static const char *const TheDamageNames[] = "COMANCHE_VULCAN", "FLESHY_SNIPER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheDamageNames) == DAMAGE_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DAMAGE_NAMES @@ -222,7 +222,7 @@ static const char *const TheDeathNames[] = "EXTRA_7", "EXTRA_8", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheDeathNames) == DEATH_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DEATH_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index 5a138b5c195..875f60e3b2a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -404,11 +404,11 @@ inline Bool GameLogic::isLoadingGame(){ return m_loadingScene;} inline Object* GameLogic::findObjectByID( ObjectID id ) { if( id == INVALID_ID ) - return NULL; + return nullptr; ObjectPtrHash::iterator it = m_objHash.find(id); if (it == m_objHash.end()) - return NULL; + return nullptr; return (*it).second; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h b/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h index a074f4f3496..9b324985bdb 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Locomotor.h @@ -83,7 +83,7 @@ static const char *const TheLocomotorAppearanceNames[] = "CLIMBER", "OTHER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorAppearanceNames) == LOCOMOTOR_APPEARANCE_COUNT + 1, "Array size"); #endif @@ -115,7 +115,7 @@ static const char *const TheLocomotorBehaviorZNames[] = "FIXED_RELATIVE_TO_GROUND_AND_BUILDINGS", "RELATIVE_TO_HIGHEST_LAYER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorBehaviorZNames) == LOCOMOTOR_BEHAVIOR_Z_COUNT + 1, "Array size"); #endif @@ -367,14 +367,14 @@ class Locomotor : public MemoryPoolObject, public Snapshot void maintainCurrentPositionHover(Object* obj, PhysicsBehavior *physics); void maintainCurrentPositionWings(Object* obj, PhysicsBehavior *physics); - PhysicsTurningType rotateTowardsPosition(Object* obj, const Coord3D& goalPos, Real *relAngle=NULL); + PhysicsTurningType rotateTowardsPosition(Object* obj, const Coord3D& goalPos, Real *relAngle=nullptr); /* return true if we can maintain the position without being called every frame (eg, we are resting on the ground), false if not (eg, we are hovering or circling) */ Bool handleBehaviorZ(Object* obj, PhysicsBehavior *physics, const Coord3D& goalPos); - PhysicsTurningType rotateObjAroundLocoPivot(Object* obj, const Coord3D& goalPos, Real maxTurnRate, Real *relAngle = NULL); + PhysicsTurningType rotateObjAroundLocoPivot(Object* obj, const Coord3D& goalPos, Real maxTurnRate, Real *relAngle = nullptr); Real getSurfaceHtAtPt(Real x, Real y); Real calcLiftToUseAtPt(Object* obj, PhysicsBehavior *physics, Real curZ, Real surfaceAtPt, Real preferredHeight); diff --git a/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h b/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h index e73f804193e..f15c33dd361 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/LocomotorSet.h @@ -66,7 +66,7 @@ static const char *const TheLocomotorSurfaceTypeNames[] = "AIR", "RUBBLE", - NULL + nullptr }; #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index b47f353ecfa..c3a905a2a64 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -105,7 +105,7 @@ static const char *const TheLocomotorSetNames[] = "SET_SUPERSONIC", "SET_SLUGGISH", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorSetNames) == LOCOMOTORSET_COUNT + 1, "Incorrect array size"); #endif @@ -128,7 +128,7 @@ static const char *const TheAutoAcquireEnemiesNames[] = "NOTWHILEATTACKING", "ATTACK_BUILDINGS", - NULL + nullptr }; #endif @@ -297,19 +297,19 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); } // Some very specific, complex behaviors are used by more than one AIUpdate. Here are their interfaces. - virtual DozerAIInterface* getDozerAIInterface() {return NULL;} - virtual SupplyTruckAIInterface* getSupplyTruckAIInterface() {return NULL;} - virtual const DozerAIInterface* getDozerAIInterface() const {return NULL;} - virtual const SupplyTruckAIInterface* getSupplyTruckAIInterface() const {return NULL;} + virtual DozerAIInterface* getDozerAIInterface() {return nullptr;} + virtual SupplyTruckAIInterface* getSupplyTruckAIInterface() {return nullptr;} + virtual const DozerAIInterface* getDozerAIInterface() const {return nullptr;} + virtual const SupplyTruckAIInterface* getSupplyTruckAIInterface() const {return nullptr;} #ifdef ALLOW_SURRENDER - virtual POWTruckAIUpdateInterface *getPOWTruckAIUpdateInterface( void ) { return NULL; } + virtual POWTruckAIUpdateInterface *getPOWTruckAIUpdateInterface( void ) { return nullptr; } #endif - virtual WorkerAIInterface* getWorkerAIInterface( void ) { return NULL; } - virtual const WorkerAIInterface* getWorkerAIInterface( void ) const { return NULL; } - virtual HackInternetAIInterface* getHackInternetAIInterface() { return NULL; } - virtual const HackInternetAIInterface* getHackInternetAIInterface() const { return NULL; } - virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return NULL; } - virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const { return NULL; } + virtual WorkerAIInterface* getWorkerAIInterface( void ) { return nullptr; } + virtual const WorkerAIInterface* getWorkerAIInterface( void ) const { return nullptr; } + virtual HackInternetAIInterface* getHackInternetAIInterface() { return nullptr; } + virtual const HackInternetAIInterface* getHackInternetAIInterface() const { return nullptr; } + virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return nullptr; } + virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const { return nullptr; } #ifdef ALLOW_SURRENDER void setSurrendered( const Object *objWeSurrenderedTo, Bool surrendered ); @@ -352,7 +352,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual Object* construct( const ThingTemplate *what, const Coord3D *pos, Real angle, Player *owningPlayer, - Bool isRebuild ) { return NULL; }///< construct a building + Bool isRebuild ) { return nullptr; }///< construct a building void ignoreObstacle( const Object *obj ); ///< tell the pathfinder to ignore the given object as an obstacle @@ -415,7 +415,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface Bool hasLocomotorForSurface(LocomotorSurfaceType surfaceType); // turret stuff. - WhichTurretType getWhichTurretForWeaponSlot(WeaponSlotType wslot, Real* turretAngle, Real* turretPitch = NULL) const; + WhichTurretType getWhichTurretForWeaponSlot(WeaponSlotType wslot, Real* turretAngle, Real* turretPitch = nullptr) const; WhichTurretType getWhichTurretForCurWeapon() const; /** return true iff the weapon is on a turret, that turret is trying to aim at the victim, @@ -457,7 +457,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface void cancelPath(void); ///< Called if we no longer need the path. Path* getPath( void ) { return m_path; } ///< return the agent's current path const Path* getPath( void ) const { return m_path; } ///< return the agent's current path - void destroyPath( void ); ///< destroy the current path, setting it to NULL + void destroyPath( void ); ///< destroy the current path, setting it to null UnsignedInt getPathAge( void ) const { return TheGameLogic->getFrame() - m_pathTimestamp; } ///< return the "age" of the path Bool isPathAvailable( const Coord3D *destination ) const; ///< does a path exist between us and the destination Bool isQuickPathAvailable( const Coord3D *destination ) const; ///< does a path (using quick pathfind) exist between us and the destination diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h index 9a7cba0a7d3..38571a42640 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h @@ -61,8 +61,8 @@ class AssaultTransportAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "MembersGetHealedAtLifeRatio", INI::parseReal, NULL, offsetof( AssaultTransportAIUpdateModuleData, m_membersGetHealedAtLifeRatio ) }, - { "ClearRangeRequiredToContinueAttackMove", INI::parseReal, NULL, offsetof( AssaultTransportAIUpdateModuleData, m_clearRangeRequiredToContinueAttackMove ) }, + { "MembersGetHealedAtLifeRatio", INI::parseReal, nullptr, offsetof( AssaultTransportAIUpdateModuleData, m_membersGetHealedAtLifeRatio ) }, + { "ClearRangeRequiredToContinueAttackMove", INI::parseReal, nullptr, offsetof( AssaultTransportAIUpdateModuleData, m_clearRangeRequiredToContinueAttackMove ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h index 532cc02aed1..fa5c711ae1f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h @@ -45,8 +45,8 @@ class AssistedTargetingUpdateModuleData : public UpdateModuleData { m_clipSize = 1; m_weaponSlot = PRIMARY_WEAPON; - m_laserFromAssisted = NULL; - m_laserToTarget = NULL; + m_laserFromAssisted = nullptr; + m_laserToTarget = nullptr; } static void buildFieldParse(MultiIniFieldParse& p); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h index b0df5fec9d0..4b32f7a1a4b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h @@ -87,9 +87,9 @@ class AutoDepositUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "DepositTiming", INI::parseDurationUnsignedInt, NULL, offsetof( AutoDepositUpdateModuleData, m_depositFrame ) }, - { "DepositAmount", INI::parseInt, NULL, offsetof( AutoDepositUpdateModuleData, m_depositAmount ) }, - { "InitialCaptureBonus", INI::parseInt, NULL, offsetof( AutoDepositUpdateModuleData, m_initialCaptureBonus ) }, + { "DepositTiming", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_depositFrame ) }, + { "DepositAmount", INI::parseInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_depositAmount ) }, + { "InitialCaptureBonus", INI::parseInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_initialCaptureBonus ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h index c1f3a178341..de6c91aa4c7 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h @@ -68,8 +68,8 @@ class AutoHealBehaviorModuleData : public UpdateModuleData m_healingDelay = UINT_MAX; m_startHealingDelay = 0; m_radius = 0.0f; - m_radiusParticleSystemTmpl = NULL; - m_unitHealPulseParticleSystemTmpl = NULL; + m_radiusParticleSystemTmpl = nullptr; + m_unitHealPulseParticleSystemTmpl = nullptr; m_affectsWholePlayer = FALSE; SET_ALL_KINDOFMASK_BITS( m_kindOf ); } @@ -78,16 +78,16 @@ class AutoHealBehaviorModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_initiallyActive ) }, - { "SingleBurst", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_singleBurst ) }, - { "HealingAmount", INI::parseInt, NULL, offsetof( AutoHealBehaviorModuleData, m_healingAmount ) }, - { "HealingDelay", INI::parseDurationUnsignedInt, NULL, offsetof( AutoHealBehaviorModuleData, m_healingDelay ) }, - { "Radius", INI::parseReal, NULL, offsetof( AutoHealBehaviorModuleData, m_radius ) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( AutoHealBehaviorModuleData, m_kindOf ) }, - { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( AutoHealBehaviorModuleData, m_radiusParticleSystemTmpl ) }, - { "UnitHealPulseParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( AutoHealBehaviorModuleData, m_unitHealPulseParticleSystemTmpl ) }, - { "StartHealingDelay", INI::parseDurationUnsignedInt, NULL, offsetof( AutoHealBehaviorModuleData, m_startHealingDelay ) }, - { "AffectsWholePlayer", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_affectsWholePlayer ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_initiallyActive ) }, + { "SingleBurst", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_singleBurst ) }, + { "HealingAmount", INI::parseInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_healingAmount ) }, + { "HealingDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_healingDelay ) }, + { "Radius", INI::parseReal, nullptr, offsetof( AutoHealBehaviorModuleData, m_radius ) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( AutoHealBehaviorModuleData, m_kindOf ) }, + { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, nullptr, offsetof( AutoHealBehaviorModuleData, m_radiusParticleSystemTmpl ) }, + { "UnitHealPulseParticleSystemName", INI::parseParticleSystemTemplate, nullptr, offsetof( AutoHealBehaviorModuleData, m_unitHealPulseParticleSystemTmpl ) }, + { "StartHealingDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_startHealingDelay ) }, + { "AffectsWholePlayer", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_affectsWholePlayer ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h index a746cd0b46e..18070aa5254 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h @@ -142,7 +142,7 @@ class BattlePlanUpdate : public UpdateModule, public SpecialPowerUpdateInterface virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const { return false; } //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const { return false; } //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) {} - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; //Returns the currently active battle plan -- unpacked and ready... returns PLANSTATUS_NONE if in transition! BattlePlanStatus getActiveBattlePlan() const; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h index 6feb21738af..fab4242c334 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h @@ -151,42 +151,42 @@ class BehaviorModule : public ObjectModule, public BehaviorModuleInterface static Int getInterfaceMask() { return 0; } static ModuleType getModuleType() { return MODULETYPE_BEHAVIOR; } - virtual BodyModuleInterface* getBody() { return NULL; } - virtual CollideModuleInterface* getCollide() { return NULL; } - virtual ContainModuleInterface* getContain() { return NULL; } - virtual CreateModuleInterface* getCreate() { return NULL; } - virtual DamageModuleInterface* getDamage() { return NULL; } - virtual DestroyModuleInterface* getDestroy() { return NULL; } - virtual DieModuleInterface* getDie() { return NULL; } - virtual SpecialPowerModuleInterface* getSpecialPower() { return NULL; } - virtual UpdateModuleInterface* getUpdate() { return NULL; } - virtual UpgradeModuleInterface* getUpgrade() { return NULL; } - virtual StealthUpdate* getStealth() { return NULL; } + virtual BodyModuleInterface* getBody() { return nullptr; } + virtual CollideModuleInterface* getCollide() { return nullptr; } + virtual ContainModuleInterface* getContain() { return nullptr; } + virtual CreateModuleInterface* getCreate() { return nullptr; } + virtual DamageModuleInterface* getDamage() { return nullptr; } + virtual DestroyModuleInterface* getDestroy() { return nullptr; } + virtual DieModuleInterface* getDie() { return nullptr; } + virtual SpecialPowerModuleInterface* getSpecialPower() { return nullptr; } + virtual UpdateModuleInterface* getUpdate() { return nullptr; } + virtual UpgradeModuleInterface* getUpgrade() { return nullptr; } + virtual StealthUpdate* getStealth() { return nullptr; } - virtual ParkingPlaceBehaviorInterface* getParkingPlaceBehaviorInterface() { return NULL; } - virtual RebuildHoleBehaviorInterface* getRebuildHoleBehaviorInterface() { return NULL; } - virtual BridgeBehaviorInterface* getBridgeBehaviorInterface() { return NULL; } - virtual BridgeTowerBehaviorInterface* getBridgeTowerBehaviorInterface() { return NULL; } - virtual BridgeScaffoldBehaviorInterface* getBridgeScaffoldBehaviorInterface() { return NULL; } - virtual OverchargeBehaviorInterface* getOverchargeBehaviorInterface() { return NULL; } - virtual TransportPassengerInterface* getTransportPassengerInterface() { return NULL; } - virtual CaveInterface* getCaveInterface() { return NULL; } - virtual LandMineInterface* getLandMineInterface() { return NULL; } - virtual DieModuleInterface* getEjectPilotDieInterface() { return NULL; } + virtual ParkingPlaceBehaviorInterface* getParkingPlaceBehaviorInterface() { return nullptr; } + virtual RebuildHoleBehaviorInterface* getRebuildHoleBehaviorInterface() { return nullptr; } + virtual BridgeBehaviorInterface* getBridgeBehaviorInterface() { return nullptr; } + virtual BridgeTowerBehaviorInterface* getBridgeTowerBehaviorInterface() { return nullptr; } + virtual BridgeScaffoldBehaviorInterface* getBridgeScaffoldBehaviorInterface() { return nullptr; } + virtual OverchargeBehaviorInterface* getOverchargeBehaviorInterface() { return nullptr; } + virtual TransportPassengerInterface* getTransportPassengerInterface() { return nullptr; } + virtual CaveInterface* getCaveInterface() { return nullptr; } + virtual LandMineInterface* getLandMineInterface() { return nullptr; } + virtual DieModuleInterface* getEjectPilotDieInterface() { return nullptr; } // interface acquisition (moved from UpdateModule) - virtual ProjectileUpdateInterface* getProjectileUpdateInterface() { return NULL; } - virtual AIUpdateInterface* getAIUpdateInterface() { return NULL; } - virtual ExitInterface* getUpdateExitInterface() { return NULL; } - virtual DelayedUpgradeUpdateInterface* getDelayedUpgradeUpdateInterface() { return NULL; } - virtual DockUpdateInterface* getDockUpdateInterface() { return NULL; } - virtual RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface( void ) { return NULL; } - virtual SlowDeathBehaviorInterface* getSlowDeathBehaviorInterface() { return NULL; } - virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return NULL; } - virtual SlavedUpdateInterface* getSlavedUpdateInterface() { return NULL; } - virtual ProductionUpdateInterface* getProductionUpdateInterface() { return NULL; } - virtual HordeUpdateInterface* getHordeUpdateInterface() { return NULL; } - virtual PowerPlantUpdateInterface* getPowerPlantUpdateInterface() { return NULL; } - virtual SpawnBehaviorInterface* getSpawnBehaviorInterface() { return NULL; } + virtual ProjectileUpdateInterface* getProjectileUpdateInterface() { return nullptr; } + virtual AIUpdateInterface* getAIUpdateInterface() { return nullptr; } + virtual ExitInterface* getUpdateExitInterface() { return nullptr; } + virtual DelayedUpgradeUpdateInterface* getDelayedUpgradeUpdateInterface() { return nullptr; } + virtual DockUpdateInterface* getDockUpdateInterface() { return nullptr; } + virtual RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface( void ) { return nullptr; } + virtual SlowDeathBehaviorInterface* getSlowDeathBehaviorInterface() { return nullptr; } + virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return nullptr; } + virtual SlavedUpdateInterface* getSlavedUpdateInterface() { return nullptr; } + virtual ProductionUpdateInterface* getProductionUpdateInterface() { return nullptr; } + virtual HordeUpdateInterface* getHordeUpdateInterface() { return nullptr; } + virtual PowerPlantUpdateInterface* getPowerPlantUpdateInterface() { return nullptr; } + virtual SpawnBehaviorInterface* getSpawnBehaviorInterface() { return nullptr; } protected: diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index f63a0e6525b..7620e94d062 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -65,7 +65,7 @@ static const char* const TheBodyDamageTypeNames[] = "REALLYDAMAGED", "RUBBLE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheBodyDamageTypeNames) == BODYDAMAGETYPE_COUNT + 1, "Incorrect array size"); #endif @@ -85,7 +85,7 @@ static const char* const TheMaxHealthChangeTypeNames[] = "SAME_CURRENTHEALTH", "PRESERVE_RATIO", "ADD_CURRENT_HEALTH_TOO", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheMaxHealthChangeTypeNames) == MAX_HEALTH_CHANGE_COUNT + 1, "Incorrect array size"); #endif @@ -244,7 +244,7 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface virtual void setArmorSetFlag(ArmorSetType ast) = 0; virtual void clearArmorSetFlag(ArmorSetType ast) = 0; - virtual const DamageInfo *getLastDamageInfo() const { return NULL; } ///< return info on last damage dealt to this object + virtual const DamageInfo *getLastDamageInfo() const { return nullptr; } ///< return info on last damage dealt to this object virtual UnsignedInt getLastDamageTimestamp() const { return 0; } ///< return frame of last damage dealt virtual UnsignedInt getLastHealingTimestamp() const { return 0; } ///< return frame of last healing dealt virtual ObjectID getClearableLastAttacker() const { return INVALID_ID; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h index 9f6ff668e70..79fe86939f4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h @@ -103,108 +103,108 @@ class BoneFXUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "DamageFXTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageFXTypes ) }, - { "DamageOCLTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageOCLTypes ) }, - { "DamageParticleTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageParticleTypes ) }, - - { "PristineFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 7 ] ) }, - - { "PristineOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 7 ] ) }, - - { "PristineParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 7 ] ) }, + { "DamageFXTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageFXTypes ) }, + { "DamageOCLTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageOCLTypes ) }, + { "DamageParticleTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageParticleTypes ) }, + + { "PristineFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 7 ] ) }, + + { "PristineOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 7 ] ) }, + + { "PristineParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 7 ] ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/CaveContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/CaveContain.h index a5ee0e8aca7..d37a0d13444 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/CaveContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/CaveContain.h @@ -55,7 +55,7 @@ class CaveContainModuleData : public OpenContainModuleData static const FieldParse dataFieldParse[] = { - { "CaveIndex", INI::parseInt, NULL, offsetof( CaveContainModuleData, m_caveIndexData ) }, + { "CaveIndex", INI::parseInt, nullptr, offsetof( CaveContainModuleData, m_caveIndexData ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h index 08fc5d2dcf3..5738f07c1ef 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h @@ -54,7 +54,7 @@ class CheckpointUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ScanDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( CheckpointUpdateModuleData, m_enemyScanDelayTime ) }, + { "ScanDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( CheckpointUpdateModuleData, m_enemyScanDelayTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/CollideModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/CollideModule.h index 2f1dde30404..c31d45f4194 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/CollideModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/CollideModule.h @@ -35,7 +35,7 @@ //------------------------------------------------------------------------------------------------- /** OBJECT COLLIDE MODULE - Called when two objects collide (or when object collides with ground) - - Note in the 'collide' method that 'other' can be NULL, this indicates a + - Note in the 'collide' method that 'other' can be null, this indicates a collision with the ground - Also note the 'collide' method is the response for the object that THIS module belongs to, we do not need to worry about the collision moudle of 'other', diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h index a9cee09e8ce..8a227f58fe8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h @@ -48,7 +48,7 @@ class ConvertToCarBombCrateCollideModuleData : public CrateCollideModuleData ConvertToCarBombCrateCollideModuleData() { m_rangeOfEffect = 0; - m_fxList = NULL; + m_fxList = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -57,7 +57,7 @@ class ConvertToCarBombCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "FXList", INI::parseFXList, NULL, offsetof( ConvertToCarBombCrateCollideModuleData, m_fxList ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( ConvertToCarBombCrateCollideModuleData, m_fxList ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h b/Generals/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h index 4cbc1f77b1f..3fab216672b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h @@ -59,7 +59,7 @@ class CreateCrateDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "CrateData", CreateCrateDieModuleData::parseCrateData, NULL, NULL }, + { "CrateData", CreateCrateDieModuleData::parseCrateData, nullptr, 0 }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/CrushDie.h b/Generals/Code/GameEngine/Include/GameLogic/Module/CrushDie.h index 4c81de8af1b..cb753449c24 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/CrushDie.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/CrushDie.h @@ -70,12 +70,12 @@ class CrushDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "TotalCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[TOTAL_CRUSH] ) }, - { "BackEndCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[BACK_END_CRUSH] ) }, - { "FrontEndCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[FRONT_END_CRUSH] ) }, - { "TotalCrushSoundPercent", INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[TOTAL_CRUSH] ) }, - { "BackEndCrushSoundPercent", INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[BACK_END_CRUSH] ) }, - { "FrontEndCrushSoundPercent",INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[FRONT_END_CRUSH] ) }, + { "TotalCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[TOTAL_CRUSH] ) }, + { "BackEndCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[BACK_END_CRUSH] ) }, + { "FrontEndCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[FRONT_END_CRUSH] ) }, + { "TotalCrushSoundPercent", INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[TOTAL_CRUSH] ) }, + { "BackEndCrushSoundPercent", INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[BACK_END_CRUSH] ) }, + { "FrontEndCrushSoundPercent",INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[FRONT_END_CRUSH] ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DamageModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DamageModule.h index 2487b2f3d2e..b14723f0faf 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DamageModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DamageModule.h @@ -70,7 +70,7 @@ class DamageModuleData : public BehaviorModuleData static const FieldParse dataFieldParse[] = { -// { "DamageTypes", INI::parseDamageTypeFlags, NULL, offsetof( DamageModuleData, m_damageTypes ) }, +// { "DamageTypes", INI::parseDamageTypeFlags, nullptr, offsetof( DamageModuleData, m_damageTypes ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h index 414402c641b..62dc454a5b6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h @@ -54,8 +54,8 @@ class DefaultProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "UnitCreatePoint", INI::parseCoord3D, NULL, offsetof( DefaultProductionExitUpdateModuleData, m_unitCreatePoint ) }, - { "NaturalRallyPoint", INI::parseCoord3D, NULL, offsetof( DefaultProductionExitUpdateModuleData, m_naturalRallyPoint ) }, + { "UnitCreatePoint", INI::parseCoord3D, nullptr, offsetof( DefaultProductionExitUpdateModuleData, m_unitCreatePoint ) }, + { "NaturalRallyPoint", INI::parseCoord3D, nullptr, offsetof( DefaultProductionExitUpdateModuleData, m_naturalRallyPoint ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -109,5 +109,5 @@ inline const Coord3D *DefaultProductionExitUpdate::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedUpgrade.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedUpgrade.h index d5d3f63eb7d..98bead9fb20 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedUpgrade.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedUpgrade.h @@ -50,7 +50,7 @@ class DelayedUpgradeModuleData : public UpgradeModuleData static const FieldParse dataFieldParse[] = { - { "DelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( DelayedUpgradeModuleData, m_delayTime ) }, + { "DelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DelayedUpgradeModuleData, m_delayTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h index fcb180e8f9d..defdf1184bb 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h @@ -50,8 +50,8 @@ class DeletionUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( DeletionUpdateModuleData, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( DeletionUpdateModuleData, m_maxFrames ) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeletionUpdateModuleData, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeletionUpdateModuleData, m_maxFrames ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h index 17b89253056..fa9018c5c8f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h @@ -216,15 +216,15 @@ class DeliverPayloadAIUpdateModuleData : public AIUpdateModuleData //DO NOT ADD DATA HERE UNLESS YOU ARE SUPPORTING SCRIPTED TEAM REINFORCEMENT DELIVERY //THESE DATA VALUES ARE SPECIFIED ONLY BY FACTIONUNIT.INI //*********************************************************************************** - { "DoorDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_doorDelay ) }, - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_putInContainerName ) }, - { "DeliveryDistance", INI::parseReal, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_maxDistanceToTarget ) }, - { "MaxAttempts", INI::parseInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_maxNumberAttempts ) }, - { "DropDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropDelay ) }, - { "DropOffset", INI::parseCoord3D, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropOffset ) }, - { "DropVariance", INI::parseCoord3D, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropVariance ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalRadius ) }, + { "DoorDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_doorDelay ) }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_putInContainerName ) }, + { "DeliveryDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_maxDistanceToTarget ) }, + { "MaxAttempts", INI::parseInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_maxNumberAttempts ) }, + { "DropDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropDelay ) }, + { "DropOffset", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropOffset ) }, + { "DropVariance", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropVariance ) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalRadius ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -284,9 +284,9 @@ class DeliverPayloadData m_inheritTransportVelocity = false; m_isParachuteDirectly = FALSE; m_exitPitchRate = 0.0f; - m_strafeFX = NULL; + m_strafeFX = nullptr; m_strafeLength = 0.0f; - m_visiblePayloadWeaponTemplate = NULL; + m_visiblePayloadWeaponTemplate = nullptr; m_selfDestructObject = FALSE; m_deliveryDecalRadius = 0; m_visibleDropBoneName.clear(); @@ -314,7 +314,7 @@ class DeliverPayloadAIUpdate : public AIUpdateInterface const Coord3D* getTargetPos() const { return &m_targetPos; } const Coord3D* getMoveToPos() const { return &m_moveToPos; } UnsignedInt getDoorDelay() const { return getDeliverPayloadAIUpdateModuleData()->m_doorDelay; } - Bool isDeliveringPayload() const { return m_deliverPayloadStateMachine != NULL; } + Bool isDeliveringPayload() const { return m_deliverPayloadStateMachine != nullptr; } const ThingTemplate* getPutInContainerTemplateViaModuleData() const; Real getAllowedDistanceToTarget() const { return m_data.m_distToTarget; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h index 74a90c299a3..40ba705747d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h @@ -67,11 +67,11 @@ class DeployStyleAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( DeployStyleAIUpdateModuleData, m_unpackTime ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( DeployStyleAIUpdateModuleData, m_packTime ) }, - { "ResetTurretBeforePacking", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_resetTurretBeforePacking ) }, - { "TurretsFunctionOnlyWhenDeployed", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_turretsFunctionOnlyWhenDeployed ) }, - { "TurretsMustCenterBeforePacking", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_turretsMustCenterBeforePacking ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_unpackTime ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_packTime ) }, + { "ResetTurretBeforePacking", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_resetTurretBeforePacking ) }, + { "TurretsFunctionOnlyWhenDeployed", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_turretsFunctionOnlyWhenDeployed ) }, + { "TurretsMustCenterBeforePacking", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_turretsMustCenterBeforePacking ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h index a6add30d44c..1de751cac44 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h @@ -75,7 +75,7 @@ class DockUpdate : public UpdateModule , public DockUpdateInterface virtual Bool isClearToApproach( Object const* docker ) const; /** Give me a Queue point to drive to, and record that that point is taken. - Returning NULL means there are none free + Returning null means there are none free */ virtual Bool reserveApproachPosition( Object* docker, Coord3D *position, Int *index ); @@ -95,7 +95,7 @@ class DockUpdate : public UpdateModule , public DockUpdateInterface virtual Bool isClearToAdvance( Object const* docker, Int dockerIndex ) const; /** Give me the point that is the start of your docking path - Returning NULL means there is none free + Returning null means there is none free All functions take docker as arg so we could have multiple docks on a building. Docker is not assumed, it is recorded and checked. */ diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index 1488eecb0d2..63b325b5818 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -146,7 +146,7 @@ class DozerAIInterface virtual void internalCancelTask( DozerTask task ) = 0; ///< cancel this task from the dozer virtual void internalTaskCompleteOrCancelled( DozerTask task ) = 0; ///< this is called when tasks are cancelled or completed - /** return a dock point for the action and task (if valid) ... note it can return NULL + /** return a dock point for the action and task (if valid) ... note it can return nullptr if no point has been set for the combination of task and point */ virtual const Coord3D* getDockPoint( DozerTask task, DozerDockPoint point ) = 0; @@ -245,7 +245,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface virtual void internalCancelTask( DozerTask task ); ///< cancel this task from the dozer virtual void internalTaskCompleteOrCancelled( DozerTask task ); ///< this is called when tasks are cancelled or completed - /** return a dock point for the action and task (if valid) ... note it can return NULL + /** return a dock point for the action and task (if valid) ... note it can return nullptr if no point has been set for the combination of task and point */ virtual const Coord3D* getDockPoint( DozerTask task, DozerDockPoint point ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h index 2472decda5b..9e936a91ae6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h @@ -59,7 +59,7 @@ class EMPUpdateModuleData : public UpdateModuleData m_endColor.setFromInt (0x00000000); //m_spinRateMax = 0.0f; m_disabledDuration = 0; - m_disableFXParticleSystem = NULL; + m_disableFXParticleSystem = nullptr; m_sparksPerCubicFoot = 0.001f; } @@ -69,17 +69,17 @@ class EMPUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "Lifetime", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_lifeFrames ) }, - { "StartFadeTime", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_startFadeFrame ) }, - { "StartScale", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_startScale ) }, - { "DisabledDuration", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_disabledDuration ) }, - //{ "SpinRateMax", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_spinRateMax ) }, - { "TargetScaleMax", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_targetScaleMax ) }, - { "TargetScaleMin", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_targetScaleMin ) }, - { "StartColor", INI::parseRGBColor, NULL, offsetof( EMPUpdateModuleData, m_startColor ) }, - { "EndColor", INI::parseRGBColor, NULL, offsetof( EMPUpdateModuleData, m_endColor ) }, - { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( EMPUpdateModuleData, m_disableFXParticleSystem ) }, - { "SparksPerCubicFoot", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_sparksPerCubicFoot ) }, + { "Lifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_lifeFrames ) }, + { "StartFadeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_startFadeFrame ) }, + { "StartScale", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_startScale ) }, + { "DisabledDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_disabledDuration ) }, + //{ "SpinRateMax", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_spinRateMax ) }, + { "TargetScaleMax", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_targetScaleMax ) }, + { "TargetScaleMin", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_targetScaleMin ) }, + { "StartColor", INI::parseRGBColor, nullptr, offsetof( EMPUpdateModuleData, m_startColor ) }, + { "EndColor", INI::parseRGBColor, nullptr, offsetof( EMPUpdateModuleData, m_endColor ) }, + { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( EMPUpdateModuleData, m_disableFXParticleSystem ) }, + { "SparksPerCubicFoot", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_sparksPerCubicFoot ) }, { 0, 0, 0, 0 } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h index 4d39ec7875f..dbbf2f2af96 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h @@ -50,7 +50,7 @@ class EnemyNearUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ScanDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( EnemyNearUpdateModuleData, m_enemyScanDelayTime ) }, + { "ScanDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( EnemyNearUpdateModuleData, m_enemyScanDelayTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FXListDie.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FXListDie.h index 6e3da938017..4ed1081837f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FXListDie.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FXListDie.h @@ -48,7 +48,7 @@ class FXListDieModuleData : public DieModuleData FXListDieModuleData() { - m_defaultDeathFX = NULL; + m_defaultDeathFX = nullptr; m_orientToObject = true; } @@ -58,8 +58,8 @@ class FXListDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "DeathFX", INI::parseFXList, NULL, offsetof( FXListDieModuleData, m_defaultDeathFX ) }, - { "OrientToObject", INI::parseBool, NULL, offsetof( FXListDieModuleData, m_orientToObject ) }, + { "DeathFX", INI::parseFXList, nullptr, offsetof( FXListDieModuleData, m_defaultDeathFX ) }, + { "OrientToObject", INI::parseBool, nullptr, offsetof( FXListDieModuleData, m_orientToObject ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h index 0ec32bde612..2eb6702b866 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h @@ -47,7 +47,7 @@ class FireWeaponCollideModuleData : public CollideModuleData FireWeaponCollideModuleData() { - m_collideWeaponTemplate = NULL; + m_collideWeaponTemplate = nullptr; m_fireOnce = FALSE; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h index 906e7784d93..4eb7c8893a5 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h @@ -56,14 +56,14 @@ class FireWeaponWhenDamagedBehaviorModuleData : public UpdateModuleData FireWeaponWhenDamagedBehaviorModuleData() { m_initiallyActive = false; - m_reactionWeaponPristine = NULL; - m_reactionWeaponDamaged = NULL; - m_reactionWeaponReallyDamaged = NULL; - m_reactionWeaponRubble = NULL; - m_continuousWeaponPristine = NULL; - m_continuousWeaponDamaged = NULL; - m_continuousWeaponReallyDamaged = NULL; - m_continuousWeaponRubble = NULL; + m_reactionWeaponPristine = nullptr; + m_reactionWeaponDamaged = nullptr; + m_reactionWeaponReallyDamaged = nullptr; + m_reactionWeaponRubble = nullptr; + m_continuousWeaponPristine = nullptr; + m_continuousWeaponDamaged = nullptr; + m_continuousWeaponReallyDamaged = nullptr; + m_continuousWeaponRubble = nullptr; m_damageTypes = DAMAGE_TYPE_FLAGS_ALL; m_damageAmount = 0; } @@ -73,17 +73,17 @@ class FireWeaponWhenDamagedBehaviorModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_initiallyActive ) }, - { "ReactionWeaponPristine", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponPristine) }, - { "ReactionWeaponDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponDamaged) }, - { "ReactionWeaponReallyDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponReallyDamaged) }, - { "ReactionWeaponRubble", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponRubble) }, - { "ContinuousWeaponPristine", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponPristine) }, - { "ContinuousWeaponDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponDamaged) }, - { "ContinuousWeaponReallyDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData,m_continuousWeaponReallyDamaged) }, - { "ContinuousWeaponRubble", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponRubble) }, - { "DamageTypes", INI::parseDamageTypeFlags, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageTypes ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageAmount ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_initiallyActive ) }, + { "ReactionWeaponPristine", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponPristine) }, + { "ReactionWeaponDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponDamaged) }, + { "ReactionWeaponReallyDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponReallyDamaged) }, + { "ReactionWeaponRubble", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponRubble) }, + { "ContinuousWeaponPristine", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponPristine) }, + { "ContinuousWeaponDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponDamaged) }, + { "ContinuousWeaponReallyDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData,m_continuousWeaponReallyDamaged) }, + { "ContinuousWeaponRubble", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponRubble) }, + { "DamageTypes", INI::parseDamageTypeFlags, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageTypes ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageAmount ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h index a7d6a9bc7c6..5b16eccb242 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h @@ -47,15 +47,15 @@ class FireWeaponWhenDeadBehaviorModuleData : public BehaviorModuleData FireWeaponWhenDeadBehaviorModuleData() { m_initiallyActive = false; - m_deathWeapon = NULL; + m_deathWeapon = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_initiallyActive ) }, - { "DeathWeapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_deathWeapon ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_initiallyActive ) }, + { "DeathWeapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_deathWeapon ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index b2c9a74d989..06f3e3e6f55 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -61,11 +61,11 @@ class GarrisonContainModuleData : public OpenContainModuleData static const FieldParse dataFieldParse[] = { - { "MobileGarrison", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_mobileGarrison ) }, - { "HealObjects", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_doIHealObjects ) }, - { "TimeForFullHeal", INI::parseDurationReal, NULL, offsetof( GarrisonContainModuleData, m_framesForFullHeal ) }, - { "InitialRoster", parseInitialRoster, NULL, 0 }, - { "ImmuneToClearBuildingAttacks", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_immuneToClearBuildingAttacks ) }, + { "MobileGarrison", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_mobileGarrison ) }, + { "HealObjects", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_doIHealObjects ) }, + { "TimeForFullHeal", INI::parseDurationReal, nullptr, offsetof( GarrisonContainModuleData, m_framesForFullHeal ) }, + { "InitialRoster", parseInitialRoster, nullptr, 0 }, + { "ImmuneToClearBuildingAttacks", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_immuneToClearBuildingAttacks ) }, { 0, 0, 0, 0 } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h index 8599b393c50..f95eac09a6c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h @@ -151,15 +151,15 @@ class HackInternetAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_unpackTime ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_packTime ) }, - { "PackUnpackVariationFactor", INI::parseReal, NULL, offsetof( HackInternetAIUpdateModuleData, m_packUnpackVariationFactor ) }, - { "CashUpdateDelay", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelay ) }, - { "RegularCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_regularCashAmount ) }, - { "VeteranCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_veteranCashAmount ) }, - { "EliteCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_eliteCashAmount ) }, - { "HeroicCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_heroicCashAmount ) }, - { "XpPerCashUpdate", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_xpPerCashUpdate ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_unpackTime ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_packTime ) }, + { "PackUnpackVariationFactor", INI::parseReal, nullptr, offsetof( HackInternetAIUpdateModuleData, m_packUnpackVariationFactor ) }, + { "CashUpdateDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelay ) }, + { "RegularCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_regularCashAmount ) }, + { "VeteranCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_veteranCashAmount ) }, + { "EliteCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_eliteCashAmount ) }, + { "HeroicCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_heroicCashAmount ) }, + { "XpPerCashUpdate", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_xpPerCashUpdate ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h index 374e0e3c426..f8b11cf1924 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h @@ -50,8 +50,8 @@ class HijackerUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AttachToTargetBone", INI::parseAsciiString, NULL, offsetof( HijackerUpdateModuleData, m_attachToBone ) }, - { "ParachuteName", INI::parseAsciiString, NULL, offsetof( HijackerUpdateModuleData, m_parachuteName ) }, + { "AttachToTargetBone", INI::parseAsciiString, nullptr, offsetof( HijackerUpdateModuleData, m_attachToBone ) }, + { "ParachuteName", INI::parseAsciiString, nullptr, offsetof( HijackerUpdateModuleData, m_parachuteName ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h index 2c73c868f0a..02dbab9fec7 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h @@ -51,8 +51,8 @@ class HiveStructureBodyModuleData : public StructureBodyModuleData StructureBodyModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, NULL, offsetof( HiveStructureBodyModuleData, m_damageTypesToPropagateToSlaves ) }, - { "SwallowDamageTypesIfSlavesNotExisting", INI::parseDamageTypeFlags, NULL, offsetof( HiveStructureBodyModuleData, m_damageTypesToSwallow ) }, + { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, nullptr, offsetof( HiveStructureBodyModuleData, m_damageTypesToPropagateToSlaves ) }, + { "SwallowDamageTypesIfSlavesNotExisting", INI::parseDamageTypeFlags, nullptr, offsetof( HiveStructureBodyModuleData, m_damageTypesToSwallow ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h index 65a46608520..2cb66b61547 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h @@ -73,7 +73,7 @@ static const char *const TheHordeActionTypeNames[] = "HORDE", "HORDE_FIXED", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheHordeActionTypeNames) == HORDEACTION_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h index 67e3f81b685..fa0d1a73fd8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h @@ -50,8 +50,8 @@ class LifetimeUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( LifetimeUpdateModuleData, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( LifetimeUpdateModuleData, m_maxFrames ) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( LifetimeUpdateModuleData, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( LifetimeUpdateModuleData, m_maxFrames ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h index 3e8466d67b4..3d2008bbbcd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h @@ -56,12 +56,12 @@ class MissileLauncherBuildingUpdateModuleData : public UpdateModuleData MissileLauncherBuildingUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_doorOpenTime = 0; m_doorWaitOpenTime = 0; m_doorClosingTime = 0; - m_openingFX = m_openFX = m_waitingToCloseFX = m_closingFX = m_closedFX = NULL; + m_openingFX = m_openFX = m_waitingToCloseFX = m_closingFX = m_closedFX = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -70,16 +70,16 @@ class MissileLauncherBuildingUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_specialPowerTemplate ) }, - { "DoorOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorOpenTime ) }, - { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorWaitOpenTime ) }, - { "DoorCloseTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorClosingTime ) }, - { "DoorOpeningFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openingFX ) }, - { "DoorOpenFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openFX ) }, - { "DoorWaitingToCloseFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_waitingToCloseFX ) }, - { "DoorClosingFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_closingFX ) }, - { "DoorClosedFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_closedFX ) }, - { "DoorOpenIdleAudio", INI::parseAudioEventRTS, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openIdleAudio ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_specialPowerTemplate ) }, + { "DoorOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorOpenTime ) }, + { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorWaitOpenTime ) }, + { "DoorCloseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorClosingTime ) }, + { "DoorOpeningFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openingFX ) }, + { "DoorOpenFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openFX ) }, + { "DoorWaitingToCloseFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_waitingToCloseFX ) }, + { "DoorClosingFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_closingFX ) }, + { "DoorClosedFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_closedFX ) }, + { "DoorOpenIdleAudio", INI::parseAudioEventRTS, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openIdleAudio ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -112,7 +112,7 @@ class MissileLauncherBuildingUpdate : public UpdateModule, public SpecialPowerUp virtual CommandOption getCommandOption() const { return (CommandOption)0; } virtual UpdateSleepTime update(); ///< Deciding whether or not to make new guys - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; private: enum DoorStateType diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h index 4f8e639bc28..4a06bd5db6d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h @@ -65,10 +65,10 @@ class MobMemberSlavedUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MustCatchUpRadius", INI::parseInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_mustCatchUpRadius ) }, - { "CatchUpCrisisBailTime", INI::parseUnsignedInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_catchUpCrisisBailTime ) }, - { "NoNeedToCatchUpRadius", INI::parseInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_noNeedToCatchUpRadius ) }, - { "Squirrelliness", INI::parseReal, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_squirrellinessRatio ) }, + { "MustCatchUpRadius", INI::parseInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_mustCatchUpRadius ) }, + { "CatchUpCrisisBailTime", INI::parseUnsignedInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_catchUpCrisisBailTime ) }, + { "NoNeedToCatchUpRadius", INI::parseInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_noNeedToCatchUpRadius ) }, + { "Squirrelliness", INI::parseReal, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_squirrellinessRatio ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h b/Generals/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h index 12a474cb61f..c471d1ac8d1 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h @@ -53,7 +53,7 @@ class MoneyCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "MoneyProvided", INI::parseUnsignedInt, NULL, offsetof( MoneyCrateCollideModuleData, m_moneyProvided ) }, + { "MoneyProvided", INI::parseUnsignedInt, nullptr, offsetof( MoneyCrateCollideModuleData, m_moneyProvided ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h index d6b0d0d305e..784225c3bea 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h @@ -60,7 +60,7 @@ class OCLSpecialPowerModuleData : public SpecialPowerModuleData ScienceType m_science; const ObjectCreationList* m_ocl; - Upgrades() : m_science(SCIENCE_INVALID), m_ocl(NULL) + Upgrades() : m_science(SCIENCE_INVALID), m_ocl(nullptr) { } }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index a60d56c3ce4..e77efc5b57e 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -134,7 +134,7 @@ class OpenContain : public UpdateModule, ///< this gets called from virtual void clientVisibleContainedFlashAsSelected() {}; - virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const { return NULL; } + virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const { return nullptr; } virtual void recalcApparentControllingPlayer() { } virtual void onContaining( Object *obj ); ///< object now contains 'obj' @@ -161,7 +161,7 @@ class OpenContain : public UpdateModule, virtual void iterateContained( ContainIterateFunc func, void *userData, Bool reverse ); virtual UnsignedInt getContainCount() const { return m_containListSize; } virtual const ContainedItemsList* getContainedItemsList() const { return &m_containList; } - virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. + virtual const Object *friend_getRider() const{return nullptr;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const; virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; } virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index cb28040e673..a9924377f33 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h @@ -95,7 +95,7 @@ class OverlordContain : public TransportContain virtual Bool getContainerPipsToShow(Int& numTotal, Int& numFull); private: - /**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns NULL, + /**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns nullptr, we are either empty or carrying a non container. */ ContainModuleInterface *getRedirectedContain() const; ///< And this gets what are redirecting to. diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h index b046386039c..7ef41f73a25 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h @@ -68,7 +68,7 @@ class POWTruckAIUpdateInterface public: - virtual void setTask( POWTruckTask task, Object *taskObject = NULL ) = 0; + virtual void setTask( POWTruckTask task, Object *taskObject = nullptr ) = 0; virtual POWTruckTask getCurrentTask( void ) = 0; virtual void loadPrisoner( Object *prisoner ) = 0; virtual void unloadPrisonersToPrison( Object *prison ) = 0; @@ -109,7 +109,7 @@ class POWTruckAIUpdate : public AIUpdateInterface, protected: - virtual void setTask( POWTruckTask task, Object *taskObject = NULL ); ///< set our current task + virtual void setTask( POWTruckTask task, Object *taskObject = nullptr ); ///< set our current task enum POWTruckAIMode // Stored in save file, do not renumber. jba. { diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index 35d4ea3b88b..553975669ca 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -63,13 +63,13 @@ class ParkingPlaceBehaviorModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "NumRows", INI::parseInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_numRows ) }, - { "NumCols", INI::parseInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_numCols ) }, - { "ApproachHeight", INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_approachHeight ) }, - { "HasRunways", INI::parseBool, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_hasRunways ) }, - { "ParkInHangars", INI::parseBool, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_parkInHangars ) }, - { "HealAmountPerSecond",INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_healAmount ) }, - //{ "TimeForFullHeal", INI::parseDurationUnsignedInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_framesForFullHeal ) }, + { "NumRows", INI::parseInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_numRows ) }, + { "NumCols", INI::parseInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_numCols ) }, + { "ApproachHeight", INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_approachHeight ) }, + { "HasRunways", INI::parseBool, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_hasRunways ) }, + { "ParkInHangars", INI::parseBool, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_parkInHangars ) }, + { "HealAmountPerSecond",INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_healAmount ) }, + //{ "TimeForFullHeal", INI::parseDurationUnsignedInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_framesForFullHeal ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h index 9101cd2a58a..4e2a2ee7243 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h @@ -160,7 +160,7 @@ class ParticleUplinkCannonUpdate : public UpdateModule, public SpecialPowerUpdat virtual Bool isActive() const {return m_status != STATUS_IDLE;} virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; } virtual CommandOption getCommandOption() const { return (CommandOption)0; } - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; virtual void onObjectCreated(); virtual UpdateSleepTime update(); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h index 17f24932846..767132c1770 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h @@ -249,7 +249,7 @@ class PhysicsBehavior : public UpdateModule, Real m_yawRate; ///< rate of rotation around up vector Real m_rollRate; ///< rate of rotation around forward vector Real m_pitchRate; ///< rate or rotation around side vector - DynamicAudioEventRTS* m_bounceSound; ///< The sound for when this thing bounces, or NULL + DynamicAudioEventRTS* m_bounceSound; ///< The sound for when this thing bounces, or nullptr Coord3D m_accel; ///< current acceleration Coord3D m_prevAccel; ///< last frame's acceleration Coord3D m_vel; ///< current velocity diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h index d30a0f30355..bd33014c857 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h @@ -48,7 +48,7 @@ class PowerPlantUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "RodsExtendTime", INI::parseDurationUnsignedInt, NULL, offsetof( PowerPlantUpdateModuleData, m_rodsExtendTime ) }, + { "RodsExtendTime", INI::parseDurationUnsignedInt, nullptr, offsetof( PowerPlantUpdateModuleData, m_rodsExtendTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h index 9857791ba99..49dfd0cc325 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h @@ -49,7 +49,7 @@ class PrisonDockUpdate : public DockUpdate // virtual destructor prototype provided by MemoryPoolObject base class virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object *docker, Object *drone = NULL ); ///< for me this means do some Prison + virtual Bool action( Object *docker, Object *drone = nullptr ); ///< for me this means do some Prison protected: diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h index 239a853d12c..9a9f5fce477 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h @@ -218,7 +218,7 @@ class ProductionUpdate : public UpdateModule, public ProductionUpdateInterface, // walking the production list from outside virtual const ProductionEntry *firstProduction( void ) const { return m_productionQueue; } - virtual const ProductionEntry *nextProduction( const ProductionEntry *p ) const { return p ? p->m_next : NULL; } + virtual const ProductionEntry *nextProduction( const ProductionEntry *p ) const { return p ? p->m_next : nullptr; } virtual void setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h index 0dd4fec2a6a..7085e893683 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h @@ -60,11 +60,11 @@ class QueueProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "UnitCreatePoint", INI::parseCoord3D, NULL, offsetof( QueueProductionExitUpdateModuleData, m_unitCreatePoint ) }, - { "NaturalRallyPoint", INI::parseCoord3D, NULL, offsetof( QueueProductionExitUpdateModuleData, m_naturalRallyPoint ) }, - { "ExitDelay", INI::parseDurationUnsignedInt, NULL, offsetof( QueueProductionExitUpdateModuleData, m_exitDelayData ) }, - { "AllowAirborneCreation", INI::parseBool, NULL, offsetof( QueueProductionExitUpdateModuleData, m_allowAirborneCreationData ) }, - { "InitialBurst", INI::parseUnsignedInt, NULL, offsetof( QueueProductionExitUpdateModuleData, m_initialBurst ) }, + { "UnitCreatePoint", INI::parseCoord3D, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_unitCreatePoint ) }, + { "NaturalRallyPoint", INI::parseCoord3D, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_naturalRallyPoint ) }, + { "ExitDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_exitDelayData ) }, + { "AllowAirborneCreation", INI::parseBool, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_allowAirborneCreationData ) }, + { "InitialBurst", INI::parseUnsignedInt, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_initialBurst ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -121,5 +121,5 @@ inline const Coord3D *QueueProductionExitUpdate::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h index b800637373b..5048bfd2461 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h @@ -48,7 +48,7 @@ class RadarUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "RadarExtendTime", INI::parseDurationReal, NULL, offsetof( RadarUpdateModuleData, m_radarExtendTime ) }, + { "RadarExtendTime", INI::parseDurationReal, nullptr, offsetof( RadarUpdateModuleData, m_radarExtendTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h index 4add4ff719a..e9bdb266583 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h @@ -48,8 +48,8 @@ class RadiusDecalUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - //{ "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalTemplate ) }, - //{ "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalRadius ) }, + //{ "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalTemplate ) }, + //{ "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalRadius ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h index 6e64d818374..f4ca6656341 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h @@ -85,7 +85,7 @@ class RailedTransportDockUpdate : public DockUpdate, // dock methods virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object* docker, Object *drone = NULL ); + virtual Bool action( Object* docker, Object *drone = nullptr ); virtual Bool isClearToEnter( Object const* docker ) const; // our own methods diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index b33a49da945..f29c3d7730b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -52,23 +52,23 @@ class RailroadBehaviorModuleData : public PhysicsBehaviorModuleData static const FieldParse dataFieldParse[] = { - { "PathPrefixName", INI::parseAsciiString, NULL, offsetof( RailroadBehaviorModuleData, m_pathPrefixName ) }, - { "CrashFXTemplateName", INI::parseAsciiString, NULL, offsetof( RailroadBehaviorModuleData, m_CrashFXTemplateName ) }, - { "IsLocomotive", INI::parseBool, NULL, offsetof( RailroadBehaviorModuleData, m_isLocomotive ) }, - { "CarriageTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(RailroadBehaviorModuleData, m_carriageTemplateNameData) }, - { "BigMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_bigMetalImpactDefaultSound) }, - { "SmallMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_smallMetalImpactDefaultSound) }, - { "MeatyBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_meatyImpactDefaultSound) }, - { "RunningGarrisonSpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) }, - { "KillSpeedMin", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) }, - { "SpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_speedMax) }, - { "Acceleration", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_acceleration) }, - { "Braking", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_braking) }, - { "WaitAtStationTime", INI::parseDurationUnsignedInt, NULL, offsetof( RailroadBehaviorModuleData, m_waitAtStationTime) }, - { "RunningSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_runningSound) }, - { "ClicketyClackSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_clicketyClackSound) }, - { "WhistleSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_whistleSound) }, - { "Friction", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_friction) }, + { "PathPrefixName", INI::parseAsciiString, nullptr, offsetof( RailroadBehaviorModuleData, m_pathPrefixName ) }, + { "CrashFXTemplateName", INI::parseAsciiString, nullptr, offsetof( RailroadBehaviorModuleData, m_CrashFXTemplateName ) }, + { "IsLocomotive", INI::parseBool, nullptr, offsetof( RailroadBehaviorModuleData, m_isLocomotive ) }, + { "CarriageTemplateName", INI::parseAsciiStringVectorAppend, nullptr, offsetof(RailroadBehaviorModuleData, m_carriageTemplateNameData) }, + { "BigMetalBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_bigMetalImpactDefaultSound) }, + { "SmallMetalBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_smallMetalImpactDefaultSound) }, + { "MeatyBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_meatyImpactDefaultSound) }, + { "RunningGarrisonSpeedMax", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) }, + { "KillSpeedMin", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) }, + { "SpeedMax", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_speedMax) }, + { "Acceleration", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_acceleration) }, + { "Braking", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_braking) }, + { "WaitAtStationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( RailroadBehaviorModuleData, m_waitAtStationTime) }, + { "RunningSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_runningSound) }, + { "ClicketyClackSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_clicketyClackSound) }, + { "WhistleSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_whistleSound) }, + { "Friction", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_friction) }, { 0, 0, 0, 0 } }; @@ -173,7 +173,7 @@ struct TrainTrack // To protect the track form ever going out of sync between cars on the same train... // I restrict write access to the first referencer, before a second one is added (the locomotive) - TrackPointList* getWritablePointList( void ) { return m_refCount == 1 ? &m_pointList : NULL; }; + TrackPointList* getWritablePointList( void ) { return m_refCount == 1 ? &m_pointList : nullptr; }; const TrackPointList* getPointList( void ) { return &m_pointList; }; private: diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h index 8cbcc525a45..2bf7617d7b5 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h @@ -107,7 +107,7 @@ class RebuildHoleBehavior : public UpdateModule, protected: - void newWorkerRespawnProcess( Object *existingWorker ); ///< start the worker respawn process (again if existingWorker is non NULL) + void newWorkerRespawnProcess( Object *existingWorker ); ///< start the worker respawn process (again if existingWorker is non nullptr) ObjectID m_workerID; ///< id of the worker that will rebuild us ObjectID m_reconstructingID; ///< ID of the object we're reconstructing diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h index c8d458ef508..26589d7cd9a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h @@ -63,7 +63,7 @@ class RepairDockUpdate : public DockUpdate virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object *docker, Object *drone = NULL ); ///< for me this means do some repair + virtual Bool action( Object *docker, Object *drone = nullptr ); ///< for me this means do some repair virtual Bool isRallyPointAfterDockType(){return TRUE;} ///< A minority of docks want to give you a final command to their rally point diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h index 8c4639ca966..ee5336aff5c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h @@ -63,11 +63,11 @@ class SalvageCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "WeaponChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_weaponChance ) }, - { "LevelChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_levelChance ) }, - { "MoneyChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_moneyChance ) }, - { "MinMoney", INI::parseInt, NULL, offsetof( SalvageCrateCollideModuleData, m_minimumMoney ) }, - { "MaxMoney", INI::parseInt, NULL, offsetof( SalvageCrateCollideModuleData, m_maximumMoney ) }, + { "WeaponChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_weaponChance ) }, + { "LevelChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_levelChance ) }, + { "MoneyChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_moneyChance ) }, + { "MinMoney", INI::parseInt, nullptr, offsetof( SalvageCrateCollideModuleData, m_minimumMoney ) }, + { "MaxMoney", INI::parseInt, nullptr, offsetof( SalvageCrateCollideModuleData, m_maximumMoney ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h index a4e8967c401..5356c02bbf3 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h @@ -96,25 +96,25 @@ class SlavedUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "GuardMaxRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_guardMaxRange ) }, - { "GuardWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_guardWanderRange ) }, - { "AttackRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_attackRange ) }, - { "AttackWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_attackWanderRange ) }, - { "ScoutRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_scoutRange ) }, - { "ScoutWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_scoutWanderRange ) }, - { "RepairRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_repairRange ) }, - { "RepairMinAltitude", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairMinAltitude ) }, - { "RepairMaxAltitude", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairMaxAltitude ) }, - { "DistToTargetToGrantRangeBonus", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_distToTargetToGrantRangeBonus ) }, - { "RepairRatePerSecond", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairRatePerSecond ) }, - { "RepairWhenBelowHealth%", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_repairWhenHealthBelowPercentage ) }, - { "RepairMinReadyTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_minReadyFrames ) }, - { "RepairMaxReadyTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_maxReadyFrames ) }, - { "RepairMinWeldTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_minWeldFrames ) }, - { "RepairMaxWeldTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_maxWeldFrames ) }, - { "RepairWeldingSys", INI::parseAsciiString, NULL, offsetof( SlavedUpdateModuleData, m_weldingSysName ) }, - { "RepairWeldingFXBone", INI::parseAsciiString, NULL, offsetof( SlavedUpdateModuleData, m_weldingFXBone ) }, - { "StayOnSameLayerAsMaster", INI::parseBool, NULL, offsetof( SlavedUpdateModuleData, m_stayOnSameLayerAsMaster ) }, + { "GuardMaxRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_guardMaxRange ) }, + { "GuardWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_guardWanderRange ) }, + { "AttackRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_attackRange ) }, + { "AttackWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_attackWanderRange ) }, + { "ScoutRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_scoutRange ) }, + { "ScoutWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_scoutWanderRange ) }, + { "RepairRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_repairRange ) }, + { "RepairMinAltitude", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairMinAltitude ) }, + { "RepairMaxAltitude", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairMaxAltitude ) }, + { "DistToTargetToGrantRangeBonus", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_distToTargetToGrantRangeBonus ) }, + { "RepairRatePerSecond", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairRatePerSecond ) }, + { "RepairWhenBelowHealth%", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_repairWhenHealthBelowPercentage ) }, + { "RepairMinReadyTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_minReadyFrames ) }, + { "RepairMaxReadyTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_maxReadyFrames ) }, + { "RepairMinWeldTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_minWeldFrames ) }, + { "RepairMaxWeldTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_maxWeldFrames ) }, + { "RepairWeldingSys", INI::parseAsciiString, nullptr, offsetof( SlavedUpdateModuleData, m_weldingSysName ) }, + { "RepairWeldingFXBone", INI::parseAsciiString, nullptr, offsetof( SlavedUpdateModuleData, m_weldingFXBone ) }, + { "StayOnSameLayerAsMaster", INI::parseBool, nullptr, offsetof( SlavedUpdateModuleData, m_stayOnSameLayerAsMaster ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index 7bf3506088a..a5da244dd7c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -61,7 +61,7 @@ static const char *const TheSlowDeathPhaseNames[] = "MIDPOINT", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheSlowDeathPhaseNames) == SD_PHASE_COUNT + 1, "Incorrect array size"); #endif diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h index debea0cc3e3..b879ab17cbe 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h @@ -79,16 +79,16 @@ class SpawnBehaviorModuleData : public BehaviorModuleData BehaviorModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "SpawnNumber", INI::parseInt, NULL, offsetof( SpawnBehaviorModuleData, m_spawnNumberData ) }, - { "SpawnReplaceDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SpawnBehaviorModuleData, m_spawnReplaceDelayData ) }, - { "OneShot", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_isOneShotData ) }, - { "CanReclaimOrphans", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_canReclaimOrphans ) }, - { "AggregateHealth", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_aggregateHealth ) }, - { "ExitByBudding", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_exitByBudding ) }, - { "SpawnTemplateName", INI::parseAsciiStringVectorAppend,NULL, offsetof( SpawnBehaviorModuleData, m_spawnTemplateNameData ) }, - { "SpawnedRequireSpawner", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_spawnedRequireSpawner ) }, - { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, NULL, offsetof( SpawnBehaviorModuleData, m_damageTypesToPropagateToSlaves ) }, - { "InitialBurst", INI::parseInt, NULL, offsetof( SpawnBehaviorModuleData, m_initialBurst ) }, { 0, 0, 0, 0 } + { "SpawnNumber", INI::parseInt, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnNumberData ) }, + { "SpawnReplaceDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnReplaceDelayData ) }, + { "OneShot", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_isOneShotData ) }, + { "CanReclaimOrphans", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_canReclaimOrphans ) }, + { "AggregateHealth", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_aggregateHealth ) }, + { "ExitByBudding", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_exitByBudding ) }, + { "SpawnTemplateName", INI::parseAsciiStringVectorAppend,nullptr, offsetof( SpawnBehaviorModuleData, m_spawnTemplateNameData ) }, + { "SpawnedRequireSpawner", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnedRequireSpawner ) }, + { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, nullptr, offsetof( SpawnBehaviorModuleData, m_damageTypesToPropagateToSlaves ) }, + { "InitialBurst", INI::parseInt, nullptr, offsetof( SpawnBehaviorModuleData, m_initialBurst ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( SpawnBehaviorModuleData, m_dieMuxData )); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h index 0b1943bb8bc..11c9a93b1b8 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h @@ -52,7 +52,7 @@ class SpawnPointProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "SpawnPointBoneName", INI::parseAsciiString, NULL, offsetof( SpawnPointProductionExitUpdateModuleData, m_spawnPointBoneNameData ) }, + { "SpawnPointBoneName", INI::parseAsciiString, nullptr, offsetof( SpawnPointProductionExitUpdateModuleData, m_spawnPointBoneNameData ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -79,7 +79,7 @@ class SpawnPointProductionExitUpdate : public UpdateModule, public ExitInterface virtual void exitObjectViaDoor( Object *newObj, ExitDoorType exitDoor ); virtual void unreserveDoorForExit( ExitDoorType exitDoor ); virtual void setRallyPoint( const Coord3D * ){} - virtual const Coord3D *getRallyPoint() const { return NULL; } + virtual const Coord3D *getRallyPoint() const { return nullptr; } virtual void exitObjectByBudding( Object *newObj, Object *budHost ) { return; } virtual UpdateSleepTime update() { return UPDATE_SLEEP_FOREVER; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h index d7eca3b9942..790c7f8e18d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h @@ -82,7 +82,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData SpecialAbilityUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_startAbilityRange = SPECIAL_ABILITY_HUGE_DISTANCE; m_abilityAbortRange = SPECIAL_ABILITY_HUGE_DISTANCE; m_preparationFrames = 0; @@ -99,7 +99,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData m_skipPackingWithNoTarget = FALSE; m_flipObjectAfterPacking = FALSE; m_flipObjectAfterUnpacking = FALSE; - m_disableFXParticleSystem = NULL; + m_disableFXParticleSystem = nullptr; m_fleeRangeAfterCompletion = 0.0f; m_doCaptureFX = FALSE; m_alwaysValidateSpecialObjects = FALSE; @@ -117,40 +117,40 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { //Primary data values - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialPowerTemplate ) }, - { "StartAbilityRange", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_startAbilityRange ) }, - { "AbilityAbortRange", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_abilityAbortRange ) }, - { "PreparationTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_preparationFrames ) }, - { "PersistentPrepTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_persistentPrepFrames ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packTime ) }, - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_unpackTime ) }, - { "PreTriggerUnstealthTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_preTriggerUnstealthFrames ) }, - { "SkipPackingWithNoTarget", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_skipPackingWithNoTarget ) }, - { "PackUnpackVariationFactor", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packUnpackVariationFactor ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialPowerTemplate ) }, + { "StartAbilityRange", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_startAbilityRange ) }, + { "AbilityAbortRange", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_abilityAbortRange ) }, + { "PreparationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_preparationFrames ) }, + { "PersistentPrepTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_persistentPrepFrames ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packTime ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_unpackTime ) }, + { "PreTriggerUnstealthTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_preTriggerUnstealthFrames ) }, + { "SkipPackingWithNoTarget", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_skipPackingWithNoTarget ) }, + { "PackUnpackVariationFactor", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packUnpackVariationFactor ) }, //Secondary data values - { "SpecialObject", INI::parseAsciiString, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectName ) }, - { "SpecialObjectAttachToBone", INI::parseAsciiString, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectAttachToBoneName ) }, - { "MaxSpecialObjects", INI::parseUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_maxSpecialObjects ) }, - { "SpecialObjectsPersistent", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistent ) }, - { "EffectDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_effectDuration ) }, - { "EffectValue", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_effectValue ) }, - { "UniqueSpecialObjectTargets", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_uniqueSpecialObjectTargets ) }, - { "SpecialObjectsPersistWhenOwnerDies", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistWhenOwnerDies ) }, - { "AlwaysValidateSpecialObjects", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_alwaysValidateSpecialObjects ) }, - { "FlipOwnerAfterPacking", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterPacking ) }, - { "FlipOwnerAfterUnpacking", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterUnpacking ) }, - { "FleeRangeAfterCompletion", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_fleeRangeAfterCompletion ) }, - { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( SpecialAbilityUpdateModuleData, m_disableFXParticleSystem ) }, - { "DoCaptureFX", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_doCaptureFX ) }, - { "PackSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packSound ) }, - { "UnpackSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_unpackSound ) }, - { "PrepSoundLoop", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_prepSoundLoop ) }, - { "TriggerSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_triggerSound ) }, - { "LoseStealthOnTrigger", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_loseStealthOnTrigger ) }, - { "AwardXPForTriggering", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_awardXPForTriggering ) }, - { "SkillPointsForTriggering", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_skillPointsForTriggering ) }, - { "ApproachRequiresLOS", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, + { "SpecialObject", INI::parseAsciiString, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectName ) }, + { "SpecialObjectAttachToBone", INI::parseAsciiString, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectAttachToBoneName ) }, + { "MaxSpecialObjects", INI::parseUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_maxSpecialObjects ) }, + { "SpecialObjectsPersistent", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistent ) }, + { "EffectDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_effectDuration ) }, + { "EffectValue", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_effectValue ) }, + { "UniqueSpecialObjectTargets", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_uniqueSpecialObjectTargets ) }, + { "SpecialObjectsPersistWhenOwnerDies", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistWhenOwnerDies ) }, + { "AlwaysValidateSpecialObjects", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_alwaysValidateSpecialObjects ) }, + { "FlipOwnerAfterPacking", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterPacking ) }, + { "FlipOwnerAfterUnpacking", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterUnpacking ) }, + { "FleeRangeAfterCompletion", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_fleeRangeAfterCompletion ) }, + { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_disableFXParticleSystem ) }, + { "DoCaptureFX", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_doCaptureFX ) }, + { "PackSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packSound ) }, + { "UnpackSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_unpackSound ) }, + { "PrepSoundLoop", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_prepSoundLoop ) }, + { "TriggerSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_triggerSound ) }, + { "LoseStealthOnTrigger", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_loseStealthOnTrigger ) }, + { "AwardXPForTriggering", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_awardXPForTriggering ) }, + { "SkillPointsForTriggering", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_skillPointsForTriggering ) }, + { "ApproachRequiresLOS", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -177,7 +177,7 @@ class SpecialAbilityUpdate : public UpdateModule, public SpecialPowerUpdateInter virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const { return false; } //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const { return false; } //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) {} - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; // virtual Bool isBusy() const { return m_isBusy; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h index 7d332abe483..e799907855c 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h @@ -43,7 +43,7 @@ class SpecialPowerCompletionDieModuleData : public DieModuleData SpecialPowerCompletionDieModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -52,7 +52,7 @@ class SpecialPowerCompletionDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerCompletionDieModuleData, m_specialPowerTemplate ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialPowerCompletionDieModuleData, m_specialPowerTemplate ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h index 41f95ad25df..2b95b78a063 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h @@ -44,5 +44,5 @@ class SpecialPowerUpdateInterface virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const = 0; //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const = 0; //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) = 0; - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const = 0; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const = 0; }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h index 3790710fc42..d545415f7d3 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h @@ -59,10 +59,10 @@ class StealthDetectorUpdateModuleData : public UpdateModuleData m_updateRate = 1; m_detectionRange = 0.0f; m_initiallyDisabled = false; - m_IRBeaconParticleSysTmpl = NULL; - m_IRParticleSysTmpl = NULL; - m_IRBrightParticleSysTmpl = NULL; - m_IRGridParticleSysTmpl = NULL; + m_IRBeaconParticleSysTmpl = nullptr; + m_IRParticleSysTmpl = nullptr; + m_IRBrightParticleSysTmpl = nullptr; + m_IRGridParticleSysTmpl = nullptr; m_extraDetectKindof.clear(); m_extraDetectKindofNot.clear(); m_canDetectWhileGarrisoned = false; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h index 649e36d3593..b49f205f505 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h @@ -57,7 +57,7 @@ static const char *const TheStealthLevelNames[] = "FIRING_PRIMARY", "FIRING_SECONDARY", "FIRING_TERTIARY", - NULL + nullptr }; #endif @@ -85,8 +85,8 @@ class StealthUpdateModuleData : public UpdateModuleData StealthUpdateModuleData() { - m_disguiseFX = NULL; - m_disguiseRevealFX = NULL; + m_disguiseFX = nullptr; + m_disguiseRevealFX = nullptr; m_stealthDelay = UINT_MAX; m_stealthLevel = 0; m_stealthSpeed = 0.0f; @@ -125,7 +125,7 @@ class StealthUpdate : public UpdateModule virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); } // ??? ugh - Bool isDisguised() const { return m_disguiseAsTemplate != NULL; } + Bool isDisguised() const { return m_disguiseAsTemplate != nullptr; } Int getDisguisedPlayerIndex() const { return m_disguiseAsPlayerIndex; } const ThingTemplate *getDisguisedTemplate() { return m_disguiseAsTemplate; } void markAsDetected( UnsignedInt numFrames = 0 ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h index a9f089efa3c..08bc0444de3 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h @@ -49,8 +49,8 @@ class StickyBombUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AttachToTargetBone", INI::parseAsciiString, NULL, offsetof( StickyBombUpdateModuleData, m_attachToBone ) }, - { "OffsetZ", INI::parseReal, NULL, offsetof( StickyBombUpdateModuleData, m_offsetZ ) }, + { "AttachToTargetBone", INI::parseAsciiString, nullptr, offsetof( StickyBombUpdateModuleData, m_attachToBone ) }, + { "OffsetZ", INI::parseReal, nullptr, offsetof( StickyBombUpdateModuleData, m_offsetZ ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index eeb21ea77a7..e33a10d0bc7 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -76,7 +76,7 @@ static const char *const TheStructureTopplePhaseNames[] = "DELAY", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheStructureTopplePhaseNames) == ST_PHASE_COUNT + 1, "Incorrect array size"); @@ -113,11 +113,11 @@ class StructureToppleUpdateModuleData : public UpdateModuleData m_structuralIntegrity = 0.1f; m_structuralDecay = 0.0f; m_damageFXTypes = DAMAGE_TYPE_FLAGS_ALL; - m_toppleStartFXList = NULL; - m_toppleDelayFXList = NULL; - m_toppleDoneFXList = NULL; - m_toppleFXList = NULL; - m_crushingFXList = NULL; + m_toppleStartFXList = nullptr; + m_toppleDelayFXList = nullptr; + m_toppleDoneFXList = nullptr; + m_toppleFXList = nullptr; + m_crushingFXList = nullptr; for (int i = 0; i < ST_PHASE_COUNT; ++i) { diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h index fea5c20041c..c912175b37b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h @@ -59,7 +59,7 @@ class SupplyCenterDockUpdate : public DockUpdate SupplyCenterDockUpdate( Thing *thing, const ModuleData* moduleData ); virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object* docker, Object *drone = NULL ); /// m_group; ///< if non-NULL, we are part of this group of agents + RefCountPtr m_group; ///< if non-null, we are part of this group of agents #endif // These will last for my lifetime. I will reuse them and reset them. The truly dynamic ones are in PartitionManager diff --git a/Generals/Code/GameEngine/Include/GameLogic/ObjectCreationList.h b/Generals/Code/GameEngine/Include/GameLogic/ObjectCreationList.h index c5fcee6975e..5b7c8615485 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ObjectCreationList.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ObjectCreationList.h @@ -28,7 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // Kris: August 23, 2003 -// All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). #pragma once @@ -133,32 +133,32 @@ class ObjectCreationList void addObjectCreationNugget(ObjectCreationNugget* nugget); // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). static Object* create( const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) { if( ocl ) return ocl->createInternal( primaryObj, primary, secondary, createOwner, lifetimeFrames ); - return NULL; + return nullptr; } // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). /// inline convenience method to avoid having to check for null. static Object* create(const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, UnsignedInt lifetimeFrames = 0 ) { if (ocl) return ocl->createInternal( primaryObj, primary, secondary, lifetimeFrames ); - return NULL; + return nullptr; } // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). /// inline convenience method to avoid having to check for null. static Object* create( const ObjectCreationList* ocl, const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) { if (ocl) return ocl->createInternal( primary, secondary, lifetimeFrames ); - return NULL; + return nullptr; } protected: @@ -166,7 +166,7 @@ class ObjectCreationList private: // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const; Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const; Object* createInternal(const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const; @@ -195,7 +195,7 @@ class ObjectCreationListStore : public SubsystemInterface /** return the ObjectCreationList with the given namekey. - return NULL if no such ObjectCreationList exists. + return nullptr if no such ObjectCreationList exists. */ const ObjectCreationList *findObjectCreationList(const char* name) const; diff --git a/Generals/Code/GameEngine/Include/GameLogic/ObjectIter.h b/Generals/Code/GameEngine/Include/GameLogic/ObjectIter.h index 03f15d38e38..3eebc9f8b34 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ObjectIter.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ObjectIter.h @@ -121,11 +121,11 @@ class SimpleObjectIterator : public ObjectIterator public: SimpleObjectIterator(); //~SimpleObjectIterator(); // provided by MPO - Object *first() { return firstWithNumeric(NULL); } - Object *next() { return nextWithNumeric(NULL); } + Object *first() { return firstWithNumeric(nullptr); } + Object *next() { return nextWithNumeric(nullptr); } - Object *firstWithNumeric(Real *num = NULL) { reset(); return nextWithNumeric(num); } - Object *nextWithNumeric(Real *num = NULL); + Object *firstWithNumeric(Real *num = nullptr) { reset(); return nextWithNumeric(num); } + Object *nextWithNumeric(Real *num = nullptr); // methods that are not inherited from ObjectIterator: diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index 6631616c306..b77828930fe 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -128,9 +128,9 @@ struct FindPositionOptions maxRadius = 0.0f; startAngle = RANDOM_START_ANGLE; maxZDelta = 1e10f; // ie, any z delta. - ignoreObject = NULL; - sourceToPathToDest = NULL; - relationshipObject = NULL; + ignoreObject = nullptr; + sourceToPathToDest = nullptr; + relationshipObject = nullptr; }; FindPositionFlags flags; ///< flags for finding the legal position Real minRadius; ///< min radius to search around @@ -1087,7 +1087,7 @@ class PartitionFilterThing : public PartitionFilter public: PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) { - DEBUG_ASSERTCRASH(m_tThing != NULL, ("ThingTemplate for PartitionFilterThing is NULL")); + DEBUG_ASSERTCRASH(m_tThing != nullptr, ("ThingTemplate for PartitionFilterThing is null")); } protected: virtual Bool allow( Object *other ); @@ -1109,7 +1109,7 @@ class PartitionFilterGarrisonable : public PartitionFilter public: PartitionFilterGarrisonable( Bool match ) : m_match(match) { - m_player = NULL; + m_player = nullptr; } protected: virtual Bool allow( Object *other ); @@ -1330,17 +1330,17 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Object *obj, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, - Real *closestDist = NULL, - Coord3D *closestDistVec = NULL + PartitionFilter **filters = nullptr, + Real *closestDist = nullptr, + Coord3D *closestDistVec = nullptr ); Object *getClosestObject( const Coord3D *pos, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, - Real *closestDist = NULL, - Coord3D *closestDistVec = NULL + PartitionFilter **filters = nullptr, + Real *closestDist = nullptr, + Coord3D *closestDistVec = nullptr ); Real getRelativeAngle2D( const Object *obj, const Object *otherObj ); @@ -1350,12 +1350,12 @@ class PartitionManager : public SubsystemInterface, public Snapshot void getVectorTo(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D& vec); // just like 'getDistance', but return the dist-sqr, meaning we save a sqrt() call if you don't need it. - Real getDistanceSquared(const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = NULL); - Real getDistanceSquared(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D *vec = NULL); + Real getDistanceSquared(const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = nullptr); + Real getDistanceSquared(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D *vec = nullptr); // just like 'getDistanceSquared', but return the dist-sqr where the obj is at goalPos. - Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = NULL); - Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Coord3D *otherPos, DistanceCalculationType dc, Coord3D *vec = NULL); + Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = nullptr); + Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Coord3D *otherPos, DistanceCalculationType dc, Coord3D *vec = nullptr); #ifdef PM_CACHE_TERRAIN_HEIGHT // note that the 2d positions aren't guaranteed to be the actual spot within the cell where the terrain @@ -1372,7 +1372,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Object *obj, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, + PartitionFilter **filters = nullptr, IterOrderType order = ITER_FASTEST ); @@ -1380,11 +1380,11 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Coord3D *pos, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, + PartitionFilter **filters = nullptr, IterOrderType order = ITER_FASTEST ); - SimpleObjectIterator *iterateAllObjects(PartitionFilter **filters = NULL); + SimpleObjectIterator *iterateAllObjects(PartitionFilter **filters = nullptr); /** return the Objects that would (or would not) collide with the given @@ -1509,13 +1509,13 @@ inline Int PartitionManager::worldToCellDist(Real w) //----------------------------------------------------------------------------- inline PartitionCell *PartitionManager::getCellAt(Int x, Int y) { - return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? NULL : &m_cells[y * m_cellCountX + x]; + return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? nullptr : &m_cells[y * m_cellCountX + x]; } //----------------------------------------------------------------------------- inline const PartitionCell *PartitionManager::getCellAt(Int x, Int y) const { - return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? NULL : &m_cells[y * m_cellCountX + x]; + return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? nullptr : &m_cells[y * m_cellCountX + x]; } //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/PolygonTrigger.h b/Generals/Code/GameEngine/Include/GameLogic/PolygonTrigger.h index 2cd94188ee0..8ebe4d2fc21 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PolygonTrigger.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PolygonTrigger.h @@ -52,10 +52,10 @@ class WaterHandle public: - WaterHandle( void ) { m_polygon = NULL; } + WaterHandle( void ) { m_polygon = nullptr; } ///@todo we need to formalize the water systems - PolygonTrigger *m_polygon; ///< valid when water is a polygon area, NULL if water is a grid + PolygonTrigger *m_polygon; ///< valid when water is a polygon area, nullptr if water is a grid }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Powers.h b/Generals/Code/GameEngine/Include/GameLogic/Powers.h index 53438b12446..3833455742a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Powers.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Powers.h @@ -51,7 +51,7 @@ static const char *const PowerNames[] = "FASTER", "DOUBLE_SHOT", "SELF_HEALING", - NULL + nullptr }; static_assert(ARRAY_SIZE(PowerNames) == POWERS_NUM_POWERS + 1, "Incorrect array size"); #endif // end DEFINE_POWER_NAMES diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h index 4a9d99212c6..e81675a3c78 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -86,7 +86,7 @@ class ScriptActions : public ScriptActionsInterface protected: static GameWindow *m_messageWindow; - static void clearWindow(void) {m_messageWindow=NULL;}; + static void clearWindow(void) {m_messageWindow=nullptr;}; Bool m_suppressNewWindows; AsciiString m_unnamedUnit; diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h index bc025c88d8e..9b8afe8ea8a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -244,8 +244,8 @@ class ScriptEngine : public SubsystemInterface, Bool isGameEnding( void ) { return m_endGameTimer >= 0; } virtual void startQuickEndGameTimer(void); ///< Starts the quick end game timer after a campaign is won or lost. virtual void startCloseWindowTimer(void); ///< Starts the timer to close windows after a mission is won or lost. - virtual void runScript(const AsciiString& scriptName, Team *pThisTeam=NULL); ///< Runs a script. - virtual void runObjectScript(const AsciiString& scriptName, Object *pThisObject=NULL); ///< Runs a script attached to this object. + virtual void runScript(const AsciiString& scriptName, Team *pThisTeam=nullptr); ///< Runs a script. + virtual void runObjectScript(const AsciiString& scriptName, Object *pThisObject=nullptr); ///< Runs a script attached to this object. virtual Team *getTeamNamed(const AsciiString& teamName); ///< Gets the named team. May be null. virtual Player *getSkirmishEnemyPlayer(void); ///< Gets the ai's enemy Human player. May be null. virtual Player *getCurrentPlayer(void); ///< Gets the player that owns the current script. May be null. @@ -271,8 +271,8 @@ class ScriptEngine : public SubsystemInterface, // For other systems to evaluate Conditions, execute Actions, etc. ///< if pThisTeam is specified, then scripts in here can use to mean the team this script is attached to. - virtual Bool evaluateConditions( Script *pScript, Team *pThisTeam = NULL, Player *pPlayer=NULL ); - virtual void friend_executeAction( ScriptAction *pActionHead, Team *pThisTeam = NULL); ///< Use this at yer peril. + virtual Bool evaluateConditions( Script *pScript, Team *pThisTeam = nullptr, Player *pPlayer=nullptr ); + virtual void friend_executeAction( ScriptAction *pActionHead, Team *pThisTeam = nullptr); ///< Use this at yer peril. virtual Object *getUnitNamed(const AsciiString& unitName); ///< Gets the named unit. May be null. virtual Bool didUnitExist(const AsciiString& unitName); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h index 70428cc389f..4229f93572f 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h @@ -168,7 +168,7 @@ class OrCondition : public MemoryPoolObject Condition *m_firstAnd; // These are Anded. public: - OrCondition():m_nextOr(NULL),m_firstAnd(NULL){}; + OrCondition():m_nextOr(nullptr),m_firstAnd(nullptr){}; //~OrCondition(); /// Duplicate creates a "deep" copy. If it is head of a linked list, duplicates the entire list. OrCondition *duplicate(void) const; @@ -572,7 +572,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class. if (ndx>=0 && ndx=0 && ndx=0 && ndx <= MAX_LINKS) return m_links[ndx]; return NULL; } + /// Get the n'th directed link. (May be nullptr). + Waypoint *getLink(Int ndx) const {if (ndx>=0 && ndx <= MAX_LINKS) return m_links[ndx]; return nullptr; } /// Get the waypoint's name. AsciiString getName(void) const {return m_name; } /// Get the integer id. @@ -227,8 +227,8 @@ class TerrainLogic : public Snapshot, virtual Bool loadMap( AsciiString filename, Bool query ); virtual void newMap( Bool saveGame ); ///< Initialize the logic for new map. - virtual Real getGroundHeight( Real x, Real y, Coord3D* normal = NULL ) const; - virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = NULL, Bool clip = true) const; + virtual Real getGroundHeight( Real x, Real y, Coord3D* normal = nullptr ) const; + virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = nullptr, Bool clip = true) const; virtual void getExtent( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality virtual void getExtentIncludingBorder( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality virtual void getMaximumPathfindExtent( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality @@ -240,7 +240,7 @@ class TerrainLogic : public Snapshot, virtual PathfindLayerEnum alignOnTerrain( Real angle, const Coord3D& pos, Bool stickToGround, Matrix3D& mtx); - virtual Bool isUnderwater( Real x, Real y, Real *waterZ = NULL, Real *terrainZ = NULL ); ///< is point under water + virtual Bool isUnderwater( Real x, Real y, Real *waterZ = nullptr, Real *terrainZ = nullptr ); ///< is point under water virtual Bool isCliffCell( Real x, Real y) const; ///< is point cliff cell virtual const WaterHandle* getWaterHandle( Real x, Real y ); ///< get water handle at this location virtual const WaterHandle* getWaterHandleByName( AsciiString name ); ///< get water handle by name @@ -274,10 +274,10 @@ class TerrainLogic : public Snapshot, ///Gets the first bridge. Traverse all bridges using bridge->getNext(); virtual Bridge *getFirstBridge(void) const { return m_bridgeListHead; } - /// Find the bridge at a location. NULL means no bridge. + /// Find the bridge at a location. null means no bridge. virtual Bridge *findBridgeAt(const Coord3D *pLoc) const; - /// Find the bridge at a location. NULL means no bridge. Note that the layer value will be used to resolve crossing bridges. + /// Find the bridge at a location. null means no bridge. Note that the layer value will be used to resolve crossing bridges. virtual Bridge *findBridgeLayerAt(const Coord3D *pLoc, PathfindLayerEnum layer, Bool clip = true) const; /// Returns true if the object is close enough to interact with the bridge for pathfinding. diff --git a/Generals/Code/GameEngine/Include/GameLogic/TurretAI.h b/Generals/Code/GameEngine/Include/GameLogic/TurretAI.h index 3a2570aaae4..036f0e9b0bd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/TurretAI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/TurretAI.h @@ -309,7 +309,7 @@ class TurretAI : public MemoryPoolObject, public Snapshot, public NotifyWeaponFi virtual void notifyFired(); virtual void notifyNewVictimChosen(Object* victim); - virtual const Coord3D* getOriginalVictimPos() const { return NULL; } // yes, we return NULL here + virtual const Coord3D* getOriginalVictimPos() const { return nullptr; } // yes, we return nullptr here virtual Bool isWeaponSlotOkToFire(WeaponSlotType wslot) const; // these are only for use by the state machines... don't call them otherwise, please diff --git a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h index 6895677ba1a..bfe39189072 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Weapon.h @@ -68,7 +68,7 @@ static const char *const TheWeaponReloadNames[] = "YES", "NO", "RETURN_TO_BASE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponReloadNames) == WEAPON_RELOAD_COUNT + 1, "Incorrect array size"); #endif @@ -89,7 +89,7 @@ static const char *const TheWeaponPrefireNames[] = "PER_SHOT", "PER_ATTACK", "PER_CLIP", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponPrefireNames) == PREFIRE_COUNT + 1, "Incorrect array size"); #endif @@ -129,7 +129,7 @@ static const char *const TheWeaponAffectsMaskNames[] = "SUICIDE", "NOT_SIMILAR", "NOT_AIRBORNE", - NULL + nullptr }; #endif @@ -161,7 +161,7 @@ static const char *const TheWeaponCollideMaskNames[] = "SMALL_MISSILES", //All missiles are also projectiles! "BALLISTIC_MISSILES", //All missiles are also projectiles! "CONTROLLED_STRUCTURES", - NULL + nullptr }; #endif @@ -245,7 +245,7 @@ static const char *const TheWeaponBonusNames[] = "FRENZY_TWO", "FRENZY_THREE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponBonusNames) == WEAPONBONUSCONDITION_COUNT + 1, "Incorrect array size"); #endif @@ -300,7 +300,7 @@ static const char *const TheWeaponBonusFieldNames[] = "RANGE", "RATE_OF_FIRE", "PRE_ATTACK", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponBonusFieldNames) == WeaponBonus::FIELD_COUNT + 1, "Incorrect array size"); #endif @@ -353,8 +353,8 @@ class WeaponTemplate : public MemoryPoolObject void reset( void ); void friend_setNextTemplate(WeaponTemplate *nextTemplate) { m_nextTemplate = nextTemplate; } - WeaponTemplate *friend_clearNextTemplate( void ) { WeaponTemplate *ret = m_nextTemplate; m_nextTemplate = NULL; return ret; } - Bool isOverride( void ) { return m_nextTemplate != NULL; } + WeaponTemplate *friend_clearNextTemplate( void ) { WeaponTemplate *ret = m_nextTemplate; m_nextTemplate = nullptr; return ret; } + Bool isOverride( void ) { return m_nextTemplate != nullptr; } /// field table for loading the values from an INI const FieldParse *getFieldParse() const { return TheWeaponTemplateFieldParseTable; } @@ -474,7 +474,7 @@ class WeaponTemplate : public MemoryPoolObject private: - // NOTE: m_nextTemplate will be cleaned up if it is NON-NULL. + // NOTE: m_nextTemplate will be cleaned up if it is NON-nullptr. WeaponTemplate *m_nextTemplate; static void parseWeaponBonusSet( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ); @@ -577,10 +577,10 @@ class Weapon : public MemoryPoolObject, //~Weapon(); // return true if we auto-reloaded our clip after firing. - Bool fireWeapon(const Object *source, Object *target, ObjectID* projectileID = NULL); + Bool fireWeapon(const Object *source, Object *target, ObjectID* projectileID = nullptr); // return true if we auto-reloaded our clip after firing. - Bool fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID = NULL); + Bool fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID = nullptr); void fireProjectileDetonationWeapon(const Object *source, Object *target, WeaponBonusConditionFlags extraBonusFlags); @@ -600,12 +600,12 @@ class Weapon : public MemoryPoolObject, */ Real estimateWeaponDamage(const Object *source, const Object *target) { - return estimateWeaponDamage(source, target, NULL); + return estimateWeaponDamage(source, target, nullptr); } Real estimateWeaponDamage(const Object *source, const Coord3D* pos) { - return estimateWeaponDamage(source, NULL, pos); + return estimateWeaponDamage(source, nullptr, pos); } /** return true if the target is within attack range, false otherwise. @@ -619,7 +619,7 @@ class Weapon : public MemoryPoolObject, Bool isGoalPosWithinAttackRange(const Object *source, const Coord3D* goalPos, const Object *target, const Coord3D* targetPos) const; //Used only by garrison contains that move objects around before doing the range check. - //If target object is specified, we'll use his position, but if it's NULL we will use the + //If target object is specified, we'll use his position, but if it's nullptr we will use the //target position passed in. //NOTE: This is not a user friendly function -- use with caution if at all! -- Kris Bool isSourceObjectWithGoalPositionWithinAttackRange(const Object *source, const Coord3D *goalPos, const Object *target, const Coord3D *targetPos) const; diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h index eecd011a369..b5c8fdbb568 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -56,7 +56,7 @@ static const char *const TheWeaponSlotTypeNames[] = "SECONDARY", "TERTIARY", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponSlotTypeNames) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); @@ -66,7 +66,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { "SECONDARY", SECONDARY_WEAPON }, { "TERTIARY", TERTIARY_WEAPON }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TheWeaponSlotTypeNamesLookupList) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h b/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h index 4b56c34b8e0..d91bad8187f 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h @@ -33,7 +33,7 @@ class GameWindow; class WindowLayout; -Bool GameSpySendChat(UnicodeString message, Bool isEmote, GameWindow *playerListbox = NULL); +Bool GameSpySendChat(UnicodeString message, Bool isEmote, GameWindow *playerListbox = nullptr); void GameSpyAddText( UnicodeString message, GameSpyColors color = GSCOLOR_DEFAULT ); extern GameWindow *progressTextWindow; ///< Text box on the progress screen diff --git a/Generals/Code/GameEngine/Source/Common/BitFlags.cpp b/Generals/Code/GameEngine/Source/Common/BitFlags.cpp index ceb943c9742..306ccf54d72 100644 --- a/Generals/Code/GameEngine/Source/Common/BitFlags.cpp +++ b/Generals/Code/GameEngine/Source/Common/BitFlags.cpp @@ -146,7 +146,7 @@ const char* const ModelConditionFlags::s_bitNameList[] = "PREORDER", - NULL + nullptr }; static_assert(ARRAY_SIZE(ModelConditionFlags::s_bitNameList) == ModelConditionFlags::NumBits + 1, "Incorrect array size"); @@ -159,6 +159,6 @@ const char* const ArmorSetFlags::s_bitNameList[] = "PLAYER_UPGRADE", "WEAK_VERSUS_BASEDEFENSES", - NULL + nullptr }; static_assert(ARRAY_SIZE(ArmorSetFlags::s_bitNameList) == ArmorSetFlags::NumBits + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp index 0ec260b3861..8b6475e3885 100644 --- a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp @@ -77,7 +77,7 @@ static void ConvertShortMapPathToLongMapPath(AsciiString &mapName) AsciiString token; AsciiString actualpath; - if ((path.find('\\') == NULL) && (path.find('/') == NULL)) + if ((path.find('\\') == nullptr) && (path.find('/') == nullptr)) { DEBUG_CRASH(("Invalid map name %s", mapName.str())); return; @@ -1335,14 +1335,14 @@ static CommandLineParam paramsForEngineInit[] = char *nextParam(char *newSource, const char *seps) { - static char *source = NULL; + static char *source = nullptr; if (newSource) { source = newSource; } if (!source) { - return NULL; + return nullptr; } // find first separator @@ -1372,15 +1372,15 @@ char *nextParam(char *newSource, const char *seps) *end = 0; if (!*source) - source = NULL; + source = nullptr; } else { - source = NULL; + source = nullptr; } if (first && !*first) - first = NULL; + first = nullptr; } return first; @@ -1392,10 +1392,10 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) std::string cmdLine = GetCommandLineA(); char *token = nextParam(&cmdLine[0], "\" "); - while (token != NULL) + while (token != nullptr) { argv.push_back(strtrim(token)); - token = nextParam(NULL, "\" "); + token = nextParam(nullptr, "\" "); } int argc = argv.size(); @@ -1445,7 +1445,7 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) void createGlobalData() { - if (TheGlobalData == NULL) + if (TheGlobalData == nullptr) TheWritableGlobalData = NEW GlobalData; } diff --git a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp index cd1a4fa3951..0b0b9cbb55e 100644 --- a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp +++ b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp @@ -50,7 +50,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -DamageFXStore *TheDamageFXStore = NULL; ///< the DamageFX store definition +DamageFXStore *TheDamageFXStore = nullptr; ///< the DamageFX store definition /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -108,7 +108,7 @@ ConstFXListPtr DamageFX::getDamageFXList(DamageType t, Real damageAmount, const if you really need to change this for some reason, consider carefully... (srj) */ if (damageAmount == 0.0f) - return NULL; + return nullptr; const DFX& dfx = m_dfx[t][source ? source->getVeterancyLevel() : LEVEL_REGULAR]; ConstFXListPtr fx = @@ -124,15 +124,15 @@ const FieldParse* DamageFX::getFieldParse() const { static const FieldParse myFieldParse[] = { - { "AmountForMajorFX", parseAmount, NULL, 0 }, - { "MajorFX", parseMajorFXList, NULL, 0 }, - { "MinorFX", parseMinorFXList, NULL, 0 }, - { "ThrottleTime", parseTime, NULL, 0 }, + { "AmountForMajorFX", parseAmount, nullptr, 0 }, + { "MajorFX", parseMajorFXList, nullptr, 0 }, + { "MinorFX", parseMinorFXList, nullptr, 0 }, + { "ThrottleTime", parseTime, nullptr, 0 }, { "VeterancyAmountForMajorFX", parseAmount, TheVeterancyNames, 0 }, { "VeterancyMajorFX", parseMajorFXList, TheVeterancyNames, 0 }, { "VeterancyMinorFX", parseMinorFXList, TheVeterancyNames, 0 }, { "VeterancyThrottleTime", parseTime, TheVeterancyNames, 0 }, - { 0, 0, 0,0 } + { nullptr, nullptr, nullptr,0 } }; return myFieldParse; } @@ -203,7 +203,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); ConstFXListPtr fx; - INI::parseFXList(ini, NULL, &fx, NULL); + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -225,7 +225,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); ConstFXListPtr fx; - INI::parseFXList(ini, NULL, &fx, NULL); + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -247,7 +247,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); UnsignedInt t; - INI::parseDurationUnsignedInt(ini, NULL, &t, NULL); + INI::parseDurationUnsignedInt(ini, nullptr, &t, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -279,7 +279,7 @@ const DamageFX *DamageFXStore::findDamageFX(NameKeyType namekey) const DamageFXMap::const_iterator it = m_dfxmap.find(namekey); if (it == m_dfxmap.end()) { - return NULL; + return nullptr; } else { diff --git a/Generals/Code/GameEngine/Source/Common/Dict.cpp b/Generals/Code/GameEngine/Source/Common/Dict.cpp index f9f9e58dfd2..21b54df2ea7 100644 --- a/Generals/Code/GameEngine/Source/Common/Dict.cpp +++ b/Generals/Code/GameEngine/Source/Common/Dict.cpp @@ -84,7 +84,7 @@ void Dict::DictPair::clear() case DICT_BOOL: case DICT_INT: case DICT_REAL: - m_value = 0; + m_value = nullptr; break; case DICT_ASCIISTRING: asAsciiString()->clear(); @@ -126,7 +126,7 @@ Dict::DictPair* Dict::findPairByKey(NameKeyType key) const DEBUG_ASSERTCRASH(key != NAMEKEY_INVALID, ("invalid namekey!")); DEBUG_ASSERTCRASH((UnsignedInt)key < (1L<<23), ("namekey too large!")); if (!m_data) - return NULL; + return nullptr; DictPair* base = m_data->peek(); Int minIdx = 0; Int maxIdx = m_data->m_numPairsUsed; @@ -143,7 +143,7 @@ Dict::DictPair* Dict::findPairByKey(NameKeyType key) const return mid; } - return NULL; + return nullptr; } // ----------------------------------------------------- @@ -157,10 +157,10 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa return pairToTranslate; } - Dict::DictPairData* newData = NULL; + Dict::DictPairData* newData = nullptr; if (numPairsNeeded > 0) { - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); DEBUG_ASSERTCRASH(numPairsNeeded <= MAX_LEN, ("Dict::ensureUnique exceeds max pairs length %d with requested length %d", MAX_LEN, numPairsNeeded)); int minBytes = sizeof(Dict::DictPairData) + numPairsNeeded*sizeof(Dict::DictPair); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); @@ -200,7 +200,7 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa void Dict::clear() { releaseData(); - m_data = NULL; + m_data = nullptr; } // ----------------------------------------------------- @@ -215,12 +215,12 @@ void Dict::releaseData() src->clear(); TheDynamicMemoryAllocator->freeBytes(m_data); } - m_data = 0; + m_data = nullptr; } } // ----------------------------------------------------- -Dict::Dict(Int numPairsToPreAllocate) : m_data(0) +Dict::Dict(Int numPairsToPreAllocate) : m_data(nullptr) { /* @@ -236,7 +236,7 @@ Dict::Dict(Int numPairsToPreAllocate) : m_data(0) sizeof(UnicodeString) <= sizeof(void*), ("oops, this code needs attention")); if (numPairsToPreAllocate) - ensureUnique(numPairsToPreAllocate, false, NULL); // will throw on error + ensureUnique(numPairsToPreAllocate, false, nullptr); // will throw on error } // ----------------------------------------------------- @@ -265,7 +265,7 @@ Dict::DataType Dict::getType(NameKeyType key) const } // ----------------------------------------------------- -Bool Dict::getBool(NameKeyType key, Bool *exists/*=NULL*/) const +Bool Dict::getBool(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -274,13 +274,13 @@ Bool Dict::getBool(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asBool(); } - DEBUG_ASSERTCRASH(exists != NULL, ("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr, ("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return false; } // ----------------------------------------------------- -Int Dict::getInt(NameKeyType key, Bool *exists/*=NULL*/) const +Int Dict::getInt(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -289,13 +289,13 @@ Int Dict::getInt(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asInt(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return 0; } // ----------------------------------------------------- -Real Dict::getReal(NameKeyType key, Bool *exists/*=NULL*/) const +Real Dict::getReal(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -304,13 +304,13 @@ Real Dict::getReal(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asReal(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return 0.0f; } // ----------------------------------------------------- -AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=NULL*/) const +AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -319,13 +319,13 @@ AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asAsciiString(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return AsciiString::TheEmptyString; } // ----------------------------------------------------- -UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=NULL*/) const +UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -334,7 +334,7 @@ UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=NULL*/) con if (exists) *exists = true; return *pair->asUnicodeString(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return UnicodeString::TheEmptyString; } diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index f8ce2dd61c3..e6cc7f309fd 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -128,7 +128,7 @@ class DeepCRCSanityCheck : public SubsystemInterface protected: }; -DeepCRCSanityCheck *TheDeepCRCSanityCheck = NULL; +DeepCRCSanityCheck *TheDeepCRCSanityCheck = nullptr; void DeepCRCSanityCheck::reset(void) { @@ -151,10 +151,10 @@ void DeepCRCSanityCheck::reset(void) //------------------------------------------------------------------------------------------------- /// The GameEngine singleton instance -GameEngine *TheGameEngine = NULL; +GameEngine *TheGameEngine = nullptr; //------------------------------------------------------------------------------------------------- -SubsystemInterfaceList* TheSubsystemList = NULL; +SubsystemInterfaceList* TheSubsystemList = nullptr; //------------------------------------------------------------------------------------------------- template @@ -163,8 +163,8 @@ void initSubsystem( AsciiString name, SUBSYSTEM* sys, Xfer *pXfer, - const char* path1 = NULL, - const char* path2 = NULL) + const char* path1 = nullptr, + const char* path2 = nullptr) { sysref = sys; TheSubsystemList->initSubsystem(sys, path1, path2, pXfer, name); @@ -182,8 +182,8 @@ static void updateWindowTitle() { // TheSuperHackers @tweak Now prints product and version information in the Window title. - DEBUG_ASSERTCRASH(TheVersion != NULL, ("TheVersion is NULL")); - DEBUG_ASSERTCRASH(TheGameText != NULL, ("TheGameText is NULL")); + DEBUG_ASSERTCRASH(TheVersion != nullptr, ("TheVersion is null")); + DEBUG_ASSERTCRASH(TheGameText != nullptr, ("TheGameText is null")); UnicodeString title; @@ -254,7 +254,7 @@ GameEngine::GameEngine( void ) m_quitting = FALSE; m_isActive = FALSE; - _Module.Init(NULL, ApplicationHInstance, NULL); + _Module.Init(nullptr, ApplicationHInstance, nullptr); } //------------------------------------------------------------------------------------------------- @@ -264,10 +264,10 @@ GameEngine::~GameEngine() //preloadTextureNamesGlobalHack.clear(); delete TheMapCache; - TheMapCache = NULL; + TheMapCache = nullptr; // delete TheShell; -// TheShell = NULL; +// TheShell = nullptr; TheGameResultsQueue->endThreads(); @@ -277,19 +277,19 @@ GameEngine::~GameEngine() TheSubsystemList->shutdownAll(); delete TheSubsystemList; - TheSubsystemList = NULL; + TheSubsystemList = nullptr; delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; delete TheCommandList; - TheCommandList = NULL; + TheCommandList = nullptr; delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; Drawable::killStaticImages(); @@ -304,16 +304,16 @@ GameEngine::~GameEngine() Bool GameEngine::isTimeFrozen() { // TheSuperHackers @fix The time can no longer be frozen in Network games. It would disconnect the player. - if (TheNetwork != NULL) + if (TheNetwork != nullptr) return false; - if (TheTacticalView != NULL) + if (TheTacticalView != nullptr) { if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) return true; } - if (TheScriptEngine != NULL) + if (TheScriptEngine != nullptr) { if (TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript()) return true; @@ -325,14 +325,14 @@ Bool GameEngine::isTimeFrozen() //------------------------------------------------------------------------------------------------- Bool GameEngine::isGameHalted() { - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { if (TheNetwork->isStalling()) return true; } else { - if (TheGameLogic != NULL && TheGameLogic->isGamePaused()) + if (TheGameLogic != nullptr && TheGameLogic->isGamePaused()) return true; } @@ -383,8 +383,8 @@ void GameEngine::init() XferCRC xferCRC; xferCRC.open("lightCRC"); - initSubsystem(TheLocalFileSystem, "TheLocalFileSystem", createLocalFileSystem(), NULL); - initSubsystem(TheArchiveFileSystem, "TheArchiveFileSystem", createArchiveFileSystem(), NULL); // this MUST come after TheLocalFileSystem creation + initSubsystem(TheLocalFileSystem, "TheLocalFileSystem", createLocalFileSystem(), nullptr); + initSubsystem(TheArchiveFileSystem, "TheArchiveFileSystem", createArchiveFileSystem(), nullptr); // this MUST come after TheLocalFileSystem creation DEBUG_ASSERTCRASH(TheWritableGlobalData,("TheWritableGlobalData expected to be created")); initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", TheWritableGlobalData, &xferCRC, "Data\\INI\\Default\\GameData", "Data\\INI\\GameData"); @@ -394,7 +394,7 @@ void GameEngine::init() #if defined(RTS_DEBUG) // If we're in Debug, load the Debug settings as well. - ini.loadFileDirectory( "Data\\INI\\GameDataDebug", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\GameDataDebug", INI_LOAD_OVERWRITE, nullptr ); #endif // special-case: parse command-line parameters after loading global data @@ -425,65 +425,65 @@ void GameEngine::init() ini.loadFileDirectory( "Data\\INI\\Water", INI_LOAD_OVERWRITE, &xferCRC ); #ifdef DEBUG_CRC - initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL); + initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, nullptr); #endif // DEBUG_CRC - initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), NULL); + initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), nullptr); updateWindowTitle(); initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science", "Data\\INI\\Science"); initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); - initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, NULL); // must be before the game text + initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, nullptr); // must be before the game text TheGlobalLanguageData->parseCustomDefinition(); - initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), NULL); - initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), NULL); + initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), nullptr); + initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), nullptr); if (!TheAudio->isMusicAlreadyLoaded()) setQuitting(TRUE); - initSubsystem(TheFunctionLexicon,"TheFunctionLexicon", createFunctionLexicon(), NULL); - initSubsystem(TheModuleFactory,"TheModuleFactory", createModuleFactory(), NULL); - initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), NULL); - initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), NULL); - initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), NULL); - initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank"); + initSubsystem(TheFunctionLexicon,"TheFunctionLexicon", createFunctionLexicon(), nullptr); + initSubsystem(TheModuleFactory,"TheModuleFactory", createModuleFactory(), nullptr); + initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), nullptr); + initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), nullptr); + initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), nullptr); + initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, nullptr, "Data\\INI\\Rank"); initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); - initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), NULL); + initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), nullptr); initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); - initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon"); + initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, nullptr, "Data\\INI\\Weapon"); initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); - initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, nullptr, "Data\\INI\\Locomotor"); initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower"); - initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX"); - initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor"); - initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, NULL); + initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, nullptr, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, nullptr, "Data\\INI\\Armor"); + initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, nullptr); initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object", "Data\\INI\\Object"); initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); - initSubsystem(TheGameClient,"TheGameClient", createGameClient(), NULL); + initSubsystem(TheGameClient,"TheGameClient", createGameClient(), nullptr); initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData", "Data\\INI\\AIData"); - initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL); - initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL); + initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), nullptr); + initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), nullptr); initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); - initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL); - initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL); - initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), NULL); - initSubsystem(TheVictoryConditions,"TheVictoryConditions", createVictoryConditions(), NULL); + initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), nullptr); + initSubsystem(TheRecorder,"TheRecorder", createRecorder(), nullptr); + initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), nullptr); + initSubsystem(TheVictoryConditions,"TheVictoryConditions", createVictoryConditions(), nullptr); AsciiString fname; fname.format("Data\\%s\\CommandMap", GetRegistryLanguage().str()); - initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap"); + initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), nullptr, fname.str(), "Data\\INI\\CommandMap"); TheMetaMap->generateMetaMap(); #if defined(RTS_DEBUG) - ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, nullptr); #endif - initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), NULL); - //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), NULL); - initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL ); - initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL ); + initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), nullptr); + //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), nullptr); + initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, nullptr ); + initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, nullptr ); // Create the interface for sending game results - initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL); + initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), nullptr); xferCRC.close(); TheWritableGlobalData->m_iniCRC = xferCRC.getCRC(); @@ -498,8 +498,8 @@ void GameEngine::init() TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_sounds3DOn, AudioAffect_Sound3D); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_speechOn, AudioAffect_Speech); - // We're not in a network game yet, so set the network singleton to NULL. - TheNetwork = NULL; + // We're not in a network game yet, so set the network singleton to nullptr. + TheNetwork = nullptr; //Create a default ini file for options if it doesn't already exist. //OptionPreferences prefs( TRUE ); @@ -517,7 +517,7 @@ void GameEngine::init() if (TheGlobalData->m_buildMapCache) { // just quit, since the map cache has already updated - //populateMapListbox(NULL, true, true); + //populateMapListbox(nullptr, true, true); m_quitting = TRUE; } @@ -616,15 +616,15 @@ void GameEngine::reset( void ) if (deleteNetwork) { - DEBUG_ASSERTCRASH(TheNetwork, ("Deleting NULL TheNetwork!")); + DEBUG_ASSERTCRASH(TheNetwork, ("Deleting null TheNetwork!")); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; } if(background) { background->destroyWindows(); deleteInstance(background); - background = NULL; + background = nullptr; } } @@ -647,7 +647,7 @@ Bool GameEngine::canUpdateGameLogic() TheFramePacer->setTimeFrozen(isTimeFrozen()); TheFramePacer->setGameHalted(isGameHalted()); - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { return canUpdateNetworkGameLogic(); } @@ -660,7 +660,7 @@ Bool GameEngine::canUpdateGameLogic() /// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateNetworkGameLogic() { - DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); + DEBUG_ASSERTCRASH(TheNetwork != nullptr, ("TheNetwork is null")); if (TheNetwork->isFrameDataReady()) { @@ -730,7 +730,7 @@ void GameEngine::update( void ) TheGameClient->UPDATE(); TheMessageStream->propagateMessages(); - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { TheNetwork->UPDATE(); } diff --git a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp index b4f4592ed29..0eb5eed8d2d 100644 --- a/Generals/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameLOD.cpp @@ -47,28 +47,28 @@ //Hack to get access to a static method on the W3DDevice side. -MW extern Bool testMinimumRequirements(ChipsetType *videoChipType, CpuType *cpuType, Int *cpuFreq, MemValueType *numRAM, Real *intBenchIndex, Real *floatBenchIndex, Real *memBenchIndex); -GameLODManager *TheGameLODManager=NULL; +GameLODManager *TheGameLODManager=nullptr; static const FieldParse TheStaticGameLODFieldParseTable[] = { - { "MinimumFPS", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_minFPS)}, - { "MinimumProcessorFps", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_minProcessorFPS)}, - { "SampleCount2D", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_sampleCount2D ) }, - { "SampleCount3D", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_sampleCount3D ) }, - { "StreamCount", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_streamCount ) }, - { "MaxParticleCount", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxParticleCount ) }, - { "UseShadowVolumes", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useShadowVolumes ) }, - { "UseShadowDecals", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useShadowDecals ) }, - { "UseCloudMap", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useCloudMap ) }, - { "UseLightMap", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useLightMap ) }, - { "ShowSoftWaterEdge", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_showSoftWaterEdge ) }, - { "MaxTankTrackEdges", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackEdges) }, - { "MaxTankTrackOpaqueEdges", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackOpaqueEdges) }, - { "MaxTankTrackFadeDelay", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackFadeDelay) }, - { "UseBuildupScaffolds", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useBuildupScaffolds ) }, - { "UseTreeSway", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useTreeSway ) }, - { "UseEmissiveNightMaterials", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useEmissiveNightMaterials ) }, - { "TextureReductionFactor", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_textureReduction ) }, + { "MinimumFPS", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_minFPS)}, + { "MinimumProcessorFps", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_minProcessorFPS)}, + { "SampleCount2D", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_sampleCount2D ) }, + { "SampleCount3D", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_sampleCount3D ) }, + { "StreamCount", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_streamCount ) }, + { "MaxParticleCount", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxParticleCount ) }, + { "UseShadowVolumes", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useShadowVolumes ) }, + { "UseShadowDecals", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useShadowDecals ) }, + { "UseCloudMap", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useCloudMap ) }, + { "UseLightMap", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useLightMap ) }, + { "ShowSoftWaterEdge", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_showSoftWaterEdge ) }, + { "MaxTankTrackEdges", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackEdges) }, + { "MaxTankTrackOpaqueEdges", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackOpaqueEdges) }, + { "MaxTankTrackFadeDelay", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackFadeDelay) }, + { "UseBuildupScaffolds", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useBuildupScaffolds ) }, + { "UseTreeSway", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useTreeSway ) }, + { "UseEmissiveNightMaterials", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useEmissiveNightMaterials ) }, + { "TextureReductionFactor", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_textureReduction ) }, }; static const char *const StaticGameLODNames[]= @@ -109,10 +109,10 @@ StaticGameLODInfo::StaticGameLODInfo(void) static const FieldParse TheDynamicGameLODFieldParseTable[] = { - { "MinimumFPS", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_minFPS)}, - { "ParticleSkipMask", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_dynamicParticleSkipMask)}, - { "DebrisSkipMask", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_dynamicDebrisSkipMask)}, - { "SlowDeathScale", INI::parseReal, NULL, offsetof( DynamicGameLODInfo, m_slowDeathScale)}, + { "MinimumFPS", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_minFPS)}, + { "ParticleSkipMask", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_dynamicParticleSkipMask)}, + { "DebrisSkipMask", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_dynamicDebrisSkipMask)}, + { "SlowDeathScale", INI::parseReal, nullptr, offsetof( DynamicGameLODInfo, m_slowDeathScale)}, { "MinParticlePriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticlePriority)}, { "MinParticleSkipPriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticleSkipPriority)}, }; @@ -139,21 +139,21 @@ DynamicGameLODInfo::DynamicGameLODInfo(void) //Keep this in sync with enum in GameLOD.h static const char *const CPUNames[] = { - "XX","P3", "P4","K7", NULL + "XX","P3", "P4","K7", nullptr }; static_assert(ARRAY_SIZE(CPUNames) == CPU_MAX + 1, "Incorrect array size"); //Keep this in sync with enum in GameLOD.h static const char *const VideoNames[] = { - "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", NULL + "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", nullptr }; static_assert(ARRAY_SIZE(VideoNames) == DC_MAX + 1, "Incorrect array size"); void parseReallyLowMHz(INI* ini) { Int mhz; - INI::parseInt(ini,NULL,&mhz,NULL); + INI::parseInt(ini,nullptr,&mhz,nullptr); if (TheGameLODManager) { TheGameLODManager->setReallyLowMHz(mhz); @@ -168,11 +168,11 @@ void INI::parseBenchProfile( INI* ini) if (preset) { - INI::parseIndexList(ini,NULL,&preset->m_cpuType,CPUNames); - INI::parseInt(ini,NULL,&preset->m_mhz,NULL); - INI::parseReal(ini,NULL,&preset->m_intBenchIndex,NULL); - INI::parseReal(ini,NULL,&preset->m_floatBenchIndex,NULL); - INI::parseReal(ini,NULL,&preset->m_memBenchIndex,NULL); + INI::parseIndexList(ini,nullptr,&preset->m_cpuType,CPUNames); + INI::parseInt(ini,nullptr,&preset->m_mhz,nullptr); + INI::parseReal(ini,nullptr,&preset->m_intBenchIndex,nullptr); + INI::parseReal(ini,nullptr,&preset->m_floatBenchIndex,nullptr); + INI::parseReal(ini,nullptr,&preset->m_memBenchIndex,nullptr); } } } @@ -196,10 +196,10 @@ void INI::parseLODPreset( INI* ini ) if (preset) { - INI::parseIndexList(ini,NULL,&preset->m_cpuType,CPUNames); - INI::parseInt(ini,NULL,&preset->m_mhz,NULL); - INI::parseIndexList(ini,NULL,&preset->m_videoType,VideoNames); - INI::parseInt(ini,NULL,&preset->m_memory,NULL); + INI::parseIndexList(ini,nullptr,&preset->m_cpuType,CPUNames); + INI::parseInt(ini,nullptr,&preset->m_mhz,nullptr); + INI::parseIndexList(ini,nullptr,&preset->m_videoType,VideoNames); + INI::parseInt(ini,nullptr,&preset->m_memory,nullptr); } } } @@ -277,7 +277,7 @@ BenchProfile *GameLODManager::newBenchProfile(void) } DEBUG_CRASH(( "GameLODManager::newBenchProfile - Too many profiles defined")); - return NULL; + return nullptr; } LODPresetInfo *GameLODManager::newLODPreset(StaticGameLODLevel index) @@ -293,17 +293,17 @@ LODPresetInfo *GameLODManager::newLODPreset(StaticGameLODLevel index) DEBUG_CRASH(( "GameLODManager::newLODPreset - Too many presets defined for '%s'", TheGameLODManager->getStaticGameLODLevelName(index))); } - return NULL; + return nullptr; } void GameLODManager::init(void) { INI ini; //Get Presets for each LOD level. - ini.loadFileDirectory( "Data\\INI\\GameLOD", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\GameLOD", INI_LOAD_OVERWRITE, nullptr ); //Get presets for each known hardware configuration - ini.loadFileDirectory( "Data\\INI\\GameLODPresets", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\GameLODPresets", INI_LOAD_OVERWRITE, nullptr); //Get Presets for custom LOD level by pulling them out of initial globaldata (which should //have all settings already applied). @@ -317,7 +317,7 @@ void GameLODManager::init(void) m_idealDetailLevel=(StaticGameLODLevel)optionPref.getIdealStaticGameDetail(); //always get this data in case we need it later. - testMinimumRequirements(NULL,&m_cpuType,&m_cpuFreq,&m_numRAM,NULL,NULL,NULL); + testMinimumRequirements(nullptr,&m_cpuType,&m_cpuFreq,&m_numRAM,nullptr,nullptr,nullptr); if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB @@ -327,7 +327,7 @@ void GameLODManager::init(void) if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark - testMinimumRequirements(NULL,NULL,NULL,NULL,&m_intBenchIndex,&m_floatBenchIndex,&m_memBenchIndex); + testMinimumRequirements(nullptr,nullptr,nullptr,nullptr,&m_intBenchIndex,&m_floatBenchIndex,&m_memBenchIndex); if (TheGlobalData->m_forceBenchmark) { //we want to see the numbers. So dump them to a logfile. @@ -480,7 +480,7 @@ StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void) m_idealDetailLevel = STATIC_GAME_LOD_LOW; //get system configuration - only need vide chip type, got rest in ::init(). - testMinimumRequirements(&m_videoChipType,NULL,NULL,NULL,NULL,NULL,NULL); + testMinimumRequirements(&m_videoChipType,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr); if (m_videoChipType == DC_UNKNOWN) m_videoChipType = DC_TNT2; //presume it's at least TNT2 level diff --git a/Generals/Code/GameEngine/Source/Common/GameMain.cpp b/Generals/Code/GameEngine/Source/Common/GameMain.cpp index 870829597bc..c9dd0a94427 100644 --- a/Generals/Code/GameEngine/Source/Common/GameMain.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameMain.cpp @@ -57,9 +57,9 @@ Int GameMain() // since execute() returned, we are exiting the game delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheGameEngine; - TheGameEngine = NULL; + TheGameEngine = nullptr; return exitcode; } diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 24d13f14da8..cf0aff23aa7 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -59,484 +59,484 @@ #include "GameNetwork/FirewallHelper.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +GlobalData* TheWritableGlobalData = nullptr; ///< The global data singleton //------------------------------------------------------------------------------------------------- -GlobalData* GlobalData::m_theOriginal = NULL; +GlobalData* GlobalData::m_theOriginal = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /*static*/ const FieldParse GlobalData::s_GlobalDataFieldParseTable[] = { - { "Windowed", INI::parseBool, NULL, offsetof( GlobalData, m_windowed ) }, - { "XResolution", INI::parseInt, NULL, offsetof( GlobalData, m_xResolution ) }, - { "YResolution", INI::parseInt, NULL, offsetof( GlobalData, m_yResolution ) }, - { "MapName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_mapName ) }, - { "MoveHintName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_moveHintName ) }, - { "UseTrees", INI::parseBool, NULL, offsetof( GlobalData, m_useTrees ) }, - { "UseFPSLimit", INI::parseBool, NULL, offsetof( GlobalData, m_useFpsLimit ) }, - { "DumpAssetUsage", INI::parseBool, NULL, offsetof( GlobalData, m_dumpAssetUsage ) }, - { "FramesPerSecondLimit", INI::parseInt, NULL, offsetof( GlobalData, m_framesPerSecondLimit ) }, - { "ChipsetType", INI::parseInt, NULL, offsetof( GlobalData, m_chipSetType ) }, - { "MaxShellScreens", INI::parseInt, NULL, offsetof( GlobalData, m_maxShellScreens ) }, - { "UseCloudMap", INI::parseBool, NULL, offsetof( GlobalData, m_useCloudMap ) }, - { "UseLightMap", INI::parseBool, NULL, offsetof( GlobalData, m_useLightMap ) }, - { "BilinearTerrainTex", INI::parseBool, NULL, offsetof( GlobalData, m_bilinearTerrainTex ) }, - { "TrilinearTerrainTex", INI::parseBool, NULL, offsetof( GlobalData, m_trilinearTerrainTex ) }, - { "MultiPassTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_multiPassTerrain ) }, - { "AdjustCliffTextures", INI::parseBool, NULL, offsetof( GlobalData, m_adjustCliffTextures ) }, - { "Use3WayTerrainBlends", INI::parseInt, NULL, offsetof( GlobalData, m_use3WayTerrainBlends ) }, - { "StretchTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_stretchTerrain ) }, - { "UseHalfHeightMap", INI::parseBool, NULL, offsetof( GlobalData, m_useHalfHeightMap ) }, - { "UserDataLeafName", INI::parseQuotedAsciiString, NULL, offsetof( GlobalData, m_userDataLeafName ) }, - - - { "DrawEntireTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_drawEntireTerrain ) }, + { "Windowed", INI::parseBool, nullptr, offsetof( GlobalData, m_windowed ) }, + { "XResolution", INI::parseInt, nullptr, offsetof( GlobalData, m_xResolution ) }, + { "YResolution", INI::parseInt, nullptr, offsetof( GlobalData, m_yResolution ) }, + { "MapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_mapName ) }, + { "MoveHintName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_moveHintName ) }, + { "UseTrees", INI::parseBool, nullptr, offsetof( GlobalData, m_useTrees ) }, + { "UseFPSLimit", INI::parseBool, nullptr, offsetof( GlobalData, m_useFpsLimit ) }, + { "DumpAssetUsage", INI::parseBool, nullptr, offsetof( GlobalData, m_dumpAssetUsage ) }, + { "FramesPerSecondLimit", INI::parseInt, nullptr, offsetof( GlobalData, m_framesPerSecondLimit ) }, + { "ChipsetType", INI::parseInt, nullptr, offsetof( GlobalData, m_chipSetType ) }, + { "MaxShellScreens", INI::parseInt, nullptr, offsetof( GlobalData, m_maxShellScreens ) }, + { "UseCloudMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useCloudMap ) }, + { "UseLightMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useLightMap ) }, + { "BilinearTerrainTex", INI::parseBool, nullptr, offsetof( GlobalData, m_bilinearTerrainTex ) }, + { "TrilinearTerrainTex", INI::parseBool, nullptr, offsetof( GlobalData, m_trilinearTerrainTex ) }, + { "MultiPassTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_multiPassTerrain ) }, + { "AdjustCliffTextures", INI::parseBool, nullptr, offsetof( GlobalData, m_adjustCliffTextures ) }, + { "Use3WayTerrainBlends", INI::parseInt, nullptr, offsetof( GlobalData, m_use3WayTerrainBlends ) }, + { "StretchTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_stretchTerrain ) }, + { "UseHalfHeightMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useHalfHeightMap ) }, + { "UserDataLeafName", INI::parseQuotedAsciiString, nullptr, offsetof( GlobalData, m_userDataLeafName ) }, + + + { "DrawEntireTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_drawEntireTerrain ) }, { "TerrainLOD", INI::parseIndexList, TerrainLODNames, offsetof( GlobalData, m_terrainLOD ) }, - { "TerrainLODTargetTimeMS", INI::parseInt, NULL, offsetof( GlobalData, m_terrainLODTargetTimeMS ) }, - { "RightMouseAlwaysScrolls", INI::parseBool, NULL, offsetof( GlobalData, m_rightMouseAlwaysScrolls ) }, - { "UseWaterPlane", INI::parseBool, NULL, offsetof( GlobalData, m_useWaterPlane ) }, - { "UseCloudPlane", INI::parseBool, NULL, offsetof( GlobalData, m_useCloudPlane ) }, - { "DownwindAngle", INI::parseReal, NULL, offsetof( GlobalData, m_downwindAngle ) }, - { "UseShadowVolumes", INI::parseBool, NULL, offsetof( GlobalData, m_useShadowVolumes ) }, - { "UseShadowDecals", INI::parseBool, NULL, offsetof( GlobalData, m_useShadowDecals ) }, - { "TextureReductionFactor", INI::parseInt, NULL, offsetof( GlobalData, m_textureReductionFactor ) }, - { "UseBehindBuildingMarker", INI::parseBool, NULL, offsetof( GlobalData, m_enableBehindBuildingMarkers ) }, - { "WaterPositionX", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionX ) }, - { "WaterPositionY", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionY ) }, - { "WaterPositionZ", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionZ ) }, - { "WaterExtentX", INI::parseReal, NULL, offsetof( GlobalData, m_waterExtentX ) }, - { "WaterExtentY", INI::parseReal, NULL, offsetof( GlobalData, m_waterExtentY ) }, - { "WaterType", INI::parseInt, NULL, offsetof( GlobalData, m_waterType ) }, - { "FeatherWater", INI::parseInt, NULL, offsetof( GlobalData, m_featherWater ) }, - { "ShowSoftWaterEdge", INI::parseBool, NULL, offsetof( GlobalData, m_showSoftWaterEdge ) }, + { "TerrainLODTargetTimeMS", INI::parseInt, nullptr, offsetof( GlobalData, m_terrainLODTargetTimeMS ) }, + { "RightMouseAlwaysScrolls", INI::parseBool, nullptr, offsetof( GlobalData, m_rightMouseAlwaysScrolls ) }, + { "UseWaterPlane", INI::parseBool, nullptr, offsetof( GlobalData, m_useWaterPlane ) }, + { "UseCloudPlane", INI::parseBool, nullptr, offsetof( GlobalData, m_useCloudPlane ) }, + { "DownwindAngle", INI::parseReal, nullptr, offsetof( GlobalData, m_downwindAngle ) }, + { "UseShadowVolumes", INI::parseBool, nullptr, offsetof( GlobalData, m_useShadowVolumes ) }, + { "UseShadowDecals", INI::parseBool, nullptr, offsetof( GlobalData, m_useShadowDecals ) }, + { "TextureReductionFactor", INI::parseInt, nullptr, offsetof( GlobalData, m_textureReductionFactor ) }, + { "UseBehindBuildingMarker", INI::parseBool, nullptr, offsetof( GlobalData, m_enableBehindBuildingMarkers ) }, + { "WaterPositionX", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionX ) }, + { "WaterPositionY", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionY ) }, + { "WaterPositionZ", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionZ ) }, + { "WaterExtentX", INI::parseReal, nullptr, offsetof( GlobalData, m_waterExtentX ) }, + { "WaterExtentY", INI::parseReal, nullptr, offsetof( GlobalData, m_waterExtentY ) }, + { "WaterType", INI::parseInt, nullptr, offsetof( GlobalData, m_waterType ) }, + { "FeatherWater", INI::parseInt, nullptr, offsetof( GlobalData, m_featherWater ) }, + { "ShowSoftWaterEdge", INI::parseBool, nullptr, offsetof( GlobalData, m_showSoftWaterEdge ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps1", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 0 ] ) }, - { "VertexWaterHeightClampLow1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 0 ] ) }, - { "VertexWaterHeightClampHi1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 0 ] ) }, - { "VertexWaterAngle1", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 0 ] ) }, - { "VertexWaterXPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 0 ] ) }, - { "VertexWaterYPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 0 ] ) }, - { "VertexWaterZPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 0 ] ) }, - { "VertexWaterXGridCells1", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 0 ] ) }, - { "VertexWaterYGridCells1", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 0 ] ) }, - { "VertexWaterGridSize1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 0 ] ) }, - { "VertexWaterAttenuationA1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 0 ] ) }, - { "VertexWaterAttenuationB1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 0 ] ) }, - { "VertexWaterAttenuationC1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 0 ] ) }, - { "VertexWaterAttenuationRange1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 0 ] ) }, + { "VertexWaterAvailableMaps1", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 0 ] ) }, + { "VertexWaterHeightClampLow1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 0 ] ) }, + { "VertexWaterHeightClampHi1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 0 ] ) }, + { "VertexWaterAngle1", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 0 ] ) }, + { "VertexWaterXPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 0 ] ) }, + { "VertexWaterYPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 0 ] ) }, + { "VertexWaterZPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 0 ] ) }, + { "VertexWaterXGridCells1", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 0 ] ) }, + { "VertexWaterYGridCells1", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 0 ] ) }, + { "VertexWaterGridSize1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 0 ] ) }, + { "VertexWaterAttenuationA1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 0 ] ) }, + { "VertexWaterAttenuationB1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 0 ] ) }, + { "VertexWaterAttenuationC1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 0 ] ) }, + { "VertexWaterAttenuationRange1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 0 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps2", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 1 ] ) }, - { "VertexWaterHeightClampLow2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 1 ] ) }, - { "VertexWaterHeightClampHi2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 1 ] ) }, - { "VertexWaterAngle2", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 1 ] ) }, - { "VertexWaterXPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 1 ] ) }, - { "VertexWaterYPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 1 ] ) }, - { "VertexWaterZPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 1 ] ) }, - { "VertexWaterXGridCells2", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 1 ] ) }, - { "VertexWaterYGridCells2", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 1 ] ) }, - { "VertexWaterGridSize2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 1 ] ) }, - { "VertexWaterAttenuationA2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 1 ] ) }, - { "VertexWaterAttenuationB2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 1 ] ) }, - { "VertexWaterAttenuationC2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 1 ] ) }, - { "VertexWaterAttenuationRange2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 1 ] ) }, + { "VertexWaterAvailableMaps2", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 1 ] ) }, + { "VertexWaterHeightClampLow2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 1 ] ) }, + { "VertexWaterHeightClampHi2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 1 ] ) }, + { "VertexWaterAngle2", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 1 ] ) }, + { "VertexWaterXPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 1 ] ) }, + { "VertexWaterYPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 1 ] ) }, + { "VertexWaterZPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 1 ] ) }, + { "VertexWaterXGridCells2", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 1 ] ) }, + { "VertexWaterYGridCells2", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 1 ] ) }, + { "VertexWaterGridSize2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 1 ] ) }, + { "VertexWaterAttenuationA2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 1 ] ) }, + { "VertexWaterAttenuationB2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 1 ] ) }, + { "VertexWaterAttenuationC2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 1 ] ) }, + { "VertexWaterAttenuationRange2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 1 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps3", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 2 ] ) }, - { "VertexWaterHeightClampLow3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 2 ] ) }, - { "VertexWaterHeightClampHi3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 2 ] ) }, - { "VertexWaterAngle3", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 2 ] ) }, - { "VertexWaterXPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 2 ] ) }, - { "VertexWaterYPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 2 ] ) }, - { "VertexWaterZPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 2 ] ) }, - { "VertexWaterXGridCells3", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 2 ] ) }, - { "VertexWaterYGridCells3", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 2 ] ) }, - { "VertexWaterGridSize3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 2 ] ) }, - { "VertexWaterAttenuationA3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 2 ] ) }, - { "VertexWaterAttenuationB3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 2 ] ) }, - { "VertexWaterAttenuationC3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 2 ] ) }, - { "VertexWaterAttenuationRange3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 2 ] ) }, + { "VertexWaterAvailableMaps3", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 2 ] ) }, + { "VertexWaterHeightClampLow3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 2 ] ) }, + { "VertexWaterHeightClampHi3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 2 ] ) }, + { "VertexWaterAngle3", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 2 ] ) }, + { "VertexWaterXPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 2 ] ) }, + { "VertexWaterYPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 2 ] ) }, + { "VertexWaterZPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 2 ] ) }, + { "VertexWaterXGridCells3", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 2 ] ) }, + { "VertexWaterYGridCells3", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 2 ] ) }, + { "VertexWaterGridSize3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 2 ] ) }, + { "VertexWaterAttenuationA3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 2 ] ) }, + { "VertexWaterAttenuationB3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 2 ] ) }, + { "VertexWaterAttenuationC3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 2 ] ) }, + { "VertexWaterAttenuationRange3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 2 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps4", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 3 ] ) }, - { "VertexWaterHeightClampLow4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 3 ] ) }, - { "VertexWaterHeightClampHi4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 3 ] ) }, - { "VertexWaterAngle4", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 3 ] ) }, - { "VertexWaterXPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 3 ] ) }, - { "VertexWaterYPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 3 ] ) }, - { "VertexWaterZPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 3 ] ) }, - { "VertexWaterXGridCells4", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 3 ] ) }, - { "VertexWaterYGridCells4", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 3 ] ) }, - { "VertexWaterGridSize4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 3 ] ) }, - { "VertexWaterAttenuationA4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 3 ] ) }, - { "VertexWaterAttenuationB4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 3 ] ) }, - { "VertexWaterAttenuationC4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 3 ] ) }, - { "VertexWaterAttenuationRange4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 3 ] ) }, - - { "SkyBoxPositionZ", INI::parseReal, NULL, offsetof( GlobalData, m_skyBoxPositionZ ) }, - { "SkyBoxScale", INI::parseReal, NULL, offsetof( GlobalData, m_skyBoxScale ) }, - { "DrawSkyBox", INI::parseBool, NULL, offsetof( GlobalData, m_drawSkyBox ) }, - { "ViewportHeightScale", INI::parseReal, NULL, offsetof( GlobalData, m_viewportHeightScale ) }, - { "CameraPitch", INI::parseReal, NULL, offsetof( GlobalData, m_cameraPitch ) }, - { "CameraYaw", INI::parseReal, NULL, offsetof( GlobalData, m_cameraYaw ) }, - { "CameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_cameraHeight ) }, - { "MaxCameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_maxCameraHeight ) }, - { "MinCameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_minCameraHeight ) }, - { "TerrainHeightAtEdgeOfMap", INI::parseReal, NULL, offsetof( GlobalData, m_terrainHeightAtEdgeOfMap ) }, - { "UnitDamagedThreshold", INI::parseReal, NULL, offsetof( GlobalData, m_unitDamagedThresh ) }, - { "UnitReallyDamagedThreshold", INI::parseReal, NULL, offsetof( GlobalData, m_unitReallyDamagedThresh ) }, - { "GroundStiffness", INI::parseReal, NULL, offsetof( GlobalData, m_groundStiffness ) }, - { "StructureStiffness", INI::parseReal, NULL, offsetof( GlobalData, m_structureStiffness ) }, - { "Gravity", INI::parseAccelerationReal, NULL, offsetof( GlobalData, m_gravity ) }, - { "StealthFriendlyOpacity", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_stealthFriendlyOpacity ) }, - { "DefaultOcclusionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_defaultOcclusionDelay ) }, - - { "PartitionCellSize", INI::parseReal, NULL, offsetof( GlobalData, m_partitionCellSize ) }, - - { "AmmoPipScaleFactor", INI::parseReal, NULL, offsetof( GlobalData, m_ammoPipScaleFactor ) }, - { "ContainerPipScaleFactor", INI::parseReal, NULL, offsetof( GlobalData, m_containerPipScaleFactor ) }, - { "AmmoPipWorldOffset", INI::parseCoord3D, NULL, offsetof( GlobalData, m_ammoPipWorldOffset ) }, - { "ContainerPipWorldOffset", INI::parseCoord3D, NULL, offsetof( GlobalData, m_containerPipWorldOffset ) }, - { "AmmoPipScreenOffset", INI::parseCoord2D, NULL, offsetof( GlobalData, m_ammoPipScreenOffset ) }, - { "ContainerPipScreenOffset", INI::parseCoord2D, NULL, offsetof( GlobalData, m_containerPipScreenOffset ) }, - - { "HistoricDamageLimit", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_historicDamageLimit ) }, - - { "MaxTerrainTracks", INI::parseInt, NULL, offsetof( GlobalData, m_maxTerrainTracks ) }, + { "VertexWaterAvailableMaps4", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 3 ] ) }, + { "VertexWaterHeightClampLow4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 3 ] ) }, + { "VertexWaterHeightClampHi4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 3 ] ) }, + { "VertexWaterAngle4", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 3 ] ) }, + { "VertexWaterXPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 3 ] ) }, + { "VertexWaterYPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 3 ] ) }, + { "VertexWaterZPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 3 ] ) }, + { "VertexWaterXGridCells4", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 3 ] ) }, + { "VertexWaterYGridCells4", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 3 ] ) }, + { "VertexWaterGridSize4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 3 ] ) }, + { "VertexWaterAttenuationA4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 3 ] ) }, + { "VertexWaterAttenuationB4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 3 ] ) }, + { "VertexWaterAttenuationC4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 3 ] ) }, + { "VertexWaterAttenuationRange4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 3 ] ) }, + + { "SkyBoxPositionZ", INI::parseReal, nullptr, offsetof( GlobalData, m_skyBoxPositionZ ) }, + { "SkyBoxScale", INI::parseReal, nullptr, offsetof( GlobalData, m_skyBoxScale ) }, + { "DrawSkyBox", INI::parseBool, nullptr, offsetof( GlobalData, m_drawSkyBox ) }, + { "ViewportHeightScale", INI::parseReal, nullptr, offsetof( GlobalData, m_viewportHeightScale ) }, + { "CameraPitch", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraPitch ) }, + { "CameraYaw", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraYaw ) }, + { "CameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraHeight ) }, + { "MaxCameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_maxCameraHeight ) }, + { "MinCameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_minCameraHeight ) }, + { "TerrainHeightAtEdgeOfMap", INI::parseReal, nullptr, offsetof( GlobalData, m_terrainHeightAtEdgeOfMap ) }, + { "UnitDamagedThreshold", INI::parseReal, nullptr, offsetof( GlobalData, m_unitDamagedThresh ) }, + { "UnitReallyDamagedThreshold", INI::parseReal, nullptr, offsetof( GlobalData, m_unitReallyDamagedThresh ) }, + { "GroundStiffness", INI::parseReal, nullptr, offsetof( GlobalData, m_groundStiffness ) }, + { "StructureStiffness", INI::parseReal, nullptr, offsetof( GlobalData, m_structureStiffness ) }, + { "Gravity", INI::parseAccelerationReal, nullptr, offsetof( GlobalData, m_gravity ) }, + { "StealthFriendlyOpacity", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_stealthFriendlyOpacity ) }, + { "DefaultOcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_defaultOcclusionDelay ) }, + + { "PartitionCellSize", INI::parseReal, nullptr, offsetof( GlobalData, m_partitionCellSize ) }, + + { "AmmoPipScaleFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_ammoPipScaleFactor ) }, + { "ContainerPipScaleFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_containerPipScaleFactor ) }, + { "AmmoPipWorldOffset", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_ammoPipWorldOffset ) }, + { "ContainerPipWorldOffset", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_containerPipWorldOffset ) }, + { "AmmoPipScreenOffset", INI::parseCoord2D, nullptr, offsetof( GlobalData, m_ammoPipScreenOffset ) }, + { "ContainerPipScreenOffset", INI::parseCoord2D, nullptr, offsetof( GlobalData, m_containerPipScreenOffset ) }, + + { "HistoricDamageLimit", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_historicDamageLimit ) }, + + { "MaxTerrainTracks", INI::parseInt, nullptr, offsetof( GlobalData, m_maxTerrainTracks ) }, { "TimeOfDay", INI::parseIndexList, TimeOfDayNames, offsetof( GlobalData, m_timeOfDay ) }, { "Weather", INI::parseIndexList, WeatherNames, offsetof( GlobalData, m_weather ) }, - { "MakeTrackMarks", INI::parseBool, NULL, offsetof( GlobalData, m_makeTrackMarks ) }, - { "HideGarrisonFlags", INI::parseBool, NULL, offsetof( GlobalData, m_hideGarrisonFlags ) }, - { "ForceModelsToFollowTimeOfDay", INI::parseBool, NULL, offsetof( GlobalData, m_forceModelsToFollowTimeOfDay ) }, - { "ForceModelsToFollowWeather", INI::parseBool, NULL, offsetof( GlobalData, m_forceModelsToFollowWeather ) }, - - { "LevelGainAnimationName", INI::parseAsciiString, NULL, offsetof( GlobalData, m_levelGainAnimationName ) }, - { "LevelGainAnimationTime", INI::parseReal, NULL, offsetof( GlobalData, m_levelGainAnimationDisplayTimeInSeconds ) }, - { "LevelGainAnimationZRise", INI::parseReal, NULL, offsetof( GlobalData, m_levelGainAnimationZRisePerSecond ) }, - - { "GetHealedAnimationName", INI::parseAsciiString, NULL, offsetof( GlobalData, m_getHealedAnimationName ) }, - { "GetHealedAnimationTime", INI::parseReal, NULL, offsetof( GlobalData, m_getHealedAnimationDisplayTimeInSeconds ) }, - { "GetHealedAnimationZRise", INI::parseReal, NULL, offsetof( GlobalData, m_getHealedAnimationZRisePerSecond ) }, - - { "TerrainLightingMorningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, - { "TerrainLightingMorningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, - { "TerrainLightingMorningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, - { "TerrainLightingAfternoonAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, - { "TerrainLightingAfternoonDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, - { "TerrainLightingAfternoonLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, - { "TerrainLightingEveningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, - { "TerrainLightingEveningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, - { "TerrainLightingEveningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, - { "TerrainLightingNightAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, - { "TerrainLightingNightDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, - { "TerrainLightingNightLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, - { "TerrainObjectsLightingNightAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, - { "TerrainObjectsLightingNightDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, - { "TerrainObjectsLightingNightLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, + { "MakeTrackMarks", INI::parseBool, nullptr, offsetof( GlobalData, m_makeTrackMarks ) }, + { "HideGarrisonFlags", INI::parseBool, nullptr, offsetof( GlobalData, m_hideGarrisonFlags ) }, + { "ForceModelsToFollowTimeOfDay", INI::parseBool, nullptr, offsetof( GlobalData, m_forceModelsToFollowTimeOfDay ) }, + { "ForceModelsToFollowWeather", INI::parseBool, nullptr, offsetof( GlobalData, m_forceModelsToFollowWeather ) }, + + { "LevelGainAnimationName", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_levelGainAnimationName ) }, + { "LevelGainAnimationTime", INI::parseReal, nullptr, offsetof( GlobalData, m_levelGainAnimationDisplayTimeInSeconds ) }, + { "LevelGainAnimationZRise", INI::parseReal, nullptr, offsetof( GlobalData, m_levelGainAnimationZRisePerSecond ) }, + + { "GetHealedAnimationName", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_getHealedAnimationName ) }, + { "GetHealedAnimationTime", INI::parseReal, nullptr, offsetof( GlobalData, m_getHealedAnimationDisplayTimeInSeconds ) }, + { "GetHealedAnimationZRise", INI::parseReal, nullptr, offsetof( GlobalData, m_getHealedAnimationZRisePerSecond ) }, + + { "TerrainLightingMorningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, + { "TerrainLightingMorningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, + { "TerrainLightingMorningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, + { "TerrainLightingAfternoonAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, + { "TerrainLightingAfternoonDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, + { "TerrainLightingAfternoonLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, + { "TerrainLightingEveningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, + { "TerrainLightingEveningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, + { "TerrainLightingEveningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, + { "TerrainLightingNightAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, + { "TerrainLightingNightDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, + { "TerrainLightingNightLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, + { "TerrainObjectsLightingNightAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, + { "TerrainObjectsLightingNightDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, + { "TerrainObjectsLightingNightLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, //Secondary global light - { "TerrainLightingMorningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, - { "TerrainLightingMorningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, - { "TerrainLightingMorningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, - { "TerrainLightingAfternoonAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, - { "TerrainLightingAfternoonDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, - { "TerrainLightingAfternoonLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, - { "TerrainLightingEveningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, - { "TerrainLightingEveningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, - { "TerrainLightingEveningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, - { "TerrainLightingNightAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, - { "TerrainLightingNightDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, - { "TerrainLightingNightLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, - { "TerrainObjectsLightingNightAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, - { "TerrainObjectsLightingNightDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, - { "TerrainObjectsLightingNightLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, + { "TerrainLightingMorningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, + { "TerrainLightingMorningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, + { "TerrainLightingMorningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, + { "TerrainLightingAfternoonAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, + { "TerrainLightingAfternoonDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, + { "TerrainLightingAfternoonLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, + { "TerrainLightingEveningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, + { "TerrainLightingEveningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, + { "TerrainLightingEveningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, + { "TerrainLightingNightAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, + { "TerrainLightingNightDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, + { "TerrainLightingNightLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, + { "TerrainObjectsLightingNightAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, + { "TerrainObjectsLightingNightDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, + { "TerrainObjectsLightingNightLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, //Third global light - { "TerrainLightingMorningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, - { "TerrainLightingMorningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, - { "TerrainLightingMorningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, - { "TerrainLightingAfternoonAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, - { "TerrainLightingAfternoonDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, - { "TerrainLightingAfternoonLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, - { "TerrainLightingEveningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, - { "TerrainLightingEveningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, - { "TerrainLightingEveningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, - { "TerrainLightingNightAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, - { "TerrainLightingNightDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, - { "TerrainLightingNightLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, - { "TerrainObjectsLightingNightAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, - { "TerrainObjectsLightingNightDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, - { "TerrainObjectsLightingNightLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, - - - { "NumberGlobalLights", INI::parseInt, NULL, offsetof( GlobalData, m_numGlobalLights)}, - { "InfantryLightMorningScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_MORNING] ) }, - { "InfantryLightAfternoonScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_AFTERNOON] ) }, - { "InfantryLightEveningScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_EVENING] ) }, - { "InfantryLightNightScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_NIGHT] ) }, - - { "MaxTranslucentObjects", INI::parseInt, NULL, offsetof( GlobalData, m_maxVisibleTranslucentObjects) }, - { "OccludedColorLuminanceScale", INI::parseReal, NULL, offsetof( GlobalData, m_occludedLuminanceScale) }, + { "TerrainLightingMorningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, + { "TerrainLightingMorningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, + { "TerrainLightingMorningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, + { "TerrainLightingAfternoonAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, + { "TerrainLightingAfternoonDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, + { "TerrainLightingAfternoonLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, + { "TerrainLightingEveningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, + { "TerrainLightingEveningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, + { "TerrainLightingEveningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, + { "TerrainLightingNightAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, + { "TerrainLightingNightDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, + { "TerrainLightingNightLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, + { "TerrainObjectsLightingNightAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, + { "TerrainObjectsLightingNightDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, + { "TerrainObjectsLightingNightLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, + + + { "NumberGlobalLights", INI::parseInt, nullptr, offsetof( GlobalData, m_numGlobalLights)}, + { "InfantryLightMorningScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_MORNING] ) }, + { "InfantryLightAfternoonScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_AFTERNOON] ) }, + { "InfantryLightEveningScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_EVENING] ) }, + { "InfantryLightNightScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_NIGHT] ) }, + + { "MaxTranslucentObjects", INI::parseInt, nullptr, offsetof( GlobalData, m_maxVisibleTranslucentObjects) }, + { "OccludedColorLuminanceScale", INI::parseReal, nullptr, offsetof( GlobalData, m_occludedLuminanceScale) }, /* These are internal use only, they do not need file definitons - { "TerrainAmbientRGB", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainAmbient ) }, - { "TerrainDiffuseRGB", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainDiffuse ) }, - { "TerrainLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLightPos ) }, + { "TerrainAmbientRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainAmbient ) }, + { "TerrainDiffuseRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainDiffuse ) }, + { "TerrainLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLightPos ) }, */ - { "MaxRoadSegments", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadSegments ) }, - { "MaxRoadVertex", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadVertex ) }, - { "MaxRoadIndex", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadIndex ) }, - { "MaxRoadTypes", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadTypes ) }, + { "MaxRoadSegments", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadSegments ) }, + { "MaxRoadVertex", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadVertex ) }, + { "MaxRoadIndex", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadIndex ) }, + { "MaxRoadTypes", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadTypes ) }, - { "ValuePerSupplyBox", INI::parseInt, NULL, offsetof( GlobalData, m_baseValuePerSupplyBox ) }, + { "ValuePerSupplyBox", INI::parseInt, nullptr, offsetof( GlobalData, m_baseValuePerSupplyBox ) }, - { "AudioOn", INI::parseBool, NULL, offsetof( GlobalData, m_audioOn ) }, - { "MusicOn", INI::parseBool, NULL, offsetof( GlobalData, m_musicOn ) }, - { "SoundsOn", INI::parseBool, NULL, offsetof( GlobalData, m_soundsOn ) }, - { "Sounds3DOn", INI::parseBool, NULL, offsetof( GlobalData, m_sounds3DOn ) }, - { "SpeechOn", INI::parseBool, NULL, offsetof( GlobalData, m_speechOn ) }, - { "VideoOn", INI::parseBool, NULL, offsetof( GlobalData, m_videoOn ) }, - { "DisableCameraMovements", INI::parseBool, NULL, offsetof( GlobalData, m_disableCameraMovement ) }, + { "AudioOn", INI::parseBool, nullptr, offsetof( GlobalData, m_audioOn ) }, + { "MusicOn", INI::parseBool, nullptr, offsetof( GlobalData, m_musicOn ) }, + { "SoundsOn", INI::parseBool, nullptr, offsetof( GlobalData, m_soundsOn ) }, + { "Sounds3DOn", INI::parseBool, nullptr, offsetof( GlobalData, m_sounds3DOn ) }, + { "SpeechOn", INI::parseBool, nullptr, offsetof( GlobalData, m_speechOn ) }, + { "VideoOn", INI::parseBool, nullptr, offsetof( GlobalData, m_videoOn ) }, + { "DisableCameraMovements", INI::parseBool, nullptr, offsetof( GlobalData, m_disableCameraMovement ) }, /* These are internal use only, they do not need file definitons /// @todo remove this hack - { "InGame", INI::parseBool, NULL, offsetof( GlobalData, m_inGame ) }, + { "InGame", INI::parseBool, nullptr, offsetof( GlobalData, m_inGame ) }, */ - { "DebugAI", INI::parseBool, NULL, offsetof( GlobalData, m_debugAI ) }, - { "DebugAIObstacles", INI::parseBool, NULL, offsetof( GlobalData, m_debugAIObstacles ) }, - { "ShowClientPhysics", INI::parseBool, NULL, offsetof( GlobalData, m_showClientPhysics ) }, - { "ShowTerrainNormals", INI::parseBool, NULL, offsetof( GlobalData, m_showTerrainNormals ) }, - { "ShowObjectHealth", INI::parseBool, NULL, offsetof( GlobalData, m_showObjectHealth ) }, - - { "ParticleScale", INI::parseReal, NULL, offsetof( GlobalData, m_particleScale ) }, - { "AutoFireParticleSmallPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleSmallPrefix ) }, - { "AutoFireParticleSmallSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleSmallSystem ) }, - { "AutoFireParticleSmallMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleSmallMax ) }, - { "AutoFireParticleMediumPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleMediumPrefix ) }, - { "AutoFireParticleMediumSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleMediumSystem ) }, - { "AutoFireParticleMediumMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleMediumMax ) }, - { "AutoFireParticleLargePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleLargePrefix ) }, - { "AutoFireParticleLargeSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleLargeSystem ) }, - { "AutoFireParticleLargeMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleLargeMax ) }, - { "AutoSmokeParticleSmallPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallPrefix ) }, - { "AutoSmokeParticleSmallSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallSystem ) }, - { "AutoSmokeParticleSmallMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallMax ) }, - { "AutoSmokeParticleMediumPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumPrefix ) }, - { "AutoSmokeParticleMediumSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumSystem ) }, - { "AutoSmokeParticleMediumMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumMax ) }, - { "AutoSmokeParticleLargePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleLargePrefix ) }, - { "AutoSmokeParticleLargeSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleLargeSystem ) }, - { "AutoSmokeParticleLargeMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleLargeMax ) }, - { "AutoAflameParticlePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoAflameParticlePrefix ) }, - { "AutoAflameParticleSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoAflameParticleSystem ) }, - { "AutoAflameParticleMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoAflameParticleMax ) }, + { "DebugAI", INI::parseBool, nullptr, offsetof( GlobalData, m_debugAI ) }, + { "DebugAIObstacles", INI::parseBool, nullptr, offsetof( GlobalData, m_debugAIObstacles ) }, + { "ShowClientPhysics", INI::parseBool, nullptr, offsetof( GlobalData, m_showClientPhysics ) }, + { "ShowTerrainNormals", INI::parseBool, nullptr, offsetof( GlobalData, m_showTerrainNormals ) }, + { "ShowObjectHealth", INI::parseBool, nullptr, offsetof( GlobalData, m_showObjectHealth ) }, + + { "ParticleScale", INI::parseReal, nullptr, offsetof( GlobalData, m_particleScale ) }, + { "AutoFireParticleSmallPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleSmallPrefix ) }, + { "AutoFireParticleSmallSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleSmallSystem ) }, + { "AutoFireParticleSmallMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleSmallMax ) }, + { "AutoFireParticleMediumPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleMediumPrefix ) }, + { "AutoFireParticleMediumSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleMediumSystem ) }, + { "AutoFireParticleMediumMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleMediumMax ) }, + { "AutoFireParticleLargePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleLargePrefix ) }, + { "AutoFireParticleLargeSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleLargeSystem ) }, + { "AutoFireParticleLargeMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleLargeMax ) }, + { "AutoSmokeParticleSmallPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallPrefix ) }, + { "AutoSmokeParticleSmallSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallSystem ) }, + { "AutoSmokeParticleSmallMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallMax ) }, + { "AutoSmokeParticleMediumPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumPrefix ) }, + { "AutoSmokeParticleMediumSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumSystem ) }, + { "AutoSmokeParticleMediumMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumMax ) }, + { "AutoSmokeParticleLargePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargePrefix ) }, + { "AutoSmokeParticleLargeSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargeSystem ) }, + { "AutoSmokeParticleLargeMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargeMax ) }, + { "AutoAflameParticlePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoAflameParticlePrefix ) }, + { "AutoAflameParticleSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoAflameParticleSystem ) }, + { "AutoAflameParticleMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoAflameParticleMax ) }, /* These are internal use only, they do not need file definitons - { "LatencyAverage", INI::parseInt, NULL, offsetof( GlobalData, m_latencyAverage ) }, - { "LatencyAmplitude", INI::parseInt, NULL, offsetof( GlobalData, m_latencyAmplitude ) }, - { "LatencyPeriod", INI::parseInt, NULL, offsetof( GlobalData, m_latencyPeriod ) }, - { "LatencyNoise", INI::parseInt, NULL, offsetof( GlobalData, m_latencyNoise ) }, - { "PacketLoss", INI::parseInt, NULL, offsetof( GlobalData, m_packetLoss ) }, + { "LatencyAverage", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAverage ) }, + { "LatencyAmplitude", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAmplitude ) }, + { "LatencyPeriod", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyPeriod ) }, + { "LatencyNoise", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyNoise ) }, + { "PacketLoss", INI::parseInt, nullptr, offsetof( GlobalData, m_packetLoss ) }, */ - { "BuildSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_BuildSpeed ) }, - { "MinDistFromEdgeOfMapForBuild", INI::parseReal, NULL, offsetof( GlobalData, m_MinDistFromEdgeOfMapForBuild ) }, - { "SupplyBuildBorder", INI::parseReal, NULL, offsetof( GlobalData, m_SupplyBuildBorder ) }, - { "AllowedHeightVariationForBuilding", INI::parseReal,NULL, offsetof( GlobalData, m_allowedHeightVariationForBuilding ) }, - { "MinLowEnergyProductionSpeed",INI::parseReal, NULL, offsetof( GlobalData, m_MinLowEnergyProductionSpeed ) }, - { "MaxLowEnergyProductionSpeed",INI::parseReal, NULL, offsetof( GlobalData, m_MaxLowEnergyProductionSpeed ) }, - { "LowEnergyPenaltyModifier", INI::parseReal, NULL, offsetof( GlobalData, m_LowEnergyPenaltyModifier ) }, - { "MultipleFactory", INI::parseReal, NULL, offsetof( GlobalData, m_MultipleFactory ) }, - { "RefundPercent", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_RefundPercent ) }, - - { "CommandCenterHealRange", INI::parseReal, NULL, offsetof( GlobalData, m_commandCenterHealRange ) }, - { "CommandCenterHealAmount", INI::parseReal, NULL, offsetof( GlobalData, m_commandCenterHealAmount ) }, - - { "StandardMinefieldDensity", INI::parseReal, NULL, offsetof( GlobalData, m_standardMinefieldDensity ) }, - { "StandardMinefieldDistance", INI::parseReal, NULL, offsetof( GlobalData, m_standardMinefieldDistance ) }, - - { "MaxLineBuildObjects", INI::parseInt, NULL, offsetof( GlobalData, m_maxLineBuildObjects ) }, - { "MaxTunnelCapacity", INI::parseInt, NULL, offsetof( GlobalData, m_maxTunnelCapacity ) }, - - { "MaxParticleCount", INI::parseInt, NULL, offsetof( GlobalData, m_maxParticleCount ) }, - { "MaxFieldParticleCount", INI::parseInt, NULL, offsetof( GlobalData, m_maxFieldParticleCount ) }, - { "HorizontalScrollSpeedFactor",INI::parseReal, NULL, offsetof( GlobalData, m_horizontalScrollSpeedFactor ) }, - { "VerticalScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_verticalScrollSpeedFactor ) }, - { "ScrollAmountCutoff", INI::parseReal, NULL, offsetof( GlobalData, m_scrollAmountCutoff ) }, - { "CameraAdjustSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAdjustSpeed ) }, - { "EnforceMaxCameraHeight", INI::parseBool, NULL, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, - { "KeyboardScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardScrollFactor ) }, - { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, - { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, + { "BuildSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_BuildSpeed ) }, + { "MinDistFromEdgeOfMapForBuild", INI::parseReal, nullptr, offsetof( GlobalData, m_MinDistFromEdgeOfMapForBuild ) }, + { "SupplyBuildBorder", INI::parseReal, nullptr, offsetof( GlobalData, m_SupplyBuildBorder ) }, + { "AllowedHeightVariationForBuilding", INI::parseReal,nullptr, offsetof( GlobalData, m_allowedHeightVariationForBuilding ) }, + { "MinLowEnergyProductionSpeed",INI::parseReal, nullptr, offsetof( GlobalData, m_MinLowEnergyProductionSpeed ) }, + { "MaxLowEnergyProductionSpeed",INI::parseReal, nullptr, offsetof( GlobalData, m_MaxLowEnergyProductionSpeed ) }, + { "LowEnergyPenaltyModifier", INI::parseReal, nullptr, offsetof( GlobalData, m_LowEnergyPenaltyModifier ) }, + { "MultipleFactory", INI::parseReal, nullptr, offsetof( GlobalData, m_MultipleFactory ) }, + { "RefundPercent", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_RefundPercent ) }, + + { "CommandCenterHealRange", INI::parseReal, nullptr, offsetof( GlobalData, m_commandCenterHealRange ) }, + { "CommandCenterHealAmount", INI::parseReal, nullptr, offsetof( GlobalData, m_commandCenterHealAmount ) }, + + { "StandardMinefieldDensity", INI::parseReal, nullptr, offsetof( GlobalData, m_standardMinefieldDensity ) }, + { "StandardMinefieldDistance", INI::parseReal, nullptr, offsetof( GlobalData, m_standardMinefieldDistance ) }, + + { "MaxLineBuildObjects", INI::parseInt, nullptr, offsetof( GlobalData, m_maxLineBuildObjects ) }, + { "MaxTunnelCapacity", INI::parseInt, nullptr, offsetof( GlobalData, m_maxTunnelCapacity ) }, + + { "MaxParticleCount", INI::parseInt, nullptr, offsetof( GlobalData, m_maxParticleCount ) }, + { "MaxFieldParticleCount", INI::parseInt, nullptr, offsetof( GlobalData, m_maxFieldParticleCount ) }, + { "HorizontalScrollSpeedFactor",INI::parseReal, nullptr, offsetof( GlobalData, m_horizontalScrollSpeedFactor ) }, + { "VerticalScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_verticalScrollSpeedFactor ) }, + { "ScrollAmountCutoff", INI::parseReal, nullptr, offsetof( GlobalData, m_scrollAmountCutoff ) }, + { "CameraAdjustSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraAdjustSpeed ) }, + { "EnforceMaxCameraHeight", INI::parseBool, nullptr, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, + { "KeyboardScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardScrollFactor ) }, + { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, + { "KeyboardCameraRotateSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "MovementPenaltyDamageState", INI::parseIndexList, TheBodyDamageTypeNames, offsetof( GlobalData, m_movementPenaltyDamageState ) }, // you cannot set this; it always has a value of 100%. -//{ "HealthBonus_Regular", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_REGULAR]) }, - { "HealthBonus_Veteran", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_VETERAN]) }, - { "HealthBonus_Elite", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_ELITE]) }, - { "HealthBonus_Heroic", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_HEROIC]) }, +//{ "HealthBonus_Regular", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_REGULAR]) }, + { "HealthBonus_Veteran", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_VETERAN]) }, + { "HealthBonus_Elite", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_ELITE]) }, + { "HealthBonus_Heroic", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_HEROIC]) }, - { "HumanSoloPlayerHealthBonus_Easy", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_EASY] ) }, - { "HumanSoloPlayerHealthBonus_Normal", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_NORMAL] ) }, - { "HumanSoloPlayerHealthBonus_Hard", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_HARD] ) }, + { "HumanSoloPlayerHealthBonus_Easy", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_EASY] ) }, + { "HumanSoloPlayerHealthBonus_Normal", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_NORMAL] ) }, + { "HumanSoloPlayerHealthBonus_Hard", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_HARD] ) }, - { "AISoloPlayerHealthBonus_Easy", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_EASY] ) }, - { "AISoloPlayerHealthBonus_Normal", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_NORMAL] ) }, - { "AISoloPlayerHealthBonus_Hard", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_HARD] ) }, + { "AISoloPlayerHealthBonus_Easy", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_EASY] ) }, + { "AISoloPlayerHealthBonus_Normal", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_NORMAL] ) }, + { "AISoloPlayerHealthBonus_Hard", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_HARD] ) }, - { "WeaponBonus", WeaponBonusSet::parseWeaponBonusSetPtr, NULL, offsetof( GlobalData, m_weaponBonusSet ) }, + { "WeaponBonus", WeaponBonusSet::parseWeaponBonusSetPtr, nullptr, offsetof( GlobalData, m_weaponBonusSet ) }, - { "DefaultStructureRubbleHeight", INI::parseReal, NULL, offsetof( GlobalData, m_defaultStructureRubbleHeight ) }, + { "DefaultStructureRubbleHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_defaultStructureRubbleHeight ) }, - { "FixedSeed", INI::parseInt, NULL, offsetof( GlobalData, m_fixedSeed ) }, + { "FixedSeed", INI::parseInt, nullptr, offsetof( GlobalData, m_fixedSeed ) }, - { "ShellMapName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_shellMapName ) }, - { "ShellMapOn", INI::parseBool, NULL, offsetof( GlobalData, m_shellMapOn ) }, - { "PlayIntro", INI::parseBool, NULL, offsetof( GlobalData, m_playIntro ) }, + { "ShellMapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_shellMapName ) }, + { "ShellMapOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shellMapOn ) }, + { "PlayIntro", INI::parseBool, nullptr, offsetof( GlobalData, m_playIntro ) }, - { "FirewallBehavior", INI::parseInt, NULL, offsetof( GlobalData, m_firewallBehavior ) }, - { "FirewallPortOverride", INI::parseInt, NULL, offsetof( GlobalData, m_firewallPortOverride ) }, - { "FirewallPortAllocationDelta",INI::parseInt, NULL, offsetof( GlobalData, m_firewallPortAllocationDelta) }, + { "FirewallBehavior", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallBehavior ) }, + { "FirewallPortOverride", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortOverride ) }, + { "FirewallPortAllocationDelta",INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortAllocationDelta) }, - { "GroupSelectMinSelectSize", INI::parseInt, NULL, offsetof( GlobalData, m_groupSelectMinSelectSize ) }, - { "GroupSelectVolumeBase", INI::parseReal, NULL, offsetof( GlobalData, m_groupSelectVolumeBase ) }, - { "GroupSelectVolumeIncrement", INI::parseReal, NULL, offsetof( GlobalData, m_groupSelectVolumeIncrement ) }, - { "MaxUnitSelectSounds", INI::parseInt, NULL, offsetof( GlobalData, m_maxUnitSelectSounds ) }, + { "GroupSelectMinSelectSize", INI::parseInt, nullptr, offsetof( GlobalData, m_groupSelectMinSelectSize ) }, + { "GroupSelectVolumeBase", INI::parseReal, nullptr, offsetof( GlobalData, m_groupSelectVolumeBase ) }, + { "GroupSelectVolumeIncrement", INI::parseReal, nullptr, offsetof( GlobalData, m_groupSelectVolumeIncrement ) }, + { "MaxUnitSelectSounds", INI::parseInt, nullptr, offsetof( GlobalData, m_maxUnitSelectSounds ) }, - { "SelectionFlashSaturationFactor", INI::parseReal, NULL, offsetof( GlobalData, m_selectionFlashSaturationFactor ) }, - { "SelectionFlashHouseColor", INI::parseBool, NULL, offsetof( GlobalData, m_selectionFlashHouseColor ) }, + { "SelectionFlashSaturationFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_selectionFlashSaturationFactor ) }, + { "SelectionFlashHouseColor", INI::parseBool, nullptr, offsetof( GlobalData, m_selectionFlashHouseColor ) }, - { "CameraAudibleRadius", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAudibleRadius ) }, - { "GroupMoveClickToGatherAreaFactor", INI::parseReal, NULL, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) }, + { "CameraAudibleRadius", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraAudibleRadius ) }, + { "GroupMoveClickToGatherAreaFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) }, #if !PRESERVE_RETAIL_BEHAVIOR - { "AllowMoneyPerMinuteForPlayer", INI::parseBool, NULL, offsetof( GlobalData, m_allowMoneyPerMinuteForPlayer ) }, + { "AllowMoneyPerMinuteForPlayer", INI::parseBool, nullptr, offsetof( GlobalData, m_allowMoneyPerMinuteForPlayer ) }, #endif - { "ShakeSubtleIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSubtleIntensity ) }, - { "ShakeNormalIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeNormalIntensity ) }, - { "ShakeStrongIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeStrongIntensity ) }, - { "ShakeSevereIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSevereIntensity ) }, - { "ShakeCineExtremeIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeCineExtremeIntensity ) }, - { "ShakeCineInsaneIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeCineInsaneIntensity ) }, - { "MaxShakeIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_maxShakeIntensity ) }, - { "MaxShakeRange", INI::parseReal, NULL, offsetof( GlobalData, m_maxShakeRange) }, - { "SellPercentage", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_sellPercentage ) }, - { "BaseRegenHealthPercentPerSecond", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_baseRegenHealthPercentPerSecond ) }, - { "BaseRegenDelay", INI::parseDurationUnsignedInt, NULL,offsetof( GlobalData, m_baseRegenDelay ) }, + { "ShakeSubtleIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeSubtleIntensity ) }, + { "ShakeNormalIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeNormalIntensity ) }, + { "ShakeStrongIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeStrongIntensity ) }, + { "ShakeSevereIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeSevereIntensity ) }, + { "ShakeCineExtremeIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeCineExtremeIntensity ) }, + { "ShakeCineInsaneIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeCineInsaneIntensity ) }, + { "MaxShakeIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_maxShakeIntensity ) }, + { "MaxShakeRange", INI::parseReal, nullptr, offsetof( GlobalData, m_maxShakeRange) }, + { "SellPercentage", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_sellPercentage ) }, + { "BaseRegenHealthPercentPerSecond", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_baseRegenHealthPercentPerSecond ) }, + { "BaseRegenDelay", INI::parseDurationUnsignedInt, nullptr,offsetof( GlobalData, m_baseRegenDelay ) }, #ifdef ALLOW_SURRENDER - { "PrisonBountyMultiplier", INI::parseReal, NULL, offsetof( GlobalData, m_prisonBountyMultiplier ) }, - { "PrisonBountyTextColor", INI::parseColorInt, NULL, offsetof( GlobalData, m_prisonBountyTextColor ) }, + { "PrisonBountyMultiplier", INI::parseReal, nullptr, offsetof( GlobalData, m_prisonBountyMultiplier ) }, + { "PrisonBountyTextColor", INI::parseColorInt, nullptr, offsetof( GlobalData, m_prisonBountyTextColor ) }, #endif - { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, + { "SpecialPowerViewObject", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_specialPowerViewObjectName ) }, // TheSuperHackers @feature Customize the opacity (0..1) and shadows of build preview objects. Shadows are enabled by default. // Note that disabling shadows loses a fair bit of contrast visually and warrants raising the opacity. - { "ObjectPlacementOpacity", INI::parseReal, NULL, offsetof( GlobalData, m_objectPlacementOpacity ) }, - { "ObjectPlacementShadows", INI::parseBool, NULL, offsetof( GlobalData, m_objectPlacementShadows ) }, + { "ObjectPlacementOpacity", INI::parseReal, nullptr, offsetof( GlobalData, m_objectPlacementOpacity ) }, + { "ObjectPlacementShadows", INI::parseBool, nullptr, offsetof( GlobalData, m_objectPlacementShadows ) }, - { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, - { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, - { "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, + { "StandardPublicBone", INI::parseAsciiStringVectorAppend, nullptr, offsetof(GlobalData, m_standardPublicBones) }, + { "ShowMetrics", INI::parseBool, nullptr, offsetof( GlobalData, m_showMetrics ) }, + { "DefaultStartingCash", Money::parseMoneyAmount, nullptr, offsetof( GlobalData, m_defaultStartingCash ) }, // NOTE: m_doubleClickTimeMS is still in use, but we disallow setting it from the GameData.ini file. It is now set in the constructor according to the windows parameter. -// { "DoubleClickTimeMS", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_doubleClickTimeMS ) }, +// { "DoubleClickTimeMS", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_doubleClickTimeMS ) }, - { "ShroudColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_shroudColor) }, - { "ClearAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_clearAlpha) }, - { "FogAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_fogAlpha) }, - { "ShroudAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_shroudAlpha) }, + { "ShroudColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_shroudColor) }, + { "ClearAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_clearAlpha) }, + { "FogAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_fogAlpha) }, + { "ShroudAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_shroudAlpha) }, - { "HotKeyTextColor", INI::parseColorInt, NULL, offsetof( GlobalData, m_hotKeyTextColor ) }, + { "HotKeyTextColor", INI::parseColorInt, nullptr, offsetof( GlobalData, m_hotKeyTextColor ) }, - { "PowerBarBase", INI::parseInt, NULL, offsetof( GlobalData, m_powerBarBase) }, - { "PowerBarIntervals", INI::parseReal, NULL, offsetof( GlobalData, m_powerBarIntervals) }, - { "PowerBarYellowRange", INI::parseInt, NULL, offsetof( GlobalData, m_powerBarYellowRange) }, - { "UnlookPersistDuration", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_unlookPersistDuration) }, + { "PowerBarBase", INI::parseInt, nullptr, offsetof( GlobalData, m_powerBarBase) }, + { "PowerBarIntervals", INI::parseReal, nullptr, offsetof( GlobalData, m_powerBarIntervals) }, + { "PowerBarYellowRange", INI::parseInt, nullptr, offsetof( GlobalData, m_powerBarYellowRange) }, + { "UnlookPersistDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_unlookPersistDuration) }, - { "NetworkFPSHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkFPSHistoryLength) }, - { "NetworkLatencyHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkLatencyHistoryLength) }, - { "NetworkRunAheadMetricsTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkRunAheadMetricsTime) }, - { "NetworkCushionHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkCushionHistoryLength) }, - { "NetworkRunAheadSlack", INI::parseInt, NULL, offsetof(GlobalData, m_networkRunAheadSlack) }, - { "NetworkKeepAliveDelay", INI::parseInt, NULL, offsetof(GlobalData, m_networkKeepAliveDelay) }, - { "NetworkDisconnectTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectTime) }, - { "NetworkPlayerTimeoutTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, - { "NetworkDisconnectScreenNotifyTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, + { "NetworkFPSHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkFPSHistoryLength) }, + { "NetworkLatencyHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkLatencyHistoryLength) }, + { "NetworkRunAheadMetricsTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkRunAheadMetricsTime) }, + { "NetworkCushionHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkCushionHistoryLength) }, + { "NetworkRunAheadSlack", INI::parseInt, nullptr, offsetof(GlobalData, m_networkRunAheadSlack) }, + { "NetworkKeepAliveDelay", INI::parseInt, nullptr, offsetof(GlobalData, m_networkKeepAliveDelay) }, + { "NetworkDisconnectTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkDisconnectTime) }, + { "NetworkPlayerTimeoutTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, + { "NetworkDisconnectScreenNotifyTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, - { "PlayStats", INI::parseInt, NULL, offsetof( GlobalData, m_playStats ) }, + { "PlayStats", INI::parseInt, nullptr, offsetof( GlobalData, m_playStats ) }, #if defined(RTS_DEBUG) - { "DisableCameraFade", INI::parseBool, NULL, offsetof( GlobalData, m_disableCameraFade ) }, - { "DisableScriptedInputDisabling", INI::parseBool, NULL, offsetof( GlobalData, m_disableScriptedInputDisabling ) }, - { "DisableMilitaryCaption", INI::parseBool, NULL, offsetof( GlobalData, m_disableMilitaryCaption ) }, - { "BenchmarkTimer", INI::parseInt, NULL, offsetof( GlobalData, m_benchmarkTimer ) }, - { "CheckMemoryLeaks", INI::parseBool, NULL, offsetof(GlobalData, m_checkForLeaks) }, - { "Wireframe", INI::parseBool, NULL, offsetof( GlobalData, m_wireframe ) }, - { "StateMachineDebug", INI::parseBool, NULL, offsetof( GlobalData, m_stateMachineDebug ) }, - { "UseCameraConstraints", INI::parseBool, NULL, offsetof( GlobalData, m_useCameraConstraints ) }, - { "ShroudOn", INI::parseBool, NULL, offsetof( GlobalData, m_shroudOn ) }, - { "FogOfWarOn", INI::parseBool, NULL, offsetof( GlobalData, m_fogOfWarOn ) }, - { "ShowCollisionExtents", INI::parseBool, NULL, offsetof( GlobalData, m_showCollisionExtents ) }, - { "ShowAudioLocations", INI::parseBool, NULL, offsetof( GlobalData, m_showAudioLocations ) }, - { "DebugProjectileTileWidth", INI::parseReal, NULL, offsetof( GlobalData, m_debugProjectileTileWidth) }, - { "DebugProjectileTileDuration",INI::parseInt, NULL, offsetof( GlobalData, m_debugProjectileTileDuration) }, - { "DebugProjectileTileColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugProjectileTileColor) }, - { "DebugVisibilityTileCount", INI::parseInt, NULL, offsetof( GlobalData, m_debugVisibilityTileCount) }, - { "DebugVisibilityTileWidth", INI::parseReal, NULL, offsetof( GlobalData, m_debugVisibilityTileWidth) }, - { "DebugVisibilityTileDuration",INI::parseInt, NULL, offsetof( GlobalData, m_debugVisibilityTileDuration) }, - { "DebugVisibilityTileTargettableColor",INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityTargettableColor) }, - { "DebugVisibilityTileDeshroudColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityDeshroudColor) }, - { "DebugVisibilityTileGapColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityGapColor) }, - { "DebugThreatMapTileDuration", INI::parseInt, NULL, offsetof( GlobalData, m_debugThreatMapTileDuration) }, - { "MaxDebugThreatMapValue", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_maxDebugThreat) }, - { "DebugCashValueMapTileDuration", INI::parseInt, NULL, offsetof( GlobalData, m_debugCashValueMapTileDuration) }, - { "MaxDebugCashValueMapValue", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_maxDebugValue) }, - { "VTune", INI::parseBool, NULL, offsetof( GlobalData, m_vTune ) }, - { "SaveStats", INI::parseBool, NULL, offsetof( GlobalData, m_saveStats ) }, - { "UseLocalMOTD", INI::parseBool, NULL, offsetof( GlobalData, m_useLocalMOTD ) }, - { "BaseStatsDir", INI::parseAsciiString,NULL, offsetof( GlobalData, m_baseStatsDir ) }, - { "LocalMOTDPath", INI::parseAsciiString,NULL, offsetof( GlobalData, m_MOTDPath ) }, - { "ExtraLogging", INI::parseBool, NULL, offsetof( GlobalData, m_extraLogging ) }, + { "DisableCameraFade", INI::parseBool, nullptr, offsetof( GlobalData, m_disableCameraFade ) }, + { "DisableScriptedInputDisabling", INI::parseBool, nullptr, offsetof( GlobalData, m_disableScriptedInputDisabling ) }, + { "DisableMilitaryCaption", INI::parseBool, nullptr, offsetof( GlobalData, m_disableMilitaryCaption ) }, + { "BenchmarkTimer", INI::parseInt, nullptr, offsetof( GlobalData, m_benchmarkTimer ) }, + { "CheckMemoryLeaks", INI::parseBool, nullptr, offsetof(GlobalData, m_checkForLeaks) }, + { "Wireframe", INI::parseBool, nullptr, offsetof( GlobalData, m_wireframe ) }, + { "StateMachineDebug", INI::parseBool, nullptr, offsetof( GlobalData, m_stateMachineDebug ) }, + { "UseCameraConstraints", INI::parseBool, nullptr, offsetof( GlobalData, m_useCameraConstraints ) }, + { "ShroudOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shroudOn ) }, + { "FogOfWarOn", INI::parseBool, nullptr, offsetof( GlobalData, m_fogOfWarOn ) }, + { "ShowCollisionExtents", INI::parseBool, nullptr, offsetof( GlobalData, m_showCollisionExtents ) }, + { "ShowAudioLocations", INI::parseBool, nullptr, offsetof( GlobalData, m_showAudioLocations ) }, + { "DebugProjectileTileWidth", INI::parseReal, nullptr, offsetof( GlobalData, m_debugProjectileTileWidth) }, + { "DebugProjectileTileDuration",INI::parseInt, nullptr, offsetof( GlobalData, m_debugProjectileTileDuration) }, + { "DebugProjectileTileColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugProjectileTileColor) }, + { "DebugVisibilityTileCount", INI::parseInt, nullptr, offsetof( GlobalData, m_debugVisibilityTileCount) }, + { "DebugVisibilityTileWidth", INI::parseReal, nullptr, offsetof( GlobalData, m_debugVisibilityTileWidth) }, + { "DebugVisibilityTileDuration",INI::parseInt, nullptr, offsetof( GlobalData, m_debugVisibilityTileDuration) }, + { "DebugVisibilityTileTargettableColor",INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityTargettableColor) }, + { "DebugVisibilityTileDeshroudColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityDeshroudColor) }, + { "DebugVisibilityTileGapColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityGapColor) }, + { "DebugThreatMapTileDuration", INI::parseInt, nullptr, offsetof( GlobalData, m_debugThreatMapTileDuration) }, + { "MaxDebugThreatMapValue", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_maxDebugThreat) }, + { "DebugCashValueMapTileDuration", INI::parseInt, nullptr, offsetof( GlobalData, m_debugCashValueMapTileDuration) }, + { "MaxDebugCashValueMapValue", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_maxDebugValue) }, + { "VTune", INI::parseBool, nullptr, offsetof( GlobalData, m_vTune ) }, + { "SaveStats", INI::parseBool, nullptr, offsetof( GlobalData, m_saveStats ) }, + { "UseLocalMOTD", INI::parseBool, nullptr, offsetof( GlobalData, m_useLocalMOTD ) }, + { "BaseStatsDir", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_baseStatsDir ) }, + { "LocalMOTDPath", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_MOTDPath ) }, + { "ExtraLogging", INI::parseBool, nullptr, offsetof( GlobalData, m_extraLogging ) }, #endif - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -548,14 +548,14 @@ GlobalData::GlobalData() Int i, j; // - // we have now instanced a global data instance, if theOriginal is NULL, this is + // we have now instanced a global data instance, if theOriginal is null, this is // *the* very first instance and it shall be recorded. This way, when we load // overrides of the global data, we can revert to the common, original data // in m_theOriginal // - if( m_theOriginal == NULL ) + if( m_theOriginal == nullptr ) m_theOriginal = this; - m_next = NULL; + m_next = nullptr; m_TiVOFastMode = FALSE; @@ -1037,13 +1037,13 @@ AsciiString GlobalData::getPath_UserData() const //------------------------------------------------------------------------------------------------- GlobalData::~GlobalData( void ) { - DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("~GlobalData: theOriginal is not original") ); + DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == nullptr, ("~GlobalData: theOriginal is not original") ); deleteInstance(m_weaponBonusSet); if( m_theOriginal == this ) { - m_theOriginal = NULL; - TheWritableGlobalData = NULL; + m_theOriginal = nullptr; + TheWritableGlobalData = nullptr; } } @@ -1132,7 +1132,7 @@ void GlobalData::reset( void ) // we now have the one single global data in TheWritableGlobalData singleton, lets sanity check // some of all that // - DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("ResetGlobalData: theOriginal is not original") ); + DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == nullptr, ("ResetGlobalData: theOriginal is not original") ); DEBUG_ASSERTCRASH( TheWritableGlobalData == GlobalData::m_theOriginal, ("ResetGlobalData: oops") ); } @@ -1168,13 +1168,13 @@ void GlobalData::parseGameDataDefinition( INI* ini ) TheWritableGlobalData->m_userDataDir.clear(); char temp[_MAX_PATH]; - if (::SHGetSpecialFolderPath(NULL, temp, CSIDL_PERSONAL, true)) + if (::SHGetSpecialFolderPath(nullptr, temp, CSIDL_PERSONAL, true)) { if (temp[strlen(temp)-1] != '\\') strcat(temp, "\\"); strcat(temp, TheWritableGlobalData->m_userDataLeafName.str()); strcat(temp, "\\"); - CreateDirectory(temp, NULL); + CreateDirectory(temp, nullptr); TheWritableGlobalData->m_userDataDir = temp; } @@ -1231,7 +1231,7 @@ void GlobalData::parseCustomDefinition() UnsignedInt GlobalData::generateExeCRC() { - DEBUG_ASSERTCRASH(TheFileSystem != NULL, ("TheFileSystem is NULL")); + DEBUG_ASSERTCRASH(TheFileSystem != nullptr, ("TheFileSystem is null")); // lets CRC the executable! Whee! const Int blockSize = 65536; @@ -1251,9 +1251,9 @@ UnsignedInt GlobalData::generateExeCRC() #else { Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); fp = TheFileSystem->openFile(buffer, File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1262,7 +1262,7 @@ UnsignedInt GlobalData::generateExeCRC() } DEBUG_LOG(("EXE CRC is 0x%8.8X", exeCRC.get())); fp->close(); - fp = NULL; + fp = nullptr; } else { DEBUG_CRASH(("Executable file has failed to open")); @@ -1278,7 +1278,7 @@ UnsignedInt GlobalData::generateExeCRC() } // Add in MP scripts to the EXE CRC, since the game will go out of sync if they change fp = TheFileSystem->openFile("Data\\Scripts\\SkirmishScripts.scb", File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1286,10 +1286,10 @@ UnsignedInt GlobalData::generateExeCRC() exeCRC.computeCRC(crcBlock, amtRead); } fp->close(); - fp = NULL; + fp = nullptr; } fp = TheFileSystem->openFile("Data\\Scripts\\MultiplayerScripts.scb", File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1297,7 +1297,7 @@ UnsignedInt GlobalData::generateExeCRC() exeCRC.computeCRC(crcBlock, amtRead); } fp->close(); - fp = NULL; + fp = nullptr; } DEBUG_LOG(("EXE+Version(%d.%d)+SCB CRC is 0x%8.8X", version >> 16, version & 0xffff, exeCRC.get())); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 51b8fc2e8ac..c9cf9cbee86 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -64,7 +64,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -static Xfer *s_xfer = NULL; +static Xfer *s_xfer = nullptr; //------------------------------------------------------------------------------------------------- /** This is the table of data types we can have in INI files. To add a new data type @@ -137,7 +137,7 @@ static const BlockParse theTypeTable[] = { "BenchProfile", INI::parseBenchProfile }, { "ReallyLowMHz", parseReallyLowMHz }, - { NULL, NULL }, + { nullptr, nullptr }, }; @@ -146,7 +146,7 @@ static const BlockParse theTypeTable[] = /////////////////////////////////////////////////////////////////////////////////////////////////// Bool INI::isValidINIFilename( const char *filename ) { - if( filename == NULL ) + if( filename == nullptr ) return FALSE; Int len = strlen( filename ); @@ -175,7 +175,7 @@ Bool INI::isValidINIFilename( const char *filename ) INI::INI( void ) { - m_file = NULL; + m_file = nullptr; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -262,7 +262,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer AsciiString tempname; tempname = (*it).str() + dirName.getLength(); - if ((tempname.find('\\') == NULL) && (tempname.find('/') == NULL)) { + if ((tempname.find('\\') == nullptr) && (tempname.find('/') == nullptr)) { // this file doesn't reside in a subdirectory, load it first. filesRead += load( *it, loadType, pXfer ); } @@ -275,7 +275,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer AsciiString tempname; tempname = (*it).str() + dirName.getLength(); - if ((tempname.find('\\') != NULL) || (tempname.find('/') != NULL)) { + if ((tempname.find('\\') != nullptr) || (tempname.find('/') != nullptr)) { filesRead += load( *it, loadType, pXfer ); } ++it; @@ -295,7 +295,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer void INI::prepFile( AsciiString filename, INILoadType loadType ) { // if we have a file open already -- we can't do another one - if( m_file != NULL ) + if( m_file != nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); @@ -305,7 +305,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) // open the file m_file = TheFileSystem->openFile(filename.str(), File::READ); - if( m_file == NULL ) + if( m_file == nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); @@ -328,12 +328,12 @@ void INI::unPrepFile() { // close the file m_file->close(); - m_file = NULL; + m_file = nullptr; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; m_endOfFile = FALSE; - s_xfer = NULL; + s_xfer = nullptr; } //------------------------------------------------------------------------------------------------- @@ -346,7 +346,7 @@ static INIBlockParse findBlockParse(const char* token) return parse->parse; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -371,7 +371,7 @@ static INIFieldParseProc findFieldParse(const FieldParse* parseTable, const char } else { - return NULL; + return nullptr; } } @@ -455,7 +455,7 @@ void INI::readLine( void ) Bool isComment = FALSE; // sanity - DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is NULL") ); + DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is null") ); // if we've reached end of file we'll just keep returning empty string in our buffer if( m_endOfFile ) @@ -721,7 +721,7 @@ void INI::parseAsciiStringVector( INI* ini, void * /*instance*/, void *store, co { std::vector* asv = (std::vector*)store; asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { asv->push_back(token); } @@ -734,7 +734,7 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto std::vector* asv = (std::vector*)store; // nope, don't clear. duh. // asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { asv->push_back(token); } @@ -746,7 +746,7 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto { ScienceVec* asv = (ScienceVec*)store; asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (stricmp(token, "None") == 0) { @@ -766,7 +766,7 @@ AsciiString INI::getNextQuotedAsciiString() buff[0] = '\0'; const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != NULL) + if (token != nullptr) { if (token[0] != '\"') { @@ -814,7 +814,7 @@ AsciiString INI::getNextAsciiString() AsciiString result; const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != NULL) + if (token != nullptr) { if (token[0] != '\"') { @@ -900,7 +900,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo else { - DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is NULL" )); + DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is null" )); throw INI_UNKNOWN_ERROR; } @@ -927,7 +927,7 @@ void INI::parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void INI::parseBitString8( INI* ini, void * /*instance*/, void *store, const void* userData ) { UnsignedInt tmp; - INI::parseBitString32(ini, NULL, &tmp, userData); + INI::parseBitString32(ini, nullptr, &tmp, userData); if (tmp & 0xffffff00) { DEBUG_CRASH(("Bad bitstring list INI::parseBitString8")); @@ -946,7 +946,7 @@ void INI::parseBitString32( INI* ini, void * /*instance*/, void *store, const vo ConstCharPtrArray flagList = (ConstCharPtrArray)userData; UnsignedInt *bits = (UnsignedInt *)store; - if( flagList == NULL || flagList[ 0 ] == NULL) + if( flagList == nullptr || flagList[ 0 ] == nullptr) { DEBUG_ASSERTCRASH( flagList, ("INTERNAL ERROR! parseBitString32: No flag list provided!") ); throw INI_INVALID_NAME_LIST; @@ -956,7 +956,7 @@ void INI::parseBitString32( INI* ini, void * /*instance*/, void *store, const vo Bool foundAddOrSub = false; // loop through all tokens - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (stricmp(token, "NONE") == 0) { @@ -1049,7 +1049,7 @@ void INI::parseRGBAColorInt( INI* ini, void * /*instance*/, void *store, const v for( Int i = 0; i < 4; i++ ) { const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == NULL) + if (token == nullptr) { if (i < 3) { @@ -1101,7 +1101,7 @@ void INI::parseColorInt( INI* ini, void * /*instance*/, void *store, const void* for( Int i = 0; i < 4; i++ ) { const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == NULL) + if (token == nullptr) { if (i < 3) { @@ -1189,11 +1189,11 @@ void INI::parseDynamicAudioEventRTS( INI *ini, void * /*instance*/, void *store, if (stricmp(token, "NoSound") == 0) { deleteInstance(*theSound); - *theSound = NULL; + *theSound = nullptr; } else { - if (*theSound == NULL) + if (*theSound == nullptr) *theSound = newInstance(DynamicAudioEventRTS); (*theSound)->m_event.setEventName(AsciiString(token)); } @@ -1237,7 +1237,7 @@ void INI::parseThingTemplate( INI* ini, void * /*instance*/, void *store, const if (stricmp(token, "None") == 0) { - *theThingTemplate = NULL; + *theThingTemplate = nullptr; } else { @@ -1261,7 +1261,7 @@ void INI::parseArmorTemplate( INI* ini, void * /*instance*/, void *store, const if (stricmp(token, "None") == 0) { - *theArmorTemplate = NULL; + *theArmorTemplate = nullptr; } else { @@ -1301,7 +1301,7 @@ void INI::parseFXList( INI* ini, void * /*instance*/, void *store, const void* / ConstFXListPtr* theFXList = (ConstFXListPtr*)store; const FXList *fxl = TheFXListStore->findFXList(token); // could be null! - DEBUG_ASSERTCRASH(fxl != NULL || stricmp(token, "None") == 0, ("FXList %s not found!",token)); + DEBUG_ASSERTCRASH(fxl != nullptr || stricmp(token, "None") == 0, ("FXList %s not found!",token)); // assign it, even if null! *theFXList = fxl; @@ -1336,7 +1336,7 @@ void INI::parseDamageFX( INI* ini, void * /*instance*/, void *store, const void* if (stricmp(token, "None") == 0) { - *theDamageFX = NULL; + *theDamageFX = nullptr; } else { @@ -1511,7 +1511,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList { Bool done = FALSE; - if( what == NULL ) + if( what == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INI::initFromINI - Invalid parameters supplied!") ); throw INI_INVALID_PARAMS; @@ -1539,7 +1539,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList for (int ptIdx = 0; ptIdx < parseTableList.getCount(); ++ptIdx) { int offset = 0; - const void* userData = 0; + const void* userData = nullptr; INIFieldParseProc parse = findFieldParse(parseTableList.getNthFieldParse(ptIdx), field, offset, userData); if (parse) { @@ -1593,7 +1593,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList /*static*/ const char* INI::getNextToken(const char* seps) { if (!seps) seps = getSeps(); - const char *token = ::strtok(NULL, seps); + const char *token = ::strtok(nullptr, seps); if (!token) throw INI_INVALID_DATA; return token; @@ -1603,7 +1603,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList /*static*/ const char* INI::getNextTokenOrNull(const char* seps) { if (!seps) seps = getSeps(); - const char *token = ::strtok(NULL, seps); + const char *token = ::strtok(nullptr, seps); return token; } @@ -1652,7 +1652,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList //------------------------------------------------------------------------------------------------- /*static*/ Int INI::scanIndexList(const char* token, ConstCharPtrArray nameList) { - if( nameList == NULL || nameList[ 0 ] == NULL ) + if( nameList == nullptr || nameList[ 0 ] == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanIndexList, invalid name list") ); @@ -1678,7 +1678,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList //------------------------------------------------------------------------------------------------- /*static*/ Int INI::scanLookupList(const char* token, ConstLookupListRecArray lookupList) { - if( lookupList == NULL || lookupList[ 0 ].name == NULL ) + if( lookupList == nullptr || lookupList[ 0 ].name == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanLookupList, invalid name list") ); throw INI_INVALID_NAME_LIST; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp index 0fd66a40454..ad333937b18 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIAnimation.cpp @@ -60,7 +60,7 @@ void INI::parseAnim2DDefinition( INI* ini ) // find existing animation template if present animTemplate = TheAnim2DCollection->findTemplate( name ); - if( animTemplate == NULL ) + if( animTemplate == nullptr ) { // item not found, create a new one diff --git a/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp index 9bff103b0dc..2f4eb32c5bc 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INICommandButton.cpp @@ -53,7 +53,7 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) // find existing item if present CommandButton *button = TheControlBar->findNonConstCommandButton( name ); - if( button == NULL ) + if( button == nullptr ) { // allocate a new item button = TheControlBar->newCommandButton( name ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp index 0d1f1a25097..5ca92f078fb 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp @@ -36,7 +36,7 @@ void parseInt( INI* ini, void * /*instance*/, void *store, const void* userData ) { DrawGroupInfo *dgi = (DrawGroupInfo*) store; - if (userData == 0) { + if (userData == nullptr) { store = &dgi->m_pixelOffsetX; dgi->m_usingPixelOffsetX = TRUE; } else { @@ -44,13 +44,13 @@ void parseInt( INI* ini, void * /*instance*/, void *store, const void* userData dgi->m_usingPixelOffsetY = TRUE; } - INI::parseInt(ini, NULL, store, NULL); + INI::parseInt(ini, nullptr, store, nullptr); } void parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* userData ) { DrawGroupInfo *dgi = (DrawGroupInfo*) store; - if (userData == 0) { + if (userData == nullptr) { store = &dgi->m_pixelOffsetX; dgi->m_usingPixelOffsetX = FALSE; } else { @@ -58,26 +58,26 @@ void parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* dgi->m_usingPixelOffsetY = FALSE; } - INI::parsePercentToReal(ini, NULL, store, NULL); + INI::parsePercentToReal(ini, nullptr, store, nullptr); } const FieldParse DrawGroupInfo::s_fieldParseTable[] = { - { "UsePlayerColor", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_usePlayerColor) }, - { "ColorForText", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForText ) }, - { "ColorForTextDropShadow", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForTextDropShadow ) }, + { "UsePlayerColor", INI::parseBool, nullptr, offsetof( DrawGroupInfo, m_usePlayerColor) }, + { "ColorForText", INI::parseColorInt, nullptr, offsetof( DrawGroupInfo, m_colorForText ) }, + { "ColorForTextDropShadow", INI::parseColorInt, nullptr, offsetof( DrawGroupInfo, m_colorForTextDropShadow ) }, - { "FontName", INI::parseQuotedAsciiString, NULL, offsetof( DrawGroupInfo, m_fontName ) }, - { "FontSize", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_fontSize ) }, - { "FontIsBold", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_fontIsBold ) }, - { "DropShadowOffsetX", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetX) }, - { "DropShadowOffsetY", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetY) }, - { "DrawPositionXPixel", parseInt, (void*)0, 0 }, - { "DrawPositionXPercent", parsePercentToReal, (void*)0, 0 }, + { "FontName", INI::parseQuotedAsciiString, nullptr, offsetof( DrawGroupInfo, m_fontName ) }, + { "FontSize", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_fontSize ) }, + { "FontIsBold", INI::parseBool, nullptr, offsetof( DrawGroupInfo, m_fontIsBold ) }, + { "DropShadowOffsetX", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_dropShadowOffsetX) }, + { "DropShadowOffsetY", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_dropShadowOffsetY) }, + { "DrawPositionXPixel", parseInt, (void*)nullptr, 0 }, + { "DrawPositionXPercent", parsePercentToReal, (void*)nullptr, 0 }, { "DrawPositionYPixel", parseInt, (void*)1, 0 }, { "DrawPositionYPercent", parsePercentToReal, (void*)1, 0 }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; /*static */ void INI::parseDrawGroupNumberDefinition(INI* ini) diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp index bf7f0220cba..ddaee904a37 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMapCache.cpp @@ -67,7 +67,7 @@ void parseSupplyPositionCoord3D( INI* ini, void * instance, void * /*store*/, co { MapMetaDataReader *mmdr = (MapMetaDataReader *)instance; Coord3D coord3d; - INI::parseCoord3D(ini, NULL, &coord3d,NULL ); + INI::parseCoord3D(ini, nullptr, &coord3d,nullptr ); mmdr->m_supplyPositions.push_front(coord3d); } @@ -76,7 +76,7 @@ void parseTechPositionsCoord3D( INI* ini, void * instance, void * /*store*/, con { MapMetaDataReader *mmdr = (MapMetaDataReader *)instance; Coord3D coord3d; - INI::parseCoord3D(ini, NULL, &coord3d,NULL ); + INI::parseCoord3D(ini, nullptr, &coord3d,nullptr ); mmdr->m_techPositions.push_front(coord3d); } @@ -84,33 +84,33 @@ void parseTechPositionsCoord3D( INI* ini, void * instance, void * /*store*/, con const FieldParse MapMetaDataReader::m_mapFieldParseTable[] = { - { "isOfficial", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isOfficial ) }, - { "isMultiplayer", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isMultiplayer ) }, - { "extentMin", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.lo ) }, - { "extentMax", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.hi ) }, - { "numPlayers", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_numPlayers ) }, - { "fileSize", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_filesize ) }, - { "fileCRC", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_CRC ) }, - { "timestampLo", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_lowTimeStamp ) }, - { "timestampHi", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_highTimeStamp ) }, - { "displayName", INI::parseAsciiString, NULL, offsetof( MapMetaDataReader, m_asciiDisplayName ) }, - { "nameLookupTag", INI::parseAsciiString, NULL, offsetof( MapMetaDataReader, m_asciiNameLookupTag ) }, - - { "supplyPosition", parseSupplyPositionCoord3D, NULL, NULL }, - { "techPosition", parseTechPositionsCoord3D, NULL, NULL }, - - { "Player_1_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) }, - { "Player_2_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 1 }, - { "Player_3_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 2 }, - { "Player_4_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 3 }, - { "Player_5_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 4 }, - { "Player_6_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 5 }, - { "Player_7_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 6 }, - { "Player_8_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 7 }, - - { "InitialCameraPosition", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, - - { NULL, NULL, NULL, 0 } + { "isOfficial", INI::parseBool, nullptr, offsetof( MapMetaDataReader, m_isOfficial ) }, + { "isMultiplayer", INI::parseBool, nullptr, offsetof( MapMetaDataReader, m_isMultiplayer ) }, + { "extentMin", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_extent.lo ) }, + { "extentMax", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_extent.hi ) }, + { "numPlayers", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_numPlayers ) }, + { "fileSize", INI::parseUnsignedInt, nullptr, offsetof( MapMetaDataReader, m_filesize ) }, + { "fileCRC", INI::parseUnsignedInt, nullptr, offsetof( MapMetaDataReader, m_CRC ) }, + { "timestampLo", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_timestamp.m_lowTimeStamp ) }, + { "timestampHi", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_timestamp.m_highTimeStamp ) }, + { "displayName", INI::parseAsciiString, nullptr, offsetof( MapMetaDataReader, m_asciiDisplayName ) }, + { "nameLookupTag", INI::parseAsciiString, nullptr, offsetof( MapMetaDataReader, m_asciiNameLookupTag ) }, + + { "supplyPosition", parseSupplyPositionCoord3D, nullptr, 0 }, + { "techPosition", parseTechPositionsCoord3D, nullptr, 0 }, + + { "Player_1_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) }, + { "Player_2_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 1 }, + { "Player_3_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 2 }, + { "Player_4_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 3 }, + { "Player_5_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 4 }, + { "Player_6_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 5 }, + { "Player_7_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 6 }, + { "Player_8_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 7 }, + + { "InitialCameraPosition", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, + + { nullptr, nullptr, nullptr, 0 } }; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index 8d044752ae2..21d5bbda299 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -59,7 +59,7 @@ void INI::parseMappedImageDefinition( INI* ini ) if(image) DEBUG_ASSERTCRASH(!image->getRawTextureData(), ("We are trying to parse over an existing image that contains a non-null rawTextureData, you should fix that")); - if( image == NULL ) + if( image == nullptr ) { // image not found, create a new one diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index ba62a15dbf6..66d50d48f06 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -69,7 +69,7 @@ void INI::parseMultiplayerColorDefinition( INI* ini ) // find existing item if present, but this type does not allow overrides, //so if it exists just overwrite it. multiplayerColorDefinition = TheMultiplayerSettings->findMultiplayerColorDefinitionByName( name ); - if( multiplayerColorDefinition == NULL ) + if( multiplayerColorDefinition == nullptr ) multiplayerColorDefinition = TheMultiplayerSettings->newMultiplayerColorDefinition( name ); ini->initFromINI( multiplayerColorDefinition, multiplayerColorDefinition->getFieldParse() ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp index a83d5467ee0..8e75daee046 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp @@ -46,7 +46,7 @@ void INI::parseParticleSystemDefinition( INI* ini ) // find existing item if present ParticleSystemTemplate *sysTemplate = const_cast(TheParticleSystemManager->findTemplate( name )); - if (sysTemplate == NULL) + if (sysTemplate == nullptr) { // no item is present, create a new one sysTemplate = TheParticleSystemManager->newTemplate( name ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp index 114adb3e3d5..1e4b0c1c945 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrain.cpp @@ -47,7 +47,7 @@ void INI::parseTerrainDefinition( INI* ini ) // find existing item if present terrainType = TheTerrainTypes->findTerrain( name ); - if( terrainType == NULL ) + if( terrainType == nullptr ) terrainType = TheTerrainTypes->newTerrain( name ); // sanity diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index 98694736ff9..8a10f8d35b1 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -59,7 +59,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) } - if( bridge == NULL ) + if( bridge == nullptr ) bridge = TheTerrainRoads->newBridge( name ); DEBUG_ASSERTCRASH( bridge, ("Unable to allcoate bridge '%s'", name.str()) ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp index c652ab51858..94cbd4779fc 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp @@ -59,7 +59,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) } - if( road == NULL ) + if( road == nullptr ) road = TheTerrainRoads->newRoad( name ); DEBUG_ASSERTCRASH( road, ("Unable to allocate road '%s'", name.str()) ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp index 5a231166fab..d6bdec167f1 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -49,7 +49,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) { AsciiString name; - WaterSetting *waterSetting = NULL; + WaterSetting *waterSetting = nullptr; // read the name const char* token = ini->getNextToken(); @@ -77,7 +77,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) } // check for no time of day match - if( waterSetting == NULL ) + if( waterSetting == nullptr ) throw INI_INVALID_DATA; // parse the data @@ -88,7 +88,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) //------------------------------------------------------------------------------------------------- void INI::parseWaterTransparencyDefinition( INI *ini ) { - if (TheWaterTransparency == NULL) { + if (TheWaterTransparency == nullptr) { TheWaterTransparency = newInstance(WaterTransparencySetting); } else if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { WaterTransparencySetting* wt = (WaterTransparencySetting*) (TheWaterTransparency.getNonOverloadedPointer()); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp index 441782733db..59388d9f854 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp @@ -84,11 +84,11 @@ void INI::parseWebpageURLDefinition( INI* ini ) const char* c = ini->getNextToken(); tag.set( c ); - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { url = TheWebBrowser->findURL(tag); - if (url == NULL) + if (url == nullptr) { url = TheWebBrowser->makeNewURL(tag); } @@ -96,7 +96,7 @@ void INI::parseWebpageURLDefinition( INI* ini ) // find existing item if present // track = TheAudio->Music->getTrack( name ); -// if( track == NULL ) +// if( track == nullptr ) // { // allocate a new track diff --git a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp index 0af149735ed..c11407a85ee 100644 --- a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp @@ -37,8 +37,8 @@ #include "GameLogic/GameLogic.h" /// The singleton message stream for messages going to TheGameLogic -MessageStream *TheMessageStream = NULL; -CommandList *TheCommandList = NULL; +MessageStream *TheMessageStream = nullptr; +CommandList *TheCommandList = nullptr; @@ -56,10 +56,10 @@ GameMessage::GameMessage( GameMessage::Type type ) { m_playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); m_type = type; - m_argList = NULL; - m_argTail = NULL; + m_argList = nullptr; + m_argTail = nullptr; m_argCount = 0; - m_list = 0; + m_list = nullptr; } @@ -111,7 +111,7 @@ GameMessageArgumentDataType GameMessage::getArgumentDataType( Int argIndex ) GameMessageArgument *a = m_argList; for (; a && (i < argIndex); a=a->m_next, ++i ); - if (a != NULL) + if (a != nullptr) { return a->m_type; } @@ -135,7 +135,7 @@ GameMessageArgument *GameMessage::allocArg( void ) m_argTail = arg; } - arg->m_next = NULL; + arg->m_next = nullptr; m_argTail = arg; m_argCount++; @@ -678,8 +678,8 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) */ GameMessageList::GameMessageList( void ) { - m_firstMessage = 0; - m_lastMessage = 0; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } /** @@ -694,7 +694,7 @@ GameMessageList::~GameMessageList() nextMsg = msg->next(); // set list ptr to null to avoid it trying to remove itself from the list // that we are in the process of nuking... - msg->friend_setList(NULL); + msg->friend_setList(nullptr); deleteInstance(msg); } } @@ -704,7 +704,7 @@ GameMessageList::~GameMessageList() */ void GameMessageList::appendMessage( GameMessage *msg ) { - msg->friend_setNext(NULL); + msg->friend_setNext(nullptr); if (m_lastMessage) { @@ -717,7 +717,7 @@ void GameMessageList::appendMessage( GameMessage *msg ) // first message m_firstMessage = msg; m_lastMessage = msg; - msg->friend_setPrev(NULL); + msg->friend_setPrev(nullptr); } // note containment within message itself @@ -763,7 +763,7 @@ void GameMessageList::removeMessage( GameMessage *msg ) else m_firstMessage = msg->next(); - msg->friend_setList(NULL); + msg->friend_setList(nullptr); } /** @@ -791,7 +791,7 @@ Bool GameMessageList::containsMessageOfType( GameMessage::Type type ) */ MessageStream::MessageStream( void ) { - m_firstTranslator = 0; + m_firstTranslator = nullptr; m_nextTranslatorID = 1; } @@ -858,7 +858,7 @@ GameMessage *MessageStream::appendMessage( GameMessage::Type type ) /** * Create a new message of the given message type and insert it - * in the stream after messageToInsertAfter, which must not be NULL. + * in the stream after messageToInsertAfter, which must not be nullptr. */ GameMessage *MessageStream::insertMessage( GameMessage::Type type, GameMessage *messageToInsertAfter ) { @@ -886,11 +886,11 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, newSS->m_priority = priority; newSS->m_id = m_nextTranslatorID++; - if (m_firstTranslator == NULL) + if (m_firstTranslator == nullptr) { // first Translator to be attached - newSS->m_prev = NULL; - newSS->m_next = NULL; + newSS->m_prev = nullptr; + newSS->m_next = nullptr; m_firstTranslator = newSS; m_lastTranslator = newSS; return newSS->m_id; @@ -915,7 +915,7 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, else { // insert at head of list - newSS->m_prev = NULL; + newSS->m_prev = nullptr; newSS->m_next = m_firstTranslator; m_firstTranslator->m_prev = newSS; m_firstTranslator = newSS; @@ -926,7 +926,7 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, // append Translator to end of list m_lastTranslator->m_next = newSS; newSS->m_prev = m_lastTranslator; - newSS->m_next = NULL; + newSS->m_next = nullptr; m_lastTranslator = newSS; } @@ -948,7 +948,7 @@ GameMessageTranslator* MessageStream::findTranslator( TranslatorID id ) } - return NULL; + return nullptr; } @@ -1098,8 +1098,8 @@ void MessageStream::propagateMessages( void ) TheCommandList->appendMessageList( m_firstMessage ); // clear the stream - m_firstMessage = NULL; - m_lastMessage = NULL; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } @@ -1173,8 +1173,8 @@ void CommandList::destroyAllMessages( void ) deleteInstance(msg); } - m_firstMessage = NULL; - m_lastMessage = NULL; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } diff --git a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp index aba90df6968..cb1fed45d37 100644 --- a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp @@ -35,7 +35,7 @@ LogClass::LogClass(const char *fname) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; diff --git a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index f9ec094415b..41586135a21 100644 --- a/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -38,7 +38,7 @@ #include "GameNetwork/GameInfo.h" // for PLAYERTEMPLATE_* // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -MultiplayerSettings *TheMultiplayerSettings = NULL; ///< The MultiplayerSettings singleton +MultiplayerSettings *TheMultiplayerSettings = nullptr; ///< The MultiplayerSettings singleton /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -46,26 +46,26 @@ MultiplayerSettings *TheMultiplayerSettings = NULL; ///< The MultiplayerSetti const FieldParse MultiplayerColorDefinition::m_colorFieldParseTable[] = { - { "TooltipName", INI::parseAsciiString, NULL, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, - { "RGBColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, - { "RGBNightColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, - { NULL, NULL, NULL, 0 } + { "TooltipName", INI::parseAsciiString, nullptr, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, + { "RGBColor", INI::parseRGBColor, nullptr, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, + { "RGBNightColor", INI::parseRGBColor, nullptr, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, + { nullptr, nullptr, nullptr, 0 } }; const FieldParse MultiplayerSettings::m_multiplayerSettingsFieldParseTable[] = { - { "InitialCreditsMin", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_initialCreditsMin ) }, - { "InitialCreditsMax", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_initialCreditsMax ) }, - { "StartCountdownTimer", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_startCountdownTimerSeconds ) }, - { "MaxBeaconsPerPlayer", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_maxBeaconsPerPlayer ) }, - { "UseShroud", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_isShroudInMultiplayer ) }, - { "ShowRandomPlayerTemplate", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomPlayerTemplate ) }, - { "ShowRandomStartPos", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, - { "ShowRandomColor", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomColor ) }, + { "InitialCreditsMin", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_initialCreditsMin ) }, + { "InitialCreditsMax", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_initialCreditsMax ) }, + { "StartCountdownTimer", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_startCountdownTimerSeconds ) }, + { "MaxBeaconsPerPlayer", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_maxBeaconsPerPlayer ) }, + { "UseShroud", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_isShroudInMultiplayer ) }, + { "ShowRandomPlayerTemplate", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomPlayerTemplate ) }, + { "ShowRandomStartPos", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, + { "ShowRandomColor", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomColor ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -107,7 +107,7 @@ MultiplayerColorDefinition * MultiplayerSettings::getColor(Int which) } else if (which < 0 || which >= getNumColors()) { - return NULL; + return nullptr; } return &m_colorList[which]; @@ -125,7 +125,7 @@ MultiplayerColorDefinition * MultiplayerSettings::findMultiplayerColorDefinition ++iter; } - return NULL; + return nullptr; } MultiplayerColorDefinition * MultiplayerSettings::newMultiplayerColorDefinition(AsciiString name) diff --git a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index f1efaf1b04b..a1081e6c2a7 100644 --- a/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/Generals/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -31,7 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine // Public Data //////////////////////////////////////////////////////////////////////////////////// -NameKeyGenerator *TheNameKeyGenerator = NULL; ///< name key gen. singleton +NameKeyGenerator *TheNameKeyGenerator = nullptr; ///< name key gen. singleton //------------------------------------------------------------------------------------------------- NameKeyGenerator::NameKeyGenerator() @@ -40,7 +40,7 @@ NameKeyGenerator::NameKeyGenerator() m_nextID = (UnsignedInt)NAMEKEY_INVALID; // uninitialized system for (Int i = 0; i < SOCKET_COUNT; ++i) - m_sockets[i] = NULL; + m_sockets[i] = nullptr; } @@ -83,7 +83,7 @@ void NameKeyGenerator::freeSockets() next = b->m_nextInSocket; deleteInstance(b); } - m_sockets[i] = NULL; + m_sockets[i] = nullptr; } } diff --git a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp index 1505f846194..48a39364d19 100644 --- a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -172,7 +172,7 @@ class PerfMetricsOutput //------------------------------------------------------------------------------------------------- static PerfMetricsOutput s_output; -static FILE* s_perfStatsFile = NULL; +static FILE* s_perfStatsFile = nullptr; static Int s_perfDumpOptions = 0; static UnsignedInt s_lastDumpedFrame = 0; static char s_buf[256] = ""; @@ -190,7 +190,7 @@ Int64 PerfGather::s_stopStartOverhead = -1; /*static*/ PerfGather*& PerfGather::getHeadPtr() { // funky technique for order-of-init problem. trust me. (srj) - static PerfGather* s_head = NULL; + static PerfGather* s_head = nullptr; return s_head; } @@ -233,7 +233,7 @@ PerfGather::PerfGather(const char *identifier) : m_prev(0) { m_ignore = FALSE; - DEBUG_ASSERTCRASH(strchr(m_identifier, ',') == NULL, ("PerfGather names must not contain commas")); + DEBUG_ASSERTCRASH(strchr(m_identifier, ',') == nullptr, ("PerfGather names must not contain commas")); addToList(); } @@ -255,7 +255,7 @@ void PerfGather::reset() //------------------------------------------------------------------------------------------------- /*static*/ void PerfGather::resetAll() { - for (PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { head->reset(); } @@ -276,7 +276,7 @@ void PerfGather::reset() s_perfStatsFile = fopen(tmp, "w"); s_perfDumpOptions = options; - if (s_perfStatsFile == NULL) + if (s_perfStatsFile == nullptr) { DEBUG_CRASH(("could not open/create perf file %s -- is it open in another app?",s_buf)); return; @@ -332,21 +332,21 @@ void PerfGather::reset() fprintf(s_perfStatsFile, "Frame"); if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Gross:%s", head->m_identifier); } } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Net:%s", head->m_identifier); } } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Count:%s", head->m_identifier); } @@ -363,7 +363,7 @@ void PerfGather::reset() fprintf(s_perfStatsFile, "Frame%08d", frame); if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { double t = head->m_runningTimeGross; t /= s_ticksPerUSec; @@ -374,7 +374,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { double t = head->m_runningTimeNet; t /= s_ticksPerUSec; @@ -385,7 +385,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",%d", head->m_callCount); } @@ -419,7 +419,7 @@ void PerfGather::reset() if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_runningTimeGross; t /= s_ticksPerUSec; @@ -431,7 +431,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_runningTimeNet; t /= s_ticksPerUSec; @@ -443,7 +443,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_callCount; TheGraphDraw->addEntry(head->m_identifier, REAL_TO_INT(t)); @@ -460,7 +460,7 @@ void PerfGather::reset() { fflush(s_perfStatsFile); fclose(s_perfStatsFile); - s_perfStatsFile = NULL; + s_perfStatsFile = nullptr; } s_lastDumpedFrame = 0; } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 71465d73471..a981c07b811 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -66,7 +66,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -ActionManager *TheActionManager = NULL; +ActionManager *TheActionManager = nullptr; // LOCAL ////////////////////////////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ Bool ActionManager::canGetRepairedAt( const Object *obj, const Object *repairDes { // sanity - if( obj == NULL || repairDest == NULL ) + if( obj == nullptr || repairDest == nullptr ) return FALSE; Relationship r = obj->getRelationship(repairDest); @@ -203,7 +203,7 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran { // sanity - if( obj == NULL || transferDest == NULL ) + if( obj == nullptr || transferDest == nullptr ) return FALSE; if( transferDest->isEffectivelyDead() ) @@ -222,11 +222,11 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran // I must be something with a Supply Transfering AI interface const AIUpdateInterface *ai= obj->getAI(); - if( ai == NULL ) + if( ai == nullptr ) return FALSE; const SupplyTruckAIInterface* supplyTruck = ai->getSupplyTruckAIInterface(); - if( supplyTruck == NULL ) + if( supplyTruck == nullptr ) return FALSE; // If it is a warehouse, it must have boxes left and not be an enemy @@ -245,7 +245,7 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran return FALSE; // if he is not a warehouse or a center, then shut the hell up - if( (warehouseModule == NULL) && (centerModule == NULL) ) + if( (warehouseModule == nullptr) && (centerModule == nullptr) ) return FALSE; // We do not check ClearToApproach, as it is a temporary failure that is handled @@ -282,13 +282,13 @@ Bool ActionManager::canDockAt( const Object *obj, const Object *dockDest, Comman { // look for a dock interface - DockUpdateInterface *di = NULL; + DockUpdateInterface *di = nullptr; for (BehaviorModule **u = dockDest->getBehaviorModules(); *u; ++u) { - if ((di = (*u)->getDockUpdateInterface()) != NULL) + if ((di = (*u)->getDockUpdateInterface()) != nullptr) break; } - if( di == NULL ) + if( di == nullptr ) return FALSE; // no dock update interface, can't possibly dock /* @@ -323,7 +323,7 @@ Bool ActionManager::canGetHealedAt( const Object *obj, const Object *healDest, C { // sanity - if( obj == NULL || healDest == NULL ) + if( obj == nullptr || healDest == nullptr ) return FALSE; Relationship r = obj->getRelationship(healDest); @@ -375,7 +375,7 @@ Bool ActionManager::canRepairObject( const Object *obj, const Object *objectToRe { // sanity - if( obj == NULL || objectToRepair == NULL ) + if( obj == nullptr || objectToRepair == nullptr ) return FALSE; Relationship r = obj->getRelationship(objectToRepair); @@ -447,7 +447,7 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, { // sanity - if( obj == NULL || objectBeingConstructed == NULL ) + if( obj == nullptr || objectBeingConstructed == nullptr ) return FALSE; // only dozers or workers can resume construction of things @@ -516,7 +516,7 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt { // sanity - if( obj == NULL || objectToEnter == NULL ) + if( obj == nullptr || objectToEnter == nullptr ) return FALSE; if( obj == objectToEnter ) @@ -577,7 +577,7 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt for (BehaviorModule** i = objectToEnter->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp == NULL) + if (pp == nullptr) continue; if (pp->hasReservedSpace(obj->getID())) @@ -757,7 +757,7 @@ Bool ActionManager::canConvertObjectToCarBomb( const Object *obj, const Object * { // sanity - if( obj == NULL || objectToConvert == NULL ) + if( obj == nullptr || objectToConvert == nullptr ) { return FALSE; } @@ -795,7 +795,7 @@ Bool ActionManager::canHijackVehicle( const Object *obj, const Object *objectToH ++foo; // sanity - if( obj == NULL || objectToHijack == NULL ) + if( obj == nullptr || objectToHijack == nullptr ) { return FALSE; } @@ -866,7 +866,7 @@ Bool ActionManager::canHijackVehicle( const Object *obj, const Object *objectToH Bool ActionManager::canMakeObjectDefector( const Object *obj, const Object *objectToMakeDefector, CommandSourceType commandSource ) //LORENZEN { // sanity - if( obj == NULL || objectToMakeDefector == NULL ) + if( obj == nullptr || objectToMakeDefector == nullptr ) { return FALSE; } @@ -902,7 +902,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT { // sanity - if( obj == NULL || objectToCapture == NULL ) + if( obj == nullptr || objectToCapture == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -983,7 +983,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT // if it's garrisoned already, we cannot capture it. // (unless it's just stealth-garrisoned.) ContainModuleInterface *contain = objectToCapture->getContain(); - if (contain != NULL && contain->isGarrisonable()) + if (contain != nullptr && contain->isGarrisonable()) { Int containCount = contain->getContainCount(); Int stealthContainCount = contain->getStealthUnitsContained(); @@ -1005,7 +1005,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT Bool ActionManager::canDisableVehicleViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource, Bool checkSourceRequirements) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; if (checkSourceRequirements) @@ -1087,7 +1087,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner { // sanity - if( obj == NULL || prisoner == NULL ) + if( obj == nullptr || prisoner == nullptr ) return FALSE; // only pow trucks can pick up anything @@ -1104,14 +1104,14 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner // prisoner must be in a surrendered state const AIUpdateInterface *ai = prisoner->getAI(); - if( ai == NULL || ai->isSurrendered() == FALSE ) + if( ai == nullptr || ai->isSurrendered() == FALSE ) return FALSE; // prisoner must have been put in a surrendered state by our own player // (or be surrendered to "everyone") Int idx = ai->getSurrenderedPlayerIndex(); - Player* surrenderedToPlayer = (idx >= 0) ? ThePlayerList->getNthPlayer(idx) : NULL; - if (surrenderedToPlayer != NULL && surrenderedToPlayer != obj->getControllingPlayer()) + Player* surrenderedToPlayer = (idx >= 0) ? ThePlayerList->getNthPlayer(idx) : nullptr; + if (surrenderedToPlayer != nullptr && surrenderedToPlayer != obj->getControllingPlayer()) return FALSE; // we must be enemies @@ -1128,7 +1128,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner Bool ActionManager::canStealCashViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource ) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -1213,7 +1213,7 @@ Bool ActionManager::canStealCashViaHacking( const Object *obj, const Object *obj Bool ActionManager::canDisableBuildingViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource ) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -1295,7 +1295,7 @@ Bool ActionManager::canCutBuildingPower( const Object *obj, const Object *buildi Bool ActionManager::canSnipeVehicle( const Object *obj, const Object *objectToSnipe, CommandSourceType commandSource ) { //Sanity check - if( obj == NULL || objectToSnipe == NULL ) + if( obj == nullptr || objectToSnipe == nullptr ) { return FALSE; } @@ -1717,7 +1717,7 @@ Bool ActionManager::canDoSpecialPower( const Object *obj, const SpecialPowerTemp Bool ActionManager::canFireWeaponAtLocation( const Object *obj, const Coord3D *loc, CommandSourceType commandSource, const WeaponSlotType slot, const Object *objectInWay ) { //Sanity check - if( obj == NULL || loc == NULL ) + if( obj == nullptr || loc == nullptr ) { return false; } @@ -1736,7 +1736,7 @@ Bool ActionManager::canFireWeaponAtLocation( const Object *obj, const Coord3D *l Bool ActionManager::canFireWeaponAtObject( const Object *obj, const Object *target, CommandSourceType commandSource, const WeaponSlotType slot ) { //Sanity check - if( obj == NULL || target == NULL ) + if( obj == nullptr || target == nullptr ) { return false; } @@ -1766,7 +1766,7 @@ Bool ActionManager::canFireWeaponAtObject( const Object *obj, const Object *targ Bool ActionManager::canFireWeapon( const Object *obj, const WeaponSlotType slot, CommandSourceType commandSource ) { //Sanity check - if( obj == NULL ) + if( obj == nullptr ) { return false; } @@ -1800,7 +1800,7 @@ Bool ActionManager::canGarrison( const Object *obj, const Object *target, Comman return false; ContainModuleInterface *cmi = target->getContain(); - if (cmi == NULL) + if (cmi == nullptr) return false; if (cmi->isGarrisonable() == false) @@ -1834,7 +1834,7 @@ Bool ActionManager::canPlayerGarrison( const Player *player, const Object *targe return false; ContainModuleInterface *cmi = target->getContain(); - if (cmi == NULL) + if (cmi == nullptr) return false; if (cmi->isGarrisonable() == false) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp index f321b4b463d..ddfa29ee0f5 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Energy.cpp @@ -57,7 +57,7 @@ Energy::Energy() { m_energyProduction = 0; m_energyConsumption = 0; - m_owner = NULL; + m_owner = nullptr; } //----------------------------------------------------------------------------- @@ -113,7 +113,7 @@ void Energy::objectEnteringInfluence( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // get the amount of energy this object produces or consumes @@ -139,7 +139,7 @@ void Energy::objectLeavingInfluence( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // get the amount of energy this object produces or consumes @@ -166,7 +166,7 @@ void Energy::addPowerBonus( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; addProduction(obj->getTemplate()->getEnergyBonus()); @@ -185,7 +185,7 @@ void Energy::removePowerBonus( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // TheSuperHackers @bugfix Caball009 14/11/2025 Don't remove power bonus for disabled power plants. @@ -211,7 +211,7 @@ void Energy::addProduction(Int amt) { m_energyProduction += amt; - if( m_owner == NULL ) + if( m_owner == nullptr ) return; // A repeated Brownout signal does nothing bad, and we need to handle more than just edge cases. @@ -224,7 +224,7 @@ void Energy::addConsumption(Int amt) { m_energyConsumption += amt; - if( m_owner == NULL ) + if( m_owner == nullptr ) return; m_owner->onPowerBrownOutChange( !hasSufficientPower() ); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp index ee9932cb9cd..3e26f70e5f9 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -58,7 +58,7 @@ UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound) { #if defined(RTS_DEBUG) Player* player = ThePlayerList->getNthPlayer(m_playerIndex); - if (player != NULL && player->buildsForFree()) + if (player != nullptr && player->buildsForFree()) return 0; #endif diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 6fe1d4fca44..fb8a1c28111 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -127,8 +127,8 @@ ClosestKindOfData::ClosestKindOfData( void ) { m_setKindOf.clear(); m_clearKindOf.clear(); - m_source = NULL; - m_closest = NULL; + m_source = nullptr; + m_closest = nullptr; m_closestDistSq = FLT_MAX; } @@ -305,36 +305,36 @@ Player::Player( Int playerIndex ) m_playerRelations = newInstance(PlayerRelationMap); m_teamRelations = newInstance(TeamRelationMap); - m_upgradeList = NULL; - m_pBuildList = NULL; - m_ai = NULL; - m_resourceGatheringManager = NULL; - m_defaultTeam = NULL; + m_upgradeList = nullptr; + m_pBuildList = nullptr; + m_ai = nullptr; + m_resourceGatheringManager = nullptr; + m_defaultTeam = nullptr; m_radarCount = 0; m_disableProofRadarCount = 0; m_radarDisabled = FALSE; m_bombardBattlePlans = 0; m_holdTheLineBattlePlans = 0; m_searchAndDestroyBattlePlans = 0; - m_tunnelSystem = NULL; - m_playerTemplate = NULL; + m_tunnelSystem = nullptr; + m_playerTemplate = nullptr; m_visionSpiedMask = PLAYERMASK_NONE; - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; m_skillPointsModifier = 1.0f; m_canBuildUnits = TRUE; m_canBuildBase = TRUE; m_cashBountyPercent = 0.0f; m_color = 0; - m_currentSelection = NULL; + m_currentSelection = nullptr; m_rankLevel = 0; m_sciencePurchasePoints = 0; - m_side = 0; + m_side = nullptr; m_skillPoints = 0; Int i; - m_upgradeList = NULL; + m_upgradeList = nullptr; for(i = 0; i < NUM_HOTKEY_SQUADS; i++) { - m_squads[i] = NULL; + m_squads[i] = nullptr; } for (i = 0; i < MAX_PLAYER_COUNT; ++i) { @@ -344,7 +344,7 @@ Player::Player( Int playerIndex ) m_attackedFrame = 0; m_unitsShouldHunt = FALSE; - init( NULL ); + init( nullptr ); } @@ -368,7 +368,7 @@ void Player::init(const PlayerTemplate* pt) m_searchAndDestroyBattlePlans = 0; deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; deleteUpgradeList(); @@ -376,15 +376,15 @@ void Player::init(const PlayerTemplate* pt) m_stats.init(); deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; - m_defaultTeam = NULL; + m_defaultTeam = nullptr; deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; + m_resourceGatheringManager = nullptr; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { deleteInstance(m_squads[i]); @@ -395,7 +395,7 @@ void Player::init(const PlayerTemplate* pt) m_currentSelection = newInstance(Squad); deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; + m_tunnelSystem = nullptr; m_canBuildBase = true; m_canBuildUnits = true; @@ -491,33 +491,33 @@ void Player::init(const PlayerTemplate* pt) //============================================================================= Player::~Player() { - m_defaultTeam = NULL; - m_playerTemplate = NULL; + m_defaultTeam = nullptr; + m_playerTemplate = nullptr; for( PlayerTeamList::iterator it = m_playerTeamPrototypes.begin(); it != m_playerTeamPrototypes.end(); ++it) { - (*it)->friend_setOwningPlayer(NULL); + (*it)->friend_setOwningPlayer(nullptr); } m_playerTeamPrototypes.clear(); // empty, but don't free the contents // delete the relation maps (the destructor clears the actual map if any data is present) deleteInstance(m_teamRelations); - m_teamRelations = NULL; + m_teamRelations = nullptr; deleteInstance(m_playerRelations); - m_playerRelations = NULL; + m_playerRelations = nullptr; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { deleteInstance(m_squads[i]); - m_squads[i] = NULL; + m_squads[i] = nullptr; } deleteInstance(m_currentSelection); - m_currentSelection = NULL; + m_currentSelection = nullptr; deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; } //============================================================================= @@ -541,7 +541,7 @@ Relationship Player::getRelationship(const Team *that) const if (!m_playerRelations->m_map.empty()) { const Player* thatPlayer = that->getControllingPlayer(); - if (thatPlayer != NULL) + if (thatPlayer != nullptr) { PlayerRelationMapType::const_iterator it = m_playerRelations->m_map.find(thatPlayer->getPlayerIndex()); if (it != m_playerRelations->m_map.end()) @@ -557,7 +557,7 @@ Relationship Player::getRelationship(const Team *that) const //============================================================================= void Player::setPlayerRelationship(const Player *that, Relationship r) { - if (that != NULL) + if (that != nullptr) { // note that this creates the entry if it doesn't exist. m_playerRelations->m_map[that->getPlayerIndex()] = r; @@ -569,7 +569,7 @@ Bool Player::removePlayerRelationship(const Player *that) { if (!m_playerRelations->m_map.empty()) { - if (that == NULL) + if (that == nullptr) { m_playerRelations->m_map.clear(); return true; @@ -590,7 +590,7 @@ Bool Player::removePlayerRelationship(const Player *that) //============================================================================= void Player::setTeamRelationship(const Team *that, Relationship r) { - if (that != NULL) + if (that != nullptr) { // note that this creates the entry if it doesn't exist. m_teamRelations->m_map[that->getID()] = r; @@ -602,7 +602,7 @@ Bool Player::removeTeamRelationship(const Team *that) { if (!m_teamRelations->m_map.empty()) { - if (that == NULL) + if (that == nullptr) { m_teamRelations->m_map.clear(); return true; @@ -698,7 +698,7 @@ void Player::setPlayerType(PlayerType t, Bool skirmish) m_playerType = t; deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; if (t == PLAYER_COMPUTER) { @@ -731,7 +731,7 @@ void Player::setDefaultTeam(void) { void Player::deletePlayerAI() { deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; } //============================================================================= @@ -741,7 +741,7 @@ void Player::initFromDict(const Dict* d) { AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); - DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); + DEBUG_ASSERTCRASH(pt != nullptr, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); init(pt); @@ -810,7 +810,7 @@ void Player::initFromDict(const Dict* d) TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); deleteInstance(TheSidesList->getSkirmishSideInfo(i)->getScriptList()); - TheSidesList->getSkirmishSideInfo(i)->setScriptList(NULL); + TheSidesList->getSkirmishSideInfo(i)->setScriptList(nullptr); } } @@ -989,7 +989,7 @@ void Player::becomingTeamMember(Object *obj, Bool yes) { NameKeyType key_AutoDepositUpdate = NAMEKEY("AutoDepositUpdate"); AutoDepositUpdate *adu = (AutoDepositUpdate *)obj->findUpdateModule(key_AutoDepositUpdate); - if (adu != NULL) { + if (adu != nullptr) { adu->awardInitialCaptureBonus( this ); } } @@ -1118,11 +1118,11 @@ void Player::computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D } //------------------------------------------------------------------------------------------------- -/** Get this player's current enemy. NOTE - Can be NULL. */ +/** Get this player's current enemy. NOTE - Can be nullptr. */ //------------------------------------------------------------------------------------------------- Player *Player::getCurrentEnemy( void ) { - return m_ai?m_ai->getAiEnemy():NULL; + return m_ai?m_ai->getAiEnemy():nullptr; } //------------------------------------------------------------------------------------------------- @@ -1144,7 +1144,7 @@ Player *Player::getCurrentEnemy( void ) FCCInfo* info = (FCCInfo*)userData; - if (info->cmdCenter == NULL + if (info->cmdCenter == nullptr && obj->isKindOf(KINDOF_COMMANDCENTER) && obj->getTemplate()->getDefaultOwningSide() == info->player->getSide() && !obj->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION) @@ -1158,7 +1158,7 @@ Object* Player::findNaturalCommandCenter() { FCCInfo info; info.player = this; - info.cmdCenter = NULL; + info.cmdCenter = nullptr; iterateObjects(doFindCommandCenter, &info); return info.cmdCenter; } @@ -1273,7 +1273,7 @@ void Player::preTeamDestroy( const Team *team ) // TheSuperHackers @bugfix Mauller/Xezon 03/05/2025 Clear the default team to prevent dangling pointer usage if( m_defaultTeam == team ) - m_defaultTeam = NULL; + m_defaultTeam = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1429,8 +1429,8 @@ Int Player::countObjects(KindOfMaskType setMask, KindOfMaskType clearMask) //============================================================================= Object *Player::findClosestByKindOf( Object *queryObject, KindOfMaskType setMask, KindOfMaskType clearMask ) { - if( queryObject == NULL ) - return NULL; + if( queryObject == nullptr ) + return nullptr; ClosestKindOfData data; data.m_setKindOf = setMask; @@ -1759,7 +1759,7 @@ void Player::transferAssetsFromThat(Player *that) for (DLINK_ITERATOR iterObj = team->iterate_TeamMemberList(); !iterObj.done(); iterObj.advance()) { Object *obj = iterObj.cur(); - if (!obj || obj->getTemplate()->isEquivalentTo(beaconTemplate)) // don't transfer NULL objs or beacons + if (!obj || obj->getTemplate()->isEquivalentTo(beaconTemplate)) // don't transfer nullptr objs or beacons { continue; } @@ -1782,7 +1782,7 @@ void Player::transferAssetsFromThat(Player *that) void Player::garrisonAllUnits(CommandSourceType source) { PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; Coord3D pos = {50.0, 50.0, 50.0}; /// @todo srj -- we should really use iterateAllObjects() here instead, but I have no time to @@ -2181,7 +2181,7 @@ void Player::addSciencePurchasePoints(Int delta) if (m_sciencePurchasePoints < 0) m_sciencePurchasePoints = 0; - if (oldSPP != m_sciencePurchasePoints && TheControlBar != NULL) + if (oldSPP != m_sciencePurchasePoints && TheControlBar != nullptr) TheControlBar->onPlayerSciencePurchasePointsChanged(this); } @@ -2318,7 +2318,7 @@ Bool Player::setRankLevel(Int newLevel) DEBUG_ASSERTCRASH(m_skillPoints >= m_levelDown && m_skillPoints < m_levelUp, ("hmm, wrong")); //DEBUG_LOG(("Rank %d, Skill %d, down %d, up %d",m_rankLevel,m_skillPoints, m_levelDown, m_levelUp)); - if (TheControlBar != NULL) + if (TheControlBar != nullptr) { if( m_levelUp ) { @@ -2506,7 +2506,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) if( upgrade->getTemplate() == upgradeTemplate ) return upgrade; - return NULL; + return nullptr; } @@ -2546,14 +2546,14 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat Upgrade *u = findUpgrade( upgradeTemplate ); // if no upgrade instance found, make a new one - if( u == NULL ) + if( u == nullptr ) { // make new one u = newInstance(Upgrade)( upgradeTemplate ); // tie to list - u->friend_setPrev( NULL ); + u->friend_setPrev( nullptr ); u->friend_setNext( m_upgradeList ); if( m_upgradeList ) m_upgradeList->friend_setPrev( u ); @@ -2593,14 +2593,14 @@ void Player::onUpgradeCompleted( const UpgradeTemplate *upgradeTemplate ) for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { Team *team = iter.cur(); - if( team == NULL ) + if( team == nullptr ) { continue; } for (DLINK_ITERATOR iterObj = team->iterate_TeamMemberList(); !iterObj.done(); iterObj.advance()) { Object *obj = iterObj.cur(); - if( obj == NULL ) + if( obj == nullptr ) { continue; } @@ -2919,7 +2919,7 @@ Bool Player::doesObjectQualifyForBattlePlan( Object *obj ) const // note, bonus is an in-out parm. void Player::changeBattlePlan( BattlePlanStatus plan, Int delta, BattlePlanBonuses *bonus ) { - DUMPBATTLEPLANBONUSES(bonus, this, NULL); + DUMPBATTLEPLANBONUSES(bonus, this, nullptr); Bool addBonus = false; Bool removeBonus = false; switch( plan ) @@ -3121,7 +3121,7 @@ void Player::removeBattlePlanBonusesForObject( Object *obj ) const //------------------------------------------------------------------------------------------------- void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bonus ) { - DUMPBATTLEPLANBONUSES(bonus, this, NULL); + DUMPBATTLEPLANBONUSES(bonus, this, nullptr); //Only allocate the battle plan bonuses if we actually use it! if( !m_battlePlanBonuses ) @@ -3133,7 +3133,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo else { DEBUG_LOG(("Adding bonus into existing m_battlePlanBonuses")); - DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); //Just apply the differences by multiplying the scalars together (kindofs won't change) //These bonuses are used for new objects that are created or objects that are transferred //to our team. @@ -3147,7 +3147,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo m_battlePlanBonuses->m_searchAndDestroy = MAX( 0, m_battlePlanBonuses->m_searchAndDestroy ); } - DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); iterateObjects( localApplyBattlePlanBonusesToObject, (void*)bonus ); } @@ -3169,7 +3169,7 @@ void Player::processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg) for (UnsignedByte i = 0; i < numArgs; ++i) { ObjectID objID = msg->getArgument(i)->objectID; Object *obj = TheGameLogic->findObjectByID(objID); - if (obj != NULL) { + if (obj != nullptr) { // first, remove it from any other hotkey squads it is in. removeObjectFromHotkeySquad(obj); m_squads[hotkeyNum]->addObject(obj); @@ -3186,7 +3186,7 @@ void Player::processSelectTeamGameMessage(Int hotkeyNum, GameMessage *msg) { return; } - if (m_squads[hotkeyNum] == NULL) { + if (m_squads[hotkeyNum] == nullptr) { return; } @@ -3209,11 +3209,11 @@ void Player::processAddTeamGameMessage(Int hotkeyNum, GameMessage *msg) { return; } - if (m_squads[hotkeyNum] == NULL) { + if (m_squads[hotkeyNum] == nullptr) { return; } - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } @@ -3229,7 +3229,7 @@ void Player::processAddTeamGameMessage(Int hotkeyNum, GameMessage *msg) { /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::getCurrentSelectionAsAIGroup(AIGroup *group) { - if (m_currentSelection != NULL) { + if (m_currentSelection != nullptr) { m_currentSelection->aiGroupFromSquad(group); } } @@ -3238,13 +3238,13 @@ void Player::getCurrentSelectionAsAIGroup(AIGroup *group) { /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::setCurrentlySelectedAIGroup(AIGroup *group) { - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } m_currentSelection->clearSquad(); - if (group != NULL) { + if (group != nullptr) { m_currentSelection->squadFromAIGroup(group, true); } } @@ -3257,7 +3257,7 @@ Squad *Player::getHotkeySquad(Int squadNumber) if ((squadNumber >= 0) && (squadNumber < NUM_HOTKEY_SQUADS)) { return m_squads[squadNumber]; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -3293,11 +3293,11 @@ void Player::removeObjectFromHotkeySquad(Object *objToRemove) /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::addAIGroupToCurrentSelection(AIGroup *group) { - if (group == NULL) { + if (group == nullptr) { return; } - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } @@ -3439,7 +3439,7 @@ void Player::setUnitsVisionSpied( Bool setting, PlayerIndex byWhom ) m_visionSpiedMask = workingMask; - iterateObjects( callHandleShroud, NULL ); + iterateObjects( callHandleShroud, nullptr ); } } @@ -3481,12 +3481,12 @@ Bool Player::isPlayableSide( void ) const void Player::crc( Xfer *xfer ) { // Player battle plan bonuses - Bool battlePlanBonus = m_battlePlanBonuses != NULL; + Bool battlePlanBonus = m_battlePlanBonuses != nullptr; xfer->xferBool( &battlePlanBonus ); CRCDEBUG_LOG(("Player %d[%ls] %s battle plans", m_playerIndex, m_playerDisplayName.str(), (battlePlanBonus)?"has":"doesn't have")); if( m_battlePlanBonuses ) { - CRCDUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + CRCDUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); xfer->xferReal( &m_battlePlanBonuses->m_armorScalar ); xfer->xferReal( &m_battlePlanBonuses->m_sightRangeScalar ); xfer->xferInt( &m_battlePlanBonuses->m_bombardment ); @@ -3579,7 +3579,7 @@ void Player::xfer( Xfer *xfer ) upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); // sanity - if( upgradeTemplate == NULL ) + if( upgradeTemplate == nullptr ) { DEBUG_CRASH(( "Player::xfer - Unable to find upgrade '%s'", upgradeName.str() )); @@ -3651,7 +3651,7 @@ void Player::xfer( Xfer *xfer ) prototype = TheTeamFactory->findTeamPrototypeByID( prototypeID ); // sanity - if( prototype == NULL ) + if( prototype == nullptr ) { DEBUG_CRASH(( "Player::xfer - Unable to find team prototype by id" )); @@ -3688,7 +3688,7 @@ void Player::xfer( Xfer *xfer ) // the head of these structures automatically deletes any links attached // deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; // read each build list info for( UnsignedShort i = 0; i < buildListInfoCount; ++i ) @@ -3696,16 +3696,16 @@ void Player::xfer( Xfer *xfer ) // allocate new build list buildListInfo = newInstance( BuildListInfo ); - buildListInfo->setNextBuildList( NULL ); + buildListInfo->setNextBuildList( nullptr ); // attach to the *end* of the list in the player - if( m_pBuildList == NULL ) + if( m_pBuildList == nullptr ) m_pBuildList = buildListInfo; else { BuildListInfo *last = m_pBuildList; - while( last->getNext() != NULL ) + while( last->getNext() != nullptr ) last = last->getNext(); last->setNextBuildList( buildListInfo ); @@ -3722,7 +3722,7 @@ void Player::xfer( Xfer *xfer ) // ai player data Bool aiPlayerPresent = m_ai ? TRUE : FALSE; xfer->xferBool( &aiPlayerPresent ); - if( (aiPlayerPresent == TRUE && m_ai == NULL) || (aiPlayerPresent == FALSE && m_ai != NULL) ) + if( (aiPlayerPresent == TRUE && m_ai == nullptr) || (aiPlayerPresent == FALSE && m_ai != nullptr) ) { DEBUG_CRASH(( "Player::xfer - m_ai present/missing mismatch" )); @@ -3735,8 +3735,8 @@ void Player::xfer( Xfer *xfer ) // resource gathering manager Bool resourceGatheringManagerPresent = m_resourceGatheringManager ? TRUE : FALSE; xfer->xferBool( &resourceGatheringManagerPresent ); - if( (resourceGatheringManagerPresent == TRUE && m_resourceGatheringManager == NULL) || - (resourceGatheringManagerPresent == FALSE && m_resourceGatheringManager != NULL ) ) + if( (resourceGatheringManagerPresent == TRUE && m_resourceGatheringManager == nullptr) || + (resourceGatheringManagerPresent == FALSE && m_resourceGatheringManager != nullptr ) ) { DEBUG_CRASH(( "Player::xfer - m_resourceGatheringManager present/missing mismatch" )); @@ -3749,8 +3749,8 @@ void Player::xfer( Xfer *xfer ) // tunnel tracking system Bool tunnelTrackerPresent = m_tunnelSystem ? TRUE : FALSE; xfer->xferBool( &tunnelTrackerPresent ); - if( (tunnelTrackerPresent == TRUE && m_tunnelSystem == NULL) || - (tunnelTrackerPresent == FALSE && m_tunnelSystem != NULL) ) + if( (tunnelTrackerPresent == TRUE && m_tunnelSystem == nullptr) || + (tunnelTrackerPresent == FALSE && m_tunnelSystem != nullptr) ) { DEBUG_CRASH(( "Player::xfer - m_tunnelSystem present/missing mismatch" )); @@ -4005,10 +4005,10 @@ void Player::xfer( Xfer *xfer ) for( UnsignedShort i = 0; i < squadCount; ++i ) { - if( m_squads[ i ] == NULL ) + if( m_squads[ i ] == nullptr ) { - DEBUG_CRASH(( "Player::xfer - NULL squad at index '%d'", i )); + DEBUG_CRASH(( "Player::xfer - null squad at index '%d'", i )); throw SC_INVALID_DATA; } @@ -4024,7 +4024,7 @@ void Player::xfer( Xfer *xfer ) { // allocate squad if needed - if( m_currentSelection == NULL && xfer->getXferMode() == XFER_LOAD ) + if( m_currentSelection == nullptr && xfer->getXferMode() == XFER_LOAD ) m_currentSelection = newInstance( Squad ); // xfer @@ -4033,12 +4033,12 @@ void Player::xfer( Xfer *xfer ) } // Player battle plan bonuses - Bool battlePlanBonus = m_battlePlanBonuses != NULL; + Bool battlePlanBonus = m_battlePlanBonuses != nullptr; xfer->xferBool( &battlePlanBonus ); //If we're loading, it just replaces the bool if( xfer->getXferMode() == XFER_LOAD ) { deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; if ( battlePlanBonus ) { diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index a14fce84fe5..3e6b734858f 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -62,11 +62,11 @@ //----------------------------------------------------------------------------- -/*extern*/ PlayerList *ThePlayerList = NULL; +/*extern*/ PlayerList *ThePlayerList = nullptr; //----------------------------------------------------------------------------- PlayerList::PlayerList() : - m_local(NULL), + m_local(nullptr), m_playerCount(0) { // we only allocate a few of these, so don't bother pooling 'em @@ -92,7 +92,7 @@ Player *PlayerList::getNthPlayer(Int i) if( i < 0 || i >= MAX_PLAYER_COUNT ) { // DEBUG_CRASH( ("Illegal player index") ); - return NULL; + return nullptr; } return m_players[i]; } @@ -107,7 +107,7 @@ Player *PlayerList::findPlayerWithNameKey(NameKeyType key) return m_players[i]; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -126,7 +126,7 @@ void PlayerList::newGame() { Int i; - DEBUG_ASSERTCRASH(this != NULL, ("null this")); + DEBUG_ASSERTCRASH(this != nullptr, ("null this")); reset(); @@ -232,10 +232,10 @@ void PlayerList::newGame() void PlayerList::init() { m_playerCount = 1; - m_players[0]->init(NULL); + m_players[0]->init(nullptr); for (int i = 1; i < MAX_PLAYER_COUNT; i++) - m_players[i]->init(NULL); + m_players[i]->init(nullptr); // call setLocalPlayer so that becomingLocalPlayer() gets called appropriately setLocalPlayer(m_players[0]); @@ -304,7 +304,7 @@ Team *PlayerList::validateTeam( AsciiString owner ) void PlayerList::setLocalPlayer(Player *player) { // can't set local player to null -- if you try, you get neutral. - if (player == NULL) + if (player == nullptr) { DEBUG_CRASH(("local player may not be null")); player = getNeutralPlayer(); @@ -344,7 +344,7 @@ void PlayerList::setLocalPlayer(Player *player) //----------------------------------------------------------------------------- Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) { - Player *player = NULL; + Player *player = nullptr; Int i; for( i = 0; i < MAX_PLAYER_COUNT; i++ ) @@ -357,14 +357,14 @@ Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) } DEBUG_CRASH( ("Player does not exist for mask") ); - return NULL; // mask not found + return nullptr; // mask not found } //----------------------------------------------------------------------------- Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) { - Player *player = NULL; + Player *player = nullptr; Int i; for( i = 0; i < MAX_PLAYER_COUNT; i++ ) @@ -380,7 +380,7 @@ Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) DEBUG_CRASH( ("No players found that contain any matching masks.") ); maskToAdjust = 0; - return NULL; // mask not found + return nullptr; // mask not found } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 3a07fa73bf9..3bc7b22e2bc 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -67,48 +67,48 @@ { static const FieldParse TheFieldParseTable[] = { - { "Side", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_side ) }, - { "PlayableSide", INI::parseBool, NULL, offsetof( PlayerTemplate, m_playableSide ) }, - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( PlayerTemplate, m_displayName) }, - { "StartMoney", PlayerTemplate::parseStartMoney, NULL, offsetof( PlayerTemplate, m_money ) }, - { "PreferredColor", INI::parseRGBColor, NULL, offsetof( PlayerTemplate, m_preferredColor ) }, - { "StartingBuilding", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingBuilding ) }, - { "StartingUnit0", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[0] ) }, - { "StartingUnit1", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[1] ) }, - { "StartingUnit2", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[2] ) }, - { "StartingUnit3", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[3] ) }, - { "StartingUnit4", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[4] ) }, - { "StartingUnit5", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[5] ) }, - { "StartingUnit6", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[6] ) }, - { "StartingUnit7", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[7] ) }, - { "StartingUnit8", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[8] ) }, - { "StartingUnit9", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[9] ) }, - { "ProductionCostChange", PlayerTemplate::parseProductionCostChange, NULL, 0 }, - { "ProductionTimeChange", PlayerTemplate::parseProductionTimeChange, NULL, 0 }, - { "ProductionVeterancyLevel", PlayerTemplate::parseProductionVeterancyLevel, NULL, 0 }, - { "IntrinsicSciences", INI::parseScienceVector, NULL, offsetof( PlayerTemplate, m_intrinsicSciences ) }, - { "PurchaseScienceCommandSetRank1",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank1 ) }, - { "PurchaseScienceCommandSetRank3",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank3 ) }, - { "PurchaseScienceCommandSetRank8",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank8 ) }, - { "SpecialPowerShortcutCommandSet",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutCommandSet ) }, - { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, - { "SpecialPowerShortcutButtonCount",INI::parseInt, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, - { "IsObserver", INI::parseBool, NULL, offsetof( PlayerTemplate, m_observer ) }, - { "IntrinsicSciencePurchasePoints", INI::parseInt, NULL, offsetof( PlayerTemplate, m_intrinsicSPP ) }, - { "ScoreScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_scoreScreenImage ) }, - { "LoadScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_loadScreenImage ) }, - { "LoadScreenMusic", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_loadScreenMusic ) }, - - { "HeadWaterMark", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_headWaterMark ) }, - { "FlagWaterMark", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_flagWaterMark ) }, - { "EnabledImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_enabledImage ) }, - //{ "DisabledImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_disabledImage ) }, - //{ "HiliteImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_hiliteImage ) }, - //{ "PushedImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_pushedImage ) }, - { "SideIconImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_sideIconImage ) }, - - { "BeaconName", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_beaconTemplate ) }, - { NULL, NULL, NULL, 0 }, + { "Side", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_side ) }, + { "PlayableSide", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_playableSide ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( PlayerTemplate, m_displayName) }, + { "StartMoney", PlayerTemplate::parseStartMoney, nullptr, offsetof( PlayerTemplate, m_money ) }, + { "PreferredColor", INI::parseRGBColor, nullptr, offsetof( PlayerTemplate, m_preferredColor ) }, + { "StartingBuilding", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingBuilding ) }, + { "StartingUnit0", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[0] ) }, + { "StartingUnit1", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[1] ) }, + { "StartingUnit2", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[2] ) }, + { "StartingUnit3", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[3] ) }, + { "StartingUnit4", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[4] ) }, + { "StartingUnit5", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[5] ) }, + { "StartingUnit6", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[6] ) }, + { "StartingUnit7", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[7] ) }, + { "StartingUnit8", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[8] ) }, + { "StartingUnit9", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[9] ) }, + { "ProductionCostChange", PlayerTemplate::parseProductionCostChange, nullptr, 0 }, + { "ProductionTimeChange", PlayerTemplate::parseProductionTimeChange, nullptr, 0 }, + { "ProductionVeterancyLevel", PlayerTemplate::parseProductionVeterancyLevel, nullptr, 0 }, + { "IntrinsicSciences", INI::parseScienceVector, nullptr, offsetof( PlayerTemplate, m_intrinsicSciences ) }, + { "PurchaseScienceCommandSetRank1",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank1 ) }, + { "PurchaseScienceCommandSetRank3",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank3 ) }, + { "PurchaseScienceCommandSetRank8",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank8 ) }, + { "SpecialPowerShortcutCommandSet",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutCommandSet ) }, + { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, + { "SpecialPowerShortcutButtonCount",INI::parseInt, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, + { "IsObserver", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_observer ) }, + { "IntrinsicSciencePurchasePoints", INI::parseInt, nullptr, offsetof( PlayerTemplate, m_intrinsicSPP ) }, + { "ScoreScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_scoreScreenImage ) }, + { "LoadScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_loadScreenImage ) }, + { "LoadScreenMusic", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_loadScreenMusic ) }, + + { "HeadWaterMark", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_headWaterMark ) }, + { "FlagWaterMark", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_flagWaterMark ) }, + { "EnabledImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_enabledImage ) }, + //{ "DisabledImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_disabledImage ) }, + //{ "HiliteImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_hiliteImage ) }, + //{ "PushedImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_pushedImage ) }, + { "SideIconImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_sideIconImage ) }, + + { "BeaconName", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_beaconTemplate ) }, + { nullptr, nullptr, nullptr, 0 }, }; return TheFieldParseTable; @@ -166,7 +166,7 @@ AsciiString PlayerTemplate::getStartingUnit( Int i ) const Int money = 0; // parse the money as a regular "FIELD = " - INI::parseInt( ini, instance, &money, NULL ); + INI::parseInt( ini, instance, &money, nullptr ); // assign the money into the 'Money' (m_money) pointed to at 'store' Money *theMoney = (Money *)store; @@ -236,7 +236,7 @@ const Image *PlayerTemplate::getEnabledImage( void ) const //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -/*extern*/ PlayerTemplateStore *ThePlayerTemplateStore = NULL; +/*extern*/ PlayerTemplateStore *ThePlayerTemplateStore = nullptr; //----------------------------------------------------------------------------- PlayerTemplateStore::PlayerTemplateStore() @@ -310,7 +310,7 @@ const PlayerTemplate* PlayerTemplateStore::findPlayerTemplate(NameKeyType nameke if ((*it).getNameKey() == namekey) return &(*it); } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -319,7 +319,7 @@ const PlayerTemplate* PlayerTemplateStore::getNthPlayerTemplate(Int i) const if (i >= 0 && i < m_playerTemplates.size()) return &m_playerTemplates[i]; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 1decc6c6e62..d4152517d9d 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -140,7 +140,7 @@ const ThingTemplate *ProductionPrerequisite::getExistingBuildFacilityTemplate( c return m_prereqUnits[i].unit; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -194,7 +194,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre PrereqUnitRec info; info.name = unit; info.flags = orUnitWithPrevious ? UNIT_OR_WITH_PREV : 0; - info.unit = NULL; + info.unit = nullptr; m_prereqUnits.push_back(info); } @@ -263,7 +263,7 @@ UnicodeString ProductionPrerequisite::getRequiresList(const Player *player) cons unit = m_prereqUnits[i-1].unit; unitName = unit->getDisplayName(); unitName.concat( L" " ); - unitName.concat(TheGameText->fetch("CONTROLBAR:OrRequirement", NULL)); + unitName.concat(TheGameText->fetch("CONTROLBAR:OrRequirement", nullptr)); unitName.concat( L" " ); requiresList.concat(unitName); } @@ -302,7 +302,7 @@ UnicodeString ProductionPrerequisite::getRequiresList(const Player *player) cons } else { unitName.concat(L"\n"); } - requiresList.concat(TheGameText->fetch("CONTROLBAR:GeneralsPromotion", NULL)); + requiresList.concat(TheGameText->fetch("CONTROLBAR:GeneralsPromotion", nullptr)); } // return final list diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp index b0cef87c976..2f12f2652fb 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp @@ -53,7 +53,7 @@ ResourceGatheringManager::~ResourceGatheringManager() void ResourceGatheringManager::addSupplyCenter( Object *newCenter ) { - if( newCenter == NULL ) + if( newCenter == nullptr ) return; m_supplyCenters.push_back( newCenter->getID() ); @@ -61,7 +61,7 @@ void ResourceGatheringManager::addSupplyCenter( Object *newCenter ) void ResourceGatheringManager::removeSupplyCenter( Object *oldCenter ) { - if( oldCenter == NULL ) + if( oldCenter == nullptr ) return; ObjectID targetID = oldCenter->getID(); @@ -80,7 +80,7 @@ void ResourceGatheringManager::removeSupplyCenter( Object *oldCenter ) void ResourceGatheringManager::addSupplyWarehouse( Object *newWarehouse ) { - if( newWarehouse == NULL ) + if( newWarehouse == nullptr ) return; m_supplyWarehouses.push_back( newWarehouse->getID() ); @@ -88,7 +88,7 @@ void ResourceGatheringManager::addSupplyWarehouse( Object *newWarehouse ) void ResourceGatheringManager::removeSupplyWarehouse( Object *oldWarehouse ) { - if( oldWarehouse == NULL ) + if( oldWarehouse == nullptr ) return; ObjectID targetID = oldWarehouse->getID(); @@ -113,7 +113,7 @@ static Real computeRelativeCost( Object *queryObject, Object *destObject, Real * //A good score is a very small number. - if( queryObject == NULL || destObject == NULL ) + if( queryObject == nullptr || destObject == nullptr ) return FLT_MAX; if( !TheActionManager->canTransferSuppliesAt(queryObject, destObject) ) @@ -138,11 +138,11 @@ static Real computeRelativeCost( Object *queryObject, Object *destObject, Real * Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) { - Object *bestWarehouse = NULL; + Object *bestWarehouse = nullptr; Real maxDistanceSquared = 100000; - if( ( queryObject == NULL ) || ( queryObject->getAI() == NULL ) ) - return NULL; + if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) + return nullptr; SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) @@ -155,7 +155,7 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) static const NameKeyType key_warehouseUpdate = NAMEKEY("SupplyWarehouseDockUpdate"); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate*)dock->findUpdateModule( key_warehouseUpdate ); //If remotely okay, let User win. - if( warehouseModule && computeRelativeCost( queryObject, dock, NULL ) != FLT_MAX ) + if( warehouseModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) return dock; } // Please note, there is not a separate Warehouse and Center memory by Design. Because @@ -176,7 +176,7 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) ObjectID currentID = *iterator; Object *currentWarehouse =TheGameLogic->findObjectByID(currentID); - if( currentWarehouse == NULL ) + if( currentWarehouse == nullptr ) { iterator = m_supplyWarehouses.erase( iterator ); } @@ -199,10 +199,10 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) { - Object *bestCenter = NULL; + Object *bestCenter = nullptr; - if( ( queryObject == NULL ) || ( queryObject->getAI() == NULL ) ) - return NULL; + if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) + return nullptr; SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) @@ -215,7 +215,7 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) static const NameKeyType key_centerUpdate = NAMEKEY("SupplyCenterDockUpdate"); SupplyCenterDockUpdate *centerModule = (SupplyCenterDockUpdate*)dock->findUpdateModule( key_centerUpdate ); //If remotely okay, let User win. - if( centerModule && computeRelativeCost( queryObject, dock, NULL ) != FLT_MAX ) + if( centerModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) return dock; } // Please note, there is not a separate Warehouse and Center memory by Design. Because @@ -232,13 +232,13 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) ObjectID currentID = *iterator; Object *currentCenter =TheGameLogic->findObjectByID(currentID); - if( currentCenter == NULL ) + if( currentCenter == nullptr ) { iterator = m_supplyCenters.erase( iterator ); } else { - Real currentCost = computeRelativeCost( queryObject, currentCenter, NULL ); + Real currentCost = computeRelativeCost( queryObject, currentCenter, nullptr ); if( currentCost < bestCost ) { bestCenter = currentCenter; diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp index 2951c86dd8c..6cb201b2467 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -33,7 +33,7 @@ #include "Common/Player.h" #include "Common/Science.h" -ScienceStore* TheScienceStore = NULL; +ScienceStore* TheScienceStore = nullptr; //----------------------------------------------------------------------------- @@ -148,7 +148,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const return si; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -163,15 +163,15 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const static const FieldParse myFieldParse[] = { - { "PrerequisiteSciences", INI::parseScienceVector, NULL, offsetof( ScienceInfo, m_prereqSciences ) }, - { "SciencePurchasePointCost", INI::parseInt, NULL, offsetof( ScienceInfo, m_sciencePurchasePointCost ) }, - { "IsGrantable", INI::parseBool, NULL, offsetof( ScienceInfo, m_grantable ) }, - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( ScienceInfo, m_name) }, - { "Description", INI::parseAndTranslateLabel, NULL, offsetof( ScienceInfo, m_description) }, - { 0, 0, 0, 0 } + { "PrerequisiteSciences", INI::parseScienceVector, nullptr, offsetof( ScienceInfo, m_prereqSciences ) }, + { "SciencePurchasePointCost", INI::parseInt, nullptr, offsetof( ScienceInfo, m_sciencePurchasePointCost ) }, + { "IsGrantable", INI::parseBool, nullptr, offsetof( ScienceInfo, m_grantable ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_name) }, + { "Description", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_description) }, + { nullptr, nullptr, nullptr, 0 } }; - ScienceInfo* info = NULL; + ScienceInfo* info = nullptr; // see if the science already exists. (can't use findScienceInfo() since it is const and should remain so.) for (ScienceInfoVec::iterator it = TheScienceStore->m_sciences.begin(); it != TheScienceStore->m_sciences.end(); ++it) @@ -188,7 +188,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const { ScienceInfo* newInfo = newInstance(ScienceInfo); - if (info == NULL) + if (info == nullptr) { // only add if it's not overriding an existing one. info = newInfo; @@ -211,7 +211,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const } else { - if (info != NULL) + if (info != nullptr) { DEBUG_CRASH(("duplicate science %s!",c)); throw INI_INVALID_DATA; @@ -365,7 +365,7 @@ ScienceType ScienceStore::friend_lookupScience(const char* scienceName) const Bool ScienceStore::isValidScience(ScienceType st) const { const ScienceInfo* si = findScienceInfo(st); - return si != NULL; + return si != nullptr; } //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 0056c1f7e03..9dc096e318b 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -407,7 +407,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) { // sanity - if( map == NULL ) + if( map == nullptr ) { DEBUG_CRASH(( "xferObjectCountMap - Invalid map parameter" )); @@ -458,7 +458,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) // read thing template name xfer->xferAsciiString( &thingTemplateName ); thingTemplate = TheThingFactory->findTemplate( thingTemplateName ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "xferObjectCountMap - Unknown thing template '%s'", thingTemplateName.str() )); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 74e9ed131bf..8ff183cf271 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -39,7 +39,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -SpecialPowerStore *TheSpecialPowerStore = NULL; +SpecialPowerStore *TheSpecialPowerStore = nullptr; #define DEFAULT_DEFECTION_DETECTION_PROTECTION_TIME_LIMIT (LOGICFRAMES_PER_SECOND * 10) @@ -100,7 +100,7 @@ const char* const SpecialPowerMaskType::s_bitNameList[] = "SPECIAL_CLEANUP_AREA", "SPECIAL_LAUNCH_BAIKONUR_ROCKET", - NULL + nullptr }; static_assert(ARRAY_SIZE(SpecialPowerMaskType::s_bitNameList) == SpecialPowerMaskType::NumBits + 1, "Incorrect array size"); @@ -162,19 +162,19 @@ void SpecialPowerStore::parseSpecialPowerDefinition( INI *ini ) /* static */ const FieldParse SpecialPowerTemplate::m_specialPowerFieldParse[] = { - { "ReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_reloadTime ) }, - { "RequiredScience", INI::parseScience, NULL, offsetof( SpecialPowerTemplate, m_requiredScience ) }, - { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerTemplate, m_initiateSound ) }, - { "InitiateAtLocationSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerTemplate, m_initiateAtLocationSound ) }, - { "PublicTimer", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_publicTimer ) }, + { "ReloadTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_reloadTime ) }, + { "RequiredScience", INI::parseScience, nullptr, offsetof( SpecialPowerTemplate, m_requiredScience ) }, + { "InitiateSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerTemplate, m_initiateSound ) }, + { "InitiateAtLocationSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerTemplate, m_initiateAtLocationSound ) }, + { "PublicTimer", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_publicTimer ) }, { "Enum", INI::parseIndexList, SpecialPowerMaskType::getBitNames(), offsetof( SpecialPowerTemplate, m_type ) }, - { "DetectionTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_detectionTime ) }, - { "SharedSyncedTimer", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_sharedNSync ) }, - { "ViewObjectDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_viewObjectDuration ) }, - { "ViewObjectRange", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_viewObjectRange ) }, - { "RadiusCursorRadius", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, - { "ShortcutPower", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, - { NULL, NULL, NULL, 0 } + { "DetectionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_detectionTime ) }, + { "SharedSyncedTimer", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_sharedNSync ) }, + { "ViewObjectDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_viewObjectDuration ) }, + { "ViewObjectRange", INI::parseReal, nullptr, offsetof( SpecialPowerTemplate, m_viewObjectRange ) }, + { "RadiusCursorRadius", INI::parseReal, nullptr, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, + { "ShortcutPower", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -243,7 +243,7 @@ SpecialPowerTemplate* SpecialPowerStore::findSpecialPowerTemplatePrivate( AsciiS if( m_specialPowerTemplates[ i ]->getName() == name ) return m_specialPowerTemplates[ i ]; - return NULL; // not found + return nullptr; // not found } @@ -258,7 +258,7 @@ const SpecialPowerTemplate *SpecialPowerStore::findSpecialPowerTemplateByID( Uns if( m_specialPowerTemplates[ i ]->getID() == id ) return m_specialPowerTemplates[ i ]; - return NULL; // not found + return nullptr; // not found } @@ -271,7 +271,7 @@ const SpecialPowerTemplate *SpecialPowerStore::getSpecialPowerTemplateByIndex( U if (index >= 0 && index < m_specialPowerTemplates.size()) return m_specialPowerTemplates[ index ]; - return NULL; // not found + return nullptr; // not found } @@ -292,11 +292,11 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl { // sanity - if( obj == NULL || specialPowerTemplate == NULL ) + if( obj == nullptr || specialPowerTemplate == nullptr ) return FALSE; // as a first sanity check, the object must have a module capable of executing the power - if( obj->getSpecialPowerModule( specialPowerTemplate ) == NULL ) + if( obj->getSpecialPowerModule( specialPowerTemplate ) == nullptr ) return FALSE; // @@ -336,7 +336,7 @@ void SpecialPowerStore::reset( void ) { SpecialPowerTemplate* si = *it; Overridable* temp = si->deleteOverrides(); - if (temp == NULL) + if (temp == nullptr) { it = m_specialPowerTemplates.erase(it); } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index f81283fdae8..daf876904fb 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -55,7 +55,7 @@ ///@todo - do delayed script evaluations for team scripts. jba. // GLOBALS //////////////////////////////////////////////////////////////////// -TeamFactory *TheTeamFactory = NULL; +TeamFactory *TheTeamFactory = nullptr; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -234,7 +234,7 @@ void TeamFactory::initFromSides(SidesList *sides) // ------------------------------------------------------------------------ void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bool isSingleton, Dict *d) { - DEBUG_ASSERTCRASH(findTeamPrototype(name)==NULL,("team already exists")); + DEBUG_ASSERTCRASH(findTeamPrototype(name)==nullptr,("team already exists")); Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner)); DEBUG_ASSERTCRASH(pOwner, ("no owner found for team %s (%s)",name.str(),owner.str())); if (!pOwner) @@ -277,14 +277,14 @@ TeamPrototype *TeamFactory::findTeamPrototype(const AsciiString& name) if (it != m_prototypes.end()) return it->second; - return NULL; + return nullptr; } // ------------------------------------------------------------------------ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) { TeamPrototypeMap::iterator it; - TeamPrototype *prototype = NULL; + TeamPrototype *prototype = nullptr; for( it = m_prototypes.begin(); it != m_prototypes.end(); ++it ) { @@ -296,7 +296,7 @@ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) } // not found - return NULL; + return nullptr; } @@ -306,7 +306,7 @@ Team *TeamFactory::findTeamByID( TeamID teamID ) // simple case if( teamID == TEAM_ID_INVALID ) - return NULL; + return nullptr; // search all prototypes for the matching team ID TeamPrototype *tp; @@ -320,7 +320,7 @@ Team *TeamFactory::findTeamByID( TeamID teamID ) return team; } - return NULL; + return nullptr; } @@ -332,10 +332,10 @@ Team *TeamFactory::createInactiveTeam(const AsciiString& name) TeamPrototype *tp = findTeamPrototype(name); if (!tp) { DEBUG_CRASH(( "Team prototype '%s' does not exist", name.str() )); - return NULL; + return nullptr; } - Team *t = NULL; + Team *t = nullptr; if (tp->getIsSingleton()) { t = tp->getFirstItemIn_TeamInstanceList(); @@ -375,10 +375,10 @@ Team *TeamFactory::createTeam(const AsciiString& name) // ------------------------------------------------------------------------ Team *TeamFactory::createTeamOnPrototype( TeamPrototype *prototype ) { - if( prototype == NULL ) + if( prototype == nullptr ) throw ERROR_BAD_ARG; - Team *t = NULL; + Team *t = nullptr; if( prototype->getIsSingleton() ) { t = prototype->getFirstItemIn_TeamInstanceList(); @@ -396,13 +396,13 @@ Team* TeamFactory::findTeam(const AsciiString& name) if (tp) { Team *t = tp->getFirstItemIn_TeamInstanceList(); - if (t == NULL && !tp->getIsSingleton()) + if (t == nullptr && !tp->getIsSingleton()) { t = createInactiveTeam(name); } return t; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ @@ -496,7 +496,7 @@ void TeamFactory::xfer( Xfer *xfer ) teamPrototype = findTeamPrototypeByID( teamPrototypeID ); // sanity - if( teamPrototype == NULL ) + if( teamPrototype == nullptr ) { DEBUG_CRASH(( "TeamFactory::xfer - Unable to find team prototype by id" )); @@ -517,7 +517,7 @@ if( xfer->getXferMode() == XFER_SAVE ) { FILE *fp = fopen( "TeamCheckSave.txt", "w+t" ); -if( fp == NULL ) +if( fp == nullptr ) return; Object *obj; @@ -584,7 +584,7 @@ void TeamFactory::loadPostProcess( void ) /* // SAVE_LOAD_DEBUG FILE *fp = fopen( "TeamCheckLoad.txt", "w+t" ); -if( fp == NULL ) +if( fp == nullptr ) return; Object *obj; @@ -813,9 +813,9 @@ TeamPrototype::TeamPrototype( TeamFactory *tf, m_flags(isSingleton ? TeamPrototype::TEAM_SINGLETON : 0), m_teamTemplate(d), m_productionConditionAlwaysFalse(false), - m_productionConditionScript(NULL) + m_productionConditionScript(nullptr) { - DEBUG_ASSERTCRASH(!(m_owningPlayer == NULL), ("bad args to TeamPrototype ctor")); + DEBUG_ASSERTCRASH(!(m_owningPlayer == nullptr), ("bad args to TeamPrototype ctor")); if (m_factory) m_factory->addTeamPrototypeToList(this); @@ -824,7 +824,7 @@ TeamPrototype::TeamPrototype( TeamFactory *tf, m_retrievedGenericScripts = false; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - m_genericScriptsToRun[i] = NULL; + m_genericScriptsToRun[i] = nullptr; } } @@ -850,12 +850,12 @@ TeamPrototype::~TeamPrototype() m_factory->removeTeamPrototypeFromList(this); deleteInstance(m_productionConditionScript); - m_productionConditionScript = NULL; + m_productionConditionScript = nullptr; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { deleteInstance(m_genericScriptsToRun[i]); - m_genericScriptsToRun[i] = NULL; + m_genericScriptsToRun[i] = nullptr; } } @@ -873,13 +873,13 @@ Team *TeamPrototype::findTeamByID( TeamID teamID ) if( iter.cur()->getID() == teamID ) return iter.cur(); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ void TeamPrototype::setControllingPlayer(Player *newController) { - DEBUG_ASSERTCRASH(newController, ("Attempted to set NULL player as team-owner, illegal.")); + DEBUG_ASSERTCRASH(newController, ("Attempted to set null player as team-owner, illegal.")); if (!newController) { return; } @@ -889,7 +889,7 @@ void TeamPrototype::setControllingPlayer(Player *newController) m_owningPlayer = newController; - // impossible to get here with a NULL pointer. + // impossible to get here with a nullptr pointer. m_owningPlayer->addTeamToList(this); } @@ -919,8 +919,8 @@ Script *TeamPrototype::getGenericScript(Int scriptToRetrieve) m_retrievedGenericScripts = TRUE; // set this to true so we won't do the lookup again. // Go get them from the script engine, and duplicate each one. for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - const Script *tmpScript = NULL; - Script *scriptToSave = NULL; + const Script *tmpScript = nullptr; + Script *scriptToSave = nullptr; if (!m_teamTemplate.m_teamGenericScripts[i].isEmpty()) { tmpScript = TheScriptEngine->findScriptByName(m_teamTemplate.m_teamGenericScripts[i]); if (tmpScript) { @@ -1057,7 +1057,7 @@ void TeamPrototype::updateState(void) done = true; for (DLINK_ITERATOR iter = iterate_TeamInstanceList(); !iter.done(); iter.advance()) { - if (iter.cur()->getFirstItemIn_TeamMemberList() == NULL) + if (iter.cur()->getFirstItemIn_TeamMemberList() == nullptr) { // Team has no members. if (this->getIsSingleton()) @@ -1134,7 +1134,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) if (delaySeconds>0) { m_productionConditionScript->setFrameToEvaluate(TheGameLogic->getFrame()+delaySeconds*LOGICFRAMES_PER_SECOND); } - return TheScriptEngine->evaluateConditions(m_productionConditionScript, NULL, getControllingPlayer()); + return TheScriptEngine->evaluateConditions(m_productionConditionScript, nullptr, getControllingPlayer()); } // We don't have a script yet, so check for one. if (m_teamTemplate.m_productionCondition.isEmpty()) { @@ -1169,7 +1169,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) // Make a copy of the script locally, just for paranoia's sake. We can't be sure // exactly what order the teams & scripts will get reset, so be safe. m_productionConditionScript = pScript->duplicate(); - return TheScriptEngine->evaluateConditions(m_productionConditionScript, NULL, getControllingPlayer()); + return TheScriptEngine->evaluateConditions(m_productionConditionScript, nullptr, getControllingPlayer()); } // Couldn't find a script. m_productionConditionAlwaysFalse = true; @@ -1265,7 +1265,7 @@ void TeamPrototype::xfer( Xfer *xfer ) // created with exactly the same team IDs they had before // teamInstance = TheTeamFactory->findTeamByID( teamID ); - if( teamInstance == NULL ) + if( teamInstance == nullptr ) { // create team @@ -1347,7 +1347,7 @@ Team::Team(TeamPrototype *proto, TeamID id ) : // ------------------------------------------------------------------------ Team::~Team() { -// DEBUG_ASSERTCRASH(getFirstItemIn_TeamMemberList() == NULL, ("Team still has members in existence")); +// DEBUG_ASSERTCRASH(getFirstItemIn_TeamMemberList() == nullptr, ("Team still has members in existence")); TheScriptEngine->notifyOfTeamDestruction(this); @@ -1361,9 +1361,9 @@ Team::~Team() } Object* tm; - while ((tm = getFirstItemIn_TeamMemberList()) != NULL) + while ((tm = getFirstItemIn_TeamMemberList()) != nullptr) { - tm->setTeam(NULL); + tm->setTeam(nullptr); } //this test is valid, but will generate a 'false positive' during game teardown //DEBUG_ASSERTCRASH(!(getControllingPlayer() && getControllingPlayer()->getDefaultTeam()==this),("I am still someones default team -- sure you want to delete me?")); @@ -1390,7 +1390,7 @@ Player *Team::getControllingPlayer() const // ------------------------------------------------------------------------ void Team::setControllingPlayer(Player *newController) { - // NULL is not allowed, but is caught by TeamPrototype::setControllingPlayer() + // nullptr is not allowed, but is caught by TeamPrototype::setControllingPlayer() m_proto->setControllingPlayer(newController); // This function is used by one script, and it is kind of odd. The actual units @@ -1445,7 +1445,7 @@ Int Team::getTargetableCount() const continue; } - if (obj->isEffectivelyDead() || (obj->getAIUpdateInterface() == NULL && !obj->isKindOf(KINDOF_STRUCTURE))) { + if (obj->isEffectivelyDead() || (obj->getAIUpdateInterface() == nullptr && !obj->isKindOf(KINDOF_STRUCTURE))) { continue; } @@ -1459,7 +1459,7 @@ Int Team::getTargetableCount() const Relationship Team::getRelationship(const Team *that) const { // do we have an override for that particular team? if so, return it. - if (!m_teamRelations->m_map.empty() && that != NULL) + if (!m_teamRelations->m_map.empty() && that != nullptr) { TeamRelationMapType::const_iterator it = m_teamRelations->m_map.find(that->getID()); if (it != m_teamRelations->m_map.end()) @@ -1469,10 +1469,10 @@ Relationship Team::getRelationship(const Team *that) const } // hummm... well, do we have an override for that team's player? - if (!m_playerRelations->m_map.empty() && that != NULL) + if (!m_playerRelations->m_map.empty() && that != nullptr) { Player* thatPlayer = that->getControllingPlayer(); - if (thatPlayer != NULL) + if (thatPlayer != nullptr) { PlayerRelationMapType::const_iterator it = m_playerRelations->m_map.find(thatPlayer->getPlayerIndex()); if (it != m_playerRelations->m_map.end()) @@ -1489,7 +1489,7 @@ Relationship Team::getRelationship(const Team *that) const // ------------------------------------------------------------------------ void Team::setTeamTargetObject(const Object *target) { - if (target==NULL) { + if (target==nullptr) { m_commonAttackTarget = INVALID_ID; return; } @@ -1506,7 +1506,7 @@ void Team::setTeamTargetObject(const Object *target) Object *Team::getTeamTargetObject(void) { if (m_commonAttackTarget == INVALID_ID) { - return NULL; + return nullptr; } Object *target = TheGameLogic->findObjectByID(m_commonAttackTarget); if (target) { @@ -1514,16 +1514,16 @@ Object *Team::getTeamTargetObject(void) if( target->testStatus( OBJECT_STATUS_STEALTHED ) && !target->testStatus( OBJECT_STATUS_DETECTED ) ) { - target = NULL; + target = nullptr; } } if (target && target->isEffectivelyDead()) { - target = NULL; + target = nullptr; } if (target && target->getContainedBy()) { - target = NULL; // target entered a building or vehicle, so stop targeting. + target = nullptr; // target entered a building or vehicle, so stop targeting. } - if (target == NULL) { + if (target == nullptr) { m_commonAttackTarget = INVALID_ID; } return target; @@ -1832,7 +1832,7 @@ void Team::updateState(void) PartitionFilterAlive filterAlive; PartitionFilterSameMapStatus filterMapStatus(iter.cur()); - PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterMapStatus, nullptr }; Real visionRange = iter.cur()->getVisionRange(); anyAliveInTeam = true; Object *pObj = ThePartitionManager->getClosestObject( iter.cur(), visionRange, @@ -2216,11 +2216,11 @@ const Coord3D* Team::getEstimateTeamPosition(void) DLINK_ITERATOR iter = iterate_TeamMemberList(); Object *obj = iter.cur(); if (!obj) - return NULL; + return nullptr; const Coord3D *pos = iter.cur()->getPosition(); if (!pos) - return NULL; + return nullptr; return pos; } @@ -2290,9 +2290,9 @@ void Team::deleteTeam(Bool ignoreDead) void Team::transferUnitsTo(Team *newTeam) { if (this == newTeam) return; - if (newTeam == NULL) return; + if (newTeam == nullptr) return; Object *obj; - while ((obj = getFirstItemIn_TeamMemberList()) != 0) + while ((obj = getFirstItemIn_TeamMemberList()) != nullptr) { obj->setTeam(newTeam); } @@ -2318,9 +2318,9 @@ static Bool isInBuildVariations(const ThingTemplate* ttWithVariations, const Thi Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHome, Real maxDist) { Player *myPlayer = getControllingPlayer(); - Object *obj=NULL; + Object *obj=nullptr; Real distSqr = maxDist*maxDist; - Object *recruit = NULL; + Object *recruit = nullptr; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) { if (!obj->getTemplate()->isEquivalentTo(tTemplate)) @@ -2364,7 +2364,7 @@ Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHo dx = teamHome->x - obj->getPosition()->x; dy = teamHome->y - obj->getPosition()->y; - if (isDefaultTeam && recruit == NULL) { + if (isDefaultTeam && recruit == nullptr) { recruit = obj; distSqr = dx*dx+dy*dy; } @@ -2375,10 +2375,10 @@ Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHo distSqr = dx*dx+dy*dy; recruit = obj; } - if (recruit!=NULL) { + if (recruit!=nullptr) { return recruit; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ @@ -2394,7 +2394,7 @@ void Team::evacuateTeam(void) ContainModuleInterface *cmi = obj->getContain(); UnsignedInt numContained = 0; - if (cmi != NULL) { + if (cmi != nullptr) { numContained = cmi->getContainCount(); } if (numContained > 0) { @@ -2426,7 +2426,7 @@ void Team::killTeam(void) // TheSuperHackers @bugfix Mauller 20/07/2025 the neutral player has no player template so we need to check for a null template const PlayerTemplate* playerTemplate = getControllingPlayer()->getPlayerTemplate(); // beacons are effectively dead, so we need to destroy via a non-kill() method - const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : NULL; + const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : nullptr; // now find objects to kill for (DLINK_ITERATOR iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -2698,7 +2698,7 @@ void Team::loadPostProcess( void ) // find object obj = TheGameLogic->findObjectByID( *it ); - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "Team::loadPostProcess - Unable to post process object to member list, object ID = '%d'", *it )); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 541d644a7ce..981ef781a1f 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -119,7 +119,7 @@ void TunnelTracker::swapContainedItemsList(ContainedItemsList& newList) // ------------------------------------------------------------------------ void TunnelTracker::updateNemesis(const Object *target) { - if (getCurNemesis()==NULL) { + if (getCurNemesis()==nullptr) { if (target) { if (target->isKindOf(KINDOF_VEHICLE) || target->isKindOf(KINDOF_STRUCTURE) || target->isKindOf(KINDOF_INFANTRY) || target->isKindOf(KINDOF_AIRCRAFT)) { @@ -136,11 +136,11 @@ void TunnelTracker::updateNemesis(const Object *target) Object *TunnelTracker::getCurNemesis(void) { if (m_curNemesisID == INVALID_ID) { - return NULL; + return nullptr; } if (m_nemesisTimestamp + 4*LOGICFRAMES_PER_SECOND < TheGameLogic->getFrame()) { m_curNemesisID = INVALID_ID; - return NULL; + return nullptr; } Object *target = TheGameLogic->findObjectByID(m_curNemesisID); if (target) { @@ -148,13 +148,13 @@ Object *TunnelTracker::getCurNemesis(void) if( target->testStatus( OBJECT_STATUS_STEALTHED ) && !target->testStatus( OBJECT_STATUS_DETECTED ) ) { - target = NULL; + target = nullptr; } } if (target && target->isEffectivelyDead()) { - target = NULL; + target = nullptr; } - if (target == NULL) { + if (target == nullptr) { m_curNemesisID = INVALID_ID; } return target; @@ -226,7 +226,7 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) if( m_tunnelCount == 0 ) { // Kill everyone in our contain list. Cave in! - iterateContained( destroyObject, NULL, FALSE ); + iterateContained( destroyObject, nullptr, FALSE ); m_containList.clear(); m_containListSize = 0; } @@ -332,7 +332,7 @@ void TunnelTracker::updateFullHealTime() continue; const ContainModuleInterface* contain = tunnelObj->getContain(); - DEBUG_ASSERTCRASH(contain != NULL, ("Contain module is NULL")); + DEBUG_ASSERTCRASH(contain != nullptr, ("Contain module is null")); if (!contain->isTunnelContain()) continue; @@ -429,7 +429,7 @@ void TunnelTracker::loadPostProcess( void ) { obj = TheGameLogic->findObjectByID( *it ); - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "TunnelTracker::loadPostProcess - Unable to find object ID '%d'", *it )); diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 32efa15188f..d125d9e202d 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -311,7 +311,7 @@ void RecorderClass::cleanUpReplayFile( void ) fseek(fp, 0, SEEK_END); fileSize = ftell(fp); fclose(fp); - fp = NULL; + fp = nullptr; DEBUG_LOG(("Log file size was %d", fileSize)); } @@ -337,15 +337,15 @@ void RecorderClass::cleanUpReplayFile( void ) } fclose(ofp); fclose(ifp); - ifp = NULL; - ofp = NULL; + ifp = nullptr; + ofp = nullptr; } else { if (ifp) fclose(ifp); if (ofp) fclose(ofp); - ifp = NULL; - ofp = NULL; + ifp = nullptr; + ofp = nullptr; } } #endif // DEBUG_LOGGING @@ -356,7 +356,7 @@ void RecorderClass::cleanUpReplayFile( void ) /** * The recorder object. */ -RecorderClass *TheRecorder = NULL; +RecorderClass *TheRecorder = nullptr; /** * Constructor @@ -365,7 +365,7 @@ RecorderClass::RecorderClass() { m_originalGameMode = GAME_NONE; m_mode = RECORDERMODETYPE_RECORD; - m_file = NULL; + m_file = nullptr; m_fileName.clear(); m_currentFilePosition = 0; m_doingAnalysis = FALSE; @@ -391,7 +391,7 @@ RecorderClass::~RecorderClass() { void RecorderClass::init() { m_originalGameMode = GAME_NONE; m_mode = RECORDERMODETYPE_NONE; - m_file = NULL; + m_file = nullptr; m_fileName.clear(); m_currentFilePosition = 0; m_gameInfo.clearSlotList(); @@ -413,9 +413,9 @@ void RecorderClass::init() { * Reset the recorder to the "initialized state." */ void RecorderClass::reset() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } m_fileName.clear(); @@ -470,9 +470,9 @@ void RecorderClass::updatePlayback() { * reaching the end of the playback file. */ void RecorderClass::stopPlayback() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } m_fileName.clear(); @@ -491,7 +491,7 @@ void RecorderClass::updateRecord() Bool needFlush = FALSE; static Int lastFrame = -1; GameMessage *msg = TheCommandList->getFirstMessage(); - while (msg != NULL) { + while (msg != nullptr) { if (msg->getType() == GameMessage::MSG_NEW_GAME && msg->getArgument(0)->integer != GAME_SHELL && msg->getArgument(0)->integer != GAME_NONE) { @@ -510,7 +510,7 @@ void RecorderClass::updateRecord() startRecording(diff, m_originalGameMode, rankPoints, maxFPS); } else if (msg->getType() == GameMessage::MSG_CLEAR_GAME_DATA) { - if (m_file != NULL) { + if (m_file != nullptr) { lastFrame = -1; writeToFile(msg); stopRecording(); @@ -518,7 +518,7 @@ void RecorderClass::updateRecord() } m_fileName.clear(); } else { - if (m_file != NULL) { + if (m_file != nullptr) { if ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES)) { // Only write the important messages to the file. @@ -531,7 +531,7 @@ void RecorderClass::updateRecord() } if (needFlush) { - DEBUG_ASSERTCRASH(m_file != NULL, ("RecorderClass::updateRecord() - unexpected call to fflush(m_file)")); + DEBUG_ASSERTCRASH(m_file != nullptr, ("RecorderClass::updateRecord() - unexpected call to fflush(m_file)")); m_file->flush(); } } @@ -541,7 +541,7 @@ void RecorderClass::updateRecord() * So don't call this unless you really mean it. */ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, Int rankPoints, Int maxFPS) { - DEBUG_ASSERTCRASH(m_file == NULL, ("Starting to record game while game is in progress.")); + DEBUG_ASSERTCRASH(m_file == nullptr, ("Starting to record game while game is in progress.")); reset(); @@ -556,8 +556,8 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In m_fileName.concat(getReplayExtention()); filepath.concat(m_fileName); m_file = TheFileSystem->openFile(filepath.str(), File::WRITE | File::BINARY); - if (m_file == NULL) { - DEBUG_ASSERTCRASH(m_file != NULL, ("Failed to create replay file")); + if (m_file == nullptr) { + DEBUG_ASSERTCRASH(m_file != nullptr, ("Failed to create replay file")); return; } // TheSuperHackers @info the null terminator needs to be ignored to maintain retail replay file layout @@ -668,7 +668,7 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In /// @todo fix this to use starting spots and player alliances when those are put in the game. for (Int i = 0; i < numPlayers; ++i) { Player *player = ThePlayerList->getNthPlayer(i); - if (player == NULL) { + if (player == nullptr) { continue; } UnicodeString name = player->getPlayerDisplayName(); @@ -724,9 +724,9 @@ void RecorderClass::stopRecording() { m_wasDesync = FALSE; } } - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; if (m_archiveReplays) archiveReplay(m_fileName); @@ -801,7 +801,7 @@ void RecorderClass::writeToFile(GameMessage * msg) { m_file->write(&numTypes, sizeof(numTypes)); GameMessageParserArgumentType *argType = parser->getFirstArgumentType(); - while (argType != NULL) { + while (argType != nullptr) { UnsignedByte type = (UnsignedByte)(argType->getType()); m_file->write(&type, sizeof(type)); @@ -823,7 +823,7 @@ void RecorderClass::writeToFile(GameMessage * msg) { } deleteInstance(parser); - parser = NULL; + parser = nullptr; } @@ -883,7 +883,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) const UnsignedInt buffersize = header.forPlayback ? replayBufferBytes : File::BUFFERSIZE; m_file = TheFileSystem->openFile(filepath.str(), File::READ | File::BINARY, buffersize); - if (m_file == NULL) + if (m_file == nullptr) { DEBUG_LOG(("Can't open %s (%s)", filepath.str(), header.filename.str())); return FALSE; @@ -895,7 +895,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) != 0 ) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have GENREP at the start.")); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } @@ -937,7 +937,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have a valid GameInfo string.")); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } m_gameInfo.startGame(0); @@ -950,7 +950,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) m_gameInfo.endGame(); m_gameInfo.reset(); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } if (header.localPlayerIndex >= 0) @@ -964,7 +964,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) m_gameInfo.endGame(); m_gameInfo.reset(); m_file->close(); - m_file = NULL; + m_file = nullptr; } return TRUE; @@ -1132,7 +1132,7 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f // TheSuperHackers @tweak Pause the game on mismatch. // But not when a window with focus is opened, because that can make resuming difficult. - if (TheWindowManager->winGetFocus() == NULL) + if (TheWindowManager->winGetFocus() == nullptr) { Bool pause = TRUE; Bool pauseMusic = FALSE; @@ -1438,7 +1438,7 @@ void RecorderClass::appendNextCommand() { GameMessageParserArgumentType *parserArgType = parser->getFirstArgumentType(); GameMessageArgumentDataType lasttype = ARGUMENTDATATYPE_UNKNOWN; Int argsLeftForType = 0; - if (parserArgType != NULL) { + if (parserArgType != nullptr) { lasttype = parserArgType->getType(); argsLeftForType = parserArgType->getArgCount(); } @@ -1447,14 +1447,14 @@ void RecorderClass::appendNextCommand() { --argsLeftForType; if (argsLeftForType == 0) { - DEBUG_ASSERTCRASH(parserArgType != NULL, ("parserArgType was NULL when it shouldn't have been.")); - if (parserArgType == NULL) { + DEBUG_ASSERTCRASH(parserArgType != nullptr, ("parserArgType was null when it shouldn't have been.")); + if (parserArgType == nullptr) { return; } parserArgType = parserArgType->getNext(); - // parserArgType is allowed to be NULL here, this is the case if there are no more arguments. - if (parserArgType != NULL) { + // parserArgType is allowed to be null here, this is the case if there are no more arguments. + if (parserArgType != nullptr) { argsLeftForType = parserArgType->getArgCount(); lasttype = parserArgType->getType(); } @@ -1468,11 +1468,11 @@ void RecorderClass::appendNextCommand() { else { deleteInstance(msg); - msg = NULL; + msg = nullptr; } deleteInstance(parser); - parser = NULL; + parser = nullptr; } void RecorderClass::readArgument(GameMessageArgumentDataType type, GameMessage *msg) { @@ -1625,9 +1625,9 @@ RecorderClass::CullBadCommandsResult RecorderClass::cullBadCommands() { return result; GameMessage *msg = TheCommandList->getFirstMessage(); - GameMessage *next = NULL; + GameMessage *next = nullptr; - while (msg != NULL) { + while (msg != nullptr) { next = msg->next(); if ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES) && @@ -1681,7 +1681,7 @@ AsciiString RecorderClass::getLastReplayFileName() #if defined(RTS_DEBUG) if (TheNetwork && TheGlobalData->m_saveStats) { - GameInfo *game = NULL; + GameInfo *game = nullptr; if (TheLAN) game = TheLAN->GetMyGame(); else if (TheGameSpyInfo) @@ -1763,7 +1763,7 @@ RecorderModeType RecorderClass::getMode() { void RecorderClass::initControls() { NameKeyType parentReplayControlID = TheNameKeyGenerator->nameToKey( "ReplayControl.wnd:ParentReplayControl" ); - GameWindow *parentReplayControl = TheWindowManager->winGetWindowFromId( NULL, parentReplayControlID ); + GameWindow *parentReplayControl = TheWindowManager->winGetWindowFromId( nullptr, parentReplayControlID ); Bool show = (getMode() != RECORDERMODETYPE_PLAYBACK); if (parentReplayControl) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index 96771ee1e2d..a4b98e048d0 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -266,12 +266,12 @@ StateMachine::StateMachine( Object *owner, AsciiString name ) m_sleepTill = 0; m_defaultStateID = INVALID_STATE_ID; m_defaultStateInited = false; - m_currentState = NULL; + m_currentState = nullptr; m_locked = false; #ifdef STATE_MACHINE_DEBUG m_name = name; m_debugOutput = false; - m_lockedby = NULL; + m_lockedby = nullptr; #endif internalClear(); } @@ -311,7 +311,7 @@ Bool StateMachine::getWantsDebugOutput() const } #ifdef DEBUG_OBJECT_ID_EXISTS - if (TheObjectIDToDebug != 0 && getOwner() != NULL && getOwner()->getID() == TheObjectIDToDebug) + if (TheObjectIDToDebug != 0 && getOwner() != nullptr && getOwner()->getID() == TheObjectIDToDebug) { return true; } @@ -359,7 +359,7 @@ void StateMachine::clear() if (m_currentState) m_currentState->onExit( EXIT_RESET ); - m_currentState = NULL; + m_currentState = nullptr; internalClear(); } @@ -389,7 +389,7 @@ StateReturnType StateMachine::resetToDefaultState() // allow current state to exit with EXIT_RESET if present if (m_currentState) m_currentState->onExit( EXIT_RESET ); - m_currentState = NULL; + m_currentState = nullptr; // // the current state has done an onExit, clear the internal guts before we set @@ -416,7 +416,7 @@ StateReturnType StateMachine::updateStateMachine() UnsignedInt now = TheGameLogic->getFrame(); if (m_sleepTill != 0 && now < m_sleepTill) { - if( m_currentState == NULL ) + if( m_currentState == nullptr ) { return STATE_FAILURE; } @@ -441,7 +441,7 @@ StateReturnType StateMachine::updateStateMachine() StateReturnType status = m_currentState->update(); // it is possible that the state's update() method clears the state machine. - if (m_currentState == NULL) + if (m_currentState == nullptr) { return STATE_FAILURE; } @@ -497,7 +497,7 @@ void StateMachine::defineState( StateID id, State *state, StateID successID, Sta state->friend_onSuccess(successID); state->friend_onFailure(failureID); - while (conditions && conditions->test != NULL) + while (conditions && conditions->test != nullptr) { state->friend_onCondition(conditions->test, conditions->toStateID, conditions->userData); ++conditions; @@ -555,7 +555,7 @@ StateReturnType StateMachine::setState( StateID newStateID ) */ StateReturnType StateMachine::internalSetState( StateID newStateID ) { - State *newState = NULL; + State *newState = nullptr; // anytime the state changes, stop sleeping m_sleepTill = 0; @@ -616,7 +616,7 @@ StateReturnType StateMachine::internalSetState( StateID newStateID ) StateReturnType status = m_currentState->onEnter(); // it is possible that the state's onEnter() method may cause the state to be destroyed - if (m_currentState == NULL) + if (m_currentState == nullptr) { return STATE_FAILURE; } @@ -706,7 +706,7 @@ StateReturnType StateMachine::initDefaultState() } REALLY_VERBOSE_LOG(("\n")); delete ids; - ids = NULL; + ids = nullptr; } REALLY_VERBOSE_LOG(("SM_END\n\n")); #endif @@ -740,14 +740,14 @@ Bool StateMachine::isGoalObjectDestroyed() const { return false; // never had a goal object } - return getGoalObject() == NULL; + return getGoalObject() == nullptr; } //----------------------------------------------------------------------------- void StateMachine::halt() { m_locked = true; - m_currentState = NULL; // don't exit current state, just clear it. + m_currentState = nullptr; // don't exit current state, just clear it. #ifdef STATE_MACHINE_DEBUG if (getWantsDebugOutput()) { diff --git a/Generals/Code/GameEngine/Source/Common/StatsCollector.cpp b/Generals/Code/GameEngine/Source/Common/StatsCollector.cpp index 9f05592a707..259dba75dfd 100644 --- a/Generals/Code/GameEngine/Source/Common/StatsCollector.cpp +++ b/Generals/Code/GameEngine/Source/Common/StatsCollector.cpp @@ -65,7 +65,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -StatsCollector *TheStatsCollector = NULL; +StatsCollector *TheStatsCollector = nullptr; static char statsDir[255] = "Stats\\"; //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 25e2a59e429..431c40ccc91 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -56,7 +56,7 @@ #include "GameLogic/Module/ParkingPlaceBehavior.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -BuildAssistant *TheBuildAssistant = NULL; +BuildAssistant *TheBuildAssistant = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -90,7 +90,7 @@ ObjectSellInfo::~ObjectSellInfo( void ) static Bool isDozer( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; if( obj->isKindOf(KINDOF_DOZER)) @@ -107,7 +107,7 @@ static Bool isDozer( Object *obj ) BuildAssistant::BuildAssistant( void ) { - m_buildPositions = NULL; + m_buildPositions = nullptr; m_buildPositionSize = 0; m_sellList.clear(); } @@ -118,7 +118,7 @@ BuildAssistant::~BuildAssistant( void ) { delete [] m_buildPositions; - m_buildPositions = NULL; + m_buildPositions = nullptr; m_buildPositionSize = 0; } @@ -190,7 +190,7 @@ void BuildAssistant::update( void ) // if object is not found, remove it from the list immediately ... this is valid as // the object maybe was destroyed by other means during the sell process // - if( obj == NULL ) + if( obj == nullptr ) { deleteInstance(sellInfo); @@ -323,11 +323,11 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe { // sanity - if( what == NULL || pos == NULL ) - return NULL; + if( what == nullptr || pos == nullptr ) + return nullptr; - if( owningPlayer == NULL ) - return NULL;// Invalid pointer. Won't happen. + if( owningPlayer == nullptr ) + return nullptr;// Invalid pointer. Won't happen. // sanity if( constructorObject ) @@ -340,7 +340,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe // Need to validate that we can make this in case someone fakes their CommandSet // A Null constructorObject is used by the script engine to cheat, so let it slide if( constructorObject && !isPossibleToMakeUnit(constructorObject, what) ) - return NULL; + return nullptr; // clear out any objects from the building area that are "auto-clearable" when building clearRemovableForConstruction( what, pos, angle ); @@ -350,7 +350,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe // totally bogus. We tried to move our units out of the way, but they wouldn't. // Chode-boys. if (owningPlayer->getPlayerType()==PLAYER_HUMAN) { - return NULL; // ai gets to cheat. jba. + return nullptr; // ai gets to cheat. jba. } } @@ -364,7 +364,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe ai->aiIdle(CMD_FROM_AI); // stop any current behavior. return ai->construct( what, pos, angle, owningPlayer, FALSE ); } - return NULL; + return nullptr; } else @@ -431,7 +431,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } - return NULL; + return nullptr; } @@ -446,7 +446,7 @@ void BuildAssistant::buildObjectLineNow( Object *constructorObject, const ThingT TileBuildInfo *tileBuildInfo; // sanity - if( what == NULL || start == NULL || end == NULL ) + if( what == nullptr || start == nullptr || end == nullptr ) return; // how big are each of our objects @@ -548,7 +548,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, { // sanity - if( build == NULL || worldPos == NULL || func == NULL ) + if( build == nullptr || worldPos == nullptr || func == nullptr ) return; // @@ -716,7 +716,7 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, Real range = 2*(build->getTemplateGeometryInfo().getMajorRadius()+build->getTemplateGeometryInfo().getMinorRadius()); PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; ObjectIterator *iter2 = ThePartitionManager->iterateObjectsInRange(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); MemoryPoolObjectHolder hold2(iter2); @@ -832,9 +832,9 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, } //------------------------------------------------------------------------------------------------- -/** Query if we can build at this location. Note that 'build' may be null and is NOT required +/** Query if we can build at this location. Note that 'build' may be nullptr and is NOT required * to be valid to know if a location is legal to build at. 'builderObject' is used - * for queries that require a pathfind check and should be NULL if not required */ + * for queries that require a pathfind check and should be null if not required */ //------------------------------------------------------------------------------------------------- LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, const ThingTemplate *build, @@ -899,12 +899,12 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, { // special case for supply centers: can't build too close to supply sources PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_SUPPLY_SOURCE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; // see if there are any reasonably close by Real range = build->getTemplateGeometryInfo().getBoundingCircleRadius() + TheGlobalData->m_SupplyBuildBorder*2; Object* tooClose = ThePartitionManager->getClosestObject(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); - if (tooClose != NULL) + if (tooClose != nullptr) { // yep, see if we would collide with an expanded version GeometryInfo tooCloseGeom = tooClose->getGeometryInfo(); @@ -935,7 +935,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, /**todo remove this if we need to change the semantics of this function of the builderObject // actually being able to get to the destination */ // - if( ai == NULL ) + if( ai == nullptr ) return LBC_NO_CLEAR_PATH; // @@ -1024,7 +1024,7 @@ void BuildAssistant::addBibs(const Coord3D *worldPos, range += 3*build->getTemplateGeometryInfo().getMajorRadius(); PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); @@ -1067,8 +1067,8 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT { // sanity - if( start == NULL || end == NULL ) - return 0; + if( start == nullptr || end == nullptr ) + return nullptr; // // we will fill out our own internal array of positions, it better be big enough to @@ -1143,7 +1143,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, builderObject, - NULL) != LBC_OK ) + nullptr) != LBC_OK ) break; // save the position in the output array @@ -1170,7 +1170,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT Bool BuildAssistant::isLineBuildTemplate( const ThingTemplate *tTemplate ) { // sanity - if( tTemplate == NULL ) + if( tTemplate == nullptr ) return FALSE; if( tTemplate->isKindOf(KINDOF_LINEBUILD)) @@ -1190,14 +1190,14 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate { // sanity - if( builder == NULL || whatToBuild == NULL ) + if( builder == nullptr || whatToBuild == nullptr ) return FALSE; // get the command set for the producer object const CommandSet *commandSet = TheControlBar->findCommandSet( builder->getCommandSetString() ); // if no command set we cannot build anything - if( commandSet == NULL ) + if( commandSet == nullptr ) { DEBUG_ASSERTLOG( 0, ("Can't build a '%s' from the builder '%s' because '%s' doesn't have any command set defined", @@ -1214,7 +1214,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate // so that nobody can hack one game and cheat to make stuff that they can't usually make // const CommandButton *commandButton; - const CommandButton *foundCommand = NULL; + const CommandButton *foundCommand = nullptr; Int i; for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { @@ -1227,7 +1227,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate foundCommand = commandButton; } - if( foundCommand == NULL ) + if( foundCommand == nullptr ) return FALSE; // make sure that the player can actually make this unit by checking prereqs and such @@ -1274,7 +1274,7 @@ CanMakeType BuildAssistant::canMakeUnit( Object *builder, const ThingTemplate *w { // sanity - if( builder == NULL || whatToBuild == NULL ) + if( builder == nullptr || whatToBuild == nullptr ) return CANMAKE_NO_PREREQ; if (builder->testScriptStatusBit(OBJECT_STATUS_SCRIPT_DISABLED) || builder->testScriptStatusBit(OBJECT_STATUS_SCRIPT_UNPOWERED)) @@ -1284,7 +1284,7 @@ CanMakeType BuildAssistant::canMakeUnit( Object *builder, const ThingTemplate *w return CANMAKE_NO_PREREQ; ProductionUpdateInterface* pu = builder->getProductionUpdateInterface(); - if (pu != NULL) + if (pu != nullptr) { CanMakeType cmt = pu->canQueueCreateUnit(whatToBuild); if (cmt != CANMAKE_OK) @@ -1330,7 +1330,7 @@ Bool BuildAssistant::isRemovableForConstruction( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; if (obj->isKindOf(KINDOF_INERT)) @@ -1473,7 +1473,7 @@ void BuildAssistant::sellObject( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // we can only sell structures ... sanity check this @@ -1481,7 +1481,7 @@ void BuildAssistant::sellObject( Object *obj ) return; // if object already has an entry in the sell list, we shouldn't try to sell it again - ObjectSellInfo *sellInfo = NULL; + ObjectSellInfo *sellInfo = nullptr; ObjectSellListIterator it; for( it = m_sellList.begin(); it != m_sellList.end(); ++it ) { @@ -1490,10 +1490,10 @@ void BuildAssistant::sellObject( Object *obj ) if( sellInfo->m_id == obj->getID() ) break; else - sellInfo = NULL; + sellInfo = nullptr; } - if( sellInfo != NULL ) + if( sellInfo != nullptr ) return; // set the construction percent of this object just below 100.0% so we can start counting down diff --git a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp b/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp index a50549597e5..56d180e5175 100644 --- a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp @@ -77,7 +77,7 @@ // Public Data //---------------------------------------------------------------------------- -CDManagerInterface* TheCDManager = NULL; +CDManagerInterface* TheCDManager = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -222,7 +222,7 @@ Int CDManager::driveCount( void ) CDDriveInterface* CDManager::getDrive( Int index ) { - CDDriveInterface *cd = NULL; + CDDriveInterface *cd = nullptr; LListNode *node = m_drives.getNode( index ); if ( node ) @@ -280,7 +280,7 @@ void CDManager::destroyAllDrives( void ) { LListNode *node; - while ( (node = m_drives.firstNode() ) != NULL ) + while ( (node = m_drives.firstNode() ) != nullptr ) { node->remove(); CDDriveInterface *drive = (CDDriveInterface *) node->item(); diff --git a/Generals/Code/GameEngine/Source/Common/System/CriticalSection.cpp b/Generals/Code/GameEngine/Source/Common/System/CriticalSection.cpp index 37f4351ffe4..6be4ec457b2 100644 --- a/Generals/Code/GameEngine/Source/Common/System/CriticalSection.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/CriticalSection.cpp @@ -27,11 +27,11 @@ #include "Common/CriticalSection.h" // Definitions. -CriticalSection *TheAsciiStringCriticalSection = NULL; -CriticalSection *TheUnicodeStringCriticalSection = NULL; -CriticalSection *TheDmaCriticalSection = NULL; -CriticalSection *TheMemoryPoolCriticalSection = NULL; -CriticalSection *TheDebugLogCriticalSection = NULL; +CriticalSection *TheAsciiStringCriticalSection = nullptr; +CriticalSection *TheUnicodeStringCriticalSection = nullptr; +CriticalSection *TheDmaCriticalSection = nullptr; +CriticalSection *TheMemoryPoolCriticalSection = nullptr; +CriticalSection *TheDebugLogCriticalSection = nullptr; #ifdef PERF_TIMERS PerfGather TheCritSecPerfGather("CritSec"); diff --git a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp index 63f980cb58e..c0a416a9efb 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -37,14 +37,14 @@ // If verbose, lots of debug logging. #define not_VERBOSE -CachedFileInputStream::CachedFileInputStream(void):m_buffer(NULL),m_size(0) +CachedFileInputStream::CachedFileInputStream(void):m_buffer(nullptr),m_size(0) { } CachedFileInputStream::~CachedFileInputStream(void) { delete[] m_buffer; - m_buffer=NULL; + m_buffer=nullptr; } Bool CachedFileInputStream::open(AsciiString path) @@ -56,7 +56,7 @@ Bool CachedFileInputStream::open(AsciiString path) m_size=file->size(); if (m_size) { m_buffer = file->readEntireAndClose(); - file = NULL; + file = nullptr; } m_pos=0; } @@ -102,7 +102,7 @@ Bool CachedFileInputStream::open(AsciiString path) void CachedFileInputStream::close(void) { delete[] m_buffer; - m_buffer=NULL; + m_buffer=nullptr; m_pos=0; m_size=0; @@ -154,36 +154,36 @@ void CachedFileInputStream::rewind() // FileInputStream - helper class. Used to read in data using a FILE * // /* -FileInputStream::FileInputStream(void):m_file(NULL) +FileInputStream::FileInputStream(void):m_file(nullptr) { } FileInputStream::~FileInputStream(void) { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } } Bool FileInputStream::open(AsciiString path) { m_file = TheFileSystem->openFile(path.str(), File::READ | File::BINARY); - return m_file==NULL?false:true; + return m_file == nullptr?false:true; } void FileInputStream::close(void) { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } } Int FileInputStream::read(void *pData, Int numBytes) { int bytesRead = 0; - if (m_file != NULL) { + if (m_file != nullptr) { bytesRead = m_file->read(pData, numBytes); } return(bytesRead); @@ -192,7 +192,7 @@ Int FileInputStream::read(void *pData, Int numBytes) UnsignedInt FileInputStream::tell(void) { UnsignedInt pos = 0; - if (m_file != NULL) { + if (m_file != nullptr) { pos = m_file->position(); } return(pos); @@ -200,7 +200,7 @@ UnsignedInt FileInputStream::tell(void) Bool FileInputStream::absoluteSeek(UnsignedInt pos) { - if (m_file != NULL) { + if (m_file != nullptr) { return (m_file->seek(pos, File::START) != -1); } return(false); @@ -208,7 +208,7 @@ Bool FileInputStream::absoluteSeek(UnsignedInt pos) Bool FileInputStream::eof(void) { - if (m_file != NULL) { + if (m_file != nullptr) { return (m_file->size() == m_file->position()); } return(true); @@ -216,7 +216,7 @@ Bool FileInputStream::eof(void) void FileInputStream::rewind() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->seek(0, File::START); } } @@ -237,7 +237,7 @@ m_pOut(pOut) AsciiString tmpFileName = TheGlobalData->getPath_UserData(); tmpFileName.concat(TEMP_FILENAME); m_tmp_file = ::fopen( tmpFileName.str(), "wb" ); - m_chunkStack = NULL; + m_chunkStack = nullptr; } DataChunkOutput::~DataChunkOutput() @@ -296,7 +296,7 @@ void DataChunkOutput::openDataChunk( const char *name, DataChunkVersionType ver void DataChunkOutput::closeDataChunk( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception return; @@ -414,7 +414,7 @@ void DataChunkOutput::writeDict( const Dict& d ) //---------------------------------------------------------------------- DataChunkTableOfContents::DataChunkTableOfContents( void ) : -m_list(NULL), +m_list(nullptr), m_nextID(1), m_listLength(0), m_headerOpened(false) @@ -442,7 +442,7 @@ Mapping *DataChunkTableOfContents::findMapping( const AsciiString& name ) if (name == m->name ) return m; - return NULL; + return nullptr; } // convert name to integer identifier @@ -574,10 +574,10 @@ void DataChunkTableOfContents::read( ChunkInputStream &s) // DataChunkInput //---------------------------------------------------------------------- DataChunkInput::DataChunkInput( ChunkInputStream *pStream ) : m_file( pStream ), - m_userData(NULL), - m_currentObject(NULL), - m_chunkStack(NULL), - m_parserList(NULL) + m_userData(nullptr), + m_currentObject(nullptr), + m_chunkStack(nullptr), + m_parserList(nullptr) { // read table of m_contents m_contents.read(*m_file); @@ -694,7 +694,7 @@ void DataChunkInput::clearChunkStack( void ) deleteInstance(c); } - m_chunkStack = NULL; + m_chunkStack = nullptr; } // reset the stream to just-opened state - ready to parse the first chunk @@ -747,7 +747,7 @@ AsciiString DataChunkInput::openDataChunk(DataChunkVersionType *ver ) // close chunk and move to start of next chunk void DataChunkInput::closeDataChunk( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception return; @@ -771,7 +771,7 @@ void DataChunkInput::closeDataChunk( void ) // return label of current data chunk AsciiString DataChunkInput::getChunkLabel( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); @@ -784,11 +784,11 @@ AsciiString DataChunkInput::getChunkLabel( void ) // return version of current data chunk DataChunkVersionType DataChunkInput::getChunkVersion( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->version; @@ -797,11 +797,11 @@ DataChunkVersionType DataChunkInput::getChunkVersion( void ) // return size of data stored in this chunk UnsignedInt DataChunkInput::getChunkDataSize( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->dataSize; @@ -811,11 +811,11 @@ UnsignedInt DataChunkInput::getChunkDataSize( void ) // return size of data left to read in this chunk UnsignedInt DataChunkInput::getChunkDataSizeLeft( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->dataLeft; diff --git a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 7bc538d7cdb..339d71f9b1b 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -45,7 +45,7 @@ const char* const DisabledMaskType::s_bitNameList[] = "DISABLED_SCRIPT_DISABLED", "DISABLED_SCRIPT_UNDERPOWERED", - NULL + nullptr }; static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 093f5e068a0..da6d08e0a68 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -65,7 +65,7 @@ static FunctionLexicon::TableEntry gameWinDrawTable[] = { { NAMEKEY_INVALID, "IMECandidateMainDraw", IMECandidateMainDraw }, { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", IMECandidateTextAreaDraw }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; // game window system table ----------------------------------------------------------------------- @@ -148,7 +148,7 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = { NAMEKEY_INVALID, "ScoreScreenSystem", ScoreScreenSystem }, { NAMEKEY_INVALID, "DownloadMenuSystem", DownloadMenuSystem }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -219,7 +219,7 @@ static FunctionLexicon::TableEntry gameWinInputTable[] = { NAMEKEY_INVALID, "DownloadMenuInput", DownloadMenuInput }, { NAMEKEY_INVALID, "IMECandidateWindowInput", IMECandidateWindowInput }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -230,7 +230,7 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = { NAMEKEY_INVALID, "GameWinDefaultTooltip", GameWinDefaultTooltip }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -281,7 +281,7 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -320,7 +320,7 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -360,14 +360,14 @@ static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA /////////////////////////////////////////////////////////////////////////////////////////////////// -FunctionLexicon *TheFunctionLexicon = NULL; ///< the function dictionary +FunctionLexicon *TheFunctionLexicon = nullptr; ///< the function dictionary //------------------------------------------------------------------------------------------------- /** Since we have a convenient table to organize our callbacks anyway, @@ -380,7 +380,7 @@ void FunctionLexicon::loadTable( TableEntry *table, { // sanity - if( table == NULL ) + if( table == nullptr ) return; // loop through all entries @@ -409,7 +409,7 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) // sanity if( key == NAMEKEY_INVALID ) - return NULL; + return nullptr; // search table for key TableEntry *entry = table; @@ -422,7 +422,7 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) } - return NULL; // not found + return nullptr; // not found } @@ -433,11 +433,11 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) //------------------------------------------------------------------------------------------------- void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) { - void *func = NULL; + void *func = nullptr; // sanity if( key == NAMEKEY_INVALID ) - return NULL; + return nullptr; // search ALL tables for function if the index paramater allows if if( index == TABLE_ANY ) @@ -475,8 +475,8 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) { // sanity - if( func == NULL ) - return NULL; + if( func == nullptr ) + return nullptr; // search the table TableEntry *entry = table; @@ -492,7 +492,7 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) } - return NULL; // not found + return nullptr; // not found } #endif @@ -509,7 +509,7 @@ FunctionLexicon::FunctionLexicon( void ) // empty the tables for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) - m_tables[ i ] = NULL; + m_tables[ i ] = nullptr; } @@ -577,12 +577,12 @@ char *FunctionLexicon::functionToName( void *func ) { // sanity - if( func == NULL ) - return NULL; + if( func == nullptr ) + return nullptr; // search ALL the tables Int i; - char *name = NULL; + char *name = nullptr; for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) { @@ -592,7 +592,7 @@ char *FunctionLexicon::functionToName( void *func ) } - return NULL; // not found + return nullptr; // not found } */ @@ -622,7 +622,7 @@ Bool FunctionLexicon::validate( void ) // // scan all tables looking for the function in sourceEntry, do not bother - // of source entry is NULL (a valid entry in the table, but not a function) + // of source entry is nullptr (a valid entry in the table, but not a function) // if( sourceEntry->func ) { @@ -682,7 +682,7 @@ GameWinDrawFunc FunctionLexicon::gameWinDrawFunc( NameKeyType key, TableIndex in GameWinDrawFunc func; func = (GameWinDrawFunc)findFunction( key, TABLE_GAME_WIN_DEVICEDRAW ); - if ( func == NULL ) + if ( func == nullptr ) { func = (GameWinDrawFunc)findFunction( key, TABLE_GAME_WIN_DRAW ); } @@ -700,7 +700,7 @@ WindowLayoutInitFunc FunctionLexicon::winLayoutInitFunc( NameKeyType key, TableI WindowLayoutInitFunc func; func = (WindowLayoutInitFunc)findFunction( key, TABLE_WIN_LAYOUT_DEVICEINIT ); - if ( func == NULL ) + if ( func == nullptr ) { func = (WindowLayoutInitFunc)findFunction( key, TABLE_WIN_LAYOUT_INIT ); } diff --git a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp index 83d39945665..480e7e3464d 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -36,7 +36,7 @@ const char *const TheVeterancyNames[] = "VETERAN", "ELITE", "HEROIC", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheVeterancyNames) == LEVEL_COUNT + 1, "Incorrect array size"); @@ -45,7 +45,7 @@ const char *const TheRelationshipNames[] = "ENEMIES", "NEUTRAL", "ALLIES", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheRelationshipNames) == RELATIONSHIP_COUNT + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp b/Generals/Code/GameEngine/Source/Common/System/GameType.cpp index 185f9c36e95..f0f5adb9cd5 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameType.cpp @@ -34,7 +34,7 @@ const char *const TimeOfDayNames[] = "EVENING", "NIGHT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TimeOfDayNames) == TIME_OF_DAY_COUNT + 1, "Incorrect array size"); @@ -43,6 +43,6 @@ const char *const WeatherNames[] = "NORMAL", "SNOWY", - NULL + nullptr }; static_assert(ARRAY_SIZE(WeatherNames) == WEATHER_COUNT + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp b/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp index 0d77c3ffc6e..55b79b6dacf 100644 --- a/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -131,7 +131,7 @@ const char* const KindOfMaskType::s_bitNameList[] = "HERO", "IGNORES_SELECT_ALL", "DONT_AUTO_CRUSH_INFANTRY", - NULL + nullptr }; static_assert(ARRAY_SIZE(KindOfMaskType::s_bitNameList) == KindOfMaskType::NumBits + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/List.cpp b/Generals/Code/GameEngine/Source/Common/System/List.cpp index 5243135f519..cf6bc82342f 100644 --- a/Generals/Code/GameEngine/Source/Common/System/List.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/List.cpp @@ -206,7 +206,7 @@ void LList::clear( void ) { LListNode *node; - while ( (node = firstNode()) != NULL ) + while ( (node = firstNode()) != nullptr ) { node->remove(); node->destroy(); @@ -252,7 +252,7 @@ LListNode* LList::getNode( Int index ) node = node->next(); } - return NULL; + return nullptr; } //============================================================================ @@ -262,7 +262,7 @@ LListNode* LList::getNode( Int index ) void LList::merge( LList *list ) { - if ( list == NULL || list->isEmpty() ) + if ( list == nullptr || list->isEmpty() ) { return; } @@ -282,7 +282,7 @@ void LList::merge( LList *list ) Bool LList::hasItem( void *item ) { - return findItem( item ) != NULL; + return findItem( item ) != nullptr; } //============================================================================ @@ -304,7 +304,7 @@ LListNode* LList::findItem( void *item ) node = node->next(); } - return NULL; + return nullptr; } //============================================================================ @@ -313,7 +313,7 @@ LListNode* LList::findItem( void *item ) LListNode::LListNode() : m_pri(0), - m_item(NULL), + m_item(nullptr), m_autoDelete(FALSE) { m_next = m_prev = this; @@ -363,7 +363,7 @@ LListNode* LListNode::next( void ) if( m_next->isHead( )) { - return NULL; + return nullptr; } return m_next; @@ -377,7 +377,7 @@ LListNode* LListNode::prev( void ) { if( m_prev->isHead()) { - return NULL; + return nullptr; } return m_prev; @@ -399,7 +399,7 @@ LListNode* LListNode::loopNext( void ) next = next->m_next; if( next->isHead( )) { - return NULL; // it is an empty list + return nullptr; // it is an empty list } } @@ -422,7 +422,7 @@ LListNode* LListNode::loopPrev( void ) prev = prev->m_prev; if( prev->isHead()) { - return NULL; // it is an empty list + return nullptr; // it is an empty list } } diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index 2fd84f01c3c..4d51e3c571e 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -61,7 +61,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameState *TheGameState = NULL; +GameState *TheGameState = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static const Char *SAVE_FILE_EOF = "SG_EOF"; @@ -180,7 +180,7 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn // sanity if( token.isEmpty() ) - return NULL; + return nullptr; // search for match our list SnapshotBlock *blockInfo; @@ -198,7 +198,7 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn } // not found - return NULL; + return nullptr; } @@ -220,7 +220,7 @@ UnicodeString getUnicodeDateBuffer(SYSTEMTIME timeVal) GetDateFormat( LOCALE_SYSTEM_DEFAULT, DATE_SHORTDATE, &timeVal, - NULL, + nullptr, dateBuffer, sizeof(dateBuffer) ); displayDateBuffer.translate(dateBuffer); return displayDateBuffer; @@ -230,7 +230,7 @@ UnicodeString getUnicodeDateBuffer(SYSTEMTIME timeVal) GetDateFormatW( LOCALE_SYSTEM_DEFAULT, DATE_SHORTDATE, &timeVal, - NULL, + nullptr, dateBuffer, ARRAY_SIZE(dateBuffer) ); displayDateBuffer.set(dateBuffer); return displayDateBuffer; @@ -251,7 +251,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GetTimeFormat( LOCALE_SYSTEM_DEFAULT, TIME_NOSECONDS|TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &timeVal, - NULL, + nullptr, timeBuffer, sizeof(timeBuffer) ); displayTimeBuffer.translate(timeBuffer); return displayTimeBuffer; @@ -263,7 +263,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GetTimeFormatW( LOCALE_SYSTEM_DEFAULT, TIME_NOSECONDS, &timeVal, - NULL, + nullptr, timeBuffer, ARRAY_SIZE(timeBuffer) ); displayTimeBuffer.set(timeBuffer); @@ -276,7 +276,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GameState::GameState( void ) { - m_availableGames = NULL; + m_availableGames = nullptr; m_isInLoadGame = FALSE; } @@ -376,7 +376,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna { // sanity - if( blockName.isEmpty() || snapshot == NULL ) + if( blockName.isEmpty() || snapshot == nullptr ) { DEBUG_CRASH(( "addSnapshotBlock: Invalid parameters" )); @@ -549,7 +549,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, } // make absolutely sure the save directory exists - CreateDirectory( getSaveDirectory().str(), NULL ); + CreateDirectory( getSaveDirectory().str(), nullptr ); // construct path to file AsciiString filepath = getFilePathInSaveDirectory(filename); @@ -599,7 +599,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, UnicodeString msg; msg.format( TheGameText->fetch("GUI:ErrorSavingGame"), ufilepath.str() ); - MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, nullptr); // close the file and get out of here xferSave.close(); @@ -725,7 +725,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) UnicodeString msg; msg.format( TheGameText->fetch("GUI:ErrorLoadingGame"), ufilepath.str() ); - MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, nullptr); return SC_INVALID_DATA; // you can't use a naked "throw" outside of a catch statement! @@ -793,7 +793,7 @@ AsciiString GameState::getMapLeafName(const AsciiString& in) const // at the name only // ++p; - DEBUG_ASSERTCRASH( p != NULL && *p != 0, ("GameState::xfer - Illegal map name encountered") ); + DEBUG_ASSERTCRASH( p != nullptr && *p != 0, ("GameState::xfer - Illegal map name encountered") ); return p; } else @@ -811,7 +811,7 @@ static const char* findLastBackslashInRangeInclusive(const char* start, const ch return end; --end; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -981,7 +981,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav SnapshotBlock *blockInfo; // sanity - if( filename.isEmpty() == TRUE || saveGameInfo == NULL ) + if( filename.isEmpty() == TRUE || saveGameInfo == nullptr ) { DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Illegal parameters" )); @@ -1020,7 +1020,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // find matching token in the save file lexicon blockInfo = findBlockInfoByToken( token, SNAPSHOT_SAVELOAD ); - if( blockInfo == NULL ) + if( blockInfo == nullptr ) throw SC_UNKNOWN_BLOCK; // read the data size of this block @@ -1083,7 +1083,7 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) AvailableGameInfo **listHead = (AvailableGameInfo **)userData; // sanity - DEBUG_ASSERTCRASH( listHead != NULL, ("addGameToAvailableList - Illegal parameters") ); + DEBUG_ASSERTCRASH( listHead != nullptr, ("addGameToAvailableList - Illegal parameters") ); DEBUG_ASSERTCRASH( filename.isEmpty() == FALSE, ("addGameToAvailableList - Illegal filename") ); try { @@ -1095,20 +1095,20 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) AvailableGameInfo *newInfo = new AvailableGameInfo; // assign data - newInfo->prev = NULL; - newInfo->next = NULL; + newInfo->prev = nullptr; + newInfo->next = nullptr; newInfo->saveGameInfo = saveGameInfo; newInfo->filename = filename; // attach to list - if( *listHead == NULL ) + if( *listHead == nullptr ) *listHead = newInfo; else { AvailableGameInfo *curr, *prev; // insert this info so that the most recent games are always at the top of this list - for( curr = *listHead; curr != NULL; curr = curr->next ) + for( curr = *listHead; curr != nullptr; curr = curr->next ) { // save current as previous @@ -1133,7 +1133,7 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) } // if not inserted, put at end - if( curr == NULL ) + if( curr == nullptr ) { prev->next = newInfo; @@ -1157,7 +1157,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType Int index; // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // first clear all entries in the listbox @@ -1170,7 +1170,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType Color newGameColor = GameMakeColor( 200, 200, 255, 255 ); index = GadgetListBoxAddEntryText( listbox, newGameText, newGameColor, -1 ); - GadgetListBoxSetItemData( listbox, NULL, index ); + GadgetListBoxSetItemData( listbox, nullptr, index ); } @@ -1254,7 +1254,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa { // sanity - if( callback == NULL ) + if( callback == nullptr ) return; // save the current directory @@ -1342,7 +1342,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) { // sanity - if( xfer == NULL ) + if( xfer == nullptr ) throw SC_INVALID_XFER; // save or load all blocks @@ -1437,7 +1437,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // find matching token in the save file lexicon blockInfo = findBlockInfoByToken( token, which ); - if( blockInfo == NULL ) + if( blockInfo == nullptr ) { // log the block not found @@ -1492,7 +1492,7 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) { // sanity - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_CRASH(( "GameState::addPostProcessSnapshot - invalid parameters" )); @@ -1621,7 +1621,7 @@ void GameState::xfer( Xfer *xfer ) if (exists == FALSE || saveGameInfo->mapLabel == AsciiString::TheEmptyString) { const char* p = TheGlobalData->m_mapName.reverseFind('\\'); - if (p == NULL) + if (p == nullptr) saveGameInfo->mapLabel = TheGlobalData->m_mapName; else { diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index c10fc093f42..5b5e9ac3fed 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -41,7 +41,7 @@ #include "GameNetwork/GameInfo.h" // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -GameStateMap *TheGameStateMap = NULL; +GameStateMap *TheGameStateMap = nullptr; // METHODS //////////////////////////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // open the map file File *file = TheFileSystem->openFile( map.str(), File::READ | File::BINARY ); - if( file == NULL ) + if( file == nullptr ) { DEBUG_CRASH(( "embedPristineMap - Error opening source file '%s'", map.str() )); @@ -90,7 +90,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // allocate buffer big enough to hold the entire map file char *buffer = new char[ fileSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "embedPristineMap - Unable to allocate buffer for file '%s'", map.str() )); @@ -130,7 +130,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) FILE *fp = fopen( map.str(), "rb" ); // sanity - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_CRASH(( "embedInUseMap - Unable to open file '%s'", map.str() )); @@ -147,7 +147,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) // allocate a buffer big enough for the entire file char *buffer = new char[ fileSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "embedInUseMap - Unable to allocate buffer for file '%s'", map.str() )); @@ -186,7 +186,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // open handle to output file FILE *fp = fopen( mapToSave.str(), "w+b" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_CRASH(( "extractAndSaveMap - Unable to open file '%s'", mapToSave.str() )); @@ -199,7 +199,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // allocate buffer big enough for the entire map file char *buffer = new char[ dataSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "extractAndSaveMap - Unable to allocate buffer for file '%s'", mapToSave.str() )); @@ -406,7 +406,7 @@ void GameStateMap::xfer( Xfer *xfer ) TheGameClient->setDrawableIDCounter( highDrawableID ); if (TheGameLogic->getGameMode()==GAME_SKIRMISH) { - if (TheSkirmishGameInfo==NULL) { + if (TheSkirmishGameInfo==nullptr) { TheSkirmishGameInfo = NEW SkirmishGameInfo; TheSkirmishGameInfo->init(); TheSkirmishGameInfo->clearSlotList(); @@ -415,7 +415,7 @@ void GameStateMap::xfer( Xfer *xfer ) xfer->xferSnapshot(TheSkirmishGameInfo); } else { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } // diff --git a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp index a1c06976e66..e248d5d6ff3 100644 --- a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -59,7 +59,7 @@ void StackDumpDefaultHandler(const char*line) //***************************************************************************** void StackDump(void (*callback)(const char*)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -89,7 +89,7 @@ _asm //***************************************************************************** void StackDumpFromContext(DWORD eip,DWORD esp,DWORD ebp, void (*callback)(const char*)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -127,10 +127,10 @@ BOOL InitSymbolInfo() process = GetCurrentProcess(); //Get the apps name - ::GetModuleFileName(NULL, pathname, _MAX_PATH); + ::GetModuleFileName(nullptr, pathname, _MAX_PATH); // turn it into a search path - _splitpath(pathname, drive, directory, NULL, NULL); + _splitpath(pathname, drive, directory, nullptr, nullptr); sprintf(pathname, "%s:\\%s", drive, directory); // append the current directory to build a search path for SymInit @@ -139,8 +139,8 @@ BOOL InitSymbolInfo() if(DbgHelpLoader::symInitialize(process, pathname, FALSE)) { // regenerate the name of the app - ::GetModuleFileName(NULL, pathname, _MAX_PATH); - if(DbgHelpLoader::symLoadModule(process, NULL, pathname, NULL, 0, 0)) + ::GetModuleFileName(nullptr, pathname, _MAX_PATH); + if(DbgHelpLoader::symLoadModule(process, nullptr, pathname, nullptr, 0, 0)) { //Load any other relevant modules (ie dlls) here atexit(DbgHelpLoader::unload); @@ -197,11 +197,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL); + nullptr); skip--; } @@ -213,11 +213,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL); + nullptr); @@ -356,11 +356,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL) != 0; + nullptr) != 0; skip--; } @@ -370,11 +370,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL) != 0; + nullptr) != 0; if (stillgoing) { *addresses = (void*)stack_frame.AddrPC.Offset; @@ -386,7 +386,7 @@ stack_frame.AddrFrame.Offset = myebp; // Fill remainder while (count) { - *addresses = NULL; + *addresses = nullptr; addresses++; count--; } @@ -395,7 +395,7 @@ stack_frame.AddrFrame.Offset = myebp; /* else { - memset(addresses,NULL,count*sizeof(void*)); + memset(addresses,nullptr,count*sizeof(void*)); } */ } @@ -407,7 +407,7 @@ stack_frame.AddrFrame.Offset = myebp; //***************************************************************************** void StackDumpFromAddresses(void**addresses, unsigned int count, void (*callback)(const char *)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -415,7 +415,7 @@ void StackDumpFromAddresses(void**addresses, unsigned int count, void (*callback if (!InitSymbolInfo()) return; - while ((count--) && (*addresses!=NULL)) + while ((count--) && (*addresses!=nullptr)) { WriteStackLine(*addresses,callback); addresses++; @@ -557,7 +557,7 @@ void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) } DOUBLE_DEBUG (("\nStack Dump:")); - StackDumpFromContext(context->Eip, context->Esp, context->Ebp, NULL); + StackDumpFromContext(context->Eip, context->Esp, context->Ebp, nullptr); DOUBLE_DEBUG (("\nDetails:")); diff --git a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp index 77f89bedf79..6d4f65f0480 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -43,12 +43,12 @@ const char *const TheUpgradeTypeNames[] = { "PLAYER", "OBJECT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheUpgradeTypeNames) == NUM_UPGRADE_TYPES + 1, "Incorrect array size"); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -class UpgradeCenter *TheUpgradeCenter = NULL; +class UpgradeCenter *TheUpgradeCenter = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // UPGRADE //////////////////////////////////////////////////////////////////////////////////////// @@ -61,8 +61,8 @@ Upgrade::Upgrade( const UpgradeTemplate *upgradeTemplate ) m_template = upgradeTemplate; m_status = UPGRADE_STATUS_INVALID; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; } @@ -116,14 +116,14 @@ void Upgrade::loadPostProcess( void ) const FieldParse UpgradeTemplate::m_upgradeFieldParseTable[] = { - { "DisplayName", INI::parseAsciiString, NULL, offsetof( UpgradeTemplate, m_displayNameLabel ) }, + { "DisplayName", INI::parseAsciiString, nullptr, offsetof( UpgradeTemplate, m_displayNameLabel ) }, { "Type", INI::parseIndexList, TheUpgradeTypeNames, offsetof( UpgradeTemplate, m_type ) }, - { "BuildTime", INI::parseReal, NULL, offsetof( UpgradeTemplate, m_buildTime ) }, - { "BuildCost", INI::parseInt, NULL, offsetof( UpgradeTemplate, m_cost ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( UpgradeTemplate, m_buttonImageName ) }, - { "ResearchSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_researchSound ) }, - { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } + { "BuildTime", INI::parseReal, nullptr, offsetof( UpgradeTemplate, m_buildTime ) }, + { "BuildCost", INI::parseInt, nullptr, offsetof( UpgradeTemplate, m_cost ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( UpgradeTemplate, m_buttonImageName ) }, + { "ResearchSound", INI::parseAudioEventRTS, nullptr, offsetof( UpgradeTemplate, m_researchSound ) }, + { "UnitSpecificSound", INI::parseAudioEventRTS, nullptr, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -135,9 +135,9 @@ UpgradeTemplate::UpgradeTemplate( void ) m_type = UPGRADE_TYPE_PLAYER; m_nameKey = NAMEKEY_INVALID; m_buildTime = 0.0f; - m_next = NULL; - m_prev = NULL; - m_buttonImage = NULL; + m_next = nullptr; + m_prev = nullptr; + m_buttonImage = nullptr; } @@ -222,7 +222,7 @@ void UpgradeTemplate::cacheButtonImage() UpgradeCenter::UpgradeCenter( void ) { - m_upgradeList = NULL; + m_upgradeList = nullptr; m_nextTemplateMaskBit = 0; buttonImagesCached = FALSE; @@ -313,7 +313,7 @@ UpgradeTemplate *UpgradeCenter::findNonConstUpgradeByKey( NameKeyType key ) return upgrade; // item not found - return NULL; + return nullptr; } @@ -340,7 +340,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgradeByKey( NameKeyType key ) const return upgrade; // item not found - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -399,11 +399,11 @@ void UpgradeCenter::linkUpgrade( UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; // link - upgrade->friend_setPrev( NULL ); + upgrade->friend_setPrev( nullptr ); upgrade->friend_setNext( m_upgradeList ); if( m_upgradeList ) m_upgradeList->friend_setPrev( upgrade ); @@ -418,7 +418,7 @@ void UpgradeCenter::unlinkUpgrade( UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; if( upgrade->friend_getNext() ) @@ -437,7 +437,7 @@ Bool UpgradeCenter::canAffordUpgrade( Player *player, const UpgradeTemplate *upg { // sanity - if( player == NULL || upgradeTemplate == NULL ) + if( player == nullptr || upgradeTemplate == nullptr ) return FALSE; // money check @@ -482,7 +482,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) // find existing item if present UpgradeTemplate* upgrade = TheUpgradeCenter->findNonConstUpgradeByKey( NAMEKEY(name) ); - if( upgrade == NULL ) + if( upgrade == nullptr ) { // allocate a new item diff --git a/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp b/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp index f2a8360d895..676cfd54033 100644 --- a/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp @@ -78,7 +78,7 @@ const char *EncryptString(const char *String) for (Cnt = 0; Cnt < MAX_ENCRYPTED_STRING; Cnt++) Return_Buffer[Cnt] = Base_String[Temp_Buffer[Cnt] & 0x3F]; - Return_Buffer[Cnt] = NULL; + Return_Buffer[Cnt] = '\0'; return (Return_Buffer); } diff --git a/Generals/Code/GameEngine/Source/Common/System/registry.cpp b/Generals/Code/GameEngine/Source/Common/System/registry.cpp index df4ab5f2ef0..0fae0ca8a5b 100644 --- a/Generals/Code/GameEngine/Source/Common/System/registry.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/registry.cpp @@ -41,7 +41,7 @@ Bool getStringFromRegistry(HKEY root, AsciiString path, AsciiString key, AsciiS if ((returnValue = RegOpenKeyEx( root, path.str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -64,7 +64,7 @@ Bool getUnsignedIntFromRegistry(HKEY root, AsciiString path, AsciiString key, Un if ((returnValue = RegOpenKeyEx( root, path.str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -85,7 +85,7 @@ Bool setStringInRegistry( HKEY root, AsciiString path, AsciiString key, AsciiStr int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_SZ; size = val.getLength()+1; @@ -104,7 +104,7 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_DWORD; size = 4; diff --git a/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp b/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp index 796f2fcc90b..751ebacddd2 100644 --- a/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp @@ -36,18 +36,18 @@ #include "Common/TerrainTypes.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -TerrainTypeCollection *TheTerrainTypes = NULL; +TerrainTypeCollection *TheTerrainTypes = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// const FieldParse TerrainType::m_terrainTypeFieldParseTable[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( TerrainType, m_texture ) }, - { "BlendEdges", INI::parseBool, NULL, offsetof( TerrainType, m_blendEdgeTexture ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( TerrainType, m_texture ) }, + { "BlendEdges", INI::parseBool, nullptr, offsetof( TerrainType, m_blendEdgeTexture ) }, { "Class", INI::parseIndexList, terrainTypeNames, offsetof( TerrainType, m_class ) }, - { "RestrictConstruction", INI::parseBool, NULL, offsetof( TerrainType, m_restrictConstruction ) }, + { "RestrictConstruction", INI::parseBool, nullptr, offsetof( TerrainType, m_restrictConstruction ) }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; @@ -61,7 +61,7 @@ TerrainType::TerrainType( void ) m_blendEdgeTexture = FALSE; m_class = TERRAIN_NONE; m_restrictConstruction = FALSE; - m_next = NULL; + m_next = nullptr; } @@ -81,7 +81,7 @@ TerrainType::~TerrainType( void ) TerrainTypeCollection::TerrainTypeCollection( void ) { - m_terrainList = NULL; + m_terrainList = nullptr; } @@ -124,7 +124,7 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) } // not found - return NULL; + return nullptr; } @@ -133,7 +133,7 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) //------------------------------------------------------------------------------------------------- TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) { - TerrainType *terrain = NULL; + TerrainType *terrain = nullptr; // allocate a new type terrain = newInstance(TerrainType); diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp index 2b421987582..d133d8e2c97 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -60,7 +60,7 @@ { ModuleData* data = MSGNEW("Module::friend_newModuleData") ModuleData; // no need to memorypool these since we never allocate more than one of each if (ini) - ini->initFromINI(data, 0); // this is just so that an "end" token is required + ini->initFromINI(data, nullptr); // this is just so that an "end" token is required return data; } @@ -112,7 +112,7 @@ ObjectModule::ObjectModule( Thing *thing, const ModuleData* moduleData ) : Modul throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH( thing, ("Thing passed to ObjectModule is NULL!") ); + DEBUG_ASSERTCRASH( thing, ("Thing passed to ObjectModule is null!") ); m_object = AsObject(thing); DEBUG_ASSERTCRASH( m_object, ("Thing passed to ObjectModule is not an Object!") ); @@ -175,7 +175,7 @@ DrawableModule::DrawableModule( Thing *thing, const ModuleData* moduleData ) : M throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH( thing, ("Thing passed to DrawableModule is NULL!") ); + DEBUG_ASSERTCRASH( thing, ("Thing passed to DrawableModule is null!") ); m_drawable = AsDrawable(thing); DEBUG_ASSERTCRASH( m_drawable, ("Thing passed to DrawableModule is not a Drawable!") ); diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 55a6abb1df4..00dc58d63a8 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -254,7 +254,7 @@ #include "GameClient/Module/BeaconClientUpdate.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ModuleFactory *TheModuleFactory = NULL; ///< the module factory singleton +ModuleFactory *TheModuleFactory = nullptr; ///< the module factory singleton // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -525,7 +525,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam const AsciiString& moduleTag) { if (name.isEmpty()) - return NULL; + return nullptr; const ModuleTemplate* moduleTemplate = findModuleTemplate(name, type); if (moduleTemplate) @@ -536,7 +536,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam return md; } - return NULL; + return nullptr; } // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -559,7 +559,7 @@ const ModuleFactory::ModuleTemplate* ModuleFactory::findModuleTemplate(const Asc if (it == m_moduleTemplateMap.end()) { DEBUG_CRASH(( "Module name '%s' not found", name.str() )); - return NULL; + return nullptr; } else { @@ -576,7 +576,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M if( name.isEmpty() ) { DEBUG_CRASH(("attempting to create module with empty name")); - return NULL; + return nullptr; } const ModuleTemplate* mt = findModuleTemplate(name, type); if (mt) @@ -589,34 +589,34 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M BehaviorModule* bm = (BehaviorModule*)mod; DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_BODY)) != 0) == (bm->getBody() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_BODY)) != 0) == (bm->getBody() != nullptr), ("getInterfaceMask bad for MODULE_BODY (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_COLLIDE)) != 0) == (bm->getCollide() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_COLLIDE)) != 0) == (bm->getCollide() != nullptr), ("getInterfaceMask bad for MODULE_COLLIDE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_CONTAIN)) != 0) == (bm->getContain() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_CONTAIN)) != 0) == (bm->getContain() != nullptr), ("getInterfaceMask bad for MODULE_CONTAIN (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_CREATE)) != 0) == (bm->getCreate() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_CREATE)) != 0) == (bm->getCreate() != nullptr), ("getInterfaceMask bad for MODULE_CREATE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DAMAGE)) != 0) == (bm->getDamage() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DAMAGE)) != 0) == (bm->getDamage() != nullptr), ("getInterfaceMask bad for MODULE_DAMAGE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DESTROY)) != 0) == (bm->getDestroy() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DESTROY)) != 0) == (bm->getDestroy() != nullptr), ("getInterfaceMask bad for MODULE_DESTROY (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DIE)) != 0) == (bm->getDie() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DIE)) != 0) == (bm->getDie() != nullptr), ("getInterfaceMask bad for MODULE_DIE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) == (bm->getSpecialPower() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) == (bm->getSpecialPower() != nullptr), ("getInterfaceMask bad for MODULE_SPECIAL_POWER (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_UPDATE)) != 0) == (bm->getUpdate() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_UPDATE)) != 0) == (bm->getUpdate() != nullptr), ("getInterfaceMask bad for MODULE_UPDATE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_UPGRADE)) != 0) == (bm->getUpgrade() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_UPGRADE)) != 0) == (bm->getUpgrade() != nullptr), ("getInterfaceMask bad for MODULE_UPGRADE (%s)",name.str())); } #endif @@ -624,7 +624,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M return mod; } - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp index f99aeecf5e7..0cf72ba4024 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -56,7 +56,7 @@ static constexpr const Real InitialThingPosY = 0.0f; Thing::Thing( const ThingTemplate *thingTemplate ) { // sanity - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { // cannot create thing without template @@ -374,7 +374,7 @@ void Thing::transformPoint( const Coord3D *in, Coord3D *out ) { // santiy - if( in == NULL || out == NULL ) + if( in == nullptr || out == nullptr ) return; // for conversion diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 42b9e4a120d..7022922ecae 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -52,7 +52,7 @@ enum { TEMPLATE_HASH_SIZE = 12288 }; // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ThingFactory *TheThingFactory = NULL; ///< Thing manager singleton declaration +ThingFactory *TheThingFactory = nullptr; ///< Thing manager singleton declaration // STATIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -103,7 +103,7 @@ void ThingFactory::addTemplate( ThingTemplate *tmplate ) //------------------------------------------------------------------------------------------------- ThingFactory::ThingFactory() { - m_firstTemplate = NULL; + m_firstTemplate = nullptr; m_nextTemplateID = 1; // not zero! #ifdef USING_STLPORT @@ -169,10 +169,10 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) { // sanity - DEBUG_ASSERTCRASH( thingTemplate, ("newOverride(): NULL 'parent' thing template") ); + DEBUG_ASSERTCRASH( thingTemplate, ("newOverride(): null 'parent' thing template") ); // sanity just for debuging, the weapon must be in the master list to do overrides - DEBUG_ASSERTCRASH( findTemplate( thingTemplate->getName() ) != NULL, + DEBUG_ASSERTCRASH( findTemplate( thingTemplate->getName() ) != nullptr, ("newOverride(): Thing template '%s' not in master list", thingTemplate->getName().str()) ); @@ -219,7 +219,7 @@ void ThingFactory::reset( void ) possibleAdjustment = TRUE; } - // if stillValid is NULL after we delete the overrides, then this template was created for + // if stillValid is nullptr after we delete the overrides, then this template was created for // this map only. If it also happens to be m_firstTemplate, then we need to update m_firstTemplate // as well. Finally, if it was only created for this map, we need to remove the name from the // hash map, to prevent any crashes. @@ -227,11 +227,11 @@ void ThingFactory::reset( void ) AsciiString templateName = t->getName(); Overridable *stillValid = t->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_firstTemplate = nextT; } - if (stillValid == NULL) { + if (stillValid == nullptr) { // Also needs to be removed from the Hash map. m_templateHashMap.erase(templateName); } @@ -265,7 +265,7 @@ const ThingTemplate *ThingFactory::findByTemplateID( UnsignedShort id ) return tmpl; } DEBUG_CRASH(("template %d not found",(Int)id)); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -302,14 +302,14 @@ ThingTemplate *ThingFactory::findTemplateInternal( const AsciiString& name, Bool { DEBUG_CRASH( ("Failed to find thing template %s (case sensitive) This issue has a chance of crashing after you ignore it!", name.str() ) ); } - return NULL; + return nullptr; } //============================================================================= Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, ObjectStatusMaskType statusBits ) { - if (tmplate == NULL) + if (tmplate == nullptr) throw ERROR_BAD_ARG; const std::vector& asv = tmplate->getBuildVariations(); @@ -317,7 +317,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec { Int which = GameLogicRandomValue(0, asv.size()-1); const ThingTemplate* tmp = findTemplate( asv[which] ); - if (tmp != NULL) + if (tmp != nullptr) tmplate = tmp; } @@ -354,7 +354,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec //============================================================================= Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits) { - if (tmplate == NULL) + if (tmplate == nullptr) throw ERROR_BAD_ARG; Drawable *draw = TheGameClient->friend_createDrawable( tmplate, statusBits ); diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 854f5e971e5..49ab62a82d8 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -106,45 +106,45 @@ AudioEventRTS ThingTemplate::s_audioEventNoSound; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above const FieldParse ThingTemplate::s_objectFieldParseTable[] = { - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( ThingTemplate, m_displayName ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( ThingTemplate, m_displayName ) }, { "RadarPriority", INI::parseByteSizedIndexList, RadarPriorityNames, offsetof( ThingTemplate, m_radarPriority ) }, - { "TransportSlotCount", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_transportSlotCount ) }, - { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, - { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, - { "IsBridge", INI::parseBool, NULL, offsetof( ThingTemplate, m_isBridge ) }, - { "ArmorSet", ThingTemplate::parseArmorTemplateSet, NULL, 0}, - { "WeaponSet", ThingTemplate::parseWeaponTemplateSet,NULL, 0}, - { "VisionRange", INI::parseReal, NULL, offsetof( ThingTemplate, m_visionRange ) }, - { "ShroudClearingRange", INI::parseReal, NULL, offsetof( ThingTemplate, m_shroudClearingRange ) }, + { "TransportSlotCount", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_transportSlotCount ) }, + { "FenceWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceWidth ) }, + { "FenceXOffset", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceXOffset ) }, + { "IsBridge", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isBridge ) }, + { "ArmorSet", ThingTemplate::parseArmorTemplateSet, nullptr, 0}, + { "WeaponSet", ThingTemplate::parseWeaponTemplateSet,nullptr, 0}, + { "VisionRange", INI::parseReal, nullptr, offsetof( ThingTemplate, m_visionRange ) }, + { "ShroudClearingRange", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shroudClearingRange ) }, - { "PlacementViewAngle", INI::parseAngleReal, NULL, offsetof( ThingTemplate, m_placementViewAngle ) }, + { "PlacementViewAngle", INI::parseAngleReal, nullptr, offsetof( ThingTemplate, m_placementViewAngle ) }, - { "FactoryExitWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_factoryExitWidth ) }, - { "FactoryExtraBibWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_factoryExtraBibWidth ) }, + { "FactoryExitWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_factoryExitWidth ) }, + { "FactoryExtraBibWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_factoryExtraBibWidth ) }, { "SkillPointValue", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_skillPointValues ) }, { "ExperienceValue", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_experienceValues ) }, { "ExperienceRequired", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_experienceRequired ) }, - { "IsTrainable", INI::parseBool, NULL, offsetof( ThingTemplate, m_isTrainable ) }, + { "IsTrainable", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isTrainable ) }, - { "Side", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_defaultOwningSide ) }, + { "Side", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_defaultOwningSide ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "Prerequisites", ThingTemplate::parsePrerequisites, 0, 0 }, + { "Prerequisites", ThingTemplate::parsePrerequisites, nullptr, 0 }, { "Buildable", INI::parseByteSizedIndexList, BuildableStatusNames, offsetof( ThingTemplate, m_buildable) }, - { "BuildCost", INI::parseUnsignedShort, NULL, offsetof( ThingTemplate, m_buildCost ) }, - { "BuildTime", INI::parseReal, NULL, offsetof( ThingTemplate, m_buildTime ) }, - { "RefundValue", INI::parseUnsignedShort, NULL, offsetof( ThingTemplate, m_refundValue ) }, + { "BuildCost", INI::parseUnsignedShort, nullptr, offsetof( ThingTemplate, m_buildCost ) }, + { "BuildTime", INI::parseReal, nullptr, offsetof( ThingTemplate, m_buildTime ) }, + { "RefundValue", INI::parseUnsignedShort, nullptr, offsetof( ThingTemplate, m_refundValue ) }, { "BuildCompletion", INI::parseByteSizedIndexList, BuildCompletionNames, offsetof( ThingTemplate, m_buildCompletion ) }, - { "EnergyProduction", INI::parseInt, NULL, offsetof( ThingTemplate, m_energyProduction ) }, - { "EnergyBonus", INI::parseInt, NULL, offsetof( ThingTemplate, m_energyBonus ) }, - { "IsForbidden", INI::parseBool, NULL, offsetof( ThingTemplate, m_isForbidden ) }, - { "IsPrerequisite", INI::parseBool, NULL, offsetof( ThingTemplate, m_isPrerequisite ) }, - { "DisplayColor", INI::parseColorInt, NULL, offsetof( ThingTemplate, m_displayColor ) }, + { "EnergyProduction", INI::parseInt, nullptr, offsetof( ThingTemplate, m_energyProduction ) }, + { "EnergyBonus", INI::parseInt, nullptr, offsetof( ThingTemplate, m_energyBonus ) }, + { "IsForbidden", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isForbidden ) }, + { "IsPrerequisite", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isPrerequisite ) }, + { "DisplayColor", INI::parseColorInt, nullptr, offsetof( ThingTemplate, m_displayColor ) }, { "EditorSorting", INI::parseByteSizedIndexList, EditorSortingNames, offsetof( ThingTemplate, m_editorSorting ) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( ThingTemplate, m_kindof ) }, - { "CommandSet", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_commandSetString ) }, - { "BuildVariations", INI::parseAsciiStringVector, NULL, offsetof( ThingTemplate, m_buildVariations ) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( ThingTemplate, m_kindof ) }, + { "CommandSet", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_commandSetString ) }, + { "BuildVariations", INI::parseAsciiStringVector, nullptr, offsetof( ThingTemplate, m_buildVariations ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above { "Behavior", ThingTemplate::parseModuleName, (const void*)MODULETYPE_BEHAVIOR, offsetof(ThingTemplate, m_behaviorModuleInfo) }, @@ -153,94 +153,94 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] = { "ClientUpdate", ThingTemplate::parseModuleName, (const void*)MODULETYPE_CLIENT_UPDATE, offsetof(ThingTemplate, m_clientUpdateModuleInfo) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "SelectPortrait", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_selectedPortraitImageName ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_buttonImageName ) }, + { "SelectPortrait", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_selectedPortraitImageName ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_buttonImageName ) }, //Code renderer handles these states now. - //{ "InventoryImageEnabled", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_ENABLED ] ) }, - //{ "InventoryImageDisabled", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_DISABLED ] ) }, - //{ "InventoryImageHilite", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_HILITE ] ) }, - //{ "InventoryImagePushed", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_PUSHED ] ) }, + //{ "InventoryImageEnabled", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_ENABLED ] ) }, + //{ "InventoryImageDisabled", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_DISABLED ] ) }, + //{ "InventoryImageHilite", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_HILITE ] ) }, + //{ "InventoryImagePushed", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_PUSHED ] ) }, - { "UpgradeCameo1", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 0 ] ) }, - { "UpgradeCameo2", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 1 ] ) }, - { "UpgradeCameo3", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 2 ] ) }, - { "UpgradeCameo4", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 3 ] ) }, - { "UpgradeCameo5", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 4 ] ) }, + { "UpgradeCameo1", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 0 ] ) }, + { "UpgradeCameo2", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 1 ] ) }, + { "UpgradeCameo3", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 2 ] ) }, + { "UpgradeCameo4", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 3 ] ) }, + { "UpgradeCameo5", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 4 ] ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "VoiceSelect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelect]) }, - { "VoiceGroupSelect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGroupSelect]) }, - { "VoiceMove", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMove]) }, - { "VoiceAttack", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttack]) }, - { "VoiceEnter", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceEnter ]) }, - { "VoiceFear", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceFear ]) }, - { "VoiceSelectElite", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelectElite ]) }, - { "VoiceCreated", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceCreated]) }, - { "VoiceTaskUnable", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskUnable ]) }, - { "VoiceTaskComplete", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskComplete ]) }, - { "VoiceMeetEnemy", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMeetEnemy]) }, - { "VoiceGarrison", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGarrison]) }, + { "VoiceSelect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelect]) }, + { "VoiceGroupSelect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGroupSelect]) }, + { "VoiceMove", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMove]) }, + { "VoiceAttack", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttack]) }, + { "VoiceEnter", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceEnter ]) }, + { "VoiceFear", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceFear ]) }, + { "VoiceSelectElite", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelectElite ]) }, + { "VoiceCreated", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceCreated]) }, + { "VoiceTaskUnable", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskUnable ]) }, + { "VoiceTaskComplete", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskComplete ]) }, + { "VoiceMeetEnemy", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMeetEnemy]) }, + { "VoiceGarrison", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGarrison]) }, #ifdef ALLOW_SURRENDER - { "VoiceSurrender", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSurrender]) }, + { "VoiceSurrender", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSurrender]) }, #endif - { "VoiceDefect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceDefect]) }, - { "VoiceAttackSpecial", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackSpecial ]) }, - { "VoiceAttackAir", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackAir ]) }, - { "VoiceGuard", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGuard ]) }, - { "SoundMoveStart", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStart]) }, - { "SoundMoveStartDamaged",INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStartDamaged]) }, - { "SoundMoveLoop", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoop]) }, - { "SoundMoveLoopDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoopDamaged]) }, - { "SoundDie", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDie]) }, - { "SoundCrush", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCrush ]) }, - { "SoundAmbient", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbient ]) }, - { "SoundAmbientDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientDamaged ]) }, - { "SoundAmbientReallyDamaged",INI::parseDynamicAudioEventRTS, NULL,offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientReallyDamaged ]) }, - { "SoundAmbientRubble", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientRubble]) }, - { "SoundStealthOn", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOn ]) }, - { "SoundStealthOff", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOff ]) }, - { "SoundCreated", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCreated ]) }, - { "SoundOnDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnDamaged ]) }, - { "SoundOnReallyDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnReallyDamaged ]) }, - { "SoundDieFire", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDieFire ]) }, - { "SoundDieToxin", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDieToxin ]) }, - { "SoundEnter", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundEnter ]) }, - { "SoundExit", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundExit ]) }, - { "SoundPromotedVeteran", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedVeteran ]) }, - { "SoundPromotedElite", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedElite ]) }, - { "SoundPromotedHero", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedHero ]) }, - { "SoundFallingFromPlane",INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundFalling ]) }, - - { "UnitSpecificSounds", ThingTemplate::parsePerUnitSounds, NULL, offsetof(ThingTemplate, m_perUnitSounds) }, - { "UnitSpecificFX", ThingTemplate::parsePerUnitFX, NULL, offsetof(ThingTemplate, m_perUnitFX) }, - { "Scale", INI::parseReal, NULL, offsetof( ThingTemplate, m_assetScale ) }, - { "Geometry", GeometryInfo::parseGeometryType, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryHeight", GeometryInfo::parseGeometryHeight, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, + { "VoiceDefect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceDefect]) }, + { "VoiceAttackSpecial", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackSpecial ]) }, + { "VoiceAttackAir", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackAir ]) }, + { "VoiceGuard", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGuard ]) }, + { "SoundMoveStart", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStart]) }, + { "SoundMoveStartDamaged",INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStartDamaged]) }, + { "SoundMoveLoop", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoop]) }, + { "SoundMoveLoopDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoopDamaged]) }, + { "SoundDie", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDie]) }, + { "SoundCrush", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCrush ]) }, + { "SoundAmbient", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbient ]) }, + { "SoundAmbientDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientDamaged ]) }, + { "SoundAmbientReallyDamaged",INI::parseDynamicAudioEventRTS, nullptr,offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientReallyDamaged ]) }, + { "SoundAmbientRubble", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientRubble]) }, + { "SoundStealthOn", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOn ]) }, + { "SoundStealthOff", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOff ]) }, + { "SoundCreated", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCreated ]) }, + { "SoundOnDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnDamaged ]) }, + { "SoundOnReallyDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnReallyDamaged ]) }, + { "SoundDieFire", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDieFire ]) }, + { "SoundDieToxin", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundDieToxin ]) }, + { "SoundEnter", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundEnter ]) }, + { "SoundExit", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundExit ]) }, + { "SoundPromotedVeteran", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedVeteran ]) }, + { "SoundPromotedElite", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedElite ]) }, + { "SoundPromotedHero", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedHero ]) }, + { "SoundFallingFromPlane",INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundFalling ]) }, + + { "UnitSpecificSounds", ThingTemplate::parsePerUnitSounds, nullptr, offsetof(ThingTemplate, m_perUnitSounds) }, + { "UnitSpecificFX", ThingTemplate::parsePerUnitFX, nullptr, offsetof(ThingTemplate, m_perUnitFX) }, + { "Scale", INI::parseReal, nullptr, offsetof( ThingTemplate, m_assetScale ) }, + { "Geometry", GeometryInfo::parseGeometryType, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryHeight", GeometryInfo::parseGeometryHeight, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, { "Shadow", INI::parseBitString8, TheShadowNames, offsetof( ThingTemplate, m_shadowType ) }, - { "ShadowSizeX", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowSizeX ) }, - { "ShadowSizeY", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowSizeY ) }, - { "ShadowOffsetX", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowOffsetX ) }, - { "ShadowOffsetY", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowOffsetY ) }, - { "ShadowTexture", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_shadowTextureName ) }, - { "OcclusionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ThingTemplate, m_occlusionDelay ) }, - { "AddModule", ThingTemplate::parseAddModule, NULL, 0 }, - { "RemoveModule", ThingTemplate::parseRemoveModule, NULL, 0 }, - { "ReplaceModule", ThingTemplate::parseReplaceModule, NULL, 0 }, - { "InheritableModule", ThingTemplate::parseInheritableModule, NULL, 0 }, - { "Locomotor", AIUpdateModuleData::parseLocomotorSet, NULL, 0 }, - { "InstanceScaleFuzziness", INI::parseReal, NULL, offsetof(ThingTemplate, m_instanceScaleFuzziness ) }, - { "StructureRubbleHeight", INI::parseUnsignedByte, NULL, offsetof(ThingTemplate, m_structureRubbleHeight ) }, - { "ThreatValue", INI::parseUnsignedShort, NULL, offsetof(ThingTemplate, m_threatValue ) }, - { "MaxSimultaneousOfType", INI::parseUnsignedShort, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, - { "CrusherLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crusherLevel ) }, - { "CrushableLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crushableLevel ) }, - - { 0, 0, 0, 0 } + { "ShadowSizeX", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowSizeX ) }, + { "ShadowSizeY", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowSizeY ) }, + { "ShadowOffsetX", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowOffsetX ) }, + { "ShadowOffsetY", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowOffsetY ) }, + { "ShadowTexture", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_shadowTextureName ) }, + { "OcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ThingTemplate, m_occlusionDelay ) }, + { "AddModule", ThingTemplate::parseAddModule, nullptr, 0 }, + { "RemoveModule", ThingTemplate::parseRemoveModule, nullptr, 0 }, + { "ReplaceModule", ThingTemplate::parseReplaceModule, nullptr, 0 }, + { "InheritableModule", ThingTemplate::parseInheritableModule, nullptr, 0 }, + { "Locomotor", AIUpdateModuleData::parseLocomotorSet, nullptr, 0 }, + { "InstanceScaleFuzziness", INI::parseReal, nullptr, offsetof(ThingTemplate, m_instanceScaleFuzziness ) }, + { "StructureRubbleHeight", INI::parseUnsignedByte, nullptr, offsetof(ThingTemplate, m_structureRubbleHeight ) }, + { "ThreatValue", INI::parseUnsignedShort, nullptr, offsetof(ThingTemplate, m_threatValue ) }, + { "MaxSimultaneousOfType", INI::parseUnsignedShort, nullptr, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, + { "CrusherLevel", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_crusherLevel ) }, + { "CrushableLevel", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_crushableLevel ) }, + + { nullptr, nullptr, nullptr, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -250,15 +250,15 @@ const FieldParse ThingTemplate::s_objectReskinFieldParseTable[] = { { "Draw", ThingTemplate::parseModuleName, (const void*)MODULETYPE_DRAW, offsetof(ThingTemplate, m_drawModuleInfo) }, - { "Geometry", GeometryInfo::parseGeometryType, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryHeight", GeometryInfo::parseGeometryHeight, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, - { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, + { "Geometry", GeometryInfo::parseGeometryType, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryHeight", GeometryInfo::parseGeometryHeight, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "FenceWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceWidth ) }, + { "FenceXOffset", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceXOffset ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -275,7 +275,7 @@ const ModuleInfo::Nugget *ModuleInfo::getNuggetWithTag( const AsciiString& tag ) return &(*it); // no match - return NULL; + return nullptr; } @@ -299,7 +299,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, const Nugget *nugget; nugget = thingTemplate->getBehaviorModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -317,7 +317,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, } nugget = thingTemplate->getDrawModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -335,7 +335,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, } nugget = thingTemplate->getClientUpdateModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -548,7 +548,7 @@ static void parsePrerequisiteUnit( INI* ini, void *instance, void * /*store*/, c ProductionPrerequisite prereq; Bool orUnitWithPrevious = FALSE; - for (const char *token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { prereq.addUnitPrereq( AsciiString( token ), orUnitWithPrevious ); orUnitWithPrevious = TRUE; @@ -575,9 +575,9 @@ void ThingTemplate::parsePrerequisites( INI* ini, void *instance, void *store, c static const FieldParse myFieldParse[] = { - { "Object", parsePrerequisiteUnit, 0, 0 }, - { "Science", parsePrerequisiteScience, 0, 0 }, - { 0, 0, 0, 0 } + { "Object", parsePrerequisiteUnit, nullptr, 0 }, + { "Science", parsePrerequisiteScience, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) @@ -595,7 +595,7 @@ static void parseArbitraryFXIntoMap( INI* ini, void *instance, void* /* store */ const char* name = (const char*)userData; const char* token = ini->getNextToken(); const FXList* fxl = TheFXListStore->findFXList(token); // could be null! - DEBUG_ASSERTCRASH(fxl != NULL || stricmp(token, "None") == 0, ("FXList %s not found!",token)); + DEBUG_ASSERTCRASH(fxl != nullptr || stricmp(token, "None") == 0, ("FXList %s not found!",token)); mapFX->insert(std::make_pair(AsciiString(name), fxl)); } @@ -609,8 +609,8 @@ void ThingTemplate::parsePerUnitFX( INI* ini, void *instance, void *store, const static const FieldParse myFieldParse[] = { - { 0, parseArbitraryFXIntoMap, NULL, 0 }, - { 0, 0, 0, 0 } + { nullptr, parseArbitraryFXIntoMap, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(fxmap, myFieldParse); @@ -639,8 +639,8 @@ void ThingTemplate::parsePerUnitSounds( INI* ini, void *instance, void *store, c static const FieldParse myFieldParse[] = { - { 0, parseArbitrarySoundsIntoMap, NULL, 0 }, - { 0, 0, 0, 0 } + { nullptr, parseArbitrarySoundsIntoMap, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(mapSounds, myFieldParse); @@ -776,10 +776,10 @@ void ArmorTemplateSet::parseArmorTemplateSet( INI* ini ) { static const FieldParse myFieldParse[] = { - { "Conditions", ArmorSetFlags::parseFromINI, NULL, offsetof( ArmorTemplateSet, m_types ) }, - { "Armor", INI::parseArmorTemplate, NULL, offsetof( ArmorTemplateSet, m_template ) }, - { "DamageFX", INI::parseDamageFX, NULL, offsetof( ArmorTemplateSet, m_fx ) }, - { 0, 0, 0, 0 } + { "Conditions", ArmorSetFlags::parseFromINI, nullptr, offsetof( ArmorTemplateSet, m_types ) }, + { "Armor", INI::parseArmorTemplate, nullptr, offsetof( ArmorTemplateSet, m_template ) }, + { "DamageFX", INI::parseDamageFX, nullptr, offsetof( ArmorTemplateSet, m_fx ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(this, myFieldParse); @@ -847,10 +847,10 @@ ThingTemplate::ThingTemplate() : m_geometryInfo(GEOMETRY_SPHERE, FALSE, 1, 1, 1) { m_moduleParsingMode = MODULEPARSE_NORMAL; - m_reskinnedFrom = NULL; + m_reskinnedFrom = nullptr; m_radarPriority = RADAR_PRIORITY_INVALID; - m_nextThingTemplate = NULL; + m_nextThingTemplate = nullptr; m_transportSlotCount = 0; m_fenceWidth = 0; m_fenceXOffset = 0; @@ -882,8 +882,8 @@ ThingTemplate::ThingTemplate() : m_factoryExitWidth = 0.0f; m_factoryExtraBibWidth = 0.0f; - m_selectedPortraitImage = NULL; - m_buttonImage = NULL; + m_selectedPortraitImage = nullptr; + m_buttonImage = nullptr; m_shadowType = SHADOW_NONE; m_shadowSizeX = 0.0f; @@ -913,7 +913,7 @@ AIUpdateModuleData *ThingTemplate::friend_getAIModuleInfo(void) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1054,13 +1054,13 @@ void ThingTemplate::validate() if (isKindOf(KINDOF_STRUCTURE)) { - if (m_armorTemplateSets.empty() || (m_armorTemplateSets.size() == 1 && m_armorTemplateSets[0].getArmorTemplate() == NULL)) + if (m_armorTemplateSets.empty() || (m_armorTemplateSets.size() == 1 && m_armorTemplateSets[0].getArmorTemplate() == nullptr)) { DEBUG_CRASH(("Structure %s has no armor, but probably should (StructureArmor) -- please fix it.)",getName().str())); } for (ArmorTemplateSetVector::const_iterator it = m_armorTemplateSets.begin(); it != m_armorTemplateSets.end(); ++it) { - if (it->getDamageFX() == NULL) + if (it->getDamageFX() == nullptr) { DEBUG_CRASH(("Structure %s has no ArmorDamageFX, and really should.",getName().str())); } @@ -1194,13 +1194,13 @@ void ThingTemplate::initForLTA(const AsciiString& name) AsciiString moduleTag; moduleTag.format( "LTA_%sDestroyDie", m_LTAName.str() ); - m_behaviorModuleInfo.addModuleInfo(this, "DestroyDie", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "DestroyDie", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_DIE), false); + m_behaviorModuleInfo.addModuleInfo(this, "DestroyDie", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "DestroyDie", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_DIE), false); moduleTag.format( "LTA_%sInactiveBody", m_LTAName.str() ); - m_behaviorModuleInfo.addModuleInfo(this, "InactiveBody", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "InactiveBody", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_BODY), false); + m_behaviorModuleInfo.addModuleInfo(this, "InactiveBody", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "InactiveBody", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_BODY), false); moduleTag.format( "LTA_%sW3DDefaultDraw", m_LTAName.str() ); - m_drawModuleInfo.addModuleInfo(this, "W3DDefaultDraw", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "W3DDefaultDraw", MODULETYPE_DRAW, moduleTag), (MODULEINTERFACE_DRAW), false); + m_drawModuleInfo.addModuleInfo(this, "W3DDefaultDraw", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "W3DDefaultDraw", MODULETYPE_DRAW, moduleTag), (MODULEINTERFACE_DRAW), false); m_armorCopiedFromDefault = false; m_weaponsCopiedFromDefault = false; @@ -1265,7 +1265,7 @@ const ThingTemplate *ThingTemplate::getBuildFacilityTemplate( const Player *play } else { - return NULL; + return nullptr; } } @@ -1284,14 +1284,14 @@ const FXList *ThingTemplate::getPerUnitFX(const AsciiString& fxName) const { if (fxName.isEmpty()) { - return NULL; + return nullptr; } PerUnitFXMap::const_iterator it = m_perUnitFX.find(fxName); if (it == m_perUnitFX.end()) { DEBUG_CRASH(("Unknown FX name (%s) asked for in ThingTemplate (%s)", fxName.str(), m_nameString.str())); - return NULL; + return nullptr; } return (it->second); @@ -1338,7 +1338,7 @@ Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const return true; // This reskinned from that reskinned from? - // Kris: added case (chassis 2 compared to chassis 3 -- NULL possible if not reskinned) + // Kris: added case (chassis 2 compared to chassis 3 -- nullptr possible if not reskinned) if( this->m_reskinnedFrom && this->m_reskinnedFrom == tt->m_reskinnedFrom ) return true; @@ -1449,6 +1449,6 @@ ModuleData* ModuleInfo::friend_getNthData(Int i) // This is kinda naughty, but its necessary. return const_cast(m_info[i].second); } - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp index 656b5f4ebf6..eacd11a0a58 100644 --- a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -126,7 +126,7 @@ Bool UserPreferences::load(AsciiString fname) if (fp) { char buf[LINE_LEN]; - while( fgets( buf, LINE_LEN, fp ) != NULL ) + while( fgets( buf, LINE_LEN, fp ) != nullptr ) { AsciiString line = buf; line.trim(); @@ -700,7 +700,7 @@ Money CustomMatchPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } diff --git a/Generals/Code/GameEngine/Source/Common/version.cpp b/Generals/Code/GameEngine/Source/Common/version.cpp index 0c6375cfafa..f5bc8560efe 100644 --- a/Generals/Code/GameEngine/Source/Common/version.cpp +++ b/Generals/Code/GameEngine/Source/Common/version.cpp @@ -33,7 +33,7 @@ #include "gitinfo.h" -Version *TheVersion = NULL; ///< The Version singleton +Version *TheVersion = nullptr; ///< The Version singleton Version::Version() { diff --git a/Generals/Code/GameEngine/Source/GameClient/ClientInstance.cpp b/Generals/Code/GameEngine/Source/GameClient/ClientInstance.cpp index 417bcbd323a..7b06108866a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/ClientInstance.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/ClientInstance.cpp @@ -22,7 +22,7 @@ namespace rts { -HANDLE ClientInstance::s_mutexHandle = NULL; +HANDLE ClientInstance::s_mutexHandle = nullptr; UnsignedInt ClientInstance::s_instanceIndex = 0; #if defined(RTS_MULTI_INSTANCE) @@ -52,13 +52,13 @@ bool ClientInstance::initialize() guidStr.push_back('-'); guidStr.append(idStr); } - s_mutexHandle = CreateMutex(NULL, FALSE, guidStr.c_str()); + s_mutexHandle = CreateMutex(nullptr, FALSE, guidStr.c_str()); if (GetLastError() == ERROR_ALREADY_EXISTS) { - if (s_mutexHandle != NULL) + if (s_mutexHandle != nullptr) { CloseHandle(s_mutexHandle); - s_mutexHandle = NULL; + s_mutexHandle = nullptr; } // Try again with a new instance. ++s_instanceIndex; @@ -67,13 +67,13 @@ bool ClientInstance::initialize() } else { - s_mutexHandle = CreateMutex(NULL, FALSE, getFirstInstanceName()); + s_mutexHandle = CreateMutex(nullptr, FALSE, getFirstInstanceName()); if (GetLastError() == ERROR_ALREADY_EXISTS) { - if (s_mutexHandle != NULL) + if (s_mutexHandle != nullptr) { CloseHandle(s_mutexHandle); - s_mutexHandle = NULL; + s_mutexHandle = nullptr; } return false; } @@ -86,7 +86,7 @@ bool ClientInstance::initialize() bool ClientInstance::isInitialized() { - return s_mutexHandle != NULL; + return s_mutexHandle != nullptr; } bool ClientInstance::isMultiInstance() diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index 2774ced465e..8b0ebc7556b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -61,22 +61,22 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -CreditsManager *TheCredits = NULL; +CreditsManager *TheCredits = nullptr; const FieldParse CreditsManager::m_creditsFieldParseTable[] = { - { "ScrollRate", INI::parseInt, NULL, offsetof( CreditsManager, m_scrollRate ) }, - { "ScrollRateEveryFrames", INI::parseInt, NULL, offsetof( CreditsManager, m_scrollRatePerFrames ) }, - { "ScrollDown", INI::parseBool, NULL, offsetof( CreditsManager, m_scrollDown ) }, - { "TitleColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_titleColor ) }, - { "MinorTitleColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_positionColor ) }, - { "NormalColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_normalColor ) }, + { "ScrollRate", INI::parseInt, nullptr, offsetof( CreditsManager, m_scrollRate ) }, + { "ScrollRateEveryFrames", INI::parseInt, nullptr, offsetof( CreditsManager, m_scrollRatePerFrames ) }, + { "ScrollDown", INI::parseBool, nullptr, offsetof( CreditsManager, m_scrollDown ) }, + { "TitleColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_titleColor ) }, + { "MinorTitleColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_positionColor ) }, + { "NormalColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_normalColor ) }, { "Style", INI::parseLookupList, CreditStyleNames, offsetof( CreditsManager, m_currentStyle ) }, - { "Blank", CreditsManager::parseBlank, NULL, NULL }, - { "Text", CreditsManager::parseText, NULL, NULL }, + { "Blank", CreditsManager::parseBlank, nullptr, 0 }, + { "Text", CreditsManager::parseText, nullptr, 0 }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -102,8 +102,8 @@ CreditsLine::CreditsLine() m_useSecond = FALSE; m_done = FALSE; m_style = CREDIT_STYLE_BLANK; - m_displayString = NULL; - m_secondDisplayString = NULL; + m_displayString = nullptr; + m_secondDisplayString = nullptr; } CreditsLine::~CreditsLine() @@ -113,8 +113,8 @@ CreditsLine::~CreditsLine() if(m_secondDisplayString) TheDisplayStringManager->freeDisplayString(m_secondDisplayString); - m_displayString = NULL; - m_secondDisplayString = NULL; + m_displayString = nullptr; + m_secondDisplayString = nullptr; } @@ -155,7 +155,7 @@ void CreditsManager::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Credits", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Credits", INI_LOAD_OVERWRITE, nullptr ); if(m_scrollRatePerFrames <=0) m_scrollRatePerFrames = 1; @@ -207,8 +207,8 @@ void CreditsManager::update( void ) { TheDisplayStringManager->freeDisplayString(cLine->m_displayString); TheDisplayStringManager->freeDisplayString(cLine->m_secondDisplayString); - cLine->m_displayString = NULL; - cLine->m_secondDisplayString = NULL; + cLine->m_displayString = nullptr; + cLine->m_secondDisplayString = nullptr; drawIt = m_displayedCreditLineList.erase(drawIt); } else diff --git a/Generals/Code/GameEngine/Source/GameClient/Display.cpp b/Generals/Code/GameEngine/Source/GameClient/Display.cpp index e9acb876dfc..0ab2cbf5f0e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Display.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Display.cpp @@ -38,31 +38,31 @@ //#include "GameLogic/GameLogic.h" /// The Display singleton instance. -Display *TheDisplay = NULL; +Display *TheDisplay = nullptr; Display::Display() { - m_viewList = NULL; + m_viewList = nullptr; m_width = 0; m_height = 0; m_bitDepth = 0; m_windowed = FALSE; - m_videoBuffer = NULL; - m_videoStream = NULL; - m_debugDisplayCallback = NULL; - m_debugDisplayUserData = NULL; - m_debugDisplay = NULL; + m_videoBuffer = nullptr; + m_videoStream = nullptr; + m_debugDisplayCallback = nullptr; + m_debugDisplayUserData = nullptr; + m_debugDisplay = nullptr; m_letterBoxFadeLevel = 0; m_letterBoxEnabled = FALSE; m_cinematicText = AsciiString::TheEmptyString; - m_cinematicFont = NULL; + m_cinematicFont = nullptr; m_cinematicTextFrames = 0; m_movieHoldTime = -1; m_copyrightHoldTime = -1; m_elapsedMovieTime = 0; m_elapsedCopywriteTime = 0; - m_copyrightDisplayString = NULL; + m_copyrightDisplayString = nullptr; m_currentlyPlayingMovie.clear(); m_letterBoxFadeStartTime = 0; @@ -92,7 +92,7 @@ void Display::deleteViews( void ) next = v->getNextView(); delete v; } - m_viewList = NULL; + m_viewList = nullptr; } /** @@ -212,7 +212,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -223,7 +223,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_elapsedMovieTime = timeGetTime(); // we're using time get time becuase legal want's actual "Seconds" m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -247,7 +247,7 @@ void Display::playMovie( AsciiString movieName) m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -255,7 +255,7 @@ void Display::playMovie( AsciiString movieName) m_currentlyPlayingMovie = movieName; m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -273,12 +273,12 @@ void Display::playMovie( AsciiString movieName) void Display::stopMovie( void ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } if (!m_currentlyPlayingMovie.isEmpty()) { @@ -288,7 +288,7 @@ void Display::stopMovie( void ) if(m_copyrightDisplayString) { TheDisplayStringManager->freeDisplayString(m_copyrightDisplayString); - m_copyrightDisplayString = NULL; + m_copyrightDisplayString = nullptr; } m_copyrightHoldTime = -1; m_movieHoldTime = -1; @@ -366,7 +366,7 @@ void Display::reset() Bool Display::isMoviePlaying(void) { - return m_videoStream != NULL && m_videoBuffer != NULL; + return m_videoStream != nullptr && m_videoBuffer != nullptr; } //============================================================================ diff --git a/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp b/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp index ee1bf2f028c..2367de67984 100644 --- a/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/DisplayString.cpp @@ -74,10 +74,10 @@ DisplayString::DisplayString( void ) { // m_textString = ""; // not necessary, done by default - m_font = NULL; + m_font = nullptr; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; } @@ -117,7 +117,7 @@ void DisplayString::reset( void ) m_textString.clear(); // no font - m_font = NULL; + m_font = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp b/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp index fc7dd99c500..7f55378fd24 100644 --- a/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp @@ -32,7 +32,7 @@ #include "GameClient/DisplayStringManager.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -DisplayStringManager *TheDisplayStringManager = NULL; +DisplayStringManager *TheDisplayStringManager = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS @@ -43,8 +43,8 @@ DisplayStringManager *TheDisplayStringManager = NULL; DisplayStringManager::DisplayStringManager( void ) { - m_stringList = NULL; - m_currentCheckpoint = NULL; + m_stringList = nullptr; + m_currentCheckpoint = nullptr; } @@ -57,7 +57,7 @@ DisplayStringManager::~DisplayStringManager( void ) // we only keep track of the strings, we do NOT de-allocate them, our // list better be cleaned out before we destroy ourselves // - assert( m_stringList == NULL ); + assert( m_stringList == nullptr ); } @@ -68,8 +68,8 @@ void DisplayStringManager::link( DisplayString *string ) { assert( string ); - assert( string->m_next == NULL ); - assert( string->m_prev == NULL ); + assert( string->m_next == nullptr ); + assert( string->m_prev == nullptr ); string->m_next = m_stringList; if( m_stringList ) diff --git a/Generals/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp index 1e4b3994161..65742a9f76a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp @@ -52,4 +52,4 @@ DrawGroupInfo::DrawGroupInfo() m_usingPixelOffsetY = TRUE; } -DrawGroupInfo *TheDrawGroupInfo = NULL; +DrawGroupInfo *TheDrawGroupInfo = nullptr; diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index dcb9fc153f7..ea575b21fea 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -103,7 +103,7 @@ static const char *const TheDrawableIconNames[] = "Enthusiastic",//a red cross? // soon to replace? "Subliminal", //with the gold border! replace? "CarBomb", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheDrawableIconNames) == MAX_ICONS + 1, "Incorrect array size"); @@ -116,7 +116,7 @@ DrawableIconInfo::DrawableIconInfo() { for (int i = 0; i < MAX_ICONS; ++i) { - m_icon[i] = NULL; + m_icon[i] = nullptr; m_keepTillFrame[i] = 0; } } @@ -135,7 +135,7 @@ void DrawableIconInfo::clear() for (int i = 0; i < MAX_ICONS; ++i) { deleteInstance(m_icon[i]); - m_icon[i] = NULL; + m_icon[i] = nullptr; m_keepTillFrame[i] = 0; } } @@ -147,7 +147,7 @@ void DrawableIconInfo::killIcon(DrawableIconType t) if (m_icon[t]) { deleteInstance(m_icon[t]); - m_icon[t] = NULL; + m_icon[t] = nullptr; m_keepTillFrame[t] = 0; } } @@ -201,7 +201,7 @@ static const char *drawableIconIndexToName( DrawableIconType iconIndex ) static DrawableIconType drawableIconNameToIndex( const char *iconName ) { - DEBUG_ASSERTCRASH( iconName != NULL, ("drawableIconNameToIndex - Illegal name") ); + DEBUG_ASSERTCRASH( iconName != nullptr, ("drawableIconNameToIndex - Illegal name") ); for( Int i = ICON_FIRST; i < MAX_ICONS; ++i ) if( stricmp( TheDrawableIconNames[ i ], iconName ) == 0 ) @@ -225,12 +225,12 @@ const Int MAX_ENABLED_MODULES = 16; // ------------------------------------------------------------------------------------------------ /*static*/ Bool Drawable::s_staticImagesInited = false; -/*static*/ const Image* Drawable::s_veterancyImage[LEVEL_COUNT] = { NULL }; -/*static*/ const Image* Drawable::s_fullAmmo = NULL; -/*static*/ const Image* Drawable::s_emptyAmmo = NULL; -/*static*/ const Image* Drawable::s_fullContainer = NULL; -/*static*/ const Image* Drawable::s_emptyContainer = NULL; -/*static*/ Anim2DTemplate** Drawable::s_animationTemplates = NULL; +/*static*/ const Image* Drawable::s_veterancyImage[LEVEL_COUNT] = { nullptr }; +/*static*/ const Image* Drawable::s_fullAmmo = nullptr; +/*static*/ const Image* Drawable::s_emptyAmmo = nullptr; +/*static*/ const Image* Drawable::s_fullContainer = nullptr; +/*static*/ const Image* Drawable::s_emptyContainer = nullptr; +/*static*/ Anim2DTemplate** Drawable::s_animationTemplates = nullptr; #ifdef DIRTY_CONDITION_FLAGS /*static*/ Int Drawable::s_modelLockCount = 0; #endif @@ -241,7 +241,7 @@ const Int MAX_ENABLED_MODULES = 16; if (s_staticImagesInited) return; - s_veterancyImage[0] = NULL; + s_veterancyImage[0] = nullptr; s_veterancyImage[1] = TheMappedImageCollection->findImageByName("SCVeter1"); s_veterancyImage[2] = TheMappedImageCollection->findImageByName("SCVeter2"); s_veterancyImage[3] = TheMappedImageCollection->findImageByName("SCVeter3"); @@ -265,7 +265,7 @@ const Int MAX_ENABLED_MODULES = 16; s_animationTemplates[ICON_BATTLEPLAN_BOMBARD] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_BOMBARD]); s_animationTemplates[ICON_BATTLEPLAN_HOLDTHELINE] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_HOLDTHELINE]); s_animationTemplates[ICON_BATTLEPLAN_SEARCHANDDESTROY] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_SEARCHANDDESTROY]); - s_animationTemplates[ICON_EMOTICON] = NULL; //Emoticons can be anything, so we'll need to handle it dynamically. + s_animationTemplates[ICON_EMOTICON] = nullptr; //Emoticons can be anything, so we'll need to handle it dynamically. s_animationTemplates[ICON_ENTHUSIASTIC] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_ENTHUSIASTIC]); s_animationTemplates[ICON_ENTHUSIASTIC_SUBLIMINAL] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_ENTHUSIASTIC_SUBLIMINAL]); s_animationTemplates[ICON_CARBOMB] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_CARBOMB]); @@ -278,7 +278,7 @@ const Int MAX_ENABLED_MODULES = 16; /*static*/ void Drawable::killStaticImages() { delete[] s_animationTemplates; - s_animationTemplates = NULL; + s_animationTemplates = nullptr; } //------------------------------------------------------------------------------------------------- @@ -316,8 +316,8 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu // assign status bits before anything else can be done m_status = statusBits; - m_nextDrawable = NULL; - m_prevDrawable = NULL; + m_nextDrawable = nullptr; + m_prevDrawable = nullptr; // register drawable with the GameClient ... do this first before we start doing anything // complex that uses any of the drawable data so that we have and ID!! It's ok to initialize @@ -339,7 +339,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu TheGlobalLanguageData->adjustFontSize(TheInGameUI->getDrawableCaptionPointSize()), TheInGameUI->isDrawableCaptionBold() )); - m_ambientSound = NULL; + m_ambientSound = nullptr; m_decalOpacityFadeTarget = 0; m_decalOpacityFadeRate = 0; @@ -357,17 +357,17 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_shroudClearFrame = InvalidShroudClearFrame; for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) - m_modules[i] = NULL; + m_modules[i] = nullptr; m_stealthLook = STEALTHLOOK_NONE; m_flashCount = 0; - m_locoInfo = NULL; - m_physicsXform = NULL; + m_locoInfo = nullptr; + m_physicsXform = nullptr; // sanity - if( TheGameClient == NULL || thingTemplate == NULL ) + if( TheGameClient == nullptr || thingTemplate == nullptr ) { assert( 0 ); @@ -383,8 +383,8 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_instanceScale = thingTemplate->getAssetScale();// * fuzzyScale; // initially not bound to an object - m_object = NULL; - m_particle = NULL; + m_object = nullptr; + m_particle = nullptr; // tintStatusTracking m_tintStatus = 0; @@ -422,7 +422,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu continue; *m++ = TheModuleFactory->newModule(this, drawMI.getNthName(modIdx), newModData, MODULETYPE_DRAW); } - *m = NULL; + *m = nullptr; const ModuleInfo& cuMI = thingTemplate->getClientUpdateModuleInfo(); if (cuMI.getCount()) @@ -442,7 +442,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu *m++ = TheModuleFactory->newModule(this, cuMI.getNthName(modIdx), newModData, MODULETYPE_CLIENT_UPDATE); } - *m = NULL; + *m = nullptr; } /// allow for inter-Module resolution @@ -460,14 +460,14 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu (*dm)->setShadowsEnabled(shadowsEnabled); } - m_groupNumber = NULL; - m_captionDisplayString = NULL; + m_groupNumber = nullptr; + m_captionDisplayString = nullptr; m_drawableInfo.m_drawable = this; - m_drawableInfo.m_ghostObject = NULL; + m_drawableInfo.m_ghostObject = nullptr; - m_iconInfo = NULL; // lazily allocate! - m_selectionFlashEnvelope = NULL; // lazily allocate! - m_colorTintEnvelope = NULL; // lazily allocate! + m_iconInfo = nullptr; // lazily allocate! + m_selectionFlashEnvelope = nullptr; // lazily allocate! + m_colorTintEnvelope = nullptr; // lazily allocate! initStaticImages(); @@ -483,13 +483,13 @@ Drawable::~Drawable() if( m_constructDisplayString ) TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; if ( m_captionDisplayString ) TheDisplayStringManager->freeDisplayString( m_captionDisplayString ); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; - m_groupNumber = NULL; + m_groupNumber = nullptr; // delete any modules callbacks for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) @@ -497,37 +497,37 @@ Drawable::~Drawable() for (Module** m = m_modules[i]; m && *m; ++m) { deleteInstance(*m); - *m = NULL; // in case other modules call findModule from their dtor! + *m = nullptr; // in case other modules call findModule from their dtor! } delete [] m_modules[i]; - m_modules[i] = NULL; + m_modules[i] = nullptr; } stopAmbientSound(); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; /// @todo this is nasty, we need a real general effects system // remove any entries that might be present from the ray effect system TheGameClient->removeFromRayEffects( this ); - // reset object to NULL so we never mistaken grab "dead" objects - m_object = NULL; - m_particle = NULL; + // reset object to nullptr so we never mistaken grab "dead" objects + m_object = nullptr; + m_particle = nullptr; // delete any icons present deleteInstance(m_iconInfo); - m_iconInfo = NULL; + m_iconInfo = nullptr; deleteInstance(m_selectionFlashEnvelope); - m_selectionFlashEnvelope = NULL; + m_selectionFlashEnvelope = nullptr; deleteInstance(m_colorTintEnvelope); - m_colorTintEnvelope = NULL; + m_colorTintEnvelope = nullptr; deleteInstance(m_locoInfo); - m_locoInfo = NULL; + m_locoInfo = nullptr; delete m_physicsXform; } @@ -604,7 +604,7 @@ Bool Drawable::getShouldAnimate( Bool considerPower ) const Bool Drawable::clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform) { DrawModule** dm = getDrawModules(); - const ObjectDrawInterface* di = (dm && *dm) ? (*dm)->getObjectDrawInterface() : NULL; + const ObjectDrawInterface* di = (dm && *dm) ? (*dm)->getObjectDrawInterface() : nullptr; if (di) { return di->clientOnly_getRenderObjInfo(pos, boundingSphereRadius, transform); @@ -778,7 +778,7 @@ void Drawable::detachFromParticleSystem( void ) if (m_particle) { m_particle->detachDrawable(); - m_particle = NULL; + m_particle = nullptr; } } @@ -902,7 +902,7 @@ void Drawable::friend_clearSelected( void ) // ------------------------------------------------------------------------------------------------ void Drawable::colorFlash( const RGBColor* color, UnsignedInt decayFrames, UnsignedInt attackFrames, UnsignedInt sustainAtPeak ) { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); if( color ) @@ -929,7 +929,7 @@ void Drawable::colorTint( const RGBColor* color ) } else { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); // remove the tint applied to the object @@ -979,7 +979,7 @@ const Vector3 * Drawable::getTintColor( void ) const } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -995,7 +995,7 @@ const Vector3 * Drawable::getSelectionColor( void ) const } } - return NULL; + return nullptr; } @@ -1140,7 +1140,7 @@ void Drawable::updateDrawable( void ) if (m_expirationDate != 0 && now >= m_expirationDate) { - DEBUG_ASSERTCRASH(obj == NULL, ("Drawables with Objects should not have expiration dates!")); + DEBUG_ASSERTCRASH(obj == nullptr, ("Drawables with Objects should not have expiration dates!")); TheGameClient->destroyDrawable(this); return; } @@ -1163,26 +1163,26 @@ void Drawable::updateDrawable( void ) { if ( testTintStatus( TINT_STATUS_DISABLED ) ) { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->play( &DARK_GRAY_DISABLED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); } // else if ( testTintStatus( TINT_STATUS_POISONED) ) // { -// if (m_colorTintEnvelope == NULL) +// if (m_colorTintEnvelope == nullptr) // m_colorTintEnvelope = newInstance(TintEnvelope); // m_colorTintEnvelope->play( &SICKLY_GREEN_POISONED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); // } // else if ( testTintStatus( TINT_STATUS_IRRADIATED) ) // { -// if (m_colorTintEnvelope == NULL) +// if (m_colorTintEnvelope == nullptr) // m_colorTintEnvelope = newInstance(TintEnvelope); // m_colorTintEnvelope->play( &RED_IRRADIATED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); // } else { // NO TINTING SHOULD BE PRESENT - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->release(); // head on back to normal, now } @@ -1213,7 +1213,7 @@ void Drawable::updateDrawable( void ) //------------------------------------------------------------------------------------------------- void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care of the details if you spec no color { - if (m_selectionFlashEnvelope == NULL) + if (m_selectionFlashEnvelope == nullptr) m_selectionFlashEnvelope = newInstance(TintEnvelope); if ( color ) @@ -1242,7 +1242,7 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care //------------------------------------------------------------------------------------------------- void Drawable::applyPhysicsXform(Matrix3D* mtx) { - if (m_physicsXform != NULL) + if (m_physicsXform != nullptr) { // TheSuperHackers @tweak Update the physics transform on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. @@ -1309,7 +1309,7 @@ Bool Drawable::calcPhysicsXform(PhysicsXformInfo& info) // ------------------------------------------------------------------------------------------------ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); Real THRUST_ROLL = locomotor->getThrustRoll(); @@ -1388,7 +1388,7 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit(); @@ -1405,16 +1405,16 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; // get our position and direction vector @@ -1487,7 +1487,7 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real OVERLAP_SHRINK_FACTOR = 0.8f; @@ -1506,16 +1506,16 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return ; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; // get our position and direction vector @@ -1540,7 +1540,7 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI // get object we are currently overlapping, if any Object* overlapped = TheGameLogic->findObjectByID(physics->getCurrentOverlap()); if (overlapped && overlapped->isKindOf(KINDOF_SHRUBBERY)) { - overlapped = NULL; // We just smash through shrubbery. jba. + overlapped = nullptr; // We just smash through shrubbery. jba. } if (overlapped) @@ -1744,7 +1744,7 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit(); @@ -1765,16 +1765,16 @@ void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformI // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return ; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return ; // get our position and direction vector @@ -2225,11 +2225,11 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region ) { // sanity - if( draw == NULL ) + if( draw == nullptr ) return FALSE; const Object *obj = draw->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return FALSE; Coord3D p; @@ -2284,7 +2284,7 @@ Bool Drawable::drawsAnyUIText( void ) if (groupNum > NO_HOTKEY_SQUAD && groupNum < NUM_HOTKEY_SQUADS ) return TRUE; else - m_groupNumber = NULL; + m_groupNumber = nullptr; if ( obj->getFormationID() != NO_FORMATION_ID ) return TRUE; @@ -2303,7 +2303,7 @@ void Drawable::drawIconUI( void ) if( TheGameLogic->getDrawIconUI() && (TheScriptEngine->getFade()==ScriptEngine::FADE_NONE) ) { IRegion2D healthBarRegionStorage; - const IRegion2D* healthBarRegion = NULL; + const IRegion2D* healthBarRegion = nullptr; if (computeHealthRegion(this, healthBarRegionStorage)) healthBarRegion = &healthBarRegionStorage; //both data and a PointerAsFlag for logic in the methods below @@ -2350,7 +2350,7 @@ void Drawable::drawIconUI( void ) //------------------------------------------------------------------------------------------------ DrawableIconInfo* Drawable::getIconInfo() { - if (m_iconInfo == NULL) + if (m_iconInfo == nullptr) m_iconInfo = newInstance(DrawableIconInfo); return m_iconInfo; } @@ -2372,8 +2372,8 @@ void Drawable::setEmoticon( const AsciiString &name, Int duration ) Anim2DTemplate *animTemplate = TheAnim2DCollection->findTemplate( name ); if( animTemplate ) { - DEBUG_ASSERTCRASH( getIconInfo()->m_icon[ ICON_EMOTICON ] == NULL, ("Drawable::setEmoticon - Emoticon isn't empty, need to refuse to set or destroy the old one in favor of the new one") ); - if( getIconInfo()->m_icon[ ICON_EMOTICON ] == NULL ) + DEBUG_ASSERTCRASH( getIconInfo()->m_icon[ ICON_EMOTICON ] == nullptr, ("Drawable::setEmoticon - Emoticon isn't empty, need to refuse to set or destroy the old one in favor of the new one") ); + if( getIconInfo()->m_icon[ ICON_EMOTICON ] == nullptr ) { getIconInfo()->m_icon[ ICON_EMOTICON ] = newInstance(Anim2D)( animTemplate, TheAnim2DCollection ); getIconInfo()->m_keepTillFrame[ ICON_EMOTICON ] = duration >= 0 ? TheGameLogic->getFrame() + duration : FOREVER; @@ -2654,7 +2654,7 @@ void Drawable::drawUIText() // GameClient caches a list of us drawables during Drawablepostdraw() // then our group numbers get spit out last, so they draw in front - const IRegion2D* healthBarRegion = NULL; + const IRegion2D* healthBarRegion = nullptr; IRegion2D healthBarRegionStorage; if (computeHealthRegion(this, healthBarRegionStorage)) healthBarRegion = &healthBarRegionStorage; //both data and a PointerAsFlag for logic in the methods below @@ -2744,7 +2744,7 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion) if( body->getHealth() != body->getMaxHealth() ) { // const DamageInfo* lastDamage = body->getLastDamageInfo(); -// if( lastDamage != NULL && lastDamage->in.m_damageType == DAMAGE_HEALING +// if( lastDamage != nullptr && lastDamage->in.m_damageType == DAMAGE_HEALING // &&(TheGameLogic->getFrame() - body->getLastHealingTimestamp()) <= HEALING_ICON_DISPLAY_TIME // ) if ( TheGameLogic->getFrame() > HEALING_ICON_DISPLAY_TIME && // because so many things init health early in game @@ -2778,14 +2778,14 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion) // if( showHealing ) /// @todo HERE, WE NEED TO LEAVE STUFF ALONE, IF WE ARE ALREADY SHOWING HEALING { - if (healthBarRegion != NULL) + if (healthBarRegion != nullptr) { - if( getIconInfo()->m_icon[ typeIndex ] == NULL ) + if( getIconInfo()->m_icon[ typeIndex ] == nullptr ) getIconInfo()->m_icon[ typeIndex ] = newInstance(Anim2D)( s_animationTemplates[ typeIndex ], TheAnim2DCollection ); // draw the animation if present - if( getIconInfo()->m_icon[ typeIndex ] != NULL) + if( getIconInfo()->m_icon[ typeIndex ] != nullptr) { // @@ -2833,7 +2833,7 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion) // only display if have enthusiasm if( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_ENTHUSIASTIC ) == TRUE && - healthBarRegion != NULL ) + healthBarRegion != nullptr ) { DrawableIconType iconIndex = ICON_ENTHUSIASTIC; @@ -2844,11 +2844,11 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion) - if( getIconInfo()->m_icon[ iconIndex ] == NULL ) + if( getIconInfo()->m_icon[ iconIndex ] == nullptr ) getIconInfo()->m_icon[ iconIndex ] = newInstance(Anim2D)( s_animationTemplates[ iconIndex ], TheAnim2DCollection ); // draw the animation if present - if( getIconInfo()->m_icon[ iconIndex ] != NULL) + if( getIconInfo()->m_icon[ iconIndex ] != nullptr) { // @@ -2913,7 +2913,7 @@ void Drawable::drawDemoralized(const IRegion2D* healthBarRegion) if( healthBarRegion ) { // create icon if necessary - if( getIconInfo()->m_icon[ ICON_DEMORALIZED ] == NULL ) + if( getIconInfo()->m_icon[ ICON_DEMORALIZED ] == nullptr ) getIconInfo()->m_icon[ ICON_DEMORALIZED ] = newInstance(Anim2D)( s_animationTemplates[ ICON_DEMORALIZED ], TheAnim2DCollection ); if (getIconInfo()->m_icon[ ICON_DEMORALIZED ]) @@ -3141,7 +3141,7 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion) ) { // create icon if necessary - if( getIconInfo()->m_icon[ ICON_DISABLED ] == NULL ) + if( getIconInfo()->m_icon[ ICON_DISABLED ] == nullptr ) { getIconInfo()->m_icon[ ICON_DISABLED ] = newInstance(Anim2D) ( s_animationTemplates[ ICON_DISABLED ], TheAnim2DCollection ); @@ -3188,7 +3188,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) // this data is in an attached object Object *obj = getObject(); - if( obj == NULL || !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || + if( obj == nullptr || !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || obj->getStatusBits().test( OBJECT_STATUS_SOLD ) ) { // no object, or we are now complete get rid of the string if we have one @@ -3196,7 +3196,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) { TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; } return; } @@ -3208,7 +3208,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) //} // construction is partially complete, allocate a display string if we need one - if( m_constructDisplayString == NULL ) + if( m_constructDisplayString == nullptr ) m_constructDisplayString = TheDisplayStringManager->newDisplayString(); // set the string if the value has changed @@ -3285,7 +3285,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion ) // get object from drawble Object* obj = getObject(); - if( obj->getExperienceTracker() == NULL ) + if( obj->getExperienceTracker() == nullptr ) { //Only objects with experience trackers can possibly have veterancy. return; @@ -3347,7 +3347,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) Object *obj = getObject(); // if no object, nothing to do - if( obj == NULL ) + if( obj == nullptr ) return; if( obj->isKindOf( KINDOF_FORCEATTACKABLE ) ) @@ -3485,7 +3485,7 @@ DrawModule** Drawable::getDrawModules() } #endif - DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); + DEBUG_ASSERTCRASH(dm != nullptr, ("Draw Module List is not expected null")); return dm; } @@ -3511,7 +3511,7 @@ DrawModule const** Drawable::getDrawModules() const } #endif - DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); + DEBUG_ASSERTCRASH(dm != nullptr, ("Draw Module List is not expected null")); return dm; } @@ -3661,7 +3661,7 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an PhysicsXformInfo physicsXform; if (calcPhysicsXform(physicsXform)) { - DEBUG_ASSERTCRASH(m_physicsXform == NULL, ("m_physicsXform is not NULL")); + DEBUG_ASSERTCRASH(m_physicsXform == nullptr, ("m_physicsXform is not null")); m_physicsXform = new PhysicsXformInfo; *m_physicsXform = physicsXform; } @@ -3798,7 +3798,7 @@ void Drawable::setCaptionText( const UnicodeString& captionText ) UnicodeString sanitizedString = captionText; TheLanguageFilter->filterLine(sanitizedString); - if( m_captionDisplayString == NULL ) + if( m_captionDisplayString == nullptr ) { m_captionDisplayString = TheDisplayStringManager->newDisplayString(); GameFont *font = TheFontLibrary->getFont( @@ -3823,7 +3823,7 @@ void Drawable::clearCaptionText( void ) { if (m_captionDisplayString) TheDisplayStringManager->freeDisplayString(m_captionDisplayString); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -3863,7 +3863,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod) Bool trySound = FALSE; if( audio.getEventName().isNotEmpty() ) { - if (m_ambientSound == NULL) + if (m_ambientSound == nullptr) m_ambientSound = newInstance(DynamicAudioEventRTS); (m_ambientSound->m_event) = audio; @@ -3877,7 +3877,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod) const AudioEventRTS& pristineAudio = getAmbientSoundByDamage( BODY_PRISTINE ); if( pristineAudio.getEventName().isNotEmpty() ) { - if (m_ambientSound == NULL) + if (m_ambientSound == nullptr) m_ambientSound = newInstance(DynamicAudioEventRTS); (m_ambientSound->m_event) = pristineAudio; trySound = TRUE; @@ -3914,7 +3914,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod) { DEBUG_CRASH( ("Ambient sound %s missing! Skipping...", m_ambientSound->m_event.getEventName().str() ) ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } } } @@ -3968,7 +3968,7 @@ void Drawable::enableAmbientSound( Bool enable ) void Drawable::prependToList(Drawable **pListHead) { // add the object to the global list - m_prevDrawable = NULL; + m_prevDrawable = nullptr; m_nextDrawable = *pListHead; if (*pListHead) (*pListHead)->m_prevDrawable = this; @@ -4113,7 +4113,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -4199,7 +4199,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); // find module in the drawable module list - Module* module = NULL; + Module* module = nullptr; for( Module **m = m_modules[curModuleType]; m && *m; ++m ) { if (moduleIdentifierKey == (*m)->getModuleTagNameKey()) @@ -4220,7 +4220,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // it from the object definition in a future patch, if that is so, we need to // skip the module data in the file // - if( module == NULL ) + if( module == nullptr ) { // for testing purposes, this module better be found @@ -4280,7 +4280,7 @@ void Drawable::xfer( Xfer *xfer ) { TheAudio->killAudioEventImmediately( m_ambientSound->m_event.getPlayingHandle() ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } // drawable id @@ -4321,13 +4321,13 @@ void Drawable::xfer( Xfer *xfer ) } // selection flash envelope - Bool selFlash = (m_selectionFlashEnvelope != NULL); + Bool selFlash = (m_selectionFlashEnvelope != nullptr); xfer->xferBool( &selFlash ); if( selFlash ) { // allocate selection flash envelope if we need to - if( m_selectionFlashEnvelope == NULL ) + if( m_selectionFlashEnvelope == nullptr ) m_selectionFlashEnvelope = newInstance( TintEnvelope ); // xfer @@ -4336,13 +4336,13 @@ void Drawable::xfer( Xfer *xfer ) } // color tint envelope - Bool colFlash = (m_colorTintEnvelope != NULL); + Bool colFlash = (m_colorTintEnvelope != nullptr); xfer->xferBool( &colFlash ); if( colFlash ) { // allocate envelope if we need to - if( m_colorTintEnvelope == NULL ) + if( m_colorTintEnvelope == nullptr ) m_colorTintEnvelope = newInstance( TintEnvelope ); // xfer @@ -4448,11 +4448,11 @@ void Drawable::xfer( Xfer *xfer ) // time to fade xfer->xferUnsignedInt( &m_timeToFade ); - Bool hasLocoInfo = (m_locoInfo != NULL); + Bool hasLocoInfo = (m_locoInfo != nullptr); xfer->xferBool( &hasLocoInfo ); if (hasLocoInfo) { - if( xfer->getXferMode() == XFER_LOAD && m_locoInfo == NULL ) + if( xfer->getXferMode() == XFER_LOAD && m_locoInfo == nullptr ) m_locoInfo = newInstance(DrawableLocoInfo); // pitch @@ -4577,7 +4577,7 @@ void Drawable::xfer( Xfer *xfer ) { // skip empty icon slots - if( !hasIconInfo() || getIconInfo()->m_icon[ i ] == NULL ) + if( !hasIconInfo() || getIconInfo()->m_icon[ i ] == nullptr ) continue; // icon index name @@ -4623,7 +4623,7 @@ void Drawable::xfer( Xfer *xfer ) // icon template name xfer->xferAsciiString( &iconTemplateName ); animTemplate = TheAnim2DCollection->findTemplate( iconTemplateName ); - if( animTemplate == NULL ) + if( animTemplate == nullptr ) { DEBUG_CRASH(( "Drawable::xfer - Unknown icon template '%s'", iconTemplateName.str() )); @@ -4679,7 +4679,7 @@ void Drawable::loadPostProcess( void ) { // if we have an object, we don't need to save/load the pos, just restore it. // if we don't, we'd better save it! - if (m_object != NULL) + if (m_object != nullptr) { setTransformMatrix(m_object->getTransformMatrix()); } @@ -4705,7 +4705,7 @@ const Locomotor* Drawable::getLocomotor() const return ai->getCurLocomotor(); } } - return NULL; + return nullptr; } //================================================================================================= @@ -4717,7 +4717,7 @@ const Locomotor* Drawable::getLocomotor() const { if (TheGameClient) // WB has no GameClient! { - for (Drawable* d = TheGameClient->firstDrawable(); d != NULL; d = d->getNextDrawable()) + for (Drawable* d = TheGameClient->firstDrawable(); d != nullptr; d = d->getNextDrawable()) { // this will force us to update stuff. d->getDrawModules(); diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp index 5e486a2aa1d..9bb05a52467 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp @@ -58,9 +58,9 @@ void BeaconClientUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RadarPulseFrequency", INI::parseDurationUnsignedInt, NULL, offsetof(BeaconClientUpdateModuleData, m_framesBetweenRadarPulses) }, - { "RadarPulseDuration", INI::parseDurationUnsignedInt, NULL, offsetof(BeaconClientUpdateModuleData, m_radarPulseDuration) }, - { 0, 0, 0, 0 } + { "RadarPulseFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_framesBetweenRadarPulses) }, + { "RadarPulseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_radarPulseDuration) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -85,7 +85,7 @@ BeaconClientUpdate::~BeaconClientUpdate( void ) //------------------------------------------------------------------------------------------------- static ParticleSystem* createParticleSystem( Drawable *draw ) { - ParticleSystem *system = NULL; + ParticleSystem *system = nullptr; if (draw) { Object *obj = draw->getObject(); diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index 60c7ec34f5a..24870d4ff97 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -93,9 +93,9 @@ static void parseSideSoundsList( INI *ini, void *instance, void *store, const vo //----------------------------------------------------------------------------------- EvaSideSounds const FieldParse EvaSideSounds::s_evaSideSounds[] = { - { "Side", INI::parseAsciiString, NULL, offsetof( EvaSideSounds, m_side) }, - { "Sounds", INI::parseSoundsList, NULL, offsetof( EvaSideSounds, m_soundNames) }, - { 0, 0, 0, 0 }, + { "Side", INI::parseAsciiString, nullptr, offsetof( EvaSideSounds, m_side) }, + { "Sounds", INI::parseSoundsList, nullptr, offsetof( EvaSideSounds, m_soundNames) }, + { nullptr, nullptr, nullptr, 0 }, }; //------------------------------------------------------------------------------------ EvaCheckInfo @@ -112,11 +112,11 @@ EvaCheckInfo::EvaCheckInfo() : //------------------------------------------------------------------------------------------------- const FieldParse EvaCheckInfo::s_evaEventInfo[] = { - { "Priority", INI::parseUnsignedInt, NULL, offsetof( EvaCheckInfo, m_priority ) }, - { "TimeBetweenChecksMS", INI::parseDurationUnsignedInt, NULL, offsetof( EvaCheckInfo, m_framesBetweenChecks ) }, - { "ExpirationTimeMS", INI::parseDurationUnsignedInt, NULL, offsetof( EvaCheckInfo, m_framesToExpire) }, - { "SideSounds", parseSideSoundsList, NULL, offsetof( EvaCheckInfo, m_evaSideSounds ) }, - { 0, 0, 0, 0 }, + { "Priority", INI::parseUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_priority ) }, + { "TimeBetweenChecksMS", INI::parseDurationUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_framesBetweenChecks ) }, + { "ExpirationTimeMS", INI::parseDurationUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_framesToExpire) }, + { "SideSounds", parseSideSoundsList, nullptr, offsetof( EvaCheckInfo, m_evaSideSounds ) }, + { nullptr, nullptr, nullptr, 0 }, }; @@ -147,7 +147,7 @@ const ShouldPlayFunc Eva::s_shouldPlayFuncs[] = //------------------------------------------------------------------------------------------------- EvaCheck::EvaCheck() : - m_evaInfo(NULL), + m_evaInfo(nullptr), m_triggeredOnFrame(TRIGGEREDON_NOT), m_timeForNextCheck(NEXT_CHECK_NOW), m_alreadyPlayed(FALSE) @@ -157,7 +157,7 @@ EvaCheck::EvaCheck() : //------------------------------------------------------------------------------------------------- Eva::Eva() : - m_localPlayer(NULL), + m_localPlayer(nullptr), m_previousBuildingCount(0), m_previousUnitCount(0), m_enabled(TRUE) @@ -182,7 +182,7 @@ void Eva::init() { // parse the INI here, etc. INI ini; - ini.loadFileDirectory( "Data\\INI\\Eva", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\Eva", INI_LOAD_OVERWRITE, nullptr); } //------------------------------------------------------------------------------------------------- @@ -231,7 +231,7 @@ void Eva::update() } processPlayingMessages(frame); - m_localPlayer = NULL; + m_localPlayer = nullptr; // Reset all of the flags that have been set to true that haven't actually been probed, because // they will need to trigger again to be valid messages. @@ -272,7 +272,7 @@ EvaCheckInfo *Eva::newEvaCheckInfo(AsciiString name) EvaCheckInfoPtrVecIt it; for (it = m_allCheckInfos.begin(); it != m_allCheckInfos.end(); ++it) { if (*it && (*it)->m_message == mesg) - return NULL; + return nullptr; } EvaCheckInfo *checkInfo = newInstance(EvaCheckInfo); @@ -293,7 +293,7 @@ const EvaCheckInfo *Eva::getEvaCheckInfo(AsciiString name) return *it; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -328,7 +328,7 @@ Bool Eva::isTimeForCheck(EvaMessage messageToTest, UnsignedInt currentFrame) con //------------------------------------------------------------------------------------------------- Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) const { - if (m_localPlayer == NULL) { + if (m_localPlayer == nullptr) { return FALSE; } @@ -458,5 +458,5 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) } //------------------------------------------------------------------------------------------------- -Eva *TheEva = NULL; +Eva *TheEva = nullptr; diff --git a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp index 42cfdea1961..6290a3ddaac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/FXList.cpp @@ -56,7 +56,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -FXListStore *TheFXListStore = NULL; ///< the FXList store definition +FXListStore *TheFXListStore = nullptr; ///< the FXList store definition //------------------------------------------------------------------------------------------------- static void adjustVector(Coord3D *vec, const Matrix3D* mtx) @@ -81,10 +81,10 @@ static void adjustVector(Coord3D *vec, const Matrix3D* mtx) //------------------------------------------------------------------------------------------------- void FXNugget::doFXObj(const Object* primary, const Object* secondary) const { - const Coord3D* p = primary ? primary->getPosition() : NULL; - const Matrix3D* mtx = primary ? primary->getTransformMatrix() : NULL; + const Coord3D* p = primary ? primary->getPosition() : nullptr; + const Matrix3D* mtx = primary ? primary->getTransformMatrix() : nullptr; const Real speed = 0.0f; // yes, that's right -- NOT the object's speed. - const Coord3D* s = secondary ? secondary->getPosition() : NULL; + const Coord3D* s = secondary ? secondary->getPosition() : nullptr; doFXPos(p, mtx, speed, s); } @@ -107,7 +107,7 @@ class SoundFXNugget : public FXNugget TheAudio->addAudioEvent(&sound); } - virtual void doFXObj(const Object* primary, const Object* secondary = NULL) const + virtual void doFXObj(const Object* primary, const Object* secondary = nullptr) const { AudioEventRTS sound(m_soundName); if (primary) @@ -124,8 +124,8 @@ class SoundFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( SoundFXNugget, m_soundName ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( SoundFXNugget, m_soundName ) }, + { nullptr, nullptr, nullptr, 0 } }; SoundFXNugget* nugget = newInstance(SoundFXNugget); @@ -197,10 +197,10 @@ class TracerFXNugget : public FXNugget speed = primarySpeed; } - TracerDrawInterface* tdi = NULL; + TracerDrawInterface* tdi = nullptr; for (DrawModule** d = tracer->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getTracerDrawInterface()) != NULL) + if ((tdi = (*d)->getTracerDrawInterface()) != nullptr) { tdi->setTracerParms(speed, m_length, m_width, m_color, 1.0f); } @@ -222,15 +222,15 @@ class TracerFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "TracerName", INI::parseAsciiString, NULL, offsetof( TracerFXNugget, m_tracerName ) }, - { "BoneName", INI::parseAsciiString, NULL, offsetof( TracerFXNugget, m_boneName ) }, - { "Speed", INI::parseVelocityReal, NULL, offsetof( TracerFXNugget, m_speed ) }, - { "DecayAt", INI::parseReal, NULL, offsetof( TracerFXNugget, m_decayAt ) }, - { "Length", INI::parseReal, NULL, offsetof( TracerFXNugget, m_length ) }, - { "Width", INI::parseReal, NULL, offsetof( TracerFXNugget, m_width ) }, - { "Color", INI::parseRGBColor, NULL, offsetof( TracerFXNugget, m_color ) }, - { "Probability", INI::parseReal, NULL, offsetof( TracerFXNugget, m_probability ) }, - { 0, 0, 0, 0 } + { "TracerName", INI::parseAsciiString, nullptr, offsetof( TracerFXNugget, m_tracerName ) }, + { "BoneName", INI::parseAsciiString, nullptr, offsetof( TracerFXNugget, m_boneName ) }, + { "Speed", INI::parseVelocityReal, nullptr, offsetof( TracerFXNugget, m_speed ) }, + { "DecayAt", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_decayAt ) }, + { "Length", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_length ) }, + { "Width", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_width ) }, + { "Color", INI::parseRGBColor, nullptr, offsetof( TracerFXNugget, m_color ) }, + { "Probability", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_probability ) }, + { nullptr, nullptr, nullptr, 0 } }; TracerFXNugget* nugget = newInstance( TracerFXNugget ); @@ -291,10 +291,10 @@ class RayEffectFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( RayEffectFXNugget, m_templateName ) }, - { "PrimaryOffset", INI::parseCoord3D, NULL, offsetof( RayEffectFXNugget, m_primaryOffset ) }, - { "SecondaryOffset", INI::parseCoord3D, NULL, offsetof( RayEffectFXNugget, m_secondaryOffset ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( RayEffectFXNugget, m_templateName ) }, + { "PrimaryOffset", INI::parseCoord3D, nullptr, offsetof( RayEffectFXNugget, m_primaryOffset ) }, + { "SecondaryOffset", INI::parseCoord3D, nullptr, offsetof( RayEffectFXNugget, m_secondaryOffset ) }, + { nullptr, nullptr, nullptr, 0 } }; RayEffectFXNugget* nugget = newInstance( RayEffectFXNugget ); @@ -353,12 +353,12 @@ class LightPulseFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Color", INI::parseRGBColor, NULL, offsetof( LightPulseFXNugget, m_color ) }, - { "Radius", INI::parseReal, NULL, offsetof( LightPulseFXNugget, m_radius ) }, - { "RadiusAsPercentOfObjectSize", INI::parsePercentToReal, NULL, offsetof( LightPulseFXNugget, m_boundingCirclePct ) }, - { "IncreaseTime", INI::parseDurationUnsignedInt, NULL, offsetof( LightPulseFXNugget, m_increaseFrames ) }, - { "DecreaseTime", INI::parseDurationUnsignedInt, NULL, offsetof( LightPulseFXNugget, m_decreaseFrames ) }, - { 0, 0, 0, 0 } + { "Color", INI::parseRGBColor, nullptr, offsetof( LightPulseFXNugget, m_color ) }, + { "Radius", INI::parseReal, nullptr, offsetof( LightPulseFXNugget, m_radius ) }, + { "RadiusAsPercentOfObjectSize", INI::parsePercentToReal, nullptr, offsetof( LightPulseFXNugget, m_boundingCirclePct ) }, + { "IncreaseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( LightPulseFXNugget, m_increaseFrames ) }, + { "DecreaseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( LightPulseFXNugget, m_decreaseFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; LightPulseFXNugget* nugget = newInstance( LightPulseFXNugget ); @@ -402,8 +402,8 @@ class ViewShakeFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Type", parseShakeType, NULL, offsetof( ViewShakeFXNugget, m_shake ) }, - { 0, 0, 0, 0 } + { "Type", parseShakeType, nullptr, offsetof( ViewShakeFXNugget, m_shake ) }, + { nullptr, nullptr, nullptr, 0 } }; ViewShakeFXNugget* nugget = newInstance( ViewShakeFXNugget ); @@ -422,7 +422,7 @@ class ViewShakeFXNugget : public FXNugget { "SEVERE", View::SHAKE_SEVERE }, { "CINE_EXTREME", View::SHAKE_CINE_EXTREME }, { "CINE_INSANE", View::SHAKE_CINE_INSANE }, - { 0, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(shakeTypeNames) == View::SHAKE_COUNT + 1, "Incorrect array size"); @@ -466,9 +466,9 @@ class TerrainScorchFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Type", parseScorchType, NULL, offsetof( TerrainScorchFXNugget, m_scorch ) }, - { "Radius", INI::parseReal, NULL, offsetof( TerrainScorchFXNugget, m_radius ) }, - { 0, 0, 0, 0 } + { "Type", parseScorchType, nullptr, offsetof( TerrainScorchFXNugget, m_scorch ) }, + { "Radius", INI::parseReal, nullptr, offsetof( TerrainScorchFXNugget, m_radius ) }, + { nullptr, nullptr, nullptr, 0 } }; TerrainScorchFXNugget* nugget = newInstance( TerrainScorchFXNugget ); @@ -488,7 +488,7 @@ class TerrainScorchFXNugget : public FXNugget { "SCORCH_4", SCORCH_4 }, { "SHADOW_SCORCH", SHADOW_SCORCH }, { "RANDOM", -1 }, - { 0, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(scorchTypeNames) == SCORCH_COUNT + 2, "Incorrect array size"); @@ -527,7 +527,7 @@ class ParticleSystemFXNugget : public FXNugget { if (primary) { - reallyDoFX(primary, primaryMtx, NULL, overrideRadius); + reallyDoFX(primary, primaryMtx, nullptr, overrideRadius); } else { @@ -567,21 +567,21 @@ class ParticleSystemFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( ParticleSystemFXNugget, m_name ) }, - { "Count", INI::parseInt, NULL, offsetof( ParticleSystemFXNugget, m_count ) }, - { "Offset", INI::parseCoord3D, NULL, offsetof( ParticleSystemFXNugget, m_offset ) }, - { "Radius", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_radius ) }, - { "Height", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_height ) }, - { "InitialDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_delay ) }, - { "RotateX", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateX ) }, - { "RotateY", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateY ) }, - { "RotateZ", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateZ ) }, - { "OrientToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_orientToObject ) }, - { "Ricochet", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_ricochet ) }, - { "AttachToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_attachToObject ) }, - { "CreateAtGroundHeight", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) }, - { "UseCallersRadius", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_useCallersRadius ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( ParticleSystemFXNugget, m_name ) }, + { "Count", INI::parseInt, nullptr, offsetof( ParticleSystemFXNugget, m_count ) }, + { "Offset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemFXNugget, m_offset ) }, + { "Radius", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_radius ) }, + { "Height", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_height ) }, + { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_delay ) }, + { "RotateX", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateX ) }, + { "RotateY", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateY ) }, + { "RotateZ", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateZ ) }, + { "OrientToObject", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_orientToObject ) }, + { "Ricochet", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_ricochet ) }, + { "AttachToObject", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_attachToObject ) }, + { "CreateAtGroundHeight", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) }, + { "UseCallersRadius", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_useCallersRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; ParticleSystemFXNugget* nugget = newInstance( ParticleSystemFXNugget ); @@ -689,7 +689,7 @@ class FXListAtBonePosFXNugget : public FXNugget FXListAtBonePosFXNugget() { - m_fx = NULL; + m_fx = nullptr; m_boneName.clear(); m_orientToBone = true; } @@ -719,10 +719,10 @@ class FXListAtBonePosFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "FX", INI::parseFXList, NULL, offsetof( FXListAtBonePosFXNugget, m_fx ) }, - { "BoneName", INI::parseAsciiString, NULL, offsetof( FXListAtBonePosFXNugget, m_boneName ) }, - { "OrientToBone", INI::parseBool, NULL, offsetof( FXListAtBonePosFXNugget, m_orientToBone ) }, - { 0, 0, 0, 0 } + { "FX", INI::parseFXList, nullptr, offsetof( FXListAtBonePosFXNugget, m_fx ) }, + { "BoneName", INI::parseAsciiString, nullptr, offsetof( FXListAtBonePosFXNugget, m_boneName ) }, + { "OrientToBone", INI::parseBool, nullptr, offsetof( FXListAtBonePosFXNugget, m_orientToBone ) }, + { nullptr, nullptr, nullptr, 0 } }; FXListAtBonePosFXNugget* nugget = newInstance( FXListAtBonePosFXNugget ); @@ -747,7 +747,7 @@ class FXListAtBonePosFXNugget : public FXNugget Coord3D p; Matrix3D m; obj->convertBonePosToWorldPos(&bonePos[i], &boneMtx[i], &p, &m); - FXList::doFXPos(m_fx, &p, &m, 0.0f, NULL, 0.0f); + FXList::doFXPos(m_fx, &p, &m, 0.0f, nullptr, 0.0f); } } } @@ -769,15 +769,15 @@ EMPTY_DTOR(FXListAtBonePosFXNugget) static const FieldParse TheFXListFieldParse[] = { - { "Sound", SoundFXNugget::parse, 0, 0}, - { "RayEffect", RayEffectFXNugget::parse, 0, 0}, - { "Tracer", TracerFXNugget::parse, 0, 0}, - { "LightPulse", LightPulseFXNugget::parse, 0, 0}, - { "ViewShake", ViewShakeFXNugget::parse, 0, 0}, - { "TerrainScorch", TerrainScorchFXNugget::parse, 0, 0}, - { "ParticleSystem", ParticleSystemFXNugget::parse, 0, 0}, - { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } + { "Sound", SoundFXNugget::parse, nullptr, 0}, + { "RayEffect", RayEffectFXNugget::parse, nullptr, 0}, + { "Tracer", TracerFXNugget::parse, nullptr, 0}, + { "LightPulse", LightPulseFXNugget::parse, nullptr, 0}, + { "ViewShake", ViewShakeFXNugget::parse, nullptr, 0}, + { "TerrainScorch", TerrainScorchFXNugget::parse, nullptr, 0}, + { "ParticleSystem", ParticleSystemFXNugget::parse, nullptr, 0}, + { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, nullptr, 0}, + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -852,14 +852,14 @@ FXListStore::~FXListStore() const FXList *FXListStore::findFXList(const char* name) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; FXListMap::const_iterator it = m_fxmap.find(NAMEKEY(name)); if (it != m_fxmap.end()) { return &(*it).second; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index dc349e6e730..552d98bee82 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -72,7 +72,7 @@ AnimateWindow::AnimateWindow( void ) m_startPos.x = m_startPos.y = 0; m_endPos.x = m_endPos.y = 0; m_curPos.x = m_curPos.y = 0; - m_win = NULL; + m_win = nullptr; m_animType = WIN_ANIMATION_NONE; m_restPos.x = m_restPos.y = 0; @@ -84,7 +84,7 @@ AnimateWindow::AnimateWindow( void ) } AnimateWindow::~AnimateWindow( void ) { - m_win = NULL; + m_win = nullptr; } void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, @@ -146,7 +146,7 @@ AnimateWindowManager::~AnimateWindowManager( void ) delete m_spiral; delete m_slideFromBottomTimed; - m_slideFromRight = NULL; + m_slideFromRight = nullptr; resetToRestPosition( ); clearWinList(m_winList); clearWinList(m_winMustFinishList); @@ -173,7 +173,7 @@ void AnimateWindowManager::reset( void ) void AnimateWindowManager::update( void ) { - ProcessAnimateWindow *processAnim = NULL; + ProcessAnimateWindow *processAnim = nullptr; // if we need to update the windows that need to finish, update that list if(m_needsUpdate) @@ -238,7 +238,7 @@ void AnimateWindowManager::registerGameWindow(GameWindow *win, AnimTypes animTyp { if(!win) { - DEBUG_CRASH(("Win was NULL as it was passed into registerGameWindow... not good indeed")); + DEBUG_CRASH(("Win was null as it was passed into registerGameWindow... not good indeed")); return; } if(animType <= WIN_ANIMATION_NONE || animType >= WIN_ANIMATION_COUNT ) @@ -308,7 +308,7 @@ ProcessAnimateWindow *AnimateWindowManager::getProcessAnimate( AnimTypes animTyp return m_slideFromTopFast; } default: - return NULL; + return nullptr; } } @@ -317,7 +317,7 @@ void AnimateWindowManager::reverseAnimateWindow( void ) m_reverse = TRUE; m_needsUpdate = TRUE; - ProcessAnimateWindow *processAnim = NULL; + ProcessAnimateWindow *processAnim = nullptr; UnsignedInt maxDelay = 0; AnimateWindowList::iterator it = m_winMustFinishList.begin(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 75952a05f2b..1a15cb86512 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -84,11 +84,11 @@ // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -ControlBar *TheControlBar = NULL; +ControlBar *TheControlBar = nullptr; -const Image* ControlBar::m_rankVeteranIcon = NULL; -const Image* ControlBar::m_rankEliteIcon = NULL; -const Image* ControlBar::m_rankHeroicIcon = NULL; +const Image* ControlBar::m_rankVeteranIcon = nullptr; +const Image* ControlBar::m_rankEliteIcon = nullptr; +const Image* ControlBar::m_rankHeroicIcon = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // CommandButton ////////////////////////////////////////////////////////////////////////////////// @@ -99,26 +99,26 @@ const Image* ControlBar::m_rankHeroicIcon = NULL; const FieldParse CommandButton::s_commandButtonFieldParseTable[] = { - { "Command", CommandButton::parseCommand, NULL, offsetof( CommandButton, m_command ) }, + { "Command", CommandButton::parseCommand, nullptr, offsetof( CommandButton, m_command ) }, { "Options", INI::parseBitString32, TheCommandOptionNames, offsetof( CommandButton, m_options ) }, - { "Object", INI::parseThingTemplate, NULL, offsetof( CommandButton, m_thingTemplate ) }, - { "Upgrade", INI::parseUpgradeTemplate, NULL, offsetof( CommandButton, m_upgradeTemplate ) }, + { "Object", INI::parseThingTemplate, nullptr, offsetof( CommandButton, m_thingTemplate ) }, + { "Upgrade", INI::parseUpgradeTemplate, nullptr, offsetof( CommandButton, m_upgradeTemplate ) }, { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( CommandButton, m_weaponSlot ) }, - { "MaxShotsToFire", INI::parseInt, NULL, offsetof( CommandButton, m_maxShotsToFire ) }, - { "Science", INI::parseScienceVector, NULL, offsetof( CommandButton, m_science ) }, - { "SpecialPower", INI::parseSpecialPowerTemplate, NULL, offsetof( CommandButton, m_specialPower ) }, - { "TextLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_textLabel ) }, - { "DescriptLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_descriptionLabel ) }, - { "PurchasedLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_purchasedLabel ) }, - { "ConflictingLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_conflictingLabel ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( CommandButton, m_buttonImageName ) }, - { "CursorName", INI::parseAsciiString, NULL, offsetof( CommandButton, m_cursorName ) }, - { "InvalidCursorName", INI::parseAsciiString, NULL, offsetof( CommandButton, m_invalidCursorName ) }, + { "MaxShotsToFire", INI::parseInt, nullptr, offsetof( CommandButton, m_maxShotsToFire ) }, + { "Science", INI::parseScienceVector, nullptr, offsetof( CommandButton, m_science ) }, + { "SpecialPower", INI::parseSpecialPowerTemplate, nullptr, offsetof( CommandButton, m_specialPower ) }, + { "TextLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_textLabel ) }, + { "DescriptLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_descriptionLabel ) }, + { "PurchasedLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_purchasedLabel ) }, + { "ConflictingLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_conflictingLabel ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_buttonImageName ) }, + { "CursorName", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_cursorName ) }, + { "InvalidCursorName", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_invalidCursorName ) }, { "ButtonBorderType", INI::parseLookupList, CommandButtonMappedBorderTypeNames, offsetof( CommandButton, m_commandButtonBorder ) }, { "RadiusCursorType", INI::parseIndexList, TheRadiusCursorNames, offsetof( CommandButton, m_radiusCursor ) }, - { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( CommandButton, m_unitSpecificSound ) }, + { "UnitSpecificSound", INI::parseAudioEventRTS, nullptr, offsetof( CommandButton, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; static void commandButtonTooltip(GameWindow *window, @@ -201,9 +201,9 @@ void ControlBar::populatePurchaseScience( Player* player ) // if no command set match is found hide all the buttons - if( commandSet1 == NULL || - commandSet3 == NULL || - commandSet8 == NULL ) + if( commandSet1 == nullptr || + commandSet3 == nullptr || + commandSet8 == nullptr ) return; // populate the button with commands defined @@ -215,7 +215,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet1->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { // hide window on interface m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE ); @@ -275,7 +275,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet3->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { // hide window on interface m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE ); @@ -338,7 +338,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet8->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { // hide window on interface m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE ); @@ -390,7 +390,7 @@ void ControlBar::populatePurchaseScience( Player* player ) } - GameWindow *win = NULL; + GameWindow *win = nullptr; UnicodeString tempUS; win = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:StaticTextRankPointsAvailable" ) ); if(win) @@ -463,7 +463,7 @@ void ControlBar::populatePurchaseScience( Player* player ) //------------------------------------------------------------------------------------------------- void ControlBar::updateContextPurchaseScience( void ) { - GameWindow *win =NULL; + GameWindow *win =nullptr; Player *player = ThePlayerList->getLocalPlayer(); win = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:ProgressBarExperience" ) ); if(win) @@ -484,12 +484,12 @@ void ControlBar::updateContextPurchaseScience( void ) /// @todo srj -- evil hack testing code. do not imitate. Object *obj = m_currentSelectedDrawable->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return; // sanity if( obj->isKindOf( KINDOF_COMMANDCENTER ) == FALSE ) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); GameWindow* win = m_contextParent[ CP_PURCHASE_SCIENCE ]; @@ -508,7 +508,7 @@ void ControlBar::updateContextPurchaseScience( void ) msg->appendIntegerArgument( st ); } - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); } */ @@ -547,18 +547,18 @@ CommandButton::CommandButton( void ) { m_command = GUI_COMMAND_NONE; - m_thingTemplate = NULL; - m_upgradeTemplate = NULL; + m_thingTemplate = nullptr; + m_upgradeTemplate = nullptr; m_weaponSlot = PRIMARY_WEAPON; m_maxShotsToFire = 0x7fffffff; // huge number m_science.clear(); - m_specialPower = NULL; - m_buttonImage = NULL; + m_specialPower = nullptr; + m_buttonImage = nullptr; //Code renderer handles these states now. - //m_disabledImage = NULL; - //m_hiliteImage = NULL; - //m_pushedImage = NULL; + //m_disabledImage = nullptr; + //m_hiliteImage = nullptr; + //m_pushedImage = nullptr; m_flashCount = 0; m_conflictingLabel.clear(); @@ -569,10 +569,10 @@ CommandButton::CommandButton( void ) m_options = 0; m_purchasedLabel.clear(); m_textLabel.clear(); - m_window = NULL; + m_window = nullptr; m_commandButtonBorder = COMMAND_BUTTON_BORDER_NONE; - //m_prev = NULL; - m_next = NULL; + //m_prev = nullptr; + m_next = nullptr; m_radiusCursor = RADIUSCURSOR_NONE; } @@ -627,7 +627,7 @@ Bool CommandButton::isValidToUseOn(const Object *sourceObj, const Object *target if (pui) { const ProductionEntry *pe = pui->firstProduction(); while (pe) { - if (pe->getProductionUpgrade() != NULL) + if (pe->getProductionUpgrade() != nullptr) return false; pe = pui->nextProduction(pe); } @@ -654,7 +654,7 @@ Bool CommandButton::isValidToUseOn(const Object *sourceObj, const Object *target if( BitIsSet( m_options, NEED_TARGET_POS ) ) { - return TheActionManager->canDoSpecialPowerAtLocation( sourceObj, targetLocation, commandSource, m_specialPower, NULL, m_options, false ); + return TheActionManager->canDoSpecialPowerAtLocation( sourceObj, targetLocation, commandSource, m_specialPower, nullptr, m_options, false ); } return TheActionManager->canDoSpecialPower( sourceObj, m_specialPower, commandSource, m_options, false ); @@ -676,7 +676,7 @@ Bool CommandButton::isReady(const Object *sourceObj) const //------------------------------------------------------------------------------------------------- Bool CommandButton::isValidObjectTarget(const Drawable* source, const Drawable* target) const { - return isValidObjectTarget(source ? source->getObject() : NULL, target ? target->getObject() : NULL); + return isValidObjectTarget(source ? source->getObject() : nullptr, target ? target->getObject() : nullptr); } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -690,7 +690,7 @@ Bool CommandButton::isValidObjectTarget(const Drawable* source, const Drawable* const FieldParse CommandSet::m_commandSetFieldParseTable[] = { - { "1", CommandSet::parseCommandButton, (void *)0, offsetof( CommandSet, m_command ) }, + { "1", CommandSet::parseCommandButton, (void *)nullptr, offsetof( CommandSet, m_command ) }, { "2", CommandSet::parseCommandButton, (void *)1, offsetof( CommandSet, m_command ) }, { "3", CommandSet::parseCommandButton, (void *)2, offsetof( CommandSet, m_command ) }, { "4", CommandSet::parseCommandButton, (void *)3, offsetof( CommandSet, m_command ) }, @@ -702,7 +702,7 @@ const FieldParse CommandSet::m_commandSetFieldParseTable[] = { "10", CommandSet::parseCommandButton, (void *)9, offsetof( CommandSet, m_command ) }, { "11", CommandSet::parseCommandButton, (void *)10, offsetof( CommandSet, m_command ) }, { "12", CommandSet::parseCommandButton, (void *)11, offsetof( CommandSet, m_command ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -777,7 +777,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons // get find the command button from this name const CommandButton *commandButton = TheControlBar->findCommandButton( AsciiString( token ) ); - if( commandButton == NULL ) + if( commandButton == nullptr ) { DEBUG_CRASH(( "[LINE: %d - FILE: '%s'] Unknown command '%s' found in command set", @@ -803,10 +803,10 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons //------------------------------------------------------------------------------------------------- CommandSet::CommandSet(const AsciiString& name) : m_name(name), - m_next(NULL) + m_next(nullptr) { for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - m_command[ i ] = NULL; + m_command[ i ] = nullptr; } //------------------------------------------------------------------------------------------------- @@ -845,67 +845,67 @@ CommandSet::~CommandSet( void ) ControlBar::ControlBar( void ) { Int i; - m_commandButtons = NULL; - m_commandSets = NULL; - m_controlBarSchemeManager = NULL; + m_commandButtons = nullptr; + m_commandSets = nullptr; + m_controlBarSchemeManager = nullptr; m_isObserverCommandBar = FALSE; - m_observerLookAtPlayer = NULL; - m_observedPlayer = NULL; - m_buildToolTipLayout = NULL; + m_observerLookAtPlayer = nullptr; + m_observedPlayer = nullptr; + m_buildToolTipLayout = nullptr; m_showBuildToolTipLayout = FALSE; m_animateDownWin1Pos.x = m_animateDownWin1Pos.y = 0; m_animateDownWin1Size.x = m_animateDownWin1Size.y = 0; m_animateDownWin2Pos.x = m_animateDownWin2Pos.y = 0; m_animateDownWin2Size.x = m_animateDownWin2Size.y = 0; - m_animateDownWindow = NULL; + m_animateDownWindow = nullptr; m_animTime = 0; for( i = 0; i < MAX_COMMANDS_PER_SET; i++) { - m_commonCommands[i] = 0; + m_commonCommands[i] = nullptr; } m_currContext = CB_CONTEXT_NONE; m_defaultControlBarPosition.x = m_defaultControlBarPosition.y = 0; m_genStarFlash = FALSE; - m_genStarOff = NULL; - m_genStarOn = NULL; + m_genStarOff = nullptr; + m_genStarOn = nullptr; m_UIDirty = FALSE; - // m_controlBarResizer = NULL; + // m_controlBarResizer = nullptr; m_buildUpClockColor = GameMakeColor(0,0,0,100); m_commandBarBorderColor = GameMakeColor(0,0,0,100); for( i = 0; i < NUM_CONTEXT_PARENTS; i++ ) - m_contextParent[ i ] = NULL; + m_contextParent[ i ] = nullptr; for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commandWindows[ i ] = NULL; + m_commandWindows[ i ] = nullptr; // removed from multiplayer branch - //m_commandMarkers[ i ] = NULL; + //m_commandMarkers[ i ] = nullptr; } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) - m_sciencePurchaseWindowsRank1[i] = NULL; + m_sciencePurchaseWindowsRank1[i] = nullptr; for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) - m_sciencePurchaseWindowsRank3[i] = NULL; + m_sciencePurchaseWindowsRank3[i] = nullptr; for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) - m_sciencePurchaseWindowsRank8[i] = NULL; + m_sciencePurchaseWindowsRank8[i] = nullptr; for( i = 0; i < MAX_SPECIAL_POWER_SHORTCUTS; i++ ) { - m_specialPowerShortcutButtons[i] = NULL; - m_specialPowerShortcutButtonParents[i] = NULL; + m_specialPowerShortcutButtons[i] = nullptr; + m_specialPowerShortcutButtonParents[i] = nullptr; } - m_specialPowerShortcutParent = NULL; - m_specialPowerLayout = NULL; - m_scienceLayout = NULL; - m_rightHUDWindow = NULL; - m_rightHUDCameoWindow = NULL; + m_specialPowerShortcutParent = nullptr; + m_specialPowerLayout = nullptr; + m_scienceLayout = nullptr; + m_rightHUDWindow = nullptr; + m_rightHUDCameoWindow = nullptr; for( i = 0; i < MAX_RIGHT_HUD_UPGRADE_CAMEOS; i++ ) m_rightHUDUpgradeCameos[i]; - m_rightHUDUnitSelectParent = NULL; - m_communicatorButton = NULL; - m_currentSelectedDrawable = NULL; + m_rightHUDUnitSelectParent = nullptr; + m_communicatorButton = nullptr; + m_currentSelectedDrawable = nullptr; m_currContext = CB_CONTEXT_NONE; m_rallyPointDrawableID = INVALID_DRAWABLE_ID; m_displayedConstructPercent = -1.0f; @@ -915,27 +915,27 @@ ControlBar::ControlBar( void ) resetContainData(); m_lastRecordedInventoryCount = 0; - m_videoManager = NULL; - m_animateWindowManager = NULL; - m_generalsScreenAnimate = NULL; - m_animateWindowManagerForGenShortcuts = NULL; + m_videoManager = nullptr; + m_animateWindowManager = nullptr; + m_generalsScreenAnimate = nullptr; + m_animateWindowManagerForGenShortcuts = nullptr; m_flash = FALSE; - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; - - m_generalButtonEnable = NULL; - m_generalButtonHighlight = NULL; - m_genArrow = NULL; + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; + + m_generalButtonEnable = nullptr; + m_generalButtonHighlight = nullptr; + m_genArrow = nullptr; m_sideSelectAnimateDown = FALSE; updateCommanBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); m_radarAttackGlowOn = FALSE; m_remainingRadarAttackGlowFrames = 0; - m_radarAttackGlowWindow = NULL; + m_radarAttackGlowWindow = nullptr; #if defined(RTS_DEBUG) m_lastFrameMarkedDirty = 0; @@ -953,27 +953,27 @@ ControlBar::~ControlBar( void ) { m_scienceLayout->destroyWindows(); deleteInstance(m_scienceLayout); - m_scienceLayout = NULL; + m_scienceLayout = nullptr; } - m_genArrow = NULL; + m_genArrow = nullptr; delete m_videoManager; - m_videoManager = NULL; + m_videoManager = nullptr; delete m_animateWindowManagerForGenShortcuts; - m_animateWindowManagerForGenShortcuts = NULL; + m_animateWindowManagerForGenShortcuts = nullptr; delete m_animateWindowManager; - m_animateWindowManager = NULL; + m_animateWindowManager = nullptr; delete m_generalsScreenAnimate; - m_generalsScreenAnimate = NULL; + m_generalsScreenAnimate = nullptr; delete m_controlBarSchemeManager; - m_controlBarSchemeManager = NULL; + m_controlBarSchemeManager = nullptr; // delete m_controlBarResizer; -// m_controlBarResizer = NULL; +// m_controlBarResizer = nullptr; // destroy all the command set definitions CommandSet *set; @@ -998,22 +998,22 @@ ControlBar::~ControlBar( void ) { m_buildToolTipLayout->destroyWindows(); deleteInstance(m_buildToolTipLayout); - m_buildToolTipLayout = NULL; + m_buildToolTipLayout = nullptr; } if(m_specialPowerLayout) { m_specialPowerLayout->destroyWindows(); deleteInstance(m_specialPowerLayout); - m_specialPowerLayout = NULL; + m_specialPowerLayout = nullptr; } - m_radarAttackGlowWindow = NULL; + m_radarAttackGlowWindow = nullptr; if (m_rightHUDCameoWindow && m_rightHUDCameoWindow->winGetUserData()) { delete m_rightHUDCameoWindow->winGetUserData(); - m_rightHUDCameoWindow->winSetUserData(NULL); + m_rightHUDCameoWindow->winSetUserData(nullptr); } } @@ -1027,11 +1027,11 @@ void ControlBar::init( void ) INI ini; m_sideSelectAnimateDown = FALSE; // load the command buttons - ini.loadFileDirectory( "Data\\INI\\Default\\CommandButton", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\CommandButton", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\CommandButton", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\CommandButton", INI_LOAD_OVERWRITE, nullptr ); // load the command sets - ini.loadFileDirectory( "Data\\INI\\CommandSet", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\CommandSet", INI_LOAD_OVERWRITE, nullptr ); // post process step after loading the command buttons and command sets postProcessCommands(); @@ -1051,35 +1051,35 @@ void ControlBar::init( void ) // NameKeyType id; id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" ); - m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( nullptr, id ); m_contextParent[ CP_MASTER ]->winGetPosition(&m_defaultControlBarPosition.x, &m_defaultControlBarPosition.y); m_scienceLayout = TheWindowManager->winCreateLayout("GeneralsExpPoints.wnd"); m_scienceLayout->hide(TRUE); id = TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:GenExpParent" ); - m_contextParent[ CP_PURCHASE_SCIENCE ] = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); + m_contextParent[ CP_PURCHASE_SCIENCE ] = TheWindowManager->winGetWindowFromId( nullptr, id );//m_scienceLayout->getFirstWindow(); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionWindow" ); - m_contextParent[ CP_UNDER_CONSTRUCTION ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_UNDER_CONSTRUCTION ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerWindow" ); - m_contextParent[ CP_OCL_TIMER ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OCL_TIMER ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BeaconWindow" ); - m_contextParent[ CP_BEACON ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_BEACON ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CommandWindow" ); - m_contextParent[ CP_COMMAND ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_COMMAND ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ProductionQueueWindow" ); - m_contextParent[ CP_BUILD_QUEUE ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_BUILD_QUEUE ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ObserverPlayerListWindow" ); - m_contextParent[ CP_OBSERVER_LIST ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OBSERVER_LIST ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ObserverPlayerInfoWindow" ); - m_contextParent[ CP_OBSERVER_INFO ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OBSERVER_INFO ] = TheWindowManager->winGetWindowFromId( nullptr, id ); // get the command windows and save for easy access later @@ -1142,13 +1142,13 @@ void ControlBar::init( void ) // keep a pointer to the window making up the right HUD display id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" ); - m_rightHUDWindow = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDWindow = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUnitSelected" ); - m_rightHUDUnitSelectParent = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDUnitSelectParent = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoWindow" ); - m_rightHUDCameoWindow = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDCameoWindow = TheWindowManager->winGetWindowFromId( nullptr, id ); for( i = 0; i < MAX_RIGHT_HUD_UPGRADE_CAMEOS; i++ ) { windowName.format( "ControlBar.wnd:UnitUpgrade%d", i+1 ); @@ -1164,63 +1164,63 @@ void ControlBar::init( void ) // don't forget about the communicator button CCB id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ); - m_communicatorButton = TheWindowManager->winGetWindowFromId( NULL, id ); + m_communicatorButton = TheWindowManager->winGetWindowFromId( nullptr, id ); setControlCommand(m_communicatorButton, findCommandButton("NonCommand_Communicator") ); m_communicatorButton->winSetTooltipFunc(commandButtonTooltip); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonOptions")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonOptions")); if(win) { setControlCommand(win, findCommandButton("NonCommand_Options") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); if(win) { setControlCommand(win, findCommandButton("NonCommand_IdleWorker") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonPlaceBeacon")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonPlaceBeacon")); if(win) { setControlCommand(win, findCommandButton("NonCommand_Beacon") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(win) { setControlCommand(win, findCommandButton("NonCommand_GeneralsExperience") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonLarge")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonLarge")); if(win) { setControlCommand(win, findCommandButton("NonCommand_UpDown") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:PowerWindow")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:PowerWindow")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:MoneyDisplay")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:MoneyDisplay")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:GeneralsExp")); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:GeneralsExp")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - m_radarAttackGlowWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinUAttack")); + m_radarAttackGlowWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinUAttack")); - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); win->winGetScreenPosition(&m_controlBarForegroundMarkerPos.x, &m_controlBarForegroundMarkerPos.y); - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); win->winGetScreenPosition(&m_controlBarBackgroundMarkerPos.x,&m_controlBarBackgroundMarkerPos.y); if(!m_videoManager) @@ -1238,14 +1238,14 @@ void ControlBar::init( void ) m_buildToolTipLayout->setUpdate(ControlBarPopupDescriptionUpdateFunc); } - m_genStarOn = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarON") : NULL; - m_genStarOff = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarOFF") : NULL; + m_genStarOn = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarON") : nullptr; + m_genStarOff = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarOFF") : nullptr; m_genStarFlash = TRUE; m_lastFlashedAtPointValue = -1; - m_rankVeteranIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron1L" ) : NULL; - m_rankEliteIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron2L" ) : NULL; - m_rankHeroicIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron3L" ) : NULL; + m_rankVeteranIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron1L" ) : nullptr; + m_rankEliteIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron2L" ) : nullptr; + m_rankHeroicIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron3L" ) : nullptr; // if(!m_controlBarResizer) @@ -1258,7 +1258,7 @@ void ControlBar::init( void ) initObserverControls(); // by default switch to the none context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); } } @@ -1280,8 +1280,8 @@ void ControlBar::reset( void ) m_displayedOCLTimerSeconds = 0; m_isObserverCommandBar = FALSE; // reset us to use a normal command bar - m_observerLookAtPlayer = NULL; - m_observedPlayer = NULL; + m_observerLookAtPlayer = nullptr; + m_observedPlayer = nullptr; if(m_buildToolTipLayout) m_buildToolTipLayout->hide(TRUE); @@ -1301,12 +1301,12 @@ void ControlBar::reset( void ) m_videoManager->reset(); // go back to default context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_sideSelectAnimateDown = FALSE; if(m_animateDownWindow) { TheWindowManager->winDestroy( m_animateDownWindow ); - m_animateDownWindow = NULL; + m_animateDownWindow = nullptr; } // Remove any overridden sets. @@ -1320,7 +1320,7 @@ void ControlBar::reset( void ) } Overridable *stillValid = set->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_commandSets = nextSet; } @@ -1338,7 +1338,7 @@ void ControlBar::reset( void ) } Overridable *stillValid = button->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_commandButtons = nextButton; } @@ -1346,7 +1346,7 @@ void ControlBar::reset( void ) } if(TheTransitionHandler) TheTransitionHandler->remove("ControlBarArrow"); - m_genArrow = NULL; + m_genArrow = nullptr; m_lastFlashedAtPointValue = -1; m_genStarFlash = TRUE; @@ -1377,7 +1377,7 @@ void ControlBar::update( void ) if (m_animateWindowManager->isFinished() && m_animateWindowManager->isReversed()) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window && !window->winIsHidden()) window->winHide(TRUE); } @@ -1414,7 +1414,7 @@ void ControlBar::update( void ) if((TheGameLogic->getFrame() % (LOGICFRAMES_PER_SECOND/2)) == 0) populateObserverInfoWindow(); - Drawable *drawToEvaluateFor = NULL; + Drawable *drawToEvaluateFor = nullptr; if( TheInGameUI->getSelectCount() > 1 ) { // Attempt to isolate a Drawable here to evaluate @@ -1430,10 +1430,10 @@ void ControlBar::update( void ) drawToEvaluateFor = TheInGameUI->getAllSelectedDrawables()->front(); } - Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : NULL; + Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : nullptr; setPortraitByObject(obj); - const Coord3D* exitPosition = NULL; + const Coord3D* exitPosition = nullptr; if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface()) exitPosition = obj->getObjectExitInterface()->getRallyPoint(); @@ -1449,10 +1449,10 @@ void ControlBar::update( void ) for( Int i = 0; i < MAX_COMMANDS_PER_SET; ++i ) { GameWindow *button = m_commandWindows[ i ]; - if( button != NULL) + if( button != nullptr) { const CommandButton *commandButton = (const CommandButton *)GadgetButtonGetData(button); - if( commandButton != NULL ) + if( commandButton != nullptr ) { if( commandButton->getFlashCount() > 0 && TheGameClient->getFrame() % 10 == 0 ) { @@ -1498,7 +1498,7 @@ void ControlBar::update( void ) const ThingTemplate *thing = TheThingFactory->findTemplate( ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getBeaconTemplate() ); ThePlayerList->getLocalPlayer()->countObjectsByThingTemplate( 1, &thing, false, &count ); static NameKeyType beaconPlacementButtonID = NAMEKEY("ControlBar.wnd:ButtonPlaceBeacon"); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, beaconPlacementButtonID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, beaconPlacementButtonID); if (win) { if (count < TheMultiplayerSettings->getMaxBeaconsPerPlayer()) @@ -1526,7 +1526,7 @@ void ControlBar::update( void ) // if nothing is selected get out of here except if we're in the Purchase science context... that requires // us to not have anything selected - if( m_currentSelectedDrawable == NULL ) + if( m_currentSelectedDrawable == nullptr ) { // we better be in the default none context @@ -1538,13 +1538,13 @@ void ControlBar::update( void ) // if our selected drawable has no object get out of here - Object *obj = NULL; + Object *obj = nullptr; if(m_currentSelectedDrawable) obj = m_currentSelectedDrawable->getObject(); - if( obj == NULL ) + if( obj == nullptr ) { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return; } @@ -1596,7 +1596,7 @@ void ControlBar::onDrawableSelected( Drawable *draw ) markUIDirty(); // cancel any pending GUI commands - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } @@ -1612,7 +1612,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) if (TheInGameUI->getSelectCount() == 0) { // we just deselected everything - cancel any pending GUI commands - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } // @@ -1620,7 +1620,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) // we have some and are in the middle of a build process, it must obiously be over now // because we are no longer selecting the dozer or worker // - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } @@ -1633,24 +1633,24 @@ const Image *ControlBar::getStarImage(void ) else m_lastFlashedAtPointValue = ThePlayerList->getLocalPlayer()->getSciencePurchasePoints(); - GameWindow *win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); + GameWindow *win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); if(!win) - return NULL; + return nullptr; if(!m_genStarFlash) { GadgetButtonSetEnabledImage(win, m_generalButtonEnable); - return NULL; + return nullptr; } if(TheGameLogic->getFrame()% LOGICFRAMES_PER_SECOND > LOGICFRAMES_PER_SECOND/2) { GadgetButtonSetEnabledImage(win, m_generalButtonHighlight); - return NULL; + return nullptr; } GadgetButtonSetEnabledImage(win, m_generalButtonEnable); - return NULL; + return nullptr; } @@ -1708,7 +1708,7 @@ void ControlBar::evaluateContextUI( void ) showPurchaseScience(); // erase any current state of the GUI by switching out to the empty context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); // sanity, nothing selected if( TheInGameUI->getSelectCount() == 0 ) @@ -1792,7 +1792,7 @@ void ControlBar::evaluateContextUI( void ) // - Drawable *drawToEvaluateFor = NULL; + Drawable *drawToEvaluateFor = nullptr; Bool multiSelect = FALSE; @@ -1804,7 +1804,7 @@ void ControlBar::evaluateContextUI( void ) // but is represented in the UI as a single unit, // so we must isolate and evaluate only the Nexus drawToEvaluateFor = TheGameClient->findDrawableByID( TheInGameUI->getSoloNexusSelectedDrawableID() ) ; - multiSelect = ( drawToEvaluateFor == NULL ); + multiSelect = ( drawToEvaluateFor == nullptr ); } else // get the first and only drawble in the selection list @@ -1814,7 +1814,7 @@ void ControlBar::evaluateContextUI( void ) if( multiSelect ) { - switchToContext( CB_CONTEXT_MULTI_SELECT, NULL ); + switchToContext( CB_CONTEXT_MULTI_SELECT, nullptr ); } else if ( drawToEvaluateFor )// either we have exactly one drawable, or we have isolated one to evaluate for... { @@ -1823,12 +1823,12 @@ void ControlBar::evaluateContextUI( void ) //Drawable *draw = selectedDrawables->front(); // sanity - //if( draw == NULL ) + //if( draw == nullptr ) // return; // get object Object *obj = drawToEvaluateFor->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return; // we show no interface for objects being sold @@ -1905,7 +1905,7 @@ CommandButton *ControlBar::findNonConstCommandButton( const AsciiString& name ) if( command->getName() == name ) return const_cast((const CommandButton*)command->getFinalOverride()); - return NULL; // not found + return nullptr; // not found } @@ -1935,7 +1935,7 @@ CommandButton *ControlBar::newCommandButton( const AsciiString& name ) CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOverride ) { if (!buttonToOverride) { - return NULL; + return nullptr; } CommandButton *newOverride; @@ -1965,7 +1965,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver // find existing item if present commandSet = TheControlBar->findNonConstCommandSet( name ); - if( commandSet == NULL ) + if( commandSet == nullptr ) { // allocate a new item @@ -2005,11 +2005,11 @@ CommandSet* ControlBar::findNonConstCommandSet( const AsciiString& name ) { CommandSet* set; - for( set = m_commandSets; set != NULL; set = set->friend_getNext() ) + for( set = m_commandSets; set != nullptr; set = set->friend_getNext() ) if( set->getName() == name ) return const_cast((const CommandSet *) set); - return NULL; // set not found + return nullptr; // set not found } //------------------------------------------------------------------------------------------------- @@ -2056,7 +2056,7 @@ CommandSet *ControlBar::newCommandSet( const AsciiString& name ) CommandSet *ControlBar::newCommandSetOverride( CommandSet *setToOverride ) { if (!setToOverride) { - return NULL; + return nullptr; } // allocate a new set @@ -2107,9 +2107,9 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) { // restore the right hud to a plain window - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; setPortraitByObject( obj ); // if we're switching context, we have to repopulate the hotkey manager @@ -2123,7 +2123,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) m_currentSelectedDrawable = draw; if (IsInGameChatActive() == FALSE && TheGameLogic && !TheGameLogic->isInShellGame()) { - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } // hide/un-hide the appropriate windows for the context @@ -2175,7 +2175,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) } // do not show any rally point marker - showRallyPoint( NULL ); + showRallyPoint( nullptr ); break; @@ -2206,12 +2206,12 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) { ProductionUpdateInterface *pu = obj->getProductionUpdateInterface(); - if( pu && pu->firstProduction() != NULL ) + if( pu && pu->firstProduction() != nullptr ) { m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); } else { @@ -2421,10 +2421,10 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com } // sanity - if( commandButton == NULL ) + if( commandButton == nullptr ) { - DEBUG_ASSERTCRASH( 0, ("setControlCommand: NULL commandButton passed in") ); + DEBUG_ASSERTCRASH( 0, ("setControlCommand: null commandButton passed in") ); return; } @@ -2514,7 +2514,7 @@ void ControlBar::postProcessCommands( void ) //------------------------------------------------------------------------------------------------- /** set the command for the button identified by the window name - * NOTE that parent may be NULL, it only helps to speed up the search for a particular + * NOTE that parent may be nullptr, it only helps to speed up the search for a particular * window ID */ //------------------------------------------------------------------------------------------------- void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWindow *parent, @@ -2523,7 +2523,7 @@ void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWin UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName ); GameWindow *win = TheWindowManager->winGetWindowFromId( parent, winID ); - if( win == NULL ) + if( win == nullptr ) { DEBUG_ASSERTCRASH( 0, ("setControlCommand: Unable to find window '%s'", buttonWindowName.str()) ); @@ -2580,7 +2580,7 @@ void ControlBar::setPortraitByObject( Object *obj ) if( obj->isKindOf( KINDOF_SHOW_PORTRAIT_WHEN_CONTROLLED ) && !obj->isLocallyControlled() ) { //Handles civ vehicles without terrorists in them - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); return; } @@ -2595,7 +2595,7 @@ void ControlBar::setPortraitByObject( Object *obj ) if( thing->isKindOf( KINDOF_SHOW_PORTRAIT_WHEN_CONTROLLED ) ) { //If a bomb truck disguises as a civ vehicle, don't use it's portrait (or else you'll see the terrorist). - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); return; } StealthUpdate* stealth = obj->getStealth(); @@ -2665,7 +2665,7 @@ void ControlBar::setPortraitByObject( Object *obj ) m_rightHUDUpgradeCameos[i]->winHide(TRUE); //Clear any overlay the portrait had on it. - GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, NULL ); + GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, nullptr ); } } @@ -2676,8 +2676,8 @@ void ControlBar::setPortraitByObject( Object *obj ) // ------------------------------------------------------------------------------------------------ void ControlBar::showRallyPoint(const Coord3D* loc) { - // if loc is NULL, destroy any rally point drawble we have shown - if (loc == NULL) + // if loc is null, destroy any rally point drawble we have shown + if (loc == nullptr) { // destroy rally point drawable if present if (m_rallyPointDrawableID != INVALID_DRAWABLE_ID) @@ -2687,7 +2687,7 @@ void ControlBar::showRallyPoint(const Coord3D* loc) return; } - Drawable* marker = NULL; + Drawable* marker = nullptr; // create a rally point drawble if necessary if (m_rallyPointDrawableID == INVALID_DRAWABLE_ID) @@ -2734,14 +2734,14 @@ void ControlBar::setControlBarSchemeByPlayer(Player *p) static NameKeyType buttonPlaceBeaconID = NAMEKEY( "ControlBar.wnd:ButtonPlaceBeacon" ); static NameKeyType buttonIdleWorkerID = NAMEKEY("ControlBar.wnd:ButtonIdleWorker"); static NameKeyType buttonGeneralID = NAMEKEY("ControlBar.wnd:ButtonGeneral"); - GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( NULL, buttonPlaceBeaconID ); - GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( NULL, buttonIdleWorkerID ); - GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID ); + GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( nullptr, buttonPlaceBeaconID ); + GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( nullptr, buttonIdleWorkerID ); + GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralID ); if( !p->isPlayerActive() ) { m_isObserverCommandBar = TRUE; - switchToContext( CB_CONTEXT_OBSERVER_LIST, NULL ); + switchToContext( CB_CONTEXT_OBSERVER_LIST, nullptr ); DEBUG_LOG(("We're loading the Observer Command Bar")); if (buttonPlaceBeacon) @@ -2753,7 +2753,7 @@ void ControlBar::setControlBarSchemeByPlayer(Player *p) } else { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_isObserverCommandBar = FALSE; if (buttonPlaceBeacon) @@ -2779,14 +2779,14 @@ void ControlBar::setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt) static NameKeyType buttonPlaceBeaconID = NAMEKEY( "ControlBar.wnd:ButtonPlaceBeacon" ); static NameKeyType buttonIdleWorkerID = NAMEKEY("ControlBar.wnd:ButtonIdleWorker"); static NameKeyType buttonGeneralID = NAMEKEY("ControlBar.wnd:ButtonGeneral"); - GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( NULL, buttonPlaceBeaconID ); - GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( NULL, buttonIdleWorkerID ); - GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID ); + GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( nullptr, buttonPlaceBeaconID ); + GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( nullptr, buttonIdleWorkerID ); + GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralID ); if(pt == ThePlayerTemplateStore->findPlayerTemplate(TheNameKeyGenerator->nameToKey("FactionObserver"))) { m_isObserverCommandBar = TRUE; - switchToContext( CB_CONTEXT_OBSERVER_LIST, NULL ); + switchToContext( CB_CONTEXT_OBSERVER_LIST, nullptr ); DEBUG_LOG(("We're loading the Observer Command Bar")); if (buttonPlaceBeacon) @@ -2798,7 +2798,7 @@ void ControlBar::setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt) } else { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_isObserverCommandBar = FALSE; if (buttonPlaceBeacon) @@ -2900,7 +2900,7 @@ void ControlBar::updateCommanBarBorderColors(Color build, Color action, Color up void ControlBar::hideCommunicator( Bool b ) { //sanity - if( m_communicatorButton != NULL ) + if( m_communicatorButton != nullptr ) m_communicatorButton->winHide( b ); } @@ -2927,7 +2927,7 @@ void ControlBar::showPurchaseScience( void ) m_genStarFlash = FALSE; if(!m_contextParent[ CP_PURCHASE_SCIENCE ]->winIsHidden()) return; - //switchToContext(CB_CONTEXT_PURCHASE_SCIENCE, NULL); + //switchToContext(CB_CONTEXT_PURCHASE_SCIENCE, nullptr); m_contextParent[ CP_PURCHASE_SCIENCE ]->winHide(FALSE); if (TheGlobalData->m_animateWindows) TheTransitionHandler->setGroup("GenExpFade"); @@ -3110,7 +3110,7 @@ void ControlBar::updateUpDownImages( const Image *toggleButtonUpIn, const Image void ControlBar::setUpDownImages( void ) { - GameWindow *win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); + GameWindow *win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); if(!win) return; // we only care if it's in it's low state, else we put the default images up @@ -3183,17 +3183,17 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) Int i = 0; for( ; i < MAX_SPECIAL_POWER_SHORTCUTS; ++i ) { - m_specialPowerShortcutButtonParents[i] = NULL; - m_specialPowerShortcutButtons[i] = NULL; + m_specialPowerShortcutButtonParents[i] = nullptr; + m_specialPowerShortcutButtons[i] = nullptr; } if(m_specialPowerLayout) { m_specialPowerLayout->destroyWindows(); deleteInstance(m_specialPowerLayout); - m_specialPowerLayout = NULL; + m_specialPowerLayout = nullptr; } - m_specialPowerShortcutParent = NULL; + m_specialPowerShortcutParent = nullptr; m_currentlyUsedSpecialPowersButtons = 0; const PlayerTemplate *pt = player->getPlayerTemplate(); @@ -3211,7 +3211,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) tempName = layoutName; tempName.concat(":GenPowersShortcutBarParent"); NameKeyType id = TheNameKeyGenerator->nameToKey( tempName ); - m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); + m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( nullptr, id );//m_scienceLayout->getFirstWindow(); tempName = layoutName; tempName.concat(":ButtonCommand%d"); @@ -3244,7 +3244,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) Int i; if(!player || !player->getPlayerTemplate() || !player->isLocalPlayer() || m_currentlyUsedSpecialPowersButtons == 0 - || m_specialPowerShortcutButtons == NULL || m_specialPowerShortcutButtonParents == NULL) + || m_specialPowerShortcutButtons == nullptr || m_specialPowerShortcutButtonParents == nullptr) return; for( i = 0; i < m_currentlyUsedSpecialPowersButtons; ++i ) { @@ -3271,7 +3271,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) commandButton = commandSet->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { continue; // hide window on interface @@ -3411,7 +3411,7 @@ void ControlBar::updateSpecialPowerShortcut( void ) // get the command from the control command = (const CommandButton *)GadgetButtonGetData(win); //command = (const CommandButton *)win->winGetUserData(); - if( command == NULL ) + if( command == nullptr ) continue; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp index cc67872121a..2a28418d189 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -51,9 +51,9 @@ void ControlBar::populateBeacon( Object *beacon ) static NameKeyType staticTextID = NAMEKEY("ControlBar.wnd:StaticTextBeaconLabel"); static NameKeyType clearButtonID = NAMEKEY("ControlBar.wnd:ButtonClearBeaconText"); - GameWindow *textEntryWin = TheWindowManager->winGetWindowFromId(NULL, textID); - GameWindow *staticTextWin = TheWindowManager->winGetWindowFromId(NULL, staticTextID); - GameWindow *buttonWin = TheWindowManager->winGetWindowFromId(NULL, clearButtonID); + GameWindow *textEntryWin = TheWindowManager->winGetWindowFromId(nullptr, textID); + GameWindow *staticTextWin = TheWindowManager->winGetWindowFromId(nullptr, staticTextID); + GameWindow *buttonWin = TheWindowManager->winGetWindowFromId(nullptr, clearButtonID); if (beacon->isLocallyControlled()) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index a02c6e7dd10..b64194a48cc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -144,14 +144,14 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co //static const CommandButton *exitCommand = findCommandButton( "Command_TransportExit" ); // sanity - if( transport == NULL || commandSet == NULL ) + if( transport == nullptr || commandSet == nullptr ) return; // get the transport contain module ContainModuleInterface *contain = transport->getContain(); // sanity - if( contain == NULL ) + if( contain == nullptr ) return; // how many slots do we have inside the transport @@ -201,7 +201,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co m_commandWindows[ i ]->winEnable( FALSE ); //Clear any potential veterancy rank, or else we'll see it when it's empty! - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); //Unmanned vehicles don't have any commands available -- in fact they are hidden! if( transport->isDisabledByType( DISABLED_UNMANNED ) ) @@ -273,7 +273,7 @@ void ControlBar::populateCommand( Object *obj ) commandSet = findCommandSet( obj->getCommandSetString() ); // if no command set match is found hide all the buttons - if( commandSet == NULL ) + if( commandSet == nullptr ) { // hide all the buttons @@ -303,7 +303,7 @@ void ControlBar::populateCommand( Object *obj ) commandButton = commandSet->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { // hide window on interface @@ -445,7 +445,7 @@ void ControlBar::resetContainData( void ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_containData[ i ].control = NULL; + m_containData[ i ].control = nullptr; m_containData[ i ].objectID = INVALID_ID; } @@ -462,10 +462,10 @@ void ControlBar::resetBuildQueueData( void ) for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) { - m_queueData[ i ].control = NULL; + m_queueData[ i ].control = nullptr; m_queueData[ i ].type = PRODUCTION_INVALID; m_queueData[ i ].productionID = PRODUCTIONID_INVALID; - m_queueData[ i ].upgradeToResearch = NULL; + m_queueData[ i ].upgradeToResearch = nullptr; } @@ -522,13 +522,13 @@ void ControlBar::populateBuildQueue( Object *producer ) GadgetButtonSetText( m_queueData[ i ].control, L"" ); //Clear any potential veterancy rank, or else we'll see it when it's empty! - GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL ); + GadgetButtonDrawOverlayImage( m_queueData[ i ].control, nullptr ); } // step through each object being built and set the image data for the buttons ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) return; // sanity const ProductionEntry *production; Int windowIndex = 0; @@ -622,7 +622,7 @@ void ControlBar::populateBuildQueue( Object *producer ) //------------------------------------------------------------------------------------------------- void ControlBar::updateContextCommand( void ) { - Object *obj = NULL; + Object *obj = nullptr; Int i; // get object @@ -633,7 +633,7 @@ void ControlBar::updateContextCommand( void ) // the contents of objects are ususally showed on the UI, when those contents change // we always to update the UI // - ContainModuleInterface *contain = obj ? obj->getContain() : NULL; + ContainModuleInterface *contain = obj ? obj->getContain() : nullptr; if( contain && contain->getContainMax() > 0 && m_lastRecordedInventoryCount != contain->getContainCount() ) { @@ -647,7 +647,7 @@ void ControlBar::updateContextCommand( void ) } // get production update for those objects that have one - ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : NULL; + ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : nullptr; // // when we have a production update, we show the build queue when there is actually @@ -658,11 +658,11 @@ void ControlBar::updateContextCommand( void ) if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == TRUE ) { - if( pu && pu->firstProduction() != NULL ) + if( pu && pu->firstProduction() != nullptr ) { // don't show the portrait image - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); // show the build queue m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); @@ -674,7 +674,7 @@ void ControlBar::updateContextCommand( void ) else { - if( pu && pu->firstProduction() == NULL ) + if( pu && pu->firstProduction() == nullptr ) { // hide the build queue @@ -692,7 +692,7 @@ void ControlBar::updateContextCommand( void ) { // when the build queue is enabled, the selected portrait cannot be shown - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); // // when showing a production queue, when the production count changes of the producer @@ -751,7 +751,7 @@ void ControlBar::updateContextCommand( void ) // get the command from the control command = (const CommandButton *)GadgetButtonGetData(win); //command = (const CommandButton *)win->winGetUserData(); - if( command == NULL ) + if( command == nullptr ) continue; // ignore transport/structure inventory commands, they are handled elsewhere @@ -833,18 +833,18 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate if( !thingTemplate ) { - return NULL; + return nullptr; } Player *player = ThePlayerList->getLocalPlayer(); if( !player ) { - return NULL; + return nullptr; } //See if the thingTemplate has a VeterancyGainCreate //This is HORROR CODE and needs to be optimized! - const VeterancyGainCreateModuleData *data = NULL; + const VeterancyGainCreateModuleData *data = nullptr; AsciiString modName; const ModuleInfo& mi = thingTemplate->getBehaviorModuleInfo(); for( Int modIdx = 0; modIdx < mi.getCount(); ++modIdx ) @@ -864,7 +864,7 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate level = data->m_startingLevel; } - //Return the appropriate image (including NULL if no veterancy levels) + //Return the appropriate image (including nullptr if no veterancy levels) switch( level ) { case LEVEL_VETERAN: @@ -874,7 +874,7 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate case LEVEL_HEROIC: return m_rankHeroicIcon; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -882,11 +882,11 @@ const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj ) { if( !obj ) { - return NULL; + return nullptr; } VeterancyLevel level = obj->getVeterancyLevel(); - //Return the appropriate image (including NULL if no veterancy levels) + //Return the appropriate image (including nullptr if no veterancy levels) switch( level ) { case LEVEL_VETERAN: @@ -896,14 +896,14 @@ const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj ) case LEVEL_HEROIC: return m_rankHeroicIcon; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- static Int getRappellerCount(Object* obj) { Int num = 0; - const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -931,10 +931,10 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com if (ThePlayerList && ThePlayerList->getLocalPlayer()) obj = ThePlayerList->getLocalPlayer()->findNaturalCommandCenter(); else - obj = NULL; + obj = nullptr; } - if (obj == NULL) + if (obj == nullptr) return COMMAND_HIDDEN; // probably better than crashing.... Player *player = obj->getControllingPlayer(); @@ -1036,14 +1036,14 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_RESTRICTED; // get the dozer ai update interface - DozerAIInterface* dozerAI = NULL; - if( obj->getAIUpdateInterface() == NULL ) + DozerAIInterface* dozerAI = nullptr; + if( obj->getAIUpdateInterface() == nullptr ) return COMMAND_RESTRICTED; dozerAI = obj->getAIUpdateInterface()->getDozerAIInterface(); - DEBUG_ASSERTCRASH( dozerAI != NULL, ("Something KINDOF_DOZER must have a Dozer-like AIUpdate") ); - if( dozerAI == NULL ) + DEBUG_ASSERTCRASH( dozerAI != nullptr, ("Something KINDOF_DOZER must have a Dozer-like AIUpdate") ); + if( dozerAI == nullptr ) return COMMAND_RESTRICTED; // if building anything at all right now we can't build another @@ -1130,7 +1130,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_RESTRICTED; } // no production update, can't possibly do this command - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_CRASH(("Objects that have Object-Level Upgrades must also have ProductionUpdate. Just cuz.")); return COMMAND_RESTRICTED; @@ -1155,7 +1155,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com AIUpdateInterface *ai = obj->getAIUpdateInterface(); // no ai, can't possibly fire weapon - if( ai == NULL ) + if( ai == nullptr ) return COMMAND_RESTRICTED; // ask the ai if the weapon is ready to fire @@ -1174,7 +1174,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_AVAILABLE; } - if( w == NULL // No weapon + if( w == nullptr // No weapon || w->getStatus() != READY_TO_FIRE // Weapon not ready || w->getPossibleNextShotFrame() == now // Weapon ready, but could fire this exact frame (handle button flicker since it may be going to fire anyway) /// @todo srj -- not sure why this next check is necessary, but the Comanche missile buttons will flicker without it. figure out someday. @@ -1185,7 +1185,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com || (w->getPossibleNextShotFrame()==now-1) ) { - if ( w != NULL ) + if ( w != nullptr ) { // only draw the clock when reloading a clip, not when merely between shots, since that's usually a tiny amount of time if ( w->getStatus() == RELOADING_CLIP) @@ -1254,7 +1254,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com DockUpdateInterface *dui = obj->getDockUpdateInterface(); // if the dock is closed or not present this command is invalid - if( dui == NULL || dui->isDockOpen() == FALSE ) + if( dui == nullptr || dui->isDockOpen() == FALSE ) return COMMAND_RESTRICTED; break; } @@ -1263,12 +1263,12 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com case GUI_COMMAND_SPECIAL_POWER: { // sanity - DEBUG_ASSERTCRASH( command->getSpecialPowerTemplate() != NULL, - ("The special power in the command '%s' is NULL", command->getName().str()) ); + DEBUG_ASSERTCRASH( command->getSpecialPowerTemplate() != nullptr, + ("The special power in the command '%s' is null", command->getName().str()) ); // get special power module from the object to execute it SpecialPowerModuleInterface *mod = obj->getSpecialPowerModule( command->getSpecialPowerTemplate() ); - if( mod == NULL ) + if( mod == nullptr ) { // sanity ... we must have a module for the special power, if we don't somebody probably // forgot to put it in the object @@ -1328,7 +1328,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com DEBUG_ASSERTCRASH( w, ("Unit %s's CommandButton %s is trying to access weaponslot %d, but doesn't have a weapon there in its FactionUnit ini entry.", obj->getTemplate()->getName().str(), command->getName().str(), (Int)command->getWeaponSlot() ) ); - if( w == NULL) + if( w == nullptr) return COMMAND_RESTRICTED; const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 44f7f28fa00..ec07e9c51da 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -65,14 +65,14 @@ CBCommandStatus ControlBar::processCommandTransitionUI( GameWindow *control, Gad { // sanity, we won't process messages if we have no source object if( m_currContext != CB_CONTEXT_MULTI_SELECT && - (m_currentSelectedDrawable == NULL || - m_currentSelectedDrawable->getObject() == NULL) ) + (m_currentSelectedDrawable == nullptr || + m_currentSelectedDrawable->getObject() == nullptr) ) { if( m_currContext != CB_CONTEXT_NONE && m_currContext != CB_CONTEXT_OBSERVER_INFO && m_currContext != CB_CONTEXT_OBSERVER_LIST) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return CBC_COMMAND_NOT_USED; } @@ -101,18 +101,18 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, if( m_currContext != CB_CONTEXT_MULTI_SELECT && commandButton->getCommandType() != GUI_COMMAND_PURCHASE_SCIENCE && commandButton->getCommandType() != GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER && - (m_currentSelectedDrawable == NULL || - m_currentSelectedDrawable->getObject() == NULL) ) + (m_currentSelectedDrawable == nullptr || + m_currentSelectedDrawable->getObject() == nullptr) ) { if( m_currContext != CB_CONTEXT_NONE ) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return CBC_COMMAND_NOT_USED; } // sanity - if( control == NULL ) + if( control == nullptr ) return CBC_COMMAND_NOT_USED; // the context sensitive gui only is only made of buttons ... sanity @@ -120,7 +120,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, return CBC_COMMAND_NOT_USED; - if( commandButton == NULL ) + if( commandButton == nullptr ) return CBC_COMMAND_NOT_USED; // if the button is flashing, tell it to stop flashing @@ -136,7 +136,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object that is driving the context sensitive UI if we're not in a multi // select context // - Object *obj = NULL; + Object *obj = nullptr; if( m_currContext != CB_CONTEXT_MULTI_SELECT && commandButton->getCommandType() != GUI_COMMAND_PURCHASE_SCIENCE && commandButton->getCommandType() != GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER) @@ -158,7 +158,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, obj->markSingleUseCommandUsed(); //Yeah, an object can only use one single use command... } - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); //Play any available unit specific sound for button Player *player = ThePlayerList->getLocalPlayer(); @@ -196,7 +196,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, { // sanity - if( m_currentSelectedDrawable == NULL ) + if( m_currentSelectedDrawable == nullptr ) break; //Kris: September 27, 2002 @@ -239,7 +239,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object we have selected Object *building = obj; - if( building == NULL ) + if( building == nullptr ) break; // sanity check, the building must be under our control to cancel construction @@ -260,7 +260,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the "factory" object that is going to make the thing Object *factory = obj; - if( factory == NULL ) + if( factory == nullptr ) break; // sanity, we must have something to build @@ -302,7 +302,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, ProductionUpdateInterface *pu = factory->getProductionUpdateInterface(); // sanity, we can't build things if we can't produce units - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producting units", @@ -353,7 +353,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object that is the producer Object *producer = obj; - if( producer == NULL ) + if( producer == nullptr ) break; // sanity, we must control the producer ... if this isn't true they might be hacking the game @@ -375,7 +375,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in player upgrade command", "UNKNOWN") ); // sanity - if( obj == NULL || upgradeT == NULL ) + if( obj == nullptr || upgradeT == nullptr ) break; // make sure the player can really make this @@ -384,8 +384,8 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; } - ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : NULL; - if (pu != NULL) + ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : nullptr; + if (pu != nullptr) { CanMakeType cmt = pu->canQueueUpgrade(upgradeT); if (cmt == CANMAKE_QUEUE_FULL) @@ -410,7 +410,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, const UpgradeTemplate *upgradeT = commandButton->getUpgradeTemplate(); DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in object upgrade command", "UNKNOWN") ); // sanity - if( upgradeT == NULL ) + if( upgradeT == nullptr ) break; //Make sure the player can really make this @@ -421,8 +421,8 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; } - ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : NULL; - if (pu != NULL) + ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : nullptr; + if (pu != nullptr) { CanMakeType cmt = pu->canQueueUpgrade(upgradeT); if (cmt == CANMAKE_QUEUE_FULL) @@ -479,7 +479,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, Object *producer = obj; // sanity - if( upgradeT == NULL || producer == NULL ) + if( upgradeT == nullptr || producer == nullptr ) break; // send the message @@ -534,7 +534,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, Object *objWantingExit = TheGameLogic->findObjectByID( objID ); // if the control container returns an object ID but the object is not found, remove the control entry and exit - if( objWantingExit == NULL ) + if( objWantingExit == nullptr ) { // @@ -542,7 +542,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // cycle of the UI will repopulate any buttons as the contents of objects // change so this is only an edge case that will be visually corrected next frame // - m_containData[ i ].control = NULL; + m_containData[ i ].control = nullptr; m_containData[ i ].objectID = INVALID_ID; break; // exit case @@ -560,7 +560,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, case GUI_COMMAND_EVACUATE: { // Cancel GUI command mode. - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); if (BitIsSet(commandButton->getOptions(), NEED_TARGET_POS) == FALSE) { pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_EVACUATE ); @@ -672,7 +672,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, case GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER: { Object* cmdCenter = ThePlayerList->getLocalPlayer()->findNaturalCommandCenter(); - if (cmdCenter == NULL) + if (cmdCenter == nullptr) break; // command needs no additional data, send the message @@ -714,7 +714,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, if( st == SCIENCE_INVALID) { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index b21ed009e55..0da5399cd58 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -52,9 +52,9 @@ void ControlBar::resetCommonCommandData( void ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; //Clear out any remnant overlays. - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); } } @@ -68,7 +68,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) const CommandButton *command; // sanity - if( draw == NULL ) + if( draw == nullptr ) return; Object* obj = draw->getObject(); @@ -80,7 +80,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // get the command set of this drawable const CommandSet *commandSet = findCommandSet( obj->getCommandSetString() ); - if( commandSet == NULL ) + if( commandSet == nullptr ) { // @@ -90,7 +90,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; if (m_commandWindows[ i ]) { m_commandWindows[ i ]->winHide( TRUE ); @@ -180,7 +180,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // // remove the common command - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; // // hide the window control cause it should have been made visible from a command @@ -208,8 +208,8 @@ void ControlBar::populateMultiSelect( void ) Drawable *draw; Bool firstDrawable = TRUE; Bool portraitSet = FALSE; - const Image *portrait = NULL; - Object *portraitObj = NULL; + const Image *portrait = nullptr; + Object *portraitObj = nullptr; // first reset the common command data resetCommonCommandData(); @@ -278,7 +278,7 @@ void ControlBar::populateMultiSelect( void ) } else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) - portrait = NULL; + portrait = nullptr; } @@ -331,7 +331,7 @@ void ControlBar::updateContextMultiSelect( void ) obj = draw->getObject(); // sanity - if( obj == NULL ) + if( obj == nullptr ) continue; // for each of the visible command windows make sure the object can execute the command @@ -350,7 +350,7 @@ void ControlBar::updateContextMultiSelect( void ) // get the command command = (const CommandButton *)GadgetButtonGetData(win); - if( command == NULL ) + if( command == nullptr ) continue; // can we do the command @@ -408,7 +408,7 @@ void ControlBar::updateContextMultiSelect( void ) continue; // don't consider slots that don't have commands - if( m_commonCommands[ i ] == NULL ) + if( m_commonCommands[ i ] == nullptr ) continue; // check the count of objects that can do the command and enable/disable the control, diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index 4d7b2201191..406550caaa4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -48,10 +48,10 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce { UnicodeString text; static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerStaticText" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( NULL, descID ); + GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); static UnsignedInt barID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerProgressBar" ); - GameWindow *barWindow = TheWindowManager->winGetWindowFromId( NULL, barID ); + GameWindow *barWindow = TheWindowManager->winGetWindowFromId( nullptr, barID ); // santiy DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); @@ -80,7 +80,7 @@ void ControlBar::populateOCLTimer( Object *creatorObject ) { // sanity - if( creatorObject == NULL ) + if( creatorObject == nullptr ) return; // get our parent window diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index d15d40b7d2c..09a7a57ab28 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -77,26 +77,24 @@ static NameKeyType staticTextPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_I NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *ObserverPlayerInfoWindow = NULL; -static GameWindow *ObserverPlayerListWindow = NULL; +static GameWindow *ObserverPlayerInfoWindow = nullptr; +static GameWindow *ObserverPlayerListWindow = nullptr; -static GameWindow *buttonPlayer[MAX_BUTTONS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *staticTextPlayer[MAX_BUTTONS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonPlayer[MAX_BUTTONS] = {0}; +static GameWindow *staticTextPlayer[MAX_BUTTONS] = {0}; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *winFlag = NULL; -static GameWindow *winGeneralPortrait = NULL; +static GameWindow *winFlag = nullptr; +static GameWindow *winGeneralPortrait = nullptr; // TheSuperHackers @tweak Allow idle worker selection for observers. -static GameWindow *buttonIdleWorker = NULL; -static GameWindow *staticTextNumberOfUnits = NULL; -static GameWindow *staticTextNumberOfBuildings = NULL; -static GameWindow *staticTextNumberOfUnitsKilled = NULL; -static GameWindow *staticTextNumberOfUnitsLost = NULL; -static GameWindow *staticTextPlayerName = NULL; +static GameWindow *buttonIdleWorker = nullptr; +static GameWindow *staticTextNumberOfUnits = nullptr; +static GameWindow *staticTextNumberOfBuildings = nullptr; +static GameWindow *staticTextNumberOfUnitsKilled = nullptr; +static GameWindow *staticTextNumberOfUnitsLost = nullptr; +static GameWindow *staticTextPlayerName = nullptr; static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; @@ -107,8 +105,8 @@ static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; void ControlBar::initObserverControls( void ) { - ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); - ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); + ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); + ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); for (Int i = 0; i < MAX_BUTTONS; i++) { @@ -121,14 +119,14 @@ void ControlBar::initObserverControls( void ) staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); } - staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); - staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); - staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); - staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); - staticTextPlayerName = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); - winFlag = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); - winGeneralPortrait = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); - buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); + staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); + staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); + staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); + staticTextPlayerName = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); + winFlag = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); + winGeneralPortrait = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); + buttonIdleWorker = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); @@ -138,10 +136,10 @@ void ControlBar::initObserverControls( void ) //------------------------------------------------------------------------------------------------- void ControlBar::setObserverLookAtPlayer(Player *player) { - if (player != NULL && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) { // Looking at the observer. Treat as not looking at player. - m_observerLookAtPlayer = NULL; + m_observerLookAtPlayer = nullptr; } else { @@ -152,10 +150,10 @@ void ControlBar::setObserverLookAtPlayer(Player *player) //------------------------------------------------------------------------------------------------- void ControlBar::setObservedPlayer(Player *player) { - if (player != NULL && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) { // Looking at the observer. Treat as not observing player. - m_observedPlayer = NULL; + m_observedPlayer = nullptr; } else { @@ -196,7 +194,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m Int controlID = control->winGetWindowId(); if( controlID == buttonCancelID) { - rts::changeObservedPlayer(NULL); + rts::changeObservedPlayer(nullptr); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp index adbe1332f01..2735ea28fd6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp @@ -79,7 +79,7 @@ void PrintInfoRecursive( GameWindow *win, FILE *fp) void PrintOffsetsFromControlBarParent( void ) { - GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); + GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); if(!controlBarParent) return; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index fc8b35ad5f2..bc1a4b564c2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -61,9 +61,9 @@ const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = { - { "AltPosition", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altPos ) }, - { "AltSize", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altSize ) }, - { NULL, NULL, NULL, 0 } + { "AltPosition", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altPos ) }, + { "AltSize", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altSize ) }, + { nullptr, nullptr, nullptr, 0 } }; //----------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void ControlBarResizer::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, nullptr ); } @@ -128,23 +128,23 @@ ResizerWindow *ControlBarResizer::findResizerWindow( AsciiString name ) } it ++; } - return NULL; + return nullptr; } ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) { ResizerWindow *newRwin = NEW ResizerWindow; if(!newRwin) - return NULL; + return nullptr; newRwin->m_name = name; - GameWindow *win = NULL; - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name)); + GameWindow *win = nullptr; + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(name)); if( !win ) { DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); delete newRwin; - return NULL; + return nullptr; } win->winGetPosition(&newRwin->m_defaultPos.x,&newRwin->m_defaultPos.y); win->winGetSize(&newRwin->m_defaultSize.x,&newRwin->m_defaultSize.y); @@ -154,7 +154,7 @@ ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) void ControlBarResizer::sizeWindowsDefault( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = NULL; + GameWindow *win = nullptr; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; @@ -164,7 +164,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); if(!win) { it++; @@ -179,7 +179,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = NULL; + GameWindow *win = nullptr; Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) @@ -191,7 +191,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); if(!win) { it++; @@ -210,7 +210,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) void INI::parseControlBarResizerDefinition( INI* ini ) { // AsciiString name; -// ResizerWindow *rWin = NULL; +// ResizerWindow *rWin = nullptr; // // // read the name // const char* c = ini->getNextToken(); @@ -223,7 +223,7 @@ void INI::parseControlBarResizerDefinition( INI* ini ) // return; // } // rWin = resizer->findResizerWindow( name ); -// if( rWin == NULL ) +// if( rWin == nullptr ) // { // // // image not found, create a new one diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 949284420c6..634357b8624 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -73,89 +73,89 @@ enum{ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = { - { "ImagePart", ControlBarSchemeManager::parseImagePart, NULL, NULL }, - { "AnimatingPart", ControlBarSchemeManager::parseAnimatingPart, NULL, NULL }, - { "ScreenCreationRes", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_ScreenCreationRes ) }, - { "Side", INI::parseAsciiString, NULL, offsetof( ControlBarScheme, m_side ) }, - { "QueueButtonImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buttonQueueImage ) }, - { "RightHUDImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_rightHUDImage ) }, - { "BuildUpClockColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_buildUpClockColor ) }, - { "ButtonBorderBuildColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderBuildColor ) }, - { "CommandBarBorderColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_commandBarBorderColor ) }, - { "ButtonBorderActionColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderActionColor ) }, - { "ButtonBorderUpgradeColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderUpgradeColor ) }, - { "ButtonBorderSystemColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderSystemColor ) }, - { "OptionsButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonEnable ) }, - { "OptionsButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonHightlited ) }, - { "OptionsButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonPushed ) }, - { "OptionsButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonDisabled ) }, - { "IdleWorkerButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonEnable ) }, - { "IdleWorkerButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonHightlited ) }, - { "IdleWorkerButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonPushed ) }, - { "IdleWorkerButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonDisabled ) }, - { "BuddyButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonEnable ) }, - { "BuddyButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonHightlited ) }, - { "BuddyButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonPushed ) }, - { "BuddyButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonDisabled) }, - { "BeaconButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonEnable ) }, - { "BeaconButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonHightlited ) }, - { "BeaconButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonPushed ) }, - { "BeaconButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonDisabled ) }, - { "GenBarButtonIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genBarButtonIn ) }, - { "GenBarButtonOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genBarButtonOn ) }, - { "ToggleButtonUpIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpIn ) }, - { "ToggleButtonUpOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpOn ) }, - { "ToggleButtonUpPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpPushed ) }, - { "ToggleButtonDownIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownIn ) }, - { "ToggleButtonDownOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownOn ) }, - { "ToggleButtonDownPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownPushed ) }, - - { "GeneralButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonEnable ) }, - { "GeneralButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonHightlited ) }, - { "GeneralButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonPushed ) }, - { "GeneralButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonDisabled ) }, - - { "UAttackButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonEnable ) }, - { "UAttackButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonHightlited ) }, - { "UAttackButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonPushed ) }, - - { "GenArrow", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genArrow) }, - - { "MinMaxButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonEnable ) }, - { "MinMaxButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonHightlited ) }, - { "MinMaxButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonPushed ) }, - - { "MinMaxUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_minMaxUL ) }, - { "MinMaxLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_minMaxLR ) }, - - { "GeneralUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_generalUL ) }, - { "GeneralLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_generalLR ) }, - - { "UAttackUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_uAttackUL ) }, - { "UAttackLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_uAttackLR ) }, - - { "OptionsUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_optionsUL ) }, - { "OptionsLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_optionsLR ) }, - - { "WorkerUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_workerUL ) }, - { "WorkerLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_workerLR ) }, - - { "ChatUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_chatUL ) }, - { "ChatLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_chatLR ) }, - - { "BeaconUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_beaconUL ) }, - { "BeaconLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_beaconLR ) }, - - { "PowerBarUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_powerBarUL ) }, - { "PowerBarLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_powerBarLR ) }, - - { "MoneyUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_moneyUL ) }, - { "MoneyLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_moneyLR ) }, - - { "CommandMarkerImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_commandMarkerImage) }, - { "ExpBarForegroundImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_expBarForeground) }, - - { NULL, NULL, NULL, 0 } + { "ImagePart", ControlBarSchemeManager::parseImagePart, nullptr, 0 }, + { "AnimatingPart", ControlBarSchemeManager::parseAnimatingPart, nullptr, 0 }, + { "ScreenCreationRes", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_ScreenCreationRes ) }, + { "Side", INI::parseAsciiString, nullptr, offsetof( ControlBarScheme, m_side ) }, + { "QueueButtonImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buttonQueueImage ) }, + { "RightHUDImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_rightHUDImage ) }, + { "BuildUpClockColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_buildUpClockColor ) }, + { "ButtonBorderBuildColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderBuildColor ) }, + { "CommandBarBorderColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_commandBarBorderColor ) }, + { "ButtonBorderActionColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderActionColor ) }, + { "ButtonBorderUpgradeColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderUpgradeColor ) }, + { "ButtonBorderSystemColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderSystemColor ) }, + { "OptionsButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonEnable ) }, + { "OptionsButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonHightlited ) }, + { "OptionsButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonPushed ) }, + { "OptionsButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonDisabled ) }, + { "IdleWorkerButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonEnable ) }, + { "IdleWorkerButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonHightlited ) }, + { "IdleWorkerButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonPushed ) }, + { "IdleWorkerButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonDisabled ) }, + { "BuddyButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonEnable ) }, + { "BuddyButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonHightlited ) }, + { "BuddyButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonPushed ) }, + { "BuddyButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonDisabled) }, + { "BeaconButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonEnable ) }, + { "BeaconButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonHightlited ) }, + { "BeaconButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonPushed ) }, + { "BeaconButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonDisabled ) }, + { "GenBarButtonIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genBarButtonIn ) }, + { "GenBarButtonOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genBarButtonOn ) }, + { "ToggleButtonUpIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpIn ) }, + { "ToggleButtonUpOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpOn ) }, + { "ToggleButtonUpPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpPushed ) }, + { "ToggleButtonDownIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownIn ) }, + { "ToggleButtonDownOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownOn ) }, + { "ToggleButtonDownPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownPushed ) }, + + { "GeneralButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonEnable ) }, + { "GeneralButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonHightlited ) }, + { "GeneralButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonPushed ) }, + { "GeneralButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonDisabled ) }, + + { "UAttackButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonEnable ) }, + { "UAttackButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonHightlited ) }, + { "UAttackButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonPushed ) }, + + { "GenArrow", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genArrow) }, + + { "MinMaxButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonEnable ) }, + { "MinMaxButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonHightlited ) }, + { "MinMaxButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonPushed ) }, + + { "MinMaxUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_minMaxUL ) }, + { "MinMaxLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_minMaxLR ) }, + + { "GeneralUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_generalUL ) }, + { "GeneralLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_generalLR ) }, + + { "UAttackUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_uAttackUL ) }, + { "UAttackLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_uAttackLR ) }, + + { "OptionsUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_optionsUL ) }, + { "OptionsLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_optionsLR ) }, + + { "WorkerUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_workerUL ) }, + { "WorkerLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_workerLR ) }, + + { "ChatUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_chatUL ) }, + { "ChatLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_chatLR ) }, + + { "BeaconUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_beaconUL ) }, + { "BeaconLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_beaconLR ) }, + + { "PowerBarUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_powerBarUL ) }, + { "PowerBarLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_powerBarLR ) }, + + { "MoneyUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_moneyUL ) }, + { "MoneyLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_moneyLR ) }, + + { "CommandMarkerImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_commandMarkerImage) }, + { "ExpBarForegroundImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_expBarForeground) }, + + { nullptr, nullptr, nullptr, 0 } }; @@ -163,7 +163,7 @@ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = static const LookupListRec AnimTypeNames[] = { { "SLIDE_RIGHT", ControlBarSchemeAnimation::CB_ANIM_SLIDE_RIGHT }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(AnimTypeNames) == ControlBarSchemeAnimation::CB_ANIM_MAX + 1, "Incorrect array size"); @@ -177,13 +177,13 @@ ControlBarSchemeImage::ControlBarSchemeImage( void ) m_name.clear(); m_position.x = m_position.y = 0; m_size.x = m_size.y = 0; - m_image = NULL; + m_image = nullptr; m_layer = 0; } ControlBarSchemeImage::~ControlBarSchemeImage( void ) { - m_image = NULL; + m_image = nullptr; } ControlBarSchemeAnimation::ControlBarSchemeAnimation( void ) @@ -192,14 +192,14 @@ ControlBarSchemeAnimation::ControlBarSchemeAnimation( void ) m_finalPos.x = m_finalPos.y = 0; m_name.clear(); m_animType = 0; - m_animImage = NULL; + m_animImage = nullptr; m_startPos.x = m_startPos.y = 0; m_currentFrame = 0; } ControlBarSchemeAnimation::~ControlBarSchemeAnimation( void ) { - m_animImage = NULL; + m_animImage = nullptr; } @@ -233,40 +233,40 @@ void ControlBarScheme::reset(void) m_name.clear(); m_ScreenCreationRes.x = m_ScreenCreationRes.y = 0; m_side.clear(); - m_buttonQueueImage = NULL; - m_rightHUDImage = NULL; - m_optionsButtonEnable = NULL; - m_optionsButtonHightlited = NULL; - m_optionsButtonPushed = NULL; - m_optionsButtonDisabled = NULL; - - m_idleWorkerButtonEnable = NULL; - m_idleWorkerButtonHightlited = NULL; - m_idleWorkerButtonPushed = NULL; - m_idleWorkerButtonDisabled = NULL; - - m_buddyButtonEnable = NULL; - m_buddyButtonHightlited = NULL; - m_buddyButtonPushed = NULL; - m_buddyButtonDisabled = NULL; - - m_beaconButtonEnable = NULL; - m_beaconButtonHightlited = NULL; - m_beaconButtonPushed = NULL; - m_beaconButtonDisabled = NULL; - - m_genBarButtonIn = NULL; - m_genBarButtonOn = NULL; - - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; - - m_commandMarkerImage = NULL; - m_expBarForeground = NULL; + m_buttonQueueImage = nullptr; + m_rightHUDImage = nullptr; + m_optionsButtonEnable = nullptr; + m_optionsButtonHightlited = nullptr; + m_optionsButtonPushed = nullptr; + m_optionsButtonDisabled = nullptr; + + m_idleWorkerButtonEnable = nullptr; + m_idleWorkerButtonHightlited = nullptr; + m_idleWorkerButtonPushed = nullptr; + m_idleWorkerButtonDisabled = nullptr; + + m_buddyButtonEnable = nullptr; + m_buddyButtonHightlited = nullptr; + m_buddyButtonPushed = nullptr; + m_buddyButtonDisabled = nullptr; + + m_beaconButtonEnable = nullptr; + m_beaconButtonHightlited = nullptr; + m_beaconButtonPushed = nullptr; + m_beaconButtonDisabled = nullptr; + + m_genBarButtonIn = nullptr; + m_genBarButtonOn = nullptr; + + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; + + m_commandMarkerImage = nullptr; + m_expBarForeground = nullptr; } @@ -284,63 +284,63 @@ ControlBarScheme::ControlBarScheme(void) m_name.clear(); m_ScreenCreationRes.x = m_ScreenCreationRes.y = 0; m_side.clear(); - m_buttonQueueImage = NULL; - m_rightHUDImage = NULL; + m_buttonQueueImage = nullptr; + m_rightHUDImage = nullptr; m_buildUpClockColor = GameMakeColor(0,0,0,100); m_borderBuildColor = GAME_COLOR_UNDEFINED; m_borderActionColor = GAME_COLOR_UNDEFINED; m_borderUpgradeColor = GAME_COLOR_UNDEFINED; m_borderSystemColor = GAME_COLOR_UNDEFINED; //m_buttonQueueImage = TheMappedImageCollection("") - m_optionsButtonEnable = NULL; - m_optionsButtonHightlited = NULL; - m_optionsButtonPushed = NULL; - m_optionsButtonDisabled = NULL; + m_optionsButtonEnable = nullptr; + m_optionsButtonHightlited = nullptr; + m_optionsButtonPushed = nullptr; + m_optionsButtonDisabled = nullptr; m_commandBarBorderColor = 0; - m_idleWorkerButtonEnable = NULL; - m_idleWorkerButtonHightlited = NULL; - m_idleWorkerButtonPushed = NULL; - m_idleWorkerButtonDisabled = NULL; + m_idleWorkerButtonEnable = nullptr; + m_idleWorkerButtonHightlited = nullptr; + m_idleWorkerButtonPushed = nullptr; + m_idleWorkerButtonDisabled = nullptr; - m_buddyButtonEnable = NULL; - m_buddyButtonHightlited = NULL; - m_buddyButtonPushed = NULL; - m_buddyButtonDisabled= NULL; + m_buddyButtonEnable = nullptr; + m_buddyButtonHightlited = nullptr; + m_buddyButtonPushed = nullptr; + m_buddyButtonDisabled= nullptr; - m_beaconButtonEnable = NULL; - m_beaconButtonHightlited = NULL; - m_beaconButtonPushed = NULL; - m_beaconButtonDisabled= NULL; + m_beaconButtonEnable = nullptr; + m_beaconButtonHightlited = nullptr; + m_beaconButtonPushed = nullptr; + m_beaconButtonDisabled= nullptr; - m_genBarButtonIn = NULL; - m_genBarButtonOn = NULL; + m_genBarButtonIn = nullptr; + m_genBarButtonOn = nullptr; - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; - m_commandMarkerImage = NULL; - m_expBarForeground = NULL; + m_commandMarkerImage = nullptr; + m_expBarForeground = nullptr; - m_generalButtonEnable = NULL; - m_generalButtonHightlited = NULL; - m_generalButtonPushed = NULL; - m_generalButtonDisabled = NULL; + m_generalButtonEnable = nullptr; + m_generalButtonHightlited = nullptr; + m_generalButtonPushed = nullptr; + m_generalButtonDisabled = nullptr; - m_uAttackButtonEnable = NULL; - m_uAttackButtonHightlited = NULL; - m_uAttackButtonPushed = NULL; + m_uAttackButtonEnable = nullptr; + m_uAttackButtonHightlited = nullptr; + m_uAttackButtonPushed = nullptr; - m_genArrow = NULL; + m_genArrow = nullptr; - m_minMaxButtonEnable = NULL; - m_minMaxButtonHightlited = NULL; - m_minMaxButtonPushed = NULL; + m_minMaxButtonEnable = nullptr; + m_minMaxButtonHightlited = nullptr; + m_minMaxButtonPushed = nullptr; m_minMaxUL.x = 0; m_minMaxLR.x = 0; @@ -413,12 +413,12 @@ void ControlBarScheme::init(void) TheControlBar->updateUpDownImages(m_toggleButtonUpIn, m_toggleButtonUpOn, m_toggleButtonUpPushed, m_toggleButtonDownIn, m_toggleButtonDownOn, m_toggleButtonDownPushed, m_generalButtonEnable, m_generalButtonHightlited); TheControlBar->setArrowImage( m_genArrow); } - GameWindow *win = NULL; + GameWindow *win = nullptr; Coord2D resMultiplier; resMultiplier.x = TheDisplay->getWidth()/INT_TO_REAL(m_ScreenCreationRes.x) ; resMultiplier.y = TheDisplay->getHeight()/INT_TO_REAL(m_ScreenCreationRes.y); - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) ); if(win) { // DEBUG_ASSERTCRASH(m_buddyButtonEnable, ("No enable button image for communicator in scheme %s!", m_name.str())); @@ -446,7 +446,7 @@ void ControlBarScheme::init(void) win->winSetPosition(x,y ); win->winSetSize((m_chatLR.x - m_chatUL.x)*resMultiplier.x + COMMAND_BAR_SIZE_OFFSET,(m_chatLR.y - m_chatUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_idleWorkerButtonEnable); @@ -473,12 +473,12 @@ void ControlBarScheme::init(void) win->winSetSize((m_workerLR.x - m_workerUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_workerLR.y - m_workerUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) ); if(win) { win->winSetEnabledImage(0, m_expBarForeground); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonOptions" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonOptions" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_optionsButtonEnable); @@ -502,7 +502,7 @@ void ControlBarScheme::init(void) win->winSetPosition(x,y ); win->winSetSize((m_optionsLR.x - m_optionsUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_optionsLR.y - m_optionsUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_beaconButtonEnable); @@ -528,7 +528,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_beaconLR.x - m_beaconUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_beaconLR.y - m_beaconUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) ); if(win) { @@ -550,7 +550,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_moneyLR.x - m_moneyUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_moneyLR.y - m_moneyUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) ); if(win) { @@ -573,7 +573,7 @@ void ControlBarScheme::init(void) DEBUG_LOG(("Power Bar UL X:%d Y:%d LR X:%d Y:%d size X:%d Y:%d",m_powerBarUL.x, m_powerBarUL.y,m_powerBarLR.x, m_powerBarLR.y, (m_powerBarLR.x - m_powerBarUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_powerBarLR.y - m_powerBarUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET )); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); if(win) { @@ -600,7 +600,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_generalLR.x - m_generalUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_generalLR.y - m_generalUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); if(win) { // The images are set above @@ -626,7 +626,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_minMaxLR.x - m_minMaxUL.x)*resMultiplier.x + COMMAND_BAR_SIZE_OFFSET,(m_minMaxLR.y - m_minMaxUL.y)*resMultiplier.y + COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUAttack" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUAttack" ) ); if(win) { win->winSetEnabledImage(0,m_uAttackButtonEnable); @@ -805,7 +805,7 @@ void ControlBarScheme::drawBackground( Coord2D multi, ICoord2D offset ) //----------------------------------------------------------------------------- ControlBarSchemeManager::ControlBarSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; m_schemeList.clear(); m_multiplyer.x = m_multiplyer.y = 1; } @@ -825,7 +825,7 @@ ControlBarSchemeManager::~ControlBarSchemeManager( void ) it ++; } m_schemeList.clear(); - m_currentScheme = NULL; + m_currentScheme = nullptr; } @@ -836,11 +836,11 @@ void ControlBarSchemeManager::parseImagePart(INI *ini, void *instance, void* /*s { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, - { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ControlBarSchemeImage, m_image ) }, + { "Layer", INI::parseInt, nullptr, offsetof( ControlBarSchemeImage, m_layer ) }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -856,11 +856,11 @@ void ControlBarSchemeManager::parseAnimatingPartImage(INI *ini, void *instance, { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, - { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ControlBarSchemeImage, m_image ) }, + { "Layer", INI::parseInt, nullptr, offsetof( ControlBarSchemeImage, m_layer ) }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -876,12 +876,12 @@ void ControlBarSchemeManager::parseAnimatingPart(INI *ini, void *instance, void* { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( ControlBarSchemeAnimation, m_name ) }, + { "Name", INI::parseAsciiString, nullptr, offsetof( ControlBarSchemeAnimation, m_name ) }, { "Animation", INI::parseLookupList, AnimTypeNames, offsetof( ControlBarSchemeAnimation, m_animType ) }, - { "Duration", INI::parseDurationUnsignedInt, NULL, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, - { "FinalPos", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, - { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Duration", INI::parseDurationUnsignedInt, nullptr, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, + { "FinalPos", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, + { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeAnimation *schemeAnim = NEW ControlBarSchemeAnimation; @@ -911,7 +911,7 @@ ControlBarScheme *ControlBarSchemeManager::newControlBarScheme( AsciiString name if( !cbScheme || name.isEmpty() ) { DEBUG_ASSERTCRASH(FALSE,("Could not create controlbar %s", name.str())); - return NULL; + return nullptr; } cbScheme->m_name.set( name ); @@ -938,13 +938,13 @@ ControlBarScheme *ControlBarSchemeManager::findControlBarScheme( AsciiString nam if( !CBScheme ) { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList")); - return NULL; + return nullptr; } if(CBScheme->m_name.compareNoCase( name ) == 0) return CBScheme; it ++; } - return NULL; + return nullptr; } // @@ -997,8 +997,8 @@ void ControlBarSchemeManager::init( void ) INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ControlBarScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ControlBarScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ControlBarScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ControlBarScheme", INI_LOAD_OVERWRITE, nullptr ); // //Load the user modified control bar schemes // WIN32_FIND_DATA findData; @@ -1007,7 +1007,7 @@ void ControlBarSchemeManager::init( void ) // { // userDataPath.format("%sINI\\ControlBarScheme",TheGlobalData->getPath_UserData().str()); // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) -// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); +// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, nullptr ); // } if( m_schemeList.empty() ) { @@ -1034,7 +1034,7 @@ void ControlBarSchemeManager::setControlBarScheme(AsciiString schemeName) else { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList")); - m_currentScheme = NULL; + m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); @@ -1082,7 +1082,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT if(side.isEmpty()) side.set("Observer"); DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side", side.str())); - ControlBarScheme *tempScheme = NULL; + ControlBarScheme *tempScheme = nullptr; ControlBarSchemeList::iterator it = m_schemeList.begin(); @@ -1118,7 +1118,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT // well, we couldn't find m_currentScheme = findControlBarScheme("Default"); DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str())); -// m_currentScheme = NULL; +// m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); @@ -1126,7 +1126,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT //----------------------------------------------------------------------------- void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) { - GameWindow *communicatorButton = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("ControlBar.wnd:PopupCommunicator") ); + GameWindow *communicatorButton = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("ControlBar.wnd:PopupCommunicator") ); if (communicatorButton && TheControlBar) { if (TheRecorder->isMultiplayer()) @@ -1150,7 +1150,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) if(side.isEmpty()) side.set("Observer"); DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side", side.str())); - ControlBarScheme *tempScheme = NULL; + ControlBarScheme *tempScheme = nullptr; ControlBarSchemeList::iterator it = m_schemeList.begin(); @@ -1186,7 +1186,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) // well, we couldn't find m_currentScheme = findControlBarScheme("Default"); DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str())); -// m_currentScheme = NULL; +// m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index 0dd9f43c16f..2c96521351c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -144,7 +144,7 @@ void ControlBar::populateStructureInventory( Object *building ) setControlCommand( m_commandWindows[ i ], exitCommand ); // Clear any veterancy icon incase the unit leaves! - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); // // if the structure can hold a lesser amount inside it than what the GUI displays // we will completely hide the buttons that can't contain anything diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index c7a37c23af5..d26d08b98bc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -49,7 +49,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) { UnicodeString text; static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( NULL, descID ); + GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); // santiy DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); @@ -71,7 +71,7 @@ void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) { // sanity - if( objectUnderConstruction == NULL ) + if( objectUnderConstruction == nullptr ) return; // get our parent window diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index 293a5b36ae4..c585ac47a9a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -43,7 +43,7 @@ const char *const DisconnectMenu::m_playerNameTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Name", "DisconnectScreen.wnd:StaticPlayer6Name", "DisconnectScreen.wnd:StaticPlayer7Name", - NULL + nullptr }; const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { @@ -54,7 +54,7 @@ const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Timeout", "DisconnectScreen.wnd:StaticPlayer6Timeout", "DisconnectScreen.wnd:StaticPlayer7Timeout", - NULL + nullptr }; const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { @@ -65,7 +65,7 @@ const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { "DisconnectScreen.wnd:ButtonKickPlayer5", "DisconnectScreen.wnd:ButtonKickPlayer6", "DisconnectScreen.wnd:ButtonKickPlayer7", - NULL + nullptr }; const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { @@ -76,7 +76,7 @@ const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Votes", "DisconnectScreen.wnd:StaticPlayer6Votes", "DisconnectScreen.wnd:StaticPlayer7Votes", - NULL + nullptr }; const char *const DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; @@ -85,17 +85,17 @@ const char *const DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.w static const Color chatNormalColor = GameMakeColor(255,0,0,255); -DisconnectMenu *TheDisconnectMenu = NULL; +DisconnectMenu *TheDisconnectMenu = nullptr; DisconnectMenu::DisconnectMenu() { - m_disconnectManager = NULL; + m_disconnectManager = nullptr; } DisconnectMenu::~DisconnectMenu() { } void DisconnectMenu::init() { - m_disconnectManager = NULL; + m_disconnectManager = nullptr; HideDisconnectWindow(); m_menuState = DISCONNECTMENUSTATETYPE_SCREENOFF; } @@ -119,9 +119,9 @@ void DisconnectMenu::hideScreen() { void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[playerNum]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { if (!name.isEmpty()) { GadgetStaticTextSetText(control, name); // showPlayerControls(playerNum); @@ -129,9 +129,9 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[playerNum]); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { if (!name.isEmpty()) { GadgetStaticTextSetText(control, L""); } @@ -146,7 +146,7 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { void DisconnectMenu::setPlayerTimeoutTime(Int playerNum, time_t newTime) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[playerNum]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); char str[33]; // itoa uses a max of 33 bytes. itoa(newTime, str, 10); @@ -154,27 +154,27 @@ void DisconnectMenu::setPlayerTimeoutTime(Int playerNum, time_t newTime) { asciiNum.set(str); UnicodeString uninum; uninum.translate(asciiNum); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, uninum); } } void DisconnectMenu::showPlayerControls(Int slot) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteButtonControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); // Disallow voting for 2-player games. Cheating punk. if ( TheGameInfo && TheGameInfo->getNumPlayers() < 3 ) @@ -188,28 +188,28 @@ void DisconnectMenu::showPlayerControls(Int slot) { } id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } } void DisconnectMenu::hidePlayerControls(Int slot) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteButtonControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); // Disallow voting for 2-player games. Cheating punk. if ( TheGameInfo && TheGameInfo->getNumPlayers() < 3 ) @@ -223,24 +223,24 @@ void DisconnectMenu::hidePlayerControls(Int slot) { } id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } } void DisconnectMenu::showPacketRouterTimeout() { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutLabelControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, L""); // start it off with a blank string. control->winHide(FALSE); } @@ -248,23 +248,23 @@ void DisconnectMenu::showPacketRouterTimeout() { void DisconnectMenu::hidePacketRouterTimeout() { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutLabelControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(TRUE); } } void DisconnectMenu::setPacketRouterTimeoutTime(time_t newTime) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); char str[33]; // itoa uses a max of 33 bytes. itoa(newTime, str, 10); @@ -272,7 +272,7 @@ void DisconnectMenu::setPacketRouterTimeoutTime(time_t newTime) { asciiNum.set(str); UnicodeString uninum; uninum.translate(asciiNum); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, uninum); } } @@ -283,9 +283,9 @@ void DisconnectMenu::sendChat(UnicodeString text) { void DisconnectMenu::showChat(UnicodeString text) { NameKeyType displayID = TheNameKeyGenerator->nameToKey(m_textDisplayControlName); - GameWindow *displayControl = TheWindowManager->winGetWindowFromId(NULL, displayID); + GameWindow *displayControl = TheWindowManager->winGetWindowFromId(nullptr, displayID); - if (displayControl != NULL) { + if (displayControl != nullptr) { GadgetListBoxAddEntryText(displayControl, text, chatNormalColor, -1, -1); } } @@ -298,14 +298,14 @@ void DisconnectMenu::removePlayer(Int slot, UnicodeString playerName) { hidePlayerControls(slot); NameKeyType displayID = TheNameKeyGenerator->nameToKey(m_textDisplayControlName); - GameWindow *displayControl = TheWindowManager->winGetWindowFromId(NULL, displayID); + GameWindow *displayControl = TheWindowManager->winGetWindowFromId(nullptr, displayID); UnicodeString text; // UnicodeString name; // name.translate(playerName); text.format(TheGameText->fetch("Network:PlayerLeftGame"), playerName.str()); - if (displayControl != NULL) { + if (displayControl != nullptr) { GadgetListBoxAddEntryText(displayControl, text, chatNormalColor, -1, -1); } } @@ -317,9 +317,9 @@ void DisconnectMenu::voteForPlayer(Int slot) { void DisconnectMenu::updateVotes(Int slot, Int votes) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { char votestr[16]; itoa(votes, votestr, 10); AsciiString asciivotes; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp index 650dfd09cb6..ddafc23e33e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp @@ -34,7 +34,7 @@ #include "GameClient/GadgetStaticText.h" #include "GameClient/GameText.h" -EstablishConnectionsMenu *TheEstablishConnectionsMenu = NULL; +EstablishConnectionsMenu *TheEstablishConnectionsMenu = nullptr; const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept1", @@ -44,7 +44,7 @@ const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept5", "EstablishConnectionsScreen.wnd:ButtonAccept6", "EstablishConnectionsScreen.wnd:ButtonAccept7", - NULL}; + nullptr}; const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Name", @@ -54,7 +54,7 @@ const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer5Name", "EstablishConnectionsScreen.wnd:StaticPlayer6Name", "EstablishConnectionsScreen.wnd:StaticPlayer7Name", - NULL + nullptr }; const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { @@ -65,7 +65,7 @@ const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer5Status", "EstablishConnectionsScreen.wnd:StaticPlayer6Status", "EstablishConnectionsScreen.wnd:StaticPlayer7Status", - NULL + nullptr }; /** @@ -107,10 +107,10 @@ void EstablishConnectionsMenu::abortGame() { // the slot number passed in is the index we are to use for the menu. void EstablishConnectionsMenu::setPlayerName(Int slot, UnicodeString name) { NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerNameControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, controlID); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - if (control == NULL) { - DEBUG_ASSERTCRASH(control != NULL, ("player name control for slot %d is NULL", slot)); + if (control == nullptr) { + DEBUG_ASSERTCRASH(control != nullptr, ("player name control for slot %d is null", slot)); return; } GadgetStaticTextSetText(control, name); @@ -118,10 +118,10 @@ void EstablishConnectionsMenu::setPlayerName(Int slot, UnicodeString name) { void EstablishConnectionsMenu::setPlayerStatus(Int slot, NATConnectionState state) { NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerStatusControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, controlID); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - if (control == NULL) { - DEBUG_ASSERTCRASH(control != NULL, ("player status control for slot %d is NULL", slot)); + if (control == nullptr) { + DEBUG_ASSERTCRASH(control != nullptr, ("player status control for slot %d is null", slot)); return; } // if (state == NATCONNECTIONSTATE_NETGEARDELAY) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp index 75704c557da..0a46c3e6f7d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp @@ -56,7 +56,7 @@ #include "GameLogic/ScriptEngine.h" //external declarations of the Gadgets the callbacks can use -WindowLayout *popupCommunicatorLayout = NULL; +WindowLayout *popupCommunicatorLayout = nullptr; //------------------------------------------------------------------------------------------------- @@ -277,7 +277,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, { // do the command - TheGameClient->evaluateContextCommand( NULL, &world, CommandTranslator::DO_COMMAND ); + TheGameClient->evaluateContextCommand( nullptr, &world, CommandTranslator::DO_COMMAND ); } else if( command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) @@ -292,7 +292,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, } else { - GameMessage *newMsg = NULL; + GameMessage *newMsg = nullptr; // Do the superweapon stuff here, before issuing these other messages @@ -407,7 +407,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, else if( controlID == beaconClearTextButtonID && TheGameLogic->isInMultiplayerGame() ) { static NameKeyType textID = NAMEKEY("ControlBar.wnd:EditBeaconText"); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, textID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, textID); if (win) { GadgetTextEntrySetText( win, UnicodeString::TheEmptyString ); @@ -471,7 +471,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, { msg->appendWideCharArgument( *c++ ); } - msg->appendWideCharArgument( L'\0' ); // trailing NULL + msg->appendWideCharArgument( L'\0' ); // trailing null } } break; @@ -504,7 +504,7 @@ void ShowControlBar( Bool immediate ) TheControlBar->showSpecialPowerShortcut(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { @@ -539,7 +539,7 @@ void HideControlBar( Bool immediate ) TheControlBar->hideSpecialPowerShortcut(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { @@ -575,7 +575,7 @@ void ToggleControlBar( Bool immediate ) toggleReplayControls(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index c658188dd09..e544a18f0c8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -94,10 +94,10 @@ #include "GameNetwork/NetworkInterface.h" -static WindowLayout *theLayout = NULL; -static GameWindow *theWindow = NULL; -static AnimateWindowManager *theAnimateWindowManager = NULL; -static GameWindow *prevWindow = NULL; +static WindowLayout *theLayout = nullptr; +static GameWindow *theWindow = nullptr; +static AnimateWindowManager *theAnimateWindowManager = nullptr; +static GameWindow *prevWindow = nullptr; static Bool useAnimation = FALSE; void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) { @@ -117,7 +117,7 @@ void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) { delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; TheControlBar->deleteBuildTooltipLayout(); } } @@ -159,9 +159,9 @@ void ControlBar::showBuildTooltipLayout( GameWindow *cmdButton ) { // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); -// m_buildToolTipLayout = NULL; +// m_buildToolTipLayout = nullptr; m_buildToolTipLayout->hide(TRUE); - prevWindow = NULL; + prevWindow = nullptr; } return; } @@ -216,7 +216,7 @@ void ControlBar::showBuildTooltipLayout( GameWindow *cmdButton ) // we're a generic window if(!BitIsSet(cmdButton->winGetStyle(), GWS_USER_WINDOW) && !BitIsSet(cmdButton->winGetStyle(), GWS_STATIC_TEXT)) return; - populateBuildTooltipLayout(NULL, cmdButton); + populateBuildTooltipLayout(nullptr, cmdButton); } m_buildToolTipLayout->hide(FALSE); @@ -300,7 +300,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, descrip = TheGameText->fetch(commandButton->getDescriptionLabel()); Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - Object *selectedObject = draw ? draw->getObject() : NULL; + Object *selectedObject = draw ? draw->getObject() : nullptr; if( selectedObject ) { //Special case: Append status of overcharge on China power plant. @@ -570,7 +570,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, tempDString->setText(descrip); tempDString->getSize(&newSize.x, &newSize.y); TheDisplayStringManager->freeDisplayString(tempDString); - tempDString = NULL; + tempDString = nullptr; diffSize = newSize.y - size.y; GameWindow *parent = m_buildToolTipLayout->getFirstWindow(); if(!parent) @@ -592,7 +592,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, // heightChange = controlBarPos.y - m_defaultControlBarPosition.y; - GameWindow *marker = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *marker = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!marker) { @@ -634,16 +634,16 @@ void ControlBar::hideBuildTooltipLayout() void ControlBar::deleteBuildTooltipLayout( void ) { m_showBuildToolTipLayout = FALSE; - prevWindow= NULL; + prevWindow= nullptr; m_buildToolTipLayout->hide(TRUE); // if(!m_buildToolTipLayout) // return; // // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); -// m_buildToolTipLayout = NULL; +// m_buildToolTipLayout = nullptr; delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index 660e96b7bf2..dc2b6273424 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -68,27 +68,27 @@ static NameKeyType buttonMuteID[MAX_SLOTS]; static NameKeyType buttonUnMuteID[MAX_SLOTS]; static NameKeyType radioButtonInGameID = NAMEKEY_INVALID; static NameKeyType radioButtonBuddiesID = NAMEKEY_INVALID; -static GameWindow *radioButtonInGame = NULL; -static GameWindow *radioButtonBuddies = NULL; +static GameWindow *radioButtonInGame = nullptr; +static GameWindow *radioButtonBuddies = nullptr; static NameKeyType winInGameID = NAMEKEY_INVALID; static NameKeyType winBuddiesID = NAMEKEY_INVALID; static NameKeyType winSoloID = NAMEKEY_INVALID; -static GameWindow *winInGame = NULL; -static GameWindow *winBuddies = NULL; -static GameWindow *winSolo = NULL; -static GameWindow *staticTextPlayer[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextSide[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextTeam[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextStatus[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *buttonMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *buttonUnMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static GameWindow *winInGame = nullptr; +static GameWindow *winBuddies = nullptr; +static GameWindow *winSolo = nullptr; +static GameWindow *staticTextPlayer[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextSide[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextTeam[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextStatus[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *buttonMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *buttonUnMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; static Int slotNumInRow[MAX_SLOTS]; //------------------------------------------------------------------------------------------------- -static WindowLayout *theLayout = NULL; -static GameWindow *theWindow = NULL; -static AnimateWindowManager *theAnimateWindowManager = NULL; +static WindowLayout *theLayout = nullptr; +static GameWindow *theWindow = nullptr; +static AnimateWindowManager *theAnimateWindowManager = nullptr; WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2); void InitBuddyControls(Int type); @@ -126,12 +126,12 @@ static void releaseWindowPointers( void ) { for (Int i=0; inameToKey("Diplomacy.wnd:RadioButtonInGame"); radioButtonBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonBuddies"); - radioButtonInGame = TheWindowManager->winGetWindowFromId(NULL, radioButtonInGameID); - radioButtonBuddies = TheWindowManager->winGetWindowFromId(NULL, radioButtonBuddiesID); + radioButtonInGame = TheWindowManager->winGetWindowFromId(nullptr, radioButtonInGameID); + radioButtonBuddies = TheWindowManager->winGetWindowFromId(nullptr, radioButtonBuddiesID); winInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:InGameParent"); winBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:BuddiesParent"); winSoloID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:SoloParent"); - winInGame = TheWindowManager->winGetWindowFromId(NULL, winInGameID); - winBuddies = TheWindowManager->winGetWindowFromId(NULL, winBuddiesID); - winSolo = TheWindowManager->winGetWindowFromId(NULL, winSoloID); + winInGame = TheWindowManager->winGetWindowFromId(nullptr, winInGameID); + winBuddies = TheWindowManager->winGetWindowFromId(nullptr, winBuddiesID); + winSolo = TheWindowManager->winGetWindowFromId(nullptr, winSoloID); if (!TheRecorder->isMultiplayer()) { @@ -287,12 +287,12 @@ void ResetDiplomacy( void ) theLayout->destroyWindows(); deleteInstance(theLayout); InitBuddyControls(-1); - theLayout = NULL; + theLayout = nullptr; } - theWindow = NULL; + theWindow = nullptr; delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -466,10 +466,10 @@ void PopulateInGameDiplomacyPopup( void ) if (slot && slot->isOccupied()) { Bool isInGame = false; - // Note - for skirmish, TheNetwork == NULL. jba. + // Note - for skirmish, TheNetwork == nullptr. jba. if (TheNetwork && TheNetwork->isPlayerConnected(slotNum)) { isInGame = true; - } else if ((TheNetwork == NULL) && slot->isHuman()) { + } else if ((TheNetwork == nullptr) && slot->isHuman()) { // this is a skirmish game and it is the human player. isInGame = true; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp index 67357c600c2..b95227521d2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp @@ -59,12 +59,12 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne // first check to make sure we have some buttons to display if(buttonFlags == 0 ) { - return NULL; + return nullptr; } GameWindow *parent = TheWindowManager->winCreateFromScript( "Menus/MessageBox.wnd" ); TheWindowManager->winSetModal( parent ); - TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + TheWindowManager->winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves TheWindowManager->winSetFocus( parent ); // If the user wants the size to be different then the default @@ -191,31 +191,31 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, NULL, NULL); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, nullptr, nullptr); } GameWindow *ExMessageBoxYesNoCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, NULL, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, nullptr, cancelCallback); } GameWindow *ExMessageBoxOkCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc okCallback, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, NULL, NULL, okCallback, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, nullptr, nullptr, okCallback, cancelCallback); } GameWindow *ExMessageBoxOk (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc okCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, NULL, NULL, okCallback, NULL); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, nullptr, nullptr, okCallback, nullptr); } GameWindow *ExMessageBoxCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, NULL, NULL, NULL, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, nullptr, nullptr, nullptr, cancelCallback); } @@ -239,7 +239,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { delete (WindowExMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp index 93e3b69370f..8b38afef512 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp @@ -74,7 +74,7 @@ WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg //Get rid of any building placement mode! if( TheInGameUI ) { - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index 3db793e6e77..a97474b56c3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -40,7 +40,7 @@ Int IMECandidateWindowLineSpacing = 2; -static DisplayString *Dstring = NULL; +static DisplayString *Dstring = nullptr; //------------------------------------------------------------------------------------------------- /** Input procedure for the candidate window */ @@ -62,7 +62,7 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m switch( msg ) { case GWM_CREATE: - if ( Dstring == NULL ) + if ( Dstring == nullptr ) { Dstring = TheDisplayStringManager->newDisplayString(); } @@ -70,10 +70,10 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: - if ( Dstring != NULL ) + if ( Dstring != nullptr ) { TheDisplayStringManager->freeDisplayString( Dstring ); - Dstring = NULL; + Dstring = nullptr; } break; @@ -152,14 +152,14 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); } - if ( Dstring == NULL ) + if ( Dstring == nullptr ) { return; } IMEManagerInterface *ime = (IMEManagerInterface*)window->winGetUserData(); - if ( ime == NULL ) + if ( ime == nullptr ) { return; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 9311f81063e..bc80a8787aa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -46,9 +46,9 @@ #include "GameNetwork/GameInfo.h" #include "GameNetwork/NetworkInterface.h" -static GameWindow *chatWindow = NULL; -static GameWindow *chatTextEntry = NULL; -static GameWindow *chatTypeStaticText = NULL; +static GameWindow *chatWindow = nullptr; +static GameWindow *chatTextEntry = nullptr; +static GameWindow *chatTypeStaticText = nullptr; static UnicodeString s_savedChat; static InGameChatType inGameChatType; @@ -79,11 +79,11 @@ void ShowInGameChat( Bool immediate ) chatWindow = TheWindowManager->winCreateFromScript( "InGameChat.wnd" ); static NameKeyType textEntryChatID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:TextEntryChat" ); - chatTextEntry = TheWindowManager->winGetWindowFromId( NULL, textEntryChatID ); + chatTextEntry = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); static NameKeyType chatTypeStaticTextID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:StaticTextChatType" ); - chatTypeStaticText = TheWindowManager->winGetWindowFromId( NULL, chatTypeStaticTextID ); + chatTypeStaticText = TheWindowManager->winGetWindowFromId( nullptr, chatTypeStaticTextID ); } TheWindowManager->winSetFocus( chatTextEntry ); SetInGameChatType( INGAME_CHAT_EVERYONE ); @@ -95,9 +95,9 @@ void ResetInGameChat( void ) { if(chatWindow) TheWindowManager->winDestroy( chatWindow ); - chatWindow = NULL; - chatTextEntry = NULL; - chatTypeStaticText = NULL; + chatWindow = nullptr; + chatTextEntry = nullptr; + chatTypeStaticText = nullptr; s_savedChat.clear(); } @@ -112,9 +112,9 @@ void HideInGameChat( Bool immediate ) chatWindow->winEnable(FALSE); chatTextEntry->winHide(TRUE); chatTextEntry->winEnable(FALSE); - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } // ------------------------------------------------------------------------------------------------ @@ -145,7 +145,7 @@ void SetInGameChatType( InGameChatType chatType ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ Bool IsInGameChatActive() { - if (chatWindow != NULL) { + if (chatWindow != nullptr) { if (chatWindow->winIsHidden() == FALSE) { return TRUE; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp index dda3a72f769..e2013ac2748 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp @@ -73,9 +73,9 @@ static NameKeyType staticTextMessageID = NAMEKEY_INVALID; static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *staticTextMessage = NULL; -static GameWindow *buttonOk = NULL; +static GameWindow *parent = nullptr; +static GameWindow *staticTextMessage = nullptr; +static GameWindow *buttonOk = nullptr; static Bool pause = FALSE; @@ -90,7 +90,7 @@ void InGamePopupMessageInit( WindowLayout *layout, void *userData ) { parentID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:InGamePopupMessageParent"); - parent = TheWindowManager->winGetWindowFromId(NULL, parentID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); staticTextMessageID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:StaticTextMessage"); staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index 133d11a1413..6f2c4de1e08 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -69,7 +69,7 @@ static NameKeyType parentMainMenuID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMainMenu = NULL; +static GameWindow *parentMainMenu = nullptr; //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ void CreditsMenuInit( WindowLayout *layout, void *userData ) TheCredits->init(); parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" ); - parentMainMenu = TheWindowManager->winGetWindowFromId( NULL, parentMainMenuID ); + parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID ); // show menu @@ -113,7 +113,7 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData ) { TheCredits->reset(); delete TheCredits; - TheCredits = NULL; + TheCredits = nullptr; TheShell->showShellMap(TRUE); // hide menu diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp index 73cef4cd845..51c1e0a5615 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -68,15 +68,15 @@ //----------------------------------------------------------------------------- static GameDifficulty s_AIDiff = DIFFICULTY_NORMAL; static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow * buttonOk = NULL; +static GameWindow * buttonOk = nullptr; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow * buttonCancel = NULL; +static GameWindow * buttonCancel = nullptr; static NameKeyType radioButtonEasyAIID = NAMEKEY_INVALID; static NameKeyType radioButtonMediumAIID = NAMEKEY_INVALID; static NameKeyType radioButtonHardAIID = NAMEKEY_INVALID; -static GameWindow * radioButtonEasyAI = NULL; -static GameWindow * radioButtonMediumAI = NULL; -static GameWindow * radioButtonHardAI = NULL; +static GameWindow * radioButtonEasyAI = nullptr; +static GameWindow * radioButtonMediumAI = nullptr; +static GameWindow * radioButtonHardAI = nullptr; void setupGameStart(AsciiString mapName, GameDifficulty diff); //----------------------------------------------------------------------------- @@ -126,7 +126,7 @@ static void SetDifficultyRadioButton( void ) void DifficultySelectInit( WindowLayout *layout, void *userData ) { NameKeyType parentID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:DifficultySelectParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonOkID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonOk" ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); @@ -144,7 +144,7 @@ void DifficultySelectInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent // AsciiString parentName( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); // NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); -// parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); +// parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); // // TheWindowManager->winSetFocus( parent ); // diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp index 1c3ce0ea666..9ae28212bc3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp @@ -47,11 +47,11 @@ static WindowLayout *disconnectMenuLayout; static NameKeyType textEntryID = NAMEKEY_INVALID; static NameKeyType textDisplayID = NAMEKEY_INVALID; -static GameWindow *textEntryWindow = NULL; -static GameWindow *textDisplayWindow = NULL; +static GameWindow *textEntryWindow = nullptr; +static GameWindow *textDisplayWindow = nullptr; static NameKeyType buttonQuitID = NAMEKEY_INVALID; -static GameWindow *buttonQuitWindow = NULL; +static GameWindow *buttonQuitWindow = nullptr; static NameKeyType buttonVotePlayer1ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer2ID = NAMEKEY_INVALID; @@ -61,28 +61,28 @@ static NameKeyType buttonVotePlayer5ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer6ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer7ID = NAMEKEY_INVALID; -static GameWindow *buttonVotePlayer1Window = NULL; -static GameWindow *buttonVotePlayer2Window = NULL; -static GameWindow *buttonVotePlayer3Window = NULL; -static GameWindow *buttonVotePlayer4Window = NULL; -static GameWindow *buttonVotePlayer5Window = NULL; -static GameWindow *buttonVotePlayer6Window = NULL; -static GameWindow *buttonVotePlayer7Window = NULL; +static GameWindow *buttonVotePlayer1Window = nullptr; +static GameWindow *buttonVotePlayer2Window = nullptr; +static GameWindow *buttonVotePlayer3Window = nullptr; +static GameWindow *buttonVotePlayer4Window = nullptr; +static GameWindow *buttonVotePlayer5Window = nullptr; +static GameWindow *buttonVotePlayer6Window = nullptr; +static GameWindow *buttonVotePlayer7Window = nullptr; static void InitDisconnectWindow( void ) { textEntryID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:TextEntry"); textDisplayID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ListboxTextDisplay"); - textEntryWindow = TheWindowManager->winGetWindowFromId(NULL, textEntryID); - textDisplayWindow = TheWindowManager->winGetWindowFromId(NULL, textDisplayID); + textEntryWindow = TheWindowManager->winGetWindowFromId(nullptr, textEntryID); + textDisplayWindow = TheWindowManager->winGetWindowFromId(nullptr, textDisplayID); - if (textEntryWindow != NULL) { + if (textEntryWindow != nullptr) { GadgetTextEntrySetText(textEntryWindow, UnicodeString::TheEmptyString); TheWindowManager->winSetFocus(textEntryWindow); } buttonQuitID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonQuitGame"); - buttonQuitWindow = TheWindowManager->winGetWindowFromId(NULL, buttonQuitID); + buttonQuitWindow = TheWindowManager->winGetWindowFromId(nullptr, buttonQuitID); buttonVotePlayer1ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer1"); buttonVotePlayer2ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer2"); @@ -92,13 +92,13 @@ static void InitDisconnectWindow( void ) { buttonVotePlayer6ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer6"); buttonVotePlayer7ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer7"); - buttonVotePlayer1Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer1ID); - buttonVotePlayer2Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer2ID); - buttonVotePlayer3Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer3ID); - buttonVotePlayer4Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer4ID); - buttonVotePlayer5Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer5ID); - buttonVotePlayer6Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer6ID); - buttonVotePlayer7Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer7ID); + buttonVotePlayer1Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer1ID); + buttonVotePlayer2Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer2ID); + buttonVotePlayer3Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer3ID); + buttonVotePlayer4Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer4ID); + buttonVotePlayer5Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer5ID); + buttonVotePlayer6Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer6ID); + buttonVotePlayer7Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer7ID); } //------------------------------------------------------ @@ -108,7 +108,7 @@ void ShowDisconnectWindow( void ) { // load the quit menu from the layout file if needed - if( disconnectMenuLayout == NULL ) + if( disconnectMenuLayout == nullptr ) { // load layout from disk @@ -165,7 +165,7 @@ void HideDisconnectWindow( void ) { // load the quit menu from the layout file if needed - if( disconnectMenuLayout == NULL ) + if( disconnectMenuLayout == nullptr ) { // load layout from disk diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 0c6d03a2670..0bb3ba5f974 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -68,13 +68,13 @@ static NameKeyType staticTextFileID = NAMEKEY_INVALID; static NameKeyType staticTextStatusID = NAMEKEY_INVALID; static NameKeyType progressBarMunkeeID = NAMEKEY_INVALID; -static GameWindow * staticTextSize = NULL; -static GameWindow * staticTextTime = NULL; -static GameWindow * staticTextFile = NULL; -static GameWindow * staticTextStatus = NULL; -static GameWindow * progressBarMunkee = NULL; +static GameWindow * staticTextSize = nullptr; +static GameWindow * staticTextTime = nullptr; +static GameWindow * staticTextFile = nullptr; +static GameWindow * staticTextStatus = nullptr; +static GameWindow * progressBarMunkee = nullptr; -static GameWindow *parent = NULL; +static GameWindow *parent = nullptr; static void closeDownloadWindow( void ) { @@ -88,10 +88,10 @@ static void closeDownloadWindow( void ) menuLayout->runShutdown(); menuLayout->destroyWindows(); deleteInstance(menuLayout); - menuLayout = NULL; + menuLayout = nullptr; } - GameWindow *mainWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("MainMenu.wnd:MainMenuParent") ); + GameWindow *mainWin = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("MainMenu.wnd:MainMenuParent") ); if (mainWin) TheWindowManager->winSetFocus( mainWin ); } @@ -135,7 +135,7 @@ class DownloadManagerMunkee : public DownloadManager HRESULT DownloadManagerMunkee::downloadFile( AsciiString server, AsciiString username, AsciiString password, AsciiString file, AsciiString localfile, AsciiString regkey, Bool tryResume ) { // see if we'll need to restart - if (strstr(localfile.str(), "patches\\") != NULL) + if (strstr(localfile.str(), "patches\\") != nullptr) { m_shouldQuitOnSuccess = true; } @@ -203,7 +203,7 @@ HRESULT DownloadManagerMunkee::OnProgressUpdate( Int bytesread, Int totalsize, I timeLeft = timeleft; if (staticTextTime && GadgetStaticTextGetText(staticTextTime).isEmpty()) // only update immediately the first time { - lastUpdate = time(NULL); + lastUpdate = time(nullptr); UnicodeString timeString; if (timeleft) { @@ -245,7 +245,7 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("DownloadMenu.wnd:ParentDownload"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); // get ids for our children controls buttonCancelID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); @@ -276,14 +276,14 @@ void DownloadMenuShutdown( WindowLayout *layout, void *userData ) DEBUG_ASSERTCRASH(TheDownloadManager, ("No download manager")); delete TheDownloadManager; - TheDownloadManager = NULL; + TheDownloadManager = nullptr; - staticTextSize = NULL; - staticTextTime = NULL; - staticTextFile = NULL; - staticTextStatus = NULL; - progressBarMunkee = NULL; - parent = NULL; + staticTextSize = nullptr; + staticTextTime = nullptr; + staticTextFile = nullptr; + staticTextStatus = nullptr; + progressBarMunkee = nullptr; + parent = nullptr; } @@ -294,7 +294,7 @@ void DownloadMenuUpdate( WindowLayout *layout, void *userData ) { if (staticTextTime && !GadgetStaticTextGetText(staticTextTime).isEmpty()) { - time_t now = time(NULL); + time_t now = time(nullptr); if (now <= lastUpdate) return; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index b04aeb377aa..62ab5cbe2d0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -51,22 +51,22 @@ static NameKeyType staticPlayer5StatusID = NAMEKEY_INVALID; static NameKeyType staticPlayer6StatusID = NAMEKEY_INVALID; static NameKeyType staticPlayer7StatusID = NAMEKEY_INVALID; -static GameWindow *buttonQuitWindow = NULL; -static GameWindow *staticPlayer1Name = NULL; -static GameWindow *staticPlayer2Name = NULL; -static GameWindow *staticPlayer3Name = NULL; -static GameWindow *staticPlayer4Name = NULL; -static GameWindow *staticPlayer5Name = NULL; -static GameWindow *staticPlayer6Name = NULL; -static GameWindow *staticPlayer7Name = NULL; - -static GameWindow *staticPlayer1Status = NULL; -static GameWindow *staticPlayer2Status = NULL; -static GameWindow *staticPlayer3Status = NULL; -static GameWindow *staticPlayer4Status = NULL; -static GameWindow *staticPlayer5Status = NULL; -static GameWindow *staticPlayer6Status = NULL; -static GameWindow *staticPlayer7Status = NULL; +static GameWindow *buttonQuitWindow = nullptr; +static GameWindow *staticPlayer1Name = nullptr; +static GameWindow *staticPlayer2Name = nullptr; +static GameWindow *staticPlayer3Name = nullptr; +static GameWindow *staticPlayer4Name = nullptr; +static GameWindow *staticPlayer5Name = nullptr; +static GameWindow *staticPlayer6Name = nullptr; +static GameWindow *staticPlayer7Name = nullptr; + +static GameWindow *staticPlayer1Status = nullptr; +static GameWindow *staticPlayer2Status = nullptr; +static GameWindow *staticPlayer3Status = nullptr; +static GameWindow *staticPlayer4Status = nullptr; +static GameWindow *staticPlayer5Status = nullptr; +static GameWindow *staticPlayer6Status = nullptr; +static GameWindow *staticPlayer7Status = nullptr; static const char *layoutFilename = "GameSpyGameOptionsMenu.wnd"; static const char *parentName = "GameSpyGameOptionsMenuParent"; @@ -82,7 +82,7 @@ static const char *gadgetsToHide[] = "ButtonSelectMap", "ButtonStart", "StaticTextMapPreview", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -93,7 +93,7 @@ static const char *perPlayerGadgetsToHide[] = "ButtonAccept", "GenericPing", //"ButtonStartPosition", - NULL + nullptr }; static const char *qmlayoutFilename = "WOLQuickMatchMenu.wnd"; @@ -107,12 +107,12 @@ static const char *qmgadgetsToHide[] = "ButtonWiden", "ButtonStop", "ButtonStart", - NULL + nullptr }; static const char *qmperPlayerGadgetsToHide[] = { //"ButtonStartPosition", - NULL + nullptr }; static void showGameSpyGameOptionsUnderlyingGUIElements( Bool show ) @@ -127,11 +127,11 @@ static void showGameSpyQMUnderlyingGUIElements( Bool show ) static void InitEstablishConnectionsDialog( void ) { buttonQuitID = TheNameKeyGenerator->nameToKey( "EstablishConnectionsScreen.wnd:ButtonQuit" ); - buttonQuitWindow = TheWindowManager->winGetWindowFromId(NULL, buttonQuitID); + buttonQuitWindow = TheWindowManager->winGetWindowFromId(nullptr, buttonQuitID); } void ShowEstablishConnectionsWindow( void ) { - if (establishConnectionsLayout == NULL) { + if (establishConnectionsLayout == nullptr) { establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); InitEstablishConnectionsDialog(); } @@ -148,7 +148,7 @@ void ShowEstablishConnectionsWindow( void ) { } void HideEstablishConnectionsWindow( void ) { - if (establishConnectionsLayout == NULL) { + if (establishConnectionsLayout == nullptr) { // establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); // InitEstablishConnectionsDialog(); return; @@ -158,7 +158,7 @@ void HideEstablishConnectionsWindow( void ) { // TheWindowManager->winDestroy(establishConnectionsLayout); establishConnectionsLayout->destroyWindows(); deleteInstance(establishConnectionsLayout); - establishConnectionsLayout = NULL; + establishConnectionsLayout = nullptr; if (!TheGameSpyGame->isQMGame()) { showGameSpyGameOptionsUnderlyingGUIElements(TRUE); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp index b11e6054990..f11b049afb2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp @@ -45,13 +45,13 @@ #include "GameNetwork/LANAPI.h" -static GameWindow *parent = NULL; -static GameWindow *staticTextGameName = NULL; -static GameWindow *staticTextMapName = NULL; -static GameWindow *listBoxPlayers = NULL; -static GameWindow *winCrates = NULL; -static GameWindow *winSuperWeapons = NULL; -static GameWindow *winFreeForAll = NULL; +static GameWindow *parent = nullptr; +static GameWindow *staticTextGameName = nullptr; +static GameWindow *staticTextMapName = nullptr; +static GameWindow *listBoxPlayers = nullptr; +static GameWindow *winCrates = nullptr; +static GameWindow *winSuperWeapons = nullptr; +static GameWindow *winFreeForAll = nullptr; static NameKeyType parentID = NAMEKEY_INVALID; static NameKeyType staticTextGameNameID = NAMEKEY_INVALID; @@ -61,7 +61,7 @@ static NameKeyType winCratesID = NAMEKEY_INVALID; static NameKeyType winSuperWeaponsID = NAMEKEY_INVALID; static NameKeyType winFreeForAllID = NAMEKEY_INVALID; -static WindowLayout *gameInfoWindowLayout = NULL; +static WindowLayout *gameInfoWindowLayout = nullptr; // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// void CreateLANGameInfoWindow( GameWindow *sizeAndPosWin ) @@ -90,7 +90,7 @@ void DestroyGameInfoWindow(void) { gameInfoWindowLayout->destroyWindows(); deleteInstance(gameInfoWindowLayout); - gameInfoWindowLayout = NULL; + gameInfoWindowLayout = nullptr; } } @@ -222,7 +222,7 @@ void GameInfoWindowInit( WindowLayout *layout, void *userData ) winSuperWeaponsID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinSuperWeapons" ); winFreeForAllID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinFreeForAll" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); staticTextGameName = TheWindowManager->winGetWindowFromId( parent, staticTextGameNameID ); staticTextMapName = TheWindowManager->winGetWindowFromId( parent, staticTextMapNameID ); listBoxPlayers = TheWindowManager->winGetWindowFromId( parent, listBoxPlayersID ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index b88f31dd093..1fb425020a2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -73,31 +73,31 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg WindowMsgData mData1, WindowMsgData mData2 ); static NameKeyType buttonBackID = NAMEKEY_INVALID; -static GameWindow *buttonBack = NULL; +static GameWindow *buttonBack = nullptr; static NameKeyType parentKeyboardOptionsMenuID = NAMEKEY_INVALID; -static GameWindow *parentKeyboardOptionsMenu = NULL; +static GameWindow *parentKeyboardOptionsMenu = nullptr; static NameKeyType comboBoxCategoryListID = NAMEKEY_INVALID; -static GameWindow *comboBoxCategoryList = NULL; +static GameWindow *comboBoxCategoryList = nullptr; static NameKeyType listBoxCommandListID = NAMEKEY_INVALID; -static GameWindow *listBoxCommandList = NULL; +static GameWindow *listBoxCommandList = nullptr; static NameKeyType staticTextDescriptionID = NAMEKEY_INVALID; -static GameWindow *staticTextDescription = NULL; +static GameWindow *staticTextDescription = nullptr; static NameKeyType staticTextCurrentHotkeyID = NAMEKEY_INVALID; -static GameWindow *staticTextCurrentHotkey = NULL; +static GameWindow *staticTextCurrentHotkey = nullptr; static NameKeyType buttonResetAllID = NAMEKEY_INVALID; -static GameWindow *buttonResetAll = NULL; +static GameWindow *buttonResetAll = nullptr; static NameKeyType textEntryAssignHotkeyID = NAMEKEY_INVALID; -static GameWindow *textEntryAssignHotkey = NULL; +static GameWindow *textEntryAssignHotkey = nullptr; static NameKeyType buttonAssignID = NAMEKEY_INVALID; -static GameWindow *buttonAssign = NULL; +static GameWindow *buttonAssign = nullptr; //use Bools to test if modifiers are used @@ -392,32 +392,32 @@ void KeyboardOptionsMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent parentKeyboardOptionsMenuID = TheNameKeyGenerator->nameToKey("KeyboardOptionsMenu.wnd:ParentKeyboardOptionsMenu"); - parentKeyboardOptionsMenu = TheWindowManager->winGetWindowFromId( NULL, parentKeyboardOptionsMenuID ); + parentKeyboardOptionsMenu = TheWindowManager->winGetWindowFromId( nullptr, parentKeyboardOptionsMenuID ); // get ids for our children controls buttonBackID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); buttonBack = TheWindowManager->winGetWindowFromId( parentKeyboardOptionsMenu, buttonBackID ); comboBoxCategoryListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ComboBoxCategoryList" ); - comboBoxCategoryList = TheWindowManager->winGetWindowFromId( /*parentKeyboardOptionsMenu*/NULL, comboBoxCategoryListID ); + comboBoxCategoryList = TheWindowManager->winGetWindowFromId( /*parentKeyboardOptionsMenu*/nullptr, comboBoxCategoryListID ); listBoxCommandListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ListBoxCommandList" ); - listBoxCommandList = TheWindowManager->winGetWindowFromId( NULL, listBoxCommandListID ); + listBoxCommandList = TheWindowManager->winGetWindowFromId( nullptr, listBoxCommandListID ); staticTextDescriptionID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextDescription" ); - staticTextDescription = TheWindowManager->winGetWindowFromId( NULL, staticTextDescriptionID ); + staticTextDescription = TheWindowManager->winGetWindowFromId( nullptr, staticTextDescriptionID ); staticTextCurrentHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextCurrentHotkey" ); - staticTextCurrentHotkey = TheWindowManager->winGetWindowFromId( NULL, staticTextCurrentHotkeyID ); + staticTextCurrentHotkey = TheWindowManager->winGetWindowFromId( nullptr, staticTextCurrentHotkeyID ); buttonResetAllID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonResetAll" ); - buttonResetAll = TheWindowManager->winGetWindowFromId( NULL, buttonResetAllID ); + buttonResetAll = TheWindowManager->winGetWindowFromId( nullptr, buttonResetAllID ); textEntryAssignHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:TextEntryAssignHotkey" ); - textEntryAssignHotkey = TheWindowManager->winGetWindowFromId( NULL, textEntryAssignHotkeyID ); + textEntryAssignHotkey = TheWindowManager->winGetWindowFromId( nullptr, textEntryAssignHotkeyID ); buttonAssignID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonAssign" ); - buttonAssign = TheWindowManager->winGetWindowFromId( NULL, buttonAssignID ); + buttonAssign = TheWindowManager->winGetWindowFromId( nullptr, buttonAssignID ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 0fdce08eaa1..2c2a7e96c4d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -111,39 +111,32 @@ static NameKeyType buttonEmoteID = NAMEKEY_INVALID; static NameKeyType buttonSelectMapID = NAMEKEY_INVALID; static NameKeyType windowMapID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLanGameOptions = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *windowMap = NULL; - -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *buttonAccept[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *parentLanGameOptions = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *windowMap = nullptr; + +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; +static GameWindow *buttonAccept[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; //external declarations of the Gadgets the callbacks can use -GameWindow *listboxChatWindowLanGame = NULL; +GameWindow *listboxChatWindowLanGame = nullptr; NameKeyType listboxChatWindowLanGameID = NAMEKEY_INVALID; -WindowLayout *mapSelectLayout = NULL; +WindowLayout *mapSelectLayout = nullptr; static Int getNextSelectablePlayer(Int start) { @@ -626,7 +619,7 @@ void InitLanGameGadgets( void ) windowMapID = TheNameKeyGenerator->nameToKey( "LanGameOptionsMenu.wnd:MapWindow" ); // Initialize the pointers to our gadgets - parentLanGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentLanGameOptionsID ); + parentLanGameOptions = TheWindowManager->winGetWindowFromId( nullptr, parentLanGameOptionsID ); DEBUG_ASSERTCRASH(parentLanGameOptions, ("Could not find the parentLanGameOptions")); buttonEmote = TheWindowManager->winGetWindowFromId( parentLanGameOptions,buttonEmoteID ); DEBUG_ASSERTCRASH(buttonEmote, ("Could not find the buttonEmote")); @@ -723,28 +716,28 @@ void InitLanGameGadgets( void ) void DeinitLanGameGadgets( void ) { - parentLanGameOptions = NULL; - buttonEmote = NULL; - buttonSelectMap = NULL; - buttonStart = NULL; - buttonBack = NULL; - listboxChatWindowLanGame = NULL; - textEntryChat = NULL; - textEntryMapDisplay = NULL; + parentLanGameOptions = nullptr; + buttonEmote = nullptr; + buttonSelectMap = nullptr; + buttonStart = nullptr; + buttonBack = nullptr; + listboxChatWindowLanGame = nullptr; + textEntryChat = nullptr; + textEntryMapDisplay = nullptr; if (windowMap) { - windowMap->winSetUserData(NULL); - windowMap = NULL; + windowMap->winSetUserData(nullptr); + windowMap = nullptr; } for (Int i = 0; i < MAX_SLOTS; i++) { - comboBoxPlayer[i] = NULL; - comboBoxColor[i] = NULL; - comboBoxPlayerTemplate[i] = NULL; - comboBoxTeam[i] = NULL; - buttonAccept[i] = NULL; -// buttonStartPosition[i] = NULL; - buttonMapStartPosition[i] = NULL; + comboBoxPlayer[i] = nullptr; + comboBoxColor[i] = nullptr; + comboBoxPlayerTemplate[i] = nullptr; + comboBoxTeam[i] = nullptr; + buttonAccept[i] = nullptr; +// buttonStartPosition[i] = nullptr; + buttonMapStartPosition[i] = nullptr; } } @@ -922,21 +915,21 @@ void setLANPlayerTooltip(LANPlayer* player) static void shutdownComplete( WindowLayout *layout ) { DeinitLanGameGadgets(); - textEntryMapDisplay = NULL; + textEntryMapDisplay = nullptr; LANisShuttingDown = false; // hide the layout layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - if (LANnextScreen != NULL) + if (LANnextScreen != nullptr) { TheShell->push(LANnextScreen); } - LANnextScreen = NULL; + LANnextScreen = nullptr; } @@ -946,7 +939,7 @@ static void shutdownComplete( WindowLayout *layout ) void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) { TheMouse->setCursor(Mouse::ARROW); - TheMouse->setMouseText(UnicodeString::TheEmptyString,NULL,NULL); + TheMouse->setMouseText(UnicodeString::TheEmptyString,nullptr,nullptr); EnableSlotListUpdates(FALSE); LANisShuttingDown = true; @@ -1046,7 +1039,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1133,7 +1126,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } TheLAN->RequestGameLeave(); //TheShell->pop(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 36467a3d0ff..96b8ce5471c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -65,7 +65,7 @@ Bool LANisShuttingDown = false; Bool LANbuttonPushed = false; Bool LANSocketErrorDetected = FALSE; -char *LANnextScreen = NULL; +char *LANnextScreen = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; @@ -271,7 +271,7 @@ Money LANPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } @@ -304,24 +304,24 @@ static NameKeyType staticTextGameInfoID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLanLobby = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonClear = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *buttonDirectConnect = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *staticToolTip = NULL; -static GameWindow *textEntryPlayerName = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *staticTextGameInfo = NULL; +static GameWindow *parentLanLobby = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonClear = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *buttonDirectConnect = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *staticToolTip = nullptr; +static GameWindow *textEntryPlayerName = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *staticTextGameInfo = nullptr; //external declarations of the Gadgets the callbacks can use NameKeyType listboxChatWindowID = NAMEKEY_INVALID; -GameWindow *listboxChatWindow = NULL; -GameWindow *listboxPlayers = NULL; +GameWindow *listboxChatWindow = nullptr; +GameWindow *listboxPlayers = nullptr; NameKeyType listboxGamesID = NAMEKEY_INVALID; -GameWindow *listboxGames = NULL; +GameWindow *listboxGames = nullptr; // hack to disable framerate limiter in LAN games //static Bool shellmapOn; @@ -362,7 +362,7 @@ static void playerTooltip(GameWindow *window, //------------------------------------------------------------------------------------------------- void LanLobbyMenuInit( WindowLayout *layout, void *userData ) { - LANnextScreen = NULL; + LANnextScreen = nullptr; LANbuttonPushed = false; LANisShuttingDown = false; @@ -384,20 +384,20 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) // Get pointers to the window buttons - parentLanLobby = TheWindowManager->winGetWindowFromId( NULL, parentLanLobbyID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonClear = TheWindowManager->winGetWindowFromId( NULL, buttonClearID); - buttonHost = TheWindowManager->winGetWindowFromId( NULL, buttonHostID ); - buttonJoin = TheWindowManager->winGetWindowFromId( NULL, buttonJoinID ); - buttonDirectConnect = TheWindowManager->winGetWindowFromId( NULL, buttonDirectConnectID ); - buttonEmote = TheWindowManager->winGetWindowFromId( NULL,buttonEmoteID ); - staticToolTip = TheWindowManager->winGetWindowFromId( NULL, staticToolTipID ); - textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID ); - textEntryChat = TheWindowManager->winGetWindowFromId( NULL, textEntryChatID ); - listboxPlayers = TheWindowManager->winGetWindowFromId( NULL, listboxPlayersID ); - listboxChatWindow = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowID ); - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesID ); - staticTextGameInfo = TheWindowManager->winGetWindowFromId( NULL, staticTextGameInfoID ); + parentLanLobby = TheWindowManager->winGetWindowFromId( nullptr, parentLanLobbyID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonClear = TheWindowManager->winGetWindowFromId( nullptr, buttonClearID); + buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID ); + buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID ); + buttonDirectConnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDirectConnectID ); + buttonEmote = TheWindowManager->winGetWindowFromId( nullptr,buttonEmoteID ); + staticToolTip = TheWindowManager->winGetWindowFromId( nullptr, staticToolTipID ); + textEntryPlayerName = TheWindowManager->winGetWindowFromId( nullptr, textEntryPlayerNameID ); + textEntryChat = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); + listboxPlayers = TheWindowManager->winGetWindowFromId( nullptr, listboxPlayersID ); + listboxChatWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowID ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesID ); + staticTextGameInfo = TheWindowManager->winGetWindowFromId( nullptr, staticTextGameInfoID ); listboxPlayers->winSetTooltipFunc(playerTooltip); // Show Menu @@ -503,7 +503,7 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("LanLobbyMenu.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("LanLobbyMenu.wnd:GadgetParent")); if(win) win->winHide(TRUE); @@ -530,14 +530,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - if (LANnextScreen != NULL) + if (LANnextScreen != nullptr) { TheShell->push(LANnextScreen); } - LANnextScreen = NULL; + LANnextScreen = nullptr; } @@ -616,7 +616,7 @@ void LanLobbyMenuUpdate( WindowLayout * layout, void *userData) if (LANSocketErrorDetected == TRUE) { LANSocketErrorDetected = FALSE; DEBUG_LOG(("SOCKET ERROR! BAILING!")); - MessageBoxOk(TheGameText->fetch("GUI:NetworkError"), TheGameText->fetch("GUI:SocketError"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NetworkError"), TheGameText->fetch("GUI:SocketError"), nullptr); // we have a socket problem, back out to the main menu. TheWindowManager->winSendSystemMsg(buttonBack->winGetParent(), GBM_SELECTED, @@ -765,7 +765,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, DEBUG_LOG(("Back was hit - popping to main menu")); TheShell->pop(); delete TheLAN; - TheLAN = NULL; + TheLAN = nullptr; //TheTransitionHandler->reverse("LanLobbyFade"); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index 58827aca51b..87dfe8b7b51 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -50,14 +50,13 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *mapList = NULL; -static GameWindow *winMapPreview = NULL; +static GameWindow *parent = nullptr; +static GameWindow *mapList = nullptr; +static GameWindow *winMapPreview = nullptr; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, @@ -80,20 +79,20 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; static void showLANGameOptionsUnderlyingGUIElements( Bool show ) { ShowUnderlyingGUIElements( show, layoutFilename, parentName, gadgetsToHide, perPlayerGadgetsToHide ); - GameWindow *win = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("LanGameOptionsMenu.wnd:ButtonBack") ); + GameWindow *win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("LanGameOptionsMenu.wnd:ButtonBack") ); if(win) win->winEnable( show ); @@ -101,16 +100,16 @@ static void showLANGameOptionsUnderlyingGUIElements( Bool show ) static void NullifyControls() { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; inameToKey( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -255,8 +254,8 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) { - GameWindow *mapWindow = NULL; - if (listboxMap != NULL) + GameWindow *mapWindow = nullptr; + if (listboxMap != NAMEKEY_INVALID) { mapWindow = TheWindowManager->winGetWindowFromId( parent, listboxMap ); } @@ -344,10 +343,10 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } - // set the controls to NULL since they've been destroyed. + // set the controls to nullptr since they've been destroyed. NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions( MAP_BACK ); @@ -358,7 +357,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg UnicodeString map; // get the selected index - if (mapWindow != NULL) + if (mapWindow != nullptr) { GadgetListBoxGetSelected( mapWindow, &selected ); } @@ -394,10 +393,10 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } - // set the controls to NULL since they've been destroyed. + // set the controls to nullptr since they've been destroyed. NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 926627b0843..e2cfe319ee3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -92,9 +92,9 @@ static Bool raiseMessageBoxes = TRUE; static Bool campaignSelected = FALSE; #if defined(RTS_DEBUG) static NameKeyType campaignID = NAMEKEY_INVALID; -static GameWindow *buttonCampaign = NULL; +static GameWindow *buttonCampaign = nullptr; #ifdef TEST_COMPRESSION -static GameWindow *buttonCompressTest = NULL; +static GameWindow *buttonCompressTest = nullptr; void DoCompressTest( void ); #endif // TEST_COMPRESSION #endif @@ -135,36 +135,36 @@ static NameKeyType buttonDiffBackID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMainMenu = NULL; -static GameWindow *buttonSinglePlayer = NULL; -static GameWindow *buttonMultiPlayer = NULL; -static GameWindow *buttonSkirmish = NULL; -static GameWindow *buttonOnline = NULL; -static GameWindow *buttonNetwork = NULL; -static GameWindow *buttonOptions = NULL; -static GameWindow *buttonExit = NULL; -static GameWindow *buttonMOTD = NULL; -static GameWindow *buttonWorldBuilder = NULL; -static GameWindow *mainMenuMovie = NULL; -static GameWindow *getUpdate = NULL; -static GameWindow *buttonTRAINING = NULL; -static GameWindow *buttonUSA = NULL; -static GameWindow *buttonGLA = NULL; -static GameWindow *buttonChina = NULL; -static GameWindow *buttonUSARecentSave = NULL; -static GameWindow *buttonUSALoadGame = NULL; -static GameWindow *buttonGLARecentSave = NULL; -static GameWindow *buttonGLALoadGame = NULL; -static GameWindow *buttonChinaRecentSave = NULL; -static GameWindow *buttonChinaLoadGame = NULL; -static GameWindow *buttonReplay = NULL; -static GameWindow *buttonLoadReplay = NULL; -static GameWindow *buttonLoad = NULL; -static GameWindow *buttonCredits = NULL; -static GameWindow *buttonEasy = NULL; -static GameWindow *buttonMedium = NULL; -static GameWindow *buttonHard = NULL; -static GameWindow *buttonDiffBack = NULL; +static GameWindow *parentMainMenu = nullptr; +static GameWindow *buttonSinglePlayer = nullptr; +static GameWindow *buttonMultiPlayer = nullptr; +static GameWindow *buttonSkirmish = nullptr; +static GameWindow *buttonOnline = nullptr; +static GameWindow *buttonNetwork = nullptr; +static GameWindow *buttonOptions = nullptr; +static GameWindow *buttonExit = nullptr; +static GameWindow *buttonMOTD = nullptr; +static GameWindow *buttonWorldBuilder = nullptr; +static GameWindow *mainMenuMovie = nullptr; +static GameWindow *getUpdate = nullptr; +static GameWindow *buttonTRAINING = nullptr; +static GameWindow *buttonUSA = nullptr; +static GameWindow *buttonGLA = nullptr; +static GameWindow *buttonChina = nullptr; +static GameWindow *buttonUSARecentSave = nullptr; +static GameWindow *buttonUSALoadGame = nullptr; +static GameWindow *buttonGLARecentSave = nullptr; +static GameWindow *buttonGLALoadGame = nullptr; +static GameWindow *buttonChinaRecentSave = nullptr; +static GameWindow *buttonChinaLoadGame = nullptr; +static GameWindow *buttonReplay = nullptr; +static GameWindow *buttonLoadReplay = nullptr; +static GameWindow *buttonLoad = nullptr; +static GameWindow *buttonCredits = nullptr; +static GameWindow *buttonEasy = nullptr; +static GameWindow *buttonMedium = nullptr; +static GameWindow *buttonHard = nullptr; +static GameWindow *buttonDiffBack = nullptr; static GameWindow *dropDownWindows[DROPDOWN_COUNT]; static Bool buttonPushed = FALSE; @@ -185,7 +185,7 @@ enum static Int showFade = FALSE; static Int dropDown = DROPDOWN_NONE; static Int pendingDropDown = DROPDOWN_NONE; -static AnimateWindowManager *localAnimateWindowManager = NULL; +static AnimateWindowManager *localAnimateWindowManager = nullptr; static Bool notShown = TRUE; static Bool FirstTimeRunningTheGame = TRUE; @@ -200,7 +200,7 @@ static Bool dontAllowTransitions = FALSE; const Int /*TIME_OUT = 15,*/ CORNER = 10; void AcceptResolution(); void DeclineResolution(); -GameWindow *resAcceptMenu = NULL; +GameWindow *resAcceptMenu = nullptr; extern DisplaySettings oldDispSettings, newDispSettings; extern Bool dispChanged; //static time_t timeStarted = 0, currentTime = 0; @@ -338,7 +338,7 @@ static void TimetToFileTime( time_t t, LPFILETIME pft ) void initialHide( void ) { -GameWindow *win = NULL; +GameWindow *win = nullptr; win = TheWindowManager->winGetWindowFromId(parentMainMenu, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinFactionGLA")); if(win) win->winHide(TRUE); @@ -408,7 +408,7 @@ GameWindow *win = NULL; static void initLabelVersion() { NameKeyType versionID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:LabelVersion" ); - GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( NULL, versionID ); + GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( nullptr, versionID ); if (labelVersion) { @@ -441,7 +441,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) pendingDropDown = DROPDOWN_NONE; Int i = 0; for(; i < DROPDOWN_COUNT; ++i) - dropDownWindows[i] = NULL; + dropDownWindows[i] = nullptr; // get ids for our windows mainMenuID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:MainMenuParent" ); @@ -480,7 +480,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) buttonDiffBackID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonDiffBack" ); // get pointers to the window buttons - parentMainMenu = TheWindowManager->winGetWindowFromId( NULL, mainMenuID ); + parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, mainMenuID ); //buttonCampaign = TheWindowManager->winGetWindowFromId( parentMainMenu, campaignID ); buttonSinglePlayer = TheWindowManager->winGetWindowFromId( parentMainMenu, buttonSinglePlayerID ); buttonMultiPlayer = TheWindowManager->winGetWindowFromId( parentMainMenu, buttonMultiPlayerID ); @@ -536,7 +536,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 25, 175, 400, 400, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif // TEST_COMPRESSION instData.init(); @@ -548,7 +548,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED, 25, 54, 180, 26, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif initLabelVersion(); @@ -573,11 +573,11 @@ void MainMenuInit( WindowLayout *layout, void *userData ) checkedForUpdate = TRUE; DEBUG_LOG(("Looking for a patch for productID=%d, versionStr=%s, distribution=%d", gameProductID, gameVersionUniqueIDStr, gameDistributionID)); - ptCheckForPatch( gameProductID, gameVersionUniqueIDStr, gameDistributionID, patchAvailableCallback, PTFalse, NULL ); - //ptCheckForPatch( productID, versionUniqueIDStr, distributionID, mapPackAvailableCallback, PTFalse, NULL ); + ptCheckForPatch( gameProductID, gameVersionUniqueIDStr, gameDistributionID, patchAvailableCallback, PTFalse, nullptr ); + //ptCheckForPatch( productID, versionUniqueIDStr, distributionID, mapPackAvailableCallback, PTFalse, nullptr ); } } - if (getUpdate != NULL) + if (getUpdate != nullptr) { getUpdate->winHide( TRUE ); //getUpdate->winEnable( FALSE ); @@ -651,7 +651,7 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) // if(winVidManager) // delete winVidManager; - // winVidManager = NULL; + // winVidManager = nullptr; if( popImmediate ) @@ -659,7 +659,7 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) // if(localAnimateWindowManager) // { // delete localAnimateWindowManager; -// localAnimateWindowManager = NULL; +// localAnimateWindowManager = nullptr; // } shutdownComplete( layout ); return; @@ -741,7 +741,7 @@ void DoResolutionDialog() resAcceptMenu = TheWindowManager->gogoMessageBox( CORNER, CORNER, -1, -1,MSG_BOX_OK | MSG_BOX_CANCEL , TheGameText->fetch("GUI:Resolution"), - resTimerString, NULL, NULL, AcceptResolution, + resTimerString, nullptr, nullptr, AcceptResolution, DeclineResolution); } @@ -755,11 +755,11 @@ void ResolutionDialogUpdate() { if (timeStarted == 0 && currentTime == 0) { - timeStarted = currentTime = time(NULL); + timeStarted = currentTime = time(nullptr); } else { - currentTime = time(NULL); + currentTime = time(nullptr); } if ( ( currentTime - timeStarted ) >= TIME_OUT) @@ -771,7 +771,7 @@ void ResolutionDialogUpdate() // Used for debugging purposes //------------------------------------------------------------------------------------------------------ DEBUG_LOG(("Resolution Timer : started at %d, current time at %d, frameTicker is %d", timeStarted, - time(NULL) , currentTime)); + time(nullptr) , currentTime)); } */ @@ -1403,7 +1403,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // load the options menu WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); - DEBUG_ASSERTCRASH(optLayout != NULL, ("unable to get options menu layout")); + DEBUG_ASSERTCRASH(optLayout != nullptr, ("unable to get options menu layout")); optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); @@ -1411,11 +1411,11 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == worldBuilderID ) { #if defined RTS_DEBUG - if(_spawnl(_P_NOWAIT,"WorldBuilderD.exe","WorldBuilderD.exe", NULL) < 0) - MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),NULL); + if(_spawnl(_P_NOWAIT,"WorldBuilderD.exe","WorldBuilderD.exe", nullptr) < 0) + MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),nullptr); #else - if(_spawnl(_P_NOWAIT,"WorldBuilder.exe","WorldBuilder.exe", NULL) < 0) - MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),NULL); + if(_spawnl(_P_NOWAIT,"WorldBuilder.exe","WorldBuilder.exe", nullptr) < 0) + MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),nullptr); #endif } else if( controlID == getUpdateID ) @@ -1433,7 +1433,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, } else { - QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),quitCallback,NULL); + QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),quitCallback,nullptr); } //#endif @@ -1472,7 +1472,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, logoIsShown = FALSE; showLogo = FALSE; showSide = SHOW_USA; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); @@ -1496,7 +1496,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, logoIsShown = FALSE; showLogo = FALSE; showSide = SHOW_GLA; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); @@ -1521,7 +1521,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, showLogo = FALSE; showSide = SHOW_CHINA; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp index 3c6f985275c..08435310692 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -50,7 +50,7 @@ // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *mapList = NULL; +static GameWindow *mapList = nullptr; static Bool showSoloMaps = true; static Bool isShuttingDown = false; @@ -109,7 +109,7 @@ static void shutdownComplete( WindowLayout *layout ) void SetDifficultyRadioButton( void ) { NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!TheScriptEngine) { @@ -171,7 +171,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // get the listbox window NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); - mapList = TheWindowManager->winGetWindowFromId( NULL, mapListID ); + mapList = TheWindowManager->winGetWindowFromId( nullptr, mapListID ); if( mapList ) { if (TheMapCache) @@ -182,14 +182,14 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID ); + GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( NULL, buttonOKID ); + GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,0); @@ -404,7 +404,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, Int selected; UnicodeString map; - GameWindow *mapWindow = TheWindowManager->winGetWindowFromId( NULL, listboxMap ); + GameWindow *mapWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxMap ); // get the selected index GadgetListBoxGetSelected( mapWindow, &selected ); @@ -454,7 +454,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, //buttonPushed = true; GadgetListBoxSetSelected( control, rowSelected ); NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( NULL, buttonOKID ); + GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOK, buttonOKID ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index 8d3b77b289c..23a0c17767b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -70,12 +70,12 @@ static NameKeyType editPlayerNameID = NAMEKEY_INVALID; static NameKeyType comboboxRemoteIPID = NAMEKEY_INVALID; static NameKeyType staticLocalIPID = NAMEKEY_INVALID; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *editPlayerName = NULL; -static GameWindow *comboboxRemoteIP = NULL; -static GameWindow *staticLocalIP = NULL; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *editPlayerName = nullptr; +static GameWindow *comboboxRemoteIP = nullptr; +static GameWindow *staticLocalIP = nullptr; void PopulateRemoteIPComboBox() { @@ -180,7 +180,7 @@ void UpdateRemoteIPList() void HostDirectConnectGame() { // Init LAN API Singleton - DEBUG_ASSERTCRASH(TheLAN != NULL, ("TheLAN is NULL!")); + DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null!")); if (!TheLAN) { TheLAN = NEW LANAPI(); @@ -252,7 +252,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) LANbuttonPushed = false; LANisShuttingDown = false; - if (TheLAN == NULL) + if (TheLAN == nullptr) { TheLAN = NEW LANAPI(); TheLAN->init(); @@ -269,12 +269,12 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) comboboxRemoteIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ComboboxRemoteIP" ); staticLocalIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:StaticLocalIP" ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonHost = TheWindowManager->winGetWindowFromId( NULL, buttonHostID); - buttonJoin = TheWindowManager->winGetWindowFromId( NULL, buttonJoinID); - editPlayerName = TheWindowManager->winGetWindowFromId( NULL, editPlayerNameID); - comboboxRemoteIP = TheWindowManager->winGetWindowFromId( NULL, comboboxRemoteIPID); - staticLocalIP = TheWindowManager->winGetWindowFromId( NULL, staticLocalIPID); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID); + buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID); + editPlayerName = TheWindowManager->winGetWindowFromId( nullptr, editPlayerNameID); + comboboxRemoteIP = TheWindowManager->winGetWindowFromId( nullptr, comboboxRemoteIPID); + staticLocalIP = TheWindowManager->winGetWindowFromId( nullptr, staticLocalIPID); // // animate controls // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_LEFT, TRUE, 800); @@ -297,10 +297,10 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) UnicodeString ipstr; delete TheLAN; - TheLAN = NULL; + TheLAN = nullptr; - if (TheLAN == NULL) { -// DEBUG_ASSERTCRASH(TheLAN != NULL, ("TheLAN is null initializing the direct connect screen.")); + if (TheLAN == nullptr) { +// DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null initializing the direct connect screen.")); TheLAN = NEW LANAPI(); OptionPreferences prefs; @@ -319,7 +319,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) Bool foundIP = FALSE; EnumeratedIP *tempIP = IPlist; - while ((tempIP != NULL) && (foundIP == FALSE)) { + while ((tempIP != nullptr) && (foundIP == FALSE)) { if (IP == tempIP->getIP()) { foundIP = TRUE; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index dc01e513b3c..d6fc89193c7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -82,120 +82,120 @@ static NameKeyType comboBoxOnlineIPID = NAMEKEY_INVALID; -static GameWindow * comboBoxOnlineIP = NULL; +static GameWindow * comboBoxOnlineIP = nullptr; static NameKeyType comboBoxLANIPID = NAMEKEY_INVALID; -static GameWindow * comboBoxLANIP = NULL; +static GameWindow * comboBoxLANIP = nullptr; static NameKeyType comboBoxAntiAliasingID = NAMEKEY_INVALID; -static GameWindow * comboBoxAntiAliasing = NULL; +static GameWindow * comboBoxAntiAliasing = nullptr; static NameKeyType comboBoxResolutionID = NAMEKEY_INVALID; -static GameWindow * comboBoxResolution = NULL; +static GameWindow * comboBoxResolution = nullptr; static NameKeyType comboBoxDetailID = NAMEKEY_INVALID; -static GameWindow * comboBoxDetail = NULL; +static GameWindow * comboBoxDetail = nullptr; static NameKeyType checkAlternateMouseID = NAMEKEY_INVALID; -static GameWindow * checkAlternateMouse = NULL; +static GameWindow * checkAlternateMouse = nullptr; static NameKeyType sliderScrollSpeedID = NAMEKEY_INVALID; -static GameWindow * sliderScrollSpeed = NULL; +static GameWindow * sliderScrollSpeed = nullptr; static NameKeyType checkLanguageFilterID = NAMEKEY_INVALID; -static GameWindow * checkLanguageFilter = NULL; +static GameWindow * checkLanguageFilter = nullptr; static NameKeyType checkUseCameraID = NAMEKEY_INVALID; -static GameWindow * checkUseCamera = NULL; +static GameWindow * checkUseCamera = nullptr; static NameKeyType checkSaveCameraID = NAMEKEY_INVALID; -static GameWindow * checkSaveCamera = NULL; +static GameWindow * checkSaveCamera = nullptr; static NameKeyType checkSendDelayID = NAMEKEY_INVALID; -static GameWindow * checkSendDelay = NULL; +static GameWindow * checkSendDelay = nullptr; static NameKeyType checkDrawAnchorID = NAMEKEY_INVALID; -static GameWindow * checkDrawAnchor = NULL; +static GameWindow * checkDrawAnchor = nullptr; static NameKeyType checkMoveAnchorID = NAMEKEY_INVALID; -static GameWindow * checkMoveAnchor = NULL; +static GameWindow * checkMoveAnchor = nullptr; static NameKeyType buttonFirewallRefreshID = NAMEKEY_INVALID; -static GameWindow * buttonFirewallRefresh = NULL; +static GameWindow * buttonFirewallRefresh = nullptr; // //static NameKeyType checkAudioHardwareID = NAMEKEY_INVALID; -//static GameWindow * checkAudioHardware = NULL; +//static GameWindow * checkAudioHardware = nullptr; // //static NameKeyType checkAudioSurroundID = NAMEKEY_INVALID; -//static GameWindow * checkAudioSurround = NULL; +//static GameWindow * checkAudioSurround = nullptr; ////volume controls // static NameKeyType sliderMusicVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderMusicVolume = NULL; +static GameWindow * sliderMusicVolume = nullptr; static NameKeyType sliderSFXVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderSFXVolume = NULL; +static GameWindow * sliderSFXVolume = nullptr; static NameKeyType sliderVoiceVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderVoiceVolume = NULL; +static GameWindow * sliderVoiceVolume = nullptr; static NameKeyType sliderGammaID = NAMEKEY_INVALID; -static GameWindow * sliderGamma = NULL; +static GameWindow * sliderGamma = nullptr; //Advanced Options Screen static NameKeyType WinAdvancedDisplayID = NAMEKEY_INVALID; -static GameWindow * WinAdvancedDisplay = NULL; +static GameWindow * WinAdvancedDisplay = nullptr; static NameKeyType ButtonAdvancedAcceptID = NAMEKEY_INVALID; -static GameWindow * ButtonAdvancedAccept = NULL; +static GameWindow * ButtonAdvancedAccept = nullptr; static NameKeyType ButtonAdvancedCancelID = NAMEKEY_INVALID; -static GameWindow * ButtonAdvancedCancel = NULL; +static GameWindow * ButtonAdvancedCancel = nullptr; static NameKeyType sliderTextureResolutionID = NAMEKEY_INVALID; -static GameWindow * sliderTextureResolution = NULL; +static GameWindow * sliderTextureResolution = nullptr; static NameKeyType sliderParticleCapID = NAMEKEY_INVALID; -static GameWindow * sliderParticleCap = NULL; +static GameWindow * sliderParticleCap = nullptr; static NameKeyType check3DShadowsID = NAMEKEY_INVALID; -static GameWindow * check3DShadows = NULL; +static GameWindow * check3DShadows = nullptr; static NameKeyType check2DShadowsID = NAMEKEY_INVALID; -static GameWindow * check2DShadows = NULL; +static GameWindow * check2DShadows = nullptr; static NameKeyType checkCloudShadowsID = NAMEKEY_INVALID; -static GameWindow * checkCloudShadows = NULL; +static GameWindow * checkCloudShadows = nullptr; static NameKeyType checkGroundLightingID = NAMEKEY_INVALID; -static GameWindow * checkGroundLighting = NULL; +static GameWindow * checkGroundLighting = nullptr; static NameKeyType checkSmoothWaterID = NAMEKEY_INVALID; -static GameWindow * checkSmoothWater = NULL; +static GameWindow * checkSmoothWater = nullptr; static NameKeyType checkBuildingOcclusionID = NAMEKEY_INVALID; -static GameWindow * checkBuildingOcclusion = NULL; +static GameWindow * checkBuildingOcclusion = nullptr; static NameKeyType checkPropsID = NAMEKEY_INVALID; -static GameWindow * checkProps = NULL; +static GameWindow * checkProps = nullptr; static NameKeyType checkExtraAnimationsID = NAMEKEY_INVALID; -static GameWindow * checkExtraAnimations = NULL; +static GameWindow * checkExtraAnimations = nullptr; static NameKeyType checkNoDynamicLodID = NAMEKEY_INVALID; -static GameWindow * checkNoDynamicLod = NULL; +static GameWindow * checkNoDynamicLod = nullptr; static NameKeyType checkUnlockFpsID = NAMEKEY_INVALID; -static GameWindow * checkUnlockFps = NULL; +static GameWindow * checkUnlockFps = nullptr; /* static NameKeyType radioHighID = NAMEKEY_INVALID; -static GameWindow * radioHigh = NULL; +static GameWindow * radioHigh = nullptr; static NameKeyType radioMediumID = NAMEKEY_INVALID; -static GameWindow * radioMedium = NULL; +static GameWindow * radioMedium = nullptr; static NameKeyType radioLowID = NAMEKEY_INVALID; -static GameWindow * radioLow = NULL; +static GameWindow * radioLow = nullptr; */ @@ -204,7 +204,7 @@ Bool dispChanged = FALSE; extern Int timer; extern void DoResolutionDialog(); static Bool ignoreSelected = FALSE; -WindowLayout *OptionsLayout = NULL; +WindowLayout *OptionsLayout = nullptr; OptionPreferences::OptionPreferences( void ) @@ -951,7 +951,7 @@ Bool OptionPreferences::getShowMoneyPerMinute(void) const return FALSE; } -static OptionPreferences *pref = NULL; +static OptionPreferences *pref = nullptr; static void setDefaults( void ) { @@ -1247,7 +1247,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // HTTP Proxy - GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); + GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); if (textEntryHTTPProxy && textEntryHTTPProxy->winGetEnabled()) { UnicodeString uStr = GadgetTextEntryGetText(textEntryHTTPProxy); @@ -1259,7 +1259,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Firewall Port Override - GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); + GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); if (textEntryFirewallPortOverride && textEntryFirewallPortOverride->winGetEnabled()) { UnicodeString uStr = GadgetTextEntryGetText(textEntryFirewallPortOverride); @@ -1569,7 +1569,7 @@ static void DestroyOptionsLayout() { SignalUIInteraction(SHELL_SCRIPT_HOOK_OPTIONS_CLOSED); TheShell->destroyOptionsLayout(); - OptionsLayout = NULL; + OptionsLayout = nullptr; } static void showAdvancedOptions() @@ -1594,7 +1594,7 @@ static void cancelAdvancedOptions() static void initLabelVersion() { NameKeyType versionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:LabelVersion" ); - GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( NULL, versionID ); + GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( nullptr, versionID ); if (labelVersion) { @@ -1627,100 +1627,100 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) SignalUIInteraction(SHELL_SCRIPT_HOOK_OPTIONS_OPENED); comboBoxLANIPID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxIP" ); - comboBoxLANIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxLANIPID); + comboBoxLANIP = TheWindowManager->winGetWindowFromId( nullptr, comboBoxLANIPID); comboBoxOnlineIPID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxOnlineIP" ); - comboBoxOnlineIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxOnlineIPID); + comboBoxOnlineIP = TheWindowManager->winGetWindowFromId( nullptr, comboBoxOnlineIPID); checkAlternateMouseID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAlternateMouse" ); - checkAlternateMouse = TheWindowManager->winGetWindowFromId( NULL, checkAlternateMouseID); + checkAlternateMouse = TheWindowManager->winGetWindowFromId( nullptr, checkAlternateMouseID); sliderScrollSpeedID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderScrollSpeed" ); - sliderScrollSpeed = TheWindowManager->winGetWindowFromId( NULL, sliderScrollSpeedID); + sliderScrollSpeed = TheWindowManager->winGetWindowFromId( nullptr, sliderScrollSpeedID); comboBoxAntiAliasingID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxAntiAliasing" ); - comboBoxAntiAliasing = TheWindowManager->winGetWindowFromId( NULL, comboBoxAntiAliasingID ); + comboBoxAntiAliasing = TheWindowManager->winGetWindowFromId( nullptr, comboBoxAntiAliasingID ); comboBoxResolutionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxResolution" ); - comboBoxResolution = TheWindowManager->winGetWindowFromId( NULL, comboBoxResolutionID ); + comboBoxResolution = TheWindowManager->winGetWindowFromId( nullptr, comboBoxResolutionID ); comboBoxDetailID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxDetail" ); - comboBoxDetail = TheWindowManager->winGetWindowFromId( NULL, comboBoxDetailID ); + comboBoxDetail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxDetailID ); checkLanguageFilterID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckLanguageFilter" ); - checkLanguageFilter = TheWindowManager->winGetWindowFromId( NULL, checkLanguageFilterID ); + checkLanguageFilter = TheWindowManager->winGetWindowFromId( nullptr, checkLanguageFilterID ); checkSendDelayID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckSendDelay" ); - checkSendDelay = TheWindowManager->winGetWindowFromId( NULL, checkSendDelayID); + checkSendDelay = TheWindowManager->winGetWindowFromId( nullptr, checkSendDelayID); buttonFirewallRefreshID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonFirewallRefresh" ); - buttonFirewallRefresh = TheWindowManager->winGetWindowFromId( NULL, buttonFirewallRefreshID); + buttonFirewallRefresh = TheWindowManager->winGetWindowFromId( nullptr, buttonFirewallRefreshID); checkDrawAnchorID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxDrawAnchor" ); - checkDrawAnchor = TheWindowManager->winGetWindowFromId( NULL, checkDrawAnchorID); + checkDrawAnchor = TheWindowManager->winGetWindowFromId( nullptr, checkDrawAnchorID); checkMoveAnchorID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxMoveAnchor" ); - checkMoveAnchor = TheWindowManager->winGetWindowFromId( NULL, checkMoveAnchorID); + checkMoveAnchor = TheWindowManager->winGetWindowFromId( nullptr, checkMoveAnchorID); // Replay camera checkSaveCameraID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxSaveCamera" ); - checkSaveCamera = TheWindowManager->winGetWindowFromId( NULL, checkSaveCameraID ); + checkSaveCamera = TheWindowManager->winGetWindowFromId( nullptr, checkSaveCameraID ); checkUseCameraID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxUseCamera" ); - checkUseCamera = TheWindowManager->winGetWindowFromId( NULL, checkUseCameraID ); + checkUseCamera = TheWindowManager->winGetWindowFromId( nullptr, checkUseCameraID ); // // Speakers and 3-D Audio // checkAudioSurroundID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAudioSurround" ); -// checkAudioSurround = TheWindowManager->winGetWindowFromId( NULL, checkAudioSurroundID ); +// checkAudioSurround = TheWindowManager->winGetWindowFromId( nullptr, checkAudioSurroundID ); // checkAudioHardwareID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAudioHardware" ); -// checkAudioHardware = TheWindowManager->winGetWindowFromId( NULL, checkAudioHardwareID ); +// checkAudioHardware = TheWindowManager->winGetWindowFromId( nullptr, checkAudioHardwareID ); // // Volume Controls sliderMusicVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderMusicVolume" ); - sliderMusicVolume = TheWindowManager->winGetWindowFromId( NULL, sliderMusicVolumeID ); + sliderMusicVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderMusicVolumeID ); sliderSFXVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderSFXVolume" ); - sliderSFXVolume = TheWindowManager->winGetWindowFromId( NULL, sliderSFXVolumeID ); + sliderSFXVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderSFXVolumeID ); sliderVoiceVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderVoiceVolume" ); - sliderVoiceVolume = TheWindowManager->winGetWindowFromId( NULL, sliderVoiceVolumeID ); + sliderVoiceVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderVoiceVolumeID ); sliderGammaID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderGamma" ); - sliderGamma = TheWindowManager->winGetWindowFromId( NULL, sliderGammaID ); + sliderGamma = TheWindowManager->winGetWindowFromId( nullptr, sliderGammaID ); // checkBoxLowTextureDetailID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckLowTextureDetail" ); -// checkBoxLowTextureDetail = TheWindowManager->winGetWindowFromId( NULL, checkBoxLowTextureDetailID ); +// checkBoxLowTextureDetail = TheWindowManager->winGetWindowFromId( nullptr, checkBoxLowTextureDetailID ); WinAdvancedDisplayID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:WinAdvancedDisplayOptions" ); - WinAdvancedDisplay = TheWindowManager->winGetWindowFromId( NULL, WinAdvancedDisplayID ); + WinAdvancedDisplay = TheWindowManager->winGetWindowFromId( nullptr, WinAdvancedDisplayID ); ButtonAdvancedAcceptID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonAdvanceAccept" ); - ButtonAdvancedAccept = TheWindowManager->winGetWindowFromId( NULL, ButtonAdvancedAcceptID ); + ButtonAdvancedAccept = TheWindowManager->winGetWindowFromId( nullptr, ButtonAdvancedAcceptID ); ButtonAdvancedCancelID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonAdvanceBack" ); - ButtonAdvancedCancel = TheWindowManager->winGetWindowFromId( NULL, ButtonAdvancedCancelID ); + ButtonAdvancedCancel = TheWindowManager->winGetWindowFromId( nullptr, ButtonAdvancedCancelID ); sliderTextureResolutionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:LowResSlider" ); - sliderTextureResolution = TheWindowManager->winGetWindowFromId( NULL, sliderTextureResolutionID ); + sliderTextureResolution = TheWindowManager->winGetWindowFromId( nullptr, sliderTextureResolutionID ); check3DShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:Check3DShadows" ); - check3DShadows = TheWindowManager->winGetWindowFromId( NULL, check3DShadowsID); + check3DShadows = TheWindowManager->winGetWindowFromId( nullptr, check3DShadowsID); check2DShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:Check2DShadows" ); - check2DShadows = TheWindowManager->winGetWindowFromId( NULL, check2DShadowsID); + check2DShadows = TheWindowManager->winGetWindowFromId( nullptr, check2DShadowsID); checkCloudShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckCloudShadows" ); - checkCloudShadows = TheWindowManager->winGetWindowFromId( NULL, checkCloudShadowsID); + checkCloudShadows = TheWindowManager->winGetWindowFromId( nullptr, checkCloudShadowsID); checkGroundLightingID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckGroundLighting" ); - checkGroundLighting = TheWindowManager->winGetWindowFromId( NULL, checkGroundLightingID); + checkGroundLighting = TheWindowManager->winGetWindowFromId( nullptr, checkGroundLightingID); checkSmoothWaterID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckSmoothWater" ); - checkSmoothWater = TheWindowManager->winGetWindowFromId( NULL, checkSmoothWaterID); + checkSmoothWater = TheWindowManager->winGetWindowFromId( nullptr, checkSmoothWaterID); checkExtraAnimationsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckExtraAnimations" ); - checkExtraAnimations = TheWindowManager->winGetWindowFromId( NULL, checkExtraAnimationsID); + checkExtraAnimations = TheWindowManager->winGetWindowFromId( nullptr, checkExtraAnimationsID); checkNoDynamicLodID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckNoDynamicLOD" ); - checkNoDynamicLod = TheWindowManager->winGetWindowFromId( NULL, checkNoDynamicLodID); + checkNoDynamicLod = TheWindowManager->winGetWindowFromId( nullptr, checkNoDynamicLodID); checkUnlockFpsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckUnlockFPS" ); - checkUnlockFps = TheWindowManager->winGetWindowFromId( NULL, checkUnlockFpsID); + checkUnlockFps = TheWindowManager->winGetWindowFromId( nullptr, checkUnlockFpsID); checkBuildingOcclusionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBehindBuilding" ); - checkBuildingOcclusion = TheWindowManager->winGetWindowFromId( NULL, checkBuildingOcclusionID); + checkBuildingOcclusion = TheWindowManager->winGetWindowFromId( nullptr, checkBuildingOcclusionID); checkPropsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckShowProps" ); - checkProps = TheWindowManager->winGetWindowFromId( NULL, checkPropsID); + checkProps = TheWindowManager->winGetWindowFromId( nullptr, checkPropsID); sliderParticleCapID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ParticleCapSlider" ); - sliderParticleCap = TheWindowManager->winGetWindowFromId( NULL, sliderParticleCapID ); + sliderParticleCap = TheWindowManager->winGetWindowFromId( nullptr, sliderParticleCapID ); WinAdvancedDisplay->winHide(TRUE); @@ -1809,7 +1809,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } // HTTP Proxy - GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); + GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); if (textEntryHTTPProxy) { UnicodeString uStr; @@ -1820,7 +1820,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } // Firewall Port Override - GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); + GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); if (textEntryFirewallPortOverride) { UnicodeString uStr; @@ -2047,7 +2047,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:OptionsMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); if( (TheGameLogic->isInGame() && TheGameLogic->getGameMode() != GAME_SHELL) || TheGameSpyInfo ) @@ -2096,10 +2096,10 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) { pref->write(); delete pref; - pref = NULL; + pref = nullptr; } - comboBoxIP = NULL; + comboBoxIP = nullptr; // hide menu layout->hide( TRUE ); @@ -2253,10 +2253,10 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, //TheShell->pop(); delete pref; - pref = NULL; + pref = nullptr; - comboBoxLANIP = NULL; - comboBoxOnlineIP = NULL; + comboBoxLANIP = nullptr; + comboBoxOnlineIP = nullptr; if(GameSpyIsOverlayOpen(GSOVERLAY_OPTIONS)) GameSpyCloseOverlay(GSOVERLAY_OPTIONS); @@ -2274,11 +2274,11 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { pref->write(); delete pref; - pref = NULL; + pref = nullptr; } - comboBoxLANIP = NULL; - comboBoxOnlineIP = NULL; + comboBoxLANIP = nullptr; + comboBoxOnlineIP = nullptr; if(!TheGameLogic->isInGame() || TheGameLogic->isInShellGame()) destroyQuitMenu(); // if we're in a game, the change res then enter the same kind of game, we nee the quit menu to be gone. diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp index be6aaaee59b..1a4cb024866 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp @@ -51,8 +51,8 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *buttonOk = NULL; -static GameWindow *parent = NULL; +static GameWindow *buttonOk = nullptr; +static GameWindow *parent = nullptr; // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupCommunicator.wnd:PopupCommunicator"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); TheWindowManager->winSetModal( parent ); @@ -189,7 +189,7 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms { popupCommunicatorLayout->destroyWindows(); deleteInstance(popupCommunicatorLayout); - popupCommunicatorLayout = NULL; + popupCommunicatorLayout = nullptr; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 77b256438ef..1fbe7899732 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -86,15 +86,15 @@ static NameKeyType textEntryLadderPasswordID = NAMEKEY_INVALID; static NameKeyType comboBoxLadderNameID = NAMEKEY_INVALID; static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; -static GameWindow *parentPopup = NULL; -static GameWindow *textEntryGameName = NULL; -static GameWindow *buttonCreateGame = NULL; -static GameWindow *checkBoxAllowObservers = NULL; -static GameWindow *textEntryGameDescription = NULL; -static GameWindow *buttonCancel = NULL; -static GameWindow *comboBoxLadderName = NULL; -static GameWindow *textEntryLadderPassword = NULL; -static GameWindow *textEntryGamePassword = NULL; +static GameWindow *parentPopup = nullptr; +static GameWindow *textEntryGameName = nullptr; +static GameWindow *buttonCreateGame = nullptr; +static GameWindow *checkBoxAllowObservers = nullptr; +static GameWindow *textEntryGameDescription = nullptr; +static GameWindow *buttonCancel = nullptr; +static GameWindow *comboBoxLadderName = nullptr; +static GameWindow *textEntryLadderPassword = nullptr; +static GameWindow *textEntryGamePassword = nullptr; void createGame( void ); @@ -162,7 +162,7 @@ void PopulateCustomLadderListBox( GameWindow *win ) // start with "No Ladder" index = GadgetListBoxAddEntryText( win, TheGameText->fetch("GUI:NoLadder"), normalColor, -1 ); - GadgetListBoxSetItemData( win, 0, index ); + GadgetListBoxSetItemData( win, nullptr, index ); // add the last ladder Int selectedPos = 0; @@ -260,7 +260,7 @@ void PopulateCustomLadderComboBox( void ) Int index; GadgetComboBoxReset( comboBoxLadderName ); index = GadgetComboBoxAddEntry( comboBoxLadderName, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxLadderName, index, 0 ); + GadgetComboBoxSetItemData( comboBoxLadderName, index, nullptr ); Int selectedPos = 0; AsciiString lastLadderAddr = pref.getLastLadderAddr(); @@ -307,7 +307,7 @@ void PopulateCustomLadderComboBox( void ) void PopupHostGameInit( WindowLayout *layout, void *userData ) { parentPopupID = TheNameKeyGenerator->nameToKey("PopupHostGame.wnd:ParentHostPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(NULL, parentPopupID); + parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); textEntryGameNameID = TheNameKeyGenerator->nameToKey("PopupHostGame.wnd:TextEntryGameName"); textEntryGameName = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGameNameID); @@ -416,7 +416,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { - parentPopup = NULL; + parentPopup = nullptr; break; @@ -495,7 +495,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W if( controlID == buttonCancelID ) { - parentPopup = NULL; + parentPopup = nullptr; GameSpyCloseOverlay(GSOVERLAY_GAMEOPTIONS); SetLobbyAttemptHostJoin( FALSE ); } @@ -510,7 +510,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W GadgetTextEntrySetText(textEntryGameName, name); } createGame(); - parentPopup = NULL; + parentPopup = nullptr; GameSpyCloseOverlay(GSOVERLAY_GAMEOPTIONS); } break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp index c34c1966909..193183b0665 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp @@ -72,8 +72,8 @@ static NameKeyType parentPopupID = NAMEKEY_INVALID; static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *parentPopup = NULL; -static GameWindow *textEntryGamePassword = NULL; +static GameWindow *parentPopup = nullptr; +static GameWindow *textEntryGamePassword = nullptr; static void joinGame( AsciiString password ); @@ -87,7 +87,7 @@ static void joinGame( AsciiString password ); void PopupJoinGameInit( WindowLayout *layout, void *userData ) { parentPopupID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:ParentJoinPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(NULL, parentPopupID); + parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); textEntryGamePasswordID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:TextEntryGamePassword"); textEntryGamePassword = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGamePasswordID); @@ -139,7 +139,7 @@ WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, Wi { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; } // don't let key fall through anywhere else @@ -189,7 +189,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; } break; } @@ -248,7 +248,7 @@ static void joinGame( AsciiString password ) { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; return; } PeerRequest req; @@ -259,5 +259,5 @@ static void joinGame( AsciiString password ) TheGameSpyPeerMessageQueue->addRequest(req); DEBUG_LOG(("Attempting to join game %d(%ls) with password [%s]", ourRoom->getID(), ourRoom->getGameName().str(), password.str())); GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - parentPopup = NULL; + parentPopup = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp index 30a86122e1e..0f7ecd8bc3e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp @@ -80,25 +80,25 @@ static NameKeyType staticTextLadderNameID = NAMEKEY_INVALID; static NameKeyType buttonOkID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *listboxLadderSelect = NULL; -static GameWindow *listboxLadderDetails = NULL; -static GameWindow *staticTextLadderName = NULL; -static GameWindow *buttonOk = NULL; -static GameWindow *buttonCancel = NULL; +static GameWindow *parent = nullptr; +static GameWindow *listboxLadderSelect = nullptr; +static GameWindow *listboxLadderDetails = nullptr; +static GameWindow *staticTextLadderName = nullptr; +static GameWindow *buttonOk = nullptr; +static GameWindow *buttonCancel = nullptr; // password entry popup static NameKeyType passwordParentID = NAMEKEY_INVALID; static NameKeyType buttonPasswordOkID = NAMEKEY_INVALID; static NameKeyType buttonPasswordCancelID = NAMEKEY_INVALID; static NameKeyType textEntryPasswordID = NAMEKEY_INVALID; -static GameWindow *passwordParent = NULL; -static GameWindow *textEntryPassword = NULL; +static GameWindow *passwordParent = nullptr; +static GameWindow *textEntryPassword = nullptr; // incorrect password popup static NameKeyType badPasswordParentID = NAMEKEY_INVALID; static NameKeyType buttonBadPasswordOkID = NAMEKEY_INVALID; -static GameWindow *badPasswordParent = NULL; +static GameWindow *badPasswordParent = nullptr; static void updateLadderDetails( Int ladderID, GameWindow *staticTextLadderName, GameWindow *listboxLadderDetails ); @@ -218,7 +218,7 @@ static void setPasswordMode(PasswordMode mode) void PopupLadderSelectInit( WindowLayout *layout, void *userData ) { parentID = NAMEKEY("PopupLadderSelect.wnd:Parent"); - parent = TheWindowManager->winGetWindowFromId(NULL, parentID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); listboxLadderSelectID = NAMEKEY("PopupLadderSelect.wnd:ListBoxLadderSelect"); listboxLadderSelect = TheWindowManager->winGetWindowFromId(parent, listboxLadderSelectID); @@ -345,9 +345,9 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { - parent = NULL; - listboxLadderSelect = NULL; - listboxLadderDetails = NULL; + parent = nullptr; + listboxLadderSelect = nullptr; + listboxLadderDetails = nullptr; CustomMatchHideHostPopup(FALSE); break; } @@ -592,7 +592,7 @@ static void closeRightClickMenu(GameWindow *win) return; winLay->destroyWindows(); deleteInstance(winLay); - winLay = NULL; + winLay = nullptr; } } @@ -618,7 +618,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms case GGM_CLOSE: { closeRightClickMenu(window); - //rcMenu = NULL; + //rcMenu = nullptr; break; } @@ -660,9 +660,9 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms rcMenu->winSetUserData((void *)selectedID); TheWindowManager->winSetLoneWindow(rcMenu); - GameWindow *st = TheWindowManager->winGetWindowFromId(NULL, + GameWindow *st = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("PopupLadderDetails.wnd:StaticTextLadderName")); - GameWindow *lb = TheWindowManager->winGetWindowFromId(NULL, + GameWindow *lb = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("PopupLadderDetails.wnd:ListBoxLadderDetails")); updateLadderDetails(selectedID, st, lb); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 2b08e31bf43..dd99652757d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -74,15 +74,15 @@ static NameKeyType checkBoxAsianFontID = NAMEKEY_INVALID; static NameKeyType checkBoxNonAsianFontID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = NULL; -static GameWindow *listboxInfo = NULL; -static GameWindow *buttonClose = NULL; -static GameWindow *buttonBuddies = NULL; -//static GameWindow *buttonbuttonOptions = NULL; -static GameWindow *buttonSetLocale = NULL; -static GameWindow *buttonDeleteAccount = NULL; -static GameWindow *checkBoxAsianFont = NULL; -static GameWindow *checkBoxNonAsianFont = NULL; +static GameWindow *parent = nullptr; +static GameWindow *listboxInfo = nullptr; +static GameWindow *buttonClose = nullptr; +static GameWindow *buttonBuddies = nullptr; +//static GameWindow *buttonbuttonOptions = nullptr; +static GameWindow *buttonSetLocale = nullptr; +static GameWindow *buttonDeleteAccount = nullptr; +static GameWindow *checkBoxAsianFont = nullptr; +static GameWindow *checkBoxNonAsianFont = nullptr; static Bool isOverlayActive = false; static Bool raiseMessageBox = false; @@ -111,7 +111,7 @@ static const Image* lookupRankImage(AsciiString side, Int rank) return TheMappedImageCollection->findImageByName("NewPlayer"); if (rank < 0 || rank >= MAX_RANKS) - return NULL; + return nullptr; // dirty hack rather than try to get artists to follow a naming convention if (side == "America") @@ -275,7 +275,7 @@ RankPoints::RankPoints(void) #endif } -RankPoints *TheRankPointValues = NULL; +RankPoints *TheRankPointValues = nullptr; void SetLookAtPlayer( Int id, AsciiString nick) { @@ -337,116 +337,116 @@ void BattleHonorTooltip(GameWindow *window, if (BitIsSet(battleHonor, BATTLE_HONOR_NOT_GAINED)) { if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_3)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3Disabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3Disabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChinaDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChinaDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BATTLE_TANK)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTankDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTankDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_AIR_WING)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWingDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWingDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ENDURANCE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEnduranceDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEnduranceDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChinaDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChinaDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ10)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10Disabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10Disabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_FAIR_PLAY)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlayDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlayDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_APOCALYPSE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypseDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypseDisabled"), -1, nullptr, tooltipWidth ); /* else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSABDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSABDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSASDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSASDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAGDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAGDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaBDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaBDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaSDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaSDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaGDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaGDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLABDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLABDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLASDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLASDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAGDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAGDisabled"), -1, nullptr, tooltipWidth ); */ else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallengeDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallengeDisabled"), -1, nullptr, tooltipWidth ); } else { if(BitIsSet(battleHonor, BATTLE_HONOR_LADDER_CHAMP)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLadderChamp"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLadderChamp"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_3)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3"), -1, nullptr, tooltipWidth ); //else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_5)) - //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak5"), -1, NULL, tooltipWidth ); + //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak5"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_10)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_25)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChina"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChina"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BATTLE_TANK)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTank"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTank"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_AIR_WING)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWing"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWing"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ENDURANCE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEndurance"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEndurance"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChina"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChina"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ5)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz5"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz5"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ10)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_FAIR_PLAY)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlay"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlay"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_APOCALYPSE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypse"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypse"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_OFFICERSCLUB)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorOfficersClub"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorOfficersClub"), -1, nullptr, tooltipWidth ); /* else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAB"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAB"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAS"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAS"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_USA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAG"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloUSAG"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaB"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaB"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaS"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaS"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_CHINA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaG"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloChinaG"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_B)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAB"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAB"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_S)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAS"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAS"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_SOLO_GLA_G)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAG"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorSoloGLAG"), -1, nullptr, tooltipWidth ); */ else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallenge"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallenge"), -1, nullptr, tooltipWidth ); } } @@ -525,7 +525,7 @@ static void populateBattleHonors(const PSPlayerStats& stats, Int battleHonors, I } ResetBattleHonorInsertion(); - GadgetListBoxAddEntryImage(list, NULL, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 1; InsertBattleHonor(list, TheMappedImageCollection->findImageByName("FairPlay"), isFairPlayer, @@ -553,7 +553,7 @@ static void populateBattleHonors(const PSPlayerStats& stats, Int battleHonors, I InsertBattleHonor(list, TheMappedImageCollection->findImageByName("HonorBlitz10"), FALSE, BATTLE_HONOR_BLITZ10, row, column); } - GadgetListBoxAddEntryImage(list, NULL, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 3; UnicodeString uStr; @@ -791,9 +791,9 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) numGames = numWins + numLosses + numDiscons; - GameWindow *win = NULL; + GameWindow *win = nullptr; UnicodeString uStr; - win = findWindow(NULL, parentWindowName, "StaticTextPlayerStatisticsLabel"); + win = findWindow(nullptr, parentWindowName, "StaticTextPlayerStatisticsLabel"); if(win) { AsciiString localeID = "WOL:Locale00"; @@ -802,39 +802,39 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(TheGameText->fetch("GUI:PlayerStatistics"), lookAtPlayerName.c_str(), TheGameText->fetch(localeID).str()); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextGamesPlayedValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextGamesPlayedValue"); if(win) { uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextWinsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextWinsValue"); if(win) { uStr.format(L"%d", numWins); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextLossesValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextLossesValue"); if(win) { uStr.format(L"%d", numLosses); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextDisconnectsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextDisconnectsValue"); if(win) { uStr.format(L"%d", numDiscons); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBestStreakValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBestStreakValue"); if (win) { uStr.format(L"%d", stats.maxWinsInARow); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextStreak"); + win = findWindow(nullptr, parentWindowName, "StaticTextStreak"); if (win) { if (stats.lossesInARow > 0) @@ -846,7 +846,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, TheGameText->fetch("GUI:CurrentWinStreak")); } } - win = findWindow(NULL, parentWindowName, "StaticTextStreakValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextStreakValue"); if(win) { Int streak = max(stats.lossesInARow, stats.winsInARow); @@ -855,7 +855,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } AsciiString favoriteSide = "Random"; - win = findWindow(NULL, parentWindowName, "StaticTextFavoriteSideValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextFavoriteSideValue"); { Int numGames = 0; Int favorite = 0; @@ -886,7 +886,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } } - win = findWindow(NULL, parentWindowName, "StaticTextTotalKillsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalKillsValue"); if(win) { Int numGames = 0; @@ -897,7 +897,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextTotalDeathsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalDeathsValue"); if(win) { Int numGames = 0; @@ -908,7 +908,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextTotalBuiltValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalBuiltValue"); if(win) { Int numGames = 0; @@ -919,7 +919,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsKilledValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsKilledValue"); if(win) { Int numGames = 0; @@ -930,7 +930,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsLostValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsLostValue"); if(win) { Int numGames = 0; @@ -941,7 +941,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsBuiltValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsBuiltValue"); if(win) { Int numGames = 0; @@ -953,14 +953,14 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextWinPercentValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextWinPercentValue"); if(win) { uStr.format(TheGameText->fetch("GUI:WinPercent"), REAL_TO_INT(numWins/(Real)numGames*100.0f)); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "ProgressBarRank"); + win = findWindow(nullptr, parentWindowName, "ProgressBarRank"); if(win && TheRankPointValues) { if( currentRank == MAX_RANKS - 1) @@ -973,7 +973,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetProgressBarSetProgress(win, 100 * INT_TO_REAL(rankPoints - TheRankPointValues->m_ranks[currentRank])/( TheRankPointValues->m_ranks[currentRank + 1] - TheRankPointValues->m_ranks[currentRank])); } } - win = findWindow(NULL, parentWindowName, "WinRank"); + win = findWindow(nullptr, parentWindowName, "WinRank"); if(win && TheRankPointValues) { if (rankPoints == 0) @@ -981,7 +981,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) else win->winSetEnabledImage(0, lookupRankImage(favoriteSide, currentRank)); } - win = findWindow(NULL, parentWindowName, "StaticTextRank"); + win = findWindow(nullptr, parentWindowName, "StaticTextRank"); if(win) { AsciiString rankStr; @@ -989,7 +989,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, TheGameText->fetch(rankStr)); } - win = findWindow(NULL, parentWindowName, "StaticTextInProgress"); + win = findWindow(nullptr, parentWindowName, "StaticTextInProgress"); if (win) { if (weHaveStats) @@ -1003,7 +1003,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } } - win = findWindow(NULL, parentWindowName, "ListboxInfo"); + win = findWindow(nullptr, parentWindowName, "ListboxInfo"); if(win) { populateBattleHonors(stats, stats.battleHonors,stats.gamesInRowWithLastGeneral,stats.lastGeneral,stats.challengeMedals, win); @@ -1024,7 +1024,7 @@ void HandlePersistentStorageResponses( void ) case PSResponse::PSRESPONSE_COULDNOTCONNECT: { // message box & hide the window - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:PSCannotConnect"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:PSCannotConnect"), nullptr); GameSpyCloseOverlay(GSOVERLAY_PLAYERINFO); } break; @@ -1184,7 +1184,7 @@ void GameSpyPlayerInfoOverlayInit( WindowLayout *layout, void *userData ) checkBoxAsianFontID = TheNameKeyGenerator->nameToKey( "PopupPlayerInfo.wnd:CheckBoxAsianText" ); checkBoxNonAsianFontID = TheNameKeyGenerator->nameToKey( "PopupPlayerInfo.wnd:CheckBoxNonAsianText" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonClose = TheWindowManager->winGetWindowFromId( parent, buttonCloseID); buttonBuddies = TheWindowManager->winGetWindowFromId( parent, buttonBuddiesID); listboxInfo = TheWindowManager->winGetWindowFromId( parent, listboxInfoID); @@ -1255,7 +1255,7 @@ void GameSpyPlayerInfoOverlayShutdown( WindowLayout *layout, void *userData ) // hide menu layout->hide( TRUE ); - parent = NULL; + parent = nullptr; // our shutdown is complete isOverlayActive = false; @@ -1384,7 +1384,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne { RefreshGameListBoxes(); GameSpyCloseOverlay( GSOVERLAY_PLAYERINFO ); - MessageBoxYesNo(TheGameText->fetch("GUI:DeleteAccount"), TheGameText->fetch("GUI:AreYouSureDeleteAccount"),messageBoxYes, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:DeleteAccount"), TheGameText->fetch("GUI:AreYouSureDeleteAccount"),messageBoxYes, nullptr); } else if (controlID == checkBoxAsianFontID) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp index 8db407bc238..2c4ae8ac22c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp @@ -66,8 +66,8 @@ static NameKeyType buttonSaveKey = NAMEKEY_INVALID; static NameKeyType listboxGamesKey = NAMEKEY_INVALID; static NameKeyType textEntryReplayNameKey = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *replaySavedParent = NULL; +static GameWindow *parent = nullptr; +static GameWindow *replaySavedParent = nullptr; static time_t s_fileSavePopupStartTime = 0; static const time_t s_fileSavePopupDuration = 1000; @@ -83,7 +83,7 @@ extern std::string LastReplayFileName; //------------------------------------------------------------------------------------------------- void ShowReplaySavedPopup(Bool show) { - if (replaySavedParent != NULL) { + if (replaySavedParent != nullptr) { if (show) { replaySavedParent->winHide(FALSE); } else { @@ -118,13 +118,13 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplayMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType replaySavedParentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplaySaved"); - replaySavedParent = TheWindowManager->winGetWindowFromId( NULL, replaySavedParentID); - if (replaySavedParent == NULL) { - DEBUG_CRASH(("replaySavedParent == NULL")); + replaySavedParent = TheWindowManager->winGetWindowFromId( nullptr, replaySavedParentID); + if (replaySavedParent == nullptr) { + DEBUG_CRASH(("replaySavedParent == nullptr")); } ShowReplaySavedPopup(FALSE); @@ -134,8 +134,8 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) buttonFrame->winEnable( TRUE ); // get the listbox that will have the save games in it - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("PopupReplayInit - Unable to find games listbox") ); + GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplayInit - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -158,7 +158,7 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void PopupReplayShutdown( WindowLayout *layout, void *userData ) { - parent = NULL; + parent = nullptr; } @@ -238,7 +238,7 @@ static std::string replayPath; // ------------------------------------------------------------------------------------------------ /** Save the replay */ // ------------------------------------------------------------------------------------------------ -static GameWindow *messageBoxWin = NULL; +static GameWindow *messageBoxWin = nullptr; static void saveReplay( UnicodeString filename ) { AsciiString translated; @@ -256,10 +256,10 @@ static void saveReplay( UnicodeString filename ) fullPath.concat(TheRecorder->getReplayExtention()); replayPath = fullPath.str(); - messageBoxWin = NULL; + messageBoxWin = nullptr; if (TheLocalFileSystem->doesFileExist(fullPath.str())) { - messageBoxWin = MessageBoxOkCancel(TheGameText->fetch("GUI:OverwriteReplayTitle"), TheGameText->fetch("GUI:OverwriteReplay"), reallySaveReplay, NULL); + messageBoxWin = MessageBoxOkCancel(TheGameText->fetch("GUI:OverwriteReplayTitle"), TheGameText->fetch("GUI:OverwriteReplay"), reallySaveReplay, nullptr); } else { @@ -283,20 +283,20 @@ void reallySaveReplay(void) if(DeleteFile(filename.str()) == 0) { wchar_t buffer[1024]; - FormatMessageW ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); if(messageBoxWin) { TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = NULL; + messageBoxWin = nullptr; } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); // get the listbox that will have the save games in it GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("reallySaveReplay - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -308,22 +308,22 @@ void reallySaveReplay(void) if(CopyFile(oldFilename.str(),filename.str(), FALSE) == 0) { wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); if(messageBoxWin) { TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = NULL; + messageBoxWin = nullptr; } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); return; } // get the listbox that will have the save games in it GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("reallySaveReplay - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -375,7 +375,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("PopupReplaySystem - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplaySystem - Unable to find games listbox") ); // // handle games listbox, when certain items are selected in the listbox only some @@ -389,7 +389,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, UnicodeString filename; filename = GadgetListBoxGetText(listboxGames, rowSelected); GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != NULL, ("PopupReplaySystem - Unable to find text entry") ); + DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); GadgetTextEntrySetText(textEntryReplayName, filename); } } @@ -427,7 +427,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, { // get the filename, and see if we are overwriting GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != NULL, ("PopupReplaySystem - Unable to find text entry") ); + DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); UnicodeString filename = GadgetTextEntryGetText( textEntryReplayName ); if (filename.isEmpty()) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index 6d7c3e661e6..9a17f1d31cc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -75,15 +75,15 @@ static NameKeyType buttonSaveDescConfirm = NAMEKEY_INVALID; static NameKeyType buttonDeleteConfirm = NAMEKEY_INVALID; static NameKeyType buttonDeleteCancel = NAMEKEY_INVALID; -static GameWindow *buttonFrame = NULL; -static GameWindow *overwriteConfirm = NULL; -static GameWindow *loadConfirm = NULL; -static GameWindow *saveDesc = NULL; -static GameWindow *listboxGames = NULL; -static GameWindow *editDesc = NULL; -static GameWindow *deleteConfirm = NULL; - -static GameWindow *parent = NULL; +static GameWindow *buttonFrame = nullptr; +static GameWindow *overwriteConfirm = nullptr; +static GameWindow *loadConfirm = nullptr; +static GameWindow *saveDesc = nullptr; +static GameWindow *listboxGames = nullptr; +static GameWindow *editDesc = nullptr; +static GameWindow *deleteConfirm = nullptr; + +static GameWindow *parent = nullptr; static SaveLoadLayoutType currentLayoutType = SLLT_INVALID; static Bool isPopup = FALSE; static Int initialGadgetDelay = 2; @@ -101,7 +101,7 @@ static void updateMenuActions( void ) { // for loading only, disable the save button, otherwise enable it - GameWindow *saveButton = TheWindowManager->winGetWindowFromId( NULL, buttonSaveKey ); + GameWindow *saveButton = TheWindowManager->winGetWindowFromId( nullptr, buttonSaveKey ); DEBUG_ASSERTCRASH( saveButton, ("SaveLoadMenuInit: Unable to find save button") ); if( currentLayoutType == SLLT_LOAD_ONLY ) saveButton->winEnable( FALSE ); @@ -109,17 +109,17 @@ static void updateMenuActions( void ) saveButton->winEnable( TRUE ); // get the games listbox - //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); + //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); // if something with a game file is selected we can use load and delete Int selected; GadgetListBoxGetSelected( listboxGames, &selected ); AvailableGameInfo *selectedGameInfo; selectedGameInfo = (AvailableGameInfo *)GadgetListBoxGetItemData( listboxGames, selected ); - GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( NULL, buttonLoadKey ); - buttonLoad->winEnable( selectedGameInfo != NULL ); - GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( NULL, buttonDeleteKey ); - buttonDelete->winEnable( selectedGameInfo != NULL ); + GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( nullptr, buttonLoadKey ); + buttonLoad->winEnable( selectedGameInfo != nullptr ); + GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( nullptr, buttonDeleteKey ); + buttonDelete->winEnable( selectedGameInfo != nullptr ); } @@ -153,7 +153,7 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupSaveLoad.wnd:SaveLoadMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); TheWindowManager->winSetModal( parent ); @@ -171,8 +171,8 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); editDesc = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:EntryDesc" ) ); // get the listbox that will have the save games in it - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // populate the listbox with the save games on disk TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); @@ -215,7 +215,7 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("SaveLoad.wnd:SaveLoadMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); // TheWindowManager->winSetModal( parent ); @@ -234,8 +234,8 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) editDesc = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "SaveLoad.wnd:EntryDesc" ) ); deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "SaveLoad.wnd:DeleteConfirmParent" ) ); // get the listbox that will have the save games in it - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // populate the listbox with the save games on disk TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); @@ -357,7 +357,7 @@ static AvailableGameInfo *getSelectedSaveFileInfo( GameWindow *window ) // get the listbox //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // which item is selected Int selected; @@ -544,9 +544,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, { GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); - if (listboxGames != NULL) { + if (listboxGames != nullptr) { int rowSelected = mData2; GadgetListBoxSetSelected(listboxGames, rowSelected); @@ -564,7 +564,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // // handle games listbox, when certain items are selected in the listbox only some @@ -600,7 +600,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, AvailableGameInfo *selectedGameInfo = getSelectedSaveFileInfo( window ); // if there is no file info, this is a new game - if( selectedGameInfo == NULL ) + if( selectedGameInfo == nullptr ) { // show the save description window diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 3d756364282..2acd3f48f9d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -57,21 +57,21 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static WindowLayout *quitMenuLayout = NULL; -static WindowLayout *fullQuitMenuLayout = NULL; -static WindowLayout *noSaveLoadQuitMenuLayout = NULL; +static WindowLayout *quitMenuLayout = nullptr; +static WindowLayout *fullQuitMenuLayout = nullptr; +static WindowLayout *noSaveLoadQuitMenuLayout = nullptr; static Bool isVisible = FALSE; -static GameWindow *quitConfirmationWindow = NULL; +static GameWindow *quitConfirmationWindow = nullptr; //external declarations of the Gadgets the callbacks can use -static WindowLayout *saveLoadMenuLayout = NULL; +static WindowLayout *saveLoadMenuLayout = nullptr; -static GameWindow *buttonRestartWin = NULL; -static GameWindow *buttonSaveLoadWin = NULL; -static GameWindow *buttonOptionsWin = NULL; -static GameWindow *buttonExitWin = NULL; +static GameWindow *buttonRestartWin = nullptr; +static GameWindow *buttonSaveLoadWin = nullptr; +static GameWindow *buttonOptionsWin = nullptr; +static GameWindow *buttonExitWin = nullptr; static NameKeyType buttonExit = NAMEKEY_INVALID; static NameKeyType buttonRestart = NAMEKEY_INVALID; @@ -87,10 +87,10 @@ static void initGadgetsFullQuit( void ) buttonOptions = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonOptions" ); buttonSaveLoad = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonSaveLoad" ); - buttonRestartWin = TheWindowManager->winGetWindowFromId( NULL, buttonRestart ); - buttonSaveLoadWin = TheWindowManager->winGetWindowFromId( NULL, buttonSaveLoad ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( NULL, buttonOptions ); - buttonExitWin = TheWindowManager->winGetWindowFromId( NULL, buttonExit ); + buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); + buttonSaveLoadWin = TheWindowManager->winGetWindowFromId( nullptr, buttonSaveLoad ); + buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); + buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); } static void initGadgetsNoSaveQuit( void ) @@ -101,10 +101,10 @@ static void initGadgetsNoSaveQuit( void ) buttonOptions = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonOptions" ); buttonSaveLoad = NAMEKEY_INVALID; - buttonRestartWin = TheWindowManager->winGetWindowFromId( NULL, buttonRestart ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( NULL, buttonOptions ); - buttonSaveLoadWin = NULL; - buttonExitWin = TheWindowManager->winGetWindowFromId( NULL, buttonExit ); + buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); + buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); + buttonSaveLoadWin = nullptr; + buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); } @@ -113,20 +113,20 @@ static void initGadgetsNoSaveQuit( void ) void destroyQuitMenu() { // destroy the quit menu - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if(fullQuitMenuLayout) { fullQuitMenuLayout->destroyWindows(); deleteInstance(fullQuitMenuLayout); - fullQuitMenuLayout = NULL; + fullQuitMenuLayout = nullptr; } if(noSaveLoadQuitMenuLayout) { noSaveLoadQuitMenuLayout->destroyWindows(); deleteInstance(noSaveLoadQuitMenuLayout); - noSaveLoadQuitMenuLayout = NULL; + noSaveLoadQuitMenuLayout = nullptr; } - quitMenuLayout = NULL; + quitMenuLayout = nullptr; isVisible = FALSE; TheInGameUI->setQuitMenuVisible(FALSE); @@ -157,7 +157,7 @@ static void exitQuitMenu() } static void noExitQuitMenu() { - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; } static void quitToDesktopQuitMenu() @@ -245,7 +245,7 @@ static void restartMissionMenu() // InitGameLogicRandom(GameClientRandomValue(0, INT_MAX - 1)); } //TheTransitionHandler->remove("QuitFull"); //KRISMORNESS ADD - //quitMenuLayout = NULL; //KRISMORNESS ADD + //quitMenuLayout = nullptr; //KRISMORNESS ADD //isVisible = TRUE; //KRISMORNESS ADD //HideQuitMenu(); //KRISMORNESS ADD TheInGameUI->setClientQuiet( TRUE ); @@ -268,7 +268,7 @@ void HideQuitMenu( void ) isVisible = FALSE; if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if ( !TheGameLogic->isInMultiplayerGame() ) TheGameLogic->setGamePaused(FALSE); @@ -283,7 +283,7 @@ void ToggleQuitMenu() return; // BGC- If we are currently in the disconnect screen, don't let the quit menu come up. - if (TheDisconnectMenu != NULL) { + if (TheDisconnectMenu != nullptr) { if (TheDisconnectMenu->isScreenVisible() == TRUE) { return; } @@ -295,20 +295,20 @@ void ToggleQuitMenu() if (TheShell->getOptionsLayout(FALSE) != FALSE) { WindowLayout *optLayout = TheShell->getOptionsLayout(FALSE); GameWindow *optionsParent = optLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(optionsParent != NULL, ("Not able to get the options layout parent window")); + DEBUG_ASSERTCRASH(optionsParent != nullptr, ("Not able to get the options layout parent window")); GameWindow *optionsBack = TheWindowManager->winGetWindowFromId(optionsParent, TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(optionsBack != NULL, ("Not able to get the back button window from the options menu")); - TheWindowManager->winSendSystemMsg(optLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)optionsBack, NULL); + DEBUG_ASSERTCRASH(optionsBack != nullptr, ("Not able to get the back button window from the options menu")); + TheWindowManager->winSendSystemMsg(optLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)optionsBack, 0); return; } - if ((saveLoadMenuLayout != NULL) && (saveLoadMenuLayout->isHidden() == FALSE)) + if ((saveLoadMenuLayout != nullptr) && (saveLoadMenuLayout->isHidden() == FALSE)) { GameWindow *saveLoadParent = saveLoadMenuLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(saveLoadParent != NULL, ("Not able to get the save/load layout parent window")); + DEBUG_ASSERTCRASH(saveLoadParent != nullptr, ("Not able to get the save/load layout parent window")); GameWindow *saveLoadBack = TheWindowManager->winGetWindowFromId(saveLoadParent, TheNameKeyGenerator->nameToKey( "PopupSaveLoad.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(saveLoadBack != NULL, ("Not able to get the back button window from the save/load menu")); - TheWindowManager->winSendSystemMsg(saveLoadMenuLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)saveLoadBack, NULL); - saveLoadMenuLayout = NULL; + DEBUG_ASSERTCRASH(saveLoadBack != nullptr, ("Not able to get the back button window from the save/load menu")); + TheWindowManager->winSendSystemMsg(saveLoadMenuLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)saveLoadBack, 0); + saveLoadMenuLayout = nullptr; return; } @@ -320,7 +320,7 @@ void ToggleQuitMenu() if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if ( !TheGameLogic->isInMultiplayerGame() ) TheGameLogic->setGamePaused(FALSE); @@ -335,7 +335,7 @@ void ToggleQuitMenu() //else //{ // TheTransitionHandler->remove("QuitFull"); - // quitMenuLayout = NULL; + // quitMenuLayout = nullptr; // isVisible = TRUE; // HideQuitMenu(); //} @@ -369,7 +369,7 @@ void ToggleQuitMenu() } // load the quit menu from the layout file if needed - if( quitMenuLayout == NULL ) + if( quitMenuLayout == nullptr ) { DEBUG_ASSERTCRASH(FALSE, ("Could not load a quit menu layout")); isVisible = FALSE; @@ -427,7 +427,7 @@ void ToggleQuitMenu() if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; HideDiplomacy(); HideInGameChat(); TheControlBar->hidePurchaseScience(); @@ -511,7 +511,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, else if( buttonOptions == controlID ) { WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); - DEBUG_ASSERTCRASH(optLayout != NULL, ("options menu layout is NULL")); + DEBUG_ASSERTCRASH(optLayout != nullptr, ("options menu layout is null")); optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp index bbad3784ad9..899dc6e7172 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp @@ -66,18 +66,18 @@ static NameKeyType buttonCopyID = NAMEKEY_INVALID; static Bool isShuttingDown = false; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentReplayMenu = NULL; -static GameWindow *buttonLoad = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *listboxReplayFiles = NULL; -static GameWindow *buttonDelete = NULL; -static GameWindow *buttonCopy = NULL; +static GameWindow *parentReplayMenu = nullptr; +static GameWindow *buttonLoad = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *listboxReplayFiles = nullptr; +static GameWindow *buttonDelete = nullptr; +static GameWindow *buttonCopy = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; #if defined(RTS_DEBUG) -static GameWindow *buttonAnalyzeReplay = NULL; +static GameWindow *buttonAnalyzeReplay = nullptr; #endif void deleteReplay( void ); @@ -110,14 +110,14 @@ static Bool readReplayMapInfo(const AsciiString& filename, RecorderClass::Replay header.forPlayback = FALSE; header.filename = filename; - if (TheRecorder != NULL && TheRecorder->readReplayHeader(header)) + if (TheRecorder != nullptr && TheRecorder->readReplayHeader(header)) { if (ParseAsciiStringToGameInfo(&info, header.gameOptions)) { - if (TheMapCache != NULL) + if (TheMapCache != nullptr) mapData = TheMapCache->findMap(info.getMap()); else - mapData = NULL; + mapData = nullptr; return true; } @@ -193,7 +193,7 @@ static void showReplayTooltip(GameWindow* window, WinInstanceData* instData, Uns ReplayTooltipMap::const_iterator it = replayTooltipCache.find(replayFileName); if (it != replayTooltipCache.end()) - TheMouse->setCursorTooltip(it->second, -1, NULL, 1.5f); + TheMouse->setCursorTooltip(it->second, -1, nullptr, 1.5f); else TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); } @@ -310,7 +310,7 @@ void PopulateReplayFileListbox(GameWindow *listbox) Color color; Color mapColor; - const Bool hasMap = mapData != NULL; + const Bool hasMap = mapData != nullptr; const Bool isCrcCompatible = RecorderClass::replayMatchesGameVersion(header); @@ -380,7 +380,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) buttonDeleteID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonDeleteReplay" ); buttonCopyID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonCopyReplay" ); - parentReplayMenu = TheWindowManager->winGetWindowFromId( NULL, parentReplayMenuID ); + parentReplayMenu = TheWindowManager->winGetWindowFromId( nullptr, parentReplayMenuID ); buttonLoad = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonLoadID ); buttonBack = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonBackID ); listboxReplayFiles = TheWindowManager->winGetWindowFromId( parentReplayMenu, listboxReplayFilesID ); @@ -402,7 +402,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 4, 4, 180, 26, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif // show menu @@ -412,7 +412,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( parentReplayMenu ); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ReplayMenu.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ReplayMenu.wnd:GadgetParent")); if(win) win->winHide(TRUE); isShuttingDown = FALSE; @@ -525,7 +525,7 @@ void reallyLoadReplay(void) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } @@ -536,7 +536,7 @@ void reallyLoadReplay(void) TheRecorder->playbackFile(asciiFilename); - if(parentReplayMenu != NULL) + if(parentReplayMenu != nullptr) { parentReplayMenu->winHide(TRUE); } @@ -558,28 +558,28 @@ static void loadReplay(UnicodeString filename) UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFoundTitle", L"REPLAY NOT FOUND"); UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFound", L"This replay cannot be loaded because the file no longer exists on this device."); - MessageBoxOk(title, body, NULL); + MessageBoxOk(title, body, nullptr); } - else if(mapData == NULL) + else if(mapData == nullptr) { // TheSuperHackers @bugfix Prompts a message box when the map used by the replay was not found. UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFoundTitle", L"MAP NOT FOUND"); UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFound", L"This replay cannot be loaded because the map was not found on this device."); - MessageBoxOk(title, body, NULL); + MessageBoxOk(title, body, nullptr); } else if(!TheRecorder->replayMatchesGameVersion(header)) { // Pressing OK loads the replay. - MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"), reallyLoadReplay, NULL); + MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"), reallyLoadReplay, nullptr); } else { TheRecorder->playbackFile(asciiFilename); - if(parentReplayMenu != NULL) + if(parentReplayMenu != nullptr) { parentReplayMenu->winHide(TRUE); } @@ -657,7 +657,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(L"Blah Blah",L"Please select something munkee boy", NULL); + MessageBoxOk(L"Blah Blah",L"Please select something munkee boy", nullptr); break; } @@ -684,7 +684,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } @@ -705,11 +705,11 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:DeleteFile"), TheGameText->fetch("GUI:AreYouSureDelete"), deleteReplayFlag, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:DeleteFile"), TheGameText->fetch("GUI:AreYouSureDelete"), deleteReplayFlag, nullptr); } else if( controlID == buttonCopyID ) { @@ -717,11 +717,11 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, nullptr); } break; } @@ -740,7 +740,7 @@ void deleteReplay( void ) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } AsciiString filename, translate; @@ -750,11 +750,11 @@ void deleteReplay( void ) if(DeleteFile(filename.str()) == 0) { char buffer[1024]; - FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, sizeof(buffer), NULL); + FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, sizeof(buffer), nullptr); UnicodeString errorStr; translate.set(buffer); errorStr.translate(translate); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); } //Load the listbox shiznit GadgetListBoxReset(listboxReplayFiles); @@ -769,7 +769,7 @@ void copyReplay( void ) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } AsciiString filename, translate; @@ -779,7 +779,7 @@ void copyReplay( void ) char path[1024]; LPITEMIDLIST pidl; - SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &pidl); + SHGetSpecialFolderLocation(nullptr, CSIDL_DESKTOPDIRECTORY, &pidl); SHGetPathFromIDList(pidl,path); AsciiString newFilename; newFilename.set(path); @@ -788,11 +788,11 @@ void copyReplay( void ) if(CopyFile(filename.str(),newFilename.str(), FALSE) == 0) { wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 12f22f49c1f..bc466edec30 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -112,21 +112,21 @@ static NameKeyType buttonContinueID = NAMEKEY_INVALID; static NameKeyType buttonBuddiesID = NAMEKEY_INVALID; static NameKeyType buttonSaveReplayID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *buttonOk = NULL; -//static GameWindow *buttonRehost = NULL; -static GameWindow *buttonContinue = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *chatBoxBorder = NULL; -static GameWindow *buttonBuddies = NULL; -static GameWindow *staticTextGameSaved = NULL; +static GameWindow *parent = nullptr; +static GameWindow *buttonOk = nullptr; +//static GameWindow *buttonRehost = nullptr; +static GameWindow *buttonContinue = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *chatBoxBorder = nullptr; +static GameWindow *buttonBuddies = nullptr; +static GameWindow *staticTextGameSaved = nullptr; static Bool overidePlayerDisplayName = FALSE; //Extrenal declarations NameKeyType listboxChatWindowScoreScreenID = NAMEKEY_INVALID; -GameWindow *listboxChatWindowScoreScreen = NULL; +GameWindow *listboxChatWindowScoreScreen = nullptr; std::string LastReplayFileName; static Bool canSaveReplay = FALSE; extern void PopupReplayUpdate(WindowLayout *layout, void *userData); @@ -135,7 +135,7 @@ void initSinglePlayer( void ); void finishSinglePlayerInit( void ); static Bool s_needToFinishSinglePlayerInit = FALSE; static Bool buttonIsFinishCampaign = FALSE; -static WindowLayout *s_blankLayout = NULL; +static WindowLayout *s_blankLayout = nullptr; void initSkirmish( void ); void initLANMultiPlayer(void); @@ -191,20 +191,20 @@ void startNextCampaignGame(void) void ScoreScreenEnableControls(Bool enable) { // if we are using the button, do the enable thing. - if ((buttonOk != NULL) && (buttonOk->winIsHidden() == FALSE)) { + if ((buttonOk != nullptr) && (buttonOk->winIsHidden() == FALSE)) { buttonOk->winEnable(enable); } - if ((buttonContinue != NULL) && (buttonContinue->winIsHidden() == FALSE)) { + if ((buttonContinue != nullptr) && (buttonContinue->winIsHidden() == FALSE)) { buttonContinue->winEnable(enable); } - if ((buttonBuddies != NULL) && (buttonBuddies->winIsHidden() == FALSE)) { + if ((buttonBuddies != nullptr) && (buttonBuddies->winIsHidden() == FALSE)) { buttonBuddies->winEnable(enable); } GameWindow *buttonSaveReplay = TheWindowManager->winGetWindowFromId( parent, buttonSaveReplayID ); - if ((buttonSaveReplay != NULL) && (buttonSaveReplay->winIsHidden() == FALSE)) { + if ((buttonSaveReplay != nullptr) && (buttonSaveReplay->winIsHidden() == FALSE)) { if (!canSaveReplay) enable = FALSE; buttonSaveReplay->winEnable(enable); @@ -237,7 +237,7 @@ void ScoreScreenInit( WindowLayout *layout, void *userData ) buttonContinueID = TheNameKeyGenerator->nameToKey( "ScoreScreen.wnd:ButtonContinue" ); buttonSaveReplayID = TheNameKeyGenerator->nameToKey( "ScoreScreen.wnd:ButtonSaveReplay" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); textEntryChat = TheWindowManager->winGetWindowFromId( parent, textEntryChatID ); buttonEmote = TheWindowManager->winGetWindowFromId( parent,buttonEmoteID ); @@ -252,7 +252,7 @@ void ScoreScreenInit( WindowLayout *layout, void *userData ) staticTextGameSaved->winHide(TRUE); overidePlayerDisplayName = FALSE; WindowLayout *replayLayout = TheShell->getPopupReplayLayout(); - if (replayLayout != NULL) { + if (replayLayout != nullptr) { replayLayout->hide(TRUE); } canSaveReplay = FALSE; @@ -344,9 +344,9 @@ void ScoreScreenShutdown( WindowLayout *layout, void *userData ) void ScoreScreenUpdate( WindowLayout * layout, void *userData) { WindowLayout *popupReplayLayout = TheShell->getPopupReplayLayout(); - if (popupReplayLayout != NULL) { + if (popupReplayLayout != nullptr) { if (popupReplayLayout->isHidden() == FALSE) { - PopupReplayUpdate(popupReplayLayout, NULL); + PopupReplayUpdate(popupReplayLayout, nullptr); } } @@ -520,7 +520,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, if( controlID == TheNameKeyGenerator->nameToKey(name)) { Bool notBuddy = TRUE; - Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(NULL,controlID)); + Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(nullptr,controlID)); // request to add a buddy BuddyInfoMap *buddies = TheGameSpyInfo->getBuddyMap(); BuddyInfoMap::iterator bIt; @@ -610,25 +610,25 @@ void initSkirmish( void ) void PlayMovieAndBlock(AsciiString movieTitle) { VideoStreamInterface *videoStream = TheVideoPlayer->open( movieTitle ); - if ( videoStream == NULL ) + if ( videoStream == nullptr ) { return; } // Create the new buffer VideoBuffer *videoBuffer = TheDisplay->createVideoBuffer(); - if ( videoBuffer == NULL || + if ( videoBuffer == nullptr || !videoBuffer->allocate( videoStream->width(), videoStream->height()) ) { delete videoBuffer; - videoBuffer = NULL; + videoBuffer = nullptr; if ( videoStream ) { videoStream->close(); - videoStream = NULL; + videoStream = nullptr; } return; @@ -673,15 +673,15 @@ void PlayMovieAndBlock(AsciiString movieTitle) TheDisplay->draw(); } TheWritableGlobalData->m_loadScreenRender = FALSE; - movieWindow->winGetInstanceData()->setVideoBuffer(NULL); + movieWindow->winGetInstanceData()->setVideoBuffer(nullptr); delete videoBuffer; - videoBuffer = NULL; + videoBuffer = nullptr; if (videoStream) { videoStream->close(); - videoStream = NULL; + videoStream = nullptr; } setFPMode(); @@ -781,7 +781,7 @@ void finishSinglePlayerInit( void ) { s_blankLayout->destroyWindows(); deleteInstance(s_blankLayout); - s_blankLayout = NULL; + s_blankLayout = nullptr; } // set keyboard focus to main parent @@ -1337,7 +1337,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // win->winHide(TRUE); // const PlayerTemplate *fact = player->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { win->winSetEnabledImage(0, fact->getSideIconImage()); } @@ -1869,11 +1869,11 @@ void grabSinglePlayerInfo( void ) ++playerCount; break; } - localPlayer = NULL; + localPlayer = nullptr; } } PlayerTemplate const *fact = ThePlayerList->getLocalPlayer()->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen()); if(image) @@ -1922,7 +1922,7 @@ void grabSinglePlayerInfo( void ) sg.m_totalUnitsBuilt = 0; sg.m_totalUnitsDestroyed = 0; sg.m_totalUnitsLost = 0; - sg.m_sideImage = NULL; + sg.m_sideImage = nullptr; Bool populate = FALSE; Color color; for(Int i = 0; i < MAX_PLAYER_COUNT; ++i) @@ -2140,7 +2140,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", i); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); const PlayerTemplate *fact = player->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { win->winSetEnabledImage(0, fact->getSideIconImage()); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp index 50789948919..b9bc05763f5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -70,19 +70,19 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType buttonNewID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonNew" ); - GameWindow *buttonNew = TheWindowManager->winGetWindowFromId( NULL, buttonNewID ); + GameWindow *buttonNew = TheWindowManager->winGetWindowFromId( nullptr, buttonNewID ); TheShell->registerWithAnimateManager(buttonNew, WIN_ANIMATION_SLIDE_LEFT, TRUE,1); NameKeyType buttonLoadID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonLoad" ); - GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( NULL, buttonLoadID ); + GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( nullptr, buttonLoadID ); TheShell->registerWithAnimateManager(buttonLoad, WIN_ANIMATION_SLIDE_LEFT, TRUE,200); NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID ); + GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,1); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 4386c5fd91c..c14bf51feab 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -69,7 +69,7 @@ #include "WWDownload/Registry.h" -SkirmishGameInfo *TheSkirmishGameInfo = NULL; +SkirmishGameInfo *TheSkirmishGameInfo = nullptr; // window ids ------------------------------------------------------------------------------ static NameKeyType parentSkirmishGameOptionsID = NAMEKEY_INVALID; @@ -113,35 +113,29 @@ static NameKeyType windowMapID = NAMEKEY_INVALID; static NameKeyType sliderGameSpeedID = NAMEKEY_INVALID; static NameKeyType staticTextGameSpeedID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *staticTextGameSpeed = NULL; -static GameWindow *parentSkirmishGameOptions = NULL; -static GameWindow *buttonExit = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *buttonReset = NULL; -static GameWindow *windowMap = NULL; -static GameWindow *textEntryPlayerName = NULL; -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *staticTextGameSpeed = nullptr; +static GameWindow *parentSkirmishGameOptions = nullptr; +static GameWindow *buttonExit = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *buttonReset = nullptr; +static GameWindow *windowMap = nullptr; +static GameWindow *textEntryPlayerName = nullptr; +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; //external declarations of the Gadgets the callbacks can use -WindowLayout *skirmishMapSelectLayout = NULL; +WindowLayout *skirmishMapSelectLayout = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; @@ -322,7 +316,7 @@ Money SkirmishPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } @@ -510,7 +504,7 @@ static void startPressed(void) if (it == TheMapCache->end()) { buttonPushed = FALSE; - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:CantFindMap"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:CantFindMap"), nullptr); } MapMetaData mmd = it->second; if(playerCount > mmd.m_numPlayers) @@ -518,13 +512,13 @@ static void startPressed(void) buttonPushed = FALSE; UnicodeString msg; msg.format(TheGameText->fetch("GUI:TooManyPlayers"), mmd.m_numPlayers); - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), msg, nullptr); } /* else if (playerCount < 2 && !sandboxOk) { sandboxOk = TRUE; - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:SandboxWarning"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:SandboxWarning"), nullptr); } */ else @@ -568,7 +562,7 @@ void MapSelectorTooltip(GameWindow *window, if ((x > (pixelX + it->x) && x < (pixelX + it->x + SUPPLY_TECH_SIZE)) && ( y > (pixelY + it->y) && y < (pixelY + it->y + SUPPLY_TECH_SIZE))) { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:TechBuilding"), -1, NULL); //, 1.5f + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:TechBuilding"), -1, nullptr); //, 1.5f return; } it++; @@ -583,7 +577,7 @@ void MapSelectorTooltip(GameWindow *window, if ((x > (pixelX + it2->x) && x < (pixelX + it2->x + SUPPLY_TECH_SIZE)) && ( y > (pixelY + it2->y) && y < (pixelY + it2->y + SUPPLY_TECH_SIZE))) { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:SupplyDock"), -1, NULL); // , 1.5f + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:SupplyDock"), -1, nullptr); // , 1.5f break; } it2++; @@ -652,9 +646,9 @@ void positionAdditionalImages( MapMetaData *mmd, GameWindow *mapWindow, Bool for if( !mmd || !mapWindow || mapWindow->winIsHidden()) return; - static MapMetaData *prevMMD = NULL; + static MapMetaData *prevMMD = nullptr; if(force) - prevMMD = NULL; + prevMMD = nullptr; // we already populated the supply and tech image locations. if(mmd == prevMMD) return; @@ -714,9 +708,9 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition std::map::iterator it = TheMapCache->find(lowerMap); if (it == TheMapCache->end()) { - mapWindow->winSetUserData(NULL); + mapWindow->winSetUserData(nullptr); - static const Image *unknownImage = NULL; + static const Image *unknownImage = nullptr; if (!unknownImage) unknownImage = TheMappedImageCollection->findImageByName("UnknownMap"); if (unknownImage) @@ -729,10 +723,10 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition mapWindow->winClearStatus(WIN_STATUS_IMAGE); } - positionAdditionalImages(NULL, mapWindow, TRUE); + positionAdditionalImages(nullptr, mapWindow, TRUE); for (Int i = 0; i < MAX_SLOTS; ++i) { - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -743,7 +737,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition MapMetaData mmd = it->second; Image *image = getMapPreviewImage(mapName); - if (mapWindow != NULL) { + if (mapWindow != nullptr) { mapWindow->winSetUserData((void *)TheMapCache->findMap(mapName)); if(image) { @@ -752,7 +746,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition } else { - static const Image *unknownImage = NULL; + static const Image *unknownImage = nullptr; if (!unknownImage) unknownImage = TheMappedImageCollection->findImageByName("UnknownMap"); if (unknownImage) @@ -779,7 +773,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition { Coord3D *pos = &wmIt->second; positionStartSpotControls(buttonMapStartPositions[i], mapWindow,pos, &mmd, buttonMapStartPositions); - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(FALSE); } @@ -792,7 +786,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition // hide the rest for (; i < MAX_SLOTS; ++i) { - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -828,7 +822,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ { for (Int i = 0; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] != NULL ) + if ( buttonMapStartPositions[i] != nullptr ) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -840,7 +834,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ Int i = 0; for(; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] != NULL ) + if ( buttonMapStartPositions[i] != nullptr ) { GadgetButtonSetText(buttonMapStartPositions[i], UnicodeString::TheEmptyString); if (!onLoadScreen) @@ -851,7 +845,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ } for( i = 0; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] == NULL ) + if ( buttonMapStartPositions[i] == nullptr ) continue; GameSlot *gs =myGame->getSlot(i); @@ -1033,7 +1027,7 @@ void InitSkirmishGameGadgets( void ) windowMapID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:MapWindow" ); staticTextGameSpeedID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:StaticTextGameSpeed" ); // Initialize the pointers to our gadgets - parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentSkirmishGameOptionsID ); + parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( nullptr, parentSkirmishGameOptionsID ); DEBUG_ASSERTCRASH(parentSkirmishGameOptions, ("Could not find the parentSkirmishGameOptions" )); buttonSelectMap = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions,buttonSelectMapID ); DEBUG_ASSERTCRASH(buttonSelectMap, ("Could not find the buttonSelectMap")); @@ -1049,7 +1043,7 @@ void InitSkirmishGameGadgets( void ) DEBUG_ASSERTCRASH(staticTextGameSpeed, ("Could not find the staticTextGameSpeed")); textEntryPlayerNameID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:TextEntryPlayerName" ); - textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID ); + textEntryPlayerName = TheWindowManager->winGetWindowFromId( nullptr, textEntryPlayerNameID ); DEBUG_ASSERTCRASH(textEntryPlayerName, ("Could not find the textEntryPlayerName" )); windowMap = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions,windowMapID ); @@ -1150,7 +1144,7 @@ void skirmishUpdateSlotList( void ) GadgetTextEntrySetText( textEntryPlayerName, TheSkirmishGameInfo->getSlot(0)->getName() ); UpdateSlotList( TheSkirmishGameInfo, comboBoxPlayer, comboBoxColor, comboBoxPlayerTemplate, - comboBoxTeam, NULL, buttonStart, buttonMapStartPosition ); + comboBoxTeam, nullptr, buttonStart, buttonMapStartPosition ); updateMapStartSpots(TheSkirmishGameInfo, buttonMapStartPosition, FALSE); doUpdateSlotList = TRUE; } @@ -1179,7 +1173,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -1187,7 +1181,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; //------------------------------------------------------------------------------------------------- @@ -1345,7 +1339,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) skirmishUpdateSlotList(); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:SubParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:SubParent")); if(win) win->winHide(TRUE); buttonPushed = FALSE; @@ -1364,14 +1358,14 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete // what the munkees does this do? - //TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + //TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - //if (LANnextScreen != NULL) + //if (LANnextScreen != nullptr) //{ // TheShell->push(LANnextScreen); //} - //LANnextScreen = NULL; + //LANnextScreen = nullptr; } @@ -1383,7 +1377,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) SignalUIInteraction(SHELL_SCRIPT_HOOK_SKIRMISH_CLOSED); TheMouse->setCursor(Mouse::ARROW); - TheMouse->setMouseText(UnicodeString::TheEmptyString,NULL,NULL); + TheMouse->setMouseText(UnicodeString::TheEmptyString,nullptr,nullptr); // if we are shutting down for an immediate pop, skip the animations Bool popImmediate = *(Bool *)userData; if( popImmediate ) @@ -1489,7 +1483,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1559,11 +1553,11 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } TheShell->pop(); delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } // else if ( controlID == buttonResetFPSID ) @@ -1699,7 +1693,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned void populateSkirmishBattleHonors(void) { - GameWindow *list = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:ListboxInfo")); + GameWindow *list = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:ListboxInfo")); if (!list) return; @@ -1713,25 +1707,25 @@ void populateSkirmishBattleHonors(void) //Int challenge = stats.getChallengeMedals(); UnicodeString uStr; - GameWindow *streakWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextStreakValue") ); + GameWindow *streakWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextStreakValue") ); if (streakWindow) { uStr.format(L"%d", stats.getWinStreak()); GadgetStaticTextSetText(streakWindow, uStr); } - GameWindow *bestStreakWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextBestStreakValue") ); + GameWindow *bestStreakWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextBestStreakValue") ); if (bestStreakWindow) { uStr.format(L"%d", stats.getBestWinStreak()); GadgetStaticTextSetText(bestStreakWindow, uStr); } - GameWindow *winsWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextWinsValue") ); + GameWindow *winsWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextWinsValue") ); if (winsWindow) { uStr.format(L"%d", stats.getWins()); GadgetStaticTextSetText(winsWindow, uStr); } - GameWindow *lossesWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextLossesValue") ); + GameWindow *lossesWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextLossesValue") ); if (lossesWindow) { uStr.format(L"%d", stats.getLosses()); @@ -1739,7 +1733,7 @@ void populateSkirmishBattleHonors(void) } ResetBattleHonorInsertion(); - GadgetListBoxAddEntryImage(list, NULL, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 1; InsertBattleHonor(list, TheMappedImageCollection->findImageByName("HonorCampaignChina"), (honors & BATTLE_HONOR_CAMPAIGN_CHINA), BATTLE_HONOR_CAMPAIGN_CHINA, row, column); @@ -1752,7 +1746,7 @@ void populateSkirmishBattleHonors(void) BATTLE_HONOR_AIR_WING, row, column); InsertBattleHonor(list, TheMappedImageCollection->findImageByName("HonorBattleTank"), (honors & BATTLE_HONOR_BATTLE_TANK), BATTLE_HONOR_BATTLE_TANK, row, column); - GadgetListBoxAddEntryImage(list, NULL, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 3; // endurance medals MapCache::const_iterator it; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 805f8415cf1..d6134233b48 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -49,34 +49,33 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *mapList = NULL; +static GameWindow *parent = nullptr; +static GameWindow *mapList = nullptr; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *winMapPreview = NULL; +static GameWindow *winMapPreview = nullptr; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; static void NullifyControls() { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; inameToKey( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!parent) return; @@ -249,7 +248,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -525,7 +524,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } skirmishPositionStartSpots(); @@ -591,7 +590,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } //TheShell->pop(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index afba8a27e04..59f7ba76f0e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -77,26 +77,26 @@ static NameKeyType buttonNotificationID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = NULL; -static GameWindow *buttonHide = NULL; -static GameWindow *buttonAddBuddy = NULL; -static GameWindow *buttonDeleteBuddy = NULL; -static GameWindow *textEntry = NULL; -static GameWindow *listboxBuddy = NULL; -static GameWindow *listboxChat = NULL; -static GameWindow *buttonAcceptBuddy = NULL; -static GameWindow *buttonDenyBuddy = NULL; -static GameWindow *radioButtonBuddies = NULL; -static GameWindow *radioButtonIgnore = NULL; -static GameWindow *parentBuddies = NULL; -static GameWindow *parentIgnore = NULL; -static GameWindow *listboxIgnore = NULL; +static GameWindow *parent = nullptr; +static GameWindow *buttonHide = nullptr; +static GameWindow *buttonAddBuddy = nullptr; +static GameWindow *buttonDeleteBuddy = nullptr; +static GameWindow *textEntry = nullptr; +static GameWindow *listboxBuddy = nullptr; +static GameWindow *listboxChat = nullptr; +static GameWindow *buttonAcceptBuddy = nullptr; +static GameWindow *buttonDenyBuddy = nullptr; +static GameWindow *radioButtonBuddies = nullptr; +static GameWindow *radioButtonIgnore = nullptr; +static GameWindow *parentBuddies = nullptr; +static GameWindow *parentIgnore = nullptr; +static GameWindow *listboxIgnore = nullptr; static Bool isOverlayActive = false; void insertChat( BuddyMessage msg ); // RightClick pointers --------------------------------------------------------------------- -static GameWindow *rcMenu = NULL; -static WindowLayout *noticeLayout = NULL; +static GameWindow *rcMenu = nullptr; +static WindowLayout *noticeLayout = nullptr; static UnsignedInt noticeExpires = 0; enum { NOTIFICATION_EXPIRES = 3000 }; @@ -125,11 +125,11 @@ class BuddyControls static BuddyControls buddyControls; BuddyControls::BuddyControls( void ) { - listboxChat = NULL; + listboxChat = nullptr; listboxChatID = NAMEKEY_INVALID; - listboxBuddies = NULL; + listboxBuddies = nullptr; listboxBuddiesID = NAMEKEY_INVALID; - textEntryEdit = NULL; + textEntryEdit = nullptr; textEntryEditID = NAMEKEY_INVALID; isInit = FALSE; } @@ -147,41 +147,41 @@ void InitBuddyControls(Int type) if(!TheGameSpyInfo) { buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = NULL; + buddyControls.textEntryEdit = nullptr; buddyControls.listboxBuddiesID = NAMEKEY_INVALID; buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = NULL; - buddyControls.listboxChat = NULL; + buddyControls.listboxBuddies = nullptr; + buddyControls.listboxChat = nullptr; buddyControls.isInit = FALSE; return; } switch (type) { case BUDDY_RESETALL_CRAP: buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = NULL; + buddyControls.textEntryEdit = nullptr; buddyControls.listboxBuddiesID = NAMEKEY_INVALID; buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = NULL; - buddyControls.listboxChat = NULL; + buddyControls.listboxBuddies = nullptr; + buddyControls.listboxChat = nullptr; buddyControls.isInit = FALSE; break; case BUDDY_WINDOW_BUDDIES: buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(NULL, buddyControls.textEntryEditID); + buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddies" ); buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxChatID); + buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); + buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); buddyControls.isInit = TRUE; break; case BUDDY_WINDOW_DIPLOMACY: buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(NULL, buddyControls.textEntryEditID); + buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddies" ); buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxChatID); + buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); + buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); buddyControls.isInit = TRUE; break; @@ -311,7 +311,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, // save message for future incarnations of the buddy window BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); BuddyMessage message; - message.m_timestamp = time(NULL); + message.m_timestamp = time(nullptr); message.m_senderID = TheGameSpyInfo->getLocalProfileID(); message.m_senderNick = TheGameSpyInfo->getLocalBaseName(); message.m_recipientID = selectedProfile; @@ -652,7 +652,7 @@ void showNotificationBox( AsciiString nick, UnicodeString message) { buttonNotificationID = TheNameKeyGenerator->nameToKey("PopupBuddyListNotification.wnd:ButtonNotification"); } - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,buttonNotificationID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,buttonNotificationID); if(!win) { deleteNotificationBox(); @@ -688,7 +688,7 @@ void deleteNotificationBox( void ) { noticeLayout->destroyWindows(); deleteInstance(noticeLayout); - noticeLayout = NULL; + noticeLayout = nullptr; } } @@ -724,7 +724,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) listboxIgnoreID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxIgnore" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonHide = TheWindowManager->winGetWindowFromId( parent, buttonHideID); buttonAddBuddy = TheWindowManager->winGetWindowFromId( parent, buttonAddBuddyID); buttonDeleteBuddy = TheWindowManager->winGetWindowFromId( parent, buttonDeleteBuddyID); @@ -765,7 +765,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData ) { - listboxIgnore = NULL; + listboxIgnore = nullptr; // hide menu layout->hide( TRUE ); @@ -1140,7 +1140,7 @@ static NameKeyType buttonPlayID = NAMEKEY_INVALID; static NameKeyType buttonIgnoreID = NAMEKEY_INVALID; static NameKeyType buttonStatsID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -//static GameWindow *rCparent = NULL; +//static GameWindow *rCparent = nullptr; //------------------------------------------------------------------------------------------------- @@ -1170,7 +1170,7 @@ static void closeRightClickMenu(GameWindow *win) return; winLay->destroyWindows(); deleteInstance(winLay); - winLay = NULL; + winLay = nullptr; } } @@ -1198,7 +1198,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) // save message for future incarnations of the buddy window BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); BuddyMessage message; - message.m_timestamp = time(NULL); + message.m_timestamp = time(nullptr); message.m_senderID = 0; message.m_senderNick = ""; message.m_recipientID = TheGameSpyInfo->getLocalProfileID(); @@ -1239,14 +1239,14 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn case GWM_DESTROY: { - rcMenu = NULL; + rcMenu = nullptr; break; } case GGM_CLOSE: { closeRightClickMenu(window); - //rcMenu = NULL; + //rcMenu = nullptr; break; } @@ -1270,9 +1270,9 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn isRequest = TRUE; delete rcData; - rcData = NULL; + rcData = nullptr; - window->winSetUserData(NULL); + window->winSetUserData(nullptr); //DEBUG_ASSERTCRASH(profileID > 0, ("Bad profile ID in user data!")); if( controlID == buttonAddID ) @@ -1425,7 +1425,7 @@ void refreshIgnoreList( void ) UnicodeString name; name.translate(aName); Int pos = GadgetListBoxAddEntryText(listboxIgnore, name, GameMakeColor(255,100,100,255),-1); - GadgetListBoxSetItemData(listboxIgnore, 0,pos ); + GadgetListBoxSetItemData(listboxIgnore, nullptr,pos ); ++iListIt; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp index 5767ddfa139..aef620ff9d1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp @@ -54,9 +54,9 @@ static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; static NameKeyType buttonLobbyID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLCustomScore = NULL; -static GameWindow *buttonDisconnect = NULL; -static GameWindow *buttonLobby = NULL; +static GameWindow *parentWOLCustomScore = nullptr; +static GameWindow *buttonDisconnect = nullptr; +static GameWindow *buttonLobby = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -66,9 +66,9 @@ void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData ) parentWOLCustomScoreID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:WOLCustomScoreScreenParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonDisconnect" ); buttonLobbyID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonLobby" ); - parentWOLCustomScore = TheWindowManager->winGetWindowFromId( NULL, parentWOLCustomScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); - buttonLobby = TheWindowManager->winGetWindowFromId( NULL, buttonLobbyID); + parentWOLCustomScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLCustomScoreID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); + buttonLobby = TheWindowManager->winGetWindowFromId( nullptr, buttonLobbyID); /* if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index 8c5ec5718c5..9a1e3dd4bf8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -85,7 +85,7 @@ void slotListDebugLog(const char *fmt, ...) { UnicodeString msg; msg.translate(buf); - TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], nullptr); } } #define SLOTLIST_DEBUG_LOG(x) slotListDebugLog x @@ -132,7 +132,7 @@ void SendStatsToOtherPlayers(const GameInfo *game) // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static Bool launchGameNext = FALSE; @@ -192,49 +192,40 @@ static NameKeyType windowMapID = NAMEKEY_INVALID; static NameKeyType windowMapSelectMapID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLGameSetup = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *windowMap = NULL; - -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *staticTextPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *buttonAccept[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *parentWOLGameSetup = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *windowMap = nullptr; + +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; +static GameWindow *staticTextPlayer[MAX_SLOTS] = {0}; +static GameWindow *buttonAccept[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; -static GameWindow *genericPingWindow[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *genericPingWindow[MAX_SLOTS] = {0}; -static const Image *pingImages[3] = { NULL, NULL, NULL }; +static const Image *pingImages[3] = { nullptr, nullptr, nullptr }; -WindowLayout *WOLMapSelectLayout = NULL; +WindowLayout *WOLMapSelectLayout = nullptr; void PopBackToLobby( void ) { // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; if (TheGameSpyInfo) // this can be blown away by a disconnect on the map transfer screen { @@ -258,14 +249,14 @@ void WOLPositionStartSpots( void ) { GameWindow *win = windowMap; - if (WOLMapSelectLayout != NULL) { - win = TheWindowManager->winGetWindowFromId(NULL, windowMapSelectMapID); + if (WOLMapSelectLayout != nullptr) { + win = TheWindowManager->winGetWindowFromId(nullptr, windowMapSelectMapID); // get the controls. NameKeyType listboxMapID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ListboxMap" ); - GameWindow *listboxMap = TheWindowManager->winGetWindowFromId( NULL, listboxMapID ); + GameWindow *listboxMap = TheWindowManager->winGetWindowFromId( nullptr, listboxMapID ); - if (listboxMap != NULL) { + if (listboxMap != nullptr) { Int selected; UnicodeString map; @@ -294,7 +285,7 @@ void WOLPositionStartSpots( void ) } } else { - DEBUG_ASSERTCRASH(win != NULL, ("no map preview window")); + DEBUG_ASSERTCRASH(win != nullptr, ("no map preview window")); positionStartSpots( TheGameSpyInfo->getCurrentStagingRoom(), buttonMapStartPosition, win); } } @@ -339,21 +330,21 @@ static void playerTooltip(GameWindow *window, } if (slotIdx < 0) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } GameSpyStagingRoom *game = TheGameSpyInfo->getCurrentStagingRoom(); if (!game) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } GameSpyGameSlot *slot = game->getGameSpySlot(slotIdx); if (!slot || !slot->isHuman()) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } @@ -373,7 +364,7 @@ static void playerTooltip(GameWindow *window, PlayerInfoMap::iterator pmIt = TheGameSpyInfo->getPlayerInfoMap()->find(aName); if (pmIt == TheGameSpyInfo->getPlayerInfoMap()->end()) { - TheMouse->setCursorTooltip( uName, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( uName, -1, nullptr, 1.5f ); return; } Int profileID = pmIt->second.m_profileID; @@ -381,7 +372,7 @@ static void playerTooltip(GameWindow *window, PSPlayerStats stats = TheGameSpyPSMessageQueue->findPlayerStatsByID(profileID); if (stats.id == 0) { - TheMouse->setCursorTooltip( uName, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( uName, -1, nullptr, 1.5f ); return; } @@ -472,7 +463,7 @@ static void playerTooltip(GameWindow *window, tooltip.concat(playerInfo); - TheMouse->setCursorTooltip( tooltip, -1, NULL, 1.5f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( tooltip, -1, nullptr, 1.5f ); // the text and width are the only params used. the others are the default values. } void gameAcceptTooltip(GameWindow *window, WinInstanceData *instData, UnsignedInt mouse) @@ -489,7 +480,7 @@ void gameAcceptTooltip(GameWindow *window, WinInstanceData *instData, UnsignedIn if ((x > winPosX && x < (winPosX + winWidth)) && (y > winPosY && y < (winPosY + winHeight))) { - TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:GameAcceptance"), -1, NULL); + TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:GameAcceptance"), -1, nullptr); } } @@ -508,12 +499,12 @@ void pingTooltip(GameWindow *window, WinInstanceData *instData, UnsignedInt mous if ((x > winPosX && x < (winPosX + winWidth)) && (y > winPosY && y < (winPosY + winHeight))) { - TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:ConnectionSpeed"), -1, NULL); + TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:ConnectionSpeed"), -1, nullptr); } } //external declarations of the Gadgets the callbacks can use -GameWindow *listboxGameSetupChat = NULL; +GameWindow *listboxGameSetupChat = nullptr; NameKeyType listboxGameSetupChatID = NAMEKEY_INVALID; static void handleColorSelection(int index) @@ -875,7 +866,7 @@ static void StartPressed(void) // we've started, there's no going back // i.e. disable the back button. buttonBack->winEnable(FALSE); - GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); + GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -905,7 +896,7 @@ void WOLDisplayGameOptions( void ) if (!parentWOLGameSetup || !theGame) return; - const GameSlot *localSlot = NULL; + const GameSlot *localSlot = nullptr; if (theGame->getLocalSlotNum() >= 0) localSlot = theGame->getConstSlot(theGame->getLocalSlotNum()); @@ -1013,7 +1004,7 @@ void InitWOLGameGadgets( void ) NameKeyType staticTextTitleID = NAMEKEY("GameSpyGameOptionsMenu.wnd:StaticTextGameName"); // Initialize the pointers to our gadgets - parentWOLGameSetup = TheWindowManager->winGetWindowFromId( NULL, parentWOLGameSetupID ); + parentWOLGameSetup = TheWindowManager->winGetWindowFromId( nullptr, parentWOLGameSetupID ); buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); buttonStart = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonStartID ); @@ -1115,7 +1106,7 @@ void InitWOLGameGadgets( void ) if( buttonAccept[0] ) buttonAccept[0]->winEnable(TRUE); - if (buttonBack != NULL) + if (buttonBack != nullptr) { buttonBack->winEnable(TRUE); } @@ -1124,31 +1115,31 @@ void InitWOLGameGadgets( void ) void DeinitWOLGameGadgets( void ) { - parentWOLGameSetup = NULL; - buttonEmote = NULL; - buttonSelectMap = NULL; - buttonStart = NULL; - buttonBack = NULL; - listboxGameSetupChat = NULL; - textEntryChat = NULL; - textEntryMapDisplay = NULL; + parentWOLGameSetup = nullptr; + buttonEmote = nullptr; + buttonSelectMap = nullptr; + buttonStart = nullptr; + buttonBack = nullptr; + listboxGameSetupChat = nullptr; + textEntryChat = nullptr; + textEntryMapDisplay = nullptr; if (windowMap) { - windowMap->winSetUserData(NULL); - windowMap = NULL; + windowMap->winSetUserData(nullptr); + windowMap = nullptr; } -// GameWindow *staticTextTitle = NULL; +// GameWindow *staticTextTitle = nullptr; for (Int i = 0; i < MAX_SLOTS; i++) { - comboBoxPlayer[i] = NULL; - staticTextPlayer[i] = NULL; - comboBoxColor[i] = NULL; - comboBoxPlayerTemplate[i] = NULL; - comboBoxTeam[i] = NULL; - buttonAccept[i] = NULL; -// buttonStartPosition[i] = NULL; - buttonMapStartPosition[i] = NULL; - genericPingWindow[i] = NULL; + comboBoxPlayer[i] = nullptr; + staticTextPlayer[i] = nullptr; + comboBoxColor[i] = nullptr; + comboBoxPlayerTemplate[i] = nullptr; + comboBoxTeam[i] = nullptr; + buttonAccept[i] = nullptr; +// buttonStartPosition[i] = nullptr; + buttonMapStartPosition[i] = nullptr; + genericPingWindow[i] = nullptr; } } @@ -1196,9 +1187,9 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) TheGameSpyInfo->setCurrentGroupRoom(0); delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; launchGameNext = FALSE; @@ -1329,9 +1320,9 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { if (!TheGameSpyPeerMessageQueue || !TheGameSpyPeerMessageQueue->isConnected()) { @@ -1351,7 +1342,7 @@ static void shutdownComplete( WindowLayout *layout ) } */ - nextScreen = NULL; + nextScreen = nullptr; } @@ -1366,12 +1357,12 @@ void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } - parentWOLGameSetup = NULL; + parentWOLGameSetup = nullptr; EnableSlotListUpdates(FALSE); DeinitWOLGameGadgets(); - if (TheEstablishConnectionsMenu != NULL) + if (TheEstablishConnectionsMenu != nullptr) { TheEstablishConnectionsMenu->endMenu(); } @@ -1433,7 +1424,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) if (TheGameSpyGame && TheGameSpyGame->isGameInProgress()) { - if (TheGameSpyInfo->isDisconnectedAfterGameStart(NULL)) + if (TheGameSpyInfo->isDisconnectedAfterGameStart(nullptr)) { return; // already been disconnected, so don't worry. } @@ -1453,7 +1444,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // check for scorescreen NameKeyType listboxChatWindowScoreScreenID = NAMEKEY("ScoreScreen.wnd:ListboxChatWindowScoreScreen"); - GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowScoreScreenID ); + GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowScoreScreenID ); if (listboxChatWindowScoreScreen) { GadgetListBoxAddEntryText(listboxChatWindowScoreScreen, TheGameText->fetch(disconMunkee), @@ -1493,7 +1484,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) return; } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1511,7 +1502,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; TheGameSpyInfo->getCurrentStagingRoom()->reset(); TheGameSpyInfo->leaveStagingRoom(); @@ -1550,7 +1541,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) case PeerResponse::PEERRESPONSE_FAILEDTOHOST: { // oops - we've not heard from the qr server. bail. - TheGameSpyInfo->addText(TheGameText->fetch("GUI:GSFailedToHost"), GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(TheGameText->fetch("GUI:GSFailedToHost"), GameSpyColor[GSCOLOR_DEFAULT], nullptr); } break; case PeerResponse::PEERRESPONSE_GAMESTART: @@ -1568,7 +1559,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // we've started, there's no going back // i.e. disable the back button. buttonBack->winEnable(FALSE); - GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); + GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -1650,7 +1641,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // now get the number of starting spots on the map. Int numStartingSpots = MAX_SLOTS; const MapMetaData *md = TheMapCache->findMap(game->getMap()); - if (md != NULL) + if (md != nullptr) { numStartingSpots = md->m_numPlayers; } @@ -1709,7 +1700,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) break; } - if (TheNAT == NULL) // don't update slot list if we're trying to start a game + if (TheNAT == nullptr) // don't update slot list if we're trying to start a game { GameInfo *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -1965,7 +1956,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (stricmp(resp.command.c_str(), "NAT") == 0) { - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } @@ -2009,7 +2000,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) Int slotNum = game->getSlotNum(resp.nick.c_str()); if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); } } @@ -2318,19 +2309,19 @@ Bool handleGameSetupSlashCommands(UnicodeString uText) { UnicodeString s; s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "me" && uText.getLength()>4) { - TheGameSpyInfo->sendChat(UnicodeString(uText.str()+4), TRUE, NULL); + TheGameSpyInfo->sendChat(UnicodeString(uText.str()+4), TRUE, nullptr); return TRUE; // was a slash command } #if defined(RTS_DEBUG) else if (token == "slots") { g_debugSlots = !g_debugSlots; - TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "discon") @@ -2399,7 +2390,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -2498,11 +2489,11 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } TheGameSpyInfo->getCurrentStagingRoom()->reset(); - //peerLeaveRoom(TheGameSpyChat->getPeer(), StagingRoom, NULL); + //peerLeaveRoom(TheGameSpyChat->getPeer(), StagingRoom, nullptr); TheGameSpyInfo->leaveStagingRoom(); buttonPushed = true; nextScreen = "Menus/WOLCustomLobby.wnd"; @@ -2524,7 +2515,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg txtInput.trim(); // Echo the user's input to the chat window if (!txtInput.isEmpty()) - TheGameSpyInfo->sendChat(txtInput, FALSE, NULL); // 'emote' button is now carriage-return + TheGameSpyInfo->sendChat(txtInput, FALSE, nullptr); // 'emote' button is now carriage-return } else if ( controlID == buttonSelectMapID ) { @@ -2666,7 +2657,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { if (!handleGameSetupSlashCommands(txtInput)) { - TheGameSpyInfo->sendChat(txtInput, false, NULL); + TheGameSpyInfo->sendChat(txtInput, false, nullptr); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp index 48437a6f368..2729a2eb158 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp @@ -45,9 +45,9 @@ static NameKeyType windowLadderID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentWindow = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *windowLadder = NULL; +static GameWindow *parentWindow = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *windowLadder = nullptr; //------------------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) buttonBackID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:ButtonBack" ); windowLadderID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:WindowLadder" ); - parentWindow = TheWindowManager->winGetWindowFromId( NULL, parentWindowID ); + parentWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWindowID ); buttonBack = TheWindowManager->winGetWindowFromId( parentWindow, buttonBackID ); windowLadder = TheWindowManager->winGetWindowFromId( parentWindow, windowLadderID ); @@ -70,7 +70,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) // PopulateReplayFileListbox(listboxReplayFiles); //TheWebBrowser->createBrowserWindow("Westwood", windowLadder); - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->createBrowserWindow("MessageBoard", windowLadder); } @@ -89,7 +89,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) { - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->closeBrowserWindow(windowLadder); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index cb9b2057b1c..903bed54d4d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -84,7 +84,7 @@ static LogClass s_perfLog("Perf.txt"); // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static time_t gameListRefreshTime = 0; static const time_t gameListRefreshInterval = 10000; @@ -111,18 +111,18 @@ static NameKeyType comboLobbyGroupRoomsID = NAMEKEY_INVALID; //static NameKeyType // sliderChatAdjustID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLLobby = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonRefresh = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *buttonBuddy = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *listboxLobbyPlayers = NULL; -static GameWindow *listboxLobbyChat = NULL; -static GameWindow *comboLobbyGroupRooms = NULL; -static GameWindow *parent = NULL; +static GameWindow *parentWOLLobby = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonRefresh = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *buttonBuddy = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *listboxLobbyPlayers = nullptr; +static GameWindow *listboxLobbyChat = nullptr; +static GameWindow *comboLobbyGroupRooms = nullptr; +static GameWindow *parent = nullptr; static Int groupRoomToJoin = 0; static Int initialGadgetDelay = 2; @@ -160,7 +160,7 @@ Bool handleLobbySlashCommands(UnicodeString uText) { UnicodeString s; s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "me" && uText.getLength()>4) @@ -201,13 +201,13 @@ Bool handleLobbySlashCommands(UnicodeString uText) else if (token == "fakecrc") { g_fakeCRC = !g_fakeCRC; - TheGameSpyInfo->addText(L"Toggled CRC fakery", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled CRC fakery", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "slots") { g_debugSlots = !g_debugSlots; - TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } #endif @@ -326,7 +326,7 @@ static void playerTooltip(GameWindow *window, tmp.format(L"\n%ls %ls", TheGameText->fetch(sideName).str(), TheGameText->fetch(rankName).str()); tooltip.concat(tmp); - TheMouse->setCursorTooltip( tooltip, -1, NULL, 1.5f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( tooltip, -1, nullptr, 1.5f ); // the text and width are the only params used. the others are the default values. } static void populateGroupRoomListbox(GameWindow *lb) @@ -384,7 +384,7 @@ static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); const Image* LookupSmallRankImage(Int side, Int rankPoints) { if (rankPoints == 0) - return NULL; + return nullptr; Int rank = 0; Int i = 0; @@ -393,7 +393,7 @@ const Image* LookupSmallRankImage(Int side, Int rankPoints) rank = i; if (rank < 0 || rank >= 10) - return NULL; + return nullptr; AsciiString sideStr = "N"; switch(side) @@ -457,7 +457,7 @@ static Int insertPlayerInListbox(const PlayerInfo& info, Color color) w = min(GadgetListBoxGetColumnWidth(listboxLobbyPlayers, 0), w); Int h = w; if (!isPreorder) - preorderImg = NULL; + preorderImg = nullptr; const Image *rankImg = LookupSmallRankImage(currentSide, currentRank); @@ -582,7 +582,7 @@ void PopulateLobbyPlayerListbox(void) if (indicesToSelect.size() != numSelected) { - TheWindowManager->winSetLoneWindow(NULL); + TheWindowManager->winSetLoneWindow(nullptr); } // restore top visible entry @@ -596,7 +596,7 @@ void PopulateLobbyPlayerListbox(void) //------------------------------------------------------------------------------------------------- void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; @@ -606,7 +606,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) playerListRefreshTime = 0; parentWOLLobbyID = TheNameKeyGenerator->nameToKey( "WOLCustomLobby.wnd:WOLLobbyMenuParent" ); - parent = TheWindowManager->winGetWindowFromId(NULL, parentWOLLobbyID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentWOLLobbyID); buttonBackID = TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:ButtonBack"); buttonBack = TheWindowManager->winGetWindowFromId(parent, buttonBackID); @@ -701,7 +701,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) TheLobbyQueuedUTMs.clear(); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:GadgetParent")); if(win) win->winHide(TRUE); DontShowMainMenu = TRUE; @@ -719,14 +719,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -760,8 +760,8 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) req.peerRequestType = PeerRequest::PEERREQUEST_STOPGAMELIST; TheGameSpyPeerMessageQueue->addRequest(req); - listboxLobbyChat = NULL; - listboxLobbyPlayers = NULL; + listboxLobbyChat = nullptr; + listboxLobbyPlayers = nullptr; isShuttingDown = true; @@ -951,7 +951,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) GameSpyGroupRoom room = iter->second; UnicodeString msg; msg.format(TheGameText->fetch("GUI:LobbyJoined"), room.m_translatedName.str()); - TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], nullptr); } } else @@ -1571,7 +1571,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, break; #endif } - Bool unknownLadder = (roomToJoin->getLadderPort() && TheLadderList->findLadder(roomToJoin->getLadderIP(), roomToJoin->getLadderPort()) == NULL); + Bool unknownLadder = (roomToJoin->getLadderPort() && TheLadderList->findLadder(roomToJoin->getLadderIP(), roomToJoin->getLadderPort()) == nullptr); if (unknownLadder) { GSMessageBoxOk(TheGameText->fetch("GUI:JoinFailedDefault"), TheGameText->fetch("GUI:JoinFailedUnknownLadder")); @@ -1605,12 +1605,12 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameInfo"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameInfo"), nullptr); } } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameSelected"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameSelected"), nullptr); } } else if ( controlID == buttonBuddyID ) @@ -1709,7 +1709,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, if( controlID == listboxLobbyPlayersID ) { RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout = NULL; + WindowLayout *rcLayout = nullptr; GameWindow *rcMenu; if(rc->pos < 0) { @@ -1771,7 +1771,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == GetGameListBoxID() ) { RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout = NULL; + WindowLayout *rcLayout = nullptr; GameWindow *rcMenu; if(rc->pos < 0) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp index 59d80e4051e..086149c9516 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp @@ -56,9 +56,9 @@ static NameKeyType buttonOkID = NAMEKEY_INVALID; static NameKeyType listboxLocaleID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLocaleSelect = NULL; -static GameWindow *buttonOk = NULL; -static GameWindow *listboxLocale = NULL; +static GameWindow *parentLocaleSelect = nullptr; +static GameWindow *buttonOk = nullptr; +static GameWindow *listboxLocale = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -68,9 +68,9 @@ void WOLLocaleSelectInit( WindowLayout *layout, void *userData ) parentLocaleSelectID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ParentLocaleSelect" ); buttonOkID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ButtonOk" ); listboxLocaleID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ListBoxLocaleSelect" ); - parentLocaleSelect = TheWindowManager->winGetWindowFromId( NULL, parentLocaleSelectID ); - buttonOk = TheWindowManager->winGetWindowFromId( NULL, buttonOkID); - listboxLocale = TheWindowManager->winGetWindowFromId( NULL, listboxLocaleID); + parentLocaleSelect = TheWindowManager->winGetWindowFromId( nullptr, parentLocaleSelectID ); + buttonOk = TheWindowManager->winGetWindowFromId( nullptr, buttonOkID); + listboxLocale = TheWindowManager->winGetWindowFromId( nullptr, listboxLocaleID); for (int i=LOC_MIN; i<=LOC_MAX; ++i) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp index 74f8f49bbdd..9e868449842 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp @@ -79,7 +79,7 @@ static Bool useWebBrowserForTOS = FALSE; static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static const UnsignedInt loginTimeoutInMS = 10000; static UnsignedInt loginAttemptTime = 0; @@ -308,7 +308,7 @@ AsciiStringList GameSpyLoginPreferences::getEmails( void ) return theList; } -static GameSpyLoginPreferences *loginPref = NULL; +static GameSpyLoginPreferences *loginPref = nullptr; static void startPings( void ) { @@ -339,30 +339,30 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { if (loginPref) { loginPref->write(); delete loginPref; - loginPref = NULL; + loginPref = nullptr; } TheShell->push(nextScreen); } else { - DEBUG_ASSERTCRASH(loginPref != NULL, ("loginPref == NULL")); + DEBUG_ASSERTCRASH(loginPref != nullptr, ("loginPref == nullptr")); if (loginPref) { loginPref->write(); delete loginPref; - loginPref = NULL; + loginPref = nullptr; } } - nextScreen = NULL; + nextScreen = nullptr; } @@ -389,24 +389,24 @@ static NameKeyType textEntryDayID = NAMEKEY_INVALID; // profile static NameKeyType textEntryYearID = NAMEKEY_INVALID; // profile // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLLogin = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonLogin = NULL; -static GameWindow *buttonCreateAccount = NULL; -static GameWindow *buttonUseAccount = NULL; -static GameWindow *buttonDontUseAccount = NULL; -static GameWindow *buttonTOS = NULL; -static GameWindow *parentTOS = NULL; -static GameWindow *buttonTOSOK = NULL; -static GameWindow *listboxTOS = NULL; -static GameWindow *comboBoxEmail = NULL; -static GameWindow *comboBoxLoginName = NULL; -static GameWindow *textEntryLoginName = NULL; -static GameWindow *textEntryPassword = NULL; -static GameWindow *checkBoxRememberPassword = NULL; -static GameWindow *textEntryMonth = NULL; -static GameWindow *textEntryDay = NULL; -static GameWindow *textEntryYear = NULL; +static GameWindow *parentWOLLogin = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonLogin = nullptr; +static GameWindow *buttonCreateAccount = nullptr; +static GameWindow *buttonUseAccount = nullptr; +static GameWindow *buttonDontUseAccount = nullptr; +static GameWindow *buttonTOS = nullptr; +static GameWindow *parentTOS = nullptr; +static GameWindow *buttonTOSOK = nullptr; +static GameWindow *listboxTOS = nullptr; +static GameWindow *comboBoxEmail = nullptr; +static GameWindow *comboBoxLoginName = nullptr; +static GameWindow *textEntryLoginName = nullptr; +static GameWindow *textEntryPassword = nullptr; +static GameWindow *checkBoxRememberPassword = nullptr; +static GameWindow *textEntryMonth = nullptr; +static GameWindow *textEntryDay = nullptr; +static GameWindow *textEntryYear = nullptr; void EnableLoginControls( Bool state ) { @@ -444,7 +444,7 @@ void EnableLoginControls( Bool state ) //------------------------------------------------------------------------------------------------- void WOLLoginMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; loginAttemptTime = 0; @@ -455,8 +455,8 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) } // if the ESRB warning is blank (other country) hide the box - GameWindow *esrbTitle = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("GameSpyLoginProfile.wnd:StaticTextESRBTop") ); - GameWindow *esrbParent = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("GameSpyLoginProfile.wnd:ParentESRB") ); + GameWindow *esrbTitle = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:StaticTextESRBTop") ); + GameWindow *esrbParent = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:ParentESRB") ); if (esrbTitle && esrbParent) { if ( GadgetStaticTextGetText( esrbTitle ).getLength() < 2 ) @@ -484,24 +484,24 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) textEntryDayID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryDay" ); textEntryYearID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryYear" ); - parentWOLLogin = TheWindowManager->winGetWindowFromId( NULL, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( NULL, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( NULL, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonDontUseAccountID); - buttonTOS = TheWindowManager->winGetWindowFromId( NULL, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( NULL, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( NULL, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( NULL, listboxTOSID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( NULL, comboBoxEmailID); - comboBoxLoginName = TheWindowManager->winGetWindowFromId( NULL, comboBoxLoginNameID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( NULL, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( NULL, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( NULL, checkBoxRememberPasswordID); - textEntryMonth = TheWindowManager->winGetWindowFromId( NULL, textEntryMonthID); - textEntryDay = TheWindowManager->winGetWindowFromId( NULL, textEntryDayID); - textEntryYear = TheWindowManager->winGetWindowFromId( NULL, textEntryYearID); + parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); + buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); + buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); + buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); + buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); + parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); + buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); + listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); + comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); + comboBoxLoginName = TheWindowManager->winGetWindowFromId( nullptr, comboBoxLoginNameID); + textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); + textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); + checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); + textEntryMonth = TheWindowManager->winGetWindowFromId( nullptr, textEntryMonthID); + textEntryDay = TheWindowManager->winGetWindowFromId( nullptr, textEntryDayID); + textEntryYear = TheWindowManager->winGetWindowFromId( nullptr, textEntryYearID); GadgetTextEntrySetText(textEntryMonth, UnicodeString::TheEmptyString); @@ -569,20 +569,20 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) textEntryPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:TextEntryPassword" ); checkBoxRememberPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:CheckBoxRememberPassword" ); - parentWOLLogin = TheWindowManager->winGetWindowFromId( NULL, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( NULL, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( NULL, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonDontUseAccountID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( NULL, comboBoxEmailID); - buttonTOS = TheWindowManager->winGetWindowFromId( NULL, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( NULL, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( NULL, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( NULL, listboxTOSID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( NULL, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( NULL, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( NULL, checkBoxRememberPasswordID); + parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); + buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); + buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); + buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); + comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); + buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); + parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); + buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); + listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); + textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); + textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); + checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); DEBUG_ASSERTCRASH(buttonBack, ("buttonBack missing!")); DEBUG_ASSERTCRASH(buttonLogin, ("buttonLogin missing!")); @@ -739,7 +739,7 @@ void WOLLoginMenuShutdown( WindowLayout *layout, void *userData ) TheWindowManager->clearTabList(); if (webBrowserActive) { - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->closeBrowserWindow(listboxTOS); } @@ -772,7 +772,7 @@ static void checkLogin( void ) DEBUG_LOG(("Ping string is %s", pingStr.str())); TheGameSpyInfo->setPingString(pingStr); //delete ThePinger; - //ThePinger = NULL; + //ThePinger = nullptr; buttonPushed = true; loggedInOK = false; // don't try this again @@ -962,7 +962,7 @@ static Bool isNickOkay(UnicodeString nick) return FALSE; WideChar newChar = nick.getCharAt(len-1); - if (wcschr(legalIRCChars, newChar) == NULL) + if (wcschr(legalIRCChars, newChar) == nullptr) return FALSE; return TRUE; @@ -986,7 +986,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) #define DATE_BUFFER_SIZE 256 char dateBuffer[ DATE_BUFFER_SIZE ]; GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "yyyy", dateBuffer, DATE_BUFFER_SIZE ); Int sysVal = atoi(dateBuffer); @@ -997,7 +997,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) return FALSE; GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "MM", dateBuffer, DATE_BUFFER_SIZE ); sysVal = atoi(dateBuffer); @@ -1008,7 +1008,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) return FALSE; // month.format("%02.2d",userVal); GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "dd", dateBuffer, DATE_BUFFER_SIZE ); sysVal = atoi(dateBuffer); @@ -1433,7 +1433,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, { parentTOS->winHide(FALSE); useWebBrowserForTOS = FALSE;//loginPref->getBool("UseTOSBrowser", TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != NULL)) + if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) { TheWebBrowser->createBrowserWindow("TermsOfService", listboxTOS); webBrowserActive = TRUE; @@ -1470,10 +1470,10 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, } delete[] fileBuf; - fileBuf = NULL; + fileBuf = nullptr; theFile->close(); - theFile = NULL; + theFile = nullptr; } } EnableLoginControls( FALSE ); @@ -1485,9 +1485,9 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, EnableLoginControls( TRUE ); parentTOS->winHide(TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != NULL)) + if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) { - if (listboxTOS != NULL) + if (listboxTOS != nullptr) { TheWebBrowser->closeBrowserWindow(listboxTOS); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index 227c11d2acf..016f587ed25 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -49,38 +49,37 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; -static GameWindow *parent = NULL; +static GameWindow *parent = nullptr; static Bool raiseMessageBoxes = FALSE; -static GameWindow *winMapPreview = NULL; +static GameWindow *winMapPreview = nullptr; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; extern WindowLayout *WOLMapSelectLayout; ///< Map selection overlay -static GameWindow *mapList = NULL; +static GameWindow *mapList = nullptr; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *winMapWindow = NULL; +static GameWindow *winMapWindow = nullptr; static void NullifyControls(void) { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; iwinGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("GameSpyGameOptionsMenu.wnd:ButtonBack") ); + GameWindow *win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("GameSpyGameOptionsMenu.wnd:ButtonBack") ); if(win) win->winEnable( show ); } @@ -128,7 +127,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -381,7 +380,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } WOLPositionStartSpots(); @@ -449,7 +448,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } showGameSpyGameOptionsUnderlyingGUIElements( TRUE ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp index 23b023b1562..98c4e4cb9d5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp @@ -50,8 +50,8 @@ static NameKeyType parentWOLMessageWindowID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLMessageWindow = NULL; -static GameWindow *buttonCancel = NULL; +static GameWindow *parentWOLMessageWindow = nullptr; +static GameWindow *buttonCancel = nullptr; //------------------------------------------------------------------------------------------------- @@ -61,8 +61,8 @@ void WOLMessageWindowInit( WindowLayout *layout, void *userData ) { parentWOLMessageWindowID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:WOLMessageWindowParent" ); buttonCancelID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:ButtonCancel" ); - parentWOLMessageWindow = TheWindowManager->winGetWindowFromId( NULL, parentWOLMessageWindowID ); - buttonCancel = TheWindowManager->winGetWindowFromId( NULL, buttonCancelID); + parentWOLMessageWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWOLMessageWindowID ); + buttonCancel = TheWindowManager->winGetWindowFromId( nullptr, buttonCancelID); // Show Menu diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp index 784bbe3ffd1..50e90a74af5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp @@ -51,9 +51,9 @@ static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; static NameKeyType buttonQuickmatchID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLQMScore = NULL; -static GameWindow *buttonDisconnect = NULL; -static GameWindow *buttonQuickmatch = NULL; +static GameWindow *parentWOLQMScore = nullptr; +static GameWindow *buttonDisconnect = nullptr; +static GameWindow *buttonQuickmatch = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -63,9 +63,9 @@ void WOLQMScoreScreenInit( WindowLayout *layout, void *userData ) parentWOLQMScoreID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:WOLQMScoreScreenParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonDisconnect" ); buttonQuickmatchID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonQuickMatch" ); - parentWOLQMScore = TheWindowManager->winGetWindowFromId( NULL, parentWOLQMScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); - buttonQuickmatch = TheWindowManager->winGetWindowFromId( NULL, buttonQuickmatchID); + parentWOLQMScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLQMScoreID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); + buttonQuickmatch = TheWindowManager->winGetWindowFromId( nullptr, buttonQuickmatchID); /* if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) @@ -99,7 +99,7 @@ void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); - //progressLayout = NULL; + //progressLayout = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 5d8eefe7cb2..e4982952296 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -102,33 +102,33 @@ static NameKeyType comboBoxColorID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLQuickMatch = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonStop = NULL; -static GameWindow *buttonWiden = NULL; -GameWindow *quickmatchTextWindow = NULL; -static GameWindow *listboxMapSelect = NULL; -//static GameWindow *textEntryMaxDisconnects = NULL; -//static GameWindow *textEntryMaxPoints = NULL; -//static GameWindow *textEntryMinPoints = NULL; -static GameWindow *textEntryWaitTime = NULL; -static GameWindow *comboBoxNumPlayers = NULL; -static GameWindow *comboBoxMaxPing = NULL; -static GameWindow *comboBoxLadder = NULL; -static GameWindow *comboBoxDisabledLadder = NULL; // enable and disable this, but never use it. it is a stand-in for comboBoxLadder for when there are no ladders -static GameWindow *comboBoxMaxDisconnects = NULL; -static GameWindow *staticTextNumPlayers = NULL; -static GameWindow *comboBoxSide = NULL; -static GameWindow *comboBoxColor = NULL; +static GameWindow *parentWOLQuickMatch = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonStop = nullptr; +static GameWindow *buttonWiden = nullptr; +GameWindow *quickmatchTextWindow = nullptr; +static GameWindow *listboxMapSelect = nullptr; +//static GameWindow *textEntryMaxDisconnects = nullptr; +//static GameWindow *textEntryMaxPoints = nullptr; +//static GameWindow *textEntryMinPoints = nullptr; +static GameWindow *textEntryWaitTime = nullptr; +static GameWindow *comboBoxNumPlayers = nullptr; +static GameWindow *comboBoxMaxPing = nullptr; +static GameWindow *comboBoxLadder = nullptr; +static GameWindow *comboBoxDisabledLadder = nullptr; // enable and disable this, but never use it. it is a stand-in for comboBoxLadder for when there are no ladders +static GameWindow *comboBoxMaxDisconnects = nullptr; +static GameWindow *staticTextNumPlayers = nullptr; +static GameWindow *comboBoxSide = nullptr; +static GameWindow *comboBoxColor = nullptr; static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static Bool isInInit = FALSE; -static const Image *selectedImage = NULL; -static const Image *unselectedImage = NULL; +static const Image *selectedImage = nullptr; +static const Image *unselectedImage = nullptr; static bool isPopulatingLadderBox = false; static Int maxPingEntries = 0; @@ -294,7 +294,7 @@ static void populateQMColorComboBox(QuickMatchPreferences& pref) // ----------------------------------------------------------------------------- -static void populateQMSideComboBox(Int favSide, const LadderInfo *li = NULL) +static void populateQMSideComboBox(Int favSide, const LadderInfo *li = nullptr) { Int numPlayerTemplates = ThePlayerTemplateStore->getPlayerTemplateCount(); UnicodeString playerTemplateName; @@ -416,7 +416,7 @@ void PopulateQMLadderListBox( GameWindow *win ) // start with "No Ladder" index = GadgetListBoxAddEntryText( win, TheGameText->fetch("GUI:NoLadder"), normalColor, -1 ); - GadgetListBoxSetItemData( win, 0, index ); + GadgetListBoxSetItemData( win, nullptr, index ); // add the last ladder Int selectedPos = 0; @@ -506,7 +506,7 @@ void PopulateQMLadderComboBox( void ) Int index; GadgetComboBoxReset( comboBoxLadder ); index = GadgetComboBoxAddEntry( comboBoxLadder, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxLadder, index, 0 ); + GadgetComboBoxSetItemData( comboBoxLadder, index, nullptr ); std::set usedLadders; @@ -567,7 +567,7 @@ static void populateQuickMatchMapSelectListbox( QuickMatchPreferences& pref ) GadgetComboBoxGetSelectedPos( comboBoxLadder, &selected ); index = (Int)GadgetComboBoxGetItemData( comboBoxLadder, selected ); const LadderInfo *li = TheLadderList->findLadderByIndex( index ); - //listboxMapSelect->winEnable( li == NULL || li->randomMaps == FALSE ); + //listboxMapSelect->winEnable( li == nullptr || li->randomMaps == FALSE ); Int numPlayers = 0; if (li) @@ -736,13 +736,13 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) } } - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; raiseMessageBoxes = true; delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; parentWOLQuickMatchID = NAMEKEY( "WOLQuickMatchMenu.wnd:WOLQuickMatchMenuParent" ); buttonBackID = NAMEKEY( "WOLQuickMatchMenu.wnd:ButtonBack" ); @@ -766,7 +766,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxSideID = NAMEKEY( "WOLQuickMatchMenu.wnd:ComboBoxSide" ); comboBoxColorID = NAMEKEY( "WOLQuickMatchMenu.wnd:ComboBoxColor" ); - parentWOLQuickMatch = TheWindowManager->winGetWindowFromId( NULL, parentWOLQuickMatchID ); + parentWOLQuickMatch = TheWindowManager->winGetWindowFromId( nullptr, parentWOLQuickMatchID ); buttonBack = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonBackID); buttonStart = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonStartID); buttonStop = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonStopID); @@ -792,7 +792,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) { // no ladders, so just disable them comboBoxDisabledLadder = comboBoxLadder; - comboBoxLadder = NULL; + comboBoxLadder = nullptr; isPopulatingLadderBox = TRUE; @@ -800,7 +800,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) Int index; GadgetComboBoxReset( comboBoxDisabledLadder ); index = GadgetComboBoxAddEntry( comboBoxDisabledLadder, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxDisabledLadder, index, 0 ); + GadgetComboBoxSetItemData( comboBoxDisabledLadder, index, nullptr ); GadgetComboBoxSetSelectedPos( comboBoxDisabledLadder, index ); isPopulatingLadderBox = FALSE; @@ -812,7 +812,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxLadder->winHide(TRUE); comboBoxLadder->winEnable(FALSE); } - comboBoxLadder = NULL; + comboBoxLadder = nullptr; GameWindow *staticTextLadder = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, NAMEKEY("WOLQuickMatchMenu.wnd:StaticTextLadder") ); if (staticTextLadder) @@ -820,7 +820,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) */ } - GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(NULL, buttonBuddiesID); + GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(nullptr, buttonBuddiesID); if (buttonBuddies) buttonBuddies->winEnable(TRUE); @@ -928,14 +928,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -949,10 +949,10 @@ void WOLQuickMatchMenuShutdown( WindowLayout *layout, void *userData ) if (!TheGameEngine->getQuitting()) saveQuickMatchOptions(); - parentWOLQuickMatch = NULL; - buttonBack = NULL; - quickmatchTextWindow = NULL; - selectedImage = unselectedImage = NULL; + parentWOLQuickMatch = nullptr; + buttonBack = nullptr; + quickmatchTextWindow = nullptr; + selectedImage = unselectedImage = nullptr; isShuttingDown = true; @@ -1050,7 +1050,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) if (TheGameSpyGame && TheGameSpyGame->isGameInProgress()) { - if (TheGameSpyInfo->isDisconnectedAfterGameStart(NULL)) + if (TheGameSpyInfo->isDisconnectedAfterGameStart(nullptr)) { return; // already been disconnected, so don't worry. } @@ -1070,7 +1070,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) // check for scorescreen NameKeyType listboxChatWindowScoreScreenID = NAMEKEY("ScoreScreen.wnd:ListboxChatWindowScoreScreen"); - GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowScoreScreenID ); + GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowScoreScreenID ); if (listboxChatWindowScoreScreen) { GadgetListBoxAddEntryText(listboxChatWindowScoreScreen, TheGameText->fetch(disconMunkee), @@ -1089,7 +1089,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) return; // if we're in game, all we care about is if we've been disconnected from the chat server } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1102,7 +1102,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) { // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; // Just back out. This cleans up some slot list problems buttonPushed = true; @@ -1165,7 +1165,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT sawImportantMessage = TRUE; - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); } } @@ -1325,7 +1325,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) DEBUG_LOG(("Starting a QM game: options=[%s]", GameInfoToAsciiString(TheGameSpyGame).str())); SendStatsToOtherPlayers(TheGameSpyGame); TheGameSpyGame->startGame(0); - GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(NULL, buttonBuddiesID); + GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(nullptr, buttonBuddiesID); if (buttonBuddies) buttonBuddies->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -1634,7 +1634,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms Int ladderIndex, index, selected; GadgetComboBoxGetSelectedPos( comboBoxLadder, &selected ); ladderIndex = (Int)GadgetComboBoxGetItemData( comboBoxLadder, selected ); - const LadderInfo *ladderInfo = NULL; + const LadderInfo *ladderInfo = nullptr; if (ladderIndex < 0) { ladderIndex = 0; @@ -1738,7 +1738,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms LadderPreferences ladPref; ladPref.loadProfile( TheGameSpyInfo->getLocalProfileID() ); LadderPref p; - p.lastPlayDate = time(NULL); + p.lastPlayDate = time(nullptr); p.address = ladderInfo->address; p.port = ladderInfo->port; p.name = ladderInfo->name; @@ -1773,7 +1773,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms for ( Int i=0; inameToKey( "WOLStatusMenu.wnd:WOLStatusMenuParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ButtonDisconnect" ); - parentWOLStatus = TheWindowManager->winGetWindowFromId( NULL, parentWOLStatusID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); + parentWOLStatus = TheWindowManager->winGetWindowFromId( nullptr, parentWOLStatusID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); - progressTextWindow = TheWindowManager->winGetWindowFromId( NULL, + progressTextWindow = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ListboxStatus" ) ); // Show Menu @@ -90,7 +90,7 @@ void WOLStatusMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); - //progressLayout = NULL; + //progressLayout = nullptr; //WOL::raiseWOLMessageBox(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index 894a3f0e70b..072d4b4311c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -69,7 +69,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = FALSE; static Bool buttonPushed = FALSE; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; // window ids ------------------------------------------------------------------------------ static NameKeyType parentWOLWelcomeID = NAMEKEY_INVALID; @@ -83,30 +83,30 @@ static NameKeyType buttonMyInfoID = NAMEKEY_INVALID; static NameKeyType listboxInfoID = NAMEKEY_INVALID; static NameKeyType buttonOptionsID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLWelcome = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonQuickMatch = NULL; -static GameWindow *buttonLobby = NULL; -static GameWindow *buttonBuddies = NULL; -static GameWindow *buttonLadder = NULL; -static GameWindow *buttonMyInfo = NULL; -static GameWindow *buttonbuttonOptions = NULL; -static WindowLayout *welcomeLayout = NULL; -static GameWindow *listboxInfo = NULL; - -static GameWindow *staticTextServerName = NULL; -static GameWindow *staticTextLastUpdated = NULL; - -static GameWindow *staticTextLadderWins = NULL; -static GameWindow *staticTextLadderLosses = NULL; -static GameWindow *staticTextLadderRank = NULL; -static GameWindow *staticTextLadderPoints = NULL; -static GameWindow *staticTextLadderDisconnects = NULL; - -static GameWindow *staticTextHighscoreWins = NULL; -static GameWindow *staticTextHighscoreLosses = NULL; -static GameWindow *staticTextHighscoreRank = NULL; -static GameWindow *staticTextHighscorePoints = NULL; +static GameWindow *parentWOLWelcome = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonQuickMatch = nullptr; +static GameWindow *buttonLobby = nullptr; +static GameWindow *buttonBuddies = nullptr; +static GameWindow *buttonLadder = nullptr; +static GameWindow *buttonMyInfo = nullptr; +static GameWindow *buttonbuttonOptions = nullptr; +static WindowLayout *welcomeLayout = nullptr; +static GameWindow *listboxInfo = nullptr; + +static GameWindow *staticTextServerName = nullptr; +static GameWindow *staticTextLastUpdated = nullptr; + +static GameWindow *staticTextLadderWins = nullptr; +static GameWindow *staticTextLadderLosses = nullptr; +static GameWindow *staticTextLadderRank = nullptr; +static GameWindow *staticTextLadderPoints = nullptr; +static GameWindow *staticTextLadderDisconnects = nullptr; + +static GameWindow *staticTextHighscoreWins = nullptr; +static GameWindow *staticTextHighscoreLosses = nullptr; +static GameWindow *staticTextHighscoreRank = nullptr; +static GameWindow *staticTextHighscorePoints = nullptr; static UnicodeString gServerName; void updateServerDisplay(UnicodeString serverName) @@ -191,14 +191,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -213,14 +213,14 @@ static UnsignedByte grabUByte(const char *s) char tmp[5] = "0xff"; tmp[2] = s[0]; tmp[3] = s[1]; - UnsignedByte b = strtol(tmp, NULL, 16); + UnsignedByte b = strtol(tmp, nullptr, 16); return b; } static void updateNumPlayersOnline(void) { GameWindow *playersOnlineWindow = TheWindowManager->winGetWindowFromId( - NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextNumPlayersOnline") ); + nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextNumPlayersOnline") ); if (playersOnlineWindow) { @@ -346,22 +346,22 @@ static void updateOverallStats(void) china = calcPercent(s_statsChina, STATS_LASTWEEK, TheGameText->fetch("SIDE:China")); gla = calcPercent(s_statsGLA, STATS_LASTWEEK, TheGameText->fetch("SIDE:GLA")); DEBUG_LOG(("Last Week: %ls %ls %ls", usa.str(), china.str(), gla.str())); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextUSALastWeek") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextUSALastWeek") ); GadgetStaticTextSetText(win, usa); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextChinaLastWeek") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextChinaLastWeek") ); GadgetStaticTextSetText(win, china); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextGLALastWeek") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextGLALastWeek") ); GadgetStaticTextSetText(win, gla); usa = calcPercent(s_statsUSA, STATS_TODAY, TheGameText->fetch("SIDE:America")); china = calcPercent(s_statsChina, STATS_TODAY, TheGameText->fetch("SIDE:China")); gla = calcPercent(s_statsGLA, STATS_TODAY, TheGameText->fetch("SIDE:GLA")); DEBUG_LOG(("Today: %ls %ls %ls", usa.str(), china.str(), gla.str())); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextUSAToday") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextUSAToday") ); GadgetStaticTextSetText(win, usa); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextChinaToday") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextChinaToday") ); GadgetStaticTextSetText(win, china); - win = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextGLAToday") ); + win = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextGLAToday") ); GadgetStaticTextSetText(win, gla); } @@ -380,7 +380,7 @@ void HandleOverallStats( const OverallStats& USA, const OverallStats& China, con void UpdateLocalPlayerStats(void) { - GameWindow *welcomeParent = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:WOLWelcomeMenuParent") ); + GameWindow *welcomeParent = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:WOLWelcomeMenuParent") ); if (welcomeParent) { @@ -400,7 +400,7 @@ static Bool raiseMessageBoxes = FALSE; //------------------------------------------------------------------------------------------------- void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = FALSE; isShuttingDown = FALSE; @@ -410,13 +410,13 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) parentWOLWelcomeID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:WOLWelcomeMenuParent" ); buttonBackID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonBack" ); - parentWOLWelcome = TheWindowManager->winGetWindowFromId( NULL, parentWOLWelcomeID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); + parentWOLWelcome = TheWindowManager->winGetWindowFromId( nullptr, parentWOLWelcomeID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); buttonOptionsID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonOptions" ); - buttonbuttonOptions = TheWindowManager->winGetWindowFromId( NULL, buttonOptionsID); + buttonbuttonOptions = TheWindowManager->winGetWindowFromId( nullptr, buttonOptionsID); listboxInfoID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:InfoListbox" ); - listboxInfo = TheWindowManager->winGetWindowFromId( NULL, listboxInfoID); + listboxInfo = TheWindowManager->winGetWindowFromId( nullptr, listboxInfoID); staticTextServerName = TheWindowManager->winGetWindowFromId( parentWOLWelcome, TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:StaticTextServerName" )); @@ -488,13 +488,13 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) buttonLadderID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonLadder" ); buttonLadder = TheWindowManager->winGetWindowFromId( parentWOLWelcome, buttonLadderID ); - if (TheFirewallHelper == NULL) { + if (TheFirewallHelper == nullptr) { TheFirewallHelper = createFirewallHelper(); } if (TheFirewallHelper->detectFirewall() == TRUE) { // don't need to detect firewall, already been done. delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } /* @@ -515,9 +515,9 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) // // animate controls // TheShell->registerWithAnimateManager(buttonQuickMatch, WIN_ANIMATION_SLIDE_LEFT, TRUE, 800); // TheShell->registerWithAnimateManager(buttonLobby, WIN_ANIMATION_SLIDE_LEFT, TRUE, 600); -// //TheShell->registerWithAnimateManager(NULL, WIN_ANIMATION_SLIDE_LEFT, TRUE, 400); +// //TheShell->registerWithAnimateManager(nullptr, WIN_ANIMATION_SLIDE_LEFT, TRUE, 400); // TheShell->registerWithAnimateManager(buttonBuddies, WIN_ANIMATION_SLIDE_LEFT, TRUE, 200); -// //TheShell->registerWithAnimateManager(NULL, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); +// //TheShell->registerWithAnimateManager(nullptr, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_BOTTOM, TRUE, 1); // Show Menu @@ -550,10 +550,10 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) { - listboxInfo = NULL; + listboxInfo = nullptr; delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; isShuttingDown = TRUE; @@ -590,7 +590,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) raiseMessageBoxes = FALSE; } - if (TheFirewallHelper != NULL) + if (TheFirewallHelper != nullptr) { if (TheFirewallHelper->behaviorDetectionUpdate()) { @@ -602,7 +602,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) // we are now done with the firewall helper delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } } @@ -796,9 +796,9 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, closeAllOverlays(); TheShell->pop(); delete TheWOL; - TheWOL = NULL; + TheWOL = nullptr; delete TheWOLGame; - TheWOLGame = NULL; + TheWOLGame = nullptr; **/ } @@ -828,7 +828,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonLobbyID) { //TheGameSpyChat->clearGroupRoomList(); - //peerListGroupRooms(TheGameSpyChat->getPeer(), ListGroupRoomsCallback, NULL, PEERTrue); + //peerListGroupRooms(TheGameSpyChat->getPeer(), ListGroupRoomsCallback, nullptr, PEERTrue); TheGameSpyInfo->joinBestGroupRoom(); enableControls( FALSE ); @@ -857,7 +857,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else { GameSpyCurrentGroupRoomID = 0; - GSMessageBoxOk(L"Oops", L"Unable to join title room", NULL); + GSMessageBoxOk(L"Oops", L"Unable to join title room", nullptr); } */ } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp index 8dcf8aa5813..82518dd1b99 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp @@ -60,34 +60,34 @@ GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, NULL, NULL); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr); } GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, NULL, NULL, TRUE); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr, TRUE); } GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Yes,No and Cancel buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, NULL, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, nullptr, cancelCallback); } GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Ok and Cancel buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, NULL, NULL, okCallback, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, nullptr, nullptr, okCallback, cancelCallback); } GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback)///< convenience function for displaying a Message box with Ok button { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, NULL, NULL, okCallback, NULL); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, nullptr, nullptr, okCallback, nullptr); } GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Cancel button { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, NULL, NULL, NULL, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, nullptr, nullptr, nullptr, cancelCallback); } @@ -110,7 +110,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, case GWM_DESTROY: { delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } @@ -194,7 +194,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, case GWM_DESTROY: { delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp index 8004e9c89df..205cbda9638 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp @@ -316,7 +316,7 @@ void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index 26b816f4867..aef04f9e1ec 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -594,10 +594,10 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, // ------------------------------------------------------------------------ case GWM_DESTROY: { - TheWindowManager->winSetLoneWindow(NULL); // if we are transitioning screens, close all combo boxes + TheWindowManager->winSetLoneWindow(nullptr); // if we are transitioning screens, close all combo boxes delete (ComboBoxData *)window->winGetUserData(); - window->winSetUserData(NULL); - comboData = NULL; + window->winSetUserData(nullptr); + comboData = nullptr; break; } @@ -838,7 +838,7 @@ void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -854,7 +854,7 @@ void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLetters void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -870,7 +870,7 @@ void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -896,7 +896,7 @@ UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return UnicodeString::TheEmptyString; // verify that this is a combo box @@ -911,7 +911,7 @@ UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) //============================================================================= void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) { - if( comboBox == NULL ) + if( comboBox == nullptr ) return; GadgetTextEntrySetText(GadgetComboBoxGetEditBox(comboBox), text); @@ -923,7 +923,7 @@ void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return -1; return (Int)TheWindowManager->winSendSystemMsg( comboBox, GCM_ADD_ENTRY, (WindowMsgData)&text, color ); } @@ -933,7 +933,7 @@ Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color colo void GadgetComboBoxReset( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // reset via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_DEL_ALL, 0, 0 ); @@ -944,7 +944,7 @@ void GadgetComboBoxReset( GameWindow *comboBox ) void GadgetComboBoxHideList( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // reset via system message TheWindowManager->winSendSystemMsg( comboBox, GGM_CLOSE, 0, 0 ); @@ -955,7 +955,7 @@ void GadgetComboBoxHideList( GameWindow *comboBox ) void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // set the ListBox gadget's font @@ -986,7 +986,7 @@ void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) void GadgetComboBoxSetEnabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1002,7 +1002,7 @@ void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Colo { ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; if(comboBoxData->listBox) @@ -1016,7 +1016,7 @@ void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Colo void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1032,7 +1032,7 @@ void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1049,7 +1049,7 @@ void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get selected indeces via system message @@ -1064,7 +1064,7 @@ void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get selected indeces via system message @@ -1083,7 +1083,7 @@ void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ) //============================================================================= void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ) { - void *data = NULL; + void *data = nullptr; if (comboBox) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index 6f25d376361..8d8d4062286 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -432,8 +432,8 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI // ------------------------------------------------------------------------ case GWM_DESTROY: delete ( (SliderData *)window->winGetUserData() ); - window->winSetUserData(NULL); - s = NULL; + window->winSetUserData(nullptr); + s = nullptr; break; // ------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 9b4547a6cf2..8c4e2e252da 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -252,7 +252,7 @@ static void adjustDisplay( GameWindow *window, Int adjustment, list->displayPos = 0; } - if( list->slider != NULL ) + if( list->slider != nullptr ) { ICoord2D sliderSize, sliderChildSize; GameWindow *child; @@ -310,7 +310,7 @@ static void computeTotalHeight( GameWindow *window ) { DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; if(displayString) - displayString->getSize( NULL, &cellHeight ); + displayString->getSize( nullptr, &cellHeight ); } } else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) @@ -403,7 +403,7 @@ static Int moveRowsDown(ListboxData *list, Int startingRow) // // remove the display or links to images after the shift // - list->listData[startingRow].cell = NULL; + list->listData[startingRow].cell = nullptr; list->listData[startingRow].height = 0; list->listData[startingRow].listHeight = 0; @@ -513,7 +513,7 @@ static Int addEntry( UnicodeString *string, Int color, Int row, Int column, Game oldTotalHeight = list->listData[row-1].listHeight; } - displayString->getSize( NULL, &rowHeight ); + displayString->getSize( nullptr, &rowHeight ); if (rowHeight > oldRowHeight) { totalHeight = oldTotalHeight + (rowHeight - oldRowHeight); @@ -709,7 +709,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, if( position >= list->endPos) position = 0; - ListEntryCell *cell = NULL; + ListEntryCell *cell = nullptr; // go through the columns until we find a column with text Int j = 0; for(; j < list->columns; ++j) @@ -1361,11 +1361,11 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, } } - cells[j].userData = NULL; - cells[j].data = NULL; + cells[j].userData = nullptr; + cells[j].data = nullptr; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } //zero out the header structure memset(list->listData,0,list->listLength * sizeof(ListEntryRow)); @@ -1404,12 +1404,12 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, { if( cells[i].cellType == LISTBOX_TEXT && cells[i].data ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[i].data ); - cells[i].data = NULL; - cells[i].userData = NULL; + cells[i].data = nullptr; + cells[i].userData = nullptr; } delete[](list->listData[mData1].cell); - list->listData[mData1].cell = NULL; + list->listData[mData1].cell = nullptr; memcpy( &list->listData[mData1], &list->listData[(mData1+1)], (list->endPos - mData1 - 1) * sizeof(ListEntryRow) ); @@ -1713,7 +1713,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // Loop through and remove all the entries from the top up until we reach // the position mData1 contains // - ListEntryCell *cells = NULL; + ListEntryCell *cells = nullptr; Int i = 0; for (; i < (Int)mData1; i++) { @@ -1726,14 +1726,14 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); // free(cells[i].userData); - cells[j].data = NULL; - cells[j].userData = NULL; + cells[j].data = nullptr; + cells[j].userData = nullptr; cells[j].color = 0; cells[j].cellType = 0; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } @@ -1751,7 +1751,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // for(i = 0; i < (Int)mData1; i ++) { - list->listData[list->endPos + i].cell = NULL; + list->listData[list->endPos + i].cell = nullptr; } @@ -1827,7 +1827,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, ICoord2D downSize = {0, 0}; ICoord2D upSize = {0, 0}; ICoord2D sliderSize = {0, 0}; - GameWindow *child = NULL; + GameWindow *child = nullptr; ICoord2D sliderChildSize = {0, 0}; // get needed window sizes @@ -1960,11 +1960,11 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // free(cells[j].userData); // Null out the data pointers so they're not destroyed when we free up this listdata - cells[j].userData = NULL; - cells[j].data = NULL; + cells[j].userData = nullptr; + cells[j].data = nullptr; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } delete[]( list->listData ); @@ -1974,8 +1974,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, delete[]( list->selections ); delete (ListboxData *)window->winGetUserData(); - window->winSetUserData( NULL ); - list = NULL; + window->winSetUserData( nullptr ); + list = nullptr; break; @@ -2037,7 +2037,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, pos = (ICoord2D *)mData1; void **data = (void **)mData2; - *data = NULL; // initialize to NULL + *data = nullptr; // initialize to nullptr if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) *data = list->listData[pos->y].cell[pos->x].userData; @@ -2174,7 +2174,7 @@ UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, I { *color = 0; // sanity - if( listbox == NULL || row == -1 || column == -1) + if( listbox == nullptr || row == -1 || column == -1) return UnicodeString::TheEmptyString; // verify that this is a list box @@ -2217,7 +2217,7 @@ Int GadgetListBoxAddEntryText( GameWindow *listbox, addInfo.width = -1; ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if (listData == NULL) + if (listData == nullptr) return -1; Bool wasFull = (listData->listLength <= listData->endPos); Int newEntryOffset = (wasFull)?0:1; @@ -2355,7 +2355,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth -2, top+2, buttonWidth, buttonHeight, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); // ---------------------------------------------------------------------- // Create Bottom Button @@ -2375,7 +2375,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) width - buttonWidth -2, (top + bottom - buttonHeight -2), buttonWidth, buttonHeight, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); // ---------------------------------------------------------------------- // create the slider @@ -2404,7 +2404,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) width - sliderButtonWidth - 2, (top + buttonHeight + 3), sliderButtonWidth, bottom - (2 * buttonHeight) - 6, - &winInstData, &sData, NULL, TRUE ); + &winInstData, &sData, nullptr, TRUE ); // we now have all the scrollbar parts, this better be set :) listData->scrollBar = TRUE; @@ -2424,17 +2424,17 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) { ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - DEBUG_ASSERTCRASH(listboxData && listboxData->selections == NULL, ("selections is not NULL")); + DEBUG_ASSERTCRASH(listboxData && listboxData->selections == nullptr, ("selections is not null")); listboxData->selections = NEW Int [listboxData->listLength]; DEBUG_LOG(( "Enable list box multi select: listLength (select) = %d * %d = %d bytes;", listboxData->listLength, sizeof(Int), listboxData->listLength *sizeof(Int) )); - if( listboxData->selections == NULL ) + if( listboxData->selections == nullptr ) { delete[]( listboxData->listData ); - listboxData->listData = NULL; + listboxData->listData = nullptr; return; } @@ -2458,7 +2458,7 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) ListboxData *listData = (ListboxData *)listbox->winGetUserData(); delete[]( listData->selections ); - listData->selections = NULL; + listData->selections = nullptr; listData->multiSelect = FALSE; @@ -2543,7 +2543,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) } if (i >= newLength) { delete[](listboxData->listData[i].cell); - listboxData->listData[i].cell = NULL; + listboxData->listData[i].cell = nullptr; } } @@ -2556,7 +2556,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) computeTotalHeight(listbox); // Sanity check that everything was created properly - if( listboxData->listData == NULL ) + if( listboxData->listData == nullptr ) { DEBUG_LOG(( "Unable to allocate listbox data pointer" )); @@ -2623,7 +2623,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // get selected indeces via system message @@ -2639,7 +2639,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // set selected index via system message @@ -2653,7 +2653,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // set selected index via system message TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)selectList, selectCount ); @@ -2666,7 +2666,7 @@ void GadgetListBoxReset( GameWindow *listbox ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // reset via system message @@ -2691,7 +2691,7 @@ void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int col //------------------------------------------------------------------------------------------------- void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column) { - void *data = NULL; + void *data = nullptr; ICoord2D pos; pos.x = column; pos.y = row; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp index 66966c2d161..d798d23f0d6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp @@ -78,7 +78,7 @@ WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt ms // ------------------------------------------------------------------------ case GWM_DESTROY: { - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp index d0d860fa202..edd6c9326c2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp @@ -123,7 +123,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( BitIsSet( window->winGetStatus(), WIN_STATUS_CHECK_LIKE ) == FALSE ) if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) BitClear( instData->m_state, WIN_STATE_SELECTED ); - //TheWindowManager->winSetFocus( NULL ); + //TheWindowManager->winSetFocus( nullptr ); if(window->winGetParent() && BitIsSet(window->winGetParent()->winGetStyle(),GWS_HORZ_SLIDER) ) { WinInstanceData *instDataParent = window->winGetParent()->winGetInstanceData(); @@ -443,7 +443,7 @@ WindowMsgHandledType GadgetPushButtonSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { delete (PushButtonData *)window->winGetUserData(); - window->winSetUserData(NULL); + window->winSetUserData(nullptr); break; } @@ -482,12 +482,12 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; // get instance data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return; // sanity, must be a check like button @@ -518,12 +518,12 @@ Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ) { // sanity - if( g == NULL ) + if( g == nullptr ) return FALSE; // get instance data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return FALSE; // we just hold this "check like dual state thingie" using the selected state @@ -537,12 +537,12 @@ void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initia { // sanity - if( g == NULL ) + if( g == nullptr ) return; // get inst data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return; // make it check like @@ -566,7 +566,7 @@ void GadgetButtonSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); @@ -577,12 +577,12 @@ PushButtonData * getNewPushButtonData( void ) { PushButtonData *p = NEW PushButtonData; if(!p) - return NULL; + return nullptr; - p->userData = NULL; + p->userData = nullptr; p->drawBorder = FALSE; p->drawClock = NO_CLOCK; - p->overlayImage = NULL; + p->overlayImage = nullptr; return p; } @@ -591,7 +591,7 @@ PushButtonData * getNewPushButtonData( void ) //============================================================================= void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -610,7 +610,7 @@ void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -631,7 +631,7 @@ void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ) void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -648,7 +648,7 @@ void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ) void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -666,7 +666,7 @@ void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ) //============================================================================= void GadgetButtonSetData(GameWindow *g, void *data) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -683,13 +683,13 @@ void GadgetButtonSetData(GameWindow *g, void *data) //============================================================================= void *GadgetButtonGetData(GameWindow *g) { - if( g == NULL ) - return NULL; + if( g == nullptr ) + return nullptr; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); if(!pData) { - return NULL; + return nullptr; } return pData->userData; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp index 9ca37816ec7..de74e32a20e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp @@ -372,7 +372,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms { // free radio button user data delete (RadioButtonData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; @@ -411,7 +411,7 @@ void GadgetRadioSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); @@ -439,7 +439,7 @@ void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp index e9bdfe91d46..68a010e6bac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp @@ -160,7 +160,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg // free text data delete (TextData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp index d213f84c1f3..8262f771162 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp @@ -143,7 +143,7 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt { // free tab control user data delete (TabControlData *)tabControl->winGetUserData(); - tabControl->winSetUserData( NULL ); + tabControl->winSetUserData( nullptr ); break; @@ -282,7 +282,7 @@ void GadgetTabControlShowSubPane( GameWindow *tabControl, Int whichPane) for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) { - if( tabData->subPanes[paneIndex] != NULL ) + if( tabData->subPanes[paneIndex] != nullptr ) tabData->subPanes[paneIndex]->winHide( true ); } if( tabData->subPanes[whichPane] ) @@ -303,13 +303,13 @@ void GadgetTabControlCreateSubPanes( GameWindow *tabControl )///< Create User Wi for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) { - if( tabData->subPanes[paneIndex] == NULL )//This one is blank + if( tabData->subPanes[paneIndex] == nullptr )//This one is blank { tabData->subPanes[paneIndex] = TheWindowManager->winCreate( tabControl, WIN_STATUS_NONE, x, y, width, height, PassSelectedButtonsToParentSystem, - NULL); + nullptr); WinInstanceData *instData = tabData->subPanes[paneIndex]->winGetInstanceData(); BitSet( instData->m_style, GWS_TAB_PANE ); char buffer[20]; @@ -351,7 +351,7 @@ void GadgetTabControlFixupSubPaneList( GameWindow *tabControl ) GameWindow *child = tabControl->winGetChild(); if( child ) {//need to write down children, and they are reversed from our array - while( child->winGetNext() != NULL ) + while( child->winGetNext() != nullptr ) { child = child->winGetNext(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index 12f00fee588..b278e8599cc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -61,8 +61,8 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static Byte drawCnt = 0; -// static TbIME *ourIME = NULL; ///< @todo need this for IME kanji support -static GameWindow *curWindow = NULL; /**< so we can keep track of the input +// static TbIME *ourIME = nullptr; ///< @todo need this for IME kanji support +static GameWindow *curWindow = nullptr; /**< so we can keep track of the input window when using IME */ // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -202,7 +202,7 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if(parent) TheWindowManager->winNextTab(parent); else @@ -220,7 +220,7 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if(parent) TheWindowManager->winPrevTab(parent); else @@ -365,8 +365,8 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, // free all edit data delete( (EntryData *)window->winGetUserData() ); - window->winSetUserData(NULL); - e = NULL; + window->winSetUserData(nullptr); + e = nullptr; break; // ------------------------------------------------------------------------ @@ -376,7 +376,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, // If we're losing focus /// @todo need to enable this for IME support // ourIME->UnActivate(); - curWindow = NULL; + curWindow = nullptr; BitClear( instData->m_state, WIN_STATE_SELECTED ); BitClear( instData->m_state, WIN_STATE_HILITED ); @@ -385,7 +385,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, e->constructText->setText( UnicodeString::TheEmptyString ); e->conCharPos = 0; if(TheIMEManager && TheIMEManager->isAttachedTo(window)) - TheIMEManager->attach(NULL); + TheIMEManager->attach(nullptr); //TheIMEManager->detatch(); } else @@ -433,7 +433,7 @@ BoolCode InitializeEntryGadget( void ) BoolCode ShutdownEntryGadget( void ) { delete ourIME; - ourIME = NULL; + ourIME = nullptr; return TRUE; } @@ -443,7 +443,7 @@ void InformEntry( WideChar c ) Int i, listCount = 0; EntryData *e; - if( ourIME == NULL || curWindow == NULL ) + if( ourIME == nullptr || curWindow == nullptr ) return; e = (EntryData *)curWindow->winGetUserData(); @@ -495,7 +495,7 @@ void InformEntry( WideChar c ) else { Int maxWidth = 0; - ListboxData list = NULL; + ListboxData list = nullptr; ICoord2D constructSize, sliderSize; WinHide( e->constructList, FALSE ); @@ -513,7 +513,7 @@ void InformEntry( WideChar c ) WideChar *text = (WideChar *)ourIME->CandidateList_GetItem( i ); TheWindowManager->winGetTextSize( e->constructList->instData.font, - text, NULL, &tempWidth, 0 ); + text, nullptr, &tempWidth, 0 ); if( tempWidth > maxWidth ) maxWidth = tempWidth; @@ -570,7 +570,7 @@ UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) { // sanity - if( textentry == NULL ) + if( textentry == nullptr ) return UnicodeString::TheEmptyString; // verify that this is a list box diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index d11c549fa23..a87f92865a7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -421,8 +421,8 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt // ------------------------------------------------------------------------ case GWM_DESTROY: delete( (SliderData *)window->winGetUserData() ); - window->winSetUserData(NULL); - s = NULL; + window->winSetUserData(nullptr); + s = nullptr; break; // ------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp index 706ae0ffef1..258b7eb8baa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp @@ -32,7 +32,7 @@ #include "GameClient/GameFont.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -FontLibrary *TheFontLibrary = NULL; +FontLibrary *TheFontLibrary = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ void FontLibrary::linkFont( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return; // link it @@ -62,17 +62,17 @@ void FontLibrary::linkFont( GameFont *font ) //------------------------------------------------------------------------------------------------- void FontLibrary::unlinkFont( GameFont *font ) { - GameFont *other = NULL; + GameFont *other = nullptr; // sanity - if( font == NULL ) + if( font == nullptr ) return; // sanity check and make sure this font is actually in this library for( other = m_fontList; other; other = other->next ) if( other == font ) break; - if( other == NULL ) + if( other == nullptr ) { DEBUG_CRASH(( "Font '%s' not found in library", font->nameString.str() )); @@ -89,13 +89,13 @@ void FontLibrary::unlinkFont( GameFont *font ) // if nothing was fount this was at the head of the list, otherwise // remove from chain // - if( other == NULL ) + if( other == nullptr ) m_fontList = font->next; else other->next = font->next; // clean up this font we just unlinked just to be cool! - font->next = NULL; + font->next = nullptr; // we now have one less font on the list m_count--; @@ -138,7 +138,7 @@ void FontLibrary::deleteAllFonts( void ) FontLibrary::FontLibrary( void ) { - m_fontList = NULL; + m_fontList = nullptr; m_count = 0; } @@ -182,7 +182,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // TheSuperHackers @fix Now also no longer creates fonts with zero size. if (pointSize < 1 || pointSize > 100) { - return NULL; + return nullptr; } GameFont *font; @@ -201,11 +201,11 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // font not found, allocate a new font element font = newInstance(GameFont); - if( font == NULL ) + if( font == nullptr ) { DEBUG_CRASH(( "getFont: Unable to allocate new font list element" )); - return NULL; + return nullptr; } @@ -213,7 +213,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) font->nameString = name; font->pointSize = pointSize; font->bold = bold; - font->fontData = NULL; + font->fontData = nullptr; //DEBUG_LOG(("Font: Loading font '%s' %d point", font->nameString.str(), font->pointSize)); // load the device specific data pointer @@ -222,7 +222,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) DEBUG_CRASH(( "getFont: Unable to load font data pointer '%s'", name.str() )); deleteInstance(font); - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 3710e5d5bec..8e63e3a99b4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -94,9 +94,9 @@ GameWindow::GameWindow( void ) m_cursorX = 0; m_cursorY = 0; - m_userData = NULL; + m_userData = nullptr; - m_inputData = NULL; + m_inputData = nullptr; winSetDrawFunc( TheWindowManager->getDefaultDraw() ); winSetInputFunc( TheWindowManager->getDefaultInput() ); @@ -104,18 +104,18 @@ GameWindow::GameWindow( void ) // We use to set the default tooltip func to TheWindowManager->getDefaultTooltip() // but I removed this so that we can set in GUI edit a text string that will be the // default tool tip for a control. - winSetTooltipFunc( NULL ); + winSetTooltipFunc( nullptr ); - m_next = NULL; - m_prev = NULL; - m_parent = NULL; - m_child = NULL; + m_next = nullptr; + m_prev = nullptr; + m_parent = nullptr; + m_child = nullptr; - m_nextLayout = NULL; - m_prevLayout = NULL; - m_layout = NULL; + m_nextLayout = nullptr; + m_prevLayout = nullptr; + m_layout = nullptr; - m_editData = NULL; + m_editData = nullptr; } @@ -125,10 +125,10 @@ GameWindow::~GameWindow( void ) { delete m_inputData; - m_inputData = NULL; + m_inputData = nullptr; delete m_editData; - m_editData = NULL; + m_editData = nullptr; unlinkFromTransitionWindows(); @@ -306,11 +306,11 @@ GameWindow *GameWindow::findPrevLeaf( void ) if( leaf ) return leaf->findLastLeaf(); else - return NULL; + return nullptr; } - return NULL; + return nullptr; } @@ -328,7 +328,7 @@ GameWindow *GameWindow::findNextLeaf( void ) return leaf->m_next; for( leaf = leaf->m_next; leaf; leaf = leaf->m_child ) - if( leaf->m_child == NULL || BitIsSet( leaf->m_status, + if( leaf->m_child == nullptr || BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; @@ -345,7 +345,7 @@ GameWindow *GameWindow::findNextLeaf( void ) { for( leaf = leaf->m_next; leaf; leaf = leaf->m_child ) - if( leaf->m_child == NULL || + if( leaf->m_child == nullptr || BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; @@ -356,11 +356,11 @@ GameWindow *GameWindow::findNextLeaf( void ) if( leaf ) return leaf->findFirstLeaf(); else - return NULL; + return nullptr; } - return NULL; + return nullptr; } @@ -379,7 +379,7 @@ Int GameWindow::winNextTab( void ) do { - if( m_parent == NULL && firstTry ) + if( m_parent == nullptr && firstTry ) { newTab = findLastLeaf( newTab ); @@ -414,7 +414,7 @@ Int GameWindow::winPrevTab( void ) do { - if( m_parent == NULL && firstTry ) + if( m_parent == nullptr && firstTry ) { newTab = findFirstLeaf( newTab ); @@ -460,7 +460,7 @@ Int GameWindow::winBringToTop( void ) for( current = TheWindowManager->winGetWindowList(); current != this; current = current->m_next) - if (current == NULL) + if (current == nullptr) return WIN_ERR_INVALID_PARAMETER; // move to head of windowList @@ -537,7 +537,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) { // sanity - if( x == NULL || y == NULL ) + if( x == nullptr || y == nullptr ) return WIN_ERR_INVALID_PARAMETER; *x = m_region.lo.x; @@ -660,7 +660,7 @@ Int GameWindow::winGetSize( Int *width, Int *height ) { // sanity - if( width == NULL || height == NULL ) + if( width == nullptr || height == nullptr ) return WIN_ERR_INVALID_PARAMETER; *width = m_size.x; @@ -830,7 +830,7 @@ void GameWindow::winGetDrawOffset( Int *x, Int *y ) { // sanity - if( x == NULL || y == NULL ) + if( x == nullptr || y == nullptr ) return; *x = m_instData.m_imageOffset.x; @@ -1071,7 +1071,7 @@ Int GameWindow::winSetInstanceData( WinInstanceData *data ) m_instData.m_tooltip = tooltipText; // make sure we didn't try to copy over a video buffer. - m_instData.m_videoBuffer = NULL; + m_instData.m_videoBuffer = nullptr; // set our text display instance text if present if( data->getTextLength() ) @@ -1151,7 +1151,7 @@ Int GameWindow::winGetWindowId( void ) Int GameWindow::winSetParent( GameWindow *parent ) { - if( m_parent == NULL) + if( m_parent == nullptr) { // Top level window so unlink it TheWindowManager->unlinkWindow( this ); @@ -1162,12 +1162,12 @@ Int GameWindow::winSetParent( GameWindow *parent ) TheWindowManager->unlinkChildWindow( this ); } - if( parent == NULL ) + if( parent == nullptr ) { // Want to make it a top level window so add to window list TheWindowManager->linkWindow( this ); - m_parent = NULL; + m_parent = nullptr; } else @@ -1229,7 +1229,7 @@ GameWindow *GameWindow::winGetChild( void ) Int GameWindow::winSetOwner( GameWindow *owner ) { - if( owner == NULL ) + if( owner == nullptr ) m_instData.m_owner = this; else m_instData.m_owner = owner; @@ -1553,7 +1553,7 @@ WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, TheTacticalView->setMouseLock( FALSE ); TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index c6a8a72b642..88ca944604e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -133,7 +133,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) if( TheMappedImageCollection ) return TheMappedImageCollection->findImageByName( name ); - return NULL; + return nullptr; } @@ -185,7 +185,7 @@ void GameWindowManager::winGetTextSize( GameFont *font, UnicodeString text, Int GameWindowManager::winFontHeight( GameFont *font ) { - if (font == NULL) + if (font == nullptr) return 0; return font->height; @@ -234,7 +234,7 @@ GameFont *GameWindowManager::winFindFont( AsciiString fontName, if( TheFontLibrary ) return TheFontLibrary->getFont( fontName, pointSize, bold ); - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 2d43ebcc48e..3f1f07a8766 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -55,7 +55,7 @@ #include "Common/NameKeyGenerator.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameWindowManager *TheWindowManager = NULL; +GameWindowManager *TheWindowManager = nullptr; UnsignedInt WindowLayoutCurrentVersion = 2; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ void GameWindowManager::processDestroyList( void ) doDestroy = m_destroyList; // set the list to empty - m_destroyList = NULL; + m_destroyList = nullptr; // do the destroys for( ; doDestroy; doDestroy = next ) @@ -101,21 +101,21 @@ void GameWindowManager::processDestroyList( void ) winRelease( doDestroy ); if( m_keyboardFocus == doDestroy ) - winSetFocus( NULL ); + winSetFocus( nullptr ); - if( (m_modalHead != NULL) && (doDestroy == m_modalHead->window) ) + if( (m_modalHead != nullptr) && (doDestroy == m_modalHead->window) ) winUnsetModal( m_modalHead->window ); if( m_currMouseRgn == doDestroy ) - m_currMouseRgn = NULL; + m_currMouseRgn = nullptr; if( m_grabWindow == doDestroy ) - m_grabWindow = NULL; + m_grabWindow = nullptr; // send the destroy message to the window we're about to kill winSendSystemMsg( doDestroy, GWM_DESTROY, 0, 0 ); - DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == NULL, ("Win user data is expected to be deleted now")); + DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == nullptr, ("Win user data is expected to be deleted now")); // free the memory deleteInstance(doDestroy); @@ -136,7 +136,7 @@ WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, Unsi { // sanity - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; if( (msg == GBM_SELECTED) || (msg == GBM_SELECTED_RIGHT) || (msg == GBM_MOUSE_ENTERING) || (msg == GBM_MOUSE_LEAVING) || (msg == GEM_EDIT_DONE)) @@ -160,7 +160,7 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt { // sanity - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; @@ -179,19 +179,19 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt GameWindowManager::GameWindowManager( void ) { - m_windowList = NULL; // list of all top level windows - m_windowTail = NULL; // last in windowList + m_windowList = nullptr; // list of all top level windows + m_windowTail = nullptr; // last in windowList - m_destroyList = NULL; // list of windows to destroy + m_destroyList = nullptr; // list of windows to destroy - m_currMouseRgn = NULL; // window that mouse is over - m_mouseCaptor = NULL; // window that captured mouse - m_keyboardFocus = NULL; // window that has input focus - m_modalHead = NULL; // top of windows in the modal stack - m_grabWindow = NULL; // window that grabbed the last down event - m_loneWindow = NULL; // Set if we just opened a combo box + m_currMouseRgn = nullptr; // window that mouse is over + m_mouseCaptor = nullptr; // window that captured mouse + m_keyboardFocus = nullptr; // window that has input focus + m_modalHead = nullptr; // top of windows in the modal stack + m_grabWindow = nullptr; // window that grabbed the last down event + m_loneWindow = nullptr; // Set if we just opened a combo box - m_cursorBitmap = NULL; + m_cursorBitmap = nullptr; m_captureFlags = 0; } @@ -206,7 +206,7 @@ GameWindowManager::~GameWindowManager( void ) freeStaticStrings(); delete TheTransitionHandler; - TheTransitionHandler = NULL; + TheTransitionHandler = nullptr; } //------------------------------------------------------------------------------------------------- @@ -250,7 +250,7 @@ void GameWindowManager::update( void ) //------------------------------------------------------------------------------------------------- void GameWindowManager::linkWindow( GameWindow *window ) { - GameWindow *lastModalWindow = NULL; + GameWindow *lastModalWindow = nullptr; GameWindow *tmp = m_windowList; while (tmp) { @@ -270,7 +270,7 @@ void GameWindowManager::linkWindow( GameWindow *window ) { // Add to head of the top level window list - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = m_windowList; if( m_windowList ) @@ -307,11 +307,11 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, { // sanity - if( window == NULL ) + if( window == nullptr ) return; // we'll say that an aheadOf window means at the head of the list - if( aheadOf == NULL ) + if( aheadOf == nullptr ) { linkWindow( window ); @@ -326,7 +326,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, // if ahead of has no parent insert it in the master list just before // ahead of // - if( aheadOfParent == NULL ) + if( aheadOfParent == nullptr ) { window->m_prev = aheadOf->m_prev; @@ -405,20 +405,20 @@ void GameWindowManager::unlinkChildWindow( GameWindow *window ) window->m_next->m_prev = window->m_prev; - window->m_next = NULL; + window->m_next = nullptr; } else { - window->m_parent->m_child = NULL; + window->m_parent->m_child = nullptr; } } // remove the parent reference from this window - window->m_parent = NULL; + window->m_parent = nullptr; } @@ -429,7 +429,7 @@ Bool GameWindowManager::isEnabled( GameWindow *win ) { // sanity - if( win == NULL ) + if( win == nullptr ) return FALSE; if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) @@ -457,7 +457,7 @@ Bool GameWindowManager::isHidden( GameWindow *win ) { // we'll allow for the idea that if a window doesn't exist it is hidden - if( win == NULL ) + if( win == nullptr ) return TRUE; if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) @@ -488,7 +488,7 @@ void GameWindowManager::addWindowToParent( GameWindow *window, { // add to parent's list of children - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = parent->m_child; if( parent->m_child ) @@ -513,15 +513,15 @@ void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, if( parent ) { - window->m_prev = NULL; - window->m_next = NULL; + window->m_prev = nullptr; + window->m_next = nullptr; if( parent->m_child ) { GameWindow *last; // wind down to last child in list last = parent->m_child; - while( last->m_next != NULL ) + while( last->m_next != nullptr ) last = last->m_next; // tie to list @@ -547,7 +547,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) // if this window has keyboard focus remove it if( m_keyboardFocus == window ) - m_keyboardFocus = NULL; + m_keyboardFocus = nullptr; // if this is the modal head, unset it if( m_modalHead && m_modalHead->window == window ) @@ -555,7 +555,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) // if this is the captor, it shall no longer be if( m_mouseCaptor == window ) - winCapture( NULL ); + winCapture( nullptr ); // // since hiding a parent will also hide the children, when a parent @@ -616,7 +616,7 @@ void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, Int GameWindowManager::winCapture( GameWindow *window ) { - if( m_mouseCaptor != NULL) + if( m_mouseCaptor != nullptr) return WIN_ERR_MOUSE_CAPTURED; m_mouseCaptor = window; @@ -632,7 +632,7 @@ Int GameWindowManager::winRelease( GameWindow *window ) { if( window == m_mouseCaptor ) - m_mouseCaptor = NULL; + m_mouseCaptor = nullptr; return WIN_ERR_OK; @@ -654,7 +654,7 @@ GameWindow *GameWindowManager::winGetCapture( void ) GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) { - if( window == NULL ) + if( window == nullptr ) window = m_windowList; for( ; window; window = window->m_next ) @@ -673,7 +673,7 @@ GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) } - return NULL; + return nullptr; } @@ -696,7 +696,7 @@ WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, WindowMsgData mData2 ) { - if( window == NULL) + if( window == nullptr) return MSG_IGNORED; if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -715,7 +715,7 @@ WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, WindowMsgData mData2 ) { - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -771,15 +771,15 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) break; window = window->winGetParent(); - if( window == NULL ) + if( window == nullptr ) break; } } - // If new window doesn't want focus, set focus to NULL + // If new window doesn't want focus, set focus to nullptr if( wantsFocus == FALSE ) - m_keyboardFocus = NULL; + m_keyboardFocus = nullptr; return WIN_ERR_OK; @@ -808,7 +808,7 @@ WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, { win = win->winGetParent(); - if( win == NULL ) + if( win == nullptr ) { returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all @@ -834,8 +834,8 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; Bool objectTooltip = FALSE; UnsignedInt packedMouseCoords; - GameWindow *window = NULL; - GameWindow *toolTipWindow = NULL; + GameWindow *window = nullptr; + GameWindow *toolTipWindow = nullptr; Int dx, dy; Bool clearGrabWindow = FALSE; @@ -850,7 +850,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms { // no window grabbed as of yet - m_grabWindow = NULL; + m_grabWindow = nullptr; // what what window within the captured window are we in window = m_mouseCaptor->winPointInChild( mousePos->x, mousePos->y ); @@ -865,7 +865,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( win ) { - while( win != NULL ) + while( win != nullptr ) { if( winSendInputMsg( win, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) @@ -1008,11 +1008,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); // check !above, below and hidden - if( window == NULL ) + if( window == nullptr ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); // check below and !hidden - if( window == NULL ) + if( window == nullptr ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); } @@ -1022,7 +1022,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if(window->winGetParent() && BitIsSet( window->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) window = window->winGetParent(); else - window = NULL; + window = nullptr; } if( window ) @@ -1044,7 +1044,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms { tempWin = tempWin->m_parent; - if( tempWin == NULL ) + if( tempWin == nullptr ) break; } @@ -1055,7 +1055,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms &&( msg == GWM_LEFT_UP || msg == GWM_MIDDLE_UP || msg == GWM_RIGHT_UP || tempWin)) { if(!m_loneWindow->winIsChild(tempWin)) - winSetLoneWindow( NULL ); + winSetLoneWindow( nullptr ); /* ComboBoxData *cData = (ComboBoxData *)m_comboBoxOpen->winGetUserData(); // verify that the window that ate the message wasn't one of our own @@ -1066,7 +1066,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms cData->listboxData->downButton != tempWin && cData->listboxData->slider != tempWin && cData->listboxData->slider != tempWin->winGetParent()) - winSetOpenComboBoxWindow( NULL );*/ + winSetOpenComboBoxWindow( nullptr );*/ } if( tempWin ) @@ -1095,7 +1095,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } - if( toolTipWindow == NULL ) + if( toolTipWindow == nullptr ) { if( isHidden( window ) == FALSE ) @@ -1146,7 +1146,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // check if new current window is different from the last // but only if both windows fall within the mouseCaptor if one exists // - if( (m_grabWindow == NULL) && (window != m_currMouseRgn) ) + if( (m_grabWindow == nullptr) && (window != m_currMouseRgn) ) { if( m_mouseCaptor ) { @@ -1167,7 +1167,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( clearGrabWindow == TRUE ) { - m_grabWindow = NULL; + m_grabWindow = nullptr; clearGrabWindow = FALSE; } @@ -1193,7 +1193,7 @@ GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) continue; - if (toolTipWindow == NULL) + if (toolTipWindow == nullptr) { GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); @@ -1208,7 +1208,7 @@ GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1223,7 +1223,7 @@ Int GameWindowManager::drawWindow( GameWindow *window ) { GameWindow *child; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; if( BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) == FALSE ) @@ -1309,7 +1309,7 @@ void GameWindowManager::dumpWindow( GameWindow *window ) #ifndef FINAL GameWindow *child; - if( window == NULL ) + if( window == nullptr ) return; DEBUG_LOG(( "ID: %d\tRedraw: 0x%08X\tUser Data: %d", @@ -1336,7 +1336,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, // allocate new window window = allocateNewWindow(); - if( window == NULL ) + if( window == nullptr ) { DEBUG_LOG(( "WinCreate error: Could not allocate new window" )); @@ -1349,7 +1349,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, } #endif - return NULL; + return nullptr; } @@ -1400,14 +1400,14 @@ Int GameWindowManager::winDestroy( GameWindow *window ) { GameWindow *child, *next; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // // we should never have edit data allocated in the window code, it's // completely handled by the editor ONLY // - DEBUG_ASSERTCRASH( window->winGetEditData() == NULL, + DEBUG_ASSERTCRASH( window->winGetEditData() == nullptr, ("winDestroy(): edit data should NOT be present!") ); if( BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -1420,16 +1420,16 @@ Int GameWindowManager::winDestroy( GameWindow *window ) winRelease( window ); if( m_keyboardFocus == window ) - winSetFocus( NULL ); + winSetFocus( nullptr ); - if( (m_modalHead != NULL) && (window == m_modalHead->window) ) + if( (m_modalHead != nullptr) && (window == m_modalHead->window) ) winUnsetModal( m_modalHead->window ); if( m_currMouseRgn == window ) - m_currMouseRgn = NULL; + m_currMouseRgn = nullptr; if( m_grabWindow == window ) - m_grabWindow = NULL; + m_grabWindow = nullptr; for( child = window->m_child; child; child = next ) { @@ -1438,13 +1438,13 @@ Int GameWindowManager::winDestroy( GameWindow *window ) } // Remove the top level window from list - if( window->m_parent == NULL ) + if( window->m_parent == nullptr ) unlinkWindow( window ); else unlinkChildWindow( window ); // Add to head of the destroy list - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = m_destroyList; m_destroyList = window; @@ -1498,18 +1498,18 @@ Int GameWindowManager::winSetModal( GameWindow *window ) { ModalWindow *modal; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // verify requesting window is a root window - if( window->m_parent != NULL ) + if( window->m_parent != nullptr ) { DEBUG_LOG(( "WinSetModal: Non Root window attempted to go modal." )); return WIN_ERR_INVALID_PARAMETER; // return error if not } // Allocate new Modal Window Entry modal = newInstance(ModalWindow); - if( modal == NULL ) + if( modal == nullptr ) { DEBUG_LOG(( "WinSetModal: Unable to allocate space for Modal Entry." )); return WIN_ERR_GENERAL_FAILURE; @@ -1532,11 +1532,11 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) { ModalWindow *next; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // verify entry is at top of list - if( (m_modalHead == NULL) || (m_modalHead->window != window) ) + if( (m_modalHead == nullptr) || (m_modalHead->window != window) ) { // return error if not @@ -1613,9 +1613,9 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh // first check to make sure we have some buttons to display if(buttonFlags == 0 ) { - return NULL; + return nullptr; } - GameWindow *trueParent = NULL; + GameWindow *trueParent = nullptr; //Changed by Chris if(useLogo) trueParent = winCreateFromScript( "Menus/QuitMessageBox.wnd" ); @@ -1629,13 +1629,13 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh menuName.set("MessageBox.wnd:"); AsciiString tempName; - GameWindow *parent = NULL; + GameWindow *parent = nullptr; tempName = menuName; tempName.concat("MessageBoxParent"); parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); winSetModal( trueParent ); - winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves winSetFocus( parent ); // If the user wants the size to be different then the default @@ -1789,7 +1789,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, DEBUG_LOG(( "Cann't create button gadget, instance data not button type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1798,12 +1798,12 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, x, y, width, height, GadgetPushButtonSystem, instData ); - if( button == NULL ) + if( button == nullptr ) { DEBUG_LOG(( "Unable to create button for push button gadget" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1822,8 +1822,8 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, // set the owner to the parent, or if no parent it will be itself button->winSetOwner( parent ); - // Init the userdata to NULL - button->winSetUserData(NULL); + // Init the userdata to null + button->winSetUserData(nullptr); // assign the default images/colors assignDefaultGadgetLook( button, defaultFont, defaultVisual ); @@ -1857,7 +1857,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, DEBUG_LOG(( "Cann't create checkbox gadget, instance data not checkbox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1866,12 +1866,12 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, x, y, width, height, GadgetCheckBoxSystem, instData ); - if( checkbox == NULL ) + if( checkbox == nullptr ) { DEBUG_LOG(( "Unable to create checkbox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1924,7 +1924,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, DEBUG_LOG(( "Cann't create radioButton gadget, instance data not radioButton type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1933,12 +1933,12 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, x, y, width, height, GadgetRadioButtonSystem, instData ); - if( radioButton == NULL ) + if( radioButton == nullptr ) { DEBUG_LOG(( "Unable to create radio button window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1996,7 +1996,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, DEBUG_LOG(( "Cann't create tabControl gadget, instance data not tabControl type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2005,12 +2005,12 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, x, y, width, height, GadgetTabControlSystem, instData ); - if( tabControl == NULL ) + if( tabControl == nullptr ) { DEBUG_LOG(( "Unable to create tab control window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2068,7 +2068,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, DEBUG_LOG(( "Cann't create listbox gadget, instance data not listbox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2076,12 +2076,12 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listbox = winCreate( parent, status, x, y, width, height, GadgetListBoxSystem, instData ); - if( listbox == NULL ) + if( listbox == nullptr ) { DEBUG_LOG(( "Unable to create listbox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2163,10 +2163,10 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, else { if( !listboxData->columnWidthPercentage ) - return NULL; + return nullptr; listboxData->columnWidth = NEW Int[listboxData->columns]; if(!listboxData->columnWidth) - return NULL; + return nullptr; Int totalWidth = width; if( listboxData->slider ) @@ -2247,17 +2247,17 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, DEBUG_LOG(( "gogoGadgetSlider warning: unrecognized slider style." )); assert( 0 ); - return NULL; + return nullptr; } // sanity - if( slider == NULL ) + if( slider == nullptr ) { DEBUG_LOG(( "Unable to create slider control window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2282,10 +2282,10 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) button = gogoGadgetPushButton( slider, statusFlags, 0, HORIZONTAL_SLIDER_THUMB_POSITION, - HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, NULL, TRUE ); + HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, nullptr, TRUE ); else button = gogoGadgetPushButton( slider, statusFlags, 0, 0, - width, width+1, &buttonInstData, NULL, TRUE ); + width, width+1, &buttonInstData, nullptr, TRUE ); // Protect against divide by zero if( sliderData->maxVal == sliderData->minVal ) @@ -2336,7 +2336,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, DEBUG_LOG(( "Cann't create ComboBox gadget, instance data not ComboBox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2344,12 +2344,12 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, comboBox = winCreate( parent, status, x, y, width, height, GadgetComboBoxSystem, instData ); - if( comboBox == NULL ) + if( comboBox == nullptr ) { DEBUG_LOG(( "Unable to create ComboBox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2422,7 +2422,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth, 0, buttonWidth, height, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); comboBoxData->dropDownButton->winSetTooltipFunc(comboBox->winGetTooltipFunc()); comboBoxData->dropDownButton->winSetTooltip(instData->getTooltipText()); comboBoxData->dropDownButton->setTooltipDelay(comboBox->getTooltipDelay()); @@ -2540,7 +2540,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, DEBUG_LOG(( "Cann't create progressBar gadget, instance data not progressBar type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2549,12 +2549,12 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, x, y, width, height, GadgetProgressBarSystem, instData ); - if( progressBar == NULL ) + if( progressBar == nullptr ) { DEBUG_LOG(( "Unable to create progress bar control" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2605,10 +2605,10 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, else { DEBUG_LOG(( "gogoGadgetText warning: unrecognized text style." )); - return NULL; + return nullptr; } - if( textWin != NULL ) + if( textWin != nullptr ) { // set the owner to the parent, or if no parent it will be itself @@ -2622,7 +2622,7 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, textWin->winSetDrawFunc( getStaticTextDrawFunc() ); data = NEW TextData; - assert( textData != NULL ); + assert( textData != nullptr ); memcpy( data, textData, sizeof(TextData) ); // allocate a display string for the tet @@ -2668,19 +2668,19 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, DEBUG_LOG(( "Unable to create text entry, style not entry type" )); assert( 0 ); - return NULL; + return nullptr; } // create the window entry = winCreate( parent, status, x, y, width, height, GadgetTextEntrySystem, instData ); - if( entry == NULL ) + if( entry == nullptr ) { DEBUG_LOG(( "Unable to create text entry window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2733,7 +2733,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, entry->winSetUserData( data ); // asian languages get to have list box kanji character completion - data->constructList = NULL; + data->constructList = nullptr; if( OurLanguage == LANGUAGE_ID_KOREAN || OurLanguage == LANGUAGE_ID_JAPANESE ) { @@ -2753,11 +2753,11 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, lData.scrollBar = TRUE; lData.multiSelect = FALSE; lData.columns = 1; - lData.columnWidth = NULL; + lData.columnWidth = nullptr; boxInstData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - data->constructList = gogoGadgetListBox( NULL, + data->constructList = gogoGadgetListBox( nullptr, WIN_STATUS_ABOVE | WIN_STATUS_HIDDEN | WIN_STATUS_NO_FOCUS | @@ -2766,16 +2766,16 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, 110, 119, &boxInstData, &lData, - NULL, + nullptr, TRUE ); - if( data->constructList == NULL ) + if( data->constructList == nullptr ) { DEBUG_LOG(( "gogoGadgetEntry warning: Failed to create listbox." )); assert( 0 ); winDestroy( entry ); - return NULL; + return nullptr; } @@ -2836,7 +2836,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, WinInstanceData *instData; // sanity - if( gadget == NULL ) + if( gadget == nullptr ) return; // get instance data @@ -3549,7 +3549,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn return m_grabWindow->winPointInChild( x, y, ignoreEnabled ); } - GameWindow *window = NULL; + GameWindow *window = nullptr; if( m_modalHead && m_modalHead->window ) { return m_modalHead->window->winPointInChild( x, y, ignoreEnabled ); @@ -3577,7 +3577,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } // check !above, below and hidden - if( window == NULL ) + if( window == nullptr ) { for( window = m_windowList; window; window = window->m_next ) { @@ -3600,7 +3600,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } // check below and !hidden - if( window == NULL ) + if( window == nullptr ) { for( window = m_windowList; window; window = window->m_next ) { @@ -3627,11 +3627,11 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT )) { // this window does not accept input, discard - window = NULL; + window = nullptr; } else if( ignoreEnabled && !( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) )) { - window = NULL; + window = nullptr; } } @@ -3676,11 +3676,11 @@ Bool GameWindowManager::initTestGUI( void ) WinInstanceData instData; // make some windows inside each other in the upper left - window = winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - window = winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); + window = winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); @@ -3689,56 +3689,56 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "What Up?"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Enabled"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, WIN_STATUS_ENABLED, 330, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Disabled"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, 0, 450, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a check box instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a check box instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED, 330, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make window to hold radio buttons - window = winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, - 200, 200, 250, 45, NULL ); + window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); @@ -3755,7 +3755,7 @@ Bool GameWindowManager::initTestGUI( void ) 10, 10, 100, 30, &instData, - &rData, NULL, TRUE ); + &rData, nullptr, TRUE ); // make a radio button instData.init(); @@ -3766,7 +3766,7 @@ Bool GameWindowManager::initTestGUI( void ) 130, 10, 100, 30, &instData, - &rData, NULL, TRUE ); + &rData, nullptr, TRUE ); GadgetRadioSetEnabledColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); GadgetRadioSetEnabledBorderColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); @@ -3781,15 +3781,15 @@ Bool GameWindowManager::initTestGUI( void ) listData.multiSelect = 1; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; + listData.columnWidth = nullptr; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( NULL, + window = gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", winMakeColor( 255, 255, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"More text", @@ -3814,15 +3814,15 @@ Bool GameWindowManager::initTestGUI( void ) listData.multiSelect = 0; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; + listData.columnWidth = nullptr; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( NULL, + window = gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", winMakeColor( 255, 255, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"More text", @@ -3845,12 +3845,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED, 360, 250, 11, 100, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a vert slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3860,12 +3860,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 400, 250, 11, 100, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a horizontal slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3875,12 +3875,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED, 200, 400, 200, 11, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a horizontal slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3890,30 +3890,30 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 420, 200, 11, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( nullptr, WIN_STATUS_ENABLED, 200, 450, 250, 15, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 470, 250, 15, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make some static text TextData textData; @@ -3921,24 +3921,24 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Centered Static Text"; - window = gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED, 200, 490, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); // make some static text textData.centered = 0; instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Not Centered Static Text"; - window = gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), winMakeColor( 255, 255, 255, 255 ) ); @@ -3949,12 +3949,12 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( nullptr, WIN_STATUS_ENABLED, 450, 270, 400, 30, &instData, - &entryData, NULL, TRUE ); + &entryData, nullptr, TRUE ); // make some entry text memset( &entryData, 0, sizeof( entryData ) ); @@ -3962,12 +3962,12 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 450, 310, 400, 30, &instData, - &entryData, NULL, TRUE ); + &entryData, nullptr, TRUE ); return TRUE; @@ -3995,7 +3995,7 @@ void GameWindowManager::winNextTab( GameWindow *window ) { winSetFocus(*m_tabList.begin()); } - winSetLoneWindow(NULL); + winSetLoneWindow(nullptr); } void GameWindowManager::winPrevTab( GameWindow *window ) @@ -4019,7 +4019,7 @@ void GameWindowManager::winPrevTab( GameWindow *window ) { winSetFocus(*m_tabList.rbegin()); } - winSetLoneWindow(NULL); + winSetLoneWindow(nullptr); } void GameWindowManager::registerTabList( GameWindowList tabList ) @@ -4037,7 +4037,7 @@ void GameWindowManager::clearTabList( void ) GameWindow *GameWindowManagerDummy::winGetWindowFromId(GameWindow *window, Int id) { window = GameWindowManager::winGetWindowFromId(window, id); - if (window != NULL) + if (window != nullptr) return window; // Just return any window, callers expect this to be non-null @@ -4052,7 +4052,7 @@ WindowMsgHandledType DummyWindowSystem(GameWindow *window, UnsignedInt msg, Wind GameWindow *GameWindowManagerDummy::winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) { WindowLayoutInfo scriptInfo; - GameWindow* dummyWindow = winCreate(NULL, 0, 0, 0, 100, 100, DummyWindowSystem, NULL); + GameWindow* dummyWindow = winCreate(nullptr, 0, 0, 0, 100, 100, DummyWindowSystem, nullptr); scriptInfo.windows.push_back(dummyWindow); if (info) *info = scriptInfo; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index ae800d56ce6..ee0598424fd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -115,10 +115,10 @@ struct GameWindowParse /////////////////////////////////////////////////////////////////////////////// // window methods and their string representations -static GameWinSystemFunc systemFunc = NULL; -static GameWinInputFunc inputFunc = NULL; -static GameWinTooltipFunc tooltipFunc = NULL; -static GameWinDrawFunc drawFunc = NULL; +static GameWinSystemFunc systemFunc = nullptr; +static GameWinInputFunc inputFunc = nullptr; +static GameWinTooltipFunc tooltipFunc = nullptr; +static GameWinDrawFunc drawFunc = nullptr; static AsciiString theSystemString; static AsciiString theInputString; static AsciiString theTooltipString; @@ -131,7 +131,7 @@ static Color defBackgroundColor = 0; static Color defHiliteColor = 0; static Color defSelectedColor = 0; static Color defTextColor = 0; -static GameFont *defFont = NULL; +static GameFont *defFont = nullptr; // // These strings must be in the same order as they are in their definitions @@ -143,7 +143,7 @@ const char *const WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABL "SMOOTH_TEXT", "ONE_LINE", "NO_FLUSH", "SEE_THRU", "RIGHT_CLICK", "WRAP_CENTERED", "CHECK_LIKE","HOTKEY_TEXT", "USE_OVERLAY_STATES", "NOT_READY", "FLASHING", "ALWAYS_COLOR", - NULL }; + nullptr }; const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", "VERTSLIDER", "HORZSLIDER", "SCROLLLISTBOX", @@ -151,7 +151,7 @@ const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX" "USER", "MOUSETRACK", "ANIMATED", "TABSTOP", "TABCONTROL", "TABPANE", "COMBOBOX", - NULL }; + nullptr }; // Implement a stack to keep track of parent/child nested window descriptions. static GameWindow *windowStack[ WIN_STACK_DEPTH ]; @@ -235,7 +235,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPt if( strncmp( buffer, "NULL", 4 ) != 0 ) { - for( tok = strtok( buffer, "+" ); tok; tok = strtok( NULL, "+" ) ) + for( tok = strtok( buffer, "+" ); tok; tok = strtok( nullptr, "+" ) ) { if ( !parseBitFlag( tok, bits, flagList ) ) { @@ -353,7 +353,7 @@ static void resetWindowDefaults( void ) defHiliteColor = 0; defSelectedColor = 0; defTextColor = 0; - defFont = 0; + defFont = nullptr; } @@ -362,7 +362,7 @@ static void resetWindowDefaults( void ) static GameWindow *peekWindow( void ) { if (stackPtr == windowStack) - return NULL; + return nullptr; return *(stackPtr - 1); @@ -374,7 +374,7 @@ static GameWindow *popWindow( void ) { if( stackPtr == windowStack ) - return NULL; + return nullptr; stackPtr--; return *stackPtr; @@ -410,10 +410,10 @@ static Bool parseColor( Color *color, char *buffer ) c = strtok( buffer, " \t\n\r" ); red = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); green = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); blue = atoi(c); *color = TheWindowManager->winMakeColor( red, green, blue, 255 ); @@ -465,7 +465,7 @@ static Bool parseDefaultFont( GameFont *font, File *inFile, char *buffer ) /// @todo font parsing for window files work needed here // *font = GetFont( buffer ); -// if( *font == NULL ) +// if( *font == nullptr ) // return FALSE; return TRUE; @@ -502,22 +502,22 @@ static Bool parseScreenRect( const char *token, char *buffer, const char *seps = " ,:=\n\r\t"; char *c; - c = strtok( NULL, seps ); // UPPERLEFT token - c = strtok( NULL, seps ); // x position + c = strtok( nullptr, seps ); // UPPERLEFT token + c = strtok( nullptr, seps ); // x position scanInt( c, screenRegion.lo.x ); - c = strtok( NULL, seps ); // y posotion + c = strtok( nullptr, seps ); // y posotion scanInt( c, screenRegion.lo.y ); - c = strtok( NULL, seps ); // BOTTOMRIGHT token - c = strtok( NULL, seps ); // x position + c = strtok( nullptr, seps ); // BOTTOMRIGHT token + c = strtok( nullptr, seps ); // x position scanInt( c, screenRegion.hi.x ); - c = strtok( NULL, seps ); // y posotion + c = strtok( nullptr, seps ); // y posotion scanInt( c, screenRegion.hi.y ); - c = strtok( NULL, seps ); // CREATIONRESOLUTION token - c = strtok( NULL, seps ); // x creation resolution + c = strtok( nullptr, seps ); // CREATIONRESOLUTION token + c = strtok( nullptr, seps ); // x creation resolution scanInt( c, createRes.x ); - c = strtok( NULL, seps ); // y creation resolution + c = strtok( nullptr, seps ); // y creation resolution scanInt( c, createRes.y ); // @@ -576,7 +576,7 @@ static Bool parseImageOffset( const char *token, WinInstanceData *instData, c = strtok( buffer, " \t\n\r" ); instData->m_imageOffset.x = atoi( c ); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); instData->m_imageOffset.y = atoi( c ); return TRUE; @@ -607,13 +607,13 @@ static Bool parseFont( const char *token, WinInstanceData *instData, strlcpy(fontName, c, ARRAY_SIZE(fontName)); // "SIZE" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, fontSize ); // "BOLD" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, fontBold ); if( TheFontLibrary ) @@ -828,21 +828,21 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // "LENGTH" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); + c = strtok( nullptr, seps ); scanShort( c, listData->listLength ); // "AUTOSCROLL" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->autoScroll ); // "SCROLLIFATEND" (optional) - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label if ( stricmp(c, "ScrollIfAtEnd") == 0 ) { - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, listData->scrollIfAtEnd ); - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label } else { @@ -850,22 +850,22 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, } // "AUTOPURGE" - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, listData->autoPurge ); // "SCROLLBAR" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->scrollBar ); // "MULTISELECT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->multiSelect ); // "COLUMNS" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanShort( c, listData->columns ); if(listData->columns > 1) { @@ -873,17 +873,17 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, for(Int i = 0; i < listData->columns; i++ ) { // "COLUMNS" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, listData->columnWidthPercentage[i] ); } } else - listData->columnWidthPercentage = NULL; - listData->columnWidth = NULL; + listData->columnWidthPercentage = nullptr; + listData->columnWidth = nullptr; // "FORCESELECT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->forceSelect ); @@ -903,23 +903,23 @@ static Bool parseComboBoxData( const char *token, WinInstanceData *instData, const char *seps = " :,\n\r\t"; c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, comboData->isEditable ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, comboData->maxChars ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, comboData->maxDisplay ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, comboData->asciiOnly ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, comboData->lettersAndNumbersOnly ); @@ -938,12 +938,12 @@ static Bool parseSliderData( const char *token, WinInstanceData *instData, // "MINVALUE" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, sliderData->minVal ); // "MAXVALUE" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, sliderData->maxVal ); return TRUE; @@ -962,7 +962,7 @@ static Bool parseRadioButtonData( const char *token, WinInstanceData *instData, // "GROUP" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, radioData->group ); return TRUE; @@ -1089,27 +1089,27 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, if( first == TRUE ) c = strtok( buffer, seps ); // label else - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label first = FALSE; - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); textData->color = GameMakeColor( r, g, b, a ); // border color - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); textData->borderColor = GameMakeColor( r, g, b, a ); @@ -1131,7 +1131,7 @@ static Bool parseStaticTextData( const char *token, WinInstanceData *instData, // "CENTERED" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, textData->centered ); return TRUE; @@ -1150,27 +1150,27 @@ static Bool parseTextEntryData( const char *token, WinInstanceData *instData, // "MAXLEN" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanShort( c, entryData->maxTextLen ); // "SECRETTEXT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->secretText ); // "NUMERICALONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->numericalOnly ); // "ALPHANUMERICALONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->alphaNumericalOnly ); // "ASCIIONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->aSCIIOnly ); return TRUE; @@ -1189,43 +1189,43 @@ static Bool parseTabControlData( const char *token, WinInstanceData *instData, //TABORIENTATION c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabOrientation ); //TABEDGE - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabEdge ); //TABWIDTH - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabWidth ); //TABHEIGHT - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabHeight ); //TABCOUNT - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabCount ); //PANEBORDER - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->paneBorder ); //PANEDISABLED Int entryCount = 0; - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, entryCount ); for( Int paneIndex = 0; paneIndex < entryCount; paneIndex ++ ) { - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, tabControlData->subPaneDisabled[paneIndex] ); } @@ -1310,35 +1310,35 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, if( first == TRUE ) c = strtok( buffer, seps ); // label else - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label first = FALSE; - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value if( strcmp( c, "NoImage" ) != 0 ) drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); else - drawData->image = NULL; + drawData->image = nullptr; // COLOR: R G B A - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); drawData->color = GameMakeColor( r, g, b, a ); // BORDERCOLOR: R G B A - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); drawData->borderColor = GameMakeColor( r, g, b, a ); @@ -1410,7 +1410,7 @@ void *getDataTemplate( char *type ) data = &cData; } else - data = NULL; + data = nullptr; return data; @@ -1454,7 +1454,7 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); sData.minVal = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); sData.maxVal = atoi(c); *data = &sData; @@ -1468,22 +1468,22 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); lData.listLength = atoi(c); -// c = strtok( NULL, " \t\n\r" ); +// c = strtok( nullptr, " \t\n\r" ); // lData.entryHeight = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.autoScroll = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.autoPurge = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.scrollBar = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.multiSelect = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.forceSelect = atoi(c); *data = &lData; @@ -1497,13 +1497,13 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); eData.maxTextLen = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); // if (c) // eData.entryWidth = atoi(c); // else // eData.entryWidth = -1; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); if (c) { eData.secretText = atoi(c); @@ -1514,7 +1514,7 @@ static Bool parseData( void **data, char *type, char *buffer ) else eData.secretText = FALSE; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); if (c) { eData.numericalOnly = ( atoi(c) == 1 ); @@ -1539,7 +1539,7 @@ static Bool parseData( void **data, char *type, char *buffer ) if( tData.centered != FALSE ) tData.centered = TRUE; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); /** @todo need to get a label from the translation manager, uncomment the following line and remove the WideChar assignment when @@ -1564,7 +1564,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &rData; } else - *data = NULL; + *data = nullptr; return TRUE; @@ -1613,7 +1613,7 @@ static GameWindow *createGadget( char *type, WinInstanceData *instData, void *data ) { - GameWindow *window = NULL; + GameWindow *window = nullptr; instData->m_owner = parent; @@ -1845,8 +1845,8 @@ static GameWindow *createGadget( char *type, cData->listboxData->multiSelect = 0; cData->listboxData->forceSelect = 1; cData->listboxData->columns = 1; - cData->listboxData->columnWidth = NULL; - cData->listboxData->columnWidthPercentage = NULL; + cData->listboxData->columnWidth = nullptr; + cData->listboxData->columnWidthPercentage = nullptr; instData->m_style |= GWS_COMBO_BOX; window = TheWindowManager->gogoGadgetComboBox( parent, status, x, y, @@ -2081,7 +2081,7 @@ static GameWindow *createWindow( char *type, } - // assign the callbacks if they are not empty/NULL, that means they were read + // assign the callbacks if they are not empty/nullptr, that means they were read // in and parsed from the window definition file if( window ) { @@ -2140,7 +2140,7 @@ static Bool parseChildWindows( GameWindow *window, //of the ones from the script file. So kill them before reading. if( BitIsSet( window->winGetStyle(), GWS_TAB_CONTROL ) ) { - GameWindow *nextWindow = NULL; + GameWindow *nextWindow = nullptr; for( GameWindow *myChild = window->winGetChild(); myChild; myChild = nextWindow ) { nextWindow = myChild->winGetNext(); @@ -2215,7 +2215,7 @@ static Bool parseChildWindows( GameWindow *window, { // Parse window descriptions until the last END is read - if( parseWindow( inFile, buffer ) == NULL ) + if( parseWindow( inFile, buffer ) == nullptr ) { return FALSE; } @@ -2295,7 +2295,7 @@ static GameWindowParse gameWindowFieldList[] = { "IMAGEOFFSET", parseImageOffset }, { "TOOLTIP", parseTooltip }, - { NULL, NULL } + { nullptr, nullptr } }; // parseWindow ================================================================ @@ -2304,14 +2304,14 @@ static GameWindowParse gameWindowFieldList[] = static GameWindow *parseWindow( File *inFile, char *buffer ) { GameWindowParse *parse; - GameWindow *window = NULL; + GameWindow *window = nullptr; GameWindow *parent = peekWindow(); WinInstanceData instData; char type[64]; char token[ 256 ]; char *c; Int x, y, width, height; - void *data = NULL; + void *data = nullptr; ICoord2D parentSize; AsciiString asciibuf; @@ -2319,10 +2319,10 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) // reset our 'static globals' that house the current parsed window callback // definitions to empty // - systemFunc = NULL; - inputFunc = NULL; - tooltipFunc = NULL; - drawFunc = NULL; + systemFunc = nullptr; + inputFunc = nullptr; + tooltipFunc = nullptr; + drawFunc = nullptr; theSystemString.clear(); theInputString.clear(); theTooltipString.clear(); @@ -2361,7 +2361,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) readUntilSemicolon( inFile, buffer, WIN_BUFFER_LENGTH ); c = strtok( buffer, seps ); assert( strcmp( c, "WINDOWTYPE" ) == 0 ); - c = strtok( NULL, seps ); // get data to right of = sign + c = strtok( nullptr, seps ); // get data to right of = sign strlcpy(type, c, ARRAY_SIZE(type)); // @@ -2409,7 +2409,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) } - if( parse->parse == NULL ) + if( parse->parse == nullptr ) { // If it's the END keyword @@ -2435,7 +2435,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) instData.m_font = TheHeaderTemplateManager->getFontFromTemplate(instData.m_headerTemplateName); // Create a window using the current description - if( window == NULL ) + if( window == nullptr ) window = createWindow( type, instData.m_id, instData.getStatus(), x, y, width, height, &instData, data, systemFunc, inputFunc, tooltipFunc, drawFunc ); @@ -2452,7 +2452,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) width, height, &instData, data, systemFunc, inputFunc, tooltipFunc, drawFunc ); - if (window == NULL) + if (window == nullptr) goto cleanupAndExit; // Parses the CHILD's window info. @@ -2460,7 +2460,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) { TheWindowManager->winDestroy( window ); - window = NULL; + window = nullptr; goto cleanupAndExit; } @@ -2487,7 +2487,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) // // I am commenting this out to get tooltips working, If for // some reason we start having displayString problems... CLH -// assert( instData.m_text == NULL && instData.m_tooltip == NULL ); +// assert( instData.m_text == nullptr && instData.m_tooltip == nullptr ); return window; @@ -2560,7 +2560,7 @@ static LayoutScriptParse layoutScriptTable[] = { "LAYOUTUPDATE", parseUpdate }, { "LAYOUTSHUTDOWN", parseShutdown }, - { NULL, NULL }, + { nullptr, nullptr }, }; @@ -2645,7 +2645,7 @@ WindowLayout *GameWindowManager::winCreateLayout( AsciiString filename ) { deleteInstance(layout); - return NULL; + return nullptr; } @@ -2667,9 +2667,9 @@ void GameWindowManager::freeStaticStrings(void) WindowLayoutInfo::WindowLayoutInfo() : version(0), - init(NULL), - update(NULL), - shutdown(NULL), + init(nullptr), + update(nullptr), + shutdown(nullptr), initNameString(AsciiString::TheEmptyString), updateNameString(AsciiString::TheEmptyString), shutdownNameString(AsciiString::TheEmptyString) @@ -2692,7 +2692,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, { const char* filename = filenameString.str(); static char buffer[ WIN_BUFFER_LENGTH ]; // input buffer for reading - GameWindow *firstWindow = NULL; + GameWindow *firstWindow = nullptr; GameWindow *window; char filepath[ _MAX_PATH ] = "Window\\"; File *inFile; @@ -2713,22 +2713,22 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // a filename only make sure the current directory is set to the right // place for the window files subdirectory // - if( strchr( filename, '\\' ) == NULL ) + if( strchr( filename, '\\' ) == nullptr ) sprintf( filepath, "Window\\%s", filename ); else strlcpy(filepath, filename, ARRAY_SIZE(filepath)); // Open the input file inFile = TheFileSystem->openFile(filepath, File::READ); - if (inFile == NULL) + if (inFile == nullptr) { DEBUG_LOG(( "WinCreateFromScript: Cannot access file '%s'.", filename )); - return NULL; + return nullptr; } // read the file version Int version; - inFile->read(NULL, strlen("FILE_VERSION = ")); + inFile->read(nullptr, strlen("FILE_VERSION = ")); inFile->scanInt(version); inFile->nextLine(); @@ -2772,8 +2772,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defEnabledColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2783,8 +2783,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defDisabledColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2794,8 +2794,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defHiliteColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2805,8 +2805,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defSelectedColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2816,8 +2816,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defTextColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2827,8 +2827,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defBackgroundColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2838,8 +2838,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultFont( defFont, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2850,7 +2850,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, window = parseWindow( inFile, buffer ); // save first window created - if( firstWindow == NULL ) + if( firstWindow == nullptr ) firstWindow = window; scriptInfo.windows.push_back(window); @@ -2861,7 +2861,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // close the file inFile->close(); - inFile = NULL; + inFile = nullptr; // if info parameter is provided, copy info to the param if( info ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index deb9c35465a..f9913bfed2a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -58,14 +58,14 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -GameWindowTransitionsHandler *TheTransitionHandler = NULL; +GameWindowTransitionsHandler *TheTransitionHandler = nullptr; const FieldParse GameWindowTransitionsHandler::m_gameWindowTransitionsFieldParseTable[] = { - { "Window", GameWindowTransitionsHandler::parseWindow, NULL, NULL }, - { "FireOnce", INI::parseBool, NULL, offsetof( TransitionGroup, m_fireOnce) }, + { "Window", GameWindowTransitionsHandler::parseWindow, nullptr, 0 }, + { "FireOnce", INI::parseBool, nullptr, offsetof( TransitionGroup, m_fireOnce) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -136,9 +136,9 @@ Transition *getTransitionForStyle( Int style ) default: DEBUG_ASSERTCRASH(FALSE, ("getTransitionForStyle:: An invalid style was passed in. Style = %d", style)); - return NULL; + return nullptr; } - return NULL; + return nullptr; } TransitionWindow::TransitionWindow( void ) @@ -147,8 +147,8 @@ TransitionWindow::TransitionWindow( void ) m_style = 0; m_winID = NAMEKEY_INVALID; - m_win = NULL; - m_transition = NULL; + m_win = nullptr; + m_transition = nullptr; } TransitionWindow::~TransitionWindow( void ) @@ -156,16 +156,16 @@ TransitionWindow::~TransitionWindow( void ) if (m_win) m_win->unlinkTransitionWindow(this); - m_win = NULL; + m_win = nullptr; delete m_transition; - m_transition = NULL; + m_transition = nullptr; } Bool TransitionWindow::init( void ) { m_winID = TheNameKeyGenerator->nameToKey(m_winName); - m_win = TheWindowManager->winGetWindowFromId(NULL, m_winID); + m_win = TheWindowManager->winGetWindowFromId(nullptr, m_winID); m_currentFrameDelay = m_frameDelay; // DEBUG_ASSERTCRASH( m_win, ("TransitionWindow::init Failed to find window %s", m_winName.str())); // if( !m_win ) @@ -223,7 +223,7 @@ void TransitionWindow::unlinkGameWindow(GameWindow* win) return; m_transition->unlinkGameWindow(win); - m_win = NULL; + m_win = nullptr; } Int TransitionWindow::getTotalFrames( void ) @@ -359,19 +359,19 @@ void TransitionGroup::addWindow( TransitionWindow *transWin ) GameWindowTransitionsHandler::GameWindowTransitionsHandler(void) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } GameWindowTransitionsHandler::~GameWindowTransitionsHandler( void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; TransitionGroupList::iterator it = m_transitionGroupList.begin(); while( it != m_transitionGroupList.end() ) @@ -384,26 +384,26 @@ GameWindowTransitionsHandler::~GameWindowTransitionsHandler( void ) void GameWindowTransitionsHandler::init(void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } void GameWindowTransitionsHandler::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\WindowTransitions", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\WindowTransitions", INI_LOAD_OVERWRITE, nullptr ); } void GameWindowTransitionsHandler::reset( void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } @@ -412,7 +412,7 @@ void GameWindowTransitionsHandler::update( void ) if(m_drawGroup != m_currentGroup) m_secondaryDrawGroup = m_drawGroup; else - m_secondaryDrawGroup = NULL; + m_secondaryDrawGroup = nullptr; m_drawGroup = m_currentGroup; if(m_currentGroup && !m_currentGroup->isFinished()) @@ -420,23 +420,23 @@ void GameWindowTransitionsHandler::update( void ) if(m_currentGroup && m_currentGroup->isFinished() && m_currentGroup->isFireOnce()) { - m_currentGroup = NULL; + m_currentGroup = nullptr; } if(m_currentGroup && m_pendingGroup && m_currentGroup->isFinished()) { m_currentGroup = m_pendingGroup; - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(!m_currentGroup && m_pendingGroup) { m_currentGroup = m_pendingGroup; - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(m_currentGroup && m_currentGroup->isFinished() && m_currentGroup->isReversed()) - m_currentGroup = NULL; + m_currentGroup = nullptr; } @@ -452,7 +452,7 @@ void GameWindowTransitionsHandler::draw( void ) void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immidiate ) { if(groupName.isEmpty() && immidiate) - m_currentGroup = NULL; + m_currentGroup = nullptr; if(immidiate && m_currentGroup) { m_currentGroup->skip(); @@ -490,7 +490,7 @@ void GameWindowTransitionsHandler::reverse( AsciiString groupName ) } if( m_pendingGroup == g) { - m_pendingGroup = NULL; + m_pendingGroup = nullptr; return; } if(m_currentGroup) @@ -502,7 +502,7 @@ void GameWindowTransitionsHandler::reverse( AsciiString groupName ) m_currentGroup->init(); m_currentGroup->skip(); m_currentGroup->reverse(); - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPending ) @@ -513,12 +513,12 @@ void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPend if(skipPending) m_pendingGroup->skip(); - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(m_currentGroup == g) { m_currentGroup->skip(); - m_currentGroup = NULL; + m_currentGroup = nullptr; if(m_pendingGroup) m_currentGroup = m_pendingGroup; } @@ -527,13 +527,13 @@ void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPend TransitionGroup *GameWindowTransitionsHandler::getNewGroup( AsciiString name ) { if(name.isEmpty()) - return NULL; + return nullptr; // test to see if we're trying to add an already exisitng group. if(findGroup(name)) { DEBUG_ASSERTCRASH(FALSE, ("GameWindowTransitionsHandler::getNewGroup - We already have a group %s", name.str())); - return NULL; + return nullptr; } TransitionGroup *g = NEW TransitionGroup; g->setName(name); @@ -554,7 +554,7 @@ Bool GameWindowTransitionsHandler::isFinished( void ) TransitionGroup *GameWindowTransitionsHandler::findGroup( AsciiString groupName ) { if(groupName.isEmpty()) - return NULL; + return nullptr; TransitionGroupList::iterator it = m_transitionGroupList.begin(); while( it != m_transitionGroupList.end() ) @@ -564,17 +564,17 @@ TransitionGroup *GameWindowTransitionsHandler::findGroup( AsciiString groupName return g; it++; } - return NULL; + return nullptr; } void GameWindowTransitionsHandler::parseWindow( INI* ini, void *instance, void *store, const void *userData ) { static const FieldParse myFieldParse[] = { - { "WinName", INI::parseAsciiString, NULL, offsetof( TransitionWindow, m_winName ) }, + { "WinName", INI::parseAsciiString, nullptr, offsetof( TransitionWindow, m_winName ) }, { "Style", INI::parseLookupList, TransitionStyleNames, offsetof( TransitionWindow, m_style ) }, - { "FrameDelay", INI::parseInt, NULL, offsetof( TransitionWindow, m_frameDelay ) }, - { NULL, NULL, NULL, 0 } + { "FrameDelay", INI::parseInt, nullptr, offsetof( TransitionWindow, m_frameDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; TransitionWindow *transWin = NEW TransitionWindow; ini->initFromINI(transWin, myFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index 72fe21b80d7..62a048a7778 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -83,14 +83,14 @@ Transition::~Transition( void ) FlashTransition::FlashTransition ( void ) { m_frameLength = FLASHTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } FlashTransition::~FlashTransition( void ) { - m_win = NULL; + m_win = nullptr; } void FlashTransition::init( GameWindow *win ) @@ -239,14 +239,14 @@ void FlashTransition::skip( void ) ButtonFlashTransition::ButtonFlashTransition ( void ) { m_frameLength = BUTTONFLASHTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ButtonFlashTransition::~ButtonFlashTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ButtonFlashTransition::init( GameWindow *win ) @@ -613,14 +613,14 @@ void ButtonFlashTransition::skip( void ) FadeTransition::FadeTransition ( void ) { m_frameLength = FADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } FadeTransition::~FadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } void FadeTransition::init( GameWindow *win ) @@ -750,14 +750,14 @@ void FadeTransition::skip( void ) ScaleUpTransition::ScaleUpTransition ( void ) { m_frameLength = SCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ScaleUpTransition::~ScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ScaleUpTransition::init( GameWindow *win ) @@ -873,14 +873,14 @@ void ScaleUpTransition::skip( void ) ScoreScaleUpTransition::ScoreScaleUpTransition ( void ) { m_frameLength = SCORESCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ScoreScaleUpTransition::~ScoreScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ScoreScaleUpTransition::init( GameWindow *win ) @@ -996,14 +996,14 @@ void ScoreScaleUpTransition::skip( void ) MainMenuScaleUpTransition::MainMenuScaleUpTransition ( void ) { m_frameLength = MAINMENUSCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuScaleUpTransition::~MainMenuScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuScaleUpTransition::init( GameWindow *win ) @@ -1014,7 +1014,7 @@ void MainMenuScaleUpTransition::init( GameWindow *win ) m_win->winGetSize(&m_size.x, &m_size.y); m_win->winGetScreenPosition(&m_pos.x, &m_pos.y ); } - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinGrowMarker")); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinGrowMarker")); if(!m_growWin) return; @@ -1113,14 +1113,14 @@ void MainMenuScaleUpTransition::skip( void ) MainMenuMediumScaleUpTransition::MainMenuMediumScaleUpTransition ( void ) { m_frameLength = MAINMENUMEDIUMSCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuMediumScaleUpTransition::~MainMenuMediumScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuMediumScaleUpTransition::init( GameWindow *win ) @@ -1134,7 +1134,7 @@ void MainMenuMediumScaleUpTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Medium"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(growWinName)); if(!m_growWin) return; @@ -1232,14 +1232,14 @@ void MainMenuMediumScaleUpTransition::skip( void ) MainMenuSmallScaleDownTransition::MainMenuSmallScaleDownTransition ( void ) { m_frameLength = MAINMENUSMALLSCALEDOWNTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuSmallScaleDownTransition::~MainMenuSmallScaleDownTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuSmallScaleDownTransition::init( GameWindow *win ) @@ -1253,7 +1253,7 @@ void MainMenuSmallScaleDownTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Small"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(growWinName)); if(!m_growWin) return; @@ -1345,18 +1345,18 @@ void MainMenuSmallScaleDownTransition::skip( void ) TextTypeTransition::TextTypeTransition ( void ) { m_frameLength = TEXTTYPETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; - m_dStr = NULL; + m_dStr = nullptr; } TextTypeTransition::~TextTypeTransition( void ) { - m_win = NULL; + m_win = nullptr; if(m_dStr) TheDisplayStringManager->freeDisplayString(m_dStr); - m_dStr = NULL; + m_dStr = nullptr; } void TextTypeTransition::init( GameWindow *win ) @@ -1457,7 +1457,7 @@ void TextTypeTransition::skip( void ) CountUpTransition::CountUpTransition ( void ) { m_frameLength = COUNTUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1465,7 +1465,7 @@ CountUpTransition::CountUpTransition ( void ) CountUpTransition::~CountUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void CountUpTransition::init( GameWindow *win ) @@ -1606,7 +1606,7 @@ void CountUpTransition::skip( void ) ScreenFadeTransition::ScreenFadeTransition ( void ) { m_frameLength = SCREENFADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1614,7 +1614,7 @@ ScreenFadeTransition::ScreenFadeTransition ( void ) ScreenFadeTransition::~ScreenFadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1681,17 +1681,17 @@ void ScreenFadeTransition::skip( void ) ControlBarArrowTransition::ControlBarArrowTransition ( void ) { m_frameLength = CONTROLBARARROWTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; - m_arrowImage = NULL; + m_arrowImage = nullptr; } ControlBarArrowTransition::~ControlBarArrowTransition( void ) { - m_win = NULL; - m_arrowImage = NULL; + m_win = nullptr; + m_arrowImage = nullptr; } void ControlBarArrowTransition::init( GameWindow *win ) @@ -1705,7 +1705,7 @@ void ControlBarArrowTransition::init( GameWindow *win ) m_fadePercent = 1.0f/ (CONTROLBARARROWTRANSITION_END - CONTROLBARARROWTRANSITION_BEGIN_FADE); m_arrowImage = TheControlBar->getArrowImage(); - GameWindow *twin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + GameWindow *twin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(!twin || !m_arrowImage) { m_isFinished = TRUE; @@ -1790,7 +1790,7 @@ void ControlBarArrowTransition::skip( void ) FullFadeTransition::FullFadeTransition ( void ) { m_frameLength = FULLFADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1798,7 +1798,7 @@ FullFadeTransition::FullFadeTransition ( void ) FullFadeTransition::~FullFadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1890,14 +1890,14 @@ void FullFadeTransition::skip( void ) TextOnFrameTransition::TextOnFrameTransition ( void ) { m_frameLength = TEXTONFRAMETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_isForward = TRUE; } TextOnFrameTransition::~TextOnFrameTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1980,14 +1980,14 @@ void TextOnFrameTransition::skip( void ) ReverseSoundTransition::ReverseSoundTransition ( void ) { m_frameLength = REVERSESOUNDTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_isForward = TRUE; } ReverseSoundTransition::~ReverseSoundTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -2080,8 +2080,8 @@ void PushButtonImageDrawThree(GameWindow *window, Int alpha ) centerImage = GadgetButtonGetMiddleEnabledImage( window ); // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends @@ -2184,7 +2184,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) ICoord2D origin, size, textPos; IRegion2D clipRegion; // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; GameFont *font = text->getFont(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index c7288236ae1..dc8a0bcb812 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -65,13 +65,13 @@ //----------------------------------------------------------------------------- const FieldParse HeaderTemplateManager::m_headerFieldParseTable[] = { - { "Font", INI::parseQuotedAsciiString, NULL, offsetof( HeaderTemplate, m_fontName ) }, - { "Point", INI::parseInt, NULL, offsetof( HeaderTemplate, m_point) }, - { "Bold", INI::parseBool, NULL, offsetof( HeaderTemplate, m_bold ) }, - { NULL, NULL, NULL, 0 }, + { "Font", INI::parseQuotedAsciiString, nullptr, offsetof( HeaderTemplate, m_fontName ) }, + { "Point", INI::parseInt, nullptr, offsetof( HeaderTemplate, m_point) }, + { "Bold", INI::parseBool, nullptr, offsetof( HeaderTemplate, m_bold ) }, + { nullptr, nullptr, nullptr, 0 }, }; -HeaderTemplateManager *TheHeaderTemplateManager = NULL; +HeaderTemplateManager *TheHeaderTemplateManager = nullptr; //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -86,7 +86,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // find existing item if present hTemplate = TheHeaderTemplateManager->findHeaderTemplate( name ); - if( hTemplate == NULL ) + if( hTemplate == nullptr ) { // allocate a new item @@ -103,7 +103,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) } HeaderTemplate::HeaderTemplate( void ) : -m_font(NULL), +m_font(nullptr), m_point(0), m_bold(FALSE) { @@ -135,7 +135,7 @@ void HeaderTemplateManager::init( void ) fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); INI ini; - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, nullptr ); } populateGameFonts(); @@ -151,7 +151,7 @@ HeaderTemplate *HeaderTemplateManager::findHeaderTemplate( AsciiString name ) return hTemplate; ++it; } - return NULL; + return nullptr; } HeaderTemplate *HeaderTemplateManager::newHeaderTemplate( AsciiString name ) @@ -159,7 +159,7 @@ HeaderTemplate *HeaderTemplateManager::newHeaderTemplate( AsciiString name ) HeaderTemplate *newHTemplate = NEW HeaderTemplate; DEBUG_ASSERTCRASH(newHTemplate, ("Unable to create a new Header Template in HeaderTemplateManager::newHeaderTemplate")); if(!newHTemplate) - return NULL; + return nullptr; newHTemplate->m_name = name; m_headerTemplateList.push_front(newHTemplate); @@ -173,7 +173,7 @@ GameFont *HeaderTemplateManager::getFontFromTemplate( AsciiString name ) if(!ht) { //DEBUG_LOG(("HeaderTemplateManager::getFontFromTemplate - Could not find header %s", name.str())); - return NULL; + return nullptr; } return ht->m_font; @@ -183,7 +183,7 @@ HeaderTemplate *HeaderTemplateManager::getFirstHeader( void ) { HeaderTemplateListIt it = m_headerTemplateList.begin(); if( it == m_headerTemplateList.end()) - return NULL; + return nullptr; return *it; } @@ -197,12 +197,12 @@ HeaderTemplate *HeaderTemplateManager::getNextHeader( HeaderTemplate *ht ) { ++it; if( it == m_headerTemplateList.end()) - return NULL; + return nullptr; return *it; } ++it; } - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index 368f7bb33a5..565b55f54e0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -220,7 +220,7 @@ IMEManager::MessageInfo IMEManager::m_mainMessageInfo[] = { "WM_IME_ENDCOMPOSITION" , WM_IME_ENDCOMPOSITION }, { "WM_IME_COMPOSITION" , WM_IME_COMPOSITION }, { "WM_IME_KEYLAST" , WM_IME_KEYLAST }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_notifyInfo[] = @@ -239,7 +239,7 @@ IMEManager::MessageInfo IMEManager::m_notifyInfo[] = { "IMN_SETSTATUSWINDOWPOS" , IMN_SETSTATUSWINDOWPOS }, { "IMN_GUIDELINE" , IMN_GUIDELINE }, { "IMN_PRIVATE" , IMN_PRIVATE }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_requestInfo[] = @@ -251,7 +251,7 @@ IMEManager::MessageInfo IMEManager::m_requestInfo[] = { "IMR_RECONVERTSTRING" , IMR_RECONVERTSTRING }, { "IMR_CONFIRMRECONVERTSTRING" , IMR_CONFIRMRECONVERTSTRING}, #endif - { NULL, 0 } + { nullptr, 0 } }; @@ -267,7 +267,7 @@ IMEManager::MessageInfo IMEManager::m_controlInfo[] = { "IMC_SETSTATUSWINDOWPOS" , IMC_SETSTATUSWINDOWPOS }, { "IMC_CLOSESTATUSWINDOW" , IMC_CLOSESTATUSWINDOW }, { "IMC_OPENSTATUSWINDOW" , IMC_OPENSTATUSWINDOW }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setContextInfo[] = @@ -278,7 +278,7 @@ IMEManager::MessageInfo IMEManager::m_setContextInfo[] = { "CANDIDATEWINDOW4" , ISC_SHOWUICANDIDATEWINDOW<<3 }, { "COMPOSITIONWINDOW" , ISC_SHOWUICOMPOSITIONWINDOW }, { "GUIDELINE" , ISC_SHOWUIGUIDELINE }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setCmodeInfo[] = @@ -296,7 +296,7 @@ IMEManager::MessageInfo IMEManager::m_setCmodeInfo[] = { "EUDC" , IME_CMODE_EUDC }, { "SYMBOL" , IME_CMODE_SYMBOL }, { "FIXED" , IME_CMODE_FIXED }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = @@ -307,7 +307,7 @@ IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = { "AUTOMATIC" , IME_SMODE_AUTOMATIC }, { "PHRASEPREDICT" , IME_SMODE_PHRASEPREDICT}, { "CONVERSATION" , IME_SMODE_CONVERSATION }, - { NULL, 0 } + { nullptr, 0 } }; #endif @@ -316,7 +316,7 @@ IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = // Public Data //---------------------------------------------------------------------------- -IMEManagerInterface *TheIMEManager = NULL; +IMEManagerInterface *TheIMEManager = nullptr; //---------------------------------------------------------------------------- @@ -337,7 +337,7 @@ IMEManagerInterface *TheIMEManager = NULL; Char* IMEManager::getMessageName( IMEManager::MessageInfo *msgTable, Int value ) { - Char *name = NULL; + Char *name = nullptr; if ( msgTable ) { @@ -395,14 +395,14 @@ void IMEManager::printMessageInfo( Int message, Int wParam, Int lParam ) case WM_IME_NOTIFY: { Char *notifyName = getMessageName( m_notifyInfo, wParam ); - if ( notifyName == NULL ) notifyName = "unknown"; + if ( notifyName == nullptr ) notifyName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, notifyName, wParam, lParam )); break; } case WM_IME_CONTROL: { Char *controlName = getMessageName( m_controlInfo, wParam ); - if ( controlName == NULL ) controlName = "unknown"; + if ( controlName == nullptr ) controlName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, controlName, wParam, lParam )); break; @@ -411,7 +411,7 @@ void IMEManager::printMessageInfo( Int message, Int wParam, Int lParam ) case WM_IME_REQUEST: { Char *requestName = getMessageName( m_requestInfo, wParam ); - if ( requestName == NULL ) requestName = "unknown"; + if ( requestName == nullptr ) requestName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, requestName, wParam, lParam )); break; @@ -444,7 +444,7 @@ void IMEManager::printConversionStatus( void ) DWORD mode; if ( m_context ) { - ImmGetConversionStatus( m_context, &mode, NULL ); + ImmGetConversionStatus( m_context, &mode, nullptr ); AsciiString flags; @@ -463,7 +463,7 @@ void IMEManager::printSentenceStatus( void ) DWORD mode; if ( m_context ) { - ImmGetConversionStatus( m_context, NULL, &mode ); + ImmGetConversionStatus( m_context, nullptr, &mode ); AsciiString flags; @@ -494,12 +494,12 @@ IMEManagerInterface *CreateIMEManagerInterface( void ) //============================================================================ IMEManager::IMEManager() -: m_window(NULL), - m_context(NULL), - m_candidateWindow(NULL), - m_statusWindow(NULL), +: m_window(nullptr), + m_context(nullptr), + m_candidateWindow(nullptr), + m_statusWindow(nullptr), m_candidateCount(0), - m_candidateString(NULL), + m_candidateString(nullptr), m_compositionStringLength(0), m_composing(FALSE), m_disabled(0), @@ -507,9 +507,9 @@ IMEManager::IMEManager() m_indexBase(1), m_compositionCharsDisplayed(0), - m_candidateDownArrow(NULL), - m_candidateTextArea(NULL), - m_candidateUpArrow(NULL), + m_candidateDownArrow(nullptr), + m_candidateTextArea(nullptr), + m_candidateUpArrow(nullptr), m_compositionCursorPos(0), m_pageSize(0), m_pageStart(0), @@ -526,8 +526,8 @@ IMEManager::~IMEManager() { if ( m_candidateWindow ) { - m_candidateWindow->winSetUserData( NULL ); - m_candidateTextArea->winSetUserData( NULL ); + m_candidateWindow->winSetUserData( nullptr ); + m_candidateTextArea->winSetUserData( nullptr ); TheWindowManager->winDestroy( m_candidateWindow ); } @@ -583,10 +583,10 @@ void IMEManager::init( void ) - if ( m_candidateTextArea == NULL ) + if ( m_candidateTextArea == nullptr ) { TheWindowManager->winDestroy( m_candidateWindow ); - m_candidateWindow = NULL; + m_candidateWindow = nullptr; } } @@ -598,7 +598,7 @@ void IMEManager::init( void ) } // attach IMEManager to each window - if ( m_candidateWindow != NULL ) + if ( m_candidateWindow != nullptr ) { m_candidateWindow->winSetUserData( TheIMEManager ); m_candidateTextArea->winSetUserData( TheIMEManager ); @@ -651,8 +651,8 @@ void IMEManager::attach( GameWindow *window ) void IMEManager::detatch( void ) { - //ImmAssociateContext( ApplicationHWnd, NULL ); - m_window = NULL; + //ImmAssociateContext( ApplicationHWnd, nullptr ); + m_window = nullptr; } @@ -999,7 +999,7 @@ void IMEManager::enable( void ) void IMEManager::disable( void ) { m_disabled++; - ImmAssociateContext( ApplicationHWnd, NULL ); + ImmAssociateContext( ApplicationHWnd, nullptr ); } //============================================================================ @@ -1008,7 +1008,7 @@ void IMEManager::disable( void ) Bool IMEManager::isEnabled( void ) { - return m_context != NULL && m_disabled == 0; + return m_context != nullptr && m_disabled == 0; } //============================================================================ @@ -1105,7 +1105,7 @@ void IMEManager::updateCompositionString( void ) if ( result >= 0 ) { m_compositionStringLength = result/2; - m_compositionCursorPos = (ImmGetCompositionStringW( m_context, GCS_CURSORPOS, NULL, 0) & 0xffff ); + m_compositionCursorPos = (ImmGetCompositionStringW( m_context, GCS_CURSORPOS, nullptr, 0) & 0xffff ); } else { @@ -1126,7 +1126,7 @@ void IMEManager::updateCompositionString( void ) } else { - m_compositionCursorPos = (ImmGetCompositionString( m_context, GCS_CURSORPOS, NULL, 0) & 0xffff ); + m_compositionCursorPos = (ImmGetCompositionString( m_context, GCS_CURSORPOS, nullptr, 0) & 0xffff ); convRes = wcslen( m_compositionString ); } @@ -1205,7 +1205,7 @@ void IMEManager::getResultsString ( void ) void IMEManager::convertToUnicode ( Char *mbcs, UnicodeString &unicode ) { - int size = MultiByteToWideChar( CP_ACP, 0, mbcs, strlen(mbcs), NULL, 0 ); + int size = MultiByteToWideChar( CP_ACP, 0, mbcs, strlen(mbcs), nullptr, 0 ); unicode.clear(); @@ -1240,7 +1240,7 @@ void IMEManager::convertToUnicode ( Char *mbcs, UnicodeString &unicode ) void IMEManager::openCandidateList( Int candidateFlags ) { - if ( m_candidateWindow == NULL ) + if ( m_candidateWindow == nullptr ) { return; } @@ -1309,14 +1309,14 @@ void IMEManager::openCandidateList( Int candidateFlags ) void IMEManager::closeCandidateList( Int candidateFlags ) { - if ( m_candidateWindow != NULL ) + if ( m_candidateWindow != nullptr ) { m_candidateWindow->winHide( TRUE ); TheWindowManager->winUnsetModal( m_candidateWindow ); } delete [] m_candidateString; - m_candidateString = NULL; + m_candidateString = nullptr; m_candidateCount = 0; @@ -1330,15 +1330,15 @@ void IMEManager::updateCandidateList( Int candidateFlags ) { delete [] m_candidateString; - m_candidateString = NULL; + m_candidateString = nullptr; m_pageSize = 10; m_candidateCount = 0; m_pageStart = 0; m_selectedIndex = 0; - if ( m_candidateWindow == NULL || - m_context == NULL || + if ( m_candidateWindow == nullptr || + m_context == nullptr || candidateFlags == 0) { return; @@ -1366,7 +1366,7 @@ void IMEManager::updateCandidateList( Int candidateFlags ) // create a temporary buffer for reading the candidate list Char *buffer = NEW Char[size]; - if ( buffer == NULL ) + if ( buffer == nullptr ) { return; } @@ -1478,14 +1478,14 @@ Int IMEManager::getIndexBase( void ) void IMEManager::resizeCandidateWindow( Int pageSize ) { - if ( m_candidateWindow == NULL ) + if ( m_candidateWindow == nullptr ) { return; } GameFont *font = m_candidateTextArea->winGetFont(); - if ( font == NULL ) + if ( font == nullptr ) { return; } @@ -1527,7 +1527,7 @@ Int IMEManager::getCandidateCount() const UnicodeString* IMEManager::getCandidate( Int index ) { - if ( m_candidateString != NULL && index >=0 && index < m_candidateCount ) + if ( m_candidateString != nullptr && index >=0 && index < m_candidateCount ) { return &m_candidateString[index]; } @@ -1568,7 +1568,7 @@ Int IMEManager::getCandidatePageStart() void IMEManager::openStatusWindow( void ) { - if ( m_statusWindow == NULL ) + if ( m_statusWindow == nullptr ) { return; } @@ -1581,7 +1581,7 @@ void IMEManager::openStatusWindow( void ) void IMEManager::closeStatusWindow( void ) { - if ( m_statusWindow == NULL ) + if ( m_statusWindow == nullptr ) { return; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index b58dbc72900..f251c55fc9d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -127,7 +127,7 @@ FRAME_FUDGE_ADD = 30, LoadScreen::LoadScreen( void ) { - m_loadScreen = NULL; + m_loadScreen = nullptr; } LoadScreen::~LoadScreen( void ) @@ -136,7 +136,7 @@ LoadScreen::~LoadScreen( void ) // delete (m_loadScreen); if(m_loadScreen) TheWindowManager->winDestroy( m_loadScreen ); - m_loadScreen = NULL; + m_loadScreen = nullptr; } void LoadScreen::update( Int percent ) @@ -157,37 +157,37 @@ SinglePlayerLoadScreen::SinglePlayerLoadScreen( void ) { m_currentObjectiveLine = 0; m_currentObjectiveLineCharacter = 0; - m_finishedObjectiveText = NULL; + m_finishedObjectiveText = FALSE; m_currentObjectiveWidthOffset = 0; - m_progressBar = NULL; - m_percent = NULL; - m_videoStream = NULL; - m_videoBuffer = NULL; - m_objectiveWin = NULL; + m_progressBar = nullptr; + m_percent = nullptr; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + m_objectiveWin = nullptr; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = NULL; + m_objectiveLines[i] = nullptr; } SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) { - m_progressBar = NULL; - m_percent = NULL; - m_objectiveWin = NULL; + m_progressBar = nullptr; + m_percent = nullptr; + m_objectiveWin = nullptr; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = NULL; + m_objectiveLines[i] = nullptr; delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = NULL; + m_ambientLoopHandle = 0; } @@ -457,7 +457,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_ambientLoop.setEventName("LoadScreenAmbient"); // create the new stream m_videoStream = TheVideoPlayer->open( TheCampaignManager->getCurrentMission()->m_movieLabel ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { m_percent->winHide(TRUE); return; @@ -465,18 +465,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) // Create the new buffer m_videoBuffer = TheDisplay->createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } return; @@ -591,8 +591,8 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) void SinglePlayerLoadScreen::reset( void ) { - setLoadScreen(NULL); - m_progressBar = NULL; + setLoadScreen(nullptr); + m_progressBar = nullptr; } void SinglePlayerLoadScreen::update( Int percent ) @@ -617,13 +617,13 @@ void SinglePlayerLoadScreen::setProgressRange( Int min, Int max ) //----------------------------------------------------------------------------- ShellGameLoadScreen::ShellGameLoadScreen( void ) { - m_progressBar = NULL; + m_progressBar = nullptr; } ShellGameLoadScreen::~ShellGameLoadScreen( void ) { - m_progressBar = NULL; + m_progressBar = nullptr; } void ShellGameLoadScreen::init( GameInfo *game ) @@ -658,8 +658,8 @@ void ShellGameLoadScreen::init( GameInfo *game ) void ShellGameLoadScreen::reset( void ) { - setLoadScreen(NULL); - m_progressBar = NULL; + setLoadScreen(nullptr); + m_progressBar = nullptr; } void ShellGameLoadScreen::update( Int percent ) @@ -675,14 +675,14 @@ void ShellGameLoadScreen::update( Int percent ) //----------------------------------------------------------------------------- MultiPlayerLoadScreen::MultiPlayerLoadScreen( void ) { - m_mapPreview = NULL; + m_mapPreview = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_buttonMapStartPosition[i] = NULL; - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_buttonMapStartPosition[i] = nullptr; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; } } @@ -691,14 +691,14 @@ MultiPlayerLoadScreen::~MultiPlayerLoadScreen( void ) { if(m_mapPreview) { - m_mapPreview->winSetUserData(NULL); + m_mapPreview->winSetUserData(nullptr); } for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; } @@ -745,7 +745,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) Int i = 0; for (; i < MAX_SLOTS; ++i) { - teamWin[i] = NULL; + teamWin[i] = nullptr; } Int netSlot = 0; @@ -843,12 +843,12 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) void MultiPlayerLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; } } @@ -892,23 +892,23 @@ void MultiPlayerLoadScreen::processProgress(Int playerId, Int percentage) GameSpyLoadScreen::GameSpyLoadScreen( void ) { - m_mapPreview = NULL; + m_mapPreview = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_buttonMapStartPosition[i] = NULL; - m_playerRank[i] = NULL; + m_buttonMapStartPosition[i] = nullptr; + m_playerRank[i] = nullptr; - m_playerOfficerMedal[i] = NULL; - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_playerOfficerMedal[i] = nullptr; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= NULL; - m_playerTotalDisconnects[i]= NULL; - m_playerWin[i]= NULL; - m_playerWinLosses[i]= NULL; + m_playerFavoriteFactions[i]= nullptr; + m_playerTotalDisconnects[i]= nullptr; + m_playerWin[i]= nullptr; + m_playerWinLosses[i]= nullptr; } } @@ -916,19 +916,19 @@ GameSpyLoadScreen::~GameSpyLoadScreen( void ) { if(m_mapPreview) { - m_mapPreview->winSetUserData(NULL); + m_mapPreview->winSetUserData(nullptr); } for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= NULL; - m_playerTotalDisconnects[i]= NULL; - m_playerWin[i]= NULL; - m_playerWinLosses[i]= NULL; + m_playerFavoriteFactions[i]= nullptr; + m_playerTotalDisconnects[i]= nullptr; + m_playerWin[i]= nullptr; + m_playerWinLosses[i]= nullptr; } } @@ -958,7 +958,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); Int i = 0; for (; i < MAX_SLOTS; ++i) { - teamWin[i] = NULL; + teamWin[i] = nullptr; } Int netSlot = 0; @@ -1043,7 +1043,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); Int favSide = GetFavoriteSide(stats); const Image *preorderImg = TheMappedImageCollection->findImageByName("OfficersClubsmall"); if (!isPreorder) - preorderImg = NULL; + preorderImg = nullptr; const Image *rankImg = LookupSmallRankImage(favSide, rankPoints); m_playerOfficerMedal[i]->winSetEnabledImage(0, preorderImg); m_playerRank[i]->winSetEnabledImage(0, rankImg); @@ -1173,12 +1173,12 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); void GameSpyLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; } } @@ -1216,28 +1216,28 @@ MapTransferLoadScreen::MapTransferLoadScreen( void ) m_oldTimeout = 0; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } MapTransferLoadScreen::~MapTransferLoadScreen( void ) { for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } void MapTransferLoadScreen::init( GameInfo *game ) @@ -1318,17 +1318,17 @@ void MapTransferLoadScreen::init( GameInfo *game ) void MapTransferLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } void MapTransferLoadScreen::update( Int percent ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 31e4691a68e..1f5b7db3a49 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -92,7 +92,7 @@ void ProcessAnimateWindowSlideFromRight::initReverseAnimateWindow( wnd::AnimateW { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -116,7 +116,7 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } animWin->setFinished( FALSE ); @@ -126,7 +126,7 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -156,7 +156,7 @@ Bool ProcessAnimateWindowSlideFromRight::updateAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -172,7 +172,7 @@ Bool ProcessAnimateWindowSlideFromRight::updateAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -204,7 +204,7 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -221,7 +221,7 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -276,7 +276,7 @@ void ProcessAnimateWindowSlideFromLeft::initReverseAnimateWindow( wnd::AnimateWi { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -298,7 +298,7 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -307,7 +307,7 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -333,7 +333,7 @@ Bool ProcessAnimateWindowSlideFromLeft::updateAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -350,7 +350,7 @@ Bool ProcessAnimateWindowSlideFromLeft::updateAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -382,7 +382,7 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -399,7 +399,7 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -454,7 +454,7 @@ void ProcessAnimateWindowSlideFromTop::initReverseAnimateWindow( wnd::AnimateWin { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -476,7 +476,7 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -485,7 +485,7 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -511,7 +511,7 @@ Bool ProcessAnimateWindowSlideFromTop::updateAnimateWindow( wnd::AnimateWindow * if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -528,7 +528,7 @@ Bool ProcessAnimateWindowSlideFromTop::updateAnimateWindow( wnd::AnimateWindow * GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -561,7 +561,7 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -578,7 +578,7 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -633,7 +633,7 @@ void ProcessAnimateWindowSlideFromBottom::initReverseAnimateWindow( wnd::Animate { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -656,7 +656,7 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -665,7 +665,7 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -691,7 +691,7 @@ Bool ProcessAnimateWindowSlideFromBottom::updateAnimateWindow( wnd::AnimateWindo if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -708,7 +708,7 @@ Bool ProcessAnimateWindowSlideFromBottom::updateAnimateWindow( wnd::AnimateWindo GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -741,7 +741,7 @@ Bool ProcessAnimateWindowSlideFromBottom::reverseAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -758,7 +758,7 @@ Bool ProcessAnimateWindowSlideFromBottom::reverseAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -814,7 +814,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initReverseAnimateWindow( wnd::An if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -823,7 +823,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initReverseAnimateWindow( wnd::An GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } restPos = animWin->getRestPos(); @@ -855,7 +855,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initAnimateWindow( wnd::AnimateWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -864,7 +864,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initAnimateWindow( wnd::AnimateWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -891,7 +891,7 @@ Bool ProcessAnimateWindowSlideFromBottomTimed::updateAnimateWindow( wnd::Animate if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -908,7 +908,7 @@ Bool ProcessAnimateWindowSlideFromBottomTimed::updateAnimateWindow( wnd::Animate GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -966,7 +966,7 @@ void ProcessAnimateWindowSpiral::initReverseAnimateWindow( wnd::AnimateWindow *a { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -990,7 +990,7 @@ void ProcessAnimateWindowSpiral::initAnimateWindow( wnd::AnimateWindow *animWin if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -999,7 +999,7 @@ void ProcessAnimateWindowSpiral::initAnimateWindow( wnd::AnimateWindow *animWin GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1025,7 +1025,7 @@ Bool ProcessAnimateWindowSpiral::updateAnimateWindow( wnd::AnimateWindow *animWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1042,7 +1042,7 @@ Bool ProcessAnimateWindowSpiral::updateAnimateWindow( wnd::AnimateWindow *animWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1079,7 +1079,7 @@ Bool ProcessAnimateWindowSpiral::reverseAnimateWindow( wnd::AnimateWindow *animW if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1094,7 +1094,7 @@ Bool ProcessAnimateWindowSpiral::reverseAnimateWindow( wnd::AnimateWindow *animW GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1147,7 +1147,7 @@ void ProcessAnimateWindowSlideFromTopFast::initReverseAnimateWindow( wnd::Animat { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -1170,7 +1170,7 @@ void ProcessAnimateWindowSlideFromTopFast::initAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -1179,7 +1179,7 @@ void ProcessAnimateWindowSlideFromTopFast::initAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1207,7 +1207,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::updateAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1224,7 +1224,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::updateAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1257,7 +1257,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::reverseAnimateWindow( wnd::AnimateWin if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1274,7 +1274,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::reverseAnimateWindow( wnd::AnimateWin GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1332,7 +1332,7 @@ void ProcessAnimateWindowSlideFromRightFast::initReverseAnimateWindow( wnd::Anim { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -1374,7 +1374,7 @@ void ProcessAnimateWindowSlideFromRightFast::initAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } animWin->setFinished( FALSE ); @@ -1384,7 +1384,7 @@ void ProcessAnimateWindowSlideFromRightFast::initAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1415,7 +1415,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::updateAnimateWindow( wnd::AnimateWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1431,7 +1431,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::updateAnimateWindow( wnd::AnimateWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1463,7 +1463,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::reverseAnimateWindow( wnd::AnimateW if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1480,7 +1480,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::reverseAnimateWindow( wnd::AnimateW GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 96440624448..f5262b666ef 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -43,7 +43,7 @@ #include "GameNetwork/GameSpy/PeerDefsImplementation.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Shell *TheShell = NULL; ///< the shell singleton definition +Shell *TheShell = nullptr; ///< the shell singleton definition // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -70,20 +70,20 @@ void Shell::construct( void ) m_screenCount = 0; for( i = 0; i < MAX_SHELL_STACK; i++ ) - m_screenStack[ i ] = NULL; + m_screenStack[ i ] = nullptr; m_pendingPush = FALSE; m_pendingPop = FALSE; m_pendingPushName.set( "" ); m_isShellActive = TRUE; m_shellMapOn = FALSE; - m_background = NULL; + m_background = nullptr; m_clearBackground = FALSE; m_animateWindowManager = NEW AnimateWindowManager; m_schemeManager = NEW ShellMenuSchemeManager; - m_saveLoadMenuLayout = NULL; - m_popupReplayLayout = NULL; - m_optionsLayout = NULL; + m_saveLoadMenuLayout = nullptr; + m_popupReplayLayout = nullptr; + m_optionsLayout = nullptr; m_screenCount = 0; } @@ -101,14 +101,14 @@ void Shell::deconstruct( void ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } delete m_animateWindowManager; - m_animateWindowManager = NULL; + m_animateWindowManager = nullptr; delete m_schemeManager; - m_schemeManager = NULL; + m_schemeManager = nullptr; // delete the save/load menu if present if( m_saveLoadMenuLayout ) @@ -116,7 +116,7 @@ void Shell::deconstruct( void ) m_saveLoadMenuLayout->destroyWindows(); deleteInstance(m_saveLoadMenuLayout); - m_saveLoadMenuLayout = NULL; + m_saveLoadMenuLayout = nullptr; } @@ -126,15 +126,15 @@ void Shell::deconstruct( void ) m_popupReplayLayout->destroyWindows(); deleteInstance(m_popupReplayLayout); - m_popupReplayLayout = NULL; + m_popupReplayLayout = nullptr; } // delete the options menu if present. - if (m_optionsLayout != NULL) { + if (m_optionsLayout != nullptr) { m_optionsLayout->destroyWindows(); deleteInstance(m_optionsLayout); - m_optionsLayout = NULL; + m_optionsLayout = nullptr; } } @@ -145,8 +145,8 @@ void Shell::init( void ) { INI ini; // Read from INI all the ShellMenuScheme - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); if( m_schemeManager ) m_schemeManager->init(); @@ -192,8 +192,8 @@ void Shell::update( void ) for( Int i = m_screenCount - 1; i >= 0; i-- ) { - DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is NULL!") ); - m_screenStack[ i ]->runUpdate( NULL ); + DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is null!") ); + m_screenStack[ i ]->runUpdate( nullptr ); } if(TheGlobalData->m_shellMapOn && m_shellMapOn &&m_background) @@ -201,7 +201,7 @@ void Shell::update( void ) m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } @@ -271,7 +271,7 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) { if (filename.isEmpty()) - return NULL; + return nullptr; // search screen list WindowLayout *screen; @@ -285,7 +285,7 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) } - return NULL; + return nullptr; } @@ -295,7 +295,7 @@ WindowLayout *Shell::getScreenLayout( Int index ) const if (index >= 0 && index < m_screenCount) return m_screenStack[index]; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -369,7 +369,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) { // just call shutdownComplete() which will immediately cause the push to happen - shutdownComplete( NULL ); + shutdownComplete( nullptr ); } @@ -391,7 +391,7 @@ void Shell::pop( void ) // sanity - if( screen == NULL ) + if( screen == nullptr ) return; #ifdef DEBUG_LOGGING @@ -430,7 +430,7 @@ void Shell::popImmediate( void ) WindowLayout *screen = top(); // sanity - if( screen == NULL ) + if( screen == nullptr ) return; #ifdef DEBUG_LOGGING @@ -478,7 +478,7 @@ void Shell::showShell( Bool runInit ) if( layout ) { - layout->runInit( NULL ); + layout->runInit( nullptr ); // layout->bringForward(); } } @@ -601,7 +601,7 @@ WindowLayout *Shell::top( void ) // emtpy stack if( m_screenCount == 0 ) - return NULL; + return nullptr; // top layout is at count index return m_screenStack[ m_screenCount - 1 ]; @@ -616,7 +616,7 @@ void Shell::linkScreen( WindowLayout *screen ) { // sanity - if( screen == NULL ) + if( screen == nullptr ) return; // check to see if at top already @@ -640,7 +640,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) { // sanity - if( screen == NULL ) + if( screen == nullptr ) return; DEBUG_ASSERTCRASH( m_screenStack[ m_screenCount - 1 ] == screen, @@ -648,7 +648,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) // remove reference to screen and decrease count if( m_screenStack[ m_screenCount - 1 ] == screen ) - m_screenStack[ --m_screenCount ] = NULL; + m_screenStack[ --m_screenCount ] = nullptr; } @@ -663,7 +663,7 @@ void Shell::doPush( AsciiString layoutFile ) // create new layout and load from window manager newScreen = TheWindowManager->winCreateLayout( layoutFile ); - DEBUG_ASSERTCRASH( newScreen != NULL, ("Shell unable to load pending push layout") ); + DEBUG_ASSERTCRASH( newScreen != nullptr, ("Shell unable to load pending push layout") ); // link screen to the top linkScreen( newScreen ); @@ -672,7 +672,7 @@ void Shell::doPush( AsciiString layoutFile ) TheIMEManager->detatch(); // run the init function automatically - newScreen->runInit( NULL ); + newScreen->runInit( nullptr ); newScreen->bringForward(); @@ -704,7 +704,7 @@ void Shell::doPop( Bool impendingPush ) WindowLayout *newTop = top(); if( newTop && !impendingPush ) { - newTop->runInit( NULL ); + newTop->runInit( nullptr ); //newTop->bringForward(); } @@ -719,7 +719,7 @@ void Shell::doPop( Bool impendingPush ) * popping the current screen off the top of the stack. It is here that we * can look for any pending push or pop operations and actually do them * - * NOTE: It is possible for the screen parameter to be NULL when we are + * NOTE: It is possible for the screen parameter to be nullptr when we are * short circuiting the shutdown logic because there is no layout * to actually shutdown (ie, the stack is empty and we push) */ //------------------------------------------------------------------------------------------------- @@ -762,7 +762,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; m_clearBackground = FALSE; } @@ -838,7 +838,7 @@ WindowLayout *Shell::getSaveLoadMenuLayout( void ) { // if layout has not been created, create it now - if( m_saveLoadMenuLayout == NULL ) + if( m_saveLoadMenuLayout == nullptr ) m_saveLoadMenuLayout = TheWindowManager->winCreateLayout( "Menus/PopupSaveLoad.wnd" ); // sanity @@ -855,7 +855,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) { // if layout has not been created, create it now - if( m_popupReplayLayout == NULL ) + if( m_popupReplayLayout == nullptr ) m_popupReplayLayout = TheWindowManager->winCreateLayout( "Menus/PopupReplay.wnd" ); // sanity @@ -871,7 +871,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) WindowLayout *Shell::getOptionsLayout( Bool create ) { // if layout has not been created, create it now - if ((m_optionsLayout == NULL) && (create == TRUE)) + if ((m_optionsLayout == nullptr) && (create == TRUE)) { m_optionsLayout = TheWindowManager->winCreateLayout( "Menus/OptionsMenu.wnd" ); @@ -886,9 +886,9 @@ WindowLayout *Shell::getOptionsLayout( Bool create ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void Shell::destroyOptionsLayout() { - if (m_optionsLayout != NULL) { + if (m_optionsLayout != nullptr) { m_optionsLayout->destroyWindows(); deleteInstance(m_optionsLayout); - m_optionsLayout = NULL; + m_optionsLayout = nullptr; } } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 1bcabcdc4b4..f2609a78cb1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -63,9 +63,9 @@ const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = { - { "ImagePart", ShellMenuSchemeManager::parseImagePart, NULL, NULL }, - { "LinePart", ShellMenuSchemeManager::parseLinePart, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "ImagePart", ShellMenuSchemeManager::parseImagePart, nullptr, 0 }, + { "LinePart", ShellMenuSchemeManager::parseLinePart, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; @@ -116,12 +116,12 @@ ShellMenuSchemeImage::ShellMenuSchemeImage( void ) m_name.clear(); m_position.x = m_position.y = 0; m_size.x = m_size.x = 0; - m_image = NULL; + m_image = nullptr; } ShellMenuSchemeImage::~ShellMenuSchemeImage( void ) { - m_image = NULL; + m_image = nullptr; } ShellMenuScheme::ShellMenuScheme( void ) @@ -200,12 +200,12 @@ void ShellMenuScheme::draw( void ) ShellMenuSchemeManager::ShellMenuSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; } ShellMenuSchemeManager::~ShellMenuSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; ShellMenuSchemeListIt it = m_schemeList.begin(); @@ -222,10 +222,10 @@ void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*st { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ShellMenuSchemeImage, m_image ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ShellMenuSchemeImage, m_image ) }, + { nullptr, nullptr, nullptr, 0 } }; ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; @@ -238,12 +238,12 @@ void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*sto { static const FieldParse myFieldParse[] = { - { "StartPosition", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeLine, m_startPos ) }, - { "EndPosition", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeLine, m_endPos ) }, - { "Color", INI::parseColorInt, NULL, offsetof( ShellMenuSchemeLine, m_color ) }, - { "Width", INI::parseInt, NULL, offsetof( ShellMenuSchemeLine, m_width ) }, + { "StartPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_startPos ) }, + { "EndPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_endPos ) }, + { "Color", INI::parseColorInt, nullptr, offsetof( ShellMenuSchemeLine, m_color ) }, + { "Width", INI::parseInt, nullptr, offsetof( ShellMenuSchemeLine, m_width ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; @@ -279,8 +279,8 @@ void ShellMenuSchemeManager::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); } @@ -288,7 +288,7 @@ void ShellMenuSchemeManager::setShellMenuScheme( AsciiString name ) { if(name.isEmpty()) { - m_currentScheme = NULL; + m_currentScheme = nullptr; return; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp index 9e466dfa8c5..1593115b371 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp @@ -74,9 +74,9 @@ WinInstanceData::WinInstanceData( void ) { // we don't allocate strings unless we need them - m_text = NULL; - m_tooltip = NULL; - m_videoBuffer = NULL; + m_text = nullptr; + m_tooltip = nullptr; + m_videoBuffer = nullptr; init(); } @@ -92,7 +92,7 @@ WinInstanceData::~WinInstanceData( void ) if( m_tooltip ) TheDisplayStringManager->freeDisplayString( m_tooltip ); - m_videoBuffer = NULL; //Video Buffer needs to be clean up by the control that is in charge of the video. + m_videoBuffer = nullptr; //Video Buffer needs to be clean up by the control that is in charge of the video. } @@ -107,15 +107,15 @@ void WinInstanceData::init( void ) for( i = 0; i < MAX_DRAW_DATA; i++ ) { - m_enabledDrawData[ i ].image = NULL; + m_enabledDrawData[ i ].image = nullptr; m_enabledDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_enabledDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - m_disabledDrawData[ i ].image = NULL; + m_disabledDrawData[ i ].image = nullptr; m_disabledDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_disabledDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - m_hiliteDrawData[ i ].image = NULL; + m_hiliteDrawData[ i ].image = nullptr; m_hiliteDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_hiliteDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; @@ -133,7 +133,7 @@ void WinInstanceData::init( void ) m_state = 0; m_style = 0; m_status = WIN_STATUS_NONE; - m_owner = NULL; + m_owner = nullptr; m_textLabelString.clear(); m_tooltipString.clear(); m_tooltipDelay = -1; ///< default value @@ -143,23 +143,23 @@ void WinInstanceData::init( void ) m_imageOffset.y = 0; // reset all data for the text display strings and font for window - m_font = NULL; + m_font = nullptr; if( m_text ) { TheDisplayStringManager->freeDisplayString( m_text ); - m_text = NULL; + m_text = nullptr; } if( m_tooltip ) { TheDisplayStringManager->freeDisplayString( m_tooltip ); - m_tooltip = NULL; + m_tooltip = nullptr; } - m_videoBuffer = NULL; + m_videoBuffer = nullptr; } @@ -170,7 +170,7 @@ void WinInstanceData::setTooltipText( UnicodeString tip ) { // allocate a text tooltip string if needed - if( m_tooltip == NULL ) + if( m_tooltip == nullptr ) m_tooltip = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_tooltip, ("no tooltip") ); @@ -186,7 +186,7 @@ void WinInstanceData::setText( UnicodeString text ) { // allocate a text instance if needed - if( m_text == NULL ) + if( m_text == nullptr ) m_text = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_text, ("no text") ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp index 1e0028dbe2c..269c91cea4a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp @@ -41,15 +41,15 @@ WindowLayout::WindowLayout( void ) { m_filenameString.set("EmptyLayout"); - m_windowList = NULL; - m_windowTail = NULL; + m_windowList = nullptr; + m_windowTail = nullptr; m_windowCount = 0; m_hidden = FALSE; - m_init = NULL; - m_update = NULL; - m_shutdown = NULL; + m_init = nullptr; + m_update = nullptr; + m_shutdown = nullptr; } @@ -63,8 +63,8 @@ WindowLayout::~WindowLayout( void ) // layout itself. This allows for maximum flexibility of the window layouts and you can // use them in any you see fit, as long as they are clean when they go away // - DEBUG_ASSERTCRASH( m_windowList == NULL, ("Window layout being destroyed still has window references") ); - DEBUG_ASSERTCRASH( m_windowTail == NULL, ("Window layout being destroyed still has window references") ); + DEBUG_ASSERTCRASH( m_windowList == nullptr, ("Window layout being destroyed still has window references") ); + DEBUG_ASSERTCRASH( m_windowTail == nullptr, ("Window layout being destroyed still has window references") ); } @@ -96,15 +96,15 @@ void WindowLayout::addWindow( GameWindow *window ) GameWindow *win = findWindow( window ); // only add window if window is not in this layout already - if( win == NULL ) + if( win == nullptr ) { - DEBUG_ASSERTCRASH( window->winGetNextInLayout() == NULL, - ("NextInLayout should be NULL before adding") ); - DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == NULL, - ("PrevInLayout should be NULL before adding") ); + DEBUG_ASSERTCRASH( window->winGetNextInLayout() == nullptr, + ("NextInLayout should be null before adding") ); + DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == nullptr, + ("PrevInLayout should be null before adding") ); - window->winSetPrevInLayout( NULL ); + window->winSetPrevInLayout( nullptr ); window->winSetNextInLayout( m_windowList ); if( m_windowList ) m_windowList->winSetPrevInLayout( window ); @@ -114,7 +114,7 @@ void WindowLayout::addWindow( GameWindow *window ) window->winSetLayout( this ); // if no tail pointer, this is it - if( m_windowTail == NULL ) + if( m_windowTail == nullptr ) m_windowTail = window; // we gots another window now @@ -147,9 +147,9 @@ void WindowLayout::removeWindow( GameWindow *window ) m_windowList = next; // set window as having no layout info - win->winSetLayout( NULL ); - win->winSetNextInLayout( NULL ); - win->winSetPrevInLayout( NULL ); + win->winSetLayout( nullptr ); + win->winSetNextInLayout( nullptr ); + win->winSetPrevInLayout( nullptr ); // if we removed the tail, set the new tail if( m_windowTail == win ) @@ -169,7 +169,7 @@ void WindowLayout::destroyWindows( void ) { GameWindow *window; - while( (window = getFirstWindow()) != 0 ) + while( (window = getFirstWindow()) != nullptr ) { // remove window from this layout @@ -204,7 +204,7 @@ Bool WindowLayout::load( AsciiString filename ) WindowLayoutInfo info; target = TheWindowManager->winCreateFromScript( filename, &info ); - if( target == NULL ) + if( target == nullptr ) { DEBUG_ASSERTCRASH( target, ("WindowLayout::load - Failed to load layout") ); @@ -293,6 +293,6 @@ GameWindow *WindowLayout::findWindow( GameWindow *window ) if( win == window ) return win; - return NULL; // window not found + return nullptr; // window not found } diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 6dbf2756c05..517d674579f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -86,7 +86,7 @@ #define DRAWABLE_HASH_SIZE 8192 /// The GameClient singleton instance -GameClient *TheGameClient = NULL; +GameClient *TheGameClient = nullptr; //------------------------------------------------------------------------------------------------- GameClient::GameClient() @@ -96,14 +96,14 @@ GameClient::GameClient() for( Int i = 0; i < MAX_CLIENT_TRANSLATORS; i++ ) m_translators[ i ] = TRANSLATOR_ID_INVALID; m_numTranslators = 0; - m_commandTranslator = NULL; + m_commandTranslator = nullptr; m_drawableTOC.clear(); m_textBearingDrawableList.clear(); m_frame = 0; - m_drawableList = NULL; + m_drawableList = nullptr; m_nextDrawableID = (DrawableID)1; TheDrawGroupInfo = new DrawGroupInfo; @@ -117,11 +117,11 @@ GameClient::~GameClient() { #ifdef PERF_TIMERS delete TheGraphDraw; - TheGraphDraw = NULL; + TheGraphDraw = nullptr; #endif delete TheDrawGroupInfo; - TheDrawGroupInfo = NULL; + TheDrawGroupInfo = nullptr; // clear any drawable TOC we might have m_drawableTOC.clear(); @@ -139,7 +139,7 @@ GameClient::~GameClient() //DEBUG_LOG(("End Texture files ------------------------------------------------")); delete TheCampaignManager; - TheCampaignManager = NULL; + TheCampaignManager = nullptr; // destroy all Drawables Drawable *draw, *nextDraw; @@ -148,39 +148,39 @@ GameClient::~GameClient() nextDraw = draw->getNextDrawable(); destroyDrawable( draw ); } - m_drawableList = NULL; + m_drawableList = nullptr; // delete the ray effects delete TheRayEffects; - TheRayEffects = NULL; + TheRayEffects = nullptr; // delete the hot key manager delete TheHotKeyManager; - TheHotKeyManager = NULL; + TheHotKeyManager = nullptr; // destroy the in-game user interface delete TheInGameUI; - TheInGameUI = NULL; + TheInGameUI = nullptr; // delete the shell delete TheShell; - TheShell = NULL; + TheShell = nullptr; delete TheIMEManager; - TheIMEManager = NULL; + TheIMEManager = nullptr; // delete window manager delete TheWindowManager; - TheWindowManager = NULL; + TheWindowManager = nullptr; // delete the font library TheFontLibrary->reset(); delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; TheMouse->reset(); delete TheMouse; - TheMouse = NULL; + TheMouse = nullptr; ///@todo : TheTerrainVisual used to be the first thing destroyed. //I had to put in here so that drawables free their track marks before @@ -188,41 +188,41 @@ GameClient::~GameClient() // destroy the terrain visual representation delete TheTerrainVisual; - TheTerrainVisual = NULL; + TheTerrainVisual = nullptr; // destroy the display delete TheDisplay; - TheDisplay = NULL; + TheDisplay = nullptr; delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; + TheHeaderTemplateManager = nullptr; delete TheLanguageFilter; - TheLanguageFilter = NULL; + TheLanguageFilter = nullptr; delete TheVideoPlayer; - TheVideoPlayer = NULL; + TheVideoPlayer = nullptr; // destroy all translators for( UnsignedInt i = 0; i < m_numTranslators; i++ ) TheMessageStream->removeTranslator( m_translators[ i ] ); m_numTranslators = 0; - m_commandTranslator = NULL; + m_commandTranslator = nullptr; delete TheAnim2DCollection; - TheAnim2DCollection = NULL; + TheAnim2DCollection = nullptr; delete TheMappedImageCollection; - TheMappedImageCollection = NULL; + TheMappedImageCollection = nullptr; delete TheKeyboard; - TheKeyboard = NULL; + TheKeyboard = nullptr; delete TheDisplayStringManager; - TheDisplayStringManager = NULL; + TheDisplayStringManager = nullptr; delete TheEva; - TheEva = NULL; + TheEva = nullptr; } @@ -236,7 +236,7 @@ void GameClient::init( void ) INI ini; // Load the DrawGroupInfo here, before the Display Manager is loaded. - ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, nullptr); // Override the ini values with localized versions: if (TheGlobalLanguageData && TheGlobalLanguageData->m_drawGroupInfoFont.name.isNotEmpty()) @@ -440,7 +440,7 @@ void GameClient::reset( void ) nextDraw = draw->getNextDrawable(); destroyDrawable( draw ); } - m_drawableList = NULL; + m_drawableList = nullptr; TheDisplay->reset(); TheTerrainVisual->reset(); @@ -619,7 +619,7 @@ void GameClient::update( void ) for (Int i=0; i < numPlayers; i++) { Player *player = ThePlayerList->getNthPlayer(i); - if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + if (player->getPlayerTemplate() != nullptr && player->getPlayerIndex() != localPlayerIndex) nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); } //update ghost objects which don't have drawables or objects. @@ -627,7 +627,7 @@ void GameClient::update( void ) } else { - TheGhostObjectManager->updateOrphanedObjects(NULL, 0); + TheGhostObjectManager->updateOrphanedObjects(nullptr, 0); } } @@ -766,7 +766,7 @@ void GameClient::iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr u nextDrawable = draw->getNextDrawable(); Coord3D pos = *draw->getPosition(); - if( region == NULL || + if( region == nullptr || (pos.x >= region->lo.x && pos.x <= region->hi.x && pos.y >= region->lo.y && pos.y <= region->hi.y && pos.z >= region->lo.z && pos.z <= region->hi.z) ) @@ -794,7 +794,7 @@ Drawable* GameClient::findDrawableByID( const DrawableID id ) DrawablePtrHashIt it = m_drawableHash.find(id); if (it == m_drawableHash.end()) { // no such drawable - return NULL; + return nullptr; } return (*it).second; @@ -825,7 +825,7 @@ void GameClient::destroyDrawable( Drawable *draw ) { DEBUG_ASSERTCRASH( obj->getDrawable() == draw, ("Object/Drawable pointer mismatch!") ); - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -844,7 +844,7 @@ void GameClient::addDrawableToLookupTable(Drawable *draw ) { // sanity - if( draw == NULL ) + if( draw == nullptr ) return; // add to lookup @@ -859,7 +859,7 @@ void GameClient::removeDrawableFromLookupTable( Drawable *draw ) { // sanity - if( draw == NULL ) + if( draw == nullptr ) return; // remove from table @@ -968,7 +968,7 @@ void GameClient::selectDrawablesInGroup( Int group ) // ------------------------------------------------------------------------------------------------ void GameClient::addTextBearingDrawable( Drawable *tbd ) { - if ( tbd != NULL ) + if ( tbd != nullptr ) m_textBearingDrawableList.push_back( tbd ); } // ------------------------------------------------------------------------------------------------ @@ -1197,7 +1197,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -1211,7 +1211,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -1233,7 +1233,7 @@ static Bool shouldSaveDrawable(const Drawable* draw) { if (draw->testDrawableStatus(DRAWABLE_STATUS_NO_SAVE)) { - if (draw->getObject() == NULL) + if (draw->getObject() == nullptr) { return false; } @@ -1275,7 +1275,7 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) templateName = draw->getTemplate()->getName(); // if is this drawable name already in the TOC, skip it - if( findTOCEntryByName( templateName ) != NULL ) + if( findTOCEntryByName( templateName ) != nullptr ) continue; // add this entry to the TOC @@ -1389,7 +1389,7 @@ void GameClient::xfer( Xfer *xfer ) // get TOC entry for this drawable tocEntry = findTOCEntryByName( draw->getTemplate()->getName() ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Drawable TOC entry not found for '%s'", draw->getTemplate()->getName().str() )); @@ -1431,7 +1431,7 @@ void GameClient::xfer( Xfer *xfer ) // find TOC entry with this identifier tocEntry = findTOCEntryById( tocID ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - No TOC entry match for id '%d'", tocID )); @@ -1444,7 +1444,7 @@ void GameClient::xfer( Xfer *xfer ) // find matching thing template thingTemplate = TheThingFactory->findTemplate( tocEntry->name ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Unrecognized thing template '%s', skipping. ENGINEERS - Are you *sure* it's OK to be ignoring this object from the save file??? Think hard about it!", @@ -1466,7 +1466,7 @@ void GameClient::xfer( Xfer *xfer ) Object *object = TheGameLogic->findObjectByID( objectID ); // sanity - if( object == NULL ) + if( object == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Cannot find object '%d' that is supposed to be attached to this drawable '%s'", @@ -1477,7 +1477,7 @@ void GameClient::xfer( Xfer *xfer ) // get the drawable from the object draw = object->getDrawable(); - if( draw == NULL ) + if( draw == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - There is no drawable attached to the object '%s' (%d) and there should be", @@ -1512,7 +1512,7 @@ void GameClient::xfer( Xfer *xfer ) draw = TheThingFactory->newDrawable( thingTemplate ); // sanity - if( draw == NULL ) + if( draw == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Unable to create drawable for '%s'", diff --git a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp index 80d83c9ba2b..5a374b7d710 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp @@ -145,8 +145,8 @@ class GameTextManager : public GameTextInterface virtual void update( void ) {}; ///< update text manager virtual void reset( void ); ///< Resets the text system - virtual UnicodeString fetch( const Char *label, Bool *exists = NULL ); ///< Returns the associated labeled unicode text - virtual UnicodeString fetch( AsciiString label, Bool *exists = NULL ); ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( const Char *label, Bool *exists = nullptr ); ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( AsciiString label, Bool *exists = nullptr ); ///< Returns the associated labeled unicode text virtual UnicodeString fetchFormat( const Char *label, ... ); virtual UnicodeString fetchOrSubstitute( const Char *label, const WideChar *substituteText ); virtual UnicodeString fetchOrSubstituteFormat( const Char *label, const WideChar *substituteFormat, ... ); @@ -210,7 +210,7 @@ static int _cdecl compareLUT ( const void *, const void*); // Public Data //---------------------------------------------------------------------------- -GameTextInterface *TheGameText = NULL; +GameTextInterface *TheGameText = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -245,10 +245,10 @@ GameTextInterface* CreateGameTextInterface( void ) GameTextManager::GameTextManager() : m_textCount(0), m_maxLabelLen(0), - m_stringInfo(NULL), - m_stringLUT(NULL), + m_stringInfo(nullptr), + m_stringLUT(nullptr), m_initialized(FALSE), - m_noStringList(NULL), + m_noStringList(nullptr), #if defined(RTS_DEBUG) m_jabberWockie(FALSE), m_munkee(FALSE), @@ -256,8 +256,8 @@ GameTextManager::GameTextManager() #else m_useStringFile(TRUE), #endif - m_mapStringInfo(NULL), - m_mapStringLUT(NULL), + m_mapStringInfo(nullptr), + m_mapStringLUT(nullptr), m_failed(L"***FATAL*** String Manager failed to initialize properly") { for(Int i=0; i < MAX_UITEXT_LENGTH; i++) @@ -328,7 +328,7 @@ void GameTextManager::init( void ) m_stringInfo = NEW StringInfo[m_textCount]; - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { deinit(); return; @@ -376,10 +376,10 @@ void GameTextManager::deinit( void ) { delete [] m_stringInfo; - m_stringInfo = NULL; + m_stringInfo = nullptr; delete [] m_stringLUT; - m_stringLUT = NULL; + m_stringLUT = nullptr; m_textCount = 0; @@ -397,7 +397,7 @@ void GameTextManager::deinit( void ) DEBUG_LOG(("*** End missing strings ***")); DEBUG_LOG_RAW(("\n")); - m_noStringList = NULL; + m_noStringList = nullptr; m_initialized = FALSE; } @@ -409,10 +409,10 @@ void GameTextManager::deinit( void ) void GameTextManager::reset( void ) { delete [] m_mapStringInfo; - m_mapStringInfo = NULL; + m_mapStringInfo = nullptr; delete [] m_mapStringLUT; - m_mapStringLUT = NULL; + m_mapStringLUT = nullptr; } @@ -514,7 +514,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -571,7 +571,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -677,7 +677,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) if ( m_jabberWockie ) { static Char buffer[MAX_UITEXT_LENGTH*2]; - Char *firstLetter = NULL, *lastLetter; + Char *firstLetter = nullptr, *lastLetter; Char *b = buffer; Int formatWord = FALSE; Char ch; @@ -693,7 +693,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) lastLetter = b-1; reverseWord ( firstLetter, lastLetter ); } - firstLetter = NULL; + firstLetter = nullptr; formatWord = FALSE; } *b++ = ch; @@ -806,7 +806,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) file = TheFileSystem->openFile(filename, File::READ | File::TEXT); DEBUG_LOG(("Looking in %s for string file", filename)); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -832,7 +832,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) textCount += 500; file->close(); - file = NULL; + file = nullptr; return TRUE; } @@ -847,7 +847,7 @@ Bool GameTextManager::getCSFInfo ( const Char *filename ) File *file = TheFileSystem->openFile(filename, File::READ | File::BINARY); DEBUG_LOG(("Looking in %s for compiled string file", filename)); - if ( file != NULL ) + if ( file != nullptr ) { if ( file->read( &header, sizeof ( header )) == sizeof ( header ) ) { @@ -869,7 +869,7 @@ Bool GameTextManager::getCSFInfo ( const Char *filename ) } file->close(); - file = NULL; + file = nullptr; } return ok; @@ -890,7 +890,7 @@ Bool GameTextManager::parseCSF( const Char *filename ) file = TheFileSystem->openFile(filename, File::READ | File::BINARY); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -996,7 +996,7 @@ Bool GameTextManager::parseCSF( const Char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1013,7 +1013,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) File *file = TheFileSystem->openFile(filename, File::READ | File::TEXT); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -1098,7 +1098,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1144,7 +1144,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) File *file; file = TheFileSystem->openFile(filename, File::READ | File::TEXT); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -1233,7 +1233,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1246,7 +1246,7 @@ UnicodeString GameTextManager::fetch( const Char *label, Bool *exists ) { DEBUG_ASSERTCRASH ( m_initialized, ("String Manager has not been m_initialized") ); - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { if( exists ) *exists = FALSE; @@ -1257,17 +1257,17 @@ UnicodeString GameTextManager::fetch( const Char *label, Bool *exists ) StringLookUp key; AsciiString lb; lb = label; - key.info = NULL; + key.info = nullptr; key.label = &lb; lookUp = (StringLookUp *) bsearch( &key, (void*) m_stringLUT, m_textCount, sizeof(StringLookUp), compareLUT ); - if ( lookUp == NULL && m_mapStringLUT && m_mapTextCount ) + if ( lookUp == nullptr && m_mapStringLUT && m_mapTextCount ) { lookUp = (StringLookUp *) bsearch( &key, (void*) m_mapStringLUT, m_mapTextCount, sizeof(StringLookUp), compareLUT ); } - if( lookUp == NULL ) + if( lookUp == nullptr ) { // string not found diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 887381c4440..63322480af8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -64,7 +64,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -GlobalLanguage *TheGlobalLanguageData = NULL; ///< The global language singleton +GlobalLanguage *TheGlobalLanguageData = nullptr; ///< The global language singleton static const LookupListRec ResolutionFontSizeMethodNames[] = { @@ -72,37 +72,37 @@ static const LookupListRec ResolutionFontSizeMethodNames[] = { "CLASSIC_NO_CEILING", GlobalLanguage::ResolutionFontSizeMethod_ClassicNoCeiling }, { "STRICT", GlobalLanguage::ResolutionFontSizeMethod_Strict }, { "BALANCED", GlobalLanguage::ResolutionFontSizeMethod_Balanced }, - { NULL, 0 } + { nullptr, 0 } }; static const FieldParse TheGlobalLanguageDataFieldParseTable[] = { - { "UnicodeFontName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontName ) }, - //{ "UnicodeFontFileName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontFileName ) }, - { "LocalFontFile", GlobalLanguage::parseFontFileName, NULL, 0}, - { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) }, - { "UseHardWordWrap", INI::parseBool, NULL, offsetof( GlobalLanguage, m_useHardWrap) }, - { "ResolutionFontAdjustment", INI::parseReal, NULL, offsetof( GlobalLanguage, m_resolutionFontSizeAdjustment) }, + { "UnicodeFontName", INI::parseAsciiString,nullptr, offsetof( GlobalLanguage, m_unicodeFontName ) }, + //{ "UnicodeFontFileName", INI::parseAsciiString,nullptr, offsetof( GlobalLanguage, m_unicodeFontFileName ) }, + { "LocalFontFile", GlobalLanguage::parseFontFileName, nullptr, 0}, + { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) }, + { "UseHardWordWrap", INI::parseBool, nullptr, offsetof( GlobalLanguage, m_useHardWrap) }, + { "ResolutionFontAdjustment", INI::parseReal, nullptr, offsetof( GlobalLanguage, m_resolutionFontSizeAdjustment) }, { "ResolutionFontSizeMethod", INI::parseLookupList, ResolutionFontSizeMethodNames, offsetof( GlobalLanguage, m_resolutionFontSizeMethod) }, - { "CopyrightFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_copyrightFont ) }, - { "MessageFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_messageFont) }, - { "MilitaryCaptionTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_militaryCaptionTitleFont) }, - { "MilitaryCaptionFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_militaryCaptionFont) }, - { "SuperweaponCountdownNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_superweaponCountdownNormalFont) }, - { "SuperweaponCountdownReadyFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_superweaponCountdownReadyFont) }, - { "NamedTimerCountdownNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_namedTimerCountdownNormalFont) }, - { "NamedTimerCountdownReadyFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_namedTimerCountdownReadyFont) }, - { "DrawableCaptionFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_drawableCaptionFont) }, - { "DefaultWindowFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_defaultWindowFont) }, - { "DefaultDisplayStringFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_defaultDisplayStringFont) }, - { "TooltipFontName", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_tooltipFontName) }, - { "NativeDebugDisplay", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_nativeDebugDisplay) }, - { "DrawGroupInfoFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_drawGroupInfoFont) }, - { "CreditsTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsTitleFont) }, - { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsPositionFont) }, - { "CreditsNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsNormalFont) }, + { "CopyrightFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_copyrightFont ) }, + { "MessageFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_messageFont) }, + { "MilitaryCaptionTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_militaryCaptionTitleFont) }, + { "MilitaryCaptionFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_militaryCaptionFont) }, + { "SuperweaponCountdownNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_superweaponCountdownNormalFont) }, + { "SuperweaponCountdownReadyFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_superweaponCountdownReadyFont) }, + { "NamedTimerCountdownNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_namedTimerCountdownNormalFont) }, + { "NamedTimerCountdownReadyFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_namedTimerCountdownReadyFont) }, + { "DrawableCaptionFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_drawableCaptionFont) }, + { "DefaultWindowFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_defaultWindowFont) }, + { "DefaultDisplayStringFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_defaultDisplayStringFont) }, + { "TooltipFontName", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_tooltipFontName) }, + { "NativeDebugDisplay", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_nativeDebugDisplay) }, + { "DrawGroupInfoFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_drawGroupInfoFont) }, + { "CreditsTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsTitleFont) }, + { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsPositionFont) }, + { "CreditsNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsNormalFont) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; //----------------------------------------------------------------------------- @@ -151,7 +151,7 @@ void GlobalLanguage::init( void ) fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); INI ini; - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, nullptr ); } StringListIt it = m_localFonts.begin(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GraphDraw.cpp b/Generals/Code/GameEngine/Source/GameClient/GraphDraw.cpp index b546c3f660c..7b4a5cf80ac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GraphDraw.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GraphDraw.cpp @@ -119,6 +119,6 @@ void GraphDraw::clear() m_graphEntries.clear(); } -GraphDraw *TheGraphDraw = NULL; +GraphDraw *TheGraphDraw = nullptr; #endif /* PERF_TIMERS */ diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 34b0ab6320c..48fcba3564a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -127,9 +127,9 @@ static UnicodeString formatIncomeValue(UnsignedInt cashPerMin) //------------------------------------------------------------------------------------------------- /// The InGameUI singleton instance. -InGameUI *TheInGameUI = NULL; +InGameUI *TheInGameUI = nullptr; -GameWindow *m_replayWindow = NULL; +GameWindow *m_replayWindow = nullptr; // ------------------------------------------------------------------------------------------------ struct KindOfSelectionData @@ -298,8 +298,8 @@ SuperweaponInfo::SuperweaponInfo( m_hiddenByScience(hiddenByScience), m_ready(ready), m_forceUpdateText(false), - m_nameDisplayString(NULL), - m_timeDisplayString(NULL), + m_nameDisplayString(nullptr), + m_timeDisplayString(nullptr), m_color(c), m_powerTemplate(spt) { @@ -320,11 +320,11 @@ SuperweaponInfo::~SuperweaponInfo() { if (m_nameDisplayString) TheDisplayStringManager->freeDisplayString( m_nameDisplayString ); - m_nameDisplayString = NULL; + m_nameDisplayString = nullptr; if (m_timeDisplayString) TheDisplayStringManager->freeDisplayString( m_timeDisplayString ); - m_timeDisplayString = NULL; + m_timeDisplayString = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -482,7 +482,7 @@ void InGameUI::xfer( Xfer *xfer ) AsciiString templateName; xfer->xferAsciiString(&templateName); const SpecialPowerTemplate* powerTemplate = TheSpecialPowerStore->findSpecialPowerTemplate(templateName); - if (powerTemplate == NULL) + if (powerTemplate == nullptr) { DEBUG_CRASH(("power %s not found",templateName.str())); throw INI_INVALID_DATA; @@ -503,7 +503,7 @@ void InGameUI::xfer( Xfer *xfer ) // srj sez: due to order-of-operation stuff, sometimes these will already exist, // sometimes not. not sure why. so handle both cases. SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo == NULL) + if (swInfo == nullptr) { const Player* player = ThePlayerList->getNthPlayer(playerIndex); swInfo = newInstance(SuperweaponInfo)( @@ -571,19 +571,19 @@ SuperweaponInfo* InGameUI::findSWInfo(Int playerIndex, const AsciiString& powerN } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate) { - if (powerTemplate == NULL) + if (powerTemplate == nullptr) return; // srj sez: don't allow adding the same superweapon more than once. it can happen. not sure how. (srj) SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo != NULL) + if (swInfo != nullptr) return; const Player* player = ThePlayerList->getNthPlayer(playerIndex); @@ -779,130 +779,130 @@ void InGameUI::showNamedTimerDisplay( Bool show ) //------------------------------------------------------------------------------------------------- const FieldParse InGameUI::s_fieldParseTable[] = { - { "MaxSelectionSize", INI::parseInt, NULL, offsetof( InGameUI, m_maxSelectCount ) }, - - { "MessageColor1", INI::parseColorInt, NULL, offsetof( InGameUI, m_messageColor1 ) }, - { "MessageColor2", INI::parseColorInt, NULL, offsetof( InGameUI, m_messageColor2 ) }, - { "MessagePosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_messagePosition ) }, - { "MessageFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_messageFont ) }, - { "MessagePointSize", INI::parseInt, NULL, offsetof( InGameUI, m_messagePointSize ) }, - { "MessageBold", INI::parseBool, NULL, offsetof( InGameUI, m_messageBold ) }, - { "MessageDelayMS", INI::parseInt, NULL, offsetof( InGameUI, m_messageDelayMS ) }, - - { "MilitaryCaptionColor", INI::parseRGBAColorInt, NULL, offsetof( InGameUI, m_militaryCaptionColor ) }, - { "MilitaryCaptionPosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "MilitaryCaptionTitleFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, - { "MilitaryCaptionTitlePointSize", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, - { "MilitaryCaptionTitleBold", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, - - { "MilitaryCaptionFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_militaryCaptionFont ) }, - { "MilitaryCaptionPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionPointSize ) }, - { "MilitaryCaptionBold", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionBold ) }, - - { "MilitaryCaptionRandomizeTyping", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, - { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionSpeed ) }, - { "MilitaryCaptionDelayMS", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionDelayMS ) }, - - { "MilitaryCaptionPosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "SuperweaponCountdownPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_superweaponPosition ) }, - { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, NULL, offsetof( InGameUI, m_superweaponFlashDuration ) }, - { "SuperweaponCountdownFlashColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_superweaponFlashColor ) }, - - { "SuperweaponCountdownNormalFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_superweaponNormalFont ) }, - { "SuperweaponCountdownNormalPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_superweaponNormalPointSize ) }, - { "SuperweaponCountdownNormalBold", INI::parseBool, NULL, offsetof( InGameUI, m_superweaponNormalBold ) }, - - { "SuperweaponCountdownReadyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_superweaponReadyFont ) }, - { "SuperweaponCountdownReadyPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_superweaponReadyPointSize ) }, - { "SuperweaponCountdownReadyBold", INI::parseBool, NULL, offsetof( InGameUI, m_superweaponReadyBold ) }, - - { "NamedTimerCountdownPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_namedTimerPosition ) }, - { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, NULL, offsetof( InGameUI, m_namedTimerFlashDuration ) }, - { "NamedTimerCountdownFlashColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerFlashColor ) }, - - { "NamedTimerCountdownNormalFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_namedTimerNormalFont ) }, - { "NamedTimerCountdownNormalPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, - { "NamedTimerCountdownNormalBold", INI::parseBool, NULL, offsetof( InGameUI, m_namedTimerNormalBold ) }, - { "NamedTimerCountdownNormalColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerNormalColor ) }, - - { "NamedTimerCountdownReadyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_namedTimerReadyFont ) }, - { "NamedTimerCountdownReadyPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, - { "NamedTimerCountdownReadyBold", INI::parseBool, NULL, offsetof( InGameUI, m_namedTimerReadyBold ) }, - { "NamedTimerCountdownReadyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerReadyColor ) }, - - { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, NULL, offsetof( InGameUI, m_floatingTextTimeOut ) }, - { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, NULL, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, - { "FloatingTextVanishRate", INI::parseVelocityReal, NULL, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, - - { "PopupMessageColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_popupMessageColor ) }, - - { "DrawableCaptionFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_drawableCaptionFont ) }, - { "DrawableCaptionPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_drawableCaptionPointSize ) }, - { "DrawableCaptionBold", INI::parseBool, NULL, offsetof( InGameUI, m_drawableCaptionBold ) }, - { "DrawableCaptionColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_drawableCaptionColor ) }, - - { "DrawRMBScrollAnchor", INI::parseBool, NULL, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, - { "MoveRMBScrollAnchor", INI::parseBool, NULL, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, - - { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, - { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, - { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, - { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, - { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, - { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, - - { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, - { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, - - { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, - { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, - { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, - { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, - { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, - { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, - - { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, - { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, - { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, - { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, - { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, - - { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, - { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, - { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, - { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, - { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, + { "MaxSelectionSize", INI::parseInt, nullptr, offsetof( InGameUI, m_maxSelectCount ) }, + + { "MessageColor1", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor1 ) }, + { "MessageColor2", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor2 ) }, + { "MessagePosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_messagePosition ) }, + { "MessageFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_messageFont ) }, + { "MessagePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_messagePointSize ) }, + { "MessageBold", INI::parseBool, nullptr, offsetof( InGameUI, m_messageBold ) }, + { "MessageDelayMS", INI::parseInt, nullptr, offsetof( InGameUI, m_messageDelayMS ) }, + + { "MilitaryCaptionColor", INI::parseRGBAColorInt, nullptr, offsetof( InGameUI, m_militaryCaptionColor ) }, + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "MilitaryCaptionTitleFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, + { "MilitaryCaptionTitlePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, + { "MilitaryCaptionTitleBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, + + { "MilitaryCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionFont ) }, + { "MilitaryCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionPointSize ) }, + { "MilitaryCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionBold ) }, + + { "MilitaryCaptionRandomizeTyping", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, + { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionSpeed ) }, + { "MilitaryCaptionDelayMS", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionDelayMS ) }, + + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "SuperweaponCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_superweaponPosition ) }, + { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_superweaponFlashDuration ) }, + { "SuperweaponCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_superweaponFlashColor ) }, + + { "SuperweaponCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponNormalFont ) }, + { "SuperweaponCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponNormalPointSize ) }, + { "SuperweaponCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponNormalBold ) }, + + { "SuperweaponCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponReadyFont ) }, + { "SuperweaponCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponReadyPointSize ) }, + { "SuperweaponCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponReadyBold ) }, + + { "NamedTimerCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_namedTimerPosition ) }, + { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_namedTimerFlashDuration ) }, + { "NamedTimerCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerFlashColor ) }, + + { "NamedTimerCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerNormalFont ) }, + { "NamedTimerCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, + { "NamedTimerCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerNormalBold ) }, + { "NamedTimerCountdownNormalColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerNormalColor ) }, + + { "NamedTimerCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerReadyFont ) }, + { "NamedTimerCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, + { "NamedTimerCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerReadyBold ) }, + { "NamedTimerCountdownReadyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerReadyColor ) }, + + { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, nullptr, offsetof( InGameUI, m_floatingTextTimeOut ) }, + { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, + { "FloatingTextVanishRate", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, + + { "PopupMessageColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_popupMessageColor ) }, + + { "DrawableCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_drawableCaptionFont ) }, + { "DrawableCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_drawableCaptionPointSize ) }, + { "DrawableCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_drawableCaptionBold ) }, + { "DrawableCaptionColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_drawableCaptionColor ) }, + + { "DrawRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, + { "MoveRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, + + { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, + { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, + { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, + { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, + { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, + { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, + + { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, + { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, + + { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, + { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, + { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, + { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, + { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, + { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, + + { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, + { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, + { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, + { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, + { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, + + { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, + { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, + { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, + { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, + { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, // TheSuperHackers @info ui enhancement configuration - { "NetworkLatencyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_networkLatencyFont ) }, - { "NetworkLatencyBold", INI::parseBool, NULL, offsetof( InGameUI, m_networkLatencyBold ) }, - { "NetworkLatencyPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_networkLatencyPosition ) }, - { "NetworkLatencyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyColor ) }, - { "NetworkLatencyDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyDropColor ) }, - - { "RenderFpsFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_renderFpsFont ) }, - { "RenderFpsBold", INI::parseBool, NULL, offsetof( InGameUI, m_renderFpsBold ) }, - { "RenderFpsPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_renderFpsPosition ) }, - { "RenderFpsColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsColor ) }, - { "RenderFpsLimitColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsLimitColor ) }, - { "RenderFpsDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsDropColor ) }, - { "RenderFpsRefreshMs", INI::parseUnsignedInt, NULL, offsetof( InGameUI, m_renderFpsRefreshMs ) }, - - { "SystemTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_systemTimeFont ) }, - { "SystemTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_systemTimeBold ) }, - { "SystemTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_systemTimePosition ) }, - { "SystemTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_systemTimeColor ) }, - { "SystemTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_systemTimeDropColor ) }, - - { "GameTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_gameTimeFont ) }, - { "GameTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_gameTimeBold ) }, - { "GameTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_gameTimePosition ) }, - { "GameTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeColor ) }, - { "GameTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeDropColor ) }, - - { NULL, NULL, NULL, 0 } + { "NetworkLatencyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_networkLatencyFont ) }, + { "NetworkLatencyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_networkLatencyBold ) }, + { "NetworkLatencyPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_networkLatencyPosition ) }, + { "NetworkLatencyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyColor ) }, + { "NetworkLatencyDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyDropColor ) }, + + { "RenderFpsFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_renderFpsFont ) }, + { "RenderFpsBold", INI::parseBool, nullptr, offsetof( InGameUI, m_renderFpsBold ) }, + { "RenderFpsPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_renderFpsPosition ) }, + { "RenderFpsColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsColor ) }, + { "RenderFpsLimitColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsLimitColor ) }, + { "RenderFpsDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsDropColor ) }, + { "RenderFpsRefreshMs", INI::parseUnsignedInt, nullptr, offsetof( InGameUI, m_renderFpsRefreshMs ) }, + + { "SystemTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_systemTimeFont ) }, + { "SystemTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_systemTimeBold ) }, + { "SystemTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_systemTimePosition ) }, + { "SystemTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeColor ) }, + { "SystemTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeDropColor ) }, + + { "GameTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_gameTimeFont ) }, + { "GameTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_gameTimeBold ) }, + { "GameTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_gameTimePosition ) }, + { "GameTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeColor ) }, + { "GameTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeDropColor ) }, + + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -947,8 +947,8 @@ InGameUI::InGameUI() m_mousedOverDrawableID = INVALID_DRAWABLE_ID; m_currentlyPlayingMovie.clear(); - m_militarySubtitle = NULL; - m_popupMessageData = NULL; + m_militarySubtitle = nullptr; + m_popupMessageData = nullptr; m_waypointMode = FALSE; m_clientQuiet = FALSE; @@ -996,46 +996,46 @@ InGameUI::InGameUI() for( i = 0; i < MAX_BUILD_PROGRESS; i++ ) { - m_buildProgress[ i ].m_thingTemplate = NULL; + m_buildProgress[ i ].m_thingTemplate = nullptr; m_buildProgress[ i ].m_percentComplete = 0.0f; - m_buildProgress[ i ].m_control = NULL; + m_buildProgress[ i ].m_control = nullptr; } - m_pendingGUICommand = NULL; + m_pendingGUICommand = nullptr; // allocate an array for the placement icons m_placeIcon = NEW Drawable* [ TheGlobalData->m_maxLineBuildObjects ]; for( i = 0; i < TheGlobalData->m_maxLineBuildObjects; i++ ) - m_placeIcon[ i ] = NULL; - m_pendingPlaceType = NULL; + m_placeIcon[ i ] = nullptr; + m_pendingPlaceType = nullptr; m_pendingPlaceSourceObjectID = INVALID_ID; m_preventLeftClickDeselectionInAlternateMouseModeForOneClick = FALSE; m_placeAnchorStart.x = m_placeAnchorStart.y = 0; m_placeAnchorEnd.x = m_placeAnchorEnd.y = 0; m_placeAnchorInProgress = FALSE; - m_videoStream = NULL; - m_videoBuffer = NULL; - m_cameoVideoStream = NULL; - m_cameoVideoBuffer = NULL; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + m_cameoVideoStream = nullptr; + m_cameoVideoBuffer = nullptr; // message info for( i = 0; i < MAX_UI_MESSAGES; i++ ) { m_uiMessages[ i ].fullText.clear(); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; m_uiMessages[ i ].color = 0; } - m_replayWindow = NULL; + m_replayWindow = nullptr; m_messagesOn = TRUE; // TheSuperHackers @info the default font, size and positions of the various counters were chosen based on GenTools implementation - m_networkLatencyString = NULL; + m_networkLatencyString = nullptr; m_networkLatencyFont = "Tahoma"; m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; m_networkLatencyBold = TRUE; @@ -1045,8 +1045,8 @@ InGameUI::InGameUI() m_networkLatencyDropColor = GameMakeColor( 0, 0, 0, 255 ); m_lastNetworkLatencyFrames = ~0u; - m_renderFpsString = NULL; - m_renderFpsLimitString = NULL; + m_renderFpsString = nullptr; + m_renderFpsLimitString = nullptr; m_renderFpsFont = "Tahoma"; m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; m_renderFpsBold = TRUE; @@ -1060,7 +1060,7 @@ InGameUI::InGameUI() m_lastRenderFpsLimit = ~0u; m_lastRenderFpsUpdateMs = 0u; - m_systemTimeString = NULL; + m_systemTimeString = nullptr; m_systemTimeFont = "Tahoma"; m_systemTimePointSize = TheGlobalData->m_systemTimeFontSize; m_systemTimeBold = TRUE; @@ -1069,8 +1069,8 @@ InGameUI::InGameUI() m_systemTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_systemTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); - m_gameTimeString = NULL; - m_gameTimeFrameString = NULL; + m_gameTimeString = nullptr; + m_gameTimeFrameString = nullptr; m_gameTimeFont = "Tahoma"; m_gameTimePointSize = TheGlobalData->m_gameTimeFontSize; m_gameTimeBold = TRUE; @@ -1125,7 +1125,7 @@ InGameUI::InGameUI() m_moveRMBScrollAnchor = FALSE; m_displayedMaxWarning = FALSE; - m_idleWorkerWin = NULL; + m_idleWorkerWin = nullptr; m_currentIdleWorkerDisplay = -1; m_waypointMode = false; @@ -1145,7 +1145,7 @@ InGameUI::InGameUI() InGameUI::~InGameUI() { delete TheControlBar; - TheControlBar = NULL; + TheControlBar = nullptr; // free all the display strings if we're removeMilitarySubtitle(); @@ -1154,7 +1154,7 @@ InGameUI::~InGameUI() stopCameoMovie(); // remove any build available status - placeBuildAvailable( NULL, NULL ); + placeBuildAvailable( nullptr, nullptr ); setRadiusCursorNone(); // delete the message resources @@ -1165,7 +1165,7 @@ InGameUI::~InGameUI() // delete the array for the drawbles delete [] m_placeIcon; - m_placeIcon = NULL; + m_placeIcon = nullptr; // clear floating text clearFloatingText(); @@ -1181,7 +1181,7 @@ InGameUI::~InGameUI() void InGameUI::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, nullptr ); //override INI values with language localized values: if (TheGlobalLanguageData) @@ -1286,7 +1286,7 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe if (cursorType == RADIUSCURSOR_NONE) return; - Object* obj = NULL; + Object* obj = nullptr; if (m_pendingGUICommand && m_pendingGUICommand->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER) { if (ThePlayerList && ThePlayerList->getLocalPlayer()) @@ -1298,21 +1298,21 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe return; Drawable *draw = getFirstSelectedDrawable(); - if (draw == NULL) + if (draw == nullptr) return; obj = draw->getObject(); } - if (obj == NULL) + if (obj == nullptr) return; Player* controller = obj->getControllingPlayer(); - if (controller == NULL) + if (controller == nullptr) return; Real radius = 0.0f; - const Weapon* w = NULL; + const Weapon* w = nullptr; switch (cursorType) { // already handled @@ -1407,7 +1407,7 @@ void InGameUI::evaluateSoloNexus( Drawable *newlyAddedDrawable ) m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID;//failsafe... - // short test: If the thing just added is a nonmobster, bail with NULL + // short test: If the thing just added is a nonmobster, bail with nullptr if ( newlyAddedDrawable ) { const Object *newObj = newlyAddedDrawable->getObject(); @@ -1542,12 +1542,12 @@ void InGameUI::handleBuildPlacements( void ) BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, builderObject, - NULL ); + nullptr ); if( lbc != LBC_OK ) m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor ); else - m_placeIcon[ 0 ]->colorTint( NULL ); + m_placeIcon[ 0 ]->colorTint( nullptr ); @@ -1604,7 +1604,7 @@ void InGameUI::handleBuildPlacements( void ) for( i = 0; i < tileBuildInfo->tilesUsed; i++ ) { - if( m_placeIcon[ i ] == NULL ) + if( m_placeIcon[ i ] == nullptr ) { UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; @@ -1620,9 +1620,9 @@ void InGameUI::handleBuildPlacements( void ) for( i = tileBuildInfo->tilesUsed; i < maxObjects; i++ ) { - if( m_placeIcon[ i ] != NULL ) + if( m_placeIcon[ i ] != nullptr ) TheGameClient->destroyDrawable( m_placeIcon[ i ] ); - m_placeIcon[ i ] = NULL; + m_placeIcon[ i ] = nullptr; } @@ -1793,7 +1793,7 @@ void InGameUI::update( void ) { // increment the Block position's Y value to draw it on the next line Int height; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(NULL, &height); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(nullptr, &height); m_militarySubtitle->blockPos.y = m_militarySubtitle->blockPos.y + height; // Now add a new display string @@ -1821,7 +1821,7 @@ void InGameUI::update( void ) m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->appendChar(tempWChar); // increment the draw position of the block Int width; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,NULL); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,nullptr); m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x + width; // lets make a sound @@ -1865,13 +1865,13 @@ void InGameUI::update( void ) static NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); static NameKeyType powerWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ); - GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); - GameWindow *powerWin = TheWindowManager->winGetWindowFromId( NULL, powerWindowKey ); -// if( moneyWin == NULL ) + GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); + GameWindow *powerWin = TheWindowManager->winGetWindowFromId( nullptr, powerWindowKey ); +// if( moneyWin == nullptr ) // { // NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); // -// moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); +// moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); // // } // end if Player* moneyPlayer = TheControlBar->getCurrentlyViewedPlayer(); @@ -2002,10 +2002,10 @@ void InGameUI::reset( void ) stopMovie(); // remove any pending GUI command - setGUICommand( NULL ); + setGUICommand( nullptr ); // remove any build available status - placeBuildAvailable( NULL, NULL ); + placeBuildAvailable( nullptr, nullptr ); // free any message resources allocated freeMessageResources(); @@ -2097,7 +2097,7 @@ void InGameUI::freeMessageResources( void ) // free display string if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; // set timestamp to zero m_uiMessages[ i ].timestamp = 0; @@ -2109,17 +2109,17 @@ void InGameUI::freeMessageResources( void ) void InGameUI::freeCustomUiResources( void ) { TheDisplayStringManager->freeDisplayString(m_networkLatencyString); - m_networkLatencyString = NULL; + m_networkLatencyString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsString); - m_renderFpsString = NULL; + m_renderFpsString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsLimitString); - m_renderFpsLimitString = NULL; + m_renderFpsLimitString = nullptr; TheDisplayStringManager->freeDisplayString(m_systemTimeString); - m_systemTimeString = NULL; + m_systemTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeString); - m_gameTimeString = NULL; + m_gameTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeFrameString); - m_gameTimeFrameString = NULL; + m_gameTimeFrameString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2158,7 +2158,7 @@ void InGameUI::message( AsciiString stringManagerLabel, ... ) //------------------------------------------------------------------------------------------------- void InGameUI::messageNoFormat( const UnicodeString& message ) { - addMessageText( message, NULL ); + addMessageText( message, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -2240,7 +2240,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC m_uiMessages[ MAX_UI_MESSAGES - 1 ].fullText.clear(); if( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ); - m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = NULL; + m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = nullptr; m_uiMessages[ MAX_UI_MESSAGES - 1 ].timestamp = 0; // shift all the messages down one index and remove the last one @@ -2263,7 +2263,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC // assign a color for this string instance that will stay with it no matter what // line it is rendered on // - if( m_uiMessages[ 1 ].displayString == NULL || m_uiMessages[ 1 ].color == color2 ) + if( m_uiMessages[ 1 ].displayString == nullptr || m_uiMessages[ 1 ].color == color2 ) m_uiMessages[ 0 ].color = color1; else m_uiMessages[ 0 ].color = color2; @@ -2279,7 +2279,7 @@ void InGameUI::removeMessageAtIndex( Int i ) m_uiMessages[ i ].fullText.clear(); if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; } @@ -2318,7 +2318,7 @@ void InGameUI::createMoveHint( const GameMessage *msg ) if( getSelectCount() == 1 ) { Drawable *draw = getFirstSelectedDrawable(); - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; if( obj && obj->isKindOf( KINDOF_IMMOBILE ) ) { //Don't allow move hints to be created if our selected object can't move! @@ -2385,7 +2385,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) if (m_isScrolling || m_isSelecting) return; // no mouseover for you - GameWindow *window = NULL; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2420,7 +2420,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->setCursorTooltip(UnicodeString::TheEmptyString ); m_mousedOverDrawableID = INVALID_DRAWABLE_ID; const Drawable *draw = TheGameClient->findDrawableByID(msg->getArgument(0)->drawableID); - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; if( obj ) { @@ -2451,14 +2451,14 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) #endif - const Player* player = NULL; + const Player* player = nullptr; const ThingTemplate *thingTemplate = obj->getTemplate(); ContainModuleInterface* contain = obj->getContain(); if( contain ) player = contain->getApparentControllingPlayer(ThePlayerList->getLocalPlayer()); - if (player == NULL) + if (player == nullptr) player = obj->getControllingPlayer(); Bool disguised = false; @@ -2551,7 +2551,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) // Add on dollar amount of warehouse contents so people don't freak out until the art is hooked up static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" ); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey ); - if( warehouseModule != NULL ) + if( warehouseModule != nullptr ) { Int boxes = warehouseModule->getBoxesStored(); Int value = boxes * TheGlobalData->m_baseValuePerSupplyBox; @@ -2628,7 +2628,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) Drawable *draw = TheGameClient->findDrawableByID(m_mousedOverDrawableID); //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { @@ -2684,7 +2684,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) //#endif // set cursor to normal if there is a window under the cursor - GameWindow *window = NULL; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2709,19 +2709,19 @@ void InGameUI::createCommandHint( const GameMessage *msg ) } //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { drawSelectable = false; } - // Note: These are only non-NULL if there is exactly one thing selected. - const Drawable *srcDraw = NULL; - const Object *srcObj = NULL; + // Note: These are only non-null if there is exactly one thing selected. + const Drawable *srcDraw = nullptr; + const Object *srcObj = nullptr; if (getSelectCount() == 1) { srcDraw = getAllSelectedDrawables()->front(); - srcObj = (srcDraw ? srcDraw->getObject() : NULL); + srcObj = (srcDraw ? srcDraw->getObject() : nullptr); } switch (m_mouseMode) @@ -2937,7 +2937,7 @@ void InGameUI::setScrolling( Bool isScrolling ) // break any camera locks TheTacticalView->setCameraLock( INVALID_ID ); - TheTacticalView->setCameraLockDrawable( NULL ); + TheTacticalView->setCameraLockDrawable( nullptr ); } else { @@ -3014,7 +3014,7 @@ void InGameUI::setGUICommand( const CommandButton *command ) DEBUG_ASSERTCRASH( 0, ("setGUICommand: Command '%s' does not need additional user interaction", command->getName().str()) ); - m_pendingGUICommand = NULL; + m_pendingGUICommand = nullptr; m_mouseMode = MOUSEMODE_DEFAULT; return; @@ -3066,7 +3066,7 @@ const CommandButton *InGameUI::getGUICommand( void ) const } //------------------------------------------------------------------------------------------------- -/** Destroy any drawables we have in our placement icon array and set to NULL */ +/** Destroy any drawables we have in our placement icon array and set to null */ //------------------------------------------------------------------------------------------------- void InGameUI::destroyPlacementIcons( void ) { @@ -3080,7 +3080,7 @@ void InGameUI::destroyPlacementIcons( void ) TheTerrainVisual->removeFactionBibDrawable(m_placeIcon[ i ]); TheGameClient->destroyDrawable( m_placeIcon[ i ] ); } - m_placeIcon[ i ] = NULL; + m_placeIcon[ i ] = nullptr; } TheTerrainVisual->removeAllBibs(); @@ -3095,7 +3095,7 @@ void InGameUI::destroyPlacementIcons( void ) void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildDrawable ) { - if (build != NULL) + if (build != nullptr) { // if building something, no radius cursor, thankew setRadiusCursorNone(); @@ -3105,8 +3105,8 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // if we're setting another place available, but we're somehow already in the placement // mode, get out of it before we start a new one // - if( m_pendingPlaceType != NULL && build != NULL ) - placeBuildAvailable( NULL, NULL ); + if( m_pendingPlaceType != nullptr && build != nullptr ) + placeBuildAvailable( nullptr, nullptr ); // // keep a record of what we are trying to place, if we are already trying to @@ -3119,7 +3119,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( m_pendingPlaceSourceObjectID != INVALID_ID ); m_pendingPlaceSourceObjectID = INVALID_ID; - Object *sourceObject = NULL; + Object *sourceObject = nullptr; if( buildDrawable ) sourceObject = buildDrawable->getObject(); if( sourceObject ) @@ -3177,7 +3177,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD draw->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the "icon" in the icon array at the first index - DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); + DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == nullptr, ("placeBuildAvailable, build icon array is not empty!") ); m_placeIcon[ 0 ] = draw; } @@ -3190,7 +3190,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD } setMouseCursor( Mouse::ARROW ); - setPlacementStart( NULL ); + setPlacementStart( nullptr ); // if we have a place icons destroy them destroyPlacementIcons(); @@ -3428,7 +3428,7 @@ Drawable *InGameUI::getFirstSelectedDrawable( void ) // sanity if( m_selectedDrawables.empty() ) - return NULL; // this is valid, nothing is selected + return nullptr; // this is valid, nothing is selected return m_selectedDrawables.front(); @@ -3641,7 +3641,7 @@ void InGameUI::postDraw( void ) { m_militarySubtitle->displayStrings[i]->draw(pos.x,pos.y, m_militarySubtitle->color,dropColor ); Int height; - m_militarySubtitle->displayStrings[i]->getSize(NULL, &height); + m_militarySubtitle->displayStrings[i]->getSize(nullptr, &height); pos.y += height; } if( m_militarySubtitle->blockDrawn ) @@ -3985,7 +3985,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -3993,7 +3993,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_currentlyPlayingMovie = movieName; m_videoBuffer = TheDisplay->createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -4008,12 +4008,12 @@ void InGameUI::playMovie( const AsciiString& movieName ) void InGameUI::stopMovie( void ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } if (!m_currentlyPlayingMovie.isEmpty()) { @@ -4040,14 +4040,14 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) m_cameoVideoStream = TheVideoPlayer->open( movieName ); - if ( m_cameoVideoStream == NULL ) + if ( m_cameoVideoStream == nullptr ) { return; } m_cameoVideoBuffer = TheDisplay->createVideoBuffer(); - if ( m_cameoVideoBuffer == NULL || + if ( m_cameoVideoBuffer == nullptr || !m_cameoVideoBuffer->allocate( m_cameoVideoStream->width(), m_cameoVideoStream->height()) ) @@ -4055,7 +4055,7 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) stopCameoMovie(); return; } - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); WinInstanceData *winData = window->winGetInstanceData(); winData->setVideoBuffer(m_cameoVideoBuffer); // window->winHide(FALSE); @@ -4066,19 +4066,19 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) void InGameUI::stopCameoMovie( void ) { //RightHUD - //GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + //GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); // window->winHide(FALSE); WinInstanceData *winData = window->winGetInstanceData(); - winData->setVideoBuffer(NULL); + winData->setVideoBuffer(nullptr); delete m_cameoVideoBuffer; - m_cameoVideoBuffer = NULL; + m_cameoVideoBuffer = nullptr; if ( m_cameoVideoStream ) { m_cameoVideoStream->close(); - m_cameoVideoStream = NULL; + m_cameoVideoStream = nullptr; } } @@ -4183,7 +4183,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * m_militaryCaptionDelayMS)/1000.0f); m_militarySubtitle->index = 0; for (int i = 1; i < MAX_SUBTITLE_LINES; i ++) - m_militarySubtitle->displayStrings[i] = NULL; + m_militarySubtitle->displayStrings[i] = nullptr; m_militarySubtitle->currentDisplayString = 0; m_militarySubtitle->displayStrings[0] = TheDisplayStringManager->newDisplayString(); @@ -4208,12 +4208,12 @@ void InGameUI::removeMilitarySubtitle( void ) for(UnsignedInt i = 0; i <= m_militarySubtitle->currentDisplayString; i ++) { TheDisplayStringManager->freeDisplayString(m_militarySubtitle->displayStrings[i]); - m_militarySubtitle->displayStrings[i] = NULL; + m_militarySubtitle->displayStrings[i] = nullptr; } //delete it man! delete m_militarySubtitle; - m_militarySubtitle= NULL; + m_militarySubtitle= nullptr; } @@ -4272,7 +4272,7 @@ Bool InGameUI::canSelectedObjectsNonAttackInteractWithObject( const Object *obje CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const Object *objectToInteractWith, SelectionRules rule, Bool additionalChecking ) const { // Setting a rally point doesn't require an object to interact with. - if( (objectToInteractWith == NULL) != (action == ACTIONTYPE_SET_RALLY_POINT)) + if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) { return ATTACKRESULT_NOT_POSSIBLE; } @@ -4361,7 +4361,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *objectToInteractWith, SelectionRules rule, Bool additionalChecking ) const { // Setting a rally point doesn't require an object to interact with. - if( (objectToInteractWith == NULL) != (action == ACTIONTYPE_SET_RALLY_POINT)) + if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) { return FALSE; } @@ -4516,7 +4516,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c } // get selected list of drawables - Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : NULL; + Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : nullptr; DrawableList tmpList; if (ignoreSelDraw) @@ -4909,7 +4909,7 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear) { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectAllUnitsByTypeAcrossRegion(NULL, mustBeSet, mustBeClear); + Int numSelected = selectAllUnitsByTypeAcrossRegion(nullptr, mustBeSet, mustBeClear); if (numSelected == -1) { UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); @@ -4938,7 +4938,7 @@ Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMask Int InGameUI::selectMatchingAcrossMap() { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectMatchingAcrossRegion(NULL); + Int numSelected = selectMatchingAcrossRegion(nullptr); if (numSelected == -1) { UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); @@ -5194,7 +5194,7 @@ void InGameUI::drawFloatingText( void ) // make drop color black, but use the alpha setting of the fill color specified (for fading) GameGetColorComponents( ftd->m_color, &r, &g, &b, &a ); dropColor = GameMakeColor( 0, 0, 0, a ); - ftd->m_dString->getSize(&width, NULL); + ftd->m_dString->getSize(&width, nullptr); // draw it! ftd->m_dString->draw(pos.x - (width / 2), pos.y, ftd->m_color,dropColor); } @@ -5279,12 +5279,12 @@ void InGameUI::clearPopupMessageData( void ) { m_popupMessageData->layout->destroyWindows(); deleteInstance(m_popupMessageData->layout); - m_popupMessageData->layout = NULL; + m_popupMessageData->layout = nullptr; } if( m_popupMessageData->pause ) TheGameLogic->setGamePaused(FALSE, m_popupMessageData->pauseMusic); deleteInstance(m_popupMessageData); - m_popupMessageData = NULL; + m_popupMessageData = nullptr; } @@ -5313,7 +5313,7 @@ FloatingTextData::~FloatingTextData(void) { if(m_dString) TheDisplayStringManager->freeDisplayString( m_dString ); - m_dString = NULL; + m_dString = nullptr; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -5327,7 +5327,7 @@ FloatingTextData::~FloatingTextData(void) WorldAnimationData::WorldAnimationData( void ) { - m_anim = NULL; + m_anim = nullptr; m_worldPos.zero(); m_expireFrame = 0; m_options = WORLD_ANIM_NO_OPTIONS; @@ -5346,13 +5346,13 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate, { // sanity - if( animTemplate == NULL || pos == NULL || durationInSeconds <= 0.0f ) + if( animTemplate == nullptr || pos == nullptr || durationInSeconds <= 0.0f ) return; // allocate a new world animation data struct // (huh huh, he said "wad") WorldAnimationData *wad = NEW WorldAnimationData; - if( wad == NULL ) + if( wad == nullptr ) return; // allocate a new animation instance @@ -5500,11 +5500,11 @@ void InGameUI::updateAndDrawWorldAnimations( void ) Object *InGameUI::findIdleWorker( Object *obj) { if(!obj) - return NULL; + return nullptr; Int index = obj->getControllingPlayer()->getPlayerIndex(); if(m_idleWorkers[index].empty()) - return NULL; + return nullptr; ObjectListIt it = m_idleWorkers[index].begin(); while(it != m_idleWorkers[index].end()) @@ -5517,7 +5517,7 @@ Object *InGameUI::findIdleWorker( Object *obj) } ++it; } - return NULL; + return nullptr; } void InGameUI::addIdleWorker( Object *obj ) @@ -5567,7 +5567,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(FALSE, ("InGameUI::selectNextIdleWorker We're trying to select a worker when our list is empty for player %ls", player->getPlayerDisplayName().str())); return; } - Object *selectThisObject = NULL; + Object *selectThisObject = nullptr; if(getSelectCount() == 0 || getSelectCount() > 1) { @@ -5606,7 +5606,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(selectThisObject, ("InGameUI::selectNextIdleWorker Could not select the next IDLE worker")); if(selectThisObject) { - DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == NULL, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); + DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == nullptr, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); deselectAllDrawables(); GameMessage *teamMsg = TheMessageStream->appendMessage( GameMessage::MSG_CREATE_SELECTED_GROUP ); @@ -5660,7 +5660,7 @@ void InGameUI::showIdleWorkerLayout( void ) { if (!m_idleWorkerWin) { - m_idleWorkerWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + m_idleWorkerWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); DEBUG_ASSERTCRASH(m_idleWorkerWin, ("InGameUI::showIdleWorkerLayout could not find IdleWorker.wnd to load")); return; } @@ -5714,10 +5714,10 @@ void InGameUI::resetIdleWorker( void ) void InGameUI::recreateControlBar( void ) { - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); deleteInstance(win); - m_idleWorkerWin = NULL; + m_idleWorkerWin = nullptr; createControlBar(); diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index 3e69d321a36..6ad9ad18111 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -37,7 +37,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Keyboard *TheKeyboard = NULL; +Keyboard *TheKeyboard = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////////////////////////// @@ -51,11 +51,11 @@ void Keyboard::createStreamMessages( void ) { // sanity - if( TheMessageStream == NULL ) + if( TheMessageStream == nullptr ) return; KeyboardIO *key = getFirstKey(); - GameMessage *msg = NULL; + GameMessage *msg = nullptr; while( key->key != KEY_NONE ) { @@ -804,7 +804,7 @@ KeyboardIO *Keyboard::findKey( KeyDefType key, KeyboardIO::StatusType status ) return io; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 8f02f88d27a..bed852d4387 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -51,7 +51,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Mouse *TheMouse = NULL; +Mouse *TheMouse = nullptr; const char *const Mouse::RedrawModeName[] = { "Mouse:Windows", @@ -72,44 +72,44 @@ const char *const Mouse::CursorCaptureBlockReasonNames[] = { /////////////////////////////////////////////////////////////////////////////////////////////////// static const FieldParse TheMouseCursorFieldParseTable[] = { - { "CursorText", INI::parseAsciiString, NULL, offsetof( CursorInfo, cursorText ) }, - { "CursorTextColor", INI::parseRGBAColorInt, NULL, offsetof( CursorInfo, cursorTextColor ) }, - { "CursorTextDropColor", INI::parseRGBAColorInt, NULL, offsetof( CursorInfo, cursorTextDropColor ) }, - { "W3DModel", INI::parseAsciiString, NULL, offsetof( CursorInfo, W3DModelName ) }, - { "W3DAnim", INI::parseAsciiString, NULL, offsetof( CursorInfo, W3DAnimName ) }, - { "W3DScale", INI::parseReal, NULL, offsetof( CursorInfo, W3DScale ) }, - { "Loop", INI::parseBool, NULL, offsetof( CursorInfo, loop ) }, - { "Image", INI::parseAsciiString, NULL, offsetof( CursorInfo, imageName ) }, - { "Texture", INI::parseAsciiString, NULL, offsetof( CursorInfo, textureName ) }, - { "HotSpot", INI::parseICoord2D, NULL, offsetof( CursorInfo, hotSpotPosition ) }, - { "Frames", INI::parseInt, NULL, offsetof( CursorInfo, numFrames ) }, - { "FPS", INI::parseReal, NULL, offsetof( CursorInfo, fps)}, - { "Directions", INI::parseInt, NULL, offsetof( CursorInfo, numDirections ) }, + { "CursorText", INI::parseAsciiString, nullptr, offsetof( CursorInfo, cursorText ) }, + { "CursorTextColor", INI::parseRGBAColorInt, nullptr, offsetof( CursorInfo, cursorTextColor ) }, + { "CursorTextDropColor", INI::parseRGBAColorInt, nullptr, offsetof( CursorInfo, cursorTextDropColor ) }, + { "W3DModel", INI::parseAsciiString, nullptr, offsetof( CursorInfo, W3DModelName ) }, + { "W3DAnim", INI::parseAsciiString, nullptr, offsetof( CursorInfo, W3DAnimName ) }, + { "W3DScale", INI::parseReal, nullptr, offsetof( CursorInfo, W3DScale ) }, + { "Loop", INI::parseBool, nullptr, offsetof( CursorInfo, loop ) }, + { "Image", INI::parseAsciiString, nullptr, offsetof( CursorInfo, imageName ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( CursorInfo, textureName ) }, + { "HotSpot", INI::parseICoord2D, nullptr, offsetof( CursorInfo, hotSpotPosition ) }, + { "Frames", INI::parseInt, nullptr, offsetof( CursorInfo, numFrames ) }, + { "FPS", INI::parseReal, nullptr, offsetof( CursorInfo, fps)}, + { "Directions", INI::parseInt, nullptr, offsetof( CursorInfo, numDirections ) }, }; static const FieldParse TheMouseFieldParseTable[] = { - { "TooltipFontName", INI::parseAsciiString,NULL, offsetof( Mouse, m_tooltipFontName ) }, - { "TooltipFontSize", INI::parseInt, NULL, offsetof( Mouse, m_tooltipFontSize ) }, - { "TooltipFontIsBold", INI::parseBool, NULL, offsetof( Mouse, m_tooltipFontIsBold ) }, - { "TooltipAnimateBackground", INI::parseBool, NULL, offsetof( Mouse, m_tooltipAnimateBackground ) }, - { "TooltipFillTime", INI::parseInt, NULL, offsetof( Mouse, m_tooltipFillTime ) }, - { "TooltipDelayTime", INI::parseInt, NULL, offsetof( Mouse, m_tooltipDelayTime ) }, - { "TooltipTextColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorText ) }, - { "TooltipHighlightColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorHighlight ) }, - { "TooltipShadowColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorShadow ) }, - { "TooltipBackgroundColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorBackground ) }, - { "TooltipBorderColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorBorder ) }, - { "TooltipWidth", INI::parsePercentToReal,NULL, offsetof( Mouse, m_tooltipWidth ) }, - { "CursorMode", INI::parseInt, NULL, offsetof( Mouse, m_currentRedrawMode ) }, - { "UseTooltipAltTextColor", INI::parseBool, NULL, offsetof( Mouse, m_useTooltipAltTextColor ) }, - { "UseTooltipAltBackColor", INI::parseBool, NULL, offsetof( Mouse, m_useTooltipAltBackColor ) }, - { "AdjustTooltipAltColor", INI::parseBool, NULL, offsetof( Mouse, m_adjustTooltipAltColor ) }, - { "OrthoCamera", INI::parseBool, NULL, offsetof( Mouse, m_orthoCamera ) }, - { "OrthoZoom", INI::parseReal, NULL, offsetof( Mouse, m_orthoZoom ) }, - { "DragTolerance", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragTolerance) }, - { "DragTolerance3D", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragTolerance3D) }, - { "DragToleranceMS", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragToleranceMS) }, + { "TooltipFontName", INI::parseAsciiString,nullptr, offsetof( Mouse, m_tooltipFontName ) }, + { "TooltipFontSize", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipFontSize ) }, + { "TooltipFontIsBold", INI::parseBool, nullptr, offsetof( Mouse, m_tooltipFontIsBold ) }, + { "TooltipAnimateBackground", INI::parseBool, nullptr, offsetof( Mouse, m_tooltipAnimateBackground ) }, + { "TooltipFillTime", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipFillTime ) }, + { "TooltipDelayTime", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipDelayTime ) }, + { "TooltipTextColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorText ) }, + { "TooltipHighlightColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorHighlight ) }, + { "TooltipShadowColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorShadow ) }, + { "TooltipBackgroundColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorBackground ) }, + { "TooltipBorderColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorBorder ) }, + { "TooltipWidth", INI::parsePercentToReal,nullptr, offsetof( Mouse, m_tooltipWidth ) }, + { "CursorMode", INI::parseInt, nullptr, offsetof( Mouse, m_currentRedrawMode ) }, + { "UseTooltipAltTextColor", INI::parseBool, nullptr, offsetof( Mouse, m_useTooltipAltTextColor ) }, + { "UseTooltipAltBackColor", INI::parseBool, nullptr, offsetof( Mouse, m_useTooltipAltBackColor ) }, + { "AdjustTooltipAltColor", INI::parseBool, nullptr, offsetof( Mouse, m_adjustTooltipAltColor ) }, + { "OrthoCamera", INI::parseBool, nullptr, offsetof( Mouse, m_orthoCamera ) }, + { "OrthoZoom", INI::parseReal, nullptr, offsetof( Mouse, m_orthoZoom ) }, + { "DragTolerance", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragTolerance) }, + { "DragTolerance3D", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragTolerance3D) }, + { "DragToleranceMS", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragToleranceMS) }, }; @@ -449,7 +449,7 @@ Mouse::Mouse( void ) m_dragToleranceMS = 0; //m_tooltipString.clear(); // redundant m_displayTooltip = FALSE; - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDelay = -1; // default value // initialize all the mouse io data memset( m_mouseEvents, 0, sizeof( m_mouseEvents ) ); @@ -498,7 +498,7 @@ Mouse::Mouse( void ) m_isTooltipEmpty = TRUE; - m_cursorTextDisplayString = NULL; + m_cursorTextDisplayString = nullptr; m_cursorTextColor.red = 255; m_cursorTextColor.green = 255; m_cursorTextColor.blue = 255; @@ -533,11 +533,11 @@ Mouse::~Mouse( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; if( m_cursorTextDisplayString ) TheDisplayStringManager->freeDisplayString( m_cursorTextDisplayString ); - m_cursorTextDisplayString = NULL; + m_cursorTextDisplayString = nullptr; } @@ -546,7 +546,7 @@ the Win32 version of the mouse (by preloading resources before D3D device is cre void Mouse::parseIni(void) { INI ini; - ini.loadFileDirectory( "Data\\INI\\Mouse", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Mouse", INI_LOAD_OVERWRITE, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -594,7 +594,7 @@ void Mouse::onResolutionChanged( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDisplayString = TheDisplayStringManager->newDisplayString(); @@ -673,10 +673,10 @@ void Mouse::createStreamMessages( void ) { // santiy - if( TheMessageStream == NULL ) + if( TheMessageStream == nullptr ) return; // no place to put messages - GameMessage *msg = NULL; + GameMessage *msg = nullptr; UnsignedInt now = timeGetTime(); // basic position messages are always created @@ -717,7 +717,7 @@ void Mouse::createStreamMessages( void ) m_stillTime = now; // button messages - msg = NULL; + msg = nullptr; switch( m_currMouse.leftEvent ) { @@ -751,7 +751,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.middleEvent ) { @@ -786,7 +786,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.rightEvent ) { @@ -822,7 +822,7 @@ void Mouse::createStreamMessages( void ) } // wheel pos - msg = NULL; + msg = nullptr; if( m_currMouse.wheelPos != 0 ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL ); @@ -921,7 +921,7 @@ void Mouse::setMouseText( UnicodeString text, { // sanity, if no display string has been created, get out of here - if( m_cursorTextDisplayString == NULL ) + if( m_cursorTextDisplayString == nullptr ) return; // set the text into the cursor display string @@ -1047,7 +1047,7 @@ Bool Mouse::canCapture() const if (m_captureBlockReasonBits != 0) return false; - DEBUG_ASSERTCRASH(TheDisplay != NULL, ("The Display is NULL")); + DEBUG_ASSERTCRASH(TheDisplay != nullptr, ("The Display is null")); const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); if (TheDisplay->getWindowed()) @@ -1208,7 +1208,7 @@ void Mouse::drawCursorText( void ) { // sanity - if( m_cursorTextDisplayString == NULL ) + if( m_cursorTextDisplayString == nullptr ) return; // get the colors to draw the text in an acceptable format @@ -1322,7 +1322,7 @@ void Mouse::setCursor( MouseCursor cursor ) return; // only if we have a display cursor do we do anything with mouse text - if( m_cursorTextDisplayString != NULL ) + if( m_cursorTextDisplayString != nullptr ) { CursorInfo *cursorInfo = &m_cursorInfo[ cursor ]; @@ -1335,7 +1335,7 @@ void Mouse::setCursor( MouseCursor cursor ) &(cursorInfo->cursorTextColor), &(cursorInfo->cursorTextDropColor) ); else - setMouseText( L"", NULL, NULL ); + setMouseText( L"", nullptr, nullptr ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/LanguageFilter.cpp b/Generals/Code/GameEngine/Source/GameClient/LanguageFilter.cpp index 9a1a4e66052..f2e0af373ad 100644 --- a/Generals/Code/GameEngine/Source/GameClient/LanguageFilter.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/LanguageFilter.cpp @@ -31,7 +31,7 @@ -LanguageFilter *TheLanguageFilter = NULL; +LanguageFilter *TheLanguageFilter = nullptr; LanguageFilter::LanguageFilter() { @@ -46,7 +46,7 @@ void LanguageFilter::init() { // read in the file already. File *file1 = TheFileSystem->openFile(BadWordFileName, File::READ | File::BINARY); - if (file1 == NULL) { + if (file1 == nullptr) { return; } @@ -66,7 +66,7 @@ void LanguageFilter::init() { } file1->close(); - file1 = NULL; + file1 = nullptr; } void LanguageFilter::reset() { @@ -88,7 +88,7 @@ void LanguageFilter::filterLine(UnicodeString &line) while (newLine.nextToken(&token, L" ;,.!?:=\\/><`~()&^%#\n\t")) { wchar_t *pos = wcsstr(buf, token.str()); - if (pos == NULL) { + if (pos == nullptr) { DEBUG_CRASH(("Couldn't find the token in its own string.")); continue; } @@ -143,7 +143,7 @@ void LanguageFilter::unHaxor(UnicodeString &word) { newWord.concat(L's'); } else if (c == L'+') { newWord.concat(L't'); - } else if (wcsrchr(ignoredChars, c) == NULL) { + } else if (wcsrchr(ignoredChars, c) == nullptr) { newWord.concat(c); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp index 3fc220d77dc..6596b16e931 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -274,12 +274,12 @@ Bool PointInsideRect2D(const Coord2D *bl, const Coord2D *tl, const Coord2D *br, Real uVal; // we're actually only interested in if the U value is (0,1) - ShortestDistancePointToSegment2D(bl, tl, inputPoint, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(bl, tl, inputPoint, nullptr, nullptr, &uVal); if (uVal <= 0.0f || uVal >= 1.0f) { return false; } - ShortestDistancePointToSegment2D(bl, br, inputPoint, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(bl, br, inputPoint, nullptr, nullptr, &uVal); return (uVal > 0.0f && uVal < 1.0f); } diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 35a406d4624..5bcee74c6dd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -155,7 +155,7 @@ void objectUnderConstruction(Object* obj, void *underConstruction) } ProductionUpdateInterface *pui = ProductionUpdate::getProductionUpdateInterfaceFromObject(obj); - if(pui != NULL && pui->getProductionCount() > 0) + if(pui != nullptr && pui->getProductionCount() > 0) { *(Bool*)underConstruction = true; return; @@ -212,7 +212,7 @@ bool changeMaxRenderFps(FpsValueChange change) bool changeLogicTimeScale(FpsValueChange change) { - if (TheNetwork != NULL) + if (TheNetwork != nullptr) return false; const UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); @@ -402,12 +402,12 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m return; } - const AudioEventRTS* soundToPlayPtr = NULL; + const AudioEventRTS* soundToPlayPtr = nullptr; - Object *objectWithSound = NULL; + Object *objectWithSound = nullptr; Bool skip = false; - Object *target = NULL; + Object *target = nullptr; if( info && info->m_drawTarget ) { target = info->m_drawTarget->getObject(); @@ -596,7 +596,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m break; } else { // clear out the sound to play, and drop into the attack object logic. - soundToPlayPtr = NULL; + soundToPlayPtr = nullptr; FALLTHROUGH; } } @@ -913,7 +913,7 @@ void amIAHero(Object* obj, void* heroHolder) { - if (!obj || ((HeroHolder*)heroHolder)->hero != NULL) + if (!obj || ((HeroHolder*)heroHolder)->hero != nullptr) { return; } @@ -930,10 +930,10 @@ static Object *iNeedAHero( void ) { Player* localPlayer = rts::getObservedOrLocalPlayer(); if (!localPlayer->isPlayerActive()) - return NULL; + return nullptr; HeroHolder heroHolder; - heroHolder.hero = NULL; + heroHolder.hero = nullptr; localPlayer->iterateObjects(amIAHero, (void*)&heroHolder); @@ -949,7 +949,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * CommandEvaluateType commandType ) { GameMessage::Type msgType = GameMessage::MSG_INVALID; - Object *obj = drawableInWay ? drawableInWay->getObject() : NULL; + Object *obj = drawableInWay ? drawableInWay->getObject() : nullptr; Bool isForceAttackable = FALSE; if (obj) { @@ -1014,11 +1014,11 @@ GameMessage::Type CommandTranslator::createAttackMessage( Drawable *draw, GameMessage::Type msgType = GameMessage::MSG_INVALID; // the drawable must have an object to be able to attack - if( draw->getObject() == NULL ) + if( draw->getObject() == nullptr ) return msgType; // the target must have an object to be attacked - if( other->getObject() == NULL ) + if( other->getObject() == nullptr ) return msgType; // insert object attack command message into stream @@ -1049,7 +1049,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, { GameMessage::Type msgType = GameMessage::MSG_INVALID; - if (target == NULL) + if (target == nullptr) return msgType; // you cannot attack an enemy that has no object representation @@ -1217,7 +1217,7 @@ GameMessage::Type CommandTranslator::issueCombatDropCommand( const CommandButton return GameMessage::MSG_INVALID; } - if( target != NULL && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) + if( target != nullptr && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { // OBJECT BASED SPECIAL @@ -1411,7 +1411,7 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const if( draw ) { - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; if( !obj ) { return retVal; @@ -1445,7 +1445,7 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const } else if( pos ) { - CanAttackResult result = canAnyForceAttack( allSelected, NULL, pos ); + CanAttackResult result = canAnyForceAttack( allSelected, nullptr, pos ); if( result == ATTACKRESULT_POSSIBLE || result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { @@ -1480,13 +1480,13 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const * 'draw'. If type == DO_HINT, then the user hasn't actually clicked, but has moused over * the drawable 'draw' and we want to generate a hint message as to what the actual * command would be if clicked - * NOTE: draw can be NULL, in which case we give a hint for the location */ + * NOTE: draw can be null, in which case we give a hint for the location */ // ------------------------------------------------------------------------------------------------ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, const Coord3D *pos, CommandEvaluateType type ) { - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; Drawable *drawableInWay = draw; //This piece of code is used to prevent interaction with unselectable objects or masked objects. When we @@ -1494,28 +1494,28 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //drawable is invalid... then convert it to a position to be evaluated instead. //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything - if( obj == NULL || + if( obj == nullptr || obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } // If the thing is a mine, and is locally controlled, then we should issue a moveto to its location. if (obj && obj->isLocallyControlled() && obj->isKindOf(KINDOF_MINE)) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } if( TheInGameUI->isInForceMoveToMode() ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } else if (TheInGameUI->isInForceAttackMode() ) { // setting the drawableInWay to draw will allow us to force attack in the issue move command // if there is a location to which we should attack. @@ -1576,8 +1576,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //If our object is a shrubbery, and we don't allow targetting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } if( obj && obj->isKindOf( KINDOF_MINE ) && !BitIsSet( command->getOptions(), ALLOW_MINE_TARGET ) ) @@ -1585,8 +1585,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //If our object is a mine, and we don't allow targetting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } //Kris: September 27, 2002 @@ -1600,22 +1600,22 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, case ALLIES: if( !BitIsSet( command->getOptions(), NEED_TARGET_ALLY_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; case ENEMIES: if( !BitIsSet( command->getOptions(), NEED_TARGET_ENEMY_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; case NEUTRAL: if( !BitIsSet( command->getOptions(), NEED_TARGET_NEUTRAL_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; } @@ -1650,7 +1650,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } case GUI_COMMAND_SPECIAL_POWER: - currentlyValid = TheInGameUI->canSelectedObjectsDoSpecialPower( command, obj, pos, InGameUI::SELECTION_ANY, command->getOptions(), NULL ); + currentlyValid = TheInGameUI->canSelectedObjectsDoSpecialPower( command, obj, pos, InGameUI::SELECTION_ANY, command->getOptions(), nullptr ); break; case GUI_COMMAND_FIRE_WEAPON: currentlyValid = TheInGameUI->canSelectedObjectsEffectivelyUseWeapon( command, obj, pos, InGameUI::SELECTION_ANY ); @@ -1683,7 +1683,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } case GUI_COMMAND_SPECIAL_POWER://lorenzen - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; case GUI_COMMAND_FIRE_WEAPON: msgType = issueFireWeaponCommand( command, type, draw, pos ); @@ -1693,10 +1693,10 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } - // NULL out the GUI command if we're actually doing something + // null out the GUI command if we're actually doing something if( type == DO_COMMAND ) { - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } } @@ -2066,7 +2066,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, spType == SPECIAL_INFANTRY_CAPTURE_BUILDING ) { //Issue the capture building command - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2109,7 +2109,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2145,7 +2145,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_BLACKLOTUS_STEAL_CASH_HACK ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2181,7 +2181,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_HACKER_DISABLE_BUILDING ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2219,7 +2219,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } #endif // ******************************************************************************************** - else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, NULL, InGameUI::SELECTION_ALL, FALSE )) + else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, nullptr, InGameUI::SELECTION_ALL, FALSE )) { msgType = GameMessage::MSG_SET_RALLY_POINT; @@ -2275,8 +2275,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, const DrawableList *allSelectedDrawables = TheInGameUI->getAllSelectedDrawables(); for( DrawableList::const_iterator it = allSelectedDrawables->begin(); it != allSelectedDrawables->end(); ++it ) { - Object *obj = (*it) ? (*it)->getObject() : NULL; - AIUpdateInterface *ai = obj ? obj->getAI() : NULL; + Object *obj = (*it) ? (*it)->getObject() : nullptr; + AIUpdateInterface *ai = obj ? obj->getAI() : nullptr; if( ai && ai->isQuickPathAvailable( pos ) ) { validQuickPath = TRUE; @@ -2292,7 +2292,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // to do. Therefore, lets not issue a move command, and instead we'll return that there // wasn't a command for us to perform. - if ( draw == NULL ) + if ( draw == nullptr ) msgType = issueMoveToLocationCommand( pos, drawableInWay, type ); } else @@ -2373,7 +2373,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through backwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; // if nothing is selected @@ -2382,11 +2382,11 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheInGameUI->getSelectCount() == 0 ) { // get the last drawable - for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } // temp is the last drawable - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2414,7 +2414,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; Bool hack = FALSE; Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); Object *selectedObject = selectedDrawable->getObject(); @@ -2431,9 +2431,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage hack = FALSE; } // if temp is null, set it to the last drawable and loop back to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { - for(temp = selectedDrawable; temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for(temp = selectedDrawable; temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } hack = TRUE; @@ -2451,7 +2451,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2483,7 +2483,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through forwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2492,7 +2492,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { // get the first drawable temp = TheGameClient->firstDrawable(); - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2520,7 +2520,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; TheGameClient->getDrawableList(); Bool hack = FALSE; // takes care of when for loop skips firstdrawable Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); @@ -2542,7 +2542,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } // if temp is null, set it to the first drawable and loop forward to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { temp = TheGameClient->firstDrawable(); hack = TRUE; @@ -2567,7 +2567,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2600,7 +2600,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through backwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2608,11 +2608,11 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheInGameUI->getSelectCount() == 0 ) { // get the last drawable - for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } // temp is the last drawable - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2643,7 +2643,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; Bool hack = FALSE; Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); Object *selectedObject = selectedDrawable->getObject(); @@ -2660,9 +2660,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage hack = FALSE; } // if temp is null, set it to the last drawable and loop back to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { - for(temp = selectedDrawable; temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for(temp = selectedDrawable; temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } hack = TRUE; @@ -2680,7 +2680,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2710,7 +2710,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through forwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2719,7 +2719,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { // get the first drawable temp = TheGameClient->firstDrawable(); - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2747,7 +2747,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; TheGameClient->getDrawableList(); Bool hack = FALSE; // takes care of when for loop skips firstdrawable Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); @@ -2769,7 +2769,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } // if temp is null, set it to the first drawable and loop forward to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { temp = TheGameClient->firstDrawable(); hack = TRUE; @@ -2795,7 +2795,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2835,12 +2835,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_SELECT_HERO: { // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Object *hero = iNeedAHero(); - if ( hero == NULL ) + if ( hero == nullptr ) break; if ( hero->isContained() ) @@ -2848,7 +2848,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *heroDraw = hero->getDrawable(); - if ( heroDraw == NULL ) + if ( heroDraw == nullptr ) break; TheInGameUI->deselectAllDrawables(); @@ -3224,7 +3224,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheWindowManager) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) hide = !window->winIsHidden(); @@ -3244,7 +3244,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (Player *observedPlayer = TheControlBar->getObservedPlayer()) { // Set no observed player. - rts::changeObservedPlayer(NULL); + rts::changeObservedPlayer(nullptr); // But keep the look-at player. TheControlBar->setObserverLookAtPlayer(lookAtPlayer); } @@ -3547,9 +3547,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // case we want to turn off the pick hint. // if (TheInGameUI->isInForceAttackMode()) { - evaluateForceAttack( NULL, &position, DO_HINT ); + evaluateForceAttack( nullptr, &position, DO_HINT ); } else { - evaluateContextCommand( NULL, &position, DO_HINT ); + evaluateContextCommand( nullptr, &position, DO_HINT ); } // Do not eat this message, as it will do something itself at HintSpy @@ -3598,7 +3598,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Issue move command to all currently selected objects. // sanity - if( TheTacticalView == NULL ) + if( TheTacticalView == nullptr ) break; // translate from screen coordinates to terrain coords @@ -3616,10 +3616,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage (PickType) pickType); // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands - Object* obj = draw ? draw->getObject() : NULL; + Object* obj = draw ? draw->getObject() : nullptr; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) { - draw = NULL; + draw = nullptr; } if (TheInGameUI->isInForceAttackMode()) { @@ -3647,7 +3647,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Issue move command to all currently selected objects. // sanity - if( TheTacticalView == NULL ) + if( TheTacticalView == nullptr ) break; // translate from screen coordinates to terrain coords @@ -3677,10 +3677,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage (PickType) pickType); // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands - Object* obj = draw ? draw->getObject() : NULL; + Object* obj = draw ? draw->getObject() : nullptr; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) { - draw = NULL; + draw = nullptr; } if (TheInGameUI->isInForceAttackMode()) { @@ -3824,7 +3824,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* if (TheWindowManager && TheNameKeyGenerator) { - GameWindow *motd = TheWindowManager->winGetWindowFromId(NULL, (Int)TheNameKeyGenerator->nameToKey("MOTD.wnd:MOTD")); + GameWindow *motd = TheWindowManager->winGetWindowFromId(nullptr, (Int)TheNameKeyGenerator->nameToKey("MOTD.wnd:MOTD")); if (motd) motd->winHide(!motd->winIsHidden()); }*/ @@ -3874,7 +3874,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheWindowManager) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) hide = !window->winIsHidden(); @@ -4260,7 +4260,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_LOCK_CAMERA_TO_SELECTION: { ObjectID id = INVALID_ID; - Drawable *d = NULL; + Drawable *d = nullptr; for (d = TheGameClient->firstDrawable(); d; d = d->getNextDrawable()) { if (d->isSelected() && d->getObject()) @@ -4274,13 +4274,13 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheTacticalView->getCameraLockDrawable()) { id = INVALID_ID; // toggle it - d=NULL; + d=nullptr; TheTacticalView->forceRedraw(); //reset camera to normal } } else { - d = NULL; + d = nullptr; } TheTacticalView->setCameraLock(id); TheTacticalView->setCameraLockDrawable(d); @@ -4588,7 +4588,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGlobalData->m_showMetrics) { TheDisplay->setDebugDisplayCallback(StatMetricsDisplay); } else { - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); } break; } @@ -4720,7 +4720,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { line = "Objects are:"; TheScriptEngine->AppendDebugMessage(line, FALSE); - pPlayer->iterateObjects( printObjects, NULL ); + pPlayer->iterateObjects( printObjects, nullptr ); } } disp = DESTROY_MESSAGE; @@ -4731,7 +4731,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEBUG_TOGGLE_NETWORK: { - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { TheNetwork->toggleNetworkOn(); } disp = DESTROY_MESSAGE; @@ -4743,7 +4743,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_PARTICLEDEBUG: { if (TheDisplay->getDebugDisplayCallback() == ParticleSystemDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(ParticleSystemDebugDisplay); disp = DESTROY_MESSAGE; @@ -4858,7 +4858,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { if (TheGameLogic->isInGame()) { - if(TheInGameUI->cameoVideoBuffer() == NULL) + if(TheInGameUI->cameoVideoBuffer() == nullptr) TheInGameUI->playCameoMovie("CameoMovie"); else TheInGameUI->stopCameoMovie(); @@ -4993,7 +4993,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_DEBUG_STATS: { if (TheDisplay->getDebugDisplayCallback() == StatDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(StatDebugDisplay); disp = DESTROY_MESSAGE; @@ -5011,7 +5011,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_AUDIODEBUG: { if (TheDisplay->getDebugDisplayCallback() == AudioDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(AudioDebugDisplay); disp = DESTROY_MESSAGE; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp index 3ade01756e7..673237bb23f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp @@ -60,8 +60,8 @@ enum CommandStatus PickAndPlayInfo::PickAndPlayInfo() { m_air = FALSE; - m_drawTarget = NULL; - m_weaponSlot = NULL; + m_drawTarget = nullptr; + m_weaponSlot = nullptr; m_specialPowerType = SPECIAL_INVALID; } @@ -84,7 +84,7 @@ GUICommandTranslator::~GUICommandTranslator() //------------------------------------------------------------------------------------------------- static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *command, PickType pickType ) { - Object *pickObj = NULL; + Object *pickObj = nullptr; // pick a drawable at the mouse location Drawable *pick = TheTacticalView->pickDrawable( mouse, FALSE, pickType ); @@ -98,7 +98,7 @@ static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *com pickObj = pick->getObject(); if (!command->isValidObjectTarget(player, pickObj)) - pickObj = NULL; + pickObj = nullptr; } @@ -113,7 +113,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -126,7 +126,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // get object id @@ -206,15 +206,15 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC static CommandStatus doGuardCommand( const CommandButton *command, GuardMode guardMode, const ICoord2D *mouse ) { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; if( TheInGameUI->getSelectCount() == 0 ) return COMMAND_COMPLETE; - GameMessage *msg = NULL; + GameMessage *msg = nullptr; - if ( msg == NULL && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) + if ( msg == nullptr && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { // get the target object under the cursor Object* target = validUnderCursor( mouse, command, PICK_TYPE_SELECTABLE ); @@ -227,7 +227,7 @@ static CommandStatus doGuardCommand( const CommandButton *command, GuardMode gua } } - if( msg == NULL ) + if( msg == nullptr ) { Coord3D world; if (BitIsSet( command->getOptions(), NEED_TARGET_POS )) @@ -238,7 +238,7 @@ static CommandStatus doGuardCommand( const CommandButton *command, GuardMode gua else { Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; world = *draw->getObject()->getPosition(); } @@ -261,7 +261,7 @@ static CommandStatus doAttackMoveCommand( const CommandButton *command, const IC { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -272,7 +272,7 @@ static CommandStatus doAttackMoveCommand( const CommandButton *command, const IC DEBUG_ASSERTCRASH( draw, ("doAttackMoveCommand: No selected object(s)") ); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -298,7 +298,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -311,7 +311,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const DEBUG_ASSERTCRASH( draw, ("doSetRallyPointCommand: No selected object") ); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -334,7 +334,7 @@ static CommandStatus doPlaceBeacon( const CommandButton *command, const ICoord2D { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -357,7 +357,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess // only pay attention to clicks in this translator if there is a pending GUI command const CommandButton *command = TheInGameUI->getGUICommand(); - if( command == NULL ) + if( command == nullptr ) return disp; switch( msg->getType() ) @@ -489,7 +489,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess if( commandStatus == COMMAND_COMPLETE ) { TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( TRUE ); - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } } diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp index 637450e48fe..ba15e942dc9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp @@ -112,7 +112,7 @@ GameMessageDisposition HotKeyTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- HotKey::HotKey() { - m_win = NULL; + m_win = nullptr; m_key.clear(); } @@ -223,7 +223,7 @@ AsciiString HotKeyManager::searchHotKey( const UnicodeString& uStr ) } //----------------------------------------------------------------------------- -HotKeyManager *TheHotKeyManager = NULL; +HotKeyManager *TheHotKeyManager = nullptr; //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 761992f7438..3cd7a822e27 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -53,7 +53,7 @@ #include "Common/GlobalData.h" // for camera pitch angle only -LookAtTranslator *TheLookAtTranslator = NULL; +LookAtTranslator *TheLookAtTranslator = nullptr; enum { @@ -157,7 +157,7 @@ LookAtTranslator::LookAtTranslator() : LookAtTranslator::~LookAtTranslator() { if (TheLookAtTranslator == this) - TheLookAtTranslator = NULL; + TheLookAtTranslator = nullptr; } const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) @@ -166,7 +166,7 @@ const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) { return &m_anchor; } - return NULL; + return nullptr; } Bool LookAtTranslator::hasMouseMovedRecently( void ) @@ -659,12 +659,12 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage #if defined(RTS_DEBUG) case GameMessage::MSG_META_DEMO_LOCK_CAMERA_TO_PLANES: { - Drawable *first = NULL; + Drawable *first = nullptr; if (m_lastPlaneID) first = TheGameClient->findDrawableByID( m_lastPlaneID ); - if (first == NULL) + if (first == nullptr) first = TheGameClient->firstDrawable(); if (first) @@ -676,7 +676,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage { // get next Drawable, wrapping around to head of list if necessary d = d->getNextDrawable(); - if (d == NULL) + if (d == nullptr) d = TheGameClient->firstDrawable(); // if we've found an airborne object, lock onto it @@ -689,10 +689,10 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Bool doLock = true; // but don't lock onto projectiles - ProjectileUpdateInterface* pui = NULL; + ProjectileUpdateInterface* pui = nullptr; for (BehaviorModule** u = d->getObject()->getBehaviorModules(); *u; ++u) { - if ((pui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((pui = (*u)->getProjectileUpdateInterface()) != nullptr) { doLock = false; break; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 2e45e5abab9..c1dbae122eb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -53,7 +53,7 @@ #include "GameLogic/GameLogic.h" // for TheGameLogic->getFrame() -MetaMap *TheMetaMap = NULL; +MetaMap *TheMetaMap = nullptr; @@ -312,7 +312,7 @@ static const LookupListRec GameMessageMetaTypeNames[] = #endif//DUMP_PERF_STATS - { NULL, 0 } + { nullptr, 0 } }; @@ -327,10 +327,10 @@ static const FieldParse TheMetaMapFieldParseTable[] = { "Modifiers", INI::parseLookupList, ModifierNames, offsetof( MetaMapRec, m_modState ) }, { "UseableIn", INI::parseBitString32, TheCommandUsableInNames, offsetof( MetaMapRec, m_usableIn ) }, { "Category", INI::parseLookupList, CategoryListName, offsetof( MetaMapRec, m_category ) }, - { "Description", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_description ) }, - { "DisplayName", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_displayName ) }, + { "Description", INI::parseAndTranslateLabel, nullptr, offsetof( MetaMapRec, m_description ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( MetaMapRec, m_displayName ) }, - { NULL, NULL, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -598,7 +598,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa //------------------------------------------------------------------------------------------------- MetaMap::MetaMap() : - m_metaMaps(NULL) + m_metaMaps(nullptr) { } @@ -660,7 +660,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) throw INI_INVALID_DATA; MetaMapRec *map = TheMetaMap->getMetaMapRec(t); - if (map == NULL) + if (map == nullptr) throw INI_INVALID_DATA; ini->initFromINI(map, TheMetaMapFieldParseTable); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index 9e066f527aa..28ac68051b2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -83,10 +83,10 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess Object *builderObject = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() ); // if our source object is gone cancel this whole placement process - if( builderObject == NULL ) + if( builderObject == nullptr ) { - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); break; } @@ -203,11 +203,11 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess break; } // get out of pending placement mode, this will also clear the arrow anchor status - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); break; } - DEBUG_ASSERTCRASH(builderObj != NULL, ("builderObj is NULL")); + DEBUG_ASSERTCRASH(builderObj != nullptr, ("builderObj is null")); // check to see if this is a legal location to build something at LegalBuildCode lbc; @@ -219,7 +219,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, - builderObj, NULL ); + builderObj, nullptr ); if( lbc == LBC_OK ) { @@ -247,7 +247,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), placeMsg->getType() ); // get out of pending placement mode, this will also clear the arrow anchor status - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } else @@ -265,7 +265,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheAudio->addAudioEvent( &noCanDoSound ); // unhook the anchor so they can try again - TheInGameUI->setPlacementStart( NULL ); + TheInGameUI->setPlacementStart( nullptr ); } @@ -296,7 +296,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // if we have moved far enough away from the start point // ICoord2D start; - TheInGameUI->getPlacementPoints( &start, NULL ); + TheInGameUI->getPlacementPoints( &start, nullptr ); Int x, y; x = mouse.x - start.x; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 627da825624..6c26efffcbb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -70,7 +70,7 @@ static Bool TheDebugSelectionMode = false; static Bool currentlyLookingForSelection( ) { // This needs to check if we are currently targetting for special weapons fire. - return TheInGameUI->getGUICommand() == NULL; + return TheInGameUI->getGUICommand() == nullptr; } //----------------------------------------------------------------------------- @@ -146,7 +146,7 @@ Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting ) } // ignore objects obscured by the GUI - GameWindow *window = NULL; + GameWindow *window = nullptr; if (TheWindowManager) { const Coord3D *c = draw->getPosition(); @@ -238,7 +238,7 @@ static Bool selectSingleDrawableWithoutSound( Drawable *draw ) TheInGameUI->selectDrawable( draw ); Object *obj = draw->getObject(); - if (obj != NULL) { + if (obj != nullptr) { GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_CREATE_SELECTED_GROUP_NO_SOUND); msg->appendBooleanArgument(TRUE); msg->appendObjectIDArgument(obj->getID()); @@ -248,7 +248,7 @@ static Bool selectSingleDrawableWithoutSound( Drawable *draw ) } -SelectionTranslator *TheSelectionTranslator = NULL; +SelectionTranslator *TheSelectionTranslator = nullptr; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -369,7 +369,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //Turn off drag select m_dragSelecting = FALSE; TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); TheTacticalView->setMouseLock( FALSE ); } return KEEP_MESSAGE; @@ -436,7 +436,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa UnsignedInt pickType = getPickTypesForContext( true /*TheInGameUI->isInForceAttackMode()*/ ); Drawable *underCursor = TheTacticalView->pickDrawable( &pixel, TheInGameUI->isInForceAttackMode(), (PickType) pickType ); - Object *objUnderCursor = underCursor ? underCursor->getObject() : NULL; + Object *objUnderCursor = underCursor ? underCursor->getObject() : nullptr; if( objUnderCursor && (!objUnderCursor->isEffectivelyDead() || objUnderCursor->isKindOf( KINDOF_ALWAYS_SELECTABLE )) ) { @@ -476,7 +476,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa Drawable *picked = TheTacticalView->pickDrawable( ®ion.lo, FALSE, PICK_TYPE_SELECTABLE); // If there wasn't anyone to pick, then we want to propagate this double click. - if (picked == NULL) + if (picked == nullptr) break; if (!picked->isMassSelectable()) @@ -487,7 +487,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // We have to have an object in order to be able to do interesting double click stuff on // him. Also, if it is a structure, it is already selected, so don't select all the units // like him. - if (pickedObj == NULL || !pickedObj->isLocallyControlled()) + if (pickedObj == nullptr || !pickedObj->isLocallyControlled()) break; // Ok. The logic is a little bit weird here. What we need to do is deselect everything @@ -680,7 +680,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // If this was a point, shift was pressed and we already have that unit selected, then we // need to deselect those units. GameMessage *newMsg = TheMessageStream->appendMessage(GameMessage::MSG_REMOVE_FROM_SELECTED_GROUP); - Drawable *draw = NULL; + Drawable *draw = nullptr; DrawableListIt it; for (it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) { @@ -713,7 +713,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa Player *localPlayer = ThePlayerList->getLocalPlayer(); Int newDrawablesSelected = 0; - Drawable *draw = NULL; + Drawable *draw = nullptr; DrawableListIt it; for (it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) { @@ -729,13 +729,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa continue; } - if (obj && obj->getContainedBy() != NULL) + if (obj && obj->getContainedBy() != nullptr) { // we're contained, and so we shouldn't be selectable. continue; } - Drawable *drawToSelect = NULL; + Drawable *drawToSelect = nullptr; ObjectID objToAppend = INVALID_ID; if (si.selectMine && obj->isLocallyControlled()) { @@ -853,7 +853,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa TheTacticalView->setMouseLock( FALSE ); TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); // insert area selection message into stream GameMessage *dragMsg = TheMessageStream->appendMessage( GameMessage::MSG_AREA_SELECTION ); @@ -922,7 +922,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if( TheInGameUI->getGUICommand() ) { //Cancel GUI command mode... don't deselect units. - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); //With a GUI command cancel, we want no other behavior. disp = DESTROY_MESSAGE; @@ -934,7 +934,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // TheSuperHackers @tweak Stubbjax 08/08/2025 Cancelling building placement no longer deselects the builder. if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { - TheInGameUI->placeBuildAvailable(NULL, NULL); + TheInGameUI->placeBuildAvailable(nullptr, nullptr); TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(FALSE); disp = DESTROY_MESSAGE; TheInGameUI->setScrolling(FALSE); @@ -970,7 +970,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // Assign selected items to a group GameMessage *newmsg = TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_CREATE_TEAM0 + group)); Drawable *drawable = TheGameClient->getDrawableList(); - while (drawable != NULL) + while (drawable != nullptr) { if (drawable->isSelected() && drawable->getObject() && drawable->getObject()->isLocallyControlled()) { @@ -1019,7 +1019,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1044,7 +1044,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1096,7 +1096,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1127,7 +1127,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1172,7 +1172,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index cd30ff3c2ce..e89f3f9bcaf 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -185,7 +185,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage ICoord2D mousePos = TheMouse->getMouseStatus()->pos; if( TheWindowManager ) - TheWindowManager->winProcessMouseEvent( GWM_NONE, &mousePos, NULL ); + TheWindowManager->winProcessMouseEvent( GWM_NONE, &mousePos, nullptr ); // Force it to keep the message, regardless of what the window thinks it did with the input. return KEEP_MESSAGE; @@ -221,7 +221,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage // process the mouse event position GameWindowMessage gwm = rawMouseToWindowMessage( msg ); if( TheWindowManager ) - returnCode = TheWindowManager->winProcessMouseEvent( gwm, &mousePos, NULL ); + returnCode = TheWindowManager->winProcessMouseEvent( gwm, &mousePos, nullptr ); if( TheShell && TheShell->isShellActive() ) returnCode = WIN_INPUT_USED; diff --git a/Generals/Code/GameEngine/Source/GameClient/RadiusDecal.cpp b/Generals/Code/GameEngine/Source/GameClient/RadiusDecal.cpp index 28b20813bb7..645c8845b47 100644 --- a/Generals/Code/GameEngine/Source/GameClient/RadiusDecal.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/RadiusDecal.cpp @@ -54,9 +54,9 @@ void RadiusDecalTemplate::createRadiusDecal(const Coord3D& pos, Real radius, con { result.clear(); - if (owningPlayer == NULL) + if (owningPlayer == nullptr) { - DEBUG_CRASH(("You MUST specify a non-NULL owningPlayer to createRadiusDecal. (srj)")); + DEBUG_CRASH(("You MUST specify a non-null owningPlayer to createRadiusDecal. (srj)")); return; } @@ -114,14 +114,14 @@ void RadiusDecalTemplate::xferRadiusDecalTemplate( Xfer *xfer ) { static const FieldParse dataFieldParse[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( RadiusDecalTemplate, m_name ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( RadiusDecalTemplate, m_name ) }, { "Style", INI::parseBitString32, TheShadowNames, offsetof( RadiusDecalTemplate, m_shadowType ) }, - { "OpacityMin", INI::parsePercentToReal, NULL, offsetof( RadiusDecalTemplate, m_minOpacity ) }, - { "OpacityMax", INI::parsePercentToReal, NULL, offsetof( RadiusDecalTemplate, m_maxOpacity) }, - { "OpacityThrobTime", INI::parseDurationUnsignedInt,NULL, offsetof( RadiusDecalTemplate, m_opacityThrobTime ) }, - { "Color", INI::parseColorInt, NULL, offsetof( RadiusDecalTemplate, m_color ) }, - { "OnlyVisibleToOwningPlayer", INI::parseBool, NULL, offsetof( RadiusDecalTemplate, m_onlyVisibleToOwningPlayer ) }, - { 0, 0, 0, 0 } + { "OpacityMin", INI::parsePercentToReal, nullptr, offsetof( RadiusDecalTemplate, m_minOpacity ) }, + { "OpacityMax", INI::parsePercentToReal, nullptr, offsetof( RadiusDecalTemplate, m_maxOpacity) }, + { "OpacityThrobTime", INI::parseDurationUnsignedInt,nullptr, offsetof( RadiusDecalTemplate, m_opacityThrobTime ) }, + { "Color", INI::parseColorInt, nullptr, offsetof( RadiusDecalTemplate, m_color ) }, + { "OnlyVisibleToOwningPlayer", INI::parseBool, nullptr, offsetof( RadiusDecalTemplate, m_onlyVisibleToOwningPlayer ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(store, dataFieldParse); @@ -129,16 +129,16 @@ void RadiusDecalTemplate::xferRadiusDecalTemplate( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ RadiusDecal::RadiusDecal() : - m_template(NULL), - m_decal(NULL), + m_template(nullptr), + m_decal(nullptr), m_empty(true) { } // ------------------------------------------------------------------------------------------------ RadiusDecal::RadiusDecal(const RadiusDecal& that) : - m_template(NULL), - m_decal(NULL), + m_template(nullptr), + m_decal(nullptr), m_empty(true) { DEBUG_CRASH(("not fully implemented")); @@ -149,10 +149,10 @@ RadiusDecal& RadiusDecal::operator=(const RadiusDecal& that) { if (this != &that) { - m_template = NULL; + m_template = nullptr; if (m_decal) m_decal->release(); - m_decal = NULL; + m_decal = nullptr; m_empty = true; DEBUG_CRASH(("not fully implemented")); } @@ -172,12 +172,12 @@ void RadiusDecal::xferRadiusDecal( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void RadiusDecal::clear() { - m_template = NULL; + m_template = nullptr; if (m_decal) { m_decal->release(); } - m_decal = NULL; + m_decal = nullptr; m_empty = true; } diff --git a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 4cc29191cae..38e75a017f2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -61,7 +61,7 @@ SelectionInfo::SelectionInfo() : { } //------------------------------------------------------------------------------------------------- -PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL) +PickDrawableStruct::PickDrawableStruct() : drawableListToFill(nullptr) { drawableListToFill = FALSE; forceAttackMode = TheInGameUI->isInForceAttackMode(); @@ -125,10 +125,10 @@ extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedD } } - Drawable *newMine = NULL; - Drawable *newFriendly = NULL; - Drawable *newEnemy = NULL; - Drawable *newCivilian = NULL; + Drawable *newMine = nullptr; + Drawable *newFriendly = nullptr; + Drawable *newEnemy = nullptr; + Drawable *newCivilian = nullptr; for (it = newlySelectedDrawables->begin(); it != newlySelectedDrawables->end(); ++it) { if (!(*it)) { @@ -252,7 +252,7 @@ UnsignedInt getPickTypesForContext( Bool forceAttackMode ) // const CommandButton *command = TheInGameUI->getGUICommand(); - if (command != NULL) { + if (command != nullptr) { if (BitIsSet( command->getOptions(), ALLOW_MINE_TARGET)) { types |= PICK_TYPE_MINES; } diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index dc3cf083120..83330303214 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -40,7 +40,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -Anim2DCollection *TheAnim2DCollection = NULL; +Anim2DCollection *TheAnim2DCollection = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,12 +52,12 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) { m_name = name; - m_images = NULL; + m_images = nullptr; m_numFrames = NUM_FRAMES_INVALID; m_framesBetweenUpdates = 0; m_animMode = ANIM_2D_LOOP; m_randomizeStartFrame = FALSE; - m_nextTemplate = NULL; + m_nextTemplate = nullptr; } @@ -76,13 +76,13 @@ Anim2DTemplate::~Anim2DTemplate( void ) const FieldParse Anim2DTemplate::s_anim2DFieldParseTable[] = { - { "NumberImages", Anim2DTemplate::parseNumImages, NULL, 0 }, - { "Image", Anim2DTemplate::parseImage, NULL, 0 }, - { "ImageSequence", Anim2DTemplate::parseImageSequence, NULL, 0 }, + { "NumberImages", Anim2DTemplate::parseNumImages, nullptr, 0 }, + { "Image", Anim2DTemplate::parseImage, nullptr, 0 }, + { "ImageSequence", Anim2DTemplate::parseImageSequence, nullptr, 0 }, { "AnimationMode", INI::parseIndexList, Anim2DModeNames, offsetof( Anim2DTemplate, m_animMode ) }, - { "AnimationDelay", INI::parseDurationUnsignedShort, NULL, offsetof( Anim2DTemplate, m_framesBetweenUpdates ) }, - { "RandomizeStartFrame", INI::parseBool, NULL, offsetof( Anim2DTemplate, m_randomizeStartFrame ) }, - { NULL, NULL, NULL, 0 } + { "AnimationDelay", INI::parseDurationUnsignedShort, nullptr, offsetof( Anim2DTemplate, m_framesBetweenUpdates ) }, + { "RandomizeStartFrame", INI::parseBool, nullptr, offsetof( Anim2DTemplate, m_randomizeStartFrame ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -127,9 +127,9 @@ void Anim2DTemplate::allocateImages( UnsignedShort numFrames ) // allocate an array to hold the image pointers m_images = NEW const Image *[ m_numFrames ]; // pool[]ify - // set all the images to NULL; + // set all the images to nullptr; for( Int i = 0; i < m_numFrames; ++i ) - m_images[ i ] = NULL; + m_images[ i ] = nullptr; } @@ -144,7 +144,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo ini->parseMappedImage( ini, instance, &image, userData ); // sanity - if( image == NULL ) + if( image == nullptr ) { //We don't care if we're in the builder @@ -210,7 +210,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo image = TheMappedImageCollection->findImageByName( imageName ); // sanity - if( image == NULL ) + if( image == nullptr ) { DEBUG_CRASH(( "Anim2DTemplate::parseImageSequence - Image '%s' not found for animation '%s'. Check the number of images specified in INI and also make sure all the actual images exist.", @@ -233,14 +233,14 @@ void Anim2DTemplate::storeImage( const Image *image ) { // sanity - if( image == NULL ) + if( image == nullptr ) return; // search through the image list and store at the next free spot for( Int i = 0; i < m_numFrames; ++i ) { - if( m_images[ i ] == NULL ) + if( m_images[ i ] == nullptr ) { m_images[ i ] = image; @@ -264,8 +264,8 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const { // sanity - DEBUG_ASSERTCRASH( m_images != NULL, - ("Anim2DTemplate::getFrame - Image data is NULL for animation '%s'", + DEBUG_ASSERTCRASH( m_images != nullptr, + ("Anim2DTemplate::getFrame - Image data is null for animation '%s'", getName().str()) ); // sanity @@ -274,7 +274,7 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const DEBUG_CRASH(( "Anim2DTemplate::getFrame - Illegal frame number '%d' for animation '%s'", frameNumber, getName().str() )); - return NULL; + return nullptr; } else @@ -296,7 +296,7 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem ) { // sanity - DEBUG_ASSERTCRASH( animTemplate != NULL, ("Anim2D::Anim2D - NULL template") ); + DEBUG_ASSERTCRASH( animTemplate != nullptr, ("Anim2D::Anim2D - null template") ); m_currentFrame = 0; // set the template @@ -317,8 +317,8 @@ Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem m_framesBetweenUpdates = m_template->getNumFramesBetweenUpdates(); // we register ourselves to the System - m_collectionSystemNext = NULL; - m_collectionSystemPrev = NULL; + m_collectionSystemNext = nullptr; + m_collectionSystemPrev = nullptr; m_lastUpdateFrame = 0; @@ -346,10 +346,10 @@ void Anim2D::setCurrentFrame( UnsignedShort frame ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); // sanity - DEBUG_ASSERTCRASH( TheGameLogic != NULL, + DEBUG_ASSERTCRASH( TheGameLogic != nullptr, ("Anim2D::setCurrentFrame - TheGameLogic must exist to use animation instances (%s)", m_template->getName().str()) ); @@ -373,7 +373,7 @@ void Anim2D::randomizeCurrentFrame( void ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); // set the current frame to a random frame setCurrentFrame( GameClientRandomValue( 0, m_template->getNumFrames() - 1 ) ); @@ -387,7 +387,7 @@ void Anim2D::reset( void ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); switch( m_template->getAnimMode() ) { @@ -424,7 +424,7 @@ void Anim2D::tryNextFrame( void ) { // sanity - DEBUG_ASSERTCRASH( TheGameLogic != NULL, + DEBUG_ASSERTCRASH( TheGameLogic != nullptr, ("Anim2D::tryNextFrame - TheGameLogic must exist to use animation instances (%s)", m_template->getName().str()) ); @@ -612,7 +612,7 @@ void Anim2D::draw( Int x, Int y ) const Image *image = m_template->getFrame( m_currentFrame ); // sanity - DEBUG_ASSERTCRASH( image != NULL, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", + DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", m_currentFrame, m_template->getName().str()) ); // get the natural width and height of this image @@ -627,7 +627,7 @@ void Anim2D::draw( Int x, Int y ) // frame numbers for animation instances that are registered with a system as the // system will update them during its update phase // - if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) + if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); } @@ -642,7 +642,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) const Image *image = m_template->getFrame( m_currentFrame ); // sanity - DEBUG_ASSERTCRASH( image != NULL, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", + DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", m_currentFrame, m_template->getName().str()) ); @@ -655,7 +655,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) // frame numbers for animation instances that are registered with a system as the // system will update them during its update phase // - if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) + if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); } @@ -705,8 +705,8 @@ void Anim2D::xfer( Xfer *xfer ) Anim2DCollection::Anim2DCollection( void ) { - m_templateList = NULL; - m_instanceList = NULL; + m_templateList = nullptr; + m_instanceList = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -715,7 +715,7 @@ Anim2DCollection::~Anim2DCollection( void ) { // there should not be any animation instances registered with us since we're being destroyed - DEBUG_ASSERTCRASH( m_instanceList == NULL, ("Anim2DCollection - instance list is not NULL") ); + DEBUG_ASSERTCRASH( m_instanceList == nullptr, ("Anim2DCollection - instance list is not null") ); // delete all the templates Anim2DTemplate *nextTemplate; @@ -742,7 +742,7 @@ void Anim2DCollection::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, nullptr ); } @@ -782,7 +782,7 @@ Anim2DTemplate *Anim2DCollection::findTemplate( const AsciiString& name ) } - return NULL; // template not found + return nullptr; // template not found } @@ -793,7 +793,7 @@ Anim2DTemplate* Anim2DCollection::getNextTemplate( Anim2DTemplate *animTemplate { return animTemplate->friend_getNextTemplate(); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -822,17 +822,17 @@ void Anim2DCollection::registerAnimation( Anim2D *anim ) { // sanity - if( anim == NULL ) + if( anim == nullptr ) return; // sanity - DEBUG_ASSERTCRASH( anim->m_collectionSystemNext == NULL && - anim->m_collectionSystemPrev == NULL, + DEBUG_ASSERTCRASH( anim->m_collectionSystemNext == nullptr && + anim->m_collectionSystemPrev == nullptr, ("Registering animation instance, instance '%s' is already in a system", anim->getAnimTemplate()->getName().str()) ); // tie to our list - anim->m_collectionSystemPrev = NULL; + anim->m_collectionSystemPrev = nullptr; anim->m_collectionSystemNext = m_instanceList; if( m_instanceList ) m_instanceList->m_collectionSystemPrev = anim; @@ -846,7 +846,7 @@ void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) { // sanity - if( anim == NULL ) + if( anim == nullptr ) return; // if animation is not registered with us do nothing diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index 97ed8527e86..13a7f51a8d0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -59,7 +59,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -CampaignManager *TheCampaignManager = NULL; +CampaignManager *TheCampaignManager = nullptr; @@ -67,12 +67,12 @@ CampaignManager *TheCampaignManager = NULL; const FieldParse CampaignManager::m_campaignFieldParseTable[] = { - { "Mission", CampaignManager::parseMissionPart, NULL, NULL }, - { "FirstMission", INI::parseAsciiString, NULL, offsetof( Campaign, m_firstMission ) }, - { "CampaignNameLabel", INI::parseAsciiString, NULL, offsetof( Campaign, m_campaignNameLabel ) }, - { "FinalVictoryMovie", INI::parseAsciiString, NULL, offsetof( Campaign, m_finalMovieName ) }, + { "Mission", CampaignManager::parseMissionPart, nullptr, 0 }, + { "FirstMission", INI::parseAsciiString, nullptr, offsetof( Campaign, m_firstMission ) }, + { "CampaignNameLabel", INI::parseAsciiString, nullptr, offsetof( Campaign, m_campaignNameLabel ) }, + { "FinalVictoryMovie", INI::parseAsciiString, nullptr, offsetof( Campaign, m_finalMovieName ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -160,7 +160,7 @@ Mission *Campaign::newMission( AsciiString name ) Mission *Campaign::getMission( AsciiString missionName ) { if(missionName.isEmpty()) - return NULL; + return nullptr; MissionListIt it; it = m_missions.begin(); // we've reached the end of the campaign @@ -172,7 +172,7 @@ Mission *Campaign::getMission( AsciiString missionName ) ++it; } DEBUG_ASSERTCRASH(FALSE, ("getMission couldn't find %s", missionName.str())); - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -191,7 +191,7 @@ Mission *Campaign::getNextMission( Mission *current) it = m_missions.begin(); // we've reached the end of the campaign if(name.isEmpty()) - return NULL; + return nullptr; while(it != m_missions.end()) { Mission *mission = *it; @@ -200,7 +200,7 @@ Mission *Campaign::getNextMission( Mission *current) ++it; } // DEBUG_ASSERTCRASH(FALSE, ("GetNextMission couldn't find %s", current->m_nextMission.str())); - return NULL; + return nullptr; } @@ -208,8 +208,8 @@ Mission *Campaign::getNextMission( Mission *current) CampaignManager::CampaignManager( void ) { m_campaignList.clear(); - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; m_victorious = FALSE; m_currentRankPoints = 0; m_difficulty = DIFFICULTY_NORMAL; @@ -218,8 +218,8 @@ CampaignManager::CampaignManager( void ) //----------------------------------------------------------------------------- CampaignManager::~CampaignManager( void ) { - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; CampaignListIt it = m_campaignList.begin(); @@ -236,7 +236,7 @@ void CampaignManager::init( void ) { INI ini; // Read from INI all the CampaignManager - ini.loadFileDirectory( "Data\\INI\\Campaign", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Campaign", INI_LOAD_OVERWRITE, nullptr ); } //----------------------------------------------------------------------------- @@ -255,7 +255,7 @@ Mission *CampaignManager::getCurrentMission( void ) Mission *CampaignManager::gotoNextMission( void ) { if (!m_currentCampaign || !m_currentMission) - return NULL; + return nullptr; m_currentMission = m_currentCampaign->getNextMission(m_currentMission); return m_currentMission; @@ -297,14 +297,14 @@ void CampaignManager::setCampaign( AsciiString campaign ) if(camp->m_name.compare(campaign) == 0) { m_currentCampaign = camp; - m_currentMission = camp->getNextMission( NULL ); + m_currentMission = camp->getNextMission( nullptr ); return; } ++it; } // could not find the mission. we are resetting the missions to nothing. - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; m_currentRankPoints = 0; m_difficulty = DIFFICULTY_NORMAL; } @@ -350,23 +350,23 @@ void CampaignManager::parseMissionPart( INI* ini, void *instance, void *store, c { static const FieldParse myFieldParse[] = { - { "Map", INI::parseAsciiString, NULL, offsetof( Mission, m_mapName ) }, - { "NextMission", INI::parseAsciiString, NULL, offsetof( Mission, m_nextMission ) }, - { "IntroMovie", INI::parseAsciiString, NULL, offsetof( Mission, m_movieLabel ) }, - { "ObjectiveLine0", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[0] ) }, - { "ObjectiveLine1", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[1] ) }, - { "ObjectiveLine2", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[2] ) }, - { "ObjectiveLine3", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[3] ) }, - { "ObjectiveLine4", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[4] ) }, - { "BriefingVoice", INI::parseAudioEventRTS, NULL, offsetof( Mission, m_briefingVoice ) }, - { "UnitNames0", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[0] ) }, - { "UnitNames1", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[1] ) }, - { "UnitNames2", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[2] ) }, - { "LocationNameLabel",INI::parseAsciiString, NULL, offsetof( Mission, m_locationNameLabel ) }, - { "VoiceLength", INI::parseInt , NULL, offsetof( Mission, m_voiceLength ) }, - - - { NULL, NULL, NULL, 0 } + { "Map", INI::parseAsciiString, nullptr, offsetof( Mission, m_mapName ) }, + { "NextMission", INI::parseAsciiString, nullptr, offsetof( Mission, m_nextMission ) }, + { "IntroMovie", INI::parseAsciiString, nullptr, offsetof( Mission, m_movieLabel ) }, + { "ObjectiveLine0", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[0] ) }, + { "ObjectiveLine1", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[1] ) }, + { "ObjectiveLine2", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[2] ) }, + { "ObjectiveLine3", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[3] ) }, + { "ObjectiveLine4", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[4] ) }, + { "BriefingVoice", INI::parseAudioEventRTS, nullptr, offsetof( Mission, m_briefingVoice ) }, + { "UnitNames0", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[0] ) }, + { "UnitNames1", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[1] ) }, + { "UnitNames2", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[2] ) }, + { "LocationNameLabel",INI::parseAsciiString, nullptr, offsetof( Mission, m_locationNameLabel ) }, + { "VoiceLength", INI::parseInt , nullptr, offsetof( Mission, m_voiceLength ) }, + + + { nullptr, nullptr, nullptr, 0 } }; AsciiString name; const char* c = ini->getNextToken(); diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp index e2fffa78cb6..bc70cb3d98c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -45,13 +45,13 @@ const FieldParse Image::m_imageFieldParseTable[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( Image, m_filename ) }, - { "TextureWidth", INI::parseInt, NULL, offsetof( Image, m_textureSize.x ) }, - { "TextureHeight", INI::parseInt, NULL, offsetof( Image, m_textureSize.y ) }, - { "Coords", Image::parseImageCoords, NULL, offsetof( Image, m_UVCoords ) }, - { "Status", Image::parseImageStatus, NULL, offsetof( Image, m_status ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( Image, m_filename ) }, + { "TextureWidth", INI::parseInt, nullptr, offsetof( Image, m_textureSize.x ) }, + { "TextureHeight", INI::parseInt, nullptr, offsetof( Image, m_textureSize.y ) }, + { "Coords", Image::parseImageCoords, nullptr, offsetof( Image, m_UVCoords ) }, + { "Status", Image::parseImageStatus, nullptr, offsetof( Image, m_status ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -134,7 +134,7 @@ void Image::parseImageStatus( INI* ini, void *instance, void *store, const void* } // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ImageCollection *TheMappedImageCollection = NULL; ///< mapped images +ImageCollection *TheMappedImageCollection = nullptr; ///< mapped images // PUBLIC FUNCTIONS//////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -152,7 +152,7 @@ Image::Image( void ) m_UVCoords.hi.y = 1.0f; m_imageSize.x = 0; m_imageSize.y = 0; - m_rawTextureData = NULL; + m_rawTextureData = nullptr; m_status = IMAGE_STATUS_NONE; } @@ -220,7 +220,7 @@ void ImageCollection::addImage( Image *image ) const Image *ImageCollection::findImage( NameKeyType namekey ) const { ImageMap::const_iterator i = m_imageMap.find(namekey); - return i == m_imageMap.end() ? NULL : i->second; + return i == m_imageMap.end() ? nullptr : i->second; } //------------------------------------------------------------------------------------------------- @@ -256,7 +256,7 @@ void ImageCollection::load( Int textureSize ) if(FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) { userDataPath.format("%sINI\\MappedImages",TheGlobalData->getPath_UserData().str()); - ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, nullptr ); } } @@ -265,9 +265,9 @@ void ImageCollection::load( Int textureSize ) // load all the ine files in that directory - ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, nullptr ); - ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, nullptr ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 4d8cd851e95..8e78ca89c58 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -58,7 +58,7 @@ //------------------------------------------------------------------------------------------------- // the singleton -ParticleSystemManager *TheParticleSystemManager = NULL; +ParticleSystemManager *TheParticleSystemManager = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -339,7 +339,7 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) } m_inSystemList = m_inOverallList = FALSE; - m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = NULL; + m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr; // add this particle to the global list, retaining particle creation order TheParticleSystemManager->addParticle(this, system->getPriority() ); @@ -360,7 +360,7 @@ Particle::~Particle() if (m_drawable) TheGameClient->destroyDrawable( m_drawable ); - m_drawable = NULL; + m_drawable = nullptr; // if this particle was controlling another particle system, destroy that system if (m_systemUnderControl) @@ -368,7 +368,7 @@ Particle::~Particle() m_systemUnderControl->detachControlParticle( this ); m_systemUnderControl->destroy(); } - m_systemUnderControl = NULL; + m_systemUnderControl = nullptr; // remove from the global list TheParticleSystemManager->removeParticle(this); @@ -755,7 +755,7 @@ void Particle::xfer( Xfer *xfer ) m_drawable = TheGameClient->findDrawableByID( drawableID ); // sanity - if( m_drawable == NULL ) + if( m_drawable == nullptr ) { DEBUG_CRASH(( "Particle::xfer - Unable to find matching drawable id for particle" )); @@ -796,7 +796,7 @@ void Particle::loadPostProcess( void ) controlParticleSystem( system ); // sanity - if( m_systemUnderControlID == NULL ) + if( m_systemUnderControlID == INVALID_PARTICLE_SYSTEM_ID ) { DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); @@ -1120,7 +1120,7 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, ParticleSystemID id, Bool createSlaves ) { - m_systemParticlesHead = m_systemParticlesTail = NULL; + m_systemParticlesHead = m_systemParticlesTail = nullptr; m_isFirstPos = true; m_template = sysTemplate; @@ -1243,8 +1243,8 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, // set up slave particle system, if any m_masterSystemID = INVALID_PARTICLE_SYSTEM_ID; m_slaveSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_masterSystem = NULL; - m_slaveSystem = NULL; + m_masterSystem = nullptr; + m_slaveSystem = nullptr; if( createSlaves ) { ParticleSystem *slaveSystem = sysTemplate->createSlaveSystem(); @@ -1262,7 +1262,7 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, m_attachedSystemName = sysTemplate->m_attachedSystemName; m_particleCount = 0; m_personalityStore = 0; - m_controlParticle = NULL; + m_controlParticle = nullptr; TheParticleSystemManager->friend_addParticleSystem(this); @@ -1280,8 +1280,8 @@ ParticleSystem::~ParticleSystem() { DEBUG_ASSERTCRASH( m_slaveSystem->getMaster() == this, ("~ParticleSystem: Our slave doesn't have us as a master!") ); - m_slaveSystem->setMaster( NULL ); - setSlave( NULL ); + m_slaveSystem->setMaster( nullptr ); + setSlave( nullptr ); } @@ -1290,8 +1290,8 @@ ParticleSystem::~ParticleSystem() { DEBUG_ASSERTCRASH( m_masterSystem->getSlave() == this, ("~ParticleSystem: Our master doesn't have us as a slave!") ); - m_masterSystem->setSlave( NULL ); - setMaster( NULL ); + m_masterSystem->setSlave( nullptr ); + setMaster( nullptr ); } @@ -1307,7 +1307,7 @@ ParticleSystem::~ParticleSystem() if (m_controlParticle) m_controlParticle->detachControlledParticleSystem(); - m_controlParticle = NULL; + m_controlParticle = nullptr; TheParticleSystemManager->friend_removeParticleSystem(this); //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); @@ -1773,7 +1773,7 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, { if (TheGlobalData->m_useFX == FALSE) - return NULL; + return nullptr; // // Enforce particle limit. @@ -1789,10 +1789,10 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, if( priority < TheGameLODManager->getMinDynamicParticlePriority() || (priority < TheGameLODManager->getMinDynamicParticleSkipPriority() && TheGameLODManager->isParticleSkipped()) ) - return NULL; + return nullptr; if ( getParticleCount() > 0 && priority == AREA_EFFECT && m_isGroundAligned && TheParticleSystemManager->getFieldParticleCount() > (UnsignedInt)TheGlobalData->m_maxFieldParticleCount ) - return NULL; + return nullptr; // ALWAYS_RENDER particles are exempt from all count limits, and are always created, regardless of LOD issues. if (priority != ALWAYS_RENDER) @@ -1801,11 +1801,11 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, if ( numInExcess > 0) { if( TheParticleSystemManager->removeOldestParticles((UnsignedInt) numInExcess, priority) != numInExcess ) - return NULL; // could not remove enough particles, don't create new stuff + return nullptr; // could not remove enough particles, don't create new stuff } if (TheGlobalData->m_maxParticleCount == 0) - return NULL; + return nullptr; } } @@ -1965,7 +1965,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) // matrix so generated particles' are relative to the parent Drawable's // position and orientation Bool transformSet = false; - const Matrix3D *parentXfrm = NULL; + const Matrix3D *parentXfrm = nullptr; Bool isShrouded = false; if (m_attachedToDrawableID) @@ -2066,7 +2066,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) { if (m_isForever || (m_isForever == false && m_systemLifetimeLeft > 0)) { - if (!isShrouded && m_isStopped == false && m_masterSystem == NULL) + if (!isShrouded && m_isStopped == false && m_masterSystem == nullptr) { if (m_burstDelayLeft == 0) { @@ -2085,7 +2085,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) { // actually create a particle Particle *p = createParticle( info, priority ); - if (p == NULL) + if (p == nullptr) continue; if (m_attachedSystemName.isEmpty() == false) @@ -2332,11 +2332,11 @@ void ParticleSystem::addParticle( Particle *particleToAdd ) } else { - particleToAdd->m_systemPrev = NULL; + particleToAdd->m_systemPrev = nullptr; } m_systemParticlesTail = particleToAdd; - particleToAdd->m_systemNext = NULL; + particleToAdd->m_systemNext = nullptr; particleToAdd->m_inSystemList = TRUE; ++m_particleCount; @@ -2365,7 +2365,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) if (particleToRemove == m_systemParticlesTail) m_systemParticlesTail = particleToRemove->m_systemPrev; - particleToRemove->m_systemNext = particleToRemove->m_systemPrev = NULL; + particleToRemove->m_systemNext = particleToRemove->m_systemPrev = nullptr; particleToRemove->m_inSystemList = FALSE; --m_particleCount; } @@ -2375,7 +2375,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *masterParticleSystem, ParticleSystem *slaveParticleSystem, Bool slaveNeedsFullPromotion) { if (!masterParticleSystem || !slaveParticleSystem) { - DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was NULL. Should not happen. JKMCD")); + DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was null. Should not happen. JKMCD")); ParticleInfo bogus; return bogus; } @@ -2624,10 +2624,10 @@ void ParticleSystem::loadPostProcess( void ) { // sanity - if( m_slaveSystem != NULL ) + if( m_slaveSystem != nullptr ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not NULL but should be" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not null but should be" )); throw SC_INVALID_DATA; } @@ -2636,10 +2636,10 @@ void ParticleSystem::loadPostProcess( void ) m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); // sanity - if( m_slaveSystem == NULL || m_slaveSystem->isDestroyed() == TRUE ) + if( m_slaveSystem == nullptr || m_slaveSystem->isDestroyed() == TRUE ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is NULL or destroyed" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is null or destroyed" )); throw SC_INVALID_DATA; } @@ -2651,10 +2651,10 @@ void ParticleSystem::loadPostProcess( void ) { // sanity - if( m_masterSystem != NULL ) + if( m_masterSystem != nullptr ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not NULL but should be" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not null but should be" )); throw SC_INVALID_DATA; } @@ -2663,10 +2663,10 @@ void ParticleSystem::loadPostProcess( void ) m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); // sanity - if( m_masterSystem == NULL || m_masterSystem->isDestroyed() == TRUE ) + if( m_masterSystem == nullptr || m_masterSystem->isDestroyed() == TRUE ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is NULL or destroyed" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is null or destroyed" )); throw SC_INVALID_DATA; } @@ -2685,102 +2685,102 @@ void ParticleSystem::loadPostProcess( void ) const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = { { "Priority", INI::parseIndexList, ParticlePriorityNames, offsetof( ParticleSystemTemplate, m_priority ) }, - { "IsOneShot", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isOneShot ) }, + { "IsOneShot", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isOneShot ) }, { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, - { "ParticleName", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, - { "AngleX", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angleX ) }, - { "AngleY", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angleY ) }, - { "AngleZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angleZ ) }, - { "AngularRateX", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularRateX ) }, - { "AngularRateY", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularRateY ) }, - { "AngularRateZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, - { "AngularDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularDamping ) }, - - { "VelocityDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_velDamping ) }, - { "Gravity", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_gravity ) }, - { "SlaveSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, - { "SlavePosOffset", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, - { "PerParticleAttachedSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, - - { "Lifetime", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_lifetime ) }, - { "SystemLifetime", INI::parseUnsignedInt, NULL, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, - - { "Size", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSize ) }, - { "StartSizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, - { "SizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRate ) }, - { "SizeRateDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, - - { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, - { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, - { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, - { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, - { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, - { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, - { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, - { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, - - { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, - { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, - { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, - { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, - { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, - { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, - { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, - { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, - -// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, NULL, offsetof( ParticleSystemTemplate, m_color ) }, - { "ColorScale", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_colorScale ) }, - - { "BurstDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstDelay ) }, - { "BurstCount", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstCount ) }, - - { "InitialDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_initialDelay ) }, - - { "DriftVelocity", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, + { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, + { "AngleX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleX ) }, + { "AngleY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleY ) }, + { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, + { "AngularRateX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateX ) }, + { "AngularRateY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateY ) }, + { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, + { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, + + { "VelocityDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_velDamping ) }, + { "Gravity", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_gravity ) }, + { "SlaveSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, + { "SlavePosOffset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, + { "PerParticleAttachedSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, + + { "Lifetime", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_lifetime ) }, + { "SystemLifetime", INI::parseUnsignedInt, nullptr, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, + + { "Size", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSize ) }, + { "StartSizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, + { "SizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRate ) }, + { "SizeRateDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, + + { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, + { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, + { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, + { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, + { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, + { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, + { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, + { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, + + { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, + { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, + { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, + { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, + { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, + { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, + { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, + { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, + +// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, nullptr, offsetof( ParticleSystemTemplate, m_color ) }, + { "ColorScale", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_colorScale ) }, + + { "BurstDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstDelay ) }, + { "BurstCount", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstCount ) }, + + { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_initialDelay ) }, + + { "DriftVelocity", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, { "VelocityType", INI::parseIndexList, EmissionVelocityTypeNames, offsetof( ParticleSystemTemplate, m_emissionVelocityType ) }, - { "VelOrthoX", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, - { "VelOrthoY", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, - { "VelOrthoZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, + { "VelOrthoX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, + { "VelOrthoY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, + { "VelOrthoZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, - { "VelSpherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, - { "VelHemispherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, + { "VelSpherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, + { "VelHemispherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, - { "VelCylindricalRadial", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, - { "VelCylindricalNormal", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, + { "VelCylindricalRadial", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, + { "VelCylindricalNormal", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, - { "VelOutward", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, - { "VelOutwardOther", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, + { "VelOutward", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, + { "VelOutwardOther", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, { "VolumeType", INI::parseIndexList, EmissionVolumeTypeNames, offsetof( ParticleSystemTemplate, m_emissionVolumeType ) }, - { "VolLineStart", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, - { "VolLineEnd", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, + { "VolLineStart", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, + { "VolLineEnd", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, - { "VolBoxHalfSize", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, + { "VolBoxHalfSize", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, - { "VolSphereRadius", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, + { "VolSphereRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, - { "VolCylinderRadius", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, - { "VolCylinderLength", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, + { "VolCylinderRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, + { "VolCylinderLength", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, - { "IsHollow", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, - { "IsGroundAligned", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, - { "IsEmitAboveGroundOnly", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, - { "IsParticleUpTowardsEmitter", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, + { "IsHollow", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, + { "IsGroundAligned", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, + { "IsEmitAboveGroundOnly", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, + { "IsParticleUpTowardsEmitter", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, { "WindMotion", INI::parseIndexList, WindMotionNames, offsetof( ParticleSystemTemplate, m_windMotion ) }, - { "WindAngleChangeMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, - { "WindAngleChangeMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, + { "WindAngleChangeMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, + { "WindAngleChangeMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, - { "WindPingPongStartAngleMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, - { "WindPingPongStartAngleMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, + { "WindPingPongStartAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, + { "WindPingPongStartAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, - { "WindPingPongEndAngleMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, - { "WindPingPongEndAngleMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, + { "WindPingPongEndAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, + { "WindPingPongEndAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; // ------------------------------------------------------------------------------------------------ @@ -2809,8 +2809,8 @@ void ParticleSystemTemplate::parseRGBColorKeyframe( INI* ini, void *instance, { RGBColorKeyframe *key = static_cast(store); - INI::parseRGBColor( ini, instance, &key->color, NULL ); - INI::parseUnsignedInt( ini, instance, &key->frame, NULL ); + INI::parseRGBColor( ini, instance, &key->color, nullptr ); + INI::parseUnsignedInt( ini, instance, &key->frame, nullptr ); } // ------------------------------------------------------------------------------------------------ @@ -2869,7 +2869,7 @@ void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, ParticleSystemTemplate::ParticleSystemTemplate( const AsciiString &name ) : m_name(name) { - m_slaveTemplate = NULL; + m_slaveTemplate = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -2880,16 +2880,16 @@ ParticleSystemTemplate::~ParticleSystemTemplate() } // ------------------------------------------------------------------------------------------------ -/** If returns non-NULL, it is a slave system for use ... the create slaves parameter +/** If returns non-null, it is a slave system for use ... the create slaves parameter * tells *this* slave system whether or not it should create any slaves itself * automatically during its own constructor */ // ------------------------------------------------------------------------------------------------ ParticleSystem *ParticleSystemTemplate::createSlaveSystem( Bool createSlaves ) const { - if (m_slaveTemplate == NULL && m_slaveSystemName.isEmpty() == false) + if (m_slaveTemplate == nullptr && m_slaveSystemName.isEmpty() == false) m_slaveTemplate = TheParticleSystemManager->findTemplate( m_slaveSystemName ); - ParticleSystem *slave = NULL; + ParticleSystem *slave = nullptr; if (m_slaveTemplate) slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves ); @@ -2918,8 +2918,8 @@ ParticleSystemManager::ParticleSystemManager( void ) for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) { - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -2945,19 +2945,19 @@ void ParticleSystemManager::init( void ) { /// Read INI data and build templates INI ini; - ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, nullptr ); // sanity, our lists must be empty!! for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) { // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == NULL, ("INIT: ParticleSystem all particles head[%d] is not NULL!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == NULL, ("INIT: ParticleSystem all particles tail[%d] is not NULL!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("INIT: ParticleSystem all particles head[%d] is not null!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not null!", i) ); - // just to be clean set them to NULL - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + // just to be clean set them to nullptr + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -2970,7 +2970,7 @@ void ParticleSystemManager::reset( void ) { while (!m_allParticleSystemList.empty()) { - DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != NULL, ("ParticleSystemManager::reset: ParticleSystem is null")); + DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != nullptr, ("ParticleSystemManager::reset: ParticleSystem is null")); deleteInstance(m_allParticleSystemList.front()); } DEBUG_ASSERTCRASH(m_particleSystemCount == 0, ("ParticleSystemManager::reset: m_particleSystemCount is %u, not 0", m_particleSystemCount)); @@ -2980,12 +2980,12 @@ void ParticleSystemManager::reset( void ) { // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == NULL, ("RESET: ParticleSystem all particles head[%d] is not NULL!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == NULL, ("RESET: ParticleSystem all particles tail[%d] is not NULL!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("RESET: ParticleSystem all particles head[%d] is not null!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not null!", i) ); - // just to be clean set them to NULL - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + // just to be clean set them to nullptr + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -3018,7 +3018,7 @@ void ParticleSystemManager::update( void ) { // TheSuperHackers @info Must increment the list iterator before potential element erasure from the list. ParticleSystem* sys = *it++; - DEBUG_ASSERTCRASH(sys != NULL, ("ParticleSystemManager::update: ParticleSystem is null")); + DEBUG_ASSERTCRASH(sys != nullptr, ("ParticleSystemManager::update: ParticleSystem is null")); if (sys->update(m_localPlayerIndex) == false) { @@ -3041,8 +3041,8 @@ void ParticleSystemManager::setOnScreenParticleCount(int count) ParticleSystem *ParticleSystemManager::createParticleSystem( const ParticleSystemTemplate *sysTemplate, Bool createSlaves ) { // sanity - if (sysTemplate == NULL) - return NULL; + if (sysTemplate == nullptr) + return nullptr; m_uniqueSystemID = (ParticleSystemID)((UnsignedInt)m_uniqueSystemID + 1); ParticleSystem *sys = newInstance(ParticleSystem)( sysTemplate, m_uniqueSystemID, createSlaves ); @@ -3069,20 +3069,20 @@ ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) { if (id == INVALID_PARTICLE_SYSTEM_ID) - return NULL; // my, that was easy + return nullptr; // my, that was easy - ParticleSystem *system = NULL; + ParticleSystem *system = nullptr; for( ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) { system = *it; - DEBUG_ASSERTCRASH(system != NULL, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); + DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); if( system->getSystemID() == id ) { return system; } } - return NULL; + return nullptr; } @@ -3101,7 +3101,7 @@ void ParticleSystemManager::destroyParticleSystemByID(ParticleSystemID id) // ------------------------------------------------------------------------------------------------ ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString &name ) const { - ParticleSystemTemplate *sysTemplate = NULL; + ParticleSystemTemplate *sysTemplate = nullptr; TemplateMap::const_iterator find(m_templateMap.find(name)); if (find != m_templateMap.end()) { @@ -3117,12 +3117,12 @@ ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString & ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &name ) { ParticleSystemTemplate *sysTemplate = findTemplate(name); - if (sysTemplate == NULL) { + if (sysTemplate == nullptr) { sysTemplate = newInstance(ParticleSystemTemplate)( name ); if (! m_templateMap.insert(std::make_pair(name, sysTemplate)).second) { deleteInstance(sysTemplate); - sysTemplate = NULL; + sysTemplate = nullptr; } } @@ -3135,7 +3135,7 @@ ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &n ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiString &name, Int parentNum ) const { if (name.isEmpty()) { - return NULL; + return nullptr; } TemplateMap::const_iterator begin(m_templateMap.begin()); @@ -3149,7 +3149,7 @@ ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiSt } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -3159,7 +3159,7 @@ void ParticleSystemManager::destroyAttachedSystems( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // iterate through all systems @@ -3169,7 +3169,7 @@ void ParticleSystemManager::destroyAttachedSystems( Object *obj ) { ParticleSystem *system = *it; - DEBUG_ASSERTCRASH(system != NULL, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); + DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); if( system->getAttachedObject() == obj->getID() ) system->destroy(); @@ -3198,11 +3198,11 @@ void ParticleSystemManager::addParticle( Particle *particleToAdd, ParticlePriori } else { - particleToAdd->m_overallPrev = NULL; + particleToAdd->m_overallPrev = nullptr; } m_allParticlesTail[ priority ] = particleToAdd; - particleToAdd->m_overallNext = NULL; + particleToAdd->m_overallNext = nullptr; particleToAdd->m_inOverallList = TRUE; ++m_particleCount; @@ -3233,7 +3233,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) if (particleToRemove == m_allParticlesTail[ priority ]) m_allParticlesTail[ priority ] = particleToRemove->m_overallPrev; - particleToRemove->m_overallNext = particleToRemove->m_overallPrev = NULL; + particleToRemove->m_overallNext = particleToRemove->m_overallPrev = nullptr; particleToRemove->m_inOverallList = FALSE; --m_particleCount; @@ -3245,7 +3245,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) // ------------------------------------------------------------------------------------------------ void ParticleSystemManager::friend_addParticleSystem( ParticleSystem *particleSystemToAdd ) { - DEBUG_ASSERTCRASH(particleSystemToAdd != NULL, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); + DEBUG_ASSERTCRASH(particleSystemToAdd != nullptr, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); m_allParticleSystemList.push_back(particleSystemToAdd); ++m_particleSystemCount; } @@ -3386,7 +3386,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemTemplate = findTemplate( systemName ); // sanity - if( systemTemplate == NULL ) + if( systemTemplate == nullptr ) { DEBUG_CRASH(( "ParticleSystemManager::xfer - Unknown particle system template '%s'", @@ -3398,7 +3398,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) // create system system = createParticleSystem( systemTemplate, FALSE ); - if( system == NULL ) + if( system == nullptr ) { DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to allocate particle system '%s'", diff --git a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp index ea98b2fde5f..6531346e1d4 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp @@ -34,7 +34,7 @@ #include "GameClient/Drawable.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -class RayEffectSystem *TheRayEffects = NULL; +class RayEffectSystem *TheRayEffects = nullptr; // PRIVATE METHODS //////////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ class RayEffectSystem *TheRayEffects = NULL; RayEffectData *RayEffectSystem::findEntry( const Drawable *draw ) { Int i; - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // find the matching effect data entry for( i = 0; i < MAX_RAY_EFFECTS; i++ ) @@ -92,7 +92,7 @@ void RayEffectSystem::init( void ) for( i = 0; i < MAX_RAY_EFFECTS; i++ ) { - m_effectData[ i ].draw = NULL; + m_effectData[ i ].draw = nullptr; m_effectData[ i ].startLoc.zero(); m_effectData[ i ].endLoc.zero(); @@ -119,10 +119,10 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, const Coord3D *endLoc ) { Int i; - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // sanity - if( draw == NULL || startLoc == NULL || endLoc == NULL ) + if( draw == nullptr || startLoc == nullptr || endLoc == nullptr ) return; /** @todo this should be more intelligent and should not be limited @@ -133,7 +133,7 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, for( i = 0; i < MAX_RAY_EFFECTS; i++ ) { - if( m_effectData[ i ].draw == NULL ) + if( m_effectData[ i ].draw == nullptr ) { effectData = &m_effectData[ i ]; @@ -144,7 +144,7 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, } // if no free slots we can't do it - if( effectData == NULL ) + if( effectData == nullptr ) return; // add the data to the entry @@ -159,10 +159,10 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, //------------------------------------------------------------------------------------------------- void RayEffectSystem::deleteRayEffect( const Drawable *draw ) { - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // sanity - if( draw == NULL ) + if( draw == nullptr ) return; // find the effect entry @@ -171,7 +171,7 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) { // remove the data for this entry - effectData->draw = NULL; + effectData->draw = nullptr; } @@ -184,10 +184,10 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) void RayEffectSystem::getRayEffectData( const Drawable *draw, RayEffectData *effectData ) { - RayEffectData *entry = NULL; + RayEffectData *entry = nullptr; // sanity - if( draw == NULL || effectData == NULL ) + if( draw == nullptr || effectData == nullptr ) return; // find the effect data entry diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 46ee5001a09..81cc830ee89 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -65,8 +65,8 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) if (buildList->m_side == info->m_side) { deleteInstance(info->m_buildList); info->m_buildList = buildList->m_buildList; - buildList->m_buildList = NULL; - buildList->m_next = NULL; + buildList->m_buildList = nullptr; + buildList->m_next = nullptr; deleteInstance(buildList); return; } @@ -79,7 +79,7 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) TAiData::~TAiData() { AISideInfo *info = m_sideInfo; - m_sideInfo = NULL; + m_sideInfo = nullptr; while (info) { AISideInfo *cur = info; info = info->m_next; @@ -87,7 +87,7 @@ TAiData::~TAiData() } AISideBuildList *build = m_sideBuildLists; - m_sideBuildLists = NULL; + m_sideBuildLists = nullptr; while (build) { AISideBuildList *cur = build; build = build->m_next; @@ -101,31 +101,31 @@ TAiData::~TAiData() /////////////////////////////////////////////////////////////////////////////////////////////////// AISideBuildList::AISideBuildList( AsciiString side ) : m_side(side), - m_buildList(NULL), - m_next(NULL) + m_buildList(nullptr), + m_next(nullptr) { } AISideBuildList::~AISideBuildList() { deleteInstance(m_buildList); // note - deletes all in the list. - m_buildList = NULL; + m_buildList = nullptr; } void AISideBuildList::addInfo(BuildListInfo *info) { // Add to the end of the list. - if (m_buildList == NULL) { + if (m_buildList == nullptr) { m_buildList = info; } else { BuildListInfo *cur = m_buildList; while (cur && cur->getNext()) { cur = cur->getNext(); } - DEBUG_ASSERTCRASH(cur && cur->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(cur && cur->getNext()==nullptr, ("Logic error.")); cur->setNextBuildList(info); } - info->setNextBuildList(NULL); // should be at the end of the list. + info->setNextBuildList(nullptr); // should be at the end of the list. } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -134,67 +134,67 @@ void AISideBuildList::addInfo(BuildListInfo *info) static const FieldParse TheAIFieldParseTable[] = { - { "StructureSeconds", INI::parseReal,NULL, offsetof( TAiData, m_structureSeconds ) }, - { "TeamSeconds", INI::parseReal,NULL, offsetof( TAiData, m_teamSeconds ) }, - { "Wealthy", INI::parseInt,NULL, offsetof( TAiData, m_resourcesWealthy ) }, - { "Poor", INI::parseInt,NULL, offsetof( TAiData, m_resourcesPoor ) }, - { "ForceIdleMSEC", INI::parseDurationUnsignedInt,NULL,offsetof( TAiData, m_forceIdleFramesCount ) }, - { "StructuresWealthyRate", INI::parseReal,NULL, offsetof( TAiData, m_structuresWealthyMod ) }, - { "TeamsWealthyRate", INI::parseReal,NULL, offsetof( TAiData, m_teamWealthyMod ) }, - { "StructuresPoorRate", INI::parseReal,NULL, offsetof( TAiData, m_structuresPoorMod ) }, - { "TeamsPoorRate", INI::parseReal,NULL, offsetof( TAiData, m_teamPoorMod ) }, - { "TeamResourcesToStart", INI::parseReal,NULL, offsetof( TAiData, m_teamResourcesToBuild ) }, - { "GuardInnerModifierAI", INI::parseReal,NULL, offsetof( TAiData, m_guardInnerModifierAI ) }, - { "GuardOuterModifierAI", INI::parseReal,NULL, offsetof( TAiData, m_guardOuterModifierAI ) }, - { "GuardInnerModifierHuman",INI::parseReal,NULL, offsetof( TAiData, m_guardInnerModifierHuman ) }, - { "GuardOuterModifierHuman",INI::parseReal,NULL, offsetof( TAiData, m_guardOuterModifierHuman ) }, - { "GuardChaseUnitsDuration", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardChaseUnitFrames ) }, - { "GuardEnemyScanRate", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardEnemyScanRate ) }, - { "GuardEnemyReturnScanRate", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardEnemyReturnScanRate ) }, - { "SkirmishGroupFudgeDistance", INI::parseReal,NULL, offsetof( TAiData, m_skirmishGroupFudgeValue ) }, + { "StructureSeconds", INI::parseReal,nullptr, offsetof( TAiData, m_structureSeconds ) }, + { "TeamSeconds", INI::parseReal,nullptr, offsetof( TAiData, m_teamSeconds ) }, + { "Wealthy", INI::parseInt,nullptr, offsetof( TAiData, m_resourcesWealthy ) }, + { "Poor", INI::parseInt,nullptr, offsetof( TAiData, m_resourcesPoor ) }, + { "ForceIdleMSEC", INI::parseDurationUnsignedInt,nullptr,offsetof( TAiData, m_forceIdleFramesCount ) }, + { "StructuresWealthyRate", INI::parseReal,nullptr, offsetof( TAiData, m_structuresWealthyMod ) }, + { "TeamsWealthyRate", INI::parseReal,nullptr, offsetof( TAiData, m_teamWealthyMod ) }, + { "StructuresPoorRate", INI::parseReal,nullptr, offsetof( TAiData, m_structuresPoorMod ) }, + { "TeamsPoorRate", INI::parseReal,nullptr, offsetof( TAiData, m_teamPoorMod ) }, + { "TeamResourcesToStart", INI::parseReal,nullptr, offsetof( TAiData, m_teamResourcesToBuild ) }, + { "GuardInnerModifierAI", INI::parseReal,nullptr, offsetof( TAiData, m_guardInnerModifierAI ) }, + { "GuardOuterModifierAI", INI::parseReal,nullptr, offsetof( TAiData, m_guardOuterModifierAI ) }, + { "GuardInnerModifierHuman",INI::parseReal,nullptr, offsetof( TAiData, m_guardInnerModifierHuman ) }, + { "GuardOuterModifierHuman",INI::parseReal,nullptr, offsetof( TAiData, m_guardOuterModifierHuman ) }, + { "GuardChaseUnitsDuration", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardChaseUnitFrames ) }, + { "GuardEnemyScanRate", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardEnemyScanRate ) }, + { "GuardEnemyReturnScanRate", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardEnemyReturnScanRate ) }, + { "SkirmishGroupFudgeDistance", INI::parseReal,nullptr, offsetof( TAiData, m_skirmishGroupFudgeValue ) }, - { "RepulsedDistance", INI::parseReal,NULL, offsetof( TAiData, m_repulsedDistance ) }, - { "EnableRepulsors", INI::parseBool,NULL, offsetof( TAiData, m_enableRepulsors ) }, + { "RepulsedDistance", INI::parseReal,nullptr, offsetof( TAiData, m_repulsedDistance ) }, + { "EnableRepulsors", INI::parseBool,nullptr, offsetof( TAiData, m_enableRepulsors ) }, - { "AlertRangeModifier", INI::parseReal,NULL, offsetof( TAiData, m_alertRangeModifier) }, - { "AggressiveRangeModifier",INI::parseReal,NULL, offsetof( TAiData, m_aggressiveRangeModifier) }, + { "AlertRangeModifier", INI::parseReal,nullptr, offsetof( TAiData, m_alertRangeModifier) }, + { "AggressiveRangeModifier",INI::parseReal,nullptr, offsetof( TAiData, m_aggressiveRangeModifier) }, - { "ForceSkirmishAI", INI::parseBool,NULL, offsetof( TAiData, m_forceSkirmishAI ) }, - { "RotateSkirmishBases", INI::parseBool,NULL, offsetof( TAiData, m_rotateSkirmishBases ) }, + { "ForceSkirmishAI", INI::parseBool,nullptr, offsetof( TAiData, m_forceSkirmishAI ) }, + { "RotateSkirmishBases", INI::parseBool,nullptr, offsetof( TAiData, m_rotateSkirmishBases ) }, - { "AttackUsesLineOfSight", INI::parseBool,NULL, offsetof( TAiData, m_attackUsesLineOfSight ) }, - { "AttackIgnoreInsignificantBuildings", INI::parseBool,NULL, offsetof( TAiData, m_attackIgnoreInsignificantBuildings ) }, + { "AttackUsesLineOfSight", INI::parseBool,nullptr, offsetof( TAiData, m_attackUsesLineOfSight ) }, + { "AttackIgnoreInsignificantBuildings", INI::parseBool,nullptr, offsetof( TAiData, m_attackIgnoreInsignificantBuildings ) }, - { "AttackPriorityDistanceModifier", INI::parseReal,NULL, offsetof( TAiData, m_attackPriorityDistanceModifier) }, - { "MaxRecruitRadius", INI::parseReal,NULL, offsetof( TAiData, m_maxRecruitDistance ) }, + { "AttackPriorityDistanceModifier", INI::parseReal,nullptr, offsetof( TAiData, m_attackPriorityDistanceModifier) }, + { "MaxRecruitRadius", INI::parseReal,nullptr, offsetof( TAiData, m_maxRecruitDistance ) }, - { "WallHeight", INI::parseReal,NULL, offsetof( TAiData, m_wallHeight ) }, + { "WallHeight", INI::parseReal,nullptr, offsetof( TAiData, m_wallHeight ) }, - { "SideInfo", AI::parseSideInfo, NULL, NULL }, + { "SideInfo", AI::parseSideInfo, nullptr, 0 }, - { "SkirmishBuildList", AI::parseSkirmishBuildList, NULL, NULL }, + { "SkirmishBuildList", AI::parseSkirmishBuildList, nullptr, 0 }, - { "MinInfantryForGroup", INI::parseInt,NULL, offsetof( TAiData, m_minInfantryForGroup ) }, - { "MinVehiclesForGroup", INI::parseInt,NULL, offsetof( TAiData, m_minVehiclesForGroup ) }, + { "MinInfantryForGroup", INI::parseInt,nullptr, offsetof( TAiData, m_minInfantryForGroup ) }, + { "MinVehiclesForGroup", INI::parseInt,nullptr, offsetof( TAiData, m_minVehiclesForGroup ) }, - { "MinDistanceForGroup", INI::parseReal,NULL, offsetof( TAiData, m_minDistanceForGroup ) }, - { "DistanceRequiresGroup", INI::parseReal,NULL, offsetof( TAiData, m_distanceRequiresGroup ) }, - { "MinClumpDensity", INI::parseReal,NULL, offsetof( TAiData, m_minClumpDensity ) }, + { "MinDistanceForGroup", INI::parseReal,nullptr, offsetof( TAiData, m_minDistanceForGroup ) }, + { "DistanceRequiresGroup", INI::parseReal,nullptr, offsetof( TAiData, m_distanceRequiresGroup ) }, + { "MinClumpDensity", INI::parseReal,nullptr, offsetof( TAiData, m_minClumpDensity ) }, - { "InfantryPathfindDiameter", INI::parseInt,NULL, offsetof( TAiData, m_infantryPathfindDiameter ) }, - { "VehiclePathfindDiameter", INI::parseInt,NULL, offsetof( TAiData, m_vehiclePathfindDiameter ) }, - { "RebuildDelayTimeSeconds", INI::parseInt,NULL, offsetof( TAiData, m_rebuildDelaySeconds ) }, - { "SupplyCenterSafeRadius", INI::parseReal,NULL, offsetof( TAiData, m_supplyCenterSafeRadius ) }, + { "InfantryPathfindDiameter", INI::parseInt,nullptr, offsetof( TAiData, m_infantryPathfindDiameter ) }, + { "VehiclePathfindDiameter", INI::parseInt,nullptr, offsetof( TAiData, m_vehiclePathfindDiameter ) }, + { "RebuildDelayTimeSeconds", INI::parseInt,nullptr, offsetof( TAiData, m_rebuildDelaySeconds ) }, + { "SupplyCenterSafeRadius", INI::parseReal,nullptr, offsetof( TAiData, m_supplyCenterSafeRadius ) }, - { "AIDozerBoredRadiusModifier", INI::parseReal,NULL, offsetof( TAiData, m_aiDozerBoredRadiusModifier ) }, - { "AICrushesInfantry", INI::parseBool,NULL, offsetof( TAiData, m_aiCrushesInfantry ) }, + { "AIDozerBoredRadiusModifier", INI::parseReal,nullptr, offsetof( TAiData, m_aiDozerBoredRadiusModifier ) }, + { "AICrushesInfantry", INI::parseBool,nullptr, offsetof( TAiData, m_aiCrushesInfantry ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -205,16 +205,16 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* static const FieldParse myFieldParse[] = { - { "ResourceGatherersEasy", INI::parseInt, NULL, offsetof( AISideInfo, m_easy ) }, - { "ResourceGatherersNormal", INI::parseInt, NULL, offsetof( AISideInfo, m_normal ) }, - { "ResourceGatherersHard", INI::parseInt, NULL, offsetof( AISideInfo, m_hard ) }, - { "BaseDefenseStructure1", INI::parseAsciiString, NULL, offsetof( AISideInfo, m_baseDefenseStructure1 ) }, - { "SkillSet1", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet1 ) }, - { "SkillSet2", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet2 ) }, - { "SkillSet3", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet3 ) }, - { "SkillSet4", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet4 ) }, - { "SkillSet5", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet5 ) }, - { NULL, NULL, NULL, 0 } + { "ResourceGatherersEasy", INI::parseInt, nullptr, offsetof( AISideInfo, m_easy ) }, + { "ResourceGatherersNormal", INI::parseInt, nullptr, offsetof( AISideInfo, m_normal ) }, + { "ResourceGatherersHard", INI::parseInt, nullptr, offsetof( AISideInfo, m_hard ) }, + { "BaseDefenseStructure1", INI::parseAsciiString, nullptr, offsetof( AISideInfo, m_baseDefenseStructure1 ) }, + { "SkillSet1", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet1 ) }, + { "SkillSet2", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet2 ) }, + { "SkillSet3", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet3 ) }, + { "SkillSet4", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet4 ) }, + { "SkillSet5", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet5 ) }, + { nullptr, nullptr, nullptr, 0 } }; AISideInfo *resourceInfo = ((TAiData*)instance)->m_sideInfo; @@ -224,7 +224,7 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* } resourceInfo = resourceInfo->m_next; } - if (resourceInfo==NULL) + if (resourceInfo==nullptr) { resourceInfo = newInstance(AISideInfo); ((TAiData*)instance)->addSideInfo(resourceInfo); @@ -238,8 +238,8 @@ void AI::parseSkillSet(INI *ini, void *instance, void* store, const void* /*user { static const FieldParse myFieldParse[] = { - { "Science", AI::parseScience, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Science", AI::parseScience, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; TSkillSet *skillset = ((TSkillSet*)store); @@ -258,7 +258,7 @@ void AI::parseScience(INI *ini, void *instance, void* /*store*/, const void* /*u return; } skillset->m_skills[skillset->m_numSkills] = SCIENCE_INVALID; - INI::parseScience(ini, instance, skillset->m_skills+skillset->m_numSkills, NULL); + INI::parseScience(ini, instance, skillset->m_skills+skillset->m_numSkills, nullptr); ScienceType science = skillset->m_skills[skillset->m_numSkills]; if (science != SCIENCE_INVALID) { if (TheScienceStore->getSciencePurchaseCost(science)==0) { @@ -277,8 +277,8 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const static const FieldParse myFieldParse[] = { - { "Structure", BuildListInfo::parseStructure, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Structure", BuildListInfo::parseStructure, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; AISideBuildList *build = newInstance(AISideBuildList)(faction); @@ -290,7 +290,7 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const //-------------------------------------------------------------------------------------------------------- /// The AI system singleton -AI *TheAI = NULL; +AI *TheAI = nullptr; /** @@ -333,7 +333,7 @@ void AI::reset( void ) } else { - m_groupList.pop_front(); // NULL group, just kill from list. Shouldn't really happen, but just in case. + m_groupList.pop_front(); // nullptr group, just kill from list. Shouldn't really happen, but just in case. } } #else @@ -368,7 +368,7 @@ void AI::update( void ) AI::~AI() { delete m_pathfinder; - m_pathfinder = NULL; + m_pathfinder = nullptr; while (m_aiData) { @@ -384,20 +384,20 @@ void AI::newOverride(void) TAiData *cur = m_aiData; m_aiData = NEW TAiData; *m_aiData = *cur; - m_aiData->m_sideInfo = NULL; + m_aiData->m_sideInfo = nullptr; AISideInfo *info = cur->m_sideInfo; while (info) { AISideInfo *newInfo = newInstance(AISideInfo); *newInfo = *info; - newInfo->m_next = NULL; + newInfo->m_next = nullptr; addSideInfo(newInfo); info = info->m_next; } - m_aiData->m_sideBuildLists = NULL; + m_aiData->m_sideBuildLists = nullptr; AISideBuildList *build = cur->m_sideBuildLists; while (build) { AISideBuildList *newbuild = newInstance(AISideBuildList)(build->m_side); - newbuild->m_next = NULL; + newbuild->m_next = nullptr; newbuild->m_buildList = build->m_buildList->duplicate(); m_aiData->addFactionBuildList(newbuild); build = build->m_next; @@ -470,7 +470,7 @@ void AI::destroyGroup( AIGroup *group ) if (i == m_groupList.end()) return; - DEBUG_ASSERTCRASH(group != NULL, ("A NULL group made its way into the AIGroup list.. jkmcd")); + DEBUG_ASSERTCRASH(group != nullptr, ("A null group made its way into the AIGroup list.. jkmcd")); // remove it // DEBUG_LOG(("***AIGROUP %x is being removed from m_groupList.", group )); @@ -491,7 +491,7 @@ AIGroup *AI::findGroup( UnsignedInt id ) if ((*i)->getID() == id) return (*i); - return NULL; + return nullptr; } //-------------------------------------------------------------------------------------------------------- @@ -549,7 +549,7 @@ class PartitionFilterWithinAttackRange : public PartitionFilter { // ignore empty slots. const Weapon* w = m_obj->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; if (w->isWithinAttackRange(m_obj, objOther)) @@ -597,7 +597,7 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie PartitionFilterPossibleToAttack would filter out everything anyway, so just punt here. */ - return NULL; + return nullptr; } // only consider live, on-map enemies. @@ -673,16 +673,16 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie filters[numFilters++] = optionalFilter; } - filters[numFilters] = NULL; + filters[numFilters] = nullptr; - if (info == NULL || info == TheScriptEngine->getDefaultAttackInfo()) + if (info == nullptr || info == TheScriptEngine->getDefaultAttackInfo()) { // No additional attack info, so just return the closest one. Object* o = ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); return o; } - Object *bestEnemy = NULL; + Object *bestEnemy = nullptr; Int effectivePriority=0; Int actualPriority=0; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(me, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR); @@ -766,7 +766,7 @@ Object *AI::findClosestAlly( const Object *me, Real range, UnsignedInt qualifier if (qualifiers & CAN_SEE) filters[numFilters++] = &filterLOS; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); } @@ -782,7 +782,7 @@ Object *AI::findClosestRepulsor( const Object *me, Real range) { if (!getAiData()->m_enableRepulsors) { - return NULL; + return nullptr; } // never target buildings (unless they can attack) @@ -798,7 +798,7 @@ Object *AI::findClosestRepulsor( const Object *me, Real range) filters[numFilters++] = &filter; filters[numFilters++] = &filterStealth; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); } @@ -838,7 +838,7 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons } } - if (object->getContainedBy() != NULL) + if (object->getContainedBy() != nullptr) { originalRange = object->getLargestWeaponRange(); } @@ -900,8 +900,8 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons //------------------------------------------------------------------------------------------------- TAiData::TAiData() : -m_next(NULL), -m_sideInfo(NULL), +m_next(nullptr), +m_sideInfo(nullptr), m_attackIgnoreInsignificantBuildings(false), m_skirmishGroupFudgeValue(0.0f), m_structureSeconds(0), @@ -938,7 +938,7 @@ m_vehiclePathfindDiameter(6), m_supplyCenterSafeRadius(250), m_rebuildDelaySeconds(10), m_distanceRequiresGroup(0.0f), -m_sideBuildLists(NULL), +m_sideBuildLists(nullptr), m_structuresPoorMod(0.0f), m_teamWealthyMod(0.0f), m_aiDozerBoredRadiusModifier(2.0), diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index 43590777358..0780246f59e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -45,8 +45,8 @@ AIDockMachine::AIDockMachine( Object *obj ) : StateMachine( obj, "AIDockMachine" { static const StateConditionInfo waitForClearanceConditions[] = { - StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -72,13 +72,13 @@ void AIDockMachine::halt() Object *goalObject = getGoalObject(); // sanity - if( goalObject != NULL ) + if( goalObject != nullptr ) { // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // We need to say goodbye, or we will leave our spot taken forever. - if( dock != NULL ) + if( dock != nullptr ) dock->cancelDock( getOwner() ); } @@ -122,13 +122,13 @@ void AIDockMachine::loadPostProcess( void ) Object *goalObject = thisState->getMachineGoalObject(); AIDockMachine *myMachine = (AIDockMachine *)thisState->getMachine(); - if( goalObject == NULL ) + if( goalObject == nullptr ) return FALSE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if( dock == NULL ) + if( dock == nullptr ) return FALSE; // if the dock says we can advance, then sidetrack to the scoot forward state @@ -169,14 +169,14 @@ StateReturnType AIDockApproachState::onEnter( void ) Object *goalObject = getMachineGoalObject(); // sanity - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -196,7 +196,7 @@ StateReturnType AIDockApproachState::onEnter( void ) AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } // this behavior is an extention of basic MoveTo return AIInternalMoveToState::onEnter(); @@ -208,7 +208,7 @@ StateReturnType AIDockApproachState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -220,7 +220,7 @@ void AIDockApproachState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -259,13 +259,13 @@ StateReturnType AIDockWaitForClearanceState::update( void ) { Object *goalObject = getMachineGoalObject(); - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -291,7 +291,7 @@ void AIDockWaitForClearanceState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -325,14 +325,14 @@ StateReturnType AIDockAdvancePositionState::onEnter( void ) Object *goalObject = getMachineGoalObject(); // sanity - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -352,7 +352,7 @@ StateReturnType AIDockAdvancePositionState::onEnter( void ) AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } // this behavior is an extention of basic MoveTo return AIInternalMoveToState::onEnter(); @@ -364,7 +364,7 @@ StateReturnType AIDockAdvancePositionState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -376,7 +376,7 @@ void AIDockAdvancePositionState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -406,12 +406,12 @@ StateReturnType AIDockMoveToEntryState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -440,7 +440,7 @@ StateReturnType AIDockMoveToEntryState::onEnter( void ) StateReturnType AIDockMoveToEntryState::update( void ) { // if we have nothing to dock with, fail - if (getMachineGoalObject() == NULL) + if (getMachineGoalObject() == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -452,7 +452,7 @@ void AIDockMoveToEntryState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -486,12 +486,12 @@ StateReturnType AIDockMoveToDockState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -524,7 +524,7 @@ StateReturnType AIDockMoveToDockState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); @@ -540,7 +540,7 @@ void AIDockMoveToDockState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -592,12 +592,12 @@ StateReturnType AIDockProcessDockState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; setNextDockActionFrame(); @@ -614,12 +614,12 @@ StateReturnType AIDockProcessDockState::update( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // Some dockers can have a delay built in @@ -673,7 +673,7 @@ Object* AIDockProcessDockState::findMyDrone() Player *player = self->getControllingPlayer(); DroneInfo dInfo; dInfo.found = FALSE; - dInfo.drone = NULL; + dInfo.drone = nullptr; dInfo.owner = self; //Iterate the objects in search for a drone with a producer ID of me. @@ -709,12 +709,12 @@ StateReturnType AIDockMoveToExitState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // get the exit position @@ -735,7 +735,7 @@ StateReturnType AIDockMoveToExitState::onEnter( void ) StateReturnType AIDockMoveToExitState::update( void ) { // if we have nothing to dock with, fail - if (getMachineGoalObject() == NULL) + if (getMachineGoalObject() == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -747,7 +747,7 @@ void AIDockMoveToExitState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -774,18 +774,18 @@ StateReturnType AIDockMoveToRallyState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // if they don't have anywhere to send us, then we are good if( ! dock->isRallyPointAfterDockType() //Chooses not to - || goalObject->getObjectExitInterface() == NULL //or can't - || goalObject->getObjectExitInterface()->getRallyPoint() == NULL //or can't right now. + || goalObject->getObjectExitInterface() == nullptr //or can't + || goalObject->getObjectExitInterface()->getRallyPoint() == nullptr //or can't right now. ) { return STATE_SUCCESS; // Success in an Enter is like success in an update. We're all fine here diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index aa09e574728..7b668290a3f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -71,7 +71,7 @@ AIGroup::AIGroup( void ) { // DEBUG_LOG(("***AIGROUP %x is being constructed.", this)); - m_groundPath = NULL; + m_groundPath = nullptr; m_speed = 0.0f; m_dirty = false; m_id = TheAI->getNextGroupID(); @@ -112,7 +112,7 @@ AIGroup::~AIGroup() #endif deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; //DEBUG_LOG(( "AIGroup #%d destroyed", m_id )); } @@ -133,7 +133,7 @@ const VecObjectID& AIGroup::getAllIDs( void ) const m_lastRequestedIDList.clear(); for (std::list::const_iterator cit = m_memberList.begin(); cit != m_memberList.end(); ++cit) { - if ((*cit) == NULL) + if ((*cit) == nullptr) continue; m_lastRequestedIDList.push_back((*cit)->getID()); @@ -174,8 +174,8 @@ Bool AIGroup::isMember( Object *obj ) void AIGroup::add( Object *obj ) { // DEBUG_LOG(("***AIGROUP %x is adding Object %x (%s).", this, obj, obj->getTemplate()->getName().str())); - DEBUG_ASSERTCRASH(obj != NULL, ("trying to add null obj to AIGroup")); - if (obj == NULL) + DEBUG_ASSERTCRASH(obj != nullptr, ("trying to add null obj to AIGroup")); + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); @@ -188,7 +188,7 @@ void AIGroup::add( Object *obj ) KindOfMaskType validNonAIKindofs; validNonAIKindofs.set(KINDOF_STRUCTURE); validNonAIKindofs.set(KINDOF_ALWAYS_SELECTABLE); - if( ai == NULL && !obj->isAnyKindOf( validNonAIKindofs ) ) + if( ai == nullptr && !obj->isAnyKindOf( validNonAIKindofs ) ) { return; } @@ -445,7 +445,7 @@ void AIGroup::recompute( void ) getCenter( ¢er ); deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; m_speed = 9999999999.9f; @@ -541,7 +541,7 @@ void AIGroup::computeIndividualDestination( Coord3D *dest, const Coord3D *groupD AIUpdateInterface *ai = obj->getAIUpdateInterface(); if (ai && ai->isDoingGroundMovement()) { if (isFormation) { - TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, NULL); + TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, nullptr); } else { TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, groupDest); } @@ -581,7 +581,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm Int numInfantry = 0; Int numVehicles = 0; - Object *centerVehicle = NULL; + Object *centerVehicle = nullptr; Real distSqrCenterVeh = distSqr*10; for( i = m_memberList.begin(); i != m_memberList.end(); ++i ) { @@ -591,7 +591,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm { continue; // don't bother telling the occupants to move. } - if( obj->getAI()==NULL ) + if( obj->getAI()==nullptr ) { continue; } @@ -618,13 +618,13 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm // find object closest to the center. dx = unitPos.x-center.x; dy = unitPos.y-center.y; - if (centerVehicle==NULL || dx*dx+dy*dygetPosition(); dx = max.x - min.x; @@ -670,7 +670,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm if (!closeEnough) return false; m_groundPath = TheAI->pathfinder()->findGroundPath(¢er, pos, PATH_DIAMETER_IN_CELLS, false); - return m_groundPath!=NULL; + return m_groundPath!=nullptr; } @@ -717,7 +717,7 @@ static void clampToMap(Coord3D *dest, PlayerType pt) Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cmdSource ) { - if (m_groundPath==NULL) return false; + if (m_groundPath==nullptr) return false; Int numColumns = 3; Int halfNumColumns = numColumns/2; @@ -728,7 +728,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm // Get the start & end vectors for the path. Coord3D startPoint = *m_groundPath->getFirstNode()->getPosition(); Real farEnoughSqr = sqr(PATH_DIAMETER_IN_CELLS*PATHFIND_CELL_SIZE_F); - PathNode *startNode = NULL; + PathNode *startNode = nullptr; PathNode *node; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { dx = node->getPosition()->x - startPoint.x; @@ -739,7 +739,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm } } Coord3D endPoint = *m_groundPath->getLastNode()->getPosition(); - PathNode *endNode = NULL; + PathNode *endNode = nullptr; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - endPoint.x; Real dy = node->getPosition()->y - endPoint.y; @@ -747,9 +747,9 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm endNode = node; } } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; return false; } @@ -793,7 +793,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -968,7 +968,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm while (node) { Coord3D dest = *node->getPosition(); PathNode *tmpNode; - PathNode *nextNode=NULL; + PathNode *nextNode=nullptr; for (tmpNode = node->getNextOptimized(); tmpNode; tmpNode=tmpNode->getNextOptimized()) { Real dx = tmpNode->getPosition()->x - dest.x; Real dy = tmpNode->getPosition()->y - dest.y; @@ -977,7 +977,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm break; } } - if (nextNode==NULL) break; + if (nextNode==nullptr) break; Coord2D cornerVectorNormal; cornerVectorNormal.y = nextNode->getPosition()->x - previousNode->getPosition()->x; cornerVectorNormal.x = -(nextNode->getPosition()->y - previousNode->getPosition()->y); @@ -1055,10 +1055,10 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm break; } } - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } return true; } @@ -1073,8 +1073,8 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c if (!getCenter( ¢er )) return; - PathNode *startNode = NULL; - PathNode *endNode = NULL; + PathNode *startNode = nullptr; + PathNode *endNode = nullptr; Coord3D endPoint = *pos; if (m_groundPath) { // Get the start & end vectors for the path. @@ -1100,15 +1100,15 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c PathNode *tmpNode = endNode; while (tmpNode) { if (tmpNode == startNode) { - endNode = NULL; + endNode = nullptr; } tmpNode = tmpNode->getNextOptimized(); } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; - startNode = NULL; - endNode = NULL; + m_groundPath = nullptr; + startNode = nullptr; + endNode = nullptr; } } @@ -1123,7 +1123,7 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c } Object *theUnit = (*i); AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) { continue; } @@ -1154,10 +1154,10 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c dest.x += offset.x; dest.y += offset.y; - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } else { Coord3D dest = endPoint; dest.x += offset.x; @@ -1178,7 +1178,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd { - if (m_groundPath==NULL) return false; + if (m_groundPath==nullptr) return false; Real dx, dy; Coord3D center; @@ -1194,7 +1194,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd // Get the start & end vectors for the path. Coord3D startPoint = *m_groundPath->getFirstNode()->getPosition(); Real farEnoughSqr = sqr(PATH_DIAMETER_IN_CELLS*PATHFIND_CELL_SIZE_F); - PathNode *startNode = NULL; + PathNode *startNode = nullptr; PathNode *node; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - startPoint.x; @@ -1205,7 +1205,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd } } Coord3D endPoint = *m_groundPath->getLastNode()->getPosition(); - PathNode *endNode = NULL; + PathNode *endNode = nullptr; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - endPoint.x; Real dy = node->getPosition()->y - endPoint.y; @@ -1214,11 +1214,11 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd } } if (endNode == m_groundPath->getFirstNode()) { - endNode = NULL; + endNode = nullptr; } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; return false; } @@ -1262,7 +1262,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1443,7 +1443,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd while (node) { Coord3D dest = *node->getPosition(); PathNode *tmpNode; - PathNode *nextNode=NULL; + PathNode *nextNode=nullptr; for (tmpNode = node->getNextOptimized(); tmpNode; tmpNode=tmpNode->getNextOptimized()) { Real dx = tmpNode->getPosition()->x - dest.x; Real dy = tmpNode->getPosition()->y - dest.y; @@ -1452,7 +1452,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd break; } } - if (nextNode==NULL) break; + if (nextNode==nullptr) break; Coord2D cornerVectorNormal; cornerVectorNormal.y = nextNode->getPosition()->x - previousNode->getPosition()->x; cornerVectorNormal.x = -(nextNode->getPosition()->y - previousNode->getPosition()->y); @@ -1533,10 +1533,10 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd break; } } - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } return true; } @@ -1655,7 +1655,7 @@ void AIGroup::groupMoveToPosition( const Coord3D *pos, Bool addWaypoint, Command { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1783,7 +1783,7 @@ void AIGroup::groupScatter( CommandSourceType cmdSource ) { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1881,7 +1881,7 @@ void AIGroup::groupTightenToPosition( const Coord3D *pos, Bool addWaypoint, Comm { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -2208,7 +2208,7 @@ void AIGroup::groupAttackPosition( const Coord3D *pos, Int maxShotsToFire, Comma { if( !pos ) { - //If you specify a NULL position, it means you are attacking your own location. + //If you specify a nullptr position, it means you are attacking your own location. attackPos.set( (*i)->getPosition() ); } @@ -2226,7 +2226,7 @@ void AIGroup::groupAttackPosition( const Coord3D *pos, Int maxShotsToFire, Comma for( ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) { Object* garrisonedMember = *it; - CanAttackResult result = garrisonedMember->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, &attackPos, cmdSource ) ; + CanAttackResult result = garrisonedMember->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, nullptr, &attackPos, cmdSource ) ; if( result == ATTACKRESULT_POSSIBLE || result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { AIUpdateInterface *memberAI = garrisonedMember->getAI(); @@ -3044,7 +3044,7 @@ void AIGroup::queueUpgrade( const UpgradeTemplate *upgrade ) // producer must have a production update ProductionUpdateInterface *pu = thisMember->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) continue; if ( pu->canQueueUpgrade( upgrade ) == CANMAKE_QUEUE_FULL ) @@ -3155,7 +3155,7 @@ Object *AIGroup::getSpecialPowerSourceObject( UnsignedInt specialPowerID ) return object; } } - return NULL; + return nullptr; } // Returns an object that has a command button for the GUI command type. @@ -3186,7 +3186,7 @@ Object *AIGroup::getCommandButtonSourceObject( GUICommandType type ) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index 9ebff0f48d9..1fcf12728f9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -58,7 +58,7 @@ const Real CLOSE_ENOUGH = (25.0f); static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ ) { Object *obj = thisState->getMachineOwner(); - BodyModuleInterface *bmi = obj ? obj->getBodyModule() : NULL; + BodyModuleInterface *bmi = obj ? obj->getBodyModule() : nullptr; if (!(obj && bmi)) { return FALSE; @@ -160,7 +160,7 @@ Bool ExitConditions::shouldExit(const StateMachine* machine) const AIGuardMachine::AIGuardMachine( Object *owner ) : StateMachine(owner, "AIGuardMachine"), m_targetToGuard(INVALID_ID), - m_areaToGuard(NULL), + m_areaToGuard(nullptr), m_nemesisToAttack(INVALID_ID), m_guardMode(GUARDMODE_NORMAL) { @@ -168,8 +168,8 @@ AIGuardMachine::AIGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { - StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -207,7 +207,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) } // Check if team auto targets same victim. - Object *teamVictim = NULL; + Object *teamVictim = nullptr; if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); @@ -254,7 +254,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) filters[count++] = &f4; } - filters[count++] = NULL; + filters[count++] = nullptr; // SimpleObjectIterator* iter = ThePartitionManager->iterateObjectsInRange( // &pos, visionRange, FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR); @@ -361,9 +361,9 @@ StateReturnType AIGuardInnerState::onEnter( void ) Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); Coord3D pos = targetToGuard ? *targetToGuard->getPosition() : *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardInnerState.")); return STATE_SUCCESS; } m_exitConditions.m_center = pos; @@ -387,7 +387,7 @@ StateReturnType AIGuardInnerState::onEnter( void ) //-------------------------------------------------------------------------------------- StateReturnType AIGuardInnerState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; // if the position has moved (IE we're guarding an object), move with it. Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); if (targetToGuard) @@ -406,11 +406,11 @@ void AIGuardInnerState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } @@ -461,9 +461,9 @@ StateReturnType AIGuardOuterState::onEnter( void ) Coord3D pos = targetToGuard ? *targetToGuard->getPosition() : *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardInnerState.")); return STATE_SUCCESS; } Object *obj = getMachineOwner(); @@ -499,7 +499,7 @@ StateReturnType AIGuardOuterState::onEnter( void ) //-------------------------------------------------------------------------------------- StateReturnType AIGuardOuterState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; // if the position has moved (IE we're guarding an object), move with it. Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); @@ -533,7 +533,7 @@ void AIGuardOuterState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -748,7 +748,7 @@ void AIGuardPickUpCrateState::onExit( StateExitType status ) AIGuardAttackAggressorState::AIGuardAttackAggressorState( StateMachine *machine ) : State( machine, "AIGuardAttackAggressorState" ) { - m_attackState = NULL; + m_attackState = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -769,9 +769,9 @@ StateReturnType AIGuardAttackAggressorState::onEnter( void ) } Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardAttackAggressorState.")); return STATE_SUCCESS; } @@ -794,7 +794,7 @@ StateReturnType AIGuardAttackAggressorState::onEnter( void ) //------------------------------------------------------------------------------------------------- StateReturnType AIGuardAttackAggressorState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; // if the position has moved (IE we're guarding an object), move with it. Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); if (targetToGuard) @@ -813,12 +813,12 @@ void AIGuardAttackAggressorState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index f0f4ca98dce..dcd1c7069a0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -101,9 +101,9 @@ constexpr const UnsignedInt CELL_INFOS_TO_ALLOCATE = 30000; //----------------------------------------------------------------------------------- PathNode::PathNode() : - m_nextOpti(0), - m_next(0), - m_prev(0), + m_nextOpti(nullptr), + m_next(nullptr), + m_prev(nullptr), m_nextOptiDist2D(0), m_canOptimize(false), m_id(-1) @@ -149,7 +149,7 @@ PathNode *PathNode::prependToList( PathNode *list ) m_next = list; if (list) list->m_prev = this; - m_prev = NULL; + m_prev = nullptr; return this; } @@ -158,10 +158,10 @@ PathNode *PathNode::prependToList( PathNode *list ) /// @todo optimize this PathNode *PathNode::appendToList( PathNode *list ) { - if (list == NULL) + if (list == nullptr) { - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; return this; } @@ -171,7 +171,7 @@ PathNode *PathNode::appendToList( PathNode *list ) tail->m_next = this; m_prev = tail; - m_next = NULL; + m_next = nullptr; return list; } @@ -197,9 +197,9 @@ const Coord3D *PathNode::computeDirectionVector( void ) { static Coord3D dir; - if (m_next == NULL) + if (m_next == nullptr) { - if (m_prev == NULL) + if (m_prev == nullptr) { // only one node on whole path - no direction dir.x = 0.0f; @@ -225,11 +225,11 @@ const Coord3D *PathNode::computeDirectionVector( void ) //----------------------------------------------------------------------------------- Path::Path(): -m_path(NULL), -m_pathTail(NULL), +m_path(nullptr), +m_pathTail(nullptr), m_isOptimized(FALSE), m_blockedByAlly(FALSE), -m_cpopRecentStart(NULL), +m_cpopRecentStart(nullptr), m_cpopCountdown(MAX_CPOP), m_cpopValid(FALSE) { @@ -315,7 +315,7 @@ void Path::xfer( Xfer *xfer ) node->setPosition(&pos); node->setLayer(layer); node->setCanOptimize(canOpt); - PathNode *optNode = NULL; + PathNode *optNode = nullptr; if (optID > 0) { optNode = m_path; while (optNode && optNode->m_id != optID) { @@ -324,7 +324,7 @@ void Path::xfer( Xfer *xfer ) DEBUG_ASSERTCRASH (optNode && optNode->m_id == optID, ("Could not find optimized link.")); } m_path = node->prependToList(m_path); - if (m_pathTail == NULL) + if (m_pathTail == nullptr) m_pathTail = node; if (optNode) { node->setNextOptimized(optNode); @@ -349,7 +349,7 @@ void Path::xfer( Xfer *xfer ) color.blue = 0; color.red = color.green = 1; Coord3D pos; - addIcon(NULL, 0, 0, color); // erase feedback. + addIcon(nullptr, 0, 0, color); // erase feedback. for( PathNode *node = getFirstNode(); node; node = node->getNext() ) { @@ -389,13 +389,13 @@ void Path::prependNode( const Coord3D *pos, PathfindLayerEnum layer ) m_path = node->prependToList( m_path ); - if (m_pathTail == NULL) + if (m_pathTail == nullptr) m_pathTail = node; m_isOptimized = false; #ifdef CPOP_STARTS_FROM_PREV_SEG - m_cpopRecentStart = NULL; + m_cpopRecentStart = nullptr; #endif } @@ -427,7 +427,7 @@ void Path::appendNode( const Coord3D *pos, PathfindLayerEnum layer ) m_pathTail = node; #ifdef CPOP_STARTS_FROM_PREV_SEG - m_cpopRecentStart = NULL; + m_cpopRecentStart = nullptr; #endif } /** @@ -687,7 +687,7 @@ void Path::optimizeGroundPath( Bool crusher, Int pathDiameter ) } // Remove jig/jogs :) jba. - for (anchor=getFirstNode(); anchor!=NULL; anchor=anchor->getNextOptimized()) { + for (anchor=getFirstNode(); anchor!=nullptr; anchor=anchor->getNextOptimized()) { node = anchor->getNextOptimized(); if (node && node->getNextOptimized()) { Real dx = node->getPosition()->x - anchor->getPosition()->x; @@ -750,7 +750,7 @@ void Path::computePointOnPath( out.posOnPath.zero(); out.distAlongPath = 0; - if (m_path == NULL) + if (m_path == nullptr) { m_cpopValid = false; return; @@ -769,7 +769,7 @@ void Path::computePointOnPath( // default pathPos to end of the path out.posOnPath = *getLastNode()->getPosition(); - const PathNode* closeNode = NULL; + const PathNode* closeNode = nullptr; Coord2D toPos; Real closeDistSqr = 99999999.9f; Real totalPathLength = 0.0f; @@ -780,7 +780,7 @@ void Path::computePointOnPath( // #ifdef CPOP_STARTS_FROM_PREV_SEG const PathNode* prevNode = m_cpopRecentStart; - if (prevNode == NULL) + if (prevNode == nullptr) prevNode = m_path; #else const PathNode* prevNode = m_path; @@ -790,7 +790,7 @@ void Path::computePointOnPath( // note that the seg dir and len returned by this is the dist & vec from 'prevNode' to 'node' for ( const PathNode* node = prevNode->getNextOptimized(&segmentDirNorm, &segmentLength); - node != NULL; + node != nullptr; node = node->getNextOptimized(&segmentDirNorm, &segmentLength) ) { const Coord3D* prevNodePos = prevNode->getPosition(); @@ -813,7 +813,7 @@ void Path::computePointOnPath( else if (alongPathDist > segmentLength) { // projected point is beyond end of segment, use end point - if (node->getNextOptimized() == NULL) + if (node->getNextOptimized() == nullptr) { alongPathDist = segmentLength; pointOnPath = *nodePos; @@ -1029,7 +1029,7 @@ void Path::computePointOnPath( */ Real Path::computeFlightDistToGoal( const Coord3D *pos, Coord3D& goalPos ) { - if (m_path == NULL) + if (m_path == nullptr) { goalPos.x = 0.0f; goalPos.y = 0.0f; @@ -1084,8 +1084,8 @@ Real Path::computeFlightDistToGoal( const Coord3D *pos, Coord3D& goalPos ) } //----------------------------------------------------------------------------------- -PathfindCellInfo *PathfindCellInfo::s_infoArray = NULL; -PathfindCellInfo *PathfindCellInfo::s_firstFree = NULL; +PathfindCellInfo *PathfindCellInfo::s_infoArray = nullptr; +PathfindCellInfo *PathfindCellInfo::s_firstFree = nullptr; #if RETAIL_COMPATIBLE_PATHFINDING // TheSuperHackers @info This variable is here so the code will run down the retail compatible path till a failure mode is hit @@ -1096,8 +1096,8 @@ Bool s_forceCleanCells = false; void PathfindCellInfo::forceCleanPathFindCellInfos() { for (Int i = 0; i < CELL_INFOS_TO_ALLOCATE - 1; i++) { - s_infoArray[i].m_nextOpen = NULL; - s_infoArray[i].m_prevOpen = NULL; + s_infoArray[i].m_nextOpen = nullptr; + s_infoArray[i].m_prevOpen = nullptr; s_infoArray[i].m_open = FALSE; s_infoArray[i].m_closed = FALSE; } @@ -1106,8 +1106,8 @@ void PathfindCellInfo::forceCleanPathFindCellInfos() void Pathfinder::forceCleanCells() { PathfindCellInfo::forceCleanPathFindCellInfos(); - m_openList = NULL; - m_closedList = NULL; + m_openList = nullptr; + m_closedList = nullptr; for (int j = 0; j <= m_extent.hi.y; ++j) { for (int i = 0; i <= m_extent.hi.x; ++i) { @@ -1126,7 +1126,7 @@ void PathfindCellInfo::allocateCellInfos(void) { releaseCellInfos(); s_infoArray = MSGNEW("PathfindCellInfo") PathfindCellInfo[CELL_INFOS_TO_ALLOCATE]; // pool[]ify - s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_pathParent = NULL; + s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_pathParent = nullptr; s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_isFree = true; s_firstFree = s_infoArray; for (Int i=0; im_cell = cell; info->m_pos = pos; - info->m_nextOpen = NULL; - info->m_prevOpen = NULL; - info->m_pathParent = NULL; + info->m_nextOpen = nullptr; + info->m_prevOpen = nullptr; + info->m_pathParent = nullptr; info->m_costSoFar = 0; info->m_totalCost = 0; info->m_open = 0; @@ -1204,7 +1204,7 @@ void PathfindCellInfo::releaseACellInfo(PathfindCellInfo *theInfo) /** * Constructor */ -PathfindCell::PathfindCell( void ) :m_info(NULL) +PathfindCell::PathfindCell( void ) :m_info(nullptr) { reset(); } @@ -1215,7 +1215,7 @@ PathfindCell::PathfindCell( void ) :m_info(NULL) PathfindCell::~PathfindCell( void ) { if (m_info) PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; static Bool warn = true; if (warn) { warn = false; @@ -1236,7 +1236,7 @@ void PathfindCell::reset( ) if (m_info) { m_info->m_obstacleID = INVALID_ID; PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; } m_connectsToLayer = LAYER_INVALID; m_layer = LAYER_GROUND; @@ -1249,9 +1249,9 @@ void PathfindCell::reset( ) Bool PathfindCell::startPathfind( PathfindCell *goalCell ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; - m_info->m_pathParent = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; + m_info->m_pathParent = nullptr; m_info->m_costSoFar = 0; // start node, no cost to get here m_info->m_totalCost = 0; if (goalCell) { @@ -1297,7 +1297,7 @@ void PathfindCell::setParentCellHierarchical( PathfindCell* parent ) void PathfindCell::clearParentCell( void ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); - m_info->m_pathParent = NULL; + m_info->m_pathParent = nullptr; } @@ -1308,7 +1308,7 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) { if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); - return (m_info != NULL); + return (m_info != nullptr); } return true; } @@ -1326,7 +1326,7 @@ void PathfindCell::releaseInfo(void) #endif { if (m_info) { - m_info->m_pathParent = NULL; + m_info->m_pathParent = nullptr; } } @@ -1338,8 +1338,8 @@ void PathfindCell::releaseInfo(void) return; } - DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_prevOpen==nullptr && m_info->m_nextOpen==nullptr, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_open==0 && m_info->m_closed==0, ("Shouldn't be linked.")); DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { @@ -1348,7 +1348,7 @@ void PathfindCell::releaseInfo(void) } PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; } @@ -1542,16 +1542,16 @@ PathfindCell *PathfindCell::putOnSortedOpenList( PathfindCell *list ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); DEBUG_ASSERTCRASH(m_info->m_closed==FALSE && m_info->m_open==FALSE, ("Serious error - Invalid flags. jba")); - if (list == NULL) + if (list == nullptr) { list = this; - m_info->m_prevOpen = NULL; - m_info->m_nextOpen = NULL; + m_info->m_prevOpen = nullptr; + m_info->m_nextOpen = nullptr; } else { // insertion sort - PathfindCell *c, *lastCell = NULL; + PathfindCell *c, *lastCell = nullptr; #if RETAIL_COMPATIBLE_PATHFINDING // TheSuperHackers @bugfix In the retail compatible pathfinding, on rare ocassions, we get stuck in an infinite loop // External code should pickup on the bad behaviour and cleanup properly, but we need to explicitly break out here @@ -1589,7 +1589,7 @@ PathfindCell *PathfindCell::putOnSortedOpenList( PathfindCell *list ) // append after "lastCell" - end of list lastCell->m_info->m_nextOpen = this->m_info; m_info->m_prevOpen = lastCell->m_info; - m_info->m_nextOpen = NULL; + m_info->m_nextOpen = nullptr; } } @@ -1614,8 +1614,8 @@ PathfindCell *PathfindCell::removeFromOpenList( PathfindCell *list ) list = getNextOpen(); m_info->m_open = false; - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; return list; } @@ -1645,11 +1645,11 @@ Int PathfindCell::releaseOpenList( PathfindCell *list ) if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; } else { - list = NULL; + list = nullptr; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); - curInfo->m_nextOpen = NULL; - curInfo->m_prevOpen = NULL; + curInfo->m_nextOpen = nullptr; + curInfo->m_prevOpen = nullptr; curInfo->m_open = FALSE; cur->releaseInfo(); } @@ -1680,11 +1680,11 @@ Int PathfindCell::releaseClosedList( PathfindCell *list ) if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; } else { - list = NULL; + list = nullptr; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); - curInfo->m_nextOpen = NULL; - curInfo->m_prevOpen = NULL; + curInfo->m_nextOpen = nullptr; + curInfo->m_prevOpen = nullptr; curInfo->m_closed = FALSE; cur->releaseInfo(); } @@ -1702,8 +1702,8 @@ PathfindCell *PathfindCell::putOnClosedList( PathfindCell *list ) m_info->m_closed = FALSE; m_info->m_closed = TRUE; - m_info->m_prevOpen = NULL; - m_info->m_nextOpen = list?list->m_info:NULL; + m_info->m_prevOpen = nullptr; + m_info->m_nextOpen = list?list->m_info:nullptr; if (list) list->m_info->m_prevOpen = this->m_info; @@ -1727,8 +1727,8 @@ PathfindCell *PathfindCell::removeFromClosedList( PathfindCell *list ) list = getNextOpen(); m_info->m_closed = false; - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; return list; } @@ -1775,7 +1775,7 @@ UnsignedInt PathfindCell::costSoFar( PathfindCell *parent ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); // very first node in path - no turns, no cost - if (parent == NULL) + if (parent == nullptr) return 0; // add in number of turns in path so far @@ -2018,10 +2018,10 @@ inline void applyBlockZone(PathfindCell &targetCell, const PathfindCell &sourceC //------------------------ ZoneBlock ------------------------------- ZoneBlock::ZoneBlock() : m_firstZone(0), m_numZones(0), -m_groundCliffZones(NULL), -m_groundWaterZones(NULL), -m_groundRubbleZones(NULL), -m_crusherZones(NULL), +m_groundCliffZones(nullptr), +m_groundWaterZones(nullptr), +m_groundRubbleZones(nullptr), +m_crusherZones(nullptr), m_zonesAllocated(0), m_interactsWithBridge(FALSE) { @@ -2039,16 +2039,16 @@ ZoneBlock::~ZoneBlock() void ZoneBlock::freeZones(void) { delete [] m_groundCliffZones; - m_groundCliffZones = NULL; + m_groundCliffZones = nullptr; delete [] m_groundWaterZones; - m_groundWaterZones = NULL; + m_groundWaterZones = nullptr; delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; + m_groundRubbleZones = nullptr; delete [] m_crusherZones; - m_crusherZones = NULL; + m_crusherZones = nullptr; } /* Allocate zone equivalency arrays large enough to hold required entries. If the arrays are already @@ -2186,7 +2186,7 @@ zoneStorageType ZoneBlock::getEffectiveZone( LocomotorSurfaceTypeMask acceptable large enough, just return. */ void ZoneBlock::allocateZones(void) { - if (m_zonesAllocated>m_numZones && m_groundCliffZones!=NULL) { + if (m_zonesAllocated>m_numZones && m_groundCliffZones!=nullptr) { return; } freeZones(); @@ -2212,14 +2212,14 @@ void ZoneBlock::allocateZones(void) //------------------------ PathfindZoneManager ------------------------------- PathfindZoneManager::PathfindZoneManager() : m_maxZone(0), m_needToCalculateZones(false), -m_groundCliffZones(NULL), -m_groundWaterZones(NULL), -m_groundRubbleZones(NULL), -m_terrainZones(NULL), -m_crusherZones(NULL), -m_hierarchicalZones(NULL), -m_blockOfZoneBlocks(NULL), -m_zoneBlocks(NULL), +m_groundCliffZones(nullptr), +m_groundWaterZones(nullptr), +m_groundRubbleZones(nullptr), +m_terrainZones(nullptr), +m_crusherZones(nullptr), +m_hierarchicalZones(nullptr), +m_blockOfZoneBlocks(nullptr), +m_zoneBlocks(nullptr), m_zonesAllocated(0) { m_zoneBlockExtent.x = 0; @@ -2235,22 +2235,22 @@ PathfindZoneManager::~PathfindZoneManager() void PathfindZoneManager::freeZones() { delete [] m_groundCliffZones; - m_groundCliffZones = NULL; + m_groundCliffZones = nullptr; delete [] m_groundWaterZones; - m_groundWaterZones = NULL; + m_groundWaterZones = nullptr; delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; + m_groundRubbleZones = nullptr; delete [] m_terrainZones; - m_terrainZones = NULL; + m_terrainZones = nullptr; delete [] m_crusherZones; - m_crusherZones = NULL; + m_crusherZones = nullptr; delete [] m_hierarchicalZones; - m_hierarchicalZones = NULL; + m_hierarchicalZones = nullptr; m_zonesAllocated = 0; } @@ -2258,10 +2258,10 @@ void PathfindZoneManager::freeZones() void PathfindZoneManager::freeBlocks() { delete [] m_blockOfZoneBlocks; - m_blockOfZoneBlocks = NULL; + m_blockOfZoneBlocks = nullptr; delete [] m_zoneBlocks; - m_zoneBlocks = NULL; + m_zoneBlocks = nullptr; m_zoneBlockExtent.x = 0; m_zoneBlockExtent.y = 0; @@ -2271,7 +2271,7 @@ void PathfindZoneManager::freeBlocks() large enough, just return. */ void PathfindZoneManager::allocateZones(void) { - if (m_zonesAllocated>m_maxZone && m_groundCliffZones!=NULL) { + if (m_zonesAllocated>m_maxZone && m_groundCliffZones!=nullptr) { return; } freeZones(); @@ -2587,7 +2587,7 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye extern void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color); RGBColor color; memset(&color, 0, sizeof(Color)); - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); for( j=0; j0) return false; - if (m_bridge==NULL) return true; + if (m_bridge==nullptr) return true; return false; } @@ -2974,7 +2974,7 @@ void PathfindLayer::doDebugIcons(void) { */ Bool PathfindLayer::init(Bridge *theBridge, PathfindLayerEnum layer) { - if (m_bridge!=NULL) return false; + if (m_bridge!=nullptr) return false; m_bridge = theBridge; m_layer = layer; m_destroyed = false; @@ -2986,7 +2986,7 @@ Bool PathfindLayer::init(Bridge *theBridge, PathfindLayerEnum layer) */ void PathfindLayer::allocateCells(const IRegion2D *extent) { - if (m_bridge == NULL) return; + if (m_bridge == nullptr) return; Region2D bridgeBounds = *m_bridge->getBounds(); Int maxX, maxY; m_xOrigin = REAL_TO_INT_FLOOR((bridgeBounds.lo.x-PATHFIND_CELL_SIZE/100)/PATHFIND_CELL_SIZE); @@ -3034,7 +3034,7 @@ void PathfindLayer::allocateCellsForWallLayer(const IRegion2D *extent, ObjectID for (i=0; ifindObjectByID(wallPieces[i]); Region2D objBounds; - if (obj==NULL) continue; + if (obj==nullptr) continue; obj->getGeometryInfo().get2DBounds(*obj->getPosition(), obj->getOrientation(), objBounds); if (first) { bridgeBounds = objBounds; @@ -3167,7 +3167,7 @@ void PathfindLayer::classifyWallCells(ObjectID *wallPieces, Int numPieces) { DEBUG_ASSERTCRASH(m_layer==LAYER_WALL, ("Wrong layer for wall.")); if (m_layer != LAYER_WALL) return; - if (m_layerCells == NULL) return; + if (m_layerCells == nullptr) return; Int i, j; for (i=0; i=m_width) return NULL; - if (y<0 || y>=m_height) return NULL; + if (x<0 || x>=m_width) return nullptr; + if (y<0 || y>=m_height) return nullptr; PathfindCell *cell = &m_layerCells[x][y]; if (cell->getType() == PathfindCell::CELL_IMPASSABLE) { - return NULL; // Impassable cells are ignored. + return nullptr; // Impassable cells are ignored. } return cell; } @@ -3351,7 +3351,7 @@ void PathfindLayer::classifyLayerMapCell( Int i, Int j , PathfindCell *cell, Bri if (!(cell->getConnectLayer()==LAYER_GROUND) ) { // Check for bridge clearance. If the ground isn't 1 pathfind cells below, mark impassable. Real groundHeight = TheTerrainLogic->getLayerHeight( center.x, center.y, LAYER_GROUND ); - Real bridgeHeight = theBridge->getBridgeHeight( ¢er, NULL ); + Real bridgeHeight = theBridge->getBridgeHeight( ¢er, nullptr ); if (groundHeight+LAYER_Z_CLOSE_ENOUGH_F > bridgeHeight) { PathfindCell *groundCell = TheAI->pathfinder()->getCell(LAYER_GROUND,i, j); if (!(groundCell->getType()==PathfindCell::CELL_OBSTACLE)) { @@ -3369,7 +3369,7 @@ Bool PathfindLayer::isPointOnWall(ObjectID *wallPieces, Int numPieces, const Coo Int i; for (i=0; ifindObjectByID(wallPieces[i]); - if (obj==NULL) continue; + if (obj==nullptr) continue; Real major = obj->getGeometryInfo().getMajorRadius(); Real minor = (obj->getGeometryInfo().getGeomType() == GEOMETRY_SPHERE) ? obj->getGeometryInfo().getMajorRadius() : obj->getGeometryInfo().getMinorRadius(); @@ -3440,9 +3440,9 @@ void PathfindLayer::classifyWallMapCell( Int i, Int j , PathfindCell *cell, Obje //----------------------- Pathfinder --------------------------------------- -Pathfinder::Pathfinder( void ) :m_map(NULL) +Pathfinder::Pathfinder( void ) :m_map(nullptr) { - debugPath = NULL; + debugPath = nullptr; PathfindCellInfo::allocateCellInfos(); reset(); } @@ -3458,10 +3458,10 @@ void Pathfinder::reset( void ) DEBUG_LOG(("Pathfind cell is %d bytes, PathfindCellInfo is %d bytes", sizeof(PathfindCell), sizeof(PathfindCellInfo))); delete [] m_blockOfMapCells; - m_blockOfMapCells = NULL; + m_blockOfMapCells = nullptr; delete [] m_map; - m_map = NULL; + m_map = nullptr; Int i; for (i=0; i<=LAYER_LAST; i++) { @@ -3471,8 +3471,8 @@ void Pathfinder::reset( void ) // reset the pathfind grid m_extent.lo.x=m_extent.lo.y=m_extent.hi.x=m_extent.hi.y=0; m_logicalExtent.lo.x=m_logicalExtent.lo.y=m_logicalExtent.hi.x=m_logicalExtent.hi.y=0; - m_openList = NULL; - m_closedList = NULL; + m_openList = nullptr; + m_closedList = nullptr; m_ignoreObstacleID = INVALID_ID; m_isTunneling = false; @@ -3488,7 +3488,7 @@ void Pathfinder::reset( void ) debugPathPos.z = 0.0f; deleteInstance(debugPath); - debugPath = NULL; + debugPath = nullptr; m_frameToShowObstacles = 0; @@ -3537,7 +3537,7 @@ void Pathfinder::removeWallPiece(Object *wallPiece) { // sanity - if( wallPiece == NULL ) + if( wallPiece == nullptr ) return; // find entry @@ -4020,7 +4020,7 @@ void Pathfinder::newMap( void ) bounds.hi.y--; Bool dataAllocated = false; if (m_extent.hi.x==bounds.hi.x && m_extent.hi.y==bounds.hi.y) { - if (m_blockOfMapCells != NULL && m_map!=NULL) { + if (m_blockOfMapCells != nullptr && m_map!=nullptr) { dataAllocated = true; } } @@ -4028,7 +4028,7 @@ void Pathfinder::newMap( void ) // so the second time through, dataAllocated==TRUE, so we skip the allocate. if (!dataAllocated) { m_extent = bounds; - DEBUG_ASSERTCRASH(m_map == NULL, ("Can't reallocate pathfind cells.")); + DEBUG_ASSERTCRASH(m_map == nullptr, ("Can't reallocate pathfind cells.")); m_zoneManager.allocateBlocks(m_extent); // Allocate cells. m_blockOfMapCells = MSGNEW("PathfindMapCells") PathfindCell[(bounds.hi.x+1)*(bounds.hi.y+1)]; @@ -4043,7 +4043,7 @@ void Pathfinder::newMap( void ) } } if (m_numWallPieces>0) { - m_layers[LAYER_WALL].init(NULL, LAYER_WALL); + m_layers[LAYER_WALL].init(nullptr, LAYER_WALL); m_layers[LAYER_WALL].allocateCellsForWallLayer(&m_extent, m_wallPieces, m_numWallPieces); } } @@ -4163,7 +4163,7 @@ void Pathfinder::debugShowSearch( Bool pathFound ) RGBColor color; color.red = color.blue = color.green = 1; if (!pathFound) { - addIcon(NULL, 0, 0, color); // erase. + addIcon(nullptr, 0, 0, color); // erase. } for( s = m_openList; s; s=s->getNextOpen() ) @@ -4246,10 +4246,10 @@ Bool Pathfinder::validMovementTerrain( PathfindLayerEnum layer, const Locomotor* Int x = REAL_TO_INT_FLOOR(pos->x/PATHFIND_CELL_SIZE); Int y = REAL_TO_INT_FLOOR(pos->y/PATHFIND_CELL_SIZE); - PathfindCell *toCell = NULL; + PathfindCell *toCell = nullptr; toCell = getCell( layer, x, y ); - if (toCell == NULL) + if (toCell == nullptr) return false; // Only do terrain, not obstacle cells. jba. if (toCell->getType()==PathfindCell::CELL_OBSTACLE) return true; @@ -4271,7 +4271,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { Int count = 0; if (m_openList) { count += PathfindCell::releaseOpenList(m_openList); - m_openList = NULL; + m_openList = nullptr; } #if RETAIL_COMPATIBLE_PATHFINDING @@ -4286,7 +4286,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { if (m_closedList) { count += PathfindCell::releaseClosedList(m_closedList); - m_closedList = NULL; + m_closedList = nullptr; } #if RETAIL_COMPATIBLE_PATHFINDING @@ -4308,7 +4308,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell ) { - if (toCell == NULL) + if (toCell == nullptr) return false; // check if the destination cell is classified as an obstacle, @@ -4335,7 +4335,7 @@ Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask */ Bool Pathfinder::checkDestination(const Object *obj, Int cellX, Int cellY, PathfindLayerEnum layer, Int iRadius, Bool centerInCell) { - // If obj==NULL, means we are checking for any ground units present. jba. + // If obj==nullptr, means we are checking for any ground units present. jba. Int numCellsAbove = iRadius; if (centerInCell) numCellsAbove++; Bool checkForAircraft = false; @@ -4463,7 +4463,7 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) } Bool check = false; - Object *unit = NULL; + Object *unit = nullptr; if (flags == PathfindCell::UNIT_PRESENT_MOVING || flags == PathfindCell::UNIT_GOAL_OTHER_MOVING) { unit = TheGameLogic->findObjectByID(posUnit); // order matters: we want to know if I consider it to be an ally, not vice versa @@ -4478,7 +4478,7 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) check = true; unit = TheGameLogic->findObjectByID(posUnit); } - if (check && unit!=NULL) { + if (check && unit!=nullptr) { if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { // Don't check if it's the ignored obstacle. check = false; @@ -4636,7 +4636,7 @@ Bool Pathfinder::checkForAdjust(Object *obj, const LocomotorSet& locomotorSet, B { Coord3D adjustDest; PathfindCell *cellP = getCell(layer, cellX, cellY); - if (cellP==NULL) return false; + if (cellP==nullptr) return false; if (cellP && cellP->getType() == PathfindCell::CELL_CLIFF) { return false; // no final destinations on cliffs. } @@ -4686,7 +4686,7 @@ Bool Pathfinder::checkForLanding(Int cellX, Int cellY, PathfindLayerEnum layer, { Coord3D adjustDest; PathfindCell *cellP = getCell(layer, cellX, cellY); - if (cellP==NULL) return false; + if (cellP==nullptr) return false; switch (cellP->getType()) { case PathfindCell::CELL_CLIFF: @@ -4694,7 +4694,7 @@ Bool Pathfinder::checkForLanding(Int cellX, Int cellY, PathfindLayerEnum layer, case PathfindCell::CELL_IMPASSABLE: return false; // no final destinations on cliffs, water, etc. } - if (checkDestination(NULL, cellX, cellY, layer, iRadius, center)) { + if (checkDestination(nullptr, cellX, cellY, layer, iRadius, center)) { adjustCoordToCell(cellX, cellY, center, adjustDest, cellP->getLayer()); *dest = adjustDest; return true; @@ -4851,7 +4851,7 @@ Bool Pathfinder::adjustDestination(Object *obj, const LocomotorSet& locomotorSet } if (groupDest) { // Didn't work, so just do simple adjust. - return(adjustDestination(obj, locomotorSet, dest, NULL)); + return(adjustDestination(obj, locomotorSet, dest, nullptr)); } return false; } @@ -4990,7 +4990,7 @@ Bool Pathfinder::adjustToPossibleDestination(Object *obj, const LocomotorSet& lo layer = obj->getLayer(); } PathfindCell *parentCell = getClippedCell( layer, &from ); - if (parentCell == NULL) { + if (parentCell == nullptr) { return false; } @@ -5121,7 +5121,7 @@ void Pathfinder::doDebugIcons(void) { RGBColor color; color.red = color.green = color.blue = 0; - addIcon(NULL, 0, 0, color); // clear. + addIcon(nullptr, 0, 0, color); // clear. Coord3D topLeftCorner; Bool showCells = TheGlobalData->m_debugAI==AI_DEBUG_CELLS; Int i; @@ -5748,7 +5748,7 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const const Coord3D *rawTo) { if (!quickDoesPathExist(locomotorSet, from, rawTo)) { - return NULL; + return nullptr; } Bool isHuman = true; if (obj && obj->getControllingPlayer() && (obj->getControllingPlayer()->getPlayerType()==PLAYER_COMPUTER)) { @@ -5764,11 +5764,11 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const } Path *pat = internalFindPath(obj, locomotorSet, from, rawTo); - if (pat!=NULL) { + if (pat!=nullptr) { return pat; } - return NULL; + return nullptr; } /** * Find a short, valid path between given locations. @@ -5798,11 +5798,11 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -5820,15 +5820,15 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, to ); - if (goalCell == NULL) { - return NULL; + if (goalCell == nullptr) { + return nullptr; } ICoord2D cell; worldToCell( to, &cell ); if (!checkDestination(obj, cell.x, cell.y, destinationLayer, radius, centerInCell)) { - return NULL; + return nullptr; } // determine start cell ICoord2D startCellNdx; @@ -5838,20 +5838,20 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe layer = obj->getLayer(); } PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { - return NULL; + if (parentCell == nullptr) { + return nullptr; } ICoord2D pos2d; worldToCell(to, &pos2d); if (!goalCell->allocateInfo(pos2d)) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); if (!parentCell->allocateInfo(pos2d)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } // @@ -5875,7 +5875,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe goalCell->releaseInfo(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } if (goalCell->isObstaclePresent(m_ignoreObstacleID) || m_isTunneling) { @@ -5892,7 +5892,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe //DEBUG_LOG(("Intense Debug Info - Pathfind Zone screen failed-cannot reach desired location.")); goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } // sanity check - if destination is invalid, can't path there @@ -5900,7 +5900,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_isTunneling = false; goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } // sanity check - if source is invalid, we have to cheat @@ -5915,7 +5915,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int cellCount = 0; @@ -5923,7 +5923,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -5990,7 +5990,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -6054,7 +6054,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** @@ -6128,7 +6128,7 @@ Int Pathfinder::clearCellForDiameter(Bool crusher, Int cellX, Int cellY, Pathfin */ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Int pathDiameter ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -6177,7 +6177,7 @@ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, Pathfi */ Path *Pathfinder::buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -6234,7 +6234,7 @@ struct MADStruct return 0; // It's the one we are ignoring. } Object *otherObj = TheGameLogic->findObjectByID(to->getPosUnit()); - if (otherObj==NULL) return 0; + if (otherObj==nullptr) return 0; if (d->obj->getRelationship(otherObj)!=ALLIES) { return 0; // Only move allies. } @@ -6340,11 +6340,11 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -6385,37 +6385,37 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, cell = newCell; } if (offset >= MAX_OFFSET) { - return NULL; + return nullptr; } } // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); - if (goalCell == NULL) { - return NULL; + if (goalCell == nullptr) { + return nullptr; } if (!goalCell->allocateInfo(cell)) { - return NULL; + return nullptr; } // determine start cell ICoord2D startCellNdx; PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { + if (parentCell == nullptr) { #if RETAIL_COMPATIBLE_PATHFINDING if (s_useFixedPathfinding) #endif { goalCell->releaseInfo(); } - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } @@ -6430,7 +6430,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if ( zone1 != zone2) { goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } parentCell->startPathfind(goalCell); @@ -6438,7 +6438,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // TheSuperHackers @fix helmutbuhler This was originally uninitialized and in the loop below. #if RETAIL_COMPATIBLE_CRC @@ -6450,7 +6450,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, // until goal is found. // Int cellCount = 0; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -6536,7 +6536,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; if ((newCell->getLayer()==LAYER_GROUND) && !m_zoneManager.isPassable(newCellCoord.x, newCellCoord.y)) { @@ -6643,7 +6643,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -6690,7 +6690,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** @@ -6816,11 +6816,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -6838,11 +6838,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); if (!goalCell) { - return NULL; + return nullptr; } if (!goalCell->allocateInfo(cell)) { - return NULL; + return nullptr; } // determine start cell @@ -6850,14 +6850,14 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); if (!parentCell) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } @@ -6869,13 +6869,13 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if ( zone1 != zone2) { goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } parentCell->startPathfind(goalCell); // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int cellCount = 0; @@ -6923,7 +6923,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } startCell->setParentCellHierarchical(parentCell); cellCount++; @@ -6950,7 +6950,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } curCost = cell->costToHierGoal(parentCell); remCost = cell->costToHierGoal(goalCell); @@ -6962,14 +6962,14 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu } } - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistSqr = sqr(HUGE_DIST); // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -7053,7 +7053,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } startCell->setParentCellHierarchical(parentCell); if (!startCell->getClosed() && !startCell->getOpen()) { @@ -7074,7 +7074,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } cell->setParentCellHierarchical(startCell); @@ -7318,7 +7318,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -7366,7 +7366,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu goalCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -7478,17 +7478,17 @@ Bool Pathfinder::slowDoesPathExist( Object *obj, ObjectID ignoreObject) { AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) { + if (ai==nullptr) { return false; } const LocomotorSet &locoSet = ai->getLocomotorSet(); m_ignoreObstacleID = ignoreObject; Path *path = findPath(obj, locoSet, from, to); m_ignoreObstacleID = INVALID_ID; - Bool found = (path!=NULL); + Bool found = (path!=nullptr); deleteInstance(path); - path = NULL; + path = nullptr; return found; } @@ -7518,7 +7518,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum layer, const Coord3D *groupDest) { //CRCDEBUG_LOG(("Pathfinder::pathDestination()")); - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return false; if (!obj) return false; @@ -7526,7 +7526,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet Coord3D adjustTo = *groupDest; Coord3D *to = &adjustTo; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -7534,13 +7534,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum desiredLayer = TheTerrainLogic->getLayerForDestination(dest); // determine desired PathfindCell *desiredCell = getClippedCell( desiredLayer, dest ); - if (desiredCell == NULL) + if (desiredCell == nullptr) return FALSE; PathfindLayerEnum goalLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( goalLayer, to ); - if (goalCell == NULL) + if (goalCell == nullptr) return FALSE; @@ -7556,7 +7556,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet ICoord2D startCellNdx; worldToCell(dest, &startCellNdx); PathfindCell *parentCell = getCell( layer, startCellNdx.x, startCellNdx.y ); - if (parentCell == NULL) + if (parentCell == nullptr) return FALSE; ICoord2D pos2d; worldToCell(to, &pos2d); @@ -7576,7 +7576,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet } } - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistanceSqr = FLT_MAX; Coord3D closestPos; @@ -7592,13 +7592,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -7656,7 +7656,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; // check if this neighbor cell is already on the open (waiting to be tried) @@ -7774,12 +7774,12 @@ struct TightenPathStruct /*static*/ Int Pathfinder::tightenPathCallback(Pathfinder* pathfinder, PathfindCell* from, PathfindCell* to, Int to_x, Int to_y, void* userData) { TightenPathStruct* d = (TightenPathStruct*)userData; - if (from == NULL || to==NULL) return 0; + if (from == nullptr || to==nullptr) return 0; if (d->layer != to->getLayer()) { return 0; // abort. } Coord3D pos; - if (!TheAI->pathfinder()->checkForAdjust(d->obj, *d->locomotorSet, true, to_x, to_y, to->getLayer(), d->radius, d->center, &pos, NULL)) + if (!TheAI->pathfinder()->checkForAdjust(d->obj, *d->locomotorSet, true, to_x, to_y, to->getLayer(), d->radius, d->center, &pos, nullptr)) { return 0; // bail early } @@ -7812,7 +7812,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con const Coord3D *rawTo) { //CRCDEBUG_LOG(("Pathfinder::checkPathCost()")); - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return 0; enum {MAX_COST = 0x7fff0000}; if (!obj) return MAX_COST; @@ -7820,7 +7820,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con Coord3D adjustTo = *rawTo; Coord3D *to = &adjustTo; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -7828,7 +7828,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con PathfindLayerEnum goalLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( goalLayer, to ); - if (goalCell == NULL) + if (goalCell == nullptr) return MAX_COST; @@ -7841,7 +7841,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con worldToCell(from, &startCellNdx); PathfindLayerEnum fromLayer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getCell( fromLayer, from ); - if (parentCell == NULL) + if (parentCell == nullptr) return MAX_COST; ICoord2D pos2d; worldToCell(to, &pos2d); @@ -7868,13 +7868,13 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -7940,7 +7940,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; // check if this neighbor cell is already on the open (waiting to be tried) @@ -8066,14 +8066,14 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet if (locomotorSet.getValidSurfaces() == 0) { DEBUG_CRASH(("Attempting to path immobile unit.")); - return NULL; + return nullptr; } - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return nullptr; m_isTunneling = false; - if (!obj) return NULL; + if (!obj) return nullptr; Bool canPathThroughUnits = false; if (obj && obj->getAIUpdateInterface()) { @@ -8089,7 +8089,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet adjustTo.x += PATHFIND_CELL_SIZE_F/2; adjustTo.y += PATHFIND_CELL_SIZE_F/2; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -8101,11 +8101,11 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( destinationLayer, to ); - if (goalCell == NULL) - return NULL; + if (goalCell == nullptr) + return nullptr; if (goalCell->getZone()==0 && destinationLayer==LAYER_WALL) { - return NULL; + return nullptr; } Bool goalOnObstacle = false; @@ -8119,7 +8119,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet PathfindCell *ignoreCell = getClippedCell(goalObj->getLayer(), goalObj->getPosition()); if ( (goalCell->getObstacleID()==ignoreCell->getObstacleID()) && (goalCell->getObstacleID() != INVALID_ID) ) { Object* newObstacle = TheGameLogic->findObjectByID(goalCell->getObstacleID()); - if (newObstacle != NULL && newObstacle->isKindOf(KINDOF_AIRFIELD)) + if (newObstacle != nullptr && newObstacle->isKindOf(KINDOF_AIRFIELD)) { m_ignoreObstacleID = goalCell->getObstacleID(); goalOnObstacle = true; @@ -8138,8 +8138,8 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet ICoord2D startCellNdx; worldToCell(from, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &clipFrom ); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), parentCell ) == false) { m_isTunneling = true; // We can't move from our current location. So relax the constraints. @@ -8173,7 +8173,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet ICoord2D pos2d; worldToCell(to, &pos2d); if (!goalCell->allocateInfo(pos2d)) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); @@ -8184,12 +8184,12 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet { goalCell->releaseInfo(); } - return NULL; + return nullptr; } } parentCell->startPathfind(goalCell); - PathfindCell *closesetCell = NULL; + PathfindCell *closesetCell = nullptr; Real closestDistanceSqr = FLT_MAX; Real closestDistScreenSqr = FLT_MAX; @@ -8197,13 +8197,13 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int count = 0; // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { Real dx; Real dy; @@ -8217,7 +8217,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet // success - found a path to the goal if (!goalOnObstacle) { // See if the goal is a valid destination. If not, accept closest cell. - if (closesetCell!=NULL && !canPathThroughUnits && !checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { + if (closesetCell!=nullptr && !canPathThroughUnits && !checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { break; } } @@ -8381,7 +8381,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -8404,7 +8404,7 @@ void Pathfinder::adjustCoordToCell(Int cellX, Int cellY, Bool centerInCell, Coor Path *Pathfinder::buildActualPath( const Object *obj, LocomotorSurfaceTypeMask acceptableSurfaces, const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Bool blocked ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -8460,8 +8460,8 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos, // traverse path cells in REVERSE order, creating path in desired order // skip the LAST node, as that will be in the same cell as the unit itself - so use the unit's position Coord3D pos; - PathfindCell *cell, *prevCell = NULL; - Bool goalCellNull = (goalCell->getParentCell()==NULL); + PathfindCell *cell, *prevCell = nullptr; + Bool goalCellNull = (goalCell->getParentCell()==nullptr); for( cell = goalCell; cell->getParentCell(); cell = cell->getParentCell() ) { m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); @@ -8624,11 +8624,11 @@ Int Pathfinder::iterateCellsAlongLine( const ICoord2D &start, const ICoord2D &en numpixels = delta_y; // There are more y-values than x-values } - PathfindCell* from = NULL; + PathfindCell* from = nullptr; for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { PathfindCell* to = getCell( layer, x, y ); - if (to==NULL) return 0; + if (to==nullptr) return 0; Int ret = (*proc)(this, from, to, x, y, userData); if (ret != 0) @@ -8642,7 +8642,7 @@ Int Pathfinder::iterateCellsAlongLine( const ICoord2D &start, const ICoord2D &en y += yinc1; // Change the y as appropriate from = to; to = getCell( layer, x, y ); - if (to==NULL) return 0; + if (to==nullptr) return 0; Int ret = (*proc)(this, from, to, x, y, userData); if (ret != 0) return ret; @@ -8663,7 +8663,7 @@ static ObjectID getSlaverID(const Object* o) for (BehaviorModule** update = o->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { return sdu->getSlaverID(); } @@ -8674,7 +8674,7 @@ static ObjectID getSlaverID(const Object* o) static ObjectID getContainerID(const Object* o) { - const Object* container = o ? o->getContainedBy() : NULL; + const Object* container = o ? o->getContainedBy() : nullptr; return container ? container->getID() : INVALID_ID; } @@ -8688,7 +8688,7 @@ struct segmentIntersectsStruct { segmentIntersectsStruct* d = (segmentIntersectsStruct*)userData; - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { Object *obj = TheGameLogic->findObjectByID(to->getObstacleID()); if (obj && obj->isKindOf(KINDOF_AIRCRAFT_PATH_AROUND)) { @@ -8716,7 +8716,7 @@ struct ViewBlockedStruct { const ViewBlockedStruct* d = (const ViewBlockedStruct*)userData; - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { // we never block our own view! @@ -8767,7 +8767,7 @@ struct ViewAttackBlockedStruct d->skipCount--; return 0; } - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { // we never block our own view! if (to->isObstaclePresent(d->obj->getID())) @@ -8861,7 +8861,7 @@ Bool Pathfinder::isAttackViewBlockedByObstacle(const Object* attacker, const Coo const Weapon* w = attacker->getCurrentWeapon(); if (attacker->isKindOf(KINDOF_IMMOBILE)) { // Don't take terrain blockage into account, since we can't move around it. jba. - w = NULL; + w = nullptr; } if (w) { @@ -8941,7 +8941,7 @@ Bool Pathfinder::segmentIntersectsTallBuilding(const PathNode *curNode, PathNode *nextNode, ObjectID ignoreBuilding, Coord3D *insertPos1, Coord3D *insertPos2, Coord3D *insertPos3 ) { segmentIntersectsStruct info; - info.theTallBuilding = NULL; + info.theTallBuilding = nullptr; info.ignoreBuilding = ignoreBuilding; Coord3D fromPos = *curNode->getPosition(); @@ -8998,7 +8998,7 @@ Bool Pathfinder::segmentIntersectsTallBuilding(const PathNode *curNode, Bool Pathfinder::circleClipsTallBuilding( const Coord3D *from, const Coord3D *to, Real circleRadius, ObjectID ignoreBuilding, Coord3D *adjustTo) { PartitionFilterAcceptByKindOf filterKindof(MAKE_KINDOF_MASK(KINDOF_AIRCRAFT_PATH_AROUND), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKindof, NULL }; + PartitionFilter *filters[] = { &filterKindof, nullptr }; Object* tallBuilding = ThePartitionManager->getClosestObject(to, circleRadius, FROM_BOUNDINGSPHERE_2D, filters); if (tallBuilding) { Real radius = tallBuilding->getGeometryInfo().getBoundingCircleRadius() + 2*PATHFIND_CELL_SIZE_F; @@ -9643,7 +9643,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Path *pathToAvoid, Object *otherObj2, Path *pathToAvoid2) { if (!m_isMapReady) - return NULL; // Should always be ok. + return nullptr; // Should always be ok. #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); @@ -9664,7 +9664,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Int radius; getRadiusAndCenter(obj, radius, centerInCell); - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // determine start cell ICoord2D startCellNdx; @@ -9676,10 +9676,10 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, worldToCell(&startPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); if (!parentCell) - return NULL; + return nullptr; if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move it without an ai. - return NULL; + return nullptr; const LocomotorSet& locomotorSet = obj->getAIUpdateInterface()->getLocomotorSet(); @@ -9700,15 +9700,15 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind(NULL); + parentCell->startPathfind(nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -9720,7 +9720,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, boxHalfWidth += otherRadius*PATHFIND_CELL_SIZE_F; if (otherCenter) boxHalfWidth+=PATHFIND_CELL_SIZE_F/2; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -9795,7 +9795,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } @@ -9817,7 +9817,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, cleanOpenAndClosedLists(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -9830,7 +9830,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); #endif - if (originalPath==NULL) return NULL; + if (originalPath==nullptr) return nullptr; Bool centerInCell; Int radius; getRadiusAndCenter(obj, radius, centerInCell); @@ -9841,7 +9841,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet m_zoneManager.setAllPassable(); - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); enum {CELL_LIMIT = 2000}; // max cells to examine. Int cellCount = 0; @@ -9858,24 +9858,24 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet worldToCell(&startPos, &startCellNdx); //worldToCell(obj->getPosition(), &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), ¤tPosition); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. + return nullptr; // shouldn't happen, but can't move it without an ai. } m_isTunneling = false; if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind( NULL); + parentCell->startPathfind( nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -9888,7 +9888,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { RGBColor color; color.setFromInt(0); - addIcon(NULL, 0,0,color); + addIcon(nullptr, 0,0,color); } #endif @@ -9940,7 +9940,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { parentCell->releaseInfo(); } - return NULL; // no open nodes. + return nullptr; // no open nodes. } PathfindCell *candidateGoal; candidateGoal = getCell(LAYER_GROUND, &goalPos); // just using for cost estimates. @@ -9953,10 +9953,10 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { parentCell->releaseInfo(); } - return NULL; + return nullptr; } - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10009,7 +10009,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet if (cellCount < CELL_LIMIT) { // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - cellCount += examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + cellCount += examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } } @@ -10038,7 +10038,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet parentCell->releaseInfo(); candidateGoal->releaseInfo(); } - return NULL; + return nullptr; } @@ -10047,7 +10047,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { if (!m_isMapReady) - return NULL; // Should always be ok. + return nullptr; // Should always be ok. Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -10115,7 +10115,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot Int cellCount = 0; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); Int attackDistance = weapon->getAttackDistance(obj, victim, victimPos); attackDistance += 3*PATHFIND_CELL_SIZE; @@ -10130,18 +10130,18 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot } if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move without an ai. - return NULL; + return nullptr; worldToCell(&objPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &objPos ); if (!parentCell) - return NULL; + return nullptr; if (!parentCell->allocateInfo(startCellNdx)) - return NULL; + return nullptr; const PathfindCell *startCell = parentCell; - parentCell->startPathfind(NULL); + parentCell->startPathfind(nullptr); // determine start cell ICoord2D victimCellNdx; @@ -10150,24 +10150,24 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot // determine goal cell PathfindCell *goalCell = getCell( LAYER_GROUND, victimCellNdx.x, victimCellNdx.y ); if (!goalCell) - return NULL; + return nullptr; if (!goalCell->allocateInfo(victimCellNdx)) { - return NULL; + return nullptr; } // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistanceSqr = FLT_MAX; Bool checkLOS = false; if (!victim) { @@ -10177,7 +10177,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot checkLOS = true; } - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10325,7 +10325,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** Find a short, valid path to a location that is safe from the repulsors. */ @@ -10333,7 +10333,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor const Coord3D *from, const Coord3D* repulsorPos1, const Coord3D* repulsorPos2, Real repulsorRadius) { //CRCDEBUG_LOG(("Pathfinder::findSafePath()")); - if (m_isMapReady == false) return NULL; // Should always be ok. + if (m_isMapReady == false) return nullptr; // Should always be ok. #if defined(RTS_DEBUG) // Int startTimeMS = ::GetTickCount(); #endif @@ -10350,7 +10350,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor isHuman = false; // computer gets to cheat. } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation m_zoneManager.setAllPassable(); @@ -10358,21 +10358,21 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor ICoord2D startCellNdx; worldToCell(obj->getPosition(), &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. + return nullptr; // shouldn't happen, but can't move it without an ai. } if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind( NULL); + parentCell->startPathfind( nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -10381,7 +10381,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor Real farthestDistanceSqr = 0; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10404,7 +10404,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor if (distSqr>repulsorDistSqr) { ok = true; } - if (m_openList == NULL && cellCount>0) { + if (m_openList == nullptr && cellCount>0) { ok = true; // exhausted the search space, just take the last cell. } if (distSqr > farthestDistanceSqr) { @@ -10466,7 +10466,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - cellCount += examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + cellCount += examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } @@ -10500,7 +10500,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor cleanOpenAndClosedLists(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 9bd88bcb319..6bb4f56e3c5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -154,7 +154,7 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *obj = TheGameLogic->findObjectByID( info->getObjectID() ); - if (obj!=NULL) { + if (obj!=nullptr) { if (obj->isKindOf(KINDOF_REBUILD_HOLE)) { RebuildHoleBehaviorInterface *rhbi = RebuildHoleBehavior::getRebuildHoleBehaviorInterfaceFromObject( obj ); if( rhbi ) { @@ -280,7 +280,7 @@ void AIPlayer::queueSupplyTruck( void ) PartitionFilterPlayer f2(m_player, false); // Only find other. PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *supplySource = ThePartitionManager->getClosestObject(¢er, radius, FROM_BOUNDINGSPHERE_2D, filters); if (!supplySource) { @@ -351,7 +351,7 @@ void AIPlayer::queueSupplyTruck( void ) SupplyTruckAIInterface* supplyTruckAI = obj->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) { ObjectID dock = supplyTruckAI->getPreferredDockID(); - if (TheGameLogic->findObjectByID(dock)!=NULL) continue; + if (TheGameLogic->findObjectByID(dock)!=nullptr) continue; if (supplyTruckAI->isCurrentlyFerryingSupplies() || supplyTruckAI->isForcedIntoWantingState()) { // This thinks he is a gatherer, but doesn't have a preferred dock id. @@ -391,7 +391,7 @@ void AIPlayer::queueSupplyTruck( void ) order->m_required = true; order->m_isResourceGatherer =true; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; TeamInQueue *team = newInstance(TeamInQueue); // Put in front of queue. prependTo_TeamBuildQueue(team); @@ -446,7 +446,7 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo { // inst-construct the building - Object *bldg = TheBuildAssistant->buildObjectNow( NULL, + Object *bldg = TheBuildAssistant->buildObjectNow( nullptr, bldgPlan, info->getLocation(), info->getAngle(), @@ -504,20 +504,20 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi { // Find a dozer. Object *dozer = findDozer(info->getLocation()); - if (dozer==NULL) { - return NULL; + if (dozer==nullptr) { + return nullptr; } // Check available funds. Money *money = m_player->getMoney(); if (money->countMoney()calcCostToBuild(m_player)) { - return NULL; + return nullptr; } // construct the building Coord3D pos = *info->getLocation(); pos.z += TheTerrainLogic->getGroundHeight(pos.x, pos.y); if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } Real angle = info->getAngle(); if( TheBuildAssistant->isLocationLegalToBuild( &pos, bldgPlan, angle, @@ -525,7 +525,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi dozer, m_player ) != LBC_OK ) { // If there's enemy units or structures, don't build/rebuild. TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. - return NULL; + return nullptr; } // validate the the position to build at is valid @@ -598,7 +598,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi BuildAssistant::NO_ENEMY_OBJECT_OVERLAP, dozer, m_player ) == LBC_OK; if (!valid) { - return NULL; + return nullptr; } } @@ -713,7 +713,7 @@ void AIPlayer::processBaseBuilding( void ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg==NULL) { + if (bldg==nullptr) { // got destroyed. ObjectID priorID; priorID = info->getObjectID(); @@ -740,10 +740,10 @@ void AIPlayer::processBaseBuilding( void ) // make sure dozer is working on him. ObjectID builder = bldg->getBuilderID(); Object* myDozer = TheGameLogic->findObjectByID(builder); - if (myDozer==NULL) { + if (myDozer==nullptr) { DEBUG_LOG(("AI's Dozer got killed. Find another dozer.")); myDozer = findDozer(bldg->getPosition()); - if (myDozer==NULL || myDozer->getAI()==NULL) { + if (myDozer==nullptr || myDozer->getAI()==nullptr) { continue; } myDozer->getAI()->aiResumeConstruction(bldg, CMD_FROM_AI); @@ -774,7 +774,7 @@ void AIPlayer::processBaseBuilding( void ) { Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg == NULL) + if (bldg == nullptr) { @@ -880,11 +880,11 @@ void AIPlayer::aiPreTeamDestroy( const Team *deletedTeam ) void AIPlayer::guardSupplyCenter( Team *team, Int minSupplies ) { m_supplySourceAttackCheckFrame = 0; // force check. - Object *warehouse = NULL; + Object *warehouse = nullptr; if (isSupplySourceAttacked()) { warehouse = TheGameLogic->findObjectByID(m_attackedSupplyCenter); } - if (warehouse==NULL) { + if (warehouse==nullptr) { warehouse = findSupplyCenter(minSupplies); } if (warehouse) { @@ -981,7 +981,7 @@ Bool AIPlayer::isSupplySourceAttacked( void ) Bool AIPlayer::isSupplySourceSafe( Int minSupplies ) { Object *warehouse = findSupplyCenter(minSupplies); - if (warehouse==NULL) return true; // it's safe cause it doesn't exist. + if (warehouse==nullptr) return true; // it's safe cause it doesn't exist. return (isLocationSafe(warehouse->getPosition(), warehouse->getTemplate())); } @@ -990,7 +990,7 @@ Bool AIPlayer::isSupplySourceSafe( Int minSupplies ) //------------------------------------------------------------------------------------------------- Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) { - if (tthing == NULL) return 0; + if (tthing == nullptr) return 0; // See if we have enemies. Real radius = TheAI->getAiData()->m_supplyCenterSafeRadius; @@ -1024,10 +1024,10 @@ Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) filters[numFilters++] = &filterInsignificant; filters[numFilters++] = &filterHarvesters; filters[numFilters++] = &filterDozer; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; Object *enemy = ThePartitionManager->getClosestObject( pos, radius, FROM_BOUNDINGSPHERE_2D, filters ); - if (enemy!=NULL) { + if (enemy!=nullptr) { return false; } return true; @@ -1049,8 +1049,8 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit ) Bool supplyTruck = false; #endif - // factory could be NULL at the start of the game. - if (factory == NULL) { + // factory could be null at the start of the game. + if (factory == nullptr) { return; } @@ -1078,7 +1078,7 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit ) std::vector path; path.push_back( *ai->getGoalPosition() ); path.push_back(team->m_team->getPrototype()->getTemplateInfo()->m_homeLocation); - ai->aiFollowExitProductionPath(&path, NULL, CMD_FROM_AI); + ai->aiFollowExitProductionPath(&path, nullptr, CMD_FROM_AI); } } @@ -1228,7 +1228,7 @@ Int AIPlayer::getPlayerSuperweaponValue(Coord3D *center, Int playerNdx, Real rad Real radSqr = sqr(radius); Player* pPlayer = ThePlayerList->getNthPlayer(playerNdx); - if (pPlayer == NULL) return 0; + if (pPlayer == nullptr) return 0; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { Team *team = iter.cur(); @@ -1297,7 +1297,7 @@ Bool AIPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString teamNam // ------------------------------------------------------------------------------------------------ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) { - Object *busyFactory = NULL; // We prefer a factory that isn't busy. + Object *busyFactory = nullptr; // We prefer a factory that isn't busy. for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) { Object *factory = TheGameLogic->findObjectByID( info->getObjectID() ); @@ -1328,7 +1328,7 @@ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) } // We didn't find an idle factory, so return the busy one. if (busyOK) return busyFactory; - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -1346,11 +1346,11 @@ Bool AIPlayer::isPossibleToBuildTeam( TeamPrototype *proto, Bool requireIdleFact const ThingTemplate *thing = TheThingFactory->findTemplate( unitInfo[i].unitThingName ); if (thing) { Int thingCost = thing->calcCostToBuild(m_player); - if (NULL == findFactory(thing, true)) { + if (nullptr == findFactory(thing, true)) { // Couldn't find a factory. return false; } - if (NULL != findFactory(thing, false)) { + if (nullptr != findFactory(thing, false)) { // Found an idle factory. anyIdle = true; } @@ -1424,9 +1424,9 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) { // Find a high production priority team that needs reinforcements. Player::PlayerTeamList::const_iterator t; - Team *curTeam = NULL; + Team *curTeam = nullptr; Int curPriority = minPriority; // Don't reinforce a team unless it is above min priority. - const ThingTemplate *curThing = NULL; + const ThingTemplate *curThing = nullptr; for (t = m_player->getPlayerTeams()->begin(); t != m_player->getPlayerTeams()->end(); ++t) { TeamPrototype *proto = (*t); @@ -1453,13 +1453,13 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) { if (unitInfo[i].maxUnits < 1) continue; const ThingTemplate *thing = TheThingFactory->findTemplate( unitInfo[i].unitThingName ); - if (thing==NULL) continue; + if (thing==nullptr) continue; Int count=0; team->countObjectsByThingTemplate(1, &thing, false, &count); if (count < unitInfo[i].maxUnits) { // See if there is a factory available. - if (NULL != findFactory(thing, false)) + if (nullptr != findFactory(thing, false)) { curTeam = team; curPriority = proto->getTemplateInfo()->m_productionPriority; @@ -1485,7 +1485,7 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) order->m_numRequired = 1; order->m_required = true; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; teamQ->m_workOrders = order; teamQ->m_frameStarted = TheGameLogic->getFrame(); teamQ->m_team = curTeam; @@ -1587,7 +1587,7 @@ Bool AIPlayer::selectTeamToBuild( void ) // pick a random team from the hi-priority set Int which = GameLogicRandomValue( 0, count-1 ); - TeamPrototype *teamProto = NULL; + TeamPrototype *teamProto = nullptr; Int i = 0; for (t = candidateList.begin(); t != candidateList.end(); ++t) { @@ -1638,7 +1638,7 @@ void AIPlayer::buildSpecificAIBuilding(const AsciiString &thingName) void AIPlayer::buildUpgrade(const AsciiString &upgrade) { const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade); - if (curUpgrade==NULL) { + if (curUpgrade==nullptr) { AsciiString msg = "Upgrade "; msg.concat(upgrade); msg.concat(" does not exist. Ignoring request."); @@ -1693,14 +1693,14 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) continue; Bool canUpgradeHere = false; const CommandSet *commandSet = TheControlBar->findCommandSet( factory->getCommandSetString() ); - if( commandSet == NULL) continue; + if( commandSet == nullptr) continue; for( Int j = 0; j < MAX_COMMANDS_PER_SET; j++ ) { //Get the command button. const CommandButton *commandButton = commandSet->getCommandButton(j); - if (commandButton==NULL) continue; + if (commandButton==nullptr) continue; if (commandButton->getName().isEmpty() ) continue; - if (commandButton->getUpgradeTemplate() == NULL ) continue; + if (commandButton->getUpgradeTemplate() == nullptr ) continue; if (commandButton->getUpgradeTemplate()->getUpgradeName() == curUpgrade->getUpgradeName()) { canUpgradeHere = true; } @@ -1774,7 +1774,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) Coord3D newPos = location; if( TheBuildAssistant->isLocationLegalToBuild( &location, tTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) != LBC_OK ) { + nullptr, m_player ) != LBC_OK ) { // Warn. const Coord3D *warehouseLocation = bestSupplyWarehouse->getPosition(); AsciiString debugMessage; @@ -1800,7 +1800,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -1809,7 +1809,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( !valid && TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); } @@ -1822,7 +1822,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -1831,7 +1831,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( !valid && TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); } @@ -1856,7 +1856,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) // ------------------------------------------------------------------------------------------------ Object *AIPlayer::findSupplyCenter(Int minimumCash) { - Object *bestSupplyWarehouse = NULL; + Object *bestSupplyWarehouse = nullptr; Real bestDistSqr = 0; Object *obj; Coord3D enemyCenter; @@ -1891,7 +1891,7 @@ Object *AIPlayer::findSupplyCenter(Int minimumCash) PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *supplyCenter = ThePartitionManager->getClosestObject(¢er, radius, FROM_BOUNDINGSPHERE_2D, filters); if (supplyCenter) { @@ -1913,7 +1913,7 @@ Object *AIPlayer::findSupplyCenter(Int minimumCash) } } - if (bestSupplyWarehouse==NULL) { + if (bestSupplyWarehouse==nullptr) { bestSupplyWarehouse = obj; bestDistSqr = distSqr; } else if (bestDistSqr>distSqr) { @@ -1955,8 +1955,8 @@ void AIPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool fl void AIPlayer::repairStructure(ObjectID structure) { Object *structureObj = TheGameLogic->findObjectByID(structure); - if (structureObj==NULL) return; - if (structureObj->getBodyModule()==NULL) return; + if (structureObj==nullptr) return; + if (structureObj->getBodyModule()==nullptr) return; // If the structure is not noticably damaged, don't bother. BodyDamageType structureState = structureObj->getBodyModule()->getDamageState(); if (structureState==BODY_PRISTINE) { @@ -2001,10 +2001,10 @@ void AIPlayer::updateBridgeRepair(void) m_bridgeTimer--; if (m_bridgeTimer>0) return; m_bridgeTimer = LOGICFRAMES_PER_SECOND; - Object *bridgeObj=NULL; - while (bridgeObj==NULL && m_structuresInQueue>0) { + Object *bridgeObj=nullptr; + while (bridgeObj==nullptr && m_structuresInQueue>0) { bridgeObj = TheGameLogic->findObjectByID(m_structuresToRepair[0]); - if (bridgeObj==NULL) { + if (bridgeObj==nullptr) { Int i; for (i=0; igetPosition(); BodyDamageType bridgeState = bridgeObj->getBodyModule()->getDamageState(); if (m_repairDozer==INVALID_ID) { @@ -2039,14 +2039,14 @@ void AIPlayer::updateBridgeRepair(void) } dozer = TheGameLogic->findObjectByID(m_repairDozer); - if (dozer==NULL) { + if (dozer==nullptr) { m_repairDozer=INVALID_ID; // we got killed. m_bridgeTimer=0; return; // Just try to find a dozer next frame. } DozerAIInterface* dozerAI = dozer->getAI()->getDozerAIInterface(); - if (dozerAI==NULL) { + if (dozerAI==nullptr) { DEBUG_CRASH(("Unexpected - dozer doesn't have dozer interface.")); return; } @@ -2133,7 +2133,7 @@ void AIPlayer::buildSpecificAITeam( TeamPrototype *teamProto, Bool priorityBuild } } const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; - WorkOrder *orders = NULL; + WorkOrder *orders = nullptr; Int i; // Queue up optional units. for( i=0; igetTemplateInfo()->m_numUnitsInfo; i++ ) @@ -2245,7 +2245,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu teamName.concat(" - Recruiting."); TheScriptEngine->AppendDebugMessage(teamName, false); const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; -// WorkOrder *orders = NULL; +// WorkOrder *orders = nullptr; Int i; Int unitsRecruited = 0; // Recruit. @@ -2296,7 +2296,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu // Put in front of queue. prependTo_TeamReadyQueue(team); team->m_priorityBuild = false; - team->m_workOrders = NULL; + team->m_workOrders = nullptr; team->m_frameStarted = TheGameLogic->getFrame(); team->m_team = theTeam; AsciiString teamName = teamProto->getName(); @@ -2306,7 +2306,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu //disband. if (!theTeam->getPrototype()->getIsSingleton()) { deleteInstance(theTeam); - theTeam = NULL; + theTeam = nullptr; } AsciiString teamName = teamProto->getName(); teamName.concat(" - Recruited 0 units, disbanding."); @@ -2624,7 +2624,7 @@ void AIPlayer::doUpgradesAndSkills( void ) } sideInfo = sideInfo->m_next; } - if (sideInfo == NULL) return; + if (sideInfo == nullptr) return; if (m_skillsetSelector == INVALID_SKILLSET_SELECTION) { Int limit = 0; @@ -2848,7 +2848,7 @@ void AIPlayer::queueDozer( void ) order->m_required = true; order->m_isResourceGatherer = FALSE; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; TeamInQueue *team = newInstance(TeamInQueue); // Put in front of queue. prependTo_TeamBuildQueue(team); @@ -2889,9 +2889,9 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) { // Add any factories placed to the build list. Object *obj; - Object *dozer = NULL; + Object *dozer = nullptr; Bool needDozer = true; - Object *closestDozer=NULL; + Object *closestDozer=nullptr; Real closestDistSqr = 0; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) @@ -2903,7 +2903,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) if (obj->isKindOf(KINDOF_DOZER)) { AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai==NULL) { + if (ai==nullptr) { continue; } @@ -2929,7 +2929,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) if (!dozerAI->isAnyTaskPending()) { dozer = obj; // prefer an idle dozer } - if (dozer==NULL) { + if (dozer==nullptr) { dozer = obj; // but we'll take one doing stuff. } if (dozer && !dozerAI->isAnyTaskPending()) { @@ -2939,7 +2939,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) dx = pos->x - dozer->getPosition()->x; dy = pos->y - dozer->getPosition()->y; distSqr = dx*dx+dy*dy; - if (closestDozer == NULL) { + if (closestDozer == nullptr) { closestDozer = dozer; closestDistSqr = distSqr; } else if (distSqr < closestDistSqr) { @@ -3015,10 +3015,10 @@ void AIPlayer::xfer( Xfer *xfer ) { // sanity, the list must be empty - if( getFirstItemIn_TeamBuildQueue() != NULL ) + if( getFirstItemIn_TeamBuildQueue() != nullptr ) { - DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not NULL, you should delete it or something before loading a new list" )); + DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not null, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; } @@ -3074,10 +3074,10 @@ void AIPlayer::xfer( Xfer *xfer ) { // sanity, the list must be empty - if( getFirstItemIn_TeamReadyQueue() != NULL ) + if( getFirstItemIn_TeamReadyQueue() != nullptr ) { - DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not NULL, you should delete it or something before loading a new list" )); + DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not null, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; } @@ -3164,7 +3164,7 @@ TeamInQueue::~TeamInQueue() } // If we have a team, activate it. If it is empty, Team.cpp will remove empty active teams. if (m_team) m_team->setActive(); - m_workOrders = NULL; + m_workOrders = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -3263,7 +3263,7 @@ void TeamInQueue::disband() if (!m_team->getPrototype()->getIsSingleton()) { deleteInstance(m_team); } - m_team = NULL; + m_team = nullptr; } } @@ -3313,10 +3313,10 @@ void TeamInQueue::xfer( Xfer *xfer ) { // sanity - if( m_workOrders != NULL ) + if( m_workOrders != nullptr ) { - DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be NULL but isn't. Perhaps you should blow it away before loading" )); + DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be null but isn't. Perhaps you should blow it away before loading" )); throw SC_INVALID_DATA; } @@ -3329,14 +3329,14 @@ void TeamInQueue::xfer( Xfer *xfer ) workOrder = newInstance(WorkOrder); // attach to list at the end - workOrder->m_next = NULL; - if( m_workOrders == NULL ) + workOrder->m_next = nullptr; + if( m_workOrders == nullptr ) m_workOrders = workOrder; else { WorkOrder *last = m_workOrders; - while( last->m_next != NULL ) + while( last->m_next != nullptr ) last = last->m_next; last->m_next = workOrder; @@ -3392,7 +3392,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) if (m_factoryID == INVALID_ID) return; Object *factory = TheGameLogic->findObjectByID( m_factoryID ); - if ( factory == NULL) { + if ( factory == nullptr) { m_factoryID = INVALID_ID; return; } @@ -3469,7 +3469,7 @@ void AIPlayer::getPlayerStructureBounds(Region2D *bounds, Int playerNdx ) objBounds.hi.x = objBounds.lo.x = objBounds.hi.y = objBounds.lo.x = 0; Player* pPlayer = ThePlayerList->getNthPlayer(playerNdx); - if (pPlayer == NULL) return; + if (pPlayer == nullptr) return; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { Team *team = iter.cur(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 1df77caa3b4..37e1276749b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -75,7 +75,7 @@ m_curLeftFlankRightDefenseAngle(0), m_curRightFlankLeftDefenseAngle(0), m_curRightFlankRightDefenseAngle(0), m_frameToCheckEnemy(0), -m_currentEnemy(NULL) +m_currentEnemy(nullptr) { m_frameLastBuildingBuilt = TheGameLogic->getFrame(); @@ -99,12 +99,12 @@ void AISkirmishPlayer::processBaseBuilding( void ) // if (m_readyToBuildStructure) { - const ThingTemplate *bldgPlan=NULL; - BuildListInfo *bldgInfo = NULL; + const ThingTemplate *bldgPlan=nullptr; + BuildListInfo *bldgInfo = nullptr; Bool isPriority = false; - Object *bldg = NULL; - const ThingTemplate *powerPlan=NULL; - BuildListInfo *powerInfo = NULL; + Object *bldg = nullptr; + const ThingTemplate *powerPlan=nullptr; + BuildListInfo *powerInfo = nullptr; Bool isUnderPowered = !m_player->getEnergy()->hasSufficientPower(); Bool powerUnderConstruction = false; for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) @@ -121,7 +121,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg==NULL) { + if (bldg==nullptr) { // got destroyed. ObjectID priorID; priorID = info->getObjectID(); @@ -152,11 +152,11 @@ void AISkirmishPlayer::processBaseBuilding( void ) // make sure dozer is working on him. ObjectID builder = bldg->getBuilderID(); Object* myDozer = TheGameLogic->findObjectByID(builder); - if (myDozer==NULL) { + if (myDozer==nullptr) { DEBUG_LOG(("AI's Dozer got killed. Find another dozer.")); queueDozer(); myDozer = findDozer(bldg->getPosition()); - if (myDozer==NULL || myDozer->getAI()==NULL) { + if (myDozer==nullptr || myDozer->getAI()==nullptr) { continue; } myDozer->getAI()->aiResumeConstruction(bldg, CMD_FROM_AI); @@ -198,7 +198,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } } if (curPlan->isKindOf(KINDOF_FS_POWER)) { - if (powerPlan==NULL && !curPlan->isKindOf(KINDOF_CASH_GENERATOR)) { + if (powerPlan==nullptr && !curPlan->isKindOf(KINDOF_CASH_GENERATOR)) { if (isUnderPowered || info->isAutomaticBuild()) { powerPlan = curPlan; powerInfo = info; @@ -209,7 +209,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) continue; // marked to not build automatically. } Object *dozer = findDozer(info->getLocation()); - if (dozer==NULL) { + if (dozer==nullptr) { if (isUnderPowered) { queueDozer(); } @@ -226,7 +226,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) // check if this building has any "rebuilds" left if (info->isBuildable()) { - if (bldgPlan == NULL) { + if (bldgPlan == nullptr) { bldgPlan = curPlan; bldgInfo = info; } @@ -471,7 +471,7 @@ Int AISkirmishPlayer::getMyEnemyPlayerIndex(void) { */ void AISkirmishPlayer::acquireEnemy(void) { - Player *bestEnemy = NULL; + Player *bestEnemy = nullptr; Real bestDistanceSqr = HUGE_DIST*HUGE_DIST; if (m_currentEnemy) { @@ -524,7 +524,7 @@ void AISkirmishPlayer::acquireEnemy(void) } } } - if (bestEnemy!=NULL && (bestEnemy!=m_currentEnemy)) { + if (bestEnemy!=nullptr && (bestEnemy!=m_currentEnemy)) { m_currentEnemy = bestEnemy; AsciiString msg = TheNameKeyGenerator->keyToName(m_player->getPlayerNameKey()); msg.concat(" acquiring target enemy player: "); @@ -591,7 +591,7 @@ void AISkirmishPlayer::buildAIBaseDefense(Bool flank) void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool flank) { const ThingTemplate *tTemplate = TheThingFactory->findTemplate(thingName); - if (tTemplate==NULL) { + if (tTemplate==nullptr) { DEBUG_CRASH(("Couldn't find base defense structure '%s' for side %s", thingName.str(), m_player->getSide().str())); return; } @@ -683,7 +683,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool canBuild; Real placeAngle = tTemplate->getPlacementViewAngle(); canBuild = LBC_OK == TheBuildAssistant->isLocationLegalToBuild(&buildPos, tTemplate, placeAngle, - BuildAssistant::TERRAIN_RESTRICTIONS|BuildAssistant::NO_OBJECT_OVERLAP, NULL, m_player); + BuildAssistant::TERRAIN_RESTRICTIONS|BuildAssistant::NO_OBJECT_OVERLAP, nullptr, m_player); TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. if (flank) { m_curFlankBaseDefense++; @@ -768,7 +768,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr teamName.concat(" - Recruiting."); TheScriptEngine->AppendDebugMessage(teamName, false); const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; -// WorkOrder *orders = NULL; +// WorkOrder *orders = nullptr; Int i; Int unitsRecruited = 0; // Recruit. @@ -819,7 +819,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr // Put in front of queue. prependTo_TeamReadyQueue(team); team->m_priorityBuild = false; - team->m_workOrders = NULL; + team->m_workOrders = nullptr; team->m_frameStarted = TheGameLogic->getFrame(); team->m_team = theTeam; AsciiString teamName = teamProto->getName(); @@ -829,7 +829,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr //disband. if (!theTeam->getPrototype()->getIsSingleton()) { deleteInstance(theTeam); - theTeam = NULL; + theTeam = nullptr; } AsciiString teamName = teamProto->getName(); teamName.concat(" - Recruited 0 units, disbanding."); @@ -1077,7 +1077,7 @@ void AISkirmishPlayer::newMap( void ) } build = build->m_next; } - DEBUG_ASSERTLOG(build!=NULL, ("Couldn't find build list for skirmish player.")); + DEBUG_ASSERTLOG(build!=nullptr, ("Couldn't find build list for skirmish player.")); // Build any with the initially built flag. for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index e27d1e08fd8..cc580ee70f5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -73,14 +73,14 @@ static Bool cannotPossiblyAttackObject( State *thisState, void* userData ); AICommandParms::AICommandParms(AICommandType cmd, CommandSourceType cmdSource) : m_cmd(cmd), m_cmdSource(cmdSource), - m_obj(NULL), - m_otherObj(NULL), - m_team(NULL), - m_waypoint(NULL), - m_polygon(NULL), + m_obj(nullptr), + m_otherObj(nullptr), + m_team(nullptr), + m_waypoint(nullptr), + m_polygon(nullptr), m_intValue(0), - m_commandButton(NULL), - m_path(NULL) + m_commandButton(nullptr), + m_path(nullptr) { m_pos.zero(); m_coords.clear(); @@ -177,13 +177,13 @@ void AICommandParmsStorage::doXfer(Xfer *xfer) cmdName = m_commandButton->getName(); } xfer->xferAsciiString(&cmdName); - if (cmdName.isNotEmpty() && m_commandButton==NULL) { + if (cmdName.isNotEmpty() && m_commandButton==nullptr) { m_commandButton = TheControlBar->findCommandButton(cmdName); } - Bool hasPath = m_path!=NULL; + Bool hasPath = m_path!=nullptr; xfer->xferBool(&hasPath); - if (hasPath && m_path==NULL) { + if (hasPath && m_path==nullptr) { m_path = newInstance(Path); } if (hasPath) { @@ -265,27 +265,27 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. static const StateConditionInfo objectConditionsNormal[] = { - StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), + StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, nullptr), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. static const StateConditionInfo objectConditionsForced[] = { - StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), + StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, nullptr), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET_FORCED), - StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; const StateConditionInfo* objectConditions = forceAttacking ? objectConditionsForced : objectConditionsNormal; static const StateConditionInfo positionConditions[] = { - StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; #ifdef STATE_MACHINE_DEBUG @@ -328,8 +328,8 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt { static const StateConditionInfo portableStructureChaseConditions[] = { - StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; /* we're a rider on a mobile object, so we can't control our motion. @@ -406,7 +406,7 @@ AttackStateMachine::~AttackStateMachine() //----------------------------------------------------------------------------------------------------------- static Object* findEnemyInContainer(Object* killer, Object* bldg) { - const ContainedItemsList* items = bldg->getContain() ? bldg->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = bldg->getContain() ? bldg->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -424,7 +424,7 @@ static Object* findEnemyInContainer(Object* killer, Object* bldg) } } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------------------------------------- @@ -510,7 +510,7 @@ StateReturnType AIRappelState::onEnter() m_targetIsBldg = true; Object* bldg = getMachineGoalObject(); - if (bldg == NULL || bldg->isEffectivelyDead() || !bldg->isKindOf(KINDOF_STRUCTURE)) + if (bldg == nullptr || bldg->isEffectivelyDead() || !bldg->isKindOf(KINDOF_STRUCTURE)) m_targetIsBldg = false; const Coord3D* pos = obj->getPosition(); @@ -541,7 +541,7 @@ StateReturnType AIRappelState::update() const Coord3D* pos = obj->getPosition(); Object* bldg = getMachineGoalObject(); - if (m_targetIsBldg && (bldg == NULL || bldg->isEffectivelyDead())) + if (m_targetIsBldg && (bldg == nullptr || bldg->isEffectivelyDead())) { // if bldg is destroyed, just head for the ground // BGC - bldg could be destroyed as they are heading down the rope. @@ -577,7 +577,7 @@ StateReturnType AIRappelState::update() if (numKilled > 0) { const FXList* fx = obj->getTemplate()->getPerUnitFX("CombatDropKillFX"); - FXList::doFXObj(fx, bldg, NULL); + FXList::doFXObj(fx, bldg, nullptr); DEBUG_LOG(("Killing %d enemies in combat drop!",numKilled)); } @@ -672,10 +672,10 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( DEBUG_ASSERTCRASH(getOwner()->getAI(), ("An AI State Machine '%s' was constructed without an AIUpdateInterface, please tell JKMCD", name.str())); m_goalPath.clear(); - m_goalWaypoint = NULL; - m_goalSquad = NULL; + m_goalWaypoint = nullptr; + m_goalSquad = nullptr; - m_temporaryState = NULL; + m_temporaryState = nullptr; m_temporaryStateFramEnd = 0; // order matters: first state is the default state. @@ -699,12 +699,12 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( defineState( AI_MOVE_AND_EVACUATE_AND_EXIT, newInstance(AIMoveAndEvacuateState)( this ), AI_MOVE_AND_DELETE, AI_MOVE_AND_DELETE ); defineState( AI_MOVE_AND_DELETE, newInstance(AIMoveAndDeleteState)( this ), AI_IDLE, AI_IDLE ); defineState( AI_WAIT, newInstance(AIWaitState)( this ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_POSITION, newInstance(AIAttackState)( this, false, false, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_FORCE_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, true, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_POSITION, newInstance(AIAttackState)( this, false, false, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_FORCE_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, true, nullptr ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_AND_FOLLOW_OBJECT, newInstance(AIAttackState)( this, true, true, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_SQUAD, newInstance(AIAttackSquadState)( this, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_AND_FOLLOW_OBJECT, newInstance(AIAttackState)( this, true, true, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_SQUAD, newInstance(AIAttackSquadState)( this, nullptr ), AI_IDLE, AI_IDLE ); defineState( AI_WANDER, newInstance(AIWanderState)( this ), AI_IDLE, AI_MOVE_AWAY_FROM_REPULSORS ); defineState( AI_PANIC, newInstance(AIPanicState)( this ), AI_IDLE, AI_MOVE_AWAY_FROM_REPULSORS ); defineState( AI_DEAD, newInstance(AIDeadState)( this ), AI_IDLE, AI_IDLE ); @@ -776,11 +776,11 @@ void AIStateMachine::xfer( Xfer *xfer ) m_goalWaypoint = TheTerrainLogic->getWaypointByName(waypointName); } } - Bool hasSquad = (m_goalSquad!=NULL); + Bool hasSquad = (m_goalSquad!=nullptr); xfer->xferBool(&hasSquad); if (xfer->getXferMode() == XFER_LOAD) { - if (hasSquad && m_goalSquad==NULL) { + if (hasSquad && m_goalSquad==nullptr) { m_goalSquad = newInstance( Squad ); } } @@ -797,7 +797,7 @@ void AIStateMachine::xfer( Xfer *xfer ) if (xfer->getXferMode() == XFER_LOAD && id != INVALID_STATE_ID) { m_temporaryState = internalGetState( id ); } - if (m_temporaryState!=NULL) { + if (m_temporaryState!=nullptr) { xfer->xferSnapshot(m_temporaryState); } @@ -874,7 +874,7 @@ StateReturnType AIStateMachine::updateStateMachine() return status; } m_temporaryState->onExit(EXIT_NORMAL); - m_temporaryState = NULL; + m_temporaryState = nullptr; } StateReturnType retType = StateMachine::updateStateMachine(); @@ -938,14 +938,14 @@ StateReturnType AIStateMachine::setTemporaryState( StateID newStateID, Int frame #endif if (m_temporaryState) { m_temporaryState->onExit(EXIT_RESET); - m_temporaryState = NULL; + m_temporaryState = nullptr; } if (newState) { m_temporaryState = newState; StateReturnType ret = m_temporaryState->onEnter(); if (ret != STATE_CONTINUE) { m_temporaryState->onExit(EXIT_NORMAL); - m_temporaryState = NULL; + m_temporaryState = nullptr; return ret; } enum {FRAME_COUNT_MAX = 60*LOGICFRAMES_PER_SECOND}; @@ -984,7 +984,7 @@ void AIStateMachine::addToGoalPath( const Coord3D *pathPoint) const Coord3D *AIStateMachine::getGoalPathPosition( Int i ) const { if (i < 0 || i >= m_goalPath.size()) - return NULL; + return nullptr; return &m_goalPath[i]; } @@ -1013,8 +1013,8 @@ void AIStateMachine::clear() { StateMachine::clear(); m_goalPath.clear(); - m_goalWaypoint = NULL; - m_goalSquad = NULL; + m_goalWaypoint = nullptr; + m_goalSquad = nullptr; AIUpdateInterface* ai = getOwner()->getAI(); if (ai) @@ -1049,7 +1049,7 @@ StateReturnType AIStateMachine::setState(StateID newStateID) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalTeam( const Team *team ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1059,7 +1059,7 @@ void AIStateMachine::setGoalTeam( const Team *team ) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalSquad( const Squad *squad ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1069,7 +1069,7 @@ void AIStateMachine::setGoalSquad( const Squad *squad ) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalAIGroup( const AIGroup *group ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1209,7 +1209,7 @@ Bool outOfWeaponRangePosition( State *thisState, void* userData ) Bool viewBlocked = false; if (onGround) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(obj, *obj->getPosition(), NULL, *pos); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(obj, *obj->getPosition(), nullptr, *pos); } if (viewBlocked) { @@ -1331,7 +1331,7 @@ void AIIdleState::doInitIdleState() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); const Locomotor* loco = ai->getCurLocomotor(); - Bool ultraAccurate = (loco != NULL && loco->isUltraAccurate()); + Bool ultraAccurate = (loco != nullptr && loco->isUltraAccurate()); #define NO_STOP_AND_SLIDE if (ai->isIdle() && ai->isDoingGroundMovement()) { @@ -1370,7 +1370,7 @@ void AIIdleState::doInitIdleState() } ai->setLocomotorGoalNone(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); } //---------------------------------------------------------------------------------------------- @@ -1464,7 +1464,7 @@ StateReturnType AIDeadState::onEnter() { Object *obj = getMachineOwner(); - // How can an object be NULL here? I don't think it actually can, but this check must be + // How can an object be null here? I don't think it actually can, but this check must be // here for a reason. - jkmcd if (obj) { @@ -1727,7 +1727,7 @@ void AIInternalMoveToState::onExit( StateExitType status ) // (This is why destructors should not do game logic) if (ai) { ai->friend_endingMove(); - DEBUG_ASSERTLOG(obj->getTeam(), ("AIInternalMoveToState::onExit obj has NULL team.")); + DEBUG_ASSERTLOG(obj->getTeam(), ("AIInternalMoveToState::onExit obj has null team.")); if (obj->getTeam() && ai->isDoingGroundMovement() && ai->getCurLocomotor() && ai->getCurLocomotor()->isUltraAccurate()) { Real dx = m_goalPosition.x-obj->getPosition()->x; @@ -1760,7 +1760,7 @@ StateReturnType AIInternalMoveToState::update() /// @todo srj -- find a way to sleep for a number of frames here, if possible return STATE_CONTINUE; } - if (thePath==NULL) { + if (thePath==nullptr) { return STATE_FAILURE; } m_waitingForPath = false; @@ -1776,7 +1776,7 @@ StateReturnType AIInternalMoveToState::update() } Bool forceRecompute = false; - if (thePath==NULL) { + if (thePath==nullptr) { forceRecompute = true; } Bool blocked=false; @@ -1835,7 +1835,7 @@ StateReturnType AIInternalMoveToState::update() } } - if (thePath != NULL) + if (thePath != nullptr) ai->setLocomotorGoalPositionOnPath(); // if our goal has moved, recompute our path @@ -1849,7 +1849,7 @@ StateReturnType AIInternalMoveToState::update() // srj sez: must re-set setLocoGoal after computePath, since computePath // can set the loco goal to NONE... - if (ai->getPath() != NULL) + if (ai->getPath() != nullptr) ai->setLocomotorGoalPositionOnPath(); else return STATE_CONTINUE; @@ -1945,7 +1945,7 @@ AIAttackMoveStateMachine::AIAttackMoveStateMachine(Object *owner, AsciiString na // order matters: first state is the default state. defineState( AI_IDLE, newInstance(AIIdleState)( this, AIIdleState::DO_NOT_LOOK_FOR_TARGETS ), AI_IDLE, AI_IDLE ); defineState( AI_PICK_UP_CRATE, newInstance(AIPickUpCrateState)( this ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, NULL ), AI_IDLE, AI_IDLE); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, nullptr ), AI_IDLE, AI_IDLE); } //---------------------------------------------------------------------------------------------------------- @@ -2028,7 +2028,7 @@ StateReturnType AIMoveToState::update() if (goalObj) { m_goalPosition = *goalObj->getPosition(); - Bool gotPhysics = obj->getPhysics()!=NULL && goalObj->getPhysics()!=NULL; + Bool gotPhysics = obj->getPhysics()!=nullptr && goalObj->getPhysics()!=nullptr; Bool isMissile = obj->isKindOf(KINDOF_PROJECTILE); if (isMissile) { Real halfHeight = getMachineGoalObject()->getGeometryInfo().getMaxHeightAbovePosition()/2.0f; @@ -2086,7 +2086,7 @@ StateReturnType AIMoveOutOfTheWayState::onEnter() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); - if (ai->getPath()==NULL) { + if (ai->getPath()==nullptr) { // Must have existing path. return STATE_FAILURE; } @@ -2358,7 +2358,7 @@ Bool AIAttackApproachTargetState::computePath() } if (m_waitingForPath) return true; - if (!forceRepath && ai->getPath()==NULL && !ai->isWaitingForPath()) + if (!forceRepath && ai->getPath()==nullptr && !ai->isWaitingForPath()) { forceRepath = true; } @@ -2583,7 +2583,7 @@ StateReturnType AIAttackApproachTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = !ai->isAttackPath(); @@ -2649,7 +2649,7 @@ StateReturnType AIAttackApproachTargetState::updateInternal() Bool viewBlocked = false; if ( ai->isDoingGroundMovement() ) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), NULL, m_goalPosition); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), nullptr, m_goalPosition); } if (!viewBlocked) { @@ -2713,7 +2713,7 @@ void AIAttackApproachTargetState::onExit( StateExitType status ) AIUpdateInterface *ai = getMachineOwner()->getAI(); Object *obj = getMachineOwner(); if (ai) { - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // Per JohnA, this state should not be calling ai->destroyPath, because we can have spastic users // that click the target repeadedly. This will prevent the unit from stuttering for said spastic @@ -2768,7 +2768,7 @@ Bool AIAttackPursueTargetState::computePath() } if (m_waitingForPath) return true; - if (!forceRepath && ai->getPath()==NULL && !ai->isWaitingForPath()) + if (!forceRepath && ai->getPath()==nullptr && !ai->isWaitingForPath()) { forceRepath = true; } @@ -2936,7 +2936,7 @@ StateReturnType AIAttackPursueTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = false; @@ -3166,7 +3166,7 @@ StateReturnType AIFollowPathState::onEnter() m_index = 0; const Coord3D *pos = ai->friend_getGoalPathPosition( m_index ); - if (pos == NULL) + if (pos == nullptr) return STATE_FAILURE; // set initial movement goal @@ -3274,7 +3274,7 @@ StateReturnType AIFollowPathState::update() //determine which waypoints to plot in the waypoint renderer. ai->friend_setCurrentGoalPathIndex( m_index ); ai->ignoreObstacleID(INVALID_ID); // we have exited whatever object we are leaving, if any. jba. - if (pos == NULL) + if (pos == nullptr) { // reached the end of the path return STATE_SUCCESS; @@ -3474,7 +3474,7 @@ AsciiString AIAttackMoveToState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMoveMachine) name.concat(m_attackMoveMachine->getCurrentStateName()); - else name.concat("*NULL m_deployMachine"); + else name.concat("*null m_deployMachine"); return name; } #endif @@ -3539,7 +3539,7 @@ StateReturnType AIAttackMoveToState::update() Object* nextObjectToAttack; nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { ai->friend_endingMove(); m_attackMoveMachine->setGoalObject(nextObjectToAttack); @@ -3692,7 +3692,7 @@ const Waypoint * AIFollowWaypointPathState::getNextWaypoint(void) #else if (!hasNextWaypoint()) { m_priorWaypoint = m_currentWaypoint; - return NULL; + return nullptr; } Int skip = -1; Int i; @@ -3726,7 +3726,7 @@ Bool AIFollowWaypointPathState::hasNextWaypoint(void) if (m_currentWaypoint->getNumLinks()==0) { return false; // no links, no next. } - if (m_priorWaypoint==NULL) { + if (m_priorWaypoint==nullptr) { return m_currentWaypoint->getNumLinks()>0; } if (m_currentWaypoint->getNumLinks()>1) { @@ -3765,7 +3765,7 @@ Real AIFollowWaypointPathState::calcExtraPathDistance(void) //---------------------------------------------------------------------------------------------------------- void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) { - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return; Object *obj = getMachineOwner(); @@ -3894,11 +3894,11 @@ void AIFollowWaypointPathState::loadPostProcess( void ) StateReturnType AIFollowWaypointPathState::onEnter() { m_appendGoalPosition = false; // not moving off the map at this point. - m_priorWaypoint = NULL; + m_priorWaypoint = nullptr; m_currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - if (m_currentWaypoint == NULL && !m_moveAsGroup) return STATE_FAILURE; + if (m_currentWaypoint == nullptr && !m_moveAsGroup) return STATE_FAILURE; getMachine()->setGoalPosition(m_currentWaypoint->getLocation()); @@ -3940,7 +3940,7 @@ StateReturnType AIFollowWaypointPathState::onEnter() m_groupOffset.y = obj->getPosition()->y - center.y; } } - if (m_currentWaypoint==NULL && m_moveAsGroup) { + if (m_currentWaypoint==nullptr && m_moveAsGroup) { m_currentWaypoint = obj->getTeam()->getCurrentWaypoint(); } // set initial movement goal @@ -4023,7 +4023,7 @@ StateReturnType AIFollowWaypointPathState::update() if (m_moveAsGroup && m_currentWaypoint != obj->getTeam()->getCurrentWaypoint()) { m_priorWaypoint = m_currentWaypoint; m_currentWaypoint = obj->getTeam()->getCurrentWaypoint(); - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { return STATE_SUCCESS; } computeGoal(false); @@ -4094,7 +4094,7 @@ StateReturnType AIFollowWaypointPathState::update() // if there are no links from this waypoint, we're done - if (m_currentWaypoint==NULL) { + if (m_currentWaypoint==nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); return STATE_SUCCESS; @@ -4180,7 +4180,7 @@ StateReturnType AIFollowWaypointPathExactState::onEnter() const Waypoint *currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - if (currentWaypoint == NULL) return STATE_FAILURE; + if (currentWaypoint == nullptr) return STATE_FAILURE; getMachine()->setGoalPosition(currentWaypoint->getLocation()); @@ -4308,7 +4308,7 @@ AsciiString AIAttackFollowWaypointPathState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackFollowMachine) name.concat(m_attackFollowMachine->getCurrentStateName()); - else name.concat("*NULL m_attackFollowMachine"); + else name.concat("*null m_attackFollowMachine"); return name; } #endif @@ -4365,7 +4365,7 @@ StateReturnType AIAttackFollowWaypointPathState::update() nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); } - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { m_attackFollowMachine->setGoalObject(nextObjectToAttack); m_attackFollowMachine->setState( AI_ATTACK_OBJECT ); @@ -4443,8 +4443,8 @@ StateReturnType AIWanderState::onEnter() m_currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - m_priorWaypoint = NULL; - if (m_currentWaypoint == NULL || ai==NULL) + m_priorWaypoint = nullptr; + if (m_currentWaypoint == nullptr || ai==nullptr) return STATE_FAILURE; m_groupOffset.x = m_groupOffset.y = 0; Locomotor* curLoco = ai->getCurLocomotor(); @@ -4487,7 +4487,7 @@ StateReturnType AIWanderState::update() m_currentWaypoint = getNextWaypoint(); // if there are no links from this waypoint, we're done - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); @@ -4677,7 +4677,7 @@ StateReturnType AIPanicState::onEnter() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return STATE_FAILURE; // set initial movement goal Locomotor* curLoco = ai->getCurLocomotor(); @@ -4728,7 +4728,7 @@ StateReturnType AIPanicState::update() m_currentWaypoint = getNextWaypoint(); // if there are no links from this waypoint, we're done - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); @@ -4800,7 +4800,7 @@ StateReturnType AIAttackAimAtTargetState::onEnter() Object* victim = getMachineGoalObject(); const Coord3D* targetPos = getMachineGoalPosition(); AIUpdateInterface* sourceAI = source->getAI(); - AIUpdateInterface* victimAI = victim ? victim->getAI() : NULL; + AIUpdateInterface* victimAI = victim ? victim->getAI() : nullptr; Locomotor* curLoco = sourceAI->getCurLocomotor(); m_canTurnInPlace = curLoco ? curLoco->getMinSpeed() == 0.0f : false; @@ -4947,7 +4947,7 @@ StateReturnType AIAttackAimAtTargetState::update() if (fabs(relAngle) < aimDelta /*&& !m_preAttackFrames*/ ) { - AIUpdateInterface* victimAI = victim ? victim->getAI() : NULL; + AIUpdateInterface* victimAI = victim ? victim->getAI() : nullptr; // add ourself as a targeter BEFORE calling isTemporarilyPreventingAimSuccess(). // we do this every time thru, just in case we get into a squabble with our turret-ai // over whether or not we are a targeter... (srj) @@ -5018,7 +5018,7 @@ void AIAttackAimAtTargetState::onExit( StateExitType status ) StateReturnType AIAttackFireWeaponState::onEnter() { // contained by AIAttackState, so no separate timer - DEBUG_ASSERTCRASH(m_att != NULL, ("m_att may not be null")); + DEBUG_ASSERTCRASH(m_att != nullptr, ("m_att may not be null")); Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); @@ -5032,7 +5032,7 @@ StateReturnType AIAttackFireWeaponState::onEnter() Object *victim = getMachineGoalObject(); if (victim && obj->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { - if (obj->getTeam()->getTeamTargetObject()==NULL) { + if (obj->getTeam()->getTeamTargetObject()==nullptr) { obj->getTeam()->setTeamTargetObject(victim); } } @@ -5103,7 +5103,7 @@ StateReturnType AIAttackFireWeaponState::update() (victim->isDestroyed() || victim->isEffectivelyDead() || (victim->isKindOf(KINDOF_MINE) && victim->testStatus(OBJECT_STATUS_MASKED))) ) { - const Coord3D* originalVictimPos = m_att ? m_att->getOriginalVictimPos() : NULL; + const Coord3D* originalVictimPos = m_att ? m_att->getOriginalVictimPos() : nullptr; if (originalVictimPos) { // note that it is important to use getLastCommandSource here; this allows @@ -5114,7 +5114,7 @@ StateReturnType AIAttackFireWeaponState::update() PartitionFilterSamePlayer filterPlayer( victim->getControllingPlayer() ); PartitionFilterSameMapStatus filterMapStatus(obj); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, obj, lastCmdSource); - PartitionFilter *filters[] = { &filterAttack, &filterPlayer, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAttack, &filterPlayer, &filterMapStatus, nullptr }; // note that we look around originalVictimPos, *not* the current victim's pos. victim = ThePartitionManager->getClosestObject( originalVictimPos, continueRange, FROM_CENTER_2D, filters );// could be null. this is ok. if (victim) @@ -5180,13 +5180,13 @@ StateReturnType AIWaitState::update() //---------------------------------------------------------------------------------------------------------- AIAttackState::AIAttackState( StateMachine *machine, Bool follow, Bool attackingObject, Bool forceAttacking, AttackExitConditionsInterface* attackParameters) : State( machine , "AIAttackState"), - m_attackMachine(NULL), + m_attackMachine(nullptr), m_attackParameters(attackParameters), - m_lockedWeaponOnEnter(NULL), + m_lockedWeaponOnEnter(nullptr), m_follow(follow), m_isAttackingObject(attackingObject), m_isForceAttacking(forceAttacking), - m_victimTeam( NULL ) + m_victimTeam( nullptr ) { m_originalVictimPos.zero(); } @@ -5196,7 +5196,7 @@ AIAttackState::~AIAttackState() { // nope, don't do this, since we may well still have it targeted // even though we're leaving this state. - // turn it off when we do setCurrentVictim(NULL). + // turn it off when we do setCurrentVictim(nullptr). //addSelfAsTargeter(false); if (m_attackMachine) @@ -5223,12 +5223,12 @@ void AIAttackState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackMachine!=NULL; + Bool hasMachine = m_attackMachine!=nullptr; xfer->xferBool(&hasMachine); xfer->xferCoord3D(&m_originalVictimPos); - if (hasMachine && m_attackMachine==NULL) { + if (hasMachine && m_attackMachine==nullptr) { // create new state machine for attack behavior m_attackMachine = newInstance(AttackStateMachine)(getMachineOwner(), this, "AIAttackMachine", m_follow, m_isAttackingObject, m_isForceAttacking ); } @@ -5254,7 +5254,7 @@ void AIAttackState::loadPostProcess( void ) m_victimTeam = victim->getTeam(); } Object* source = getMachineOwner(); - m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : NULL; + m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : nullptr; } #ifdef STATE_MACHINE_DEBUG @@ -5264,7 +5264,7 @@ AsciiString AIAttackState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMachine) name.concat(m_attackMachine->getCurrentStateName()); - else name.concat("*NULL m_attackMachine"); + else name.concat("*null m_attackMachine"); return name; } #endif @@ -5340,7 +5340,7 @@ StateReturnType AIAttackState::onEnter() if (m_isAttackingObject) { Object* victim = getMachineGoalObject(); - if (victim == NULL || victim->isEffectivelyDead()) + if (victim == nullptr || victim->isEffectivelyDead()) { ai->notifyVictimIsDead(); return STATE_FAILURE; // we have nothing to attack! @@ -5365,7 +5365,7 @@ StateReturnType AIAttackState::onEnter() source->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); } - m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? curWeapon : NULL; + m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? curWeapon : nullptr; StateReturnType retType = m_attackMachine->initDefaultState(); if( retType == STATE_CONTINUE ) @@ -5403,7 +5403,7 @@ StateReturnType AIAttackState::update() { Object* victim = getMachineGoalObject(); - if (victim == NULL || victim->isEffectivelyDead()) + if (victim == nullptr || victim->isEffectivelyDead()) { source->getAI()->notifyVictimIsDead(); return STATE_SUCCESS; // my, that was easy @@ -5425,15 +5425,15 @@ StateReturnType AIAttackState::update() { if( !victim->getStatusBits().test( OBJECT_STATUS_CAN_ATTACK ) ) { - if ( victim->getContain() != NULL ) + if ( victim->getContain() != nullptr ) { if (victim->getContain()->isGarrisonable() && (victim->getContain()->getContainCount() == 0) ) { if ( source->getRelationship( victim ) == NEUTRAL ) { - ai->friend_setGoalObject(NULL); + ai->friend_setGoalObject(nullptr); if (victim==source->getTeam()->getTeamTargetObject()) { - source->getTeam()->setTeamTargetObject(NULL); + source->getTeam()->setTeamTargetObject(nullptr); } ai->notifyVictimIsDead(); // well, not "dead", but longer attackable return STATE_FAILURE; @@ -5447,9 +5447,9 @@ StateReturnType AIAttackState::update() // order matters: we want to know if I consider it to be an enemy, not vice versa if( source->getRelationship( victim ) != ENEMIES) { - ai->friend_setGoalObject(NULL); + ai->friend_setGoalObject(nullptr); if (victim==source->getTeam()->getTeamTargetObject()) { - source->getTeam()->setTeamTargetObject(NULL); + source->getTeam()->setTeamTargetObject(nullptr); } ai->notifyVictimIsDead(); // well, not "dead", but longer attackable return STATE_FAILURE; @@ -5470,11 +5470,11 @@ StateReturnType AIAttackState::update() // if we entered with a locked weapon (ie, a special weapon), then we will // only keep attacking as long as that weapon remains the cur weapon... // if anything ever changes that weapon, we exit attack mode immediately. - if (m_lockedWeaponOnEnter != NULL && m_lockedWeaponOnEnter != curWeapon) + if (m_lockedWeaponOnEnter != nullptr && m_lockedWeaponOnEnter != curWeapon) return STATE_FAILURE; // we've shot as many times as we are allowed to - if (curWeapon == NULL || curWeapon->getMaxShotCount() <= 0) + if (curWeapon == nullptr || curWeapon->getMaxShotCount() <= 0) return STATE_FAILURE; /** @@ -5494,12 +5494,12 @@ void AIAttackState::onExit( StateExitType status ) USE_PERF_TIMER(AIAttackState) // nope, don't do this, since we may well still have it targeted // even though we're leaving this state. turn it off when we - // turn it off when we do setCurrentVictim(NULL). + // turn it off when we do setCurrentVictim(nullptr). //addSelfAsTargeter(false); // destroy the attack machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; Object *obj = getMachineOwner(); obj->clearStatus( MAKE_OBJECT_STATUS_MASK4( OBJECT_STATUS_IS_FIRING_WEAPON, @@ -5514,10 +5514,10 @@ void AIAttackState::onExit( StateExitType status ) if (ai) { //ai->notifyVictimIsDead(); no, do NOT do this here. - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); for (int i = 0; i < MAX_TURRETS; ++i) - ai->setTurretTargetObject((WhichTurretType)i, NULL, 0); - ai->friend_setGoalObject(NULL); + ai->setTurretTargetObject((WhichTurretType)i, nullptr, 0); + ai->friend_setGoalObject(nullptr); } } @@ -5572,7 +5572,7 @@ void AIAttackThenIdleStateMachine::loadPostProcess( void ) AIAttackThenIdleStateMachine::AIAttackThenIdleStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) { // order matters: first state is the default state. - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, nullptr ), AI_IDLE, AI_IDLE ); defineState( AI_PICK_UP_CRATE, newInstance(AIPickUpCrateState)( this ), AI_IDLE, AI_IDLE ); defineState( AI_IDLE, newInstance(AIIdleState)( this, AIIdleState::DO_NOT_LOOK_FOR_TARGETS ), AI_IDLE, AI_IDLE ); } @@ -5612,11 +5612,11 @@ void AIAttackSquadState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackSquadMachine!=NULL; + Bool hasMachine = m_attackSquadMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_attackSquadMachine==NULL) { + if (hasMachine && m_attackSquadMachine==nullptr) { // create new state machine for attack behavior m_attackSquadMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackMachine" ); } @@ -5640,7 +5640,7 @@ AsciiString AIAttackSquadState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackSquadMachine) name.concat(m_attackSquadMachine->getCurrentStateName()); - else name.concat("*NULL m_attackSquadMachine"); + else name.concat("*null m_attackSquadMachine"); return name; } #endif @@ -5715,7 +5715,7 @@ void AIAttackSquadState::onExit( StateExitType status ) { // destroy the attack machine deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; + m_attackSquadMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5724,7 +5724,7 @@ Object *AIAttackSquadState::chooseVictim(void) Squad *victimSquad = ((AIStateMachine*)getMachine())->getGoalSquad(); if (!victimSquad) { - return NULL; + return nullptr; } Object *owner = getMachineOwner(); @@ -5735,20 +5735,20 @@ Object *AIAttackSquadState::chooseVictim(void) { if (moodVal & MM_Mood_Sleep) { - return NULL; + return nullptr; } if (moodVal & MM_Mood_Passive) { BodyModuleInterface *bmi = owner->getBodyModule(); if (!bmi) { - return NULL; + return nullptr; } const DamageInfo *di = bmi->getLastDamageInfo(); if (!di) { - return NULL; + return nullptr; } return TheGameLogic->findObjectByID(di->in.m_sourceID); @@ -5778,7 +5778,7 @@ Object *AIAttackSquadState::chooseVictim(void) Int numUnits = objects.size(); if (numUnits == 0) { - return NULL; + return nullptr; } Int unitToAttack = GameLogicRandomValue(0, numUnits - 1); @@ -5792,9 +5792,9 @@ Object *AIAttackSquadState::chooseVictim(void) PartitionFilterAcceptOnSquad f1(victimSquad); PartitionFilterSameMapStatus filterMapStatus(getMachineOwner()); - PartitionFilter *filters[] = { &f1, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &f1, &filterMapStatus, nullptr }; - Object *victim = ThePartitionManager->getClosestObject(getMachineOwner(), HUGE_DIST, FROM_CENTER_2D, filters, NULL, NULL); + Object *victim = ThePartitionManager->getClosestObject(getMachineOwner(), HUGE_DIST, FROM_CENTER_2D, filters, nullptr, nullptr); return victim; break; } @@ -5808,12 +5808,12 @@ Object *AIAttackSquadState::chooseVictim(void) return objects[0]; } - return NULL; + return nullptr; break; } }; - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5846,11 +5846,11 @@ void AIDockState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_dockMachine!=NULL; + Bool hasMachine = m_dockMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_dockMachine==NULL) { + if (hasMachine && m_dockMachine==nullptr) { // create new state machine for attack behavior m_dockMachine = newInstance(AIDockMachine)( getMachineOwner()); } @@ -5874,7 +5874,7 @@ AsciiString AIDockState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_dockMachine) name.concat(m_dockMachine->getCurrentStateName()); - else name.concat("*NULL m_dockMachine"); + else name.concat("*null m_dockMachine"); return name; } #endif @@ -5889,17 +5889,17 @@ StateReturnType AIDockState::onEnter() { // who are we docking with? Object *dockWithMe = getMachineGoalObject(); - if (dockWithMe == NULL) + if (dockWithMe == nullptr) { // we have nothing to dock with! DEBUG_LOG(("No goal in AIDockState::onEnter - exiting.")); return STATE_FAILURE; } - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; dock = dockWithMe->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) { + if (dock == nullptr) { DEBUG_LOG(("Goal is not a dock in AIDockState::onEnter - exiting.")); return STATE_FAILURE; } @@ -5930,7 +5930,7 @@ void AIDockState::onExit( StateExitType status ) if (m_dockMachine) { m_dockMachine->halt();// GS, you have to halt before you delete to do cleanup. deleteInstance(m_dockMachine); - m_dockMachine = NULL; + m_dockMachine = nullptr; } else { DEBUG_LOG(("Dock exited immediately")); } @@ -5940,7 +5940,7 @@ void AIDockState::onExit( StateExitType status ) if (ai) { ai->setCanPathThroughUnits(false); - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } } @@ -6059,7 +6059,7 @@ void AIEnterState::onExit( StateExitType status ) if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); if (ai->getCurLocomotor()) { ai->getCurLocomotor()->setAllowInvalidPosition(false); @@ -6096,7 +6096,7 @@ StateReturnType AIEnterState::update() // -- tell the humvee to enter a chinook // -- fly the chinook around; the rangers follow the chinook like dopes // this just bails in this case. (srj) - if (goal->getContainedBy() != NULL && goal->isAboveTerrain() && !obj->isAboveTerrain()) + if (goal->getContainedBy() != nullptr && goal->isAboveTerrain() && !obj->isAboveTerrain()) { return STATE_FAILURE; } @@ -6256,8 +6256,8 @@ StateReturnType AIExitState::update() //GS. The goal of unified ExitInterfaces dies a horrible death. I can't ask Object for the exit, // as removeFromContain is only in the Contain type. I'm spliting the names in shame. - ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : NULL; - if( goalExitInterface == NULL ) + ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : nullptr; + if( goalExitInterface == nullptr ) return STATE_FAILURE; if( goalExitInterface->isExitBusy() ) @@ -6321,7 +6321,7 @@ AsciiString AIGuardState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_guardMachine) name.concat(m_guardMachine->getCurrentStateName()); - else name.concat("*NULL guardMachine"); + else name.concat("*null guardMachine"); return name; } #endif @@ -6342,11 +6342,11 @@ void AIGuardState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_guardMachine!=NULL; + Bool hasMachine = m_guardMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_guardMachine==NULL) { + if (hasMachine && m_guardMachine==nullptr) { // create new state machine for guard behavior m_guardMachine = newInstance(AIGuardMachine)( getMachineOwner()); } @@ -6395,7 +6395,7 @@ StateReturnType AIGuardState::onEnter() void AIGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6406,7 +6406,7 @@ StateReturnType AIGuardState::update() { //DEBUG_LOG(("AIGuardState frame %d: %08lx",TheGameLogic->getFrame(),getMachineOwner())); - if (m_guardMachine == NULL) + if (m_guardMachine == nullptr) { return STATE_FAILURE; // We actually already exited. } @@ -6447,7 +6447,7 @@ AsciiString AITunnelNetworkGuardState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_guardMachine) name.concat(m_guardMachine->getCurrentStateName()); - else name.concat("*NULL guardMachine"); + else name.concat("*null guardMachine"); return name; } #endif @@ -6468,11 +6468,11 @@ void AITunnelNetworkGuardState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_guardMachine!=NULL; + Bool hasMachine = m_guardMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_guardMachine==NULL) { + if (hasMachine && m_guardMachine==nullptr) { // create new state machine for guard behavior m_guardMachine = newInstance(AITNGuardMachine)( getMachineOwner()); } @@ -6516,7 +6516,7 @@ StateReturnType AITunnelNetworkGuardState::onEnter() void AITunnelNetworkGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6527,7 +6527,7 @@ StateReturnType AITunnelNetworkGuardState::update() { //DEBUG_LOG(("AITunnelNetworkGuardState frame %d: %08lx",TheGameLogic->getFrame(),getMachineOwner())); - if (m_guardMachine == NULL) + if (m_guardMachine == nullptr) { return STATE_FAILURE; // We actually already exited. } @@ -6582,11 +6582,11 @@ void AIHuntState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_huntMachine!=NULL; + Bool hasMachine = m_huntMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_huntMachine==NULL) { + if (hasMachine && m_huntMachine==nullptr) { // create new state machine for hunt behavior m_huntMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackThenIdleStateMachine"); } @@ -6629,7 +6629,7 @@ void AIHuntState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_huntMachine); - m_huntMachine = NULL; + m_huntMachine = nullptr; Object *obj = getMachineOwner(); if (obj) @@ -6645,7 +6645,7 @@ AsciiString AIHuntState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_huntMachine) name.concat(m_huntMachine->getCurrentStateName()); - else name.concat("*NULL huntMachine"); + else name.concat("*null huntMachine"); return name; } #endif @@ -6677,17 +6677,17 @@ StateReturnType AIHuntState::update() m_nextEnemyScanTime = now + ENEMY_SCAN_RATE; - const AttackPriorityInfo *info = NULL; + const AttackPriorityInfo *info = nullptr; info = ai->getAttackInfo(); // Check if team auto targets same victim. - Object* teamVictim = NULL; + Object* teamVictim = nullptr; if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); } - Object* victim = NULL; - if (teamVictim && info==NULL) + Object* victim = nullptr; + if (teamVictim && info==nullptr) { victim = teamVictim; } @@ -6695,15 +6695,15 @@ StateReturnType AIHuntState::update() { // do NOT do line of sight check - we want to find everything victim = TheAI->findClosestEnemy( owner, 9999.9f, AI::CAN_ATTACK, info ); - if (victim==NULL && owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()) { + if (victim==nullptr && owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()) { // If we are doing an all hunt, try hunting without the attack priority info. jba. - victim = TheAI->findClosestEnemy(owner, 9999.9f, AI::CAN_ATTACK, NULL); + victim = TheAI->findClosestEnemy(owner, 9999.9f, AI::CAN_ATTACK, nullptr); } if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { // Check priorities. if (teamVictim && info) { - if (victim==NULL) { + if (victim==nullptr) { DEBUG_LOG(("Couldnt' find victim. hmm.")); victim = teamVictim; } @@ -6729,7 +6729,7 @@ StateReturnType AIHuntState::update() } if (owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()==FALSE) { // If we are not doing an all hunt, then exit hunt state - no more victims. - if (m_huntMachine->getCurrentStateID() == AI_IDLE && victim==NULL) { + if (m_huntMachine->getCurrentStateID() == AI_IDLE && victim==nullptr) { return STATE_SUCCESS; // we killed everything :) jba. } } @@ -6778,11 +6778,11 @@ void AIAttackAreaState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackMachine!=NULL; + Bool hasMachine = m_attackMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_attackMachine==NULL) { + if (hasMachine && m_attackMachine==nullptr) { // create new state machine for hunt behavior m_attackMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackThenIdleStateMachine"); } @@ -6807,7 +6807,7 @@ AsciiString AIAttackAreaState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMachine) name.concat(m_attackMachine->getCurrentStateName()); - else name.concat("*NULL m_attackMachine"); + else name.concat("*null m_attackMachine"); return name; } #endif @@ -6833,7 +6833,7 @@ void AIAttackAreaState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -6857,10 +6857,10 @@ StateReturnType AIAttackAreaState::update() m_nextEnemyScanTime = now + ENEMY_SCAN_RATE; AIUpdateInterface *ai = owner->getAI(); - if (ai->getAreaToGuard() == NULL) + if (ai->getAreaToGuard() == nullptr) return STATE_FAILURE; - const AttackPriorityInfo *info = NULL; + const AttackPriorityInfo *info = nullptr; info = ai->getAttackInfo(); PartitionFilterPolygonTrigger polyFilter(ai->getAreaToGuard()); @@ -6872,7 +6872,7 @@ StateReturnType AIAttackAreaState::update() { m_attackMachine->setState( AI_ATTACK_OBJECT ); } - if (victim==NULL) { + if (victim==nullptr) { return STATE_SUCCESS; } } @@ -6933,7 +6933,7 @@ StateReturnType AIFaceState::onEnter() m_canTurnInPlace = curLoco ? curLoco->getMinSpeed() == 0.0f : false; Object* target = getMachineGoalObject(); - if (m_obj && target == NULL ) + if (m_obj && target == nullptr ) { // Nothing to face... return STATE_FAILURE; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index 048c7163432..4990a49226f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -59,7 +59,7 @@ const Real CLOSE_ENOUGH = (25.0f); static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ ) { Object *obj = thisState->getMachineOwner(); - BodyModuleInterface *bmi = obj ? obj->getBodyModule() : NULL; + BodyModuleInterface *bmi = obj ? obj->getBodyModule() : nullptr; if (!(obj && bmi)) { return FALSE; @@ -102,9 +102,9 @@ static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ static Object *findBestTunnel(Player *ownerPlayer, const Coord3D *pos) { - if (!ownerPlayer) return NULL; // should never happen, but hey. jba. + if (!ownerPlayer) return nullptr; // should never happen, but hey. jba. TunnelTracker *tunnels = ownerPlayer->getTunnelSystem(); - Object *bestTunnel = NULL; + Object *bestTunnel = nullptr; Real bestDistSqr = 0; const std::list *allTunnels = tunnels->getContainerList(); for( std::list::const_iterator iter = allTunnels->begin(); iter != allTunnels->end(); iter++ ) { @@ -114,7 +114,7 @@ static Object *findBestTunnel(Player *ownerPlayer, const Coord3D *pos) Real dx = currentTunnel->getPosition()->x-pos->x; Real dy = currentTunnel->getPosition()->y-pos->y; Real distSqr = dx*dx+dy*dy; - if (bestTunnel==NULL || distSqrgetTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); @@ -205,7 +205,7 @@ Bool AITNGuardMachine::lookForInnerTarget(void) Player *ownerPlayer = getOwner()->getControllingPlayer(); if (!ownerPlayer) return false; // should never happen, but hey. jba. TunnelTracker *tunnels = ownerPlayer->getTunnelSystem(); - if (tunnels==NULL) return false; + if (tunnels==nullptr) return false; if (tunnels->getCurNemesis()) { setNemesisID(tunnels->getCurNemesis()->getID()); return true; // Transitions to AITNGuardInnerState. @@ -329,9 +329,9 @@ AITNGuardInnerState::~AITNGuardInnerState(void) StateReturnType AITNGuardInnerState::onEnter( void ) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardInnerState.")); return STATE_SUCCESS; } m_exitConditions.m_attackGiveUpFrame = TheGameLogic->getFrame() + TheAI->getAiData()->m_guardChaseUnitFrames; @@ -364,7 +364,7 @@ static Object *TunnelNetworkScan(Object *owner) Real visionRange = AITNGuardMachine::getStdGuardRange(owner); - filters[count++] = NULL; + filters[count++] = nullptr; Object* target = ThePartitionManager->getClosestObject(owner->getPosition(), visionRange, FROM_CENTER_2D, filters); return target; @@ -375,7 +375,7 @@ StateReturnType AITNGuardInnerState::update( void ) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -383,7 +383,7 @@ StateReturnType AITNGuardInnerState::update( void ) Object* owner = getMachineOwner(); // killed him. Object *teamVictim = owner->getTeam()->getTeamTargetObject(); - if (nemesis == NULL) + if (nemesis == nullptr) { if (teamVictim) { @@ -416,7 +416,7 @@ StateReturnType AITNGuardInnerState::update( void ) } } } else { - if (nemesis != teamVictim && teamVictim != NULL) { + if (nemesis != teamVictim && teamVictim != nullptr) { tunnels->updateNemesis(nemesis); getGuardMachine()->setNemesisID(teamVictim->getID()); } @@ -431,7 +431,7 @@ void AITNGuardInnerState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -479,9 +479,9 @@ StateReturnType AITNGuardOuterState::onEnter( void ) } Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardOuterState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardOuterState.")); return STATE_SUCCESS; } @@ -511,8 +511,8 @@ StateReturnType AITNGuardOuterState::update( void ) goalObj = nemesis; } // Check if team auto targets same victim. - Object *teamVictim = NULL; - if (goalObj == NULL && owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) + Object *teamVictim = nullptr; + if (goalObj == nullptr && owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); if (teamVictim) @@ -534,7 +534,7 @@ void AITNGuardOuterState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -583,7 +583,7 @@ StateReturnType AITNGuardReturnState::onEnter( void ) // Find tunnel network to enter. // Scan my tunnels. Object *bestTunnel = findBestTunnel(getMachineOwner()->getControllingPlayer(), getMachineOwner()->getPosition()); - if (bestTunnel==NULL) return STATE_FAILURE; + if (bestTunnel==nullptr) return STATE_FAILURE; getMachine()->setGoalObject(bestTunnel); getMachineOwner()->getAI()->friend_setGoalObject(bestTunnel); @@ -603,7 +603,7 @@ StateReturnType AITNGuardReturnState::update( void ) } } // Check tunnel for target. - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -669,7 +669,7 @@ StateReturnType AITNGuardIdleState::onEnter( void ) UnsignedInt now = TheGameLogic->getFrame(); m_nextEnemyScanTime = now + GameLogicRandomValue(0, TheAI->getAiData()->m_guardEnemyScanRate); - getMachineOwner()->getAI()->friend_setGoalObject(NULL); + getMachineOwner()->getAI()->friend_setGoalObject(nullptr); return STATE_CONTINUE; } @@ -684,7 +684,7 @@ StateReturnType AITNGuardIdleState::update( void ) m_nextEnemyScanTime = now + TheAI->getAiData()->m_guardEnemyScanRate; - getMachineOwner()->getAI()->friend_setGoalObject(NULL); + getMachineOwner()->getAI()->friend_setGoalObject(nullptr); #ifdef STATE_MACHINE_DEBUG //getMachine()->setDebugOutput(true); @@ -702,15 +702,15 @@ StateReturnType AITNGuardIdleState::update( void ) if (getGuardMachine()->lookForInnerTarget()) { Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardAttackAggressorState.")); return STATE_SLEEP(0); } if (getMachineOwner()->getContainedBy()) { Object *bestTunnel = findBestTunnel(owner->getControllingPlayer(), nemesis->getPosition()); - ExitInterface* goalExitInterface = bestTunnel->getContain() ? bestTunnel->getContain()->getContainExitInterface() : NULL; - if( goalExitInterface == NULL ) + ExitInterface* goalExitInterface = bestTunnel->getContain() ? bestTunnel->getContain()->getContainExitInterface() : nullptr; + if( goalExitInterface == nullptr ) return STATE_FAILURE; if( goalExitInterface->isExitBusy() ) @@ -775,7 +775,7 @@ void AITNGuardPickUpCrateState::onExit( StateExitType status ) AITNGuardAttackAggressorState::AITNGuardAttackAggressorState( StateMachine *machine ) : State( machine, "AITNGuardAttackAggressorState" ) { - m_attackState = NULL; + m_attackState = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -797,14 +797,14 @@ StateReturnType AITNGuardAttackAggressorState::onEnter( void ) } Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardAttackAggressorState.")); return STATE_SUCCESS; } Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -829,7 +829,7 @@ StateReturnType AITNGuardAttackAggressorState::update( void ) if (m_attackState->getMachine()->getCurrentStateID() == AttackStateMachine::FIRE_WEAPON) { Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -846,12 +846,12 @@ void AITNGuardAttackAggressorState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 157899e6900..6db33b94bf5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -84,7 +84,7 @@ void Squad::clearSquad() { // getAllObjects ////////////////////////////////////////////////////////////////////////////////// const VecObjectPtr& Squad::getAllObjects(void) // Not a const function cause we clear away dead object here too { - // prunes all NULL objects + // prunes all null objects m_objectsCached.clear(); for (VecObjectIDIt it = m_objectIDs.begin(); it != m_objectIDs.end(); ) { Object *obj = TheGameLogic->findObjectByID(*it); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index c9270e89047..3bd0218a97d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -85,8 +85,8 @@ TurretStateMachine::TurretStateMachine( TurretAI* tai, Object *obj, AsciiString { static const StateConditionInfo fireConditions[] = { - StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -203,7 +203,7 @@ static void parseTWS(INI* ini, void * /*instance*/, void * store, const void* /* { UnsignedInt* tws = (UnsignedInt*)store; const char* token = ini->getNextToken(); - while (token != NULL) + while (token != nullptr) { WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(token, TheWeaponSlotTypeNames); *tws |= (1 << wslot); @@ -216,7 +216,7 @@ void TurretAIData::parseTurretSweep(INI* ini, void *instance, void * /*store*/, { TurretAIData* self = (TurretAIData*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseAngleReal( ini, instance, &self->m_turretFireAngleSweep[wslot], NULL ); + INI::parseAngleReal( ini, instance, &self->m_turretFireAngleSweep[wslot], nullptr ); } //------------------------------------------------------------------------------------------------- @@ -224,7 +224,7 @@ void TurretAIData::parseTurretSweepSpeed(INI* ini, void *instance, void * /*stor { TurretAIData* self = (TurretAIData*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseReal( ini, instance, &self->m_turretSweepSpeedModifier[wslot], NULL ); + INI::parseReal( ini, instance, &self->m_turretSweepSpeedModifier[wslot], nullptr ); } //---------------------------------------------------------------------------------------------------------- @@ -232,28 +232,28 @@ void TurretAIData::buildFieldParse(MultiIniFieldParse& p) { static const FieldParse dataFieldParse[] = { - { "TurretTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( TurretAIData, m_turnRate ) }, - { "TurretPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( TurretAIData, m_pitchRate ) }, - { "NaturalTurretAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_naturalTurretAngle ) }, - { "NaturalTurretPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_naturalTurretPitch ) }, - { "FirePitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_firePitch ) }, - { "MinPhysicalPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_minPitch ) }, - { "GroundUnitPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_groundUnitPitch ) }, - { "TurretFireAngleSweep", TurretAIData::parseTurretSweep, NULL, NULL }, - { "TurretSweepSpeedModifier",TurretAIData::parseTurretSweepSpeed, NULL, NULL }, - { "ControlledWeaponSlots", parseTWS, NULL, offsetof( TurretAIData, m_turretWeaponSlots ) }, - { "AllowsPitch", INI::parseBool, NULL, offsetof( TurretAIData, m_isAllowsPitch ) }, + { "TurretTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( TurretAIData, m_turnRate ) }, + { "TurretPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( TurretAIData, m_pitchRate ) }, + { "NaturalTurretAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_naturalTurretAngle ) }, + { "NaturalTurretPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_naturalTurretPitch ) }, + { "FirePitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_firePitch ) }, + { "MinPhysicalPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_minPitch ) }, + { "GroundUnitPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_groundUnitPitch ) }, + { "TurretFireAngleSweep", TurretAIData::parseTurretSweep, nullptr, 0 }, + { "TurretSweepSpeedModifier",TurretAIData::parseTurretSweepSpeed, nullptr, 0 }, + { "ControlledWeaponSlots", parseTWS, nullptr, offsetof( TurretAIData, m_turretWeaponSlots ) }, + { "AllowsPitch", INI::parseBool, nullptr, offsetof( TurretAIData, m_isAllowsPitch ) }, #ifdef INTER_TURRET_DELAY - { "InterTurretDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_interTurretDelay ) }, + { "InterTurretDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_interTurretDelay ) }, #endif - { "MinIdleScanAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_minIdleScanAngle ) }, - { "MaxIdleScanAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_maxIdleScanAngle ) }, - { "MinIdleScanInterval", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_minIdleScanInterval ) }, - { "MaxIdleScanInterval", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_maxIdleScanInterval ) }, - { "RecenterTime", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_recenterTime ) }, - { "InitiallyDisabled", INI::parseBool, NULL, offsetof( TurretAIData, m_initiallyDisabled ) }, - { "FiresWhileTurning", INI::parseBool, NULL, offsetof( TurretAIData, m_firesWhileTurning ) }, - { 0, 0, 0, 0 } + { "MinIdleScanAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_minIdleScanAngle ) }, + { "MaxIdleScanAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_maxIdleScanAngle ) }, + { "MinIdleScanInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_minIdleScanInterval ) }, + { "MaxIdleScanInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_maxIdleScanInterval ) }, + { "RecenterTime", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_recenterTime ) }, + { "InitiallyDisabled", INI::parseBool, nullptr, offsetof( TurretAIData, m_initiallyDisabled ) }, + { "FiresWhileTurning", INI::parseBool, nullptr, offsetof( TurretAIData, m_firesWhileTurning ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -268,7 +268,7 @@ TurretAI::TurretAI(Object* owner, const TurretAIData* data, WhichTurretType tur) m_owner(owner), m_whichTurret(tur), m_data(data), - m_turretStateMachine(NULL), + m_turretStateMachine(nullptr), m_playRotSound(false), m_playPitchSound(false), m_positiveSweep(true), @@ -280,7 +280,7 @@ TurretAI::TurretAI(Object* owner, const TurretAIData* data, WhichTurretType tur) m_enabled(!data->m_initiallyDisabled), m_firesWhileTurning(data->m_firesWhileTurning), m_isForceAttacking(false), - m_victimInitialTeam(NULL) + m_victimInitialTeam(nullptr) { m_continuousFireExpirationFrame = -1; if (!m_data) @@ -493,7 +493,7 @@ Bool TurretAI::isOwnersCurWeaponOnTurret() const { WeaponSlotType wslot; Weapon* w = m_owner->getCurrentWeapon(&wslot); - return w != NULL && isWeaponSlotOnTurret(wslot); + return w != nullptr && isWeaponSlotOnTurret(wslot); } //---------------------------------------------------------------------------------------------------------- @@ -505,7 +505,7 @@ Bool TurretAI::isWeaponSlotOnTurret(WeaponSlotType wslot) const //---------------------------------------------------------------------------------------------------------- TurretTargetType TurretAI::friend_getTurretTarget(Object*& obj, Coord3D& pos) const { - obj = NULL; + obj = nullptr; pos.zero(); if (m_target == TARGET_OBJECT) @@ -513,16 +513,16 @@ TurretTargetType TurretAI::friend_getTurretTarget(Object*& obj, Coord3D& pos) co obj = m_turretStateMachine->getGoalObject(); // clear it explicitly if null -- could be deceased but holding the // old (bogus) objectid internally - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { - m_turretStateMachine->setGoalObject(NULL); + m_turretStateMachine->setGoalObject(nullptr); m_target = TARGET_NONE; m_targetWasSetByIdleMood = false; } } else if (m_target == TARGET_POSITION) { - obj = NULL; + obj = nullptr; pos = *m_turretStateMachine->getGoalPosition(); } @@ -533,11 +533,11 @@ TurretTargetType TurretAI::friend_getTurretTarget(Object*& obj, Coord3D& pos) co void TurretAI::removeSelfAsTargeter() { // be paranoid, in case we are called from dtors, etc. - if (m_target == TARGET_OBJECT && m_turretStateMachine != NULL) + if (m_target == TARGET_OBJECT && m_turretStateMachine != nullptr) { Object* self = m_owner; Object* target = m_turretStateMachine->getGoalObject(); - if (self != NULL && target != NULL) + if (self != nullptr && target != nullptr) { AIUpdateInterface* targetAI = target->getAI(); if (targetAI) @@ -555,10 +555,10 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) victim->isEffectivelyDead() || !isOwnersCurWeaponOnTurret()) { - victim = NULL; + victim = nullptr; } - if (victim == NULL) + if (victim == nullptr) { // if nuking the victim, remove self as targeter before doing anything else. // (note that we never ADD self as targeter here; that is done in the aim state) @@ -571,7 +571,7 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) m_isForceAttacking = forceAttacking; StateID sid = m_turretStateMachine->getCurrentStateID(); - if (victim != NULL) + if (victim != nullptr) { // if we're already in the aim state, don't call setState, since // it would go thru the exit/enter stuff, which we don't really want @@ -585,7 +585,7 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) // only change states if we are aiming. if (sid == TURRETAI_AIM || sid == TURRETAI_FIRE) m_turretStateMachine->setState(TURRETAI_HOLD); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } } @@ -594,35 +594,35 @@ void TurretAI::setTurretTargetPosition( const Coord3D* pos ) { if (!pos || !isOwnersCurWeaponOnTurret()) { - pos = NULL; + pos = nullptr; } // remove self as targeter before doing anything else. // (note that we never ADD self as targeter here; that is done in the aim state) removeSelfAsTargeter(); - m_turretStateMachine->setGoalObject( NULL ); + m_turretStateMachine->setGoalObject( nullptr ); if (pos) m_turretStateMachine->setGoalPosition( pos ); m_target = pos ? TARGET_POSITION : TARGET_NONE; m_targetWasSetByIdleMood = false; StateID sid = m_turretStateMachine->getCurrentStateID(); - if (pos != NULL) + if (pos != nullptr) { // if we're already in the aim state, don't call setState, since // it would go thru the exit/enter stuff, which we don't really want // to do... if (sid != TURRETAI_AIM && sid != TURRETAI_FIRE) m_turretStateMachine->setState( TURRETAI_AIM ); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } else { // only change states if we are aiming. if (sid == TURRETAI_AIM || sid == TURRETAI_FIRE) m_turretStateMachine->setState(TURRETAI_HOLD); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } } @@ -779,7 +779,7 @@ void TurretAI::getOtherTurretWeaponInfo(Int& numSelf, Int& numSelfReloading, Int { // ignore empty slots. const Weapon* w = getOwner()->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; // ignore the weapons on this turret. @@ -811,7 +811,7 @@ Bool TurretAI::friend_isAnyWeaponInRangeOf(const Object* o) const { // ignore empty slots. const Weapon* w = getOwner()->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL || !isWeaponSlotOnTurret((WeaponSlotType)i)) + if (w == nullptr || !isWeaponSlotOnTurret((WeaponSlotType)i)) continue; if (w->isWithinAttackRange(getOwner(), o) @@ -949,7 +949,7 @@ StateReturnType TurretAIAimTurretState::update() } Object* enemy; - AIUpdateInterface* enemyAI=NULL; + AIUpdateInterface* enemyAI=nullptr; Coord3D enemyPosition; Bool preventing = false; TurretTargetType targetType = turret->friend_getTurretTarget(enemy, enemyPosition); @@ -981,14 +981,14 @@ StateReturnType TurretAIAimTurretState::update() } nothingInRange = !turret->friend_isAnyWeaponInRangeOf(enemy); - if (enemy == NULL || !ableToAttackTarget || + if (enemy == nullptr || !ableToAttackTarget || (!isPrimaryEnemy && nothingInRange) || enemy->getTeam() != turret->friend_getVictimInitialTeam() ) { if (turret->friend_getTargetWasSetByIdleMood()) { - turret->setTurretTargetObject(NULL, FALSE); + turret->setTurretTargetObject(nullptr, FALSE); } return STATE_FAILURE; } @@ -1014,7 +1014,7 @@ StateReturnType TurretAIAimTurretState::update() enemyPosition = *enemy->getPosition(); } - enemyAI = enemy ? enemy->getAI() : NULL; + enemyAI = enemy ? enemy->getAI() : nullptr; // add ourself as a targeter BEFORE calling isTemporarilyPreventingAimSuccess(). // we do this every time thru, just in case we get into a squabble with our ai @@ -1026,7 +1026,7 @@ StateReturnType TurretAIAimTurretState::update() // don't use 'enemy' after this point, just the position. to help // enforce this, we'll null it out. - enemy = NULL; + enemy = nullptr; break; } @@ -1041,7 +1041,7 @@ StateReturnType TurretAIAimTurretState::update() Weapon *curWeapon = obj->getCurrentWeapon( &slot ); if (!curWeapon) { - DEBUG_CRASH(("TurretAIAimTurretState::update - curWeapon is NULL.")); + DEBUG_CRASH(("TurretAIAimTurretState::update - curWeapon is null.")); return STATE_FAILURE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 4026e72869c..81f6b5c8ad8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -36,14 +36,14 @@ #include "GameLogic/TerrainLogic.h" /* ********* PolygonTrigger class ****************************/ -PolygonTrigger *PolygonTrigger::ThePolygonTriggerListPtr = NULL; +PolygonTrigger *PolygonTrigger::ThePolygonTriggerListPtr = nullptr; Int PolygonTrigger::s_currentID = 1; /** PolygonTrigger - Constructor. */ PolygonTrigger::PolygonTrigger(Int initialAllocation) : -m_nextPolygonTrigger(NULL), -m_points(NULL), +m_nextPolygonTrigger(nullptr), +m_points(nullptr), m_numPoints(0), m_sizePoints(0), m_exportWithScripts(false), @@ -67,14 +67,14 @@ m_riverStart(0) PolygonTrigger::~PolygonTrigger(void) { delete [] m_points; - m_points = NULL; + m_points = nullptr; if (m_nextPolygonTrigger) { PolygonTrigger *cur = m_nextPolygonTrigger; PolygonTrigger *next; while (cur) { next = cur->getNext(); - cur->setNextPoly(NULL); // prevents recursion. + cur->setNextPoly(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -119,7 +119,7 @@ PolygonTrigger *PolygonTrigger::getPolygonTriggerByID(Int triggerID) return poly; // not found - return NULL; + return nullptr; } @@ -142,7 +142,7 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu AsciiString triggerName; // Remove any existing polygon triggers, if any. PolygonTrigger::deleteTriggers(); // just in case. - PolygonTrigger *pPrevTrig = NULL; + PolygonTrigger *pPrevTrig = nullptr; ICoord3D loc; count = file.readInt(); while (count>0) { @@ -293,7 +293,7 @@ void PolygonTrigger::addPolygonTrigger(PolygonTrigger *pTrigger) */ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) { - PolygonTrigger *pPrev = NULL; + PolygonTrigger *pPrev = nullptr; PolygonTrigger *pTrig=getFirstPolygonTrigger(); for (; pTrig; pTrig = pTrig->getNext()) { if (pTrig==pTrigger) break; @@ -309,7 +309,7 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) ThePolygonTriggerListPtr = pTrig->m_nextPolygonTrigger; } } - pTrigger->m_nextPolygonTrigger = NULL; + pTrigger->m_nextPolygonTrigger = nullptr; } /** @@ -318,7 +318,7 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) void PolygonTrigger::deleteTriggers(void) { PolygonTrigger *pList = ThePolygonTriggerListPtr; - ThePolygonTriggerListPtr = NULL; + ThePolygonTriggerListPtr = nullptr; s_currentID = 1; deleteInstance(pList); } @@ -403,7 +403,7 @@ void PolygonTrigger::deletePoint(Int ndx) void PolygonTrigger::getCenterPoint(Coord3D* pOutCoord) const { - DEBUG_ASSERTCRASH(pOutCoord != NULL, ("pOutCoord was null. Non-Fatal, but shouldn't happen.")); + DEBUG_ASSERTCRASH(pOutCoord != nullptr, ("pOutCoord was null. Non-Fatal, but shouldn't happen.")); if (!pOutCoord) { return; } @@ -474,7 +474,7 @@ const WaterHandle* PolygonTrigger::getWaterHandle(void) const if( isWaterArea() ) return &m_waterHandle; - return NULL; // this polygon trigger is not a water area + return nullptr; // this polygon trigger is not a water area } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index c660fdf1214..40bd4ee43cc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -63,14 +63,14 @@ static const Int K_SIDES_DATA_VERSION_3 = 3; // includes Team list. SidesInfo - Constructor. */ SidesInfo::SidesInfo(void) : - m_pBuildList(NULL), - m_scripts(NULL) + m_pBuildList(nullptr), + m_scripts(nullptr) { } SidesInfo::SidesInfo(const SidesInfo& thatref) : - m_pBuildList(NULL), - m_scripts(NULL) + m_pBuildList(nullptr), + m_scripts(nullptr) { *this = thatref; } @@ -86,12 +86,12 @@ SidesInfo::~SidesInfo(void) void SidesInfo::init(const Dict* d) { deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; m_dict.clear(); deleteInstance(m_scripts); - m_scripts = NULL; + m_scripts = nullptr; if (d) m_dict = *d; @@ -105,12 +105,12 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) this->clear(); this->m_dict = that.m_dict; - BuildListInfo* thisBLTail = NULL; + BuildListInfo* thisBLTail = nullptr; for (BuildListInfo* thatBL = that.m_pBuildList; thatBL; thatBL = thatBL->getNext()) { BuildListInfo* thisBL = newInstance( BuildListInfo ); *thisBL = *thatBL; - thisBL->setNextBuildList(NULL); + thisBL->setNextBuildList(nullptr); if (thisBLTail) thisBLTail->setNextBuildList(thisBL); @@ -123,7 +123,7 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) if (that.m_scripts) this->m_scripts = that.m_scripts->duplicate(); else - this->m_scripts = NULL; + this->m_scripts = nullptr; } return *this; } @@ -134,11 +134,11 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) */ void SidesInfo::addToBuildList(BuildListInfo *pBuildList, Int position) { - DEBUG_ASSERTLOG(pBuildList->getNext()==NULL, ("WARNING***Adding already linked element.")); - BuildListInfo *pCur = NULL; + DEBUG_ASSERTLOG(pBuildList->getNext()==nullptr, ("WARNING***Adding already linked element.")); + BuildListInfo *pCur = nullptr; while (position) { position--; - if (pCur==NULL) { + if (pCur==nullptr) { pCur = m_pBuildList; } else { if (pCur->getNext()) { @@ -148,7 +148,7 @@ void SidesInfo::addToBuildList(BuildListInfo *pBuildList, Int position) } } } - if (pCur==NULL) { + if (pCur==nullptr) { // add to front of list. pBuildList->setNextBuildList(m_pBuildList); m_pBuildList = pBuildList; @@ -175,8 +175,8 @@ void SidesInfo::reorderInBuildList(BuildListInfo *pBuildList, Int newPosition) */ Int SidesInfo::removeFromBuildList(BuildListInfo *pBuildList) { - DEBUG_ASSERTCRASH(pBuildList, ("Removing NULL list.")); - if (pBuildList==NULL) return 0; + DEBUG_ASSERTCRASH(pBuildList, ("Removing null list.")); + if (pBuildList==nullptr) return 0; Int position = 0; @@ -196,12 +196,12 @@ Int SidesInfo::removeFromBuildList(BuildListInfo *pBuildList) pPrev->setNextBuildList(pBuildList->getNext()); } } - pBuildList->setNextBuildList(NULL); + pBuildList->setNextBuildList(nullptr); return position; } /* ********* SidesList class ****************************/ -/*extern*/ SidesList *TheSidesList = NULL; ///< singleton instance of SidesList +/*extern*/ SidesList *TheSidesList = nullptr; ///< singleton instance of SidesList /** SidesList - Constructor. */ @@ -246,7 +246,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v { DEBUG_ASSERTCRASH(TheSidesList, ("TheSidesList is null")); - if (TheSidesList==NULL) + if (TheSidesList==nullptr) return false; TheSidesList->clear(); @@ -297,7 +297,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v } file.registerParser( "PlayerScriptsList", info->label, ScriptList::ParseScriptsDataChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { throw(ERROR_CORRUPT_FILE_FORMAT); } ScriptList *scripts[MAX_PLAYER_COUNT]; @@ -306,11 +306,11 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v if (igetNumSides()) { deleteInstance(TheSidesList->getSideInfo(i)->getScriptList()); TheSidesList->getSideInfo(i)->setScriptList(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } else { // Read in more players worth than we have. deleteInstance(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } } TheSidesList->validateSides(); @@ -330,7 +330,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v void SidesList::WriteSidesDataChunk(DataChunkOutput &chunkWriter) { DEBUG_ASSERTCRASH(TheSidesList, ("TheSidesList is null")); - if (TheSidesList==NULL) + if (TheSidesList==nullptr) return; /**********HEIGHT MAP DATA ***********************/ chunkWriter.openDataChunk("SidesList", K_SIDES_DATA_VERSION_3); @@ -388,12 +388,12 @@ void SidesList::WriteSidesDataChunk(DataChunkOutput &chunkWriter) } -TeamsInfo *SidesList::findTeamInfo(AsciiString name, Int* index /*= NULL*/) +TeamsInfo *SidesList::findTeamInfo(AsciiString name, Int* index /*= nullptr*/) { return m_teamrec.findTeamInfo(name, index); } -SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= NULL*/) +SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numSides; i++) { @@ -404,10 +404,10 @@ SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= NULL*/) return &m_sides[i]; } } - return NULL; + return nullptr; } -SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= NULL*/) +SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numSkirmishSides; i++) { @@ -418,7 +418,7 @@ SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= NULL return &m_skirmishSides[i]; } } - return NULL; + return nullptr; } static AsciiString static_readPlayerNames[MAX_PLAYER_COUNT]; @@ -500,9 +500,9 @@ void SidesList::prepareForMP_or_Skirmish(void) // Don't consider FactionCivilian. continue; } - if (m_skirmishSides[i].getScriptList()==NULL) continue; - if (m_skirmishSides[i].getScriptList()->getScript() != NULL || - m_skirmishSides[i].getScriptList()->getScriptGroup()!=NULL) { + if (m_skirmishSides[i].getScriptList()==nullptr) continue; + if (m_skirmishSides[i].getScriptList()->getScript() != nullptr || + m_skirmishSides[i].getScriptList()->getScriptGroup()!=nullptr) { gotScripts = true; } } @@ -538,7 +538,7 @@ void SidesList::prepareForMP_or_Skirmish(void) deleteInstance(getSkirmishSideInfo(curSide)->getScriptList()); getSkirmishSideInfo(curSide)->setScriptList(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } for (i=0; igetAsciiString(TheKey_teamName); AsciiString towner = tdict->getAsciiString(TheKey_teamOwner); SidesInfo* si = findSideInfo(towner); - if (si == NULL || towner == tname) + if (si == nullptr || towner == tname) { DEBUG_LOG(("bad owner %s; reparenting to neutral...",towner.str())); tdict->setAsciiString(TheKey_teamOwner, AsciiString::TheEmptyString); @@ -868,8 +868,8 @@ void SidesList::xfer( Xfer *xfer ) scriptList = getSideInfo( i )->getScriptList(); scriptListPresent = scriptList ? TRUE : FALSE; xfer->xferBool( &scriptListPresent ); - if( (scriptList == NULL && scriptListPresent == TRUE) || - (scriptList != NULL && scriptListPresent == FALSE) ) + if( (scriptList == nullptr && scriptListPresent == TRUE) || + (scriptList != nullptr && scriptListPresent == FALSE) ) { DEBUG_CRASH(( "SidesList::xfer - script list missing/present mismatch" )); @@ -896,9 +896,9 @@ void SidesList::loadPostProcess( void ) BuildListInfo - Constructor. */ BuildListInfo::BuildListInfo(void) : -m_nextBuildList(NULL), -m_renderObj(NULL), -m_shadowObj(NULL), +m_nextBuildList(nullptr), +m_renderObj(nullptr), +m_shadowObj(nullptr), m_isInitiallyBuilt(false), m_numRebuilds(0), m_angle(0), @@ -940,7 +940,7 @@ BuildListInfo::~BuildListInfo(void) BuildListInfo *next; while (cur) { next = cur->getNext(); - cur->setNextBuildList(NULL); // prevents recursion. + cur->setNextBuildList(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -954,14 +954,14 @@ void BuildListInfo::parseStructure(INI *ini, void *instance, void* /*store*/, co static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( BuildListInfo, m_buildingName ) }, - { "Location", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_location ) }, - { "Rebuilds", INI::parseInt, NULL, offsetof( BuildListInfo, m_numRebuilds ) }, - { "Angle", INI::parseAngleReal, NULL, offsetof( BuildListInfo, m_angle ) }, - { "InitiallyBuilt", INI::parseBool, NULL, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, - { "RallyPointOffset", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_rallyPointOffset ) }, - { "AutomaticallyBuild", INI::parseBool, NULL, offsetof( BuildListInfo, m_automaticallyBuild ) }, - { NULL, NULL, NULL, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( BuildListInfo, m_buildingName ) }, + { "Location", INI::parseCoord2D, nullptr, offsetof( BuildListInfo, m_location ) }, + { "Rebuilds", INI::parseInt, nullptr, offsetof( BuildListInfo, m_numRebuilds ) }, + { "Angle", INI::parseAngleReal, nullptr, offsetof( BuildListInfo, m_angle ) }, + { "InitiallyBuilt", INI::parseBool, nullptr, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, + { "RallyPointOffset", INI::parseCoord2D, nullptr, offsetof( BuildListInfo, m_rallyPointOffset ) }, + { "AutomaticallyBuild", INI::parseBool, nullptr, offsetof( BuildListInfo, m_automaticallyBuild ) }, + { nullptr, nullptr, nullptr, 0 } }; BuildListInfo *buildInfo = newInstance( BuildListInfo ); @@ -978,13 +978,13 @@ BuildListInfo *BuildListInfo::duplicate(void) { BuildListInfo *first = newInstance( BuildListInfo ); *first = *this; - first->m_nextBuildList = NULL; + first->m_nextBuildList = nullptr; BuildListInfo *next = this->m_nextBuildList; BuildListInfo *cur = first; while (next) { BuildListInfo *link = newInstance( BuildListInfo ); *link = *next; - link->m_nextBuildList = NULL; + link->m_nextBuildList = nullptr; cur->m_nextBuildList = link; cur = link; next = next->m_nextBuildList; @@ -1052,12 +1052,12 @@ void BuildListInfo::loadPostProcess( void ) /* ********* TeamsInfoRec class ****************************/ TeamsInfoRec::TeamsInfoRec() : - m_numTeams(0), m_numTeamsAllocated(0), m_teams(NULL) + m_numTeams(0), m_numTeamsAllocated(0), m_teams(nullptr) { } TeamsInfoRec::TeamsInfoRec(const TeamsInfoRec& thatref) : - m_numTeams(0), m_numTeamsAllocated(0), m_teams(NULL) + m_numTeams(0), m_numTeamsAllocated(0), m_teams(nullptr) { *this = thatref; } @@ -1092,10 +1092,10 @@ void TeamsInfoRec::clear() m_numTeams = 0; m_numTeamsAllocated = 0; delete [] m_teams; - m_teams = NULL; + m_teams = nullptr; } -TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= NULL*/) +TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numTeams; ++i) { @@ -1106,7 +1106,7 @@ TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= NULL*/) return &m_teams[i]; } } - return NULL; + return nullptr; } void TeamsInfoRec::addTeam(const Dict* d) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index 2a1898c62d3..76064d4bfb4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -61,7 +61,7 @@ // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -TerrainLogic *TheTerrainLogic = NULL; +TerrainLogic *TheTerrainLogic = nullptr; // STATIC ///////////////////////////////////////////////////////////////////////////////////////// WaterHandle TerrainLogic::m_gridWaterHandle; @@ -73,7 +73,7 @@ WaterHandle TerrainLogic::m_gridWaterHandle; Waypoint::Waypoint(WaypointID id, AsciiString name, const Coord3D *pLoc, AsciiString label1, AsciiString label2, AsciiString label3, Bool biDirectional) : m_name(name), -m_pNext(NULL), +m_pNext(nullptr), m_location(*pLoc), m_id(id), m_pathLabel1(label1), @@ -84,7 +84,7 @@ m_biDirectional(biDirectional) { Int i; for (i=0; isetTower( towerType, tower ); // tie the bridge to us BridgeTowerBehaviorInterface *bridgeTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( tower ); - DEBUG_ASSERTCRASH( bridgeTowerInterface != NULL, ("Bridge::createTower - no 'BridgeTowerBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeTowerInterface != nullptr, ("Bridge::createTower - no 'BridgeTowerBehaviorInterface' found") ); if( bridgeTowerInterface ) { @@ -244,7 +244,7 @@ m_bridgeInfo(theInfo) DEBUG_LOG(("*** GenericBridge template not found.")); return; } - Object *bridge = TheThingFactory->newObject(genericBridgeTemplate, NULL); + Object *bridge = TheThingFactory->newObject(genericBridgeTemplate, nullptr); Coord3D center; center.x = (m_bridgeInfo.fromLeft.x + m_bridgeInfo.toRight.x)/2.0f; center.y = (m_bridgeInfo.fromLeft.y + m_bridgeInfo.toRight.y)/2.0f; @@ -268,7 +268,7 @@ m_bridgeInfo(theInfo) // get the template of the bridge TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - if( bridgeTemplate == NULL ) { + if( bridgeTemplate == nullptr ) { DEBUG_LOG(( "*** Bridge Template Not Found '%s'.", bridgeTemplateName.str() )); return; } @@ -319,7 +319,7 @@ m_bridgeInfo(theInfo) } #endif - m_next = NULL; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -379,7 +379,7 @@ Bridge::Bridge(Object *bridgeObj) // get the template of the bridge AsciiString bridgeTemplateName = bridgeObj->getTemplate()->getName(); TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - if( bridgeTemplate == NULL ) { + if( bridgeTemplate == nullptr ) { DEBUG_LOG(( "*** Bridge Template Not Found '%s'.", bridgeTemplateName.str() )); return; } @@ -433,7 +433,7 @@ Bridge::Bridge(Object *bridgeObj) } - m_next = NULL; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -862,7 +862,7 @@ Drawable *Bridge::pickBridge(const Vector3 &from, const Vector3 &to, Vector3 *po return bridge->getDrawable(); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -916,7 +916,7 @@ void Bridge::updateDamageState( void ) // code will take care of that // BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridge ); - if( bbi == NULL || bbi->isScaffoldPresent() == FALSE ) + if( bbi == nullptr || bbi->isScaffoldPresent() == FALSE ) TheAI->pathfinder()->changeBridgeState(m_layer, true); m_bridgeInfo.damageStateChanged = true; } @@ -964,7 +964,7 @@ TerrainLogic::TerrainLogic() for( i = 0; i < MAX_DYNAMIC_WATER; ++i ) { - m_waterToUpdate[ i ].waterTable = NULL; + m_waterToUpdate[ i ].waterTable = nullptr; m_waterToUpdate[ i ].changePerFrame = 0.0f; m_waterToUpdate[ i ].targetHeight = 0.0f; m_waterToUpdate[ i ].damageAmount = 0.0f; @@ -973,9 +973,9 @@ TerrainLogic::TerrainLogic() } m_numWaterToUpdate = 0; - m_waypointListHead = NULL; - m_bridgeListHead = NULL; - m_mapData = NULL; + m_waypointListHead = nullptr; + m_bridgeListHead = nullptr; + m_mapData = nullptr; m_bridgeDamageStatesChanged = FALSE; m_mapDX = 0; m_mapDY = 0; @@ -1214,19 +1214,19 @@ void TerrainLogic::enableWaterGrid( Bool enable ) } - TheTerrainVisual->setWaterGridHeightClamps( NULL, + TheTerrainVisual->setWaterGridHeightClamps( nullptr, TheGlobalData->m_vertexWaterHeightClampLow[ waterSettingIndex ], TheGlobalData->m_vertexWaterHeightClampHi[ waterSettingIndex ] ); - TheTerrainVisual->setWaterTransform( NULL, + TheTerrainVisual->setWaterTransform( nullptr, TheGlobalData->m_vertexWaterAngle[ waterSettingIndex ], TheGlobalData->m_vertexWaterXPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterYPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterZPosition[ waterSettingIndex ] ); - TheTerrainVisual->setWaterGridResolution( NULL, + TheTerrainVisual->setWaterGridResolution( nullptr, TheGlobalData->m_vertexWaterXGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterYGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterGridSize[ waterSettingIndex ] ); - TheTerrainVisual->setWaterAttenuationFactors( NULL, + TheTerrainVisual->setWaterAttenuationFactors( nullptr, TheGlobalData->m_vertexWaterAttenuationA[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationB[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationC[ waterSettingIndex ], @@ -1367,8 +1367,8 @@ void TerrainLogic::addWaypoint(MapObject *pMapObj) //------------------------------------------------------------------------------------------------- void TerrainLogic::addWaypointLink(Int id1, Int id2) { - Waypoint *pWay1 = NULL; - Waypoint *pWay2 = NULL; + Waypoint *pWay1 = nullptr; + Waypoint *pWay2 = nullptr; Waypoint *pWay; // Traverse all waypoints. /// @todo ID's should be UnsignedInts (MSB) @@ -1406,15 +1406,15 @@ void TerrainLogic::addWaypointLink(Int id1, Int id2) //------------------------------------------------------------------------------------------------- void TerrainLogic::deleteWaypoints(void) { - Waypoint *pNext = NULL; + Waypoint *pNext = nullptr; Waypoint *pWay; // Traverse all waypoints. for (pWay = getFirstWaypoint(); pWay; pWay = pNext) { pNext = pWay->getNext(); - pWay->setNext(NULL); + pWay->setNext(nullptr); deleteInstance(pWay); } - m_waypointListHead = NULL; + m_waypointListHead = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1560,7 +1560,7 @@ Waypoint *TerrainLogic::getWaypointByName( AsciiString name ) if (way->getName() == name) return way; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1572,7 +1572,7 @@ Waypoint *TerrainLogic::getWaypointByID( UnsignedInt id ) if (way->getID() == id) return way; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1581,10 +1581,10 @@ Waypoint *TerrainLogic::getWaypointByID( UnsignedInt id ) Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiString label ) { Real distSqr = 0; - Waypoint *pClosestWay = NULL; + Waypoint *pClosestWay = nullptr; if (label.isEmpty()) { DEBUG_LOG(("***Warning - asking for empty path label.")); - return NULL; + return nullptr; } for( Waypoint *way = m_waypointListHead; way; way = way->getNext() ) { @@ -1595,7 +1595,7 @@ Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiStrin if (match) { Coord3D curPos = *way->getLocation(); Real newDistSqr = (curPos.x-pos->x)*(curPos.x-pos->x) + (curPos.y-pos->y)*(curPos.y-pos->y); - if (pClosestWay==NULL) { + if (pClosestWay==nullptr) { pClosestWay = way; distSqr = newDistSqr; } else if (newDistSqr < distSqr) { @@ -1613,7 +1613,7 @@ Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiStrin //------------------------------------------------------------------------------------------------- Bool TerrainLogic::isPurposeOfPath( Waypoint *pWay, AsciiString label ) { - if (label.isEmpty() || pWay==NULL) { + if (label.isEmpty() || pWay==nullptr) { DEBUG_LOG(("***Warning - asking for empth path label.")); return false; } @@ -1628,7 +1628,7 @@ Bool TerrainLogic::isPurposeOfPath( Waypoint *pWay, AsciiString label ) //------------------------------------------------------------------------------------------------- -/** Given a name, return the associated trigger area, or NULL if one doesn't exist. */ +/** Given a name, return the associated trigger area, or null if one doesn't exist. */ //------------------------------------------------------------------------------------------------- PolygonTrigger *TerrainLogic::getTriggerAreaByName( AsciiString name ) { @@ -1637,7 +1637,7 @@ PolygonTrigger *TerrainLogic::getTriggerAreaByName( AsciiString name ) if (name == trigName) return pTrig; } - return NULL; + return nullptr; } @@ -1654,7 +1654,7 @@ Bridge * TerrainLogic::findBridgeAt( const Coord3D *pLoc) const } pBridge = pBridge->getNext(); } - return(NULL); + return(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1663,7 +1663,7 @@ Bridge * TerrainLogic::findBridgeAt( const Coord3D *pLoc) const Bridge * TerrainLogic::findBridgeLayerAt( const Coord3D *pLoc, PathfindLayerEnum layer, Bool clip) const { if (layer == LAYER_GROUND) - return NULL; + return nullptr; Bridge *pBridge = getFirstBridge(); while (pBridge) @@ -1674,7 +1674,7 @@ Bridge * TerrainLogic::findBridgeLayerAt( const Coord3D *pLoc, PathfindLayerEnum } pBridge = pBridge->getNext(); } - return(NULL); + return(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1700,7 +1700,7 @@ PathfindLayerEnum TerrainLogic::getLayerForDestination(const Coord3D *pos) while (pBridge ) { if (pBridge->isPointOnBridge(pos) ) { - Real delta = fabs(pos->z-pBridge->getBridgeHeight(pos, NULL)); + Real delta = fabs(pos->z-pBridge->getBridgeHeight(pos, nullptr)); if (deltagetLayer(); bestDistance = delta; @@ -1731,13 +1731,13 @@ PathfindLayerEnum TerrainLogic::getHighestLayerForDestination(const Coord3D *pos } } - for (Bridge *pBridge = getFirstBridge(); pBridge != NULL; pBridge = pBridge->getNext()) { + for (Bridge *pBridge = getFirstBridge(); pBridge != nullptr; pBridge = pBridge->getNext()) { if (onlyHealthyBridges && pBridge->peekBridgeInfo()->curDamageState == BODY_RUBBLE) continue; if (pBridge->isPointOnBridge(pos) ) { - Real delta = pos->z - pBridge->getBridgeHeight(pos, NULL); + Real delta = pos->z - pBridge->getBridgeHeight(pos, nullptr); // must be ABOVE (or on) the bridge for this call. (srj) if (delta >= 0 && fabs(delta) < fabs(bestDistance)) { bestLayer = pBridge->getLayer(); @@ -1787,7 +1787,7 @@ Bool TerrainLogic::objectInteractsWithBridgeLayer(Object *obj, Int layer, Bool c } if (match) { - Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), NULL); + Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), nullptr); Real delta = fabs(obj->getPosition()->z-bridgeHeight); if (delta>LAYER_Z_CLOSE_ENOUGH_F) { return false; @@ -1814,7 +1814,7 @@ Bool TerrainLogic::objectInteractsWithBridgeLayer(Object *obj, Int layer, Bool c //------------------------------------------------------------------------------------------------- Bool TerrainLogic::objectInteractsWithBridgeEnd(Object *obj, Int layer) const { - if (layer == LAYER_GROUND) return NULL; + if (layer == LAYER_GROUND) return false; Bridge *pBridge = getFirstBridge(); while (pBridge ) { @@ -1836,7 +1836,7 @@ Bool TerrainLogic::objectInteractsWithBridgeEnd(Object *obj, Int layer) const } if (match) { - Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), NULL); + Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), nullptr); Real delta = fabs(obj->getPosition()->z-bridgeHeight); if (delta>LAYER_Z_CLOSE_ENOUGH_F) { @@ -1958,7 +1958,7 @@ void TerrainLogic::getBridgeAttackPoints(const Object *bridge, TBridgeAttackInfo //------------------------------------------------------------------------------------------------- Drawable *TerrainLogic::pickBridge(const Vector3 &from, const Vector3 &to, Vector3 *pos) { - Drawable *curDraw = NULL; + Drawable *curDraw = nullptr; Vector3 curPos(0,0,0); Bridge *pBridge = getFirstBridge(); @@ -1980,15 +1980,15 @@ Drawable *TerrainLogic::pickBridge(const Vector3 &from, const Vector3 &to, Vecto //------------------------------------------------------------------------------------------------- void TerrainLogic::deleteBridges(void) { - Bridge *pNext = NULL; + Bridge *pNext = nullptr; Bridge *pBridge; // Traverse all waypoints. for (pBridge = getFirstBridge(); pBridge; pBridge = pNext) { pNext = pBridge->getNext(); - pBridge->setNext(NULL); + pBridge->setNext(nullptr); deleteInstance(pBridge); } - m_bridgeListHead = NULL; + m_bridgeListHead = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1998,7 +1998,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) { // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // check for removing the head @@ -2139,7 +2139,7 @@ Bool TerrainLogic::isUnderwater( Real x, Real y, Real *waterZ, Real *terrainZ ) const WaterHandle *waterHandle = getWaterHandle( x, y ); // if no water here, no height, no nuttin - if( waterHandle == NULL ) + if( waterHandle == nullptr ) { // but we have to return the terrain Z if requested! if (terrainZ) @@ -2175,7 +2175,7 @@ Bool TerrainLogic::isUnderwater( Real x, Real y, Real *waterZ, Real *terrainZ ) // ------------------------------------------------------------------------------------------------ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) { - const WaterHandle *waterHandle = NULL; + const WaterHandle *waterHandle = nullptr; Real waterZ = 0.0f; ICoord3D iLoc; @@ -2250,7 +2250,7 @@ const WaterHandle* TerrainLogic::getWaterHandleByName( AsciiString name ) trig = trig->getNext(); } - return NULL; + return nullptr; } @@ -2260,7 +2260,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) { // sanity - if( water == NULL ) + if( water == nullptr ) return 0.0f; // @@ -2276,7 +2276,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) } // sanity - DEBUG_ASSERTCRASH( water->m_polygon != NULL, ("getWaterHeight: polygon trigger in water handle is NULL") ); + DEBUG_ASSERTCRASH( water->m_polygon != nullptr, ("getWaterHeight: polygon trigger in water handle is null") ); // return the height of the water using the polygon trigger return water->m_polygon->getPoint( 0 )->z; @@ -2292,7 +2292,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d { // sanity - if( water == NULL ) + if( water == nullptr ) return; // @@ -2376,7 +2376,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( ¢er, maxDist, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *obj; const Coord3D *objPos; @@ -2425,7 +2425,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, } // sanity - if( water == NULL ) + if( water == nullptr ) return; // if this water table already has an entry in the array to update, remove it @@ -2474,7 +2474,7 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region { // sanity - if( water == NULL || region == NULL ) + if( water == nullptr || region == nullptr ) return; // setup the lo and high of the region to the *opposite* side of the map plus some big number @@ -2908,7 +2908,7 @@ void TerrainLogic::xfer( Xfer *xfer ) PolygonTrigger *poly = PolygonTrigger::getPolygonTriggerByID( triggerID ); // sanity - if( poly == NULL ) + if( poly == nullptr ) { DEBUG_CRASH(( "TerrainLogic::xfer - Unable to find polygon trigger for water table with trigger ID '%d'", @@ -2921,7 +2921,7 @@ void TerrainLogic::xfer( Xfer *xfer ) m_waterToUpdate[ i ].waterTable = poly->getWaterHandle(); // sanity - if( m_waterToUpdate[ i ].waterTable == NULL ) + if( m_waterToUpdate[ i ].waterTable == nullptr ) { DEBUG_CRASH(( "TerrainLogic::xfer - Polygon trigger to use for water handle has no water handle!" )); @@ -2960,7 +2960,7 @@ void TerrainLogic::loadPostProcess( void ) { pNext = pBridge->getNext(); Object* obj = TheGameLogic->findObjectByID(pBridge->peekBridgeInfo()->bridgeObjectID); - if (obj == NULL) + if (obj == nullptr) { deleteBridge(pBridge); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp index 2fbddabc9ff..b4e67c7f900 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp @@ -40,7 +40,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -ArmorStore* TheArmorStore = NULL; ///< the ArmorTemplate store definition +ArmorStore* TheArmorStore = nullptr; ///< the ArmorTemplate store definition /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -120,7 +120,7 @@ const ArmorTemplate* ArmorStore::findArmorTemplate(NameKeyType namekey) const ArmorTemplateMap::const_iterator it = m_armorTemplates.find(namekey); if (it == m_armorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -145,7 +145,7 @@ const ArmorTemplate* ArmorStore::findArmorTemplate(const char* name) const { static const FieldParse myFieldParse[] = { - { "Armor", ArmorTemplate::parseArmorCoefficients, NULL, 0 } + { "Armor", ArmorTemplate::parseArmorCoefficients, nullptr, 0 } }; const char *c = ini->getNextToken(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp index 97c49aee134..1bc2c1febec 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp @@ -235,7 +235,7 @@ UpdateSleepTime AutoHealBehavior::update( void ) PartitionFilterRelationship relationship( obj, PartitionFilterRelationship::ALLOW_ALLIES ); PartitionFilterSameMapStatus filterMapStatus(obj); PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, nullptr }; // scan objects in our region ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( obj->getPosition(), d->m_radius, FROM_CENTER_2D, filters ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 1bdc37c657e..834310b9671 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -85,11 +85,11 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "LateralScaffoldSpeed", INI::parseVelocityReal, NULL, offsetof( BridgeBehaviorModuleData, m_lateralScaffoldSpeed ) }, - { "VerticalScaffoldSpeed", INI::parseVelocityReal, NULL, offsetof( BridgeBehaviorModuleData, m_verticalScaffoldSpeed ) }, - { "BridgeDieFX", parseFX, NULL, offsetof( BridgeBehaviorModuleData, m_fx ) }, - { "BridgeDieOCL", parseOCL, NULL, offsetof( BridgeBehaviorModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "LateralScaffoldSpeed", INI::parseVelocityReal, nullptr, offsetof( BridgeBehaviorModuleData, m_lateralScaffoldSpeed ) }, + { "VerticalScaffoldSpeed", INI::parseVelocityReal, nullptr, offsetof( BridgeBehaviorModuleData, m_verticalScaffoldSpeed ) }, + { "BridgeDieFX", parseFX, nullptr, offsetof( BridgeBehaviorModuleData, m_fx ) }, + { "BridgeDieOCL", parseOCL, nullptr, offsetof( BridgeBehaviorModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -115,7 +115,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, } // delay value - ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, NULL ); + ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, nullptr ); // get optional bone label token = ini->getNextTokenOrNull( ini->getSepsColon() ); @@ -149,7 +149,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // create item we will read into and push on list BridgeFXInfo item; - item.fx = NULL; + item.fx = nullptr; // get list to store at BridgeFXList *bridgeFXList = (BridgeFXList *)store; @@ -166,7 +166,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // fx list name and store as pointer FXList *fx; - ini->parseFXList( ini, instance, &fx, NULL ); + ini->parseFXList( ini, instance, &fx, nullptr ); // store fx list to item item.fx = fx; @@ -190,7 +190,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // create item we will read into and push on list BridgeOCLInfo item; - item.ocl = NULL; + item.ocl = nullptr; // get list to store at BridgeOCLList *bridgeOCLList = (BridgeOCLList *)store; @@ -207,7 +207,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // fx list name and store as pointer ObjectCreationList *ocl; - ini->parseObjectCreationList( ini, instance, &ocl, NULL ); + ini->parseObjectCreationList( ini, instance, &ocl, nullptr ); // store ocl list to item item.ocl = ocl; @@ -244,10 +244,10 @@ BridgeBehavior::BridgeBehavior( Thing *thing, const ModuleData *moduleData ) for( i = 0; i < MAX_BRIDGE_BODY_FX; ++i ) { - m_damageToOCL[ bodyState ][ i ] = NULL; - m_damageToFX[ bodyState ][ i ] = NULL; - m_repairToOCL[ bodyState ][ i ] = NULL; - m_repairToFX[ bodyState ][ i ] = NULL; + m_damageToOCL[ bodyState ][ i ] = nullptr; + m_damageToFX[ bodyState ][ i ] = nullptr; + m_repairToOCL[ bodyState ][ i ] = nullptr; + m_repairToFX[ bodyState ][ i ] = nullptr; } @@ -291,11 +291,11 @@ BridgeBehavior::~BridgeBehavior( void ) { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; BehaviorModule **bmi; - BridgeBehaviorInterface *bbi = NULL; + BridgeBehaviorInterface *bbi = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -306,7 +306,7 @@ BridgeBehavior::~BridgeBehavior( void ) } // interface not found - return NULL; + return nullptr; } @@ -328,7 +328,7 @@ void BridgeBehavior::resolveFX( void ) Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // get the bridge template name @@ -338,7 +338,7 @@ void BridgeBehavior::resolveFX( void ) TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); // sanity - if( bridgeTemplate == NULL ) + if( bridgeTemplate == nullptr ) return; AsciiString name; @@ -351,22 +351,22 @@ void BridgeBehavior::resolveFX( void ) name = bridgeTemplate->getDamageToOCLString( (BodyDamageType)bodyState, i ); m_damageToOCL[ bodyState ][ i ] = TheObjectCreationListStore->findObjectCreationList( name.str() ); - if( name.isEmpty() == FALSE && m_damageToOCL[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_damageToOCL[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "OCL list '%s' not found", name.str() )); name = bridgeTemplate->getDamageToFXString( (BodyDamageType)bodyState, i ); m_damageToFX[ bodyState ][ i ] = TheFXListStore->findFXList( name.str() ); - if( name.isEmpty() == FALSE && m_damageToFX[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_damageToFX[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); name = bridgeTemplate->getRepairedToOCLString( (BodyDamageType)bodyState, i ); m_repairToOCL[ bodyState ][ i ] = TheObjectCreationListStore->findObjectCreationList( name.str() ); - if( name.isEmpty() == FALSE && m_repairToOCL[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_repairToOCL[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "OCL list '%s' not found", name.str() )); name = bridgeTemplate->getRepairedToFXString( (BodyDamageType)bodyState, i ); m_repairToFX[ bodyState ][ i ] = TheFXListStore->findFXList( name.str() ); - if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); } @@ -445,7 +445,7 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) // to all our towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + if( source == nullptr || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) { Object *tower; @@ -489,7 +489,7 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) // to all our towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + if( source == nullptr || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) { Object *tower; @@ -519,7 +519,7 @@ void BridgeBehavior::getRandomSurfacePosition( TerrainRoadType *bridgeTemplate, { // sanity - if( bridgeInfo == NULL || pos == NULL ) + if( bridgeInfo == nullptr || pos == nullptr ) return; // @@ -568,11 +568,11 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, { // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // if no effects, don't bother - if( ocl == NULL && fx == NULL ) + if( ocl == nullptr && fx == nullptr ) return; // get bridge info @@ -598,7 +598,7 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, { getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); - ObjectCreationList::create( ocl, getObject(), &pos, NULL ); + ObjectCreationList::create( ocl, getObject(), &pos, nullptr ); } @@ -635,7 +635,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) { DEBUG_CRASH(( "BridgeBehavior - Unable to find bridge" )); @@ -719,8 +719,8 @@ UpdateSleepTime BridgeBehavior::update( void ) // get bridge information Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); - const BridgeInfo *bridgeInfo = NULL; - TerrainRoadType *bridgeTemplate = NULL; + const BridgeInfo *bridgeInfo = nullptr; + TerrainRoadType *bridgeTemplate = nullptr; if ( bridge ) { DEBUG_ASSERTCRASH( bridge, ("BridgeBehavior::update - Unable to find bridge") ); @@ -756,7 +756,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // boneName = (*fxIt).timeAndLocationInfo.boneName; if( boneName.isEmpty() == FALSE ) - us->getSingleLogicalBonePosition( boneName.str(), &pos, NULL ); + us->getSingleLogicalBonePosition( boneName.str(), &pos, nullptr ); else if ( bridge && bridgeTemplate && bridgeInfo)//we have valid Terrain data for the bridge getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); else @@ -802,17 +802,17 @@ UpdateSleepTime BridgeBehavior::update( void ) { // launch the effects just using the parent object for location info - ObjectCreationList::create( (*oclIt).ocl, us, NULL ); + ObjectCreationList::create( (*oclIt).ocl, us, nullptr ); } else { // get bone position - us->getSingleLogicalBonePosition( boneName.str(), &pos, NULL ); + us->getSingleLogicalBonePosition( boneName.str(), &pos, nullptr ); // launch the fx list - ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL ); + ObjectCreationList::create( (*oclIt).ocl, us, &pos, nullptr ); } @@ -827,7 +827,7 @@ UpdateSleepTime BridgeBehavior::update( void ) pos.set( getObject()->getPosition() ); // launch the fx list - ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL ); + ObjectCreationList::create( (*oclIt).ocl, us, &pos, nullptr ); } @@ -965,7 +965,7 @@ void BridgeBehavior::setScaffoldData( Object *obj, { // sanity - if( obj == NULL || angle == NULL || riseToPos == NULL || buildPos == NULL ) + if( obj == nullptr || angle == nullptr || riseToPos == nullptr || buildPos == nullptr ) return; const BridgeBehaviorModuleData *modData = getBridgeBehaviorModuleData(); @@ -1041,7 +1041,7 @@ void BridgeBehavior::createScaffolding( void ) // get the thing template for the scaffold object we're going to use AsciiString scaffoldObjectName = bridgeTemplate->getScaffoldObjectName(); const ThingTemplate *scaffoldTemplate = TheThingFactory->findTemplate( scaffoldObjectName ); - if( scaffoldTemplate == NULL ) + if( scaffoldTemplate == nullptr ) { DEBUG_CRASH(( "Unable to find bridge scaffold template" )); @@ -1052,7 +1052,7 @@ void BridgeBehavior::createScaffolding( void ) // get thing template for scaffold support object AsciiString scaffoldSupportObjectName = bridgeTemplate->getScaffoldSupportObjectName(); const ThingTemplate *scaffoldSupportTemplate = TheThingFactory->findTemplate( scaffoldSupportObjectName ); - if( scaffoldSupportTemplate == NULL ) + if( scaffoldSupportTemplate == nullptr ) { DEBUG_CRASH(( "Unable to find bridge support scaffold template" )); @@ -1299,7 +1299,7 @@ void BridgeBehavior::removeScaffolding( void ) // get the object obj = TheGameLogic->findObjectByID( (*it) ); - if( obj == NULL ) + if( obj == nullptr ) continue; // get the scaffold behavior @@ -1346,12 +1346,12 @@ Bool BridgeBehavior::isScaffoldInMotion( void ) // get object obj = TheGameLogic->findObjectByID( (*it) ); - if( obj == NULL ) + if( obj == nullptr ) continue; // get scaffold interface BridgeScaffoldBehaviorInterface *bsbi = BridgeScaffoldBehavior::getBridgeScaffoldBehaviorInterfaceFromObject( obj ); - if( bsbi == NULL ) + if( bsbi == nullptr ) continue; // check in motion diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index 4ca29443328..43486d9c58d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -284,11 +284,11 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi { // santiy - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; // get the bridge tower behavior interface - BridgeScaffoldBehaviorInterface *bridgeScaffoldInterface = NULL; + BridgeScaffoldBehaviorInterface *bridgeScaffoldInterface = nullptr; BehaviorModule **bmi; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -300,7 +300,7 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi } // interface not found - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index 554688e6058..6b99c277002 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -62,7 +62,7 @@ BridgeTowerBehavior::~BridgeTowerBehavior( void ) void BridgeTowerBehavior::setBridge( Object *bridge ) { - if( bridge == NULL ) + if( bridge == nullptr ) m_bridgeID = INVALID_ID; else m_bridgeID = bridge->getID(); @@ -94,7 +94,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) Object *bridge = TheGameLogic->findObjectByID( getBridgeID() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // @@ -106,7 +106,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // get the bridge behavior module for our bridge BehaviorModule **bmi; - BridgeBehaviorInterface *bridgeInterface = NULL; + BridgeBehaviorInterface *bridgeInterface = nullptr; for( bmi = bridge->getBehaviorModules(); *bmi; ++bmi ) { @@ -115,7 +115,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) break; } - DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeInterface != nullptr, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -124,7 +124,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // or other towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || + if( source == nullptr || (source->isKindOf( KINDOF_BRIDGE ) == FALSE && source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE) ) { @@ -175,7 +175,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) Object *bridge = TheGameLogic->findObjectByID( getBridgeID() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // @@ -187,7 +187,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // get the bridge behavior module for our bridge BehaviorModule **bmi; - BridgeBehaviorInterface *bridgeInterface = NULL; + BridgeBehaviorInterface *bridgeInterface = nullptr; for( bmi = bridge->getBehaviorModules(); *bmi; ++bmi ) { @@ -196,7 +196,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) break; } - DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeInterface != nullptr, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -205,7 +205,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // or other towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || + if( source == nullptr || (source->isKindOf( KINDOF_BRIDGE ) == FALSE && source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE) ) { @@ -269,11 +269,11 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa { // sanity - if( obj == NULL || obj->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) - return NULL; + if( obj == nullptr || obj->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + return nullptr; BehaviorModule **bmi; - BridgeTowerBehaviorInterface *bridgeTowerInterface = NULL; + BridgeTowerBehaviorInterface *bridgeTowerInterface = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -284,7 +284,7 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa } // interface not found - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index e4096fcab7d..59edca33a3c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -64,7 +64,7 @@ DumbProjectileBehaviorModuleData::DumbProjectileBehaviorModuleData() : m_firstPercentIndent(0.0f), m_secondPercentIndent(0.0f), m_garrisonHitKillCount(0), - m_garrisonHitKillFX(NULL), + m_garrisonHitKillFX(nullptr), m_flightPathAdjustDistPerFrame(0.0f) { } @@ -76,25 +76,25 @@ void DumbProjectileBehaviorModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxLifespan", INI::parseDurationUnsignedInt, NULL, offsetof( DumbProjectileBehaviorModuleData, m_maxLifespan ) }, - { "TumbleRandomly", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_tumbleRandomly ) }, - { "DetonateCallsKill", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_detonateCallsKill ) }, - { "OrientToFlightPath", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_orientToFlightPath ) }, + { "MaxLifespan", INI::parseDurationUnsignedInt, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_maxLifespan ) }, + { "TumbleRandomly", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_tumbleRandomly ) }, + { "DetonateCallsKill", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_detonateCallsKill ) }, + { "OrientToFlightPath", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_orientToFlightPath ) }, - { "FirstHeight", INI::parseReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_firstHeight ) }, - { "SecondHeight", INI::parseReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_secondHeight ) }, - { "FirstPercentIndent", INI::parsePercentToReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_firstPercentIndent ) }, - { "SecondPercentIndent", INI::parsePercentToReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_secondPercentIndent ) }, + { "FirstHeight", INI::parseReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_firstHeight ) }, + { "SecondHeight", INI::parseReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_secondHeight ) }, + { "FirstPercentIndent", INI::parsePercentToReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_firstPercentIndent ) }, + { "SecondPercentIndent", INI::parsePercentToReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_secondPercentIndent ) }, - { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindof ) }, - { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindofNot ) }, - { "GarrisonHitKillCount", INI::parseUnsignedInt, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillCount ) }, - { "GarrisonHitKillFX", INI::parseFXList, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillFX ) }, + { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindof ) }, + { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindofNot ) }, + { "GarrisonHitKillCount", INI::parseUnsignedInt, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillCount ) }, + { "GarrisonHitKillFX", INI::parseFXList, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillFX ) }, - { "FlightPathAdjustDistPerSecond", INI::parseVelocityReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_flightPathAdjustDistPerFrame ) }, + { "FlightPathAdjustDistPerSecond", INI::parseVelocityReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_flightPathAdjustDistPerFrame ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -109,7 +109,7 @@ DumbProjectileBehavior::DumbProjectileBehavior( Thing *thing, const ModuleData* { m_launcherID = INVALID_ID; m_victimID = INVALID_ID; - m_detonationWeaponTmpl = NULL; + m_detonationWeaponTmpl = nullptr; m_lifespanFrame = 0; m_flightPath.clear(); m_flightPathSegments = 0; @@ -406,7 +406,7 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments) controlPoints[3] = m_flightPathEnd; Real highestInterveningTerrain; - Bool onMap = ThePartitionManager->estimateTerrainExtremesAlongLine( controlPoints[0], controlPoints[3], NULL, &highestInterveningTerrain, NULL, NULL ); + Bool onMap = ThePartitionManager->estimateTerrainExtremesAlongLine( controlPoints[0], controlPoints[3], nullptr, &highestInterveningTerrain, nullptr, nullptr ); if( !onMap ) { return false; @@ -460,7 +460,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) { const DumbProjectileBehaviorModuleData* d = getDumbProjectileBehaviorModuleData(); - if (other != NULL) + if (other != nullptr) { Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); @@ -499,7 +499,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) if (numKilled > 0) { // note, fx is played at center of building, not at grenade's location - FXList::doFXObj(d->m_garrisonHitKillFX, other, NULL); + FXList::doFXObj(d->m_garrisonHitKillFX, other, nullptr); // don't do the normal explosion; just destroy ourselves & return TheGameLogic->destroyObject(getObject()); @@ -729,7 +729,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) { if( weaponTemplateName == AsciiString::TheEmptyString ) - m_detonationWeaponTmpl = NULL; + m_detonationWeaponTmpl = nullptr; else { @@ -737,7 +737,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName ); // sanity - if( m_detonationWeaponTmpl == NULL ) + if( m_detonationWeaponTmpl == nullptr ) { DEBUG_CRASH(( "DumbProjectileBehavior::xfer - Unknown weapon template '%s'", diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp index c846c48e9c7..d9fed1586a9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp @@ -57,14 +57,14 @@ const Real END_MIDPOINT_RATIO = 0.65f; //------------------------------------------------------------------------------------------------- FireWeaponWhenDamagedBehavior::FireWeaponWhenDamagedBehavior( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), - m_reactionWeaponPristine( NULL ), - m_reactionWeaponDamaged( NULL ), - m_reactionWeaponReallyDamaged( NULL ), - m_reactionWeaponRubble( NULL ), - m_continuousWeaponPristine( NULL ), - m_continuousWeaponDamaged( NULL ), - m_continuousWeaponReallyDamaged( NULL ), - m_continuousWeaponRubble( NULL ) + m_reactionWeaponPristine( nullptr ), + m_reactionWeaponDamaged( nullptr ), + m_reactionWeaponReallyDamaged( nullptr ), + m_reactionWeaponRubble( nullptr ), + m_continuousWeaponPristine( nullptr ), + m_continuousWeaponDamaged( nullptr ), + m_continuousWeaponReallyDamaged( nullptr ), + m_continuousWeaponRubble( nullptr ) { const FireWeaponWhenDamagedBehaviorModuleData *d = getFireWeaponWhenDamagedBehaviorModuleData(); @@ -127,10 +127,10 @@ FireWeaponWhenDamagedBehavior::FireWeaponWhenDamagedBehavior( Thing *thing, cons } if (isUpgradeActive() && - (d->m_continuousWeaponPristine != NULL || - d->m_continuousWeaponDamaged != NULL || - d->m_continuousWeaponReallyDamaged != NULL || - d->m_continuousWeaponRubble != NULL)) + (d->m_continuousWeaponPristine != nullptr || + d->m_continuousWeaponDamaged != nullptr || + d->m_continuousWeaponReallyDamaged != nullptr || + d->m_continuousWeaponRubble != nullptr)) { setWakeFrame(getObject(), UPDATE_SLEEP_NONE); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index c52f4fd5b26..80fe1d9503f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -58,7 +58,7 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() { m_mineName.clear(); - m_genFX = NULL; + m_genFX = nullptr; m_distanceAroundObject = TheGlobalData->m_standardMinefieldDistance; m_minesPerSquareFoot = TheGlobalData->m_standardMinefieldDensity; m_onDeath = false; @@ -76,18 +76,18 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "MineName", INI::parseAsciiString, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_mineName ) }, - { "GenerationFX", INI::parseFXList, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_genFX ) }, - { "DistanceAroundObject", INI::parseReal, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_distanceAroundObject ) }, - { "MinesPerSquareFoot", INI::parseReal, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_minesPerSquareFoot ) }, - { "GenerateOnlyOnDeath", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_onDeath) }, - { "BorderOnly", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_borderOnly) }, - { "SmartBorder", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorder) }, - { "SmartBorderSkipInterior", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorderSkipInterior) }, - { "AlwaysCircular", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_alwaysCircular) }, - { "RandomJitter", INI::parsePercentToReal, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_randomJitter) }, - { "SkipIfThisMuchUnderStructure", INI::parsePercentToReal, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_skipIfThisMuchUnderStructure) }, - { 0, 0, 0, 0 } + { "MineName", INI::parseAsciiString, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_mineName ) }, + { "GenerationFX", INI::parseFXList, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_genFX ) }, + { "DistanceAroundObject", INI::parseReal, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_distanceAroundObject ) }, + { "MinesPerSquareFoot", INI::parseReal, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_minesPerSquareFoot ) }, + { "GenerateOnlyOnDeath", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_onDeath) }, + { "BorderOnly", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_borderOnly) }, + { "SmartBorder", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorder) }, + { "SmartBorderSkipInterior", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorderSkipInterior) }, + { "AlwaysCircular", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_alwaysCircular) }, + { "RandomJitter", INI::parsePercentToReal, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_randomJitter) }, + { "SkipIfThisMuchUnderStructure", INI::parsePercentToReal, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_skipIfThisMuchUnderStructure) }, + { nullptr, nullptr, nullptr, 0 } }; BehaviorModuleData::buildFieldParse(p); @@ -183,10 +183,10 @@ Object* GenerateMinefieldBehavior::placeMineAt(const Coord3D& pt, const ThingTem PathfindLayerEnum layer = TheTerrainLogic->getHighestLayerForDestination(&tmp); if (layer == LAYER_GROUND && TheTerrainLogic->isUnderwater(pt.x, pt.y)) - return NULL; + return nullptr; if (layer == LAYER_GROUND && TheTerrainLogic->isCliffCell(pt.x, pt.y)) - return NULL; + return nullptr; Real orient = GameLogicRandomValueReal(-PI, PI); @@ -201,7 +201,7 @@ Object* GenerateMinefieldBehavior::placeMineAt(const Coord3D& pt, const ThingTem for (Object* them = iter->first(); them; them = iter->next()) { if (them->isKindOf(KINDOF_STRUCTURE)) - return NULL; + return nullptr; } Object* mine = TheThingFactory->newObject(mineTemplate, team); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index d2da84a2ef3..5015a14df9a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -62,7 +62,7 @@ InstantDeathBehaviorModuleData::InstantDeathBehaviorModuleData() static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fx.push_back(fxl); @@ -73,7 +73,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls.push_back(ocl); @@ -84,7 +84,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const WeaponTemplate *wt = TheWeaponStore->findWeaponTemplate(token); // could be null! this is OK! self->m_weapons.push_back(wt); @@ -98,10 +98,10 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* static const FieldParse dataFieldParse[] = { - { "FX", parseFX, NULL, 0 }, - { "OCL", parseOCL, NULL, 0 }, - { "Weapon", parseWeapon, NULL, 0 }, - { 0, 0, 0, 0 } + { "FX", parseFX, nullptr, 0 }, + { "OCL", parseOCL, nullptr, 0 }, + { "Weapon", parseWeapon, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -144,7 +144,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) const FXListVec& v = d->m_fx; DEBUG_ASSERTCRASH(idx>=0&&idxm_ocls.size(); @@ -154,7 +154,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) const OCLVec& v = d->m_ocls; DEBUG_ASSERTCRASH(idx>=0&&idxm_weapons.size(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp index b5cdc239d8e..91731d4640e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp @@ -53,22 +53,22 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) { - m_fxOnGroundDeath = NULL; - m_oclOnGroundDeath = NULL; + m_fxOnGroundDeath = nullptr; + m_oclOnGroundDeath = nullptr; - m_fxInitialDeath = NULL; - m_oclInitialDeath = NULL; + m_fxInitialDeath = nullptr; + m_oclInitialDeath = nullptr; m_delaySecondaryFromInitialDeath = 0; - m_fxSecondary = NULL; - m_oclSecondary = NULL; + m_fxSecondary = nullptr; + m_oclSecondary = nullptr; - m_fxHitGround = NULL; - m_oclHitGround = NULL; + m_fxHitGround = nullptr; + m_oclHitGround = nullptr; m_delayFinalBlowUpFromHitGround = 0; - m_fxFinalBlowUp = NULL; - m_oclFinalBlowUp = NULL; + m_fxFinalBlowUp = nullptr; + m_oclFinalBlowUp = nullptr; m_rollRate = 0.0f; m_rollRateDelta = 1.0f; @@ -86,32 +86,32 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "FXOnGroundDeath", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxOnGroundDeath ) }, - { "OCLOnGroundDeath", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclOnGroundDeath ) }, + { "FXOnGroundDeath", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxOnGroundDeath ) }, + { "OCLOnGroundDeath", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclOnGroundDeath ) }, - { "FXInitialDeath", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxInitialDeath ) }, - { "OCLInitialDeath", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclInitialDeath ) }, + { "FXInitialDeath", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxInitialDeath ) }, + { "OCLInitialDeath", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclInitialDeath ) }, - { "DelaySecondaryFromInitialDeath", INI::parseDurationUnsignedInt, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_delaySecondaryFromInitialDeath ) }, - { "FXSecondary", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxSecondary ) }, - { "OCLSecondary", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclSecondary ) }, + { "DelaySecondaryFromInitialDeath", INI::parseDurationUnsignedInt, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_delaySecondaryFromInitialDeath ) }, + { "FXSecondary", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxSecondary ) }, + { "OCLSecondary", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclSecondary ) }, - { "FXHitGround", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxHitGround ) }, - { "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclHitGround ) }, + { "FXHitGround", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxHitGround ) }, + { "OCLHitGround", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclHitGround ) }, - { "DelayFinalBlowUpFromHitGround", INI::parseDurationUnsignedInt, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_delayFinalBlowUpFromHitGround ) }, - { "FXFinalBlowUp", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, - { "OCLFinalBlowUp", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, + { "DelayFinalBlowUpFromHitGround", INI::parseDurationUnsignedInt, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_delayFinalBlowUpFromHitGround ) }, + { "FXFinalBlowUp", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, + { "OCLFinalBlowUp", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, - { "DeathLoopSound", INI::parseAudioEventRTS, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_deathLoopSound ) }, + { "DeathLoopSound", INI::parseAudioEventRTS, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_deathLoopSound ) }, // @todo srj -- RollRate and RollRateDelta and PitchRate should use parseAngularVelocityReal - { "RollRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) }, - { "RollRateDelta", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRateDelta ) }, - { "PitchRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) }, - { "FallHowFast", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fallHowFast ) }, + { "RollRate", INI::parseReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) }, + { "RollRateDelta", INI::parsePercentToReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_rollRateDelta ) }, + { "PitchRate", INI::parseReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) }, + { "FallHowFast", INI::parsePercentToReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fallHowFast ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -157,7 +157,7 @@ void JetSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) FXList::doFXObj( modData->m_fxOnGroundDeath, us ); // execute ocl - ObjectCreationList::create( modData->m_oclOnGroundDeath, us, NULL ); + ObjectCreationList::create( modData->m_oclOnGroundDeath, us, nullptr ); // destroy object TheGameLogic->destroyObject( us ); @@ -190,7 +190,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) // do some effects FXList::doFXObj( modData->m_fxInitialDeath, us ); - ObjectCreationList::create( modData->m_oclInitialDeath, us, NULL ); + ObjectCreationList::create( modData->m_oclInitialDeath, us, nullptr ); // start audio loop playing m_deathLoopSound = modData->m_deathLoopSound; @@ -289,7 +289,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxHitGround, us ); - ObjectCreationList::create( modData->m_oclHitGround, us, NULL ); + ObjectCreationList::create( modData->m_oclHitGround, us, nullptr ); // we are now on the ground m_timerOnGroundFrame = TheGameLogic->getFrame(); @@ -307,7 +307,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxSecondary, us ); - ObjectCreationList::create( modData->m_oclSecondary, us, NULL ); + ObjectCreationList::create( modData->m_oclSecondary, us, nullptr ); // clear the death frame timer since we've already executed the event now m_timerDeathFrame = 0; @@ -323,7 +323,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxFinalBlowUp, us ); - ObjectCreationList::create( modData->m_oclFinalBlowUp, us, NULL ); + ObjectCreationList::create( modData->m_oclFinalBlowUp, us, nullptr ); // we're all done now TheGameLogic->destroyObject( us ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index 1f4da6a1d4f..a5c429ad1b6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -53,7 +53,7 @@ const Real MIN_HEALTH = 0.1f; // ------------------------------------------------------------------------------------------------ MinefieldBehaviorModuleData::MinefieldBehaviorModuleData() { - m_detonationWeapon = NULL; + m_detonationWeapon = nullptr; m_detonatedBy = (1 << ENEMIES) | (1 << NEUTRAL); m_stopsRegenAfterCreatorDies = true; m_regenerates = false; @@ -74,17 +74,17 @@ MinefieldBehaviorModuleData::MinefieldBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "DetonationWeapon", INI::parseWeaponTemplate, NULL, offsetof( MinefieldBehaviorModuleData, m_detonationWeapon ) }, + { "DetonationWeapon", INI::parseWeaponTemplate, nullptr, offsetof( MinefieldBehaviorModuleData, m_detonationWeapon ) }, { "DetonatedBy", INI::parseBitString32, TheRelationshipNames, offsetof( MinefieldBehaviorModuleData, m_detonatedBy ) }, - { "StopsRegenAfterCreatorDies", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_stopsRegenAfterCreatorDies ) }, - { "Regenerates", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_regenerates ) }, - { "WorkersDetonate", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_workersDetonate ) }, - { "CreatorDeathCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_creatorDeathCheckRate ) }, - { "ScootFromStartingPointTime", INI::parseDurationUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_scootFromStartingPointTime ) }, - { "NumVirtualMines", INI::parseUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_numVirtualMines ) }, - { "RepeatDetonateMoveThresh", INI::parseReal, NULL, offsetof( MinefieldBehaviorModuleData, m_repeatDetonateMoveThresh ) }, - { "DegenPercentPerSecondAfterCreatorDies", INI::parsePercentToReal, NULL, offsetof( MinefieldBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, - { 0, 0, 0, 0 } + { "StopsRegenAfterCreatorDies", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_stopsRegenAfterCreatorDies ) }, + { "Regenerates", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_regenerates ) }, + { "WorkersDetonate", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_workersDetonate ) }, + { "CreatorDeathCheckRate", INI::parseDurationUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_creatorDeathCheckRate ) }, + { "ScootFromStartingPointTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_scootFromStartingPointTime ) }, + { "NumVirtualMines", INI::parseUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_numVirtualMines ) }, + { "RepeatDetonateMoveThresh", INI::parseReal, nullptr, offsetof( MinefieldBehaviorModuleData, m_repeatDetonateMoveThresh ) }, + { "DegenPercentPerSecondAfterCreatorDies", INI::parsePercentToReal, nullptr, offsetof( MinefieldBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -215,7 +215,7 @@ UpdateSleepTime MinefieldBehavior::update() if (m_immunes[i].id == INVALID_ID) continue; - if (TheGameLogic->findObjectByID(m_immunes[i].id) == NULL || + if (TheGameLogic->findObjectByID(m_immunes[i].id) == nullptr || now > m_immunes[i].collideTime + 2) { //DEBUG_LOG(("expiring an immunity %d",m_immunes[i].id)); @@ -237,7 +237,7 @@ UpdateSleepTime MinefieldBehavior::update() if (producerID != INVALID_ID) { Object* producer = TheGameLogic->findObjectByID(producerID); - if (producer == NULL || producer->isEffectivelyDead()) + if (producer == nullptr || producer->isEffectivelyDead()) { m_regenerates = false; m_draining = true; @@ -331,7 +331,7 @@ static Real calcDistSquared(const Coord3D& a, const Coord3D& b) //------------------------------------------------------------------------------------------------- void MinefieldBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { - if (other == NULL || other->isEffectivelyDead()) + if (other == nullptr || other->isEffectivelyDead()) return; if (m_virtualMinesRemaining == 0) @@ -377,7 +377,7 @@ void MinefieldBehavior::onCollide( Object *other, const Coord3D *loc, const Coor // have a real mine they area trying to clear... it's possible they could be trying to // clear a position where there is no mine, in which case we grant them no immunity, muwahahaha) AIUpdateInterface* otherAI = other->getAI(); - if (otherAI && otherAI->isClearingMines() && otherAI->getGoalObject() != NULL) + if (otherAI && otherAI->isClearingMines() && otherAI->getGoalObject() != nullptr) { // mine-clearers are granted immunity to us for as long as they continuously // collide, even if no longer clearing mines. (this prevents the problem diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp index 2df2eee4ff8..1d15dc1f83f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp @@ -63,9 +63,9 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "HealthPercentToDrainPerSecond", INI::parsePercentToReal, NULL, offsetof( OverchargeBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, - { "NotAllowedWhenHealthBelowPercent", INI::parsePercentToReal, NULL, offsetof( OverchargeBehaviorModuleData, m_notAllowedWhenHealthBelowPercent ) }, - { 0, 0, 0, 0 } + { "HealthPercentToDrainPerSecond", INI::parsePercentToReal, nullptr, offsetof( OverchargeBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, + { "NotAllowedWhenHealthBelowPercent", INI::parsePercentToReal, nullptr, offsetof( OverchargeBehaviorModuleData, m_notAllowedWhenHealthBelowPercent ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp index 5d72a53965a..7570b9967a4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp @@ -93,12 +93,12 @@ void POWTruckBehavior::onCollide( Object *other, const Coord3D *loc, const Coord Object *us = getObject(); // sanity - if( other == NULL ) + if( other == nullptr ) return; // if other isn't slated to be picked up by us, ignore AIUpdateInterface *otherAi = other->getAIUpdateInterface(); - if( otherAi == NULL || otherAi->isSurrendered() == FALSE ) + if( otherAi == nullptr || otherAi->isSurrendered() == FALSE ) return; // get our AI info diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 4105cf9600a..501a6259870 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -98,7 +98,7 @@ void ParkingPlaceBehavior::buildInfo() info.m_orientation = mtx.Get_Z_Rotation(); tmp.format("Runway%dPrep%d",col+1,row+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_prep, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_prep, nullptr); info.m_runway = col; info.m_door = (ExitDoorType)door++; @@ -121,10 +121,10 @@ void ParkingPlaceBehavior::buildInfo() AsciiString tmp; tmp.format("RunwayStart%d",col+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_start, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_start, nullptr); tmp.format("RunwayEnd%d",col+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_end, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_end, nullptr); info.m_inUseBy = INVALID_ID; info.m_nextInLineForTakeoff = INVALID_ID; @@ -148,7 +148,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; @@ -166,7 +166,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_inUseBy != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_inUseBy); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_inUseBy = INVALID_ID; it->m_wasInLine = false; @@ -175,7 +175,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_nextInLineForTakeoff != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_nextInLineForTakeoff); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_nextInLineForTakeoff = INVALID_ID; } @@ -190,7 +190,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); anythingPurged = true; @@ -230,7 +230,7 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findPPI(ObjectID i DEBUG_ASSERTCRASH(id != INVALID_ID, ("call findEmptyPPI instead")); if (!m_gotInfo || id == INVALID_ID) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -238,14 +238,14 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findPPI(ObjectID i return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findEmptyPPI() { if (!m_gotInfo) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -253,7 +253,7 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findEmptyPPI() return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -284,7 +284,7 @@ Bool ParkingPlaceBehavior::hasAvailableSpaceFor(const ThingTemplate* thing) cons if (id != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(id); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { id = INVALID_ID; } @@ -308,10 +308,10 @@ Bool ParkingPlaceBehavior::reserveSpace(ObjectID id, Real parkingOffset, Parking const ParkingPlaceBehaviorModuleData* d = getParkingPlaceBehaviorModuleData(); ParkingPlaceInfo* ppi = findPPI(id); - if (ppi == NULL) + if (ppi == nullptr) { ppi = findEmptyPPI(); - if (ppi == NULL) + if (ppi == nullptr) { DEBUG_CRASH(("No parking places!")); return false; // nothing available @@ -589,7 +589,7 @@ void ParkingPlaceBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detec if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -604,7 +604,7 @@ void ParkingPlaceBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detec { releaseSpace(obj->getID()); if (obj->getProducerID() == getObject()->getID()) - obj->setProducer(NULL); + obj->setProducer(nullptr); } } else @@ -628,7 +628,7 @@ void ParkingPlaceBehavior::killAllParkedUnits() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -672,7 +672,7 @@ UpdateSleepTime ParkingPlaceBehavior::update() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); } @@ -723,7 +723,7 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD { if (exitDoor != DOOR_NONE_NEEDED) { - ParkingPlaceInfo* ppi = NULL; + ParkingPlaceInfo* ppi = nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { if (it->m_objectInSpace == INVALID_ID && it->m_reservedForExit == TRUE && it->m_door == exitDoor) @@ -771,7 +771,7 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD { CRCDEBUG_LOG(("Produced at hangar (door = %d)", exitDoor)); DEBUG_ASSERTCRASH(exitDoor != DOOR_NONE_NEEDED, ("Hmm, unlikely")); - if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, NULL, NULL, NULL, NULL, &hangarInternal, &hangOrient)) + if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, nullptr, nullptr, nullptr, nullptr, &hangarInternal, &hangOrient)) { DEBUG_CRASH(("no spaces available, how did we get here?")); ppinfo.parkingSpace = *getObject()->getPosition(); @@ -844,7 +844,7 @@ const Coord3D* ParkingPlaceBehavior::getRallyPoint( void ) const { return &m_heliRallyPoint; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index 931c5d80784..94d9447cd1a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -54,9 +54,9 @@ PoisonedBehaviorModuleData::PoisonedBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "PoisonDamageInterval", INI::parseDurationUnsignedInt, NULL, offsetof(PoisonedBehaviorModuleData, m_poisonDamageIntervalData) }, - { "PoisonDuration", INI::parseDurationUnsignedInt, NULL, offsetof(PoisonedBehaviorModuleData, m_poisonDurationData) }, - { 0, 0, 0, 0 } + { "PoisonDamageInterval", INI::parseDurationUnsignedInt, nullptr, offsetof(PoisonedBehaviorModuleData, m_poisonDamageIntervalData) }, + { "PoisonDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(PoisonedBehaviorModuleData, m_poisonDurationData) }, + { nullptr, nullptr, nullptr, 0 } }; UpdateModuleData::buildFieldParse(p); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp index 89be9fc77d3..5ab7fb70d18 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp @@ -72,7 +72,7 @@ PrisonVisual::PrisonVisual( void ) m_objectID = INVALID_ID; m_drawableID = INVALID_DRAWABLE_ID; - m_next = NULL; + m_next = nullptr; } @@ -105,8 +105,8 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "ShowPrisoners", INI::parseBool, NULL, offsetof( PrisonBehaviorModuleData, m_showPrisoners ) }, - { "YardBonePrefix", INI::parseAsciiString, NULL, offsetof( PrisonBehaviorModuleData, m_prisonYardBonePrefix ) }, + { "ShowPrisoners", INI::parseBool, nullptr, offsetof( PrisonBehaviorModuleData, m_showPrisoners ) }, + { "YardBonePrefix", INI::parseAsciiString, nullptr, offsetof( PrisonBehaviorModuleData, m_prisonYardBonePrefix ) }, { 0, 0, 0, 0 } }; @@ -125,7 +125,7 @@ PrisonBehavior::PrisonBehavior( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { - m_visualList = NULL; + m_visualList = nullptr; } @@ -214,7 +214,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) Int i; // sanity - if( pos == NULL ) + if( pos == nullptr ) return; // initialize the picked location to that of the prison center @@ -226,7 +226,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) Int yardBones = us->getMultiLogicalBonePosition( modData->m_prisonYardBonePrefix.str(), MAX_YARD_BONES, yardPositions, - NULL ); + nullptr ); // // we must have at least 3 bone locations to make a yard polygon, otherwise we'll @@ -300,7 +300,7 @@ void PrisonBehavior::addVisual( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // create a drawable @@ -338,14 +338,14 @@ void PrisonBehavior::removeVisual( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // initialize a drawable ID to invalid DrawableID drawableID = INVALID_DRAWABLE_ID; // find visual info in our list, once found, take this opportunity to remove it from that list - PrisonVisual *visual, *prevVisual = NULL; + PrisonVisual *visual, *prevVisual = nullptr; for( visual = m_visualList; visual; visual = visual->m_next ) { @@ -434,7 +434,7 @@ void PrisonBehavior::xfer( Xfer *xfer ) { // the visual list should be empty - if( m_visualList != NULL ) + if( m_visualList != nullptr ) { DEBUG_CRASH(( "PrisonBehavior::xfer - the visual list should be empty but is not" )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp index f4ffa2deddc..21b7e78f28d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp @@ -62,7 +62,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "BrainwashDuration", INI::parseDurationUnsignedInt, NULL, offsetof( PropagandaCenterBehaviorModuleData, m_brainwashDuration ) }, + { "BrainwashDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( PropagandaCenterBehaviorModuleData, m_brainwashDuration ) }, { 0, 0, 0, 0 } }; @@ -164,7 +164,7 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) // remove any surrender status from this object AIUpdateInterface *ai = brainwashingSubject->getAIUpdateInterface(); if( ai ) - ai->setSurrendered( NULL, FALSE ); + ai->setSurrendered( nullptr, FALSE ); // add this object to our brainwashed list if we're not already in it for( BrainwashedIDListIterator it = m_brainwashedList.begin(); @@ -216,7 +216,7 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) void PropagandaCenterBehavior::onRemoving( Object *obj ) { - // if we're removing the brainwashing subject, NULL the pointer + // if we're removing the brainwashing subject, nullptr the pointer if( m_brainwashingSubjectID == obj->getID() ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 3d0ee6d9b27..c0fff7a12cb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -61,7 +61,7 @@ class ObjectTracker : public MemoryPoolObject public: - ObjectTracker( void ) { objectID = INVALID_ID; next = NULL; } + ObjectTracker( void ) { objectID = INVALID_ID; next = nullptr; } ObjectID objectID; ObjectTracker *next; @@ -82,9 +82,9 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) m_scanDelayInFrames = 100; m_autoHealPercentPerSecond = 0.01f; m_upgradedAutoHealPercentPerSecond = 0.02f; - m_pulseFX = NULL; - m_upgradeRequired = NULL; - m_upgradedPulseFX = NULL; + m_pulseFX = nullptr; + m_upgradeRequired = nullptr; + m_upgradedPulseFX = nullptr; } @@ -96,14 +96,14 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "Radius", INI::parseReal, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_scanRadius ) }, - { "DelayBetweenUpdates", INI::parseDurationUnsignedInt, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_scanDelayInFrames ) }, - { "HealPercentEachSecond", INI::parsePercentToReal, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_autoHealPercentPerSecond ) }, - { "UpgradedHealPercentEachSecond", INI::parsePercentToReal,NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedAutoHealPercentPerSecond ) }, - { "PulseFX", INI::parseFXList, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_pulseFX ) }, - { "UpgradeRequired", INI::parseAsciiString, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradeRequired ) }, - { "UpgradedPulseFX", INI::parseFXList, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedPulseFX ) }, - { 0, 0, 0, 0 } + { "Radius", INI::parseReal, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_scanRadius ) }, + { "DelayBetweenUpdates", INI::parseDurationUnsignedInt, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_scanDelayInFrames ) }, + { "HealPercentEachSecond", INI::parsePercentToReal, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_autoHealPercentPerSecond ) }, + { "UpgradedHealPercentEachSecond", INI::parsePercentToReal,nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedAutoHealPercentPerSecond ) }, + { "PulseFX", INI::parseFXList, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_pulseFX ) }, + { "UpgradeRequired", INI::parseAsciiString, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradeRequired ) }, + { "UpgradedPulseFX", INI::parseFXList, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedPulseFX ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -120,7 +120,7 @@ PropagandaTowerBehavior::PropagandaTowerBehavior( Thing *thing, const ModuleData : UpdateModule( thing, modData ) { m_lastScanFrame = 0; - m_insideList = NULL; + m_insideList = nullptr; setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); } @@ -228,7 +228,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) // go through any objects in our area of influence and do the effect logic on them Object *obj; - ObjectTracker *curr = NULL, *prev = NULL, *next = NULL; + ObjectTracker *curr = nullptr, *prev = nullptr, *next = nullptr; for( curr = m_insideList; curr; curr = next ) { @@ -381,7 +381,7 @@ void PropagandaTowerBehavior::doScan( void ) { const PropagandaTowerBehaviorModuleData *modData = getPropagandaTowerBehaviorModuleData(); Object *us = getObject(); - ObjectTracker *newInsideList = NULL; + ObjectTracker *newInsideList = nullptr; // The act of scanning is when we play our effect Bool upgradePresent = FALSE; @@ -440,7 +440,7 @@ void PropagandaTowerBehavior::doScan( void ) &filterAlive, &filterMapStatus, &filterOutBuildings, - NULL + nullptr }; // scan objects in our region @@ -476,13 +476,13 @@ void PropagandaTowerBehavior::doScan( void ) { // find this entry in the new list - ObjectTracker *o = NULL; + ObjectTracker *o = nullptr; for( o = newInsideList; o; o = o->next ) if( o->objectID == curr->objectID ) break; // if entry wasn't there, remove the bonus from this object - if( o == NULL ) + if( o == nullptr ) { obj = TheGameLogic->findObjectByID( curr->objectID ); @@ -562,7 +562,7 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) { // sanity - if( m_insideList != NULL ) + if( m_insideList != nullptr ) { DEBUG_CRASH(( "PropagandaTowerBehavior::xfer - m_insideList should be empty but is not" )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp index cbb54d5a2cd..102f6320dd1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp @@ -62,10 +62,10 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "WorkerObjectName", INI::parseAsciiString, NULL, offsetof( RebuildHoleBehaviorModuleData, m_workerTemplateName ) }, - { "WorkerRespawnDelay", INI::parseDurationReal, NULL, offsetof( RebuildHoleBehaviorModuleData, m_workerRespawnDelay ) }, - { "HoleHealthRegen%PerSecond", INI::parsePercentToReal, NULL, offsetof( RebuildHoleBehaviorModuleData, m_holeHealthRegenPercentPerSecond ) }, - { 0, 0, 0, 0 } + { "WorkerObjectName", INI::parseAsciiString, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_workerTemplateName ) }, + { "WorkerRespawnDelay", INI::parseDurationReal, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_workerRespawnDelay ) }, + { "HoleHealthRegen%PerSecond", INI::parsePercentToReal, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_holeHealthRegenPercentPerSecond ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -86,8 +86,8 @@ RebuildHoleBehavior::RebuildHoleBehavior( Thing *thing, const ModuleData* module m_reconstructingID = INVALID_ID; m_spawnerObjectID = INVALID_ID; m_workerWaitCounter = 0; - m_workerTemplate = NULL; - m_rebuildTemplate = NULL; + m_workerTemplate = nullptr; + m_rebuildTemplate = nullptr; } @@ -150,7 +150,7 @@ void RebuildHoleBehavior::startRebuildProcess( const ThingTemplate *rebuild, Obj m_spawnerObjectID = spawnerID; // start the spawning process for a worker - newWorkerRespawnProcess( NULL ); + newWorkerRespawnProcess( nullptr ); } @@ -183,8 +183,8 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) { const RebuildHoleBehaviorModuleData *modData = getRebuildHoleBehaviorModuleData(); Object *hole = getObject(); - Object *reconstructing = NULL; - Object *worker = NULL; + Object *reconstructing = nullptr; + Object *worker = nullptr; // get the worker object if we have one if( m_workerID != 0 ) @@ -194,8 +194,8 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) worker = TheGameLogic->findObjectByID( m_workerID ); // if the worker is no longer there, start the respawning process for a worker again - if( worker == NULL ) - newWorkerRespawnProcess( NULL ); + if( worker == nullptr ) + newWorkerRespawnProcess( nullptr ); } @@ -210,7 +210,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) // if that object does not exist anymore, we need to kill a worker if we have one // and start the spawning process over again // - if( reconstructing == NULL ) + if( reconstructing == nullptr ) { newWorkerRespawnProcess( worker ); @@ -221,7 +221,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) } // see if it's time for us to spawn a worker - if( worker == NULL && m_workerWaitCounter > 0 ) + if( worker == nullptr && m_workerWaitCounter > 0 ) { // decrement counter and respawn if it's time @@ -229,7 +229,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) { // resolve the worker template pointer if necessary - if( m_workerTemplate == NULL ) + if( m_workerTemplate == nullptr ) m_workerTemplate = TheThingFactory->findTemplate( modData->m_workerTemplateName ); // create a worker @@ -251,7 +251,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) if( ai ) { - if( reconstructing == NULL ) + if( reconstructing == nullptr ) reconstructing = ai->construct( m_rebuildTemplate, hole->getPosition(), hole->getOrientation(), @@ -357,7 +357,7 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) // ------------------------------------------------------------------------------------------------ /*static*/ RebuildHoleBehaviorInterface* RebuildHoleBehavior::getRebuildHoleBehaviorInterfaceFromObject( Object *obj ) { - RebuildHoleBehaviorInterface *rhbi = NULL; + RebuildHoleBehaviorInterface *rhbi = nullptr; if( obj ) { @@ -428,7 +428,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) { m_workerTemplate = TheThingFactory->findTemplate( workerName ); - if( m_workerTemplate == NULL ) + if( m_workerTemplate == nullptr ) { DEBUG_CRASH(( "RebuildHoleBehavior::xfer - Unable to find template '%s'", @@ -439,7 +439,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) } else - m_workerTemplate = NULL; + m_workerTemplate = nullptr; } @@ -453,7 +453,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) { m_rebuildTemplate = TheThingFactory->findTemplate( rebuildName ); - if( m_rebuildTemplate == NULL ) + if( m_rebuildTemplate == nullptr ) { DEBUG_CRASH(( "RebuildHoleBehavior::xfer - Unable to find template '%s'", @@ -464,7 +464,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) } else - m_rebuildTemplate = NULL; + m_rebuildTemplate = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index a833818b7f3..1a44165671a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -81,7 +81,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fx[sdphase].push_back(fxl); @@ -95,7 +95,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[sdphase].push_back(ocl); @@ -109,7 +109,7 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const WeaponTemplate *wt = TheWeaponStore->findWeaponTemplate(token); // could be null! this is OK! self->m_weapons[sdphase].push_back(wt); @@ -125,22 +125,22 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* static const FieldParse dataFieldParse[] = { - { "SinkRate", INI::parseVelocityReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkRate ) }, - { "ProbabilityModifier", INI::parseInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_probabilityModifier ) }, - { "ModifierBonusPerOverkillPercent", INI::parsePercentToReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_modifierBonusPerOverkillPercent ) }, - { "SinkDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkDelay ) }, - { "SinkDelayVariance", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkDelayVariance ) }, - { "DestructionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionDelay ) }, - { "DestructionDelayVariance", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionDelayVariance ) }, - { "DestructionAltitude", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionAltitude ) }, - { "FX", parseFX, NULL, 0 }, - { "OCL", parseOCL, NULL, 0 }, - { "Weapon", parseWeapon, NULL, 0 }, - { "FlingForce", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForce) }, - { "FlingForceVariance", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) }, - { "FlingPitch", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitch) }, - { "FlingPitchVariance", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitchVariance) }, - { 0, 0, 0, 0 } + { "SinkRate", INI::parseVelocityReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkRate ) }, + { "ProbabilityModifier", INI::parseInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_probabilityModifier ) }, + { "ModifierBonusPerOverkillPercent", INI::parsePercentToReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_modifierBonusPerOverkillPercent ) }, + { "SinkDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkDelay ) }, + { "SinkDelayVariance", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkDelayVariance ) }, + { "DestructionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionDelay ) }, + { "DestructionDelayVariance", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionDelayVariance ) }, + { "DestructionAltitude", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionAltitude ) }, + { "FX", parseFX, nullptr, 0 }, + { "OCL", parseOCL, nullptr, 0 }, + { "Weapon", parseWeapon, nullptr, 0 }, + { "FlingForce", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingForce) }, + { "FlingForceVariance", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) }, + { "FlingPitch", INI::parseAngleReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingPitch) }, + { "FlingPitchVariance", INI::parseAngleReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingPitchVariance) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( SlowDeathBehaviorModuleData, m_dieMuxData )); @@ -274,7 +274,7 @@ void SlowDeathBehavior::beginSlowDeath(const DamageInfo *damageInfo) SlavedUpdate* slave = (SlavedUpdate*)obj->findUpdateModule( key_SlavedUpdate ); if( slave ) { - slave->onSlaverDie( NULL ); + slave->onSlaverDie( nullptr ); } } @@ -345,7 +345,7 @@ void SlowDeathBehavior::doPhaseStuff(SlowDeathPhaseType sdphase) const FXListVec& v = d->m_fx[sdphase]; DEBUG_ASSERTCRASH(idx>=0&&idxm_ocls[sdphase].size(); @@ -355,7 +355,7 @@ void SlowDeathBehavior::doPhaseStuff(SlowDeathPhaseType sdphase) const OCLVec& v = d->m_ocls[sdphase]; DEBUG_ASSERTCRASH(idx>=0&&idxm_weapons[sdphase].size(); @@ -493,7 +493,7 @@ void SlowDeathBehavior::onDie( const DamageInfo *damageInfo ) for (; *update; ++update) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo)) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo)) { total += sdu->getProbabilityModifier( damageInfo ); } @@ -507,7 +507,7 @@ void SlowDeathBehavior::onDie( const DamageInfo *damageInfo ) for (/* UpdateModuleInterface** */ update = getObject()->getBehaviorModules(); *update; ++update) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo)) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo)) { roll -= sdu->getProbabilityModifier( damageInfo ); if (roll <= 0) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp index 294fad763d5..411c4aaee6a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp @@ -150,7 +150,7 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onSlaverDie( damageInfo ); break; @@ -158,7 +158,7 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) } // our spawner has died, we must invalidate the ID now in the spawned object - currentSpawn->setProducer( NULL ); + currentSpawn->setProducer( nullptr ); } } @@ -296,7 +296,7 @@ Bool SpawnBehavior::maySpawnSelfTaskAI( Real maxSelfTaskersRatio ) // ------------------------------------------------------------------------------------------------ Object* SpawnBehavior::getClosestSlave( const Coord3D *pos ) { - Object *closest = NULL; + Object *closest = nullptr; Real closestDistance; for( objectIDListIterator it = m_spawnIDs.begin(); it != m_spawnIDs.end(); ++it ) { @@ -483,9 +483,9 @@ class OrphanData OrphanData::OrphanData( void ) { - m_matchTemplate = NULL; - m_source = NULL; - m_closest = NULL; + m_matchTemplate = nullptr; + m_source = nullptr; + m_closest = nullptr; m_closestDistSq = BIG_DISTANCE; } @@ -539,7 +539,7 @@ Object *SpawnBehavior::reclaimOrphanSpawn( void ) continue; orphanData.m_matchTemplate = TheThingFactory->findTemplate( *tempName ); orphanData.m_source = getObject(); - orphanData.m_closest = NULL; + orphanData.m_closest = nullptr; orphanData.m_closestDistSq = BIG_DISTANCE; player->iterateObjects( findClosestOrphan, &orphanData ); prevName = *tempName; @@ -555,17 +555,17 @@ Bool SpawnBehavior::createSpawn() const SpawnBehaviorModuleData *md = getSpawnBehaviorModuleData(); ExitInterface* exitInterface = parent->getObjectExitInterface(); - if( exitInterface == NULL ) + if( exitInterface == nullptr ) { - DEBUG_ASSERTCRASH( exitInterface != NULL, ("Something cannot have SpawnBehavior without an exit interface") ); + DEBUG_ASSERTCRASH( exitInterface != nullptr, ("Something cannot have SpawnBehavior without an exit interface") ); return FALSE; } - ExitDoorType exitDoor = exitInterface->reserveDoorForExit(NULL, NULL); + ExitDoorType exitDoor = exitInterface->reserveDoorForExit(nullptr, nullptr); if (exitDoor == DOOR_NONE_AVAILABLE) return FALSE; - Object *newSpawn = NULL; + Object *newSpawn = nullptr; // try to reclaim orphaned objects if possible Bool reclaimedOrphan = FALSE; @@ -577,7 +577,7 @@ Bool SpawnBehavior::createSpawn() } // This assures that an orphan has not just been reclaimed, - if( newSpawn == NULL ) // and that we really want a new spawn, here. + if( newSpawn == nullptr ) // and that we really want a new spawn, here. { m_spawnTemplate = TheThingFactory->findTemplate( *m_templateNameIterator ); @@ -607,7 +607,7 @@ Bool SpawnBehavior::createSpawn() for (BehaviorModule** update = newSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onEnslave( parent ); break; @@ -631,7 +631,7 @@ Bool SpawnBehavior::createSpawn() ExitInterface* barracksExitInterface = barracks->getObjectExitInterface(); if ( barracksExitInterface ) { - ExitDoorType barracksDoor = barracksExitInterface->reserveDoorForExit(NULL, NULL); + ExitDoorType barracksDoor = barracksExitInterface->reserveDoorForExit(nullptr, nullptr); barracksExitInterface->exitObjectViaDoor( newSpawn, barracksDoor ); newSpawn->setProducer(parent);//let parents producer exit him, but he thinks it was me --m_initialBurstCountdown; @@ -646,8 +646,8 @@ Bool SpawnBehavior::createSpawn() { // find the closest spawn to the nexus... //there is probably a more elegant way to choose the budHost, but oh well - Object *budHost = NULL; - Object *curSpawn = NULL; + Object *budHost = nullptr; + Object *curSpawn = nullptr; Real tapeMeasure = 99999; Real closest = 999999.9f; // 1000 * 1000 objectIDListIterator iter; @@ -667,7 +667,7 @@ Bool SpawnBehavior::createSpawn() } } } - exitInterface->exitObjectByBudding( newSpawn, budHost );// also handles the NULL pointer okay + exitInterface->exitObjectByBudding( newSpawn, budHost );// also handles the nullptr pointer okay } @@ -721,7 +721,7 @@ void SpawnBehavior::onSpawnDeath( ObjectID deadSpawn, DamageInfo *damageInfo ) if ( (m_spawnCount == 0) && m_aggregateHealth) // I'm dead without my spawn { Object *killer = TheGameLogic->findObjectByID(damageInfo->in.m_sourceID); - if (killer != NULL) { + if (killer != nullptr) { killer->scoreTheKill(getObject()); } TheGameLogic->destroyObject(getObject()); @@ -759,7 +759,7 @@ void SpawnBehavior::onDamage( DamageInfo *info ) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onSlaverDamage( info ); break; @@ -830,8 +830,8 @@ void SpawnBehavior::computeAggregateStates(void) Bool SomebodyIsSelected = FALSE; Bool SomebodyIsNotSelected = FALSE; - Drawable *spawnDraw = NULL; - Object *currentSpawn = NULL; + Drawable *spawnDraw = nullptr; + Object *currentSpawn = nullptr; WeaponBonusConditionFlags spawnWeaponBonus; @@ -849,7 +849,7 @@ void SpawnBehavior::computeAggregateStates(void) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { m_selfTaskingSpawnCount += ( sdu->isSelfTasking()); break; @@ -1009,12 +1009,12 @@ void SpawnBehavior::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - m_spawnTemplate = NULL; + m_spawnTemplate = nullptr; if( name.isEmpty() == FALSE ) { m_spawnTemplate = TheThingFactory->findTemplate( name ); - if( m_spawnTemplate == NULL ) + if( m_spawnTemplate == nullptr ) { DEBUG_CRASH(( "SpawnBehavior::xfer - Unable to find template '%s'", name.str() )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index a6d6ed0281c..5a0c0de7853 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -50,10 +50,10 @@ SupplyWarehouseCripplingBehaviorModuleData::SupplyWarehouseCripplingBehaviorModu static const FieldParse dataFieldParse[] = { - { "SelfHealSupression", INI::parseDurationUnsignedInt, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealSupression) }, - { "SelfHealDelay", INI::parseDurationUnsignedInt, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealDelay) }, - { "SelfHealAmount", INI::parseReal, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealAmount) }, - { 0, 0, 0, 0 } + { "SelfHealSupression", INI::parseDurationUnsignedInt, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealSupression) }, + { "SelfHealDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealDelay) }, + { "SelfHealAmount", INI::parseReal, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealAmount) }, + { nullptr, nullptr, nullptr, 0 } }; UpdateModuleData::buildFieldParse(p); @@ -103,7 +103,7 @@ UpdateSleepTime SupplyWarehouseCripplingBehavior::update() UnsignedInt now = TheGameLogic->getFrame(); m_nextHealingFrame = now + md->m_selfHealDelay; - getObject()->attemptHealing(md->m_selfHealAmount, NULL); + getObject()->attemptHealing(md->m_selfHealAmount, nullptr); if( getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth() ) return UPDATE_SLEEP_FOREVER;// this can't be in onHealing, as the healing comes from here diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp index 7b1efe52b69..c9da92bb87c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp @@ -42,7 +42,7 @@ // ------------------------------------------------------------------------------------------------ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) { - m_pulseFX = NULL; + m_pulseFX = nullptr; m_pulseFXRate = 0; } @@ -54,9 +54,9 @@ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "PulseFX", INI::parseFXList, NULL, offsetof( TechBuildingBehaviorModuleData, m_pulseFX ) }, - { "PulseFXRate", INI::parseDurationUnsignedInt, NULL, offsetof( TechBuildingBehaviorModuleData, m_pulseFXRate ) }, - { 0, 0, 0, 0 } + { "PulseFX", INI::parseFXList, nullptr, offsetof( TechBuildingBehaviorModuleData, m_pulseFX ) }, + { "PulseFXRate", INI::parseDurationUnsignedInt, nullptr, offsetof( TechBuildingBehaviorModuleData, m_pulseFXRate ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -105,7 +105,7 @@ UpdateSleepTime TechBuildingBehavior::update( void ) } // if we have a pulse fx, and are owned, sleep only a little while, otherwise sleep forever - if (d->m_pulseFX != NULL && d->m_pulseFXRate > 0 && captured) + if (d->m_pulseFX != nullptr && d->m_pulseFXRate > 0 && captured) { FXList::doFXObj( d->m_pulseFX, us ); return UPDATE_SLEEP(d->m_pulseFXRate); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index f96f8c8d33b..5894e32e231 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -134,9 +134,9 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxHealth", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_maxHealth ) }, - { "InitialHealth", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_initialHealth ) }, - { 0, 0, 0, 0 } + { "MaxHealth", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_maxHealth ) }, + { "InitialHealth", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_initialHealth ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -145,8 +145,8 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- ActiveBody::ActiveBody( Thing *thing, const ModuleData* moduleData ) : BodyModule(thing, moduleData), - m_curDamageFX(NULL), - m_curArmorSet(NULL), + m_curDamageFX(nullptr), + m_curArmorSet(nullptr), m_frontCrushed(false), m_backCrushed(false), m_lastDamageTimestamp(0xffffffff),// So we don't think we just got damaged on the first frame @@ -155,7 +155,7 @@ ActiveBody::ActiveBody( Thing *thing, const ModuleData* moduleData ) : m_nextDamageFXTime(0), m_lastDamageFXDone((DamageType)-1), m_lastDamageCleared(false), - m_particleSystems(NULL), + m_particleSystems(nullptr), m_indestructible(false) { m_currentHealth = getActiveBodyModuleData()->m_initialHealth; @@ -324,7 +324,7 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) validateArmorAndDamageFX(); // sanity - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if ( m_indestructible ) @@ -551,7 +551,7 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo ) validateArmorAndDamageFX(); // sanity - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType != DAMAGE_HEALING ) @@ -726,7 +726,7 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, Object *us = getObject(); // sanity - if( systemTemplate == NULL ) + if( systemTemplate == nullptr ) return; // get the bones @@ -735,7 +735,7 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, Int numBones = us->getMultiLogicalBonePosition( boneBaseName.str(), MAX_BONES, bonePositions, - NULL, + nullptr, FALSE ); // if no bones found nothing else to do @@ -1272,7 +1272,7 @@ void ActiveBody::xfer( Xfer *xfer ) ParticleSystemID particleSystemID; // the list should be empty at this time - if( m_particleSystems != NULL ) + if( m_particleSystems != nullptr ) { DEBUG_CRASH(( "ActiveBody::xfer - m_particleSystems should be empty, but is not" )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp index ce79e918640..ba77c2b2604 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp @@ -76,7 +76,7 @@ Real InactiveBody::estimateDamage( DamageInfoInput& damageInfo ) const //------------------------------------------------------------------------------------------------- void InactiveBody::attemptDamage( DamageInfo *damageInfo ) { - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType == DAMAGE_HEALING ) @@ -113,7 +113,7 @@ void InactiveBody::attemptDamage( DamageInfo *damageInfo ) //------------------------------------------------------------------------------------------------- void InactiveBody::attemptHealing( DamageInfo *damageInfo ) { - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType != DAMAGE_HEALING ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp index 2eacd9f0103..fa5fa721d96 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp @@ -186,7 +186,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other ) Bool targetCanEject = FALSE; - BehaviorModule **dmi = NULL; + BehaviorModule **dmi = nullptr; for( dmi = other->getBehaviorModules(); *dmi; ++dmi ) { if( (*dmi)->getEjectPilotDieInterface() ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp index 8d8e7d5081b..8e2b5504616 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp @@ -50,7 +50,7 @@ CrateCollideModuleData::CrateCollideModuleData() m_executeAnimationFades = TRUE; m_isBuildingPickup = FALSE; m_isHumanOnlyPickup = FALSE; - m_executeFX = NULL; + m_executeFX = nullptr; m_pickupScience = SCIENCE_INVALID; m_executionAnimationTemplate = AsciiString::TheEmptyString; } @@ -63,19 +63,19 @@ void CrateCollideModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CrateCollideModuleData, m_kindof ) }, - { "ForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CrateCollideModuleData, m_kindofnot ) }, - { "ForbidOwnerPlayer", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) }, - { "BuildingPickup", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isBuildingPickup ) }, - { "HumanOnly", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) }, - { "PickupScience", INI::parseScience, NULL, offsetof( CrateCollideModuleData, m_pickupScience ) }, - { "ExecuteFX", INI::parseFXList, NULL, offsetof( CrateCollideModuleData, m_executeFX ) }, - { "ExecuteAnimation", INI::parseAsciiString, NULL, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) }, - { "ExecuteAnimationTime", INI::parseReal, NULL, offsetof( CrateCollideModuleData, m_executeAnimationDisplayTimeInSeconds ) }, - { "ExecuteAnimationZRise", INI::parseReal, NULL, offsetof( CrateCollideModuleData, m_executeAnimationZRisePerSecond ) }, - { "ExecuteAnimationFades", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_executeAnimationFades ) }, - - { 0, 0, 0, 0 } + { "RequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateCollideModuleData, m_kindof ) }, + { "ForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateCollideModuleData, m_kindofnot ) }, + { "ForbidOwnerPlayer", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) }, + { "BuildingPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isBuildingPickup ) }, + { "HumanOnly", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) }, + { "PickupScience", INI::parseScience, nullptr, offsetof( CrateCollideModuleData, m_pickupScience ) }, + { "ExecuteFX", INI::parseFXList, nullptr, offsetof( CrateCollideModuleData, m_executeFX ) }, + { "ExecuteAnimation", INI::parseAsciiString, nullptr, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) }, + { "ExecuteAnimationTime", INI::parseReal, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationDisplayTimeInSeconds ) }, + { "ExecuteAnimationZRise", INI::parseReal, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationZRisePerSecond ) }, + { "ExecuteAnimationFades", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationFades ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -96,7 +96,7 @@ CrateCollide::~CrateCollide( void ) //------------------------------------------------------------------------------------------------- /** The collide event. - * Note that when other is NULL it means "collide with ground" */ + * Note that when other is nullptr it means "collide with ground" */ //------------------------------------------------------------------------------------------------- void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) { @@ -106,7 +106,7 @@ void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) { if( executeCrateBehavior( other ) ) { - if( modData->m_executeFX != NULL ) + if( modData->m_executeFX != nullptr ) { // Note: We pass in other here, because the crate is owned by the neutral player, and // we want to do things that only the other person can see. @@ -137,7 +137,7 @@ void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) Bool CrateCollide::isValidToExecute( const Object *other ) const { //The ground never picks up a crate - if( other == NULL ) + if( other == nullptr ) return FALSE; //Nothing Neutral can pick up any type of crate @@ -148,7 +148,7 @@ Bool CrateCollide::isValidToExecute( const Object *other ) const Bool validBuildingAttempt = md->m_isBuildingPickup && other->isKindOf( KINDOF_STRUCTURE ); // Must be a "Unit" type thing. Real Game Object, not just Object - if( other->getAIUpdateInterface() == NULL && !validBuildingAttempt )// Building exception flag for Drop Zone + if( other->getAIUpdateInterface() == nullptr && !validBuildingAttempt )// Building exception flag for Drop Zone return FALSE; // must match our kindof flags (if any) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp index 3ba3e048566..1b921e17116 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp @@ -112,7 +112,7 @@ Bool SalvageCrateCollide::executeCrateBehavior( Object *other ) // ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::eligibleForWeaponSet( Object *other ) { - if( other == NULL ) + if( other == nullptr ) return FALSE; // A kindof marks eligibility, and you must not be fully upgraded @@ -127,7 +127,7 @@ Bool SalvageCrateCollide::eligibleForWeaponSet( Object *other ) // ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::eligibleForLevel( Object *other ) { - if( other == NULL ) + if( other == nullptr ) return FALSE; // Sorry, you are max level diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp index e6b019cc9b8..9170d558425 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp @@ -58,7 +58,7 @@ Bool UnitCrateCollide::executeCrateBehavior( Object *other ) UnsignedInt unitCount = getUnitCrateCollideModuleData()->m_unitCount; ThingTemplate const *unitType = TheThingFactory->findTemplate( getUnitCrateCollideModuleData()->m_unitType ); - if( unitType == NULL ) + if( unitType == nullptr ) { return FALSE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp index 427271044f7..9e055264977 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp @@ -139,7 +139,7 @@ Bool VeterancyCrateCollide::executeCrateBehavior( Object *other ) if (range == 0) { // do just the collider - if (other != NULL) + if (other != nullptr) { other->getExperienceTracker()->gainExpForLevel( levelsToGain, ( ! md->m_isPilot) ); } @@ -148,7 +148,7 @@ Bool VeterancyCrateCollide::executeCrateBehavior( Object *other ) { PartitionFilterSamePlayer othersPlayerFilter( other->getControllingPlayer() ); PartitionFilterSameMapStatus filterMapStatus(other); - PartitionFilter *filters[] = { &othersPlayerFilter, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &othersPlayerFilter, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( other, range, FROM_CENTER_2D, filters, ITER_FASTEST ); MemoryPoolObjectHolder hold(iter); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp index 6706f057ebe..3e66c56c9e8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp @@ -43,11 +43,11 @@ void FireWeaponCollideModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "CollideWeapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponCollideModuleData, m_collideWeaponTemplate ) }, - { "FireOnce", INI::parseBool, NULL, offsetof( FireWeaponCollideModuleData, m_fireOnce ) }, - { "RequiredStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( FireWeaponCollideModuleData, m_requiredStatus ) }, - { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( FireWeaponCollideModuleData, m_forbiddenStatus ) }, - { 0, 0, 0, 0 } + { "CollideWeapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponCollideModuleData, m_collideWeaponTemplate ) }, + { "FireOnce", INI::parseBool, nullptr, offsetof( FireWeaponCollideModuleData, m_fireOnce ) }, + { "RequiredStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( FireWeaponCollideModuleData, m_requiredStatus ) }, + { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( FireWeaponCollideModuleData, m_forbiddenStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -56,7 +56,7 @@ void FireWeaponCollideModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- FireWeaponCollide::FireWeaponCollide( Thing *thing, const ModuleData* moduleData ) : CollideModule( thing, moduleData ), - m_collideWeapon(NULL) + m_collideWeapon(nullptr) { m_collideWeapon = TheWeaponStore->allocateNewWeapon(getFireWeaponCollideModuleData()->m_collideWeaponTemplate, PRIMARY_WEAPON); m_everFired = FALSE; @@ -74,7 +74,7 @@ FireWeaponCollide::~FireWeaponCollide( void ) //------------------------------------------------------------------------------------------------- void FireWeaponCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { - if( other == NULL ) + if( other == nullptr ) return; //Don't shoot the ground Object *me = getObject(); @@ -144,7 +144,7 @@ void FireWeaponCollide::xfer( Xfer *xfer ) if( collideWeaponPresent ) { - DEBUG_ASSERTCRASH( m_collideWeapon != NULL, + DEBUG_ASSERTCRASH( m_collideWeapon != nullptr, ("FireWeaponCollide::xfer - m_collideWeapon present mismatch") ); xfer->xferSnapshot( m_collideWeapon ); @@ -152,7 +152,7 @@ void FireWeaponCollide::xfer( Xfer *xfer ) else { - DEBUG_ASSERTCRASH( m_collideWeapon == NULL, + DEBUG_ASSERTCRASH( m_collideWeapon == nullptr, ("FireWeaponCollide::Xfer - m_collideWeapon missing mismatch" )); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp index dd014d6c640..ca4bc9b2ed7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp @@ -62,7 +62,7 @@ SquishCollide::~SquishCollide( void ) void SquishCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // Note that other == null means "collide with ground" - if (other == NULL) + if (other == nullptr) return; Object *self = getObject(); @@ -92,7 +92,7 @@ void SquishCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D if( other->getCrusherLevel() > 0 && other->getRelationship(getObject()) != ALLIES) { PhysicsBehavior *otherPhysics = other->getPhysics(); - if (otherPhysics == NULL) + if (otherPhysics == nullptr) return; // use a 1.0 crush radius so the tank has to actually hit the infantry. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp index 603106a97f9..bdb672e82af 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp @@ -55,7 +55,7 @@ CaveContain::CaveContain( Thing *thing, const ModuleData* moduleData ) : OpenCon { m_needToRunOnBuildComplete = true; m_caveIndex = 0; - m_originalTeam = NULL; + m_originalTeam = nullptr; } //------------------------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ void CaveContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // @@ -175,10 +175,10 @@ void CaveContain::onRemoving( Object *obj ) // (hokey exception: if our team is null, don't bother -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() != NULL) + if (getObject()->getTeam() != nullptr) { changeTeamOnAllConnectedCaves( m_originalTeam, FALSE ); - m_originalTeam = NULL; + m_originalTeam = nullptr; } // change the state back from garrisoned @@ -278,7 +278,7 @@ void CaveContain::tryToSetCaveIndex( Int newIndex ) void CaveContain::recalcApparentControllingPlayer( void ) { //Record original team first time through. - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { m_originalTeam = getObject()->getTeam(); } @@ -286,8 +286,8 @@ void CaveContain::recalcApparentControllingPlayer( void ) // (hokey trick: if our team is null, nuke originalTeam -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() == NULL) - m_originalTeam = NULL; + if (getObject()->getTeam() == nullptr) + m_originalTeam = nullptr; // This is called from onContaining, so a one is the edge trigger to do capture stuff if( getContainCount() == 1 ) @@ -324,10 +324,10 @@ static CaveInterface* findCave(Object* obj) for (BehaviorModule** i = obj->getBehaviorModules(); *i; ++i) { CaveInterface* c = (*i)->getCaveInterface(); - if (c != NULL) + if (c != nullptr) return c; } - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////////////// @@ -344,12 +344,12 @@ void CaveContain::changeTeamOnAllConnectedCaves( Team *newTeam, Bool setOriginal // This is a distributed Garrison in terms of capturing, so when one node // triggers the change, he needs to tell everyone, so anyone can do the un-change. CaveInterface *caveModule = findCave(currentCave); - if( caveModule == NULL ) + if( caveModule == nullptr ) continue; if( setOriginalTeams ) caveModule->setOriginalTeam( currentCave->getTeam() ); else - caveModule->setOriginalTeam( NULL ); + caveModule->setOriginalTeam( nullptr ); // Now do the actual switch for this one. @@ -408,7 +408,7 @@ void CaveContain::xfer( Xfer *xfer ) { m_originalTeam = TheTeamFactory->findTeamByID( teamID ); - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { DEBUG_CRASH(( "CaveContain::xfer - Unable to find original team by id" )); @@ -418,7 +418,7 @@ void CaveContain::xfer( Xfer *xfer ) } else - m_originalTeam = NULL; + m_originalTeam = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 3851d860cad..23f0175ff6c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -95,7 +95,7 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, #endif // sanity - if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) + if( targetPos == nullptr || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) return GARRISON_INDEX_INVALID; Int closestIndex = GARRISON_INDEX_INVALID; @@ -105,7 +105,7 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, { // only consider free garrison points - if( m_garrisonPointData[ i ].object == NULL ) + if( m_garrisonPointData[ i ].object == nullptr ) { // compute the squared distance between these two points @@ -134,7 +134,7 @@ Int GarrisonContain::getObjectGarrisonPointIndex( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return GARRISON_INDEX_INVALID; for( Int i = 0; i < MAX_GARRISON_POINTS; ++i ) @@ -156,7 +156,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); // sanity - if( obj == NULL || pointIndex < 0 || pointIndex >= MAX_GARRISON_POINTS || + if( obj == nullptr || pointIndex < 0 || pointIndex >= MAX_GARRISON_POINTS || conditionIndex < 0 || conditionIndex >= MAX_GARRISON_POINT_CONDITIONS ) { @@ -166,7 +166,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, } // make sure this point is empty - if( m_garrisonPointData[ pointIndex ].object != NULL ) + if( m_garrisonPointData[ pointIndex ].object != nullptr ) { DEBUG_CRASH(( "GarrisonContain::putObjectAtGarrisonPoint - Garrison Point '%d' is not empty", @@ -315,7 +315,7 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap removeObjectFromGarrisonPoint( source, existingIndex ); } - putObjectAtBestGarrisonPoint( source, victim, NULL ); + putObjectAtBestGarrisonPoint( source, victim, nullptr ); //Okay, now we have positioned the object in the best position for the victim. //Now check if we are able to fire on our victim. @@ -352,7 +352,7 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap removeObjectFromGarrisonPoint( source, existingIndex ); } - putObjectAtBestGarrisonPoint( source, NULL, targetPos ); + putObjectAtBestGarrisonPoint( source, nullptr, targetPos ); //Okay, now we have positioned the object in the best position for the targetPos. //Now check if we are able to fire on our targetPos. @@ -378,11 +378,11 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, { // sanity - if( obj == NULL || (target == NULL && targetPos == NULL) ) + if( obj == nullptr || (target == nullptr && targetPos == nullptr) ) return; // if obj target, override pos - if (target != NULL) + if (target != nullptr) targetPos = target->getPosition(); // if this object is already at a garrison point do nothing @@ -410,7 +410,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // search for the object in the garrison point data, if found, remove it @@ -446,7 +446,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) } // remove from this spot - m_garrisonPointData[ removeIndex ].object = NULL; + m_garrisonPointData[ removeIndex ].object = nullptr; m_garrisonPointData[ removeIndex ].targetID = INVALID_ID; m_garrisonPointData[ removeIndex ].placeFrame = 0; m_garrisonPointData[ removeIndex ].lastEffectFrame = 0; @@ -455,7 +455,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) // destroy drawable for gun barrel and effects if present if( m_garrisonPointData[ removeIndex ].effect ) TheGameClient->destroyDrawable( m_garrisonPointData[ removeIndex ].effect ); - m_garrisonPointData[ removeIndex ].effect = NULL; + m_garrisonPointData[ removeIndex ].effect = nullptr; // set the position of the object to back to the center of the garrisoned building obj->setPosition( getObject()->getPosition() ); @@ -478,7 +478,7 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : { Int i, j; - m_originalTeam = NULL; + m_originalTeam = nullptr; m_hideGarrisonedStateFromNonallies = FALSE; m_garrisonPointsInUse = 0; m_garrisonPointsInitialized = FALSE; @@ -486,11 +486,11 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : for( i = 0; i < MAX_GARRISON_POINTS; i++ ) { - m_garrisonPointData[ i ].object = NULL; + m_garrisonPointData[ i ].object = nullptr; m_garrisonPointData[ i ].targetID = INVALID_ID; m_garrisonPointData[ i ].placeFrame = 0; m_garrisonPointData[ i ].lastEffectFrame = 0; - m_garrisonPointData[ i ].effect = NULL; + m_garrisonPointData[ i ].effect = nullptr; for( j = 0; j < MAX_GARRISON_POINT_CONDITIONS; ++j ) m_garrisonPoint[ j ][ i ].zero(); @@ -615,9 +615,9 @@ void GarrisonContain::addValidObjectsToGarrisonPoints( void ) // already in there // if( victim ) - putObjectAtBestGarrisonPoint( obj, victim, NULL ); + putObjectAtBestGarrisonPoint( obj, victim, nullptr ); else if( victimPos ) - putObjectAtBestGarrisonPoint( obj, NULL, victimPos ); + putObjectAtBestGarrisonPoint( obj, nullptr, victimPos ); } @@ -982,7 +982,7 @@ const Player* GarrisonContain::getApparentControllingPlayer( const Player* obser void GarrisonContain::recalcApparentControllingPlayer( void ) { //Record original team first time through. - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { m_originalTeam = getObject()->getTeam(); } @@ -990,8 +990,8 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) // (hokey trick: if our team is null, nuke originalTeam -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() == NULL) - m_originalTeam = NULL; + if (getObject()->getTeam() == nullptr) + m_originalTeam = nullptr; // Check to see if we have any units contained in our object if( getContainCount() > 0 ) { @@ -1004,7 +1004,7 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) m_hideGarrisonedStateFromNonallies = ( !detected && ( getStealthUnitsContained() == getContainCount() ) ); Player* controller = rider->getControllingPlayer(); - Team *team = controller ? controller->getDefaultTeam() : NULL; + Team *team = controller ? controller->getDefaultTeam() : nullptr; if( team ) { getObject()->setTeam( team ); @@ -1111,7 +1111,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_PRISTINE; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1125,7 +1125,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_DAMAGED; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1139,7 +1139,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_REALLY_DAMAGED; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1349,10 +1349,10 @@ void GarrisonContain::onRemoving( Object *obj ) // (hokey exception: if our team is null, don't bother -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() != NULL) + if (getObject()->getTeam() != nullptr) { getObject()->setTeam( m_originalTeam ); - m_originalTeam = NULL; + m_originalTeam = nullptr; } // we also lose our transient attack ability @@ -1486,7 +1486,7 @@ void GarrisonContain::xfer( Xfer *xfer ) { m_originalTeam = TheTeamFactory->findTeamByID( teamID ); - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { DEBUG_CRASH(( "GarrisonContain::xfer - Unable to find original team by id" )); @@ -1496,7 +1496,7 @@ void GarrisonContain::xfer( Xfer *xfer ) } else - m_originalTeam = NULL; + m_originalTeam = nullptr; } @@ -1605,7 +1605,7 @@ void GarrisonContain::loadPostProcess( void ) { m_garrisonPointData[ i ].object = TheGameLogic->findObjectByID( m_garrisonPointData[ i ].objectID ); - if( m_garrisonPointData[ i ].object == NULL ) + if( m_garrisonPointData[ i ].object == nullptr ) { DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find object for point data" )); @@ -1615,14 +1615,14 @@ void GarrisonContain::loadPostProcess( void ) } else - m_garrisonPointData[ i ].object = NULL; + m_garrisonPointData[ i ].object = nullptr; // drawable effect pointer if( m_garrisonPointData[ i ].effectID != INVALID_ID ) { m_garrisonPointData[ i ].effect = TheGameClient->findDrawableByID( m_garrisonPointData[ i ].effectID ); - if( m_garrisonPointData[ i ].effect == NULL ) + if( m_garrisonPointData[ i ].effect == nullptr ) { DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find effect for point data" )); @@ -1632,7 +1632,7 @@ void GarrisonContain::loadPostProcess( void ) } else - m_garrisonPointData[ i ].effect = NULL; + m_garrisonPointData[ i ].effect = nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp index 4885ab2570d..8f40b8272c5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp @@ -59,8 +59,8 @@ HealContainModuleData::HealContainModuleData( void ) static const FieldParse dataFieldParse[] = { - { "TimeForFullHeal", INI::parseDurationUnsignedInt, NULL, offsetof( HealContainModuleData, m_framesForFullHeal ) }, - { 0, 0, 0, 0 } + { "TimeForFullHeal", INI::parseDurationUnsignedInt, nullptr, offsetof( HealContainModuleData, m_framesForFullHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp index 3e729bc9471..1a2b1c5df88 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp @@ -86,15 +86,15 @@ void MobNexusContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Slots", INI::parseInt, NULL, offsetof( MobNexusContainModuleData, m_slotCapacity ) }, - { "ScatterNearbyOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_scatterNearbyOnExit ) }, - { "OrientLikeContainerOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_orientLikeContainerOnExit ) }, - { "KeepContainerVelocityOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_keepContainerVelocityOnExit ) }, - { "ExitBone", INI::parseAsciiString, NULL, offsetof( MobNexusContainModuleData, m_exitBone ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( MobNexusContainModuleData, m_exitPitchRate ) }, - { "InitialPayload", parseInitialPayload, NULL, 0 }, - { "HealthRegen%PerSec", INI::parseReal, NULL, offsetof( MobNexusContainModuleData, m_healthRegen ) }, - { 0, 0, 0, 0 } + { "Slots", INI::parseInt, nullptr, offsetof( MobNexusContainModuleData, m_slotCapacity ) }, + { "ScatterNearbyOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_scatterNearbyOnExit ) }, + { "OrientLikeContainerOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_orientLikeContainerOnExit ) }, + { "KeepContainerVelocityOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_keepContainerVelocityOnExit ) }, + { "ExitBone", INI::parseAsciiString, nullptr, offsetof( MobNexusContainModuleData, m_exitBone ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( MobNexusContainModuleData, m_exitPitchRate ) }, + { "InitialPayload", parseInitialPayload, nullptr, 0 }, + { "HealthRegen%PerSec", INI::parseReal, nullptr, offsetof( MobNexusContainModuleData, m_healthRegen ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -242,9 +242,9 @@ void MobNexusContain::onRemoving( Object *rider ) if (draw) { Coord3D bonePos, worldPos; - if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, NULL, 1) == 1) + if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, nullptr, 1) == 1) { - getObject()->convertBonePosToWorldPos(&bonePos, NULL, &worldPos, NULL); + getObject()->convertBonePosToWorldPos(&bonePos, nullptr, &worldPos, nullptr); rider->setPosition(&worldPos); } } @@ -383,7 +383,7 @@ UpdateSleepTime MobNexusContain::update() // ------------------------------------------------------------------------------------------------ ExitDoorType MobNexusContain::reserveDoorForExit( const ThingTemplate* objType, Object *specificObject ) { - if( specificObject == NULL ) + if( specificObject == nullptr ) return DOOR_1;// I can, in general, exit people. // This is an override, not an extend. I will check for game legality for diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 659ae112d51..9d5aef9352f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -88,20 +88,20 @@ OpenContainModuleData::OpenContainModuleData( void ) static const FieldParse dataFieldParse[] = { - { "ContainMax", INI::parseInt, NULL, offsetof( OpenContainModuleData, m_containMax ) }, - { "EnterSound", INI::parseAudioEventRTS, NULL, offsetof( OpenContainModuleData, m_enterSound ) }, - { "ExitSound", INI::parseAudioEventRTS, NULL, offsetof( OpenContainModuleData, m_exitSound ) }, - { "DamagePercentToUnits", INI::parsePercentToReal, NULL, offsetof( OpenContainModuleData, m_damagePercentageToUnits ) }, - { "AllowInsideKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( OpenContainModuleData, m_allowInsideKindOf ) }, - { "ForbidInsideKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( OpenContainModuleData, m_forbidInsideKindOf ) }, - { "PassengersAllowedToFire", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_passengersAllowedToFire ) }, - { "PassengersInTurret", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_passengersInTurret ) }, - { "NumberOfExitPaths", INI::parseInt, NULL, offsetof( OpenContainModuleData, m_numberOfExitPaths ) }, - { "DoorOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( OpenContainModuleData, m_doorOpenTime ) }, - { "AllowAlliesInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowAlliesInside ) }, - { "AllowEnemiesInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowEnemiesInside ) }, - { "AllowNeutralInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowNeutralInside ) }, - { 0, 0, 0, 0 } + { "ContainMax", INI::parseInt, nullptr, offsetof( OpenContainModuleData, m_containMax ) }, + { "EnterSound", INI::parseAudioEventRTS, nullptr, offsetof( OpenContainModuleData, m_enterSound ) }, + { "ExitSound", INI::parseAudioEventRTS, nullptr, offsetof( OpenContainModuleData, m_exitSound ) }, + { "DamagePercentToUnits", INI::parsePercentToReal, nullptr, offsetof( OpenContainModuleData, m_damagePercentageToUnits ) }, + { "AllowInsideKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( OpenContainModuleData, m_allowInsideKindOf ) }, + { "ForbidInsideKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( OpenContainModuleData, m_forbidInsideKindOf ) }, + { "PassengersAllowedToFire", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_passengersAllowedToFire ) }, + { "PassengersInTurret", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_passengersInTurret ) }, + { "NumberOfExitPaths", INI::parseInt, nullptr, offsetof( OpenContainModuleData, m_numberOfExitPaths ) }, + { "DoorOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( OpenContainModuleData, m_doorOpenTime ) }, + { "AllowAlliesInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowAlliesInside ) }, + { "AllowEnemiesInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowEnemiesInside ) }, + { "AllowNeutralInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowNeutralInside ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( OpenContainModuleData, m_dieMuxData )); @@ -275,7 +275,7 @@ void OpenContain::addToContain( Object *rider ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; #if defined(RTS_DEBUG) @@ -291,12 +291,12 @@ void OpenContain::addToContain( Object *rider ) reportObject = *items->begin(); } } - DEBUG_CRASH( ("OpenContain::addToContain() - Object %s not valid for container %s!", reportObject?reportObject->getTemplate()->getName().str():"NULL", getObject()->getTemplate()->getName().str() ) ); + DEBUG_CRASH( ("OpenContain::addToContain() - Object %s not valid for container %s!", reportObject?reportObject->getTemplate()->getName().str():"null", getObject()->getTemplate()->getName().str() ) ); } #endif // this object cannot be contained by this module if it is already contained in something - if( rider->getContainedBy() != NULL ) + if( rider->getContainedBy() != nullptr ) { DEBUG_LOG(( "'%s' is trying to contain '%s', but '%s' is already contained by '%s'", @@ -369,7 +369,7 @@ void OpenContain::removeFromContain( Object *rider, Bool exposeStealthUnits ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; // @@ -678,7 +678,7 @@ Real OpenContain::getContainedItemsMass() const void OpenContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // colliding with nothing? we don't care. - if( other == NULL ) + if( other == nullptr ) return; // ok, step two: only contain stuff that wants us to contain it. @@ -686,7 +686,7 @@ void OpenContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *n // must be an AI object.... AIUpdateInterface *ai = other->getAI(); - if (ai == NULL) + if (ai == nullptr) return; // ...and must be trying to enter our object. @@ -874,8 +874,8 @@ void OpenContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor ) startBone.concat(suffix); endBone.concat(suffix); } - me->getSingleLogicalBonePosition( startBone.str(), &startPosition, NULL ); - me->getSingleLogicalBonePosition( endBone.str(), &endPosition, NULL ); + me->getSingleLogicalBonePosition( startBone.str(), &startPosition, nullptr ); + me->getSingleLogicalBonePosition( endBone.str(), &endPosition, nullptr ); //startPosition.x = startPosition.y = 0; Real exitAngle = me->getOrientation(); @@ -911,7 +911,7 @@ void OpenContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor ) TheAI->pathfinder()->updatePos(me, me->getPosition()); TheAI->pathfinder()->updateGoal(me, me->getPosition(), TheTerrainLogic->getLayerForDestination(me->getPosition())); } - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // The units often come out at the same position, and need to ignore collisions briefly // as they move out. jba. ai->setIgnoreCollisionTime(LOGICFRAMES_PER_SECOND); @@ -993,8 +993,8 @@ void OpenContain::exitObjectInAHurry( Object *exitObj ) startBone.concat(suffix); endBone.concat(suffix); } - me->getSingleLogicalBonePosition( startBone.str(), &startPosition, NULL ); - me->getSingleLogicalBonePosition( endBone.str(), &endPosition, NULL ); + me->getSingleLogicalBonePosition( startBone.str(), &startPosition, nullptr ); + me->getSingleLogicalBonePosition( endBone.str(), &endPosition, nullptr ); //startPosition.x = startPosition.y = 0; Real exitAngle = me->getOrientation(); @@ -1016,7 +1016,7 @@ void OpenContain::exitObjectInAHurry( Object *exitObj ) TheAI->pathfinder()->updatePos(me, me->getPosition()); TheAI->pathfinder()->updateGoal(me, me->getPosition(), TheTerrainLogic->getLayerForDestination(me->getPosition())); } - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // The units often come out at the same position, and need to ignore collisions briefly // as they move out. jba. ai->setIgnoreCollisionTime(LOGICFRAMES_PER_SECOND); @@ -1051,7 +1051,7 @@ Bool OpenContain::isPassengerAllowedToFire() const return FALSE;// Just no, no matter what. // If we are ourselves contained, our passengers need to check with them if they get past us - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return getObject()->getContainedBy()->getContain()->isPassengerAllowedToFire(); return TRUE;// We say yes, and we are not inside something. @@ -1129,7 +1129,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointSize == 0 && m_noFirePointsInArt == false ) { - m_firePointSize = getObject()->getMultiLogicalBonePosition("FIREPOINT", MAX_FIRE_POINTS, NULL, m_firePoints, TRUE ); + m_firePointSize = getObject()->getMultiLogicalBonePosition("FIREPOINT", MAX_FIRE_POINTS, nullptr, m_firePoints, TRUE ); // // if there is still no firepoints in the art, we'll set a flag so that we don't @@ -1167,7 +1167,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) } firepoint.concat(suffix); - getObject()->getSingleLogicalBonePositionOnTurret(TURRET_MAIN, firepoint.str(), NULL, &matrix ); + getObject()->getSingleLogicalBonePositionOnTurret(TURRET_MAIN, firepoint.str(), nullptr, &matrix ); } else { @@ -1200,7 +1200,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) */ void OpenContain::onObjectWantsToEnterOrExit(Object* obj, ObjectEnterExitType wants) { - if (obj == NULL) + if (obj == nullptr) return; ObjectID id = obj->getID(); @@ -1223,7 +1223,7 @@ void OpenContain::pruneDeadWanters() { ObjectID id = (*it).first; Object* obj = TheGameLogic->findObjectByID(id); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { ObjectEnterExitMap::iterator tmp = it; ++it; @@ -1357,7 +1357,7 @@ void OpenContain::processDamageToContained() { Object *object = *it; - DEBUG_ASSERTCRASH( object, ("Contain list must not contain NULL element") ); + DEBUG_ASSERTCRASH( object, ("Contain list must not contain null element") ); // Calculate the damage to be inflicted on each unit. Real damage = object->getBodyModule()->getMaxHealth() * data->m_damagePercentageToUnits; @@ -1417,7 +1417,7 @@ const Coord3D *OpenContain::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1431,7 +1431,7 @@ Bool OpenContain::getNaturalRallyPoint( Coord3D& rallyPoint, Bool offset ) cons { endBone.concat("01"); } - getObject()->getSingleLogicalBonePosition( endBone.str(), &rallyPoint, NULL ); + getObject()->getSingleLogicalBonePosition( endBone.str(), &rallyPoint, nullptr ); } else { @@ -1663,7 +1663,7 @@ void OpenContain::loadPostProcess( void ) obj = TheGameLogic->findObjectByID( *idIt ); // sanity - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "OpenContain::loadPostProcess - Unable to find object to put on contain list" )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index a67b4afe6f8..4f61dbfede7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -60,7 +60,7 @@ void OverlordContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -106,17 +106,17 @@ ContainModuleInterface *OverlordContain::getRedirectedContain() const // If I am empty, say no. if( m_containListSize < 1 ) - return NULL; + return nullptr; if( !m_redirectionActivated ) - return NULL;// Shut off early to allow death to happen without my bunker having + return nullptr;// Shut off early to allow death to happen without my bunker having // trouble finding me to say goodbye as messages get sucked up the pipe to him. Object *myGuy = m_containList.front(); if( myGuy ) return myGuy->getContain(); - return NULL;// Or say no if they have no contain. + return nullptr;// Or say no if they have no contain. } @@ -130,7 +130,7 @@ ContainModuleInterface *OverlordContain::getRedirectedContain() const void OverlordContain::onDie( const DamageInfo *damageInfo ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onDie( damageInfo ); return; @@ -153,7 +153,7 @@ void OverlordContain::onDie( const DamageInfo *damageInfo ) void OverlordContain::onDelete( void ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onDelete( ); return; @@ -182,7 +182,7 @@ void OverlordContain::onCapture( Player *oldOwner, Player *newOwner ) //------------------------------------------------------------------------------------------------- Bool OverlordContain::isGarrisonable() const { - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE; return getRedirectedContain()->isGarrisonable(); @@ -191,7 +191,7 @@ Bool OverlordContain::isGarrisonable() const //------------------------------------------------------------------------------------------------- Bool OverlordContain::isKickOutOnCapture() { - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE;// Me the Overlord doesn't want to return getRedirectedContain()->isKickOutOnCapture(); @@ -201,7 +201,7 @@ Bool OverlordContain::isKickOutOnCapture() void OverlordContain::addToContainList( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::addToContainList( obj ); return; @@ -214,7 +214,7 @@ void OverlordContain::addToContainList( Object *obj ) void OverlordContain::addToContain( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::addToContain( obj ); return; @@ -232,7 +232,7 @@ void OverlordContain::addToContain( Object *obj ) void OverlordContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::removeFromContain( obj, exposeStealthUnits ); return; @@ -248,7 +248,7 @@ void OverlordContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) void OverlordContain::removeAllContained( Bool exposeStealthUnits ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::removeAllContained( exposeStealthUnits ); return; @@ -273,7 +273,7 @@ void OverlordContain::removeAllContained( Bool exposeStealthUnits ) void OverlordContain::iterateContained( ContainIterateFunc func, void *userData, Bool reverse ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::iterateContained( func, userData, reverse ); return; @@ -286,7 +286,7 @@ void OverlordContain::iterateContained( ContainIterateFunc func, void *userData, void OverlordContain::onContaining( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onContaining( obj ); activateRedirectedContain();//Am now carrying something @@ -303,7 +303,7 @@ void OverlordContain::onContaining( Object *obj ) void OverlordContain::onRemoving( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onRemoving( obj ); return; @@ -319,7 +319,7 @@ void OverlordContain::onRemoving( Object *obj ) Bool OverlordContain::isValidContainerFor(const Object* obj, Bool checkCapacity) const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::isValidContainerFor( obj, checkCapacity ); return getRedirectedContain()->isValidContainerFor( obj, checkCapacity ); @@ -331,7 +331,7 @@ UnsignedInt OverlordContain::getContainCount() const ContainModuleInterface* redir = getRedirectedContain(); // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( redir == NULL ) + if( redir == nullptr ) return TransportContain::getContainCount( ); return redir->getContainCount(); @@ -341,7 +341,7 @@ UnsignedInt OverlordContain::getContainCount() const Bool OverlordContain::getContainerPipsToShow(Int& numTotal, Int& numFull) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { numTotal = 0; numFull = 0; @@ -357,7 +357,7 @@ Bool OverlordContain::getContainerPipsToShow(Int& numTotal, Int& numFull) Int OverlordContain::getContainMax( ) const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::getContainMax( ); return getRedirectedContain()->getContainMax(); @@ -367,7 +367,7 @@ Int OverlordContain::getContainMax( ) const const ContainedItemsList* OverlordContain::getContainedItemsList() const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::getContainedItemsList( ); return getRedirectedContain()->getContainedItemsList(); @@ -390,7 +390,7 @@ Bool OverlordContain::isEnclosingContainerFor( const Object *obj ) const Bool OverlordContain::isDisplayedOnControlBar() const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE;//No need to call up inheritance, this is a module based question, and I say no. return getRedirectedContain()->isDisplayedOnControlBar(); @@ -407,7 +407,7 @@ const Object *OverlordContain::friend_getRider() const return m_containList.front(); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index 2cb5300b4a6..bae366a9452 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -71,14 +71,14 @@ void ParachuteContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "PitchRateMax", INI::parseAngularVelocityReal, NULL, offsetof( ParachuteContainModuleData, m_pitchRateMax ) }, - { "RollRateMax", INI::parseAngularVelocityReal, NULL, offsetof( ParachuteContainModuleData, m_rollRateMax ) }, - { "LowAltitudeDamping", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_lowAltitudeDamping ) }, - { "ParachuteOpenDist", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_paraOpenDist ) }, - { "KillWhenLandingInWaterSlop", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_killWhenLandingInWaterSlop ) }, - { "FreeFallDamagePercent", INI::parsePercentToReal, NULL, offsetof( ParachuteContainModuleData, m_freeFallDamagePercent ) }, - { "ParachuteOpenSound", INI::parseAudioEventRTS, NULL, offsetof( ParachuteContainModuleData, m_parachuteOpenSound ) }, - { 0, 0, 0, 0 } + { "PitchRateMax", INI::parseAngularVelocityReal, nullptr, offsetof( ParachuteContainModuleData, m_pitchRateMax ) }, + { "RollRateMax", INI::parseAngularVelocityReal, nullptr, offsetof( ParachuteContainModuleData, m_rollRateMax ) }, + { "LowAltitudeDamping", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_lowAltitudeDamping ) }, + { "ParachuteOpenDist", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_paraOpenDist ) }, + { "KillWhenLandingInWaterSlop", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_killWhenLandingInWaterSlop ) }, + { "FreeFallDamagePercent", INI::parsePercentToReal, nullptr, offsetof( ParachuteContainModuleData, m_freeFallDamagePercent ) }, + { "ParachuteOpenSound", INI::parseAudioEventRTS, nullptr, offsetof( ParachuteContainModuleData, m_parachuteOpenSound ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -157,13 +157,13 @@ void ParachuteContain::updateBonePositions() Drawable* parachuteDraw = getObject()->getDrawable(); if (parachuteDraw) { - if (parachuteDraw->getPristineBonePositions( "PARA_COG", 0, &m_paraSwayBone, NULL, 1) != 1) + if (parachuteDraw->getPristineBonePositions( "PARA_COG", 0, &m_paraSwayBone, nullptr, 1) != 1) { DEBUG_CRASH(("PARA_COG not found")); m_paraSwayBone.zero(); } - if (parachuteDraw->getPristineBonePositions( "PARA_ATTCH", 0, &m_paraAttachBone, NULL, 1 ) != 1) + if (parachuteDraw->getPristineBonePositions( "PARA_ATTCH", 0, &m_paraAttachBone, nullptr, 1 ) != 1) { DEBUG_CRASH(("PARA_ATTCH not found")); m_paraAttachBone.zero(); @@ -177,11 +177,11 @@ void ParachuteContain::updateBonePositions() m_needToUpdateRiderBones = false; // yeah, even if not found. - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; - Drawable* riderDraw = rider ? rider->getDrawable() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; + Drawable* riderDraw = rider ? rider->getDrawable() : nullptr; if (riderDraw) { - if (riderDraw->getPristineBonePositions( "PARA_MAN", 0, &m_riderAttachBone, NULL, 1) != 1) + if (riderDraw->getPristineBonePositions( "PARA_MAN", 0, &m_riderAttachBone, nullptr, 1) != 1) { //DEBUG_LOG(("*** No parachute-attach bone... using object height!")); m_riderAttachBone.zero(); @@ -198,22 +198,22 @@ void ParachuteContain::updateOffsetsFromBones() { const Coord3D* objPos = getObject()->getPosition(); - getObject()->convertBonePosToWorldPos(&m_paraSwayBone, NULL, &m_paraSwayOffset, NULL); + getObject()->convertBonePosToWorldPos(&m_paraSwayBone, nullptr, &m_paraSwayOffset, nullptr); m_paraSwayOffset.x -= objPos->x; m_paraSwayOffset.y -= objPos->y; m_paraSwayOffset.z -= objPos->z; - getObject()->convertBonePosToWorldPos(&m_paraAttachBone, NULL, &m_paraAttachOffset, NULL); + getObject()->convertBonePosToWorldPos(&m_paraAttachBone, nullptr, &m_paraAttachOffset, nullptr); m_paraAttachOffset.x -= objPos->x; m_paraAttachOffset.y -= objPos->y; m_paraAttachOffset.z -= objPos->z; - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (rider) { const Coord3D* riderPos = rider->getPosition(); - rider->convertBonePosToWorldPos(&m_riderAttachBone, NULL, &m_riderAttachOffset, NULL); + rider->convertBonePosToWorldPos(&m_riderAttachBone, nullptr, &m_riderAttachOffset, nullptr); m_riderAttachOffset.x -= riderPos->x; m_riderAttachOffset.y -= riderPos->y; m_riderAttachOffset.z -= riderPos->z; @@ -287,7 +287,7 @@ UpdateSleepTime ParachuteContain::update( void ) Drawable* draw = parachute->getDrawable(); const ParachuteContainModuleData* d = getParachuteContainModuleData(); - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (m_startZ == NO_START_Z) { m_startZ = parachute->getPosition()->z; @@ -335,7 +335,7 @@ UpdateSleepTime ParachuteContain::update( void ) FindPositionOptions fpOptions; fpOptions.minRadius = 0.0f; fpOptions.maxRadius = 100.0f; - fpOptions.relationshipObject = NULL; + fpOptions.relationshipObject = nullptr; fpOptions.flags = FPF_NONE; ThePartitionManager->findPositionAround( &target, &fpOptions, &target ); } @@ -554,7 +554,7 @@ void ParachuteContain::positionRider(Object* rider) } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } } @@ -582,7 +582,7 @@ void ParachuteContain::onDie( const DamageInfo * damageInfo ) // if we are airborne when killed, the guy falls screaming to his death... if (getObject()->isSignificantlyAboveTerrain()) { - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (rider) { removeAllContained(); @@ -620,10 +620,10 @@ void ParachuteContain::onDie( const DamageInfo * damageInfo ) void ParachuteContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // Note that other == null means "collide with ground" - if( other == NULL ) + if( other == nullptr ) { // if we're in a container (eg, a transport plane), just ignore this... - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return; removeAllContained(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp index 56d3636b293..ca8646d0797 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp @@ -40,13 +40,13 @@ static RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; // find us our dock interface - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = obj->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; return rtdui; @@ -109,7 +109,7 @@ void RailedTransportContain::exitObjectViaDoor( Object *newObj, ExitDoorType exi { RailedTransportDockUpdateInterface *rtdui = getRailedTransportDockUpdateInterface(); - if( rtdui == NULL ) + if( rtdui == nullptr ) return; // tell the railed dock to exit ONE object, this one diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index 2916b521585..d08780676fc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -92,19 +92,19 @@ void TransportContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Slots", INI::parseInt, NULL, offsetof( TransportContainModuleData, m_slotCapacity ) }, - { "ScatterNearbyOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_scatterNearbyOnExit ) }, - { "OrientLikeContainerOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_orientLikeContainerOnExit ) }, - { "KeepContainerVelocityOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_keepContainerVelocityOnExit ) }, - { "GoAggressiveOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_goAggressiveOnExit ) }, - { "ResetMoodCheckTimeOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_resetMoodCheckTimeOnExit ) }, - { "DestroyRidersWhoAreNotFreeToExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_destroyRidersWhoAreNotFreeToExit ) }, - { "ExitBone", INI::parseAsciiString, NULL, offsetof( TransportContainModuleData, m_exitBone ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( TransportContainModuleData, m_exitPitchRate ) }, - { "InitialPayload", parseInitialPayload, NULL, 0 }, - { "HealthRegen%PerSec", INI::parseReal, NULL, offsetof( TransportContainModuleData, m_healthRegen ) }, - { "ExitDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TransportContainModuleData, m_exitDelay ) }, - { 0, 0, 0, 0 } + { "Slots", INI::parseInt, nullptr, offsetof( TransportContainModuleData, m_slotCapacity ) }, + { "ScatterNearbyOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_scatterNearbyOnExit ) }, + { "OrientLikeContainerOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_orientLikeContainerOnExit ) }, + { "KeepContainerVelocityOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_keepContainerVelocityOnExit ) }, + { "GoAggressiveOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_goAggressiveOnExit ) }, + { "ResetMoodCheckTimeOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_resetMoodCheckTimeOnExit ) }, + { "DestroyRidersWhoAreNotFreeToExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_destroyRidersWhoAreNotFreeToExit ) }, + { "ExitBone", INI::parseAsciiString, nullptr, offsetof( TransportContainModuleData, m_exitBone ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( TransportContainModuleData, m_exitPitchRate ) }, + { "InitialPayload", parseInitialPayload, nullptr, 0 }, + { "HealthRegen%PerSec", INI::parseReal, nullptr, offsetof( TransportContainModuleData, m_healthRegen ) }, + { "ExitDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( TransportContainModuleData, m_exitDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -248,9 +248,9 @@ void TransportContain::onRemoving( Object *rider ) if (draw) { Coord3D bonePos, worldPos; - if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, NULL, 1) == 1) + if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, nullptr, 1) == 1) { - getObject()->convertBonePosToWorldPos(&bonePos, NULL, &worldPos, NULL); + getObject()->convertBonePosToWorldPos(&bonePos, nullptr, &worldPos, nullptr); rider->setPosition(&worldPos); } } @@ -443,7 +443,7 @@ void TransportContain::killRidersWhoAreNotFreeToExit() // ------------------------------------------------------------------------------------------------ Bool TransportContain::isSpecificRiderFreeToExit(Object* specificObject) { - if( specificObject == NULL ) + if( specificObject == nullptr ) return TRUE; // I can, in general, exit people. // This is a override, not an extend. I will check for game legality for diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 2fc9fb89aa0..d62d8b0c5b2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -81,7 +81,7 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // trigger an onRemoving event for 'm_object' no longer containing 'itemToRemove->m_object' @@ -98,7 +98,7 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) // it is actually contained by this module // Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; //game tear down. We do the onRemove* stuff first because this is allowed to fail but that still needs to be done if(!owningPlayer->getTunnelSystem()) @@ -125,7 +125,7 @@ void TunnelContain::removeAllContained( Bool exposeStealthUnits ) while ( it != list.end() ) { Object *obj = *it++; - DEBUG_ASSERTCRASH( obj, ("Contain list must not contain NULL element")); + DEBUG_ASSERTCRASH( obj, ("Contain list must not contain null element")); removeFromContain( obj, exposeStealthUnits ); } @@ -186,10 +186,10 @@ void TunnelContain::onSelling() { // A TunnelContain tells everyone to leave if this is the last tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; // We are the last tunnel, so kick everyone out. This makes tunnels act like Palace and Bunker @@ -245,7 +245,7 @@ const ContainedItemsList* TunnelContain::getContainedItemsList() const { return owningPlayer->getTunnelSystem()->getContainedItemsList(); } - return NULL; + return nullptr; } UnsignedInt TunnelContain::getFullTimeForHeal(void) const @@ -323,10 +323,10 @@ void TunnelContain::onDie( const DamageInfo * damageInfo ) return;//it isn't registered as a tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelDestroyed( getObject() ); @@ -342,10 +342,10 @@ void TunnelContain::onDelete( void ) return;//it isn't registered as a tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelDestroyed( getObject() ); @@ -366,10 +366,10 @@ void TunnelContain::onBuildComplete( void ) m_needToRunOnBuildComplete = false; Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelCreated( getObject() ); @@ -395,7 +395,7 @@ UpdateSleepTime TunnelContain::update( void ) OpenContain::update(); Object *obj = getObject(); - Player *controllingPlayer = NULL; + Player *controllingPlayer = nullptr; if (obj) { controllingPlayer = obj->getControllingPlayer(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index c8bcb5ded2e..9eb5a639b41 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -51,9 +51,9 @@ void GrantUpgradeCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "UpgradeToGrant", INI::parseAsciiString, NULL, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, - { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, - { 0, 0, 0, 0 } + { "UpgradeToGrant", INI::parseAsciiString, nullptr, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, + { "ExemptStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp index 4e743c5fb94..cce2cc21001 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp @@ -63,16 +63,16 @@ void SupplyCenterCreate::onBuildComplete( void ) CreateModule::onBuildComplete(); // extend - if( ThePlayerList == NULL ) + if( ThePlayerList == nullptr ) return; for( Int playerIndex = ThePlayerList->getPlayerCount() - 1; playerIndex >= 0; playerIndex-- ) { Player *currentPlayer = ThePlayerList->getNthPlayer( playerIndex ); - if( currentPlayer == NULL ) + if( currentPlayer == nullptr ) continue; ResourceGatheringManager *manager = currentPlayer->getResourceGatheringManager(); - if( manager == NULL ) + if( manager == nullptr ) continue; manager->addSupplyCenter( getObject() ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp index da84fa1eb8b..e04f94e424a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp @@ -54,16 +54,16 @@ SupplyWarehouseCreate::~SupplyWarehouseCreate( void ) void SupplyWarehouseCreate::onCreate( void ) { // Warehouses are never Built. - if( ThePlayerList == NULL ) + if( ThePlayerList == nullptr ) return; for( Int playerIndex = ThePlayerList->getPlayerCount() - 1; playerIndex >= 0; playerIndex-- ) { Player *currentPlayer = ThePlayerList->getNthPlayer( playerIndex ); - if( currentPlayer == NULL ) + if( currentPlayer == nullptr ) continue; ResourceGatheringManager *manager = currentPlayer->getResourceGatheringManager(); - if( manager == NULL ) + if( manager == nullptr ) continue; manager->addSupplyWarehouse( getObject() ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index 339ee4c674b..069011df6c4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -54,8 +54,8 @@ void VeterancyGainCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { { "StartingLevel", INI::parseIndexList, TheVeterancyNames, offsetof( VeterancyGainCreateModuleData, m_startingLevel ) }, - { "ScienceRequired", INI::parseScience, NULL, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) }, - { 0, 0, 0, 0 } + { "ScienceRequired", INI::parseScience, nullptr, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp index 51b09ce1cab..ae7cdade6ef 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp @@ -56,9 +56,9 @@ void BoneFXDamage::onObjectCreated() { static NameKeyType key_BoneFXUpdate = NAMEKEY("BoneFXUpdate"); BoneFXUpdate* bfxu = (BoneFXUpdate*)getObject()->findUpdateModule(key_BoneFXUpdate); - if (bfxu == NULL) + if (bfxu == nullptr) { - DEBUG_ASSERTCRASH(bfxu != NULL, ("BoneFXDamage requires BoneFXUpdate")); + DEBUG_ASSERTCRASH(bfxu != nullptr, ("BoneFXDamage requires BoneFXUpdate")); throw INI_INVALID_DATA; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 7d9a7d10907..423b3102222 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -50,19 +50,19 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) for( j = 0; j < DAMAGE_MODULE_MAX_FX; j++ ) { - m_fxList[ i ][ j ].fx = NULL; + m_fxList[ i ][ j ].fx = nullptr; m_fxList[ i ][ j ].locInfo.loc.x = 0.0f; m_fxList[ i ][ j ].locInfo.loc.y = 0.0f; m_fxList[ i ][ j ].locInfo.loc.z = 0.0f; m_fxList[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_fxList[ i ][ j ].locInfo.randomBone = FALSE; - m_OCL[ i ][ j ].ocl = NULL; + m_OCL[ i ][ j ].ocl = nullptr; m_OCL[ i ][ j ].locInfo.loc.x = 0.0f; m_OCL[ i ][ j ].locInfo.loc.y = 0.0f; m_OCL[ i ][ j ].locInfo.loc.z = 0.0f; m_OCL[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_OCL[ i ][ j ].locInfo.randomBone = FALSE; - m_particleSystem[ i ][ j ].particleSysTemplate = NULL; + m_particleSystem[ i ][ j ].particleSysTemplate = nullptr; m_particleSystem[ i ][ j ].locInfo.loc.x = 0.0f; m_particleSystem[ i ][ j ].locInfo.loc.y = 0.0f; m_particleSystem[ i ][ j ].locInfo.loc.z = 0.0f; @@ -108,7 +108,7 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) } // parse the Bool definition - ini->parseBool( ini, instance, &locInfo->randomBone, NULL ); + ini->parseBool( ini, instance, &locInfo->randomBone, nullptr ); } else if( stricmp( token, "loc" ) == 0 ) @@ -155,7 +155,7 @@ void TransitionDamageFXModuleData::parseFXList( INI *ini, void *instance, } // parse the fx list name - ini->parseFXList( ini, instance, &info->fx, NULL ); + ini->parseFXList( ini, instance, &info->fx, nullptr ); } @@ -256,7 +256,7 @@ void TransitionDamageFX::onDelete( void ) static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) { - DEBUG_ASSERTCRASH( locInfo, ("getLocalEffectPos: locInfo is NULL") ); + DEBUG_ASSERTCRASH( locInfo, ("getLocalEffectPos: locInfo is null") ); if( locInfo->locType == FX_DAMAGE_LOC_TYPE_BONE && draw ) { @@ -266,7 +266,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) Coord3D pos; // get the bone position - Int count = draw->getPristineBonePositions( locInfo->boneName.str(), 0, &pos, NULL, 1 ); + Int count = draw->getPristineBonePositions( locInfo->boneName.str(), 0, &pos, nullptr, 1 ); // sanity, if bone not found revert back to location defined in struct (which is 0,0,0) if( count == 0 ) @@ -283,7 +283,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) // get the bone positions Int boneCount; - boneCount = draw->getPristineBonePositions( locInfo->boneName.str(), 1, positions, NULL, MAX_BONES ); + boneCount = draw->getPristineBonePositions( locInfo->boneName.str(), 1, positions, nullptr, MAX_BONES ); // sanity, if bone not found revert back to location defined in struct (which is 0,0,0) if( boneCount == 0 ) @@ -308,7 +308,7 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState ) { - Object *damageSource = NULL; + Object *damageSource = nullptr; Int i; Drawable *draw = getObject()->getDrawable(); const TransitionDamageFXModuleData *modData = getTransitionDamageFXModuleData(); @@ -350,12 +350,12 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( modData->m_fxList[ newState ][ i ].fx ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) { pos = getLocalEffectPos( &modData->m_fxList[ newState ][ i ].locInfo, draw ); - getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + getObject()->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); FXList::doFXPos( modData->m_fxList[ newState ][ i ].fx, &pos ); } @@ -366,12 +366,12 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( damageSource && modData->m_OCL[ newState ][ i ].ocl ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageOCLTypes, lastDamageInfo->in.m_damageType ) ) { pos = getLocalEffectPos( &modData->m_OCL[ newState ][ i ].locInfo, draw ); - getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + getObject()->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); ObjectCreationList::create( modData->m_OCL[ newState ][ i ].ocl, getObject(), &pos, damageSource->getPosition() ); @@ -384,7 +384,7 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( pSystemT ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageParticleTypes, lastDamageInfo->in.m_damageType ) ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp index ee05f5bd9f1..da46471d73d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp @@ -72,7 +72,7 @@ void CreateCrateDie::onDie( const DamageInfo * damageInfo ) if (!isDieApplicable(damageInfo)) return; - CrateTemplate const *currentCrateData = NULL; + CrateTemplate const *currentCrateData = nullptr; Object *killer = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); Object *me = getObject(); @@ -144,7 +144,7 @@ Bool CreateCrateDie::testVeterancyLevel( CrateTemplate const *currentCrateData ) Bool CreateCrateDie::testKillerType( CrateTemplate const *currentCrateData, Object *killer ) { - if( killer == NULL ) + if( killer == nullptr ) return FALSE; // Must match the whole group of bits set in the KilledBy description (most likely One). @@ -156,13 +156,13 @@ Bool CreateCrateDie::testKillerType( CrateTemplate const *currentCrateData, Obje Bool CreateCrateDie::testKillerScience( CrateTemplate const *currentCrateData, Object *killer ) { - if( killer == NULL ) + if( killer == nullptr ) return FALSE; // killer's player must have the listed science Player *killerPlayer = killer->getControllingPlayer(); - if( killerPlayer == NULL ) + if( killerPlayer == nullptr ) return FALSE; if( ! killerPlayer->hasScience( currentCrateData->m_killerScience ) ) @@ -198,8 +198,8 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) // At this point, I could very well have a "" for the type, if the Designer didn't make the sum of chances 1 ThingTemplate const *crateType = TheThingFactory->findTemplate( crateName ); - if( crateType == NULL ) - return NULL; + if( crateType == nullptr ) + return nullptr; Bool spotFound = FALSE; Coord3D creationPoint; @@ -222,7 +222,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) // of the large dead thing (building rubble) fpOptions.minRadius = 0.0f; fpOptions.maxRadius = 125.0f; - fpOptions.relationshipObject = NULL; + fpOptions.relationshipObject = nullptr; fpOptions.flags = FPF_NONE; if( ThePartitionManager->findPositionAround( ¢erPoint, &fpOptions, &creationPoint ) ) { @@ -232,7 +232,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) if( spotFound ) { - Object *newCrate = TheThingFactory->newObject( crateType, NULL ); + Object *newCrate = TheThingFactory->newObject( crateType, nullptr ); newCrate->setPosition( &creationPoint ); newCrate->setOrientation( GameLogicRandomValueReal( 0, 2*PI ) ); newCrate->setLayer(layer); @@ -249,7 +249,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) return newCrate; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp index c21f3b10798..09ff68387da 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp @@ -43,7 +43,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() { - m_ocl = NULL; + m_ocl = nullptr; } @@ -55,8 +55,8 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() static const FieldParse dataFieldParse[] = { - { "CreationList", INI::parseObjectCreationList, NULL, offsetof( CreateObjectDieModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "CreationList", INI::parseObjectCreationList, nullptr, offsetof( CreateObjectDieModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp index 93f9127d0cb..45f0e930543 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp @@ -48,7 +48,7 @@ // Figure out which crush point was hit so the correct crushed object can be swapped in static CrushEnum crushLocationCheck( Object* crusherObject, Object* victimObject ) { - if( (crusherObject == NULL) || (victimObject == NULL) ) + if( (crusherObject == nullptr) || (victimObject == nullptr) ) return NO_CRUSH; Bool frontCrushed = victimObject->getBodyModule()->getFrontCrushed(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp index 913c2cbba74..97872d534c6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp @@ -53,11 +53,11 @@ const FieldParse* DieMuxData::getFieldParse() { static const FieldParse dataFieldParse[] = { - { "DeathTypes", INI::parseDeathTypeFlags, NULL, offsetof( DieMuxData, m_deathTypes ) }, - { "VeterancyLevels", INI::parseVeterancyLevelFlags, NULL, offsetof( DieMuxData, m_veterancyLevels ) }, - { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( DieMuxData, m_exemptStatus ) }, - { "RequiredStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( DieMuxData, m_requiredStatus ) }, - { 0, 0, 0, 0 } + { "DeathTypes", INI::parseDeathTypeFlags, nullptr, offsetof( DieMuxData, m_deathTypes ) }, + { "VeterancyLevels", INI::parseVeterancyLevelFlags, nullptr, offsetof( DieMuxData, m_veterancyLevels ) }, + { "ExemptStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( DieMuxData, m_exemptStatus ) }, + { "RequiredStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( DieMuxData, m_requiredStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; return dataFieldParse; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp index a993aa2955e..a4d07536ade 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp @@ -43,8 +43,8 @@ //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- EjectPilotDieModuleData::EjectPilotDieModuleData() : - m_oclInAir(NULL), - m_oclOnGround(NULL), + m_oclInAir(nullptr), + m_oclOnGround(nullptr), m_invulnerableTime(0) { } @@ -57,11 +57,11 @@ void EjectPilotDieModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AirCreationList", INI::parseObjectCreationList, NULL, offsetof( EjectPilotDieModuleData, m_oclInAir ) }, - { "GroundCreationList", INI::parseObjectCreationList, NULL, offsetof( EjectPilotDieModuleData, m_oclOnGround ) }, - { "InvulnerableTime", INI::parseDurationUnsignedInt, NULL, offsetof(EjectPilotDieModuleData, m_invulnerableTime ) }, + { "AirCreationList", INI::parseObjectCreationList, nullptr, offsetof( EjectPilotDieModuleData, m_oclInAir ) }, + { "GroundCreationList", INI::parseObjectCreationList, nullptr, offsetof( EjectPilotDieModuleData, m_oclOnGround ) }, + { "InvulnerableTime", INI::parseDurationUnsignedInt, nullptr, offsetof(EjectPilotDieModuleData, m_invulnerableTime ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp index 372d55d0bf2..ea732262fda 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp @@ -63,10 +63,10 @@ RebuildHoleExposeDieModuleData::RebuildHoleExposeDieModuleData() static const FieldParse dataFieldParse[] = { - { "HoleName", INI::parseAsciiString, NULL, offsetof( RebuildHoleExposeDieModuleData, m_holeName ) }, - { "HoleMaxHealth", INI::parseReal, NULL, offsetof( RebuildHoleExposeDieModuleData, m_holeMaxHealth ) }, - { "TransferAttackers", INI::parseBool, NULL, offsetof( RebuildHoleExposeDieModuleData, m_transferAttackers ) }, - { 0, 0, 0, 0 } + { "HoleName", INI::parseAsciiString, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_holeName ) }, + { "HoleMaxHealth", INI::parseReal, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_holeMaxHealth ) }, + { "TransferAttackers", INI::parseBool, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_transferAttackers ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp index 78bc4fced53..72833b66dca 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp @@ -66,7 +66,7 @@ FiringTracker::~FiringTracker() //------------------------------------------------------------------------------------------------- Int FiringTracker::getNumConsecutiveShotsAtVictim( const Object *victim ) const { - if( victim == NULL ) + if( victim == nullptr ) return 0;// safety, this function is for asking about shots at a victim if( victim->getID() != m_victimID ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 2c7af514764..52dfefb245b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -34,7 +34,7 @@ #include "GameLogic/GhostObject.h" #include "GameLogic/Object.h" -GhostObjectManager *TheGhostObjectManager = NULL; +GhostObjectManager *TheGhostObjectManager = nullptr; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -46,8 +46,8 @@ m_parentAngle(0.0f), m_parentGeometryIsSmall(true), m_parentGeometryMajorRadius(0.0f), m_parentGeometryminorRadius(0.0f), -m_parentObject(NULL), -m_partitionData(NULL) +m_parentObject(nullptr), +m_partitionData(nullptr) { m_parentPosition.zero(); } @@ -88,7 +88,7 @@ void GhostObject::xfer( Xfer *xfer ) m_parentObject = TheGameLogic->findObjectByID( parentObjectID ); // sanity - if( parentObjectID != INVALID_ID && m_parentObject == NULL ) + if( parentObjectID != INVALID_ID && m_parentObject == nullptr ) { DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; @@ -152,7 +152,7 @@ void GhostObjectManager::reset(void) // ------------------------------------------------------------------------------------------------ GhostObject *GhostObjectManager::addGhostObject(Object *object, PartitionData *pd) { - return 0; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 06d42d780c1..07607992a48 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -55,7 +55,7 @@ static const Real DONUT_DISTANCE=4.0*PATHFIND_CELL_SIZE_F; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -LocomotorStore *TheLocomotorStore = NULL; ///< the Locomotor store definition +LocomotorStore *TheLocomotorStore = nullptr; ///< the Locomotor store definition const Real BIGNUM = 99999.0f; @@ -65,7 +65,7 @@ static const char *const TheLocomotorPriorityNames[] = "MOVES_MIDDLE", "MOVES_FRONT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorPriorityNames) == LOCOMOTOR_PRIORITY_COUNT + 1, "Array size"); @@ -431,64 +431,64 @@ const FieldParse* LocomotorTemplate::getFieldParse() const static const FieldParse TheFieldParse[] = { { "Surfaces", INI::parseBitString32, TheLocomotorSurfaceTypeNames, offsetof(LocomotorTemplate, m_surfaces) }, - { "Speed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_maxSpeed) }, - { "SpeedDamaged", INI::parseVelocityReal, NULL, offsetof( LocomotorTemplate, m_maxSpeedDamaged ) }, - { "TurnRate", INI::parseAngularVelocityReal, NULL, offsetof(LocomotorTemplate, m_maxTurnRate) }, - { "TurnRateDamaged", INI::parseAngularVelocityReal, NULL, offsetof( LocomotorTemplate, m_maxTurnRateDamaged ) }, - { "Acceleration", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_acceleration) }, - { "AccelerationDamaged", INI::parseAccelerationReal, NULL, offsetof( LocomotorTemplate, m_accelerationDamaged ) }, - { "Lift", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_lift) }, - { "LiftDamaged", INI::parseAccelerationReal, NULL, offsetof( LocomotorTemplate, m_liftDamaged ) }, - { "Braking", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_braking) }, - { "MinSpeed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_minSpeed) }, - { "MinTurnSpeed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_minTurnSpeed) }, - { "PreferredHeight", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_preferredHeight) }, - { "PreferredHeightDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_preferredHeightDamping) }, - { "CirclingRadius", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_circlingRadius) }, - { "Extra2DFriction", parseFrictionPerSec, NULL, offsetof(LocomotorTemplate, m_extra2DFriction) }, - { "SpeedLimitZ", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_speedLimitZ) }, - { "MaxThrustAngle", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_maxThrustAngle) }, // yes, angle, not angular-vel + { "Speed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_maxSpeed) }, + { "SpeedDamaged", INI::parseVelocityReal, nullptr, offsetof( LocomotorTemplate, m_maxSpeedDamaged ) }, + { "TurnRate", INI::parseAngularVelocityReal, nullptr, offsetof(LocomotorTemplate, m_maxTurnRate) }, + { "TurnRateDamaged", INI::parseAngularVelocityReal, nullptr, offsetof( LocomotorTemplate, m_maxTurnRateDamaged ) }, + { "Acceleration", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_acceleration) }, + { "AccelerationDamaged", INI::parseAccelerationReal, nullptr, offsetof( LocomotorTemplate, m_accelerationDamaged ) }, + { "Lift", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_lift) }, + { "LiftDamaged", INI::parseAccelerationReal, nullptr, offsetof( LocomotorTemplate, m_liftDamaged ) }, + { "Braking", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_braking) }, + { "MinSpeed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_minSpeed) }, + { "MinTurnSpeed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_minTurnSpeed) }, + { "PreferredHeight", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_preferredHeight) }, + { "PreferredHeightDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_preferredHeightDamping) }, + { "CirclingRadius", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_circlingRadius) }, + { "Extra2DFriction", parseFrictionPerSec, nullptr, offsetof(LocomotorTemplate, m_extra2DFriction) }, + { "SpeedLimitZ", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_speedLimitZ) }, + { "MaxThrustAngle", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_maxThrustAngle) }, // yes, angle, not angular-vel { "ZAxisBehavior", INI::parseIndexList, TheLocomotorBehaviorZNames, offsetof(LocomotorTemplate, m_behaviorZ) }, { "Appearance", INI::parseIndexList, TheLocomotorAppearanceNames, offsetof(LocomotorTemplate, m_appearance) }, \ { "GroupMovementPriority", INI::parseIndexList, TheLocomotorPriorityNames, offsetof(LocomotorTemplate, m_movePriority) }, \ - { "AccelerationPitchLimit", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_accelPitchLimit) }, - { "BounceAmount", INI::parseAngularVelocityReal, NULL, offsetof(LocomotorTemplate, m_bounceKick) }, - { "PitchStiffness", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchStiffness) }, - { "RollStiffness", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rollStiffness) }, - { "PitchDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchDamping) }, - { "RollDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rollDamping) }, - { "ThrustRoll", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_thrustRoll) }, - { "ThrustWobbleRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wobbleRate) }, - { "ThrustMinWobble", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_minWobble) }, - { "ThrustMaxWobble", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maxWobble) }, - { "PitchInDirectionOfZVelFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchByZVelCoef) }, - { "ForwardVelocityPitchFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_forwardVelCoef) }, - { "LateralVelocityRollFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_lateralVelCoef) }, - { "ForwardAccelerationPitchFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_forwardAccelCoef) }, - { "LateralAccelerationRollFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_lateralAccelCoef) }, - { "UniformAxialDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_uniformAxialDamping) }, - { "TurnPivotOffset", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_turnPivotOffset) }, - { "Apply2DFrictionWhenAirborne", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_apply2DFrictionWhenAirborne) }, - { "DownhillOnly", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_downhillOnly) }, - { "AllowAirborneMotiveForce", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_allowMotiveForceWhileAirborne) }, - { "LocomotorWorksWhenDead", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_locomotorWorksWhenDead) }, - { "AirborneTargetingHeight", INI::parseInt, NULL, offsetof( LocomotorTemplate, m_airborneTargetingHeight ) }, - { "StickToGround", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_stickToGround) }, - { "CanMoveBackwards", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_canMoveBackward) }, - { "HasSuspension", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_hasSuspension) }, - { "FrontWheelTurnAngle", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_wheelTurnAngle) }, - { "MaximumWheelExtension", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maximumWheelExtension) }, - { "MaximumWheelCompression", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maximumWheelCompression) }, - { "CloseEnoughDist", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_closeEnoughDist) }, - { "CloseEnoughDist3D", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_isCloseEnoughDist3D) }, - { "SlideIntoPlaceTime", INI::parseDurationReal, NULL, offsetof(LocomotorTemplate, m_ultraAccurateSlideIntoPlaceFactor) }, - - { "WanderWidthFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderWidthFactor) }, - { "WanderLengthFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderLengthFactor) }, - { "WanderAboutPointRadius", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderAboutPointRadius) }, - - { NULL, NULL, NULL, 0 } + { "AccelerationPitchLimit", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_accelPitchLimit) }, + { "BounceAmount", INI::parseAngularVelocityReal, nullptr, offsetof(LocomotorTemplate, m_bounceKick) }, + { "PitchStiffness", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchStiffness) }, + { "RollStiffness", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rollStiffness) }, + { "PitchDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchDamping) }, + { "RollDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rollDamping) }, + { "ThrustRoll", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_thrustRoll) }, + { "ThrustWobbleRate", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wobbleRate) }, + { "ThrustMinWobble", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_minWobble) }, + { "ThrustMaxWobble", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maxWobble) }, + { "PitchInDirectionOfZVelFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchByZVelCoef) }, + { "ForwardVelocityPitchFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_forwardVelCoef) }, + { "LateralVelocityRollFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_lateralVelCoef) }, + { "ForwardAccelerationPitchFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_forwardAccelCoef) }, + { "LateralAccelerationRollFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_lateralAccelCoef) }, + { "UniformAxialDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_uniformAxialDamping) }, + { "TurnPivotOffset", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_turnPivotOffset) }, + { "Apply2DFrictionWhenAirborne", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_apply2DFrictionWhenAirborne) }, + { "DownhillOnly", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_downhillOnly) }, + { "AllowAirborneMotiveForce", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_allowMotiveForceWhileAirborne) }, + { "LocomotorWorksWhenDead", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_locomotorWorksWhenDead) }, + { "AirborneTargetingHeight", INI::parseInt, nullptr, offsetof( LocomotorTemplate, m_airborneTargetingHeight ) }, + { "StickToGround", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_stickToGround) }, + { "CanMoveBackwards", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_canMoveBackward) }, + { "HasSuspension", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_hasSuspension) }, + { "FrontWheelTurnAngle", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_wheelTurnAngle) }, + { "MaximumWheelExtension", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maximumWheelExtension) }, + { "MaximumWheelCompression", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maximumWheelCompression) }, + { "CloseEnoughDist", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_closeEnoughDist) }, + { "CloseEnoughDist3D", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_isCloseEnoughDist3D) }, + { "SlideIntoPlaceTime", INI::parseDurationReal, nullptr, offsetof(LocomotorTemplate, m_ultraAccurateSlideIntoPlaceFactor) }, + + { "WanderWidthFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderWidthFactor) }, + { "WanderLengthFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderLengthFactor) }, + { "WanderAboutPointRadius", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderAboutPointRadius) }, + + { nullptr, nullptr, nullptr, 0 } }; return TheFieldParse; @@ -517,11 +517,11 @@ LocomotorStore::~LocomotorStore() LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) { if (namekey == NAMEKEY_INVALID) - return NULL; + return nullptr; LocomotorTemplateMap::iterator it = m_locomotorTemplates.find(namekey); if (it == m_locomotorTemplates.end()) - return NULL; + return nullptr; else return (*it).second; } @@ -530,12 +530,12 @@ LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) const LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) const { if (namekey == NAMEKEY_INVALID) - return NULL; + return nullptr; LocomotorTemplateMap::const_iterator it = m_locomotorTemplates.find(namekey); if (it == m_locomotorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -569,8 +569,8 @@ void LocomotorStore::reset() //------------------------------------------------------------------------------------------------- LocomotorTemplate *LocomotorStore::newOverride( LocomotorTemplate *locoTemplate ) { - if (locoTemplate == NULL) - return NULL; + if (locoTemplate == nullptr) + return nullptr; // allocate new template LocomotorTemplate *newTemplate = newInstance(LocomotorTemplate); @@ -850,11 +850,11 @@ void Locomotor::locoUpdate_moveTowardsAngle(Object* obj, Real goalAngle) { setFlag(MAINTAIN_POS_IS_VALID, false); - if (obj == NULL || m_template == NULL) + if (obj == nullptr || m_template == nullptr) return; PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -907,7 +907,7 @@ PhysicsTurningType Locomotor::rotateTowardsPosition(Object* obj, const Coord3D& void Locomotor::setPhysicsOptions(Object* obj) { PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -941,7 +941,7 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& goalP m_brakingFactor = 1.0f; } PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -1827,7 +1827,7 @@ void Locomotor::moveTowardsPositionWings(Object* obj, PhysicsBehavior *physics, angleTowardPos += aimDir; BodyDamageType bdt = obj->getBodyModule()->getDamageState(); - Real turnRadius = calcMinTurnRadius(bdt, NULL) * 4; + Real turnRadius = calcMinTurnRadius(bdt, nullptr) * 4; // project a spot "radius" dist away from it, in that dir Coord3D desiredPos = goalPos; @@ -2404,7 +2404,7 @@ Bool Locomotor::locoUpdate_maintainCurrentPosition(Object* obj) m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND; setFlag(IS_BRAKING, false); PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return TRUE; @@ -2479,7 +2479,7 @@ void Locomotor::maintainCurrentPositionWings(Object* obj, PhysicsBehavior *physi BodyDamageType bdt = obj->getBodyModule()->getDamageState(); Real turnRadius = m_template->m_circlingRadius; if (turnRadius == 0.0f) - turnRadius = calcMinTurnRadius(bdt, NULL); + turnRadius = calcMinTurnRadius(bdt, nullptr); // find the direction towards our "maintain pos" const Coord3D* pos = obj->getPosition(); @@ -2648,7 +2648,7 @@ void LocomotorSet::xfer( Xfer *xfer ) xfer->xferAsciiString(&name); const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name)); - if (lt == NULL) + if (lt == nullptr) { DEBUG_CRASH(( "LocomotorSet::xfer - template %s not found", name.str() )); throw XFER_UNKNOWN_STRING; @@ -2692,7 +2692,7 @@ void LocomotorSet::xferSelfAndCurLocoPtr(Xfer *xfer, Locomotor** loco) if (name.isEmpty()) { - *loco = NULL; + *loco = nullptr; } else { @@ -2752,7 +2752,7 @@ Locomotor* LocomotorSet::findLocomotor(LocomotorSurfaceTypeMask t) if (curLocomotor && (curLocomotor->getLegalSurfaces() & t)) return curLocomotor; } - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index c426213d170..fb88a6688d8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -168,32 +168,32 @@ AsciiString DebugDescribeObject(const Object *obj) Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatusMask, Team *team ) : Thing(tt), m_indicatorColor(0), - m_ai(NULL), - m_physics(NULL), + m_ai(nullptr), + m_physics(nullptr), m_geometryInfo(tt->getTemplateGeometryInfo()), - m_containedBy(NULL), + m_containedBy(nullptr), m_xferContainedByID(INVALID_ID), m_containedByFrame(0), - m_behaviors(NULL), - m_body(NULL), - m_contain(NULL), - m_stealth(NULL), - m_partitionData(NULL), - m_radarData(NULL), - m_drawable(NULL), - m_next(NULL), - m_prev(NULL), - m_team(NULL), - m_experienceTracker(NULL), - m_firingTracker(NULL), - m_repulsorHelper(NULL), - m_smcHelper(NULL), - m_wsHelper(NULL), - m_defectionHelper(NULL), - m_partitionLastLook(NULL), - m_partitionLastShroud(NULL), - m_partitionLastThreat(NULL), - m_partitionLastValue(NULL), + m_behaviors(nullptr), + m_body(nullptr), + m_contain(nullptr), + m_stealth(nullptr), + m_partitionData(nullptr), + m_radarData(nullptr), + m_drawable(nullptr), + m_next(nullptr), + m_prev(nullptr), + m_team(nullptr), + m_experienceTracker(nullptr), + m_firingTracker(nullptr), + m_repulsorHelper(nullptr), + m_smcHelper(nullptr), + m_wsHelper(nullptr), + m_defectionHelper(nullptr), + m_partitionLastLook(nullptr), + m_partitionLastShroud(nullptr), + m_partitionLastThreat(nullptr), + m_partitionLastValue(nullptr), m_smcUntil(NEVER), m_privateStatus(0), m_formationID(NO_FORMATION_ID), @@ -221,7 +221,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu } // sanity - if( TheGameLogic == NULL || tt == NULL ) + if( TheGameLogic == nullptr || tt == nullptr ) { assert( 0 ); @@ -249,7 +249,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_status = objectStatusMask; m_layer = LAYER_GROUND; - m_group = NULL; + m_group = nullptr; m_constructionPercent = CONSTRUCTION_COMPLETE; // complete by default @@ -289,7 +289,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_smcHelper = newInstance(ObjectSMCHelper)(this, &smcModuleData); *curB++ = m_smcHelper; - if (TheAI != NULL + if (TheAI != nullptr && TheAI->getAiData()->m_enableRepulsors && isKindOf(KINDOF_CAN_BE_REPULSED)) { @@ -347,40 +347,40 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu BodyModuleInterface* body = newMod->getBody(); if (body) { - DEBUG_ASSERTCRASH(m_body == NULL, ("Duplicate bodies")); + DEBUG_ASSERTCRASH(m_body == nullptr, ("Duplicate bodies")); m_body = body; } ContainModuleInterface* contain = newMod->getContain(); if (contain) { - DEBUG_ASSERTCRASH(m_contain == NULL, ("Duplicate containers")); + DEBUG_ASSERTCRASH(m_contain == nullptr, ("Duplicate containers")); m_contain = contain; } StealthUpdate* stealth = newMod->getStealth(); if ( stealth ) { - DEBUG_ASSERTCRASH( m_stealth == NULL, ("DuplicateStealthUpdates!") ); + DEBUG_ASSERTCRASH( m_stealth == nullptr, ("DuplicateStealthUpdates!") ); m_stealth = stealth; } AIUpdateInterface* ai = newMod->getAIUpdateInterface(); if (ai) { - DEBUG_ASSERTCRASH(m_ai == NULL, ("You should never have more than one AI module (srj)")); + DEBUG_ASSERTCRASH(m_ai == nullptr, ("You should never have more than one AI module (srj)")); m_ai = ai; } static NameKeyType key_PhysicsUpdate = NAMEKEY("PhysicsBehavior"); if (newMod->getModuleNameKey() == key_PhysicsUpdate) { - DEBUG_ASSERTCRASH(m_physics == NULL, ("You should never have more than one Physics module (%s)",getTemplate()->getName().str())); + DEBUG_ASSERTCRASH(m_physics == nullptr, ("You should never have more than one Physics module (%s)",getTemplate()->getName().str())); m_physics = (PhysicsBehavior*)newMod; } } - *curB = NULL; + *curB = nullptr; AIUpdateInterface *ai = getAIUpdateInterface(); if (ai) { @@ -528,7 +528,7 @@ Object::~Object() } // - // remove from radar before we NULL out the team ... the order of ops are critical here + // remove from radar before we null out the team ... the order of ops are critical here // because the radar code will sometimes look at the team info and it is assumed through // the team and player code that the team is valid // @@ -540,17 +540,17 @@ Object::~Object() TheGameLogic->sendObjectDestroyed( this ); // empty the team - setTeam( NULL ); + setTeam( nullptr ); // Object's set of these persist for the life of the object. deleteInstance(m_partitionLastLook); - m_partitionLastLook = NULL; + m_partitionLastLook = nullptr; deleteInstance(m_partitionLastShroud); - m_partitionLastShroud = NULL; + m_partitionLastShroud = nullptr; deleteInstance(m_partitionLastThreat); - m_partitionLastThreat = NULL; + m_partitionLastThreat = nullptr; deleteInstance(m_partitionLastValue); - m_partitionLastValue = NULL; + m_partitionLastValue = nullptr; // remove the object from the partition system if present if( m_partitionData ) @@ -560,28 +560,28 @@ Object::~Object() leaveGroup(); // note, do NOT free these, there are just a shadow copy! - m_ai = NULL; - m_physics = NULL; + m_ai = nullptr; + m_physics = nullptr; // delete any modules present for (BehaviorModule** b = m_behaviors; *b; ++b) { deleteInstance(*b); - *b = NULL; // in case other modules call findModule from their dtor! + *b = nullptr; // in case other modules call findModule from their dtor! } delete [] m_behaviors; - m_behaviors = NULL; + m_behaviors = nullptr; deleteInstance(m_experienceTracker); - m_experienceTracker = NULL; + m_experienceTracker = nullptr; // we don't need to delete these, there were deleted on the m_behaviors list - m_firingTracker = NULL; - m_repulsorHelper = NULL; - m_smcHelper = NULL; - m_wsHelper = NULL; - m_defectionHelper = NULL; + m_firingTracker = nullptr; + m_repulsorHelper = nullptr; + m_smcHelper = nullptr; + m_wsHelper = nullptr; + m_defectionHelper = nullptr; // reset id to zero so we never mistaken grab "dead" objects m_id = INVALID_ID; @@ -628,7 +628,7 @@ void Object::onContainedBy( Object *containedBy ) void Object::onRemovedFrom( Object *removedFrom ) { clearStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_MASKED, OBJECT_STATUS_UNSELECTABLE ) ); - m_containedBy = NULL; + m_containedBy = nullptr; m_containedByFrame = 0; } @@ -662,7 +662,7 @@ const Object* Object::getEnclosingContainedBy() const return container; } - return NULL; + return nullptr; } const Object* Object::getOuterObject() const @@ -739,11 +739,11 @@ void Object::friend_setUndetectedDefector( Bool status ) //============================================================================= void Object::restoreOriginalTeam() { - if( m_team == NULL || m_originalTeamName.isEmpty() ) + if( m_team == nullptr || m_originalTeamName.isEmpty() ) return; Team* origTeam = TheTeamFactory->findTeam(m_originalTeamName); - if (origTeam == NULL) + if (origTeam == nullptr) { DEBUG_CRASH(("Object original team (%s) could not be found or created! (srj)",m_originalTeamName.str())); return; @@ -871,7 +871,7 @@ void Object::setStatus( ObjectStatusMaskType objectStatus, Bool set ) if (m_status != oldStatus) { - if( set && objectStatus.test( OBJECT_STATUS_REPULSOR ) && m_repulsorHelper != NULL ) + if( set && objectStatus.test( OBJECT_STATUS_REPULSOR ) && m_repulsorHelper != nullptr ) { // Damaged repulsable civilians scare (repulse) other civs, but only // for a short amount of time... use the repulsor helper to turn off repulsion shortly. @@ -1237,7 +1237,7 @@ void Object::clearSpecialModelConditionStates() // } // else // { -// DEBUG_CRASH(("NULL Drawable at this point, you can't get modelconditionflags now.")); +// DEBUG_CRASH(("null Drawable at this point, you can't get modelconditionflags now.")); // static ModelConditionFlags noFlags; // return noFlags; // } @@ -1247,7 +1247,7 @@ void Object::clearSpecialModelConditionStates() Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) { if (!m_weaponSet.hasAnyWeapon()) - return NULL; + return nullptr; if (wslot) *wslot = m_weaponSet.getCurWeaponSlot(); @@ -1258,7 +1258,7 @@ Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) const Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) const { if (!m_weaponSet.hasAnyWeapon()) - return NULL; + return nullptr; if (wslot) *wslot = m_weaponSet.getCurWeaponSlot(); @@ -1327,7 +1327,7 @@ void Object::fireCurrentWeapon(Object *target) //USE_PERF_TIMER(fireCurrentWeapon) // victim may have already been destroyed - if (target == NULL) + if (target == nullptr) return; Weapon* weapon = m_weaponSet.getCurWeapon(); @@ -1349,7 +1349,7 @@ void Object::fireCurrentWeapon(const Coord3D* pos) { //USE_PERF_TIMER(fireCurrentWeapon) - if (pos == NULL) + if (pos == nullptr) return; Weapon* weapon = m_weaponSet.getCurWeapon(); @@ -1444,7 +1444,7 @@ Player * Object::getControllingPlayer() const if (myTeam) return myTeam->getControllingPlayer(); - return NULL; + return nullptr; } //============================================================================= @@ -1708,7 +1708,7 @@ void Object::attemptDamage( DamageInfo *damageInfo ) damageInfo->in.m_damageType != DAMAGE_PENALTY && damageInfo->in.m_damageType != DAMAGE_HEALING && !BitIsSet(damageInfo->in.m_sourcePlayerMask, getControllingPlayer()->getPlayerMask()) && - m_radarData != NULL && + m_radarData != nullptr && getControllingPlayer() == ThePlayerList->getLocalPlayer() ) TheRadar->tryUnderAttackEvent( this ); @@ -1806,7 +1806,7 @@ void Object::kill() //------------------------------------------------------------------------------------------------- void Object::healCompletely() { - attemptHealing(HUGE_DAMAGE_AMOUNT, NULL); + attemptHealing(HUGE_DAMAGE_AMOUNT, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2301,17 +2301,17 @@ Bool Object::isInside(const PolygonTrigger *pTrigger) const // ------------------------------------------------------------------------------------------------ ExitInterface *Object::getObjectExitInterface() const { - ExitInterface *exitInterface = NULL; + ExitInterface *exitInterface = nullptr; for( BehaviorModule **umod = m_behaviors; *umod; ++umod ) { - if( (exitInterface = (*umod)->getUpdateExitInterface()) != NULL ) + if( (exitInterface = (*umod)->getUpdateExitInterface()) != nullptr ) break; } // If you don't have a fancy one, you may have one from your contain module, // since if you can contain something, they will need to get out. - if( exitInterface == NULL ) + if( exitInterface == nullptr ) { ContainModuleInterface *cmod = getContain(); if( cmod ) @@ -2448,7 +2448,7 @@ void Object::prependToList(Object **pListHead) { DEBUG_ASSERTCRASH(!isInList(pListHead), ("obj is already in a list")); - m_prev = NULL; + m_prev = nullptr; m_next = *pListHead; if (*pListHead) (*pListHead)->m_prev = this; @@ -2529,8 +2529,8 @@ void Object::removeFromList(Object **pListHead) else *pListHead = m_next; - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2606,14 +2606,14 @@ void Object::calcNaturalRallyPoint(Coord2D *pt) //------------------------------------------------------------------------------------------------- Module* Object::findModule(NameKeyType key) const { - Module* m = NULL; + Module* m = nullptr; for (BehaviorModule** b = m_behaviors; *b; ++b) { if ((*b)->getModuleNameKey() == key) { #ifdef INTENSE_DEBUG - if (m == NULL) + if (m == nullptr) { m = *b; } @@ -2909,7 +2909,7 @@ Bool Object::isAbleToAttack() const // if we're contained within a transport we cannot attack unless it specifically allows us const Object *containedBy = getContainedBy(); - DEBUG_ASSERTCRASH( (containedBy == NULL) || (containedBy->getContain() != NULL), ("A %s thinks they are contained by something with no contain module!", getTemplate()->getName().str() ) ); + DEBUG_ASSERTCRASH( (containedBy == nullptr) || (containedBy->getContain() != nullptr), ("A %s thinks they are contained by something with no contain module!", getTemplate()->getName().str() ) ); if( containedBy && containedBy->getContain() && !containedBy->getContain()->isPassengerAllowedToFire() ) return false; @@ -2994,7 +2994,7 @@ Bool Object::isAbleToAttack() const return true; // if we have AI and a weapon, assume we know how to use it - if (getAIUpdateInterface() != NULL && m_weaponSet.hasAnyWeapon()) + if (getAIUpdateInterface() != nullptr && m_weaponSet.hasAnyWeapon()) { // actually, we don't want to do this; we want the troop crawler to be considered "able to attack" @@ -3633,7 +3633,7 @@ void Object::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { Team *team = TheTeamFactory->findTeamByID( teamID ); - if( team == NULL ) + if( team == nullptr ) { DEBUG_CRASH(( "Object::xfer - Unable to load team" )); throw SC_INVALID_DATA; @@ -3709,7 +3709,7 @@ void Object::xfer( Xfer *xfer ) // our responsibility. if( xfer->getXferMode() == XFER_SAVE ) { - if( m_containedBy != NULL ) + if( m_containedBy != nullptr ) m_xferContainedByID = m_containedBy->getID(); else m_xferContainedByID = INVALID_ID; @@ -3832,7 +3832,7 @@ void Object::xfer( Xfer *xfer ) NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); // find the module with this identifier in the module list - module = NULL; + module = nullptr; for (BehaviorModule** b = m_behaviors; b && *b; ++b) { @@ -3852,7 +3852,7 @@ void Object::xfer( Xfer *xfer ) // it from the object definition in a future patch, if that is so, we need to // skip the module data in the file // - if( module == NULL ) + if( module == nullptr ) { // for testing purposes, this module better be found @@ -3894,7 +3894,7 @@ void Object::xfer( Xfer *xfer ) //m_group; // don't need to save m_partitionData. - DEBUG_ASSERTCRASH(!(xfer->getXferMode() == XFER_LOAD && m_partitionData == NULL), ("should not be in partitionmgr yet")); + DEBUG_ASSERTCRASH(!(xfer->getXferMode() == XFER_LOAD && m_partitionData == nullptr), ("should not be in partitionmgr yet")); // don't need to be saved or loaded; are inited & cached for runtime only by our ctor (srj) //m_repulsorHelper; @@ -3944,7 +3944,7 @@ void Object::loadPostProcess() if( m_xferContainedByID != INVALID_ID ) m_containedBy = TheGameLogic->findObjectByID(m_xferContainedByID); else - m_containedBy = NULL; + m_containedBy = nullptr; } @@ -4242,10 +4242,10 @@ void Object::adjustModelConditionForWeaponStatus() //------------------------------------------------------------------------------------------------- Bool Object::hasGhostObject() const { - if (m_partitionData == NULL) + if (m_partitionData == nullptr) return false; - return m_partitionData->getGhostObject() != NULL; + return m_partitionData->getGhostObject() != nullptr; } //------------------------------------------------------------------------------------------------- @@ -4667,8 +4667,8 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe { // sanity - if( specialPowerTemplate == NULL ) - return NULL; + if( specialPowerTemplate == nullptr ) + return nullptr; // search the modules for the one with the matching template for (BehaviorModule** m = m_behaviors; *m; ++m) @@ -4681,7 +4681,7 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe return sp; } - return NULL; + return nullptr; } @@ -4814,7 +4814,7 @@ void Object::doCommandButton( const CommandButton *commandButton, CommandSourceT const UpgradeTemplate *upgradeT = commandButton->getUpgradeTemplate(); DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in player upgrade command", "UNKNOWN") ); // sanity - if( upgradeT == NULL ) + if( upgradeT == nullptr ) break; if( upgradeT->getUpgradeType() == UPGRADE_TYPE_OBJECT ) { @@ -4823,7 +4823,7 @@ void Object::doCommandButton( const CommandButton *commandButton, CommandSourceT } // producer must have a production update ProductionUpdateInterface *pu = getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // queue the upgrade "research" pu->queueUpgrade( upgradeT ); @@ -5055,7 +5055,7 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) } - return NULL; + return nullptr; } @@ -5063,15 +5063,15 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) // ------------------------------------------------------------------------------------------------ DockUpdateInterface *Object::getDockUpdateInterface( void ) { - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; for( BehaviorModule **u = m_behaviors; *u; ++u ) { - if( (dock = (*u)->getDockUpdateInterface()) != NULL ) + if( (dock = (*u)->getDockUpdateInterface()) != nullptr ) return dock; } - return NULL; + return nullptr; } @@ -5092,7 +5092,7 @@ SpecialPowerModuleInterface* Object::findSpecialPowerModuleInterface( SpecialPow return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5112,7 +5112,7 @@ SpecialPowerModuleInterface* Object::findAnyShortcutSpecialPowerModuleInterface( return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5128,7 +5128,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const return sbi; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5147,7 +5147,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5166,7 +5166,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( } } } - return NULL; + return nullptr; } @@ -5188,7 +5188,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5229,17 +5229,17 @@ Bool Object::getSingleLogicalBonePositionOnTurret( WhichTurretType whichTurret, { Coord3D turretPosition; Coord3D bonePosition; - if( getDrawable() == NULL || getAI() == NULL ) + if( getDrawable() == nullptr || getAI() == nullptr ) return FALSE; // We need to find the TurretBone's pristine position. - getDrawable()->getProjectileLaunchOffset( PRIMARY_WEAPON, 1, NULL, whichTurret, &turretPosition, NULL ); + getDrawable()->getProjectileLaunchOffset( PRIMARY_WEAPON, 1, nullptr, whichTurret, &turretPosition, nullptr ); // And the required bone's pristine position - if( getDrawable()->getPristineBonePositions(boneName, 0, &bonePosition, NULL, 1) != 1 ) + if( getDrawable()->getPristineBonePositions(boneName, 0, &bonePosition, nullptr, 1) != 1 ) return FALSE; //Then we mojo the Logic position of the required bone like Missile firing does. Using the logic twist of the turret Real turretRotation; - getAI()->getTurretRotAndPitch( whichTurret, &turretRotation, NULL ); + getAI()->getTurretRotAndPitch( whichTurret, &turretRotation, nullptr ); Matrix3D boneOffset(TRUE);// This will be from the turret to the requested bone @@ -5261,7 +5261,7 @@ Bool Object::getSingleLogicalBonePositionOnTurret( WhichTurretType whichTurret, boneLogicTransform.mul( turnAdjustment, boneOffset ); Matrix3D worldTransform; - convertBonePosToWorldPos(NULL, &boneLogicTransform, NULL, &worldTransform); + convertBonePosToWorldPos(nullptr, &boneLogicTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); Coord3D worldPos; @@ -5289,7 +5289,7 @@ Int Object::getMultiLogicalBonePosition(const char* boneNamePrefix, Int maxBones if( convertToWorld ) { for (Int i = 0; i < count; ++i) - m_drawable->convertBonePosToWorldPos( positions ? &positions[i] : NULL, transforms ? &transforms[i] : NULL, positions ? &positions[i] : NULL, transforms ? &transforms[i] : NULL ); + m_drawable->convertBonePosToWorldPos( positions ? &positions[i] : nullptr, transforms ? &transforms[i] : nullptr, positions ? &positions[i] : nullptr, transforms ? &transforms[i] : nullptr ); } return count; } @@ -5531,9 +5531,9 @@ void Object::leaveGroup( void ) // if we are in a group, remove ourselves from it if (m_group) { - // to avoid recursion, set m_group to NULL before removing + // to avoid recursion, set m_group to nullptr before removing AIGroupPtr group = m_group; - m_group = NULL; + m_group = nullptr; group->remove( this ); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 2398127315d..57d77b20d77 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -75,7 +75,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -ObjectCreationListStore *TheObjectCreationListStore = NULL; ///< the ObjectCreationList store definition +ObjectCreationListStore *TheObjectCreationListStore = nullptr; ///< the ObjectCreationList store definition //------------------------------------------------------------------------------------------------- static void adjustVector(Coord3D *vec, const Matrix3D* mtx) @@ -100,7 +100,7 @@ static void adjustVector(Coord3D *vec, const Matrix3D* mtx) //------------------------------------------------------------------------------------------------- Object* ObjectCreationNugget::create( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames ) const { - return create( primary, primary ? primary->getPosition() : NULL, secondary ? secondary->getPosition() : NULL, lifetimeFrames ); + return create( primary, primary ? primary->getPosition() : nullptr, secondary ? secondary->getPosition() : nullptr, lifetimeFrames ); } //------------------------------------------------------------------------------------------------- @@ -119,7 +119,7 @@ class FireWeaponNugget : public ObjectCreationNugget public: FireWeaponNugget() : - m_weapon(NULL) + m_weapon(nullptr) { } @@ -128,22 +128,22 @@ class FireWeaponNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } if (m_weapon) { TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); } - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponNugget, m_weapon ) }, - { 0, 0, 0, 0 } + { "Weapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponNugget, m_weapon ) }, + { nullptr, nullptr, nullptr, 0 } }; FireWeaponNugget* nugget = newInstance(FireWeaponNugget); @@ -175,7 +175,7 @@ class AttackNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } // Star trekkin, across the universe. @@ -203,18 +203,18 @@ class AttackNugget : public ObjectCreationNugget rd->createRadiusDecal(m_deliveryDecalTemplate, m_deliveryDecalRadius, *secondary); rd->killWhenNoLongerAttacking(true); } - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "NumberOfShots", INI::parseInt, NULL, offsetof( AttackNugget, m_numberOfShots ) }, + { "NumberOfShots", INI::parseInt, nullptr, offsetof( AttackNugget, m_numberOfShots ) }, { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( AttackNugget, m_weaponSlot ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( AttackNugget, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof(AttackNugget, m_deliveryDecalRadius) }, - { 0, 0, 0, 0 } + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( AttackNugget, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof(AttackNugget, m_deliveryDecalRadius) }, + { nullptr, nullptr, nullptr, 0 } }; AttackNugget* nugget = newInstance(AttackNugget); @@ -262,10 +262,10 @@ class DeliverPayloadNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } - Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : NULL; + Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : nullptr; //What I'm doing for the purposes of the formations is to calculate the relative positions of @@ -301,7 +301,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget CWy = dx * s + dy * c + dy; } - Object *firstTransport = NULL; + Object *firstTransport = nullptr; for( UnsignedInt formationIndex = 0; formationIndex < m_formationSize; formationIndex++ ) { Coord3D offset; @@ -364,7 +364,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget transport = TheThingFactory->newObject( ttn, owner ); if( !transport ) { - return NULL; + return nullptr; } if( !firstTransport ) { @@ -426,7 +426,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget transport->setPosition(&startPos); } - const ThingTemplate* putInContainerTmpl = m_putInContainerName.isEmpty() ? NULL : TheThingFactory->findTemplate(m_putInContainerName); + const ThingTemplate* putInContainerTmpl = m_putInContainerName.isEmpty() ? nullptr : TheThingFactory->findTemplate(m_putInContainerName); for (std::vector::const_iterator it = m_payload.begin(); it != m_payload.end(); ++it) { const ThingTemplate* payloadTmpl = TheThingFactory->findTemplate(it->m_payloadName); @@ -434,7 +434,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget { DEBUG_CRASH( ("DeliverPayloadNugget::create() -- %s couldn't create %s (template not found).", transport->getTemplate()->getName().str(), it->m_payloadName.str() ) ); - return NULL; + return nullptr; } for (int i = 0; i < it->m_payloadCount; ++i) { @@ -518,27 +518,27 @@ class DeliverPayloadNugget : public ObjectCreationNugget //*************************************************************** //OBJECT CREATION LIST SPECIFIC DATA -- once created data no longer needed //The transport(s) that carry all the payload items (and initial physics information) - { "Transport", INI::parseAsciiString, NULL, offsetof(DeliverPayloadNugget, m_transportName) }, - { "StartAtPreferredHeight", INI::parseBool, NULL, offsetof(DeliverPayloadNugget, m_startAtPreferredHeight) }, - { "StartAtMaxSpeed", INI::parseBool, NULL, offsetof(DeliverPayloadNugget, m_startAtMaxSpeed) }, + { "Transport", INI::parseAsciiString, nullptr, offsetof(DeliverPayloadNugget, m_transportName) }, + { "StartAtPreferredHeight", INI::parseBool, nullptr, offsetof(DeliverPayloadNugget, m_startAtPreferredHeight) }, + { "StartAtMaxSpeed", INI::parseBool, nullptr, offsetof(DeliverPayloadNugget, m_startAtMaxSpeed) }, //For multiple transports, this defines the formation (and convergence if all weapons will hit same target) - { "FormationSize", INI::parseUnsignedInt, NULL, offsetof( DeliverPayloadNugget, m_formationSize) }, - { "FormationSpacing", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_formationSpacing) }, - { "WeaponConvergenceFactor", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_convergenceFactor ) }, - { "WeaponErrorRadius", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_errorRadius ) }, - { "DelayDeliveryMax", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadNugget, m_delayDeliveryFramesMax ) }, + { "FormationSize", INI::parseUnsignedInt, nullptr, offsetof( DeliverPayloadNugget, m_formationSize) }, + { "FormationSpacing", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_formationSpacing) }, + { "WeaponConvergenceFactor", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_convergenceFactor ) }, + { "WeaponErrorRadius", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_errorRadius ) }, + { "DelayDeliveryMax", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadNugget, m_delayDeliveryFramesMax ) }, //Payload information (it's all created now and stored inside) - { "Payload", parsePayload, NULL, 0 }, - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( DeliverPayloadNugget, m_putInContainerName) }, + { "Payload", parsePayload, nullptr, 0 }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadNugget, m_putInContainerName) }, //END OBJECT CREATION LIST SPECIFIC DATA //*************************************************************** //*************************************************************** //DELIVERPAYLOADDATA contains the rest (and most) of the parsed data. //*************************************************************** - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; DeliverPayloadNugget* nugget = newInstance(DeliverPayloadNugget); @@ -638,25 +638,25 @@ class ApplyRandomForceNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } virtual Object* create(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const { DEBUG_CRASH(("You must call this effect with an object, not a location")); - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(ApplyRandomForceNugget, m_spinRate) }, - { "MinForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_minMag) }, - { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_maxMag) }, - { "MinForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_minPitch) }, - { "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_maxPitch) }, - { 0, 0, 0, 0 } + { "SpinRate", INI::parseAngularVelocityReal, nullptr, offsetof(ApplyRandomForceNugget, m_spinRate) }, + { "MinForceMagnitude", INI::parseReal, nullptr, offsetof(ApplyRandomForceNugget, m_minMag) }, + { "MaxForceMagnitude", INI::parseReal, nullptr, offsetof(ApplyRandomForceNugget, m_maxMag) }, + { "MinForcePitch", INI::parseAngleReal, nullptr, offsetof(ApplyRandomForceNugget, m_minPitch) }, + { "MaxForcePitch", INI::parseAngleReal, nullptr, offsetof(ApplyRandomForceNugget, m_maxPitch) }, + { nullptr, nullptr, nullptr, 0 } }; ApplyRandomForceNugget* nugget = newInstance(ApplyRandomForceNugget); @@ -698,7 +698,7 @@ static const char* const DebrisDispositionNames[] = "FLOATING", "INHERIT_VELOCITY", "WHIRLING", - NULL + nullptr }; std::vector debrisModelNamesGlobalHack; @@ -758,7 +758,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget m_minFrames(0), m_maxFrames(0), m_shadowType(SHADOW_NONE), - m_fxFinal(NULL), + m_fxFinal(nullptr), m_preserveLayer(true), m_objectCount(0) { @@ -770,7 +770,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget if (primary) { if (m_skipIfSignificantlyAirborne && primary->isSignificantlyAboveTerrain()) - return NULL; + return nullptr; return reallyCreate( primary->getPosition(), primary->getTransformMatrix(), primary->getOrientation(), primary, lifetimeFrames ); } @@ -778,14 +778,14 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } virtual Object* create(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames = 0 ) const { if (primary) { - const Matrix3D *xfrm = NULL; + const Matrix3D *xfrm = nullptr; const Real angle = 0.0; return reallyCreate( primary, xfrm, angle, primaryObj, lifetimeFrames ); } @@ -793,43 +793,43 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } static const FieldParse* getCommonFieldParse() { static const FieldParse commonFieldParse[] = { - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_putInContainer) }, - { "ParticleSystem", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_particleSysName) }, - { "Count", INI::parseInt, NULL, offsetof( GenericObjectCreationNugget, m_debrisToGenerate ) }, - { "IgnorePrimaryObstacle", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_ignorePrimaryObstacle) }, - { "OrientInForceDirection", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_orientInForceDirection) }, - { "ExtraBounciness", INI::parseReal, NULL, offsetof( GenericObjectCreationNugget, m_extraBounciness ) }, - { "ExtraFriction", parseFrictionPerSec, NULL, offsetof( GenericObjectCreationNugget, m_extraFriction ) }, - { "Offset", INI::parseCoord3D, NULL, offsetof( GenericObjectCreationNugget, m_offset ) }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_putInContainer) }, + { "ParticleSystem", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_particleSysName) }, + { "Count", INI::parseInt, nullptr, offsetof( GenericObjectCreationNugget, m_debrisToGenerate ) }, + { "IgnorePrimaryObstacle", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_ignorePrimaryObstacle) }, + { "OrientInForceDirection", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_orientInForceDirection) }, + { "ExtraBounciness", INI::parseReal, nullptr, offsetof( GenericObjectCreationNugget, m_extraBounciness ) }, + { "ExtraFriction", parseFrictionPerSec, nullptr, offsetof( GenericObjectCreationNugget, m_extraFriction ) }, + { "Offset", INI::parseCoord3D, nullptr, offsetof( GenericObjectCreationNugget, m_offset ) }, { "Disposition", INI::parseBitString32, DebrisDispositionNames, offsetof( GenericObjectCreationNugget, m_disposition ) }, - { "DispositionIntensity", INI::parseReal, NULL, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) }, - { "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_spinRate) }, - { "YawRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_yawRate) }, - { "RollRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_rollRate) }, - { "PitchRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_pitchRate) }, - { "MinForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minMag) }, - { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_maxMag) }, - { "MinForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_minPitch) }, - { "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_maxPitch) }, - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( GenericObjectCreationNugget, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( GenericObjectCreationNugget, m_maxFrames ) }, - { "SpreadFormation", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_spreadFormation) }, - { "MinDistanceAFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minDistanceAFormation) }, - { "MinDistanceBFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minDistanceBFormation) }, - { "MaxDistanceFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_maxDistanceFormation) }, - { "FadeIn", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_fadeIn) }, - { "FadeOut", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_fadeOut) }, - { "FadeTime", INI::parseDurationUnsignedInt, NULL, offsetof(GenericObjectCreationNugget, m_fadeFrames) }, - { "FadeSound", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_fadeSoundName) }, - { "PreserveLayer", INI::parseBool, NULL, offsetof( GenericObjectCreationNugget, m_preserveLayer) }, - { 0, 0, 0, 0 } + { "DispositionIntensity", INI::parseReal, nullptr, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) }, + { "SpinRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_spinRate) }, + { "YawRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_yawRate) }, + { "RollRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_rollRate) }, + { "PitchRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_pitchRate) }, + { "MinForceMagnitude", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minMag) }, + { "MaxForceMagnitude", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxMag) }, + { "MinForcePitch", INI::parseAngleReal, nullptr, offsetof(GenericObjectCreationNugget, m_minPitch) }, + { "MaxForcePitch", INI::parseAngleReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxPitch) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( GenericObjectCreationNugget, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( GenericObjectCreationNugget, m_maxFrames ) }, + { "SpreadFormation", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_spreadFormation) }, + { "MinDistanceAFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minDistanceAFormation) }, + { "MinDistanceBFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minDistanceBFormation) }, + { "MaxDistanceFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxDistanceFormation) }, + { "FadeIn", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_fadeIn) }, + { "FadeOut", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_fadeOut) }, + { "FadeTime", INI::parseDurationUnsignedInt, nullptr, offsetof(GenericObjectCreationNugget, m_fadeFrames) }, + { "FadeSound", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_fadeSoundName) }, + { "PreserveLayer", INI::parseBool, nullptr, offsetof( GenericObjectCreationNugget, m_preserveLayer) }, + { nullptr, nullptr, nullptr, 0 } }; return commonFieldParse; } @@ -838,16 +838,16 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const FieldParse myFieldParse[] = { - { "ContainInsideSourceObject", INI::parseBool, NULL, offsetof( GenericObjectCreationNugget, m_containInsideSourceObject) }, - { "ObjectNames", parseDebrisObjectNames, NULL, 0 }, - { "ObjectCount", INI::parseInt, NULL, offsetof(GenericObjectCreationNugget, m_objectCount) }, - { "InheritsVeterancy", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_inheritsVeterancy) }, - { "SkipIfSignificantlyAirborne", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_skipIfSignificantlyAirborne) }, - { "InvulnerableTime", INI::parseDurationUnsignedInt, NULL, offsetof(GenericObjectCreationNugget, m_invulnerableTime) }, - { "MinHealth", INI::parsePercentToReal, NULL, offsetof(GenericObjectCreationNugget, m_minHealth) }, - { "MaxHealth", INI::parsePercentToReal, NULL, offsetof(GenericObjectCreationNugget, m_maxHealth) }, - { "RequiresLivePlayer", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_requiresLivePlayer) }, - { 0, 0, 0, 0 } + { "ContainInsideSourceObject", INI::parseBool, nullptr, offsetof( GenericObjectCreationNugget, m_containInsideSourceObject) }, + { "ObjectNames", parseDebrisObjectNames, nullptr, 0 }, + { "ObjectCount", INI::parseInt, nullptr, offsetof(GenericObjectCreationNugget, m_objectCount) }, + { "InheritsVeterancy", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_inheritsVeterancy) }, + { "SkipIfSignificantlyAirborne", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_skipIfSignificantlyAirborne) }, + { "InvulnerableTime", INI::parseDurationUnsignedInt, nullptr, offsetof(GenericObjectCreationNugget, m_invulnerableTime) }, + { "MinHealth", INI::parsePercentToReal, nullptr, offsetof(GenericObjectCreationNugget, m_minHealth) }, + { "MaxHealth", INI::parsePercentToReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxHealth) }, + { "RequiresLivePlayer", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_requiresLivePlayer) }, + { nullptr, nullptr, nullptr, 0 } }; MultiIniFieldParse p; @@ -866,15 +866,15 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const FieldParse myFieldParse[] = { - { "ModelNames", parseDebrisObjectNames, NULL, 0 }, - { "Mass", INI::parsePositiveNonZeroReal, NULL, offsetof( GenericObjectCreationNugget, m_mass ) }, - { "AnimationSet", parseAnimSet, NULL, offsetof( GenericObjectCreationNugget, m_animSets) }, - { "FXFinal", INI::parseFXList, NULL, offsetof( GenericObjectCreationNugget, m_fxFinal) }, - { "OkToChangeModelColor", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_okToChangeModelColor) }, - { "MinLODRequired", INI::parseStaticGameLODLevel, NULL, offsetof(GenericObjectCreationNugget, m_minLODRequired) }, + { "ModelNames", parseDebrisObjectNames, nullptr, 0 }, + { "Mass", INI::parsePositiveNonZeroReal, nullptr, offsetof( GenericObjectCreationNugget, m_mass ) }, + { "AnimationSet", parseAnimSet, nullptr, offsetof( GenericObjectCreationNugget, m_animSets) }, + { "FXFinal", INI::parseFXList, nullptr, offsetof( GenericObjectCreationNugget, m_fxFinal) }, + { "OkToChangeModelColor", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_okToChangeModelColor) }, + { "MinLODRequired", INI::parseStaticGameLODLevel, nullptr, offsetof(GenericObjectCreationNugget, m_minLODRequired) }, { "Shadow", INI::parseBitString32, TheShadowNames, offsetof( GenericObjectCreationNugget, m_shadowType ) }, - { "BounceSound", INI::parseAudioEventRTS, NULL, offsetof( GenericObjectCreationNugget, m_bounceSound) }, - { 0, 0, 0, 0 } + { "BounceSound", INI::parseAudioEventRTS, nullptr, offsetof( GenericObjectCreationNugget, m_bounceSound) }, + { nullptr, nullptr, nullptr, 0 } }; MultiIniFieldParse p; @@ -983,7 +983,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget for (BehaviorModule** update = obj->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onEnslave( sourceObj ); break; @@ -1217,19 +1217,19 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const ThingTemplate* debrisTemplate = TheThingFactory->findTemplate("GenericDebris"); - if (m_names.empty()) - return NULL; + if (m_names.size() <= 0) + return nullptr; if (m_requiresLivePlayer && (!sourceObj || !sourceObj->getControllingPlayer()->isPlayerActive())) - return NULL; // don't spawn useful objects for dead players. Avoid the zombie units from Yuri's. + return nullptr; // don't spawn useful objects for dead players. Avoid the zombie units from Yuri's. // Object type debris might need this information to process visual UpgradeModules. - Team *debrisOwner = NULL; + Team *debrisOwner = nullptr; if( sourceObj ) debrisOwner = sourceObj->getControllingPlayer()->getDefaultTeam(); - Object* container = NULL; - Object *firstObject = NULL; + Object* container = nullptr; + Object *firstObject = nullptr; if (!m_putInContainer.isEmpty()) { const ThingTemplate* containerTmpl = TheThingFactory->findTemplate(m_putInContainer); @@ -1277,14 +1277,14 @@ class GenericObjectCreationNugget : public ObjectCreationNugget firstObject = debris; } debris->setProducer(sourceObj); - if (m_preserveLayer && sourceObj != NULL && container == NULL) + if (m_preserveLayer && sourceObj != nullptr && container == nullptr) { PathfindLayerEnum layer = sourceObj->getLayer(); if (layer != LAYER_GROUND) debris->setLayer(layer); } - if (container != NULL && container->getContain() != NULL && container->getContain()->isValidContainerFor(debris, true)) + if (container != nullptr && container->getContain() != nullptr && container->getContain()->isValidContainerFor(debris, true)) container->getContain()->addToContain(debris); // if we want the objects being created to appear in a spread formation @@ -1410,13 +1410,13 @@ EMPTY_DTOR(GenericObjectCreationNugget) //------------------------------------------------------------------------------------------------- static const FieldParse TheObjectCreationListFieldParse[] = { - { "CreateObject", GenericObjectCreationNugget::parseObject, 0, 0}, - { "CreateDebris", GenericObjectCreationNugget::parseDebris, 0, 0}, - { "ApplyRandomForce", ApplyRandomForceNugget::parse, 0, 0}, - { "DeliverPayload", DeliverPayloadNugget::parse, 0, 0}, - { "FireWeapon", FireWeaponNugget::parse, 0, 0}, - { "Attack", AttackNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } + { "CreateObject", GenericObjectCreationNugget::parseObject, nullptr, 0}, + { "CreateDebris", GenericObjectCreationNugget::parseDebris, nullptr, 0}, + { "ApplyRandomForce", ApplyRandomForceNugget::parse, nullptr, 0}, + { "DeliverPayload", DeliverPayloadNugget::parse, nullptr, 0}, + { "FireWeapon", FireWeaponNugget::parse, nullptr, 0}, + { "Attack", AttackNugget::parse, nullptr, 0}, + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -1436,12 +1436,12 @@ void ObjectCreationList::addObjectCreationNugget(ObjectCreationNugget* nugget) //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Bool createOwner, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primaryObj != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primaryObj != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primaryObj, primary, secondary, createOwner, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1451,12 +1451,12 @@ Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coor //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primaryObj != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primaryObj != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primaryObj, primary, secondary, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1466,12 +1466,12 @@ Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coor //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primary != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primary != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primary, secondary, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1501,12 +1501,12 @@ ObjectCreationListStore::~ObjectCreationListStore() const ObjectCreationList *ObjectCreationListStore::findObjectCreationList(const char* name) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; ObjectCreationListMap::const_iterator it = m_ocls.find(NAMEKEY(name)); if (it == m_ocls.end()) { - return NULL; + return nullptr; } else { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index cabb37d8144..55e5ae5c9ab 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -109,7 +109,7 @@ const Real HUGE_DIST_SQR = (HUGE_DIST*HUGE_DIST); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static PartitionContactList* TheContactList = NULL; +static PartitionContactList* TheContactList = nullptr; //----------------------------------------------------------------------------- // Local Types @@ -202,7 +202,7 @@ inline Bool filtersAllow(PartitionFilter **filters, Object *objOther) { for (idx = 0; idx < MAXR; ++idx) { - names[idx] = NULL; + names[idx] = nullptr; rejections[idx] = 0; usefulRejections[idx] = 0; } @@ -891,8 +891,8 @@ static Bool distCalcProc_BoundaryAndBoundary_3D( Real maxDistSqr ) { - const GeometryInfo* geomA = objA ? &objA->getGeometryInfo() : NULL; - const GeometryInfo* geomB = objB ? &objB->getGeometryInfo() : NULL; + const GeometryInfo* geomA = objA ? &objA->getGeometryInfo() : nullptr; + const GeometryInfo* geomB = objB ? &objB->getGeometryInfo() : nullptr; // note that object positions are defined as the bottom center of the geometry, // thus we must add the radius to the z coord to get the proper center of the bounding sphere. @@ -972,7 +972,7 @@ static CollideTestProc theCollideTestProcs[] = //----------------------------------------------------------------------------- // Public Data //----------------------------------------------------------------------------- -PartitionManager *ThePartitionManager = NULL; ///< the object manager singleton +PartitionManager *ThePartitionManager = nullptr; ///< the object manager singleton //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1017,7 +1017,7 @@ class PartitionContactList PartitionContactList() { memset(m_contactHash, 0, sizeof(m_contactHash)); - m_contactList = NULL; + m_contactList = nullptr; } ~PartitionContactList() @@ -1114,7 +1114,7 @@ PartitionCell *CellOutwardIterator::nextCell(Bool skipEmpties) goto try_again; } - return NULL; + return nullptr; } #endif @@ -1125,23 +1125,23 @@ PartitionCell *CellOutwardIterator::nextCell(Bool skipEmpties) //----------------------------------------------------------------------------- CellAndObjectIntersection::CellAndObjectIntersection() { - m_cell = NULL; - m_module = NULL; - m_prevCoi = NULL; - m_nextCoi = NULL; + m_cell = nullptr; + m_module = nullptr; + m_prevCoi = nullptr; + m_nextCoi = nullptr; } //----------------------------------------------------------------------------- CellAndObjectIntersection::~CellAndObjectIntersection() { - DEBUG_ASSERTCRASH(m_prevCoi == NULL && m_nextCoi == NULL, ("destroying a linked COI")); + DEBUG_ASSERTCRASH(m_prevCoi == nullptr && m_nextCoi == nullptr, ("destroying a linked COI")); DEBUG_ASSERTCRASH(!getModule(), ("destroying an in-use COI")); } //----------------------------------------------------------------------------- void CellAndObjectIntersection::friend_addToCellList(CellAndObjectIntersection **pListHead) { - DEBUG_ASSERTCRASH(m_prevCoi == NULL && m_nextCoi == NULL && *pListHead != this, ("trying to add a cell to list, but it appears to already be in a list")); + DEBUG_ASSERTCRASH(m_prevCoi == nullptr && m_nextCoi == nullptr && *pListHead != this, ("trying to add a cell to list, but it appears to already be in a list")); this->m_nextCoi = *pListHead; if (*pListHead) @@ -1153,7 +1153,7 @@ void CellAndObjectIntersection::friend_addToCellList(CellAndObjectIntersection * void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersection **pListHead) { #define DEBUG_ASSERTINLIST(c) \ - DEBUG_ASSERTCRASH((c)->m_prevCoi != NULL || (c)->m_nextCoi != NULL || *pListHead == (c), ("cell is not in list")); + DEBUG_ASSERTCRASH((c)->m_prevCoi != nullptr || (c)->m_nextCoi != nullptr || *pListHead == (c), ("cell is not in list")); DEBUG_ASSERTINLIST(this); @@ -1175,8 +1175,8 @@ void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersect this->m_nextCoi->m_prevCoi = this->m_prevCoi; } - this->m_prevCoi = NULL; - this->m_nextCoi = NULL; + this->m_prevCoi = nullptr; + this->m_nextCoi = nullptr; #undef DEBUG_ASSERTINLIST } @@ -1184,16 +1184,16 @@ void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersect //----------------------------------------------------------------------------- void CellAndObjectIntersection::addCoverage(PartitionCell *cell, PartitionData *module) { - DEBUG_ASSERTCRASH(m_cell == NULL || m_cell == cell, ("mismatch")); - DEBUG_ASSERTCRASH(m_module == NULL || m_module == module, ("mismatch")); + DEBUG_ASSERTCRASH(m_cell == nullptr || m_cell == cell, ("mismatch")); + DEBUG_ASSERTCRASH(m_module == nullptr || m_module == module, ("mismatch")); - if (m_module != NULL && m_module != module) + if (m_module != nullptr && m_module != module) { DEBUG_CRASH(("COI already in use by another module!")); return; } - if (m_cell == NULL) + if (m_cell == nullptr) cell->friend_addToCellList(this); m_cell = cell; @@ -1203,15 +1203,15 @@ void CellAndObjectIntersection::addCoverage(PartitionCell *cell, PartitionData * //----------------------------------------------------------------------------- void CellAndObjectIntersection::removeAllCoverage() { - if (m_module == NULL) + if (m_module == nullptr) { DEBUG_CRASH(("COI not in use")); return; } m_cell->friend_removeFromCellList(this); - m_cell = NULL; - m_module = NULL; + m_cell = nullptr; + m_module = nullptr; } //----------------------------------------------------------------------------- @@ -1222,7 +1222,7 @@ void CellAndObjectIntersection::removeAllCoverage() PartitionCell::PartitionCell() { m_cellX = m_cellY = 0; - m_firstCoiInCell = NULL; + m_firstCoiInCell = nullptr; m_coiCount = 0; #ifdef PM_CACHE_TERRAIN_HEIGHT m_loTerrainZ = HUGE_DIST; // huge positive @@ -1251,7 +1251,7 @@ PartitionCell::PartitionCell() //----------------------------------------------------------------------------- PartitionCell::~PartitionCell() { - DEBUG_ASSERTCRASH(m_firstCoiInCell == NULL && m_coiCount == 0, ("destroying a nonempty PartitionCell")); + DEBUG_ASSERTCRASH(m_firstCoiInCell == nullptr && m_coiCount == 0, ("destroying a nonempty PartitionCell")); // but don't destroy the Cois; they don't belong to us } @@ -1488,9 +1488,9 @@ void PartitionCell::validateCoiList() { nextCoi = coi->getNextCoi(); DEBUG_ASSERTCRASH(coi->getPrevCoi() == prevCoi, ("coi link mismatch")); - DEBUG_ASSERTCRASH(prevCoi == NULL || prevCoi->getNextCoi() == coi, ("coi link mismatch")); - DEBUG_ASSERTCRASH((coi == getFirstCoiInCell()) == (prevCoi == NULL) , ("coi link mismatch")); - DEBUG_ASSERTCRASH(nextCoi == NULL || nextCoi->getPrevCoi() == coi, ("coi link mismatch")); + DEBUG_ASSERTCRASH(prevCoi == nullptr || prevCoi->getNextCoi() == coi, ("coi link mismatch")); + DEBUG_ASSERTCRASH((coi == getFirstCoiInCell()) == (prevCoi == nullptr) , ("coi link mismatch")); + DEBUG_ASSERTCRASH(nextCoi == nullptr || nextCoi->getPrevCoi() == coi, ("coi link mismatch")); } } #endif @@ -1539,18 +1539,18 @@ void PartitionCell::loadPostProcess( void ) PartitionData::PartitionData() { //DEBUG_LOG(("create pd %08lx",this)); - m_next = NULL; - m_prev = NULL; - m_nextDirty = NULL; - m_prevDirty = NULL; - m_object = NULL; - m_ghostObject = NULL; + m_next = nullptr; + m_prev = nullptr; + m_nextDirty = nullptr; + m_prevDirty = nullptr; + m_object = nullptr; + m_ghostObject = nullptr; m_coiArrayCount = 0; - m_coiArray = NULL; + m_coiArray = nullptr; m_coiInUseCount = 0; m_doneFlag = 0; m_dirtyStatus = NOT_DIRTY; - m_lastCell = NULL; + m_lastCell = nullptr; for (int i = 0; i < MAX_PLAYER_COUNT; ++i) { m_everSeenByPlayer[i] = false; @@ -1741,7 +1741,7 @@ void PartitionData::addSubPixToCoverage(PartitionCell *cell) { // see if we already have a coi for this cell. CellAndObjectIntersection *coi = m_coiArray; - CellAndObjectIntersection *coiToUse = NULL; + CellAndObjectIntersection *coiToUse = nullptr; for (Int i = m_coiInUseCount; i; --i, ++coi) { if (coi->getCell() == cell) @@ -1750,8 +1750,8 @@ void PartitionData::addSubPixToCoverage(PartitionCell *cell) break; } } - DEBUG_ASSERTCRASH(coiToUse != NULL || m_coiInUseCount < m_coiArrayCount, ("not enough cois allocated for this object")); - if (coiToUse == NULL && m_coiInUseCount < m_coiArrayCount) + DEBUG_ASSERTCRASH(coiToUse != nullptr || m_coiInUseCount < m_coiArrayCount, ("not enough cois allocated for this object")); + if (coiToUse == nullptr && m_coiInUseCount < m_coiArrayCount) { // nope, no coi for this cell, allocate a new one coiToUse = &m_coiArray[m_coiInUseCount++]; @@ -2193,7 +2193,7 @@ Int PartitionData::calcMaxCoiForShape(GeometryType geom, Real majorRadius, Real Int PartitionData::calcMaxCoiForObject() { Object *obj = getObject(); - DEBUG_ASSERTCRASH(obj != NULL, ("must be attached to an Object here 2")); + DEBUG_ASSERTCRASH(obj != nullptr, ("must be attached to an Object here 2")); GeometryType geom = obj->getGeometryInfo().getGeomType(); Real majorRadius = obj->getGeometryInfo().getMajorRadius(); @@ -2228,7 +2228,7 @@ void PartitionData::makeDirty(Bool needToUpdateCells) //----------------------------------------------------------------------------- void PartitionData::allocCoiArray() { - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); m_coiArrayCount = calcMaxCoiForObject(); m_coiArray = MSGNEW("PartitionManager_COI") CellAndObjectIntersection[m_coiArrayCount]; // may throw! @@ -2240,7 +2240,7 @@ void PartitionData::allocCoiArray() void PartitionData::freeCoiArray() { delete [] m_coiArray; // yes, it's OK to call this on null... - m_coiArray = NULL; + m_coiArray = nullptr; m_coiArrayCount = 0; m_coiInUseCount = 0; makeDirty(true); @@ -2273,7 +2273,7 @@ void PartitionData::attachToObject(Object* object) //DEBUG_LOG(("attach pd for pd %08lx obj %08lx",this,m_object)); // (re)calc maxCoi and (re)alloc cois - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); freeCoiArray(); allocCoiArray(); // may throw! @@ -2297,16 +2297,16 @@ void PartitionData::detachFromObject() TheContactList->removeSpecificPartitionData(this); if (m_object) - m_object->friend_setPartitionData(NULL); + m_object->friend_setPartitionData(nullptr); removeAllTouchedCells(); freeCoiArray(); //DEBUG_LOG(("detach pd for pd %08lx obj %08lx",this,m_object)); // no longer attached to object - m_object = NULL; + m_object = nullptr; TheGhostObjectManager->removeGhostObject(m_ghostObject); - m_ghostObject = NULL; + m_ghostObject = nullptr; } //----------------------------------------------------------------------------- @@ -2314,11 +2314,11 @@ void PartitionData::attachToGhostObject(GhostObject* object) { // remember who contains us - m_object = NULL; //it's only attached to a ghost object, no parent object. + m_object = nullptr; //it's only attached to a ghost object, no parent object. m_ghostObject = object; // (re)calc maxCoi and (re)alloc cois - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); freeCoiArray(); @@ -2328,7 +2328,7 @@ void PartitionData::attachToGhostObject(GhostObject* object) makeDirty(true); if (m_ghostObject) - m_ghostObject->updateParentObject(NULL,this); + m_ghostObject->updateParentObject(nullptr,this); } //----------------------------------------------------------------------------- @@ -2350,8 +2350,8 @@ void PartitionData::detachFromGhostObject(void) //DEBUG_LOG(("detach pd for pd %08lx obj %08lx",this,m_object)); // no longer attached to object - m_object = NULL; - m_ghostObject = NULL; + m_object = nullptr; + m_ghostObject = nullptr; } //----------------------------------------------------------------------------- @@ -2378,12 +2378,12 @@ inline UnsignedInt hash2ints(Int a, Int b) //----------------------------------------------------------------------------- void PartitionContactList::addToContactList( PartitionData *obj, PartitionData *other ) { - if (obj == other || obj == NULL || other == NULL) + if (obj == other || obj == nullptr || other == nullptr) return; Object* obj_obj = obj->getObject(); Object* other_obj = other->getObject(); - if (obj_obj == NULL || other_obj == NULL) + if (obj_obj == nullptr || other_obj == nullptr) return; // compute hash index based on object's ids. @@ -2471,8 +2471,8 @@ void PartitionContactList::removeSpecificPartitionData(PartitionData* data) { if (cd->m_obj == data || cd->m_other == data) { - cd->m_obj = NULL; - cd->m_other = NULL; + cd->m_obj = nullptr; + cd->m_other = nullptr; } } } @@ -2489,7 +2489,7 @@ void PartitionContactList::resetContactList() } memset(m_contactHash, 0, sizeof(m_contactHash)); - m_contactList = NULL; + m_contactList = nullptr; } //----------------------------------------------------------------------------- @@ -2497,7 +2497,7 @@ void PartitionContactList::processContactList() { for (PartitionContactListNode* cd = m_contactList; cd; cd = cd->m_next) { - if (cd->m_obj == NULL || cd->m_other == NULL) + if (cd->m_obj == nullptr || cd->m_other == nullptr) continue; // we know that their partitions overlap; determine if they REALLY collide @@ -2519,8 +2519,8 @@ void PartitionContactList::processContactList() // the onCollide() calls can remove the object(s) from the partition mgr, // thus destroying the partitiondata for 'em. go ahead and null these out here // so we won't be tempted to use 'em (since they might be bogus). - cd->m_obj = NULL; - cd->m_other = NULL; + cd->m_obj = nullptr; + cd->m_other = nullptr; obj->onCollide(other, &cinfo.loc, &cinfo.normal); flipCoord3D(&cinfo.normal); @@ -2540,12 +2540,12 @@ void PartitionContactList::processContactList() // NOTE also that we re-get partitiondata from the object, since it might have been // removed from the partition system by the onCollide call... // - if (!obj->isDestroyed() && obj->friend_getPartitionData() != NULL && !obj->isKindOf(KINDOF_IMMOBILE)) + if (!obj->isDestroyed() && obj->friend_getPartitionData() != nullptr && !obj->isKindOf(KINDOF_IMMOBILE)) { //DEBUG_LOG(("%d: re-dirtying collision of %s %08lx with %s %08lx",TheGameLogic->getFrame(),obj->getTemplate()->getName().str(),obj,other->getTemplate()->getName().str(),other)); obj->friend_getPartitionData()->makeDirty(false); } - if (!other->isDestroyed() && other->friend_getPartitionData() != NULL && !other->isKindOf(KINDOF_IMMOBILE)) + if (!other->isDestroyed() && other->friend_getPartitionData() != nullptr && !other->isKindOf(KINDOF_IMMOBILE)) { //DEBUG_LOG(("%d: re-dirtying collision of %s %08lx with %s %08lx [other]",TheGameLogic->getFrame(),other->getTemplate()->getName().str(),other,obj->getTemplate()->getName().str(),obj)); other->friend_getPartitionData()->makeDirty(false); @@ -2560,15 +2560,15 @@ void PartitionContactList::processContactList() //----------------------------------------------------------------------------- PartitionManager::PartitionManager() { - m_moduleList = NULL; + m_moduleList = nullptr; m_cellSize = m_cellSizeInv = 0.0f; m_cellCountX = 0; m_cellCountY = 0; m_totalCellCount = 0; - m_cells = NULL; + m_cells = nullptr; m_worldExtents.lo.zero(); m_worldExtents.hi.zero(); - m_dirtyModules = NULL; + m_dirtyModules = nullptr; m_updatedSinceLastReset = false; #ifdef FASTER_GCO m_maxGcoRadius = 0; @@ -2616,7 +2616,7 @@ void PartitionManager::init() m_cellSizeInv = (Real)(1.0 / m_cellSize); - DEBUG_ASSERTCRASH(m_cells == NULL, ("double init")); + DEBUG_ASSERTCRASH(m_cells == nullptr, ("double init")); if (TheTerrainLogic) { @@ -2658,7 +2658,7 @@ void PartitionManager::init() m_cellCountX = 0; m_cellCountY = 0; m_totalCellCount = 0; - m_cells = NULL; + m_cells = nullptr; m_worldExtents.lo.zero(); m_worldExtents.hi.zero(); } @@ -2703,7 +2703,7 @@ void PartitionManager::shutdown() #ifdef RTS_DEBUG // the above *should* remove all the touched cells (via unRegisterObject), but let's check: - DEBUG_ASSERTCRASH( m_moduleList == NULL, ("hmm, modules left over")); + DEBUG_ASSERTCRASH( m_moduleList == nullptr, ("hmm, modules left over")); PartitionData *mod, *nextMod; for( mod = m_moduleList; mod; mod = nextMod ) { @@ -2720,7 +2720,7 @@ void PartitionManager::shutdown() resetPendingUndoShroudRevealQueue(); delete [] m_cells; - m_cells = NULL; + m_cells = nullptr; m_cellSize = m_cellSizeInv = 0.0f; m_cellCountX = 0; @@ -2754,7 +2754,7 @@ void PartitionManager::update() // save it. PartitionData *dirty = m_dirtyModules; - DEBUG_ASSERTCRASH(dirty->getObject() != NULL || dirty->getGhostObject() != NULL, + DEBUG_ASSERTCRASH(dirty->getObject() != nullptr || dirty->getGhostObject() != nullptr, ("must be attached to an Object here %08lx",dirty)); // get this BEFORE removing from dirty list, since that clears the @@ -2780,7 +2780,7 @@ void PartitionManager::update() #ifdef INTENSE_DEBUG DEBUG_ASSERTLOG(cc==0,("updated partition info for %d objects",cc)); #endif - TheContactList = NULL; + TheContactList = nullptr; processPendingUndoShroudRevealQueue(); } @@ -2852,11 +2852,11 @@ void PartitionManager::update() void PartitionManager::registerObject( Object* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // if object is already part of this system get out of here - if( object->friend_getPartitionData() != NULL ) + if( object->friend_getPartitionData() != nullptr ) { DEBUG_LOG(( "Object '%s' already registered with partition manager", object->getTemplate()->getName().str() )); @@ -2867,7 +2867,7 @@ void PartitionManager::registerObject( Object* object ) PartitionData *mod = newInstance( PartitionData ); // link the module to the list in the partition manager - mod->setPrev( NULL ); + mod->setPrev( nullptr ); mod->setNext( m_moduleList ); if( m_moduleList ) m_moduleList->setPrev( mod ); @@ -2882,26 +2882,26 @@ void PartitionManager::registerObject( Object* object ) void PartitionManager::unRegisterObject( Object* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // get the partition module PartitionData *mod = object->friend_getPartitionData(); - if( mod == NULL ) + if( mod == nullptr ) return; GhostObject *ghost; // need to figure out if any players have a fogged memory of this object. // if so, we can't remove it from the shroud system just yet. - if ((ghost=mod->getGhostObject()) != NULL && mod->wasSeenByAnyPlayers() < MAX_PLAYER_COUNT) + if ((ghost=mod->getGhostObject()) != nullptr && mod->wasSeenByAnyPlayers() < MAX_PLAYER_COUNT) { if (TheContactList) TheContactList->removeSpecificPartitionData(mod); - object->friend_setPartitionData(NULL); - mod->friend_setObject(NULL); + object->friend_setPartitionData(nullptr); + mod->friend_setObject(nullptr); //Tell the ghost object that its parent is dead. - ghost->updateParentObject(NULL, mod); + ghost->updateParentObject(nullptr, mod); return; } @@ -2927,11 +2927,11 @@ void PartitionManager::unRegisterObject( Object* object ) void PartitionManager::registerGhostObject( GhostObject* object) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // if object is already part of this system get out of here - if( object->friend_getPartitionData() != NULL ) + if( object->friend_getPartitionData() != nullptr ) { DEBUG_LOG(( "GhostObject already registered with partition manager")); return; @@ -2941,7 +2941,7 @@ void PartitionManager::registerGhostObject( GhostObject* object) PartitionData *mod = newInstance( PartitionData ); // link the module to the list in the partition manager - mod->setPrev( NULL ); + mod->setPrev( nullptr ); mod->setNext( m_moduleList ); if( m_moduleList ) m_moduleList->setPrev( mod ); @@ -2955,12 +2955,12 @@ void PartitionManager::registerGhostObject( GhostObject* object) void PartitionManager::unRegisterGhostObject( GhostObject* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // get the partition module PartitionData *mod = object->friend_getPartitionData(); - if( mod == NULL ) + if( mod == nullptr ) return; // detach the module from the object @@ -3248,7 +3248,7 @@ Object *PartitionManager::getClosestObjects( ++theEntrancyCount; #endif - DEBUG_ASSERTCRASH((obj==NULL) != (pos == NULL), ("either obj or pos must be null")); + DEBUG_ASSERTCRASH((obj==nullptr) != (pos == nullptr), ("either obj or pos must be null")); DistCalcProc distProc = theDistCalcProcs[dc]; @@ -3257,7 +3257,7 @@ Object *PartitionManager::getClosestObjects( if (pos) { objPos = pos; - objToUse = NULL; + objToUse = nullptr; } else { @@ -3267,7 +3267,7 @@ Object *PartitionManager::getClosestObjects( Int cellCenterX, cellCenterY; worldToCell(objPos->x, objPos->y, &cellCenterX, &cellCenterY); - Object* closestObj = NULL; + Object* closestObj = nullptr; Real closestDistSqr = maxDist * maxDist; // if it's not closer than this, we shouldn't consider it anyway... Coord3D closestVec; #if !RETAIL_COMPATIBLE_CRC // TheSuperHackers @info This should be safe to initialize because it is unused, but let us be extra safe for now. @@ -3312,7 +3312,7 @@ Object *PartitionManager::getClosestObjects( for (OffsetVec::const_iterator it = offsets.begin(); it != offsets.end(); ++it) { PartitionCell* thisCell = getCellAt(cellCenterX + it->x, cellCenterY + it->y); - if (thisCell == NULL) + if (thisCell == nullptr) continue; for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = thisCoi->getNextCoi()) @@ -3321,7 +3321,7 @@ Object *PartitionManager::getClosestObjects( Object *thisObj = thisMod->getObject(); // never compare against ourself. - if (thisObj == obj || thisObj == NULL) + if (thisObj == obj || thisObj == nullptr) continue; // since an object can exist in multiple COIs, we use this to avoid processing @@ -3384,7 +3384,7 @@ Object *PartitionManager::getClosestObjects( ++theIterFlag; PartitionCell *thisCell; - while ((thisCell = iter.nextNonEmpty()) != NULL) + while ((thisCell = iter.nextNonEmpty()) != nullptr) { CellAndObjectIntersection *nextCoi; for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = nextCoi) @@ -3475,7 +3475,7 @@ Object *PartitionManager::getClosestObject( Coord3D *closestDistVec ) { - return getClosestObjects(obj, NULL, maxDist, dc, filters, NULL, closestDist, closestDistVec); + return getClosestObjects(obj, nullptr, maxDist, dc, filters, nullptr, closestDist, closestDistVec); } //----------------------------------------------------------------------------- @@ -3488,7 +3488,7 @@ Object *PartitionManager::getClosestObject( Coord3D *closestDistVec ) { - return getClosestObjects(NULL, pos, maxDist, dc, filters, NULL, closestDist, closestDistVec); + return getClosestObjects(nullptr, pos, maxDist, dc, filters, nullptr, closestDist, closestDistVec); } //----------------------------------------------------------------------------- @@ -3504,7 +3504,7 @@ void PartitionManager::getVectorTo(const Object *obj, const Coord3D *pos, Distan { DistCalcProc distProc = theDistCalcProcs[dc]; Real distSqr; - (*distProc)(obj->getPosition(), obj, pos, NULL, distSqr, vec, HUGE_DIST_SQR); + (*distProc)(obj->getPosition(), obj, pos, nullptr, distSqr, vec, HUGE_DIST_SQR); } //----------------------------------------------------------------------------- @@ -3525,7 +3525,7 @@ Real PartitionManager::getDistanceSquared(const Object *obj, const Coord3D *pos, DistCalcProc distProc = theDistCalcProcs[dc]; Real thisDistSqr; Coord3D thisVec; - (*distProc)(obj->getPosition(), obj, pos, NULL, thisDistSqr, thisVec, HUGE_DIST_SQR); + (*distProc)(obj->getPosition(), obj, pos, nullptr, thisDistSqr, thisVec, HUGE_DIST_SQR); if (vec) *vec = thisVec; return thisDistSqr; @@ -3551,7 +3551,7 @@ Real PartitionManager::getGoalDistanceSquared(const Object *obj, const Coord3D * DistCalcProc distProc = theDistCalcProcs[dc]; Real thisDistSqr; Coord3D thisVec; - (*distProc)(goalPos, obj, otherPos, NULL, thisDistSqr, thisVec, HUGE_DIST_SQR); + (*distProc)(goalPos, obj, otherPos, nullptr, thisDistSqr, thisVec, HUGE_DIST_SQR); if (vec) *vec = thisVec; return thisDistSqr; @@ -3625,7 +3625,7 @@ SimpleObjectIterator *PartitionManager::iterateObjectsInRange( SimpleObjectIterator *iter = newInstance(SimpleObjectIterator); iterHolder.hold(iter); - getClosestObjects(obj, NULL, maxDist, dc, filters, iter, NULL, NULL); + getClosestObjects(obj, nullptr, maxDist, dc, filters, iter, nullptr, nullptr); iter->sort(order); iterHolder.release(); @@ -3645,7 +3645,7 @@ SimpleObjectIterator *PartitionManager::iterateObjectsInRange( SimpleObjectIterator *iter = newInstance(SimpleObjectIterator); iterHolder.hold(iter); - getClosestObjects(NULL, pos, maxDist, dc, filters, iter, NULL, NULL); + getClosestObjects(nullptr, pos, maxDist, dc, filters, iter, nullptr, nullptr); iter->sort(order); iterHolder.release(); @@ -3668,9 +3668,9 @@ SimpleObjectIterator* PartitionManager::iteratePotentialCollisions( iterHolder.hold(iter); PartitionFilterWouldCollide filter(*pos, geom, angle, true); - PartitionFilter *filters[] = { &filter, NULL }; + PartitionFilter *filters[] = { &filter, nullptr }; - getClosestObjects(NULL, pos, maxDist, use2D ? FROM_BOUNDINGSPHERE_2D : FROM_BOUNDINGSPHERE_3D, filters, iter, NULL, NULL); + getClosestObjects(nullptr, pos, maxDist, use2D ? FROM_BOUNDINGSPHERE_2D : FROM_BOUNDINGSPHERE_3D, filters, iter, nullptr, nullptr); iterHolder.release(); return iter; @@ -3696,7 +3696,7 @@ Bool PartitionManager::isColliding( const Object *a, const Object *b ) const } //See if the partition data collides. - return ad->friend_collidesWith( bd, NULL ); + return ad->friend_collidesWith( bd, nullptr ); } //----------------------------------------------------------------------------- @@ -3906,7 +3906,7 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, { // sanity - if( center == NULL || result == NULL || options == NULL ) + if( center == nullptr || result == nullptr || options == nullptr ) return FALSE; Region3D extent; @@ -4403,7 +4403,7 @@ Int PartitionManager::iterateCellsAlongLine(const Coord3D& pos, const Coord3D& p for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { PartitionCell* cell = getCellAt(x, y); // might be null if off the edge - DEBUG_ASSERTCRASH(cell != NULL, ("off the map")); + DEBUG_ASSERTCRASH(cell != nullptr, ("off the map")); if (cell) { Int ret = (*proc)(cell, userData); @@ -4550,7 +4550,7 @@ Bool PartitionManager::isClearLineOfSightTerrain(const Object* obj, const Coord3 */ Real maxZ; Coord2D maxZPos; - Bool valid = estimateTerrainExtremesAlongLine(pos, posOther, NULL, &maxZ, NULL, &maxZPos); + Bool valid = estimateTerrainExtremesAlongLine(pos, posOther, nullptr, &maxZ, nullptr, &maxZPos); DEBUG_ASSERTCRASH(valid, ("this should never happen unless both positions are off-map")); if (!valid) return true; @@ -4726,7 +4726,7 @@ Real PartitionManager::getGroundOrStructureHeight(Real posx, Real posy) // scan all objects in the radius of our extent and find the tallest height among them PartitionFilterAcceptByKindOf filter1( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ), KINDOFMASK_NONE ); - PartitionFilter *filters[] = { &filter1, NULL }; + PartitionFilter *filters[] = { &filter1, nullptr }; Coord3D pos; pos.x = posx; pos.y = posy; @@ -4961,7 +4961,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) // Get the controlling team of other. ContainModuleInterface* contain = other->getContain(); - const Player* otherPlayer = contain ? contain->getApparentControllingPlayer(myPlayer) : NULL; + const Player* otherPlayer = contain ? contain->getApparentControllingPlayer(myPlayer) : nullptr; if (!otherPlayer) otherPlayer = other->getControllingPlayer(); @@ -4983,7 +4983,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) return true; } - if (other->getContain() != NULL && other->isAbleToAttack()) + if (other->getContain() != nullptr && other->isAbleToAttack()) { // Don't reject garrisoned buildings that can attack return true; @@ -5166,7 +5166,7 @@ Bool PartitionFilterUnmannedObject::allow( Object *other ) //----------------------------------------------------------------------------- Bool PartitionFilterValidCommandButtonTarget::allow( Object *other ) { - return (m_commandButton->isValidToUseOn(m_source, other, NULL, m_commandSource) == m_match); + return (m_commandButton->isValidToUseOn(m_source, other, nullptr, m_commandSource) == m_match); } //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp index 78ae8a60632..1aa7772e0e2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp @@ -37,7 +37,7 @@ SimpleObjectIterator::ClumpCompareProc SimpleObjectIterator::theClumpCompareProcs[] = { - NULL, // "fastest" gets no proc + nullptr, // "fastest" gets no proc SimpleObjectIterator::sortNearToFar, SimpleObjectIterator::sortFarToNear, SimpleObjectIterator::sortCheapToExpensive, @@ -47,7 +47,7 @@ SimpleObjectIterator::ClumpCompareProc SimpleObjectIterator::theClumpCompareProc //============================================================================= SimpleObjectIterator::Clump::Clump() { - m_nextClump = NULL; + m_nextClump = nullptr; } //============================================================================= @@ -58,8 +58,8 @@ SimpleObjectIterator::Clump::~Clump() //============================================================================= SimpleObjectIterator::SimpleObjectIterator() { - m_firstClump = NULL; - m_curClump = NULL; + m_firstClump = nullptr; + m_curClump = nullptr; m_clumpCount = 0; } @@ -88,7 +88,7 @@ void SimpleObjectIterator::insert(Object *obj, Real numeric) //============================================================================= Object *SimpleObjectIterator::nextWithNumeric(Real *num) { - Object *obj = NULL; + Object *obj = nullptr; if (num) *num = 0.0f; @@ -121,8 +121,8 @@ void SimpleObjectIterator::makeEmpty() } DEBUG_ASSERTCRASH(m_clumpCount == 0, ("hmm")); - m_firstClump = NULL; - m_curClump = NULL; + m_firstClump = nullptr; + m_curClump = nullptr; m_clumpCount = 0; } @@ -153,8 +153,8 @@ void SimpleObjectIterator::sort(IterOrderType order) for ( Int n = 1 ; ; n *= 2 ) { Clump *to_do = m_firstClump; - Clump *tail = NULL; - m_firstClump = NULL; + Clump *tail = nullptr; + m_firstClump = nullptr; Int mergeCount = 0; @@ -225,7 +225,7 @@ void SimpleObjectIterator::sort(IterOrderType order) to_do = sub; } if (tail) - tail->m_nextClump = NULL; + tail->m_nextClump = nullptr; if (mergeCount <= 1) // when we have done just one (or none) swap, we're done break; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp index 43d4850f732..8808fd4d4f2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp @@ -64,8 +64,8 @@ BaikonurLaunchPowerModuleData::BaikonurLaunchPowerModuleData( void ) static const FieldParse dataFieldParse[] = { - { "DetonationObject", INI::parseAsciiString, NULL, offsetof( BaikonurLaunchPowerModuleData, m_detonationObject ) }, - { 0, 0, 0, 0 } + { "DetonationObject", INI::parseAsciiString, nullptr, offsetof( BaikonurLaunchPowerModuleData, m_detonationObject ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp index 1e6bd51e3b8..de75236289b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp @@ -86,8 +86,8 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, { CashBountyPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parsePercentToReal(ini, NULL, &up.m_bounty, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parsePercentToReal(ini, nullptr, &up.m_bounty, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -103,10 +103,10 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, static const FieldParse dataFieldParse[] = { #ifdef NOT_IN_USE - { "UpgradeBounty", parseBountyUpgradePair, NULL, offsetof( CashBountyPowerModuleData, m_upgrades ) }, + { "UpgradeBounty", parseBountyUpgradePair, nullptr, offsetof( CashBountyPowerModuleData, m_upgrades ) }, #endif - { "Bounty", INI::parsePercentToReal, NULL, offsetof( CashBountyPowerModuleData, m_defaultBounty ) }, - { 0, 0, 0, 0 } + { "Bounty", INI::parsePercentToReal, nullptr, offsetof( CashBountyPowerModuleData, m_defaultBounty ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -150,7 +150,7 @@ Real CashBountyPower::findBounty() const const CashBountyPowerModuleData* d = getCashBountyPowerModuleData(); #ifdef NOT_IN_USE const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgrades.begin(); it != d->m_upgrades.end(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp index 82b94e1a754..ac11418900e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp @@ -53,8 +53,8 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store { CashHackSpecialPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parseInt(ini, NULL, &up.m_amountToSteal, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parseInt(ini, nullptr, &up.m_amountToSteal, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -68,9 +68,9 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store static const FieldParse dataFieldParse[] = { - { "UpgradeMoneyAmount", parseCashHackUpgradePair, NULL, offsetof( CashHackSpecialPowerModuleData, m_upgrades ) }, - { "MoneyAmount", INI::parseInt, NULL, offsetof( CashHackSpecialPowerModuleData, m_defaultAmountToSteal ) }, - { 0, 0, 0, 0 } + { "UpgradeMoneyAmount", parseCashHackUpgradePair, nullptr, offsetof( CashHackSpecialPowerModuleData, m_upgrades ) }, + { "MoneyAmount", INI::parseInt, nullptr, offsetof( CashHackSpecialPowerModuleData, m_defaultAmountToSteal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -112,7 +112,7 @@ Int CashHackSpecialPower::findAmountToSteal() const { const CashHackSpecialPowerModuleData* d = getCashHackSpecialPowerModuleData(); const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgrades.begin(); it != d->m_upgrades.end(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp index dfa42864475..1260c0979dd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp @@ -64,8 +64,8 @@ void CleanupAreaPowerModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxMoveDistanceFromLocation", INI::parseReal, NULL, offsetof( CleanupAreaPowerModuleData, m_cleanupMoveRange ) }, - { 0, 0, 0, 0 } + { "MaxMoveDistanceFromLocation", INI::parseReal, nullptr, offsetof( CleanupAreaPowerModuleData, m_cleanupMoveRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp index d6f6ec27422..cff0913d87c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp @@ -61,8 +61,8 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) static const FieldParse dataFieldParse[] = { - { "FatCursorRadius", INI::parseReal, NULL, offsetof( DefectorSpecialPowerModuleData, m_fatCursorRadius ) }, - { 0, 0, 0, 0 } + { "FatCursorRadius", INI::parseReal, nullptr, offsetof( DefectorSpecialPowerModuleData, m_fatCursorRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp index 3ebffaddd19..983f569ad9e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp @@ -52,7 +52,7 @@ DemoralizeSpecialPowerModuleData::DemoralizeSpecialPowerModuleData( void ) m_baseDurationInFrames = 0; m_bonusDurationPerCapturedInFrames = 0; m_maxDurationInFrames = 0; - m_fxList = NULL; + m_fxList = nullptr; } @@ -64,13 +64,13 @@ void DemoralizeSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BaseRange", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_baseRange ) }, - { "BonusRangePerCaptured", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_bonusRangePerCaptured ) }, - { "MaxRange", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_maxRange ) }, - { "BaseDuration", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_baseDurationInFrames ) }, - { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, - { "MaxDuration", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_maxDurationInFrames ) }, - { "FXList", INI::parseFXList, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_fxList ) }, + { "BaseRange", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_baseRange ) }, + { "BonusRangePerCaptured", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_bonusRangePerCaptured ) }, + { "MaxRange", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_maxRange ) }, + { "BaseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_baseDurationInFrames ) }, + { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, + { "MaxDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_maxDurationInFrames ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_fxList ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); @@ -104,7 +104,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // call the base class action cause we are *EXTENDING* functionality @@ -148,7 +148,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real PartitionFilterAcceptByKindOf filter2( MAKE_KINDOF_MASK( KINDOF_INFANTRY ), KINDOFMASK_NONE ); PartitionFilterSameMapStatus filterMapStatus(source); - PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( loc, range, FROM_CENTER_2D, diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index 0e70351b04e..cf93a6f8b44 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -57,7 +57,7 @@ static const char* const TheOCLCreateLocTypeNames[] = "USE_OWNER_OBJECT", "CREATE_ABOVE_LOCATION", "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, "Incorrect array size"); @@ -65,7 +65,7 @@ static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, //------------------------------------------------------------------------------------------------- OCLSpecialPowerModuleData::OCLSpecialPowerModuleData( void ) { - m_defaultOCL = NULL; + m_defaultOCL = nullptr; m_upgradeOCL.clear(); m_createLoc = CREATE_AT_EDGE_NEAR_SOURCE; } @@ -76,8 +76,8 @@ static void parseOCLUpgradePair( INI* ini, void * /*instance*/, void *store, con { OCLSpecialPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parseObjectCreationList(ini, NULL, &up.m_ocl, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parseObjectCreationList(ini, nullptr, &up.m_ocl, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -91,10 +91,10 @@ static void parseOCLUpgradePair( INI* ini, void * /*instance*/, void *store, con static const FieldParse dataFieldParse[] = { - { "UpgradeOCL", parseOCLUpgradePair, NULL, offsetof( OCLSpecialPowerModuleData, m_upgradeOCL ) }, - { "OCL", INI::parseObjectCreationList, NULL, offsetof( OCLSpecialPowerModuleData, m_defaultOCL ) }, + { "UpgradeOCL", parseOCLUpgradePair, nullptr, offsetof( OCLSpecialPowerModuleData, m_upgradeOCL ) }, + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( OCLSpecialPowerModuleData, m_defaultOCL ) }, { "CreateLocation", INI::parseIndexList, TheOCLCreateLocTypeNames, offsetof( OCLSpecialPowerModuleData, m_createLoc ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -118,7 +118,7 @@ const ObjectCreationList* OCLSpecialPower::findOCL() const { const OCLSpecialPowerModuleData* d = getOCLSpecialPowerModuleData(); const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgradeOCL.begin(); it != d->m_upgradeOCL.end(); @@ -147,7 +147,7 @@ void OCLSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // call the base class action cause we are *EXTENDING* functionality diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp index 61628a2e3fd..cf6ce80969b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp @@ -63,7 +63,7 @@ void SpecialAbility::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, U return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // call the base class action cause we are *EXTENDING* functionality diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 20e8230cd92..1902010dda7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -60,7 +60,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_updateModuleStartsAttack = false; m_startsPaused = FALSE; @@ -74,11 +74,11 @@ SpecialPowerModuleData::SpecialPowerModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, - { "UpdateModuleStartsAttack", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, - { "StartsPaused", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_startsPaused ) }, - { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerModuleData, m_initiateSound ) }, - { 0, 0, 0, 0 } + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, + { "UpdateModuleStartsAttack", INI::parseBool, nullptr, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, + { "StartsPaused", INI::parseBool, nullptr, offsetof( SpecialPowerModuleData, m_startsPaused ) }, + { "InitiateSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerModuleData, m_initiateSound ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -317,7 +317,7 @@ Real SpecialPowerModule::getPercentReady() const const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); // sanity - if( modData->m_specialPowerTemplate == NULL ) + if( modData->m_specialPowerTemplate == nullptr ) return 0.0f; UnsignedInt readyFrame = m_availableOnFrame; @@ -358,7 +358,7 @@ void SpecialPowerModule::startPowerRecharge() const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); // sanity - if( modData->m_specialPowerTemplate == NULL ) + if( modData->m_specialPowerTemplate == nullptr ) { DEBUG_CRASH(("special power not found")); return; @@ -437,7 +437,7 @@ void SpecialPowerModule::createViewObject( const Coord3D *location ) const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); const SpecialPowerTemplate *powerTemplate = modData->m_specialPowerTemplate; - if( modData == NULL || powerTemplate == NULL ) + if( modData == nullptr || powerTemplate == nullptr ) return; Real visionRange = powerTemplate->getViewObjectRange(); @@ -451,12 +451,12 @@ void SpecialPowerModule::createViewObject( const Coord3D *location ) return; const ThingTemplate *viewObjectTemplate = TheThingFactory->findTemplate( objectName ); - if( viewObjectTemplate == NULL ) + if( viewObjectTemplate == nullptr ) return; Object *viewObject = TheThingFactory->newObject( viewObjectTemplate, getObject()->getControllingPlayer()->getDefaultTeam() ); - if( viewObject == NULL ) + if( viewObject == nullptr ) return; viewObject->setPosition( location ); @@ -539,7 +539,7 @@ void SpecialPowerModule::doSpecialPower( UnsignedInt commandOptions ) //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, NULL, NULL, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, nullptr, nullptr, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -547,7 +547,7 @@ void SpecialPowerModule::doSpecialPower( UnsignedInt commandOptions ) //is the napalm strike. If we don't call this now, it's up to the update module to do so. if( !getSpecialPowerModuleData()->m_updateModuleStartsAttack ) { - triggerSpecialPower( NULL );// Location-less trigger + triggerSpecialPower( nullptr );// Location-less trigger } } @@ -561,7 +561,7 @@ void SpecialPowerModule::doSpecialPowerAtObject( Object *obj, UnsignedInt comman //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( obj, NULL, NULL, commandOptions ); + initiateIntentToDoSpecialPower( obj, nullptr, nullptr, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -583,7 +583,7 @@ void SpecialPowerModule::doSpecialPowerAtLocation( const Coord3D *loc, Real angl //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, loc, NULL, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, loc, nullptr, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -605,7 +605,7 @@ void SpecialPowerModule::doSpecialPowerUsingWaypoints( const Waypoint *way, Unsi //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, NULL, way, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, nullptr, way, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -613,7 +613,7 @@ void SpecialPowerModule::doSpecialPowerUsingWaypoints( const Waypoint *way, Unsi //is the napalm strike. If we don't call this now, it's up to the update module to do so. if( !getSpecialPowerModuleData()->m_updateModuleStartsAttack ) { - triggerSpecialPower( NULL );// This type doesn't create view objects + triggerSpecialPower( nullptr );// This type doesn't create view objects } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp index 73643833048..d7c754b0a2f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp @@ -55,10 +55,10 @@ void SpyVisionSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BaseDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_baseDurationInFrames ) }, - { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, - { "MaxDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_maxDurationInFrames ) }, - { 0, 0, 0, 0 } + { "BaseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_baseDurationInFrames ) }, + { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, + { "MaxDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_maxDurationInFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 2f09a4ff27b..e8acc202c87 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -79,7 +79,7 @@ AIUpdateModuleData::AIUpdateModuleData() { //m_locomotorTemplates -- nothing to do for (int i = 0; i < MAX_TURRETS; i++) - m_turretData[i] = NULL; + m_turretData[i] = nullptr; m_autoAcquireEnemiesWhenIdle = 0; m_moodAttackCheckRate = LOGICFRAMES_PER_SECOND * 2; #ifdef ALLOW_SURRENDER @@ -104,12 +104,12 @@ AIUpdateModuleData::~AIUpdateModuleData() const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(LocomotorSetType t) const { if (m_locomotorTemplates.empty()) - return NULL; + return nullptr; LocomotorTemplateMap::const_iterator it = m_locomotorTemplates.find(t); if (it == m_locomotorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -124,14 +124,14 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L static const FieldParse dataFieldParse[] = { - { "Turret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[0]) }, - { "AltTurret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[1]) }, + { "Turret", AIUpdateModuleData::parseTurret, nullptr, offsetof(AIUpdateModuleData, m_turretData[0]) }, + { "AltTurret", AIUpdateModuleData::parseTurret, nullptr, offsetof(AIUpdateModuleData, m_turretData[1]) }, { "AutoAcquireEnemiesWhenIdle", INI::parseBitString32, TheAutoAcquireEnemiesNames, offsetof(AIUpdateModuleData, m_autoAcquireEnemiesWhenIdle) }, - { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, + { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, nullptr, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, #ifdef ALLOW_SURRENDER - { "SurrenderDuration", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_surrenderDuration) }, + { "SurrenderDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(AIUpdateModuleData, m_surrenderDuration) }, #endif - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -205,7 +205,7 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_priorWaypointID = 0xfacade; m_currentWaypointID = 0xfacade; - m_stateMachine = NULL; + m_stateMachine = nullptr; m_nextEnemyScanTime = 0; m_currentVictimID = INVALID_ID; m_desiredSpeed = FAST_AS_POSSIBLE; @@ -214,12 +214,12 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_guardTargetType[0] = m_guardTargetType[1] = GUARDTARGET_NONE; m_locationToGuard.zero(); m_objectToGuard = INVALID_ID; - m_areaToGuard = NULL; - m_attackInfo = NULL; + m_areaToGuard = nullptr; + m_attackInfo = nullptr; m_waypointCount = 0; m_waypointIndex = 0; - m_completedWaypoint = NULL; - m_path = NULL; + m_completedWaypoint = nullptr; + m_path = nullptr; m_requestedVictimID = INVALID_ID; m_requestedDestination.zero(); m_requestedDestination2.zero(); @@ -240,12 +240,12 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_moveOutOfWay1 = INVALID_ID; m_moveOutOfWay2 = INVALID_ID; m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; m_curLocomotorSet = LOCOMOTORSET_INVALID; m_locomotorGoalType = NONE; m_locomotorGoalData.zero(); for (i = 0; i < MAX_TURRETS; i++) - m_turretAI[i] = NULL; + m_turretAI[i] = nullptr; m_turretSyncFlag = TURRET_INVALID; m_attitude = ATTITUDE_NORMAL; m_nextMoodCheckTime = 0; @@ -310,7 +310,7 @@ void AIUpdateInterface::setSurrendered( const Object *objWeSurrenderedTo, Bool s if (m_surrenderedFramesLeft < d->m_surrenderDuration) m_surrenderedFramesLeft = d->m_surrenderDuration; - const Player* playerWeSurrenderedTo = objWeSurrenderedTo ? objWeSurrenderedTo->getControllingPlayer() : NULL; + const Player* playerWeSurrenderedTo = objWeSurrenderedTo ? objWeSurrenderedTo->getControllingPlayer() : nullptr; m_surrenderedPlayerIndex = playerWeSurrenderedTo ? playerWeSurrenderedTo->getPlayerIndex() : -1; if (!wasSurrendered) @@ -351,7 +351,7 @@ void AIUpdateInterface::setGoalPositionClipped(const Coord3D* in, CommandSourceT if (cmdSource == CMD_FROM_PLAYER) { Real fudge = TheGlobalData->m_partitionCellSize * 0.5f; - if (getObject()->isKindOf(KINDOF_AIRCRAFT) && getObject()->isSignificantlyAboveTerrain() && m_curLocomotor != NULL) + if (getObject()->isKindOf(KINDOF_AIRCRAFT) && getObject()->isSignificantlyAboveTerrain() && m_curLocomotor != nullptr) { // aircraft must stay further away from the map edges, to prevent getting "lost" fudge = max(fudge, m_curLocomotor->getPreferredHeight()); @@ -379,7 +379,7 @@ void AIUpdateInterface::setGoalPositionClipped(const Coord3D* in, CommandSourceT } else { - getStateMachine()->setGoalPosition(NULL); + getStateMachine()->setGoalPosition(nullptr); } } @@ -428,7 +428,7 @@ void AIUpdateInterface::doPathfind( PathfindServicesInterface *pathfinder ) return; } if (m_isAttackPath) { - Object *victim = NULL; + Object *victim = nullptr; if (m_requestedVictimID != INVALID_ID) { victim = TheGameLogic->findObjectByID(m_requestedVictimID); } @@ -595,7 +595,7 @@ void AIUpdateInterface::setPathFromWaypoint(const Waypoint *way, const Coord2D * Coord3D wayPos = *way->getLocation(); wayPos.x += offset->x; wayPos.y += offset->y; - if (way->getLink(0) == NULL) { + if (way->getLink(0) == nullptr) { TheAI->pathfinder()->snapPosition(getObject(), &wayPos); } m_path->appendNode( &wayPos, LAYER_GROUND ); @@ -617,7 +617,7 @@ void AIUpdateInterface::onObjectCreated() // create the behavior state machine. // can't do this in the ctor because makeStateMachine is a protected virtual func, // and overrides to virtual funcs don't exist in our ctor. (look it up.) - if (m_stateMachine == NULL) + if (m_stateMachine == nullptr) { m_stateMachine = makeStateMachine(); m_stateMachine->initDefaultState(); @@ -628,7 +628,7 @@ void AIUpdateInterface::onObjectCreated() AIUpdateInterface::~AIUpdateInterface( void ) { m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; if( m_stateMachine ) { m_stateMachine->halt(); @@ -638,11 +638,11 @@ AIUpdateInterface::~AIUpdateInterface( void ) for (int i = 0; i < MAX_TURRETS; i++) { deleteInstance(m_turretAI[i]); - m_turretAI[i] = NULL; + m_turretAI[i] = nullptr; } - m_stateMachine = NULL; + m_stateMachine = nullptr; - // destroy the current path. (destroyPath is NULL savvy) + // destroy the current path. (destroyPath is nullptr savvy) destroyPath(); } @@ -668,7 +668,7 @@ Object* AIUpdateInterface::getTurretTargetObject( WhichTurretType tur ) return obj; } } - return NULL; + return nullptr; } //============================================================================= @@ -748,7 +748,7 @@ Bool AIUpdateInterface::getTurretRotAndPitch(WhichTurretType tur, Real* turretAn //============================================================================= Real AIUpdateInterface::getTurretTurnRate(WhichTurretType tur) const { - return (tur != TURRET_INVALID && m_turretAI[tur] != NULL) ? + return (tur != TURRET_INVALID && m_turretAI[tur] != nullptr) ? m_turretAI[tur]->getTurnRate() : 0.0f; } @@ -784,7 +784,7 @@ WhichTurretType AIUpdateInterface::getWhichTurretForWeaponSlot(WeaponSlotType ws //============================================================================= Real AIUpdateInterface::getCurLocomotorSpeed() const { - if (m_curLocomotor != NULL) + if (m_curLocomotor != nullptr) return m_curLocomotor->getMaxSpeedForCondition(getObject()->getBodyModule()->getDamageState()); DEBUG_LOG(("no current locomotor!")); @@ -827,7 +827,7 @@ Bool AIUpdateInterface::chooseLocomotorSetExplicit(LocomotorSetType wst) if (set) { m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; for (size_t i = 0; i < set->size(); ++i) { const LocomotorTemplate* lt = set->at(i); @@ -847,9 +847,9 @@ void AIUpdateInterface::chooseGoodLocomotorFromCurrentSet( void ) Locomotor* newLoco = TheAI->pathfinder()->chooseBestLocomotorForPosition(getObject()->getLayer(), &m_locomotorSet, getObject()->getPosition()); - if (newLoco == NULL) + if (newLoco == nullptr) { - if (prevLoco != NULL) + if (prevLoco != nullptr) { /* due to physics, we might slight into a cell for which we have no loco (eg, cliff) and get stuck. this is bad. as a solution, we do this. @@ -905,7 +905,7 @@ Object* AIUpdateInterface::checkForCrateToPickup() } } } - return NULL; + return nullptr; } #ifdef ALLOW_SURRENDER @@ -1001,7 +1001,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) m_isInUpdate = TRUE; - m_completedWaypoint = NULL; // Reset so state machine update can set it if we just completed the path. + m_completedWaypoint = nullptr; // Reset so state machine update can set it if we just completed the path. // assume we can sleep forever, unless the state machine (or turret, etc) demand otherwise UpdateSleepTime subMachineSleep = UPDATE_SLEEP_FOREVER; @@ -1052,7 +1052,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) TheAI->pathfinder()->updateGoal(getObject(), &goalPos, getObject()->getLayer()); } m_movementComplete = FALSE; - ignoreObstacle(NULL); + ignoreObstacle(nullptr); } UnsignedInt now = TheGameLogic->getFrame(); @@ -1124,7 +1124,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) m_isInUpdate = FALSE; - if (m_completedWaypoint != NULL) + if (m_completedWaypoint != nullptr) { // sleep NONE here so that it will get reset next frame. // this happen infrequently, so it shouldn't be an issue. @@ -1424,7 +1424,7 @@ Bool AIUpdateInterface::processCollision(PhysicsBehavior *physics, Object *other return FALSE; AIUpdateInterface* aiOther = other->getAI(); - if (aiOther == NULL) + if (aiOther == nullptr) return FALSE; Bool selfMoving = isMoving(); @@ -1464,7 +1464,7 @@ Bool AIUpdateInterface::processCollision(PhysicsBehavior *physics, Object *other } #define dont_MOVE_AROUND // It just causes more problems than it fixes. jba. #ifdef MOVE_AROUND - if (m_curLocomotor!=NULL && (other->isKindOf(KINDOF_INFANTRY)==getObject()->isKindOf(KINDOF_INFANTRY))) { + if (m_curLocomotor!= nullptr && (other->isKindOf(KINDOF_INFANTRY)==getObject()->isKindOf(KINDOF_INFANTRY))) { Real myMaxSpeed = m_curLocomotor->getMaxSpeedForCondition(getObject()->getBodyModule()->getDamageState()); Locomotor *hisLoco = aiOther->getCurLocomotor(); if (hisLoco) { @@ -1599,9 +1599,9 @@ Bool AIUpdateInterface::computeQuickPath( const Coord3D *destination ) // First, see if our path already goes to the destination. if (m_path) { - PathNode *closeNode = NULL; + PathNode *closeNode = nullptr; closeNode = m_path->getLastNode(); - if (closeNode && closeNode->getNextOptimized()==NULL) { + if (closeNode && closeNode->getNextOptimized()==nullptr) { Real dxSqr = destination->x - closeNode->getPosition()->x; dxSqr *= dxSqr; Real dySqr = destination->y - closeNode->getPosition()->y; @@ -1678,7 +1678,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co } } - Path *theNewPath = NULL; + Path *theNewPath = nullptr; TheAI->pathfinder()->setIgnoreObstacleID( getIgnoredObstacleID() ); Coord3D originalDestination = *destination; @@ -1693,7 +1693,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(destination); if (TheAI->pathfinder()->validMovementPosition( getObject()->getCrusherLevel()>0, destinationLayer, m_locomotorSet, destination ) == FALSE) { - theNewPath = NULL; + theNewPath = nullptr; } else { @@ -1706,7 +1706,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co destination); } } - if (theNewPath==NULL && m_path==NULL) { + if (theNewPath==nullptr && m_path==nullptr) { Real pathCostFactor = 0.0f; theNewPath = pathServices->findClosestPath( getObject(), m_locomotorSet, getObject()->getPosition(), destination, m_isBlockedAndStuck, pathCostFactor, FALSE ); @@ -1786,7 +1786,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic Object* source = getObject(); if (!victim && !victimPos) { - //CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() - victim is NULL")); + //CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() - victim is null")); return FALSE; } @@ -1804,7 +1804,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic // is our weapon within attack range? // if so, just return TRUE with no path. - if (victim != NULL) + if (victim != nullptr) { if (weapon->isWithinAttackRange(source, victim)) { @@ -1822,14 +1822,14 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic } } - else if (victimPos != NULL) + else if (victimPos != nullptr) { if (weapon->isWithinAttackRange(source, victimPos)) { Bool viewBlocked = FALSE; if (isDoingGroundMovement()) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), NULL, *victimPos); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), nullptr, *victimPos); } if (!viewBlocked) { destroyPath(); @@ -1851,7 +1851,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic getCurLocomotor()->setNoSlowDownAsApproachingDest(TRUE); } Bool ok = computePath(pathServices, &tmp); - if (m_path==NULL) return false; + if (m_path==nullptr) return false; Real dx, dy; dx = victimPos->x - m_path->getLastNode()->getPosition()->x; dy = victimPos->y - m_path->getLastNode()->getPosition()->y; @@ -1874,7 +1874,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic Coord3D localVictimPos; - if (victim != NULL) + if (victim != nullptr) { if (victim->isKindOf(KINDOF_BRIDGE)) { @@ -1906,16 +1906,16 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic // build a trivial one-node path containing destination weapon->computeApproachTarget(getObject(), victim, &localVictimPos, 0, localVictimPos); - //DEBUG_ASSERTCRASH(weapon->isGoalPosWithinAttackRange(getObject(), &localVictimPos, victim, victimPos, NULL), + //DEBUG_ASSERTCRASH(weapon->isGoalPosWithinAttackRange(getObject(), &localVictimPos, victim, victimPos, nullptr), // ("position we just calced is not acceptable")); // First, see if our path already goes to the destination. if (m_path) { - PathNode *startNode, *closeNode = NULL; + PathNode *startNode, *closeNode = nullptr; startNode = m_path->getFirstNode(); closeNode = startNode->getNextOptimized(); - if (closeNode && closeNode->getNextOptimized()==NULL) { + if (closeNode && closeNode->getNextOptimized()==nullptr) { Real dxSqr = localVictimPos.x - closeNode->getPosition()->x; dxSqr *= dxSqr; Real dySqr = localVictimPos.y - closeNode->getPosition()->y; @@ -1971,13 +1971,13 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic //------------------------------------------------------------------------------------------------- /** - * Destroy the current path, and set it to NULL + * Destroy the current path, and set it to null */ void AIUpdateInterface::destroyPath( void ) { // destroy previous path deleteInstance(m_path); - m_path = NULL; + m_path = nullptr; m_waitingForPath = FALSE; // we no longer need it. //CRCDEBUG_LOG(("AIUpdateInterface::destroyPath() - m_isAttackPath = FALSE for object %d", getObject()->getID())); @@ -2038,7 +2038,7 @@ Bool AIUpdateInterface::isPathAvailable( const Coord3D *destination ) const { // sanity - if( destination == NULL ) + if( destination == nullptr ) return FALSE; const Coord3D *myPos = getObject()->getPosition(); @@ -2055,7 +2055,7 @@ Bool AIUpdateInterface::isQuickPathAvailable( const Coord3D *destination ) const { // sanity - if( destination == NULL ) + if( destination == nullptr ) return FALSE; const Coord3D *myPos = getObject()->getPosition(); @@ -2255,7 +2255,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void ) m_curMaxBlockedSpeed = FAST_AS_POSSIBLE; } - if (m_curLocomotor != NULL + if (m_curLocomotor != nullptr && m_locomotorGoalType == NONE && m_doFinalPosition == FALSE && m_isBlocked == FALSE @@ -2317,7 +2317,7 @@ Bool AIUpdateInterface::isDoingGroundMovement(void) const return FALSE; // air only loco. } - if (m_curLocomotor == NULL) + if (m_curLocomotor == nullptr) { return FALSE; // No loco, so we aren't moving. } @@ -2337,7 +2337,7 @@ Bool AIUpdateInterface::isDoingGroundMovement(void) const // if we're airborne and "allowed to fall", we are probably deliberately in midair // due to rappel or accident... const PhysicsBehavior* physics = getObject()->getPhysics(); - if (getObject()->isAboveTerrain() && physics != NULL && physics->getAllowToFall()) + if (getObject()->isAboveTerrain() && physics != nullptr && physics->getAllowToFall()) { return FALSE; } @@ -2354,7 +2354,7 @@ destinations, and this routine identifies non-ground units that should unstack. Bool AIUpdateInterface::isAircraftThatAdjustsDestination(void) const { - if (m_curLocomotor == NULL) + if (m_curLocomotor == nullptr) { return FALSE; // No loco, so we aren't moving. } @@ -2491,9 +2491,9 @@ void AIUpdateInterface::joinTeam( void ) chooseLocomotorSet(LOCOMOTORSET_NORMAL); getStateMachine()->clear(); - getStateMachine()->setGoalWaypoint(NULL); + getStateMachine()->setGoalWaypoint(nullptr); Object *obj = getObject(); - Object *other = NULL; + Object *other = nullptr; Team *team = obj->getTeam(); for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -2971,7 +2971,7 @@ void AIUpdateInterface::privateIdle(CommandSourceType cmdSource) for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it) { Object* obj = *it; - AIUpdateInterface* ai = obj ? obj->getAI() : NULL; + AIUpdateInterface* ai = obj ? obj->getAI() : nullptr; if (ai) ai->aiIdle(cmdSource); } @@ -3028,7 +3028,7 @@ void AIUpdateInterface::privateTightenToPosition( const Coord3D *pos, CommandSou if (getObject()->isMobile() == FALSE) return; getStateMachine()->clear(); - getStateMachine()->setGoalObject( NULL ); + getStateMachine()->setGoalObject( nullptr ); setGoalPositionClipped(pos, cmdSource); setLastCommandSource( cmdSource ); getStateMachine()->setState( AI_MOVE_AND_TIGHTEN ); @@ -3099,18 +3099,18 @@ void AIUpdateInterface::privateMoveAwayFromUnit( Object *unit, CommandSourceType m_moveOutOfWay2 = m_moveOutOfWay1; m_moveOutOfWay1 = id; Object *obj2 = TheGameLogic->findObjectByID(m_moveOutOfWay2); - Path *path2 = NULL; + Path *path2 = nullptr; if (obj2 && obj2->getAI()) { path2 = obj2->getAI()->getPath(); } - Path* unitPath = NULL; + Path* unitPath = nullptr; if (unit && unit->getAI()) { unitPath = unit->getAI()->getPath(); } - if (unitPath == NULL) return; + if (unitPath == nullptr) return; Path *newPath = TheAI->pathfinder()->getMoveAwayFromPath(getObject(), unit, unitPath, obj2, path2); - if (newPath==NULL && !canPathThroughUnits()) { + if (newPath==nullptr && !canPathThroughUnits()) { setCanPathThroughUnits(TRUE); newPath = TheAI->pathfinder()->getMoveAwayFromPath(getObject(), unit, unitPath, obj2, path2); } @@ -3231,14 +3231,14 @@ void AIUpdateInterface::privateFollowPathAppend( const Coord3D *pos, CommandSour std::vector path; path.push_back( *getGoalPosition() ); path.push_back( *pos ); - privateFollowPath( &path, NULL, cmdSource, false ); + privateFollowPath( &path, nullptr, cmdSource, false ); } else { //Hopefully we're idle or doing something that doesn't require movement. std::vector path; path.push_back( *pos ); - privateFollowPath( &path, NULL, cmdSource, false ); + privateFollowPath( &path, nullptr, cmdSource, false ); } } @@ -3362,7 +3362,7 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT //chooseLocomotorSet(LOCOMOTORSET_NORMAL); Coord3D localPos = *pos; - pos = NULL; + pos = nullptr; // ick... rather grody hack for disarming stuff. if we attack a position, // but have a "continue range" for the weapon, try to find a suitable object @@ -3375,7 +3375,7 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT getObject()->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, getObject(), cmdSource); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter *filters[] = { &filterAttack, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAttack, &filterMapStatus, nullptr }; Object* victim = ThePartitionManager->getClosestObject(&localPos, continueRange, FROM_CENTER_2D, filters); getObject()->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); @@ -3413,9 +3413,9 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT getStateMachine()->setState( AI_ATTACK_POSITION ); - //Set the goal object to NULL because if we are attacking a location, we need to be able to move up to it properly. + //Set the goal object to nullptr because if we are attacking a location, we need to be able to move up to it properly. //When this isn't set, the move aborts before getting into firing range, thus deadlocks. - getStateMachine()->setGoalObject( NULL ); + getStateMachine()->setGoalObject( nullptr ); // do this after setting it as the current state, as the max-shots-to-fire is reset in AttackState::onEnter() weapon = getObject()->getCurrentWeapon(); @@ -3969,14 +3969,14 @@ void AIUpdateInterface::transferAttack(ObjectID fromID, ObjectID toID) */ void AIUpdateInterface::setCurrentVictim( const Object *victim ) { - if (victim == NULL) + if (victim == nullptr) { // be paranoid, in case we are called from dtors, etc. if (m_currentVictimID != INVALID_ID) { Object* self = getObject(); Object* target = TheGameLogic->findObjectByID(m_currentVictimID); - if (self != NULL && target != NULL) + if (self != nullptr && target != nullptr) { AIUpdateInterface* targetAI = target->getAI(); if (targetAI) @@ -4005,7 +4005,7 @@ Object *AIUpdateInterface::getCurrentVictim( void ) const if (m_currentVictimID != INVALID_ID) return TheGameLogic->findObjectByID( m_currentVictimID ); - return NULL; + return nullptr; } // if we are attacking a position (and NOT an object), return it. otherwise return null. @@ -4019,7 +4019,7 @@ const Coord3D *AIUpdateInterface::getCurrentVictimPos( void ) const } } - return NULL; + return nullptr; } @@ -4073,7 +4073,7 @@ Object* AIUpdateInterface::getEnterTarget() if( stateType != AI_ENTER && stateType != AI_GUARD_TUNNEL_NETWORK && stateType != AI_GET_REPAIRED ) - return NULL; + return nullptr; return getStateMachine()->getGoalObject(); } @@ -4131,7 +4131,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixValue( void ) const } else { - if (m_turretAI[0] != NULL) + if (m_turretAI[0] != nullptr) { returnVal |= MM_UnitType_Turreted; } @@ -4265,10 +4265,10 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring // if we're dead, we can't attack if (obj->isEffectivelyDead()) - return NULL; + return nullptr; if (obj->testStatus(OBJECT_STATUS_IS_USING_ABILITY)) { - return NULL; // we are doing a special ability. Shouldn't auto-acquire a target at this time. jba. + return nullptr; // we are doing a special ability. Shouldn't auto-acquire a target at this time. jba. } const AIUpdateModuleData* d = getAIUpdateModuleData(); @@ -4277,14 +4277,14 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { if ((d->m_autoAcquireEnemiesWhenIdle & AAS_Idle) == 0) { - return NULL; + return nullptr; } } // srj sez: this should ignore calledDuringIdle, despite what the name of the bit implies. if (isAttacking() && BitIsSet(d->m_autoAcquireEnemiesWhenIdle, AAS_Idle_Not_While_Attacking)) { - return NULL; + return nullptr; } //Check if unit is stealthed... is so we won't acquire targets unless he has @@ -4300,12 +4300,12 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring if( !container ) { //Not contained - return NULL; + return nullptr; } if( !container->getContain()->isPassengerAllowedToFire() ) { //Container doesn't allow for passenger to shoot. - return NULL; + return nullptr; } } } @@ -4314,7 +4314,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring UnsignedInt now = TheGameLogic->getFrame(); // Check if team auto targets same victim. - Object *teamVictim = NULL; + Object *teamVictim = nullptr; if (calledByAI && obj->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = obj->getTeam()->getTeamTargetObject(); @@ -4328,7 +4328,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { // make sure it's time to check again. if (now < m_nextMoodCheckTime) - return NULL; + return nullptr; Int checkRate = d->m_moodAttackCheckRate; m_nextMoodCheckTime = now + checkRate; @@ -4344,7 +4344,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring Real rangeToFindWithin = TheAI->getAdjustedVisionRangeForObject(obj, AI_VISIONFACTOR_OWNERTYPE | AI_VISIONFACTOR_MOOD); if (rangeToFindWithin <= 0.0f) - return NULL; + return nullptr; //If we are contained by an object, add it's bounding radius so that large buildings can auto acquire everything in //outer ranges. Calculating this from the center is bad... although this code makes it possible to acquire a target @@ -4360,7 +4360,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { BodyModuleInterface *bmi = obj->getBodyModule(); if (!bmi) - return NULL; + return nullptr; return TheGameLogic->findObjectByID(bmi->getLastDamageInfo()->in.m_sourceID); } @@ -4409,7 +4409,7 @@ DEBUG_LOG(("GNMT frame %d: %s %08lx (con %s %08lx) uses range %f, flags %08lx, % container, rangeToFindWithin, flags, - getAttackInfo() != NULL && getAttackInfo() != TheScriptEngine->getDefaultAttackInfo() ? "ATTACKINFO," : "", + getAttackInfo() != nullptr && getAttackInfo() != TheScriptEngine->getDefaultAttackInfo() ? "ATTACKINFO," : "", newVictim ? newVictim->getTemplate()->getName().str() : "", newVictim )); @@ -4438,7 +4438,7 @@ Bool AIUpdateInterface::hasNationalism() const { ///@todo Find a better way to represent nationalism without hard coding here (CBD) static const UpgradeTemplate *nationalismTemplate = TheUpgradeCenter->findUpgrade( "Upgrade_Nationalism" ); - if (nationalismTemplate != NULL) + if (nationalismTemplate != nullptr) { return player->hasUpgradeComplete( nationalismTemplate ); } @@ -4454,7 +4454,7 @@ Bool AIUpdateInterface::hasFanaticism() const { ///@todo Find a better way to represent fanaticism without hard coding here (MAL) static const UpgradeTemplate *fanaticismTemplate = TheUpgradeCenter->findUpgrade( "Upgrade_Fanaticism" ); - if (fanaticismTemplate != NULL) + if (fanaticismTemplate != nullptr) { return player->hasUpgradeComplete( fanaticismTemplate ); } @@ -4879,7 +4879,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) } xfer->xferBool(&m_waitingForPath); - Bool gotPath = (m_path != NULL); + Bool gotPath = (m_path != nullptr); xfer->xferBool(&gotPath); if (xfer->getXferMode() == XFER_LOAD) { if (gotPath) { @@ -4958,7 +4958,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) // xferSelfAndCurLocoPtr() to continue to require a pristine, // empty set. (srj) m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; } m_locomotorSet.xferSelfAndCurLocoPtr(xfer, &m_curLocomotor); xfer->xferUser(&m_curLocomotorSet, sizeof(m_curLocomotorSet)); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp index 214cb16d0c6..6d703fcb3bf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp @@ -159,7 +159,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( !member || member->isEffectivelyDead() || ai->getLastCommandSource() != CMD_FROM_AI ) { //Member is toast -- so remove him from our list! @@ -264,7 +264,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) Object *designatedTarget = TheGameLogic->findObjectByID( m_designatedTarget ); if( designatedTarget && designatedTarget->isEffectivelyDead() ) { - designatedTarget = NULL; + designatedTarget = nullptr; } if( designatedTarget ) { @@ -272,7 +272,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { @@ -439,7 +439,7 @@ void AssaultTransportAIUpdate::retrieveMembers() for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { Bool contained = member->isContained(); @@ -459,7 +459,7 @@ void AssaultTransportAIUpdate::giveFinalOrders() for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { Object *designatedTarget = TheGameLogic->findObjectByID( m_designatedTarget ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index cf48a89f970..1e59de9261a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -89,7 +89,7 @@ static Real calcDistSqr(const Coord3D& a, const Coord3D& b) //------------------------------------------------------------------------------------------------- static Object* getPotentialRappeller(Object* obj) { - const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -101,7 +101,7 @@ static Object* getPotentialRappeller(Object* obj) } } } - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -362,9 +362,9 @@ class ChinookCombatDropState : public State { Object* rappeller = TheGameLogic->findObjectByID(*oit); #if RETAIL_COMPATIBLE_CRC - if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) + if (rappeller == nullptr || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) #else - if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) + if (rappeller == nullptr || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) #endif { oit = it->rappellerIDs.erase(oit); @@ -379,10 +379,10 @@ class ChinookCombatDropState : public State static void initRopeParms(Drawable* rope, Real length, Real width, const RGBColor& color, Real wobbleLen, Real wobbleAmp, Real wobbleRate) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->initRopeParms(length, width, color, wobbleLen, wobbleAmp, wobbleRate); } @@ -391,10 +391,10 @@ class ChinookCombatDropState : public State static void setRopeCurLen(Drawable* rope, Real length) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->setRopeCurLen(length); } @@ -403,10 +403,10 @@ class ChinookCombatDropState : public State static void setRopeSpeed(Drawable* rope, Real curSpeed, Real maxSpeed, Real accel) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->setRopeSpeed(curSpeed, maxSpeed, accel); } @@ -460,7 +460,7 @@ class ChinookCombatDropState : public State xfer->xferSTLObjectIDList(&info.rappellerIDs); if (xfer->getXferMode() == XFER_LOAD) { - info.ropeDrawable = NULL; // filled in via loadPostProcess + info.ropeDrawable = nullptr; // filled in via loadPostProcess m_ropes[i] = info; } } @@ -485,7 +485,7 @@ class ChinookCombatDropState : public State { Object* obj = getMachineOwner(); Drawable* draw = obj->getDrawable(); - if (draw == NULL) + if (draw == nullptr) return STATE_FAILURE; ChinookAIUpdate* ai = (ChinookAIUpdate*)obj->getAIUpdateInterface(); @@ -505,8 +505,8 @@ class ChinookCombatDropState : public State Coord3D ropePos[MAX_BONES]; Matrix3D dropMtx[MAX_BONES]; - Int ropeCount = draw->getPristineBonePositions("RopeStart", 1, ropePos, NULL, MAX_BONES); - Int dropCount = draw->getPristineBonePositions("RopeEnd", 1, NULL, dropMtx, MAX_BONES); + Int ropeCount = draw->getPristineBonePositions("RopeStart", 1, ropePos, nullptr, MAX_BONES); + Int dropCount = draw->getPristineBonePositions("RopeEnd", 1, nullptr, dropMtx, MAX_BONES); Int numRopes = d->m_numRopes; if (numRopes > ropeCount) numRopes = ropeCount; @@ -519,12 +519,12 @@ class ChinookCombatDropState : public State { RopeInfo info; - obj->convertBonePosToWorldPos( NULL, &dropMtx[i], NULL, &info.dropStartMtx ); + obj->convertBonePosToWorldPos( nullptr, &dropMtx[i], nullptr, &info.dropStartMtx ); - info.ropeDrawable = ropeTmpl ? TheThingFactory->newDrawable(ropeTmpl) : NULL; + info.ropeDrawable = ropeTmpl ? TheThingFactory->newDrawable(ropeTmpl) : nullptr; if (info.ropeDrawable) { - obj->convertBonePosToWorldPos( &ropePos[i], NULL, &ropePos[i], NULL ); + obj->convertBonePosToWorldPos( &ropePos[i], nullptr, &ropePos[i], nullptr ); info.ropeDrawable->setPosition(&ropePos[i]); info.ropeSpeed = 0.0f; info.ropeLen = 1.0f; @@ -585,7 +585,7 @@ class ChinookCombatDropState : public State if (now >= it->nextDropTime) { Object* rappeller = getPotentialRappeller(obj); - if (rappeller != NULL) + if (rappeller != nullptr) { #if RETAIL_COMPATIBLE_CRC ExitInterface *exitInterface = obj->getObjectExitInterface(); @@ -610,7 +610,7 @@ class ChinookCombatDropState : public State rappeller->setTransformMatrix(&it->dropStartMtx); - AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : NULL; + AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : nullptr; if (rappellerAI) { rappellerAI->setDesiredSpeed(d->m_rappelSpeed); @@ -629,7 +629,7 @@ class ChinookCombatDropState : public State } } - if (numRopesInUse == 0 && getPotentialRappeller(obj) == NULL) + if (numRopesInUse == 0 && getPotentialRappeller(obj) == nullptr) { // we're done! return STATE_SUCCESS; @@ -656,8 +656,8 @@ class ChinookCombatDropState : public State for (std::list::iterator oit = it->rappellerIDs.begin(); oit != it->rappellerIDs.end(); ++oit) { Object* rappeller = TheGameLogic->findObjectByID(*oit); - AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : NULL; - if (rappellerAI != NULL) + AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : nullptr; + if (rappellerAI != nullptr) { rappellerAI->aiIdle(CMD_FROM_AI); } @@ -674,7 +674,7 @@ class ChinookCombatDropState : public State const Real initialSpeed = TheGlobalData->m_gravity * 30; // give it a little kick setRopeSpeed(m_ropes[i].ropeDrawable, initialSpeed, d->m_ropeDropSpeed, TheGlobalData->m_gravity); m_ropes[i].ropeDrawable->setExpirationDate(now + ROPE_EXPIRATION_TIME); - m_ropes[i].ropeDrawable = NULL; // we're done with it, so null it so we won't save it + m_ropes[i].ropeDrawable = nullptr; // we're done with it, so null it so we won't save it } } @@ -734,7 +734,7 @@ class ChinookMoveToBldgState : public AIMoveToState const Coord3D* destPos; Object* bldg = getMachineGoalObject(); - if (bldg != NULL && !bldg->isEffectivelyDead() && bldg->isKindOf(KINDOF_STRUCTURE)) + if (bldg != nullptr && !bldg->isEffectivelyDead() && bldg->isKindOf(KINDOF_STRUCTURE)) { destPos = bldg->getPosition(); m_newPreferredHeight = bldg->getGeometryInfo().getMaxHeightAbovePosition() + d->m_minDropHeight; @@ -900,13 +900,13 @@ ChinookAIUpdate::~ChinookAIUpdate() static ParkingPlaceBehaviorInterface* getPP(ObjectID id) { Object* airfield = TheGameLogic->findObjectByID( id ); - if (airfield == NULL || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_AIRFIELD)) - return NULL; + if (airfield == nullptr || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_AIRFIELD)) + return nullptr; - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) break; } @@ -920,7 +920,7 @@ void ChinookAIUpdate::setAirfieldForHealing(ObjectID id) if (m_airfieldForHealing != INVALID_ID && m_airfieldForHealing != id) { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - if (pp != NULL) + if (pp != nullptr) { pp->setHealee(getObject(), false); } @@ -1019,7 +1019,7 @@ UpdateSleepTime ChinookAIUpdate::update() const ContainModuleInterface* contain = getObject()->getContain(); const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); - if (pp != NULL) + if (pp != nullptr) { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC @@ -1031,7 +1031,7 @@ UpdateSleepTime ChinookAIUpdate::update() { // we're completely healed, so take off again pp->setHealee(getObject(), false); - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); } else { @@ -1058,11 +1058,11 @@ UpdateSleepTime ChinookAIUpdate::update() } else if (waitingToEnterOrExit && m_flightStatus != CHINOOK_LANDED) { - setMyState(LANDING, NULL, NULL, CMD_FROM_AI); + setMyState(LANDING, nullptr, nullptr, CMD_FROM_AI); } else if (!waitingToEnterOrExit && m_flightStatus == CHINOOK_LANDED && m_airfieldForHealing == INVALID_ID) { - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); } } } @@ -1103,7 +1103,7 @@ void ChinookAIUpdate::privateGetRepaired( Object *repairDepot, CommandSourceType if (ThePartitionManager->findPositionAround(&pos, &options, &tmp)) pos = tmp; - setMyState(MOVE_TO_AND_LAND, NULL, &pos, cmdSource); + setMyState(MOVE_TO_AND_LAND, nullptr, &pos, cmdSource); } @@ -1115,12 +1115,12 @@ void ChinookAIUpdate::privateCombatDrop( Object* target, const Coord3D& pos, Com // when there is a target present, we must verify that we can logically do the action when // we get commands from players (we'll assume AI knows what its doing) // - if( target != NULL && cmdSource == CMD_FROM_PLAYER && + if( target != nullptr && cmdSource == CMD_FROM_PLAYER && TheActionManager->canEnterObject( getObject(), target, cmdSource, COMBATDROP_INTO ) == FALSE ) return; Coord3D localPos = pos; - if (target == NULL) + if (target == nullptr) { // if target is null, we are dropping at a pos, not into a bldg. // in this case, ensure there is no structure at the pos... this can happen @@ -1188,7 +1188,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } else @@ -1196,7 +1196,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) // do this INSTEAD of the standard stuff setMyState( (parms->m_cmd == AICMD_MOVE_TO_POSITION_AND_EVACUATE) ? MOVE_TO_AND_EVAC : MOVE_TO_AND_EVAC_AND_EXIT, - NULL, &parms->m_pos, CMD_FROM_AI); + nullptr, &parms->m_pos, CMD_FROM_AI); passItThru = false; } } @@ -1211,7 +1211,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(LANDING, NULL, NULL, CMD_FROM_AI); + setMyState(LANDING, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } } @@ -1225,7 +1225,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index a8c7c8876ca..29f62d3fa3e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -56,41 +56,41 @@ const FieldParse* DeliverPayloadData::getFieldParse() static const FieldParse dataFieldParse[] = { - { "DeliveryDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_distToTarget) }, - { "PreOpenDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_preOpenDistance) }, - { "MaxAttempts", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_maxAttempts) }, + { "DeliveryDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_distToTarget) }, + { "PreOpenDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_preOpenDistance) }, + { "MaxAttempts", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_maxAttempts) }, //Drop information - { "DropDelay", INI::parseDurationUnsignedInt,NULL, offsetof( DeliverPayloadData, m_dropDelay ) }, - { "DropOffset", INI::parseCoord3D, NULL, offsetof( DeliverPayloadData, m_dropOffset ) }, - { "DropVariance", INI::parseCoord3D, NULL, offsetof( DeliverPayloadData, m_dropVariance ) }, - { "InheritTransportVelocity", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_inheritTransportVelocity ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal,NULL, offsetof( DeliverPayloadData, m_exitPitchRate ) }, - { "ParachuteDirectly", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_isParachuteDirectly) }, + { "DropDelay", INI::parseDurationUnsignedInt,nullptr, offsetof( DeliverPayloadData, m_dropDelay ) }, + { "DropOffset", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadData, m_dropOffset ) }, + { "DropVariance", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadData, m_dropVariance ) }, + { "InheritTransportVelocity", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_inheritTransportVelocity ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal,nullptr, offsetof( DeliverPayloadData, m_exitPitchRate ) }, + { "ParachuteDirectly", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_isParachuteDirectly) }, //Visible payload information (payload assumed to be show visibly and it's created only when dropped) - { "VisibleItemsDroppedPerInterval", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_visibleItemsDroppedPerInterval ) }, - { "VisibleDropBoneBaseName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visibleDropBoneName ) }, - { "VisibleSubObjectBaseName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visibleSubObjectName ) }, - { "VisibleNumBones", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_visibleNumBones ) }, - { "VisiblePayloadTemplateName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visiblePayloadTemplateName ) }, - { "VisiblePayloadWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( DeliverPayloadData, m_visiblePayloadWeaponTemplate ) }, - { "SelfDestructObject", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_selfDestructObject ) }, + { "VisibleItemsDroppedPerInterval", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_visibleItemsDroppedPerInterval ) }, + { "VisibleDropBoneBaseName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visibleDropBoneName ) }, + { "VisibleSubObjectBaseName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visibleSubObjectName ) }, + { "VisibleNumBones", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_visibleNumBones ) }, + { "VisiblePayloadTemplateName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visiblePayloadTemplateName ) }, + { "VisiblePayloadWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( DeliverPayloadData, m_visiblePayloadWeaponTemplate ) }, + { "SelfDestructObject", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_selfDestructObject ) }, //Weapon based payload - { "FireWeapon", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_fireWeapon ) }, + { "FireWeapon", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_fireWeapon ) }, //Specify an additional weaponslot to be fired while strafing - { "DiveStartDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_diveStartDistance ) }, - { "DiveEndDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_diveEndDistance ) }, + { "DiveStartDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_diveStartDistance ) }, + { "DiveEndDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_diveEndDistance ) }, { "StrafingWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DeliverPayloadData, m_strafingWeaponSlot ) }, - { "StrafeWeaponFX", INI::parseFXList, NULL, offsetof( DeliverPayloadData, m_strafeFX ) }, - { "StrafeLength", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_strafeLength ) }, + { "StrafeWeaponFX", INI::parseFXList, nullptr, offsetof( DeliverPayloadData, m_strafeFX ) }, + { "StrafeLength", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_strafeLength ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DeliverPayloadData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof(DeliverPayloadData, m_deliveryDecalRadius) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DeliverPayloadData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof(DeliverPayloadData, m_deliveryDecalRadius) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; return dataFieldParse; } @@ -109,7 +109,7 @@ AIStateMachine* DeliverPayloadAIUpdate::makeStateMachine() //------------------------------------------------------------------------------------------------- DeliverPayloadAIUpdate::DeliverPayloadAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdateInterface( thing, moduleData ) { - m_deliverPayloadStateMachine = NULL; + m_deliverPayloadStateMachine = nullptr; m_targetPos.zero(); m_moveToPos.zero(); m_visibleItemsDelivered = 0; @@ -247,7 +247,7 @@ void DeliverPayloadAIUpdate::deliverPayload( //**************************************************** deleteInstance(m_deliverPayloadStateMachine); - m_deliverPayloadStateMachine = NULL; + m_deliverPayloadStateMachine = nullptr; m_moveToPos = *moveToPos; m_targetPos = *targetPos; @@ -320,7 +320,7 @@ void DeliverPayloadAIUpdate::deliverPayloadViaModuleData( const Coord3D *moveToP const ThingTemplate* DeliverPayloadAIUpdate::getPutInContainerTemplateViaModuleData() const { AsciiString name = getDeliverPayloadAIUpdateModuleData()->m_putInContainerName; - return name.isEmpty() ? NULL : TheThingFactory->findTemplate( name ); + return name.isEmpty() ? nullptr : TheThingFactory->findTemplate( name ); } //------------------------------------------------------------------------------------------------- @@ -454,9 +454,9 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) xfer->xferReal(&data.m_deliveryDecalRadius); *((DeliverPayloadData*)&m_data) = data; - Bool hasStateMachine = m_deliverPayloadStateMachine!=NULL; + Bool hasStateMachine = m_deliverPayloadStateMachine!=nullptr; xfer->xferBool(&hasStateMachine); - if (hasStateMachine && m_deliverPayloadStateMachine==NULL) + if (hasStateMachine && m_deliverPayloadStateMachine==nullptr) { m_deliverPayloadStateMachine = newInstance(DeliverPayloadStateMachine)( getObject() ); } @@ -499,8 +499,8 @@ DeliverPayloadStateMachine::DeliverPayloadStateMachine( Object *owner ) : StateM static const StateConditionInfo considerConditions[] = { - StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -680,8 +680,8 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often if (!ai->isCloseEnoughToTarget()) return STATE_FAILURE; - const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : NULL; - if( (!items || items->empty()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) + const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : nullptr; + if( (!items || !items->size()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) { //We are out of payload to drop AND our visible payload is empty. It's possible for deliverers to //have one or the other or even both. @@ -707,7 +707,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often AIUpdateInterface* itemAI = item->getAIUpdateInterface(); if (itemAI) { - itemAI->aiExit(NULL, CMD_FROM_AI); + itemAI->aiExit(nullptr, CMD_FROM_AI); } Coord3D pos = *item->getPosition(); @@ -785,9 +785,9 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often Coord3D pos; AsciiString bone; bone.format( "%s%02d", ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1 ); - if( draw->getPristineBonePositions( ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1, &pos, NULL, 1 ) > 0 ) + if( draw->getPristineBonePositions( ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1, &pos, nullptr, 1 ) > 0 ) { - draw->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + draw->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); payload->setPosition( &pos ); } else @@ -830,7 +830,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often break; } VeterancyLevel v = owner->getVeterancyLevel(); - pui->projectileFireAtObjectOrPosition( NULL, ai->getTargetPos(), weaponTemplate, weaponTemplate->getProjectileExhaust(v) ); + pui->projectileFireAtObjectOrPosition( nullptr, ai->getTargetPos(), weaponTemplate, weaponTemplate->getProjectileExhaust(v) ); projectileFired = true; //damageInfo.in.m_sourceID = pui->projectileGetLauncherID(); break; @@ -941,7 +941,7 @@ StateReturnType ConsiderNewApproachState::onEnter() // Increment local counter o // based on loco values, move off far enough so we can turn, then head back. (if we just say // "head back directly", the code will just keep turning in circles, not realizing that our // turning radius is too large for that ever to work.) - Real minTurnRadius = ai->calcMinTurnRadius(NULL); + Real minTurnRadius = ai->calcMinTurnRadius(nullptr); // how far is "far enough"? we must be at least 2*radius dist away from our target. // (we add a little fudge since we may not be able to travel our max speed while diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp index 4d7749f530c..2b29c968967 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp @@ -154,7 +154,7 @@ UpdateSleepTime DeployStyleAIUpdate::update( void ) Object *self = getObject(); Weapon *weapon = self->getCurrentWeapon(); Bool inRange = FALSE; - Object *designatedTarget = NULL; + Object *designatedTarget = nullptr; Bool isAttacking = FALSE; if( weapon ) @@ -171,7 +171,7 @@ UpdateSleepTime DeployStyleAIUpdate::update( void ) designatedTarget = TheGameLogic->findObjectByID( m_attackObjectID ); if( designatedTarget && designatedTarget->isEffectivelyDead() ) { - designatedTarget = NULL; + designatedTarget = nullptr; } if( designatedTarget ) { @@ -192,7 +192,7 @@ UpdateSleepTime DeployStyleAIUpdate::update( void ) } else { - //Get the current goal object (NULL if we have a turret). + //Get the current goal object (nullptr if we have a turret). designatedTarget = getGoalObject(); } if( !designatedTarget ) @@ -223,12 +223,12 @@ UpdateSleepTime DeployStyleAIUpdate::update( void ) } else { - designatedTarget = NULL; + designatedTarget = nullptr; } } else { - designatedTarget = NULL; + designatedTarget = nullptr; } } else if( designatedTarget ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 4ef21b66eb0..4484fe16fd8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -167,11 +167,11 @@ StateReturnType DozerActionPickActionPosState::update( void ) Object *goalObject = TheGameLogic->findObjectByID( dozerAI->getTaskTarget( m_task ) ); // if there is no goal, get out of this machine with a failure code (success is done in the action state ) - if( goalObject == NULL ) + if( goalObject == nullptr ) { // to be clean get rid of the goal object we set - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); // cancel our task dozerAI->cancelTask( m_task ); @@ -295,7 +295,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) Object *dozer = getMachineOwner(); // sanity - if( goalObject == NULL || dozer == NULL ) + if( goalObject == nullptr || dozer == nullptr ) return STATE_FAILURE; AIUpdateInterface *ai = dozer->getAIUpdateInterface(); @@ -308,7 +308,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) if ( dozerAI ) dozerAI->internalTaskComplete( m_task ); } - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -330,7 +330,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) if ( dozerAI ) dozerAI->internalTaskComplete( m_task ); } - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -478,7 +478,7 @@ StateReturnType DozerActionDoActionState::update( void ) // const UnsignedInt ACTION_TIME = LOGICFRAMES_PER_SECOND * 4 ; // frames to spend here in this state doing the action // check for object gone - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; if ( dozer->isDisabledByType( DISABLED_UNMANNED ) )// Yipes, I've been sniped! @@ -717,7 +717,7 @@ StateReturnType DozerActionDoActionState::update( void ) // remember who has been healing it, and will return false to everybody else //or if the goalObject is already receiving healing, I must stop, since my healing is getting rejected here dozerAI->internalTaskComplete( m_task ); - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -761,7 +761,7 @@ StateReturnType DozerActionDoActionState::update( void ) dozerAI->internalTaskComplete( m_task ); // to be clean get rid of the goal object we set - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); getMachineOwner()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it @@ -857,11 +857,11 @@ static Object *findObjectToRepair( Object *dozer ) { // sanity - if( dozer == NULL ) - return NULL; + if( dozer == nullptr ) + return nullptr; if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } const DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); @@ -869,7 +869,7 @@ static Object *findObjectToRepair( Object *dozer ) PartitionFilterAcceptByKindOf filter2( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ), KINDOFMASK_NONE ); PartitionFilterSameMapStatus filterMapStatus(dozer); - PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( dozer->getPosition(), dozerAI->getBoredRange(), FROM_CENTER_2D, @@ -877,7 +877,7 @@ static Object *findObjectToRepair( Object *dozer ) MemoryPoolObjectHolder hold( iter ); Object *obj; - Object *closestRepairTarget = NULL; + Object *closestRepairTarget = nullptr; Real closestRepairTargetDistSqr = 0.0f; for( obj = iter->first(); obj; obj = iter->next() ) { @@ -887,7 +887,7 @@ static Object *findObjectToRepair( Object *dozer ) continue; // target the closest valid repair target - if( closestRepairTarget == NULL ) + if( closestRepairTarget == nullptr ) { closestRepairTarget = obj; @@ -921,11 +921,11 @@ static Object *findMine( Object *dozer ) { // sanity - if( dozer == NULL ) - return NULL; + if( dozer == nullptr ) + return nullptr; if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } const DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); @@ -934,7 +934,7 @@ static Object *findMine( Object *dozer ) PartitionFilterRelationship filterTeam(dozer, PartitionFilterRelationship::ALLOW_ENEMIES | PartitionFilterRelationship::ALLOW_NEUTRAL); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, dozer, CMD_FROM_DOZER); PartitionFilterSameMapStatus filterMapStatus(dozer); - PartitionFilter *filters[] = { &filterTeam, &filterAttack, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAttack, &filterMapStatus, nullptr }; Object* mine = ThePartitionManager->getClosestObject(dozer, dozerAI->getBoredRange(), FROM_CENTER_2D, filters); return mine; @@ -1123,7 +1123,7 @@ StateReturnType DozerPrimaryIdleState::update( void ) } else { getMachineOwner()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it Object *mine = findMine(dozer); - if (mine!=NULL) { + if (mine!=nullptr) { ai->aiAttackObject( mine, 1, CMD_FROM_DOZER); } } @@ -1271,10 +1271,10 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi { static const StateConditionInfo idleConditions[] = { - StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, NULL), - StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, NULL), - StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, nullptr), + StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, nullptr), + StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -1418,10 +1418,10 @@ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RepairHealthPercentPerSecond", INI::parsePercentToReal, NULL, offsetof( DozerAIUpdateModuleData, m_repairHealthPercentPerSecond ) }, - { "BoredTime", INI::parseDurationReal, NULL, offsetof( DozerAIUpdateModuleData, m_boredTime ) }, - { "BoredRange", INI::parseReal, NULL, offsetof( DozerAIUpdateModuleData, m_boredRange ) }, - { 0, 0, 0, 0 } + { "RepairHealthPercentPerSecond", INI::parsePercentToReal, nullptr, offsetof( DozerAIUpdateModuleData, m_repairHealthPercentPerSecond ) }, + { "BoredTime", INI::parseDurationReal, nullptr, offsetof( DozerAIUpdateModuleData, m_boredTime ) }, + { "BoredRange", INI::parseReal, nullptr, offsetof( DozerAIUpdateModuleData, m_boredRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -1456,10 +1456,10 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value // - // initialize the dozer machine to NULL, we want to do this and create it during the update + // initialize the dozer machine to nullptr, we want to do this and create it during the update // implementation because at this point we don't have the object all setup // - m_dozerMachine = NULL; + m_dozerMachine = nullptr; createMachines(); } @@ -1489,7 +1489,7 @@ DozerAIUpdate::~DozerAIUpdate( void ) void DozerAIUpdate::createMachines( void ) { - if( m_dozerMachine == NULL ) + if( m_dozerMachine == nullptr ) { m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); @@ -1506,18 +1506,18 @@ void DozerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to create scaffolding if necessary @@ -1532,18 +1532,18 @@ void DozerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to end any scaffolding from repairing @@ -1599,7 +1599,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; #if !RETAIL_COMPATIBLE_CRC - else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + else if (currentTask == DOZER_TASK_BUILD && targetObject == nullptr) invalidTask = TRUE; #endif @@ -1638,8 +1638,8 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, createMachines(); // sanity - if( what == NULL || pos == NULL || owningPlayer == NULL ) - return NULL; + if( what == nullptr || pos == nullptr || owningPlayer == nullptr ) + return nullptr; // sanity DEBUG_ASSERTCRASH( getObject()->getControllingPlayer() == owningPlayer, @@ -1662,7 +1662,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, // make sure the player is capable of building this if( TheBuildAssistant->canMakeUnit( getObject(), what ) != CANMAKE_OK) - return NULL; + return nullptr; // validate the the position to build at is valid if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, @@ -1670,8 +1670,8 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } @@ -1743,7 +1743,7 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; // if we're not repairing right now, we don't have any accept restrictions @@ -1764,14 +1764,14 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) if( currentRepair->isKindOf( KINDOF_BRIDGE_TOWER ) && obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) { - BridgeTowerBehaviorInterface *currentTowerInterface = NULL; - BridgeTowerBehaviorInterface *newTowerInterface = NULL; + BridgeTowerBehaviorInterface *currentTowerInterface = nullptr; + BridgeTowerBehaviorInterface *newTowerInterface = nullptr; currentTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( currentRepair ); newTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( obj ); // sanity - if( currentTowerInterface == NULL || newTowerInterface == NULL ) + if( currentTowerInterface == nullptr || newTowerInterface == nullptr ) { DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); @@ -1854,7 +1854,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -1924,7 +1924,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm // have to repair at a tower. Real bestDistSqr = 1e10f; - Object* bestTower = NULL; + Object* bestTower = nullptr; for (Int i = 0; i < BRIDGE_MAX_TOWERS; ++i) { Object* tower = TheGameLogic->findObjectByID(bbi->getTowerID((BridgeTowerType)i)); @@ -1950,7 +1950,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm return bestTower; DEBUG_CRASH(("should not happen, no reachable tower found")); - return NULL; + return nullptr; } } @@ -1968,7 +1968,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) DEBUG_ASSERTCRASH( task >= 0 && task < DOZER_NUM_TASKS, ("Illegal dozer task '%d'", task) ); // sanity - if( target == NULL ) + if( target == nullptr ) return; // @@ -1988,7 +1988,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) Coord3D position; target = findGoodBuildOrRepairPositionAndTarget(me, target, position); - if (target == NULL) + if (target == nullptr) return; // could happen for some bridges // @@ -2160,7 +2160,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) ///@todo This would be correct except that we don't have idle crane animations and it is December. // Object* goalObject = TheGameLogic->findObjectByID(m_task[task].m_targetObjectID); -// if (goalObject != NULL) +// if (goalObject != nullptr) // { // goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); // } @@ -2176,7 +2176,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) getObject()->clearModelConditionState( MODELCONDITION_ACTIVELY_CONSTRUCTING ); // Bridges have been made indestructible, so the code below was meaningless. -- ML - // Object *obj = NULL; + // Object *obj = nullptr; // get object to reapir (if present) //obj = TheGameLogic->findObjectByID( m_task[ task ].m_targetObjectID ); // @@ -2247,7 +2247,7 @@ void DozerAIUpdate::onDelete( void ) for( i = 0; i < DOZER_NUM_TASKS; i++ ) { Object* goalObject = TheGameLogic->findObjectByID(m_task[i].m_targetObjectID); - if (goalObject != NULL) + if (goalObject != nullptr) { goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); } @@ -2292,18 +2292,18 @@ const Coord3D* DozerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint point // sanity if( task < 0 || task >= DOZER_NUM_TASKS ) - return NULL; + return nullptr; // sanity if( point < 0 || point >= DOZER_NUM_DOCK_POINTS ) - return NULL; + return nullptr; // if the point has been set (is valid) then return it if( m_dockPoint[ task ][ point ].valid ) return &m_dockPoint[ task ][ point ].location; // no valid point has been set for this dock point on this task - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index 82c34f3859b..b0654ec3f79 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp @@ -164,7 +164,7 @@ void HackInternetAIUpdate::hackInternet() { //if (m_hackInternetStateMachine) // deleteInstance(m_hackInternetStateMachine); - //m_hackInternetStateMachine = NULL; + //m_hackInternetStateMachine = nullptr; // must make the state machine AFTER initing the other stuff, since it may inquire of its values... //m_hackInternetStateMachine = newInstance(HackInternetStateMachine)( getObject() ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 1ce63cffc52..6e257287f31 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -91,7 +91,7 @@ static Bool isOutOfSpecialReloadAmmo(Object* jet) for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { Weapon* weapon = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (weapon == NULL || weapon->getReloadType() != RETURN_TO_BASE_TO_RELOAD) + if (weapon == nullptr || weapon->getReloadType() != RETURN_TO_BASE_TO_RELOAD) continue; ++specials; if (weapon->getStatus() == OUT_OF_AMMO) @@ -101,22 +101,22 @@ static Bool isOutOfSpecialReloadAmmo(Object* jet) } //------------------------------------------------------------------------------------------------- -static ParkingPlaceBehaviorInterface* getPP(ObjectID id, Object** airfieldPP = NULL) +static ParkingPlaceBehaviorInterface* getPP(ObjectID id, Object** airfieldPP = nullptr) { if (airfieldPP) - *airfieldPP = NULL; + *airfieldPP = nullptr; Object* airfield = TheGameLogic->findObjectByID( id ); - if (airfield == NULL || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_AIRFIELD) || airfield->testStatus(OBJECT_STATUS_SOLD)) - return NULL; + if (airfield == nullptr || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_AIRFIELD) || airfield->testStatus(OBJECT_STATUS_SOLD)) + return nullptr; if (airfieldPP) *airfieldPP = airfield; - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) break; } @@ -137,7 +137,7 @@ class PartitionFilterHasParkingPlace : public PartitionFilter virtual Bool allow(Object *objOther) { ParkingPlaceBehaviorInterface* pp = getPP(objOther->getID()); - if (pp != NULL && pp->reserveSpace(m_id, 0.0f, NULL)) + if (pp != nullptr && pp->reserveSpace(m_id, 0.0f, nullptr)) return true; return false; } @@ -163,7 +163,7 @@ static Object* findSuitableAirfield(Object* jet) filters[numFilters++] = &filterAlive; filters[numFilters++] = &filterPP; filters[numFilters++] = &filterMapStatus; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( jet, HUGE_DIST, FROM_CENTER_2D, filters ); } @@ -215,14 +215,14 @@ class JetAwaitingRunwayState : public State return STATE_FAILURE; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) { // no producer? just skip this step. return STATE_SUCCESS; } // gotta reserve a space in order to reserve a runway - if (!pp->reserveSpace(jet->getID(), jetAI->friend_getParkingOffset(), NULL)) + if (!pp->reserveSpace(jet->getID(), jetAI->friend_getParkingOffset(), nullptr)) { DEBUG_ASSERTCRASH(m_landing, ("hmm, this should never happen for taking-off things")); return STATE_FAILURE; @@ -448,7 +448,7 @@ class JetOrHeliTaxiState : public AIMoveOutOfTheWayState Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID(), &airfield); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step. ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -584,7 +584,7 @@ class JetTakeoffOrLandingState : public AIFollowPathState jetAI->ignoreObstacleID(jet->getProducerID()); ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -810,7 +810,7 @@ class HeliTakeoffOrLandingState : public State Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID(), &airfield); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step Coord3D landingApproach; @@ -1004,7 +1004,7 @@ class JetOrHeliParkOrientState : public State } ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_FAILURE; ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -1110,11 +1110,11 @@ class JetPauseBeforeTakeoffState : public AIFaceState for (Int i = 0; i < count; ++i) { Object* otherJet = TheGameLogic->findObjectByID(pp->getRunwayReservation(i)); - if (otherJet == NULL || otherJet == jet) + if (otherJet == nullptr || otherJet == jet) continue; AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) continue; if (ai->getCurrentStateID() == TAXI_TO_TAKEOFF) @@ -1135,7 +1135,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState const Object* thisJet = getMachineOwner(); ParkingPlaceBehaviorInterface* pp = getPP(getMachineOwner()->getProducerID()); - if (pp != NULL) + if (pp != nullptr) { const Int thisJetRunway = pp->getRunwayIndex(thisJet->getID()); const Int runwayCount = pp->getRunwayCount(); @@ -1146,11 +1146,11 @@ class JetPauseBeforeTakeoffState : public AIFaceState continue; Object* otherJet = TheGameLogic->findObjectByID(pp->getRunwayReservation(runway)); - if (otherJet == NULL) + if (otherJet == nullptr) continue; AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) continue; if (ai->getCurrentStateID() != TAXI_TO_TAKEOFF) @@ -1159,7 +1159,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState return otherJet; } } - return NULL; + return nullptr; } #endif @@ -1196,7 +1196,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState #endif ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step. ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -1398,7 +1398,7 @@ class JetOrHeliReloadAmmoState : public State for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { const Weapon* w = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; Int remaining = w->getRemainingAmmo(); @@ -1428,7 +1428,7 @@ class JetOrHeliReloadAmmoState : public State for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { Weapon* w = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; if (now >= m_reloadDoneFrame) @@ -1474,13 +1474,13 @@ class JetOrHeliReturnForLandingState : public AIInternalMoveToState JetAIUpdate* jetAI = (JetAIUpdate*)jet->getAIUpdateInterface(); ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) { // nuke the producer id, since it's dead - jet->setProducer(NULL); + jet->setProducer(nullptr); Object* airfield = findSuitableAirfield( jet ); - pp = airfield ? getPP(airfield->getID()) : NULL; + pp = airfield ? getPP(airfield->getID()) : nullptr; if (airfield && pp) { jet->setProducer(airfield); @@ -1615,26 +1615,26 @@ JetAIUpdateModuleData::JetAIUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OutOfAmmoDamagePerSecond", INI::parsePercentToReal, NULL, offsetof( JetAIUpdateModuleData, m_outOfAmmoDamagePerSecond ) }, - { "NeedsRunway", INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_needsRunway ) }, - { "KeepsParkingSpaceWhenAirborne",INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_keepsParkingSpaceWhenAirborne ) }, - { "TakeoffSpeedForMaxLift", INI::parsePercentToReal, NULL, offsetof( JetAIUpdateModuleData, m_takeoffSpeedForMaxLift ) }, - { "TakeoffPause", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_takeoffPause ) }, - { "MinHeight", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_minHeight ) }, - { "ParkingOffset", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_parkingOffset ) }, - { "SneakyOffsetWhenAttacking", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_sneakyOffsetWhenAttacking ) }, + { "OutOfAmmoDamagePerSecond", INI::parsePercentToReal, nullptr, offsetof( JetAIUpdateModuleData, m_outOfAmmoDamagePerSecond ) }, + { "NeedsRunway", INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_needsRunway ) }, + { "KeepsParkingSpaceWhenAirborne",INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_keepsParkingSpaceWhenAirborne ) }, + { "TakeoffSpeedForMaxLift", INI::parsePercentToReal, nullptr, offsetof( JetAIUpdateModuleData, m_takeoffSpeedForMaxLift ) }, + { "TakeoffPause", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_takeoffPause ) }, + { "MinHeight", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_minHeight ) }, + { "ParkingOffset", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_parkingOffset ) }, + { "SneakyOffsetWhenAttacking", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_sneakyOffsetWhenAttacking ) }, { "AttackLocomotorType", INI::parseIndexList, TheLocomotorSetNames, offsetof( JetAIUpdateModuleData, m_attackingLoco ) }, - { "AttackLocomotorPersistTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_attackLocoPersistTime ) }, - { "AttackersMissPersistTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_attackersMissPersistTime ) }, + { "AttackLocomotorPersistTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_attackLocoPersistTime ) }, + { "AttackersMissPersistTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_attackersMissPersistTime ) }, { "ReturnForAmmoLocomotorType", INI::parseIndexList, TheLocomotorSetNames, offsetof( JetAIUpdateModuleData, m_returningLoco ) }, - { "LockonTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_lockonTime ) }, - { "LockonCursor", INI::parseAsciiString, NULL, offsetof( JetAIUpdateModuleData, m_lockonCursor ) }, - { "LockonInitialDist", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonInitialDist ) }, - { "LockonFreq", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonFreq ) }, - { "LockonAngleSpin", INI::parseAngleReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonAngleSpin ) }, - { "LockonBlinky", INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_lockonBlinky ) }, - { "ReturnToBaseIdleTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_returnToBaseIdleTime ) }, - { 0, 0, 0, 0 } + { "LockonTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_lockonTime ) }, + { "LockonCursor", INI::parseAsciiString, nullptr, offsetof( JetAIUpdateModuleData, m_lockonCursor ) }, + { "LockonInitialDist", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonInitialDist ) }, + { "LockonFreq", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonFreq ) }, + { "LockonAngleSpin", INI::parseAngleReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonAngleSpin ) }, + { "LockonBlinky", INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_lockonBlinky ) }, + { "ReturnToBaseIdleTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_returnToBaseIdleTime ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -1662,7 +1662,7 @@ JetAIUpdate::JetAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdat m_attackersMissExpireFrame = 0; m_untargetableExpireFrame = 0; m_returnToBaseFrame = 0; - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; m_landingPosForHelipadStuff.zero(); m_producerLocation.zero(); @@ -1675,7 +1675,7 @@ JetAIUpdate::~JetAIUpdate() if (m_lockonDrawable) { TheGameClient->destroyDrawable(m_lockonDrawable); - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; } } @@ -1715,7 +1715,7 @@ void JetAIUpdate::getProducerLocation() Object* jet = getObject(); Object* airfield = TheGameLogic->findObjectByID( jet->getProducerID() ); - if (airfield == NULL) + if (airfield == nullptr) m_producerLocation = *jet->getPosition(); else m_producerLocation = *airfield->getPosition(); @@ -1763,7 +1763,7 @@ UpdateSleepTime JetAIUpdate::update() // that jets (and ESPECIALLY comanches) are still getting healed at airfields. if (AIUpdateInterface::isIdle() || getStateMachine()->getCurrentStateID() == RELOAD_AMMO) { - if (pp != NULL) + if (pp != nullptr) { if (!getFlag(ALLOW_AIR_LOCO) && !getFlag(HAS_PENDING_COMMAND) && @@ -1822,7 +1822,7 @@ UpdateSleepTime JetAIUpdate::update() } else { - if (pp != NULL) + if (pp != nullptr) { pp->setHealee(getObject(), false); } @@ -1840,7 +1840,7 @@ UpdateSleepTime JetAIUpdate::update() Real minHeight = friend_getMinHeight(); Drawable* draw = jet->getDrawable(); - if (draw != NULL) + if (draw != nullptr) { StateID id = getStateMachine()->getCurrentStateID(); Bool needToCheckMinHeight = (id >= JETAISTATETYPE_FIRST && id <= JETAISTATETYPE_LAST) || @@ -1857,12 +1857,12 @@ UpdateSleepTime JetAIUpdate::update() } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } @@ -2007,7 +2007,7 @@ void JetAIUpdate::pruneDeadTargeters() { for (std::list::iterator it = m_targetedBy.begin(); it != m_targetedBy.end(); /* empty */ ) { - if (TheGameLogic->findObjectByID(*it) == NULL) + if (TheGameLogic->findObjectByID(*it) == nullptr) { it = m_targetedBy.erase(it); } @@ -2028,7 +2028,7 @@ void JetAIUpdate::positionLockon() if (m_untargetableExpireFrame == 0) { TheGameClient->destroyDrawable(m_lockonDrawable); - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; return; } @@ -2085,7 +2085,7 @@ void JetAIUpdate::buildLockonDrawableIfNecessary() return; const JetAIUpdateModuleData* d = getJetAIUpdateModuleData(); - if (d->m_lockonCursor.isNotEmpty() && m_lockonDrawable == NULL) + if (d->m_lockonCursor.isNotEmpty() && m_lockonDrawable == nullptr) { const ThingTemplate* tt = TheThingFactory->findTemplate(d->m_lockonCursor); if (tt) @@ -2215,15 +2215,15 @@ void JetAIUpdate::doLandingCommand(Object *airfield, CommandSourceType cmdSource for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp == NULL) + if (pp == nullptr) continue; if (getObject()->isKindOf(KINDOF_PRODUCED_AT_HELIPAD) || - pp->reserveSpace(getObject()->getID(), friend_getParkingOffset(), NULL)) + pp->reserveSpace(getObject()->getID(), friend_getParkingOffset(), nullptr)) { // if we had a space at another airfield, release it ParkingPlaceBehaviorInterface* oldPP = getPP(getObject()->getProducerID()); - if (oldPP != NULL && oldPP != pp) + if (oldPP != nullptr && oldPP != pp) { oldPP->releaseSpace(getObject()->getID()); } @@ -2286,11 +2286,11 @@ Bool JetAIUpdate::isParkedAt(const Object* obj) const { if (!getFlag(ALLOW_AIR_LOCO) && !getObject()->isKindOf(KINDOF_PRODUCED_AT_HELIPAD) && - obj != NULL) + obj != nullptr) { Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(getObject()->getProducerID(), &airfield); - if (pp != NULL && airfield != NULL && airfield == obj) + if (pp != nullptr && airfield != nullptr && airfield == obj) { return true; } @@ -2450,7 +2450,7 @@ void JetAIUpdate::xfer( Xfer *xfer ) drawName = m_lockonDrawable->getTemplate()->getName(); } xfer->xferAsciiString(&drawName); - if (drawName.isNotEmpty() && m_lockonDrawable==NULL) + if (drawName.isNotEmpty() && m_lockonDrawable==nullptr) { const ThingTemplate* tt = TheThingFactory->findTemplate(drawName); if (tt) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 1b42513fc2a..862bc0ac6cd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -66,11 +66,11 @@ MissileAIUpdateModuleData::MissileAIUpdateModuleData() m_initialVel = 0; m_initialDist = 0.0f; m_diveDistance = 0.0f; - m_ignitionFX = NULL; + m_ignitionFX = nullptr; m_useWeaponSpeed = false; m_detonateOnNoFuel = FALSE; m_garrisonHitKillCount = 0; - m_garrisonHitKillFX = NULL; + m_garrisonHitKillFX = nullptr; m_lockDistance = 75.0f; } @@ -81,22 +81,22 @@ void MissileAIUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TryToFollowTarget", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_tryToFollowTarget ) }, - { "FuelLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_fuelLifetime ) }, - { "IgnitionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_ignitionDelay ) }, - { "InitialVelocity", INI::parseVelocityReal, NULL, offsetof( MissileAIUpdateModuleData, m_initialVel) }, - { "DistanceToTravelBeforeTurning", INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_initialDist ) }, - { "DistanceToTargetBeforeDiving", INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_diveDistance ) }, - { "DistanceToTargetForLock",INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_lockDistance ) }, - { "IgnitionFX", INI::parseFXList, NULL, offsetof( MissileAIUpdateModuleData, m_ignitionFX ) }, - { "UseWeaponSpeed", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_useWeaponSpeed ) }, - { "DetonateOnNoFuel", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_detonateOnNoFuel ) }, - - { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindof ) }, - { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindofNot ) }, - { "GarrisonHitKillCount", INI::parseUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillCount ) }, - { "GarrisonHitKillFX", INI::parseFXList, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillFX ) }, - { 0, 0, 0, 0 } + { "TryToFollowTarget", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_tryToFollowTarget ) }, + { "FuelLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_fuelLifetime ) }, + { "IgnitionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_ignitionDelay ) }, + { "InitialVelocity", INI::parseVelocityReal, nullptr, offsetof( MissileAIUpdateModuleData, m_initialVel) }, + { "DistanceToTravelBeforeTurning", INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_initialDist ) }, + { "DistanceToTargetBeforeDiving", INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_diveDistance ) }, + { "DistanceToTargetForLock",INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_lockDistance ) }, + { "IgnitionFX", INI::parseFXList, nullptr, offsetof( MissileAIUpdateModuleData, m_ignitionFX ) }, + { "UseWeaponSpeed", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_useWeaponSpeed ) }, + { "DetonateOnNoFuel", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_detonateOnNoFuel ) }, + + { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindof ) }, + { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindofNot ) }, + { "GarrisonHitKillCount", INI::parseUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillCount ) }, + { "GarrisonHitKillFX", INI::parseFXList, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillFX ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -121,8 +121,8 @@ MissileAIUpdate::MissileAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_noTurnDistLeft = d->m_initialDist; m_prevPos = *getObject()->getPosition(); m_maxAccel = BIGNUM; - m_detonationWeaponTmpl = NULL; - m_exhaustSysTmpl = NULL; + m_detonationWeaponTmpl = nullptr; + m_exhaustSysTmpl = nullptr; m_isTrackingTarget = FALSE; m_exhaustID = INVALID_PARTICLE_SYSTEM_ID; m_extraBonusFlags = 0; @@ -294,7 +294,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) if (projectileIsArmed() == false) return true; - if (other==NULL) { + if (other==nullptr) { // we hit the ground. Check to see if we hit something unexpected. Coord3D goal = *getGoalPosition(); Coord3D pos = *obj->getPosition(); @@ -311,7 +311,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) } } - if (other != NULL) + if (other != nullptr) { Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); @@ -350,7 +350,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) if (numKilled > 0) { // note, fx is played at center of building, not at grenade's location - FXList::doFXObj(d->m_garrisonHitKillFX, other, NULL); + FXList::doFXObj(d->m_garrisonHitKillFX, other, nullptr); // don't do the normal explosion; just destroy ourselves & return TheGameLogic->destroyObject(obj); @@ -449,7 +449,7 @@ void MissileAIUpdate::doIgnitionState() } FXList::doFXObj(d->m_ignitionFX, getObject()); - if (m_exhaustSysTmpl != NULL) + if (m_exhaustSysTmpl != nullptr) { m_exhaustID = TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject()); } @@ -496,7 +496,7 @@ void MissileAIUpdate::doAttackState(Bool turnOK) { Real lockDistanceSquared = d->m_lockDistance; Real distanceToTargetSquared; - if (m_isTrackingTarget && (getGoalObject() != NULL)) { + if (m_isTrackingTarget && (getGoalObject() != nullptr)) { distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalObject(), FROM_CENTER_2D); } else { distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalPosition(), FROM_CENTER_2D ); @@ -538,7 +538,7 @@ void MissileAIUpdate::doAttackState(Bool turnOK) // If I was fired at a flyer and have lost target (most likely they died), then I need to do something better // than cloverleaf around their last spot. - if( m_isTrackingTarget && (getGoalObject() == NULL) ) + if( m_isTrackingTarget && (getGoalObject() == nullptr) ) airborneTargetGone(); } @@ -573,7 +573,7 @@ void MissileAIUpdate::doKillState(void) } if (isIdle()) { // we finished the move - if (getGoalObject()!=NULL) { + if (getGoalObject()!=nullptr) { Locomotor* curLoco = getCurLocomotor(); Real closeEnough = 1.0f; if (curLoco) @@ -595,7 +595,7 @@ void MissileAIUpdate::doKillState(void) } // If I was fired at a flyer and have lost target (most likely they died), then I need to do something better // than cloverleaf around their last spot. - if( m_isTrackingTarget && (getGoalObject() == NULL) ) + if( m_isTrackingTarget && (getGoalObject() == nullptr) ) airborneTargetGone(); } @@ -774,7 +774,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) weaponName = m_detonationWeaponTmpl->getName(); } xfer->xferAsciiString(&weaponName); - if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == NULL) + if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == nullptr) { m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName); } @@ -785,7 +785,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) exhaustName = m_exhaustSysTmpl->getName(); } xfer->xferAsciiString(&exhaustName); - if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == NULL) + if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == nullptr) { m_exhaustSysTmpl = TheParticleSystemManager->findTemplate(exhaustName); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index b809367e515..c57039d408a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -67,8 +67,8 @@ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BoredTime", INI::parseDurationUnsignedInt, NULL, offsetof( POWTruckAIUpdateModuleData, m_boredTimeInFrames ) }, - { "AtPrisonDistance", INI::parseReal, NULL, offsetof( POWTruckAIUpdateModuleData, m_hangAroundPrisonDistance ) }, + { "BoredTime", INI::parseDurationUnsignedInt, nullptr, offsetof( POWTruckAIUpdateModuleData, m_boredTimeInFrames ) }, + { "AtPrisonDistance", INI::parseReal, nullptr, offsetof( POWTruckAIUpdateModuleData, m_hangAroundPrisonDistance ) }, { 0, 0, 0, 0 } }; @@ -220,7 +220,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) // sanity, POW_TRUCK_TASK_COLLECTING_TARGET and POW_TRUCK_TASK_RETURNING_PRISONERS require taskObject parameters if( (task == POW_TRUCK_TASK_COLLECTING_TARGET || task == POW_TRUCK_TASK_RETURNING_PRISONERS) && - taskObject == NULL ) + taskObject == nullptr ) { DEBUG_CRASH(( "POWTruckAIUpdate::setTask - Illegal arguments" )); @@ -329,11 +329,11 @@ void POWTruckAIUpdate::privateReturnPrisoners( Object *prison, CommandSourceType setAIMode( AUTOMATIC ); // if no prison is provided, find one if possible - if( prison == NULL ) + if( prison == nullptr ) prison = findBestPrison(); // still no prison, nothing to do - if( prison == NULL ) + if( prison == nullptr ) return; // set us into the return prisoners "state" @@ -430,7 +430,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) if( contain->getContainCount() != 0 ) doReturnPrisoners(); else - doReturnToPrison( NULL ); + doReturnToPrison( nullptr ); } @@ -509,7 +509,7 @@ static void putContainedInPrison( Object *obj, void *userData ) PrisonerReturnData *returnData = (PrisonerReturnData *)userData; // sanity - DEBUG_ASSERTCRASH( returnData != NULL && returnData->source != NULL && returnData->dest != NULL, + DEBUG_ASSERTCRASH( returnData != nullptr && returnData->source != nullptr && returnData->dest != nullptr, ("putContainedInPrison: Invalid arguments") ); // take 'obj' out of the source @@ -541,7 +541,7 @@ void POWTruckAIUpdate::updateReturnPrisoners( void ) Object *prison = TheGameLogic->findObjectByID( m_prisonID ); // prison has gone away, do this all over again - if( prison == NULL ) + if( prison == nullptr ) { doReturnPrisoners(); @@ -575,7 +575,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) Object *prison = findBestPrison(); // if no prison is available, nothing to do - if( prison == NULL ) + if( prison == nullptr ) { setTask( POW_TRUCK_TASK_WAITING ); @@ -605,11 +605,11 @@ void POWTruckAIUpdate::doReturnToPrison( Object *prison ) setTask( POW_TRUCK_TASK_WAITING ); // find the closest prison if one was not provided - if( prison == NULL ) + if( prison == nullptr ) prison = findBestPrison(); // if no prison found forget it - if( prison == NULL ) + if( prison == nullptr ) return; // get our info @@ -634,7 +634,7 @@ Object *POWTruckAIUpdate::findBestPrison( void ) ObjectID prisonID = getObject()->getProducerID(); if( prisonID == INVALID_ID ) - return NULL; + return nullptr; // find prison object Object *prison = TheGameLogic->findObjectByID( prisonID ); @@ -652,8 +652,8 @@ Object *POWTruckAIUpdate::findBestTarget( void ) Player *player = us->getControllingPlayer(); // sanity - if( player == NULL ) - return NULL; + if( player == nullptr ) + return nullptr; // get our info const AIUpdateInterface *ai = us->getAIUpdateInterface(); @@ -663,7 +663,7 @@ Object *POWTruckAIUpdate::findBestTarget( void ) // scan all objects, there is no range Object *other; Real closestTargetDistSq = HUGE_DIST; - Object *closestTarget = NULL; + Object *closestTarget = nullptr; for( other = TheGameLogic->getFirstObject(); other; other = other->getNextObject() ) { @@ -680,7 +680,7 @@ Object *POWTruckAIUpdate::findBestTarget( void ) // is this target closer than the one we've found so far Real distSq = ThePartitionManager->getDistanceSquared( us, other, FROM_CENTER_2D ); - if( closestTarget == NULL || distSq < closestTargetDistSq ) + if( closestTarget == nullptr || distSq < closestTargetDistSq ) { // we must be able to pathfind to this target @@ -727,13 +727,13 @@ static void putPrisonersInPrison( Object *obj, void *userData ) Object *prison = prisonUnloadData->destPrison; // sanity - DEBUG_ASSERTCRASH( prison, ("putPrisonersInPrison: NULL user data") ); - DEBUG_ASSERTCRASH( obj->getContainedBy() != NULL, + DEBUG_ASSERTCRASH( prison, ("putPrisonersInPrison: null user data") ); + DEBUG_ASSERTCRASH( obj->getContainedBy() != nullptr, ("putPrisonersInPrison: Prisoner '%s' is not contained by anything, it should be contained by a POW truck", obj->getTemplate()->getName().str()) ); // extra super sanity, just so that we don't crash ... this is in the assert above - if( obj->getContainedBy() == NULL ) + if( obj->getContainedBy() == nullptr ) return; // take 'obj' out of the truck @@ -764,7 +764,7 @@ void POWTruckAIUpdate::unloadPrisonersToPrison( Object *prison ) Object *us = getObject(); // sanity - if( prison == NULL ) + if( prison == nullptr ) return; // get contain modules @@ -834,7 +834,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) Object *us = getObject(); // sanity - if( prisoner == NULL ) + if( prisoner == nullptr ) return; // validate that we can load this prisoner @@ -862,7 +862,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) // AIUpdateInterface *prisonerAI = prisoner->getAIUpdateInterface(); if( prisonerAI ) - prisonerAI->setSurrendered( NULL, FALSE ); + prisonerAI->setSurrendered( nullptr, FALSE ); // done adding prisoner, for automatic AI find another target, for manual just wait if( m_aiMode == AUTOMATIC ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp index f22256ff035..bf1a69f28c8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp @@ -55,8 +55,8 @@ void RailedTransportAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "PathPrefixName", INI::parseAsciiString, NULL, offsetof( RailedTransportAIUpdateModuleData, m_pathPrefixName ) }, - { 0, 0, 0, 0 } + { "PathPrefixName", INI::parseAsciiString, nullptr, offsetof( RailedTransportAIUpdateModuleData, m_pathPrefixName ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -135,7 +135,7 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) const Coord3D *ourPos = us->getPosition(); // select the path with the closest ending waypoint to our location - Waypoint *waypoint, *closestEndWaypoint = NULL; + Waypoint *waypoint, *closestEndWaypoint = nullptr; Int closestPath = INVALID_PATH; Real closestDist = 99999999.9f; for( Int i = 0; i < m_numPaths; ++i ) @@ -309,13 +309,13 @@ void RailedTransportAIUpdate::privateExecuteRailedTransport( CommandSourceType c // if we just call the method getReailedTransportDockUpdateInterface, it will execute // the method for *THIS AI UPDATE MODULE* which of course is not our dock update // - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = us->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; // if we've in the process of loading or unloading anything we can't do a transport sequence - if( rtdui == NULL || rtdui->isLoadingOrUnloading() ) + if( rtdui == nullptr || rtdui->isLoadingOrUnloading() ) return; // pick the next path @@ -345,13 +345,13 @@ void RailedTransportAIUpdate::privateEvacuate( Int exposeStealthUnits, CommandSo // if we just call the method getReailedTransportDockUpdateInterface, it will execute // the method for *THIS AI UPDATE MODULE* which of course is not our dock update // - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = us->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; // sanity - if( rtdui == NULL ) + if( rtdui == nullptr ) return; // can't unload when in transit diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index 05608fd5f5b..a4f8dce7872 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -135,7 +135,7 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_whistleSound.setObjectID( getObject()->getID() ) ; m_clicketyClackSound.setObjectID( getObject()->getID() ) ; - m_track = NULL; + m_track = nullptr; m_currentPointHandle = 0xfacade; m_waitAtStationTimer = 0; @@ -168,12 +168,12 @@ RailroadBehavior::~RailroadBehavior( void ) TheAudio->removeAudioEvent( m_runningSound.getPlayingHandle() );// no more chugchug when I'm dead - if( m_track != NULL ) + if( m_track != nullptr ) { if (m_track->releaseReference()) delete m_track; - m_track = NULL; + m_track = nullptr; } @@ -502,7 +502,7 @@ void RailroadBehavior::playImpactSound(Object *victim, const Coord3D *impactPosi void RailroadBehavior::loadTrackData( void ) { - if ( m_track != NULL ) + if ( m_track != nullptr ) return;// lets do this only once! @@ -516,7 +516,7 @@ void RailroadBehavior::loadTrackData( void ) // m_anchorWaypointID COULD HAVE BEEN RECORDED IN XFER, WHICH MEANS I LOADED MY TRACK DATA IN A PRIOR LIFE, // SO LETS JUST RE_INIT THE TRACK BASED ON THAT POINT, AUTOMAGICALLY - Waypoint *anchorWaypoint = NULL; + Waypoint *anchorWaypoint = nullptr; if ( m_anchorWaypointID == INVALID_WAYPOINT_ID ) { Waypoint *anyWaypoint = TheTerrainLogic->getFirstWaypoint(); @@ -556,7 +556,7 @@ void RailroadBehavior::loadTrackData( void ) m_track = NEW( TrainTrack );// this constructor inc's the refcount to 1 // From now until the next carriage is added, this track is writable using getWritablePointList(); - // This method will return NULL when refcount is 2 or more + // This method will return nullptr when refcount is 2 or more // getPointList returns the list as const to any caller // each carriage must increment the reference when this pointer is passed to it, // any subsequent carriage (destructor) will delete this memory here if it releases refcount to zero @@ -595,7 +595,7 @@ void RailroadBehavior::loadTrackData( void ) Waypoint *anotherWaypoint = scanner->getLink( 0 ); // if scanner's link is valid, we'll add it to the track. now - if ( anotherWaypoint != NULL ) + if ( anotherWaypoint != nullptr ) { //measure the track while we are at it @@ -610,7 +610,7 @@ void RailroadBehavior::loadTrackData( void ) trackPoint.m_distanceFromPrev = distFromTo; trackPoint.m_distanceFromFirst = m_track->m_length; trackPoint.m_isFirstPoint = FALSE; - trackPoint.m_isLastPoint = anotherWaypoint->getLink( 0 ) == NULL; + trackPoint.m_isLastPoint = anotherWaypoint->getLink( 0 ) == nullptr; trackPoint.m_isTunnelOrBridge = anotherWaypoint->getName().endsWith("Tunnel"); trackPoint.m_isStation = anotherWaypoint->getName().endsWith("Station"); trackPoint.m_isPingPong = scanner->getName().endsWith("PingPong"); @@ -870,7 +870,7 @@ class PartitionFilterIsValidCarriage : public PartitionFilter { // must exist! - if ( m_obj == NULL || objOther == NULL) + if ( m_obj == nullptr || objOther == nullptr) return FALSE; //must not be me! @@ -919,19 +919,19 @@ void RailroadBehavior::createCarriages( void ) PartitionFilterIsValidCarriage pfivc(self, md); - PartitionFilter *filters[] = { &pfivc, 0 }; + PartitionFilter *filters[] = { &pfivc, nullptr }; - Object* xferCarriage = NULL; - Object *closeCarriage = NULL; - Object *firstCarriage = NULL; + Object* xferCarriage = nullptr; + Object *closeCarriage = nullptr; + Object *firstCarriage = nullptr; if ( m_trailerID != INVALID_ID ) { xferCarriage = TheGameLogic->findObjectByID( m_trailerID ); } - if (xferCarriage != NULL) + if (xferCarriage != nullptr) closeCarriage = xferCarriage; else closeCarriage = ThePartitionManager->getClosestObject( &myHitchLoc, maxRadius, FROM_CENTER_2D, filters); @@ -1010,7 +1010,7 @@ void RailroadBehavior::hitchNewCarriagebyTemplate( ObjectID locoID, const Templa //Okay that's me, now for the next guy //--------------------------------------- - Object *newCarriage = NULL; + Object *newCarriage = nullptr; if ( iter != list.end() )// this test is bogus { @@ -1079,16 +1079,16 @@ void RailroadBehavior::hitchNewCarriagebyProximity( ObjectID locoID, TrainTrack myHitchLoc.add( & hitchOffset ); PartitionFilterIsValidCarriage pfivc(self, md); - PartitionFilter *filters[] = { &pfivc, 0 }; + PartitionFilter *filters[] = { &pfivc, nullptr }; - Object* xferCarriage = NULL; - Object *closeCarriage = NULL; + Object* xferCarriage = nullptr; + Object *closeCarriage = nullptr; if ( m_trailerID != INVALID_ID ) { xferCarriage = TheGameLogic->findObjectByID( m_trailerID ); } - if (xferCarriage != NULL) + if (xferCarriage != nullptr) closeCarriage = xferCarriage; else closeCarriage = ThePartitionManager->getClosestObject( &myHitchLoc, maxRadius, FROM_CENTER_2D, filters); @@ -1380,7 +1380,7 @@ void RailroadBehavior::FindPosByPathDistance( Coord3D *pos, const Real dist, con if (thisPoint && thisPoint->m_distanceFromFirst < actualDistance)// I am after this point, and { Coord3D thisPointPos = thisPoint->m_position; - const TrackPoint *nextPoint = NULL; + const TrackPoint *nextPoint = nullptr; // TheSuperHackers Mauller 02/04/2025 Prevent dereferencing of endpoint pointer which throws asserts during Debug if (pointIter != pointList->end()) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index 79afbb2b75c..80c142b8a86 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -68,7 +68,7 @@ AIStateMachine* SupplyTruckAIUpdate::makeStateMachine() //------------------------------------------------------------------------------------------------- SupplyTruckAIUpdate::SupplyTruckAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdateInterface( thing, moduleData ) { - m_supplyTruckStateMachine = NULL; + m_supplyTruckStateMachine = nullptr; m_preferredDock = INVALID_ID; m_numberBoxes = 0; m_forcePending = FALSE; @@ -359,9 +359,9 @@ TheInGameUI->DEBUG_addFloatingText("entering idle state", getMachineOwner()->get #endif Object *owner = getMachineOwner(); - if (owner != NULL) { + if (owner != nullptr) { AIUpdateInterface * ownerAI = owner->getAIUpdateInterface(); - if (ownerAI != NULL) { + if (ownerAI != nullptr) { // This is to get idle workers to always show up on the // "idle worker button." // Basically if you have a worker interface, and we are entering @@ -369,7 +369,7 @@ TheInGameUI->DEBUG_addFloatingText("entering idle state", getMachineOwner()->get // know so it can decide which idle state it wants us to actually // be in from its perspective. WorkerAIInterface *workerAI = ownerAI->getWorkerAIInterface(); - if (workerAI != NULL) { + if (workerAI != nullptr) { workerAI->exitingSupplyTruckState(); } } @@ -388,40 +388,40 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine { static const StateConditionInfo busyConditions[] = { - StateConditionInfo(ownerIdle, ST_IDLE, NULL), - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerIdle, ST_IDLE, nullptr), + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo idleConditions[] = { - StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), - StateConditionInfo(isForcedIntoWantingState, ST_WANTING, NULL), - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isForcedIntoBusyState, ST_BUSY, nullptr), + StateConditionInfo(isForcedIntoWantingState, ST_WANTING, nullptr), + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo wantingConditions[] = { - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo regroupingConditions[] = { - StateConditionInfo(ownerIdle, ST_IDLE, NULL), - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerIdle, ST_IDLE, nullptr), + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo dockingConditions[] = { - StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), - StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isForcedIntoBusyState, ST_BUSY, nullptr), + StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -548,7 +548,7 @@ TheInGameUI->DEBUG_addFloatingText("entering regrouping state", getMachineOwner( if( !ownerPlayer || !ownerAI ) return STATE_FAILURE; - ownerAI->ignoreObstacle( NULL ); + ownerAI->ignoreObstacle( nullptr ); SupplyTruckAIInterface *update = owner->getAIUpdateInterface()->getSupplyTruckAIInterface(); if( !update ) { @@ -561,7 +561,7 @@ TheInGameUI->DEBUG_addFloatingText("entering regrouping state", getMachineOwner( update->setForceWantingState( wanting ); - Object *destinationObject = NULL; + Object *destinationObject = nullptr; KindOfMaskType kindof; KindOfMaskType kindofnot; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index 00b494a802b..1fffd9bf8e1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -62,7 +62,7 @@ TransportAIUpdate::~TransportAIUpdate( void ) void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -106,7 +106,7 @@ void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -150,7 +150,7 @@ void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsTo void TransportAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 54a92e76664..bd67b782cd2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -85,10 +85,10 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : { // - // initialize the dozer machine to NULL, we want to do this and create it during the update + // initialize the dozer machine to nullptr, we want to do this and create it during the update // implementation because at this point we don't have the object all setup m_isRebuild = FALSE; - m_dozerMachine = NULL; + m_dozerMachine = nullptr; for( Int i = 0; i < DOZER_NUM_TASKS; i++ ) { m_task[ i ].m_targetObjectID = INVALID_ID; @@ -102,12 +102,12 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_currentTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value - m_supplyTruckStateMachine = NULL; + m_supplyTruckStateMachine = nullptr; m_numberBoxes = 0; m_forcePending = FALSE; m_forcedBusyPending = FALSE; - m_workerMachine = NULL; + m_workerMachine = nullptr; m_suppliesDepletedVoice = getWorkerAIUpdateModuleData()->m_suppliesDepletedVoice; @@ -172,17 +172,17 @@ Real WorkerAIUpdate::getBoredRange( void ) const void WorkerAIUpdate::createMachines( void ) { - if( m_workerMachine == NULL ) + if( m_workerMachine == nullptr ) { m_workerMachine = newInstance(WorkerStateMachine)( getObject() ); - if( m_dozerMachine == NULL ) + if( m_dozerMachine == nullptr ) { m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); m_dozerMachine->initDefaultState(); } - if( m_supplyTruckStateMachine == NULL ) + if( m_supplyTruckStateMachine == nullptr ) { m_supplyTruckStateMachine = newInstance(SupplyTruckStateMachine)( getObject() ); m_supplyTruckStateMachine->initDefaultState(); @@ -280,7 +280,7 @@ UpdateSleepTime WorkerAIUpdate::update( void ) TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; #if !RETAIL_COMPATIBLE_CRC - else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + else if (currentTask == DOZER_TASK_BUILD && targetObject == nullptr) invalidTask = TRUE; #endif @@ -337,8 +337,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, createMachines(); // sanity - if( what == NULL || pos == NULL || owningPlayer == NULL ) - return NULL; + if( what == nullptr || pos == nullptr || owningPlayer == nullptr ) + return nullptr; // sanity DEBUG_ASSERTCRASH( getObject()->getControllingPlayer() == owningPlayer, @@ -357,8 +357,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } else @@ -366,7 +366,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, // make sure the player is capable of building this if( TheBuildAssistant->canMakeUnit( getObject(), what ) != CANMAKE_OK ) - return NULL; + return nullptr; // validate the the position to build at is valid if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, @@ -374,8 +374,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } @@ -477,7 +477,7 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; // if we're not repairing right now, we don't have any accept restrictions @@ -498,14 +498,14 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) if( currentRepair->isKindOf( KINDOF_BRIDGE_TOWER ) && obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) { - BridgeTowerBehaviorInterface *currentTowerInterface = NULL; - BridgeTowerBehaviorInterface *newTowerInterface = NULL; + BridgeTowerBehaviorInterface *currentTowerInterface = nullptr; + BridgeTowerBehaviorInterface *newTowerInterface = nullptr; currentTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( currentRepair ); newTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( obj ); // sanity - if( currentTowerInterface == NULL || newTowerInterface == NULL ) + if( currentTowerInterface == nullptr || newTowerInterface == nullptr ) { DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); @@ -588,7 +588,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -610,7 +610,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) DEBUG_ASSERTCRASH( task >= 0 && task < DOZER_NUM_TASKS, ("Illegal dozer task '%d'", task) ); // sanity - if( target == NULL ) + if( target == nullptr ) return; m_preferredDock = INVALID_ID; // If we are dozing, we don't want any supply truck stuff going on. jba. @@ -632,7 +632,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) Coord3D position; target = DozerAIUpdate::findGoodBuildOrRepairPositionAndTarget(me, target, position); - if (target == NULL) + if (target == nullptr) return; // could happen for some bridges // @@ -819,7 +819,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) ///@todo This would be correct except that we don't have idle crane animations and it is December. // Object* goalObject = TheGameLogic->findObjectByID(m_task[task].m_targetObjectID); -// if (goalObject != NULL) +// if (goalObject != nullptr) // { // goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); // } @@ -830,7 +830,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: { - Object *obj = NULL; + Object *obj = nullptr; // the builder is no longer actively repairing something getObject()->clearModelConditionState( MODELCONDITION_ACTIVELY_CONSTRUCTING ); @@ -890,7 +890,7 @@ void WorkerAIUpdate::onDelete( void ) for( i = 0; i < DOZER_NUM_TASKS; i++ ) { Object* goalObject = TheGameLogic->findObjectByID(m_task[i].m_targetObjectID); - if (goalObject != NULL) + if (goalObject != nullptr) { goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); } @@ -927,18 +927,18 @@ const Coord3D* WorkerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint poin // sanity if( task < 0 || task >= DOZER_NUM_TASKS ) - return NULL; + return nullptr; // sanity if( point < 0 || point >= DOZER_NUM_DOCK_POINTS ) - return NULL; + return nullptr; // if the point has been set (is valid) then return it if( m_dockPoint[ task ][ point ].valid ) return &m_dockPoint[ task ][ point ].location; // no valid point has been set for this dock point on this task - return NULL; + return nullptr; } @@ -1171,14 +1171,14 @@ WorkerStateMachine::WorkerStateMachine( Object *owner ) : StateMachine( owner, " { static const StateConditionInfo asDozerConditions[] = { - StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo asTruckConditions[] = { - StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -1255,7 +1255,7 @@ Bool WorkerStateMachine::supplyTruckSubMachineReadyToLeave( State *thisState, vo // so there is no transition out on the way in. Active and Busy means it isn't doing // anything Supply related. - return !supplyTruckSubMachineWantsToEnter( thisState, NULL ) + return !supplyTruckSubMachineWantsToEnter( thisState, nullptr ) && update->isSupplyTruckBrainActiveAndBusy(); } @@ -1327,18 +1327,18 @@ void WorkerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to create scaffolding if necessary @@ -1353,18 +1353,18 @@ void WorkerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to end any scaffolding from repairing diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index 3670aeb4e90..8a58326da9b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -52,11 +52,11 @@ void AssistedTargetingUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AssistingClipSize", INI::parseInt, NULL, offsetof( AssistedTargetingUpdateModuleData, m_clipSize ) }, + { "AssistingClipSize", INI::parseInt, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_clipSize ) }, { "AssistingWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( AssistedTargetingUpdateModuleData, m_weaponSlot ) }, - { "LaserFromAssisted", INI::parseThingTemplate, NULL, offsetof( AssistedTargetingUpdateModuleData, m_laserFromAssisted ) }, - { "LaserToTarget", INI::parseThingTemplate, NULL, offsetof( AssistedTargetingUpdateModuleData, m_laserToTarget ) }, - { 0, 0, 0, 0 } + { "LaserFromAssisted", INI::parseThingTemplate, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_laserFromAssisted ) }, + { "LaserToTarget", INI::parseThingTemplate, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_laserToTarget ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp index 7637a09f748..9ea2f39891a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp @@ -67,11 +67,11 @@ AutoFindHealingUpdateModuleData::AutoFindHealingUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( AutoFindHealingUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_scanRange ) }, - { "NeverHeal", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_neverHeal ) }, - { "AlwaysHeal", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_alwaysHeal ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_scanRange ) }, + { "NeverHeal", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_neverHeal ) }, + { "AlwaysHeal", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_alwaysHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -117,7 +117,7 @@ UpdateSleepTime AutoFindHealingUpdate::update() m_nextScanFrames = data->m_scanFrames; AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) return UPDATE_SLEEP_NONE; + if (ai==nullptr) return UPDATE_SLEEP_NONE; // Check health. BodyModuleInterface *body = obj->getBodyModule(); @@ -152,7 +152,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() { const AutoFindHealingUpdateModuleData *data = getAutoFindHealingUpdateModuleData(); Object *me = getObject(); - Object *bestTarget = NULL; + Object *bestTarget = nullptr; Real closestDistSqr=0; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( me->getPosition(), data->m_scanRange, FROM_CENTER_2D ); @@ -167,7 +167,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() } Real fDistSqr = ThePartitionManager->getDistanceSquared( me, other, FROM_CENTER_2D ) ; - if (bestTarget==NULL) { + if (bestTarget==nullptr) { bestTarget = other; closestDistSqr = fDistSqr; continue; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp index 8e88437b830..3f49891481e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp @@ -56,7 +56,7 @@ void BaseRegenerateUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index 8647e010085..7d3d6f72ad7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -66,7 +66,7 @@ //------------------------------------------------------------------------------------------------- BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_bombardmentPlanAnimationFrames = 0; m_holdTheLinePlanAnimationFrames = 0; m_searchAndDestroyPlanAnimationFrames = 0; @@ -89,41 +89,41 @@ BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( BattlePlanUpdateModuleData, m_specialPowerTemplate ) }, - - { "BombardmentPlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentPlanAnimationFrames ) }, - { "HoldTheLinePlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePlanAnimationFrames ) }, - { "SearchAndDestroyPlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPlanAnimationFrames ) }, - { "TransitionIdleTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_transitionIdleFrames ) }, - - { "BombardmentPlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentUnpackName ) }, - { "BombardmentPlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentPackName ) }, - { "BombardmentMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentMessageLabel ) }, - { "BombardmentAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentAnnouncementName ) }, - { "SearchAndDestroyPlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyUnpackName ) }, - { "SearchAndDestroyPlanIdleLoopSoundName",INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyIdleName ) }, - { "SearchAndDestroyPlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPackName ) }, - { "SearchAndDestroyMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyMessageLabel ) }, - { "SearchAndDestroyAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyAnnouncementName ) }, - { "HoldTheLinePlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineUnpackName ) }, - { "HoldTheLinePlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePackName ) }, - { "HoldTheLineMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineMessageLabel ) }, - { "HoldTheLineAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineAnnouncementName ) }, - - { "ValidMemberKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( BattlePlanUpdateModuleData, m_validMemberKindOf ) }, - { "InvalidMemberKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( BattlePlanUpdateModuleData, m_invalidMemberKindOf ) }, - { "BattlePlanChangeParalyzeTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_battlePlanParalyzeFrames ) }, - { "HoldTheLinePlanArmorDamageScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineArmorDamageScalar ) }, - { "SearchAndDestroyPlanSightRangeScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroySightRangeScalar ) }, - - { "StrategyCenterSearchAndDestroySightRangeScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroySightRangeScalar ) }, - { "StrategyCenterSearchAndDestroyDetectsStealth", INI::parseBool, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroyDetectsStealth ) }, - { "StrategyCenterHoldTheLineMaxHealthScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthScalar ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( BattlePlanUpdateModuleData, m_specialPowerTemplate ) }, + + { "BombardmentPlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentPlanAnimationFrames ) }, + { "HoldTheLinePlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePlanAnimationFrames ) }, + { "SearchAndDestroyPlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPlanAnimationFrames ) }, + { "TransitionIdleTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_transitionIdleFrames ) }, + + { "BombardmentPlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentUnpackName ) }, + { "BombardmentPlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentPackName ) }, + { "BombardmentMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentMessageLabel ) }, + { "BombardmentAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentAnnouncementName ) }, + { "SearchAndDestroyPlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyUnpackName ) }, + { "SearchAndDestroyPlanIdleLoopSoundName",INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyIdleName ) }, + { "SearchAndDestroyPlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPackName ) }, + { "SearchAndDestroyMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyMessageLabel ) }, + { "SearchAndDestroyAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyAnnouncementName ) }, + { "HoldTheLinePlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineUnpackName ) }, + { "HoldTheLinePlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePackName ) }, + { "HoldTheLineMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineMessageLabel ) }, + { "HoldTheLineAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineAnnouncementName ) }, + + { "ValidMemberKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( BattlePlanUpdateModuleData, m_validMemberKindOf ) }, + { "InvalidMemberKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( BattlePlanUpdateModuleData, m_invalidMemberKindOf ) }, + { "BattlePlanChangeParalyzeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_battlePlanParalyzeFrames ) }, + { "HoldTheLinePlanArmorDamageScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineArmorDamageScalar ) }, + { "SearchAndDestroyPlanSightRangeScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroySightRangeScalar ) }, + + { "StrategyCenterSearchAndDestroySightRangeScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroySightRangeScalar ) }, + { "StrategyCenterSearchAndDestroyDetectsStealth", INI::parseBool, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroyDetectsStealth ) }, + { "StrategyCenterHoldTheLineMaxHealthScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthScalar ) }, { "StrategyCenterHoldTheLineMaxHealthChangeType", INI::parseIndexList, TheMaxHealthChangeTypeNames, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthChangeType ) }, - { "VisionObjectName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_visionObjectName ) }, + { "VisionObjectName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_visionObjectName ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -131,7 +131,7 @@ BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() //------------------------------------------------------------------------------------------------- BattlePlanUpdate::BattlePlanUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), - m_bonuses(NULL) + m_bonuses(nullptr) { const BattlePlanUpdateModuleData *data = getBattlePlanUpdateModuleData(); @@ -155,7 +155,7 @@ BattlePlanUpdate::BattlePlanUpdate( Thing *thing, const ModuleData* moduleData ) m_visionObjectID = INVALID_ID; - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; } //------------------------------------------------------------------------------------------------- @@ -196,7 +196,7 @@ void BattlePlanUpdate::onDelete() Player* player = getObject()->getControllingPlayer(); // however, player CAN legitimately be null during game reset cycles // (and which point it doesn't really matter if we can remove the bonus or not) - //DEBUG_ASSERTCRASH(player != NULL, ("Hmm, controller is null")); + //DEBUG_ASSERTCRASH(player != nullptr, ("Hmm, controller is null")); if( player && m_planAffectingArmy != PLANSTATUS_NONE ) { player->changeBattlePlan( m_planAffectingArmy, -1, m_bonuses ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp index 92dc1c839d7..185b5ac44af 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp @@ -54,11 +54,11 @@ BoneFXUpdateModuleData::BoneFXUpdateModuleData(void) Int i, j; for (i = 0; i < BODYDAMAGETYPE_COUNT; ++i) { for (j = 0; j < BONE_FX_MAX_BONES; ++j) { - m_fxList[i][j].fx = NULL; + m_fxList[i][j].fx = nullptr; m_fxList[i][j].onlyOnce = TRUE; - m_OCL[i][j].ocl = NULL; + m_OCL[i][j].ocl = nullptr; m_OCL[i][j].onlyOnce = TRUE; - m_particleSystem[i][j].particleSysTemplate = NULL; + m_particleSystem[i][j].particleSysTemplate = nullptr; m_particleSystem[i][j].onlyOnce = TRUE; } } @@ -96,7 +96,7 @@ void BoneFXUpdate::onObjectCreated() { static NameKeyType key_BoneFXDamage = NAMEKEY("BoneFXDamage"); BoneFXDamage* bfxd = (BoneFXDamage*)getObject()->findDamageModule(key_BoneFXDamage); - if (bfxd == NULL) + if (bfxd == nullptr) { DEBUG_CRASH(("BoneFXUpdate requires BoneFXDamage")); throw INI_INVALID_DATA; @@ -140,8 +140,8 @@ static void parseFXLocInfo( INI *ini, void *instance, BoneLocInfo *locInfo ) static void parseGameClientRandomDelay( INI *ini, void *instance, GameClientRandomVariable *delay) { Real min, max; - INI::parseDurationReal(ini, instance, &min, NULL); - INI::parseDurationReal(ini, instance, &max, NULL); + INI::parseDurationReal(ini, instance, &min, nullptr); + INI::parseDurationReal(ini, instance, &max, nullptr); delay->setRange(min, max, GameClientRandomVariable::DistributionType::UNIFORM); } @@ -149,8 +149,8 @@ static void parseGameClientRandomDelay( INI *ini, void *instance, GameClientRand static void parseGameLogicRandomDelay( INI *ini, void *instance, GameLogicRandomVariable *delay) { Real min, max; - INI::parseDurationReal(ini, instance, &min, NULL); - INI::parseDurationReal(ini, instance, &max, NULL); + INI::parseDurationReal(ini, instance, &min, nullptr); + INI::parseDurationReal(ini, instance, &max, nullptr); delay->setRange(min, max, GameLogicRandomVariable::DistributionType::UNIFORM); } @@ -178,7 +178,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr); parseGameLogicRandomDelay( ini, instance, &info->gameLogicDelay); @@ -193,7 +193,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, } // parse the fx list name - ini->parseFXList( ini, instance, &info->fx, NULL ); + ini->parseFXList( ini, instance, &info->fx, nullptr ); } @@ -220,7 +220,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL ); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr ); parseGameLogicRandomDelay(ini, instance, &info->gameLogicDelay); @@ -235,7 +235,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, } // parse the ocl name - ini->parseObjectCreationList( ini, instance, &info->ocl, NULL ); + ini->parseObjectCreationList( ini, instance, &info->ocl, nullptr ); } @@ -262,7 +262,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL ); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr ); parseGameClientRandomDelay(ini, instance, &info->gameClientDelay); @@ -277,7 +277,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, } // parse the particle system name - ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, NULL ); + ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, nullptr ); } @@ -396,10 +396,10 @@ void BoneFXUpdate::doFXListAtBone(const FXList *fxList, const Coord3D *bonePosit // Convert the bone's position relative to the origin of the building to the current // bone position in the world. Coord3D newPos; - building->convertBonePosToWorldPos(bonePosition, NULL, &newPos, NULL); + building->convertBonePosToWorldPos(bonePosition, nullptr, &newPos, nullptr); // execute the fx list at the calculated bone position. - FXList::doFXPos(fxList, &newPos, NULL); + FXList::doFXPos(fxList, &newPos, nullptr); } //------------------------------------------------------------------------------------------------- @@ -421,9 +421,9 @@ void BoneFXUpdate::doOCLAtBone(const ObjectCreationList *ocl, const Coord3D *bon Object *building = getObject(); Coord3D newPos; - building->convertBonePosToWorldPos(bonePosition, NULL, &newPos, NULL); + building->convertBonePosToWorldPos(bonePosition, nullptr, &newPos, nullptr); - ObjectCreationList::create( ocl, building, &newPos, NULL ); + ObjectCreationList::create( ocl, building, &newPos, nullptr ); } @@ -444,7 +444,7 @@ void BoneFXUpdate::doParticleSystemAtBone(const ParticleSystemTemplate *particle Object *building = getObject(); ParticleSystem *psys = TheParticleSystemManager->createParticleSystem(particleSystemTemplate); - if (psys != NULL) + if (psys != nullptr) { m_particleSystemIDs.push_back(psys->getSystemID()); psys->setPosition(bonePosition); @@ -499,14 +499,14 @@ void BoneFXUpdate::resolveBoneLocations() { Int i; const BoneFXUpdateModuleData *d = getBoneFXUpdateModuleData(); Object *building = getObject(); - if (building == NULL) { - DEBUG_ASSERTCRASH(building != NULL, ("There is no object?")); + if (building == nullptr) { + DEBUG_ASSERTCRASH(building != nullptr, ("There is no object?")); return; } Drawable *drawable = building->getDrawable(); - if (drawable == NULL) { - DEBUG_ASSERTCRASH(drawable != NULL, ("There is no drawable?")); + if (drawable == nullptr) { + DEBUG_ASSERTCRASH(drawable != nullptr, ("There is no drawable?")); return; } @@ -514,19 +514,19 @@ void BoneFXUpdate::resolveBoneLocations() { if (d->m_fxList[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneFXListInfo *info = &(d->m_fxList[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_FXBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_FXBonePositions[m_curBodyState][i], nullptr, 1); } if (d->m_OCL[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneOCLInfo *info = &(d->m_OCL[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_OCLBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_OCLBonePositions[m_curBodyState][i], nullptr, 1); } if (d->m_particleSystem[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneParticleSystemInfo *info = &(d->m_particleSystem[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_PSBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_PSBonePositions[m_curBodyState][i], nullptr, 1); } } m_bonesResolved[m_curBodyState] = TRUE; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp index 746118fb4d6..f91c7829738 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp @@ -81,14 +81,14 @@ void CheckpointUpdate::checkForAlliesAndEnemies( void ) geom.setMinorRadius( m_maxMinorRadius ); obj->setGeometryInfo( geom ); - Object *enemy, *ally = NULL; + Object *enemy, *ally = nullptr; Real visionRange = obj->getVisionRange(); enemy = TheAI->findClosestEnemy( obj, visionRange, 0 ); - m_enemyNear = (enemy != NULL); + m_enemyNear = (enemy != nullptr); ally = TheAI->findClosestAlly( obj, visionRange, 0 ); - m_allyNear = (ally != NULL); + m_allyNear = (ally != nullptr); // here we restore the radius so that other units can path past the open gate geom.setMinorRadius( restoreSpecialRadius ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp index 9fc92b0a4e7..d99b265ebeb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp @@ -64,9 +64,9 @@ CleanupHazardUpdateModuleData::CleanupHazardUpdateModuleData() static const FieldParse dataFieldParse[] = { { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( CleanupHazardUpdateModuleData, m_weaponSlot ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( CleanupHazardUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( CleanupHazardUpdateModuleData, m_scanRange ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( CleanupHazardUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( CleanupHazardUpdateModuleData, m_scanRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -78,7 +78,7 @@ CleanupHazardUpdate::CleanupHazardUpdate( Thing *thing, const ModuleData* module m_nextScanFrames = 0; m_nextShotAvailableInFrames = 0; m_inRange = false; - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; m_moveRange = 0.0f; m_pos.zero(); @@ -222,7 +222,7 @@ void CleanupHazardUpdate::fireWhenReady() { scanClosestTarget(); m_nextScanFrames = data->m_scanFrames; - target = NULL; //Set target to NULL so we don't shoot at it (might be out of range) + target = nullptr; //Set target to nullptr so we don't shoot at it (might be out of range) } } else @@ -261,12 +261,12 @@ Object* CleanupHazardUpdate::scanClosestTarget() { const CleanupHazardUpdateModuleData *data = getCleanupHazardUpdateModuleData(); Object *me = getObject(); - Object *bestTargetInRange = NULL; + Object *bestTargetInRange = nullptr; m_bestTargetID = INVALID_ID; PartitionFilterAcceptByKindOf kindFilter(MAKE_KINDOF_MASK(KINDOF_CLEANUP_HAZARD), KINDOFMASK_NONE); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter* filters[] = { &kindFilter, &filterMapStatus, NULL }; + PartitionFilter* filters[] = { &kindFilter, &filterMapStatus, nullptr }; if( m_moveRange > 0.0f ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp index 802d2d7afa2..50f89ca1ee2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp @@ -68,9 +68,9 @@ CommandButtonHuntUpdateModuleData::CommandButtonHuntUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( CommandButtonHuntUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( CommandButtonHuntUpdateModuleData, m_scanRange ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( CommandButtonHuntUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( CommandButtonHuntUpdateModuleData, m_scanRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -78,7 +78,7 @@ CommandButtonHuntUpdateModuleData::CommandButtonHuntUpdateModuleData() //------------------------------------------------------------------------------------------------- CommandButtonHuntUpdate::CommandButtonHuntUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), -m_commandButton(NULL) +m_commandButton(nullptr) { setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); m_commandButtonName = AsciiString::TheEmptyString; @@ -103,7 +103,7 @@ void CommandButtonHuntUpdate::setCommandButton(const AsciiString& buttonName) { Object *obj = getObject(); m_commandButtonName = buttonName; - m_commandButton = NULL; + m_commandButton = nullptr; const CommandSet *commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() ); if( commandSet ) { @@ -122,14 +122,14 @@ void CommandButtonHuntUpdate::setCommandButton(const AsciiString& buttonName) } } } - m_commandButton = NULL; + m_commandButton = nullptr; } } - if (m_commandButton==NULL) { + if (m_commandButton==nullptr) { return; } AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL ) return; + if (ai==nullptr ) return; // Stop whatever we're doing. ai->aiIdle(CMD_FROM_AI); @@ -146,12 +146,12 @@ UpdateSleepTime CommandButtonHuntUpdate::update() Object *obj = getObject(); AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL || m_commandButton==NULL) return UPDATE_SLEEP_FOREVER; + if (ai==nullptr || m_commandButton==nullptr) return UPDATE_SLEEP_FOREVER; if (ai->getLastCommandSource() != CMD_FROM_AI) { // If a script or the player (in this case should only be script, but either way) // we quit hunting. - m_commandButton = NULL; + m_commandButton = nullptr; m_commandButtonName.clear(); return UPDATE_SLEEP_FOREVER; } @@ -201,7 +201,7 @@ UpdateSleepTime CommandButtonHuntUpdate::huntSpecialPower(AIUpdateInterface *ai) if( spTemplate ) { SpecialAbilityUpdate* spUpdate = obj->findSpecialAbilityUpdate( spTemplate->getSpecialPowerType() ); - if (spUpdate == NULL) return UPDATE_SLEEP_FOREVER; + if (spUpdate == nullptr) return UPDATE_SLEEP_FOREVER; if (spUpdate->isActive()) { return UPDATE_SLEEP(data->m_scanFrames); } @@ -232,14 +232,14 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) filters[0] = &aliveFilter; filters[1] = &filterMapStatus; filters[2] = &filterTeam; - filters[3] = NULL; + filters[3] = nullptr; const SpecialPowerTemplate *spTemplate = m_commandButton->getSpecialPowerTemplate(); - if( !spTemplate ) return NULL; // isn't going to happen. + if( !spTemplate ) return nullptr; // isn't going to happen. Bool isBlackLotusVehicleHack = (spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK); Bool isCaptureBuilding = (spTemplate->getSpecialPowerType() == SPECIAL_INFANTRY_CAPTURE_BUILDING); if (isCaptureBuilding) { - filters[2] = NULL; // It's ok (in fact necessary for oil derricks) to capture special buildings. + filters[2] = nullptr; // It's ok (in fact necessary for oil derricks) to capture special buildings. } Bool isPlaceExplosive = false; @@ -251,10 +251,10 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR ); MemoryPoolObjectHolder hold(iter); - Object *bestTarget = NULL; + Object *bestTarget = nullptr; Int effectivePriority=0; Int actualPriority=0; - const AttackPriorityInfo *info=NULL; + const AttackPriorityInfo *info=nullptr; if (me->getAI()) { info = me->getAI()->getAttackInfo(); } @@ -283,7 +283,7 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) // Don't target things near explosives... It's just not a good idea. PartitionFilterSamePlayer filterPlayer( me->getControllingPlayer() ); // Look for our own mines. PartitionFilterAcceptByKindOf filterKind(MAKE_KINDOF_MASK(KINDOF_MINE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKind, &filterPlayer, NULL }; + PartitionFilter *filters[] = { &filterKind, &filterPlayer, nullptr }; Object *mine = ThePartitionManager->getClosestObject( other, range, FROM_BOUNDINGSPHERE_2D, filters );// could be null. this is ok. if (mine) { continue; @@ -354,7 +354,7 @@ void CommandButtonHuntUpdate::xfer( Xfer *xfer ) { // initialize to no command button - m_commandButton = NULL; + m_commandButton = nullptr; // find command button pointer if name is present if( m_commandButtonName.isEmpty() == FALSE ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp index 0ba4f1aac11..1dc715090bb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp @@ -48,7 +48,7 @@ void DelayedWeaponSetUpgradeUpdateModuleData::buildFieldParse(MultiIniFieldParse static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp index 95b1f638fdc..337d4f4af68 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp @@ -56,7 +56,7 @@ DemoTrapUpdateModuleData::DemoTrapUpdateModuleData() m_proximityModeWeaponSlot = PRIMARY_WEAPON; m_triggerDetonationRange = 0.0f; m_scanFrames = 0; - m_detonationWeaponTemplate = NULL; + m_detonationWeaponTemplate = nullptr; m_detonateWhenKilled = false; } @@ -67,17 +67,17 @@ DemoTrapUpdateModuleData::DemoTrapUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "DefaultProximityMode", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_defaultsToProximityMode ) }, + { "DefaultProximityMode", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_defaultsToProximityMode ) }, { "DetonationWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponSlot ) }, { "ProximityModeWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_proximityModeWeaponSlot ) }, { "ManualModeWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_manualModeWeaponSlot ) }, - { "TriggerDetonationRange", INI::parseReal, NULL, offsetof( DemoTrapUpdateModuleData, m_triggerDetonationRange ) }, - { "IgnoreTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( DemoTrapUpdateModuleData, m_ignoreKindOf ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( DemoTrapUpdateModuleData, m_scanFrames ) }, - { "AutoDetonationWithFriendsInvolved", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_friendlyDetonation ) }, - { "DetonationWeapon", INI::parseWeaponTemplate, NULL, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponTemplate ) }, - { "DetonateWhenKilled", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_detonateWhenKilled ) }, - { 0, 0, 0, 0 } + { "TriggerDetonationRange", INI::parseReal, nullptr, offsetof( DemoTrapUpdateModuleData, m_triggerDetonationRange ) }, + { "IgnoreTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( DemoTrapUpdateModuleData, m_ignoreKindOf ) }, + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoTrapUpdateModuleData, m_scanFrames ) }, + { "AutoDetonationWithFriendsInvolved", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_friendlyDetonation ) }, + { "DetonationWeapon", INI::parseWeaponTemplate, nullptr, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponTemplate ) }, + { "DetonateWhenKilled", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_detonateWhenKilled ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp index f1ee45abe75..339d5d96882 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp @@ -53,9 +53,9 @@ DockUpdateModuleData::DockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "NumberApproachPositions" ,INI::parseInt, NULL, offsetof( DockUpdateModuleData, m_numberApproachPositionsData ) }, - { "AllowsPassthrough" ,INI::parseBool, NULL, offsetof( DockUpdateModuleData, m_isAllowPassthrough ) }, - { 0, 0, 0, 0 } + { "NumberApproachPositions" ,INI::parseInt, nullptr, offsetof( DockUpdateModuleData, m_numberApproachPositionsData ) }, + { "AllowsPassthrough" ,INI::parseBool, nullptr, offsetof( DockUpdateModuleData, m_isAllowPassthrough ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -141,7 +141,7 @@ Bool DockUpdate::reserveApproachPosition( Object* docker, Coord3D *position, Int loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return FALSE; ObjectID dockerID = docker->getID(); @@ -192,7 +192,7 @@ Bool DockUpdate::advanceApproachPosition( Object* docker, Coord3D *position, Int loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return FALSE; if( *index <= 0 ) return FALSE; @@ -240,7 +240,7 @@ void DockUpdate::getEnterPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are, unless you fly, in which case I should recenter you @@ -258,7 +258,7 @@ void DockUpdate::getEnterPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_enterPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_enterPosition, nullptr, position, nullptr ); } @@ -270,7 +270,7 @@ void DockUpdate::getDockPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are. @@ -283,7 +283,7 @@ void DockUpdate::getDockPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_dockPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_dockPosition, nullptr, position, nullptr ); } @@ -295,7 +295,7 @@ void DockUpdate::getExitPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are. @@ -308,7 +308,7 @@ void DockUpdate::getExitPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_exitPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_exitPosition, nullptr, position, nullptr ); } @@ -457,7 +457,7 @@ Coord3D DockUpdate::computeApproachPosition( Int positionIndex, Object *forWhom // Start with the pristine bone, then convert it to the world, then find a clean spot around it. Object *us = getObject(); - us->convertBonePosToWorldPos( &m_approachPositions[positionIndex], NULL, &workingPosition, NULL ); + us->convertBonePosToWorldPos( &m_approachPositions[positionIndex], nullptr, &workingPosition, nullptr ); if( m_numberApproachPositionBones == 0 ) { @@ -495,9 +495,9 @@ void DockUpdate::loadDockPositions() if (myDrawable) { - myDrawable->getPristineBonePositions( "DockStart", 0, &m_enterPosition, NULL, 1); - myDrawable->getPristineBonePositions( "DockAction", 0, &m_dockPosition, NULL, 1); - myDrawable->getPristineBonePositions( "DockEnd", 0, &m_exitPosition, NULL, 1); + myDrawable->getPristineBonePositions( "DockStart", 0, &m_enterPosition, nullptr, 1); + myDrawable->getPristineBonePositions( "DockAction", 0, &m_dockPosition, nullptr, 1); + myDrawable->getPristineBonePositions( "DockEnd", 0, &m_exitPosition, nullptr, 1); if( m_numberApproachPositions != DYNAMIC_APPROACH_VECTOR_FLAG ) { // Dynamic means no bones @@ -508,7 +508,7 @@ void DockUpdate::loadDockPositions() // TheSuperHackers @fix helmutbuhler 19/04/2025 Zero initialize array to prevent uninitialized memory reads. // Important: the entire target vector is used for serialization and crc and must not contain random data. Coord3D approachBones[DEFAULT_APPROACH_VECTOR_SIZE] = {0}; - m_numberApproachPositionBones = myDrawable->getPristineBonePositions( "DockWaiting", 1, approachBones, NULL, m_numberApproachPositions); + m_numberApproachPositionBones = myDrawable->getPristineBonePositions( "DockWaiting", 1, approachBones, nullptr, m_numberApproachPositions); if( m_numberApproachPositions == m_approachPositions.size() )//safeguard: will always be true { for( Int copyIndex = 0; copyIndex < m_numberApproachPositions; ++copyIndex ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp index 3ee5ae7e848..54c5993c2c4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp @@ -63,7 +63,7 @@ Bool PrisonDockUpdate::action( Object *docker, Object *drone ) { // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // if docker has no contents, do nothing and stop the dock process diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index bedbd258caa..ad8def5579d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -64,9 +64,9 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "PullInsideDuration", INI::parseDurationUnsignedInt, NULL, offsetof( RailedTransportDockUpdateModuleData, m_pullInsideDurationInFrames ) }, - { "PushOutsideDuration",INI::parseDurationUnsignedInt, NULL, offsetof( RailedTransportDockUpdateModuleData, m_pushOutsideDurationInFrames ) }, - { 0, 0, 0, 0 } + { "PullInsideDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( RailedTransportDockUpdateModuleData, m_pullInsideDurationInFrames ) }, + { "PushOutsideDuration",INI::parseDurationUnsignedInt, nullptr, offsetof( RailedTransportDockUpdateModuleData, m_pushOutsideDurationInFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -126,7 +126,7 @@ Bool RailedTransportDockUpdate::action( Object *docker, Object *drone ) Object *us = getObject(); // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // set this object as docking with us if not already done so @@ -256,7 +256,7 @@ void RailedTransportDockUpdate::doPullInDocking( void ) Object *docker = TheGameLogic->findObjectByID( m_dockingObjectID ); // check for docker gone - if( docker == NULL ) + if( docker == nullptr ) m_dockingObjectID = INVALID_ID; // pull it @@ -337,7 +337,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) Object *unloader = TheGameLogic->findObjectByID( m_unloadingObjectID ); // if unloader is not found (like they got destroyed) unload the next object inside - if( unloader == NULL ) + if( unloader == nullptr ) { unloadNext(); @@ -408,8 +408,8 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) { Coord3D finalPos; - draw->getPristineBonePositions( "DOCKWAITING07", 0, &finalPos, NULL, 1 ); - us->convertBonePosToWorldPos( &finalPos, NULL, &finalPos, NULL ); + draw->getPristineBonePositions( "DOCKWAITING07", 0, &finalPos, nullptr, 1 ); + us->convertBonePosToWorldPos( &finalPos, nullptr, &finalPos, nullptr ); unloaderAI->aiMoveToPosition( &finalPos, CMD_FROM_AI ); } @@ -433,7 +433,7 @@ static void getFirstContain( Object *obj, void *userData ) Object **firstContain = (Object **)userData; // if object has been found get out of here - if( *firstContain != NULL ) + if( *firstContain != nullptr ) return; // assign this as the first object found @@ -460,12 +460,12 @@ void RailedTransportDockUpdate::unloadNext( void ) // better be an open container ContainModuleInterface *contain = us->getContain(); - OpenContain *openContain = contain ? contain->asOpenContain() : NULL; + OpenContain *openContain = contain ? contain->asOpenContain() : nullptr; DEBUG_ASSERTCRASH( openContain, ("Unloading next from railed transport, but '%s' has no open container", us->getTemplate()->getName().str()) ); // get the first contained object - Object *unloader = NULL; + Object *unloader = nullptr; openContain->iterateContained( getFirstContain, &unloader, FALSE ); if( unloader ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp index f39dd2741f9..51505682b31 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp @@ -53,8 +53,8 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "TimeForFullHeal", INI::parseDurationReal, NULL, offsetof( RepairDockUpdateModuleData, m_framesForFullHeal ) }, - { 0, 0, 0, 0 } + { "TimeForFullHeal", INI::parseDurationReal, nullptr, offsetof( RepairDockUpdateModuleData, m_framesForFullHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -92,7 +92,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) { // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // get our module data diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp index 965f0fdd028..37f5e5f0884 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp @@ -52,7 +52,7 @@ SupplyCenterDockUpdateModuleData::SupplyCenterDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -79,14 +79,14 @@ SupplyCenterDockUpdate::~SupplyCenterDockUpdate() // ------------------------------------------------------------------------------------------------ Bool SupplyCenterDockUpdate::action( Object* docker, Object *drone ) { - SupplyTruckAIInterface* supplyTruckAI = NULL; - if( docker->getAIUpdateInterface() == NULL ) + SupplyTruckAIInterface* supplyTruckAI = nullptr; + if( docker->getAIUpdateInterface() == nullptr ) return FALSE; supplyTruckAI = docker->getAIUpdateInterface()->getSupplyTruckAIInterface(); - DEBUG_ASSERTCRASH( supplyTruckAI != NULL, ("Something Docking with a Supply Center must have a Supply-truck like AIUpdate") ); - if( supplyTruckAI == NULL ) + DEBUG_ASSERTCRASH( supplyTruckAI != nullptr, ("Something Docking with a Supply Center must have a Supply-truck like AIUpdate") ); + if( supplyTruckAI == nullptr ) return FALSE; UnsignedInt value = 0; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp index fcfb9f0eb95..67806c33fb9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp @@ -55,9 +55,9 @@ SupplyWarehouseDockUpdateModuleData::SupplyWarehouseDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "StartingBoxes", INI::parseInt, NULL, offsetof( SupplyWarehouseDockUpdateModuleData, m_startingBoxesData ) }, - { "DeleteWhenEmpty", INI::parseBool, NULL, offsetof( SupplyWarehouseDockUpdateModuleData, m_deleteWhenEmpty ) }, - { 0, 0, 0, 0 } + { "StartingBoxes", INI::parseInt, nullptr, offsetof( SupplyWarehouseDockUpdateModuleData, m_startingBoxesData ) }, + { "DeleteWhenEmpty", INI::parseBool, nullptr, offsetof( SupplyWarehouseDockUpdateModuleData, m_deleteWhenEmpty ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp index 1663997ab29..8410b286110 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp @@ -62,20 +62,20 @@ DynamicGeometryInfoUpdateModuleData::DynamicGeometryInfoUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialDelay) }, + { "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialDelay) }, - { "InitialHeight", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialHeight) }, - { "InitialMajorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMajorRadius) }, - { "InitialMinorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMinorRadius) }, + { "InitialHeight", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialHeight) }, + { "InitialMajorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMajorRadius) }, + { "InitialMinorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMinorRadius) }, - { "FinalHeight", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalHeight) }, - { "FinalMajorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMajorRadius) }, - { "FinalMinorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMinorRadius) }, + { "FinalHeight", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalHeight) }, + { "FinalMajorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMajorRadius) }, + { "FinalMinorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMinorRadius) }, - { "TransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_transitionTime) }, - { "ReverseAtTransitionTime", INI::parseBool, NULL, offsetof( DynamicGeometryInfoUpdateModuleData, m_reverseAtTransitionTime ) }, + { "TransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_transitionTime) }, + { "ReverseAtTransitionTime", INI::parseBool, nullptr, offsetof( DynamicGeometryInfoUpdateModuleData, m_reverseAtTransitionTime ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index 0253517006a..4405b72fcf6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -59,15 +59,15 @@ DynamicShroudClearingRangeUpdateModuleData::DynamicShroudClearingRangeUpdateModu static const FieldParse dataFieldParse[] = { - { "ChangeInterval", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_changeInterval ) }, - { "GrowInterval", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growInterval ) }, - { "ShrinkDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkDelay ) }, - { "ShrinkTime", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkTime ) }, - { "GrowDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growDelay ) }, - { "GrowTime", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growTime ) }, - { "FinalVision", INI::parseReal, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_finalVision ) }, - { "GridDecalTemplate", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_gridDecalTemplate ) }, - { 0, 0, 0, 0 } + { "ChangeInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_changeInterval ) }, + { "GrowInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growInterval ) }, + { "ShrinkDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkDelay ) }, + { "ShrinkTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkTime ) }, + { "GrowDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growDelay ) }, + { "GrowTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growTime ) }, + { "FinalVision", INI::parseReal, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_finalVision ) }, + { "GridDecalTemplate", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_gridDecalTemplate ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index e64539f715a..f8023f3b678 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -84,7 +84,7 @@ EMPUpdate::EMPUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModul if ( data ) { //SANITY - DEBUG_ASSERTCRASH( TheGameLogic, ("EMPUpdate::EMPUpdate - TheGameLogic is NULL" ) ); + DEBUG_ASSERTCRASH( TheGameLogic, ("EMPUpdate::EMPUpdate - TheGameLogic is null" ) ); UnsignedInt now = TheGameLogic->getFrame(); m_currentScale = data->m_startScale; @@ -106,7 +106,7 @@ EMPUpdate::EMPUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModul } //SANITY - DEBUG_ASSERTCRASH( data, ("EMPUpdate::EMPUpdate - getEMPUpdateModuleData is NULL" ) ); + DEBUG_ASSERTCRASH( data, ("EMPUpdate::EMPUpdate - getEMPUpdateModuleData is null" ) ); m_currentScale = 1.0f; m_dieFrame = 0; m_tintEnvFadeFrames = 0; @@ -175,8 +175,8 @@ void EMPUpdate::doDisableAttack( void ) Real curVictimDistSqr; const Coord3D *pos = object->getPosition(); - SimpleObjectIterator *iter = NULL; - Object *curVictim = NULL; + SimpleObjectIterator *iter = nullptr; + Object *curVictim = nullptr; if (radius > 0.0f) { @@ -188,7 +188,7 @@ void EMPUpdate::doDisableAttack( void ) MemoryPoolObjectHolder hold(iter); - for ( ; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for ( ; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { if ( curVictim != object) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp index 3bd99fbb760..09d58ed6365 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp @@ -71,7 +71,7 @@ void EnemyNearUpdate::checkForEnemies( void ) Real visionRange = getObject()->getVisionRange(); Object* enemy = TheAI->findClosestEnemy( getObject(), visionRange, AI::CAN_SEE ); - m_enemyNear = (enemy != NULL); + m_enemyNear = (enemy != nullptr); } else { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index 5a1c35f59c3..7add830fe8d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -59,7 +59,7 @@ FireOCLAfterWeaponCooldownUpdateModuleData::FireOCLAfterWeaponCooldownUpdateModu m_minShotsRequired = 1; m_oclLifetimePerSecond = 1000; m_oclMaxFrames = 1000; - m_ocl = NULL; + m_ocl = nullptr; } //------------------------------------------------------------------------------------------------- @@ -69,11 +69,11 @@ void FireOCLAfterWeaponCooldownUpdateModuleData::buildFieldParse(MultiIniFieldPa static const FieldParse dataFieldParse[] = { { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_weaponSlot ) }, - { "OCL", INI::parseObjectCreationList, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_ocl ) }, - { "MinShotsToCreateOCL", INI::parseUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_minShotsRequired ) }, - { "OCLLifetimePerSecond", INI::parseUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclLifetimePerSecond ) }, - { "OCLLifetimeMaxCap", INI::parseDurationUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclMaxFrames ) }, - { 0, 0, 0, 0 } + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_ocl ) }, + { "MinShotsToCreateOCL", INI::parseUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_minShotsRequired ) }, + { "OCLLifetimePerSecond", INI::parseUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclLifetimePerSecond ) }, + { "OCLLifetimeMaxCap", INI::parseDurationUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclMaxFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(UpgradeMuxData::getFieldParse(), offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_upgradeMuxData )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp index 82553422d93..cb0da1c915f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp @@ -62,7 +62,7 @@ Bool PartitionFilterFlammable::allow(Object *objOther) // It must be burnable in general, and burnable now static NameKeyType key_FlammableUpdate = NAMEKEY("FlammableUpdate"); FlammableUpdate* fu = (FlammableUpdate*)objOther->findUpdateModule(key_FlammableUpdate); - if (fu == NULL) + if (fu == nullptr) return FALSE; if( ! fu->wouldIgnite() ) @@ -79,7 +79,7 @@ FireSpreadUpdateModuleData::FireSpreadUpdateModuleData() { m_minSpreadTryDelayData = 0; m_maxSpreadTryDelayData = 0; - m_oclEmbers = NULL; + m_oclEmbers = nullptr; m_spreadTryRange = 0; } @@ -90,11 +90,11 @@ FireSpreadUpdateModuleData::FireSpreadUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OCLEmbers", INI::parseObjectCreationList, NULL, offsetof( FireSpreadUpdateModuleData, m_oclEmbers ) }, - { "MinSpreadDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireSpreadUpdateModuleData, m_minSpreadTryDelayData ) }, - { "MaxSpreadDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireSpreadUpdateModuleData, m_maxSpreadTryDelayData ) }, - { "SpreadTryRange", INI::parseReal, NULL, offsetof( FireSpreadUpdateModuleData, m_spreadTryRange ) }, - { 0, 0, 0, 0 } + { "OCLEmbers", INI::parseObjectCreationList, nullptr, offsetof( FireSpreadUpdateModuleData, m_oclEmbers ) }, + { "MinSpreadDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireSpreadUpdateModuleData, m_minSpreadTryDelayData ) }, + { "MaxSpreadDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireSpreadUpdateModuleData, m_maxSpreadTryDelayData ) }, + { "SpreadTryRange", INI::parseReal, nullptr, offsetof( FireSpreadUpdateModuleData, m_spreadTryRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -122,15 +122,15 @@ UpdateSleepTime FireSpreadUpdate::update( void ) if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) ) return UPDATE_SLEEP_FOREVER; // not on fire -- sleep forever { - ObjectCreationList::create( d->m_oclEmbers, getObject(), NULL ); + ObjectCreationList::create( d->m_oclEmbers, getObject(), nullptr ); if( d->m_spreadTryRange != 0 ) { // This will spread fire explicitly PartitionFilterFlammable fFilter; - PartitionFilter *filters[] = { &fFilter, NULL }; + PartitionFilter *filters[] = { &fFilter, nullptr }; -// SimpleObjectIterator *iter = NULL; +// SimpleObjectIterator *iter = nullptr; // iter = ThePartitionManager->iterateObjectsInRange(getObject(), // d->m_spreadTryRange, // FROM_CENTER_3D, diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index 915540b4a8f..ad579de6045 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -39,7 +39,7 @@ //------------------------------------------------------------------------------------------------- FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() { - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; } //------------------------------------------------------------------------------------------------- @@ -49,8 +49,8 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, - { 0, 0, 0, 0 } + { "Weapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -59,7 +59,7 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() //------------------------------------------------------------------------------------------------- FireWeaponUpdate::FireWeaponUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), - m_weapon(NULL) + m_weapon(nullptr) { const WeaponTemplate *tmpl = getFireWeaponUpdateModuleData()->m_weaponTemplate; if (tmpl) @@ -92,7 +92,7 @@ UpdateSleepTime FireWeaponUpdate::update( void ) //------------------------------------------------------------------------------------------------- Bool FireWeaponUpdate::isOkayToFire() { - if( m_weapon == NULL ) + if( m_weapon == nullptr ) return FALSE; // Weapon is reloading diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp index 72201fbcd5b..9a3915a6ce1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp @@ -50,8 +50,8 @@ FirestormDynamicGeometryInfoUpdateModuleData::FirestormDynamicGeometryInfoUpdate { for( Int i = 0; i < MAX_FIRESTORM_SYSTEMS; i++ ) - m_particleSystem[ i ] = NULL; - m_fxList = NULL; + m_particleSystem[ i ] = nullptr; + m_fxList = nullptr; m_particleOffsetZ = 0.0f; m_scorchSize = 0.0f; m_delayBetweenDamageFrames = 0.0f; @@ -67,29 +67,29 @@ FirestormDynamicGeometryInfoUpdateModuleData::FirestormDynamicGeometryInfoUpdate static const FieldParse dataFieldParse[] = { - { "DelayBetweenDamageFrames", INI::parseDurationReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_delayBetweenDamageFrames ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_damageAmount ) }, - { "MaxHeightForDamage", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_maxHeightForDamage ) }, - { "ParticleSystem1", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 0 ] ) }, - { "ParticleSystem2", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 1 ] ) }, - { "ParticleSystem3", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 2 ] ) }, - { "ParticleSystem4", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 3 ] ) }, - { "ParticleSystem5", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 4 ] ) }, - { "ParticleSystem6", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 5 ] ) }, - { "ParticleSystem7", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 6 ] ) }, - { "ParticleSystem8", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 7 ] ) }, - { "ParticleSystem9", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 8 ] ) }, - { "ParticleSystem10", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 9 ] ) }, - { "ParticleSystem11", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 10 ] ) }, - { "ParticleSystem12", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 11 ] ) }, - { "ParticleSystem13", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 12 ] ) }, - { "ParticleSystem14", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 13 ] ) }, - { "ParticleSystem15", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 14 ] ) }, - { "ParticleSystem16", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 15 ] ) }, - { "FXList", INI::parseFXList, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_fxList ) }, - { "ParticleOffsetZ", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleOffsetZ ) }, - { "ScorchSize", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_scorchSize ) }, - { 0, 0, 0, 0 } + { "DelayBetweenDamageFrames", INI::parseDurationReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_delayBetweenDamageFrames ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_damageAmount ) }, + { "MaxHeightForDamage", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_maxHeightForDamage ) }, + { "ParticleSystem1", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 0 ] ) }, + { "ParticleSystem2", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 1 ] ) }, + { "ParticleSystem3", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 2 ] ) }, + { "ParticleSystem4", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 3 ] ) }, + { "ParticleSystem5", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 4 ] ) }, + { "ParticleSystem6", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 5 ] ) }, + { "ParticleSystem7", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 6 ] ) }, + { "ParticleSystem8", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 7 ] ) }, + { "ParticleSystem9", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 8 ] ) }, + { "ParticleSystem10", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 9 ] ) }, + { "ParticleSystem11", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 10 ] ) }, + { "ParticleSystem12", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 11 ] ) }, + { "ParticleSystem13", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 12 ] ) }, + { "ParticleSystem14", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 13 ] ) }, + { "ParticleSystem15", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 14 ] ) }, + { "ParticleSystem16", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 15 ] ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_fxList ) }, + { "ParticleOffsetZ", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleOffsetZ ) }, + { "ScorchSize", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_scorchSize ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -248,7 +248,7 @@ void FirestormDynamicGeometryInfoUpdate::doDamageScan( void ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( firestormPos, boundingCircle, FROM_BOUNDINGSPHERE_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; for( other = iter->first(); other; other = iter->next() ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index acbdde07dfd..97f3c571571 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -59,14 +59,14 @@ FlammableUpdateModuleData::FlammableUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "BurnedDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_burnedDelay ) }, - { "AflameDuration", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDuration ) }, - { "AflameDamageDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDamageDelay ) }, - { "AflameDamageAmount", INI::parseInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDamageAmount ) }, - { "BurningSoundName", INI::parseAsciiString, NULL, offsetof( FlammableUpdateModuleData, m_burningSoundName) }, - { "FlameDamageLimit", INI::parseReal, NULL, offsetof( FlammableUpdateModuleData, m_flameDamageLimitData ) }, - { "FlameDamageExpiration", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_flameDamageExpirationDelay ) }, - { 0, 0, 0, 0 } + { "BurnedDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_burnedDelay ) }, + { "AflameDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDuration ) }, + { "AflameDamageDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDamageDelay ) }, + { "AflameDamageAmount", INI::parseInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDamageAmount ) }, + { "BurningSoundName", INI::parseAsciiString, nullptr, offsetof( FlammableUpdateModuleData, m_burningSoundName) }, + { "FlameDamageLimit", INI::parseReal, nullptr, offsetof( FlammableUpdateModuleData, m_flameDamageLimitData ) }, + { "FlameDamageExpiration", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_flameDamageExpirationDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -79,7 +79,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_aflameEndFrame = 0; m_burnedEndFrame = 0; m_damageEndFrame = 0; - m_audioHandle = NULL; + m_audioHandle = 0; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; @@ -208,7 +208,7 @@ void FlammableUpdate::tryToIgnite() // bleah. this sucks. (srj) static const NameKeyType key_FireSpreadUpdate = NAMEKEY("FireSpreadUpdate"); FireSpreadUpdate* fu = (FireSpreadUpdate*)getObject()->findUpdateModule(key_FireSpreadUpdate); - if (fu != NULL) + if (fu != nullptr) { fu->startFireSpreading(); } @@ -257,7 +257,7 @@ void FlammableUpdate::stopBurningSound() if (m_audioHandle) { TheAudio->removeAudioEvent( m_audioHandle ); - m_audioHandle = NULL; + m_audioHandle = 0; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp index 4963527673c..157c53c5e62 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp @@ -60,8 +60,8 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "Enabled", INI::parseBool, NULL, offsetof( FloatUpdateModuleData, m_enabled ) }, - { 0, 0, 0, 0 } + { "Enabled", INI::parseBool, nullptr, offsetof( FloatUpdateModuleData, m_enabled ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp index 892d741695a..95fe4d24961 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp @@ -66,13 +66,13 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TargetHeight", INI::parseReal, NULL, offsetof( HeightDieUpdateModuleData, m_targetHeightAboveTerrain ) }, - { "TargetHeightIncludesStructures", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_targetHeightIncludesStructures ) }, - { "OnlyWhenMovingDown", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_onlyWhenMovingDown ) }, - { "DestroyAttachedParticlesAtHeight", INI::parseReal, NULL, offsetof( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) }, - { "SnapToGroundOnDeath", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) }, - { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof( HeightDieUpdateModuleData, m_initialDelay ) }, - { 0, 0, 0, 0 } + { "TargetHeight", INI::parseReal, nullptr, offsetof( HeightDieUpdateModuleData, m_targetHeightAboveTerrain ) }, + { "TargetHeightIncludesStructures", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_targetHeightIncludesStructures ) }, + { "OnlyWhenMovingDown", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_onlyWhenMovingDown ) }, + { "DestroyAttachedParticlesAtHeight", INI::parseReal, nullptr, offsetof( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) }, + { "SnapToGroundOnDeath", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) }, + { "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( HeightDieUpdateModuleData, m_initialDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -119,7 +119,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) return UPDATE_SLEEP_NONE; // do nothing if we're contained within other objects ... like a transport - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) { // keep track of our last position even though we're not doing anything yet @@ -179,7 +179,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) // scan all objects in the radius of our extent and find the tallest height among them PartitionFilterAcceptByKindOf filter1( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ),KINDOFMASK_NONE ); - PartitionFilter *filters[] = { &filter1, NULL }; + PartitionFilter *filters[] = { &filter1, nullptr }; Real range = getObject()->getGeometryInfo().getBoundingCircleRadius(); ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( getObject(), range, diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp index 57057173a94..650d9a4c10d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp @@ -77,17 +77,17 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo m_minBladeFlyOffDelay = 0.0; m_maxBladeFlyOffDelay = 0.0; - m_attachParticleSystem = NULL; + m_attachParticleSystem = nullptr; m_attachParticleLoc.x = 0.0f; m_attachParticleLoc.y = 0.0f; m_attachParticleLoc.z = 0.0f; - m_oclEjectPilot = NULL; - m_fxBlade = NULL; - m_oclBlade = NULL; - m_fxHitGround = NULL; - m_oclHitGround = NULL; - m_fxFinalBlowUp = NULL; - m_oclFinalBlowUp = NULL; + m_oclEjectPilot = nullptr; + m_fxBlade = nullptr; + m_oclBlade = nullptr; + m_fxHitGround = nullptr; + m_oclHitGround = nullptr; + m_fxFinalBlowUp = nullptr; + m_oclFinalBlowUp = nullptr; m_delayFromGroundToFinalDeath = 0; m_maxBraking = 99999.0f; @@ -101,34 +101,34 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo static const FieldParse dataFieldParse[] = { - { "SpiralOrbitTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitTurnRate ) }, - { "SpiralOrbitForwardSpeed", INI::parseVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeed ) }, - { "SpiralOrbitForwardSpeedDamping", INI::parseReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) }, - { "MinSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minSelfSpin ) }, - { "MaxSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxSelfSpin ) }, - { "SelfSpinUpdateDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateDelay ) }, - { "SelfSpinUpdateAmount", INI::parseAngleReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateAmount ) }, - { "FallHowFast", INI::parsePercentToReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fallHowFast ) }, - { "MinBladeFlyOffDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minBladeFlyOffDelay ) }, - { "MaxBladeFlyOffDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBladeFlyOffDelay ) }, - { "AttachParticle", INI::parseParticleSystemTemplate, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleSystem ) }, - { "AttachParticleBone", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleBone ) }, - { "AttachParticleLoc", INI::parseCoord3D, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleLoc ) }, - { "BladeObjectName", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeObjectName ) }, - { "BladeBoneName", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeBone ) }, - { "OCLEjectPilot", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclEjectPilot ) }, - { "FXBlade", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxBlade ) }, - { "OCLBlade", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclBlade ) }, - { "FXHitGround", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxHitGround ) }, - { "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclHitGround ) }, - { "FXFinalBlowUp", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, - { "OCLFinalBlowUp", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, - { "DelayFromGroundToFinalDeath", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_delayFromGroundToFinalDeath ) }, - { "FinalRubbleObject", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_finalRubbleObject ) }, - { "SoundDeathLoop", INI::parseAudioEventRTS, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_deathSound) }, - { "MaxBraking", INI::parseAccelerationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBraking) }, - - { 0, 0, 0, 0 } + { "SpiralOrbitTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitTurnRate ) }, + { "SpiralOrbitForwardSpeed", INI::parseVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeed ) }, + { "SpiralOrbitForwardSpeedDamping", INI::parseReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) }, + { "MinSelfSpin", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minSelfSpin ) }, + { "MaxSelfSpin", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxSelfSpin ) }, + { "SelfSpinUpdateDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateDelay ) }, + { "SelfSpinUpdateAmount", INI::parseAngleReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateAmount ) }, + { "FallHowFast", INI::parsePercentToReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fallHowFast ) }, + { "MinBladeFlyOffDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minBladeFlyOffDelay ) }, + { "MaxBladeFlyOffDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBladeFlyOffDelay ) }, + { "AttachParticle", INI::parseParticleSystemTemplate, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleSystem ) }, + { "AttachParticleBone", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleBone ) }, + { "AttachParticleLoc", INI::parseCoord3D, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleLoc ) }, + { "BladeObjectName", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeObjectName ) }, + { "BladeBoneName", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeBone ) }, + { "OCLEjectPilot", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclEjectPilot ) }, + { "FXBlade", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxBlade ) }, + { "OCLBlade", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclBlade ) }, + { "FXHitGround", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxHitGround ) }, + { "OCLHitGround", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclHitGround ) }, + { "FXFinalBlowUp", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, + { "OCLFinalBlowUp", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, + { "DelayFromGroundToFinalDeath", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_delayFromGroundToFinalDeath ) }, + { "FinalRubbleObject", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_finalRubbleObject ) }, + { "SoundDeathLoop", INI::parseAudioEventRTS, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_deathSound) }, + { "MaxBraking", INI::parseAccelerationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBraking) }, + + { nullptr, nullptr, nullptr, 0 } }; @@ -244,7 +244,7 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) { Coord3D pos; - if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, NULL, 1 ) ) + if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, nullptr, 1 ) ) pSys->setPosition( &pos ); } @@ -384,8 +384,8 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) if( draw ) { - draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, NULL, 1 ); - draw->convertBonePosToWorldPos( &bladePos, NULL, &bladePos, NULL ); + draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, nullptr, 1 ); + draw->convertBonePosToWorldPos( &bladePos, nullptr, &bladePos, nullptr ); } @@ -395,7 +395,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // run the fx at the blade position FXList::doFXPos( modData->m_fxBlade, &bladePos ); - ObjectCreationList::create( modData->m_oclBlade, copter, &bladePos, NULL ); + ObjectCreationList::create( modData->m_oclBlade, copter, &bladePos, nullptr ); // // if we have (potentially) a pilot ejection, do it here. @@ -403,7 +403,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // because the former makes the right sounds, and also constrains to veteran-or-better status. // if( modData->m_oclEjectPilot && copter->getVeterancyLevel() > LEVEL_REGULAR ) - EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, NULL ); + EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, nullptr ); } @@ -449,7 +449,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // make hit ground effect FXList::doFXObj( modData->m_fxHitGround, copter ); - ObjectCreationList::create( modData->m_oclHitGround, copter, NULL ); + ObjectCreationList::create( modData->m_oclHitGround, copter, nullptr ); // hold the copter in place now copter->setDisabled( DISABLED_HELD ); @@ -472,7 +472,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // make effect FXList::doFXObj( modData->m_fxFinalBlowUp, copter ); - ObjectCreationList::create( modData->m_oclFinalBlowUp, copter, NULL ); + ObjectCreationList::create( modData->m_oclFinalBlowUp, copter, nullptr ); // we are now all done, destroy us and make a rubble shell copter const ThingTemplate* ttn = TheThingFactory->findTemplate(modData->m_finalRubbleObject); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index c71120c2557..d5e506481fb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -57,7 +57,7 @@ HijackerUpdate::HijackerUpdate( Thing *thing, const ModuleData *moduleData ) : U setIsInVehicle( FALSE ); m_wasTargetAirborne = false; m_ejectPos.zero(); -// m_ejectPilotDMI = NULL; +// m_ejectPilotDMI = nullptr; } //------------------------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ UpdateSleepTime HijackerUpdate::update( void ) } - setTargetObject( NULL ); + setTargetObject( nullptr ); setIsInVehicle( FALSE ); setUpdate( FALSE ); m_wasTargetAirborne = false; @@ -174,9 +174,9 @@ void HijackerUpdate::setTargetObject( const Object *object ) // here we also test the target to see whether it ejects pilots // when it dies... if so, stores a pointer to that diemoduleinterface - // NULL if not... + // nullptr if not... -// BehaviorModule **dmi = NULL; +// BehaviorModule **dmi = nullptr; // for( dmi = object->getBehaviorModules(); *dmi; ++dmi ) // { // m_ejectPilotDMI = (*dmi)->getEjectPilotDieInterface(); @@ -187,7 +187,7 @@ void HijackerUpdate::setTargetObject( const Object *object ) else { m_targetID = INVALID_ID; -// m_ejectPilotDMI = NULL; +// m_ejectPilotDMI = nullptr; } } @@ -198,7 +198,7 @@ Object* HijackerUpdate::getTargetObject() const { return TheGameLogic->findObjectByID( m_targetID ); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index 9d1be6984d3..f8dd42765c1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -57,7 +57,7 @@ static HordeUpdateInterface* getHUI(Object* obj) if( hui ) return hui; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -132,17 +132,17 @@ HordeUpdateModuleData::HordeUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "UpdateRate", INI::parseDurationUnsignedInt, NULL, offsetof(HordeUpdateModuleData, m_updateRate) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof(HordeUpdateModuleData, m_kindof) }, - { "Count", INI::parseInt, NULL, offsetof(HordeUpdateModuleData, m_minCount) }, - { "Radius", INI::parseReal, NULL, offsetof(HordeUpdateModuleData, m_minDist) }, - { "RubOffRadius", INI::parseReal, NULL, offsetof(HordeUpdateModuleData, m_rubOffRadius) }, - { "AlliesOnly", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_alliesOnly) }, - { "ExactMatch", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_exactMatch) }, + { "UpdateRate", INI::parseDurationUnsignedInt, nullptr, offsetof(HordeUpdateModuleData, m_updateRate) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof(HordeUpdateModuleData, m_kindof) }, + { "Count", INI::parseInt, nullptr, offsetof(HordeUpdateModuleData, m_minCount) }, + { "Radius", INI::parseReal, nullptr, offsetof(HordeUpdateModuleData, m_minDist) }, + { "RubOffRadius", INI::parseReal, nullptr, offsetof(HordeUpdateModuleData, m_rubOffRadius) }, + { "AlliesOnly", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_alliesOnly) }, + { "ExactMatch", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_exactMatch) }, { "Action", INI::parseIndexList, TheHordeActionTypeNames, offsetof(HordeUpdateModuleData, m_action) }, - { "FlagSubObjectNames", INI::parseAsciiStringVector, NULL, offsetof(HordeUpdateModuleData, m_flagSubObjNames) }, - { "AllowedNationalism", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_allowedNationalism) }, - { 0, 0, 0, 0 } + { "FlagSubObjectNames", INI::parseAsciiStringVector, nullptr, offsetof(HordeUpdateModuleData, m_flagSubObjNames) }, + { "AllowedNationalism", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_allowedNationalism) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -257,7 +257,7 @@ UpdateSleepTime HordeUpdate::update( void ) m_lastHordeRefreshFrame = TheGameLogic->getFrame(); PartitionFilterHordeMember hmFilter(getObject(), md); - PartitionFilter *filters[] = { &hmFilter, NULL }; + PartitionFilter *filters[] = { &hmFilter, nullptr }; SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(getObject(), md->m_minDist, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); @@ -275,7 +275,7 @@ UpdateSleepTime HordeUpdate::update( void ) for (Object* other = iter->first(); other; other = iter->next()) { HordeUpdateInterface* hui = getHUI(other); - if ( hui != NULL && hui->isTrueHordeMember() ) + if ( hui != nullptr && hui->isTrueHordeMember() ) { Real dist = ThePartitionManager->getDistanceSquared(getObject(), other, FROM_CENTER_2D); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index 8b4a9b4ed72..6c323c786f5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -55,11 +55,11 @@ LaserUpdateModuleData::LaserUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "MuzzleParticleSystem", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_particleSystemName ) }, - { "TargetParticleSystem", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_targetParticleSystemName ) }, - { "ParentFireBoneName", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_parentFireBoneName ) }, - { "ParentFireBoneOnTurret", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_parentFireBoneOnTurret ) }, - { 0, 0, 0, 0 } + { "MuzzleParticleSystem", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_particleSystemName ) }, + { "TargetParticleSystem", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_targetParticleSystemName ) }, + { "ParentFireBoneName", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_parentFireBoneName ) }, + { "ParentFireBoneOnTurret", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_parentFireBoneOnTurret ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -210,7 +210,7 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons // Override startPos with the logic bone position if( data->m_parentFireBoneOnTurret ) { - if( !parent->getSingleLogicalBonePositionOnTurret( TURRET_MAIN, data->m_parentFireBoneName.str(), &m_startPos, NULL ) ) + if( !parent->getSingleLogicalBonePositionOnTurret( TURRET_MAIN, data->m_parentFireBoneName.str(), &m_startPos, nullptr ) ) { // failed to find the required bone, so just die TheGameClient->destroyDrawable( getDrawable() ); @@ -219,7 +219,7 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons } else { - if( !parent->getSingleLogicalBonePosition( data->m_parentFireBoneName.str(), &m_startPos, NULL ) ) + if( !parent->getSingleLogicalBonePosition( data->m_parentFireBoneName.str(), &m_startPos, nullptr ) ) { // failed to find the required bone, so just die TheGameClient->destroyDrawable( getDrawable() ); @@ -240,7 +240,7 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons } //Compute endPos - if( endPos != NULL ) + if( endPos != nullptr ) { // just use what they gave, no override here m_endPos = *endPos; @@ -321,7 +321,7 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons Real LaserUpdate::getTemplateLaserRadius() const { const Drawable *draw = getDrawable(); - const LaserDrawInterface* ldi = NULL; + const LaserDrawInterface* ldi = nullptr; for( const DrawModule** d = draw->getDrawModules(); *d; ++d ) { ldi = (*d)->getLaserDrawInterface(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp index 071f32af641..12a42996011 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp @@ -135,7 +135,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) } Object *master = TheGameLogic->findObjectByID( m_slaver ); - if( master == NULL ) + if( master == nullptr ) { stopSlavedEffects(); @@ -304,7 +304,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) if ( masterAI->isIdle() ) // if controlling player has pressed stop, we stop! That's it! { myAI->aiIdle(CMD_FROM_AI); - primaryVictim = NULL; + primaryVictim = nullptr; m_primaryVictimID = INVALID_ID; return UPDATE_SLEEP_NONE; } @@ -339,7 +339,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) } else { - DEBUG_ASSERTCRASH(( spawnerBehavior != NULL ),("Hey!, why for this mob member got no spawner? MLorenzen")); + DEBUG_ASSERTCRASH(( spawnerBehavior != nullptr ),("Hey!, why for this mob member got no spawner? MLorenzen")); } } @@ -378,7 +378,7 @@ void MobMemberSlavedUpdate::doCatchUpLogic( Coord3D *pos ) //------------------------------------------------------------------------------------------------- void MobMemberSlavedUpdate::startSlavedEffects( const Object *slaver ) { - if( slaver == NULL ) + if( slaver == nullptr ) return; m_slaver = slaver->getID(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp index c7b1b9abfa1..323f3e62b30 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp @@ -69,7 +69,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule } m_scorchSize = 0.0f; - m_fxList = NULL; + m_fxList = nullptr; } @@ -82,100 +82,100 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule static const FieldParse dataFieldParse[] = { - { "ScorchMarkSize", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_scorchSize ) }, - { "FXList", INI::parseFXList, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_fxList ) }, - - { "Blast1Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].enabled ) }, - { "Blast1Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].delay ) }, - { "Blast1ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].scorchDelay ) }, - { "Blast1InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].innerRadius ) }, - { "Blast1OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].outerRadius ) }, - { "Blast1MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].maxDamage ) }, - { "Blast1MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].minDamage ) }, - { "Blast1ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) }, - { "Blast1PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) }, - - { "Blast2Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].enabled ) }, - { "Blast2Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].delay ) }, - { "Blast2ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].scorchDelay ) }, - { "Blast2InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].innerRadius ) }, - { "Blast2OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].outerRadius ) }, - { "Blast2MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].maxDamage ) }, - { "Blast2MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].minDamage ) }, - { "Blast2ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) }, - { "Blast2PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) }, - - { "Blast3Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].enabled ) }, - { "Blast3Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].delay ) }, - { "Blast3ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].scorchDelay ) }, - { "Blast3InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].innerRadius ) }, - { "Blast3OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].outerRadius ) }, - { "Blast3MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].maxDamage ) }, - { "Blast3MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].minDamage ) }, - { "Blast3ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) }, - { "Blast3PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) }, - - { "Blast4Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].enabled ) }, - { "Blast4Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].delay ) }, - { "Blast4ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].scorchDelay ) }, - { "Blast4InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].innerRadius ) }, - { "Blast4OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].outerRadius ) }, - { "Blast4MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].maxDamage ) }, - { "Blast4MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].minDamage ) }, - { "Blast4ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) }, - { "Blast4PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) }, - - { "Blast5Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].enabled ) }, - { "Blast5Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].delay ) }, - { "Blast5ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].scorchDelay ) }, - { "Blast5InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].innerRadius ) }, - { "Blast5OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].outerRadius ) }, - { "Blast5MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].maxDamage ) }, - { "Blast5MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].minDamage ) }, - { "Blast5ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) }, - { "Blast5PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) }, - - { "Blast6Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].enabled ) }, - { "Blast6Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].delay ) }, - { "Blast6ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].scorchDelay ) }, - { "Blast6InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].innerRadius ) }, - { "Blast6OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].outerRadius ) }, - { "Blast6MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].maxDamage ) }, - { "Blast6MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].minDamage ) }, - { "Blast6ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) }, - { "Blast6PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) }, - - { "Blast7Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].enabled ) }, - { "Blast7Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].delay ) }, - { "Blast7ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].scorchDelay ) }, - { "Blast7InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].innerRadius ) }, - { "Blast7OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].outerRadius ) }, - { "Blast7MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].maxDamage ) }, - { "Blast7MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].minDamage ) }, - { "Blast7ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) }, - { "Blast7PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) }, - - { "Blast8Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].enabled ) }, - { "Blast8Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].delay ) }, - { "Blast8ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].scorchDelay ) }, - { "Blast8InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].innerRadius ) }, - { "Blast8OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].outerRadius ) }, - { "Blast8MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].maxDamage ) }, - { "Blast8MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].minDamage ) }, - { "Blast8ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) }, - { "Blast8PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) }, - - { "Blast9Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].enabled ) }, - { "Blast9Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].delay ) }, - { "Blast9ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].scorchDelay ) }, - { "Blast9InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].innerRadius ) }, - { "Blast9OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].outerRadius ) }, - { "Blast9MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].maxDamage ) }, - { "Blast9MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].minDamage ) }, - { "Blast9ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) }, - { "Blast9PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) }, - - { 0, 0, 0, 0 } + { "ScorchMarkSize", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_scorchSize ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_fxList ) }, + + { "Blast1Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].enabled ) }, + { "Blast1Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].delay ) }, + { "Blast1ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].scorchDelay ) }, + { "Blast1InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].innerRadius ) }, + { "Blast1OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].outerRadius ) }, + { "Blast1MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].maxDamage ) }, + { "Blast1MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].minDamage ) }, + { "Blast1ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) }, + { "Blast1PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) }, + + { "Blast2Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].enabled ) }, + { "Blast2Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].delay ) }, + { "Blast2ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].scorchDelay ) }, + { "Blast2InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].innerRadius ) }, + { "Blast2OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].outerRadius ) }, + { "Blast2MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].maxDamage ) }, + { "Blast2MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].minDamage ) }, + { "Blast2ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) }, + { "Blast2PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) }, + + { "Blast3Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].enabled ) }, + { "Blast3Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].delay ) }, + { "Blast3ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].scorchDelay ) }, + { "Blast3InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].innerRadius ) }, + { "Blast3OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].outerRadius ) }, + { "Blast3MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].maxDamage ) }, + { "Blast3MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].minDamage ) }, + { "Blast3ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) }, + { "Blast3PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) }, + + { "Blast4Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].enabled ) }, + { "Blast4Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].delay ) }, + { "Blast4ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].scorchDelay ) }, + { "Blast4InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].innerRadius ) }, + { "Blast4OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].outerRadius ) }, + { "Blast4MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].maxDamage ) }, + { "Blast4MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].minDamage ) }, + { "Blast4ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) }, + { "Blast4PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) }, + + { "Blast5Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].enabled ) }, + { "Blast5Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].delay ) }, + { "Blast5ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].scorchDelay ) }, + { "Blast5InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].innerRadius ) }, + { "Blast5OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].outerRadius ) }, + { "Blast5MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].maxDamage ) }, + { "Blast5MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].minDamage ) }, + { "Blast5ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) }, + { "Blast5PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) }, + + { "Blast6Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].enabled ) }, + { "Blast6Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].delay ) }, + { "Blast6ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].scorchDelay ) }, + { "Blast6InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].innerRadius ) }, + { "Blast6OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].outerRadius ) }, + { "Blast6MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].maxDamage ) }, + { "Blast6MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].minDamage ) }, + { "Blast6ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) }, + { "Blast6PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) }, + + { "Blast7Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].enabled ) }, + { "Blast7Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].delay ) }, + { "Blast7ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].scorchDelay ) }, + { "Blast7InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].innerRadius ) }, + { "Blast7OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].outerRadius ) }, + { "Blast7MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].maxDamage ) }, + { "Blast7MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].minDamage ) }, + { "Blast7ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) }, + { "Blast7PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) }, + + { "Blast8Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].enabled ) }, + { "Blast8Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].delay ) }, + { "Blast8ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].scorchDelay ) }, + { "Blast8InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].innerRadius ) }, + { "Blast8OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].outerRadius ) }, + { "Blast8MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].maxDamage ) }, + { "Blast8MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].minDamage ) }, + { "Blast8ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) }, + { "Blast8PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) }, + + { "Blast9Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].enabled ) }, + { "Blast9Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].delay ) }, + { "Blast9ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].scorchDelay ) }, + { "Blast9InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].innerRadius ) }, + { "Blast9OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].outerRadius ) }, + { "Blast9MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].maxDamage ) }, + { "Blast9MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].minDamage ) }, + { "Blast9ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) }, + { "Blast9PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -294,7 +294,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) { // sanity - if( blastInfo == NULL ) + if( blastInfo == nullptr ) return; // get the module data @@ -317,7 +317,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( missilePos, blastInfo->outerRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; const Coord3D *otherPos; @@ -413,7 +413,7 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo { // sanity - if( blastInfo == NULL ) + if( blastInfo == nullptr ) return; // get the module data @@ -429,7 +429,7 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( missilePos, blastInfo->outerRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; for( other = iter->first(); other; other = iter->next() ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp index f7f728ab4ec..c34e51fb0b8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp @@ -62,8 +62,8 @@ NeutronMissileUpdateModuleData::NeutronMissileUpdateModuleData() m_forwardDamping = 0; m_relativeSpeed = 1.0f; m_targetFromDirectlyAbove = 0.0f; - m_ignitionFX = NULL; - m_launchFX = NULL; + m_ignitionFX = nullptr; + m_launchFX = nullptr; m_specialAccelFactor = 1.0f; m_specialSpeedTime = 0; m_specialSpeedHeight = 0.0f; @@ -78,20 +78,20 @@ void NeutronMissileUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DistanceToTravelBeforeTurning", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_initialDist ) }, - { "MaxTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_maxTurnRate ) }, - { "ForwardDamping", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_forwardDamping ) }, - { "RelativeSpeed", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_relativeSpeed ) }, - { "TargetFromDirectlyAbove", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_targetFromDirectlyAbove ) }, - { "LaunchFX", INI::parseFXList, NULL, offsetof( NeutronMissileUpdateModuleData, m_launchFX ) }, - { "SpecialSpeedTime", INI::parseDurationUnsignedInt, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedTime ) }, - { "SpecialSpeedHeight", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedHeight ) }, - { "SpecialAccelFactor", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialAccelFactor ) }, - { "SpecialJitterDistance", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialJitterDistance ) }, - { "IgnitionFX", INI::parseFXList, NULL, offsetof( NeutronMissileUpdateModuleData, m_ignitionFX ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalRadius ) }, - { 0, 0, 0, 0 } + { "DistanceToTravelBeforeTurning", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_initialDist ) }, + { "MaxTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_maxTurnRate ) }, + { "ForwardDamping", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_forwardDamping ) }, + { "RelativeSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_relativeSpeed ) }, + { "TargetFromDirectlyAbove", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_targetFromDirectlyAbove ) }, + { "LaunchFX", INI::parseFXList, nullptr, offsetof( NeutronMissileUpdateModuleData, m_launchFX ) }, + { "SpecialSpeedTime", INI::parseDurationUnsignedInt, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedTime ) }, + { "SpecialSpeedHeight", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedHeight ) }, + { "SpecialAccelFactor", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialAccelFactor ) }, + { "SpecialJitterDistance", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialJitterDistance ) }, + { "IgnitionFX", INI::parseFXList, nullptr, offsetof( NeutronMissileUpdateModuleData, m_ignitionFX ) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -124,7 +124,7 @@ NeutronMissileUpdate::NeutronMissileUpdate( Thing *thing, const ModuleData* modu m_heightAtLaunch = 0; m_frameAtLaunch = 0; - m_exhaustSysTmpl = NULL; + m_exhaustSysTmpl = nullptr; } @@ -204,7 +204,7 @@ void NeutronMissileUpdate::doLaunch( void ) Object *launcher = TheGameLogic->findObjectByID( m_launcherID ); // if our launch vehicle is gone, destroy ourselves - if (launcher == NULL) + if (launcher == nullptr) { m_launcherID = INVALID_ID; TheGameLogic->destroyObject( getObject() ); @@ -213,14 +213,14 @@ void NeutronMissileUpdate::doLaunch( void ) Matrix3D attachTransform; if (!launcher->getDrawable() || - !launcher->getDrawable()->getProjectileLaunchOffset(m_attach_wslot, m_attach_specificBarrelToUse, &attachTransform, TURRET_INVALID, NULL)) + !launcher->getDrawable()->getProjectileLaunchOffset(m_attach_wslot, m_attach_specificBarrelToUse, &attachTransform, TURRET_INVALID, nullptr)) { DEBUG_CRASH(("ProjectileLaunchPos %d %d not found!",m_attach_wslot, m_attach_specificBarrelToUse)); attachTransform.Make_Identity(); } Matrix3D worldTransform; - launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); + launcher->convertBonePosToWorldPos(nullptr, &attachTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); Coord3D worldPos; @@ -264,7 +264,7 @@ void NeutronMissileUpdate::doLaunch( void ) FXList::doFXObj(getNeutronMissileUpdateModuleData()->m_ignitionFX, getObject()); - if (m_exhaustSysTmpl != NULL) + if (m_exhaustSysTmpl != nullptr) TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject()); m_state = ATTACK; @@ -383,7 +383,7 @@ void NeutronMissileUpdate::doAttack( void ) UnsignedInt now = TheGameLogic->getFrame(); if (d->m_specialSpeedTime > 0 && now <= m_frameAtLaunch + d->m_specialSpeedTime) { - getObject()->getDrawable()->setInstanceMatrix(NULL); + getObject()->getDrawable()->setInstanceMatrix(nullptr); UnsignedInt elapsed = now - m_frameAtLaunch; if (elapsed < d->m_specialSpeedTime) { @@ -436,7 +436,7 @@ Bool NeutronMissileUpdate::projectileHandleCollision( Object *other ) return true; // Don't hit your own launcher, ever. - if (other != NULL && projectileGetLauncherID() == other->getID()) + if (other != nullptr && projectileGetLauncherID() == other->getID()) return true; // collided with something... blow'd up! @@ -524,7 +524,7 @@ UpdateSleepTime NeutronMissileUpdate::update( void ) Coord3D normal; normal.x = normal.y = 0.0f; normal.z = -1.0f; - getObject()->onCollide(NULL, getObject()->getPosition(), &normal); + getObject()->onCollide(nullptr, getObject()->getPosition(), &normal); } return UPDATE_SLEEP_NONE; } @@ -610,13 +610,13 @@ void NeutronMissileUpdate::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - // make system template NULL to be safe - m_exhaustSysTmpl = NULL; + // make system template nullptr to be safe + m_exhaustSysTmpl = nullptr; if( name.isEmpty() == FALSE ) { m_exhaustSysTmpl = TheParticleSystemManager->findTemplate( name ); - if( m_exhaustSysTmpl == NULL ) + if( m_exhaustSysTmpl == nullptr ) { DEBUG_CRASH(( "NeutronMissileUpdate::xfer - Unable to find particle system '%s'", name.str() )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp index ae5549043f2..23d1f5b4a53 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp @@ -44,7 +44,7 @@ OCLUpdateModuleData::OCLUpdateModuleData() { m_minDelay = 0; m_maxDelay = 0; - m_ocl = NULL; + m_ocl = nullptr; m_isCreateAtEdge = FALSE; } @@ -55,11 +55,11 @@ OCLUpdateModuleData::OCLUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OCL", INI::parseObjectCreationList, NULL, offsetof( OCLUpdateModuleData, m_ocl ) }, - { "MinDelay", INI::parseDurationUnsignedInt, NULL, offsetof( OCLUpdateModuleData, m_minDelay ) }, - { "MaxDelay", INI::parseDurationUnsignedInt, NULL, offsetof( OCLUpdateModuleData, m_maxDelay ) }, - { "CreateAtEdge", INI::parseBool, NULL, offsetof( OCLUpdateModuleData, m_isCreateAtEdge ) }, - { 0, 0, 0, 0 } + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( OCLUpdateModuleData, m_ocl ) }, + { "MinDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( OCLUpdateModuleData, m_minDelay ) }, + { "MaxDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( OCLUpdateModuleData, m_maxDelay ) }, + { "CreateAtEdge", INI::parseBool, nullptr, offsetof( OCLUpdateModuleData, m_isCreateAtEdge ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index 70860c672b7..0abaa7cafe0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -65,7 +65,7 @@ //------------------------------------------------------------------------------------------------- ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_beginChargeFrames = 0; m_raiseAntennaFrames = 0; m_readyDelayFrames = 0; @@ -76,8 +76,8 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() m_totalScorchMarks = 0; m_scorchMarkScalar = 1.0f; m_damageRadiusScalar = 1.0f; - m_groundHitFX = NULL; - m_beamLaunchFX = NULL; + m_groundHitFX = nullptr; + m_beamLaunchFX = nullptr; m_framesBetweenLaunchFXRefresh = 30; m_totalDamagePulses = 0; m_damagePerSecond = 0.0f; @@ -98,59 +98,59 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_specialPowerTemplate ) }, - { "BeginChargeTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beginChargeFrames ) }, - { "RaiseAntennaTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_raiseAntennaFrames ) }, - { "ReadyDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_readyDelayFrames ) }, - { "WidthGrowTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_widthGrowFrames ) }, - { "BeamTravelTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamTravelFrames ) }, - { "TotalFiringTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalFiringFrames ) }, - { "RevealRange", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_revealRange ) }, - - { "OuterEffectBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectBaseBoneName ) }, - { "OuterEffectNumBones", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectNumBones ) }, - { "OuterNodesLightFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesLightFlareParticleSystemName ) }, - { "OuterNodesMediumFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesMediumFlareParticleSystemName ) }, - { "OuterNodesIntenseFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesIntenseFlareParticleSystemName ) }, - - { "ConnectorBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorBoneName ) }, - { "ConnectorMediumLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumLaserNameName ) }, - { "ConnectorIntenseLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseLaserNameName ) }, - { "ConnectorMediumFlare", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumFlareParticleSystemName ) }, - { "ConnectorIntenseFlare", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseFlareParticleSystemName ) }, - - { "FireBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_fireBoneName ) }, - { "LaserBaseLightFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseLightFlareParticleSystemName ) }, - { "LaserBaseMediumFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseMediumFlareParticleSystemName ) }, - { "LaserBaseIntenseFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseIntenseFlareParticleSystemName ) }, - - { "ParticleBeamLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_particleBeamLaserName ) }, - - { "SwathOfDeathDistance", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathDistance ) }, - { "SwathOfDeathAmplitude", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathAmplitude ) }, - { "TotalScorchMarks", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalScorchMarks ) }, - { "ScorchMarkScalar", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_scorchMarkScalar ) }, - { "BeamLaunchFX", INI::parseFXList, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamLaunchFX ) }, - { "DelayBetweenLaunchFX", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_framesBetweenLaunchFXRefresh ) }, - { "GroundHitFX", INI::parseFXList, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_groundHitFX ) }, - - { "DamagePerSecond", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePerSecond ) }, - { "TotalDamagePulses", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalDamagePulses ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_specialPowerTemplate ) }, + { "BeginChargeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beginChargeFrames ) }, + { "RaiseAntennaTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_raiseAntennaFrames ) }, + { "ReadyDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_readyDelayFrames ) }, + { "WidthGrowTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_widthGrowFrames ) }, + { "BeamTravelTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamTravelFrames ) }, + { "TotalFiringTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalFiringFrames ) }, + { "RevealRange", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_revealRange ) }, + + { "OuterEffectBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectBaseBoneName ) }, + { "OuterEffectNumBones", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectNumBones ) }, + { "OuterNodesLightFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesLightFlareParticleSystemName ) }, + { "OuterNodesMediumFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesMediumFlareParticleSystemName ) }, + { "OuterNodesIntenseFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesIntenseFlareParticleSystemName ) }, + + { "ConnectorBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorBoneName ) }, + { "ConnectorMediumLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumLaserNameName ) }, + { "ConnectorIntenseLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseLaserNameName ) }, + { "ConnectorMediumFlare", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumFlareParticleSystemName ) }, + { "ConnectorIntenseFlare", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseFlareParticleSystemName ) }, + + { "FireBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_fireBoneName ) }, + { "LaserBaseLightFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseLightFlareParticleSystemName ) }, + { "LaserBaseMediumFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseMediumFlareParticleSystemName ) }, + { "LaserBaseIntenseFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseIntenseFlareParticleSystemName ) }, + + { "ParticleBeamLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_particleBeamLaserName ) }, + + { "SwathOfDeathDistance", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathDistance ) }, + { "SwathOfDeathAmplitude", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathAmplitude ) }, + { "TotalScorchMarks", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalScorchMarks ) }, + { "ScorchMarkScalar", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_scorchMarkScalar ) }, + { "BeamLaunchFX", INI::parseFXList, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamLaunchFX ) }, + { "DelayBetweenLaunchFX", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_framesBetweenLaunchFXRefresh ) }, + { "GroundHitFX", INI::parseFXList, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_groundHitFX ) }, + + { "DamagePerSecond", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePerSecond ) }, + { "TotalDamagePulses", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalDamagePulses ) }, { "DamageType", INI::parseIndexList, TheDamageNames, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageType ) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof( ParticleUplinkCannonUpdateModuleData, m_deathType ) }, - { "DamageRadiusScalar", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageRadiusScalar ) }, + { "DamageRadiusScalar", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageRadiusScalar ) }, - { "PoweringUpSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_powerupSoundName ) }, - { "UnpackToIdleSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_unpackToReadySoundName ) }, - { "FiringToPackSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_firingToIdleSoundName ) }, - { "GroundAnnihilationSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_annihilationSoundName ) }, - { "DamagePulseRemnantObjectName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePulseRemnantObjectName ) }, + { "PoweringUpSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_powerupSoundName ) }, + { "UnpackToIdleSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_unpackToReadySoundName ) }, + { "FiringToPackSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_firingToIdleSoundName ) }, + { "GroundAnnihilationSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_annihilationSoundName ) }, + { "DamagePulseRemnantObjectName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePulseRemnantObjectName ) }, - { "ManualDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) }, - { "ManualFastDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) }, - { "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) }, + { "ManualDrivingSpeed", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) }, + { "ManualFastDrivingSpeed", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) }, + { "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -162,7 +162,7 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu m_status = STATUS_IDLE; m_laserStatus = LASERSTATUS_NONE; m_frames = 0; - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; m_groundToOrbitBeamID = INVALID_DRAWABLE_ID; m_orbitToTargetBeamID = INVALID_DRAWABLE_ID; m_connectorSystemID = INVALID_PARTICLE_SYSTEM_ID; @@ -274,7 +274,7 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow if( !BitIsSet( commandOptions, COMMAND_FIRED_BY_SCRIPT ) ) { - DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be NULL")); + DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be null")); //All human players have manual control and must "drive" the beam around! m_startAttackFrame = TheGameLogic->getFrame(); @@ -286,7 +286,7 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow } else { - DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be NULL")); + DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be null")); //All computer controlled players have automatic control -- the "S" curve. UnsignedInt now = TheGameLogic->getFrame(); @@ -566,7 +566,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ); if( update ) { - update->initLaser( NULL, &orbitPosition, &m_currentTargetPosition ); + update->initLaser( nullptr, &orbitPosition, &m_currentTargetPosition ); // TheSuperHackers @logic-client-separation The GameLogic has a dependency on this drawable. // The logical laser radius for the damage should probably be part of ParticleUplinkCannonUpdateModuleData. templateLaserRadius = update->getTemplateLaserRadius(); @@ -601,7 +601,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() //Generate iteration of fxlist for beam hitting ground. if( data->m_groundHitFX ) { - FXList::doFXPos( data->m_groundHitFX, &m_currentTargetPosition, NULL ); + FXList::doFXPos( data->m_groundHitFX, &m_currentTargetPosition, nullptr ); } //Also reveal vision because the owning player has full rights to watch the carnage he created! @@ -625,7 +625,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() damageInfo.in.m_deathType = data->m_deathType; PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &filterAlive, NULL }; + PartitionFilter *filters[] = { &filterAlive, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( &m_currentTargetPosition, damageRadius, FROM_CENTER_2D, filters ); MemoryPoolObjectHolder hold( iter ); @@ -696,7 +696,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() //Generate iteration of fxlist for beam launching if( data->m_beamLaunchFX ) { - FXList::doFXPos( data->m_beamLaunchFX, &m_laserOriginPosition, NULL ); + FXList::doFXPos( data->m_beamLaunchFX, &m_laserOriginPosition, nullptr ); } m_nextLaunchFXFrame = now + data->m_framesBetweenLaunchFXRefresh; } @@ -812,7 +812,7 @@ void ParticleUplinkCannonUpdate::createConnectorLasers( IntensityTypes intensity LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ); if( update ) { - update->initLaser( NULL, &m_outerNodePositions[ i ], &m_connectorNodePosition ); + update->initLaser( nullptr, &m_outerNodePositions[ i ], &m_connectorNodePosition ); } } } @@ -920,7 +920,7 @@ void ParticleUplinkCannonUpdate::createGroundToOrbitLaser( UnsignedInt growthFra Coord3D orbitPosition; orbitPosition.set( &m_laserOriginPosition ); orbitPosition.z += 500.0f; - update->initLaser( NULL, &m_laserOriginPosition, &orbitPosition, growthFrames ); + update->initLaser( nullptr, &m_laserOriginPosition, &orbitPosition, growthFrames ); } } } @@ -959,7 +959,7 @@ void ParticleUplinkCannonUpdate::createOrbitToTargetLaser( UnsignedInt growthFra Coord3D orbitPosition; orbitPosition.set( &m_initialTargetPosition ); orbitPosition.z += 500.0f; - update->initLaser( NULL, &orbitPosition, &m_initialTargetPosition, growthFrames ); + update->initLaser( nullptr, &orbitPosition, &m_initialTargetPosition, growthFrames ); } } } @@ -1449,11 +1449,11 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) { Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); - if( drawable != NULL ) + if( drawable != nullptr ) { static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); - if( update != NULL ) + if( update != nullptr ) { m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 36dd8619c9d..f161a6046bc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -149,26 +149,26 @@ static void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, con static const FieldParse dataFieldParse[] = { - { "Mass", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_mass ) }, + { "Mass", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_mass ) }, - { "ForwardFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_forwardFriction ) }, - { "LateralFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_lateralFriction ) }, - { "ZFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_ZFriction ) }, - { "AerodynamicFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_aerodynamicFriction ) }, + { "ForwardFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_forwardFriction ) }, + { "LateralFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_lateralFriction ) }, + { "ZFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_ZFriction ) }, + { "AerodynamicFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_aerodynamicFriction ) }, - { "CenterOfMassOffset", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_centerOfMassOffset ) }, - { "AllowBouncing", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_allowBouncing ) }, - { "AllowCollideForce", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_allowCollideForce ) }, - { "KillWhenRestingOnGround", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_killWhenRestingOnGround) }, + { "CenterOfMassOffset", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_centerOfMassOffset ) }, + { "AllowBouncing", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_allowBouncing ) }, + { "AllowCollideForce", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_allowCollideForce ) }, + { "KillWhenRestingOnGround", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_killWhenRestingOnGround) }, - { "MinFallHeightForDamage", parseHeightToSpeed, NULL, offsetof( PhysicsBehaviorModuleData, m_minFallSpeedForDamage) }, - { "FallHeightDamageFactor", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_fallHeightDamageFactor) }, - { "PitchRollYawFactor", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_pitchRollYawFactor) }, + { "MinFallHeightForDamage", parseHeightToSpeed, nullptr, offsetof( PhysicsBehaviorModuleData, m_minFallSpeedForDamage) }, + { "FallHeightDamageFactor", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_fallHeightDamageFactor) }, + { "PitchRollYawFactor", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_pitchRollYawFactor) }, - { "VehicleCrashesIntoBuildingWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoBuildingWeaponTemplate) }, - { "VehicleCrashesIntoNonBuildingWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoNonBuildingWeaponTemplate) }, + { "VehicleCrashesIntoBuildingWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoBuildingWeaponTemplate) }, + { "VehicleCrashesIntoNonBuildingWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoNonBuildingWeaponTemplate) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -205,8 +205,8 @@ PhysicsBehavior::PhysicsBehavior( Thing *thing, const ModuleData* moduleData ) : setAllowBouncing(getPhysicsBehaviorModuleData()->m_allowBouncing); setAllowCollideForce(getPhysicsBehaviorModuleData()->m_allowCollideForce); - m_pui = NULL; - m_bounceSound = NULL; + m_pui = nullptr; + m_bounceSound = nullptr; #ifdef SLEEPY_PHYSICS setWakeFrame(getObject(), UPDATE_SLEEP_NONE); @@ -217,15 +217,15 @@ PhysicsBehavior::PhysicsBehavior( Thing *thing, const ModuleData* moduleData ) : static ProjectileUpdateInterface* getPui(Object* obj) { if (!obj->isKindOf(KINDOF_PROJECTILE)) - return NULL; + return nullptr; - ProjectileUpdateInterface* objPui = NULL; + ProjectileUpdateInterface* objPui = nullptr; for (BehaviorModule** u = obj->getBehaviorModules(); *u; ++u) { - if ((objPui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((objPui = (*u)->getProjectileUpdateInterface()) != nullptr) return objPui; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -238,7 +238,7 @@ void PhysicsBehavior::onObjectCreated() PhysicsBehavior::~PhysicsBehavior() { deleteInstance(m_bounceSound); - m_bounceSound = NULL; + m_bounceSound = nullptr; } //------------------------------------------------------------------------------------------------- @@ -514,7 +514,7 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) { if (bounceSound) { - if (m_bounceSound == NULL) + if (m_bounceSound == nullptr) m_bounceSound = newInstance(DynamicAudioEventRTS); m_bounceSound->m_event = *bounceSound; @@ -522,7 +522,7 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) else { deleteInstance(m_bounceSound); - m_bounceSound = NULL; + m_bounceSound = nullptr; } } @@ -719,7 +719,7 @@ UpdateSleepTime PhysicsBehavior::update() Coord3D normal; normal.x = normal.y = 0.0f; normal.z = -1.0f; - obj->onCollide(NULL, obj->getPosition(), &normal); + obj->onCollide(nullptr, obj->getPosition(), &normal); // // don't bother trying to remember how far we've fallen; instead, @@ -731,7 +731,7 @@ UpdateSleepTime PhysicsBehavior::update() // Real netSpeed = -activeVelZ - d->m_minFallSpeedForDamage; - if (netSpeed > 0.0f && m_pui == NULL) + if (netSpeed > 0.0f && m_pui == nullptr) { // only apply force if it's a pretty steep fall, so that things // going down hills don't injure themselves (unless the hill is really steep) @@ -873,13 +873,13 @@ Real PhysicsBehavior::getForwardSpeed3D() const //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::isCurrentlyOverlapped(Object *obj) const { - return obj != NULL && obj->getID() == m_currentOverlap; + return obj != nullptr && obj->getID() == m_currentOverlap; } //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::wasPreviouslyOverlapped(Object *obj) const { - return obj != NULL && obj->getID() == m_previousOverlap; + return obj != nullptr && obj->getID() == m_previousOverlap; } //------------------------------------------------------------------------------------------------- @@ -933,7 +933,7 @@ void PhysicsBehavior::addOverlap(Object *obj) //------------------------------------------------------------------------------------------------- void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const { - if (that != NULL) + if (that != nullptr) { that->m_vel.add(&m_vel); that->m_velMag = INVALID_VEL_MAG; @@ -943,7 +943,7 @@ void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const //------------------------------------------------------------------------------------------------- void PhysicsBehavior::addVelocityTo( const Coord3D *vel) { - if (vel != NULL) + if (vel != nullptr) m_vel.add( vel ); } @@ -1034,7 +1034,7 @@ void PhysicsBehavior::doBounceSound(const Coord3D& prevPos) void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { //USE_PERF_TIMER(PhysicsBehavioronCollide) - if (m_pui != NULL) + if (m_pui != nullptr) { // projectiles always get a chance to handle their own collisions, and not go thru here if (m_pui->projectileHandleCollision(other)) @@ -1046,7 +1046,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 Object* objContainedBy = obj->getContainedBy(); // Note that other == null means "collide with ground" - if (other == NULL) + if (other == nullptr) { // if we are in a container, tell the container we collided with the ground. // (handy for parachutes.) @@ -1073,7 +1073,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 // ignore collisions with our "ignore" thingie, if any (and vice versa) AIUpdateInterface* ai = obj->getAIUpdateInterface(); - if (ai != NULL && ai->getIgnoredObstacleID() == other->getID()) + if (ai != nullptr && ai->getIgnoredObstacleID() == other->getID()) { /// @todo srj -- what the hell is this code doing here? ack! //Before we return, check for a very special case of an infantry colliding with an unmanned vehicle. @@ -1101,7 +1101,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 } AIUpdateInterface* aiOther = other->getAIUpdateInterface(); - if (aiOther != NULL && aiOther->getIgnoredObstacleID() == obj->getID()) + if (aiOther != nullptr && aiOther->getIgnoredObstacleID() == obj->getID()) { return; } @@ -1213,7 +1213,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 // don't let us intersect buildings. cheat. applying a force won't work // cuz we are usually braking. jam it. Object* objToBounce = obj; - while (objToBounce->getContainedBy() != NULL) + while (objToBounce->getContainedBy() != nullptr) objToBounce = objToBounce->getContainedBy(); Real bounceOutDist = usRadius * 0.1f; @@ -1346,7 +1346,7 @@ Bool PhysicsBehavior::checkForOverlapCollision(Object *other) // grab physics modules if there PhysicsBehavior *crusherPhysics = this; - if( crusherPhysics == NULL ) + if( crusherPhysics == nullptr ) { return false; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp index e82f830db91..a36e435d485 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp @@ -66,10 +66,10 @@ PilotFindVehicleUpdateModuleData::PilotFindVehicleUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_scanRange ) }, - { "MinHealth", INI::parseReal, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_minHealth ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_scanRange ) }, + { "MinHealth", INI::parseReal, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_minHealth ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -109,7 +109,7 @@ UpdateSleepTime PilotFindVehicleUpdate::update() const PilotFindVehicleUpdateModuleData *data = getPilotFindVehicleUpdateModuleData(); AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) return UPDATE_SLEEP_FOREVER; + if (ai==nullptr) return UPDATE_SLEEP_FOREVER; if( !ai->isIdle() ) { @@ -149,7 +149,7 @@ Object* PilotFindVehicleUpdate::scanClosestTarget() filters[1] = &aliveFilter; filters[2] = &playerFilter; filters[3] = &filterMapStatus; - filters[4] = NULL; + filters[4] = nullptr; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( me->getPosition(), data->m_scanRange, FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR ); @@ -178,7 +178,7 @@ Object* PilotFindVehicleUpdate::scanClosestTarget() } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp index f8ed7a44af1..a088d16f1bb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp @@ -51,7 +51,7 @@ //------------------------------------------------------------------------------------------------- PointDefenseLaserUpdateModuleData::PointDefenseLaserUpdateModuleData() { - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; m_scanFrames = 0; m_scanRange = 0.0f; m_velocityFactor = 0.0f; @@ -64,13 +64,13 @@ PointDefenseLaserUpdateModuleData::PointDefenseLaserUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "WeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_weaponTemplate ) }, - { "PrimaryTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_primaryTargetKindOf ) }, - { "SecondaryTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_secondaryTargetKindOf ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanRange ) }, - { "PredictTargetVelocityFactor", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) }, - { 0, 0, 0, 0 } + { "WeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_weaponTemplate ) }, + { "PrimaryTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_primaryTargetKindOf ) }, + { "SecondaryTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_secondaryTargetKindOf ) }, + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_scanRange ) }, + { "PredictTargetVelocityFactor", INI::parseReal, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -185,7 +185,7 @@ void PointDefenseLaserUpdate::fireWhenReady() { scanClosestTarget(); m_nextScanFrames = data->m_scanFrames; - target = NULL; //Set target to NULL so we don't shoot at it (might be out of range) + target = nullptr; //Set target to nullptr so we don't shoot at it (might be out of range) } } else @@ -242,8 +242,8 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() { const PointDefenseLaserUpdateModuleData *data = getPointDefenseLaserUpdateModuleData(); Object *me = getObject(); - Object *bestTargetOutOfRange[2] = { NULL, NULL }; - Object *bestTargetInRange[2] = { NULL, NULL }; + Object *bestTargetOutOfRange[2] = { nullptr, nullptr }; + Object *bestTargetInRange[2] = { nullptr, nullptr }; Real closestDist[2]; Real closestOutsideRange[2]; Int index; @@ -360,7 +360,7 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() //Utter failure -- nothing on the scope. m_bestTargetID = INVALID_ID; m_inRange = false; - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp index bfcab8950b7..500b6aad80c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp @@ -111,7 +111,7 @@ void QueueProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoorType PhysicsBehavior *newObjectPhysics = newObj->getPhysics(); PhysicsBehavior *myPhysics = creationObject->getPhysics(); - if( (myPhysics != NULL) && creationInAir && (newObjectPhysics != NULL) ) + if( (myPhysics != nullptr) && creationInAir && (newObjectPhysics != nullptr) ) { Coord3D startingForce = *myPhysics->getVelocity(); startingForce.x *= newObjectPhysics->getMass(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp index 2bf00757c5b..a330a09f1e6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp @@ -146,7 +146,7 @@ void SpawnPointProductionExitUpdate::initializeBonePositions() Drawable *myDrawable = me->getDrawable(); // This fundamental failure will result in this never ever thinking it is free - if( myDrawable == NULL ) + if( myDrawable == nullptr ) return; Matrix3D boneTransforms[MAX_SPAWN_POINTS]; @@ -156,13 +156,13 @@ void SpawnPointProductionExitUpdate::initializeBonePositions() // Get all the bones of the right name const SpawnPointProductionExitUpdateModuleData* md = getSpawnPointProductionExitUpdateModuleData(); - m_spawnPointCount = myDrawable->getPristineBonePositions( md->m_spawnPointBoneNameData.str(), 1, NULL, boneTransforms, MAX_SPAWN_POINTS ); + m_spawnPointCount = myDrawable->getPristineBonePositions( md->m_spawnPointBoneNameData.str(), 1, nullptr, boneTransforms, MAX_SPAWN_POINTS ); for( matrixIndex = 0; matrixIndex < m_spawnPointCount; matrixIndex++ ) { Matrix3D *currentTransform = &(boneTransforms[matrixIndex]); // Convert their matrix one by one - me->convertBonePosToWorldPos( NULL, currentTransform, NULL, currentTransform ); + me->convertBonePosToWorldPos( nullptr, currentTransform, nullptr, currentTransform ); // Then save the world coord and angle m_worldCoordSpawnPoints[matrixIndex].x = currentTransform->Get_X_Translation(); @@ -183,7 +183,7 @@ void SpawnPointProductionExitUpdate::revalidateOccupiers() if( m_spawnPointOccupier[positionIndex] == INVALID_ID ) continue; - if( TheGameLogic->findObjectByID( m_spawnPointOccupier[positionIndex] ) == NULL ) + if( TheGameLogic->findObjectByID( m_spawnPointOccupier[positionIndex] ) == nullptr ) m_spawnPointOccupier[positionIndex] = INVALID_ID; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 179b61d1395..8a1d6d75618 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -127,15 +127,15 @@ ProductionUpdateModuleData::ProductionUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "MaxQueueEntries", INI::parseInt, NULL, offsetof( ProductionUpdateModuleData, m_maxQueueEntries ) }, - { "NumDoorAnimations", INI::parseInt, NULL, offsetof( ProductionUpdateModuleData, m_numDoorAnimations ) }, - { "DoorOpeningTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorOpeningTime ) }, - { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorWaitOpenTime ) }, - { "DoorCloseTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorClosingTime ) }, - { "ConstructionCompleteDuration", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_constructionCompleteDuration ) }, - { "QuantityModifier", parseAppendQuantityModifier, NULL, offsetof( ProductionUpdateModuleData, m_quantityModifiers ) }, - { "DisabledTypesToProcess", DisabledMaskType::parseFromINI, NULL, offsetof( ProductionUpdateModuleData, m_disabledTypesToProcess ) }, - { 0, 0, 0, 0 } + { "MaxQueueEntries", INI::parseInt, nullptr, offsetof( ProductionUpdateModuleData, m_maxQueueEntries ) }, + { "NumDoorAnimations", INI::parseInt, nullptr, offsetof( ProductionUpdateModuleData, m_numDoorAnimations ) }, + { "DoorOpeningTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorOpeningTime ) }, + { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorWaitOpenTime ) }, + { "DoorCloseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorClosingTime ) }, + { "ConstructionCompleteDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_constructionCompleteDuration ) }, + { "QuantityModifier", parseAppendQuantityModifier, nullptr, offsetof( ProductionUpdateModuleData, m_quantityModifiers ) }, + { "DisabledTypesToProcess", DisabledMaskType::parseFromINI, nullptr, offsetof( ProductionUpdateModuleData, m_disabledTypesToProcess ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -151,13 +151,13 @@ ProductionEntry::ProductionEntry( void ) { m_type = PRODUCTION_INVALID; - m_objectToProduce = NULL; - m_upgradeToResearch = NULL; + m_objectToProduce = nullptr; + m_upgradeToResearch = nullptr; m_productionID = (ProductionID)1; m_percentComplete = 0.0f; m_framesUnderConstruction = 0; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; m_productionQuantityProduced = 0; m_productionQuantityTotal = 0; } @@ -179,8 +179,8 @@ ProductionUpdate::ProductionUpdate( Thing *thing, const ModuleData* moduleData ) UpdateModule( thing, moduleData ) { - m_productionQueue = NULL; - m_productionQueueTail = NULL; + m_productionQueue = nullptr; + m_productionQueueTail = nullptr; m_productionCount = 0; m_uniqueID = (ProductionID)1; for (Int i = 0; i < DOOR_COUNT_MAX; ++i) @@ -233,10 +233,10 @@ CanMakeType ProductionUpdate::canQueueCreateUnit( const ThingTemplate *unitType /// @todo srj -- this is horrible, but the "right" way to do it is to move // ProductionUpdate to be part of ParkingPlaceBehavior, which I don't currently // have time for... - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = getObject()->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) { if (pp->shouldReserveDoorWhenQueued(unitType) && !pp->hasAvailableSpaceFor(unitType)) return CANMAKE_PARKING_PLACES_FULL; @@ -257,7 +257,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return FALSE; // get the player @@ -326,7 +326,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; // get the player @@ -351,7 +351,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) } // sanity, entry not found - if( production == NULL ) + if( production == nullptr ) return; // refund money back to the player @@ -390,17 +390,17 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio /// @todo srj -- this is horrible, but the "right" way to do it is to move // ProductionUpdate to be part of ParkingPlaceBehavior, which I don't currently // have time for... - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = getObject()->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) { if (pp->shouldReserveDoorWhenQueued(unitType)) { ExitInterface* exitInterface = getObject()->getObjectExitInterface(); if (exitInterface) { - exitDoor = exitInterface->reserveDoorForExit(unitType, NULL); + exitDoor = exitInterface->reserveDoorForExit(unitType, nullptr); } if (exitDoor == DOOR_NONE_AVAILABLE) { @@ -651,7 +651,7 @@ UpdateSleepTime ProductionUpdate::update( void ) } // if nothing in the queue get outta here - if( production == NULL ) + if( production == nullptr ) return UPDATE_SLEEP_NONE; // @@ -668,7 +668,7 @@ UpdateSleepTime ProductionUpdate::update( void ) Player *player = us->getControllingPlayer(); // sanity - if( player == NULL ) + if( player == nullptr ) { // remove from queue list @@ -742,14 +742,14 @@ UpdateSleepTime ProductionUpdate::update( void ) ExitDoorType exitDoor = production->getExitDoor(); if (exitDoor == DOOR_NONE_AVAILABLE) { - exitDoor = exitInterface->reserveDoorForExit(production->m_objectToProduce, NULL); + exitDoor = exitInterface->reserveDoorForExit(production->m_objectToProduce, nullptr); production->setExitDoor(exitDoor); } if (exitDoor != DOOR_NONE_AVAILABLE) { // note, could be DOOR_NONE_NEEDED! so door could be null. (srj) - DoorInfo* door = (exitDoor >= 0 && exitDoor < DOOR_COUNT_MAX) ? &m_doors[exitDoor] : NULL; + DoorInfo* door = (exitDoor >= 0 && exitDoor < DOOR_COUNT_MAX) ? &m_doors[exitDoor] : nullptr; // // if the producing structure has a door opening animation we will set the condition @@ -757,7 +757,7 @@ UpdateSleepTime ProductionUpdate::update( void ) // that had us previously closing a door) // const ProductionUpdateModuleData *d = getProductionUpdateModuleData(); - if( d->m_numDoorAnimations > 0 && door != NULL ) + if( d->m_numDoorAnimations > 0 && door != nullptr ) { // if the door is closed, open it @@ -809,7 +809,7 @@ UpdateSleepTime ProductionUpdate::update( void ) // animations we will not make the object until the door has been totally // opened // - if( d->m_numDoorAnimations == 0 || door == NULL || door->m_doorWaitOpenFrame != 0 ) + if( d->m_numDoorAnimations == 0 || door == nullptr || door->m_doorWaitOpenFrame != 0 ) { Object *newObj = TheThingFactory->newObject( production->m_objectToProduce, creationBuilding->getControllingPlayer()->getDefaultTeam() ); @@ -945,7 +945,7 @@ UpdateSleepTime ProductionUpdate::update( void ) //Also mark the UI dirty -- incase object with upgrade cameo is selected. Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - Object *selectedObject = draw ? draw->getObject() : NULL; + Object *selectedObject = draw ? draw->getObject() : nullptr; if( selectedObject ) { const ThingTemplate *thing = selectedObject->getTemplate(); @@ -982,7 +982,7 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) { // check for empty list - if( m_productionQueue == NULL ) + if( m_productionQueue == nullptr ) m_productionQueue = production; // make any existing tail pointer now point to us, and we point back to them @@ -1178,11 +1178,11 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; BehaviorModule **bmi; - ProductionUpdateInterface *pui = NULL; + ProductionUpdateInterface *pui = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -1193,7 +1193,7 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) } // interface not found - return NULL; + return nullptr; } @@ -1277,7 +1277,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) AsciiString name; // the queue should be emtpy now - if( m_productionQueue != NULL ) + if( m_productionQueue != nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - m_productionQueue is not empty, but should be" )); @@ -1293,7 +1293,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) production = newInstance(ProductionEntry); // tie to list at end - if( m_productionQueue == NULL ) + if( m_productionQueue == nullptr ) m_productionQueue = production; // make any existing tail pointer now point to us, and we point back to them @@ -1317,7 +1317,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) { production->m_objectToProduce = TheThingFactory->findTemplate( name ); - if( production->m_objectToProduce == NULL ) + if( production->m_objectToProduce == nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find template '%s'", name.str() )); @@ -1330,7 +1330,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) { production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name ); - if( production->m_upgradeToResearch == NULL ) + if( production->m_upgradeToResearch == nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find upgrade '%s'", name.str() )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp index c805e87220b..87a70875f4d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp @@ -88,7 +88,7 @@ void ProjectileStreamUpdate::addProjectile( ObjectID sourceID, ObjectID newID ) void ProjectileStreamUpdate::cullFrontOfList() { - while( (m_firstValidIndex != m_nextFreeIndex) && (TheGameLogic->findObjectByID( m_projectileIDs[m_firstValidIndex] ) == NULL) ) + while( (m_firstValidIndex != m_nextFreeIndex) && (TheGameLogic->findObjectByID( m_projectileIDs[m_firstValidIndex] ) == nullptr) ) { // Chew off the front if they are gone. Don't chew on the middle, as bad ones there are just a break in the chain m_firstValidIndex = (m_firstValidIndex + 1) % MAX_PROJECTILE_STREAM; @@ -100,7 +100,7 @@ Bool ProjectileStreamUpdate::considerDying() if( m_firstValidIndex == m_nextFreeIndex && m_owningObject != INVALID_ID ) { //If I have no projectiles to watch, and my master is dead, then yes, I want to die - if( TheGameLogic->findObjectByID(m_owningObject) == NULL ) + if( TheGameLogic->findObjectByID(m_owningObject) == nullptr ) return TRUE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp index 4e1013b63a1..fcfd8c87cfa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp @@ -53,8 +53,8 @@ ProneUpdateModuleData::ProneUpdateModuleData() : static const FieldParse dataFieldParse[] = { - { "DamageToFramesRatio", INI::parseReal, NULL, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) }, - { 0, 0, 0, 0 } + { "DamageToFramesRatio", INI::parseReal, nullptr, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp index 1cff280766b..551de9f5f37 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp @@ -177,7 +177,7 @@ UpdateSleepTime SlavedUpdate::update( void ) //Get my master's AI. If he is attacking something, grant him a range bonus, //and I'll fly over the target. - Object *target = NULL; + Object *target = nullptr; AIUpdateInterface *masterAI = master->getAIUpdateInterface(); if( masterAI ) { @@ -623,7 +623,7 @@ void SlavedUpdate::setRepairState( RepairStates repairState ) { Coord3D pos; //Get the bone position - if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, NULL, 1 ) ) + if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, nullptr, 1 ) ) { pos.add( obj->getPosition() ); } @@ -699,7 +699,7 @@ void SlavedUpdate::moveToNewRepairSpot() //------------------------------------------------------------------------------------------------- void SlavedUpdate::startSlavedEffects( const Object *slaver ) { - if( slaver == NULL ) + if( slaver == nullptr ) return; m_slaver = slaver->getID(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 7a1e167cbc9..a5357afb8c9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -234,7 +234,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) { Object* target = TheGameLogic->findObjectByID(m_targetID); - if (target != NULL) + if (target != nullptr) { const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); if (target->isEffectivelyDead()) @@ -724,7 +724,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const } Real fDistSquared = 0.0f; - Object *target = NULL; + Object *target = nullptr; if( m_targetID != INVALID_ID ) { target = TheGameLogic->findObjectByID( m_targetID ); @@ -766,7 +766,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const { //Make sure we can see the target! PartitionFilterLineOfSight filterLOS( self ); - PartitionFilter *filters[] = { &filterLOS, NULL }; + PartitionFilter *filters[] = { &filterLOS, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( self, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR ); MemoryPoolObjectHolder hold(iter); for( Object *theTarget = iter->first(); theTarget; theTarget = iter->next() ) @@ -799,7 +799,7 @@ Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const range = __max( 0.0f, range - UNDERSIZE ); Real fDistSquared = 0.0f; - Object *target = NULL; + Object *target = nullptr; if( m_targetID != INVALID_ID ) { target = TheGameLogic->findObjectByID( m_targetID ); @@ -965,7 +965,7 @@ void SpecialAbilityUpdate::startPreparation() SpecialPowerModuleInterface *spmInterface = getMySPM(); if( spmInterface ) { - spmInterface->markSpecialPowerTriggered(NULL);// Null for not creating a view object + spmInterface->markSpecialPowerTriggered(nullptr);// Null for not creating a view object } if (getObject()->getAI()) { @@ -1005,7 +1005,7 @@ Bool SpecialAbilityUpdate::initLaser(Object* specialObject, Object* target ) } Coord3D startPos; - if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, NULL ) ) + if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, nullptr ) ) { //If we can't find the bone, then set it to our current position. startPos.set( getObject()->getPosition() ); @@ -1020,7 +1020,7 @@ Bool SpecialAbilityUpdate::initLaser(Object* specialObject, Object* target ) { endPos = startPos; } - update->initLaser( NULL, &startPos, &endPos ); + update->initLaser( nullptr, &startPos, &endPos ); return true; } @@ -1464,7 +1464,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() Object* SpecialAbilityUpdate::createSpecialObject() { const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - Object *specialObject = NULL; + Object *specialObject = nullptr; if( m_specialObjectEntries == data->m_maxSpecialObjects ) { @@ -1474,7 +1474,7 @@ Object* SpecialAbilityUpdate::createSpecialObject() //limit we can have, then don't allow any more to be created.... //We could add recycling code if need be.. but the logic that handles //canDoSpecialPowerXXX should prevent this triggering. - return NULL; + return nullptr; } else { @@ -1622,7 +1622,7 @@ void SpecialAbilityUpdate::finishAbility() if (contPlayer) { PartitionFilterSamePlayer filterPlayer( contPlayer ); // Look for our own mines. PartitionFilterAcceptByKindOf filterKind(MAKE_KINDOF_MASK(KINDOF_MINE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKind, &filterPlayer, NULL }; + PartitionFilter *filters[] = { &filterKind, &filterPlayer, nullptr }; Object *mine = ThePartitionManager->getClosestObject( &pos, data->m_fleeRangeAfterCompletion, FROM_CENTER_2D, filters );// could be null. this is ok. if (mine) { dir.set(pos.x-mine->getPosition()->x, pos.y-mine->getPosition()->y, 0); @@ -1773,7 +1773,7 @@ Object* SpecialAbilityUpdate::findSpecialObjectWithProducerID( const Object *tar } } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp index 5397affbdc0..b02adae856f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp @@ -45,7 +45,7 @@ void SpyVisionUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -94,7 +94,7 @@ UpdateSleepTime SpyVisionUpdate::update( void ) void SpyVisionUpdate::doActivationWork( Bool setting ) { Player *ourPlayer = getObject()->getControllingPlayer(); - if( ourPlayer == NULL || ThePlayerList == NULL ) + if( ourPlayer == nullptr || ThePlayerList == nullptr ) return; for (Int i=0; i < ThePlayerList->getPlayerCount(); ++i) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index 79769bc5214..89ad057dce0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -59,22 +59,22 @@ void StealthDetectorUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DetectionRate", INI::parseDurationUnsignedInt, NULL, offsetof( StealthDetectorUpdateModuleData, m_updateRate ) }, - { "DetectionRange", INI::parseReal, NULL, offsetof( StealthDetectorUpdateModuleData, m_detectionRange ) }, - { "InitiallyDisabled", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_initiallyDisabled ) }, - { "PingSound", INI::parseAudioEventRTS, NULL, offsetof( StealthDetectorUpdateModuleData, m_pingSound ) }, - { "LoudPingSound", INI::parseAudioEventRTS, NULL, offsetof( StealthDetectorUpdateModuleData, m_loudPingSound ) }, - { "IRBeaconParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRBeaconParticleSysTmpl ) }, - { "IRParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysTmpl ) }, - { "IRBrightParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRBrightParticleSysTmpl ) }, - { "IRGridParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRGridParticleSysTmpl ) }, - { "IRParticleSysBone", INI::parseAsciiString, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysBone ) }, - { "ExtraRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindof ) }, - { "ExtraForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindofNot ) }, - { "CanDetectWhileGarrisoned", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileGarrisoned ) }, - { "CanDetectWhileContained", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileTransported ) }, - - { 0, 0, 0, 0 } + { "DetectionRate", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthDetectorUpdateModuleData, m_updateRate ) }, + { "DetectionRange", INI::parseReal, nullptr, offsetof( StealthDetectorUpdateModuleData, m_detectionRange ) }, + { "InitiallyDisabled", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_initiallyDisabled ) }, + { "PingSound", INI::parseAudioEventRTS, nullptr, offsetof( StealthDetectorUpdateModuleData, m_pingSound ) }, + { "LoudPingSound", INI::parseAudioEventRTS, nullptr, offsetof( StealthDetectorUpdateModuleData, m_loudPingSound ) }, + { "IRBeaconParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRBeaconParticleSysTmpl ) }, + { "IRParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysTmpl ) }, + { "IRBrightParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRBrightParticleSysTmpl ) }, + { "IRGridParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRGridParticleSysTmpl ) }, + { "IRParticleSysBone", INI::parseAsciiString, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysBone ) }, + { "ExtraRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindof ) }, + { "ExtraForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindofNot ) }, + { "CanDetectWhileGarrisoned", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileGarrisoned ) }, + { "CanDetectWhileContained", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileTransported ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -186,7 +186,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) PartitionFilterRelationship filterTeam(self, PartitionFilterRelationship::ALLOW_ENEMIES | PartitionFilterRelationship::ALLOW_NEUTRAL ); PartitionFilterAcceptByKindOf filterKindof(data->m_extraDetectKindof, data->m_extraDetectKindofNot); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter* filters[] = { &filterStealthOrStealthGarrisoned, &filterTeam, &filterKindof, &filterMapStatus, NULL }; + PartitionFilter* filters[] = { &filterStealthOrStealthGarrisoned, &filterTeam, &filterKindof, &filterMapStatus, nullptr }; Real visionRange = self->getVisionRange(); if( data->m_detectionRange > 0.0f ) @@ -314,7 +314,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) ContainModuleInterface *contain = them->getContain(); if( contain && contain->isGarrisonable() && contain->getStealthUnitsContained() ) { - Object* rider = NULL; + Object* rider = nullptr; for(ContainedItemsList::const_iterator it = contain->getContainedItemsList()->begin(); it != contain->getContainedItemsList()->end(); ++it) { rider = *it; @@ -344,7 +344,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) Drawable *myDraw = self->getDrawable(); Coord3D bonePosition = {-1.66f,5.5f,15};//@todo use bone position if (myDraw) - myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, NULL, 1); + myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, nullptr, 1); const ParticleSystemTemplate *pingTemplate; if ( foundSomeone ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 1411a1b8307..3ef650cecf9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -68,23 +68,23 @@ void StealthUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "StealthDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_stealthDelay ) }, - { "MoveThresholdSpeed", INI::parseVelocityReal, NULL, offsetof( StealthUpdateModuleData, m_stealthSpeed ) }, + { "StealthDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_stealthDelay ) }, + { "MoveThresholdSpeed", INI::parseVelocityReal, nullptr, offsetof( StealthUpdateModuleData, m_stealthSpeed ) }, { "StealthForbiddenConditions", INI::parseBitString32, TheStealthLevelNames, offsetof( StealthUpdateModuleData, m_stealthLevel) }, - { "HintDetectableConditions", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StealthUpdateModuleData, m_hintDetectableStates) }, - { "FriendlyOpacityMin", INI::parsePercentToReal, NULL, offsetof( StealthUpdateModuleData, m_friendlyOpacityMin ) }, - { "FriendlyOpacityMax", INI::parsePercentToReal, NULL, offsetof( StealthUpdateModuleData, m_friendlyOpacityMax ) }, - { "PulseFrequency", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_pulseFrames ) }, - { "DisguisesAsTeam", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_teamDisguised ) }, - { "RevealDistanceFromTarget", INI::parseReal, NULL, offsetof( StealthUpdateModuleData, m_revealDistanceFromTarget ) }, - { "OrderIdleEnemiesToAttackMeUponReveal", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_orderIdleEnemiesToAttackMeUponReveal ) }, - { "DisguiseFX", INI::parseFXList, NULL, offsetof( StealthUpdateModuleData, m_disguiseFX ) }, - { "DisguiseRevealFX", INI::parseFXList, NULL, offsetof( StealthUpdateModuleData, m_disguiseRevealFX ) }, - { "DisguiseTransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_disguiseTransitionFrames ) }, - { "DisguiseRevealTransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_disguiseRevealTransitionFrames ) }, - { "InnateStealth", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_innateStealth ) }, - - { 0, 0, 0, 0 } + { "HintDetectableConditions", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StealthUpdateModuleData, m_hintDetectableStates) }, + { "FriendlyOpacityMin", INI::parsePercentToReal, nullptr, offsetof( StealthUpdateModuleData, m_friendlyOpacityMin ) }, + { "FriendlyOpacityMax", INI::parsePercentToReal, nullptr, offsetof( StealthUpdateModuleData, m_friendlyOpacityMax ) }, + { "PulseFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_pulseFrames ) }, + { "DisguisesAsTeam", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_teamDisguised ) }, + { "RevealDistanceFromTarget", INI::parseReal, nullptr, offsetof( StealthUpdateModuleData, m_revealDistanceFromTarget ) }, + { "OrderIdleEnemiesToAttackMeUponReveal", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_orderIdleEnemiesToAttackMeUponReveal ) }, + { "DisguiseFX", INI::parseFXList, nullptr, offsetof( StealthUpdateModuleData, m_disguiseFX ) }, + { "DisguiseRevealFX", INI::parseFXList, nullptr, offsetof( StealthUpdateModuleData, m_disguiseRevealFX ) }, + { "DisguiseTransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_disguiseTransitionFrames ) }, + { "DisguiseRevealTransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_disguiseRevealTransitionFrames ) }, + { "InnateStealth", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_innateStealth ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -104,7 +104,7 @@ StealthUpdate::StealthUpdate( Thing *thing, const ModuleData* moduleData ) : Upd m_pulsePhase = GameClientRandomValueReal(0, PI); m_disguiseAsPlayerIndex = -1; - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; m_transitioningToDisguise = false; m_disguised = false; m_disguiseTransitionFrames = 0; @@ -192,7 +192,7 @@ Bool StealthUpdate::allowedToStealth() const } const PhysicsBehavior *physics = self->getPhysics(); - if ((flags & STEALTH_NOT_WHILE_MOVING) && physics != NULL && + if ((flags & STEALTH_NOT_WHILE_MOVING) && physics != nullptr && physics->getVelocityMagnitude() > getStealthUpdateModuleData()->m_stealthSpeed) return false; @@ -600,7 +600,7 @@ void StealthUpdate::markAsDetected(UnsignedInt numFrames) //If we are disguised, remove the disguise permanently! if( isDisguised() ) { - disguiseAsObject( NULL ); + disguiseAsObject( nullptr ); } UnsignedInt now = TheGameLogic->getFrame(); @@ -667,7 +667,7 @@ void StealthUpdate::disguiseAsObject( const Object *target ) } else if( m_disguised ) { - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; m_disguiseAsPlayerIndex = 0; m_disguiseTransitionFrames = data->m_disguiseRevealTransitionFrames; m_transitioningToDisguise = false; //Means we are losing the disguise over time. @@ -870,12 +870,12 @@ void StealthUpdate::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; if( name.isEmpty() == FALSE ) { m_disguiseAsTemplate = TheThingFactory->findTemplate( name ); - if( m_disguiseAsTemplate == NULL ) + if( m_disguiseAsTemplate == nullptr ) { DEBUG_CRASH(( "StealthUpdate::xfer - Unknown template '%s'", name.str() )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index 0b7ca867061..34f53823385 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -78,7 +78,7 @@ void StickyBombUpdate::onObjectCreated() Object *target = ai->getGoalObject(); if( target ) { - init( target, NULL); + init( target, nullptr); } } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index 7789f245f40..67f317afeb2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -57,7 +57,7 @@ static const char *const TheStructureCollapsePhaseNames[] = "BURST", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheStructureCollapsePhaseNames) == SC_PHASE_COUNT + 1, "Wrong array size"); @@ -84,7 +84,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u { StructureCollapseUpdateModuleData* self = (StructureCollapseUpdateModuleData*)instance; StructureCollapsePhaseType scphase = (StructureCollapsePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureCollapsePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fxs[scphase].push_back(fxl); @@ -96,7 +96,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { StructureCollapseUpdateModuleData* self = (StructureCollapseUpdateModuleData*)instance; StructureCollapsePhaseType stphase = (StructureCollapsePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureCollapsePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[stphase].push_back(ocl); @@ -110,16 +110,16 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* static const FieldParse dataFieldParse[] = { - { "MinCollapseDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_minCollapseDelay ) }, - { "MaxCollapseDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxCollapseDelay ) }, - { "MinBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_minBurstDelay ) }, - { "MaxBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxBurstDelay ) }, - { "CollapseDamping", INI::parseReal, NULL, offsetof( StructureCollapseUpdateModuleData, m_collapseDamping ) }, - { "MaxShudder", INI::parseReal, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxShudder ) }, - { "BigBurstFrequency", INI::parseInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_bigBurstFrequency ) }, - { "OCL", parseOCL, NULL, 0 }, - { "FXList", parseFX, NULL, 0 }, - { 0, 0, 0, 0 } + { "MinCollapseDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_minCollapseDelay ) }, + { "MaxCollapseDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxCollapseDelay ) }, + { "MinBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_minBurstDelay ) }, + { "MaxBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxBurstDelay ) }, + { "CollapseDamping", INI::parseReal, nullptr, offsetof( StructureCollapseUpdateModuleData, m_collapseDamping ) }, + { "MaxShudder", INI::parseReal, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxShudder ) }, + { "BigBurstFrequency", INI::parseInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_bigBurstFrequency ) }, + { "OCL", parseOCL, nullptr, 0 }, + { "FXList", parseFX, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( StructureCollapseUpdateModuleData, m_dieMuxData )); @@ -333,7 +333,7 @@ void StructureCollapseUpdate::doPhaseStuff(StructureCollapsePhaseType scphase, c const OCLVec& v = d->m_ocls[scphase]; DEBUG_ASSERTCRASH(idx>=0&&idxfindUpdateModule(key_BoneFXUpdate); - if (bfxu != NULL) + if (bfxu != nullptr) { bfxu->stopAllBoneFX(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index ec95774da6d..ea7664dcc14 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -83,7 +83,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { StructureToppleUpdateModuleData* self = (StructureToppleUpdateModuleData*)instance; StructureTopplePhaseType stphase = (StructureTopplePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureTopplePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[stphase].push_back(ocl); @@ -95,9 +95,9 @@ static void parseAngleFX(INI* ini, void *instance, void * /* store */, const voi { StructureToppleUpdateModuleData* self = (StructureToppleUpdateModuleData*)instance; AngleFXInfo info; - INI::parseReal(ini, instance, &(info.angle), NULL); + INI::parseReal(ini, instance, &(info.angle), nullptr); info.angle = info.angle * PI / 180.0f; // convert from degrees to radians. - INI::parseFXList(ini, instance, &(info.fxList), NULL); + INI::parseFXList(ini, instance, &(info.fxList), nullptr); self->angleFX.push_back(info); } @@ -108,22 +108,22 @@ static void parseAngleFX(INI* ini, void *instance, void * /* store */, const voi static const FieldParse dataFieldParse[] = { - { "MinToppleDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_minToppleDelay ) }, - { "MaxToppleDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_maxToppleDelay ) }, - { "MinToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_minToppleBurstDelay ) }, - { "MaxToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_maxToppleBurstDelay ) }, - { "StructuralIntegrity", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralIntegrity ) }, - { "StructuralDecay", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) }, - { "DamageFXTypes", INI::parseDamageTypeFlags, NULL, offsetof( StructureToppleUpdateModuleData, m_damageFXTypes ) }, - { "TopplingFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleFXList ) }, - { "ToppleDelayFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleDelayFXList ) }, - { "ToppleStartFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleStartFXList ) }, - { "ToppleDoneFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleDoneFXList ) }, - { "CrushingFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_crushingFXList ) }, - { "CrushingWeaponName", INI::parseAsciiString, NULL, offsetof( StructureToppleUpdateModuleData, m_crushingWeaponName ) }, - { "OCL", parseOCL, NULL, 0 }, - { "AngleFX", parseAngleFX, NULL, 0 }, - { 0, 0, 0, 0 } + { "MinToppleDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_minToppleDelay ) }, + { "MaxToppleDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_maxToppleDelay ) }, + { "MinToppleBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_minToppleBurstDelay ) }, + { "MaxToppleBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_maxToppleBurstDelay ) }, + { "StructuralIntegrity", INI::parseReal, nullptr, offsetof( StructureToppleUpdateModuleData, m_structuralIntegrity ) }, + { "StructuralDecay", INI::parseReal, nullptr, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) }, + { "DamageFXTypes", INI::parseDamageTypeFlags, nullptr, offsetof( StructureToppleUpdateModuleData, m_damageFXTypes ) }, + { "TopplingFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleFXList ) }, + { "ToppleDelayFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleDelayFXList ) }, + { "ToppleStartFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleStartFXList ) }, + { "ToppleDoneFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleDoneFXList ) }, + { "CrushingFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_crushingFXList ) }, + { "CrushingWeaponName", INI::parseAsciiString, nullptr, offsetof( StructureToppleUpdateModuleData, m_crushingWeaponName ) }, + { "OCL", parseOCL, nullptr, 0 }, + { "AngleFX", parseAngleFX, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( StructureToppleUpdateModuleData, m_dieMuxData )); @@ -144,7 +144,7 @@ void StructureToppleUpdate::beginStructureTopple(const DamageInfo *damageInfo) Object *building = getObject(); Real toppleAngle = 0.0; - if (attacker == NULL) { + if (attacker == nullptr) { toppleAngle = GameLogicRandomValueReal(0.0, 2*PI); } else { const Coord3D *attackerPos = attacker->getPosition(); @@ -259,7 +259,7 @@ UpdateSleepTime StructureToppleUpdate::update( void ) applyCrushingDamage(0.0f); doPhaseStuff(STPHASE_FINAL, getObject()->getPosition()); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXObj(d->m_toppleDoneFXList, getObject()); m_toppleFrame = TheGameLogic->getFrame(); @@ -310,7 +310,7 @@ void StructureToppleUpdate::doToppleDoneStuff() { static NameKeyType key_BoneFXUpdate = NAMEKEY("BoneFXUpdate"); BoneFXUpdate *bfxu = (BoneFXUpdate *)getObject()->findUpdateModule(key_BoneFXUpdate); - if (bfxu != NULL) { + if (bfxu != nullptr) { bfxu->stopAllBoneFX(); } @@ -337,7 +337,7 @@ void StructureToppleUpdate::doAngleFX(Real curAngle, Real newAngle) { if ((it->angle > curAngle) && (it->angle <= newAngle)) { - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXObj(it->fxList, getObject()); } } @@ -380,7 +380,7 @@ void StructureToppleUpdate::applyCrushingDamage(Real theta) // Get the crushing weapon. const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName); - if (wt == NULL) { + if (wt == nullptr) { return; } @@ -431,7 +431,7 @@ void StructureToppleUpdate::doDamageLine(Object *building, const WeaponTemplate* TheWeaponStore->createAndFireTempWeapon(wt, building, &target); // do the crushing particle effects - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_crushingFXList, &target); } @@ -443,7 +443,7 @@ void StructureToppleUpdate::doDamageLine(Object *building, const WeaponTemplate* TheWeaponStore->createAndFireTempWeapon(wt, building, &target); // do the crushing particle effects - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_crushingFXList, &target); // Do the flying debris for this line. @@ -461,7 +461,7 @@ void StructureToppleUpdate::doToppleStartFX(Object *building, const DamageInfo * const StructureToppleUpdateModuleData *d = getStructureToppleUpdateModuleData(); const DamageInfo *lastDamageInfo = getObject()->getBodyModule()->getLastDamageInfo(); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_toppleStartFXList, building->getPosition()); doPhaseStuff(STPHASE_INITIAL, building->getPosition()); @@ -475,22 +475,22 @@ void StructureToppleUpdate::doToppleDelayBurstFX() const DamageInfo *lastDamageInfo = getObject()->getBodyModule()->getLastDamageInfo(); DEBUG_LOG(("Doing topple delay burst on frame %d", TheGameLogic->getFrame())); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_toppleDelayFXList, &m_delayBurstLocation); Object *building = getObject(); Drawable *drawable = building->getDrawable(); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) { for (std::vector::const_iterator it = d->fxbones.begin(); it != d->fxbones.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(it->particleSystemTemplate); - if (sys != NULL) + if (sys != nullptr) { Coord3D pos; - if (drawable->getPristineBonePositions(it->boneName.str(), 0, &pos, NULL, 1) == 1) + if (drawable->getPristineBonePositions(it->boneName.str(), 0, &pos, nullptr, 1) == 1) { // got the bone position... sys->setPosition(&pos); @@ -553,7 +553,7 @@ void StructureToppleUpdate::doPhaseStuff(StructureTopplePhaseType stphase, const const OCLVec& v = d->m_ocls[stphase]; DEBUG_ASSERTCRASH(idx>=0&&idxiterateObjectsInRange(getObject(), 1000.0f, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); @@ -386,8 +386,8 @@ UpdateSleepTime TensileFormationUpdate::update( void ) void TensileFormationUpdate::propagateDislodgement ( Bool enabled ) { PartitionFilterTensileFormationMember tfmFilter( getObject() ); - PartitionFilter *filters[] = { &tfmFilter, NULL }; - SimpleObjectIterator *iter = NULL; + PartitionFilter *filters[] = { &tfmFilter, nullptr }; + SimpleObjectIterator *iter = nullptr; iter = ThePartitionManager->iterateObjectsInRange(getObject(), 100.0f, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); for (Object* other = iter->first(); other; other = iter->next()) @@ -405,7 +405,7 @@ void TensileFormationUpdate::propagateDislodgement ( Bool enabled ) //TensileFormationUpdate* tfu = getTFU(other); - //if ( tfu != NULL ) + //if ( tfu != nullptr ) //{ // tfu->setEnabled( enabled ); //} diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index 8eb909b8809..5db9614f8f4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -59,8 +59,8 @@ ToppleUpdateModuleData::ToppleUpdateModuleData() const Real START_VELOCITY_PERCENT = 0.2f; const Real START_ACCEL_PERCENT = 0.01f; const Real VELOCITY_BOUNCE_PERCENT = 0.3f; // multiply the velocity by this when you bounce - m_toppleFX = NULL; - m_bounceFX = NULL; + m_toppleFX = nullptr; + m_bounceFX = nullptr; m_stumpName.clear(); m_killWhenToppled = true; m_killWhenStartToppled = false; @@ -80,18 +80,18 @@ void ToppleUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ToppleFX", INI::parseFXList, NULL, offsetof( ToppleUpdateModuleData, m_toppleFX ) }, - { "BounceFX", INI::parseFXList, NULL, offsetof( ToppleUpdateModuleData, m_bounceFX ) }, - { "StumpName", INI::parseAsciiString, NULL, offsetof( ToppleUpdateModuleData, m_stumpName ) }, - { "KillWhenStartToppling", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killWhenStartToppled ) }, - { "KillWhenFinishedToppling", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killWhenToppled ) }, - { "KillStumpWhenToppled", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killStumpWhenToppled ) }, - { "ToppleLeftOrRightOnly", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_toppleLeftOrRightOnly ) }, - { "ReorientToppledRubble", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_reorientToppledRubble ) }, - { "InitialVelocityPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_initialVelocityPercent ) }, - { "InitialAccelPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_initialAccelPercent ) }, - { "BounceVelocityPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_bounceVelocityPercent ) }, - { 0, 0, 0, 0 } + { "ToppleFX", INI::parseFXList, nullptr, offsetof( ToppleUpdateModuleData, m_toppleFX ) }, + { "BounceFX", INI::parseFXList, nullptr, offsetof( ToppleUpdateModuleData, m_bounceFX ) }, + { "StumpName", INI::parseAsciiString, nullptr, offsetof( ToppleUpdateModuleData, m_stumpName ) }, + { "KillWhenStartToppling", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killWhenStartToppled ) }, + { "KillWhenFinishedToppling", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killWhenToppled ) }, + { "KillStumpWhenToppled", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killStumpWhenToppled ) }, + { "ToppleLeftOrRightOnly", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_toppleLeftOrRightOnly ) }, + { "ReorientToppledRubble", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_reorientToppledRubble ) }, + { "InitialVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_initialVelocityPercent ) }, + { "InitialAccelPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_initialAccelPercent ) }, + { "BounceVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_bounceVelocityPercent ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -213,7 +213,7 @@ void ToppleUpdate::applyTopplingForce( const Coord3D* toppleDirection, Real topp if (!d->m_stumpName.isEmpty()) { const ThingTemplate* ttn = TheThingFactory->findTemplate(d->m_stumpName); - Object *stump = TheThingFactory->newObject( ttn, NULL ); + Object *stump = TheThingFactory->newObject( ttn, nullptr ); if (stump) { stump->setPosition( getObject()->getPosition() ); @@ -364,7 +364,7 @@ void ToppleUpdate::onCollide( Object *other, const Coord3D *loc, const Coord3D * { // Note that other == null means "collide with ground" // - if (other == NULL) + if (other == nullptr) return; //@todo JohnA -- Should you get around to adding trees to avoidance pathfinding, then you'll diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index 33737623cbb..027fb33bb40 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -83,22 +83,22 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "WaveDelay", INI::parseDurationReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waveDelay ) }, - { "YSize", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_ySize ) }, - { "LinearWaveSpacing", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_linearWaveSpacing ) }, - { "WaveBendMagnitude", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waveBendMagnitude ) }, - { "WaterVelocity", INI::parseVelocityReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waterVelocity ) }, - { "PreferredHeight", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_preferredHeight ) }, - { "ShorelineEffectDistance", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_shorelineEffectDistance ) }, - { "DamageRadius", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageRadius ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageAmount ) }, - { "ToppleForce", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) }, - { "RandomSplashSound", INI::parseAudioEventRTS, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSound ) }, - { "RandomSplashSoundFrequency", INI::parseInt, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSoundFrequency ) }, - { "BridgeParticle", INI::parseParticleSystemTemplate, NULL, offsetof( WaveGuideUpdateModuleData, m_bridgeParticle ) }, - { "BridgeParticleAngleFudge", INI::parseAngleReal, NULL, offsetof( WaveGuideUpdateModuleData, m_bridgeParticleAngleFudge ) }, - { "LoopingSound", INI::parseAudioEventRTS, NULL, offsetof( WaveGuideUpdateModuleData, m_loopingSound ) }, - { 0, 0, 0, 0 } + { "WaveDelay", INI::parseDurationReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waveDelay ) }, + { "YSize", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_ySize ) }, + { "LinearWaveSpacing", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_linearWaveSpacing ) }, + { "WaveBendMagnitude", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waveBendMagnitude ) }, + { "WaterVelocity", INI::parseVelocityReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waterVelocity ) }, + { "PreferredHeight", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_preferredHeight ) }, + { "ShorelineEffectDistance", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_shorelineEffectDistance ) }, + { "DamageRadius", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_damageRadius ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_damageAmount ) }, + { "ToppleForce", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) }, + { "RandomSplashSound", INI::parseAudioEventRTS, nullptr, offsetof( WaveGuideUpdateModuleData, m_randomSplashSound ) }, + { "RandomSplashSoundFrequency", INI::parseInt, nullptr, offsetof( WaveGuideUpdateModuleData, m_randomSplashSoundFrequency ) }, + { "BridgeParticle", INI::parseParticleSystemTemplate, nullptr, offsetof( WaveGuideUpdateModuleData, m_bridgeParticle ) }, + { "BridgeParticleAngleFudge", INI::parseAngleReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_bridgeParticleAngleFudge ) }, + { "LoopingSound", INI::parseAudioEventRTS, nullptr, offsetof( WaveGuideUpdateModuleData, m_loopingSound ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -191,7 +191,7 @@ Bool WaveGuideUpdate::startMoving( void ) // there must be at least one link Waypoint *next = waypoint->getLink( 0 ); - if( next == NULL ) + if( next == nullptr ) { DEBUG_CRASH(( "WaveGuideUpdate:startMoving - There must be a linked waypoint path to follow" )); @@ -560,7 +560,7 @@ void WaveGuideUpdate::doDamage( void ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( &m_transformedShapePoints[ i ], modData->m_damageRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *obj; const Coord3D *objPos; @@ -676,7 +676,7 @@ void WaveGuideUpdate::doDamage( void ) if( obj->isKindOf( KINDOF_BRIDGE ) ) { const ThingTemplate* ttn = TheThingFactory->findTemplate("WaterWaveBridge"); - Object *newBridge = TheThingFactory->newObject( ttn, NULL ); + Object *newBridge = TheThingFactory->newObject( ttn, nullptr ); if( newBridge ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp index ddd99e0860f..58c8952b536 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp @@ -51,8 +51,8 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "NewShroudRange", INI::parseReal, NULL, offsetof( ActiveShroudUpgradeModuleData, m_newShroudRange ) }, - { 0, 0, 0, 0 } + { "NewShroudRange", INI::parseReal, nullptr, offsetof( ActiveShroudUpgradeModuleData, m_newShroudRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index b4a9a244384..68b7dcfd563 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -41,8 +41,8 @@ void CommandSetUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "CommandSet", INI::parseAsciiString, NULL, offsetof( CommandSetUpgradeModuleData, m_newCommandSet ) }, - { 0, 0, 0, 0 } + { "CommandSet", INI::parseAsciiString, nullptr, offsetof( CommandSetUpgradeModuleData, m_newCommandSet ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp index c2b72526561..e55d6ab5f52 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp @@ -88,9 +88,9 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "EffectKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CostModifierUpgradeModuleData, m_kindOf ) }, - { "Percentage", INI::parsePercentToReal, NULL, offsetof( CostModifierUpgradeModuleData, m_percentage ) }, - { 0, 0, 0, 0 } + { "EffectKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CostModifierUpgradeModuleData, m_kindOf ) }, + { "Percentage", INI::parsePercentToReal, nullptr, offsetof( CostModifierUpgradeModuleData, m_percentage ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp index 68fd6ecfc43..099eb96ef01 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/DelayedUpgrade.cpp @@ -53,7 +53,7 @@ DelayedUpgrade::~DelayedUpgrade( void ) void DelayedUpgrade::upgradeImplementation( ) { UnsignedInt delay = getDelayedUpgradeModuleData()->m_delayTime; - DelayedUpgradeUpdateInterface *upgradeUpdate = NULL; + DelayedUpgradeUpdateInterface *upgradeUpdate = nullptr; Object *me = getObject(); UpgradeMaskType activation, conflicting; @@ -62,7 +62,7 @@ void DelayedUpgrade::upgradeImplementation( ) for (BehaviorModule** u = me->getBehaviorModules(); *u; ++u) { // Check all Upgradeupdate modules for firing - if ((upgradeUpdate = (*u)->getDelayedUpgradeUpdateInterface()) != NULL) + if ((upgradeUpdate = (*u)->getDelayedUpgradeUpdateInterface()) != nullptr) { if( upgradeUpdate->isTriggeredBy( activation ) ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp index bfa7e0a54ec..ba56e9229fe 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp @@ -51,8 +51,8 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AddXPScalar", INI::parseReal, NULL, offsetof( ExperienceScalarUpgradeModuleData, m_addXPScalar ) }, - { 0, 0, 0, 0 } + { "AddXPScalar", INI::parseReal, nullptr, offsetof( ExperienceScalarUpgradeModuleData, m_addXPScalar ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp index e5aa81681a1..0b6bf32a445 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp @@ -54,9 +54,9 @@ void MaxHealthUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AddMaxHealth", INI::parseReal, NULL, offsetof( MaxHealthUpgradeModuleData, m_addMaxHealth ) }, + { "AddMaxHealth", INI::parseReal, nullptr, offsetof( MaxHealthUpgradeModuleData, m_addMaxHealth ) }, { "ChangeType", INI::parseIndexList, TheMaxHealthChangeTypeNames, offsetof( MaxHealthUpgradeModuleData, m_maxHealthChangeType ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp index 2fd664af72f..144a9646543 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp @@ -43,7 +43,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) { - m_ocl = NULL; + m_ocl = nullptr; } @@ -55,8 +55,8 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "UpgradeObject", INI::parseObjectCreationList, NULL, offsetof( ObjectCreationUpgradeModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "UpgradeObject", INI::parseObjectCreationList, nullptr, offsetof( ObjectCreationUpgradeModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -94,7 +94,7 @@ void ObjectCreationUpgrade::upgradeImplementation( void ) // spawn everything in the OCL if (getObjectCreationUpgradeModuleData() && getObjectCreationUpgradeModuleData()->m_ocl) { - ObjectCreationList::create((getObjectCreationUpgradeModuleData()->m_ocl), getObject(), NULL); + ObjectCreationList::create((getObjectCreationUpgradeModuleData()->m_ocl), getObject(), nullptr); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp index cd899a854cc..d930a3f3e53 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp @@ -46,8 +46,8 @@ void RadarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DisableProof", INI::parseBool, NULL, offsetof( RadarUpgradeModuleData, m_isDisableProof ) }, - { 0, 0, 0, 0 } + { "DisableProof", INI::parseBool, nullptr, offsetof( RadarUpgradeModuleData, m_isDisableProof ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp index 582a8fa48b9..a3034a31b6f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp @@ -79,9 +79,9 @@ void StatusBitsUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "StatusToSet", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StatusBitsUpgradeModuleData, m_statusToSet ) }, - { "StatusToClear", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StatusBitsUpgradeModuleData, m_statusToClear ) }, - { 0, 0, 0, 0 } + { "StatusToSet", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StatusBitsUpgradeModuleData, m_statusToSet ) }, + { "StatusToClear", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StatusBitsUpgradeModuleData, m_statusToClear ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp index e99d360087a..aca00238775 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp @@ -61,9 +61,9 @@ void SubObjectsUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ShowSubObjects", INI::parseAsciiStringVectorAppend, NULL, offsetof( SubObjectsUpgradeModuleData, m_showSubObjectNames ) }, - { "HideSubObjects", INI::parseAsciiStringVectorAppend, NULL, offsetof( SubObjectsUpgradeModuleData, m_hideSubObjectNames ) }, - { 0, 0, 0, 0 } + { "ShowSubObjects", INI::parseAsciiStringVectorAppend, nullptr, offsetof( SubObjectsUpgradeModuleData, m_showSubObjectNames ) }, + { "HideSubObjects", INI::parseAsciiStringVectorAppend, nullptr, offsetof( SubObjectsUpgradeModuleData, m_hideSubObjectNames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp index 2edb3c799aa..4edb9ab9948 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp @@ -41,7 +41,7 @@ //------------------------------------------------------------------------------------------------- UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void ) { - m_specialPower = NULL; + m_specialPower = nullptr; } //------------------------------------------------------------------------------------------------- @@ -52,8 +52,8 @@ UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( UnpauseSpecialPowerUpgradeModuleData, m_specialPower ) }, - { 0, 0, 0, 0 } + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( UnpauseSpecialPowerUpgradeModuleData, m_specialPower ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 86835e3872f..ef09e5cfcbe 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -113,8 +113,8 @@ static void parsePerVetLevelFXList( INI* ini, void* /*instance*/, void * store, typedef const FXList* ConstFXListPtr; ConstFXListPtr* s = (ConstFXListPtr*)store; VeterancyLevel v = (VeterancyLevel)INI::scanIndexList(ini->getNextToken(), TheVeterancyNames); - const FXList* fx = NULL; - INI::parseFXList(ini, NULL, &fx, NULL); + const FXList* fx = nullptr; + INI::parseFXList(ini, nullptr, &fx, nullptr); s[v] = fx; } @@ -123,8 +123,8 @@ static void parseAllVetLevelsFXList( INI* ini, void* /*instance*/, void * store, { typedef const FXList* ConstFXListPtr; ConstFXListPtr* s = (ConstFXListPtr*)store; - const FXList* fx = NULL; - INI::parseFXList(ini, NULL, &fx, NULL); + const FXList* fx = nullptr; + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) s[i] = fx; } @@ -135,8 +135,8 @@ static void parsePerVetLevelPSys( INI* ini, void* /*instance*/, void * store, co typedef const ParticleSystemTemplate* ConstParticleSystemTemplatePtr; ConstParticleSystemTemplatePtr* s = (ConstParticleSystemTemplatePtr*)store; VeterancyLevel v = (VeterancyLevel)INI::scanIndexList(ini->getNextToken(), TheVeterancyNames); - ConstParticleSystemTemplatePtr pst = NULL; - INI::parseParticleSystemTemplate(ini, NULL, &pst, NULL); + ConstParticleSystemTemplatePtr pst = nullptr; + INI::parseParticleSystemTemplate(ini, nullptr, &pst, nullptr); s[v] = pst; } @@ -145,8 +145,8 @@ static void parseAllVetLevelsPSys( INI* ini, void* /*instance*/, void * store, c { typedef const ParticleSystemTemplate* ConstParticleSystemTemplatePtr; ConstParticleSystemTemplatePtr* s = (ConstParticleSystemTemplatePtr*)store; - ConstParticleSystemTemplatePtr pst = NULL; - INI::parseParticleSystemTemplate(ini, NULL, &pst, NULL); + ConstParticleSystemTemplatePtr pst = nullptr; + INI::parseParticleSystemTemplate(ini, nullptr, &pst, nullptr); for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) s[i] = pst; } @@ -154,7 +154,7 @@ static void parseAllVetLevelsPSys( INI* ini, void* /*instance*/, void * store, c /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -WeaponStore *TheWeaponStore = NULL; ///< the weapon store definition +WeaponStore *TheWeaponStore = nullptr; ///< the weapon store definition /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -163,47 +163,47 @@ WeaponStore *TheWeaponStore = NULL; ///< the weapon store definition const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { - { "PrimaryDamage", INI::parseReal, NULL, offsetof(WeaponTemplate, m_primaryDamage) }, - { "PrimaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_primaryDamageRadius) }, - { "SecondaryDamage", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamage) }, - { "SecondaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamageRadius) }, - { "AttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_attackRange) }, - { "MinimumAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_minimumAttackRange) }, - { "RequestAssistRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_requestAssistRange) }, - { "AcceptableAimDelta", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_aimDelta) }, - { "ScatterRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_scatterRadius) }, - { "ScatterTargetScalar", INI::parseReal, NULL, offsetof(WeaponTemplate, m_scatterTargetScalar) }, - { "ScatterRadiusVsInfantry", INI::parseReal, NULL, offsetof( WeaponTemplate, m_infantryInaccuracyDist ) }, + { "PrimaryDamage", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_primaryDamage) }, + { "PrimaryDamageRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_primaryDamageRadius) }, + { "SecondaryDamage", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_secondaryDamage) }, + { "SecondaryDamageRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_secondaryDamageRadius) }, + { "AttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_attackRange) }, + { "MinimumAttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_minimumAttackRange) }, + { "RequestAssistRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_requestAssistRange) }, + { "AcceptableAimDelta", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_aimDelta) }, + { "ScatterRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterRadius) }, + { "ScatterTargetScalar", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterTargetScalar) }, + { "ScatterRadiusVsInfantry", INI::parseReal, nullptr, offsetof( WeaponTemplate, m_infantryInaccuracyDist ) }, { "DamageType", INI::parseIndexList, TheDamageNames, offsetof(WeaponTemplate, m_damageType) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof(WeaponTemplate, m_deathType) }, - { "WeaponSpeed", INI::parseVelocityReal, NULL, offsetof(WeaponTemplate, m_weaponSpeed) }, - { "MinWeaponSpeed", INI::parseVelocityReal, NULL, offsetof(WeaponTemplate, m_minWeaponSpeed) }, - { "ScaleWeaponSpeed", INI::parseBool, NULL, offsetof(WeaponTemplate, m_isScaleWeaponSpeed) }, - { "WeaponRecoil", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_weaponRecoil) }, - { "MinTargetPitch", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_minTargetPitch) }, - { "MaxTargetPitch", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_maxTargetPitch) }, - { "ProjectileObject", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_projectileName) }, - { "FireSound", INI::parseAudioEventRTS, NULL, offsetof(WeaponTemplate, m_fireSound) }, - { "FireSoundLoopTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_fireSoundLoopTime) }, - { "FireFX", parseAllVetLevelsFXList, NULL, offsetof(WeaponTemplate, m_fireFXs) }, - { "ProjectileDetonationFX", parseAllVetLevelsFXList, NULL, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, - { "FireOCL", parseAllVetLevelsAsciiString, NULL, offsetof(WeaponTemplate, m_fireOCLNames) }, - { "ProjectileDetonationOCL", parseAllVetLevelsAsciiString, NULL, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, - { "ProjectileExhaust", parseAllVetLevelsPSys, NULL, offsetof(WeaponTemplate, m_projectileExhausts) }, - { "VeterancyFireFX", parsePerVetLevelFXList, NULL, offsetof(WeaponTemplate, m_fireFXs) }, - { "VeterancyProjectileDetonationFX", parsePerVetLevelFXList, NULL, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, - { "VeterancyFireOCL", parsePerVetLevelAsciiString, NULL, offsetof(WeaponTemplate, m_fireOCLNames) }, - { "VeterancyProjectileDetonationOCL", parsePerVetLevelAsciiString, NULL, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, - { "VeterancyProjectileExhaust", parsePerVetLevelPSys, NULL, offsetof(WeaponTemplate, m_projectileExhausts) }, - { "ClipSize", INI::parseInt, NULL, offsetof(WeaponTemplate, m_clipSize) }, - { "ContinuousFireOne", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireOneShotsNeeded) }, - { "ContinuousFireTwo", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireTwoShotsNeeded) }, - { "ContinuousFireCoast", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_continuousFireCoastFrames) }, - { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, - { "ClipReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_clipReloadTime) }, - { "DelayBetweenShots", WeaponTemplate::parseShotDelay, NULL, 0 }, - { "ShotsPerBarrel", INI::parseInt, NULL, offsetof(WeaponTemplate, m_shotsPerBarrel) }, - { "DamageDealtAtSelfPosition",INI::parseBool, NULL, offsetof(WeaponTemplate, m_damageDealtAtSelfPosition) }, + { "WeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_weaponSpeed) }, + { "MinWeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_minWeaponSpeed) }, + { "ScaleWeaponSpeed", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_isScaleWeaponSpeed) }, + { "WeaponRecoil", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_weaponRecoil) }, + { "MinTargetPitch", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_minTargetPitch) }, + { "MaxTargetPitch", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_maxTargetPitch) }, + { "ProjectileObject", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileName) }, + { "FireSound", INI::parseAudioEventRTS, nullptr, offsetof(WeaponTemplate, m_fireSound) }, + { "FireSoundLoopTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_fireSoundLoopTime) }, + { "FireFX", parseAllVetLevelsFXList, nullptr, offsetof(WeaponTemplate, m_fireFXs) }, + { "ProjectileDetonationFX", parseAllVetLevelsFXList, nullptr, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, + { "FireOCL", parseAllVetLevelsAsciiString, nullptr, offsetof(WeaponTemplate, m_fireOCLNames) }, + { "ProjectileDetonationOCL", parseAllVetLevelsAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, + { "ProjectileExhaust", parseAllVetLevelsPSys, nullptr, offsetof(WeaponTemplate, m_projectileExhausts) }, + { "VeterancyFireFX", parsePerVetLevelFXList, nullptr, offsetof(WeaponTemplate, m_fireFXs) }, + { "VeterancyProjectileDetonationFX", parsePerVetLevelFXList, nullptr, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, + { "VeterancyFireOCL", parsePerVetLevelAsciiString, nullptr, offsetof(WeaponTemplate, m_fireOCLNames) }, + { "VeterancyProjectileDetonationOCL", parsePerVetLevelAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, + { "VeterancyProjectileExhaust", parsePerVetLevelPSys, nullptr, offsetof(WeaponTemplate, m_projectileExhausts) }, + { "ClipSize", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_clipSize) }, + { "ContinuousFireOne", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_continuousFireOneShotsNeeded) }, + { "ContinuousFireTwo", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_continuousFireTwoShotsNeeded) }, + { "ContinuousFireCoast", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_continuousFireCoastFrames) }, + { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, + { "ClipReloadTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_clipReloadTime) }, + { "DelayBetweenShots", WeaponTemplate::parseShotDelay, nullptr, 0 }, + { "ShotsPerBarrel", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_shotsPerBarrel) }, + { "DamageDealtAtSelfPosition",INI::parseBool, nullptr, offsetof(WeaponTemplate, m_damageDealtAtSelfPosition) }, { "RadiusDamageAffects", INI::parseBitString32, TheWeaponAffectsMaskNames, offsetof(WeaponTemplate, m_affectsMask) }, { "ProjectileCollidesWith", INI::parseBitString32, TheWeaponCollideMaskNames, offsetof(WeaponTemplate, m_collideMask) }, { "AntiAirborneVehicle", INI::parseBitInInt32, (void*)WEAPON_ANTI_AIRBORNE_VEHICLE, offsetof(WeaponTemplate, m_antiMask) }, @@ -215,24 +215,24 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "AntiAirborneInfantry", INI::parseBitInInt32, (void*)WEAPON_ANTI_AIRBORNE_INFANTRY, offsetof(WeaponTemplate, m_antiMask) }, { "AntiBallisticMissile", INI::parseBitInInt32, (void*)WEAPON_ANTI_BALLISTIC_MISSILE, offsetof(WeaponTemplate, m_antiMask) }, { "AutoReloadsClip", INI::parseIndexList, TheWeaponReloadNames, offsetof(WeaponTemplate, m_reloadType) }, - { "ProjectileStreamName", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_projectileStreamName) }, - { "LaserName", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_laserName) }, - { "WeaponBonus", WeaponTemplate::parseWeaponBonusSet, NULL, 0 }, - { "HistoricBonusTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_historicBonusTime) }, - { "HistoricBonusRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_historicBonusRadius) }, - { "HistoricBonusCount", INI::parseInt, NULL, offsetof(WeaponTemplate, m_historicBonusCount) }, - { "HistoricBonusWeapon", INI::parseWeaponTemplate, NULL, offsetof(WeaponTemplate, m_historicBonusWeapon) }, - { "LeechRangeWeapon", INI::parseBool, NULL, offsetof(WeaponTemplate, m_leechRangeWeapon) }, - { "ScatterTarget", WeaponTemplate::parseScatterTarget, NULL, 0 }, - { "CapableOfFollowingWaypoints", INI::parseBool, NULL, offsetof(WeaponTemplate, m_capableOfFollowingWaypoint) }, - { "ShowsAmmoPips", INI::parseBool, NULL, offsetof(WeaponTemplate, m_isShowsAmmoPips) }, - { "AllowAttackGarrisonedBldgs", INI::parseBool, NULL, offsetof(WeaponTemplate, m_allowAttackGarrisonedBldgs) }, - { "PlayFXWhenStealthed", INI::parseBool, NULL, offsetof(WeaponTemplate, m_playFXWhenStealthed) }, - { "PreAttackDelay", INI::parseDurationUnsignedInt, NULL, offsetof( WeaponTemplate, m_preAttackDelay ) }, + { "ProjectileStreamName", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileStreamName) }, + { "LaserName", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_laserName) }, + { "WeaponBonus", WeaponTemplate::parseWeaponBonusSet, nullptr, 0 }, + { "HistoricBonusTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_historicBonusTime) }, + { "HistoricBonusRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_historicBonusRadius) }, + { "HistoricBonusCount", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_historicBonusCount) }, + { "HistoricBonusWeapon", INI::parseWeaponTemplate, nullptr, offsetof(WeaponTemplate, m_historicBonusWeapon) }, + { "LeechRangeWeapon", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_leechRangeWeapon) }, + { "ScatterTarget", WeaponTemplate::parseScatterTarget, nullptr, 0 }, + { "CapableOfFollowingWaypoints", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_capableOfFollowingWaypoint) }, + { "ShowsAmmoPips", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_isShowsAmmoPips) }, + { "AllowAttackGarrisonedBldgs", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_allowAttackGarrisonedBldgs) }, + { "PlayFXWhenStealthed", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_playFXWhenStealthed) }, + { "PreAttackDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( WeaponTemplate, m_preAttackDelay ) }, { "PreAttackType", INI::parseIndexList, TheWeaponPrefireNames, offsetof(WeaponTemplate, m_prefireType) }, - { "ContinueAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_continueAttackRange) }, - { "SuspendFXDelay", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_suspendFXDelay) }, - { NULL, NULL, NULL, 0 } + { "ContinueAttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_continueAttackRange) }, + { "SuspendFXDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_suspendFXDelay) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -241,7 +241,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = /////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- -WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) +WeaponTemplate::WeaponTemplate() : m_nextTemplate(nullptr) { m_name = "NoNameWeapon"; @@ -265,16 +265,16 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_minTargetPitch = -PI; m_maxTargetPitch = PI; m_projectileName.clear(); // no projectile - m_projectileTmpl = NULL; + m_projectileTmpl = nullptr; for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) { m_fireOCLNames[i].clear(); m_projectileDetonationOCLNames[i].clear(); - m_projectileExhausts[i] = NULL; - m_fireOCLs[i] = NULL; - m_projectileDetonationOCLs[i] = NULL; - m_fireFXs[i] = NULL; - m_projectileDetonateFXs[i] = NULL; + m_projectileExhausts[i] = nullptr; + m_fireOCLs[i] = nullptr; + m_projectileDetonationOCLs[i] = nullptr; + m_fireFXs[i] = nullptr; + m_projectileDetonateFXs[i] = nullptr; } m_damageDealtAtSelfPosition = false; m_affectsMask = (WEAPON_AFFECTS_ALLIES | WEAPON_AFFECTS_ENEMIES | WEAPON_AFFECTS_NEUTRALS); @@ -291,7 +291,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_minDelayBetweenShots = 0; m_maxDelayBetweenShots = 0; m_fireSoundLoopTime = 0; - m_extraBonus = NULL; + m_extraBonus = nullptr; m_shotsPerBarrel = 1; m_antiMask = WEAPON_ANTI_GROUND; // but not air or projectile. m_projectileStreamName.clear(); @@ -299,7 +299,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_historicBonusTime = 0; m_historicBonusCount = 0; m_historicBonusRadius = 0; - m_historicBonusWeapon = NULL; + m_historicBonusWeapon = nullptr; m_leechRangeWeapon = FALSE; m_capableOfFollowingWaypoint = FALSE; m_isShowsAmmoPips = FALSE; @@ -348,7 +348,7 @@ void WeaponTemplate::reset( void ) Coord2D target; target.x = 0; target.y = 0; - INI::parseCoord2D( ini, NULL, &target, NULL ); + INI::parseCoord2D( ini, nullptr, &target, nullptr ); self->m_scatterTargets.push_back(target); } @@ -401,7 +401,7 @@ void WeaponTemplate::postProcessLoad() if (m_projectileName.isEmpty()) { - m_projectileTmpl = NULL; + m_projectileTmpl = nullptr; } else { @@ -414,7 +414,7 @@ void WeaponTemplate::postProcessLoad() // And the OCL if there is one if (m_fireOCLNames[i].isEmpty()) { - m_fireOCLs[i] = NULL; + m_fireOCLs[i] = nullptr; } else { @@ -426,7 +426,7 @@ void WeaponTemplate::postProcessLoad() // And the other OCL if there is one if (m_projectileDetonationOCLNames[i].isEmpty() ) { - m_projectileDetonationOCLs[i] = NULL; + m_projectileDetonationOCLs[i] = nullptr; } else { @@ -555,14 +555,14 @@ Real WeaponTemplate::estimateWeaponTemplateDamage( const WeaponBonus& bonus ) const { - if (sourceObj == NULL || (victimObj == NULL && victimPos == NULL)) + if (sourceObj == nullptr || (victimObj == nullptr && victimPos == nullptr)) { DEBUG_CRASH(("bad args to estimate")); return 0.0f; } const Real damageAmount = getPrimaryDamage(bonus); - if ( victimObj == NULL ) + if ( victimObj == nullptr ) { return damageAmount; } @@ -630,7 +630,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( if (intendedVictimID == thingWeCollidedWith->getID()) return true; - if (projectileLauncher != NULL) + if (projectileLauncher != nullptr) { // Don't hit your own launcher, ever. @@ -671,7 +671,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( for (BehaviorModule** i = thingWeCollidedWith->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp != NULL && pp->hasReservedSpace(intendedVictimID)) + if (pp != nullptr && pp->hasReservedSpace(intendedVictimID)) return false; } } @@ -679,7 +679,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( // if something has a Sneaky Target offset, it is momentarily immune to being hit... // normally this shouldn't happen, but occasionally can by accident. so avoid it. (srj) const AIUpdateInterface* ai = thingWeCollidedWith->getAI(); - if (ai != NULL && ai->getSneakyTargetingOffset(NULL)) + if (ai != nullptr && ai->getSneakyTargetingOffset(nullptr)) { return false; } @@ -748,19 +748,19 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate //CRCDEBUG_LOG(("WeaponTemplate::fireWeaponTemplate() from %s", DescribeObject(sourceObj).str())); DEBUG_ASSERTCRASH(specificBarrelToUse >= 0, ("specificBarrelToUse should no longer be -1")); - if (sourceObj == NULL || (victimObj == NULL && victimPos == NULL)) + if (sourceObj == nullptr || (victimObj == nullptr && victimPos == nullptr)) { //-extraLogging #if defined(RTS_DEBUG) if( TheGlobalData->m_extraLogging ) - DEBUG_LOG( ("FAIL 1 (sourceObj %d == NULL || (victimObj %d == NULL && victimPos %d == NULL)", sourceObj != 0, victimObj != 0, victimPos != 0) ); + DEBUG_LOG( ("FAIL 1 (sourceObj %d == nullptr || (victimObj %d == nullptr && victimPos %d == nullptr)", sourceObj != 0, victimObj != 0, victimPos != 0) ); #endif //end -extraLogging return 0; } - DEBUG_ASSERTCRASH((m_primaryDamage > 0) || (victimObj == NULL), ("You can't really shoot a zero damage weapon at an Object.") ); + DEBUG_ASSERTCRASH((m_primaryDamage > 0) || (victimObj == nullptr), ("You can't really shoot a zero damage weapon at an Object.") ); ObjectID sourceID = sourceObj->getID(); const Coord3D* sourcePos = sourceObj->getPosition(); @@ -777,7 +777,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate Coord3D sneakyOffset; const AIUpdateInterface* ai = victimObj->getAI(); - if (ai != NULL && ai->getSneakyTargetingOffset(&sneakyOffset)) + if (ai != nullptr && ai->getSneakyTargetingOffset(&sneakyOffset)) { victimPosStorage = *victimPos; victimPosStorage.x += sneakyOffset.x; @@ -786,7 +786,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate victimPos = &victimPosStorage; // for a sneaky offset, we always target a position rather than an object - victimObj = NULL; + victimObj = nullptr; victimID = INVALID_ID; distSqr = ThePartitionManager->getDistanceSquared(sourceObj, victimPos, ATTACK_RANGE_CALC_TYPE); } @@ -819,7 +819,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate } // DEBUG_LOG(("WeaponTemplate::fireWeaponTemplate: firing weapon %s (source=%s, victim=%s)", -// m_name.str(),sourceObj->getTemplate()->getName().str(),victimObj?victimObj->getTemplate()->getName().str():"NULL")); +// m_name.str(),sourceObj->getTemplate()->getName().str(),victimObj?victimObj->getTemplate()->getName().str():"null")); //Only perform this check if the weapon isn't a leech range weapon (which can have unlimited range!) if( !ignoreRanges && !isLeechRangeWeapon() ) @@ -880,7 +880,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate const FXList* fx = isProjectileDetonation ? getProjectileDetonateFX(v) : getFireFX(v); if ( TheGameLogic->getFrame() < firingWeapon->getSuspendFXFrame() ) - fx = NULL; + fx = nullptr; Bool handled; @@ -906,7 +906,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate ); } - if (handled == false && fx != NULL) + if (handled == false && fx != nullptr) { // bah. just play it at the drawable's pos. //DEBUG_LOG(("*** WeaponFireFX not fully handled by the client")); @@ -921,10 +921,10 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate VeterancyLevel v = sourceObj->getVeterancyLevel(); const ObjectCreationList *oclToUse = isProjectileDetonation ? getProjectileDetonationOCL(v) : getFireOCL(v); if( oclToUse ) - ObjectCreationList::create( oclToUse, sourceObj, NULL ); + ObjectCreationList::create( oclToUse, sourceObj, nullptr ); } - if (getProjectileTemplate() == NULL || isProjectileDetonation) + if (getProjectileTemplate() == nullptr || isProjectileDetonation) { // see if we need to be called back at a later point to deal the damage. Coord3D v; @@ -1045,7 +1045,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate targetLayer = victimObj->getLayer(); } - victimObj = NULL; // his position is already in victimPos, if he existed + victimObj = nullptr; // his position is already in victimPos, if he existed //Randomize the scatter radius (sometimes it can be more accurate than others) scatterRadius = GameLogicRandomValueReal( 0, scatterRadius ); @@ -1066,10 +1066,10 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate projectileDestination.z = TheTerrainLogic->getLayerHeight( projectileDestination.x, projectileDestination.y, targetLayer ); } - ProjectileUpdateInterface* pui = NULL; + ProjectileUpdateInterface* pui = nullptr; for (BehaviorModule** u = projectile->getBehaviorModules(); *u; ++u) { - if ((pui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((pui = (*u)->getProjectileUpdateInterface()) != nullptr) break; } if (pui) @@ -1252,7 +1252,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co if (sourceID == 0) // must have a source return; - if (victimID == 0 && pos == NULL) // must have some sort of destination + if (victimID == 0 && pos == nullptr) // must have some sort of destination return; Object *source = TheGameLogic->findObjectByID(sourceID); // might be null... @@ -1262,7 +1262,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co //DEBUG_LOG(("WeaponTemplate::dealDamageInternal: dealing damage %s at frame %d",m_name.str(),TheGameLogic->getFrame())); // if there's a specific victim, use it's pos (overriding the value passed in) - Object *primaryVictim = victimID ? TheGameLogic->findObjectByID(victimID) : NULL; // might be null... + Object *primaryVictim = victimID ? TheGameLogic->findObjectByID(victimID) : nullptr; // might be null... if (primaryVictim) { pos = primaryVictim->getPosition(); @@ -1270,7 +1270,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co DamageType damageType = getDamageType(); DeathType deathType = getDeathType(); - if (getProjectileTemplate() == NULL || isProjectileDetonation) + if (getProjectileTemplate() == nullptr || isProjectileDetonation) { SimpleObjectIterator *iter; Object *curVictim; @@ -1293,20 +1293,20 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co } else { - //DEBUG_ASSERTCRASH(primaryVictim != NULL, ("weapons without radii should always pass in specific victims")); + //DEBUG_ASSERTCRASH(primaryVictim != nullptr, ("weapons without radii should always pass in specific victims")); // check against victimID rather than primaryVictim, since we may have targeted a legitimate victim // that got killed before the damage was dealt... (srj) //DEBUG_ASSERTCRASH(victimID != 0, ("weapons without radii should always pass in specific victims")); - iter = NULL; + iter = nullptr; curVictim = primaryVictim; curVictimDistSqr = 0.0f; } MemoryPoolObjectHolder hold(iter); - for (; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for (; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { Bool killSelf = false; - if (source != NULL) + if (source != nullptr) { // anytime something is designated as the "primary victim" (ie, the direct target // of the weapon), we ignore all the "affects" flags. @@ -1400,7 +1400,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co for (BehaviorModule** u = source->getBehaviorModules(); *u; ++u) { ProjectileUpdateInterface* pui = (*u)->getProjectileUpdateInterface(); - if (pui != NULL) + if (pui != nullptr) { damageInfo.in.m_sourceID = pui->projectileGetLauncherID(); break; @@ -1453,7 +1453,7 @@ void WeaponStore::handleProjectileDetonation(const WeaponTemplate* wt, const Obj //------------------------------------------------------------------------------------------------- void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object *source, const Coord3D* pos) { - if (wt == NULL) + if (wt == nullptr) return; Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1465,7 +1465,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object *source, Object *target) { //CRCDEBUG_LOG(("WeaponStore::createAndFireTempWeapon() for %s", DescribeObject(source))); - if (wt == NULL) + if (wt == nullptr) return; Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1477,9 +1477,9 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object const WeaponTemplate *WeaponStore::findWeaponTemplate( const AsciiString& name ) const { if (name.compareNoCase("None") == 0) - return NULL; + return nullptr; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); + DEBUG_ASSERTCRASH(wt != nullptr, ("Weapon %s not found!",name)); return wt; } @@ -1487,9 +1487,9 @@ const WeaponTemplate *WeaponStore::findWeaponTemplate( const AsciiString& name ) const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); + DEBUG_ASSERTCRASH(wt != nullptr, ("Weapon %s not found!",name)); return wt; } @@ -1501,7 +1501,7 @@ WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const if(it != m_weaponTemplateHashMap.end()) return it->second; - return NULL; + return nullptr; } @@ -1511,7 +1511,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -1527,7 +1527,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) WeaponTemplate *WeaponStore::newOverride(WeaponTemplate *weaponTemplate) { if (!weaponTemplate) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -2148,7 +2148,7 @@ Bool Weapon::isGoalPosWithinAttackRange(const Object *source, const Coord3D* goa // otherwise if it teters on the edge, attacks can fail. jba. Real attackRangeSqr = sqr(getAttackRange(source)-(PATHFIND_CELL_SIZE_F*0.25f)); - if (target != NULL) + if (target != nullptr) { if (target->isKindOf(KINDOF_BRIDGE)) { @@ -2254,7 +2254,7 @@ Real Weapon::getAttackDistance(const Object *source, const Object *victimObj, co { Real range = getAttackRange(source); - if (victimObj != NULL) + if (victimObj != nullptr) { #ifdef ATTACK_RANGE_IS_2D range += source->getGeometryInfo().getBoundingCircleRadius(); @@ -2293,12 +2293,12 @@ void Weapon::newProjectileFired(const Object *sourceObj, const Object *projectil return; // nope, no streak logic to do Object* projectileStream = TheGameLogic->findObjectByID(m_projectileStreamID); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) { m_projectileStreamID = INVALID_ID; // reset, since it might have been "valid" but deleted out from under us const ThingTemplate* pst = TheThingFactory->findTemplate(m_template->getProjectileStreamName()); projectileStream = TheThingFactory->newObject( pst, sourceObj->getControllingPlayer()->getDefaultTeam() ); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) return; m_projectileStreamID = projectileStream->getID(); } @@ -2320,7 +2320,7 @@ void Weapon::createLaser( const Object *sourceObj, const Object *victimObj, cons { const ThingTemplate* pst = TheThingFactory->findTemplate(m_template->getLaserName()); Object* laser = TheThingFactory->newObject( pst, sourceObj->getControllingPlayer()->getDefaultTeam() ); - if( laser == NULL ) + if( laser == nullptr ) return; //Check for laser update @@ -2475,7 +2475,7 @@ Bool Weapon::privateFireWeapon( if( victimObj ) { victimPos = victimObj->getPosition(); - victimObj = NULL; + victimObj = nullptr; } Coord3D targetPos = *victimPos; // need to copy, as this pointer is actually inside somebody potentially Int randomPick = GameLogicRandomValue( 0, m_scatterTargetsUnused.size() - 1 ); @@ -2580,7 +2580,7 @@ void Weapon::preFireWeapon( const Object *source, const Object *victim ) Bool Weapon::fireWeapon(const Object *source, Object *target, ObjectID* projectileID) { //CRCDEBUG_LOG(("Weapon::fireWeapon() for %s at %s", DescribeObject(source).str(), DescribeObject(target).str())); - return privateFireWeapon(source, target, NULL, false, false, 0, projectileID); + return privateFireWeapon(source, target, nullptr, false, false, 0, projectileID); } //------------------------------------------------------------------------------------------------- @@ -2588,21 +2588,21 @@ Bool Weapon::fireWeapon(const Object *source, Object *target, ObjectID* projecti Bool Weapon::fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID) { //CRCDEBUG_LOG(("Weapon::fireWeapon() for %s", DescribeObject(source).str())); - return privateFireWeapon(source, NULL, pos, false, false, 0, projectileID); + return privateFireWeapon(source, nullptr, pos, false, false, 0, projectileID); } //------------------------------------------------------------------------------------------------- void Weapon::fireProjectileDetonationWeapon(const Object *source, Object *target, WeaponBonusConditionFlags extraBonusFlags) { //CRCDEBUG_LOG(("Weapon::fireProjectileDetonationWeapon() for %sat %s", DescribeObject(source).str(), DescribeObject(target).str())); - privateFireWeapon(source, target, NULL, true, false, extraBonusFlags, NULL); + privateFireWeapon(source, target, nullptr, true, false, extraBonusFlags, nullptr); } //------------------------------------------------------------------------------------------------- void Weapon::fireProjectileDetonationWeapon(const Object *source, const Coord3D* pos, WeaponBonusConditionFlags extraBonusFlags) { //CRCDEBUG_LOG(("Weapon::fireProjectileDetonationWeapon() for %s", DescribeObject(source).str())); - privateFireWeapon(source, NULL, pos, true, false, extraBonusFlags, NULL); + privateFireWeapon(source, nullptr, pos, true, false, extraBonusFlags, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2616,7 +2616,7 @@ Object* Weapon::forceFireWeapon( const Object *source, const Coord3D *pos) //Fire the weapon at the position. Internally, it'll store the weapon projectile ID if so created. ObjectID projectileID = INVALID_ID; const Bool ignoreRange = true; - privateFireWeapon(source, NULL, pos, false, ignoreRange, NULL, &projectileID); + privateFireWeapon(source, nullptr, pos, false, ignoreRange, 0, &projectileID); return TheGameLogic->findObjectByID( projectileID ); } @@ -2744,8 +2744,8 @@ class AssistanceRequestData //------------------------------------------------------------------------------------------------- AssistanceRequestData::AssistanceRequestData() { - m_requestingObject = NULL; - m_victimObject = NULL; + m_requestingObject = nullptr; + m_victimObject = nullptr; m_requestDistanceSquared = 0.0f; } @@ -2770,7 +2770,7 @@ static void makeAssistanceRequest( Object *requestOf, void *userData ) // and respond to requests static const NameKeyType key_assistUpdate = NAMEKEY("AssistedTargetingUpdate"); AssistedTargetingUpdate *assistModule = (AssistedTargetingUpdate*)requestOf->findUpdateModule(key_assistUpdate); - if( assistModule == NULL ) + if( assistModule == nullptr ) return; // and say yes @@ -2831,7 +2831,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v Coord3D turretRotPos = {0.0f, 0.0f, 0.0f}; Coord3D turretPitchPos = {0.0f, 0.0f, 0.0f}; const Drawable* draw = launcher->getDrawable(); - //CRCDEBUG_LOG(("Do we have a drawable? %d", (draw != NULL))); + //CRCDEBUG_LOG(("Do we have a drawable? %d", (draw != nullptr))); if (!draw || !draw->getProjectileLaunchOffset(wslot, specificBarrelToUse, &attachTransform, tur, &turretRotPos, &turretPitchPos)) { //CRCDEBUG_LOG(("ProjectileLaunchPos %d %d not found!",wslot, specificBarrelToUse)); @@ -2867,7 +2867,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v #endif } - launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); + launcher->convertBonePosToWorldPos(nullptr, &attachTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); worldPos.x = tmp.X; @@ -2887,7 +2887,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v //DescribeObject(projectile).str(), DescribeObject(launcher).str())); // if our launch vehicle is gone, destroy ourselves - if (launcher == NULL) + if (launcher == nullptr) { TheGameLogic->destroyObject( projectile ); return; @@ -2924,7 +2924,7 @@ void Weapon::getFiringLineOfSightOrigin(const Object* source, Coord3D& origin) c origin.z += source->getGeometryInfo().getMaxHeightAbovePosition(); /* - if (m_template->getProjectileTemplate() == NULL) + if (m_template->getProjectileTemplate() == nullptr) { // note that we want to measure from the top of the collision // shape, not the bottom! (most objects have eyes a lot closer @@ -2958,7 +2958,7 @@ Bool Weapon::isClearFiringLineOfSightTerrain(const Object* source, const Object* //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain() - victimPos is (%g,%g,%g) (%X,%X,%X)", // victimPos.x, victimPos.y, victimPos.z, // AS_INT(victimPos.x),AS_INT(victimPos.y),AS_INT(victimPos.z))); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -2970,7 +2970,7 @@ Bool Weapon::isClearFiringLineOfSightTerrain(const Object* source, const Coord3D //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain(Coord3D) for %s", DescribeObject(source).str())); //DUMPCOORD3D(&origin); getFiringLineOfSightOrigin(source, origin); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -2984,7 +2984,7 @@ Bool Weapon::isClearGoalFiringLineOfSightTerrain(const Object* source, const Coo getFiringLineOfSightOrigin(source, origin); Coord3D victimPos; victim->getGeometryInfo().getCenterPosition( *victim->getPosition(), victimPos ); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -2999,7 +2999,7 @@ Bool Weapon::isClearGoalFiringLineOfSightTerrain(const Object* source, const Coo //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain() - victimPos is (%g,%g,%g) (%X,%X,%X)", // victimPos.x, victimPos.y, victimPos.z, // AS_INT(victimPos.x),AS_INT(victimPos.y),AS_INT(victimPos.z))); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } // ------------------------------------------------------------------------------------------------ @@ -3222,7 +3222,7 @@ void Weapon::xfer( Xfer *xfer ) if (xfer->getXferMode() == XFER_LOAD) { m_template = TheWeaponStore->findWeaponTemplate(tmplName); - if (m_template == NULL) + if (m_template == nullptr) throw INI_INVALID_DATA; } } @@ -3319,7 +3319,7 @@ void Weapon::loadPostProcess( void ) if( m_projectileStreamID != INVALID_ID ) { Object* projectileStream = TheGameLogic->findObjectByID( m_projectileStreamID ); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) { m_projectileStreamID = INVALID_ID; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 9eb4a1e54eb..bdcedf09078 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -71,7 +71,7 @@ const char* const WeaponSetFlags::s_bitNameList[] = "CARBOMB", "MINE_CLEARING_DETAIL", - NULL + nullptr }; static_assert(ARRAY_SIZE(WeaponSetFlags::s_bitNameList) == WeaponSetFlags::NumBits + 1, "Incorrect array size"); @@ -95,7 +95,7 @@ void WeaponTemplateSet::clear() m_types.clear(); for (int i = 0; i < WEAPONSLOT_COUNT; ++i) { - m_template[i] = NULL; + m_template[i] = nullptr; m_autoChooseMask[i] = 0xffffffff; // by default, allow autochoosing from any CommandSource CLEAR_KINDOFMASK(m_preferredAgainst[i]); // by default, weapon isn't preferred against anything in particular } @@ -117,7 +117,7 @@ void WeaponTemplateSet::parseWeapon(INI* ini, void *instance, void * /*store*/, { WeaponTemplateSet* self = (WeaponTemplateSet*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseWeaponTemplate(ini, instance, &self->m_template[wslot], NULL); + INI::parseWeaponTemplate(ini, instance, &self->m_template[wslot], nullptr); } //------------------------------------------------------------------------------------------------- @@ -133,7 +133,7 @@ void WeaponTemplateSet::parsePreferredAgainst(INI* ini, void *instance, void * / { WeaponTemplateSet* self = (WeaponTemplateSet*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - KindOfMaskType::parseFromINI(ini, instance, &self->m_preferredAgainst[wslot], NULL); + KindOfMaskType::parseFromINI(ini, instance, &self->m_preferredAgainst[wslot], nullptr); } //------------------------------------------------------------------------------------------------- @@ -141,13 +141,13 @@ void WeaponTemplateSet::parseWeaponTemplateSet( INI* ini, const ThingTemplate* t { static const FieldParse myFieldParse[] = { - { "Conditions", WeaponSetFlags::parseFromINI, NULL, offsetof( WeaponTemplateSet, m_types ) }, - { "Weapon", WeaponTemplateSet::parseWeapon, NULL, 0 }, - { "AutoChooseSources", WeaponTemplateSet::parseAutoChoose, NULL, 0 }, - { "PreferredAgainst", WeaponTemplateSet::parsePreferredAgainst, NULL, 0 }, - { "ShareWeaponReloadTime", INI::parseBool, NULL, offsetof( WeaponTemplateSet, m_isReloadTimeShared ) }, - { "WeaponLockSharedAcrossSets", INI::parseBool, NULL, offsetof( WeaponTemplateSet, m_isWeaponLockSharedAcrossSets ) }, - { 0, 0, 0, 0 } + { "Conditions", WeaponSetFlags::parseFromINI, nullptr, offsetof( WeaponTemplateSet, m_types ) }, + { "Weapon", WeaponTemplateSet::parseWeapon, nullptr, 0 }, + { "AutoChooseSources", WeaponTemplateSet::parseAutoChoose, nullptr, 0 }, + { "PreferredAgainst", WeaponTemplateSet::parsePreferredAgainst, nullptr, 0 }, + { "ShareWeaponReloadTime", INI::parseBool, nullptr, offsetof( WeaponTemplateSet, m_isReloadTimeShared ) }, + { "WeaponLockSharedAcrossSets", INI::parseBool, nullptr, offsetof( WeaponTemplateSet, m_isWeaponLockSharedAcrossSets ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(this, myFieldParse); @@ -169,7 +169,7 @@ WeaponSet::WeaponSet() { m_curWeapon = PRIMARY_WEAPON; m_curWeaponLockedStatus = NOT_LOCKED; - m_curWeaponTemplateSet = NULL; + m_curWeaponTemplateSet = nullptr; m_filledWeaponSlotMask = 0; m_totalAntiMask = 0; m_totalDamageTypeMask = 0; @@ -177,7 +177,7 @@ WeaponSet::WeaponSet() m_hasPitchLimit = false; m_hasDamageWeapon = false; for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) - m_weapons[i] = NULL; + m_weapons[i] = nullptr; } //------------------------------------------------------------------------------------------------- @@ -217,16 +217,16 @@ void WeaponSet::xfer( Xfer *xfer ) if (ttName.isEmpty()) { - m_curWeaponTemplateSet = NULL; + m_curWeaponTemplateSet = nullptr; } else { const ThingTemplate* tt = TheThingFactory->findTemplate(ttName); - if (tt == NULL) + if (tt == nullptr) throw INI_INVALID_DATA; m_curWeaponTemplateSet = tt->findWeaponTemplateSet(wsFlags); - if (m_curWeaponTemplateSet == NULL) + if (m_curWeaponTemplateSet == nullptr) throw INI_INVALID_DATA; } } @@ -234,10 +234,10 @@ void WeaponSet::xfer( Xfer *xfer ) { AsciiString ttName; // leave 'em empty in case we're null WeaponSetFlags wsFlags; - if (m_curWeaponTemplateSet != NULL) + if (m_curWeaponTemplateSet != nullptr) { const ThingTemplate* tt = m_curWeaponTemplateSet->friend_getThingTemplate(); - if (tt == NULL) + if (tt == nullptr) throw INI_INVALID_DATA; ttName = tt->getName(); @@ -249,14 +249,14 @@ void WeaponSet::xfer( Xfer *xfer ) for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { - Bool hasWeaponInSlot = (m_weapons[i] != NULL); + Bool hasWeaponInSlot = (m_weapons[i] != nullptr); xfer->xferBool(&hasWeaponInSlot); if (hasWeaponInSlot) { - if (xfer->getXferMode() == XFER_LOAD && m_weapons[i] == NULL) + if (xfer->getXferMode() == XFER_LOAD && m_weapons[i] == nullptr) { const WeaponTemplate* wt = m_curWeaponTemplateSet->getNth((WeaponSlotType)i); - if (wt==NULL) { + if (wt==nullptr) { DEBUG_CRASH(("xfer backwards compatibility code - old save file??? jba.")); wt = m_curWeaponTemplateSet->getNth((WeaponSlotType)0); } @@ -304,7 +304,7 @@ void WeaponSet::updateWeaponSet(const Object* obj) for (Int i = WEAPONSLOT_COUNT - 1; i >= PRIMARY_WEAPON ; --i) { deleteInstance(m_weapons[i]); - m_weapons[i] = NULL; + m_weapons[i] = nullptr; if (set->getNth((WeaponSlotType)i)) { @@ -541,7 +541,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac // if the victim is contained within an enclosing container, it cannot be attacked directly const Object* victimsContainer = victim->getContainedBy(); - if (victimsContainer != NULL && victimsContainer->getContain()->isEnclosingContainerFor(victim) == TRUE) + if (victimsContainer != nullptr && victimsContainer->getContain()->isEnclosingContainerFor(victim) == TRUE) { return ATTACKRESULT_NOT_POSSIBLE; } @@ -625,7 +625,7 @@ CanAttackResult WeaponSet::getAbleToUseWeaponAgainstTarget( AbleToAttackType att continue; Bool handled = FALSE; - ContainModuleInterface *contain = containedBy ? containedBy->getContain() : NULL; + ContainModuleInterface *contain = containedBy ? containedBy->getContain() : nullptr; if( contain && contain->isGarrisonable() ) { //For contained things, we need to fake-move objects to the best garrison point in order @@ -764,7 +764,7 @@ Bool WeaponSet::chooseBestWeaponForTarget(const Object* obj, const Object* victi then choose the gun and go back to wanting to choose the missile, etc */ - if (victim == NULL) + if (victim == nullptr) return false; // Usually cause victim just got killed. jba. if( isCurWeaponLocked() ) @@ -798,7 +798,7 @@ Bool WeaponSet::chooseBestWeaponForTarget(const Object* obj, const Object* victi continue; Weapon* weapon = m_weapons[i]; - if (weapon == NULL) + if (weapon == nullptr) continue; // weapon out of range. @@ -928,7 +928,7 @@ void WeaponSet::reloadAllAmmo(const Object *obj, Bool now) for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { Weapon* weapon = m_weapons[i]; - if (weapon != NULL) + if (weapon != nullptr) { if (now) weapon->loadAmmoNow(obj); @@ -944,7 +944,7 @@ Bool WeaponSet::isOutOfAmmo() const for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { const Weapon* weapon = m_weapons[i]; - if (weapon == NULL) + if (weapon == nullptr) continue; if (weapon->getStatus() != OUT_OF_AMMO) { @@ -965,7 +965,7 @@ const Weapon* WeaponSet::findAmmoPipShowingWeapon() const return weapon; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -978,7 +978,7 @@ Weapon* WeaponSet::findWaypointFollowingCapableWeapon() return m_weapons[i]; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -994,7 +994,7 @@ Bool WeaponSet::setWeaponLock( WeaponSlotType weaponSlot, WeaponLockType lockTyp // Verify the asked for weapon exists , choose it, and then lock it as choosen until unlocked // the old code was just plain wrong. (look at it in perforce and you'll see...) - if (m_weapons[weaponSlot] != NULL) + if (m_weapons[weaponSlot] != nullptr) { if( lockType == LOCKED_PERMANENTLY ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 6680f09c8ce..5aa14860a19 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -117,8 +117,8 @@ static void updateTeamAndPlayerStuff( Object *obj, void *userData ) #define REALLY_FAR (100000 * MAP_XY_FACTOR) // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptActionsInterface *TheScriptActions = NULL; -GameWindow *ScriptActions::m_messageWindow = NULL; +ScriptActionsInterface *TheScriptActions = nullptr; +GameWindow *ScriptActions::m_messageWindow = nullptr; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -174,7 +174,7 @@ void ScriptActions::closeWindows( Bool suppressNewWindows ) if (m_messageWindow) { TheWindowManager->winDestroy(m_messageWindow); - m_messageWindow = NULL; + m_messageWindow = nullptr; } } @@ -483,7 +483,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS Bool needToMoveToDestination = false; //Validate the waypoint Waypoint *way = TheTerrainLogic->getWaypointByName(waypoint); - if (way==NULL) + if (way==nullptr) { return; } @@ -505,7 +505,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Create the team (not the units inside team). Team *theTeam = TheTeamFactory->createInactiveTeam( team ); - if (theTeam==NULL) { + if (theTeam==nullptr) { return; } const ThingTemplate *transportTemplate; @@ -513,8 +513,8 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Create the transport first (if applicable), so we can determine if it has paradrop capabilities. //If so, we'll be doing a lot of things differently! - Object *transport=NULL; - ContainModuleInterface *contain = NULL; + Object *transport=nullptr; + ContainModuleInterface *contain = nullptr; transportTemplate = TheThingFactory->findTemplate( pInfo->m_transportUnitType ); if( transportTemplate ) { @@ -531,7 +531,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Check to see if we have a transport, and if our transport has paradrop capabilities. If this is the //case, we'll need to create each unit inside "parachute containers". static NameKeyType key_DeliverPayloadAIUpdate = NAMEKEY("DeliverPayloadAIUpdate"); - DeliverPayloadAIUpdate *dp = NULL; + DeliverPayloadAIUpdate *dp = nullptr; if( transport ) { dp = (DeliverPayloadAIUpdate*)transport->findUpdateModule(key_DeliverPayloadAIUpdate); @@ -539,7 +539,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Our tranport has a deliverPayload update module. This means it'll do airborned drops. - const ThingTemplate* putInContainerTemplate = NULL; + const ThingTemplate* putInContainerTemplate = nullptr; if( dp ) { //Check to see if we are packaging our units @@ -555,7 +555,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS Coord3D pos = origin; if (unitTemplate && theTeam) { - Object *obj = NULL; + Object *obj = nullptr; for (j=0; jm_unitsInfo[i].maxUnits; j++) { // create new object in the world @@ -628,7 +628,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS } } - contain = NULL; + contain = nullptr; if( transport ) { contain = transport->getContain(); @@ -647,7 +647,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS // it's our transport. continue; } - if (obj->getContainedBy() != NULL) + if (obj->getContainedBy() != nullptr) { continue; } @@ -821,10 +821,10 @@ void ScriptActions::doOversizeTheTerrain(Int amount) void ScriptActions::doSetupCamera(const AsciiString& waypoint, Real zoom, Real pitch, const AsciiString& lookAtWaypoint) { Waypoint *way = TheTerrainLogic->getWaypointByName(waypoint); - if (way==NULL) return; + if (way==nullptr) return; Coord3D pos = *way->getLocation(); Waypoint *lookat = TheTerrainLogic->getWaypointByName(lookAtWaypoint); - if (lookat==NULL) return; + if (lookat==nullptr) return; Coord3D destination = *lookat->getLocation(); TheTacticalView->moveCameraTo(&pos, 0, 0, true); TheTacticalView->cameraModLookToward(&destination); @@ -928,7 +928,7 @@ void ScriptActions::doRotateCameraTowardObject(const AsciiString& unitName, Real void ScriptActions::doRotateCameraTowardWaypoint(const AsciiString& waypointName, Real sec) { Waypoint *way = TheTerrainLogic->getWaypointByName(waypointName); - if (way==NULL) return; + if (way==nullptr) return; TheTacticalView->rotateCameraTowardPosition(way->getLocation(), sec*1000); } @@ -950,7 +950,7 @@ void ScriptActions::doMoveCameraAlongWaypointPath(const AsciiString& waypoint, R //------------------------------------------------------------------------------------------------- void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiString& thingName, const AsciiString& teamName, Coord3D *pos, Real angle ) { - Object* pOldObj = NULL; + Object* pOldObj = nullptr; if (objectName != m_unnamedUnit) { pOldObj = TheScriptEngine->getUnitNamed(objectName); @@ -968,7 +968,7 @@ void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiStr Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); // The team is the team based on the name, and the calling team (if any) and the team that // triggered the condition. jba. :) - if (theTeam==NULL) { + if (theTeam==nullptr) { // We may need to create the team. theTeam = TheTeamFactory->createTeam( teamName ); } @@ -1014,7 +1014,7 @@ void ScriptActions::doAttack(const AsciiString& attackerName, const AsciiString& const Team *victimTeam = TheScriptEngine->getTeamNamed( victimName ); // sanity - if( attackingTeam == NULL || victimTeam == NULL ) + if( attackingTeam == nullptr || victimTeam == nullptr ) return; AIGroupPtr aiGroup = TheAI->createGroup(); @@ -1138,7 +1138,7 @@ void ScriptActions::createUnitOnTeamAt(const AsciiString& unitName, const AsciiS Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); // The team is the team based on the name, and the calling team (if any) and the team that // triggered the condition. jba. :) - if (theTeam==NULL) { + if (theTeam==nullptr) { // We may need to create the team. theTeam = TheTeamFactory->createTeam( teamName ); } @@ -1653,7 +1653,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName Coord3D pos; pos.x=pos.y=pos.z=0; - Object *firstUnit=NULL; + Object *firstUnit=nullptr; // Get the center point for the team for (DLINK_ITERATOR iter = theTeam->iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -1663,7 +1663,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName pos.y += objPos.y; pos.z += objPos.z; // Not actually used by getClosestWaypointOnPath, but hey, might as well be correct. count++; - if (firstUnit==NULL) { + if (firstUnit==nullptr) { firstUnit = obj; } } @@ -1673,7 +1673,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName pos.z /= count; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer==NULL) return; + if (enemyPlayer==nullptr) return; Int mpNdx = enemyPlayer->getMpStartIndex()+1; AsciiString pathLabel; @@ -1736,7 +1736,7 @@ void ScriptActions::doTeamMoveToSkirmishApproachPath(const AsciiString& teamName pos.z /= count; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer==NULL) return; + if (enemyPlayer==nullptr) return; Int mpNdx = enemyPlayer->getMpStartIndex()+1; AsciiString pathLabel; @@ -2602,7 +2602,7 @@ void ScriptActions::doCameoFlash(const AsciiString& name, Int timeInSeconds) //sanity button = TheControlBar->findCommandButton( name ); - if( button == NULL ) + if( button == nullptr ) { DEBUG_CRASH(( "ScriptActions::doCameoFlash can't find AsciiString cameoflash" )); return; @@ -2664,7 +2664,7 @@ void ScriptActions::doNamedFlash(const AsciiString& unitName, Int timeInSeconds, Int frames = LOGICFRAMES_PER_SECOND * timeInSeconds; // every time the framecount % 20 == 0, drawable::update will call doNamedFlash Int count = frames / DRAWABLE_FRAMES_PER_FLASH; - Color flashy = (color == NULL) ? obj->getIndicatorColor() : color->getAsInt(); + Color flashy = (color == nullptr) ? obj->getIndicatorColor() : color->getAsInt(); drawable->setFlashColor( flashy ); drawable->setFlashCount( count ); return; @@ -2677,7 +2677,7 @@ void ScriptActions::doNamedFlash(const AsciiString& unitName, Int timeInSeconds, void ScriptActions::doTeamFlash(const AsciiString& teamName, Int timeInSeconds, const RGBColor *color) { Team *team = TheScriptEngine->getTeamNamed( teamName ); - if (team == NULL || !team->hasAnyObjects()) + if (team == nullptr || !team->hasAnyObjects()) return; DLINK_ITERATOR iter = team->iterate_TeamMemberList(); @@ -2696,7 +2696,7 @@ void ScriptActions::doTeamFlash(const AsciiString& teamName, Int timeInSeconds, Int frames = LOGICFRAMES_PER_SECOND * timeInSeconds; Int count = frames / DRAWABLE_FRAMES_PER_FLASH; - Color flashy = (color == NULL) ? obj->getIndicatorColor() : color->getAsInt(); + Color flashy = (color == nullptr) ? obj->getIndicatorColor() : color->getAsInt(); draw->setFlashColor( flashy ); draw->setFlashCount( count ); } @@ -2781,7 +2781,7 @@ void ScriptActions::doNamedTransferAssetsToPlayer(const AsciiString& unitName, c } pObj->setTeam(playerTeam); - updateTeamAndPlayerStuff(pObj, NULL); + updateTeamAndPlayerStuff(pObj, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2790,7 +2790,7 @@ void ScriptActions::doNamedTransferAssetsToPlayer(const AsciiString& unitName, c void ScriptActions::excludePlayerFromScoreScreen(const AsciiString& playerName) { Player *pPlayer = TheScriptEngine->getPlayerFromAsciiString(playerName); - if (pPlayer == NULL) { + if (pPlayer == nullptr) { return; } @@ -3128,7 +3128,7 @@ void ScriptActions::doMergeTeamIntoTeam(const AsciiString& teamSrcName, const As { Team *teamSrc = TheScriptEngine->getTeamNamed(teamSrcName); Team *teamDest = TheScriptEngine->getTeamNamed(teamDestName); - if (teamDest==NULL) { + if (teamDest==nullptr) { teamDest = TheTeamFactory->findTeam( teamDestName ); } if (!teamSrc || !teamDest) { @@ -3150,12 +3150,12 @@ void ScriptActions::doMergeTeamIntoTeam(const AsciiString& teamSrcName, const As nextObj = iter.cur(); iter.advance(); obj->setTeam(teamDest); - updateTeamAndPlayerStuff(obj, NULL); + updateTeamAndPlayerStuff(obj, nullptr); } if (nextObj) { nextObj->setTeam(teamDest); - updateTeamAndPlayerStuff(nextObj, NULL); + updateTeamAndPlayerStuff(nextObj, nullptr); } teamSrc->deleteTeam(); @@ -3365,7 +3365,7 @@ void ScriptActions::doTeamGarrisonNearestBuilding(const AsciiString& teamName) PartitionFilterGarrisonableByPlayer f1(theTeam->getControllingPlayer(), true, CMD_FROM_SCRIPT); PartitionFilterSameMapStatus filterMapStatus(leader); - PartitionFilter *filters[] = { &f1, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &f1, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(leader, REALLY_FAR, FROM_CENTER_3D, filters, ITER_SORTED_NEAR_TO_FAR); MemoryPoolObjectHolder hold(iter); @@ -3419,7 +3419,7 @@ void ScriptActions::doTeamExitAllBuildings(const AsciiString& teamName) } ai->chooseLocomotorSet(LOCOMOTORSET_NORMAL); - ai->aiExit(NULL, CMD_FROM_SCRIPT); + ai->aiExit(nullptr, CMD_FROM_SCRIPT); } } @@ -3476,7 +3476,7 @@ void ScriptActions::doUnitGarrisonNearestBuilding(const AsciiString& unitName) PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); PartitionFilterSameMapStatus filterMapStatus(theUnit); - PartitionFilter *filters[] = { &f1, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &f1, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(theUnit, REALLY_FAR, FROM_CENTER_3D, filters, ITER_SORTED_NEAR_TO_FAR); MemoryPoolObjectHolder hold(iter); @@ -3549,7 +3549,7 @@ void ScriptActions::doUnitExitBuilding(const AsciiString& unitName) } ai->chooseLocomotorSet(LOCOMOTORSET_NORMAL); - ai->aiExit(NULL, CMD_FROM_SCRIPT); + ai->aiExit(nullptr, CMD_FROM_SCRIPT); } //------------------------------------------------------------------------------------------------- @@ -3799,7 +3799,7 @@ void ScriptActions::doTransferTeamToPlayer(const AsciiString& teamName, const As theTeam->setControllingPlayer(playerDest); // srj sez: ensure that all these guys get the upgrades that belong to the new player - theTeam->iterateObjects(updateTeamAndPlayerStuff, NULL); + theTeam->iterateObjects(updateTeamAndPlayerStuff, nullptr); } //------------------------------------------------------------------------------------------------- @@ -3971,11 +3971,11 @@ void ScriptActions::doSkirmishFireSpecialPowerAtMostCost( const AsciiString &pla { Int enemyNdx; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer == NULL) return; + if (enemyPlayer == nullptr) return; enemyNdx = enemyPlayer->getPlayerIndex(); const SpecialPowerTemplate *power = TheSpecialPowerStore->findSpecialPowerTemplate(specialPower); - if (power==NULL) + if (power==nullptr) return; Real radius = 50.0f; if (power->getRadiusCursorRadius()>radius) { @@ -3985,7 +3985,7 @@ void ScriptActions::doSkirmishFireSpecialPowerAtMostCost( const AsciiString &pla Player::PlayerTeamList::const_iterator it; Player *pPlayer = TheScriptEngine->getPlayerFromAsciiString(player); - if (pPlayer==NULL) + if (pPlayer==nullptr) return; Coord3D location; @@ -4419,8 +4419,8 @@ void ScriptActions::doTeamRemoveAllOverrideRelations(const AsciiString& teamName Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); if (theTeam) { // invalid ID is OK -- it removes all relationships - theTeam->removeOverrideTeamRelationship( NULL ); - theTeam->removeOverridePlayerRelationship( NULL ); + theTeam->removeOverrideTeamRelationship( TEAM_ID_INVALID ); + theTeam->removeOverridePlayerRelationship( PLAYER_INDEX_INVALID ); } } //------------------------------------------------------------------------------------------------- @@ -4689,11 +4689,11 @@ void ScriptActions::doBorderSwitch(Int borderToUse) * and re-reveal the map. BGC */ Int observerPlayerIndex = -1; - if (ThePlayerList != NULL) + if (ThePlayerList != nullptr) { Player *observer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); - if (observer != NULL) { + if (observer != nullptr) { observerPlayerIndex = observer->getPlayerIndex(); } } @@ -4724,7 +4724,7 @@ void ScriptActions::doForceObjectSelection(const AsciiString& teamName, const As return; } - Object *bestGuess = NULL; + Object *bestGuess = nullptr; for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { Object *obj = iter.cur(); @@ -4733,7 +4733,7 @@ void ScriptActions::doForceObjectSelection(const AsciiString& teamName, const As } if (obj->getTemplate() && obj->getTemplate()->getName() == objectType) { - if (bestGuess == NULL || obj->getID() < bestGuess->getID()) { // lower ID means its newer + if (bestGuess == nullptr || obj->getID() < bestGuess->getID()) { // lower ID means its newer bestGuess = obj; } } @@ -4761,7 +4761,7 @@ void* __cdecl killTheObject( Object *obj, void* userObj ) userObj; if (obj) obj->kill(); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -4780,7 +4780,7 @@ void ScriptActions::doDestroyAllContained(const AsciiString& unitName, Int damag return; } - cmi->iterateContained((ContainIterateFunc)killTheObject, NULL, false); + cmi->iterateContained((ContainIterateFunc)killTheObject, nullptr, false); } //------------------------------------------------------------------------------------------------- @@ -4829,10 +4829,10 @@ static CaveInterface* findCave(Object* obj) for (BehaviorModule** i = obj->getBehaviorModules(); *i; ++i) { CaveInterface* c = (*i)->getCaveInterface(); - if (c != NULL) + if (c != nullptr) return c; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -4847,7 +4847,7 @@ void ScriptActions::doSetCaveIndex( const AsciiString& caveName, Int caveIndex ) } CaveInterface *caveModule = findCave(obj); - if( caveModule == NULL ) + if( caveModule == nullptr ) return; caveModule->tryToSetCaveIndex( caveIndex ); @@ -4866,7 +4866,7 @@ void ScriptActions::doSetWarehouseValue( const AsciiString& warehouseName, Int c static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" ); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey ); - if( warehouseModule == NULL ) + if( warehouseModule == nullptr ) return; warehouseModule->setCashValue( cashValue ); @@ -4937,7 +4937,7 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const PartitionFilterPolygonTrigger acceptWithin(trig); PartitionFilterSameMapStatus filterMapStatus(obj); - PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, nullptr }; Object *dest = ThePartitionManager->getClosestObject(obj->getPosition(), REALLY_FAR, FROM_CENTER_2D, filters); if (!dest) { @@ -4983,7 +4983,7 @@ void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const PartitionFilterPolygonTrigger acceptWithin(trig); PartitionFilterSameMapStatus filterMapStatus(obj); - PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, nullptr }; Object *dest = ThePartitionManager->getClosestObject(obj->getPosition(), REALLY_FAR, FROM_CENTER_2D, filters); if (!dest) { @@ -5074,7 +5074,7 @@ void ScriptActions::doSkirmishCommandButtonOnMostValuable( const AsciiString& te return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5092,7 +5092,7 @@ void ScriptActions::doSkirmishCommandButtonOnMostValuable( const AsciiString& te PartitionFilterValidCommandButtonTarget f2(srcObj, commandButton, true, CMD_FROM_SCRIPT); PartitionFilterSameMapStatus filterMapStatus(srcObj); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; // @todo: Should we add the group's radius to the range? Seems like a possibility. SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(&pos, range, FROM_CENTER_2D, filters, ITER_SORTED_EXPENSIVE_TO_CHEAP); MemoryPoolObjectHolder hold(iter); @@ -5137,7 +5137,7 @@ void ScriptActions::doTeamUseCommandButtonOnNamed( const AsciiString& teamName, return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5153,7 +5153,7 @@ void ScriptActions::doTeamUseCommandButtonOnNamed( const AsciiString& teamName, return; } - if (commandButton->isValidToUseOn(srcObj, obj, NULL, CMD_FROM_SCRIPT)) { + if (commandButton->isValidToUseOn(srcObj, obj, nullptr, CMD_FROM_SCRIPT)) { theGroup->groupDoCommandButtonAtObject(commandButton, obj, CMD_FROM_SCRIPT); } } @@ -5180,7 +5180,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestEnemy( const AsciiString& tea return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5198,7 +5198,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestEnemy( const AsciiString& tea Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5230,7 +5230,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestGarrisonedBuilding( const Asc return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5250,7 +5250,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestGarrisonedBuilding( const Asc Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5282,7 +5282,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestKindof( const AsciiString& te return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5301,7 +5301,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestKindof( const AsciiString& te Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5333,7 +5333,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuilding( const AsciiString& return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5352,7 +5352,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuilding( const AsciiString& Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5384,7 +5384,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuildingClass( const AsciiStr return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5404,7 +5404,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuildingClass( const AsciiStr Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5436,7 +5436,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5460,7 +5460,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5490,7 +5490,7 @@ void ScriptActions::doTeamPartialUseCommandButton( Real percentage, const AsciiS for (iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { Object *obj = iter.cur(); - if (commandButton->isValidToUseOn(obj, NULL, NULL, CMD_FROM_SCRIPT)) { + if (commandButton->isValidToUseOn(obj, nullptr, nullptr, CMD_FROM_SCRIPT)) { objList.push_back(obj); } } @@ -5533,7 +5533,7 @@ void ScriptActions::doTeamCaptureNearestUnownedFactionUnit( const AsciiString& t Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5928,7 +5928,7 @@ void ScriptActions::doRemoveCommandBarButton(const AsciiString& buttonName, cons if (slotNum >= 0) { - TheGameLogic->setControlBarOverride(templ->friend_getCommandSetString(), slotNum, NULL); + TheGameLogic->setControlBarOverride(templ->friend_getCommandSetString(), slotNum, nullptr); } } @@ -5941,7 +5941,7 @@ void ScriptActions::doAddCommandBarButton(const AsciiString& buttonName, const A } const CommandButton *commandButton = TheControlBar->findCommandButton( buttonName ); - if (commandButton == NULL) + if (commandButton == nullptr) { // not here. use doRemoveCommandBarButton to remove one. return; @@ -6372,10 +6372,10 @@ void ScriptActions::executeAction( ScriptAction *pAction ) doCameoFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt()); return; case ScriptAction::NAMED_FLASH: - doNamedFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), NULL); + doNamedFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), nullptr); return; case ScriptAction::TEAM_FLASH: - doTeamFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), NULL); + doTeamFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), nullptr); return; case ScriptAction::NAMED_FLASH_WHITE: { diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 9ebaba9e855..7a7fd6cd797 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -66,7 +66,7 @@ class ObjectTypesTemp public: ObjectTypes* m_types; - ObjectTypesTemp() : m_types(NULL) + ObjectTypesTemp() : m_types(nullptr) { m_types = newInstance(ObjectTypes); } @@ -93,7 +93,7 @@ namespace rts }; // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptConditionsInterface *TheScriptConditions = NULL; +ScriptConditionsInterface *TheScriptConditions = nullptr; class TransportStatus : public MemoryPoolObject { @@ -105,7 +105,7 @@ class TransportStatus : public MemoryPoolObject Int m_unitCount; public: - TransportStatus() : m_objID(INVALID_ID), m_frameNumber(0), m_unitCount(0), m_nextStatus(NULL) {} + TransportStatus() : m_objID(INVALID_ID), m_frameNumber(0), m_unitCount(0), m_nextStatus(nullptr) {} //~TransportStatus(); }; @@ -149,7 +149,7 @@ void ScriptConditions::reset( void ) { deleteInstance(s_transportStatuses); - s_transportStatuses = NULL; + s_transportStatuses = nullptr; // Empty for now. jba. } @@ -170,7 +170,7 @@ parameter so we don't have to do a name search. May return null if the player d Player *ScriptConditions::playerFromParam(Parameter *pSideParm) { DEBUG_ASSERTCRASH(Parameter::SIDE == pSideParm->getParameterType(), ("Wrong parameter type.")); - Player *pPlayer=NULL; + Player *pPlayer=nullptr; UnsignedInt mask = (UnsignedInt)pSideParm->getInt(); if (mask) { pPlayer = ThePlayerList->getPlayerFromMask(mask); @@ -373,7 +373,7 @@ Bool ScriptConditions::evaluateHasUnits(Parameter *pTeamParm) // It isn't THIS_TEAM, and doesn't match the THIS_TEAM, so check if any team with this name // has units. - TeamPrototype *pProto = NULL; + TeamPrototype *pProto = nullptr; pProto = TheTeamFactory->findTeamPrototype(desiredTeamName); if (pProto) { @@ -399,7 +399,7 @@ Bool ScriptConditions::evaluateTeamInsideAreaPartially(Parameter *pTeamParm, Par AsciiString triggerName = pTriggerAreaParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerAreaParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; if (theTeam) { return (theTeam->someInsideSomeOutside(pTrig, (UnsignedInt) pTypeParm->getInt()) || theTeam->allInside(pTrig, (UnsignedInt) pTypeParm->getInt())); @@ -420,7 +420,7 @@ Bool ScriptConditions::evaluateNamedInsideArea(Parameter *pUnitParm, Parameter * AsciiString triggerName = pTriggerAreaParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerAreaParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; if (theObj) { Coord3D pCoord = *theObj->getPosition(); ICoord3D iCoord; @@ -437,7 +437,7 @@ Bool ScriptConditions::evaluatePlayerHasUnitTypeInArea(Condition *pCondition, Pa { AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; Player* pPlayer = playerFromParam(pPlayerParm); if (!pPlayer) { @@ -529,7 +529,7 @@ Bool ScriptConditions::evaluatePlayerHasUnitKindInArea(Condition *pCondition, Pa { AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; KindOfType kind = (KindOfType)pKindParm->getInt(); @@ -654,7 +654,7 @@ Bool ScriptConditions::evaluateTeamInsideAreaEntirely(Parameter *pTeamParm, Para AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) + if (pTrig == nullptr) return false; if (theTeam) { @@ -772,7 +772,7 @@ Bool ScriptConditions::evaluateNamedAttackedByPlayer(Parameter *pUnitParm, Param ObjectID id = lastDamageInfo->in.m_sourceID; Object* pAttacker = TheGameLogic->findObjectByID(id); - Player *pPlayer = NULL; + Player *pPlayer = nullptr; if (lastDamageInfo->in.m_sourcePlayerMask) { pPlayer = ThePlayerList->getPlayerFromMask(lastDamageInfo->in.m_sourcePlayerMask); } @@ -878,7 +878,7 @@ Bool ScriptConditions::evaluateNamedCreated(Parameter* pUnitParm) { // This is actually evaluateNamedExists(...) ///@todo - evaluate created, not exists... - return (TheScriptEngine->getUnitNamed(pUnitParm->getString()) != NULL); + return (TheScriptEngine->getUnitNamed(pUnitParm->getString()) != nullptr); } //------------------------------------------------------------------------------------------------- @@ -1043,7 +1043,7 @@ Bool ScriptConditions::evaluateEnemySighted(Parameter *pItemParm, Parameter *pAl // and only on-map (or not) PartitionFilterSameMapStatus filterMapStatus(theObj); - PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterStealth, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterStealth, &filterMapStatus, nullptr }; Real visionRange = theObj->getVisionRange(); @@ -1088,7 +1088,7 @@ Bool ScriptConditions::evaluateTypeSighted(Parameter *pItemParm, Parameter *pTyp // and only on-map (or not) PartitionFilterSameMapStatus filterMapStatus(theObj); - PartitionFilter *filters[] = { &filterAlive, &filterStealth, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAlive, &filterStealth, &filterMapStatus, nullptr }; Real visionRange = theObj->getVisionRange(); @@ -1810,14 +1810,14 @@ Bool ScriptConditions::evaluateSkirmishSpecialPowerIsReady(Parameter *pSkirmishP } Int nextFrame = TheGameLogic->getFrame() + 10*LOGICFRAMES_PER_SECOND; const SpecialPowerTemplate *power = TheSpecialPowerStore->findSpecialPowerTemplate(pPower->getString()); - if (power==NULL) { + if (power==nullptr) { pPower->friend_setInt(-1); // flag as never true. return false; } Bool found = false; Player::PlayerTeamList::const_iterator it; Player *pPlayer = playerFromParam(pSkirmishPlayerParm); - if (pPlayer==NULL) + if (pPlayer==nullptr) return false; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { @@ -1892,7 +1892,7 @@ Bool ScriptConditions::evaluateUnitHasEmptied(Parameter *pUnitParm) UnsignedInt frameNum = TheGameLogic->getFrame(); - if (stats == NULL) + if (stats == nullptr) { TransportStatus *transportStatus = newInstance(TransportStatus); transportStatus->m_objID = object->getID(); @@ -1932,7 +1932,7 @@ Bool ScriptConditions::evaluateTeamIsContained(Parameter *pTeamParm, Bool allCon continue; } - Bool isContained = (obj->getContainedBy() != NULL); + Bool isContained = (obj->getContainedBy() != nullptr); if (!isContained) { // we could still be exiting, in which case we should pretend like we are contained. @@ -2130,7 +2130,7 @@ Bool ScriptConditions::evaluateSkirmishSuppliesWithinDistancePerimeter(Parameter PartitionFilterPlayerAffiliation f2(player, ALLOW_NEUTRAL, true); PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(¢er, distance, FROM_CENTER_2D, filters, ITER_FASTEST); MemoryPoolObjectHolder hold(iter); @@ -2181,9 +2181,9 @@ Bool ScriptConditions::evaluateSkirmishPlayerTechBuildingWithinDistancePerimeter PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; - Bool comparison = ThePartitionManager->getClosestObject(¢er, radius, FROM_CENTER_2D, filters) != NULL; + Bool comparison = ThePartitionManager->getClosestObject(¢er, radius, FROM_CENTER_2D, filters) != nullptr; pCondition->setCustomData(-1); // false. if (comparison) { pCondition->setCustomData(1); // true. @@ -2391,7 +2391,7 @@ Bool ScriptConditions::evaluateSkirmishPlayerHasComparisonCapturedUnits(Paramete Bool ScriptConditions::evaluateSkirmishNamedAreaExists(Parameter *, Parameter *pTriggerParm) { PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - return (pTrig != NULL); + return (pTrig != nullptr); } //------------------------------------------------------------------------------------------------- @@ -2444,10 +2444,10 @@ Bool ScriptConditions::evaluateSkirmishPlayerHasUnitsInArea(Condition *pConditio PartitionFilterPolygonTrigger f2(pTrig); PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(¢er, radius, FROM_CENTER_2D, filters); - Bool condition = (obj!=NULL); + Bool condition = (obj!=nullptr); pCondition->setCustomData(-1); // false. if (condition) { pCondition->setCustomData(1); // true. @@ -2738,15 +2738,15 @@ Bool ScriptConditions::evaluateCondition( Condition *pCondition ) case Condition::UNIT_HEALTH: return evaluateUnitHealth(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_TRIGGERED_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_TRIGGERED_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_MIDWAY_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_MIDWAY_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_COMPLETED_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_COMPLETED_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_ACQUIRED_SCIENCE: @@ -2760,7 +2760,7 @@ Bool ScriptConditions::evaluateCondition( Condition *pCondition ) DEBUG_CRASH(("PLAYER_SELECTED_GENERAL script conditions are no longer in use")); return false; case Condition::PLAYER_BUILT_UPGRADE: - return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_BUILT_UPGRADE_FROM_NAMED: return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_HAS_OBJECT_COMPARISON: diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 5bb04e08179..dbffa95e3e9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -109,9 +109,9 @@ Bool st_particleSystemNeedsStopping = FALSE; ///< Set along with st_particleSyst typedef void (*VTProc)(); static Bool st_EnableVTune = false; - static HMODULE st_vTuneDLL = NULL; - static VTProc VTPause = NULL; - static VTProc VTResume = NULL; + static HMODULE st_vTuneDLL = nullptr; + static VTProc VTPause = nullptr; + static VTProc VTResume = nullptr; static void _initVTune( void ); static void _updateVTune ( void ); @@ -134,7 +134,7 @@ static const Int FRAMES_TO_FADE_IN_AT_START = 33; //#include "Common/PerfTimer.h" // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptEngine *TheScriptEngine = NULL; +ScriptEngine *TheScriptEngine = nullptr; /// Local classes /// AttackPriorityInfo class @@ -143,7 +143,7 @@ static const Int ATTACK_PRIORITY_DEFAULT = 1; //------------------------------------------------------------------------------------------------- /** Ctor */ //------------------------------------------------------------------------------------------------- -AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFAULT), m_priorityMap(NULL) +AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFAULT), m_priorityMap(nullptr) { m_name.clear(); } @@ -154,7 +154,7 @@ AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFA AttackPriorityInfo::~AttackPriorityInfo() { delete m_priorityMap; - m_priorityMap = NULL; + m_priorityMap = nullptr; } //------------------------------------------------------------------------------------------------- @@ -162,8 +162,8 @@ AttackPriorityInfo::~AttackPriorityInfo() //------------------------------------------------------------------------------------------------- void AttackPriorityInfo::setPriority(const ThingTemplate *tThing, Int priority) { - if (tThing==NULL) return; - if (m_priorityMap==NULL) { + if (tThing==nullptr) return; + if (m_priorityMap==nullptr) { m_priorityMap = NEW AttackPriorityMap; // STL type, so impractical to use memorypool } tThing = (const ThingTemplate *)tThing->getFinalOverride(); @@ -176,7 +176,7 @@ void AttackPriorityInfo::setPriority(const ThingTemplate *tThing, Int priority) Int AttackPriorityInfo::getPriority(const ThingTemplate *tThing) const { Int priority = m_defaultPriority; - if (tThing==NULL) return priority; + if (tThing==nullptr) return priority; tThing = (const ThingTemplate *)tThing->getFinalOverride(); if (m_priorityMap && !m_priorityMap->empty()) { AttackPriorityMap::const_iterator it = m_priorityMap->find(tThing); @@ -194,7 +194,7 @@ Int AttackPriorityInfo::getPriority(const ThingTemplate *tThing) const void AttackPriorityInfo::dumpPriorityInfo(void) { DEBUG_LOG(("Attack priority '%s', default %d", m_name.str(), m_defaultPriority)); - if (m_priorityMap==NULL) return; + if (m_priorityMap==nullptr) return; for (AttackPriorityMap::const_iterator it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it) { const ThingTemplate *tThing = (*it).first; Int priority = (*it).second; @@ -217,7 +217,7 @@ void AttackPriorityInfo::reset( void ) m_defaultPriority = ATTACK_PRIORITY_DEFAULT; delete m_priorityMap; - m_priorityMap = NULL; + m_priorityMap = nullptr; } @@ -317,7 +317,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) // read thing template name, and get template xfer->xferAsciiString( &thingTemplateName ); thingTemplate = TheThingFactory->findTemplate( thingTemplateName ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "AttackPriorityInfo::xfer - Unable to find thing template '%s'", @@ -353,12 +353,12 @@ void AttackPriorityInfo::loadPostProcess( void ) ScriptEngine::ScriptEngine(): m_numCounters(0), m_numFlags(0), -m_callingTeam(NULL), -m_callingObject(NULL), -m_conditionTeam(NULL), -m_conditionObject(NULL), -m_currentPlayer(NULL), -m_skirmishHumanPlayer(NULL), +m_callingTeam(nullptr), +m_callingObject(nullptr), +m_conditionTeam(nullptr), +m_conditionObject(nullptr), +m_currentPlayer(nullptr), +m_skirmishHumanPlayer(nullptr), m_fade(FADE_NONE), m_freezeByScript(FALSE), m_frameObjectCountChanged(0), @@ -395,7 +395,7 @@ ScriptEngine::~ScriptEngine() } FreeLibrary(st_DebugDLL); - st_DebugDLL = NULL; + st_DebugDLL = nullptr; } if (st_ParticleDLL) { @@ -405,7 +405,7 @@ ScriptEngine::~ScriptEngine() } FreeLibrary(st_ParticleDLL); - st_ParticleDLL = NULL; + st_ParticleDLL = nullptr; } #ifdef DO_VTUNE_STUFF @@ -424,13 +424,13 @@ void ScriptEngine::init( void ) if (TheGlobalData->m_scriptDebug) { st_DebugDLL = LoadLibrary("DebugWindow.dll"); } else { - st_DebugDLL = NULL; + st_DebugDLL = nullptr; } if (TheGlobalData->m_particleEdit) { st_ParticleDLL = LoadLibrary("ParticleEditor.dll"); } else { - st_ParticleDLL = NULL; + st_ParticleDLL = nullptr; } if (st_DebugDLL) { @@ -4542,12 +4542,12 @@ void ScriptEngine::reset( void ) m_endGameTimer = -1; m_closeWindowTimer = -1; - m_callingTeam = NULL; - m_callingObject = NULL; - m_conditionTeam = NULL; - m_conditionObject = NULL; - m_currentPlayer = NULL; - m_skirmishHumanPlayer = NULL; + m_callingTeam = nullptr; + m_callingObject = nullptr; + m_conditionTeam = nullptr; + m_conditionObject = nullptr; + m_currentPlayer = nullptr; + m_skirmishHumanPlayer = nullptr; m_frameObjectCountChanged = 0; m_shownMPLocalDefeatWindow = FALSE; @@ -4592,12 +4592,12 @@ void ScriptEngine::reset( void ) if (TheSidesList) { for (numToDump=0; numToDump<10; numToDump++) { Real maxTime = 0; - Script *maxScript = NULL; + Script *maxScript = nullptr; /* Run through scripts & set condition team names. */ for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (pScr->getConditionTime()>maxTime) { @@ -4634,7 +4634,7 @@ void ScriptEngine::reset( void ) VecSequentialScriptPtrIt seqScriptIt = m_sequentialScripts.begin(); while (seqScriptIt != m_sequentialScripts.end()) { SequentialScript* seqScript = *seqScriptIt; - while (seqScript != NULL) { + while (seqScript != nullptr) { SequentialScript* scriptToDelete = seqScript; seqScript = seqScript->m_nextScriptInSequence; deleteInstance(scriptToDelete); @@ -4731,7 +4731,7 @@ void ScriptEngine::newMap( void ) for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { checkConditionsForTeamNames(pScr); @@ -4850,7 +4850,7 @@ void ScriptEngine::update( void ) } executeScripts(pGroup->getScript()); } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } // Reset the entered/exited flag in teams, so the next update sets them @@ -4917,12 +4917,12 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc if (TheSidesList) { for (numToDump=0; numToDump<2; numToDump++) { Real maxTime = 0; - Script *maxScript = NULL; + Script *maxScript = nullptr; /* Run through scripts & set condition team names. */ for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (pScr->getCurTime()>maxTime) { @@ -5016,8 +5016,8 @@ void ScriptEngine::updateFades( void ) //------------------------------------------------------------------------------------------------- Player *ScriptEngine::getCurrentPlayer(void) { - if (m_currentPlayer==NULL) - AppendDebugMessage("***Unexpected NULL player:***", false); + if (m_currentPlayer==nullptr) + AppendDebugMessage("***Unexpected null player:***", false); return m_currentPlayer; } @@ -5063,7 +5063,7 @@ Player *ScriptEngine::getSkirmishEnemyPlayer(void) { if (m_currentPlayer) { Player *enemy = m_currentPlayer->getCurrentEnemy(); - if (enemy==NULL) { + if (enemy==nullptr) { // get the human player. Int i; for (i=0; igetPlayerCount(); i++) { @@ -5071,13 +5071,13 @@ Player *ScriptEngine::getSkirmishEnemyPlayer(void) if (/*enemy->isLocalPlayer() &&*/ enemy->getPlayerType()==PLAYER_HUMAN) { return enemy; } - enemy = NULL; + enemy = nullptr; } } return enemy; } DEBUG_CRASH(("No enemy found. Unexpected but not fatal. jba.")); - return NULL; + return nullptr; } #if 0 //------------------------------------------------------------------------------------------------- @@ -5086,7 +5086,7 @@ Player *ScriptEngine::getSkirmishEnemyPlayer(void) Player *ScriptEngine::getSkirmishPlayerFromParm(Parameter *pSkirmishPlayerParm) { if (!pSkirmishPlayerParm) - return NULL; + return nullptr; return getSkirmishPlayerFromAsciiString(pSkirmishPlayerParm->getString()); } @@ -5103,7 +5103,7 @@ Player *ScriptEngine::getSkirmishPlayerFromAsciiString(const AsciiString& skirmi AppendDebugMessage("***Invalid Skirmish Player name:***", false); - return NULL; + return nullptr; } #endif @@ -5122,14 +5122,14 @@ Player *ScriptEngine::getPlayerFromAsciiString(const AsciiString& playerString) else { NameKeyType key = NAMEKEY(playerString); Player *pPlayer = ThePlayerList->findPlayerWithNameKey(key); - if (pPlayer!=NULL) { + if (pPlayer!=nullptr) { return pPlayer; } } AppendDebugMessage("***Invalid Player name:***", false); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5140,8 +5140,8 @@ ObjectTypes *ScriptEngine::getObjectTypes(const AsciiString& objectTypeList) AllObjectTypesIt it; for (it = m_allObjectTypeLists.begin(); it != m_allObjectTypeLists.end(); ++it) { - if ((*it) == NULL) { - DEBUG_CRASH(("NULL object type list was unexpected. jkmcd")); + if ((*it) == nullptr) { + DEBUG_CRASH(("null object type list was unexpected. jkmcd")); continue; } @@ -5150,7 +5150,7 @@ ObjectTypes *ScriptEngine::getObjectTypes(const AsciiString& objectTypeList) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5179,12 +5179,12 @@ void ScriptEngine::doObjectTypeListMaintenance(const AsciiString& objectTypeList removeObjectTypes(currentObjectTypeVec); // Semantic emphasis - currentObjectTypeVec = NULL; + currentObjectTypeVec = nullptr; } } //------------------------------------------------------------------------------------------------- -/** Given a name, return the associated trigger area, or NULL if one doesn't exist. +/** Given a name, return the associated trigger area, or null if one doesn't exist. Handles skirmish name qualification. */ //------------------------------------------------------------------------------------------------- PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) @@ -5198,7 +5198,7 @@ PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) name.format("%s%d", OUTER_PERIMETER, ndx); } } else { - return NULL; + return nullptr; } } else if (name == ENEMY_INNER_PERIMETER || name == ENEMY_OUTER_PERIMETER) { @@ -5217,7 +5217,7 @@ PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) } } PolygonTrigger *trig = TheTerrainLogic->getTriggerAreaByName(name); - if (trig==NULL) { + if (trig==nullptr) { AsciiString msg = "!!!WARNING!!! Trigger area '"; msg.concat(name); msg.concat("' not found."); @@ -5246,13 +5246,13 @@ Team * ScriptEngine::getTeamNamed(const AsciiString& teamName) return m_conditionTeam; } TeamPrototype *theTeamProto = TheTeamFactory->findTeamPrototype( teamName ); - if (theTeamProto == NULL) return NULL; + if (theTeamProto == nullptr) return nullptr; if (theTeamProto->getIsSingleton()) { Team *theTeam = theTeamProto->getFirstItemIn_TeamInstanceList(); if (theTeam && theTeam->isActive()) { return theTeam; } - return NULL; // team wasn't active. + return nullptr; // team wasn't active. } static int warnCount = 0; @@ -5283,7 +5283,7 @@ Object * ScriptEngine::getUnitNamed(const AsciiString& unitName) return it->second; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5293,7 +5293,7 @@ Bool ScriptEngine::didUnitExist(const AsciiString& unitName) { for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (unitName == (it->first)) { - return (it->second == NULL); + return (it->second == nullptr); } } return false; @@ -5316,12 +5316,12 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) // Team *pSavConditionTeam = m_conditionTeam; LatchRestore latch(m_callingTeam, pThisTeam); - m_conditionTeam = NULL; - m_currentPlayer = NULL; + m_conditionTeam = nullptr; + m_currentPlayer = nullptr; if (m_callingTeam) { m_currentPlayer = m_callingTeam->getControllingPlayer(); } - Script *pScript = NULL; + Script *pScript = nullptr; ScriptGroup *pGroup = findGroup(scriptName); if (pGroup) { if (pGroup->isSubroutine()) { @@ -5335,7 +5335,7 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -5368,7 +5368,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } Object *pSavCallingObject = m_callingObject; m_callingObject = pThisObject; - Script *pScript = NULL; + Script *pScript = nullptr; ScriptGroup *pGroup = findGroup(scriptName); if (pGroup) { if (pGroup->isSubroutine()) { @@ -5382,7 +5382,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -5435,7 +5435,7 @@ const TCounter *ScriptEngine::getCounter(const AsciiString& counterName) return &(m_counters[i]); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5464,7 +5464,7 @@ void ScriptEngine::doNamedMapReveal(const AsciiString& revealName) { VecNamedRevealIt it; - NamedReveal *reveal = NULL; + NamedReveal *reveal = nullptr; for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) { if (it->m_revealName == revealName) { reveal = &(*it); @@ -5497,7 +5497,7 @@ void ScriptEngine::undoNamedMapReveal(const AsciiString& revealName) { VecNamedRevealIt it; - NamedReveal *reveal = NULL; + NamedReveal *reveal = nullptr; for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) { if (it->m_revealName == revealName) { reveal = &(*it); @@ -5568,7 +5568,7 @@ ScriptGroup *ScriptEngine::findGroup(const AsciiString& name) Int i; for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - if (pSL==NULL) continue; + if (pSL==nullptr) continue; ScriptGroup *pGroup; for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) { if (pGroup->getName() == name) { @@ -5576,7 +5576,7 @@ ScriptGroup *ScriptEngine::findGroup(const AsciiString& name) } } } - return 0; // Shouldn't ever happen. + return nullptr; // Shouldn't ever happen. } //------------------------------------------------------------------------------------------------- @@ -5587,7 +5587,7 @@ Script *ScriptEngine::findScript(const AsciiString& name) Int i; for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - if (pSL==NULL) continue; + if (pSL==nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if ((name==pScr->getName())) { @@ -5603,7 +5603,7 @@ Script *ScriptEngine::findScript(const AsciiString& name) } } } - return 0; // Shouldn't ever happen. + return nullptr; // Shouldn't ever happen. } //------------------------------------------------------------------------------------------------- @@ -5791,7 +5791,7 @@ AttackPriorityInfo * ScriptEngine::findAttackInfo(const AsciiString& name, Bool m_numAttackInfo++; return &m_attackPriorityInfo[m_numAttackInfo-1]; } - return NULL; + return nullptr; } /// Attack priority stuff. @@ -5838,13 +5838,13 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) const ThingTemplate *thingTemplate; // get thing template based from map object name thingTemplate = TheThingFactory->findTemplate(typeArgument); - if (thingTemplate==NULL) { + if (thingTemplate==nullptr) { AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false); AppendDebugMessage(pAction->getParameter(0)->getString(), false); return; } AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -5869,13 +5869,13 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) { AsciiString thisTypeName = types->getNthInList(typeIndex); const ThingTemplate *thisType = TheThingFactory->findTemplate(thisTypeName); - if (thisType==NULL) { + if (thisType==nullptr) { AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false); AppendDebugMessage(pAction->getParameter(0)->getString(), false); return; } AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -5903,7 +5903,7 @@ void ScriptEngine::setPriorityKind( ScriptAction *pAction ) { DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 3, ("Not enough parameters.")); AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -5927,7 +5927,7 @@ void ScriptEngine::setPriorityDefault( ScriptAction *pAction ) { DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.")); AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -5967,7 +5967,7 @@ void ScriptEngine::setObjectCount(Int playerIndex, const AsciiString& objectType //------------------------------------------------------------------------------------------------- void ScriptEngine::removeObjectTypes(ObjectTypes *typesToRemove) { - if (typesToRemove == NULL) { + if (typesToRemove == nullptr) { return; } @@ -6141,7 +6141,7 @@ void ScriptEngine::callSubroutine( ScriptAction *pAction ) } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -6183,7 +6183,7 @@ void ScriptEngine::checkConditionsForTeamNames(Script *pScript) if (Parameter::TEAM == pCondition->getParameter(i)->getParameterType()) { AsciiString teamName = pCondition->getParameter(i)->getString(); TeamPrototype *proto = TheTeamFactory->findTeamPrototype(teamName); - if (proto==NULL) continue; // Undefined team - don't bother. + if (proto==nullptr) continue; // Undefined team - don't bother. Bool singleton = proto->getIsSingleton(); if (proto->getTemplateInfo()->m_maxInstances < 2) { singleton = true; @@ -6258,7 +6258,7 @@ void ScriptEngine::executeScript( Script *pScript ) #endif Team *pSavConditionTeam = m_conditionTeam; - TeamPrototype *pProto = NULL; + TeamPrototype *pProto = nullptr; if (!pScript->getConditionTeamName().isEmpty()) { pProto = TheTeamFactory->findTeamPrototype(pScript->getConditionTeamName()); @@ -6291,7 +6291,7 @@ void ScriptEngine::executeScript( Script *pScript ) } } else { - m_conditionTeam = NULL; + m_conditionTeam = nullptr; // If conditions evaluate to true, execute actions. if (evaluateConditions(pScript)) { if (pScript->getAction()) { @@ -6350,7 +6350,7 @@ void ScriptEngine::friend_executeAction( ScriptAction *pActionHead, Team *pThisT Team *pSavCallingTeam = m_callingTeam; Player *pSavPlayer = m_currentPlayer; m_callingTeam = pThisTeam; - m_currentPlayer = NULL; + m_currentPlayer = nullptr; if (pThisTeam) { m_currentPlayer = pThisTeam->getControllingPlayer(); } @@ -6376,7 +6376,7 @@ void ScriptEngine::addObjectToCache(Object* pNewObject) for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (it->first == objName) { - if (it->second == NULL) { + if (it->second == nullptr) { AsciiString newNameForDead; newNameForDead.format("Reassigning dead object's name '%s' to object (%d) of type '%s'", objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str()); AppendDebugMessage(newNameForDead, FALSE); @@ -6412,7 +6412,7 @@ void ScriptEngine::removeObjectFromCache( Object* pDeadObject ) { for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (pDeadObject == (it->second)) { - it->second = NULL; // Don't remove it, cause we want to check whether we ever knew a name later + it->second = nullptr; // Don't remove it, cause we want to check whether we ever knew a name later break; } } @@ -6477,11 +6477,11 @@ void ScriptEngine::notifyOfObjectDestruction( Object *pDeadObject ) } if (m_conditionObject == pDeadObject) { - m_conditionObject = NULL; + m_conditionObject = nullptr; } if (m_callingObject == pDeadObject) { - m_callingObject = NULL; + m_callingObject = nullptr; } } @@ -6856,7 +6856,7 @@ Bool ScriptEngine::evaluateConditions( Script *pScript, Team *thisTeam, Player * { LatchRestore latch(m_callingTeam, thisTeam); if (thisTeam) player = thisTeam->getControllingPlayer(); - if (player==NULL) player=m_currentPlayer; + if (player==nullptr) player=m_currentPlayer; LatchRestore latch2(m_currentPlayer, player); OrCondition *pConditionHead = pScript->getOrCondition(); Bool testValue = false; @@ -7013,8 +7013,8 @@ void ScriptEngine::appendSequentialScript(const SequentialScript *scriptToSequen SequentialScript *newSequentialScript = newInstance( SequentialScript ); (*newSequentialScript) = (*scriptToSequence); - // Must set this to NULL, as we don't want an infinite loop. - newSequentialScript->m_nextScriptInSequence = NULL; + // Must set this to nullptr, as we don't want an infinite loop. + newSequentialScript->m_nextScriptInSequence = nullptr; // reset the instruction pointer newSequentialScript->m_currentInstruction = -1; @@ -7103,9 +7103,9 @@ void ScriptEngine::notifyOfTeamDestruction(Team *teamDestroyed) } if (m_callingTeam == teamDestroyed) - m_callingTeam = NULL; + m_callingTeam = nullptr; if (m_conditionTeam == teamDestroyed) - m_conditionTeam = NULL; + m_conditionTeam = nullptr; } void ScriptEngine::setSequentialTimer(Object *obj, Int frameCount) @@ -7155,7 +7155,7 @@ void ScriptEngine::setSequentialTimer(Team *team, Int frameCount) void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) { VecSequentialScriptPtrIt it; - SequentialScript* lastScript = NULL; + SequentialScript* lastScript = nullptr; Bool itAdvanced = false; Int spinCount = 0; @@ -7181,7 +7181,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = false; SequentialScript *seqScript = (*it); - if (seqScript == NULL) { + if (seqScript == nullptr) { it = cleanupSequentialScript(it, false); continue; } @@ -7193,18 +7193,18 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = true; continue; } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; if (obj) { m_currentPlayer = obj->getControllingPlayer(); } else if (team) { m_currentPlayer = team->getControllingPlayer(); } if (m_currentPlayer && !m_currentPlayer->isSkirmishAIPlayer()) { - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } - AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : NULL; - AIGroupPtr aigroup = (team ? TheAI->createGroup() : NULL); + AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : nullptr; + AIGroupPtr aigroup = (team ? TheAI->createGroup() : nullptr); if (aigroup) { #if RETAIL_COMPATIBLE_AIGROUP team->getTeamAsAIGroup(aigroup); @@ -7252,13 +7252,13 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) // Save off the next action ScriptAction *nextAction = action->getNext(); - action->setNextAction(NULL); + action->setNextAction(nullptr); if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_ALL) { - if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), true)) { + if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(nullptr, action->getParameter(1), action->getParameter(2), true)) { seqScript->m_dontAdvanceInstruction = TRUE; } } else if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_PARTIAL) { - if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), false)) { + if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(nullptr, action->getParameter(1), action->getParameter(2), false)) { seqScript->m_dontAdvanceInstruction = TRUE; } } else if (action->getActionType() == ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_ALL) { @@ -7294,7 +7294,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = true; } else if (team) { // attempt to rebuild the aigroup, as it probably expired during the action execution - aigroup = (team ? TheAI->createGroup() : NULL); + aigroup = (team ? TheAI->createGroup() : nullptr); #if RETAIL_COMPATIBLE_AIGROUP team->getTeamAsAIGroup(aigroup); #else @@ -7340,7 +7340,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) ++it; } } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } ScriptEngine::VecSequentialScriptPtrIt ScriptEngine::cleanupSequentialScript(VecSequentialScriptPtrIt it, Bool cleanDanglers) @@ -7357,18 +7357,18 @@ ScriptEngine::VecSequentialScriptPtrIt ScriptEngine::cleanupSequentialScript(Vec scriptToDelete = seqScript; seqScript = seqScript->m_nextScriptInSequence; deleteInstance(scriptToDelete); - scriptToDelete = NULL; + scriptToDelete = nullptr; } - (*it) = NULL; + (*it) = nullptr; } else { // we want to make sure to not delete any dangling scripts. (*it) = scriptToDelete->m_nextScriptInSequence; deleteInstance(scriptToDelete); - scriptToDelete = NULL; + scriptToDelete = nullptr; } - if ((*it) == NULL) { + if ((*it) == nullptr) { return m_sequentialScripts.erase(it); } @@ -7404,14 +7404,14 @@ void ScriptEngine::setEnableVTune(Bool value) } //----SequentialScript----------------------------------------------------------------------------- -SequentialScript::SequentialScript() : m_teamToExecOn(NULL), +SequentialScript::SequentialScript() : m_teamToExecOn(nullptr), m_objectID(INVALID_ID), - m_scriptToExecuteSequentially(NULL), + m_scriptToExecuteSequentially(nullptr), m_currentInstruction(START_INSTRUCTION), m_timesToLoop(0), m_framesToWait(-1), m_dontAdvanceInstruction(FALSE), - m_nextScriptInSequence(NULL) + m_nextScriptInSequence(nullptr) { } @@ -7446,7 +7446,7 @@ void SequentialScript::xfer( Xfer *xfer ) m_teamToExecOn = TheTeamFactory->findTeamByID( teamID ); // sanity - if( teamID != TEAM_ID_INVALID && m_teamToExecOn == NULL ) + if( teamID != TEAM_ID_INVALID && m_teamToExecOn == nullptr ) { DEBUG_CRASH(( "SequentialScript::xfer - Unable to find team by ID (#%d) for m_teamToExecOn", @@ -7477,14 +7477,14 @@ void SequentialScript::xfer( Xfer *xfer ) xfer->xferAsciiString( &scriptName ); // script pointer - DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially == NULL, ("SequentialScript::xfer - m_scripttoExecuteSequentially") ); + DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially == nullptr, ("SequentialScript::xfer - m_scripttoExecuteSequentially") ); // find script m_scriptToExecuteSequentially = const_cast(TheScriptEngine->findScriptByName(scriptName)); // sanity - DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != NULL, - ("SequentialScript::xfer - m_scriptToExecuteSequentially is NULL but should not be") ); + DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != nullptr, + ("SequentialScript::xfer - m_scriptToExecuteSequentially is null but should not be") ); } @@ -7815,7 +7815,7 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiString - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiString - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -7878,7 +7878,7 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringUINT - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringUINT - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -7953,7 +7953,7 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringObjectID - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringObjectID - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8028,7 +8028,7 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringCoord3D - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringCoord3D - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8266,7 +8266,7 @@ void ScriptEngine::xfer( Xfer *xfer ) namedObjectName = it->first; xfer->xferAsciiString( &namedObjectName ); - // write object id (note that object may be NULL) + // write object id (note that object may be null) obj = it->second; objectID = obj ? obj->getID() : INVALID_ID; xfer->xferObjectID( &objectID ); @@ -8294,7 +8294,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // read object id and turn into object pointer xfer->xferObjectID( &objectID ); obj = TheGameLogic->findObjectByID( objectID ); - if( obj == NULL && objectID != INVALID_ID ) + if( obj == nullptr && objectID != INVALID_ID ) { DEBUG_CRASH(( "ScriptEngine::xfer - Unable to find object by ID for m_namedObjects" )); @@ -8888,9 +8888,9 @@ extern void _updateAsciiStringParmsFromSystem( ParticleSystemTemplate *particleT return; } - ((funcptr) proc)(0, particleTemplate->m_particleTypeName.str(), NULL); // PARM_ParticleTypeName - ((funcptr) proc)(1, particleTemplate->m_slaveSystemName.str(), NULL); // PARM_SlaveSystemName - ((funcptr) proc)(2, particleTemplate->m_attachedSystemName.str(), NULL); // PARM_AttachedSystemName + ((funcptr) proc)(0, particleTemplate->m_particleTypeName.str(), nullptr); // PARM_ParticleTypeName + ((funcptr) proc)(1, particleTemplate->m_slaveSystemName.str(), nullptr); // PARM_SlaveSystemName + ((funcptr) proc)(2, particleTemplate->m_attachedSystemName.str(), nullptr); // PARM_AttachedSystemName } @@ -8903,13 +8903,13 @@ static void _writeOutINI( void ) const int maxFileLength = 128; char buff[maxFileLength]; - File *saveFile = NULL; + File *saveFile = nullptr; int i = 0; do { if (saveFile) { saveFile->close(); - saveFile = NULL; + saveFile = nullptr; } sprintf(buff, "%s%d.%s", BACKUP_FILE_NAME, i, BACKUP_EXT); saveFile = TheFileSystem->openFile(buff, File::READ | File::TEXT); @@ -8931,9 +8931,9 @@ static void _writeOutINI( void ) saveFile->write(&singleChar, 1); } oldINI->close(); - oldINI = NULL; + oldINI = nullptr; saveFile->close(); - saveFile = NULL; + saveFile = nullptr; } @@ -8954,7 +8954,7 @@ static void _writeOutINI( void ) } newINI->close(); - newINI = NULL; + newINI = nullptr; } @@ -9416,7 +9416,7 @@ static void _updateAndSetCurrentSystem( void ) ParticleSystemTemplate *parentTemp = TheParticleSystemManager->findParentTemplate(pTemp->getName(), 0); if (parentTemp) { - ParticleSystem *parentSystem = NULL; + ParticleSystem *parentSystem = nullptr; parentSystem = TheParticleSystemManager->createParticleSystem(parentTemp); if (parentSystem) { @@ -9451,7 +9451,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) // save the old file File *iniFile = TheFileSystem->openFile("Data\\INI\\ParticleSystem.ini", File::READ | File::TEXT); - File *outTempINI = NULL; + File *outTempINI = nullptr; if (!iniFile) { return; @@ -9487,7 +9487,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) // write out the closing "END" outTempINI->write(linebuff, strlen(linebuff)); outTempINI->close(); - outTempINI = NULL; + outTempINI = nullptr; } // force the current system to stop. @@ -9499,7 +9499,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) } // reload that entry INI ini; - ini.load("temporary.ini", INI_LOAD_OVERWRITE, NULL); + ini.load("temporary.ini", INI_LOAD_OVERWRITE, nullptr); // delete the file // unlink("temporary.ini"); @@ -9586,18 +9586,18 @@ static void _initVTune() // always try loading it, even if -vtune wasn't specified. st_vTuneDLL = ::LoadLibrary("vtuneapi.dll"); // nope, not here... -//DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, "VTuneAPI DLL not found!")); +//DEBUG_ASSERTCRASH(st_vTuneDLL != nullptr, "VTuneAPI DLL not found!")); if (st_vTuneDLL) { VTPause = (VTProc)::GetProcAddress(st_vTuneDLL, "VTPause"); VTResume = (VTProc)::GetProcAddress(st_vTuneDLL, "VTResume"); - DEBUG_ASSERTCRASH(VTPause != NULL && VTResume != NULL, ("VTuneAPI procs not found!")); + DEBUG_ASSERTCRASH(VTPause != nullptr && VTResume != nullptr, ("VTuneAPI procs not found!")); } else { - VTPause = NULL; - VTResume = NULL; + VTPause = nullptr; + VTResume = nullptr; } if (TheGlobalData->m_vTune) @@ -9607,7 +9607,7 @@ static void _initVTune() if (VTPause) VTPause(); // only complain about it being missing if they were expecting it to be present - DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, ("VTuneAPI DLL not found!")); + DEBUG_ASSERTCRASH(st_vTuneDLL != nullptr, ("VTuneAPI DLL not found!")); } else { @@ -9641,8 +9641,8 @@ static void _cleanUpVTune() { FreeLibrary(st_vTuneDLL); } - st_vTuneDLL = NULL; - VTPause = NULL; - VTResume = NULL; + st_vTuneDLL = nullptr; + VTPause = nullptr; + VTResume = nullptr; } #endif // VTUNE diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index e81045e9a97..f66f27dd64e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -68,8 +68,8 @@ -static Script *s_mtScript = NULL; -static ScriptGroup *s_mtGroup = NULL; +static Script *s_mtScript = nullptr; +static ScriptGroup *s_mtGroup = nullptr; // // These strings must be in the same order as they are in their definitions @@ -163,7 +163,7 @@ enum { AT_END = 0x00FFFFFF }; // ******************************** class ScriptList ********************************************* //------------------------------------------------------------------------------------------------- // Statics /////////////////////////////////////////////////////////////////////////////////////// -ScriptList *ScriptList::s_readLists[MAX_PLAYER_COUNT] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; +ScriptList *ScriptList::s_readLists[MAX_PLAYER_COUNT] = {0}; Int ScriptList::s_numInReadList = 0; Int ScriptList::m_curId = 0; @@ -178,7 +178,7 @@ void ScriptList::updateDefaults(void) for (i=0; igetNumSides(); i++) { ScriptList* pList = TheSidesList->getSideInfo(i)->getScriptList(); - if (pList == NULL) { + if (pList == nullptr) { pList = newInstance(ScriptList); TheSidesList->getSideInfo(i)->setScriptList(pList); } @@ -191,11 +191,11 @@ void ScriptList::updateDefaults(void) void ScriptList::reset(void) { Int i; - if (TheSidesList == NULL) return; /// @todo - move this code into sides list. + if (TheSidesList == nullptr) return; /// @todo - move this code into sides list. for (i=0; igetNumSides(); i++) { ScriptList* pList = TheSidesList->getSideInfo(i)->getScriptList(); - TheSidesList->getSideInfo(i)->setScriptList(NULL); + TheSidesList->getSideInfo(i)->setScriptList(nullptr); deleteInstance(pList); } } @@ -206,8 +206,8 @@ void ScriptList::reset(void) Ctor. */ ScriptList::ScriptList(void) : -m_firstGroup(NULL), -m_firstScript(NULL) +m_firstGroup(nullptr), +m_firstScript(nullptr) { } @@ -218,10 +218,10 @@ m_firstScript(NULL) ScriptList::~ScriptList(void) { deleteInstance(m_firstGroup); - m_firstGroup = NULL; + m_firstGroup = nullptr; deleteInstance(m_firstScript); - m_firstScript = NULL; + m_firstScript = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -269,7 +269,7 @@ void ScriptList::xfer( Xfer *xfer ) } if (scriptCount>0) { DEBUG_CRASH(("Stripping out extra scripts - Bad...")); - if (s_mtScript==NULL) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. + if (s_mtScript==nullptr) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. while (scriptCount) { xfer->xferSnapshot(s_mtScript); scriptCount--; @@ -298,7 +298,7 @@ void ScriptList::xfer( Xfer *xfer ) } if (scriptGroupCount>0) { DEBUG_CRASH(("Stripping out extra groups. - Bad...")); - if (s_mtGroup == NULL) s_mtGroup = newInstance(ScriptGroup); // Yes it leaks, but this is only for recovery. + if (s_mtGroup == nullptr) s_mtGroup = newInstance(ScriptGroup); // Yes it leaks, but this is only for recovery. while (scriptGroupCount) { xfer->xferSnapshot(s_mtGroup); scriptGroupCount--; @@ -324,7 +324,7 @@ ScriptList *ScriptList::duplicate(void) const { const ScriptGroup *src = this->m_firstGroup; - ScriptGroup *dst = NULL; + ScriptGroup *dst = nullptr; while (src) { ScriptGroup *tmp = src->duplicate(); @@ -341,7 +341,7 @@ ScriptList *ScriptList::duplicate(void) const { const Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicate(); @@ -370,7 +370,7 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, { const ScriptGroup *src = this->m_firstGroup; - ScriptGroup *dst = NULL; + ScriptGroup *dst = nullptr; while (src) { ScriptGroup *tmp = src->duplicateAndQualify( qualifier, playerTemplateName, newPlayerName); @@ -387,7 +387,7 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, { const Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); @@ -410,8 +410,8 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, */ void ScriptList::discard(void) { - m_firstGroup = NULL; - m_firstScript = NULL; + m_firstGroup = nullptr; + m_firstScript = nullptr; deleteInstance(this); } @@ -420,9 +420,9 @@ void ScriptList::discard(void) */ void ScriptList::addGroup(ScriptGroup *pGrp, Int ndx) { - ScriptGroup *pPrev = NULL; + ScriptGroup *pPrev = nullptr; ScriptGroup *pCur = m_firstGroup; - DEBUG_ASSERTCRASH(pGrp->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pGrp->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -444,9 +444,9 @@ void ScriptList::addGroup(ScriptGroup *pGrp, Int ndx) */ void ScriptList::addScript(Script *pScr, Int ndx) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; - DEBUG_ASSERTCRASH(pScr->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pScr->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -466,14 +466,14 @@ void ScriptList::addScript(Script *pScr, Int ndx) */ void ScriptList::deleteScript(Script *pScr) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; while (pCur != pScr) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find script.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { // unlink from previous script. @@ -483,7 +483,7 @@ void ScriptList::deleteScript(Script *pScr) m_firstScript = pCur->getNext(); } // Clear the link & delete. - pCur->setNextScript(NULL); + pCur->setNextScript(nullptr); deleteInstance(pCur); } @@ -492,14 +492,14 @@ void ScriptList::deleteScript(Script *pScr) */ void ScriptList::deleteGroup(ScriptGroup *pGrp) { - ScriptGroup *pPrev = NULL; + ScriptGroup *pPrev = nullptr; ScriptGroup *pCur = m_firstGroup; while (pCur != pGrp) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find group.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { // unlink from previous group. pPrev->setNextGroup(pCur->getNext()); @@ -508,7 +508,7 @@ void ScriptList::deleteGroup(ScriptGroup *pGrp) m_firstGroup = pCur->getNext(); } // Clear the link & delete. - pCur->setNextGroup(NULL); + pCur->setNextGroup(nullptr); deleteInstance(pCur); } @@ -526,11 +526,11 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); for (i=0; igetNext(); - cur->setNextGroup(NULL); // prevents recursion. + cur->setNextGroup(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -704,7 +704,7 @@ void ScriptGroup::xfer( Xfer *xfer ) } if (scriptCount>0) { DEBUG_CRASH(("Stripping out extra scripts - Bad...")); - if (s_mtScript==NULL) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. + if (s_mtScript==nullptr) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. while (scriptCount) { xfer->xferSnapshot(s_mtScript); scriptCount--; @@ -723,7 +723,7 @@ void ScriptGroup::loadPostProcess( void ) /** ScriptGroup::duplicate - Creates a full, "deep" copy of ScriptGroup. - m_nextGroup is NULL on the copy. + m_nextGroup is nullptr on the copy. */ ScriptGroup *ScriptGroup::duplicate(void) const { @@ -731,7 +731,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const { Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicate(); @@ -749,7 +749,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const pNew->m_groupName = this->m_groupName; pNew->m_isGroupActive = this->m_isGroupActive; pNew->m_isGroupSubroutine = this->m_isGroupSubroutine; - pNew->m_nextGroup = NULL; + pNew->m_nextGroup = nullptr; return pNew; } @@ -757,7 +757,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const /** ScriptGroup::duplicateAndQualify - Creates a full, "deep" copy of ScriptGroup, adding qualifier to names. - m_nextGroup is NULL on the copy. + m_nextGroup is nullptr on the copy. */ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const @@ -766,7 +766,7 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, { Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); @@ -785,7 +785,7 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, pNew->m_groupName.concat(qualifier); pNew->m_isGroupActive = this->m_isGroupActive; pNew->m_isGroupSubroutine = this->m_isGroupSubroutine; - pNew->m_nextGroup = NULL; + pNew->m_nextGroup = nullptr; return pNew; } @@ -795,21 +795,21 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, */ void ScriptGroup::deleteScript(Script *pScr) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; while (pScr != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find script.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextScript(pCur->getNext()); } else { m_firstScript = pCur->getNext(); } // Clear link & delete. - pCur->setNextScript(NULL); + pCur->setNextScript(nullptr); deleteInstance(pCur); } @@ -818,9 +818,9 @@ void ScriptGroup::deleteScript(Script *pScr) */ void ScriptGroup::addScript(Script *pScr, Int ndx) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; - DEBUG_ASSERTCRASH(pScr->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pScr->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -900,10 +900,10 @@ m_conditionExecutedCount(0), m_frameToEvaluateAt(0), m_isSubroutine(false), m_hasWarnings(false), -m_nextScript(NULL), -m_condition(NULL), -m_action(NULL), -m_actionFalse(NULL), +m_nextScript(nullptr), +m_condition(nullptr), +m_action(nullptr), +m_actionFalse(nullptr), m_curTime(0.0f) { } @@ -919,7 +919,7 @@ Script::~Script(void) Script *next; while (cur) { next = cur->getNext(); - cur->setNextScript(NULL); // prevents recursion. + cur->setNextScript(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -969,7 +969,7 @@ void Script::loadPostProcess( void ) /** Script::duplicate - Creates a full, "deep" copy of script. Condition list and action list is duplicated as well. Note - just the script, doesn't - duplicate a list of scripts. m_nextScript is NULL on the copy. + duplicate a list of scripts. m_nextScript is nullptr on the copy. */ Script *Script::duplicate(void) const { @@ -1003,7 +1003,7 @@ Script *Script::duplicate(void) const Script::duplicate - Creates a full, "deep" copy of script, with qualifier added to names. Condition list and action list is duplicated as well. Note - just the script, doesn't - duplicate a list of scripts. m_nextScript is NULL on the copy. + duplicate a list of scripts. m_nextScript is nullptr on the copy. */ Script *Script::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const @@ -1057,15 +1057,15 @@ void Script::updateFrom(Script *pSrc) deleteInstance(this->m_condition); this->m_condition = pSrc->m_condition; - pSrc->m_condition = NULL; + pSrc->m_condition = nullptr; deleteInstance(this->m_action); this->m_action = pSrc->m_action; - pSrc->m_action = NULL; + pSrc->m_action = nullptr; deleteInstance(this->m_actionFalse); this->m_actionFalse = pSrc->m_actionFalse; - pSrc->m_actionFalse = NULL; + pSrc->m_actionFalse = nullptr; } /** @@ -1073,20 +1073,20 @@ void Script::updateFrom(Script *pSrc) */ void Script::deleteOrCondition(OrCondition *pCond) { - OrCondition *pPrev = NULL; + OrCondition *pPrev = nullptr; OrCondition *pCur = m_condition; while (pCond != pCur) { pPrev = pCur; pCur = pCur->getNextOrCondition(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextOrCondition(pCur->getNextOrCondition()); } else { m_condition = pCur->getNextOrCondition(); } - pCur->setNextOrCondition(NULL); + pCur->setNextOrCondition(nullptr); deleteInstance(pCur); } @@ -1096,20 +1096,20 @@ void Script::deleteOrCondition(OrCondition *pCond) */ void Script::deleteAction(ScriptAction *pAct) { - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; ScriptAction *pCur = m_action; while (pAct != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find action.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextAction(pCur->getNext()); } else { m_action = pCur->getNext(); } - pCur->setNextAction(NULL); + pCur->setNextAction(nullptr); deleteInstance(pCur); } @@ -1119,20 +1119,20 @@ void Script::deleteAction(ScriptAction *pAct) */ void Script::deleteFalseAction(ScriptAction *pAct) { - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; ScriptAction *pCur = m_actionFalse; while (pAct != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find action.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextAction(pCur->getNext()); } else { m_actionFalse = pCur->getNext(); } - pCur->setNextAction(NULL); + pCur->setNextAction(nullptr); deleteInstance(pCur); } @@ -1244,7 +1244,7 @@ Script *Script::ParseScript(DataChunkInput &file, unsigned short version) file.registerParser( "ScriptActionFalse", "Script", ScriptAction::ParseActionFalseDataChunk ); if (! file.parse(pScript) ) { - return NULL; + return nullptr; } DEBUG_ASSERTCRASH(file.atEndOfChunk(), ("Unexpected data left over.")); return pScript; @@ -1292,7 +1292,7 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) { OrCondition *myConditions = getOrCondition(); if ( myConditions == curOr ) { - return NULL; + return nullptr; } while (myConditions) { @@ -1303,7 +1303,7 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) } DEBUG_CRASH(("Tried to find an OrCondition that doesn't seem to exist (jkmcd)")); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1312,14 +1312,14 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) OrCondition::~OrCondition(void) { deleteInstance(m_firstAnd); - m_firstAnd = NULL; + m_firstAnd = nullptr; if (m_nextOr) { OrCondition *cur = m_nextOr; OrCondition *next; while (cur) { next = cur->getNextOrCondition(); - cur->setNextOrCondition(NULL); // prevents recursion. + cur->setNextOrCondition(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -1367,7 +1367,7 @@ OrCondition *OrCondition::duplicateAndQualify(const AsciiString& qualifier, Condition *OrCondition::removeCondition(Condition *pCond) { - Condition *pPrev = NULL; + Condition *pPrev = nullptr; Condition *pCur = m_firstAnd; while (pCond != pCur) { pPrev = pCur; @@ -1375,15 +1375,15 @@ Condition *OrCondition::removeCondition(Condition *pCond) } DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) - return NULL; + if (pCur==nullptr) + return nullptr; if (pPrev) { pPrev->setNextCondition(pCur->getNext()); } else { m_firstAnd = pCur->getNext(); } - pCur->setNextCondition(NULL); + pCur->setNextCondition(nullptr); return pCur; } @@ -1391,7 +1391,7 @@ void OrCondition::deleteCondition(Condition *pCond) { Condition *pCur = removeCondition(pCond); DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) + if (pCur==nullptr) return; deleteInstance(pCur); } @@ -1451,7 +1451,7 @@ Condition *OrCondition::findPreviousCondition( Condition *curCond ) { Condition *myConditions = getFirstAndCondition(); if (myConditions == curCond) { - return NULL; + return nullptr; } while (myConditions) { @@ -1462,7 +1462,7 @@ Condition *OrCondition::findPreviousCondition( Condition *curCond ) } DEBUG_CRASH(("Searched for non-existent And Condition. (jkmcd)")); - return NULL; + return nullptr; } @@ -1474,12 +1474,12 @@ m_conditionType(CONDITION_FALSE), m_hasWarnings(false), m_customData(0), m_numParms(0), -m_nextAndCondition(NULL) +m_nextAndCondition(nullptr) { Int i; for (i = 0; i < MAX_PARMS; i++) { - m_parms[i] = NULL; + m_parms[i] = nullptr; } } @@ -1489,7 +1489,7 @@ m_numParms(0) { Int i; for (i=0; igetConditionTemplate(m_conditionType); @@ -1557,14 +1557,14 @@ Condition::~Condition(void) Int i; for (i=0; igetNext(); - cur->setNextCondition(NULL); // prevents recursion. + cur->setNextCondition(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -2166,7 +2166,7 @@ ScriptAction::ScriptAction(): m_actionType(NO_OP), m_hasWarnings(false), m_numParms(0), -m_nextAction(NULL) +m_nextAction(nullptr) { } @@ -2176,7 +2176,7 @@ m_numParms(0) { Int i; for (i=0; igetActionTemplate(m_actionType); @@ -2252,14 +2252,14 @@ ScriptAction::~ScriptAction(void) Int i; for (i=0; igetNext(); - cur->setNextAction(NULL); // prevents recursion. + cur->setNextAction(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -2499,5 +2499,5 @@ const char* const TheObjectFlagsNames[] = "Selectable", "AI Recruitable", "Player Targetable", - NULL, + nullptr, }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp index c3f70c082cb..7779e98180e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp @@ -57,7 +57,7 @@ #define ISSET(x) (m_victoryConditions & VICTORY_##x) //------------------------------------------------------------------------------------------------- -VictoryConditionsInterface *TheVictoryConditions = NULL; +VictoryConditionsInterface *TheVictoryConditions = nullptr; //------------------------------------------------------------------------------------------------- inline static Bool areAllies(const Player *p1, const Player *p2) @@ -125,7 +125,7 @@ void VictoryConditions::reset( void ) { for (Int i=0; igetPlayerNameKey() == NAMEKEY(pName)) { - GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):NULL; + GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):nullptr; if (slot && slot->isAI()) { DEBUG_LOG(("Marking AI player %s as defeated", pName.str())); @@ -224,7 +224,7 @@ void VictoryConditions::update( void ) { if (!m_singleAllianceRemaining) { - //MessageBoxOk(TheGameText->fetch("GUI:Defeat"), TheGameText->fetch("GUI:LocalDefeat"), NULL); + //MessageBoxOk(TheGameText->fetch("GUI:Defeat"), TheGameText->fetch("GUI:LocalDefeat"), nullptr); } m_localPlayerDefeated = true; // don't check again TheRadar->forceOn(localPlayer->getPlayerIndex(), TRUE); @@ -321,7 +321,7 @@ void VictoryConditions::cachePlayerPtrs( void ) } while (playerCount < MAX_PLAYER_COUNT) { - m_players[playerCount++] = NULL; + m_players[playerCount++] = nullptr; } if (m_localSlotNum < 0) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp index 380dd9529d0..058a98cb938 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp @@ -34,7 +34,7 @@ #include "Common/Xfer.h" #include "GameLogic/CaveSystem.h" -CaveSystem *TheCaveSystem = NULL; +CaveSystem *TheCaveSystem = nullptr; CaveSystem::CaveSystem() { @@ -52,7 +52,7 @@ void CaveSystem::reset() { for( std::vector::iterator iter = m_tunnelTrackerVector.begin(); iter != m_tunnelTrackerVector.end(); iter++ ) { - TunnelTracker *currentTracker = *iter; // could be NULL, since we don't slide back to fill deleted entries so offsets don't shift + TunnelTracker *currentTracker = *iter; // could be null, since we don't slide back to fill deleted entries so offsets don't shift deleteInstance(currentTracker); } m_tunnelTrackerVector.clear(); @@ -65,8 +65,8 @@ void CaveSystem::update() Bool CaveSystem::canSwitchIndexToIndex( Int oldIndex, Int newIndex ) { // When I grant permission, you need to do it. ie call Unregister and then re-register with the new number - TunnelTracker *oldTracker = NULL; - TunnelTracker *newTracker = NULL; + TunnelTracker *oldTracker = nullptr; + TunnelTracker *newTracker = nullptr; if( m_tunnelTrackerVector.size() > oldIndex ) { oldTracker = m_tunnelTrackerVector[oldIndex]; @@ -93,18 +93,18 @@ void CaveSystem::registerNewCave( Int theIndex ) { // You are new and off the edge, so I will fill NULLs up to you and then make a newTracker at that spot while( theIndex >= m_tunnelTrackerVector.size() ) - m_tunnelTrackerVector.push_back( NULL ); + m_tunnelTrackerVector.push_back( nullptr ); needToCreate = TRUE; } else { // else you either exist or have existed, so I will either let things be or re-create that slot - if( m_tunnelTrackerVector[theIndex] == NULL ) + if( m_tunnelTrackerVector[theIndex] == nullptr ) needToCreate = TRUE; } - if( needToCreate )// if true, we new theIndex is the index of a NULL to be filled + if( needToCreate )// if true, we new theIndex is the index of a nullptr to be filled m_tunnelTrackerVector[theIndex] = newInstance(TunnelTracker); } @@ -117,13 +117,13 @@ void CaveSystem::unregisterCave( Int theIndex ) TunnelTracker *CaveSystem::getTunnelTrackerForCaveIndex( Int theIndex ) { - TunnelTracker *theTracker = NULL; + TunnelTracker *theTracker = nullptr; if( theIndex < m_tunnelTrackerVector.size() ) { theTracker = m_tunnelTrackerVector[theIndex]; } - DEBUG_ASSERTCRASH( theTracker != NULL, ("No one should be interested in a sub-cave that doesn't exist.") ); + DEBUG_ASSERTCRASH( theTracker != nullptr, ("No one should be interested in a sub-cave that doesn't exist.") ); return theTracker; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index 810e5d07b46..4360fb637fe 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -34,7 +34,7 @@ #include "GameLogic/CrateSystem.h" #include "Common/BitFlagsIO.h" -CrateSystem *TheCrateSystem = NULL; +CrateSystem *TheCrateSystem = nullptr; CrateSystem::CrateSystem() { @@ -93,7 +93,7 @@ void CrateSystem::parseCrateTemplateDefinition(INI* ini) name.set(c); CrateTemplate *crateTemplate = TheCrateSystem->friend_findCrateTemplate(name); - if (crateTemplate == NULL) { + if (crateTemplate == nullptr) { crateTemplate = TheCrateSystem->newCrateTemplate(name); if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { @@ -113,7 +113,7 @@ CrateTemplate *CrateSystem::newCrateTemplate( AsciiString name ) { // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon CrateTemplate *ct = newInstance(CrateTemplate); @@ -134,7 +134,7 @@ CrateTemplate *CrateSystem::newCrateTemplate( AsciiString name ) CrateTemplate *CrateSystem::newCrateTemplateOverride( CrateTemplate *crateToOverride ) { if (!crateToOverride) { - return NULL; + return nullptr; } CrateTemplate *newOverride = newInstance(CrateTemplate); @@ -156,7 +156,7 @@ const CrateTemplate *CrateSystem::findCrateTemplate(AsciiString name) const } - return NULL; + return nullptr; } CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) @@ -167,7 +167,7 @@ CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) CrateTemplateOverride overridable(m_crateTemplateVector[i]); return const_cast((const CrateTemplate *)overridable); } - return NULL; + return nullptr; } @@ -179,13 +179,13 @@ CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) //-------------------------------------------------------------------------------- const FieldParse CrateTemplate::TheCrateTemplateFieldParseTable[] = { - { "CreationChance", INI::parseReal, NULL, offsetof( CrateTemplate, m_creationChance ) }, + { "CreationChance", INI::parseReal, nullptr, offsetof( CrateTemplate, m_creationChance ) }, { "VeterancyLevel", INI::parseIndexList, TheVeterancyNames, offsetof( CrateTemplate, m_veterancyLevel ) }, - { "KilledByType", KindOfMaskType::parseFromINI, NULL, offsetof( CrateTemplate, m_killedByTypeKindof) }, - { "CrateObject", CrateTemplate::parseCrateCreationEntry, NULL, NULL }, - { "KillerScience", INI::parseScience, NULL, offsetof( CrateTemplate, m_killerScience) }, - { "OwnedByMaker", INI::parseBool, NULL, offsetof( CrateTemplate, m_isOwnedByMaker) }, - { NULL, NULL, NULL, NULL }, + { "KilledByType", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateTemplate, m_killedByTypeKindof) }, + { "CrateObject", CrateTemplate::parseCrateCreationEntry, nullptr, 0 }, + { "KillerScience", INI::parseScience, nullptr, offsetof( CrateTemplate, m_killerScience) }, + { "OwnedByMaker", INI::parseBool, nullptr, offsetof( CrateTemplate, m_isOwnedByMaker) }, + { nullptr, nullptr, nullptr, 0 }, }; CrateTemplate::CrateTemplate() diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 1b2fa9b864a..ba912efab45 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -113,10 +113,10 @@ DECLARE_PERF_TIMER(SleepyMaintenance) #ifdef DO_UNIT_TIMINGS #pragma MESSAGE("*** WARNING *** DOING DO_UNIT_TIMINGS!!!!") Bool g_UT_gotUnit = false; -const ThingTemplate *g_UT_curThing = NULL; +const ThingTemplate *g_UT_curThing = nullptr; Bool g_UT_startTiming = false; -FILE *g_UT_timingLog=NULL; -FILE *g_UT_commaLog=NULL; +FILE *g_UT_timingLog=nullptr; +FILE *g_UT_commaLog=nullptr; // Note - this is only for gathering timing data! DO NOT DO THIS IN REGULAR CODE!!! JBA #define BRUTAL_TIMING_HACK #include "../../GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h" @@ -128,7 +128,7 @@ FILE *g_UT_commaLog=NULL; enum { OBJ_HASH_SIZE = 8192 }; /// The GameLogic singleton instance -GameLogic *TheGameLogic = NULL; +GameLogic *TheGameLogic = nullptr; static void findAndSelectCommandCenter(Object *obj, void* alreadyFound); @@ -175,7 +175,7 @@ static Waypoint * findNamedWaypoint(AsciiString name) return way; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -207,7 +207,7 @@ void setFPMode( void ) // ------------------------------------------------------------------------------------------------ GameLogic::GameLogic( void ) { - m_background = NULL; + m_background = nullptr; m_CRC = 0; m_isInUpdate = FALSE; @@ -228,8 +228,8 @@ GameLogic::GameLogic( void ) m_frameObjectsChangedTriggerAreas = 0; m_width = 0; m_height = 0; - m_objList = NULL; - m_curUpdateModule = NULL; + m_objList = nullptr; + m_curUpdateModule = nullptr; m_nextObjID = INVALID_ID; m_startNewGame = FALSE; m_gameMode = GAME_NONE; @@ -242,7 +242,7 @@ GameLogic::GameLogic( void ) m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; m_logicTimeScaleEnabledMemory = FALSE; - m_loadScreen = NULL; + m_loadScreen = nullptr; m_forceGameStartByTimeOut = FALSE; #ifdef DUMP_PERF_STATS m_overallFailedPathfinds = 0; @@ -283,7 +283,7 @@ void GameLogic::destroyAllObjectsImmediate() // process the destroy list immediately processDestroyList(); - DEBUG_ASSERTCRASH( m_objList == NULL, ("destroyAllObjectsImmediate: Object list not cleared") ); + DEBUG_ASSERTCRASH( m_objList == nullptr, ("destroyAllObjectsImmediate: Object list not cleared") ); } @@ -301,7 +301,7 @@ GameLogic::~GameLogic() { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } // destroy all remaining objects @@ -309,27 +309,27 @@ GameLogic::~GameLogic() // delete the logical terrain delete TheTerrainLogic; - TheTerrainLogic = NULL; + TheTerrainLogic = nullptr; delete TheGhostObjectManager; - TheGhostObjectManager=NULL; + TheGhostObjectManager=nullptr; // delete the partition manager delete ThePartitionManager; - ThePartitionManager = NULL; + ThePartitionManager = nullptr; delete TheScriptActions; - TheScriptActions = NULL; + TheScriptActions = nullptr; delete TheScriptConditions; - TheScriptConditions = NULL; + TheScriptConditions = nullptr; // delete the Script Engine delete TheScriptEngine; - TheScriptEngine = NULL; + TheScriptEngine = nullptr; // Null out TheGameLogic - TheGameLogic = NULL; + TheGameLogic = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -420,7 +420,7 @@ void GameLogic::reset( void ) m_forceGameStartByTimeOut = FALSE; delete TheStatsCollector; - TheStatsCollector = NULL; + TheStatsCollector = nullptr; // clear any table of contents we have m_objectTOC.clear(); @@ -429,7 +429,7 @@ void GameLogic::reset( void ) m_hasUpdated = FALSE; m_width = DEFAULT_WORLD_WIDTH; m_height = DEFAULT_WORLD_HEIGHT; - m_objList = NULL; + m_objList = nullptr; #ifdef ALLOW_NONSLEEPY_UPDATES m_normalUpdates.clear(); #endif @@ -438,7 +438,7 @@ void GameLogic::reset( void ) (*it)->friend_setIndexInLogic(-1); } m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; m_isScoringEnabled = TRUE; m_showBehindBuildingMarkers = TRUE; @@ -530,8 +530,8 @@ static void placeNetworkBuildingsForPlayer(Int slotNum, const GameSlot *pSlot, P if (!conYard) return; - pPlayer->onStructureCreated(NULL, conYard); - pPlayer->onStructureConstructionComplete(NULL, conYard, FALSE); + pPlayer->onStructureCreated(nullptr, conYard); + pPlayer->onStructureConstructionComplete(nullptr, conYard, FALSE); //pos.x -= conYard->getGeometryInfo().getBoundingSphereRadius()/2; pos.y -= conYard->getGeometryInfo().getBoundingSphereRadius()/2; @@ -559,7 +559,7 @@ static void placeNetworkBuildingsForPlayer(Int slotNum, const GameSlot *pSlot, P { Object *unit = placeObjectAtPosition(slotNum, objName, objPos, pPlayer, pTemplate); if (unit) { - pPlayer->onUnitCreated(NULL, unit); + pPlayer->onUnitCreated(nullptr, unit); } } else @@ -599,7 +599,7 @@ LoadScreen *GameLogic::getLoadScreen( Bool saveGame ) break; case GAME_NONE: default: - return NULL; + return nullptr; } } @@ -929,7 +929,7 @@ void GameLogic::deleteLoadScreen( void ) { delete m_loadScreen; - m_loadScreen = NULL; + m_loadScreen = nullptr; } @@ -1013,13 +1013,13 @@ void GameLogic::startNewGame( Bool saveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } m_loadScreen = getLoadScreen( saveGame ); if(m_loadScreen) { TheWritableGlobalData->m_loadScreenRender = TRUE; ///< mark it so only a few select things are rendered during load - m_loadScreen->init(NULL); + m_loadScreen->init(nullptr); } } @@ -1045,7 +1045,7 @@ void GameLogic::startNewGame( Bool saveGame ) TheWritableGlobalData->m_TiVOFastMode = FALSE; //always disable the TIVO fast-forward mode at the start of a new game. // Fill in the game color and Factions before we do the Load Screen - TheGameInfo = NULL; + TheGameInfo = nullptr; Int localSlot = 0; if (TheNetwork) { @@ -1091,7 +1091,7 @@ void GameLogic::startNewGame( Bool saveGame ) } else { if (m_gameMode == GAME_SINGLE_PLAYER) { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } } @@ -1118,7 +1118,7 @@ void GameLogic::startNewGame( Bool saveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } setFPMode(); if(TheCampaignManager) @@ -1375,7 +1375,7 @@ void GameLogic::startNewGame( Bool saveGame ) ChunkInputStream *pStrm = &theInputStream; DataChunkInput file( pStrm ); file.registerParser( "PlayerScriptsList", AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { DEBUG_LOG(("ERROR - Unable to read in multiplayer scripts.")); return; } @@ -1384,7 +1384,7 @@ void GameLogic::startNewGame( Bool saveGame ) if (count) { ScriptList *pSL = TheSidesList->getSideInfo(0)->getScriptList(); - if (pSL != NULL) + if (pSL != nullptr) { Script *next = scripts[0]->getScript(); while (next) @@ -1533,7 +1533,7 @@ void GameLogic::startNewGame( Bool saveGame ) // get thing template based from map object name thingTemplate = pMapObj->getThingTemplate(); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) continue; if (!thingTemplate->isBridgeLike()) @@ -1640,7 +1640,7 @@ void GameLogic::startNewGame( Bool saveGame ) // have temporary templates created 'on the fly' during a // ThingFactory->findTemplate() call when loading from the map file // - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) continue; if (thingTemplate->isBridgeLike()) @@ -1752,7 +1752,7 @@ void GameLogic::startNewGame( Bool saveGame ) } else { - const PlayerTemplate* pt = NULL; + const PlayerTemplate* pt = nullptr; pt = ThePlayerTemplateStore->getNthPlayerTemplate(slot->getPlayerTemplate()); placeNetworkBuildingsForPlayer(i, slot, player, pt); @@ -1863,7 +1863,7 @@ void GameLogic::startNewGame( Bool saveGame ) { Player *pPlayer = ThePlayerList->getNthPlayer(i); if (pPlayer && pPlayer->getPlayerType() != PLAYER_HUMAN) - pPlayer = NULL; + pPlayer = nullptr; if (pPlayer) { @@ -1890,7 +1890,7 @@ void GameLogic::startNewGame( Bool saveGame ) } // if we're in a load game, don't fade yet - if(saveGame == FALSE && TheTransitionHandler != NULL && m_loadScreen) + if(saveGame == FALSE && TheTransitionHandler != nullptr && m_loadScreen) { TheTransitionHandler->setGroup("FadeWholeScreen"); while(!TheTransitionHandler->isFinished()) @@ -2129,7 +2129,7 @@ void GameLogic::loadMapINI( AsciiString mapName ) if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading map.ini")); INI ini; - ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); + ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, nullptr ); } // TheSuperHackers @todo Implement ini load directory for map folder. @@ -2139,7 +2139,7 @@ void GameLogic::loadMapINI( AsciiString mapName ) if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading solo.ini")); INI ini; - ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); + ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, nullptr ); } // No error here. There could've just *not* been a map.ini file. @@ -2249,9 +2249,9 @@ void GameLogic::processCommandList( CommandList *list ) for( msg = list->getFirstMessage(); msg; msg = msg->next() ) { #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(msg != NULL && msg != (GameMessage*)0xdeadbeef, ("bad msg")); + DEBUG_ASSERTCRASH(msg != nullptr && msg != (GameMessage*)0xdeadbeef, ("bad msg")); #endif - logicMessageDispatcher( msg, NULL ); + logicMessageDispatcher( msg, nullptr ); } if (m_shouldValidateCRCs && !TheNetwork->sawCRCMismatch()) @@ -2406,8 +2406,8 @@ void GameLogic::deselectObject(Object *obj, PlayerMaskType playerMask, Bool affe group->removeAll(); #endif } else { - // NULL will clear the group. - player->setCurrentlySelectedAIGroup(NULL); + // nullptr will clear the group. + player->setCurrentlySelectedAIGroup(nullptr); } if (affectClient) { @@ -2639,7 +2639,7 @@ void GameLogic::pushSleepyUpdate(UpdateModulePtr u) { USE_PERF_TIMER(SleepyMaintenance) - DEBUG_ASSERTCRASH(u != NULL, ("You may not pass null for sleepy update info")); + DEBUG_ASSERTCRASH(u != nullptr, ("You may not pass null for sleepy update info")); m_sleepyUpdates.push_back(u); u->friend_setIndexInLogic(m_sleepyUpdates.size() - 1); @@ -2868,7 +2868,7 @@ static void unitTimings(void) timeNoSpawn = timeToUpdate; drawCallNoSpawn = (float)drawCallTotal / (float)(TIME_FRAMES * 100); // 100 units for TIME_FRAMES } - if (g_UT_curThing==NULL) return; + if (g_UT_curThing==nullptr) return; @@ -2906,7 +2906,7 @@ static void unitTimings(void) if (mi.getCount() > 0) { const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; if (md) { modelName = md->getBestModelNameForWB(state); @@ -2957,7 +2957,7 @@ static void unitTimings(void) } g_UT_curThing = g_UT_curThing->friend_getNextTemplate(); - if (g_UT_curThing == NULL) { + if (g_UT_curThing == nullptr) { unitTypes++; if (unitTypes==END) { side++; @@ -2966,11 +2966,11 @@ static void unitTimings(void) g_UT_startTiming = false; if (g_UT_timingLog) { fclose(g_UT_timingLog); - g_UT_timingLog = NULL; + g_UT_timingLog = nullptr; } if (g_UT_commaLog) { fclose(g_UT_commaLog); - g_UT_commaLog = NULL; + g_UT_commaLog = nullptr; } break; } @@ -3022,7 +3022,7 @@ static void unitTimings(void) for (j=0; j<10; j++) { Team *team = ThePlayerList->getNthPlayer(1)->getDefaultTeam(); Object *obj = TheThingFactory->newObject( btt, team ); - if (obj==NULL) break; + if (obj==nullptr) break; if (obj) { g_UT_gotUnit = true; @@ -3199,7 +3199,7 @@ void GameLogic::update( void ) u->update(); #endif - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } } } @@ -3238,7 +3238,7 @@ void GameLogic::update( void ) if (sleepLen < 1) sleepLen = UPDATE_SLEEP_NONE; - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } @@ -3340,7 +3340,7 @@ void GameLogic::addObjectToLookupTable( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // add to lookup @@ -3355,7 +3355,7 @@ void GameLogic::removeObjectFromLookupTable( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // remove from lookup table @@ -3440,7 +3440,7 @@ Object *GameLogic::friend_createObject( const ThingTemplate *thing, const Object // ------------------------------------------------------------------------------------------------ void GameLogic::destroyObject( Object *obj ) { - DEBUG_ASSERTCRASH(obj != NULL, ("destroying null object")); + DEBUG_ASSERTCRASH(obj != nullptr, ("destroying null object")); // if already flagged for destruction, ignore if (!obj || obj->isDestroyed()) @@ -3599,7 +3599,7 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) UnsignedInt theCRC = xferCRC->getCRC(); delete xferCRC; - xferCRC = NULL; + xferCRC = nullptr; if (isInGameLogicUpdate()) { @@ -3649,7 +3649,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) // Because this implementation is a bridge between the Logic and Interface, // we must take extra care to handle such cases as when the system it // shutting down. - if(TheGameClient == NULL) + if(TheGameClient == nullptr) return; // destroy the drawable @@ -3660,7 +3660,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) } // erase the binding of the drawable to this object - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -4048,7 +4048,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -4062,7 +4062,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -4107,7 +4107,7 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) templateName = obj->getTemplate()->getName(); // if is this object name already in the TOC, skip it - if( findTOCEntryByName( templateName ) != NULL ) + if( findTOCEntryByName( templateName ) != nullptr ) continue; // add this entry to the TOC @@ -4228,7 +4228,7 @@ void GameLogic::prepareLogicForObjectLoad( void ) processDestroyList(); // there should be no objects anywhere - DEBUG_ASSERTCRASH( getFirstObject() == NULL, + DEBUG_ASSERTCRASH( getFirstObject() == nullptr, ("GameLogic::prepareLogicForObjectLoad - There are still objects loaded in the engine, but it should be empty (Top is '%s')", getFirstObject()->getTemplate()->getName().str()) ); @@ -4289,7 +4289,7 @@ void GameLogic::xfer( Xfer *xfer ) // get the object TOC entry for this template tocEntry = findTOCEntryByName( obj->getTemplate()->getName() ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Object TOC entry not found for '%s'", obj->getTemplate()->getName().str() )); @@ -4329,7 +4329,7 @@ void GameLogic::xfer( Xfer *xfer ) // find Object TOC entry with this identifier tocEntry = findTOCEntryById( tocID ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - No TOC entry match for id '%d'", tocID )); @@ -4342,7 +4342,7 @@ void GameLogic::xfer( Xfer *xfer ) // find matching thing template thingTemplate = TheThingFactory->findTemplate( tocEntry->name ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Unrecognized thing template name '%s', skipping. ENGINEERS - Are you *sure* it's OK to be ignoring this object from the save file??? Think hard about it!", @@ -4441,7 +4441,7 @@ void GameLogic::xfer( Xfer *xfer ) poly = PolygonTrigger::getPolygonTriggerByID( triggerID ); // sanity - if( poly == NULL ) + if( poly == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Unable to find polygon trigger with id '%d'", @@ -4547,11 +4547,11 @@ void GameLogic::xfer( Xfer *xfer ) break; AsciiString value; xfer->xferAsciiString(&value); - ConstCommandButtonPtr button = NULL; + ConstCommandButtonPtr button = nullptr; if (value.isNotEmpty()) { button = TheControlBar->findCommandButton(value); - DEBUG_ASSERTCRASH(button != NULL, ("Could not find button %s",value.str())); + DEBUG_ASSERTCRASH(button != nullptr, ("Could not find button %s",value.str())); } m_controlBarOverrides[name] = button; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index dc05ea60e69..4602a53b2fe 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -92,7 +92,7 @@ static Bool theBuildPlan = false; static Object *thePlanSubject[ MAX_PATH_SUBJECTS ]; static int thePlanSubjectCount = 0; -//static WindowLayout *background = NULL; +//static WindowLayout *background = nullptr; // ------------------------------------------------------------------------------------------------ /** Issue the movement command to the object */ @@ -214,7 +214,7 @@ static Object * getSingleObjectFromSelection(const AIGroup *currentlySelectedGro VecObjectID::const_iterator it = selectedObjects.begin(); return TheGameLogic->findObjectByID(*it); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -231,8 +231,8 @@ void GameLogic::closeWindows( void ) // hide the options menu NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( NULL, buttonID ); - GameWindow *window = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("OptionsMenu.wnd:OptionsMenuParent") ); + GameWindow *button = TheWindowManager->winGetWindowFromId( nullptr, buttonID ); + GameWindow *window = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("OptionsMenu.wnd:OptionsMenuParent") ); if(window) TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); @@ -289,7 +289,7 @@ void GameLogic::clearGameData( Bool showScoreScreen ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } } @@ -337,14 +337,14 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(msg != NULL && msg != (GameMessage*)0xdeadbeef, ("bad msg")); + DEBUG_ASSERTCRASH(msg != nullptr && msg != (GameMessage*)0xdeadbeef, ("bad msg")); #endif Player *thisPlayer = ThePlayerList->getNthPlayer( msg->getPlayerIndex() ); DEBUG_ASSERTCRASH( thisPlayer, ("logicMessageDispatcher: Processing message from unknown player (player index '%d')", msg->getPlayerIndex()) ); - AIGroupPtr currentlySelectedGroup = NULL; + AIGroupPtr currentlySelectedGroup = nullptr; if (isInGame()) { @@ -368,13 +368,13 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #if RETAIL_COMPATIBLE_AIGROUP TheAI->destroyGroup(currentlySelectedGroup); #endif - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; } // If there are any units that the player doesn't own, then remove them from the "currentlySelectedGroup" if (currentlySelectedGroup) if (currentlySelectedGroup->removeAnyObjectsNotOwnedByPlayer(thisPlayer)) - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; if(TheStatsCollector) TheStatsCollector->collectMsgStats(msg); @@ -456,7 +456,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) currentlySelectedGroup->removeAll(); #endif } - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; clearGameData(); break; @@ -520,7 +520,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // lock it just till the weapon is empty or the attack is "done" if( currentlySelectedGroup && currentlySelectedGroup->setWeaponLockForGroup( weaponSlot, LOCKED_TEMPORARILY )) { - currentlySelectedGroup->groupAttackPosition( NULL, maxShotsToFire, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupAttackPosition( nullptr, maxShotsToFire, CMD_FROM_PLAYER ); } break; @@ -558,7 +558,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Coord3D targetLoc = msg->getArgument( 0 )->location; if( currentlySelectedGroup ) - currentlySelectedGroup->groupCombatDrop( NULL, targetLoc, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupCombatDrop( nullptr, targetLoc, CMD_FROM_PLAYER ); /* if( sourceObject ) @@ -566,7 +566,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) AIUpdateInterface* sourceAI = sourceObject->getAIUpdateInterface(); if (sourceAI) { - sourceAI->aiCombatDrop( NULL, targetLoc, CMD_FROM_PLAYER ); + sourceAI->aiCombatDrop( nullptr, targetLoc, CMD_FROM_PLAYER ); } } */ @@ -585,7 +585,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Int maxShotsToFire = msg->getArgument( 2 )->integer; // sanity - if( targetObject == NULL ) + if( targetObject == nullptr ) break; @@ -655,7 +655,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(2)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -697,7 +697,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(4)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -740,7 +740,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(3)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -975,7 +975,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *enter = findObjectByID( msg->getArgument( 1 )->objectID ); // sanity - if( enter == NULL ) + if( enter == nullptr ) break; if( currentlySelectedGroup ) @@ -999,10 +999,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif // sanity - if( objectWantingToExit == NULL ) + if( objectWantingToExit == nullptr ) break; - if( objectContainingExiter == NULL ) + if( objectContainingExiter == nullptr ) break; // sanity, the player must actually control this object @@ -1084,7 +1084,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *repairDepot = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( repairDepot == NULL ) + if( repairDepot == nullptr ) break; // tell the currently selected group to go get repaired @@ -1101,7 +1101,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *dockBuilding = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( dockBuilding == NULL ) + if( dockBuilding == nullptr ) break; // tell the currently selected group to go get repaired @@ -1118,7 +1118,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *healDest = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( healDest == NULL ) + if( healDest == nullptr ) break; // tell the currently selected group to enter the building for healing @@ -1135,7 +1135,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *repairTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( repairTarget == NULL ) + if( repairTarget == nullptr ) break; // @@ -1155,7 +1155,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *constructTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( constructTarget == NULL ) + if( constructTarget == nullptr ) break; // @@ -1181,7 +1181,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ObjectID sourceID = msg->getArgument(2)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -1310,7 +1310,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) const UpgradeTemplate *upgradeT = TheUpgradeCenter->findUpgradeByKey( (NameKeyType)(msg->getArgument( 0 )->integer) ); // sanity - if( producer == NULL || upgradeT == NULL ) + if( producer == nullptr || upgradeT == nullptr ) break; // the player must actually control the producer object @@ -1319,7 +1319,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // producer must have a production update ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // cancel the upgrade @@ -1345,12 +1345,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) productionID = (ProductionID)msg->getArgument( 1 )->integer; // sanity - if ( producer == NULL || whatToCreate == NULL ) + if ( producer == nullptr || whatToCreate == nullptr ) break; // get the production interface for the producer ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_ASSERTCRASH( 0, ("MSG_QUEUE_UNIT_CREATE: Producer '%s' doesn't have a unit production interface", @@ -1377,7 +1377,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ProductionID productionID = (ProductionID)msg->getArgument( 0 )->integer; // sanity - if( producer == NULL ) + if( producer == nullptr ) break; // sanity, the player must control the producer @@ -1386,7 +1386,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // get the unit production interface ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // cancel the production @@ -1414,7 +1414,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) loc = msg->getArgument( 1 )->location; angle = msg->getArgument( 2 )->real; - if( place == NULL || constructorObject == NULL ) + if( place == nullptr || constructorObject == nullptr ) break; //These are not crashes, as the object may have died before this message came in if( msg->getType() == GameMessage::MSG_DOZER_CONSTRUCT ) @@ -1461,7 +1461,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #else Object *building = getSingleObjectFromSelection(currentlySelectedGroup.Peek()); #endif - if( building == NULL ) + if( building == nullptr ) break; // the player sending this message must actually control this building @@ -1542,7 +1542,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // use selected group if( currentlySelectedGroup ) - currentlySelectedGroup->groupReturnToPrison( NULL, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupReturnToPrison( nullptr, CMD_FROM_PLAYER ); break; @@ -1557,7 +1557,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Bool createNewGroup = msg->getArgument( 0 )->boolean; Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player == NULL) { + if (player == nullptr) { DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); break; } @@ -1583,7 +1583,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player == NULL) { + if (player == nullptr) { DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); break; } @@ -1606,9 +1606,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) case GameMessage::MSG_DESTROY_SELECTED_GROUP: { Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player != NULL) + if (player != nullptr) { - player->setCurrentlySelectedAIGroup(NULL); + player->setCurrentlySelectedAIGroup(nullptr); } break; @@ -1626,7 +1626,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_PLACE_BEACON: { - if (thisPlayer->getPlayerTemplate() == NULL) + if (thisPlayer->getPlayerTemplate() == nullptr) break; Coord3D pos = msg->getArgument( 0 )->location; Region3D r; @@ -1658,7 +1658,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } Object *object = TheThingFactory->newObject( thing, thisPlayer->getDefaultTeam() ); object->setPosition( &pos ); - object->setProducer(NULL); + object->setProducer(nullptr); if (thisPlayer->getRelationship( ThePlayerList->getLocalPlayer()->getDefaultTeam() ) == ALLIES || ThePlayerList->getLocalPlayer()->isPlayerObserver()) { @@ -1776,7 +1776,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (allSelectedObjects->isEmpty()) { TheAI->destroyGroup(allSelectedObjects); - allSelectedObjects = NULL; + allSelectedObjects = nullptr; } #endif } @@ -1900,7 +1900,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for create team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for create team message")); // TheSuperHackers @tweak Stubbjax 17/08/2025 The local player processes this message in CommandXlat for immediate assignment. if (player && !player->isLocalPlayer()) @@ -1922,9 +1922,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for select team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for select team message")); - if (player == NULL) + if (player == nullptr) { break; } @@ -1946,9 +1946,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for add team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for add team message")); - if (player == NULL) + if (player == nullptr) { break; } @@ -2013,7 +2013,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ScienceType science = (ScienceType)msg->getArgument( 0 )->integer; // sanity - if( science == SCIENCE_INVALID || thisPlayer == NULL ) + if( science == SCIENCE_INVALID || thisPlayer == nullptr ) break; thisPlayer->attemptToPurchaseScience(science); @@ -2050,7 +2050,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } /**/ - if( currentlySelectedGroup != NULL ) + if( currentlySelectedGroup != nullptr ) { #if RETAIL_COMPATIBLE_AIGROUP TheAI->destroyGroup(currentlySelectedGroup); diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp index f4a2d3c4b0b..18265789d1f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp @@ -33,7 +33,7 @@ #include "Common/Player.h" #include "GameLogic/RankInfo.h" -RankInfoStore* TheRankInfoStore = NULL; +RankInfoStore* TheRankInfoStore = nullptr; //----------------------------------------------------------------------------- @@ -105,7 +105,7 @@ const RankInfo* RankInfoStore::getRankInfo(Int level) const return (const RankInfo*)ri->getFinalOverride(); } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -117,11 +117,11 @@ void RankInfoStore::friend_parseRankDefinition( INI* ini ) static const FieldParse myFieldParse[] = { - { "RankName", INI::parseAndTranslateLabel, NULL, offsetof( RankInfo, m_rankName ) }, - { "SkillPointsNeeded", INI::parseInt, NULL, offsetof( RankInfo, m_skillPointsNeeded ) }, - { "SciencesGranted", INI::parseScienceVector, NULL, offsetof( RankInfo, m_sciencesGranted ) }, - { "SciencePurchasePointsGranted", INI::parseUnsignedInt, NULL, offsetof( RankInfo, m_sciencePurchasePointsGranted ) }, - { 0, 0, 0, 0 } + { "RankName", INI::parseAndTranslateLabel, nullptr, offsetof( RankInfo, m_rankName ) }, + { "SkillPointsNeeded", INI::parseInt, nullptr, offsetof( RankInfo, m_skillPointsNeeded ) }, + { "SciencesGranted", INI::parseScienceVector, nullptr, offsetof( RankInfo, m_sciencesGranted ) }, + { "SciencePurchasePointsGranted", INI::parseUnsignedInt, nullptr, offsetof( RankInfo, m_sciencePurchasePointsGranted ) }, + { nullptr, nullptr, nullptr, 0 } }; if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index 7ead7cd440d..cc6b1e33004 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -71,7 +71,7 @@ void EnableAcceptControls(Bool Enabled, GameInfo *myGame, GameWindow *comboPlaye Bool isObserver = myGame->getConstSlot(slotNum)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER; - if( !myGame->amIHost() && (buttonStart != NULL) ) + if( !myGame->amIHost() && (buttonStart != nullptr) ) buttonStart->winEnable(Enabled); if(comboColor[slotNum]) { @@ -132,7 +132,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha AsciiString parentNameStr; parentNameStr.format("%s:%s", layoutFilename, parentName); NameKeyType parentID = NAMEKEY(parentNameStr); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!parent) { DEBUG_CRASH(("Window %s not found", parentNameStr.str())); @@ -413,10 +413,10 @@ void UpdateSlotList( GameInfo *myGame, GameWindow *comboPlayer[], comboPlayer[i]->winEnable( FALSE ); } //if( i == myGame->getLocalSlotNum()) - if((comboColor[i] != NULL) && BitIsSet(comboColor[i]->winGetStatus(), WIN_STATUS_ENABLED)) + if((comboColor[i] != nullptr) && BitIsSet(comboColor[i]->winGetStatus(), WIN_STATUS_ENABLED)) PopulateColorComboBox(i, comboColor, myGame, myGame->getConstSlot(i)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER); Int max, idx; - if (comboColor[i] != NULL) { + if (comboColor[i] != nullptr) { max = GadgetComboBoxGetLength(comboColor[i]); for (idx=0; idxshowLocaleSelect()) { TheGameSpyThread->setShowLocaleSelect(false); - WindowLayout *layout = NULL; + WindowLayout *layout = nullptr; layout = TheWindowManager->winCreateLayout( "Menus/PopupLocaleSelect.wnd" ); layout->runInit(); layout->hide( FALSE ); @@ -270,7 +270,7 @@ void GameSpyChat::update( void ) gpProcess(TheGPConnection); - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -282,7 +282,7 @@ void GameSpyChat::update( void ) } } - if (TheFirewallHelper != NULL) { + if (TheFirewallHelper != nullptr) { if (TheFirewallHelper->behaviorDetectionUpdate()) { TheGlobalData->m_firewallBehavior = TheFirewallHelper->getFirewallBehavior(); OptionPreferences *pref = NEW OptionPreferences; @@ -296,7 +296,7 @@ void GameSpyChat::update( void ) // we are now done with the firewall helper delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } } @@ -305,18 +305,18 @@ void GameSpyChat::update( void ) { // login timed out m_loginTimeout = 0; - GSMessageBoxOk(L"Error connecting", L"Timed out connecting", NULL); + GSMessageBoxOk(L"Error connecting", L"Timed out connecting", nullptr); // Enable controls again //EnableLoginControls(TRUE); if (TheGameSpyGame) delete TheGameSpyGame; - TheGameSpyGame = NULL; + TheGameSpyGame = nullptr; if (m_peer) peerShutdown(m_peer); - m_peer = NULL; + m_peer = nullptr; gpDisconnect(TheGPConnection); gpDestroy(TheGPConnection); @@ -341,12 +341,12 @@ void GameSpyChat::UTMPlayer( const char *name, const char *key, const char *val, void GameSpyChat::startGame( void ) { - peerStartGame( m_peer, NULL, PEER_STOP_REPORTING ); + peerStartGame( m_peer, nullptr, PEER_STOP_REPORTING ); } void GameSpyChat::leaveRoom( RoomType roomType ) { - peerLeaveRoom( m_peer, roomType, NULL ); + peerLeaveRoom( m_peer, roomType, nullptr ); } void GameSpyChat::setReady( Bool ready ) @@ -362,7 +362,7 @@ void GameSpyChat::enumPlayers( RoomType roomType, peerEnumPlayersCallback callba void GameSpyChat::startListingGames( peerListingGamesCallback callback ) { peerSetUpdatesRoomChannel( m_peer, "#gmtest_updates" ); - peerStartListingGames( m_peer, NULL, callback, NULL ); + peerStartListingGames( m_peer, nullptr, callback, nullptr ); } void GameSpyChat::stopListingGames( void ) @@ -440,12 +440,12 @@ void GameSpyChat::joinBestGroupRoom( void ) } else { - GSMessageBoxOk(L"Oops", L"No empty group rooms", NULL); + GSMessageBoxOk(L"Oops", L"No empty group rooms", nullptr); } } else { - GSMessageBoxOk(L"Oops", L"No group rooms", NULL); + GSMessageBoxOk(L"Oops", L"No group rooms", nullptr); } } @@ -456,11 +456,11 @@ void GameSpyChat::disconnectFromChat( void ) if (m_peer) { peerShutdown(m_peer); - m_peer = NULL; + m_peer = nullptr; } if (TheGameSpyGame) delete TheGameSpyGame; - TheGameSpyGame = NULL; + TheGameSpyGame = nullptr; } @@ -477,9 +477,9 @@ void DisconnectedCallback(PEER peer, const char * reason, if (TheGameSpyGame) delete TheGameSpyGame; - TheGameSpyGame = NULL; + TheGameSpyGame = nullptr; - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSDisconnected"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSDisconnected"), nullptr); WindowLayout * mainMenu = TheShell->findScreenByFilename("Menus/MainMenu.wnd"); if (mainMenu) @@ -920,7 +920,7 @@ void JoinRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, RoomTy TheShell->pop(); TheShell->push("Menus/WOLWelcomeMenu.wnd"); } - GSMessageBoxOk(L"Oops", L"Unable to join group room", NULL); + GSMessageBoxOk(L"Oops", L"Unable to join group room", nullptr); } // Update buddy location @@ -978,7 +978,7 @@ void JoinRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, RoomTy else { // let the user know - GSMessageBoxOk(L"Oops", L"Unable to join game", NULL); + GSMessageBoxOk(L"Oops", L"Unable to join game", nullptr); DEBUG_LOG(("JoinRoomCallback - Failed to join staging room.")); } @@ -1065,7 +1065,7 @@ void createRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, Room { // join the lobby again TheGameSpyChat->joinGroupRoom(oldGroupID); - GSMessageBoxOk(L"Oops", L"Unable to create game", NULL); + GSMessageBoxOk(L"Oops", L"Unable to create game", nullptr); } // Update buddy location @@ -1086,7 +1086,7 @@ void createRoomCallback(PEER peer, PEERBool success, PEERJoinResult result, Room // Gets called once for each group room when listing group rooms. // After this has been called for each group room, it will be -// called one more time with groupID==0 and name==NULL. +// called one more time with groupID==0 and name==nullptr. ///////////////////////////////////////////////////////////////// void ListGroupRoomsCallback(PEER peer, PEERBool success, int groupID, GServer server, @@ -1141,14 +1141,14 @@ void GameSpyChat::_connectCallback(PEER peer, PEERBool success, void * param) m_loginTimeout = 0; if (!success) { - GSMessageBoxOk(L"Error connecting", L"Failed to connect", NULL); + GSMessageBoxOk(L"Error connecting", L"Failed to connect", nullptr); DEBUG_LOG(("GameSpyChat::_connectCallback - failed to connect.")); } if(!success) { peerShutdown(m_peer); - m_peer = NULL; + m_peer = nullptr; gpDisconnect(TheGPConnection); gpDestroy(TheGPConnection); @@ -1176,7 +1176,7 @@ void GameSpyChat::_connectCallback(PEER peer, PEERBool success, void * param) TheShell->push("Menus/WOLWelcomeMenu.wnd"); clearGroupRoomList(); - peerListGroupRooms(m_peer, ListGroupRoomsCallback, NULL, PEERFalse); + peerListGroupRooms(m_peer, ListGroupRoomsCallback, nullptr, PEERFalse); } // Called if there's an error with the nick. @@ -1207,9 +1207,9 @@ void GameSpyChat::_nickErrorCallback(PEER peer, int type, const char * nick, voi } else { - GSMessageBoxOk(L"Error connecting", L"That nickname is already taken; please choose another one.", NULL); + GSMessageBoxOk(L"Error connecting", L"That nickname is already taken; please choose another one.", nullptr); // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); // Enable controls again //EnableLoginControls(TRUE); @@ -1218,9 +1218,9 @@ void GameSpyChat::_nickErrorCallback(PEER peer, int type, const char * nick, voi } else { - GSMessageBoxOk(L"Error connecting", L"That nickname contains at least 1 invalid character, please choose another one.", NULL); + GSMessageBoxOk(L"Error connecting", L"That nickname contains at least 1 invalid character, please choose another one.", nullptr); // Cancel the connect. - peerRetryWithNick(peer, NULL); + peerRetryWithNick(peer, nullptr); // Enable controls again //EnableLoginControls(TRUE); @@ -1239,7 +1239,7 @@ void GameSpyChat::_GPConnectCallback(GPConnection * pconnection, GPConnectRespon if (*res != GP_NO_ERROR) { // couldn't connect. bummer. - GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", NULL); + GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", nullptr); gpDisconnect(TheGPConnection); gpDestroy(TheGPConnection); m_loginTimeout = 0; @@ -1248,7 +1248,7 @@ void GameSpyChat::_GPConnectCallback(GPConnection * pconnection, GPConnectRespon // Connect to chat. /////////////////// - peerConnect(m_peer, m_loginName.str(), m_profileID, nickErrorCallback, connectCallback, NULL, PEERFalse); + peerConnect(m_peer, m_loginName.str(), m_profileID, nickErrorCallback, connectCallback, nullptr, PEERFalse); } static Bool inGPReconnect = false; @@ -1262,7 +1262,7 @@ void GameSpyChat::_GPReconnectCallback(GPConnection * pconnection, GPConnectResp if (arg->result != GP_NO_ERROR) { // couldn't connect. bummer. - GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", NULL); + GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", nullptr); gpDisconnect(TheGPConnection); gpDestroy(TheGPConnection); return; @@ -1270,7 +1270,7 @@ void GameSpyChat::_GPReconnectCallback(GPConnection * pconnection, GPConnectResp else { // yay! we're back in! - GSMessageBoxOk(L"Connected!", L"Reonnected to buddy server", NULL); + GSMessageBoxOk(L"Connected!", L"Reonnected to buddy server", nullptr); } } @@ -1280,10 +1280,10 @@ void GameSpyChat::loginProfile(AsciiString loginName, AsciiString password, Asci /////////////////// m_profileID = 0; gpInitialize(TheGPConnection, 0); - gpSetCallback(TheGPConnection, GP_ERROR, (GPCallback)GPErrorCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_REQUEST, (GPCallback)GPRecvBuddyRequestCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_MESSAGE, (GPCallback)GPRecvBuddyMessageCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_STATUS, (GPCallback)GPRecvBuddyStatusCallback, NULL); + gpSetCallback(TheGPConnection, GP_ERROR, (GPCallback)GPErrorCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_REQUEST, (GPCallback)GPRecvBuddyRequestCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_MESSAGE, (GPCallback)GPRecvBuddyMessageCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_STATUS, (GPCallback)GPRecvBuddyStatusCallback, nullptr); GPResult res = GP_PARAMETER_ERROR; m_loginName = loginName; @@ -1295,7 +1295,7 @@ void GameSpyChat::loginProfile(AsciiString loginName, AsciiString password, Asci if (res != GP_NO_ERROR) { // couldn't connect. bummer. - GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", NULL); + GSMessageBoxOk(L"Error connecting", L"Error connecting to buddy server", nullptr); gpDisconnect(TheGPConnection); gpDestroy(TheGPConnection); loginTimeout = 0; @@ -1305,7 +1305,7 @@ void GameSpyChat::loginProfile(AsciiString loginName, AsciiString password, Asci // Connect to chat. /////////////////// GameSpyLocalNickname = loginName; - peerConnect(TheGameSpyChat->getPeer(), loginName.str(), GameSpyLocalProfile, nickErrorCallback, connectCallback, NULL, PEERFalse); + peerConnect(TheGameSpyChat->getPeer(), loginName.str(), GameSpyLocalProfile, nickErrorCallback, connectCallback, nullptr, PEERFalse); */ } @@ -1317,12 +1317,12 @@ void GameSpyChat::reconnectProfile( void ) inGPReconnect = true; gpInitialize(TheGPConnection, 0); - gpSetCallback(TheGPConnection, GP_ERROR, (GPCallback)GPErrorCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_REQUEST, (GPCallback)GPRecvBuddyRequestCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_MESSAGE, (GPCallback)GPRecvBuddyMessageCallback, NULL); - gpSetCallback(TheGPConnection, GP_RECV_BUDDY_STATUS, (GPCallback)GPRecvBuddyStatusCallback, NULL); + gpSetCallback(TheGPConnection, GP_ERROR, (GPCallback)GPErrorCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_REQUEST, (GPCallback)GPRecvBuddyRequestCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_MESSAGE, (GPCallback)GPRecvBuddyMessageCallback, nullptr); + gpSetCallback(TheGPConnection, GP_RECV_BUDDY_STATUS, (GPCallback)GPRecvBuddyStatusCallback, nullptr); - gpConnect(TheGPConnection, m_loginName.str(), m_email.str(), m_password.str(), GP_FIREWALL, GP_NON_BLOCKING, (GPCallback)GPReconnectCallback, NULL); + gpConnect(TheGPConnection, m_loginName.str(), m_email.str(), m_password.str(), GP_FIREWALL, GP_NON_BLOCKING, (GPCallback)GPReconnectCallback, nullptr); } void GameSpyChat::loginQuick(AsciiString login) @@ -1333,7 +1333,7 @@ void GameSpyChat::loginQuick(AsciiString login) /////////////////// m_loginName = login; DEBUG_LOG(("GameSpyChat::loginQuick - setting login to %s", m_loginName)); - peerConnect(m_peer, login.str(), 0, nickErrorCallback, connectCallback, NULL, PEERFalse); + peerConnect(m_peer, login.str(), 0, nickErrorCallback, connectCallback, nullptr, PEERFalse); } void GameSpyChat::login(AsciiString loginName, AsciiString password, AsciiString email) @@ -1366,14 +1366,14 @@ void GameSpyChat::login(AsciiString loginName, AsciiString password, AsciiString callbacks.GOARules = GOARulesCallback; callbacks.GOAPlayers = GOAPlayersCallback; //callbacks.globalKeyChanged = GlobalKeyChanged; - callbacks.param = NULL; + callbacks.param = nullptr; // Init peer. ///////////// m_peer = peerInitialize(&callbacks); if(!m_peer) { - GSMessageBoxOk(L"No Peer", L"No Peer", NULL); + GSMessageBoxOk(L"No Peer", L"No Peer", nullptr); return; } @@ -1392,9 +1392,9 @@ void GameSpyChat::login(AsciiString loginName, AsciiString password, AsciiString ///////////////// if(!peerSetTitle(m_peer, "gmtest", "HA6zkS", "gmtest", "HA6zkS", 15, pingRooms, crossPingRooms)) { - GSMessageBoxOk(L"Error setting title", L"Error setting title", NULL); + GSMessageBoxOk(L"Error setting title", L"Error setting title", nullptr); peerShutdown(m_peer); - m_peer = NULL; + m_peer = nullptr; return; } diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyChat.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyChat.cpp index a567fd126cc..925d892b9a6 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyChat.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyChat.cpp @@ -439,7 +439,7 @@ static handleUnicodeMessage( const char *nick, UnicodeString msg, Bool isPublic, void GameSpyAddText( UnicodeString message, GameSpyColors color ) { - GameWindow *textWindow = NULL; + GameWindow *textWindow = nullptr; if (!textWindow) textWindow = listboxLobbyChat; diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGP.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGP.cpp index be309ddae3d..906d3f52cf4 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGP.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGP.cpp @@ -42,7 +42,7 @@ void GPRecvBuddyMessageCallback(GPConnection * pconnection, GPRecvBuddyMessageAr { DEBUG_LOG(("GPRecvBuddyMessageCallback: message from %d is %s", arg->profile, arg->message)); - //gpGetInfo(pconn, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, NULL); + //gpGetInfo(pconn, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, nullptr); //printf("MESSAGE (%d): %s: %s\n", msgCount,whois, arg->message); } @@ -135,7 +135,7 @@ void GPErrorCallback(GPConnection * pconnection, GPErrorArg * arg, void * param) GameSpyCloseOverlay(GSOVERLAY_BUDDY); if (TheGameSpyChat->isConnected()) { - GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, NULL); + GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, nullptr); } } else diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp index 92dc5ddd070..61f45c48e7b 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp @@ -46,7 +46,7 @@ // Singleton ------------------------------------------ -GameSpyGameInfo *TheGameSpyGame = NULL; +GameSpyGameInfo *TheGameSpyGame = nullptr; // Helper Functions ---------------------------------------- @@ -187,7 +187,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load INETMIB1.DLL")); HINSTANCE mib_ii_dll = LoadLibrary("inetmib1.dll"); - if (mib_ii_dll == NULL) { + if (mib_ii_dll == nullptr) { DEBUG_LOG(("Failed to load INETMIB1.DLL")); return(false); } @@ -195,7 +195,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load SNMPAPI.DLL")); HINSTANCE snmpapi_dll = LoadLibrary("snmpapi.dll"); - if (snmpapi_dll == NULL) { + if (snmpapi_dll == nullptr) { DEBUG_LOG(("Failed to load SNMPAPI.DLL")); FreeLibrary(mib_ii_dll); return(false); @@ -208,7 +208,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP SnmpExtensionQueryPtr = (int (__stdcall *)(unsigned char,SnmpVarBindList *,long *,long *)) GetProcAddress(mib_ii_dll, "SnmpExtensionQuery"); SnmpUtilMemAllocPtr = (void *(__stdcall *)(unsigned long)) GetProcAddress(snmpapi_dll, "SnmpUtilMemAlloc"); SnmpUtilMemFreePtr = (void (__stdcall *)(void *)) GetProcAddress(snmpapi_dll, "SnmpUtilMemFree"); - if (SnmpExtensionInitPtr == NULL || SnmpExtensionQueryPtr == NULL || SnmpUtilMemAllocPtr == NULL || SnmpUtilMemFreePtr == NULL) { + if (SnmpExtensionInitPtr == nullptr || SnmpExtensionQueryPtr == nullptr || SnmpUtilMemAllocPtr == nullptr || SnmpUtilMemFreePtr == nullptr) { DEBUG_LOG(("Failed to get proc addresses for linked functions")); FreeLibrary(snmpapi_dll); FreeLibrary(mib_ii_dll); @@ -449,8 +449,8 @@ GameSpyGameInfo::GameSpyGameInfo() { setLocalIP(0); } - m_server = NULL; - m_transport = NULL; + m_server = nullptr; + m_transport = nullptr; } // Misc game-related functionality -------------------- @@ -475,7 +475,7 @@ void GameSpyStartGame( void ) { UnicodeString text; text.format(TheGameText->fetch("LAN:NeedMorePlayers"),numUsers); - TheGameSpyInfo->addText(text, GSCOLOR_DEFAULT, NULL); + TheGameSpyInfo->addText(text, GSCOLOR_DEFAULT, nullptr); } return; } @@ -492,11 +492,11 @@ void GameSpyLaunchGame( void ) // Set up the game network AsciiString user; AsciiString userList; - DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); + DEBUG_ASSERTCRASH(TheNetwork == nullptr, ("For some reason TheNetwork isn't null at the start of this game. Better look into that.")); - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; } // Time to initialize TheNetwork for this game. @@ -518,7 +518,7 @@ void GameSpyLaunchGame( void ) { DEBUG_CRASH(("No GameSlot[%d]!", i)); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; return; } @@ -566,9 +566,9 @@ void GameSpyLaunchGame( void ) InitGameLogicRandom( TheGameSpyGame->getSeed() ); DEBUG_LOG(("InitGameLogicRandom( %d )", TheGameSpyGame->getSeed())); - if (TheNAT != NULL) { + if (TheNAT != nullptr) { delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; } } } @@ -603,7 +603,7 @@ Int GameSpyGameInfo::getLocalSlotNum( void ) const for (Int i=0; iisPlayer(localName)) @@ -621,8 +621,8 @@ void GameSpyGameInfo::gotGOACall( void ) void GameSpyGameInfo::startGame(Int gameID) { DEBUG_LOG(("GameSpyGameInfo::startGame - game id = %d", gameID)); - DEBUG_ASSERTCRASH(m_transport == NULL, ("m_transport is not NULL when it should be")); - DEBUG_ASSERTCRASH(TheNAT == NULL, ("TheNAT is not NULL when it should be")); + DEBUG_ASSERTCRASH(m_transport == nullptr, ("m_transport is not null when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not null when it should be")); // fill in GS-specific info for (Int i=0; iattachSlotList(m_slot, getLocalSlotNum(), m_localIP); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyPersistentStorage.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyPersistentStorage.cpp index 76b3ef38dee..76cbf4f45ad 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyPersistentStorage.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyPersistentStorage.cpp @@ -219,7 +219,7 @@ void GameSpyPlayerInfo::threadSetLosses( AsciiString val ) free(writable); } -GameSpyPlayerInfoInterface *TheGameSpyPlayerInfo = NULL; +GameSpyPlayerInfoInterface *TheGameSpyPlayerInfo = nullptr; GameSpyPlayerInfoInterface *createGameSpyPlayerInfo( void ) { @@ -358,12 +358,12 @@ static Bool gameSpyInitPersistentStorageConnection( void ) in the password for the profile we are authenticating. Again, if this is done in a client/server setting, with the Persistent Storage access being done on the server, and the P&M SDK is used on the client, the - server will need to send the challenge (GetChallenge(NULL)) to the client, the + server will need to send the challenge (GetChallenge(nullptr)) to the client, the client will create the validation token using GenerateAuth, and send it back to the server for use in PreAuthenticatePlayerPM ***********/ char *munkeeHack = strdup(TheGameSpyChat->getPassword().str()); // GenerateAuth takes a char*, not a const char* :P - GenerateAuth(GetChallenge(NULL), munkeeHack, validate); + GenerateAuth(GetChallenge(nullptr), munkeeHack, validate); free (munkeeHack); /************ @@ -372,7 +372,7 @@ static Bool gameSpyInitPersistentStorageConnection( void ) We pass the same authentication callback as for the first user, but a different localid this time. ************/ - PreAuthenticatePlayerPM(0, TheGameSpyChat->getProfileID(), validate, persAuthCallback, NULL); + PreAuthenticatePlayerPM(0, TheGameSpyChat->getProfileID(), validate, persAuthCallback, nullptr); } else { diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 226dc9c769d..9bfaf45c1a2 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -368,7 +368,7 @@ class W3DModelDraw : public DrawModule, public ObjectDrawInterface virtual Int getPristineBonePositionsForConditionState(const ModelConditionFlags& condition, const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const; virtual Int getCurrentBonePositions(const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const; virtual Bool getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const; - virtual Bool getProjectileLaunchOffset(const ModelConditionFlags& condition, WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = NULL) const; + virtual Bool getProjectileLaunchOffset(const ModelConditionFlags& condition, WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = nullptr) const; virtual void updateProjectileClipStatus( UnsignedInt shotsRemaining, UnsignedInt maxShots, WeaponSlotType slot ); ///< This will do the show/hide work if ProjectileBoneFeedbackEnabled is set. virtual void updateDrawModuleSupplyStatus( Int maxSupply, Int currentSupply ); ///< This will do visual feedback on Supplies carried virtual void notifyDrawModuleDependencyCleared( ){}///< if you were waiting for something before you drew, it's ready now diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h index baae21cb17d..eeaedcb31e7 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h @@ -73,7 +73,7 @@ class W3DAssetManager: public WW3DAssetManager void Report_Used_Font3DDatas( void ); void Report_Used_FontChars (void); - virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=NULL, const char *newTexture=NULL); + virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=nullptr, const char *newTexture=nullptr); ///Swaps the specified textures in the render object prototype. int replacePrototypeTexture(RenderObjClass *robj, const char * oldname, const char * newname); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h index 40e18524de5..782aa73d5e6 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h @@ -143,9 +143,9 @@ class W3DBufferManager void freeAllBuffers(void); ///m_nextVB; }; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h index da0a942acd6..1ba387314e9 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h @@ -42,7 +42,7 @@ class W3DShadowManager // shadow list management void Reset( void ); - Shadow* addShadow( RenderObjClass *robj,Shadow::ShadowTypeInfo *shadowInfo=NULL, Drawable *draw=NULL); ///< adds shadow caster to rendering system. + Shadow* addShadow( RenderObjClass *robj,Shadow::ShadowTypeInfo *shadowInfo=nullptr, Drawable *draw=nullptr); ///< adds shadow caster to rendering system. void removeShadow(Shadow *shadow); ///< removed shadow from rendering system and frees its resources. void removeAllShadows(void); ///< Remove all shadows. void setShadowColor(UnsignedInt color) { m_shadowColor=color;} ///removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } if (m_renderObject) { - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } for (int i = 0; i < STATECOUNT; ++i) { REF_PTR_RELEASE(m_anims[i]); - m_anims[i] = NULL; + m_anims[i] = nullptr; } } @@ -103,7 +103,7 @@ void W3DDebrisDraw::setFullyObscuredByShroud(Bool fullyObscured) //------------------------------------------------------------------------------------------------- void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) { - if (m_renderObject == NULL && !name.isEmpty()) + if (m_renderObject == nullptr && !name.isEmpty()) { Int hexColor = 0; if (color != 0) @@ -112,7 +112,7 @@ void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) DEBUG_ASSERTCRASH(m_renderObject, ("Debris model %s not found!",name.str())); if (m_renderObject) { - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object(m_renderObject); m_renderObject->Set_User_Data(getDrawable()->getDrawableInfo()); @@ -138,7 +138,7 @@ void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } } @@ -156,11 +156,11 @@ void W3DDebrisDraw::setAnimNames(AsciiString initial, AsciiString flying, AsciiS for (i = 0; i < STATECOUNT; ++i) { REF_PTR_RELEASE(m_anims[i]); - m_anims[i] = NULL; + m_anims[i] = nullptr; } - m_anims[INITIAL] = initial.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(initial.str()); - m_anims[FLYING] = flying.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(flying.str()); + m_anims[INITIAL] = initial.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(initial.str()); + m_anims[FLYING] = flying.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(flying.str()); if (stricmp(final.str(), "STOP") == 0) { m_finalStop = true; @@ -170,7 +170,7 @@ void W3DDebrisDraw::setAnimNames(AsciiString initial, AsciiString flying, AsciiS { m_finalStop = false; } - m_anims[FINAL] = final.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(final.str()); + m_anims[FINAL] = final.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(final.str()); m_state = 0; m_frames = 0; m_fxFinal = finalFX; @@ -237,7 +237,7 @@ void W3DDebrisDraw::doDrawModule(const Matrix3D* transformMtx) Int oldState = m_state; Object* obj = getDrawable()->getObject(); const Int MIN_FINAL_FRAMES = 3; - if (m_state != FINAL && obj != NULL && !obj->isAboveTerrain() && m_frames > MIN_FINAL_FRAMES) + if (m_state != FINAL && obj != nullptr && !obj->isAboveTerrain() && m_frames > MIN_FINAL_FRAMES) { m_state = FINAL; } @@ -246,12 +246,12 @@ void W3DDebrisDraw::doDrawModule(const Matrix3D* transformMtx) ++m_state; } HAnimClass* hanim = m_anims[m_state]; - if (hanim != NULL && (hanim != m_renderObject->Peek_Animation() || oldState != m_state)) + if (hanim != nullptr && (hanim != m_renderObject->Peek_Animation() || oldState != m_state)) { RenderObjClass::AnimMode m = TheAnimModes[m_state]; if (m_state == FINAL) { - FXList::doFXPos(m_fxFinal, getDrawable()->getPosition(), getDrawable()->getTransformMatrix(), 0, NULL, 0.0f); + FXList::doFXPos(m_fxFinal, getDrawable()->getPosition(), getDrawable()->getTransformMatrix(), 0, nullptr, 0.0f); if (m_finalStop) m = RenderObjClass::ANIM_MODE_MANUAL; } @@ -309,7 +309,7 @@ void W3DDebrisDraw::xfer( Xfer *xfer ) // when loading, set the animations if( xfer->getXferMode() == XFER_LOAD ) - setAnimNames( m_animInitial, m_animFlying, m_animFinal, NULL ); + setAnimNames( m_animInitial, m_animFlying, m_animFinal, nullptr ); // state xfer->xferInt( &m_state ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index e07a19a7ca3..e199b6b0500 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -54,8 +54,8 @@ W3DDefaultDraw::W3DDefaultDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData) { #ifdef LOAD_TEST_ASSETS - m_renderObject = NULL; - m_shadow = NULL; + m_renderObject = nullptr; + m_shadow = nullptr; if (!getDrawable()->getTemplate()->getLTAName().isEmpty()) { m_renderObject = W3DDisplay::m_assetManager->Create_Render_Obj(getDrawable()->getTemplate()->getLTAName().str(), getDrawable()->getScale(), 0); @@ -108,13 +108,13 @@ W3DDefaultDraw::~W3DDefaultDraw(void) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } if (m_renderObject) { W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } #endif } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp index a0151a6016e..1a578779f53 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp @@ -59,9 +59,9 @@ void W3DDependencyModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AttachToBoneInContainer", INI::parseAsciiString, NULL, offsetof(W3DDependencyModelDrawModuleData, m_attachToDrawableBoneInContainer) }, + { "AttachToBoneInContainer", INI::parseAsciiString, nullptr, offsetof(W3DDependencyModelDrawModuleData, m_attachToDrawableBoneInContainer) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index aab8c0ebf9a..16b52a2ef17 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -98,7 +98,7 @@ class LogClass LogClass::LogClass(const char *fname) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -238,7 +238,7 @@ static const char *const ACBitsNames[] = "MAINTAIN_FRAME_ACROSS_STATES3", "MAINTAIN_FRAME_ACROSS_STATES4", - NULL + nullptr }; static_assert(ARRAY_SIZE(ACBitsNames) == AC_BITS_COUNT + 1, "Incorrect array size"); @@ -295,7 +295,7 @@ const UnsignedInt NO_NEXT_DURATION = 0xffffffff; //------------------------------------------------------------------------------------------------- W3DAnimationInfo::W3DAnimationInfo(const AsciiString& name, Bool isIdle, Real distanceCovered) : #ifdef RETAIN_ANIM_HANDLES - m_handle(NULL), + m_handle(nullptr), m_naturalDurationInMsec(0), #else m_naturalDurationInMsec(-1), @@ -346,7 +346,7 @@ W3DAnimationInfo& W3DAnimationInfo::operator=(const W3DAnimationInfo &r) HAnimClass* W3DAnimationInfo::getAnimHandle() const { #ifdef RETAIN_ANIM_HANDLES - if (m_handle == NULL) + if (m_handle == nullptr) { // Get_HAnim addrefs it, so we'll have to release it in our dtor. m_handle = W3DDisplay::m_assetManager->Get_HAnim(m_name.str()); @@ -363,7 +363,7 @@ HAnimClass* W3DAnimationInfo::getAnimHandle() const #else HAnimClass* handle = W3DDisplay::m_assetManager->Get_HAnim(m_name.str()); DEBUG_ASSERTCRASH(handle, ("*** ASSET ERROR: animation %s not found",m_name.str())); - if (handle != NULL && m_naturalDurationInMsec < 0) + if (handle != nullptr && m_naturalDurationInMsec < 0) { m_naturalDurationInMsec = handle->Get_Num_Frames() * 1000.0f / handle->Get_Frame_Rate(); } @@ -379,7 +379,7 @@ W3DAnimationInfo::~W3DAnimationInfo() { #ifdef RETAIN_ANIM_HANDLES REF_PTR_RELEASE(m_handle); - m_handle = NULL; + m_handle = nullptr; #endif } @@ -393,8 +393,8 @@ void ModelConditionInfo::preloadAssets( TimeOfDay timeOfDay, Real scale ) } // this can be called from the client, which is problematic -// validateStuff(NULL, getDrawable()->getScale()); - //validateCachedBones(NULL, scale); +// validateStuff(nullptr, getDrawable()->getScale()); + //validateCachedBones(nullptr, scale); //validateTurretInfo(); //validateWeaponBarrelInfo(); } @@ -476,7 +476,7 @@ static Bool findSingleSubObj(RenderObjClass* robj, const AsciiString& boneName, #if defined(RTS_DEBUG) test->Release_Ref(); test = robj->Get_Sub_Object_On_Bone(0, boneIndex); - DEBUG_ASSERTCRASH(test != NULL && test == childObject, ("*** ASSET ERROR: Hmm, bone problem")); + DEBUG_ASSERTCRASH(test != nullptr && test == childObject, ("*** ASSET ERROR: Hmm, bone problem")); #endif } if (test) test->Release_Ref(); @@ -612,7 +612,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c m_validStuff |= PRISTINE_BONES_VALID; Bool tossRobj = false; - if (robj == NULL) + if (robj == nullptr) { if (m_modelName.isEmpty()) { @@ -631,8 +631,8 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c } Matrix3D originalTransform = robj->Get_Transform(); // save the transform - HLodClass* hlod = NULL; - HAnimClass* curAnim = NULL; + HLodClass* hlod = nullptr; + HAnimClass* curAnim = nullptr; int numFrames = 0; float frame = 0.0f; int mode = 0; @@ -657,14 +657,14 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c if (animToUse) animToUse->Add_Ref(); } - if (animToUse != NULL) + if (animToUse != nullptr) { // make sure we're in frame zero. Int whichFrame = testFlagBit(m_flags, PRISTINE_BONE_POS_IN_FINAL_FRAME) ? animToUse->Get_Num_Frames()-1 : 0; robj->Set_Animation(animToUse, whichFrame, RenderObjClass::ANIM_MODE_MANUAL); // must balance the addref, above REF_PTR_RELEASE(animToUse); - animToUse = NULL; + animToUse = nullptr; } Matrix3D tmp(true); @@ -700,7 +700,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c } robj->Set_Transform(originalTransform); // restore previous transform - if (curAnim != NULL) + if (curAnim != nullptr) { robj->Set_Animation(curAnim, frame, mode); hlod->Set_Animation_Frame_Rate_Multiplier(mult); @@ -772,7 +772,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const { sprintf(buffer, "%s%02d", plbName.str(), i); const Matrix3D* mtx = findPristineBone(NAMEKEY(buffer), &plbBoneIndex); - if (mtx != NULL) + if (mtx != nullptr) info.m_projectileOffsetMtx = *mtx; } @@ -806,8 +806,8 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const info.m_muzzleFlashBoneName = mfName; #endif - const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName), NULL); - if (plbMtx != NULL) + const Matrix3D* plbMtx = plbName.isEmpty() ? nullptr : findPristineBone(NAMEKEY(plbName), nullptr); + if (plbMtx != nullptr) info.m_projectileOffsetMtx = *plbMtx; else info.m_projectileOffsetMtx.Make_Identity(); @@ -815,7 +815,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const if (!fxBoneName.isEmpty()) findPristineBone(NAMEKEY(fxBoneName), &info.m_fxBone); - if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != NULL) + if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != nullptr) { CRCDEBUG_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) wslot %d", m_modelName.str(), wslot)); DUMPMATRIX3D(&(info.m_projectileOffsetMtx)); @@ -859,7 +859,7 @@ void ModelConditionInfo::validateTurretInfo() const if (tur.m_turretAngleNameKey != NAMEKEY_INVALID) { - if (findPristineBone(tur.m_turretAngleNameKey, &tur.m_turretAngleBone) == NULL) + if (findPristineBone(tur.m_turretAngleNameKey, &tur.m_turretAngleBone) == nullptr) { DEBUG_CRASH(("*** ASSET ERROR: TurretBone %s not found! (%s)",KEYNAME(tur.m_turretAngleNameKey).str(),m_modelName.str())); tur.m_turretAngleBone = 0; @@ -872,7 +872,7 @@ void ModelConditionInfo::validateTurretInfo() const if (tur.m_turretPitchNameKey != NAMEKEY_INVALID) { - if (findPristineBone(tur.m_turretPitchNameKey, &tur.m_turretPitchBone) == NULL) + if (findPristineBone(tur.m_turretPitchNameKey, &tur.m_turretPitchBone) == nullptr) { DEBUG_CRASH(("*** ASSET ERROR: TurretBone %s not found! (%s)",KEYNAME(tur.m_turretPitchNameKey).str(),m_modelName.str())); tur.m_turretPitchBone = 0; @@ -899,7 +899,7 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero, some callers rely on this if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } if (boneName == NAMEKEY_INVALID) @@ -907,7 +907,7 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero, some callers rely on this if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } PristineBoneInfoMap::const_iterator it = m_pristineBones.find(boneName); @@ -922,14 +922,14 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero -- some callers rely on this! if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } } //------------------------------------------------------------------------------------------------- Bool ModelConditionInfo::findPristineBonePos(NameKeyType boneName, Coord3D& pos) const { - const Matrix3D* mtx = findPristineBone(boneName, NULL); + const Matrix3D* mtx = findPristineBone(boneName, nullptr); if (mtx) { Vector3 v = mtx->Get_Translation(); @@ -953,7 +953,7 @@ void ModelConditionInfo::loadAnimations() const { HAnimClass* h = it2->getAnimHandle(); // just force it to get loaded REF_PTR_RELEASE(h); - h = NULL; + h = nullptr; } #else // srj sez: I think there is no real reason to preload these all anymore. things that need the anims @@ -1058,7 +1058,7 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw if (!c_it->matchesMode(false, false) && !c_it->matchesMode(night, snowy)) continue; - c_it->validateStuff(NULL, draw->getScale(), m_extraPublicBones); + c_it->validateStuff(nullptr, draw->getScale(), m_extraPublicBones); } for (TransitionMap::iterator t_it = m_transitionMap.begin(); t_it != m_transitionMap.end(); ++t_it) @@ -1087,7 +1087,7 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw //it->addPublicBone(m_extraPublicBones); // srj sez: hm, this doesn't make sense; I think we really do need to validate transition states. - t_it->second.validateStuff(NULL, draw->getScale(), m_extraPublicBones); + t_it->second.validateStuff(nullptr, draw->getScale(), m_extraPublicBones); } } } @@ -1128,7 +1128,7 @@ const Vector3* W3DModelDrawModuleData::getAttachToDrawableBoneOffset(const Drawa { if (m_attachToDrawableBone.isEmpty()) { - return NULL; + return nullptr; } else { @@ -1136,7 +1136,7 @@ const Vector3* W3DModelDrawModuleData::getAttachToDrawableBoneOffset(const Drawa { // must use pristine bone here since the result is used by logic Matrix3D boneMtx; - if (draw->getPristineBonePositions(m_attachToDrawableBone.str(), 0, NULL, &boneMtx, 1) == 1) + if (draw->getPristineBonePositions(m_attachToDrawableBone.str(), 0, nullptr, &boneMtx, 1) == 1) { m_attachToDrawableBoneOffset = boneMtx.Get_Translation(); } @@ -1177,23 +1177,23 @@ void W3DModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "InitialRecoilSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_initialRecoil) }, - { "MaxRecoilDistance", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_maxRecoil) }, - { "RecoilDamping", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilDamping) }, - { "RecoilSettleSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilSettle) }, - { "OkToChangeModelColor", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) }, - { "AnimationsRequirePower", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) }, - { "MinLODRequired", INI::parseStaticGameLODLevel, NULL, offsetof(W3DModelDrawModuleData, m_minLODRequired) }, + { "InitialRecoilSpeed", INI::parseVelocityReal, nullptr, offsetof(W3DModelDrawModuleData, m_initialRecoil) }, + { "MaxRecoilDistance", INI::parseReal, nullptr, offsetof(W3DModelDrawModuleData, m_maxRecoil) }, + { "RecoilDamping", INI::parseReal, nullptr, offsetof(W3DModelDrawModuleData, m_recoilDamping) }, + { "RecoilSettleSpeed", INI::parseVelocityReal, nullptr, offsetof(W3DModelDrawModuleData, m_recoilSettle) }, + { "OkToChangeModelColor", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) }, + { "AnimationsRequirePower", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) }, + { "MinLODRequired", INI::parseStaticGameLODLevel, nullptr, offsetof(W3DModelDrawModuleData, m_minLODRequired) }, { "ProjectileBoneFeedbackEnabledSlots", INI::parseBitString32, TheWeaponSlotTypeNames, offsetof(W3DModelDrawModuleData, m_projectileBoneFeedbackEnabledSlots) }, { "DefaultConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_DEFAULT, 0 }, { "ConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_NORMAL, 0 }, { "AliasConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_ALIAS, 0 }, { "TransitionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_TRANSITION, 0 }, - { "TrackMarks", parseAsciiStringLC, NULL, offsetof(W3DModelDrawModuleData, m_trackFile) }, - { "ExtraPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(W3DModelDrawModuleData, m_extraPublicBones) }, - { "AttachToBoneInAnotherModule", parseAsciiStringLC, NULL, offsetof(W3DModelDrawModuleData, m_attachToDrawableBone) }, - { "IgnoreConditionStates", ModelConditionFlags::parseFromINI, NULL, offsetof(W3DModelDrawModuleData, m_ignoreConditionStates) }, - { 0, 0, 0, 0 } + { "TrackMarks", parseAsciiStringLC, nullptr, offsetof(W3DModelDrawModuleData, m_trackFile) }, + { "ExtraPublicBone", INI::parseAsciiStringVectorAppend, nullptr, offsetof(W3DModelDrawModuleData, m_extraPublicBones) }, + { "AttachToBoneInAnotherModule", parseAsciiStringLC, nullptr, offsetof(W3DModelDrawModuleData, m_attachToDrawableBone) }, + { "IgnoreConditionStates", ModelConditionFlags::parseFromINI, nullptr, offsetof(W3DModelDrawModuleData, m_ignoreConditionStates) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -1264,7 +1264,7 @@ static void parseShowHideSubObject(INI* ini, void *instance, void *store, const { if (stricmp(it->subObjName.str(), subObjName.str()) == 0) { - it->hide = (userData != NULL); + it->hide = (userData != nullptr); found = true; } } @@ -1273,7 +1273,7 @@ static void parseShowHideSubObject(INI* ini, void *instance, void *store, const { ModelConditionInfo::HideShowSubObjInfo info; info.subObjName = subObjName; - info.hide = (userData != NULL); + info.hide = (userData != nullptr); vec->push_back(info); } subObjName = ini->getNextAsciiString(); @@ -1330,7 +1330,7 @@ static void parseParticleSysBone(INI* ini, void *instance, void * store, const v ParticleSysBoneInfo info; info.boneName = ini->getNextAsciiString(); info.boneName.toLower(); - ini->parseParticleSystemTemplate(ini, instance, &(info.particleSystemTemplate), NULL); + ini->parseParticleSystemTemplate(ini, instance, &(info.particleSystemTemplate), nullptr); ModelConditionInfo *self = (ModelConditionInfo *)instance; self->m_particleSysBones.push_back(info); } @@ -1394,31 +1394,31 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void { static const FieldParse myFieldParse[] = { - { "Model", parseAsciiStringLC, NULL, offsetof(ModelConditionInfo, m_modelName) }, - { "Turret", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretAngleNameKey) }, - { "TurretArtAngle", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtAngle) }, - { "TurretPitch", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretPitchNameKey) }, - { "TurretArtPitch", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtPitch) }, - { "AltTurret", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretAngleNameKey) }, - { "AltTurretArtAngle", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtAngle) }, - { "AltTurretPitch", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretPitchNameKey) }, - { "AltTurretArtPitch", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtPitch) }, - { "ShowSubObject", parseShowHideSubObject, (void*)0, offsetof(ModelConditionInfo, m_hideShowVec) }, + { "Model", parseAsciiStringLC, nullptr, offsetof(ModelConditionInfo, m_modelName) }, + { "Turret", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretAngleNameKey) }, + { "TurretArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtAngle) }, + { "TurretPitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretPitchNameKey) }, + { "TurretArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtPitch) }, + { "AltTurret", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretAngleNameKey) }, + { "AltTurretArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtAngle) }, + { "AltTurretPitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretPitchNameKey) }, + { "AltTurretArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtPitch) }, + { "ShowSubObject", parseShowHideSubObject, (void*)nullptr, offsetof(ModelConditionInfo, m_hideShowVec) }, { "HideSubObject", parseShowHideSubObject, (void*)1, offsetof(ModelConditionInfo, m_hideShowVec) }, - { "WeaponFireFXBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponFireFXBoneName[0]) }, - { "WeaponRecoilBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponRecoilBoneName[0]) }, - { "WeaponMuzzleFlash", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponMuzzleFlashName[0]) }, - { "WeaponLaunchBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponProjectileLaunchBoneName[0]) }, - { "WeaponHideShowBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponProjectileHideShowName[0]) }, + { "WeaponFireFXBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponFireFXBoneName[0]) }, + { "WeaponRecoilBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponRecoilBoneName[0]) }, + { "WeaponMuzzleFlash", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponMuzzleFlashName[0]) }, + { "WeaponLaunchBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponProjectileLaunchBoneName[0]) }, + { "WeaponHideShowBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponProjectileHideShowName[0]) }, { "Animation", parseAnimation, (void*)ANIM_NORMAL, offsetof(ModelConditionInfo, m_animations) }, { "IdleAnimation", parseAnimation, (void*)ANIM_IDLE, offsetof(ModelConditionInfo, m_animations) }, { "AnimationMode", INI::parseIndexList, TheAnimModeNames, offsetof(ModelConditionInfo, m_mode) }, - { "TransitionKey", parseLowercaseNameKey, NULL, offsetof(ModelConditionInfo, m_transitionKey) }, - { "WaitForStateToFinishIfPossible", parseLowercaseNameKey, NULL, offsetof(ModelConditionInfo, m_allowToFinishKey) }, + { "TransitionKey", parseLowercaseNameKey, nullptr, offsetof(ModelConditionInfo, m_transitionKey) }, + { "WaitForStateToFinishIfPossible", parseLowercaseNameKey, nullptr, offsetof(ModelConditionInfo, m_allowToFinishKey) }, { "Flags", INI::parseBitString32, ACBitsNames, offsetof(ModelConditionInfo, m_flags) }, - { "ParticleSysBone", parseParticleSysBone, NULL, 0 }, - { "AnimationSpeedFactorRange", parseRealRange, NULL, 0 }, - { 0, 0, 0, 0 } + { "ParticleSysBone", parseParticleSysBone, nullptr, 0 }, + { "AnimationSpeedFactorRange", parseRealRange, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ModelConditionInfo info; @@ -1519,7 +1519,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void prevState.m_description.concat("\nAKA: "); prevState.m_description.concat(description); #else - conditionsYes.parse(ini, NULL); + conditionsYes.parse(ini, nullptr); #endif if (conditionsYes.anyIntersectionWith(self->m_ignoreConditionStates)) @@ -1573,7 +1573,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void info.m_description.concat("\n "); info.m_description.concat(description); #else - conditionsYes.parse(ini, NULL); + conditionsYes.parse(ini, nullptr); #endif if (conditionsYes.anyIntersectionWith(self->m_ignoreConditionStates)) @@ -1702,15 +1702,15 @@ W3DModelDraw::W3DModelDraw(Thing *thing, const ModuleData* moduleData) : DrawMod m_animationMode = RenderObjClass::ANIM_MODE_LOOP; m_hideHeadlights = true; m_pauseAnimation = false; - m_curState = NULL; + m_curState = nullptr; m_hexColor = 0; - m_renderObject = NULL; - m_shadow = NULL; + m_renderObject = nullptr; + m_shadow = nullptr; m_shadowEnabled = TRUE; - m_terrainDecal = NULL; - m_trackRenderObject = NULL; + m_terrainDecal = nullptr; + m_trackRenderObject = nullptr; m_whichAnimInCurState = -1; - m_nextState = NULL; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; for (i = 0; i < WEAPONSLOT_COUNT; ++i) { @@ -1733,7 +1733,7 @@ W3DModelDraw::W3DModelDraw(Thing *thing, const ModuleData* moduleData) : DrawMod } Drawable* draw = getDrawable(); - Object* obj = draw ? draw->getObject() : NULL; + Object* obj = draw ? draw->getObject() : nullptr; if (obj) { if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) @@ -1761,10 +1761,10 @@ W3DModelDraw::~W3DModelDraw(void) if (m_trackRenderObject && TheTerrainTracksRenderObjClassSystem) { TheTerrainTracksRenderObjClassSystem->unbindTrack(m_trackRenderObject); - m_trackRenderObject = NULL; + m_trackRenderObject = nullptr; } - nukeCurrentRender(NULL); + nukeCurrentRender(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1776,8 +1776,8 @@ void W3DModelDraw::doStartOrStopParticleSys() //for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); - if (sys != NULL) { - // this can be NULL + if (sys != nullptr) { + // this can be null if (hidden) { sys->stop(); } else { @@ -1814,7 +1814,7 @@ void W3DModelDraw::releaseShadows(void) ///< frees all shadow resources used by { if (m_shadow) m_shadow->release(); - m_shadow = NULL; + m_shadow = nullptr; } /** Create shadow resources if not already present. This is used to dynamically enable/disable shadows by the options screen*/ @@ -1823,7 +1823,7 @@ void W3DModelDraw::allocateShadows(void) const ThingTemplate *tmplate=getDrawable()->getTemplate(); //Check if we don't already have a shadow but need one for this type of model. - if (m_shadow == NULL && m_renderObject && TheW3DShadowManager && tmplate->getShadowType() != SHADOW_NONE) + if (m_shadow == nullptr && m_renderObject && TheW3DShadowManager && tmplate->getShadowType() != SHADOW_NONE) { Shadow::ShadowTypeInfo shadowInfo; strlcpy(shadowInfo.m_ShadowName, tmplate->getShadowTextureName().str(), ARRAY_SIZE(shadowInfo.m_ShadowName)); @@ -1867,7 +1867,7 @@ void W3DModelDraw::getRenderCost(RenderCost & rc) const #if defined(RTS_DEBUG) void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) const { - if (robj == NULL) return; + if (robj == nullptr) return; // recurse through sub-objects for (int i=0; iGet_Num_Sub_Objects(); i++) { @@ -1884,7 +1884,7 @@ void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) if (robj->Class_ID() == RenderObjClass::CLASSID_MESH) { MeshClass * mesh = (MeshClass*)robj; MeshModelClass * model = mesh->Peek_Model(); - if (model != NULL) + if (model != nullptr) { if (model->Get_Flag(MeshGeometryClass::SORT)) rc.addSortedMeshes(1); if (model->Get_Flag(MeshGeometryClass::SKIN)) @@ -1896,7 +1896,7 @@ void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) // collect bone stats. const HTreeClass * htree = robj->Get_HTree(); - if (htree != NULL) { + if (htree != nullptr) { rc.addBones(htree->Num_Pivots()); } } @@ -2023,12 +2023,12 @@ void W3DModelDraw::doDrawModule(const Matrix3D* transformMtx) if (isAnimationComplete(m_renderObject)) { - if (m_curState != NULL && m_nextState != NULL) + if (m_curState != nullptr && m_nextState != nullptr) { //DEBUG_LOG(("transition %s is complete",m_curState->m_description.str())); const ModelConditionInfo* nextState = m_nextState; UnsignedInt nextDuration = m_nextStateAnimLoopDuration; - m_nextState = NULL; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; setModelState(nextState); if (nextDuration != NO_NEXT_DURATION) @@ -2039,7 +2039,7 @@ void W3DModelDraw::doDrawModule(const Matrix3D* transformMtx) } if (m_renderObject && - m_curState != NULL && + m_curState != nullptr && m_whichAnimInCurState != -1) { if (m_curState->m_animations[m_whichAnimInCurState].isIdleAnim()) @@ -2082,15 +2082,15 @@ const ModelConditionInfo* W3DModelDraw::findTransitionForSig(TransitionSig sig) { return &(*it).second; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- Real W3DModelDraw::getCurrentAnimFraction() const { - if (m_curState != NULL + if (m_curState != nullptr && isAnyMaintainFrameFlagSet(m_curState->m_flags) - && m_renderObject != NULL + && m_renderObject != nullptr && m_renderObject->Class_ID() == RenderObjClass::CLASSID_HLOD) { float framenum, dummy; @@ -2174,7 +2174,7 @@ void W3DModelDraw::adjustAnimation(const ModelConditionInfo* prevState, Real pre m_renderObject->Set_Animation(animHandle, startFrame, m_curState->m_mode); REF_PTR_RELEASE(animHandle); - animHandle = NULL; + animHandle = nullptr; if (m_renderObject->Class_ID() == RenderObjClass::CLASSID_HLOD) { @@ -2217,7 +2217,7 @@ Bool W3DModelDraw::setCurAnimDurationInMsec(Real desiredDurationInMsec) //------------------------------------------------------------------------------------------------- Real W3DModelDraw::getCurAnimDistanceCovered() const { - if (m_curState != NULL && m_whichAnimInCurState >= 0) + if (m_curState != nullptr && m_whichAnimInCurState >= 0) { const W3DAnimationInfo& animInfo = m_curState->m_animations[m_whichAnimInCurState]; #if defined(RTS_DEBUG) @@ -2313,7 +2313,7 @@ void W3DModelDraw::doHideShowSubObjs(const std::vectorGet_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != nullptr) { subObj->Set_Hidden(it->hide); @@ -2350,9 +2350,9 @@ void W3DModelDraw::stopClientParticleSystems() //for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); - if (sys != NULL) + if (sys != nullptr) { - // this can be NULL + // this can be null sys->destroy(); } } @@ -2553,15 +2553,15 @@ void W3DModelDraw::recalcBonesForClientParticleSystems() if (m_needRecalcBoneParticleSystems) { const Drawable* drawable = getDrawable(); - if (drawable != NULL ) + if (drawable != nullptr ) { - if( m_curState != NULL && drawable->testDrawableStatus( DRAWABLE_STATUS_NO_STATE_PARTICLES ) == FALSE ) + if( m_curState != nullptr && drawable->testDrawableStatus( DRAWABLE_STATUS_NO_STATE_PARTICLES ) == FALSE ) { for (std::vector::const_iterator it = m_curState->m_particleSysBones.begin(); it != m_curState->m_particleSysBones.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(it->particleSystemTemplate); - if (sys != NULL) + if (sys != nullptr) { Coord3D pos; pos.zero(); @@ -2639,13 +2639,13 @@ void W3DModelDraw::recalcBonesForClientParticleSystems() Bool W3DModelDraw::updateBonesForClientParticleSystems() { const Drawable* drawable = getDrawable(); - if (drawable != NULL && m_curState != NULL && m_renderObject != NULL ) + if (drawable != nullptr && m_curState != nullptr && m_renderObject != nullptr ) { for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); Int boneIndex = (*it).boneIndex; - if ( (sys != NULL) && (boneIndex != 0) ) + if ( (sys != nullptr) && (boneIndex != 0) ) { Matrix3D originalTransform = m_renderObject->Get_Transform(); Matrix3D tmp(1); @@ -2684,7 +2684,7 @@ void W3DModelDraw::setTerrainDecal(TerrainDecalType type) if (m_terrainDecal) m_terrainDecal->release(); - m_terrainDecal = NULL; + m_terrainDecal = nullptr; if (type == TERRAIN_DECAL_NONE || type >= TERRAIN_DECAL_MAX) //turning off decals on this object. (or bad value.) @@ -2740,11 +2740,11 @@ void W3DModelDraw::nukeCurrentRender(Matrix3D* xform) // changing geometry, so we need to remove shadow if present if (m_shadow) m_shadow->release(); - m_shadow = NULL; + m_shadow = nullptr; if(m_terrainDecal) m_terrainDecal->release(); - m_terrainDecal = NULL; + m_terrainDecal = nullptr; // remove existing render object from the scene if (m_renderObject) @@ -2752,10 +2752,10 @@ void W3DModelDraw::nukeCurrentRender(Matrix3D* xform) // save the transform for the new model if (xform) *xform = m_renderObject->Get_Transform(); - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } else { @@ -2776,7 +2776,7 @@ void W3DModelDraw::hideGarrisonFlags(Bool hide) Int objIndex; RenderObjClass* subObj; - if ((subObj = m_renderObject->Get_Sub_Object_By_Name("POLE", &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name("POLE", &objIndex)) != nullptr) { subObj->Set_Hidden(hide); @@ -2867,8 +2867,8 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) DEBUG_LOG(("REQUEST switching to state %s for obj %s %d",newState->m_description.str(),getDrawable()->getObject()->getTemplate()->getName().str(),getDrawable()->getObject()->getID())); } #endif - const ModelConditionInfo* nextState = NULL; - if (m_curState != NULL && newState != NULL) + const ModelConditionInfo* nextState = nullptr; + if (m_curState != nullptr && newState != nullptr) { // if the requested state is the current state (and nothing is pending), // or if the requested state is pending, just punt. @@ -2889,8 +2889,8 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // -- curState is a real state, nextState is a real state without a wait-to-finish clause // -- should be impossible! - if ((m_curState == newState && m_nextState == NULL) || - (m_curState != NULL && m_nextState == newState)) + if ((m_curState == newState && m_nextState == nullptr) || + (m_curState != nullptr && m_nextState == newState)) { #ifdef DEBUG_OBJECT_ID_EXISTS if (getDrawable() && getDrawable()->getObject() && getDrawable()->getObject()->getID() == TheObjectIDToDebug) @@ -2926,7 +2926,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) { TransitionSig sig = buildTransitionSig(m_curState->m_transitionKey, newState->m_transitionKey); const ModelConditionInfo* transState = findTransitionForSig(sig); - if (transState != NULL) + if (transState != nullptr) { #ifdef DEBUG_OBJECT_ID_EXISTS if (getDrawable() && getDrawable()->getObject() && getDrawable()->getObject()->getID() == TheObjectIDToDebug) @@ -2960,7 +2960,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // note that different states might use the same model; for these, don't go thru the // expense of creating a new render-object. (exception: if color is changing, or subobjs are changing, // or a few other things...) - if (m_curState == NULL || + if (m_curState == nullptr || newState->m_modelName != m_curState->m_modelName || turretNamesDiffer(newState, m_curState) // srj sez: I'm not sure why we want to do the "hard stuff" if we have projectile bones; I think @@ -2976,7 +2976,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // create a new render object and set into drawable if (newState->m_modelName.isEmpty()) { - m_renderObject = NULL; + m_renderObject = nullptr; } else { @@ -3004,7 +3004,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) if (m_renderObject && TheGlobalData->m_makeTrackMarks && !m_trackRenderObject && - TheTerrainTracksRenderObjClassSystem != NULL && + TheTerrainTracksRenderObjClassSystem != nullptr && !getW3DModelDrawModuleData()->m_trackFile.isEmpty()) { m_trackRenderObject = TheTerrainTracksRenderObjClassSystem->bindTrack(m_renderObject, 1.0f*MAP_XY_FACTOR, getW3DModelDrawModuleData()->m_trackFile.str()); @@ -3026,7 +3026,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) shadowInfo.m_offsetX = tmplate->getShadowOffsetX(); shadowInfo.m_offsetY = tmplate->getShadowOffsetY(); - DEBUG_ASSERTCRASH(m_shadow == NULL, ("m_shadow is not NULL")); + DEBUG_ASSERTCRASH(m_shadow == nullptr, ("m_shadow is not null")); m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); if (m_shadow) { m_shadow->enableShadowInvisible(m_fullyObscuredByShroud); @@ -3082,7 +3082,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) } // add render object to our scene - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object(m_renderObject); // tie in our drawable as the user data pointer in the render object @@ -3171,10 +3171,10 @@ void W3DModelDraw::replaceIndicatorColor(Color color) { m_hexColor = newColor; - // set these to NULL to force a regen of everything in setModelState. + // set these to nullptr to force a regen of everything in setModelState. const ModelConditionInfo* tmp = m_curState; - m_curState = NULL; - m_nextState = NULL; + m_curState = nullptr; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; setModelState(tmp); } @@ -3246,7 +3246,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( //DUMPREAL(getDrawable()->getScale()); //BONEPOS_LOG(("validateStuffs() from within W3DModelDraw::getProjectileLaunchOffset()")); //BONEPOS_DUMPREAL(getDrawable()->getScale()); - stateToUse->validateStuff(NULL, getDrawable()->getScale(), d->m_extraPublicBones); + stateToUse->validateStuff(nullptr, getDrawable()->getScale(), d->m_extraPublicBones); DEBUG_ASSERTCRASH(stateToUse->m_transitionSig == NO_TRANSITION, ("It is never legal to getProjectileLaunchOffset from a Transition state (they vary on a per-client basis)... however, we can fix this (see srj)\n")); @@ -3260,7 +3260,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( // must use pristine bone here since the result is used by logic Matrix3D pivot; if (d->m_attachToDrawableBone.isNotEmpty() && - getDrawable()->getPristineBonePositions( d->m_attachToDrawableBone.str(), 0, NULL, &pivot, 1 ) == 1) + getDrawable()->getPristineBonePositions( d->m_attachToDrawableBone.str(), 0, nullptr, &pivot, 1 ) == 1) { pivot.Pre_Rotate_Z(getDrawable()->getOrientation()); techOffset.x = pivot.Get_X_Translation(); @@ -3276,7 +3276,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( // Can't find the launch pos, but they might still want the other info they asked for CRCDEBUG_LOG(("empty wbvec")); //BONEPOS_LOG(("empty wbvec")); - launchPos = NULL; + launchPos = nullptr; } else { @@ -3346,7 +3346,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( #endif } } - return launchPos != NULL;// return if LaunchPos is valid or not + return launchPos != nullptr;// return if LaunchPos is valid or not } //------------------------------------------------------------------------------------------------- @@ -3373,7 +3373,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( // { // CRCDEBUG_LOG(("W3DModelDraw::getPristineBonePositionsForConditionState() - state = '%s'", // stateToUse->getDescription().str())); -// //CRCDEBUG_LOG(("renderObject == NULL: %d", (stateToUse==m_curState)?(m_renderObject == NULL):1)); +// //CRCDEBUG_LOG(("renderObject == nullptr: %d", (stateToUse==m_curState)?(m_renderObject == nullptr):1)); // } //BONEPOS_LOG(("validateStuff() from within W3DModelDraw::getPristineBonePositionsForConditionState()")); @@ -3382,7 +3382,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( stateToUse->validateStuff( // if the state is the current state, pass in the current render object // so that we don't have to re-create it! - stateToUse == m_curState ? m_renderObject : NULL, + stateToUse == m_curState ? m_renderObject : nullptr, getDrawable()->getScale(), getW3DModelDrawModuleData()->m_extraPublicBones); @@ -3392,7 +3392,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( if (maxBones > MAX_BONE_GET) maxBones = MAX_BONE_GET; - if (transforms == NULL) + if (transforms == nullptr) transforms = tmpMtx; Int posCount = 0; @@ -3412,7 +3412,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( *c = tolower(*c); } - const Matrix3D* mtx = stateToUse->findPristineBone(NAMEKEY(buffer), NULL); + const Matrix3D* mtx = stateToUse->findPristineBone(NAMEKEY(buffer), nullptr); if (mtx) { transforms[posCount] = *mtx; @@ -3531,7 +3531,7 @@ Int W3DModelDraw::getCurrentBonePositions( if (maxBones > MAX_BONE_GET) maxBones = MAX_BONE_GET; - if (transforms == NULL) + if (transforms == nullptr) transforms = tmpMtx; if( !m_renderObject ) @@ -3673,7 +3673,7 @@ Bool W3DModelDraw::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelTo if (info.m_fxBone && m_renderObject) { const Object *logicObject = getDrawable()->getObject();// This is slow, so store it - if( ! m_renderObject->Is_Hidden() || (logicObject == NULL) ) + if( ! m_renderObject->Is_Hidden() || (logicObject == nullptr) ) { // I can ask the drawable's bone position if I am not hidden (if I have no object I have no choice) Matrix3D mtx = m_renderObject->Get_Bone_Transform(info.m_fxBone); @@ -3725,8 +3725,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) { // this is never defined -- srj #ifdef NO_DURATIONS_ON_TRANSITIONS - if (m_curState != NULL && m_curState->m_transition != NO_TRANSITION && - m_nextState != NULL && m_nextState->m_transition == NO_TRANSITION) + if (m_curState != nullptr && m_curState->m_transition != NO_TRANSITION && + m_nextState != nullptr && m_nextState->m_transition == NO_TRANSITION) { DEBUG_LOG(("deferring pending duration of %d frames",numFrames)); m_nextStateAnimLoopDuration = numFrames; @@ -3734,7 +3734,7 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) } m_nextStateAnimLoopDuration = NO_NEXT_DURATION; - DEBUG_ASSERTCRASH(m_curState != NULL && m_curState->m_transition == NO_TRANSITION, ("Hmm, setAnimationLoopDuration on a transition state is probably not right... see srj")); + DEBUG_ASSERTCRASH(m_curState != nullptr && m_curState->m_transition == NO_TRANSITION, ("Hmm, setAnimationLoopDuration on a transition state is probably not right... see srj")); #else m_nextStateAnimLoopDuration = NO_NEXT_DURATION; #endif @@ -3750,8 +3750,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { - if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && !m_curState->m_animations.empty() && - m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && !m_nextState->m_animations.empty()) + if (m_curState != nullptr && m_curState->m_transitionSig != NO_TRANSITION && m_curState->m_animations.size() > 0 && + m_nextState != nullptr && m_nextState->m_transitionSig == NO_TRANSITION && m_nextState->m_animations.size() > 0) { // we have a transition; split up the time suitably. // note that this is just a guess, and assumes that the states @@ -3815,7 +3815,7 @@ void W3DModelDraw::rebuildWeaponRecoilInfo(const ModelConditionInfo* state) { Int wslot; - if (state == NULL) + if (state == nullptr) { for (wslot = 0; wslot < WEAPONSLOT_COUNT; ++wslot) { @@ -3927,7 +3927,7 @@ void W3DModelDraw::updateSubObjects() Int objIndex; RenderObjClass* subObj; - if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != nullptr) { subObj->Set_Hidden(it->hide); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index a89398e22f5..5546a77dc0e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -29,6 +29,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// + #include "Common/Xfer.h" #include "GameClient/Drawable.h" #include "GameLogic/Object.h" @@ -52,7 +53,7 @@ void W3DOverlordTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp index d05f9103dfd..b6efb3babe4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp @@ -29,6 +29,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include + #include "Common/STLTypedefs.h" #include "Common/Thing.h" #include "Common/Xfer.h" @@ -46,7 +47,7 @@ //------------------------------------------------------------------------------------------------- W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) { - W3DDynamicLight *light = NULL; + W3DDynamicLight *light = nullptr; // get me a dynamic light from the scene light = W3DDisplay::m_3DScene->getADynamicLight(); @@ -74,7 +75,7 @@ W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) //------------------------------------------------------------------------------------------------- W3DPoliceCarDraw::W3DPoliceCarDraw( Thing *thing, const ModuleData* moduleData ) : W3DTruckDraw( thing, moduleData ) { - m_light = NULL; + m_light = nullptr; m_curFrame = GameClientRandomValueReal(0, 10 ); } @@ -91,7 +92,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void ) m_light->setFrameFade(0, 5); m_light->setDecayRange(); m_light->setDecayColor(); - m_light = NULL; + m_light = nullptr; } } @@ -105,7 +106,7 @@ void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx) // get pointers to our render objects that we'll need RenderObjClass* policeCarRenderObj = getRenderObject(); - if( policeCarRenderObj == NULL ) + if( policeCarRenderObj == nullptr ) return; HAnimClass *anim = policeCarRenderObj->Peek_Animation(); @@ -139,7 +140,7 @@ void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx) } // make us a light if we don't already have one - if( m_light == NULL ) + if( m_light == nullptr ) m_light = createDynamicLight(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp index 44a69928ea0..8f699cc7c18 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp @@ -59,12 +59,12 @@ void W3DProjectileStreamDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_textureName) }, - { "Width", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_width) }, - { "TileFactor", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_tileFactor) }, - { "ScrollRate", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_scrollRate) }, - { "MaxSegments", INI::parseInt, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_maxSegments) }, - { 0, 0, 0, 0 } + { "Texture", INI::parseAsciiString, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_textureName) }, + { "Width", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_width) }, + { "TileFactor", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_tileFactor) }, + { "ScrollRate", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_scrollRate) }, + { "MaxSegments", INI::parseInt, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_maxSegments) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -93,7 +93,7 @@ W3DProjectileStreamDraw::W3DProjectileStreamDraw( Thing *thing, const ModuleData const W3DProjectileStreamDrawModuleData* d = getW3DProjectileStreamDrawModuleData(); m_texture = WW3DAssetManager::Get_Instance()->Get_Texture( d->m_textureName.str() ); for( Int index = 0; index < MAX_PROJECTILE_STREAM; index++ ) - m_allLines[index] = NULL; + m_allLines[index] = nullptr; m_linesValid = 0; } @@ -126,7 +126,7 @@ void W3DProjectileStreamDraw::doDrawModule(const Matrix3D* ) { // get object from logic Object *me = getDrawable()->getObject(); - if (me == NULL) + if (me == nullptr) return; static NameKeyType key_ProjectileStreamUpdate = NAMEKEY("ProjectileStreamUpdate"); @@ -186,7 +186,7 @@ void W3DProjectileStreamDraw::doDrawModule(const Matrix3D* ) W3DDisplay::m_3DScene->Remove_Render_Object( deadLine ); REF_PTR_RELEASE( deadLine ); - m_allLines[lineIndex] = NULL; + m_allLines[lineIndex] = nullptr; m_linesValid--; } } @@ -195,7 +195,7 @@ void W3DProjectileStreamDraw::makeOrUpdateLine( Vector3 *points, UnsignedInt poi { Bool newLine = FALSE; - if( m_allLines[lineIndex] == NULL ) + if( m_allLines[lineIndex] == nullptr ) { //Need a new one if this is blank, otherwise I'll reset the existing one m_allLines[lineIndex] = NEW SegmentedLineClass; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index e809aac0331..620b4e8d08e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -53,9 +53,9 @@ void W3DScienceModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RequiredScience", INI::parseScience, NULL, offsetof(W3DScienceModelDrawModuleData, m_requiredScience) }, + { "RequiredScience", INI::parseScience, nullptr, offsetof(W3DScienceModelDrawModuleData, m_requiredScience) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp index f9b5dbd254c..9649d1b80fa 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp @@ -48,9 +48,9 @@ void W3DSupplyDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "SupplyBonePrefix", INI::parseAsciiString, NULL, offsetof(W3DSupplyDrawModuleData, m_supplyBonePrefix) }, + { "SupplyBonePrefix", INI::parseAsciiString, nullptr, offsetof(W3DSupplyDrawModuleData, m_supplyBonePrefix) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -75,7 +75,7 @@ void W3DSupplyDraw::updateDrawModuleSupplyStatus( Int maxSupply, Int currentSupp AsciiString boneName = getW3DSupplyDrawModuleData()->m_supplyBonePrefix; if( m_totalBones == -1 ) { - m_totalBones = getDrawable()->getPristineBonePositions( boneName.str(), 1, NULL, NULL, INT_MAX );// The last arg is to guard the size of the arrays. I am not passing any in, I am just counting bones. + m_totalBones = getDrawable()->getPristineBonePositions( boneName.str(), 1, nullptr, nullptr, INT_MAX );// The last arg is to guard the size of the arrays. I am not passing any in, I am just counting bones. m_lastNumberShown = m_totalBones; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index efdc37d46a2..55aa19f567c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include #include + #include "Common/Thing.h" #include "Common/ThingFactory.h" #include "Common/GameAudio.h" @@ -72,12 +73,12 @@ void W3DTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TreadDebrisLeft", INI::parseAsciiString, NULL, offsetof(W3DTankDrawModuleData, m_treadDebrisNameLeft) }, - { "TreadDebrisRight", INI::parseAsciiString, NULL, offsetof(W3DTankDrawModuleData, m_treadDebrisNameRight) }, - { "TreadAnimationRate", INI::parseVelocityReal, NULL, offsetof(W3DTankDrawModuleData, m_treadAnimationRate) }, - { "TreadPivotSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankDrawModuleData, m_treadPivotSpeedFraction) }, - { "TreadDriveSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankDrawModuleData, m_treadDriveSpeedFraction) }, - { 0, 0, 0, 0 } + { "TreadDebrisLeft", INI::parseAsciiString, nullptr, offsetof(W3DTankDrawModuleData, m_treadDebrisNameLeft) }, + { "TreadDebrisRight", INI::parseAsciiString, nullptr, offsetof(W3DTankDrawModuleData, m_treadDebrisNameRight) }, + { "TreadAnimationRate", INI::parseVelocityReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadAnimationRate) }, + { "TreadPivotSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadPivotSpeedFraction) }, + { "TreadDriveSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadDriveSpeedFraction) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -85,13 +86,13 @@ void W3DTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTankDraw::W3DTankDraw( Thing *thing, const ModuleData* moduleData ) -: W3DModelDraw( thing, moduleData ),m_prevRenderObj(NULL), m_treadDebrisLeft(NULL), m_treadDebrisRight(NULL) +: W3DModelDraw( thing, moduleData ),m_prevRenderObj(nullptr), m_treadDebrisLeft(nullptr), m_treadDebrisRight(nullptr) { - m_treadDebrisLeft = NULL; - m_treadDebrisRight = NULL; + m_treadDebrisLeft = nullptr; + m_treadDebrisRight = nullptr; for (Int i=0; iattachToObject(NULL); + m_treadDebrisLeft->attachToObject(nullptr); m_treadDebrisLeft->destroy(); - m_treadDebrisLeft = NULL; + m_treadDebrisLeft = nullptr; } if (m_treadDebrisRight) { - m_treadDebrisRight->attachToObject(NULL); + m_treadDebrisRight->attachToObject(nullptr); m_treadDebrisRight->destroy(); - m_treadDebrisRight = NULL; + m_treadDebrisRight = nullptr; } } @@ -261,7 +262,7 @@ void W3DTankDraw::updateTreadObjects(void) const char *meshName; //Check if subobject name starts with "TREADS". if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH && subObj->Get_Name() - && ( (meshName=strchr(subObj->Get_Name(),'.') ) != 0 && *(meshName++)) + && ( (meshName=strchr(subObj->Get_Name(),'.') ) != nullptr && *(meshName++)) &&_strnicmp(meshName,"TREADS", 6) == 0) { //check if sub-object has the correct material to do texture scrolling. MaterialInfoClass *mat=subObj->Get_Material_Info(); @@ -319,19 +320,19 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) const Real DEBRIS_THRESHOLD = 0.00001f; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { updateTreadObjects(); } // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 433b3af4c46..eb2ab2a924b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -70,25 +70,25 @@ void W3DTankTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Dust", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_dustEffectName) }, - { "DirtSpray", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_dirtEffectName) }, - { "PowerslideSpray", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideEffectName) }, - { "LeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_frontLeftTireBoneName) }, - { "RightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_frontRightTireBoneName) }, - { "LeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_rearLeftTireBoneName) }, - { "RightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_rearRightTireBoneName) }, - { "MidLeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midFrontLeftTireBoneName) }, - { "MidRightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midFrontRightTireBoneName) }, - { "MidLeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearLeftTireBoneName) }, - { "MidRightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearRightTireBoneName) }, - { "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_rotationSpeedMultiplier) }, - { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) }, - { "TreadDebrisLeft", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameLeft) }, - { "TreadDebrisRight", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameRight) }, - { "TreadAnimationRate", INI::parseVelocityReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadAnimationRate) }, - { "TreadPivotSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadPivotSpeedFraction) }, - { "TreadDriveSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDriveSpeedFraction) }, - { 0, 0, 0, 0 } + { "Dust", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_dustEffectName) }, + { "DirtSpray", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_dirtEffectName) }, + { "PowerslideSpray", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_powerslideEffectName) }, + { "LeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_frontLeftTireBoneName) }, + { "RightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_frontRightTireBoneName) }, + { "LeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rearLeftTireBoneName) }, + { "RightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rearRightTireBoneName) }, + { "MidLeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midFrontLeftTireBoneName) }, + { "MidRightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midFrontRightTireBoneName) }, + { "MidLeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midRearLeftTireBoneName) }, + { "MidRightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midRearRightTireBoneName) }, + { "TireRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rotationSpeedMultiplier) }, + { "PowerslideRotationAddition", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) }, + { "TreadDebrisLeft", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameLeft) }, + { "TreadDebrisRight", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameRight) }, + { "TreadAnimationRate", INI::parseVelocityReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadAnimationRate) }, + { "TreadPivotSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadPivotSpeedFraction) }, + { "TreadDriveSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDriveSpeedFraction) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -96,21 +96,21 @@ void W3DTankTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTankTruckDraw::W3DTankTruckDraw( Thing *thing, const ModuleData* moduleData ) : W3DModelDraw( thing, moduleData ), -m_dirtEffect(NULL), m_dustEffect(NULL), m_powerslideEffect(NULL), m_effectsInitialized(false), +m_dirtEffect(nullptr), m_dustEffect(nullptr), m_powerslideEffect(nullptr), m_effectsInitialized(false), m_wasAirborne(false), m_isPowersliding(false), m_frontWheelRotation(0), m_rearWheelRotation(0), m_frontRightTireBone(0), m_frontLeftTireBone(0), m_rearLeftTireBone(0),m_rearRightTireBone(0), -m_prevRenderObj(NULL) +m_prevRenderObj(nullptr) { //Truck Data m_landingSound = *(thing->getTemplate()->getPerUnitSound("TruckLandingSound")); m_powerslideSound = *(thing->getTemplate()->getPerUnitSound("TruckPowerslideSound")); //Tank data - m_treadDebrisLeft = NULL; - m_treadDebrisRight = NULL; + m_treadDebrisLeft = nullptr; + m_treadDebrisRight = nullptr; for (Int i=0; iattachToObject(NULL); + m_dustEffect->attachToObject(nullptr); m_dustEffect->destroy(); - m_dustEffect = NULL; + m_dustEffect = nullptr; } if (m_dirtEffect) { - m_dirtEffect->attachToObject(NULL); + m_dirtEffect->attachToObject(nullptr); m_dirtEffect->destroy(); - m_dirtEffect = NULL; + m_dirtEffect = nullptr; } if (m_powerslideEffect) { - m_powerslideEffect->attachToObject(NULL); + m_powerslideEffect->attachToObject(nullptr); m_powerslideEffect->destroy(); - m_powerslideEffect = NULL; + m_powerslideEffect = nullptr; } } @@ -446,7 +446,7 @@ void W3DTankTruckDraw::updateTreadObjects(void) const char *meshName; //Check if subobject name starts with "TREADS". if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH && subObj->Get_Name() - && ( (meshName=strchr(subObj->Get_Name(),'.') ) != 0 && *(meshName++)) + && ( (meshName=strchr(subObj->Get_Name(),'.') ) != nullptr && *(meshName++)) &&_strnicmp(meshName,"TREADS", 6) == 0) { //check if sub-object has the correct material to do texture scrolling. MaterialInfoClass *mat=subObj->Get_Material_Info(); @@ -491,7 +491,7 @@ void W3DTankTruckDraw::onRenderObjRecreated(void) //DEBUG_LOG(("Old obj %x, newObj %x, new bones %d, old bones %d", // m_prevRenderObj, getRenderObject(), getRenderObject()->Get_Num_Bones(), // m_prevNumBones)); - m_prevRenderObj = NULL; + m_prevRenderObj = nullptr; m_frontLeftTireBone = 0; m_frontRightTireBone = 0; m_rearLeftTireBone = 0; @@ -524,17 +524,17 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Real SIZE_CAP = 2.0f; // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { updateBones(); updateTreadObjects(); } // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp index c56ae62d0af..0552e6ce206 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp @@ -59,7 +59,7 @@ W3DTracerDraw::W3DTracerDraw( Thing *thing, const ModuleData* moduleData ) : Dra m_color.green = 0.8f; m_color.blue = 0.7f; m_speedInDistPerFrame = 1.0f; - m_theTracer = NULL; + m_theTracer = nullptr; } @@ -111,7 +111,7 @@ void W3DTracerDraw::doDrawModule(const Matrix3D* transformMtx) { // create tracer - if( m_theTracer == NULL ) + if( m_theTracer == nullptr ) { Vector3 start( 0.0f, 0.0f, 0.0f ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 0baa25aa28a..9ae19534433 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -67,30 +67,30 @@ void W3DTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Dust", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_dustEffectName) }, - { "DirtSpray", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_dirtEffectName) }, - { "PowerslideSpray", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideEffectName) }, - - { "LeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_frontLeftTireBoneName) }, - { "RightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_frontRightTireBoneName) }, - { "LeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_rearLeftTireBoneName) }, - { "RightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_rearRightTireBoneName) }, - { "MidLeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midFrontLeftTireBoneName) }, - { "MidRightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midFrontRightTireBoneName) }, - { "MidLeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midRearLeftTireBoneName) }, - { "MidRightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midRearRightTireBoneName) }, - { "MidLeftMidTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midMidLeftTireBoneName) }, - { "MidRightMidTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midMidRightTireBoneName) }, - - { "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_rotationSpeedMultiplier) }, - { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) }, - { "CabBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_cabBoneName) }, - { "TrailerBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_trailerBoneName) }, - { "CabRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_cabRotationFactor) }, - { "TrailerRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_trailerRotationFactor) }, - { "RotationDamping", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_rotationDampingFactor) }, - - { 0, 0, 0, 0 } + { "Dust", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_dustEffectName) }, + { "DirtSpray", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_dirtEffectName) }, + { "PowerslideSpray", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_powerslideEffectName) }, + + { "LeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_frontLeftTireBoneName) }, + { "RightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_frontRightTireBoneName) }, + { "LeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_rearLeftTireBoneName) }, + { "RightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_rearRightTireBoneName) }, + { "MidLeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midFrontLeftTireBoneName) }, + { "MidRightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midFrontRightTireBoneName) }, + { "MidLeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midRearLeftTireBoneName) }, + { "MidRightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midRearRightTireBoneName) }, + { "MidLeftMidTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midMidLeftTireBoneName) }, + { "MidRightMidTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midMidRightTireBoneName) }, + + { "TireRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_rotationSpeedMultiplier) }, + { "PowerslideRotationAddition", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) }, + { "CabBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_cabBoneName) }, + { "TrailerBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_trailerBoneName) }, + { "CabRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_cabRotationFactor) }, + { "TrailerRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_trailerRotationFactor) }, + { "RotationDamping", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_rotationDampingFactor) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -98,12 +98,12 @@ void W3DTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTruckDraw::W3DTruckDraw( Thing *thing, const ModuleData* moduleData ) : W3DModelDraw( thing, moduleData ), -m_dirtEffect(NULL), m_dustEffect(NULL), m_powerslideEffect(NULL), m_effectsInitialized(false), +m_dirtEffect(nullptr), m_dustEffect(nullptr), m_powerslideEffect(nullptr), m_effectsInitialized(false), m_wasAirborne(false), m_isPowersliding(false), m_frontWheelRotation(0), m_rearWheelRotation(0), m_midFrontWheelRotation(0), m_midRearWheelRotation(0), m_frontRightTireBone(0), m_frontLeftTireBone(0), m_rearLeftTireBone(0),m_rearRightTireBone(0), m_midFrontRightTireBone(0), m_midFrontLeftTireBone(0), m_midRearLeftTireBone(0),m_midRearRightTireBone(0), -m_midMidRightTireBone(0), m_midMidLeftTireBone(0), m_prevRenderObj(NULL) +m_midMidRightTireBone(0), m_midMidLeftTireBone(0), m_prevRenderObj(nullptr) { const AudioEventRTS * event; event = thing->getTemplate()->getPerUnitSound("TruckLandingSound"); @@ -129,21 +129,21 @@ void W3DTruckDraw::tossEmitters() { if (m_dustEffect) { - m_dustEffect->attachToObject(NULL); + m_dustEffect->attachToObject(nullptr); m_dustEffect->destroy(); - m_dustEffect = NULL; + m_dustEffect = nullptr; } if (m_dirtEffect) { - m_dirtEffect->attachToObject(NULL); + m_dirtEffect->attachToObject(nullptr); m_dirtEffect->destroy(); - m_dirtEffect = NULL; + m_dirtEffect = nullptr; } if (m_powerslideEffect) { - m_powerslideEffect->attachToObject(NULL); + m_powerslideEffect->attachToObject(nullptr); m_powerslideEffect->destroy(); - m_powerslideEffect = NULL; + m_powerslideEffect = nullptr; } } @@ -364,7 +364,7 @@ void W3DTruckDraw::onRenderObjRecreated(void) //DEBUG_LOG(("Old obj %x, newObj %x, new bones %d, old bones %d", // m_prevRenderObj, getRenderObject(), getRenderObject()->Get_Num_Bones(), // m_prevNumBones)); - m_prevRenderObj = NULL; + m_prevRenderObj = nullptr; m_frontLeftTireBone = 0; m_frontRightTireBone = 0; m_rearLeftTireBone = 0; @@ -390,7 +390,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) return; const W3DTruckDrawModuleData *moduleData = getW3DTruckDrawModuleData(); - if (moduleData==NULL) + if (moduleData==nullptr) return; // shouldn't ever happen. // TheSuperHackers @tweak Update the draw on every WW Sync only. @@ -402,10 +402,10 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Real SIZE_CAP = 2.0f; // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { DEBUG_LOG(("W3DTruckDraw::doDrawModule - shouldn't update bones. jba")); updateBones(); @@ -413,7 +413,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index 1a99fe9ac16..fa6e7ba0d33 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -26,6 +26,7 @@ // Author: Colin Day // Desc: Control bar callbacks /////////////////////////////////////////////////////////////////////////////////////////////////// + #include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/Radar.h" @@ -118,16 +119,16 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) //static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); //static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerPointG"); - //const Image *endBar = NULL; - //const Image *beginBar = NULL; - const Image *centerBar = NULL; + //const Image *endBar = nullptr; + //const Image *beginBar = nullptr; + const Image *centerBar = nullptr; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; Energy *energy = player->getEnergy(); - if( energy == NULL ) + if( energy == nullptr ) return; Int consumption = energy->getConsumption(); @@ -277,16 +278,16 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreen"); - const Image *endBar = NULL; - const Image *beginBar = NULL; - const Image *centerBar = NULL; + const Image *endBar = nullptr; + const Image *beginBar = nullptr; + const Image *centerBar = nullptr; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; Energy *energy = player->getEnergy(); - if( energy == NULL ) + if( energy == nullptr ) return; Int consumption = energy->getConsumption(); @@ -600,7 +601,7 @@ void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) void W3DCommandBarTopDraw( GameWindow *window, WinInstanceData *instData ) { - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(!win || win->winIsHidden() || !ThePlayerList->getLocalPlayer()->isPlayerActive()) return; @@ -625,12 +626,12 @@ void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData if(!man) return; static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!win) { return; - //win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); } TheControlBar->getBackgroundMarkerPos(&basePos.x, &basePos.y); ICoord2D pos, offset; @@ -650,12 +651,12 @@ void W3DCommandBarForegroundDraw( GameWindow *window, WinInstanceData *instData return; static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!win) { return; - //win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); } TheControlBar->getForegroundMarkerPos(&basePos.x, &basePos.y); ICoord2D pos, offset; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 6579e5d5955..97a88b6295b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -211,7 +211,7 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) - advancePosition(NULL, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); + advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); //TheDisplay->drawLine(); @@ -275,7 +275,7 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) - advancePosition(NULL, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); + advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); //TheDisplay->drawLine(); @@ -419,7 +419,7 @@ void W3DMainMenuMapBorder( GameWindow *window, WinInstanceData *instData ) Int size = 20; Int halfSize = size / 2; - const Image *image = NULL; + const Image *image = nullptr; // Draw Horizontal Lines // All border pieces are based on a 10 pixel offset from the centerline @@ -635,8 +635,8 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends @@ -786,7 +786,7 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -944,7 +944,7 @@ void W3DMainMenuInit( WindowLayout *layout, void *userData ) if (buttonChina) buttonChina->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - GameWindow *win = NULL; + GameWindow *win = nullptr; win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonMultiBack")); if(win) win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp index f321f803e6c..981e8ac0eea 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp @@ -74,7 +74,7 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -251,7 +251,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) { Int checkOffsetFromLeft; - const Image *boxImage = NULL;//*backgroundImage = NULL, + const Image *boxImage = nullptr;//*backgroundImage = nullptr, ICoord2D origin, start, end, size; // get window position and size diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index b58f44730bb..b5a72407fa6 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -371,10 +371,10 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImageLeft == NULL || rightImageLeft == NULL || - centerImageLeft == NULL || smallCenterImageLeft == NULL || - leftImageRight == NULL || rightImageRight == NULL || - centerImageRight == NULL || smallCenterImageRight == NULL ) + if( leftImageLeft == nullptr || rightImageLeft == nullptr || + centerImageLeft == nullptr || smallCenterImageLeft == nullptr || + leftImageRight == nullptr || rightImageRight == nullptr || + centerImageRight == nullptr || smallCenterImageRight == nullptr ) return; // get image sizes for the ends diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp index e8a97d81054..9baf04b4fd8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp @@ -283,10 +283,10 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat } // sanity - if( backLeft == NULL || backRight == NULL || - backCenter == NULL || - barRight == NULL) - // backSmallCenter == NULL ||barLeft == NULL ||barCenter == NULL || barSmallCenter == NULL ) + if( backLeft == nullptr || backRight == nullptr || + backCenter == nullptr || + barRight == nullptr) + // backSmallCenter == nullptr ||barLeft == nullptr ||barCenter == nullptr || barSmallCenter == nullptr ) return; // get image sizes for the ends diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp index fb5f3390dc8..5c434203bff 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp @@ -86,7 +86,7 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -273,7 +273,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) void W3DGadgetPushButtonImageDraw( GameWindow *window, WinInstanceData *instData ) { - // if we return NULL then we'll call the one picture drawing code, if we return a value + // if we return nullptr then we'll call the one picture drawing code, if we return a value // then we'll call the 3 picture drawing code if( GadgetButtonGetMiddleEnabledImage( window ) ) { @@ -304,7 +304,7 @@ void W3DGadgetPushButtonImageDraw( GameWindow *window, void W3DGadgetPushButtonImageDrawOne( GameWindow *window, WinInstanceData *instData ) { - const Image *image = NULL; + const Image *image = nullptr; ICoord2D size, start, end; // @@ -444,7 +444,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, if( BitIsSet( window->winGetStatus(), WIN_STATUS_USE_OVERLAY_STATES ) ) { - image = NULL; + image = nullptr; static const Image *pushedOverlayIcon = TheMappedImageCollection->findImageByName( "Cameo_push" ); static const Image *hilitedOverlayIcon = TheMappedImageCollection->findImageByName( "Cameo_hilited" ); if( pushedOverlayIcon && hilitedOverlayIcon ) @@ -555,8 +555,8 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp index e13bf6fa405..fe463b8ecf4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp @@ -74,7 +74,7 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -314,8 +314,8 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImage == NULL || centerImage == NULL || - rightImage == NULL ) + if( leftImage == nullptr || centerImage == nullptr || + rightImage == nullptr ) return; // get image sizes for the ends diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index 84c4e9ff1d8..f1d8a3bc618 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -83,7 +83,7 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, ICoord2D origin, size, textPos; IRegion2D clipRegion; // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp index 30f356cfa48..baea0758923 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp @@ -418,7 +418,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, tabDeltaY = tabHeight; } - const Image *image = NULL; + const Image *image = nullptr; if( tabData->tabCount >= 1 )//Does exist { @@ -435,7 +435,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabZero( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -464,7 +464,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabOne( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -493,7 +493,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabTwo( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -522,7 +522,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabThree( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -551,7 +551,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabFour( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -580,7 +580,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabFive( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -609,7 +609,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabSix( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -638,7 +638,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabSeven( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp index dba4d4f1e78..36e7b452bf9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp @@ -196,7 +196,7 @@ static void drawTextEntryText( GameWindow *window, WinInstanceData *instData, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if( (window == TheWindowManager->winGetFocus() || (parent && parent == TheWindowManager->winGetFocus())) && ((drawCnt++ >> 3) & 0x1) ) TheWindowManager->winFillRect( textColor, WIN_DRAW_LINE_WIDTH, diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp index 8884b0f095d..5593517ccd9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp @@ -182,8 +182,8 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( topImage == NULL || bottomImage == NULL || - centerImage == NULL || smallCenterImage == NULL ) + if( topImage == nullptr || bottomImage == nullptr || + centerImage == nullptr || smallCenterImage == nullptr ) return; // get image sizes for the ends diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp index 836a338bcd0..c90931db767 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp @@ -74,7 +74,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return FALSE; const char* name = font->nameString.str(); @@ -84,7 +84,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) // get the font data from the asset manager FontCharsClass *fontChar = WW3DAssetManager::Get_Instance()->Get_FontChars( name, size, bold ); - if( fontChar == NULL ) + if( fontChar == nullptr ) { DEBUG_CRASH(( "Unable to find font '%s' in Asset Manager", name )); return FALSE; @@ -115,7 +115,7 @@ void W3DFontLibrary::releaseFontData( GameFont *font ) ((FontCharsClass *)(font->fontData))->AlternateUnicodeFont->Release_Ref(); ((FontCharsClass *)(font->fontData))->Release_Ref(); - font->fontData = NULL; + font->fontData = nullptr; } } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp index 7fa36bca028..8cf7953ea17 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp @@ -66,7 +66,7 @@ enum // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static Bool bordersInit = FALSE; -static const Image *borderPieces[NUM_BORDER_PIECES] = { 0 }; +static const Image *borderPieces[NUM_BORDER_PIECES] = { nullptr }; // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ void W3DGameWindow::winDrawBorder( void ) TheWindowManager->winGetTextSize( m_instData.getFont(), m_instData.getText(), - &textWidth, NULL, 0 ); + &textWidth, nullptr, 0 ); width -= textWidth + 6; x += textWidth + 6; @@ -525,7 +525,7 @@ void W3DGameWindow::winDrawBorder( void ) void W3DGameWindow::winSetFont( GameFont *font ) { - if (font == NULL) + if (font == nullptr) return; // extending functionality @@ -549,7 +549,7 @@ Int W3DGameWindow::winSetText( UnicodeString newText ) GameWindow::winSetText( newText ); // rebuild the sentence in our text renderer - m_textRenderer.Build_Sentence( m_instData.getText().str(),NULL, NULL ); + m_textRenderer.Build_Sentence( m_instData.getText().str(),nullptr, nullptr ); // this is a visual change m_needPolyDraw = TRUE; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp index 5022bbb876b..801300fa57e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp @@ -26,7 +26,7 @@ #include "Common/Debug.h" #include "W3DDevice/GameClient/W3DBufferManager.h" -W3DBufferManager *TheW3DBufferManager=NULL; //singleton +W3DBufferManager *TheW3DBufferManager=nullptr; //singleton static int FVFTypeIndexList[W3DBufferManager::MAX_FVF]= { @@ -64,14 +64,14 @@ W3DBufferManager::W3DBufferManager(void) Int i=0; for (; im_prevSameVB) vbSlot->m_prevSameVB->m_nextSameVB=vbSlot->m_nextSameVB; else - vbSlot->m_VB->m_usedSlots=NULL; + vbSlot->m_VB->m_usedSlots=nullptr; if (vbSlot->m_nextSameVB) vbSlot->m_nextSameVB->m_prevSameVB=vbSlot->m_prevSameVB; vbSlot=vbSlot->m_nextSameSize; m_numEmptySlotsAllocated--; } - m_W3DVertexBufferSlots[i][j]=NULL; + m_W3DVertexBufferSlots[i][j]=nullptr; } } @@ -115,14 +115,14 @@ void W3DBufferManager::freeAllSlots(void) if (ibSlot->m_prevSameIB) ibSlot->m_prevSameIB->m_nextSameIB=ibSlot->m_nextSameIB; else - ibSlot->m_IB->m_usedSlots=NULL; + ibSlot->m_IB->m_usedSlots=nullptr; if (ibSlot->m_nextSameIB) ibSlot->m_nextSameIB->m_prevSameIB=ibSlot->m_prevSameIB; ibSlot=ibSlot->m_nextSameSize; m_numEmptyIndexSlotsAllocated--; } - m_W3DIndexBufferSlots[j]=NULL; + m_W3DIndexBufferSlots[j]=nullptr; } DEBUG_ASSERTCRASH(m_numEmptySlotsAllocated==0, ("Failed to free all empty vertex buffer slots")); @@ -140,22 +140,22 @@ void W3DBufferManager::freeAllBuffers(void) { W3DVertexBuffer *vb = m_W3DVertexBuffers[i]; while (vb) - { DEBUG_ASSERTCRASH(vb->m_usedSlots == NULL, ("Freeing Non-Empty Vertex Buffer")); + { DEBUG_ASSERTCRASH(vb->m_usedSlots == nullptr, ("Freeing Non-Empty Vertex Buffer")); REF_PTR_RELEASE(vb->m_DX8VertexBuffer); m_numEmptyVertexBuffersAllocated--; vb=vb->m_nextVB; //get next vertex buffer of this type } - m_W3DVertexBuffers[i]=NULL; + m_W3DVertexBuffers[i]=nullptr; } W3DIndexBuffer *ib = m_W3DIndexBuffers; while (ib) - { DEBUG_ASSERTCRASH(ib->m_usedSlots == NULL, ("Freeing Non-Empty Index Buffer")); + { DEBUG_ASSERTCRASH(ib->m_usedSlots == nullptr, ("Freeing Non-Empty Index Buffer")); REF_PTR_RELEASE(ib->m_DX8IndexBuffer); m_numEmptyIndexBuffersAllocated--; ib=ib->m_nextIB; //get next vertex buffer of this type } - m_W3DIndexBuffers=NULL; + m_W3DIndexBuffers=nullptr; DEBUG_ASSERTCRASH(m_numEmptyVertexBuffersAllocated==0, ("Failed to free all empty vertex buffers")); DEBUG_ASSERTCRASH(m_numEmptyIndexBuffersAllocated==0, ("Failed to free all empty index buffers")); @@ -187,7 +187,7 @@ Bool W3DBufferManager::ReAcquireResources(void) { W3DVertexBuffer *vb = m_W3DVertexBuffers[i]; while (vb) - { DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer == NULL, ("ReAcquire of existing vertex buffer")); + { DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer == nullptr, ("ReAcquire of existing vertex buffer")); vb->m_DX8VertexBuffer=NEW_REF(DX8VertexBufferClass,(FVFTypeIndexList[vb->m_format],vb->m_size,DX8VertexBufferClass::USAGE_DEFAULT)); DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer, ("Failed ReAcquire of vertex buffer")); if (!vb->m_DX8VertexBuffer) @@ -198,7 +198,7 @@ Bool W3DBufferManager::ReAcquireResources(void) W3DIndexBuffer *ib = m_W3DIndexBuffers; while (ib) - { DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer == NULL, ("ReAcquire of existing index buffer")); + { DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer == nullptr, ("ReAcquire of existing index buffer")); ib->m_DX8IndexBuffer=NEW_REF(DX8IndexBufferClass,(ib->m_size,DX8IndexBufferClass::USAGE_DEFAULT)); DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer, ("Failed ReAcquire of index buffer")); if (!ib->m_DX8IndexBuffer) @@ -211,11 +211,11 @@ Bool W3DBufferManager::ReAcquireResources(void) /**Searches through previously allocated vertex buffer slots and returns a matching type. If none found, creates a new slot and adds it to the pool. Returns a pointer to the VB slot. - Returns NULL in case of failure. + Returns nullptr in case of failure. */ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES fvfType, Int size) { - W3DVertexBufferSlot *vbSlot=NULL; + W3DVertexBufferSlot *vbSlot=nullptr; //round size to next multiple of minimum slot size. //should help avoid fragmentation. @@ -226,14 +226,14 @@ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES f // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. // This will happen when a mesh is too complex to draw shadows with. if (sizeIndex >= MAX_VB_SIZES || size <= 0) { - return NULL; + return nullptr; } - if ((vbSlot=m_W3DVertexBufferSlots[fvfType][sizeIndex]) != NULL) + if ((vbSlot=m_W3DVertexBufferSlots[fvfType][sizeIndex]) != nullptr) { //found a previously allocated slot matching required size m_W3DVertexBufferSlots[fvfType][sizeIndex]=vbSlot->m_nextSameSize; if (vbSlot->m_nextSameSize) - vbSlot->m_nextSameSize->m_prevSameSize=NULL; + vbSlot->m_nextSameSize->m_prevSameSize=nullptr; return vbSlot; } else @@ -241,7 +241,7 @@ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES f return allocateSlotStorage(fvfType, size); } - return NULL; + return nullptr; } /**Returns vertex buffer space back to pool so it can be reused later*/ @@ -269,7 +269,7 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. // This will happen when there are too many meshes in the scene to draw shadows with. if (m_numEmptySlotsAllocated >= MAX_NUMBER_SLOTS) { - return NULL; + return nullptr; } pVB=m_W3DVertexBuffers[fvfType]; @@ -283,10 +283,10 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB vbSlot->m_VB=pVB; //Link to VB list of slots vbSlot->m_nextSameVB=pVB->m_usedSlots; - vbSlot->m_prevSameVB=NULL; //this will be the new head + vbSlot->m_prevSameVB=nullptr; //this will be the new head if (pVB->m_usedSlots) pVB->m_usedSlots->m_prevSameVB=vbSlot; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=NULL; + vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; pVB->m_usedSlots=vbSlot; pVB->m_startFreeIndex += size; m_numEmptySlotsAllocated++; @@ -320,22 +320,22 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB vbSlot->m_size=size; vbSlot->m_start=0; vbSlot->m_VB=pVB; - vbSlot->m_prevSameVB=vbSlot->m_nextSameVB=NULL; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=NULL; + vbSlot->m_prevSameVB=vbSlot->m_nextSameVB=nullptr; + vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; return vbSlot; } - return NULL; + return nullptr; } //******************************** Index Buffer code ****************************************************** /**Searches through previously allocated index buffer slots and returns a matching type. If none found, creates a new slot and adds it to the pool. Returns a pointer to the IB slot. - Returns NULL in case of failure. + Returns nullptr in case of failure. */ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) { - W3DIndexBufferSlot *ibSlot=NULL; + W3DIndexBufferSlot *ibSlot=nullptr; //round size to next multiple of minimum slot size. //should help avoid fragmentation. @@ -346,14 +346,14 @@ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. // This will happen when a mesh is too complex to draw shadows with. if (sizeIndex >= MAX_IB_SIZES || size <= 0) { - return NULL; + return nullptr; } - if ((ibSlot=m_W3DIndexBufferSlots[sizeIndex]) != NULL) + if ((ibSlot=m_W3DIndexBufferSlots[sizeIndex]) != nullptr) { //found a previously allocated slot matching required size m_W3DIndexBufferSlots[sizeIndex]=ibSlot->m_nextSameSize; if (ibSlot->m_nextSameSize) - ibSlot->m_nextSameSize->m_prevSameSize=NULL; + ibSlot->m_nextSameSize->m_prevSameSize=nullptr; return ibSlot; } else @@ -361,7 +361,7 @@ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) return allocateSlotStorage(size); } - return NULL; + return nullptr; } /**Returns index buffer space back to pool so it can be reused later*/ @@ -389,7 +389,7 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. // This will happen when there are too many meshes in the scene to draw shadows with. if (m_numEmptyIndexSlotsAllocated >= MAX_NUMBER_SLOTS) { - return NULL; + return nullptr; } pIB=m_W3DIndexBuffers; @@ -403,10 +403,10 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int ibSlot->m_IB=pIB; //Link to IB list of slots ibSlot->m_nextSameIB=pIB->m_usedSlots; - ibSlot->m_prevSameIB=NULL; //this will be the new head + ibSlot->m_prevSameIB=nullptr; //this will be the new head if (pIB->m_usedSlots) pIB->m_usedSlots->m_prevSameIB=ibSlot; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=NULL; + ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; pIB->m_usedSlots=ibSlot; pIB->m_startFreeIndex += size; m_numEmptyIndexSlotsAllocated++; @@ -439,10 +439,10 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int ibSlot->m_size=size; ibSlot->m_start=0; ibSlot->m_IB=pIB; - ibSlot->m_prevSameIB=ibSlot->m_nextSameIB=NULL; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=NULL; + ibSlot->m_prevSameIB=ibSlot->m_nextSameIB=nullptr; + ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; return ibSlot; } - return NULL; + return nullptr; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 7bf679d6c6c..85b679b6eb3 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -74,7 +74,7 @@ Maybe project onto a deformed terrain patch that molds to trays/bibs. #define DEFAULT_RENDER_TARGET_WIDTH 512 #define DEFAULT_RENDER_TARGET_HEIGHT 512 -W3DProjectedShadowManager *TheW3DProjectedShadowManager=NULL; //global singleton +W3DProjectedShadowManager *TheW3DProjectedShadowManager=nullptr; //global singleton ProjectedShadowManager *TheProjectedShadowManager; //global singleton with simpler interface. extern const FrustumClass *shadowCameraFrustum; //defined in W3DShadow. ///@todo: Externs from volumetric shadow renderer - these need to be moved into W3DBufferManager @@ -97,8 +97,8 @@ struct SHADOW_DECAL_VERTEX //vertex structure passed to D3D #define SHADOW_DECAL_FVF D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_DIFFUSE -LPDIRECT3DVERTEXBUFFER8 shadowDecalVertexBufferD3D=NULL; ///freeAllTextures(); @@ -258,10 +258,10 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) ///@todo: We should allocate our render target pool here. - DEBUG_ASSERTCRASH(m_dynamicRenderTarget == NULL, ("Acquire of existing shadow render target")); + DEBUG_ASSERTCRASH(m_dynamicRenderTarget == nullptr, ("Acquire of existing shadow render target")); m_renderTargetHasAlpha=TRUE; - if ((m_dynamicRenderTarget=DX8Wrapper::Create_Render_Target (DEFAULT_RENDER_TARGET_WIDTH, DEFAULT_RENDER_TARGET_HEIGHT, WW3D_FORMAT_A8R8G8B8)) == NULL) + if ((m_dynamicRenderTarget=DX8Wrapper::Create_Render_Target (DEFAULT_RENDER_TARGET_WIDTH, DEFAULT_RENDER_TARGET_HEIGHT, WW3D_FORMAT_A8R8G8B8)) == nullptr) { m_renderTargetHasAlpha=FALSE; @@ -273,7 +273,7 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DProjectedShadowManager without device")); - DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == NULL && shadowDecalIndexBufferD3D == NULL, ("ReAquireResources not released in W3DProjectedShadowManager")); + DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAquireResources not released in W3DProjectedShadowManager")); if (FAILED(m_pDev->CreateIndexBuffer ( @@ -285,7 +285,7 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) ))) return FALSE; - if (shadowDecalVertexBufferD3D == NULL) + if (shadowDecalVertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(m_pDev->CreateVertexBuffer @@ -310,8 +310,8 @@ void W3DProjectedShadowManager::ReleaseResources(void) shadowDecalIndexBufferD3D->Release(); if (shadowDecalVertexBufferD3D) shadowDecalVertexBufferD3D->Release(); - shadowDecalIndexBufferD3D=NULL; - shadowDecalVertexBufferD3D=NULL; + shadowDecalIndexBufferD3D=nullptr; + shadowDecalVertexBufferD3D=nullptr; } void W3DProjectedShadowManager::invalidateCachedLightPositions(void) @@ -531,9 +531,9 @@ Int W3DProjectedShadowManager::renderProjectedTerrainShadow(W3DProjectedShadow * #if 0 -TextureClass *snow=NULL; -TextureClass *grass=NULL; -TextureClass *ground=NULL; +TextureClass *snow=nullptr; +TextureClass *grass=nullptr; +TextureClass *ground=nullptr; #define V_COUNT (4*4) //4 vertices per cell #define I_COUNT (4*6) //6 indices per cell @@ -1319,7 +1319,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) TheDX8MeshRenderer.Set_Camera(&rinfo.Camera); //keep track of active decal texture so we can render all decals at once. - W3DShadowTexture *lastShadowDecalTexture=NULL; + W3DShadowTexture *lastShadowDecalTexture=nullptr; ShadowType lastShadowType = SHADOW_NONE; for( shadow = m_shadowList; shadow; shadow = shadow->m_next ) @@ -1328,7 +1328,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) { if (shadow->m_type & SHADOW_DECAL) { - if (lastShadowDecalTexture == NULL) + if (lastShadowDecalTexture == nullptr) lastShadowDecalTexture=m_shadowList->m_shadowTexture[0]; if (lastShadowType == SHADOW_NONE) lastShadowType = m_shadowList->m_type; @@ -1403,10 +1403,10 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) if (di) { W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + RenderObjClass *robj=nullptr; ///@todo: don't apply shadows to translcuent objects unless they are MOBILE - hack to get tanks to work. - if ((robj=w3dDraw->getRenderObject()) != 0 && (!robj->Is_Alpha() || !obj->isKindOf(KINDOF_IMMOBILE)) && robj != shadow->m_robj && robj->Is_Really_Visible()) + if ((robj=w3dDraw->getRenderObject()) != nullptr && (!robj->Is_Alpha() || !obj->isKindOf(KINDOF_IMMOBILE)) && robj != shadow->m_robj && robj->Is_Really_Visible()) { //do a more accurate test against W3D render bounding boxes. if (robj->Intersect_AABox(boxtest)) @@ -1433,14 +1433,14 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) if (m_decalList) { //keep track of active decal texture so we can render all decals at once. - W3DShadowTexture *lastShadowDecalTexture=NULL; + W3DShadowTexture *lastShadowDecalTexture=nullptr; ShadowType lastShadowType = SHADOW_NONE; for( shadow = m_decalList; shadow; shadow = shadow->m_next ) { if (shadow->m_isEnabled && !shadow->m_isInvisibleEnabled) { - if (lastShadowDecalTexture == NULL) + if (lastShadowDecalTexture == nullptr) lastShadowDecalTexture=m_decalList->m_shadowTexture[0]; if (lastShadowType == SHADOW_NONE) lastShadowType = m_decalList->m_type; @@ -1469,7 +1469,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) Some examples: Scorch marks, blood, stains, selection/status indicators, etc.*/ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. Real decalSizeX=0.0f; @@ -1479,7 +1479,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!shadowInfo) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected @@ -1489,7 +1489,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //Adding a new decal texture TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1497,10 +1497,10 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture: %s",texture_name)); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture: %s",texture_name)); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1518,10 +1518,10 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // poolify // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; - shadow->setRenderObject(NULL); + shadow->setRenderObject(nullptr); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights shadow->m_type = shadowType; /// type of projection shadow->m_allowWorldAlign=allowWorldAlign; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1542,7 +1542,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_decalList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1557,7 +1557,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_decalList; m_decalList = shadow; @@ -1571,7 +1571,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Some examples: Scorch marks, blood, stains, selection/status indicators, etc.*/ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. Real decalSizeX=0.0f; @@ -1583,7 +1583,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!robj || !shadowInfo) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected @@ -1593,7 +1593,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //Adding a new decal texture TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1601,10 +1601,10 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture: %s",texture_name)); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture: %s",texture_name)); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; SET_REF_OWNER( st ); @@ -1624,8 +1624,8 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights @@ -1664,7 +1664,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_decalList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1679,7 +1679,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_decalList; m_decalList = shadow; @@ -1691,7 +1691,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; static char defaultDecalName[]={"shadow.tga"}; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1705,7 +1705,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S if (!m_dynamicRenderTarget || !robj || !TheGlobalData->m_useShadowDecals) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support if (shadowInfo) @@ -1727,7 +1727,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S } st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //need to add this texture without creating it from a real renderobject TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1735,10 +1735,10 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture")); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture")); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1770,16 +1770,16 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S strlcpy(texture_name, robj->Get_Name(), ARRAY_SIZE(texture_name)); //not texture name give, assume model name. st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //texture doesn't exist, use current render object to create it m_W3DShadowTextureManager->createTexture(robj,texture_name); //try loading again st=m_W3DShadowTextureManager->getTexture(texture_name); - DEBUG_ASSERTCRASH(st != NULL, ("Could not create shadow texture")); + DEBUG_ASSERTCRASH(st != nullptr, ("Could not create shadow texture")); - if (st==NULL) - return NULL; //could not create the shadow texture + if (st==nullptr) + return nullptr; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; } @@ -1790,13 +1790,13 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st==NULL) + if (st==nullptr) { //did not find a cached copy of the shadow geometry, create a new one m_W3DShadowTextureManager->createTexture(robj,texture_name); //try loading again st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st==NULL) - return NULL; //could not create the shadow texture + if (st==nullptr) + return nullptr; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; } @@ -1804,8 +1804,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights @@ -1852,7 +1852,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_shadowList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1867,7 +1867,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_shadowList; m_shadowList = shadow; @@ -1879,7 +1879,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; static char defaultDecalName[]={"shadow.tga"}; ShadowType shadowType=SHADOW_DECAL; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1905,7 +1905,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT } st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //need to add this texture without creating it from a real renderobject TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1913,10 +1913,10 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture")); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture")); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1933,8 +1933,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setTexture(0,st); shadow->m_type = shadowType; /// type of projection @@ -1980,8 +1980,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) { - W3DProjectedShadow *prev_shadow=NULL; - W3DProjectedShadow *next_shadow=NULL; + W3DProjectedShadow *prev_shadow=nullptr; + W3DProjectedShadow *next_shadow=nullptr; if (shadow->m_type & (SHADOW_ALPHA_DECAL|SHADOW_ADDITIVE_DECAL)) { @@ -2021,9 +2021,9 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) void W3DProjectedShadowManager::removeAllShadows(void) { - W3DProjectedShadow *cur_shadow=NULL; + W3DProjectedShadow *cur_shadow=nullptr; W3DProjectedShadow *next_shadow=m_shadowList; - m_shadowList = NULL; + m_shadowList = nullptr; m_numDecalShadows = 0; m_numProjectionShadows = 0; @@ -2031,17 +2031,17 @@ void W3DProjectedShadowManager::removeAllShadows(void) for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } next_shadow=m_decalList; - cur_shadow=NULL; - m_decalList=NULL; + cur_shadow=nullptr; + m_decalList=nullptr; for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } } @@ -2074,14 +2074,14 @@ void W3DProjectedShadow::getRenderCost(RenderCost & rc) const W3DProjectedShadow::W3DProjectedShadow(void) { m_diffuse=0xffffffff; - m_shadowProjector=NULL; + m_shadowProjector=nullptr; m_lastObjPosition.Set(0,0,0); m_type = SHADOW_NONE; /// type of projection m_allowWorldAlign = FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. m_isEnabled = TRUE; m_isInvisibleEnabled = FALSE; for (Int i=0; iAdd_Ref(); } return text; @@ -2347,7 +2347,7 @@ W3DShadowTexture * W3DShadowTextureManager::getTexture(const char * name) /** Add texture to cache */ Bool W3DShadowTextureManager::addTexture(W3DShadowTexture *newTexture) { - WWASSERT (newTexture != NULL); + WWASSERT (newTexture != nullptr); // Increment the refcount on the new texture and add it to our table. newTexture->Add_Ref (); @@ -2389,7 +2389,7 @@ class MissingTextureClass : public HashableClass { ** Missing Textures ** ** The idea here, allow the system to register which textures are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching again. +** so that if they are asked for again, we can quickly return nullptr, without searching again. */ void W3DShadowTextureManager::registerMissing( const char * name ) { @@ -2398,7 +2398,7 @@ void W3DShadowTextureManager::registerMissing( const char * name ) Bool W3DShadowTextureManager::isMissing( const char * name ) { - return ( missingTextureTable->Find( name ) != NULL ); + return ( missingTextureTable->Find( name ) != nullptr ); } /** Create shadow geometry from a reference W3D RenderObject*/ @@ -2408,7 +2408,7 @@ int W3DShadowTextureManager::createTexture(RenderObjClass *robj, const char *nam W3DShadowTexture * newTexture = NEW W3DShadowTexture; - if (newTexture == NULL) { + if (newTexture == nullptr) { goto Error; } @@ -2421,7 +2421,7 @@ int W3DShadowTextureManager::createTexture(RenderObjClass *robj, const char *nam { // load failed! newTexture->Release_Ref(); goto Error; - } else if (peekTexture(newTexture->Get_Name()) != NULL) + } else if (peekTexture(newTexture->Get_Name()) != nullptr) { // duplicate exists! newTexture->Release_Ref(); // Release the one we just loaded goto Error; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp index 9e5b24fee57..bc605b06cf1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp @@ -54,7 +54,7 @@ #define SUN_DISTANCE_FROM_GROUND 10000.0f //distance of sun (our only light source). // Global Variables and Functions ///////////////////////////////////////////// -W3DShadowManager *TheW3DShadowManager=NULL; +W3DShadowManager *TheW3DShadowManager=nullptr; const FrustumClass *shadowCameraFrustum; Vector3 LightPosWorld[ MAX_SHADOW_LIGHTS ] = @@ -101,7 +101,7 @@ void DoShadows(RenderInfoClass & rinfo, Bool stencilPass) W3DShadowManager::W3DShadowManager( void ) { - DEBUG_ASSERTCRASH(TheW3DVolumetricShadowManager == NULL && TheW3DProjectedShadowManager == NULL, + DEBUG_ASSERTCRASH(TheW3DVolumetricShadowManager == nullptr && TheW3DProjectedShadowManager == nullptr, ("Creating new shadow managers without deleting old ones")); m_shadowColor = 0x7fa0a0a0; @@ -121,9 +121,9 @@ W3DShadowManager::W3DShadowManager( void ) W3DShadowManager::~W3DShadowManager( void ) { delete TheW3DVolumetricShadowManager; - TheW3DVolumetricShadowManager = NULL; + TheW3DVolumetricShadowManager = nullptr; delete TheW3DProjectedShadowManager; - TheProjectedShadowManager = TheW3DProjectedShadowManager = NULL; + TheProjectedShadowManager = TheW3DProjectedShadowManager = nullptr; } /** Do one-time initilalization of shadow systems that need to be @@ -196,10 +196,10 @@ Shadow *W3DShadowManager::addShadow( RenderObjClass *robj, Shadow::ShadowTypeInf return (Shadow *)TheW3DProjectedShadowManager->addShadow(robj, shadowInfo, draw); break; default: - return NULL; + return nullptr; } - return NULL; + return nullptr; } void W3DShadowManager::removeShadow(Shadow *shadow) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 592b75725ff..46de1297442 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -61,7 +61,7 @@ // Global Variables and Functions ///////////////////////////////////////////// -W3DVolumetricShadowManager *TheW3DVolumetricShadowManager=NULL; +W3DVolumetricShadowManager *TheW3DVolumetricShadowManager=nullptr; extern const FrustumClass *shadowCameraFrustum; //defined in W3DShadow. /////////////////////////////////////////////////////////////////////////////// @@ -103,8 +103,8 @@ struct SHADOW_STATIC_VOLUME_VERTEX //vertex structure passed to D3D #define SHADOW_DYNAMIC_VOLUME_FVF D3DFVF_XYZ #endif -LPDIRECT3DVERTEXBUFFER8 shadowVertexBufferD3D=NULL; ///getMap(); if (!map) @@ -419,13 +419,13 @@ int W3DShadowGeometryHeightmapMesh::GetPolygonIndex (long dwPolyId, short *psInd Vector3 *W3DShadowGeometryHeightmapMesh::GetVertex (int dwVertId, Vector3 *pvVertex) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; if (TheTerrainRenderObject) map=TheTerrainRenderObject->getMap(); if (!map) - return NULL; + return nullptr; Int row=dwVertId/m_width; Int column=dwVertId-row*m_width; @@ -440,7 +440,7 @@ Vector3 *W3DShadowGeometryHeightmapMesh::GetVertex (int dwVertId, Vector3 *pvVer Bool isPatchShadowed(W3DShadowGeometryHeightmapMesh *hm_mesh) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; Short poly[ 3 ]; Vector3 vertex; Vector3 normal,lightVector; @@ -451,7 +451,7 @@ Bool isPatchShadowed(W3DShadowGeometryHeightmapMesh *hm_mesh) map=TheTerrainRenderObject->getMap(); if (!map) - return NULL; + return nullptr; hm_mesh->GetPolygonNormal( 0, &normal ); @@ -521,7 +521,7 @@ static Int numTerrainMeshes=0; void W3DVolumetricShadowManager::loadTerrainShadows(void) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; Int patchSize=3; if (TheTerrainRenderObject) @@ -753,10 +753,10 @@ Int W3DShadowGeometry::init(RenderObjClass *robj) W3DShadowGeometryMesh::W3DShadowGeometryMesh( void ) { // init polygon neighbor information - m_polyNeighbors = NULL; + m_polyNeighbors = nullptr; m_numPolyNeighbors = 0; - m_parentVerts = NULL; - m_polygonNormals = NULL; + m_parentVerts = nullptr; + m_polygonNormals = nullptr; } // ~W3DShadowGeometry ============================================================ @@ -783,7 +783,7 @@ PolyNeighbor *W3DShadowGeometryMesh::GetPolyNeighbor( Int polyIndex ) // DBGPRINTF(( "Invalid neighbor index '%d'\n", polyIndex )); assert( 0 ); - return NULL; + return nullptr; } @@ -986,11 +986,11 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) // assure we're not re-allocating without deleting assert( m_numPolyNeighbors == 0 ); - assert( m_polyNeighbors == NULL ); + assert( m_polyNeighbors == nullptr ); // allocate the list m_polyNeighbors = NEW PolyNeighbor[ numPolys ]; - if( m_polyNeighbors == NULL ) + if( m_polyNeighbors == nullptr ) { // DBGPRINTF(( "Unable to allocate polygon neighbors\n" )); @@ -1014,12 +1014,12 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) // delete list delete [] m_polyNeighbors; - m_polyNeighbors = NULL; + m_polyNeighbors = nullptr; m_numPolyNeighbors = 0; // sanity error checking assert( m_numPolyNeighbors == 0 ); - assert( m_polyNeighbors == NULL ); + assert( m_polyNeighbors == nullptr ); } @@ -1116,7 +1116,7 @@ void W3DVolumetricShadow::updateOptimalExtrusionPadding(void) terrainPoint = Corners[i] + shadowRay*t; terrainPoint.Z=0; //ignore height - Real terrainHeight=TheTerrainRenderObject->getHeightMapHeight(terrainPoint.X,terrainPoint.Y,NULL); + Real terrainHeight=TheTerrainRenderObject->getHeightMapHeight(terrainPoint.X,terrainPoint.Y,nullptr); if (terrainHeight < (objPos.Z - MAX_SHADOW_EXTRUSION_UNDER_OBJECT_BEFORE_CLAMP)) //check if terrain dips more than 10 units under object. { if (j == 0) //this is the initial point so object must be right on the edge of a cliff. @@ -1196,7 +1196,7 @@ void W3DVolumetricShadow::getRenderCost(RenderCost & rc) const void W3DVolumetricShadow::RenderVolume(Int meshIndex, Int lightIndex) { HLodClass *hlod=(HLodClass *)m_robj; - MeshClass *mesh=NULL; + MeshClass *mesh=nullptr; Int meshRobjIndex=m_geometry->getMesh(meshIndex)->m_meshRobjIndex; @@ -1540,18 +1540,18 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) { Int i,j; - m_next = NULL; - m_geometry = NULL; + m_next = nullptr; + m_geometry = nullptr; m_shadowLengthScale = 0.0f; m_extraExtrusionPadding = 0.0f; - m_robj = NULL; + m_robj = nullptr; m_isEnabled = TRUE; m_isInvisibleEnabled = FALSE; for (j=0; j < MAX_SHADOW_CASTER_MESHES; j++) { m_numSilhouetteIndices[j] = 0; m_maxSilhouetteEntries[j] = 0; - m_silhouetteIndex[j] = NULL; + m_silhouetteIndex[j] = nullptr; m_shadowVolumeCount[j] = 0; } @@ -1559,9 +1559,9 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) { for (j=0; j < MAX_SHADOW_CASTER_MESHES; j++) { - m_shadowVolume[ i ][j] = NULL; - m_shadowVolumeVB[i][j] = NULL; - m_shadowVolumeIB[i][j] = NULL; + m_shadowVolume[ i ][j] = nullptr; + m_shadowVolumeVB[i][j] = nullptr; + m_shadowVolumeIB[i][j] = nullptr; m_shadowVolumeRenderTask[i][j].m_parentShadow = this; m_shadowVolumeRenderTask[i][j].m_meshIndex = (UnsignedByte)j; m_shadowVolumeRenderTask[i][j].m_lightIndex = (UnsignedByte)i; @@ -1598,8 +1598,8 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) if (m_geometry) REF_PTR_RELEASE(m_geometry); - m_geometry=NULL; - m_robj=NULL; + m_geometry=nullptr; + m_robj=nullptr; } @@ -1659,7 +1659,7 @@ void W3DVolumetricShadow::Update() Vector3 pos; // sanity - if( m_geometry == NULL) + if( m_geometry == nullptr) return; // @@ -1686,7 +1686,7 @@ void W3DVolumetricShadow::Update() if (TheTerrainLogic) groundHeight=TheTerrainLogic->getGroundHeight(pos.X,pos.Y); //logic knows about bridges so use if available. else - groundHeight=TheTerrainRenderObject->getHeightMapHeight(pos.X,pos.Y, NULL); + groundHeight=TheTerrainRenderObject->getHeightMapHeight(pos.X,pos.Y, nullptr); if (fabs(pos.Z - groundHeight) >= AIRBORNE_UNIT_GROUND_DELTA) { Real extent = MAX_SHADOW_LENGTH_EXTRA_AIRBORNE_SCALE_FACTOR * m_robjExtent; @@ -1739,7 +1739,7 @@ void W3DVolumetricShadow::updateVolumes(Real zoffset) static SphereClass sphere; Int meshIndex; - DEBUG_ASSERTCRASH(hlod != NULL,("updateVolumes : hlod is NULL!")); + DEBUG_ASSERTCRASH(hlod != nullptr,("updateVolumes : hlod is null!")); Bool parentVis=m_robj->Is_Really_Visible(); @@ -2312,7 +2312,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject { // initialize this neighbor to nuttin - otherNeighbor = NULL; + otherNeighbor = nullptr; // get our neighbor if present and cull them if processed if( polyNeighbor->neighbor[ j ].neighborIndex != NO_NEIGHBOR ) @@ -2344,7 +2344,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject { // check for no neighbor edges - if( otherNeighbor == NULL ) + if( otherNeighbor == nullptr ) { visibleNeighborless = TRUE; @@ -2359,7 +2359,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject } } - else if( otherNeighbor != NULL && + else if( otherNeighbor != nullptr && BitIsSet( otherNeighbor->status, POLY_VISIBLE ) ) { @@ -2427,7 +2427,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx // sanity if( volumeIndex < 0 || volumeIndex >= MAX_SHADOW_LIGHTS || - lightPosObject == NULL ) + lightPosObject == nullptr ) { assert( 0 ); @@ -2438,7 +2438,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "No volume allocated at index '%d'\n", volumeIndex )); @@ -2666,7 +2666,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow // sanity if( volumeIndex < 0 || volumeIndex >= MAX_SHADOW_LIGHTS || - lightPosObject == NULL ) + lightPosObject == nullptr ) { assert( 0 ); @@ -2677,7 +2677,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "No volume allocated at index '%d'\n", volumeIndex )); @@ -2790,23 +2790,23 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow } //*********************************************************************************************** - DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Vertex Buffer Shadow")); + DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == nullptr,("Updating Existing Static Vertex Buffer Shadow")); vbSlot=m_shadowVolumeVB[ volumeIndex ][meshIndex] = TheW3DBufferManager->getSlot(W3DBufferManager::VBM_FVF_XYZ, vertexCount); - DEBUG_ASSERTCRASH(vbSlot != NULL, ("Can't allocate vertex buffer slot for shadow volume")); - if (vbSlot != NULL) + DEBUG_ASSERTCRASH(vbSlot != nullptr, ("Can't allocate vertex buffer slot for shadow volume")); + if (vbSlot != nullptr) { DEBUG_ASSERTCRASH(vbSlot->m_size >= vertexCount,("Overflowing Shadow Vertex Buffer Slot")); } DEBUG_ASSERTCRASH(m_shadowVolume[ volumeIndex ][meshIndex]->GetNumPolygon() == 0,("Updating Existing Static Shadow Volume")); - DEBUG_ASSERTCRASH(m_shadowVolumeIB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Index Buffer Shadow")); + DEBUG_ASSERTCRASH(m_shadowVolumeIB[ volumeIndex ][meshIndex] == nullptr,("Updating Existing Static Index Buffer Shadow")); ibSlot=m_shadowVolumeIB[ volumeIndex ][meshIndex] = TheW3DBufferManager->getSlot(polygonCount*3); - DEBUG_ASSERTCRASH(ibSlot != NULL, ("Can't allocate index buffer slot for shadow volume")); - if (ibSlot != NULL) + DEBUG_ASSERTCRASH(ibSlot != nullptr, ("Can't allocate index buffer slot for shadow volume")); + if (ibSlot != nullptr) { DEBUG_ASSERTCRASH(ibSlot->m_size >= (polygonCount*3),("Overflowing Shadow Index Buffer Slot")); } @@ -2818,8 +2818,8 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow if (vbSlot) TheW3DBufferManager->releaseSlot(vbSlot); - m_shadowVolumeIB[ volumeIndex ][meshIndex]=NULL; - m_shadowVolumeVB[ volumeIndex ][meshIndex]=NULL; + m_shadowVolumeIB[ volumeIndex ][meshIndex]=nullptr; + m_shadowVolumeVB[ volumeIndex ][meshIndex]=nullptr; return; } @@ -2828,13 +2828,13 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow DX8VertexBufferClass::AppendLockClass lockVtxBuffer(vbSlot->m_VB->m_DX8VertexBuffer,vbSlot->m_start,vertexCount); VertexFormatXYZ *vb = (VertexFormatXYZ*)lockVtxBuffer.Get_Vertex_Array(); - if (vb == NULL) + if (vb == nullptr) return; DX8IndexBufferClass::AppendLockClass lockIdxBuffer(ibSlot->m_IB->m_DX8IndexBuffer,ibSlot->m_start,polygonCount*3); UnsignedShort *ib = (UnsignedShort*)lockIdxBuffer.Get_Index_Array(); - if (ib == NULL) + if (ib == nullptr) return; shadowVolume->SetNumActivePolygon(polygonCount); @@ -2989,7 +2989,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) } - if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == 0) + if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == nullptr) { // poolify shadowVolume = NEW Geometry; // create the new geometry @@ -2997,7 +2997,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) m_shadowVolumeCount[meshIndex]++; } - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "Unable to allocate '%d' shadow volume\n", volumeIndex )); @@ -3079,7 +3079,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) { delete m_shadowVolume[ volumeIndex ][meshIndex]; - m_shadowVolume[ volumeIndex ][meshIndex] = NULL; + m_shadowVolume[ volumeIndex ][meshIndex] = nullptr; // we now have one less shadow volume m_shadowVolumeCount[meshIndex]--; @@ -3115,11 +3115,11 @@ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) if (geometry) { if (m_shadowVolumeVB[volumeIndex][meshIndex]) { TheW3DBufferManager->releaseSlot(m_shadowVolumeVB[volumeIndex][meshIndex]); - m_shadowVolumeVB[volumeIndex][meshIndex]=NULL; + m_shadowVolumeVB[volumeIndex][meshIndex]=nullptr; } if (m_shadowVolumeIB[ volumeIndex ][meshIndex]) { TheW3DBufferManager->releaseSlot(m_shadowVolumeIB[volumeIndex][meshIndex]); - m_shadowVolumeIB[volumeIndex][meshIndex]=NULL; + m_shadowVolumeIB[volumeIndex][meshIndex]=nullptr; } geometry->Release(); } @@ -3137,13 +3137,13 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) Int numEntries = numVertices * 5; ///@todo: HACK, HACK... Should be 2! // sanity - assert( m_silhouetteIndex[meshIndex] == NULL && + assert( m_silhouetteIndex[meshIndex] == nullptr && m_numSilhouetteIndices[meshIndex] == 0 && numEntries > 0 ); // allocate memory m_silhouetteIndex[meshIndex] = NEW short[ numEntries ]; - if( m_silhouetteIndex[meshIndex] == NULL ) + if( m_silhouetteIndex[meshIndex] == nullptr ) { // DBGPRINTF(( "Unable to allcoate silhouette storage '%d'\n", numEntries )); @@ -3169,7 +3169,7 @@ void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) { delete [] m_silhouetteIndex[meshIndex]; - m_silhouetteIndex[meshIndex] = NULL; + m_silhouetteIndex[meshIndex] = nullptr; m_numSilhouetteIndices[meshIndex] = 0; } @@ -3296,8 +3296,8 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) REF_PTR_RELEASE(vmat); DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); //turn off textures - DX8Wrapper::Set_Texture(1,NULL); //turn off textures + DX8Wrapper::Set_Texture(0,nullptr); //turn off textures + DX8Wrapper::Set_Texture(1,nullptr); //turn off textures DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices // turn off z writing @@ -3320,8 +3320,8 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) m_pDev->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE); m_pDev->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); m_pDev->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 ); - m_pDev->SetTexture(0,NULL); - m_pDev->SetTexture(1,NULL); + m_pDev->SetTexture(0,nullptr); + m_pDev->SetTexture(1,nullptr); DWORD oldColorWriteEnable=0x12345678; @@ -3368,9 +3368,9 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) //m_pDev->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME); - lastActiveVertexBuffer=NULL; //reset + lastActiveVertexBuffer=nullptr; //reset - m_dynamicShadowVolumesToRender=NULL; //clear list of pending dynamic shadows + m_dynamicShadowVolumesToRender=nullptr; //clear list of pending dynamic shadows W3DVolumetricShadowRenderTask *shadowDynamicTasksStart,*shadowDynamicTask; // step through each of our shadows and render @@ -3400,7 +3400,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) //Empty queue of static shadow volumes to render. W3DBufferManager::W3DVertexBuffer *nextVb; W3DVolumetricShadowRenderTask *nextTask; - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { nextTask=(W3DVolumetricShadowRenderTask *)nextVb->m_renderTaskList; while (nextTask) @@ -3421,7 +3421,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) m_pDev->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW); - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { nextTask=(W3DVolumetricShadowRenderTask *)nextVb->m_renderTaskList; while (nextTask) @@ -3442,9 +3442,9 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) } //Reset all render tasks for next frame. - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { - nextVb->m_renderTaskList=NULL; + nextVb->m_renderTaskList=nullptr; } m_pDev->SetRenderState(D3DRS_CULLMODE,D3DCULL_CW); @@ -3479,7 +3479,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices renderStencilShadows(); @@ -3555,7 +3555,7 @@ void W3DVolumetricShadowManager::invalidateCachedLightPositions(void) W3DVolumetricShadowManager::W3DVolumetricShadowManager( void ) { - m_shadowList = NULL; + m_shadowList = nullptr; m_W3DShadowGeometryManager = NEW W3DShadowGeometryManager; @@ -3569,12 +3569,12 @@ W3DVolumetricShadowManager::~W3DVolumetricShadowManager( void ) { ReleaseResources(); delete m_W3DShadowGeometryManager; - m_W3DShadowGeometryManager = NULL; + m_W3DShadowGeometryManager = nullptr; delete TheW3DBufferManager; - TheW3DBufferManager=NULL; + TheW3DBufferManager=nullptr; //all shadows should be freed up at this point but check anyway - assert(m_shadowList==NULL); + assert(m_shadowList==nullptr); } @@ -3585,8 +3585,8 @@ void W3DVolumetricShadowManager::ReleaseResources(void) shadowIndexBufferD3D->Release(); if (shadowVertexBufferD3D) shadowVertexBufferD3D->Release(); - shadowIndexBufferD3D=NULL; - shadowVertexBufferD3D=NULL; + shadowIndexBufferD3D=nullptr; + shadowVertexBufferD3D=nullptr; if (TheW3DBufferManager) { TheW3DBufferManager->ReleaseResources(); invalidateCachedLightPositions(); //vertex buffers need to be refilled. @@ -3612,7 +3612,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) ))) return FALSE; - if (shadowVertexBufferD3D == NULL) + if (shadowVertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(m_pDev->CreateVertexBuffer @@ -3647,7 +3647,7 @@ Bool W3DVolumetricShadowManager::init( void ) void W3DVolumetricShadowManager::reset( void ) { - assert (m_shadowList == NULL); + assert (m_shadowList == nullptr); m_W3DShadowGeometryManager->Free_All_Geoms(); TheW3DBufferManager->freeAllBuffers(); @@ -3660,33 +3660,33 @@ void W3DVolumetricShadowManager::reset( void ) W3DVolumetricShadow* W3DVolumetricShadowManager::addShadow(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw) { if (!DX8Wrapper::Has_Stencil() || !robj || !TheGlobalData->m_useShadowVolumes) - return NULL; //right now we require a stencil buffer + return nullptr; //right now we require a stencil buffer - W3DShadowGeometry *sg=NULL; + W3DShadowGeometry *sg=nullptr; if (!robj) - return NULL; //must have a render object in order to read shadow geometry + return nullptr; //must have a render object in order to read shadow geometry const char *name=robj->Get_Name(); if (!name) - return NULL; + return nullptr; sg=m_W3DShadowGeometryManager->Get_Geom(name); - if (sg==NULL) + if (sg==nullptr) { //did not find a cached copy of the shadow geometry, create a new one m_W3DShadowGeometryManager->Load_Geom(robj,name); //try loading again sg=m_W3DShadowGeometryManager->Get_Geom(name); - if (sg==NULL) - return NULL; //could not create the shadow geometry + if (sg==nullptr) + return nullptr; //could not create the shadow geometry } W3DVolumetricShadow *shadow = NEW W3DVolumetricShadow; // poolify // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->SetGeometry(sg); @@ -3717,8 +3717,8 @@ W3DVolumetricShadow* W3DVolumetricShadowManager::addShadow(RenderObjClass *robj, */ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) { - W3DVolumetricShadow *prev_shadow=NULL; - W3DVolumetricShadow *next_shadow=NULL; + W3DVolumetricShadow *prev_shadow=nullptr; + W3DVolumetricShadow *next_shadow=nullptr; //search for this shadow for( next_shadow = m_shadowList; next_shadow; prev_shadow=next_shadow, next_shadow = next_shadow->m_next ) @@ -3743,15 +3743,15 @@ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) */ void W3DVolumetricShadowManager::removeAllShadows(void) { - W3DVolumetricShadow *cur_shadow=NULL; + W3DVolumetricShadow *cur_shadow=nullptr; W3DVolumetricShadow *next_shadow=m_shadowList; - m_shadowList = NULL; + m_shadowList = nullptr; //search for this shadow for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } } @@ -3768,10 +3768,10 @@ W3DShadowGeometryManager::~W3DShadowGeometryManager(void) Free_All_Geoms(); delete GeomPtrTable; - GeomPtrTable = NULL; + GeomPtrTable = nullptr; delete MissingGeomTable; - MissingGeomTable = NULL; + MissingGeomTable = nullptr; } /** Release all loaded animations */ @@ -3798,7 +3798,7 @@ W3DShadowGeometry * W3DShadowGeometryManager::Peek_Geom(const char * name) W3DShadowGeometry * W3DShadowGeometryManager::Get_Geom(const char * name) { W3DShadowGeometry * geom = Peek_Geom( name ); - if ( geom != NULL ) { + if ( geom != nullptr ) { geom->Add_Ref(); } return geom; @@ -3807,7 +3807,7 @@ W3DShadowGeometry * W3DShadowGeometryManager::Get_Geom(const char * name) /** Add animation to cache */ Bool W3DShadowGeometryManager::Add_Geom(W3DShadowGeometry *new_geom) { - WWASSERT (new_geom != NULL); + WWASSERT (new_geom != nullptr); // Increment the refcount on the new animation and add it to our table. new_geom->Add_Ref (); @@ -3836,7 +3836,7 @@ class MissingGeomClass : public HashableClass { ** Missing Geoms ** ** The idea here, allow the system to register which anims are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching the +** so that if they are asked for again, we can quickly return nullptr, without searching the ** disk again. */ void W3DShadowGeometryManager::Register_Missing( const char * name ) @@ -3846,7 +3846,7 @@ void W3DShadowGeometryManager::Register_Missing( const char * name ) Bool W3DShadowGeometryManager::Is_Missing( const char * name ) { - return ( MissingGeomTable->Find( name ) != NULL ); + return ( MissingGeomTable->Find( name ) != nullptr ); } /** Create shadow geometry from a reference W3D RenderObject*/ @@ -3856,7 +3856,7 @@ int W3DShadowGeometryManager::Load_Geom(RenderObjClass *robj, const char *name) W3DShadowGeometry * newgeom = NEW W3DShadowGeometry; - if (newgeom == NULL) { + if (newgeom == nullptr) { goto Error; } @@ -3881,7 +3881,7 @@ int W3DShadowGeometryManager::Load_Geom(RenderObjClass *robj, const char *name) newgeom->Release_Ref(); //DEBUG_LOG(("****Shadow Volume Creation Failed on %s",name)); goto Error; - } else if (Peek_Geom(newgeom->Get_Name()) != NULL) + } else if (Peek_Geom(newgeom->Get_Name()) != nullptr) { // duplicate exists! newgeom->Release_Ref(); // Release the one we just loaded goto Error; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index a0143fd001a..f0f81fc2c2e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -127,7 +127,7 @@ W3DPrototypeClass::~W3DPrototypeClass(void) { if (Proto) { Proto->Release_Ref(); - Proto = NULL; + Proto = nullptr; } } @@ -178,7 +178,7 @@ TextureClass *W3DAssetManager::Get_Texture( GetPrecisionTimer(&endTime64); Total_Get_Texture_Time += endTime64-startTime64; #endif - return NULL; + return nullptr; } StringClass lower_case_name(filename,true); @@ -198,7 +198,7 @@ TextureClass *W3DAssetManager::Get_Texture( */ if (!tex) { - tex = NEW_REF(TextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression)); + tex = NEW_REF(TextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression)); TextureHash.Insert(tex->Get_Texture_Name(),tex); // if (TheGlobalData->m_preloadAssets) // { @@ -622,8 +622,8 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, { const char *name=texture->Get_Texture_Name(); - // if texture is procedural return NULL - if (name && name[0]=='!') return NULL; + // if texture is procedural return nullptr + if (name && name[0]=='!') return nullptr; // make sure texture is loaded if (!texture->Is_Initialized()) @@ -673,7 +673,7 @@ __int64 Total_Create_Render_Obj_Time=0; #endif //--------------------------------------------------------------------- /** Generals specific code to generate customized render objects for each team color - Scale==1.0, color==0x00000000, and oldTexure==NULL are defaults that do nothing. + Scale==1.0, color==0x00000000, and oldTexure== nullptr are defaults that do nothing. */ RenderObjClass * W3DAssetManager::Create_Render_Obj( const char * name, @@ -690,7 +690,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( Bool reallyscale = (WWMath::Fabs(scale - ident_scale) > scale_epsilon); Bool reallycolor = (color & 0xFFFFFF) != 0; //black is not a valid color and assumes no custom coloring. - Bool reallytexture = (oldTexture != NULL && newTexture != NULL); + Bool reallytexture = (oldTexture != nullptr && newTexture != nullptr); // base case, no scale or color if (!reallyscale && !reallycolor && !reallytexture) @@ -707,7 +707,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( Munge_Render_Obj_Name(newname, name, scale, color, newTexture); // see if we got a cached version - RenderObjClass *rendobj = NULL; + RenderObjClass *rendobj = nullptr; Set_WW3D_Load_On_Demand(false); // munged name will never be found in a file. rendobj = WW3DAssetManager::Create_Render_Obj(newname); @@ -734,12 +734,12 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( PrototypeClass * proto = Find_Prototype(name); Set_WW3D_Load_On_Demand(true); // Auto Load. - if (WW3D_Load_On_Demand && proto == NULL) + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand char filename [MAX_PATH]; const char *mesh_name = strchr (name, '.'); - if (mesh_name != NULL) + if (mesh_name != nullptr) { lstrcpyn(filename, name, ((int)mesh_name) - ((int)name) + 1); lstrcat(filename, ".w3d"); @@ -757,7 +757,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( proto = Find_Prototype(name); // try again } - if (proto == NULL) + if (proto == nullptr) { static int warning_count = 0; if (++warning_count <= 20) @@ -768,7 +768,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( GetPrecisionTimer(&endTime64); Total_Create_Render_Obj_Time += endTime64-startTime64; #endif - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } rendobj = proto->Create(); @@ -779,7 +779,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( GetPrecisionTimer(&endTime64); Total_Create_Render_Obj_Time += endTime64-startTime64; #endif - return NULL; + return nullptr; } Make_Unique(rendobj,reallyscale,reallycolor); @@ -848,7 +848,7 @@ int W3DAssetManager::Recolor_Mesh(RenderObjClass *robj, const int color) MaterialInfoClass *material = mesh->Get_Material_Info(); // recolor vertex material (assuming mesh is housecolor) - if ( (( (meshName=strchr(mesh->Get_Name(),'.') ) != 0 && *(meshName++)) || ( (meshName=mesh->Get_Name()) != NULL)) && + if ( (( (meshName=strchr(mesh->Get_Name(),'.') ) != nullptr && *(meshName++)) || ( (meshName=mesh->Get_Name()) != nullptr)) && _strnicmp(meshName,"HOUSECOLOR", 10) == 0) { for (i=0; iVertex_Material_Count(); i++) Recolor_Vertex_Material(material->Peek_Vertex_Material(i),color); @@ -1069,7 +1069,7 @@ static Bool getMeshColorMethods(MeshClass *mesh, Bool &vertexColor, Bool &textur //Meshes which are part of another model have names in the form "name.name" while //isolated meshes are just "name". We check for both starting with "HOUSECOLOR". const char *meshName; - if ( ( (meshName=strchr(mesh->Get_Name(),'.') ) != 0 && *(meshName++)) || ( (meshName=mesh->Get_Name()) != NULL) ) + if ( ( (meshName=strchr(mesh->Get_Name(),'.') ) != nullptr && *(meshName++)) || ( (meshName=mesh->Get_Name()) != nullptr) ) { //Check if this object has housecolors on mesh if ( _strnicmp(meshName,"HOUSECOLOR", 10) == 0) vertexColor = true; @@ -1314,7 +1314,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal Munge_Render_Obj_Name(newname, name, scale, hsv_shift); // see if we got a cached version - RenderObjClass *rendobj=NULL; + RenderObjClass *rendobj=nullptr; if (isGranny) { //Granny objects share the same prototype since they allow instance scaling. @@ -1340,10 +1340,10 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal PrototypeClass * proto = Find_Prototype(name); Set_WW3D_Load_On_Demand(true); // Auto Load. - if (WW3D_Load_On_Demand && proto == NULL) { // If we didn't find one, try to load on demand + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand char filename [MAX_PATH]; char *mesh_name = ::strchr (name, '.'); - if (mesh_name != NULL) { + if (mesh_name != nullptr) { ::lstrcpyn (filename, name, ((int)mesh_name) - ((int)name) + 1); if (isGranny) ::lstrcat (filename, ".gr2"); @@ -1368,17 +1368,17 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal proto = Find_Prototype(name); // try again } - if (proto == NULL) { + if (proto == nullptr) { static int warning_count = 0; if (++warning_count <= 20) { WWDEBUG_SAY(("WARNING: Failed to create Render Object: %s",name)); } - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } rendobj=proto->Create(); - if (!rendobj) return NULL; + if (!rendobj) return nullptr; if (!isGranny) { Make_Unique(rendobj,reallyscale,reallyhsv_shift); @@ -1414,8 +1414,8 @@ TextureClass * W3DAssetManager::Get_Texture_With_HSV_Shift(const char * filename // // Bail if the user isn't really asking for anything // - if ((filename == NULL) || (strlen(filename) == 0)) { - return NULL; + if ((filename == nullptr) || (strlen(filename) == 0)) { + return nullptr; } TextureClass *newtex = Find_Texture(filename, hsv_shift); @@ -1428,7 +1428,7 @@ TextureClass * W3DAssetManager::Get_Texture_With_HSV_Shift(const char * filename _strlwr(lower_case_name); TextureClass *oldtex = TextureHash.Get(lower_case_name); if (!oldtex) { - oldtex = NEW_REF(TextureClass,(lower_case_name, NULL, mip_level_count)); + oldtex = NEW_REF(TextureClass,(lower_case_name, nullptr, mip_level_count)); TextureHash.Insert(oldtex->Get_Texture_Name(), oldtex); } @@ -1497,8 +1497,8 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, { const char *name=texture->Get_Texture_Name(); - // if texture is procedural return NULL - if (name && name[0]=='!') return NULL; + // if texture is procedural return nullptr + if (name && name[0]=='!') return nullptr; // make sure texture is loaded if (!texture->Is_Initialized()) @@ -1509,12 +1509,12 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, texture->Get_Level_Description(desc); // if texture is monochrome and no value shifting - // return NULL + // return nullptr smallsurf=texture->Get_Surface_Level((MipCountType)texture->Get_Mip_Level_Count()-1); if (hsv_shift.Z==0.0f && smallsurf->Is_Monochrome()) { REF_PTR_RELEASE(smallsurf); - return NULL; + return nullptr; } REF_PTR_RELEASE(smallsurf); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp index eca9c59f7d6..df93aabad9b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DBibBuffer.h" #include @@ -220,9 +221,9 @@ for the bibs. */ W3DBibBuffer::W3DBibBuffer(void) { m_initialized = false; - m_vertexBib = NULL; - m_indexBib = NULL; - m_bibTexture = NULL; + m_vertexBib = nullptr; + m_indexBib = nullptr; + m_bibTexture = nullptr; m_curNumBibVertices=0; m_curNumBibIndices=0; clearAllBibs(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index 282706871ef..198e5ec8a26 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DBridgeBuffer.h" #include "W3DDevice/GameClient/W3DAssetManager.h" @@ -101,10 +102,10 @@ static ShaderClass detailShader(SC_ALPHA_MIRROR); /** Initializes pointers & values. */ //============================================================================= W3DBridge::W3DBridge() : -m_bridgeTexture(NULL), -m_leftMesh(NULL), -m_sectionMesh(NULL), -m_rightMesh(NULL), +m_bridgeTexture(nullptr), +m_leftMesh(nullptr), +m_sectionMesh(nullptr), +m_rightMesh(nullptr), m_visible(false), m_curDamageState(BODY_PRISTINE), m_scale(1.0) @@ -279,13 +280,13 @@ Bool W3DBridge::load(BodyDamageType curDamageState) m_scale = scale; - if (m_leftMesh == NULL) { + if (m_leftMesh == nullptr) { clearBridge(); return(false); } m_bridgeType = SECTIONAL_BRIDGE; - if (m_rightMesh == NULL || m_sectionMesh == NULL) { + if (m_rightMesh == nullptr || m_sectionMesh == nullptr) { m_bridgeType = FIXED_BRIDGE; } @@ -405,7 +406,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer const Matrix3D &mtx, MeshClass *pMesh, RefRenderObjListIterator *pLightsIterator) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Int i; @@ -464,7 +465,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer #else normal = (normal.X) * vec + normal.Y*vecNormal + normal.Z*vecZ; normal.Normalize(); - TheTerrainRenderObject->doTheLight(&vb, lightRay, &normal, NULL, 1.0f); + TheTerrainRenderObject->doTheLight(&vb, lightRay, &normal, nullptr, 1.0f); curVb->diffuse = vb.diffuse | 0xFF000000; #endif curVb++; @@ -480,7 +481,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer Int W3DBridge::getModelVerticesFixed(VertexFormatXYZNDUV1 *destination_vb, Int curVertex, const Matrix3D &mtx, MeshClass *pMesh, RefRenderObjListIterator *pLightsIterator) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Vector3 vec = m_end - m_start; @@ -514,7 +515,7 @@ void W3DBridge::getIndicesNVertices(UnsignedShort *destination_ib, VertexFormatX m_firstIndex = *curIndexP; m_numVertex = 0; m_numPolygons = 0; - if (m_sectionMesh == NULL) { + if (m_sectionMesh == nullptr) { numV = getModelVerticesFixed(destination_vb, *curVertexP, m_leftMtx, m_leftMesh, pLightsIterator); if (!numV) { //not enough room for vertices @@ -632,7 +633,7 @@ void W3DBridge::getIndicesNVertices(UnsignedShort *destination_ib, VertexFormatX //============================================================================= Int W3DBridge::getModelIndices(UnsignedShort *destination_ib, Int curIndex, Int vertexOffset, MeshClass *pMesh) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Int numPoly = pMesh->Peek_Model()->Get_Polygon_Count(); const TriIndex *pPoly =pMesh->Peek_Model()->Get_Polygon_Array(); @@ -730,10 +731,10 @@ for the bridges. */ W3DBridgeBuffer::W3DBridgeBuffer(void) { m_initialized = false; - m_vertexMaterial = NULL; - m_vertexBridge = NULL; - m_indexBridge = NULL; - m_bridgeTexture = NULL; + m_vertexMaterial = nullptr; + m_vertexBridge = nullptr; + m_indexBridge = nullptr; + m_bridgeTexture = nullptr; m_curNumBridgeVertices=0; m_curNumBridgeIndices=0; clearAllBridges(); @@ -814,13 +815,13 @@ void W3DBridgeBuffer::loadBridges(W3DTerrainLogic *pTerrainLogic, Bool saveGame) if ( !pMapObj2 || !pMapObj2->getFlag(FLAG_BRIDGE_POINT2)) { DEBUG_LOG(("Missing second bridge point. Ignoring first.")); } - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_BRIDGE_POINT2)) continue; Vector3 from, to; from.Set(pMapObj->getLocation()->x, pMapObj->getLocation()->y, 0); - from.Z = TheTerrainRenderObject->getHeightMapHeight(from.X, from.Y, NULL) + BRIDGE_FLOAT_AMT; + from.Z = TheTerrainRenderObject->getHeightMapHeight(from.X, from.Y, nullptr) + BRIDGE_FLOAT_AMT; to.Set(pMapObj2->getLocation()->x, pMapObj2->getLocation()->y, 0); - to.Z = TheTerrainRenderObject->getHeightMapHeight(to.X, to.Y, NULL) + BRIDGE_FLOAT_AMT; + to.Z = TheTerrainRenderObject->getHeightMapHeight(to.X, to.Y, nullptr) + BRIDGE_FLOAT_AMT; addBridge(from, to, pMapObj->getName(), pTerrainLogic, pMapObj->getProperties()); pMapObj = pMapObj2; } @@ -838,21 +839,21 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, BridgeTowerType type, BridgeInfo *bridgeInfo ) { - RenderObjClass* tower = NULL; + RenderObjClass* tower = nullptr; // sanity - if( scene == NULL || - assetManager == NULL || - mapObject == NULL || - bridgeInfo == NULL || + if( scene == nullptr || + assetManager == nullptr || + mapObject == nullptr || + bridgeInfo == nullptr || type < 0 || type >= BRIDGE_MAX_TOWERS ) - return NULL; + return nullptr; // get template for this bridge - DEBUG_ASSERTCRASH( TheTerrainRoads, ("createTower: TheTerrainRoads is NULL") ); + DEBUG_ASSERTCRASH( TheTerrainRoads, ("createTower: TheTerrainRoads is null") ); TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( mapObject->getName() ); - if( bridgeTemplate == NULL ) - return NULL; + if( bridgeTemplate == nullptr ) + return nullptr; // given the type of tower (corner position) find the appropriate spot to put the tower Coord3D towerPos; @@ -863,28 +864,28 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, case BRIDGE_TOWER_FROM_RIGHT: towerPos = bridgeInfo->fromRight; break; case BRIDGE_TOWER_TO_LEFT: towerPos = bridgeInfo->toLeft; break; case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; - default: return NULL; + default: return nullptr; } // set the Z position to that of the terrain - towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, NULL); + towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, nullptr); // find the thing template for the tower we want to construct AsciiString towerTemplateName = bridgeTemplate->getTowerObjectName( type ); - DEBUG_ASSERTCRASH( TheThingFactory, ("createTower: TheThingFactory is NULL") ); + DEBUG_ASSERTCRASH( TheThingFactory, ("createTower: TheThingFactory is null") ); const ThingTemplate *towerTemplate = TheThingFactory->findTemplate( towerTemplateName ); - if( towerTemplate == NULL ) - return NULL; + if( towerTemplate == nullptr ) + return nullptr; // find the name of the render object to show const ModuleInfo& mi = towerTemplate->getDrawModuleInfo( ); if( mi.getCount() <= 0 ) - return NULL; + return nullptr; const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; - if( md == NULL ) - return NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; + if( md == nullptr ) + return nullptr; ModelConditionFlags state; state.clear(); AsciiString modelName = md->getBestModelNameForWB( state ); @@ -923,7 +924,7 @@ static void updateTowerPos( RenderObjClass* tower, { // sanity - if( tower == NULL || type < 0 || type >= BRIDGE_MAX_TOWERS || bridgeInfo == NULL ) + if( tower == nullptr || type < 0 || type >= BRIDGE_MAX_TOWERS || bridgeInfo == nullptr ) return; // @@ -987,7 +988,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana if( !pMapObj2 || !pMapObj2->getFlag( FLAG_BRIDGE_POINT2 ) ) DEBUG_LOG(("Missing second bridge point. Ignoring first.")); - if( pMapObj2 == NULL ) + if( pMapObj2 == nullptr ) break; if( !pMapObj2->getFlag( FLAG_BRIDGE_POINT2 ) ) continue; @@ -1025,7 +1026,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana // create render object if needed created = FALSE; towerRenderObj = pMapObj->getBridgeRenderObject( (BridgeTowerType)j ); - if( towerRenderObj == NULL ) + if( towerRenderObj == nullptr ) { towerRenderObj = createTower( scene, assetManager, pMapObj, (BridgeTowerType)j, &bridgeInfo ); @@ -1034,7 +1035,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana } // sanity - DEBUG_ASSERTCRASH( towerRenderObj != NULL, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", + DEBUG_ASSERTCRASH( towerRenderObj != nullptr, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", m_bridges[ i ].getTemplateName().str()) ); // update the position of the towers @@ -1134,7 +1135,7 @@ void W3DBridgeBuffer::drawBridges(CameraClass * camera, Bool wireframe, TextureC } } if (changed) { - loadBridgesInVertexAndIndexBuffers(NULL); + loadBridgesInVertexAndIndexBuffers(nullptr); } } else { // In wb, all are enabled. diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp index 2b07be5a2f1..73de29487df 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DCustomEdging.h" #include @@ -285,8 +286,8 @@ for the trees. */ W3DCustomEdging::W3DCustomEdging(void) { m_initialized = false; - m_vertexEdging = NULL; - m_indexEdging = NULL; + m_vertexEdging = nullptr; + m_indexEdging = nullptr; clearAllEdging(); allocateEdgingBuffers(); m_initialized = true; @@ -370,7 +371,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); DX8Wrapper::Set_Texture(0,edgeTex); - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); // Draw the custom edge. DX8Wrapper::Apply_Render_State_Changes(); @@ -384,7 +385,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, false); //test pixels if transparent(clipped) before rendering. DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); #endif - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); if (cloudTexture) { DX8Wrapper::Set_Shader(detailOpaqueShader); DX8Wrapper::Apply_Render_State_Changes(); @@ -413,7 +414,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); } if (noiseTexture) { - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); DX8Wrapper::Set_Texture(0,noiseTexture); DX8Wrapper::Apply_Render_State_Changes(); DX8Wrapper::Set_Texture(1,edgeTex); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp index 3ddf49f69af..7f7ab7c11b4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp @@ -101,7 +101,7 @@ //============================================================================ W3DDebugDisplay::W3DDebugDisplay() -: m_displayString(NULL) +: m_displayString(nullptr) { } @@ -133,7 +133,7 @@ void W3DDebugDisplay::init( void ) void W3DDebugDisplay::drawText( Int x, Int y, Char *text ) { - if ( m_font == NULL || m_displayString == NULL ) + if ( m_font == nullptr || m_displayString == nullptr ) { return ; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp index 833b6da546e..8066f671b33 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp @@ -93,14 +93,14 @@ struct DebugIcon { Int endFrame; // Frame when this disappears. }; -DebugIcon *W3DDebugIcons::m_debugIcons = NULL; +DebugIcon *W3DDebugIcons::m_debugIcons = nullptr; Int W3DDebugIcons::m_numDebugIcons = 0; W3DDebugIcons::~W3DDebugIcons(void) { REF_PTR_RELEASE(m_vertexMaterialClass); delete m_debugIcons; - m_debugIcons = NULL; + m_debugIcons = nullptr; m_numDebugIcons = 0; } @@ -185,7 +185,7 @@ static Int maxIcons = 0; void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color) { - if (pos==NULL) { + if (pos==nullptr) { if (m_numDebugIcons > maxIcons) { DEBUG_LOG(("Max icons %d", m_numDebugIcons)); maxIcons = m_numDebugIcons; @@ -194,7 +194,7 @@ void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuratio return; } if (m_numDebugIcons>= MAX_ICONS) return; - if (m_debugIcons==NULL) return; + if (m_debugIcons==nullptr) return; m_debugIcons[m_numDebugIcons].position = *pos; m_debugIcons[m_numDebugIcons].width = width; m_debugIcons[m_numDebugIcons].color = color; @@ -216,7 +216,7 @@ void W3DDebugIcons::Render(RenderInfoClass & rinfo) DX8Wrapper::Apply_Render_State_Changes(); DX8Wrapper::Set_Material(m_vertexMaterialClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Apply_Render_State_Changes(); Matrix3D tm(Transform); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 0d79197c648..de50039400c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -113,7 +113,7 @@ static void drawFramerateBar(void); #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT -static W3DDynamicLight * theDynamicLight = NULL; +static W3DDynamicLight * theDynamicLight = nullptr; static Real theLightXOffset = 0.1f; static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; @@ -145,7 +145,7 @@ class StatDumpClass StatDumpClass::StatDumpClass( const char *fname ) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -268,7 +268,7 @@ void StatDumpClass::dumpStats() fprintf( m_fp, "\n" ); #if defined(RTS_DEBUG) - TheAudio->audioDebugDisplay( NULL, NULL, m_fp ); + TheAudio->audioDebugDisplay( nullptr, nullptr, m_fp ); fprintf( m_fp, "\n" ); #endif @@ -304,10 +304,10 @@ StatDumpClass TheStatDump("StatisticsDump.txt"); /////////////////////////////////////////////////////////////////////////////// //============================================================================= -RTS3DScene *W3DDisplay::m_3DScene = NULL; -RTS2DScene *W3DDisplay::m_2DScene = NULL; -RTS3DInterfaceScene *W3DDisplay::m_3DInterfaceScene = NULL; -W3DAssetManager *W3DDisplay::m_assetManager = NULL; +RTS3DScene *W3DDisplay::m_3DScene = nullptr; +RTS2DScene *W3DDisplay::m_2DScene = nullptr; +RTS3DInterfaceScene *W3DDisplay::m_3DInterfaceScene = nullptr; +W3DAssetManager *W3DDisplay::m_assetManager = nullptr; //============================================================================= // note, can't use the ones from PerfTimer.h 'cuz they are currently @@ -334,17 +334,17 @@ W3DDisplay::W3DDisplay() Int i; m_initialized = false; - m_assetManager = NULL; - m_3DScene = NULL; - m_2DScene = NULL; - m_3DInterfaceScene = NULL; + m_assetManager = nullptr; + m_3DScene = nullptr; + m_2DScene = nullptr; + m_3DInterfaceScene = nullptr; m_averageFPS = TheGlobalData->m_framesPerSecondLimit; #if defined(RTS_DEBUG) m_timerAtCumuFPSStart = 0; #endif for (i=0; iReset(); delete m_2DRender; - m_2DRender = NULL; + m_2DRender = nullptr; } @@ -412,7 +412,7 @@ W3DDisplay::~W3DDisplay() if (!TheGlobalData->m_headless) DX8WebBrowser::Shutdown(); delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; } @@ -800,7 +800,7 @@ void W3DDisplay::reset( void ) // Remove all render objects. - if (m_3DScene != NULL) + if (m_3DScene != nullptr) { SceneIterator *sceneIter = m_3DScene->Create_Iterator(); sceneIter->First(); @@ -879,7 +879,7 @@ void W3DDisplay::gatherDebugStats( void ) static Int s_sortedPolysSinceLastUpdate = 0; // allocate the display strings if needed - if( m_displayStrings[0] == NULL ) + if( m_displayStrings[0] == nullptr ) { GameFont *font; if (TheGlobalLanguageData && TheGlobalLanguageData->m_nativeDebugDisplay.name.isNotEmpty()) @@ -894,7 +894,7 @@ void W3DDisplay::gatherDebugStats( void ) for (int i = 0; i < DisplayStringCount; i++) { - if (m_displayStrings[i] == NULL) + if (m_displayStrings[i] == nullptr) { m_displayStrings[i] = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_displayStrings[i], ("Failed to create DisplayString") ); @@ -904,7 +904,7 @@ void W3DDisplay::gatherDebugStats( void ) } - if (m_benchmarkDisplayString == NULL) + if (m_benchmarkDisplayString == nullptr) { GameFont *thisFont = TheFontLibrary->getFont( "FixedSys", 8, FALSE ); m_benchmarkDisplayString = TheDisplayStringManager->newDisplayString(); @@ -922,10 +922,10 @@ void W3DDisplay::gatherDebugStats( void ) s_timeSinceLastUpdateInSecs = ((double)(time64 - s_lastUpdateTime64) / (double)(freq64)); #ifdef EXTENDED_STATS - static FILE *pListFile = NULL; + static FILE *pListFile = nullptr; static Int64 lastFrameTime=0; static samples = 0; - if (pListFile == NULL) { + if (pListFile == nullptr) { pListFile = fopen("FrameRateLog.txt", "w"); } samples++; @@ -1254,7 +1254,7 @@ void W3DDisplay::gatherDebugStats( void ) unibuffer.concat( L"RMB " ); } - Object *object = NULL; + Object *object = nullptr; #if defined(RTS_DEBUG) //debug hack to view object under mouse stats Drawable *draw = TheTacticalView->pickDrawable(&TheMousePos, FALSE, (PickType)0xffffffff ); #else @@ -1296,7 +1296,7 @@ void W3DDisplay::gatherDebugStats( void ) m_displayStrings[Objects]->setText( unibuffer ); // Network incoming bandwidth stats - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { unibuffer.format(L"IN: %.2f bytes/sec, %.2f packets/sec", TheNetwork->getIncomingBytesPerSecond(), TheNetwork->getIncomingPacketsPerSecond()); m_displayStrings[NetIncoming]->setText( unibuffer ); @@ -1475,7 +1475,7 @@ void W3DDisplay::drawCurrentDebugDisplay( void ) if ( m_debugDisplay && m_debugDisplayCallback ) { m_debugDisplay->reset(); - m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, NULL ); + m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, nullptr ); } } } @@ -1957,7 +1957,7 @@ void W3DDisplay::createLightPulse( const Coord3D *pos, const RGBColor *color, UnsignedInt decayFrameTime//, Bool donut ) { - if (m_3DScene == NULL) + if (m_3DScene == nullptr) return; if (innerRadius+attenuationWidth<2.0*PATHFIND_CELL_SIZE_F + 1.0f) { return; // it basically won't make any visual difference. jba. @@ -2486,7 +2486,7 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, { // sanity - if( image == NULL ) + if( image == nullptr ) return; // !! @@ -2691,7 +2691,7 @@ VideoBuffer* W3DDisplay::createVideoBuffer( void ) else { // card does not support any of the formats we need - return NULL; + return nullptr; } } // on low mem machines, render every video in 16bit except for the EA Logo movie @@ -2823,7 +2823,7 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) PBITMAPINFO pbmi; pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)); - if (pbmi == NULL) + if (pbmi == nullptr) return; pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2842,10 +2842,10 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) hf = CreateFile(pszFile, GENERIC_READ | GENERIC_WRITE, (DWORD) 0, - NULL, + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - (HANDLE) NULL); + (HANDLE) nullptr); if (hf != INVALID_HANDLE_VALUE) { @@ -2864,15 +2864,15 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) // Copy the BITMAPFILEHEADER into the .BMP file. if (WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), - (LPDWORD) &dwTmp, NULL)) + (LPDWORD) &dwTmp, nullptr)) { // Copy the BITMAPINFOHEADER and RGBQUAD array into the file. - if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, NULL)) + if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, nullptr)) { // Copy the array of color indices into the .BMP file. dwTotal = cb = pbih->biSizeImage; hp = lpBits; - WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, NULL); + WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, nullptr); } } @@ -2914,10 +2914,10 @@ void W3DDisplay::takeScreenShot(void) surface->Get_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -2926,7 +2926,7 @@ void W3DDisplay::takeScreenShot(void) } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -2957,7 +2957,7 @@ void W3DDisplay::takeScreenShot(void) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Targa targ; memset(&targ.Header,0,sizeof(targ.Header)); @@ -2988,7 +2988,7 @@ void W3DDisplay::takeScreenShot(void) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; //Flip the image char *ptr,*ptr1; @@ -3031,7 +3031,7 @@ void W3DDisplay::toggleMovieCapture(void) #if defined(RTS_DEBUG) -static FILE *AssetDumpFile=NULL; +static FILE *AssetDumpFile=nullptr; void dumpMeshAssets(MeshClass *mesh) { @@ -3048,7 +3048,7 @@ void dumpMeshAssets(MeshClass *mesh) { for (int i=0;iGet_Polygon_Count();++i) { - if ((texture=model->Peek_Texture(i,pass,stage)) != NULL) + if ((texture=model->Peek_Texture(i,pass,stage)) != nullptr) { fprintf(AssetDumpFile,"\t%s\n",texture->Get_Texture_Name().str()); } @@ -3056,7 +3056,7 @@ void dumpMeshAssets(MeshClass *mesh) } else { - if ((texture=model->Peek_Single_Texture(pass,stage)) != NULL) + if ((texture=model->Peek_Single_Texture(pass,stage)) != nullptr) { fprintf(AssetDumpFile,"\t%s\n",texture->Get_Texture_Name().str()); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 33775af48ad..41f1fe51bec 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -173,7 +173,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textRenderer.Build_Sentence( getText().str(), &m_hotKeyPos.x, &m_hotKeyPos.y ); m_hotkey.translate(TheHotKeyManager->searchHotKey(getText())); if(!m_hotkey.isEmpty()) - m_textRendererHotKey.Build_Sentence(m_hotkey.str(), NULL, NULL); + m_textRendererHotKey.Build_Sentence(m_hotkey.str(), nullptr, nullptr); else { m_useHotKey = FALSE; @@ -181,7 +181,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr } } else - m_textRenderer.Build_Sentence( getText().str(), NULL, NULL ); + m_textRenderer.Build_Sentence( getText().str(), nullptr, nullptr ); m_fontChanged = FALSE; m_textChanged = FALSE; needNewPolys = TRUE; @@ -287,7 +287,7 @@ void W3DDisplayString::setFont( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return; // if the new font is the same as our existing font do nothing @@ -349,7 +349,7 @@ void W3DDisplayString::computeExtents( void ) UnsignedInt len = getTextLength(); // if we have no string, or no font we don't have a size yet - if( len == 0 || m_font == NULL ) + if( len == 0 || m_font == nullptr ) { m_size.x = 0; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 459fc1be20e..ba0ff1765cf 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -46,10 +46,10 @@ W3DDisplayStringManager::W3DDisplayStringManager( void ) { for (Int i = 0; i < MAX_GROUPS; ++i) { - m_groupNumeralStrings[i] = NULL; + m_groupNumeralStrings[i] = nullptr; } - m_formationLetterDisplayString = NULL; + m_formationLetterDisplayString = nullptr; } @@ -60,12 +60,12 @@ W3DDisplayStringManager::~W3DDisplayStringManager( void ) { if (m_groupNumeralStrings[i]) freeDisplayString(m_groupNumeralStrings[i]); - m_groupNumeralStrings[i] = NULL; + m_groupNumeralStrings[i] = nullptr; } if (m_formationLetterDisplayString) freeDisplayString( m_formationLetterDisplayString ); - m_formationLetterDisplayString = NULL; + m_formationLetterDisplayString = nullptr; } @@ -113,12 +113,12 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) DisplayString *newString = newInstance(W3DDisplayString); // sanity - if( newString == NULL ) + if( newString == nullptr ) { DEBUG_LOG(( "newDisplayString: Could not allcoate new W3D display string" )); assert( 0 ); - return NULL; + return nullptr; } @@ -148,7 +148,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) { // sanity - if( string == NULL ) + if( string == nullptr ) return; // unlink @@ -156,7 +156,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) // if the string happens to fall where our current checkpoint was, set the checkpoint to null if ( m_currentCheckpoint == string) { - m_currentCheckpoint = NULL; + m_currentCheckpoint = nullptr; } // free data diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index c0df9dc89db..0b4ab05e73f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -73,7 +73,7 @@ typedef enum GameFileClass::GameFileClass( char const *filename ) { - m_theFile = NULL; + m_theFile = nullptr; m_fileExists = FALSE; m_filePath[0] = 0; m_filename[0] = 0; @@ -89,7 +89,7 @@ GameFileClass::GameFileClass( void ) { m_fileExists = FALSE; - m_theFile = NULL; + m_theFile = nullptr; m_filePath[ 0 ] = 0; m_filename[ 0 ] = 0; @@ -307,7 +307,7 @@ bool GameFileClass::Is_Available( int forced ) //------------------------------------------------------------------------------------------------- bool GameFileClass::Is_Open(void) const { - return m_theFile != NULL; + return m_theFile != nullptr; } //------------------------------------------------------------------------------------------------- @@ -334,7 +334,7 @@ int GameFileClass::Open(int rights) m_theFile = TheFileSystem->openFile( m_filePath, File::READ | File::BINARY ); - return (m_theFile != NULL); + return (m_theFile != nullptr); } //------------------------------------------------------------------------------------------------- @@ -394,7 +394,7 @@ void GameFileClass::Close(void) { if (m_theFile) { m_theFile->close(); - m_theFile = NULL; + m_theFile = nullptr; } } @@ -402,7 +402,7 @@ void GameFileClass::Close(void) /////////////////////////////////////////////////////////////////////////////////////////////////// // W3DFileSystem Class //////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -extern W3DFileSystem *TheW3DFileSystem = NULL; +extern W3DFileSystem *TheW3DFileSystem = nullptr; //------------------------------------------------------------------------------------------------- /** Constructor. Creating an instance of this class overrides the default @@ -423,7 +423,7 @@ after W3D is shutdown. */ //------------------------------------------------------------------------------------------------- W3DFileSystem::~W3DFileSystem(void) { - _TheFileFactory = NULL; // remove the w3d file factory. + _TheFileFactory = nullptr; // remove the w3d file factory. } //------------------------------------------------------------------------------------------------- @@ -447,7 +447,7 @@ void W3DFileSystem::Return_File( FileClass *file ) void W3DFileSystem::reprioritizeTexturesBySize() { ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH); - if (dirInfo != NULL) + if (dirInfo != nullptr) { reprioritizeTexturesBySize(*dirInfo); } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 11f6372e141..be3efb0db2a 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -117,11 +117,11 @@ void W3DGameClient::reset( void ) Drawable *W3DGameClient::friend_createDrawable( const ThingTemplate *tmplate, DrawableStatusBits statusBits ) { - Drawable *draw = NULL; + Drawable *draw = nullptr; // sanity - if( tmplate == NULL ) - return NULL; + if( tmplate == nullptr ) + return nullptr; draw = newInstance(Drawable)( tmplate, statusBits ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index 816d96ec8c2..25b40d5ad5c 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -108,9 +108,9 @@ DebugHintObject::~DebugHintObject(void) } DebugHintObject::DebugHintObject(void) : - m_indexBuffer(NULL), - m_vertexMaterialClass(NULL), - m_vertexBufferTile(NULL), + m_indexBuffer(nullptr), + m_vertexMaterialClass(nullptr), + m_vertexBufferTile(nullptr), m_myColor(0), m_mySize(0) { @@ -200,7 +200,7 @@ void DebugHintObject::setLocAndColorAndSize(const Coord3D *loc, Int argb, Int si if (m_myLoc.z < 0 && TheTerrainRenderObject) { - m_myLoc.z = TheTerrainRenderObject->getHeightMapHeight(m_myLoc.x, m_myLoc.y, NULL); + m_myLoc.z = TheTerrainRenderObject->getHeightMapHeight(m_myLoc.x, m_myLoc.y, nullptr); } if (m_vertexBufferTile) @@ -242,7 +242,7 @@ void DebugHintObject::Render(RenderInfoClass & rinfo) { DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile); @@ -270,13 +270,13 @@ W3DInGameUI::W3DInGameUI() for( i = 0; i < MAX_MOVE_HINTS; i++ ) { - m_moveHintRenderObj[ i ] = NULL; - m_moveHintAnim[ i ] = NULL; + m_moveHintRenderObj[ i ] = nullptr; + m_moveHintAnim[ i ] = nullptr; } - m_buildingPlacementAnchor = NULL; - m_buildingPlacementArrow = NULL; + m_buildingPlacementAnchor = nullptr; + m_buildingPlacementArrow = nullptr; } @@ -313,13 +313,13 @@ static void loadText( char *filename, GameWindow *listboxText ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return; char buffer[ 1024 ]; UnicodeString line; Color color = GameMakeColor(255, 255, 255, 255); - while( fgets( buffer, 1024, fp ) != NULL ) + while( fgets( buffer, 1024, fp ) != nullptr ) { line.translate(buffer); line.trim(); @@ -482,7 +482,7 @@ void W3DInGameUI::drawMoveHints( View *view ) // continue; // create render object and add to scene of needed - if( m_moveHintRenderObj[ i ] == NULL ) + if( m_moveHintRenderObj[ i ] == nullptr ) { RenderObjClass *hint; HAnimClass *anim; @@ -495,7 +495,7 @@ void W3DInGameUI::drawMoveHints( View *view ) anim = W3DDisplay::m_assetManager->Get_HAnim(animName.str()); // sanity - if( hint == NULL ) + if( hint == nullptr ) { DEBUG_CRASH(("unable to create hint")); @@ -621,8 +621,8 @@ void W3DInGameUI::drawPlaceAngle( View *view ) } } - Bool anchorInScene = m_buildingPlacementAnchor->Peek_Scene() != NULL; - Bool arrowInScene = m_buildingPlacementArrow->Peek_Scene() != NULL; + Bool anchorInScene = m_buildingPlacementAnchor->Peek_Scene() != nullptr; + Bool arrowInScene = m_buildingPlacementArrow->Peek_Scene() != nullptr; // get out of here if this display isn't up anyway if( isPlacementAnchored() == FALSE ) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index 260558f8cb6..848ea23b4e9 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -88,9 +88,9 @@ W3DMouse::W3DMouse( void ) for (Int i=0; iGet_Texture(FrameName)) != NULL) + if ((cursorTextures[cursor][i]=am->Get_Texture(FrameName)) != nullptr) { m_currentD3DSurface[m_currentFrames]=cursorTextures[cursor][i]->Get_Surface_Level(); m_currentFrames++; } @@ -223,18 +223,18 @@ void W3DMouse::initD3DAssets(void) WW3DAssetManager *am=WW3DAssetManager::Get_Instance(); //Check if texture assets already loaded - if (m_currentRedrawMode == RM_DX8 && cursorTextures[1] == NULL && am) + if (m_currentRedrawMode == RM_DX8 && cursorTextures[1] == nullptr && am) { for (Int i=0; iGet_Texture(m_cursorInfo[i].textureName.str()); + cursorTextures[i][j]=nullptr;//am->Get_Texture(m_cursorInfo[i].textureName.str()); } } for (Int x = 0; x < MAX_2D_CURSOR_ANIM_FRAMES; x++) - m_currentD3DSurface[x]=NULL; + m_currentD3DSurface[x]=nullptr; } } @@ -264,7 +264,7 @@ void W3DMouse::initW3DAssets(void) return; //Check if model assets already loaded - if ((cursorModels[1] == NULL && W3DDisplay::m_assetManager)) + if ((cursorModels[1] == nullptr && W3DDisplay::m_assetManager)) { for (Int i=1; iGet_HAnim(m_cursorInfo[i].W3DAnimName.str()); if (cursorAnims[i] && cursorModels[i]) { @@ -387,12 +387,12 @@ void W3DMouse::setCursor( MouseCursor cursor ) //make sure Windows didn't reset our cursor if (m_currentRedrawMode == RM_DX8) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); Bool doImageChange=FALSE; - if (m_pDev != NULL) + if (m_pDev != nullptr) { m_pDev->ShowCursor(FALSE); //disable DX8 cursor if (cursor != m_currentD3DCursor) @@ -423,7 +423,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) } else if (m_currentRedrawMode == RM_POLYGON) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor m_currentD3DCursor=NONE; m_currentW3DCursor=NONE; m_currentPolygonCursor = cursor; @@ -431,7 +431,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) } else if (m_currentRedrawMode == RM_W3D) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor m_currentD3DCursor=NONE; m_currentPolygonCursor=NONE; if (cursor != m_currentW3DCursor) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index f71bccd308b..adb44f0d3b3 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -42,18 +42,18 @@ W3DParticleSystemManager::W3DParticleSystemManager() { - m_pointGroup = NULL; - m_streakLine = NULL; - m_posBuffer = NULL; - m_RGBABuffer = NULL; - m_sizeBuffer = NULL; - m_angleBuffer = NULL; + m_pointGroup = nullptr; + m_streakLine = nullptr; + m_posBuffer = nullptr; + m_RGBABuffer = nullptr; + m_sizeBuffer = nullptr; + m_angleBuffer = nullptr; m_readyToRender = false; m_onScreenParticleCount = 0; m_pointGroup = NEW PointGroupClass(); - //m_streakLine = NULL; + //m_streakLine = nullptr; m_streakLine = NEW StreakLineClass(); m_posBuffer = NEW_REF( ShareBufferClass, (MAX_POINTS_PER_GROUP, "W3DParticleSystemManager::m_posBuffer") ); @@ -283,7 +283,7 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) /// @todo Use both QUADS and TRIS for particles m_pointGroup->Set_Point_Mode( PointGroupClass::QUADS ); - m_pointGroup->Set_Arrays( m_posBuffer, m_RGBABuffer, NULL, m_sizeBuffer, m_angleBuffer, NULL, count ); + m_pointGroup->Set_Arrays( m_posBuffer, m_RGBABuffer, nullptr, m_sizeBuffer, m_angleBuffer, nullptr, count ); m_pointGroup->Set_Billboard(sys->shouldBillboard()); /// @todo Support animated texture particles diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index b8d8db3d90c..ffe5521fb05 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DRoadBuffer.h" #include @@ -128,9 +129,9 @@ static Int xpSign(const Vector2 &v1, const Vector2 &v2) { /** Nulls index & vertex data. */ //============================================================================= RoadType::RoadType(void): -m_roadTexture(NULL), -m_vertexRoad(NULL), -m_indexRoad(NULL), +m_roadTexture(nullptr), +m_vertexRoad(nullptr), +m_indexRoad(nullptr), m_stackingOrder(0), m_uniqueID(-1) { @@ -216,9 +217,9 @@ void RoadType::loadTestTexture(void) RoadSegment::RoadSegment(void) { m_numVertex = 0; - m_vb = NULL; + m_vb = nullptr; m_numIndex = 0; - m_ib = NULL; + m_ib = nullptr; } //============================================================================= @@ -230,11 +231,11 @@ RoadSegment::~RoadSegment(void) { m_numVertex = 0; delete[] m_vb; - m_vb = NULL; + m_vb = nullptr; m_numIndex = 0; delete[] m_ib; - m_ib = NULL; + m_ib = nullptr; } @@ -247,7 +248,7 @@ RoadSegment::~RoadSegment(void) void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) { delete[] m_vb; - m_vb = NULL; + m_vb = nullptr; m_numVertex = 0; Vector3 verts[MAX_SEG_VERTEX]; @@ -278,7 +279,7 @@ void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) { delete[] m_ib; - m_ib = NULL; + m_ib = nullptr; m_numIndex = 0; if (numIndex < 1 || numIndex > MAX_SEG_INDEX) @@ -299,7 +300,7 @@ void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) //============================================================================= Int RoadSegment::GetVertices(VertexFormatXYZDUV1 *destination_vb, Int numToCopy) { - if (m_vb == NULL || numToCopy<1) return (0); + if (m_vb == nullptr || numToCopy<1) return (0); if (numToCopy > m_numVertex) return(0); memcpy(destination_vb, m_vb, numToCopy*sizeof(VertexFormatXYZDUV1)); return(numToCopy); @@ -312,7 +313,7 @@ Int RoadSegment::GetVertices(VertexFormatXYZDUV1 *destination_vb, Int numToCopy) //============================================================================= Int RoadSegment::GetIndices(UnsignedShort *destination_ib, Int numToCopy, Int offset) { - if (m_ib == NULL || numToCopy<1) return (0); + if (m_ib == nullptr || numToCopy<1) return (0); if (numToCopy > m_numIndex) return(0); Int i; for (i=0; im_roadTypes[m_curRoadType].setNumVertices(0); this->m_roadTypes[m_curRoadType].setNumIndices(0); return; @@ -1578,7 +1579,7 @@ void W3DRoadBuffer::addMapObjects() #ifdef RTS_DEBUG DEBUG_ASSERTLOG(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("Bad Flag")); #endif - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; Vector2 loc1, loc2; loc1.Set(pMapObj->getLocation()->x, pMapObj->getLocation()->y); @@ -1748,15 +1749,15 @@ void W3DRoadBuffer::insertTee(Vector2 loc, Int index1, Real scale) // pr1-3 point to the points on the segments that form the tee. // They are the points on the segments that are != loc. - TRoadPt *pr1=NULL; - TRoadPt *pr2=NULL; - TRoadPt *pr3=NULL; + TRoadPt *pr1=nullptr; + TRoadPt *pr2=nullptr; + TRoadPt *pr3=nullptr; // pc1-3 point to the center points of the segments. These are the // points that are at loc. - TRoadPt *pc1=NULL; - TRoadPt *pc2=NULL; - TRoadPt *pc3=NULL; + TRoadPt *pc1=nullptr; + TRoadPt *pc2=nullptr; + TRoadPt *pc3=nullptr; if (m_roads[index1].m_pt1.loc == loc) { pr1 = &m_roads[index1].m_pt2; @@ -1771,7 +1772,7 @@ void W3DRoadBuffer::insertTee(Vector2 loc, Int index1, Real scale) for (i = index1+1; im_curNumRoadIndices == 0) continue; if (wireframe) { - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); } else { m_roadTypes[i].applyTexture(); if (cloudTexture) { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 2b60391f2c0..5b5d7901cd1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -95,7 +95,7 @@ RTS3DScene::RTS3DScene() Int i=0; for (; im_shroudOn) m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,()); else - m_shroudMaterialPass = NULL; + m_shroudMaterialPass = nullptr; #else m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,()); #endif @@ -137,7 +137,7 @@ RTS3DScene::RTS3DScene() if (TheGlobalData->m_maxVisibleTranslucentObjects > 0) m_translucentObjectsBuffer = NEW RenderObjClass* [TheGlobalData->m_maxVisibleTranslucentObjects]; else - m_translucentObjectsBuffer = NULL; + m_translucentObjectsBuffer = nullptr; m_numPotentialOccluders=0; m_numPotentialOccludees=0; @@ -147,17 +147,17 @@ RTS3DScene::RTS3DScene() if (TheGlobalData->m_maxVisibleOccluderObjects > 0) m_potentialOccluders = NEW RenderObjClass* [TheGlobalData->m_maxVisibleOccluderObjects]; else - m_potentialOccluders = NULL; + m_potentialOccluders = nullptr; if (TheGlobalData->m_maxVisibleOccludeeObjects > 0) m_potentialOccludees = NEW RenderObjClass* [TheGlobalData->m_maxVisibleOccludeeObjects]; else - m_potentialOccludees = NULL; + m_potentialOccludees = nullptr; if (TheGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects > 0) m_nonOccludersOrOccludees = NEW RenderObjClass* [TheGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects]; else - m_nonOccludersOrOccludees = NULL; + m_nonOccludersOrOccludees = nullptr; //Modify the shader to make occlusion transparent ShaderClass shader = PlayerColorShader; @@ -178,7 +178,7 @@ RTS3DScene::RTS3DScene() } #else for (i=0; iGet_User_Data(); if (drawInfo) draw=drawInfo->m_drawable; @@ -453,7 +453,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) { //need to keep track of occluders and occludees for subsequent code. drawInfo = (DrawableInfo *)robj->Get_User_Data(); - if (drawInfo && (draw=drawInfo->m_drawable) != NULL) + if (drawInfo && (draw=drawInfo->m_drawable) != nullptr) { if (draw->isDrawableEffectivelyHidden() || draw->getFullyObscuredByShroud()) { robj->Set_Visible(false); @@ -532,7 +532,7 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable it.Next(); //advance to next object in case this one gets deleted during renderOneObject(). DrawableInfo *drawInfo = (DrawableInfo *)robj->Get_User_Data(); - Drawable *draw=NULL; + Drawable *draw=nullptr; if (drawInfo) draw = drawInfo->m_drawable; if (!draw) continue; @@ -556,10 +556,10 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable //============================================================================= void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, Int localPlayerIndex) { - Drawable *draw = NULL; - DrawableInfo *drawInfo = NULL; + Drawable *draw = nullptr; + DrawableInfo *drawInfo = nullptr; Bool drawableHidden=FALSE; - Object* obj = NULL; + Object* obj = nullptr; ObjectShroudStatus ss=OBJECTSHROUD_INVALID; Bool doExtraMaterialPop=FALSE; Bool doExtraFlagsPop=FALSE; @@ -641,8 +641,8 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I // HANDLE THE SPECIAL DRAWABLE-LEVEL COLORING SETTINGS FIRST - const Vector3 *tintColor = NULL; - const Vector3 *selectionColor = NULL; + const Vector3 *tintColor = nullptr; + const Vector3 *selectionColor = nullptr; tintColor = draw->getTintColor(); selectionColor = draw->getSelectionColor(); @@ -717,7 +717,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I //lighting environment applied which emulates the look of fog. rinfo.light_environment = &m_foggedLightEnv; robj->Render(rinfo); - rinfo.light_environment = NULL; + rinfo.light_environment = nullptr; return; } else @@ -795,7 +795,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I } } - rinfo.light_environment = NULL; + rinfo.light_environment = nullptr; if (doExtraMaterialPop) //check if there is an extra material on the stack from the heatvision effect. rinfo.Pop_Material_Pass(); if (doExtraFlagsPop) @@ -1058,7 +1058,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) StDrawableDirtyStuffLocker lockDirtyStuff; #endif - RenderObjClass *terrainObject=NULL,*robj; + RenderObjClass *terrainObject=nullptr,*robj; m_translucentObjectsCount = 0; //start of new frame so no translucent objects m_occludedObjectsCount = 0; @@ -1094,7 +1094,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) if (terrainObject) // Don't check visibility - terrain is always visible. jba. { robj=terrainObject; - rinfo.light_environment = NULL; // Terrain is self lit. + rinfo.light_environment = nullptr; // Terrain is self lit. rinfo.Camera.Set_User_Data(this); //pass the scene to terrain via user data. if (m_customPassMode == SCENE_PASS_DEFAULT && m_shroudMaterialPass) { @@ -1133,7 +1133,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) if (robj->Is_Really_Visible()) { DrawableInfo *drawInfo = (DrawableInfo *)robj->Get_User_Data(); - Drawable *draw=NULL; + Drawable *draw=nullptr; if (drawInfo) draw = drawInfo->m_drawable; #ifdef USE_NON_STENCIL_OCCLUSION @@ -1154,7 +1154,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) } // only render particles once per frame - if (terrainObject != NULL && TheParticleSystemManager != NULL && + if (terrainObject != nullptr && TheParticleSystemManager != nullptr && Get_Extra_Pass_Polygon_Mode() == EXTRA_PASS_DISABLE) { TheParticleSystemManager->queueParticleRender(); @@ -1673,7 +1673,7 @@ void RTS3DScene::doRender( CameraClass * cam ) { m_camera = cam; DRAW(); - m_camera = NULL; + m_camera = nullptr; } @@ -1684,7 +1684,7 @@ void RTS3DScene::doRender( CameraClass * cam ) //============================================================================= void RTS3DScene::draw( ) { - if (m_camera == NULL) { + if (m_camera == nullptr) { DEBUG_CRASH(("Null m_camera in RTS3DScene::draw")); return; } @@ -1739,7 +1739,7 @@ void RTS2DScene::doRender( CameraClass * cam ) { m_camera = cam; DRAW(); - m_camera = NULL; + m_camera = nullptr; } //============================================================================= @@ -1749,7 +1749,7 @@ void RTS2DScene::doRender( CameraClass * cam ) //============================================================================= void RTS2DScene::draw( ) { - if (m_camera == NULL) { + if (m_camera == nullptr) { DEBUG_CRASH(("Null m_camera in RTS2DScene::draw")); return; } @@ -1804,8 +1804,8 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) #endif RefRenderObjListIterator it(&RenderList); - DrawableInfo *drawInfo = NULL; - Drawable *draw = NULL; + DrawableInfo *drawInfo = nullptr; + Drawable *draw = nullptr; RenderObjClass * robj; m_numPotentialOccluders=0; @@ -1829,7 +1829,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) robj = it.Peek_Obj(); - draw=NULL; + draw=nullptr; drawInfo = (DrawableInfo *)robj->Get_User_Data(); if (drawInfo) draw=drawInfo->m_drawable; @@ -1879,7 +1879,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) { //need to keep track of occluders and ocludees for subsequent code. drawInfo = (DrawableInfo *)robj->Get_User_Data(); - if (drawInfo && (draw=drawInfo->m_drawable) != NULL) + if (drawInfo && (draw=drawInfo->m_drawable) != nullptr) { // now handled above in the cheater foil <<<<<<<<<<<< diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp index 2337420cfe4..b1bbf390899 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp @@ -70,12 +70,12 @@ //----------------------------------------------------------------------------- W3DShroud::W3DShroud(void) { - m_finalFogData=NULL; - m_currentFogData=NULL; - m_pSrcTexture=NULL; - m_pDstTexture=NULL; - m_srcTextureData=NULL; - m_srcTexturePitch=NULL; + m_finalFogData=nullptr; + m_currentFogData=nullptr; + m_pSrcTexture=nullptr; + m_pDstTexture=nullptr; + m_srcTextureData=nullptr; + m_srcTexturePitch=0; m_dstTextureWidth=m_numMaxVisibleCellsX=0; m_dstTextureHeight=m_numMaxVisibleCellsY=0; m_boderShroudLevel = (W3DShroudLevel)TheGlobalData->m_shroudAlpha; //assume border is black @@ -109,8 +109,8 @@ W3DShroud::~W3DShroud(void) */ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSizeY) { - DEBUG_ASSERTCRASH( m_pSrcTexture == NULL, ("ReAcquire of existing shroud textures")); - DEBUG_ASSERTCRASH( pMap != NULL, ("Shroud init with NULL WorldHeightMap")); + DEBUG_ASSERTCRASH( m_pSrcTexture == nullptr, ("ReAcquire of existing shroud textures")); + DEBUG_ASSERTCRASH( pMap != nullptr, ("Shroud init with null WorldHeightMap")); Int dstTextureWidth=0; Int dstTextureHeight=0; @@ -157,12 +157,12 @@ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSi #endif m_pSrcTexture = DX8Wrapper::_Create_DX8_Surface(srcWidth,srcHeight, WW3D_FORMAT_R5G6B5); - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Failed to Allocate Shroud Src Surface")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Failed to Allocate Shroud Src Surface")); D3DLOCKED_RECT rect; //Get a pointer to source surface pixels. - HRESULT res = m_pSrcTexture->LockRect(&rect,NULL,D3DLOCK_NO_DIRTY_UPDATE); + HRESULT res = m_pSrcTexture->LockRect(&rect,nullptr,D3DLOCK_NO_DIRTY_UPDATE); m_pSrcTexture->UnlockRect(); DEBUG_ASSERTCRASH( res == D3D_OK, ("Failed to lock shroud src surface")); @@ -201,14 +201,14 @@ void W3DShroud::reset() if (m_pSrcTexture) { m_pSrcTexture->Release(); - m_pSrcTexture=NULL; + m_pSrcTexture=nullptr; } delete [] m_finalFogData; - m_finalFogData=NULL; + m_finalFogData=nullptr; delete [] m_currentFogData; - m_currentFogData=NULL; + m_currentFogData=nullptr; m_clearDstTexture = TRUE; //always refill the destination texture after a reset } @@ -227,7 +227,7 @@ Bool W3DShroud::ReAcquireResources(void) if (!m_dstTextureWidth) return TRUE; //nothing to reaquire since shroud was never initialized with valid data - DEBUG_ASSERTCRASH( m_pDstTexture == NULL, ("ReAcquire of existing shroud texture")); + DEBUG_ASSERTCRASH( m_pDstTexture == nullptr, ("ReAcquire of existing shroud texture")); // Create destination texture (stored in video memory). // Since we control the video memory copy, we can do partial updates more efficiently. Or do shift blits. @@ -238,7 +238,7 @@ Bool W3DShroud::ReAcquireResources(void) #endif m_pDstTexture = MSGNEW("TextureClass") TextureClass(m_dstTextureWidth,m_dstTextureHeight,WW3D_FORMAT_R5G6B5,MIP_LEVELS_1, TextureClass::POOL_DEFAULT); - DEBUG_ASSERTCRASH( m_pDstTexture != NULL, ("Failed ReAcquire of shroud texture")); + DEBUG_ASSERTCRASH( m_pDstTexture != nullptr, ("Failed ReAcquire of shroud texture")); if (!m_pDstTexture) { //could not create a valid texture @@ -257,7 +257,7 @@ Bool W3DShroud::ReAcquireResources(void) //----------------------------------------------------------------------------- W3DShroudLevel W3DShroud::getShroudLevel(Int x, Int y) { - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Reading empty shroud")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Reading empty shroud")); if (x < m_numCellsX && y < m_numCellsY) { @@ -278,7 +278,7 @@ W3DShroudLevel W3DShroud::getShroudLevel(Int x, Int y) //----------------------------------------------------------------------------- void W3DShroud::setShroudLevel(Int x, Int y, W3DShroudLevel level, Bool textureOnly) { - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Writing empty shroud. Usually means that map failed to load.")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Writing empty shroud. Usually means that map failed to load.")); if (!m_pSrcTexture) return; @@ -507,7 +507,7 @@ void W3DShroud::setBorderShroudLevel(W3DShroudLevel level) //----------------------------------------------------------------------------- ///@todo: remove this -TextureClass *DummyTexture=NULL; +TextureClass *DummyTexture=nullptr; //#define LOAD_DUMMY_SHROUD @@ -537,7 +537,7 @@ void W3DShroud::render(CameraClass *cam) } #endif - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Updating unallocated shroud texture")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Updating unallocated shroud texture")); #ifdef LOAD_DUMMY_SHROUD diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp index f1dd583f159..f3f71c7dd09 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp @@ -77,10 +77,10 @@ W3DStatusCircle::~W3DStatusCircle(void) W3DStatusCircle::W3DStatusCircle(void) { - m_indexBuffer=NULL; - m_vertexMaterialClass=NULL; - m_vertexBufferCircle=NULL; - m_vertexBufferScreen=NULL; + m_indexBuffer=nullptr; + m_vertexMaterialClass=nullptr; + m_vertexBufferCircle=nullptr; + m_vertexBufferScreen=nullptr; } @@ -304,10 +304,10 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) if (!TheGameLogic->isInGame() || TheGameLogic->getGameMode() == GAME_SHELL) return; - if (m_indexBuffer == NULL) { + if (m_indexBuffer == nullptr) { initData(); } - if (m_indexBuffer == NULL) { + if (m_indexBuffer == nullptr) { return; } Bool setIndex = false; @@ -320,7 +320,7 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) //Apply the shader and material DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferCircle); setIndex = true; @@ -343,7 +343,7 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) if (!setIndex) { DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); } tm.Make_Identity(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp index 5fe6e86f4e8..257ef93f81b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp @@ -52,7 +52,7 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win) WebBrowserURL *url = findURL( AsciiString(tag) ); - if (url == NULL) { + if (url == nullptr) { DEBUG_LOG(("W3DWebBrowser::createBrowserWindow - couldn't find URL for page %s", tag)); return FALSE; } @@ -62,7 +62,7 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win) #else CComQIPtr idisp(m_dispatch); #endif - if (m_dispatch == NULL) + if (m_dispatch == nullptr) { return FALSE; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index 01e42c7e6e2..7332c3c7d3b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -51,6 +51,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DWaypointBuffer.h" #include @@ -323,9 +324,9 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) corners[3].x = ctr->x - exc + eys; corners[3].y = ctr->y - eyc - exs; - Coord2D *pNearElbow = NULL;//find the closest corner to the rallyPoint same end as door - Coord2D *pFarElbow = NULL; //find the closest corner to the rallypoint away from door - Coord2D *nearCandidate = NULL; + Coord2D *pNearElbow = nullptr;//find the closest corner to the rallyPoint same end as door + Coord2D *pFarElbow = nullptr; //find the closest corner to the rallypoint away from door + Coord2D *nearCandidate = nullptr; Coord3D cornerToRPDelta, cornerToExitDelta; cornerToRPDelta.z = 0.0f; cornerToExitDelta.z = 0.0f; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index ec1e2521ac2..d223721b355 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -173,8 +173,8 @@ Bool W3DRenderObjectSnapshot::removeFromScene() W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj) { - m_robj = NULL; - m_next = NULL; + m_robj = nullptr; + m_next = nullptr; update(robj, drawInfo, cloneParentRobj); } @@ -294,15 +294,15 @@ void W3DRenderObjectSnapshot::loadPostProcess( void ) W3DGhostObject::W3DGhostObject() { for (Int i = 0; i < MAX_PLAYER_COUNT; i++) - m_parentSnapshots[i] = NULL; + m_parentSnapshots[i] = nullptr; - m_drawableInfo.m_drawable = NULL; + m_drawableInfo.m_drawable = nullptr; m_drawableInfo.m_flags = 0; - m_drawableInfo.m_ghostObject = NULL; + m_drawableInfo.m_ghostObject = nullptr; m_drawableInfo.m_shroudStatusObjectID = INVALID_ID; - m_nextSystem = NULL; - m_prevSystem = NULL; + m_nextSystem = nullptr; + m_prevSystem = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -314,12 +314,12 @@ W3DGhostObject::~W3DGhostObject() { for (Int i = 0; i < MAX_PLAYER_COUNT; i++) { - DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + DEBUG_ASSERTCRASH(m_parentSnapshots[i] == nullptr, ("Delete of non-empty GhostObject")); } } else { - DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); + DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == nullptr, ("Delete of non-empty GhostObject")); } #endif } @@ -347,7 +347,7 @@ void W3DGhostObject::snapShot(int playerIndex) draw->setShroudClearFrame(InvalidShroudClearFrame); W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; - W3DRenderObjectSnapshot *prevSnap = NULL; + W3DRenderObjectSnapshot *prevSnap = nullptr; //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) @@ -362,7 +362,7 @@ void W3DGhostObject::snapShot(int playerIndex) //as for build-ups that are currently disabled. if (robj) { - if (snap == NULL) + if (snap == nullptr) { snap = NEW W3DRenderObjectSnapshot(robj, &m_drawableInfo); // poolify if (prevSnap) @@ -413,7 +413,7 @@ void W3DGhostObject::snapShot(int playerIndex) void W3DGhostObject::removeParentObject(void) { // sanity - if( m_parentObject == NULL ) + if( m_parentObject == nullptr ) return; Drawable *draw = m_parentObject->getDrawable(); @@ -437,7 +437,7 @@ void W3DGhostObject::removeParentObject(void) RenderObjClass *robj = w3dDraw->getRenderObject(); if (robj) { - DEBUG_ASSERTCRASH(robj->Peek_Scene() != NULL, ("Removing GhostObject parent not in scene")); + DEBUG_ASSERTCRASH(robj->Peek_Scene() != nullptr, ("Removing GhostObject parent not in scene")); robj->Remove(); } } @@ -530,7 +530,7 @@ void W3DGhostObject::freeSnapShot(int playerIndex) delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex] = NULL; + m_parentSnapshots[playerIndex] = nullptr; } } @@ -624,7 +624,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) m_drawableInfo.m_drawable = TheGameClient->findDrawableByID( drawableID ); // sanity - if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) + if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == nullptr ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); } @@ -657,7 +657,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // sanity, this catches when we read from the file a count of zero, but our data // structure already has something allocated in this snapshot index // - if( snapshotCount == 0 && m_parentSnapshots[ i ] != NULL ) + if( snapshotCount == 0 && m_parentSnapshots[ i ] != nullptr ) { DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; @@ -696,7 +696,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) else { RenderObjClass *renderObject; - W3DRenderObjectSnapshot *prevObjectSnapshot = NULL; + W3DRenderObjectSnapshot *prevObjectSnapshot = nullptr; for( UnsignedByte j = 0; j < snapshotCount; ++j ) { @@ -737,7 +737,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // in the world, we need to remove it // if( m_parentObject && - m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != NULL && + m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr && xfer->getXferMode() == XFER_LOAD ) removeParentObject(); @@ -807,8 +807,8 @@ void W3DGhostObject::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ W3DGhostObjectManager::W3DGhostObjectManager(void) { - m_freeModules = NULL; - m_usedModules = NULL; + m_freeModules = nullptr; + m_usedModules = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -849,7 +849,7 @@ void W3DGhostObjectManager::reset(void) mod = nextmod; } - DEBUG_ASSERTCRASH(m_usedModules == NULL, ("Reset of Non-Empty GhostObjectManager")); + DEBUG_ASSERTCRASH(m_usedModules == nullptr, ("Reset of Non-Empty GhostObjectManager")); //Delete any remaining modules (should be none) mod = m_usedModules; @@ -881,7 +881,7 @@ void W3DGhostObjectManager::removeGhostObject(GhostObject *object) m_usedModules = mod->m_nextSystem; // add module to free list - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -894,11 +894,11 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData { // we disabled adding new ghost objects - used during map border resizing and loading if (m_lockGhostObjects || m_saveLockGhostObjects ) - return NULL; + return nullptr; #if defined(DEBUG_FOG_MEMORY) && defined(DEBUG_CRASHING) // sanity - if( object != NULL ) + if( object != nullptr ) { W3DGhostObject *sanity = m_usedModules; while( sanity ) @@ -926,7 +926,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData mod = NEW W3DGhostObject; // poolify } - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_usedModules; if( m_usedModules ) m_usedModules->m_prevSystem = mod; @@ -934,7 +934,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData //Copy settings from parent object mod->m_parentObject = object; - mod->m_drawableInfo.m_drawable = NULL; //these dummy render objects don't have drawables. + mod->m_drawableInfo.m_drawable = nullptr; //these dummy render objects don't have drawables. mod->m_drawableInfo.m_ghostObject = mod; mod->m_partitionData = pd; @@ -986,10 +986,10 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly updates // all real objects when changing players without waiting for another logic step. // This is particularly noticeable when changing the player while the game is paused. - for (Drawable* draw = TheGameClient->firstDrawable(); draw != NULL; draw = draw->getNextDrawable()) + for (Drawable* draw = TheGameClient->firstDrawable(); draw != nullptr; draw = draw->getNextDrawable()) { Object* obj = draw->getObject(); - if (obj == NULL) + if (obj == nullptr) continue; const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); @@ -1024,7 +1024,7 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play { numStoredSnapshots = 0; - if (playerIndexList != NULL && playerIndexCount > 0) + if (playerIndexList != nullptr && playerIndexCount > 0) { int* playerIndex = playerIndexList; int* const playerIndexEnd = playerIndexList + playerIndexCount; @@ -1046,7 +1046,7 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play if (!numStoredSnapshots) { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData = NULL; + mod->m_partitionData = nullptr; removeGhostObject(mod); } } @@ -1074,14 +1074,14 @@ void W3DGhostObjectManager::releasePartitionData(void) if (!mod->m_parentObject) { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData = NULL; + mod->m_partitionData = nullptr; } else { //The parent object will handle unregistering so just tell to break the //ghost object link. - mod->friend_getPartitionData()->friend_setGhostObject(NULL); - mod->m_partitionData = NULL; + mod->friend_getPartitionData()->friend_setGhostObject(nullptr); + mod->m_partitionData = nullptr; } mod=nextmod; } @@ -1179,8 +1179,8 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) else { // sanity, there should be no ghost objects loaded at this time - DEBUG_ASSERTCRASH( m_usedModules == NULL, - ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!") ); + DEBUG_ASSERTCRASH( m_usedModules == nullptr, + ("W3DGhostObjectManager::xfer - The used module list is not null upon load, but should be!") ); // now it's time to unlock the ghost objects for loading DEBUG_ASSERTCRASH( m_saveLockGhostObjects == TRUE, @@ -1207,11 +1207,11 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) ghostObject = addGhostObject( object, object->friend_getPartitionData() ); // sanity - DEBUG_ASSERTCRASH( ghostObject != NULL, + DEBUG_ASSERTCRASH( ghostObject != nullptr, ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'", object->getTemplate()->getName().str()) ); // link the ghost object and logical object togehter through partition/ghostObject dat - DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == NULL, + DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == nullptr, ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'", object->getTemplate()->getName().str()) ); object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); @@ -1219,7 +1219,7 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) else { // create object with no object or partition data - ghostObject = addGhostObject( NULL, NULL ); + ghostObject = addGhostObject( nullptr, nullptr ); // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 6ece16cdf7a..04284ef67a0 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -48,7 +48,7 @@ W3DTerrainLogic::W3DTerrainLogic(): m_mapMinZ(0), m_mapMaxZ(1) { - m_mapData = NULL; + m_mapData = nullptr; } //------------------------------------------------------------------------------------------------- @@ -318,7 +318,7 @@ Real W3DTerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, C } } Bridge* pBridge; - if ((pBridge = findBridgeLayerAt(&loc, layer, clip)) != 0) + if ((pBridge = findBridgeLayerAt(&loc, layer, clip)) != nullptr) { Real bridgeHeight = pBridge->getBridgeHeight(&loc, normal); if (bridgeHeight > height) diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp index d15828036cc..e528e838a54 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp @@ -131,7 +131,7 @@ void Win32CDDrive::refreshInfo( void ) Bool mayRequireUpdate = (m_disk != CD::NO_DISK); Char volName[1024]; // read the volume info - if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, NULL, NULL, NULL, NULL, 0 )) + if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, nullptr, nullptr, nullptr, nullptr, 0 )) { m_diskName = volName; m_disk = CD::UNKNOWN_DISK; diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 03801ec67a7..22898219c55 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -30,6 +30,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include + #include "Win32Device/Common/Win32GameEngine.h" #include "Common/PerfTimer.h" @@ -97,7 +98,7 @@ void Win32GameEngine::update( void ) Sleep(5); serviceWindowsOS(); - if (TheLAN != NULL) { + if (TheLAN != nullptr) { // BGC - need to update TheLAN so we can process and respond to other // people's messages who may not be alt-tabbed out like we are. TheLAN->setIsActive(isActive()); @@ -130,14 +131,14 @@ void Win32GameEngine::serviceWindowsOS( void ) Int returnValue; // - // see if we have any messages to process, a NULL window handle tells the + // see if we have any messages to process, a nullptr window handle tells the // OS to look at the main window associated with the calling thread, us! // - while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // get the message - returnValue = GetMessage( &msg, NULL, 0, 0 ); + returnValue = GetMessage( &msg, nullptr, 0, 0 ); // this is one possible way to check for quitting conditions as a message // of WM_QUIT will cause GetMessage() to return 0 diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp index 3511d609d78..dd6baa139e2 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp @@ -103,7 +103,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn Int returnResult = 0; if (TheSystemIsUnicode) { - returnResult = ::MessageBoxW(NULL, mesgStr.str(), promptStr.str(), windowsOptionsFlags); + returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags); } else { @@ -114,7 +114,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn mesgA.translate(mesgStr); //Make sure main window is not TOP_MOST ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - returnResult = ::MessageBoxA(NULL, mesgA.str(), promptA.str(), windowsOptionsFlags); + returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags); } if (returnResult == IDOK) { diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index f0b7d39b155..a81065e933e 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -80,7 +80,7 @@ static ErrorLookup errorLookup[] = { (HRESULT)DIERR_REPORTFULL, "DIERR_REPORTFULL" }, { (HRESULT)DIERR_UNPLUGGED, "DIERR_UNPLUGGED" }, { (HRESULT)DIERR_UNSUPPORTED, "DIERR_UNSUPPORTED" }, -{ 0, NULL } +{ 0, nullptr } }; @@ -95,7 +95,7 @@ static void printReturnCode( char *label, HRESULT hr ) { ErrorLookup *error = errorLookup; - while( error->string != NULL ) + while( error->string != nullptr ) { if( error->error == hr ) @@ -121,7 +121,7 @@ void DirectInputKeyboard::openKeyboard( void ) DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&m_pDirectInput, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -135,7 +135,7 @@ void DirectInputKeyboard::openKeyboard( void ) // obtain an interface to the system keyboard device hr = m_pDirectInput->CreateDevice( GUID_SysKeyboard, &m_pKeyboardDevice, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -222,7 +222,7 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pKeyboardDevice->Unacquire(); m_pKeyboardDevice->Release(); - m_pKeyboardDevice = NULL; + m_pKeyboardDevice = nullptr; DEBUG_LOG(( "OK - Keyboard deviced closed" )); } @@ -230,7 +230,7 @@ void DirectInputKeyboard::closeKeyboard( void ) { m_pDirectInput->Release(); - m_pDirectInput = NULL; + m_pDirectInput = nullptr; DEBUG_LOG(( "OK - Keyboard direct input interface closed" )); } @@ -345,8 +345,8 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) DirectInputKeyboard::DirectInputKeyboard( void ) { - m_pDirectInput = NULL; - m_pKeyboardDevice = NULL; + m_pDirectInput = nullptr; + m_pKeyboardDevice = nullptr; if( GetKeyState( VK_CAPITAL ) & 0x01 ) @@ -411,7 +411,7 @@ void DirectInputKeyboard::update( void ) DWORD items = INFINITE; m_pKeyboardDevice->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ), - NULL, &items, 0 ); + nullptr, &items, 0 ); } */ diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 0df595f04ca..561ccd5f125 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -50,7 +50,7 @@ void DirectInputMouse::openMouse( void ) DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&m_pDirectInput, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -62,9 +62,9 @@ void DirectInputMouse::openMouse( void ) } // create a device for the system mouse - hr = m_pDirectInput->CreateDevice( GUID_SysMouse, + hr = m_pDirectInput->CreateDevice( GUID_SysMouse, &m_pMouseDevice, nullptr ); &m_pMouseDevice, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -171,7 +171,7 @@ void DirectInputMouse::closeMouse( void ) m_pMouseDevice->Unacquire(); m_pMouseDevice->Release(); - m_pMouseDevice = NULL; + m_pMouseDevice = nullptr; DEBUG_LOG(( "OK - Mouse device closed" )); } @@ -181,7 +181,7 @@ void DirectInputMouse::closeMouse( void ) { m_pDirectInput->Release(); - m_pDirectInput = NULL; + m_pDirectInput = nullptr; DEBUG_LOG(( "OK - Mouse direct input interface closed" )); } @@ -320,8 +320,8 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, DirectInputMouse::DirectInputMouse( void ) { - m_pDirectInput = NULL; - m_pMouseDevice = NULL; + m_pDirectInput = nullptr; + m_pMouseDevice = nullptr; } @@ -466,20 +466,20 @@ void DirectInputMouse::setCursor( MouseCursor cursor ) { case NONE: - SetCursor( NULL ); + SetCursor( nullptr ); break; case NORMAL: case ARROW: - SetCursor( LoadCursor( NULL, IDC_ARROW ) ); + SetCursor( LoadCursor( nullptr, IDC_ARROW ) ); break; case SCROLL: - SetCursor( LoadCursor( NULL, IDC_SIZEALL ) ); + SetCursor( LoadCursor( nullptr, IDC_SIZEALL ) ); break; case CROSS: - SetCursor( LoadCursor( NULL, IDC_CROSS ) ); + SetCursor( LoadCursor( nullptr, IDC_CROSS ) ); break; } diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index 533c0d908a9..a1625fb6558 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -254,7 +254,7 @@ Win32Mouse::Win32Mouse( void ) m_currentWin32Cursor = NONE; for (Int i=0; i 0); WWASSERT(vertcount > 0); - WWASSERT(polys != NULL); - WWASSERT(verts != NULL); + WWASSERT(polys != nullptr); + WWASSERT(verts != nullptr); /* ** If we already have allocated data, release it @@ -185,7 +185,7 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,TriIndex * polys,int vertc */ Root = W3DNEW CullNodeStruct; Build_Tree(Root,PolyCount,polyindices); - polyindices = NULL; + polyindices = nullptr; /* ** fill in the remaining information needed in the tree: @@ -266,10 +266,10 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the poly array. */ if (arrays.FrontCount) { - WWASSERT(arrays.FrontPolys != NULL); + WWASSERT(arrays.FrontPolys != nullptr); node->Front = W3DNEW CullNodeStruct; Build_Tree(node->Front,arrays.FrontCount,arrays.FrontPolys); - arrays.FrontPolys = NULL; + arrays.FrontPolys = nullptr; } /* @@ -277,11 +277,11 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the tile array. */ if (arrays.BackCount) { - WWASSERT(arrays.BackPolys != NULL); + WWASSERT(arrays.BackPolys != nullptr); node->Back = W3DNEW CullNodeStruct; Build_Tree(node->Back,arrays.BackCount,arrays.BackPolys); - arrays.BackPolys = NULL; + arrays.BackPolys = nullptr; } } @@ -302,7 +302,7 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p AABTreeBuilderClass::SplitChoiceStruct AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { - WWASSERT(polyindices != NULL); + WWASSERT(polyindices != nullptr); const int NUM_TRYS = 50; @@ -889,9 +889,9 @@ void AABTreeBuilderClass::Build_W3D_AABTree_Recursive /* ** If this is a non-leaf node, set up the child indices, otherwise set up the polygon indices */ - if (node->Front != NULL) { + if (node->Front != nullptr) { - WWASSERT(node->Back != NULL); // if we have one child, we better have both! + WWASSERT(node->Back != nullptr); // if we have one child, we better have both! newnode->FrontOrPoly0 = node->Front->Index; newnode->BackOrPolyCount = node->Back->Index; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h index 9098dfb60ee..a54c6171b23 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h @@ -85,7 +85,7 @@ class AABTreeBuilderClass */ struct CullNodeStruct { - CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(NULL),Back(NULL),PolyCount(0),PolyIndices(NULL) {} + CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(nullptr),Back(nullptr),PolyCount(0),PolyIndices(nullptr) {} ~CullNodeStruct(void) { delete Front; @@ -134,8 +134,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys(nullptr) { } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 32a40db2f52..cb6472b884f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -86,32 +86,32 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) : CurMotionMode(BASE_POSE) { // Inline struct members can't be initialized in init list for some reason... - ModeAnim.Motion=NULL; + ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; ModeAnim.LastSyncTime=WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0=NULL; - ModeInterp.Motion1=NULL; + ModeInterp.Motion0=nullptr; + ModeInterp.Motion1=nullptr; ModeInterp.Frame0=0.0f; ModeInterp.PrevFrame0=0.0f; ModeInterp.PrevFrame1=0.0f; ModeInterp.Frame1=0.0f; ModeInterp.Percentage=0.0f; - ModeCombo.AnimCombo=NULL; + ModeCombo.AnimCombo=nullptr; /* ** Store a pointer to the htree */ - if (htree_name == NULL) { - HTree = NULL; + if (htree_name == nullptr) { + HTree = nullptr; } else if (htree_name[0] == 0) { HTree = W3DNEW HTreeClass; HTree->Init_Default (); } else { HTreeClass * source = WW3DAssetManager::Get_Instance()->Get_HTree(htree_name); - if (source != NULL) { + if (source != nullptr) { HTree = W3DNEW HTreeClass(*source); } else { WWDEBUG_SAY(("Unable to find HTree: %s",htree_name)); @@ -139,23 +139,23 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) : CompositeRenderObjClass(src), IsTreeValid(0), CurMotionMode(BASE_POSE), - HTree(NULL) + HTree(nullptr) { // Inline struct members can't be initialized in init list for some reason... - ModeAnim.Motion=NULL; + ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; ModeAnim.LastSyncTime=WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0=NULL; - ModeInterp.Motion1=NULL; + ModeInterp.Motion0=nullptr; + ModeInterp.Motion1=nullptr; ModeInterp.Frame0=0.0f; ModeInterp.PrevFrame0=0.0f; ModeInterp.PrevFrame1=0.0f; ModeInterp.Frame1=0.0f; ModeInterp.Percentage=0.0f; - ModeCombo.AnimCombo=NULL; + ModeCombo.AnimCombo=nullptr; *this = src; } @@ -202,20 +202,20 @@ Animatable3DObjClass & Animatable3DObjClass::operator = (const Animatable3DObjCl IsTreeValid = 0; CurMotionMode = BASE_POSE; - ModeAnim.Motion = NULL; + ModeAnim.Motion = nullptr; ModeAnim.Frame = 0.0f; ModeAnim.PrevFrame = 0.0f; ModeAnim.LastSyncTime = WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0 = NULL; - ModeInterp.Motion1 = NULL; + ModeInterp.Motion0 = nullptr; + ModeInterp.Motion1 = nullptr; ModeInterp.Frame0 = 0.0f; ModeInterp.PrevFrame0 = 0.0f; ModeInterp.PrevFrame1 = 0.0f; ModeInterp.Frame1 = 0.0f; ModeInterp.Percentage = 0.0f; - ModeCombo.AnimCombo = NULL; + ModeCombo.AnimCombo = nullptr; delete HTree; HTree = W3DNEW HTreeClass(*that.HTree); @@ -243,21 +243,21 @@ void Animatable3DObjClass::Release( void ) break; case SINGLE_ANIM: - if ( ModeAnim.Motion != NULL ) { + if ( ModeAnim.Motion != nullptr ) { ModeAnim.Motion->Release_Ref(); - ModeAnim.Motion = NULL; + ModeAnim.Motion = nullptr; } break; case DOUBLE_ANIM: - if ( ModeInterp.Motion0 != NULL ) { + if ( ModeInterp.Motion0 != nullptr ) { ModeInterp.Motion0->Release_Ref(); - ModeInterp.Motion0 = NULL; + ModeInterp.Motion0 = nullptr; } - if ( ModeInterp.Motion1 != NULL ) { + if ( ModeInterp.Motion1 != nullptr ) { ModeInterp.Motion1->Release_Ref(); - ModeInterp.Motion1 = NULL; + ModeInterp.Motion1 = nullptr; } break; @@ -283,7 +283,7 @@ void Animatable3DObjClass::Release( void ) *=============================================================================================*/ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) { - if (HTree == NULL) return; + if (HTree == nullptr) return; if (Is_Not_Hidden_At_All() == false) { return; @@ -313,7 +313,7 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) *=============================================================================================*/ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { - if (HTree == NULL) return; + if (HTree == nullptr) return; // // Force the hierarchy to be recalculated for single animations. @@ -532,7 +532,7 @@ void Animatable3DObjClass::Set_Animation ModeInterp.Percentage = percentage; Set_Hierarchy_Valid(false); - if ( ModeInterp.Motion0 != NULL ) { + if ( ModeInterp.Motion0 != nullptr ) { ModeInterp.Motion0->Add_Ref(); const char* sound_name = AnimatedSoundMgrClass::Get_Embedded_Sound_Name(motion0); if (sound_name) { @@ -541,7 +541,7 @@ void Animatable3DObjClass::Set_Animation } } - if ( ModeInterp.Motion1 != NULL ) { + if ( ModeInterp.Motion1 != nullptr ) { ModeInterp.Motion1->Add_Ref(); const char* sound_name = AnimatedSoundMgrClass::Get_Embedded_Sound_Name(motion1); if (sound_name) { @@ -607,7 +607,7 @@ HAnimClass * Animatable3DObjClass::Peek_Animation( void ) if ( CurMotionMode == SINGLE_ANIM ) { return ModeAnim.Motion; } else { - return NULL; + return nullptr; } } @@ -832,7 +832,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) for (int index = 0; index < count; index ++) { HAnimClass *motion = ModeCombo.AnimCombo->Peek_Motion(index); - if ( motion != NULL && motion->Has_Embedded_Sounds() ) { + if ( motion != nullptr && motion->Has_Embedded_Sounds() ) { float prev_frame = AnimatedSoundMgrClass::Trigger_Sound(motion, ModeCombo.AnimCombo->Get_Prev_Frame(index), ModeCombo.AnimCombo->Get_Frame(index), HTree->Get_Transform(motion->Get_Embedded_Sound_Bone_Index())); ModeCombo.AnimCombo->Set_Prev_Frame(index, prev_frame); @@ -908,7 +908,7 @@ bool Animatable3DObjClass::Simple_Evaluate_Bone(int boneindex, float frame, Matr // // Only do this for simple animations // - if (HTree != NULL) { + if (HTree != nullptr) { if (CurMotionMode == SINGLE_ANIM) { retval = HTree->Simple_Evaluate_Pivot (ModeAnim.Motion, boneindex, frame, Get_Transform (), tm); } @@ -1091,7 +1091,7 @@ HAnimClass * Animatable3DObjClass::Peek_Animation_And_Info(float& frame, int& nu mult = ModeAnim.frameRateMultiplier; return ModeAnim.Motion; } else { - return NULL; + return nullptr; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 1e2ad69f8f9..2594251be0e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -123,7 +123,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass protected: // internally used to compute the current frame if the object is in ANIM_MODE_MANUAL - float Compute_Current_Frame(float *newDirection=NULL) const; + float Compute_Current_Frame(float *newDirection=nullptr) const; // Update the sub-object transforms according to the current anim state and root transform. virtual void Update_Sub_Object_Transforms(void); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index 15afd75578c..65a487d32f6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -120,7 +120,7 @@ /* ** Static member variable which keeps track of the single instanced asset manager */ -WW3DAssetManager * WW3DAssetManager::TheInstance = NULL; +WW3DAssetManager * WW3DAssetManager::TheInstance = nullptr; /* ** Static instance of the Null prototype. This render object is special cased @@ -176,7 +176,7 @@ class Font3DDataIterator : public AssetIterator virtual void First(void) { Node = WW3DAssetManager::Get_Instance()->Font3DDatas.Head(); } virtual void Next(void) { Node = Node->Next(); } - virtual bool Is_Done(void) { return Node==NULL; } + virtual bool Is_Done(void) { return Node==nullptr; } virtual const char * Current_Item_Name(void) { return Node->Data()->Name; } protected: @@ -205,9 +205,9 @@ WW3DAssetManager::WW3DAssetManager(void) : WW3D_Load_On_Demand (false), Activate_Fog_On_Load (false), - MetalManager(0) + MetalManager(nullptr) { - assert(TheInstance == NULL); + assert(TheInstance == nullptr); TheInstance = this; // set the growth rates @@ -253,10 +253,10 @@ WW3DAssetManager::~WW3DAssetManager(void) delete MetalManager; Free(); - TheInstance = NULL; + TheInstance = nullptr; delete [] PrototypeHashTable; - PrototypeHashTable = NULL; + PrototypeHashTable = nullptr; } static void Create_Number_String(StringClass& number, unsigned value) @@ -448,7 +448,7 @@ void WW3DAssetManager::Free_Assets(void) PrototypeClass * proto = Prototypes[count]; Prototypes.Delete(count); - if (proto != NULL) { + if (proto != nullptr) { proto->DeleteSelf(); } } @@ -527,7 +527,7 @@ void WW3DAssetManager::Free_Assets_With_Exclusion_List(const DynamicVectorClass< for (; iGet_Name())); proto->DeleteSelf(); } - Prototypes[i] = NULL; + Prototypes[i] = nullptr; } } @@ -589,7 +589,7 @@ void WW3DAssetManager::Create_Asset_List(DynamicVectorClass & model if (proto) { const char * name = proto->Get_Name(); - if ((strchr(name,'#') == NULL) && (strchr(name,'.') == NULL)) { + if ((strchr(name,'#') == nullptr) && (strchr(name,'.') == nullptr)) { model_list.Add(StringClass(name)); } } @@ -707,9 +707,9 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) ** Find a loader that handles that type of chunk */ PrototypeLoaderClass * loader = Find_Prototype_Loader(chunk_id); - PrototypeClass * newproto = NULL; + PrototypeClass * newproto = nullptr; - if (loader != NULL) { + if (loader != nullptr) { /* ** Ask it to create a prototype from the contents of the @@ -730,7 +730,7 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) ** Now, see if the prototype that we loaded has a duplicate ** name with any of our currently loaded prototypes (can't have that!) */ - if (newproto != NULL) { + if (newproto != nullptr) { if (!Render_Obj_Exists(newproto->Get_Name())) { @@ -747,7 +747,7 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) */ WWDEBUG_SAY(("Render Object Name Collision: %s",newproto->Get_Name())); newproto->DeleteSelf(); - newproto = NULL; + newproto = nullptr; return false; } @@ -788,12 +788,12 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) // Try to find a prototype PrototypeClass * proto = Find_Prototype(name); - if (WW3D_Load_On_Demand && proto == NULL) { // If we didn't find one, try to load on demand + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand AssetStatusClass::Peek_Instance()->Report_Load_On_Demand_RObj(name); char filename [MAX_PATH]; const char *mesh_name = ::strchr (name, '.'); - if (mesh_name != NULL) { + if (mesh_name != nullptr) { ::lstrcpyn (filename, name, ((int)mesh_name) - ((int)name) + 1); ::lstrcat (filename, ".w3d"); } else { @@ -810,7 +810,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) proto = Find_Prototype(name); // try again } - if (proto == NULL) { + if (proto == nullptr) { static int warning_count = 0; // Note - objects named "#..." are scaled cached objects, so don't warn... if (name[0] != '#') { @@ -819,7 +819,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) } AssetStatusClass::Peek_Instance()->Report_Missing_RObj(name); } - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } return proto->Create(); @@ -840,7 +840,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) *=============================================================================================*/ bool WW3DAssetManager::Render_Obj_Exists(const char * name) { - if (Find_Prototype(name) == NULL) return false; + if (Find_Prototype(name) == nullptr) return false; else return true; } @@ -881,7 +881,7 @@ RenderObjIterator * WW3DAssetManager::Create_Render_Obj_Iterator(void) *=============================================================================================*/ void WW3DAssetManager::Release_Render_Obj_Iterator(RenderObjIterator * it) { - WWASSERT(it != NULL); + WWASSERT(it != nullptr); delete it; } @@ -966,7 +966,7 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) // Try to find the hanim HAnimClass * anim = HAnimManager.Get_Anim(name); - if (WW3D_Load_On_Demand && anim == NULL) { // If we didn't find it, try to load on demand + if (WW3D_Load_On_Demand && anim == nullptr) { // If we didn't find it, try to load on demand if ( !HAnimManager.Is_Missing( name ) ) { // if this is NOT a known missing anim @@ -974,12 +974,12 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) char filename[ MAX_PATH ]; const char *animname = strchr( name, '.'); - if (animname != NULL) { + if (animname != nullptr) { sprintf( filename, "%s.w3d", animname+1); } else { WWDEBUG_SAY(( "Animation %s has no . in the name", name )); WWASSERT( 0 ); - return NULL; + return nullptr; } // If we can't find it, try the parent directory @@ -989,7 +989,7 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) } anim = HAnimManager.Get_Anim(name); // Try agai - if (anim == NULL) { + if (anim == nullptr) { HAnimManager.Register_Missing( name ); // This is now a KNOWN missing anim AssetStatusClass::Peek_Instance()->Report_Missing_HAnim(name); } @@ -1020,7 +1020,7 @@ HTreeClass * WW3DAssetManager::Get_HTree(const char * name) // Try to find the htree HTreeClass * htree = HTreeManager.Get_Tree(name); - if (WW3D_Load_On_Demand && htree == NULL) { // If we didn't find it, try to load on demand + if (WW3D_Load_On_Demand && htree == nullptr) { // If we didn't find it, try to load on demand AssetStatusClass::Peek_Instance()->Report_Load_On_Demand_HTree(name); @@ -1036,7 +1036,7 @@ HTreeClass * WW3DAssetManager::Get_HTree(const char * name) htree = HTreeManager.Get_Tree(name); // Try again - if (htree == NULL) { + if (htree == nullptr) { AssetStatusClass::Peek_Instance()->Report_Missing_HTree(name); } } @@ -1079,9 +1079,9 @@ TextureClass * WW3DAssetManager::Get_Texture /* ** Bail if the user isn't really asking for anything */ - if ((filename == NULL) || (strlen(filename) == 0)) + if ((filename == nullptr) || (strlen(filename) == 0)) { - return NULL; + return nullptr; } StringClass lower_case_name(filename,true); @@ -1103,20 +1103,20 @@ TextureClass * WW3DAssetManager::Get_Texture { if (type==TextureBaseClass::TEX_REGULAR) { - tex = NEW_REF (TextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (TextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else if (type==TextureBaseClass::TEX_CUBEMAP) { - tex = NEW_REF (CubeTextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (CubeTextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else if (type==TextureBaseClass::TEX_VOLUME) { - tex = NEW_REF (VolumeTextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (VolumeTextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else { WWASSERT_PRINT(false, ("Unhandled case")); - return NULL; + return nullptr; } TextureHash.Insert(tex->Get_Texture_Name(),tex); @@ -1398,7 +1398,7 @@ void WW3DAssetManager::Release_All_Font3DDatas( void ) { // for each mat in the list, get it and release ref it Font3DDataClass *head; - while ((head = Font3DDatas.Remove_Head()) != NULL ) { + while ((head = Font3DDatas.Remove_Head()) != nullptr ) { head->Release_Ref(); } } @@ -1466,7 +1466,7 @@ FontCharsClass * WW3DAssetManager::Get_FontChars( const char * name, int point_s } font->Release_Ref(); - return NULL; + return nullptr; } @@ -1511,7 +1511,7 @@ void WW3DAssetManager::Release_All_FontChars( void ) *=============================================================================================*/ void WW3DAssetManager::Register_Prototype_Loader(PrototypeLoaderClass * loader) { - WWASSERT(loader != NULL); + WWASSERT(loader != nullptr); PrototypeLoaders.Add(loader); } @@ -1523,7 +1523,7 @@ void WW3DAssetManager::Register_Prototype_Loader(PrototypeLoaderClass * loader) * chunk_id - chunk type that the loader needs to handle * * * * OUTPUT: * - * pointer to the appropriate loader or NULL if one wasn't found * + * pointer to the appropriate loader or null if one wasn't found * * * * WARNINGS: * * * @@ -1538,7 +1538,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) return loader; } } - return NULL; + return nullptr; } @@ -1558,7 +1558,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) *=============================================================================================*/ void WW3DAssetManager::Add_Prototype(PrototypeClass * newproto) { - WWASSERT(newproto != NULL); + WWASSERT(newproto != nullptr); int hash = CRC_Stringi(newproto->Get_Name()) & PROTOTYPE_HASH_MASK; newproto->friend_setNextHash(PrototypeHashTable[hash]); PrototypeHashTable[hash] = newproto; @@ -1580,25 +1580,25 @@ void WW3DAssetManager::Add_Prototype(PrototypeClass * newproto) *=============================================================================================*/ void WW3DAssetManager::Remove_Prototype(PrototypeClass *proto) { - WWASSERT(proto != NULL); - if (proto != NULL) { + WWASSERT(proto != nullptr); + if (proto != nullptr) { // // Find the prototype in the hash table. // const char *pname = proto->Get_Name (); bool bfound = false; - PrototypeClass *prev = NULL; + PrototypeClass *prev = nullptr; int hash = CRC_Stringi(pname) & PROTOTYPE_HASH_MASK; for (PrototypeClass *test = PrototypeHashTable[hash]; - (test != NULL) && (bfound == false); + (test != nullptr) && (bfound == false); test = test->friend_getNextHash()) { // Is this the prototype? if (::stricmp (test->Get_Name(), pname) == 0) { // Remove this prototype from the linked list for this hash index. - if (prev == NULL) { + if (prev == nullptr) { PrototypeHashTable[hash] = test->friend_getNextHash(); } else { prev->friend_setNextHash(test->friend_getNextHash()); @@ -1634,12 +1634,12 @@ void WW3DAssetManager::Remove_Prototype(PrototypeClass *proto) *=============================================================================================*/ void WW3DAssetManager::Remove_Prototype(const char *name) { - WWASSERT(name != NULL); - if (name != NULL) { + WWASSERT(name != nullptr); + if (name != nullptr) { // Lookup the prototype by name PrototypeClass *proto = Find_Prototype (name); - if (proto != NULL) { + if (proto != nullptr) { // Remove the prototype from our lists, and free its memory Remove_Prototype (proto); @@ -1675,13 +1675,13 @@ PrototypeClass * WW3DAssetManager::Find_Prototype(const char * name) int hash = CRC_Stringi(name) & PROTOTYPE_HASH_MASK; PrototypeClass * test = PrototypeHashTable[hash]; - while (test != NULL) { + while (test != nullptr) { if (stricmp(test->Get_Name(),name) == 0) { return test; } test = test->friend_getNextHash(); } - return NULL; + return nullptr; } /* @@ -1701,7 +1701,7 @@ const char * RObjIterator::Current_Item_Name(void) if (Index < WW3DAssetManager::Get_Instance()->Prototypes.Count()) { return WW3DAssetManager::Get_Instance()->Prototypes[Index]->Get_Name(); } else { - return NULL; + return nullptr; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h index f3f1ca83f79..e8f60565490 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -201,7 +201,7 @@ class WW3DAssetManager ** WW3DAssetManager::Get_Instance(); */ static WW3DAssetManager * Get_Instance(void) { return TheInstance; } - static void Delete_This(void) { delete TheInstance; TheInstance=NULL; } + static void Delete_This(void) { delete TheInstance; TheInstance=nullptr; } /* ** Load data from any type of w3d file diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp index 829cb1406c9..b30cb81222f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp @@ -158,7 +158,7 @@ static Vector3 _BoxVertexNormals[NUM_BOX_VERTS] = bool BoxRenderObjClass::IsInitted = false; int BoxRenderObjClass::DisplayMask = 0; -static VertexMaterialClass * _BoxMaterial = NULL; +static VertexMaterialClass * _BoxMaterial = nullptr; static ShaderClass _BoxShader; @@ -306,7 +306,7 @@ const char * BoxRenderObjClass::Get_Name(void) const *=============================================================================================*/ void BoxRenderObjClass::Set_Name(const char * name) { - WWASSERT(name != NULL); + WWASSERT(name != nullptr); size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name)); (void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name)); } @@ -351,7 +351,7 @@ void BoxRenderObjClass::Init(void) /* ** Set up the materials */ - WWASSERT(_BoxMaterial == NULL); + WWASSERT(_BoxMaterial == nullptr); _BoxMaterial = NEW_REF(VertexMaterialClass,()); _BoxMaterial->Set_Ambient(0,0,0); _BoxMaterial->Set_Diffuse(0,0,0); @@ -506,7 +506,7 @@ void BoxRenderObjClass::render_box(RenderInfoClass & rinfo,const Vector3 & cente */ DX8Wrapper::Set_Material(_BoxMaterial); DX8Wrapper::Set_Shader(_BoxShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Set_Index_Buffer(ibaccess,0); DX8Wrapper::Set_Vertex_Buffer(vbaccess); @@ -724,7 +724,7 @@ void AABoxRenderObjClass::Render(RenderInfoClass & rinfo) void AABoxRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); Matrix3D temp(1); temp.Translate(Transform.Get_Translation()); rinfo.VisRasterizer->Set_Model_Transform(temp); @@ -1101,7 +1101,7 @@ void OBBoxRenderObjClass::Render(RenderInfoClass & rinfo) void OBBoxRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Set_Model_Transform(Transform); vis_render_box(rinfo,ObjSpaceCenter,ObjSpaceExtent); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp index aadd17ced0c..bb9031fd477 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -771,7 +771,7 @@ float CameraClass::Get_Aspect_Ratio(void) const void CameraClass::Get_Projection_Matrix(Matrix4x4 * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = ProjectionTransform; @@ -779,7 +779,7 @@ void CameraClass::Get_Projection_Matrix(Matrix4x4 * set_tm) void CameraClass::Get_D3D_Projection_Matrix(Matrix4x4 * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = ProjectionTransform; @@ -800,7 +800,7 @@ void CameraClass::Get_D3D_Projection_Matrix(Matrix4x4 * set_tm) void CameraClass::Get_View_Matrix(Matrix3D * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = CameraInvTransform; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h index db25bf92605..c56f3df5f19 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -287,10 +287,10 @@ inline void CameraClass::Set_Depth_Range(float zmin,float zmax) inline void CameraClass::Get_Depth_Range(float * set_zmin,float * set_zmax) const { - if (set_zmin != NULL) { + if (set_zmin != nullptr) { *set_zmin = ZBufferMin; } - if (set_zmax != NULL) { + if (set_zmax != nullptr) { *set_zmax = ZBufferMax; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index de63c6bdd62..3e2949b08ea 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -232,7 +232,7 @@ static DazzleTypeClass** types; static unsigned type_count; // Current dazzle layer - must be set before rendering -static DazzleLayerClass * current_dazzle_layer = NULL; +static DazzleLayerClass * current_dazzle_layer = nullptr; static LensflareTypeClass** lensflares; static unsigned lensflare_count; @@ -298,9 +298,9 @@ class DazzleINIClass : public INIClass { const Vector2 DazzleINIClass::Get_Vector2(char const *section, char const *entry, const Vector2 & defvalue) { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector2 ret; if ( sscanf( entryptr->Value, "%f,%f", &ret[0], &ret[1] ) == 2 ) { return ret; @@ -312,9 +312,9 @@ const Vector2 DazzleINIClass::Get_Vector2(char const *section, char const *entry const Vector3 DazzleINIClass::Get_Vector3(char const *section, char const * entry, const Vector3 & defvalue ) { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector3 ret; if ( sscanf( entryptr->Value, "%f,%f,%f", &ret[0], &ret[1], &ret[2] ) == 3 ) { return ret; @@ -326,9 +326,9 @@ const Vector3 DazzleINIClass::Get_Vector3(char const *section, char const * entr const Vector4 DazzleINIClass::Get_Vector4(char const *section, char const *entry, const Vector4 & defvalue) const { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector4 ret; if ( sscanf( entryptr->Value, "%f,%f,%f,%f", &ret[0], &ret[1], &ret[2], &ret[3] ) == 4 ) { return ret; @@ -343,7 +343,7 @@ const Vector4 DazzleINIClass::Get_Vector4(char const *section, char const *entry LensflareTypeClass::LensflareTypeClass(const LensflareInitClass& is) : lic(is), - texture(NULL) + texture(nullptr) { } @@ -432,8 +432,8 @@ DazzleTypeClass::DazzleTypeClass(const DazzleInitClass& is) ic(is), dazzle_shader(default_dazzle_shader), halo_shader(default_halo_shader), - primary_texture(NULL), - secondary_texture(NULL), + primary_texture(nullptr), + secondary_texture(nullptr), lensflare_id(DazzleRenderObjClass::Get_Lensflare_ID(is.lensflare_name)), radius(is.radius) { @@ -572,9 +572,9 @@ void DazzleRenderObjClass::Init_From_INI(const INIClass* ini) lic.flare_uv=W3DNEWARRAY Vector4[lic.flare_count]; } else { - lic.flare_locations=NULL; - lic.flare_sizes=NULL; - lic.flare_colors=NULL; + lic.flare_locations=nullptr; + lic.flare_sizes=nullptr; + lic.flare_colors=nullptr; } for (int flare=0;flare=type_count) return NULL; + if (id>=type_count) return nullptr; return types[id]; } @@ -1284,13 +1284,13 @@ unsigned DazzleRenderObjClass::Get_Lensflare_ID(const char* name) // // Return pointer to LensflareTypeClass object with given id. If the id is out // of range (usually UINT_MAX, in can the id was obtained with invalid name -// string) return NULL. +// string) return null. // // ---------------------------------------------------------------------------- -LensflareTypeClass* DazzleRenderObjClass::Get_Lensflare_Class(unsigned id) // Return lensflare type class pointer, or NULL if not found +LensflareTypeClass* DazzleRenderObjClass::Get_Lensflare_Class(unsigned id) // Return lensflare type class pointer, or null if not found { - if (id>=lensflare_count) return NULL; + if (id>=lensflare_count) return nullptr; return lensflares[id]; } @@ -1350,7 +1350,7 @@ uint32 DazzlePersistFactoryClass::Chunk_ID(void) const PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const { - DazzleRenderObjClass * old_obj = NULL; + DazzleRenderObjClass * old_obj = nullptr; Matrix3D tm(1); char dazzle_type[256]; dazzle_type[0] = 0; @@ -1390,18 +1390,18 @@ PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const RenderObjClass * new_obj = NEW_REF(DazzleRenderObjClass,(dazzle_type)); /* - ** If we failed to create it, replace it with a NULL + ** If we failed to create it, replace it with a nullptr */ - if (new_obj == NULL) { + if (new_obj == nullptr) { static int count = 0; if ( count++ < 10 ) { WWDEBUG_SAY(("DazzlePersistFactory failed to create dazzle of type: %s!!",dazzle_type)); - WWDEBUG_SAY(("Replacing it with a NULL render object!")); + WWDEBUG_SAY(("Replacing it with a null render object!")); } new_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj("NULL"); } - WWASSERT(new_obj != NULL); + WWASSERT(new_obj != nullptr); if (new_obj) { new_obj->Set_Transform(tm); } @@ -1445,7 +1445,7 @@ const PersistFactoryClass & DazzleRenderObjClass::Get_Factory (void) const ** **********************************************************************************************/ DazzleLayerClass::DazzleLayerClass(void) : - visible_lists(NULL) + visible_lists(nullptr) { // Generate an array with one visible list for each type. // NOTE - this means that this constructor must be called AFTER all types @@ -1454,7 +1454,7 @@ DazzleLayerClass::DazzleLayerClass(void) : visible_lists = W3DNEWARRAY DazzleRenderObjClass *[type_count]; for (unsigned int i = 0; i < type_count; i++) { - visible_lists[i] = NULL; + visible_lists[i] = nullptr; } } @@ -1476,7 +1476,7 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - DX8Wrapper::Set_Material(NULL); + DX8Wrapper::Set_Material(nullptr); for (unsigned type=0;typeSucc(); } - visible_lists[type] = NULL; + visible_lists[type] = nullptr; } /********************************************************************************************** @@ -1553,7 +1553,7 @@ float DazzleVisibilityClass::Compute_Dazzle_Visibility */ SceneClass * scene = dazzle->Get_Scene(); RenderObjClass * container = dazzle->Get_Container(); - while ((scene == NULL) && (container != NULL)) { + while ((scene == nullptr) && (container != nullptr)) { scene = container->Get_Scene(); container = container->Get_Container(); } @@ -1561,7 +1561,7 @@ float DazzleVisibilityClass::Compute_Dazzle_Visibility /* ** If we found the scene (we SHOULD!) then ask it to compute the visibility */ - if (scene != NULL) { + if (scene != nullptr) { float value = scene->Compute_Point_Visibility(rinfo,point); scene->Release_Ref(); return value; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h index 5c59019771e..28aede3f164 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h @@ -313,11 +313,11 @@ class DazzleRenderObjClass : public RenderObjClass static void Init_From_INI(const INIClass* ini); static unsigned Get_Type_ID(const char* name); // Return the ID of type with given name, or INT_MAX if failed static const char * Get_Type_Name(unsigned int id); // Return the name of the type with the given ID - static DazzleTypeClass* Get_Type_Class(unsigned id); // Return dazzle type class pointer, or NULL if not found + static DazzleTypeClass* Get_Type_Class(unsigned id); // Return dazzle type class pointer, or null if not found // The pointer is NOT refcounted - all types are deinitialised // when exiting the level. static unsigned Get_Lensflare_ID(const char* name); // Return the ID of lensflare with given name, or INT_MAX if failed - static LensflareTypeClass* Get_Lensflare_Class(unsigned id); // Return lensflare type class pointer, or NULL if not found + static LensflareTypeClass* Get_Lensflare_Class(unsigned id); // Return lensflare type class pointer, or null if not found static void Deinit(); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp index 300d9132700..98ff4c7b846 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp @@ -17,6 +17,7 @@ */ // 08/06/02 KM Added cube map and volume texture support + #include "ddsfile.h" #include "ffactory.h" #include "bufffile.h" @@ -30,15 +31,15 @@ DDSFileClass::DDSFileClass(const char* name,unsigned reduction_factor) : - DDSMemory(NULL), + DDSMemory(nullptr), Width(0), Height(0), Depth(0), FullWidth(0), FullHeight(0), FullDepth(0), - LevelSizes(NULL), - LevelOffsets(NULL), + LevelSizes(nullptr), + LevelOffsets(nullptr), MipLevels(0), ReductionFactor(reduction_factor), Format(WW3D_FORMAT_UNKNOWN), @@ -360,7 +361,7 @@ void DDSFileClass::Copy_Level_To_Surface(unsigned level,IDirect3DSurface8* d3d_s // First lock the surface D3DLOCKED_RECT locked_rect; - DX8_ErrorCode(d3d_surface->LockRect(&locked_rect,NULL,0)); + DX8_ErrorCode(d3d_surface->LockRect(&locked_rect,nullptr,0)); Copy_Level_To_Surface( level, @@ -705,7 +706,7 @@ void DDSFileClass::Copy_CubeMap_Level_To_Surface // volume texture copy const unsigned char* DDSFileClass::Get_Volume_Memory_Pointer(unsigned int level) const { - return NULL;//DDSMemory[ + return nullptr;//DDSMemory[ } void DDSFileClass::Copy_Volume_Level_To_Surface diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp index b97dfdbf0cf..05ac69336ca 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp @@ -198,8 +198,8 @@ DecalMeshClass::DecalMeshClass(MeshClass * parent,DecalSystemClass * system) : Parent(parent), DecalSystem(system) { - WWASSERT(Parent != NULL); - WWASSERT(DecalSystem != NULL); + WWASSERT(Parent != nullptr); + WWASSERT(DecalSystem != nullptr); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 7e818fcbed9..851fb1a3313 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -52,7 +52,7 @@ static unsigned short _DynamicSortingIndexArraySize=0; static unsigned short _DynamicSortingIndexArrayOffset=0; static bool _DynamicDX8IndexBufferInUse=false; -static DX8IndexBufferClass* _DynamicDX8IndexBuffer=NULL; +static DX8IndexBufferClass* _DynamicDX8IndexBuffer=nullptr; static unsigned short _DynamicDX8IndexBufferSize=DEFAULT_IB_SIZE; static unsigned short _DynamicDX8IndexBufferOffset=0; @@ -339,7 +339,7 @@ SortingIndexBufferClass::~SortingIndexBufferClass() DynamicIBAccessClass::DynamicIBAccessClass(unsigned short type_, unsigned short index_count_) : IndexCount(index_count_), - IndexBuffer(0), + IndexBuffer(nullptr), Type(type_) { WWASSERT(Type==BUFFER_TYPE_DYNAMIC_DX8 || Type==BUFFER_TYPE_DYNAMIC_SORTING); @@ -366,13 +366,13 @@ DynamicIBAccessClass::~DynamicIBAccessClass() void DynamicIBAccessClass::_Deinit() { - WWASSERT ((_DynamicDX8IndexBuffer == NULL) || (_DynamicDX8IndexBuffer->Num_Refs() == 1)); + WWASSERT ((_DynamicDX8IndexBuffer == nullptr) || (_DynamicDX8IndexBuffer->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicDX8IndexBuffer); _DynamicDX8IndexBufferInUse=false; _DynamicDX8IndexBufferSize=DEFAULT_IB_SIZE; _DynamicDX8IndexBufferOffset=0; - WWASSERT ((_DynamicSortingIndexArray == NULL) || (_DynamicSortingIndexArray->Num_Refs() == 1)); + WWASSERT ((_DynamicSortingIndexArray == nullptr) || (_DynamicSortingIndexArray->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicSortingIndexArray); _DynamicSortingIndexArrayInUse=false; _DynamicSortingIndexArraySize=0; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp index 687b972af38..35e690b3bf0 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -101,10 +101,10 @@ class PolyRenderTaskClass : public AutoPoolClass PolyRenderTaskClass(DX8PolygonRendererClass * p_renderer,MeshClass * p_mesh) : Renderer(p_renderer), Mesh(p_mesh), - NextVisible(NULL) + NextVisible(nullptr) { - WWASSERT(Renderer != NULL); - WWASSERT(Mesh != NULL); + WWASSERT(Renderer != nullptr); + WWASSERT(Mesh != nullptr); Mesh->Add_Ref(); } @@ -142,10 +142,10 @@ class MatPassTaskClass : public AutoPoolClass MatPassTaskClass(MaterialPassClass * pass,MeshClass * mesh) : MaterialPass(pass), Mesh(mesh), - NextVisible(NULL) + NextVisible(nullptr) { - WWASSERT(MaterialPass != NULL); - WWASSERT(Mesh != NULL); + WWASSERT(MaterialPass != nullptr); + WWASSERT(Mesh != nullptr); MaterialPass->Add_Ref(); Mesh->Add_Ref(); } @@ -192,7 +192,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( : pass(pass_), shader(shd), - render_task_head(NULL), + render_task_head(nullptr), material(mat), container(container_) { @@ -201,7 +201,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( for (int a=0;aSet_Texture_Category(NULL); - if (PolygonRendererList.Peek_Head() == NULL) { + p_renderer->Set_Texture_Category(nullptr); + if (PolygonRendererList.Peek_Head() == nullptr) { container->Remove_Texture_Category(this); texture_category_delete_list.Add_Tail(this); } @@ -267,7 +267,7 @@ void DX8FVFCategoryContainer::Remove_Texture_Category(DX8TextureCategoryClass* t } for (pass=0; passSet_Next_Visible(new_mpr); } @@ -292,10 +292,10 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) { // additional passes MatPassTaskClass * mpr = visible_matpass_head; - MatPassTaskClass * last_mpr = NULL; + MatPassTaskClass * last_mpr = nullptr; bool renderTasksRemaining=false; - while (mpr != NULL) { + while (mpr != nullptr) { MeshClass * mesh = mpr->Peek_Mesh(); @@ -311,7 +311,7 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) MatPassTaskClass * next_mpr = mpr->Get_Next_Visible(); // remove from list, then delete - if (last_mpr == NULL) { + if (last_mpr == nullptr) { visible_matpass_head = next_mpr; } else { last_mpr->Set_Next_Visible(next_mpr); @@ -321,7 +321,7 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) mpr = next_mpr; } - visible_matpass_tail = renderTasksRemaining ? last_mpr : NULL; + visible_matpass_tail = renderTasksRemaining ? last_mpr : nullptr; } @@ -362,7 +362,7 @@ void DX8TextureCategoryClass::Log(bool only_visible) prtc = prtc->Get_Next_Visible(); } - if (prtc != NULL) { + if (prtc != nullptr) { WWDEBUG_SAY(("+")); p_renderer->Log(); } else { @@ -382,9 +382,9 @@ DX8FVFCategoryContainer::DX8FVFCategoryContainer(unsigned FVF_,bool sorting_) : FVF(FVF_), sorting(sorting_), - visible_matpass_head(NULL), - visible_matpass_tail(NULL), - index_buffer(0), + visible_matpass_head(nullptr), + visible_matpass_tail(nullptr), + index_buffer(nullptr), used_indices(0), passes(MAX_PASSES), uv_coordinate_channels(0), @@ -422,7 +422,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category DX8TextureCategoryClass* ref_category) { // Find texture category which matches ref_category's properties but has 'texture' on given pass and stage. - DX8TextureCategoryClass* dest_tex_category=NULL; + DX8TextureCategoryClass* dest_tex_category=nullptr; TextureCategoryListIterator dest_it(&texture_category_list[pass]); while (!dest_it.Is_Done()) { if (dest_it.Peek_Obj()->Peek_Texture(stage)==texture) { @@ -442,7 +442,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category( @@ -451,7 +451,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category DX8TextureCategoryClass* ref_category) { // Find texture category which matches ref_category's properties but has 'vmat' on given pass - DX8TextureCategoryClass* dest_tex_category=NULL; + DX8TextureCategoryClass* dest_tex_category=nullptr; TextureCategoryListIterator dest_it(&texture_category_list[pass]); while (!dest_it.Is_Done()) { if (Equal_Material(dest_it.Peek_Obj()->Peek_Material(),vmat)) { @@ -467,7 +467,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( @@ -700,7 +700,7 @@ unsigned DX8FVFCategoryContainer::Define_FVF(MeshModelClass* mmc,bool enable_lig DX8RigidFVFCategoryContainer::DX8RigidFVFCategoryContainer(unsigned FVF,bool sorting_) : DX8FVFCategoryContainer(FVF,sorting_), - vertex_buffer(0), + vertex_buffer(nullptr), used_vertices(0) { } @@ -1200,8 +1200,8 @@ DX8SkinFVFCategoryContainer::DX8SkinFVFCategoryContainer(bool sorting) : DX8FVFCategoryContainer(DX8_FVF_XYZNUV1,sorting), VisibleVertexCount(0), - VisibleSkinHead(NULL), - VisibleSkinTail(NULL) + VisibleSkinHead(nullptr), + VisibleSkinTail(nullptr) { } @@ -1249,7 +1249,7 @@ void DX8SkinFVFCategoryContainer::Render(void) } AnythingToRender=false; - DX8Wrapper::Set_Vertex_Buffer(NULL); // Free up the reference to the current vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); // Free up the reference to the current vertex buffer // (in case it is the dynamic, which may have to be resized) //'Generals' customization to allow more than 65535 vertices @@ -1274,9 +1274,9 @@ void DX8SkinFVFCategoryContainer::Render(void) { DynamicVBAccessClass::WriteLockClass l(&vb); VertexFormatXYZNDUV2 * dest_verts = l.Get_Formatted_Vertex_Array(); unsigned vertex_offset=0; - remainingMesh = NULL; + remainingMesh = nullptr; - while (mesh != NULL) { + while (mesh != nullptr) { MeshModelClass * mmc = mesh->Peek_Model(); int mesh_vertex_count=mmc->Get_Vertex_Count(); @@ -1284,7 +1284,7 @@ void DX8SkinFVFCategoryContainer::Render(void) if (vertex_offset+mesh_vertex_count > maxVertexCount || remainingMesh) { //flag mesh so we know it didn't fit in the vertex buffer mesh->Set_Base_Vertex_Offset(VERTEX_BUFFER_OVERFLOW); - if (remainingMesh == NULL) + if (remainingMesh == nullptr) remainingMesh = mesh; //start of meshes that didn't fit in buffer mesh = mesh->Peek_Next_Visible_Skin(); //skip rendering this mesh continue; @@ -1398,25 +1398,25 @@ bool DX8SkinFVFCategoryContainer::Check_If_Mesh_Fits(MeshModelClass* mmc) void DX8SkinFVFCategoryContainer::clearVisibleSkinList() { - while (VisibleSkinHead != NULL) + while (VisibleSkinHead != nullptr) { MeshClass* next = VisibleSkinHead->Peek_Next_Visible_Skin(); - VisibleSkinHead->Set_Next_Visible_Skin(NULL); + VisibleSkinHead->Set_Next_Visible_Skin(nullptr); VisibleSkinHead = next; } - VisibleSkinHead = NULL; - VisibleSkinTail = NULL; + VisibleSkinHead = nullptr; + VisibleSkinTail = nullptr; VisibleVertexCount = 0; } void DX8SkinFVFCategoryContainer::Add_Visible_Skin(MeshClass * mesh) { - if (mesh->Peek_Next_Visible_Skin() != NULL || mesh == VisibleSkinTail) + if (mesh->Peek_Next_Visible_Skin() != nullptr || mesh == VisibleSkinTail) { DEBUG_CRASH(("Mesh %s is already a visible skin, and we tried to add it again... please notify Mark W or Steven J immediately!",mesh->Get_Name())); return; } - if (VisibleSkinHead == NULL) + if (VisibleSkinHead == nullptr) VisibleSkinTail = mesh; mesh->Set_Next_Visible_Skin(VisibleSkinHead); VisibleSkinHead = mesh; @@ -1637,7 +1637,7 @@ void DX8TextureCategoryClass::Render(void) #endif for (unsigned i=0;iGet_Texture_Name().str() : "NULL")); + SNAPSHOT_SAY(("Set_Texture(%d,%s)",i,Peek_Texture(i) ? Peek_Texture(i)->Get_Texture_Name().str() : "null")); DX8Wrapper::Set_Texture(i,Peek_Texture(i)); } @@ -1645,7 +1645,7 @@ void DX8TextureCategoryClass::Render(void) } #endif - SNAPSHOT_SAY(("Set_Material(%s)",Peek_Material() ? Peek_Material()->Get_Name() : "NULL")); + SNAPSHOT_SAY(("Set_Material(%s)",Peek_Material() ? Peek_Material()->Get_Name() : "null")); VertexMaterialClass *vmaterial=(VertexMaterialClass *)Peek_Material(); //ugly cast from const but we'll restore it after changes so okay. -MW DX8Wrapper::Set_Material(vmaterial); @@ -1677,7 +1677,7 @@ void DX8TextureCategoryClass::Render(void) bool renderTasksRemaining=false; PolyRenderTaskClass * prt = render_task_head; - PolyRenderTaskClass * last_prt = NULL; + PolyRenderTaskClass * last_prt = nullptr; while (prt) { @@ -1708,7 +1708,7 @@ void DX8TextureCategoryClass::Render(void) // Disable texturing on all stages and passes. for (i = 0; i < MAX_TEXTURE_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } break; @@ -1721,7 +1721,7 @@ void DX8TextureCategoryClass::Render(void) } } else { for (i = 0; i < MAX_TEXTURE_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } } break; @@ -1731,7 +1731,7 @@ void DX8TextureCategoryClass::Render(void) // Disable texturing on all but the zeroth stage of each pass. DX8Wrapper::Set_Texture (0, Peek_Texture (0)); for (i = 1; i < MAX_TEXTURE_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } break; @@ -1749,7 +1749,7 @@ void DX8TextureCategoryClass::Render(void) ** states untouched. This way they can set a couple global lights that affect the entire scene. */ LightEnvironmentClass * lenv = mesh->Get_Lighting_Environment(); - if (lenv != NULL) { + if (lenv != nullptr) { SNAPSHOT_SAY(("LightEnvironment, lights: %d",lenv->Get_Light_Count())); DX8Wrapper::Set_Light_Environment(lenv); } @@ -1836,7 +1836,7 @@ void DX8TextureCategoryClass::Render(void) oldMapper->Set_Current_UV_Offset(matOverride->customUVOffset); } else - oldMapper=NULL; + oldMapper=nullptr; if (mesh->Get_Alpha_Override() != 1.0) { @@ -1866,7 +1866,7 @@ void DX8TextureCategoryClass::Render(void) oldMapper->Set_Current_UV_Offset(oldUVOffset); } - DX8Wrapper::Set_Material(NULL); //force a reset of vertex material since we secretly changed opacity or uv offset + DX8Wrapper::Set_Material(nullptr); //force a reset of vertex material since we secretly changed opacity or uv offset DX8Wrapper::Set_Material(vmaterial); //restore previous material. } else @@ -1887,7 +1887,7 @@ void DX8TextureCategoryClass::Render(void) PolyRenderTaskClass * next_prt = prt->Get_Next_Visible(); // remove from list, then delete - if (last_prt == NULL) { + if (last_prt == nullptr) { render_task_head = next_prt; } else { last_prt->Set_Next_Visible(next_prt); @@ -1906,7 +1906,7 @@ void DX8TextureCategoryClass::Render(void) void DX8TextureCategoryClass::Clear_Render_List() { - while (render_task_head != NULL) + while (render_task_head != nullptr) { PolyRenderTaskClass* next = render_task_head->Get_Next_Visible(); delete render_task_head; @@ -1917,10 +1917,10 @@ void DX8TextureCategoryClass::Clear_Render_List() DX8MeshRendererClass::DX8MeshRendererClass() : - camera(NULL), + camera(nullptr), enable_lighting(true), - texture_category_container_list_skin(NULL), - visible_decal_meshes(NULL) + texture_category_container_list_skin(nullptr), + visible_decal_meshes(nullptr) { } @@ -1936,8 +1936,8 @@ void DX8MeshRendererClass::Init(void) void DX8MeshRendererClass::Shutdown(void) { - camera = NULL; - visible_decal_meshes = NULL; + camera = nullptr; + visible_decal_meshes = nullptr; Invalidate(true); Clear_Pending_Delete_Lists(); _TempVertexBuffer.Clear(); //free memory @@ -1961,7 +1961,7 @@ void DX8MeshRendererClass::Clear_Pending_Delete_Lists() static void Add_Rigid_Mesh_To_Container(FVFCategoryList* container_list,unsigned fvf,MeshModelClass* mmc) { WWASSERT(container_list); - DX8FVFCategoryContainer * container = NULL; + DX8FVFCategoryContainer * container = nullptr; bool sorting=((!!mmc->Get_Flag(MeshModelClass::SORT)) && WW3D::Is_Sorting_Enabled()); FVFCategoryListIterator it(container_list); @@ -2110,14 +2110,14 @@ void DX8MeshRendererClass::Flush(void) Render_Decal_Meshes(); - DX8Wrapper::Set_Vertex_Buffer(NULL); - DX8Wrapper::Set_Index_Buffer(NULL,0); + DX8Wrapper::Set_Vertex_Buffer(nullptr); + DX8Wrapper::Set_Index_Buffer(nullptr,0); } void DX8MeshRendererClass::Add_To_Render_List(DecalMeshClass * decalmesh) { - WWASSERT(decalmesh != NULL); + WWASSERT(decalmesh != nullptr); decalmesh->Set_Next_Visible(visible_decal_meshes); visible_decal_meshes = decalmesh; } @@ -2127,11 +2127,11 @@ void DX8MeshRendererClass::Render_Decal_Meshes(void) DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,8); DecalMeshClass * decal_mesh = visible_decal_meshes; - while (decal_mesh != NULL) { + while (decal_mesh != nullptr) { decal_mesh->Render(); decal_mesh = decal_mesh->Peek_Next_Visible(); } - visible_decal_meshes = NULL; + visible_decal_meshes = nullptr; DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,0); } @@ -2176,7 +2176,7 @@ void DX8MeshRendererClass::Invalidate( bool shutdown) if (texture_category_container_list_skin) { Invalidate_FVF_Category_Container_List(*texture_category_container_list_skin); delete texture_category_container_list_skin; - texture_category_container_list_skin=NULL; + texture_category_container_list_skin=nullptr; } if (!shutdown) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h index 1bd4dc0a670..cde0916560e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h @@ -91,7 +91,7 @@ class DX8TextureCategoryClass : public MultiListObjectClass void Add_Render_Task(DX8PolygonRendererClass * p_renderer,MeshClass * p_mesh); void Render(void); - bool Anything_To_Render() { return (render_task_head != NULL); } + bool Anything_To_Render() { return (render_task_head != nullptr); } void Clear_Render_List(); TextureClass * Peek_Texture(int stage) { return textures[stage]; } @@ -109,7 +109,7 @@ class DX8TextureCategoryClass : public MultiListObjectClass void Log(bool only_visible); void Remove_Polygon_Renderer(DX8PolygonRendererClass* p_renderer); - void Add_Polygon_Renderer(DX8PolygonRendererClass* p_renderer,DX8PolygonRendererClass* add_after_this=NULL); + void Add_Polygon_Renderer(DX8PolygonRendererClass* p_renderer,DX8PolygonRendererClass* add_after_this=nullptr); DX8FVFCategoryContainer * Get_Container(void) { return container; } @@ -202,7 +202,7 @@ class DX8FVFCategoryContainer : public MultiListObjectClass void Add_Visible_Texture_Category(DX8TextureCategoryClass * tex_category,int pass) { WWASSERT(passNum_Refs() == 1)); + WWASSERT ((_DynamicDX8VertexBuffer == nullptr) || (_DynamicDX8VertexBuffer->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicDX8VertexBuffer); _DynamicDX8VertexBufferInUse=false; _DynamicDX8VertexBufferSize=DEFAULT_VB_SIZE; _DynamicDX8VertexBufferOffset=0; - WWASSERT ((_DynamicSortingVertexArray == NULL) || (_DynamicSortingVertexArray->Num_Refs() == 1)); + WWASSERT ((_DynamicSortingVertexArray == nullptr) || (_DynamicSortingVertexArray->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicSortingVertexArray); WWASSERT(!_DynamicSortingVertexArrayInUse); _DynamicSortingVertexArrayInUse=false; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index b6696957880..297670eb2cf 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -99,7 +99,7 @@ int DX8Wrapper_PreserveFPU = 0; ** ***********************************************************************************/ -static HWND _Hwnd = NULL; +static HWND _Hwnd = nullptr; bool DX8Wrapper::IsInitted = false; bool DX8Wrapper::_EnableTriangleDraw = true; @@ -122,8 +122,8 @@ DWORD DX8Wrapper::Pixel_Shader = 0; Vector4 DX8Wrapper::Vertex_Shader_Constants[MAX_VERTEX_SHADER_CONSTANTS]; Vector4 DX8Wrapper::Pixel_Shader_Constants[MAX_PIXEL_SHADER_CONSTANTS]; -LightEnvironmentClass* DX8Wrapper::Light_Environment = NULL; -RenderInfoClass* DX8Wrapper::Render_Info = NULL; +LightEnvironmentClass* DX8Wrapper::Light_Environment = nullptr; +RenderInfoClass* DX8Wrapper::Render_Info = nullptr; DWORD DX8Wrapper::Vertex_Processing_Behavior = 0; ZTextureClass* DX8Wrapper::Shadow_Map[MAX_SHADOW_MAPS]; @@ -141,12 +141,12 @@ unsigned DX8Wrapper::render_state_changed; bool DX8Wrapper::FogEnable = false; D3DCOLOR DX8Wrapper::FogColor = 0; -IDirect3D8 * DX8Wrapper::D3DInterface = NULL; -IDirect3DDevice8 * DX8Wrapper::D3DDevice = NULL; -IDirect3DSurface8 * DX8Wrapper::CurrentRenderTarget = NULL; -IDirect3DSurface8 * DX8Wrapper::CurrentDepthBuffer = NULL; -IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = NULL; -IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = NULL; +IDirect3D8 * DX8Wrapper::D3DInterface = nullptr; +IDirect3DDevice8 * DX8Wrapper::D3DDevice = nullptr; +IDirect3DSurface8 * DX8Wrapper::CurrentRenderTarget = nullptr; +IDirect3DSurface8 * DX8Wrapper::CurrentDepthBuffer = nullptr; +IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = nullptr; +IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = nullptr; bool DX8Wrapper::IsRenderToTexture = false; unsigned DX8Wrapper::matrix_changes = 0; @@ -167,7 +167,7 @@ float DX8Wrapper::ZFar; Matrix4x4 DX8Wrapper::ProjectionMatrix; Matrix4x4 DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; -DX8Caps* DX8Wrapper::CurrentCaps = 0; +DX8Caps* DX8Wrapper::CurrentCaps = nullptr; // Hack test... this disables rendering of batches of too few polygons. unsigned DX8Wrapper::DrawPolygonLowBoundLimit=0; @@ -197,10 +197,10 @@ static DynamicVectorClass _RenderDeviceDescriptionTable; typedef IDirect3D8* (WINAPI *Direct3DCreate8Type) (UINT SDKVersion); -Direct3DCreate8Type Direct3DCreate8Ptr = NULL; -HINSTANCE D3D8Lib = NULL; +Direct3DCreate8Type Direct3DCreate8Ptr = nullptr; +HINSTANCE D3D8Lib = nullptr; -DX8_CleanupHook *DX8Wrapper::m_pCleanupHook=NULL; +DX8_CleanupHook *DX8Wrapper::m_pCleanupHook=nullptr; #ifdef EXTENDED_STATS DX8_Stats DX8Wrapper::stats; #endif @@ -304,8 +304,8 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) //world_identity; //CurrentFogColor; - D3DInterface = NULL; - D3DDevice = NULL; + D3DInterface = nullptr; + D3DDevice = nullptr; WWDEBUG_SAY(("Reset DX8Wrapper statistics")); Reset_Statistics(); @@ -315,10 +315,10 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) if (!lite) { D3D8Lib = LoadLibrary("D3D8.DLL"); - if (D3D8Lib == NULL) return false; // Return false at this point if init failed + if (D3D8Lib == nullptr) return false; // Return false at this point if init failed Direct3DCreate8Ptr = (Direct3DCreate8Type) GetProcAddress(D3D8Lib, "Direct3DCreate8"); - if (Direct3DCreate8Ptr == NULL) return false; + if (Direct3DCreate8Ptr == nullptr) return false; /* ** Create the D3D interface object @@ -331,7 +331,7 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) D3DInterface = Direct3DCreate8Ptr(D3D_SDK_VERSION); // TODO: handle failure cases... } - if (D3DInterface == NULL) { + if (D3DInterface == nullptr) { return(false); } IsInitted = true; @@ -351,13 +351,13 @@ void DX8Wrapper::Shutdown(void) { if (D3DDevice) { - Set_Render_Target ((IDirect3DSurface8 *)NULL); + Set_Render_Target ((IDirect3DSurface8 *)nullptr); Release_Device(); } if (D3DInterface) { D3DInterface->Release(); - D3DInterface=NULL; + D3DInterface=nullptr; } @@ -369,19 +369,19 @@ void DX8Wrapper::Shutdown(void) if (Textures[i]) { Textures[i]->Release(); - Textures[i] = NULL; + Textures[i] = nullptr; } } } if (D3DInterface) { UINT newRefCount=D3DInterface->Release(); - D3DInterface=NULL; + D3DInterface=nullptr; } if (D3D8Lib) { FreeLibrary(D3D8Lib); - D3D8Lib = NULL; + D3D8Lib = nullptr; } _RenderDeviceNameTable.Clear(); // note - Delete_All() resizes the vector, causing a reallocation. Clear is better. jba. @@ -461,19 +461,19 @@ void DX8Wrapper::Invalidate_Cached_Render_States(void) { TextureStageStates[a][b]=0x12345678; } - //Need to explicitly set texture to NULL, otherwise app will not be able to + //Need to explicitly set texture to null, otherwise app will not be able to //set it to null because of redundant state checker. MW if (_Get_D3D_Device8()) - _Get_D3D_Device8()->SetTexture(a,NULL); - if (Textures[a] != NULL) { + _Get_D3D_Device8()->SetTexture(a,nullptr); + if (Textures[a] != nullptr) { Textures[a]->Release(); } - Textures[a]=NULL; + Textures[a]=nullptr; } ShaderClass::Invalidate(); - //Need to explicitly set render_state texture pointers to NULL. MW + //Need to explicitly set render_state texture pointers to null. MW Release_Render_State(); // (gth) clear the matrix shadows too @@ -512,14 +512,14 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Shutdowns(void) MissingTexture::_Deinit(); delete CurrentCaps; - CurrentCaps=NULL; + CurrentCaps=nullptr; } bool DX8Wrapper::Create_Device(void) { - WWASSERT(D3DDevice==NULL); // for now, once you've created a device, you're stuck with it! + WWASSERT(D3DDevice==nullptr); // for now, once you've created a device, you're stuck with it! D3DCAPS8 caps; if @@ -608,12 +608,12 @@ bool DX8Wrapper::Reset_Device(bool reload_assets) { WWDEBUG_SAY(("Resetting device.")); DX8_THREAD_ASSERT(); - if ((IsInitted) && (D3DDevice != NULL)) { + if ((IsInitted) && (D3DDevice != nullptr)) { // Release all non-MANAGED stuff WW3D::_Invalidate_Textures(); - Set_Vertex_Buffer (NULL); - Set_Index_Buffer (NULL, 0); + Set_Vertex_Buffer (nullptr); + Set_Index_Buffer (nullptr, 0); if (m_pCleanupHook) { m_pCleanupHook->ReleaseResources(); } @@ -655,11 +655,11 @@ void DX8Wrapper::Release_Device(void) for (int a=0;aRelease(); - D3DDevice=NULL; + D3DDevice=nullptr; } } @@ -894,7 +894,7 @@ void DX8Wrapper::Resize_And_Position_Window() rectClient.bottom = rectClient.top + ResolutionHeight; MoveRectIntoOtherRect(rectClient, mi.rcMonitor, &left, &top); - ::SetWindowPos (_Hwnd, NULL, left, top, width, height, SWP_NOZORDER); + ::SetWindowPos (_Hwnd, nullptr, left, top, width, height, SWP_NOZORDER); DEBUG_LOG(("Window positioned to x:%d y:%d, resized to w:%d h:%d", left, top, width, height)); } @@ -946,7 +946,7 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int } #endif //must be either resetting existing device or creating a new one. - WWASSERT(reset_device || D3DDevice == NULL); + WWASSERT(reset_device || D3DDevice == nullptr); /* ** Initialize values for D3DPRESENT_PARAMETERS members. @@ -1184,7 +1184,7 @@ const char * DX8Wrapper::Get_Render_Device_Name(int device_index) bool DX8Wrapper::Set_Device_Resolution(int width,int height,int bits,int windowed, bool resize_window) { - if (D3DDevice != NULL) { + if (D3DDevice != nullptr) { if (width != -1) { _PresentParameters.BackBufferWidth = ResolutionWidth = width; @@ -1220,7 +1220,7 @@ void DX8Wrapper::Get_Render_Target_Resolution(int & set_w,int & set_h,int & set_ { WWASSERT(IsInitted); - if (CurrentRenderTarget != NULL) { + if (CurrentRenderTarget != nullptr) { D3DSURFACE_DESC info; CurrentRenderTarget->GetDesc (&info); @@ -1347,7 +1347,7 @@ bool DX8Wrapper::Find_Color_And_Z_Mode(int resx,int resy,int bitdepth,D3DFORMAT /* ** Select the table that we're going to use to search for a valid backbuffer format */ - D3DFORMAT * format_table = NULL; + D3DFORMAT * format_table = nullptr; int format_count = 0; if (BitDepth == 16) { @@ -1611,7 +1611,7 @@ void DX8Wrapper::End_Scene(bool flip_frames) HRESULT hr; { WWPROFILE("DX8Device::Present()"); - hr=_Get_D3D_Device8()->Present(NULL, NULL, NULL, NULL); + hr=_Get_D3D_Device8()->Present(nullptr, nullptr, nullptr, nullptr); } number_of_DX8_calls++; @@ -1647,10 +1647,10 @@ void DX8Wrapper::End_Scene(bool flip_frames) } // Each frame, release all of the buffers and textures. - Set_Vertex_Buffer(NULL); - Set_Index_Buffer(NULL,0); - for (int i=0;iGet_Max_Textures_Per_Pass();++i) Set_Texture(i,NULL); - Set_Material(NULL); + Set_Vertex_Buffer(nullptr); + Set_Index_Buffer(nullptr,0); + for (int i=0;iGet_Max_Textures_Per_Pass();++i) Set_Texture(i,nullptr); + Set_Material(nullptr); } @@ -1687,7 +1687,7 @@ void DX8Wrapper::Flip_To_Primary(void) } } else { WWDEBUG_SAY(("Flipping: %ld", FrameCount)); - hr = _Get_D3D_Device8()->Present(NULL, NULL, NULL, NULL); + hr = _Get_D3D_Device8()->Present(nullptr, nullptr, nullptr, nullptr); if (SUCCEEDED(hr)) { IsDeviceLost=false; @@ -1719,7 +1719,7 @@ void DX8Wrapper::Clear(bool clear_color, bool clear_z_stencil, const Vector3 &co if (clear_z_stencil && has_stencil) flags |= D3DCLEAR_STENCIL; if (flags) { - DX8CALL(Clear(0, NULL, flags, Convert_Color(color,dest_alpha), z, stencil)); + DX8CALL(Clear(0, nullptr, flags, Convert_Color(color,dest_alpha), z, stencil)); } } @@ -1873,7 +1873,7 @@ void DX8Wrapper::Draw_Sorting_IB_VB( { DynamicIBAccessClass::WriteLockClass lock(&dyn_ib_access); unsigned short* dest=lock.Get_Index_Array(); - unsigned short* src=NULL; + unsigned short* src=nullptr; src=static_cast(render_state.index_buffer)->index_buffer; src+=render_state.iba_offset+start_index; @@ -2168,8 +2168,8 @@ void DX8Wrapper::Apply_Render_State_Changes() Set_DX8_Light(index,&render_state.Lights[index]); } else { - Set_DX8_Light(index,NULL); - SNAPSHOT_SAY((" clearing light to NULL")); + Set_DX8_Light(index,nullptr); + SNAPSHOT_SAY((" clearing light to null")); } } } @@ -2203,7 +2203,7 @@ void DX8Wrapper::Apply_Render_State_Changes() WWASSERT(0); } } else { - DX8CALL(SetStreamSource(0,NULL,0)); + DX8CALL(SetStreamSource(0,nullptr,0)); DX8_RECORD_VERTEX_BUFFER_CHANGE(); } } @@ -2227,7 +2227,7 @@ void DX8Wrapper::Apply_Render_State_Changes() } else { DX8CALL(SetIndices( - NULL, + nullptr, 0)); DX8_RECORD_INDEX_BUFFER_CHANGE(); } @@ -2250,7 +2250,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2259,7 +2259,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture // format that is supported and use that instead. // Render target may return NOTAVAILABLE, in - // which case we return NULL. + // which case we return null. if (rendertarget) { unsigned ret=D3DXCreateTexture( DX8Wrapper::_Get_D3D_Device8(), @@ -2273,12 +2273,12 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } DX8_ErrorCode(ret); @@ -2315,7 +2315,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; // NOTE: If the original image format is not supported as a texture format, it will // automatically be converted to an appropriate format. @@ -2334,8 +2334,8 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture D3DX_FILTER_BOX, D3DX_FILTER_BOX, 0, - NULL, - NULL, + nullptr, + nullptr, &texture); if (result != D3D_OK) { @@ -2360,7 +2360,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; D3DSURFACE_DESC surface_desc; ::ZeroMemory(&surface_desc, sizeof(D3DSURFACE_DESC)); @@ -2372,15 +2372,15 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture texture = _Create_DX8_Texture(surface_desc.Width, surface_desc.Height, format, mip_level_count); // Copy the surface to the texture - IDirect3DSurface8 *tex_surface = NULL; + IDirect3DSurface8 *tex_surface = nullptr; texture->GetSurfaceLevel(0, &tex_surface); - DX8_ErrorCode(D3DXLoadSurfaceFromSurface(tex_surface, NULL, NULL, surface, NULL, NULL, D3DX_FILTER_BOX, 0)); + DX8_ErrorCode(D3DXLoadSurfaceFromSurface(tex_surface, nullptr, nullptr, surface, nullptr, nullptr, D3DX_FILTER_BOX, 0)); tex_surface->Release(); // Create mipmaps if needed if (mip_level_count!=MIP_LEVELS_1) { - DX8_ErrorCode(D3DXFilterTexture(texture, NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(texture, nullptr, 0, D3DX_FILTER_BOX)); } return texture; @@ -2401,7 +2401,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8* texture = NULL; + IDirect3DTexture8* texture = nullptr; D3DFORMAT zfmt=WW3DZFormat_To_D3DFormat(zformat); @@ -2419,7 +2419,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } // If ran out of texture ram, try invalidating some textures and mesh cache. @@ -2454,7 +2454,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2484,7 +2484,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture WWASSERT(width==height); DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DCubeTexture8* texture=NULL; + IDirect3DCubeTexture8* texture=nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2493,7 +2493,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture // format that is supported and use that instead. // Render target may return NOTAVAILABLE, in - // which case we return NULL. + // which case we return null. if (rendertarget) { unsigned ret=D3DXCreateCubeTexture @@ -2510,7 +2510,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } // If ran out of texture ram, try invalidating some textures and mesh cache. @@ -2545,7 +2545,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2621,7 +2621,7 @@ IDirect3DVolumeTexture8* DX8Wrapper::_Create_DX8_Volume_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DVolumeTexture8* texture=NULL; + IDirect3DVolumeTexture8* texture=nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2691,7 +2691,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(unsigned int width, unsigned DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DSurface8 *surface = NULL; + IDirect3DSurface8 *surface = nullptr; // Paletted surfaces not supported! WWASSERT(format!=D3DFMT_P8); @@ -2715,7 +2715,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_) // the file data and use D3DXLoadSurfaceFromFile. This is a horrible hack, but it saves us // having to write file loaders. Will fix this when D3DX provides us with the right functions. // Create a surface the size of the file image data - IDirect3DSurface8 *surface = NULL; + IDirect3DSurface8 *surface = nullptr; { @@ -2924,12 +2924,12 @@ void DX8Wrapper::Set_Light_Environment(LightEnvironmentClass* light_env) } for (;l<4;++l) { - Set_Light(l,NULL); + Set_Light(l,nullptr); } } /* else { for (int l=0;l<4;++l) { - Set_Light(l,NULL); + Set_Light(l,nullptr); } } */ @@ -2942,7 +2942,7 @@ IDirect3DSurface8 * DX8Wrapper::_Get_DX8_Front_Buffer() DX8CALL(GetDisplayMode(&mode)); - IDirect3DSurface8 * fb=NULL; + IDirect3DSurface8 * fb=nullptr; DX8CALL(CreateImageSurface(mode.Width,mode.Height,D3DFMT_A8R8G8B8,&fb)); @@ -2955,7 +2955,7 @@ SurfaceClass * DX8Wrapper::_Get_DX8_Back_Buffer(unsigned int num) DX8_THREAD_ASSERT(); IDirect3DSurface8 * bb; - SurfaceClass *surf=NULL; + SurfaceClass *surf=nullptr; DX8CALL(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb)); if (bb) { @@ -2981,10 +2981,10 @@ DX8Wrapper::Create_Render_Target (int width, int height, WW3DFormat format) format=D3DFormat_To_WW3DFormat(mode.Format); } - // If render target format isn't supported return NULL + // If render target format isn't supported return null if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format)) { WWDEBUG_SAY(("DX8Wrapper - Render target format is not supported")); - return NULL; + return nullptr; } // @@ -3013,7 +3013,7 @@ DX8Wrapper::Create_Render_Target (int width, int height, WW3DFormat format) // 3dfx drivers are lying in the CheckDeviceFormat call and claiming // that they support render targets! - if (tex->Peek_D3D_Base_Texture() == NULL) + if (tex->Peek_D3D_Base_Texture() == nullptr) { WWDEBUG_SAY(("DX8Wrapper - Render target creation failed!")); REF_PTR_RELEASE(tex); @@ -3043,15 +3043,15 @@ void DX8Wrapper::Create_Render_Target // Use the current display format if format isn't specified if (format==WW3D_FORMAT_UNKNOWN) { - *target=NULL; - *depth_buffer=NULL; + *target=nullptr; + *depth_buffer=nullptr; return; /* D3DDISPLAYMODE mode; DX8CALL(GetDisplayMode(&mode)); format=D3DFormat_To_WW3DFormat(mode.Format);*/ } - // If render target format isn't supported return NULL + // If render target format isn't supported return null if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format) || !Get_Current_Caps()->Support_Depth_Stencil_Format(zformat)) { @@ -3085,7 +3085,7 @@ void DX8Wrapper::Create_Render_Target // 3dfx drivers are lying in the CheckDeviceFormat call and claiming // that they support render targets! - if (tex->Peek_D3D_Base_Texture() == NULL) + if (tex->Peek_D3D_Base_Texture() == nullptr) { WWDEBUG_SAY(("DX8Wrapper - Render target creation failed!")); REF_PTR_RELEASE(tex); @@ -3117,16 +3117,16 @@ void DX8Wrapper::Set_Render_Target_With_Z ZTextureClass* ztexture ) { - WWASSERT(texture!=NULL); + WWASSERT(texture!=nullptr); IDirect3DSurface8 * d3d_surf = texture->Get_D3D_Surface_Level(); - WWASSERT(d3d_surf != NULL); + WWASSERT(d3d_surf != nullptr); - IDirect3DSurface8* d3d_zbuf=NULL; - if (ztexture!=NULL) + IDirect3DSurface8* d3d_zbuf=nullptr; + if (ztexture!=nullptr) { d3d_zbuf=ztexture->Get_D3D_Surface_Level(); - WWASSERT(d3d_zbuf!=NULL); + WWASSERT(d3d_zbuf!=nullptr); Set_Render_Target(d3d_surf,d3d_zbuf); d3d_zbuf->Release(); } @@ -3143,12 +3143,12 @@ void DX8Wrapper::Set_Render_Target(IDirect3DSwapChain8 *swap_chain) { DX8_THREAD_ASSERT(); - WWASSERT (swap_chain != NULL); + WWASSERT (swap_chain != nullptr); // // Get the back buffer for the swap chain // - LPDIRECT3DSURFACE8 render_target = NULL; + LPDIRECT3DSURFACE8 render_target = nullptr; swap_chain->GetBackBuffer (0, D3DBACKBUFFER_TYPE_MONO, &render_target); // @@ -3159,9 +3159,9 @@ DX8Wrapper::Set_Render_Target(IDirect3DSwapChain8 *swap_chain) // // Release our hold on the back buffer // - if (render_target != NULL) { + if (render_target != nullptr) { render_target->Release (); - render_target = NULL; + render_target = nullptr; } IsRenderToTexture = false; @@ -3179,62 +3179,62 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Should we restore the default render target set a new one? // - if (render_target == NULL || render_target == DefaultRenderTarget) + if (render_target == nullptr || render_target == DefaultRenderTarget) { - // If there is currently a custom render target, default must NOT be NULL. + // If there is currently a custom render target, default must NOT be null. if (CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget!=NULL); + WWASSERT(DefaultRenderTarget!=nullptr); } // // Restore the default render target // - if (DefaultRenderTarget != NULL) + if (DefaultRenderTarget != nullptr) { DX8CALL(SetRenderTarget (DefaultRenderTarget, DefaultDepthBuffer)); DefaultRenderTarget->Release (); - DefaultRenderTarget = NULL; + DefaultRenderTarget = nullptr; if (DefaultDepthBuffer) { DefaultDepthBuffer->Release (); - DefaultDepthBuffer = NULL; + DefaultDepthBuffer = nullptr; } } // // Release our hold on the "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } } else if (render_target != CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget==NULL); + WWASSERT(DefaultRenderTarget==nullptr); // // We'll need the depth buffer later... // - if (DefaultDepthBuffer == NULL) + if (DefaultDepthBuffer == nullptr) { -// IDirect3DSurface8 *depth_buffer = NULL; +// IDirect3DSurface8 *depth_buffer = nullptr; DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer)); } // // Get a pointer to the default render target (if necessary) // - if (DefaultRenderTarget == NULL) + if (DefaultRenderTarget == nullptr) { DX8CALL(GetRenderTarget (&DefaultRenderTarget)); } @@ -3242,24 +3242,24 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Release our hold on the old "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } // // Keep a copy of the current render target (for housekeeping) // CurrentRenderTarget = render_target; - WWASSERT (CurrentRenderTarget != NULL); - if (CurrentRenderTarget != NULL) + WWASSERT (CurrentRenderTarget != nullptr); + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->AddRef (); @@ -3272,7 +3272,7 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default } else { - DX8CALL(SetRenderTarget (CurrentRenderTarget, NULL)); + DX8CALL(SetRenderTarget (CurrentRenderTarget, nullptr)); } } } @@ -3280,9 +3280,9 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Free our hold on the depth buffer // -// if (depth_buffer != NULL) { +// if (depth_buffer != nullptr) { // depth_buffer->Release (); -// depth_buffer = NULL; +// depth_buffer = nullptr; // } IsRenderToTexture = false; @@ -3308,61 +3308,61 @@ void DX8Wrapper::Set_Render_Target // // Should we restore the default render target set a new one? // - if (render_target == NULL || render_target == DefaultRenderTarget) + if (render_target == nullptr || render_target == DefaultRenderTarget) { - // If there is currently a custom render target, default must NOT be NULL. + // If there is currently a custom render target, default must NOT be null. if (CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget!=NULL); + WWASSERT(DefaultRenderTarget!=nullptr); } // // Restore the default render target // - if (DefaultRenderTarget != NULL) + if (DefaultRenderTarget != nullptr) { DX8CALL(SetRenderTarget (DefaultRenderTarget, DefaultDepthBuffer)); DefaultRenderTarget->Release (); - DefaultRenderTarget = NULL; + DefaultRenderTarget = nullptr; if (DefaultDepthBuffer) { DefaultDepthBuffer->Release (); - DefaultDepthBuffer = NULL; + DefaultDepthBuffer = nullptr; } } // // Release our hold on the "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } } else if (render_target != CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget==NULL); + WWASSERT(DefaultRenderTarget==nullptr); // // We'll need the depth buffer later... // - if (DefaultDepthBuffer == NULL) + if (DefaultDepthBuffer == nullptr) { -// IDirect3DSurface8 *depth_buffer = NULL; +// IDirect3DSurface8 *depth_buffer = nullptr; DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer)); } // // Get a pointer to the default render target (if necessary) // - if (DefaultRenderTarget == NULL) + if (DefaultRenderTarget == nullptr) { DX8CALL(GetRenderTarget (&DefaultRenderTarget)); } @@ -3370,16 +3370,16 @@ void DX8Wrapper::Set_Render_Target // // Release our hold on the old "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } // @@ -3387,8 +3387,8 @@ void DX8Wrapper::Set_Render_Target // CurrentRenderTarget = render_target; CurrentDepthBuffer = depth_buffer; - WWASSERT (CurrentRenderTarget != NULL); - if (CurrentRenderTarget != NULL) + WWASSERT (CurrentRenderTarget != nullptr); + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->AddRef (); CurrentDepthBuffer->AddRef(); @@ -3429,7 +3429,7 @@ DX8Wrapper::Create_Additional_Swap_Chain (HWND render_window) // // Create the swap chain // - IDirect3DSwapChain8 *swap_chain = NULL; + IDirect3DSwapChain8 *swap_chain = nullptr; DX8CALL(CreateAdditionalSwapChain(¶ms, &swap_chain)); return swap_chain; } @@ -3625,15 +3625,15 @@ void DX8Wrapper::Apply_Default_State() //Set_DX8_Texture_Stage_State(i, D3DTSS_RESULTARG, D3DTA_CURRENT); Set_DX8_Texture_Stage_State(i, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); - Set_Texture(i,NULL); + Set_Texture(i,nullptr); } -// DX8Wrapper::Set_Material(NULL); +// DX8Wrapper::Set_Material(nullptr); VertexMaterialClass::Apply_Null(); for (unsigned index=0;index<4;++index) { - SNAPSHOT_SAY(("Clearing light %d to NULL",index)); - Set_DX8_Light(index,NULL); + SNAPSHOT_SAY(("Clearing light %d to null",index)); + Set_DX8_Light(index,nullptr); } // set up simple default TSS diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index f72ce2e13ee..de29437b8bd 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -459,9 +459,9 @@ class DX8Wrapper ** WW3D::Render (scene, camera, FALSE, FALSE); ** WW3D::End_Render (); ** - ** swap_chain_ptr->Present (NULL, NULL, NULL, NULL); + ** swap_chain_ptr->Present (nullptr, nullptr, nullptr, nullptr); ** - ** DX8Wrapper::Set_Render_Target ((IDirect3DSurface8 *)NULL); + ** DX8Wrapper::Set_Render_Target ((IDirect3DSurface8 *)nullptr); ** */ static IDirect3DSwapChain8 * Create_Additional_Swap_Chain (HWND render_window); @@ -487,7 +487,7 @@ class DX8Wrapper TextureClass** target, ZTextureClass** depth_buffer ); - static void Set_Render_Target_With_Z (TextureClass * texture, ZTextureClass* ztexture=NULL); + static void Set_Render_Target_With_Z (TextureClass * texture, ZTextureClass* ztexture=nullptr); static void Set_Shadow_Map(int idx, ZTextureClass* ztex) { Shadow_Map[idx]=ztex; } static ZTextureClass* Get_Shadow_Map(int idx) { return Shadow_Map[idx]; } @@ -828,7 +828,7 @@ WWINLINE void DX8Wrapper::Set_Ambient(const Vector3& color) // // Set vertex buffer to be used in the subsequent render calls. If there was // a vertex buffer being used earlier, release the reference to it. Passing -// NULL just will release the vertex buffer. +// nullptr just will release the vertex buffer. // // ---------------------------------------------------------------------------- diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp index fa9af0c8db7..d30f49c5062 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp @@ -94,11 +94,11 @@ HAnimManagerClass::~HAnimManagerClass(void) Free_All_Anims(); delete AnimPtrTable; - AnimPtrTable = NULL; + AnimPtrTable = nullptr; Reset_Missing(); delete MissingAnimTable; - MissingAnimTable = NULL; + MissingAnimTable = nullptr; } @@ -153,7 +153,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) { HMorphAnimClass * newanim = W3DNEW HMorphAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -163,7 +163,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -196,7 +196,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) { HRawAnimClass * newanim = W3DNEW HRawAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -206,7 +206,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -239,7 +239,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) { HCompressedAnimClass * newanim = W3DNEW HCompressedAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -249,7 +249,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -298,7 +298,7 @@ HAnimClass * HAnimManagerClass::Peek_Anim(const char * name) HAnimClass * HAnimManagerClass::Get_Anim(const char * name) { HAnimClass * anim = Peek_Anim( name ); - if ( anim != NULL ) { + if ( anim != nullptr ) { anim->Add_Ref(); } return anim; @@ -384,7 +384,7 @@ void HAnimManagerClass::Create_Asset_List(DynamicVectorClass & excl // Anims are named in the format: . const char * anim_name = anim->Get_Name(); const char * filename = strchr(anim_name,'.'); - if (filename != NULL) { + if (filename != nullptr) { exclusion_list.Add(StringClass(filename+1)); } } @@ -405,7 +405,7 @@ void HAnimManagerClass::Create_Asset_List(DynamicVectorClass & excl *=============================================================================================*/ bool HAnimManagerClass::Add_Anim(HAnimClass *new_anim) { - WWASSERT (new_anim != NULL); + WWASSERT (new_anim != nullptr); // Increment the refcount on the W3DNEW animation and add it to our table. new_anim->Add_Ref (); @@ -419,7 +419,7 @@ bool HAnimManagerClass::Add_Anim(HAnimClass *new_anim) ** Missing Anims ** ** The idea here, allow the system to register which anims are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching the +** so that if they are asked for again, we can quickly return nullptr, without searching the ** disk again. */ void HAnimManagerClass::Register_Missing( const char * name ) @@ -429,7 +429,7 @@ void HAnimManagerClass::Register_Missing( const char * name ) bool HAnimManagerClass::Is_Missing( const char * name ) { - return ( MissingAnimTable->Find( name ) != NULL ); + return ( MissingAnimTable->Find( name ) != nullptr ); } void HAnimManagerClass::Reset_Missing( void ) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 2287e2a6dc1..6993d836902 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -71,8 +71,8 @@ * HLodClass::Peek_Additional_Model -- returns pointer to an additional model * * HLodClass::Get_Additional_Model -- returns pointer to an additional model * * HLodClass::Get_Additional_Model_Bone -- returns the bone index of an additional model * - * HLodClass::Is_NULL_Lod_Included -- does this HLod have NULL as its lowest LOD * - * HLodClass::Include_NULL_Lod -- Add NULL as the lowest LOD * + * HLodClass::Is_NULL_Lod_Included -- does this HLod have nullptr as its lowest LOD * + * HLodClass::Include_NULL_Lod -- Add nullptr as the lowest LOD * * HLodClass::Get_Num_Polys -- returns polycount of the current LOD * * HLodClass::Render -- render this HLod * * HLodClass::Special_Render -- Special_Render for HLod * @@ -213,21 +213,21 @@ PrototypeClass *HLodLoaderClass::Load_W3D( ChunkLoadClass &cload ) { HLodDefClass * def = W3DNEW HLodDefClass; - if (def == NULL) + if (def == nullptr) { - return NULL; + return nullptr; } if (def->Load_W3D(cload) != WW3D_ERROR_OK) { // load failed, delete the model and return an error delete def; - return NULL; + return nullptr; } else { // ok, accept this model! HLodPrototypeClass *proto = W3DNEW HLodPrototypeClass(def); return proto; } - return NULL; + return nullptr; } @@ -270,11 +270,11 @@ RenderObjClass * HLodPrototypeClass::Create(void) * HISTORY: * *=============================================================================================*/ HLodDefClass::HLodDefClass(void) : - Name(NULL), - HierarchyTreeName(NULL), + Name(nullptr), + HierarchyTreeName(nullptr), LodCount(0), - Lod(NULL), - ProxyArray(NULL) + Lod(nullptr), + ProxyArray(nullptr) { } @@ -292,11 +292,11 @@ HLodDefClass::HLodDefClass(void) : * 1/26/00 gth : Created. * *=============================================================================================*/ HLodDefClass::HLodDefClass(HLodClass &src_lod) : - Name(NULL), - HierarchyTreeName(NULL), + Name(nullptr), + HierarchyTreeName(nullptr), LodCount(0), - Lod(NULL), - ProxyArray(NULL) + Lod(nullptr), + ProxyArray(nullptr) { Initialize (src_lod); return ; @@ -337,13 +337,13 @@ HLodDefClass::~HLodDefClass(void) void HLodDefClass::Free(void) { ::free(Name); - Name = NULL; + Name = nullptr; ::free(HierarchyTreeName); - HierarchyTreeName = NULL; + HierarchyTreeName = nullptr; delete[] Lod; - Lod = NULL; + Lod = nullptr; LodCount = 0; REF_PTR_RELEASE(ProxyArray); @@ -372,7 +372,7 @@ void HLodDefClass::Initialize(HLodClass &src_lod) // Copy the name and hierarcy name from the source object Name = ::strdup (src_lod.Get_Name ()); const HTreeClass *phtree = src_lod.Get_HTree (); - if (phtree != NULL) { + if (phtree != nullptr) { HierarchyTreeName = ::strdup (phtree->Get_Name ()); } @@ -398,11 +398,11 @@ void HLodDefClass::Initialize(HLodClass &src_lod) // Record information about this model (if possible) RenderObjClass *prender_obj = src_lod.Peek_Lod_Model (index, model_index); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { model_names[model_index] = ::strdup (prender_obj->Get_Name ()); bone_indicies[model_index] = src_lod.Get_Lod_Model_Bone (index, model_index); } else { - model_names[model_index] = NULL; + model_names[model_index] = nullptr; bone_indicies[model_index] = 0; } } @@ -723,8 +723,8 @@ bool HLodDefClass::read_proxy_array(ChunkLoadClass & cload) HLodDefClass::SubObjectArrayClass::SubObjectArrayClass(void) : MaxScreenSize(NO_MAX_SCREEN_SIZE), ModelCount(0), - ModelName(NULL), - BoneIndex(NULL) + ModelName(nullptr), + BoneIndex(nullptr) { } @@ -763,16 +763,16 @@ void HLodDefClass::SubObjectArrayClass::Reset(void) { MaxScreenSize = NO_MAX_SCREEN_SIZE; - if (ModelName != NULL) { + if (ModelName != nullptr) { for (int imodel=0; imodel 0) && (count < 256)); // Set the name @@ -1007,7 +1007,7 @@ HLodClass::HLodClass(const char * name,RenderObjClass ** lods,int count) : // Create our HTree from the highest LOD if it is an HModel // Otherwise, create a single node tree const HTreeClass * tree = lods[count-1]->Get_HTree(); - if (tree != NULL) { + if (tree != nullptr) { HTree = W3DNEW HTreeClass(*tree); } else { HTree = W3DNEW HTreeClass(); @@ -1078,13 +1078,13 @@ HLodClass::HLodClass(const HLodDefClass & def) : Animatable3DObjClass(def.HierarchyTreeName), LodCount(0), CurLod(0), - Lod(NULL), + Lod(nullptr), BoundingBoxIndex(-1), - Cost(NULL), - Value(NULL), + Cost(nullptr), + Value(nullptr), AdditionalModels(), - SnapPoints(NULL), - ProxyArray(NULL), + SnapPoints(nullptr), + ProxyArray(nullptr), LODBias(1.0f) { // Set the name @@ -1112,7 +1112,7 @@ HLodClass::HLodClass(const HLodDefClass & def) : RenderObjClass * robj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(def.Lod[ilod].ModelName[imodel]); int boneindex = def.Lod[ilod].BoneIndex[imodel]; - if (robj != NULL) { + if (robj != nullptr) { Add_Lod_Model(ilod,robj,boneindex); robj->Release_Ref(); } @@ -1125,7 +1125,7 @@ HLodClass::HLodClass(const HLodDefClass & def) : for (int iagg=0; iaggCreate_Render_Obj(def.Aggregates.ModelName[iagg]); int boneindex = def.Aggregates.BoneIndex[iagg]; - if (robj != NULL) { + if (robj != nullptr) { Add_Sub_Object_To_Bone(robj,boneindex); robj->Release_Ref(); } @@ -1167,13 +1167,13 @@ HLodClass::HLodClass(const HModelDefClass & def) : Animatable3DObjClass(def.BasePoseName), LodCount(0), CurLod(0), - Lod(NULL), + Lod(nullptr), BoundingBoxIndex(-1), - Cost(NULL), - Value(NULL), + Cost(nullptr), + Value(nullptr), AdditionalModels(), - SnapPoints(NULL), - ProxyArray(NULL), + SnapPoints(nullptr), + ProxyArray(nullptr), LODBias(1.0f) { // Set the name @@ -1248,7 +1248,7 @@ HLodClass & HLodClass::operator = (const HLodClass & that) WWASSERT(LodCount >= 1); Lod = W3DNEWARRAY ModelArrayClass[LodCount]; - WWASSERT(Lod != NULL); + WWASSERT(Lod != nullptr); Cost = W3DNEWARRAY float[LodCount]; WWASSERT(Cost); // Value has LodCount + 1 entries so PostIncrementValue can always use @@ -1349,10 +1349,10 @@ void HLodClass::Free(void) for (model = 0; model < Lod[lod].Count(); model++) { RenderObjClass * robj = Lod[lod][model].Model; - Lod[lod][model].Model = NULL; + Lod[lod][model].Model = nullptr; WWASSERT(robj); - robj->Set_Container(NULL); + robj->Set_Container(nullptr); robj->Release_Ref(); } @@ -1361,21 +1361,21 @@ void HLodClass::Free(void) } delete[] Lod; - Lod = NULL; + Lod = nullptr; LodCount = 0; delete[] Cost; - Cost = NULL; + Cost = nullptr; delete[] Value; - Value = NULL; + Value = nullptr; for (model = 0; model < AdditionalModels.Count(); model++) { RenderObjClass * robj = AdditionalModels[model].Model; - AdditionalModels[model].Model = NULL; + AdditionalModels[model].Model = nullptr; WWASSERT(robj); - robj->Set_Container(NULL); + robj->Set_Container(nullptr); robj->Release_Ref(); } AdditionalModels.Delete_All(); @@ -1424,7 +1424,7 @@ void HLodClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const if (BoundingBoxIndex >= 0 && BoundingBoxIndex < count) { RenderObjClass *mesh = Lod[LodCount - 1][BoundingBoxIndex].Model; - if (mesh != NULL && mesh->Class_ID () == RenderObjClass::CLASSID_OBBOX) { + if (mesh != nullptr && mesh->Class_ID () == RenderObjClass::CLASSID_OBBOX) { OBBoxRenderObjClass *obbox_mesh = (OBBoxRenderObjClass *)mesh; @@ -1707,7 +1707,7 @@ int HLodClass::Get_Lod_Model_Count(int lod_index) const *=============================================================================================*/ RenderObjClass *HLodClass::Peek_Lod_Model(int lod_index, int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Params valid? WWASSERT(lod_index >= 0); @@ -1739,7 +1739,7 @@ RenderObjClass *HLodClass::Peek_Lod_Model(int lod_index, int model_index) const *=============================================================================================*/ RenderObjClass *HLodClass::Get_Lod_Model(int lod_index, int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Params valid? WWASSERT(lod_index >= 0); @@ -1750,7 +1750,7 @@ RenderObjClass *HLodClass::Get_Lod_Model(int lod_index, int model_index) const // Get a pointer to the requested model pmodel = Lod[lod_index][model_index].Model; - if (pmodel != NULL) { + if (pmodel != nullptr) { pmodel->Add_Ref (); } } @@ -1824,7 +1824,7 @@ int HLodClass::Get_Additional_Model_Count(void) const *=============================================================================================*/ RenderObjClass * HLodClass::Peek_Additional_Model (int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Param valid? WWASSERT(model_index >= 0); @@ -1855,7 +1855,7 @@ RenderObjClass * HLodClass::Peek_Additional_Model (int model_index) const *=============================================================================================*/ RenderObjClass * HLodClass::Get_Additional_Model (int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Param valid? WWASSERT(model_index >= 0); @@ -1865,7 +1865,7 @@ RenderObjClass * HLodClass::Get_Additional_Model (int model_index) const // Get a pointer to the requested model pmodel = AdditionalModels[model_index].Model; - if (pmodel != NULL) { + if (pmodel != nullptr) { pmodel->Add_Ref (); } } @@ -1907,7 +1907,7 @@ int HLodClass::Get_Additional_Model_Bone (int model_index) const /*********************************************************************************************** - * HLodClass::Is_NULL_Lod_Included -- does this HLod have NULL as its lowest LOD * + * HLodClass::Is_NULL_Lod_Included -- does this HLod have nullptr as its lowest LOD * * * * INPUT: * * * @@ -1923,7 +1923,7 @@ bool HLodClass::Is_NULL_Lod_Included(void) const bool included = false; // Determine if the lowest-level LOD is the null render object or not... - if ((LodCount > 0) && (Lod[0][0].Model != NULL)) { + if ((LodCount > 0) && (Lod[0][0].Model != nullptr)) { included = (Lod[0][0].Model->Class_ID () == RenderObjClass::CLASSID_NULL); } @@ -1933,7 +1933,7 @@ bool HLodClass::Is_NULL_Lod_Included(void) const /*********************************************************************************************** - * HLodClass::Include_NULL_Lod -- Add NULL as the lowest LOD * + * HLodClass::Include_NULL_Lod -- Add nullptr as the lowest LOD * * * * INPUT: * * * @@ -1948,15 +1948,15 @@ void HLodClass::Include_NULL_Lod(bool include) { if ((include == false) && Is_NULL_Lod_Included ()) { - // Free the 'NULL' object's stored information + // Free the 'nullptr' object's stored information int index = 0; for (int model = 0; model < Lod[index].Count (); model++) { RenderObjClass * robj = Lod[index][model].Model; - Lod[index][model].Model = NULL; + Lod[index][model].Model = nullptr; WWASSERT(robj); - robj->Set_Container (NULL); + robj->Set_Container (nullptr); robj->Release_Ref (); } @@ -1984,10 +1984,10 @@ void HLodClass::Include_NULL_Lod(bool include) } else if (include && (Is_NULL_Lod_Included () == false)) { - // Tag the NULL render object onto the end + // Tag the nullptr render object onto the end RenderObjClass *null_object = WW3DAssetManager::Get_Instance ()->Create_Render_Obj ("NULL"); - WWASSERT (null_object != NULL); - if (null_object != NULL) { + WWASSERT (null_object != nullptr); + if (null_object != nullptr) { // Resize the lod array ModelArrayClass *temp_lods = W3DNEWARRAY ModelArrayClass[LodCount + 1]; @@ -2009,7 +2009,7 @@ void HLodClass::Include_NULL_Lod(bool include) Cost = temp_cost; LodCount ++; - // Add this NULL object to the start of the lod list + // Add this null object to the start of the lod list Add_Lod_Model (0, null_object, 0); null_object->Release_Ref (); } @@ -2039,7 +2039,7 @@ void HLodClass::Include_NULL_Lod(bool include) *=============================================================================================*/ int HLodClass::Get_Proxy_Count(void) const { - if (ProxyArray != NULL) { + if (ProxyArray != nullptr) { return ProxyArray->Length(); } else { return 0; @@ -2063,7 +2063,7 @@ bool HLodClass::Get_Proxy (int index, ProxyClass &proxy) const { bool retval = false; - if (ProxyArray != NULL) { + if (ProxyArray != nullptr) { // // Lookup the proxy's transform @@ -2376,7 +2376,7 @@ int HLodClass::Add_Sub_Object(RenderObjClass * subobj) int HLodClass::Remove_Sub_Object(RenderObjClass * removeme) { // no object given? - if (removeme == NULL) { + if (removeme == nullptr) { return 0; } @@ -2413,7 +2413,7 @@ int HLodClass::Remove_Sub_Object(RenderObjClass * removeme) if (found) { // clear the object's container pointer - removeme->Set_Container(NULL); + removeme->Set_Container(nullptr); // let him know in case he is removed from the scene as a result of this // this is the combination of this HLod being in the scene and and this model @@ -2499,7 +2499,7 @@ RenderObjClass * HLodClass::Get_Sub_Object_On_Bone(int index,int boneindex) cons count++; } } - return NULL; + return nullptr; } @@ -3206,7 +3206,7 @@ RenderObjClass * HLodClass::Get_Current_LOD(void) int count = Get_Lod_Model_Count(CurLod); if(!count) - return 0; + return nullptr; return Get_Lod_Model(CurLod, 0); } @@ -3318,7 +3318,7 @@ int HLodClass::Get_Num_Snap_Points(void) *=============================================================================================*/ void HLodClass::Get_Snap_Point(int index,Vector3 * set) { - WWASSERT(set != NULL); + WWASSERT(set != nullptr); if (SnapPoints) { *set = (*SnapPoints)[index]; } else { @@ -3418,7 +3418,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) { const char *name = model->Get_Name (); const char *name_seg = ::strchr (name, '.'); - if (name_seg != NULL) { + if (name_seg != nullptr) { name = name_seg + 1; } @@ -3433,7 +3433,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) int i; - RenderObjClass * robj = NULL; + RenderObjClass * robj = nullptr; // if we don't have any sub objects, just set default bounds if (Get_Num_Sub_Objects() <= 0) { @@ -3509,7 +3509,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) *=============================================================================================*/ void HLodClass::Add_Lod_Model(int lod, RenderObjClass * robj, int boneindex) { - WWASSERT(robj != NULL); + WWASSERT(robj != nullptr); ModelNodeClass newnode; newnode.Model = robj; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index f30f54eb303..3277e42a040 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -195,9 +195,9 @@ HMorphAnimClass::HMorphAnimClass(void) : FrameRate(0.0f), ChannelCount(0), NumNodes(0), - PoseData(NULL), - MorphKeyData(NULL), - PivotChannel(NULL) + PoseData(nullptr), + MorphKeyData(nullptr), + PivotChannel(nullptr) { memset(Name,0,sizeof(Name)); memset(AnimName,0,sizeof(AnimName)); @@ -211,19 +211,19 @@ HMorphAnimClass::~HMorphAnimClass(void) void HMorphAnimClass::Free(void) { - if (PoseData != NULL) { + if (PoseData != nullptr) { for (int i=0; i= '0' && str[0] <= '9') || str[0] == '-' || str[0] == '.'); str ++; } @@ -349,7 +349,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Attempt to load the new base pose // HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - WWASSERT (base_pose != NULL); + WWASSERT (base_pose != nullptr); NumNodes = base_pose->Num_Pivots(); // @@ -362,7 +362,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Get the list of comma-delimited strings from the header // - StringClass *column_list = NULL; + StringClass *column_list = nullptr; int column_count = Build_List_From_String (header, ",", &column_list); // @@ -394,7 +394,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Get the frame descriptions from this line // - StringClass *channel_list = NULL; + StringClass *channel_list = nullptr; int list_count = Build_List_From_String (frame_desc, ",", &channel_list); WWASSERT (list_count > 0); @@ -427,7 +427,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] channel_list; - channel_list = NULL; + channel_list = nullptr; } // @@ -441,7 +441,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] column_list; - column_list = NULL; + column_list = nullptr; } return retval; @@ -449,7 +449,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des void HMorphAnimClass::Resolve_Pivot_Channels(void) { - WWASSERT (PivotChannel != NULL); + WWASSERT (PivotChannel != nullptr); // // Loop over all the pivots in the HTree @@ -482,7 +482,7 @@ void HMorphAnimClass::Set_Name(const char * name) // StringClass full_name = name; char *separator = ::strchr (full_name.Peek_Buffer(), '.'); - if (separator != NULL) { + if (separator != nullptr) { // // Null out the separator and copy the two names @@ -510,7 +510,7 @@ int HMorphAnimClass::Create_New_Morph(const int channels, HAnimClass *anim[]) ChannelCount = channels; // read in the animation header - if (anim == NULL) { + if (anim == nullptr) { return LOAD_ERROR; } @@ -559,7 +559,7 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) strlcat(Name, AnimName, ARRAY_SIZE(Name)); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - if (base_pose == NULL) { + if (base_pose == nullptr) { return LOAD_ERROR; } NumNodes = base_pose->Num_Pivots(); @@ -607,7 +607,7 @@ void HMorphAnimClass::read_channel(ChunkLoadClass & cload,int channel) //StringClass channel_anim_name; //channel_anim_name.Format ("%s.%s", HierarchyName, anim_name); PoseData[channel] = WW3DAssetManager::Get_Instance()->Get_HAnim(anim_name); - WWASSERT(PoseData[channel] != NULL); + WWASSERT(PoseData[channel] != nullptr); cload.Open_Chunk(); WWASSERT(cload.Cur_Chunk_ID() == W3D_CHUNK_MORPHANIM_KEYDATA); @@ -655,7 +655,7 @@ int HMorphAnimClass::Save_W3D(ChunkSaveClass & csave) void HMorphAnimClass::write_channel(ChunkSaveClass & csave,int channel) { - WWASSERT(PoseData[channel] != NULL); + WWASSERT(PoseData[channel] != nullptr); const char * pose_name = PoseData[channel]->Get_Name(); csave.Begin_Chunk(W3D_CHUNK_MORPHANIM_POSENAME); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index b4dcf09fe14..497753f54e6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -68,14 +68,14 @@ * HISTORY: * *=============================================================================================*/ NodeMotionStruct::NodeMotionStruct() : - X(NULL), - Y(NULL), - Z(NULL), - XR(NULL), - YR(NULL), - ZR(NULL), - Q(NULL), - Vis(NULL) + X(nullptr), + Y(nullptr), + Z(nullptr), + XR(nullptr), + YR(nullptr), + ZR(nullptr), + Q(nullptr), + Vis(nullptr) { } @@ -121,7 +121,7 @@ HRawAnimClass::HRawAnimClass(void) : NumFrames(0), NumNodes(0), FrameRate(0), - NodeMotion(NULL) + NodeMotion(nullptr) { memset(Name,0,W3D_NAME_LEN); memset(HierarchyName,0,W3D_NAME_LEN); @@ -161,7 +161,7 @@ HRawAnimClass::~HRawAnimClass(void) void HRawAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -220,7 +220,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) strcpy(HierarchyName, aheader.HierarchyName); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - if (base_pose == NULL) { + if (base_pose == nullptr) { goto Error; } NumNodes = base_pose->Num_Pivots(); @@ -229,7 +229,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) FrameRate = aheader.FrameRate; NodeMotion = W3DNEWARRAY NodeMotionStruct[ NumNodes ]; - if (NodeMotion == NULL) { + if (NodeMotion == nullptr) { goto Error; } @@ -429,7 +429,7 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co { struct NodeMotionStruct * motion = &NodeMotion[pividx]; - if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) { + if ( (motion->X == nullptr) && (motion->Y == nullptr) && (motion->Z == nullptr) ) { trans.Set(0.0f,0.0f,0.0f); return; } @@ -448,13 +448,13 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co Vector3 trans0(0.0f,0.0f,0.0f); - if (motion->X != NULL) { + if (motion->X != nullptr) { motion->X->Get_Vector((int)frame0,&(trans0[0])); } - if (motion->Y != NULL) { + if (motion->Y != nullptr) { motion->Y->Get_Vector((int)frame0,&(trans0[1])); } - if (motion->Z != NULL) { + if (motion->Z != nullptr) { motion->Z->Get_Vector((int)frame0,&(trans0[2])); } @@ -465,13 +465,13 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co Vector3 trans1(0.0f,0.0f,0.0f); - if (motion->X != NULL) { + if (motion->X != nullptr) { motion->X->Get_Vector((int)frame1,&(trans1[0])); } - if (motion->Y != NULL) { + if (motion->Y != nullptr) { motion->Y->Get_Vector((int)frame1,&(trans1[1])); } - if (motion->Z != NULL) { + if (motion->Z != nullptr) { motion->Z->Get_Vector((int)frame1,&(trans1[2])); } @@ -509,7 +509,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const Quaternion q0, q1; MotionChannelClass* mc = NodeMotion[pividx].Q; - if (mc != NULL) + if (mc != nullptr) { mc->Get_Vector_As_Quat((int)frame0, q0); mc->Get_Vector_As_Quat((int)frame1, q1); @@ -537,7 +537,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const float vals[4]; Quaternion q0(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame0,vals); q0.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -548,7 +548,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const } Quaternion q1(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame1,vals); q1.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -573,7 +573,7 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const { struct NodeMotionStruct * motion = &NodeMotion[pividx]; -// if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) { +// if ( (motion->X == nullptr) && (motion->Y == nullptr) && (motion->Z == nullptr) ) { // trans.Set(0.0f,0.0f,0.0f); // return; // } @@ -591,21 +591,21 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const float vals[4]; Quaternion q0(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame0,vals); q0.Set(vals[0],vals[1],vals[2],vals[3]); } if ( ratio == 0.0f ) { ::Build_Matrix3D(q0,mtx); - if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(mtx[0][3])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(mtx[1][3])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(mtx[2][3])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame0,&(mtx[0][3])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame0,&(mtx[1][3])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame0,&(mtx[2][3])); return; } Quaternion q1(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame1,vals); q1.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -615,14 +615,14 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const ::Build_Matrix3D(q,mtx); Vector3 trans0(0.0f,0.0f,0.0f); - if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(trans0[0])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(trans0[1])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(trans0[2])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame0,&(trans0[0])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame0,&(trans0[1])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame0,&(trans0[2])); Vector3 trans1(0.0f,0.0f,0.0f); - if (motion->X != NULL) motion->X->Get_Vector((int)frame1,&(trans1[0])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame1,&(trans1[1])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame1,&(trans1[2])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame1,&(trans1[0])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame1,&(trans1[1])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame1,&(trans1[2])); Vector3 trans; Vector3::Lerp( trans0, trans1, ratio, &trans ); @@ -644,7 +644,7 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const *=============================================================================================*/ bool HRawAnimClass::Get_Visibility(int pividx,float frame) { - if (NodeMotion[pividx].Vis != NULL) { + if (NodeMotion[pividx].Vis != nullptr) { return (NodeMotion[pividx].Vis->Get_Bit((int)frame) == 1); } @@ -669,14 +669,14 @@ bool HRawAnimClass::Is_Node_Motion_Present(int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - if (NodeMotion[pividx].X != NULL) return true; - if (NodeMotion[pividx].Y != NULL) return true; - if (NodeMotion[pividx].Z != NULL) return true; - if (NodeMotion[pividx].XR != NULL) return true; - if (NodeMotion[pividx].YR != NULL) return true; - if (NodeMotion[pividx].ZR != NULL) return true; - if (NodeMotion[pividx].Q != NULL) return true; - if (NodeMotion[pividx].Vis != NULL) return true; + if (NodeMotion[pividx].X != nullptr) return true; + if (NodeMotion[pividx].Y != nullptr) return true; + if (NodeMotion[pividx].Z != nullptr) return true; + if (NodeMotion[pividx].XR != nullptr) return true; + if (NodeMotion[pividx].YR != nullptr) return true; + if (NodeMotion[pividx].ZR != nullptr) return true; + if (NodeMotion[pividx].Q != nullptr) return true; + if (NodeMotion[pividx].Vis != nullptr) return true; return false; } @@ -684,31 +684,31 @@ bool HRawAnimClass::Is_Node_Motion_Present(int pividx) bool HRawAnimClass::Has_X_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].X != NULL; + return NodeMotion[pividx].X != nullptr; } bool HRawAnimClass::Has_Y_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Y != NULL; + return NodeMotion[pividx].Y != nullptr; } bool HRawAnimClass::Has_Z_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Z != NULL; + return NodeMotion[pividx].Z != nullptr; } bool HRawAnimClass::Has_Rotation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Q != NULL; + return NodeMotion[pividx].Q != nullptr; } bool HRawAnimClass::Has_Visibility (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Vis != NULL; + return NodeMotion[pividx].Vis != nullptr; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp index c0c8fdec4df..4fc53aa7a3f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp @@ -67,7 +67,7 @@ HTreeManagerClass::HTreeManagerClass(void) : NumTrees(0) { for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } } @@ -121,7 +121,7 @@ void HTreeManagerClass::Free_All_Trees(void) { for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } NumTrees = 0; } @@ -146,7 +146,7 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis int treeidx=0; for (; treeidx < MAX_TREES; treeidx++) { - if (TreePtr[treeidx] != NULL) { + if (TreePtr[treeidx] != nullptr) { if (exclusion_list.Is_Excluded(TreePtr[treeidx])) { @@ -158,7 +158,7 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis //WWDEBUG_SAY(("deleting tree %s",TreePtr[treeidx]->Get_Name())); delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } } } @@ -182,7 +182,7 @@ int HTreeManagerClass::Load_Tree(ChunkLoadClass & cload) WWMEMLOG(MEM_ANIMATION); HTreeClass * newtree = W3DNEW HTreeClass; - if (newtree == NULL) { + if (newtree == nullptr) { goto Error; } @@ -255,7 +255,7 @@ char *HTreeManagerClass::Get_Tree_Name(const int idx) } } - return NULL; + return nullptr; } @@ -280,7 +280,7 @@ HTreeClass * HTreeManagerClass::Get_Tree(const char * name) return TreePtr[i]; } } - return NULL; + return nullptr; } @@ -301,6 +301,6 @@ HTreeClass * HTreeManagerClass::Get_Tree(int id) if ((id >= 0) && (id < NumTrees)) { return TreePtr[id]; } else { - return NULL; + return nullptr; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h index 1e9f8ecc21d..ed83f8a8a3d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h @@ -94,7 +94,7 @@ class MatrixMapperClass : public TextureMapperClass void Compute_Texture_Coordinate(const Vector3 & point,Vector3 * set_stq); - TextureMapperClass* Clone(void) const { WWASSERT(0); return NULL; } + TextureMapperClass* Clone(void) const { WWASSERT(0); return nullptr; } virtual void Apply(int uv_array_index); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp index 178db80b333..1127a75c8b3 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -154,11 +154,11 @@ static DynamicVectorClass _TempVertexBuffer; * 1/6/98 GTH : Created. * *=============================================================================================*/ MeshClass::MeshClass(void) : - Model(NULL), - DecalMesh(NULL), - LightEnvironment(NULL), + Model(nullptr), + DecalMesh(nullptr), + LightEnvironment(nullptr), BaseVertexOffset(0), - NextVisibleSkin(NULL), + NextVisibleSkin(nullptr), m_alphaOverride(1.0f), m_materialPassAlphaOverride(1.0f), m_materialPassEmissiveOverride(1.0f) @@ -181,11 +181,11 @@ MeshClass::MeshClass(void) : *=============================================================================================*/ MeshClass::MeshClass(const MeshClass & that) : RenderObjClass(that), - Model(NULL), - DecalMesh(NULL), - LightEnvironment(NULL), + Model(nullptr), + DecalMesh(nullptr), + LightEnvironment(nullptr), BaseVertexOffset(that.BaseVertexOffset), - NextVisibleSkin(NULL), + NextVisibleSkin(nullptr), m_alphaOverride(1.0f), m_materialPassAlphaOverride(1.0f), m_materialPassEmissiveOverride(1.0f) @@ -217,7 +217,7 @@ MeshClass & MeshClass::operator = (const MeshClass & that) // just dont copy the decals or light environment REF_PTR_RELEASE(DecalMesh); - LightEnvironment = NULL; + LightEnvironment = nullptr; } return * this; } @@ -391,7 +391,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) return Model->MatInfo; } } - return NULL; + return nullptr; } @@ -409,7 +409,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) *=============================================================================================*/ MeshModelClass * MeshClass::Get_Model(void) { - if (Model != NULL) { + if (Model != nullptr) { Model->Add_Ref(); } return Model; @@ -510,8 +510,8 @@ void MeshClass::Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm) void MeshClass::Get_Deformed_Vertices(Vector3 *dst_vert) { WWASSERT(Model->Get_Flag(MeshGeometryClass::SKIN)); - WWASSERT(Container != NULL); - WWASSERT(Container->Get_HTree() != NULL); + WWASSERT(Container != nullptr); + WWASSERT(Container->Get_HTree() != nullptr); Model->get_deformed_vertices(dst_vert,Container->Get_HTree()); } @@ -564,7 +564,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) Model->Generate_Rigid_APT(localbox, temp_apt); if (temp_apt.Count() > 0) { - if (DecalMesh == NULL) { + if (DecalMesh == nullptr) { DecalMesh = NEW_REF(RigidDecalMeshClass, (this, generator->Peek_Decal_System())); } DecalMesh->Create_Decal(generator, localbox, temp_apt); @@ -592,7 +592,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) // if it is not empty, add a decal if (temp_apt.Count() > 0) { - if (DecalMesh == NULL) { + if (DecalMesh == nullptr) { DecalMesh = NEW_REF(SkinDecalMeshClass, (this, generator->Peek_Decal_System())); } DecalMesh->Create_Decal(generator, worldbox, temp_apt, &_TempVertexBuffer); @@ -615,7 +615,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) *=============================================================================================*/ void MeshClass::Delete_Decal(uint32 decal_id) { - if (DecalMesh != NULL) { + if (DecalMesh != nullptr) { DecalMesh->Delete_Decal(decal_id); } } @@ -749,14 +749,14 @@ void MeshClass::Render(RenderInfoClass & rinfo) ** to tell the mesh rendering system to process this skin */ if (rendered_something && Model->Get_Flag(MeshGeometryClass::SKIN)) { - //WWASSERT(dynamic_cast(fvf_container) != NULL); + //WWASSERT(dynamic_cast(fvf_container) != nullptr); static_cast(fvf_container)->Add_Visible_Skin(this); } /* ** If we have a decal mesh, link it into the mesh rendering system */ - if (DecalMesh != NULL) { + if (DecalMesh != nullptr) { const SphereClass & ws_sphere = Get_Bounding_Sphere(); Vector3 cam_space_sphere_center; rinfo.Camera.Transform_To_View_Space(cam_space_sphere_center,ws_sphere.Center); @@ -788,7 +788,7 @@ void MeshClass::Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass * float oldOpacity=-1.0f; Vector3 oldEmissive(-1,-1,-1); - if (LightEnvironment != NULL) { + if (LightEnvironment != nullptr) { DX8Wrapper::Set_Light_Environment(LightEnvironment); } @@ -839,7 +839,7 @@ void MeshClass::Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass * //MW: Need uninstall custom materials in case they leave D3D in unknown state pass->UnInstall_Materials(); - } else if ((pass->Get_Cull_Volume() != NULL) && (MaterialPassClass::Is_Per_Polygon_Culling_Enabled())) { + } else if ((pass->Get_Cull_Volume() != nullptr) && (MaterialPassClass::Is_Per_Polygon_Culling_Enabled())) { /* ** Generate the APT @@ -990,7 +990,7 @@ void MeshClass::Special_Render(SpecialRenderInfoClass & rinfo) if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); if (Model->Get_Flag(MeshModelClass::SKIN) == 0) { rinfo.VisRasterizer->Set_Model_Transform(Transform); @@ -1016,8 +1016,8 @@ void MeshClass::Special_Render(SpecialRenderInfoClass & rinfo) } if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_SHADOW) { - const HTreeClass * htree = NULL; - if (Container!=NULL) { + const HTreeClass * htree = nullptr; + if (Container!=nullptr) { htree = Container->Get_HTree(); } Model->Shadow_Render(rinfo,Transform,htree); @@ -1104,7 +1104,7 @@ WW3DErrorType MeshClass::Load_W3D(ChunkLoadClass & cload) ** Create empty MaterialInfo and Model */ Model = NEW_REF(MeshModelClass,()); - if (Model == NULL) { + if (Model == nullptr) { WWDEBUG_SAY(("MeshClass::Load - Failed to allocate model")); return WW3D_ERROR_LOAD_FAILED; } @@ -1425,7 +1425,7 @@ void MeshClass::Add_Dependencies_To_List // Get a pointer to this mesh's material information object // MaterialInfoClass *material = Get_Material_Info (); - if (material != NULL) { + if (material != nullptr) { // // Loop through all the textures and add their filenames to our list @@ -1436,7 +1436,7 @@ void MeshClass::Add_Dependencies_To_List // Add this texture's filename to the list // TextureClass *texture = material->Peek_Texture (index); - if (texture != NULL) { + if (texture != nullptr) { file_list.Add (texture->Get_Full_Path ()); } } @@ -1530,7 +1530,7 @@ void MeshClass::Set_Sort_Level(int level) int MeshClass::Get_Draw_Call_Count(void) const { - if (Model != NULL) { + if (Model != nullptr) { // Prefer to return the number of polygon renderers int prcount = Model->PolygonRendererList.Count(); if (prcount > 0) { @@ -1538,7 +1538,7 @@ int MeshClass::Get_Draw_Call_Count(void) const } // Otherwise if we have textures, return the number of textures (e.g. dont have prs when sorting) - if ((Model->MatInfo != NULL) && (Model->MatInfo->Texture_Count() > 0)) { + if ((Model->MatInfo != nullptr) && (Model->MatInfo->Texture_Count() > 0)) { return Model->MatInfo->Texture_Count(); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h index c1633d5a0ea..81b2ae7aaff 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h @@ -141,7 +141,7 @@ class MeshClass : public W3DMPO, public RenderObjClass void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm); void Get_Deformed_Vertices(Vector3 *dst_vert); - void Set_Lighting_Environment(LightEnvironmentClass * light_env) { if (light_env) {m_localLightEnv=*light_env;LightEnvironment = &m_localLightEnv;} else {LightEnvironment = NULL;} } + void Set_Lighting_Environment(LightEnvironmentClass * light_env) { if (light_env) {m_localLightEnv=*light_env;LightEnvironment = &m_localLightEnv;} else {LightEnvironment = nullptr;} } LightEnvironmentClass * Get_Lighting_Environment(void) { return LightEnvironment; } float Get_Alpha_Override(void) { return m_alphaOverride;} diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index db16e9d09f2..7923ba8496c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -160,7 +160,7 @@ class VertexArrayClass VertexArrayClass(int maxsize,int match_normals = 0) { - Verts = NULL; + Verts = nullptr; assert(maxsize > 0); Verts = W3DNEWARRAY MeshBuilderClass::VertClass[maxsize]; assert(Verts); @@ -406,7 +406,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -557,16 +557,16 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ State(STATE_ACCEPTING_INPUT), PassCount(pass_count), FaceCount(0), - Faces(NULL), + Faces(nullptr), InputVertCount(0), VertCount(0), - Verts(NULL), + Verts(nullptr), CurFace(0), AllocFaceCount(0), AllocFaceGrowth(0), PolyOrderPass(0), PolyOrderStage(0), - WorldInfo (NULL) + WorldInfo (nullptr) { Reset(pass_count,face_count_guess,face_count_growth_rate); } @@ -586,7 +586,7 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ MeshBuilderClass::~MeshBuilderClass(void) { Free(); - Set_World_Info(NULL); + Set_World_Info(nullptr); } @@ -605,10 +605,10 @@ MeshBuilderClass::~MeshBuilderClass(void) void MeshBuilderClass::Free(void) { delete[] Faces; - Faces = NULL; + Faces = nullptr; delete Verts; - Verts = NULL; + Verts = nullptr; FaceCount = 0; VertCount = 0; @@ -823,7 +823,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) /* ** Smooth this mesh with neighboring meshes! */ - if (WorldInfo != NULL && WorldInfo->Are_Meshes_Smoothed ()) { + if (WorldInfo != nullptr && WorldInfo->Are_Meshes_Smoothed ()) { for (vertidx = 0; vertidx < VertCount; vertidx++) { if (Verts[vertidx].ShadeIndex == vertidx) { Verts[vertidx].Normal += WorldInfo->Get_Shared_Vertex_Normal(Verts[vertidx].Position, Verts[vertidx].SharedSmGroup); @@ -1010,8 +1010,8 @@ void MeshBuilderClass::Compute_Bounding_Box(Vector3 * set_min,Vector3 * set_max) { int i; - assert(set_min != NULL); - assert(set_max != NULL); + assert(set_min != nullptr); + assert(set_max != nullptr); // Bounding Box // straightforward, axis-aligned bounding box. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp index 221307965e6..bd3329b4751 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -121,25 +121,25 @@ static SimpleVecClass _VNormArray(1024); * 11/9/2000 gth : Created. * *=============================================================================================*/ MeshGeometryClass::MeshGeometryClass(void) : - MeshName(NULL), - UserText(NULL), + MeshName(nullptr), + UserText(nullptr), Flags(0), SortLevel(SORT_LEVEL_NONE), W3dAttributes(0), PolyCount(0), VertexCount(0), - Poly(NULL), - PolySurfaceType(NULL), - Vertex(NULL), - VertexNorm(NULL), - PlaneEq(NULL), - VertexShadeIdx(NULL), - VertexBoneLink(NULL), + Poly(nullptr), + PolySurfaceType(nullptr), + Vertex(nullptr), + VertexNorm(nullptr), + PlaneEq(nullptr), + VertexShadeIdx(nullptr), + VertexBoneLink(nullptr), BoundBoxMin(0,0,0), BoundBoxMax(1,1,1), BoundSphereCenter(0,0,0), BoundSphereRadius(1), - CullTree(NULL) + CullTree(nullptr) { } @@ -157,25 +157,25 @@ MeshGeometryClass::MeshGeometryClass(void) : * 11/9/2000 gth : Created. * *=============================================================================================*/ MeshGeometryClass::MeshGeometryClass(const MeshGeometryClass & that) : - MeshName(NULL), - UserText(NULL), + MeshName(nullptr), + UserText(nullptr), Flags(0), SortLevel(SORT_LEVEL_NONE), W3dAttributes(0), PolyCount(0), VertexCount(0), - Poly(NULL), - PolySurfaceType(NULL), - Vertex(NULL), - VertexNorm(NULL), - PlaneEq(NULL), - VertexShadeIdx(NULL), - VertexBoneLink(NULL), + Poly(nullptr), + PolySurfaceType(nullptr), + Vertex(nullptr), + VertexNorm(nullptr), + PlaneEq(nullptr), + VertexShadeIdx(nullptr), + VertexBoneLink(nullptr), BoundBoxMin(0,0,0), BoundBoxMax(1,1,1), BoundSphereCenter(0,0,0), BoundSphereRadius(1), - CullTree(NULL) + CullTree(nullptr) { *this = that; } @@ -311,7 +311,7 @@ const char * MeshGeometryClass::Get_Name(void) const if (MeshName) { return MeshName->Get_Array(); } - return NULL; + return nullptr; } @@ -356,7 +356,7 @@ const char * MeshGeometryClass::Get_User_Text(void) if (UserText) { return UserText->Get_Array(); } - return NULL; + return nullptr; } @@ -398,7 +398,7 @@ void MeshGeometryClass::Set_User_Text(char * usertext) *=============================================================================================*/ void MeshGeometryClass::Get_Bounding_Box(AABoxClass * set_box) { - WWASSERT(set_box != NULL); + WWASSERT(set_box != nullptr); set_box->Center = (BoundBoxMax + BoundBoxMin) * 0.5f; set_box->Extent = (BoundBoxMax - BoundBoxMin) * 0.5f; } @@ -418,7 +418,7 @@ void MeshGeometryClass::Get_Bounding_Box(AABoxClass * set_box) *=============================================================================================*/ void MeshGeometryClass::Get_Bounding_Sphere(SphereClass * set_sphere) { - WWASSERT(set_sphere != NULL); + WWASSERT(set_sphere != nullptr); set_sphere->Center = BoundSphereCenter; set_sphere->Radius = BoundSphereRadius; } @@ -473,7 +473,7 @@ void MeshGeometryClass::Generate_Rigid_APT(const Vector3 & view_dir, SimpleDynVe *=============================================================================================*/ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box, SimpleDynVecClass & apt) { - if (CullTree != NULL) { + if (CullTree != nullptr) { CullTree->Generate_APT(local_box, apt); } else { @@ -512,7 +512,7 @@ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box, SimpleD *=============================================================================================*/ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box,const Vector3 & viewdir,SimpleDynVecClass & apt) { - if (CullTree != NULL) { + if (CullTree != nullptr) { CullTree->Generate_APT(local_box, viewdir,apt); } else { @@ -1247,7 +1247,7 @@ bool MeshGeometryClass::cast_obbox_brute_force(OBBoxCollisionTestClass & boxtest *=============================================================================================*/ void MeshGeometryClass::Compute_Plane_Equations(Vector4 * peq) { - WWASSERT(peq!=NULL); + WWASSERT(peq!=nullptr); TriIndex * poly = Poly->Get_Array(); Vector3 * vert = Vertex->Get_Array(); @@ -1284,7 +1284,7 @@ void MeshGeometryClass::Compute_Plane_Equations(Vector4 * peq) *=============================================================================================*/ void MeshGeometryClass::Compute_Vertex_Normals(Vector3 * vnorm) { - WWASSERT(vnorm != NULL); + WWASSERT(vnorm != nullptr); if ((PolyCount == 0)|| (VertexCount == 0)) { return; } @@ -1376,7 +1376,7 @@ void MeshGeometryClass::Compute_Bounds(Vector3 * verts) } // find bounding box minimum and maximum - if (verts == NULL) { + if (verts == nullptr) { verts = Vertex->Get_Array(); } VectorProcessorClass::MinMax(verts,BoundBoxMin,BoundBoxMax,VertexCount); @@ -1465,7 +1465,7 @@ Vector4 * MeshGeometryClass::get_planes(bool create) if (PlaneEq) { return PlaneEq->Get_Array(); } - return NULL; + return nullptr; #endif } @@ -1540,7 +1540,7 @@ void MeshGeometryClass::Generate_Culling_Tree(void) AABTreeBuilderClass builder; builder.Build_AABTree(PolyCount,Poly->Get_Array(),VertexCount,Vertex->Get_Array()); - DEBUG_ASSERTCRASH(CullTree == NULL, ("MeshGeometryClass::Generate_Culling_Tree: Leaking CullTree")); + DEBUG_ASSERTCRASH(CullTree == nullptr, ("MeshGeometryClass::Generate_Culling_Tree: Leaking CullTree")); CullTree = NEW_REF(AABTreeClass,(&builder)); CullTree->Set_Mesh(this); } @@ -1611,7 +1611,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; /* ** Set Bounding Info @@ -1671,7 +1671,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) ** If this mesh is collideable and no AABTree was in the file, generate one now */ if ( (((W3dAttributes & W3D_MESH_FLAG_COLLISION_TYPE_MASK) >> W3D_MESH_FLAG_COLLISION_TYPE_SHIFT) != 0) && - (CullTree == NULL)) + (CullTree == nullptr)) { Generate_Culling_Tree(); } @@ -1892,9 +1892,9 @@ WW3DErrorType MeshGeometryClass::read_user_text(ChunkLoadClass & cload) ** This shouldn't happen but if there are more than one ** USER_TEXT chunks in the mesh file, store only the first ** one. I am assuming that if the UserText buffer is not - ** NULL, then a previous user text chunk has been read in... + ** nullptr, then a previous user text chunk has been read in... */ - if (UserText != NULL) { + if (UserText != nullptr) { return WW3D_ERROR_OK; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h index 15474c20faf..adfa0b0f656 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h @@ -149,7 +149,7 @@ class MeshGeometryClass : public W3DMPO, public RefCountClass, public MultiListO void Get_Bounding_Sphere(SphereClass * set_sphere); // exposed culling support - bool Has_Cull_Tree(void) { return CullTree != NULL; } + bool Has_Cull_Tree(void) { return CullTree != nullptr; } void Generate_Rigid_APT(const Vector3 & view_dir, SimpleDynVecClass & apt); void Generate_Rigid_APT(const OBBoxClass & local_box, SimpleDynVecClass & apt); @@ -263,7 +263,7 @@ inline uint32 * MeshGeometryClass::get_shade_indices(bool create) if (VertexShadeIdx) { return VertexShadeIdx->Get_Array(); } - return NULL; + return nullptr; } inline uint16 * MeshGeometryClass::get_bone_links(bool create) @@ -274,7 +274,7 @@ inline uint16 * MeshGeometryClass::get_bone_links(bool create) if (VertexBoneLink) { return VertexBoneLink->Get_Array(); } - return NULL; + return nullptr; } inline uint8 MeshGeometryClass::Get_Poly_Surface_Type(int poly_index) const diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp index 55561099f08..7033a708e70 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp @@ -180,26 +180,26 @@ MeshMatDescClass::MeshMatDescClass(void) : PolyCount(0) { for (int array=0;array < MAX_COLOR_ARRAYS; array++) { - ColorArray[array] = NULL; + ColorArray[array] = nullptr; } for (int uvarray=0;uvarrayGet_Element(vidx); - } else if (Material[pass] != NULL) { + } else if (Material[pass] != nullptr) { Material[pass]->Add_Ref(); return Material[pass]; } - return NULL; + return nullptr; } ShaderClass MeshMatDescClass::Get_Shader(int pidx,int pass) const @@ -522,13 +522,13 @@ TextureClass * MeshMatDescClass::Get_Texture(int pidx,int pass,int stage) const return TextureArray[pass][stage]->Get_Element(pidx); - } else if (Texture[pass][stage] != NULL) { + } else if (Texture[pass][stage] != nullptr) { Texture[pass][stage]->Add_Ref(); return Texture[pass][stage]; } - return NULL; + return nullptr; } VertexMaterialClass * MeshMatDescClass::Peek_Material(int vidx,int pass) const @@ -549,7 +549,7 @@ TextureClass * MeshMatDescClass::Peek_Texture(int pidx,int pass,int stage) const TexBufferClass * MeshMatDescClass::Get_Texture_Array(int pass,int stage,bool create) { - if (create && TextureArray[pass][stage] == NULL) { + if (create && TextureArray[pass][stage] == nullptr) { TextureArray[pass][stage] = NEW_REF(TexBufferClass,(PolyCount, "MeshMatDescClass::TextureArray")); } return TextureArray[pass][stage]; @@ -557,7 +557,7 @@ TexBufferClass * MeshMatDescClass::Get_Texture_Array(int pass,int stage,bool cre MatBufferClass * MeshMatDescClass::Get_Material_Array(int pass,bool create) { - if (create && MaterialArray[pass] == NULL) { + if (create && MaterialArray[pass] == nullptr) { MaterialArray[pass] = NEW_REF(MatBufferClass,(VertexCount, "MeshMatDescClass::MaterialArray")); } return MaterialArray[pass]; @@ -565,14 +565,14 @@ MatBufferClass * MeshMatDescClass::Get_Material_Array(int pass,bool create) ShaderClass * MeshMatDescClass::Get_Shader_Array(int pass,bool create) { - if (create && ShaderArray[pass] == NULL) { + if (create && ShaderArray[pass] == nullptr) { ShaderArray[pass] = NEW_REF(ShareBufferClass,(PolyCount, "MeshMatDescClass::ShaderArray")); ShaderArray[pass]->Clear(); } if (ShaderArray[pass]) { return ShaderArray[pass]->Get_Array(); } - return NULL; + return nullptr; } void MeshMatDescClass::Make_UV_Array_Unique(int pass,int stage) @@ -587,7 +587,7 @@ void MeshMatDescClass::Make_UV_Array_Unique(int pass,int stage) void MeshMatDescClass::Make_Color_Array_Unique(int array) { - if ((ColorArray[array] != NULL) && (ColorArray[array]->Num_Refs() > 1)) { + if ((ColorArray[array] != nullptr) && (ColorArray[array]->Num_Refs() > 1)) { ShareBufferClass * unique_color_array = NEW_REF(ShareBufferClass,(*ColorArray[array])); ColorArray[array]->Release_Ref(); ColorArray[array] = unique_color_array; @@ -623,13 +623,13 @@ void MeshMatDescClass::Install_UV_Array(int pass,int stage,Vector2 * uvs,int cou ** Find the first empty UV-array slot */ int new_index = 0; - while ((UV[new_index] != NULL) && (new_index < MAX_UV_ARRAYS)) { + while ((UV[new_index] != nullptr) && (new_index < MAX_UV_ARRAYS)) { new_index++; } if (new_index < MAX_UV_ARRAYS) { - WWASSERT(UV[new_index] == NULL); + WWASSERT(UV[new_index] == nullptr); UV[new_index] = NEW_REF(UVBufferClass,(count, "MeshMatDescClass::UV")); memcpy(UV[new_index]->Get_Array(),uvs,count * sizeof(Vector2)); UV[new_index]->Update_CRC(); // update the crc for future comparision @@ -651,25 +651,25 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * /* ** If this pass doesn't have a vertex material, create one */ - if ((Material[pass] == NULL) && (MaterialArray[pass] == NULL)) { + if ((Material[pass] == nullptr) && (MaterialArray[pass] == nullptr)) { Material[pass] = NEW_REF(VertexMaterialClass,()); } /* ** Configure the materials to source the uv coordinates and colors */ - if (Material[pass] != NULL) { + if (Material[pass] != nullptr) { Configure_Material(Material[pass],pass,lighting_enabled); } else { - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(pass,0); for (int vidx=0; vidxGet_Diffuse(&single_diffuse); @@ -743,8 +743,8 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * } // If both DCG and DIG arrays are submitted, multiply them together to DCG channel - if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != NULL) && - (DIGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[1] != NULL)) { + if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != nullptr) && + (DIGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[1] != nullptr)) { unsigned * diffuse_array = ColorArray[0]->Get_Array(); unsigned * emissive_array = ColorArray[1]->Get_Array(); @@ -759,12 +759,12 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * } DIGSource[pass]=VertexMaterialClass::MATERIAL; // DIG channel no more - if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != NULL)) { + if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != nullptr)) { unsigned * diffuse_array = ColorArray[0]->Get_Array(); Vector3 mtl_diffuse; float mtl_opacity = 1.0f; - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0,pass); for (int vidx=0; vidxGet_Array(); Vector3 mtl_diffuse; float mtl_opacity = 1.0f; - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0,pass); for (int vidx=0; vidxGet_Array(); Vector3 mtl_emissive; - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0,pass); for (int vidx=0; vidxDo_Mappers_Need_Normals()) return true; } else { - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(pass,0); for (int vidx=0; vidxDo_Mappers_Need_Normals()) return true; prev_mtl = mtl; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h index 29266923896..f1ea4e3cd10 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h @@ -145,11 +145,11 @@ class MeshMatDescClass : public W3DMPO ** Determine whether this material description contains data for the specified category */ bool Has_UV(int pass,int stage) { return UVSource[pass][stage] != -1; } - bool Has_Color_Array(int array) { return ColorArray[array] != NULL; } + bool Has_Color_Array(int array) { return ColorArray[array] != nullptr; } - bool Has_Texture_Data(int pass,int stage) { return (Texture[pass][stage] != NULL) || (TextureArray[pass][stage] != NULL); } - bool Has_Shader_Data(int pass) { return (Shader[pass] != NullShader) || (ShaderArray[pass] != NULL); } - bool Has_Material_Data(int pass) { return (Material[pass] != NULL) || (MaterialArray[pass] != NULL); } + bool Has_Texture_Data(int pass,int stage) { return (Texture[pass][stage] != nullptr) || (TextureArray[pass][stage] != nullptr); } + bool Has_Shader_Data(int pass) { return (Shader[pass] != NullShader) || (ShaderArray[pass] != nullptr); } + bool Has_Material_Data(int pass) { return (Material[pass] != nullptr) || (MaterialArray[pass] != nullptr); } /* ** "Get" functions for Materials, Textures, and Shaders when there are more than one (per-polygon or per-vertex) @@ -178,7 +178,7 @@ class MeshMatDescClass : public W3DMPO ** Post-Load processing, configures all materials to use the correct passes and ** material color sources, etc. */ - void Post_Load_Process(bool enable_lighting = true,MeshModelClass * parent = NULL); + void Post_Load_Process(bool enable_lighting = true,MeshModelClass * parent = nullptr); void Disable_Lighting(void); /* @@ -225,7 +225,7 @@ class MeshMatDescClass : public W3DMPO /** ** MatBufferClass ** This is a ShareBufferClass of pointers to vertex materials. Should be written as a template... -** Get and Peek work like normal, and all non-NULL pointers will be released when the buffer +** Get and Peek work like normal, and all non-null pointers will be released when the buffer ** is destroyed. */ class MatBufferClass : public ShareBufferClass < VertexMaterialClass * > @@ -303,12 +303,12 @@ class UVBufferClass : public ShareBufferClass < Vector2 > inline Vector2 * MeshMatDescClass::Get_UV_Array(int pass,int stage) { if (UVSource[pass][stage] == -1) { - return NULL; + return nullptr; } - if (UV[UVSource[pass][stage]] != NULL) { + if (UV[UVSource[pass][stage]] != nullptr) { return UV[UVSource[pass][stage]]->Get_Array(); } - return NULL; + return nullptr; } inline void MeshMatDescClass::Set_UV_Source(int pass,int stage,int sourceindex) @@ -332,7 +332,7 @@ inline int MeshMatDescClass::Get_UV_Source(int pass,int stage) inline int MeshMatDescClass::Get_UV_Array_Count(void) { int count = 0; - while ((UV[count] != NULL) && (count < MAX_UV_ARRAYS)) { + while ((UV[count] != nullptr) && (count < MAX_UV_ARRAYS)) { count++; } return count; @@ -345,10 +345,10 @@ inline Vector2 * MeshMatDescClass::Get_UV_Array_By_Index(int index, bool create) if (create && !UV[index]) { UV[index] = NEW_REF(UVBufferClass,(VertexCount, "MeshMatDescClass::UV")); } - if (UV[index] != NULL) { + if (UV[index] != nullptr) { return UV[index]->Get_Array(); } - return NULL; + return nullptr; } inline unsigned* MeshMatDescClass::Get_DCG_Array(int pass) @@ -357,25 +357,25 @@ inline unsigned* MeshMatDescClass::Get_DCG_Array(int pass) WWASSERT(pass < MAX_PASSES); switch (DCGSource[pass]) { case VertexMaterialClass::MATERIAL: - return NULL; + return nullptr; break; case VertexMaterialClass::COLOR1: if (ColorArray[0]) { return ColorArray[0]->Get_Array(); } else { - return NULL; + return nullptr; } break; case VertexMaterialClass::COLOR2: if (ColorArray[1]) { return ColorArray[1]->Get_Array(); } else { - return NULL; + return nullptr; } break; default: WWASSERT(0); - return(NULL); + return(nullptr); break; }; } @@ -386,25 +386,25 @@ inline unsigned * MeshMatDescClass::Get_DIG_Array(int pass) WWASSERT(pass < MAX_PASSES); switch (DIGSource[pass]) { case VertexMaterialClass::MATERIAL: - return NULL; + return nullptr; break; case VertexMaterialClass::COLOR1: if (ColorArray[0]) { return ColorArray[0]->Get_Array(); } else { - return NULL; + return nullptr; } break; case VertexMaterialClass::COLOR2: if (ColorArray[1]) { return ColorArray[1]->Get_Array(); } else { - return NULL; + return nullptr; } break; default: WWASSERT(0); - return(NULL); + return(nullptr); break; }; } @@ -437,7 +437,7 @@ inline unsigned * MeshMatDescClass::Get_Color_Array(int index,bool create) if (ColorArray[index]) { return ColorArray[index]->Get_Array(); } - return NULL; + return nullptr; } inline VertexMaterialClass * MeshMatDescClass::Get_Single_Material(int pass) const @@ -465,17 +465,17 @@ inline ShaderClass MeshMatDescClass::Get_Single_Shader(int pass) const inline bool MeshMatDescClass::Has_Material_Array(int pass) const { - return (MaterialArray[pass] != NULL); + return (MaterialArray[pass] != nullptr); } inline bool MeshMatDescClass::Has_Shader_Array(int pass) const { - return (ShaderArray[pass] != NULL); + return (ShaderArray[pass] != nullptr); } inline bool MeshMatDescClass::Has_Texture_Array(int pass,int stage) const { - return (TextureArray[pass][stage] != NULL); + return (TextureArray[pass][stage] != nullptr); } inline void MeshMatDescClass::Disable_Backface_Culling(void) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp index 275c79e2343..13572eeede1 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp @@ -66,11 +66,11 @@ static DynamicVectorClass _TempClipFlagBuffer; MeshModelClass::MeshModelClass(void) : - DefMatDesc(NULL), - AlternateMatDesc(NULL), - CurMatDesc(NULL), - MatInfo(NULL), - GapFiller(NULL) + DefMatDesc(nullptr), + AlternateMatDesc(nullptr), + CurMatDesc(nullptr), + MatInfo(nullptr), + GapFiller(nullptr) { Set_Flag(DIRTY_BOUNDS,true); @@ -84,14 +84,14 @@ MeshModelClass::MeshModelClass(void) : MeshModelClass::MeshModelClass(const MeshModelClass & that) : MeshGeometryClass(that), - DefMatDesc(NULL), - AlternateMatDesc(NULL), - CurMatDesc(NULL), - MatInfo(NULL), - GapFiller(NULL) + DefMatDesc(nullptr), + AlternateMatDesc(nullptr), + CurMatDesc(nullptr), + MatInfo(nullptr), + GapFiller(nullptr) { DefMatDesc = W3DNEW MeshMatDescClass(*(that.DefMatDesc)); - if (that.AlternateMatDesc != NULL) { + if (that.AlternateMatDesc != nullptr) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); } CurMatDesc = DefMatDesc; @@ -124,16 +124,16 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) CurMatDesc = DefMatDesc; delete AlternateMatDesc; - AlternateMatDesc = NULL; + AlternateMatDesc = nullptr; - if (that.AlternateMatDesc != NULL) { + if (that.AlternateMatDesc != nullptr) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); } clone_materials(that); delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; if (that.GapFiller) GapFiller=W3DNEW GapFillerClass(*that.GapFiller); @@ -146,7 +146,7 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) //DMS - We must delete the gapfiller object BEFORE the geometry is reset. Otherwise, // the number of stages and passes gets reset and the gapfiller cannot deallocate properly. delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; Reset_Geometry(polycount,vertcount); @@ -158,7 +158,7 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) DefMatDesc->Reset(polycount,vertcount,passcount); delete AlternateMatDesc; - AlternateMatDesc = NULL; + AlternateMatDesc = nullptr; CurMatDesc = DefMatDesc; @@ -174,7 +174,7 @@ void MeshModelClass::Register_For_Rendering() } else { delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; } } else { @@ -183,7 +183,7 @@ void MeshModelClass::Register_For_Rendering() } else { delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; } } @@ -247,7 +247,7 @@ void MeshModelClass::Replace_VertexMaterial(VertexMaterialClass* vmat,VertexMate DX8FVFCategoryContainer* MeshModelClass::Peek_FVF_Category_Container() { - if (PolygonRendererList.Is_Empty()) return NULL; + if (PolygonRendererList.Is_Empty()) return nullptr; DX8PolygonRendererClass* polygon_renderer=PolygonRendererList.Get_Head(); WWASSERT(polygon_renderer); DX8TextureCategoryClass* texture_category=polygon_renderer->Get_Texture_Category(); @@ -259,7 +259,7 @@ DX8FVFCategoryContainer* MeshModelClass::Peek_FVF_Category_Container() void MeshModelClass::Shadow_Render(SpecialRenderInfoClass & rinfo,const Matrix3D & tm,const HTreeClass * htree) { - if (rinfo.BWRenderer != NULL) { + if (rinfo.BWRenderer != nullptr) { if (_TempTransformedVertexBuffer.Length() < VertexCount) _TempTransformedVertexBuffer.Resize(VertexCount); Vector4* transf_ptr=&(_TempTransformedVertexBuffer[0]); get_deformed_screenspace_vertices(transf_ptr,rinfo,tm,htree); @@ -444,7 +444,7 @@ void MeshModelClass::Make_Color_Array_Unique(int array_index) void MeshModelClass::Enable_Alternate_Material_Description(bool onoff) { - if ((onoff == true) && (AlternateMatDesc != NULL)) { + if ((onoff == true) && (AlternateMatDesc != nullptr)) { if (CurMatDesc != AlternateMatDesc) { CurMatDesc = AlternateMatDesc; @@ -577,7 +577,7 @@ HashTemplateClass SideHash; // // ---------------------------------------------------------------------------- -GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(NULL), PolygonCount(0) +GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(nullptr), PolygonCount(0) { REF_PTR_SET(mmc,mmc_); @@ -588,22 +588,22 @@ GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(NULL), PolygonCount(0 if (mmc->Has_Texture_Array(pass,stage)) { TextureArray[pass][stage]=W3DNEWARRAY TextureClass*[ArraySize]; } - else TextureArray[pass][stage]=NULL; + else TextureArray[pass][stage]=nullptr; } if (mmc->Has_Material_Array(pass)) { MaterialArray[pass]=W3DNEWARRAY VertexMaterialClass*[ArraySize]; } - else MaterialArray[pass]=NULL; + else MaterialArray[pass]=nullptr; if (mmc->Has_Shader_Array(pass)) { ShaderArray[pass]=W3DNEWARRAY ShaderClass[ArraySize]; } - else ShaderArray[pass]=NULL; + else ShaderArray[pass]=nullptr; } } -GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonCount(that.PolygonCount) +GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(nullptr), PolygonCount(that.PolygonCount) { REF_PTR_SET(mmc,that.mmc); @@ -618,7 +618,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC TextureArray[pass][stage][i]->Add_Ref(); } } - else TextureArray[pass][stage]=NULL; + else TextureArray[pass][stage]=nullptr; } if (that.MaterialArray[pass]) { @@ -628,7 +628,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC MaterialArray[pass][i]->Add_Ref(); } } - else MaterialArray[pass]=NULL; + else MaterialArray[pass]=nullptr; if (that.ShaderArray[pass]) { ShaderArray[pass]=W3DNEWARRAY ShaderClass[ArraySize]; @@ -636,7 +636,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC ShaderArray[pass][i]=that.ShaderArray[pass][i]; } } - else ShaderArray[pass]=NULL; + else ShaderArray[pass]=nullptr; } } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h index 2a48ea3b171..becd10c9be5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h @@ -242,7 +242,7 @@ class MeshModelClass : public MeshGeometryClass // Process texture reductions // void Process_Texture_Reduction(void); - // FVF category container will be NULL if the mesh hasn't been registered to the rendering system + // FVF category container will be null if the mesh hasn't been registered to the rendering system DX8FVFCategoryContainer* Peek_FVF_Category_Container(); // Determine whether any rendering feature used by this mesh requires vertex normals diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index c2bfcf76913..71f0fbc4d68 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -236,7 +236,7 @@ class MeshSaveContextClass *=============================================================================================*/ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) { - MeshLoadContextClass * context = NULL; + MeshLoadContextClass * context = nullptr; /* ** Open the first chunk, it should be the mesh header @@ -280,7 +280,7 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; context->AlternateMatDesc.Set_Vertex_Count(VertexCount); context->AlternateMatDesc.Set_Polygon_Count(PolyCount); @@ -398,7 +398,7 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) ** If this mesh is collideable and no AABTree was in the file, generate one now */ if ( (((W3dAttributes & W3D_MESH_FLAG_COLLISION_TYPE_MASK) >> W3D_MESH_FLAG_COLLISION_TYPE_SHIFT) != 0) && - (CullTree == NULL)) + (CullTree == nullptr)) { Generate_Culling_Tree(); } @@ -584,12 +584,12 @@ WW3DErrorType MeshModelClass::read_chunks(ChunkLoadClass & cload,MeshLoadContext WW3DErrorType MeshModelClass::read_texcoords(ChunkLoadClass & cload,MeshLoadContextClass * context) { W3dTexCoordStruct texcoord; - Vector2 * uvarray = 0; + Vector2 * uvarray = nullptr; int elementcount = cload.Cur_Chunk_Length() / sizeof (W3dTexCoordStruct); uvarray = context->Get_Temporary_UV_Array(elementcount); - if (uvarray != NULL) { + if (uvarray != nullptr) { /* ** Read the uv's into the first u-v pass array ** NOTE: this is an obsolete function. Texture coordinates are now @@ -643,9 +643,9 @@ WW3DErrorType MeshModelClass::read_v3_materials(ChunkLoadClass & cload,MeshLoadC ** W3D_MATERIAL3_SC_MAP - specular color map ** W3D_MATERIAL3_SI_MAP - specular illumination map */ - VertexMaterialClass * vmat = NULL; + VertexMaterialClass * vmat = nullptr; ShaderClass shader; - TextureClass * tex = NULL; + TextureClass * tex = nullptr; char name[256]; /* @@ -765,8 +765,8 @@ WW3DErrorType MeshModelClass::read_v3_materials(ChunkLoadClass & cload,MeshLoadC vmat->Release_Ref(); if (tex) tex->Release_Ref(); - vmat = NULL; - tex = NULL; + vmat = nullptr; + tex = nullptr; /* ** Close the W3D_CHUNK_MATERIAL3 @@ -885,10 +885,10 @@ WW3DErrorType MeshModelClass::read_vertex_colors(ChunkLoadClass & cload,MeshLoad ** ** A side effect is that if two DCG chunks are encountered, only the first is used... */ - if (CurMatDesc->Has_Color_Array(0) == NULL) { + if (CurMatDesc->Has_Color_Array(0) == false) { W3dRGBStruct color; unsigned * dcg = Get_Color_Array(0,true); - assert(dcg != NULL); + assert(dcg != nullptr); for (int i=0; iGet_Temporary_UV_Array(elementcount); - if (uvs != NULL) { + if (uvs != nullptr) { for (unsigned i = 0; i < elementcount; i++) { cload.Read (&texcoord, sizeof (texcoord)); uvs[i].X = texcoord.U; @@ -1553,7 +1553,7 @@ WW3DErrorType MeshModelClass::read_per_face_texcoord_ids (ChunkLoadClass &cload, // Vector3i *uvindices; // // uvindices = matdesc->Get_UVIndex_Array (context->CurPass, true); -// WWASSERT (uvindices != NULL); +// WWASSERT (uvindices != nullptr); //uvindices=W3DNEWARRAY Vector3i[Get_Polygon_Count()]; // cload.Read (uvindices, size); @@ -1653,7 +1653,7 @@ void MeshModelClass::post_process() if (Get_Flag(MeshGeometryClass::TWO_SIDED)) { DefMatDesc->Disable_Backface_Culling(); - if (AlternateMatDesc != NULL) { + if (AlternateMatDesc != nullptr) { AlternateMatDesc->Disable_Backface_Culling(); } @@ -1833,7 +1833,7 @@ void MeshModelClass::install_materials(MeshLoadContextClass * context) ** Finish configuring the vertex materials and color arrays. */ DefMatDesc->Post_Load_Process (true); - if (AlternateMatDesc != NULL) { + if (AlternateMatDesc != nullptr) { AlternateMatDesc->Post_Load_Process (true); } @@ -1872,7 +1872,7 @@ void MeshModelClass::clone_materials(const MeshModelClass & srcmesh) void MeshModelClass::install_alternate_material_desc(MeshLoadContextClass * context) { if (context->AlternateMatDesc.Is_Empty() == false) { - WWASSERT(AlternateMatDesc == NULL); + WWASSERT(AlternateMatDesc == nullptr); AlternateMatDesc = W3DNEW MeshMatDescClass; AlternateMatDesc->Init_Alternate(*DefMatDesc,context->AlternateMatDesc); } @@ -1897,7 +1897,7 @@ MeshLoadContextClass::MeshLoadContextClass(void) PrelitChunkID = 0xffffffff; CurPass = 0; CurTexStage = 0; - TexCoords = NULL; + TexCoords = nullptr; LoadedDIG = false; } @@ -1919,7 +1919,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) int i; delete TexCoords; - TexCoords = NULL; + TexCoords = nullptr; for (i=0; iRelease_Ref(); @@ -1949,7 +1949,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) *=============================================================================================*/ W3dTexCoordStruct * MeshLoadContextClass::Get_Texcoord_Array(void) { - if (TexCoords == NULL) { + if (TexCoords == nullptr) { TexCoords = W3DNEWARRAY W3dTexCoordStruct[Header.NumVertices]; } return TexCoords; @@ -1990,7 +1990,7 @@ int MeshLoadContextClass::Add_Shader(ShaderClass shader) *=============================================================================================*/ int MeshLoadContextClass::Add_Vertex_Material(VertexMaterialClass * vmat) { - WWASSERT(vmat != NULL); + WWASSERT(vmat != nullptr); vmat->Add_Ref(); int index = VertexMaterials.Count(); VertexMaterials.Add(vmat); @@ -2012,7 +2012,7 @@ int MeshLoadContextClass::Add_Vertex_Material(VertexMaterialClass * vmat) *=============================================================================================*/ int MeshLoadContextClass::Add_Texture(TextureClass * tex) { - WWASSERT(tex != NULL); + WWASSERT(tex != nullptr); tex->Add_Ref(); int index = Textures.Count(); Textures.Add(tex); @@ -2052,7 +2052,7 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial } // add the vertex material if it is unique - if (vmat == NULL) { + if (vmat == nullptr) { mat->VertexMaterialIdx = -1; } else { unsigned long crc = vmat->Get_CRC(); @@ -2070,7 +2070,7 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial } // add the texture if it is unique - if (tex == NULL) { + if (tex == nullptr) { mat->TextureIdx = -1; } else { int ti=0; @@ -2133,7 +2133,7 @@ VertexMaterialClass * MeshLoadContextClass::Peek_Legacy_Vertex_Material(int lega if (vi != -1) { return Peek_Vertex_Material(vi); } else { - return NULL; + return nullptr; } } @@ -2158,7 +2158,7 @@ TextureClass * MeshLoadContextClass::Peek_Legacy_Texture(int legacy_material_ind if (ti != -1) { return Peek_Texture(ti); } else { - return NULL; + return nullptr; } } @@ -2275,7 +2275,7 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex char * mesh_name = strchr(name,'.'); int hierarchy_name_len = 0; - if (mesh_name == NULL) { + if (mesh_name == nullptr) { mesh_name = name; } else { hierarchy_name_len = (int)mesh_name - (int)name; @@ -2318,7 +2318,7 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex WW3DErrorType MeshModelClass::write_user_text(ChunkSaveClass & csave,MeshSaveContextClass * /*context*/) { - if (UserText == NULL) return WW3D_ERROR_OK; + if (UserText == nullptr) return WW3D_ERROR_OK; if (strlen(UserText->Get_Array()) < 1) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_MESH_USER_TEXT); @@ -2335,7 +2335,7 @@ WW3DErrorType MeshModelClass::write_triangles(ChunkSaveClass & csave,MeshSaveCon } TriIndex * poly_verts = Poly->Get_Array(); - Vector4 * poly_eq = (PlaneEq ? PlaneEq->Get_Array() : NULL); + Vector4 * poly_eq = (PlaneEq ? PlaneEq->Get_Array() : nullptr); for (int i=0; i 0); - if (VertexShadeIdx == NULL) return WW3D_ERROR_OK; + if (VertexShadeIdx == nullptr) return WW3D_ERROR_OK; if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_SHADE_INDICES)) { return WW3D_ERROR_SAVE_FAILED; @@ -2463,7 +2463,7 @@ WW3DErrorType MeshModelClass::write_vertex_shade_indices(ChunkSaveClass & csave, WW3DErrorType MeshModelClass::write_vertex_influences(ChunkSaveClass & csave,MeshSaveContextClass * /*context*/) { WWASSERT(Get_Vertex_Count() > 0); - if (VertexBoneLink == NULL) return WW3D_ERROR_OK; + if (VertexBoneLink == nullptr) return WW3D_ERROR_OK; if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_INFLUENCES)) { return WW3D_ERROR_SAVE_FAILED; @@ -2585,13 +2585,13 @@ WW3DErrorType MeshModelClass::write_material_pass(ChunkSaveClass & csave,MeshSav WW3DErrorType MeshModelClass::write_vertex_material_ids(ChunkSaveClass & csave,MeshSaveContextClass * context) { // first check if all vertex material pointers are Null (is this legal?) - if ( (DefMatDesc->Material[context->CurPass] == NULL) && - (DefMatDesc->MaterialArray[context->CurPass] == NULL)) return WW3D_ERROR_OK; + if ( (DefMatDesc->Material[context->CurPass] == nullptr) && + (DefMatDesc->MaterialArray[context->CurPass] == nullptr)) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_VERTEX_MATERIAL_IDS); uint32 id = 0; - if (DefMatDesc->MaterialArray[context->CurPass] == NULL) { + if (DefMatDesc->MaterialArray[context->CurPass] == nullptr) { id = context->Materials.Find_Vertex_Material(DefMatDesc->Material[context->CurPass]); csave.Write(&id,sizeof(id)); @@ -2615,7 +2615,7 @@ WW3DErrorType MeshModelClass::write_shader_ids(ChunkSaveClass & csave,MeshSaveCo csave.Begin_Chunk(W3D_CHUNK_SHADER_IDS); uint32 id = 0; - if (DefMatDesc->ShaderArray[context->CurPass] == NULL) { + if (DefMatDesc->ShaderArray[context->CurPass] == nullptr) { id = context->Materials.Find_Shader(DefMatDesc->Shader[context->CurPass]); csave.Write(&id,sizeof(id)); @@ -2635,7 +2635,7 @@ WW3DErrorType MeshModelClass::write_shader_ids(ChunkSaveClass & csave,MeshSaveCo WW3DErrorType MeshModelClass::write_scg(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->SCG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->SCG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_SCG); W3dRGBAStruct color; @@ -2651,7 +2651,7 @@ WW3DErrorType MeshModelClass::write_scg(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_dig(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->DIG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->DIG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_DIG); W3dRGBStruct color; @@ -2666,7 +2666,7 @@ WW3DErrorType MeshModelClass::write_dig(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_dcg(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->DCG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->DCG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_DCG); W3dRGBAStruct color; @@ -2681,8 +2681,8 @@ WW3DErrorType MeshModelClass::write_dcg(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_texture_stage(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if ( (DefMatDesc->Texture[context->CurPass][context->CurStage] == NULL) && - (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == NULL)) return WW3D_ERROR_OK; + if ( (DefMatDesc->Texture[context->CurPass][context->CurStage] == nullptr) && + (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == nullptr)) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_TEXTURE_STAGE); write_texture_ids(csave,context); @@ -2698,7 +2698,7 @@ WW3DErrorType MeshModelClass::write_texture_ids(ChunkSaveClass & csave,MeshSaveC csave.Begin_Chunk(W3D_CHUNK_TEXTURE_IDS); uint32 id = 0; - if (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == NULL) { + if (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == nullptr) { id = context->Materials.Find_Texture(DefMatDesc->Texture[context->CurPass][context->CurStage]); csave.Write(&id,sizeof(id)); @@ -2718,7 +2718,7 @@ WW3DErrorType MeshModelClass::write_texture_ids(ChunkSaveClass & csave,MeshSaveC WW3DErrorType MeshModelClass::write_stage_texcoords(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->UV[context->CurPass][context->CurStage] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->UV[context->CurPass][context->CurStage] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_STAGE_TEXCOORDS); W3dTexCoordStruct tex; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp index ec512b35208..32732112920 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp @@ -94,7 +94,7 @@ MotionChannelClass::MotionChannelClass(void) : PivotIdx(0), Type(0), VectorLen(0), - Data(NULL), + Data(nullptr), FirstFrame(-1), LastFrame(-1) { @@ -132,7 +132,7 @@ MotionChannelClass::~MotionChannelClass(void) void MotionChannelClass::Free(void) { delete[] Data; - Data = NULL; + Data = nullptr; } @@ -194,7 +194,7 @@ BitChannelClass::BitChannelClass(void) : DefaultVal(0), FirstFrame(-1), LastFrame(-1), - Bits(NULL) + Bits(nullptr) { } @@ -232,7 +232,7 @@ BitChannelClass::~BitChannelClass(void) void BitChannelClass::Free(void) { delete[] Bits; - Bits = NULL; + Bits = nullptr; } @@ -304,7 +304,7 @@ TimeCodedMotionChannelClass::TimeCodedMotionChannelClass(void) : Type(0), VectorLen(0), PacketSize(0), - Data(NULL), + Data(nullptr), NumTimeCodes(0), LastTimeCodeIdx(0), // absolute index to last time code CachedIdx(0) // Last Index Used @@ -343,7 +343,7 @@ TimeCodedMotionChannelClass::~TimeCodedMotionChannelClass(void) void TimeCodedMotionChannelClass::Free(void) { delete[] Data; - Data = NULL; + Data = nullptr; } @@ -670,7 +670,7 @@ TimeCodedBitChannelClass::TimeCodedBitChannelClass(void) : PivotIdx(0), Type(0), DefaultVal(0), - Bits(NULL), + Bits(nullptr), CachedIdx(0) { } @@ -709,7 +709,7 @@ TimeCodedBitChannelClass::~TimeCodedBitChannelClass(void) void TimeCodedBitChannelClass::Free(void) { delete[] Bits; - Bits = NULL; + Bits = nullptr; } @@ -830,9 +830,9 @@ AdaptiveDeltaMotionChannelClass::AdaptiveDeltaMotionChannelClass(void) : PivotIdx(0), Type(0), VectorLen(0), - Data(NULL), + Data(nullptr), NumFrames(0), - CacheData(NULL), + CacheData(nullptr), Scale(0.0f) { @@ -887,10 +887,10 @@ AdaptiveDeltaMotionChannelClass::~AdaptiveDeltaMotionChannelClass(void) void AdaptiveDeltaMotionChannelClass::Free(void) { delete[] Data; - Data = NULL; + Data = nullptr; delete CacheData; - CacheData = NULL; + CacheData = nullptr; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index feeb891f575..0f8585efd8e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -33,6 +33,7 @@ *-------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + #include "part_buf.h" #include "part_emt.h" #include "ww3d.h" @@ -97,7 +98,7 @@ ParticleBufferClass::ParticleBufferClass int frame_mode, const W3dEmitterLinePropertiesStruct * line_props ) : - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -116,36 +117,36 @@ ParticleBufferClass::ParticleBufferClass BoundingBox(Vector3(0,0,0),Vector3(0,0,0)), BoundingBoxDirty(true), NumColorKeyFrames(0), - ColorKeyFrameTimes(NULL), - ColorKeyFrameValues(NULL), - ColorKeyFrameDeltas(NULL), + ColorKeyFrameTimes(nullptr), + ColorKeyFrameValues(nullptr), + ColorKeyFrameDeltas(nullptr), NumAlphaKeyFrames(0), - AlphaKeyFrameTimes(NULL), - AlphaKeyFrameValues(NULL), - AlphaKeyFrameDeltas(NULL), + AlphaKeyFrameTimes(nullptr), + AlphaKeyFrameValues(nullptr), + AlphaKeyFrameDeltas(nullptr), NumSizeKeyFrames(0), - SizeKeyFrameTimes(NULL), - SizeKeyFrameValues(NULL), - SizeKeyFrameDeltas(NULL), + SizeKeyFrameTimes(nullptr), + SizeKeyFrameValues(nullptr), + SizeKeyFrameDeltas(nullptr), NumRotationKeyFrames(0), - RotationKeyFrameTimes(NULL), - RotationKeyFrameValues(NULL), - HalfRotationKeyFrameDeltas(NULL), - OrientationKeyFrameValues(NULL), + RotationKeyFrameTimes(nullptr), + RotationKeyFrameValues(nullptr), + HalfRotationKeyFrameDeltas(nullptr), + OrientationKeyFrameValues(nullptr), NumFrameKeyFrames(0), - FrameKeyFrameTimes(NULL), - FrameKeyFrameValues(NULL), - FrameKeyFrameDeltas(NULL), + FrameKeyFrameTimes(nullptr), + FrameKeyFrameValues(nullptr), + FrameKeyFrameDeltas(nullptr), NumBlurTimeKeyFrames(0), - BlurTimeKeyFrameTimes(NULL), - BlurTimeKeyFrameValues(NULL), - BlurTimeKeyFrameDeltas(NULL), + BlurTimeKeyFrameTimes(nullptr), + BlurTimeKeyFrameValues(nullptr), + BlurTimeKeyFrameDeltas(nullptr), NumRandomColorEntriesMinus1(0), - RandomColorEntries(NULL), + RandomColorEntries(nullptr), NumRandomAlphaEntriesMinus1(0), - RandomAlphaEntries(NULL), + RandomAlphaEntries(nullptr), NumRandomSizeEntriesMinus1(0), - RandomSizeEntries(NULL), + RandomSizeEntries(nullptr), ColorRandom(0, 0, 0), OpacityRandom(0), SizeRandom(0), @@ -153,26 +154,26 @@ ParticleBufferClass::ParticleBufferClass FrameRandom(0), InitialOrientationRandom(0), NumRandomRotationEntriesMinus1(0), - RandomRotationEntries(NULL), + RandomRotationEntries(nullptr), NumRandomOrientationEntriesMinus1(0), - RandomOrientationEntries(NULL), + RandomOrientationEntries(nullptr), NumRandomFrameEntriesMinus1(0), - RandomFrameEntries(NULL), + RandomFrameEntries(nullptr), NumRandomBlurTimeEntriesMinus1(0), - RandomBlurTimeEntries(NULL), - PointGroup(NULL), - LineRenderer(NULL), - Diffuse(NULL), - Color(NULL), - Alpha(NULL), - Size(NULL), - Orientation(NULL), - Frame(NULL), - TailPosition(NULL), - APT(NULL), + RandomBlurTimeEntries(nullptr), + PointGroup(nullptr), + LineRenderer(nullptr), + Diffuse(nullptr), + Color(nullptr), + Alpha(nullptr), + Size(nullptr), + Orientation(nullptr), + Frame(nullptr), + TailPosition(nullptr), + APT(nullptr), PingPongPosition(pingpong), - Velocity(NULL), - TimeStamp(NULL), + Velocity(nullptr), + TimeStamp(nullptr), Emitter(emitter), DecimationThreshold(0U), ProjectedArea(0.0f) @@ -180,8 +181,8 @@ ParticleBufferClass::ParticleBufferClass LodCount = 17; LodBias = 1.0f; - Position[0] = NULL; - Position[1] = NULL; + Position[0] = nullptr; + Position[1] = nullptr; // Create color array, keyframes and randomizer table (if needed) Reset_Colors(color); @@ -251,7 +252,7 @@ ParticleBufferClass::ParticleBufferClass // If the render mode is W3D_EMITTER_RENDER_MODE_LINE and we are supplied with // a line properties structure, set up a line renderer if (RenderMode == W3D_EMITTER_RENDER_MODE_LINE) { - if (line_props != NULL) { + if (line_props != nullptr) { LineRenderer = W3DNEW SegLineRendererClass; LineRenderer->Init(*line_props); LineRenderer->Set_Texture(tex); @@ -267,7 +268,7 @@ ParticleBufferClass::ParticleBufferClass ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : RenderObjClass(src), - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -286,33 +287,33 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : BoundingBox(Vector3(0,0,0),Vector3(0,0,0)), BoundingBoxDirty(true), NumColorKeyFrames(src.NumColorKeyFrames), - ColorKeyFrameTimes(NULL), - ColorKeyFrameValues(NULL), - ColorKeyFrameDeltas(NULL), + ColorKeyFrameTimes(nullptr), + ColorKeyFrameValues(nullptr), + ColorKeyFrameDeltas(nullptr), NumAlphaKeyFrames(src.NumAlphaKeyFrames), - AlphaKeyFrameTimes(NULL), - AlphaKeyFrameValues(NULL), - AlphaKeyFrameDeltas(NULL), + AlphaKeyFrameTimes(nullptr), + AlphaKeyFrameValues(nullptr), + AlphaKeyFrameDeltas(nullptr), NumSizeKeyFrames(src.NumSizeKeyFrames), - SizeKeyFrameTimes(NULL), - SizeKeyFrameValues(NULL), - SizeKeyFrameDeltas(NULL), + SizeKeyFrameTimes(nullptr), + SizeKeyFrameValues(nullptr), + SizeKeyFrameDeltas(nullptr), NumRotationKeyFrames(src.NumRotationKeyFrames), - RotationKeyFrameTimes(NULL), - RotationKeyFrameValues(NULL), - HalfRotationKeyFrameDeltas(NULL), - OrientationKeyFrameValues(NULL), + RotationKeyFrameTimes(nullptr), + RotationKeyFrameValues(nullptr), + HalfRotationKeyFrameDeltas(nullptr), + OrientationKeyFrameValues(nullptr), NumFrameKeyFrames(src.NumFrameKeyFrames), - FrameKeyFrameTimes(NULL), - FrameKeyFrameValues(NULL), - FrameKeyFrameDeltas(NULL), + FrameKeyFrameTimes(nullptr), + FrameKeyFrameValues(nullptr), + FrameKeyFrameDeltas(nullptr), NumBlurTimeKeyFrames(src.NumBlurTimeKeyFrames), - BlurTimeKeyFrameTimes(NULL), - BlurTimeKeyFrameValues(NULL), - BlurTimeKeyFrameDeltas(NULL), - RandomColorEntries(NULL), - RandomAlphaEntries(NULL), - RandomSizeEntries(NULL), + BlurTimeKeyFrameTimes(nullptr), + BlurTimeKeyFrameValues(nullptr), + BlurTimeKeyFrameDeltas(nullptr), + RandomColorEntries(nullptr), + RandomAlphaEntries(nullptr), + RandomSizeEntries(nullptr), ColorRandom(src.ColorRandom), OpacityRandom(src.OpacityRandom), SizeRandom(src.SizeRandom), @@ -320,32 +321,32 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : FrameRandom(src.FrameRandom), InitialOrientationRandom(src.InitialOrientationRandom), NumRandomRotationEntriesMinus1(0), - RandomRotationEntries(NULL), + RandomRotationEntries(nullptr), NumRandomOrientationEntriesMinus1(0), - RandomOrientationEntries(NULL), + RandomOrientationEntries(nullptr), NumRandomFrameEntriesMinus1(0), - RandomFrameEntries(NULL), + RandomFrameEntries(nullptr), NumRandomBlurTimeEntriesMinus1(0), - RandomBlurTimeEntries(NULL), - PointGroup(NULL), - LineRenderer(NULL), - Diffuse(NULL), - Color(NULL), - Alpha(NULL), - Size(NULL), - Orientation(NULL), - Frame(NULL), - TailPosition(NULL), - APT(NULL), + RandomBlurTimeEntries(nullptr), + PointGroup(nullptr), + LineRenderer(nullptr), + Diffuse(nullptr), + Color(nullptr), + Alpha(nullptr), + Size(nullptr), + Orientation(nullptr), + Frame(nullptr), + TailPosition(nullptr), + APT(nullptr), PingPongPosition(src.PingPongPosition), - Velocity(NULL), - TimeStamp(NULL), + Velocity(nullptr), + TimeStamp(nullptr), Emitter(src.Emitter), DecimationThreshold(src.DecimationThreshold), ProjectedArea(0.0f) { - Position[0] = NULL; - Position[1] = NULL; + Position[0] = nullptr; + Position[1] = nullptr; unsigned int i; @@ -473,7 +474,7 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : } } else { - // Unlike other properties, if there is no Orientation array then all the arrays are NULL + // Unlike other properties, if there is no Orientation array then all the arrays are nullptr // (including the Values array) - there is an implicit starting value of 0. } @@ -654,7 +655,7 @@ ParticleBufferClass::~ParticleBufferClass(void) // harmful (if emitter and buffer each have refcounted pointers to the // other neither would ever get deleted). // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } delete LineRenderer; @@ -721,7 +722,7 @@ void ParticleBufferClass::Render_Particles(RenderInfoClass & rinfo) { // If the number of active points is less than the maximum or we need to decimate particles // (for LOD purposes), build the active point table: - ShareBufferClass *apt = NULL; + ShareBufferClass *apt = nullptr; unsigned int active_point_count = 0; if (NonNewNum < (int)MaxNum || DecimationThreshold > 0) { @@ -826,7 +827,7 @@ void ParticleBufferClass::Render_Particles(RenderInfoClass & rinfo) } else if (Diffuse) { Diffuse->Release_Ref(); - Diffuse=NULL; + Diffuse=nullptr; } PointGroup->Set_Arrays(Position[pingpong], Diffuse, apt, Size, Orientation, Frame, active_point_count); @@ -1134,14 +1135,14 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop // ColorKeyFrameValues if the right size, otherwise release and reallocate. if (Color) { Color->Release_Ref(); - Color = NULL; + Color = nullptr; } delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; + ColorKeyFrameTimes = nullptr; delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; + ColorKeyFrameDeltas = nullptr; if (ColorKeyFrameValues) { if (NumColorKeyFrames > 1) { @@ -1282,14 +1283,14 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props // AlphaKeyFrameValues if the right size, otherwise release and reallocate. if (Alpha) { Alpha->Release_Ref(); - Alpha = NULL; + Alpha = nullptr; } delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; + AlphaKeyFrameTimes = nullptr; delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; + AlphaKeyFrameDeltas = nullptr; if (AlphaKeyFrameValues) { if (NumAlphaKeyFrames > 1) { @@ -1427,14 +1428,14 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) // SizeKeyFrameValues if the right size, otherwise release and reallocate. if (Size) { Size->Release_Ref(); - Size = NULL; + Size = nullptr; } delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; + SizeKeyFrameTimes = nullptr; delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; + SizeKeyFrameDeltas = nullptr; if (SizeKeyFrameValues) { if (NumSizeKeyFrames > 1) { @@ -1579,7 +1580,7 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro RotationRandom = new_props.Rand * 0.001f; InitialOrientationRandom = orient_rnd; - // If both randomizers are effectively zero and rotation is constant zero, then all arrays are NULL. + // If both randomizers are effectively zero and rotation is constant zero, then all arrays are nullptr. static const float eps_orientation = 2.77777778e-4f; // Epsilon is equivalent to 0.1 degree static const float eps_rotation = 2.77777778e-4f; // Epsilon is equivalent to one rotation per hour (in rotations / second) bool orientation_rand_zero = fabs(orient_rnd) < eps_orientation; @@ -1590,16 +1591,16 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro REF_PTR_RELEASE(Orientation); delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; + RotationKeyFrameTimes = nullptr; delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; + HalfRotationKeyFrameDeltas = nullptr; delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; + RotationKeyFrameValues = nullptr; delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; + OrientationKeyFrameValues = nullptr; NumRotationKeyFrames = 0; NumRandomRotationEntriesMinus1 = 0; @@ -1780,11 +1781,11 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) REF_PTR_RELEASE(Frame); if (FrameKeyFrameTimes) { delete [] FrameKeyFrameTimes; - FrameKeyFrameTimes = NULL; + FrameKeyFrameTimes = nullptr; } if (FrameKeyFrameDeltas) { delete [] FrameKeyFrameDeltas; - FrameKeyFrameDeltas = NULL; + FrameKeyFrameDeltas = nullptr; } if (FrameKeyFrameValues) { if (NumFrameKeyFrames > 1) { @@ -1922,10 +1923,10 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // otherwise release and reallocate. delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; + BlurTimeKeyFrameTimes = nullptr; delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; + BlurTimeKeyFrameDeltas = nullptr; if (BlurTimeKeyFrameValues) { if (NumBlurTimeKeyFrames > 1) { @@ -2045,7 +2046,7 @@ void ParticleBufferClass::Emitter_Is_Dead(void) IsEmitterDead = true; // We do not have a ref for the emitter (see DTor for detailed explanation) // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } @@ -2057,7 +2058,7 @@ void ParticleBufferClass::Set_Emitter(ParticleEmitterClass *emitter) if (Emitter) { // We do not have a ref for the emitter (see DTor for detailed explanation) // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } Emitter = emitter; @@ -2166,14 +2167,14 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) unsigned int bkey = NumBlurTimeKeyFrames -1; unsigned int part; - Vector3 *color = Color ? Color->Get_Array(): NULL; - float *alpha = Alpha ? Alpha->Get_Array(): NULL; - float *size = Size ? Size->Get_Array(): NULL; - uint8 *orientation = Orientation ? Orientation->Get_Array(): NULL; - uint8 *frame = Frame ? Frame->Get_Array(): NULL; - Vector3 *tailposition = TailPosition ? TailPosition->Get_Array() : NULL; + Vector3 *color = Color ? Color->Get_Array(): nullptr; + float *alpha = Alpha ? Alpha->Get_Array(): nullptr; + float *size = Size ? Size->Get_Array(): nullptr; + uint8 *orientation = Orientation ? Orientation->Get_Array(): nullptr; + uint8 *frame = Frame ? Frame->Get_Array(): nullptr; + Vector3 *tailposition = TailPosition ? TailPosition->Get_Array() : nullptr; - Vector3 *position=NULL; + Vector3 *position=nullptr; if (PingPongPosition) { int pingpong = WW3D::Get_Frame_Count() & 0x1; @@ -2436,7 +2437,7 @@ void ParticleBufferClass::Get_New_Particles(void) prev_pos = Position[pingpong ^ 0x1]->Get_Array(); } else { position = Position[0]->Get_Array(); - prev_pos = NULL; + prev_pos = nullptr; } for (; NewParticleQueueCount;) { @@ -2616,7 +2617,7 @@ void ParticleBufferClass::Get_Color_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((ColorKeyFrameDeltas != NULL) && + if ((ColorKeyFrameDeltas != nullptr) && ((ColorKeyFrameDeltas[NumColorKeyFrames - 1].X != 0) || (ColorKeyFrameDeltas[NumColorKeyFrames - 1].Y != 0) || (ColorKeyFrameDeltas[NumColorKeyFrames - 1].Z != 0))) { @@ -2627,8 +2628,8 @@ void ParticleBufferClass::Get_Color_Key_Frames (ParticlePropertyStruct colors.Start = ColorKeyFrameValues[0]; colors.Rand = ColorRandom; colors.NumKeyFrames = real_keyframe_count; - colors.KeyTimes = NULL; - colors.Values = NULL; + colors.KeyTimes = nullptr; + colors.Values = nullptr; // // If we have more than just the start color, build @@ -2674,7 +2675,7 @@ void ParticleBufferClass::Get_Opacity_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((AlphaKeyFrameDeltas != NULL) && + if ((AlphaKeyFrameDeltas != nullptr) && (AlphaKeyFrameDeltas[NumAlphaKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -2683,8 +2684,8 @@ void ParticleBufferClass::Get_Opacity_Key_Frames (ParticlePropertyStruct opacities.Start = AlphaKeyFrameValues[0]; opacities.Rand = OpacityRandom; opacities.NumKeyFrames = real_keyframe_count; - opacities.KeyTimes = NULL; - opacities.Values = NULL; + opacities.KeyTimes = nullptr; + opacities.Values = nullptr; // // If we have more than just the start opacity, build @@ -2731,7 +2732,7 @@ void ParticleBufferClass::Get_Size_Key_Frames (ParticlePropertyStruct &si // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((SizeKeyFrameDeltas != NULL) && + if ((SizeKeyFrameDeltas != nullptr) && (SizeKeyFrameDeltas[NumSizeKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -2740,8 +2741,8 @@ void ParticleBufferClass::Get_Size_Key_Frames (ParticlePropertyStruct &si sizes.Start = SizeKeyFrameValues[0]; sizes.Rand = SizeRandom; sizes.NumKeyFrames = real_keyframe_count; - sizes.KeyTimes = NULL; - sizes.Values = NULL; + sizes.KeyTimes = nullptr; + sizes.Values = nullptr; // // If we have more than just the start opacity, build @@ -2792,7 +2793,7 @@ void ParticleBufferClass::Get_Rotation_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((HalfRotationKeyFrameDeltas != NULL) && + if ((HalfRotationKeyFrameDeltas != nullptr) && (HalfRotationKeyFrameDeltas[NumRotationKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -2802,8 +2803,8 @@ void ParticleBufferClass::Get_Rotation_Key_Frames (ParticlePropertyStruct rotations.Start = RotationKeyFrameValues ? RotationKeyFrameValues[0] * 1000.0f : 0; rotations.Rand = RotationRandom * 1000.0f; rotations.NumKeyFrames = real_keyframe_count; - rotations.KeyTimes = NULL; - rotations.Values = NULL; + rotations.KeyTimes = nullptr; + rotations.Values = nullptr; // // If we have more than just the start rotation, build @@ -2850,7 +2851,7 @@ void ParticleBufferClass::Get_Frame_Key_Frames (ParticlePropertyStruct &f // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((FrameKeyFrameDeltas != NULL) && + if ((FrameKeyFrameDeltas != nullptr) && (FrameKeyFrameDeltas[NumFrameKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -2859,8 +2860,8 @@ void ParticleBufferClass::Get_Frame_Key_Frames (ParticlePropertyStruct &f frames.Start = FrameKeyFrameValues[0]; frames.Rand = FrameRandom; frames.NumKeyFrames = real_keyframe_count; - frames.KeyTimes = NULL; - frames.Values = NULL; + frames.KeyTimes = nullptr; + frames.Values = nullptr; // // If we have more than just the start rotation, build @@ -2906,7 +2907,7 @@ void ParticleBufferClass::Get_Blur_Time_Key_Frames (ParticlePropertyStructGet_Texture_Mapping_Mode(); } return SegLineRendererClass::UNIFORM_WIDTH_TEXTURE_MAP; @@ -2982,7 +2983,7 @@ int ParticleBufferClass::Get_Line_Texture_Mapping_Mode(void) const int ParticleBufferClass::Is_Merge_Intersections(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Merge_Intersections(); } return false; @@ -2990,7 +2991,7 @@ int ParticleBufferClass::Is_Merge_Intersections(void) const int ParticleBufferClass::Is_Freeze_Random(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Freeze_Random(); } return false; @@ -2998,7 +2999,7 @@ int ParticleBufferClass::Is_Freeze_Random(void) const int ParticleBufferClass::Is_Sorting_Disabled(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Sorting_Disabled(); } return false; @@ -3006,7 +3007,7 @@ int ParticleBufferClass::Is_Sorting_Disabled(void) const int ParticleBufferClass::Are_End_Caps_Enabled(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Are_End_Caps_Enabled(); } return false; @@ -3014,7 +3015,7 @@ int ParticleBufferClass::Are_End_Caps_Enabled(void) const int ParticleBufferClass::Get_Subdivision_Level(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Current_Subdivision_Level(); } return 0; @@ -3022,7 +3023,7 @@ int ParticleBufferClass::Get_Subdivision_Level(void) const float ParticleBufferClass::Get_Noise_Amplitude(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Noise_Amplitude(); } return 0.0f; @@ -3030,7 +3031,7 @@ float ParticleBufferClass::Get_Noise_Amplitude(void) const float ParticleBufferClass::Get_Merge_Abort_Factor(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Merge_Abort_Factor(); } return 0.0f; @@ -3038,7 +3039,7 @@ float ParticleBufferClass::Get_Merge_Abort_Factor(void) const float ParticleBufferClass::Get_Texture_Tile_Factor(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Texture_Tile_Factor(); } return 1.0f; @@ -3046,7 +3047,7 @@ float ParticleBufferClass::Get_Texture_Tile_Factor(void) const Vector2 ParticleBufferClass::Get_UV_Offset_Rate(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_UV_Offset_Rate(); } return Vector2(0.0f,0.0f); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h index a70cf24f658..7f126753486 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h @@ -299,13 +299,13 @@ class ParticleBufferClass : public RenderObjClass // At least one keyframe must exist for each property (time 0). // If a randomizer is zero and there are no additional keyframes for // that property (or the keyframes are all equal), all the arrays for - // that property are NULL (since they will never be used), except for + // that property are nullptr (since they will never be used), except for // the Values array which will have one entry (the constant value). // Note that the rotation and orientation properties are different - // only orientation is used in rendering. The rotation data is only // used to compute the orientations. So the condition is different - // if rotation and orientation randomizers, and all rotation keyframes - // are all zero, then all of the arrays will be NULL (including the + // are all zero, then all of the arrays will be null (including the // Values array). unsigned int NumColorKeyFrames; unsigned int * ColorKeyFrameTimes; // 0th entry is always 0 @@ -340,7 +340,7 @@ class ParticleBufferClass : public RenderObjClass // randomizer is zero, the table will have one entry (containing zero), // which is why each property has its own NumXXXRandomEntries variable. // If a randomizer is zero and the property has no keyframes, the table - // will be NULL since it will never be used (property is constant)). + // will be null since it will never be used (property is constant)). unsigned int NumRandomColorEntriesMinus1; // 2^n - 1 so can be used as a mask also Vector3 * RandomColorEntries; unsigned int NumRandomAlphaEntriesMinus1; // 2^n - 1 so can be used as a mask also diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 37a1731b0e9..42289c9437f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -92,8 +92,8 @@ ParticleEmitterClass::ParticleEmitterClass(float emit_rate, unsigned int burst_s MaxParticles(max_particles), IsComplete(false), RemoveOnComplete(DefaultRemoveOnComplete), - NameString(NULL), - UserString(NULL), + NameString(nullptr), + UserString(nullptr), IsInScene(false) { EmitRate = emit_rate > 0.0f ? (unsigned int)(1000.0f / emit_rate) : 1000U; @@ -131,13 +131,13 @@ ParticleEmitterClass::ParticleEmitterClass(const ParticleEmitterClass & src) : if (src.PosRand) { PosRand = src.PosRand->Clone(); } else { - PosRand = NULL; + PosRand = nullptr; } BaseVel = src.BaseVel; if (src.VelRand) { VelRand = src.VelRand->Clone(); } else { - VelRand = NULL; + VelRand = nullptr; } OutwardVel = src.OutwardVel; VelInheritFactor = src.VelInheritFactor; @@ -178,14 +178,14 @@ ParticleEmitterClass::~ParticleEmitterClass(void) Buffer->Release_Ref(); delete PosRand; - PosRand = NULL; + PosRand = nullptr; delete VelRand; - VelRand = NULL; + VelRand = nullptr; - if (NameString != NULL) { + if (NameString != nullptr) { ::free (NameString); - NameString = NULL; + NameString = nullptr; } return ; @@ -196,11 +196,11 @@ ParticleEmitterClass * ParticleEmitterClass::Create_From_Definition (const ParticleEmitterDefClass &definition) { // Assume failure - ParticleEmitterClass *pemitter = NULL; + ParticleEmitterClass *pemitter = nullptr; // Attempt to load the texture for this emitter const char *ptexture_filename = definition.Get_Texture_Filename (); - TextureClass *ptexture = NULL; + TextureClass *ptexture = nullptr; if (ptexture_filename && ptexture_filename[0]) { ptexture = WW3DAssetManager::Get_Instance()->Get_Texture ( @@ -349,7 +349,7 @@ void ParticleEmitterClass::On_Frame_Update(void) // The particle buffer doesn't have a valid Scene yet - the emitter // finds out what scene it belongs to (goes up the container tree - // until it finds a non-NULL Scene), and then adds the particle + // until it finds a non-null Scene), and then adds the particle // buffer to it. if ( BufferSceneNeeded ) { @@ -451,8 +451,8 @@ void ParticleEmitterClass::Set_Velocity_Randomizer(Vector3Randomizer *rand) Vector3Randomizer *ParticleEmitterClass::Get_Creation_Volume (void) const { - Vector3Randomizer *randomizer = NULL; - if (PosRand != NULL) { + Vector3Randomizer *randomizer = nullptr; + if (PosRand != nullptr) { randomizer = PosRand->Clone (); //randomizer->Scale (1000.0F); } @@ -462,8 +462,8 @@ Vector3Randomizer *ParticleEmitterClass::Get_Creation_Volume (void) const Vector3Randomizer *ParticleEmitterClass::Get_Velocity_Random (void) const { - Vector3Randomizer *randomizer = NULL; - if (VelRand != NULL) { + Vector3Randomizer *randomizer = nullptr; + if (VelRand != nullptr) { randomizer = VelRand->Clone (); randomizer->Scale (1000.0F); } @@ -630,7 +630,7 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co // Initialize one new particle at the given NewParticleStruct address, with // the given age and emitter transform (expressed as a quaternion and origin -// vector). (must check if address is NULL). +// vector). (must check if address is nullptr). void ParticleEmitterClass::Initialize_Particle(NewParticleStruct * newpart, unsigned int timestamp, const Quaternion & quat, const Vector3 & orig) { @@ -686,12 +686,12 @@ ParticleEmitterClass::Build_Definition (void) const { // Allocate a new emitter definition object ParticleEmitterDefClass *pdefinition = W3DNEW ParticleEmitterDefClass; - WWASSERT (pdefinition != NULL); - if (pdefinition != NULL) { + WWASSERT (pdefinition != nullptr); + if (pdefinition != nullptr) { // Set the texture's filename TextureClass *ptexture = Get_Texture (); - if (ptexture != NULL) { + if (ptexture != nullptr) { pdefinition->Set_Texture_Filename (ptexture->Get_Texture_Name()); REF_PTR_RELEASE(ptexture); } @@ -810,7 +810,7 @@ ParticleEmitterClass::Save (ChunkSaveClass &chunk_save) const // Build a definition from this emitter instance, and save it // to the chunk. ParticleEmitterDefClass *pdefinition = Build_Definition (); - if (pdefinition != NULL) { + if (pdefinition != nullptr) { ret_val = pdefinition->Save_W3D (chunk_save); } @@ -823,9 +823,9 @@ void ParticleEmitterClass::Set_Name (const char *pname) { // Free the old name if necessary - if (NameString != NULL) { + if (NameString != nullptr) { ::free (NameString); - NameString = NULL; + NameString = nullptr; } // Copy the provided name @@ -860,7 +860,7 @@ ParticleEmitterClass::Add_Dependencies_To_List // Get the texture the emitter is using and add it to our list // TextureClass *texture = Get_Texture (); - if (texture != NULL) { + if (texture != nullptr) { file_list.Add (texture->Get_Full_Path ()); REF_PTR_RELEASE(texture); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h index 410de23a813..47b450d0035 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -77,8 +77,8 @@ void Copy_Emitter_Property_Struct dest.Start = src.Start; dest.Rand = src.Rand; dest.NumKeyFrames = src.NumKeyFrames; - dest.KeyTimes = NULL; - dest.Values = NULL; + dest.KeyTimes = nullptr; + dest.Values = nullptr; if (dest.NumKeyFrames > 0) { dest.KeyTimes = W3DNEWARRAY float[dest.NumKeyFrames]; @@ -117,7 +117,7 @@ class ParticleEmitterClass : public RenderObjClass int max_particles = 0, int max_buffer_size = -1, bool pingpong = false, int render_mode = W3D_EMITTER_RENDER_MODE_TRI_PARTICLES, int frame_mode = W3D_EMITTER_FRAME_MODE_1x1, - const W3dEmitterLinePropertiesStruct * line_props = NULL); + const W3dEmitterLinePropertiesStruct * line_props = nullptr); ParticleEmitterClass(const ParticleEmitterClass & src); ParticleEmitterClass & operator = (const ParticleEmitterClass &); @@ -173,7 +173,7 @@ class ParticleEmitterClass : public RenderObjClass void Set_Base_Velocity(const Vector3& base_vel); void Set_Outwards_Velocity(float out_vel); void Set_Velocity_Inheritance_Factor(float inh_factor); - void Set_Acceleration (const Vector3 &acceleration) { if (Buffer != NULL) Buffer->Set_Acceleration (acceleration/1000000.0f); } + void Set_Acceleration (const Vector3 &acceleration) { if (Buffer != nullptr) Buffer->Set_Acceleration (acceleration/1000000.0f); } // Change visual properties of emitter / buffer: void Reset_Colors(ParticlePropertyStruct &new_props) { if (Buffer) Buffer->Reset_Colors(new_props); } @@ -214,7 +214,7 @@ class ParticleEmitterClass : public RenderObjClass // Virtual accessors (used for type specific information) // virtual int Get_User_Type (void) const { return EMITTER_TYPEID_DEFAULT; } - virtual const char * Get_User_String (void) const { return NULL; } + virtual const char * Get_User_String (void) const { return nullptr; } // // Inline accessors. @@ -295,7 +295,7 @@ class ParticleEmitterClass : public RenderObjClass // Initialize one new particle at the given NewParticleStruct // address, with the given age and emitter transform (expressed as a - // quaternion and origin vector). (must check if address is NULL). + // quaternion and origin vector). (must check if address is nullptr). void Initialize_Particle(NewParticleStruct * newpart, unsigned int age, const Quaternion & quat, const Vector3 & orig); @@ -303,9 +303,9 @@ class ParticleEmitterClass : public RenderObjClass unsigned int BurstSize; // Burst size (how many particles in each emission). unsigned int OneTimeBurstSize; // Burst size for a one-time burst. bool OneTimeBurst; // Do we need to do a one-time burst? - Vector3Randomizer * PosRand; // Position randomizer pointer (may be NULL). + Vector3Randomizer * PosRand; // Position randomizer pointer (may be null). Vector3 BaseVel; // Base initial emission velocity. - Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be NULL). + Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be null). float OutwardVel; // Size of outwards velocity. float VelInheritFactor; // Affects emitter vel. inherited by particles. unsigned int EmitRemain; // Millisecond emitter remainder. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index e25e57244ac..a1b12dedf62 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -42,11 +42,11 @@ #include "texture.h" #ifndef SAFE_DELETE -#define SAFE_DELETE(pointer) { delete pointer; pointer = NULL; } +#define SAFE_DELETE(pointer) { delete pointer; pointer = nullptr; } #endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = NULL; } +#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = nullptr; } #endif @@ -68,13 +68,13 @@ const char *EMITTER_TYPE_NAMES[EMITTER_TYPEID_COUNT] = // ParticleEmitterDefClass // ParticleEmitterDefClass::ParticleEmitterDefClass (void) - : m_pName (NULL), + : m_pName (nullptr), m_Version (0L), - m_pUserString (NULL), + m_pUserString (nullptr), m_iUserType (EMITTER_TYPEID_DEFAULT), m_InitialOrientationRandom (0), - m_pCreationVolume (NULL), - m_pVelocityRandomizer (NULL) + m_pCreationVolume (nullptr), + m_pVelocityRandomizer (nullptr) { ::memset (&m_Info, 0, sizeof (m_Info)); ::memset (&m_InfoV2, 0, sizeof (m_InfoV2)); @@ -95,13 +95,13 @@ ParticleEmitterDefClass::ParticleEmitterDefClass (void) // ParticleEmitterDefClass // ParticleEmitterDefClass::ParticleEmitterDefClass (const ParticleEmitterDefClass &src) - : m_pName (NULL), + : m_pName (nullptr), m_Version (0L), - m_pUserString (NULL), + m_pUserString (nullptr), m_iUserType (EMITTER_TYPEID_DEFAULT), m_InitialOrientationRandom (src.m_InitialOrientationRandom), - m_pCreationVolume (NULL), - m_pVelocityRandomizer (NULL) + m_pCreationVolume (nullptr), + m_pVelocityRandomizer (nullptr) { ::memset (&m_Info, 0, sizeof (m_Info)); ::memset (&m_InfoV2, 0, sizeof (m_InfoV2)); @@ -126,19 +126,19 @@ ParticleEmitterDefClass::ParticleEmitterDefClass (const ParticleEmitterDefClass ParticleEmitterDefClass::~ParticleEmitterDefClass (void) { // Free the name buffer if necessary - if (m_pName != NULL) { + if (m_pName != nullptr) { // free() is used because the buffer was allocated with ::_strdup(). ::free (m_pName); - m_pName = NULL; + m_pName = nullptr; } // Free the user-string buffer if necessary - if (m_pUserString != NULL) { + if (m_pUserString != nullptr) { // free() is used because the buffer was allocated with ::malloc() or ::_strdup(). ::free (m_pUserString); - m_pUserString = NULL; + m_pUserString = nullptr; } Free_Props (); @@ -237,7 +237,7 @@ ParticleEmitterDefClass::Set_Velocity_Random (Vector3Randomizer *randomizer) // // Ensure our persistent structure is up-to-date so it will save correctly // - if (m_pVelocityRandomizer != NULL) { + if (m_pVelocityRandomizer != nullptr) { Initialize_Randomizer_Struct (*m_pVelocityRandomizer, m_InfoV2.VelRandom); } @@ -258,7 +258,7 @@ ParticleEmitterDefClass::Set_Creation_Volume (Vector3Randomizer *randomizer) // // Ensure our persistent structure is up-to-date so it will save correctly // - if (m_pCreationVolume != NULL) { + if (m_pCreationVolume != nullptr) { Initialize_Randomizer_Struct (*m_pCreationVolume, m_InfoV2.CreationVolume); } @@ -317,7 +317,7 @@ ParticleEmitterDefClass::Normalize_Filename (void) // Find the last occurance of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); - if (filename != NULL) { + if (filename != nullptr) { // Increment past the directory deliminator filename ++; @@ -451,7 +451,7 @@ ParticleEmitterDefClass::Convert_To_Ver2 (void) // ShaderClass shader = ShaderClass::_PresetAdditiveSpriteShader; TextureClass *ptexture = WW3DAssetManager::Get_Instance ()->Get_Texture (m_Info.TextureFilename); - if (ptexture != NULL) { + if (ptexture != nullptr) { // If texture has an alpha channel do alpha blending instead of additive // (which is the default for point groups): // SurfaceClass::SurfaceDescription surf_desc; @@ -628,7 +628,7 @@ ParticleEmitterDefClass::Read_Info (ChunkLoadClass &chunk_load) Vector3Randomizer * ParticleEmitterDefClass::Create_Randomizer (W3dVolumeRandomizerStruct &info) { - Vector3Randomizer *randomizer = NULL; + Vector3Randomizer *randomizer = nullptr; switch (info.ClassID) { case Vector3Randomizer::CLASSID_SOLIDBOX: @@ -787,7 +787,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the color keyframes from the chunk // - Read_Color_Keyframe (chunk_load, NULL, &m_ColorKeyframes.Start); + Read_Color_Keyframe (chunk_load, nullptr, &m_ColorKeyframes.Start); for (index = 0; index < m_ColorKeyframes.NumKeyFrames; index ++) { Read_Color_Keyframe (chunk_load, &m_ColorKeyframes.KeyTimes[index], @@ -814,7 +814,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the opacity keyframes from the chunk // - Read_Opacity_Keyframe (chunk_load, NULL, &m_OpacityKeyframes.Start); + Read_Opacity_Keyframe (chunk_load, nullptr, &m_OpacityKeyframes.Start); for (index = 0; index < m_OpacityKeyframes.NumKeyFrames; index ++) { Read_Opacity_Keyframe (chunk_load, &m_OpacityKeyframes.KeyTimes[index], @@ -824,7 +824,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the size keyframes from the chunk // - Read_Size_Keyframe (chunk_load, NULL, &m_SizeKeyframes.Start); + Read_Size_Keyframe (chunk_load, nullptr, &m_SizeKeyframes.Start); for (index = 0; index < m_SizeKeyframes.NumKeyFrames; index ++) { Read_Size_Keyframe (chunk_load, &m_SizeKeyframes.KeyTimes[index], @@ -865,12 +865,12 @@ ParticleEmitterDefClass::Read_Color_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the oclor back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = RGBA_TO_VECTOR3 (key_frame.Color); } @@ -903,12 +903,12 @@ ParticleEmitterDefClass::Read_Opacity_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the value back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = key_frame.Opacity; } @@ -941,12 +941,12 @@ ParticleEmitterDefClass::Read_Size_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the value back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = key_frame.Size; } @@ -1215,7 +1215,7 @@ ParticleEmitterDefClass::Save_User_Data (ChunkSaveClass &chunk_save) ret_val = WW3D_ERROR_OK; // Do we need to write the user string to the file? - if (m_pUserString != NULL) { + if (m_pUserString != nullptr) { // Now write the user string param to the file if (chunk_save.Write (m_pUserString, string_len) != string_len) { @@ -1800,11 +1800,11 @@ PrototypeClass * ParticleEmitterLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) { // Assume failure - ParticleEmitterPrototypeClass *pprototype = NULL; + ParticleEmitterPrototypeClass *pprototype = nullptr; // Create a definition object ParticleEmitterDefClass *pdefinition = W3DNEW ParticleEmitterDefClass; - if (pdefinition != NULL) { + if (pdefinition != nullptr) { // Ask the definition object to load the emitter data if (pdefinition->Load_W3D (chunk_load) != WW3D_ERROR_OK) { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 08b2bfe3cdf..7ebdae2b037 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -60,7 +60,7 @@ RectClass Render2DClass::ScreenResolution( 0,0,0,0 ); Render2DClass::Render2DClass( TextureClass* tex ) : CoordinateScale( 1, 1 ), CoordinateOffset( 0, 0 ), - Texture(0), + Texture(nullptr), ZValue(0), IsHidden( false ), IsGrayScale (false) @@ -110,7 +110,7 @@ void Render2DClass::Set_Texture( const char * filename) { TextureClass * tex = WW3DAssetManager::Get_Instance()->Get_Texture( filename, MIP_LEVELS_1 ); Set_Texture( tex ); - if ( tex != NULL ) { + if ( tex != nullptr ) { SET_REF_OWNER( tex ); tex->Release_Ref(); } @@ -637,7 +637,7 @@ void Render2DClass::Render(void) Render2DTextClass::Render2DTextClass(Font3DInstanceClass *font) : Location(0.0f,0.0f), Cursor(0.0f,0.0f), - Font(NULL), + Font(nullptr), WrapWidth(0), ClipRect(0, 0, 0, 0), IsClippedEnabled(false) @@ -668,7 +668,7 @@ void Render2DTextClass::Set_Font( Font3DInstanceClass *font ) { REF_PTR_SET(Font,font); - if ( Font != NULL ) { + if ( Font != nullptr ) { Set_Texture( Font->Peek_Texture() ); #define BLOCK_CHAR 0 diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h index a9bf9a51693..3ebf438e4fb 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h @@ -94,7 +94,7 @@ class Render2DClass : public W3DMPO { W3DMPO_GLUE(Render2DClass) public: - Render2DClass( TextureClass* tex = NULL ); + Render2DClass( TextureClass* tex = nullptr ); virtual ~Render2DClass(void); virtual void Reset(void); @@ -188,7 +188,7 @@ class Render2DClass : public W3DMPO */ class Render2DTextClass : public Render2DClass { public: - Render2DTextClass(Font3DInstanceClass *font=NULL); + Render2DTextClass(Font3DInstanceClass *font=nullptr); ~Render2DTextClass(); virtual void Reset(void); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp index cea7f87bceb..93ee8b64cef 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp @@ -50,11 +50,11 @@ RenderInfoClass::RenderInfoClass(CameraClass & cam) : fog_start(0.0f), fog_end(0.0f), fog_scale(0.0f), - light_environment(0), + light_environment(nullptr), AdditionalMaterialPassCount(0), RejectedMaterialPasses(0), OverrideFlagLevel(0), - Texture_Projector(NULL), + Texture_Projector(nullptr), alphaOverride(1.0f), materialPassAlphaOverride(1.0f), materialPassEmissiveOverride(1.0f) @@ -83,7 +83,7 @@ void RenderInfoClass::Pop_Material_Pass(void) WWASSERT(AdditionalMaterialPassCount>0); AdditionalMaterialPassCount--; MaterialPassClass * mpass = AdditionalMaterialPassArray[AdditionalMaterialPassCount]; - if (mpass != NULL) { + if (mpass != nullptr) { mpass->Release_Ref(); } } @@ -128,8 +128,8 @@ RenderInfoClass::RINFO_OVERRIDE_FLAGS & RenderInfoClass::Current_Override_Flags( SpecialRenderInfoClass::SpecialRenderInfoClass(CameraClass & cam,int render_type) : RenderInfoClass(cam), RenderType(render_type), - VisRasterizer(NULL), - BWRenderer(NULL) + VisRasterizer(nullptr), + BWRenderer(nullptr) { } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp index 62c73f0488a..d49ff840bb0 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -351,7 +351,7 @@ SimpleSceneClass::~SimpleSceneClass(void) void SimpleSceneClass::Remove_All_Render_Objects(void) { RenderObjClass * obj; - while ( ( obj = RenderList.Remove_Head() ) != NULL ) { + while ( ( obj = RenderList.Remove_Head() ) != nullptr ) { SceneClass::Remove_Render_Object(obj); obj->Release_Ref(); // remove head gets a ref } @@ -543,13 +543,13 @@ void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo) // apply only the first four lights in the scene // derived classes should use light environment - WWASSERT(rinfo.light_environment==NULL); + WWASSERT(rinfo.light_environment==nullptr); int count=0; // Turn off lights in case we have none - DX8Wrapper::Set_Light(0,NULL); - DX8Wrapper::Set_Light(1,NULL); - DX8Wrapper::Set_Light(2,NULL); - DX8Wrapper::Set_Light(3,NULL); + DX8Wrapper::Set_Light(0,nullptr); + DX8Wrapper::Set_Light(1,nullptr); + DX8Wrapper::Set_Light(2,nullptr); + DX8Wrapper::Set_Light(3,nullptr); for (it.First(&LightList); !it.Is_Done(); it.Next()) { if (count<4) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp index f17ba4de0d1..efa57687e7c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -377,7 +377,7 @@ void SortingRendererClass::Insert_Triangles( if (!node) sorted_list.Add_Tail(state); #ifdef WWDEBUG - unsigned short* indices=NULL; + unsigned short* indices=nullptr; SortingIndexBufferClass* index_buffer=static_cast(state->sorting_state.index_buffer); WWASSERT(index_buffer); indices=index_buffer->index_buffer; @@ -494,19 +494,19 @@ static void Apply_Render_State(RenderStateStruct& render_state) DX8Wrapper::Set_DX8_Light(3,&render_state.Lights[3]); } else { - DX8Wrapper::Set_DX8_Light(3,NULL); + DX8Wrapper::Set_DX8_Light(3,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(2,NULL); + DX8Wrapper::Set_DX8_Light(2,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(1,NULL); + DX8Wrapper::Set_DX8_Light(1,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(0,NULL); + DX8Wrapper::Set_DX8_Light(0,nullptr); } @@ -543,7 +543,7 @@ void SortingRendererClass::Flush_Sorting_Pool() SortingNodeStruct* state=overlapping_nodes[node_id]; float* vertex_z_array=Get_Vertex_Z_Array(state->vertex_count); - VertexFormatXYZNDUV2* src_verts=NULL; + VertexFormatXYZNDUV2* src_verts=nullptr; SortingVertexBufferClass* vertex_buffer=static_cast(state->sorting_state.vertex_buffer); WWASSERT(vertex_buffer); src_verts=vertex_buffer->VertexBuffer; @@ -561,7 +561,7 @@ void SortingRendererClass::Flush_Sorting_Pool() *dest_verts++=*src_verts; } - unsigned short* indices=NULL; + unsigned short* indices=nullptr; SortingIndexBufferClass* index_buffer=static_cast(state->sorting_state.index_buffer); WWASSERT(index_buffer); indices=index_buffer->index_buffer; @@ -719,8 +719,8 @@ void SortingRendererClass::Flush() Flush_Sorting_Pool(); - DX8Wrapper::Set_Index_Buffer(0,0); - DX8Wrapper::Set_Vertex_Buffer(0); + DX8Wrapper::Set_Index_Buffer(nullptr,0); + DX8Wrapper::Set_Vertex_Buffer(nullptr); total_sorting_vertices=0; DynamicIBAccessClass::_Reset(false); @@ -736,12 +736,12 @@ void SortingRendererClass::Flush() void SortingRendererClass::Deinit() { - SortingNodeStruct *head = NULL; + SortingNodeStruct *head = nullptr; // // Flush the sorted list // - while ((head = sorted_list.Head ()) != NULL) { + while ((head = sorted_list.Head ()) != nullptr) { sorted_list.Remove_Head (); delete head; } @@ -749,28 +749,28 @@ void SortingRendererClass::Deinit() // // Flush the clean list // - while ((head = clean_list.Head ()) != NULL) { + while ((head = clean_list.Head ()) != nullptr) { clean_list.Remove_Head (); delete head; } delete[] vertex_z_array; - vertex_z_array=NULL; + vertex_z_array=nullptr; vertex_z_array_count=0; delete[] polygon_z_array; - polygon_z_array=NULL; + polygon_z_array=nullptr; polygon_z_array_count=0; delete[] node_id_array; - node_id_array=NULL; + node_id_array=nullptr; node_id_array_count=0; delete[] sorted_node_id_array; - sorted_node_id_array=NULL; + sorted_node_id_array=nullptr; sorted_node_id_array_count=0; delete[] polygon_index_array; - polygon_index_array=NULL; + polygon_index_array=nullptr; polygon_index_array_count=0; delete[] temp_index_array; - temp_index_array=NULL; + temp_index_array=nullptr; temp_index_array_count=0; } @@ -847,7 +847,7 @@ void SortingRendererClass::Insert_VolumeParticle( if (!node) sorted_list.Add_Tail(state); //#ifdef WWDEBUG -// unsigned short* indices=NULL; +// unsigned short* indices=nullptr; // SortingIndexBufferClass* index_buffer=static_cast(state->sorting_state.index_buffer); // WWASSERT(index_buffer); // indices=index_buffer->index_buffer; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp index 267d9f33844..b0be7fb418e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp @@ -71,9 +71,9 @@ class DynD3DMATERIAL8 : public W3DMPO */ VertexMaterialClass::VertexMaterialClass(void): #ifdef DYN_MAT8 - MaterialDyn(NULL), + MaterialDyn(nullptr), #else - MaterialOld(NULL), + MaterialOld(nullptr), #endif Flags(0), AmbientColorSource(D3DMCS_MATERIAL), @@ -87,7 +87,7 @@ VertexMaterialClass::VertexMaterialClass(void): for (i=0; iClone(); @@ -156,7 +156,7 @@ VertexMaterialClass::~VertexMaterialClass(void) if (Mapper[i]) { REF_PTR_RELEASE(Mapper[i]); - Mapper[i]=NULL; + Mapper[i]=nullptr; } } @@ -181,9 +181,9 @@ VertexMaterialClass & VertexMaterialClass::operator = (const VertexMaterialClass CRCDirty=src.CRCDirty; int stage; for (stage=0;stageRelease_Ref(); - Mapper[stage] = NULL; + Mapper[stage] = nullptr; } } for (stage=0;stageGet_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -1368,7 +1368,7 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -1398,7 +1398,7 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; switch (format) { case TGA: @@ -1504,7 +1504,7 @@ void WW3D::Start_Movie_Capture( const char * filename_base, float frame_rate ) int width=bounds.right-bounds.left; int depth=24; - WWASSERT( Movie == NULL); + WWASSERT( Movie == nullptr); if (frame_rate == 0.0f) { frame_rate = 1.0f; @@ -1539,9 +1539,9 @@ void WW3D::Stop_Movie_Capture( void ) IsCapturing = false; WWDEBUG_SAY(( "Stoping Movie" )); - WWASSERT( Movie != NULL); + WWASSERT( Movie != nullptr); delete Movie; - Movie = NULL; + Movie = nullptr; } #endif } @@ -1655,7 +1655,7 @@ bool WW3D::Is_Movie_Paused() *=============================================================================================*/ bool WW3D::Is_Recording_Next_Frame() { - return (Movie != 0) && (!PauseRecord || RecordNextFrame); + return (Movie != nullptr) && (!PauseRecord || RecordNextFrame); } @@ -1673,7 +1673,7 @@ bool WW3D::Is_Recording_Next_Frame() *=============================================================================================*/ bool WW3D::Is_Movie_Ready() { - return Movie != 0; + return Movie != nullptr; } @@ -1706,10 +1706,10 @@ void WW3D::Update_Movie_Capture( void ) surface->Get_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -1718,7 +1718,7 @@ void WW3D::Update_Movie_Capture( void ) } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -1748,7 +1748,7 @@ void WW3D::Update_Movie_Capture( void ) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Movie->Grab(image); #endif @@ -1877,7 +1877,7 @@ VertexMaterialClass * WW3D::Peek_Default_Debug_Material(void) WWASSERT(DefaultDebugMaterial); return DefaultDebugMaterial; #else - return NULL; + return nullptr; #endif } @@ -1930,7 +1930,7 @@ ShaderClass WW3D::Peek_Lightmap_Debug_Shader(void) void WW3D::Allocate_Debug_Resources(void) { #ifdef WWDEBUG - WWASSERT(DefaultDebugMaterial == NULL); + WWASSERT(DefaultDebugMaterial == nullptr); DefaultDebugMaterial = W3DNEW VertexMaterialClass; DefaultDebugMaterial->Set_Shininess(0.0f); DefaultDebugMaterial->Set_Opacity(1.0f); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index f169690b695..24906129b0e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -100,7 +100,7 @@ class WW3D }; - static WW3DErrorType Init(void * hwnd, char *defaultpal = NULL, bool lite = false); + static WW3DErrorType Init(void * hwnd, char *defaultpal = nullptr, bool lite = false); static WW3DErrorType Shutdown(void); static bool Is_Initted(void) { return IsInitted; } @@ -143,7 +143,7 @@ class WW3D ** special cases like generating a shadow texture for an object. Basically this function will have the ** entire scene rendering overhead. */ - static WW3DErrorType Begin_Render(bool clear = false,bool clearz = true,const Vector3 & color = Vector3(0,0,0), float dest_alpha=0.0f, void(*network_callback)(void) = NULL); + static WW3DErrorType Begin_Render(bool clear = false,bool clearz = true,const Vector3 & color = Vector3(0,0,0), float dest_alpha=0.0f, void(*network_callback)(void) = nullptr); static WW3DErrorType Render(const LayerListClass & layerlist); static WW3DErrorType Render(const LayerClass & layer); static WW3DErrorType Render(SceneClass * scene,CameraClass * cam,bool clear = false,bool clearz = false,const Vector3 & color = Vector3(0,0,0)); diff --git a/Generals/Code/Main/WinMain.cpp b/Generals/Code/Main/WinMain.cpp index 3c34a3e81cf..528b09dbdf5 100644 --- a/Generals/Code/Main/WinMain.cpp +++ b/Generals/Code/Main/WinMain.cpp @@ -70,9 +70,9 @@ // GLOBALS //////////////////////////////////////////////////////////////////// -HINSTANCE ApplicationHInstance = NULL; ///< our application instance -HWND ApplicationHWnd = NULL; ///< our application window handle -Win32Mouse *TheWin32Mouse = NULL; ///< for the WndProc() only +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance +HWND ApplicationHWnd = nullptr; ///< our application window handle +Win32Mouse *TheWin32Mouse = nullptr; ///< for the WndProc() only DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows. const Char *g_strFile = "data\\Generals.str"; @@ -83,7 +83,7 @@ static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; -static HBITMAP gLoadScreenBitmap = NULL; +static HBITMAP gLoadScreenBitmap = nullptr; //#define DEBUG_WINDOWS_MESSAGES @@ -516,7 +516,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, //------------------------------------------------------------------------- case 0x020A: // WM_MOUSEWHEEL { - if( TheWin32Mouse == NULL ) + if( TheWin32Mouse == nullptr ) return 0; long x = (long) LOWORD(lParam); @@ -535,7 +535,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, //------------------------------------------------------------------------- case WM_MOUSEMOVE: { - if( TheWin32Mouse == NULL ) + if( TheWin32Mouse == nullptr ) return 0; // ignore when window is not active @@ -584,7 +584,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, ::SetBkColor(dc, RGB(0,0,0)); ::TextOut(dc, 30, 30, "Loading Command & Conquer Generals...", 37); #endif - if (gLoadScreenBitmap!=NULL) { + if (gLoadScreenBitmap!=nullptr) { Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); @@ -677,8 +677,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, WndProc, 0, 0, hInstance, LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ApplicationIcon)), - NULL/*LoadCursor(NULL, IDC_ARROW)*/, - (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, + nullptr/*LoadCursor(nullptr, IDC_ARROW)*/, + (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT("Game Window") }; RegisterClass( &wndClass ); @@ -715,10 +715,10 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin //(GetSystemMetrics( SM_CYSCREEN ) / 25) - (startHeight / 25),//this works with any screen res rect.right-rect.left, rect.bottom-rect.top, - 0L, - 0L, + nullptr, + nullptr, hInstance, - 0L ); + nullptr ); if (!runWindowed) @@ -795,7 +795,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, /// @todo remove this force set of working directory later Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (Char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -834,14 +834,14 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, // save our application instance for future use ApplicationHInstance = hInstance; - if (gLoadScreenBitmap!=NULL) { + if (gLoadScreenBitmap!=nullptr) { ::DeleteObject(gLoadScreenBitmap); - gLoadScreenBitmap = NULL; + gLoadScreenBitmap = nullptr; } // BGC - initialize COM - // OleInitialize(NULL); + // OleInitialize(nullptr); @@ -855,7 +855,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, if (!rts::ClientInstance::initialize()) { - HWND ccwindow = FindWindow(rts::ClientInstance::getFirstInstanceName(), NULL); + HWND ccwindow = FindWindow(rts::ClientInstance::getFirstInstanceName(), nullptr); if (ccwindow) { SetForegroundWindow(ccwindow); @@ -864,7 +864,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, DEBUG_LOG(("Generals is already running...Bail!")); delete TheVersion; - TheVersion = NULL; + TheVersion = nullptr; shutdownMemoryManager(); return exitcode; } @@ -875,7 +875,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, exitcode = GameMain(); delete TheVersion; - TheVersion = NULL; + TheVersion = nullptr; #ifdef MEMORYPOOL_DEBUG TheMemoryPoolFactory->debugMemoryReport(REPORT_POOLINFO | REPORT_POOL_OVERFLOW | REPORT_SIMPLE_LEAKS, 0, 0); @@ -897,10 +897,10 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef RTS_ENABLE_CRASHDUMP MiniDumper::shutdownMiniDumper(); #endif - TheAsciiStringCriticalSection = NULL; - TheUnicodeStringCriticalSection = NULL; - TheDmaCriticalSection = NULL; - TheMemoryPoolCriticalSection = NULL; + TheAsciiStringCriticalSection = nullptr; + TheUnicodeStringCriticalSection = nullptr; + TheDmaCriticalSection = nullptr; + TheMemoryPoolCriticalSection = nullptr; return exitcode; diff --git a/Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h b/Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h index dda18bf3aea..0a0cca6e32c 100644 --- a/Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h +++ b/Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h @@ -95,7 +95,7 @@ class GUIEditDisplay : public Display // These are stub functions to allow compilation: /// Create a video buffer that can be used for this display - virtual VideoBuffer* createVideoBuffer( void ) { return NULL; } + virtual VideoBuffer* createVideoBuffer( void ) { return nullptr; } /// draw a video buffer fit within the screen coordinates virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) { } diff --git a/Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h b/Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h index d79cb6085ec..03846f8aa82 100644 --- a/Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h +++ b/Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h @@ -55,7 +55,7 @@ class GUIEditWindowManager : public W3DGameWindowManager virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, Int x, Int y, Int width, Int height, GameWinSystemFunc system, - WinInstanceData *instData = NULL ); + WinInstanceData *instData = nullptr ); // ************************************************************************** // GUIEdit specific methods ************************************************* @@ -90,7 +90,7 @@ class GUIEditWindowManager : public W3DGameWindowManager also in the select list */ void removeSupervisedChildSelections( void ); /** selected windows that are children will cut loose their parents - and become adults (their parent will be NULL, otherwise the screen) */ + and become adults (their parent will be null, otherwise the screen) */ // void orphanSelectedChildren( void ); /// dupe a window and its children diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp index 84300568e45..f9ac3167cec 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp @@ -64,7 +64,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static const char *noNameWindowString = "Un-named Window"; -static GameWindow *currentWindow = NULL; ///< current window we're editing +static GameWindow *currentWindow = nullptr; ///< current window we're editing // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ void SaveCallbacks( GameWindow *window, HWND dialog ) { // sanity - if( window == NULL || dialog == NULL ) + if( window == nullptr || dialog == nullptr ) return; // get edit data for window @@ -122,7 +122,7 @@ void SaveCallbacks( GameWindow *window, HWND dialog ) //============================================================================= static void setCurrentWindow( GameWindow *window, HWND dialog ) { - GameWindowEditData *editData = NULL; + GameWindowEditData *editData = nullptr; // get edit data from window if present if( window ) @@ -132,7 +132,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) currentWindow = window; // sanity - if( dialog == NULL ) + if( dialog == nullptr ) return; // enable the callback combo boxes @@ -156,7 +156,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // input - name = NULL; + name = nullptr; if( editData ) name = editData->inputCallbackString; if( name.isEmpty() ) @@ -165,7 +165,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // tooltip - name = NULL; + name = nullptr; if( editData ) name = editData->tooltipCallbackString; if( name.isEmpty() ) @@ -174,7 +174,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // draw - name = NULL; + name = nullptr; if( editData ) name = editData->drawCallbackString; if( name.isEmpty() ) @@ -209,7 +209,7 @@ static void loadUserWindows( HWND listbox, GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // is this a candidate @@ -286,7 +286,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, { // load the combos with the callbacks - InitCallbackCombos( hWndDialog, NULL ); + InitCallbackCombos( hWndDialog, nullptr ); // select the none string at the top index in each combo SendDlgItemMessage( hWndDialog, COMBO_SYSTEM, CB_SETCURSEL, 0, 0 ); @@ -299,7 +299,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, TheWindowManager->winGetWindowList() ); // no current window - setCurrentWindow( NULL, hWndDialog ); + setCurrentWindow( nullptr, hWndDialog ); return TRUE; @@ -337,7 +337,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, // sanity - DEBUG_ASSERTCRASH( win, ("NULL window set in listbox item data") ); + DEBUG_ASSERTCRASH( win, ("null window set in listbox item data") ); // save the callbacks for the curent window selected SaveCallbacks( currentWindow, hWndDialog ); @@ -361,7 +361,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, // save callbacks, set current window to empty and end dialog SaveCallbacks( currentWindow, hWndDialog ); - setCurrentWindow( NULL, hWndDialog ); + setCurrentWindow( nullptr, hWndDialog ); // save the layout callbacks saveLayoutCallbacks( hWndDialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp index b53865f58f5..475af3a4da7 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp @@ -215,8 +215,8 @@ HWND InitCheckBoxPropertiesDialog( GameWindow *window ) (LPCTSTR)CHECK_BOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)checkBoxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp index f65f77b0316..f688806a28e 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp @@ -257,7 +257,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWnd, UINT uMsg, * * Returns: * Pointer to selected color - * NULL for canceled request + * nullptr for canceled request */ // ============================================================================ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, @@ -276,7 +276,7 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, TheEditor->getWindowHandle(), SelectColorDlgProc ) ) return &selectedColor; else - return NULL; + return nullptr; } @@ -406,19 +406,19 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (mode == MODE_RGB) { rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); // convert to ranges 0 - 1 for RGB conversion hsvColor.saturation /= 100.0f; hsvColor.value /= 100.0f; @@ -444,7 +444,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, DeleteObject (hBrushNew); // validate this new area - ValidateRect (hWndControl, NULL); + ValidateRect (hWndControl, nullptr); break; @@ -531,7 +531,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // original pen if (mode == MODE_HSV) { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = 1.0f / 100.0f; hsvColor.value = 1; rgbColor = hsvToRGB (hsvColor); @@ -593,9 +593,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // original pen if (mode == MODE_HSV) { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = - (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE) / 100.0f; + (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE) / 100.0f; hsvColor.value = 1.0f / 100.0f; rgbColor = hsvToRGB (hsvColor); rgbColor.red *= 255.0f; @@ -722,24 +722,24 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (mode == MODE_RGB) { rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, - NULL, FALSE ); + nullptr, FALSE ); } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); hsvColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, - NULL, FALSE ); + nullptr, FALSE ); // convert to ranges 0 - 1 for RGB conversion hsvColor.saturation /= 100.0f; @@ -759,13 +759,13 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // force update of preview box // invalidate the preview box to force an update of its color - InvalidateRect( hWndPreview, NULL, FALSE); + InvalidateRect( hWndPreview, nullptr, FALSE); UpdateWindow (hWndPreview); // force updates of the colorbars - InvalidateRect (hWndColorBar1, NULL, FALSE); - InvalidateRect (hWndColorBar2, NULL, FALSE); - InvalidateRect (hWndColorBar3, NULL, FALSE); + InvalidateRect (hWndColorBar1, nullptr, FALSE); + InvalidateRect (hWndColorBar2, nullptr, FALSE); + InvalidateRect (hWndColorBar3, nullptr, FALSE); UpdateWindow (hWndColorBar1); UpdateWindow (hWndColorBar2); UpdateWindow (hWndColorBar3); @@ -811,9 +811,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, HSVColorReal hsvColor; if (mode == MODE_RGB) { // switch to HSV - rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); - rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); - rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); + rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); // convert rgb to range 0 - 1 rgbColor.red /= 255.0f; @@ -849,9 +849,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, } else { // switch to RGB - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); - hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); - hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); // convert saturation and value to range 0 - 1 hsvColor.saturation /= 100.0f; @@ -888,9 +888,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, } // invalidate all the vertical color bars so they are redrawn - InvalidateRect (hWndColorBar1, NULL, TRUE); - InvalidateRect (hWndColorBar2, NULL, TRUE); - InvalidateRect (hWndColorBar3, NULL, TRUE); + InvalidateRect (hWndColorBar1, nullptr, TRUE); + InvalidateRect (hWndColorBar2, nullptr, TRUE); + InvalidateRect (hWndColorBar3, nullptr, TRUE); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp index 4a31019bc94..8c9230fddc2 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp @@ -542,11 +542,11 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetComboBoxSetLettersAndNumbersOnly(window, IsDlgButtonChecked( hWndDialog, CHECK_LETTERS_AND_NUMBERS )); // change in the size of the comboBox - Int newMaxChars = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, FALSE ); + Int newMaxChars = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, nullptr, FALSE ); if( newMaxChars != comboData->maxChars) GadgetComboBoxSetMaxChars( window, newMaxChars ); - Int newMaxDisplay = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS_DISPLAYED, NULL, FALSE ); + Int newMaxDisplay = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS_DISPLAYED, nullptr, FALSE ); if( newMaxDisplay != comboData->maxDisplay ) GadgetComboBoxSetMaxDisplay( window, newMaxDisplay ); @@ -607,8 +607,8 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) (LPCTSTR)COMBO_BOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)comboBoxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp index 4f2f38a36a7..5b303495357 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp @@ -130,7 +130,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -179,7 +179,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, newColor->blue, newColor->alpha ); SetControlColor( controlID, newGameColor ); - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } @@ -285,7 +285,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { HWND combo; FunctionLexicon::TableEntry *entry; - GameWindowEditData *editData = NULL; + GameWindowEditData *editData = nullptr; AsciiString name; // get edit data from window @@ -434,8 +434,8 @@ HWND InitUserWinPropertiesDialog( GameWindow *window ) (LPCTSTR)GENERIC_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)genericPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp index ea0b71c3123..c0ac2f89ed5 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp @@ -153,7 +153,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -194,7 +194,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, { gridColor = *newColor; - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } @@ -210,7 +210,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, Int value; // get the pixels between marks - value = GetDlgItemInt( hWndDialog, EDIT_RESOLUTION, NULL, FALSE ); + value = GetDlgItemInt( hWndDialog, EDIT_RESOLUTION, nullptr, FALSE ); TheEditor->setGridResolution( value ); // get grid on/off flag diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 7d73dea2097..101dfeda44c 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -46,6 +46,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////// + #include "GUIEdit.h" #include "Properties.h" #include "LayoutScheme.h" @@ -224,15 +225,15 @@ static void removeScrollbar( GameWindow *listbox ) // delete the up button TheWindowManager->winDestroy( listData->upButton ); - listData->upButton = NULL; + listData->upButton = nullptr; // delete down button TheWindowManager->winDestroy( listData->downButton ); - listData->downButton = NULL; + listData->downButton = nullptr; // delete the slider TheWindowManager->winDestroy( listData->slider ); - listData->slider = NULL; + listData->slider = nullptr; // remove the scrollbar flag from the listbox data listData->scrollBar = FALSE; @@ -577,7 +578,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, removeScrollbar( window ); // change in the size of the listbox - Int newMaxItems = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS, NULL, FALSE ); + Int newMaxItems = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS, nullptr, FALSE ); if( newMaxItems != listData->listLength ) GadgetListBoxSetListLength( window, newMaxItems ); @@ -596,7 +597,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, window->winSetStatus( bit ); // Multi-column - Int newColumns = GetDlgItemInt( hWndDialog, EDIT_NUM_COLUMNS,NULL,FALSE); + Int newColumns = GetDlgItemInt( hWndDialog, EDIT_NUM_COLUMNS,nullptr,FALSE); if(newColumns > 1) { @@ -604,7 +605,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GetDlgItemText(hWndDialog,EDIT_COLUMN_PERCENT,percentages,sizeof(percentages)); if(strlen(percentages) == 0) { - MessageBox(NULL,"You have specified a column amount greater then 1, please enter the same about of percentages","whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr,"You have specified a column amount greater then 1, please enter the same about of percentages","whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); break; } @@ -612,17 +613,17 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, Int i = 0; Int total = 0; Char *token = strtok( percentages, "," ); - while( token != NULL ) + while( token != nullptr ) { newPercentages[i] = atoi(token); total += newPercentages[i]; - token = strtok( NULL, "," ); + token = strtok( nullptr, "," ); i++; if(i > newColumns && token) { Char whoopsMsg[250]; sprintf(whoopsMsg,"You have Specified %d columns but I have read in more then that for the percentages, please double check your data", newColumns); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -630,7 +631,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, { Char whoopsMsg[250]; sprintf(whoopsMsg,"You have Specified %d columns but I have read in only %d for the percentages, please double check your data", newColumns, i ); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -638,7 +639,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, { Char whoopsMsg[250]; sprintf(whoopsMsg,"Please Double check to make sure your percentages add up to 100."); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -703,8 +704,8 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) (LPCTSTR)LISTBOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)listboxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp index 9692ada0d91..35e4ea7f120 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp @@ -237,8 +237,8 @@ HWND InitProgressBarPropertiesDialog( GameWindow *window ) (LPCTSTR)PROGRESS_BAR_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)progressBarPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp index 4b34062e485..e44b979f274 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp @@ -206,8 +206,8 @@ HWND InitPushButtonPropertiesDialog( GameWindow *window ) (LPCTSTR)PUSH_BUTTON_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)pushButtonPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index 762e869b3ed..334362fa102 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -175,9 +175,9 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, GadgetRadioSetHiliteCheckedBoxColor( window, info->color ); GadgetRadioSetHiliteCheckedBoxBorderColor( window, info->borderColor ); - // save group - Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, NULL, FALSE ); - Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); + // save group + Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, nullptr, FALSE ); + Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); GadgetRadioSetGroup( window, group, screen ); } @@ -231,11 +231,11 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) { // sanity - if( combo == NULL ) + if( combo == nullptr ) return; // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // if this is a radio button get the group @@ -275,8 +275,8 @@ HWND InitRadioButtonPropertiesDialog( GameWindow *window ) (LPCTSTR)RADIO_BUTTON_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)radioButtonPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index a02474ed9c6..db2da4e8138 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -285,8 +285,8 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, // slider data SliderData *sliderData = (SliderData *)window->winGetUserData(); - sliderData->minVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MIN, NULL, FALSE ); - sliderData->maxVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MAX, NULL, FALSE ); + sliderData->minVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MIN, nullptr, FALSE ); + sliderData->maxVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MAX, nullptr, FALSE ); // sanity if( sliderData->minVal > sliderData->maxVal ) @@ -295,7 +295,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, sliderData->minVal = sliderData->maxVal; sliderData->maxVal = temp; - MessageBox( NULL, "Slider min greated than max, the values were swapped", + MessageBox( nullptr, "Slider min greated than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); } @@ -356,8 +356,8 @@ HWND InitSliderPropertiesDialog( GameWindow *window ) (LPCTSTR)SLIDER_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)sliderPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp index 2fd0bec921e..66e83737584 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp @@ -207,8 +207,8 @@ HWND InitStaticTextPropertiesDialog( GameWindow *window ) (LPCTSTR)STATIC_TEXT_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)staticTextPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp index 07b2c4da465..10790580990 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp @@ -278,11 +278,11 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - tabData->tabWidth = GetDlgItemInt( hWndDialog, TAB_WIDTH, NULL, FALSE ); - tabData->tabHeight = GetDlgItemInt(hWndDialog, TAB_HEIGHT, NULL, FALSE ); - tabData->tabCount = GetDlgItemInt(hWndDialog, TAB_COUNT, NULL, FALSE ); - tabData->paneBorder = GetDlgItemInt(hWndDialog, BORDER_WIDTH, NULL, FALSE ); - tabData->activeTab = GetDlgItemInt(hWndDialog, ACTIVE_TAB, NULL, FALSE ); + tabData->tabWidth = GetDlgItemInt( hWndDialog, TAB_WIDTH, nullptr, FALSE ); + tabData->tabHeight = GetDlgItemInt(hWndDialog, TAB_HEIGHT, nullptr, FALSE ); + tabData->tabCount = GetDlgItemInt(hWndDialog, TAB_COUNT, nullptr, FALSE ); + tabData->paneBorder = GetDlgItemInt(hWndDialog, BORDER_WIDTH, nullptr, FALSE ); + tabData->activeTab = GetDlgItemInt(hWndDialog, ACTIVE_TAB, nullptr, FALSE ); if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_0 ) ) tabData->subPaneDisabled[0] = TRUE; @@ -398,8 +398,8 @@ HWND InitTabControlPropertiesDialog( GameWindow *tabControl ) (LPCTSTR)TAB_CONTROL_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)tabControlPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( tabControl, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp index 2d8b21d0188..22da4b484bb 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp @@ -151,7 +151,7 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, // text entry props EntryData *entryData = (EntryData *)window->winGetUserData(); - entryData->maxTextLen = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, TRUE ); + entryData->maxTextLen = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, nullptr, TRUE ); entryData->secretText = IsDlgButtonChecked( hWndDialog, CHECK_SECRET_TEXT ); entryData->aSCIIOnly = IsDlgButtonChecked( hWndDialog, CHECK_ASCII_TEXT ); if( IsDlgButtonChecked( hWndDialog, RADIO_LETTERS_AND_NUMBERS ) ) @@ -232,8 +232,8 @@ HWND InitTextEntryPropertiesDialog( GameWindow *window ) (LPCTSTR)TEXT_ENTRY_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)textEntryPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp index fcef3393402..5b711392e8f 100644 --- a/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -74,7 +74,7 @@ const char *EditWindow::m_className = "EditWindowClass"; ///< edit window class /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -EditWindow *TheEditWindow = NULL; ///< edit window singleton +EditWindow *TheEditWindow = nullptr; ///< edit window singleton /////////////////////////////////////////////////////////////////////////////// // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -324,9 +324,9 @@ void EditWindow::registerEditWindowClass( void ) wcex.cbWndExtra = 0; wcex.hInstance = hInst; wcex.hIcon = LoadIcon( hInst, (LPCTSTR)IDI_GUIEDIT ); - wcex.hCursor = NULL; //LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = nullptr; //LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); - wcex.lpszMenuName = NULL; + wcex.lpszMenuName = nullptr; wcex.lpszClassName = m_className; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); @@ -352,15 +352,15 @@ EditWindow::EditWindow( void ) m_size.x = 0; m_size.y = 0; m_bitDepth = 32; - m_editWindowHWnd = NULL; - m_assetManager = NULL; - m_2DRender = NULL; + m_editWindowHWnd = nullptr; + m_assetManager = nullptr; + m_2DRender = nullptr; m_w3dInitialized = FALSE; m_popupMenuClickPos.x = 0; m_popupMenuClickPos.y = 0; - m_pickedWindow = NULL; + m_pickedWindow = nullptr; m_dragMoveOrigin.x = 0; m_dragMoveOrigin.y = 0; @@ -374,7 +374,7 @@ EditWindow::EditWindow( void ) m_selectRegion.hi.y = 0; m_resizingWindow = FALSE; - m_windowToResize = NULL; + m_windowToResize = nullptr; m_resizeOrigin.x = 0; m_resizeOrigin.y = 0; m_resizeDest.x = 0; @@ -447,9 +447,9 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) clientRect.right - clientRect.left, // width clientRect.bottom - clientRect.top, // height, TheEditor->getWindowHandle(), // parent - NULL, // menu + nullptr, // menu TheEditor->getInstance(), // instance - NULL ); // creation parameters + nullptr ); // creation parameters // display the window ShowWindow( m_editWindowHWnd, SW_SHOW ); @@ -483,7 +483,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) m_w3dInitialized = TRUE; // set a timer for updating visual pulse drawing - SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, NULL ); + SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, nullptr ); } @@ -495,12 +495,12 @@ void EditWindow::shutdown( void ) // delete 2d renderer delete m_2DRender; - m_2DRender = NULL; + m_2DRender = nullptr; // delete asset manager m_assetManager->Free_Assets(); delete m_assetManager; - m_assetManager = NULL; + m_assetManager = nullptr; // shutdown WW3D WW3D::Shutdown(); @@ -508,12 +508,12 @@ void EditWindow::shutdown( void ) // delete the w3d file system delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; // destroy the edit window if( m_editWindowHWnd ) DestroyWindow( m_editWindowHWnd ); - m_editWindowHWnd = NULL; + m_editWindowHWnd = nullptr; // unregister our edit window class UnregisterClass( m_className, TheEditor->getInstance() ); @@ -625,9 +625,9 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // the edit window just make sure all our drag and drop stuff is // clear in the hierarchy // - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); if( TheEditor->getMode() == MODE_DRAG_MOVE ) { @@ -678,7 +678,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // if( TheEditor->getMode() == MODE_DRAG_MOVE && TheEditor->selectionCount() == 1 && - TheHierarchyView->getPopupTarget() != NULL ) + TheHierarchyView->getPopupTarget() != nullptr ) break; // @@ -789,7 +789,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, TheEditor->dragMoveSelectedWindows( &m_dragMoveOrigin, &m_dragMoveDest ); // release capture - SetCapture( NULL ); + SetCapture( nullptr ); // go back to normal mode TheEditor->setMode( MODE_EDIT ); @@ -930,7 +930,7 @@ Bool EditWindow::inCornerTolerance( ICoord2D *dest, ICoord2D *source, IRegion2D region; // sanity - if( dest == NULL || source == NULL ) + if( dest == nullptr || source == nullptr ) return FALSE; /// @todo we should write PointInRegion() stuff again like it was in Nox @@ -963,7 +963,7 @@ Bool EditWindow::inLineTolerance( ICoord2D *dest, IRegion2D region; // sanity - if( dest == NULL || lineStart == NULL || lineEnd == NULL ) + if( dest == nullptr || lineStart == nullptr || lineEnd == nullptr ) return FALSE; // setup region @@ -1116,7 +1116,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) { // end recursion - if( windowList == NULL ) + if( windowList == nullptr ) return; // draw outline for this window @@ -1152,7 +1152,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) { // end recursion - if( windowList == NULL ) + if( windowList == nullptr ) return; // @@ -1415,7 +1415,7 @@ void EditWindow::drawGrid( void ) { TheDisplay->drawLine( 0, y, m_size.x, y, 1, color ); -// MoveToEx( hdc, 0, y, NULL ); +// MoveToEx( hdc, 0, y, nullptr ); // LineTo( hdc, m_size.x, y ); } @@ -1424,7 +1424,7 @@ void EditWindow::drawGrid( void ) { TheDisplay->drawLine( x, 0, x, m_size.y, 1, color ); -// MoveToEx( hdc, x, 0, NULL ); +// MoveToEx( hdc, x, 0, nullptr ); // LineTo( hdc, x, m_size.y ); } @@ -1436,7 +1436,7 @@ void EditWindow::drawGrid( void ) for( x = 0; x < m_size.x; x += res ) { - MoveToEx( hdc, x, y, NULL ); + MoveToEx( hdc, x, y, nullptr ); LineTo( hdc, x + 1, y + 1 ); // TheDisplay->drawLine( x, y, x + 1, y + 1, 1, 0xFFFFFFFF ); @@ -1545,7 +1545,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) screen.x = x; screen.y = y; ClientToScreen( m_editWindowHWnd, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, m_editWindowHWnd, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, m_editWindowHWnd, nullptr ); // save the location click for the creation of the popup menu m_popupMenuClickPos.x = x; @@ -1619,7 +1619,7 @@ void EditWindow::drawImage( const Image *image, { // sanity - if( image == NULL ) + if( image == nullptr ) return; const Region2D *uv = image->getUV(); @@ -1738,7 +1738,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // check to see if the resizing window was deleted @@ -1746,7 +1746,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) { // get back to normal mode and clean up - m_windowToResize = NULL; + m_windowToResize = nullptr; m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); @@ -1754,7 +1754,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) // null out picked window if needed if( m_pickedWindow == window ) - m_pickedWindow = NULL; + m_pickedWindow = nullptr; // // go back to edit mode, this keeps us from staying in a resize mode diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 2faba87eaf7..150c5cf44f8 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -105,7 +105,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// -GUIEdit *TheEditor = NULL; +GUIEdit *TheEditor = nullptr; // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -127,31 +127,31 @@ char *GUIEdit::saveAsDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = m_appHWnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "wnd"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetSaveFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -169,31 +169,31 @@ char *GUIEdit::openDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = m_appHWnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "wnd"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetOpenFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -297,8 +297,8 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) - return NULL; + if( window == nullptr ) + return nullptr; // search the list entry = m_selectList; @@ -313,7 +313,7 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) } - return NULL; // not found + return nullptr; // not found } @@ -365,7 +365,7 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) ICoord2D origin, size; // sanity - if( region == NULL ) + if( region == nullptr ) return; // unselect everything selected @@ -412,18 +412,18 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) GUIEdit::GUIEdit( void ) { - m_appInst = 0; - m_appHWnd = NULL; - m_statusBarHWnd = NULL; - m_toolbarHWnd = NULL; + m_appInst = nullptr; + m_appHWnd = nullptr; + m_statusBarHWnd = nullptr; + m_toolbarHWnd = nullptr; m_unsaved = FALSE; m_mode = MODE_UNDEFINED; strcpy( m_savePathAndFilename, "" ); strcpy( m_saveFilename, "" ); - m_selectList = NULL; - m_propertyTarget = NULL; + m_selectList = nullptr; + m_propertyTarget = nullptr; m_gridVisible = TRUE; m_snapToGrid = TRUE; @@ -446,14 +446,14 @@ GUIEdit::GUIEdit( void ) GUIEdit::~GUIEdit( void ) { delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; + TheHeaderTemplateManager = nullptr; delete TheGameText; - TheGameText = NULL; + TheGameText = nullptr; // delete the IME Manager // delete TheIMEManager; -// TheIMEManager = NULL; +// TheIMEManager = nullptr; // all the shutdown routine shutdown(); @@ -629,80 +629,80 @@ void GUIEdit::shutdown( void ) // delete the display delete TheDisplay; - TheDisplay = NULL; + TheDisplay = nullptr; // delete all windows properly in the editor deleteAllWindows(); // delete the mouse delete TheMouse; - TheMouse = NULL; - TheWin32Mouse = NULL; + TheMouse = nullptr; + TheWin32Mouse = nullptr; delete ThePlayerList; - ThePlayerList = NULL; + ThePlayerList = nullptr; delete TheRankInfoStore; - TheRankInfoStore = NULL; + TheRankInfoStore = nullptr; // delete the window manager delete TheWindowManager; - TheWindowManager = NULL; - TheGUIEditWindowManager = NULL; + TheWindowManager = nullptr; + TheGUIEditWindowManager = nullptr; // delete display string manager delete TheDisplayStringManager; - TheDisplayStringManager = NULL; + TheDisplayStringManager = nullptr; // delete image collection delete TheMappedImageCollection; - TheMappedImageCollection = NULL; + TheMappedImageCollection = nullptr; // delete the font library delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; delete TheCommandList; - TheCommandList = NULL; + TheCommandList = nullptr; delete TheMessageStream; - TheMessageStream = NULL; + TheMessageStream = nullptr; // delete the function lexicon delete TheFunctionLexicon; - TheFunctionLexicon = NULL; + TheFunctionLexicon = nullptr; // delete name key generator delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; delete TheGlobalLanguageData; - TheGlobalLanguageData = NULL; + TheGlobalLanguageData = nullptr; // delete file system delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheLocalFileSystem; - TheLocalFileSystem = NULL; + TheLocalFileSystem = nullptr; delete TheArchiveFileSystem; - TheArchiveFileSystem = NULL; + TheArchiveFileSystem = nullptr; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // delete the hierarchy view delete TheHierarchyView; - TheHierarchyView = NULL; + TheHierarchyView = nullptr; // destroy the edit window delete TheEditWindow; - TheEditWindow = NULL; + TheEditWindow = nullptr; delete TheKeyboard; - TheKeyboard = NULL; + TheKeyboard = nullptr; } @@ -744,7 +744,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_LOG(( "writeConfigFile: Unable to open file '%s'", filename )); @@ -799,7 +799,7 @@ Bool GUIEdit::readConfigFile( const char *filename ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return TRUE; // version @@ -863,12 +863,12 @@ void GUIEdit::readFontFile( const char *filename ) FILE *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return; // read how many entries follow @@ -905,7 +905,7 @@ void GUIEdit::readFontFile( const char *filename ) // set the font GameFont *font = TheFontLibrary->getFont( AsciiString(fontBuffer), size, bold ); - if( font == NULL ) + if( font == nullptr ) { char buffer[ 1024 ]; @@ -931,12 +931,12 @@ void GUIEdit::writeFontFile( const char *filename ) FILE *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) return; // dont bother making an error, it's likely to be read only a lot // available fonts @@ -1116,7 +1116,7 @@ void GUIEdit::setCursor( CursorType type ) } // set the new cursor - SetCursor( LoadCursor( NULL, identifier ) ); + SetCursor( LoadCursor( nullptr, identifier ) ); } @@ -1212,7 +1212,7 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) { GameWindow *window; - GameWindow *pick = NULL; + GameWindow *pick = nullptr; IRegion2D region; for( window = TheWindowManager->winGetWindowList(); @@ -1314,9 +1314,9 @@ void GUIEdit::clipCreationParamsToParent( GameWindow *parent, newWidth, newHeight; // sanity - if( parent == NULL || - x == NULL || y == NULL || - width == NULL || height == NULL ) + if( parent == nullptr || + x == nullptr || y == nullptr || + width == nullptr || height == nullptr ) return; // get parent screen region and size @@ -1388,7 +1388,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) { // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // @@ -1402,7 +1402,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) // take this out of the property target if present if( m_propertyTarget == window ) - m_propertyTarget = NULL; + m_propertyTarget = nullptr; // notify the edit window this is going away TheEditWindow->notifyWindowDeleted( window ); @@ -1443,7 +1443,7 @@ GameWindow *GUIEdit::newWindow( UnsignedInt windowStyle, Int x, Int y, Int width, Int height ) { - GameWindow *window = NULL; + GameWindow *window = nullptr; // create the appropriate window based on style bit passed in switch( windowStyle ) @@ -1532,7 +1532,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // // if there is a parent present we need to translate the screen x and y @@ -1545,7 +1545,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, window = TheWindowManager->winCreate( parent, status, x, y, width, height, - NULL, NULL ); + nullptr, nullptr ); // a window created in the editor here is a user window WinInstanceData *instData = window->winGetInstanceData(); @@ -1591,7 +1591,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep the button inside a parent if present if( parent ) @@ -1606,7 +1606,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); @@ -1683,7 +1683,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1700,7 +1700,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -1789,7 +1789,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1808,7 +1808,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, width, height, &instData, &radioData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -1897,7 +1897,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1922,7 +1922,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, width, height, &instData, &tabControlData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2095,7 +2095,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2120,7 +2120,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, width, height, &instData, &sliderData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2216,7 +2216,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2241,7 +2241,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, width, height, &instData, &sliderData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2337,7 +2337,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2353,7 +2353,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2472,7 +2472,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2518,8 +2518,8 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, comboData->listboxData->multiSelect = 0; comboData->listboxData->forceSelect = 1; comboData->listboxData->columns = 1; - comboData->listboxData->columnWidth = NULL; - comboData->listboxData->columnWidthPercentage = NULL; + comboData->listboxData->columnWidth = nullptr; + comboData->listboxData->columnWidthPercentage = nullptr; //create the control window = TheWindowManager->gogoGadgetComboBox( parent, @@ -2528,7 +2528,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, width, height, &instData, comboData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2887,7 +2887,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2908,8 +2908,8 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, listData.multiSelect = 0; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; - listData.columnWidthPercentage = NULL; + listData.columnWidth = nullptr; + listData.columnWidthPercentage = nullptr; // make control window = TheWindowManager->gogoGadgetListBox( parent, @@ -2918,7 +2918,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, width, height, &instData, &listData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3150,7 +3150,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -3173,7 +3173,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, width, height, &instData, &entryData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3256,7 +3256,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -3279,7 +3279,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, width, height, &instData, &textData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3531,7 +3531,7 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) { // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // strip off this name if present @@ -3574,7 +3574,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // if this is a user window, set the default callbacks @@ -3645,7 +3645,7 @@ Bool GUIEdit::menuOpen( void ) filePath = openDialog(); // if no filename came back they cancelled this operation - if( filePath == NULL ) + if( filePath == nullptr ) return FALSE; // file not opened // @@ -3739,7 +3739,7 @@ Bool GUIEdit::menuSaveAs( void ) filePath = saveAsDialog(); // if no filename came back they cancelled this operation - if( filePath == NULL ) + if( filePath == nullptr ) return FALSE; // save not done // OK, save the filename we're going to use @@ -3774,7 +3774,7 @@ Bool GUIEdit::menuCopy( void ) // trivial case, nothing selected select = getSelectList(); - if( select == NULL ) + if( select == nullptr ) { MessageBox( m_appHWnd, "You must have windows selected before you can copy them.", @@ -3813,7 +3813,7 @@ Bool GUIEdit::menuCut( void ) // trivial case, nothing selected select = getSelectList(); - if( select == NULL ) + if( select == nullptr ) { MessageBox( m_appHWnd, "You must have windows selected before you can cut.", @@ -3844,7 +3844,7 @@ Bool GUIEdit::isWindowSelected( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return FALSE; // find entry @@ -3864,7 +3864,7 @@ void GUIEdit::selectWindow( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return; // do not add to list if already on it @@ -3873,7 +3873,7 @@ void GUIEdit::selectWindow( GameWindow *window ) // allocate new entry and add to list entry = new WindowSelectionEntry; - if( entry == NULL ) + if( entry == nullptr ) { DEBUG_LOG(( "Unable to allocate selection entry for window" )); @@ -3884,7 +3884,7 @@ void GUIEdit::selectWindow( GameWindow *window ) // fill out information and tie to head of list entry->window = window; - entry->prev = NULL; + entry->prev = nullptr; entry->next = m_selectList; if( m_selectList ) m_selectList->prev = entry; @@ -3904,7 +3904,7 @@ void GUIEdit::unSelectWindow( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return; // find entry @@ -3968,7 +3968,7 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) { // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // @@ -4012,7 +4012,7 @@ void GUIEdit::deleteSelected( void ) // of the select list and delete those // deleteList = new GameWindow *[ count ]; - if( deleteList == NULL ) + if( deleteList == nullptr ) { DEBUG_LOG(( "Cannot allocate delete list!" )); @@ -4055,7 +4055,7 @@ void GUIEdit::bringSelectedToTop( void ) // GameWindow **snapshot; snapshot = new GameWindow *[ count ]; - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_LOG(( "bringSelectedToTop: Unabled to allocate selectList" )); @@ -4101,7 +4101,7 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, ICoord2D origin; // sanity - if( dragOrigin == NULL || dragDest == NULL ) + if( dragOrigin == nullptr || dragDest == nullptr ) return; // traverse selection list @@ -4154,7 +4154,7 @@ GameWindow *GUIEdit::getFirstSelected( void ) if( m_selectList ) return m_selectList->window; - return NULL; + return nullptr; } @@ -4333,8 +4333,8 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, Int sizeLimit = 5; // sanity - if( window == NULL || resizeOrigin == NULL || resizeDest == NULL || - resultLoc == NULL || resultSize == NULL ) + if( window == nullptr || resizeOrigin == nullptr || resizeDest == nullptr || + resultLoc == nullptr || resultSize == nullptr ) return; // get the current position and size of the window @@ -4534,7 +4534,7 @@ Bool GUIEdit::windowIsGadget( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return FALSE; return BitIsSet( window->winGetStyle(), GWS_GADGET_WINDOW ); @@ -4549,7 +4549,7 @@ void GUIEdit::gridSnapLocation( ICoord2D *source, ICoord2D *snapped ) { // sanity - if( source == NULL || snapped == NULL ) + if( source == nullptr || snapped == nullptr ) return; snapped->x = (source->x / m_gridResolution) * m_gridResolution; @@ -4565,7 +4565,7 @@ void GUIEdit::checkMenuItem( Int item ) HMENU menu = GetMenu( m_appHWnd ); // sanity - if( menu == NULL ) + if( menu == nullptr ) return; // check it @@ -4581,7 +4581,7 @@ void GUIEdit::unCheckMenuItem( Int item ) HMENU menu = GetMenu( m_appHWnd ); // sanity - if( menu == NULL ) + if( menu == nullptr ) return; // check it @@ -4599,7 +4599,7 @@ Bool GUIEdit::isNameDuplicate( GameWindow *root, GameWindow *ignore, AsciiString WinInstanceData *instData; // end of recursion, sanity for name, and empty name ("") is always OK - if( root == NULL || name.isEmpty() ) + if( root == nullptr || name.isEmpty() ) return FALSE; // name is a-ok! :) // get instance data @@ -4628,7 +4628,7 @@ void GUIEdit::loadGUIEditFontLibrary( FontLibrary *library ) { // sanity - if( library == NULL ) + if( library == nullptr ) return; AsciiString fixedSys("FixedSys"); diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index 8e00fe565fe..cc2c8989e62 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -43,7 +43,7 @@ #include "HierarchyView.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GUIEditWindowManager *TheGUIEditWindowManager = NULL; ///< editor use only +GUIEditWindowManager *TheGUIEditWindowManager = nullptr; ///< editor use only /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -59,7 +59,7 @@ Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, GameWindow *other; // sanity - if( list == NULL || window == NULL ) + if( list == nullptr || window == nullptr ) return FALSE; // just run through the window list in the clipboard to check @@ -83,14 +83,14 @@ void GUIEditWindowManager::linkToClipboard( GameWindow *window, { // sanity - if( window == NULL || list == NULL ) + if( window == nullptr || list == nullptr ) return; // debug sanity checking, can't add if already in it if( isWindowInClipboard( window, list ) ) return; - window->winSetPrev( NULL ); + window->winSetPrev( nullptr ); window->winSetNext( *list ); if( *list ) (*list)->winSetPrev( window ); @@ -107,7 +107,7 @@ void GUIEditWindowManager::unlinkFromClipboard( GameWindow *window, GameWindow *next, *prev; // sanity - if( window == NULL || list == NULL ) + if( window == nullptr || list == nullptr ) return; // debug sanity checking, can't remove if not in @@ -197,7 +197,7 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) window->winGetScreenPosition( &pos.x, &pos.y ); // remove the child from the parent and add to top level of window system - window->winSetParent( NULL ); + window->winSetParent( nullptr ); // // adjust the position, which previously was relative to the parent @@ -221,8 +221,8 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) GUIEditWindowManager::GUIEditWindowManager( void ) { - m_clipboard = NULL; - m_clipboardDup = NULL; + m_clipboard = nullptr; + m_clipboardDup = nullptr; m_copySpacing = 8; m_numCopiesPasted = 0; @@ -235,7 +235,7 @@ GUIEditWindowManager::~GUIEditWindowManager( void ) { // the duplicate list is only used in the actual act of pasting - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); // free all data on the clipboard resetClipboard(); @@ -271,8 +271,8 @@ Int GUIEditWindowManager::winDestroy( GameWindow *window ) // delete it delete editData; - // set the edit data to NULL in the window - window->winSetEditData( NULL ); + // set the edit data to null in the window + window->winSetEditData( nullptr ); } @@ -351,7 +351,7 @@ void GUIEditWindowManager::resetClipboard( void ) processDestroyList(); // nothing in the buffer now - m_clipboard = NULL; + m_clipboard = nullptr; m_numCopiesPasted = 0; } @@ -407,7 +407,7 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) { // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // if widow is selected duplicate and continue on @@ -416,7 +416,7 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) GameWindow *duplicate; // perform the duplication of window and all children - duplicate = duplicateWindow( root, NULL ); + duplicate = duplicateWindow( root, nullptr ); if( duplicate ) { @@ -608,7 +608,7 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) Int sanityLoop = 0; // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // get our inst data @@ -663,10 +663,10 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) void GUIEditWindowManager::pasteClipboard( void ) { GameWindow *window, *next; - GameWindow *firstWindow = NULL; + GameWindow *firstWindow = nullptr; // check for empty clipboard - if( m_clipboard == NULL ) + if( m_clipboard == nullptr ) { MessageBox( TheEditor->getWindowHandle(), @@ -678,7 +678,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } // create a duplicate of everything in the clipboard - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); createClipboardDuplicate(); // @@ -729,7 +729,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } // the clipboard duplicate list is only for the act of pasting - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); // we've now completed another successful copy pasted in m_numCopiesPasted++; @@ -784,15 +784,15 @@ void InstDrawCopy ( WinInstanceData *instData, WinInstanceData *sourceInstData) GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, GameWindow *parent ) { - GameWindow *duplicate = NULL; + GameWindow *duplicate = nullptr; UnsignedInt style, status; WinInstanceData *instData; WinInstanceData instDataCopy; ICoord2D pos, size; // sanity - if( source == NULL ) - return NULL; + if( source == nullptr ) + return nullptr; // get the window instance data and make a copy of it for creating new stuff instData = source->winGetInstanceData(); @@ -803,8 +803,8 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // do NOT copy the display string instances, these MUST be allocated when // needed in real windows // - instDataCopy.m_text = NULL; - instDataCopy.m_tooltip = NULL; + instDataCopy.m_text = nullptr; + instDataCopy.m_tooltip = nullptr; // get a few properties we're going to need style = source->winGetStyle(); @@ -1128,7 +1128,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, } } else - listDataCopy.columnWidth = NULL; + listDataCopy.columnWidth = nullptr; if(listData->columnWidthPercentage) { @@ -1139,7 +1139,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, } } else - listDataCopy.columnWidthPercentage = NULL; + listDataCopy.columnWidthPercentage = nullptr; duplicate = TheWindowManager->gogoGadgetListBox( parent, @@ -1325,7 +1325,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, pos.y, size.x, size.y, - NULL, + nullptr, &instDataCopy ); } @@ -1337,19 +1337,19 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, "Internal Error", MB_OK ); assert( 0 ); memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below - return NULL; + return nullptr; } // sanity - if( duplicate == NULL ) + if( duplicate == nullptr ) { MessageBox( TheEditor->getWindowHandle(), "Unable to duplicate window", "Internal Error", MB_OK ); assert( 0 ); memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below - return NULL; + return nullptr; } @@ -1361,7 +1361,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // but that is totally isolated in the parent so that's OK and // necessary. // - if( parent == NULL ) + if( parent == nullptr ) unlinkWindow( duplicate ); // copy edit data, only for the editor @@ -1416,7 +1416,7 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) // find last window in clipboard lastWindow = m_clipboard; - while( lastWindow && lastWindow->winGetNext() != NULL ) + while( lastWindow && lastWindow->winGetNext() != nullptr ) lastWindow = lastWindow->winGetNext(); // @@ -1428,7 +1428,7 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) { // duplicate the window and all its children - duplicate = duplicateWindow( window, NULL ); + duplicate = duplicateWindow( window, nullptr ); // add duplicate to list if( duplicate ) @@ -1446,18 +1446,18 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, { // sanity - if( target == NULL ) + if( target == nullptr ) return; // get target parent GameWindow *prevParent = target->winGetParent(); // check for no parent - if( parent == NULL ) + if( parent == nullptr ) { // if target already has no parent nothing to do - if( prevParent == NULL ) + if( prevParent == nullptr ) return; // @@ -1538,7 +1538,7 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, { // sanity - if( windowToMove == NULL || aheadOf == NULL || windowToMove == aheadOf ) + if( windowToMove == nullptr || aheadOf == nullptr || windowToMove == aheadOf ) return; // diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index c28bdbb1bb1..4e86ad9c8ee 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -70,7 +70,7 @@ static ICoord2D dialogSize; // PUBLIC DATA //////////////////////////////////////////////////////////////// -HierarchyView *TheHierarchyView = NULL; ///< the view singleton +HierarchyView *TheHierarchyView = nullptr; ///< the view singleton // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -186,9 +186,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // use the "no" cursor // if( TheHierarchyView->validateDragDropOperation( dragWindow, target ) ) - SetCursor( LoadCursor( NULL, IDC_CROSS ) ); + SetCursor( LoadCursor( nullptr, IDC_CROSS ) ); else - SetCursor( LoadCursor( NULL, IDC_NO ) ); + SetCursor( LoadCursor( nullptr, IDC_NO ) ); } @@ -225,7 +225,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // get the node info from the tree item we're over overItemInfo.hItem = overItem; - overItemInfo.lParam = NULL; + overItemInfo.lParam = 0; overItemInfo.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( TheHierarchyView->getTreeHandle(), &overItemInfo ); overWindow = (GameWindow *)overItemInfo.lParam; @@ -259,7 +259,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, screen.x = x; screen.y = y; ClientToScreen( hWndDialog, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); // // do not reset the drag window, and set the target window as @@ -289,8 +289,8 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, if( clearDragWindow ) { - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); } @@ -298,7 +298,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ReleaseCapture(); // set the cursor back to normal - SetCursor( LoadCursor( NULL, IDC_ARROW ) ); + SetCursor( LoadCursor( nullptr, IDC_ARROW ) ); } @@ -349,7 +349,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, screen.x = x; screen.y = y; ClientToScreen( hWndDialog, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); } @@ -433,7 +433,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, menu = LoadMenu( TheEditor->getInstance(), (LPCTSTR)HIERARCHY_POPUP_MENU ); subMenu = GetSubMenu( menu, 0 ); GetCursorPos( &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); } @@ -452,7 +452,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // save the window being dragged TheHierarchyView->setDragWindow( (GameWindow *)newItem.lParam ); - TheHierarchyView->setDragTarget( NULL ); + TheHierarchyView->setDragTarget( nullptr ); // capture the mouse SetCapture( TheHierarchyView->getHierarchyHandle() ); @@ -492,9 +492,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheGUIEditWindowManager->moveAheadOf( drag, target ); // we're done with the drag and popup ops now - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); break; @@ -511,9 +511,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheGUIEditWindowManager->makeChildOf( drag, target ); // we're done with the drag and popup ops now - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); break; @@ -525,7 +525,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, GameWindow *target = TheHierarchyView->getPopupTarget(); // sanity - if( target == NULL ) + if( target == nullptr ) break; // @@ -607,13 +607,13 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) { // end of recursion - if( node == NULL || window == NULL ) - return NULL; + if( node == nullptr || window == nullptr ) + return nullptr; // is it in this node TVITEM item; item.hItem = node; - item.lParam = NULL; + item.lParam = 0; item.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( m_tree, &item ); if( (GameWindow *)item.lParam == window ) @@ -621,7 +621,7 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) // not there, check our children HTREEITEM child; - HTREEITEM found = NULL; + HTREEITEM found = nullptr; for( child = TreeView_GetNextItem( m_tree, node, TVGN_CHILD ); child; child = TreeView_GetNextItem( m_tree, child, TVGN_NEXT ) ) @@ -647,8 +647,8 @@ HTREEITEM HierarchyView::findTreeEntry( GameWindow *window ) { // no-op - if( window == NULL ) - return NULL; + if( window == nullptr ) + return nullptr; // get root and search from there return findItemEntry( TreeView_GetRoot( m_tree ), window ); @@ -664,15 +664,15 @@ void HierarchyView::addWindowToTree( GameWindow *window, Bool addChildren, Bool addSiblings ) { - HTREEITEM newItem = NULL; + HTREEITEM newItem = nullptr; // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // add only if not in tree already newItem = findTreeEntry( window ); - if( newItem == NULL ) + if( newItem == nullptr ) { // setup insert struct @@ -695,7 +695,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, newItem = TreeView_InsertItem( m_tree, &insert ); // sanity - if( newItem == NULL ) + if( newItem == nullptr ) { DEBUG_LOG(( "Error adding window to tree" )); @@ -736,13 +736,13 @@ void HierarchyView::addWindowToTree( GameWindow *window, HierarchyView::HierarchyView( void ) { - m_dialog = NULL; - m_tree = NULL; + m_dialog = nullptr; + m_tree = nullptr; dialogPos.x = dialogPos.y = 0; dialogSize.x = dialogSize.y = 0; - m_dragWindow = NULL; - m_dragTarget = NULL; - m_popupTarget = NULL; + m_dragWindow = nullptr; + m_dragTarget = nullptr; + m_popupTarget = nullptr; } @@ -820,8 +820,8 @@ void HierarchyView::shutdown( void ) // destroy the control palette window DestroyWindow( m_dialog ); - m_dialog = NULL; - m_tree = NULL; + m_dialog = nullptr; + m_tree = nullptr; } @@ -837,7 +837,7 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) strcpy( buffer, "" ); // sanity - if( window == NULL ) + if( window == nullptr ) return buffer; // no name available, construct one based on type @@ -892,14 +892,14 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) { // sanity - if( window == NULL || m_dialog == NULL ) + if( window == nullptr || m_dialog == nullptr ) return; // do not add again if already in the tree - if( findTreeEntry( window ) != NULL ) + if( findTreeEntry( window ) != nullptr ) return; - // get the parent tree entry to this window, NULL if no parent + // get the parent tree entry to this window, nullptr if no parent GameWindow *parent = window->winGetParent(); HTREEITEM parentItem = findTreeEntry( parent ); @@ -910,7 +910,7 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) // force the tree control to redraw, it seems to have problems updating // the plus signs, lame ass Microsoft // - InvalidateRect( m_tree, NULL, TRUE ); + InvalidateRect( m_tree, nullptr, TRUE ); } @@ -922,26 +922,26 @@ void HierarchyView::removeWindow( GameWindow *window ) HTREEITEM item; // sanity - if( window == NULL ) + if( window == nullptr ) return; // if this window is the drag window clean that mode up if( window == m_dragWindow ) - m_dragWindow = NULL; + m_dragWindow = nullptr; // clean up drag target if( window == m_dragTarget ) - m_dragTarget = NULL; + m_dragTarget = nullptr; // if this window is the popup target remove it if( window == m_popupTarget ) - m_popupTarget = NULL; + m_popupTarget = nullptr; // find this entry in the tree item = findTreeEntry( window ); // if not in tree nothing to do - if( item == NULL ) + if( item == nullptr ) return; // remove it from the tree @@ -957,12 +957,12 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // find this window entry HTREEITEM item = findTreeEntry( window ); - if( item == NULL ) + if( item == nullptr ) { DEBUG_LOG(( "Cannot bring window to top, no entry in tree!" )); @@ -990,12 +990,12 @@ void HierarchyView::updateWindowName( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get the tree entry HTREEITEM item = findTreeEntry( window ); - if( item == NULL ) + if( item == nullptr ) { DEBUG_LOG(( "updateWindowName: No hierarchy entry for window!" )); @@ -1022,7 +1022,7 @@ void HierarchyView::getDialogPos( ICoord2D *pos ) { // sanity - if( pos == NULL ) + if( pos == nullptr ) return; *pos = dialogPos; @@ -1036,7 +1036,7 @@ void HierarchyView::getDialogSize( ICoord2D *size ) { // sanity - if( size == NULL ) + if( size == nullptr ) return; *size = dialogSize; @@ -1082,14 +1082,14 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get the window hierarchy entry removeWindow( window ); - // we'll say and aheadOf of NULL means put at the top - if( aheadOf == NULL ) + // we'll say and aheadOf of null means put at the top + if( aheadOf == nullptr ) { addWindow( window, HIERARCHY_ADD_AT_TOP ); @@ -1099,7 +1099,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, // get the hierarchy item of the aheadOf window HTREEITEM aheadOfItem = findTreeEntry( aheadOf ); - if( aheadOfItem == NULL ) + if( aheadOfItem == nullptr ) { DEBUG_LOG(( "moveWindowAheadOf: aheadOf has no hierarchy entry!" )); @@ -1110,13 +1110,13 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, // // get the parent item we will be inserting the new entry at, a parent - // of NULL is OK and will put it at the root of the tree + // of nullptr is OK and will put it at the root of the tree // HTREEITEM parentItem = TreeView_GetNextItem( m_tree, aheadOfItem, TVGN_PARENT ); // // get the item that we will be inserting after (just previous to - // 'aheadOfItem' ... this can also be NULL for putting at the head + // 'aheadOfItem' ... this can also be null for putting at the head // HTREEITEM prevItem = TreeView_GetNextItem( m_tree, aheadOfItem, TVGN_PREVIOUS ); @@ -1124,7 +1124,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, TVINSERTSTRUCT insert; insert.itemex.mask = TVIF_TEXT | TVIF_PARAM; insert.hParent = parentItem; - if( prevItem == NULL ) + if( prevItem == nullptr ) insert.hInsertAfter = TVI_FIRST; else insert.hInsertAfter = prevItem; @@ -1135,7 +1135,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, HTREEITEM newItem = TreeView_InsertItem( m_tree, &insert ); // sanity - if( newItem == NULL ) + if( newItem == nullptr ) { DEBUG_LOG(( "moveWindowAheadOf: Error adding window to tree" )); @@ -1166,14 +1166,14 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // remvoe the window from the hierarchy removeWindow( window ); - // if parent is NULL we'll put at top of list - if( parent == NULL ) + // if parent is nullptr we'll put at top of list + if( parent == nullptr ) { addWindow( window, HIERARCHY_ADD_AT_TOP ); @@ -1183,7 +1183,7 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) // find the entry of the parent HTREEITEM parentItem = findTreeEntry( parent ); - if( parentItem == NULL ) + if( parentItem == nullptr ) { DEBUG_LOG(( "moveWindowChildOf: No parent entry" )); @@ -1209,7 +1209,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) TVHITTESTINFO hitTest; hitTest.pt.x = x; hitTest.pt.y = y; - hitTest.hItem = NULL; + hitTest.hItem = nullptr; hitTest.flags = TVHT_ONITEM; return TreeView_HitTest( getTreeHandle(), &hitTest ); @@ -1223,15 +1223,15 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) { // sanity - if( treeItem == NULL ) - return NULL; + if( treeItem == nullptr ) + return nullptr; // get the node info from the tree item we're over TVITEM itemInfo; GameWindow *window; itemInfo.hItem = treeItem; - itemInfo.lParam = NULL; + itemInfo.lParam = 0; itemInfo.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( m_tree, &itemInfo ); window = (GameWindow *)itemInfo.lParam; @@ -1246,13 +1246,13 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) //============================================================================= void HierarchyView::selectWindow( GameWindow *window ) { - HTREEITEM item = NULL; + HTREEITEM item = nullptr; // get the item associated with the window if( window ) item = findTreeEntry( window ); - // select the item, or no item NULL will select nothing + // select the item, or no item nullptr will select nothing TreeView_SelectItem( m_tree, item ); TreeView_Expand( m_tree, item, 0 ); @@ -1268,7 +1268,7 @@ Bool HierarchyView::validateDragDropOperation( GameWindow *source, { // sanity - if( source == NULL || target == NULL ) + if( source == nullptr || target == nullptr ) return FALSE; // if target is the source or is a child of source in any way this is illegal diff --git a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index 9ede862b0f7..28f5ebc6204 100644 --- a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -78,12 +78,12 @@ /////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -static LayoutScheme *theScheme = NULL; +static LayoutScheme *theScheme = nullptr; /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -LayoutScheme *TheDefaultScheme = NULL; +LayoutScheme *TheDefaultScheme = nullptr; // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -207,31 +207,31 @@ char *saveAsDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "ls"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetSaveFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -249,31 +249,31 @@ char *openDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "ls"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetOpenFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -329,7 +329,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, // layout, because this is such a large sweeping change we will // ask them if they are sure // - result = MessageBox( NULL, "This will apply these scheme color and image settings to ALL windows and gadgets currently loaded in the edit window. Are you sure you want to proceed?", + result = MessageBox( nullptr, "This will apply these scheme color and image settings to ALL windows and gadgets currently loaded in the edit window. Are you sure you want to proceed?", "Are You Sure?", MB_YESNO | MB_ICONWARNING ); if( result == IDNO ) break; @@ -441,7 +441,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // apply changes to this window @@ -1488,7 +1488,7 @@ LayoutScheme::LayoutScheme( void ) m_disabledText.borderColor = GAME_COLOR_UNDEFINED; m_hiliteText.color = GAME_COLOR_UNDEFINED; m_hiliteText.borderColor = GAME_COLOR_UNDEFINED; - m_font = NULL; + m_font = nullptr; } @@ -1507,8 +1507,8 @@ LayoutScheme::~LayoutScheme( void ) { delete [] m_imageAndColorTable[ i ].stateNameBuffer; - m_imageAndColorTable[ i ].stateNameBuffer = NULL; - m_imageAndColorTable[ i ].stateName = NULL; + m_imageAndColorTable[ i ].stateNameBuffer = nullptr; + m_imageAndColorTable[ i ].stateName = nullptr; } @@ -2129,14 +2129,14 @@ void LayoutScheme::init( void ) image = TheMappedImageCollection->findImageByName( "TabControlSevenHilite" ); storeImageAndColor( TC_TAB_7_HILITE, image, green, darkGreen ); - storeImageAndColor( TAB_CONTROL_ENABLED, NULL, black, white ); - storeImageAndColor( TAB_CONTROL_DISABLED, NULL, darkGray, white ); - storeImageAndColor( TAB_CONTROL_HILITE, NULL, black, white ); + storeImageAndColor( TAB_CONTROL_ENABLED, nullptr, black, white ); + storeImageAndColor( TAB_CONTROL_DISABLED, nullptr, darkGray, white ); + storeImageAndColor( TAB_CONTROL_HILITE, nullptr, black, white ); // generic - storeImageAndColor( GENERIC_ENABLED, NULL, darkBlue, white ); - storeImageAndColor( GENERIC_DISABLED, NULL, darkGray, white ); - storeImageAndColor( GENERIC_HILITE, NULL, lightBlue, white ); + storeImageAndColor( GENERIC_ENABLED, nullptr, darkBlue, white ); + storeImageAndColor( GENERIC_DISABLED, nullptr, darkGray, white ); + storeImageAndColor( GENERIC_HILITE, nullptr, lightBlue, white ); // default text colors m_enabledText.color = white; @@ -2163,7 +2163,7 @@ void LayoutScheme::openDialog( void ) DialogBox( TheEditor->getInstance(), (LPCTSTR)LAYOUT_SCHEME_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)layoutSchemeCallback ); - theScheme = NULL; + theScheme = nullptr; } @@ -2179,7 +2179,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) DEBUG_LOG(( "Illegal state to to layout 'findEntry' '%d'", id )); assert( 0 ); - return NULL; + return nullptr; } @@ -2192,7 +2192,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) } - return NULL; // not found + return nullptr; // not found } @@ -2208,7 +2208,7 @@ ImageAndColorInfo *LayoutScheme::getImageAndColor( StateIdentifier id ) DEBUG_LOG(( "getImageAndColor: Illegal state '%d'", id )); assert( 0 ); - return NULL; + return nullptr; } @@ -2258,7 +2258,7 @@ Bool LayoutScheme::saveScheme( char *filename ) // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_LOG(( "saveScheme: Unable to open file '%s'", filename )); @@ -2340,7 +2340,7 @@ Bool LayoutScheme::loadScheme( char *filename ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return FALSE; // save the filename we're using now diff --git a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp index 3a85e204118..371b3d853dc 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp @@ -99,280 +99,280 @@ ColorControl colorControlTable[] = ImageAndColorInfo imageAndColorTable[] = { - { GWS_PUSH_BUTTON, BUTTON_ENABLED, "[Button] Enabled (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_ENABLED_PUSHED, "[Button] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_DISABLED, "[Button] Disabled (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_DISABLED_PUSHED, "[Button] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_HILITE, "[Button] Hilite (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_HILITE_PUSHED, "[Button] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_RADIO_BUTTON, RADIO_ENABLED, "[Radio] Enabled Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_ENABLED_UNCHECKED_BOX, "[Radio] Enabled Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_ENABLED_CHECKED_BOX, "[Radio] Enabled Nubbin (Checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED, "[Radio] Disabled Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED_UNCHECKED_BOX, "[Radio] Disabled Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED_CHECKED_BOX, "[Radio] Disabled Nubbin (Checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE, "[Radio] Hilite Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE_UNCHECKED_BOX, "[Radio] Hilite Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE_CHECKED_BOX, "[Radio] Hilite Nubbin (Checked)", NULL, 0, 0 }, - - { GWS_CHECK_BOX, CHECK_BOX_ENABLED, "[Check Box] Enabled Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_ENABLED_UNCHECKED_BOX, "[Check Box] Enabled Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_ENABLED_CHECKED_BOX, "[Check Box] Enabled Box (Checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED, "[Check Box] Disabled Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED_UNCHECKED_BOX, "[Check Box] Disabled Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED_CHECKED_BOX, "[Check Box] Disabled Box (Checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE, "[Check Box] Hilite Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE_UNCHECKED_BOX, "[Check Box] Hilite Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE_CHECKED_BOX, "[Check Box] Hilite Box (Checked)", NULL, 0, 0 }, - - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_LEFT, "[HSlider] Enabled Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_RIGHT, "[HSlider] Enabled Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_CENTER, "[HSlider] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_SMALL_CENTER, "[HSlider] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_LEFT, "[HSlider] Disabled Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_RIGHT, "[HSlider] Disabled Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_CENTER, "[HSlider] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_SMALL_CENTER, "[HSlider] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_LEFT, "[HSlider] Hilite Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_RIGHT, "[HSlider] Hilite Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_CENTER, "[HSlider] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_SMALL_CENTER, "[HSlider] Hilite Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED, "[Thumb [HSlider]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [HSlider]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED, "[Thumb [HSlider]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [HSlider]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE, "[Thumb [HSlider]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE_PUSHED, "[Thumb [HSlider]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_VERT_SLIDER, VSLIDER_ENABLED_TOP, "[VSlider] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_BOTTOM, "[VSlider] Enabled Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_CENTER, "[VSlider] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_SMALL_CENTER, "[VSlider] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_TOP, "[VSlider] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_BOTTOM, "[VSlider] Disabled Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_CENTER, "[VSlider] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_SMALL_CENTER, "[VSlider] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_TOP, "[VSlider] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_BOTTOM, "[VSlider] Hilite Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_CENTER, "[VSlider] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_SMALL_CENTER, "[VSlider] Hilite Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED, "[Thumb [VSlider]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [VSlider]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED, "[Thumb [VSlider]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [VSlider]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE, "[Thumb [VSlider]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE_PUSHED, "[Thumb [VSlider]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED, "[Listbox] Enabled Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED, "[Listbox] Disabled Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE, "[Listbox] Hilite Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox]] Enabled Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox]] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox]] Disabled Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox]] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox]] Hilite Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox]] Hilite Repeating Small Cener", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_ENABLED, "[ComboBox] Enabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, "[ComboBox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, "[ComboBox] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED, "[ComboBox] Disabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, "[ComboBox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, "[ComboBox] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE, "[ComboBox] Hilite Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_LEFT, "[ComboBox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, "[ComboBox] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_CENTER, "[ComboBox] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED, "[Button [ComboBox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, "[Button [ComboBox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED, "[Button [ComboBox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, "[Button [ComboBox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE, "[Button [ComboBox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, "[Button [ComboBox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_LEFT, "[Text Entry [ComboBox]] Enabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_RIGHT, "[Text Entry [ComboBox]] Enabled Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_CENTER, "[Text Entry [ComboBox]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_LEFT, "[Text Entry [ComboBox]] Disabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_RIGHT, "[Text Entry [ComboBox]] Disabled Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_CENTER, "[Text Entry [ComboBox]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_LEFT, "[Text Entry [ComboBox]] Hilite Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_RIGHT, "[Text Entry [ComboBox]] Hilite Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_CENTER, "[Text Entry [ComboBox]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, "[Text Entry [ComboBox]] Hilite Small Repeating Center", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED, "[Listbox [ComboBox]] Enabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED, "[Listbox [ComboBox]] Disabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE, "[Listbox [ComboBox]] Hilite Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox [ComboBox]]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Enabled Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox [ComboBox]]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Disabled Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox [ComboBox]]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox [ComboBox]]] Hilite Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Small Cener", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - - - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_LEFT, "[Bar] Enabled Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_RIGHT, "[Bar] Enabled Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_CENTER, "[Bar] Enabled Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_SMALL_CENTER, "[Bar] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_LEFT, "[Bar] Enabled Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_RIGHT, "[Bar] Enabled Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_CENTER, "[Bar] Enabled Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, "[Bar] Enabled Fill Bar Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_LEFT, "[Bar] Disabled Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_RIGHT, "[Bar] Disabled Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_CENTER, "[Bar] Disabled Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_SMALL_CENTER, "[Bar] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_LEFT, "[Bar] Disabled Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_RIGHT, "[Bar] Disabled Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_CENTER, "[Bar] Disabled Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, "[Bar] Disabled Fill Bar Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_LEFT, "[Bar] Hilite Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_RIGHT, "[Bar] Hilite Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_CENTER, "[Bar] Hilite Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_SMALL_CENTER, "[Bar] Hilite Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_LEFT, "[Bar] Hilite Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_RIGHT, "[Bar] Hilite Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_CENTER, "[Bar] Hilite Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, "[Bar] Hilite Fill Bar Small Repeating Center", NULL, 0, 0 }, - - - { GWS_STATIC_TEXT, STATIC_TEXT_ENABLED, "[Static Text] Enabled", NULL, 0, 0 }, - { GWS_STATIC_TEXT, STATIC_TEXT_DISABLED, "[Static Text] Disabled", NULL, 0, 0 }, - { GWS_STATIC_TEXT, STATIC_TEXT_HILITE, "[Static Text] Hilite", NULL, 0, 0 }, - - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_LEFT, "[Text Entry] Enabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_RIGHT, "[Text Entry] Enabled Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_CENTER, "[Text Entry] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_SMALL_CENTER, "[Text Entry] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_LEFT, "[Text Entry] Disabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_RIGHT, "[Text Entry] Disabled Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_CENTER, "[Text Entry] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_SMALL_CENTER, "[Text Entry] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_LEFT, "[Text Entry] Hilite Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_RIGHT, "[Text Entry] Hilite Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_CENTER, "[Text Entry] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_SMALL_CENTER, "[Text Entry] Hilite Small Repeating Center", NULL, 0, 0 }, - - { GWS_TAB_CONTROL, TC_TAB_0_ENABLED, "[Tab Control] Tab 0 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_0_DISABLED, "[Tab Control] Tab 0 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_0_HILITE, "[Tab Control] Tab 0 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_ENABLED, "[Tab Control] Tab 1 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_DISABLED, "[Tab Control] Tab 1 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_HILITE, "[Tab Control] Tab 1 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_ENABLED, "[Tab Control] Tab 2 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_DISABLED, "[Tab Control] Tab 2 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_HILITE, "[Tab Control] Tab 2 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_ENABLED, "[Tab Control] Tab 3 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_DISABLED, "[Tab Control] Tab 3 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_HILITE, "[Tab Control] Tab 3 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_ENABLED, "[Tab Control] Tab 4 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_DISABLED, "[Tab Control] Tab 4 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_HILITE, "[Tab Control] Tab 4 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_ENABLED, "[Tab Control] Tab 5 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_DISABLED, "[Tab Control] Tab 5 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_HILITE, "[Tab Control] Tab 5 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_ENABLED, "[Tab Control] Tab 6 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_DISABLED, "[Tab Control] Tab 6 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_HILITE, "[Tab Control] Tab 6 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_ENABLED, "[Tab Control] Tab 7 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_DISABLED, "[Tab Control] Tab 7 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_HILITE, "[Tab Control] Tab 7 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_ENABLED, "[Tab Control] Background Surface Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_DISABLED, "[Tab Control] Background Surface Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_HILITE, "[Tab Control] Background Surface Hilite", NULL, 0, 0 }, - - { GWS_USER_WINDOW, GENERIC_ENABLED, "[User]Enabled Surface", NULL, 0, 0 }, - { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", NULL, 0, 0 }, - { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", NULL, 0, 0 }, - - { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } + { GWS_PUSH_BUTTON, BUTTON_ENABLED, "[Button] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_ENABLED_PUSHED, "[Button] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_DISABLED, "[Button] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_DISABLED_PUSHED, "[Button] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_HILITE, "[Button] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_HILITE_PUSHED, "[Button] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_RADIO_BUTTON, RADIO_ENABLED, "[Radio] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_ENABLED_UNCHECKED_BOX, "[Radio] Enabled Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_ENABLED_CHECKED_BOX, "[Radio] Enabled Nubbin (Checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED, "[Radio] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED_UNCHECKED_BOX, "[Radio] Disabled Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED_CHECKED_BOX, "[Radio] Disabled Nubbin (Checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE, "[Radio] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE_UNCHECKED_BOX, "[Radio] Hilite Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE_CHECKED_BOX, "[Radio] Hilite Nubbin (Checked)", nullptr, nullptr, 0 }, + + { GWS_CHECK_BOX, CHECK_BOX_ENABLED, "[Check Box] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_ENABLED_UNCHECKED_BOX, "[Check Box] Enabled Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_ENABLED_CHECKED_BOX, "[Check Box] Enabled Box (Checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED, "[Check Box] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED_UNCHECKED_BOX, "[Check Box] Disabled Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED_CHECKED_BOX, "[Check Box] Disabled Box (Checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE, "[Check Box] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE_UNCHECKED_BOX, "[Check Box] Hilite Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE_CHECKED_BOX, "[Check Box] Hilite Box (Checked)", nullptr, nullptr, 0 }, + + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_LEFT, "[HSlider] Enabled Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_RIGHT, "[HSlider] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_CENTER, "[HSlider] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_SMALL_CENTER, "[HSlider] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_LEFT, "[HSlider] Disabled Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_RIGHT, "[HSlider] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_CENTER, "[HSlider] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_SMALL_CENTER, "[HSlider] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_LEFT, "[HSlider] Hilite Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_RIGHT, "[HSlider] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_CENTER, "[HSlider] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_SMALL_CENTER, "[HSlider] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED, "[Thumb [HSlider]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [HSlider]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED, "[Thumb [HSlider]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [HSlider]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE, "[Thumb [HSlider]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE_PUSHED, "[Thumb [HSlider]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_VERT_SLIDER, VSLIDER_ENABLED_TOP, "[VSlider] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_BOTTOM, "[VSlider] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_CENTER, "[VSlider] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_SMALL_CENTER, "[VSlider] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_TOP, "[VSlider] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_BOTTOM, "[VSlider] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_CENTER, "[VSlider] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_SMALL_CENTER, "[VSlider] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_TOP, "[VSlider] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_BOTTOM, "[VSlider] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_CENTER, "[VSlider] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_SMALL_CENTER, "[VSlider] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED, "[Thumb [VSlider]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [VSlider]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED, "[Thumb [VSlider]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [VSlider]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE, "[Thumb [VSlider]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE_PUSHED, "[Thumb [VSlider]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED, "[Listbox] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED, "[Listbox] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE, "[Listbox] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox]] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox]] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox]] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox]] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox]] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox]] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox]] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox]] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox]] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_ENABLED, "[ComboBox] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, "[ComboBox] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, "[ComboBox] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED, "[ComboBox] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, "[ComboBox] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, "[ComboBox] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE, "[ComboBox] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_LEFT, "[ComboBox] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, "[ComboBox] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_CENTER, "[ComboBox] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED, "[Button [ComboBox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, "[Button [ComboBox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED, "[Button [ComboBox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, "[Button [ComboBox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE, "[Button [ComboBox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, "[Button [ComboBox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_LEFT, "[Text Entry [ComboBox]] Enabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_RIGHT, "[Text Entry [ComboBox]] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_CENTER, "[Text Entry [ComboBox]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_LEFT, "[Text Entry [ComboBox]] Disabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_RIGHT, "[Text Entry [ComboBox]] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_CENTER, "[Text Entry [ComboBox]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_LEFT, "[Text Entry [ComboBox]] Hilite Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_RIGHT, "[Text Entry [ComboBox]] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_CENTER, "[Text Entry [ComboBox]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, "[Text Entry [ComboBox]] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED, "[Listbox [ComboBox]] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED, "[Listbox [ComboBox]] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE, "[Listbox [ComboBox]] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox [ComboBox]]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox [ComboBox]]] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox [ComboBox]]] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox [ComboBox]]] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox [ComboBox]]] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_LEFT, "[Bar] Enabled Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_RIGHT, "[Bar] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_CENTER, "[Bar] Enabled Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_SMALL_CENTER, "[Bar] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_LEFT, "[Bar] Enabled Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_RIGHT, "[Bar] Enabled Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_CENTER, "[Bar] Enabled Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, "[Bar] Enabled Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_LEFT, "[Bar] Disabled Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_RIGHT, "[Bar] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_CENTER, "[Bar] Disabled Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_SMALL_CENTER, "[Bar] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_LEFT, "[Bar] Disabled Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_RIGHT, "[Bar] Disabled Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_CENTER, "[Bar] Disabled Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, "[Bar] Disabled Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_LEFT, "[Bar] Hilite Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_RIGHT, "[Bar] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_CENTER, "[Bar] Hilite Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_SMALL_CENTER, "[Bar] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_LEFT, "[Bar] Hilite Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_RIGHT, "[Bar] Hilite Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_CENTER, "[Bar] Hilite Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, "[Bar] Hilite Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + + + { GWS_STATIC_TEXT, STATIC_TEXT_ENABLED, "[Static Text] Enabled", nullptr, nullptr, 0 }, + { GWS_STATIC_TEXT, STATIC_TEXT_DISABLED, "[Static Text] Disabled", nullptr, nullptr, 0 }, + { GWS_STATIC_TEXT, STATIC_TEXT_HILITE, "[Static Text] Hilite", nullptr, nullptr, 0 }, + + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_LEFT, "[Text Entry] Enabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_RIGHT, "[Text Entry] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_CENTER, "[Text Entry] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_SMALL_CENTER, "[Text Entry] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_LEFT, "[Text Entry] Disabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_RIGHT, "[Text Entry] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_CENTER, "[Text Entry] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_SMALL_CENTER, "[Text Entry] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_LEFT, "[Text Entry] Hilite Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_RIGHT, "[Text Entry] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_CENTER, "[Text Entry] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_SMALL_CENTER, "[Text Entry] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_TAB_CONTROL, TC_TAB_0_ENABLED, "[Tab Control] Tab 0 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_0_DISABLED, "[Tab Control] Tab 0 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_0_HILITE, "[Tab Control] Tab 0 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_ENABLED, "[Tab Control] Tab 1 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_DISABLED, "[Tab Control] Tab 1 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_HILITE, "[Tab Control] Tab 1 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_ENABLED, "[Tab Control] Tab 2 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_DISABLED, "[Tab Control] Tab 2 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_HILITE, "[Tab Control] Tab 2 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_ENABLED, "[Tab Control] Tab 3 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_DISABLED, "[Tab Control] Tab 3 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_HILITE, "[Tab Control] Tab 3 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_ENABLED, "[Tab Control] Tab 4 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_DISABLED, "[Tab Control] Tab 4 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_HILITE, "[Tab Control] Tab 4 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_ENABLED, "[Tab Control] Tab 5 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_DISABLED, "[Tab Control] Tab 5 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_HILITE, "[Tab Control] Tab 5 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_ENABLED, "[Tab Control] Tab 6 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_DISABLED, "[Tab Control] Tab 6 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_HILITE, "[Tab Control] Tab 6 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_ENABLED, "[Tab Control] Tab 7 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_DISABLED, "[Tab Control] Tab 7 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_HILITE, "[Tab Control] Tab 7 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_ENABLED, "[Tab Control] Background Surface Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_DISABLED, "[Tab Control] Background Surface Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_HILITE, "[Tab Control] Background Surface Hilite", nullptr, nullptr, 0 }, + + { GWS_USER_WINDOW, GENERIC_ENABLED, "[User]Enabled Surface", nullptr, nullptr, 0 }, + { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", nullptr, nullptr, 0 }, + { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", nullptr, nullptr, 0 }, + + { 0, IDENTIFIER_INVALID, nullptr, nullptr, nullptr, 0 } }; @@ -395,7 +395,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) POINT screen; // sanity - if( window == NULL ) + if( window == nullptr ) return; // translate client position to screen coords of menu @@ -428,7 +428,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) dialog = InitUserWinPropertiesDialog( window ); // sanity check dialog - if( dialog == NULL ) + if( dialog == nullptr ) { DEBUG_LOG(( "Error creating properties dialog" )); @@ -459,7 +459,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) Int index; // sanity - if( comboBox == NULL || TheFontLibrary == NULL ) + if( comboBox == nullptr || TheFontLibrary == nullptr ) return; // reset the combo box @@ -491,7 +491,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[None]" ); // if no font select the top index - if( currFont == NULL ) + if( currFont == nullptr ) { SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); @@ -533,8 +533,8 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) { // santiy - if( combo == NULL ) - return NULL; + if( combo == nullptr ) + return nullptr; // get the selected item Int selected; @@ -542,7 +542,7 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) // index 0 is the "none" selector if( selected == 0 ) - return NULL; + return nullptr; // get the font from the selected item return (GameFont *)SendMessage( combo, CB_GETITEMDATA, selected, 0 ); @@ -557,7 +557,7 @@ static void saveFontSelection( HWND combo, GameWindow *window ) GameFont *font; // sanity - if( combo == NULL || window == NULL ) + if( combo == nullptr || window == nullptr ) return; // get the font @@ -575,7 +575,7 @@ static void saveHeaderSelection( HWND comboBox, GameWindow *window ) char buffer[ 512 ]; // santiy - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get the selected index @@ -600,7 +600,7 @@ static void loadTooltipTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -619,7 +619,7 @@ static void loadTooltipDelayTextLabel( HWND dialog, HWND edit, GameWindow *windo { // sanity - if( dialog == NULL || edit == NULL || window == NULL ) + if( dialog == nullptr || edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -638,7 +638,7 @@ static void saveTooltipTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // get the text from the edit control into the label buffer @@ -657,11 +657,11 @@ static void saveTooltipDelayTextLabel(HWND dialog, HWND edit, GameWindow *window { // sanity - if( dialog == NULL || edit == NULL || window == NULL ) + if( dialog == nullptr || edit == nullptr || window == nullptr ) return; // WinInstanceData *instData = window->winGetInstanceData(); -// instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, NULL, TRUE ); +// instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, nullptr, TRUE ); } @@ -673,7 +673,7 @@ static void loadTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -691,7 +691,7 @@ static void saveTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // get the text from the edit control into the label buffer @@ -733,7 +733,7 @@ void LoadTextStateCombo( HWND comboBox, { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // @@ -767,7 +767,7 @@ void LoadStateCombo( UnsignedInt style, HWND comboBox ) Int index; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // load the combo box with matching bit fields @@ -799,7 +799,7 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) WinInstanceData *instData; // sanity - if( window == NULL || dialog == NULL ) + if( window == nullptr || dialog == nullptr ) return; // get instance data @@ -894,11 +894,11 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) { // end recursion, note that "" is always a valid name - if( root == NULL || name == NULL || strlen( name ) == 0 ) + if( root == nullptr || name == nullptr || strlen( name ) == 0 ) return TRUE; // a name cannot have a colon in it cause we use it for decoration - if( strchr( name, ':' ) != NULL ) + if( strchr( name, ':' ) != nullptr ) { char buffer[ 1024 ]; @@ -945,7 +945,7 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get style of window @@ -1047,7 +1047,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) UnsignedInt bit; // sanity - if( dialog == NULL || window == NULL ) + if( dialog == nullptr || window == nullptr ) return FALSE; // get name in the name edit box @@ -1147,7 +1147,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) // save delay text label data if present HWND editTooltipDelayText = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY ); if( editTooltipDelayText ) - instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, NULL, TRUE ); + instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, nullptr, TRUE ); HWND headerCombo = GetDlgItem( dialog, COMBO_HEADER ); if( headerCombo ) @@ -1169,14 +1169,14 @@ void LoadImageListComboBox( HWND comboBox ) Image *image; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // clear the content of the box SendMessage( comboBox, CB_RESETCONTENT, 0, 0 ); // load the combo box with string names from the GUI image collection - for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=NULL;index++) + for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=nullptr;index++) { SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() ); @@ -1200,7 +1200,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) HeaderTemplate *ht; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // clear the content of the box @@ -1235,7 +1235,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) * image Loc from the GUI collection * * NOTE: The image list combo boxes have a [NONE] at index 0, if that - * is selected NULL will be returned + * is selected nullptr will be returned */ //============================================================================= const Image *ComboBoxSelectionToImage( HWND comboBox ) @@ -1244,15 +1244,15 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) char buffer[ 512 ]; // santiy - if( comboBox == NULL ) - return NULL; + if( comboBox == nullptr ) + return nullptr; // get the selected index selected = SendMessage( comboBox, CB_GETCURSEL, 0, 0 ); // do nothing if index 0 is selected (contains the string "[NONE]") if( selected == CB_ERR || selected == 0 ) - return NULL; + return nullptr; // get the text of the selected item SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer ); @@ -1279,7 +1279,7 @@ RGBColorInt *GetControlColor( UnsignedInt controlID ) } // not found - return NULL; + return nullptr; } @@ -1327,7 +1327,7 @@ ImageAndColorInfo *GetStateInfo( StateIdentifier id ) } - return NULL; + return nullptr; } @@ -1345,7 +1345,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) // get the data for the new state info = GetStateInfo( id ); - if( info == NULL ) + if( info == nullptr ) { DEBUG_LOG(( "Invalid state request" )); @@ -1367,8 +1367,8 @@ void SwitchToState( StateIdentifier id, HWND dialog ) // invalidate the color previews, they will redraw with the new // state automatically // - InvalidateRect( colorButton, NULL, TRUE ); - InvalidateRect( borderColorButton, NULL, TRUE ); + InvalidateRect( colorButton, nullptr, TRUE ); + InvalidateRect( borderColorButton, nullptr, TRUE ); } @@ -1432,7 +1432,7 @@ ImageAndColorInfo *GetCurrentStateInfo( HWND dialog ) // get selected state selected = SendMessage( stateCombo, CB_GETCURSEL, 0, 0 ); if( selected == CB_ERR ) - return NULL; + return nullptr; // get the state ID of the selected item (stored in the item data) stateID = (StateIdentifier)SendMessage( stateCombo, CB_GETITEMDATA, selected, 0 ); @@ -1558,7 +1558,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it *returnCode = TRUE; @@ -1615,8 +1615,8 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, currTextIndex = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 ); // invalidate each of the preview windows for text colors - InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE ); - InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE ); + InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), nullptr, TRUE ); + InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), nullptr, TRUE ); } used = TRUE; @@ -1695,7 +1695,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, assert( 0 ); // invalidate the color preview - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index ecac794fd7d..db74eced264 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -305,7 +305,7 @@ static Bool saveCallbacks( GameWindow *window, FILE *fp, Int dataIndent ) GameWindowEditData *editData = window->winGetEditData(); // if no edit data don't write anything for callbacks - if( editData == NULL ) + if( editData == nullptr ) return FALSE; // system @@ -365,7 +365,7 @@ static Bool saveFont( GameWindow *window, FILE *fp, Int dataIndent ) GameFont *font = window->winGetFont(); // if no font data don't write anything - if( font == NULL ) + if( font == nullptr ) return TRUE; // write the font data @@ -612,7 +612,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) ListboxData *listData = (ListboxData *)window->winGetUserData(); // sanity - if( listData == NULL ) + if( listData == nullptr ) { DEBUG_LOG(( "No listbox data to save for window '%d'", @@ -698,7 +698,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); // sanity - if( comboData == NULL ) + if( comboData == nullptr ) { DEBUG_LOG(( "No comboData data to save for window '%d'", @@ -797,7 +797,7 @@ static Bool saveRadioButtonData( GameWindow *window, FILE *fp, Int dataIndent ) { RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - if( radioData == NULL ) + if( radioData == nullptr ) { @@ -823,7 +823,7 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) SliderData *sliderData = (SliderData *)window->winGetUserData(); // sanity - if( sliderData == NULL ) + if( sliderData == nullptr ) { DEBUG_LOG(( "No slider data in window to save for window %d", @@ -861,7 +861,7 @@ static Bool saveStaticTextData( GameWindow *window, FILE *fp, Int dataIndent ) TextData *textData = (TextData *)window->winGetUserData(); // sanity - if( textData == NULL ) + if( textData == nullptr ) { DEBUG_LOG(( "No text data in window to save for window %d", @@ -886,7 +886,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) EntryData *entryData = (EntryData *)window->winGetUserData(); // sanity - if( entryData == NULL ) + if( entryData == nullptr ) { DEBUG_LOG(( "No text entry data in window to save for window %d", @@ -919,7 +919,7 @@ static Bool saveTabControlData( GameWindow *window, FILE *fp, Int dataIndent ) TabControlData *tabControlData = (TabControlData *)window->winGetUserData(); // sanity - if( tabControlData == NULL ) + if( tabControlData == nullptr ) { DEBUG_LOG(( "No text entry data in window to save for window %d", @@ -1038,7 +1038,7 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) { // traverse to end of child list - while( child->winGetNext() != NULL ) + while( child->winGetNext() != nullptr ) child = child->winGetNext(); // save children windows in reverse order @@ -1095,7 +1095,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) { // the end of recursion - if( root == NULL ) + if( root == nullptr ) return; // trivial case @@ -1153,7 +1153,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) { // end recursion - if( window == NULL ) + if( window == nullptr ) return; // is this a radio button @@ -1212,12 +1212,12 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) writeFontFile( GUIEDIT_FONT_FILENAME ); // sanity - if( filePathAndFilename == NULL ) + if( filePathAndFilename == nullptr ) return FALSE; // check for empty layout and just get out of here window = TheWindowManager->winGetWindowList(); - if( window == NULL ) + if( window == nullptr ) return TRUE; // check all the names for sizes once decorated with filename @@ -1239,7 +1239,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // open the file fp = fopen( filePathAndFilename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) return FALSE; // write out a single line for our window file version @@ -1257,7 +1257,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // go to end of window list window = TheWindowManager->winGetWindowList(); - while( window->winGetNext() != NULL ) + while( window->winGetNext() != nullptr ) window = window->winGetNext(); // loop backwards saving all windows diff --git a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp index bc6a055d5ea..36d262ed99b 100644 --- a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -71,7 +71,7 @@ static const char *szWindowClass = "GUIEdit"; // PUBLIC DATA //////////////////////////////////////////////////////////////// HINSTANCE ApplicationHInstance; ///< main application instance HWND ApplicationHWnd; ///< main application HWnd -Win32Mouse *TheWin32Mouse = NULL; ///< for Win32 mouse +Win32Mouse *TheWin32Mouse = nullptr; ///< for Win32 mouse const char *gAppPrefix = "ge_"; /// So GuiEdit can have a different debug log file name if we need it const Char *g_strFile = "data\\Generals.str"; @@ -114,12 +114,12 @@ static BOOL initInstance( HINSTANCE hInstance, int nCmdShow ) 0, // y position GetSystemMetrics( SM_CXSCREEN ), // width GetSystemMetrics( SM_CYSCREEN ), // height - NULL, // parent - NULL, // menu + nullptr, // parent + nullptr, // menu ApplicationHInstance, // instance - NULL ); // creation data + nullptr ); // creation data - if( ApplicationHWnd == NULL ) + if( ApplicationHWnd == nullptr ) return FALSE; // display the window @@ -157,7 +157,7 @@ static ATOM registerClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)GUIEDIT_LARGE_ICON); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); wcex.lpszMenuName = (LPCSTR)GUIEDIT_MENU; wcex.lpszClassName = szWindowClass; @@ -186,7 +186,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, /// @todo remove this force set of working directory later Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (Char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -214,29 +214,29 @@ Int APIENTRY WinMain(HINSTANCE hInstance, // initialize GUIEdit data TheEditor = new GUIEdit; - if( TheEditor == NULL ) + if( TheEditor == nullptr ) return FALSE; TheEditor->init(); TheFramePacer = new FramePacer(); // - // see if we have any messages to process, a NULL window handle tells the + // see if we have any messages to process, a nullptr window handle tells the // OS to look at the main window associated with the calling thread, us! // while( quit == FALSE ) { // is there is message ready for us? - if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + if( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // process ALL messages waiting - while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // get the message - returnValue = GetMessage( &msg, NULL, 0, 0 ); + returnValue = GetMessage( &msg, nullptr, 0, 0 ); // check for quitting if( returnValue == 0 ) @@ -268,10 +268,10 @@ Int APIENTRY WinMain(HINSTANCE hInstance, // shutdown GUIEdit data delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheEditor; - TheEditor = NULL; + TheEditor = nullptr; shutdownMemoryManager(); diff --git a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h index 0ba1ac79c90..f1a4fe80d63 100644 --- a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h +++ b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h @@ -30,7 +30,7 @@ class CColorAlphaDialog : public CDialog void onColorPress( Int colorPressed ); public: enum {IDD = IDD_PSEd_EditColorAndAlpha}; - CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = NULL); + CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h b/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h index 2e933110eb6..b2458f3002d 100644 --- a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ b/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h @@ -22,7 +22,7 @@ struct CParticleEditorPage : public CDialog { UINT m_templateID; public: - CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = NULL); + CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr); void InitPanel( int templateID ); diff --git a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h index 8b2f8df1a1d..6a3f2d30373 100644 --- a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h +++ b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h @@ -26,7 +26,7 @@ class CSwitchesDialog : public CDialog { public: enum {IDD = IDD_PSEd_EditSwitchesDialog}; - CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = NULL); + CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h index 5a3be36cca9..3082593c715 100644 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h @@ -49,7 +49,7 @@ class EmissionPanelPoint : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelPoint}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = NULL); + EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -67,7 +67,7 @@ class EmissionPanelLine : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelLine}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = NULL); + EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -85,7 +85,7 @@ class EmissionPanelBox : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelBox}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = NULL); + EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -103,7 +103,7 @@ class EmissionPanelSphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelSphere}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = NULL); + EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -121,7 +121,7 @@ class EmissionPanelCylinder : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelCylinder}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = NULL); + EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h b/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h index 7d3dd89fcbc..fc8e38cd2bd 100644 --- a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h +++ b/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h @@ -43,7 +43,7 @@ interface ISwapablePanel : public CDialog { - ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = NULL) : CDialog(nIDTemplate, pParentWnd) {} + ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr) : CDialog(nIDTemplate, pParentWnd) {} virtual DWORD GetIDD( void ) = 0; virtual void performUpdate( IN Bool toUI ) = 0; virtual void InitPanel( void ) = 0; diff --git a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h index 4cd07683ea5..f7f3dc0d13e 100644 --- a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h +++ b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h @@ -45,7 +45,7 @@ class MoreParmsDialog : public CDialog { public: enum { IDD = IDD_PSEd_EditMoreParms }; - MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = NULL); + MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = nullptr); virtual ~MoreParmsDialog(); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp index bccb1643894..bd4b45e05d0 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp @@ -73,7 +73,7 @@ CDebugWindowApp::CDebugWindowApp() { AfxInitialize(true); AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = NULL; + m_DialogWindow = nullptr; } @@ -104,9 +104,9 @@ void __declspec(dllexport) CreateParticleSystemDialog(void) DebugWindowDialog* tmpWnd; tmpWnd = new DebugWindowDialog; - tmpWnd->Create(DebugWindowDialog::IDD, NULL); + tmpWnd->Create(DebugWindowDialog::IDD, nullptr); - tmpWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + tmpWnd->SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); tmpWnd->InitPanel(); tmpWnd->ShowWindow(SW_SHOW); if (tmpWnd->GetMainWndHWND()) { @@ -126,7 +126,7 @@ void __declspec(dllexport) DestroyParticleSystemDialog(void) if (tmpWnd) { tmpWnd->DestroyWindow(); delete tmpWnd; - theApp.SetDialogWindow(NULL); + theApp.SetDialogWindow(nullptr); } } catch (...) { } } diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index 670b92543b1..cb5bfef2994 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -35,11 +35,11 @@ m_colorAlphaDialog(CColorAlphaDialog::IDD, this), m_switchesDialog(CSwitchesDialog::IDD, this), m_moreParmsDialog(MoreParmsDialog::IDD, this) { - mMainWndHWND = ::FindWindow(NULL, "Command & Conquer: Generals"); + mMainWndHWND = ::FindWindow(nullptr, "Command & Conquer: Generals"); m_activeEmissionPage = 0; m_activeVelocityPage = 0; m_activeParticlePage = 0; - m_particleSystem = NULL; + m_particleSystem = nullptr; m_changeHasOcurred = false; @@ -157,7 +157,7 @@ void DebugWindowDialog::InitPanel( void ) m_emissionTypePanels[j]->Create(m_emissionTypePanels[j]->GetIDD(), this); m_emissionTypePanels[j]->InitPanel(); m_emissionTypePanels[j]->ShowWindow(SW_HIDE); - m_emissionTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_emissionTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_emissionTypePanels[0]->ShowWindow(SW_SHOW); @@ -172,7 +172,7 @@ void DebugWindowDialog::InitPanel( void ) m_velocityTypePanels[j]->Create(m_velocityTypePanels[j]->GetIDD(), this); m_velocityTypePanels[j]->InitPanel(); m_velocityTypePanels[j]->ShowWindow(SW_HIDE); - m_velocityTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_velocityTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_velocityTypePanels[0]->ShowWindow(SW_SHOW); @@ -187,7 +187,7 @@ void DebugWindowDialog::InitPanel( void ) m_particleTypePanels[j]->Create(m_particleTypePanels[j]->GetIDD(), this); m_particleTypePanels[j]->InitPanel(); m_particleTypePanels[j]->ShowWindow(SW_HIDE); - m_particleTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_particleTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_particleTypePanels[0]->ShowWindow(SW_SHOW); diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h index 0e62ee6e95c..0b1e474b4d5 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h @@ -54,7 +54,7 @@ class DebugWindowDialog : public CDialog { public: enum {IDD = IDD_PSEd}; - DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = NULL); + DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = nullptr); virtual ~DebugWindowDialog(); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h index 93b05b4b5dc..5dc146d78cb 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h @@ -48,7 +48,7 @@ class ParticlePanelParticle : public ISwapablePanel public: enum {IDD = IDD_PSEd_ParticlePanelParticle}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = NULL); + ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -66,7 +66,7 @@ class ParticlePanelDrawable : public ISwapablePanel public: enum {IDD = IDD_PSEd_ParticlePanelDrawable}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = NULL); + ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); void clearAllThingTemplates( void ); @@ -85,7 +85,7 @@ class ParticlePanelStreak : public ParticlePanelParticle public: enum {IDD = IDD_PSEd_ParticlePanelStreak}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = NULL); + ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h index e6b499af11c..4568438d940 100644 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h @@ -49,7 +49,7 @@ class VelocityPanelOrtho : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelOrtho}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = NULL); + VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -67,7 +67,7 @@ class VelocityPanelSphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelSphere}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = NULL); + VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -85,7 +85,7 @@ class VelocityPanelHemisphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelHemisphere}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = NULL); + VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -103,7 +103,7 @@ class VelocityPanelCylinder : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelCylinder}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = NULL); + VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -121,7 +121,7 @@ class VelocityPanelOutward : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelOutward}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = NULL); + VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h b/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h index b8ee5094786..8267d6ef9cd 100644 --- a/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h +++ b/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h @@ -28,7 +28,7 @@ class BaseBuildProps : public CDialog { // Construction public: - BaseBuildProps(CWnd* pParent = NULL); // standard constructor + BaseBuildProps(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BaseBuildProps) diff --git a/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h b/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h index 00f661fa1b4..59ed246aa9e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h +++ b/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h @@ -32,7 +32,7 @@ class BlendMaterial : public COptionsPanel { // Construction public: - BlendMaterial(CWnd* pParent = NULL); // standard constructor + BlendMaterial(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BlendMaterial) diff --git a/Generals/Code/Tools/WorldBuilder/include/BuildList.h b/Generals/Code/Tools/WorldBuilder/include/BuildList.h index 26b7b28e033..1fa68ff27ec 100644 --- a/Generals/Code/Tools/WorldBuilder/include/BuildList.h +++ b/Generals/Code/Tools/WorldBuilder/include/BuildList.h @@ -34,7 +34,7 @@ class BuildList : public COptionsPanel, public PopupSliderOwner { // Construction public: - BuildList(CWnd* pParent = NULL); ///< standard constructor + BuildList(CWnd* pParent = nullptr); ///< standard constructor ~BuildList(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/Generals/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h b/Generals/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h index bb77f20cfad..b7406987297 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h @@ -26,7 +26,7 @@ class CFixTeamOwnerDialog : public CDialog { public: enum { IDD = IDD_CHANGE_TEAM_OWNER }; - CFixTeamOwnerDialog( TeamsInfo *ti, SidesList *sideList, UINT nIDTemplate = CFixTeamOwnerDialog::IDD, CWnd* pParentWnd = NULL ); + CFixTeamOwnerDialog( TeamsInfo *ti, SidesList *sideList, UINT nIDTemplate = CFixTeamOwnerDialog::IDD, CWnd* pParentWnd = nullptr ); AsciiString getSelectedOwner(); Bool pickedValidTeam() { return m_pickedValidTeam; } diff --git a/Generals/Code/Tools/WorldBuilder/include/CUndoable.h b/Generals/Code/Tools/WorldBuilder/include/CUndoable.h index 9d81a9db14d..f444e3d0cb3 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CUndoable.h +++ b/Generals/Code/Tools/WorldBuilder/include/CUndoable.h @@ -74,7 +74,7 @@ class WBDocUndoable : public Undoable public: - WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset = NULL); + WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset = nullptr); // destructor. ~WBDocUndoable(void); @@ -229,7 +229,7 @@ class DictItemUndoable : public Undoable // if you want to just add/modify/remove a single dict item, pass the item's key. // if you want to substitute the entire contents of the new dict, pass NAMEKEY_INVALID. - DictItemUndoable(Dict **d, Dict data, NameKeyType key, Int dictsToModify = 1, CWorldBuilderDoc *pDoc = NULL, Bool inval = false); + DictItemUndoable(Dict **d, Dict data, NameKeyType key, Int dictsToModify = 1, CWorldBuilderDoc *pDoc = nullptr, Bool inval = false); // destructor. ~DictItemUndoable(void); diff --git a/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h b/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h index 95863f9cd09..ee7470ea05b 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h @@ -31,7 +31,7 @@ class CameraOptions : public CDialog, public PopupSliderOwner { // Construction public: - CameraOptions(CWnd* pParent = NULL); // standard constructor + CameraOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CameraOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/CellWidth.h b/Generals/Code/Tools/WorldBuilder/include/CellWidth.h index 9b8c8fc88e6..7694b43fdaa 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CellWidth.h +++ b/Generals/Code/Tools/WorldBuilder/include/CellWidth.h @@ -28,7 +28,7 @@ class CellWidth : public CDialog { // Construction public: - CellWidth(int cellWidth, CWnd* pParent = NULL); // standard constructor + CellWidth(int cellWidth, CWnd* pParent = nullptr); // standard constructor int GetCellWidth(void) {return mCellWidth;}; // Dialog Data diff --git a/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h b/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h index 26f4cffbeea..6601cb982c5 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h @@ -35,7 +35,7 @@ class ContourOptions : public CDialog MIN_WIDTH=1, MAX_WIDTH=6}; - ContourOptions(CWnd* pParent = NULL); // standard constructor + ContourOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ContourOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditAction.h b/Generals/Code/Tools/WorldBuilder/include/EditAction.h index d060b685f31..ac04d34e8a3 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditAction.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditAction.h @@ -32,7 +32,7 @@ class EditAction : public CDialog { // Construction public: - EditAction(CWnd* pParent = NULL); // standard constructor + EditAction(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditAction) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditCondition.h b/Generals/Code/Tools/WorldBuilder/include/EditCondition.h index b6f04353a56..a0eb69a0ae4 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditCondition.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditCondition.h @@ -31,7 +31,7 @@ class EditCondition : public CDialog { // Construction public: - EditCondition(CWnd* pParent = NULL); // standard constructor + EditCondition(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditCondition) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditCoordParameter.h b/Generals/Code/Tools/WorldBuilder/include/EditCoordParameter.h index f2dc6770900..94e88687d82 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditCoordParameter.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditCoordParameter.h @@ -30,7 +30,7 @@ class EditCoordParameter : public CDialog friend class EditParameter; // Construction public: - EditCoordParameter(CWnd* pParent = NULL); // standard constructor + EditCoordParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditCoordParameter) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditGroup.h b/Generals/Code/Tools/WorldBuilder/include/EditGroup.h index 2a3585f8080..ece1ab0345b 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditGroup.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditGroup.h @@ -29,7 +29,7 @@ class EditGroup : public CDialog { // Construction public: - EditGroup(ScriptGroup *pGroup, CWnd* pParent = NULL); // standard constructor + EditGroup(ScriptGroup *pGroup, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditGroup) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditObjectParameter.h b/Generals/Code/Tools/WorldBuilder/include/EditObjectParameter.h index 6f1c4dd965d..0ab31d75293 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditObjectParameter.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditObjectParameter.h @@ -30,7 +30,7 @@ class EditObjectParameter : public CDialog friend class EditParameter; // Construction public: - EditObjectParameter(CWnd* pParent = NULL); // standard constructor + EditObjectParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditObjectParameter) diff --git a/Generals/Code/Tools/WorldBuilder/include/EditParameter.h b/Generals/Code/Tools/WorldBuilder/include/EditParameter.h index 082e10b3c62..2ac6663eaee 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditParameter.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditParameter.h @@ -31,7 +31,7 @@ class EditParameter : public CDialog { // Construction public: - EditParameter(CWnd* pParent = NULL); // standard constructor + EditParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditParameter) @@ -57,7 +57,7 @@ class EditParameter : public CDialog static Bool loadScripts(CComboBox *pCombo, Bool subr, AsciiString match = AsciiString::TheEmptyString); static Bool loadWaypoints(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); static Bool loadTransports(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); - static Bool loadObjectTypeList(CComboBox *pCombo, std::vector *strings = NULL, AsciiString match = AsciiString::TheEmptyString); + static Bool loadObjectTypeList(CComboBox *pCombo, std::vector *strings = nullptr, AsciiString match = AsciiString::TheEmptyString); protected: static Bool loadSides(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); diff --git a/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h b/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h index fa38ca049d6..33625c14bf8 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h @@ -28,7 +28,7 @@ class ExportScriptsOptions : public CDialog { // Construction public: - ExportScriptsOptions(CWnd* pParent = NULL); // standard constructor + ExportScriptsOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ExportScriptsOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h b/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h index 2cd482dd5f4..1b412ae9fab 100644 --- a/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h @@ -37,7 +37,7 @@ class FeatherOptions : public COptionsPanel , public PopupSliderOwner MIN_RADIUS=1, MAX_RADIUS=5}; - FeatherOptions(CWnd* pParent = NULL); // standard constructor + FeatherOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(FeatherOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/FenceOptions.h b/Generals/Code/Tools/WorldBuilder/include/FenceOptions.h index 8c11eefa41e..144244eb03c 100644 --- a/Generals/Code/Tools/WorldBuilder/include/FenceOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/FenceOptions.h @@ -33,7 +33,7 @@ class FenceOptions : public COptionsPanel { // Construction public: - FenceOptions(CWnd* pParent = NULL); ///< standard constructor + FenceOptions(CWnd* pParent = nullptr); ///< standard constructor ~FenceOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h b/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h index f38d6251bb9..5ac3346e5f1 100644 --- a/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h @@ -40,7 +40,7 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner int kUIBlueIDs[3];// = {IDC_BD_EDIT, IDC_BD_EDIT1, IDC_BD_EDIT2}; CButtonShowColor m_colorButton; - GlobalLightOptions(CWnd* pParent = NULL); // standard constructor + GlobalLightOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(GlobalLightOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/GroveOptions.h b/Generals/Code/Tools/WorldBuilder/include/GroveOptions.h index 22df766d485..a176b4858bd 100644 --- a/Generals/Code/Tools/WorldBuilder/include/GroveOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/GroveOptions.h @@ -45,7 +45,7 @@ class GroveOptions : public COptionsPanel Int mNumTrees; public: - GroveOptions(CWnd* pParent = NULL); + GroveOptions(CWnd* pParent = nullptr); ~GroveOptions(); void makeMain(void); diff --git a/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h b/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h index 6312a67db76..a70ed8b653b 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -24,7 +24,7 @@ class ImpassableOptions : public CDialog enum { IDD = IDD_IMPASSABLEOPTIONS }; public: - ImpassableOptions(CWnd* pParent = NULL, Real defaultSlope = 45.0f); + ImpassableOptions(CWnd* pParent = nullptr, Real defaultSlope = 45.0f); virtual ~ImpassableOptions(); Real GetSlopeToShow() const { return m_slopeToShow; } Real GetDefaultSlope() const { return m_defaultSlopeToShow; } diff --git a/Generals/Code/Tools/WorldBuilder/include/LayersList.h b/Generals/Code/Tools/WorldBuilder/include/LayersList.h index 2dbbcb0dd1b..2b761c4917e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/LayersList.h +++ b/Generals/Code/Tools/WorldBuilder/include/LayersList.h @@ -81,7 +81,7 @@ class LayersList : public CDialog public: enum { IDD = IDD_LAYERSLIST }; - LayersList(UINT nIDTemplate = LayersList::IDD, CWnd *parentWnd = NULL); + LayersList(UINT nIDTemplate = LayersList::IDD, CWnd *parentWnd = nullptr); virtual ~LayersList(); void resetLayers(); @@ -127,16 +127,16 @@ class LayersList : public CDialog // layerIt points to a valid layer iterator in which the MapObject was found // MapObjectIt points to a valid MapObject iterator on the layerIts MapObjectsInLayer member // 2) Returns false if the MapObject cannot be found. - Bool findMapObjectAndList(IN MapObject *MapObjectToFind, OUT ListLayerIt *layerIt = NULL, OUT ListMapObjectPtrIt *MapObjectIt = NULL); + Bool findMapObjectAndList(IN MapObject *MapObjectToFind, OUT ListLayerIt *layerIt = nullptr, OUT ListMapObjectPtrIt *MapObjectIt = nullptr); // This function takes a layer name, and does one of the following: // 1) Return true if the layer can be found, and // layerIt points to a valid layer iterator named layerName // 2) Returns false if the layer cannot be found. - Bool findLayerNamed(IN AsciiString layerName, OUT ListLayerIt *layerIt = NULL); + Bool findLayerNamed(IN AsciiString layerName, OUT ListLayerIt *layerIt = nullptr); void addMapObjectToLayer(IN MapObject *objToAdd, IN ListLayerIt *layerIt); - void removeMapObjectFromLayer(IN MapObject *objToRemove, IN ListLayerIt *layerIt = NULL, IN ListMapObjectPtrIt *MapObjectIt = NULL); + void removeMapObjectFromLayer(IN MapObject *objToRemove, IN ListLayerIt *layerIt = nullptr, IN ListMapObjectPtrIt *MapObjectIt = nullptr); protected: virtual void OnOK(); diff --git a/Generals/Code/Tools/WorldBuilder/include/LightOptions.h b/Generals/Code/Tools/WorldBuilder/include/LightOptions.h index e08e6b0759d..adcd549594f 100644 --- a/Generals/Code/Tools/WorldBuilder/include/LightOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/LightOptions.h @@ -31,7 +31,7 @@ class LightOptions : public COptionsPanel // Construction public: - LightOptions(CWnd* pParent = NULL); // standard constructor + LightOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(LightOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/MapSettings.h b/Generals/Code/Tools/WorldBuilder/include/MapSettings.h index 8fc0810a064..eae8eedcb62 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MapSettings.h +++ b/Generals/Code/Tools/WorldBuilder/include/MapSettings.h @@ -28,7 +28,7 @@ class MapSettings : public CDialog { // Construction public: - MapSettings(CWnd* pParent = NULL); // standard constructor + MapSettings(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(MapSettings) diff --git a/Generals/Code/Tools/WorldBuilder/include/MeshMoldOptions.h b/Generals/Code/Tools/WorldBuilder/include/MeshMoldOptions.h index 0e6515be6f1..02d37096098 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MeshMoldOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/MeshMoldOptions.h @@ -31,7 +31,7 @@ class MeshMoldOptions : public COptionsPanel , public PopupSliderOwner { // Construction public: - MeshMoldOptions(CWnd* pParent = NULL); // standard constructor + MeshMoldOptions(CWnd* pParent = nullptr); // standard constructor enum {MIN_ANGLE=-180, MAX_ANGLE=180, MIN_HEIGHT=-10, diff --git a/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h b/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h index d81891a47ba..d2f691323f1 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h @@ -41,7 +41,7 @@ class MoundOptions : public COptionsPanel , public PopupSliderOwner MIN_FEATHER=0, MAX_FEATHER=20}; - MoundOptions(CWnd* pParent = NULL); // standard constructor + MoundOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(MoundOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/NewHeightMap.h b/Generals/Code/Tools/WorldBuilder/include/NewHeightMap.h index 9ae6fde449d..3cacd82ec1c 100644 --- a/Generals/Code/Tools/WorldBuilder/include/NewHeightMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/NewHeightMap.h @@ -43,7 +43,7 @@ class CNewHeightMap : public CDialog { // Construction public: - CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent = NULL); // standard constructor + CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent = nullptr); // standard constructor void GetHeightInfo(TNewHeightInfo *hiP) {*hiP = mHeightInfo; }; // Dialog Data diff --git a/Generals/Code/Tools/WorldBuilder/include/ObjectOptions.h b/Generals/Code/Tools/WorldBuilder/include/ObjectOptions.h index 3b94fd9b70d..d4f0a798948 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ObjectOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ObjectOptions.h @@ -33,7 +33,7 @@ class ObjectOptions : public COptionsPanel { // Construction public: - ObjectOptions(CWnd* pParent = NULL); ///< standard constructor + ObjectOptions(CWnd* pParent = nullptr); ///< standard constructor ~ObjectOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/Generals/Code/Tools/WorldBuilder/include/OpenMap.h b/Generals/Code/Tools/WorldBuilder/include/OpenMap.h index 80d679ccd8c..29b937ef7ae 100644 --- a/Generals/Code/Tools/WorldBuilder/include/OpenMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/OpenMap.h @@ -35,7 +35,7 @@ class OpenMap : public CDialog { // Construction public: - OpenMap(TOpenMapInfo *pInfo, CWnd* pParent = NULL); // standard constructor + OpenMap(TOpenMapInfo *pInfo, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(OpenMap) diff --git a/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h b/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h index ff459a0e90c..15ca6081cc3 100644 --- a/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h +++ b/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h @@ -32,7 +32,7 @@ class COptionsPanel : public CDialog { // Construction public: - COptionsPanel(Int dlgid = 0, CWnd* pParent = NULL); // standard constructor + COptionsPanel(Int dlgid = 0, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(COptionsPanel) diff --git a/Generals/Code/Tools/WorldBuilder/include/PickUnitDialog.h b/Generals/Code/Tools/WorldBuilder/include/PickUnitDialog.h index c6a58c0e320..dcd641a5090 100644 --- a/Generals/Code/Tools/WorldBuilder/include/PickUnitDialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/PickUnitDialog.h @@ -46,8 +46,8 @@ class PickUnitDialog : public CDialog // Construction public: - PickUnitDialog(CWnd* pParent = NULL); // standard constructor - PickUnitDialog(UINT id, CWnd* pParent = NULL); // standard constructor + PickUnitDialog(CWnd* pParent = nullptr); // standard constructor + PickUnitDialog(UINT id, CWnd* pParent = nullptr); // standard constructor ~PickUnitDialog(void); ///< standard destructor // Dialog Data @@ -87,7 +87,7 @@ class PickUnitDialog : public CDialog class ReplaceUnitDialog : public PickUnitDialog { public: - ReplaceUnitDialog(CWnd* pParent = NULL); // standard constructor + ReplaceUnitDialog(CWnd* pParent = nullptr); // standard constructor void setMissing(AsciiString name) {m_missingName = name;}; diff --git a/Generals/Code/Tools/WorldBuilder/include/RampOptions.h b/Generals/Code/Tools/WorldBuilder/include/RampOptions.h index 1d6828ae486..154b6167010 100644 --- a/Generals/Code/Tools/WorldBuilder/include/RampOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/RampOptions.h @@ -47,7 +47,7 @@ class RampOptions : public COptionsPanel Real m_rampWidth; public: enum { IDD = IDD_RAMP_OPTIONS }; - RampOptions(CWnd* pParent = NULL); + RampOptions(CWnd* pParent = nullptr); virtual ~RampOptions(); Bool shouldApplyTheRamp(); diff --git a/Generals/Code/Tools/WorldBuilder/include/RoadOptions.h b/Generals/Code/Tools/WorldBuilder/include/RoadOptions.h index 1536469cbfa..f62b02bb6f4 100644 --- a/Generals/Code/Tools/WorldBuilder/include/RoadOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/RoadOptions.h @@ -33,7 +33,7 @@ class RoadOptions : public COptionsPanel { // Construction public: - RoadOptions(CWnd* pParent = NULL); ///< standard constructor + RoadOptions(CWnd* pParent = nullptr); ///< standard constructor ~RoadOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/Generals/Code/Tools/WorldBuilder/include/SaveMap.h b/Generals/Code/Tools/WorldBuilder/include/SaveMap.h index 4a849ff5ec0..8e7f513687a 100644 --- a/Generals/Code/Tools/WorldBuilder/include/SaveMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/SaveMap.h @@ -36,7 +36,7 @@ class SaveMap : public CDialog { // Construction public: - SaveMap(TSaveMapInfo *pInfo, CWnd* pParent = NULL); // standard constructor + SaveMap(TSaveMapInfo *pInfo, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(SaveMap) diff --git a/Generals/Code/Tools/WorldBuilder/include/ScorchOptions.h b/Generals/Code/Tools/WorldBuilder/include/ScorchOptions.h index 1fdae4e4138..128bcd5d53e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ScorchOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ScorchOptions.h @@ -34,7 +34,7 @@ class ScorchOptions : public COptionsPanel, public PopupSliderOwner { // Construction public: - ScorchOptions(CWnd* pParent = NULL); // standard constructor + ScorchOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ScorchOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/ScriptDialog.h b/Generals/Code/Tools/WorldBuilder/include/ScriptDialog.h index 2e3e3055792..55f3f8b130a 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ScriptDialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/ScriptDialog.h @@ -61,7 +61,7 @@ class ScriptDialog : public CDialog { // Construction public: - ScriptDialog(CWnd* pParent = NULL); // standard constructor + ScriptDialog(CWnd* pParent = nullptr); // standard constructor ~ScriptDialog(); // destructor // Dialog Data diff --git a/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h b/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h index a3108838286..6b8f68f1b86 100644 --- a/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h +++ b/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h @@ -28,7 +28,7 @@ class SelectMacrotexture : public CDialog { // Construction public: - SelectMacrotexture(CWnd* pParent = NULL); // standard constructor + SelectMacrotexture(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(SelectMacrotexture) diff --git a/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h b/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h index 1af6e29d513..40c1ea107fd 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h @@ -28,7 +28,7 @@ class ShadowOptions : public CDialog { // Construction public: - ShadowOptions(CWnd* pParent = NULL); // standard constructor + ShadowOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ShadowOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h b/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h index 5018911070a..bc625943abb 100644 --- a/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h +++ b/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h @@ -32,7 +32,7 @@ class TerrainMaterial : public COptionsPanel, public PopupSliderOwner { // Construction public: - TerrainMaterial(CWnd* pParent = NULL); // standard constructor + TerrainMaterial(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(TerrainMaterial) diff --git a/Generals/Code/Tools/WorldBuilder/include/TerrainModal.h b/Generals/Code/Tools/WorldBuilder/include/TerrainModal.h index 6032a53b6f0..96427faeb8e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/TerrainModal.h +++ b/Generals/Code/Tools/WorldBuilder/include/TerrainModal.h @@ -31,7 +31,7 @@ class TerrainModal : public CDialog { // Construction public: - TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent = NULL); // standard constructor + TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(TerrainModal) diff --git a/Generals/Code/Tools/WorldBuilder/include/Tool.h b/Generals/Code/Tools/WorldBuilder/include/Tool.h index 70515caca9d..670a74c9214 100644 --- a/Generals/Code/Tools/WorldBuilder/include/Tool.h +++ b/Generals/Code/Tools/WorldBuilder/include/Tool.h @@ -75,7 +75,7 @@ class Tool virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} - virtual WorldHeightMapEdit *getHeightMap(void) {return NULL;} + virtual WorldHeightMapEdit *getHeightMap(void) {return nullptr;} static Real calcRoundBlendFactor(CPoint center, Int x, Int y, Int brushWidth, Int featherWidth); static Real calcSquareBlendFactor(CPoint center, Int x, Int y, Int brushWidth, Int featherWidth); diff --git a/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h b/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h index 129b12204f2..9ac20bab965 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h +++ b/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h @@ -41,8 +41,8 @@ class CWBFrameWnd : public CFrameWnd public: virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, - CWnd* pParentWnd = NULL, - CCreateContext* pContext = NULL); + CWnd* pParentWnd = nullptr, + CCreateContext* pContext = nullptr); // ClassWizard generated virtual function overrides //}}AFX_VIRTUAL @@ -70,8 +70,8 @@ class CWB3dFrameWnd : public CMainFrame // Overrides virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, - CWnd* pParentWnd = NULL, - CCreateContext* pContext = NULL); + CWnd* pParentWnd = nullptr, + CCreateContext* pContext = nullptr); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWB3dFrameWnd) public: diff --git a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index fe2e8fa0837..e800c2b7913 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -35,7 +35,7 @@ class CProcessNode Real m_len; ///< Length of texture coord on this node. CProcessNode *m_next; public: - CProcessNode(Int x, Int y):m_x(x),m_y(y),m_next(NULL),m_len(0) {}; + CProcessNode(Int x, Int y):m_x(x),m_y(y),m_next(nullptr),m_len(0) {}; ~CProcessNode(void) { }; }; @@ -92,7 +92,7 @@ class WorldHeightMapEdit : public WorldHeightMap UnsignedByte *pProcessed, TCliffInfo &cliffInfo); Bool adjustForTiling(TCliffInfo &cliffInfo, Real textureWidth); void updateFlatCellForAdjacentCliffs(Int xIndex, Int yIndex, - Int curTileClass, UnsignedByte *pProcessed=NULL); + Int curTileClass, UnsignedByte *pProcessed=nullptr); public: // construction WorldHeightMapEdit(Int xExtent, Int yExtent, UnsignedByte initialHeight, Int border); ///< create. @@ -161,7 +161,7 @@ class WorldHeightMapEdit : public WorldHeightMap void changeBoundary(Int ndx, ICoord2D *border); void removeLastBoundary(void); - // outNdx must not be NULL, but outHandle can be. + // outNdx must not be null, but outHandle can be. // outHandle: 0 means BL, 1 means TL, 2 means TR, 3 means BR void findBoundaryNear(Coord3D *pt, float okDistance, Int *outNdx, Int *outHandle); }; diff --git a/Generals/Code/Tools/WorldBuilder/include/WaterOptions.h b/Generals/Code/Tools/WorldBuilder/include/WaterOptions.h index 9cf098f0e37..70ef07da248 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WaterOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/WaterOptions.h @@ -35,7 +35,7 @@ class WaterOptions : public COptionsPanel, public PopupSliderOwner // Construction public: - WaterOptions(CWnd* pParent = NULL); // standard constructor + WaterOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(WaterOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/WaypointOptions.h b/Generals/Code/Tools/WorldBuilder/include/WaypointOptions.h index 3a4feaabd36..4663df59d1b 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WaypointOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/WaypointOptions.h @@ -34,7 +34,7 @@ class WaypointOptions : public COptionsPanel // Construction public: - WaypointOptions(CWnd* pParent = NULL); // standard constructor + WaypointOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(WaypointOptions) @@ -82,7 +82,7 @@ class WaypointOptions : public COptionsPanel static void update(void); static MapObject *getSingleSelectedWaypoint(void); static PolygonTrigger *getSingleSelectedPolygon(void); - static Bool isUnique(AsciiString name, MapObject* theMapObj = NULL); + static Bool isUnique(AsciiString name, MapObject* theMapObj = nullptr); static AsciiString GenerateUniqueName(Int id); diff --git a/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h b/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h index 5ea8f22dde8..03c02004b29 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h +++ b/Generals/Code/Tools/WorldBuilder/include/WorldBuilder.h @@ -135,7 +135,7 @@ class CWorldBuilderApp : public CWinApp void deletePasteObjList(void) { deleteInstance(m_pasteMapObjList); - m_pasteMapObjList = NULL; + m_pasteMapObjList = nullptr; }; public: diff --git a/Generals/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h b/Generals/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h index 01f04ea8293..23debe377c0 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h +++ b/Generals/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h @@ -89,7 +89,7 @@ class CWorldBuilderDoc : public CDocument void changeBoundary(Int ndx, ICoord2D *border); void removeLastBoundary(void); - // outNdx must not be NULL, but outHandle can be. + // outNdx must not be null, but outHandle can be. // outHandle: 0 means BL, 1 means TL, 2 means TR, 3 means BR void findBoundaryNear(Coord3D *pt, float okDistance, Int *outNdx, Int *outHandle); diff --git a/Generals/Code/Tools/WorldBuilder/include/WorldBuilderView.h b/Generals/Code/Tools/WorldBuilder/include/WorldBuilderView.h index 822473285ea..6406dd01c9c 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WorldBuilderView.h +++ b/Generals/Code/Tools/WorldBuilder/include/WorldBuilderView.h @@ -124,7 +124,7 @@ class CWorldBuilderView : public WbView /// the doc has changed size; readjust view as necessary. virtual void adjustDocSize(); - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj); /// Invalidates the area of one height map cell in the 2d view. diff --git a/Generals/Code/Tools/WorldBuilder/include/addplayerdialog.h b/Generals/Code/Tools/WorldBuilder/include/addplayerdialog.h index 2222f54b993..7039b42a46d 100644 --- a/Generals/Code/Tools/WorldBuilder/include/addplayerdialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/addplayerdialog.h @@ -34,7 +34,7 @@ class AddPlayerDialog : public CDialog // Construction public: - AddPlayerDialog(AsciiString side, CWnd* pParent = NULL); // standard constructor + AddPlayerDialog(AsciiString side, CWnd* pParent = nullptr); // standard constructor AsciiString getAddedSide() { return m_addedSide; } diff --git a/Generals/Code/Tools/WorldBuilder/include/brushoptions.h b/Generals/Code/Tools/WorldBuilder/include/brushoptions.h index fe9a13b1626..6413d99bf84 100644 --- a/Generals/Code/Tools/WorldBuilder/include/brushoptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/brushoptions.h @@ -37,7 +37,7 @@ class BrushOptions : public COptionsPanel , public PopupSliderOwner FREQ_FEATHER_TICKS=4, MAX_FEATHER=20}; - BrushOptions(CWnd* pParent = NULL); // standard constructor + BrushOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BrushOptions) diff --git a/Generals/Code/Tools/WorldBuilder/include/euladialog.h b/Generals/Code/Tools/WorldBuilder/include/euladialog.h index 87eb399ba1d..6203df5b56e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/euladialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/euladialog.h @@ -28,7 +28,7 @@ class EulaDialog : public CDialog { // Construction public: - EulaDialog(CWnd* pParent = NULL); // standard constructor + EulaDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EulaDialog) diff --git a/Generals/Code/Tools/WorldBuilder/include/mapobjectprops.h b/Generals/Code/Tools/WorldBuilder/include/mapobjectprops.h index 85796292820..64ad5cbc7c2 100644 --- a/Generals/Code/Tools/WorldBuilder/include/mapobjectprops.h +++ b/Generals/Code/Tools/WorldBuilder/include/mapobjectprops.h @@ -41,7 +41,7 @@ class MapObjectProps : public COptionsPanel, public PopupSliderOwner { // Construction public: - MapObjectProps(Dict* dictToEdit = NULL, const char* title = NULL, CWnd* pParent = NULL); // standard constructor + MapObjectProps(Dict* dictToEdit = nullptr, const char* title = nullptr, CWnd* pParent = nullptr); // standard constructor ~MapObjectProps(); void makeMain(); diff --git a/Generals/Code/Tools/WorldBuilder/include/playerlistdlg.h b/Generals/Code/Tools/WorldBuilder/include/playerlistdlg.h index 3ec9c410514..8069032ab19 100644 --- a/Generals/Code/Tools/WorldBuilder/include/playerlistdlg.h +++ b/Generals/Code/Tools/WorldBuilder/include/playerlistdlg.h @@ -31,7 +31,7 @@ class PlayerListDlg : public CDialog { // Construction public: - PlayerListDlg(CWnd* pParent = NULL); // standard constructor + PlayerListDlg(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(PlayerListDlg) diff --git a/Generals/Code/Tools/WorldBuilder/include/propedit.h b/Generals/Code/Tools/WorldBuilder/include/propedit.h index 34c9c0beaae..d66f1abf862 100644 --- a/Generals/Code/Tools/WorldBuilder/include/propedit.h +++ b/Generals/Code/Tools/WorldBuilder/include/propedit.h @@ -28,7 +28,7 @@ class PropEdit : public CDialog { // Construction public: - PropEdit(AsciiString* key, Dict::DataType* type, AsciiString* value, Bool valueOnly, CWnd *parent = NULL); + PropEdit(AsciiString* key, Dict::DataType* type, AsciiString* value, Bool valueOnly, CWnd *parent = nullptr); // Dialog Data //{{AFX_DATA(PropEdit) diff --git a/Generals/Code/Tools/WorldBuilder/include/teamsdialog.h b/Generals/Code/Tools/WorldBuilder/include/teamsdialog.h index 536bcd4ac7d..096e1c845e5 100644 --- a/Generals/Code/Tools/WorldBuilder/include/teamsdialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/teamsdialog.h @@ -30,7 +30,7 @@ class CTeamsDialog : public CDialog { // Construction public: - CTeamsDialog(CWnd* pParent = NULL); // standard constructor + CTeamsDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CTeamsDialog) diff --git a/Generals/Code/Tools/WorldBuilder/include/wbview.h b/Generals/Code/Tools/WorldBuilder/include/wbview.h index 9b8a879c2cd..e39f5295b0e 100644 --- a/Generals/Code/Tools/WorldBuilder/include/wbview.h +++ b/Generals/Code/Tools/WorldBuilder/include/wbview.h @@ -108,7 +108,7 @@ class WbView : public CView /// Scrolls the window by this amount. virtual void scrollInView(Real x, Real y, Bool end) { DEBUG_CRASH(("should not call")); } - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj) { } /// Invalidates the area of one height map cell in the 2d view. @@ -127,8 +127,8 @@ class WbView : public CView void snapPoint(Coord3D *thePt) {if (m_snapToGrid || m_lockAngle) {thePt->x = MAP_XY_FACTOR*floor(thePt->x/MAP_XY_FACTOR+0.5); thePt->y = MAP_XY_FACTOR*floor(thePt->y/MAP_XY_FACTOR+0.5);};}; virtual TPickedStatus picked(MapObject *pObj, Coord3D docPt); - virtual MapObject *picked3dObjectInView(CPoint viewPt) {return NULL;}; - virtual BuildListInfo *pickedBuildObjectInView(CPoint viewPt) {return NULL;}; + virtual MapObject *picked3dObjectInView(CPoint viewPt) {return nullptr;}; + virtual BuildListInfo *pickedBuildObjectInView(CPoint viewPt) {return nullptr;}; Bool isPolygonTriggerVisible(void) {return m_showPolygonTriggers;}; Bool isWaypointVisible(void) {return m_showWaypoints;}; diff --git a/Generals/Code/Tools/WorldBuilder/include/wbview3d.h b/Generals/Code/Tools/WorldBuilder/include/wbview3d.h index f1f38c74c07..751eb8b2e68 100644 --- a/Generals/Code/Tools/WorldBuilder/include/wbview3d.h +++ b/Generals/Code/Tools/WorldBuilder/include/wbview3d.h @@ -227,7 +227,7 @@ class WbView3d : public WbView, public DX8_CleanupHook virtual void updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange); - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj); // find the best model for an object diff --git a/Generals/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp b/Generals/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp index cd7adaf8f3d..f0630a84b99 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp @@ -28,7 +28,7 @@ // BaseBuildProps dialog -BaseBuildProps::BaseBuildProps(CWnd* pParent /*=NULL*/) +BaseBuildProps::BaseBuildProps(CWnd* pParent /*=nullptr*/) : CDialog(BaseBuildProps::IDD, pParent) { //{{AFX_DATA_INIT(BaseBuildProps) diff --git a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 28484783752..d0676c592bd 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -31,7 +31,7 @@ #include "Common/TerrainTypes.h" #include "W3DDevice/GameClient/TerrainTex.h" -BlendMaterial *BlendMaterial::m_staticThis = NULL; +BlendMaterial *BlendMaterial::m_staticThis = nullptr; static Int defaultMaterialIndex = -1; @@ -40,7 +40,7 @@ static Int defaultMaterialIndex = -1; Int BlendMaterial::m_currentBlendTexture(-1); -BlendMaterial::BlendMaterial(CWnd* pParent /*=NULL*/) : +BlendMaterial::BlendMaterial(CWnd* pParent /*=nullptr*/) : m_updating(false) { //{{AFX_DATA_INIT(BlendMaterial) @@ -84,7 +84,7 @@ Bool BlendMaterial::setTerrainTreeViewSelection(HTREEITEM parent, Int selection) char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; @@ -126,7 +126,7 @@ BOOL BlendMaterial::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - //m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + //m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); //m_terrainSwatches.ShowWindow(SW_SHOW); m_staticThis = this; @@ -144,7 +144,7 @@ HTREEITEM BlendMaterial::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -268,7 +268,7 @@ BOOL BlendMaterial::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) m_currentBlendTexture = texClass; } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_terrainTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_terrainTreeView.GetChildItem(hItem); } diff --git a/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp b/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp index e3017bdaa7d..3543e35f104 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp @@ -46,8 +46,8 @@ Int BrushTool::m_brushHeight; BrushTool::BrushTool(void) : Tool(ID_BRUSH_TOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapFeatherCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapFeatherCopy = nullptr; m_brushWidth = 0; m_brushFeather = 0; diff --git a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp index 3b677d78e54..ad895aa69ce 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -37,7 +37,7 @@ #include "Common/WellKnownKeys.h" #include "wbview3d.h" -BuildList *BuildList::m_staticThis = NULL; +BuildList *BuildList::m_staticThis = nullptr; Bool BuildList::m_updating = false; @@ -45,7 +45,7 @@ Bool BuildList::m_updating = false; // BuildList dialog -BuildList::BuildList(CWnd* pParent /*=NULL*/) +BuildList::BuildList(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(BuildList) // NOTE: the ClassWizard will add member initialization here @@ -213,7 +213,7 @@ void BuildList::OnMoveUp() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } Int newSel = m_curBuildList-1; pSide->reorderInBuildList(pBuildInfo, newSel); @@ -245,9 +245,9 @@ void BuildList::OnMoveDown() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } - if (pBuildInfo->getNext() == NULL) { + if (pBuildInfo->getNext() == nullptr) { // there isn't one to move down after. return; } @@ -336,16 +336,16 @@ void BuildList::OnSelchangeBuildList() m_curBuildList = pList->GetCurSel(); Int numBL = pList->GetCount(); - SidesInfo *pSide = NULL; + SidesInfo *pSide = nullptr; if (TheSidesList) { pSide = TheSidesList->getSideInfo(m_curSide); } Int count = m_curBuildList; - BuildListInfo *pBuildInfo = NULL; + BuildListInfo *pBuildInfo = nullptr; if (pSide) { pBuildInfo = pSide->getBuildList(); } - if (count<0) pBuildInfo = NULL; + if (count<0) pBuildInfo = nullptr; while (count && pBuildInfo) { count--; pBuildInfo = pBuildInfo->getNext(); @@ -373,7 +373,7 @@ void BuildList::OnSelchangeBuildList() Bool exists; AsciiString objectTeamName = d->getAsciiString(TheKey_originalOwner, &exists); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(objectTeamName); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):AsciiString::TheEmptyString; Int energy = 0; @@ -390,7 +390,7 @@ void BuildList::OnSelchangeBuildList() { count = m_curBuildList; BuildListInfo *pBuildInfo = pSide->getBuildList(); - if (count<0) pBuildInfo = NULL; + if (count<0) pBuildInfo = nullptr; while (count>=0 && pBuildInfo) { AsciiString tName = pBuildInfo->getTemplateName(); const ThingTemplate *templ = TheThingFactory->findTemplate(tName); @@ -427,7 +427,7 @@ void BuildList::OnSelchangeBuildList() progressWnd->SetPos((Int)((1.0f-energyUsed)*100)); } - if (pBuildInfo==NULL) { + if (pBuildInfo==nullptr) { enableAttrs = false; } if (m_curBuildList > 0) { @@ -465,7 +465,7 @@ void BuildList::OnSelchangeBuildList() CButton *pBtn = (CButton *)GetDlgItem(IDC_ALREADY_BUILD); if (pBtn) pBtn->SetCheck(pBuildInfo->isInitiallyBuilt()?1:0); CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; UnsignedInt nr = pBuildInfo->getNumRebuilds(); if (nr == BuildListInfo::UNLIMITED_REBUILDS) { pCombo->SetCurSel(6); @@ -496,7 +496,7 @@ void BuildList::OnAlreadyBuild() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } CButton *pBtn = (CButton *)GetDlgItem(IDC_ALREADY_BUILD); if (pBtn) { @@ -522,7 +522,7 @@ void BuildList::OnDeleteBuilding() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pSide->removeFromBuildList(pBuildInfo); @@ -539,7 +539,7 @@ void BuildList::OnDeleteBuilding() void BuildList::OnSelendokRebuilds() { CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; Int sel = pCombo->GetCurSel(); if (sel<0) return; // no selection. UnsignedInt nr; @@ -555,7 +555,7 @@ void BuildList::OnSelendokRebuilds() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setNumRebuilds(nr); } @@ -563,7 +563,7 @@ void BuildList::OnSelendokRebuilds() void BuildList::OnEditchangeRebuilds() { CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; Int sel = pCombo->GetCurSel(); if (sel>=0) return; // An entry is selected, and handled by OnSelendokRebuilds.. char buffer[_MAX_PATH]; @@ -579,7 +579,7 @@ void BuildList::OnEditchangeRebuilds() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setNumRebuilds(nr); } @@ -596,7 +596,7 @@ void BuildList::OnDblclkBuildList() while (count) { count--; pBI = pBI->getNext(); - if (pBI == NULL) return; + if (pBI == nullptr) return; } BaseBuildProps dlg; @@ -697,7 +697,7 @@ void BuildList::OnChangeZOffset() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } Coord3D loc = *pBuildInfo->getLocation(); loc.z = m_height; @@ -725,7 +725,7 @@ void BuildList::OnChangeAngle() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setAngle(m_angle * PI/180); WbView3d *p3View = CWorldBuilderDoc::GetActiveDoc()->GetActive3DView(); @@ -734,11 +734,11 @@ void BuildList::OnChangeAngle() void BuildList::OnExport() { - static FILE *theLogFile = NULL; + static FILE *theLogFile = nullptr; Bool open = false; try { char buffer[ _MAX_PATH ]; - ::GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + ::GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *(pEnd + 1) = 0; @@ -751,12 +751,12 @@ void BuildList::OnExport() strlcat(buffer, "_BuildList.ini", ARRAY_SIZE(buffer)); theLogFile = fopen(buffer, "w"); - if (theLogFile == NULL) + if (theLogFile == nullptr) throw; AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); - DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); + DEBUG_ASSERTCRASH(pt != nullptr, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); fprintf(theLogFile, ";Skirmish AI Build List\n"); fprintf(theLogFile, "SkirmishBuildList %s\n", pt->getSide().str()); diff --git a/Generals/Code/Tools/WorldBuilder/src/BuildListTool.cpp b/Generals/Code/Tools/WorldBuilder/src/BuildListTool.cpp index aa520a4105e..3b8d10c59c7 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BuildListTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BuildListTool.cpp @@ -40,17 +40,17 @@ // Bool BuildListTool::m_isActive = false; -PickUnitDialog* BuildListTool::m_static_pickBuildingDlg = NULL; +PickUnitDialog* BuildListTool::m_static_pickBuildingDlg = nullptr; /// Constructor BuildListTool::BuildListTool(void) : Tool(ID_BUILD_LIST_TOOL, IDC_BUILD_LIST_TOOL), - m_rotateCursor(NULL), - m_pointerCursor(NULL), - m_moveCursor(NULL), + m_rotateCursor(nullptr), + m_pointerCursor(nullptr), + m_moveCursor(nullptr), m_created(false) { - m_curObject = NULL; + m_curObject = nullptr; } /// Destructor @@ -68,7 +68,7 @@ void BuildListTool::createWindow(void) m_pickBuildingDlg.SetFactionOnly(true); m_pickBuildingDlg.Create(IDD_PICKUNIT, CMainFrame::GetMainFrame()); m_pickBuildingDlg.SetupAsPanel(); - m_pickBuildingDlg.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_pickBuildingDlg.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_static_pickBuildingDlg = &m_pickBuildingDlg; m_created = true; } @@ -111,7 +111,7 @@ void BuildListTool::activate() if (!wasActive) { p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } if (!m_created) { createWindow(); @@ -126,9 +126,9 @@ void BuildListTool::deactivate() WbView3d *p3View = CWorldBuilderDoc::GetActive3DView(); Coord3D loc; loc.x=loc.y=loc.z=0; - p3View->setObjTracking(NULL, loc, 0, false); // Turn off object cursor tracking. + p3View->setObjTracking(nullptr, loc, 0, false); // Turn off object cursor tracking. p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); m_pickBuildingDlg.ShowWindow(SW_HIDE); } @@ -138,17 +138,17 @@ void BuildListTool::setCursor(void) if (isDoingAdd()) { Tool::setCursor(); // Default cursor is the adding cursor } else if (m_mouseUpMove) { - if (m_moveCursor == NULL) { + if (m_moveCursor == nullptr) { m_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_MOVE)); } ::SetCursor(m_moveCursor); } else if (m_mouseUpRotate) { - if (m_rotateCursor == NULL) { + if (m_rotateCursor == nullptr) { m_rotateCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_ROTATE)); } ::SetCursor(m_rotateCursor); } else { - if (m_pointerCursor == NULL) { + if (m_pointerCursor == nullptr) { m_pointerCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_POINTER)); } ::SetCursor(m_pointerCursor); @@ -202,11 +202,11 @@ void BuildListTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CW p3View->setObjTracking(pCur, loc, 0, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, 0, false); + p3View->setObjTracking(nullptr, loc, 0, false); } return; } - p3View->setObjTracking(NULL, cpt, 0, false); + p3View->setObjTracking(nullptr, cpt, 0, false); if (m == TRACK_NONE) { // See if the cursor is over an object. diff --git a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp index 1ba555be5d3..7fe6ab3178b 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -57,7 +57,7 @@ Undoable::~Undoable(void) /// Create a new undoable. // Undoable::Undoable(void): - mNext(NULL) + mNext(nullptr) { } @@ -90,7 +90,7 @@ WBDocUndoable::~WBDocUndoable(void) { REF_PTR_RELEASE(mPNewHeightMapData); REF_PTR_RELEASE(mPOldHeightMapData); - mPDoc = NULL; // not ref counted. + mPDoc = nullptr; // not ref counted. } @@ -98,9 +98,9 @@ WBDocUndoable::~WBDocUndoable(void) /// Create a new undoable. // WBDocUndoable::WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset): - mPNewHeightMapData(NULL), - mPOldHeightMapData(NULL), - mPDoc(NULL) + mPNewHeightMapData(nullptr), + mPOldHeightMapData(nullptr), + mPDoc(nullptr) { if (pObjOffset) { m_offsetObjects = true; @@ -143,7 +143,7 @@ void WBDocUndoable::Do(void) pBuild->setLocation(loc); } } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPNewHeightMapData->dbgVerifyAfterUndo(); } @@ -168,7 +168,7 @@ void WBDocUndoable::Redo(void) pCur->setLocation(&loc); pCur = pCur->getNext(); } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPNewHeightMapData->dbgVerifyAfterUndo(); } @@ -193,7 +193,7 @@ void WBDocUndoable::Undo(void) pCur->setLocation(&loc); pCur = pCur->getNext(); } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPOldHeightMapData->dbgVerifyAfterUndo(); } @@ -206,10 +206,10 @@ void WBDocUndoable::Undo(void) // AddObjectUndoable::~AddObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. if (!m_addedToList) { deleteInstance(m_objectToAdd); - m_objectToAdd=NULL; + m_objectToAdd=nullptr; } } @@ -218,10 +218,10 @@ AddObjectUndoable::~AddObjectUndoable(void) // AddObjectUndoable - create a new undoable. // AddObjectUndoable::AddObjectUndoable(CWorldBuilderDoc *pDoc, MapObject *pObjectToAdd): - m_pDoc(NULL), + m_pDoc(nullptr), m_numObjects(0), m_addedToList(false), - m_objectToAdd(NULL) + m_objectToAdd(nullptr) { m_pDoc = pDoc; // not ref counted. m_objectToAdd = pObjectToAdd; @@ -234,7 +234,7 @@ void AddObjectUndoable::Do(void) { // WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); MapObject *pCur = m_objectToAdd; - MapObject *pLast = NULL; + MapObject *pLast = nullptr; // Clear selection. PointerTool::clearSelection(); @@ -248,7 +248,7 @@ void AddObjectUndoable::Do(void) m_numObjects++; pCur = pCur->getNext(); } - if (pLast==NULL) { + if (pLast==nullptr) { return; } pLast->setNextMap(MapObject::getFirstMapObject()); @@ -307,7 +307,7 @@ void AddObjectUndoable::Undo(void) } if ((m_numObjects == 1) && pCur) { MapObject::TheMapObjectListPtr = pCur->getNext(); - pCur->setNextMap(NULL); + pCur->setNextMap(nullptr); m_addedToList = false; } pCur = m_objectToAdd; @@ -325,19 +325,19 @@ void AddObjectUndoable::Undo(void) ***************************************************************************/ MoveInfo::~MoveInfo(void) { - m_objectToModify=NULL; // The map info list owns these, don't delete. + m_objectToModify=nullptr; // The map info list owns these, don't delete. MoveInfo *pCur = m_next; MoveInfo *tmp; while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } } MoveInfo::MoveInfo( MapObject *pObjToMove): - m_next(NULL) + m_next(nullptr) { m_objectToModify = pObjToMove; // Not copied. m_newAngle = m_objectToModify->getAngle(); @@ -434,28 +434,28 @@ void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc) // ModifyObjectUndoable::~ModifyObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. if (m_moveList) { delete m_moveList; } - m_moveList = NULL; + m_moveList = nullptr; } // // ModifyObjectUndoable - create a new undoable. // ModifyObjectUndoable::ModifyObjectUndoable(CWorldBuilderDoc *pDoc): - m_pDoc(NULL), - m_moveList(NULL), + m_pDoc(nullptr), + m_moveList(nullptr), m_inval(false) { m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - MoveInfo *pCurInfo = NULL; + MoveInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { MoveInfo *pNew = new MoveInfo(curMapObj); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_moveList = pNew; } else { pCurInfo->m_next = pNew; @@ -513,7 +513,7 @@ void ModifyObjectUndoable::SetThingTemplate(const ThingTemplate* thing) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -529,7 +529,7 @@ void ModifyObjectUndoable::SetName(AsciiString name) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -555,7 +555,7 @@ void ModifyObjectUndoable::Redo(void) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -573,7 +573,7 @@ void ModifyObjectUndoable::Undo(void) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -582,19 +582,19 @@ void ModifyObjectUndoable::Undo(void) ***************************************************************************/ FlagsInfo::~FlagsInfo(void) { - m_objectToModify=NULL; // The map info list owns these, don't delete. + m_objectToModify=nullptr; // The map info list owns these, don't delete. FlagsInfo *pCur = m_next; FlagsInfo *tmp; while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } } FlagsInfo::FlagsInfo( MapObject *pObjToMove, Int flagMask, Int flagValue): - m_next(NULL) + m_next(nullptr) { m_objectToModify = pObjToMove; // Not copied. m_flagMask = flagMask; @@ -648,26 +648,26 @@ void FlagsInfo::UndoFlags(CWorldBuilderDoc *pDoc) // ModifyFlagsUndoable::~ModifyFlagsUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. delete m_flagsList; - m_flagsList = NULL; + m_flagsList = nullptr; } // // ModifyFlagsUndoable - create a new undoable. // ModifyFlagsUndoable::ModifyFlagsUndoable(CWorldBuilderDoc *pDoc, Int flagMask, Int flagValue): - m_pDoc(NULL), - m_flagsList(NULL) + m_pDoc(nullptr), + m_flagsList(nullptr) { m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - FlagsInfo *pCurInfo = NULL; + FlagsInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { FlagsInfo *pNew = new FlagsInfo(curMapObj, flagMask, flagValue); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_flagsList = pNew; } else { pCurInfo->m_next = pNew; @@ -739,7 +739,7 @@ void SidesListUndoable::Do(void) BuildList::update(); WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } void SidesListUndoable::Undo(void) @@ -751,7 +751,7 @@ void SidesListUndoable::Undo(void) BuildList::update(); WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } /************************************************************************* @@ -798,7 +798,7 @@ void DictItemUndoable::Do(void) if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -815,7 +815,7 @@ void DictItemUndoable::Undo(void) if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -864,18 +864,18 @@ DeleteInfo::~DeleteInfo(void) while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } - m_objectToDelete=NULL; - m_priorObject=NULL; + m_objectToDelete=nullptr; + m_priorObject=nullptr; } DeleteInfo::DeleteInfo( MapObject *pObjectToDelete): - m_objectToDelete(NULL), + m_objectToDelete(nullptr), m_didDelete(false), - m_next(NULL), - m_priorObject(NULL) + m_next(nullptr), + m_priorObject(nullptr) { m_objectToDelete = pObjectToDelete; // Not copied. } @@ -886,7 +886,7 @@ DeleteInfo::DeleteInfo( MapObject *pObjectToDelete): void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) { DEBUG_ASSERTCRASH(!m_didDelete,("oops")); - m_priorObject = NULL; + m_priorObject = nullptr; MapObject *curMapObj = MapObject::getFirstMapObject(); Bool found = false; while (curMapObj) { @@ -899,7 +899,7 @@ void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) } DEBUG_ASSERTCRASH(found,("not found")); if (!found) { - m_objectToDelete = NULL; + m_objectToDelete = nullptr; return; } if (m_priorObject) { @@ -908,7 +908,7 @@ void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr == m_objectToDelete,("oops")); MapObject::TheMapObjectListPtr = MapObject::TheMapObjectListPtr->getNext(); } - m_objectToDelete->setNextMap(NULL); + m_objectToDelete->setNextMap(nullptr); m_didDelete = true; } @@ -919,7 +919,7 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) if (m_priorObject) { m_objectToDelete->setNextMap(m_priorObject->getNext()); m_priorObject->setNextMap(m_objectToDelete); - m_priorObject = NULL; + m_priorObject = nullptr; } else { m_objectToDelete->setNextMap(MapObject::TheMapObjectListPtr); MapObject::TheMapObjectListPtr = m_objectToDelete; @@ -935,10 +935,10 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) // DeleteObjectUndoable::~DeleteObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. delete m_deleteList; - m_deleteList=NULL; + m_deleteList=nullptr; } @@ -946,8 +946,8 @@ DeleteObjectUndoable::~DeleteObjectUndoable(void) // DeleteObjectUndoable - create a new undoable. Deletes all selected objects. // DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): - m_pDoc(NULL), - m_deleteList(NULL) + m_pDoc(nullptr), + m_deleteList(nullptr) { // Note - you can't delete just one end of a map segment. So delete both. MapObject *pMapObj; @@ -956,7 +956,7 @@ DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); DEBUG_ASSERTCRASH(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("oops")); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; // If one end of a road segment is selected, both are. if (pMapObj->isSelected() || pMapObj2->isSelected()) { @@ -969,11 +969,11 @@ DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - DeleteInfo *pCurInfo = NULL; + DeleteInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { DeleteInfo *pNew = new DeleteInfo(curMapObj); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_deleteList = pNew; } else { pCurInfo->m_next = pNew; @@ -992,7 +992,7 @@ void DeleteObjectUndoable::Do(void) { WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); DeleteInfo *pCur = m_deleteList; - DeleteInfo *pInvertedList = NULL; + DeleteInfo *pInvertedList = nullptr; while (pCur) { // first, remove it from the Layers list. TheLayersList->removeMapObjectFromLayersList(pCur->m_objectToDelete); @@ -1007,7 +1007,7 @@ void DeleteObjectUndoable::Do(void) WbView3d *p3View = m_pDoc->GetActive3DView(); if (p3View) { // Shouldn't ever be null, but just in case... jba. p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } m_deleteList = pInvertedList; } @@ -1019,7 +1019,7 @@ void DeleteObjectUndoable::Undo(void) { WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); DeleteInfo *pCur = m_deleteList; - DeleteInfo *pInvertedList=NULL; + DeleteInfo *pInvertedList=nullptr; while (pCur) { // Re-Add it to the layers list Dict* objDict = pCur->m_objectToDelete->getProperties(); @@ -1047,10 +1047,10 @@ void DeleteObjectUndoable::Undo(void) AddPolygonUndoable::~AddPolygonUndoable(void) { if (m_trigger && !m_isTriggerInList) { - DEBUG_ASSERTCRASH(m_trigger->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(m_trigger->getNext()==nullptr, ("Logic error.")); deleteInstance(m_trigger); } - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1089,7 +1089,7 @@ void AddPolygonUndoable::Undo(void) // AddPolygonPointUndoable::~AddPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1128,7 +1128,7 @@ void AddPolygonPointUndoable::Undo(void) // ModifyPolygonPointUndoable::~ModifyPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1167,7 +1167,7 @@ void ModifyPolygonPointUndoable::Undo(void) // MovePolygonUndoable::~MovePolygonUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1240,7 +1240,7 @@ void MovePolygonUndoable::Undo(void) // InsertPolygonPointUndoable::~InsertPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1277,7 +1277,7 @@ void InsertPolygonPointUndoable::Undo(void) // DeletePolygonPointUndoable::~DeletePolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1315,10 +1315,10 @@ void DeletePolygonPointUndoable::Undo(void) DeletePolygonUndoable::~DeletePolygonUndoable(void) { if (m_trigger && !m_isTriggerInList) { - DEBUG_ASSERTCRASH(m_trigger->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(m_trigger->getNext()==nullptr, ("Logic error.")); deleteInstance(m_trigger); } - m_trigger=NULL; + m_trigger=nullptr; } // diff --git a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp index a998b7869be..32f1633aac8 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -30,7 +30,7 @@ // CameraOptions dialog -CameraOptions::CameraOptions(CWnd* pParent /*=NULL*/) +CameraOptions::CameraOptions(CWnd* pParent /*=nullptr*/) : CDialog(CameraOptions::IDD, pParent) { m_updating = false; diff --git a/Generals/Code/Tools/WorldBuilder/src/CellWidth.cpp b/Generals/Code/Tools/WorldBuilder/src/CellWidth.cpp index 25a4440e3b4..a2fd1b0a95d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CellWidth.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CellWidth.cpp @@ -27,7 +27,7 @@ // CellWidth dialog /// Constructor and set initial cell width. -CellWidth::CellWidth(int cellWidth, CWnd* pParent /*=NULL*/) +CellWidth::CellWidth(int cellWidth, CWnd* pParent /*=nullptr*/) : CDialog(CellWidth::IDD, pParent), mCellWidth(cellWidth) { diff --git a/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp index 6309e481e9d..ea1bc9dea10 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp @@ -33,7 +33,7 @@ Int ContourOptions::m_contourWidth = 1; /// ContourOptions dialog trivial construstor - Create does the real work. -ContourOptions::ContourOptions(CWnd* pParent /*=NULL*/) +ContourOptions::ContourOptions(CWnd* pParent /*=nullptr*/) : CDialog(ContourOptions::IDD, pParent) { //{{AFX_DATA_INIT(ContourOptions) diff --git a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp index db327f00a1a..31fd2eede39 100644 --- a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -136,22 +136,22 @@ DrawObject::~DrawObject(void) DrawObject::DrawObject(void) : m_drawObjects(true), m_drawPolygonAreas(true), - m_indexBuffer(NULL), - m_vertexMaterialClass(NULL), - m_vertexBufferTile1(NULL), - m_vertexBufferTile2(NULL), - m_vertexBufferWater(NULL), - m_vertexFeedback(NULL), - m_indexFeedback(NULL), - m_indexWater(NULL), - m_moldMesh(NULL) + m_indexBuffer(nullptr), + m_vertexMaterialClass(nullptr), + m_vertexBufferTile1(nullptr), + m_vertexBufferTile2(nullptr), + m_vertexBufferWater(nullptr), + m_vertexFeedback(nullptr), + m_indexFeedback(nullptr), + m_indexWater(nullptr), + m_moldMesh(nullptr) { m_feedbackPoint.x = 20; m_feedbackPoint.y = 20; initData(); m_waterDrawObject = new WaterRenderObjClass; - m_waterDrawObject->init(0, 0, 0, NULL, WaterRenderObjClass::WATER_TYPE_0_TRANSLUCENT); + m_waterDrawObject->init(0, 0, 0, nullptr, WaterRenderObjClass::WATER_TYPE_0_TRANSLUCENT); TheWaterRenderObj=m_waterDrawObject; } @@ -215,7 +215,7 @@ Int DrawObject::freeMapResources(void) REF_PTR_RELEASE(m_indexWater); REF_PTR_RELEASE(m_moldMesh); REF_PTR_RELEASE(m_waterDrawObject); - TheWaterRenderObj = NULL; + TheWaterRenderObj = nullptr; return 0; } @@ -282,11 +282,11 @@ void DrawObject::updateMeshVB(void) REF_PTR_RELEASE(m_moldMesh); m_curMeshModelName = MeshMoldOptions::getModelName(); } - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); pMgr->Set_WW3D_Load_On_Demand(false); // We don't want it fishing for these assets in the game assets. m_moldMesh = (MeshClass*)pMgr->Create_Render_Obj(m_curMeshModelName.str()); - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { // Try loading the mold asset. AsciiString path("data\\editor\\molds\\"); path.concat(m_curMeshModelName); @@ -299,7 +299,7 @@ void DrawObject::updateMeshVB(void) } pMgr->Set_WW3D_Load_On_Demand(true); } - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { return; } @@ -314,7 +314,7 @@ void DrawObject::updateMeshVB(void) VertexFormatXYZDUV1 *vb = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array(); VertexFormatXYZDUV1 *curVb = vb; - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { return; } Int i; @@ -354,7 +354,7 @@ void DrawObject::updateMeshVB(void) #if 1 curVb->diffuse = 0x0000ffff | (theAlpha << 24); // bright cyan. #else - TheTerrainRenderObject->doTheLight(&vb, &lightRay, (Vector3 *)(&pNormal[i]), NULL, 1.0f); + TheTerrainRenderObject->doTheLight(&vb, &lightRay, (Vector3 *)(&pNormal[i]), nullptr, 1.0f); vb.diffuse &= 0x0000ffff; curVb->diffuse = vb.diffuse | (theAlpha << 24); #endif @@ -577,33 +577,33 @@ void DrawObject::updateBoundaryVB(void) startPt.x = startPt.y = 0; startPt.x *= MAP_XY_FACTOR; startPt.y *= MAP_XY_FACTOR; - startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, NULL); + startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, nullptr); endPt.x = 0; endPt.y = curBoundary.y; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 1) { startPt = endPt; endPt.x = curBoundary.x; endPt.y = curBoundary.y; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 2) { startPt = endPt; endPt.x = curBoundary.x; endPt.y = 0; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 3) { startPt = endPt; endPt.x = 0; endPt.y = 0; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } if ((m_feedbackVertexCount + 8) > NUM_FEEDBACK_VERTEX) { @@ -743,7 +743,7 @@ void DrawObject::updateAmbientSoundVB(void) } Coord3D startPt = *mo->getLocation(); - startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, NULL); + startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, nullptr); if (m_feedbackVertexCount + 6 > NUM_FEEDBACK_VERTEX) { return; @@ -904,8 +904,8 @@ void DrawObject::updateWaypointVB(void) normal *= 0.5f; // Rotate the normal 90 degrees. normal.Rotate_Z(PI/2); - loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, NULL); - loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, NULL); + loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, nullptr); + loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, nullptr); if (m_feedbackVertexCount+9>= NUM_FEEDBACK_VERTEX) { return; @@ -1090,7 +1090,7 @@ void DrawObject::updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOp ICoord3D iLoc = *pTrig->getPoint(i); loc1.x = iLoc.x; loc1.y = iLoc.y; - loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, NULL); + loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, nullptr); if (igetNumPoints()-1) { iLoc = *pTrig->getPoint(i+1); } else { @@ -1099,7 +1099,7 @@ void DrawObject::updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOp } loc2.x = iLoc.x; loc2.y = iLoc.y; - loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, NULL); + loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, nullptr); Vector3 normal(loc2.x-loc1.x, loc2.y-loc1.y, loc2.z-loc1.z); normal.Normalize(); normal *= 0.5f; @@ -1233,11 +1233,11 @@ void DrawObject::updateFeedbackVB(void) if (doubleResolution) { X = ADJUST_FROM_INDEX_TO_REAL(i)/2.0f + ADJUST_FROM_INDEX_TO_REAL(2*offset+m_cellCenter.x) / 2.0; Y = ADJUST_FROM_INDEX_TO_REAL(j)/2.0f + ADJUST_FROM_INDEX_TO_REAL(2*offset+m_cellCenter.y) / 2.0; - theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, NULL); + theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, nullptr); } else { X = ADJUST_FROM_INDEX_TO_REAL(i); Y = ADJUST_FROM_INDEX_TO_REAL(j); - theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, NULL); + theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, nullptr); } curVb->u1 = 0; curVb->v1 = 0; @@ -1608,7 +1608,7 @@ void DrawObject::setFeedbackPos(Coord3D pos) void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, Real rampWidth) { - DEBUG_ASSERTCRASH(start && end, ("Parameter passed into setRampFeedbackParms was NULL. Not allowed")); + DEBUG_ASSERTCRASH(start && end, ("Parameter passed into setRampFeedbackParms was null. Not allowed")); if (!(start && end)) { return; } @@ -1627,7 +1627,7 @@ void DrawObject::Render(RenderInfoClass & rinfo) DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Apply_Render_State_Changes(); Int count=0; Int i; @@ -1648,7 +1648,7 @@ void DrawObject::Render(RenderInfoClass & rinfo) Coord3D loc = *pMapObj->getLocation(); if (TheTerrainRenderObject) { - loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); } // Cull. SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); @@ -1709,8 +1709,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer if (m_drawPolygonAreas) { Int selected; @@ -1726,7 +1726,7 @@ void DrawObject::Render(RenderInfoClass & rinfo) Coord3D loc; loc.x = iLoc.x; loc.y = iLoc.y; - loc.z = TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z = TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); if (rinfo.Camera.Cull_Sphere(bounds)) { continue; @@ -1775,15 +1775,15 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer if (BuildListTool::isActive()) for (i=0; igetNumSides(); i++) { SidesInfo *pSide = TheSidesList->getSideInfo(i); for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { Coord3D loc = *pBuild->getLocation(); if (TheTerrainRenderObject) { - loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); } // Cull. SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); @@ -1823,8 +1823,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer Matrix3D tmReset(Transform); DX8Wrapper::Set_Transform(D3DTS_WORLD,tmReset); @@ -1841,8 +1841,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer #if 1 if (m_meshFeedback) { @@ -1865,8 +1865,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } #endif - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer #if 1 if (m_rampFeedback) { @@ -1882,8 +1882,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } #endif - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer #if 1 if (m_boundaryFeedback) { @@ -1900,8 +1900,8 @@ void DrawObject::Render(RenderInfoClass & rinfo) } #endif - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer if (m_ambientSoundFeedback) { diff --git a/Generals/Code/Tools/WorldBuilder/src/EditAction.cpp b/Generals/Code/Tools/WorldBuilder/src/EditAction.cpp index 6c0e522a531..c7bce6af8ef 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditAction.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditAction.cpp @@ -30,7 +30,7 @@ // EditAction dialog -EditAction::EditAction(CWnd* pParent /*=NULL*/) +EditAction::EditAction(CWnd* pParent /*=nullptr*/) : CDialog(EditAction::IDD, pParent) { //{{AFX_DATA_INIT(EditAction) diff --git a/Generals/Code/Tools/WorldBuilder/src/EditCondition.cpp b/Generals/Code/Tools/WorldBuilder/src/EditCondition.cpp index 4db1f526984..4ea362a23aa 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditCondition.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditCondition.cpp @@ -29,7 +29,7 @@ // EditCondition dialog -EditCondition::EditCondition(CWnd* pParent /*=NULL*/) +EditCondition::EditCondition(CWnd* pParent /*=nullptr*/) : CDialog(EditCondition::IDD, pParent) { //{{AFX_DATA_INIT(EditCondition) diff --git a/Generals/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp index ddf29114adc..31b897cfae8 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp @@ -30,7 +30,7 @@ // EditCoordParameter dialog -EditCoordParameter::EditCoordParameter(CWnd* pParent /*=NULL*/) +EditCoordParameter::EditCoordParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditCoordParameter::IDD, pParent) { //{{AFX_DATA_INIT(EditCoordParameter) diff --git a/Generals/Code/Tools/WorldBuilder/src/EditGroup.cpp b/Generals/Code/Tools/WorldBuilder/src/EditGroup.cpp index cb3953b4040..ed5052bcbb4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditGroup.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditGroup.cpp @@ -28,7 +28,7 @@ // EditGroup dialog -EditGroup::EditGroup(ScriptGroup *pGroup, CWnd* pParent /*=NULL*/) +EditGroup::EditGroup(ScriptGroup *pGroup, CWnd* pParent /*=nullptr*/) : CDialog(EditGroup::IDD, pParent), m_scriptGroup(pGroup) { diff --git a/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp index 72fa5685923..5e7c6568182 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp @@ -38,7 +38,7 @@ // EditObjectParameter dialog -EditObjectParameter::EditObjectParameter(CWnd* pParent /*=NULL*/) +EditObjectParameter::EditObjectParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditObjectParameter::IDD, pParent) { //{{AFX_DATA_INIT(EditObjectParameter) @@ -119,7 +119,7 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) // first sort by Side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH(!side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH(!side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -176,7 +176,7 @@ void EditObjectParameter::addObjectLists( ) parent = findOrAdd(parent, "Object Lists"); std::vector strings; - EditParameter::loadObjectTypeList(NULL, &strings); + EditParameter::loadObjectTypeList(nullptr, &strings); Int numItems = strings.size(); @@ -209,7 +209,7 @@ HTREEITEM EditObjectParameter::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; diff --git a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp index 3f8321d85c9..d1321a2f06a 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -74,7 +74,7 @@ AsciiString EditParameter::m_selectedLocalizedString = AsciiString::TheEmptyString; AsciiString EditParameter::m_unitName = AsciiString::TheEmptyString; -EditParameter::EditParameter(CWnd* pParent /*=NULL*/) +EditParameter::EditParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditParameter::IDD, pParent), m_int(0), m_real(0) @@ -103,7 +103,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // EditParameter message handlers -SidesList *EditParameter::m_sidesListP = NULL; +SidesList *EditParameter::m_sidesListP = nullptr; Int EditParameter::edit( Parameter *pParm, AsciiString unitName ) { @@ -166,13 +166,13 @@ AsciiString EditParameter::getWarningText(Parameter *pParm) DEBUG_CRASH(("Unknown parameter type.")); break; case Parameter::SCRIPT: - if (!loadScripts(NULL, false, uiString)) { + if (!loadScripts(nullptr, false, uiString)) { warningText.format("Script '%s' does not exist.", uiString.str()); } break; case Parameter::SCRIPT_SUBROUTINE: - if (!loadScripts(NULL, true, uiString)) { - if (!loadScripts(NULL, false, uiString)) { + if (!loadScripts(nullptr, true, uiString)) { + if (!loadScripts(nullptr, false, uiString)) { warningText.format("Script '%s' does not exist.", uiString.str()); } else { warningText.format("Script '%s' is not a subroutine.", uiString.str()); @@ -180,32 +180,32 @@ AsciiString EditParameter::getWarningText(Parameter *pParm) } break; case Parameter::ATTACK_PRIORITY_SET: - if (!loadAttackPrioritySets(NULL, uiString)) { + if (!loadAttackPrioritySets(nullptr, uiString)) { warningText.format("Attack priority set '%s' does not exist.", uiString.str()); } break; case Parameter::WAYPOINT: - if (!loadWaypoints(NULL, uiString)) { + if (!loadWaypoints(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::WAYPOINT_PATH: - if (!loadWaypointPaths(NULL, uiString)) { + if (!loadWaypointPaths(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::TRIGGER_AREA: - if (!loadTriggerAreas(NULL, uiString)) { + if (!loadTriggerAreas(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::COMMAND_BUTTON: - if (!loadCommandButtons(NULL, uiString)) { + if (!loadCommandButtons(nullptr, uiString)) { warningText.format("Command button '%s' does not exist.", uiString.str()); } break; case Parameter::FONT_NAME: - if(!loadFontNames(NULL, uiString)) { + if(!loadFontNames(nullptr, uiString)) { warningText.format("Font '%s' does not exist.", uiString.str()); } break; @@ -214,43 +214,43 @@ AsciiString EditParameter::getWarningText(Parameter *pParm) case Parameter::TEXT_STRING: break; case Parameter::LOCALIZED_TEXT: - if (loadLocalizedText(NULL, uiString) == AsciiString::TheEmptyString) { + if (loadLocalizedText(nullptr, uiString) == AsciiString::TheEmptyString) { warningText.format("Localized string '%s' does not exist.", uiString.str()); } break; case Parameter::SOUND: - if (!loadAudioType(Parameter::SOUND, NULL, uiString)) { + if (!loadAudioType(Parameter::SOUND, nullptr, uiString)) { warningText.format("Sound '%s' does not exist.", uiString.str()); } break; case Parameter::TEAM: - if (!loadTeams(NULL, uiString)) { + if (!loadTeams(nullptr, uiString)) { warningText.format("Team '%s' does not exist.", uiString.str()); } break; case Parameter::BRIDGE: - if (!loadBridges(NULL, uiString)) { + if (!loadBridges(nullptr, uiString)) { warningText.format("Bridge '%s' does not exist.", uiString.str()); } break; case Parameter::UNIT: - if (!loadUnits(NULL, uiString)) { + if (!loadUnits(nullptr, uiString)) { warningText.format("Unit '%s' does not exist.", uiString.str()); } break; case Parameter::OBJECT_TYPE: - if (!loadObjectType(NULL, uiString)) { + if (!loadObjectType(nullptr, uiString)) { warningText.format("Object type '%s' does not exist.", uiString.str()); } break; case Parameter::SIDE: - if (!loadSides(NULL, uiString)) { + if (!loadSides(nullptr, uiString)) { warningText.format("Player '%s' does not exist.", uiString.str()); } break; case Parameter::OBJECT_PANEL_FLAG: - if (!loadObjectFlags(NULL, uiString)) { + if (!loadObjectFlags(nullptr, uiString)) { warningText.format("Object flag '%s' is unrecognized.", uiString.str()); } break; @@ -297,19 +297,19 @@ AsciiString EditParameter::getWarningText(Parameter *pParm) break; case Parameter::DIALOG: - if (!loadAudioType(Parameter::DIALOG, NULL, uiString)) { + if (!loadAudioType(Parameter::DIALOG, nullptr, uiString)) { warningText.format("Dialog '%s' does not exist.", uiString.str()); } break; case Parameter::MUSIC: - if (!loadAudioType(Parameter::MUSIC, NULL, uiString)) { + if (!loadAudioType(Parameter::MUSIC, nullptr, uiString)) { warningText.format("Track '%s' does not exist.", uiString.str()); } break; case Parameter::MOVIE: - if (!loadMovies(NULL, uiString)) { + if (!loadMovies(nullptr, uiString)) { AsciiString commentFromINI; if (!getMovieComment(uiString, commentFromINI)) { warningText.format("Movie '%s' does not exit.", uiString.str()); @@ -320,26 +320,26 @@ AsciiString EditParameter::getWarningText(Parameter *pParm) break; case Parameter::SPECIAL_POWER: - if (!loadSpecialPowers(NULL, uiString)) { + if (!loadSpecialPowers(nullptr, uiString)) { warningText.format("Special Power '%s' does not exist.", uiString.str()); } break; case Parameter::SCIENCE: - if (!loadSciences(NULL, uiString)) { + if (!loadSciences(nullptr, uiString)) { warningText.format("Science '%s' does not exist.", uiString.str()); } break; case Parameter::SCIENCE_AVAILABILITY: - if( !loadScienceAvailabilities( NULL, uiString ) ) + if( !loadScienceAvailabilities( nullptr, uiString ) ) { warningText.format( "Science availability '%s' does not exist.", uiString.str() ); } break; case Parameter::UPGRADE: - if (!loadUpgrades(NULL, uiString)) { + if (!loadUpgrades(nullptr, uiString)) { warningText.format("Upgrade '%s' does not exist.", uiString.str()); } break; @@ -667,7 +667,7 @@ void EditParameter::loadCounters(CComboBox *pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -691,7 +691,7 @@ Bool EditParameter::loadAttackPrioritySets(CComboBox *pCombo, AsciiString match) Int i; Bool found = false; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -829,7 +829,7 @@ Bool EditParameter::loadAbilities( CComboBox *pCombo, AsciiString match ) break; } } - const ThingTemplate *theTemplate = NULL; + const ThingTemplate *theTemplate = nullptr; if ( theUnit ) { theTemplate = theUnit->getThingTemplate(); @@ -949,7 +949,7 @@ void EditParameter::loadFlags(CComboBox *pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -975,7 +975,7 @@ Bool EditParameter::loadObjectType(CComboBox *pCombo, AsciiString match) Bool didMatch = false; - didMatch = loadObjectTypeList(pCombo, NULL, match); + didMatch = loadObjectTypeList(pCombo, nullptr, match); // add entries from the thing factory as the available objects to use const ThingTemplate *tTemplate; @@ -1209,12 +1209,12 @@ Bool EditParameter::loadCommandButtons(CComboBox *pCombo, AsciiString match) while (fp->eof() == FALSE) { token = strtok(string, seps); - if( token != NULL ) + if( token != nullptr ) { if( strcmp( token, "CommandButton" ) == 0) { - token = strtok(NULL, seps); - if( token != NULL ) + token = strtok(nullptr, seps); + if( token != nullptr ) { if (pCombo) pCombo->AddString(token); if (strcmp(match.str(), token) == 0) didMatch = true; @@ -1226,7 +1226,7 @@ Bool EditParameter::loadCommandButtons(CComboBox *pCombo, AsciiString match) } fp->close(); - fp = NULL; + fp = nullptr; return didMatch; } @@ -1267,7 +1267,7 @@ Bool EditParameter::loadFontNames(CComboBox *pCombo, AsciiString match) // delete the font library TheFontLibrary->reset(); delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; return didMatch; } @@ -1280,17 +1280,17 @@ void EditParameter::readFontFile( const char *filename ) File *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = TheFileSystem->openFile( filename, File::READ | File::TEXT); - if( fp == NULL ) + if( fp == nullptr ) return; // read how many entries follow Int fontCount; - fp->read(NULL, sizeof("AVAILABLE_FONT_COUNT = ")); + fp->read(nullptr, sizeof("AVAILABLE_FONT_COUNT = ")); fp->scanInt(fontCount); for( Int i = 0; i < fontCount; i++ ) @@ -1328,7 +1328,7 @@ void EditParameter::readFontFile( const char *filename ) // set the font GameFont *font = TheFontLibrary->getFont( AsciiString(fontBuffer), size, bold ); - if( font == NULL ) + if( font == nullptr ) { char buffer[ 1024 ]; @@ -1342,7 +1342,7 @@ void EditParameter::readFontFile( const char *filename ) // close the file fp->close(); - fp = NULL; + fp = nullptr; } @@ -1419,11 +1419,11 @@ Bool EditParameter::loadScripts(CComboBox *pCombo, Bool subr, AsciiString match) if (pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; Bool didMatch = false; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (subr && !pScr->isSubroutine()) continue; @@ -1460,7 +1460,7 @@ Bool EditParameter::loadSides(CComboBox *pCombo, AsciiString match) if (match == THIS_PLAYER_ENEMY) didMatch=true; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { Dict *d = sidesListP->getSideInfo(i)->getDict(); AsciiString name = d->getAsciiString(TheKey_playerName); @@ -1483,7 +1483,7 @@ Bool EditParameter::loadTeams(CComboBox *pCombo, AsciiString match) if (match == ANY_TEAM) didMatch=true; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i = 0; i < sidesListP->getNumTeams(); i++) { Dict *d = sidesListP->getTeamInfo(i)->getDict(); @@ -1508,7 +1508,7 @@ Bool EditParameter::loadTeamOrUnit(CComboBox *pCombo, AsciiString match) Bool didMatch = false; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i = 0; i < sidesListP->getNumTeams(); i++) { Dict *d = sidesListP->getTeamInfo(i)->getDict(); @@ -1581,7 +1581,7 @@ Bool EditParameter::loadUnits(CComboBox *pCombo, AsciiString match) SidesList *sidesListP = m_sidesListP; Int i; - if (sidesListP==NULL) + if (sidesListP==nullptr) { sidesListP = TheSidesList; } @@ -2197,7 +2197,7 @@ void EditParameter::OnOK() case Parameter::LOCALIZED_TEXT: pCombo->GetWindowText(txt); comboText = AsciiString(txt); - m_parameter->friend_setString(loadLocalizedText(NULL, comboText)); + m_parameter->friend_setString(loadLocalizedText(nullptr, comboText)); break; case Parameter::BOUNDARY: { @@ -2284,7 +2284,7 @@ void EditParameter::OnPreviewSound() event.generateFilename(); if (!event.getFilename().isEmpty()) { - PlaySound(event.getFilename().str(), NULL, SND_ASYNC | SND_FILENAME | SND_PURGE); + PlaySound(event.getFilename().str(), nullptr, SND_ASYNC | SND_FILENAME | SND_PURGE); } } } diff --git a/Generals/Code/Tools/WorldBuilder/src/EulaDialog.cpp b/Generals/Code/Tools/WorldBuilder/src/EulaDialog.cpp index 038f5d440b2..1ec06311360 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EulaDialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EulaDialog.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // EulaDialog dialog -EulaDialog::EulaDialog(CWnd* pParent /*=NULL*/) +EulaDialog::EulaDialog(CWnd* pParent /*=nullptr*/) : CDialog(EulaDialog::IDD, pParent) { //{{AFX_DATA_INIT(EulaDialog) diff --git a/Generals/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp index fea78fb4385..1fcad1a76eb 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp @@ -30,7 +30,7 @@ Bool ExportScriptsOptions::m_waypoints = true; Bool ExportScriptsOptions::m_triggers = true; Bool ExportScriptsOptions::m_allScripts = false; -ExportScriptsOptions::ExportScriptsOptions(CWnd* pParent /*=NULL*/) +ExportScriptsOptions::ExportScriptsOptions(CWnd* pParent /*=nullptr*/) : CDialog(ExportScriptsOptions::IDD, pParent) { //{{AFX_DATA_INIT(ExportScriptsOptions) diff --git a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index e8365374079..6d6db24f6da 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "FeatherTool.h" -FeatherOptions *FeatherOptions::m_staticThis = NULL; +FeatherOptions *FeatherOptions::m_staticThis = nullptr; Int FeatherOptions::m_currentFeather = 0; Int FeatherOptions::m_currentRate = 3; Int FeatherOptions::m_currentRadius = 1; @@ -34,7 +34,7 @@ Int FeatherOptions::m_currentRadius = 1; /// FeatherOptions dialog trivial construstor - Create does the real work. -FeatherOptions::FeatherOptions(CWnd* pParent /*=NULL*/) +FeatherOptions::FeatherOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(FeatherOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp b/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp index 117004025ff..c41273b9f1c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp @@ -42,9 +42,9 @@ Int FeatherTool::m_radius = 0; FeatherTool::FeatherTool(void) : Tool(ID_FEATHERTOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapFeatherCopy = NULL; - m_htMapRateCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapFeatherCopy = nullptr; + m_htMapRateCopy = nullptr; } /// Destructor diff --git a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp index 0b4885ad5c1..9009a11db7b 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -45,7 +45,7 @@ so forth is all handled in the object options panel. jba. */ #include -FenceOptions *FenceOptions::m_staticThis = NULL; +FenceOptions *FenceOptions::m_staticThis = nullptr; Bool FenceOptions::m_updating = false; Int FenceOptions::m_currentObjectIndex=-1; Real FenceOptions::m_fenceSpacing=1; @@ -56,9 +56,9 @@ Real FenceOptions::m_fenceOffset=0; // FenceOptions dialog -FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) +FenceOptions::FenceOptions(CWnd* pParent /*=nullptr*/) { - m_objectsList = NULL; + m_objectsList = nullptr; m_customSpacing = false; //{{AFX_DATA_INIT(FenceOptions) // NOTE: the ClassWizard will add member initialization here @@ -69,7 +69,7 @@ FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) FenceOptions::~FenceOptions(void) { deleteInstance(m_objectsList); - m_objectsList = NULL; + m_objectsList = nullptr; } @@ -153,7 +153,7 @@ BOOL FenceOptions::OnInitDialog() if (tTemplate->getFenceWidth() == 0) continue; // create new map object - pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; @@ -206,7 +206,7 @@ HTREEITEM FenceOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -236,10 +236,10 @@ HTREEITEM FenceOptions::findOrAdd(HTREEITEM parent, const char *pLabel) void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const char *name, Int terrainNdx, HTREEITEM parent ) { - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -260,7 +260,7 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -334,7 +334,7 @@ Bool FenceOptions::setObjectTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; diff --git a/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp b/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp index c7d89109b8a..60a5793ace4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FenceTool.cpp @@ -39,7 +39,7 @@ /// Constructor FenceTool::FenceTool(void) : Tool(ID_FENCE_TOOL, IDC_FENCE), - m_mapObjectList(NULL), + m_mapObjectList(nullptr), m_objectCount(1) { m_curObjectWidth = 27.35f; @@ -50,7 +50,7 @@ FenceTool::FenceTool(void) : FenceTool::~FenceTool(void) { deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; + m_mapObjectList = nullptr; } void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView, CWorldBuilderDoc *pDoc, Bool checkPlayers) @@ -83,22 +83,22 @@ void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView normalDelta.normalize(); Int i; - if (m_mapObjectList == NULL) return; + if (m_mapObjectList == nullptr) return; MapObject *pCurObj = m_mapObjectList; for (i=1; igetNext() == NULL) { + if (pCurObj->getNext() == nullptr) { pCurObj->setNextMap(ObjectOptions::duplicateCurMapObjectForPlace(&downPt, angle, checkPlayers)); } pCurObj=pCurObj->getNext(); - if (pCurObj == NULL) return; + if (pCurObj == nullptr) return; } WbView3d *p3View = pDoc->GetActive3DView(); MapObject *pXtraObjects = pCurObj->getNext(); - pCurObj->setNextMap(NULL); + pCurObj->setNextMap(nullptr); if (pXtraObjects) { p3View->removeFenceListObjects(pXtraObjects); deleteInstance(pXtraObjects); - pXtraObjects = NULL; + pXtraObjects = nullptr; } pCurObj = m_mapObjectList; @@ -126,9 +126,9 @@ void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView void FenceTool::deactivate() { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// Shows the object options panel void FenceTool::activate() @@ -136,9 +136,9 @@ void FenceTool::activate() CMainFrame::GetMainFrame()->showOptionsDialog(IDD_FENCE_OPTIONS); DrawObject::setDoBrushFeedback(false); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); FenceOptions::update(); } @@ -154,7 +154,7 @@ void FenceTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB m_downPt3d = cpt; deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; + m_mapObjectList = nullptr; if (FenceOptions::hasSelectedObject()) { FenceOptions::update(); @@ -177,12 +177,12 @@ void FenceTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld pView->snapPoint(&loc); Real angle = 0 ; if (m == TRACK_L) { // Mouse is down, so fence. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); updateMapObjectList(m_downPt3d,loc, pView, pDoc, false); return; } MapObject *pCur = ObjectOptions::getObjectNamed(AsciiString(ObjectOptions::getCurObjectName())); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); loc.z = ObjectOptions::getCurObjectHeight(); if (pCur && FenceOptions::hasSelectedObject()) { // Display the transparent version of this object. @@ -191,7 +191,7 @@ void FenceTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld p3View->setObjTracking(pCur, loc, angle, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); } } @@ -210,7 +210,7 @@ void FenceTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBui AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_mapObjectList); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObjectList = NULL; // undoable owns it now. + m_mapObjectList = nullptr; // undoable owns it now. } } diff --git a/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp b/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp index 328370274de..9ab949deba4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp @@ -40,7 +40,7 @@ Bool FloodFillTool::m_adjustCliffTextures = false; /// Constructor FloodFillTool::FloodFillTool(void) : Tool(ID_TILE_FLOOD_FILL, IDC_FLOOD_FILL), - m_cliffCursor(NULL) + m_cliffCursor(nullptr) { } @@ -66,7 +66,7 @@ void FloodFillTool::activate() void FloodFillTool::setCursor(void) { if (m_adjustCliffTextures) { - if (m_cliffCursor == NULL) { + if (m_cliffCursor == nullptr) { m_cliffCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_CLIFF)); } ::SetCursor(m_cliffCursor); diff --git a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 5cbd61e86f6..6879f5eb27f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -31,7 +31,7 @@ /// GlobalLightOptions dialog trivial construstor - Create does the real work. -GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=NULL*/) +GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=nullptr*/) : CDialog(GlobalLightOptions::IDD, pParent) { //{{AFX_DATA_INIT(GlobalLightOptions) diff --git a/Generals/Code/Tools/WorldBuilder/src/GroveOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/GroveOptions.cpp index b0cb541a0fa..8687248189c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GroveOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GroveOptions.cpp @@ -25,7 +25,7 @@ #define ARBITRARY_BUFF_SIZE 128 -/*extern*/ GroveOptions *TheGroveOptions = NULL; +/*extern*/ GroveOptions *TheGroveOptions = nullptr; void GroveOptions::makeMain(void) { @@ -168,7 +168,7 @@ BOOL GroveOptions::OnInitDialog() GroveOptions::~GroveOptions() { - TheGroveOptions = NULL; + TheGroveOptions = nullptr; } diff --git a/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp b/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp index c53bc119d51..0905871cf35 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GroveTool.cpp @@ -64,7 +64,7 @@ Bool localIsUnderwater( Real x, Real y) if (pTrig->pointInTrigger(iLoc)) { Real wZ = pTrig->getPoint(0)->z; // See if the ground height is less than the water level. - Real curHeight = TheTerrainRenderObject->getHeightMapHeight(x, y, NULL); + Real curHeight = TheTerrainRenderObject->getHeightMapHeight(x, y, nullptr); return (curHeightInvalidate(); _plantGroveInBox(m_downPt, viewPt, pView); - if (m_headMapObj != NULL) { + if (m_headMapObj != nullptr) { AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_headMapObj); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_headMapObj = NULL; // undoable owns it now. + m_headMapObj = nullptr; // undoable owns it now. } return; } @@ -295,15 +295,15 @@ void GroveTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBui zeroDir.x = 0.0f; zeroDir.y = 0.0f; zeroDir.z = 0.0f; - loc.z = TheTerrainRenderObject ? TheTerrainRenderObject->getHeightMapHeight( loc.x, loc.y, NULL ) : 0; + loc.z = TheTerrainRenderObject ? TheTerrainRenderObject->getHeightMapHeight( loc.x, loc.y, nullptr ) : 0; // grow tree grove out from here plantGrove( loc, zeroDir, loc.z, depth, bounds ); - if (m_headMapObj != NULL) { + if (m_headMapObj != nullptr) { AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_headMapObj); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_headMapObj = NULL; // undoable owns it now. + m_headMapObj = nullptr; // undoable owns it now. } } @@ -334,12 +334,12 @@ void GroveTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld void GroveTool::addObj(Coord3D *pos, AsciiString name) { MapObject *pCur = ObjectOptions::getObjectNamed(name); - DEBUG_ASSERTCRASH(pCur!=NULL, ("oops")); + DEBUG_ASSERTCRASH(pCur!=nullptr, ("oops")); if (!pCur) return; Coord3D theLoc = *pos; theLoc.z = 0; Real angle = GameLogicRandomValueReal( 0.0f, 2.0f * PI ); - MapObject *pNew = newInstance( MapObject)(theLoc, pCur->getName(), angle, 0, NULL, pCur->getThingTemplate() ); + MapObject *pNew = newInstance( MapObject)(theLoc, pCur->getName(), angle, 0, nullptr, pCur->getThingTemplate() ); pNew->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); pNew->setNextMap(m_headMapObj); m_headMapObj = pNew; @@ -353,7 +353,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -362,7 +362,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -371,7 +371,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -380,7 +380,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -390,7 +390,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -400,7 +400,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -410,7 +410,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -420,7 +420,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { diff --git a/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp b/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp index 5a44b9c4646..2c92b4cea11 100644 --- a/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/LayersList.cpp @@ -77,7 +77,7 @@ void CLLTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) SelectItem(item); if (item) { - if (GetParentItem(item) == NULL) { + if (GetParentItem(item) == nullptr) { mLastClickedLayer = GetItemText(item); mLastClickedObject = AsciiString::TheEmptyString; contextIsLayer = true; @@ -139,7 +139,7 @@ END_MESSAGE_MAP() LayersList::LayersList(UINT nIDTemplate, CWnd *parentWnd) : CDialog(nIDTemplate, parentWnd) { - mTree = NULL; + mTree = nullptr; resetLayers(); } @@ -170,7 +170,7 @@ void LayersList::resetLayers(void) void LayersList::addMapObjectToLayersList(MapObject *objToAdd, AsciiString layerToAddTo) { if (!objToAdd || findMapObjectAndList(objToAdd)) { - DEBUG_CRASH(("MapObject added was NULL or object already in Layers List. jkmcd")); + DEBUG_CRASH(("MapObject added was null or object already in Layers List. jkmcd")); return; } ListLayerIt layerIt; @@ -205,7 +205,7 @@ AsciiString LayersList::removeMapObjectFromLayersList(MapObject *objToRemove) void LayersList::changeMapObjectLayer(MapObject *objToChange, AsciiString layerToPlaceOn) { if (!objToChange) { - DEBUG_CRASH(("Attempted to change location of NULL object. jkmcd")); + DEBUG_CRASH(("Attempted to change location of null object. jkmcd")); return; } @@ -441,7 +441,7 @@ void LayersList::addMapObjectToLayer(IN MapObject *objectToAdd, IN ListLayerIt * void LayersList::removeMapObjectFromLayer(IN MapObject *objectToRemove, IN ListLayerIt *layerIt, IN ListMapObjectPtrIt *objectIt) { if (!objectToRemove) { - DEBUG_CRASH(("Attempted to remove NULL object from layers list. jkmcd")); + DEBUG_CRASH(("Attempted to remove null object from layers list. jkmcd")); return; } @@ -526,7 +526,7 @@ void LayersList::OnBeginEditLabel(NMHDR *pNotifyStruct, LRESULT* pResult) } TV_DISPINFO *ptvdi = (TV_DISPINFO*) pNotifyStruct; - if (ptvdi == NULL) { + if (ptvdi == nullptr) { (*pResult) = 1; return; } @@ -637,7 +637,7 @@ void LayersList::OnDeleteLayer() HTREEITEM LayersList::findTreeLayerNamed(const AsciiString& nameToFind) { if (!mTree) { - return NULL; + return nullptr; } HTREEITEM hItem = mTree->GetRootItem(); @@ -649,13 +649,13 @@ HTREEITEM LayersList::findTreeLayerNamed(const AsciiString& nameToFind) hItem = mTree->GetNextSiblingItem(hItem); } - return NULL; + return nullptr; } HTREEITEM LayersList::findTreeObjectNamed(const AsciiString& objectToFind, HTREEITEM layerItem) { if (!(layerItem && mTree)) { - return NULL; + return nullptr; } HTREEITEM hItem = mTree->GetChildItem(layerItem); @@ -667,7 +667,7 @@ HTREEITEM LayersList::findTreeObjectNamed(const AsciiString& objectToFind, HTREE hItem = mTree->GetNextSiblingItem(hItem); } - return NULL; + return nullptr; } void LayersList::OnHideShowLayer() @@ -849,7 +849,7 @@ MapObject *LayersList::findObjectByUID(AsciiString objectIDToFind) obj = obj->getNext(); } - return NULL; + return nullptr; } BEGIN_MESSAGE_MAP(LayersList, CDialog) @@ -870,4 +870,4 @@ END_MESSAGE_MAP() std::string LayersList::TheDefaultLayerName = "Default Layer"; std::string LayersList::TheDefaultNewLayerName = "New Layer"; const std::string LayersList::TheUnmutableDefaultLayerName = "Default Layer"; -extern LayersList *TheLayersList = NULL; +extern LayersList *TheLayersList = nullptr; diff --git a/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp index 788a2cae4ee..10ee00a028d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp @@ -28,12 +28,12 @@ #include "wbview3d.h" #include "Common/WellKnownKeys.h" -LightOptions *LightOptions::m_staticThis = NULL; +LightOptions *LightOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// /// LightOptions dialog trivial construstor - Create does the real work. -LightOptions::LightOptions(CWnd* pParent /*=NULL*/) +LightOptions::LightOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(LightOptions) // NOTE: the ClassWizard will add member initialization here @@ -52,7 +52,7 @@ void LightOptions::DoDataExchange(CDataExchange* pDX) MapObject *LightOptions::getSingleSelectedLight(void) { MapObject *pMapObj; - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { @@ -66,7 +66,7 @@ MapObject *LightOptions::getSingleSelectedLight(void) if (selCount==1 && theMapObj) { return theMapObj; } - return(NULL); + return(nullptr); } diff --git a/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp b/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp index 0501faf23ba..369067109fa 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MainFrm.cpp @@ -59,7 +59,7 @@ static UINT indicators[] = ID_INDICATOR_SCRL, }; -CMainFrame *CMainFrame::TheMainFrame = NULL; +CMainFrame *CMainFrame::TheMainFrame = nullptr; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction @@ -67,10 +67,10 @@ CMainFrame *CMainFrame::TheMainFrame = NULL; CMainFrame::CMainFrame() { TheMainFrame = this; - m_curOptions = NULL; - m_hAutoSaveTimer = NULL; + m_curOptions = nullptr; + m_hAutoSaveTimer = 0; m_autoSaving = false; - m_layersList = NULL; + m_layersList = nullptr; } CMainFrame::~CMainFrame() @@ -78,7 +78,7 @@ CMainFrame::~CMainFrame() delete m_layersList; SaveBarState("MainFrame"); - TheMainFrame = NULL; + TheMainFrame = nullptr; ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSave", m_autoSave); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSaveIntervalSeconds", m_autoSaveInterval); CoUninitialize(); @@ -99,7 +99,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) top.top += 10; top.top = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "Top", top.top); top.left =::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "Left", top.left); - SetWindowPos(NULL, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + SetWindowPos(nullptr, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); GetWindowRect(&frameRect); EnableDocking(CBRS_ALIGN_TOP); @@ -142,112 +142,112 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_brushOptions.Create(IDD_BRUSH_OPTIONS, this); - m_brushOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_brushOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_brushOptions.GetWindowRect(&frameRect); m_optionsPanelWidth = frameRect.Width(); m_optionsPanelHeight = frameRect.Height(); m_featherOptions.Create(IDD_FEATHER_OPTIONS, this); - m_featherOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_featherOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_featherOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_noOptions.Create(IDD_NO_OPTIONS, this); - m_noOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_noOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_noOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_terrainMaterial.Create(IDD_TERRAIN_MATERIAL, this); - m_terrainMaterial.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_terrainMaterial.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_terrainMaterial.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_blendMaterial.Create(IDD_BLEND_MATERIAL, this); - m_blendMaterial.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_blendMaterial.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_blendMaterial.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_moundOptions.Create(IDD_MOUND_OPTIONS, this); - m_moundOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_moundOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_moundOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_objectOptions.Create(IDD_OBJECT_OPTIONS, this); - m_objectOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_objectOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_objectOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_fenceOptions.Create(IDD_FENCE_OPTIONS, this); - m_fenceOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_fenceOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_fenceOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_mapObjectProps.Create(IDD_MAPOBJECT_PROPS, this); m_mapObjectProps.makeMain(); - m_mapObjectProps.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_mapObjectProps.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_mapObjectProps.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_roadOptions.Create(IDD_ROAD_OPTIONS, this); - m_roadOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_roadOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_roadOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waypointOptions.Create(IDD_WAYPOINT_OPTIONS, this); - m_waypointOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_waypointOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_waypointOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waterOptions.Create(IDD_WATER_OPTIONS, this); - m_waterOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_waterOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_waterOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_lightOptions.Create(IDD_LIGHT_OPTIONS, this); - m_lightOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_lightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_lightOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_meshMoldOptions.Create(IDD_MESHMOLD_OPTIONS, this); - m_meshMoldOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_meshMoldOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_meshMoldOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_buildListOptions.Create(IDD_BUILD_LIST_PANEL, this); - m_buildListOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_buildListOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_buildListOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_groveOptions.Create(IDD_GROVE_OPTIONS, this); m_groveOptions.makeMain(); - m_groveOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_groveOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_groveOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_rampOptions.Create(IDD_RAMP_OPTIONS, this); - m_rampOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_rampOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_rampOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_scorchOptions.Create(IDD_SCORCH_OPTIONS, this); - m_scorchOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_scorchOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_scorchOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); @@ -256,7 +256,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) frameRect.left =::AfxGetApp()->GetProfileInt(GLOBALLIGHT_OPTIONS_PANEL_SECTION, "Left", frameRect.left); m_globalLightOptions.Create(IDD_GLOBAL_LIGHT_OPTIONS, this); - m_globalLightOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_globalLightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_globalLightOptions.GetWindowRect(&frameRect); m_globalLightOptionsWidth = frameRect.Width(); m_globalLightOptionsHeight = frameRect.Height(); @@ -265,7 +265,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) frameRect.left =::AfxGetApp()->GetProfileInt(CAMERA_OPTIONS_PANEL_SECTION, "Left", frameRect.left); m_cameraOptions.Create(IDD_CAMERA_OPTIONS, this); - m_cameraOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_cameraOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_cameraOptions.GetWindowRect(&frameRect); // now, setup the Layers Panel @@ -275,7 +275,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) CRect optionsRect; m_globalLightOptions.GetWindowRect(&optionsRect); - m_layersList->SetWindowPos(NULL, optionsRect.left, optionsRect.bottom + 100, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + m_layersList->SetWindowPos(nullptr, optionsRect.left, optionsRect.bottom + 100, 0, 0, SWP_NOZORDER | SWP_NOSIZE); Int sbf = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowBrushFeedback", 1); if (sbf != 0) { @@ -288,7 +288,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_autoSave = autoSave != 0; autoSave = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "AutoSaveIntervalSeconds", 120); m_autoSaveInterval = autoSave; - m_hAutoSaveTimer = this->SetTimer(1, m_autoSaveInterval*1000, NULL); + m_hAutoSaveTimer = this->SetTimer(1, m_autoSaveInterval*1000, nullptr); #if USE_STREAMING_AUDIO StartMusic(); @@ -322,7 +322,7 @@ void CMainFrame::adjustWindowSize(void) this->GetWindowRect(window); Int newWidth = window.Width()-widthDelta; Int newHeight = window.Height()-heightDelta; - this->SetWindowPos(NULL, 0, + this->SetWindowPos(nullptr, 0, 0, newWidth, newHeight, SWP_NOMOVE|SWP_NOZORDER); // MainFrm.cpp sets the top and left. if (pView) { @@ -340,30 +340,30 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) void CMainFrame::ResetWindowPositions(void) { - if (m_curOptions == NULL) { + if (m_curOptions == nullptr) { m_curOptions = &m_brushOptions; } - SetWindowPos(NULL, 20, 20, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + SetWindowPos(nullptr, 20, 20, 0, 0, SWP_NOSIZE|SWP_NOZORDER); ShowWindow(SW_SHOW); - m_curOptions->SetWindowPos(NULL, 40, 40, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + m_curOptions->SetWindowPos(nullptr, 40, 40, 0, 0, SWP_NOSIZE|SWP_NOZORDER); m_curOptions->ShowWindow(SW_SHOW); CView *pView = CWorldBuilderDoc::GetActive2DView(); if (pView) { CWnd *pParent = pView->GetParentFrame(); if (pParent) { - pParent->SetWindowPos(NULL, 60, 60, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + pParent->SetWindowPos(nullptr, 60, 60, 0, 0, SWP_NOSIZE|SWP_NOZORDER); } } CPoint pos(20,200); this->FloatControlBar(&m_floatingToolBar, pos, CBRS_ALIGN_LEFT); - m_floatingToolBar.SetWindowPos(NULL, pos.x, pos.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + m_floatingToolBar.SetWindowPos(nullptr, pos.x, pos.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER); m_floatingToolBar.ShowWindow(SW_SHOW); } void CMainFrame::showOptionsDialog(Int dialogID) { - CWnd *newOptions = NULL; + CWnd *newOptions = nullptr; switch(dialogID) { case IDD_BRUSH_OPTIONS : newOptions = &m_brushOptions; break; case IDD_TERRAIN_MATERIAL: newOptions = &m_terrainMaterial; break; @@ -469,7 +469,7 @@ void CMainFrame::OnDestroy() if (m_hAutoSaveTimer) { KillTimer(m_hAutoSaveTimer); } - m_hAutoSaveTimer = NULL; + m_hAutoSaveTimer = 0; CFrameWnd::OnDestroy(); } @@ -478,7 +478,7 @@ void CMainFrame::OnTimer(UINT nIDEvent) CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); if (pDoc && pDoc->needAutoSave()) { m_autoSaving = true; - HCURSOR old = SetCursor(::LoadCursor(0, IDC_WAIT)); + HCURSOR old = SetCursor(::LoadCursor(nullptr, IDC_WAIT)); SetMessageText("Auto Saving map..."); pDoc->autoSave(); if (old) SetCursor(old); diff --git a/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp b/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp index 114bbda21a8..1c454135dcb 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MapPreview.cpp @@ -169,7 +169,7 @@ Bool MapPreview::mapPreviewToWorld(const ICoord2D *radar, Coord3D *world) Int x, y; // sanity - if( radar == NULL || world == NULL ) + if( radar == nullptr || world == nullptr ) return FALSE; // get the coords diff --git a/Generals/Code/Tools/WorldBuilder/src/MapSettings.cpp b/Generals/Code/Tools/WorldBuilder/src/MapSettings.cpp index bfd863b0611..1801d404e8f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MapSettings.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MapSettings.cpp @@ -33,7 +33,7 @@ // MapSettings dialog -MapSettings::MapSettings(CWnd* pParent /*=NULL*/) +MapSettings::MapSettings(CWnd* pParent /*=nullptr*/) : CDialog(MapSettings::IDD, pParent) { //{{AFX_DATA_INIT(MapSettings) diff --git a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index fc0ec4df85d..7a04ba1cd2b 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -31,12 +31,12 @@ Real MeshMoldOptions::m_currentHeight=0; Real MeshMoldOptions::m_currentScale=1.0f; Int MeshMoldOptions::m_currentAngle=0; -MeshMoldOptions * MeshMoldOptions::m_staticThis=NULL; +MeshMoldOptions * MeshMoldOptions::m_staticThis=nullptr; Bool MeshMoldOptions::m_doingPreview=false; Bool MeshMoldOptions::m_raiseOnly=false; Bool MeshMoldOptions::m_lowerOnly=false; -MeshMoldOptions::MeshMoldOptions(CWnd* pParent /*=NULL*/) +MeshMoldOptions::MeshMoldOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(MeshMoldOptions) // NOTE: the ClassWizard will add member initialization here @@ -86,8 +86,8 @@ BOOL MeshMoldOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(".\\data\\Editor\\Molds\\", "*.w3d", filenameList, FALSE); - if (!filenameList.empty()) { - HTREEITEM child = NULL; + if (filenameList.size() > 0) { + HTREEITEM child = nullptr; FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp b/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp index c5ae174c04b..42a0f27ce88 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp @@ -41,7 +41,7 @@ Bool MeshMoldTool::m_tracking = false; Coord3D MeshMoldTool::m_toolPos; -WorldHeightMapEdit *MeshMoldTool::m_htMapEditCopy = NULL; +WorldHeightMapEdit *MeshMoldTool::m_htMapEditCopy = nullptr; /// Constructor MeshMoldTool::MeshMoldTool(void) : @@ -95,7 +95,7 @@ void MeshMoldTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor if (!m_tracking) { m_tracking = true; m_toolPos = cpt; - Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, NULL); + Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, nullptr); MeshMoldOptions::setHeight(height); } DrawObject::setDoMeshFeedback(true); @@ -186,8 +186,8 @@ void MeshMoldTool::applyMesh(CWorldBuilderDoc *pDoc) { WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - HCURSOR old = SetCursor(::LoadCursor(0, IDC_WAIT)); - if (m_htMapEditCopy == NULL) { + HCURSOR old = SetCursor(::LoadCursor(nullptr, IDC_WAIT)); + if (m_htMapEditCopy == nullptr) { m_htMapEditCopy = pDoc->GetHeightMap()->duplicate(); } else { // Restore original heights to edit copy. diff --git a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp index 8bdc6b806d1..bde4aa980f9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "MoundTool.h" -MoundOptions *MoundOptions::m_staticThis = NULL; +MoundOptions *MoundOptions::m_staticThis = nullptr; Int MoundOptions::m_currentWidth = 0; Int MoundOptions::m_currentHeight = 0; Int MoundOptions::m_currentFeather = 0; @@ -34,7 +34,7 @@ Int MoundOptions::m_currentFeather = 0; /// MoundOptions dialog trivial construstor - Create does the real work. -MoundOptions::MoundOptions(CWnd* pParent /*=NULL*/) +MoundOptions::MoundOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(MoundOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp b/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp index ffcaefc3170..3eb9af508de 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp @@ -45,8 +45,8 @@ Int MoundTool::m_brushFeather; MoundTool::MoundTool(void) : Tool(ID_BRUSH_ADD_TOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapSaveCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapSaveCopy = nullptr; m_raising = true; } diff --git a/Generals/Code/Tools/WorldBuilder/src/MyToolbar.cpp b/Generals/Code/Tools/WorldBuilder/src/MyToolbar.cpp index 3e42d6af2c9..a79ca28d428 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MyToolbar.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MyToolbar.cpp @@ -37,7 +37,7 @@ END_MESSAGE_MAP() #define MAX_POS 7 #define MIN_POS 1 -CellSizeToolBar *CellSizeToolBar::m_staticThis = NULL; +CellSizeToolBar *CellSizeToolBar::m_staticThis = nullptr; void CellSizeToolBar::CellSizeChanged(Int cellSize) { @@ -48,14 +48,14 @@ void CellSizeToolBar::CellSizeChanged(Int cellSize) if (newSize >= cellSize) break; } i = MAX_POS - i + MIN_POS; // Invert the range - if (m_staticThis != NULL) { + if (m_staticThis != nullptr) { m_staticThis->m_cellSlider.SetPos(i); } } CellSizeToolBar::~CellSizeToolBar(void) { - m_staticThis = NULL; + m_staticThis = nullptr; } void CellSizeToolBar::SetupSlider(void) @@ -89,7 +89,7 @@ void CellSizeToolBar::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) if (newSize>64) return; CWorldBuilderView* pView = CWorldBuilderDoc::GetActive2DView(); - if (pView == NULL || newSize == pView->getCellSize()) return; + if (pView == nullptr || newSize == pView->getCellSize()) return; pView->setCellSize(newSize); } @@ -98,7 +98,7 @@ LRESULT CellSizeToolBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam if (message == WM_VSCROLL) { int nScrollCode = (short)LOWORD(wParam); int nPos = (short)HIWORD(wParam); - OnVScroll(nScrollCode, nPos, NULL); + OnVScroll(nScrollCode, nPos, nullptr); return(0); } return(CDialogBar::WindowProc(message, wParam, lParam)); diff --git a/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp b/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp index 98d04218089..43358bb9f39 100644 --- a/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp @@ -27,7 +27,7 @@ // CNewHeightMap dialog -CNewHeightMap::CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent /*=NULL*/) +CNewHeightMap::CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent /*=nullptr*/) : CDialog(CNewHeightMap::IDD, pParent) { mHeightInfo = *hiP; diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index 941cee4d117..4c6a369f38d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -41,7 +41,7 @@ #include -ObjectOptions *ObjectOptions::m_staticThis = NULL; +ObjectOptions *ObjectOptions::m_staticThis = nullptr; Bool ObjectOptions::m_updating = false; char ObjectOptions::m_currentObjectName[NAME_MAX_LEN]; Int ObjectOptions::m_currentObjectIndex=-1; @@ -51,9 +51,9 @@ AsciiString ObjectOptions::m_curOwnerName; // ObjectOptions dialog -ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) +ObjectOptions::ObjectOptions(CWnd* pParent /*=nullptr*/) { - m_objectsList = NULL; + m_objectsList = nullptr; strcpy(m_currentObjectName, "No Selection"); m_curOwnerName.clear(); //{{AFX_DATA_INIT(ObjectOptions) @@ -65,7 +65,7 @@ ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) ObjectOptions::~ObjectOptions(void) { deleteInstance(m_objectsList); - m_objectsList = NULL; + m_objectsList = nullptr; } @@ -159,7 +159,7 @@ void ObjectOptions::updateLabel() } else { - m_objectPreview.SetThingTemplate(NULL); + m_objectPreview.SetThingTemplate(nullptr); } m_objectPreview.Invalidate(); @@ -205,7 +205,7 @@ void ObjectOptions::updateLabel() static const PlayerTemplate* findFirstPlayerTemplateOnSide(AsciiString side) { if (side.isEmpty()) - return NULL; // neutral, this is ok + return nullptr; // neutral, this is ok for (int i = 0; i < ThePlayerTemplateStore->getPlayerTemplateCount(); i++) { @@ -217,7 +217,7 @@ static const PlayerTemplate* findFirstPlayerTemplateOnSide(AsciiString side) } DEBUG_CRASH(("no player found for %s!",side.str())); - return NULL; + return nullptr; } #endif @@ -244,7 +244,7 @@ BOOL ObjectOptions::OnInitDialog() MapObject *pMap; // create new map object - pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; @@ -258,7 +258,7 @@ BOOL ObjectOptions::OnInitDialog() { Coord3D pt = {0,0,0}; char base[1024] = "*Lights/Light"; - MapObject *pMap = newInstance(MapObject)(pt, AsciiString(base), 0.0f, 0, NULL, NULL ); + MapObject *pMap = newInstance(MapObject)(pt, AsciiString(base), 0.0f, 0, nullptr, nullptr ); pMap->setIsLight(); Dict *props = pMap->getProperties(); @@ -308,7 +308,7 @@ BOOL ObjectOptions::OnInitDialog() } } Coord3D pt = {0,0,0}; - MapObject *pMap = newInstance(MapObject)(pt, AsciiString(fileBuf), 0.0f, 0, NULL, NULL ); + MapObject *pMap = newInstance(MapObject)(pt, AsciiString(fileBuf), 0.0f, 0, nullptr, nullptr ); pMap->setNextMap(m_objectsList); m_objectsList = pMap; @@ -339,7 +339,7 @@ BOOL ObjectOptions::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_objectPreview.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_objectPreview.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_objectPreview.ShowWindow(SW_SHOW); MapObject *pMap = m_objectsList; @@ -368,7 +368,7 @@ HTREEITEM ObjectOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -432,7 +432,7 @@ HTREEITEM ObjectOptions::_FindOrDont(const char* pLabel, HTREEITEM startPoint) itemsToEx.push_back(m_objectTreeView.GetNextSiblingItem(hItem)); } } - return NULL; + return nullptr; } @@ -443,10 +443,10 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, Int terrainNdx, HTREEITEM parent ) { char buffer[ _MAX_PATH ]; - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -467,7 +467,7 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -548,7 +548,7 @@ Bool ObjectOptions::setObjectTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; @@ -625,7 +625,7 @@ MapObject *ObjectOptions::getCurMapObject(void) pObj = pObj->getNext(); } } - return(NULL); + return(nullptr); } AsciiString ObjectOptions::getCurGdfName(void) @@ -707,7 +707,7 @@ MapObject *ObjectOptions::duplicateCurMapObjectForPlace(const Coord3D* loc, Real } } AfxMessageBox("Unable to add object."); - return(NULL); + return(nullptr); } Real ObjectOptions::getCurObjectHeight(void) @@ -750,7 +750,7 @@ MapObject *ObjectOptions::getObjectNamed(AsciiString name) pObj = pObj->getNext(); } } - return(NULL); + return(nullptr); } Int ObjectOptions::getObjectNamedIndex(const AsciiString& name) @@ -776,7 +776,7 @@ Int ObjectOptions::getObjectNamedIndex(const AsciiString& name) pObj = pObj->getNext(); } } - return(NULL); + return(0); } @@ -802,7 +802,7 @@ void ObjectOptions::selectObject(const MapObject* pObj) char buffer[NAME_MAX_LEN]; HTREEITEM objToSel = m_staticThis->findOrDont(pObj->getName().str()); - if (objToSel == NULL) { + if (objToSel == nullptr) { return; } diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp index 6ed63b1bb4c..4c257cf0be6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp @@ -54,7 +54,7 @@ ObjectPreview::ObjectPreview() { - m_tTempl = NULL; + m_tTempl = nullptr; } ObjectPreview::~ObjectPreview() @@ -89,11 +89,11 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) HRESULT hr=m_pDev->CreateImageSurface( desc.Width,desc.Height,desc.Format, &tempSurface); - hr=m_pDev->CopyRects(surface,NULL,0,tempSurface,NULL); + hr=m_pDev->CopyRects(surface,nullptr,0,tempSurface,nullptr); D3DLOCKED_RECT lrect; - DX8_ErrorCode(tempSurface->LockRect(&lrect,NULL,D3DLOCK_READONLY)); + DX8_ErrorCode(tempSurface->LockRect(&lrect,nullptr,D3DLOCK_READONLY)); unsigned int x,y,index,index2,width,height; @@ -129,7 +129,7 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) targ.Save("ObjectPreview.tga",TGAF_IMAGE,false); - return NULL; + return nullptr; #else @@ -184,7 +184,7 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) static UnsignedByte * generatePreview( const ThingTemplate *tt ) { // find the default model to preview - RenderObjClass *model = NULL; + RenderObjClass *model = nullptr; Real scale = 1.0f; AsciiString modelName = "No Model Name"; if (tt) @@ -214,7 +214,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) if (!objectTexture) { model->Release_Ref(); - return NULL; + return nullptr; } // Set the render target @@ -248,7 +248,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) WW3D::End_Render(false); // Change the rendertarget back to the main backbuffer - DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)NULL); + DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)nullptr); SurfaceClass *surface = objectTexture->Get_Surface_Level(); UnsignedByte *data = saveSurface(surface->Peek_D3D_Surface()); @@ -261,7 +261,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) } } - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectTool.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectTool.cpp index c8f140bdb54..43ddb3b405c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectTool.cpp @@ -84,9 +84,9 @@ Real ObjectTool::calcAngle(Coord3D downPt, Coord3D curPt, WbView* pView) void ObjectTool::deactivate() { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// Shows the object options panel void ObjectTool::activate() @@ -94,9 +94,9 @@ void ObjectTool::activate() CMainFrame::GetMainFrame()->showOptionsDialog(IDD_OBJECT_OPTIONS); DrawObject::setDoBrushFeedback(false); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /** Execute the tool on mouse down - Place an object. */ @@ -129,14 +129,14 @@ void ObjectTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl angle = pCur->getThingTemplate()->getPlacementViewAngle(); } WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); loc.z = ObjectOptions::getCurObjectHeight(); if (pCur) { // Display the transparent version of this object. p3View->setObjTracking(pCur, loc, angle, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); } } @@ -164,7 +164,7 @@ void ObjectTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. } } diff --git a/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp b/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp index 5810c435c8a..015a5b091df 100644 --- a/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp @@ -28,7 +28,7 @@ // OpenMap dialog -OpenMap::OpenMap(TOpenMapInfo *pInfo, CWnd* pParent /*=NULL*/) +OpenMap::OpenMap(TOpenMapInfo *pInfo, CWnd* pParent /*=nullptr*/) : CDialog(OpenMap::IDD, pParent), m_pInfo(pInfo) { @@ -81,7 +81,7 @@ void OpenMap::OnBrowse() void OpenMap::OnOK() { CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST); - if (pList == NULL) { + if (pList == nullptr) { OnCancel(); return; } @@ -108,7 +108,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) m_usingSystemDir = systemMaps; ::AfxGetApp()->WriteProfileInt(MAP_OPENSAVE_PANEL_SECTION, "UseSystemDir", m_usingSystemDir); - HANDLE hFindFile = 0; + HANDLE hFindFile = nullptr; WIN32_FIND_DATA findData; char dirBuf[_MAX_PATH]; char findBuf[_MAX_PATH]; @@ -121,7 +121,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) snprintf(dirBuf, ARRAY_SIZE(dirBuf), "%sMaps\\", TheGlobalData->getPath_UserData().str()); } CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST); - if (pList == NULL) return; + if (pList == nullptr) return; pList->ResetContent(); snprintf(findBuf, ARRAY_SIZE(findBuf), "%s*.*", dirBuf); @@ -164,11 +164,11 @@ BOOL OpenMap::OnInitDialog() CDialog::OnInitDialog(); CButton *pSystemMaps = (CButton *)this->GetDlgItem(IDC_SYSTEMMAPS); - if (pSystemMaps != NULL) + if (pSystemMaps != nullptr) pSystemMaps->SetCheck( m_usingSystemDir ); CButton *pUserMaps = (CButton *)this->GetDlgItem(IDC_USERMAPS); - if (pUserMaps != NULL) + if (pUserMaps != nullptr) pUserMaps->SetCheck( !m_usingSystemDir ); // TheSuperHackers @tweak Originally World Builder has hidden the System Maps tab button in Release builds, diff --git a/Generals/Code/Tools/WorldBuilder/src/OptionsPanel.cpp b/Generals/Code/Tools/WorldBuilder/src/OptionsPanel.cpp index 1a747e2cd87..ea5f1df381f 100644 --- a/Generals/Code/Tools/WorldBuilder/src/OptionsPanel.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/OptionsPanel.cpp @@ -28,7 +28,7 @@ // COptionsPanel dialog -COptionsPanel::COptionsPanel(Int dlgid /*=0*/, CWnd* pParent /*=NULL*/) +COptionsPanel::COptionsPanel(Int dlgid /*=0*/, CWnd* pParent /*=nullptr*/) : CDialog(dlgid ? dlgid : COptionsPanel::IDD, pParent) { //{{AFX_DATA_INIT(COptionsPanel) diff --git a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index 5f4b9d903ab..5492fd5b571 100644 --- a/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -35,10 +35,10 @@ // PickUnitDialog dialog -ReplaceUnitDialog::ReplaceUnitDialog(CWnd* pParent /*=NULL*/) +ReplaceUnitDialog::ReplaceUnitDialog(CWnd* pParent /*=nullptr*/) : PickUnitDialog(IDD, pParent) { - m_objectsList = NULL; + m_objectsList = nullptr; m_currentObjectIndex = -1; m_currentObjectName[0] = 0; for (int i = ES_FIRST; iisBuildableItem())) continue; // create new map object - pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; } @@ -212,7 +212,7 @@ HTREEITEM PickUnitDialog::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -283,10 +283,10 @@ BOOL PickUnitDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int index, HTREEITEM parent ) { char buffer[ _MAX_PATH ]; - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -307,7 +307,7 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -402,5 +402,5 @@ const ThingTemplate* PickUnitDialog::getPickedThing(void) return tTemplate; } } - return NULL; + return nullptr; } diff --git a/Generals/Code/Tools/WorldBuilder/src/PointerTool.cpp b/Generals/Code/Tools/WorldBuilder/src/PointerTool.cpp index 7d8490ba11c..2bb96cd1908 100644 --- a/Generals/Code/Tools/WorldBuilder/src/PointerTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/PointerTool.cpp @@ -88,10 +88,10 @@ static void helper_pickAllWaypointsInPath( Int sourceID, CWorldBuilderDoc *pDoc, /// Constructor PointerTool::PointerTool(void) : - m_modifyUndoable(NULL), - m_curObject(NULL), - m_rotateCursor(NULL), - m_moveCursor(NULL) + m_modifyUndoable(nullptr), + m_curObject(nullptr), + m_rotateCursor(nullptr), + m_moveCursor(nullptr) { m_toolID = ID_POINTER_TOOL; m_cursorID = IDC_POINTER; @@ -164,7 +164,7 @@ void PointerTool::clearSelection(void) ///< Clears the selected objects selected } } } - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; } /// Activate. @@ -175,15 +175,15 @@ void PointerTool::activate() m_mouseUpMove = false; checkForPropertiesPanel(); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// deactivate. void PointerTool::deactivate() { - m_curObject = NULL; + m_curObject = nullptr; PolygonTool::deactivate(); } @@ -191,12 +191,12 @@ void PointerTool::deactivate() void PointerTool::setCursor(void) { if (m_mouseUpRotate) { - if (m_rotateCursor == NULL) { + if (m_rotateCursor == nullptr) { m_rotateCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_ROTATE)); } ::SetCursor(m_rotateCursor); } else if (m_mouseUpMove) { - if (m_moveCursor == NULL) { + if (m_moveCursor == nullptr) { m_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_MOVE_POINTER)); } ::SetCursor(m_moveCursor); @@ -276,7 +276,7 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl PolygonTool::startMouseDown(m, viewPt, pView, pDoc); return; } - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; m_poly_dragPointNdx = -1; } } @@ -284,10 +284,10 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl // WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - m_curObject = NULL; + m_curObject = nullptr; MapObject *pObj = MapObject::getFirstMapObject(); MapObject *p3DObj = pView->picked3dObjectInView(viewPt); - MapObject *pClosestPicked = NULL; + MapObject *pClosestPicked = nullptr; if (allowPick(p3DObj, pView)) { pClosestPicked = p3DObj; } @@ -312,7 +312,7 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl } } - Bool anySelected = (pClosestPicked!=NULL); + Bool anySelected = (pClosestPicked!=nullptr); if (shiftKey) { if (pClosestPicked && pClosestPicked->isSelected()) { pClosestPicked->setSelected(false); @@ -442,7 +442,7 @@ void PointerTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWor return; } - if (m_curObject == NULL) { + if (m_curObject == nullptr) { return; } pView->viewToDocCoords(viewPt, &cpt, !m_rotating); diff --git a/Generals/Code/Tools/WorldBuilder/src/PolygonTool.cpp b/Generals/Code/Tools/WorldBuilder/src/PolygonTool.cpp index c58312ca602..2fec8cd3e41 100644 --- a/Generals/Code/Tools/WorldBuilder/src/PolygonTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/PolygonTool.cpp @@ -41,7 +41,7 @@ Bool PolygonTool::m_poly_isActive = false; Bool PolygonTool::m_poly_isAdding = false; -PolygonTrigger *PolygonTool::m_poly_curSelectedPolygon = NULL; +PolygonTrigger *PolygonTool::m_poly_curSelectedPolygon = nullptr; Int PolygonTool::m_poly_dragPointNdx = -1; enum {SNAP_DISTANCE = 5}; @@ -49,8 +49,8 @@ enum {SNAP_DISTANCE = 5}; /// Constructor PolygonTool::PolygonTool(void) : Tool(ID_POLYGON_TOOL, IDC_POLYGON), - m_poly_plusCursor(NULL), - m_poly_moveCursor(NULL) + m_poly_plusCursor(nullptr), + m_poly_moveCursor(nullptr) { } @@ -78,7 +78,7 @@ void PolygonTool::deactivate() } } m_poly_isActive = false; - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; } /// Shows the terrain materials options panel. @@ -150,7 +150,7 @@ PolygonTrigger *PolygonTool::pickPolygon(Coord3D loc, CPoint viewPt, WbView* pVi return pTrig; } } - return NULL; + return nullptr; } // Snap to other polys. @@ -177,7 +177,7 @@ Bool PolygonTool::poly_snapToPoly(Coord3D *pLoc) { // Pick a point. Int PolygonTool::poly_pickPoint(PolygonTrigger *pTrig, CPoint viewPt, WbView* pView) { - if (pTrig==NULL) return -1; + if (pTrig==nullptr) return -1; Int i; const Int PICK_PIXELS = pView->getPickPixels(); for (i=0; igetNumPoints(); i++) { @@ -202,7 +202,7 @@ Int PolygonTool::poly_pickPoint(PolygonTrigger *pTrig, CPoint viewPt, WbView* pV // Get the point to insert closest to loc. Int PolygonTool::poly_getInsertIndex(PolygonTrigger *pTrig, Coord3D loc) { - if (pTrig==NULL) return 0; + if (pTrig==nullptr) return 0; static Int tolerance = SNAP_DISTANCE; Int i; @@ -254,11 +254,11 @@ void PolygonTool::poly_pickOnMouseDown(CPoint viewPt, WbView* pView) } } if (!found) { - m_poly_curSelectedPolygon = NULL; // Undo probably made it go away. + m_poly_curSelectedPolygon = nullptr; // Undo probably made it go away. } } m_poly_justPicked = false; // Always false here. Pointer tool sets to true. - if (m_poly_curSelectedPolygon == NULL || !m_poly_isAdding) { + if (m_poly_curSelectedPolygon == nullptr || !m_poly_isAdding) { PolygonTrigger *pSel; Coord3D docPt = m_poly_unsnappedMouseDownPt; if (m_poly_curSelectedPolygon && poly_pickPoly(m_poly_curSelectedPolygon, docPt, SNAP_DISTANCE)) { @@ -302,8 +302,8 @@ void PolygonTool::startMouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, iDocPt.z = m_poly_curSelectedPolygon->getPoint(0)->z; } m_poly_dragPointNdx = -1; - m_poly_moveUndoable = NULL; - if (m_poly_curSelectedPolygon==NULL) { + m_poly_moveUndoable = nullptr; + if (m_poly_curSelectedPolygon==nullptr) { // adding a new polygon. m_poly_curSelectedPolygon = newInstance(PolygonTrigger)(32); AsciiString name; @@ -364,10 +364,10 @@ Bool PolygonTool::deleteSelectedPolygon(void) } } if (!found) { - m_poly_curSelectedPolygon = NULL; // Undo probably made it go away. + m_poly_curSelectedPolygon = nullptr; // Undo probably made it go away. } } - if (m_poly_curSelectedPolygon == NULL) { + if (m_poly_curSelectedPolygon == nullptr) { return false; } CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); @@ -383,7 +383,7 @@ Bool PolygonTool::deleteSelectedPolygon(void) DeletePolygonUndoable *pUndo = new DeletePolygonUndoable(m_poly_curSelectedPolygon); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; m_poly_dragPointNdx = -1; } WaypointOptions::update(); @@ -394,12 +394,12 @@ Bool PolygonTool::deleteSelectedPolygon(void) void PolygonTool::setCursor(void) { if (m_poly_mouseUpPlus || (m_poly_isAdding && m_poly_curSelectedPolygon)) { - if (m_poly_plusCursor == NULL) { + if (m_poly_plusCursor == nullptr) { m_poly_plusCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_POLYGON_PLUS)); } ::SetCursor(m_poly_plusCursor); } else if (m_poly_mouseUpMove) { - if (m_poly_moveCursor == NULL) { + if (m_poly_moveCursor == nullptr) { m_poly_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_POLYGON_MOVE)); } ::SetCursor(m_poly_moveCursor); diff --git a/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp index 6bf4b22e39f..b428277493c 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp @@ -48,7 +48,7 @@ RampOptions::RampOptions(CWnd* pParent) : COptionsPanel(RampOptions::IDD, pParen RampOptions::~RampOptions() { - TheRampOptions = NULL; + TheRampOptions = nullptr; } Bool RampOptions::shouldApplyTheRamp() @@ -79,7 +79,7 @@ void RampOptions::OnWidthChange() m_rampWidth = atof(str.GetBuffer(0)); } -extern RampOptions* TheRampOptions = NULL; +extern RampOptions* TheRampOptions = nullptr; BEGIN_MESSAGE_MAP(RampOptions, COptionsPanel) ON_BN_CLICKED(IDC_RO_APPLY, OnApply) diff --git a/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp b/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp index d0764505b35..d9bef230431 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp @@ -83,7 +83,7 @@ void RampTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB } else if (m == TRACK_L) { Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); - docPt.z = TheTerrainRenderObject->getHeightMapHeight(docPt.x, docPt.y, NULL); + docPt.z = TheTerrainRenderObject->getHeightMapHeight(docPt.x, docPt.y, nullptr); mEndPoint = docPt; } @@ -99,7 +99,7 @@ void RampTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); mStartPoint = docPt; - mStartPoint.z = TheTerrainRenderObject->getHeightMapHeight(mStartPoint.x, mStartPoint.y, NULL); + mStartPoint.z = TheTerrainRenderObject->getHeightMapHeight(mStartPoint.x, mStartPoint.y, nullptr); mIsMouseDown = true; } @@ -114,7 +114,7 @@ void RampTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuil Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); mEndPoint = docPt; - mEndPoint.z = TheTerrainRenderObject->getHeightMapHeight(mEndPoint.x, mEndPoint.y, NULL); + mEndPoint.z = TheTerrainRenderObject->getHeightMapHeight(mEndPoint.x, mEndPoint.y, nullptr); mIsMouseDown = false; } @@ -163,7 +163,7 @@ void RampTool::applyRamp(CWorldBuilderDoc* pDoc) Coord2D end = { mEndPoint.x, mEndPoint.y }; Coord2D pt2D = { pt.x, pt.y }; - ShortestDistancePointToSegment2D(&start, &end, &pt2D, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(&start, &end, &pt2D, nullptr, nullptr, &uVal); Real height = mStartPoint.z + uVal * (mEndPoint.z - mStartPoint.z); worldHeightDup->setHeight(indices[i].x, indices[i].y, (UnsignedByte) (height / MAP_HEIGHT_SCALE)); diff --git a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp index 68d08204542..15c95eb8591 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -33,7 +33,7 @@ #include -RoadOptions *RoadOptions::m_staticThis = NULL; +RoadOptions *RoadOptions::m_staticThis = nullptr; Bool RoadOptions::m_updating = false; AsciiString RoadOptions::m_currentRoadName; Int RoadOptions::m_currentRoadIndex=0; @@ -48,7 +48,7 @@ Bool RoadOptions::m_doJoin = false; ///< Is a join to different road type. // RoadOptions dialog -RoadOptions::RoadOptions(CWnd* pParent /*=NULL*/) +RoadOptions::RoadOptions(CWnd* pParent /*=nullptr*/) { m_currentRoadName = "Road"; //{{AFX_DATA_INIT(RoadOptions) @@ -99,7 +99,7 @@ void RoadOptions::updateLabel(void) /** Returns true if only one or more roads is selected. */ Bool RoadOptions::selectionIsRoadsOnly(void) { -// MapObject *theMapObj = NULL; +// MapObject *theMapObj = nullptr; Bool foundRoad = false; Bool foundAnythingElse = false; MapObject *pMapObj; @@ -118,7 +118,7 @@ Bool RoadOptions::selectionIsRoadsOnly(void) /** Returns true if only one or more roads is selected. */ void RoadOptions::updateSelection(void) { -// MapObject *theMapObj = NULL; +// MapObject *theMapObj = nullptr; Int angled = 0; Int tight = 0; Int broad = 0; @@ -312,7 +312,7 @@ HTREEITEM RoadOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -344,7 +344,7 @@ Bool RoadOptions::findAndSelect(HTREEITEM parent, AsciiString label) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -419,7 +419,7 @@ Bool RoadOptions::setRoadTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; @@ -549,7 +549,7 @@ BOOL RoadOptions::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) updateLabel(); } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_roadTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_roadTreeView.GetChildItem(hItem); } diff --git a/Generals/Code/Tools/WorldBuilder/src/RoadTool.cpp b/Generals/Code/Tools/WorldBuilder/src/RoadTool.cpp index ffb6a3d65d9..55e07945b9d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RoadTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RoadTool.cpp @@ -43,13 +43,13 @@ RoadTool::RoadTool(void) : Tool(ID_ROAD_TOOL, IDC_ROAD) { - m_mapObj = NULL; + m_mapObj = nullptr; } /// Destructor RoadTool::~RoadTool(void) { - m_mapObj = NULL; + m_mapObj = nullptr; } //----------------------------------------------------------------------------- // Public Functions @@ -62,7 +62,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { MapObject* pMapObj2 = pMapObj->getNext(); - if (pMapObj2==NULL) + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; @@ -76,7 +76,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) Real dist; Real u; - ShortestDistancePointToSegment2D(&start, &end, &loc, NULL, &snapLoc, &u); + ShortestDistancePointToSegment2D(&start, &end, &loc, nullptr, &snapLoc, &u); if (u < 0 || u > 1) { continue; } @@ -94,7 +94,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) } } } - return NULL; + return nullptr; } //============================================================================= @@ -117,7 +117,7 @@ Bool RoadTool::snap(Coord3D *pLoc, Bool skipFirst) } if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; Vector2 dist; if (!pMapObj->isSelected()) { @@ -177,13 +177,13 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu isLandmark = tt->isBridge(); } if (isLandmark) { - MapObject *pNew1 = newInstance(MapObject)(loc1, RoadOptions::getCurRoadName(), 0.0f, 0, NULL, tt ); + MapObject *pNew1 = newInstance(MapObject)(loc1, RoadOptions::getCurRoadName(), 0.0f, 0, nullptr, tt ); pNew1->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew1); pNew1->setSelected(true); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObj = NULL; + m_mapObj = nullptr; return; } } @@ -191,7 +191,7 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu Bool snapped = false; Bool divideSegment = false; - MapObject* pickedSegment = NULL; + MapObject* pickedSegment = nullptr; if (!isBridge) { snapped = snap(&loc1, false); if (!snapped) { @@ -222,13 +222,13 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu roadName = RoadOptions::getCurRoadName(); } - MapObject *pNew1 = newInstance(MapObject)(loc1, roadName, 0.0f, 0, NULL, NULL ); - MapObject *pNew2 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, NULL, NULL ); - MapObject *pNew3 = NULL; - MapObject *pNew4 = NULL; + MapObject *pNew1 = newInstance(MapObject)(loc1, roadName, 0.0f, 0, nullptr, nullptr ); + MapObject *pNew2 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, nullptr, nullptr ); + MapObject *pNew3 = nullptr; + MapObject *pNew4 = nullptr; if (divideSegment) { - pNew3 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, NULL, NULL ); - pNew4 = newInstance(MapObject)(loc3, roadName, 0.0f, 0, NULL, NULL ); + pNew3 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, nullptr, nullptr ); + pNew4 = newInstance(MapObject)(loc3, roadName, 0.0f, 0, nullptr, nullptr ); } pNew1->setColor(RGB(255,255,0)); // make road endpoints yellow. @@ -295,7 +295,7 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew3); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObj = NULL; + m_mapObj = nullptr; PointerTool::clearSelection(); pNew2->setSelected(true); pNew3->setSelected(true); @@ -308,7 +308,7 @@ void RoadTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB if (m != TRACK_L) return; Coord3D loc1 ; - if (m_mapObj == NULL) { + if (m_mapObj == nullptr) { return; } @@ -336,6 +336,6 @@ void RoadTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB void RoadTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) { if (m != TRACK_L) return; - m_mapObj = NULL; + m_mapObj = nullptr; } diff --git a/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp b/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp index 4214f468044..9640f4e4483 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SaveMap.cpp @@ -28,7 +28,7 @@ // SaveMap dialog -SaveMap::SaveMap(TSaveMapInfo *pInfo, CWnd* pParent /*=NULL*/) +SaveMap::SaveMap(TSaveMapInfo *pInfo, CWnd* pParent /*=nullptr*/) : CDialog(SaveMap::IDD, pParent), m_pInfo(pInfo) { @@ -74,7 +74,7 @@ void SaveMap::OnUserMaps() void SaveMap::OnOK() { CWnd *pEdit = GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit == NULL) { + if (pEdit == nullptr) { DEBUG_CRASH(("Bad resources.")); OnCancel(); return; @@ -119,7 +119,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) m_pInfo->usingSystemDir = m_usingSystemDir = systemMaps; ::AfxGetApp()->WriteProfileInt(MAP_OPENSAVE_PANEL_SECTION, "UseSystemDir", m_usingSystemDir); - HANDLE hFindFile = 0; + HANDLE hFindFile = nullptr; WIN32_FIND_DATA findData; char dirBuf[_MAX_PATH]; char findBuf[_MAX_PATH]; @@ -136,7 +136,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) dirBuf[len] = 0; } CListBox *pList = (CListBox *)this->GetDlgItem(IDC_SAVE_LIST); - if (pList == NULL) return; + if (pList == nullptr) return; pList->ResetContent(); snprintf(findBuf, ARRAY_SIZE(findBuf), "%s*.*", dirBuf); @@ -163,7 +163,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) if (hFindFile) FindClose(hFindFile); } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit != NULL) { + if (pEdit != nullptr) { strlcpy(fileBuf, m_pInfo->filename, ARRAY_SIZE(fileBuf)); Int len = strlen(fileBuf); if (len>4 && stricmp(".map", fileBuf+(len-4)) == 0) { @@ -186,7 +186,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) void SaveMap::OnSelchangeSaveList() { CListBox *pList = (CListBox *)this->GetDlgItem(IDC_SAVE_LIST); - if (pList == NULL) { + if (pList == nullptr) { return; } @@ -196,7 +196,7 @@ void SaveMap::OnSelchangeSaveList() pList->GetText(sel, filename); } CWnd *pEdit = GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit == NULL) { + if (pEdit == nullptr) { return; } pEdit->SetWindowText(filename); @@ -207,11 +207,11 @@ BOOL SaveMap::OnInitDialog() CDialog::OnInitDialog(); CButton *pSystemMaps = (CButton *)this->GetDlgItem(IDC_SYSTEMMAPS); - if (pSystemMaps != NULL) + if (pSystemMaps != nullptr) pSystemMaps->SetCheck( m_usingSystemDir ); CButton *pUserMaps = (CButton *)this->GetDlgItem(IDC_USERMAPS); - if (pUserMaps != NULL) + if (pUserMaps != nullptr) pUserMaps->SetCheck( !m_usingSystemDir ); // TheSuperHackers @tweak Originally World Builder has hidden the System Maps tab button in Release builds, diff --git a/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp index 12c8ef06c20..1ef2a1dedf5 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScorchOptions.cpp @@ -31,13 +31,13 @@ Scorches ScorchOptions::m_scorchtype = SCORCH_1; Real ScorchOptions::m_scorchsize = DEFAULT_SCORCHMARK_RADIUS; -ScorchOptions *ScorchOptions::m_staticThis = NULL; +ScorchOptions *ScorchOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// // ScorchOptions dialog -ScorchOptions::ScorchOptions(CWnd* pParent /*=NULL*/) +ScorchOptions::ScorchOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(ScorchOptions) // NOTE: the ClassWizard will add member initialization here @@ -63,7 +63,7 @@ END_MESSAGE_MAP() MapObject *ScorchOptions::getSingleSelectedScorch(void) { - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; MapObject *pMapObj; @@ -79,7 +79,7 @@ MapObject *ScorchOptions::getSingleSelectedScorch(void) return theMapObj; } - return(NULL); + return(nullptr); } void ScorchOptions::updateTheUI(void) @@ -261,7 +261,7 @@ void ScorchOptions::getAllSelectedDicts(void) Dict** ScorchOptions::getAllSelectedDictsData() { #if defined(USING_STLPORT) || __cplusplus < 201103L - return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : NULL; + return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : nullptr; #else return m_allSelectedDicts.data(); #endif diff --git a/Generals/Code/Tools/WorldBuilder/src/ScorchTool.cpp b/Generals/Code/Tools/WorldBuilder/src/ScorchTool.cpp index 7dc51c9a8de..e5c9cd07ff3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScorchTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScorchTool.cpp @@ -94,7 +94,7 @@ MapObject *ScorchTool::pickScorch(Coord3D loc){ return pObj; } } - return NULL; + return nullptr; } @@ -111,7 +111,7 @@ void ScorchTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld ScorchOptions::update(); } else { pView->snapPoint(&docPt); - MapObject *pNew = newInstance(MapObject)(docPt, "Scorch", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance(MapObject)(docPt, "Scorch", 0, 0, nullptr, nullptr ); pNew->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); pNew->setSelected(true); pNew->setIsScorch(); @@ -120,7 +120,7 @@ void ScorchTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. ScorchOptions::update(); } m_mouseDownPt = docPt; diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp index 336773df565..4808855cdf4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp @@ -32,7 +32,7 @@ IMPLEMENT_DYNCREATE(ScriptActionsFalse, CPropertyPage) ScriptActionsFalse::ScriptActionsFalse() : CPropertyPage(ScriptActionsFalse::IDD), -m_falseAction(NULL), +m_falseAction(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptActionsFalse) @@ -82,7 +82,7 @@ BOOL ScriptActionsFalse::OnInitDialog() void ScriptActionsFalse::loadList(void) { - m_falseAction = NULL; + m_falseAction = nullptr; ScriptDialog::updateScriptWarning(m_script); CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); Int count = 0; @@ -111,7 +111,7 @@ void ScriptActionsFalse::loadList(void) void ScriptActionsFalse::OnEditAction() { CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); - if (m_falseAction == NULL) { + if (m_falseAction == nullptr) { return; } EditAction cDlg; @@ -128,13 +128,13 @@ void ScriptActionsFalse::OnEditAction() void ScriptActionsFalse::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_DELETE); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_MOVE_DOWN); pWnd->EnableWindow(m_falseAction && m_falseAction->getNext()); @@ -146,7 +146,7 @@ void ScriptActionsFalse::enableUI() void ScriptActionsFalse::OnSelchangeActionList() { - m_falseAction = NULL; + m_falseAction = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -220,7 +220,7 @@ Bool ScriptActionsFalse::doMoveDown() if (m_falseAction && m_falseAction->getNext()) { ScriptAction *pNext = m_falseAction->getNext(); ScriptAction *pCur = m_script->getFalseAction(); - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; while (pCur != m_falseAction) { pPrev = pCur; pCur = pCur->getNext(); diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp index b81e71d3c3f..fc043ce8e3d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp @@ -32,7 +32,7 @@ IMPLEMENT_DYNCREATE(ScriptActionsTrue, CPropertyPage) ScriptActionsTrue::ScriptActionsTrue() : CPropertyPage(ScriptActionsTrue::IDD), -m_action(NULL), +m_action(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptActionsTrue) @@ -82,7 +82,7 @@ BOOL ScriptActionsTrue::OnInitDialog() void ScriptActionsTrue::loadList(void) { - m_action = NULL; + m_action = nullptr; ScriptDialog::updateScriptWarning(m_script); CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); Int count = 0; @@ -111,7 +111,7 @@ void ScriptActionsTrue::loadList(void) void ScriptActionsTrue::OnEditAction() { CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); - if (m_action == NULL) { + if (m_action == nullptr) { return; } EditAction cDlg; @@ -128,13 +128,13 @@ void ScriptActionsTrue::OnEditAction() void ScriptActionsTrue::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_DELETE); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_MOVE_DOWN); pWnd->EnableWindow(m_action && m_action->getNext()); @@ -146,7 +146,7 @@ void ScriptActionsTrue::enableUI() void ScriptActionsTrue::OnSelchangeActionList() { - m_action = NULL; + m_action = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -220,7 +220,7 @@ Bool ScriptActionsTrue::doMoveDown() if (m_action && m_action->getNext()) { ScriptAction *pNext = m_action->getNext(); ScriptAction *pCur = m_script->getAction(); - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; while (pCur != m_action) { pPrev = pCur; pCur = pCur->getNext(); diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index 639fb1aac32..dd61986bc84 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -32,8 +32,8 @@ IMPLEMENT_DYNCREATE(ScriptConditionsDlg, CPropertyPage) ScriptConditionsDlg::ScriptConditionsDlg() : CPropertyPage(ScriptConditionsDlg::IDD), -m_condition(NULL), -m_orCondition(NULL), +m_condition(nullptr), +m_orCondition(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptConditionsDlg) @@ -121,7 +121,7 @@ void ScriptConditionsDlg::loadList(void) void ScriptConditionsDlg::OnEditCondition() { CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); - if (m_condition == NULL) { + if (m_condition == nullptr) { return; } EditCondition cDlg; @@ -145,10 +145,10 @@ void ScriptConditionsDlg::OnEditCondition() void ScriptConditionsDlg::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT_CONDITION); - pWnd->EnableWindow(m_condition!=NULL); + pWnd->EnableWindow(m_condition!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_condition!=NULL); + pWnd->EnableWindow(m_condition!=nullptr); pWnd = GetDlgItem(IDC_DELETE); pWnd->EnableWindow(m_condition || m_orCondition); @@ -156,15 +156,15 @@ void ScriptConditionsDlg::enableUI() void ScriptConditionsDlg::setSel(OrCondition *pOr, Condition *pCond) { - m_orCondition = NULL; - m_condition = NULL; + m_orCondition = nullptr; + m_condition = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); if (pList) { pList->SetCurSel(-1); Int count = 0; m_orCondition = m_script->getOrCondition(); while (m_orCondition) { - if (m_orCondition==pOr && pCond==NULL) { + if (m_orCondition==pOr && pCond==nullptr) { pList->SetCurSel(count); enableUI(); return; @@ -188,8 +188,8 @@ void ScriptConditionsDlg::setSel(OrCondition *pOr, Condition *pCond) void ScriptConditionsDlg::OnSelchangeConditionList() { - m_orCondition = NULL; - m_condition = NULL; + m_orCondition = nullptr; + m_condition = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -234,7 +234,7 @@ void ScriptConditionsDlg::OnOr() m_script->setOrCondition(pOr); } loadList(); - setSel(pOr, NULL); + setSel(pOr, nullptr); } void ScriptConditionsDlg::OnNew() @@ -248,7 +248,7 @@ void ScriptConditionsDlg::OnNew() pCond->setNextCondition(m_condition->getNext()); m_condition->setNextCondition(pCond); } else { - if (m_orCondition == NULL) { + if (m_orCondition == nullptr) { OrCondition *pOr = newInstance( OrCondition); pOr->setNextOrCondition(m_script->getOrCondition()); m_script->setOrCondition(pOr); @@ -292,7 +292,7 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) (*outWhichNow) = m_orCondition; if (m_condition && m_orCondition) { Condition *pNext = m_condition->getNext(); - if (pNext==NULL) { + if (pNext==nullptr) { OrCondition *pNOr = m_orCondition->getNextOrCondition(); if (!pNOr) { pNOr = newInstance( OrCondition); @@ -308,7 +308,7 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) } Condition *pCur = m_orCondition->getFirstAndCondition(); - Condition *pPrev = NULL; + Condition *pPrev = nullptr; while (pCur != m_condition) { pPrev = pCur; pCur = pCur->getNext(); @@ -328,9 +328,9 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) return 1; } else if (m_orCondition) { OrCondition *pNext = m_orCondition->getNextOrCondition(); - if (pNext==NULL) return 0; + if (pNext==nullptr) return 0; OrCondition *pCur = m_script->getOrCondition(); - OrCondition *pPrev = NULL; + OrCondition *pPrev = nullptr; while (pCur != m_orCondition) { pPrev = pCur; pCur = pCur->getNextOrCondition(); @@ -358,14 +358,14 @@ Int ScriptConditionsDlg::doMoveUp( OrCondition **outWhichNow ) if (m_condition && m_orCondition) { (*outWhichNow) = m_orCondition; Condition *pPrev = m_orCondition->findPreviousCondition(m_condition); - if (pPrev == NULL) { + if (pPrev == nullptr) { OrCondition *pNOr = m_script->findPreviousOrCondition(m_orCondition); if (!pNOr) { pNOr = newInstance( OrCondition); pNOr->setNextOrCondition(m_orCondition); m_script->setOrCondition(pNOr); } - Condition *previous = pNOr->findPreviousCondition(NULL); + Condition *previous = pNOr->findPreviousCondition(nullptr); if (previous) { m_orCondition->removeCondition(m_condition); previous->setNextCondition(m_condition); diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptDialog.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptDialog.cpp index 1cfdb69b091..a56eeace5c9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptDialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptDialog.cpp @@ -47,7 +47,7 @@ static const Int K_LOCAL_TEAMS_VERSION_1 = 1; #define SCRIPT_DIALOG_SECTION "ScriptDialog" static const char* NEUTRAL_NAME_STR = "(neutral)"; -ScriptDialog *ScriptDialog::m_staticThis = NULL; +ScriptDialog *ScriptDialog::m_staticThis = nullptr; static AsciiString formatScriptLabel(Script *pScr) { AsciiString fmt; @@ -126,12 +126,12 @@ void CSDTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) if (item) { ScriptDialog *sd = (ScriptDialog*) GetParent(); - if (sd->friend_getCurScript() != NULL) + if (sd->friend_getCurScript() != nullptr) { Bool active = sd->friend_getCurScript()->isActive(); pPopup->CheckMenuItem(ID_SCRIPTACTIVATE, MF_BYCOMMAND | (active ? MF_CHECKED : MF_UNCHECKED)); } - else if (sd->friend_getCurGroup() != NULL) + else if (sd->friend_getCurGroup() != nullptr) { Bool active = sd->friend_getCurGroup()->isActive(); pPopup->CheckMenuItem(ID_SCRIPTACTIVATE, MF_BYCOMMAND | (active ? MF_CHECKED : MF_UNCHECKED)); @@ -149,7 +149,7 @@ END_MESSAGE_MAP() // ScriptDialog dialog -ScriptDialog::ScriptDialog(CWnd* pParent /*=NULL*/) +ScriptDialog::ScriptDialog(CWnd* pParent /*=nullptr*/) : CDialog(ScriptDialog::IDD, pParent) { m_draggingTreeView = false; @@ -160,8 +160,8 @@ ScriptDialog::ScriptDialog(CWnd* pParent /*=NULL*/) ScriptDialog::~ScriptDialog() { - EditParameter::setCurSidesList(NULL); - m_staticThis=NULL; + EditParameter::setCurSidesList(nullptr); + m_staticThis=nullptr; } @@ -200,7 +200,7 @@ void ScriptDialog::OnSelchangedScriptTree(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); - if (pNMTreeView->itemNew.hItem==NULL) { + if (pNMTreeView->itemNew.hItem==nullptr) { m_curSelection.IntToList(0); m_curSelection.m_objType = ListType::PLAYER_TYPE; } else { @@ -215,10 +215,10 @@ void ScriptDialog::OnSelchangedScriptTree(NMHDR* pNMHDR, LRESULT* pResult) ScriptGroup *pGroup = getCurGroup(); CWnd *pWnd = GetDlgItem(IDC_EDIT_SCRIPT); - pWnd->EnableWindow(pScript!=NULL || pGroup!=NULL); + pWnd->EnableWindow(pScript!=nullptr || pGroup!=nullptr); pWnd = GetDlgItem(IDC_COPY_SCRIPT); - pWnd->EnableWindow(pScript!=NULL); + pWnd->EnableWindow(pScript!=nullptr); pWnd = GetDlgItem(IDC_DELETE); pWnd->EnableWindow(m_curSelection.m_objType != ListType::PLAYER_TYPE); @@ -257,7 +257,7 @@ Script *ScriptDialog::getCurScript(void) if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE || m_curSelection.m_objType == ListType::SCRIPT_IN_GROUP_TYPE) { ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); if (pSL) { - Script *pScr=NULL; + Script *pScr=nullptr; if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE) { pScr = pSL->getScript(); } else { @@ -278,17 +278,17 @@ Script *ScriptDialog::getCurScript(void) } } } - return NULL; + return nullptr; } ScriptGroup *ScriptDialog::getCurGroup(void) { ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); if (m_curSelection.m_objType == ListType::PLAYER_TYPE) { - return NULL; + return nullptr; } if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE) { - return NULL; + return nullptr; } if (pSL) { Int groupNdx; @@ -299,7 +299,7 @@ ScriptGroup *ScriptDialog::getCurGroup(void) } } } - return NULL; + return nullptr; } /** Updates the warning flags in a script, & script conditions & actions. */ @@ -394,7 +394,7 @@ BOOL ScriptDialog::OnInitDialog() pTree->SetImageList(&m_imageList, TVSIL_STATE); for (i=0; iSelectItem(hItem); didSelect = true; } @@ -406,7 +406,7 @@ BOOL ScriptDialog::OnInitDialog() GetWindowRect(&top); top.top = ::AfxGetApp()->GetProfileInt(SCRIPT_DIALOG_SECTION, "Top", top.top); top.left =::AfxGetApp()->GetProfileInt(SCRIPT_DIALOG_SECTION, "Left", top.left); - SetWindowPos(NULL, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + SetWindowPos(nullptr, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -485,7 +485,7 @@ Bool ScriptDialog::updateIcons(HTREEITEM hItem) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM child = pTree->GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { ListType lt; lt.IntToList(pTree->GetItemData(child)); @@ -637,7 +637,7 @@ void ScriptDialog::reloadPlayer(Int playerIndex, ScriptList *pSL) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM player = pTree->GetChildItem(TVI_ROOT); - while (player != NULL) { + while (player != nullptr) { TVITEM item; ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; @@ -683,7 +683,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM player = pTree->GetChildItem(TVI_ROOT); TVITEM item; - while (player != NULL) { + while (player != nullptr) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = player; @@ -696,7 +696,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) player = pTree->GetNextSiblingItem(player); } DEBUG_ASSERTCRASH(player, ("Couldn't find player.")); - if (!player) return NULL; + if (!player) return nullptr; if (sel.m_objType == ListType::PLAYER_TYPE) { return player; } @@ -706,7 +706,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) group = player; // top level scripts are grouped under player. } else { group = pTree->GetChildItem(player); - while (group != NULL) { + while (group != nullptr) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = group; @@ -721,13 +721,13 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) } } DEBUG_ASSERTCRASH(group, ("Couldn't find group.")); - if (!group) return NULL; + if (!group) return nullptr; if (sel.m_objType == ListType::GROUP_TYPE) { return group; } HTREEITEM script; - for (script = pTree->GetChildItem(group); script != NULL; script = pTree->GetNextSiblingItem(script)) { + for (script = pTree->GetChildItem(group); script != nullptr; script = pTree->GetNextSiblingItem(script)) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = script; @@ -864,7 +864,7 @@ void ScriptDialog::OnEditScript() Script *pScript = getCurScript(); ScriptGroup *pGroup = getCurGroup(); DEBUG_ASSERTCRASH(pScript || pGroup, ("Null script.")); - if (pScript == NULL) { + if (pScript == nullptr) { CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM item = findItem(m_curSelection); if (pGroup) { @@ -872,7 +872,7 @@ void ScriptDialog::OnEditScript() if (IDOK==editDlg.DoModal()) { if (item) { pTree->SetItemText(item, pGroup->getName().str()); - pTree->SelectItem(NULL); + pTree->SelectItem(nullptr); updateWarnings(); pTree->SelectItem(item); } @@ -906,7 +906,7 @@ void ScriptDialog::OnEditScript() HTREEITEM item = findItem(m_curSelection); if (item) { pTree->SetItemText(item, formatScriptLabel(pScript).str()); - pTree->SelectItem(NULL); + pTree->SelectItem(nullptr); updateWarnings(); pTree->SelectItem(item); // Updates the comment field & text field. } @@ -919,7 +919,7 @@ void ScriptDialog::OnCopyScript() { Script *pScript = getCurScript(); DEBUG_ASSERTCRASH(pScript, ("Null script.")); - if (pScript == NULL) return; + if (pScript == nullptr) return; Script *pDup = pScript->duplicate(); AsciiString newName = pDup->getName(); newName.concat(" C"); @@ -944,7 +944,7 @@ void ScriptDialog::OnDelete() m_curSelection.m_objType = ListType::PLAYER_TYPE; } else { pGroup->deleteScript(pScript); - if (pGroup->getScript()==NULL) { + if (pGroup->getScript()==nullptr) { m_curSelection.m_objType = ListType::GROUP_TYPE; } } @@ -953,7 +953,7 @@ void ScriptDialog::OnDelete() } } else { pSL->deleteScript(pScript); - if (pSL->getScript()==NULL) { + if (pSL->getScript()==nullptr) { m_curSelection.m_objType = ListType::PLAYER_TYPE; } } @@ -1128,10 +1128,10 @@ void ScriptDialog::OnSave() ScriptList *scripts[MAX_PLAYER_COUNT]; for (i=0; iaddScript(pScript, 0); } - if (scripts[0] == NULL) { + if (scripts[0] == nullptr) { ::AfxMessageBox("No scripts selected - aborting export.", MB_OK); return; } @@ -1343,7 +1343,7 @@ void ScriptDialog::OnSave() void ScriptDialog::OnLoad() { - CFileDialog fileDlg(true, ".scb", NULL, 0, + CFileDialog fileDlg(true, ".scb", nullptr, 0, "Script files (.scb)|*.scb||", this); Int result = fileDlg.DoModal(); @@ -1351,7 +1351,7 @@ void ScriptDialog::OnLoad() // Open document dialog may change working directory, // change it back. char buf[_MAX_PATH]; - ::GetModuleFileName(NULL, buf, sizeof(buf)); + ::GetModuleFileName(nullptr, buf, sizeof(buf)); if (char *pEnd = strrchr(buf, '\\')) { *pEnd = 0; } @@ -1368,8 +1368,8 @@ void ScriptDialog::OnLoad() try { ChunkInputStream *pStrm = &theInputStream; DataChunkInput file( pStrm ); - m_firstReadObject = NULL; - m_firstTrigger = NULL; + m_firstReadObject = nullptr; + m_firstTrigger = nullptr; m_waypointBase = pDoc->getNextWaypointID(); m_maxWaypoint = m_waypointBase; file.registerParser( "PlayerScriptsList", AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk ); @@ -1393,13 +1393,13 @@ void ScriptDialog::OnLoad() AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_firstReadObject); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_firstReadObject = NULL; // undoable owns it now. + m_firstReadObject = nullptr; // undoable owns it now. } PolygonTrigger *pTrig; PolygonTrigger *pNextTrig; for (pTrig=m_firstTrigger; pTrig; pTrig = pNextTrig) { pNextTrig = pTrig->getNext(); - pTrig->setNextPoly(NULL); + pTrig->setNextPoly(nullptr); PolygonTrigger::addPolygonTrigger(pTrig); } @@ -1407,7 +1407,7 @@ void ScriptDialog::OnLoad() Int count = ScriptList::getReadScripts(scripts); Int i; for (i=0; igetScript() == NULL && scripts[i]->getScriptGroup()==NULL) continue; + if (scripts[i]->getScript() == nullptr && scripts[i]->getScriptGroup()==nullptr) continue; Int curSide = -1; if (count==1) { curSide = m_curSelection.m_playerIndex; @@ -1439,7 +1439,7 @@ void ScriptDialog::OnLoad() Int j=0; for (pScr = scripts[i]->getScript(); pScr; pScr=pNextScr) { pNextScr=pScr->getNext(); - pScr->setNextScript(NULL); + pScr->setNextScript(nullptr); pSL->addScript(pScr, j); //unlink it and add. j++; } @@ -1448,13 +1448,13 @@ void ScriptDialog::OnLoad() ScriptGroup *pNextGroup; for (pGroup = scripts[i]->getScriptGroup(); pGroup; pGroup=pNextGroup) { pNextGroup=pGroup->getNext(); - pGroup->setNextGroup(NULL); + pGroup->setNextGroup(nullptr); pSL->addGroup(pGroup, j); j++; } scripts[i]->discard(); /* Frees the script list, but none of it's children, as they have been copied into the current scripts. */ - scripts[i] = NULL; + scripts[i] = nullptr; if (pSL) { reloadPlayer(curSide, pSL); } @@ -1473,7 +1473,7 @@ void ScriptDialog::OnLoad() */ Bool ScriptDialog::ParseObjectsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData) { - file.m_currentObject = NULL; + file.m_currentObject = nullptr; file.registerParser( "Object", info->label, ParseObjectDataChunk ); return (file.parse(userData)); } @@ -1543,10 +1543,10 @@ Bool ScriptDialog::ParseObjectDataChunk(DataChunkInput &file, DataChunkInfo *inf } if (pPrevious) { - DEBUG_ASSERTCRASH(pThis->m_firstReadObject != NULL && pPrevious->getNext() == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(pThis->m_firstReadObject != nullptr && pPrevious->getNext() == nullptr, ("Bad linkage.")); pPrevious->setNextMap(pThisOne); } else { - DEBUG_ASSERTCRASH(pThis->m_firstReadObject == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(pThis->m_firstReadObject == nullptr, ("Bad linkage.")); pThis->m_firstReadObject = pThisOne; } file.m_currentObject = pThisOne; @@ -1656,8 +1656,8 @@ Bool ScriptDialog::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChunk AsciiString triggerName; // Remove any existing polygon triggers, if any. ScriptDialog *pThis = (ScriptDialog *)userData; - pThis->m_firstTrigger = NULL; - PolygonTrigger *pPrevTrig = NULL; + pThis->m_firstTrigger = nullptr; + PolygonTrigger *pPrevTrig = nullptr; count = file.readInt(); Bool isRiver; Int riverStart; @@ -1721,7 +1721,7 @@ void ScriptDialog::OnDblclkScriptTree(NMHDR* pNMHDR, LRESULT* pResult) { Script *pScript = getCurScript(); ScriptGroup *pGroup = getCurGroup(); - if (pScript == NULL && pGroup == NULL) return; + if (pScript == nullptr && pGroup == nullptr) return; OnEditScript(); *pResult = 0; } @@ -1767,7 +1767,7 @@ void ScriptDialog::OnMouseMove(UINT nFlags, CPoint point) const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != NULL) { + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { pTree->SelectDropTarget(htiTarget); } } @@ -1788,7 +1788,7 @@ void ScriptDialog::OnLButtonUp(UINT nFlags, CPoint point) const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != NULL) { + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { pTree->SelectItem(htiTarget); pTree->SelectDropTarget(htiTarget); doDropOn(m_dragItem, htiTarget); @@ -1806,13 +1806,13 @@ void ScriptDialog::doDropOn(HTREEITEM hDrag, HTREEITEM hTarget) ListType target; target.IntToList(pTree->GetItemData(hTarget)); - Script *dragScript = NULL; - ScriptGroup *dragGroup = NULL; + Script *dragScript = nullptr; + ScriptGroup *dragGroup = nullptr; m_curSelection = drag; Script *pScript = getCurScript(); ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); ScriptGroup *pGroup = getCurGroup(); - if (pSL == NULL) return; + if (pSL == nullptr) return; if (pScript) { dragScript = pScript->duplicate(); if (pGroup) { @@ -1841,7 +1841,7 @@ void ScriptDialog::doDropOn(HTREEITEM hDrag, HTREEITEM hTarget) pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); pGroup = getCurGroup(); DEBUG_ASSERTCRASH((pSL), ("Hmm - bad data. jba.")); - if (pSL == NULL) return; + if (pSL == nullptr) return; // If we are dragging a group onto a script, adjust the group index so we add after. if (drag.m_objType == ListType::GROUP_TYPE) { @@ -1901,7 +1901,7 @@ void ScriptDialog::OnScriptActivate() CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM item = findItem(m_curSelection); - if (getCurScript() != NULL) + if (getCurScript() != nullptr) { /// Updates attributes active = getCurScript()->isActive(); @@ -1923,7 +1923,7 @@ void ScriptDialog::OnScriptActivate() pTree->SetItemState(item, INDEXTOSTATEIMAGEMASK(6), TVIS_STATEIMAGEMASK); } } - else if (getCurGroup() != NULL) + else if (getCurGroup() != nullptr) { /// Updates attributes active = getCurGroup()->isActive(); diff --git a/Generals/Code/Tools/WorldBuilder/src/ScriptProperties.cpp b/Generals/Code/Tools/WorldBuilder/src/ScriptProperties.cpp index 64b1c401ea7..68e403d43d0 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ScriptProperties.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ScriptProperties.cpp @@ -29,7 +29,7 @@ IMPLEMENT_DYNCREATE(ScriptProperties, CPropertyPage) -ScriptProperties::ScriptProperties() : m_updating(false), m_script(NULL), +ScriptProperties::ScriptProperties() : m_updating(false), m_script(nullptr), CPropertyPage(ScriptProperties::IDD) { //{{AFX_DATA_INIT(ScriptProperties) diff --git a/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index d2de095c9e8..23bbfa673e7 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -30,7 +30,7 @@ // SelectMacrotexture dialog -SelectMacrotexture::SelectMacrotexture(CWnd* pParent /*=NULL*/) +SelectMacrotexture::SelectMacrotexture(CWnd* pParent /*=nullptr*/) : CDialog(SelectMacrotexture::IDD, pParent) { //{{AFX_DATA_INIT(SelectMacrotexture) @@ -80,7 +80,7 @@ BOOL SelectMacrotexture::OnInitDialog() if (!filenameList.empty()) { TVINSERTSTRUCT ins; - HTREEITEM child = NULL; + HTREEITEM child = nullptr; FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/Generals/Code/Tools/WorldBuilder/src/ShadowOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ShadowOptions.cpp index b07a6ad140c..d3695af3b47 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ShadowOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ShadowOptions.cpp @@ -31,7 +31,7 @@ // ShadowOptions dialog -ShadowOptions::ShadowOptions(CWnd* pParent /*=NULL*/) +ShadowOptions::ShadowOptions(CWnd* pParent /*=nullptr*/) : CDialog(ShadowOptions::IDD, pParent) { //{{AFX_DATA_INIT(ShadowOptions) diff --git a/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp b/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp index ecd327af6d1..8f139382d02 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp @@ -65,7 +65,7 @@ void SplashScreen::outputText(UINT nIDString) m_loadString = str; - RedrawWindow(&m_rect, NULL); + RedrawWindow(&m_rect, nullptr); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp index 803b19d7e57..76ae9a5c0f4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp @@ -83,8 +83,8 @@ void TeamGeneric::_fillComboBoxesWithScripts() void TeamGeneric::_dictToScripts() { - CWnd *pText = NULL; - CComboBox *pCombo = NULL; + CWnd *pText = nullptr; + CComboBox *pCombo = nullptr; if (!m_teamDict) { return; @@ -162,8 +162,8 @@ void TeamGeneric::_scriptsToDict() return; } - CWnd *pText = NULL; - CComboBox *pCombo = NULL; + CWnd *pText = nullptr; + CComboBox *pCombo = nullptr; int scriptNum = 0; diff --git a/Generals/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp b/Generals/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp index 3ca98b22b2c..36cbba5c4f4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp @@ -31,7 +31,7 @@ TeamReinforcement::TeamReinforcement() : CPropertyPage(TeamReinforcement::IDD) , - m_teamDict(NULL) + m_teamDict(nullptr) { //{{AFX_DATA_INIT(TeamReinforcement) // NOTE: the ClassWizard will add member initialization here diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index beed12aff1f..8b25017731d 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -33,7 +33,7 @@ #include "W3DDevice/GameClient/TerrainTex.h" #include "W3DDevice/GameClient/HeightMap.h" -TerrainMaterial *TerrainMaterial::m_staticThis = NULL; +TerrainMaterial *TerrainMaterial::m_staticThis = nullptr; static Int defaultMaterialIndex = 0; @@ -46,7 +46,7 @@ Int TerrainMaterial::m_currentBgTexture(6); Bool TerrainMaterial::m_paintingPathingInfo; Bool TerrainMaterial::m_paintingPassable; -TerrainMaterial::TerrainMaterial(CWnd* pParent /*=NULL*/) : +TerrainMaterial::TerrainMaterial(CWnd* pParent /*=nullptr*/) : m_updating(false), m_currentWidth(3) { @@ -141,10 +141,10 @@ void TerrainMaterial::updateLabel(void) AsciiString name = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture); const char *tName = name.str(); - if (tName == NULL || tName[0] == 0) { + if (tName == nullptr || tName[0] == 0) { tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); } - if (tName == NULL) { + if (tName == nullptr) { return; } const char *leaf = tName; @@ -175,7 +175,7 @@ Bool TerrainMaterial::setTerrainTreeViewSelection(HTREEITEM parent, Int selectio char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; @@ -217,7 +217,7 @@ BOOL TerrainMaterial::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_terrainSwatches.ShowWindow(SW_SHOW); m_paintingPathingInfo = false; @@ -247,7 +247,7 @@ HTREEITEM TerrainMaterial::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -496,7 +496,7 @@ BOOL TerrainMaterial::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) } } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_terrainTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_terrainTreeView.GetChildItem(hItem); } diff --git a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp index c4d6e5a30a2..a17a70211a1 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -34,7 +34,7 @@ // TerrainModal dialog -TerrainModal::TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent /*=NULL*/) +TerrainModal::TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent /*=nullptr*/) : CDialog(TerrainModal::IDD, pParent) { //{{AFX_DATA_INIT(TerrainModal) @@ -60,10 +60,10 @@ void TerrainModal::updateLabel(void) if (!pDoc) return; const char *tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); - if (tName == NULL || tName[0] == 0) { + if (tName == nullptr || tName[0] == 0) { tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); } - if (tName == NULL) { + if (tName == nullptr) { return; } const char *leaf = tName; @@ -98,7 +98,7 @@ BOOL TerrainModal::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_terrainSwatches.ShowWindow(SW_SHOW); pWnd = GetDlgItem(IDC_MISSING_NAME); @@ -119,7 +119,7 @@ HTREEITEM TerrainModal::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -247,7 +247,7 @@ Bool TerrainModal::setTerrainTreeViewSelection(HTREEITEM parent, Int selection) char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; diff --git a/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp b/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp index a5262814966..57490fe0aba 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp @@ -40,7 +40,7 @@ TileTool::TileTool(void) : Tool(ID_TILE_TOOL, IDC_TILE_CURSOR) { - m_htMapEditCopy = NULL; + m_htMapEditCopy = nullptr; } /// Destructor diff --git a/Generals/Code/Tools/WorldBuilder/src/Tool.cpp b/Generals/Code/Tools/WorldBuilder/src/Tool.cpp index 4962e7cff48..f55ab2027c9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/Tool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/Tool.cpp @@ -36,7 +36,7 @@ Tool::Tool(Int toolID, Int cursorID) { m_toolID = toolID; m_cursorID = cursorID; - m_cursor = NULL; + m_cursor = nullptr; } @@ -59,7 +59,7 @@ void Tool::activate() void Tool::setCursor(void) { - if (m_cursor == NULL) { + if (m_cursor == nullptr) { m_cursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(m_cursorID)); } ::SetCursor(m_cursor); diff --git a/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp b/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp index 3b57d0cb3f7..ddea4384636 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp @@ -50,7 +50,7 @@ BOOL CWBFrameWnd::LoadFrame(UINT nIDResource, if (ret) { Int top = ::AfxGetApp()->GetProfileInt(TWO_D_WINDOW_SECTION, "Top", 10); Int left =::AfxGetApp()->GetProfileInt(TWO_D_WINDOW_SECTION, "Left", 10); - this->SetWindowPos(NULL, left, + this->SetWindowPos(nullptr, left, top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); if (!m_cellSizeToolBar.Create(this, IDD_CELL_SLIDER, CBRS_LEFT, IDD_CELL_SLIDER)) diff --git a/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp b/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp index ceaf815bc85..ef58aa73b74 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp @@ -70,7 +70,7 @@ void WBHeightMap::setFlattenHeights(Bool flat) m_flattenHeights = flat; m_originX = 0; m_originY = 0; - updateBlock(0, 0, m_x-1, m_y-1, m_map, NULL); + updateBlock(0, 0, m_x-1, m_y-1, m_map, nullptr); } } diff --git a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index 4a3fd07652f..ceceb6328fa 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -51,7 +51,7 @@ void WBPopupSliderButton::SetupPopSliderButton if (hbmOld) ::DeleteObject(hbmOld); - hbmOld = NULL; + hbmOld = nullptr; } @@ -61,7 +61,7 @@ void WBPopupSliderButton::SetupPopSliderButton WBPopupSliderButton::WBPopupSliderButton() { - m_owner = NULL; + m_owner = nullptr; } WBPopupSliderButton::~WBPopupSliderButton() @@ -118,7 +118,7 @@ point; ///////////////////////////////////////////////////////////////////////////// // PopupSlider static member variables -PopupSlider *PopupSlider::gPopupSlider = 0; +PopupSlider *PopupSlider::gPopupSlider = nullptr; ///////////////////////////////////////////////////////////////////////////// @@ -226,7 +226,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, DEBUG_ASSERTCRASH(((SB_HORZ == kind) || (SB_VERT == kind)), ("PopupSlider - unexpected kind of slider!")); - DEBUG_ASSERTCRASH(pSliderOwner, ("slider owner is NULL!")); + DEBUG_ASSERTCRASH(pSliderOwner, ("slider owner is null!")); try { CRect rect; @@ -257,7 +257,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, } catch (...) { // don't rethrow delete pPopupSlider; - pPopupSlider = NULL; + pPopupSlider = nullptr; } @@ -270,13 +270,13 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, PopupSlider::PopupSlider() { - mSliderOwner = NULL; + mSliderOwner = nullptr; mDraggingThumb = false; mClickThrough = false; mSetOrigPt = false; mEverMoved = false; - mIcon = NULL; + mIcon = nullptr; m_lo = m_hi = m_curValue = 0; m_valOnLastFinished = 0; @@ -289,7 +289,7 @@ PopupSlider::~PopupSlider() (void)bRet; DEBUG_ASSERTCRASH(bRet != 0, ("Oops.")); - mIcon = NULL; + mIcon = nullptr; } } @@ -326,7 +326,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) DWORD dwExStyle = WS_EX_TOPMOST; DWORD dwStyle = WS_POPUP; UINT nClassStyle = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT | CS_SAVEBITS; - HCURSOR hCursor = ::LoadCursor(NULL, IDC_ARROW); + HCURSOR hCursor = ::LoadCursor(nullptr, IDC_ARROW); CString className = AfxRegisterWndClass(nClassStyle, hCursor, (HBRUSH) m_brush3dFaceColor); long winWidth, winHeight; @@ -341,7 +341,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) dwStyle, winRect.left, winRect.top, winRect.Width(), winRect.Height(), pParentWnd->GetSafeHwnd(), - NULL, NULL)) + nullptr, nullptr)) throw(-1); @@ -370,7 +370,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) CRect myWindowRect; GetWindowRect(&myWindowRect); myWindowRect.OffsetRect(hAdjustToCenter, vAdjustToCenter); - SetWindowPos(NULL, myWindowRect.left, myWindowRect.top, myWindowRect.Width(), myWindowRect.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW); + SetWindowPos(nullptr, myWindowRect.left, myWindowRect.top, myWindowRect.Width(), myWindowRect.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW); } // finally, make sure the window appears on screen @@ -400,7 +400,7 @@ void PopupSlider::PostNcDestroy() // now that the window has gone away, delete ourselves if (gPopupSlider == this) { delete gPopupSlider; - gPopupSlider = NULL; + gPopupSlider = nullptr; } } @@ -439,7 +439,7 @@ void PopupSlider::OnPaint() CRect iconRect; GetThumbIconRect(&iconRect); ::DrawIconEx(dc.GetSafeHdc(), iconRect.left, iconRect.top, - mIcon, 0, 0, 0, NULL, DI_NORMAL); + mIcon, 0, 0, 0, nullptr, DI_NORMAL); } // Do not call CWnd::OnPaint() for painting messages } diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index e667ac3f90c..4ae9c528cb3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -72,9 +72,9 @@ void WorldHeightMapEdit::init(void) Int i, j; for (i=0; im_alphaEdgeTex); REF_PTR_SET(m_terrainTex, pThis->m_terrainTex); @@ -219,7 +219,7 @@ m_warnTooManyBlend(false) memset(m_cellFlipState,0,numBytesX*numBytesY); //clear all flags memset(m_cellCliffState,0,numBytesX*numBytesY); //clear all flags m_data = new UnsignedByte[m_dataSize + m_width+1]; - if (m_data == NULL) { + if (m_data == nullptr) { AfxMessageBox(IDS_OUT_OF_MEMORY); m_dataSize = 0; } else { @@ -448,7 +448,7 @@ void WorldHeightMapEdit::loadImagesFromTerrainType( TerrainType *terrain ) { // sanity - if( terrain == NULL ) + if( terrain == nullptr ) return; char buffer[ _MAX_PATH ]; @@ -510,7 +510,7 @@ void WorldHeightMapEdit::loadImagesFromTerrainType( TerrainType *terrain ) Bool WorldHeightMapEdit::getRawTileData(Short tileNdx, Int width, UnsignedByte *buffer, Int bufLen) { - TileData *pSrc = NULL; + TileData *pSrc = nullptr; if (tileNdx/4 < NUM_SOURCE_TILES) { pSrc = m_sourceTiles[tileNdx/4]; } @@ -541,14 +541,14 @@ Bool WorldHeightMapEdit::getRawTileData(Short tileNdx, Int width, UnsignedByte * WorldHeightMapEdit::getPointerToClassTileData(Int texClass) { - TileData *pSrc = NULL; + TileData *pSrc = nullptr; if (texClass >= 0 && texClass <= m_numGlobalTextureClasses) { pSrc = m_globalTextureClasses[texClass].tiles[0]; } - if (pSrc != NULL) { + if (pSrc != nullptr) { return(pSrc->getDataPtr()); } - return(NULL); + return(nullptr); } @@ -820,14 +820,14 @@ void WorldHeightMapEdit::saveToFile(DataChunkOutput &chunkWriter) // // duplicate - Makes a copy. -// Returns NULL if allocation failed. +// Returns null if allocation failed. WorldHeightMapEdit *WorldHeightMapEdit::duplicate(void) { WorldHeightMapEdit *newMap = new WorldHeightMapEdit(this); - if (newMap->m_data == NULL) { + if (newMap->m_data == nullptr) { delete newMap; - return(NULL); + return(nullptr); } return(newMap); } @@ -891,7 +891,7 @@ Int WorldHeightMapEdit::getTileIndexFromTerrainType( TerrainType *terrain ) { // sanity - if( terrain == NULL ) + if( terrain == nullptr ) return -1; // search the texture list for a matching texture filename @@ -925,7 +925,7 @@ Int WorldHeightMapEdit::allocateTiles(Int textureClass) m_textureClasses[m_numTextureClasses].isBlendEdgeTile = m_globalTextureClasses[textureClass].isBlendEdgeTile; m_numTextureClasses++; REF_PTR_RELEASE(m_terrainTex); // need to update the texture. - updateTileTexturePositions(NULL); + updateTileTexturePositions(nullptr); for (i=0; iblendNdx; sourceNdx = sourceNdx>>2; pBlendTile = m_sourceTiles[sourceNdx]; - if (pBlendTile == NULL) { + if (pBlendTile == nullptr) { return(-1); } // Make a quick scan through the blended tiles, and see if we already got this one. @@ -1135,7 +1135,7 @@ void WorldHeightMapEdit::blendSpecificTiles(Int xIndex, Int yIndex, Int srcXInde Bool baseNeedsFlip = false; UnsignedByte baseIsDiagonal = 0; Int ndx = (yIndex*m_width)+xIndex; - TBlendTileInfo *baseBlendInfo=NULL; + TBlendTileInfo *baseBlendInfo=nullptr; if (TheGlobalData->m_use3WayTerrainBlends && m_blendTileNdxes[ndx] != 0) { baseBlendInfo=&m_blendedTiles[m_blendTileNdxes[ndx]]; //Figure out if this tile will eventually need flipping when rendered @@ -1243,13 +1243,13 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas for (i=0; im_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int curNdx = (pCurNode->m_y*m_width)+pCurNode->m_x; for (i=pCurNode->m_x-1; im_x+2; i++) { if (i<0) continue; @@ -1310,11 +1310,11 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas } pNodesToProcess = pProcessedNodes; - pProcessedNodes = NULL; + pProcessedNodes = nullptr; while (pNodesToProcess) { CProcessNode *pCurNode = pNodesToProcess; pNodesToProcess = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int curNdx = (pCurNode->m_y*m_width)+pCurNode->m_x; for (i=pCurNode->m_x-1; im_x+2; i++) { if (i<0) continue; @@ -1344,7 +1344,7 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas } delete[] pProcessed; - pProcessed = NULL; + pProcessed = nullptr; } /****************************************************************** @@ -1534,13 +1534,13 @@ Bool WorldHeightMapEdit::floodFill(Int xIndex, Int yIndex, Int textureClass, Boo } } } else { - CProcessNode *pNodesToProcess = NULL; + CProcessNode *pNodesToProcess = nullptr; Int nodesProcessed = 0; pNodesToProcess = new CProcessNode(xIndex, yIndex); while (pNodesToProcess) { CProcessNode *pCurNode = pNodesToProcess; pNodesToProcess = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int ndx = (pCurNode->m_y*m_width)+pCurNode->m_x; Int blendNdx = m_blendTileNdxes[ndx]; setTileNdx(pCurNode->m_x, pCurNode->m_y, textureClass, false); @@ -2010,7 +2010,7 @@ void WorldHeightMapEdit::removeFirstObject(void) { MapObject *firstObj = MapObject::TheMapObjectListPtr; MapObject::TheMapObjectListPtr = firstObj->getNext(); - firstObj->setNextMap(NULL); // so we don't delete the whole list. + firstObj->setNextMap(nullptr); // so we don't delete the whole list. deleteInstance(firstObj); } @@ -2024,7 +2024,7 @@ Bool WorldHeightMapEdit::selectDuplicates(void) const float DELTA = 0.05f; MapObject *firstObj = MapObject::TheMapObjectListPtr; MapObject *pObj; -// MapObject *pPrevRoad = NULL; +// MapObject *pPrevRoad = nullptr; Bool anySelected = false; for (pObj=firstObj; pObj; pObj=pObj->getNext()) { pObj->setSelected(false); @@ -2048,7 +2048,7 @@ Bool WorldHeightMapEdit::selectDuplicates(void) } if (pObj->getFlag(FLAG_ROAD_FLAGS)) { - if (pObj->getNext() == NULL) continue; + if (pObj->getNext() == nullptr) continue; if (!pObj->getFlag(FLAG_ROAD_POINT1)) { continue; } @@ -2108,7 +2108,7 @@ Bool WorldHeightMapEdit::selectSimilar(void) return false; } - for (otherObj=firstObj; otherObj != NULL; otherObj=otherObj->getNext()) { + for (otherObj=firstObj; otherObj != nullptr; otherObj=otherObj->getNext()) { if (otherObj->getName() != selectedObj->getName()) { continue; // names don't match. } @@ -2206,7 +2206,7 @@ Bool WorldHeightMapEdit::selectInvalidTeam(void) if (anySelected) { DEBUG_LOG(("%s", report.str())); - MessageBox(NULL, report.str(), "Missing team report", MB_OK); + MessageBox(nullptr, report.str(), "Missing team report", MB_OK); } return anySelected; @@ -2255,15 +2255,15 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) for (i=0; im_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; - if (pNodesToProcess == NULL) { + if (pNodesToProcess == nullptr) { if (pMutantNodes) { pNodesToProcess = pMutantNodes; pMutantNodes = pMutantNodes->m_next; - pNodesToProcess->m_next = NULL; + pNodesToProcess->m_next = nullptr; pProcessTail = pNodesToProcess; } } @@ -2456,7 +2456,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (uvRange.hi.ym_x-1; im_x+2; i++) { if (i<0) continue; @@ -2507,16 +2507,16 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (cliffInfo.mutant) { pNodes[curNdx]->m_next = pMutantNodes; pMutantNodes = pNodes[curNdx]; - pNodes[curNdx] = NULL; + pNodes[curNdx] = nullptr; } else { if (pProcessTail) { pProcessTail->m_next = pNodes[curNdx]; } pProcessTail = pNodes[curNdx]; - if (pNodesToProcess == NULL) { + if (pNodesToProcess == nullptr) { pNodesToProcess = pNodes[curNdx]; } - pNodes[curNdx] = NULL; + pNodes[curNdx] = nullptr; } } else { k = 0; @@ -2533,7 +2533,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) while (pUnCliffyNodes) { CProcessNode *pCurNode = pUnCliffyNodes; pUnCliffyNodes = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; ndx = (pCurNode->m_y*m_width)+pCurNode->m_x; if (!pProcessed[ndx]) { m_cliffInfoNdxes[ndx] = 0; diff --git a/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp index e716b431b42..eabfa56d1bd 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp @@ -34,7 +34,7 @@ #include "Common/WellKnownKeys.h" #include "LayersList.h" -WaterOptions *WaterOptions::m_staticThis = NULL; +WaterOptions *WaterOptions::m_staticThis = nullptr; Int WaterOptions::m_waterHeight = 7; Int WaterOptions::m_waterPointSpacing = MAP_XY_FACTOR; Bool WaterOptions::m_creatingWaterAreas = false; @@ -42,8 +42,8 @@ Bool WaterOptions::m_creatingWaterAreas = false; /// WaterOptions dialog trivial construstor - Create does the real work. -WaterOptions::WaterOptions(CWnd* pParent /*=NULL*/): -m_moveUndoable(NULL) +WaterOptions::WaterOptions(CWnd* pParent /*=nullptr*/): +m_moveUndoable(nullptr) { //{{AFX_DATA_INIT(WaterOptions) // NOTE: the ClassWizard will add member initialization here @@ -88,7 +88,7 @@ void WaterOptions::updateTheUI(void) } pButton = (CButton*)GetDlgItem(IDC_MAKE_RIVER); pButton->SetCheck(isRiver ? 1:0); - pButton->EnableWindow(theTrigger!=NULL); + pButton->EnableWindow(theTrigger!=nullptr); pWnd = m_staticThis->GetDlgItem(IDC_SPACING); char buffer[12]; diff --git a/Generals/Code/Tools/WorldBuilder/src/WaterTool.cpp b/Generals/Code/Tools/WorldBuilder/src/WaterTool.cpp index 239e003acd7..e820d5a10c2 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WaterTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WaterTool.cpp @@ -124,12 +124,12 @@ void WaterTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB void WaterTool::setCursor(void) { if (m_poly_mouseUpPlus || (m_poly_isAdding && m_poly_curSelectedPolygon)) { - if (m_poly_plusCursor == NULL) { + if (m_poly_plusCursor == nullptr) { m_poly_plusCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_WATER_PLUS)); } ::SetCursor(m_poly_plusCursor); } else if (m_poly_mouseUpMove) { - if (m_poly_moveCursor == NULL) { + if (m_poly_moveCursor == nullptr) { m_poly_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_WATER_MOVE)); } ::SetCursor(m_poly_moveCursor); diff --git a/Generals/Code/Tools/WorldBuilder/src/WaypointOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/WaypointOptions.cpp index 111bb04d8e3..c2324238759 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WaypointOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WaypointOptions.cpp @@ -34,13 +34,13 @@ #include "Common/WellKnownKeys.h" #include "LayersList.h" -WaypointOptions *WaypointOptions::m_staticThis = NULL; +WaypointOptions *WaypointOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// /// WaypointOptions dialog trivial construstor - Create does the real work. -WaypointOptions::WaypointOptions(CWnd* pParent /*=NULL*/): -m_moveUndoable(NULL) +WaypointOptions::WaypointOptions(CWnd* pParent /*=nullptr*/): +m_moveUndoable(nullptr) { //{{AFX_DATA_INIT(WaypointOptions) // NOTE: the ClassWizard will add member initialization here @@ -58,7 +58,7 @@ void WaypointOptions::DoDataExchange(CDataExchange* pDX) MapObject *WaypointOptions::getSingleSelectedWaypoint(void) { - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; MapObject *pMapObj; @@ -74,13 +74,13 @@ MapObject *WaypointOptions::getSingleSelectedWaypoint(void) return theMapObj; } - return(NULL); + return(nullptr); } PolygonTrigger *WaypointOptions::getSingleSelectedPolygon(void) { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return NULL; + if (pDoc==nullptr) return nullptr; WbView3d *p3View = pDoc->GetActive3DView(); Bool showPoly = false; if (p3View) { @@ -93,7 +93,7 @@ PolygonTrigger *WaypointOptions::getSingleSelectedPolygon(void) } } } - return(NULL); + return(nullptr); } void WaypointOptions::updateTheUI(void) @@ -522,7 +522,7 @@ void WaypointOptions::OnEditchangeWaypointlabel1Edit() void WaypointOptions::changeWaypointLabel(Int editControlID, NameKeyType key) { MapObject *theMapObj = getSingleSelectedWaypoint(); - if (theMapObj==NULL) return; + if (theMapObj==nullptr) return; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); if (!pDoc->isWaypointLinked(theMapObj)) { return; @@ -552,7 +552,7 @@ void WaypointOptions::OnEditchangeWaypointlabel3Edit() void WaypointOptions::OnWaypointBidirectional() { MapObject *theMapObj = getSingleSelectedWaypoint(); - if (theMapObj==NULL) return; + if (theMapObj==nullptr) return; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); if (!pDoc->isWaypointLinked(theMapObj)) { return; diff --git a/Generals/Code/Tools/WorldBuilder/src/WaypointTool.cpp b/Generals/Code/Tools/WorldBuilder/src/WaypointTool.cpp index 24568828216..56d74756523 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WaypointTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WaypointTool.cpp @@ -100,7 +100,7 @@ MapObject *WaypointTool::pickWaypoint(Coord3D loc){ return pObj; } } - return NULL; + return nullptr; } @@ -119,7 +119,7 @@ void WaypointTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor WaypointOptions::update(); } else { pView->snapPoint(&docPt); - MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); Int id = pDoc->getNextWaypointID(); AsciiString name = WaypointOptions::GenerateUniqueName(id); pNew->setSelected(true); @@ -130,7 +130,7 @@ void WaypointTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. m_downWaypointID = id; WaypointOptions::update(); } @@ -164,9 +164,9 @@ void WaypointTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld MapObject *pObj; PointerTool::clearSelection(); pObj = pickWaypoint(docPt); - if (pObj == NULL) { + if (pObj == nullptr) { pView->snapPoint(&docPt); - MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); Int id = pDoc->getNextWaypointID(); AsciiString name; name.format("Waypoint %d", id); @@ -179,7 +179,7 @@ void WaypointTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. pObj = pNew; - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. } if (pObj) { diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index aa8be4c583b..76ea0533cff 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -87,17 +87,17 @@ static SubsystemInterfaceList TheSubsystemListRecord; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = nullptr, const char* path2 = nullptr) { sysref = sys; - TheSubsystemListRecord.initSubsystem(sys, path1, path2, NULL); + TheSubsystemListRecord.initSubsystem(sys, path1, path2, nullptr); } #define APP_SECTION "WorldbuilderApp" #define OPEN_FILE_DIR "OpenDirectory" -Win32Mouse *TheWin32Mouse = NULL; +Win32Mouse *TheWin32Mouse = nullptr; const char *gAppPrefix = "wb_"; /// So WB can have a different debug log file name. const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; @@ -160,7 +160,7 @@ FileClass * WB_W3DFileSystem::Get_File( char const *filename ) // The one and only CWorldBuilderApp object static CWorldBuilderApp theApp; -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; /** * The ApplicationHInstance is needed for the WOL code, @@ -168,9 +168,9 @@ HWND ApplicationHWnd = NULL; * Of course, the WOL code is in gameengine, while the * HINSTANCE is only in the various projects' main files. * So, we need to create the HINSTANCE, even if it always - * stays NULL. Just to make COM happy. Whee. + * stays null. Just to make COM happy. Whee. */ -HINSTANCE ApplicationHInstance = NULL; +HINSTANCE ApplicationHInstance = nullptr; ///////////////////////////////////////////////////////////////////////////// // CWorldBuilderApp @@ -196,15 +196,15 @@ static Int gFirstCP = 0; // CWorldBuilderApp construction CWorldBuilderApp::CWorldBuilderApp() : - m_curTool(NULL), - m_selTool(NULL), + m_curTool(nullptr), + m_selTool(nullptr), m_lockCurTool(0), - m_3dtemplate(NULL), - m_pasteMapObjList(NULL) + m_3dtemplate(nullptr), + m_pasteMapObjList(nullptr) { for (Int i=0; igetPath_UserData().str()); - CreateDirectory(buf, NULL); + CreateDirectory(buf, nullptr); // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.loadFileDirectory( "Data\\INI\\Default\\Water", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Water", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Water", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Water", INI_LOAD_OVERWRITE, nullptr ); initSubsystem(TheGameText, CreateGameTextInterface()); initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science", "Data\\INI\\Science"); @@ -376,7 +376,7 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheScriptEngine, (ScriptEngine*)(new ScriptEngine())); // need this before TheAudio in case we're running off of CD - TheAudio can try to open Music.big on the CD... - initSubsystem(TheCDManager, CreateCDManager(), NULL); + initSubsystem(TheCDManager, CreateCDManager(), nullptr); initSubsystem(TheAudio, (AudioManager*)new MilesAudioManager()); if (!TheAudio->isMusicAlreadyLoaded()) return FALSE; @@ -385,16 +385,16 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(TheRankInfoStore, new RankInfoStore(), nullptr, "Data\\INI\\Rank"); initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheWeaponStore, new WeaponStore(), nullptr, "Data\\INI\\Weapon"); initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), nullptr, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), nullptr, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), nullptr, "Data\\INI\\Armor"); initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); @@ -474,12 +474,12 @@ BOOL CWorldBuilderApp::InitInstance() BOOL CWorldBuilderApp::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { - // If pHandlerInfo is NULL, then handle the message - if (pHandlerInfo == NULL) + // If pHandlerInfo is null, then handle the message + if (pHandlerInfo == nullptr) { for (Int i=0; igetToolID()) { if (nCode == CN_COMMAND) { @@ -635,16 +635,16 @@ int CWorldBuilderApp::ExitInstance() WorldHeightMapEdit::shutdown(); delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; #ifdef MEMORYPOOL_CHECKPOINTING Int lastCP = TheMemoryPoolFactory->debugSetCheckpoint(); diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index da3eb6fb1c3..94cdc3995d3 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -125,8 +125,8 @@ END_MESSAGE_MAP() // CWorldBuilderDoc construction/destruction CWorldBuilderDoc::CWorldBuilderDoc() : - m_heightMap(NULL), - m_undoList(NULL), + m_heightMap(nullptr), + m_undoList(nullptr), m_maxUndos(MAX_UNDOS), /// @todo: get from pref? m_curRedo(0), m_needAutosave(false), @@ -140,7 +140,7 @@ CWorldBuilderDoc::CWorldBuilderDoc() : CWorldBuilderDoc::~CWorldBuilderDoc() { #ifdef ONLY_ONE_AT_A_TIME - if (m_heightMap != NULL ) { + if (m_heightMap != nullptr ) { gAlreadyOpen = false; } #endif @@ -268,9 +268,9 @@ class CompressedCachedMFCFileOutputStream : public OutputStream m_file->Write(srcBuffer, m_totalBytes); } delete[] srcBuffer; - srcBuffer = NULL; + srcBuffer = nullptr; delete[] destBuffer; - destBuffer = NULL; + destBuffer = nullptr; } }; @@ -301,7 +301,7 @@ void CWorldBuilderDoc::Serialize(CArchive& ar) chunkWriter->closeDataChunk(); delete chunkWriter; - chunkWriter = NULL; + chunkWriter = nullptr; theStream.flush(); } catch(...) { const char *msg = "WorldHeightMapEdit::WorldHeightMapEdit height map file write failed: "; @@ -400,7 +400,7 @@ void CWorldBuilderDoc::Serialize(CArchive& ar) REF_PTR_RELEASE(m_undoList); m_curRedo = 0; POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -536,7 +536,7 @@ void CWorldBuilderDoc::validate(void) // swapDict contains a 'history' of missing model swaps done this load, so all objects with a // particular name are replaced with the exact same model. AsciiString name = pMapObj->getName(); - if (pMapObj->getThingTemplate() == NULL) + if (pMapObj->getThingTemplate() == nullptr) { Bool exists = false; swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); @@ -619,12 +619,12 @@ void CWorldBuilderDoc::OnJumpToGame() DoFileSave(); CString filename; DEBUG_LOG(("strTitle=%s strPathName=%s", m_strTitle, m_strPathName)); - if (strstr(m_strPathName, TheGlobalData->getPath_UserData().str()) != NULL) + if (strstr(m_strPathName, TheGlobalData->getPath_UserData().str()) != nullptr) filename.Format("%sMaps\\%s", TheGlobalData->getPath_UserData().str(), static_cast(m_strTitle)); else filename.Format("Maps\\%s", static_cast(m_strTitle)); - /*int retval =*/ _spawnl(_P_NOWAIT, "\\projects\\rts\\run\\rtsi.exe", "ignored", "-scriptDebug", "-win", "-file", static_cast(filename), NULL); + /*int retval =*/ _spawnl(_P_NOWAIT, "\\projects\\rts\\run\\rtsi.exe", "ignored", "-scriptDebug", "-win", "-file", static_cast(filename), nullptr); } catch (...) { } } @@ -640,7 +640,7 @@ BOOL CWorldBuilderDoc::DoFileSave() } // File does not exist, dwAttrib==0xffffffff // we do not have read-write access or the file does not (now) exist - if (!DoSave(NULL)) + if (!DoSave(nullptr)) { TRACE0("Warning: File save with new name failed.\n"); return FALSE; @@ -660,7 +660,7 @@ BOOL CWorldBuilderDoc::DoFileSave() BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) // Save the document data to a file // lpszPathName = path name where to save document file - // if lpszPathName is NULL then the user will be prompted (SaveAs) + // if lpszPathName is null then the user will be prompted (SaveAs) // note: lpszPathName can be different than 'm_strPathName' // if 'bReplace' is TRUE will change file name if successful (SaveAs) // if 'bReplace' is FALSE will not change path name (SaveCopyAs) @@ -669,7 +669,7 @@ BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) if (newName.IsEmpty()) { CDocTemplate* pTemplate = GetDocTemplate(); - ASSERT(pTemplate != NULL); + ASSERT(pTemplate != nullptr); newName = m_strPathName; if (bReplace && newName.IsEmpty()) @@ -737,7 +737,7 @@ BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) if (!OnSaveDocument(newName)) { - if (lpszPathName == NULL) + if (lpszPathName == nullptr) { // be sure to delete the file try @@ -869,7 +869,7 @@ void CWorldBuilderDoc::SetHeightMap(WorldHeightMapEdit *pMap, Bool doUpdate) REF_PTR_SET(m_heightMap, pMap); if (doUpdate) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -885,7 +885,7 @@ void CWorldBuilderDoc::AddAndDoUndoable(Undoable *pUndo) { Undoable *pCurUndo = m_undoList; Int count = m_curRedo; - while(count>0 && pCurUndo != NULL) { + while(count>0 && pCurUndo != nullptr) { count--; pCurUndo = pCurUndo->GetNext(); } @@ -901,7 +901,7 @@ void CWorldBuilderDoc::AddAndDoUndoable(Undoable *pUndo) while (pCurUndo) { count++; if (count >= MAX_UNDOS) { - pCurUndo->LinkNext(NULL); + pCurUndo->LinkNext(nullptr); break; } pCurUndo = pCurUndo->GetNext(); @@ -919,7 +919,7 @@ void CWorldBuilderDoc::OnEditRedo() count--; pUndo = pUndo->GetNext(); } - DEBUG_ASSERTCRASH((pUndo != NULL),("oops")); + DEBUG_ASSERTCRASH((pUndo != nullptr),("oops")); if (pUndo) { pUndo->Redo(); SetModifiedFlag(); @@ -930,7 +930,7 @@ void CWorldBuilderDoc::OnEditRedo() void CWorldBuilderDoc::OnUpdateEditRedo(CCmdUI* pCmdUI) { - pCmdUI->Enable(m_undoList!=NULL && m_curRedo>0); + pCmdUI->Enable(m_undoList!=nullptr && m_curRedo>0); } void CWorldBuilderDoc::OnEditUndo() @@ -939,11 +939,11 @@ void CWorldBuilderDoc::OnEditUndo() m_needAutosave = true; m_waypointTableNeedsUpdate=true; Int count = m_curRedo; - while(count>0 && pUndo != NULL) { + while(count>0 && pUndo != nullptr) { count--; pUndo = pUndo->GetNext(); } - if (pUndo != NULL) { + if (pUndo != nullptr) { pUndo->Undo(); SetModifiedFlag(); m_curRedo++; @@ -962,17 +962,17 @@ void CWorldBuilderDoc::OnTogglePitchAndRotation( void ) void CWorldBuilderDoc::OnUpdateEditUndo(CCmdUI* pCmdUI) { Bool canUndo=false; - if (m_undoList!=NULL) { + if (m_undoList!=nullptr) { if (m_curRedo == 0) { canUndo = true; // haven't undone any yet. } else { Undoable *pUndo = m_undoList; Int count = m_curRedo; - while(count>0 && pUndo != NULL) { + while(count>0 && pUndo != nullptr) { count--; pUndo = pUndo->GetNext(); } - canUndo = pUndo != NULL; + canUndo = pUndo != nullptr; } } pCmdUI->Enable(canUndo); @@ -992,7 +992,7 @@ void CWorldBuilderDoc::OnTsCanonical() if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->optimizeTiles()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); @@ -1028,7 +1028,7 @@ void CWorldBuilderDoc::OnFileResize() } WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; Coord3D objOffset; if (htMapEditCopy->resize(hi.xExtent, hi.yExtent, hi.initialHeight, hi.borderWidth, hi.anchorTop, hi.anchorBottom, hi.anchorLeft, hi.anchorRight, &objOffset)) { // does all the work. @@ -1038,7 +1038,7 @@ void CWorldBuilderDoc::OnFileResize() POSITION pos = GetFirstViewPosition(); IRegion2D partialRange = {0,0,0,0}; Get3DView()->updateHeightMapInView(m_heightMap, false, partialRange); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1058,7 +1058,7 @@ void CWorldBuilderDoc::OnTsRemap() { if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->remapTextures()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); @@ -1094,7 +1094,7 @@ void CWorldBuilderDoc::OnTsRemap() // only works for SDI, not MDI return (CWorldBuilderDoc*)CMainFrame::GetMainFrame()->GetActiveDocument(); #endif - return NULL; + return nullptr; } /* static */ CWorldBuilderView *CWorldBuilderDoc::GetActive2DView() @@ -1103,7 +1103,7 @@ void CWorldBuilderDoc::OnTsRemap() if (pDoc) { return pDoc->Get2DView(); } - return NULL; + return nullptr; } /* static */ WbView3d *CWorldBuilderDoc::GetActive3DView() @@ -1112,33 +1112,33 @@ void CWorldBuilderDoc::OnTsRemap() if (pDoc) { return pDoc->Get3DView(); } - return NULL; + return nullptr; } CWorldBuilderView *CWorldBuilderDoc::Get2DView() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CWorldBuilderView))) return (CWorldBuilderView*)pView; } - return NULL; + return nullptr; } WbView3d *CWorldBuilderDoc::Get3DView() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(WbView3d))) return (WbView3d*)pView; } - return NULL; + return nullptr; } void CWorldBuilderDoc::Create2DView() @@ -1156,8 +1156,8 @@ void CWorldBuilderDoc::Create3DView() CDocTemplate* pTemplate = WbApp()->Get3dTemplate(); IRegion2D partialRange = {0,0,0,0}; ASSERT_VALID(pTemplate); - CFrameWnd* pFrame = pTemplate->CreateNewFrame(this, NULL); - if (pFrame == NULL) + CFrameWnd* pFrame = pTemplate->CreateNewFrame(this, nullptr); + if (pFrame == nullptr) { TRACE0("Warning: failed to create new frame.\n"); return; // command failed @@ -1253,7 +1253,7 @@ BOOL CWorldBuilderDoc::OnNewDocument() Create3DView(); POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1269,7 +1269,7 @@ BOOL CWorldBuilderDoc::OnNewDocument() void CWorldBuilderDoc::invalObject(MapObject *pMapObj) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1281,7 +1281,7 @@ void CWorldBuilderDoc::invalObject(MapObject *pMapObj) void CWorldBuilderDoc::invalCell(int xIndex, int yIndex) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1296,7 +1296,7 @@ void CWorldBuilderDoc::syncViewCenters(Real x, Real y) return; POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1309,7 +1309,7 @@ void CWorldBuilderDoc::syncViewCenters(Real x, Real y) void CWorldBuilderDoc::updateAllViews() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1321,7 +1321,7 @@ void CWorldBuilderDoc::updateAllViews() void CWorldBuilderDoc::updateHeightMap(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1349,7 +1349,7 @@ BOOL CWorldBuilderDoc::OnOpenDocument(LPCTSTR lpszPathName) TheGameText->reset(); AsciiString s = lpszPathName; const char* lastSep = s.reverseFind('\\'); - if (lastSep != NULL) + if (lastSep != nullptr) { s.truncateTo(lastSep - s.str() + 1); } @@ -1358,7 +1358,7 @@ BOOL CWorldBuilderDoc::OnOpenDocument(LPCTSTR lpszPathName) TheGameText->initMapStringFile(s); WbApp()->setCurrentDirectory(AsciiString(buf)); - ::GetModuleFileName(NULL, buf, sizeof(buf)); + ::GetModuleFileName(nullptr, buf, sizeof(buf)); if (char *pEnd = strrchr(buf, '\\')) { *pEnd = 0; } @@ -1386,7 +1386,7 @@ Bool CWorldBuilderDoc::getCellIndexFromCoord(Coord3D cpt, CPoint *ndxP) Bool inMap = true; WorldHeightMapEdit *pMap = GetHeightMap(); - if (pMap == NULL) return false; + if (pMap == nullptr) return false; Int xIndex = floor(cpt.x/MAP_XY_FACTOR); xIndex += pMap->getBorderSize(); @@ -1491,7 +1491,7 @@ Bool CWorldBuilderDoc::getCellPositionFromCoord(Coord3D cpt, Coord3D *locP) locP->x = -1; locP->y = -1; WorldHeightMapEdit *pMap = GetHeightMap(); - if (pMap == NULL) return(false); + if (pMap == nullptr) return(false); // yLocation = pMap->getYExtent() - yLocation; CPoint curNdx; if (getCellIndexFromCoord(cpt, &curNdx)) { @@ -1588,7 +1588,7 @@ void CWorldBuilderDoc::compressWaypointIds(void) { updateWaypointTable(); m_curWaypointID = 0; - MapObject *pMapObj = NULL; + MapObject *pMapObj = nullptr; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->isWaypoint()) { Int nwpid = getNextWaypointID(); @@ -1644,17 +1644,17 @@ void CWorldBuilderDoc::updateWaypointTable(void) m_waypointTableNeedsUpdate=false; Int i; for (i=0; igetNext()) { if (pMapObj->isWaypoint()) { Int id = pMapObj->getWaypointID(); DEBUG_ASSERTCRASH(id>0 && id0 && idsetWaypointID(getNextWaypointID()); m_waypointTableNeedsUpdate=true; } else { @@ -1722,9 +1722,9 @@ MapObject *CWorldBuilderDoc::getWaypointByID(Int waypointID) if (pObj && pObj->isWaypoint()) { return pObj; } - DEBUG_ASSERTCRASH(pObj==NULL, ("Waypoint links to an obj that isn't a waypoint.")); + DEBUG_ASSERTCRASH(pObj==nullptr, ("Waypoint links to an obj that isn't a waypoint.")); } - return NULL; + return nullptr; } //============================================================================= @@ -1805,13 +1805,13 @@ void CWorldBuilderDoc::updateLWL(MapObject *pWay, MapObject *pSrcWay) } MapObject *pCurWay = pWay; - pWay = NULL; + pWay = nullptr; Int i; for (i=0; i=0 && waypointID1getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; writeRawDict( theLogFile, "MapObject",d ); writeRawDict( theLogFile, "MapObjectTeam",teamDict ); } @@ -2139,7 +2139,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) if (tt->getEditorSorting() == ES_STRUCTURE) { Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; Bool showScript = false; @@ -2179,7 +2179,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) Bool exists; Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; Int veterancy = d->getInt(TheKey_objectVeterancy, &exists); @@ -2278,7 +2278,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) if (tt->getEditorSorting() == ES_MISC_MAN_MADE) { Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; @@ -2557,7 +2557,7 @@ void CWorldBuilderDoc::OnRemoveclifftexmapping() if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->removeCliffMapping()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp index 171d50879a2..97a15908662 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp @@ -268,7 +268,7 @@ void CWorldBuilderView::OnPaint() WorldHeightMapEdit *pMap = getTrackingHeightMap(); // If no map yet, there is nothing to draw. - if (pMap==NULL) return; + if (pMap==nullptr) return; Int minJ = 0; Int minI = 0; @@ -358,11 +358,11 @@ void CWorldBuilderView::OnPaint() ::Sleep(5); #endif Int width = m_cellSize; - UnsignedByte *pData = NULL; + UnsignedByte *pData = nullptr; if (m_showTexture) { } // Draw the texture if we have one, else the height color. - if ((pData!=NULL)) { + if ((pData!=nullptr)) { drawMyTexture(&dc, &rect, width, pData); } else { dc.FillSolidRect(&rect, getColorForHeight(ht)); @@ -416,7 +416,7 @@ void CWorldBuilderView::OnPaint() //============================================================================= void CWorldBuilderView::invalObjectInView(MapObject *pMapObj) { - if (pMapObj == NULL) { + if (pMapObj == nullptr) { Invalidate(false); return; } @@ -938,7 +938,7 @@ void CWorldBuilderView::scrollInView(Real xScroll, Real yScroll, Bool end) CPoint pt((client.left+client.right)/2+mXScrollOffset, (client.bottom+client.top)/2+mYScrollOffset); CWorldBuilderDoc* pDoc = WbDoc(); WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; m_centerPt.X = (Real)(pt.x)/m_cellSize; m_centerPt.Y = pMap->getYExtent() - (Real)(pt.y)/m_cellSize; constrainCenterPt(); diff --git a/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp b/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp index 0c0abb1afa6..7372b0d42e4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/addplayerdialog.cpp @@ -32,7 +32,7 @@ // AddPlayerDialog dialog -AddPlayerDialog::AddPlayerDialog(AsciiString side, CWnd* pParent /*=NULL*/) +AddPlayerDialog::AddPlayerDialog(AsciiString side, CWnd* pParent /*=nullptr*/) : CDialog(AddPlayerDialog::IDD, pParent) { //{{AFX_DATA_INIT(AddPlayerDialog) diff --git a/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp b/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp index 030a00630b6..4f4e9c12a53 100644 --- a/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "BrushTool.h" -BrushOptions *BrushOptions::m_staticThis = NULL; +BrushOptions *BrushOptions::m_staticThis = nullptr; Int BrushOptions::m_currentWidth = 0; Int BrushOptions::m_currentHeight = 0; Int BrushOptions::m_currentFeather = 0; @@ -34,7 +34,7 @@ Int BrushOptions::m_currentFeather = 0; /// BrushOptions dialog trivial construstor - Create does the real work. -BrushOptions::BrushOptions(CWnd* pParent /*=NULL*/) +BrushOptions::BrushOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(BrushOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 59d8b883631..20804726755 100644 --- a/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -42,20 +42,20 @@ const char* NEUTRAL_TEAM_INTERNAL_STR = "team"; ///////////////////////////////////////////////////////////////////////////// // MapObjectProps dialog -/*static*/ MapObjectProps *MapObjectProps::TheMapObjectProps = NULL; +/*static*/ MapObjectProps *MapObjectProps::TheMapObjectProps = nullptr; void MapObjectProps::makeMain() { - DEBUG_ASSERTCRASH(TheMapObjectProps == NULL, ("already have a main props")); - if (TheMapObjectProps == NULL) + DEBUG_ASSERTCRASH(TheMapObjectProps == nullptr, ("already have a main props")); + if (TheMapObjectProps == nullptr) TheMapObjectProps = this; } -MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParent /*=NULL*/) : +MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParent /*=nullptr*/) : COptionsPanel(MapObjectProps::IDD, pParent), m_dictToEdit(dictToEdit), m_title(title), - m_selectedObject(NULL) + m_selectedObject(nullptr) { //{{AFX_DATA_INIT(MapObjectProps) // NOTE: the ClassWizard will add member initialization here @@ -65,7 +65,7 @@ MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParen MapObjectProps::~MapObjectProps() { if (TheMapObjectProps == this) - TheMapObjectProps = NULL; + TheMapObjectProps = nullptr; } void MapObjectProps::DoDataExchange(CDataExchange* pDX) @@ -176,7 +176,7 @@ BOOL MapObjectProps::OnInitDialog() m_heightSlider.SetupPopSliderButton(this, IDC_HEIGHT_POPUP, this); m_angleSlider.SetupPopSliderButton(this, IDC_ANGLE_POPUP, this); - m_posUndoable = NULL; + m_posUndoable = nullptr; m_angle = 0; m_height = 0; @@ -205,7 +205,7 @@ void MapObjectProps::updateTheUI(void) continue; } - m_dictToEdit = pMapObj ? pMapObj->getProperties() : NULL; + m_dictToEdit = pMapObj ? pMapObj->getProperties() : nullptr; _DictToTeam(); _DictToName(); @@ -238,7 +238,7 @@ void MapObjectProps::updateTheUI(void) /*static*/ MapObject *MapObjectProps::getSingleSelectedMapObject(void) { MapObject *pMapObj; - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { @@ -253,7 +253,7 @@ void MapObjectProps::updateTheUI(void) if (selCount==1 && theMapObj) { return theMapObj; } - return(NULL); + return(nullptr); } void MapObjectProps::OnEditprop() @@ -717,13 +717,13 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) return; } - if (m_selectedObject == NULL) { + if (m_selectedObject == nullptr) { return; } // Otherwise, fill it with the upgrades available for this unit const ThingTemplate *tt = m_selectedObject->getThingTemplate(); - if (tt == NULL) { + if (tt == nullptr) { // This is valid. For instance, Scorch marks do not have thing templates. return; } @@ -1345,7 +1345,7 @@ void MapObjectProps::getAllSelectedDicts(void) Dict** MapObjectProps::getAllSelectedDictsData() { #if defined(USING_STLPORT) || __cplusplus < 201103L - return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : NULL; + return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : nullptr; #else return m_allSelectedDicts.data(); #endif @@ -1419,7 +1419,7 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) case IDC_HEIGHT_POPUP: case IDC_ANGLE_POPUP: REF_PTR_RELEASE(m_posUndoable); // belongs to pDoc now. - m_posUndoable = NULL; + m_posUndoable = nullptr; break; default: diff --git a/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp b/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp index ec1855d77a5..8448aad4692 100644 --- a/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/playerlistdlg.cpp @@ -238,7 +238,7 @@ static const char* calcRelationStr(SidesList& sides, int t1, int t2) // PlayerListDlg dialog -PlayerListDlg::PlayerListDlg(CWnd* pParent /*=NULL*/) +PlayerListDlg::PlayerListDlg(CWnd* pParent /*=nullptr*/) : CDialog(PlayerListDlg::IDD, pParent), m_updating(0) { //{{AFX_DATA_INIT(PlayerListDlg) diff --git a/Generals/Code/Tools/WorldBuilder/src/teamsdialog.cpp b/Generals/Code/Tools/WorldBuilder/src/teamsdialog.cpp index 1ad5e6a164f..7fcf8ae1d05 100644 --- a/Generals/Code/Tools/WorldBuilder/src/teamsdialog.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/teamsdialog.cpp @@ -42,7 +42,7 @@ static const char* NEUTRAL_NAME_STR = "(neutral)"; // CTeamsDialog dialog -CTeamsDialog::CTeamsDialog(CWnd* pParent /*=NULL*/) +CTeamsDialog::CTeamsDialog(CWnd* pParent /*=nullptr*/) : CDialog(CTeamsDialog::IDD, pParent) { //{{AFX_DATA_INIT(CTeamsDialog) @@ -502,7 +502,7 @@ void CTeamsDialog::OnMoveUpTeam() // rebuild user interface to reflect changes /* - LVITEM *pItem = NULL; + LVITEM *pItem = nullptr; CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_TEAMS_LIST); Bool result = pList->GetItem(pItem); pList->DeleteItem(m_curTeam); @@ -560,7 +560,7 @@ void CTeamsDialog::OnMoveDownTeam() m_curTeam++; // rebuild user interface to reflect changes -/* LVITEM *pItem = NULL; +/* LVITEM *pItem = nullptr; CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_TEAMS_LIST); Bool result = pList->GetItem(pItem); pList->DeleteItem(m_curTeam); diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview.cpp index d512204cf15..a087a7cb8f9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview.cpp @@ -239,10 +239,10 @@ void WbView::mouseMove(TTrackingMode m, CPoint viewPt) } pObj = pObj->getNext(); } - if (pObj==NULL) { + if (pObj==nullptr) { pObj = picked3dObjectInView(viewPt); } - Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, NULL); + Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, nullptr); CString str, str2, str3; str.Format("%d object(s), ", totalObjects); str2.Format("%d waypoint(s), ", totalWaypoints); @@ -396,7 +396,7 @@ WorldHeightMapEdit *WbView::getTrackingHeightMap() pMap = WbApp()->getCurTool()->getHeightMap(); } // If we aren't editing, or the tool doesn't provide a map, use the current one. - if (pMap == NULL) { + if (pMap == nullptr) { pMap = WbDoc()->GetHeightMap(); } return pMap; @@ -406,7 +406,7 @@ WorldHeightMapEdit *WbView::getTrackingHeightMap() void WbView::constrainCenterPt() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; #if 0 if (m_centerPt.X >= pMap->getXExtent()) m_centerPt.X = pMap->getXExtent()-1; if (m_centerPt.X<0) m_centerPt.X = 0; @@ -430,7 +430,7 @@ BOOL WbView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) WbApp()->getCurTool()->setCursor(); } else { // Else just use the system arrow cursor. This shouldn't normally happen. - ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); + ::SetCursor(::LoadCursor(nullptr, IDC_ARROW)); } return(0); } @@ -476,8 +476,8 @@ void WbView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) void WbView::OnEditCopy() { - MapObject *pTheCopy = NULL; - MapObject *pTmp = NULL; + MapObject *pTheCopy = nullptr; + MapObject *pTmp = nullptr; MapObject *pObj = MapObject::getFirstMapObject(); // Note - map segments come in pairs. So copy both. @@ -487,7 +487,7 @@ void WbView::OnEditCopy() if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); DEBUG_ASSERTCRASH(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("oops")); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; // If one end of a road segment is selected, both are. if (pMapObj->isSelected() || pMapObj2->isSelected()) { @@ -510,7 +510,7 @@ void WbView::OnEditCopy() pObj = pObj->getNext(); } WbApp()->setMapObjPasteList(pTheCopy); - pTheCopy = NULL; // belongs to the app. + pTheCopy = nullptr; // belongs to the app. } void WbView::OnUpdateEditCopy(CCmdUI* pCmdUI) @@ -532,8 +532,8 @@ void WbView::OnUpdateEditCut(CCmdUI* pCmdUI) void WbView::OnEditPaste() { CWorldBuilderDoc* pDoc = WbDoc(); - MapObject *pTheCopy = NULL; - MapObject *pTmp = NULL; + MapObject *pTheCopy = nullptr; + MapObject *pTmp = nullptr; /* First, clear the selection. */ PointerTool::clearSelection(); @@ -551,7 +551,7 @@ void WbView::OnEditPaste() AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pTheCopy); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pTheCopy = NULL; // undoable owns it now. + pTheCopy = nullptr; // undoable owns it now. } @@ -561,7 +561,7 @@ void WbView::OnViewShowObjects() m_showObjects = !m_showObjects; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(!m_showObjects); } ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowObjectIcons", m_showObjects?1:0); @@ -576,7 +576,7 @@ void WbView::OnUpdateViewShowObjects(CCmdUI* pCmdUI) void WbView::OnUpdateEditPaste(CCmdUI* pCmdUI) { MapObject *pTheCopy = WbApp()->getMapObjPasteList(); - pCmdUI->Enable(pTheCopy != NULL); + pCmdUI->Enable(pTheCopy != nullptr); } void WbView::OnViewSnaptogrid() @@ -593,26 +593,26 @@ void WbView::OnUpdateViewSnaptogrid(CCmdUI* pCmdUI) void WbView::OnEditSelectdup() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectDuplicates(); } void WbView::OnEditSelectsimilar() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectSimilar(); } void WbView::OnEditSelectinvalidteam() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectInvalidTeam(); } void WbView::OnEditReplace() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; EditorSortingType sort = ES_NONE; for (MapObject* pObj = MapObject::getFirstMapObject(); pObj; pObj = pObj->getNext()) { @@ -770,7 +770,7 @@ void WbView::OnEditWorldinfo() #if 0 Dict *d = MapObject::getWorldDict(); Dict dcopy = *d; - MapObjectProps editor(&dcopy, "Edit World Info", NULL); + MapObjectProps editor(&dcopy, "Edit World Info", nullptr); if (editor.DoModal() == IDOK) { CWorldBuilderDoc* pDoc = WbDoc(); @@ -896,7 +896,7 @@ void WbView::OnShowNames() m_showNames = m_showNames ? false : true; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(false); } @@ -936,7 +936,7 @@ void WbView::OnShowTerrain() m_showTerrain = !m_showTerrain; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(false); } diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 52cfb0e994e..d4c2235c5fb 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -112,7 +112,7 @@ class SkeletonSceneClass; #define SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT -static W3DDynamicLight * theDynamicLight = NULL; +static W3DDynamicLight * theDynamicLight = nullptr; static Real theLightXOffset = 0.1f; static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; @@ -159,15 +159,15 @@ class PlaceholderView : public View Int m_originX, m_originY; ///< Location of top/left view corner protected: - virtual View *prependViewToList( View *list ) {return NULL;}; ///< Prepend this view to the given list, return the new list - virtual View *getNextView( void ) { return NULL; } ///< Return next view in the set + virtual View *prependViewToList( View *list ) {return nullptr;}; ///< Prepend this view to the given list, return the new list + virtual View *getNextView( void ) { return nullptr; } ///< Return next view in the set public: virtual void init( void ){}; virtual UnsignedInt getID( void ) { return 1; } - virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ){return NULL;}; ///< pick drawable given the screen pixel coords + virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ){return nullptr;}; ///< pick drawable given the screen pixel coords /// all drawables in the 2D screen region will call the 'callback' virtual Int iterateDrawablesInRegion( IRegion2D *screenRegion, @@ -254,7 +254,7 @@ class PlaceholderView : public View virtual void snapToCameraLock( void ) { } virtual void setSnapMode( CameraLockType lockType, Real lockDist ) { } - virtual Drawable *getCameraLockDrawable() const { return NULL; } + virtual Drawable *getCameraLockDrawable() const { return nullptr; } virtual void setCameraLockDrawable(Drawable *drawable) { } virtual void setMouseLock( Bool mouseLocked ) {} ///< lock/unlock the mouse input to the tactical view @@ -294,7 +294,7 @@ PlaceholderView bogusTacticalView; class SkeletonSceneClass : public RTS3DScene { public: - SkeletonSceneClass(void) : m_testPass(NULL) { } + SkeletonSceneClass(void) : m_testPass(nullptr) { } ~SkeletonSceneClass(void) { REF_PTR_RELEASE(m_testPass); } void Set_Material_Pass(MaterialPassClass * pass) { REF_PTR_SET(m_testPass, pass); } @@ -328,7 +328,7 @@ Bool SkeletonSceneClass::safeContains(RenderObjClass *obj) void SkeletonSceneClass::Remove_Render_Object(RenderObjClass * obj) { if (RenderList.Contains(obj)) { - RenderObjClass *refPtr = NULL; + RenderObjClass *refPtr = nullptr; REF_PTR_SET(refPtr, obj); // ref it, as when it gets removed from the scene, may get deleted otherwise. RTS3DScene::Remove_Render_Object(obj); REF_PTR_RELEASE(refPtr); @@ -347,10 +347,10 @@ void WbView3d::setObjTracking(MapObject *pMapObj, Coord3D pos, Real angle, Bool REF_PTR_RELEASE(m_objectToolTrackingObj); m_objectToolTrackingObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, 0); } - if (m_objectToolTrackingObj == NULL) { + if (m_objectToolTrackingObj == nullptr) { return; } - pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); Matrix3D renderObjPos(true); // init to identity renderObjPos.Translate(pos.x, pos.y, pos.z); renderObjPos.Rotate_Z(angle); @@ -366,15 +366,15 @@ IMPLEMENT_DYNCREATE(WbView3d, WbView) // ---------------------------------------------------------------------------- WbView3d::WbView3d() : - m_assetManager(NULL), - m_scene(NULL), - m_overlayScene(NULL), - m_transparentObjectsScene(NULL), - m_baseBuildScene(NULL), - m_objectToolTrackingObj(NULL), + m_assetManager(nullptr), + m_scene(nullptr), + m_overlayScene(nullptr), + m_transparentObjectsScene(nullptr), + m_baseBuildScene(nullptr), + m_objectToolTrackingObj(nullptr), m_showObjToolTrackingObj(false), - m_camera(NULL), - m_heightMapRenderObj(NULL), + m_camera(nullptr), + m_heightMapRenderObj(nullptr), m_mouseWheelOffset(0), m_actualWinSize(0, 0), m_cameraAngle(0.0), @@ -385,11 +385,11 @@ WbView3d::WbView3d() : m_time(0), m_updateCount(0), m_needToLoadRoads(0), - m_timer(NULL), - m_drawObject(NULL), - m_layer(NULL), - m_buildLayer(NULL), - m_intersector(NULL), + m_timer(0), + m_drawObject(nullptr), + m_layer(nullptr), + m_buildLayer(nullptr), + m_intersector(nullptr), m_showEntireMap(false), m_partialMapSize(129), m_showWireframe(false), @@ -410,7 +410,7 @@ WbView3d::WbView3d() : for (Int i=0; iGetProfileInt(MAIN_FRAME_SECTION, "ShowWireframe", 0) != 0); @@ -428,7 +428,7 @@ WbView3d::~WbView3d() { for (Int i=0; iRemove(); REF_PTR_RELEASE(m_lightFeedbackMesh[i]); } @@ -447,14 +447,14 @@ void WbView3d::shutdownWW3D(void) PredictiveLODOptimizerClass::Free(); /// @todo: where does this need to be done? m_assetManager->Free_Assets(); delete m_assetManager; - m_assetManager = NULL; + m_assetManager = nullptr; } if (TheW3DShadowManager) { TheW3DShadowManager->removeAllShadows(); delete TheW3DShadowManager; - TheW3DShadowManager=NULL; + TheW3DShadowManager=nullptr; } REF_PTR_RELEASE(m_transparentObjectsScene); REF_PTR_RELEASE(m_overlayScene); @@ -476,17 +476,17 @@ void WbView3d::shutdownWW3D(void) m_ww3dInited = false; delete m_intersector; - m_intersector = NULL; + m_intersector = nullptr; delete m_layer; - m_layer = NULL; + m_layer = nullptr; delete m_buildLayer; - m_buildLayer = NULL; + m_buildLayer = nullptr; if (m3DFont) { m3DFont->Release(); - m3DFont = NULL; + m3DFont = nullptr; } } @@ -503,7 +503,7 @@ void WbView3d::ReleaseResources(void) if (m3DFont) { m3DFont->Release(); } - m3DFont = NULL; + m3DFont = nullptr; } //============================================================================= @@ -515,7 +515,7 @@ void WbView3d::ReAcquireResources(void) { if (TheTerrainRenderObject) { TheTerrainRenderObject->ReAcquireResources(); - TheTerrainRenderObject->loadRoadsAndBridges(NULL,FALSE); + TheTerrainRenderObject->loadRoadsAndBridges(nullptr,FALSE); TheTerrainRenderObject->worldBuilderUpdateBridgeTowers( m_assetManager, m_scene ); } IDirect3DDevice8* pDev = DX8Wrapper::_Get_D3D_Device8(); @@ -543,11 +543,11 @@ void WbView3d::ReAcquireResources(void) D3DXCreateFont(pDev, hFont, &m3DFont); DeleteObject(hFont); } else { - m3DFont = NULL; + m3DFont = nullptr; } } else { - m3DFont = NULL; + m3DFont = nullptr; } } @@ -555,9 +555,9 @@ void WbView3d::ReAcquireResources(void) // ---------------------------------------------------------------------------- void WbView3d::killTheTimer(void) { - if (m_timer != NULL) { + if (m_timer != 0) { KillTimer(m_timer); - m_timer = NULL; + m_timer = 0; } } @@ -594,14 +594,14 @@ void WbView3d::initAssets() #define TERRAIN_SAMPLE_SIZE 40.0f static Real getHeightAroundPos(WBHeightMap *heightMap, Real x, Real y) { - Real terrainHeight = heightMap->getHeightMapHeight(x, y, NULL); + Real terrainHeight = heightMap->getHeightMapHeight(x, y, nullptr); // find best approximation of max terrain height we can see Real terrainHeightMax = terrainHeight; - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, NULL)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, nullptr)); return terrainHeightMax; } @@ -806,7 +806,7 @@ void WbView3d::resetRenderObjects() // Erase references to render objs that have been removed. while (pMapObj) { - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); pMapObj = pMapObj->getNext(); } @@ -815,7 +815,7 @@ void WbView3d::resetRenderObjects() SidesInfo *pSide = TheSidesList->getSideInfo(i); BuildListInfo *pBuild = pSide->getBuildList(); while (pBuild) { - pBuild->setRenderObj(NULL); + pBuild->setRenderObj(nullptr); pBuild = pBuild->getNext(); } } @@ -838,7 +838,7 @@ void WbView3d::stepTimeOfDay() TheWritableGlobalData->m_timeOfDay = TIME_OF_DAY_FIRST; } resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // ---------------------------------------------------------------------------- @@ -925,11 +925,11 @@ void WbView3d::updateLights() while (pMapObj && m_heightMapRenderObj) { if (pMapObj->isLight()) { Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); RenderObjClass *renderObj= pMapObj->getRenderObj(); if (renderObj) { m_scene->Remove_Render_Object(renderObj); - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); } // It is a light, and handled at the device level. jba. LightClass* lightP = NEW_REF(LightClass, (LightClass::POINT)); @@ -995,15 +995,15 @@ void WbView3d::updateFenceListObjects(MapObject *pObject) { Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); - RenderObjClass *renderObj=NULL; + RenderObjClass *renderObj=nullptr; REF_PTR_SET( renderObj, pMapObj->getRenderObj() ); if (!renderObj) { Real scale = 1.0; AsciiString modelName = getModelNameAndScale(pMapObj, &scale, BODY_PRISTINE); // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) != 0 ) { @@ -1041,7 +1041,7 @@ void WbView3d::removeFenceListObjects(MapObject *pObject) { if (pMapObj->getRenderObj()) { m_scene->Remove_Render_Object(pMapObj->getRenderObj()); - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); } } @@ -1059,7 +1059,7 @@ AsciiString WbView3d::getBestModelName(const ThingTemplate* tt, const ModelCondi { // const W3DModelDrawModuleData* md = dynamic_cast(mi->getNthData(0)); const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; if (md) { return md->getBestModelNameForWB(c); @@ -1105,13 +1105,13 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) } // Update. Coord3D loc = *pBuild->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); - RenderObjClass *renderObj=NULL; - Shadow *shadowObj=NULL; + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); + RenderObjClass *renderObj=nullptr; + Shadow *shadowObj=nullptr; // Build list render obj is not refcounted, so check & make sure it exists in the scene. if (pBuild->getRenderObj()) { if (!m_baseBuildScene->safeContains(pBuild->getRenderObj())) { - pBuild->setRenderObj(NULL); + pBuild->setRenderObj(nullptr); } } @@ -1129,7 +1129,7 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) scale = tTemplate->getAssetScale(); } // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) != 0 ) { @@ -1171,12 +1171,12 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) // Build list render obj is not refcounted, so check & make sure it exists in the scene. if (!found && pBuildToInval && pBuildToInval->getRenderObj()) { if (!m_baseBuildScene->safeContains(pBuildToInval->getRenderObj())) { - pBuildToInval->setRenderObj(NULL); + pBuildToInval->setRenderObj(nullptr); } } if (!found && pBuildToInval && pBuildToInval->getRenderObj()) { m_baseBuildScene->Remove_Render_Object(pBuildToInval->getRenderObj()); - pBuildToInval->setRenderObj(NULL); + pBuildToInval->setRenderObj(nullptr); } Invalidate(false); } @@ -1292,26 +1292,26 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body void WbView3d::invalObjectInView(MapObject *pMapObjIn) { ++m_updateCount; - if (m_heightMapRenderObj == NULL) { + if (m_heightMapRenderObj == nullptr) { m_heightMapRenderObj = NEW_REF(WBHeightMap,()); m_scene->Add_Render_Object(m_heightMapRenderObj); } - if (pMapObjIn == NULL) { - invalBuildListItemInView(NULL); + if (pMapObjIn == nullptr) { + invalBuildListItemInView(nullptr); } Bool found = false; Bool isRoad = false; Bool isLight = false; Bool isScorch = false; - if (pMapObjIn == NULL) + if (pMapObjIn == nullptr) isScorch = true; MapObject *pMapObj; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObjIn == pMapObj) found = true; - if (pMapObjIn != NULL && !found) { + if (pMapObjIn != nullptr && !found) { continue; } if (pMapObj->getFlags() & (FLAG_ROAD_FLAGS|FLAG_BRIDGE_FLAGS)) { @@ -1331,10 +1331,10 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); - RenderObjClass *renderObj=NULL; - Shadow *shadowObj=NULL; + RenderObjClass *renderObj=nullptr; + Shadow *shadowObj=nullptr; REF_PTR_SET( renderObj, pMapObj->getRenderObj() ); Int playerColor = 0xFFFFFF; @@ -1394,7 +1394,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) Real scale = 1.0; AsciiString modelName = getModelNameAndScale(pMapObj, &scale, curDamageState); // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) != 0 ) { @@ -1463,12 +1463,12 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) if (!found && pMapObjIn && pMapObjIn->getRenderObj()) { if( m_showShadows ) { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); --m_updateCount; return; } m_scene->Remove_Render_Object(pMapObjIn->getRenderObj()); - pMapObjIn->setRenderObj(NULL); + pMapObjIn->setRenderObj(nullptr); } if (isRoad) { @@ -1489,12 +1489,12 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) // ---------------------------------------------------------------------------- void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange) { - if (htMap == NULL) + if (htMap == nullptr) return; ++m_updateCount; - if (m_heightMapRenderObj == NULL) { + if (m_heightMapRenderObj == nullptr) { m_heightMapRenderObj = NEW_REF(WBHeightMap,()); m_scene->Add_Render_Object(m_heightMapRenderObj); partial = false; @@ -1525,7 +1525,7 @@ void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const if (curTicks < 1) curTicks = 1; } - invalObjectInView(NULL); // update all the map objects, to account for ground changes + invalObjectInView(nullptr); // update all the map objects, to account for ground changes --m_updateCount; } @@ -1571,7 +1571,7 @@ MapObject *WbView3d::picked3dObjectInView(CPoint viewPt) } } - return NULL; + return nullptr; } //============================================================================= @@ -1619,7 +1619,7 @@ BuildListInfo *WbView3d::pickedBuildObjectInView(CPoint viewPt) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1913,7 +1913,7 @@ Bool WbView3d::docToViewCoords(Coord3D curPt, CPoint* newPt) newPt->x = -1000; newPt->y = -1000; if (m_heightMapRenderObj) { - curPt.z += m_heightMapRenderObj->getHeightMapHeight(curPt.x, curPt.y, NULL); + curPt.z += m_heightMapRenderObj->getHeightMapHeight(curPt.x, curPt.y, nullptr); } world.Set( curPt.x, curPt.y, curPt.z ); @@ -1960,7 +1960,7 @@ void WbView3d::redraw(void) DEBUG_ASSERTCRASH((m_heightMapRenderObj),("oops")); if (m_heightMapRenderObj) { if (m_needToLoadRoads) { - m_heightMapRenderObj->loadRoadsAndBridges(NULL,FALSE); + m_heightMapRenderObj->loadRoadsAndBridges(nullptr,FALSE); m_heightMapRenderObj->worldBuilderUpdateBridgeTowers( m_assetManager, m_scene ); m_needToLoadRoads = false; } @@ -2052,7 +2052,7 @@ void WbView3d::render() WW3D::Render(m_overlayScene,m_camera); //if (mytext) mytext->Render(); if (m3DFont) { - drawLabels(NULL); + drawLabels(nullptr); } @@ -2205,11 +2205,11 @@ void WbView3d::initWW3D() D3DXCreateFont(pDev, hFont, &m3DFont); DeleteObject(hFont); } else { - m3DFont = NULL; + m3DFont = nullptr; } } else { - m3DFont = NULL; + m3DFont = nullptr; } WW3D::Enable_Static_Sort_Lists(true); @@ -2228,7 +2228,7 @@ void WbView3d::initWW3D() TheWritableGlobalData->m_useShadowVolumes = true; TheWritableGlobalData->m_useShadowDecals = true; TheWritableGlobalData->m_enableBehindBuildingMarkers = false; //this is only for the game. - if (TheW3DShadowManager==NULL) + if (TheW3DShadowManager==nullptr) { TheW3DShadowManager = new W3DShadowManager; TheW3DShadowManager->init(); } @@ -2251,7 +2251,7 @@ int WbView3d::OnCreate(LPCREATESTRUCT lpCreateStruct) WWDebug_Install_Message_Handler(WWDebug_Message_Callback); WWDebug_Install_Assert_Handler(WWAssert_Callback); - m_timer = SetTimer(0, UPDATE_TIME, NULL); + m_timer = SetTimer(0, UPDATE_TIME, nullptr); initWW3D(); TheWritableGlobalData->m_useCloudMap = AfxGetApp()->GetProfileInt("GameOptions", "cloudMap", 0); @@ -2316,7 +2316,7 @@ void WbView3d::drawLabels(HDC hdc) if (m_doLightFeedback && pMapObj->isSelected()) { //find out position of selected object in order to use it for light feedback tracking. selectedPos=*pMapObj->getLocation(); - selectedPos.z = m_heightMapRenderObj->getHeightMapHeight(selectedPos.x, selectedPos.y, NULL); + selectedPos.z = m_heightMapRenderObj->getHeightMapHeight(selectedPos.x, selectedPos.y, nullptr); RenderObjClass *selRobj=pMapObj->getRenderObj(); if (selRobj) { @@ -2330,12 +2330,12 @@ void WbView3d::drawLabels(HDC hdc) if (pMapObj->isWaypoint() && m_showWaypoints) { name = pMapObj->getWaypointName(); pos = *pMapObj->getLocation(); - pos.z = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } else if (pMapObj->getThingTemplate() && !(pMapObj->getFlags() & (FLAG_ROAD_FLAGS|FLAG_BRIDGE_FLAGS)) && - pMapObj->getRenderObj() == NULL) { + pMapObj->getRenderObj() == nullptr) { name = pMapObj->getThingTemplate()->getName(); pos = *pMapObj->getLocation(); - pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } Int i; for (i=0; i<4; i++) { @@ -2431,12 +2431,12 @@ void WbView3d::drawLabels(HDC hdc) selectedPos.y - m_lightDirection[lIndex].y*selectedRadius, selectedPos.z - m_lightDirection[lIndex].z*selectedRadius); - if (m_lightFeedbackMesh[lIndex] == NULL) + if (m_lightFeedbackMesh[lIndex] == nullptr) { char nameBuf[64]; snprintf(nameBuf, ARRAY_SIZE(nameBuf), "WB_LIGHT%d", lIndex+1); m_lightFeedbackMesh[lIndex]=WW3DAssetManager::Get_Instance()->Create_Render_Obj(nameBuf); } - if (m_lightFeedbackMesh[lIndex]==NULL) { + if (m_lightFeedbackMesh[lIndex]==nullptr) { break; } Matrix3D lightMat; @@ -2488,7 +2488,7 @@ void WbView3d::drawLabels(HDC hdc) for (Int lIndex=0; lIndexRemove(); REF_PTR_RELEASE(m_lightFeedbackMesh[lIndex]); } @@ -2561,7 +2561,7 @@ void WbView3d::setDefaultCamera() } if (m_heightMapRenderObj) { - m_groundLevel = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + m_groundLevel = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } //m_cameraOffset.z = m_groundLevel+TheGlobalData->m_cameraHeight; @@ -2695,7 +2695,7 @@ void WbView3d::OnViewShowtopdownview() { m_projection = !m_projection; m_heightMapRenderObj->setFlattenHeights(m_projection); - invalObjectInView(NULL); + invalObjectInView(nullptr); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowTopDownView", m_projection?1:0); } @@ -2789,7 +2789,7 @@ void WbView3d::OnViewShowshadows() m_showShadows = false; } else { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } } else { TheW3DShadowManager->removeAllShadows(); @@ -2840,7 +2840,7 @@ void WbView3d::OnEditMapSettings() if (dlg.DoModal() == IDOK) { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } } @@ -2858,7 +2858,7 @@ void WbView3d::OnViewShowModels() setShowModels(!getShowModels()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowModels", getShowModels()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewShowModels(CCmdUI* pCmdUI) { @@ -2870,7 +2870,7 @@ void WbView3d::OnViewGarrisoned() setShowGarrisoned(!getShowGarrisoned()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowGarrisoned", getShowGarrisoned()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewGarrisoned(CCmdUI* pCmdUI) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h index 84b2ec0b70e..c2d731229c9 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h @@ -266,7 +266,7 @@ class BitFlags static const char* getNameFromSingleBit(Int i) { - return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : NULL; + return (i >= 0 && i < NUMBITS) ? s_bitNameList[i] : nullptr; } static Int getSingleBitFromName(const char* token) @@ -284,7 +284,7 @@ class BitFlags const char* getBitNameIfSet(Int i) const { - return test(i) ? s_bitNameList[i] : NULL; + return test(i) ? s_bitNameList[i] : nullptr; } Bool setBitByName(const char* token) @@ -309,14 +309,14 @@ class BitFlags void buildDescription( AsciiString* str ) const { - if ( str == NULL ) + if ( str == nullptr ) return;//sanity for( Int i = 0; i < size(); ++i ) { const char* bitName = getBitNameIfSet(i); - if (bitName != NULL) + if (bitName != nullptr) { str->concat( bitName ); str->concat( ",\n"); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h index f5796520286..6e8e8959926 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h @@ -39,14 +39,14 @@ template void BitFlags::buildDescription( AsciiString* str ) const { - if ( str == NULL ) + if ( str == nullptr ) return;//sanity for( Int i = 0; i < size(); ++i ) { const char* bitName = getBitNameIfSet(i); - if (bitName != NULL) + if (bitName != nullptr) { str->concat( bitName ); str->concat( ",\n"); @@ -67,7 +67,7 @@ void BitFlags::parse(INI* ini, AsciiString* str) Bool foundAddOrSub = false; // loop through all tokens - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (str) { @@ -132,7 +132,7 @@ void BitFlags::parse(INI* ini, AsciiString* str) template /*static*/ void BitFlags::parseFromINI(INI* ini, void* /*instance*/, void *store, const void* /*userData*/) { - ((BitFlags*)store)->parse(ini, NULL); + ((BitFlags*)store)->parse(ini, nullptr); } //------------------------------------------------------------------------------------------------- @@ -172,7 +172,7 @@ void BitFlags::xfer(Xfer* xfer) const char* bitName = getBitNameIfSet(i); // ignore if this kindof is not set in our mask data - if (bitName == NULL) + if (bitName == nullptr) continue; // this bit is set, write the string value diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h index b27261582a5..9188ffb9ee1 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h @@ -94,7 +94,7 @@ class ScopedCriticalSection #include "mutex.h" -// These should be NULL on creation then non-NULL in WinMain or equivalent. +// These should be null on creation then non-null in WinMain or equivalent. // This allows us to be silently non-threadsafe for WB and other single-threaded apps. extern CriticalSection *TheAsciiStringCriticalSection; extern CriticalSection *TheUnicodeStringCriticalSection; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h b/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h index af9bfadd783..bd16a53fa38 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DamageFX.h @@ -116,8 +116,8 @@ class DamageFX void clear() { m_amountForMajorFX = 0.0f; - m_majorDamageFXList = NULL; - m_minorDamageFXList = NULL; + m_majorDamageFXList = nullptr; + m_minorDamageFXList = nullptr; m_damageFXThrottleTime = 0; } }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DataChunk.h b/GeneralsMD/Code/GameEngine/Include/Common/DataChunk.h index 438580c5b34..cc7f074275d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DataChunk.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DataChunk.h @@ -187,8 +187,8 @@ class DataChunkInput // to create an object, and a subsequent chunk to // parse values into that object. However, the second // chunk parser could also create and parse an object - // of its own if this pointer is NULL. - // The parser of the base class should NULL this pointer. + // of its own if this pointer is null. + // The parser of the base class should set this pointer to null. void *m_userData; // user data hook public: @@ -196,10 +196,10 @@ class DataChunkInput ~DataChunkInput(); // register a parser function for data chunks with labels matching "label", whose parent - // chunks labels match "parentLabel" (or NULL for global scope) - void registerParser( const AsciiString& label, const AsciiString& parentLabel, DataChunkParserPtr parser, void *userData = NULL ); + // chunks labels match "parentLabel" (or null for global scope) + void registerParser( const AsciiString& label, const AsciiString& parentLabel, DataChunkParserPtr parser, void *userData = nullptr ); - Bool parse( void *userData = NULL ); // parse the chunk stream using registered parsers + Bool parse( void *userData = nullptr ); // parse the chunk stream using registered parsers // assumed to be at the start of chunk when called // can be called recursively diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Dict.h b/GeneralsMD/Code/GameEngine/Include/Common/Dict.h index 295ffd2fae9..bdd741ffe3b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Dict.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Dict.h @@ -141,31 +141,31 @@ class Dict if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Bool getBool(NameKeyType key, Bool* exists = NULL) const; + Bool getBool(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Int getInt(NameKeyType key, Bool* exists = NULL) const; + Int getInt(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, 0 is returned. */ - Real getReal(NameKeyType key, Bool* exists = NULL) const; + Real getReal(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, "" is returned. */ - AsciiString getAsciiString(NameKeyType key, Bool* exists = NULL) const; + AsciiString getAsciiString(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given key. if there is no pair with the given key, or the value is not of the correct type, "" is returned. */ - UnicodeString getUnicodeString(NameKeyType key, Bool* exists = NULL) const; + UnicodeString getUnicodeString(NameKeyType key, Bool* exists = nullptr) const; /** return the value for the pair with the given index. diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h b/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h index 2f9cfd15724..0214bf86aeb 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h @@ -93,20 +93,20 @@ class DrawModule : public DrawableModule virtual Bool isLaser() const { return false; } // interface acquisition - virtual ObjectDrawInterface* getObjectDrawInterface() { return NULL; } - virtual const ObjectDrawInterface* getObjectDrawInterface() const { return NULL; } + virtual ObjectDrawInterface* getObjectDrawInterface() { return nullptr; } + virtual const ObjectDrawInterface* getObjectDrawInterface() const { return nullptr; } - virtual DebrisDrawInterface* getDebrisDrawInterface() { return NULL; } - virtual const DebrisDrawInterface* getDebrisDrawInterface() const { return NULL; } + virtual DebrisDrawInterface* getDebrisDrawInterface() { return nullptr; } + virtual const DebrisDrawInterface* getDebrisDrawInterface() const { return nullptr; } - virtual TracerDrawInterface* getTracerDrawInterface() { return NULL; } - virtual const TracerDrawInterface* getTracerDrawInterface() const { return NULL; } + virtual TracerDrawInterface* getTracerDrawInterface() { return nullptr; } + virtual const TracerDrawInterface* getTracerDrawInterface() const { return nullptr; } - virtual RopeDrawInterface* getRopeDrawInterface() { return NULL; } - virtual const RopeDrawInterface* getRopeDrawInterface() const { return NULL; } + virtual RopeDrawInterface* getRopeDrawInterface() { return nullptr; } + virtual const RopeDrawInterface* getRopeDrawInterface() const { return nullptr; } - virtual LaserDrawInterface* getLaserDrawInterface() { return NULL; } - virtual const LaserDrawInterface* getLaserDrawInterface() const { return NULL; } + virtual LaserDrawInterface* getLaserDrawInterface() { return nullptr; } + virtual const LaserDrawInterface* getLaserDrawInterface() const { return nullptr; } }; inline DrawModule::DrawModule( Thing *thing, const ModuleData* moduleData ) : DrawableModule( thing, moduleData ) { } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h index 5cf1b10b629..1e7c224fd5a 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h @@ -338,7 +338,7 @@ public: \ o->dlink_removeFrom_##LISTNAME(&m_dlinkhead_##LISTNAME.m_head); \ } \ typedef void (*RemoveAllProc_##LISTNAME)(OBJCLASS* o); \ - inline void removeAll_##LISTNAME(RemoveAllProc_##LISTNAME p = NULL) \ + inline void removeAll_##LISTNAME(RemoveAllProc_##LISTNAME p = nullptr) \ { \ while (m_dlinkhead_##LISTNAME.m_head) \ { \ @@ -351,7 +351,7 @@ public: \ inline void reverse_##LISTNAME() \ { \ OBJCLASS* cur = m_dlinkhead_##LISTNAME.m_head; \ - OBJCLASS* prev = NULL; \ + OBJCLASS* prev = nullptr; \ while (cur) \ { \ OBJCLASS* originalNext = cur->dlink_next_##LISTNAME(); \ @@ -455,7 +455,7 @@ class DLINK_ITERATOR Bool done() const { - return m_cur == NULL; + return m_cur == nullptr; } OBJCLASS* cur() const diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h index fa4fccad236..9b2a12458d3 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Geometry.h @@ -59,7 +59,7 @@ static const char *const GeometryNames[] = "SPHERE", "CYLINDER", "BOX", - NULL + nullptr }; static_assert(ARRAY_SIZE(GeometryNames) == GEOMETRY_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_GEOMETRY_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h index 613cae14065..86437a1b461 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h @@ -327,14 +327,14 @@ class INI this will *never* return null; if there are no more tokens, an exception will be thrown. */ - const char* getNextToken(const char* seps = NULL); + const char* getNextToken(const char* seps = nullptr); /** just like getNextToken(), except that null is returned if no more tokens are present (rather than throwing an exception). usually you should call getNextToken(), but for some cases this is handier (ie, parsing a variable-length number of tokens). */ - const char* getNextTokenOrNull(const char* seps = NULL); + const char* getNextTokenOrNull(const char* seps = nullptr); /** This is called when the next thing you expect is something like: diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INIException.h b/GeneralsMD/Code/GameEngine/Include/Common/INIException.h index d73af7cd0f6..cf5d9e54842 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INIException.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INIException.h @@ -35,7 +35,7 @@ class INIException public: char *mFailureMessage; - INIException(const char* errorMessage) : mFailureMessage(NULL) + INIException(const char* errorMessage) : mFailureMessage(nullptr) { if (errorMessage) { mFailureMessage = new char[strlen(errorMessage) + 1]; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Module.h b/GeneralsMD/Code/GameEngine/Include/Common/Module.h index e6ea3dd33ce..2dd9f863f28 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Module.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Module.h @@ -109,9 +109,9 @@ class ModuleData : public Snapshot virtual Bool isAiModuleData() const { return false; } // ugh, hack - virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return NULL; } + virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return nullptr; } // ugh, hack - virtual const W3DTreeDrawModuleData* getAsW3DTreeDrawModuleData() const { return NULL; } + virtual const W3DTreeDrawModuleData* getAsW3DTreeDrawModuleData() const { return nullptr; } virtual StaticGameLODLevel getMinimumRequiredGameLOD() const { return (StaticGameLODLevel)0;} static void buildFieldParse(MultiIniFieldParse& p) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h b/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h index a7af21cd32c..074b1042993 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModuleFactory.h @@ -91,7 +91,7 @@ class ModuleFactory : public SubsystemInterface, public Snapshot class ModuleTemplate { public: - ModuleTemplate() : m_createProc(NULL), m_createDataProc(NULL), m_whichInterfaces(0) + ModuleTemplate() : m_createProc(nullptr), m_createDataProc(nullptr), m_whichInterfaces(0) { } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h index ffa939baf77..c948ff09c1b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h @@ -66,7 +66,7 @@ class Bucket : public MemoryPoolObject AsciiString m_nameString; }; -inline Bucket::Bucket() : m_nextInSocket(NULL), m_key(NAMEKEY_INVALID) { } +inline Bucket::Bucket() : m_nextInSocket(nullptr), m_key(NAMEKEY_INVALID) { } inline Bucket::~Bucket() { } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h b/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h index 03ae479dd00..2f3f8727b3e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Overridable.h @@ -47,9 +47,9 @@ class Overridable : public MemoryPoolObject Bool m_isOverride; public: - Overridable() : m_nextOverride(NULL), m_isOverride(false) {} + Overridable() : m_nextOverride(nullptr), m_isOverride(false) {} - // return a constant version of m_nextOverride, which can be NULL if there is no + // return a constant version of m_nextOverride, which can be null if there is no // override const Overridable *getNextOverride( void ) const { @@ -99,14 +99,14 @@ class Overridable : public MemoryPoolObject m_isOverride = true; } - // used in factory reset() calls at the end of a game to clean up overrides. Can return NULL + // used in factory reset() calls at the end of a game to clean up overrides. Can return nullptr // if the first Overridable is itself an override Overridable *deleteOverrides( void ) { if ( m_isOverride ) { deleteInstance(this); - return NULL; + return nullptr; } else if ( m_nextOverride ) { diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Override.h b/GeneralsMD/Code/GameEngine/Include/Common/Override.h index 45cd955858d..aa41b18cc21 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Override.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Override.h @@ -50,7 +50,7 @@ template class OVERRIDE { public: // Provide useful constructores to go from a T* to an OVERRIDE - OVERRIDE(const T *overridable = NULL); + OVERRIDE(const T *overridable = nullptr); // Copy constructor OVERRIDE(OVERRIDE &overridable); // Operator= for copying from another OVERRIDE and T* @@ -107,7 +107,7 @@ template const T *OVERRIDE::operator->() const { if (!m_overridable) - return NULL; + return nullptr; return (T*) m_overridable->getFinalOverride(); } @@ -116,7 +116,7 @@ template const T *OVERRIDE::operator*() const { if (!m_overridable) - return NULL; + return nullptr; return (T*) m_overridable->getFinalOverride(); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/PerfTimer.h b/GeneralsMD/Code/GameEngine/Include/Common/PerfTimer.h index b2a4c60d051..c072e01f2c7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/PerfTimer.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/PerfTimer.h @@ -140,7 +140,7 @@ void PerfGather::startTimer() //------------------------------------------------------------------------------------------------- void PerfGather::stopTimer() { - DEBUG_ASSERTCRASH(this != NULL, ("I am null, uh oh")); + DEBUG_ASSERTCRASH(this != nullptr, ("I am null, uh oh")); Int64 runTime; GetPrecisionTimer(&runTime); @@ -153,7 +153,7 @@ void PerfGather::stopTimer() ++m_callCount; #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(*m_activeHead != NULL, ("m_activeHead is null, uh oh")); + DEBUG_ASSERTCRASH(*m_activeHead != nullptr, ("m_activeHead is null, uh oh")); DEBUG_ASSERTCRASH(*m_activeHead == this, ("I am not the active timer, uh oh")); DEBUG_ASSERTCRASH(m_activeHead >= &m_active[0] && m_activeHead <= &m_active[MAX_ACTIVE_STACK-1], ("active under/over flow")); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h index ad150eb5dfb..a1a784be06c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h @@ -103,7 +103,7 @@ static const char *const ScienceAvailabilityNames[] = "Available", "Disabled", "Hidden", - NULL + nullptr }; static_assert(ARRAY_SIZE(ScienceAvailabilityNames) == SCIENCE_AVAILABILITY_COUNT + 1, "Incorrect array size"); #endif // end DEFINE_SCIENCE_AVAILABILITY_NAMES @@ -443,7 +443,7 @@ class Player : public Snapshot virtual Bool computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D *pos, Int playerNdx, Real weaponRadius); ///< Calculates best pos for weapon given radius. - /// Get the enemy an ai player is currently focused on. NOTE - Can be NULL. + /// Get the enemy an ai player is currently focused on. NOTE - Can be nullptr. Player *getCurrentEnemy( void ); /// Is this player a skirmish ai player? @@ -531,8 +531,8 @@ class Player : public Snapshot /** return this player's "default" team. */ - Team *getDefaultTeam() { DEBUG_ASSERTCRASH(m_defaultTeam!=NULL,("default team is null")); return m_defaultTeam; } - const Team *getDefaultTeam() const { DEBUG_ASSERTCRASH(m_defaultTeam!=NULL,("default team is null")); return m_defaultTeam; } + Team *getDefaultTeam() { DEBUG_ASSERTCRASH(m_defaultTeam!=nullptr,("default team is null")); return m_defaultTeam; } + const Team *getDefaultTeam() const { DEBUG_ASSERTCRASH(m_defaultTeam!=nullptr,("default team is null")); return m_defaultTeam; } void setBuildList(BuildListInfo *pBuildList); ///< sets the build list. BuildListInfo *getBuildList( void ) { return m_pBuildList; } ///< returns the build list. (build list might be modified by the solo AI) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h b/GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h index 7fe0641a246..90bec473a80 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h @@ -106,7 +106,7 @@ class PlayerList : public SubsystemInterface, all other players (this is so that everything can be associated with a nonnull Player, to simplify the universe). This will never return null. */ - Player *getNeutralPlayer() { DEBUG_ASSERTCRASH(m_players[0] != NULL, ("null neutral")); return m_players[0]; } + Player *getNeutralPlayer() { DEBUG_ASSERTCRASH(m_players[0] != nullptr, ("null neutral")); return m_players[0]; } /** return the Player with the given internal name, or null if none found. @@ -117,7 +117,7 @@ class PlayerList : public SubsystemInterface, Return the "local" player (ie, the human playing the game). This will never return null. */ - inline Player *getLocalPlayer() { DEBUG_ASSERTCRASH(m_local != NULL, ("null m_local")); return m_local; } + inline Player *getLocalPlayer() { DEBUG_ASSERTCRASH(m_local != nullptr, ("null m_local")); return m_local; } /** Set the local player. You cannot set it to null; if you pass null, you'll diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h index 829c0cb4deb..13d86605478 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SparseMatchFinder.h @@ -125,7 +125,7 @@ class SparseMatchFinder //------------------------------------------------------------------------------------------------- const MATCHABLE* findBestInfoSlow(const std::vector& v, const BITSET& bits) const { - const MATCHABLE* result = NULL; + const MATCHABLE* result = nullptr; Int bestYesMatch = 0; // want to maximize this Int bestYesExtraneousBits = 999; // want to minimize this @@ -222,19 +222,19 @@ class SparseMatchFinder { typename MatchMap::const_iterator it = m_bestMatches.find(bits); - const MATCHABLE *first = NULL; + const MATCHABLE *first = nullptr; if (it != m_bestMatches.end()) { first = (*it).second; } - if (first != NULL) { + if (first != nullptr) { return first; } const MATCHABLE* info = findBestInfoSlow(v, bits); - DEBUG_ASSERTCRASH(info != NULL, ("no suitable match for criteria was found!")); - if (info != NULL) { + DEBUG_ASSERTCRASH(info != nullptr, ("no suitable match for criteria was found!")); + if (info != nullptr) { m_bestMatches[bits] = info; } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h index 5c2990fe3ab..6312d3467ee 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h @@ -30,11 +30,11 @@ #if defined(RTS_DEBUG) || defined(IG_DEBUG_STACKTRACE) // Writes a stackdump (provide a callback : gets called per line) -// If callback is NULL then will write using OuputDebugString +// If callback is nullptr then will write using OuputDebugString void StackDump(void (*callback)(const char*)); // Writes a stackdump (provide a callback : gets called per line) -// If callback is NULL then will write using OuputDebugString +// If callback is nullptr then will write using OuputDebugString void StackDumpFromContext(DWORD eip,DWORD esp,DWORD ebp, void (*callback)(const char*)); // Gets count* addresses from the current stack diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h b/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h index c23f8023628..719d5cb846e 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StateMachine.h @@ -171,7 +171,7 @@ class State : public MemoryPoolObject, public Snapshot void friend_setID( StateID id ) { m_ID = id; } ///< define this state's id (for use only by StateMachine class) void friend_onSuccess( StateID toStateID ) { m_successStateID = toStateID; } ///< define which state to move to after successful completion void friend_onFailure( StateID toStateID ) { m_failureStateID = toStateID; } ///< define which state to move to after failure - void friend_onCondition( StateTransFuncPtr test, StateID toStateID, void* userData, const char* description = NULL ); ///< define when to change state + void friend_onCondition( StateTransFuncPtr test, StateID toStateID, void* userData, const char* description = nullptr ); ///< define when to change state StateReturnType friend_checkForTransitions( StateReturnType status ); ///< given a return code, handle state transitions StateReturnType friend_checkForSleepTransitions( StateReturnType status ); ///< given a return code, handle state transitions @@ -290,7 +290,7 @@ class StateMachine : public MemoryPoolObject, public Snapshot { m_locked = false; #ifdef STATE_MACHINE_DEBUG - m_lockedby = NULL; + m_lockedby = nullptr; #endif } @@ -351,7 +351,7 @@ class StateMachine : public MemoryPoolObject, public Snapshot void defineState( StateID id, State *state, StateID successID, StateID failureID, - const StateConditionInfo* conditions = NULL); + const StateConditionInfo* conditions = nullptr); State* internalGetState( StateID id ); @@ -480,6 +480,6 @@ EMPTY_DTOR(SleepState) // @todo Replace calls to deleteInstance with RefCountPtr when so appropriate. inline void deleteInstance(StateMachine* machine) { - if (machine != NULL) + if (machine != nullptr) machine->Release_Ref(); } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index e7c5725ba1e..d0b6175a70c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -52,7 +52,7 @@ class SubsystemInterface /** - Constructors should initialize any data to a valid state. That DOES NOT mean * the data has default values (something done in the init() method), only that * nothing is left pointing to garbage, un-initialized memory. In most cases - * this probably means just setting members to zero or NULL. + * this probably means just setting members to zero or nullptr. */ SubsystemInterface(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Team.h b/GeneralsMD/Code/GameEngine/Include/Common/Team.h index b5ac00ce11f..cc332e97e41 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Team.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Team.h @@ -259,7 +259,7 @@ class Team : public MemoryPoolObject, Player *getControllingPlayer() const; /** - set the team's owner. (NULL is not allowed) + set the team's owner. (nullptr is not allowed) */ void setControllingPlayer(Player *newController); @@ -540,7 +540,7 @@ class TeamPrototype : public MemoryPoolObject, Team *findTeamByID( TeamID teamID ); /** - set the team's owner. (NULL is not allowed) + set the team's owner. (nullptr is not allowed) */ void setControllingPlayer(Player *newController); @@ -696,10 +696,10 @@ class TeamFactory : public SubsystemInterface, /// return the TeamPrototype with the given name. if none exists, return null. TeamPrototype *findTeamPrototype(const AsciiString& name); - /// return TeamPrototype with matching ID. if none exists NULL is returned + /// return TeamPrototype with matching ID. if none exists nullptr is returned TeamPrototype *findTeamPrototypeByID( TeamPrototypeID id ); - /// search all prototypes for the team with the matching id, if none found NULL is returned + /// search all prototypes for the team with the matching id, if none found nullptr is returned Team *findTeamByID( TeamID teamID ); // note that there is no way to directly destroy a specific TeamPrototype (or a Team); the only diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h index 2c9ea65d222..de3984df9ae 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h @@ -137,7 +137,7 @@ static const char *const terrainTypeNames[] = "ROCK_ACCENT", "URBAN", - NULL + nullptr }; static_assert(ARRAY_SIZE(terrainTypeNames) == TERRAIN_NUM_CLASSES + 1, "Incorrect array size"); #endif // end DEFINE_TERRAIN_TYPE_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h index 982a401ae69..134276ae68f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Thing.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Thing.h @@ -84,10 +84,10 @@ class Thing : public MemoryPoolObject { // note, it is explicitly OK to pass null for 'thing' here; // they will check for null and return null in these cases. - friend Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : NULL; } - friend Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; } - friend const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : NULL; } - friend const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : NULL; } + friend Object *AsObject(Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; } + friend Drawable *AsDrawable(Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; } + friend const Object *AsObject(const Thing *thing) { return thing ? thing->asObjectMeth() : nullptr; } + friend const Drawable *AsDrawable(const Thing *thing) { return thing ? thing->asDrawableMeth() : nullptr; } MEMORY_POOL_GLUE_ABC(Thing) @@ -148,10 +148,10 @@ class Thing : public MemoryPoolObject // Virtual method since objects can be on bridges and need to calculate heigh above terrain differently. virtual Real calculateHeightAboveTerrain(void) const; // Calculates the actual height above terrain. Doesn't use cache. - virtual Object *asObjectMeth() { return NULL; } - virtual Drawable *asDrawableMeth() { return NULL; } - virtual const Object *asObjectMeth() const { return NULL; } - virtual const Drawable *asDrawableMeth() const { return NULL; } + virtual Object *asObjectMeth() { return nullptr; } + virtual Drawable *asDrawableMeth() { return nullptr; } + virtual const Object *asObjectMeth() const { return nullptr; } + virtual const Drawable *asDrawableMeth() const { return nullptr; } virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle) = 0; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h index 621f798a871..dcd47453391 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h @@ -71,7 +71,7 @@ static const char *const EditorSortingNames[] = "ROAD", "WAYPOINT", - NULL + nullptr }; static_assert(ARRAY_SIZE(EditorSortingNames) == ES_NUM_SORTING_TYPES + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index 77220fbfb84..3fb07704652 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -145,7 +145,7 @@ class AudioArray AudioArray() { for (Int i = 0; i < TTAUDIO_COUNT; ++i) - m_audio[i] = NULL; + m_audio[i] = nullptr; } ~AudioArray() @@ -161,7 +161,7 @@ class AudioArray if (that.m_audio[i]) m_audio[i] = newInstance(DynamicAudioEventRTS)(*that.m_audio[i]); else - m_audio[i] = NULL; + m_audio[i] = nullptr; } } @@ -180,7 +180,7 @@ class AudioArray } else { - m_audio[i] = NULL; + m_audio[i] = nullptr; } } } @@ -206,7 +206,7 @@ static const char *const BuildCompletionNames[] = "APPEARS_AT_RALLY_POINT", "PLACED_BY_PLAYER", - NULL + nullptr }; static_assert(ARRAY_SIZE(BuildCompletionNames) == BC_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILD_COMPLETION_NAMES @@ -229,7 +229,7 @@ static const char *const BuildableStatusNames[] = "Ignore_Prerequisites", "No", "Only_By_AI", - NULL + nullptr }; static_assert(ARRAY_SIZE(BuildableStatusNames) == BSTATUS_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_BUILDABLE_STATUS_NAMES @@ -288,7 +288,7 @@ class ModuleInfo Bool containsPartialName(const char* n) const { for (size_t i = 0; i < m_info.size(); i++) - if (strstr(m_info[i].first.str(), n) != NULL) + if (strstr(m_info[i].first.str(), n) != nullptr) return true; return false; } @@ -318,7 +318,7 @@ class ModuleInfo { return m_info[i].second; } - return NULL; + return nullptr; } // for use only by ThingTemplate::friend_getAIModuleInfo @@ -603,7 +603,7 @@ class ThingTemplate : public Overridable void setCopiedFromDefault(); - void setReskinnedFrom(const ThingTemplate* tt) { DEBUG_ASSERTCRASH(m_reskinnedFrom == NULL, ("should be null")); m_reskinnedFrom = tt; } + void setReskinnedFrom(const ThingTemplate* tt) { DEBUG_ASSERTCRASH(m_reskinnedFrom == nullptr, ("should be null")); m_reskinnedFrom = tt; } Bool isPrerequisite() const { return m_isPrerequisite; } @@ -634,7 +634,7 @@ class ThingTemplate : public Overridable const PerUnitSoundMap* getAllPerUnitSounds( void ) const { return &m_perUnitSounds; } void validateAudio(); const AudioEventRTS* getAudio(ThingTemplateAudioType t) const { return m_audioarray.m_audio[t] ? &m_audioarray.m_audio[t]->m_event : &s_audioEventNoSound; } - Bool hasAudio(ThingTemplateAudioType t) const { return m_audioarray.m_audio[t] != NULL; } + Bool hasAudio(ThingTemplateAudioType t) const { return m_audioarray.m_audio[t] != nullptr; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** Table for parsing the object fields */ @@ -715,7 +715,7 @@ class ThingTemplate : public Overridable // ---- Pointer-sized things ThingTemplate* m_nextThingTemplate; - const ThingTemplate* m_reskinnedFrom; ///< non NULL if we were generated via a reskin + const ThingTemplate* m_reskinnedFrom; ///< non nullptr if we were generated via a reskin const Image * m_selectedPortraitImage; /// portrait image when selected (to display in GUI) const Image * m_buttonImage; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h index eed24494d81..b0f4a2cb3ec 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h @@ -62,7 +62,7 @@ static const char *const Anim2DModeNames[] = "LOOP_BACKWARDS", "PING_PONG", "PING_PONG_BACKWARDS", - NULL + nullptr }; static_assert(ARRAY_SIZE(Anim2DModeNames) == ANIM_2D_NUM_MODES + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h index fb8456685e4..73be82f6868 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h @@ -76,8 +76,8 @@ class GeneralPersona public: GeneralPersona( void ) : - m_imageBioPortraitSmall(NULL), - m_imageBioPortraitLarge(NULL) + m_imageBioPortraitSmall(nullptr), + m_imageBioPortraitLarge(nullptr) { } // ~GeneralPersona( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h index 2017aba7acb..dcd5a2d18d1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h @@ -117,8 +117,8 @@ class PickAndPlayInfo Bool m_air; //Are we attacking an airborned target? Drawable *m_drawTarget; //Do we have an override draw target? - WeaponSlotType *m_weaponSlot; //Are we forcing a specific weapon slot? NULL if unspecified. + WeaponSlotType *m_weaponSlot; //Are we forcing a specific weapon slot? nullptr if unspecified. SpecialPowerType m_specialPowerType; //Which special power are use using? SPECIAL_INVALID if unspecified. }; -extern void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type msgType, PickAndPlayInfo *info = NULL ); +extern void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type msgType, PickAndPlayInfo *info = nullptr ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index 1d37eb6ee39..b4a0dbbddb9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -133,7 +133,7 @@ static const char *const TheCommandOptionNames[] = "CAN_USE_WAYPOINTS", "MUST_BE_STOPPED", - NULL + nullptr }; #endif // end DEFINE_COMMAND_OPTION_NAMES @@ -261,7 +261,7 @@ static const char *const TheGuiCommandNames[] = "SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT", "SELECT_ALL_UNITS_OF_TYPE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheGuiCommandNames) == GUI_COMMAND_NUM_COMMANDS + 1, "Incorrect array size"); #endif // end DEFINE_GUI_COMMAND_NAMES @@ -285,7 +285,7 @@ static const LookupListRec CommandButtonMappedBorderTypeNames[] = { "ACTION", COMMAND_BUTTON_BORDER_ACTION }, { "SYSTEM", COMMAND_BUTTON_BORDER_SYSTEM }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(CommandButtonMappedBorderTypeNames) == COMMAND_BUTTON_BORDER_COUNT + 1, "Incorrect array size"); //------------------------------------------------------------------------------------------------- @@ -314,7 +314,7 @@ class CommandButton : public Overridable Bool isValidObjectTarget(const Object* sourceObj, const Object* targetObj) const; Bool isValidObjectTarget(const Drawable* source, const Drawable* target) const; - // Note: It is perfectly valid for either (or both!) of targetObj and targetLocation to be NULL. + // Note: It is perfectly valid for either (or both!) of targetObj and targetLocation to be nullptr. // This is a convenience function to make several calls to other functions. Bool isValidToUseOn(const Object *sourceObj, const Object *targetObj, const Coord3D *targetLocation, CommandSourceType commandSource) const; Bool isReady(const Object *sourceObj) const; @@ -448,29 +448,29 @@ class SideSelectWindowData public: SideSelectWindowData(void) { - generalSpeak = NULL; + generalSpeak = nullptr; m_currColor = 0; - m_gereralsNameWin = NULL; + m_gereralsNameWin = nullptr; m_lastTime = 0; - m_pTemplate = NULL; - m_sideNameWin = NULL; + m_pTemplate = nullptr; + m_sideNameWin = nullptr; m_startTime = 0; m_state = 0; - m_upgradeImage1 = NULL; - m_upgradeImage1Win = NULL; - m_upgradeImage2 = NULL; - m_upgradeImage2Win = NULL; - m_upgradeImage3 = NULL; - m_upgradeImage3Win = NULL; - m_upgradeImage4 = NULL; - m_upgradeImage4Win = NULL; + m_upgradeImage1 = nullptr; + m_upgradeImage1Win = nullptr; + m_upgradeImage2 = nullptr; + m_upgradeImage2Win = nullptr; + m_upgradeImage3 = nullptr; + m_upgradeImage3Win = nullptr; + m_upgradeImage4 = nullptr; + m_upgradeImage4Win = nullptr; m_upgradeImageSize.x = m_upgradeImageSize.y = 0; - m_upgradeLabel1Win = NULL; - m_upgradeLabel2Win = NULL; - m_upgradeLabel3Win = NULL; - m_upgradeLabel4Win = NULL; - sideWindow = NULL; + m_upgradeLabel1Win = nullptr; + m_upgradeLabel2Win = nullptr; + m_upgradeLabel3Win = nullptr; + m_upgradeLabel4Win = nullptr; + sideWindow = nullptr; } ~SideSelectWindowData(void); @@ -741,7 +741,7 @@ class ControlBar : public SubsystemInterface void setObservedPlayer(Player *player); ///< Sets the observed player. Used to present the game world as if that player was the local player. Player *getObservedPlayer() const { return m_observedPlayer; } ///< Return the observed player. Can return null. - /// Returns the currently viewed player. May return NULL if no player is selected while observing. + /// Returns the currently viewed player. May return nullptr if no player is selected while observing. Player* getCurrentlyViewedPlayer(); /// Returns the relationship with the currently viewed player. May return NEUTRAL if no player is selected while observing. Relationship getCurrentlyViewedPlayerRelationship(const Team* team); @@ -818,7 +818,7 @@ class ControlBar : public SubsystemInterface /// show/hide the portrait window image using the image from the object void setPortraitByObject( Object *obj ); - /// show rally point at world location, a NULL location will hide any visible rally point marker + /// show rally point at world location, a nullptr location will hide any visible rally point marker void showRallyPoint( const Coord3D *loc ); /// post process step, after all commands and command sets are loaded @@ -843,7 +843,7 @@ class ControlBar : public SubsystemInterface static void populateInvDataCallback( Object *obj, void *userData ); // the following methods are for updating the currently showing context - CommandAvailability getCommandAvailability( const CommandButton *command, Object *obj, GameWindow *win, GameWindow *applyToWin = NULL, Bool forceDisabledEvaluation = FALSE ) const; + CommandAvailability getCommandAvailability( const CommandButton *command, Object *obj, GameWindow *win, GameWindow *applyToWin = nullptr, Bool forceDisabledEvaluation = FALSE ) const; void updateContextMultiSelect( void ); void updateContextPurchaseScience( void ); void updateContextCommand( void ); @@ -978,7 +978,7 @@ class ControlBar : public SubsystemInterface void hideBuildTooltipLayout( void ); void deleteBuildTooltipLayout( void ); Bool getShowBuildTooltipLayout( void ){return m_showBuildToolTipLayout; } - void populateBuildTooltipLayout( const CommandButton *commandButton, GameWindow *tooltipWin = NULL ); + void populateBuildTooltipLayout( const CommandButton *commandButton, GameWindow *tooltipWin = nullptr ); void repopulateBuildTooltipLayout( void ); private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h index a4a1782e84c..a00dfda8c67 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Credits.h @@ -81,7 +81,7 @@ static const LookupListRec CreditStyleNames[] = { "NORMAL", CREDIT_STYLE_NORMAL }, { "COLUMN", CREDIT_STYLE_COLUMN }, // CREDIT_STYLE_BLANK - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(CreditStyleNames) == MAX_CREDIT_STYLES, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index 799633ed043..352a2517d86 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -84,7 +84,7 @@ class Display : public SubsystemInterface virtual Int getDisplayModeCount(void) {return 0;} ///getNextView(); - return NULL; + return nullptr; } virtual void drawViews( void ); ///< Render all views of the world @@ -153,7 +153,7 @@ class Display : public SubsystemInterface virtual Bool isMoviePlaying(void); /// Register debug display callback - virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = NULL ); + virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = nullptr ); virtual DebugDisplayCallback *getDebugDisplayCallback(); virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting ) = 0; ///< set shroud @@ -216,7 +216,7 @@ class Display : public SubsystemInterface // the singleton extern Display *TheDisplay; -extern void StatDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL ); +extern void StatDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = nullptr ); //Necessary for display resolution confirmation dialog box //Holds the previous and current display settings diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index b66eb7dc96a..60c1035211b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -396,7 +396,7 @@ class Drawable : public Thing, void colorFlash( const RGBColor *color, UnsignedInt decayFrames = DEF_DECAY_FRAMES, UnsignedInt attackFrames = 0, UnsignedInt sustainAtPeak = 0 ); ///< flash a drawable in the color specified for a short time void colorTint( const RGBColor *color ); ///< tint this drawable the color specified void setTintEnvelope( const RGBColor *color, Real attack, Real decay ); ///< how to transition color - void flashAsSelected( const RGBColor *color = NULL ); ///< drawable takes care of the details if you spec no color + void flashAsSelected( const RGBColor *color = nullptr ); ///< drawable takes care of the details if you spec no color /// Return true if drawable has been marked as "selected" Bool isSelected( void ) const { return m_selected; } @@ -465,7 +465,7 @@ class Drawable : public Thing, // that the team is nonnull. void changedTeam(); - const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : NULL; } + const TWheelInfo *getWheelInfo(void) const { return m_locoInfo ? &m_locoInfo->m_wheelInfo : nullptr; } const DrawableLocoInfo *getLocoInfo() const { return m_locoInfo; } @@ -491,7 +491,7 @@ class Drawable : public Thing, // this is a special-purpose call for W3DModelDraw. (srj) Bool getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const; - Bool getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = NULL) const; + Bool getProjectileLaunchOffset(WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = nullptr) const; /** This call says, "I want the current animation (if any) to take n frames to complete a single cycle". @@ -570,7 +570,7 @@ class Drawable : public Thing, DrawableIconInfo* getIconInfo(); ///< lazily allocates, if necessary void killIcon(DrawableIconType t) { if (m_iconInfo) m_iconInfo->killIcon(t); } - Bool hasIconInfo() const { return m_iconInfo != NULL; } + Bool hasIconInfo() const { return m_iconInfo != nullptr; } Bool getReceivesDynamicLights( void ) { return m_receivesDynamicLights; }; @@ -580,7 +580,7 @@ class Drawable : public Thing, // Stuff for overriding ambient sound const AudioEventInfo * getBaseSoundAmbientInfo() const; //< Possible starting point if only some parameters are customized void enableAmbientSoundFromScript( Bool enable ); - const AudioEventRTS * getAmbientSound() const { return m_ambientSound == NULL ? NULL : &m_ambientSound->m_event; } + const AudioEventRTS * getAmbientSound() const { return m_ambientSound == nullptr ? nullptr : &m_ambientSound->m_event; } void setCustomSoundAmbientOff(); //< Kill the ambient sound void setCustomSoundAmbientInfo( DynamicAudioEventInfo * customAmbientInfo ); //< Set ambient sound. void clearCustomSoundAmbient( ) { clearCustomSoundAmbient( true ); } //< Return to using defaults @@ -678,7 +678,7 @@ class Drawable : public Thing, Drawable *m_nextDrawable; Drawable *m_prevDrawable; ///< list links - DynamicAudioEventInfo *m_customSoundAmbientInfo; ///< If not NULL, info about the ambient sound to attach to this object + DynamicAudioEventInfo *m_customSoundAmbientInfo; ///< If not nullptr, info about the ambient sound to attach to this object DrawableStatusBits m_status; ///< status bits (see DrawableStatus enum) UnsignedInt m_tintStatus; ///< tint color status bits (see TintStatus enum) diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h index 356bc358ba9..747c88ef9bd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h @@ -46,7 +46,7 @@ struct DrawableInfo ERF_DELAYED_RENDER = ERF_IS_TRANSLUCENT|ERF_POTENTIAL_OCCLUDEE, }; - DrawableInfo(void) : m_shroudStatusObjectID(INVALID_ID), m_drawable(NULL), m_ghostObject(NULL), m_flags(ERF_IS_NORMAL) {} + DrawableInfo(void) : m_shroudStatusObjectID(INVALID_ID), m_drawable(nullptr), m_ghostObject(nullptr), m_flags(ERF_IS_NORMAL) {} ObjectID m_shroudStatusObjectID; ///doFXPos(primary, primaryMtx, primarySpeed, secondary, overrideRadius); } /// inline convenience method to avoid having to check for null. - inline static void doFXObj(const FXList* fx, const Object* primary, const Object* secondary = NULL) + inline static void doFXObj(const FXList* fx, const Object* primary, const Object* secondary = nullptr) { if (fx) { @@ -166,13 +166,13 @@ class FXList The main guts of the system: actually perform the sound and/or video effects needed. Note that primary and/or secondary can be null, so you must check for this. */ - void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f) const; + void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx = nullptr, const Real primarySpeed = 0.0f, const Coord3D *secondary = nullptr, const Real overrideRadius = 0.0f) const; /** the object-based version... by default, just call the location-based implementation. Note that primary and/or secondary can be null, so you must check for this. */ - void doFXObj(const Object* primary, const Object* secondary = NULL) const; + void doFXObj(const Object* primary, const Object* secondary = nullptr) const; private: @@ -200,7 +200,7 @@ class FXListStore : public SubsystemInterface /** return the FXList with the given namekey. - return NULL if no such FXList exists. + return nullptr if no such FXList exists. */ const FXList *findFXList( const char* name ) const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h index 0c1ac745240..56fc475e5c9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h @@ -167,7 +167,7 @@ inline GameWindow *GadgetComboBoxGetDropDownButton( GameWindow *g ) if( comboBoxData && comboBoxData->dropDownButton ) return comboBoxData->dropDownButton; - return NULL; + return nullptr; } inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) { @@ -175,7 +175,7 @@ inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) if( comboBoxData && comboBoxData->listBox) return comboBoxData->listBox; - return NULL; + return nullptr; } @@ -185,7 +185,7 @@ inline GameWindow *GadgetComboBoxGetEditBox( GameWindow *g ) if( comboBoxData && comboBoxData->editBox) return comboBoxData->editBox; - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h index 9823f276f13..7709091010d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h @@ -185,7 +185,7 @@ inline GameWindow *GadgetListBoxGetSlider( GameWindow *g ) if( listData && listData->slider ) return listData->slider; - return NULL; + return nullptr; } inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) { @@ -193,7 +193,7 @@ inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) if( listData && listData->upButton ) return listData->upButton; - return NULL; + return nullptr; } inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) { @@ -201,7 +201,7 @@ inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) if( listData && listData->downButton ) return listData->downButton; - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h index 53d485e4d2a..ced1e0c3013 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h @@ -81,10 +81,10 @@ void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) void GadgetButtonSetData(GameWindow *g, void *data); void *GadgetButtonGetData(GameWindow *g); void GadgetButtonSetAltSound( GameWindow *g, AsciiString altSound ); -inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } inline void GadgetButtonSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetEnabledSelectedColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } inline void GadgetButtonSetEnabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } inline const Image *GadgetButtonGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } @@ -94,10 +94,10 @@ inline const Image *GadgetButtonGetEnabledSelectedImage( GameWindow *g ) { r inline Color GadgetButtonGetEnabledSelectedColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } inline Color GadgetButtonGetEnabledSelectedBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } inline void GadgetButtonSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetDisabledSelectedColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } inline void GadgetButtonSetDisabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } inline const Image *GadgetButtonGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } @@ -107,10 +107,10 @@ inline const Image *GadgetButtonGetDisabledSelectedImage( GameWindow *g ) { inline Color GadgetButtonGetDisabledSelectedColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } inline Color GadgetButtonGetDisabledSelectedBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, NULL );g->winSetEnabledImage( 6, NULL );} +inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} inline void GadgetButtonSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } inline void GadgetButtonSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, NULL );g->winSetEnabledImage( 3, NULL );} +inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} inline void GadgetButtonSetHiliteSelectedColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } inline void GadgetButtonSetHiliteSelectedBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } inline const Image *GadgetButtonGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h index 8eb102efae5..323c2a610b4 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h @@ -220,7 +220,7 @@ inline const Image *GadgetSliderGetEnabledThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetEnabledImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetEnabledThumbColor( GameWindow *g ) { @@ -244,7 +244,7 @@ inline const Image *GadgetSliderGetEnabledSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetEnabledSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetEnabledSelectedThumbColor( GameWindow *g ) { @@ -307,7 +307,7 @@ inline const Image *GadgetSliderGetDisabledThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetDisabledImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetDisabledThumbColor( GameWindow *g ) { @@ -331,7 +331,7 @@ inline const Image *GadgetSliderGetDisabledSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetDisabledSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetDisabledSelectedThumbColor( GameWindow *g ) { @@ -393,7 +393,7 @@ inline const Image *GadgetSliderGetHiliteThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetHiliteImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetHiliteThumbColor( GameWindow *g ) { @@ -417,7 +417,7 @@ inline const Image *GadgetSliderGetHiliteSelectedThumbImage( GameWindow *g ) if( thumb ) return GadgetButtonGetHiliteSelectedImage( thumb ); else - return NULL; + return nullptr; } inline Color GadgetSliderGetHiliteSelectedThumbColor( GameWindow *g ) { diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h index 3a0d32e59f6..e1427047606 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h @@ -222,7 +222,7 @@ class GameClient : public SubsystemInterface, do \ { \ Drawable* _xq_nextDrawable; \ - for (Drawable* DRAW = TheGameClient->firstDrawable(); DRAW != NULL; DRAW = _xq_nextDrawable ) \ + for (Drawable* DRAW = TheGameClient->firstDrawable(); DRAW != nullptr; DRAW = _xq_nextDrawable ) \ { \ _xq_nextDrawable = DRAW->getNextDrawable(); \ if (DRAW->getStatusFlags() & (STATUS)) \ @@ -241,12 +241,12 @@ class GameClient : public SubsystemInterface, inline Drawable* GameClient::findDrawableByID( const DrawableID id ) { if( id == INVALID_DRAWABLE_ID ) - return NULL; + return nullptr; // DrawablePtrHashIt it = m_drawableHash.find(id); // if (it == m_drawableHash.end()) { // // no such drawable -// return NULL; +// return nullptr; // } // // return (*it).second; @@ -254,7 +254,7 @@ inline Drawable* GameClient::findDrawableByID( const DrawableID id ) if( (size_t)id < m_drawableVector.size() ) return m_drawableVector[(size_t)id]; - return NULL; + return nullptr; } @@ -277,29 +277,29 @@ extern GameClient *TheGameClient; // // GameEngine: // TheGameClient is partially disabled: -// TheKeyboard = NULL -// TheMouse = NULL +// TheKeyboard = nullptr +// TheMouse = nullptr // TheDisplay is partially disabled: -// m_3DInterfaceScene = NULL -// m_2DScene = NULL -// m_3DScene = NULL +// m_3DInterfaceScene = nullptr +// m_2DScene = nullptr +// m_3DScene = nullptr // (m_assetManager remains!) // TheWindowManager = GameWindowManagerDummy -// TheIMEManager = NULL +// TheIMEManager = nullptr // TheTerrainVisual is partially disabled: -// TheTerrainTracksRenderObjClassSystem = NULL -// TheW3DShadowManager = NULL -// TheWaterRenderObj = NULL -// TheSmudgeManager = NULL +// TheTerrainTracksRenderObjClassSystem = nullptr +// TheW3DShadowManager = nullptr +// TheWaterRenderObj = nullptr +// TheSmudgeManager = nullptr // TheTerrainRenderObject is partially disabled: -// m_treeBuffer = NULL -// m_propBuffer = NULL -// m_bibBuffer = NULL +// m_treeBuffer = nullptr +// m_propBuffer = nullptr +// m_bibBuffer = nullptr // m_bridgeBuffer is partially disabled: -// m_vertexBridge = NULL -// m_indexBridge = NULL -// m_vertexMaterial = NULL -// m_waypointBuffer = NULL -// m_roadBuffer = NULL -// m_shroud = NULL +// m_vertexBridge = nullptr +// m_indexBridge = nullptr +// m_vertexMaterial = nullptr +// m_waypointBuffer = nullptr +// m_roadBuffer = nullptr +// m_shroud = nullptr // TheRadar = RadarDummy diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h index 08ce4da1ecc..154799a5dd8 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h @@ -98,7 +98,7 @@ inline GameFont *FontLibrary::nextFont( GameFont *font ) { if( font ) return font->next; - return NULL; + return nullptr; } // EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h index 500c4ecd22d..7dc1f79e041 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h @@ -72,8 +72,8 @@ class GameTextInterface : public SubsystemInterface virtual ~GameTextInterface() {}; - virtual UnicodeString fetch( const Char *label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text - virtual UnicodeString fetch( AsciiString label, Bool *exists = NULL ) = 0; ///< Returns the associated labeled unicode text ; TheSuperHackers @todo Remove + virtual UnicodeString fetch( const Char *label, Bool *exists = nullptr ) = 0; ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( AsciiString label, Bool *exists = nullptr ) = 0; ///< Returns the associated labeled unicode text ; TheSuperHackers @todo Remove virtual UnicodeString fetchFormat( const Char *label, ... ) = 0; // Do not call this directly, but use the FETCH_OR_SUBSTITUTE macro diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h index 18f652a9dfb..4a490fef3e2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h @@ -439,7 +439,7 @@ class GameWindowDummy : public GameWindow MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(GameWindowDummy, "GameWindowDummy") public: virtual void winDrawBorder() {} - virtual void* winGetUserData(void) { return NULL; } + virtual void* winGetUserData(void) { return nullptr; } }; // ModalWindow ---------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h index 22616dff9d4..62fe086204e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -197,7 +197,7 @@ friend class GameWindow; //--------------------------------------------------------------------------- // Creating windows /// create new window(s) from .wnd file ... see definition for what is returned - virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = NULL ); + virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = nullptr ); /// create new window(s) from .wnd file and wrap in a WindowLayout virtual WindowLayout *winCreateLayout( AsciiString filename ); @@ -209,7 +209,7 @@ friend class GameWindow; virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, Int x, Int y, Int width, Int height, GameWinSystemFunc system, - WinInstanceData *instData = NULL ); + WinInstanceData *instData = nullptr ); //--------------------------------------------------------------------------- // Manipulating windows in the system @@ -270,7 +270,7 @@ friend class GameWindow; WindowMsgData mData1, WindowMsgData mData2 ); /** get the window pointer from id, starting at 'window' and searching - down the heirarchy. If 'window' is NULL then all windows will + down the heirarchy. If 'window' is nullptr then all windows will be searched */ virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id ); virtual Int winCapture( GameWindow *window ); ///< captures the mouse @@ -389,26 +389,26 @@ class GameWindowManagerDummy : public GameWindowManager virtual GameWindow *allocateNewWindow() { return newInstance(GameWindowDummy); } - virtual GameWinDrawFunc getPushButtonImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getPushButtonDrawFunc() { return NULL; } - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getCheckBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getRadioButtonDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTabControlImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTabControlDrawFunc() { return NULL; } - virtual GameWinDrawFunc getListBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getListBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getComboBoxImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getComboBoxDrawFunc() { return NULL; } - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() { return NULL; } - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getVerticalSliderDrawFunc() { return NULL; } - virtual GameWinDrawFunc getProgressBarImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getProgressBarDrawFunc() { return NULL; } - virtual GameWinDrawFunc getStaticTextImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getStaticTextDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTextEntryImageDrawFunc() { return NULL; } - virtual GameWinDrawFunc getTextEntryDrawFunc() { return NULL; } + virtual GameWinDrawFunc getPushButtonImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getPushButtonDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getCheckBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getCheckBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getRadioButtonImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getRadioButtonDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTabControlImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTabControlDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getListBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getListBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getComboBoxImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getComboBoxDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getHorizontalSliderDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getVerticalSliderDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getProgressBarImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getProgressBarDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getStaticTextImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getStaticTextDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTextEntryImageDrawFunc() { return nullptr; } + virtual GameWinDrawFunc getTextEntryDrawFunc() { return nullptr; } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index fcd6bca92d5..239014b8ece 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -103,7 +103,7 @@ static const LookupListRec TransitionStyleNames[] = { "CONTROLBARARROW", CONTROL_BAR_ARROW_TRANSITION }, { "SCORESCALEUP", SCORE_SCALE_UP_TRANSITION }, { "REVERSESOUND", REVERSE_SOUND_TRANSITION }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TransitionStyleNames) == MAX_TRANSITION_WINDOW_STYLES + 1, "Incorrect array size"); @@ -122,7 +122,7 @@ class Transition virtual void skip( void ) = 0; - void unlinkGameWindow(GameWindow* win) { if ( m_win == win ) m_win = NULL; } + void unlinkGameWindow(GameWindow* win) { if ( m_win == win ) m_win = nullptr; } Bool isFinished( void ) { return m_isFinished; } Int getFrameLength( void ){ return m_frameLength; } protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h index 5c791363fde..1301e402fa8 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h @@ -53,7 +53,7 @@ static const char *const imageStatusNames[] = { "ROTATED_90_CLOCKWISE", "RAW_TEXTURE", - NULL + nullptr }; #endif // end DEFINE_IMAGE_STATUS_NAMES @@ -142,7 +142,7 @@ class ImageCollection : public SubsystemInterface for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) if (!index--) return i->second; - return NULL; + return nullptr; } protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index d30b79567f1..775610d4e02 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -142,7 +142,7 @@ static const char *const TheRadiusCursorNames[] = "CLEARMINES", "AMBULANCE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); #endif @@ -462,7 +462,7 @@ friend class Drawable; // for selection/deselection transactions virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of virtual void setRadiusCursor(RadiusCursorType r, const SpecialPowerTemplate* sp, WeaponSlotType wslot); - virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, NULL, PRIMARY_WEAPON); } + virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, nullptr, PRIMARY_WEAPON); } virtual void setInputEnabled( Bool enable ); ///< Set the input enabled or disabled virtual Bool getInputEnabled( void ) { return m_inputEnabled; } ///< Get the current input status @@ -688,7 +688,7 @@ friend class Drawable; // for selection/deselection transactions void incrementSelectCount( void ) { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables void decrementSelectCount( void ) { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables virtual View *createView( void ) = 0; ///< Factory for Views - void evaluateSoloNexus( Drawable *newlyAddedDrawable = NULL ); + void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr ); /// expire a hint from of the specified type at the hint index void expireHint( HintType type, UnsignedInt hintIndex ); @@ -699,7 +699,7 @@ friend class Drawable; // for selection/deselection transactions void setMouseCursor(Mouse::MouseCursor c); - void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = NULL ); ///< internal workhorse for adding plain text for messages + void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr ); ///< internal workhorse for adding plain text for messages void removeMessageAtIndex( Int i ); ///< remove the message at index i void updateFloatingText( void ); ///< Update function to move our floating text diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h index 79a11a6d82d..527af260552 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h @@ -117,7 +117,7 @@ class Keyboard : public SubsystemInterface // access methods for key data void resetKeys( void ); ///< reset the state of the keys KeyboardIO *getFirstKey( void ); ///< get first key ready for processing - KeyboardIO *findKey( KeyDefType key, KeyboardIO::StatusType status ); ///< get key ready for processing, can return NULL + KeyboardIO *findKey( KeyDefType key, KeyboardIO::StatusType status ); ///< get key ready for processing, can return nullptr void setKeyStatusData( KeyDefType key, KeyboardIO::StatusType data ); ///< set key status WideChar translateKey( WideChar keyCode ); ///< translate key code to printable UNICODE char diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h index ba8031e8d71..8e2217a9601 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h @@ -39,10 +39,10 @@ extern Bool ClipLine2D( ICoord2D *p1, ICoord2D *p2, ICoord2D *c1, ICoord2D *c2, ///< IntersectLine2D will take two segments delimited by ab and cd and will return whether ///< they intersect within the length of ab. They will also return the intersection point out -///< intersection if it is non-NULL. +///< intersection if it is non-null. extern Bool IntersectLine2D( const Coord2D *a, const Coord2D *b, const Coord2D *c, const Coord2D *d, - Coord2D *intersection = NULL); + Coord2D *intersection = nullptr); ///< PointInsideRect2D will return true iff inputPoint lies iside of the rectangle specified ///< by bl, tl, br, tr. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h index f096807b8db..c1101296edd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -55,7 +55,7 @@ static const LookupListRec CategoryListName[] = {"TEAM", CATEGORY_TEAM}, {"MISC", CATEGORY_MISC}, {"DEBUG", CATEGORY_DEBUG}, - {NULL, 0} + { nullptr, 0} }; @@ -258,7 +258,7 @@ static const LookupListRec KeyNames[] = { "KEY_INS", MK_INS }, { "KEY_DEL", MK_DEL }, { "KEY_NONE", MK_NONE }, - { NULL, 0 } + { nullptr, 0 } }; // ------------------------------------------------------------------------------- @@ -276,7 +276,7 @@ static const LookupListRec TransitionNames[] = { "DOWN", DOWN }, { "UP", UP }, { "DOUBLEDOWN", DOUBLEDOWN }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TransitionNames) == MAPPABLE_KEY_TRANSITION_COUNT + 1, "Incorrect array size"); @@ -304,7 +304,7 @@ static const LookupListRec ModifierNames[] = { "SHIFT_CTRL", SHIFT_CTRL }, { "SHIFT_ALT", SHIFT_ALT }, { "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL }, - { NULL, 0 } + { nullptr, 0 } }; @@ -328,7 +328,7 @@ static const char* const TheCommandUsableInNames[] = "GAME", "OBSERVER", - NULL + nullptr }; // ------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index 6170da909f1..77cec327bea 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -295,7 +295,7 @@ class Mouse : public SubsystemInterface Int getCursorTooltipDelay() { return m_tooltipDelay; } void setCursorTooltipDelay(Int delay) { m_tooltipDelay = delay; } - void setCursorTooltip( UnicodeString tooltip, Int tooltipDelay = -1, const RGBColor *color = NULL, Real width = 1.0f ); ///< set tooltip string at cursor + void setCursorTooltip( UnicodeString tooltip, Int tooltipDelay = -1, const RGBColor *color = nullptr, Real width = 1.0f ); ///< set tooltip string at cursor void setMouseText( UnicodeString text, const RGBAColorInt *color, const RGBAColorInt *dropColor ); ///< set the cursor text, *NOT* the tooltip text virtual void setMouseLimits( void ); ///< update the limit extents the mouse can move in MouseCursor getMouseCursor(void) { return m_currentCursor; } ///< get the current mouse cursor image type diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index c2fd7e89da9..ccd6c6a1689 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -183,7 +183,7 @@ class Particle : public MemoryPoolObject, void setIsCulled (Bool enable) { m_isCulled = enable;} ///< set particle to not visible because it's outside view frustum void controlParticleSystem( ParticleSystem *sys ) { m_systemUnderControl = sys; } - void detachControlledParticleSystem( void ) { m_systemUnderControl = NULL; } + void detachControlledParticleSystem( void ) { m_systemUnderControl = nullptr; } // get priority of this particle ... which is the priority of the system it belongs to ParticlePriorityType getPriority( void ); @@ -445,37 +445,37 @@ class ParticleSystemInfo : public Snapshot static const char *const ParticleShaderTypeNames[] = { - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", NULL + "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", nullptr }; static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); static const char *const ParticleTypeNames[] = { - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE","SMUDGE", NULL + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE","SMUDGE", nullptr }; static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); static const char *const EmissionVelocityTypeNames[] = { - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", NULL + "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", nullptr }; static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); static const char *const EmissionVolumeTypeNames[] = { - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", NULL + "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", nullptr }; static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); static const char *const ParticlePriorityNames[] = { - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", NULL + "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", nullptr }; static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); static const char *const WindMotionNames[] = { - "NONE", "Unused", "PingPong", "Circular", NULL + "NONE", "Unused", "PingPong", "Circular", nullptr }; static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); @@ -494,7 +494,7 @@ class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystem AsciiString getName( void ) const { return m_name; } // This function was made const because of update modules' module data being all const. - ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-NULL, it is a slave system for use + ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-null, it is a slave system for use const FieldParse *getFieldParse( void ) const { return m_fieldParseTable; } ///< Parsing from INI access static void parseRGBColorKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); @@ -518,7 +518,7 @@ class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystem AsciiString m_name; ///< the name of this template // This has to be mutable because of the delayed initialization thing in createSlaveSystem - mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-NULL, use this to create a slave system + mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-null, use this to create a slave system // template attribute data inherited from ParticleSystemInfo class }; @@ -609,7 +609,7 @@ class ParticleSystem : public MemoryPoolObject, Bool isSaveable( void ) const { return m_isSaveable; } /// called when the particle this system is controlled by dies - void detachControlParticle( Particle *p ) { m_controlParticle = NULL; } + void detachControlParticle( Particle *p ) { m_controlParticle = nullptr; } /// called to merge two systems info. If slaveNeedsFullPromotion is true, then the slave needs to be aware of how many particles /// to generate as well. @@ -687,14 +687,14 @@ class ParticleSystem : public MemoryPoolObject, Coord3D m_pos; ///< this is the position to emit at. Coord3D m_lastPos; ///< this is the previous position we emitted at. - ParticleSystem * m_slaveSystem; ///< if non-NULL, another system this one has control of + ParticleSystem * m_slaveSystem; ///< if non-null, another system this one has control of ParticleSystemID m_slaveSystemID; ///< id of slave system (if present) - ParticleSystem * m_masterSystem; ///< if non-NULL, the system that controls this one + ParticleSystem * m_masterSystem; ///< if non-null, the system that controls this one ParticleSystemID m_masterSystemID; ///< master system id (if present); const ParticleSystemTemplate * m_template; ///< the template this system was constructed from - Particle * m_controlParticle; ///< if non-NULL, this system is controlled by this particle + Particle * m_controlParticle; ///< if non-null, this system is controlled by this particle Bool m_isLocalIdentity; ///< if true, the matrix can be ignored Bool m_isIdentity; ///< if true, the matrix can be ignored @@ -817,4 +817,4 @@ class ParticleSystemManager : public SubsystemInterface, extern ParticleSystemManager *TheParticleSystemManager; class DebugDisplayInterface; -extern void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = NULL ); +extern void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp = nullptr ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h index 3b8347c9d13..01e02d09dbe 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h @@ -56,7 +56,7 @@ static const char* const TheShadowNames[] = "SHADOW_DIRECTIONAL_PROJECTION", "SHADOW_ALPHA_DECAL", "SHADOW_ADDITIVE_DECAL", - NULL + nullptr }; #endif // end DEFINE_SHADOW_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h b/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h index a4bdf6ce2b5..b5d4c5456a1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h @@ -72,9 +72,9 @@ class WindowLayout : public MemoryPoolObject GameWindow *getFirstWindow( void ) const; ///< get first window in list for screen // accessing layout callbacks ------------------------------------------------------------------ - void runInit( void *userData = NULL ); ///< run the init method if available - void runUpdate( void *userData = NULL ); ///< run the update method if available - void runShutdown( void *userData = NULL ); ///< run the shutdown method if available + void runInit( void *userData = nullptr ); ///< run the init method if available + void runUpdate( void *userData = nullptr ); ///< run the update method if available + void runShutdown( void *userData = nullptr ); ///< run the shutdown method if available void setInit( WindowLayoutInitFunc init ); ///< set the init callback void setUpdate( WindowLayoutUpdateFunc update ); ///< set the update callback void setShutdown( WindowLayoutShutdownFunc shutdown); ///< set the shutdown callback diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h index fc4a0be12d0..0563f0f56aa 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h @@ -100,7 +100,7 @@ class AISideInfo : public MemoryPoolObject { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AISideInfo, "AISideInfo") public: - AISideInfo( void ) : m_easy(0), m_normal(1), m_hard(2), m_next(NULL) + AISideInfo( void ) : m_easy(0), m_normal(1), m_hard(2), m_next(nullptr) { m_side.clear(); m_baseDefenseStructure1.clear(); @@ -264,7 +264,7 @@ class AI : public SubsystemInterface, public Snapshot UNFOGGED = 1 << 5 }; Object *findClosestEnemy( const Object *me, Real range, UnsignedInt qualifiers, - const AttackPriorityInfo *info=NULL, PartitionFilter *optionalFilter=NULL); + const AttackPriorityInfo *info=nullptr, PartitionFilter *optionalFilter=nullptr); Object *findClosestRepulsor( const Object *me, Real range); @@ -341,7 +341,7 @@ static const char *const TheCommandSourceMaskNames[] = "FROM_DOZER", //don't use this "DEFAULT_SWITCH_WEAPON", //unit will pick this weapon when normal logic fails. - NULL + nullptr }; static_assert(ARRAY_SIZE(TheCommandSourceMaskNames) == COMMAND_SOURCE_TYPE_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuard.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuard.h index c8b0597bff3..029df010c1f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuard.h @@ -138,8 +138,8 @@ class AIGuardInnerState : public State public: AIGuardInnerState( StateMachine *machine ) : State( machine, "AIGuardInner" ) { - m_attackState = NULL; - m_enterState = NULL; + m_attackState = nullptr; + m_enterState = nullptr; } virtual Bool isAttack() const { return m_attackState ? m_attackState->isAttack() : FALSE; } virtual StateReturnType onEnter( void ); @@ -189,7 +189,7 @@ class AIGuardOuterState : public State public: AIGuardOuterState( StateMachine *machine ) : State( machine, "AIGuardOuter" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual Bool isAttack() const { return m_attackState ? m_attackState->isAttack() : FALSE; } virtual StateReturnType onEnter( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuardRetaliate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuardRetaliate.h index cc889280cda..4f1e9b9a83e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuardRetaliate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIGuardRetaliate.h @@ -175,7 +175,7 @@ class AIGuardRetaliateOuterState : public State public: AIGuardRetaliateOuterState( StateMachine *machine ) : State( machine, "AIGuardRetaliateOuter" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index a76f26cc521..89f36104be3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -78,7 +78,7 @@ class PathNode : public MemoryPoolObject void setNextOptimized( PathNode *node ); - PathNode *getNextOptimized(Coord2D* dir = NULL, Real* dist = NULL) ///< return next node in optimized path + PathNode *getNextOptimized(Coord2D* dir = nullptr, Real* dist = nullptr) ///< return next node in optimized path { if (dir) *dir = m_nextOptiDirNorm2D; @@ -87,7 +87,7 @@ class PathNode : public MemoryPoolObject return m_nextOpti; } - const PathNode *getNextOptimized(Coord2D* dir = NULL, Real* dist = NULL) const ///< return next node in optimized path + const PathNode *getNextOptimized(Coord2D* dir = nullptr, Real* dist = nullptr) const ///< return next node in optimized path { if (dir) *dir = m_nextOptiDirNorm2D; @@ -318,7 +318,7 @@ class PathfindCell /// remove all cells from closed list. static Int releaseOpenList( PathfindCell *list ); - inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell:NULL;} + inline PathfindCell *getNextOpen(void) {return m_info->m_nextOpen?m_info->m_nextOpen->m_cell: nullptr;} inline UnsignedShort getXIndex(void) const {return m_info->m_pos.x;} inline UnsignedShort getYIndex(void) const {return m_info->m_pos.y;} @@ -337,7 +337,7 @@ class PathfindCell void setParentCell(PathfindCell* parent); void clearParentCell(void); void setParentCellHierarchical(PathfindCell* parent); - inline PathfindCell* getParentCell(void) const {return m_info ? m_info->m_pathParent ? m_info->m_pathParent->m_cell : NULL : NULL;} + inline PathfindCell* getParentCell(void) const {return m_info ? m_info->m_pathParent ? m_info->m_pathParent->m_cell : nullptr : nullptr;} Bool startPathfind( PathfindCell *goalCell ); Bool getPinched(void) const {return m_pinched;} @@ -345,7 +345,7 @@ class PathfindCell Bool allocateInfo(const ICoord2D &pos); void releaseInfo(void); - Bool hasInfo(void) const {return m_info!=NULL;} + Bool hasInfo(void) const {return m_info!=nullptr;} zoneStorageType getZone(void) const {return m_zone;} void setZone(zoneStorageType zone) {m_zone = zone;} void setGoalUnit(ObjectID unit, const ICoord2D &pos ); @@ -673,7 +673,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot void setIgnoreObstacleID( ObjectID objID ); ///< if non-zero, the pathfinder will ignore the given obstacle - Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell = NULL ); ///< Return true if given position is a valid movement location + Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell = nullptr ); ///< Return true if given position is a valid movement location Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Int x, Int y ); ///< Return true if given position is a valid movement location Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, const Coord3D *pos ); ///< Return true if given position is a valid movement location Bool validMovementTerrain( PathfindLayerEnum layer, const Locomotor* locomotor, const Coord3D *pos ); ///< Return true if given position is a valid movement location @@ -706,7 +706,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot // Adjusts the destination to a spot near dest that is not occupied by other units. Bool adjustDestination(Object *obj, const LocomotorSet& locomotorSet, - Coord3D *dest, const Coord3D *groupDest=NULL); + Coord3D *dest, const Coord3D *groupDest=nullptr); // Adjusts the destination to a spot near dest for landing that is not occupied by other units. Bool adjustToLandingDestination(Object *obj, Coord3D *dest); @@ -930,7 +930,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, Int x, Int y if (x >= m_extent.lo.x && x <= m_extent.hi.x && y >= m_extent.lo.y && y <= m_extent.hi.y) { - PathfindCell *cell = NULL; + PathfindCell *cell = nullptr; if (layer > LAYER_GROUND && layer <= LAYER_LAST) { cell = m_layers[layer].getCell(x, y); @@ -941,7 +941,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, Int x, Int y } else { - return NULL; + return nullptr; } } @@ -949,7 +949,7 @@ inline PathfindCell *Pathfinder::getCell( PathfindLayerEnum layer, const Coord3D { ICoord2D cell; Bool overflow = worldToCell( pos, &cell ); - if (overflow) return NULL; + if (overflow) return nullptr; return getCell( layer, cell.x, cell.y ); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPlayer.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPlayer.h index c623b5aba36..f7ded4d1742 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPlayer.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPlayer.h @@ -50,7 +50,7 @@ class WorkOrder : public MemoryPoolObject, public: - WorkOrder():m_thing(NULL), m_factoryID(INVALID_ID), m_isResourceGatherer(false), m_numCompleted(0), m_numRequired(1), m_next(NULL) {}; + WorkOrder():m_thing(nullptr), m_factoryID(INVALID_ID), m_isResourceGatherer(false), m_numCompleted(0), m_numRequired(1), m_next(nullptr) {}; Bool isWaitingToBuild( void ); ///< return true if nothing is yet building this unit void validateFactory( Player *thisPlayer ); ///< verify factoryID still refers to an active object @@ -106,9 +106,9 @@ class TeamInQueue : public MemoryPoolObject, public: TeamInQueue() : - m_workOrders(NULL), - m_team(NULL), - m_nextTeamInQueue(NULL), + m_workOrders(nullptr), + m_team(nullptr), + m_nextTeamInQueue(nullptr), m_sentToStartLocation(false), m_reinforcement(false), m_stopQueueing(false), @@ -179,7 +179,7 @@ class AIPlayer : public MemoryPoolObject, virtual void recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadius); ///< Builds this team immediately. virtual Bool isSkirmishAI(void) {return false;} - virtual Player *getAiEnemy(void) {return NULL;} ///< Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba. + virtual Player *getAiEnemy(void) {return nullptr;} ///< Solo AI attacks based on scripting. Only skirmish auto-acquires an enemy at this point. jba. virtual Bool checkBridges(Object *unit, Waypoint *way) {return false;} virtual void repairStructure(ObjectID structure); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h index 8d96e659972..3b2738a2f93 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h @@ -655,7 +655,7 @@ class AIFollowWaypointPathExactState : public AIInternalMoveToState MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIFollowWaypointPathExactState, "AIFollowWaypointPathExactState") public: AIFollowWaypointPathExactState( StateMachine *machine, Bool asGroup ) : m_moveAsGroup(asGroup), - m_lastWaypoint(NULL), + m_lastWaypoint(nullptr), AIInternalMoveToState( machine, "AIFollowWaypointPathExactState" ) { } virtual StateReturnType onEnter(); virtual void onExit( StateExitType status ); @@ -1023,7 +1023,7 @@ class AIAttackSquadState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIAttackSquadState, "AIAttackSquadState") public: - AIAttackSquadState( StateMachine *machine, AttackExitConditionsInterface *attackParameters = NULL) : + AIAttackSquadState( StateMachine *machine, AttackExitConditionsInterface *attackParameters = nullptr) : State( machine , "AIAttackSquadState") { } //~AIAttackSquadState(); @@ -1069,7 +1069,7 @@ class AIDockState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIDockState, "AIDockState") public: - AIDockState( StateMachine *machine ) : State( machine, "AIDockState" ), m_dockMachine(NULL), m_usingPrecisionMovement(FALSE) { } + AIDockState( StateMachine *machine ) : State( machine, "AIDockState" ), m_dockMachine(nullptr), m_usingPrecisionMovement(FALSE) { } //~AIDockState(); virtual Bool isAttack() const { return m_dockMachine ? m_dockMachine->isInAttackState() : FALSE; } virtual StateReturnType onEnter(); @@ -1158,9 +1158,9 @@ class AIGuardState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIGuardState, "AIGuardState") public: - AIGuardState( StateMachine *machine ) : State( machine, "AIGuardState" ), m_guardMachine(NULL) + AIGuardState( StateMachine *machine ) : State( machine, "AIGuardState" ), m_guardMachine(nullptr) { - m_guardMachine = NULL; + m_guardMachine = nullptr; } //~AIGuardState(); virtual Bool isAttack() const; @@ -1189,7 +1189,7 @@ class AIGuardRetaliateState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIGuardRetaliateState, "AIGuardRetaliateState") public: - AIGuardRetaliateState( StateMachine *machine ) : State( machine, "AIGuardRetaliateState" ), m_guardRetaliateMachine(NULL) {} + AIGuardRetaliateState( StateMachine *machine ) : State( machine, "AIGuardRetaliateState" ), m_guardRetaliateMachine(nullptr) {} //~AIGuardRetaliateState(); virtual Bool isAttack() const; virtual StateReturnType onEnter(); @@ -1216,9 +1216,9 @@ class AITunnelNetworkGuardState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AITunnelNetworkGuardState, "AITunnelNetworkGuardState") public: - AITunnelNetworkGuardState( StateMachine *machine ) : State( machine, "AITunnelNetworkGuardState" ), m_guardMachine(NULL) + AITunnelNetworkGuardState( StateMachine *machine ) : State( machine, "AITunnelNetworkGuardState" ), m_guardMachine(nullptr) { - m_guardMachine = NULL; + m_guardMachine = nullptr; } //~AIGuardState(); virtual Bool isAttack() const; @@ -1246,7 +1246,7 @@ class AIHuntState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIHuntState, "AIHuntState") public: - AIHuntState( StateMachine *machine ) : State( machine, "AIHuntState" ), m_huntMachine(NULL) + AIHuntState( StateMachine *machine ) : State( machine, "AIHuntState" ), m_huntMachine(nullptr) { m_nextEnemyScanTime = 0; } @@ -1279,7 +1279,7 @@ class AIAttackAreaState : public State { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AIAttackAreaState, "AIAttackAreaState") public: - AIAttackAreaState( StateMachine *machine ) : State( machine, "AIAttackAreaState" ), m_attackMachine(NULL), + AIAttackAreaState( StateMachine *machine ) : State( machine, "AIAttackAreaState" ), m_attackMachine(nullptr), m_nextEnemyScanTime(0) { } //~AIAttackAreaState(); virtual Bool isAttack() const { return m_attackMachine ? m_attackMachine->isInAttackState() : FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AITNGuard.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AITNGuard.h index c5a34a6944d..ff82a06d26f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AITNGuard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AITNGuard.h @@ -120,7 +120,7 @@ class AITNGuardInnerState : public State public: AITNGuardInnerState( StateMachine *machine ) : State( machine, "AITNGuardInner" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); @@ -167,7 +167,7 @@ class AITNGuardOuterState : public State public: AITNGuardOuterState( StateMachine *machine ) : State( machine, "AITNGuardOuter" ) { - m_attackState = NULL; + m_attackState = nullptr; } virtual StateReturnType onEnter( void ); virtual StateReturnType update( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h index b98b2ba8d9e..bd584b46a92 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Armor.h @@ -70,7 +70,7 @@ class Armor { public: - inline Armor(const ArmorTemplate* tmpl = NULL) : m_template(tmpl) + inline Armor(const ArmorTemplate* tmpl = nullptr) : m_template(tmpl) { } @@ -81,7 +81,7 @@ class Armor inline void clear() { - m_template = NULL; + m_template = nullptr; } private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h index 6f99fde5fde..247011075a6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ArmorSet.h @@ -74,8 +74,8 @@ class ArmorTemplateSet void clear() { m_types.clear(); - m_template = NULL; - m_fx = NULL; + m_template = nullptr; + m_fx = nullptr; } const ArmorTemplate* getArmorTemplate() const { return m_template; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h index df1b6e5f679..54df02f52dc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h @@ -220,7 +220,7 @@ static const char *const TheDeathNames[] = "EXTRA_8", "POISONED_GAMMA", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheDeathNames) == DEATH_NUM_TYPES + 1, "Incorrect array size"); #endif // end DEFINE_DEATH_NAMES @@ -260,7 +260,7 @@ class DamageInfoInput : public Snapshot DamageInfoInput( void ) { m_sourceID = INVALID_ID; - m_sourceTemplate = NULL; + m_sourceTemplate = nullptr; m_sourcePlayerMask = 0; m_damageType = DAMAGE_EXPLOSION; m_damageStatusType = OBJECT_STATUS_NONE; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h index c4f7e130737..69b8175f68a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -428,17 +428,17 @@ inline UnsignedShort GameLogic::getSuperweaponRestriction() const { return m_sup inline Object* GameLogic::findObjectByID( ObjectID id ) { if( id == INVALID_ID ) - return NULL; + return nullptr; // ObjectPtrHash::iterator it = m_objHash.find(id); // if (it == m_objHash.end()) -// return NULL; +// return nullptr; // // return (*it).second; if( (size_t)id < m_objVector.size() ) return m_objVector[(size_t)id]; - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h index 6a3886ea982..adb0faf5840 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h @@ -85,7 +85,7 @@ static const char *const TheLocomotorAppearanceNames[] = "OTHER", "MOTORCYCLE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorAppearanceNames) == LOCOMOTOR_APPEARANCE_COUNT + 1, "Array size"); #endif @@ -117,7 +117,7 @@ static const char *const TheLocomotorBehaviorZNames[] = "FIXED_RELATIVE_TO_GROUND_AND_BUILDINGS", "RELATIVE_TO_HIGHEST_LAYER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorBehaviorZNames) == LOCOMOTOR_BEHAVIOR_Z_COUNT + 1, "Array size"); #endif @@ -385,14 +385,14 @@ class Locomotor : public MemoryPoolObject, public Snapshot void maintainCurrentPositionHover(Object* obj, PhysicsBehavior *physics); void maintainCurrentPositionWings(Object* obj, PhysicsBehavior *physics); - PhysicsTurningType rotateTowardsPosition(Object* obj, const Coord3D& goalPos, Real *relAngle=NULL); + PhysicsTurningType rotateTowardsPosition(Object* obj, const Coord3D& goalPos, Real *relAngle=nullptr); /* return true if we can maintain the position without being called every frame (eg, we are resting on the ground), false if not (eg, we are hovering or circling) */ Bool handleBehaviorZ(Object* obj, PhysicsBehavior *physics, const Coord3D& goalPos); - PhysicsTurningType rotateObjAroundLocoPivot(Object* obj, const Coord3D& goalPos, Real maxTurnRate, Real *relAngle = NULL); + PhysicsTurningType rotateObjAroundLocoPivot(Object* obj, const Coord3D& goalPos, Real maxTurnRate, Real *relAngle = nullptr); Real getSurfaceHtAtPt(Real x, Real y); Real calcLiftToUseAtPt(Object* obj, PhysicsBehavior *physics, Real curZ, Real surfaceAtPt, Real preferredHeight); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h index c4002d35628..c684a9a48ca 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/LocomotorSet.h @@ -66,7 +66,7 @@ static const char *const TheLocomotorSurfaceTypeNames[] = "AIR", "RUBBLE", - NULL + nullptr }; #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 32e562d23ab..0337ac7ed8c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -106,7 +106,7 @@ static const char *const TheLocomotorSetNames[] = "SET_SUPERSONIC", "SET_SLUGGISH", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorSetNames) == LOCOMOTORSET_COUNT + 1, "Incorrect array size"); #endif @@ -129,7 +129,7 @@ static const char *const TheAutoAcquireEnemiesNames[] = "NOTWHILEATTACKING", "ATTACK_BUILDINGS", - NULL + nullptr }; #endif @@ -305,21 +305,21 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); } // Some very specific, complex behaviors are used by more than one AIUpdate. Here are their interfaces. - virtual DozerAIInterface* getDozerAIInterface() {return NULL;} - virtual SupplyTruckAIInterface* getSupplyTruckAIInterface() {return NULL;} - virtual const DozerAIInterface* getDozerAIInterface() const {return NULL;} - virtual const SupplyTruckAIInterface* getSupplyTruckAIInterface() const {return NULL;} + virtual DozerAIInterface* getDozerAIInterface() {return nullptr;} + virtual SupplyTruckAIInterface* getSupplyTruckAIInterface() {return nullptr;} + virtual const DozerAIInterface* getDozerAIInterface() const {return nullptr;} + virtual const SupplyTruckAIInterface* getSupplyTruckAIInterface() const {return nullptr;} #ifdef ALLOW_SURRENDER - virtual POWTruckAIUpdateInterface *getPOWTruckAIUpdateInterface( void ) { return NULL; } + virtual POWTruckAIUpdateInterface *getPOWTruckAIUpdateInterface( void ) { return nullptr; } #endif - virtual WorkerAIInterface* getWorkerAIInterface( void ) { return NULL; } - virtual const WorkerAIInterface* getWorkerAIInterface( void ) const { return NULL; } - virtual HackInternetAIInterface* getHackInternetAIInterface() { return NULL; } - virtual const HackInternetAIInterface* getHackInternetAIInterface() const { return NULL; } - virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return NULL; } - virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const { return NULL; } - virtual JetAIUpdate* getJetAIUpdate() { return NULL; } - virtual const JetAIUpdate* getJetAIUpdate() const { return NULL; } + virtual WorkerAIInterface* getWorkerAIInterface( void ) { return nullptr; } + virtual const WorkerAIInterface* getWorkerAIInterface( void ) const { return nullptr; } + virtual HackInternetAIInterface* getHackInternetAIInterface() { return nullptr; } + virtual const HackInternetAIInterface* getHackInternetAIInterface() const { return nullptr; } + virtual AssaultTransportAIInterface* getAssaultTransportAIInterface() { return nullptr; } + virtual const AssaultTransportAIInterface* getAssaultTransportAIInterface() const { return nullptr; } + virtual JetAIUpdate* getJetAIUpdate() { return nullptr; } + virtual const JetAIUpdate* getJetAIUpdate() const { return nullptr; } #ifdef ALLOW_SURRENDER void setSurrendered( const Object *objWeSurrenderedTo, Bool surrendered ); @@ -365,7 +365,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface virtual Object* construct( const ThingTemplate *what, const Coord3D *pos, Real angle, Player *owningPlayer, - Bool isRebuild ) { return NULL; }///< construct a building + Bool isRebuild ) { return nullptr; }///< construct a building void ignoreObstacle( const Object *obj ); ///< tell the pathfinder to ignore the given object as an obstacle @@ -428,7 +428,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface Bool hasLocomotorForSurface(LocomotorSurfaceType surfaceType); // turret stuff. - WhichTurretType getWhichTurretForWeaponSlot(WeaponSlotType wslot, Real* turretAngle, Real* turretPitch = NULL) const; + WhichTurretType getWhichTurretForWeaponSlot(WeaponSlotType wslot, Real* turretAngle, Real* turretPitch = nullptr) const; WhichTurretType getWhichTurretForCurWeapon() const; /** return true iff the weapon is on a turret, that turret is trying to aim at the victim, @@ -470,7 +470,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface void cancelPath(void); ///< Called if we no longer need the path. Path* getPath( void ) { return m_path; } ///< return the agent's current path const Path* getPath( void ) const { return m_path; } ///< return the agent's current path - void destroyPath( void ); ///< destroy the current path, setting it to NULL + void destroyPath( void ); ///< destroy the current path, setting it to null UnsignedInt getPathAge( void ) const { return TheGameLogic->getFrame() - m_pathTimestamp; } ///< return the "age" of the path Bool isPathAvailable( const Coord3D *destination ) const; ///< does a path exist between us and the destination Bool isQuickPathAvailable( const Coord3D *destination ) const; ///< does a path (using quick pathfind) exist between us and the destination diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AnimationSteeringUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AnimationSteeringUpdate.h index 6ffc8b3060c..49f3cc8e6a8 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AnimationSteeringUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AnimationSteeringUpdate.h @@ -49,7 +49,7 @@ class AnimationSteeringUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "MinTransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof( AnimationSteeringUpdateModuleData, m_transitionFrames ) }, + { "MinTransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( AnimationSteeringUpdateModuleData, m_transitionFrames ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h index edcaf28beac..6b5f8af4400 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssaultTransportAIUpdate.h @@ -61,8 +61,8 @@ class AssaultTransportAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "MembersGetHealedAtLifeRatio", INI::parseReal, NULL, offsetof( AssaultTransportAIUpdateModuleData, m_membersGetHealedAtLifeRatio ) }, - { "ClearRangeRequiredToContinueAttackMove", INI::parseReal, NULL, offsetof( AssaultTransportAIUpdateModuleData, m_clearRangeRequiredToContinueAttackMove ) }, + { "MembersGetHealedAtLifeRatio", INI::parseReal, nullptr, offsetof( AssaultTransportAIUpdateModuleData, m_membersGetHealedAtLifeRatio ) }, + { "ClearRangeRequiredToContinueAttackMove", INI::parseReal, nullptr, offsetof( AssaultTransportAIUpdateModuleData, m_clearRangeRequiredToContinueAttackMove ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h index a70c06b9734..ad37bf5bebc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h @@ -92,11 +92,11 @@ class AutoDepositUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "DepositTiming", INI::parseDurationUnsignedInt, NULL, offsetof( AutoDepositUpdateModuleData, m_depositFrame ) }, - { "DepositAmount", INI::parseInt, NULL, offsetof( AutoDepositUpdateModuleData, m_depositAmount ) }, - { "InitialCaptureBonus", INI::parseInt, NULL, offsetof( AutoDepositUpdateModuleData, m_initialCaptureBonus ) }, - { "ActualMoney", INI::parseBool, NULL, offsetof( AutoDepositUpdateModuleData, m_isActualMoney ) }, - { "UpgradedBoost", parseUpgradePair, NULL, offsetof( AutoDepositUpdateModuleData, m_upgradeBoost ) }, + { "DepositTiming", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_depositFrame ) }, + { "DepositAmount", INI::parseInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_depositAmount ) }, + { "InitialCaptureBonus", INI::parseInt, nullptr, offsetof( AutoDepositUpdateModuleData, m_initialCaptureBonus ) }, + { "ActualMoney", INI::parseBool, nullptr, offsetof( AutoDepositUpdateModuleData, m_isActualMoney ) }, + { "UpgradedBoost", parseUpgradePair, nullptr, offsetof( AutoDepositUpdateModuleData, m_upgradeBoost ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h index 549bcd5fac6..e56dead9e50 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoHealBehavior.h @@ -70,8 +70,8 @@ class AutoHealBehaviorModuleData : public UpdateModuleData m_healingDelay = UINT_MAX; m_startHealingDelay = 0; m_radius = 0.0f; - m_radiusParticleSystemTmpl = NULL; - m_unitHealPulseParticleSystemTmpl = NULL; + m_radiusParticleSystemTmpl = nullptr; + m_unitHealPulseParticleSystemTmpl = nullptr; m_affectsWholePlayer = FALSE; m_skipSelfForHealing = FALSE; SET_ALL_KINDOFMASK_BITS( m_kindOf ); @@ -82,18 +82,18 @@ class AutoHealBehaviorModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_initiallyActive ) }, - { "SingleBurst", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_singleBurst ) }, - { "HealingAmount", INI::parseInt, NULL, offsetof( AutoHealBehaviorModuleData, m_healingAmount ) }, - { "HealingDelay", INI::parseDurationUnsignedInt, NULL, offsetof( AutoHealBehaviorModuleData, m_healingDelay ) }, - { "Radius", INI::parseReal, NULL, offsetof( AutoHealBehaviorModuleData, m_radius ) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( AutoHealBehaviorModuleData, m_kindOf ) }, - { "ForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( AutoHealBehaviorModuleData, m_forbiddenKindOf ) }, - { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( AutoHealBehaviorModuleData, m_radiusParticleSystemTmpl ) }, - { "UnitHealPulseParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( AutoHealBehaviorModuleData, m_unitHealPulseParticleSystemTmpl ) }, - { "StartHealingDelay", INI::parseDurationUnsignedInt, NULL, offsetof( AutoHealBehaviorModuleData, m_startHealingDelay ) }, - { "AffectsWholePlayer", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_affectsWholePlayer ) }, - { "SkipSelfForHealing", INI::parseBool, NULL, offsetof( AutoHealBehaviorModuleData, m_skipSelfForHealing ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_initiallyActive ) }, + { "SingleBurst", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_singleBurst ) }, + { "HealingAmount", INI::parseInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_healingAmount ) }, + { "HealingDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_healingDelay ) }, + { "Radius", INI::parseReal, nullptr, offsetof( AutoHealBehaviorModuleData, m_radius ) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( AutoHealBehaviorModuleData, m_kindOf ) }, + { "ForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( AutoHealBehaviorModuleData, m_forbiddenKindOf ) }, + { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, nullptr, offsetof( AutoHealBehaviorModuleData, m_radiusParticleSystemTmpl ) }, + { "UnitHealPulseParticleSystemName", INI::parseParticleSystemTemplate, nullptr, offsetof( AutoHealBehaviorModuleData, m_unitHealPulseParticleSystemTmpl ) }, + { "StartHealingDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoHealBehaviorModuleData, m_startHealingDelay ) }, + { "AffectsWholePlayer", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_affectsWholePlayer ) }, + { "SkipSelfForHealing", INI::parseBool, nullptr, offsetof( AutoHealBehaviorModuleData, m_skipSelfForHealing ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h index 8eeed38c7d3..5d101b7d5ad 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BattlePlanUpdate.h @@ -142,7 +142,7 @@ class BattlePlanUpdate : public SpecialPowerUpdateModule virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const { return false; } //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const { return false; } //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) {} - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; //Returns the currently active battle plan -- unpacked and ready... returns PLANSTATUS_NONE if in transition! BattlePlanStatus getActiveBattlePlan() const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h index 0290d52b508..235d3efcd66 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h @@ -153,44 +153,44 @@ class BehaviorModule : public ObjectModule, public BehaviorModuleInterface static Int getInterfaceMask() { return 0; } static ModuleType getModuleType() { return MODULETYPE_BEHAVIOR; } - virtual BodyModuleInterface* getBody() { return NULL; } - virtual CollideModuleInterface* getCollide() { return NULL; } - virtual ContainModuleInterface* getContain() { return NULL; } - virtual CreateModuleInterface* getCreate() { return NULL; } - virtual DamageModuleInterface* getDamage() { return NULL; } - virtual DestroyModuleInterface* getDestroy() { return NULL; } - virtual DieModuleInterface* getDie() { return NULL; } - virtual SpecialPowerModuleInterface* getSpecialPower() { return NULL; } - virtual UpdateModuleInterface* getUpdate() { return NULL; } - virtual UpgradeModuleInterface* getUpgrade() { return NULL; } - virtual StealthUpdate* getStealth() { return NULL; } - virtual SpyVisionUpdate* getSpyVisionUpdate() { return NULL; } - - virtual ParkingPlaceBehaviorInterface* getParkingPlaceBehaviorInterface() { return NULL; } - virtual RebuildHoleBehaviorInterface* getRebuildHoleBehaviorInterface() { return NULL; } - virtual BridgeBehaviorInterface* getBridgeBehaviorInterface() { return NULL; } - virtual BridgeTowerBehaviorInterface* getBridgeTowerBehaviorInterface() { return NULL; } - virtual BridgeScaffoldBehaviorInterface* getBridgeScaffoldBehaviorInterface() { return NULL; } - virtual OverchargeBehaviorInterface* getOverchargeBehaviorInterface() { return NULL; } - virtual TransportPassengerInterface* getTransportPassengerInterface() { return NULL; } - virtual CaveInterface* getCaveInterface() { return NULL; } - virtual LandMineInterface* getLandMineInterface() { return NULL; } - virtual DieModuleInterface* getEjectPilotDieInterface() { return NULL; } + virtual BodyModuleInterface* getBody() { return nullptr; } + virtual CollideModuleInterface* getCollide() { return nullptr; } + virtual ContainModuleInterface* getContain() { return nullptr; } + virtual CreateModuleInterface* getCreate() { return nullptr; } + virtual DamageModuleInterface* getDamage() { return nullptr; } + virtual DestroyModuleInterface* getDestroy() { return nullptr; } + virtual DieModuleInterface* getDie() { return nullptr; } + virtual SpecialPowerModuleInterface* getSpecialPower() { return nullptr; } + virtual UpdateModuleInterface* getUpdate() { return nullptr; } + virtual UpgradeModuleInterface* getUpgrade() { return nullptr; } + virtual StealthUpdate* getStealth() { return nullptr; } + virtual SpyVisionUpdate* getSpyVisionUpdate() { return nullptr; } + + virtual ParkingPlaceBehaviorInterface* getParkingPlaceBehaviorInterface() { return nullptr; } + virtual RebuildHoleBehaviorInterface* getRebuildHoleBehaviorInterface() { return nullptr; } + virtual BridgeBehaviorInterface* getBridgeBehaviorInterface() { return nullptr; } + virtual BridgeTowerBehaviorInterface* getBridgeTowerBehaviorInterface() { return nullptr; } + virtual BridgeScaffoldBehaviorInterface* getBridgeScaffoldBehaviorInterface() { return nullptr; } + virtual OverchargeBehaviorInterface* getOverchargeBehaviorInterface() { return nullptr; } + virtual TransportPassengerInterface* getTransportPassengerInterface() { return nullptr; } + virtual CaveInterface* getCaveInterface() { return nullptr; } + virtual LandMineInterface* getLandMineInterface() { return nullptr; } + virtual DieModuleInterface* getEjectPilotDieInterface() { return nullptr; } // interface acquisition (moved from UpdateModule) - virtual ProjectileUpdateInterface* getProjectileUpdateInterface() { return NULL; } - virtual AIUpdateInterface* getAIUpdateInterface() { return NULL; } - virtual ExitInterface* getUpdateExitInterface() { return NULL; } - virtual DockUpdateInterface* getDockUpdateInterface() { return NULL; } - virtual RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface( void ) { return NULL; } - virtual SlowDeathBehaviorInterface* getSlowDeathBehaviorInterface() { return NULL; } - virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return NULL; } - virtual SlavedUpdateInterface* getSlavedUpdateInterface() { return NULL; } - virtual ProductionUpdateInterface* getProductionUpdateInterface() { return NULL; } - virtual HordeUpdateInterface* getHordeUpdateInterface() { return NULL; } - virtual PowerPlantUpdateInterface* getPowerPlantUpdateInterface() { return NULL; } - virtual SpawnBehaviorInterface* getSpawnBehaviorInterface() { return NULL; } - virtual CountermeasuresBehaviorInterface* getCountermeasuresBehaviorInterface() { return NULL; } - virtual const CountermeasuresBehaviorInterface* getCountermeasuresBehaviorInterface() const { return NULL; } + virtual ProjectileUpdateInterface* getProjectileUpdateInterface() { return nullptr; } + virtual AIUpdateInterface* getAIUpdateInterface() { return nullptr; } + virtual ExitInterface* getUpdateExitInterface() { return nullptr; } + virtual DockUpdateInterface* getDockUpdateInterface() { return nullptr; } + virtual RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface( void ) { return nullptr; } + virtual SlowDeathBehaviorInterface* getSlowDeathBehaviorInterface() { return nullptr; } + virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return nullptr; } + virtual SlavedUpdateInterface* getSlavedUpdateInterface() { return nullptr; } + virtual ProductionUpdateInterface* getProductionUpdateInterface() { return nullptr; } + virtual HordeUpdateInterface* getHordeUpdateInterface() { return nullptr; } + virtual PowerPlantUpdateInterface* getPowerPlantUpdateInterface() { return nullptr; } + virtual SpawnBehaviorInterface* getSpawnBehaviorInterface() { return nullptr; } + virtual CountermeasuresBehaviorInterface* getCountermeasuresBehaviorInterface() { return nullptr; } + virtual const CountermeasuresBehaviorInterface* getCountermeasuresBehaviorInterface() const { return nullptr; } protected: @@ -252,7 +252,7 @@ class ParkingPlaceBehaviorInterface virtual void setHealee(Object* healee, Bool add) = 0; virtual void killAllParkedUnits() = 0; virtual void defectAllParkedUnits(Team* newTeam, UnsignedInt detectionTime) = 0; - virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = NULL, Int *newIndex = NULL ) = 0; + virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = nullptr, Int *newIndex = nullptr ) = 0; virtual const std::vector* getTaxiLocations( ObjectID id ) const = 0; virtual const std::vector* getCreationLocations( ObjectID id ) const = 0; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 2e9e792cff7..c39d7cf06a1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -65,7 +65,7 @@ static const char* const TheBodyDamageTypeNames[] = "REALLYDAMAGED", "RUBBLE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheBodyDamageTypeNames) == BODYDAMAGETYPE_COUNT + 1, "Incorrect array size"); #endif @@ -87,7 +87,7 @@ static const char* const TheMaxHealthChangeTypeNames[] = "PRESERVE_RATIO", "ADD_CURRENT_HEALTH_TOO", "FULLY_HEAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheMaxHealthChangeTypeNames) == MAX_HEALTH_CHANGE_COUNT + 1, "Incorrect array size"); #endif @@ -261,7 +261,7 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface virtual void clearArmorSetFlag(ArmorSetType ast) = 0; virtual Bool testArmorSetFlag(ArmorSetType ast) = 0; - virtual const DamageInfo *getLastDamageInfo() const { return NULL; } ///< return info on last damage dealt to this object + virtual const DamageInfo *getLastDamageInfo() const { return nullptr; } ///< return info on last damage dealt to this object virtual UnsignedInt getLastDamageTimestamp() const { return 0; } ///< return frame of last damage dealt virtual UnsignedInt getLastHealingTimestamp() const { return 0; } ///< return frame of last healing dealt virtual ObjectID getClearableLastAttacker() const { return INVALID_ID; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h index 8aea6769866..8db256dc9e9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BoneFXUpdate.h @@ -103,108 +103,108 @@ class BoneFXUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "DamageFXTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageFXTypes ) }, - { "DamageOCLTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageOCLTypes ) }, - { "DamageParticleTypes", INI::parseDamageTypeFlags, NULL, offsetof( BoneFXUpdateModuleData, m_damageParticleTypes ) }, - - { "PristineFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleFXList1", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleFXList2", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleFXList3", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleFXList4", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleFXList5", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleFXList6", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleFXList7", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleFXList8", BoneFXUpdateModuleData::parseFXList, NULL, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 7 ] ) }, - - { "PristineOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleOCL1", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleOCL2", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleOCL3", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleOCL4", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleOCL5", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleOCL6", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleOCL7", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleOCL8", BoneFXUpdateModuleData::parseObjectCreationList, NULL, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 7 ] ) }, - - { "PristineParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 0 ] ) }, - { "PristineParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 1 ] ) }, - { "PristineParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 2 ] ) }, - { "PristineParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 3 ] ) }, - { "PristineParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 4 ] ) }, - { "PristineParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 5 ] ) }, - { "PristineParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 6 ] ) }, - { "PristineParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 7 ] ) }, - { "DamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 0 ] ) }, - { "DamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 1 ] ) }, - { "DamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 2 ] ) }, - { "DamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 3 ] ) }, - { "DamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 4 ] ) }, - { "DamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 5 ] ) }, - { "DamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 6 ] ) }, - { "DamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 7 ] ) }, - { "ReallyDamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 0 ] ) }, - { "ReallyDamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 1 ] ) }, - { "ReallyDamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 2 ] ) }, - { "ReallyDamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 3 ] ) }, - { "ReallyDamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 4 ] ) }, - { "ReallyDamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 5 ] ) }, - { "ReallyDamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 6 ] ) }, - { "ReallyDamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 7 ] ) }, - { "RubbleParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 0 ] ) }, - { "RubbleParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 1 ] ) }, - { "RubbleParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 2 ] ) }, - { "RubbleParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 3 ] ) }, - { "RubbleParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 4 ] ) }, - { "RubbleParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 5 ] ) }, - { "RubbleParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 6 ] ) }, - { "RubbleParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, NULL, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 7 ] ) }, + { "DamageFXTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageFXTypes ) }, + { "DamageOCLTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageOCLTypes ) }, + { "DamageParticleTypes", INI::parseDamageTypeFlags, nullptr, offsetof( BoneFXUpdateModuleData, m_damageParticleTypes ) }, + + { "PristineFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleFXList1", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleFXList2", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleFXList3", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleFXList4", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleFXList5", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleFXList6", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleFXList7", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleFXList8", BoneFXUpdateModuleData::parseFXList, nullptr, offsetof( BoneFXUpdateModuleData, m_fxList[ BODY_RUBBLE ][ 7 ] ) }, + + { "PristineOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleOCL1", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleOCL2", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleOCL3", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleOCL4", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleOCL5", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleOCL6", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleOCL7", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleOCL8", BoneFXUpdateModuleData::parseObjectCreationList, nullptr, offsetof( BoneFXUpdateModuleData, m_OCL[ BODY_RUBBLE ][ 7 ] ) }, + + { "PristineParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 0 ] ) }, + { "PristineParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 1 ] ) }, + { "PristineParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 2 ] ) }, + { "PristineParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 3 ] ) }, + { "PristineParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 4 ] ) }, + { "PristineParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 5 ] ) }, + { "PristineParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 6 ] ) }, + { "PristineParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_PRISTINE ][ 7 ] ) }, + { "DamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 0 ] ) }, + { "DamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 1 ] ) }, + { "DamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 2 ] ) }, + { "DamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 3 ] ) }, + { "DamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 4 ] ) }, + { "DamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 5 ] ) }, + { "DamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 6 ] ) }, + { "DamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_DAMAGED ][ 7 ] ) }, + { "ReallyDamagedParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 0 ] ) }, + { "ReallyDamagedParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 1 ] ) }, + { "ReallyDamagedParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 2 ] ) }, + { "ReallyDamagedParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 3 ] ) }, + { "ReallyDamagedParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 4 ] ) }, + { "ReallyDamagedParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 5 ] ) }, + { "ReallyDamagedParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 6 ] ) }, + { "ReallyDamagedParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_REALLYDAMAGED ][ 7 ] ) }, + { "RubbleParticleSystem1", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 0 ] ) }, + { "RubbleParticleSystem2", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 1 ] ) }, + { "RubbleParticleSystem3", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 2 ] ) }, + { "RubbleParticleSystem4", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 3 ] ) }, + { "RubbleParticleSystem5", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 4 ] ) }, + { "RubbleParticleSystem6", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 5 ] ) }, + { "RubbleParticleSystem7", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 6 ] ) }, + { "RubbleParticleSystem8", BoneFXUpdateModuleData::parseParticleSystem, nullptr, offsetof( BoneFXUpdateModuleData, m_particleSystem[ BODY_RUBBLE ][ 7 ] ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CaveContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CaveContain.h index fca16c556a7..030749a5429 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CaveContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CaveContain.h @@ -55,7 +55,7 @@ class CaveContainModuleData : public OpenContainModuleData static const FieldParse dataFieldParse[] = { - { "CaveIndex", INI::parseInt, NULL, offsetof( CaveContainModuleData, m_caveIndexData ) }, + { "CaveIndex", INI::parseInt, nullptr, offsetof( CaveContainModuleData, m_caveIndexData ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h index 4c3bb82e42c..5021f09655d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CheckpointUpdate.h @@ -54,7 +54,7 @@ class CheckpointUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ScanDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( CheckpointUpdateModuleData, m_enemyScanDelayTime ) }, + { "ScanDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( CheckpointUpdateModuleData, m_enemyScanDelayTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h index 3394bee8860..9ce9008c5c5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h @@ -35,7 +35,7 @@ //------------------------------------------------------------------------------------------------- /** OBJECT COLLIDE MODULE - Called when two objects collide (or when object collides with ground) - - Note in the 'collide' method that 'other' can be NULL, this indicates a + - Note in the 'collide' method that 'other' can be null, this indicates a collision with the ground - Also note the 'collide' method is the response for the object that THIS module belongs to, we do not need to worry about the collision moudle of 'other', diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h index c748c8ec301..922a4a9bdcc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h @@ -48,7 +48,7 @@ class ConvertToCarBombCrateCollideModuleData : public CrateCollideModuleData ConvertToCarBombCrateCollideModuleData() { m_rangeOfEffect = 0; - m_fxList = NULL; + m_fxList = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -57,7 +57,7 @@ class ConvertToCarBombCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "FXList", INI::parseFXList, NULL, offsetof( ConvertToCarBombCrateCollideModuleData, m_fxList ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( ConvertToCarBombCrateCollideModuleData, m_fxList ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h index c4ed34504ae..d49252ecdc7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h @@ -76,18 +76,18 @@ class CountermeasuresBehaviorModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "FlareTemplateName", INI::parseAsciiString, NULL, offsetof( CountermeasuresBehaviorModuleData, m_flareTemplateName ) }, - { "FlareBoneBaseName", INI::parseAsciiString, NULL, offsetof( CountermeasuresBehaviorModuleData, m_flareBoneBaseName ) }, - { "VolleySize", INI::parseUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_volleySize ) }, - { "VolleyArcAngle", INI::parseAngleReal, NULL, offsetof( CountermeasuresBehaviorModuleData, m_volleyArcAngle ) }, - { "VolleyVelocityFactor", INI::parseReal, NULL, offsetof( CountermeasuresBehaviorModuleData, m_volleyVelocityFactor ) }, - { "DelayBetweenVolleys", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_framesBetweenVolleys ) }, - { "NumberOfVolleys", INI::parseUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_numberOfVolleys ) }, - { "ReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_reloadFrames ) }, - { "EvasionRate", INI::parsePercentToReal, NULL, offsetof( CountermeasuresBehaviorModuleData, m_evasionRate ) }, - { "MustReloadAtAirfield", INI::parseBool, NULL, offsetof( CountermeasuresBehaviorModuleData, m_mustReloadAtAirfield ) }, - { "MissileDecoyDelay", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_missileDecoyFrames ) }, - { "ReactionLaunchLatency", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_countermeasureReactionFrames ) }, + { "FlareTemplateName", INI::parseAsciiString, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_flareTemplateName ) }, + { "FlareBoneBaseName", INI::parseAsciiString, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_flareBoneBaseName ) }, + { "VolleySize", INI::parseUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_volleySize ) }, + { "VolleyArcAngle", INI::parseAngleReal, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_volleyArcAngle ) }, + { "VolleyVelocityFactor", INI::parseReal, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_volleyVelocityFactor ) }, + { "DelayBetweenVolleys", INI::parseDurationUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_framesBetweenVolleys ) }, + { "NumberOfVolleys", INI::parseUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_numberOfVolleys ) }, + { "ReloadTime", INI::parseDurationUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_reloadFrames ) }, + { "EvasionRate", INI::parsePercentToReal, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_evasionRate ) }, + { "MustReloadAtAirfield", INI::parseBool, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_mustReloadAtAirfield ) }, + { "MissileDecoyDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_missileDecoyFrames ) }, + { "ReactionLaunchLatency", INI::parseDurationUnsignedInt, nullptr, offsetof( CountermeasuresBehaviorModuleData, m_countermeasureReactionFrames ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h index a5c9f2e21de..eb476ab5895 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CreateCrateDie.h @@ -59,7 +59,7 @@ class CreateCrateDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "CrateData", CreateCrateDieModuleData::parseCrateData, NULL, NULL }, + { "CrateData", CreateCrateDieModuleData::parseCrateData, nullptr, 0 }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrushDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrushDie.h index c18289db5b3..457d5ae6dfd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrushDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrushDie.h @@ -70,12 +70,12 @@ class CrushDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "TotalCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[TOTAL_CRUSH] ) }, - { "BackEndCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[BACK_END_CRUSH] ) }, - { "FrontEndCrushSound", INI::parseAudioEventRTS, NULL, offsetof( CrushDieModuleData, m_crushSounds[FRONT_END_CRUSH] ) }, - { "TotalCrushSoundPercent", INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[TOTAL_CRUSH] ) }, - { "BackEndCrushSoundPercent", INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[BACK_END_CRUSH] ) }, - { "FrontEndCrushSoundPercent",INI::parseInt, NULL, offsetof( CrushDieModuleData, m_crushSoundPercent[FRONT_END_CRUSH] ) }, + { "TotalCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[TOTAL_CRUSH] ) }, + { "BackEndCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[BACK_END_CRUSH] ) }, + { "FrontEndCrushSound", INI::parseAudioEventRTS, nullptr, offsetof( CrushDieModuleData, m_crushSounds[FRONT_END_CRUSH] ) }, + { "TotalCrushSoundPercent", INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[TOTAL_CRUSH] ) }, + { "BackEndCrushSoundPercent", INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[BACK_END_CRUSH] ) }, + { "FrontEndCrushSoundPercent",INI::parseInt, nullptr, offsetof( CrushDieModuleData, m_crushSoundPercent[FRONT_END_CRUSH] ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamageModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamageModule.h index 6555522a816..be732c89ed7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamageModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamageModule.h @@ -70,7 +70,7 @@ class DamageModuleData : public BehaviorModuleData static const FieldParse dataFieldParse[] = { -// { "DamageTypes", INI::parseDamageTypeFlags, NULL, offsetof( DamageModuleData, m_damageTypes ) }, +// { "DamageTypes", INI::parseDamageTypeFlags, nullptr, offsetof( DamageModuleData, m_damageTypes ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h index 4d2aea2d39f..f79f4097d4d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DefaultProductionExitUpdate.h @@ -56,9 +56,9 @@ class DefaultProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "UnitCreatePoint", INI::parseCoord3D, NULL, offsetof( DefaultProductionExitUpdateModuleData, m_unitCreatePoint ) }, - { "NaturalRallyPoint", INI::parseCoord3D, NULL, offsetof( DefaultProductionExitUpdateModuleData, m_naturalRallyPoint ) }, - { "UseSpawnRallyPoint", INI::parseBool, NULL, offsetof( DefaultProductionExitUpdateModuleData, m_useSpawnRallyPoint ) }, + { "UnitCreatePoint", INI::parseCoord3D, nullptr, offsetof( DefaultProductionExitUpdateModuleData, m_unitCreatePoint ) }, + { "NaturalRallyPoint", INI::parseCoord3D, nullptr, offsetof( DefaultProductionExitUpdateModuleData, m_naturalRallyPoint ) }, + { "UseSpawnRallyPoint", INI::parseBool, nullptr, offsetof( DefaultProductionExitUpdateModuleData, m_useSpawnRallyPoint ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -113,7 +113,7 @@ inline const Coord3D *DefaultProductionExitUpdate::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h index 436feb28d70..58ccdb84087 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeletionUpdate.h @@ -50,8 +50,8 @@ class DeletionUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( DeletionUpdateModuleData, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( DeletionUpdateModuleData, m_maxFrames ) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeletionUpdateModuleData, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeletionUpdateModuleData, m_maxFrames ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h index 84e64d9f047..f028aabe93a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h @@ -218,15 +218,15 @@ class DeliverPayloadAIUpdateModuleData : public AIUpdateModuleData //DO NOT ADD DATA HERE UNLESS YOU ARE SUPPORTING SCRIPTED TEAM REINFORCEMENT DELIVERY //THESE DATA VALUES ARE SPECIFIED ONLY BY FACTIONUNIT.INI //*********************************************************************************** - { "DoorDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_doorDelay ) }, - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_putInContainerName ) }, - { "DeliveryDistance", INI::parseReal, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_maxDistanceToTarget ) }, - { "MaxAttempts", INI::parseInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_maxNumberAttempts ) }, - { "DropDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropDelay ) }, - { "DropOffset", INI::parseCoord3D, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropOffset ) }, - { "DropVariance", INI::parseCoord3D, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_dropVariance ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalRadius ) }, + { "DoorDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_doorDelay ) }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_putInContainerName ) }, + { "DeliveryDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_maxDistanceToTarget ) }, + { "MaxAttempts", INI::parseInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_maxNumberAttempts ) }, + { "DropDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropDelay ) }, + { "DropOffset", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropOffset ) }, + { "DropVariance", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_dropVariance ) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( DeliverPayloadAIUpdateModuleData, m_deliveryDecalRadius ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -286,9 +286,9 @@ class DeliverPayloadData m_inheritTransportVelocity = false; m_isParachuteDirectly = FALSE; m_exitPitchRate = 0.0f; - m_strafeFX = NULL; + m_strafeFX = nullptr; m_strafeLength = 0.0f; - m_visiblePayloadWeaponTemplate = NULL; + m_visiblePayloadWeaponTemplate = nullptr; m_selfDestructObject = FALSE; m_deliveryDecalRadius = 0; m_visibleDropBoneName.clear(); @@ -316,7 +316,7 @@ class DeliverPayloadAIUpdate : public AIUpdateInterface const Coord3D* getTargetPos() const { return &m_targetPos; } const Coord3D* getMoveToPos() const { return &m_moveToPos; } UnsignedInt getDoorDelay() const { return getDeliverPayloadAIUpdateModuleData()->m_doorDelay; } - Bool isDeliveringPayload() const { return m_deliverPayloadStateMachine != NULL; } + Bool isDeliveringPayload() const { return m_deliverPayloadStateMachine != nullptr; } const ThingTemplate* getPutInContainerTemplateViaModuleData() const; Real getAllowedDistanceToTarget() const { return m_data.m_distToTarget; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h index d50fc085f10..c8ad16ae630 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeployStyleAIUpdate.h @@ -69,12 +69,12 @@ class DeployStyleAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( DeployStyleAIUpdateModuleData, m_unpackTime ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( DeployStyleAIUpdateModuleData, m_packTime ) }, - { "ResetTurretBeforePacking", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_resetTurretBeforePacking ) }, - { "TurretsFunctionOnlyWhenDeployed", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_turretsFunctionOnlyWhenDeployed ) }, - { "TurretsMustCenterBeforePacking", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_turretsMustCenterBeforePacking ) }, - { "ManualDeployAnimations", INI::parseBool, NULL, offsetof( DeployStyleAIUpdateModuleData, m_manualDeployAnimations ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_unpackTime ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_packTime ) }, + { "ResetTurretBeforePacking", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_resetTurretBeforePacking ) }, + { "TurretsFunctionOnlyWhenDeployed", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_turretsFunctionOnlyWhenDeployed ) }, + { "TurretsMustCenterBeforePacking", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_turretsMustCenterBeforePacking ) }, + { "ManualDeployAnimations", INI::parseBool, nullptr, offsetof( DeployStyleAIUpdateModuleData, m_manualDeployAnimations ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h index 92695de6c55..2d4b9619e05 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DockUpdate.h @@ -75,7 +75,7 @@ class DockUpdate : public UpdateModule , public DockUpdateInterface virtual Bool isClearToApproach( Object const* docker ) const; /** Give me a Queue point to drive to, and record that that point is taken. - Returning NULL means there are none free + Returning null means there are none free */ virtual Bool reserveApproachPosition( Object* docker, Coord3D *position, Int *index ); @@ -95,7 +95,7 @@ class DockUpdate : public UpdateModule , public DockUpdateInterface virtual Bool isClearToAdvance( Object const* docker, Int dockerIndex ) const; /** Give me the point that is the start of your docking path - Returning NULL means there is none free + Returning null means there is none free All functions take docker as arg so we could have multiple docks on a building. Docker is not assumed, it is recorded and checked. */ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index 2d5d4bd3991..fd1b97ba629 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -146,7 +146,7 @@ class DozerAIInterface virtual void internalCancelTask( DozerTask task ) = 0; ///< cancel this task from the dozer virtual void internalTaskCompleteOrCancelled( DozerTask task ) = 0; ///< this is called when tasks are cancelled or completed - /** return a dock point for the action and task (if valid) ... note it can return NULL + /** return a dock point for the action and task (if valid) ... note it can return nullptr if no point has been set for the combination of task and point */ virtual const Coord3D* getDockPoint( DozerTask task, DozerDockPoint point ) = 0; @@ -245,7 +245,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface virtual void internalCancelTask( DozerTask task ); ///< cancel this task from the dozer virtual void internalTaskCompleteOrCancelled( DozerTask task ); ///< this is called when tasks are cancelled or completed - /** return a dock point for the action and task (if valid) ... note it can return NULL + /** return a dock point for the action and task (if valid) ... note it can return nullptr if no point has been set for the combination of task and point */ virtual const Coord3D* getDockPoint( DozerTask task, DozerDockPoint point ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h index 9e6712b5089..5a78d581b82 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h @@ -68,7 +68,7 @@ class EMPUpdateModuleData : public UpdateModuleData m_endColor.setFromInt (0x00000000); //m_spinRateMax = 0.0f; m_disabledDuration = 0; - m_disableFXParticleSystem = NULL; + m_disableFXParticleSystem = nullptr; m_sparksPerCubicFoot = 0.001f; m_effectRadius = 200; m_rejectMask = 0; @@ -83,23 +83,23 @@ class EMPUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "Lifetime", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_lifeFrames ) }, - { "StartFadeTime", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_startFadeFrame ) }, - { "StartScale", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_startScale ) }, - { "DisabledDuration", INI::parseDurationUnsignedInt, NULL, offsetof( EMPUpdateModuleData, m_disabledDuration ) }, - //{ "SpinRateMax", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_spinRateMax ) }, - { "TargetScaleMax", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_targetScaleMax ) }, - { "TargetScaleMin", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_targetScaleMin ) }, - { "StartColor", INI::parseRGBColor, NULL, offsetof( EMPUpdateModuleData, m_startColor ) }, - { "EndColor", INI::parseRGBColor, NULL, offsetof( EMPUpdateModuleData, m_endColor ) }, - { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( EMPUpdateModuleData, m_disableFXParticleSystem ) }, - { "SparksPerCubicFoot", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_sparksPerCubicFoot ) }, - { "EffectRadius", INI::parseReal, NULL, offsetof( EMPUpdateModuleData, m_effectRadius ) }, + { "Lifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_lifeFrames ) }, + { "StartFadeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_startFadeFrame ) }, + { "StartScale", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_startScale ) }, + { "DisabledDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( EMPUpdateModuleData, m_disabledDuration ) }, + //{ "SpinRateMax", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_spinRateMax ) }, + { "TargetScaleMax", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_targetScaleMax ) }, + { "TargetScaleMin", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_targetScaleMin ) }, + { "StartColor", INI::parseRGBColor, nullptr, offsetof( EMPUpdateModuleData, m_startColor ) }, + { "EndColor", INI::parseRGBColor, nullptr, offsetof( EMPUpdateModuleData, m_endColor ) }, + { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( EMPUpdateModuleData, m_disableFXParticleSystem ) }, + { "SparksPerCubicFoot", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_sparksPerCubicFoot ) }, + { "EffectRadius", INI::parseReal, nullptr, offsetof( EMPUpdateModuleData, m_effectRadius ) }, { "DoesNotAffect", INI::parseBitString32, TheWeaponAffectsMaskNames, offsetof(EMPUpdateModuleData, m_rejectMask) }, - { "DoesNotAffectMyOwnBuildings", INI::parseBool, NULL, offsetof( EMPUpdateModuleData, m_doesNotAffectMyOwnBuildings ) }, + { "DoesNotAffectMyOwnBuildings", INI::parseBool, nullptr, offsetof( EMPUpdateModuleData, m_doesNotAffectMyOwnBuildings ) }, - { "VictimRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( EMPUpdateModuleData, m_victimKindOf ) }, - { "VictimForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( EMPUpdateModuleData, m_victimKindOfNot ) }, + { "VictimRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( EMPUpdateModuleData, m_victimKindOf ) }, + { "VictimForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( EMPUpdateModuleData, m_victimKindOfNot ) }, { 0, 0, 0, 0 } }; @@ -166,7 +166,7 @@ class LeafletDropBehaviorModuleData : public UpdateModuleData m_delayFrames = 1; m_disabledDuration = 0; m_radius = 60.0f; - m_leafletFXParticleSystem = NULL; + m_leafletFXParticleSystem = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -174,10 +174,10 @@ class LeafletDropBehaviorModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "Delay", INI::parseDurationUnsignedInt, NULL, offsetof( LeafletDropBehaviorModuleData, m_delayFrames ) }, - { "DisabledDuration", INI::parseDurationUnsignedInt, NULL, offsetof( LeafletDropBehaviorModuleData, m_disabledDuration ) }, - { "AffectRadius", INI::parseReal, NULL, offsetof( LeafletDropBehaviorModuleData, m_radius ) }, - { "LeafletFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( LeafletDropBehaviorModuleData, m_leafletFXParticleSystem ) }, + { "Delay", INI::parseDurationUnsignedInt, nullptr, offsetof( LeafletDropBehaviorModuleData, m_delayFrames ) }, + { "DisabledDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( LeafletDropBehaviorModuleData, m_disabledDuration ) }, + { "AffectRadius", INI::parseReal, nullptr, offsetof( LeafletDropBehaviorModuleData, m_radius ) }, + { "LeafletFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( LeafletDropBehaviorModuleData, m_leafletFXParticleSystem ) }, diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h index 3929983db08..c6d0d056b1f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EnemyNearUpdate.h @@ -50,7 +50,7 @@ class EnemyNearUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "ScanDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( EnemyNearUpdateModuleData, m_enemyScanDelayTime ) }, + { "ScanDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( EnemyNearUpdateModuleData, m_enemyScanDelayTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h index 20533a7b503..ec82e7db403 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h @@ -51,7 +51,7 @@ class FXListDieModuleData : public DieModuleData FXListDieModuleData() { - m_defaultDeathFX = NULL; + m_defaultDeathFX = nullptr; m_orientToObject = TRUE; m_initiallyActive = TRUE; //Patch 1.02 -- Craptacular HACK -- should default to FALSE but only ONE case sets it false out of 847! } @@ -62,9 +62,9 @@ class FXListDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( FXListDieModuleData, m_initiallyActive ) }, - { "DeathFX", INI::parseFXList, NULL, offsetof( FXListDieModuleData, m_defaultDeathFX ) }, - { "OrientToObject", INI::parseBool, NULL, offsetof( FXListDieModuleData, m_orientToObject ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( FXListDieModuleData, m_initiallyActive ) }, + { "DeathFX", INI::parseFXList, nullptr, offsetof( FXListDieModuleData, m_defaultDeathFX ) }, + { "OrientToObject", INI::parseBool, nullptr, offsetof( FXListDieModuleData, m_orientToObject ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h index 5d1f6fb04a7..fce140d0690 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h @@ -47,7 +47,7 @@ class FireWeaponCollideModuleData : public CollideModuleData FireWeaponCollideModuleData() { - m_collideWeaponTemplate = NULL; + m_collideWeaponTemplate = nullptr; m_fireOnce = FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h index e675e82a2cb..076de50a23f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h @@ -56,14 +56,14 @@ class FireWeaponWhenDamagedBehaviorModuleData : public UpdateModuleData FireWeaponWhenDamagedBehaviorModuleData() { m_initiallyActive = false; - m_reactionWeaponPristine = NULL; - m_reactionWeaponDamaged = NULL; - m_reactionWeaponReallyDamaged = NULL; - m_reactionWeaponRubble = NULL; - m_continuousWeaponPristine = NULL; - m_continuousWeaponDamaged = NULL; - m_continuousWeaponReallyDamaged = NULL; - m_continuousWeaponRubble = NULL; + m_reactionWeaponPristine = nullptr; + m_reactionWeaponDamaged = nullptr; + m_reactionWeaponReallyDamaged = nullptr; + m_reactionWeaponRubble = nullptr; + m_continuousWeaponPristine = nullptr; + m_continuousWeaponDamaged = nullptr; + m_continuousWeaponReallyDamaged = nullptr; + m_continuousWeaponRubble = nullptr; m_damageTypes = DAMAGE_TYPE_FLAGS_ALL; m_damageAmount = 0; } @@ -73,17 +73,17 @@ class FireWeaponWhenDamagedBehaviorModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_initiallyActive ) }, - { "ReactionWeaponPristine", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponPristine) }, - { "ReactionWeaponDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponDamaged) }, - { "ReactionWeaponReallyDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponReallyDamaged) }, - { "ReactionWeaponRubble", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponRubble) }, - { "ContinuousWeaponPristine", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponPristine) }, - { "ContinuousWeaponDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponDamaged) }, - { "ContinuousWeaponReallyDamaged", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData,m_continuousWeaponReallyDamaged) }, - { "ContinuousWeaponRubble", INI::parseWeaponTemplate, NULL, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponRubble) }, - { "DamageTypes", INI::parseDamageTypeFlags, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageTypes ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageAmount ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_initiallyActive ) }, + { "ReactionWeaponPristine", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponPristine) }, + { "ReactionWeaponDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponDamaged) }, + { "ReactionWeaponReallyDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponReallyDamaged) }, + { "ReactionWeaponRubble", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_reactionWeaponRubble) }, + { "ContinuousWeaponPristine", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponPristine) }, + { "ContinuousWeaponDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponDamaged) }, + { "ContinuousWeaponReallyDamaged", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData,m_continuousWeaponReallyDamaged) }, + { "ContinuousWeaponRubble", INI::parseWeaponTemplate, nullptr, offsetof(FireWeaponWhenDamagedBehaviorModuleData, m_continuousWeaponRubble) }, + { "DamageTypes", INI::parseDamageTypeFlags, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageTypes ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( FireWeaponWhenDamagedBehaviorModuleData, m_damageAmount ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h index 5c666599d54..1467788d208 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h @@ -48,15 +48,15 @@ class FireWeaponWhenDeadBehaviorModuleData : public BehaviorModuleData FireWeaponWhenDeadBehaviorModuleData() { m_initiallyActive = false; - m_deathWeapon = NULL; + m_deathWeapon = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) { static const FieldParse dataFieldParse[] = { - { "StartsActive", INI::parseBool, NULL, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_initiallyActive ) }, - { "DeathWeapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_deathWeapon ) }, + { "StartsActive", INI::parseBool, nullptr, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_initiallyActive ) }, + { "DeathWeapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponWhenDeadBehaviorModuleData, m_deathWeapon ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h index 650166809a1..20bc95c7a68 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlightDeckBehavior.h @@ -49,7 +49,7 @@ struct RunwayDefinition { RunwayDefinition() { - m_catapultParticleSystem = NULL; + m_catapultParticleSystem = nullptr; } std::vector m_spacesBoneNames; @@ -118,7 +118,7 @@ class FlightDeckBehavior : public AIUpdateInterface, virtual Bool getExitPosition( Coord3D& rallyPoint ) const { return FALSE; } virtual Bool getNaturalRallyPoint( Coord3D& rallyPoint, Bool offset = TRUE ) { return FALSE; } virtual void setRallyPoint( const Coord3D *pos ) {} - virtual const Coord3D *getRallyPoint( void ) const { return NULL;} + virtual const Coord3D *getRallyPoint( void ) const { return nullptr;} // UpdateModule virtual UpdateSleepTime update(); @@ -145,7 +145,7 @@ class FlightDeckBehavior : public AIUpdateInterface, virtual void setHealee(Object* healee, Bool add); virtual void killAllParkedUnits(); virtual void defectAllParkedUnits(Team* newTeam, UnsignedInt detectionTime); - virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = NULL, Int *newIndex = NULL ); + virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = nullptr, Int *newIndex = nullptr ); // AIUpdateInterface virtual void aiDoCommand(const AICommandParms* parms); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index b8c78b631af..bccf952d2c0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -65,12 +65,12 @@ class GarrisonContainModuleData : public OpenContainModuleData static const FieldParse dataFieldParse[] = { - { "MobileGarrison", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_mobileGarrison ) }, - { "HealObjects", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_doIHealObjects ) }, - { "TimeForFullHeal", INI::parseDurationReal, NULL, offsetof( GarrisonContainModuleData, m_framesForFullHeal ) }, - { "InitialRoster", parseInitialRoster, NULL, 0 }, - { "ImmuneToClearBuildingAttacks", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_immuneToClearBuildingAttacks ) }, - { "IsEnclosingContainer", INI::parseBool, NULL, offsetof( GarrisonContainModuleData, m_isEnclosingContainer ) }, + { "MobileGarrison", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_mobileGarrison ) }, + { "HealObjects", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_doIHealObjects ) }, + { "TimeForFullHeal", INI::parseDurationReal, nullptr, offsetof( GarrisonContainModuleData, m_framesForFullHeal ) }, + { "InitialRoster", parseInitialRoster, nullptr, 0 }, + { "ImmuneToClearBuildingAttacks", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_immuneToClearBuildingAttacks ) }, + { "IsEnclosingContainer", INI::parseBool, nullptr, offsetof( GarrisonContainModuleData, m_isEnclosingContainer ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h index ed0491c3c72..d7863c4756f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h @@ -58,7 +58,7 @@ class GrantStealthBehaviorModuleData : public UpdateModuleData m_finalRadius = 200.0f; m_startRadius = 0.0f; m_radiusGrowRate = 10.0f; - m_radiusParticleSystemTmpl = NULL; + m_radiusParticleSystemTmpl = nullptr; SET_ALL_KINDOFMASK_BITS( m_kindOf ); } @@ -68,11 +68,11 @@ class GrantStealthBehaviorModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "StartRadius", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_startRadius ) }, - { "FinalRadius", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_finalRadius ) }, - { "RadiusGrowRate", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_radiusGrowRate ) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( GrantStealthBehaviorModuleData, m_kindOf ) }, - { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( GrantStealthBehaviorModuleData, m_radiusParticleSystemTmpl ) }, + { "StartRadius", INI::parseReal, nullptr, offsetof( GrantStealthBehaviorModuleData, m_startRadius ) }, + { "FinalRadius", INI::parseReal, nullptr, offsetof( GrantStealthBehaviorModuleData, m_finalRadius ) }, + { "RadiusGrowRate", INI::parseReal, nullptr, offsetof( GrantStealthBehaviorModuleData, m_radiusGrowRate ) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( GrantStealthBehaviorModuleData, m_kindOf ) }, + { "RadiusParticleSystemName", INI::parseParticleSystemTemplate, nullptr, offsetof( GrantStealthBehaviorModuleData, m_radiusParticleSystemTmpl ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h index 48c3f44b91c..1ee56d85707 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h @@ -153,16 +153,16 @@ class HackInternetAIUpdateModuleData : public AIUpdateModuleData static const FieldParse dataFieldParse[] = { - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_unpackTime ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_packTime ) }, - { "PackUnpackVariationFactor", INI::parseReal, NULL, offsetof( HackInternetAIUpdateModuleData, m_packUnpackVariationFactor ) }, - { "CashUpdateDelay", INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelay ) }, - { "CashUpdateDelayFast",INI::parseDurationUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelayFast ) }, - { "RegularCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_regularCashAmount ) }, - { "VeteranCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_veteranCashAmount ) }, - { "EliteCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_eliteCashAmount ) }, - { "HeroicCashAmount", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_heroicCashAmount ) }, - { "XpPerCashUpdate", INI::parseUnsignedInt, NULL, offsetof( HackInternetAIUpdateModuleData, m_xpPerCashUpdate ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_unpackTime ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_packTime ) }, + { "PackUnpackVariationFactor", INI::parseReal, nullptr, offsetof( HackInternetAIUpdateModuleData, m_packUnpackVariationFactor ) }, + { "CashUpdateDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelay ) }, + { "CashUpdateDelayFast",INI::parseDurationUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_cashUpdateDelayFast ) }, + { "RegularCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_regularCashAmount ) }, + { "VeteranCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_veteranCashAmount ) }, + { "EliteCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_eliteCashAmount ) }, + { "HeroicCashAmount", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_heroicCashAmount ) }, + { "XpPerCashUpdate", INI::parseUnsignedInt, nullptr, offsetof( HackInternetAIUpdateModuleData, m_xpPerCashUpdate ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h index bbabac53f1d..b0b2746216a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HijackerUpdate.h @@ -50,8 +50,8 @@ class HijackerUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AttachToTargetBone", INI::parseAsciiString, NULL, offsetof( HijackerUpdateModuleData, m_attachToBone ) }, - { "ParachuteName", INI::parseAsciiString, NULL, offsetof( HijackerUpdateModuleData, m_parachuteName ) }, + { "AttachToTargetBone", INI::parseAsciiString, nullptr, offsetof( HijackerUpdateModuleData, m_attachToBone ) }, + { "ParachuteName", INI::parseAsciiString, nullptr, offsetof( HijackerUpdateModuleData, m_parachuteName ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h index 7ff7780860b..e938c79c083 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HiveStructureBody.h @@ -51,8 +51,8 @@ class HiveStructureBodyModuleData : public StructureBodyModuleData StructureBodyModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, NULL, offsetof( HiveStructureBodyModuleData, m_damageTypesToPropagateToSlaves ) }, - { "SwallowDamageTypesIfSlavesNotExisting", INI::parseDamageTypeFlags, NULL, offsetof( HiveStructureBodyModuleData, m_damageTypesToSwallow ) }, + { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, nullptr, offsetof( HiveStructureBodyModuleData, m_damageTypesToPropagateToSlaves ) }, + { "SwallowDamageTypesIfSlavesNotExisting", INI::parseDamageTypeFlags, nullptr, offsetof( HiveStructureBodyModuleData, m_damageTypesToSwallow ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h index 9ec900ce0ac..88891946681 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HordeUpdate.h @@ -73,7 +73,7 @@ static const char *const TheHordeActionTypeNames[] = "HORDE", "HORDE_FIXED", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheHordeActionTypeNames) == HORDEACTION_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h index 7802e2bf50e..555b3e315a6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LifetimeUpdate.h @@ -50,8 +50,8 @@ class LifetimeUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( LifetimeUpdateModuleData, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( LifetimeUpdateModuleData, m_maxFrames ) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( LifetimeUpdateModuleData, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( LifetimeUpdateModuleData, m_maxFrames ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h index 30bf8b44b4c..da27b222bbb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileLauncherBuildingUpdate.h @@ -56,12 +56,12 @@ class MissileLauncherBuildingUpdateModuleData : public UpdateModuleData MissileLauncherBuildingUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_doorOpenTime = 0; m_doorWaitOpenTime = 0; m_doorClosingTime = 0; - m_openingFX = m_openFX = m_waitingToCloseFX = m_closingFX = m_closedFX = NULL; + m_openingFX = m_openFX = m_waitingToCloseFX = m_closingFX = m_closedFX = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -70,16 +70,16 @@ class MissileLauncherBuildingUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_specialPowerTemplate ) }, - { "DoorOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorOpenTime ) }, - { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorWaitOpenTime ) }, - { "DoorCloseTime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorClosingTime ) }, - { "DoorOpeningFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openingFX ) }, - { "DoorOpenFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openFX ) }, - { "DoorWaitingToCloseFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_waitingToCloseFX ) }, - { "DoorClosingFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_closingFX ) }, - { "DoorClosedFX", INI::parseFXList, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_closedFX ) }, - { "DoorOpenIdleAudio", INI::parseAudioEventRTS, NULL, offsetof( MissileLauncherBuildingUpdateModuleData, m_openIdleAudio ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_specialPowerTemplate ) }, + { "DoorOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorOpenTime ) }, + { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorWaitOpenTime ) }, + { "DoorCloseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_doorClosingTime ) }, + { "DoorOpeningFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openingFX ) }, + { "DoorOpenFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openFX ) }, + { "DoorWaitingToCloseFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_waitingToCloseFX ) }, + { "DoorClosingFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_closingFX ) }, + { "DoorClosedFX", INI::parseFXList, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_closedFX ) }, + { "DoorOpenIdleAudio", INI::parseAudioEventRTS, nullptr, offsetof( MissileLauncherBuildingUpdateModuleData, m_openIdleAudio ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -112,7 +112,7 @@ class MissileLauncherBuildingUpdate : public SpecialPowerUpdateModule virtual CommandOption getCommandOption() const { return (CommandOption)0; } virtual UpdateSleepTime update(); ///< Deciding whether or not to make new guys - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; private: enum DoorStateType diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h index ce18cf4873f..6f9920a51f3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MobMemberSlavedUpdate.h @@ -65,10 +65,10 @@ class MobMemberSlavedUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "MustCatchUpRadius", INI::parseInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_mustCatchUpRadius ) }, - { "CatchUpCrisisBailTime", INI::parseUnsignedInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_catchUpCrisisBailTime ) }, - { "NoNeedToCatchUpRadius", INI::parseInt, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_noNeedToCatchUpRadius ) }, - { "Squirrelliness", INI::parseReal, NULL, offsetof( MobMemberSlavedUpdateModuleData, m_squirrellinessRatio ) }, + { "MustCatchUpRadius", INI::parseInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_mustCatchUpRadius ) }, + { "CatchUpCrisisBailTime", INI::parseUnsignedInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_catchUpCrisisBailTime ) }, + { "NoNeedToCatchUpRadius", INI::parseInt, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_noNeedToCatchUpRadius ) }, + { "Squirrelliness", INI::parseReal, nullptr, offsetof( MobMemberSlavedUpdateModuleData, m_squirrellinessRatio ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h index ed767becd88..2dd3b3b42e6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h @@ -56,8 +56,8 @@ class MoneyCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "MoneyProvided", INI::parseUnsignedInt, NULL, offsetof( MoneyCrateCollideModuleData, m_moneyProvided ) }, - { "UpgradedBoost", parseUpgradePair, NULL, offsetof( MoneyCrateCollideModuleData, m_upgradeBoost ) }, + { "MoneyProvided", INI::parseUnsignedInt, nullptr, offsetof( MoneyCrateCollideModuleData, m_moneyProvided ) }, + { "UpgradedBoost", parseUpgradePair, nullptr, offsetof( MoneyCrateCollideModuleData, m_upgradeBoost ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronBlastBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronBlastBehavior.h index 9f972ea26a9..8ec75e55198 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronBlastBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronBlastBehavior.h @@ -54,9 +54,9 @@ class NeutronBlastBehaviorModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "BlastRadius", INI::parseReal, NULL, offsetof( NeutronBlastBehaviorModuleData, m_blastRadius ) }, - { "AffectAirborne", INI::parseBool, NULL, offsetof( NeutronBlastBehaviorModuleData, m_isAffectAirborne ) }, - { "AffectAllies", INI::parseBool, NULL, offsetof( NeutronBlastBehaviorModuleData, m_affectAllies ) }, + { "BlastRadius", INI::parseReal, nullptr, offsetof( NeutronBlastBehaviorModuleData, m_blastRadius ) }, + { "AffectAirborne", INI::parseBool, nullptr, offsetof( NeutronBlastBehaviorModuleData, m_isAffectAirborne ) }, + { "AffectAllies", INI::parseBool, nullptr, offsetof( NeutronBlastBehaviorModuleData, m_affectAllies ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h index 5fa059cff71..28fe4d78429 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OCLSpecialPower.h @@ -60,7 +60,7 @@ class OCLSpecialPowerModuleData : public SpecialPowerModuleData ScienceType m_science; const ObjectCreationList* m_ocl; - Upgrades() : m_science(SCIENCE_INVALID), m_ocl(NULL) + Upgrades() : m_science(SCIENCE_INVALID), m_ocl(nullptr) { } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index 3af77883edb..dbeeaba5ff6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -137,7 +137,7 @@ class OpenContain : public UpdateModule, ///< this gets called from virtual void clientVisibleContainedFlashAsSelected() {}; - virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const { return NULL; } + virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const { return nullptr; } virtual void recalcApparentControllingPlayer() { } virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj' @@ -171,7 +171,7 @@ class OpenContain : public UpdateModule, virtual void iterateContained( ContainIterateFunc func, void *userData, Bool reverse ); virtual UnsignedInt getContainCount() const { return m_containListSize; } virtual const ContainedItemsList* getContainedItemsList() const { return &m_containList; } - virtual const Object *friend_getRider() const{return NULL;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. + virtual const Object *friend_getRider() const{return nullptr;} ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it. virtual Real getContainedItemsMass() const; virtual UnsignedInt getStealthUnitsContained() const { return m_stealthUnitsContained; } virtual UnsignedInt getHeroUnitsContained() const { return m_heroUnitsContained; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index 8cb487b76e1..0610fd3fb4b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h @@ -113,7 +113,7 @@ class OverlordContain : public TransportContain virtual void createPayload(); private: - /**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns NULL, + /**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns nullptr, we are either empty or carrying a non container. */ ContainModuleInterface *getRedirectedContain() const; ///< And this gets what are redirecting to. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h index f937ba66b6c..db21542f97f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/POWTruckAIUpdate.h @@ -68,7 +68,7 @@ class POWTruckAIUpdateInterface public: - virtual void setTask( POWTruckTask task, Object *taskObject = NULL ) = 0; + virtual void setTask( POWTruckTask task, Object *taskObject = nullptr ) = 0; virtual POWTruckTask getCurrentTask( void ) = 0; virtual void loadPrisoner( Object *prisoner ) = 0; virtual void unloadPrisonersToPrison( Object *prison ) = 0; @@ -109,7 +109,7 @@ class POWTruckAIUpdate : public AIUpdateInterface, protected: - virtual void setTask( POWTruckTask task, Object *taskObject = NULL ); ///< set our current task + virtual void setTask( POWTruckTask task, Object *taskObject = nullptr ); ///< set our current task enum POWTruckAIMode // Stored in save file, do not renumber. jba. { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h index 053d3108e62..09c4d707288 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParkingPlaceBehavior.h @@ -67,18 +67,18 @@ class ParkingPlaceBehaviorModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "NumRows", INI::parseInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_numRows ) }, - { "NumCols", INI::parseInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_numCols ) }, - { "ApproachHeight", INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_approachHeight ) }, - { "LandingDeckHeightOffset", INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_landingDeckHeightOffset ) }, - { "HasRunways", INI::parseBool, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_hasRunways ) }, - { "ParkInHangars", INI::parseBool, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_parkInHangars ) }, - { "HealAmountPerSecond", INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_healAmount ) }, -// { "ExtraHealAmount4Helicopters", INI::parseReal, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_extraHealAmount4Helicopters ) }, + { "NumRows", INI::parseInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_numRows ) }, + { "NumCols", INI::parseInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_numCols ) }, + { "ApproachHeight", INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_approachHeight ) }, + { "LandingDeckHeightOffset", INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_landingDeckHeightOffset ) }, + { "HasRunways", INI::parseBool, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_hasRunways ) }, + { "ParkInHangars", INI::parseBool, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_parkInHangars ) }, + { "HealAmountPerSecond", INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_healAmount ) }, +// { "ExtraHealAmount4Helicopters", INI::parseReal, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_extraHealAmount4Helicopters ) }, - //{ "TimeForFullHeal", INI::parseDurationUnsignedInt, NULL, offsetof( ParkingPlaceBehaviorModuleData, m_framesForFullHeal ) }, + //{ "TimeForFullHeal", INI::parseDurationUnsignedInt, nullptr, offsetof( ParkingPlaceBehaviorModuleData, m_framesForFullHeal ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -148,9 +148,9 @@ class ParkingPlaceBehavior : public UpdateModule, virtual void setHealee(Object* healee, Bool add); virtual void killAllParkedUnits(); virtual void defectAllParkedUnits(Team* newTeam, UnsignedInt detectionTime); - virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = NULL, Int *newIndex = NULL ) { return FALSE; } - virtual const std::vector* getTaxiLocations( ObjectID id ) const { return NULL; } - virtual const std::vector* getCreationLocations( ObjectID id ) const { return NULL; } + virtual Bool calcBestParkingAssignment( ObjectID id, Coord3D *pos, Int *oldIndex = nullptr, Int *newIndex = nullptr ) { return FALSE; } + virtual const std::vector* getTaxiLocations( ObjectID id ) const { return nullptr; } + virtual const std::vector* getCreationLocations( ObjectID id ) const { return nullptr; } private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h index a022329ba16..28d42e1f1a9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h @@ -161,7 +161,7 @@ class ParticleUplinkCannonUpdate : public SpecialPowerUpdateModule virtual Bool isActive() const {return m_status != STATUS_IDLE;} virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; } virtual CommandOption getCommandOption() const { return (CommandOption)0; } - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; virtual ScienceType getExtraRequiredScience() const { return SCIENCE_INVALID; } //Does this object have more than one special power module with the same spTemplate? virtual void onObjectCreated(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h index bd41d3c97f1..228b36bd313 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h @@ -263,7 +263,7 @@ class PhysicsBehavior : public UpdateModule, Real m_yawRate; ///< rate of rotation around up vector Real m_rollRate; ///< rate of rotation around forward vector Real m_pitchRate; ///< rate or rotation around side vector - DynamicAudioEventRTS* m_bounceSound; ///< The sound for when this thing bounces, or NULL + DynamicAudioEventRTS* m_bounceSound; ///< The sound for when this thing bounces, or nullptr Coord3D m_accel; ///< current acceleration Coord3D m_prevAccel; ///< last frame's acceleration Coord3D m_vel; ///< current velocity diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h index 97c21634e53..765ebd01ddb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PowerPlantUpdate.h @@ -48,7 +48,7 @@ class PowerPlantUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "RodsExtendTime", INI::parseDurationUnsignedInt, NULL, offsetof( PowerPlantUpdateModuleData, m_rodsExtendTime ) }, + { "RodsExtendTime", INI::parseDurationUnsignedInt, nullptr, offsetof( PowerPlantUpdateModuleData, m_rodsExtendTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h index 2baf25279c4..33789d1b3fd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PrisonDockUpdate.h @@ -49,7 +49,7 @@ class PrisonDockUpdate : public DockUpdate // virtual destructor prototype provided by MemoryPoolObject base class virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object *docker, Object *drone = NULL ); ///< for me this means do some Prison + virtual Bool action( Object *docker, Object *drone = nullptr ); ///< for me this means do some Prison protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h index 5c6cc19fe4b..23f721ead53 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h @@ -223,7 +223,7 @@ class ProductionUpdate : public UpdateModule, public ProductionUpdateInterface, // walking the production list from outside virtual const ProductionEntry *firstProduction( void ) const { return m_productionQueue; } - virtual const ProductionEntry *nextProduction( const ProductionEntry *p ) const { return p ? p->m_next : NULL; } + virtual const ProductionEntry *nextProduction( const ProductionEntry *p ) const { return p ? p->m_next : nullptr; } virtual void setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h index d6eb4714fd1..27a541ce345 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/QueueProductionExitUpdate.h @@ -60,11 +60,11 @@ class QueueProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "UnitCreatePoint", INI::parseCoord3D, NULL, offsetof( QueueProductionExitUpdateModuleData, m_unitCreatePoint ) }, - { "NaturalRallyPoint", INI::parseCoord3D, NULL, offsetof( QueueProductionExitUpdateModuleData, m_naturalRallyPoint ) }, - { "ExitDelay", INI::parseDurationUnsignedInt, NULL, offsetof( QueueProductionExitUpdateModuleData, m_exitDelayData ) }, - { "AllowAirborneCreation", INI::parseBool, NULL, offsetof( QueueProductionExitUpdateModuleData, m_allowAirborneCreationData ) }, - { "InitialBurst", INI::parseUnsignedInt, NULL, offsetof( QueueProductionExitUpdateModuleData, m_initialBurst ) }, + { "UnitCreatePoint", INI::parseCoord3D, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_unitCreatePoint ) }, + { "NaturalRallyPoint", INI::parseCoord3D, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_naturalRallyPoint ) }, + { "ExitDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_exitDelayData ) }, + { "AllowAirborneCreation", INI::parseBool, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_allowAirborneCreationData ) }, + { "InitialBurst", INI::parseUnsignedInt, nullptr, offsetof( QueueProductionExitUpdateModuleData, m_initialBurst ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -121,5 +121,5 @@ inline const Coord3D *QueueProductionExitUpdate::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h index c36d57bf363..6b695a324ba 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadarUpdate.h @@ -48,7 +48,7 @@ class RadarUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { - { "RadarExtendTime", INI::parseDurationReal, NULL, offsetof( RadarUpdateModuleData, m_radarExtendTime ) }, + { "RadarExtendTime", INI::parseDurationReal, nullptr, offsetof( RadarUpdateModuleData, m_radarExtendTime ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h index 3d58a6ae6f4..7536a9b7b05 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RadiusDecalUpdate.h @@ -48,8 +48,8 @@ class RadiusDecalUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - //{ "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalTemplate ) }, - //{ "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalRadius ) }, + //{ "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalTemplate ) }, + //{ "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( RadiusDecalUpdateModuleData, m_deliveryDecalRadius ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h index 537d0293ba4..d9f83936a0a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailedTransportDockUpdate.h @@ -86,7 +86,7 @@ class RailedTransportDockUpdate : public DockUpdate, // dock methods virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object* docker, Object *drone = NULL ); + virtual Bool action( Object* docker, Object *drone = nullptr ); virtual Bool isClearToEnter( Object const* docker ) const; // our own methods diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index 994a7e67de9..dc171244527 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -52,23 +52,23 @@ class RailroadBehaviorModuleData : public PhysicsBehaviorModuleData static const FieldParse dataFieldParse[] = { - { "PathPrefixName", INI::parseAsciiString, NULL, offsetof( RailroadBehaviorModuleData, m_pathPrefixName ) }, - { "CrashFXTemplateName", INI::parseAsciiString, NULL, offsetof( RailroadBehaviorModuleData, m_CrashFXTemplateName ) }, - { "IsLocomotive", INI::parseBool, NULL, offsetof( RailroadBehaviorModuleData, m_isLocomotive ) }, - { "CarriageTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(RailroadBehaviorModuleData, m_carriageTemplateNameData) }, - { "BigMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_bigMetalImpactDefaultSound) }, - { "SmallMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_smallMetalImpactDefaultSound) }, - { "MeatyBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_meatyImpactDefaultSound) }, - { "RunningGarrisonSpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) }, - { "KillSpeedMin", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) }, - { "SpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_speedMax) }, - { "Acceleration", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_acceleration) }, - { "Braking", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_braking) }, - { "WaitAtStationTime", INI::parseDurationUnsignedInt, NULL, offsetof( RailroadBehaviorModuleData, m_waitAtStationTime) }, - { "RunningSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_runningSound) }, - { "ClicketyClackSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_clicketyClackSound) }, - { "WhistleSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_whistleSound) }, - { "Friction", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_friction) }, + { "PathPrefixName", INI::parseAsciiString, nullptr, offsetof( RailroadBehaviorModuleData, m_pathPrefixName ) }, + { "CrashFXTemplateName", INI::parseAsciiString, nullptr, offsetof( RailroadBehaviorModuleData, m_CrashFXTemplateName ) }, + { "IsLocomotive", INI::parseBool, nullptr, offsetof( RailroadBehaviorModuleData, m_isLocomotive ) }, + { "CarriageTemplateName", INI::parseAsciiStringVectorAppend, nullptr, offsetof(RailroadBehaviorModuleData, m_carriageTemplateNameData) }, + { "BigMetalBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_bigMetalImpactDefaultSound) }, + { "SmallMetalBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_smallMetalImpactDefaultSound) }, + { "MeatyBounceSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_meatyImpactDefaultSound) }, + { "RunningGarrisonSpeedMax", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) }, + { "KillSpeedMin", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) }, + { "SpeedMax", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_speedMax) }, + { "Acceleration", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_acceleration) }, + { "Braking", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_braking) }, + { "WaitAtStationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( RailroadBehaviorModuleData, m_waitAtStationTime) }, + { "RunningSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_runningSound) }, + { "ClicketyClackSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_clicketyClackSound) }, + { "WhistleSound", INI::parseAudioEventRTS, nullptr, offsetof( RailroadBehaviorModuleData, m_whistleSound) }, + { "Friction", INI::parseReal, nullptr, offsetof( RailroadBehaviorModuleData, m_friction) }, { 0, 0, 0, 0 } }; @@ -173,7 +173,7 @@ struct TrainTrack // To protect the track form ever going out of sync between cars on the same train... // I restrict write access to the first referencer, before a second one is added (the locomotive) - TrackPointList* getWritablePointList( void ) { return m_refCount == 1 ? &m_pointList : NULL; }; + TrackPointList* getWritablePointList( void ) { return m_refCount == 1 ? &m_pointList : nullptr; }; const TrackPointList* getPointList( void ) { return &m_pointList; }; private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h index 8a37bc1e417..406b16ec684 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RebuildHoleBehavior.h @@ -107,7 +107,7 @@ class RebuildHoleBehavior : public UpdateModule, protected: - void newWorkerRespawnProcess( Object *existingWorker ); ///< start the worker respawn process (again if existingWorker is non NULL) + void newWorkerRespawnProcess( Object *existingWorker ); ///< start the worker respawn process (again if existingWorker is non nullptr) ObjectID m_workerID; ///< id of the worker that will rebuild us ObjectID m_reconstructingID; ///< ID of the object we're reconstructing diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h index ff8c94e972a..55aa122157b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RepairDockUpdate.h @@ -63,7 +63,7 @@ class RepairDockUpdate : public DockUpdate virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object *docker, Object *drone = NULL ); ///< for me this means do some repair + virtual Bool action( Object *docker, Object *drone = nullptr ); ///< for me this means do some repair virtual Bool isRallyPointAfterDockType(){return TRUE;} ///< A minority of docks want to give you a final command to their rally point diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageInternetCenterCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageInternetCenterCrateCollide.h index 319dc68a3fc..f00fb7a0821 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageInternetCenterCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageInternetCenterCrateCollide.h @@ -56,7 +56,7 @@ class SabotageInternetCenterCrateCollideModuleData : public CrateCollideModuleDa static const FieldParse dataFieldParse[] = { - { "SabotageDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SabotageInternetCenterCrateCollideModuleData, m_sabotageFrames ) }, + { "SabotageDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SabotageInternetCenterCrateCollideModuleData, m_sabotageFrames ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageMilitaryFactoryCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageMilitaryFactoryCrateCollide.h index 543e001657d..e7ca672ca07 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageMilitaryFactoryCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageMilitaryFactoryCrateCollide.h @@ -56,7 +56,7 @@ class SabotageMilitaryFactoryCrateCollideModuleData : public CrateCollideModuleD static const FieldParse dataFieldParse[] = { - { "SabotageDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SabotageMilitaryFactoryCrateCollideModuleData, m_sabotageFrames ) }, + { "SabotageDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SabotageMilitaryFactoryCrateCollideModuleData, m_sabotageFrames ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotagePowerPlantCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotagePowerPlantCrateCollide.h index daff6951800..479b9db8e87 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotagePowerPlantCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotagePowerPlantCrateCollide.h @@ -56,7 +56,7 @@ class SabotagePowerPlantCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "SabotagePowerDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SabotagePowerPlantCrateCollideModuleData, m_powerSabotageFrames ) }, + { "SabotagePowerDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SabotagePowerPlantCrateCollideModuleData, m_powerSabotageFrames ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyCenterCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyCenterCrateCollide.h index c3f75fc1e9f..9b62fdb0f17 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyCenterCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyCenterCrateCollide.h @@ -56,7 +56,7 @@ class SabotageSupplyCenterCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "StealCashAmount", INI::parseUnsignedInt, NULL, offsetof( SabotageSupplyCenterCrateCollideModuleData, m_stealCashAmount ) }, + { "StealCashAmount", INI::parseUnsignedInt, nullptr, offsetof( SabotageSupplyCenterCrateCollideModuleData, m_stealCashAmount ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyDropzoneCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyDropzoneCrateCollide.h index 0bf5d1c2d77..c85cb592344 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyDropzoneCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SabotageSupplyDropzoneCrateCollide.h @@ -56,7 +56,7 @@ class SabotageSupplyDropzoneCrateCollideModuleData : public CrateCollideModuleDa static const FieldParse dataFieldParse[] = { - { "StealCashAmount", INI::parseUnsignedInt, NULL, offsetof( SabotageSupplyDropzoneCrateCollideModuleData, m_stealCashAmount ) }, + { "StealCashAmount", INI::parseUnsignedInt, nullptr, offsetof( SabotageSupplyDropzoneCrateCollideModuleData, m_stealCashAmount ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h index 5540c678b5c..5153d583317 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h @@ -63,11 +63,11 @@ class SalvageCrateCollideModuleData : public CrateCollideModuleData static const FieldParse dataFieldParse[] = { - { "WeaponChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_weaponChance ) }, - { "LevelChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_levelChance ) }, - { "MoneyChance", INI::parsePercentToReal, NULL, offsetof( SalvageCrateCollideModuleData, m_moneyChance ) }, - { "MinMoney", INI::parseInt, NULL, offsetof( SalvageCrateCollideModuleData, m_minimumMoney ) }, - { "MaxMoney", INI::parseInt, NULL, offsetof( SalvageCrateCollideModuleData, m_maximumMoney ) }, + { "WeaponChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_weaponChance ) }, + { "LevelChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_levelChance ) }, + { "MoneyChance", INI::parsePercentToReal, nullptr, offsetof( SalvageCrateCollideModuleData, m_moneyChance ) }, + { "MinMoney", INI::parseInt, nullptr, offsetof( SalvageCrateCollideModuleData, m_minimumMoney ) }, + { "MaxMoney", INI::parseInt, nullptr, offsetof( SalvageCrateCollideModuleData, m_maximumMoney ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h index 2a77c29aeb8..f49cf3e7f17 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlavedUpdate.h @@ -96,25 +96,25 @@ class SlavedUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "GuardMaxRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_guardMaxRange ) }, - { "GuardWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_guardWanderRange ) }, - { "AttackRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_attackRange ) }, - { "AttackWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_attackWanderRange ) }, - { "ScoutRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_scoutRange ) }, - { "ScoutWanderRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_scoutWanderRange ) }, - { "RepairRange", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_repairRange ) }, - { "RepairMinAltitude", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairMinAltitude ) }, - { "RepairMaxAltitude", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairMaxAltitude ) }, - { "DistToTargetToGrantRangeBonus", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_distToTargetToGrantRangeBonus ) }, - { "RepairRatePerSecond", INI::parseReal, NULL, offsetof( SlavedUpdateModuleData, m_repairRatePerSecond ) }, - { "RepairWhenBelowHealth%", INI::parseInt, NULL, offsetof( SlavedUpdateModuleData, m_repairWhenHealthBelowPercentage ) }, - { "RepairMinReadyTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_minReadyFrames ) }, - { "RepairMaxReadyTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_maxReadyFrames ) }, - { "RepairMinWeldTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_minWeldFrames ) }, - { "RepairMaxWeldTime", INI::parseDurationUnsignedInt, NULL, offsetof( SlavedUpdateModuleData, m_maxWeldFrames ) }, - { "RepairWeldingSys", INI::parseAsciiString, NULL, offsetof( SlavedUpdateModuleData, m_weldingSysName ) }, - { "RepairWeldingFXBone", INI::parseAsciiString, NULL, offsetof( SlavedUpdateModuleData, m_weldingFXBone ) }, - { "StayOnSameLayerAsMaster", INI::parseBool, NULL, offsetof( SlavedUpdateModuleData, m_stayOnSameLayerAsMaster ) }, + { "GuardMaxRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_guardMaxRange ) }, + { "GuardWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_guardWanderRange ) }, + { "AttackRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_attackRange ) }, + { "AttackWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_attackWanderRange ) }, + { "ScoutRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_scoutRange ) }, + { "ScoutWanderRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_scoutWanderRange ) }, + { "RepairRange", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_repairRange ) }, + { "RepairMinAltitude", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairMinAltitude ) }, + { "RepairMaxAltitude", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairMaxAltitude ) }, + { "DistToTargetToGrantRangeBonus", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_distToTargetToGrantRangeBonus ) }, + { "RepairRatePerSecond", INI::parseReal, nullptr, offsetof( SlavedUpdateModuleData, m_repairRatePerSecond ) }, + { "RepairWhenBelowHealth%", INI::parseInt, nullptr, offsetof( SlavedUpdateModuleData, m_repairWhenHealthBelowPercentage ) }, + { "RepairMinReadyTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_minReadyFrames ) }, + { "RepairMaxReadyTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_maxReadyFrames ) }, + { "RepairMinWeldTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_minWeldFrames ) }, + { "RepairMaxWeldTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SlavedUpdateModuleData, m_maxWeldFrames ) }, + { "RepairWeldingSys", INI::parseAsciiString, nullptr, offsetof( SlavedUpdateModuleData, m_weldingSysName ) }, + { "RepairWeldingFXBone", INI::parseAsciiString, nullptr, offsetof( SlavedUpdateModuleData, m_weldingFXBone ) }, + { "StayOnSameLayerAsMaster", INI::parseBool, nullptr, offsetof( SlavedUpdateModuleData, m_stayOnSameLayerAsMaster ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h index db778297fdc..d415bd9dd89 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SlowDeathBehavior.h @@ -61,7 +61,7 @@ static const char *const TheSlowDeathPhaseNames[] = "MIDPOINT", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheSlowDeathPhaseNames) == SD_PHASE_COUNT + 1, "Incorrect array size"); #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h index 4f27ad1a9ab..42203c8a1a2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h @@ -48,7 +48,7 @@ class SmartBombTargetHomingUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "CourseCorrectionScalar", INI::parseReal, NULL, offsetof( SmartBombTargetHomingUpdateModuleData, m_courseCorrectionScalar ) }, + { "CourseCorrectionScalar", INI::parseReal, nullptr, offsetof( SmartBombTargetHomingUpdateModuleData, m_courseCorrectionScalar ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h index 748355ff15e..f1a097b6033 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h @@ -81,17 +81,17 @@ class SpawnBehaviorModuleData : public BehaviorModuleData BehaviorModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "SpawnNumber", INI::parseInt, NULL, offsetof( SpawnBehaviorModuleData, m_spawnNumberData ) }, - { "SpawnReplaceDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SpawnBehaviorModuleData, m_spawnReplaceDelayData ) }, - { "OneShot", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_isOneShotData ) }, - { "CanReclaimOrphans", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_canReclaimOrphans ) }, - { "AggregateHealth", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_aggregateHealth ) }, - { "ExitByBudding", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_exitByBudding ) }, - { "SpawnTemplateName", INI::parseAsciiStringVectorAppend,NULL, offsetof( SpawnBehaviorModuleData, m_spawnTemplateNameData ) }, - { "SpawnedRequireSpawner", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_spawnedRequireSpawner ) }, - { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, NULL, offsetof( SpawnBehaviorModuleData, m_damageTypesToPropagateToSlaves ) }, - { "InitialBurst", INI::parseInt, NULL, offsetof( SpawnBehaviorModuleData, m_initialBurst ) }, - { "SlavesHaveFreeWill", INI::parseBool, NULL, offsetof( SpawnBehaviorModuleData, m_slavesHaveFreeWill ) }, + { "SpawnNumber", INI::parseInt, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnNumberData ) }, + { "SpawnReplaceDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnReplaceDelayData ) }, + { "OneShot", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_isOneShotData ) }, + { "CanReclaimOrphans", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_canReclaimOrphans ) }, + { "AggregateHealth", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_aggregateHealth ) }, + { "ExitByBudding", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_exitByBudding ) }, + { "SpawnTemplateName", INI::parseAsciiStringVectorAppend,nullptr, offsetof( SpawnBehaviorModuleData, m_spawnTemplateNameData ) }, + { "SpawnedRequireSpawner", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_spawnedRequireSpawner ) }, + { "PropagateDamageTypesToSlavesWhenExisting", INI::parseDamageTypeFlags, nullptr, offsetof( SpawnBehaviorModuleData, m_damageTypesToPropagateToSlaves ) }, + { "InitialBurst", INI::parseInt, nullptr, offsetof( SpawnBehaviorModuleData, m_initialBurst ) }, + { "SlavesHaveFreeWill", INI::parseBool, nullptr, offsetof( SpawnBehaviorModuleData, m_slavesHaveFreeWill ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h index 8622540f497..fa81a352131 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h @@ -52,7 +52,7 @@ class SpawnPointProductionExitUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "SpawnPointBoneName", INI::parseAsciiString, NULL, offsetof( SpawnPointProductionExitUpdateModuleData, m_spawnPointBoneNameData ) }, + { "SpawnPointBoneName", INI::parseAsciiString, nullptr, offsetof( SpawnPointProductionExitUpdateModuleData, m_spawnPointBoneNameData ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -79,7 +79,7 @@ class SpawnPointProductionExitUpdate : public UpdateModule, public ExitInterface virtual void exitObjectViaDoor( Object *newObj, ExitDoorType exitDoor ); virtual void unreserveDoorForExit( ExitDoorType exitDoor ); virtual void setRallyPoint( const Coord3D * ){} - virtual const Coord3D *getRallyPoint() const { return NULL; } + virtual const Coord3D *getRallyPoint() const { return nullptr; } virtual void exitObjectByBudding( Object *newObj, Object *budHost ) { return; } virtual UpdateSleepTime update() { return UPDATE_SLEEP_FOREVER; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h index bee145e9aa6..7e619c43bb7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h @@ -85,7 +85,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData SpecialAbilityUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_startAbilityRange = SPECIAL_ABILITY_HUGE_DISTANCE; m_abilityAbortRange = SPECIAL_ABILITY_HUGE_DISTANCE; m_preparationFrames = 0; @@ -102,7 +102,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData m_skipPackingWithNoTarget = FALSE; m_flipObjectAfterPacking = FALSE; m_flipObjectAfterUnpacking = FALSE; - m_disableFXParticleSystem = NULL; + m_disableFXParticleSystem = nullptr; m_fleeRangeAfterCompletion = 0.0f; m_doCaptureFX = FALSE; m_alwaysValidateSpecialObjects = FALSE; @@ -122,43 +122,43 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData static const FieldParse dataFieldParse[] = { //Primary data values - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialPowerTemplate ) }, - { "StartAbilityRange", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_startAbilityRange ) }, - { "AbilityAbortRange", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_abilityAbortRange ) }, - { "PreparationTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_preparationFrames ) }, - { "PersistentPrepTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_persistentPrepFrames ) }, - { "PackTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packTime ) }, - { "UnpackTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_unpackTime ) }, - { "PreTriggerUnstealthTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_preTriggerUnstealthFrames ) }, - { "SkipPackingWithNoTarget", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_skipPackingWithNoTarget ) }, - { "PackUnpackVariationFactor", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packUnpackVariationFactor ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialPowerTemplate ) }, + { "StartAbilityRange", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_startAbilityRange ) }, + { "AbilityAbortRange", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_abilityAbortRange ) }, + { "PreparationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_preparationFrames ) }, + { "PersistentPrepTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_persistentPrepFrames ) }, + { "PackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packTime ) }, + { "UnpackTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_unpackTime ) }, + { "PreTriggerUnstealthTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_preTriggerUnstealthFrames ) }, + { "SkipPackingWithNoTarget", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_skipPackingWithNoTarget ) }, + { "PackUnpackVariationFactor", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packUnpackVariationFactor ) }, //Secondary data values - { "SpecialObject", INI::parseAsciiString, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectName ) }, - { "SpecialObjectAttachToBone", INI::parseAsciiString, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectAttachToBoneName ) }, - { "MaxSpecialObjects", INI::parseUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_maxSpecialObjects ) }, - { "SpecialObjectsPersistent", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistent ) }, - { "EffectDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_effectDuration ) }, - { "EffectValue", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_effectValue ) }, - { "UniqueSpecialObjectTargets", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_uniqueSpecialObjectTargets ) }, - { "SpecialObjectsPersistWhenOwnerDies", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistWhenOwnerDies ) }, - { "AlwaysValidateSpecialObjects", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_alwaysValidateSpecialObjects ) }, - { "FlipOwnerAfterPacking", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterPacking ) }, - { "FlipOwnerAfterUnpacking", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterUnpacking ) }, - { "FleeRangeAfterCompletion", INI::parseReal, NULL, offsetof( SpecialAbilityUpdateModuleData, m_fleeRangeAfterCompletion ) }, - { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( SpecialAbilityUpdateModuleData, m_disableFXParticleSystem ) }, - { "DoCaptureFX", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_doCaptureFX ) }, - { "PackSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_packSound ) }, - { "UnpackSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_unpackSound ) }, - { "PrepSoundLoop", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_prepSoundLoop ) }, - { "TriggerSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialAbilityUpdateModuleData, m_triggerSound ) }, - { "LoseStealthOnTrigger", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_loseStealthOnTrigger ) }, - { "AwardXPForTriggering", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_awardXPForTriggering ) }, - { "SkillPointsForTriggering", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_skillPointsForTriggering ) }, - { "ApproachRequiresLOS", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, - { "ApproachRequiresLOS", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, - { "NeedToFaceTarget", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_needToFaceTarget ) }, - { "PersistenceRequiresRecharge",INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_persistenceRequiresRecharge ) }, + { "SpecialObject", INI::parseAsciiString, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectName ) }, + { "SpecialObjectAttachToBone", INI::parseAsciiString, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectAttachToBoneName ) }, + { "MaxSpecialObjects", INI::parseUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_maxSpecialObjects ) }, + { "SpecialObjectsPersistent", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistent ) }, + { "EffectDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_effectDuration ) }, + { "EffectValue", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_effectValue ) }, + { "UniqueSpecialObjectTargets", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_uniqueSpecialObjectTargets ) }, + { "SpecialObjectsPersistWhenOwnerDies", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_specialObjectsPersistWhenOwnerDies ) }, + { "AlwaysValidateSpecialObjects", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_alwaysValidateSpecialObjects ) }, + { "FlipOwnerAfterPacking", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterPacking ) }, + { "FlipOwnerAfterUnpacking", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_flipObjectAfterUnpacking ) }, + { "FleeRangeAfterCompletion", INI::parseReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_fleeRangeAfterCompletion ) }, + { "DisableFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_disableFXParticleSystem ) }, + { "DoCaptureFX", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_doCaptureFX ) }, + { "PackSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_packSound ) }, + { "UnpackSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_unpackSound ) }, + { "PrepSoundLoop", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_prepSoundLoop ) }, + { "TriggerSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_triggerSound ) }, + { "LoseStealthOnTrigger", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_loseStealthOnTrigger ) }, + { "AwardXPForTriggering", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_awardXPForTriggering ) }, + { "SkillPointsForTriggering", INI::parseInt, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_skillPointsForTriggering ) }, + { "ApproachRequiresLOS", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, + { "ApproachRequiresLOS", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, + { "NeedToFaceTarget", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_needToFaceTarget ) }, + { "PersistenceRequiresRecharge",INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_persistenceRequiresRecharge ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -185,7 +185,7 @@ class SpecialAbilityUpdate : public SpecialPowerUpdateModule virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const { return false; } //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const { return false; } //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) {} - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; // virtual Bool isBusy() const { return m_isBusy; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h index fef438647a4..290538a6d09 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerCompletionDie.h @@ -43,7 +43,7 @@ class SpecialPowerCompletionDieModuleData : public DieModuleData SpecialPowerCompletionDieModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -52,7 +52,7 @@ class SpecialPowerCompletionDieModuleData : public DieModuleData static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerCompletionDieModuleData, m_specialPowerTemplate ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialPowerCompletionDieModuleData, m_specialPowerTemplate ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h index 8669842463a..739b170c080 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h @@ -160,7 +160,7 @@ class SpecialPowerModule : public BehaviorModule, virtual Bool isScriptOnly() const; //If the special power launches a construction site, we need to know the final product for placement purposes. - virtual const ThingTemplate* getReferenceThingTemplate() const { return NULL; } + virtual const ThingTemplate* getReferenceThingTemplate() const { return nullptr; } protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h index 01d4aed5643..5672fdc6ac5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerUpdateModule.h @@ -47,7 +47,7 @@ class SpecialPowerUpdateInterface virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const = 0; //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const = 0; //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) = 0; - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const = 0; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const = 0; }; //------------------------------------------------------------------------------------------------- @@ -75,6 +75,6 @@ class SpecialPowerUpdateModule : public UpdateModule, public SpecialPowerUpdateI virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const = 0; //Is it active now? virtual Bool doesSpecialPowerHaveOverridableDestination() const = 0; //Does it have it, even if it's not active? virtual void setSpecialPowerOverridableDestination( const Coord3D *loc ) = 0; - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const = 0; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const = 0; }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h index ee44fd479d9..5249b78d543 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipDeploymentUpdate.h @@ -117,7 +117,7 @@ class SpectreGunshipDeploymentUpdate : public SpecialPowerUpdateModule virtual Bool isActive() const {return FALSE;} virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; } virtual CommandOption getCommandOption() const { return (CommandOption)0; } - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const { return FALSE; }; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const { return FALSE; }; virtual ScienceType getExtraRequiredScience() const { return getSpectreGunshipDeploymentUpdateModuleData()->m_extraRequiredScience; } //Does this object have more than one special power module with the same spTemplate? virtual void onObjectCreated(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipUpdate.h index c494e4b1a58..6660616ace3 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpectreGunshipUpdate.h @@ -105,7 +105,7 @@ class SpectreGunshipUpdate : public SpecialPowerUpdateModule virtual Bool isActive() const {return m_status < GUNSHIP_STATUS_DEPARTING;} virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; } virtual CommandOption getCommandOption() const { return (CommandOption)0; } - virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const; + virtual Bool isPowerCurrentlyInUse( const CommandButton *command = nullptr ) const; virtual void onObjectCreated(); virtual UpdateSleepTime update(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h index 6410014f217..135f48273ff 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h @@ -63,11 +63,11 @@ class SpyVisionUpdateModuleData : public UpdateModuleData { static const FieldParse dataFieldParse[] = { - { "NeedsUpgrade", INI::parseBool, NULL, offsetof( SpyVisionUpdateModuleData, m_needsUpgrade ) }, - { "SelfPowered", INI::parseBool, NULL, offsetof( SpyVisionUpdateModuleData, m_selfPowered ) }, - { "SelfPoweredDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionUpdateModuleData, m_selfPoweredDuration ) }, - { "SelfPoweredInterval", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionUpdateModuleData, m_selfPoweredInterval ) }, - { "SpyOnKindof", KindOfMaskType::parseFromINI, NULL, offsetof( SpyVisionUpdateModuleData, m_spyOnKindof ) }, + { "NeedsUpgrade", INI::parseBool, nullptr, offsetof( SpyVisionUpdateModuleData, m_needsUpgrade ) }, + { "SelfPowered", INI::parseBool, nullptr, offsetof( SpyVisionUpdateModuleData, m_selfPowered ) }, + { "SelfPoweredDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionUpdateModuleData, m_selfPoweredDuration ) }, + { "SelfPoweredInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionUpdateModuleData, m_selfPoweredInterval ) }, + { "SpyOnKindof", KindOfMaskType::parseFromINI, nullptr, offsetof( SpyVisionUpdateModuleData, m_spyOnKindof ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h index 6eab70e630a..76ff0495304 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthDetectorUpdate.h @@ -59,10 +59,10 @@ class StealthDetectorUpdateModuleData : public UpdateModuleData m_updateRate = 1; m_detectionRange = 0.0f; m_initiallyDisabled = false; - m_IRBeaconParticleSysTmpl = NULL; - m_IRParticleSysTmpl = NULL; - m_IRBrightParticleSysTmpl = NULL; - m_IRGridParticleSysTmpl = NULL; + m_IRBeaconParticleSysTmpl = nullptr; + m_IRParticleSysTmpl = nullptr; + m_IRBrightParticleSysTmpl = nullptr; + m_IRGridParticleSysTmpl = nullptr; m_extraDetectKindof.clear(); m_extraDetectKindofNot.clear(); m_canDetectWhileGarrisoned = false; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h index 11b44712951..3d922c42649 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h @@ -65,7 +65,7 @@ static const char *const TheStealthLevelNames[] = "NO_BLACK_MARKET", "TAKING_DAMAGE", "RIDERS_ATTACKING", - NULL + nullptr }; #endif @@ -125,7 +125,7 @@ class StealthUpdate : public UpdateModule virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK( DISABLED_HELD ); } // ??? ugh - Bool isDisguised() const { return m_disguiseAsTemplate != NULL; } + Bool isDisguised() const { return m_disguiseAsTemplate != nullptr; } Int getDisguisedPlayerIndex() const { return m_disguiseAsPlayerIndex; } const ThingTemplate *getDisguisedTemplate() { return m_disguiseAsTemplate; } void markAsDetected( UnsignedInt numFrames = 0 ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h index 5d1c16d07f6..dde03c60252 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StickyBombUpdate.h @@ -47,8 +47,8 @@ class StickyBombUpdateModuleData : public UpdateModuleData StickyBombUpdateModuleData() { m_offsetZ = 10.0f; - m_geometryBasedDamageWeaponTemplate = NULL; - m_geometryBasedDamageFX = NULL; + m_geometryBasedDamageWeaponTemplate = nullptr; + m_geometryBasedDamageFX = nullptr; } static void buildFieldParse(MultiIniFieldParse& p) @@ -56,10 +56,10 @@ class StickyBombUpdateModuleData : public UpdateModuleData UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AttachToTargetBone", INI::parseAsciiString, NULL, offsetof( StickyBombUpdateModuleData, m_attachToBone ) }, - { "OffsetZ", INI::parseReal, NULL, offsetof( StickyBombUpdateModuleData, m_offsetZ ) }, - { "GeometryBasedDamageWeapon",INI::parseWeaponTemplate, NULL, offsetof( StickyBombUpdateModuleData, m_geometryBasedDamageWeaponTemplate ) }, - { "GeometryBasedDamageFX", INI::parseFXList, NULL, offsetof( StickyBombUpdateModuleData, m_geometryBasedDamageFX ) }, + { "AttachToTargetBone", INI::parseAsciiString, nullptr, offsetof( StickyBombUpdateModuleData, m_attachToBone ) }, + { "OffsetZ", INI::parseReal, nullptr, offsetof( StickyBombUpdateModuleData, m_offsetZ ) }, + { "GeometryBasedDamageWeapon",INI::parseWeaponTemplate, nullptr, offsetof( StickyBombUpdateModuleData, m_geometryBasedDamageWeaponTemplate ) }, + { "GeometryBasedDamageFX", INI::parseFXList, nullptr, offsetof( StickyBombUpdateModuleData, m_geometryBasedDamageFX ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -82,7 +82,7 @@ class StickyBombUpdate : public UpdateModule virtual UpdateSleepTime update(); ///< called once per frame - void initStickyBomb( Object *object, const Object *bomber, const Coord3D *specificPos = NULL ); + void initStickyBomb( Object *object, const Object *bomber, const Coord3D *specificPos = nullptr ); void detonate(); Bool isTimedBomb() const { return m_dieFrame > 0; } UnsignedInt getDetonationFrame() const { return m_dieFrame; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h index 9e8931794df..a0d11786288 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureToppleUpdate.h @@ -76,7 +76,7 @@ static const char *const TheStructureTopplePhaseNames[] = "DELAY", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheStructureTopplePhaseNames) == ST_PHASE_COUNT + 1, "Incorrect array size"); @@ -114,11 +114,11 @@ class StructureToppleUpdateModuleData : public UpdateModuleData m_structuralDecay = 0.0f; m_damageFXTypes = DAMAGE_TYPE_FLAGS_NONE; m_damageFXTypes.flip(); - m_toppleStartFXList = NULL; - m_toppleDelayFXList = NULL; - m_toppleDoneFXList = NULL; - m_toppleFXList = NULL; - m_crushingFXList = NULL; + m_toppleStartFXList = nullptr; + m_toppleDelayFXList = nullptr; + m_toppleDoneFXList = nullptr; + m_toppleFXList = nullptr; + m_crushingFXList = nullptr; for (int i = 0; i < ST_PHASE_COUNT; ++i) { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h index e6d0d2d2825..45ebe75b725 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h @@ -58,7 +58,7 @@ class SupplyCenterDockUpdate : public DockUpdate SupplyCenterDockUpdate( Thing *thing, const ModuleData* moduleData ); virtual DockUpdateInterface* getDockUpdateInterface() { return this; } - virtual Bool action( Object* docker, Object *drone = NULL ); /// m_group; ///< if non-NULL, we are part of this group of agents + RefCountPtr m_group; ///< if non-null, we are part of this group of agents #endif // These will last for my lifetime. I will reuse them and reset them. The truly dynamic ones are in PartitionManager diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectCreationList.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectCreationList.h index d39dd19c00b..dba9c293ba9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectCreationList.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectCreationList.h @@ -28,7 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // Kris: August 23, 2003 -// All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). #pragma once @@ -133,32 +133,32 @@ class ObjectCreationList void addObjectCreationNugget(ObjectCreationNugget* nugget); // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). static Object* create( const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) { if( ocl ) return ocl->createInternal( primaryObj, primary, secondary, createOwner, lifetimeFrames ); - return NULL; + return nullptr; } // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). /// inline convenience method to avoid having to check for null. static Object* create(const ObjectCreationList* ocl, const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Real angle, UnsignedInt lifetimeFrames = 0 ) { if (ocl) return ocl->createInternal( primaryObj, primary, secondary, angle, lifetimeFrames ); - return NULL; + return nullptr; } // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). /// inline convenience method to avoid having to check for null. static Object* create( const ObjectCreationList* ocl, const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) { if (ocl) return ocl->createInternal( primary, secondary, lifetimeFrames ); - return NULL; + return nullptr; } protected: @@ -166,7 +166,7 @@ class ObjectCreationList private: // Kris: August 23, 2003 - // All OCLs return the first object that is created (or NULL if not applicable). + // All OCLs return the first object that is created (or null if not applicable). Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Bool createOwner, UnsignedInt lifetimeFrames = 0 ) const; Object* createInternal(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Real angle, UnsignedInt lifetimeFrames = 0 ) const; Object* createInternal(const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames = 0 ) const; @@ -195,7 +195,7 @@ class ObjectCreationListStore : public SubsystemInterface /** return the ObjectCreationList with the given namekey. - return NULL if no such ObjectCreationList exists. + return nullptr if no such ObjectCreationList exists. */ const ObjectCreationList *findObjectCreationList(const char* name) const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectIter.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectIter.h index 6ef3f32d588..0e3fcd01849 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectIter.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectIter.h @@ -121,11 +121,11 @@ class SimpleObjectIterator : public ObjectIterator public: SimpleObjectIterator(); //~SimpleObjectIterator(); // provided by MPO - Object *first() { return firstWithNumeric(NULL); } - Object *next() { return nextWithNumeric(NULL); } + Object *first() { return firstWithNumeric(nullptr); } + Object *next() { return nextWithNumeric(nullptr); } - Object *firstWithNumeric(Real *num = NULL) { reset(); return nextWithNumeric(num); } - Object *nextWithNumeric(Real *num = NULL); + Object *firstWithNumeric(Real *num = nullptr) { reset(); return nextWithNumeric(num); } + Object *nextWithNumeric(Real *num = nullptr); // methods that are not inherited from ObjectIterator: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index 627f5494d51..9fd6bb4db26 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -129,9 +129,9 @@ struct FindPositionOptions maxRadius = 0.0f; startAngle = RANDOM_START_ANGLE; maxZDelta = 1e10f; // ie, any z delta. - ignoreObject = NULL; - sourceToPathToDest = NULL; - relationshipObject = NULL; + ignoreObject = nullptr; + sourceToPathToDest = nullptr; + relationshipObject = nullptr; }; FindPositionFlags flags; ///< flags for finding the legal position Real minRadius; ///< min radius to search around @@ -1124,7 +1124,7 @@ class PartitionFilterThing : public PartitionFilter public: PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) { - DEBUG_ASSERTCRASH(m_tThing != NULL, ("ThingTemplate for PartitionFilterThing is NULL")); + DEBUG_ASSERTCRASH(m_tThing != nullptr, ("ThingTemplate for PartitionFilterThing is null")); } protected: virtual Bool allow( Object *other ); @@ -1146,7 +1146,7 @@ class PartitionFilterGarrisonable : public PartitionFilter public: PartitionFilterGarrisonable( Bool match ) : m_match(match) { - m_player = NULL; + m_player = nullptr; } protected: virtual Bool allow( Object *other ); @@ -1367,17 +1367,17 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Object *obj, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, - Real *closestDist = NULL, - Coord3D *closestDistVec = NULL + PartitionFilter **filters = nullptr, + Real *closestDist = nullptr, + Coord3D *closestDistVec = nullptr ); Object *getClosestObject( const Coord3D *pos, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, - Real *closestDist = NULL, - Coord3D *closestDistVec = NULL + PartitionFilter **filters = nullptr, + Real *closestDist = nullptr, + Coord3D *closestDistVec = nullptr ); Real getRelativeAngle2D( const Object *obj, const Object *otherObj ); @@ -1387,12 +1387,12 @@ class PartitionManager : public SubsystemInterface, public Snapshot void getVectorTo(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D& vec); // just like 'getDistance', but return the dist-sqr, meaning we save a sqrt() call if you don't need it. - Real getDistanceSquared(const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = NULL); - Real getDistanceSquared(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D *vec = NULL); + Real getDistanceSquared(const Object *obj, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = nullptr); + Real getDistanceSquared(const Object *obj, const Coord3D *pos, DistanceCalculationType dc, Coord3D *vec = nullptr); // just like 'getDistanceSquared', but return the dist-sqr where the obj is at goalPos. - Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = NULL); - Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Coord3D *otherPos, DistanceCalculationType dc, Coord3D *vec = NULL); + Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Object *otherObj, DistanceCalculationType dc, Coord3D *vec = nullptr); + Real getGoalDistanceSquared(const Object *obj, const Coord3D *goalPos, const Coord3D *otherPos, DistanceCalculationType dc, Coord3D *vec = nullptr); #ifdef PM_CACHE_TERRAIN_HEIGHT // note that the 2d positions aren't guaranteed to be the actual spot within the cell where the terrain @@ -1409,7 +1409,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Object *obj, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, + PartitionFilter **filters = nullptr, IterOrderType order = ITER_FASTEST ); @@ -1417,11 +1417,11 @@ class PartitionManager : public SubsystemInterface, public Snapshot const Coord3D *pos, Real maxDist, DistanceCalculationType dc, - PartitionFilter **filters = NULL, + PartitionFilter **filters = nullptr, IterOrderType order = ITER_FASTEST ); - SimpleObjectIterator *iterateAllObjects(PartitionFilter **filters = NULL); + SimpleObjectIterator *iterateAllObjects(PartitionFilter **filters = nullptr); /** return the Objects that would (or would not) collide with the given @@ -1546,13 +1546,13 @@ inline Int PartitionManager::worldToCellDist(Real w) //----------------------------------------------------------------------------- inline PartitionCell *PartitionManager::getCellAt(Int x, Int y) { - return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? NULL : &m_cells[y * m_cellCountX + x]; + return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? nullptr : &m_cells[y * m_cellCountX + x]; } //----------------------------------------------------------------------------- inline const PartitionCell *PartitionManager::getCellAt(Int x, Int y) const { - return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? NULL : &m_cells[y * m_cellCountX + x]; + return (x < 0 || y < 0 || x >= m_cellCountX || y >= m_cellCountY) ? nullptr : &m_cells[y * m_cellCountX + x]; } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PolygonTrigger.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PolygonTrigger.h index 39ef5273f28..8c122fd5d62 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PolygonTrigger.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PolygonTrigger.h @@ -52,10 +52,10 @@ class WaterHandle public: - WaterHandle( void ) { m_polygon = NULL; } + WaterHandle( void ) { m_polygon = nullptr; } ///@todo we need to formalize the water systems - PolygonTrigger *m_polygon; ///< valid when water is a polygon area, NULL if water is a grid + PolygonTrigger *m_polygon; ///< valid when water is a polygon area, nullptr if water is a grid }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h index 54732967956..40fc6b4f64f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Powers.h @@ -51,7 +51,7 @@ static const char *const PowerNames[] = "FASTER", "DOUBLE_SHOT", "SELF_HEALING", - NULL + nullptr }; static_assert(ARRAY_SIZE(PowerNames) == POWERS_NUM_POWERS + 1, "Incorrect array size"); #endif // end DEFINE_POWER_NAMES diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h index c849fb5fa85..f94f20b351b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -86,7 +86,7 @@ class ScriptActions : public ScriptActionsInterface protected: static GameWindow *m_messageWindow; - static void clearWindow(void) {m_messageWindow=NULL;}; + static void clearWindow(void) {m_messageWindow=nullptr;}; Bool m_suppressNewWindows; AsciiString m_unnamedUnit; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h index fe237cbceec..0447dc20209 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -244,8 +244,8 @@ class ScriptEngine : public SubsystemInterface, Bool isGameEnding( void ) { return m_endGameTimer >= 0; } virtual void startQuickEndGameTimer(void); ///< Starts the quick end game timer after a campaign is won or lost. virtual void startCloseWindowTimer(void); ///< Starts the timer to close windows after a mission is won or lost. - virtual void runScript(const AsciiString& scriptName, Team *pThisTeam=NULL); ///< Runs a script. - virtual void runObjectScript(const AsciiString& scriptName, Object *pThisObject=NULL); ///< Runs a script attached to this object. + virtual void runScript(const AsciiString& scriptName, Team *pThisTeam=nullptr); ///< Runs a script. + virtual void runObjectScript(const AsciiString& scriptName, Object *pThisObject=nullptr); ///< Runs a script attached to this object. virtual Team *getTeamNamed(const AsciiString& teamName); ///< Gets the named team. May be null. virtual Player *getSkirmishEnemyPlayer(void); ///< Gets the ai's enemy Human player. May be null. virtual Player *getCurrentPlayer(void); ///< Gets the player that owns the current script. May be null. @@ -271,8 +271,8 @@ class ScriptEngine : public SubsystemInterface, // For other systems to evaluate Conditions, execute Actions, etc. ///< if pThisTeam is specified, then scripts in here can use to mean the team this script is attached to. - virtual Bool evaluateConditions( Script *pScript, Team *pThisTeam = NULL, Player *pPlayer=NULL ); - virtual void friend_executeAction( ScriptAction *pActionHead, Team *pThisTeam = NULL); ///< Use this at yer peril. + virtual Bool evaluateConditions( Script *pScript, Team *pThisTeam = nullptr, Player *pPlayer=nullptr ); + virtual void friend_executeAction( ScriptAction *pActionHead, Team *pThisTeam = nullptr); ///< Use this at yer peril. virtual Object *getUnitNamed(const AsciiString& unitName); ///< Gets the named unit. May be null. virtual Bool didUnitExist(const AsciiString& unitName); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h index 3b928470bd3..e9b0556dc75 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h @@ -161,7 +161,7 @@ class OrCondition : public MemoryPoolObject Condition *m_firstAnd; // These are Anded. public: - OrCondition():m_nextOr(NULL),m_firstAnd(NULL){}; + OrCondition():m_nextOr(nullptr),m_firstAnd(nullptr){}; //~OrCondition(); /// Duplicate creates a "deep" copy. If it is head of a linked list, duplicates the entire list. OrCondition *duplicate(void) const; @@ -577,7 +577,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class. if (ndx>=0 && ndx=0 && ndx=0 && ndx <= MAX_LINKS) return m_links[ndx]; return NULL; } + /// Get the n'th directed link. (May be nullptr). + Waypoint *getLink(Int ndx) const {if (ndx>=0 && ndx <= MAX_LINKS) return m_links[ndx]; return nullptr; } /// Get the waypoint's name. AsciiString getName(void) const {return m_name; } /// Get the integer id. @@ -227,8 +227,8 @@ class TerrainLogic : public Snapshot, virtual Bool loadMap( AsciiString filename, Bool query ); virtual void newMap( Bool saveGame ); ///< Initialize the logic for new map. - virtual Real getGroundHeight( Real x, Real y, Coord3D* normal = NULL ) const; - virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = NULL, Bool clip = true) const; + virtual Real getGroundHeight( Real x, Real y, Coord3D* normal = nullptr ) const; + virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = nullptr, Bool clip = true) const; virtual void getExtent( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality virtual void getExtentIncludingBorder( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality virtual void getMaximumPathfindExtent( Region3D *extent ) const { DEBUG_CRASH(("not implemented")); } ///< @todo This should not be a stub - this should own this functionality @@ -240,7 +240,7 @@ class TerrainLogic : public Snapshot, virtual PathfindLayerEnum alignOnTerrain( Real angle, const Coord3D& pos, Bool stickToGround, Matrix3D& mtx); - virtual Bool isUnderwater( Real x, Real y, Real *waterZ = NULL, Real *terrainZ = NULL ); ///< is point under water + virtual Bool isUnderwater( Real x, Real y, Real *waterZ = nullptr, Real *terrainZ = nullptr ); ///< is point under water virtual Bool isCliffCell( Real x, Real y) const; ///< is point cliff cell virtual const WaterHandle* getWaterHandle( Real x, Real y ); ///< get water handle at this location virtual const WaterHandle* getWaterHandleByName( AsciiString name ); ///< get water handle by name @@ -274,10 +274,10 @@ class TerrainLogic : public Snapshot, ///Gets the first bridge. Traverse all bridges using bridge->getNext(); virtual Bridge *getFirstBridge(void) const { return m_bridgeListHead; } - /// Find the bridge at a location. NULL means no bridge. + /// Find the bridge at a location. null means no bridge. virtual Bridge *findBridgeAt(const Coord3D *pLoc) const; - /// Find the bridge at a location. NULL means no bridge. Note that the layer value will be used to resolve crossing bridges. + /// Find the bridge at a location. null means no bridge. Note that the layer value will be used to resolve crossing bridges. virtual Bridge *findBridgeLayerAt(const Coord3D *pLoc, PathfindLayerEnum layer, Bool clip = true) const; /// Returns true if the object is close enough to interact with the bridge for pathfinding. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h index 30aa1d34cf1..c1f46c9d166 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/TurretAI.h @@ -309,7 +309,7 @@ class TurretAI : public MemoryPoolObject, public Snapshot, public NotifyWeaponFi virtual void notifyFired(); virtual void notifyNewVictimChosen(Object* victim); - virtual const Coord3D* getOriginalVictimPos() const { return NULL; } // yes, we return NULL here + virtual const Coord3D* getOriginalVictimPos() const { return nullptr; } // yes, we return nullptr here virtual Bool isWeaponSlotOkToFire(WeaponSlotType wslot) const; // these are only for use by the state machines... don't call them otherwise, please diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index 3afebed868d..da552dcfa89 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -68,7 +68,7 @@ static const char *const TheWeaponReloadNames[] = "YES", "NO", "RETURN_TO_BASE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponReloadNames) == WEAPON_RELOAD_COUNT + 1, "Incorrect array size"); #endif @@ -89,7 +89,7 @@ static const char *const TheWeaponPrefireNames[] = "PER_SHOT", "PER_ATTACK", "PER_CLIP", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponPrefireNames) == PREFIRE_COUNT + 1, "Incorrect array size"); #endif @@ -129,7 +129,7 @@ static const char *const TheWeaponAffectsMaskNames[] = "SUICIDE", "NOT_SIMILAR", "NOT_AIRBORNE", - NULL + nullptr }; //#endif @@ -161,7 +161,7 @@ static const char *const TheWeaponCollideMaskNames[] = "SMALL_MISSILES", //All missiles are also projectiles! "BALLISTIC_MISSILES", //All missiles are also projectiles! "CONTROLLED_STRUCTURES", - NULL + nullptr }; #endif @@ -245,7 +245,7 @@ static const char *const TheWeaponBonusNames[] = "FRENZY_TWO", "FRENZY_THREE", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponBonusNames) == WEAPONBONUSCONDITION_COUNT + 1, "Incorrect array size"); #endif @@ -300,7 +300,7 @@ static const char *const TheWeaponBonusFieldNames[] = "RANGE", "RATE_OF_FIRE", "PRE_ATTACK", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponBonusFieldNames) == WeaponBonus::FIELD_COUNT + 1, "Incorrect array size"); #endif @@ -353,8 +353,8 @@ class WeaponTemplate : public MemoryPoolObject void reset( void ); void friend_setNextTemplate(WeaponTemplate *nextTemplate) { m_nextTemplate = nextTemplate; } - WeaponTemplate *friend_clearNextTemplate( void ) { WeaponTemplate *ret = m_nextTemplate; m_nextTemplate = NULL; return ret; } - Bool isOverride( void ) { return m_nextTemplate != NULL; } + WeaponTemplate *friend_clearNextTemplate( void ) { WeaponTemplate *ret = m_nextTemplate; m_nextTemplate = nullptr; return ret; } + Bool isOverride( void ) { return m_nextTemplate != nullptr; } /// field table for loading the values from an INI const FieldParse *getFieldParse() const { return TheWeaponTemplateFieldParseTable; } @@ -483,7 +483,7 @@ class WeaponTemplate : public MemoryPoolObject private: - // NOTE: m_nextTemplate will be cleaned up if it is NON-NULL. + // NOTE: m_nextTemplate will be cleaned up if it is NON-nullptr. WeaponTemplate *m_nextTemplate; static void parseWeaponBonusSet( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ); @@ -594,10 +594,10 @@ class Weapon : public MemoryPoolObject, //~Weapon(); // return true if we auto-reloaded our clip after firing. - Bool fireWeapon(const Object *source, Object *target, ObjectID* projectileID = NULL); + Bool fireWeapon(const Object *source, Object *target, ObjectID* projectileID = nullptr); // return true if we auto-reloaded our clip after firing. - Bool fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID = NULL); + Bool fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID = nullptr); void fireProjectileDetonationWeapon(const Object *source, Object *target, WeaponBonusConditionFlags extraBonusFlags, Bool inflictDamage = TRUE ); @@ -617,12 +617,12 @@ class Weapon : public MemoryPoolObject, */ Real estimateWeaponDamage(const Object *source, const Object *target) { - return estimateWeaponDamage(source, target, NULL); + return estimateWeaponDamage(source, target, nullptr); } Real estimateWeaponDamage(const Object *source, const Coord3D* pos) { - return estimateWeaponDamage(source, NULL, pos); + return estimateWeaponDamage(source, nullptr, pos); } void onWeaponBonusChange(const Object *source);///< Our Object's weapon bonus changed, so we need to update to reflect that instead of waiting @@ -638,7 +638,7 @@ class Weapon : public MemoryPoolObject, Bool isGoalPosWithinAttackRange(const Object *source, const Coord3D* goalPos, const Object *target, const Coord3D* targetPos) const; //Used only by garrison contains that move objects around before doing the range check. - //If target object is specified, we'll use his position, but if it's NULL we will use the + //If target object is specified, we'll use his position, but if it's nullptr we will use the //target position passed in. //NOTE: This is not a user friendly function -- use with caution if at all! -- Kris Bool isSourceObjectWithGoalPositionWithinAttackRange(const Object *source, const Coord3D *goalPos, const Object *target, const Coord3D *targetPos) const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h index 707d5fffc10..604ea78318e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -57,7 +57,7 @@ static const char *const TheWeaponSlotTypeNames[] = "SECONDARY", "TERTIARY", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheWeaponSlotTypeNames) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); @@ -67,7 +67,7 @@ static const LookupListRec TheWeaponSlotTypeNamesLookupList[] = { "SECONDARY", SECONDARY_WEAPON }, { "TERTIARY", TERTIARY_WEAPON }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(TheWeaponSlotTypeNamesLookupList) == WEAPONSLOT_COUNT + 1, "Incorrect array size"); @@ -232,7 +232,7 @@ class WeaponSet : public Snapshot const Weapon* findAmmoPipShowingWeapon() const; void weaponSetOnWeaponBonusChange(const Object *source); UnsignedInt getMostPercentReadyToFireAnyWeapon() const; - inline UnsignedInt getNthCommandSourceMask( WeaponSlotType n ) const { return m_curWeaponTemplateSet ? m_curWeaponTemplateSet->getNthCommandSourceMask( n ) : NULL; } + inline UnsignedInt getNthCommandSourceMask( WeaponSlotType n ) const { return m_curWeaponTemplateSet ? m_curWeaponTemplateSet->getNthCommandSourceMask( n ) : 0; } Bool setWeaponLock( WeaponSlotType weaponSlot, WeaponLockType lockType ); void releaseWeaponLock(WeaponLockType lockType); diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h index cf149df1740..cdc700485a5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h @@ -33,7 +33,7 @@ class GameWindow; class WindowLayout; -Bool GameSpySendChat(UnicodeString message, Bool isEmote, GameWindow *playerListbox = NULL); +Bool GameSpySendChat(UnicodeString message, Bool isEmote, GameWindow *playerListbox = nullptr); void GameSpyAddText( UnicodeString message, GameSpyColors color = GSCOLOR_DEFAULT ); extern GameWindow *progressTextWindow; ///< Text box on the progress screen diff --git a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp index 8fb0da908e3..9be1aa1401b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp @@ -172,7 +172,7 @@ const char* const ModelConditionFlags::s_bitNameList[] = "DISGUISED", - NULL + nullptr }; static_assert(ARRAY_SIZE(ModelConditionFlags::s_bitNameList) == ModelConditionFlags::NumBits + 1, "Incorrect array size"); @@ -188,6 +188,6 @@ const char* const ArmorSetFlags::s_bitNameList[] = "CRATE_UPGRADE_ONE", "CRATE_UPGRADE_TWO", - NULL + nullptr }; static_assert(ARRAY_SIZE(ArmorSetFlags::s_bitNameList) == ArmorSetFlags::NumBits + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp index 0ec260b3861..8b6475e3885 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp @@ -77,7 +77,7 @@ static void ConvertShortMapPathToLongMapPath(AsciiString &mapName) AsciiString token; AsciiString actualpath; - if ((path.find('\\') == NULL) && (path.find('/') == NULL)) + if ((path.find('\\') == nullptr) && (path.find('/') == nullptr)) { DEBUG_CRASH(("Invalid map name %s", mapName.str())); return; @@ -1335,14 +1335,14 @@ static CommandLineParam paramsForEngineInit[] = char *nextParam(char *newSource, const char *seps) { - static char *source = NULL; + static char *source = nullptr; if (newSource) { source = newSource; } if (!source) { - return NULL; + return nullptr; } // find first separator @@ -1372,15 +1372,15 @@ char *nextParam(char *newSource, const char *seps) *end = 0; if (!*source) - source = NULL; + source = nullptr; } else { - source = NULL; + source = nullptr; } if (first && !*first) - first = NULL; + first = nullptr; } return first; @@ -1392,10 +1392,10 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) std::string cmdLine = GetCommandLineA(); char *token = nextParam(&cmdLine[0], "\" "); - while (token != NULL) + while (token != nullptr) { argv.push_back(strtrim(token)); - token = nextParam(NULL, "\" "); + token = nextParam(nullptr, "\" "); } int argc = argv.size(); @@ -1445,7 +1445,7 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) void createGlobalData() { - if (TheGlobalData == NULL) + if (TheGlobalData == nullptr) TheWritableGlobalData = NEW GlobalData; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp index 8975fa7d606..849d43ef378 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp @@ -48,7 +48,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -DamageFXStore *TheDamageFXStore = NULL; ///< the DamageFX store definition +DamageFXStore *TheDamageFXStore = nullptr; ///< the DamageFX store definition /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -106,7 +106,7 @@ ConstFXListPtr DamageFX::getDamageFXList(DamageType t, Real damageAmount, const if you really need to change this for some reason, consider carefully... (srj) */ if (damageAmount == 0.0f) - return NULL; + return nullptr; const DFX& dfx = m_dfx[t][source ? source->getVeterancyLevel() : LEVEL_REGULAR]; ConstFXListPtr fx = @@ -122,15 +122,15 @@ const FieldParse* DamageFX::getFieldParse() const { static const FieldParse myFieldParse[] = { - { "AmountForMajorFX", parseAmount, NULL, 0 }, - { "MajorFX", parseMajorFXList, NULL, 0 }, - { "MinorFX", parseMinorFXList, NULL, 0 }, - { "ThrottleTime", parseTime, NULL, 0 }, + { "AmountForMajorFX", parseAmount, nullptr, 0 }, + { "MajorFX", parseMajorFXList, nullptr, 0 }, + { "MinorFX", parseMinorFXList, nullptr, 0 }, + { "ThrottleTime", parseTime, nullptr, 0 }, { "VeterancyAmountForMajorFX", parseAmount, TheVeterancyNames, 0 }, { "VeterancyMajorFX", parseMajorFXList, TheVeterancyNames, 0 }, { "VeterancyMinorFX", parseMinorFXList, TheVeterancyNames, 0 }, { "VeterancyThrottleTime", parseTime, TheVeterancyNames, 0 }, - { 0, 0, 0,0 } + { nullptr, nullptr, nullptr,0 } }; return myFieldParse; } @@ -201,7 +201,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); ConstFXListPtr fx; - INI::parseFXList(ini, NULL, &fx, NULL); + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -223,7 +223,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); ConstFXListPtr fx; - INI::parseFXList(ini, NULL, &fx, NULL); + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -245,7 +245,7 @@ static void parseCommonStuff( parseCommonStuff(ini, names, vetFirst, vetLast, damageFirst, damageLast); UnsignedInt t; - INI::parseDurationUnsignedInt(ini, NULL, &t, NULL); + INI::parseDurationUnsignedInt(ini, nullptr, &t, nullptr); for (Int dt = damageFirst; dt <= damageLast; ++dt) { @@ -277,7 +277,7 @@ const DamageFX *DamageFXStore::findDamageFX(NameKeyType namekey) const DamageFXMap::const_iterator it = m_dfxmap.find(namekey); if (it == m_dfxmap.end()) { - return NULL; + return nullptr; } else { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp index 0eba66efd03..67c75b7c900 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp @@ -84,7 +84,7 @@ void Dict::DictPair::clear() case DICT_BOOL: case DICT_INT: case DICT_REAL: - m_value = 0; + m_value = nullptr; break; case DICT_ASCIISTRING: asAsciiString()->clear(); @@ -126,7 +126,7 @@ Dict::DictPair* Dict::findPairByKey(NameKeyType key) const DEBUG_ASSERTCRASH(key != NAMEKEY_INVALID, ("invalid namekey!")); DEBUG_ASSERTCRASH((UnsignedInt)key < (1L<<23), ("namekey too large!")); if (!m_data) - return NULL; + return nullptr; DictPair* base = m_data->peek(); Int minIdx = 0; Int maxIdx = m_data->m_numPairsUsed; @@ -143,7 +143,7 @@ Dict::DictPair* Dict::findPairByKey(NameKeyType key) const return mid; } - return NULL; + return nullptr; } // ----------------------------------------------------- @@ -157,10 +157,10 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa return pairToTranslate; } - Dict::DictPairData* newData = NULL; + Dict::DictPairData* newData = nullptr; if (numPairsNeeded > 0) { - DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != nullptr, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.")); DEBUG_ASSERTCRASH(numPairsNeeded <= MAX_LEN, ("Dict::ensureUnique exceeds max pairs length %d with requested length %d", MAX_LEN, numPairsNeeded)); int minBytes = sizeof(Dict::DictPairData) + numPairsNeeded*sizeof(Dict::DictPair); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); @@ -200,7 +200,7 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa void Dict::clear() { releaseData(); - m_data = NULL; + m_data = nullptr; } // ----------------------------------------------------- @@ -215,12 +215,12 @@ void Dict::releaseData() src->clear(); TheDynamicMemoryAllocator->freeBytes(m_data); } - m_data = 0; + m_data = nullptr; } } // ----------------------------------------------------- -Dict::Dict(Int numPairsToPreAllocate) : m_data(0) +Dict::Dict(Int numPairsToPreAllocate) : m_data(nullptr) { /* @@ -236,7 +236,7 @@ Dict::Dict(Int numPairsToPreAllocate) : m_data(0) sizeof(UnicodeString) <= sizeof(void*), ("oops, this code needs attention")); if (numPairsToPreAllocate) - ensureUnique(numPairsToPreAllocate, false, NULL); // will throw on error + ensureUnique(numPairsToPreAllocate, false, nullptr); // will throw on error } // ----------------------------------------------------- @@ -265,7 +265,7 @@ Dict::DataType Dict::getType(NameKeyType key) const } // ----------------------------------------------------- -Bool Dict::getBool(NameKeyType key, Bool *exists/*=NULL*/) const +Bool Dict::getBool(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -274,13 +274,13 @@ Bool Dict::getBool(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asBool(); } - DEBUG_ASSERTCRASH(exists != NULL, ("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr, ("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return false; } // ----------------------------------------------------- -Int Dict::getInt(NameKeyType key, Bool *exists/*=NULL*/) const +Int Dict::getInt(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -289,13 +289,13 @@ Int Dict::getInt(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asInt(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return 0; } // ----------------------------------------------------- -Real Dict::getReal(NameKeyType key, Bool *exists/*=NULL*/) const +Real Dict::getReal(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -304,13 +304,13 @@ Real Dict::getReal(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asReal(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return 0.0f; } // ----------------------------------------------------- -AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=NULL*/) const +AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -319,13 +319,13 @@ AsciiString Dict::getAsciiString(NameKeyType key, Bool *exists/*=NULL*/) const if (exists) *exists = true; return *pair->asAsciiString(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return AsciiString::TheEmptyString; } // ----------------------------------------------------- -UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=NULL*/) const +UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=nullptr*/) const { validate(); DictPair* pair = findPairByKey(key); @@ -334,7 +334,7 @@ UnicodeString Dict::getUnicodeString(NameKeyType key, Bool *exists/*=NULL*/) con if (exists) *exists = true; return *pair->asUnicodeString(); } - DEBUG_ASSERTCRASH(exists != NULL,("dict key missing, or of wrong type")); // only assert if they didn't check result + DEBUG_ASSERTCRASH(exists != nullptr,("dict key missing, or of wrong type")); // only assert if they didn't check result if (exists) *exists = false; return UnicodeString::TheEmptyString; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 3c183794f8b..c37b6e99b04 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -126,7 +126,7 @@ class DeepCRCSanityCheck : public SubsystemInterface protected: }; -DeepCRCSanityCheck *TheDeepCRCSanityCheck = NULL; +DeepCRCSanityCheck *TheDeepCRCSanityCheck = nullptr; void DeepCRCSanityCheck::reset(void) { @@ -149,10 +149,10 @@ void DeepCRCSanityCheck::reset(void) //------------------------------------------------------------------------------------------------- /// The GameEngine singleton instance -GameEngine *TheGameEngine = NULL; +GameEngine *TheGameEngine = nullptr; //------------------------------------------------------------------------------------------------- -SubsystemInterfaceList* TheSubsystemList = NULL; +SubsystemInterfaceList* TheSubsystemList = nullptr; //------------------------------------------------------------------------------------------------- template @@ -161,8 +161,8 @@ void initSubsystem( AsciiString name, SUBSYSTEM* sys, Xfer *pXfer, - const char* path1 = NULL, - const char* path2 = NULL) + const char* path1 = nullptr, + const char* path2 = nullptr) { sysref = sys; TheSubsystemList->initSubsystem(sys, path1, path2, pXfer, name); @@ -180,8 +180,8 @@ static void updateWindowTitle() { // TheSuperHackers @tweak Now prints product and version information in the Window title. - DEBUG_ASSERTCRASH(TheVersion != NULL, ("TheVersion is NULL")); - DEBUG_ASSERTCRASH(TheGameText != NULL, ("TheGameText is NULL")); + DEBUG_ASSERTCRASH(TheVersion != nullptr, ("TheVersion is null")); + DEBUG_ASSERTCRASH(TheGameText != nullptr, ("TheGameText is null")); UnicodeString title; @@ -252,7 +252,7 @@ GameEngine::GameEngine( void ) m_quitting = FALSE; m_isActive = FALSE; - _Module.Init(NULL, ApplicationHInstance, NULL); + _Module.Init(nullptr, ApplicationHInstance, nullptr); } //------------------------------------------------------------------------------------------------- @@ -262,10 +262,10 @@ GameEngine::~GameEngine() //preloadTextureNamesGlobalHack.clear(); delete TheMapCache; - TheMapCache = NULL; + TheMapCache = nullptr; // delete TheShell; -// TheShell = NULL; +// TheShell = nullptr; TheGameResultsQueue->endThreads(); @@ -275,22 +275,22 @@ GameEngine::~GameEngine() TheSubsystemList->shutdownAll(); delete TheSubsystemList; - TheSubsystemList = NULL; + TheSubsystemList = nullptr; delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; delete TheCommandList; - TheCommandList = NULL; + TheCommandList = nullptr; delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheGameLODManager; - TheGameLODManager = NULL; + TheGameLODManager = nullptr; Drawable::killStaticImages(); @@ -305,16 +305,16 @@ GameEngine::~GameEngine() Bool GameEngine::isTimeFrozen() { // TheSuperHackers @fix The time can no longer be frozen in Network games. It would disconnect the player. - if (TheNetwork != NULL) + if (TheNetwork != nullptr) return false; - if (TheTacticalView != NULL) + if (TheTacticalView != nullptr) { if (TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished()) return true; } - if (TheScriptEngine != NULL) + if (TheScriptEngine != nullptr) { if (TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript()) return true; @@ -326,14 +326,14 @@ Bool GameEngine::isTimeFrozen() //------------------------------------------------------------------------------------------------- Bool GameEngine::isGameHalted() { - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { if (TheNetwork->isStalling()) return true; } else { - if (TheGameLogic != NULL && TheGameLogic->isGamePaused()) + if (TheGameLogic != nullptr && TheGameLogic->isGamePaused()) return true; } @@ -424,7 +424,7 @@ void GameEngine::init() xferCRC.open("lightCRC"); - initSubsystem(TheLocalFileSystem, "TheLocalFileSystem", createLocalFileSystem(), NULL); + initSubsystem(TheLocalFileSystem, "TheLocalFileSystem", createLocalFileSystem(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -435,7 +435,7 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheArchiveFileSystem, "TheArchiveFileSystem", createArchiveFileSystem(), NULL); // this MUST come after TheLocalFileSystem creation + initSubsystem(TheArchiveFileSystem, "TheArchiveFileSystem", createArchiveFileSystem(), nullptr); // this MUST come after TheLocalFileSystem creation #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// @@ -461,7 +461,7 @@ void GameEngine::init() #if defined(RTS_DEBUG) // If we're in Debug, load the Debug settings as well. - ini.loadFileDirectory( "Data\\INI\\GameDataDebug", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\GameDataDebug", INI_LOAD_OVERWRITE, nullptr ); #endif // special-case: parse command-line parameters after loading global data @@ -496,9 +496,9 @@ void GameEngine::init() #ifdef DEBUG_CRC - initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, NULL); + initSubsystem(TheDeepCRCSanityCheck, "TheDeepCRCSanityCheck", MSGNEW("GameEngineSubystem") DeepCRCSanityCheck, nullptr); #endif // DEBUG_CRC - initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), NULL); + initSubsystem(TheGameText, "TheGameText", CreateGameTextInterface(), nullptr); updateWindowTitle(); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -513,16 +513,16 @@ void GameEngine::init() initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer", "Data\\INI\\Multiplayer"); initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain", "Data\\INI\\Terrain"); initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); - initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, NULL); // must be before the game text + initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, nullptr); // must be before the game text TheGlobalLanguageData->parseCustomDefinition(); - initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), NULL); + initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// sprintf(Buf,"----------------------------------------------------------------------------After TheCDManager = %f seconds",((double)(endTime64-startTime64)/(double)(freq64))); startTime64 = endTime64;//Reset the clock //////////////////////////////////////////////////////// DEBUG_LOG(("%s", Buf));//////////////////////////////////////////////////////////////////////////// #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), NULL); + initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), nullptr); if (!TheAudio->isMusicAlreadyLoaded()) setQuitting(TRUE); @@ -534,14 +534,14 @@ void GameEngine::init() #endif///////////////////////////////////////////////////////////////////////////////////////////// - initSubsystem(TheFunctionLexicon,"TheFunctionLexicon", createFunctionLexicon(), NULL); - initSubsystem(TheModuleFactory,"TheModuleFactory", createModuleFactory(), NULL); - initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), NULL); - initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), NULL); - initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), NULL); - initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank"); + initSubsystem(TheFunctionLexicon,"TheFunctionLexicon", createFunctionLexicon(), nullptr); + initSubsystem(TheModuleFactory,"TheModuleFactory", createModuleFactory(), nullptr); + initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), nullptr); + initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), nullptr); + initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), nullptr); + initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, nullptr, "Data\\INI\\Rank"); initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); - initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), NULL); + initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// @@ -552,13 +552,13 @@ void GameEngine::init() initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); - initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon"); + initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, nullptr, "Data\\INI\\Weapon"); initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); - initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor"); + initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, nullptr, "Data\\INI\\Locomotor"); initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower"); - initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX"); - initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor"); - initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, NULL); + initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, nullptr, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, nullptr, "Data\\INI\\Armor"); + initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -581,7 +581,7 @@ void GameEngine::init() initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); - initSubsystem(TheGameClient,"TheGameClient", createGameClient(), NULL); + initSubsystem(TheGameClient,"TheGameClient", createGameClient(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -593,13 +593,13 @@ void GameEngine::init() initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData", "Data\\INI\\AIData"); - initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL); - initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL); + initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), nullptr); + initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), nullptr); initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); - initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL); - initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL); - initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), NULL); - initSubsystem(TheVictoryConditions,"TheVictoryConditions", createVictoryConditions(), NULL); + initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), nullptr); + initSubsystem(TheRecorder,"TheRecorder", createRecorder(), nullptr); + initSubsystem(TheRadar,"TheRadar", TheGlobalData->m_headless ? NEW RadarDummy : createRadar(), nullptr); + initSubsystem(TheVictoryConditions,"TheVictoryConditions", createVictoryConditions(), nullptr); @@ -613,26 +613,26 @@ void GameEngine::init() AsciiString fname; fname.format("Data\\%s\\CommandMap", GetRegistryLanguage().str()); - initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), NULL, fname.str(), "Data\\INI\\CommandMap"); + initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), nullptr, fname.str(), "Data\\INI\\CommandMap"); TheMetaMap->generateMetaMap(); #if defined(RTS_DEBUG) - ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, nullptr); #endif #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - ini.loadFileDirectory("Data\\INI\\CommandMapDemo", INI_LOAD_MULTIFILE, NULL); + ini.loadFileDirectory("Data\\INI\\CommandMapDemo", INI_LOAD_MULTIFILE, nullptr); #endif - initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), NULL); - //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), NULL); - initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, NULL ); - initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, NULL ); + initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), nullptr); + //initSubsystem((CComObject *)TheWebBrowser,"(CComObject *)TheWebBrowser", (CComObject *)createWebBrowser(), nullptr); + initSubsystem(TheGameStateMap,"TheGameStateMap", MSGNEW("GameEngineSubsystem") GameStateMap, nullptr ); + initSubsystem(TheGameState,"TheGameState", MSGNEW("GameEngineSubsystem") GameState, nullptr ); // Create the interface for sending game results - initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), NULL); + initSubsystem(TheGameResultsQueue,"TheGameResultsQueue", GameResultsInterface::createNewGameResultsInterface(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// @@ -656,8 +656,8 @@ void GameEngine::init() TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_sounds3DOn, AudioAffect_Sound3D); TheAudio->setOn(TheGlobalData->m_audioOn && TheGlobalData->m_speechOn, AudioAffect_Speech); - // We're not in a network game yet, so set the network singleton to NULL. - TheNetwork = NULL; + // We're not in a network game yet, so set the network singleton to nullptr. + TheNetwork = nullptr; //Create a default ini file for options if it doesn't already exist. //OptionPreferences prefs( TRUE ); @@ -684,7 +684,7 @@ void GameEngine::init() if (TheGlobalData->m_buildMapCache) { // just quit, since the map cache has already updated - //populateMapListbox(NULL, true, true); + //populateMapListbox(nullptr, true, true); m_quitting = TRUE; } @@ -785,15 +785,15 @@ void GameEngine::reset( void ) if (deleteNetwork) { - DEBUG_ASSERTCRASH(TheNetwork, ("Deleting NULL TheNetwork!")); + DEBUG_ASSERTCRASH(TheNetwork, ("Deleting null TheNetwork!")); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; } if(background) { background->destroyWindows(); deleteInstance(background); - background = NULL; + background = nullptr; } } @@ -816,7 +816,7 @@ Bool GameEngine::canUpdateGameLogic() TheFramePacer->setTimeFrozen(isTimeFrozen()); TheFramePacer->setGameHalted(isGameHalted()); - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { return canUpdateNetworkGameLogic(); } @@ -829,7 +829,7 @@ Bool GameEngine::canUpdateGameLogic() /// ----------------------------------------------------------------------------------------------- Bool GameEngine::canUpdateNetworkGameLogic() { - DEBUG_ASSERTCRASH(TheNetwork != NULL, ("TheNetwork is NULL")); + DEBUG_ASSERTCRASH(TheNetwork != nullptr, ("TheNetwork is null")); if (TheNetwork->isFrameDataReady()) { @@ -899,7 +899,7 @@ void GameEngine::update( void ) TheGameClient->UPDATE(); TheMessageStream->propagateMessages(); - if (TheNetwork != NULL) + if (TheNetwork != nullptr) { TheNetwork->UPDATE(); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp index 4594265789b..371926ead13 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp @@ -47,29 +47,29 @@ //Hack to get access to a static method on the W3DDevice side. -MW extern Bool testMinimumRequirements(ChipsetType *videoChipType, CpuType *cpuType, Int *cpuFreq, MemValueType *numRAM, Real *intBenchIndex, Real *floatBenchIndex, Real *memBenchIndex); -GameLODManager *TheGameLODManager=NULL; +GameLODManager *TheGameLODManager=nullptr; static const FieldParse TheStaticGameLODFieldParseTable[] = { - { "MinimumFPS", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_minFPS)}, - { "MinimumProcessorFps", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_minProcessorFPS)}, - { "SampleCount2D", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_sampleCount2D ) }, - { "SampleCount3D", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_sampleCount3D ) }, - { "StreamCount", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_streamCount ) }, - { "MaxParticleCount", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxParticleCount ) }, - { "UseShadowVolumes", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useShadowVolumes ) }, - { "UseShadowDecals", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useShadowDecals ) }, - { "UseCloudMap", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useCloudMap ) }, - { "UseLightMap", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useLightMap ) }, - { "ShowSoftWaterEdge", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_showSoftWaterEdge ) }, - { "MaxTankTrackEdges", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackEdges) }, - { "MaxTankTrackOpaqueEdges", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackOpaqueEdges) }, - { "MaxTankTrackFadeDelay", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_maxTankTrackFadeDelay) }, - { "UseBuildupScaffolds", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useBuildupScaffolds ) }, - { "UseTreeSway", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useTreeSway ) }, - { "UseEmissiveNightMaterials", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useEmissiveNightMaterials ) }, - { "UseHeatEffects", INI::parseBool, NULL, offsetof( StaticGameLODInfo, m_useHeatEffects ) }, - { "TextureReductionFactor", INI::parseInt, NULL, offsetof( StaticGameLODInfo, m_textureReduction ) }, + { "MinimumFPS", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_minFPS)}, + { "MinimumProcessorFps", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_minProcessorFPS)}, + { "SampleCount2D", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_sampleCount2D ) }, + { "SampleCount3D", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_sampleCount3D ) }, + { "StreamCount", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_streamCount ) }, + { "MaxParticleCount", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxParticleCount ) }, + { "UseShadowVolumes", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useShadowVolumes ) }, + { "UseShadowDecals", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useShadowDecals ) }, + { "UseCloudMap", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useCloudMap ) }, + { "UseLightMap", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useLightMap ) }, + { "ShowSoftWaterEdge", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_showSoftWaterEdge ) }, + { "MaxTankTrackEdges", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackEdges) }, + { "MaxTankTrackOpaqueEdges", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackOpaqueEdges) }, + { "MaxTankTrackFadeDelay", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_maxTankTrackFadeDelay) }, + { "UseBuildupScaffolds", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useBuildupScaffolds ) }, + { "UseTreeSway", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useTreeSway ) }, + { "UseEmissiveNightMaterials", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useEmissiveNightMaterials ) }, + { "UseHeatEffects", INI::parseBool, nullptr, offsetof( StaticGameLODInfo, m_useHeatEffects ) }, + { "TextureReductionFactor", INI::parseInt, nullptr, offsetof( StaticGameLODInfo, m_textureReduction ) }, }; static const char *const StaticGameLODNames[]= @@ -111,10 +111,10 @@ StaticGameLODInfo::StaticGameLODInfo(void) static const FieldParse TheDynamicGameLODFieldParseTable[] = { - { "MinimumFPS", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_minFPS)}, - { "ParticleSkipMask", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_dynamicParticleSkipMask)}, - { "DebrisSkipMask", INI::parseInt, NULL, offsetof( DynamicGameLODInfo, m_dynamicDebrisSkipMask)}, - { "SlowDeathScale", INI::parseReal, NULL, offsetof( DynamicGameLODInfo, m_slowDeathScale)}, + { "MinimumFPS", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_minFPS)}, + { "ParticleSkipMask", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_dynamicParticleSkipMask)}, + { "DebrisSkipMask", INI::parseInt, nullptr, offsetof( DynamicGameLODInfo, m_dynamicDebrisSkipMask)}, + { "SlowDeathScale", INI::parseReal, nullptr, offsetof( DynamicGameLODInfo, m_slowDeathScale)}, { "MinParticlePriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticlePriority)}, { "MinParticleSkipPriority", INI::parseIndexList, ParticlePriorityNames, offsetof( DynamicGameLODInfo, m_minDynamicParticleSkipPriority)}, }; @@ -141,21 +141,21 @@ DynamicGameLODInfo::DynamicGameLODInfo(void) //Keep this in sync with enum in GameLOD.h static const char *const CPUNames[] = { - "XX","P3", "P4","K7", NULL + "XX","P3", "P4","K7", nullptr }; static_assert(ARRAY_SIZE(CPUNames) == CPU_MAX + 1, "Incorrect array size"); //Keep this in sync with enum in GameLOD.h static const char *const VideoNames[] = { - "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", NULL + "XX","V2","V3","V4","V5","TNT","TNT2","GF2","R100","PS11","GF3","GF4","PS14","R200","PS20","R300", nullptr }; static_assert(ARRAY_SIZE(VideoNames) == DC_MAX + 1, "Incorrect array size"); void parseReallyLowMHz(INI* ini) { Int mhz; - INI::parseInt(ini,NULL,&mhz,NULL); + INI::parseInt(ini,nullptr,&mhz,nullptr); if (TheGameLODManager) { TheGameLODManager->setReallyLowMHz(mhz); @@ -170,11 +170,11 @@ void INI::parseBenchProfile( INI* ini) if (preset) { - INI::parseIndexList(ini,NULL,&preset->m_cpuType,CPUNames); - INI::parseInt(ini,NULL,&preset->m_mhz,NULL); - INI::parseReal(ini,NULL,&preset->m_intBenchIndex,NULL); - INI::parseReal(ini,NULL,&preset->m_floatBenchIndex,NULL); - INI::parseReal(ini,NULL,&preset->m_memBenchIndex,NULL); + INI::parseIndexList(ini,nullptr,&preset->m_cpuType,CPUNames); + INI::parseInt(ini,nullptr,&preset->m_mhz,nullptr); + INI::parseReal(ini,nullptr,&preset->m_intBenchIndex,nullptr); + INI::parseReal(ini,nullptr,&preset->m_floatBenchIndex,nullptr); + INI::parseReal(ini,nullptr,&preset->m_memBenchIndex,nullptr); } } } @@ -198,10 +198,10 @@ void INI::parseLODPreset( INI* ini ) if (preset) { - INI::parseIndexList(ini,NULL,&preset->m_cpuType,CPUNames); - INI::parseInt(ini,NULL,&preset->m_mhz,NULL); - INI::parseIndexList(ini,NULL,&preset->m_videoType,VideoNames); - INI::parseInt(ini,NULL,&preset->m_memory,NULL); + INI::parseIndexList(ini,nullptr,&preset->m_cpuType,CPUNames); + INI::parseInt(ini,nullptr,&preset->m_mhz,nullptr); + INI::parseIndexList(ini,nullptr,&preset->m_videoType,VideoNames); + INI::parseInt(ini,nullptr,&preset->m_memory,nullptr); } } } @@ -280,7 +280,7 @@ BenchProfile *GameLODManager::newBenchProfile(void) } DEBUG_CRASH(( "GameLODManager::newBenchProfile - Too many profiles defined")); - return NULL; + return nullptr; } LODPresetInfo *GameLODManager::newLODPreset(StaticGameLODLevel index) @@ -296,17 +296,17 @@ LODPresetInfo *GameLODManager::newLODPreset(StaticGameLODLevel index) DEBUG_CRASH(( "GameLODManager::newLODPreset - Too many presets defined for '%s'", TheGameLODManager->getStaticGameLODLevelName(index))); } - return NULL; + return nullptr; } void GameLODManager::init(void) { INI ini; //Get Presets for each LOD level. - ini.loadFileDirectory( "Data\\INI\\GameLOD", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\GameLOD", INI_LOAD_OVERWRITE, nullptr ); //Get presets for each known hardware configuration - ini.loadFileDirectory( "Data\\INI\\GameLODPresets", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\GameLODPresets", INI_LOAD_OVERWRITE, nullptr); //Get Presets for custom LOD level by pulling them out of initial globaldata (which should //have all settings already applied). @@ -320,7 +320,7 @@ void GameLODManager::init(void) m_idealDetailLevel=(StaticGameLODLevel)optionPref.getIdealStaticGameDetail(); //always get this data in case we need it later. - testMinimumRequirements(NULL,&m_cpuType,&m_cpuFreq,&m_numRAM,NULL,NULL,NULL); + testMinimumRequirements(nullptr,&m_cpuType,&m_cpuFreq,&m_numRAM,nullptr,nullptr,nullptr); if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT) m_memPassed=TRUE; //check if they have at least 256 MB @@ -330,7 +330,7 @@ void GameLODManager::init(void) if (m_cpuType == XX || TheGlobalData->m_forceBenchmark) { //need to run the benchmark - testMinimumRequirements(NULL,NULL,NULL,NULL,&m_intBenchIndex,&m_floatBenchIndex,&m_memBenchIndex); + testMinimumRequirements(nullptr,nullptr,nullptr,nullptr,&m_intBenchIndex,&m_floatBenchIndex,&m_memBenchIndex); if (TheGlobalData->m_forceBenchmark) { //we want to see the numbers. So dump them to a logfile. @@ -485,7 +485,7 @@ StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void) m_idealDetailLevel = STATIC_GAME_LOD_LOW; //get system configuration - only need vide chip type, got rest in ::init(). - testMinimumRequirements(&m_videoChipType,NULL,NULL,NULL,NULL,NULL,NULL); + testMinimumRequirements(&m_videoChipType,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr); if (m_videoChipType == DC_UNKNOWN) m_videoChipType = DC_TNT2; //presume it's at least TNT2 level diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp index 7c72fc4e1e8..ed94ec7bf54 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp @@ -57,9 +57,9 @@ Int GameMain() // since execute() returned, we are exiting the game delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheGameEngine; - TheGameEngine = NULL; + TheGameEngine = nullptr; return exitcode; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index 32808fab439..e3e7b831f8d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -60,483 +60,483 @@ #include "GameNetwork/FirewallHelper.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +GlobalData* TheWritableGlobalData = nullptr; ///< The global data singleton //------------------------------------------------------------------------------------------------- -GlobalData* GlobalData::m_theOriginal = NULL; +GlobalData* GlobalData::m_theOriginal = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /*static*/ const FieldParse GlobalData::s_GlobalDataFieldParseTable[] = { - { "Windowed", INI::parseBool, NULL, offsetof( GlobalData, m_windowed ) }, - { "XResolution", INI::parseInt, NULL, offsetof( GlobalData, m_xResolution ) }, - { "YResolution", INI::parseInt, NULL, offsetof( GlobalData, m_yResolution ) }, - { "MapName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_mapName ) }, - { "MoveHintName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_moveHintName ) }, - { "UseTrees", INI::parseBool, NULL, offsetof( GlobalData, m_useTrees ) }, - { "UseFPSLimit", INI::parseBool, NULL, offsetof( GlobalData, m_useFpsLimit ) }, - { "DumpAssetUsage", INI::parseBool, NULL, offsetof( GlobalData, m_dumpAssetUsage ) }, - { "FramesPerSecondLimit", INI::parseInt, NULL, offsetof( GlobalData, m_framesPerSecondLimit ) }, - { "ChipsetType", INI::parseInt, NULL, offsetof( GlobalData, m_chipSetType ) }, - { "MaxShellScreens", INI::parseInt, NULL, offsetof( GlobalData, m_maxShellScreens ) }, - { "UseCloudMap", INI::parseBool, NULL, offsetof( GlobalData, m_useCloudMap ) }, - { "UseLightMap", INI::parseBool, NULL, offsetof( GlobalData, m_useLightMap ) }, - { "BilinearTerrainTex", INI::parseBool, NULL, offsetof( GlobalData, m_bilinearTerrainTex ) }, - { "TrilinearTerrainTex", INI::parseBool, NULL, offsetof( GlobalData, m_trilinearTerrainTex ) }, - { "MultiPassTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_multiPassTerrain ) }, - { "AdjustCliffTextures", INI::parseBool, NULL, offsetof( GlobalData, m_adjustCliffTextures ) }, - { "Use3WayTerrainBlends", INI::parseInt, NULL, offsetof( GlobalData, m_use3WayTerrainBlends ) }, - { "StretchTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_stretchTerrain ) }, - { "UseHalfHeightMap", INI::parseBool, NULL, offsetof( GlobalData, m_useHalfHeightMap ) }, - - - { "DrawEntireTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_drawEntireTerrain ) }, + { "Windowed", INI::parseBool, nullptr, offsetof( GlobalData, m_windowed ) }, + { "XResolution", INI::parseInt, nullptr, offsetof( GlobalData, m_xResolution ) }, + { "YResolution", INI::parseInt, nullptr, offsetof( GlobalData, m_yResolution ) }, + { "MapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_mapName ) }, + { "MoveHintName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_moveHintName ) }, + { "UseTrees", INI::parseBool, nullptr, offsetof( GlobalData, m_useTrees ) }, + { "UseFPSLimit", INI::parseBool, nullptr, offsetof( GlobalData, m_useFpsLimit ) }, + { "DumpAssetUsage", INI::parseBool, nullptr, offsetof( GlobalData, m_dumpAssetUsage ) }, + { "FramesPerSecondLimit", INI::parseInt, nullptr, offsetof( GlobalData, m_framesPerSecondLimit ) }, + { "ChipsetType", INI::parseInt, nullptr, offsetof( GlobalData, m_chipSetType ) }, + { "MaxShellScreens", INI::parseInt, nullptr, offsetof( GlobalData, m_maxShellScreens ) }, + { "UseCloudMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useCloudMap ) }, + { "UseLightMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useLightMap ) }, + { "BilinearTerrainTex", INI::parseBool, nullptr, offsetof( GlobalData, m_bilinearTerrainTex ) }, + { "TrilinearTerrainTex", INI::parseBool, nullptr, offsetof( GlobalData, m_trilinearTerrainTex ) }, + { "MultiPassTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_multiPassTerrain ) }, + { "AdjustCliffTextures", INI::parseBool, nullptr, offsetof( GlobalData, m_adjustCliffTextures ) }, + { "Use3WayTerrainBlends", INI::parseInt, nullptr, offsetof( GlobalData, m_use3WayTerrainBlends ) }, + { "StretchTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_stretchTerrain ) }, + { "UseHalfHeightMap", INI::parseBool, nullptr, offsetof( GlobalData, m_useHalfHeightMap ) }, + + + { "DrawEntireTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_drawEntireTerrain ) }, { "TerrainLOD", INI::parseIndexList, TerrainLODNames, offsetof( GlobalData, m_terrainLOD ) }, - { "TerrainLODTargetTimeMS", INI::parseInt, NULL, offsetof( GlobalData, m_terrainLODTargetTimeMS ) }, - { "RightMouseAlwaysScrolls", INI::parseBool, NULL, offsetof( GlobalData, m_rightMouseAlwaysScrolls ) }, - { "UseWaterPlane", INI::parseBool, NULL, offsetof( GlobalData, m_useWaterPlane ) }, - { "UseCloudPlane", INI::parseBool, NULL, offsetof( GlobalData, m_useCloudPlane ) }, - { "DownwindAngle", INI::parseReal, NULL, offsetof( GlobalData, m_downwindAngle ) }, - { "UseShadowVolumes", INI::parseBool, NULL, offsetof( GlobalData, m_useShadowVolumes ) }, - { "UseShadowDecals", INI::parseBool, NULL, offsetof( GlobalData, m_useShadowDecals ) }, - { "TextureReductionFactor", INI::parseInt, NULL, offsetof( GlobalData, m_textureReductionFactor ) }, - { "UseBehindBuildingMarker", INI::parseBool, NULL, offsetof( GlobalData, m_enableBehindBuildingMarkers ) }, - { "WaterPositionX", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionX ) }, - { "WaterPositionY", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionY ) }, - { "WaterPositionZ", INI::parseReal, NULL, offsetof( GlobalData, m_waterPositionZ ) }, - { "WaterExtentX", INI::parseReal, NULL, offsetof( GlobalData, m_waterExtentX ) }, - { "WaterExtentY", INI::parseReal, NULL, offsetof( GlobalData, m_waterExtentY ) }, - { "WaterType", INI::parseInt, NULL, offsetof( GlobalData, m_waterType ) }, - { "FeatherWater", INI::parseInt, NULL, offsetof( GlobalData, m_featherWater ) }, - { "ShowSoftWaterEdge", INI::parseBool, NULL, offsetof( GlobalData, m_showSoftWaterEdge ) }, + { "TerrainLODTargetTimeMS", INI::parseInt, nullptr, offsetof( GlobalData, m_terrainLODTargetTimeMS ) }, + { "RightMouseAlwaysScrolls", INI::parseBool, nullptr, offsetof( GlobalData, m_rightMouseAlwaysScrolls ) }, + { "UseWaterPlane", INI::parseBool, nullptr, offsetof( GlobalData, m_useWaterPlane ) }, + { "UseCloudPlane", INI::parseBool, nullptr, offsetof( GlobalData, m_useCloudPlane ) }, + { "DownwindAngle", INI::parseReal, nullptr, offsetof( GlobalData, m_downwindAngle ) }, + { "UseShadowVolumes", INI::parseBool, nullptr, offsetof( GlobalData, m_useShadowVolumes ) }, + { "UseShadowDecals", INI::parseBool, nullptr, offsetof( GlobalData, m_useShadowDecals ) }, + { "TextureReductionFactor", INI::parseInt, nullptr, offsetof( GlobalData, m_textureReductionFactor ) }, + { "UseBehindBuildingMarker", INI::parseBool, nullptr, offsetof( GlobalData, m_enableBehindBuildingMarkers ) }, + { "WaterPositionX", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionX ) }, + { "WaterPositionY", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionY ) }, + { "WaterPositionZ", INI::parseReal, nullptr, offsetof( GlobalData, m_waterPositionZ ) }, + { "WaterExtentX", INI::parseReal, nullptr, offsetof( GlobalData, m_waterExtentX ) }, + { "WaterExtentY", INI::parseReal, nullptr, offsetof( GlobalData, m_waterExtentY ) }, + { "WaterType", INI::parseInt, nullptr, offsetof( GlobalData, m_waterType ) }, + { "FeatherWater", INI::parseInt, nullptr, offsetof( GlobalData, m_featherWater ) }, + { "ShowSoftWaterEdge", INI::parseBool, nullptr, offsetof( GlobalData, m_showSoftWaterEdge ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps1", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 0 ] ) }, - { "VertexWaterHeightClampLow1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 0 ] ) }, - { "VertexWaterHeightClampHi1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 0 ] ) }, - { "VertexWaterAngle1", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 0 ] ) }, - { "VertexWaterXPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 0 ] ) }, - { "VertexWaterYPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 0 ] ) }, - { "VertexWaterZPosition1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 0 ] ) }, - { "VertexWaterXGridCells1", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 0 ] ) }, - { "VertexWaterYGridCells1", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 0 ] ) }, - { "VertexWaterGridSize1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 0 ] ) }, - { "VertexWaterAttenuationA1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 0 ] ) }, - { "VertexWaterAttenuationB1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 0 ] ) }, - { "VertexWaterAttenuationC1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 0 ] ) }, - { "VertexWaterAttenuationRange1", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 0 ] ) }, + { "VertexWaterAvailableMaps1", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 0 ] ) }, + { "VertexWaterHeightClampLow1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 0 ] ) }, + { "VertexWaterHeightClampHi1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 0 ] ) }, + { "VertexWaterAngle1", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 0 ] ) }, + { "VertexWaterXPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 0 ] ) }, + { "VertexWaterYPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 0 ] ) }, + { "VertexWaterZPosition1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 0 ] ) }, + { "VertexWaterXGridCells1", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 0 ] ) }, + { "VertexWaterYGridCells1", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 0 ] ) }, + { "VertexWaterGridSize1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 0 ] ) }, + { "VertexWaterAttenuationA1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 0 ] ) }, + { "VertexWaterAttenuationB1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 0 ] ) }, + { "VertexWaterAttenuationC1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 0 ] ) }, + { "VertexWaterAttenuationRange1", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 0 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps2", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 1 ] ) }, - { "VertexWaterHeightClampLow2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 1 ] ) }, - { "VertexWaterHeightClampHi2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 1 ] ) }, - { "VertexWaterAngle2", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 1 ] ) }, - { "VertexWaterXPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 1 ] ) }, - { "VertexWaterYPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 1 ] ) }, - { "VertexWaterZPosition2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 1 ] ) }, - { "VertexWaterXGridCells2", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 1 ] ) }, - { "VertexWaterYGridCells2", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 1 ] ) }, - { "VertexWaterGridSize2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 1 ] ) }, - { "VertexWaterAttenuationA2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 1 ] ) }, - { "VertexWaterAttenuationB2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 1 ] ) }, - { "VertexWaterAttenuationC2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 1 ] ) }, - { "VertexWaterAttenuationRange2", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 1 ] ) }, + { "VertexWaterAvailableMaps2", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 1 ] ) }, + { "VertexWaterHeightClampLow2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 1 ] ) }, + { "VertexWaterHeightClampHi2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 1 ] ) }, + { "VertexWaterAngle2", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 1 ] ) }, + { "VertexWaterXPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 1 ] ) }, + { "VertexWaterYPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 1 ] ) }, + { "VertexWaterZPosition2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 1 ] ) }, + { "VertexWaterXGridCells2", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 1 ] ) }, + { "VertexWaterYGridCells2", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 1 ] ) }, + { "VertexWaterGridSize2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 1 ] ) }, + { "VertexWaterAttenuationA2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 1 ] ) }, + { "VertexWaterAttenuationB2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 1 ] ) }, + { "VertexWaterAttenuationC2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 1 ] ) }, + { "VertexWaterAttenuationRange2", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 1 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps3", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 2 ] ) }, - { "VertexWaterHeightClampLow3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 2 ] ) }, - { "VertexWaterHeightClampHi3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 2 ] ) }, - { "VertexWaterAngle3", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 2 ] ) }, - { "VertexWaterXPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 2 ] ) }, - { "VertexWaterYPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 2 ] ) }, - { "VertexWaterZPosition3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 2 ] ) }, - { "VertexWaterXGridCells3", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 2 ] ) }, - { "VertexWaterYGridCells3", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 2 ] ) }, - { "VertexWaterGridSize3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 2 ] ) }, - { "VertexWaterAttenuationA3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 2 ] ) }, - { "VertexWaterAttenuationB3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 2 ] ) }, - { "VertexWaterAttenuationC3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 2 ] ) }, - { "VertexWaterAttenuationRange3", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 2 ] ) }, + { "VertexWaterAvailableMaps3", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 2 ] ) }, + { "VertexWaterHeightClampLow3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 2 ] ) }, + { "VertexWaterHeightClampHi3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 2 ] ) }, + { "VertexWaterAngle3", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 2 ] ) }, + { "VertexWaterXPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 2 ] ) }, + { "VertexWaterYPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 2 ] ) }, + { "VertexWaterZPosition3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 2 ] ) }, + { "VertexWaterXGridCells3", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 2 ] ) }, + { "VertexWaterYGridCells3", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 2 ] ) }, + { "VertexWaterGridSize3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 2 ] ) }, + { "VertexWaterAttenuationA3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 2 ] ) }, + { "VertexWaterAttenuationB3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 2 ] ) }, + { "VertexWaterAttenuationC3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 2 ] ) }, + { "VertexWaterAttenuationRange3", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 2 ] ) }, // nasty ick, we need to save this data with a map and not hard code INI values - { "VertexWaterAvailableMaps4", INI::parseAsciiString, NULL, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 3 ] ) }, - { "VertexWaterHeightClampLow4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 3 ] ) }, - { "VertexWaterHeightClampHi4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 3 ] ) }, - { "VertexWaterAngle4", INI::parseAngleReal, NULL, offsetof( GlobalData, m_vertexWaterAngle[ 3 ] ) }, - { "VertexWaterXPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterXPosition[ 3 ] ) }, - { "VertexWaterYPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterYPosition[ 3 ] ) }, - { "VertexWaterZPosition4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterZPosition[ 3 ] ) }, - { "VertexWaterXGridCells4", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterXGridCells[ 3 ] ) }, - { "VertexWaterYGridCells4", INI::parseInt, NULL, offsetof( GlobalData, m_vertexWaterYGridCells[ 3 ] ) }, - { "VertexWaterGridSize4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterGridSize[ 3 ] ) }, - { "VertexWaterAttenuationA4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationA[ 3 ] ) }, - { "VertexWaterAttenuationB4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationB[ 3 ] ) }, - { "VertexWaterAttenuationC4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationC[ 3 ] ) }, - { "VertexWaterAttenuationRange4", INI::parseReal, NULL, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 3 ] ) }, - - { "SkyBoxPositionZ", INI::parseReal, NULL, offsetof( GlobalData, m_skyBoxPositionZ ) }, - { "SkyBoxScale", INI::parseReal, NULL, offsetof( GlobalData, m_skyBoxScale ) }, - { "DrawSkyBox", INI::parseBool, NULL, offsetof( GlobalData, m_drawSkyBox ) }, - { "ViewportHeightScale", INI::parseReal, NULL, offsetof( GlobalData, m_viewportHeightScale ) }, - { "CameraPitch", INI::parseReal, NULL, offsetof( GlobalData, m_cameraPitch ) }, - { "CameraYaw", INI::parseReal, NULL, offsetof( GlobalData, m_cameraYaw ) }, - { "CameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_cameraHeight ) }, - { "MaxCameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_maxCameraHeight ) }, - { "MinCameraHeight", INI::parseReal, NULL, offsetof( GlobalData, m_minCameraHeight ) }, - { "TerrainHeightAtEdgeOfMap", INI::parseReal, NULL, offsetof( GlobalData, m_terrainHeightAtEdgeOfMap ) }, - { "UnitDamagedThreshold", INI::parseReal, NULL, offsetof( GlobalData, m_unitDamagedThresh ) }, - { "UnitReallyDamagedThreshold", INI::parseReal, NULL, offsetof( GlobalData, m_unitReallyDamagedThresh ) }, - { "GroundStiffness", INI::parseReal, NULL, offsetof( GlobalData, m_groundStiffness ) }, - { "StructureStiffness", INI::parseReal, NULL, offsetof( GlobalData, m_structureStiffness ) }, - { "Gravity", INI::parseAccelerationReal, NULL, offsetof( GlobalData, m_gravity ) }, - { "StealthFriendlyOpacity", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_stealthFriendlyOpacity ) }, - { "DefaultOcclusionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_defaultOcclusionDelay ) }, - - { "PartitionCellSize", INI::parseReal, NULL, offsetof( GlobalData, m_partitionCellSize ) }, - - { "AmmoPipScaleFactor", INI::parseReal, NULL, offsetof( GlobalData, m_ammoPipScaleFactor ) }, - { "ContainerPipScaleFactor", INI::parseReal, NULL, offsetof( GlobalData, m_containerPipScaleFactor ) }, - { "AmmoPipWorldOffset", INI::parseCoord3D, NULL, offsetof( GlobalData, m_ammoPipWorldOffset ) }, - { "ContainerPipWorldOffset", INI::parseCoord3D, NULL, offsetof( GlobalData, m_containerPipWorldOffset ) }, - { "AmmoPipScreenOffset", INI::parseCoord2D, NULL, offsetof( GlobalData, m_ammoPipScreenOffset ) }, - { "ContainerPipScreenOffset", INI::parseCoord2D, NULL, offsetof( GlobalData, m_containerPipScreenOffset ) }, - - { "HistoricDamageLimit", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_historicDamageLimit ) }, - - { "MaxTerrainTracks", INI::parseInt, NULL, offsetof( GlobalData, m_maxTerrainTracks ) }, + { "VertexWaterAvailableMaps4", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_vertexWaterAvailableMaps[ 3 ] ) }, + { "VertexWaterHeightClampLow4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampLow[ 3 ] ) }, + { "VertexWaterHeightClampHi4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterHeightClampHi[ 3 ] ) }, + { "VertexWaterAngle4", INI::parseAngleReal, nullptr, offsetof( GlobalData, m_vertexWaterAngle[ 3 ] ) }, + { "VertexWaterXPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterXPosition[ 3 ] ) }, + { "VertexWaterYPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterYPosition[ 3 ] ) }, + { "VertexWaterZPosition4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterZPosition[ 3 ] ) }, + { "VertexWaterXGridCells4", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterXGridCells[ 3 ] ) }, + { "VertexWaterYGridCells4", INI::parseInt, nullptr, offsetof( GlobalData, m_vertexWaterYGridCells[ 3 ] ) }, + { "VertexWaterGridSize4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterGridSize[ 3 ] ) }, + { "VertexWaterAttenuationA4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationA[ 3 ] ) }, + { "VertexWaterAttenuationB4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationB[ 3 ] ) }, + { "VertexWaterAttenuationC4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationC[ 3 ] ) }, + { "VertexWaterAttenuationRange4", INI::parseReal, nullptr, offsetof( GlobalData, m_vertexWaterAttenuationRange[ 3 ] ) }, + + { "SkyBoxPositionZ", INI::parseReal, nullptr, offsetof( GlobalData, m_skyBoxPositionZ ) }, + { "SkyBoxScale", INI::parseReal, nullptr, offsetof( GlobalData, m_skyBoxScale ) }, + { "DrawSkyBox", INI::parseBool, nullptr, offsetof( GlobalData, m_drawSkyBox ) }, + { "ViewportHeightScale", INI::parseReal, nullptr, offsetof( GlobalData, m_viewportHeightScale ) }, + { "CameraPitch", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraPitch ) }, + { "CameraYaw", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraYaw ) }, + { "CameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraHeight ) }, + { "MaxCameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_maxCameraHeight ) }, + { "MinCameraHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_minCameraHeight ) }, + { "TerrainHeightAtEdgeOfMap", INI::parseReal, nullptr, offsetof( GlobalData, m_terrainHeightAtEdgeOfMap ) }, + { "UnitDamagedThreshold", INI::parseReal, nullptr, offsetof( GlobalData, m_unitDamagedThresh ) }, + { "UnitReallyDamagedThreshold", INI::parseReal, nullptr, offsetof( GlobalData, m_unitReallyDamagedThresh ) }, + { "GroundStiffness", INI::parseReal, nullptr, offsetof( GlobalData, m_groundStiffness ) }, + { "StructureStiffness", INI::parseReal, nullptr, offsetof( GlobalData, m_structureStiffness ) }, + { "Gravity", INI::parseAccelerationReal, nullptr, offsetof( GlobalData, m_gravity ) }, + { "StealthFriendlyOpacity", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_stealthFriendlyOpacity ) }, + { "DefaultOcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_defaultOcclusionDelay ) }, + + { "PartitionCellSize", INI::parseReal, nullptr, offsetof( GlobalData, m_partitionCellSize ) }, + + { "AmmoPipScaleFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_ammoPipScaleFactor ) }, + { "ContainerPipScaleFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_containerPipScaleFactor ) }, + { "AmmoPipWorldOffset", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_ammoPipWorldOffset ) }, + { "ContainerPipWorldOffset", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_containerPipWorldOffset ) }, + { "AmmoPipScreenOffset", INI::parseCoord2D, nullptr, offsetof( GlobalData, m_ammoPipScreenOffset ) }, + { "ContainerPipScreenOffset", INI::parseCoord2D, nullptr, offsetof( GlobalData, m_containerPipScreenOffset ) }, + + { "HistoricDamageLimit", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_historicDamageLimit ) }, + + { "MaxTerrainTracks", INI::parseInt, nullptr, offsetof( GlobalData, m_maxTerrainTracks ) }, { "TimeOfDay", INI::parseIndexList, TimeOfDayNames, offsetof( GlobalData, m_timeOfDay ) }, { "Weather", INI::parseIndexList, WeatherNames, offsetof( GlobalData, m_weather ) }, - { "MakeTrackMarks", INI::parseBool, NULL, offsetof( GlobalData, m_makeTrackMarks ) }, - { "HideGarrisonFlags", INI::parseBool, NULL, offsetof( GlobalData, m_hideGarrisonFlags ) }, - { "ForceModelsToFollowTimeOfDay", INI::parseBool, NULL, offsetof( GlobalData, m_forceModelsToFollowTimeOfDay ) }, - { "ForceModelsToFollowWeather", INI::parseBool, NULL, offsetof( GlobalData, m_forceModelsToFollowWeather ) }, - - { "LevelGainAnimationName", INI::parseAsciiString, NULL, offsetof( GlobalData, m_levelGainAnimationName ) }, - { "LevelGainAnimationTime", INI::parseReal, NULL, offsetof( GlobalData, m_levelGainAnimationDisplayTimeInSeconds ) }, - { "LevelGainAnimationZRise", INI::parseReal, NULL, offsetof( GlobalData, m_levelGainAnimationZRisePerSecond ) }, - - { "GetHealedAnimationName", INI::parseAsciiString, NULL, offsetof( GlobalData, m_getHealedAnimationName ) }, - { "GetHealedAnimationTime", INI::parseReal, NULL, offsetof( GlobalData, m_getHealedAnimationDisplayTimeInSeconds ) }, - { "GetHealedAnimationZRise", INI::parseReal, NULL, offsetof( GlobalData, m_getHealedAnimationZRisePerSecond ) }, - - { "TerrainLightingMorningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, - { "TerrainLightingMorningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, - { "TerrainLightingMorningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, - { "TerrainLightingAfternoonAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, - { "TerrainLightingAfternoonDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, - { "TerrainLightingAfternoonLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, - { "TerrainLightingEveningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, - { "TerrainLightingEveningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, - { "TerrainLightingEveningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, - { "TerrainLightingNightAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, - { "TerrainLightingNightDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, - { "TerrainLightingNightLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, - { "TerrainObjectsLightingNightAmbient", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, - { "TerrainObjectsLightingNightDiffuse", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, - { "TerrainObjectsLightingNightLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, + { "MakeTrackMarks", INI::parseBool, nullptr, offsetof( GlobalData, m_makeTrackMarks ) }, + { "HideGarrisonFlags", INI::parseBool, nullptr, offsetof( GlobalData, m_hideGarrisonFlags ) }, + { "ForceModelsToFollowTimeOfDay", INI::parseBool, nullptr, offsetof( GlobalData, m_forceModelsToFollowTimeOfDay ) }, + { "ForceModelsToFollowWeather", INI::parseBool, nullptr, offsetof( GlobalData, m_forceModelsToFollowWeather ) }, + + { "LevelGainAnimationName", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_levelGainAnimationName ) }, + { "LevelGainAnimationTime", INI::parseReal, nullptr, offsetof( GlobalData, m_levelGainAnimationDisplayTimeInSeconds ) }, + { "LevelGainAnimationZRise", INI::parseReal, nullptr, offsetof( GlobalData, m_levelGainAnimationZRisePerSecond ) }, + + { "GetHealedAnimationName", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_getHealedAnimationName ) }, + { "GetHealedAnimationTime", INI::parseReal, nullptr, offsetof( GlobalData, m_getHealedAnimationDisplayTimeInSeconds ) }, + { "GetHealedAnimationZRise", INI::parseReal, nullptr, offsetof( GlobalData, m_getHealedAnimationZRisePerSecond ) }, + + { "TerrainLightingMorningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, + { "TerrainLightingMorningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, + { "TerrainLightingMorningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, + { "TerrainLightingAfternoonAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, + { "TerrainLightingAfternoonDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, + { "TerrainLightingAfternoonLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, + { "TerrainLightingEveningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, + { "TerrainLightingEveningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, + { "TerrainLightingEveningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, + { "TerrainLightingNightAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, + { "TerrainLightingNightDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, + { "TerrainLightingNightLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][0].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][0].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][0].lightPos ) }, + { "TerrainObjectsLightingNightAmbient", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].ambient ) }, + { "TerrainObjectsLightingNightDiffuse", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].diffuse ) }, + { "TerrainObjectsLightingNightLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][0].lightPos ) }, //Secondary global light - { "TerrainLightingMorningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, - { "TerrainLightingMorningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, - { "TerrainLightingMorningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, - { "TerrainLightingAfternoonAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, - { "TerrainLightingAfternoonDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, - { "TerrainLightingAfternoonLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, - { "TerrainLightingEveningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, - { "TerrainLightingEveningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, - { "TerrainLightingEveningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, - { "TerrainLightingNightAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, - { "TerrainLightingNightDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, - { "TerrainLightingNightLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, - { "TerrainObjectsLightingNightAmbient2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, - { "TerrainObjectsLightingNightDiffuse2", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, - { "TerrainObjectsLightingNightLightPos2", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, + { "TerrainLightingMorningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, + { "TerrainLightingMorningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, + { "TerrainLightingMorningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, + { "TerrainLightingAfternoonAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, + { "TerrainLightingAfternoonDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, + { "TerrainLightingAfternoonLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, + { "TerrainLightingEveningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, + { "TerrainLightingEveningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, + { "TerrainLightingEveningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, + { "TerrainLightingNightAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, + { "TerrainLightingNightDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, + { "TerrainLightingNightLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][1].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][1].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][1].lightPos ) }, + { "TerrainObjectsLightingNightAmbient2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].ambient ) }, + { "TerrainObjectsLightingNightDiffuse2", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].diffuse ) }, + { "TerrainObjectsLightingNightLightPos2", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][1].lightPos ) }, //Third global light - { "TerrainLightingMorningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, - { "TerrainLightingMorningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, - { "TerrainLightingMorningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, - { "TerrainLightingAfternoonAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, - { "TerrainLightingAfternoonDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, - { "TerrainLightingAfternoonLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, - { "TerrainLightingEveningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, - { "TerrainLightingEveningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, - { "TerrainLightingEveningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, - { "TerrainLightingNightAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, - { "TerrainLightingNightDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, - { "TerrainLightingNightLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, - - { "TerrainObjectsLightingMorningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, - { "TerrainObjectsLightingMorningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, - { "TerrainObjectsLightingMorningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, - { "TerrainObjectsLightingAfternoonAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, - { "TerrainObjectsLightingAfternoonDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, - { "TerrainObjectsLightingAfternoonLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, - { "TerrainObjectsLightingEveningAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, - { "TerrainObjectsLightingEveningDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, - { "TerrainObjectsLightingEveningLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, - { "TerrainObjectsLightingNightAmbient3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, - { "TerrainObjectsLightingNightDiffuse3", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, - { "TerrainObjectsLightingNightLightPos3", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, - - - { "NumberGlobalLights", INI::parseInt, NULL, offsetof( GlobalData, m_numGlobalLights)}, - { "InfantryLightMorningScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_MORNING] ) }, - { "InfantryLightAfternoonScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_AFTERNOON] ) }, - { "InfantryLightEveningScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_EVENING] ) }, - { "InfantryLightNightScale", INI::parseReal, NULL, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_NIGHT] ) }, - - { "MaxTranslucentObjects", INI::parseInt, NULL, offsetof( GlobalData, m_maxVisibleTranslucentObjects) }, - { "OccludedColorLuminanceScale", INI::parseReal, NULL, offsetof( GlobalData, m_occludedLuminanceScale) }, + { "TerrainLightingMorningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, + { "TerrainLightingMorningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, + { "TerrainLightingMorningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, + { "TerrainLightingAfternoonAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, + { "TerrainLightingAfternoonDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, + { "TerrainLightingAfternoonLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, + { "TerrainLightingEveningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, + { "TerrainLightingEveningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, + { "TerrainLightingEveningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, + { "TerrainLightingNightAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, + { "TerrainLightingNightDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, + { "TerrainLightingNightLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, + + { "TerrainObjectsLightingMorningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].ambient ) }, + { "TerrainObjectsLightingMorningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].diffuse ) }, + { "TerrainObjectsLightingMorningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_MORNING ][2].lightPos ) }, + { "TerrainObjectsLightingAfternoonAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].ambient ) }, + { "TerrainObjectsLightingAfternoonDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].diffuse ) }, + { "TerrainObjectsLightingAfternoonLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_AFTERNOON ][2].lightPos ) }, + { "TerrainObjectsLightingEveningAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].ambient ) }, + { "TerrainObjectsLightingEveningDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].diffuse ) }, + { "TerrainObjectsLightingEveningLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_EVENING ][2].lightPos ) }, + { "TerrainObjectsLightingNightAmbient3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].ambient ) }, + { "TerrainObjectsLightingNightDiffuse3", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].diffuse ) }, + { "TerrainObjectsLightingNightLightPos3", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainObjectsLighting[ TIME_OF_DAY_NIGHT ][2].lightPos ) }, + + + { "NumberGlobalLights", INI::parseInt, nullptr, offsetof( GlobalData, m_numGlobalLights)}, + { "InfantryLightMorningScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_MORNING] ) }, + { "InfantryLightAfternoonScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_AFTERNOON] ) }, + { "InfantryLightEveningScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_EVENING] ) }, + { "InfantryLightNightScale", INI::parseReal, nullptr, offsetof( GlobalData, m_infantryLightScale[TIME_OF_DAY_NIGHT] ) }, + + { "MaxTranslucentObjects", INI::parseInt, nullptr, offsetof( GlobalData, m_maxVisibleTranslucentObjects) }, + { "OccludedColorLuminanceScale", INI::parseReal, nullptr, offsetof( GlobalData, m_occludedLuminanceScale) }, /* These are internal use only, they do not need file definitons - { "TerrainAmbientRGB", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainAmbient ) }, - { "TerrainDiffuseRGB", INI::parseRGBColor, NULL, offsetof( GlobalData, m_terrainDiffuse ) }, - { "TerrainLightPos", INI::parseCoord3D, NULL, offsetof( GlobalData, m_terrainLightPos ) }, + { "TerrainAmbientRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainAmbient ) }, + { "TerrainDiffuseRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainDiffuse ) }, + { "TerrainLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLightPos ) }, */ - { "MaxRoadSegments", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadSegments ) }, - { "MaxRoadVertex", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadVertex ) }, - { "MaxRoadIndex", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadIndex ) }, - { "MaxRoadTypes", INI::parseInt, NULL, offsetof( GlobalData, m_maxRoadTypes ) }, + { "MaxRoadSegments", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadSegments ) }, + { "MaxRoadVertex", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadVertex ) }, + { "MaxRoadIndex", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadIndex ) }, + { "MaxRoadTypes", INI::parseInt, nullptr, offsetof( GlobalData, m_maxRoadTypes ) }, - { "ValuePerSupplyBox", INI::parseInt, NULL, offsetof( GlobalData, m_baseValuePerSupplyBox ) }, + { "ValuePerSupplyBox", INI::parseInt, nullptr, offsetof( GlobalData, m_baseValuePerSupplyBox ) }, - { "AudioOn", INI::parseBool, NULL, offsetof( GlobalData, m_audioOn ) }, - { "MusicOn", INI::parseBool, NULL, offsetof( GlobalData, m_musicOn ) }, - { "SoundsOn", INI::parseBool, NULL, offsetof( GlobalData, m_soundsOn ) }, - { "Sounds3DOn", INI::parseBool, NULL, offsetof( GlobalData, m_sounds3DOn ) }, - { "SpeechOn", INI::parseBool, NULL, offsetof( GlobalData, m_speechOn ) }, - { "VideoOn", INI::parseBool, NULL, offsetof( GlobalData, m_videoOn ) }, - { "DisableCameraMovements", INI::parseBool, NULL, offsetof( GlobalData, m_disableCameraMovement ) }, + { "AudioOn", INI::parseBool, nullptr, offsetof( GlobalData, m_audioOn ) }, + { "MusicOn", INI::parseBool, nullptr, offsetof( GlobalData, m_musicOn ) }, + { "SoundsOn", INI::parseBool, nullptr, offsetof( GlobalData, m_soundsOn ) }, + { "Sounds3DOn", INI::parseBool, nullptr, offsetof( GlobalData, m_sounds3DOn ) }, + { "SpeechOn", INI::parseBool, nullptr, offsetof( GlobalData, m_speechOn ) }, + { "VideoOn", INI::parseBool, nullptr, offsetof( GlobalData, m_videoOn ) }, + { "DisableCameraMovements", INI::parseBool, nullptr, offsetof( GlobalData, m_disableCameraMovement ) }, /* These are internal use only, they do not need file definitons /// @todo remove this hack - { "InGame", INI::parseBool, NULL, offsetof( GlobalData, m_inGame ) }, + { "InGame", INI::parseBool, nullptr, offsetof( GlobalData, m_inGame ) }, */ - { "DebugAI", INI::parseBool, NULL, offsetof( GlobalData, m_debugAI ) }, - { "DebugAIObstacles", INI::parseBool, NULL, offsetof( GlobalData, m_debugAIObstacles ) }, - { "ShowClientPhysics", INI::parseBool, NULL, offsetof( GlobalData, m_showClientPhysics ) }, - { "ShowTerrainNormals", INI::parseBool, NULL, offsetof( GlobalData, m_showTerrainNormals ) }, - { "ShowObjectHealth", INI::parseBool, NULL, offsetof( GlobalData, m_showObjectHealth ) }, - - { "ParticleScale", INI::parseReal, NULL, offsetof( GlobalData, m_particleScale ) }, - { "AutoFireParticleSmallPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleSmallPrefix ) }, - { "AutoFireParticleSmallSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleSmallSystem ) }, - { "AutoFireParticleSmallMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleSmallMax ) }, - { "AutoFireParticleMediumPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleMediumPrefix ) }, - { "AutoFireParticleMediumSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleMediumSystem ) }, - { "AutoFireParticleMediumMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleMediumMax ) }, - { "AutoFireParticleLargePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleLargePrefix ) }, - { "AutoFireParticleLargeSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoFireParticleLargeSystem ) }, - { "AutoFireParticleLargeMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoFireParticleLargeMax ) }, - { "AutoSmokeParticleSmallPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallPrefix ) }, - { "AutoSmokeParticleSmallSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallSystem ) }, - { "AutoSmokeParticleSmallMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleSmallMax ) }, - { "AutoSmokeParticleMediumPrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumPrefix ) }, - { "AutoSmokeParticleMediumSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumSystem ) }, - { "AutoSmokeParticleMediumMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleMediumMax ) }, - { "AutoSmokeParticleLargePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleLargePrefix ) }, - { "AutoSmokeParticleLargeSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoSmokeParticleLargeSystem ) }, - { "AutoSmokeParticleLargeMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoSmokeParticleLargeMax ) }, - { "AutoAflameParticlePrefix", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoAflameParticlePrefix ) }, - { "AutoAflameParticleSystem", INI::parseAsciiString, NULL, offsetof( GlobalData, m_autoAflameParticleSystem ) }, - { "AutoAflameParticleMax", INI::parseInt, NULL, offsetof( GlobalData, m_autoAflameParticleMax ) }, + { "DebugAI", INI::parseBool, nullptr, offsetof( GlobalData, m_debugAI ) }, + { "DebugAIObstacles", INI::parseBool, nullptr, offsetof( GlobalData, m_debugAIObstacles ) }, + { "ShowClientPhysics", INI::parseBool, nullptr, offsetof( GlobalData, m_showClientPhysics ) }, + { "ShowTerrainNormals", INI::parseBool, nullptr, offsetof( GlobalData, m_showTerrainNormals ) }, + { "ShowObjectHealth", INI::parseBool, nullptr, offsetof( GlobalData, m_showObjectHealth ) }, + + { "ParticleScale", INI::parseReal, nullptr, offsetof( GlobalData, m_particleScale ) }, + { "AutoFireParticleSmallPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleSmallPrefix ) }, + { "AutoFireParticleSmallSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleSmallSystem ) }, + { "AutoFireParticleSmallMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleSmallMax ) }, + { "AutoFireParticleMediumPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleMediumPrefix ) }, + { "AutoFireParticleMediumSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleMediumSystem ) }, + { "AutoFireParticleMediumMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleMediumMax ) }, + { "AutoFireParticleLargePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleLargePrefix ) }, + { "AutoFireParticleLargeSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoFireParticleLargeSystem ) }, + { "AutoFireParticleLargeMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoFireParticleLargeMax ) }, + { "AutoSmokeParticleSmallPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallPrefix ) }, + { "AutoSmokeParticleSmallSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallSystem ) }, + { "AutoSmokeParticleSmallMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleSmallMax ) }, + { "AutoSmokeParticleMediumPrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumPrefix ) }, + { "AutoSmokeParticleMediumSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumSystem ) }, + { "AutoSmokeParticleMediumMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleMediumMax ) }, + { "AutoSmokeParticleLargePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargePrefix ) }, + { "AutoSmokeParticleLargeSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargeSystem ) }, + { "AutoSmokeParticleLargeMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoSmokeParticleLargeMax ) }, + { "AutoAflameParticlePrefix", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoAflameParticlePrefix ) }, + { "AutoAflameParticleSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoAflameParticleSystem ) }, + { "AutoAflameParticleMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoAflameParticleMax ) }, /* These are internal use only, they do not need file definitons - { "LatencyAverage", INI::parseInt, NULL, offsetof( GlobalData, m_latencyAverage ) }, - { "LatencyAmplitude", INI::parseInt, NULL, offsetof( GlobalData, m_latencyAmplitude ) }, - { "LatencyPeriod", INI::parseInt, NULL, offsetof( GlobalData, m_latencyPeriod ) }, - { "LatencyNoise", INI::parseInt, NULL, offsetof( GlobalData, m_latencyNoise ) }, - { "PacketLoss", INI::parseInt, NULL, offsetof( GlobalData, m_packetLoss ) }, + { "LatencyAverage", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAverage ) }, + { "LatencyAmplitude", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAmplitude ) }, + { "LatencyPeriod", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyPeriod ) }, + { "LatencyNoise", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyNoise ) }, + { "PacketLoss", INI::parseInt, nullptr, offsetof( GlobalData, m_packetLoss ) }, */ - { "BuildSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_BuildSpeed ) }, - { "MinDistFromEdgeOfMapForBuild", INI::parseReal, NULL, offsetof( GlobalData, m_MinDistFromEdgeOfMapForBuild ) }, - { "SupplyBuildBorder", INI::parseReal, NULL, offsetof( GlobalData, m_SupplyBuildBorder ) }, - { "AllowedHeightVariationForBuilding", INI::parseReal,NULL, offsetof( GlobalData, m_allowedHeightVariationForBuilding ) }, - { "MinLowEnergyProductionSpeed",INI::parseReal, NULL, offsetof( GlobalData, m_MinLowEnergyProductionSpeed ) }, - { "MaxLowEnergyProductionSpeed",INI::parseReal, NULL, offsetof( GlobalData, m_MaxLowEnergyProductionSpeed ) }, - { "LowEnergyPenaltyModifier", INI::parseReal, NULL, offsetof( GlobalData, m_LowEnergyPenaltyModifier ) }, - { "MultipleFactory", INI::parseReal, NULL, offsetof( GlobalData, m_MultipleFactory ) }, - { "RefundPercent", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_RefundPercent ) }, - - { "CommandCenterHealRange", INI::parseReal, NULL, offsetof( GlobalData, m_commandCenterHealRange ) }, - { "CommandCenterHealAmount", INI::parseReal, NULL, offsetof( GlobalData, m_commandCenterHealAmount ) }, - - { "StandardMinefieldDensity", INI::parseReal, NULL, offsetof( GlobalData, m_standardMinefieldDensity ) }, - { "StandardMinefieldDistance", INI::parseReal, NULL, offsetof( GlobalData, m_standardMinefieldDistance ) }, - - { "MaxLineBuildObjects", INI::parseInt, NULL, offsetof( GlobalData, m_maxLineBuildObjects ) }, - { "MaxTunnelCapacity", INI::parseInt, NULL, offsetof( GlobalData, m_maxTunnelCapacity ) }, - - { "MaxParticleCount", INI::parseInt, NULL, offsetof( GlobalData, m_maxParticleCount ) }, - { "MaxFieldParticleCount", INI::parseInt, NULL, offsetof( GlobalData, m_maxFieldParticleCount ) }, - { "HorizontalScrollSpeedFactor",INI::parseReal, NULL, offsetof( GlobalData, m_horizontalScrollSpeedFactor ) }, - { "VerticalScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_verticalScrollSpeedFactor ) }, - { "ScrollAmountCutoff", INI::parseReal, NULL, offsetof( GlobalData, m_scrollAmountCutoff ) }, - { "CameraAdjustSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAdjustSpeed ) }, - { "EnforceMaxCameraHeight", INI::parseBool, NULL, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, - { "KeyboardScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardScrollFactor ) }, - { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, - { "KeyboardCameraRotateSpeed", INI::parseReal, NULL, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, + { "BuildSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_BuildSpeed ) }, + { "MinDistFromEdgeOfMapForBuild", INI::parseReal, nullptr, offsetof( GlobalData, m_MinDistFromEdgeOfMapForBuild ) }, + { "SupplyBuildBorder", INI::parseReal, nullptr, offsetof( GlobalData, m_SupplyBuildBorder ) }, + { "AllowedHeightVariationForBuilding", INI::parseReal,nullptr, offsetof( GlobalData, m_allowedHeightVariationForBuilding ) }, + { "MinLowEnergyProductionSpeed",INI::parseReal, nullptr, offsetof( GlobalData, m_MinLowEnergyProductionSpeed ) }, + { "MaxLowEnergyProductionSpeed",INI::parseReal, nullptr, offsetof( GlobalData, m_MaxLowEnergyProductionSpeed ) }, + { "LowEnergyPenaltyModifier", INI::parseReal, nullptr, offsetof( GlobalData, m_LowEnergyPenaltyModifier ) }, + { "MultipleFactory", INI::parseReal, nullptr, offsetof( GlobalData, m_MultipleFactory ) }, + { "RefundPercent", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_RefundPercent ) }, + + { "CommandCenterHealRange", INI::parseReal, nullptr, offsetof( GlobalData, m_commandCenterHealRange ) }, + { "CommandCenterHealAmount", INI::parseReal, nullptr, offsetof( GlobalData, m_commandCenterHealAmount ) }, + + { "StandardMinefieldDensity", INI::parseReal, nullptr, offsetof( GlobalData, m_standardMinefieldDensity ) }, + { "StandardMinefieldDistance", INI::parseReal, nullptr, offsetof( GlobalData, m_standardMinefieldDistance ) }, + + { "MaxLineBuildObjects", INI::parseInt, nullptr, offsetof( GlobalData, m_maxLineBuildObjects ) }, + { "MaxTunnelCapacity", INI::parseInt, nullptr, offsetof( GlobalData, m_maxTunnelCapacity ) }, + + { "MaxParticleCount", INI::parseInt, nullptr, offsetof( GlobalData, m_maxParticleCount ) }, + { "MaxFieldParticleCount", INI::parseInt, nullptr, offsetof( GlobalData, m_maxFieldParticleCount ) }, + { "HorizontalScrollSpeedFactor",INI::parseReal, nullptr, offsetof( GlobalData, m_horizontalScrollSpeedFactor ) }, + { "VerticalScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_verticalScrollSpeedFactor ) }, + { "ScrollAmountCutoff", INI::parseReal, nullptr, offsetof( GlobalData, m_scrollAmountCutoff ) }, + { "CameraAdjustSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraAdjustSpeed ) }, + { "EnforceMaxCameraHeight", INI::parseBool, nullptr, offsetof( GlobalData, m_enforceMaxCameraHeight ) }, + { "KeyboardScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardScrollFactor ) }, + { "KeyboardDefaultScrollSpeedFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardDefaultScrollFactor ) }, + { "KeyboardCameraRotateSpeed", INI::parseReal, nullptr, offsetof( GlobalData, m_keyboardCameraRotateSpeed ) }, { "MovementPenaltyDamageState", INI::parseIndexList, TheBodyDamageTypeNames, offsetof( GlobalData, m_movementPenaltyDamageState ) }, // you cannot set this; it always has a value of 100%. -//{ "HealthBonus_Regular", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_REGULAR]) }, - { "HealthBonus_Veteran", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_VETERAN]) }, - { "HealthBonus_Elite", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_ELITE]) }, - { "HealthBonus_Heroic", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_healthBonus[LEVEL_HEROIC]) }, +//{ "HealthBonus_Regular", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_REGULAR]) }, + { "HealthBonus_Veteran", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_VETERAN]) }, + { "HealthBonus_Elite", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_ELITE]) }, + { "HealthBonus_Heroic", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_healthBonus[LEVEL_HEROIC]) }, - { "HumanSoloPlayerHealthBonus_Easy", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_EASY] ) }, - { "HumanSoloPlayerHealthBonus_Normal", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_NORMAL] ) }, - { "HumanSoloPlayerHealthBonus_Hard", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_HARD] ) }, + { "HumanSoloPlayerHealthBonus_Easy", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_EASY] ) }, + { "HumanSoloPlayerHealthBonus_Normal", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_NORMAL] ) }, + { "HumanSoloPlayerHealthBonus_Hard", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_HUMAN][DIFFICULTY_HARD] ) }, - { "AISoloPlayerHealthBonus_Easy", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_EASY] ) }, - { "AISoloPlayerHealthBonus_Normal", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_NORMAL] ) }, - { "AISoloPlayerHealthBonus_Hard", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_HARD] ) }, + { "AISoloPlayerHealthBonus_Easy", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_EASY] ) }, + { "AISoloPlayerHealthBonus_Normal", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_NORMAL] ) }, + { "AISoloPlayerHealthBonus_Hard", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_soloPlayerHealthBonusForDifficulty[PLAYER_COMPUTER][DIFFICULTY_HARD] ) }, - { "WeaponBonus", WeaponBonusSet::parseWeaponBonusSetPtr, NULL, offsetof( GlobalData, m_weaponBonusSet ) }, + { "WeaponBonus", WeaponBonusSet::parseWeaponBonusSetPtr, nullptr, offsetof( GlobalData, m_weaponBonusSet ) }, - { "DefaultStructureRubbleHeight", INI::parseReal, NULL, offsetof( GlobalData, m_defaultStructureRubbleHeight ) }, + { "DefaultStructureRubbleHeight", INI::parseReal, nullptr, offsetof( GlobalData, m_defaultStructureRubbleHeight ) }, - { "FixedSeed", INI::parseInt, NULL, offsetof( GlobalData, m_fixedSeed ) }, + { "FixedSeed", INI::parseInt, nullptr, offsetof( GlobalData, m_fixedSeed ) }, - { "ShellMapName", INI::parseAsciiString,NULL, offsetof( GlobalData, m_shellMapName ) }, - { "ShellMapOn", INI::parseBool, NULL, offsetof( GlobalData, m_shellMapOn ) }, - { "PlayIntro", INI::parseBool, NULL, offsetof( GlobalData, m_playIntro ) }, + { "ShellMapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_shellMapName ) }, + { "ShellMapOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shellMapOn ) }, + { "PlayIntro", INI::parseBool, nullptr, offsetof( GlobalData, m_playIntro ) }, - { "FirewallBehavior", INI::parseInt, NULL, offsetof( GlobalData, m_firewallBehavior ) }, - { "FirewallPortOverride", INI::parseInt, NULL, offsetof( GlobalData, m_firewallPortOverride ) }, - { "FirewallPortAllocationDelta",INI::parseInt, NULL, offsetof( GlobalData, m_firewallPortAllocationDelta) }, + { "FirewallBehavior", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallBehavior ) }, + { "FirewallPortOverride", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortOverride ) }, + { "FirewallPortAllocationDelta",INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortAllocationDelta) }, - { "GroupSelectMinSelectSize", INI::parseInt, NULL, offsetof( GlobalData, m_groupSelectMinSelectSize ) }, - { "GroupSelectVolumeBase", INI::parseReal, NULL, offsetof( GlobalData, m_groupSelectVolumeBase ) }, - { "GroupSelectVolumeIncrement", INI::parseReal, NULL, offsetof( GlobalData, m_groupSelectVolumeIncrement ) }, - { "MaxUnitSelectSounds", INI::parseInt, NULL, offsetof( GlobalData, m_maxUnitSelectSounds ) }, + { "GroupSelectMinSelectSize", INI::parseInt, nullptr, offsetof( GlobalData, m_groupSelectMinSelectSize ) }, + { "GroupSelectVolumeBase", INI::parseReal, nullptr, offsetof( GlobalData, m_groupSelectVolumeBase ) }, + { "GroupSelectVolumeIncrement", INI::parseReal, nullptr, offsetof( GlobalData, m_groupSelectVolumeIncrement ) }, + { "MaxUnitSelectSounds", INI::parseInt, nullptr, offsetof( GlobalData, m_maxUnitSelectSounds ) }, - { "SelectionFlashSaturationFactor", INI::parseReal, NULL, offsetof( GlobalData, m_selectionFlashSaturationFactor ) }, - { "SelectionFlashHouseColor", INI::parseBool, NULL, offsetof( GlobalData, m_selectionFlashHouseColor ) }, + { "SelectionFlashSaturationFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_selectionFlashSaturationFactor ) }, + { "SelectionFlashHouseColor", INI::parseBool, nullptr, offsetof( GlobalData, m_selectionFlashHouseColor ) }, - { "CameraAudibleRadius", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAudibleRadius ) }, - { "GroupMoveClickToGatherAreaFactor", INI::parseReal, NULL, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) }, + { "CameraAudibleRadius", INI::parseReal, nullptr, offsetof( GlobalData, m_cameraAudibleRadius ) }, + { "GroupMoveClickToGatherAreaFactor", INI::parseReal, nullptr, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) }, #if !PRESERVE_RETAIL_BEHAVIOR - { "AllowMoneyPerMinuteForPlayer", INI::parseBool, NULL, offsetof( GlobalData, m_allowMoneyPerMinuteForPlayer ) }, + { "AllowMoneyPerMinuteForPlayer", INI::parseBool, nullptr, offsetof( GlobalData, m_allowMoneyPerMinuteForPlayer ) }, #endif - { "ShakeSubtleIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSubtleIntensity ) }, - { "ShakeNormalIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeNormalIntensity ) }, - { "ShakeStrongIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeStrongIntensity ) }, - { "ShakeSevereIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSevereIntensity ) }, - { "ShakeCineExtremeIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeCineExtremeIntensity ) }, - { "ShakeCineInsaneIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeCineInsaneIntensity ) }, - { "MaxShakeIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_maxShakeIntensity ) }, - { "MaxShakeRange", INI::parseReal, NULL, offsetof( GlobalData, m_maxShakeRange) }, - { "SellPercentage", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_sellPercentage ) }, - { "BaseRegenHealthPercentPerSecond", INI::parsePercentToReal, NULL, offsetof( GlobalData, m_baseRegenHealthPercentPerSecond ) }, - { "BaseRegenDelay", INI::parseDurationUnsignedInt, NULL,offsetof( GlobalData, m_baseRegenDelay ) }, + { "ShakeSubtleIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeSubtleIntensity ) }, + { "ShakeNormalIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeNormalIntensity ) }, + { "ShakeStrongIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeStrongIntensity ) }, + { "ShakeSevereIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeSevereIntensity ) }, + { "ShakeCineExtremeIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeCineExtremeIntensity ) }, + { "ShakeCineInsaneIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_shakeCineInsaneIntensity ) }, + { "MaxShakeIntensity", INI::parseReal, nullptr, offsetof( GlobalData, m_maxShakeIntensity ) }, + { "MaxShakeRange", INI::parseReal, nullptr, offsetof( GlobalData, m_maxShakeRange) }, + { "SellPercentage", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_sellPercentage ) }, + { "BaseRegenHealthPercentPerSecond", INI::parsePercentToReal, nullptr, offsetof( GlobalData, m_baseRegenHealthPercentPerSecond ) }, + { "BaseRegenDelay", INI::parseDurationUnsignedInt, nullptr,offsetof( GlobalData, m_baseRegenDelay ) }, #ifdef ALLOW_SURRENDER - { "PrisonBountyMultiplier", INI::parseReal, NULL, offsetof( GlobalData, m_prisonBountyMultiplier ) }, - { "PrisonBountyTextColor", INI::parseColorInt, NULL, offsetof( GlobalData, m_prisonBountyTextColor ) }, + { "PrisonBountyMultiplier", INI::parseReal, nullptr, offsetof( GlobalData, m_prisonBountyMultiplier ) }, + { "PrisonBountyTextColor", INI::parseColorInt, nullptr, offsetof( GlobalData, m_prisonBountyTextColor ) }, #endif - { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, + { "SpecialPowerViewObject", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_specialPowerViewObjectName ) }, // TheSuperHackers @feature Customize the opacity (0..1) and shadows of build preview objects. Shadows are enabled by default. // Note that disabling shadows loses a fair bit of contrast visually and warrants raising the opacity. - { "ObjectPlacementOpacity", INI::parseReal, NULL, offsetof( GlobalData, m_objectPlacementOpacity ) }, - { "ObjectPlacementShadows", INI::parseBool, NULL, offsetof( GlobalData, m_objectPlacementShadows ) }, + { "ObjectPlacementOpacity", INI::parseReal, nullptr, offsetof( GlobalData, m_objectPlacementOpacity ) }, + { "ObjectPlacementShadows", INI::parseBool, nullptr, offsetof( GlobalData, m_objectPlacementShadows ) }, - { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, - { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, - { "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, + { "StandardPublicBone", INI::parseAsciiStringVectorAppend, nullptr, offsetof(GlobalData, m_standardPublicBones) }, + { "ShowMetrics", INI::parseBool, nullptr, offsetof( GlobalData, m_showMetrics ) }, + { "DefaultStartingCash", Money::parseMoneyAmount, nullptr, offsetof( GlobalData, m_defaultStartingCash ) }, // NOTE: m_doubleClickTimeMS is still in use, but we disallow setting it from the GameData.ini file. It is now set in the constructor according to the windows parameter. -// { "DoubleClickTimeMS", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_doubleClickTimeMS ) }, +// { "DoubleClickTimeMS", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_doubleClickTimeMS ) }, - { "ShroudColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_shroudColor) }, - { "ClearAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_clearAlpha) }, - { "FogAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_fogAlpha) }, - { "ShroudAlpha", INI::parseUnsignedByte, NULL, offsetof( GlobalData, m_shroudAlpha) }, + { "ShroudColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_shroudColor) }, + { "ClearAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_clearAlpha) }, + { "FogAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_fogAlpha) }, + { "ShroudAlpha", INI::parseUnsignedByte, nullptr, offsetof( GlobalData, m_shroudAlpha) }, - { "HotKeyTextColor", INI::parseColorInt, NULL, offsetof( GlobalData, m_hotKeyTextColor ) }, + { "HotKeyTextColor", INI::parseColorInt, nullptr, offsetof( GlobalData, m_hotKeyTextColor ) }, - { "PowerBarBase", INI::parseInt, NULL, offsetof( GlobalData, m_powerBarBase) }, - { "PowerBarIntervals", INI::parseReal, NULL, offsetof( GlobalData, m_powerBarIntervals) }, - { "PowerBarYellowRange", INI::parseInt, NULL, offsetof( GlobalData, m_powerBarYellowRange) }, - { "UnlookPersistDuration", INI::parseDurationUnsignedInt, NULL, offsetof( GlobalData, m_unlookPersistDuration) }, + { "PowerBarBase", INI::parseInt, nullptr, offsetof( GlobalData, m_powerBarBase) }, + { "PowerBarIntervals", INI::parseReal, nullptr, offsetof( GlobalData, m_powerBarIntervals) }, + { "PowerBarYellowRange", INI::parseInt, nullptr, offsetof( GlobalData, m_powerBarYellowRange) }, + { "UnlookPersistDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( GlobalData, m_unlookPersistDuration) }, - { "NetworkFPSHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkFPSHistoryLength) }, - { "NetworkLatencyHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkLatencyHistoryLength) }, - { "NetworkRunAheadMetricsTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkRunAheadMetricsTime) }, - { "NetworkCushionHistoryLength", INI::parseInt, NULL, offsetof(GlobalData, m_networkCushionHistoryLength) }, - { "NetworkRunAheadSlack", INI::parseInt, NULL, offsetof(GlobalData, m_networkRunAheadSlack) }, - { "NetworkKeepAliveDelay", INI::parseInt, NULL, offsetof(GlobalData, m_networkKeepAliveDelay) }, - { "NetworkDisconnectTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectTime) }, - { "NetworkPlayerTimeoutTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, - { "NetworkDisconnectScreenNotifyTime", INI::parseInt, NULL, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, + { "NetworkFPSHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkFPSHistoryLength) }, + { "NetworkLatencyHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkLatencyHistoryLength) }, + { "NetworkRunAheadMetricsTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkRunAheadMetricsTime) }, + { "NetworkCushionHistoryLength", INI::parseInt, nullptr, offsetof(GlobalData, m_networkCushionHistoryLength) }, + { "NetworkRunAheadSlack", INI::parseInt, nullptr, offsetof(GlobalData, m_networkRunAheadSlack) }, + { "NetworkKeepAliveDelay", INI::parseInt, nullptr, offsetof(GlobalData, m_networkKeepAliveDelay) }, + { "NetworkDisconnectTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkDisconnectTime) }, + { "NetworkPlayerTimeoutTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkPlayerTimeoutTime) }, + { "NetworkDisconnectScreenNotifyTime", INI::parseInt, nullptr, offsetof(GlobalData, m_networkDisconnectScreenNotifyTime) }, - { "PlayStats", INI::parseInt, NULL, offsetof( GlobalData, m_playStats ) }, + { "PlayStats", INI::parseInt, nullptr, offsetof( GlobalData, m_playStats ) }, #if defined(RTS_DEBUG) - { "DisableCameraFade", INI::parseBool, NULL, offsetof( GlobalData, m_disableCameraFade ) }, - { "DisableScriptedInputDisabling", INI::parseBool, NULL, offsetof( GlobalData, m_disableScriptedInputDisabling ) }, - { "DisableMilitaryCaption", INI::parseBool, NULL, offsetof( GlobalData, m_disableMilitaryCaption ) }, - { "BenchmarkTimer", INI::parseInt, NULL, offsetof( GlobalData, m_benchmarkTimer ) }, - { "CheckMemoryLeaks", INI::parseBool, NULL, offsetof(GlobalData, m_checkForLeaks) }, - { "Wireframe", INI::parseBool, NULL, offsetof( GlobalData, m_wireframe ) }, - { "StateMachineDebug", INI::parseBool, NULL, offsetof( GlobalData, m_stateMachineDebug ) }, - { "UseCameraConstraints", INI::parseBool, NULL, offsetof( GlobalData, m_useCameraConstraints ) }, - { "ShroudOn", INI::parseBool, NULL, offsetof( GlobalData, m_shroudOn ) }, - { "FogOfWarOn", INI::parseBool, NULL, offsetof( GlobalData, m_fogOfWarOn ) }, - { "ShowCollisionExtents", INI::parseBool, NULL, offsetof( GlobalData, m_showCollisionExtents ) }, - { "ShowAudioLocations", INI::parseBool, NULL, offsetof( GlobalData, m_showAudioLocations ) }, - { "DebugProjectileTileWidth", INI::parseReal, NULL, offsetof( GlobalData, m_debugProjectileTileWidth) }, - { "DebugProjectileTileDuration",INI::parseInt, NULL, offsetof( GlobalData, m_debugProjectileTileDuration) }, - { "DebugProjectileTileColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugProjectileTileColor) }, - { "DebugVisibilityTileCount", INI::parseInt, NULL, offsetof( GlobalData, m_debugVisibilityTileCount) }, - { "DebugVisibilityTileWidth", INI::parseReal, NULL, offsetof( GlobalData, m_debugVisibilityTileWidth) }, - { "DebugVisibilityTileDuration",INI::parseInt, NULL, offsetof( GlobalData, m_debugVisibilityTileDuration) }, - { "DebugVisibilityTileTargettableColor",INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityTargettableColor) }, - { "DebugVisibilityTileDeshroudColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityDeshroudColor) }, - { "DebugVisibilityTileGapColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugVisibilityGapColor) }, - { "DebugThreatMapTileDuration", INI::parseInt, NULL, offsetof( GlobalData, m_debugThreatMapTileDuration) }, - { "MaxDebugThreatMapValue", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_maxDebugThreat) }, - { "DebugCashValueMapTileDuration", INI::parseInt, NULL, offsetof( GlobalData, m_debugCashValueMapTileDuration) }, - { "MaxDebugCashValueMapValue", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_maxDebugValue) }, - { "VTune", INI::parseBool, NULL, offsetof( GlobalData, m_vTune ) }, - { "SaveStats", INI::parseBool, NULL, offsetof( GlobalData, m_saveStats ) }, - { "UseLocalMOTD", INI::parseBool, NULL, offsetof( GlobalData, m_useLocalMOTD ) }, - { "BaseStatsDir", INI::parseAsciiString,NULL, offsetof( GlobalData, m_baseStatsDir ) }, - { "LocalMOTDPath", INI::parseAsciiString,NULL, offsetof( GlobalData, m_MOTDPath ) }, - { "ExtraLogging", INI::parseBool, NULL, offsetof( GlobalData, m_extraLogging ) }, + { "DisableCameraFade", INI::parseBool, nullptr, offsetof( GlobalData, m_disableCameraFade ) }, + { "DisableScriptedInputDisabling", INI::parseBool, nullptr, offsetof( GlobalData, m_disableScriptedInputDisabling ) }, + { "DisableMilitaryCaption", INI::parseBool, nullptr, offsetof( GlobalData, m_disableMilitaryCaption ) }, + { "BenchmarkTimer", INI::parseInt, nullptr, offsetof( GlobalData, m_benchmarkTimer ) }, + { "CheckMemoryLeaks", INI::parseBool, nullptr, offsetof(GlobalData, m_checkForLeaks) }, + { "Wireframe", INI::parseBool, nullptr, offsetof( GlobalData, m_wireframe ) }, + { "StateMachineDebug", INI::parseBool, nullptr, offsetof( GlobalData, m_stateMachineDebug ) }, + { "UseCameraConstraints", INI::parseBool, nullptr, offsetof( GlobalData, m_useCameraConstraints ) }, + { "ShroudOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shroudOn ) }, + { "FogOfWarOn", INI::parseBool, nullptr, offsetof( GlobalData, m_fogOfWarOn ) }, + { "ShowCollisionExtents", INI::parseBool, nullptr, offsetof( GlobalData, m_showCollisionExtents ) }, + { "ShowAudioLocations", INI::parseBool, nullptr, offsetof( GlobalData, m_showAudioLocations ) }, + { "DebugProjectileTileWidth", INI::parseReal, nullptr, offsetof( GlobalData, m_debugProjectileTileWidth) }, + { "DebugProjectileTileDuration",INI::parseInt, nullptr, offsetof( GlobalData, m_debugProjectileTileDuration) }, + { "DebugProjectileTileColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugProjectileTileColor) }, + { "DebugVisibilityTileCount", INI::parseInt, nullptr, offsetof( GlobalData, m_debugVisibilityTileCount) }, + { "DebugVisibilityTileWidth", INI::parseReal, nullptr, offsetof( GlobalData, m_debugVisibilityTileWidth) }, + { "DebugVisibilityTileDuration",INI::parseInt, nullptr, offsetof( GlobalData, m_debugVisibilityTileDuration) }, + { "DebugVisibilityTileTargettableColor",INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityTargettableColor) }, + { "DebugVisibilityTileDeshroudColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityDeshroudColor) }, + { "DebugVisibilityTileGapColor", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_debugVisibilityGapColor) }, + { "DebugThreatMapTileDuration", INI::parseInt, nullptr, offsetof( GlobalData, m_debugThreatMapTileDuration) }, + { "MaxDebugThreatMapValue", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_maxDebugThreat) }, + { "DebugCashValueMapTileDuration", INI::parseInt, nullptr, offsetof( GlobalData, m_debugCashValueMapTileDuration) }, + { "MaxDebugCashValueMapValue", INI::parseUnsignedInt, nullptr, offsetof( GlobalData, m_maxDebugValue) }, + { "VTune", INI::parseBool, nullptr, offsetof( GlobalData, m_vTune ) }, + { "SaveStats", INI::parseBool, nullptr, offsetof( GlobalData, m_saveStats ) }, + { "UseLocalMOTD", INI::parseBool, nullptr, offsetof( GlobalData, m_useLocalMOTD ) }, + { "BaseStatsDir", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_baseStatsDir ) }, + { "LocalMOTDPath", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_MOTDPath ) }, + { "ExtraLogging", INI::parseBool, nullptr, offsetof( GlobalData, m_extraLogging ) }, #endif - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -548,14 +548,14 @@ GlobalData::GlobalData() Int i, j; // - // we have now instanced a global data instance, if theOriginal is NULL, this is + // we have now instanced a global data instance, if theOriginal is null, this is // *the* very first instance and it shall be recorded. This way, when we load // overrides of the global data, we can revert to the common, original data // in m_theOriginal // - if( m_theOriginal == NULL ) + if( m_theOriginal == nullptr ) m_theOriginal = this; - m_next = NULL; + m_next = nullptr; #if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) m_specialPowerUsesDelay = TRUE; @@ -1038,7 +1038,7 @@ GlobalData::GlobalData() // Set user data directory based on registry settings instead of INI parameters. This allows us to // localize the leaf name. char temp[_MAX_PATH + 1]; - if (::SHGetSpecialFolderPath(NULL, temp, CSIDL_PERSONAL, true)) + if (::SHGetSpecialFolderPath(nullptr, temp, CSIDL_PERSONAL, true)) { AsciiString myDocumentsDirectory = temp; @@ -1058,7 +1058,7 @@ GlobalData::GlobalData() if (myDocumentsDirectory.getCharAt( myDocumentsDirectory.getLength() - 1) != '\\') myDocumentsDirectory.concat( '\\' ); - CreateDirectory(myDocumentsDirectory.str(), NULL); + CreateDirectory(myDocumentsDirectory.str(), nullptr); m_userDataDir = myDocumentsDirectory; } @@ -1074,13 +1074,13 @@ GlobalData::GlobalData() //------------------------------------------------------------------------------------------------- GlobalData::~GlobalData( void ) { - DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("~GlobalData: theOriginal is not original") ); + DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == nullptr, ("~GlobalData: theOriginal is not original") ); deleteInstance(m_weaponBonusSet); if( m_theOriginal == this ) { - m_theOriginal = NULL; - TheWritableGlobalData = NULL; + m_theOriginal = nullptr; + TheWritableGlobalData = nullptr; } } @@ -1169,7 +1169,7 @@ void GlobalData::reset( void ) // we now have the one single global data in TheWritableGlobalData singleton, lets sanity check // some of all that // - DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == NULL, ("ResetGlobalData: theOriginal is not original") ); + DEBUG_ASSERTCRASH( TheWritableGlobalData->m_next == nullptr, ("ResetGlobalData: theOriginal is not original") ); DEBUG_ASSERTCRASH( TheWritableGlobalData == GlobalData::m_theOriginal, ("ResetGlobalData: oops") ); } @@ -1258,7 +1258,7 @@ void GlobalData::parseCustomDefinition() UnsignedInt GlobalData::generateExeCRC() { - DEBUG_ASSERTCRASH(TheFileSystem != NULL, ("TheFileSystem is NULL")); + DEBUG_ASSERTCRASH(TheFileSystem != nullptr, ("TheFileSystem is null")); // lets CRC the executable! Whee! const Int blockSize = 65536; @@ -1278,9 +1278,9 @@ UnsignedInt GlobalData::generateExeCRC() #else { Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); fp = TheFileSystem->openFile(buffer, File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1289,7 +1289,7 @@ UnsignedInt GlobalData::generateExeCRC() } DEBUG_LOG(("EXE CRC is 0x%8.8X", exeCRC.get())); fp->close(); - fp = NULL; + fp = nullptr; } else { DEBUG_CRASH(("Executable file has failed to open")); @@ -1305,7 +1305,7 @@ UnsignedInt GlobalData::generateExeCRC() } // Add in MP scripts to the EXE CRC, since the game will go out of sync if they change fp = TheFileSystem->openFile("Data\\Scripts\\SkirmishScripts.scb", File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1313,10 +1313,10 @@ UnsignedInt GlobalData::generateExeCRC() exeCRC.computeCRC(crcBlock, amtRead); } fp->close(); - fp = NULL; + fp = nullptr; } fp = TheFileSystem->openFile("Data\\Scripts\\MultiplayerScripts.scb", File::READ | File::BINARY); - if (fp != NULL) { + if (fp != nullptr) { unsigned char crcBlock[blockSize]; Int amtRead = 0; while ( (amtRead=fp->read(crcBlock, blockSize)) > 0 ) @@ -1324,7 +1324,7 @@ UnsignedInt GlobalData::generateExeCRC() exeCRC.computeCRC(crcBlock, amtRead); } fp->close(); - fp = NULL; + fp = nullptr; } DEBUG_LOG(("EXE+Version(%d.%d)+SCB CRC is 0x%8.8X", version >> 16, version & 0xffff, exeCRC.get())); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index edda2599bfc..b91fa9eb3f6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -64,7 +64,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -static Xfer *s_xfer = NULL; +static Xfer *s_xfer = nullptr; //------------------------------------------------------------------------------------------------- /** This is the table of data types we can have in INI files. To add a new data type @@ -141,7 +141,7 @@ static const BlockParse theTypeTable[] = { "ScriptAction", ScriptEngine::parseScriptAction }, { "ScriptCondition", ScriptEngine::parseScriptCondition }, - { NULL, NULL }, + { nullptr, nullptr }, }; @@ -150,7 +150,7 @@ static const BlockParse theTypeTable[] = /////////////////////////////////////////////////////////////////////////////////////////////////// Bool INI::isValidINIFilename( const char *filename ) { - if( filename == NULL ) + if( filename == nullptr ) return FALSE; Int len = strlen( filename ); @@ -179,7 +179,7 @@ Bool INI::isValidINIFilename( const char *filename ) INI::INI( void ) { - m_file = NULL; + m_file = nullptr; m_readBufferNext=m_readBufferUsed=0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; @@ -267,7 +267,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer AsciiString tempname; tempname = (*it).str() + dirName.getLength(); - if ((tempname.find('\\') == NULL) && (tempname.find('/') == NULL)) { + if ((tempname.find('\\') == nullptr) && (tempname.find('/') == nullptr)) { // this file doesn't reside in a subdirectory, load it first. filesRead += load( *it, loadType, pXfer ); } @@ -280,7 +280,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer AsciiString tempname; tempname = (*it).str() + dirName.getLength(); - if ((tempname.find('\\') != NULL) || (tempname.find('/') != NULL)) { + if ((tempname.find('\\') != nullptr) || (tempname.find('/') != nullptr)) { filesRead += load( *it, loadType, pXfer ); } ++it; @@ -300,7 +300,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer void INI::prepFile( AsciiString filename, INILoadType loadType ) { // if we have a file open already -- we can't do another one - if( m_file != NULL ) + if( m_file != nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); @@ -310,7 +310,7 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) // open the file m_file = TheFileSystem->openFile(filename.str(), File::READ); - if( m_file == NULL ) + if( m_file == nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); @@ -333,13 +333,13 @@ void INI::unPrepFile() { // close the file m_file->close(); - m_file = NULL; + m_file = nullptr; m_readBufferUsed=m_readBufferNext=0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; m_endOfFile = FALSE; - s_xfer = NULL; + s_xfer = nullptr; } //------------------------------------------------------------------------------------------------- @@ -352,7 +352,7 @@ static INIBlockParse findBlockParse(const char* token) return parse->parse; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -377,7 +377,7 @@ static INIFieldParseProc findFieldParse(const FieldParse* parseTable, const char } else { - return NULL; + return nullptr; } } @@ -459,7 +459,7 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) void INI::readLine( void ) { // sanity - DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is NULL") ); + DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is null") ); if (m_endOfFile) *m_buffer=0; @@ -712,7 +712,7 @@ void INI::parseAsciiStringVector( INI* ini, void * /*instance*/, void *store, co { std::vector* asv = (std::vector*)store; asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { asv->push_back(token); } @@ -725,7 +725,7 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto std::vector* asv = (std::vector*)store; // nope, don't clear. duh. // asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { asv->push_back(token); } @@ -737,7 +737,7 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto { ScienceVec* asv = (ScienceVec*)store; asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (stricmp(token, "None") == 0) { @@ -757,7 +757,7 @@ AsciiString INI::getNextQuotedAsciiString() buff[0] = '\0'; const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != NULL) + if (token != nullptr) { if (token[0] != '\"') { @@ -805,7 +805,7 @@ AsciiString INI::getNextAsciiString() AsciiString result; const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != NULL) + if (token != nullptr) { if (token[0] != '\"') { @@ -898,7 +898,7 @@ void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const vo else { - DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is NULL" )); + DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is null" )); throw INI_UNKNOWN_ERROR; } @@ -925,7 +925,7 @@ void INI::parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void INI::parseBitString8( INI* ini, void * /*instance*/, void *store, const void* userData ) { UnsignedInt tmp; - INI::parseBitString32(ini, NULL, &tmp, userData); + INI::parseBitString32(ini, nullptr, &tmp, userData); if (tmp & 0xffffff00) { DEBUG_CRASH(("Bad bitstring list INI::parseBitString8")); @@ -944,7 +944,7 @@ void INI::parseBitString32( INI* ini, void * /*instance*/, void *store, const vo ConstCharPtrArray flagList = (ConstCharPtrArray)userData; UnsignedInt *bits = (UnsignedInt *)store; - if( flagList == NULL || flagList[ 0 ] == NULL) + if( flagList == nullptr || flagList[ 0 ] == nullptr) { DEBUG_ASSERTCRASH( flagList, ("INTERNAL ERROR! parseBitString32: No flag list provided!") ); throw INI_INVALID_NAME_LIST; @@ -954,7 +954,7 @@ void INI::parseBitString32( INI* ini, void * /*instance*/, void *store, const vo Bool foundAddOrSub = false; // loop through all tokens - for (const char *token = ini->getNextTokenOrNull(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) { if (stricmp(token, "NONE") == 0) { @@ -1047,7 +1047,7 @@ void INI::parseRGBAColorInt( INI* ini, void * /*instance*/, void *store, const v for( Int i = 0; i < 4; i++ ) { const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == NULL) + if (token == nullptr) { if (i < 3) { @@ -1099,7 +1099,7 @@ void INI::parseColorInt( INI* ini, void * /*instance*/, void *store, const void* for( Int i = 0; i < 4; i++ ) { const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == NULL) + if (token == nullptr) { if (i < 3) { @@ -1187,11 +1187,11 @@ void INI::parseDynamicAudioEventRTS( INI *ini, void * /*instance*/, void *store, if (stricmp(token, "NoSound") == 0) { deleteInstance(*theSound); - *theSound = NULL; + *theSound = nullptr; } else { - if (*theSound == NULL) + if (*theSound == nullptr) *theSound = newInstance(DynamicAudioEventRTS); (*theSound)->m_event.setEventName(AsciiString(token)); } @@ -1235,7 +1235,7 @@ void INI::parseThingTemplate( INI* ini, void * /*instance*/, void *store, const if (stricmp(token, "None") == 0) { - *theThingTemplate = NULL; + *theThingTemplate = nullptr; } else { @@ -1259,7 +1259,7 @@ void INI::parseArmorTemplate( INI* ini, void * /*instance*/, void *store, const if (stricmp(token, "None") == 0) { - *theArmorTemplate = NULL; + *theArmorTemplate = nullptr; } else { @@ -1299,7 +1299,7 @@ void INI::parseFXList( INI* ini, void * /*instance*/, void *store, const void* / ConstFXListPtr* theFXList = (ConstFXListPtr*)store; const FXList *fxl = TheFXListStore->findFXList(token); // could be null! - DEBUG_ASSERTCRASH(fxl != NULL || stricmp(token, "None") == 0, ("FXList %s not found!",token)); + DEBUG_ASSERTCRASH(fxl != nullptr || stricmp(token, "None") == 0, ("FXList %s not found!",token)); // assign it, even if null! *theFXList = fxl; @@ -1334,7 +1334,7 @@ void INI::parseDamageFX( INI* ini, void * /*instance*/, void *store, const void* if (stricmp(token, "None") == 0) { - *theDamageFX = NULL; + *theDamageFX = nullptr; } else { @@ -1512,7 +1512,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList { Bool done = FALSE; - if( what == NULL ) + if( what == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INI::initFromINI - Invalid parameters supplied!") ); throw INI_INVALID_PARAMS; @@ -1540,7 +1540,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList for (int ptIdx = 0; ptIdx < parseTableList.getCount(); ++ptIdx) { int offset = 0; - const void* userData = 0; + const void* userData = nullptr; INIFieldParseProc parse = findFieldParse(parseTableList.getNthFieldParse(ptIdx), field, offset, userData); if (parse) { @@ -1594,7 +1594,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList /*static*/ const char* INI::getNextToken(const char* seps) { if (!seps) seps = getSeps(); - const char *token = ::strtok(NULL, seps); + const char *token = ::strtok(nullptr, seps); if (!token) throw INI_INVALID_DATA; return token; @@ -1604,7 +1604,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList /*static*/ const char* INI::getNextTokenOrNull(const char* seps) { if (!seps) seps = getSeps(); - const char *token = ::strtok(NULL, seps); + const char *token = ::strtok(nullptr, seps); return token; } @@ -1653,7 +1653,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList //------------------------------------------------------------------------------------------------- /*static*/ Int INI::scanIndexList(const char* token, ConstCharPtrArray nameList) { - if( nameList == NULL || nameList[ 0 ] == NULL ) + if( nameList == nullptr || nameList[ 0 ] == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanIndexList, invalid name list") ); @@ -1679,7 +1679,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList //------------------------------------------------------------------------------------------------- /*static*/ Int INI::scanLookupList(const char* token, ConstLookupListRecArray lookupList) { - if( lookupList == NULL || lookupList[ 0 ].name == NULL ) + if( lookupList == nullptr || lookupList[ 0 ].name == nullptr ) { DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanLookupList, invalid name list") ); throw INI_INVALID_NAME_LIST; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp index 7300b1ebc74..fe994c3745f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAnimation.cpp @@ -60,7 +60,7 @@ void INI::parseAnim2DDefinition( INI* ini ) // find existing animation template if present animTemplate = TheAnim2DCollection->findTemplate( name ); - if( animTemplate == NULL ) + if( animTemplate == nullptr ) { // item not found, create a new one diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp index 67b6216c7c8..7d0c5425969 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp @@ -53,7 +53,7 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) // find existing item if present CommandButton *button = TheControlBar->findNonConstCommandButton( name ); - if( button == NULL ) + if( button == nullptr ) { // allocate a new item button = TheControlBar->newCommandButton( name ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp index a732029ae73..8c939923cb5 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIDrawGroupInfo.cpp @@ -36,7 +36,7 @@ void parseInt( INI* ini, void * /*instance*/, void *store, const void* userData ) { DrawGroupInfo *dgi = (DrawGroupInfo*) store; - if (userData == 0) { + if (userData == nullptr) { store = &dgi->m_pixelOffsetX; dgi->m_usingPixelOffsetX = TRUE; } else { @@ -44,13 +44,13 @@ void parseInt( INI* ini, void * /*instance*/, void *store, const void* userData dgi->m_usingPixelOffsetY = TRUE; } - INI::parseInt(ini, NULL, store, NULL); + INI::parseInt(ini, nullptr, store, nullptr); } void parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* userData ) { DrawGroupInfo *dgi = (DrawGroupInfo*) store; - if (userData == 0) { + if (userData == nullptr) { store = &dgi->m_pixelOffsetX; dgi->m_usingPixelOffsetX = FALSE; } else { @@ -58,26 +58,26 @@ void parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* dgi->m_usingPixelOffsetY = FALSE; } - INI::parsePercentToReal(ini, NULL, store, NULL); + INI::parsePercentToReal(ini, nullptr, store, nullptr); } const FieldParse DrawGroupInfo::s_fieldParseTable[] = { - { "UsePlayerColor", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_usePlayerColor) }, - { "ColorForText", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForText ) }, - { "ColorForTextDropShadow", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForTextDropShadow ) }, + { "UsePlayerColor", INI::parseBool, nullptr, offsetof( DrawGroupInfo, m_usePlayerColor) }, + { "ColorForText", INI::parseColorInt, nullptr, offsetof( DrawGroupInfo, m_colorForText ) }, + { "ColorForTextDropShadow", INI::parseColorInt, nullptr, offsetof( DrawGroupInfo, m_colorForTextDropShadow ) }, - { "FontName", INI::parseQuotedAsciiString, NULL, offsetof( DrawGroupInfo, m_fontName ) }, - { "FontSize", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_fontSize ) }, - { "FontIsBold", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_fontIsBold ) }, - { "DropShadowOffsetX", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetX) }, - { "DropShadowOffsetY", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetY) }, - { "DrawPositionXPixel", parseInt, (void*)0, 0 }, - { "DrawPositionXPercent", parsePercentToReal, (void*)0, 0 }, + { "FontName", INI::parseQuotedAsciiString, nullptr, offsetof( DrawGroupInfo, m_fontName ) }, + { "FontSize", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_fontSize ) }, + { "FontIsBold", INI::parseBool, nullptr, offsetof( DrawGroupInfo, m_fontIsBold ) }, + { "DropShadowOffsetX", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_dropShadowOffsetX) }, + { "DropShadowOffsetY", INI::parseInt, nullptr, offsetof( DrawGroupInfo, m_dropShadowOffsetY) }, + { "DrawPositionXPixel", parseInt, (void*)nullptr, 0 }, + { "DrawPositionXPercent", parsePercentToReal, (void*)nullptr, 0 }, { "DrawPositionYPixel", parseInt, (void*)1, 0 }, { "DrawPositionYPercent", parsePercentToReal, (void*)1, 0 }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; /*static */ void INI::parseDrawGroupNumberDefinition(INI* ini) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp index 00e6a6cabbf..2e67cfae62d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMapCache.cpp @@ -67,7 +67,7 @@ void parseSupplyPositionCoord3D( INI* ini, void * instance, void * /*store*/, co { MapMetaDataReader *mmdr = (MapMetaDataReader *)instance; Coord3D coord3d; - INI::parseCoord3D(ini, NULL, &coord3d,NULL ); + INI::parseCoord3D(ini, nullptr, &coord3d,nullptr ); mmdr->m_supplyPositions.push_front(coord3d); } @@ -76,7 +76,7 @@ void parseTechPositionsCoord3D( INI* ini, void * instance, void * /*store*/, con { MapMetaDataReader *mmdr = (MapMetaDataReader *)instance; Coord3D coord3d; - INI::parseCoord3D(ini, NULL, &coord3d,NULL ); + INI::parseCoord3D(ini, nullptr, &coord3d,nullptr ); mmdr->m_techPositions.push_front(coord3d); } @@ -84,33 +84,33 @@ void parseTechPositionsCoord3D( INI* ini, void * instance, void * /*store*/, con const FieldParse MapMetaDataReader::m_mapFieldParseTable[] = { - { "isOfficial", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isOfficial ) }, - { "isMultiplayer", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isMultiplayer ) }, - { "extentMin", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.lo ) }, - { "extentMax", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.hi ) }, - { "numPlayers", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_numPlayers ) }, - { "fileSize", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_filesize ) }, - { "fileCRC", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_CRC ) }, - { "timestampLo", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_lowTimeStamp ) }, - { "timestampHi", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_highTimeStamp ) }, - { "displayName", INI::parseAsciiString, NULL, offsetof( MapMetaDataReader, m_asciiDisplayName ) }, - { "nameLookupTag", INI::parseAsciiString, NULL, offsetof( MapMetaDataReader, m_asciiNameLookupTag ) }, - - { "supplyPosition", parseSupplyPositionCoord3D, NULL, NULL }, - { "techPosition", parseTechPositionsCoord3D, NULL, NULL }, - - { "Player_1_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) }, - { "Player_2_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 1 }, - { "Player_3_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 2 }, - { "Player_4_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 3 }, - { "Player_5_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 4 }, - { "Player_6_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 5 }, - { "Player_7_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 6 }, - { "Player_8_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 7 }, - - { "InitialCameraPosition", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, - - { NULL, NULL, NULL, 0 } + { "isOfficial", INI::parseBool, nullptr, offsetof( MapMetaDataReader, m_isOfficial ) }, + { "isMultiplayer", INI::parseBool, nullptr, offsetof( MapMetaDataReader, m_isMultiplayer ) }, + { "extentMin", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_extent.lo ) }, + { "extentMax", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_extent.hi ) }, + { "numPlayers", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_numPlayers ) }, + { "fileSize", INI::parseUnsignedInt, nullptr, offsetof( MapMetaDataReader, m_filesize ) }, + { "fileCRC", INI::parseUnsignedInt, nullptr, offsetof( MapMetaDataReader, m_CRC ) }, + { "timestampLo", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_timestamp.m_lowTimeStamp ) }, + { "timestampHi", INI::parseInt, nullptr, offsetof( MapMetaDataReader, m_timestamp.m_highTimeStamp ) }, + { "displayName", INI::parseAsciiString, nullptr, offsetof( MapMetaDataReader, m_asciiDisplayName ) }, + { "nameLookupTag", INI::parseAsciiString, nullptr, offsetof( MapMetaDataReader, m_asciiNameLookupTag ) }, + + { "supplyPosition", parseSupplyPositionCoord3D, nullptr, 0 }, + { "techPosition", parseTechPositionsCoord3D, nullptr, 0 }, + + { "Player_1_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) }, + { "Player_2_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 1 }, + { "Player_3_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 2 }, + { "Player_4_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 3 }, + { "Player_5_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 4 }, + { "Player_6_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 5 }, + { "Player_7_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 6 }, + { "Player_8_Start", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 7 }, + + { "InitialCameraPosition", INI::parseCoord3D, nullptr, offsetof( MapMetaDataReader, m_initialCameraPosition ) }, + + { nullptr, nullptr, nullptr, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index f7a4c801543..9c7fb4bd213 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -59,7 +59,7 @@ void INI::parseMappedImageDefinition( INI* ini ) if(image) DEBUG_ASSERTCRASH(!image->getRawTextureData(), ("We are trying to parse over an existing image that contains a non-null rawTextureData, you should fix that")); - if( image == NULL ) + if( image == nullptr ) { // image not found, create a new one diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index 380c5e2548f..ed7840d7bd5 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -69,7 +69,7 @@ void INI::parseMultiplayerColorDefinition( INI* ini ) // find existing item if present, but this type does not allow overrides, //so if it exists just overwrite it. multiplayerColorDefinition = TheMultiplayerSettings->findMultiplayerColorDefinitionByName( name ); - if( multiplayerColorDefinition == NULL ) + if( multiplayerColorDefinition == nullptr ) multiplayerColorDefinition = TheMultiplayerSettings->newMultiplayerColorDefinition( name ); ini->initFromINI( multiplayerColorDefinition, multiplayerColorDefinition->getFieldParse() ); @@ -88,9 +88,9 @@ namespace const FieldParse startingMoneyFieldParseTable[] = { - { "Value", Money::parseMoneyAmount, NULL, offsetof( MultiplayerStartingMoneySettings, money ) }, - { "Default", INI::parseBool, NULL, offsetof( MultiplayerStartingMoneySettings, isDefault ) }, - { NULL, NULL, NULL, 0 } + { "Value", Money::parseMoneyAmount, nullptr, offsetof( MultiplayerStartingMoneySettings, money ) }, + { "Default", INI::parseBool, nullptr, offsetof( MultiplayerStartingMoneySettings, isDefault ) }, + { nullptr, nullptr, nullptr, 0 } }; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp index 617f3963638..fd0b84d5182 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIParticleSys.cpp @@ -46,7 +46,7 @@ void INI::parseParticleSystemDefinition( INI* ini ) // find existing item if present ParticleSystemTemplate *sysTemplate = const_cast(TheParticleSystemManager->findTemplate( name )); - if (sysTemplate == NULL) + if (sysTemplate == nullptr) { // no item is present, create a new one sysTemplate = TheParticleSystemManager->newTemplate( name ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp index ae6e2c92815..cff4840ca0f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrain.cpp @@ -47,7 +47,7 @@ void INI::parseTerrainDefinition( INI* ini ) // find existing item if present terrainType = TheTerrainTypes->findTerrain( name ); - if( terrainType == NULL ) + if( terrainType == nullptr ) terrainType = TheTerrainTypes->newTerrain( name ); // sanity diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index 3ad8a5d3eed..2bcb705c19b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -59,7 +59,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) } - if( bridge == NULL ) + if( bridge == nullptr ) bridge = TheTerrainRoads->newBridge( name ); DEBUG_ASSERTCRASH( bridge, ("Unable to allcoate bridge '%s'", name.str()) ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp index 99b5ec9ebf8..719d1b9c881 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainRoad.cpp @@ -59,7 +59,7 @@ void INI::parseTerrainRoadDefinition( INI* ini ) } - if( road == NULL ) + if( road == nullptr ) road = TheTerrainRoads->newRoad( name ); DEBUG_ASSERTCRASH( road, ("Unable to allocate road '%s'", name.str()) ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp index d3894bf3eac..3ec7eddfcb4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWater.cpp @@ -49,7 +49,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) { AsciiString name; - WaterSetting *waterSetting = NULL; + WaterSetting *waterSetting = nullptr; // read the name const char* token = ini->getNextToken(); @@ -77,7 +77,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) } // check for no time of day match - if( waterSetting == NULL ) + if( waterSetting == nullptr ) throw INI_INVALID_DATA; // parse the data @@ -88,7 +88,7 @@ void INI::parseWaterSettingDefinition( INI* ini ) //------------------------------------------------------------------------------------------------- void INI::parseWaterTransparencyDefinition( INI *ini ) { - if (TheWaterTransparency == NULL) { + if (TheWaterTransparency == nullptr) { TheWaterTransparency = newInstance(WaterTransparencySetting); } else if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { WaterTransparencySetting* wt = (WaterTransparencySetting*) (TheWaterTransparency.getNonOverloadedPointer()); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp index 8efd3aef39f..17908288d94 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIWebpageURL.cpp @@ -84,11 +84,11 @@ void INI::parseWebpageURLDefinition( INI* ini ) const char* c = ini->getNextToken(); tag.set( c ); - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { url = TheWebBrowser->findURL(tag); - if (url == NULL) + if (url == nullptr) { url = TheWebBrowser->makeNewURL(tag); } @@ -96,7 +96,7 @@ void INI::parseWebpageURLDefinition( INI* ini ) // find existing item if present // track = TheAudio->Music->getTrack( name ); -// if( track == NULL ) +// if( track == nullptr ) // { // allocate a new track diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp index 1acee2d16fa..e4b39574979 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp @@ -37,8 +37,8 @@ #include "GameLogic/GameLogic.h" /// The singleton message stream for messages going to TheGameLogic -MessageStream *TheMessageStream = NULL; -CommandList *TheCommandList = NULL; +MessageStream *TheMessageStream = nullptr; +CommandList *TheCommandList = nullptr; @@ -56,10 +56,10 @@ GameMessage::GameMessage( GameMessage::Type type ) { m_playerIndex = ThePlayerList->getLocalPlayer()->getPlayerIndex(); m_type = type; - m_argList = NULL; - m_argTail = NULL; + m_argList = nullptr; + m_argTail = nullptr; m_argCount = 0; - m_list = 0; + m_list = nullptr; } @@ -111,7 +111,7 @@ GameMessageArgumentDataType GameMessage::getArgumentDataType( Int argIndex ) GameMessageArgument *a = m_argList; for (; a && (i < argIndex); a=a->m_next, ++i ); - if (a != NULL) + if (a != nullptr) { return a->m_type; } @@ -135,7 +135,7 @@ GameMessageArgument *GameMessage::allocArg( void ) m_argTail = arg; } - arg->m_next = NULL; + arg->m_next = nullptr; m_argTail = arg; m_argCount++; @@ -710,8 +710,8 @@ const char *GameMessage::getCommandTypeAsString(GameMessage::Type t) */ GameMessageList::GameMessageList( void ) { - m_firstMessage = 0; - m_lastMessage = 0; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } /** @@ -726,7 +726,7 @@ GameMessageList::~GameMessageList() nextMsg = msg->next(); // set list ptr to null to avoid it trying to remove itself from the list // that we are in the process of nuking... - msg->friend_setList(NULL); + msg->friend_setList(nullptr); deleteInstance(msg); } } @@ -736,7 +736,7 @@ GameMessageList::~GameMessageList() */ void GameMessageList::appendMessage( GameMessage *msg ) { - msg->friend_setNext(NULL); + msg->friend_setNext(nullptr); if (m_lastMessage) { @@ -749,7 +749,7 @@ void GameMessageList::appendMessage( GameMessage *msg ) // first message m_firstMessage = msg; m_lastMessage = msg; - msg->friend_setPrev(NULL); + msg->friend_setPrev(nullptr); } // note containment within message itself @@ -795,7 +795,7 @@ void GameMessageList::removeMessage( GameMessage *msg ) else m_firstMessage = msg->next(); - msg->friend_setList(NULL); + msg->friend_setList(nullptr); } /** @@ -823,7 +823,7 @@ Bool GameMessageList::containsMessageOfType( GameMessage::Type type ) */ MessageStream::MessageStream( void ) { - m_firstTranslator = 0; + m_firstTranslator = nullptr; m_nextTranslatorID = 1; } @@ -890,7 +890,7 @@ GameMessage *MessageStream::appendMessage( GameMessage::Type type ) /** * Create a new message of the given message type and insert it - * in the stream after messageToInsertAfter, which must not be NULL. + * in the stream after messageToInsertAfter, which must not be nullptr. */ GameMessage *MessageStream::insertMessage( GameMessage::Type type, GameMessage *messageToInsertAfter ) { @@ -918,11 +918,11 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, newSS->m_priority = priority; newSS->m_id = m_nextTranslatorID++; - if (m_firstTranslator == NULL) + if (m_firstTranslator == nullptr) { // first Translator to be attached - newSS->m_prev = NULL; - newSS->m_next = NULL; + newSS->m_prev = nullptr; + newSS->m_next = nullptr; m_firstTranslator = newSS; m_lastTranslator = newSS; return newSS->m_id; @@ -947,7 +947,7 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, else { // insert at head of list - newSS->m_prev = NULL; + newSS->m_prev = nullptr; newSS->m_next = m_firstTranslator; m_firstTranslator->m_prev = newSS; m_firstTranslator = newSS; @@ -958,7 +958,7 @@ TranslatorID MessageStream::attachTranslator( GameMessageTranslator *translator, // append Translator to end of list m_lastTranslator->m_next = newSS; newSS->m_prev = m_lastTranslator; - newSS->m_next = NULL; + newSS->m_next = nullptr; m_lastTranslator = newSS; } @@ -980,7 +980,7 @@ GameMessageTranslator* MessageStream::findTranslator( TranslatorID id ) } - return NULL; + return nullptr; } @@ -1129,8 +1129,8 @@ void MessageStream::propagateMessages( void ) TheCommandList->appendMessageList( m_firstMessage ); // clear the stream - m_firstMessage = NULL; - m_lastMessage = NULL; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } @@ -1204,8 +1204,8 @@ void CommandList::destroyAllMessages( void ) deleteInstance(msg); } - m_firstMessage = NULL; - m_lastMessage = NULL; + m_firstMessage = nullptr; + m_lastMessage = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp index 7d3945c75ea..d74f485686b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp @@ -35,7 +35,7 @@ LogClass::LogClass(const char *fname) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index d23ec32b56c..30dccadc621 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -38,7 +38,7 @@ #include "GameNetwork/GameInfo.h" // for PLAYERTEMPLATE_* // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -MultiplayerSettings *TheMultiplayerSettings = NULL; ///< The MultiplayerSettings singleton +MultiplayerSettings *TheMultiplayerSettings = nullptr; ///< The MultiplayerSettings singleton /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -46,24 +46,24 @@ MultiplayerSettings *TheMultiplayerSettings = NULL; ///< The MultiplayerSetti const FieldParse MultiplayerColorDefinition::m_colorFieldParseTable[] = { - { "TooltipName", INI::parseAsciiString, NULL, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, - { "RGBColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, - { "RGBNightColor", INI::parseRGBColor, NULL, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, - { NULL, NULL, NULL, 0 } + { "TooltipName", INI::parseAsciiString, nullptr, offsetof( MultiplayerColorDefinition, m_tooltipName ) }, + { "RGBColor", INI::parseRGBColor, nullptr, offsetof( MultiplayerColorDefinition, m_rgbValue ) }, + { "RGBNightColor", INI::parseRGBColor, nullptr, offsetof( MultiplayerColorDefinition, m_rgbValueNight ) }, + { nullptr, nullptr, nullptr, 0 } }; const FieldParse MultiplayerSettings::m_multiplayerSettingsFieldParseTable[] = { - { "StartCountdownTimer", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_startCountdownTimerSeconds ) }, - { "MaxBeaconsPerPlayer", INI::parseInt, NULL, offsetof( MultiplayerSettings, m_maxBeaconsPerPlayer ) }, - { "UseShroud", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_isShroudInMultiplayer ) }, - { "ShowRandomPlayerTemplate", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomPlayerTemplate ) }, - { "ShowRandomStartPos", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, - { "ShowRandomColor", INI::parseBool, NULL, offsetof( MultiplayerSettings, m_showRandomColor ) }, + { "StartCountdownTimer", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_startCountdownTimerSeconds ) }, + { "MaxBeaconsPerPlayer", INI::parseInt, nullptr, offsetof( MultiplayerSettings, m_maxBeaconsPerPlayer ) }, + { "UseShroud", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_isShroudInMultiplayer ) }, + { "ShowRandomPlayerTemplate", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomPlayerTemplate ) }, + { "ShowRandomStartPos", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomStartPos ) }, + { "ShowRandomColor", INI::parseBool, nullptr, offsetof( MultiplayerSettings, m_showRandomColor ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -107,7 +107,7 @@ MultiplayerColorDefinition * MultiplayerSettings::getColor(Int which) } else if (which < 0 || which >= getNumColors()) { - return NULL; + return nullptr; } return &m_colorList[which]; @@ -125,7 +125,7 @@ MultiplayerColorDefinition * MultiplayerSettings::findMultiplayerColorDefinition ++iter; } - return NULL; + return nullptr; } MultiplayerColorDefinition * MultiplayerSettings::newMultiplayerColorDefinition(AsciiString name) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index 44894061dab..7f700e779d9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -31,7 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine // Public Data //////////////////////////////////////////////////////////////////////////////////// -NameKeyGenerator *TheNameKeyGenerator = NULL; ///< name key gen. singleton +NameKeyGenerator *TheNameKeyGenerator = nullptr; ///< name key gen. singleton //------------------------------------------------------------------------------------------------- NameKeyGenerator::NameKeyGenerator() @@ -40,7 +40,7 @@ NameKeyGenerator::NameKeyGenerator() m_nextID = (UnsignedInt)NAMEKEY_INVALID; // uninitialized system for (Int i = 0; i < SOCKET_COUNT; ++i) - m_sockets[i] = NULL; + m_sockets[i] = nullptr; } @@ -83,7 +83,7 @@ void NameKeyGenerator::freeSockets() next = b->m_nextInSocket; deleteInstance(b); } - m_sockets[i] = NULL; + m_sockets[i] = nullptr; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp index 336cffbc838..50c75c8cc7f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -252,7 +252,7 @@ class PerfMetricsOutput //------------------------------------------------------------------------------------------------- static PerfMetricsOutput s_output; -static FILE* s_perfStatsFile = NULL; +static FILE* s_perfStatsFile = nullptr; static Int s_perfDumpOptions = 0; static UnsignedInt s_lastDumpedFrame = 0; static char s_buf[256] = ""; @@ -270,7 +270,7 @@ Int64 PerfGather::s_stopStartOverhead = -1; /*static*/ PerfGather*& PerfGather::getHeadPtr() { // funky technique for order-of-init problem. trust me. (srj) - static PerfGather* s_head = NULL; + static PerfGather* s_head = nullptr; return s_head; } @@ -313,7 +313,7 @@ PerfGather::PerfGather(const char *identifier) : m_prev(0) { m_ignore = FALSE; - DEBUG_ASSERTCRASH(strchr(m_identifier, ',') == NULL, ("PerfGather names must not contain commas")); + DEBUG_ASSERTCRASH(strchr(m_identifier, ',') == nullptr, ("PerfGather names must not contain commas")); addToList(); } @@ -335,7 +335,7 @@ void PerfGather::reset() //------------------------------------------------------------------------------------------------- /*static*/ void PerfGather::resetAll() { - for (PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { head->reset(); } @@ -356,7 +356,7 @@ void PerfGather::reset() s_perfStatsFile = fopen(tmp, "w"); s_perfDumpOptions = options; - if (s_perfStatsFile == NULL) + if (s_perfStatsFile == nullptr) { DEBUG_CRASH(("could not open/create perf file %s -- is it open in another app?",s_buf)); return; @@ -412,21 +412,21 @@ void PerfGather::reset() fprintf(s_perfStatsFile, "Frame"); if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Gross:%s", head->m_identifier); } } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Net:%s", head->m_identifier); } } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",Count:%s", head->m_identifier); } @@ -443,7 +443,7 @@ void PerfGather::reset() fprintf(s_perfStatsFile, "Frame%08d", frame); if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { double t = head->m_runningTimeGross; t /= s_ticksPerUSec; @@ -454,7 +454,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { double t = head->m_runningTimeNet; t /= s_ticksPerUSec; @@ -465,7 +465,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { fprintf(s_perfStatsFile, ",%d", head->m_callCount); } @@ -499,7 +499,7 @@ void PerfGather::reset() if (s_perfDumpOptions & PERF_GROSSTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_runningTimeGross; t /= s_ticksPerUSec; @@ -511,7 +511,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_NETTIME) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_runningTimeNet; t /= s_ticksPerUSec; @@ -523,7 +523,7 @@ void PerfGather::reset() } if (s_perfDumpOptions & PERF_CALLCOUNT) { - for (const PerfGather* head = getHeadPtr(); head != NULL; head = head->m_next) + for (const PerfGather* head = getHeadPtr(); head != nullptr; head = head->m_next) { Real t = head->m_callCount; TheGraphDraw->addEntry(head->m_identifier, REAL_TO_INT(t)); @@ -540,7 +540,7 @@ void PerfGather::reset() { fflush(s_perfStatsFile); fclose(s_perfStatsFile); - s_perfStatsFile = NULL; + s_perfStatsFile = nullptr; } s_lastDumpedFrame = 0; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp index 9041f653bdb..ad565ea87f3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp @@ -68,7 +68,7 @@ const char *const TheAcademyClassificationTypeNames[] = "ACT_NONE", "ACT_UPGRADE_RADAR", "ACT_SUPERPOWER", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheAcademyClassificationTypeNames) == ACT_COUNT + 1, "Incorrect array size"); @@ -122,11 +122,11 @@ void AcademyStats::init( const Player *player ) //Find the command set for our dozer... so we can extract information about things //we can build. - m_dozerCommandSet = NULL; + m_dozerCommandSet = nullptr; player->iterateObjects( findDozerCommandSet, (void*)m_dozerCommandSet ); - m_commandCenterTemplate = NULL; - m_supplyCenterTemplate = NULL; + m_commandCenterTemplate = nullptr; + m_supplyCenterTemplate = nullptr; if( m_dozerCommandSet ) { @@ -291,7 +291,7 @@ static void updateAcademyStats( Object *obj, void *userData ) if( academy->isFirstUpdate() ) { - academy->recordProduction( obj, NULL ); + academy->recordProduction( obj, nullptr ); } } @@ -1069,7 +1069,7 @@ Bool AcademyStats::calculateAcademyAdvice( AcademyAdviceInfo *info ) //Sanity if( !info ) { - DEBUG_CRASH( ("AcademyStats::calculateAcademyAdvice() was passed in NULL AcademyAdviceInfo.") ); + DEBUG_CRASH( ("AcademyStats::calculateAcademyAdvice() was passed in null AcademyAdviceInfo.") ); return FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 600ee5ca255..658000a6387 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -66,7 +66,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -ActionManager *TheActionManager = NULL; +ActionManager *TheActionManager = nullptr; // LOCAL ////////////////////////////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ Bool ActionManager::canGetRepairedAt( const Object *obj, const Object *repairDes { // sanity - if( obj == NULL || repairDest == NULL ) + if( obj == nullptr || repairDest == nullptr ) return FALSE; Relationship r = obj->getRelationship(repairDest); @@ -207,7 +207,7 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran { // sanity - if( obj == NULL || transferDest == NULL ) + if( obj == nullptr || transferDest == nullptr ) return FALSE; if( transferDest->isEffectivelyDead() ) @@ -226,11 +226,11 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran // I must be something with a Supply Transfering AI interface const AIUpdateInterface *ai= obj->getAI(); - if( ai == NULL ) + if( ai == nullptr ) return FALSE; const SupplyTruckAIInterface* supplyTruck = ai->getSupplyTruckAIInterface(); - if( supplyTruck == NULL ) + if( supplyTruck == nullptr ) return FALSE; // If it is a warehouse, it must have boxes left and not be an enemy @@ -249,7 +249,7 @@ Bool ActionManager::canTransferSuppliesAt( const Object *obj, const Object *tran return FALSE; // if he is not a warehouse or a center, then shut the hell up - if( (warehouseModule == NULL) && (centerModule == NULL) ) + if( (warehouseModule == nullptr) && (centerModule == nullptr) ) return FALSE; // We do not check ClearToApproach, as it is a temporary failure that is handled @@ -286,13 +286,13 @@ Bool ActionManager::canDockAt( const Object *obj, const Object *dockDest, Comman { // look for a dock interface - DockUpdateInterface *di = NULL; + DockUpdateInterface *di = nullptr; for (BehaviorModule **u = dockDest->getBehaviorModules(); *u; ++u) { - if ((di = (*u)->getDockUpdateInterface()) != NULL) + if ((di = (*u)->getDockUpdateInterface()) != nullptr) break; } - if( di == NULL ) + if( di == nullptr ) return FALSE; // no dock update interface, can't possibly dock /* @@ -327,7 +327,7 @@ Bool ActionManager::canGetHealedAt( const Object *obj, const Object *healDest, C { // sanity - if( obj == NULL || healDest == NULL ) + if( obj == nullptr || healDest == nullptr ) return FALSE; Relationship r = obj->getRelationship(healDest); @@ -379,7 +379,7 @@ Bool ActionManager::canRepairObject( const Object *obj, const Object *objectToRe { // sanity - if( obj == NULL || objectToRepair == NULL ) + if( obj == nullptr || objectToRepair == nullptr ) return FALSE; Relationship r = obj->getRelationship(objectToRepair); @@ -451,7 +451,7 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, { // sanity - if( obj == NULL || objectBeingConstructed == NULL ) + if( obj == nullptr || objectBeingConstructed == nullptr ) return FALSE; // only dozers or workers can resume construction of things @@ -520,7 +520,7 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt { // sanity - if( obj == NULL || objectToEnter == NULL ) + if( obj == nullptr || objectToEnter == nullptr ) return FALSE; if( obj == objectToEnter ) @@ -595,7 +595,7 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt for (BehaviorModule** i = objectToEnter->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp == NULL) + if (pp == nullptr) continue; if (pp->hasReservedSpace(obj->getID())) @@ -812,7 +812,7 @@ Bool ActionManager::canConvertObjectToCarBomb( const Object *obj, const Object * { // sanity - if( obj == NULL || objectToConvert == NULL ) + if( obj == nullptr || objectToConvert == nullptr ) { return FALSE; } @@ -846,7 +846,7 @@ Bool ActionManager::canConvertObjectToCarBomb( const Object *obj, const Object * Bool ActionManager::canHijackVehicle( const Object *obj, const Object *objectToHijack, CommandSourceType commandSource ) //LORENZEN { // sanity - if( obj == NULL || objectToHijack == NULL ) + if( obj == nullptr || objectToHijack == nullptr ) { return FALSE; } @@ -908,7 +908,7 @@ Bool ActionManager::canHijackVehicle( const Object *obj, const Object *objectToH Bool ActionManager::canSabotageBuilding( const Object *obj, const Object *objectToSabotage, CommandSourceType commandSource ) { // sanity - if( obj == NULL || objectToSabotage == NULL ) + if( obj == nullptr || objectToSabotage == nullptr ) { return FALSE; } @@ -953,7 +953,7 @@ Bool ActionManager::canSabotageBuilding( const Object *obj, const Object *object Bool ActionManager::canMakeObjectDefector( const Object *obj, const Object *objectToMakeDefector, CommandSourceType commandSource ) //LORENZEN { // sanity - if( obj == NULL || objectToMakeDefector == NULL ) + if( obj == nullptr || objectToMakeDefector == nullptr ) { return FALSE; } @@ -989,7 +989,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT { // sanity - if( obj == NULL || objectToCapture == NULL ) + if( obj == nullptr || objectToCapture == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -1071,7 +1071,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT // if it's garrisoned already, we cannot capture it. // (unless it's just stealth-garrisoned.) ContainModuleInterface *contain = objectToCapture->getContain(); - if (contain != NULL && contain->isGarrisonable()) + if (contain != nullptr && contain->isGarrisonable()) { Int containCount = contain->getContainCount(); Int stealthContainCount = contain->getStealthUnitsContained(); @@ -1093,7 +1093,7 @@ Bool ActionManager::canCaptureBuilding( const Object *obj, const Object *objectT Bool ActionManager::canDisableVehicleViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource, Bool checkSourceRequirements) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; if (checkSourceRequirements) @@ -1176,7 +1176,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner { // sanity - if( obj == NULL || prisoner == NULL ) + if( obj == nullptr || prisoner == nullptr ) return FALSE; // only pow trucks can pick up anything @@ -1193,14 +1193,14 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner // prisoner must be in a surrendered state const AIUpdateInterface *ai = prisoner->getAI(); - if( ai == NULL || ai->isSurrendered() == FALSE ) + if( ai == nullptr || ai->isSurrendered() == FALSE ) return FALSE; // prisoner must have been put in a surrendered state by our own player // (or be surrendered to "everyone") Int idx = ai->getSurrenderedPlayerIndex(); - Player* surrenderedToPlayer = (idx >= 0) ? ThePlayerList->getNthPlayer(idx) : NULL; - if (surrenderedToPlayer != NULL && surrenderedToPlayer != obj->getControllingPlayer()) + Player* surrenderedToPlayer = (idx >= 0) ? ThePlayerList->getNthPlayer(idx) : nullptr; + if (surrenderedToPlayer != nullptr && surrenderedToPlayer != obj->getControllingPlayer()) return FALSE; // we must be enemies @@ -1217,7 +1217,7 @@ Bool ActionManager::canPickUpPrisoner( const Object *obj, const Object *prisoner Bool ActionManager::canStealCashViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource ) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -1303,7 +1303,7 @@ Bool ActionManager::canStealCashViaHacking( const Object *obj, const Object *obj Bool ActionManager::canDisableBuildingViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource ) { // sanity - if( obj == NULL || objectToHack == NULL ) + if( obj == nullptr || objectToHack == nullptr ) return FALSE; //Make sure our object has the capability of performing this special ability. @@ -1386,7 +1386,7 @@ Bool ActionManager::canCutBuildingPower( const Object *obj, const Object *buildi Bool ActionManager::canSnipeVehicle( const Object *obj, const Object *objectToSnipe, CommandSourceType commandSource ) { //Sanity check - if( obj == NULL || objectToSnipe == NULL ) + if( obj == nullptr || objectToSnipe == nullptr ) { return FALSE; } @@ -1934,7 +1934,7 @@ Bool ActionManager::canDoSpecialPower( const Object *obj, const SpecialPowerTemp Bool ActionManager::canFireWeaponAtLocation( const Object *obj, const Coord3D *loc, CommandSourceType commandSource, const WeaponSlotType slot, const Object *objectInWay ) { //Sanity check - if( obj == NULL || loc == NULL ) + if( obj == nullptr || loc == nullptr ) { return false; } @@ -1953,7 +1953,7 @@ Bool ActionManager::canFireWeaponAtLocation( const Object *obj, const Coord3D *l Bool ActionManager::canFireWeaponAtObject( const Object *obj, const Object *target, CommandSourceType commandSource, const WeaponSlotType slot ) { //Sanity check - if( obj == NULL || target == NULL ) + if( obj == nullptr || target == nullptr ) { return FALSE; } @@ -1992,7 +1992,7 @@ Bool ActionManager::canFireWeaponAtObject( const Object *obj, const Object *targ Bool ActionManager::canFireWeapon( const Object *obj, const WeaponSlotType slot, CommandSourceType commandSource ) { //Sanity check - if( obj == NULL ) + if( obj == nullptr ) { return false; } @@ -2026,7 +2026,7 @@ Bool ActionManager::canGarrison( const Object *obj, const Object *target, Comman return false; ContainModuleInterface *cmi = target->getContain(); - if (cmi == NULL) + if (cmi == nullptr) return false; if (cmi->isGarrisonable() == false) @@ -2060,7 +2060,7 @@ Bool ActionManager::canPlayerGarrison( const Player *player, const Object *targe return false; ContainModuleInterface *cmi = target->getContain(); - if (cmi == NULL) + if (cmi == nullptr) return false; if (cmi->isGarrisonable() == false) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp index a0928add8f7..702a300c884 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Energy.cpp @@ -59,7 +59,7 @@ Energy::Energy() { m_energyProduction = 0; m_energyConsumption = 0; - m_owner = NULL; + m_owner = nullptr; m_powerSabotagedTillFrame = 0; } @@ -132,7 +132,7 @@ void Energy::objectEnteringInfluence( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // get the amount of energy this object produces or consumes @@ -158,7 +158,7 @@ void Energy::objectLeavingInfluence( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // get the amount of energy this object produces or consumes @@ -185,7 +185,7 @@ void Energy::addPowerBonus( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; addProduction(obj->getTemplate()->getEnergyBonus()); @@ -204,7 +204,7 @@ void Energy::removePowerBonus( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // TheSuperHackers @bugfix Caball009 14/11/2025 Don't remove power bonus for disabled power plants. @@ -230,7 +230,7 @@ void Energy::addProduction(Int amt) { m_energyProduction += amt; - if( m_owner == NULL ) + if( m_owner == nullptr ) return; // A repeated Brownout signal does nothing bad, and we need to handle more than just edge cases. @@ -243,7 +243,7 @@ void Energy::addConsumption(Int amt) { m_energyConsumption += amt; - if( m_owner == NULL ) + if( m_owner == nullptr ) return; m_owner->onPowerBrownOutChange( !hasSufficientPower() ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp index 7821340747d..7aa6507a3b9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -58,7 +58,7 @@ UnsignedInt Money::withdraw(UnsignedInt amountToWithdraw, Bool playSound) { #if defined(RTS_DEBUG) Player* player = ThePlayerList->getNthPlayer(m_playerIndex); - if (player != NULL && player->buildsForFree()) + if (player != nullptr && player->buildsForFree()) return 0; #endif diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index ec98aa370d6..22e8272b31d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -128,8 +128,8 @@ ClosestKindOfData::ClosestKindOfData( void ) { m_setKindOf.clear(); m_clearKindOf.clear(); - m_source = NULL; - m_closest = NULL; + m_source = nullptr; + m_closest = nullptr; m_closestDistSq = FLT_MAX; } @@ -306,36 +306,36 @@ Player::Player( Int playerIndex ) m_playerRelations = newInstance(PlayerRelationMap); m_teamRelations = newInstance(TeamRelationMap); - m_upgradeList = NULL; - m_pBuildList = NULL; - m_ai = NULL; - m_resourceGatheringManager = NULL; - m_defaultTeam = NULL; + m_upgradeList = nullptr; + m_pBuildList = nullptr; + m_ai = nullptr; + m_resourceGatheringManager = nullptr; + m_defaultTeam = nullptr; m_radarCount = 0; m_disableProofRadarCount = 0; m_radarDisabled = FALSE; m_bombardBattlePlans = 0; m_holdTheLineBattlePlans = 0; m_searchAndDestroyBattlePlans = 0; - m_tunnelSystem = NULL; - m_playerTemplate = NULL; - m_battlePlanBonuses = NULL; + m_tunnelSystem = nullptr; + m_playerTemplate = nullptr; + m_battlePlanBonuses = nullptr; m_skillPointsModifier = 1.0f; m_canBuildUnits = TRUE; m_canBuildBase = TRUE; m_cashBountyPercent = 0.0f; m_color = 0; - m_currentSelection = NULL; + m_currentSelection = nullptr; m_rankLevel = 0; m_sciencePurchasePoints = 0; - m_side = 0; - m_baseSide = 0; + m_side = nullptr; + m_baseSide = nullptr; m_skillPoints = 0; Int i; - m_upgradeList = NULL; + m_upgradeList = nullptr; for(i = 0; i < NUM_HOTKEY_SQUADS; i++) { - m_squads[i] = NULL; + m_squads[i] = nullptr; } for (i = 0; i < MAX_PLAYER_COUNT; ++i) { @@ -344,7 +344,7 @@ Player::Player( Int playerIndex ) m_attackedFrame = 0; m_unitsShouldHunt = FALSE; - init( NULL ); + init( nullptr ); } @@ -368,7 +368,7 @@ void Player::init(const PlayerTemplate* pt) m_searchAndDestroyBattlePlans = 0; deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; deleteUpgradeList(); @@ -376,15 +376,15 @@ void Player::init(const PlayerTemplate* pt) m_stats.init(); deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; - m_defaultTeam = NULL; + m_defaultTeam = nullptr; deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; deleteInstance(m_resourceGatheringManager); - m_resourceGatheringManager = NULL; + m_resourceGatheringManager = nullptr; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { deleteInstance(m_squads[i]); @@ -395,7 +395,7 @@ void Player::init(const PlayerTemplate* pt) m_currentSelection = newInstance(Squad); deleteInstance(m_tunnelSystem); - m_tunnelSystem = NULL; + m_tunnelSystem = nullptr; m_canBuildBase = true; m_canBuildUnits = true; @@ -501,33 +501,33 @@ void Player::init(const PlayerTemplate* pt) //============================================================================= Player::~Player() { - m_defaultTeam = NULL; - m_playerTemplate = NULL; + m_defaultTeam = nullptr; + m_playerTemplate = nullptr; for( PlayerTeamList::iterator it = m_playerTeamPrototypes.begin(); it != m_playerTeamPrototypes.end(); ++it) { - (*it)->friend_setOwningPlayer(NULL); + (*it)->friend_setOwningPlayer(nullptr); } m_playerTeamPrototypes.clear(); // empty, but don't free the contents // delete the relation maps (the destructor clears the actual map if any data is present) deleteInstance(m_teamRelations); - m_teamRelations = NULL; + m_teamRelations = nullptr; deleteInstance(m_playerRelations); - m_playerRelations = NULL; + m_playerRelations = nullptr; for (Int i = 0; i < NUM_HOTKEY_SQUADS; ++i) { deleteInstance(m_squads[i]); - m_squads[i] = NULL; + m_squads[i] = nullptr; } deleteInstance(m_currentSelection); - m_currentSelection = NULL; + m_currentSelection = nullptr; deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; } //============================================================================= @@ -551,7 +551,7 @@ Relationship Player::getRelationship(const Team *that) const if (!m_playerRelations->m_map.empty()) { const Player* thatPlayer = that->getControllingPlayer(); - if (thatPlayer != NULL) + if (thatPlayer != nullptr) { PlayerRelationMapType::const_iterator it = m_playerRelations->m_map.find(thatPlayer->getPlayerIndex()); if (it != m_playerRelations->m_map.end()) @@ -567,7 +567,7 @@ Relationship Player::getRelationship(const Team *that) const //============================================================================= void Player::setPlayerRelationship(const Player *that, Relationship r) { - if (that != NULL) + if (that != nullptr) { // note that this creates the entry if it doesn't exist. m_playerRelations->m_map[that->getPlayerIndex()] = r; @@ -579,7 +579,7 @@ Bool Player::removePlayerRelationship(const Player *that) { if (!m_playerRelations->m_map.empty()) { - if (that == NULL) + if (that == nullptr) { m_playerRelations->m_map.clear(); return true; @@ -600,7 +600,7 @@ Bool Player::removePlayerRelationship(const Player *that) //============================================================================= void Player::setTeamRelationship(const Team *that, Relationship r) { - if (that != NULL) + if (that != nullptr) { // note that this creates the entry if it doesn't exist. m_teamRelations->m_map[that->getID()] = r; @@ -612,7 +612,7 @@ Bool Player::removeTeamRelationship(const Team *that) { if (!m_teamRelations->m_map.empty()) { - if (that == NULL) + if (that == nullptr) { m_teamRelations->m_map.clear(); return true; @@ -738,7 +738,7 @@ void Player::setPlayerType(PlayerType t, Bool skirmish) m_playerType = t; deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; if (t == PLAYER_COMPUTER) { @@ -771,7 +771,7 @@ void Player::setDefaultTeam(void) { void Player::deletePlayerAI() { deleteInstance(m_ai); - m_ai = NULL; + m_ai = nullptr; } //============================================================================= @@ -781,7 +781,7 @@ void Player::initFromDict(const Dict* d) { AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); - DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); + DEBUG_ASSERTCRASH(pt != nullptr, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); init(pt); @@ -850,7 +850,7 @@ void Player::initFromDict(const Dict* d) TheSidesList->getSideInfo(getPlayerIndex())->setScriptList(scripts); deleteInstance(TheSidesList->getSkirmishSideInfo(i)->getScriptList()); - TheSidesList->getSkirmishSideInfo(i)->setScriptList(NULL); + TheSidesList->getSkirmishSideInfo(i)->setScriptList(nullptr); } } @@ -1030,7 +1030,7 @@ void Player::becomingTeamMember(Object *obj, Bool yes) { NameKeyType key_AutoDepositUpdate = NAMEKEY("AutoDepositUpdate"); AutoDepositUpdate *adu = (AutoDepositUpdate *)obj->findUpdateModule(key_AutoDepositUpdate); - if (adu != NULL) { + if (adu != nullptr) { adu->awardInitialCaptureBonus( this ); } } @@ -1166,11 +1166,11 @@ Bool Player::computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D } //------------------------------------------------------------------------------------------------- -/** Get this player's current enemy. NOTE - Can be NULL. */ +/** Get this player's current enemy. NOTE - Can be nullptr. */ //------------------------------------------------------------------------------------------------- Player *Player::getCurrentEnemy( void ) { - return m_ai?m_ai->getAiEnemy():NULL; + return m_ai?m_ai->getAiEnemy():nullptr; } //------------------------------------------------------------------------------------------------- @@ -1207,7 +1207,7 @@ static void doFindCommandCenter(Object* obj, void* userData) PlayerObjectFindInfo* info = (PlayerObjectFindInfo*)userData; - if (info->obj == NULL + if (info->obj == nullptr && obj->isKindOf(KINDOF_COMMANDCENTER) && obj->getTemplate()->getDefaultOwningSide() == info->player->getSide() && !obj->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION) @@ -1428,7 +1428,7 @@ Object* Player::findNaturalCommandCenter() { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; iterateObjects(doFindCommandCenter, &info); return info.obj; } @@ -1438,7 +1438,7 @@ Object* Player::findMostReadyShortcutSpecialPowerOfType( SpecialPowerType spType { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; info.spType = spType; info.lowestReadyFrame = 0xffffffff; iterateObjects( doFindSpecialPowerSourceObject, &info ); @@ -1450,7 +1450,7 @@ Object* Player::findMostReadyShortcutWeaponForThing( const ThingTemplate *thing, { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; info.thing = thing; info.highestPercentage = 0; iterateObjects( doFindMostReadyWeaponForThing, &info ); @@ -1463,7 +1463,7 @@ Object* Player::findMostReadyShortcutSpecialPowerForThing( const ThingTemplate * { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; info.thing = thing; info.highestPercentage = 0; iterateObjects( doFindMostReadySpecialPowerForThing, &info ); @@ -1476,7 +1476,7 @@ Object* Player::findAnyExistingObjectWithThingTemplate( const ThingTemplate *thi { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; info.thing = thing; iterateObjects( doFindExistingObjectWithThingTemplate, &info ); return info.obj; @@ -1489,7 +1489,7 @@ Bool Player::hasAnyShortcutSpecialPower() { PlayerObjectFindInfo info; info.player = this; - info.obj = NULL; + info.obj = nullptr; info.spType = SPECIAL_INVALID; //Invalid dictates that we don't care about the type. info.lowestReadyFrame = 0xffffffff; iterateObjects( doFindSpecialPowerSourceObject, &info ); @@ -1616,7 +1616,7 @@ void Player::preTeamDestroy( const Team *team ) // TheSuperHackers @bugfix Mauller/Xezon 03/05/2025 Clear the default team to prevent dangling pointer usage if( m_defaultTeam == team ) - m_defaultTeam = NULL; + m_defaultTeam = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1814,8 +1814,8 @@ Int Player::countObjects(KindOfMaskType setMask, KindOfMaskType clearMask) //============================================================================= Object *Player::findClosestByKindOf( Object *queryObject, KindOfMaskType setMask, KindOfMaskType clearMask ) { - if( queryObject == NULL ) - return NULL; + if( queryObject == nullptr ) + return nullptr; ClosestKindOfData data; data.m_setKindOf = setMask; @@ -2144,7 +2144,7 @@ void Player::transferAssetsFromThat(Player *that) for (DLINK_ITERATOR iterObj = team->iterate_TeamMemberList(); !iterObj.done(); iterObj.advance()) { Object *obj = iterObj.cur(); - if (!obj || obj->getTemplate()->isEquivalentTo(beaconTemplate)) // don't transfer NULL objs or beacons + if (!obj || obj->getTemplate()->isEquivalentTo(beaconTemplate)) // don't transfer nullptr objs or beacons { continue; } @@ -2167,7 +2167,7 @@ void Player::transferAssetsFromThat(Player *that) void Player::garrisonAllUnits(CommandSourceType source) { PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; Coord3D pos = {50.0, 50.0, 50.0}; /// @todo srj -- we should really use iterateAllObjects() here instead, but I have no time to @@ -2307,7 +2307,7 @@ void sellBuildings( Object *obj, void *userData ) //============================================================================= void Player::sellEverythingUnderTheSun() { - iterateObjects( sellBuildings, NULL ); + iterateObjects( sellBuildings, nullptr ); } @@ -2580,7 +2580,7 @@ void Player::addSciencePurchasePoints(Int delta) if (m_sciencePurchasePoints < 0) m_sciencePurchasePoints = 0; - if (oldSPP != m_sciencePurchasePoints && TheControlBar != NULL) + if (oldSPP != m_sciencePurchasePoints && TheControlBar != nullptr) TheControlBar->onPlayerSciencePurchasePointsChanged(this); } @@ -2725,7 +2725,7 @@ Bool Player::setRankLevel(Int newLevel) DEBUG_ASSERTCRASH(m_skillPoints >= m_levelDown && m_skillPoints < m_levelUp, ("hmm, wrong")); //DEBUG_LOG(("Rank %d, Skill %d, down %d, up %d",m_rankLevel,m_skillPoints, m_levelDown, m_levelUp)); - if (TheControlBar != NULL) + if (TheControlBar != nullptr) { if( m_levelUp ) { @@ -2852,7 +2852,7 @@ static void countExisting( Object *obj, void *userData ) // Compare templates if ( ( typeCountData->type && typeCountData->type->isEquivalentTo( obj->getTemplate() ) ) || - ( typeCountData->linkKey != NAMEKEY_INVALID && obj->getTemplate() != NULL && typeCountData->linkKey == obj->getTemplate()->getMaxSimultaneousLinkKey() ) ) + ( typeCountData->linkKey != NAMEKEY_INVALID && obj->getTemplate() != nullptr && typeCountData->linkKey == obj->getTemplate()->getMaxSimultaneousLinkKey() ) ) { typeCountData->count++; } @@ -2987,7 +2987,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) if( upgrade->getTemplate() == upgradeTemplate ) return upgrade; - return NULL; + return nullptr; } @@ -3027,14 +3027,14 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat Upgrade *u = findUpgrade( upgradeTemplate ); // if no upgrade instance found, make a new one - if( u == NULL ) + if( u == nullptr ) { // make new one u = newInstance(Upgrade)( upgradeTemplate ); // tie to list - u->friend_setPrev( NULL ); + u->friend_setPrev( nullptr ); u->friend_setNext( m_upgradeList ); if( m_upgradeList ) m_upgradeList->friend_setPrev( u ); @@ -3079,14 +3079,14 @@ void Player::onUpgradeCompleted( const UpgradeTemplate *upgradeTemplate ) for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { Team *team = iter.cur(); - if( team == NULL ) + if( team == nullptr ) { continue; } for (DLINK_ITERATOR iterObj = team->iterate_TeamMemberList(); !iterObj.done(); iterObj.advance()) { Object *obj = iterObj.cur(); - if( obj == NULL ) + if( obj == nullptr ) { continue; } @@ -3410,7 +3410,7 @@ Bool Player::doesObjectQualifyForBattlePlan( Object *obj ) const // note, bonus is an in-out parm. void Player::changeBattlePlan( BattlePlanStatus plan, Int delta, BattlePlanBonuses *bonus ) { - DUMPBATTLEPLANBONUSES(bonus, this, NULL); + DUMPBATTLEPLANBONUSES(bonus, this, nullptr); Bool addBonus = false; Bool removeBonus = false; switch( plan ) @@ -3612,7 +3612,7 @@ void Player::removeBattlePlanBonusesForObject( Object *obj ) const //------------------------------------------------------------------------------------------------- void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bonus ) { - DUMPBATTLEPLANBONUSES(bonus, this, NULL); + DUMPBATTLEPLANBONUSES(bonus, this, nullptr); //Only allocate the battle plan bonuses if we actually use it! if( !m_battlePlanBonuses ) @@ -3624,7 +3624,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo else { DEBUG_LOG(("Adding bonus into existing m_battlePlanBonuses")); - DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); //Just apply the differences by multiplying the scalars together (kindofs won't change) //These bonuses are used for new objects that are created or objects that are transferred //to our team. @@ -3638,7 +3638,7 @@ void Player::applyBattlePlanBonusesForPlayerObjects( const BattlePlanBonuses *bo m_battlePlanBonuses->m_searchAndDestroy = MAX( 0, m_battlePlanBonuses->m_searchAndDestroy ); } - DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + DUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); iterateObjects( localApplyBattlePlanBonusesToObject, (void*)bonus ); } @@ -3660,7 +3660,7 @@ void Player::processCreateTeamGameMessage(Int hotkeyNum, const GameMessage *msg) for (UnsignedByte i = 0; i < numArgs; ++i) { ObjectID objID = msg->getArgument(i)->objectID; Object *obj = TheGameLogic->findObjectByID(objID); - if (obj != NULL) { + if (obj != nullptr) { // first, remove it from any other hotkey squads it is in. removeObjectFromHotkeySquad(obj); m_squads[hotkeyNum]->addObject(obj); @@ -3677,7 +3677,7 @@ void Player::processSelectTeamGameMessage(Int hotkeyNum, GameMessage *msg) { return; } - if (m_squads[hotkeyNum] == NULL) { + if (m_squads[hotkeyNum] == nullptr) { return; } @@ -3707,11 +3707,11 @@ void Player::processAddTeamGameMessage(Int hotkeyNum, GameMessage *msg) { return; } - if (m_squads[hotkeyNum] == NULL) { + if (m_squads[hotkeyNum] == nullptr) { return; } - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } @@ -3727,7 +3727,7 @@ void Player::processAddTeamGameMessage(Int hotkeyNum, GameMessage *msg) { /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::getCurrentSelectionAsAIGroup(AIGroup *group) { - if (m_currentSelection != NULL) { + if (m_currentSelection != nullptr) { m_currentSelection->aiGroupFromSquad(group); } } @@ -3736,13 +3736,13 @@ void Player::getCurrentSelectionAsAIGroup(AIGroup *group) { /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::setCurrentlySelectedAIGroup(AIGroup *group) { - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } m_currentSelection->clearSquad(); - if (group != NULL) { + if (group != nullptr) { m_currentSelection->squadFromAIGroup(group, true); } } @@ -3755,7 +3755,7 @@ Squad *Player::getHotkeySquad(Int squadNumber) if ((squadNumber >= 0) && (squadNumber < NUM_HOTKEY_SQUADS)) { return m_squads[squadNumber]; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -3791,11 +3791,11 @@ void Player::removeObjectFromHotkeySquad(Object *objToRemove) /** Select a hotkey team based on this GameMessage */ //------------------------------------------------------------------------------------------------- void Player::addAIGroupToCurrentSelection(AIGroup *group) { - if (group == NULL) { + if (group == nullptr) { return; } - if (m_currentSelection == NULL) { + if (m_currentSelection == nullptr) { m_currentSelection = newInstance( Squad ); } @@ -3958,12 +3958,12 @@ Bool Player::isPlayableSide( void ) const void Player::crc( Xfer *xfer ) { // Player battle plan bonuses - Bool battlePlanBonus = m_battlePlanBonuses != NULL; + Bool battlePlanBonus = m_battlePlanBonuses != nullptr; xfer->xferBool( &battlePlanBonus ); CRCDEBUG_LOG(("Player %d[%ls] %s battle plans", m_playerIndex, m_playerDisplayName.str(), (battlePlanBonus)?"has":"doesn't have")); if( m_battlePlanBonuses ) { - CRCDUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, NULL); + CRCDUMPBATTLEPLANBONUSES(m_battlePlanBonuses, this, nullptr); xfer->xferReal( &m_battlePlanBonuses->m_armorScalar ); xfer->xferReal( &m_battlePlanBonuses->m_sightRangeScalar ); xfer->xferInt( &m_battlePlanBonuses->m_bombardment ); @@ -4053,7 +4053,7 @@ void Player::xfer( Xfer *xfer ) upgradeTemplate = TheUpgradeCenter->findUpgrade( upgradeName ); // sanity - if( upgradeTemplate == NULL ) + if( upgradeTemplate == nullptr ) { DEBUG_CRASH(( "Player::xfer - Unable to find upgrade '%s'", upgradeName.str() )); @@ -4125,7 +4125,7 @@ void Player::xfer( Xfer *xfer ) prototype = TheTeamFactory->findTeamPrototypeByID( prototypeID ); // sanity - if( prototype == NULL ) + if( prototype == nullptr ) { DEBUG_CRASH(( "Player::xfer - Unable to find team prototype by id" )); @@ -4162,7 +4162,7 @@ void Player::xfer( Xfer *xfer ) // the head of these structures automatically deletes any links attached // deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; // read each build list info for( UnsignedShort i = 0; i < buildListInfoCount; ++i ) @@ -4170,16 +4170,16 @@ void Player::xfer( Xfer *xfer ) // allocate new build list buildListInfo = newInstance( BuildListInfo ); - buildListInfo->setNextBuildList( NULL ); + buildListInfo->setNextBuildList( nullptr ); // attach to the *end* of the list in the player - if( m_pBuildList == NULL ) + if( m_pBuildList == nullptr ) m_pBuildList = buildListInfo; else { BuildListInfo *last = m_pBuildList; - while( last->getNext() != NULL ) + while( last->getNext() != nullptr ) last = last->getNext(); last->setNextBuildList( buildListInfo ); @@ -4196,7 +4196,7 @@ void Player::xfer( Xfer *xfer ) // ai player data Bool aiPlayerPresent = m_ai ? TRUE : FALSE; xfer->xferBool( &aiPlayerPresent ); - if( (aiPlayerPresent == TRUE && m_ai == NULL) || (aiPlayerPresent == FALSE && m_ai != NULL) ) + if( (aiPlayerPresent == TRUE && m_ai == nullptr) || (aiPlayerPresent == FALSE && m_ai != nullptr) ) { DEBUG_CRASH(( "Player::xfer - m_ai present/missing mismatch" )); @@ -4209,8 +4209,8 @@ void Player::xfer( Xfer *xfer ) // resource gathering manager Bool resourceGatheringManagerPresent = m_resourceGatheringManager ? TRUE : FALSE; xfer->xferBool( &resourceGatheringManagerPresent ); - if( (resourceGatheringManagerPresent == TRUE && m_resourceGatheringManager == NULL) || - (resourceGatheringManagerPresent == FALSE && m_resourceGatheringManager != NULL ) ) + if( (resourceGatheringManagerPresent == TRUE && m_resourceGatheringManager == nullptr) || + (resourceGatheringManagerPresent == FALSE && m_resourceGatheringManager != nullptr ) ) { DEBUG_CRASH(( "Player::xfer - m_resourceGatheringManager present/missing mismatch" )); @@ -4223,8 +4223,8 @@ void Player::xfer( Xfer *xfer ) // tunnel tracking system Bool tunnelTrackerPresent = m_tunnelSystem ? TRUE : FALSE; xfer->xferBool( &tunnelTrackerPresent ); - if( (tunnelTrackerPresent == TRUE && m_tunnelSystem == NULL) || - (tunnelTrackerPresent == FALSE && m_tunnelSystem != NULL) ) + if( (tunnelTrackerPresent == TRUE && m_tunnelSystem == nullptr) || + (tunnelTrackerPresent == FALSE && m_tunnelSystem != nullptr) ) { DEBUG_CRASH(( "Player::xfer - m_tunnelSystem present/missing mismatch" )); @@ -4468,10 +4468,10 @@ void Player::xfer( Xfer *xfer ) for( UnsignedShort i = 0; i < squadCount; ++i ) { - if( m_squads[ i ] == NULL ) + if( m_squads[ i ] == nullptr ) { - DEBUG_CRASH(( "Player::xfer - NULL squad at index '%d'", i )); + DEBUG_CRASH(( "Player::xfer - null squad at index '%d'", i )); throw SC_INVALID_DATA; } @@ -4487,7 +4487,7 @@ void Player::xfer( Xfer *xfer ) { // allocate squad if needed - if( m_currentSelection == NULL && xfer->getXferMode() == XFER_LOAD ) + if( m_currentSelection == nullptr && xfer->getXferMode() == XFER_LOAD ) m_currentSelection = newInstance( Squad ); // xfer @@ -4496,12 +4496,12 @@ void Player::xfer( Xfer *xfer ) } // Player battle plan bonuses - Bool battlePlanBonus = m_battlePlanBonuses != NULL; + Bool battlePlanBonus = m_battlePlanBonuses != nullptr; xfer->xferBool( &battlePlanBonus ); //If we're loading, it just replaces the bool if( xfer->getXferMode() == XFER_LOAD ) { deleteInstance(m_battlePlanBonuses); - m_battlePlanBonuses = NULL; + m_battlePlanBonuses = nullptr; if ( battlePlanBonus ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp index 7b33095bc6d..485588c5f9d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp @@ -62,11 +62,11 @@ //----------------------------------------------------------------------------- -/*extern*/ PlayerList *ThePlayerList = NULL; +/*extern*/ PlayerList *ThePlayerList = nullptr; //----------------------------------------------------------------------------- PlayerList::PlayerList() : - m_local(NULL), + m_local(nullptr), m_playerCount(0) { // we only allocate a few of these, so don't bother pooling 'em @@ -92,7 +92,7 @@ Player *PlayerList::getNthPlayer(Int i) if( i < 0 || i >= MAX_PLAYER_COUNT ) { // DEBUG_CRASH( ("Illegal player index") ); - return NULL; + return nullptr; } return m_players[i]; } @@ -107,7 +107,7 @@ Player *PlayerList::findPlayerWithNameKey(NameKeyType key) return m_players[i]; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -126,7 +126,7 @@ void PlayerList::newGame() { Int i; - DEBUG_ASSERTCRASH(this != NULL, ("null this")); + DEBUG_ASSERTCRASH(this != nullptr, ("null this")); reset(); @@ -232,10 +232,10 @@ void PlayerList::newGame() void PlayerList::init() { m_playerCount = 1; - m_players[0]->init(NULL); + m_players[0]->init(nullptr); for (int i = 1; i < MAX_PLAYER_COUNT; i++) - m_players[i]->init(NULL); + m_players[i]->init(nullptr); // call setLocalPlayer so that becomingLocalPlayer() gets called appropriately setLocalPlayer(m_players[0]); @@ -304,7 +304,7 @@ Team *PlayerList::validateTeam( AsciiString owner ) void PlayerList::setLocalPlayer(Player *player) { // can't set local player to null -- if you try, you get neutral. - if (player == NULL) + if (player == nullptr) { DEBUG_CRASH(("local player may not be null")); player = getNeutralPlayer(); @@ -344,7 +344,7 @@ void PlayerList::setLocalPlayer(Player *player) //----------------------------------------------------------------------------- Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) { - Player *player = NULL; + Player *player = nullptr; Int i; for( i = 0; i < MAX_PLAYER_COUNT; i++ ) @@ -357,14 +357,14 @@ Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) } DEBUG_CRASH( ("Player does not exist for mask") ); - return NULL; // mask not found + return nullptr; // mask not found } //----------------------------------------------------------------------------- Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) { - Player *player = NULL; + Player *player = nullptr; Int i; for( i = 0; i < MAX_PLAYER_COUNT; i++ ) @@ -380,7 +380,7 @@ Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) DEBUG_CRASH( ("No players found that contain any matching masks.") ); maskToAdjust = 0; - return NULL; // mask not found + return nullptr; // mask not found } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index ef8be636a69..81c5cf6b32d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -67,58 +67,58 @@ { static const FieldParse TheFieldParseTable[] = { - { "Side", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_side ) }, - { "BaseSide", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_baseSide ) }, - { "PlayableSide", INI::parseBool, NULL, offsetof( PlayerTemplate, m_playableSide ) }, - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( PlayerTemplate, m_displayName) }, - { "StartMoney", PlayerTemplate::parseStartMoney, NULL, offsetof( PlayerTemplate, m_money ) }, - { "PreferredColor", INI::parseRGBColor, NULL, offsetof( PlayerTemplate, m_preferredColor ) }, - { "StartingBuilding", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingBuilding ) }, - { "StartingUnit0", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[0] ) }, - { "StartingUnit1", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[1] ) }, - { "StartingUnit2", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[2] ) }, - { "StartingUnit3", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[3] ) }, - { "StartingUnit4", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[4] ) }, - { "StartingUnit5", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[5] ) }, - { "StartingUnit6", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[6] ) }, - { "StartingUnit7", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[7] ) }, - { "StartingUnit8", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[8] ) }, - { "StartingUnit9", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_startingUnits[9] ) }, - { "ProductionCostChange", PlayerTemplate::parseProductionCostChange, NULL, 0 }, - { "ProductionTimeChange", PlayerTemplate::parseProductionTimeChange, NULL, 0 }, - { "ProductionVeterancyLevel", PlayerTemplate::parseProductionVeterancyLevel, NULL, 0 }, - { "IntrinsicSciences", INI::parseScienceVector, NULL, offsetof( PlayerTemplate, m_intrinsicSciences ) }, - { "PurchaseScienceCommandSetRank1",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank1 ) }, - { "PurchaseScienceCommandSetRank3",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank3 ) }, - { "PurchaseScienceCommandSetRank8",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank8 ) }, - { "SpecialPowerShortcutCommandSet",INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutCommandSet ) }, - { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, - { "SpecialPowerShortcutButtonCount",INI::parseInt, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, - { "IsObserver", INI::parseBool, NULL, offsetof( PlayerTemplate, m_observer ) }, - { "OldFaction", INI::parseBool, NULL, offsetof( PlayerTemplate, m_oldFaction ) }, - { "IntrinsicSciencePurchasePoints", INI::parseInt, NULL, offsetof( PlayerTemplate, m_intrinsicSPP ) }, - { "ScoreScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_scoreScreenImage ) }, - { "LoadScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_loadScreenImage ) }, - { "LoadScreenMusic", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_loadScreenMusic ) }, - { "ScoreScreenMusic", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_scoreScreenMusic ) }, - - { "HeadWaterMark", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_headWaterMark ) }, - { "FlagWaterMark", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_flagWaterMark ) }, - { "EnabledImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_enabledImage ) }, - //{ "DisabledImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_disabledImage ) }, - //{ "HiliteImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_hiliteImage ) }, - //{ "PushedImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_pushedImage ) }, - { "SideIconImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_sideIconImage ) }, - { "GeneralImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_generalImage ) }, - - { "BeaconName", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_beaconTemplate ) }, - { "ArmyTooltip", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_tooltip ) }, - { "Features", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_strGeneralFeatures ) }, - { "MedallionRegular", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_strMedallionNormal ) }, - { "MedallionHilite", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_strMedallionHilite ) }, - { "MedallionSelect", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_strMedallionSelected ) }, - - { NULL, NULL, NULL, 0 }, + { "Side", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_side ) }, + { "BaseSide", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_baseSide ) }, + { "PlayableSide", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_playableSide ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( PlayerTemplate, m_displayName) }, + { "StartMoney", PlayerTemplate::parseStartMoney, nullptr, offsetof( PlayerTemplate, m_money ) }, + { "PreferredColor", INI::parseRGBColor, nullptr, offsetof( PlayerTemplate, m_preferredColor ) }, + { "StartingBuilding", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingBuilding ) }, + { "StartingUnit0", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[0] ) }, + { "StartingUnit1", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[1] ) }, + { "StartingUnit2", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[2] ) }, + { "StartingUnit3", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[3] ) }, + { "StartingUnit4", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[4] ) }, + { "StartingUnit5", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[5] ) }, + { "StartingUnit6", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[6] ) }, + { "StartingUnit7", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[7] ) }, + { "StartingUnit8", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[8] ) }, + { "StartingUnit9", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_startingUnits[9] ) }, + { "ProductionCostChange", PlayerTemplate::parseProductionCostChange, nullptr, 0 }, + { "ProductionTimeChange", PlayerTemplate::parseProductionTimeChange, nullptr, 0 }, + { "ProductionVeterancyLevel", PlayerTemplate::parseProductionVeterancyLevel, nullptr, 0 }, + { "IntrinsicSciences", INI::parseScienceVector, nullptr, offsetof( PlayerTemplate, m_intrinsicSciences ) }, + { "PurchaseScienceCommandSetRank1",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank1 ) }, + { "PurchaseScienceCommandSetRank3",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank3 ) }, + { "PurchaseScienceCommandSetRank8",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_purchaseScienceCommandSetRank8 ) }, + { "SpecialPowerShortcutCommandSet",INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutCommandSet ) }, + { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, + { "SpecialPowerShortcutButtonCount",INI::parseInt, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, + { "IsObserver", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_observer ) }, + { "OldFaction", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_oldFaction ) }, + { "IntrinsicSciencePurchasePoints", INI::parseInt, nullptr, offsetof( PlayerTemplate, m_intrinsicSPP ) }, + { "ScoreScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_scoreScreenImage ) }, + { "LoadScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_loadScreenImage ) }, + { "LoadScreenMusic", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_loadScreenMusic ) }, + { "ScoreScreenMusic", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_scoreScreenMusic ) }, + + { "HeadWaterMark", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_headWaterMark ) }, + { "FlagWaterMark", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_flagWaterMark ) }, + { "EnabledImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_enabledImage ) }, + //{ "DisabledImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_disabledImage ) }, + //{ "HiliteImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_hiliteImage ) }, + //{ "PushedImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_pushedImage ) }, + { "SideIconImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_sideIconImage ) }, + { "GeneralImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_generalImage ) }, + + { "BeaconName", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_beaconTemplate ) }, + { "ArmyTooltip", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_tooltip ) }, + { "Features", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_strGeneralFeatures ) }, + { "MedallionRegular", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_strMedallionNormal ) }, + { "MedallionHilite", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_strMedallionHilite ) }, + { "MedallionSelect", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_strMedallionSelected ) }, + + { nullptr, nullptr, nullptr, 0 }, }; return TheFieldParseTable; @@ -176,7 +176,7 @@ AsciiString PlayerTemplate::getStartingUnit( Int i ) const Int money = 0; // parse the money as a regular "FIELD = " - INI::parseInt( ini, instance, &money, NULL ); + INI::parseInt( ini, instance, &money, nullptr ); // assign the money into the 'Money' (m_money) pointed to at 'store' Money *theMoney = (Money *)store; @@ -253,7 +253,7 @@ const Image *PlayerTemplate::getEnabledImage( void ) const //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -/*extern*/ PlayerTemplateStore *ThePlayerTemplateStore = NULL; +/*extern*/ PlayerTemplateStore *ThePlayerTemplateStore = nullptr; //----------------------------------------------------------------------------- PlayerTemplateStore::PlayerTemplateStore() @@ -294,7 +294,7 @@ Int PlayerTemplateStore::getTemplateNumByName(AsciiString name) const if (m_playerTemplates[num].getName().compareNoCase(name.str()) == 0) return num; } - DEBUG_ASSERTCRASH(NULL, ("Template doesn't exist for given name")); + DEBUG_ASSERTCRASH(nullptr, ("Template doesn't exist for given name")); return -1; } @@ -339,7 +339,7 @@ const PlayerTemplate* PlayerTemplateStore::findPlayerTemplate(NameKeyType nameke if ((*it).getNameKey() == namekey) return &(*it); } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -348,7 +348,7 @@ const PlayerTemplate* PlayerTemplateStore::getNthPlayerTemplate(Int i) const if (i >= 0 && i < m_playerTemplates.size()) return &m_playerTemplates[i]; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 0e5bc0904e3..49c560c2b1d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -143,7 +143,7 @@ const ThingTemplate *ProductionPrerequisite::getExistingBuildFacilityTemplate( c return m_prereqUnits[i].unit; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -197,7 +197,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre PrereqUnitRec info; info.name = unit; info.flags = orUnitWithPrevious ? UNIT_OR_WITH_PREV : 0; - info.unit = NULL; + info.unit = nullptr; m_prereqUnits.push_back(info); } @@ -266,7 +266,7 @@ UnicodeString ProductionPrerequisite::getRequiresList(const Player *player) cons unit = m_prereqUnits[i-1].unit; unitName = unit->getDisplayName(); unitName.concat( L" " ); - unitName.concat(TheGameText->fetch("CONTROLBAR:OrRequirement", NULL)); + unitName.concat(TheGameText->fetch("CONTROLBAR:OrRequirement", nullptr)); unitName.concat( L" " ); requiresList.concat(unitName); } @@ -305,7 +305,7 @@ UnicodeString ProductionPrerequisite::getRequiresList(const Player *player) cons } else { unitName.concat(L"\n"); } - requiresList.concat(TheGameText->fetch("CONTROLBAR:GeneralsPromotion", NULL)); + requiresList.concat(TheGameText->fetch("CONTROLBAR:GeneralsPromotion", nullptr)); } // return final list diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp index 8724a73f20a..3db81c1a665 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp @@ -53,7 +53,7 @@ ResourceGatheringManager::~ResourceGatheringManager() void ResourceGatheringManager::addSupplyCenter( Object *newCenter ) { - if( newCenter == NULL ) + if( newCenter == nullptr ) return; m_supplyCenters.push_back( newCenter->getID() ); @@ -61,7 +61,7 @@ void ResourceGatheringManager::addSupplyCenter( Object *newCenter ) void ResourceGatheringManager::removeSupplyCenter( Object *oldCenter ) { - if( oldCenter == NULL ) + if( oldCenter == nullptr ) return; ObjectID targetID = oldCenter->getID(); @@ -80,7 +80,7 @@ void ResourceGatheringManager::removeSupplyCenter( Object *oldCenter ) void ResourceGatheringManager::addSupplyWarehouse( Object *newWarehouse ) { - if( newWarehouse == NULL ) + if( newWarehouse == nullptr ) return; m_supplyWarehouses.push_back( newWarehouse->getID() ); @@ -88,7 +88,7 @@ void ResourceGatheringManager::addSupplyWarehouse( Object *newWarehouse ) void ResourceGatheringManager::removeSupplyWarehouse( Object *oldWarehouse ) { - if( oldWarehouse == NULL ) + if( oldWarehouse == nullptr ) return; ObjectID targetID = oldWarehouse->getID(); @@ -113,7 +113,7 @@ static Real computeRelativeCost( Object *queryObject, Object *destObject, Real * //A good score is a very small number. - if( queryObject == NULL || destObject == NULL ) + if( queryObject == nullptr || destObject == nullptr ) return FLT_MAX; if( !TheActionManager->canTransferSuppliesAt(queryObject, destObject) ) @@ -138,11 +138,11 @@ static Real computeRelativeCost( Object *queryObject, Object *destObject, Real * Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) { - Object *bestWarehouse = NULL; + Object *bestWarehouse = nullptr; Real maxDistanceSquared = 100000; - if( ( queryObject == NULL ) || ( queryObject->getAI() == NULL ) ) - return NULL; + if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) + return nullptr; SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) @@ -155,7 +155,7 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) static const NameKeyType key_warehouseUpdate = NAMEKEY("SupplyWarehouseDockUpdate"); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate*)dock->findUpdateModule( key_warehouseUpdate ); //If remotely okay, let User win. - if( warehouseModule && computeRelativeCost( queryObject, dock, NULL ) != FLT_MAX ) + if( warehouseModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) return dock; } // Please note, there is not a separate Warehouse and Center memory by Design. Because @@ -176,7 +176,7 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) ObjectID currentID = *iterator; Object *currentWarehouse =TheGameLogic->findObjectByID(currentID); - if( currentWarehouse == NULL ) + if( currentWarehouse == nullptr ) { iterator = m_supplyWarehouses.erase( iterator ); } @@ -199,10 +199,10 @@ Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) { - Object *bestCenter = NULL; + Object *bestCenter = nullptr; - if( ( queryObject == NULL ) || ( queryObject->getAI() == NULL ) ) - return NULL; + if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) + return nullptr; SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) @@ -215,7 +215,7 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) static const NameKeyType key_centerUpdate = NAMEKEY("SupplyCenterDockUpdate"); SupplyCenterDockUpdate *centerModule = (SupplyCenterDockUpdate*)dock->findUpdateModule( key_centerUpdate ); //If remotely okay, let User win. - if( centerModule && computeRelativeCost( queryObject, dock, NULL ) != FLT_MAX ) + if( centerModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) return dock; } // Please note, there is not a separate Warehouse and Center memory by Design. Because @@ -232,13 +232,13 @@ Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) ObjectID currentID = *iterator; Object *currentCenter =TheGameLogic->findObjectByID(currentID); - if( currentCenter == NULL ) + if( currentCenter == nullptr ) { iterator = m_supplyCenters.erase( iterator ); } else { - Real currentCost = computeRelativeCost( queryObject, currentCenter, NULL ); + Real currentCost = computeRelativeCost( queryObject, currentCenter, nullptr ); if( currentCost < bestCost ) { bestCenter = currentCenter; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp index c2f75e58c22..0876e37cc67 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp @@ -33,7 +33,7 @@ #include "Common/Player.h" #include "Common/Science.h" -ScienceStore* TheScienceStore = NULL; +ScienceStore* TheScienceStore = nullptr; //----------------------------------------------------------------------------- @@ -148,7 +148,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const return si; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -163,15 +163,15 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const static const FieldParse myFieldParse[] = { - { "PrerequisiteSciences", INI::parseScienceVector, NULL, offsetof( ScienceInfo, m_prereqSciences ) }, - { "SciencePurchasePointCost", INI::parseInt, NULL, offsetof( ScienceInfo, m_sciencePurchasePointCost ) }, - { "IsGrantable", INI::parseBool, NULL, offsetof( ScienceInfo, m_grantable ) }, - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( ScienceInfo, m_name) }, - { "Description", INI::parseAndTranslateLabel, NULL, offsetof( ScienceInfo, m_description) }, - { 0, 0, 0, 0 } + { "PrerequisiteSciences", INI::parseScienceVector, nullptr, offsetof( ScienceInfo, m_prereqSciences ) }, + { "SciencePurchasePointCost", INI::parseInt, nullptr, offsetof( ScienceInfo, m_sciencePurchasePointCost ) }, + { "IsGrantable", INI::parseBool, nullptr, offsetof( ScienceInfo, m_grantable ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_name) }, + { "Description", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_description) }, + { nullptr, nullptr, nullptr, 0 } }; - ScienceInfo* info = NULL; + ScienceInfo* info = nullptr; // see if the science already exists. (can't use findScienceInfo() since it is const and should remain so.) for (ScienceInfoVec::iterator it = TheScienceStore->m_sciences.begin(); it != TheScienceStore->m_sciences.end(); ++it) @@ -188,7 +188,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const { ScienceInfo* newInfo = newInstance(ScienceInfo); - if (info == NULL) + if (info == nullptr) { // only add if it's not overriding an existing one. info = newInfo; @@ -211,7 +211,7 @@ const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const } else { - if (info != NULL) + if (info != nullptr) { DEBUG_CRASH(("duplicate science %s!",c)); throw INI_INVALID_DATA; @@ -365,7 +365,7 @@ ScienceType ScienceStore::friend_lookupScience(const char* scienceName) const Bool ScienceStore::isValidScience(ScienceType st) const { const ScienceInfo* si = findScienceInfo(st); - return si != NULL; + return si != nullptr; } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 41e6d5ceaaa..b0efba7739b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -407,7 +407,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) { // sanity - if( map == NULL ) + if( map == nullptr ) { DEBUG_CRASH(( "xferObjectCountMap - Invalid map parameter" )); @@ -458,7 +458,7 @@ void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) // read thing template name xfer->xferAsciiString( &thingTemplateName ); thingTemplate = TheThingFactory->findTemplate( thingTemplateName ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "xferObjectCountMap - Unknown thing template '%s'", thingTemplateName.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index f059cfdef1d..159404daaba 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -39,7 +39,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -SpecialPowerStore *TheSpecialPowerStore = NULL; +SpecialPowerStore *TheSpecialPowerStore = nullptr; #define DEFAULT_DEFECTION_DETECTION_PROTECTION_TIME_LIMIT (LOGICFRAMES_PER_SECOND * 10) @@ -129,7 +129,7 @@ const char* const SpecialPowerMaskType::s_bitNameList[] = "SPECIAL_BATTLESHIP_BOMBARDMENT", - NULL + nullptr }; static_assert(ARRAY_SIZE(SpecialPowerMaskType::s_bitNameList) == SpecialPowerMaskType::NumBits + 1, "Incorrect array size"); @@ -191,20 +191,20 @@ void SpecialPowerStore::parseSpecialPowerDefinition( INI *ini ) /* static */ const FieldParse SpecialPowerTemplate::m_specialPowerFieldParse[] = { - { "ReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_reloadTime ) }, - { "RequiredScience", INI::parseScience, NULL, offsetof( SpecialPowerTemplate, m_requiredScience ) }, - { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerTemplate, m_initiateSound ) }, - { "InitiateAtLocationSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerTemplate, m_initiateAtLocationSound ) }, - { "PublicTimer", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_publicTimer ) }, + { "ReloadTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_reloadTime ) }, + { "RequiredScience", INI::parseScience, nullptr, offsetof( SpecialPowerTemplate, m_requiredScience ) }, + { "InitiateSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerTemplate, m_initiateSound ) }, + { "InitiateAtLocationSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerTemplate, m_initiateAtLocationSound ) }, + { "PublicTimer", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_publicTimer ) }, { "Enum", INI::parseIndexList, SpecialPowerMaskType::getBitNames(), offsetof( SpecialPowerTemplate, m_type ) }, - { "DetectionTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_detectionTime ) }, - { "SharedSyncedTimer", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_sharedNSync ) }, - { "ViewObjectDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpecialPowerTemplate, m_viewObjectDuration ) }, - { "ViewObjectRange", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_viewObjectRange ) }, - { "RadiusCursorRadius", INI::parseReal, NULL, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, - { "ShortcutPower", INI::parseBool, NULL, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, + { "DetectionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_detectionTime ) }, + { "SharedSyncedTimer", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_sharedNSync ) }, + { "ViewObjectDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpecialPowerTemplate, m_viewObjectDuration ) }, + { "ViewObjectRange", INI::parseReal, nullptr, offsetof( SpecialPowerTemplate, m_viewObjectRange ) }, + { "RadiusCursorRadius", INI::parseReal, nullptr, offsetof( SpecialPowerTemplate, m_radiusCursorRadius ) }, + { "ShortcutPower", INI::parseBool, nullptr, offsetof( SpecialPowerTemplate, m_shortcutPower ) }, { "AcademyClassify", INI::parseIndexList, TheAcademyClassificationTypeNames, offsetof( SpecialPowerTemplate, m_academyClassificationType ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -273,7 +273,7 @@ SpecialPowerTemplate* SpecialPowerStore::findSpecialPowerTemplatePrivate( AsciiS if( m_specialPowerTemplates[ i ]->getName() == name ) return m_specialPowerTemplates[ i ]; - return NULL; // not found + return nullptr; // not found } @@ -288,7 +288,7 @@ const SpecialPowerTemplate *SpecialPowerStore::findSpecialPowerTemplateByID( Uns if( m_specialPowerTemplates[ i ]->getID() == id ) return m_specialPowerTemplates[ i ]; - return NULL; // not found + return nullptr; // not found } @@ -301,7 +301,7 @@ const SpecialPowerTemplate *SpecialPowerStore::getSpecialPowerTemplateByIndex( U if (index >= 0 && index < m_specialPowerTemplates.size()) return m_specialPowerTemplates[ index ]; - return NULL; // not found + return nullptr; // not found } @@ -322,11 +322,11 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl { // sanity - if( obj == NULL || specialPowerTemplate == NULL ) + if( obj == nullptr || specialPowerTemplate == nullptr ) return FALSE; // as a first sanity check, the object must have a module capable of executing the power - if( obj->getSpecialPowerModule( specialPowerTemplate ) == NULL ) + if( obj->getSpecialPowerModule( specialPowerTemplate ) == nullptr ) return FALSE; // @@ -366,7 +366,7 @@ void SpecialPowerStore::reset( void ) { SpecialPowerTemplate* si = *it; Overridable* temp = si->deleteOverrides(); - if (temp == NULL) + if (temp == nullptr) { it = m_specialPowerTemplates.erase(it); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 701debf163d..2322395a1d6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -55,7 +55,7 @@ ///@todo - do delayed script evaluations for team scripts. jba. // GLOBALS //////////////////////////////////////////////////////////////////// -TeamFactory *TheTeamFactory = NULL; +TeamFactory *TheTeamFactory = nullptr; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -234,7 +234,7 @@ void TeamFactory::initFromSides(SidesList *sides) // ------------------------------------------------------------------------ void TeamFactory::initTeam(const AsciiString& name, const AsciiString& owner, Bool isSingleton, Dict *d) { - DEBUG_ASSERTCRASH(findTeamPrototype(name)==NULL,("team already exists")); + DEBUG_ASSERTCRASH(findTeamPrototype(name)==nullptr,("team already exists")); Player *pOwner = ThePlayerList->findPlayerWithNameKey(NAMEKEY(owner)); DEBUG_ASSERTCRASH(pOwner, ("no owner found for team %s (%s)",name.str(),owner.str())); if (!pOwner) @@ -277,14 +277,14 @@ TeamPrototype *TeamFactory::findTeamPrototype(const AsciiString& name) if (it != m_prototypes.end()) return it->second; - return NULL; + return nullptr; } // ------------------------------------------------------------------------ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) { TeamPrototypeMap::iterator it; - TeamPrototype *prototype = NULL; + TeamPrototype *prototype = nullptr; for( it = m_prototypes.begin(); it != m_prototypes.end(); ++it ) { @@ -296,7 +296,7 @@ TeamPrototype *TeamFactory::findTeamPrototypeByID( TeamPrototypeID id ) } // not found - return NULL; + return nullptr; } @@ -306,7 +306,7 @@ Team *TeamFactory::findTeamByID( TeamID teamID ) // simple case if( teamID == TEAM_ID_INVALID ) - return NULL; + return nullptr; // search all prototypes for the matching team ID TeamPrototype *tp; @@ -320,7 +320,7 @@ Team *TeamFactory::findTeamByID( TeamID teamID ) return team; } - return NULL; + return nullptr; } @@ -332,10 +332,10 @@ Team *TeamFactory::createInactiveTeam(const AsciiString& name) TeamPrototype *tp = findTeamPrototype(name); if (!tp) { DEBUG_CRASH(( "Team prototype '%s' does not exist", name.str() )); - return NULL; + return nullptr; } - Team *t = NULL; + Team *t = nullptr; if (tp->getIsSingleton()) { t = tp->getFirstItemIn_TeamInstanceList(); @@ -375,10 +375,10 @@ Team *TeamFactory::createTeam(const AsciiString& name) // ------------------------------------------------------------------------ Team *TeamFactory::createTeamOnPrototype( TeamPrototype *prototype ) { - if( prototype == NULL ) + if( prototype == nullptr ) throw ERROR_BAD_ARG; - Team *t = NULL; + Team *t = nullptr; if( prototype->getIsSingleton() ) { t = prototype->getFirstItemIn_TeamInstanceList(); @@ -396,13 +396,13 @@ Team* TeamFactory::findTeam(const AsciiString& name) if (tp) { Team *t = tp->getFirstItemIn_TeamInstanceList(); - if (t == NULL && !tp->getIsSingleton()) + if (t == nullptr && !tp->getIsSingleton()) { t = createInactiveTeam(name); } return t; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ @@ -496,7 +496,7 @@ void TeamFactory::xfer( Xfer *xfer ) teamPrototype = findTeamPrototypeByID( teamPrototypeID ); // sanity - if( teamPrototype == NULL ) + if( teamPrototype == nullptr ) { DEBUG_CRASH(( "TeamFactory::xfer - Unable to find team prototype by id" )); @@ -517,7 +517,7 @@ if( xfer->getXferMode() == XFER_SAVE ) { FILE *fp = fopen( "TeamCheckSave.txt", "w+t" ); -if( fp == NULL ) +if( fp == nullptr ) return; Object *obj; @@ -584,7 +584,7 @@ void TeamFactory::loadPostProcess( void ) /* // SAVE_LOAD_DEBUG FILE *fp = fopen( "TeamCheckLoad.txt", "w+t" ); -if( fp == NULL ) +if( fp == nullptr ) return; Object *obj; @@ -813,9 +813,9 @@ TeamPrototype::TeamPrototype( TeamFactory *tf, m_flags(isSingleton ? TeamPrototype::TEAM_SINGLETON : 0), m_teamTemplate(d), m_productionConditionAlwaysFalse(false), - m_productionConditionScript(NULL) + m_productionConditionScript(nullptr) { - DEBUG_ASSERTCRASH(!(m_owningPlayer == NULL), ("bad args to TeamPrototype ctor")); + DEBUG_ASSERTCRASH(!(m_owningPlayer == nullptr), ("bad args to TeamPrototype ctor")); if (m_factory) m_factory->addTeamPrototypeToList(this); @@ -824,7 +824,7 @@ TeamPrototype::TeamPrototype( TeamFactory *tf, m_retrievedGenericScripts = false; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - m_genericScriptsToRun[i] = NULL; + m_genericScriptsToRun[i] = nullptr; } } @@ -850,12 +850,12 @@ TeamPrototype::~TeamPrototype() m_factory->removeTeamPrototypeFromList(this); deleteInstance(m_productionConditionScript); - m_productionConditionScript = NULL; + m_productionConditionScript = nullptr; for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { deleteInstance(m_genericScriptsToRun[i]); - m_genericScriptsToRun[i] = NULL; + m_genericScriptsToRun[i] = nullptr; } } @@ -873,13 +873,13 @@ Team *TeamPrototype::findTeamByID( TeamID teamID ) if( iter.cur()->getID() == teamID ) return iter.cur(); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ void TeamPrototype::setControllingPlayer(Player *newController) { - DEBUG_ASSERTCRASH(newController, ("Attempted to set NULL player as team-owner, illegal.")); + DEBUG_ASSERTCRASH(newController, ("Attempted to set null player as team-owner, illegal.")); if (!newController) { return; } @@ -889,7 +889,7 @@ void TeamPrototype::setControllingPlayer(Player *newController) m_owningPlayer = newController; - // impossible to get here with a NULL pointer. + // impossible to get here with a nullptr pointer. m_owningPlayer->addTeamToList(this); } @@ -919,8 +919,8 @@ Script *TeamPrototype::getGenericScript(Int scriptToRetrieve) m_retrievedGenericScripts = TRUE; // set this to true so we won't do the lookup again. // Go get them from the script engine, and duplicate each one. for (Int i = 0; i < MAX_GENERIC_SCRIPTS; ++i) { - const Script *tmpScript = NULL; - Script *scriptToSave = NULL; + const Script *tmpScript = nullptr; + Script *scriptToSave = nullptr; if (!m_teamTemplate.m_teamGenericScripts[i].isEmpty()) { tmpScript = TheScriptEngine->findScriptByName(m_teamTemplate.m_teamGenericScripts[i]); if (tmpScript) { @@ -1057,7 +1057,7 @@ void TeamPrototype::updateState(void) done = true; for (DLINK_ITERATOR iter = iterate_TeamInstanceList(); !iter.done(); iter.advance()) { - if (iter.cur()->getFirstItemIn_TeamMemberList() == NULL) + if (iter.cur()->getFirstItemIn_TeamMemberList() == nullptr) { // Team has no members. if (this->getIsSingleton()) @@ -1134,7 +1134,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) if (delaySeconds>0) { m_productionConditionScript->setFrameToEvaluate(TheGameLogic->getFrame()+delaySeconds*LOGICFRAMES_PER_SECOND); } - return TheScriptEngine->evaluateConditions(m_productionConditionScript, NULL, getControllingPlayer()); + return TheScriptEngine->evaluateConditions(m_productionConditionScript, nullptr, getControllingPlayer()); } // We don't have a script yet, so check for one. if (m_teamTemplate.m_productionCondition.isEmpty()) { @@ -1169,7 +1169,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) // Make a copy of the script locally, just for paranoia's sake. We can't be sure // exactly what order the teams & scripts will get reset, so be safe. m_productionConditionScript = pScript->duplicate(); - return TheScriptEngine->evaluateConditions(m_productionConditionScript, NULL, getControllingPlayer()); + return TheScriptEngine->evaluateConditions(m_productionConditionScript, nullptr, getControllingPlayer()); } // Couldn't find a script. m_productionConditionAlwaysFalse = true; @@ -1265,7 +1265,7 @@ void TeamPrototype::xfer( Xfer *xfer ) // created with exactly the same team IDs they had before // teamInstance = TheTeamFactory->findTeamByID( teamID ); - if( teamInstance == NULL ) + if( teamInstance == nullptr ) { // create team @@ -1348,7 +1348,7 @@ Team::Team(TeamPrototype *proto, TeamID id ) : // ------------------------------------------------------------------------ Team::~Team() { -// DEBUG_ASSERTCRASH(getFirstItemIn_TeamMemberList() == NULL, ("Team still has members in existence")); +// DEBUG_ASSERTCRASH(getFirstItemIn_TeamMemberList() == nullptr, ("Team still has members in existence")); TheScriptEngine->notifyOfTeamDestruction(this); @@ -1362,9 +1362,9 @@ Team::~Team() } Object* tm; - while ((tm = getFirstItemIn_TeamMemberList()) != NULL) + while ((tm = getFirstItemIn_TeamMemberList()) != nullptr) { - tm->setTeam(NULL); + tm->setTeam(nullptr); } //this test is valid, but will generate a 'false positive' during game teardown //DEBUG_ASSERTCRASH(!(getControllingPlayer() && getControllingPlayer()->getDefaultTeam()==this),("I am still someones default team -- sure you want to delete me?")); @@ -1391,7 +1391,7 @@ Player *Team::getControllingPlayer() const // ------------------------------------------------------------------------ void Team::setControllingPlayer(Player *newController) { - // NULL is not allowed, but is caught by TeamPrototype::setControllingPlayer() + // nullptr is not allowed, but is caught by TeamPrototype::setControllingPlayer() m_proto->setControllingPlayer(newController); // This function is used by one script, and it is kind of odd. The actual units @@ -1446,7 +1446,7 @@ Int Team::getTargetableCount() const continue; } - if (obj->isEffectivelyDead() || (obj->getAIUpdateInterface() == NULL && !obj->isKindOf(KINDOF_STRUCTURE))) { + if (obj->isEffectivelyDead() || (obj->getAIUpdateInterface() == nullptr && !obj->isKindOf(KINDOF_STRUCTURE))) { continue; } @@ -1460,7 +1460,7 @@ Int Team::getTargetableCount() const Relationship Team::getRelationship(const Team *that) const { // do we have an override for that particular team? if so, return it. - if (!m_teamRelations->m_map.empty() && that != NULL) + if (!m_teamRelations->m_map.empty() && that != nullptr) { TeamRelationMapType::const_iterator it = m_teamRelations->m_map.find(that->getID()); if (it != m_teamRelations->m_map.end()) @@ -1470,10 +1470,10 @@ Relationship Team::getRelationship(const Team *that) const } // hummm... well, do we have an override for that team's player? - if (!m_playerRelations->m_map.empty() && that != NULL) + if (!m_playerRelations->m_map.empty() && that != nullptr) { Player* thatPlayer = that->getControllingPlayer(); - if (thatPlayer != NULL) + if (thatPlayer != nullptr) { PlayerRelationMapType::const_iterator it = m_playerRelations->m_map.find(thatPlayer->getPlayerIndex()); if (it != m_playerRelations->m_map.end()) @@ -1490,7 +1490,7 @@ Relationship Team::getRelationship(const Team *that) const // ------------------------------------------------------------------------ void Team::setTeamTargetObject(const Object *target) { - if (target==NULL) { + if (target==nullptr) { m_commonAttackTarget = INVALID_ID; return; } @@ -1507,7 +1507,7 @@ void Team::setTeamTargetObject(const Object *target) Object *Team::getTeamTargetObject(void) { if (m_commonAttackTarget == INVALID_ID) { - return NULL; + return nullptr; } Object *target = TheGameLogic->findObjectByID(m_commonAttackTarget); if (target) { @@ -1516,21 +1516,21 @@ Object *Team::getTeamTargetObject(void) !target->testStatus( OBJECT_STATUS_DETECTED ) && !target->testStatus( OBJECT_STATUS_DISGUISED ) ) { - target = NULL; + target = nullptr; } } if (target && target->isEffectivelyDead()) { - target = NULL; + target = nullptr; } if (target && target->getContainedBy()) { - target = NULL; // target entered a building or vehicle, so stop targeting. + target = nullptr; // target entered a building or vehicle, so stop targeting. } if (target && target->isKindOf(KINDOF_AIRCRAFT)) { // It is just generally bad to have an aircraft as the team target. // Let team members acquire aircraft individually. jba. [8/27/2003] - target = NULL; + target = nullptr; } - if (target == NULL) { + if (target == nullptr) { m_commonAttackTarget = INVALID_ID; } return target; @@ -1839,7 +1839,7 @@ void Team::updateState(void) PartitionFilterAlive filterAlive; PartitionFilterSameMapStatus filterMapStatus(iter.cur()); - PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterMapStatus, nullptr }; Real visionRange = iter.cur()->getVisionRange(); anyAliveInTeam = true; Object *pObj = ThePartitionManager->getClosestObject( iter.cur(), visionRange, @@ -2223,11 +2223,11 @@ const Coord3D* Team::getEstimateTeamPosition(void) const DLINK_ITERATOR iter = iterate_TeamMemberList(); Object *obj = iter.cur(); if (!obj) - return NULL; + return nullptr; const Coord3D *pos = iter.cur()->getPosition(); if (!pos) - return NULL; + return nullptr; return pos; } @@ -2297,9 +2297,9 @@ void Team::deleteTeam(Bool ignoreDead) void Team::transferUnitsTo(Team *newTeam) { if (this == newTeam) return; - if (newTeam == NULL) return; + if (newTeam == nullptr) return; Object *obj; - while ((obj = getFirstItemIn_TeamMemberList()) != 0) + while ((obj = getFirstItemIn_TeamMemberList()) != nullptr) { obj->setTeam(newTeam); } @@ -2325,9 +2325,9 @@ static Bool isInBuildVariations(const ThingTemplate* ttWithVariations, const Thi Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHome, Real maxDist) { Player *myPlayer = getControllingPlayer(); - Object *obj=NULL; + Object *obj=nullptr; Real distSqr = maxDist*maxDist; - Object *recruit = NULL; + Object *recruit = nullptr; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) { if (!obj->getTemplate()->isEquivalentTo(tTemplate)) @@ -2371,7 +2371,7 @@ Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHo dx = teamHome->x - obj->getPosition()->x; dy = teamHome->y - obj->getPosition()->y; - if (isDefaultTeam && recruit == NULL) { + if (isDefaultTeam && recruit == nullptr) { recruit = obj; distSqr = dx*dx+dy*dy; } @@ -2382,10 +2382,10 @@ Object *Team::tryToRecruit(const ThingTemplate *tTemplate, const Coord3D *teamHo distSqr = dx*dx+dy*dy; recruit = obj; } - if (recruit!=NULL) { + if (recruit!=nullptr) { return recruit; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------ @@ -2401,7 +2401,7 @@ void Team::evacuateTeam(void) ContainModuleInterface *cmi = obj->getContain(); UnsignedInt numContained = 0; - if (cmi != NULL) { + if (cmi != nullptr) { numContained = cmi->getContainCount(); } if (numContained > 0) { @@ -2433,7 +2433,7 @@ void Team::killTeam(void) // TheSuperHackers @bugfix Mauller 20/07/2025 the neutral player has no player template so we need to check for a null template const PlayerTemplate* playerTemplate = getControllingPlayer()->getPlayerTemplate(); // beacons are effectively dead, so we need to destroy via a non-kill() method - const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : NULL; + const ThingTemplate* beaconTemplate = playerTemplate ? TheThingFactory->findTemplate( playerTemplate->getBeaconTemplate() ) : nullptr; // now find objects to kill for (DLINK_ITERATOR iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -2705,7 +2705,7 @@ void Team::loadPostProcess( void ) // find object obj = TheGameLogic->findObjectByID( *it ); - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "Team::loadPostProcess - Unable to post process object to member list, object ID = '%d'", *it )); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 72ea6a28222..f561de2d8e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -119,7 +119,7 @@ void TunnelTracker::swapContainedItemsList(ContainedItemsList& newList) // ------------------------------------------------------------------------ void TunnelTracker::updateNemesis(const Object *target) { - if (getCurNemesis()==NULL) { + if (getCurNemesis()==nullptr) { if (target) { if (target->isKindOf(KINDOF_VEHICLE) || target->isKindOf(KINDOF_STRUCTURE) || target->isKindOf(KINDOF_INFANTRY) || target->isKindOf(KINDOF_AIRCRAFT)) { @@ -136,11 +136,11 @@ void TunnelTracker::updateNemesis(const Object *target) Object *TunnelTracker::getCurNemesis(void) { if (m_curNemesisID == INVALID_ID) { - return NULL; + return nullptr; } if (m_nemesisTimestamp + 4*LOGICFRAMES_PER_SECOND < TheGameLogic->getFrame()) { m_curNemesisID = INVALID_ID; - return NULL; + return nullptr; } Object *target = TheGameLogic->findObjectByID(m_curNemesisID); if (target) { @@ -149,13 +149,13 @@ Object *TunnelTracker::getCurNemesis(void) !target->testStatus( OBJECT_STATUS_DETECTED ) && !target->testStatus( OBJECT_STATUS_DISGUISED ) ) { - target = NULL; + target = nullptr; } } if (target && target->isEffectivelyDead()) { - target = NULL; + target = nullptr; } - if (target == NULL) { + if (target == nullptr) { m_curNemesisID = INVALID_ID; } return target; @@ -227,7 +227,7 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) if( m_tunnelCount == 0 ) { // Kill everyone in our contain list. Cave in! - iterateContained( destroyObject, NULL, FALSE ); + iterateContained( destroyObject, nullptr, FALSE ); m_containList.clear(); m_containListSize = 0; } @@ -333,7 +333,7 @@ void TunnelTracker::updateFullHealTime() continue; const ContainModuleInterface* contain = tunnelObj->getContain(); - DEBUG_ASSERTCRASH(contain != NULL, ("Contain module is NULL")); + DEBUG_ASSERTCRASH(contain != nullptr, ("Contain module is null")); if (!contain->isTunnelContain()) continue; @@ -430,7 +430,7 @@ void TunnelTracker::loadPostProcess( void ) { obj = TheGameLogic->findObjectByID( *it ); - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "TunnelTracker::loadPostProcess - Unable to find object ID '%d'", *it )); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index e5bc9ebbfa7..5da265409e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -311,7 +311,7 @@ void RecorderClass::cleanUpReplayFile( void ) fseek(fp, 0, SEEK_END); fileSize = ftell(fp); fclose(fp); - fp = NULL; + fp = nullptr; DEBUG_LOG(("Log file size was %d", fileSize)); } @@ -337,15 +337,15 @@ void RecorderClass::cleanUpReplayFile( void ) } fclose(ofp); fclose(ifp); - ifp = NULL; - ofp = NULL; + ifp = nullptr; + ofp = nullptr; } else { if (ifp) fclose(ifp); if (ofp) fclose(ofp); - ifp = NULL; - ofp = NULL; + ifp = nullptr; + ofp = nullptr; } } #endif // DEBUG_LOGGING @@ -356,7 +356,7 @@ void RecorderClass::cleanUpReplayFile( void ) /** * The recorder object. */ -RecorderClass *TheRecorder = NULL; +RecorderClass *TheRecorder = nullptr; /** * Constructor @@ -365,7 +365,7 @@ RecorderClass::RecorderClass() { m_originalGameMode = GAME_NONE; m_mode = RECORDERMODETYPE_RECORD; - m_file = NULL; + m_file = nullptr; m_fileName.clear(); m_currentFilePosition = 0; m_doingAnalysis = FALSE; @@ -391,7 +391,7 @@ RecorderClass::~RecorderClass() { void RecorderClass::init() { m_originalGameMode = GAME_NONE; m_mode = RECORDERMODETYPE_NONE; - m_file = NULL; + m_file = nullptr; m_fileName.clear(); m_currentFilePosition = 0; m_gameInfo.clearSlotList(); @@ -413,9 +413,9 @@ void RecorderClass::init() { * Reset the recorder to the "initialized state." */ void RecorderClass::reset() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } m_fileName.clear(); @@ -470,9 +470,9 @@ void RecorderClass::updatePlayback() { * reaching the end of the playback file. */ void RecorderClass::stopPlayback() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } m_fileName.clear(); @@ -491,7 +491,7 @@ void RecorderClass::updateRecord() Bool needFlush = FALSE; static Int lastFrame = -1; GameMessage *msg = TheCommandList->getFirstMessage(); - while (msg != NULL) { + while (msg != nullptr) { if (msg->getType() == GameMessage::MSG_NEW_GAME && msg->getArgument(0)->integer != GAME_SHELL && msg->getArgument(0)->integer != GAME_SINGLE_PLAYER && // Due to the massive amount of scripts that use in GC and single player, replays have been cut for them. @@ -512,7 +512,7 @@ void RecorderClass::updateRecord() startRecording(diff, m_originalGameMode, rankPoints, maxFPS); } else if (msg->getType() == GameMessage::MSG_CLEAR_GAME_DATA) { - if (m_file != NULL) { + if (m_file != nullptr) { lastFrame = -1; writeToFile(msg); stopRecording(); @@ -520,7 +520,7 @@ void RecorderClass::updateRecord() } m_fileName.clear(); } else { - if (m_file != NULL) { + if (m_file != nullptr) { if ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES)) { // Only write the important messages to the file. @@ -533,7 +533,7 @@ void RecorderClass::updateRecord() } if (needFlush) { - DEBUG_ASSERTCRASH(m_file != NULL, ("RecorderClass::updateRecord() - unexpected call to fflush(m_file)")); + DEBUG_ASSERTCRASH(m_file != nullptr, ("RecorderClass::updateRecord() - unexpected call to fflush(m_file)")); m_file->flush(); } } @@ -543,7 +543,7 @@ void RecorderClass::updateRecord() * So don't call this unless you really mean it. */ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, Int rankPoints, Int maxFPS) { - DEBUG_ASSERTCRASH(m_file == NULL, ("Starting to record game while game is in progress.")); + DEBUG_ASSERTCRASH(m_file == nullptr, ("Starting to record game while game is in progress.")); reset(); @@ -558,8 +558,8 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In m_fileName.concat(getReplayExtention()); filepath.concat(m_fileName); m_file = TheFileSystem->openFile(filepath.str(), File::WRITE | File::BINARY); - if (m_file == NULL) { - DEBUG_ASSERTCRASH(m_file != NULL, ("Failed to create replay file")); + if (m_file == nullptr) { + DEBUG_ASSERTCRASH(m_file != nullptr, ("Failed to create replay file")); return; } // TheSuperHackers @info the null terminator needs to be ignored to maintain retail replay file layout @@ -670,7 +670,7 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In /// @todo fix this to use starting spots and player alliances when those are put in the game. for (Int i = 0; i < numPlayers; ++i) { Player *player = ThePlayerList->getNthPlayer(i); - if (player == NULL) { + if (player == nullptr) { continue; } UnicodeString name = player->getPlayerDisplayName(); @@ -726,9 +726,9 @@ void RecorderClass::stopRecording() { m_wasDesync = FALSE; } } - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; if (m_archiveReplays) archiveReplay(m_fileName); @@ -803,7 +803,7 @@ void RecorderClass::writeToFile(GameMessage * msg) { m_file->write(&numTypes, sizeof(numTypes)); GameMessageParserArgumentType *argType = parser->getFirstArgumentType(); - while (argType != NULL) { + while (argType != nullptr) { UnsignedByte type = (UnsignedByte)(argType->getType()); m_file->write(&type, sizeof(type)); @@ -825,7 +825,7 @@ void RecorderClass::writeToFile(GameMessage * msg) { } deleteInstance(parser); - parser = NULL; + parser = nullptr; } @@ -885,7 +885,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) const UnsignedInt buffersize = header.forPlayback ? replayBufferBytes : File::BUFFERSIZE; m_file = TheFileSystem->openFile(filepath.str(), File::READ | File::BINARY, buffersize); - if (m_file == NULL) + if (m_file == nullptr) { DEBUG_LOG(("Can't open %s (%s)", filepath.str(), header.filename.str())); return FALSE; @@ -897,7 +897,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) != 0 ) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have GENREP at the start.")); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } @@ -939,7 +939,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have a valid GameInfo string.")); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } m_gameInfo.startGame(0); @@ -952,7 +952,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) m_gameInfo.endGame(); m_gameInfo.reset(); m_file->close(); - m_file = NULL; + m_file = nullptr; return FALSE; } if (header.localPlayerIndex >= 0) @@ -966,7 +966,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) m_gameInfo.endGame(); m_gameInfo.reset(); m_file->close(); - m_file = NULL; + m_file = nullptr; } return TRUE; @@ -1135,7 +1135,7 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f // TheSuperHackers @tweak Pause the game on mismatch. // But not when a window with focus is opened, because that can make resuming difficult. - if (TheWindowManager->winGetFocus() == NULL) + if (TheWindowManager->winGetFocus() == nullptr) { Bool pause = TRUE; Bool pauseMusic = FALSE; @@ -1441,7 +1441,7 @@ void RecorderClass::appendNextCommand() { GameMessageParserArgumentType *parserArgType = parser->getFirstArgumentType(); GameMessageArgumentDataType lasttype = ARGUMENTDATATYPE_UNKNOWN; Int argsLeftForType = 0; - if (parserArgType != NULL) { + if (parserArgType != nullptr) { lasttype = parserArgType->getType(); argsLeftForType = parserArgType->getArgCount(); } @@ -1450,14 +1450,14 @@ void RecorderClass::appendNextCommand() { --argsLeftForType; if (argsLeftForType == 0) { - DEBUG_ASSERTCRASH(parserArgType != NULL, ("parserArgType was NULL when it shouldn't have been.")); - if (parserArgType == NULL) { + DEBUG_ASSERTCRASH(parserArgType != nullptr, ("parserArgType was null when it shouldn't have been.")); + if (parserArgType == nullptr) { return; } parserArgType = parserArgType->getNext(); - // parserArgType is allowed to be NULL here, this is the case if there are no more arguments. - if (parserArgType != NULL) { + // parserArgType is allowed to be null here, this is the case if there are no more arguments. + if (parserArgType != nullptr) { argsLeftForType = parserArgType->getArgCount(); lasttype = parserArgType->getType(); } @@ -1471,11 +1471,11 @@ void RecorderClass::appendNextCommand() { else { deleteInstance(msg); - msg = NULL; + msg = nullptr; } deleteInstance(parser); - parser = NULL; + parser = nullptr; } void RecorderClass::readArgument(GameMessageArgumentDataType type, GameMessage *msg) { @@ -1628,9 +1628,9 @@ RecorderClass::CullBadCommandsResult RecorderClass::cullBadCommands() { return result; GameMessage *msg = TheCommandList->getFirstMessage(); - GameMessage *next = NULL; + GameMessage *next = nullptr; - while (msg != NULL) { + while (msg != nullptr) { next = msg->next(); if ((msg->getType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES) && @@ -1684,7 +1684,7 @@ AsciiString RecorderClass::getLastReplayFileName() #if defined(RTS_DEBUG) if (TheNetwork && TheGlobalData->m_saveStats) { - GameInfo *game = NULL; + GameInfo *game = nullptr; if (TheLAN) game = TheLAN->GetMyGame(); else if (TheGameSpyInfo) @@ -1766,7 +1766,7 @@ RecorderModeType RecorderClass::getMode() { void RecorderClass::initControls() { NameKeyType parentReplayControlID = TheNameKeyGenerator->nameToKey( "ReplayControl.wnd:ParentReplayControl" ); - GameWindow *parentReplayControl = TheWindowManager->winGetWindowFromId( NULL, parentReplayControlID ); + GameWindow *parentReplayControl = TheWindowManager->winGetWindowFromId( nullptr, parentReplayControlID ); Bool show = (getMode() != RECORDERMODETYPE_PLAYBACK); if (parentReplayControl) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index be7de3cd04b..1d2294c321f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -266,12 +266,12 @@ StateMachine::StateMachine( Object *owner, AsciiString name ) m_sleepTill = 0; m_defaultStateID = INVALID_STATE_ID; m_defaultStateInited = false; - m_currentState = NULL; + m_currentState = nullptr; m_locked = false; #ifdef STATE_MACHINE_DEBUG m_name = name; m_debugOutput = false; - m_lockedby = NULL; + m_lockedby = nullptr; #endif internalClear(); } @@ -311,7 +311,7 @@ Bool StateMachine::getWantsDebugOutput() const } #ifdef DEBUG_OBJECT_ID_EXISTS - if (TheObjectIDToDebug != 0 && getOwner() != NULL && getOwner()->getID() == TheObjectIDToDebug) + if (TheObjectIDToDebug != 0 && getOwner() != nullptr && getOwner()->getID() == TheObjectIDToDebug) { return true; } @@ -359,7 +359,7 @@ void StateMachine::clear() if (m_currentState) m_currentState->onExit( EXIT_RESET ); - m_currentState = NULL; + m_currentState = nullptr; internalClear(); } @@ -389,7 +389,7 @@ StateReturnType StateMachine::resetToDefaultState() // allow current state to exit with EXIT_RESET if present if (m_currentState) m_currentState->onExit( EXIT_RESET ); - m_currentState = NULL; + m_currentState = nullptr; // // the current state has done an onExit, clear the internal guts before we set @@ -416,7 +416,7 @@ StateReturnType StateMachine::updateStateMachine() UnsignedInt now = TheGameLogic->getFrame(); if (m_sleepTill != 0 && now < m_sleepTill) { - if( m_currentState == NULL ) + if( m_currentState == nullptr ) { return STATE_FAILURE; } @@ -441,7 +441,7 @@ StateReturnType StateMachine::updateStateMachine() StateReturnType status = m_currentState->update(); // it is possible that the state's update() method clears the state machine. - if (m_currentState == NULL) + if (m_currentState == nullptr) { return STATE_FAILURE; } @@ -497,7 +497,7 @@ void StateMachine::defineState( StateID id, State *state, StateID successID, Sta state->friend_onSuccess(successID); state->friend_onFailure(failureID); - while (conditions && conditions->test != NULL) + while (conditions && conditions->test != nullptr) { state->friend_onCondition(conditions->test, conditions->toStateID, conditions->userData); ++conditions; @@ -563,7 +563,7 @@ StateReturnType StateMachine::setState( StateID newStateID ) */ StateReturnType StateMachine::internalSetState( StateID newStateID ) { - State *newState = NULL; + State *newState = nullptr; // anytime the state changes, stop sleeping m_sleepTill = 0; @@ -624,7 +624,7 @@ StateReturnType StateMachine::internalSetState( StateID newStateID ) StateReturnType status = m_currentState->onEnter(); // it is possible that the state's onEnter() method may cause the state to be destroyed - if (m_currentState == NULL) + if (m_currentState == nullptr) { return STATE_FAILURE; } @@ -714,7 +714,7 @@ StateReturnType StateMachine::initDefaultState() } REALLY_VERBOSE_LOG(("\n")); delete ids; - ids = NULL; + ids = nullptr; } REALLY_VERBOSE_LOG(("SM_END\n\n")); #endif @@ -748,14 +748,14 @@ Bool StateMachine::isGoalObjectDestroyed() const { return false; // never had a goal object } - return getGoalObject() == NULL; + return getGoalObject() == nullptr; } //----------------------------------------------------------------------------- void StateMachine::halt() { m_locked = true; - m_currentState = NULL; // don't exit current state, just clear it. + m_currentState = nullptr; // don't exit current state, just clear it. #ifdef STATE_MACHINE_DEBUG if (getWantsDebugOutput()) { @@ -857,7 +857,7 @@ void StateMachine::xfer( Xfer *xfer ) } for( i = m_stateMap.begin(); i != m_stateMap.end(); ++i ) { State *state = (*i).second; - if( state != NULL ) + if( state != nullptr ) { StateID id = state->getID(); xfer->xferUnsignedInt(&id); @@ -868,8 +868,8 @@ void StateMachine::xfer( Xfer *xfer ) } else { - DEBUG_CRASH(("state was NULL on xfer, trying to heal...")); - // Hmm... too late to find out why we are getting NULL in our state, but if we let it go, we will Throw in xferSnapshot. + DEBUG_CRASH(("state was null on xfer, trying to heal...")); + // Hmm... too late to find out why we are getting nullptr in our state, but if we let it go, we will Throw in xferSnapshot. state = internalGetState(m_defaultStateID); StateID id = state->getID(); xfer->xferUnsignedInt(&id); @@ -879,10 +879,10 @@ void StateMachine::xfer( Xfer *xfer ) } } else { - if( m_currentState == NULL ) + if( m_currentState == nullptr ) { - DEBUG_ASSERTCRASH(m_currentState != NULL, ("currentState was NULL on xfer, trying to heal...")); - // Hmm... too late to find out why we are getting NULL in our state, but if we let it go, we will Throw in xferSnapshot. + DEBUG_ASSERTCRASH(m_currentState != nullptr, ("currentState was null on xfer, trying to heal...")); + // Hmm... too late to find out why we are getting nullptr in our state, but if we let it go, we will Throw in xferSnapshot. m_currentState = internalGetState(m_defaultStateID); } xfer->xferSnapshot(m_currentState); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp index 4289f2b2013..e253300153f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp @@ -65,7 +65,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -StatsCollector *TheStatsCollector = NULL; +StatsCollector *TheStatsCollector = nullptr; static char statsDir[255] = "Stats\\"; //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index b3e11d5f10e..2f5db145e36 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -56,7 +56,7 @@ #include "GameLogic/Module/ParkingPlaceBehavior.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -BuildAssistant *TheBuildAssistant = NULL; +BuildAssistant *TheBuildAssistant = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -90,7 +90,7 @@ ObjectSellInfo::~ObjectSellInfo( void ) static Bool isDozer( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; if( obj->isKindOf(KINDOF_DOZER)) @@ -107,7 +107,7 @@ static Bool isDozer( Object *obj ) BuildAssistant::BuildAssistant( void ) { - m_buildPositions = NULL; + m_buildPositions = nullptr; m_buildPositionSize = 0; m_sellList.clear(); } @@ -118,7 +118,7 @@ BuildAssistant::~BuildAssistant( void ) { delete [] m_buildPositions; - m_buildPositions = NULL; + m_buildPositions = nullptr; m_buildPositionSize = 0; } @@ -190,7 +190,7 @@ void BuildAssistant::update( void ) // if object is not found, remove it from the list immediately ... this is valid as // the object maybe was destroyed by other means during the sell process // - if( obj == NULL ) + if( obj == nullptr ) { deleteInstance(sellInfo); @@ -323,11 +323,11 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe { // sanity - if( what == NULL || pos == NULL ) - return NULL; + if( what == nullptr || pos == nullptr ) + return nullptr; - if( owningPlayer == NULL ) - return NULL;// Invalid pointer. Won't happen. + if( owningPlayer == nullptr ) + return nullptr;// Invalid pointer. Won't happen. // sanity if( constructorObject ) @@ -338,9 +338,9 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } // Need to validate that we can make this in case someone fakes their CommandSet - // A NULL constructor Object means a script built building so let it slide. - if( (constructorObject != NULL) && !isPossibleToMakeUnit(constructorObject, what) ) - return NULL; + // A nullptr constructor Object means a script built building so let it slide. + if( (constructorObject != nullptr) && !isPossibleToMakeUnit(constructorObject, what) ) + return nullptr; // clear out any objects from the building area that are "auto-clearable" when building clearRemovableForConstruction( what, pos, angle ); @@ -350,7 +350,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe // totally bogus. We tried to move our units out of the way, but they wouldn't. // Chode-boys. if (owningPlayer->getPlayerType()==PLAYER_HUMAN) { - return NULL; // ai gets to cheat. jba. + return nullptr; // ai gets to cheat. jba. } } @@ -364,7 +364,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe ai->aiIdle(CMD_FROM_AI); // stop any current behavior. return ai->construct( what, pos, angle, owningPlayer, FALSE ); } - return NULL; + return nullptr; } else @@ -431,7 +431,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } - return NULL; + return nullptr; } @@ -446,7 +446,7 @@ void BuildAssistant::buildObjectLineNow( Object *constructorObject, const ThingT TileBuildInfo *tileBuildInfo; // sanity - if( what == NULL || start == NULL || end == NULL ) + if( what == nullptr || start == nullptr || end == nullptr ) return; // how big are each of our objects @@ -548,7 +548,7 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, { // sanity - if( build == NULL || worldPos == NULL || func == NULL ) + if( build == nullptr || worldPos == nullptr || func == nullptr ) return; // @@ -770,7 +770,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos Real range = 2*(build->getTemplateGeometryInfo().getMajorRadius()+build->getTemplateGeometryInfo().getMinorRadius()); PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; ObjectIterator *iter2 = ThePartitionManager->iterateObjectsInRange(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); MemoryPoolObjectHolder hold2(iter2); @@ -907,7 +907,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos //------------------------------------------------------------------------------------------------- /** Query if we can build at this location. Note that 'build' may be null and is NOT required * to be valid to know if a location is legal to build at. 'builderObject' is used - * for queries that require a pathfind check and should be NULL if not required */ + * for queries that require a pathfind check and should be null if not required */ //------------------------------------------------------------------------------------------------- LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, const ThingTemplate *build, @@ -973,12 +973,12 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, { // special case for supply centers: can't build too close to supply sources PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_SUPPLY_SOURCE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; // see if there are any reasonably close by Real range = build->getTemplateGeometryInfo().getBoundingCircleRadius() + TheGlobalData->m_SupplyBuildBorder*2; Object* tooClose = ThePartitionManager->getClosestObject(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); - if (tooClose != NULL) + if (tooClose != nullptr) { // yep, see if we would collide with an expanded version GeometryInfo tooCloseGeom = tooClose->getGeometryInfo(); @@ -1009,7 +1009,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, /**todo remove this if we need to change the semantics of this function of the builderObject // actually being able to get to the destination */ // - if( ai == NULL ) + if( ai == nullptr ) return LBC_NO_CLEAR_PATH; if( ai->isQuickPathAvailable( worldPos ) == FALSE ) @@ -1082,7 +1082,7 @@ void BuildAssistant::addBibs(const Coord3D *worldPos, range += 3*build->getTemplateGeometryInfo().getMajorRadius(); PartitionFilterAcceptByKindOf f1(MAKE_KINDOF_MASK(KINDOF_STRUCTURE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &f1, NULL }; + PartitionFilter *filters[] = { &f1, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(worldPos, range, FROM_BOUNDINGSPHERE_2D, filters); @@ -1125,8 +1125,8 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT { // sanity - if( start == NULL || end == NULL ) - return 0; + if( start == nullptr || end == nullptr ) + return nullptr; // // we will fill out our own internal array of positions, it better be big enough to @@ -1201,7 +1201,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, builderObject, - NULL) != LBC_OK ) + nullptr) != LBC_OK ) break; // save the position in the output array @@ -1228,7 +1228,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT Bool BuildAssistant::isLineBuildTemplate( const ThingTemplate *tTemplate ) { // sanity - if( tTemplate == NULL ) + if( tTemplate == nullptr ) return FALSE; if( tTemplate->isKindOf(KINDOF_LINEBUILD)) @@ -1248,14 +1248,14 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate { // sanity - if( builder == NULL || whatToBuild == NULL ) + if( builder == nullptr || whatToBuild == nullptr ) return FALSE; // get the command set for the producer object const CommandSet *commandSet = TheControlBar->findCommandSet( builder->getCommandSetString() ); // if no command set we cannot build anything - if( commandSet == NULL ) + if( commandSet == nullptr ) { DEBUG_ASSERTLOG( 0, ("Can't build a '%s' from the builder '%s' because '%s' doesn't have any command set defined", @@ -1272,7 +1272,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate // so that nobody can hack one game and cheat to make stuff that they can't usually make // const CommandButton *commandButton; - const CommandButton *foundCommand = NULL; + const CommandButton *foundCommand = nullptr; Int i; for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { @@ -1285,7 +1285,7 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate foundCommand = commandButton; } - if( foundCommand == NULL ) + if( foundCommand == nullptr ) return FALSE; // make sure that the player can actually make this unit by checking prereqs and such @@ -1307,7 +1307,7 @@ CanMakeType BuildAssistant::canMakeUnit( Object *builder, const ThingTemplate *w { // sanity - if( builder == NULL || whatToBuild == NULL ) + if( builder == nullptr || whatToBuild == nullptr ) return CANMAKE_NO_PREREQ; if (builder->testScriptStatusBit(OBJECT_STATUS_SCRIPT_DISABLED) || builder->testScriptStatusBit(OBJECT_STATUS_SCRIPT_UNPOWERED)) @@ -1334,7 +1334,7 @@ CanMakeType BuildAssistant::canMakeUnit( Object *builder, const ThingTemplate *w if (!isPossibleToMakeUnit(builder, whatToBuild)) return CANMAKE_NO_PREREQ; - if (pu != NULL) + if (pu != nullptr) { CanMakeType cmt = pu->canQueueCreateUnit(whatToBuild); if (cmt != CANMAKE_OK) @@ -1359,7 +1359,7 @@ Bool BuildAssistant::isRemovableForConstruction( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; if (obj->isKindOf(KINDOF_INERT)) @@ -1503,7 +1503,7 @@ void BuildAssistant::sellObject( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // we can only sell structures ... sanity check this @@ -1511,7 +1511,7 @@ void BuildAssistant::sellObject( Object *obj ) return; // if object already has an entry in the sell list, we shouldn't try to sell it again - ObjectSellInfo *sellInfo = NULL; + ObjectSellInfo *sellInfo = nullptr; ObjectSellListIterator it; for( it = m_sellList.begin(); it != m_sellList.end(); ++it ) { @@ -1520,10 +1520,10 @@ void BuildAssistant::sellObject( Object *obj ) if( sellInfo->m_id == obj->getID() ) break; else - sellInfo = NULL; + sellInfo = nullptr; } - if( sellInfo != NULL ) + if( sellInfo != nullptr ) return; // set the construction percent of this object just below 100.0% so we can start counting down diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp index 5b7147d1e9a..f6610198ffe 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp @@ -77,7 +77,7 @@ // Public Data //---------------------------------------------------------------------------- -CDManagerInterface* TheCDManager = NULL; +CDManagerInterface* TheCDManager = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -222,7 +222,7 @@ Int CDManager::driveCount( void ) CDDriveInterface* CDManager::getDrive( Int index ) { - CDDriveInterface *cd = NULL; + CDDriveInterface *cd = nullptr; LListNode *node = m_drives.getNode( index ); if ( node ) @@ -280,7 +280,7 @@ void CDManager::destroyAllDrives( void ) { LListNode *node; - while ( (node = m_drives.firstNode() ) != NULL ) + while ( (node = m_drives.firstNode() ) != nullptr ) { node->remove(); CDDriveInterface *drive = (CDDriveInterface *) node->item(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CriticalSection.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CriticalSection.cpp index 6b30352242f..aa3bdb50637 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/CriticalSection.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/CriticalSection.cpp @@ -27,11 +27,11 @@ #include "Common/CriticalSection.h" // Definitions. -CriticalSection *TheAsciiStringCriticalSection = NULL; -CriticalSection *TheUnicodeStringCriticalSection = NULL; -CriticalSection *TheDmaCriticalSection = NULL; -CriticalSection *TheMemoryPoolCriticalSection = NULL; -CriticalSection *TheDebugLogCriticalSection = NULL; +CriticalSection *TheAsciiStringCriticalSection = nullptr; +CriticalSection *TheUnicodeStringCriticalSection = nullptr; +CriticalSection *TheDmaCriticalSection = nullptr; +CriticalSection *TheMemoryPoolCriticalSection = nullptr; +CriticalSection *TheDebugLogCriticalSection = nullptr; #ifdef PERF_TIMERS PerfGather TheCritSecPerfGather("CritSec"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp index 6f04f71e8d7..977ecc1d782 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -37,14 +37,14 @@ // If verbose, lots of debug logging. #define not_VERBOSE -CachedFileInputStream::CachedFileInputStream(void):m_buffer(NULL),m_size(0) +CachedFileInputStream::CachedFileInputStream(void):m_buffer(nullptr),m_size(0) { } CachedFileInputStream::~CachedFileInputStream(void) { delete[] m_buffer; - m_buffer=NULL; + m_buffer=nullptr; } Bool CachedFileInputStream::open(AsciiString path) @@ -56,7 +56,7 @@ Bool CachedFileInputStream::open(AsciiString path) m_size=file->size(); if (m_size) { m_buffer = file->readEntireAndClose(); - file = NULL; + file = nullptr; } m_pos=0; } @@ -102,7 +102,7 @@ Bool CachedFileInputStream::open(AsciiString path) void CachedFileInputStream::close(void) { delete[] m_buffer; - m_buffer=NULL; + m_buffer=nullptr; m_pos=0; m_size=0; @@ -154,36 +154,36 @@ void CachedFileInputStream::rewind() // FileInputStream - helper class. Used to read in data using a FILE * // /* -FileInputStream::FileInputStream(void):m_file(NULL) +FileInputStream::FileInputStream(void):m_file(nullptr) { } FileInputStream::~FileInputStream(void) { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } } Bool FileInputStream::open(AsciiString path) { m_file = TheFileSystem->openFile(path.str(), File::READ | File::BINARY); - return m_file==NULL?false:true; + return m_file == nullptr?false:true; } void FileInputStream::close(void) { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->close(); - m_file = NULL; + m_file = nullptr; } } Int FileInputStream::read(void *pData, Int numBytes) { int bytesRead = 0; - if (m_file != NULL) { + if (m_file != nullptr) { bytesRead = m_file->read(pData, numBytes); } return(bytesRead); @@ -192,7 +192,7 @@ Int FileInputStream::read(void *pData, Int numBytes) UnsignedInt FileInputStream::tell(void) { UnsignedInt pos = 0; - if (m_file != NULL) { + if (m_file != nullptr) { pos = m_file->position(); } return(pos); @@ -200,7 +200,7 @@ UnsignedInt FileInputStream::tell(void) Bool FileInputStream::absoluteSeek(UnsignedInt pos) { - if (m_file != NULL) { + if (m_file != nullptr) { return (m_file->seek(pos, File::START) != -1); } return(false); @@ -208,7 +208,7 @@ Bool FileInputStream::absoluteSeek(UnsignedInt pos) Bool FileInputStream::eof(void) { - if (m_file != NULL) { + if (m_file != nullptr) { return (m_file->size() == m_file->position()); } return(true); @@ -216,7 +216,7 @@ Bool FileInputStream::eof(void) void FileInputStream::rewind() { - if (m_file != NULL) { + if (m_file != nullptr) { m_file->seek(0, File::START); } } @@ -237,7 +237,7 @@ m_pOut(pOut) AsciiString tmpFileName = TheGlobalData->getPath_UserData(); tmpFileName.concat(TEMP_FILENAME); m_tmp_file = ::fopen( tmpFileName.str(), "wb" ); - m_chunkStack = NULL; + m_chunkStack = nullptr; } DataChunkOutput::~DataChunkOutput() @@ -296,7 +296,7 @@ void DataChunkOutput::openDataChunk( const char *name, DataChunkVersionType ver void DataChunkOutput::closeDataChunk( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception return; @@ -414,7 +414,7 @@ void DataChunkOutput::writeDict( const Dict& d ) //---------------------------------------------------------------------- DataChunkTableOfContents::DataChunkTableOfContents( void ) : -m_list(NULL), +m_list(nullptr), m_nextID(1), m_listLength(0), m_headerOpened(false) @@ -442,7 +442,7 @@ Mapping *DataChunkTableOfContents::findMapping( const AsciiString& name ) if (name == m->name ) return m; - return NULL; + return nullptr; } // convert name to integer identifier @@ -574,10 +574,10 @@ void DataChunkTableOfContents::read( ChunkInputStream &s) // DataChunkInput //---------------------------------------------------------------------- DataChunkInput::DataChunkInput( ChunkInputStream *pStream ) : m_file( pStream ), - m_userData(NULL), - m_currentObject(NULL), - m_chunkStack(NULL), - m_parserList(NULL) + m_userData(nullptr), + m_currentObject(nullptr), + m_chunkStack(nullptr), + m_parserList(nullptr) { // read table of m_contents m_contents.read(*m_file); @@ -694,7 +694,7 @@ void DataChunkInput::clearChunkStack( void ) deleteInstance(c); } - m_chunkStack = NULL; + m_chunkStack = nullptr; } // reset the stream to just-opened state - ready to parse the first chunk @@ -747,7 +747,7 @@ AsciiString DataChunkInput::openDataChunk(DataChunkVersionType *ver ) // close chunk and move to start of next chunk void DataChunkInput::closeDataChunk( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception return; @@ -771,7 +771,7 @@ void DataChunkInput::closeDataChunk( void ) // return label of current data chunk AsciiString DataChunkInput::getChunkLabel( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); @@ -784,11 +784,11 @@ AsciiString DataChunkInput::getChunkLabel( void ) // return version of current data chunk DataChunkVersionType DataChunkInput::getChunkVersion( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->version; @@ -797,11 +797,11 @@ DataChunkVersionType DataChunkInput::getChunkVersion( void ) // return size of data stored in this chunk UnsignedInt DataChunkInput::getChunkDataSize( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->dataSize; @@ -811,11 +811,11 @@ UnsignedInt DataChunkInput::getChunkDataSize( void ) // return size of data left to read in this chunk UnsignedInt DataChunkInput::getChunkDataSizeLeft( void ) { - if (m_chunkStack == NULL) + if (m_chunkStack == nullptr) { // TODO: Throw exception DEBUG_CRASH(("Bad.")); - return NULL; + return 0; } return m_chunkStack->dataLeft; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 643d3c06116..e1259282ec0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -49,7 +49,7 @@ const char* const DisabledMaskType::s_bitNameList[] = "DISABLED_SCRIPT_DISABLED", "DISABLED_SCRIPT_UNDERPOWERED", - NULL + nullptr }; static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 3eccb5ef087..c269e5316fd 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -65,7 +65,7 @@ static FunctionLexicon::TableEntry gameWinDrawTable[] = { { NAMEKEY_INVALID, "IMECandidateMainDraw", IMECandidateMainDraw }, { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", IMECandidateTextAreaDraw }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; // game window system table ----------------------------------------------------------------------- @@ -149,7 +149,7 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = { NAMEKEY_INVALID, "ScoreScreenSystem", ScoreScreenSystem }, { NAMEKEY_INVALID, "DownloadMenuSystem", DownloadMenuSystem }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -221,7 +221,7 @@ static FunctionLexicon::TableEntry gameWinInputTable[] = { NAMEKEY_INVALID, "DownloadMenuInput", DownloadMenuInput }, { NAMEKEY_INVALID, "IMECandidateWindowInput", IMECandidateWindowInput }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -232,7 +232,7 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = { NAMEKEY_INVALID, "GameWinDefaultTooltip", GameWinDefaultTooltip }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -284,7 +284,7 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -325,7 +325,7 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -366,14 +366,14 @@ static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, NULL, NULL } + { NAMEKEY_INVALID, nullptr, nullptr } }; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA /////////////////////////////////////////////////////////////////////////////////////////////////// -FunctionLexicon *TheFunctionLexicon = NULL; ///< the function dictionary +FunctionLexicon *TheFunctionLexicon = nullptr; ///< the function dictionary //------------------------------------------------------------------------------------------------- /** Since we have a convenient table to organize our callbacks anyway, @@ -386,7 +386,7 @@ void FunctionLexicon::loadTable( TableEntry *table, { // sanity - if( table == NULL ) + if( table == nullptr ) return; // loop through all entries @@ -415,7 +415,7 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) // sanity if( key == NAMEKEY_INVALID ) - return NULL; + return nullptr; // search table for key TableEntry *entry = table; @@ -428,7 +428,7 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) } - return NULL; // not found + return nullptr; // not found } @@ -439,11 +439,11 @@ void *FunctionLexicon::keyToFunc( NameKeyType key, TableEntry *table ) //------------------------------------------------------------------------------------------------- void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) { - void *func = NULL; + void *func = nullptr; // sanity if( key == NAMEKEY_INVALID ) - return NULL; + return nullptr; // search ALL tables for function if the index paramater allows if if( index == TABLE_ANY ) @@ -481,8 +481,8 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) { // sanity - if( func == NULL ) - return NULL; + if( func == nullptr ) + return nullptr; // search the table TableEntry *entry = table; @@ -498,7 +498,7 @@ const char *FunctionLexicon::funcToName( void *func, TableEntry *table ) } - return NULL; // not found + return nullptr; // not found } #endif @@ -515,7 +515,7 @@ FunctionLexicon::FunctionLexicon( void ) // empty the tables for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) - m_tables[ i ] = NULL; + m_tables[ i ] = nullptr; } @@ -583,12 +583,12 @@ char *FunctionLexicon::functionToName( void *func ) { // sanity - if( func == NULL ) - return NULL; + if( func == nullptr ) + return nullptr; // search ALL the tables Int i; - char *name = NULL; + char *name = nullptr; for( i = 0; i < MAX_FUNCTION_TABLES; i++ ) { @@ -598,7 +598,7 @@ char *FunctionLexicon::functionToName( void *func ) } - return NULL; // not found + return nullptr; // not found } */ @@ -628,7 +628,7 @@ Bool FunctionLexicon::validate( void ) // // scan all tables looking for the function in sourceEntry, do not bother - // of source entry is NULL (a valid entry in the table, but not a function) + // of source entry is nullptr (a valid entry in the table, but not a function) // if( sourceEntry->func ) { @@ -688,7 +688,7 @@ GameWinDrawFunc FunctionLexicon::gameWinDrawFunc( NameKeyType key, TableIndex in GameWinDrawFunc func; func = (GameWinDrawFunc)findFunction( key, TABLE_GAME_WIN_DEVICEDRAW ); - if ( func == NULL ) + if ( func == nullptr ) { func = (GameWinDrawFunc)findFunction( key, TABLE_GAME_WIN_DRAW ); } @@ -706,7 +706,7 @@ WindowLayoutInitFunc FunctionLexicon::winLayoutInitFunc( NameKeyType key, TableI WindowLayoutInitFunc func; func = (WindowLayoutInitFunc)findFunction( key, TABLE_WIN_LAYOUT_DEVICEINIT ); - if ( func == NULL ) + if ( func == nullptr ) { func = (WindowLayoutInitFunc)findFunction( key, TABLE_WIN_LAYOUT_INIT ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp index 69be9afe5b4..7f8b4ff4015 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -36,7 +36,7 @@ const char *const TheVeterancyNames[] = "VETERAN", "ELITE", "HEROIC", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheVeterancyNames) == LEVEL_COUNT + 1, "Incorrect array size"); @@ -45,7 +45,7 @@ const char *const TheRelationshipNames[] = "ENEMIES", "NEUTRAL", "ALLIES", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheRelationshipNames) == RELATIONSHIP_COUNT + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp index b4fbba3d5c3..5cd0d411220 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp @@ -34,7 +34,7 @@ const char *const TimeOfDayNames[] = "EVENING", "NIGHT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TimeOfDayNames) == TIME_OF_DAY_COUNT + 1, "Incorrect array size"); @@ -43,6 +43,6 @@ const char *const WeatherNames[] = "NORMAL", "SNOWY", - NULL + nullptr }; static_assert(ARRAY_SIZE(WeatherNames) == WEATHER_COUNT + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp index 7e703a508a3..faae7432629 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -159,7 +159,7 @@ const char* const KindOfMaskType::s_bitNameList[] = "CONSERVATIVE_BUILDING", "IGNORE_DOCKING_BONES", - NULL + nullptr }; static_assert(ARRAY_SIZE(KindOfMaskType::s_bitNameList) == KindOfMaskType::NumBits + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/List.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/List.cpp index af7da9cc3f3..25f632a4987 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/List.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/List.cpp @@ -206,7 +206,7 @@ void LList::clear( void ) { LListNode *node; - while ( (node = firstNode()) != NULL ) + while ( (node = firstNode()) != nullptr ) { node->remove(); node->destroy(); @@ -252,7 +252,7 @@ LListNode* LList::getNode( Int index ) node = node->next(); } - return NULL; + return nullptr; } //============================================================================ @@ -262,7 +262,7 @@ LListNode* LList::getNode( Int index ) void LList::merge( LList *list ) { - if ( list == NULL || list->isEmpty() ) + if ( list == nullptr || list->isEmpty() ) { return; } @@ -282,7 +282,7 @@ void LList::merge( LList *list ) Bool LList::hasItem( void *item ) { - return findItem( item ) != NULL; + return findItem( item ) != nullptr; } //============================================================================ @@ -304,7 +304,7 @@ LListNode* LList::findItem( void *item ) node = node->next(); } - return NULL; + return nullptr; } //============================================================================ @@ -313,7 +313,7 @@ LListNode* LList::findItem( void *item ) LListNode::LListNode() : m_pri(0), - m_item(NULL), + m_item(nullptr), m_autoDelete(FALSE) { m_next = m_prev = this; @@ -363,7 +363,7 @@ LListNode* LListNode::next( void ) if( m_next->isHead( )) { - return NULL; + return nullptr; } return m_next; @@ -377,7 +377,7 @@ LListNode* LListNode::prev( void ) { if( m_prev->isHead()) { - return NULL; + return nullptr; } return m_prev; @@ -399,7 +399,7 @@ LListNode* LListNode::loopNext( void ) next = next->m_next; if( next->isHead( )) { - return NULL; // it is an empty list + return nullptr; // it is an empty list } } @@ -422,7 +422,7 @@ LListNode* LListNode::loopPrev( void ) prev = prev->m_prev; if( prev->isHead()) { - return NULL; // it is an empty list + return nullptr; // it is an empty list } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp index 87a5934f403..f46cb876301 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp @@ -61,7 +61,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameState *TheGameState = NULL; +GameState *TheGameState = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static const Char *SAVE_FILE_EOF = "SG_EOF"; @@ -180,7 +180,7 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn // sanity if( token.isEmpty() ) - return NULL; + return nullptr; // search for match our list SnapshotBlock *blockInfo; @@ -198,7 +198,7 @@ GameState::SnapshotBlock *GameState::findBlockInfoByToken( AsciiString token, Sn } // not found - return NULL; + return nullptr; } @@ -220,7 +220,7 @@ UnicodeString getUnicodeDateBuffer(SYSTEMTIME timeVal) GetDateFormat( LOCALE_SYSTEM_DEFAULT, DATE_SHORTDATE, &timeVal, - NULL, + nullptr, dateBuffer, sizeof(dateBuffer) ); displayDateBuffer.translate(dateBuffer); return displayDateBuffer; @@ -230,7 +230,7 @@ UnicodeString getUnicodeDateBuffer(SYSTEMTIME timeVal) GetDateFormatW( LOCALE_SYSTEM_DEFAULT, DATE_SHORTDATE, &timeVal, - NULL, + nullptr, dateBuffer, ARRAY_SIZE(dateBuffer) ); displayDateBuffer.set(dateBuffer); return displayDateBuffer; @@ -251,7 +251,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GetTimeFormat( LOCALE_SYSTEM_DEFAULT, TIME_NOSECONDS|TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &timeVal, - NULL, + nullptr, timeBuffer, sizeof(timeBuffer) ); displayTimeBuffer.translate(timeBuffer); return displayTimeBuffer; @@ -263,7 +263,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GetTimeFormatW( LOCALE_SYSTEM_DEFAULT, TIME_NOSECONDS, &timeVal, - NULL, + nullptr, timeBuffer, ARRAY_SIZE(timeBuffer) ); displayTimeBuffer.set(timeBuffer); @@ -276,7 +276,7 @@ UnicodeString getUnicodeTimeBuffer(SYSTEMTIME timeVal) GameState::GameState( void ) { - m_availableGames = NULL; + m_availableGames = nullptr; m_isInLoadGame = FALSE; } @@ -376,7 +376,7 @@ void GameState::addSnapshotBlock( AsciiString blockName, Snapshot *snapshot, Sna { // sanity - if( blockName.isEmpty() || snapshot == NULL ) + if( blockName.isEmpty() || snapshot == nullptr ) { DEBUG_CRASH(( "addSnapshotBlock: Invalid parameters" )); @@ -549,7 +549,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, } // make absolutely sure the save directory exists - CreateDirectory( getSaveDirectory().str(), NULL ); + CreateDirectory( getSaveDirectory().str(), nullptr ); // construct path to file AsciiString filepath = getFilePathInSaveDirectory(filename); @@ -599,7 +599,7 @@ SaveCode GameState::saveGame( AsciiString filename, UnicodeString desc, UnicodeString msg; msg.format( TheGameText->fetch("GUI:ErrorSavingGame"), ufilepath.str() ); - MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, nullptr); // close the file and get out of here xferSave.close(); @@ -725,7 +725,7 @@ SaveCode GameState::loadGame( AvailableGameInfo gameInfo ) UnicodeString msg; msg.format( TheGameText->fetch("GUI:ErrorLoadingGame"), ufilepath.str() ); - MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"), msg, nullptr); return SC_INVALID_DATA; // you can't use a naked "throw" outside of a catch statement! @@ -793,7 +793,7 @@ AsciiString GameState::getMapLeafName(const AsciiString& in) const // at the name only // ++p; - DEBUG_ASSERTCRASH( p != NULL && *p != 0, ("GameState::xfer - Illegal map name encountered") ); + DEBUG_ASSERTCRASH( p != nullptr && *p != 0, ("GameState::xfer - Illegal map name encountered") ); return p; } else @@ -811,7 +811,7 @@ static const char* findLastBackslashInRangeInclusive(const char* start, const ch return end; --end; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -981,7 +981,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav SnapshotBlock *blockInfo; // sanity - if( filename.isEmpty() == TRUE || saveGameInfo == NULL ) + if( filename.isEmpty() == TRUE || saveGameInfo == nullptr ) { DEBUG_CRASH(( "GameState::getSaveGameInfoFromFile - Illegal parameters" )); @@ -1020,7 +1020,7 @@ void GameState::getSaveGameInfoFromFile( AsciiString filename, SaveGameInfo *sav // find matching token in the save file lexicon blockInfo = findBlockInfoByToken( token, SNAPSHOT_SAVELOAD ); - if( blockInfo == NULL ) + if( blockInfo == nullptr ) throw SC_UNKNOWN_BLOCK; // read the data size of this block @@ -1083,7 +1083,7 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) AvailableGameInfo **listHead = (AvailableGameInfo **)userData; // sanity - DEBUG_ASSERTCRASH( listHead != NULL, ("addGameToAvailableList - Illegal parameters") ); + DEBUG_ASSERTCRASH( listHead != nullptr, ("addGameToAvailableList - Illegal parameters") ); DEBUG_ASSERTCRASH( filename.isEmpty() == FALSE, ("addGameToAvailableList - Illegal filename") ); try { @@ -1095,20 +1095,20 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) AvailableGameInfo *newInfo = new AvailableGameInfo; // assign data - newInfo->prev = NULL; - newInfo->next = NULL; + newInfo->prev = nullptr; + newInfo->next = nullptr; newInfo->saveGameInfo = saveGameInfo; newInfo->filename = filename; // attach to list - if( *listHead == NULL ) + if( *listHead == nullptr ) *listHead = newInfo; else { AvailableGameInfo *curr, *prev; // insert this info so that the most recent games are always at the top of this list - for( curr = *listHead; curr != NULL; curr = curr->next ) + for( curr = *listHead; curr != nullptr; curr = curr->next ) { // save current as previous @@ -1133,7 +1133,7 @@ static void addGameToAvailableList( AsciiString filename, void *userData ) } // if not inserted, put at end - if( curr == NULL ) + if( curr == nullptr ) { prev->next = newInfo; @@ -1157,7 +1157,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType Int index; // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // first clear all entries in the listbox @@ -1170,7 +1170,7 @@ void GameState::populateSaveGameListbox( GameWindow *listbox, SaveLoadLayoutType Color newGameColor = GameMakeColor( 200, 200, 255, 255 ); index = GadgetListBoxAddEntryText( listbox, newGameText, newGameColor, -1 ); - GadgetListBoxSetItemData( listbox, NULL, index ); + GadgetListBoxSetItemData( listbox, nullptr, index ); } @@ -1254,7 +1254,7 @@ void GameState::iterateSaveFiles( IterateSaveFileCallback callback, void *userDa { // sanity - if( callback == NULL ) + if( callback == nullptr ) return; // save the current directory @@ -1342,7 +1342,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) { // sanity - if( xfer == NULL ) + if( xfer == nullptr ) throw SC_INVALID_XFER; // save or load all blocks @@ -1437,7 +1437,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which ) // find matching token in the save file lexicon blockInfo = findBlockInfoByToken( token, which ); - if( blockInfo == NULL ) + if( blockInfo == nullptr ) { // log the block not found @@ -1492,7 +1492,7 @@ void GameState::addPostProcessSnapshot( Snapshot *snapshot ) { // sanity - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_CRASH(( "GameState::addPostProcessSnapshot - invalid parameters" )); @@ -1621,7 +1621,7 @@ void GameState::xfer( Xfer *xfer ) if (exists == FALSE || saveGameInfo->mapLabel == AsciiString::TheEmptyString) { const char* p = TheGlobalData->m_mapName.reverseFind('\\'); - if (p == NULL) + if (p == nullptr) saveGameInfo->mapLabel = TheGlobalData->m_mapName; else { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 15782d54425..9efafb2ea29 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -43,7 +43,7 @@ #include "GameNetwork/GameInfo.h" // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -GameStateMap *TheGameStateMap = NULL; +GameStateMap *TheGameStateMap = nullptr; // METHODS //////////////////////////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // open the map file File *file = TheFileSystem->openFile( map.str(), File::READ | File::BINARY ); - if( file == NULL ) + if( file == nullptr ) { DEBUG_CRASH(( "embedPristineMap - Error opening source file '%s'", map.str() )); @@ -92,7 +92,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) // allocate buffer big enough to hold the entire map file char *buffer = new char[ fileSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "embedPristineMap - Unable to allocate buffer for file '%s'", map.str() )); @@ -132,7 +132,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) FILE *fp = fopen( map.str(), "rb" ); // sanity - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_CRASH(( "embedInUseMap - Unable to open file '%s'", map.str() )); @@ -149,7 +149,7 @@ static void embedInUseMap( AsciiString map, Xfer *xfer ) // allocate a buffer big enough for the entire file char *buffer = new char[ fileSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "embedInUseMap - Unable to allocate buffer for file '%s'", map.str() )); @@ -188,7 +188,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // open handle to output file FILE *fp = fopen( mapToSave.str(), "w+b" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_CRASH(( "extractAndSaveMap - Unable to open file '%s'", mapToSave.str() )); @@ -201,7 +201,7 @@ static void extractAndSaveMap( AsciiString mapToSave, Xfer *xfer ) // allocate buffer big enough for the entire map file char *buffer = new char[ dataSize ]; - if( buffer == NULL ) + if( buffer == nullptr ) { DEBUG_CRASH(( "extractAndSaveMap - Unable to allocate buffer for file '%s'", mapToSave.str() )); @@ -415,7 +415,7 @@ void GameStateMap::xfer( Xfer *xfer ) // Save the Game Info so the game can be started with the correct players on load if( TheGameLogic->getGameMode()==GAME_SKIRMISH ) { - if( TheSkirmishGameInfo==NULL ) + if( TheSkirmishGameInfo==nullptr ) { TheSkirmishGameInfo = NEW SkirmishGameInfo; TheSkirmishGameInfo->init(); @@ -427,7 +427,7 @@ void GameStateMap::xfer( Xfer *xfer ) else { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } // diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp index b6a48d47376..74b0c151670 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -59,7 +59,7 @@ void StackDumpDefaultHandler(const char*line) //***************************************************************************** void StackDump(void (*callback)(const char*)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -89,7 +89,7 @@ _asm //***************************************************************************** void StackDumpFromContext(DWORD eip,DWORD esp,DWORD ebp, void (*callback)(const char*)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -127,10 +127,10 @@ BOOL InitSymbolInfo() process = GetCurrentProcess(); //Get the apps name - ::GetModuleFileName(NULL, pathname, _MAX_PATH); + ::GetModuleFileName(nullptr, pathname, _MAX_PATH); // turn it into a search path - _splitpath(pathname, drive, directory, NULL, NULL); + _splitpath(pathname, drive, directory, nullptr, nullptr); sprintf(pathname, "%s:\\%s", drive, directory); // append the current directory to build a search path for SymInit @@ -139,8 +139,8 @@ BOOL InitSymbolInfo() if(DbgHelpLoader::symInitialize(process, pathname, FALSE)) { // regenerate the name of the app - ::GetModuleFileName(NULL, pathname, _MAX_PATH); - if(DbgHelpLoader::symLoadModule(process, NULL, pathname, NULL, 0, 0)) + ::GetModuleFileName(nullptr, pathname, _MAX_PATH); + if(DbgHelpLoader::symLoadModule(process, nullptr, pathname, nullptr, 0, 0)) { //Load any other relevant modules (ie dlls) here atexit(DbgHelpLoader::unload); @@ -197,11 +197,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL); + nullptr); skip--; } @@ -213,11 +213,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL); + nullptr); @@ -356,11 +356,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL) != 0; + nullptr) != 0; skip--; } @@ -370,11 +370,11 @@ stack_frame.AddrFrame.Offset = myebp; process, thread, &stack_frame, - NULL, //&gsContext, - NULL, + nullptr, //&gsContext, + nullptr, DbgHelpLoader::symFunctionTableAccess, DbgHelpLoader::symGetModuleBase, - NULL) != 0; + nullptr) != 0; if (stillgoing) { *addresses = (void*)stack_frame.AddrPC.Offset; @@ -386,7 +386,7 @@ stack_frame.AddrFrame.Offset = myebp; // Fill remainder while (count) { - *addresses = NULL; + *addresses = nullptr; addresses++; count--; } @@ -395,7 +395,7 @@ stack_frame.AddrFrame.Offset = myebp; /* else { - memset(addresses,NULL,count*sizeof(void*)); + memset(addresses,nullptr,count*sizeof(void*)); } */ } @@ -407,7 +407,7 @@ stack_frame.AddrFrame.Offset = myebp; //***************************************************************************** void StackDumpFromAddresses(void**addresses, unsigned int count, void (*callback)(const char *)) { - if (callback == NULL) + if (callback == nullptr) { callback = StackDumpDefaultHandler; } @@ -415,7 +415,7 @@ void StackDumpFromAddresses(void**addresses, unsigned int count, void (*callback if (!InitSymbolInfo()) return; - while ((count--) && (*addresses!=NULL)) + while ((count--) && (*addresses!=nullptr)) { WriteStackLine(*addresses,callback); addresses++; @@ -558,7 +558,7 @@ void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) } DOUBLE_DEBUG (("\nStack Dump:")); - StackDumpFromContext(context->Eip, context->Esp, context->Ebp, NULL); + StackDumpFromContext(context->Eip, context->Esp, context->Ebp, nullptr); DOUBLE_DEBUG (("\nDetails:")); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp index 1047f7970a8..15df5a40844 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp @@ -42,12 +42,12 @@ const char *const TheUpgradeTypeNames[] = { "PLAYER", "OBJECT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheUpgradeTypeNames) == NUM_UPGRADE_TYPES + 1, "Incorrect array size"); // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -class UpgradeCenter *TheUpgradeCenter = NULL; +class UpgradeCenter *TheUpgradeCenter = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // UPGRADE //////////////////////////////////////////////////////////////////////////////////////// @@ -60,8 +60,8 @@ Upgrade::Upgrade( const UpgradeTemplate *upgradeTemplate ) m_template = upgradeTemplate; m_status = UPGRADE_STATUS_INVALID; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; } @@ -115,15 +115,15 @@ void Upgrade::loadPostProcess( void ) const FieldParse UpgradeTemplate::m_upgradeFieldParseTable[] = { - { "DisplayName", INI::parseAsciiString, NULL, offsetof( UpgradeTemplate, m_displayNameLabel ) }, + { "DisplayName", INI::parseAsciiString, nullptr, offsetof( UpgradeTemplate, m_displayNameLabel ) }, { "Type", INI::parseIndexList, TheUpgradeTypeNames, offsetof( UpgradeTemplate, m_type ) }, - { "BuildTime", INI::parseReal, NULL, offsetof( UpgradeTemplate, m_buildTime ) }, - { "BuildCost", INI::parseInt, NULL, offsetof( UpgradeTemplate, m_cost ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( UpgradeTemplate, m_buttonImageName ) }, - { "ResearchSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_researchSound ) }, - { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, + { "BuildTime", INI::parseReal, nullptr, offsetof( UpgradeTemplate, m_buildTime ) }, + { "BuildCost", INI::parseInt, nullptr, offsetof( UpgradeTemplate, m_cost ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( UpgradeTemplate, m_buttonImageName ) }, + { "ResearchSound", INI::parseAudioEventRTS, nullptr, offsetof( UpgradeTemplate, m_researchSound ) }, + { "UnitSpecificSound", INI::parseAudioEventRTS, nullptr, offsetof( UpgradeTemplate, m_unitSpecificSound ) }, { "AcademyClassify", INI::parseIndexList, TheAcademyClassificationTypeNames, offsetof( UpgradeTemplate, m_academyClassificationType ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -135,9 +135,9 @@ UpgradeTemplate::UpgradeTemplate( void ) m_type = UPGRADE_TYPE_PLAYER; m_nameKey = NAMEKEY_INVALID; m_buildTime = 0.0f; - m_next = NULL; - m_prev = NULL; - m_buttonImage = NULL; + m_next = nullptr; + m_prev = nullptr; + m_buttonImage = nullptr; m_academyClassificationType = ACT_NONE; } @@ -223,7 +223,7 @@ void UpgradeTemplate::cacheButtonImage() UpgradeCenter::UpgradeCenter( void ) { - m_upgradeList = NULL; + m_upgradeList = nullptr; m_nextTemplateMaskBit = 0; buttonImagesCached = FALSE; @@ -314,7 +314,7 @@ UpgradeTemplate *UpgradeCenter::findNonConstUpgradeByKey( NameKeyType key ) return upgrade; // item not found - return NULL; + return nullptr; } @@ -341,7 +341,7 @@ const UpgradeTemplate *UpgradeCenter::findUpgradeByKey( NameKeyType key ) const return upgrade; // item not found - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -400,11 +400,11 @@ void UpgradeCenter::linkUpgrade( UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; // link - upgrade->friend_setPrev( NULL ); + upgrade->friend_setPrev( nullptr ); upgrade->friend_setNext( m_upgradeList ); if( m_upgradeList ) m_upgradeList->friend_setPrev( upgrade ); @@ -419,7 +419,7 @@ void UpgradeCenter::unlinkUpgrade( UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; if( upgrade->friend_getNext() ) @@ -438,7 +438,7 @@ Bool UpgradeCenter::canAffordUpgrade( Player *player, const UpgradeTemplate *upg { // sanity - if( player == NULL || upgradeTemplate == NULL ) + if( player == nullptr || upgradeTemplate == nullptr ) return FALSE; // money check @@ -483,7 +483,7 @@ void UpgradeCenter::parseUpgradeDefinition( INI *ini ) // find existing item if present UpgradeTemplate* upgrade = TheUpgradeCenter->findNonConstUpgradeByKey( NAMEKEY(name) ); - if( upgrade == NULL ) + if( upgrade == nullptr ) { // allocate a new item diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp index 8520c0a1197..5b70b5095dd 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp @@ -78,7 +78,7 @@ const char *EncryptString(const char *String) for (Cnt = 0; Cnt < MAX_ENCRYPTED_STRING; Cnt++) Return_Buffer[Cnt] = Base_String[Temp_Buffer[Cnt] & 0x3F]; - Return_Buffer[Cnt] = NULL; + Return_Buffer[Cnt] = '\0'; return (Return_Buffer); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp index 339423da85b..df78c8ed782 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp @@ -41,7 +41,7 @@ Bool getStringFromRegistry(HKEY root, AsciiString path, AsciiString key, AsciiS if ((returnValue = RegOpenKeyEx( root, path.str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -64,7 +64,7 @@ Bool getUnsignedIntFromRegistry(HKEY root, AsciiString path, AsciiString key, Un if ((returnValue = RegOpenKeyEx( root, path.str(), 0, KEY_READ, &handle )) == ERROR_SUCCESS) { - returnValue = RegQueryValueEx(handle, key.str(), NULL, &type, (unsigned char *) &buffer, &size); + returnValue = RegQueryValueEx(handle, key.str(), nullptr, &type, (unsigned char *) &buffer, &size); RegCloseKey( handle ); } @@ -85,7 +85,7 @@ Bool setStringInRegistry( HKEY root, AsciiString path, AsciiString key, AsciiStr int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_SZ; size = val.getLength()+1; @@ -104,7 +104,7 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns int size; char lpClass[] = "REG_NONE"; - if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &handle, NULL )) == ERROR_SUCCESS) + if ((returnValue = RegCreateKeyEx( root, path.str(), 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &handle, nullptr )) == ERROR_SUCCESS) { type = REG_DWORD; size = 4; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp index 43b5186f626..08ed9776d01 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/TerrainTypes.cpp @@ -36,18 +36,18 @@ #include "Common/TerrainTypes.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -TerrainTypeCollection *TheTerrainTypes = NULL; +TerrainTypeCollection *TheTerrainTypes = nullptr; // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// const FieldParse TerrainType::m_terrainTypeFieldParseTable[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( TerrainType, m_texture ) }, - { "BlendEdges", INI::parseBool, NULL, offsetof( TerrainType, m_blendEdgeTexture ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( TerrainType, m_texture ) }, + { "BlendEdges", INI::parseBool, nullptr, offsetof( TerrainType, m_blendEdgeTexture ) }, { "Class", INI::parseIndexList, terrainTypeNames, offsetof( TerrainType, m_class ) }, - { "RestrictConstruction", INI::parseBool, NULL, offsetof( TerrainType, m_restrictConstruction ) }, + { "RestrictConstruction", INI::parseBool, nullptr, offsetof( TerrainType, m_restrictConstruction ) }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; @@ -61,7 +61,7 @@ TerrainType::TerrainType( void ) m_blendEdgeTexture = FALSE; m_class = TERRAIN_NONE; m_restrictConstruction = FALSE; - m_next = NULL; + m_next = nullptr; } @@ -81,7 +81,7 @@ TerrainType::~TerrainType( void ) TerrainTypeCollection::TerrainTypeCollection( void ) { - m_terrainList = NULL; + m_terrainList = nullptr; } @@ -124,7 +124,7 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) } // not found - return NULL; + return nullptr; } @@ -133,7 +133,7 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name ) //------------------------------------------------------------------------------------------------- TerrainType *TerrainTypeCollection::newTerrain( AsciiString name ) { - TerrainType *terrain = NULL; + TerrainType *terrain = nullptr; // allocate a new type terrain = newInstance(TerrainType); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp index 0607cddd1d4..bfe7b6b6ee6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp @@ -60,7 +60,7 @@ { ModuleData* data = MSGNEW("Module::friend_newModuleData") ModuleData; // no need to memorypool these since we never allocate more than one of each if (ini) - ini->initFromINI(data, 0); // this is just so that an "end" token is required + ini->initFromINI(data, nullptr); // this is just so that an "end" token is required return data; } @@ -112,7 +112,7 @@ ObjectModule::ObjectModule( Thing *thing, const ModuleData* moduleData ) : Modul throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH( thing, ("Thing passed to ObjectModule is NULL!") ); + DEBUG_ASSERTCRASH( thing, ("Thing passed to ObjectModule is null!") ); m_object = AsObject(thing); DEBUG_ASSERTCRASH( m_object, ("Thing passed to ObjectModule is not an Object!") ); @@ -175,7 +175,7 @@ DrawableModule::DrawableModule( Thing *thing, const ModuleData* moduleData ) : M throw INI_INVALID_DATA; } - DEBUG_ASSERTCRASH( thing, ("Thing passed to DrawableModule is NULL!") ); + DEBUG_ASSERTCRASH( thing, ("Thing passed to DrawableModule is null!") ); m_drawable = AsDrawable(thing); DEBUG_ASSERTCRASH( m_drawable, ("Thing passed to DrawableModule is not a Drawable!") ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 7d85052fd7c..07ba266dc19 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -281,7 +281,7 @@ #include "GameClient/Module/BeaconClientUpdate.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ModuleFactory *TheModuleFactory = NULL; ///< the module factory singleton +ModuleFactory *TheModuleFactory = nullptr; ///< the module factory singleton // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -580,7 +580,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam const AsciiString& moduleTag) { if (name.isEmpty()) - return NULL; + return nullptr; const ModuleTemplate* moduleTemplate = findModuleTemplate(name, type); if (moduleTemplate) @@ -591,7 +591,7 @@ ModuleData* ModuleFactory::newModuleDataFromINI(INI* ini, const AsciiString& nam return md; } - return NULL; + return nullptr; } // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -614,7 +614,7 @@ const ModuleFactory::ModuleTemplate* ModuleFactory::findModuleTemplate(const Asc if (it == m_moduleTemplateMap.end()) { DEBUG_CRASH(( "Module name '%s' not found", name.str() )); - return NULL; + return nullptr; } else { @@ -631,7 +631,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M if( name.isEmpty() ) { DEBUG_CRASH(("attempting to create module with empty name")); - return NULL; + return nullptr; } const ModuleTemplate* mt = findModuleTemplate(name, type); if (mt) @@ -644,34 +644,34 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M BehaviorModule* bm = (BehaviorModule*)mod; DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_BODY)) != 0) == (bm->getBody() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_BODY)) != 0) == (bm->getBody() != nullptr), ("getInterfaceMask bad for MODULE_BODY (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_COLLIDE)) != 0) == (bm->getCollide() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_COLLIDE)) != 0) == (bm->getCollide() != nullptr), ("getInterfaceMask bad for MODULE_COLLIDE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_CONTAIN)) != 0) == (bm->getContain() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_CONTAIN)) != 0) == (bm->getContain() != nullptr), ("getInterfaceMask bad for MODULE_CONTAIN (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_CREATE)) != 0) == (bm->getCreate() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_CREATE)) != 0) == (bm->getCreate() != nullptr), ("getInterfaceMask bad for MODULE_CREATE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DAMAGE)) != 0) == (bm->getDamage() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DAMAGE)) != 0) == (bm->getDamage() != nullptr), ("getInterfaceMask bad for MODULE_DAMAGE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DESTROY)) != 0) == (bm->getDestroy() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DESTROY)) != 0) == (bm->getDestroy() != nullptr), ("getInterfaceMask bad for MODULE_DESTROY (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_DIE)) != 0) == (bm->getDie() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_DIE)) != 0) == (bm->getDie() != nullptr), ("getInterfaceMask bad for MODULE_DIE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) == (bm->getSpecialPower() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) == (bm->getSpecialPower() != nullptr), ("getInterfaceMask bad for MODULE_SPECIAL_POWER (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_UPDATE)) != 0) == (bm->getUpdate() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_UPDATE)) != 0) == (bm->getUpdate() != nullptr), ("getInterfaceMask bad for MODULE_UPDATE (%s)",name.str())); DEBUG_ASSERTCRASH( - ((mt->m_whichInterfaces & (MODULEINTERFACE_UPGRADE)) != 0) == (bm->getUpgrade() != NULL), + ((mt->m_whichInterfaces & (MODULEINTERFACE_UPGRADE)) != 0) == (bm->getUpgrade() != nullptr), ("getInterfaceMask bad for MODULE_UPGRADE (%s)",name.str())); } #endif @@ -679,7 +679,7 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const M return mod; } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp index 6fc61f7be96..50bd1d01e36 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -56,7 +56,7 @@ static constexpr const Real InitialThingPosY = 0.0f; Thing::Thing( const ThingTemplate *thingTemplate ) { // sanity - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { // cannot create thing without template @@ -374,7 +374,7 @@ void Thing::transformPoint( const Coord3D *in, Coord3D *out ) { // santiy - if( in == NULL || out == NULL ) + if( in == nullptr || out == nullptr ) return; // for conversion diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 71a9e724fbf..2f190e8d2df 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -52,7 +52,7 @@ enum { TEMPLATE_HASH_SIZE = 12288 }; // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ThingFactory *TheThingFactory = NULL; ///< Thing manager singleton declaration +ThingFactory *TheThingFactory = nullptr; ///< Thing manager singleton declaration // STATIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -103,7 +103,7 @@ void ThingFactory::addTemplate( ThingTemplate *tmplate ) //------------------------------------------------------------------------------------------------- ThingFactory::ThingFactory() { - m_firstTemplate = NULL; + m_firstTemplate = nullptr; m_nextTemplateID = 1; // not zero! #ifdef USING_STLPORT @@ -169,10 +169,10 @@ ThingTemplate* ThingFactory::newOverride( ThingTemplate *thingTemplate ) { // sanity - DEBUG_ASSERTCRASH( thingTemplate, ("newOverride(): NULL 'parent' thing template") ); + DEBUG_ASSERTCRASH( thingTemplate, ("newOverride(): null 'parent' thing template") ); // sanity just for debuging, the weapon must be in the master list to do overrides - DEBUG_ASSERTCRASH( findTemplate( thingTemplate->getName() ) != NULL, + DEBUG_ASSERTCRASH( findTemplate( thingTemplate->getName() ) != nullptr, ("newOverride(): Thing template '%s' not in master list", thingTemplate->getName().str()) ); @@ -219,7 +219,7 @@ void ThingFactory::reset( void ) possibleAdjustment = TRUE; } - // if stillValid is NULL after we delete the overrides, then this template was created for + // if stillValid is nullptr after we delete the overrides, then this template was created for // this map only. If it also happens to be m_firstTemplate, then we need to update m_firstTemplate // as well. Finally, if it was only created for this map, we need to remove the name from the // hash map, to prevent any crashes. @@ -227,11 +227,11 @@ void ThingFactory::reset( void ) AsciiString templateName = t->getName(); Overridable *stillValid = t->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_firstTemplate = nextT; } - if (stillValid == NULL) { + if (stillValid == nullptr) { // Also needs to be removed from the Hash map. m_templateHashMap.erase(templateName); } @@ -265,7 +265,7 @@ const ThingTemplate *ThingFactory::findByTemplateID( UnsignedShort id ) return tmpl; } DEBUG_CRASH(("template %d not found",(Int)id)); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -302,14 +302,14 @@ ThingTemplate *ThingFactory::findTemplateInternal( const AsciiString& name, Bool { DEBUG_CRASH( ("Failed to find thing template %s (case sensitive) This issue has a chance of crashing after you ignore it!", name.str() ) ); } - return NULL; + return nullptr; } //============================================================================= Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, ObjectStatusMaskType statusBits ) { - if (tmplate == NULL) + if (tmplate == nullptr) throw ERROR_BAD_ARG; const std::vector& asv = tmplate->getBuildVariations(); @@ -317,7 +317,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec { Int which = GameLogicRandomValue(0, asv.size()-1); const ThingTemplate* tmp = findTemplate( asv[which] ); - if (tmp != NULL) + if (tmp != nullptr) tmplate = tmp; } @@ -354,7 +354,7 @@ Object *ThingFactory::newObject( const ThingTemplate *tmplate, Team *team, Objec //============================================================================= Drawable *ThingFactory::newDrawable(const ThingTemplate *tmplate, DrawableStatusBits statusBits) { - if (tmplate == NULL) + if (tmplate == nullptr) throw ERROR_BAD_ARG; Drawable *draw = TheGameClient->friend_createDrawable( tmplate, statusBits ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 70d8c1b2b9e..e398a434676 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -108,48 +108,48 @@ AudioEventRTS ThingTemplate::s_audioEventNoSound; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above const FieldParse ThingTemplate::s_objectFieldParseTable[] = { - { "DisplayName", INI::parseAndTranslateLabel, NULL, offsetof( ThingTemplate, m_displayName ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( ThingTemplate, m_displayName ) }, { "RadarPriority", INI::parseByteSizedIndexList, RadarPriorityNames, offsetof( ThingTemplate, m_radarPriority ) }, - { "TransportSlotCount", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_transportSlotCount ) }, - { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, - { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, - { "IsBridge", INI::parseBool, NULL, offsetof( ThingTemplate, m_isBridge ) }, - { "ArmorSet", ThingTemplate::parseArmorTemplateSet, NULL, 0}, - { "WeaponSet", ThingTemplate::parseWeaponTemplateSet,NULL, 0}, - { "VisionRange", INI::parseReal, NULL, offsetof( ThingTemplate, m_visionRange ) }, - { "ShroudClearingRange", INI::parseReal, NULL, offsetof( ThingTemplate, m_shroudClearingRange ) }, - { "ShroudRevealToAllRange", INI::parseReal, NULL, offsetof( ThingTemplate, m_shroudRevealToAllRange ) }, + { "TransportSlotCount", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_transportSlotCount ) }, + { "FenceWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceWidth ) }, + { "FenceXOffset", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceXOffset ) }, + { "IsBridge", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isBridge ) }, + { "ArmorSet", ThingTemplate::parseArmorTemplateSet, nullptr, 0}, + { "WeaponSet", ThingTemplate::parseWeaponTemplateSet,nullptr, 0}, + { "VisionRange", INI::parseReal, nullptr, offsetof( ThingTemplate, m_visionRange ) }, + { "ShroudClearingRange", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shroudClearingRange ) }, + { "ShroudRevealToAllRange", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shroudRevealToAllRange ) }, - { "PlacementViewAngle", INI::parseAngleReal, NULL, offsetof( ThingTemplate, m_placementViewAngle ) }, + { "PlacementViewAngle", INI::parseAngleReal, nullptr, offsetof( ThingTemplate, m_placementViewAngle ) }, - { "FactoryExitWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_factoryExitWidth ) }, - { "FactoryExtraBibWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_factoryExtraBibWidth ) }, + { "FactoryExitWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_factoryExitWidth ) }, + { "FactoryExtraBibWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_factoryExtraBibWidth ) }, { "SkillPointValue", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_skillPointValues ) }, { "ExperienceValue", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_experienceValues ) }, { "ExperienceRequired", ThingTemplate::parseIntList, (void*)LEVEL_COUNT, offsetof( ThingTemplate, m_experienceRequired ) }, - { "IsTrainable", INI::parseBool, NULL, offsetof( ThingTemplate, m_isTrainable ) }, - { "EnterGuard", INI::parseBool, NULL, offsetof( ThingTemplate, m_enterGuard ) }, - { "HijackGuard", INI::parseBool, NULL, offsetof( ThingTemplate, m_hijackGuard ) }, + { "IsTrainable", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isTrainable ) }, + { "EnterGuard", INI::parseBool, nullptr, offsetof( ThingTemplate, m_enterGuard ) }, + { "HijackGuard", INI::parseBool, nullptr, offsetof( ThingTemplate, m_hijackGuard ) }, - { "Side", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_defaultOwningSide ) }, + { "Side", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_defaultOwningSide ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "Prerequisites", ThingTemplate::parsePrerequisites, 0, 0 }, + { "Prerequisites", ThingTemplate::parsePrerequisites, nullptr, 0 }, { "Buildable", INI::parseByteSizedIndexList, BuildableStatusNames, offsetof( ThingTemplate, m_buildable) }, - { "BuildCost", INI::parseUnsignedShort, NULL, offsetof( ThingTemplate, m_buildCost ) }, - { "BuildTime", INI::parseReal, NULL, offsetof( ThingTemplate, m_buildTime ) }, - { "RefundValue", INI::parseUnsignedShort, NULL, offsetof( ThingTemplate, m_refundValue ) }, + { "BuildCost", INI::parseUnsignedShort, nullptr, offsetof( ThingTemplate, m_buildCost ) }, + { "BuildTime", INI::parseReal, nullptr, offsetof( ThingTemplate, m_buildTime ) }, + { "RefundValue", INI::parseUnsignedShort, nullptr, offsetof( ThingTemplate, m_refundValue ) }, { "BuildCompletion", INI::parseByteSizedIndexList, BuildCompletionNames, offsetof( ThingTemplate, m_buildCompletion ) }, - { "EnergyProduction", INI::parseInt, NULL, offsetof( ThingTemplate, m_energyProduction ) }, - { "EnergyBonus", INI::parseInt, NULL, offsetof( ThingTemplate, m_energyBonus ) }, - { "IsForbidden", INI::parseBool, NULL, offsetof( ThingTemplate, m_isForbidden ) }, - { "IsPrerequisite", INI::parseBool, NULL, offsetof( ThingTemplate, m_isPrerequisite ) }, - { "DisplayColor", INI::parseColorInt, NULL, offsetof( ThingTemplate, m_displayColor ) }, + { "EnergyProduction", INI::parseInt, nullptr, offsetof( ThingTemplate, m_energyProduction ) }, + { "EnergyBonus", INI::parseInt, nullptr, offsetof( ThingTemplate, m_energyBonus ) }, + { "IsForbidden", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isForbidden ) }, + { "IsPrerequisite", INI::parseBool, nullptr, offsetof( ThingTemplate, m_isPrerequisite ) }, + { "DisplayColor", INI::parseColorInt, nullptr, offsetof( ThingTemplate, m_displayColor ) }, { "EditorSorting", INI::parseByteSizedIndexList, EditorSortingNames, offsetof( ThingTemplate, m_editorSorting ) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( ThingTemplate, m_kindof ) }, - { "CommandSet", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_commandSetString ) }, - { "BuildVariations", INI::parseAsciiStringVector, NULL, offsetof( ThingTemplate, m_buildVariations ) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( ThingTemplate, m_kindof ) }, + { "CommandSet", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_commandSetString ) }, + { "BuildVariations", INI::parseAsciiStringVector, nullptr, offsetof( ThingTemplate, m_buildVariations ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above { "Behavior", ThingTemplate::parseModuleName, (const void*)MODULETYPE_BEHAVIOR, offsetof(ThingTemplate, m_behaviorModuleInfo) }, @@ -158,94 +158,94 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] = { "ClientUpdate", ThingTemplate::parseModuleName, (const void*)MODULETYPE_CLIENT_UPDATE, offsetof(ThingTemplate, m_clientUpdateModuleInfo) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "SelectPortrait", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_selectedPortraitImageName ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_buttonImageName ) }, + { "SelectPortrait", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_selectedPortraitImageName ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_buttonImageName ) }, //Code renderer handles these states now. - //{ "InventoryImageEnabled", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_ENABLED ] ) }, - //{ "InventoryImageDisabled", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_DISABLED ] ) }, - //{ "InventoryImageHilite", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_HILITE ] ) }, - //{ "InventoryImagePushed", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_PUSHED ] ) }, + //{ "InventoryImageEnabled", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_ENABLED ] ) }, + //{ "InventoryImageDisabled", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_DISABLED ] ) }, + //{ "InventoryImageHilite", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_HILITE ] ) }, + //{ "InventoryImagePushed", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_inventoryImage[ INV_IMAGE_PUSHED ] ) }, - { "UpgradeCameo1", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 0 ] ) }, - { "UpgradeCameo2", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 1 ] ) }, - { "UpgradeCameo3", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 2 ] ) }, - { "UpgradeCameo4", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 3 ] ) }, - { "UpgradeCameo5", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 4 ] ) }, + { "UpgradeCameo1", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 0 ] ) }, + { "UpgradeCameo2", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 1 ] ) }, + { "UpgradeCameo3", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 2 ] ) }, + { "UpgradeCameo4", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 3 ] ) }, + { "UpgradeCameo5", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_upgradeCameoUpgradeNames[ 4 ] ) }, // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above - { "VoiceSelect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelect]) }, - { "VoiceGroupSelect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGroupSelect]) }, - { "VoiceMove", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMove]) }, - { "VoiceAttack", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttack]) }, - { "VoiceEnter", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceEnter ]) }, - { "VoiceFear", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceFear ]) }, - { "VoiceSelectElite", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelectElite ]) }, - { "VoiceCreated", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceCreated]) }, - { "VoiceTaskUnable", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskUnable ]) }, - { "VoiceTaskComplete", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskComplete ]) }, - { "VoiceMeetEnemy", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMeetEnemy]) }, - { "VoiceGarrison", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGarrison]) }, + { "VoiceSelect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelect]) }, + { "VoiceGroupSelect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGroupSelect]) }, + { "VoiceMove", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMove]) }, + { "VoiceAttack", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttack]) }, + { "VoiceEnter", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceEnter ]) }, + { "VoiceFear", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceFear ]) }, + { "VoiceSelectElite", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSelectElite ]) }, + { "VoiceCreated", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceCreated]) }, + { "VoiceTaskUnable", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskUnable ]) }, + { "VoiceTaskComplete", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceTaskComplete ]) }, + { "VoiceMeetEnemy", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceMeetEnemy]) }, + { "VoiceGarrison", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGarrison]) }, #ifdef ALLOW_SURRENDER - { "VoiceSurrender", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSurrender]) }, + { "VoiceSurrender", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceSurrender]) }, #endif - { "VoiceDefect", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceDefect]) }, - { "VoiceAttackSpecial", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackSpecial ]) }, - { "VoiceAttackAir", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackAir ]) }, - { "VoiceGuard", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGuard ]) }, - { "SoundMoveStart", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStart]) }, - { "SoundMoveStartDamaged",INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStartDamaged]) }, - { "SoundMoveLoop", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoop]) }, - { "SoundMoveLoopDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoopDamaged]) }, - { "SoundAmbient", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbient ]) }, - { "SoundAmbientDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientDamaged ]) }, - { "SoundAmbientReallyDamaged",INI::parseDynamicAudioEventRTS, NULL,offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientReallyDamaged ]) }, - { "SoundAmbientRubble", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientRubble]) }, - { "SoundStealthOn", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOn ]) }, - { "SoundStealthOff", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOff ]) }, - { "SoundCreated", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCreated ]) }, - { "SoundOnDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnDamaged ]) }, - { "SoundOnReallyDamaged", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnReallyDamaged ]) }, - { "SoundEnter", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundEnter ]) }, - { "SoundExit", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundExit ]) }, - { "SoundPromotedVeteran", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedVeteran ]) }, - { "SoundPromotedElite", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedElite ]) }, - { "SoundPromotedHero", INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedHero ]) }, - { "SoundFallingFromPlane",INI::parseDynamicAudioEventRTS, NULL, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundFalling ]) }, - - { "UnitSpecificSounds", ThingTemplate::parsePerUnitSounds, NULL, offsetof(ThingTemplate, m_perUnitSounds) }, - { "UnitSpecificFX", ThingTemplate::parsePerUnitFX, NULL, offsetof(ThingTemplate, m_perUnitFX) }, - { "Scale", INI::parseReal, NULL, offsetof( ThingTemplate, m_assetScale ) }, - { "Geometry", GeometryInfo::parseGeometryType, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryHeight", GeometryInfo::parseGeometryHeight, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, + { "VoiceDefect", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceDefect]) }, + { "VoiceAttackSpecial", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackSpecial ]) }, + { "VoiceAttackAir", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceAttackAir ]) }, + { "VoiceGuard", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_voiceGuard ]) }, + { "SoundMoveStart", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStart]) }, + { "SoundMoveStartDamaged",INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveStartDamaged]) }, + { "SoundMoveLoop", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoop]) }, + { "SoundMoveLoopDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundMoveLoopDamaged]) }, + { "SoundAmbient", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbient ]) }, + { "SoundAmbientDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientDamaged ]) }, + { "SoundAmbientReallyDamaged",INI::parseDynamicAudioEventRTS, nullptr,offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientReallyDamaged ]) }, + { "SoundAmbientRubble", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundAmbientRubble]) }, + { "SoundStealthOn", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOn ]) }, + { "SoundStealthOff", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundStealthOff ]) }, + { "SoundCreated", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundCreated ]) }, + { "SoundOnDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnDamaged ]) }, + { "SoundOnReallyDamaged", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundOnReallyDamaged ]) }, + { "SoundEnter", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundEnter ]) }, + { "SoundExit", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundExit ]) }, + { "SoundPromotedVeteran", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedVeteran ]) }, + { "SoundPromotedElite", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedElite ]) }, + { "SoundPromotedHero", INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundPromotedHero ]) }, + { "SoundFallingFromPlane",INI::parseDynamicAudioEventRTS, nullptr, offsetof( ThingTemplate, m_audioarray.m_audio[TTAUDIO_soundFalling ]) }, + + { "UnitSpecificSounds", ThingTemplate::parsePerUnitSounds, nullptr, offsetof(ThingTemplate, m_perUnitSounds) }, + { "UnitSpecificFX", ThingTemplate::parsePerUnitFX, nullptr, offsetof(ThingTemplate, m_perUnitFX) }, + { "Scale", INI::parseReal, nullptr, offsetof( ThingTemplate, m_assetScale ) }, + { "Geometry", GeometryInfo::parseGeometryType, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryHeight", GeometryInfo::parseGeometryHeight, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, { "Shadow", INI::parseBitString8, TheShadowNames, offsetof( ThingTemplate, m_shadowType ) }, - { "ShadowSizeX", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowSizeX ) }, - { "ShadowSizeY", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowSizeY ) }, - { "ShadowOffsetX", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowOffsetX ) }, - { "ShadowOffsetY", INI::parseReal, NULL, offsetof( ThingTemplate, m_shadowOffsetY ) }, - { "ShadowTexture", INI::parseAsciiString, NULL, offsetof( ThingTemplate, m_shadowTextureName ) }, - { "OcclusionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ThingTemplate, m_occlusionDelay ) }, - { "AddModule", ThingTemplate::parseAddModule, NULL, 0 }, - { "RemoveModule", ThingTemplate::parseRemoveModule, NULL, 0 }, - { "ReplaceModule", ThingTemplate::parseReplaceModule, NULL, 0 }, - { "InheritableModule", ThingTemplate::parseInheritableModule, NULL, 0 }, - - { "OverrideableByLikeKind", ThingTemplate::OverrideableByLikeKind, NULL, 0 }, - - { "Locomotor", AIUpdateModuleData::parseLocomotorSet, NULL, 0 }, - { "InstanceScaleFuzziness", INI::parseReal, NULL, offsetof(ThingTemplate, m_instanceScaleFuzziness ) }, - { "StructureRubbleHeight", INI::parseUnsignedByte, NULL, offsetof(ThingTemplate, m_structureRubbleHeight ) }, - { "ThreatValue", INI::parseUnsignedShort, NULL, offsetof(ThingTemplate, m_threatValue ) }, - { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, - { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, - { "CrusherLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crusherLevel ) }, - { "CrushableLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crushableLevel ) }, - - { 0, 0, 0, 0 } + { "ShadowSizeX", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowSizeX ) }, + { "ShadowSizeY", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowSizeY ) }, + { "ShadowOffsetX", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowOffsetX ) }, + { "ShadowOffsetY", INI::parseReal, nullptr, offsetof( ThingTemplate, m_shadowOffsetY ) }, + { "ShadowTexture", INI::parseAsciiString, nullptr, offsetof( ThingTemplate, m_shadowTextureName ) }, + { "OcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ThingTemplate, m_occlusionDelay ) }, + { "AddModule", ThingTemplate::parseAddModule, nullptr, 0 }, + { "RemoveModule", ThingTemplate::parseRemoveModule, nullptr, 0 }, + { "ReplaceModule", ThingTemplate::parseReplaceModule, nullptr, 0 }, + { "InheritableModule", ThingTemplate::parseInheritableModule, nullptr, 0 }, + + { "OverrideableByLikeKind", ThingTemplate::OverrideableByLikeKind, nullptr, 0 }, + + { "Locomotor", AIUpdateModuleData::parseLocomotorSet, nullptr, 0 }, + { "InstanceScaleFuzziness", INI::parseReal, nullptr, offsetof(ThingTemplate, m_instanceScaleFuzziness ) }, + { "StructureRubbleHeight", INI::parseUnsignedByte, nullptr, offsetof(ThingTemplate, m_structureRubbleHeight ) }, + { "ThreatValue", INI::parseUnsignedShort, nullptr, offsetof(ThingTemplate, m_threatValue ) }, + { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, nullptr, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, + { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, nullptr, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, + { "CrusherLevel", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_crusherLevel ) }, + { "CrushableLevel", INI::parseUnsignedByte, nullptr, offsetof( ThingTemplate, m_crushableLevel ) }, + + { nullptr, nullptr, nullptr, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -255,19 +255,19 @@ const FieldParse ThingTemplate::s_objectReskinFieldParseTable[] = { { "Draw", ThingTemplate::parseModuleName, (const void*)MODULETYPE_DRAW, offsetof(ThingTemplate, m_drawModuleInfo) }, - { "Geometry", GeometryInfo::parseGeometryType, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryHeight", GeometryInfo::parseGeometryHeight, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, NULL, offsetof( ThingTemplate, m_geometryInfo ) }, - { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, - { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, + { "Geometry", GeometryInfo::parseGeometryType, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMajorRadius", GeometryInfo::parseGeometryMajorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryMinorRadius", GeometryInfo::parseGeometryMinorRadius, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryHeight", GeometryInfo::parseGeometryHeight, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, nullptr, offsetof( ThingTemplate, m_geometryInfo ) }, + { "FenceWidth", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceWidth ) }, + { "FenceXOffset", INI::parseReal, nullptr, offsetof( ThingTemplate, m_fenceXOffset ) }, // Needed to avoid some cheats with the scud storm rebuild hole - { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, - { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, + { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, nullptr, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, + { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, nullptr, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; // NOTE NOTE NOTE -- s_objectFieldParseTable and s_objectReskinFieldParseTable must be updated in tandem -- see comment above @@ -284,7 +284,7 @@ const ModuleInfo::Nugget *ModuleInfo::getNuggetWithTag( const AsciiString& tag ) return &(*it); // no match - return NULL; + return nullptr; } @@ -309,7 +309,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, const Nugget *nugget; nugget = thingTemplate->getBehaviorModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -327,7 +327,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, } nugget = thingTemplate->getDrawModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -345,7 +345,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, } nugget = thingTemplate->getClientUpdateModuleInfo().getNuggetWithTag( moduleTag ); - if( nugget != NULL ) + if( nugget != nullptr ) { // compare this nugget tag against the tag for the new data we're going to submit @@ -630,7 +630,7 @@ static void parsePrerequisiteUnit( INI* ini, void *instance, void * /*store*/, c ProductionPrerequisite prereq; Bool orUnitWithPrevious = FALSE; - for (const char *token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char *token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { prereq.addUnitPrereq( AsciiString( token ), orUnitWithPrevious ); orUnitWithPrevious = TRUE; @@ -657,9 +657,9 @@ void ThingTemplate::parsePrerequisites( INI* ini, void *instance, void *store, c static const FieldParse myFieldParse[] = { - { "Object", parsePrerequisiteUnit, 0, 0 }, - { "Science", parsePrerequisiteScience, 0, 0 }, - { 0, 0, 0, 0 } + { "Object", parsePrerequisiteUnit, nullptr, 0 }, + { "Science", parsePrerequisiteScience, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) @@ -677,7 +677,7 @@ static void parseArbitraryFXIntoMap( INI* ini, void *instance, void* /* store */ const char* name = (const char*)userData; const char* token = ini->getNextToken(); const FXList* fxl = TheFXListStore->findFXList(token); // could be null! - DEBUG_ASSERTCRASH(fxl != NULL || stricmp(token, "None") == 0, ("FXList %s not found!",token)); + DEBUG_ASSERTCRASH(fxl != nullptr || stricmp(token, "None") == 0, ("FXList %s not found!",token)); mapFX->insert(std::make_pair(AsciiString(name), fxl)); } @@ -691,8 +691,8 @@ void ThingTemplate::parsePerUnitFX( INI* ini, void *instance, void *store, const static const FieldParse myFieldParse[] = { - { 0, parseArbitraryFXIntoMap, NULL, 0 }, - { 0, 0, 0, 0 } + { nullptr, parseArbitraryFXIntoMap, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(fxmap, myFieldParse); @@ -721,8 +721,8 @@ void ThingTemplate::parsePerUnitSounds( INI* ini, void *instance, void *store, c static const FieldParse myFieldParse[] = { - { 0, parseArbitrarySoundsIntoMap, NULL, 0 }, - { 0, 0, 0, 0 } + { nullptr, parseArbitrarySoundsIntoMap, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(mapSounds, myFieldParse); @@ -882,10 +882,10 @@ void ArmorTemplateSet::parseArmorTemplateSet( INI* ini ) { static const FieldParse myFieldParse[] = { - { "Conditions", ArmorSetFlags::parseFromINI, NULL, offsetof( ArmorTemplateSet, m_types ) }, - { "Armor", INI::parseArmorTemplate, NULL, offsetof( ArmorTemplateSet, m_template ) }, - { "DamageFX", INI::parseDamageFX, NULL, offsetof( ArmorTemplateSet, m_fx ) }, - { 0, 0, 0, 0 } + { "Conditions", ArmorSetFlags::parseFromINI, nullptr, offsetof( ArmorTemplateSet, m_types ) }, + { "Armor", INI::parseArmorTemplate, nullptr, offsetof( ArmorTemplateSet, m_template ) }, + { "DamageFX", INI::parseDamageFX, nullptr, offsetof( ArmorTemplateSet, m_fx ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(this, myFieldParse); @@ -985,10 +985,10 @@ ThingTemplate::ThingTemplate() : m_geometryInfo(GEOMETRY_SPHERE, FALSE, 1, 1, 1) { m_moduleParsingMode = MODULEPARSE_NORMAL; - m_reskinnedFrom = NULL; + m_reskinnedFrom = nullptr; m_radarPriority = RADAR_PRIORITY_INVALID; - m_nextThingTemplate = NULL; + m_nextThingTemplate = nullptr; m_transportSlotCount = 0; m_fenceWidth = 0; m_fenceXOffset = 0; @@ -1023,8 +1023,8 @@ ThingTemplate::ThingTemplate() : m_factoryExitWidth = 0.0f; m_factoryExtraBibWidth = 0.0f; - m_selectedPortraitImage = NULL; - m_buttonImage = NULL; + m_selectedPortraitImage = nullptr; + m_buttonImage = nullptr; m_shadowType = SHADOW_NONE; m_shadowSizeX = 0.0f; @@ -1056,7 +1056,7 @@ AIUpdateModuleData *ThingTemplate::friend_getAIModuleInfo(void) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1193,13 +1193,13 @@ void ThingTemplate::validate() if (isKindOf(KINDOF_STRUCTURE)) { - if (m_armorTemplateSets.empty() || (m_armorTemplateSets.size() == 1 && m_armorTemplateSets[0].getArmorTemplate() == NULL)) + if (m_armorTemplateSets.empty() || (m_armorTemplateSets.size() == 1 && m_armorTemplateSets[0].getArmorTemplate() == nullptr)) { DEBUG_CRASH(("Structure %s has no armor, but probably should (StructureArmor) -- please fix it.)",getName().str())); } for (ArmorTemplateSetVector::const_iterator it = m_armorTemplateSets.begin(); it != m_armorTemplateSets.end(); ++it) { - if (it->getDamageFX() == NULL) + if (it->getDamageFX() == nullptr) { DEBUG_CRASH(("Structure %s has no ArmorDamageFX, and really should.",getName().str())); } @@ -1333,13 +1333,13 @@ void ThingTemplate::initForLTA(const AsciiString& name) AsciiString moduleTag; moduleTag.format( "LTA_%sDestroyDie", m_LTAName.str() ); - m_behaviorModuleInfo.addModuleInfo(this, "DestroyDie", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "DestroyDie", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_DIE), false); + m_behaviorModuleInfo.addModuleInfo(this, "DestroyDie", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "DestroyDie", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_DIE), false); moduleTag.format( "LTA_%sInactiveBody", m_LTAName.str() ); - m_behaviorModuleInfo.addModuleInfo(this, "InactiveBody", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "InactiveBody", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_BODY), false); + m_behaviorModuleInfo.addModuleInfo(this, "InactiveBody", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "InactiveBody", MODULETYPE_BEHAVIOR, moduleTag), (MODULEINTERFACE_BODY), false); moduleTag.format( "LTA_%sW3DDefaultDraw", m_LTAName.str() ); - m_drawModuleInfo.addModuleInfo(this, "W3DDefaultDraw", moduleTag, TheModuleFactory->newModuleDataFromINI(NULL, "W3DDefaultDraw", MODULETYPE_DRAW, moduleTag), (MODULEINTERFACE_DRAW), false); + m_drawModuleInfo.addModuleInfo(this, "W3DDefaultDraw", moduleTag, TheModuleFactory->newModuleDataFromINI(nullptr, "W3DDefaultDraw", MODULETYPE_DRAW, moduleTag), (MODULEINTERFACE_DRAW), false); m_armorCopiedFromDefault = false; m_weaponsCopiedFromDefault = false; @@ -1404,7 +1404,7 @@ const ThingTemplate *ThingTemplate::getBuildFacilityTemplate( const Player *play } else { - return NULL; + return nullptr; } } @@ -1423,14 +1423,14 @@ const FXList *ThingTemplate::getPerUnitFX(const AsciiString& fxName) const { if (fxName.isEmpty()) { - return NULL; + return nullptr; } PerUnitFXMap::const_iterator it = m_perUnitFX.find(fxName); if (it == m_perUnitFX.end()) { DEBUG_CRASH(("Unknown FX name (%s) asked for in ThingTemplate (%s)", fxName.str(), m_nameString.str())); - return NULL; + return nullptr; } return (it->second); @@ -1493,7 +1493,7 @@ Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const return true; // This reskinned from that reskinned from? - // Kris: added case (chassis 2 compared to chassis 3 -- NULL possible if not reskinned) + // Kris: added case (chassis 2 compared to chassis 3 -- nullptr possible if not reskinned) if( this->m_reskinnedFrom && this->m_reskinnedFrom == tt->m_reskinnedFrom ) return true; @@ -1604,6 +1604,6 @@ ModuleData* ModuleInfo::friend_getNthData(Int i) // This is kinda naughty, but its necessary. return const_cast(m_info[i].second); } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp index 7fefc7d5d1f..1a77fdeee45 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -127,7 +127,7 @@ Bool UserPreferences::load(AsciiString fname) if (fp) { char buf[LINE_LEN]; - while( fgets( buf, LINE_LEN, fp ) != NULL ) + while( fgets( buf, LINE_LEN, fp ) != nullptr ) { AsciiString line = buf; line.trim(); @@ -716,7 +716,7 @@ Money CustomMatchPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/version.cpp b/GeneralsMD/Code/GameEngine/Source/Common/version.cpp index 39876290ccc..5c7ad7bcf6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/version.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/version.cpp @@ -33,7 +33,7 @@ #include "gitinfo.h" -Version *TheVersion = NULL; ///< The Version singleton +Version *TheVersion = nullptr; ///< The Version singleton Version::Version() { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ClientInstance.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ClientInstance.cpp index 417bcbd323a..7b06108866a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/ClientInstance.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ClientInstance.cpp @@ -22,7 +22,7 @@ namespace rts { -HANDLE ClientInstance::s_mutexHandle = NULL; +HANDLE ClientInstance::s_mutexHandle = nullptr; UnsignedInt ClientInstance::s_instanceIndex = 0; #if defined(RTS_MULTI_INSTANCE) @@ -52,13 +52,13 @@ bool ClientInstance::initialize() guidStr.push_back('-'); guidStr.append(idStr); } - s_mutexHandle = CreateMutex(NULL, FALSE, guidStr.c_str()); + s_mutexHandle = CreateMutex(nullptr, FALSE, guidStr.c_str()); if (GetLastError() == ERROR_ALREADY_EXISTS) { - if (s_mutexHandle != NULL) + if (s_mutexHandle != nullptr) { CloseHandle(s_mutexHandle); - s_mutexHandle = NULL; + s_mutexHandle = nullptr; } // Try again with a new instance. ++s_instanceIndex; @@ -67,13 +67,13 @@ bool ClientInstance::initialize() } else { - s_mutexHandle = CreateMutex(NULL, FALSE, getFirstInstanceName()); + s_mutexHandle = CreateMutex(nullptr, FALSE, getFirstInstanceName()); if (GetLastError() == ERROR_ALREADY_EXISTS) { - if (s_mutexHandle != NULL) + if (s_mutexHandle != nullptr) { CloseHandle(s_mutexHandle); - s_mutexHandle = NULL; + s_mutexHandle = nullptr; } return false; } @@ -86,7 +86,7 @@ bool ClientInstance::initialize() bool ClientInstance::isInitialized() { - return s_mutexHandle != NULL; + return s_mutexHandle != nullptr; } bool ClientInstance::isMultiInstance() diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index 14c845436ad..d3a1d8ed1a5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -61,22 +61,22 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -CreditsManager *TheCredits = NULL; +CreditsManager *TheCredits = nullptr; const FieldParse CreditsManager::m_creditsFieldParseTable[] = { - { "ScrollRate", INI::parseInt, NULL, offsetof( CreditsManager, m_scrollRate ) }, - { "ScrollRateEveryFrames", INI::parseInt, NULL, offsetof( CreditsManager, m_scrollRatePerFrames ) }, - { "ScrollDown", INI::parseBool, NULL, offsetof( CreditsManager, m_scrollDown ) }, - { "TitleColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_titleColor ) }, - { "MinorTitleColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_positionColor ) }, - { "NormalColor", INI::parseColorInt, NULL, offsetof( CreditsManager, m_normalColor ) }, + { "ScrollRate", INI::parseInt, nullptr, offsetof( CreditsManager, m_scrollRate ) }, + { "ScrollRateEveryFrames", INI::parseInt, nullptr, offsetof( CreditsManager, m_scrollRatePerFrames ) }, + { "ScrollDown", INI::parseBool, nullptr, offsetof( CreditsManager, m_scrollDown ) }, + { "TitleColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_titleColor ) }, + { "MinorTitleColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_positionColor ) }, + { "NormalColor", INI::parseColorInt, nullptr, offsetof( CreditsManager, m_normalColor ) }, { "Style", INI::parseLookupList, CreditStyleNames, offsetof( CreditsManager, m_currentStyle ) }, - { "Blank", CreditsManager::parseBlank, NULL, NULL }, - { "Text", CreditsManager::parseText, NULL, NULL }, + { "Blank", CreditsManager::parseBlank, nullptr, 0 }, + { "Text", CreditsManager::parseText, nullptr, 0 }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -102,8 +102,8 @@ CreditsLine::CreditsLine() m_useSecond = FALSE; m_done = FALSE; m_style = CREDIT_STYLE_BLANK; - m_displayString = NULL; - m_secondDisplayString = NULL; + m_displayString = nullptr; + m_secondDisplayString = nullptr; } CreditsLine::~CreditsLine() @@ -113,8 +113,8 @@ CreditsLine::~CreditsLine() if(m_secondDisplayString) TheDisplayStringManager->freeDisplayString(m_secondDisplayString); - m_displayString = NULL; - m_secondDisplayString = NULL; + m_displayString = nullptr; + m_secondDisplayString = nullptr; } @@ -155,7 +155,7 @@ void CreditsManager::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Credits", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Credits", INI_LOAD_OVERWRITE, nullptr ); if(m_scrollRatePerFrames <=0) m_scrollRatePerFrames = 1; @@ -207,8 +207,8 @@ void CreditsManager::update( void ) { TheDisplayStringManager->freeDisplayString(cLine->m_displayString); TheDisplayStringManager->freeDisplayString(cLine->m_secondDisplayString); - cLine->m_displayString = NULL; - cLine->m_secondDisplayString = NULL; + cLine->m_displayString = nullptr; + cLine->m_secondDisplayString = nullptr; drawIt = m_displayedCreditLineList.erase(drawIt); } else diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp index 1b75c624683..015b66c3e88 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp @@ -38,31 +38,31 @@ //#include "GameLogic/GameLogic.h" /// The Display singleton instance. -Display *TheDisplay = NULL; +Display *TheDisplay = nullptr; Display::Display() { - m_viewList = NULL; + m_viewList = nullptr; m_width = 0; m_height = 0; m_bitDepth = 0; m_windowed = FALSE; - m_videoBuffer = NULL; - m_videoStream = NULL; - m_debugDisplayCallback = NULL; - m_debugDisplayUserData = NULL; - m_debugDisplay = NULL; + m_videoBuffer = nullptr; + m_videoStream = nullptr; + m_debugDisplayCallback = nullptr; + m_debugDisplayUserData = nullptr; + m_debugDisplay = nullptr; m_letterBoxFadeLevel = 0; m_letterBoxEnabled = FALSE; m_cinematicText = AsciiString::TheEmptyString; - m_cinematicFont = NULL; + m_cinematicFont = nullptr; m_cinematicTextFrames = 0; m_movieHoldTime = -1; m_copyrightHoldTime = -1; m_elapsedMovieTime = 0; m_elapsedCopywriteTime = 0; - m_copyrightDisplayString = NULL; + m_copyrightDisplayString = nullptr; m_currentlyPlayingMovie.clear(); m_letterBoxFadeStartTime = 0; @@ -92,7 +92,7 @@ void Display::deleteViews( void ) next = v->getNextView(); delete v; } - m_viewList = NULL; + m_viewList = nullptr; } /** @@ -212,7 +212,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -223,7 +223,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_elapsedMovieTime = timeGetTime(); // we're using time get time becuase legal want's actual "Seconds" m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -247,7 +247,7 @@ void Display::playMovie( AsciiString movieName) m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -255,7 +255,7 @@ void Display::playMovie( AsciiString movieName) m_currentlyPlayingMovie = movieName; m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -273,12 +273,12 @@ void Display::playMovie( AsciiString movieName) void Display::stopMovie( void ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } if (!m_currentlyPlayingMovie.isEmpty()) { @@ -288,7 +288,7 @@ void Display::stopMovie( void ) if(m_copyrightDisplayString) { TheDisplayStringManager->freeDisplayString(m_copyrightDisplayString); - m_copyrightDisplayString = NULL; + m_copyrightDisplayString = nullptr; } m_copyrightHoldTime = -1; m_movieHoldTime = -1; @@ -366,7 +366,7 @@ void Display::reset() Bool Display::isMoviePlaying(void) { - return m_videoStream != NULL && m_videoBuffer != NULL; + return m_videoStream != nullptr && m_videoBuffer != nullptr; } //============================================================================ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp index 8d61a053e45..418b8144d9f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayString.cpp @@ -74,10 +74,10 @@ DisplayString::DisplayString( void ) { // m_textString = ""; // not necessary, done by default - m_font = NULL; + m_font = nullptr; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; } @@ -117,7 +117,7 @@ void DisplayString::reset( void ) m_textString.clear(); // no font - m_font = NULL; + m_font = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp index 6d8adb6b174..dcf6524b79e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/DisplayStringManager.cpp @@ -32,7 +32,7 @@ #include "GameClient/DisplayStringManager.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -DisplayStringManager *TheDisplayStringManager = NULL; +DisplayStringManager *TheDisplayStringManager = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS @@ -43,8 +43,8 @@ DisplayStringManager *TheDisplayStringManager = NULL; DisplayStringManager::DisplayStringManager( void ) { - m_stringList = NULL; - m_currentCheckpoint = NULL; + m_stringList = nullptr; + m_currentCheckpoint = nullptr; } @@ -57,7 +57,7 @@ DisplayStringManager::~DisplayStringManager( void ) // we only keep track of the strings, we do NOT de-allocate them, our // list better be cleaned out before we destroy ourselves // - assert( m_stringList == NULL ); + assert( m_stringList == nullptr ); } @@ -68,8 +68,8 @@ void DisplayStringManager::link( DisplayString *string ) { assert( string ); - assert( string->m_next == NULL ); - assert( string->m_prev == NULL ); + assert( string->m_next == nullptr ); + assert( string->m_prev == nullptr ); string->m_next = m_stringList; if( m_stringList ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp index 558cee48c1e..22723e8d910 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/DrawGroupInfo.cpp @@ -52,4 +52,4 @@ DrawGroupInfo::DrawGroupInfo() m_usingPixelOffsetY = TRUE; } -DrawGroupInfo *TheDrawGroupInfo = NULL; +DrawGroupInfo *TheDrawGroupInfo = nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index c8f9b0f56ac..3d8b0c30f93 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -110,7 +110,7 @@ static const char *const TheDrawableIconNames[] = "Enthusiastic",//a red cross? // soon to replace? "Subliminal", //with the gold border! replace? "CarBomb", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheDrawableIconNames) == MAX_ICONS + 1, "Incorrect array size"); @@ -124,9 +124,9 @@ static_assert(ARRAY_SIZE(TheDrawableIconNames) == MAX_ICONS + 1, "Incorrect arra */ static DynamicAudioEventInfo * getNoSoundMarker() { - static DynamicAudioEventInfo * marker = NULL; + static DynamicAudioEventInfo * marker = nullptr; - if ( marker == NULL ) + if ( marker == nullptr ) { // Initialize first time function is called marker = newInstance( DynamicAudioEventInfo ); @@ -143,7 +143,7 @@ DrawableIconInfo::DrawableIconInfo() { for (int i = 0; i < MAX_ICONS; ++i) { - m_icon[i] = NULL; + m_icon[i] = nullptr; m_keepTillFrame[i] = 0; } } @@ -162,7 +162,7 @@ void DrawableIconInfo::clear() for (int i = 0; i < MAX_ICONS; ++i) { deleteInstance(m_icon[i]); - m_icon[i] = NULL; + m_icon[i] = nullptr; m_keepTillFrame[i] = 0; } } @@ -174,7 +174,7 @@ void DrawableIconInfo::killIcon(DrawableIconType t) if (m_icon[t]) { deleteInstance(m_icon[t]); - m_icon[t] = NULL; + m_icon[t] = nullptr; m_keepTillFrame[t] = 0; } } @@ -231,7 +231,7 @@ static const char *drawableIconIndexToName( DrawableIconType iconIndex ) static DrawableIconType drawableIconNameToIndex( const char *iconName ) { - DEBUG_ASSERTCRASH( iconName != NULL, ("drawableIconNameToIndex - Illegal name") ); + DEBUG_ASSERTCRASH( iconName != nullptr, ("drawableIconNameToIndex - Illegal name") ); for( Int i = ICON_FIRST; i < MAX_ICONS; ++i ) if( stricmp( TheDrawableIconNames[ i ], iconName ) == 0 ) @@ -258,12 +258,12 @@ const Int MAX_ENABLED_MODULES = 16; // ------------------------------------------------------------------------------------------------ /*static*/ Bool Drawable::s_staticImagesInited = false; -/*static*/ const Image* Drawable::s_veterancyImage[LEVEL_COUNT] = { NULL }; -/*static*/ const Image* Drawable::s_fullAmmo = NULL; -/*static*/ const Image* Drawable::s_emptyAmmo = NULL; -/*static*/ const Image* Drawable::s_fullContainer = NULL; -/*static*/ const Image* Drawable::s_emptyContainer = NULL; -/*static*/ Anim2DTemplate** Drawable::s_animationTemplates = NULL; +/*static*/ const Image* Drawable::s_veterancyImage[LEVEL_COUNT] = { nullptr }; +/*static*/ const Image* Drawable::s_fullAmmo = nullptr; +/*static*/ const Image* Drawable::s_emptyAmmo = nullptr; +/*static*/ const Image* Drawable::s_fullContainer = nullptr; +/*static*/ const Image* Drawable::s_emptyContainer = nullptr; +/*static*/ Anim2DTemplate** Drawable::s_animationTemplates = nullptr; #ifdef DIRTY_CONDITION_FLAGS /*static*/ Int Drawable::s_modelLockCount = 0; #endif @@ -274,7 +274,7 @@ const Int MAX_ENABLED_MODULES = 16; if (s_staticImagesInited) return; - s_veterancyImage[0] = NULL; + s_veterancyImage[0] = nullptr; s_veterancyImage[1] = TheMappedImageCollection->findImageByName("SCVeter1"); s_veterancyImage[2] = TheMappedImageCollection->findImageByName("SCVeter2"); s_veterancyImage[3] = TheMappedImageCollection->findImageByName("SCVeter3"); @@ -298,7 +298,7 @@ const Int MAX_ENABLED_MODULES = 16; s_animationTemplates[ICON_BATTLEPLAN_BOMBARD] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_BOMBARD]); s_animationTemplates[ICON_BATTLEPLAN_HOLDTHELINE] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_HOLDTHELINE]); s_animationTemplates[ICON_BATTLEPLAN_SEARCHANDDESTROY] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_BATTLEPLAN_SEARCHANDDESTROY]); - s_animationTemplates[ICON_EMOTICON] = NULL; //Emoticons can be anything, so we'll need to handle it dynamically. + s_animationTemplates[ICON_EMOTICON] = nullptr; //Emoticons can be anything, so we'll need to handle it dynamically. s_animationTemplates[ICON_ENTHUSIASTIC] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_ENTHUSIASTIC]); s_animationTemplates[ICON_ENTHUSIASTIC_SUBLIMINAL] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_ENTHUSIASTIC_SUBLIMINAL]); s_animationTemplates[ICON_CARBOMB] = TheAnim2DCollection->findTemplate(TheDrawableIconNames[ICON_CARBOMB]); @@ -311,7 +311,7 @@ const Int MAX_ENABLED_MODULES = 16; /*static*/ void Drawable::killStaticImages() { delete[] s_animationTemplates; - s_animationTemplates = NULL; + s_animationTemplates = nullptr; } //------------------------------------------------------------------------------------------------- @@ -349,10 +349,10 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu // assign status bits before anything else can be done m_status = statusBits; - m_nextDrawable = NULL; - m_prevDrawable = NULL; + m_nextDrawable = nullptr; + m_prevDrawable = nullptr; - m_customSoundAmbientInfo = NULL; + m_customSoundAmbientInfo = nullptr; // register drawable with the GameClient ... do this first before we start doing anything // complex that uses any of the drawable data so that we have and ID!! It's ok to initialize @@ -374,7 +374,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu TheGlobalLanguageData->adjustFontSize(TheInGameUI->getDrawableCaptionPointSize()), TheInGameUI->isDrawableCaptionBold() )); - m_ambientSound = NULL; + m_ambientSound = nullptr; m_ambientSoundEnabled = true; m_ambientSoundEnabledFromScript = true; @@ -394,17 +394,17 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_shroudClearFrame = InvalidShroudClearFrame; for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) - m_modules[i] = NULL; + m_modules[i] = nullptr; m_stealthLook = STEALTHLOOK_NONE; m_flashCount = 0; - m_locoInfo = NULL; - m_physicsXform = NULL; + m_locoInfo = nullptr; + m_physicsXform = nullptr; // sanity - if( TheGameClient == NULL || thingTemplate == NULL ) + if( TheGameClient == nullptr || thingTemplate == nullptr ) { assert( 0 ); @@ -420,7 +420,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu m_instanceScale = thingTemplate->getAssetScale();// * fuzzyScale; // initially not bound to an object - m_object = NULL; + m_object = nullptr; // tintStatusTracking m_tintStatus = 0; @@ -457,7 +457,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu continue; *m++ = TheModuleFactory->newModule(this, drawMI.getNthName(modIdx), newModData, MODULETYPE_DRAW); } - *m = NULL; + *m = nullptr; const ModuleInfo& cuMI = thingTemplate->getClientUpdateModuleInfo(); if (cuMI.getCount()) @@ -477,7 +477,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu *m++ = TheModuleFactory->newModule(this, cuMI.getNthName(modIdx), newModData, MODULETYPE_CLIENT_UPDATE); } - *m = NULL; + *m = nullptr; } /// allow for inter-Module resolution @@ -495,14 +495,14 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu (*dm)->setShadowsEnabled(shadowsEnabled); } - m_groupNumber = NULL; - m_captionDisplayString = NULL; + m_groupNumber = nullptr; + m_captionDisplayString = nullptr; m_drawableInfo.m_drawable = this; - m_drawableInfo.m_ghostObject = NULL; + m_drawableInfo.m_ghostObject = nullptr; - m_iconInfo = NULL; // lazily allocate! - m_selectionFlashEnvelope = NULL; // lazily allocate! - m_colorTintEnvelope = NULL; // lazily allocate! + m_iconInfo = nullptr; // lazily allocate! + m_selectionFlashEnvelope = nullptr; // lazily allocate! + m_colorTintEnvelope = nullptr; // lazily allocate! initStaticImages(); @@ -518,7 +518,7 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu // This is all really traceable to the fact that stopAmbientSound() won't stop a sound which // is in the middle of playing; it will only stop it when the current wavefile is finished. // So we have to be very careful of called startAmbientSound() because we can't "take it back" later. - if ( TheGameLogic != NULL && !TheGameLogic->isLoadingMap() && TheGameState != NULL && !TheGameState->isInLoadGame() ) + if ( TheGameLogic != nullptr && !TheGameLogic->isLoadingMap() && TheGameState != nullptr && !TheGameState->isInLoadGame() ) { startAmbientSound(); } @@ -533,13 +533,13 @@ Drawable::~Drawable() if( m_constructDisplayString ) TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; if ( m_captionDisplayString ) TheDisplayStringManager->freeDisplayString( m_captionDisplayString ); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; - m_groupNumber = NULL; + m_groupNumber = nullptr; // delete any modules callbacks for (i = 0; i < NUM_DRAWABLE_MODULE_TYPES; ++i) @@ -547,16 +547,16 @@ Drawable::~Drawable() for (Module** m = m_modules[i]; m && *m; ++m) { deleteInstance(*m); - *m = NULL; // in case other modules call findModule from their dtor! + *m = nullptr; // in case other modules call findModule from their dtor! } delete [] m_modules[i]; - m_modules[i] = NULL; + m_modules[i] = nullptr; } stopAmbientSound(); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; clearCustomSoundAmbient( false ); @@ -564,21 +564,21 @@ Drawable::~Drawable() // remove any entries that might be present from the ray effect system TheGameClient->removeFromRayEffects( this ); - // reset object to NULL so we never mistaken grab "dead" objects - m_object = NULL; + // reset object to nullptr so we never mistaken grab "dead" objects + m_object = nullptr; // delete any icons present deleteInstance(m_iconInfo); - m_iconInfo = NULL; + m_iconInfo = nullptr; deleteInstance(m_selectionFlashEnvelope); - m_selectionFlashEnvelope = NULL; + m_selectionFlashEnvelope = nullptr; deleteInstance(m_colorTintEnvelope); - m_colorTintEnvelope = NULL; + m_colorTintEnvelope = nullptr; deleteInstance(m_locoInfo); - m_locoInfo = NULL; + m_locoInfo = nullptr; delete m_physicsXform; } @@ -661,7 +661,7 @@ Bool Drawable::getShouldAnimate( Bool considerPower ) const Bool Drawable::clientOnly_getFirstRenderObjInfo(Coord3D* pos, Real* boundingSphereRadius, Matrix3D* transform) { DrawModule** dm = getDrawModules(); - const ObjectDrawInterface* di = (dm && *dm) ? (*dm)->getObjectDrawInterface() : NULL; + const ObjectDrawInterface* di = (dm && *dm) ? (*dm)->getObjectDrawInterface() : nullptr; if (di) { return di->clientOnly_getRenderObjInfo(pos, boundingSphereRadius, transform); @@ -951,7 +951,7 @@ void Drawable::friend_clearSelected( void ) // ------------------------------------------------------------------------------------------------ void Drawable::colorFlash( const RGBColor* color, UnsignedInt decayFrames, UnsignedInt attackFrames, UnsignedInt sustainAtPeak ) { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); if( color ) @@ -978,7 +978,7 @@ void Drawable::colorTint( const RGBColor* color ) } else { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); // remove the tint applied to the object @@ -1028,7 +1028,7 @@ const Vector3 * Drawable::getTintColor( void ) const } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1044,7 +1044,7 @@ const Vector3 * Drawable::getSelectionColor( void ) const } } - return NULL; + return nullptr; } @@ -1215,7 +1215,7 @@ void Drawable::updateDrawable( void ) if (m_expirationDate != 0 && now >= m_expirationDate) { - DEBUG_ASSERTCRASH(obj == NULL, ("Drawables with Objects should not have expiration dates!")); + DEBUG_ASSERTCRASH(obj == nullptr, ("Drawables with Objects should not have expiration dates!")); TheGameClient->destroyDrawable(this); return; } @@ -1238,21 +1238,21 @@ void Drawable::updateDrawable( void ) { if ( testTintStatus( TINT_STATUS_DISABLED ) ) { - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->play( &DARK_GRAY_DISABLED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); } else if( testTintStatus(TINT_STATUS_GAINING_SUBDUAL_DAMAGE) ) { // Disabled has precendence, so it goes first - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->play( &SUBDUAL_DAMAGE_COLOR, 150, 150, SUSTAIN_INDEFINITELY); } else if( testTintStatus(TINT_STATUS_FRENZY) ) { // Disabled has precendence, so it goes first - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->play( isKindOf( KINDOF_INFANTRY) ? &FRENZY_COLOR_INFANTRY:&FRENZY_COLOR, 30, 30, SUSTAIN_INDEFINITELY); @@ -1260,20 +1260,20 @@ void Drawable::updateDrawable( void ) } // else if ( testTintStatus( TINT_STATUS_POISONED) ) // { -// if (m_colorTintEnvelope == NULL) +// if (m_colorTintEnvelope == nullptr) // m_colorTintEnvelope = newInstance(TintEnvelope); // m_colorTintEnvelope->play( &SICKLY_GREEN_POISONED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); // } // else if ( testTintStatus( TINT_STATUS_IRRADIATED) ) // { -// if (m_colorTintEnvelope == NULL) +// if (m_colorTintEnvelope == nullptr) // m_colorTintEnvelope = newInstance(TintEnvelope); // m_colorTintEnvelope->play( &RED_IRRADIATED_COLOR, 30, 30, SUSTAIN_INDEFINITELY); // } else { // NO TINTING SHOULD BE PRESENT - if (m_colorTintEnvelope == NULL) + if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->release(); // head on back to normal, now } @@ -1308,14 +1308,14 @@ void Drawable::updateDrawable( void ) { const AudioEventInfo * eventInfo = m_ambientSound->m_event.getAudioEventInfo(); - if ( eventInfo == NULL && TheAudio != NULL ) + if ( eventInfo == nullptr && TheAudio != nullptr ) { // We'll need this in a second anyway so cache it TheAudio->getInfoForAudioEvent( &m_ambientSound->m_event ); eventInfo = m_ambientSound->m_event.getAudioEventInfo(); } - if ( eventInfo == NULL || ( eventInfo->isPermanentSound() ) ) + if ( eventInfo == nullptr || ( eventInfo->isPermanentSound() ) ) { startAmbientSound(); } @@ -1330,7 +1330,7 @@ void Drawable::onLevelStart() // the call to startAmbientSound in the constructor is too early to // actually start the sound if the constructor is called during level load. if( m_ambientSoundEnabled && m_ambientSoundEnabledFromScript && - ( m_ambientSound == NULL || + ( m_ambientSound == nullptr || ( !m_ambientSound->m_event.getEventName().isEmpty() && !m_ambientSound->m_event.isCurrentlyPlaying() ) ) ) { // Unlike the check in the update() function, we want to do this for looping & one-shot sounds equally @@ -1341,7 +1341,7 @@ void Drawable::onLevelStart() //------------------------------------------------------------------------------------------------- void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care of the details if you spec no color { - if (m_selectionFlashEnvelope == NULL) + if (m_selectionFlashEnvelope == nullptr) m_selectionFlashEnvelope = newInstance(TintEnvelope); if ( color ) @@ -1370,7 +1370,7 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes care //------------------------------------------------------------------------------------------------- void Drawable::applyPhysicsXform(Matrix3D* mtx) { - if (m_physicsXform != NULL) + if (m_physicsXform != nullptr) { // TheSuperHackers @tweak Update the physics transform on every WW Sync only. // All calculations are originally catered to a 30 fps logic step. @@ -1441,7 +1441,7 @@ Bool Drawable::calcPhysicsXform(PhysicsXformInfo& info) // ------------------------------------------------------------------------------------------------ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); Real THRUST_ROLL = locomotor->getThrustRoll(); @@ -1520,7 +1520,7 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit(); @@ -1539,16 +1539,16 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; // get our position and direction vector @@ -1632,7 +1632,7 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real OVERLAP_SHRINK_FACTOR = 0.8f; @@ -1652,16 +1652,16 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return ; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; // get our position and direction vector @@ -1686,7 +1686,7 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI // get object we are currently overlapping, if any Object* overlapped = TheGameLogic->findObjectByID(physics->getCurrentOverlap()); if (overlapped && overlapped->isKindOf(KINDOF_SHRUBBERY)) { - overlapped = NULL; // We just smash through shrubbery. jba. + overlapped = nullptr; // We just smash through shrubbery. jba. } if (overlapped) @@ -1890,7 +1890,7 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformI //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit(); @@ -1912,16 +1912,16 @@ void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformI // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return ; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return ; // get our position and direction vector @@ -2185,7 +2185,7 @@ void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformI //------------------------------------------------------------------------------------------------- void Drawable::calcPhysicsXformMotorcycle( const Locomotor *locomotor, PhysicsXformInfo& info ) { - if (m_locoInfo == NULL) + if (m_locoInfo == nullptr) m_locoInfo = newInstance(DrawableLocoInfo); const Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit(); @@ -2207,16 +2207,16 @@ void Drawable::calcPhysicsXformMotorcycle( const Locomotor *locomotor, PhysicsXf // get object from logic Object *obj = getObject(); - if (obj == NULL) + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) return ; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return ; // get our position and direction vector @@ -2672,11 +2672,11 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region ) { // sanity - if( draw == NULL ) + if( draw == nullptr ) return FALSE; const Object *obj = draw->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return FALSE; Coord3D p; @@ -2731,7 +2731,7 @@ Bool Drawable::drawsAnyUIText( void ) if (groupNum > NO_HOTKEY_SQUAD && groupNum < NUM_HOTKEY_SQUADS ) return TRUE; else - m_groupNumber = NULL; + m_groupNumber = nullptr; if ( obj->getFormationID() != NO_FORMATION_ID ) return TRUE; @@ -2750,7 +2750,7 @@ void Drawable::drawIconUI( void ) if( TheGameLogic->getDrawIconUI() && (TheScriptEngine->getFade()==ScriptEngine::FADE_NONE) ) { IRegion2D healthBarRegionStorage; - const IRegion2D* healthBarRegion = NULL; + const IRegion2D* healthBarRegion = nullptr; if (computeHealthRegion(this, healthBarRegionStorage)) healthBarRegion = &healthBarRegionStorage; //both data and a PointerAsFlag for logic in the methods below @@ -2801,7 +2801,7 @@ void Drawable::drawIconUI( void ) //------------------------------------------------------------------------------------------------ DrawableIconInfo* Drawable::getIconInfo() { - if (m_iconInfo == NULL) + if (m_iconInfo == nullptr) m_iconInfo = newInstance(DrawableIconInfo); return m_iconInfo; } @@ -2823,8 +2823,8 @@ void Drawable::setEmoticon( const AsciiString &name, Int duration ) Anim2DTemplate *animTemplate = TheAnim2DCollection->findTemplate( name ); if( animTemplate ) { - DEBUG_ASSERTCRASH( getIconInfo()->m_icon[ ICON_EMOTICON ] == NULL, ("Drawable::setEmoticon - Emoticon isn't empty, need to refuse to set or destroy the old one in favor of the new one") ); - if( getIconInfo()->m_icon[ ICON_EMOTICON ] == NULL ) + DEBUG_ASSERTCRASH( getIconInfo()->m_icon[ ICON_EMOTICON ] == nullptr, ("Drawable::setEmoticon - Emoticon isn't empty, need to refuse to set or destroy the old one in favor of the new one") ); + if( getIconInfo()->m_icon[ ICON_EMOTICON ] == nullptr ) { getIconInfo()->m_icon[ ICON_EMOTICON ] = newInstance(Anim2D)( animTemplate, TheAnim2DCollection ); getIconInfo()->m_keepTillFrame[ ICON_EMOTICON ] = duration >= 0 ? TheGameLogic->getFrame() + duration : FOREVER; @@ -3105,7 +3105,7 @@ void Drawable::drawUIText() // GameClient caches a list of us drawables during Drawablepostdraw() // then our group numbers get spit out last, so they draw in front - const IRegion2D* healthBarRegion = NULL; + const IRegion2D* healthBarRegion = nullptr; IRegion2D healthBarRegionStorage; if (computeHealthRegion(this, healthBarRegionStorage)) healthBarRegion = &healthBarRegionStorage; //both data and a PointerAsFlag for logic in the methods below @@ -3235,7 +3235,7 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion) if( body->getHealth() != body->getMaxHealth() ) { // const DamageInfo* lastDamage = body->getLastDamageInfo(); -// if( lastDamage != NULL && lastDamage->in.m_damageType == DAMAGE_HEALING +// if( lastDamage != nullptr && lastDamage->in.m_damageType == DAMAGE_HEALING // &&(TheGameLogic->getFrame() - body->getLastHealingTimestamp()) <= HEALING_ICON_DISPLAY_TIME // ) if ( TheGameLogic->getFrame() > HEALING_ICON_DISPLAY_TIME && // because so many things init health early in game @@ -3269,14 +3269,14 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion) // if( showHealing ) /// @todo HERE, WE NEED TO LEAVE STUFF ALONE, IF WE ARE ALREADY SHOWING HEALING { - if (healthBarRegion != NULL) + if (healthBarRegion != nullptr) { - if( getIconInfo()->m_icon[ typeIndex ] == NULL ) + if( getIconInfo()->m_icon[ typeIndex ] == nullptr ) getIconInfo()->m_icon[ typeIndex ] = newInstance(Anim2D)( s_animationTemplates[ typeIndex ], TheAnim2DCollection ); // draw the animation if present - if( getIconInfo()->m_icon[ typeIndex ] != NULL) + if( getIconInfo()->m_icon[ typeIndex ] != nullptr) { // @@ -3324,7 +3324,7 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion) // only display if have enthusiasm if( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_ENTHUSIASTIC ) == TRUE && - healthBarRegion != NULL ) + healthBarRegion != nullptr ) { DrawableIconType iconIndex = ICON_ENTHUSIASTIC; @@ -3335,11 +3335,11 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion) - if( getIconInfo()->m_icon[ iconIndex ] == NULL ) + if( getIconInfo()->m_icon[ iconIndex ] == nullptr ) getIconInfo()->m_icon[ iconIndex ] = newInstance(Anim2D)( s_animationTemplates[ iconIndex ], TheAnim2DCollection ); // draw the animation if present - if( getIconInfo()->m_icon[ iconIndex ] != NULL) + if( getIconInfo()->m_icon[ iconIndex ] != nullptr) { // @@ -3404,7 +3404,7 @@ void Drawable::drawDemoralized(const IRegion2D* healthBarRegion) if( healthBarRegion ) { // create icon if necessary - if( getIconInfo()->m_icon[ ICON_DEMORALIZED ] == NULL ) + if( getIconInfo()->m_icon[ ICON_DEMORALIZED ] == nullptr ) getIconInfo()->m_icon[ ICON_DEMORALIZED ] = newInstance(Anim2D)( s_animationTemplates[ ICON_DEMORALIZED ], TheAnim2DCollection ); if (getIconInfo()->m_icon[ ICON_DEMORALIZED ]) @@ -3638,7 +3638,7 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion) ) { // create icon if necessary - if( getIconInfo()->m_icon[ ICON_DISABLED ] == NULL ) + if( getIconInfo()->m_icon[ ICON_DISABLED ] == nullptr ) { getIconInfo()->m_icon[ ICON_DISABLED ] = newInstance(Anim2D) ( s_animationTemplates[ ICON_DISABLED ], TheAnim2DCollection ); @@ -3685,7 +3685,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) // this data is in an attached object Object *obj = getObject(); - if( obj == NULL || !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || + if( obj == nullptr || !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) || obj->getStatusBits().test( OBJECT_STATUS_SOLD ) ) { // no object, or we are now complete get rid of the string if we have one @@ -3693,7 +3693,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) { TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; } return; } @@ -3705,7 +3705,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) //} // construction is partially complete, allocate a display string if we need one - if( m_constructDisplayString == NULL ) + if( m_constructDisplayString == nullptr ) m_constructDisplayString = TheDisplayStringManager->newDisplayString(); // set the string if the value has changed @@ -3785,7 +3785,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion ) // get object from drawble Object* obj = getObject(); - if( obj->getExperienceTracker() == NULL ) + if( obj->getExperienceTracker() == nullptr ) { //Only objects with experience trackers can possibly have veterancy. return; @@ -3847,7 +3847,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) Object *obj = getObject(); // if no object, nothing to do - if( obj == NULL ) + if( obj == nullptr ) return; if( obj->isKindOf( KINDOF_FORCEATTACKABLE ) ) @@ -3967,7 +3967,7 @@ void Drawable::clearAndSetModelConditionState( ModelConditionFlagType clr, Model DrawModule** Drawable::getDrawModulesNonDirty() { DrawModule** dm = (DrawModule**)getModuleList(MODULETYPE_DRAW); - DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); + DEBUG_ASSERTCRASH(dm != nullptr, ("Draw Module List is not expected null")); return dm; } @@ -3993,7 +3993,7 @@ DrawModule** Drawable::getDrawModules() } #endif - DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); + DEBUG_ASSERTCRASH(dm != nullptr, ("Draw Module List is not expected null")); return dm; } @@ -4019,7 +4019,7 @@ DrawModule const** Drawable::getDrawModules() const } #endif - DEBUG_ASSERTCRASH(dm != NULL, ("Draw Module List is not expected NULL")); + DEBUG_ASSERTCRASH(dm != nullptr, ("Draw Module List is not expected null")); return dm; } @@ -4178,7 +4178,7 @@ void Drawable::friend_bindToObject( Object *obj ) ///< bind this drawable to an PhysicsXformInfo physicsXform; if (calcPhysicsXform(physicsXform)) { - DEBUG_ASSERTCRASH(m_physicsXform == NULL, ("m_physicsXform is not NULL")); + DEBUG_ASSERTCRASH(m_physicsXform == nullptr, ("m_physicsXform is not null")); m_physicsXform = new PhysicsXformInfo; *m_physicsXform = physicsXform; } @@ -4324,7 +4324,7 @@ void Drawable::setCaptionText( const UnicodeString& captionText ) UnicodeString sanitizedString = captionText; TheLanguageFilter->filterLine(sanitizedString); - if( m_captionDisplayString == NULL ) + if( m_captionDisplayString == nullptr ) { m_captionDisplayString = TheDisplayStringManager->newDisplayString(); GameFont *font = TheFontLibrary->getFont( @@ -4349,7 +4349,7 @@ void Drawable::clearCaptionText( void ) { if (m_captionDisplayString) TheDisplayStringManager->freeDisplayString(m_captionDisplayString); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -4388,7 +4388,7 @@ const AudioEventInfo * Drawable::getBaseSoundAmbientInfo() const if ( baseAmbient ) return baseAmbient->getAudioEventInfo(); - return NULL; + return nullptr; } /** @@ -4439,13 +4439,13 @@ void Drawable::clearCustomSoundAmbient( bool restartSound ) if ( m_ambientSound ) { // Make sure sound doesn't keep a reference to the deleted pointer - m_ambientSound->m_event.setAudioEventInfo( NULL ); + m_ambientSound->m_event.setAudioEventInfo( nullptr ); } // Stop using old info stopAmbientSound(); - m_customSoundAmbientInfo = NULL; + m_customSoundAmbientInfo = nullptr; if ( restartSound ) { @@ -4464,11 +4464,11 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe Bool trySound = FALSE; // Look for customized sound info - if ( dt != BODY_RUBBLE && m_customSoundAmbientInfo != NULL ) + if ( dt != BODY_RUBBLE && m_customSoundAmbientInfo != nullptr ) { if ( m_customSoundAmbientInfo != getNoSoundMarker() ) { - if (m_ambientSound == NULL) + if (m_ambientSound == nullptr) m_ambientSound = newInstance(DynamicAudioEventRTS); // Make sure m_event will accept the custom info @@ -4484,7 +4484,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe const AudioEventRTS& audio = getAmbientSoundByDamage(dt); if( audio.getEventName().isNotEmpty() ) { - if (m_ambientSound == NULL) + if (m_ambientSound == nullptr) m_ambientSound = newInstance(DynamicAudioEventRTS); (m_ambientSound->m_event) = audio; @@ -4498,7 +4498,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe const AudioEventRTS& pristineAudio = getAmbientSoundByDamage( BODY_PRISTINE ); if( pristineAudio.getEventName().isNotEmpty() ) { - if (m_ambientSound == NULL) + if (m_ambientSound == nullptr) m_ambientSound = newInstance(DynamicAudioEventRTS); (m_ambientSound->m_event) = pristineAudio; trySound = TRUE; @@ -4540,7 +4540,7 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe { DEBUG_CRASH( ("Ambient sound %s missing! Skipping...", m_ambientSound->m_event.getEventName().str() ) ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } } } @@ -4626,7 +4626,7 @@ void Drawable::enableAmbientSoundFromScript( Bool enable ) void Drawable::prependToList(Drawable **pListHead) { // add the object to the global list - m_prevDrawable = NULL; + m_prevDrawable = nullptr; m_nextDrawable = *pListHead; if (*pListHead) (*pListHead)->m_prevDrawable = this; @@ -4771,7 +4771,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -4857,7 +4857,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); // find module in the drawable module list - Module* module = NULL; + Module* module = nullptr; for( Module **m = m_modules[curModuleType]; m && *m; ++m ) { if (moduleIdentifierKey == (*m)->getModuleTagNameKey()) @@ -4878,7 +4878,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) // it from the object definition in a future patch, if that is so, we need to // skip the module data in the file // - if( module == NULL ) + if( module == nullptr ) { // for testing purposes, this module better be found @@ -4940,7 +4940,7 @@ void Drawable::xfer( Xfer *xfer ) { TheAudio->killAudioEventImmediately( m_ambientSound->m_event.getPlayingHandle() ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } // drawable id @@ -4981,13 +4981,13 @@ void Drawable::xfer( Xfer *xfer ) } // selection flash envelope - Bool selFlash = (m_selectionFlashEnvelope != NULL); + Bool selFlash = (m_selectionFlashEnvelope != nullptr); xfer->xferBool( &selFlash ); if( selFlash ) { // allocate selection flash envelope if we need to - if( m_selectionFlashEnvelope == NULL ) + if( m_selectionFlashEnvelope == nullptr ) m_selectionFlashEnvelope = newInstance( TintEnvelope ); // xfer @@ -4996,13 +4996,13 @@ void Drawable::xfer( Xfer *xfer ) } // color tint envelope - Bool colFlash = (m_colorTintEnvelope != NULL); + Bool colFlash = (m_colorTintEnvelope != nullptr); xfer->xferBool( &colFlash ); if( colFlash ) { // allocate envelope if we need to - if( m_colorTintEnvelope == NULL ) + if( m_colorTintEnvelope == nullptr ) m_colorTintEnvelope = newInstance( TintEnvelope ); // xfer @@ -5108,11 +5108,11 @@ void Drawable::xfer( Xfer *xfer ) // time to fade xfer->xferUnsignedInt( &m_timeToFade ); - Bool hasLocoInfo = (m_locoInfo != NULL); + Bool hasLocoInfo = (m_locoInfo != nullptr); xfer->xferBool( &hasLocoInfo ); if (hasLocoInfo) { - if( xfer->getXferMode() == XFER_LOAD && m_locoInfo == NULL ) + if( xfer->getXferMode() == XFER_LOAD && m_locoInfo == nullptr ) m_locoInfo = newInstance(DrawableLocoInfo); // pitch @@ -5237,7 +5237,7 @@ void Drawable::xfer( Xfer *xfer ) { // skip empty icon slots - if( !hasIconInfo() || getIconInfo()->m_icon[ i ] == NULL ) + if( !hasIconInfo() || getIconInfo()->m_icon[ i ] == nullptr ) continue; // icon index name @@ -5283,7 +5283,7 @@ void Drawable::xfer( Xfer *xfer ) // icon template name xfer->xferAsciiString( &iconTemplateName ); animTemplate = TheAnim2DCollection->findTemplate( iconTemplateName ); - if( animTemplate == NULL ) + if( animTemplate == nullptr ) { DEBUG_CRASH(( "Drawable::xfer - Unknown icon template '%s'", iconTemplateName.str() )); @@ -5343,7 +5343,7 @@ void Drawable::xfer( Xfer *xfer ) if ( version >= 7 ) { - Bool customized = ( m_customSoundAmbientInfo != NULL ); + Bool customized = ( m_customSoundAmbientInfo != nullptr ); xfer->xferBool( &customized ); if ( customized ) @@ -5366,7 +5366,7 @@ void Drawable::xfer( Xfer *xfer ) DynamicAudioEventInfo * customizedInfo; Bool successfulLoad = true; - if ( baseInfo == NULL ) + if ( baseInfo == nullptr ) { DEBUG_CRASH( ( "Load failed to load customized ambient sound because sound '%s' no longer exists", baseInfoName.str() ) ); @@ -5394,12 +5394,12 @@ void Drawable::xfer( Xfer *xfer ) clearCustomSoundAmbient( false ); m_customSoundAmbientInfo = customizedInfo; - customizedInfo = NULL; // Belongs to TheAudio now + customizedInfo = nullptr; // Belongs to TheAudio now } else { deleteInstance(customizedInfo); - customizedInfo = NULL; + customizedInfo = nullptr; } } catch( ... ) @@ -5431,7 +5431,7 @@ void Drawable::loadPostProcess( void ) { // if we have an object, we don't need to save/load the pos, just restore it. // if we don't, we'd better save it! - if (m_object != NULL) + if (m_object != nullptr) { setTransformMatrix(m_object->getTransformMatrix()); } @@ -5464,7 +5464,7 @@ const Locomotor* Drawable::getLocomotor() const return ai->getCurLocomotor(); } } - return NULL; + return nullptr; } //================================================================================================= @@ -5476,7 +5476,7 @@ const Locomotor* Drawable::getLocomotor() const { if (TheGameClient) // WB has no GameClient! { - for (Drawable* d = TheGameClient->firstDrawable(); d != NULL; d = d->getNextDrawable()) + for (Drawable* d = TheGameClient->firstDrawable(); d != nullptr; d = d->getNextDrawable()) { // this will force us to update stuff. d->getDrawModules(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp index 338b0cc82ec..509f4436b05 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp @@ -58,9 +58,9 @@ void BeaconClientUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RadarPulseFrequency", INI::parseDurationUnsignedInt, NULL, offsetof(BeaconClientUpdateModuleData, m_framesBetweenRadarPulses) }, - { "RadarPulseDuration", INI::parseDurationUnsignedInt, NULL, offsetof(BeaconClientUpdateModuleData, m_radarPulseDuration) }, - { 0, 0, 0, 0 } + { "RadarPulseFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_framesBetweenRadarPulses) }, + { "RadarPulseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_radarPulseDuration) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -85,7 +85,7 @@ BeaconClientUpdate::~BeaconClientUpdate( void ) //------------------------------------------------------------------------------------------------- static ParticleSystem* createParticleSystem( Drawable *draw ) { - ParticleSystem *system = NULL; + ParticleSystem *system = nullptr; if (draw) { Object *obj = draw->getObject(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 31db3b87618..c03a9ec8559 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -190,9 +190,9 @@ static void parseSideSoundsList( INI *ini, void *instance, void *store, const vo //----------------------------------------------------------------------------------- EvaSideSounds const FieldParse EvaSideSounds::s_evaSideSounds[] = { - { "Side", INI::parseAsciiString, NULL, offsetof( EvaSideSounds, m_side) }, - { "Sounds", INI::parseSoundsList, NULL, offsetof( EvaSideSounds, m_soundNames) }, - { 0, 0, 0, 0 }, + { "Side", INI::parseAsciiString, nullptr, offsetof( EvaSideSounds, m_side) }, + { "Sounds", INI::parseSoundsList, nullptr, offsetof( EvaSideSounds, m_soundNames) }, + { nullptr, nullptr, nullptr, 0 }, }; //------------------------------------------------------------------------------------ EvaCheckInfo @@ -209,17 +209,17 @@ EvaCheckInfo::EvaCheckInfo() : //------------------------------------------------------------------------------------------------- const FieldParse EvaCheckInfo::s_evaEventInfo[] = { - { "Priority", INI::parseUnsignedInt, NULL, offsetof( EvaCheckInfo, m_priority ) }, - { "TimeBetweenChecksMS", INI::parseDurationUnsignedInt, NULL, offsetof( EvaCheckInfo, m_framesBetweenChecks ) }, - { "ExpirationTimeMS", INI::parseDurationUnsignedInt, NULL, offsetof( EvaCheckInfo, m_framesToExpire) }, - { "SideSounds", parseSideSoundsList, NULL, offsetof( EvaCheckInfo, m_evaSideSounds ) }, - { 0, 0, 0, 0 }, + { "Priority", INI::parseUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_priority ) }, + { "TimeBetweenChecksMS", INI::parseDurationUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_framesBetweenChecks ) }, + { "ExpirationTimeMS", INI::parseDurationUnsignedInt, nullptr, offsetof( EvaCheckInfo, m_framesToExpire) }, + { "SideSounds", parseSideSoundsList, nullptr, offsetof( EvaCheckInfo, m_evaSideSounds ) }, + { nullptr, nullptr, nullptr, 0 }, }; //------------------------------------------------------------------------------------------------- EvaCheck::EvaCheck() : - m_evaInfo(NULL), + m_evaInfo(nullptr), m_triggeredOnFrame(TRIGGEREDON_NOT), m_timeForNextCheck(NEXT_CHECK_NOW), m_alreadyPlayed(FALSE) @@ -229,7 +229,7 @@ EvaCheck::EvaCheck() : //------------------------------------------------------------------------------------------------- Eva::Eva() : - m_localPlayer(NULL), + m_localPlayer(nullptr), m_previousBuildingCount(0), m_previousUnitCount(0), m_enabled(TRUE) @@ -254,7 +254,7 @@ void Eva::init() { // parse the INI here, etc. INI ini; - ini.loadFileDirectory( "Data\\INI\\Eva", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory( "Data\\INI\\Eva", INI_LOAD_OVERWRITE, nullptr); } //------------------------------------------------------------------------------------------------- @@ -303,7 +303,7 @@ void Eva::update() } processPlayingMessages(frame); - m_localPlayer = NULL; + m_localPlayer = nullptr; // Reset all of the flags that have been set to true that haven't actually been probed, because // they will need to trigger again to be valid messages. @@ -344,7 +344,7 @@ EvaCheckInfo *Eva::newEvaCheckInfo(AsciiString name) EvaCheckInfoPtrVecIt it; for (it = m_allCheckInfos.begin(); it != m_allCheckInfos.end(); ++it) { if (*it && (*it)->m_message == mesg) - return NULL; + return nullptr; } EvaCheckInfo *checkInfo = newInstance(EvaCheckInfo); @@ -365,7 +365,7 @@ const EvaCheckInfo *Eva::getEvaCheckInfo(AsciiString name) return *it; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -402,7 +402,7 @@ Bool Eva::isTimeForCheck(EvaMessage messageToTest, UnsignedInt currentFrame) con //------------------------------------------------------------------------------------------------- Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) const { - if (m_localPlayer == NULL) { + if (m_localPlayer == nullptr) { return FALSE; } @@ -550,5 +550,5 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) } //------------------------------------------------------------------------------------------------- -Eva *TheEva = NULL; +Eva *TheEva = nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp index 5549137d7ce..e04a65bca4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp @@ -56,7 +56,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -FXListStore *TheFXListStore = NULL; ///< the FXList store definition +FXListStore *TheFXListStore = nullptr; ///< the FXList store definition //------------------------------------------------------------------------------------------------- static void adjustVector(Coord3D *vec, const Matrix3D* mtx) @@ -81,10 +81,10 @@ static void adjustVector(Coord3D *vec, const Matrix3D* mtx) //------------------------------------------------------------------------------------------------- void FXNugget::doFXObj(const Object* primary, const Object* secondary) const { - const Coord3D* p = primary ? primary->getPosition() : NULL; - const Matrix3D* mtx = primary ? primary->getTransformMatrix() : NULL; + const Coord3D* p = primary ? primary->getPosition() : nullptr; + const Matrix3D* mtx = primary ? primary->getTransformMatrix() : nullptr; const Real speed = 0.0f; // yes, that's right -- NOT the object's speed. - const Coord3D* s = secondary ? secondary->getPosition() : NULL; + const Coord3D* s = secondary ? secondary->getPosition() : nullptr; doFXPos(p, mtx, speed, s); } @@ -107,7 +107,7 @@ class SoundFXNugget : public FXNugget TheAudio->addAudioEvent(&sound); } - virtual void doFXObj(const Object* primary, const Object* secondary = NULL) const + virtual void doFXObj(const Object* primary, const Object* secondary = nullptr) const { AudioEventRTS sound(m_soundName); if (primary) @@ -124,8 +124,8 @@ class SoundFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( SoundFXNugget, m_soundName ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( SoundFXNugget, m_soundName ) }, + { nullptr, nullptr, nullptr, 0 } }; SoundFXNugget* nugget = newInstance(SoundFXNugget); @@ -197,10 +197,10 @@ class TracerFXNugget : public FXNugget speed = primarySpeed; } - TracerDrawInterface* tdi = NULL; + TracerDrawInterface* tdi = nullptr; for (DrawModule** d = tracer->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getTracerDrawInterface()) != NULL) + if ((tdi = (*d)->getTracerDrawInterface()) != nullptr) { tdi->setTracerParms(speed, m_length, m_width, m_color, 1.0f); } @@ -222,15 +222,15 @@ class TracerFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "TracerName", INI::parseAsciiString, NULL, offsetof( TracerFXNugget, m_tracerName ) }, - { "BoneName", INI::parseAsciiString, NULL, offsetof( TracerFXNugget, m_boneName ) }, - { "Speed", INI::parseVelocityReal, NULL, offsetof( TracerFXNugget, m_speed ) }, - { "DecayAt", INI::parseReal, NULL, offsetof( TracerFXNugget, m_decayAt ) }, - { "Length", INI::parseReal, NULL, offsetof( TracerFXNugget, m_length ) }, - { "Width", INI::parseReal, NULL, offsetof( TracerFXNugget, m_width ) }, - { "Color", INI::parseRGBColor, NULL, offsetof( TracerFXNugget, m_color ) }, - { "Probability", INI::parseReal, NULL, offsetof( TracerFXNugget, m_probability ) }, - { 0, 0, 0, 0 } + { "TracerName", INI::parseAsciiString, nullptr, offsetof( TracerFXNugget, m_tracerName ) }, + { "BoneName", INI::parseAsciiString, nullptr, offsetof( TracerFXNugget, m_boneName ) }, + { "Speed", INI::parseVelocityReal, nullptr, offsetof( TracerFXNugget, m_speed ) }, + { "DecayAt", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_decayAt ) }, + { "Length", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_length ) }, + { "Width", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_width ) }, + { "Color", INI::parseRGBColor, nullptr, offsetof( TracerFXNugget, m_color ) }, + { "Probability", INI::parseReal, nullptr, offsetof( TracerFXNugget, m_probability ) }, + { nullptr, nullptr, nullptr, 0 } }; TracerFXNugget* nugget = newInstance( TracerFXNugget ); @@ -291,10 +291,10 @@ class RayEffectFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( RayEffectFXNugget, m_templateName ) }, - { "PrimaryOffset", INI::parseCoord3D, NULL, offsetof( RayEffectFXNugget, m_primaryOffset ) }, - { "SecondaryOffset", INI::parseCoord3D, NULL, offsetof( RayEffectFXNugget, m_secondaryOffset ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( RayEffectFXNugget, m_templateName ) }, + { "PrimaryOffset", INI::parseCoord3D, nullptr, offsetof( RayEffectFXNugget, m_primaryOffset ) }, + { "SecondaryOffset", INI::parseCoord3D, nullptr, offsetof( RayEffectFXNugget, m_secondaryOffset ) }, + { nullptr, nullptr, nullptr, 0 } }; RayEffectFXNugget* nugget = newInstance( RayEffectFXNugget ); @@ -353,12 +353,12 @@ class LightPulseFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Color", INI::parseRGBColor, NULL, offsetof( LightPulseFXNugget, m_color ) }, - { "Radius", INI::parseReal, NULL, offsetof( LightPulseFXNugget, m_radius ) }, - { "RadiusAsPercentOfObjectSize", INI::parsePercentToReal, NULL, offsetof( LightPulseFXNugget, m_boundingCirclePct ) }, - { "IncreaseTime", INI::parseDurationUnsignedInt, NULL, offsetof( LightPulseFXNugget, m_increaseFrames ) }, - { "DecreaseTime", INI::parseDurationUnsignedInt, NULL, offsetof( LightPulseFXNugget, m_decreaseFrames ) }, - { 0, 0, 0, 0 } + { "Color", INI::parseRGBColor, nullptr, offsetof( LightPulseFXNugget, m_color ) }, + { "Radius", INI::parseReal, nullptr, offsetof( LightPulseFXNugget, m_radius ) }, + { "RadiusAsPercentOfObjectSize", INI::parsePercentToReal, nullptr, offsetof( LightPulseFXNugget, m_boundingCirclePct ) }, + { "IncreaseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( LightPulseFXNugget, m_increaseFrames ) }, + { "DecreaseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( LightPulseFXNugget, m_decreaseFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; LightPulseFXNugget* nugget = newInstance( LightPulseFXNugget ); @@ -402,8 +402,8 @@ class ViewShakeFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Type", parseShakeType, NULL, offsetof( ViewShakeFXNugget, m_shake ) }, - { 0, 0, 0, 0 } + { "Type", parseShakeType, nullptr, offsetof( ViewShakeFXNugget, m_shake ) }, + { nullptr, nullptr, nullptr, 0 } }; ViewShakeFXNugget* nugget = newInstance( ViewShakeFXNugget ); @@ -422,7 +422,7 @@ class ViewShakeFXNugget : public FXNugget { "SEVERE", View::SHAKE_SEVERE }, { "CINE_EXTREME", View::SHAKE_CINE_EXTREME }, { "CINE_INSANE", View::SHAKE_CINE_INSANE }, - { 0, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(shakeTypeNames) == View::SHAKE_COUNT + 1, "Incorrect array size"); @@ -466,9 +466,9 @@ class TerrainScorchFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Type", parseScorchType, NULL, offsetof( TerrainScorchFXNugget, m_scorch ) }, - { "Radius", INI::parseReal, NULL, offsetof( TerrainScorchFXNugget, m_radius ) }, - { 0, 0, 0, 0 } + { "Type", parseScorchType, nullptr, offsetof( TerrainScorchFXNugget, m_scorch ) }, + { "Radius", INI::parseReal, nullptr, offsetof( TerrainScorchFXNugget, m_radius ) }, + { nullptr, nullptr, nullptr, 0 } }; TerrainScorchFXNugget* nugget = newInstance( TerrainScorchFXNugget ); @@ -488,7 +488,7 @@ class TerrainScorchFXNugget : public FXNugget { "SCORCH_4", SCORCH_4 }, { "SHADOW_SCORCH", SHADOW_SCORCH }, { "RANDOM", -1 }, - { 0, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(scorchTypeNames) == SCORCH_COUNT + 2, "Incorrect array size"); @@ -527,7 +527,7 @@ class ParticleSystemFXNugget : public FXNugget { if (primary) { - reallyDoFX(primary, primaryMtx, NULL, overrideRadius); + reallyDoFX(primary, primaryMtx, nullptr, overrideRadius); } else { @@ -567,21 +567,21 @@ class ParticleSystemFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( ParticleSystemFXNugget, m_name ) }, - { "Count", INI::parseInt, NULL, offsetof( ParticleSystemFXNugget, m_count ) }, - { "Offset", INI::parseCoord3D, NULL, offsetof( ParticleSystemFXNugget, m_offset ) }, - { "Radius", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_radius ) }, - { "Height", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_height ) }, - { "InitialDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemFXNugget, m_delay ) }, - { "RotateX", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateX ) }, - { "RotateY", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateY ) }, - { "RotateZ", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateZ ) }, - { "OrientToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_orientToObject ) }, - { "Ricochet", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_ricochet ) }, - { "AttachToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_attachToObject ) }, - { "CreateAtGroundHeight", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) }, - { "UseCallersRadius", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_useCallersRadius ) }, - { 0, 0, 0, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( ParticleSystemFXNugget, m_name ) }, + { "Count", INI::parseInt, nullptr, offsetof( ParticleSystemFXNugget, m_count ) }, + { "Offset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemFXNugget, m_offset ) }, + { "Radius", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_radius ) }, + { "Height", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_height ) }, + { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemFXNugget, m_delay ) }, + { "RotateX", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateX ) }, + { "RotateY", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateY ) }, + { "RotateZ", INI::parseAngleReal, nullptr, offsetof( ParticleSystemFXNugget, m_rotateZ ) }, + { "OrientToObject", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_orientToObject ) }, + { "Ricochet", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_ricochet ) }, + { "AttachToObject", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_attachToObject ) }, + { "CreateAtGroundHeight", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) }, + { "UseCallersRadius", INI::parseBool, nullptr, offsetof( ParticleSystemFXNugget, m_useCallersRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; ParticleSystemFXNugget* nugget = newInstance( ParticleSystemFXNugget ); @@ -689,7 +689,7 @@ class FXListAtBonePosFXNugget : public FXNugget FXListAtBonePosFXNugget() { - m_fx = NULL; + m_fx = nullptr; m_boneName.clear(); m_orientToBone = true; } @@ -719,10 +719,10 @@ class FXListAtBonePosFXNugget : public FXNugget { static const FieldParse myFieldParse[] = { - { "FX", INI::parseFXList, NULL, offsetof( FXListAtBonePosFXNugget, m_fx ) }, - { "BoneName", INI::parseAsciiString, NULL, offsetof( FXListAtBonePosFXNugget, m_boneName ) }, - { "OrientToBone", INI::parseBool, NULL, offsetof( FXListAtBonePosFXNugget, m_orientToBone ) }, - { 0, 0, 0, 0 } + { "FX", INI::parseFXList, nullptr, offsetof( FXListAtBonePosFXNugget, m_fx ) }, + { "BoneName", INI::parseAsciiString, nullptr, offsetof( FXListAtBonePosFXNugget, m_boneName ) }, + { "OrientToBone", INI::parseBool, nullptr, offsetof( FXListAtBonePosFXNugget, m_orientToBone ) }, + { nullptr, nullptr, nullptr, 0 } }; FXListAtBonePosFXNugget* nugget = newInstance( FXListAtBonePosFXNugget ); @@ -747,7 +747,7 @@ class FXListAtBonePosFXNugget : public FXNugget Coord3D p; Matrix3D m; obj->convertBonePosToWorldPos(&bonePos[i], &boneMtx[i], &p, &m); - FXList::doFXPos(m_fx, &p, &m, 0.0f, NULL, 0.0f); + FXList::doFXPos(m_fx, &p, &m, 0.0f, nullptr, 0.0f); } } } @@ -769,15 +769,15 @@ EMPTY_DTOR(FXListAtBonePosFXNugget) static const FieldParse TheFXListFieldParse[] = { - { "Sound", SoundFXNugget::parse, 0, 0}, - { "RayEffect", RayEffectFXNugget::parse, 0, 0}, - { "Tracer", TracerFXNugget::parse, 0, 0}, - { "LightPulse", LightPulseFXNugget::parse, 0, 0}, - { "ViewShake", ViewShakeFXNugget::parse, 0, 0}, - { "TerrainScorch", TerrainScorchFXNugget::parse, 0, 0}, - { "ParticleSystem", ParticleSystemFXNugget::parse, 0, 0}, - { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } + { "Sound", SoundFXNugget::parse, nullptr, 0}, + { "RayEffect", RayEffectFXNugget::parse, nullptr, 0}, + { "Tracer", TracerFXNugget::parse, nullptr, 0}, + { "LightPulse", LightPulseFXNugget::parse, nullptr, 0}, + { "ViewShake", ViewShakeFXNugget::parse, nullptr, 0}, + { "TerrainScorch", TerrainScorchFXNugget::parse, nullptr, 0}, + { "ParticleSystem", ParticleSystemFXNugget::parse, nullptr, 0}, + { "FXListAtBonePos", FXListAtBonePosFXNugget::parse, nullptr, 0}, + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -852,14 +852,14 @@ FXListStore::~FXListStore() const FXList *FXListStore::findFXList(const char* name) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; FXListMap::const_iterator it = m_fxmap.find(NAMEKEY(name)); if (it != m_fxmap.end()) { return &(*it).second; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index 167d48f52f5..95408b9004b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -72,7 +72,7 @@ AnimateWindow::AnimateWindow(void) m_startPos.x = m_startPos.y = 0; m_endPos.x = m_endPos.y = 0; m_curPos.x = m_curPos.y = 0; - m_win = NULL; + m_win = nullptr; m_animType = WIN_ANIMATION_NONE; m_restPos.x = m_restPos.y = 0; @@ -84,7 +84,7 @@ AnimateWindow::AnimateWindow(void) } AnimateWindow::~AnimateWindow( void ) { - m_win = NULL; + m_win = nullptr; } void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, @@ -146,7 +146,7 @@ AnimateWindowManager::~AnimateWindowManager( void ) delete m_spiral; delete m_slideFromBottomTimed; - m_slideFromRight = NULL; + m_slideFromRight = nullptr; resetToRestPosition( ); clearWinList(m_winList); clearWinList(m_winMustFinishList); @@ -173,7 +173,7 @@ void AnimateWindowManager::reset( void ) void AnimateWindowManager::update( void ) { - ProcessAnimateWindow *processAnim = NULL; + ProcessAnimateWindow *processAnim = nullptr; // if we need to update the windows that need to finish, update that list if(m_needsUpdate) @@ -238,7 +238,7 @@ void AnimateWindowManager::registerGameWindow(GameWindow *win, AnimTypes animTyp { if(!win) { - DEBUG_CRASH(("Win was NULL as it was passed into registerGameWindow... not good indeed")); + DEBUG_CRASH(("Win was null as it was passed into registerGameWindow... not good indeed")); return; } if(animType <= WIN_ANIMATION_NONE || animType >= WIN_ANIMATION_COUNT ) @@ -308,7 +308,7 @@ ProcessAnimateWindow *AnimateWindowManager::getProcessAnimate( AnimTypes animTyp return m_slideFromTopFast; } default: - return NULL; + return nullptr; } } @@ -317,7 +317,7 @@ void AnimateWindowManager::reverseAnimateWindow( void ) m_reverse = TRUE; m_needsUpdate = TRUE; - ProcessAnimateWindow *processAnim = NULL; + ProcessAnimateWindow *processAnim = nullptr; UnsignedInt maxDelay = 0; AnimateWindowList::iterator it = m_winMustFinishList.begin(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp index d270e95daf2..ffe9a6b0974 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp @@ -32,7 +32,7 @@ #include "GameClient/ChallengeGenerals.h" -ChallengeGenerals *TheChallengeGenerals = NULL; +ChallengeGenerals *TheChallengeGenerals = nullptr; ChallengeGenerals *createChallengeGenerals( void ) { @@ -55,7 +55,7 @@ ChallengeGenerals::~ChallengeGenerals() void ChallengeGenerals::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\ChallengeMode", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\ChallengeMode", INI_LOAD_OVERWRITE, nullptr ); } @@ -63,34 +63,34 @@ void ChallengeGenerals::parseGeneralPersona(INI *ini, void *instance, void *stor { static const FieldParse dataFieldParse[] = { - { "StartsEnabled", INI::parseBool, NULL, offsetof( GeneralPersona, m_bStartsEnabled ) }, - { "BioNameString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioName ) }, - { "BioDOBString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioDOB ) }, - { "BioBirthplaceString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioBirthplace ) }, - { "BioStrategyString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioStrategy ) }, - { "BioRankString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioRank ) }, - { "BioBranchString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioBranch ) }, - { "BioClassNumberString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strBioClassNumber ) }, - { "BioPortraitSmall", INI::parseMappedImage, NULL, offsetof( GeneralPersona, m_imageBioPortraitSmall ) }, - { "BioPortraitLarge", INI::parseMappedImage, NULL, offsetof( GeneralPersona, m_imageBioPortraitLarge ) }, - { "Campaign", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strCampaign ) }, - { "PlayerTemplate", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strPlayerTemplateName ) }, - { "PortraitMovieLeftName", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strPortraitMovieLeftName ) }, - { "PortraitMovieRightName", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strPortraitMovieRightName ) }, - { "DefeatedImage", INI::parseMappedImage, NULL, offsetof( GeneralPersona, m_imageDefeated ) }, - { "VictoriousImage", INI::parseMappedImage, NULL, offsetof( GeneralPersona, m_imageVictorious ) }, - { "DefeatedString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strDefeated ) }, - { "VictoriousString", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strVictorious ) }, - { "SelectionSound", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strSelectionSound ) }, - { "TauntSound1", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strTauntSound1 ) }, - { "TauntSound2", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strTauntSound2 ) }, - { "TauntSound3", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strTauntSound3 ) }, - { "WinSound", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strWinSound ) }, - { "LossSound", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strLossSound ) }, - { "PreviewSound", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strPreviewSound ) }, - { "NameSound", INI::parseAsciiString, NULL, offsetof( GeneralPersona, m_strNameSound ) }, - - { 0, 0, 0, 0 } + { "StartsEnabled", INI::parseBool, nullptr, offsetof( GeneralPersona, m_bStartsEnabled ) }, + { "BioNameString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioName ) }, + { "BioDOBString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioDOB ) }, + { "BioBirthplaceString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBirthplace ) }, + { "BioStrategyString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioStrategy ) }, + { "BioRankString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioRank ) }, + { "BioBranchString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBranch ) }, + { "BioClassNumberString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioClassNumber ) }, + { "BioPortraitSmall", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitSmall ) }, + { "BioPortraitLarge", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitLarge ) }, + { "Campaign", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strCampaign ) }, + { "PlayerTemplate", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPlayerTemplateName ) }, + { "PortraitMovieLeftName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieLeftName ) }, + { "PortraitMovieRightName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieRightName ) }, + { "DefeatedImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageDefeated ) }, + { "VictoriousImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageVictorious ) }, + { "DefeatedString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strDefeated ) }, + { "VictoriousString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strVictorious ) }, + { "SelectionSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strSelectionSound ) }, + { "TauntSound1", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound1 ) }, + { "TauntSound2", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound2 ) }, + { "TauntSound3", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound3 ) }, + { "WinSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strWinSound ) }, + { "LossSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strLossSound ) }, + { "PreviewSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPreviewSound ) }, + { "NameSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strNameSound ) }, + + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(store, dataFieldParse); } @@ -98,19 +98,19 @@ void ChallengeGenerals::parseGeneralPersona(INI *ini, void *instance, void *stor const FieldParse ChallengeGenerals::s_fieldParseTable[] = { - { "GeneralPersona0", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[0] ) }, - { "GeneralPersona1", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[1] ) }, - { "GeneralPersona2", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[2] ) }, - { "GeneralPersona3", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[3] ) }, - { "GeneralPersona4", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[4] ) }, - { "GeneralPersona5", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[5] ) }, - { "GeneralPersona6", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[6] ) }, - { "GeneralPersona7", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[7] ) }, - { "GeneralPersona8", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[8] ) }, - { "GeneralPersona9", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[9] ) }, - { "GeneralPersona10", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[10] ) }, - { "GeneralPersona11", ChallengeGenerals::parseGeneralPersona, NULL, offsetof( ChallengeGenerals, m_position[11] ) }, - { 0, 0, 0, 0 } + { "GeneralPersona0", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[0] ) }, + { "GeneralPersona1", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[1] ) }, + { "GeneralPersona2", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[2] ) }, + { "GeneralPersona3", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[3] ) }, + { "GeneralPersona4", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[4] ) }, + { "GeneralPersona5", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[5] ) }, + { "GeneralPersona6", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[6] ) }, + { "GeneralPersona7", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[7] ) }, + { "GeneralPersona8", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[8] ) }, + { "GeneralPersona9", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[9] ) }, + { "GeneralPersona10", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[10] ) }, + { "GeneralPersona11", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[11] ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -133,8 +133,8 @@ const GeneralPersona* ChallengeGenerals::getPlayerGeneralByCampaignName( AsciiSt if (campaignName.compareNoCase( name.str() ) == 0) return &m_position[i]; } - DEBUG_ASSERTCRASH(NULL, ("Can't find General by Campaign Name")); - return NULL; + DEBUG_ASSERTCRASH(nullptr, ("Can't find General by Campaign Name")); + return nullptr; } const GeneralPersona* ChallengeGenerals::getGeneralByGeneralName( AsciiString name ) const @@ -145,7 +145,7 @@ const GeneralPersona* ChallengeGenerals::getGeneralByGeneralName( AsciiString na if (generalName.compareNoCase( name.str() ) == 0) return &m_position[i]; } - return NULL; + return nullptr; } const GeneralPersona* ChallengeGenerals::getGeneralByTemplateName( AsciiString name ) const @@ -156,5 +156,5 @@ const GeneralPersona* ChallengeGenerals::getGeneralByTemplateName( AsciiString n if (templateName.compareNoCase( name.str() ) == 0) return &m_position[i]; } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 6eb90665160..9b1e52f7eed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -85,11 +85,11 @@ // PUBLIC ///////////////////////////////////////////////////////////////////////////////////////// -ControlBar *TheControlBar = NULL; +ControlBar *TheControlBar = nullptr; -const Image* ControlBar::m_rankVeteranIcon = NULL; -const Image* ControlBar::m_rankEliteIcon = NULL; -const Image* ControlBar::m_rankHeroicIcon = NULL; +const Image* ControlBar::m_rankVeteranIcon = nullptr; +const Image* ControlBar::m_rankEliteIcon = nullptr; +const Image* ControlBar::m_rankHeroicIcon = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // CommandButton ////////////////////////////////////////////////////////////////////////////////// @@ -100,26 +100,26 @@ const Image* ControlBar::m_rankHeroicIcon = NULL; const FieldParse CommandButton::s_commandButtonFieldParseTable[] = { - { "Command", CommandButton::parseCommand, NULL, offsetof( CommandButton, m_command ) }, + { "Command", CommandButton::parseCommand, nullptr, offsetof( CommandButton, m_command ) }, { "Options", INI::parseBitString32, TheCommandOptionNames, offsetof( CommandButton, m_options ) }, - { "Object", INI::parseThingTemplate, NULL, offsetof( CommandButton, m_thingTemplate ) }, - { "Upgrade", INI::parseUpgradeTemplate, NULL, offsetof( CommandButton, m_upgradeTemplate ) }, + { "Object", INI::parseThingTemplate, nullptr, offsetof( CommandButton, m_thingTemplate ) }, + { "Upgrade", INI::parseUpgradeTemplate, nullptr, offsetof( CommandButton, m_upgradeTemplate ) }, { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( CommandButton, m_weaponSlot ) }, - { "MaxShotsToFire", INI::parseInt, NULL, offsetof( CommandButton, m_maxShotsToFire ) }, - { "Science", INI::parseScienceVector, NULL, offsetof( CommandButton, m_science ) }, - { "SpecialPower", INI::parseSpecialPowerTemplate, NULL, offsetof( CommandButton, m_specialPower ) }, - { "TextLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_textLabel ) }, - { "DescriptLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_descriptionLabel ) }, - { "PurchasedLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_purchasedLabel ) }, - { "ConflictingLabel", INI::parseAsciiString, NULL, offsetof( CommandButton, m_conflictingLabel ) }, - { "ButtonImage", INI::parseAsciiString, NULL, offsetof( CommandButton, m_buttonImageName ) }, - { "CursorName", INI::parseAsciiString, NULL, offsetof( CommandButton, m_cursorName ) }, - { "InvalidCursorName", INI::parseAsciiString, NULL, offsetof( CommandButton, m_invalidCursorName ) }, + { "MaxShotsToFire", INI::parseInt, nullptr, offsetof( CommandButton, m_maxShotsToFire ) }, + { "Science", INI::parseScienceVector, nullptr, offsetof( CommandButton, m_science ) }, + { "SpecialPower", INI::parseSpecialPowerTemplate, nullptr, offsetof( CommandButton, m_specialPower ) }, + { "TextLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_textLabel ) }, + { "DescriptLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_descriptionLabel ) }, + { "PurchasedLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_purchasedLabel ) }, + { "ConflictingLabel", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_conflictingLabel ) }, + { "ButtonImage", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_buttonImageName ) }, + { "CursorName", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_cursorName ) }, + { "InvalidCursorName", INI::parseAsciiString, nullptr, offsetof( CommandButton, m_invalidCursorName ) }, { "ButtonBorderType", INI::parseLookupList, CommandButtonMappedBorderTypeNames, offsetof( CommandButton, m_commandButtonBorder ) }, { "RadiusCursorType", INI::parseIndexList, TheRadiusCursorNames, offsetof( CommandButton, m_radiusCursor ) }, - { "UnitSpecificSound", INI::parseAudioEventRTS, NULL, offsetof( CommandButton, m_unitSpecificSound ) }, + { "UnitSpecificSound", INI::parseAudioEventRTS, nullptr, offsetof( CommandButton, m_unitSpecificSound ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; static void commandButtonTooltip(GameWindow *window, @@ -202,9 +202,9 @@ void ControlBar::populatePurchaseScience( Player* player ) // if no command set match is found hide all the buttons - if( commandSet1 == NULL || - commandSet3 == NULL || - commandSet8 == NULL ) + if( commandSet1 == nullptr || + commandSet3 == nullptr || + commandSet8 == nullptr ) return; // populate the button with commands defined @@ -216,7 +216,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet1->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) + if( commandButton == nullptr || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) { // hide window on interface m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE ); @@ -276,7 +276,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet3->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) + if( commandButton == nullptr || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) { // hide window on interface m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE ); @@ -339,7 +339,7 @@ void ControlBar::populatePurchaseScience( Player* player ) commandButton = commandSet8->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) + if( commandButton == nullptr || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) ) { // hide window on interface m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE ); @@ -391,7 +391,7 @@ void ControlBar::populatePurchaseScience( Player* player ) } - GameWindow *win = NULL; + GameWindow *win = nullptr; UnicodeString tempUS; win = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:StaticTextRankPointsAvailable" ) ); if(win) @@ -467,7 +467,7 @@ void ControlBar::populatePurchaseScience( Player* player ) //------------------------------------------------------------------------------------------------- void ControlBar::updateContextPurchaseScience( void ) { - GameWindow *win =NULL; + GameWindow *win =nullptr; Player *player = ThePlayerList->getLocalPlayer(); win = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:ProgressBarExperience" ) ); if(win) @@ -488,12 +488,12 @@ void ControlBar::updateContextPurchaseScience( void ) /// @todo srj -- evil hack testing code. do not imitate. Object *obj = m_currentSelectedDrawable->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return; // sanity if( obj->isKindOf( KINDOF_COMMANDCENTER ) == FALSE ) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); GameWindow* win = m_contextParent[ CP_PURCHASE_SCIENCE ]; @@ -512,7 +512,7 @@ void ControlBar::updateContextPurchaseScience( void ) msg->appendIntegerArgument( st ); } - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); } */ @@ -551,18 +551,18 @@ CommandButton::CommandButton( void ) { m_command = GUI_COMMAND_NONE; - m_thingTemplate = NULL; - m_upgradeTemplate = NULL; + m_thingTemplate = nullptr; + m_upgradeTemplate = nullptr; m_weaponSlot = PRIMARY_WEAPON; m_maxShotsToFire = 0x7fffffff; // huge number m_science.clear(); - m_specialPower = NULL; - m_buttonImage = NULL; + m_specialPower = nullptr; + m_buttonImage = nullptr; //Code renderer handles these states now. - //m_disabledImage = NULL; - //m_hiliteImage = NULL; - //m_pushedImage = NULL; + //m_disabledImage = nullptr; + //m_hiliteImage = nullptr; + //m_pushedImage = nullptr; m_flashCount = 0; m_conflictingLabel.clear(); @@ -573,10 +573,10 @@ CommandButton::CommandButton( void ) m_options = 0; m_purchasedLabel.clear(); m_textLabel.clear(); - m_window = NULL; + m_window = nullptr; m_commandButtonBorder = COMMAND_BUTTON_BORDER_NONE; - //m_prev = NULL; - m_next = NULL; + //m_prev = nullptr; + m_next = nullptr; m_radiusCursor = RADIUSCURSOR_NONE; } @@ -631,7 +631,7 @@ Bool CommandButton::isValidToUseOn(const Object *sourceObj, const Object *target if (pui) { const ProductionEntry *pe = pui->firstProduction(); while (pe) { - if (pe->getProductionUpgrade() != NULL) + if (pe->getProductionUpgrade() != nullptr) return false; pe = pui->nextProduction(pe); } @@ -671,7 +671,7 @@ Bool CommandButton::isValidToUseOn(const Object *sourceObj, const Object *target if( BitIsSet( m_options, NEED_TARGET_POS ) ) { - return TheActionManager->canDoSpecialPowerAtLocation( sourceObj, &pos, commandSource, m_specialPower, NULL, m_options, false ); + return TheActionManager->canDoSpecialPowerAtLocation( sourceObj, &pos, commandSource, m_specialPower, nullptr, m_options, false ); } return TheActionManager->canDoSpecialPower( sourceObj, m_specialPower, commandSource, m_options, false ); @@ -693,7 +693,7 @@ Bool CommandButton::isReady(const Object *sourceObj) const //------------------------------------------------------------------------------------------------- Bool CommandButton::isValidObjectTarget(const Drawable* source, const Drawable* target) const { - return isValidObjectTarget(source ? source->getObject() : NULL, target ? target->getObject() : NULL); + return isValidObjectTarget(source ? source->getObject() : nullptr, target ? target->getObject() : nullptr); } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -707,7 +707,7 @@ Bool CommandButton::isValidObjectTarget(const Drawable* source, const Drawable* const FieldParse CommandSet::m_commandSetFieldParseTable[] = { - { "1", CommandSet::parseCommandButton, (void *)0, offsetof( CommandSet, m_command ) }, + { "1", CommandSet::parseCommandButton, (void *)nullptr, offsetof( CommandSet, m_command ) }, { "2", CommandSet::parseCommandButton, (void *)1, offsetof( CommandSet, m_command ) }, { "3", CommandSet::parseCommandButton, (void *)2, offsetof( CommandSet, m_command ) }, { "4", CommandSet::parseCommandButton, (void *)3, offsetof( CommandSet, m_command ) }, @@ -725,7 +725,7 @@ const FieldParse CommandSet::m_commandSetFieldParseTable[] = { "16", CommandSet::parseCommandButton, (void *)15, offsetof( CommandSet, m_command ) }, { "17", CommandSet::parseCommandButton, (void *)16, offsetof( CommandSet, m_command ) }, { "18", CommandSet::parseCommandButton, (void *)17, offsetof( CommandSet, m_command ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -800,7 +800,7 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons // get find the command button from this name const CommandButton *commandButton = TheControlBar->findCommandButton( AsciiString( token ) ); - if( commandButton == NULL ) + if( commandButton == nullptr ) { DEBUG_CRASH(( "[LINE: %d - FILE: '%s'] Unknown command '%s' found in command set", @@ -826,10 +826,10 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons //------------------------------------------------------------------------------------------------- CommandSet::CommandSet(const AsciiString& name) : m_name(name), - m_next(NULL) + m_next(nullptr) { for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - m_command[ i ] = NULL; + m_command[ i ] = nullptr; } //------------------------------------------------------------------------------------------------- @@ -868,13 +868,13 @@ CommandSet::~CommandSet( void ) ControlBar::ControlBar( void ) { Int i; - m_commandButtons = NULL; - m_commandSets = NULL; - m_controlBarSchemeManager = NULL; + m_commandButtons = nullptr; + m_commandSets = nullptr; + m_controlBarSchemeManager = nullptr; m_isObserverCommandBar = FALSE; - m_observerLookAtPlayer = NULL; - m_observedPlayer = NULL; - m_buildToolTipLayout = NULL; + m_observerLookAtPlayer = nullptr; + m_observedPlayer = nullptr; + m_buildToolTipLayout = nullptr; m_showBuildToolTipLayout = FALSE; m_animateDownWin1Pos.x = m_animateDownWin1Pos.y = 0; @@ -882,55 +882,55 @@ ControlBar::ControlBar( void ) m_animateDownWin2Pos.x = m_animateDownWin2Pos.y = 0; m_animateDownWin2Size.x = m_animateDownWin2Size.y = 0; - m_animateDownWindow = NULL; + m_animateDownWindow = nullptr; m_animTime = 0; for( i = 0; i < MAX_COMMANDS_PER_SET; i++) { - m_commonCommands[i] = 0; + m_commonCommands[i] = nullptr; } m_currContext = CB_CONTEXT_NONE; m_defaultControlBarPosition.x = m_defaultControlBarPosition.y = 0; m_genStarFlash = FALSE; - m_genStarOff = NULL; - m_genStarOn = NULL; + m_genStarOff = nullptr; + m_genStarOn = nullptr; m_UIDirty = FALSE; - // m_controlBarResizer = NULL; + // m_controlBarResizer = nullptr; m_buildUpClockColor = GameMakeColor(0,0,0,100); m_commandBarBorderColor = GameMakeColor(0,0,0,100); for( i = 0; i < NUM_CONTEXT_PARENTS; i++ ) - m_contextParent[ i ] = NULL; + m_contextParent[ i ] = nullptr; for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commandWindows[ i ] = NULL; + m_commandWindows[ i ] = nullptr; // removed from multiplayer branch - //m_commandMarkers[ i ] = NULL; + //m_commandMarkers[ i ] = nullptr; } for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ ) - m_sciencePurchaseWindowsRank1[i] = NULL; + m_sciencePurchaseWindowsRank1[i] = nullptr; for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ ) - m_sciencePurchaseWindowsRank3[i] = NULL; + m_sciencePurchaseWindowsRank3[i] = nullptr; for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ ) - m_sciencePurchaseWindowsRank8[i] = NULL; + m_sciencePurchaseWindowsRank8[i] = nullptr; for( i = 0; i < MAX_SPECIAL_POWER_SHORTCUTS; i++ ) { - m_specialPowerShortcutButtons[i] = NULL; - m_specialPowerShortcutButtonParents[i] = NULL; + m_specialPowerShortcutButtons[i] = nullptr; + m_specialPowerShortcutButtonParents[i] = nullptr; } - m_specialPowerShortcutParent = NULL; - m_specialPowerLayout = NULL; - m_scienceLayout = NULL; - m_rightHUDWindow = NULL; - m_rightHUDCameoWindow = NULL; + m_specialPowerShortcutParent = nullptr; + m_specialPowerLayout = nullptr; + m_scienceLayout = nullptr; + m_rightHUDWindow = nullptr; + m_rightHUDCameoWindow = nullptr; for( i = 0; i < MAX_RIGHT_HUD_UPGRADE_CAMEOS; i++ ) m_rightHUDUpgradeCameos[i]; - m_rightHUDUnitSelectParent = NULL; - m_communicatorButton = NULL; - m_currentSelectedDrawable = NULL; + m_rightHUDUnitSelectParent = nullptr; + m_communicatorButton = nullptr; + m_currentSelectedDrawable = nullptr; m_currContext = CB_CONTEXT_NONE; m_rallyPointDrawableID = INVALID_DRAWABLE_ID; m_displayedConstructPercent = -1.0f; @@ -940,27 +940,27 @@ ControlBar::ControlBar( void ) resetContainData(); m_lastRecordedInventoryCount = 0; - m_videoManager = NULL; - m_animateWindowManager = NULL; - m_generalsScreenAnimate = NULL; - m_animateWindowManagerForGenShortcuts = NULL; + m_videoManager = nullptr; + m_animateWindowManager = nullptr; + m_generalsScreenAnimate = nullptr; + m_animateWindowManagerForGenShortcuts = nullptr; m_flash = FALSE; - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; - - m_generalButtonEnable = NULL; - m_generalButtonHighlight = NULL; - m_genArrow = NULL; + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; + + m_generalButtonEnable = nullptr; + m_generalButtonHighlight = nullptr; + m_genArrow = nullptr; m_sideSelectAnimateDown = FALSE; updateCommanBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); m_radarAttackGlowOn = FALSE; m_remainingRadarAttackGlowFrames = 0; - m_radarAttackGlowWindow = NULL; + m_radarAttackGlowWindow = nullptr; #if defined(RTS_DEBUG) m_lastFrameMarkedDirty = 0; @@ -978,27 +978,27 @@ ControlBar::~ControlBar( void ) { m_scienceLayout->destroyWindows(); deleteInstance(m_scienceLayout); - m_scienceLayout = NULL; + m_scienceLayout = nullptr; } - m_genArrow = NULL; + m_genArrow = nullptr; delete m_videoManager; - m_videoManager = NULL; + m_videoManager = nullptr; delete m_animateWindowManagerForGenShortcuts; - m_animateWindowManagerForGenShortcuts = NULL; + m_animateWindowManagerForGenShortcuts = nullptr; delete m_animateWindowManager; - m_animateWindowManager = NULL; + m_animateWindowManager = nullptr; delete m_generalsScreenAnimate; - m_generalsScreenAnimate = NULL; + m_generalsScreenAnimate = nullptr; delete m_controlBarSchemeManager; - m_controlBarSchemeManager = NULL; + m_controlBarSchemeManager = nullptr; // delete m_controlBarResizer; -// m_controlBarResizer = NULL; +// m_controlBarResizer = nullptr; // destroy all the command set definitions CommandSet *set; @@ -1023,22 +1023,22 @@ ControlBar::~ControlBar( void ) { m_buildToolTipLayout->destroyWindows(); deleteInstance(m_buildToolTipLayout); - m_buildToolTipLayout = NULL; + m_buildToolTipLayout = nullptr; } if(m_specialPowerLayout) { m_specialPowerLayout->destroyWindows(); deleteInstance(m_specialPowerLayout); - m_specialPowerLayout = NULL; + m_specialPowerLayout = nullptr; } - m_radarAttackGlowWindow = NULL; + m_radarAttackGlowWindow = nullptr; if (m_rightHUDCameoWindow && m_rightHUDCameoWindow->winGetUserData()) { delete m_rightHUDCameoWindow->winGetUserData(); - m_rightHUDCameoWindow->winSetUserData(NULL); + m_rightHUDCameoWindow->winSetUserData(nullptr); } } @@ -1052,11 +1052,11 @@ void ControlBar::init( void ) INI ini; m_sideSelectAnimateDown = FALSE; // load the command buttons - ini.loadFileDirectory( "Data\\INI\\Default\\CommandButton", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\CommandButton", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\CommandButton", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\CommandButton", INI_LOAD_OVERWRITE, nullptr ); // load the command sets - ini.loadFileDirectory( "Data\\INI\\CommandSet", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\CommandSet", INI_LOAD_OVERWRITE, nullptr ); // post process step after loading the command buttons and command sets postProcessCommands(); @@ -1076,35 +1076,35 @@ void ControlBar::init( void ) // NameKeyType id; id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" ); - m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( nullptr, id ); m_contextParent[ CP_MASTER ]->winGetPosition(&m_defaultControlBarPosition.x, &m_defaultControlBarPosition.y); m_scienceLayout = TheWindowManager->winCreateLayout("GeneralsExpPoints.wnd"); m_scienceLayout->hide(TRUE); id = TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:GenExpParent" ); - m_contextParent[ CP_PURCHASE_SCIENCE ] = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); + m_contextParent[ CP_PURCHASE_SCIENCE ] = TheWindowManager->winGetWindowFromId( nullptr, id );//m_scienceLayout->getFirstWindow(); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionWindow" ); - m_contextParent[ CP_UNDER_CONSTRUCTION ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_UNDER_CONSTRUCTION ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerWindow" ); - m_contextParent[ CP_OCL_TIMER ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OCL_TIMER ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BeaconWindow" ); - m_contextParent[ CP_BEACON ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_BEACON ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CommandWindow" ); - m_contextParent[ CP_COMMAND ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_COMMAND ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ProductionQueueWindow" ); - m_contextParent[ CP_BUILD_QUEUE ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_BUILD_QUEUE ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ObserverPlayerListWindow" ); - m_contextParent[ CP_OBSERVER_LIST ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OBSERVER_LIST ] = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ObserverPlayerInfoWindow" ); - m_contextParent[ CP_OBSERVER_INFO ] = TheWindowManager->winGetWindowFromId( NULL, id ); + m_contextParent[ CP_OBSERVER_INFO ] = TheWindowManager->winGetWindowFromId( nullptr, id ); // get the command windows and save for easy access later @@ -1167,13 +1167,13 @@ void ControlBar::init( void ) // keep a pointer to the window making up the right HUD display id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" ); - m_rightHUDWindow = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDWindow = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUnitSelected" ); - m_rightHUDUnitSelectParent = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDUnitSelectParent = TheWindowManager->winGetWindowFromId( nullptr, id ); id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoWindow" ); - m_rightHUDCameoWindow = TheWindowManager->winGetWindowFromId( NULL, id ); + m_rightHUDCameoWindow = TheWindowManager->winGetWindowFromId( nullptr, id ); for( i = 0; i < MAX_RIGHT_HUD_UPGRADE_CAMEOS; i++ ) { windowName.format( "ControlBar.wnd:UnitUpgrade%d", i+1 ); @@ -1189,63 +1189,63 @@ void ControlBar::init( void ) // don't forget about the communicator button CCB id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ); - m_communicatorButton = TheWindowManager->winGetWindowFromId( NULL, id ); + m_communicatorButton = TheWindowManager->winGetWindowFromId( nullptr, id ); setControlCommand(m_communicatorButton, findCommandButton("NonCommand_Communicator") ); m_communicatorButton->winSetTooltipFunc(commandButtonTooltip); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonOptions")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonOptions")); if(win) { setControlCommand(win, findCommandButton("NonCommand_Options") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); if(win) { setControlCommand(win, findCommandButton("NonCommand_IdleWorker") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonPlaceBeacon")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonPlaceBeacon")); if(win) { setControlCommand(win, findCommandButton("NonCommand_Beacon") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(win) { setControlCommand(win, findCommandButton("NonCommand_GeneralsExperience") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonLarge")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonLarge")); if(win) { setControlCommand(win, findCommandButton("NonCommand_UpDown") ); win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:PowerWindow")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:PowerWindow")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey("ControlBar.wnd:MoneyDisplay")); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey("ControlBar.wnd:MoneyDisplay")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:GeneralsExp")); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:GeneralsExp")); if(win) { win->winSetTooltipFunc(commandButtonTooltip); } - m_radarAttackGlowWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinUAttack")); + m_radarAttackGlowWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinUAttack")); - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); win->winGetScreenPosition(&m_controlBarForegroundMarkerPos.x, &m_controlBarForegroundMarkerPos.y); - win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); win->winGetScreenPosition(&m_controlBarBackgroundMarkerPos.x,&m_controlBarBackgroundMarkerPos.y); if(!m_videoManager) @@ -1263,14 +1263,14 @@ void ControlBar::init( void ) m_buildToolTipLayout->setUpdate(ControlBarPopupDescriptionUpdateFunc); } - m_genStarOn = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarON") : NULL; - m_genStarOff = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarOFF") : NULL; + m_genStarOn = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarON") : nullptr; + m_genStarOff = TheMappedImageCollection ? (Image *)TheMappedImageCollection->findImageByName("BarButtonGenStarOFF") : nullptr; m_genStarFlash = TRUE; m_lastFlashedAtPointValue = -1; - m_rankVeteranIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron1L" ) : NULL; - m_rankEliteIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron2L" ) : NULL; - m_rankHeroicIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron3L" ) : NULL; + m_rankVeteranIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron1L" ) : nullptr; + m_rankEliteIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron2L" ) : nullptr; + m_rankHeroicIcon = TheMappedImageCollection ? TheMappedImageCollection->findImageByName( "SSChevron3L" ) : nullptr; // if(!m_controlBarResizer) @@ -1283,7 +1283,7 @@ void ControlBar::init( void ) initObserverControls(); // by default switch to the none context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); } } @@ -1305,8 +1305,8 @@ void ControlBar::reset( void ) m_displayedOCLTimerSeconds = 0; m_isObserverCommandBar = FALSE; // reset us to use a normal command bar - m_observerLookAtPlayer = NULL; - m_observedPlayer = NULL; + m_observerLookAtPlayer = nullptr; + m_observedPlayer = nullptr; if(m_buildToolTipLayout) m_buildToolTipLayout->hide(TRUE); @@ -1326,12 +1326,12 @@ void ControlBar::reset( void ) m_videoManager->reset(); // go back to default context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_sideSelectAnimateDown = FALSE; if(m_animateDownWindow) { TheWindowManager->winDestroy( m_animateDownWindow ); - m_animateDownWindow = NULL; + m_animateDownWindow = nullptr; } // Remove any overridden sets. @@ -1345,7 +1345,7 @@ void ControlBar::reset( void ) } Overridable *stillValid = set->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_commandSets = nextSet; } @@ -1363,7 +1363,7 @@ void ControlBar::reset( void ) } Overridable *stillValid = button->deleteOverrides(); - if (stillValid == NULL && possibleAdjustment) { + if (stillValid == nullptr && possibleAdjustment) { m_commandButtons = nextButton; } @@ -1371,7 +1371,7 @@ void ControlBar::reset( void ) } if(TheTransitionHandler) TheTransitionHandler->remove("ControlBarArrow"); - m_genArrow = NULL; + m_genArrow = nullptr; m_lastFlashedAtPointValue = -1; m_genStarFlash = TRUE; @@ -1402,7 +1402,7 @@ void ControlBar::update( void ) if (m_animateWindowManager->isFinished() && m_animateWindowManager->isReversed()) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window && !window->winIsHidden()) window->winHide(TRUE); } @@ -1439,7 +1439,7 @@ void ControlBar::update( void ) if((TheGameLogic->getFrame() % (LOGICFRAMES_PER_SECOND/2)) == 0) populateObserverInfoWindow(); - Drawable *drawToEvaluateFor = NULL; + Drawable *drawToEvaluateFor = nullptr; if( TheInGameUI->getSelectCount() > 1 ) { // Attempt to isolate a Drawable here to evaluate @@ -1455,10 +1455,10 @@ void ControlBar::update( void ) drawToEvaluateFor = TheInGameUI->getAllSelectedDrawables()->front(); } - Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : NULL; + Object* obj = drawToEvaluateFor ? drawToEvaluateFor->getObject() : nullptr; setPortraitByObject(obj); - const Coord3D* exitPosition = NULL; + const Coord3D* exitPosition = nullptr; if (obj && obj->getControllingPlayer() == getCurrentlyViewedPlayer() && obj->getObjectExitInterface()) exitPosition = obj->getObjectExitInterface()->getRallyPoint(); @@ -1474,10 +1474,10 @@ void ControlBar::update( void ) for( Int i = 0; i < MAX_COMMANDS_PER_SET; ++i ) { GameWindow *button = m_commandWindows[ i ]; - if( button != NULL) + if( button != nullptr) { const CommandButton *commandButton = (const CommandButton *)GadgetButtonGetData(button); - if( commandButton != NULL ) + if( commandButton != nullptr ) { if( commandButton->getFlashCount() > 0 && TheGameClient->getFrame() % 10 == 0 ) { @@ -1523,7 +1523,7 @@ void ControlBar::update( void ) const ThingTemplate *thing = TheThingFactory->findTemplate( ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getBeaconTemplate() ); ThePlayerList->getLocalPlayer()->countObjectsByThingTemplate( 1, &thing, false, &count ); static NameKeyType beaconPlacementButtonID = NAMEKEY("ControlBar.wnd:ButtonPlaceBeacon"); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, beaconPlacementButtonID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, beaconPlacementButtonID); if (win) { if (count < TheMultiplayerSettings->getMaxBeaconsPerPlayer()) @@ -1551,7 +1551,7 @@ void ControlBar::update( void ) // if nothing is selected get out of here except if we're in the Purchase science context... that requires // us to not have anything selected - if( m_currentSelectedDrawable == NULL ) + if( m_currentSelectedDrawable == nullptr ) { // we better be in the default none context @@ -1563,13 +1563,13 @@ void ControlBar::update( void ) // if our selected drawable has no object get out of here - Object *obj = NULL; + Object *obj = nullptr; if(m_currentSelectedDrawable) obj = m_currentSelectedDrawable->getObject(); - if( obj == NULL ) + if( obj == nullptr ) { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return; } @@ -1621,7 +1621,7 @@ void ControlBar::onDrawableSelected( Drawable *draw ) markUIDirty(); // cancel any pending GUI commands - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } @@ -1637,7 +1637,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) if (TheInGameUI->getSelectCount() == 0) { // we just deselected everything - cancel any pending GUI commands - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } // @@ -1645,7 +1645,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) // we have some and are in the middle of a build process, it must obiously be over now // because we are no longer selecting the dozer or worker // - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } @@ -1658,24 +1658,24 @@ const Image *ControlBar::getStarImage(void ) else m_lastFlashedAtPointValue = ThePlayerList->getLocalPlayer()->getSciencePurchasePoints(); - GameWindow *win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); + GameWindow *win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); if(!win) - return NULL; + return nullptr; if(!m_genStarFlash) { GadgetButtonSetEnabledImage(win, m_generalButtonEnable); - return NULL; + return nullptr; } if(TheGameLogic->getFrame()% LOGICFRAMES_PER_SECOND > LOGICFRAMES_PER_SECOND/2) { GadgetButtonSetEnabledImage(win, m_generalButtonHighlight); - return NULL; + return nullptr; } GadgetButtonSetEnabledImage(win, m_generalButtonEnable); - return NULL; + return nullptr; } @@ -1733,7 +1733,7 @@ void ControlBar::evaluateContextUI( void ) showPurchaseScience(); // erase any current state of the GUI by switching out to the empty context - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); // sanity, nothing selected if( TheInGameUI->getSelectCount() == 0 ) @@ -1817,7 +1817,7 @@ void ControlBar::evaluateContextUI( void ) // - Drawable *drawToEvaluateFor = NULL; + Drawable *drawToEvaluateFor = nullptr; Bool multiSelect = FALSE; @@ -1829,7 +1829,7 @@ void ControlBar::evaluateContextUI( void ) // but is represented in the UI as a single unit, // so we must isolate and evaluate only the Nexus drawToEvaluateFor = TheGameClient->findDrawableByID( TheInGameUI->getSoloNexusSelectedDrawableID() ) ; - multiSelect = ( drawToEvaluateFor == NULL ); + multiSelect = ( drawToEvaluateFor == nullptr ); } else // get the first and only drawble in the selection list @@ -1839,7 +1839,7 @@ void ControlBar::evaluateContextUI( void ) if( multiSelect ) { - switchToContext( CB_CONTEXT_MULTI_SELECT, NULL ); + switchToContext( CB_CONTEXT_MULTI_SELECT, nullptr ); } else if ( drawToEvaluateFor )// either we have exactly one drawable, or we have isolated one to evaluate for... { @@ -1848,12 +1848,12 @@ void ControlBar::evaluateContextUI( void ) //Drawable *draw = selectedDrawables->front(); // sanity - //if( draw == NULL ) + //if( draw == nullptr ) // return; // get object Object *obj = drawToEvaluateFor->getObject(); - if( obj == NULL ) + if( obj == nullptr ) return; // we show no interface for objects being sold @@ -1930,7 +1930,7 @@ CommandButton *ControlBar::findNonConstCommandButton( const AsciiString& name ) if( command->getName() == name ) return const_cast((const CommandButton*)command->getFinalOverride()); - return NULL; // not found + return nullptr; // not found } @@ -1960,7 +1960,7 @@ CommandButton *ControlBar::newCommandButton( const AsciiString& name ) CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOverride ) { if (!buttonToOverride) { - return NULL; + return nullptr; } CommandButton *newOverride; @@ -1990,7 +1990,7 @@ CommandButton *ControlBar::newCommandButtonOverride( CommandButton *buttonToOver // find existing item if present commandSet = TheControlBar->findNonConstCommandSet( name ); - if( commandSet == NULL ) + if( commandSet == nullptr ) { // allocate a new item @@ -2030,11 +2030,11 @@ CommandSet* ControlBar::findNonConstCommandSet( const AsciiString& name ) { CommandSet* set; - for( set = m_commandSets; set != NULL; set = set->friend_getNext() ) + for( set = m_commandSets; set != nullptr; set = set->friend_getNext() ) if( set->getName() == name ) return const_cast((const CommandSet *) set); - return NULL; // set not found + return nullptr; // set not found } //------------------------------------------------------------------------------------------------- @@ -2081,7 +2081,7 @@ CommandSet *ControlBar::newCommandSet( const AsciiString& name ) CommandSet *ControlBar::newCommandSetOverride( CommandSet *setToOverride ) { if (!setToOverride) { - return NULL; + return nullptr; } // allocate a new set @@ -2132,9 +2132,9 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) { // restore the right hud to a plain window - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; setPortraitByObject( obj ); // if we're switching context, we have to repopulate the hotkey manager @@ -2148,7 +2148,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) m_currentSelectedDrawable = draw; if (IsInGameChatActive() == FALSE && TheGameLogic && !TheGameLogic->isInShellGame()) { - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } // hide/un-hide the appropriate windows for the context @@ -2200,7 +2200,7 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) } // do not show any rally point marker - showRallyPoint( NULL ); + showRallyPoint( nullptr ); break; @@ -2231,12 +2231,12 @@ void ControlBar::switchToContext( ControlBarContext context, Drawable *draw ) { ProductionUpdateInterface *pu = obj->getProductionUpdateInterface(); - if( pu && pu->firstProduction() != NULL ) + if( pu && pu->firstProduction() != nullptr ) { m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); populateBuildQueue( obj ); - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); } else { @@ -2446,10 +2446,10 @@ void ControlBar::setControlCommand( GameWindow *button, const CommandButton *com } // sanity - if( commandButton == NULL ) + if( commandButton == nullptr ) { - DEBUG_ASSERTCRASH( 0, ("setControlCommand: NULL commandButton passed in") ); + DEBUG_ASSERTCRASH( 0, ("setControlCommand: null commandButton passed in") ); return; } @@ -2539,7 +2539,7 @@ void ControlBar::postProcessCommands( void ) //------------------------------------------------------------------------------------------------- /** set the command for the button identified by the window name - * NOTE that parent may be NULL, it only helps to speed up the search for a particular + * NOTE that parent may be nullptr, it only helps to speed up the search for a particular * window ID */ //------------------------------------------------------------------------------------------------- void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWindow *parent, @@ -2548,7 +2548,7 @@ void ControlBar::setControlCommand( const AsciiString& buttonWindowName, GameWin UnsignedInt winID = TheNameKeyGenerator->nameToKey( buttonWindowName ); GameWindow *win = TheWindowManager->winGetWindowFromId( parent, winID ); - if( win == NULL ) + if( win == nullptr ) { DEBUG_ASSERTCRASH( 0, ("setControlCommand: Unable to find window '%s'", buttonWindowName.str()) ); @@ -2605,7 +2605,7 @@ void ControlBar::setPortraitByObject( Object *obj ) if( obj->isKindOf( KINDOF_SHOW_PORTRAIT_WHEN_CONTROLLED ) && !obj->isLocallyControlled() ) { //Handles civ vehicles without terrorists in them - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); return; } @@ -2620,7 +2620,7 @@ void ControlBar::setPortraitByObject( Object *obj ) if( thing->isKindOf( KINDOF_SHOW_PORTRAIT_WHEN_CONTROLLED ) ) { //If a bomb truck disguises as a civ vehicle, don't use it's portrait (or else you'll see the terrorist). - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); return; } StealthUpdate *stealth = obj->getStealth(); @@ -2690,7 +2690,7 @@ void ControlBar::setPortraitByObject( Object *obj ) m_rightHUDUpgradeCameos[i]->winHide(TRUE); //Clear any overlay the portrait had on it. - GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, NULL ); + GadgetButtonDrawOverlayImage( m_rightHUDCameoWindow, nullptr ); } } @@ -2701,8 +2701,8 @@ void ControlBar::setPortraitByObject( Object *obj ) // ------------------------------------------------------------------------------------------------ void ControlBar::showRallyPoint(const Coord3D* loc) { - // if loc is NULL, destroy any rally point drawble we have shown - if (loc == NULL) + // if loc is null, destroy any rally point drawble we have shown + if (loc == nullptr) { // destroy rally point drawable if present if (m_rallyPointDrawableID != INVALID_DRAWABLE_ID) @@ -2712,7 +2712,7 @@ void ControlBar::showRallyPoint(const Coord3D* loc) return; } - Drawable* marker = NULL; + Drawable* marker = nullptr; // create a rally point drawble if necessary if (m_rallyPointDrawableID == INVALID_DRAWABLE_ID) @@ -2759,14 +2759,14 @@ void ControlBar::setControlBarSchemeByPlayer(Player *p) static NameKeyType buttonPlaceBeaconID = NAMEKEY( "ControlBar.wnd:ButtonPlaceBeacon" ); static NameKeyType buttonIdleWorkerID = NAMEKEY("ControlBar.wnd:ButtonIdleWorker"); static NameKeyType buttonGeneralID = NAMEKEY("ControlBar.wnd:ButtonGeneral"); - GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( NULL, buttonPlaceBeaconID ); - GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( NULL, buttonIdleWorkerID ); - GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID ); + GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( nullptr, buttonPlaceBeaconID ); + GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( nullptr, buttonIdleWorkerID ); + GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralID ); if( !p->isPlayerActive() ) { m_isObserverCommandBar = TRUE; - switchToContext( CB_CONTEXT_OBSERVER_LIST, NULL ); + switchToContext( CB_CONTEXT_OBSERVER_LIST, nullptr ); DEBUG_LOG(("We're loading the Observer Command Bar")); if (buttonPlaceBeacon) @@ -2778,7 +2778,7 @@ void ControlBar::setControlBarSchemeByPlayer(Player *p) } else { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_isObserverCommandBar = FALSE; if (buttonPlaceBeacon) @@ -2804,14 +2804,14 @@ void ControlBar::setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt) static NameKeyType buttonPlaceBeaconID = NAMEKEY( "ControlBar.wnd:ButtonPlaceBeacon" ); static NameKeyType buttonIdleWorkerID = NAMEKEY("ControlBar.wnd:ButtonIdleWorker"); static NameKeyType buttonGeneralID = NAMEKEY("ControlBar.wnd:ButtonGeneral"); - GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( NULL, buttonPlaceBeaconID ); - GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( NULL, buttonIdleWorkerID ); - GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralID ); + GameWindow *buttonPlaceBeacon = TheWindowManager->winGetWindowFromId( nullptr, buttonPlaceBeaconID ); + GameWindow *buttonIdleWorker = TheWindowManager->winGetWindowFromId( nullptr, buttonIdleWorkerID ); + GameWindow *buttonGeneral = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralID ); if(pt == ThePlayerTemplateStore->findPlayerTemplate(TheNameKeyGenerator->nameToKey("FactionObserver"))) { m_isObserverCommandBar = TRUE; - switchToContext( CB_CONTEXT_OBSERVER_LIST, NULL ); + switchToContext( CB_CONTEXT_OBSERVER_LIST, nullptr ); DEBUG_LOG(("We're loading the Observer Command Bar")); if (buttonPlaceBeacon) @@ -2823,7 +2823,7 @@ void ControlBar::setControlBarSchemeByPlayerTemplate( const PlayerTemplate *pt) } else { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); m_isObserverCommandBar = FALSE; if (buttonPlaceBeacon) @@ -2925,7 +2925,7 @@ void ControlBar::updateCommanBarBorderColors(Color build, Color action, Color up void ControlBar::hideCommunicator( Bool b ) { //sanity - if( m_communicatorButton != NULL ) + if( m_communicatorButton != nullptr ) m_communicatorButton->winHide( b ); } @@ -2952,7 +2952,7 @@ void ControlBar::showPurchaseScience( void ) m_genStarFlash = FALSE; if(!m_contextParent[ CP_PURCHASE_SCIENCE ]->winIsHidden()) return; - //switchToContext(CB_CONTEXT_PURCHASE_SCIENCE, NULL); + //switchToContext(CB_CONTEXT_PURCHASE_SCIENCE, nullptr); m_contextParent[ CP_PURCHASE_SCIENCE ]->winHide(FALSE); if (TheGlobalData->m_animateWindows) TheTransitionHandler->setGroup("GenExpFade"); @@ -3153,7 +3153,7 @@ void ControlBar::updateUpDownImages( const Image *toggleButtonUpIn, const Image void ControlBar::setUpDownImages( void ) { - GameWindow *win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); + GameWindow *win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); if(!win) return; // we only care if it's in it's low state, else we put the default images up @@ -3226,17 +3226,17 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) Int i = 0; for( ; i < MAX_SPECIAL_POWER_SHORTCUTS; ++i ) { - m_specialPowerShortcutButtonParents[i] = NULL; - m_specialPowerShortcutButtons[i] = NULL; + m_specialPowerShortcutButtonParents[i] = nullptr; + m_specialPowerShortcutButtons[i] = nullptr; } if(m_specialPowerLayout) { m_specialPowerLayout->destroyWindows(); deleteInstance(m_specialPowerLayout); - m_specialPowerLayout = NULL; + m_specialPowerLayout = nullptr; } - m_specialPowerShortcutParent = NULL; + m_specialPowerShortcutParent = nullptr; m_currentlyUsedSpecialPowersButtons = 0; const PlayerTemplate *pt = player->getPlayerTemplate(); @@ -3254,7 +3254,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) tempName = layoutName; tempName.concat(":GenPowersShortcutBarParent"); NameKeyType id = TheNameKeyGenerator->nameToKey( tempName ); - m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( NULL, id );//m_scienceLayout->getFirstWindow(); + m_specialPowerShortcutParent = TheWindowManager->winGetWindowFromId( nullptr, id );//m_scienceLayout->getFirstWindow(); tempName = layoutName; tempName.concat(":ButtonCommand%d"); @@ -3285,7 +3285,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) Int i; if(!player || !player->getPlayerTemplate() || !player->isLocalPlayer() || m_currentlyUsedSpecialPowersButtons == 0 - || m_specialPowerShortcutButtons == NULL || m_specialPowerShortcutButtonParents == NULL) + || m_specialPowerShortcutButtons == nullptr || m_specialPowerShortcutButtonParents == nullptr) return; for( i = 0; i < MAX_SPECIAL_POWER_SHORTCUTS; ++i ) { @@ -3312,7 +3312,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player) commandButton = commandSet->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { continue; // hide window on interface @@ -3583,7 +3583,7 @@ void ControlBar::updateSpecialPowerShortcut( void ) // get the command from the control command = (const CommandButton *)GadgetButtonGetData(win); //command = (const CommandButton *)win->winGetUserData(); - if( command == NULL ) + if( command == nullptr ) continue; @@ -3596,7 +3596,7 @@ void ControlBar::updateSpecialPowerShortcut( void ) CommandAvailability availability = COMMAND_RESTRICTED; const SpecialPowerTemplate *spTemplate = command->getSpecialPowerTemplate(); - Object *obj = NULL; + Object *obj = nullptr; if( spTemplate ) { obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( command->getSpecialPowerTemplate()->getSpecialPowerType() ); @@ -3676,7 +3676,7 @@ void ControlBar::drawSpecialPowerShortcutMultiplierText() // get the command from the control command = (const CommandButton *)GadgetButtonGetData(win); //command = (const CommandButton *)win->winGetUserData(); - if( command == NULL ) + if( command == nullptr ) continue; //draw superweapon ready multipliers @@ -3709,7 +3709,7 @@ void ControlBar::drawSpecialPowerShortcutMultiplierText() UnicodeString unibuffer; GadgetButtonSetText( win, unibuffer ); //TheDisplayStringManager->freeDisplayString( m_shortcutDisplayStrings[ i ] ); - //m_shortcutDisplayStrings[ i ] = NULL; + //m_shortcutDisplayStrings[ i ] = nullptr; } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp index 9851cc03ff7..4dc85964307 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -51,9 +51,9 @@ void ControlBar::populateBeacon( Object *beacon ) static NameKeyType staticTextID = NAMEKEY("ControlBar.wnd:StaticTextBeaconLabel"); static NameKeyType clearButtonID = NAMEKEY("ControlBar.wnd:ButtonClearBeaconText"); - GameWindow *textEntryWin = TheWindowManager->winGetWindowFromId(NULL, textID); - GameWindow *staticTextWin = TheWindowManager->winGetWindowFromId(NULL, staticTextID); - GameWindow *buttonWin = TheWindowManager->winGetWindowFromId(NULL, clearButtonID); + GameWindow *textEntryWin = TheWindowManager->winGetWindowFromId(nullptr, textID); + GameWindow *staticTextWin = TheWindowManager->winGetWindowFromId(nullptr, staticTextID); + GameWindow *buttonWin = TheWindowManager->winGetWindowFromId(nullptr, clearButtonID); if (beacon->isLocallyControlled()) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index ca67c21b7e4..e27312cbce9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -145,14 +145,14 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co //static const CommandButton *exitCommand = findCommandButton( "Command_TransportExit" ); // sanity - if( transport == NULL || commandSet == NULL ) + if( transport == nullptr || commandSet == nullptr ) return; // get the transport contain module ContainModuleInterface *contain = transport->getContain(); // sanity - if( contain == NULL ) + if( contain == nullptr ) return; // how many slots do we have inside the transport @@ -202,7 +202,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co m_commandWindows[ i ]->winEnable( FALSE ); //Clear any potential veterancy rank, or else we'll see it when it's empty! - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); //Unmanned vehicles don't have any commands available -- in fact they are hidden! if( transport->isDisabledByType( DISABLED_UNMANNED ) ) @@ -274,7 +274,7 @@ void ControlBar::populateCommand( Object *obj ) commandSet = findCommandSet( obj->getCommandSetString() ); // if no command set match is found hide all the buttons - if( commandSet == NULL ) + if( commandSet == nullptr ) { // hide all the buttons @@ -304,7 +304,7 @@ void ControlBar::populateCommand( Object *obj ) commandButton = commandSet->getCommandButton(i); // if button is not present, just hide the window - if( commandButton == NULL ) + if( commandButton == nullptr ) { // hide window on interface @@ -515,7 +515,7 @@ void ControlBar::resetContainData( void ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_containData[ i ].control = NULL; + m_containData[ i ].control = nullptr; m_containData[ i ].objectID = INVALID_ID; } @@ -532,10 +532,10 @@ void ControlBar::resetBuildQueueData( void ) for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ ) { - m_queueData[ i ].control = NULL; + m_queueData[ i ].control = nullptr; m_queueData[ i ].type = PRODUCTION_INVALID; m_queueData[ i ].productionID = PRODUCTIONID_INVALID; - m_queueData[ i ].upgradeToResearch = NULL; + m_queueData[ i ].upgradeToResearch = nullptr; } @@ -592,13 +592,13 @@ void ControlBar::populateBuildQueue( Object *producer ) GadgetButtonSetText( m_queueData[ i ].control, L"" ); //Clear any potential veterancy rank, or else we'll see it when it's empty! - GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL ); + GadgetButtonDrawOverlayImage( m_queueData[ i ].control, nullptr ); } // step through each object being built and set the image data for the buttons ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) return; // sanity const ProductionEntry *production; Int windowIndex = 0; @@ -692,7 +692,7 @@ void ControlBar::populateBuildQueue( Object *producer ) //------------------------------------------------------------------------------------------------- void ControlBar::updateContextCommand( void ) { - Object *obj = NULL; + Object *obj = nullptr; Int i; // get object @@ -703,7 +703,7 @@ void ControlBar::updateContextCommand( void ) // the contents of objects are ususally showed on the UI, when those contents change // we always to update the UI // - ContainModuleInterface *contain = obj ? obj->getContain() : NULL; + ContainModuleInterface *contain = obj ? obj->getContain() : nullptr; if( contain && contain->getContainMax() > 0 && m_lastRecordedInventoryCount != contain->getContainCount() ) { @@ -717,7 +717,7 @@ void ControlBar::updateContextCommand( void ) } // get production update for those objects that have one - ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : NULL; + ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : nullptr; // // when we have a production update, we show the build queue when there is actually @@ -728,11 +728,11 @@ void ControlBar::updateContextCommand( void ) if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == TRUE ) { - if( pu && pu->firstProduction() != NULL ) + if( pu && pu->firstProduction() != nullptr ) { // don't show the portrait image - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); // show the build queue m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE ); @@ -744,7 +744,7 @@ void ControlBar::updateContextCommand( void ) else { - if( pu && pu->firstProduction() == NULL ) + if( pu && pu->firstProduction() == nullptr ) { // hide the build queue @@ -762,7 +762,7 @@ void ControlBar::updateContextCommand( void ) { // when the build queue is enabled, the selected portrait cannot be shown - setPortraitByObject( NULL ); + setPortraitByObject( nullptr ); // // when showing a production queue, when the production count changes of the producer @@ -821,7 +821,7 @@ void ControlBar::updateContextCommand( void ) // get the command from the control command = (const CommandButton *)GadgetButtonGetData(win); //command = (const CommandButton *)win->winGetUserData(); - if( command == NULL ) + if( command == nullptr ) continue; @@ -911,18 +911,18 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate if( !thingTemplate ) { - return NULL; + return nullptr; } Player *player = ThePlayerList->getLocalPlayer(); if( !player ) { - return NULL; + return nullptr; } //See if the thingTemplate has a VeterancyGainCreate //This is HORROR CODE and needs to be optimized! - const VeterancyGainCreateModuleData *data = NULL; + const VeterancyGainCreateModuleData *data = nullptr; AsciiString modName; const ModuleInfo& mi = thingTemplate->getBehaviorModuleInfo(); for( Int modIdx = 0; modIdx < mi.getCount(); ++modIdx ) @@ -948,7 +948,7 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate } } - //Return the appropriate image (including NULL if no veterancy levels) + //Return the appropriate image (including nullptr if no veterancy levels) switch( level ) { case LEVEL_VETERAN: @@ -958,7 +958,7 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate case LEVEL_HEROIC: return m_rankHeroicIcon; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -966,11 +966,11 @@ const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj ) { if( !obj ) { - return NULL; + return nullptr; } VeterancyLevel level = obj->getVeterancyLevel(); - //Return the appropriate image (including NULL if no veterancy levels) + //Return the appropriate image (including nullptr if no veterancy levels) switch( level ) { case LEVEL_VETERAN: @@ -980,14 +980,14 @@ const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj ) case LEVEL_HEROIC: return m_rankHeroicIcon; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- static Int getRappellerCount(Object* obj) { Int num = 0; - const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -1017,7 +1017,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com if (ThePlayerList && ThePlayerList->getLocalPlayer()) obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( command->getSpecialPowerTemplate()->getSpecialPowerType() ); else - obj = NULL; + obj = nullptr; } //If we modify the button (like a gadget clock overlay), then sometimes we may wish to apply it to a specific different button. @@ -1027,7 +1027,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com applyToWin = win; } - if (obj == NULL) + if (obj == nullptr) return COMMAND_HIDDEN; // probably better than crashing.... Player *player = obj->getControllingPlayer(); @@ -1141,14 +1141,14 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_RESTRICTED; // get the dozer ai update interface - DozerAIInterface* dozerAI = NULL; - if( obj->getAIUpdateInterface() == NULL ) + DozerAIInterface* dozerAI = nullptr; + if( obj->getAIUpdateInterface() == nullptr ) return COMMAND_RESTRICTED; dozerAI = obj->getAIUpdateInterface()->getDozerAIInterface(); - DEBUG_ASSERTCRASH( dozerAI != NULL, ("Something KINDOF_DOZER must have a Dozer-like AIUpdate") ); - if( dozerAI == NULL ) + DEBUG_ASSERTCRASH( dozerAI != nullptr, ("Something KINDOF_DOZER must have a Dozer-like AIUpdate") ); + if( dozerAI == nullptr ) return COMMAND_RESTRICTED; // if building anything at all right now we can't build another @@ -1249,7 +1249,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_RESTRICTED; } // no production update, can't possibly do this command - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_CRASH(("Objects that have Object-Level Upgrades must also have ProductionUpdate. Just cuz.")); return COMMAND_RESTRICTED; @@ -1283,7 +1283,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com AIUpdateInterface *ai = obj->getAIUpdateInterface(); // no ai, can't possibly fire weapon - if( ai == NULL ) + if( ai == nullptr ) return COMMAND_RESTRICTED; // ask the ai if the weapon is ready to fire @@ -1302,7 +1302,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com return COMMAND_AVAILABLE; } - if( w == NULL // No weapon + if( w == nullptr // No weapon || w->getStatus() != READY_TO_FIRE // Weapon not ready || w->getPossibleNextShotFrame() == now // Weapon ready, but could fire this exact frame (handle button flicker since it may be going to fire anyway) /// @todo srj -- not sure why this next check is necessary, but the Comanche missile buttons will flicker without it. figure out someday. @@ -1313,7 +1313,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com || (w->getPossibleNextShotFrame()==now-1) ) { - if ( w != NULL ) + if ( w != nullptr ) { // only draw the clock when reloading a clip, not when merely between shots, since that's usually a tiny amount of time if ( w->getStatus() == RELOADING_CLIP) @@ -1392,7 +1392,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com DockUpdateInterface *dui = obj->getDockUpdateInterface(); // if the dock is closed or not present this command is invalid - if( dui == NULL || dui->isDockOpen() == FALSE ) + if( dui == nullptr || dui->isDockOpen() == FALSE ) return COMMAND_RESTRICTED; break; } @@ -1403,12 +1403,12 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com case GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT: { // sanity - DEBUG_ASSERTCRASH( command->getSpecialPowerTemplate() != NULL, - ("The special power in the command '%s' is NULL", command->getName().str()) ); + DEBUG_ASSERTCRASH( command->getSpecialPowerTemplate() != nullptr, + ("The special power in the command '%s' is null", command->getName().str()) ); // get special power module from the object to execute it SpecialPowerModuleInterface *mod = obj->getSpecialPowerModule( command->getSpecialPowerTemplate() ); - if( mod == NULL ) + if( mod == nullptr ) { // sanity ... we must have a module for the special power, if we don't somebody probably // forgot to put it in the object @@ -1468,7 +1468,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com DEBUG_ASSERTCRASH( w, ("Unit %s's CommandButton %s is trying to access weaponslot %d, but doesn't have a weapon there in its FactionUnit ini entry.", obj->getTemplate()->getName().str(), command->getName().str(), (Int)command->getWeaponSlot() ) ); - if( w == NULL) + if( w == nullptr) return COMMAND_RESTRICTED; const DrawableList *selected = TheInGameUI->getAllSelectedDrawables(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 37261a151d3..8177de95f75 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -101,14 +101,14 @@ CBCommandStatus ControlBar::processCommandTransitionUI( GameWindow *control, Gad { // sanity, we won't process messages if we have no source object if( m_currContext != CB_CONTEXT_MULTI_SELECT && - (m_currentSelectedDrawable == NULL || - m_currentSelectedDrawable->getObject() == NULL) ) + (m_currentSelectedDrawable == nullptr || + m_currentSelectedDrawable->getObject() == nullptr) ) { if( m_currContext != CB_CONTEXT_NONE && m_currContext != CB_CONTEXT_OBSERVER_INFO && m_currContext != CB_CONTEXT_OBSERVER_LIST) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return CBC_COMMAND_NOT_USED; } @@ -139,17 +139,17 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, commandButton->getCommandType() != GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT && commandButton->getCommandType() != GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT && commandButton->getCommandType() != GUI_COMMAND_SELECT_ALL_UNITS_OF_TYPE && - (m_currentSelectedDrawable == NULL || m_currentSelectedDrawable->getObject() == NULL) ) + (m_currentSelectedDrawable == nullptr || m_currentSelectedDrawable->getObject() == nullptr) ) { if( m_currContext != CB_CONTEXT_NONE ) - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); return CBC_COMMAND_NOT_USED; } // sanity - if( control == NULL ) + if( control == nullptr ) return CBC_COMMAND_NOT_USED; // the context sensitive gui only is only made of buttons ... sanity @@ -157,7 +157,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, return CBC_COMMAND_NOT_USED; - if( commandButton == NULL ) + if( commandButton == nullptr ) return CBC_COMMAND_NOT_USED; // if the button is flashing, tell it to stop flashing @@ -173,7 +173,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object that is driving the context sensitive UI if we're not in a multi // select context // - Object *obj = NULL; + Object *obj = nullptr; if( m_currContext != CB_CONTEXT_MULTI_SELECT && commandButton->getCommandType() != GUI_COMMAND_PURCHASE_SCIENCE && commandButton->getCommandType() != GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT && @@ -197,7 +197,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, obj->markSingleUseCommandUsed(); //Yeah, an object can only use one single use command... } - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); //Play any available unit specific sound for button Player *player = ThePlayerList->getLocalPlayer(); @@ -235,7 +235,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, { // sanity - if( m_currentSelectedDrawable == NULL ) + if( m_currentSelectedDrawable == nullptr ) break; //Kris: September 27, 2002 @@ -322,7 +322,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, case GUI_COMMAND_SPECIAL_POWER_CONSTRUCT: { // sanity - if( m_currentSelectedDrawable == NULL ) + if( m_currentSelectedDrawable == nullptr ) break; const ThingTemplate *whatToBuild = commandButton->getThingTemplate(); @@ -371,7 +371,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object we have selected Object *building = obj; - if( building == NULL ) + if( building == nullptr ) break; // sanity check, the building must be under our control to cancel construction @@ -393,7 +393,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the "factory" object that is going to make the thing Object *factory = obj; - if( factory == NULL ) + if( factory == nullptr ) break; // sanity, we must have something to build @@ -435,7 +435,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, ProductionUpdateInterface *pu = factory->getProductionUpdateInterface(); // sanity, we can't build things if we can't produce units - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producting units", @@ -486,7 +486,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // get the object that is the producer Object *producer = obj; - if( producer == NULL ) + if( producer == nullptr ) break; // sanity, we must control the producer ... if this isn't true they might be hacking the game @@ -508,7 +508,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in player upgrade command", "UNKNOWN") ); // sanity - if( obj == NULL || upgradeT == NULL ) + if( obj == nullptr || upgradeT == nullptr ) break; // make sure the player can really make this @@ -517,8 +517,8 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; } - ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : NULL; - if (pu != NULL) + ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : nullptr; + if (pu != nullptr) { CanMakeType cmt = pu->canQueueUpgrade(upgradeT); if (cmt == CANMAKE_QUEUE_FULL) @@ -543,7 +543,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, const UpgradeTemplate *upgradeT = commandButton->getUpgradeTemplate(); DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in object upgrade command", "UNKNOWN") ); // sanity - if( upgradeT == NULL ) + if( upgradeT == nullptr ) break; //Make sure the player can really make this @@ -554,8 +554,8 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; } - ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : NULL; - if (pu != NULL) + ProductionUpdateInterface* pu = obj ? obj->getProductionUpdateInterface() : nullptr; + if (pu != nullptr) { CanMakeType cmt = pu->canQueueUpgrade(upgradeT); if (cmt == CANMAKE_QUEUE_FULL) @@ -612,7 +612,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, Object *producer = obj; // sanity - if( upgradeT == NULL || producer == NULL ) + if( upgradeT == nullptr || producer == nullptr ) break; // send the message @@ -699,7 +699,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, Object *objWantingExit = TheGameLogic->findObjectByID( objID ); // if the control container returns an object ID but the object is not found, remove the control entry and exit - if( objWantingExit == NULL ) + if( objWantingExit == nullptr ) { // @@ -707,7 +707,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, // cycle of the UI will repopulate any buttons as the contents of objects // change so this is only an edge case that will be visually corrected next frame // - m_containData[ i ].control = NULL; + m_containData[ i ].control = nullptr; m_containData[ i ].objectID = INVALID_ID; break; // exit case @@ -727,7 +727,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, case GUI_COMMAND_EVACUATE: { // Cancel GUI command mode. - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); if (BitIsSet(commandButton->getOptions(), NEED_TARGET_POS) == FALSE) { pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_EVACUATE ); @@ -884,7 +884,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, if( st == SCIENCE_INVALID) { - switchToContext( CB_CONTEXT_NONE, NULL ); + switchToContext( CB_CONTEXT_NONE, nullptr ); break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index 4ba7345e650..903faa97a22 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -52,9 +52,9 @@ void ControlBar::resetCommonCommandData( void ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; //Clear out any remnant overlays. - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); } } @@ -68,7 +68,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) const CommandButton *command; // sanity - if( draw == NULL ) + if( draw == nullptr ) return; Object* obj = draw->getObject(); @@ -80,7 +80,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // get the command set of this drawable const CommandSet *commandSet = findCommandSet( obj->getCommandSetString() ); - if( commandSet == NULL ) + if( commandSet == nullptr ) { // @@ -90,7 +90,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) { - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; if (m_commandWindows[ i ]) { m_commandWindows[ i ]->winHide( TRUE ); @@ -180,7 +180,7 @@ void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) // // remove the common command - m_commonCommands[ i ] = NULL; + m_commonCommands[ i ] = nullptr; // // hide the window control cause it should have been made visible from a command @@ -208,8 +208,8 @@ void ControlBar::populateMultiSelect( void ) Drawable *draw; Bool firstDrawable = TRUE; Bool portraitSet = FALSE; - const Image *portrait = NULL; - Object *portraitObj = NULL; + const Image *portrait = nullptr; + Object *portraitObj = nullptr; // first reset the common command data resetCommonCommandData(); @@ -278,7 +278,7 @@ void ControlBar::populateMultiSelect( void ) } else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) - portrait = NULL; + portrait = nullptr; } @@ -331,7 +331,7 @@ void ControlBar::updateContextMultiSelect( void ) obj = draw->getObject(); // sanity - if( obj == NULL ) + if( obj == nullptr ) continue; // for each of the visible command windows make sure the object can execute the command @@ -350,7 +350,7 @@ void ControlBar::updateContextMultiSelect( void ) // get the command command = (const CommandButton *)GadgetButtonGetData(win); - if( command == NULL ) + if( command == nullptr ) continue; // can we do the command @@ -408,7 +408,7 @@ void ControlBar::updateContextMultiSelect( void ) continue; // don't consider slots that don't have commands - if( m_commonCommands[ i ] == NULL ) + if( m_commonCommands[ i ] == nullptr ) continue; // check the count of objects that can do the command and enable/disable the control, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index ea1211b34a1..4f371e91799 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -48,10 +48,10 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce { UnicodeString text; static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerStaticText" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( NULL, descID ); + GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); static UnsignedInt barID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerProgressBar" ); - GameWindow *barWindow = TheWindowManager->winGetWindowFromId( NULL, barID ); + GameWindow *barWindow = TheWindowManager->winGetWindowFromId( nullptr, barID ); // santiy DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); @@ -80,7 +80,7 @@ void ControlBar::populateOCLTimer( Object *creatorObject ) { // sanity - if( creatorObject == NULL ) + if( creatorObject == nullptr ) return; // get our parent window diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp index bd7a154d681..bb6975721c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp @@ -77,26 +77,24 @@ static NameKeyType staticTextPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_I NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *ObserverPlayerInfoWindow = NULL; -static GameWindow *ObserverPlayerListWindow = NULL; +static GameWindow *ObserverPlayerInfoWindow = nullptr; +static GameWindow *ObserverPlayerListWindow = nullptr; -static GameWindow *buttonPlayer[MAX_BUTTONS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *staticTextPlayer[MAX_BUTTONS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonPlayer[MAX_BUTTONS] = {0}; +static GameWindow *staticTextPlayer[MAX_BUTTONS] = {0}; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *winFlag = NULL; -static GameWindow *winGeneralPortrait = NULL; +static GameWindow *winFlag = nullptr; +static GameWindow *winGeneralPortrait = nullptr; // TheSuperHackers @tweak Allow idle worker selection for observers. -static GameWindow *buttonIdleWorker = NULL; -static GameWindow *staticTextNumberOfUnits = NULL; -static GameWindow *staticTextNumberOfBuildings = NULL; -static GameWindow *staticTextNumberOfUnitsKilled = NULL; -static GameWindow *staticTextNumberOfUnitsLost = NULL; -static GameWindow *staticTextPlayerName = NULL; +static GameWindow *buttonIdleWorker = nullptr; +static GameWindow *staticTextNumberOfUnits = nullptr; +static GameWindow *staticTextNumberOfBuildings = nullptr; +static GameWindow *staticTextNumberOfUnitsKilled = nullptr; +static GameWindow *staticTextNumberOfUnitsLost = nullptr; +static GameWindow *staticTextPlayerName = nullptr; static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; @@ -107,8 +105,8 @@ static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; void ControlBar::initObserverControls( void ) { - ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); - ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); + ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); + ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); for (Int i = 0; i < MAX_BUTTONS; i++) { @@ -121,14 +119,14 @@ void ControlBar::initObserverControls( void ) staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); } - staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); - staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); - staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); - staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); - staticTextPlayerName = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); - winFlag = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); - winGeneralPortrait = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); - buttonIdleWorker = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); + staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); + staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); + staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); + staticTextPlayerName = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); + winFlag = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); + winGeneralPortrait = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); + buttonIdleWorker = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); @@ -138,10 +136,10 @@ void ControlBar::initObserverControls( void ) //------------------------------------------------------------------------------------------------- void ControlBar::setObserverLookAtPlayer(Player *player) { - if (player != NULL && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) { // Looking at the observer. Treat as not looking at player. - m_observerLookAtPlayer = NULL; + m_observerLookAtPlayer = nullptr; } else { @@ -152,10 +150,10 @@ void ControlBar::setObserverLookAtPlayer(Player *player) //------------------------------------------------------------------------------------------------- void ControlBar::setObservedPlayer(Player *player) { - if (player != NULL && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) + if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) { // Looking at the observer. Treat as not observing player. - m_observedPlayer = NULL; + m_observedPlayer = nullptr; } else { @@ -196,7 +194,7 @@ WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt m Int controlID = control->winGetWindowId(); if( controlID == buttonCancelID) { - rts::changeObservedPlayer(NULL); + rts::changeObservedPlayer(nullptr); ObserverPlayerInfoWindow->winHide(TRUE); ObserverPlayerListWindow->winHide(FALSE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp index 7fe4f4e843a..73d6da2998f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp @@ -79,7 +79,7 @@ void PrintInfoRecursive( GameWindow *win, FILE *fp) void PrintOffsetsFromControlBarParent( void ) { - GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); + GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); if(!controlBarParent) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp index 2eee2dd5312..d3ef6a5c231 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp @@ -61,9 +61,9 @@ const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = { - { "AltPosition", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altPos ) }, - { "AltSize", INI::parseICoord2D, NULL, offsetof( ResizerWindow, m_altSize ) }, - { NULL, NULL, NULL, 0 } + { "AltPosition", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altPos ) }, + { "AltSize", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altSize ) }, + { nullptr, nullptr, nullptr, 0 } }; //----------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void ControlBarResizer::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, nullptr ); } @@ -128,23 +128,23 @@ ResizerWindow *ControlBarResizer::findResizerWindow( AsciiString name ) } it ++; } - return NULL; + return nullptr; } ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) { ResizerWindow *newRwin = NEW ResizerWindow; if(!newRwin) - return NULL; + return nullptr; newRwin->m_name = name; - GameWindow *win = NULL; - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(name)); + GameWindow *win = nullptr; + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(name)); if( !win ) { DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); delete newRwin; - return NULL; + return nullptr; } win->winGetPosition(&newRwin->m_defaultPos.x,&newRwin->m_defaultPos.y); win->winGetSize(&newRwin->m_defaultSize.x,&newRwin->m_defaultSize.y); @@ -154,7 +154,7 @@ ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) void ControlBarResizer::sizeWindowsDefault( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = NULL; + GameWindow *win = nullptr; while (it != m_resizerWindowsList.end()) { ResizerWindow *rWin = *it; @@ -164,7 +164,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); if(!win) { it++; @@ -179,7 +179,7 @@ void ControlBarResizer::sizeWindowsDefault( void ) void ControlBarResizer::sizeWindowsAlt( void ) { ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = NULL; + GameWindow *win = nullptr; Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; while (it != m_resizerWindowsList.end()) @@ -191,7 +191,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) it++; continue; } - win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(rWin->m_name)); + win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); if(!win) { it++; @@ -210,7 +210,7 @@ void ControlBarResizer::sizeWindowsAlt( void ) void INI::parseControlBarResizerDefinition( INI* ini ) { // AsciiString name; -// ResizerWindow *rWin = NULL; +// ResizerWindow *rWin = nullptr; // // // read the name // const char* c = ini->getNextToken(); @@ -223,7 +223,7 @@ void INI::parseControlBarResizerDefinition( INI* ini ) // return; // } // rWin = resizer->findResizerWindow( name ); -// if( rWin == NULL ) +// if( rWin == nullptr ) // { // // // image not found, create a new one diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 32b27527194..e8cc648bb69 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -73,90 +73,90 @@ enum{ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = { - { "ImagePart", ControlBarSchemeManager::parseImagePart, NULL, NULL }, - { "AnimatingPart", ControlBarSchemeManager::parseAnimatingPart, NULL, NULL }, - { "ScreenCreationRes", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_ScreenCreationRes ) }, - { "Side", INI::parseAsciiString, NULL, offsetof( ControlBarScheme, m_side ) }, - { "QueueButtonImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buttonQueueImage ) }, - { "RightHUDImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_rightHUDImage ) }, - { "BuildUpClockColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_buildUpClockColor ) }, - { "ButtonBorderBuildColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderBuildColor ) }, - { "CommandBarBorderColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_commandBarBorderColor ) }, - { "ButtonBorderActionColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderActionColor ) }, - { "ButtonBorderUpgradeColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderUpgradeColor ) }, - { "ButtonBorderSystemColor", INI::parseColorInt, NULL, offsetof( ControlBarScheme, m_borderSystemColor ) }, - { "OptionsButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonEnable ) }, - { "OptionsButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonHightlited ) }, - { "OptionsButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonPushed ) }, - { "OptionsButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_optionsButtonDisabled ) }, - { "IdleWorkerButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonEnable ) }, - { "IdleWorkerButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonHightlited ) }, - { "IdleWorkerButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonPushed ) }, - { "IdleWorkerButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_idleWorkerButtonDisabled ) }, - { "BuddyButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonEnable ) }, - { "BuddyButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonHightlited ) }, - { "BuddyButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonPushed ) }, - { "BuddyButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_buddyButtonDisabled) }, - { "BeaconButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonEnable ) }, - { "BeaconButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonHightlited ) }, - { "BeaconButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonPushed ) }, - { "BeaconButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_beaconButtonDisabled ) }, - { "GenBarButtonIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genBarButtonIn ) }, - { "GenBarButtonOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genBarButtonOn ) }, - { "ToggleButtonUpIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpIn ) }, - { "ToggleButtonUpOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpOn ) }, - { "ToggleButtonUpPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonUpPushed ) }, - { "ToggleButtonDownIn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownIn ) }, - { "ToggleButtonDownOn", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownOn ) }, - { "ToggleButtonDownPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_toggleButtonDownPushed ) }, - - { "GeneralButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonEnable ) }, - { "GeneralButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonHightlited ) }, - { "GeneralButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonPushed ) }, - { "GeneralButtonDisabled", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_generalButtonDisabled ) }, - - { "UAttackButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonEnable ) }, - { "UAttackButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonHightlited ) }, - { "UAttackButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_uAttackButtonPushed ) }, - - { "GenArrow", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_genArrow) }, - - { "MinMaxButtonEnable", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonEnable ) }, - { "MinMaxButtonHightlited", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonHightlited ) }, - { "MinMaxButtonPushed", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_minMaxButtonPushed ) }, - - { "MinMaxUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_minMaxUL ) }, - { "MinMaxLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_minMaxLR ) }, - - { "GeneralUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_generalUL ) }, - { "GeneralLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_generalLR ) }, - - { "UAttackUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_uAttackUL ) }, - { "UAttackLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_uAttackLR ) }, - - { "OptionsUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_optionsUL ) }, - { "OptionsLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_optionsLR ) }, - - { "WorkerUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_workerUL ) }, - { "WorkerLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_workerLR ) }, - - { "ChatUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_chatUL ) }, - { "ChatLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_chatLR ) }, - - { "BeaconUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_beaconUL ) }, - { "BeaconLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_beaconLR ) }, - - { "PowerBarUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_powerBarUL ) }, - { "PowerBarLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_powerBarLR ) }, - - { "MoneyUL", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_moneyUL ) }, - { "MoneyLR", INI::parseICoord2D, NULL, offsetof( ControlBarScheme, m_moneyLR ) }, - - { "CommandMarkerImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_commandMarkerImage) }, - { "ExpBarForegroundImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_expBarForeground) }, - { "PowerPurchaseImage", INI::parseMappedImage, NULL, offsetof( ControlBarScheme, m_powerPurchaseImage) }, - - { NULL, NULL, NULL, 0 } + { "ImagePart", ControlBarSchemeManager::parseImagePart, nullptr, 0 }, + { "AnimatingPart", ControlBarSchemeManager::parseAnimatingPart, nullptr, 0 }, + { "ScreenCreationRes", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_ScreenCreationRes ) }, + { "Side", INI::parseAsciiString, nullptr, offsetof( ControlBarScheme, m_side ) }, + { "QueueButtonImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buttonQueueImage ) }, + { "RightHUDImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_rightHUDImage ) }, + { "BuildUpClockColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_buildUpClockColor ) }, + { "ButtonBorderBuildColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderBuildColor ) }, + { "CommandBarBorderColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_commandBarBorderColor ) }, + { "ButtonBorderActionColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderActionColor ) }, + { "ButtonBorderUpgradeColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderUpgradeColor ) }, + { "ButtonBorderSystemColor", INI::parseColorInt, nullptr, offsetof( ControlBarScheme, m_borderSystemColor ) }, + { "OptionsButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonEnable ) }, + { "OptionsButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonHightlited ) }, + { "OptionsButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonPushed ) }, + { "OptionsButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_optionsButtonDisabled ) }, + { "IdleWorkerButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonEnable ) }, + { "IdleWorkerButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonHightlited ) }, + { "IdleWorkerButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonPushed ) }, + { "IdleWorkerButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_idleWorkerButtonDisabled ) }, + { "BuddyButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonEnable ) }, + { "BuddyButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonHightlited ) }, + { "BuddyButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonPushed ) }, + { "BuddyButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_buddyButtonDisabled) }, + { "BeaconButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonEnable ) }, + { "BeaconButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonHightlited ) }, + { "BeaconButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonPushed ) }, + { "BeaconButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_beaconButtonDisabled ) }, + { "GenBarButtonIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genBarButtonIn ) }, + { "GenBarButtonOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genBarButtonOn ) }, + { "ToggleButtonUpIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpIn ) }, + { "ToggleButtonUpOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpOn ) }, + { "ToggleButtonUpPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonUpPushed ) }, + { "ToggleButtonDownIn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownIn ) }, + { "ToggleButtonDownOn", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownOn ) }, + { "ToggleButtonDownPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_toggleButtonDownPushed ) }, + + { "GeneralButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonEnable ) }, + { "GeneralButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonHightlited ) }, + { "GeneralButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonPushed ) }, + { "GeneralButtonDisabled", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_generalButtonDisabled ) }, + + { "UAttackButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonEnable ) }, + { "UAttackButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonHightlited ) }, + { "UAttackButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_uAttackButtonPushed ) }, + + { "GenArrow", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_genArrow) }, + + { "MinMaxButtonEnable", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonEnable ) }, + { "MinMaxButtonHightlited", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonHightlited ) }, + { "MinMaxButtonPushed", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_minMaxButtonPushed ) }, + + { "MinMaxUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_minMaxUL ) }, + { "MinMaxLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_minMaxLR ) }, + + { "GeneralUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_generalUL ) }, + { "GeneralLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_generalLR ) }, + + { "UAttackUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_uAttackUL ) }, + { "UAttackLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_uAttackLR ) }, + + { "OptionsUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_optionsUL ) }, + { "OptionsLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_optionsLR ) }, + + { "WorkerUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_workerUL ) }, + { "WorkerLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_workerLR ) }, + + { "ChatUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_chatUL ) }, + { "ChatLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_chatLR ) }, + + { "BeaconUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_beaconUL ) }, + { "BeaconLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_beaconLR ) }, + + { "PowerBarUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_powerBarUL ) }, + { "PowerBarLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_powerBarLR ) }, + + { "MoneyUL", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_moneyUL ) }, + { "MoneyLR", INI::parseICoord2D, nullptr, offsetof( ControlBarScheme, m_moneyLR ) }, + + { "CommandMarkerImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_commandMarkerImage) }, + { "ExpBarForegroundImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_expBarForeground) }, + { "PowerPurchaseImage", INI::parseMappedImage, nullptr, offsetof( ControlBarScheme, m_powerPurchaseImage) }, + + { nullptr, nullptr, nullptr, 0 } }; @@ -164,7 +164,7 @@ const FieldParse ControlBarSchemeManager::m_controlBarSchemeFieldParseTable[] = static const LookupListRec AnimTypeNames[] = { { "SLIDE_RIGHT", ControlBarSchemeAnimation::CB_ANIM_SLIDE_RIGHT }, - { NULL, 0 } + { nullptr, 0 } }; static_assert(ARRAY_SIZE(AnimTypeNames) == ControlBarSchemeAnimation::CB_ANIM_MAX + 1, "Incorrect array size"); @@ -178,13 +178,13 @@ ControlBarSchemeImage::ControlBarSchemeImage( void ) m_name.clear(); m_position.x = m_position.y = 0; m_size.x = m_size.y = 0; - m_image = NULL; + m_image = nullptr; m_layer = 0; } ControlBarSchemeImage::~ControlBarSchemeImage( void ) { - m_image = NULL; + m_image = nullptr; } ControlBarSchemeAnimation::ControlBarSchemeAnimation( void ) @@ -193,14 +193,14 @@ ControlBarSchemeAnimation::ControlBarSchemeAnimation( void ) m_finalPos.x = m_finalPos.y = 0; m_name.clear(); m_animType = 0; - m_animImage = NULL; + m_animImage = nullptr; m_startPos.x = m_startPos.y = 0; m_currentFrame = 0; } ControlBarSchemeAnimation::~ControlBarSchemeAnimation( void ) { - m_animImage = NULL; + m_animImage = nullptr; } @@ -234,41 +234,41 @@ void ControlBarScheme::reset(void) m_name.clear(); m_ScreenCreationRes.x = m_ScreenCreationRes.y = 0; m_side.clear(); - m_buttonQueueImage = NULL; - m_rightHUDImage = NULL; - m_optionsButtonEnable = NULL; - m_optionsButtonHightlited = NULL; - m_optionsButtonPushed = NULL; - m_optionsButtonDisabled = NULL; - - m_idleWorkerButtonEnable = NULL; - m_idleWorkerButtonHightlited = NULL; - m_idleWorkerButtonPushed = NULL; - m_idleWorkerButtonDisabled = NULL; - - m_buddyButtonEnable = NULL; - m_buddyButtonHightlited = NULL; - m_buddyButtonPushed = NULL; - m_buddyButtonDisabled = NULL; - - m_beaconButtonEnable = NULL; - m_beaconButtonHightlited = NULL; - m_beaconButtonPushed = NULL; - m_beaconButtonDisabled = NULL; - - m_genBarButtonIn = NULL; - m_genBarButtonOn = NULL; - - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; - - m_commandMarkerImage = NULL; - m_expBarForeground = NULL; - m_powerPurchaseImage = NULL; + m_buttonQueueImage = nullptr; + m_rightHUDImage = nullptr; + m_optionsButtonEnable = nullptr; + m_optionsButtonHightlited = nullptr; + m_optionsButtonPushed = nullptr; + m_optionsButtonDisabled = nullptr; + + m_idleWorkerButtonEnable = nullptr; + m_idleWorkerButtonHightlited = nullptr; + m_idleWorkerButtonPushed = nullptr; + m_idleWorkerButtonDisabled = nullptr; + + m_buddyButtonEnable = nullptr; + m_buddyButtonHightlited = nullptr; + m_buddyButtonPushed = nullptr; + m_buddyButtonDisabled = nullptr; + + m_beaconButtonEnable = nullptr; + m_beaconButtonHightlited = nullptr; + m_beaconButtonPushed = nullptr; + m_beaconButtonDisabled = nullptr; + + m_genBarButtonIn = nullptr; + m_genBarButtonOn = nullptr; + + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; + + m_commandMarkerImage = nullptr; + m_expBarForeground = nullptr; + m_powerPurchaseImage = nullptr; } @@ -286,65 +286,65 @@ ControlBarScheme::ControlBarScheme(void) m_name.clear(); m_ScreenCreationRes.x = m_ScreenCreationRes.y = 0; m_side.clear(); - m_buttonQueueImage = NULL; - m_rightHUDImage = NULL; + m_buttonQueueImage = nullptr; + m_rightHUDImage = nullptr; m_buildUpClockColor = GameMakeColor(0,0,0,100); m_borderBuildColor = GAME_COLOR_UNDEFINED; m_borderActionColor = GAME_COLOR_UNDEFINED; m_borderUpgradeColor = GAME_COLOR_UNDEFINED; m_borderSystemColor = GAME_COLOR_UNDEFINED; //m_buttonQueueImage = TheMappedImageCollection("") - m_optionsButtonEnable = NULL; - m_optionsButtonHightlited = NULL; - m_optionsButtonPushed = NULL; - m_optionsButtonDisabled = NULL; + m_optionsButtonEnable = nullptr; + m_optionsButtonHightlited = nullptr; + m_optionsButtonPushed = nullptr; + m_optionsButtonDisabled = nullptr; m_commandBarBorderColor = 0; - m_idleWorkerButtonEnable = NULL; - m_idleWorkerButtonHightlited = NULL; - m_idleWorkerButtonPushed = NULL; - m_idleWorkerButtonDisabled = NULL; + m_idleWorkerButtonEnable = nullptr; + m_idleWorkerButtonHightlited = nullptr; + m_idleWorkerButtonPushed = nullptr; + m_idleWorkerButtonDisabled = nullptr; - m_buddyButtonEnable = NULL; - m_buddyButtonHightlited = NULL; - m_buddyButtonPushed = NULL; - m_buddyButtonDisabled= NULL; + m_buddyButtonEnable = nullptr; + m_buddyButtonHightlited = nullptr; + m_buddyButtonPushed = nullptr; + m_buddyButtonDisabled= nullptr; - m_beaconButtonEnable = NULL; - m_beaconButtonHightlited = NULL; - m_beaconButtonPushed = NULL; - m_beaconButtonDisabled= NULL; + m_beaconButtonEnable = nullptr; + m_beaconButtonHightlited = nullptr; + m_beaconButtonPushed = nullptr; + m_beaconButtonDisabled= nullptr; - m_genBarButtonIn = NULL; - m_genBarButtonOn = NULL; + m_genBarButtonIn = nullptr; + m_genBarButtonOn = nullptr; - m_toggleButtonUpIn = NULL; - m_toggleButtonUpOn = NULL; - m_toggleButtonUpPushed = NULL; - m_toggleButtonDownIn = NULL; - m_toggleButtonDownOn = NULL; - m_toggleButtonDownPushed = NULL; + m_toggleButtonUpIn = nullptr; + m_toggleButtonUpOn = nullptr; + m_toggleButtonUpPushed = nullptr; + m_toggleButtonDownIn = nullptr; + m_toggleButtonDownOn = nullptr; + m_toggleButtonDownPushed = nullptr; - m_commandMarkerImage = NULL; - m_expBarForeground = NULL; + m_commandMarkerImage = nullptr; + m_expBarForeground = nullptr; - m_powerPurchaseImage = NULL; + m_powerPurchaseImage = nullptr; - m_generalButtonEnable = NULL; - m_generalButtonHightlited = NULL; - m_generalButtonPushed = NULL; - m_generalButtonDisabled = NULL; + m_generalButtonEnable = nullptr; + m_generalButtonHightlited = nullptr; + m_generalButtonPushed = nullptr; + m_generalButtonDisabled = nullptr; - m_uAttackButtonEnable = NULL; - m_uAttackButtonHightlited = NULL; - m_uAttackButtonPushed = NULL; + m_uAttackButtonEnable = nullptr; + m_uAttackButtonHightlited = nullptr; + m_uAttackButtonPushed = nullptr; - m_genArrow = NULL; + m_genArrow = nullptr; - m_minMaxButtonEnable = NULL; - m_minMaxButtonHightlited = NULL; - m_minMaxButtonPushed = NULL; + m_minMaxButtonEnable = nullptr; + m_minMaxButtonHightlited = nullptr; + m_minMaxButtonPushed = nullptr; m_minMaxUL.x = 0; m_minMaxLR.x = 0; @@ -416,12 +416,12 @@ void ControlBarScheme::init(void) TheControlBar->updateUpDownImages(m_toggleButtonUpIn, m_toggleButtonUpOn, m_toggleButtonUpPushed, m_toggleButtonDownIn, m_toggleButtonDownOn, m_toggleButtonDownPushed, m_generalButtonEnable, m_generalButtonHightlited); TheControlBar->setArrowImage( m_genArrow); } - GameWindow *win = NULL; + GameWindow *win = nullptr; Coord2D resMultiplier; resMultiplier.x = TheDisplay->getWidth()/INT_TO_REAL(m_ScreenCreationRes.x) ; resMultiplier.y = TheDisplay->getHeight()/INT_TO_REAL(m_ScreenCreationRes.y); - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) ); if(win) { // DEBUG_ASSERTCRASH(m_buddyButtonEnable, ("No enable button image for communicator in scheme %s!", m_name.str())); @@ -449,7 +449,7 @@ void ControlBarScheme::init(void) win->winSetPosition(x,y ); win->winSetSize((m_chatLR.x - m_chatUL.x)*resMultiplier.x + COMMAND_BAR_SIZE_OFFSET,(m_chatLR.y - m_chatUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_idleWorkerButtonEnable); @@ -476,12 +476,12 @@ void ControlBarScheme::init(void) win->winSetSize((m_workerLR.x - m_workerUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_workerLR.y - m_workerUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) ); if(win) { win->winSetEnabledImage(0, m_expBarForeground); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonOptions" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonOptions" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_optionsButtonEnable); @@ -505,7 +505,7 @@ void ControlBarScheme::init(void) win->winSetPosition(x,y ); win->winSetSize((m_optionsLR.x - m_optionsUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_optionsLR.y - m_optionsUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) ); if(win) { GadgetButtonSetEnabledImage(win, m_beaconButtonEnable); @@ -531,7 +531,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_beaconLR.x - m_beaconUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_beaconLR.y - m_beaconUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) ); if(win) { @@ -553,7 +553,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_moneyLR.x - m_moneyUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_moneyLR.y - m_moneyUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) ); if(win) { @@ -576,7 +576,7 @@ void ControlBarScheme::init(void) DEBUG_LOG(("Power Bar UL X:%d Y:%d LR X:%d Y:%d size X:%d Y:%d",m_powerBarUL.x, m_powerBarUL.y,m_powerBarLR.x, m_powerBarLR.y, (m_powerBarLR.x - m_powerBarUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_powerBarLR.y - m_powerBarUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET )); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) ); if(win) { @@ -603,7 +603,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_generalLR.x - m_generalUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_generalLR.y - m_generalUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonLarge" ) ); if(win) { // The images are set above @@ -629,7 +629,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_minMaxLR.x - m_minMaxUL.x)*resMultiplier.x + COMMAND_BAR_SIZE_OFFSET,(m_minMaxLR.y - m_minMaxUL.y)*resMultiplier.y + COMMAND_BAR_SIZE_OFFSET); } - win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUAttack" ) ); + win= TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:WinUAttack" ) ); if(win) { win->winSetEnabledImage(0,m_uAttackButtonEnable); @@ -653,7 +653,7 @@ void ControlBarScheme::init(void) win->winSetSize((m_uAttackLR.x - m_uAttackUL.x)*resMultiplier.x+ COMMAND_BAR_SIZE_OFFSET,(m_uAttackLR.y - m_uAttackUL.y)*resMultiplier.y+ COMMAND_BAR_SIZE_OFFSET); } - win = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:GenExpParent" ) ); + win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:GenExpParent" ) ); if(win) { win->winSetEnabledImage(0,m_powerPurchaseImage); @@ -818,7 +818,7 @@ void ControlBarScheme::drawBackground( Coord2D multi, ICoord2D offset ) //----------------------------------------------------------------------------- ControlBarSchemeManager::ControlBarSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; m_schemeList.clear(); m_multiplyer.x = m_multiplyer.y = 1; } @@ -838,7 +838,7 @@ ControlBarSchemeManager::~ControlBarSchemeManager( void ) it ++; } m_schemeList.clear(); - m_currentScheme = NULL; + m_currentScheme = nullptr; } @@ -849,11 +849,11 @@ void ControlBarSchemeManager::parseImagePart(INI *ini, void *instance, void* /*s { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, - { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ControlBarSchemeImage, m_image ) }, + { "Layer", INI::parseInt, nullptr, offsetof( ControlBarSchemeImage, m_layer ) }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -869,11 +869,11 @@ void ControlBarSchemeManager::parseAnimatingPartImage(INI *ini, void *instance, { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ControlBarSchemeImage, m_image ) }, - { "Layer", INI::parseInt, NULL, offsetof( ControlBarSchemeImage, m_layer ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ControlBarSchemeImage, m_image ) }, + { "Layer", INI::parseInt, nullptr, offsetof( ControlBarSchemeImage, m_layer ) }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeImage *schemeImage = NEW ControlBarSchemeImage; @@ -889,12 +889,12 @@ void ControlBarSchemeManager::parseAnimatingPart(INI *ini, void *instance, void* { static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( ControlBarSchemeAnimation, m_name ) }, + { "Name", INI::parseAsciiString, nullptr, offsetof( ControlBarSchemeAnimation, m_name ) }, { "Animation", INI::parseLookupList, AnimTypeNames, offsetof( ControlBarSchemeAnimation, m_animType ) }, - { "Duration", INI::parseDurationUnsignedInt, NULL, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, - { "FinalPos", INI::parseICoord2D, NULL, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, - { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Duration", INI::parseDurationUnsignedInt, nullptr, offsetof( ControlBarSchemeAnimation, m_animDuration ) }, + { "FinalPos", INI::parseICoord2D, nullptr, offsetof( ControlBarSchemeAnimation, m_finalPos ) }, + { "ImagePart", ControlBarSchemeManager::parseAnimatingPartImage, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ControlBarSchemeAnimation *schemeAnim = NEW ControlBarSchemeAnimation; @@ -924,7 +924,7 @@ ControlBarScheme *ControlBarSchemeManager::newControlBarScheme( AsciiString name if( !cbScheme || name.isEmpty() ) { DEBUG_ASSERTCRASH(FALSE,("Could not create controlbar %s", name.str())); - return NULL; + return nullptr; } cbScheme->m_name.set( name ); @@ -951,13 +951,13 @@ ControlBarScheme *ControlBarSchemeManager::findControlBarScheme( AsciiString nam if( !CBScheme ) { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList")); - return NULL; + return nullptr; } if(CBScheme->m_name.compareNoCase( name ) == 0) return CBScheme; it ++; } - return NULL; + return nullptr; } // @@ -1010,8 +1010,8 @@ void ControlBarSchemeManager::init( void ) INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ControlBarScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ControlBarScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ControlBarScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ControlBarScheme", INI_LOAD_OVERWRITE, nullptr ); // //Load the user modified control bar schemes // WIN32_FIND_DATA findData; @@ -1020,7 +1020,7 @@ void ControlBarSchemeManager::init( void ) // { // userDataPath.format("%sINI\\ControlBarScheme",TheGlobalData->getPath_UserData().str()); // if (FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) -// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); +// ini.loadFileDirectory(userDataPath, INI_LOAD_OVERWRITE, nullptr ); // } if( m_schemeList.empty() ) { @@ -1047,7 +1047,7 @@ void ControlBarSchemeManager::setControlBarScheme(AsciiString schemeName) else { DEBUG_ASSERTCRASH(FALSE,("There's no ControlBarScheme in the ControlBarSchemeList:m_schemeList")); - m_currentScheme = NULL; + m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); @@ -1095,7 +1095,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT if(side.isEmpty()) side.set("Observer"); DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side", side.str())); - ControlBarScheme *tempScheme = NULL; + ControlBarScheme *tempScheme = nullptr; ControlBarSchemeList::iterator it = m_schemeList.begin(); @@ -1131,7 +1131,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT // well, we couldn't find m_currentScheme = findControlBarScheme("Default"); DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str())); -// m_currentScheme = NULL; +// m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); @@ -1139,7 +1139,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT //----------------------------------------------------------------------------- void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) { - GameWindow *communicatorButton = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("ControlBar.wnd:PopupCommunicator") ); + GameWindow *communicatorButton = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("ControlBar.wnd:PopupCommunicator") ); if (communicatorButton && TheControlBar) { if (TheRecorder->isMultiplayer()) @@ -1163,7 +1163,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) if(side.isEmpty()) side.set("Observer"); DEBUG_LOG(("setControlBarSchemeByPlayer used %s as its side", side.str())); - ControlBarScheme *tempScheme = NULL; + ControlBarScheme *tempScheme = nullptr; ControlBarSchemeList::iterator it = m_schemeList.begin(); @@ -1199,7 +1199,7 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) // well, we couldn't find m_currentScheme = findControlBarScheme("Default"); DEBUG_LOG(("There's no ControlBarScheme with a side of %s", side.str())); -// m_currentScheme = NULL; +// m_currentScheme = nullptr; } if(m_currentScheme) m_currentScheme->init(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index d41a25c3d58..3bece0dc76f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -154,7 +154,7 @@ void ControlBar::populateStructureInventory( Object *building ) setControlCommand( m_commandWindows[ i ], exitCommand ); // Clear any veterancy icon incase the unit leaves! - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL ); + GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); // // if the structure can hold a lesser amount inside it than what the GUI displays // we will completely hide the buttons that can't contain anything diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index b85445884db..79ccbaf6d54 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -49,7 +49,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) { UnicodeString text; static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( NULL, descID ); + GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); // santiy DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); @@ -71,7 +71,7 @@ void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) { // sanity - if( objectUnderConstruction == NULL ) + if( objectUnderConstruction == nullptr ) return; // get our parent window diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp index 6c2ffe60e4a..a2c241e5ada 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp @@ -42,7 +42,7 @@ const char *const DisconnectMenu::m_playerNameTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Name", "DisconnectScreen.wnd:StaticPlayer6Name", "DisconnectScreen.wnd:StaticPlayer7Name", - NULL + nullptr }; const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { @@ -53,7 +53,7 @@ const char *const DisconnectMenu::m_playerTimeoutTextControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Timeout", "DisconnectScreen.wnd:StaticPlayer6Timeout", "DisconnectScreen.wnd:StaticPlayer7Timeout", - NULL + nullptr }; const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { @@ -64,7 +64,7 @@ const char *const DisconnectMenu::m_playerVoteButtonControlNames[] = { "DisconnectScreen.wnd:ButtonKickPlayer5", "DisconnectScreen.wnd:ButtonKickPlayer6", "DisconnectScreen.wnd:ButtonKickPlayer7", - NULL + nullptr }; const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { @@ -75,7 +75,7 @@ const char *const DisconnectMenu::m_playerVoteCountControlNames[] = { "DisconnectScreen.wnd:StaticPlayer5Votes", "DisconnectScreen.wnd:StaticPlayer6Votes", "DisconnectScreen.wnd:StaticPlayer7Votes", - NULL + nullptr }; const char *const DisconnectMenu::m_packetRouterTimeoutControlName = "DisconnectScreen.wnd:StaticPacketRouterTimeout"; @@ -84,17 +84,17 @@ const char *const DisconnectMenu::m_textDisplayControlName = "DisconnectScreen.w static const Color chatNormalColor = GameMakeColor(255,0,0,255); -DisconnectMenu *TheDisconnectMenu = NULL; +DisconnectMenu *TheDisconnectMenu = nullptr; DisconnectMenu::DisconnectMenu() { - m_disconnectManager = NULL; + m_disconnectManager = nullptr; } DisconnectMenu::~DisconnectMenu() { } void DisconnectMenu::init() { - m_disconnectManager = NULL; + m_disconnectManager = nullptr; HideDisconnectWindow(); m_menuState = DISCONNECTMENUSTATETYPE_SCREENOFF; } @@ -118,9 +118,9 @@ void DisconnectMenu::hideScreen() { void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[playerNum]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { if (!name.isEmpty()) { GadgetStaticTextSetText(control, name); // showPlayerControls(playerNum); @@ -128,9 +128,9 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[playerNum]); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { if (!name.isEmpty()) { GadgetStaticTextSetText(control, L""); } @@ -145,7 +145,7 @@ void DisconnectMenu::setPlayerName(Int playerNum, UnicodeString name) { void DisconnectMenu::setPlayerTimeoutTime(Int playerNum, time_t newTime) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[playerNum]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); char str[33]; // itoa uses a max of 33 bytes. itoa(newTime, str, 10); @@ -153,77 +153,77 @@ void DisconnectMenu::setPlayerTimeoutTime(Int playerNum, time_t newTime) { asciiNum.set(str); UnicodeString uninum; uninum.translate(asciiNum); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, uninum); } } void DisconnectMenu::showPlayerControls(Int slot) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteButtonControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); control->winEnable(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(FALSE); } } void DisconnectMenu::hidePlayerControls(Int slot) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerNameTextControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerTimeoutTextControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteButtonControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); control->winEnable(TRUE); } id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - control = TheWindowManager->winGetWindowFromId(NULL, id); - if (control != NULL) { + control = TheWindowManager->winGetWindowFromId(nullptr, id); + if (control != nullptr) { control->winHide(TRUE); } } void DisconnectMenu::showPacketRouterTimeout() { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutLabelControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(FALSE); } id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, L""); // start it off with a blank string. control->winHide(FALSE); } @@ -231,23 +231,23 @@ void DisconnectMenu::showPacketRouterTimeout() { void DisconnectMenu::hidePacketRouterTimeout() { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutLabelControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(TRUE); } id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - control = TheWindowManager->winGetWindowFromId(NULL, id); + control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { control->winHide(TRUE); } } void DisconnectMenu::setPacketRouterTimeoutTime(time_t newTime) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_packetRouterTimeoutControlName); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); char str[33]; // itoa uses a max of 33 bytes. itoa(newTime, str, 10); @@ -255,7 +255,7 @@ void DisconnectMenu::setPacketRouterTimeoutTime(time_t newTime) { asciiNum.set(str); UnicodeString uninum; uninum.translate(asciiNum); - if (control != NULL) { + if (control != nullptr) { GadgetStaticTextSetText(control, uninum); } } @@ -266,9 +266,9 @@ void DisconnectMenu::sendChat(UnicodeString text) { void DisconnectMenu::showChat(UnicodeString text) { NameKeyType displayID = TheNameKeyGenerator->nameToKey(m_textDisplayControlName); - GameWindow *displayControl = TheWindowManager->winGetWindowFromId(NULL, displayID); + GameWindow *displayControl = TheWindowManager->winGetWindowFromId(nullptr, displayID); - if (displayControl != NULL) { + if (displayControl != nullptr) { GadgetListBoxAddEntryText(displayControl, text, chatNormalColor, -1, -1); } } @@ -281,14 +281,14 @@ void DisconnectMenu::removePlayer(Int slot, UnicodeString playerName) { hidePlayerControls(slot); NameKeyType displayID = TheNameKeyGenerator->nameToKey(m_textDisplayControlName); - GameWindow *displayControl = TheWindowManager->winGetWindowFromId(NULL, displayID); + GameWindow *displayControl = TheWindowManager->winGetWindowFromId(nullptr, displayID); UnicodeString text; // UnicodeString name; // name.translate(playerName); text.format(TheGameText->fetch("Network:PlayerLeftGame"), playerName.str()); - if (displayControl != NULL) { + if (displayControl != nullptr) { GadgetListBoxAddEntryText(displayControl, text, chatNormalColor, -1, -1); } } @@ -300,9 +300,9 @@ void DisconnectMenu::voteForPlayer(Int slot) { void DisconnectMenu::updateVotes(Int slot, Int votes) { NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerVoteCountControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, id); - if (control != NULL) { + if (control != nullptr) { char votestr[16]; itoa(votes, votestr, 10); AsciiString asciivotes; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp index 223e4afae78..aace34b1c86 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp @@ -34,7 +34,7 @@ #include "GameClient/GadgetStaticText.h" #include "GameClient/GameText.h" -EstablishConnectionsMenu *TheEstablishConnectionsMenu = NULL; +EstablishConnectionsMenu *TheEstablishConnectionsMenu = nullptr; const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept1", @@ -44,7 +44,7 @@ const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { "EstablishConnectionsScreen.wnd:ButtonAccept5", "EstablishConnectionsScreen.wnd:ButtonAccept6", "EstablishConnectionsScreen.wnd:ButtonAccept7", - NULL}; + nullptr}; const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer1Name", @@ -54,7 +54,7 @@ const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer5Name", "EstablishConnectionsScreen.wnd:StaticPlayer6Name", "EstablishConnectionsScreen.wnd:StaticPlayer7Name", - NULL + nullptr }; const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { @@ -65,7 +65,7 @@ const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { "EstablishConnectionsScreen.wnd:StaticPlayer5Status", "EstablishConnectionsScreen.wnd:StaticPlayer6Status", "EstablishConnectionsScreen.wnd:StaticPlayer7Status", - NULL + nullptr }; /** @@ -107,10 +107,10 @@ void EstablishConnectionsMenu::abortGame() { // the slot number passed in is the index we are to use for the menu. void EstablishConnectionsMenu::setPlayerName(Int slot, UnicodeString name) { NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerNameControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, controlID); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - if (control == NULL) { - DEBUG_ASSERTCRASH(control != NULL, ("player name control for slot %d is NULL", slot)); + if (control == nullptr) { + DEBUG_ASSERTCRASH(control != nullptr, ("player name control for slot %d is null", slot)); return; } GadgetStaticTextSetText(control, name); @@ -118,10 +118,10 @@ void EstablishConnectionsMenu::setPlayerName(Int slot, UnicodeString name) { void EstablishConnectionsMenu::setPlayerStatus(Int slot, NATConnectionState state) { NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerStatusControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(NULL, controlID); + GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - if (control == NULL) { - DEBUG_ASSERTCRASH(control != NULL, ("player status control for slot %d is NULL", slot)); + if (control == nullptr) { + DEBUG_ASSERTCRASH(control != nullptr, ("player status control for slot %d is null", slot)); return; } // if (state == NATCONNECTIONSTATE_NETGEARDELAY) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp index fef643087a1..0e2b20d0627 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp @@ -56,7 +56,7 @@ #include "GameLogic/ScriptEngine.h" //external declarations of the Gadgets the callbacks can use -WindowLayout *popupCommunicatorLayout = NULL; +WindowLayout *popupCommunicatorLayout = nullptr; //------------------------------------------------------------------------------------------------- @@ -276,7 +276,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, { // do the command - TheGameClient->evaluateContextCommand( NULL, &world, CommandTranslator::DO_COMMAND ); + TheGameClient->evaluateContextCommand( nullptr, &world, CommandTranslator::DO_COMMAND ); } else if( command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) @@ -291,7 +291,7 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, } else { - GameMessage *newMsg = NULL; + GameMessage *newMsg = nullptr; // Do the superweapon stuff here, before issuing these other messages @@ -406,7 +406,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, else if( controlID == beaconClearTextButtonID && TheGameLogic->isInMultiplayerGame() ) { static NameKeyType textID = NAMEKEY("ControlBar.wnd:EditBeaconText"); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, textID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, textID); if (win) { GadgetTextEntrySetText( win, UnicodeString::TheEmptyString ); @@ -470,7 +470,7 @@ WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg, { msg->appendWideCharArgument( *c++ ); } - msg->appendWideCharArgument( L'\0' ); // trailing NULL + msg->appendWideCharArgument( L'\0' ); // trailing null terminator } } break; @@ -503,7 +503,7 @@ void ShowControlBar( Bool immediate ) TheControlBar->showSpecialPowerShortcut(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { @@ -538,7 +538,7 @@ void HideControlBar( Bool immediate ) TheControlBar->hideSpecialPowerShortcut(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { @@ -574,7 +574,7 @@ void ToggleControlBar( Bool immediate ) toggleReplayControls(); Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp index 3619dd01bbb..1ecb6250536 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -94,10 +94,10 @@ #include "GameNetwork/NetworkInterface.h" -static WindowLayout *theLayout = NULL; -static GameWindow *theWindow = NULL; -static AnimateWindowManager *theAnimateWindowManager = NULL; -static GameWindow *prevWindow = NULL; +static WindowLayout *theLayout = nullptr; +static GameWindow *theWindow = nullptr; +static AnimateWindowManager *theAnimateWindowManager = nullptr; +static GameWindow *prevWindow = nullptr; static Bool useAnimation = FALSE; void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) { @@ -117,7 +117,7 @@ void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ) if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) { delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; TheControlBar->deleteBuildTooltipLayout(); } } @@ -159,9 +159,9 @@ void ControlBar::showBuildTooltipLayout( GameWindow *cmdButton ) { // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); -// m_buildToolTipLayout = NULL; +// m_buildToolTipLayout = nullptr; m_buildToolTipLayout->hide(TRUE); - prevWindow = NULL; + prevWindow = nullptr; } return; } @@ -216,7 +216,7 @@ void ControlBar::showBuildTooltipLayout( GameWindow *cmdButton ) // we're a generic window if(!BitIsSet(cmdButton->winGetStyle(), GWS_USER_WINDOW) && !BitIsSet(cmdButton->winGetStyle(), GWS_STATIC_TEXT)) return; - populateBuildTooltipLayout(NULL, cmdButton); + populateBuildTooltipLayout(nullptr, cmdButton); } m_buildToolTipLayout->hide(FALSE); @@ -311,7 +311,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, descrip = TheGameText->fetch(commandButton->getDescriptionLabel()); Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - Object *selectedObject = draw ? draw->getObject() : NULL; + Object *selectedObject = draw ? draw->getObject() : nullptr; if( selectedObject ) { //Special case: Append status of overcharge on China power plant. @@ -628,7 +628,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, tempDString->setText(descrip); tempDString->getSize(&newSize.x, &newSize.y); TheDisplayStringManager->freeDisplayString(tempDString); - tempDString = NULL; + tempDString = nullptr; diffSize = newSize.y - size.y; GameWindow *parent = m_buildToolTipLayout->getFirstWindow(); if(!parent) @@ -650,7 +650,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton, // heightChange = controlBarPos.y - m_defaultControlBarPosition.y; - GameWindow *marker = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *marker = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!marker) { @@ -692,16 +692,16 @@ void ControlBar::hideBuildTooltipLayout() void ControlBar::deleteBuildTooltipLayout( void ) { m_showBuildToolTipLayout = FALSE; - prevWindow= NULL; + prevWindow= nullptr; m_buildToolTipLayout->hide(TRUE); // if(!m_buildToolTipLayout) // return; // // m_buildToolTipLayout->destroyWindows(); // deleteInstance(m_buildToolTipLayout); -// m_buildToolTipLayout = NULL; +// m_buildToolTipLayout = nullptr; delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp index da73cce360b..115a315e462 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp @@ -68,27 +68,27 @@ static NameKeyType buttonMuteID[MAX_SLOTS]; static NameKeyType buttonUnMuteID[MAX_SLOTS]; static NameKeyType radioButtonInGameID = NAMEKEY_INVALID; static NameKeyType radioButtonBuddiesID = NAMEKEY_INVALID; -static GameWindow *radioButtonInGame = NULL; -static GameWindow *radioButtonBuddies = NULL; +static GameWindow *radioButtonInGame = nullptr; +static GameWindow *radioButtonBuddies = nullptr; static NameKeyType winInGameID = NAMEKEY_INVALID; static NameKeyType winBuddiesID = NAMEKEY_INVALID; static NameKeyType winSoloID = NAMEKEY_INVALID; -static GameWindow *winInGame = NULL; -static GameWindow *winBuddies = NULL; -static GameWindow *winSolo = NULL; -static GameWindow *staticTextPlayer[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextSide[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextTeam[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *staticTextStatus[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *buttonMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; -static GameWindow *buttonUnMute[MAX_SLOTS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static GameWindow *winInGame = nullptr; +static GameWindow *winBuddies = nullptr; +static GameWindow *winSolo = nullptr; +static GameWindow *staticTextPlayer[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextSide[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextTeam[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *staticTextStatus[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *buttonMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; +static GameWindow *buttonUnMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; static Int slotNumInRow[MAX_SLOTS]; //------------------------------------------------------------------------------------------------- -static WindowLayout *theLayout = NULL; -static GameWindow *theWindow = NULL; -static AnimateWindowManager *theAnimateWindowManager = NULL; +static WindowLayout *theLayout = nullptr; +static GameWindow *theWindow = nullptr; +static AnimateWindowManager *theAnimateWindowManager = nullptr; WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2); void InitBuddyControls(Int type); @@ -126,12 +126,12 @@ static void releaseWindowPointers( void ) { for (Int i=0; inameToKey("Diplomacy.wnd:RadioButtonInGame"); radioButtonBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonBuddies"); - radioButtonInGame = TheWindowManager->winGetWindowFromId(NULL, radioButtonInGameID); - radioButtonBuddies = TheWindowManager->winGetWindowFromId(NULL, radioButtonBuddiesID); + radioButtonInGame = TheWindowManager->winGetWindowFromId(nullptr, radioButtonInGameID); + radioButtonBuddies = TheWindowManager->winGetWindowFromId(nullptr, radioButtonBuddiesID); winInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:InGameParent"); winBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:BuddiesParent"); winSoloID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:SoloParent"); - winInGame = TheWindowManager->winGetWindowFromId(NULL, winInGameID); - winBuddies = TheWindowManager->winGetWindowFromId(NULL, winBuddiesID); - winSolo = TheWindowManager->winGetWindowFromId(NULL, winSoloID); + winInGame = TheWindowManager->winGetWindowFromId(nullptr, winInGameID); + winBuddies = TheWindowManager->winGetWindowFromId(nullptr, winBuddiesID); + winSolo = TheWindowManager->winGetWindowFromId(nullptr, winSoloID); if (!TheRecorder->isMultiplayer()) { @@ -287,12 +287,12 @@ void ResetDiplomacy( void ) theLayout->destroyWindows(); deleteInstance(theLayout); InitBuddyControls(-1); - theLayout = NULL; + theLayout = nullptr; } - theWindow = NULL; + theWindow = nullptr; delete theAnimateWindowManager; - theAnimateWindowManager = NULL; + theAnimateWindowManager = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -466,10 +466,10 @@ void PopulateInGameDiplomacyPopup( void ) if (slot && slot->isOccupied()) { Bool isInGame = false; - // Note - for skirmish, TheNetwork == NULL. jba. + // Note - for skirmish, TheNetwork == nullptr. jba. if (TheNetwork && TheNetwork->isPlayerConnected(slotNum)) { isInGame = true; - } else if ((TheNetwork == NULL) && slot->isHuman()) { + } else if ((TheNetwork == nullptr) && slot->isHuman()) { // this is a skirmish game and it is the human player. isInGame = true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp index ec5c383e37e..a858dae4aad 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp @@ -59,12 +59,12 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne // first check to make sure we have some buttons to display if(buttonFlags == 0 ) { - return NULL; + return nullptr; } GameWindow *parent = TheWindowManager->winCreateFromScript( "Menus/MessageBox.wnd" ); TheWindowManager->winSetModal( parent ); - TheWindowManager->winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + TheWindowManager->winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves TheWindowManager->winSetFocus( parent ); // If the user wants the size to be different then the default @@ -191,31 +191,31 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, NULL, NULL); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, nullptr, nullptr); } GameWindow *ExMessageBoxYesNoCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc yesCallback, MessageBoxFunc noCallback, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, NULL, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, nullptr, cancelCallback); } GameWindow *ExMessageBoxOkCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc okCallback, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, NULL, NULL, okCallback, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, nullptr, nullptr, okCallback, cancelCallback); } GameWindow *ExMessageBoxOk (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc okCallback) { - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, NULL, NULL, okCallback, NULL); + return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, nullptr, nullptr, okCallback, nullptr); } GameWindow *ExMessageBoxCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, MessageBoxFunc cancelCallback) { - return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, NULL, NULL, NULL, cancelCallback); + return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, nullptr, nullptr, nullptr, cancelCallback); } @@ -239,7 +239,7 @@ WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { delete (WindowExMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp index feb813c857e..9cc92034e23 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp @@ -74,7 +74,7 @@ WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg //Get rid of any building placement mode! if( TheInGameUI ) { - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index fee4cf69aeb..8648fb28a34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -40,7 +40,7 @@ Int IMECandidateWindowLineSpacing = 2; -static DisplayString *Dstring = NULL; +static DisplayString *Dstring = nullptr; //------------------------------------------------------------------------------------------------- /** Input procedure for the candidate window */ @@ -62,7 +62,7 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m switch( msg ) { case GWM_CREATE: - if ( Dstring == NULL ) + if ( Dstring == nullptr ) { Dstring = TheDisplayStringManager->newDisplayString(); } @@ -70,10 +70,10 @@ WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: - if ( Dstring != NULL ) + if ( Dstring != nullptr ) { TheDisplayStringManager->freeDisplayString( Dstring ); - Dstring = NULL; + Dstring = nullptr; } break; @@ -152,14 +152,14 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) start.x, start.y, end.x, end.y ); } - if ( Dstring == NULL ) + if ( Dstring == nullptr ) { return; } IMEManagerInterface *ime = (IMEManagerInterface*)window->winGetUserData(); - if ( ime == NULL ) + if ( ime == nullptr ) { return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp index 09336b14179..1f21323ade1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -46,9 +46,9 @@ #include "GameNetwork/GameInfo.h" #include "GameNetwork/NetworkInterface.h" -static GameWindow *chatWindow = NULL; -static GameWindow *chatTextEntry = NULL; -static GameWindow *chatTypeStaticText = NULL; +static GameWindow *chatWindow = nullptr; +static GameWindow *chatTextEntry = nullptr; +static GameWindow *chatTypeStaticText = nullptr; static UnicodeString s_savedChat; static InGameChatType inGameChatType; @@ -79,11 +79,11 @@ void ShowInGameChat( Bool immediate ) chatWindow = TheWindowManager->winCreateFromScript( "InGameChat.wnd" ); static NameKeyType textEntryChatID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:TextEntryChat" ); - chatTextEntry = TheWindowManager->winGetWindowFromId( NULL, textEntryChatID ); + chatTextEntry = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); static NameKeyType chatTypeStaticTextID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:StaticTextChatType" ); - chatTypeStaticText = TheWindowManager->winGetWindowFromId( NULL, chatTypeStaticTextID ); + chatTypeStaticText = TheWindowManager->winGetWindowFromId( nullptr, chatTypeStaticTextID ); } TheWindowManager->winSetFocus( chatTextEntry ); SetInGameChatType( INGAME_CHAT_EVERYONE ); @@ -95,9 +95,9 @@ void ResetInGameChat( void ) { if(chatWindow) TheWindowManager->winDestroy( chatWindow ); - chatWindow = NULL; - chatTextEntry = NULL; - chatTypeStaticText = NULL; + chatWindow = nullptr; + chatTextEntry = nullptr; + chatTypeStaticText = nullptr; s_savedChat.clear(); } @@ -112,9 +112,9 @@ void HideInGameChat( Bool immediate ) chatWindow->winEnable(FALSE); chatTextEntry->winHide(TRUE); chatTextEntry->winEnable(FALSE); - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } - TheWindowManager->winSetFocus( NULL ); + TheWindowManager->winSetFocus( nullptr ); } // ------------------------------------------------------------------------------------------------ @@ -145,7 +145,7 @@ void SetInGameChatType( InGameChatType chatType ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ Bool IsInGameChatActive() { - if (chatWindow != NULL) { + if (chatWindow != nullptr) { if (chatWindow->winIsHidden() == FALSE) { return TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp index 25726ad39cb..8782368c136 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp @@ -73,9 +73,9 @@ static NameKeyType staticTextMessageID = NAMEKEY_INVALID; static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *staticTextMessage = NULL; -static GameWindow *buttonOk = NULL; +static GameWindow *parent = nullptr; +static GameWindow *staticTextMessage = nullptr; +static GameWindow *buttonOk = nullptr; static Bool pause = FALSE; @@ -90,7 +90,7 @@ void InGamePopupMessageInit( WindowLayout *layout, void *userData ) { parentID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:InGamePopupMessageParent"); - parent = TheWindowManager->winGetWindowFromId(NULL, parentID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); staticTextMessageID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:StaticTextMessage"); staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp index 8a7ca7b216d..067e5bcffc0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp @@ -56,7 +56,7 @@ #include "GameLogic/ScriptEngine.h" -SkirmishGameInfo *TheChallengeGameInfo = NULL; +SkirmishGameInfo *TheChallengeGameInfo = nullptr; // defines static const Int DEFAULT_GENERAL = 0; @@ -76,21 +76,21 @@ static NameKeyType backdropID = NAMEKEY_INVALID; static NameKeyType bioParentID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMenu = NULL; -static GameWindow *buttonPlay = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *bioPortrait = NULL; -static GameWindow *bioLine1Entry = NULL; -static GameWindow *bioLine2Entry = NULL; -static GameWindow *bioLine3Entry = NULL; -static GameWindow *bioLine4Entry = NULL; -static GameWindow *buttonGeneralPosition[NUM_GENERALS] = {NULL}; -static GameWindow *backdrop = NULL; -static GameWindow *bioParent = NULL; +static GameWindow *parentMenu = nullptr; +static GameWindow *buttonPlay = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *bioPortrait = nullptr; +static GameWindow *bioLine1Entry = nullptr; +static GameWindow *bioLine2Entry = nullptr; +static GameWindow *bioLine3Entry = nullptr; +static GameWindow *bioLine4Entry = nullptr; +static GameWindow *buttonGeneralPosition[NUM_GENERALS] = {nullptr}; +static GameWindow *backdrop = nullptr; +static GameWindow *bioParent = nullptr; //static NameKeyType testWinID = NAMEKEY_INVALID; -//static GameWindow *testWin = NULL; -static WindowVideoManager *wndVideoManager = NULL; +//static GameWindow *testWin = nullptr; +static WindowVideoManager *wndVideoManager = nullptr; // static Int initialGadgetDelay = 2; @@ -117,8 +117,8 @@ Int bioTotalLength = 0; static Int buttonSequenceStep = 0; // audio -AudioHandle lastSelectionSound = NULL; -AudioHandle lastPreviewSound = NULL; +AudioHandle lastSelectionSound = 0; +AudioHandle lastPreviewSound = 0; static Int introAudioMagicNumber = 0; static Bool hasPlayedIntroAudio = FALSE; @@ -339,7 +339,7 @@ void ChallengeMenuInit( WindowLayout *layout, void *userData ) // init window ids and pointers parentID = TheNameKeyGenerator->nameToKey( "ChallengeMenu.wnd:ParentChallengeMenu" ); - parentMenu = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parentMenu = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonPlayID = TheNameKeyGenerator->nameToKey( "ChallengeMenu.wnd:ButtonPlay" ); buttonPlay = TheWindowManager->winGetWindowFromId( parentMenu, buttonPlayID ); buttonBackID = TheNameKeyGenerator->nameToKey( "ChallengeMenu.wnd:ButtonBack" ); @@ -385,7 +385,7 @@ void ChallengeMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( parentMenu ); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *winGadgetParent = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ChallengeMenu.wnd:GadgetParent")); + GameWindow *winGadgetParent = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ChallengeMenu.wnd:GadgetParent")); if(winGadgetParent) winGadgetParent->winHide(TRUE); isShuttingDown = FALSE; @@ -394,8 +394,8 @@ void ChallengeMenuInit( WindowLayout *layout, void *userData ) wndVideoManager = NEW WindowVideoManager; wndVideoManager->init(); - lastSelectionSound = NULL; - lastPreviewSound = NULL; + lastSelectionSound = 0; + lastPreviewSound = 0; hasPlayedIntroAudio = FALSE; } @@ -455,7 +455,7 @@ void ChallengeMenuUpdate( WindowLayout *layout, void *userData ) void ChallengeMenuShutdown( WindowLayout *layout, void *userData ) { delete wndVideoManager; - wndVideoManager = NULL; + wndVideoManager = nullptr; lastButtonIndex = -1; @@ -473,12 +473,12 @@ void ChallengeMenuShutdown( WindowLayout *layout, void *userData ) isShuttingDown = TRUE; delete TheChallengeGameInfo; - TheChallengeGameInfo = NULL; + TheChallengeGameInfo = nullptr; TheAudio->removeAudioEvent( lastSelectionSound ); TheAudio->removeAudioEvent( lastPreviewSound ); - lastSelectionSound = NULL; - lastPreviewSound = NULL; + lastSelectionSound = 0; + lastPreviewSound = 0; introAudioMagicNumber = 0; } @@ -616,7 +616,7 @@ WindowMsgHandledType ChallengeMenuSystem( GameWindow *window, UnsignedInt msg, W if (lastButtonIndex != -1) { isAutoSelecting = TRUE; - GameWindow *lastControl = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralPositionID[lastButtonIndex]); + GameWindow *lastControl = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralPositionID[lastButtonIndex]); GadgetCheckBoxToggle(lastControl); } @@ -644,9 +644,9 @@ WindowMsgHandledType ChallengeMenuSystem( GameWindow *window, UnsignedInt msg, W } else if( controlID == buttonPlayID ) { - if( TheChallengeGameInfo == NULL ) + if( TheChallengeGameInfo == nullptr ) { - // If this is NULL, then we must be on the way back out of this menu. + // If this is null, then we must be on the way back out of this menu. // Don't crash, just eat the button click message. return MSG_HANDLED; } @@ -657,7 +657,7 @@ WindowMsgHandledType ChallengeMenuSystem( GameWindow *window, UnsignedInt msg, W // turn off the last button so the screen will be pristine when the user returns isAutoSelecting = TRUE; - GameWindow *lastControl = TheWindowManager->winGetWindowFromId( NULL, buttonGeneralPositionID[lastButtonIndex]); + GameWindow *lastControl = TheWindowManager->winGetWindowFromId( nullptr, buttonGeneralPositionID[lastButtonIndex]); GadgetCheckBoxSetChecked(lastControl, FALSE); lastButtonIndex = -1; // introAudioHasPlayed = FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp index 3a0087ded97..3d83d0d91e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp @@ -69,7 +69,7 @@ static NameKeyType parentMainMenuID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMainMenu = NULL; +static GameWindow *parentMainMenu = nullptr; //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ void CreditsMenuInit( WindowLayout *layout, void *userData ) TheCredits->init(); parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" ); - parentMainMenu = TheWindowManager->winGetWindowFromId( NULL, parentMainMenuID ); + parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID ); // show menu @@ -113,7 +113,7 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData ) { TheCredits->reset(); delete TheCredits; - TheCredits = NULL; + TheCredits = nullptr; TheShell->showShellMap(TRUE); // hide menu diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp index 4e8d80624a0..b2c3d41dd19 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -68,15 +68,15 @@ //----------------------------------------------------------------------------- static GameDifficulty s_AIDiff = DIFFICULTY_NORMAL; static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow * buttonOk = NULL; +static GameWindow * buttonOk = nullptr; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow * buttonCancel = NULL; +static GameWindow * buttonCancel = nullptr; static NameKeyType radioButtonEasyAIID = NAMEKEY_INVALID; static NameKeyType radioButtonMediumAIID = NAMEKEY_INVALID; static NameKeyType radioButtonHardAIID = NAMEKEY_INVALID; -static GameWindow * radioButtonEasyAI = NULL; -static GameWindow * radioButtonMediumAI = NULL; -static GameWindow * radioButtonHardAI = NULL; +static GameWindow * radioButtonEasyAI = nullptr; +static GameWindow * radioButtonMediumAI = nullptr; +static GameWindow * radioButtonHardAI = nullptr; void setupGameStart(AsciiString mapName, GameDifficulty diff); //----------------------------------------------------------------------------- @@ -126,7 +126,7 @@ static void SetDifficultyRadioButton( void ) void DifficultySelectInit( WindowLayout *layout, void *userData ) { NameKeyType parentID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:DifficultySelectParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonOkID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonOk" ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); @@ -144,7 +144,7 @@ void DifficultySelectInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent // AsciiString parentName( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); // NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); -// parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); +// parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); // // TheWindowManager->winSetFocus( parent ); // diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp index c0b7f7097cb..a87aa0fb176 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp @@ -46,11 +46,11 @@ static WindowLayout *disconnectMenuLayout; static NameKeyType textEntryID = NAMEKEY_INVALID; static NameKeyType textDisplayID = NAMEKEY_INVALID; -static GameWindow *textEntryWindow = NULL; -static GameWindow *textDisplayWindow = NULL; +static GameWindow *textEntryWindow = nullptr; +static GameWindow *textDisplayWindow = nullptr; static NameKeyType buttonQuitID = NAMEKEY_INVALID; -static GameWindow *buttonQuitWindow = NULL; +static GameWindow *buttonQuitWindow = nullptr; static NameKeyType buttonVotePlayer1ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer2ID = NAMEKEY_INVALID; @@ -60,28 +60,28 @@ static NameKeyType buttonVotePlayer5ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer6ID = NAMEKEY_INVALID; static NameKeyType buttonVotePlayer7ID = NAMEKEY_INVALID; -static GameWindow *buttonVotePlayer1Window = NULL; -static GameWindow *buttonVotePlayer2Window = NULL; -static GameWindow *buttonVotePlayer3Window = NULL; -static GameWindow *buttonVotePlayer4Window = NULL; -static GameWindow *buttonVotePlayer5Window = NULL; -static GameWindow *buttonVotePlayer6Window = NULL; -static GameWindow *buttonVotePlayer7Window = NULL; +static GameWindow *buttonVotePlayer1Window = nullptr; +static GameWindow *buttonVotePlayer2Window = nullptr; +static GameWindow *buttonVotePlayer3Window = nullptr; +static GameWindow *buttonVotePlayer4Window = nullptr; +static GameWindow *buttonVotePlayer5Window = nullptr; +static GameWindow *buttonVotePlayer6Window = nullptr; +static GameWindow *buttonVotePlayer7Window = nullptr; static void InitDisconnectWindow( void ) { textEntryID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:TextEntry"); textDisplayID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ListboxTextDisplay"); - textEntryWindow = TheWindowManager->winGetWindowFromId(NULL, textEntryID); - textDisplayWindow = TheWindowManager->winGetWindowFromId(NULL, textDisplayID); + textEntryWindow = TheWindowManager->winGetWindowFromId(nullptr, textEntryID); + textDisplayWindow = TheWindowManager->winGetWindowFromId(nullptr, textDisplayID); - if (textEntryWindow != NULL) { + if (textEntryWindow != nullptr) { GadgetTextEntrySetText(textEntryWindow, UnicodeString::TheEmptyString); TheWindowManager->winSetFocus(textEntryWindow); } buttonQuitID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonQuitGame"); - buttonQuitWindow = TheWindowManager->winGetWindowFromId(NULL, buttonQuitID); + buttonQuitWindow = TheWindowManager->winGetWindowFromId(nullptr, buttonQuitID); buttonVotePlayer1ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer1"); buttonVotePlayer2ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer2"); @@ -91,13 +91,13 @@ static void InitDisconnectWindow( void ) { buttonVotePlayer6ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer6"); buttonVotePlayer7ID = TheNameKeyGenerator->nameToKey( "DisconnectScreen.wnd:ButtonKickPlayer7"); - buttonVotePlayer1Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer1ID); - buttonVotePlayer2Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer2ID); - buttonVotePlayer3Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer3ID); - buttonVotePlayer4Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer4ID); - buttonVotePlayer5Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer5ID); - buttonVotePlayer6Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer6ID); - buttonVotePlayer7Window = TheWindowManager->winGetWindowFromId(NULL, buttonVotePlayer7ID); + buttonVotePlayer1Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer1ID); + buttonVotePlayer2Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer2ID); + buttonVotePlayer3Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer3ID); + buttonVotePlayer4Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer4ID); + buttonVotePlayer5Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer5ID); + buttonVotePlayer6Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer6ID); + buttonVotePlayer7Window = TheWindowManager->winGetWindowFromId(nullptr, buttonVotePlayer7ID); } //------------------------------------------------------ @@ -107,7 +107,7 @@ void ShowDisconnectWindow( void ) { // load the quit menu from the layout file if needed - if( disconnectMenuLayout == NULL ) + if( disconnectMenuLayout == nullptr ) { // load layout from disk @@ -150,7 +150,7 @@ void HideDisconnectWindow( void ) { // load the quit menu from the layout file if needed - if( disconnectMenuLayout == NULL ) + if( disconnectMenuLayout == nullptr ) { // load layout from disk diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp index 61a4e89ee71..f40010e506e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp @@ -68,13 +68,13 @@ static NameKeyType staticTextFileID = NAMEKEY_INVALID; static NameKeyType staticTextStatusID = NAMEKEY_INVALID; static NameKeyType progressBarMunkeeID = NAMEKEY_INVALID; -static GameWindow * staticTextSize = NULL; -static GameWindow * staticTextTime = NULL; -static GameWindow * staticTextFile = NULL; -static GameWindow * staticTextStatus = NULL; -static GameWindow * progressBarMunkee = NULL; +static GameWindow * staticTextSize = nullptr; +static GameWindow * staticTextTime = nullptr; +static GameWindow * staticTextFile = nullptr; +static GameWindow * staticTextStatus = nullptr; +static GameWindow * progressBarMunkee = nullptr; -static GameWindow *parent = NULL; +static GameWindow *parent = nullptr; static void closeDownloadWindow( void ) { @@ -88,10 +88,10 @@ static void closeDownloadWindow( void ) menuLayout->runShutdown(); menuLayout->destroyWindows(); deleteInstance(menuLayout); - menuLayout = NULL; + menuLayout = nullptr; } - GameWindow *mainWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("MainMenu.wnd:MainMenuParent") ); + GameWindow *mainWin = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("MainMenu.wnd:MainMenuParent") ); if (mainWin) TheWindowManager->winSetFocus( mainWin ); } @@ -135,7 +135,7 @@ class DownloadManagerMunkee : public DownloadManager HRESULT DownloadManagerMunkee::downloadFile( AsciiString server, AsciiString username, AsciiString password, AsciiString file, AsciiString localfile, AsciiString regkey, Bool tryResume ) { // see if we'll need to restart - if (strstr(localfile.str(), "patches\\") != NULL) + if (strstr(localfile.str(), "patches\\") != nullptr) { m_shouldQuitOnSuccess = true; } @@ -203,7 +203,7 @@ HRESULT DownloadManagerMunkee::OnProgressUpdate( Int bytesread, Int totalsize, I timeLeft = timeleft; if (staticTextTime && GadgetStaticTextGetText(staticTextTime).isEmpty()) // only update immediately the first time { - lastUpdate = time(NULL); + lastUpdate = time(nullptr); UnicodeString timeString; if (timeleft) { @@ -245,7 +245,7 @@ void DownloadMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("DownloadMenu.wnd:ParentDownload"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); // get ids for our children controls buttonCancelID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); @@ -276,14 +276,14 @@ void DownloadMenuShutdown( WindowLayout *layout, void *userData ) DEBUG_ASSERTCRASH(TheDownloadManager, ("No download manager")); delete TheDownloadManager; - TheDownloadManager = NULL; + TheDownloadManager = nullptr; - staticTextSize = NULL; - staticTextTime = NULL; - staticTextFile = NULL; - staticTextStatus = NULL; - progressBarMunkee = NULL; - parent = NULL; + staticTextSize = nullptr; + staticTextTime = nullptr; + staticTextFile = nullptr; + staticTextStatus = nullptr; + progressBarMunkee = nullptr; + parent = nullptr; } @@ -294,7 +294,7 @@ void DownloadMenuUpdate( WindowLayout *layout, void *userData ) { if (staticTextTime && !GadgetStaticTextGetText(staticTextTime).isEmpty()) { - time_t now = time(NULL); + time_t now = time(nullptr); if (now <= lastUpdate) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp index c3c10fa3f65..2ae75b2f54f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp @@ -51,22 +51,22 @@ static NameKeyType staticPlayer5StatusID = NAMEKEY_INVALID; static NameKeyType staticPlayer6StatusID = NAMEKEY_INVALID; static NameKeyType staticPlayer7StatusID = NAMEKEY_INVALID; -static GameWindow *buttonQuitWindow = NULL; -static GameWindow *staticPlayer1Name = NULL; -static GameWindow *staticPlayer2Name = NULL; -static GameWindow *staticPlayer3Name = NULL; -static GameWindow *staticPlayer4Name = NULL; -static GameWindow *staticPlayer5Name = NULL; -static GameWindow *staticPlayer6Name = NULL; -static GameWindow *staticPlayer7Name = NULL; - -static GameWindow *staticPlayer1Status = NULL; -static GameWindow *staticPlayer2Status = NULL; -static GameWindow *staticPlayer3Status = NULL; -static GameWindow *staticPlayer4Status = NULL; -static GameWindow *staticPlayer5Status = NULL; -static GameWindow *staticPlayer6Status = NULL; -static GameWindow *staticPlayer7Status = NULL; +static GameWindow *buttonQuitWindow = nullptr; +static GameWindow *staticPlayer1Name = nullptr; +static GameWindow *staticPlayer2Name = nullptr; +static GameWindow *staticPlayer3Name = nullptr; +static GameWindow *staticPlayer4Name = nullptr; +static GameWindow *staticPlayer5Name = nullptr; +static GameWindow *staticPlayer6Name = nullptr; +static GameWindow *staticPlayer7Name = nullptr; + +static GameWindow *staticPlayer1Status = nullptr; +static GameWindow *staticPlayer2Status = nullptr; +static GameWindow *staticPlayer3Status = nullptr; +static GameWindow *staticPlayer4Status = nullptr; +static GameWindow *staticPlayer5Status = nullptr; +static GameWindow *staticPlayer6Status = nullptr; +static GameWindow *staticPlayer7Status = nullptr; static const char *layoutFilename = "GameSpyGameOptionsMenu.wnd"; static const char *parentName = "GameSpyGameOptionsMenuParent"; @@ -82,7 +82,7 @@ static const char *gadgetsToHide[] = "ButtonSelectMap", "ButtonStart", "StaticTextMapPreview", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -93,7 +93,7 @@ static const char *perPlayerGadgetsToHide[] = "ButtonAccept", "GenericPing", //"ButtonStartPosition", - NULL + nullptr }; static const char *qmlayoutFilename = "WOLQuickMatchMenu.wnd"; @@ -107,12 +107,12 @@ static const char *qmgadgetsToHide[] = "ButtonWiden", "ButtonStop", "ButtonStart", - NULL + nullptr }; static const char *qmperPlayerGadgetsToHide[] = { //"ButtonStartPosition", - NULL + nullptr }; static void showGameSpyGameOptionsUnderlyingGUIElements( Bool show ) @@ -127,11 +127,11 @@ static void showGameSpyQMUnderlyingGUIElements( Bool show ) static void InitEstablishConnectionsDialog( void ) { buttonQuitID = TheNameKeyGenerator->nameToKey( "EstablishConnectionsScreen.wnd:ButtonQuit" ); - buttonQuitWindow = TheWindowManager->winGetWindowFromId(NULL, buttonQuitID); + buttonQuitWindow = TheWindowManager->winGetWindowFromId(nullptr, buttonQuitID); } void ShowEstablishConnectionsWindow( void ) { - if (establishConnectionsLayout == NULL) { + if (establishConnectionsLayout == nullptr) { establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); InitEstablishConnectionsDialog(); } @@ -148,7 +148,7 @@ void ShowEstablishConnectionsWindow( void ) { } void HideEstablishConnectionsWindow( void ) { - if (establishConnectionsLayout == NULL) { + if (establishConnectionsLayout == nullptr) { // establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); // InitEstablishConnectionsDialog(); return; @@ -158,7 +158,7 @@ void HideEstablishConnectionsWindow( void ) { // TheWindowManager->winDestroy(establishConnectionsLayout); establishConnectionsLayout->destroyWindows(); deleteInstance(establishConnectionsLayout); - establishConnectionsLayout = NULL; + establishConnectionsLayout = nullptr; if (!TheGameSpyGame->isQMGame()) { showGameSpyGameOptionsUnderlyingGUIElements(TRUE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp index 3286091c8e8..287808684bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp @@ -45,13 +45,13 @@ #include "GameNetwork/LANAPI.h" -static GameWindow *parent = NULL; -static GameWindow *staticTextGameName = NULL; -static GameWindow *staticTextMapName = NULL; -static GameWindow *listBoxPlayers = NULL; -static GameWindow *winCrates = NULL; -static GameWindow *winSuperWeapons = NULL; -static GameWindow *winFreeForAll = NULL; +static GameWindow *parent = nullptr; +static GameWindow *staticTextGameName = nullptr; +static GameWindow *staticTextMapName = nullptr; +static GameWindow *listBoxPlayers = nullptr; +static GameWindow *winCrates = nullptr; +static GameWindow *winSuperWeapons = nullptr; +static GameWindow *winFreeForAll = nullptr; static NameKeyType parentID = NAMEKEY_INVALID; static NameKeyType staticTextGameNameID = NAMEKEY_INVALID; @@ -61,7 +61,7 @@ static NameKeyType winCratesID = NAMEKEY_INVALID; static NameKeyType winSuperWeaponsID = NAMEKEY_INVALID; static NameKeyType winFreeForAllID = NAMEKEY_INVALID; -static WindowLayout *gameInfoWindowLayout = NULL; +static WindowLayout *gameInfoWindowLayout = nullptr; // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// void CreateLANGameInfoWindow( GameWindow *sizeAndPosWin ) @@ -90,7 +90,7 @@ void DestroyGameInfoWindow(void) { gameInfoWindowLayout->destroyWindows(); deleteInstance(gameInfoWindowLayout); - gameInfoWindowLayout = NULL; + gameInfoWindowLayout = nullptr; } } @@ -222,7 +222,7 @@ void GameInfoWindowInit( WindowLayout *layout, void *userData ) winSuperWeaponsID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinSuperWeapons" ); winFreeForAllID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinFreeForAll" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); staticTextGameName = TheWindowManager->winGetWindowFromId( parent, staticTextGameNameID ); staticTextMapName = TheWindowManager->winGetWindowFromId( parent, staticTextMapNameID ); listBoxPlayers = TheWindowManager->winGetWindowFromId( parent, listBoxPlayersID ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index 0c466741cc5..5d2353454a2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -73,31 +73,31 @@ WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg WindowMsgData mData1, WindowMsgData mData2 ); static NameKeyType buttonBackID = NAMEKEY_INVALID; -static GameWindow *buttonBack = NULL; +static GameWindow *buttonBack = nullptr; static NameKeyType parentKeyboardOptionsMenuID = NAMEKEY_INVALID; -static GameWindow *parentKeyboardOptionsMenu = NULL; +static GameWindow *parentKeyboardOptionsMenu = nullptr; static NameKeyType comboBoxCategoryListID = NAMEKEY_INVALID; -static GameWindow *comboBoxCategoryList = NULL; +static GameWindow *comboBoxCategoryList = nullptr; static NameKeyType listBoxCommandListID = NAMEKEY_INVALID; -static GameWindow *listBoxCommandList = NULL; +static GameWindow *listBoxCommandList = nullptr; static NameKeyType staticTextDescriptionID = NAMEKEY_INVALID; -static GameWindow *staticTextDescription = NULL; +static GameWindow *staticTextDescription = nullptr; static NameKeyType staticTextCurrentHotkeyID = NAMEKEY_INVALID; -static GameWindow *staticTextCurrentHotkey = NULL; +static GameWindow *staticTextCurrentHotkey = nullptr; static NameKeyType buttonResetAllID = NAMEKEY_INVALID; -static GameWindow *buttonResetAll = NULL; +static GameWindow *buttonResetAll = nullptr; static NameKeyType textEntryAssignHotkeyID = NAMEKEY_INVALID; -static GameWindow *textEntryAssignHotkey = NULL; +static GameWindow *textEntryAssignHotkey = nullptr; static NameKeyType buttonAssignID = NAMEKEY_INVALID; -static GameWindow *buttonAssign = NULL; +static GameWindow *buttonAssign = nullptr; //use Bools to test if modifiers are used @@ -392,32 +392,32 @@ void KeyboardOptionsMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent parentKeyboardOptionsMenuID = TheNameKeyGenerator->nameToKey("KeyboardOptionsMenu.wnd:ParentKeyboardOptionsMenu"); - parentKeyboardOptionsMenu = TheWindowManager->winGetWindowFromId( NULL, parentKeyboardOptionsMenuID ); + parentKeyboardOptionsMenu = TheWindowManager->winGetWindowFromId( nullptr, parentKeyboardOptionsMenuID ); // get ids for our children controls buttonBackID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); buttonBack = TheWindowManager->winGetWindowFromId( parentKeyboardOptionsMenu, buttonBackID ); comboBoxCategoryListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ComboBoxCategoryList" ); - comboBoxCategoryList = TheWindowManager->winGetWindowFromId( /*parentKeyboardOptionsMenu*/NULL, comboBoxCategoryListID ); + comboBoxCategoryList = TheWindowManager->winGetWindowFromId( /*parentKeyboardOptionsMenu*/nullptr, comboBoxCategoryListID ); listBoxCommandListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ListBoxCommandList" ); - listBoxCommandList = TheWindowManager->winGetWindowFromId( NULL, listBoxCommandListID ); + listBoxCommandList = TheWindowManager->winGetWindowFromId( nullptr, listBoxCommandListID ); staticTextDescriptionID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextDescription" ); - staticTextDescription = TheWindowManager->winGetWindowFromId( NULL, staticTextDescriptionID ); + staticTextDescription = TheWindowManager->winGetWindowFromId( nullptr, staticTextDescriptionID ); staticTextCurrentHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextCurrentHotkey" ); - staticTextCurrentHotkey = TheWindowManager->winGetWindowFromId( NULL, staticTextCurrentHotkeyID ); + staticTextCurrentHotkey = TheWindowManager->winGetWindowFromId( nullptr, staticTextCurrentHotkeyID ); buttonResetAllID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonResetAll" ); - buttonResetAll = TheWindowManager->winGetWindowFromId( NULL, buttonResetAllID ); + buttonResetAll = TheWindowManager->winGetWindowFromId( nullptr, buttonResetAllID ); textEntryAssignHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:TextEntryAssignHotkey" ); - textEntryAssignHotkey = TheWindowManager->winGetWindowFromId( NULL, textEntryAssignHotkeyID ); + textEntryAssignHotkey = TheWindowManager->winGetWindowFromId( nullptr, textEntryAssignHotkeyID ); buttonAssignID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonAssign" ); - buttonAssign = TheWindowManager->winGetWindowFromId( NULL, buttonAssignID ); + buttonAssign = TheWindowManager->winGetWindowFromId( nullptr, buttonAssignID ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 2541ecafb9e..f38ccb5157d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -116,41 +116,34 @@ static NameKeyType checkboxLimitSuperweaponsID = NAMEKEY_INVALID; static NameKeyType comboBoxStartingCashID = NAMEKEY_INVALID; static NameKeyType windowMapID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLanGameOptions = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *checkboxLimitSuperweapons = NULL; -static GameWindow *comboBoxStartingCash = NULL; -static GameWindow *windowMap = NULL; - -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *buttonAccept[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *parentLanGameOptions = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *checkboxLimitSuperweapons = nullptr; +static GameWindow *comboBoxStartingCash = nullptr; +static GameWindow *windowMap = nullptr; + +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; +static GameWindow *buttonAccept[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; //external declarations of the Gadgets the callbacks can use -GameWindow *listboxChatWindowLanGame = NULL; +GameWindow *listboxChatWindowLanGame = nullptr; NameKeyType listboxChatWindowLanGameID = NAMEKEY_INVALID; -WindowLayout *mapSelectLayout = NULL; +WindowLayout *mapSelectLayout = nullptr; static Int getNextSelectablePlayer(Int start) { @@ -691,7 +684,7 @@ void InitLanGameGadgets( void ) windowMapID = TheNameKeyGenerator->nameToKey( "LanGameOptionsMenu.wnd:MapWindow" ); // Initialize the pointers to our gadgets - parentLanGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentLanGameOptionsID ); + parentLanGameOptions = TheWindowManager->winGetWindowFromId( nullptr, parentLanGameOptionsID ); DEBUG_ASSERTCRASH(parentLanGameOptions, ("Could not find the parentLanGameOptions")); buttonEmote = TheWindowManager->winGetWindowFromId( parentLanGameOptions,buttonEmoteID ); DEBUG_ASSERTCRASH(buttonEmote, ("Could not find the buttonEmote")); @@ -797,30 +790,30 @@ void InitLanGameGadgets( void ) void DeinitLanGameGadgets( void ) { - parentLanGameOptions = NULL; - buttonEmote = NULL; - buttonSelectMap = NULL; - buttonStart = NULL; - buttonBack = NULL; - listboxChatWindowLanGame = NULL; - textEntryChat = NULL; - textEntryMapDisplay = NULL; - checkboxLimitSuperweapons = NULL; - comboBoxStartingCash = NULL; + parentLanGameOptions = nullptr; + buttonEmote = nullptr; + buttonSelectMap = nullptr; + buttonStart = nullptr; + buttonBack = nullptr; + listboxChatWindowLanGame = nullptr; + textEntryChat = nullptr; + textEntryMapDisplay = nullptr; + checkboxLimitSuperweapons = nullptr; + comboBoxStartingCash = nullptr; if (windowMap) { - windowMap->winSetUserData(NULL); - windowMap = NULL; + windowMap->winSetUserData(nullptr); + windowMap = nullptr; } for (Int i = 0; i < MAX_SLOTS; i++) { - comboBoxPlayer[i] = NULL; - comboBoxColor[i] = NULL; - comboBoxPlayerTemplate[i] = NULL; - comboBoxTeam[i] = NULL; - buttonAccept[i] = NULL; -// buttonStartPosition[i] = NULL; - buttonMapStartPosition[i] = NULL; + comboBoxPlayer[i] = nullptr; + comboBoxColor[i] = nullptr; + comboBoxPlayerTemplate[i] = nullptr; + comboBoxTeam[i] = nullptr; + buttonAccept[i] = nullptr; +// buttonStartPosition[i] = nullptr; + buttonMapStartPosition[i] = nullptr; } } @@ -1017,21 +1010,21 @@ void setLANPlayerTooltip(LANPlayer* player) static void shutdownComplete( WindowLayout *layout ) { DeinitLanGameGadgets(); - textEntryMapDisplay = NULL; + textEntryMapDisplay = nullptr; LANisShuttingDown = false; // hide the layout layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - if (LANnextScreen != NULL) + if (LANnextScreen != nullptr) { TheShell->push(LANnextScreen); } - LANnextScreen = NULL; + LANnextScreen = nullptr; } @@ -1041,7 +1034,7 @@ static void shutdownComplete( WindowLayout *layout ) void LanGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) { TheMouse->setCursor(Mouse::ARROW); - TheMouse->setMouseText(UnicodeString::TheEmptyString,NULL,NULL); + TheMouse->setMouseText(UnicodeString::TheEmptyString,nullptr,nullptr); EnableSlotListUpdates(FALSE); LANisShuttingDown = true; @@ -1141,7 +1134,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1236,7 +1229,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } TheLAN->RequestGameLeave(); //TheShell->pop(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index 58418c946df..23e7aa351d0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -65,7 +65,7 @@ Bool LANisShuttingDown = false; Bool LANbuttonPushed = false; Bool LANSocketErrorDetected = FALSE; -char *LANnextScreen = NULL; +char *LANnextScreen = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; @@ -271,7 +271,7 @@ Money LANPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } @@ -304,24 +304,24 @@ static NameKeyType staticTextGameInfoID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLanLobby = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonClear = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *buttonDirectConnect = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *staticToolTip = NULL; -static GameWindow *textEntryPlayerName = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *staticTextGameInfo = NULL; +static GameWindow *parentLanLobby = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonClear = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *buttonDirectConnect = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *staticToolTip = nullptr; +static GameWindow *textEntryPlayerName = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *staticTextGameInfo = nullptr; //external declarations of the Gadgets the callbacks can use NameKeyType listboxChatWindowID = NAMEKEY_INVALID; -GameWindow *listboxChatWindow = NULL; -GameWindow *listboxPlayers = NULL; +GameWindow *listboxChatWindow = nullptr; +GameWindow *listboxPlayers = nullptr; NameKeyType listboxGamesID = NAMEKEY_INVALID; -GameWindow *listboxGames = NULL; +GameWindow *listboxGames = nullptr; // hack to disable framerate limiter in LAN games //static Bool shellmapOn; @@ -362,7 +362,7 @@ static void playerTooltip(GameWindow *window, //------------------------------------------------------------------------------------------------- void LanLobbyMenuInit( WindowLayout *layout, void *userData ) { - LANnextScreen = NULL; + LANnextScreen = nullptr; LANbuttonPushed = false; LANisShuttingDown = false; @@ -384,20 +384,20 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) // Get pointers to the window buttons - parentLanLobby = TheWindowManager->winGetWindowFromId( NULL, parentLanLobbyID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonClear = TheWindowManager->winGetWindowFromId( NULL, buttonClearID); - buttonHost = TheWindowManager->winGetWindowFromId( NULL, buttonHostID ); - buttonJoin = TheWindowManager->winGetWindowFromId( NULL, buttonJoinID ); - buttonDirectConnect = TheWindowManager->winGetWindowFromId( NULL, buttonDirectConnectID ); - buttonEmote = TheWindowManager->winGetWindowFromId( NULL,buttonEmoteID ); - staticToolTip = TheWindowManager->winGetWindowFromId( NULL, staticToolTipID ); - textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID ); - textEntryChat = TheWindowManager->winGetWindowFromId( NULL, textEntryChatID ); - listboxPlayers = TheWindowManager->winGetWindowFromId( NULL, listboxPlayersID ); - listboxChatWindow = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowID ); - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesID ); - staticTextGameInfo = TheWindowManager->winGetWindowFromId( NULL, staticTextGameInfoID ); + parentLanLobby = TheWindowManager->winGetWindowFromId( nullptr, parentLanLobbyID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonClear = TheWindowManager->winGetWindowFromId( nullptr, buttonClearID); + buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID ); + buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID ); + buttonDirectConnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDirectConnectID ); + buttonEmote = TheWindowManager->winGetWindowFromId( nullptr,buttonEmoteID ); + staticToolTip = TheWindowManager->winGetWindowFromId( nullptr, staticToolTipID ); + textEntryPlayerName = TheWindowManager->winGetWindowFromId( nullptr, textEntryPlayerNameID ); + textEntryChat = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); + listboxPlayers = TheWindowManager->winGetWindowFromId( nullptr, listboxPlayersID ); + listboxChatWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowID ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesID ); + staticTextGameInfo = TheWindowManager->winGetWindowFromId( nullptr, staticTextGameInfoID ); listboxPlayers->winSetTooltipFunc(playerTooltip); // Show Menu @@ -503,7 +503,7 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData ) justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("LanLobbyMenu.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("LanLobbyMenu.wnd:GadgetParent")); if(win) win->winHide(TRUE); @@ -530,14 +530,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - if (LANnextScreen != NULL) + if (LANnextScreen != nullptr) { TheShell->push(LANnextScreen); } - LANnextScreen = NULL; + LANnextScreen = nullptr; } @@ -616,7 +616,7 @@ void LanLobbyMenuUpdate( WindowLayout * layout, void *userData) if (LANSocketErrorDetected == TRUE) { LANSocketErrorDetected = FALSE; DEBUG_LOG(("SOCKET ERROR! BAILING!")); - MessageBoxOk(TheGameText->fetch("GUI:NetworkError"), TheGameText->fetch("GUI:SocketError"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NetworkError"), TheGameText->fetch("GUI:SocketError"), nullptr); // we have a socket problem, back out to the main menu. TheWindowManager->winSendSystemMsg(buttonBack->winGetParent(), GBM_SELECTED, @@ -765,7 +765,7 @@ WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, DEBUG_LOG(("Back was hit - popping to main menu")); TheShell->pop(); delete TheLAN; - TheLAN = NULL; + TheLAN = nullptr; //TheTransitionHandler->reverse("LanLobbyFade"); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp index 5ff05f9ff1b..b79272a6a66 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp @@ -50,14 +50,13 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *mapList = NULL; -static GameWindow *winMapPreview = NULL; +static GameWindow *parent = nullptr; +static GameWindow *mapList = nullptr; +static GameWindow *winMapPreview = nullptr; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, @@ -80,20 +79,20 @@ static const char *gadgetsToHide[] = "ButtonStart", "StaticTextMapPreview", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; static void showLANGameOptionsUnderlyingGUIElements( Bool show ) { ShowUnderlyingGUIElements( show, layoutFilename, parentName, gadgetsToHide, perPlayerGadgetsToHide ); - GameWindow *win = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("LanGameOptionsMenu.wnd:ButtonBack") ); + GameWindow *win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("LanGameOptionsMenu.wnd:ButtonBack") ); if(win) win->winEnable( show ); @@ -101,16 +100,16 @@ static void showLANGameOptionsUnderlyingGUIElements( Bool show ) static void NullifyControls() { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; inameToKey( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -255,8 +254,8 @@ WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) { - GameWindow *mapWindow = NULL; - if (listboxMap != NULL) + GameWindow *mapWindow = nullptr; + if (listboxMap != NAMEKEY_INVALID) { mapWindow = TheWindowManager->winGetWindowFromId( parent, listboxMap ); } @@ -344,10 +343,10 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } - // set the controls to NULL since they've been destroyed. + // set the controls to nullptr since they've been destroyed. NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); PostToLanGameOptions( MAP_BACK ); @@ -358,7 +357,7 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg UnicodeString map; // get the selected index - if (mapWindow != NULL) + if (mapWindow != nullptr) { GadgetListBoxGetSelected( mapWindow, &selected ); } @@ -394,10 +393,10 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { mapSelectLayout->destroyWindows(); deleteInstance(mapSelectLayout); - mapSelectLayout = NULL; + mapSelectLayout = nullptr; } - // set the controls to NULL since they've been destroyed. + // set the controls to nullptr since they've been destroyed. NullifyControls(); showLANGameOptionsUnderlyingGUIElements(TRUE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index 23b5e9ea142..e006099b62f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -95,9 +95,9 @@ static Bool raiseMessageBoxes = TRUE; static Bool campaignSelected = FALSE; #if defined(RTS_DEBUG) || defined RTS_PROFILE static NameKeyType campaignID = NAMEKEY_INVALID; -static GameWindow *buttonCampaign = NULL; +static GameWindow *buttonCampaign = nullptr; #ifdef TEST_COMPRESSION -static GameWindow *buttonCompressTest = NULL; +static GameWindow *buttonCompressTest = nullptr; void DoCompressTest( void ); #endif // TEST_COMPRESSION #endif @@ -140,37 +140,37 @@ static NameKeyType buttonDiffBackID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMainMenu = NULL; -static GameWindow *buttonSinglePlayer = NULL; -static GameWindow *buttonMultiPlayer = NULL; -static GameWindow *buttonSkirmish = NULL; -static GameWindow *buttonOnline = NULL; -static GameWindow *buttonNetwork = NULL; -static GameWindow *buttonOptions = NULL; -static GameWindow *buttonExit = NULL; -static GameWindow *buttonMOTD = NULL; -static GameWindow *buttonWorldBuilder = NULL; -static GameWindow *mainMenuMovie = NULL; -static GameWindow *getUpdate = NULL; -static GameWindow *buttonTRAINING = NULL; -static GameWindow *buttonChallenge = NULL; -static GameWindow *buttonUSA = NULL; -static GameWindow *buttonGLA = NULL; -static GameWindow *buttonChina = NULL; -static GameWindow *buttonUSARecentSave = NULL; -static GameWindow *buttonUSALoadGame = NULL; -static GameWindow *buttonGLARecentSave = NULL; -static GameWindow *buttonGLALoadGame = NULL; -static GameWindow *buttonChinaRecentSave = NULL; -static GameWindow *buttonChinaLoadGame = NULL; -static GameWindow *buttonReplay = NULL; -static GameWindow *buttonLoadReplay = NULL; -static GameWindow *buttonLoad = NULL; -static GameWindow *buttonCredits = NULL; -static GameWindow *buttonEasy = NULL; -static GameWindow *buttonMedium = NULL; -static GameWindow *buttonHard = NULL; -static GameWindow *buttonDiffBack = NULL; +static GameWindow *parentMainMenu = nullptr; +static GameWindow *buttonSinglePlayer = nullptr; +static GameWindow *buttonMultiPlayer = nullptr; +static GameWindow *buttonSkirmish = nullptr; +static GameWindow *buttonOnline = nullptr; +static GameWindow *buttonNetwork = nullptr; +static GameWindow *buttonOptions = nullptr; +static GameWindow *buttonExit = nullptr; +static GameWindow *buttonMOTD = nullptr; +static GameWindow *buttonWorldBuilder = nullptr; +static GameWindow *mainMenuMovie = nullptr; +static GameWindow *getUpdate = nullptr; +static GameWindow *buttonTRAINING = nullptr; +static GameWindow *buttonChallenge = nullptr; +static GameWindow *buttonUSA = nullptr; +static GameWindow *buttonGLA = nullptr; +static GameWindow *buttonChina = nullptr; +static GameWindow *buttonUSARecentSave = nullptr; +static GameWindow *buttonUSALoadGame = nullptr; +static GameWindow *buttonGLARecentSave = nullptr; +static GameWindow *buttonGLALoadGame = nullptr; +static GameWindow *buttonChinaRecentSave = nullptr; +static GameWindow *buttonChinaLoadGame = nullptr; +static GameWindow *buttonReplay = nullptr; +static GameWindow *buttonLoadReplay = nullptr; +static GameWindow *buttonLoad = nullptr; +static GameWindow *buttonCredits = nullptr; +static GameWindow *buttonEasy = nullptr; +static GameWindow *buttonMedium = nullptr; +static GameWindow *buttonHard = nullptr; +static GameWindow *buttonDiffBack = nullptr; static GameWindow *dropDownWindows[DROPDOWN_COUNT]; static Bool buttonPushed = FALSE; @@ -192,7 +192,7 @@ enum static Int showFade = FALSE; static Int dropDown = DROPDOWN_NONE; static Int pendingDropDown = DROPDOWN_NONE; -static AnimateWindowManager *localAnimateWindowManager = NULL; +static AnimateWindowManager *localAnimateWindowManager = nullptr; static Bool notShown = TRUE; static Bool FirstTimeRunningTheGame = TRUE; @@ -208,7 +208,7 @@ static Bool dontAllowTransitions = FALSE; const Int /*TIME_OUT = 15,*/ CORNER = 10; void AcceptResolution(); void DeclineResolution(); -GameWindow *resAcceptMenu = NULL; +GameWindow *resAcceptMenu = nullptr; extern DisplaySettings oldDispSettings, newDispSettings; extern Bool dispChanged; //static time_t timeStarted = 0, currentTime = 0; @@ -373,7 +373,7 @@ static void TimetToFileTime( time_t t, LPFILETIME pft ) void initialHide( void ) { -GameWindow *win = NULL; +GameWindow *win = nullptr; win = TheWindowManager->winGetWindowFromId(parentMainMenu, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinFactionGLA")); if(win) win->winHide(TRUE); @@ -443,7 +443,7 @@ GameWindow *win = NULL; static void initLabelVersion() { NameKeyType versionID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:LabelVersion" ); - GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( NULL, versionID ); + GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( nullptr, versionID ); if (labelVersion) { @@ -476,7 +476,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) pendingDropDown = DROPDOWN_NONE; Int i = 0; for(; i < DROPDOWN_COUNT; ++i) - dropDownWindows[i] = NULL; + dropDownWindows[i] = nullptr; // get ids for our windows mainMenuID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:MainMenuParent" ); @@ -516,7 +516,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) buttonDiffBackID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonDiffBack" ); // get pointers to the window buttons - parentMainMenu = TheWindowManager->winGetWindowFromId( NULL, mainMenuID ); + parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, mainMenuID ); //buttonCampaign = TheWindowManager->winGetWindowFromId( parentMainMenu, campaignID ); buttonSinglePlayer = TheWindowManager->winGetWindowFromId( parentMainMenu, buttonSinglePlayerID ); buttonMultiPlayer = TheWindowManager->winGetWindowFromId( parentMainMenu, buttonMultiPlayerID ); @@ -573,7 +573,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 25, 175, 400, 400, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif // TEST_COMPRESSION instData.init(); @@ -585,7 +585,7 @@ void MainMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED, 25, 54, 180, 26, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif initLabelVersion(); @@ -610,11 +610,11 @@ void MainMenuInit( WindowLayout *layout, void *userData ) checkedForUpdate = TRUE; DEBUG_LOG(("Looking for a patch for productID=%d, versionStr=%s, distribution=%d", gameProductID, gameVersionUniqueIDStr, gameDistributionID)); - ptCheckForPatch( gameProductID, gameVersionUniqueIDStr, gameDistributionID, patchAvailableCallback, PTFalse, NULL ); - //ptCheckForPatch( productID, versionUniqueIDStr, distributionID, mapPackAvailableCallback, PTFalse, NULL ); + ptCheckForPatch( gameProductID, gameVersionUniqueIDStr, gameDistributionID, patchAvailableCallback, PTFalse, nullptr ); + //ptCheckForPatch( productID, versionUniqueIDStr, distributionID, mapPackAvailableCallback, PTFalse, nullptr ); } } - if (getUpdate != NULL) + if (getUpdate != nullptr) { getUpdate->winHide( TRUE ); //getUpdate->winEnable( FALSE ); @@ -688,7 +688,7 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) // if(winVidManager) // delete winVidManager; - // winVidManager = NULL; + // winVidManager = nullptr; if( popImmediate ) @@ -696,7 +696,7 @@ void MainMenuShutdown( WindowLayout *layout, void *userData ) // if(localAnimateWindowManager) // { // delete localAnimateWindowManager; -// localAnimateWindowManager = NULL; +// localAnimateWindowManager = nullptr; // } shutdownComplete( layout ); return; @@ -778,7 +778,7 @@ void DoResolutionDialog() resAcceptMenu = TheWindowManager->gogoMessageBox( CORNER, CORNER, -1, -1,MSG_BOX_OK | MSG_BOX_CANCEL , TheGameText->fetch("GUI:Resolution"), - resTimerString, NULL, NULL, AcceptResolution, + resTimerString, nullptr, nullptr, AcceptResolution, DeclineResolution); } @@ -792,11 +792,11 @@ void ResolutionDialogUpdate() { if (timeStarted == 0 && currentTime == 0) { - timeStarted = currentTime = time(NULL); + timeStarted = currentTime = time(nullptr); } else { - currentTime = time(NULL); + currentTime = time(nullptr); } if ( ( currentTime - timeStarted ) >= TIME_OUT) @@ -808,7 +808,7 @@ void ResolutionDialogUpdate() // Used for debugging purposes //------------------------------------------------------------------------------------------------------ DEBUG_LOG(("Resolution Timer : started at %d, current time at %d, frameTicker is %d", timeStarted, - time(NULL) , currentTime)); + time(nullptr) , currentTime)); } */ @@ -1487,7 +1487,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, // load the options menu WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); - DEBUG_ASSERTCRASH(optLayout != NULL, ("unable to get options menu layout")); + DEBUG_ASSERTCRASH(optLayout != nullptr, ("unable to get options menu layout")); optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); @@ -1495,11 +1495,11 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == worldBuilderID ) { #if defined RTS_DEBUG - if(_spawnl(_P_NOWAIT,"WorldBuilderD.exe","WorldBuilderD.exe", NULL) < 0) - MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),NULL); + if(_spawnl(_P_NOWAIT,"WorldBuilderD.exe","WorldBuilderD.exe", nullptr) < 0) + MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),nullptr); #else - if(_spawnl(_P_NOWAIT,"WorldBuilder.exe","WorldBuilder.exe", NULL) < 0) - MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),NULL); + if(_spawnl(_P_NOWAIT,"WorldBuilder.exe","WorldBuilder.exe", nullptr) < 0) + MessageBoxOk(TheGameText->fetch("GUI:WorldBuilder"), TheGameText->fetch("GUI:WorldBuilderLoadFailed"),nullptr); #endif } else if( controlID == getUpdateID ) @@ -1517,7 +1517,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, } else { - QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),quitCallback,NULL); + QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),quitCallback,nullptr); } //#endif @@ -1580,7 +1580,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, showLogo = FALSE; showSide = SHOW_USA; // launchChallengeMenu = FALSE; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); @@ -1608,7 +1608,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, showLogo = FALSE; showSide = SHOW_GLA; // launchChallengeMenu = FALSE; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); @@ -1636,7 +1636,7 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, showLogo = FALSE; showSide = SHOW_CHINA; // launchChallengeMenu = FALSE; -// WindowLayout *layout = NULL; +// WindowLayout *layout = nullptr; // layout = TheWindowManager->winCreateLayout( "Menus/DifficultySelect.wnd" ); // layout->runInit(); // layout->hide( FALSE ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp index 429d921a4fd..067f60a824b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp @@ -50,7 +50,7 @@ // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *mapList = NULL; +static GameWindow *mapList = nullptr; static Bool showSoloMaps = true; static Bool isShuttingDown = false; @@ -109,7 +109,7 @@ static void shutdownComplete( WindowLayout *layout ) void SetDifficultyRadioButton( void ) { NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!TheScriptEngine) { @@ -171,7 +171,7 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // get the listbox window NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); - mapList = TheWindowManager->winGetWindowFromId( NULL, mapListID ); + mapList = TheWindowManager->winGetWindowFromId( nullptr, mapListID ); if( mapList ) { if (TheMapCache) @@ -182,14 +182,14 @@ void MapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID ); + GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( NULL, buttonOKID ); + GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,0); @@ -404,7 +404,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, Int selected; UnicodeString map; - GameWindow *mapWindow = TheWindowManager->winGetWindowFromId( NULL, listboxMap ); + GameWindow *mapWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxMap ); // get the selected index GadgetListBoxGetSelected( mapWindow, &selected ); @@ -454,7 +454,7 @@ WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, //buttonPushed = true; GadgetListBoxSetSelected( control, rowSelected ); NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( NULL, buttonOKID ); + GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonOK, buttonOKID ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp index c6132c56e49..f8d6b3856e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp @@ -70,12 +70,12 @@ static NameKeyType editPlayerNameID = NAMEKEY_INVALID; static NameKeyType comboboxRemoteIPID = NAMEKEY_INVALID; static NameKeyType staticLocalIPID = NAMEKEY_INVALID; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *editPlayerName = NULL; -static GameWindow *comboboxRemoteIP = NULL; -static GameWindow *staticLocalIP = NULL; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *editPlayerName = nullptr; +static GameWindow *comboboxRemoteIP = nullptr; +static GameWindow *staticLocalIP = nullptr; void PopulateRemoteIPComboBox() { @@ -180,7 +180,7 @@ void UpdateRemoteIPList() void HostDirectConnectGame() { // Init LAN API Singleton - DEBUG_ASSERTCRASH(TheLAN != NULL, ("TheLAN is NULL!")); + DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null!")); if (!TheLAN) { TheLAN = NEW LANAPI(); @@ -252,7 +252,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) LANbuttonPushed = false; LANisShuttingDown = false; - if (TheLAN == NULL) + if (TheLAN == nullptr) { TheLAN = NEW LANAPI(); TheLAN->init(); @@ -269,12 +269,12 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) comboboxRemoteIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ComboboxRemoteIP" ); staticLocalIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:StaticLocalIP" ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonHost = TheWindowManager->winGetWindowFromId( NULL, buttonHostID); - buttonJoin = TheWindowManager->winGetWindowFromId( NULL, buttonJoinID); - editPlayerName = TheWindowManager->winGetWindowFromId( NULL, editPlayerNameID); - comboboxRemoteIP = TheWindowManager->winGetWindowFromId( NULL, comboboxRemoteIPID); - staticLocalIP = TheWindowManager->winGetWindowFromId( NULL, staticLocalIPID); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID); + buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID); + editPlayerName = TheWindowManager->winGetWindowFromId( nullptr, editPlayerNameID); + comboboxRemoteIP = TheWindowManager->winGetWindowFromId( nullptr, comboboxRemoteIPID); + staticLocalIP = TheWindowManager->winGetWindowFromId( nullptr, staticLocalIPID); // // animate controls // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_LEFT, TRUE, 800); @@ -297,10 +297,10 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) UnicodeString ipstr; delete TheLAN; - TheLAN = NULL; + TheLAN = nullptr; - if (TheLAN == NULL) { -// DEBUG_ASSERTCRASH(TheLAN != NULL, ("TheLAN is null initializing the direct connect screen.")); + if (TheLAN == nullptr) { +// DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null initializing the direct connect screen.")); TheLAN = NEW LANAPI(); OptionPreferences prefs; @@ -319,7 +319,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) Bool foundIP = FALSE; EnumeratedIP *tempIP = IPlist; - while ((tempIP != NULL) && (foundIP == FALSE)) { + while ((tempIP != nullptr) && (foundIP == FALSE)) { if (IP == tempIP->getIP()) { foundIP = TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 16e2cc03111..f8f484e17dc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -82,129 +82,129 @@ static NameKeyType comboBoxOnlineIPID = NAMEKEY_INVALID; -static GameWindow * comboBoxOnlineIP = NULL; +static GameWindow * comboBoxOnlineIP = nullptr; static NameKeyType comboBoxLANIPID = NAMEKEY_INVALID; -static GameWindow * comboBoxLANIP = NULL; +static GameWindow * comboBoxLANIP = nullptr; static NameKeyType comboBoxAntiAliasingID = NAMEKEY_INVALID; -static GameWindow * comboBoxAntiAliasing = NULL; +static GameWindow * comboBoxAntiAliasing = nullptr; static NameKeyType comboBoxResolutionID = NAMEKEY_INVALID; -static GameWindow * comboBoxResolution = NULL; +static GameWindow * comboBoxResolution = nullptr; static NameKeyType comboBoxDetailID = NAMEKEY_INVALID; -static GameWindow * comboBoxDetail = NULL; +static GameWindow * comboBoxDetail = nullptr; static NameKeyType checkAlternateMouseID = NAMEKEY_INVALID; -static GameWindow * checkAlternateMouse = NULL; +static GameWindow * checkAlternateMouse = nullptr; static NameKeyType checkRetaliationID = NAMEKEY_INVALID; -static GameWindow * checkRetaliation = NULL; +static GameWindow * checkRetaliation = nullptr; static NameKeyType checkDoubleClickAttackMoveID = NAMEKEY_INVALID; -static GameWindow * checkDoubleClickAttackMove = NULL; +static GameWindow * checkDoubleClickAttackMove = nullptr; static NameKeyType sliderScrollSpeedID = NAMEKEY_INVALID; -static GameWindow * sliderScrollSpeed = NULL; +static GameWindow * sliderScrollSpeed = nullptr; static NameKeyType checkLanguageFilterID = NAMEKEY_INVALID; -static GameWindow * checkLanguageFilter = NULL; +static GameWindow * checkLanguageFilter = nullptr; static NameKeyType checkUseCameraID = NAMEKEY_INVALID; -static GameWindow * checkUseCamera = NULL; +static GameWindow * checkUseCamera = nullptr; static NameKeyType checkSaveCameraID = NAMEKEY_INVALID; -static GameWindow * checkSaveCamera = NULL; +static GameWindow * checkSaveCamera = nullptr; static NameKeyType checkSendDelayID = NAMEKEY_INVALID; -static GameWindow * checkSendDelay = NULL; +static GameWindow * checkSendDelay = nullptr; static NameKeyType checkDrawAnchorID = NAMEKEY_INVALID; -static GameWindow * checkDrawAnchor = NULL; +static GameWindow * checkDrawAnchor = nullptr; static NameKeyType checkMoveAnchorID = NAMEKEY_INVALID; -static GameWindow * checkMoveAnchor = NULL; +static GameWindow * checkMoveAnchor = nullptr; static NameKeyType buttonFirewallRefreshID = NAMEKEY_INVALID; -static GameWindow * buttonFirewallRefresh = NULL; +static GameWindow * buttonFirewallRefresh = nullptr; // //static NameKeyType checkAudioHardwareID = NAMEKEY_INVALID; -//static GameWindow * checkAudioHardware = NULL; +//static GameWindow * checkAudioHardware = nullptr; // //static NameKeyType checkAudioSurroundID = NAMEKEY_INVALID; -//static GameWindow * checkAudioSurround = NULL; +//static GameWindow * checkAudioSurround = nullptr; ////volume controls // static NameKeyType sliderMusicVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderMusicVolume = NULL; +static GameWindow * sliderMusicVolume = nullptr; static NameKeyType sliderSFXVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderSFXVolume = NULL; +static GameWindow * sliderSFXVolume = nullptr; static NameKeyType sliderVoiceVolumeID = NAMEKEY_INVALID; -static GameWindow * sliderVoiceVolume = NULL; +static GameWindow * sliderVoiceVolume = nullptr; static NameKeyType sliderGammaID = NAMEKEY_INVALID; -static GameWindow * sliderGamma = NULL; +static GameWindow * sliderGamma = nullptr; //Advanced Options Screen static NameKeyType WinAdvancedDisplayID = NAMEKEY_INVALID; -static GameWindow * WinAdvancedDisplay = NULL; +static GameWindow * WinAdvancedDisplay = nullptr; static NameKeyType ButtonAdvancedAcceptID = NAMEKEY_INVALID; -static GameWindow * ButtonAdvancedAccept = NULL; +static GameWindow * ButtonAdvancedAccept = nullptr; static NameKeyType ButtonAdvancedCancelID = NAMEKEY_INVALID; -static GameWindow * ButtonAdvancedCancel = NULL; +static GameWindow * ButtonAdvancedCancel = nullptr; static NameKeyType sliderTextureResolutionID = NAMEKEY_INVALID; -static GameWindow * sliderTextureResolution = NULL; +static GameWindow * sliderTextureResolution = nullptr; static NameKeyType sliderParticleCapID = NAMEKEY_INVALID; -static GameWindow * sliderParticleCap = NULL; +static GameWindow * sliderParticleCap = nullptr; static NameKeyType check3DShadowsID = NAMEKEY_INVALID; -static GameWindow * check3DShadows = NULL; +static GameWindow * check3DShadows = nullptr; static NameKeyType check2DShadowsID = NAMEKEY_INVALID; -static GameWindow * check2DShadows = NULL; +static GameWindow * check2DShadows = nullptr; static NameKeyType checkCloudShadowsID = NAMEKEY_INVALID; -static GameWindow * checkCloudShadows = NULL; +static GameWindow * checkCloudShadows = nullptr; static NameKeyType checkGroundLightingID = NAMEKEY_INVALID; -static GameWindow * checkGroundLighting = NULL; +static GameWindow * checkGroundLighting = nullptr; static NameKeyType checkSmoothWaterID = NAMEKEY_INVALID; -static GameWindow * checkSmoothWater = NULL; +static GameWindow * checkSmoothWater = nullptr; static NameKeyType checkBuildingOcclusionID = NAMEKEY_INVALID; -static GameWindow * checkBuildingOcclusion = NULL; +static GameWindow * checkBuildingOcclusion = nullptr; static NameKeyType checkPropsID = NAMEKEY_INVALID; -static GameWindow * checkProps = NULL; +static GameWindow * checkProps = nullptr; static NameKeyType checkExtraAnimationsID = NAMEKEY_INVALID; -static GameWindow * checkExtraAnimations = NULL; +static GameWindow * checkExtraAnimations = nullptr; static NameKeyType checkNoDynamicLodID = NAMEKEY_INVALID; -static GameWindow * checkNoDynamicLod = NULL; +static GameWindow * checkNoDynamicLod = nullptr; static NameKeyType checkUnlockFpsID = NAMEKEY_INVALID; -static GameWindow * checkUnlockFps = NULL; +static GameWindow * checkUnlockFps = nullptr; static NameKeyType checkHeatEffectsID = NAMEKEY_INVALID; -static GameWindow * checkHeatEffects = NULL; +static GameWindow * checkHeatEffects = nullptr; /* static NameKeyType radioHighID = NAMEKEY_INVALID; -static GameWindow * radioHigh = NULL; +static GameWindow * radioHigh = nullptr; static NameKeyType radioMediumID = NAMEKEY_INVALID; -static GameWindow * radioMedium = NULL; +static GameWindow * radioMedium = nullptr; static NameKeyType radioLowID = NAMEKEY_INVALID; -static GameWindow * radioLow = NULL; +static GameWindow * radioLow = nullptr; */ @@ -213,7 +213,7 @@ Bool dispChanged = FALSE; extern Int timer; extern void DoResolutionDialog(); static Bool ignoreSelected = FALSE; -WindowLayout *OptionsLayout = NULL; +WindowLayout *OptionsLayout = nullptr; OptionPreferences::OptionPreferences( void ) @@ -995,7 +995,7 @@ Bool OptionPreferences::getShowMoneyPerMinute(void) const return FALSE; } -static OptionPreferences *pref = NULL; +static OptionPreferences *pref = nullptr; static void setDefaults( void ) { @@ -1301,7 +1301,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // HTTP Proxy - GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); + GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); if (textEntryHTTPProxy && textEntryHTTPProxy->winGetEnabled()) { UnicodeString uStr = GadgetTextEntryGetText(textEntryHTTPProxy); @@ -1313,7 +1313,7 @@ static void saveOptions( void ) //------------------------------------------------------------------------------------------------- // Firewall Port Override - GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); + GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); if (textEntryFirewallPortOverride && textEntryFirewallPortOverride->winGetEnabled()) { UnicodeString uStr = GadgetTextEntryGetText(textEntryFirewallPortOverride); @@ -1629,7 +1629,7 @@ static void DestroyOptionsLayout() { SignalUIInteraction(SHELL_SCRIPT_HOOK_OPTIONS_CLOSED); TheShell->destroyOptionsLayout(); - OptionsLayout = NULL; + OptionsLayout = nullptr; } static void showAdvancedOptions() @@ -1654,7 +1654,7 @@ static void cancelAdvancedOptions() static void initLabelVersion() { NameKeyType versionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:LabelVersion" ); - GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( NULL, versionID ); + GameWindow *labelVersion = TheWindowManager->winGetWindowFromId( nullptr, versionID ); if (labelVersion) { @@ -1687,107 +1687,107 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) SignalUIInteraction(SHELL_SCRIPT_HOOK_OPTIONS_OPENED); comboBoxLANIPID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxIP" ); - comboBoxLANIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxLANIPID); + comboBoxLANIP = TheWindowManager->winGetWindowFromId( nullptr, comboBoxLANIPID); comboBoxOnlineIPID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxOnlineIP" ); - comboBoxOnlineIP = TheWindowManager->winGetWindowFromId( NULL, comboBoxOnlineIPID); + comboBoxOnlineIP = TheWindowManager->winGetWindowFromId( nullptr, comboBoxOnlineIPID); checkAlternateMouseID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAlternateMouse" ); - checkAlternateMouse = TheWindowManager->winGetWindowFromId( NULL, checkAlternateMouseID); + checkAlternateMouse = TheWindowManager->winGetWindowFromId( nullptr, checkAlternateMouseID); checkRetaliationID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:Retaliation" ); - checkRetaliation = TheWindowManager->winGetWindowFromId( NULL, checkRetaliationID); + checkRetaliation = TheWindowManager->winGetWindowFromId( nullptr, checkRetaliationID); checkDoubleClickAttackMoveID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckDoubleClickAttackMove" ); - checkDoubleClickAttackMove = TheWindowManager->winGetWindowFromId( NULL, checkDoubleClickAttackMoveID ); + checkDoubleClickAttackMove = TheWindowManager->winGetWindowFromId( nullptr, checkDoubleClickAttackMoveID ); sliderScrollSpeedID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderScrollSpeed" ); - sliderScrollSpeed = TheWindowManager->winGetWindowFromId( NULL, sliderScrollSpeedID); + sliderScrollSpeed = TheWindowManager->winGetWindowFromId( nullptr, sliderScrollSpeedID); comboBoxAntiAliasingID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxAntiAliasing" ); - comboBoxAntiAliasing = TheWindowManager->winGetWindowFromId( NULL, comboBoxAntiAliasingID ); + comboBoxAntiAliasing = TheWindowManager->winGetWindowFromId( nullptr, comboBoxAntiAliasingID ); comboBoxResolutionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxResolution" ); - comboBoxResolution = TheWindowManager->winGetWindowFromId( NULL, comboBoxResolutionID ); + comboBoxResolution = TheWindowManager->winGetWindowFromId( nullptr, comboBoxResolutionID ); comboBoxDetailID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ComboBoxDetail" ); - comboBoxDetail = TheWindowManager->winGetWindowFromId( NULL, comboBoxDetailID ); + comboBoxDetail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxDetailID ); checkLanguageFilterID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckLanguageFilter" ); - checkLanguageFilter = TheWindowManager->winGetWindowFromId( NULL, checkLanguageFilterID ); + checkLanguageFilter = TheWindowManager->winGetWindowFromId( nullptr, checkLanguageFilterID ); checkSendDelayID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckSendDelay" ); - checkSendDelay = TheWindowManager->winGetWindowFromId( NULL, checkSendDelayID); + checkSendDelay = TheWindowManager->winGetWindowFromId( nullptr, checkSendDelayID); buttonFirewallRefreshID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonFirewallRefresh" ); - buttonFirewallRefresh = TheWindowManager->winGetWindowFromId( NULL, buttonFirewallRefreshID); + buttonFirewallRefresh = TheWindowManager->winGetWindowFromId( nullptr, buttonFirewallRefreshID); checkDrawAnchorID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxDrawAnchor" ); - checkDrawAnchor = TheWindowManager->winGetWindowFromId( NULL, checkDrawAnchorID); + checkDrawAnchor = TheWindowManager->winGetWindowFromId( nullptr, checkDrawAnchorID); checkMoveAnchorID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxMoveAnchor" ); - checkMoveAnchor = TheWindowManager->winGetWindowFromId( NULL, checkMoveAnchorID); + checkMoveAnchor = TheWindowManager->winGetWindowFromId( nullptr, checkMoveAnchorID); // Replay camera checkSaveCameraID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxSaveCamera" ); - checkSaveCamera = TheWindowManager->winGetWindowFromId( NULL, checkSaveCameraID ); + checkSaveCamera = TheWindowManager->winGetWindowFromId( nullptr, checkSaveCameraID ); checkUseCameraID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBoxUseCamera" ); - checkUseCamera = TheWindowManager->winGetWindowFromId( NULL, checkUseCameraID ); + checkUseCamera = TheWindowManager->winGetWindowFromId( nullptr, checkUseCameraID ); // // Speakers and 3-D Audio // checkAudioSurroundID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAudioSurround" ); -// checkAudioSurround = TheWindowManager->winGetWindowFromId( NULL, checkAudioSurroundID ); +// checkAudioSurround = TheWindowManager->winGetWindowFromId( nullptr, checkAudioSurroundID ); // checkAudioHardwareID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckAudioHardware" ); -// checkAudioHardware = TheWindowManager->winGetWindowFromId( NULL, checkAudioHardwareID ); +// checkAudioHardware = TheWindowManager->winGetWindowFromId( nullptr, checkAudioHardwareID ); // // Volume Controls sliderMusicVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderMusicVolume" ); - sliderMusicVolume = TheWindowManager->winGetWindowFromId( NULL, sliderMusicVolumeID ); + sliderMusicVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderMusicVolumeID ); sliderSFXVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderSFXVolume" ); - sliderSFXVolume = TheWindowManager->winGetWindowFromId( NULL, sliderSFXVolumeID ); + sliderSFXVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderSFXVolumeID ); sliderVoiceVolumeID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderVoiceVolume" ); - sliderVoiceVolume = TheWindowManager->winGetWindowFromId( NULL, sliderVoiceVolumeID ); + sliderVoiceVolume = TheWindowManager->winGetWindowFromId( nullptr, sliderVoiceVolumeID ); sliderGammaID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:SliderGamma" ); - sliderGamma = TheWindowManager->winGetWindowFromId( NULL, sliderGammaID ); + sliderGamma = TheWindowManager->winGetWindowFromId( nullptr, sliderGammaID ); // checkBoxLowTextureDetailID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckLowTextureDetail" ); -// checkBoxLowTextureDetail = TheWindowManager->winGetWindowFromId( NULL, checkBoxLowTextureDetailID ); +// checkBoxLowTextureDetail = TheWindowManager->winGetWindowFromId( nullptr, checkBoxLowTextureDetailID ); WinAdvancedDisplayID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:WinAdvancedDisplayOptions" ); - WinAdvancedDisplay = TheWindowManager->winGetWindowFromId( NULL, WinAdvancedDisplayID ); + WinAdvancedDisplay = TheWindowManager->winGetWindowFromId( nullptr, WinAdvancedDisplayID ); ButtonAdvancedAcceptID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonAdvanceAccept" ); - ButtonAdvancedAccept = TheWindowManager->winGetWindowFromId( NULL, ButtonAdvancedAcceptID ); + ButtonAdvancedAccept = TheWindowManager->winGetWindowFromId( nullptr, ButtonAdvancedAcceptID ); ButtonAdvancedCancelID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonAdvanceBack" ); - ButtonAdvancedCancel = TheWindowManager->winGetWindowFromId( NULL, ButtonAdvancedCancelID ); + ButtonAdvancedCancel = TheWindowManager->winGetWindowFromId( nullptr, ButtonAdvancedCancelID ); sliderTextureResolutionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:LowResSlider" ); - sliderTextureResolution = TheWindowManager->winGetWindowFromId( NULL, sliderTextureResolutionID ); + sliderTextureResolution = TheWindowManager->winGetWindowFromId( nullptr, sliderTextureResolutionID ); check3DShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:Check3DShadows" ); - check3DShadows = TheWindowManager->winGetWindowFromId( NULL, check3DShadowsID); + check3DShadows = TheWindowManager->winGetWindowFromId( nullptr, check3DShadowsID); check2DShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:Check2DShadows" ); - check2DShadows = TheWindowManager->winGetWindowFromId( NULL, check2DShadowsID); + check2DShadows = TheWindowManager->winGetWindowFromId( nullptr, check2DShadowsID); checkCloudShadowsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckCloudShadows" ); - checkCloudShadows = TheWindowManager->winGetWindowFromId( NULL, checkCloudShadowsID); + checkCloudShadows = TheWindowManager->winGetWindowFromId( nullptr, checkCloudShadowsID); checkGroundLightingID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckGroundLighting" ); - checkGroundLighting = TheWindowManager->winGetWindowFromId( NULL, checkGroundLightingID); + checkGroundLighting = TheWindowManager->winGetWindowFromId( nullptr, checkGroundLightingID); checkSmoothWaterID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckSmoothWater" ); - checkSmoothWater = TheWindowManager->winGetWindowFromId( NULL, checkSmoothWaterID); + checkSmoothWater = TheWindowManager->winGetWindowFromId( nullptr, checkSmoothWaterID); checkExtraAnimationsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckExtraAnimations" ); - checkExtraAnimations = TheWindowManager->winGetWindowFromId( NULL, checkExtraAnimationsID); + checkExtraAnimations = TheWindowManager->winGetWindowFromId( nullptr, checkExtraAnimationsID); checkNoDynamicLodID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckNoDynamicLOD" ); - checkNoDynamicLod = TheWindowManager->winGetWindowFromId( NULL, checkNoDynamicLodID); + checkNoDynamicLod = TheWindowManager->winGetWindowFromId( nullptr, checkNoDynamicLodID); checkHeatEffectsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckHeatEffects" ); - checkHeatEffects = TheWindowManager->winGetWindowFromId( NULL, checkHeatEffectsID); + checkHeatEffects = TheWindowManager->winGetWindowFromId( nullptr, checkHeatEffectsID); checkUnlockFpsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckUnlockFPS" ); - checkUnlockFps = TheWindowManager->winGetWindowFromId( NULL, checkUnlockFpsID); + checkUnlockFps = TheWindowManager->winGetWindowFromId( nullptr, checkUnlockFpsID); checkBuildingOcclusionID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckBehindBuilding" ); - checkBuildingOcclusion = TheWindowManager->winGetWindowFromId( NULL, checkBuildingOcclusionID); + checkBuildingOcclusion = TheWindowManager->winGetWindowFromId( nullptr, checkBuildingOcclusionID); checkPropsID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:CheckShowProps" ); - checkProps = TheWindowManager->winGetWindowFromId( NULL, checkPropsID); + checkProps = TheWindowManager->winGetWindowFromId( nullptr, checkPropsID); sliderParticleCapID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ParticleCapSlider" ); - sliderParticleCap = TheWindowManager->winGetWindowFromId( NULL, sliderParticleCapID ); + sliderParticleCap = TheWindowManager->winGetWindowFromId( nullptr, sliderParticleCapID ); WinAdvancedDisplay->winHide(TRUE); @@ -1876,7 +1876,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } // HTTP Proxy - GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); + GameWindow *textEntryHTTPProxy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryHTTPProxy")); if (textEntryHTTPProxy) { UnicodeString uStr; @@ -1887,7 +1887,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) } // Firewall Port Override - GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); + GameWindow *textEntryFirewallPortOverride = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("OptionsMenu.wnd:TextEntryFirewallPortOverride")); if (textEntryFirewallPortOverride) { UnicodeString uStr; @@ -2118,7 +2118,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:OptionsMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); if( (TheGameLogic->isInGame() && TheGameLogic->getGameMode() != GAME_SHELL) || TheGameSpyInfo ) @@ -2167,10 +2167,10 @@ void OptionsMenuShutdown( WindowLayout *layout, void *userData ) { pref->write(); delete pref; - pref = NULL; + pref = nullptr; } - comboBoxIP = NULL; + comboBoxIP = nullptr; // hide menu layout->hide( TRUE ); @@ -2324,10 +2324,10 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, //TheShell->pop(); delete pref; - pref = NULL; + pref = nullptr; - comboBoxLANIP = NULL; - comboBoxOnlineIP = NULL; + comboBoxLANIP = nullptr; + comboBoxOnlineIP = nullptr; if(GameSpyIsOverlayOpen(GSOVERLAY_OPTIONS)) GameSpyCloseOverlay(GSOVERLAY_OPTIONS); @@ -2345,11 +2345,11 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, { pref->write(); delete pref; - pref = NULL; + pref = nullptr; } - comboBoxLANIP = NULL; - comboBoxOnlineIP = NULL; + comboBoxLANIP = nullptr; + comboBoxOnlineIP = nullptr; if(!TheGameLogic->isInGame() || TheGameLogic->isInShellGame()) destroyQuitMenu(); // if we're in a game, the change res then enter the same kind of game, we nee the quit menu to be gone. diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp index d3b9be11bc0..3789ca93370 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp @@ -51,8 +51,8 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *buttonOk = NULL; -static GameWindow *parent = NULL; +static GameWindow *buttonOk = nullptr; +static GameWindow *parent = nullptr; // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ void PopupCommunicatorInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupCommunicator.wnd:PopupCommunicator"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); TheWindowManager->winSetModal( parent ); @@ -189,7 +189,7 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms { popupCommunicatorLayout->destroyWindows(); deleteInstance(popupCommunicatorLayout); - popupCommunicatorLayout = NULL; + popupCommunicatorLayout = nullptr; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 9d55935b356..c976fd926b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -88,17 +88,17 @@ static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; static NameKeyType checkBoxLimitArmiesID = NAMEKEY_INVALID; static NameKeyType checkBoxUseStatsID = NAMEKEY_INVALID; -static GameWindow *parentPopup = NULL; -static GameWindow *textEntryGameName = NULL; -static GameWindow *buttonCreateGame = NULL; -static GameWindow *checkBoxAllowObservers = NULL; -static GameWindow *textEntryGameDescription = NULL; -static GameWindow *buttonCancel = NULL; -static GameWindow *comboBoxLadderName = NULL; -static GameWindow *textEntryLadderPassword = NULL; -static GameWindow *textEntryGamePassword = NULL; -static GameWindow *checkBoxLimitArmies = NULL; -static GameWindow *checkBoxUseStats = NULL; +static GameWindow *parentPopup = nullptr; +static GameWindow *textEntryGameName = nullptr; +static GameWindow *buttonCreateGame = nullptr; +static GameWindow *checkBoxAllowObservers = nullptr; +static GameWindow *textEntryGameDescription = nullptr; +static GameWindow *buttonCancel = nullptr; +static GameWindow *comboBoxLadderName = nullptr; +static GameWindow *textEntryLadderPassword = nullptr; +static GameWindow *textEntryGamePassword = nullptr; +static GameWindow *checkBoxLimitArmies = nullptr; +static GameWindow *checkBoxUseStats = nullptr; void createGame( void ); @@ -166,7 +166,7 @@ void PopulateCustomLadderListBox( GameWindow *win ) // start with "No Ladder" index = GadgetListBoxAddEntryText( win, TheGameText->fetch("GUI:NoLadder"), normalColor, -1 ); - GadgetListBoxSetItemData( win, 0, index ); + GadgetListBoxSetItemData( win, nullptr, index ); // add the last ladder Int selectedPos = 0; @@ -264,7 +264,7 @@ void PopulateCustomLadderComboBox( void ) Int index; GadgetComboBoxReset( comboBoxLadderName ); index = GadgetComboBoxAddEntry( comboBoxLadderName, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxLadderName, index, 0 ); + GadgetComboBoxSetItemData( comboBoxLadderName, index, nullptr ); Int selectedPos = 0; AsciiString lastLadderAddr = pref.getLastLadderAddr(); @@ -311,7 +311,7 @@ void PopulateCustomLadderComboBox( void ) void PopupHostGameInit( WindowLayout *layout, void *userData ) { parentPopupID = TheNameKeyGenerator->nameToKey("PopupHostGame.wnd:ParentHostPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(NULL, parentPopupID); + parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); textEntryGameNameID = TheNameKeyGenerator->nameToKey("PopupHostGame.wnd:TextEntryGameName"); textEntryGameName = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGameNameID); @@ -449,7 +449,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { - parentPopup = NULL; + parentPopup = nullptr; break; @@ -528,7 +528,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W if( controlID == buttonCancelID ) { - parentPopup = NULL; + parentPopup = nullptr; GameSpyCloseOverlay(GSOVERLAY_GAMEOPTIONS); SetLobbyAttemptHostJoin( FALSE ); } @@ -543,7 +543,7 @@ WindowMsgHandledType PopupHostGameSystem( GameWindow *window, UnsignedInt msg, W GadgetTextEntrySetText(textEntryGameName, name); } createGame(); - parentPopup = NULL; + parentPopup = nullptr; GameSpyCloseOverlay(GSOVERLAY_GAMEOPTIONS); } break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp index efbba30770c..3400fd7a748 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp @@ -72,8 +72,8 @@ static NameKeyType parentPopupID = NAMEKEY_INVALID; static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *parentPopup = NULL; -static GameWindow *textEntryGamePassword = NULL; +static GameWindow *parentPopup = nullptr; +static GameWindow *textEntryGamePassword = nullptr; static void joinGame( AsciiString password ); @@ -87,7 +87,7 @@ static void joinGame( AsciiString password ); void PopupJoinGameInit( WindowLayout *layout, void *userData ) { parentPopupID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:ParentJoinPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(NULL, parentPopupID); + parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); textEntryGamePasswordID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:TextEntryGamePassword"); textEntryGamePassword = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGamePasswordID); @@ -139,7 +139,7 @@ WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, Wi { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; } // don't let key fall through anywhere else @@ -189,7 +189,7 @@ WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, W { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; } break; } @@ -248,7 +248,7 @@ static void joinGame( AsciiString password ) { GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); SetLobbyAttemptHostJoin( FALSE ); - parentPopup = NULL; + parentPopup = nullptr; return; } PeerRequest req; @@ -259,5 +259,5 @@ static void joinGame( AsciiString password ) TheGameSpyPeerMessageQueue->addRequest(req); DEBUG_LOG(("Attempting to join game %d(%ls) with password [%s]", ourRoom->getID(), ourRoom->getGameName().str(), password.str())); GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - parentPopup = NULL; + parentPopup = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp index 72389c9f9f4..cc517e5b568 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp @@ -80,25 +80,25 @@ static NameKeyType staticTextLadderNameID = NAMEKEY_INVALID; static NameKeyType buttonOkID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *listboxLadderSelect = NULL; -static GameWindow *listboxLadderDetails = NULL; -static GameWindow *staticTextLadderName = NULL; -static GameWindow *buttonOk = NULL; -static GameWindow *buttonCancel = NULL; +static GameWindow *parent = nullptr; +static GameWindow *listboxLadderSelect = nullptr; +static GameWindow *listboxLadderDetails = nullptr; +static GameWindow *staticTextLadderName = nullptr; +static GameWindow *buttonOk = nullptr; +static GameWindow *buttonCancel = nullptr; // password entry popup static NameKeyType passwordParentID = NAMEKEY_INVALID; static NameKeyType buttonPasswordOkID = NAMEKEY_INVALID; static NameKeyType buttonPasswordCancelID = NAMEKEY_INVALID; static NameKeyType textEntryPasswordID = NAMEKEY_INVALID; -static GameWindow *passwordParent = NULL; -static GameWindow *textEntryPassword = NULL; +static GameWindow *passwordParent = nullptr; +static GameWindow *textEntryPassword = nullptr; // incorrect password popup static NameKeyType badPasswordParentID = NAMEKEY_INVALID; static NameKeyType buttonBadPasswordOkID = NAMEKEY_INVALID; -static GameWindow *badPasswordParent = NULL; +static GameWindow *badPasswordParent = nullptr; static void updateLadderDetails( Int ladderID, GameWindow *staticTextLadderName, GameWindow *listboxLadderDetails ); @@ -218,7 +218,7 @@ static void setPasswordMode(PasswordMode mode) void PopupLadderSelectInit( WindowLayout *layout, void *userData ) { parentID = NAMEKEY("PopupLadderSelect.wnd:Parent"); - parent = TheWindowManager->winGetWindowFromId(NULL, parentID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); listboxLadderSelectID = NAMEKEY("PopupLadderSelect.wnd:ListBoxLadderSelect"); listboxLadderSelect = TheWindowManager->winGetWindowFromId(parent, listboxLadderSelectID); @@ -345,9 +345,9 @@ WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt ms //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { - parent = NULL; - listboxLadderSelect = NULL; - listboxLadderDetails = NULL; + parent = nullptr; + listboxLadderSelect = nullptr; + listboxLadderDetails = nullptr; CustomMatchHideHostPopup(FALSE); break; } @@ -592,7 +592,7 @@ static void closeRightClickMenu(GameWindow *win) return; winLay->destroyWindows(); deleteInstance(winLay); - winLay = NULL; + winLay = nullptr; } } @@ -618,7 +618,7 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms case GGM_CLOSE: { closeRightClickMenu(window); - //rcMenu = NULL; + //rcMenu = nullptr; break; } @@ -660,9 +660,9 @@ WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt ms rcMenu->winSetUserData((void *)selectedID); TheWindowManager->winSetLoneWindow(rcMenu); - GameWindow *st = TheWindowManager->winGetWindowFromId(NULL, + GameWindow *st = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("PopupLadderDetails.wnd:StaticTextLadderName")); - GameWindow *lb = TheWindowManager->winGetWindowFromId(NULL, + GameWindow *lb = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("PopupLadderDetails.wnd:ListBoxLadderDetails")); updateLadderDetails(selectedID, st, lb); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 3dd610bcfdc..555b1ac888c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -74,15 +74,15 @@ static NameKeyType checkBoxAsianFontID = NAMEKEY_INVALID; static NameKeyType checkBoxNonAsianFontID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = NULL; -static GameWindow *listboxInfo = NULL; -static GameWindow *buttonClose = NULL; -static GameWindow *buttonBuddies = NULL; -//static GameWindow *buttonbuttonOptions = NULL; -static GameWindow *buttonSetLocale = NULL; -static GameWindow *buttonDeleteAccount = NULL; -static GameWindow *checkBoxAsianFont = NULL; -static GameWindow *checkBoxNonAsianFont = NULL; +static GameWindow *parent = nullptr; +static GameWindow *listboxInfo = nullptr; +static GameWindow *buttonClose = nullptr; +static GameWindow *buttonBuddies = nullptr; +//static GameWindow *buttonbuttonOptions = nullptr; +static GameWindow *buttonSetLocale = nullptr; +static GameWindow *buttonDeleteAccount = nullptr; +static GameWindow *checkBoxAsianFont = nullptr; +static GameWindow *checkBoxNonAsianFont = nullptr; static Bool isOverlayActive = false; static Bool raiseMessageBox = false; @@ -111,7 +111,7 @@ static const Image* lookupRankImage(AsciiString side, Int rank) return TheMappedImageCollection->findImageByName("NewPlayer"); if (rank < 0 || rank >= MAX_RANKS) - return NULL; + return nullptr; // dirty hack rather than try to get artists to follow a naming convention if (side == "USA") @@ -257,7 +257,7 @@ RankPoints::RankPoints(void) m_disconnectMultiplier = -1.0f; } -RankPoints *TheRankPointValues = NULL; +RankPoints *TheRankPointValues = nullptr; void SetLookAtPlayer( Int id, AsciiString nick) { @@ -320,143 +320,143 @@ void BattleHonorTooltip(GameWindow *window, if (BitIsSet(battleHonor, BATTLE_HONOR_NOT_GAINED)) { if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChinaDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChinaDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BATTLE_TANK)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTankDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTankDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_AIR_WING)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWingDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWingDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ENDURANCE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEnduranceDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEnduranceDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChinaDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChinaDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLADisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLADisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ10)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitzDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitzDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_FAIR_PLAY)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlayDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlayDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_APOCALYPSE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypseDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypseDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE_MODE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChallengeDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChallengeDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ULTIMATE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorUltimateDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorUltimateDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_GLOBAL_GENERAL)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorGlobalGeneralDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorGlobalGeneralDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallengeDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallengeDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_ONLINE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakOnlineDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakOnlineDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_DOMINATION)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationDisabled"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_DOMINATION_ONLINE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationOnlineDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationOnlineDisabled"), -1, nullptr, tooltipWidth ); } else { if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyUSA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChina"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyChina"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_LOYALTY_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorLoyaltyGLA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BATTLE_TANK)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTank"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBattleTank"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_AIR_WING)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWing"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorAirWing"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ENDURANCE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEndurance"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorEndurance"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_USA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignUSA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_CHINA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChina"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChina"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CAMPAIGN_GLA)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLA"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignGLA"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ5)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz5"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz5"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_BLITZ10)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorBlitz10"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_FAIR_PLAY)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlay"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorFairPlay"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_APOCALYPSE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypse"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorApocalypse"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_OFFICERSCLUB)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorOfficersClub"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorOfficersClub"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE_MODE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChallenge"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorCampaignChallenge"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_ULTIMATE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorUltimate"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorUltimate"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_GLOBAL_GENERAL)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorGlobalGeneral"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorGlobalGeneral"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_CHALLENGE)) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallenge"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorChallenge"), -1, nullptr, tooltipWidth ); else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK)) { if (extraValue >= 1000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak1000"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak1000"), -1, nullptr, tooltipWidth ); else if (extraValue >= 500) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak500"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak500"), -1, nullptr, tooltipWidth ); else if (extraValue >= 100) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak100"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak100"), -1, nullptr, tooltipWidth ); else if (extraValue >= 25) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25"), -1, nullptr, tooltipWidth ); else if (extraValue >= 10) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10"), -1, nullptr, tooltipWidth ); else if (extraValue >= 3) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3"), -1, nullptr, tooltipWidth ); else - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakDisabled"), -1, nullptr, tooltipWidth ); } else if(BitIsSet(battleHonor, BATTLE_HONOR_STREAK_ONLINE)) { if (extraValue >= 1000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak1000Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak1000Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 500) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak500Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak500Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 100) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak100Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak100Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 25) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak25Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 10) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak10Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 3) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreak3Online"), -1, nullptr, tooltipWidth ); else - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakOnlineDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorStreakOnlineDisabled"), -1, nullptr, tooltipWidth ); } else if(BitIsSet(battleHonor, BATTLE_HONOR_DOMINATION)) { if (extraValue >= 10000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination10000"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination10000"), -1, nullptr, tooltipWidth ); else if (extraValue >= 1000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination1000"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination1000"), -1, nullptr, tooltipWidth ); else if (extraValue >= 500) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination500"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination500"), -1, nullptr, tooltipWidth ); else if (extraValue >= 100) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination100"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination100"), -1, nullptr, tooltipWidth ); else - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationDisabled"), -1, nullptr, tooltipWidth ); } else if(BitIsSet(battleHonor, BATTLE_HONOR_DOMINATION_ONLINE)) { if (extraValue >= 10000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination10000Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination10000Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 1000) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination1000Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination1000Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 500) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination500Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination500Online"), -1, nullptr, tooltipWidth ); else if (extraValue >= 100) - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination100Online"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDomination100Online"), -1, nullptr, tooltipWidth ); else - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationOnlineDisabled"), -1, NULL, tooltipWidth ); + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:BattleHonorDominationOnlineDisabled"), -1, nullptr, tooltipWidth ); } } @@ -537,7 +537,7 @@ static void populateBattleHonors(const PSPlayerStats& stats, Int battleHonors, I } ResetBattleHonorInsertion(); - GadgetListBoxAddEntryImage(list, NULL, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 1; InsertBattleHonor(list, TheMappedImageCollection->findImageByName("FairPlay"), isFairPlayer, @@ -551,7 +551,7 @@ static void populateBattleHonors(const PSPlayerStats& stats, Int battleHonors, I BATTLE_HONOR_APOCALYPSE, row, column); // create a spacer for row 2 and start the images on row 3 - GadgetListBoxAddEntryImage(list, NULL, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); row = 3; if (BitIsSet(battleHonors, BATTLE_HONOR_BLITZ5)) @@ -860,9 +860,9 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) numGames = numWins + numLosses + numDiscons; - GameWindow *win = NULL; + GameWindow *win = nullptr; UnicodeString uStr; - win = findWindow(NULL, parentWindowName, "StaticTextPlayerStatisticsLabel"); + win = findWindow(nullptr, parentWindowName, "StaticTextPlayerStatisticsLabel"); if(win) { AsciiString localeID = "WOL:Locale00"; @@ -871,39 +871,39 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(TheGameText->fetch("GUI:PlayerStatistics"), lookAtPlayerName.c_str(), TheGameText->fetch(localeID).str()); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextGamesPlayedValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextGamesPlayedValue"); if(win) { uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextWinsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextWinsValue"); if(win) { uStr.format(L"%d", numWins); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextLossesValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextLossesValue"); if(win) { uStr.format(L"%d", numLosses); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextDisconnectsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextDisconnectsValue"); if(win) { uStr.format(L"%d", numDiscons); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBestStreakValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBestStreakValue"); if (win) { uStr.format(L"%d", stats.maxWinsInARow); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextStreak"); + win = findWindow(nullptr, parentWindowName, "StaticTextStreak"); if (win) { if (stats.lossesInARow > 0) @@ -915,7 +915,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, TheGameText->fetch("GUI:CurrentWinStreak")); } } - win = findWindow(NULL, parentWindowName, "StaticTextStreakValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextStreakValue"); if(win) { Int streak = max(stats.lossesInARow, stats.winsInARow); @@ -923,7 +923,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextTotalKillsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalKillsValue"); if(win) { Int numGames = 0; @@ -934,7 +934,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextTotalDeathsValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalDeathsValue"); if(win) { Int numGames = 0; @@ -945,7 +945,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextTotalBuiltValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextTotalBuiltValue"); if(win) { Int numGames = 0; @@ -956,7 +956,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsKilledValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsKilledValue"); if(win) { Int numGames = 0; @@ -967,7 +967,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsLostValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsLostValue"); if(win) { Int numGames = 0; @@ -978,7 +978,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) uStr.format(L"%d", numGames); GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextBuildingsBuiltValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextBuildingsBuiltValue"); if(win) { Int numGames = 0; @@ -990,7 +990,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "StaticTextWinPercentValue"); + win = findWindow(nullptr, parentWindowName, "StaticTextWinPercentValue"); if(win) { //GS prevent divide by zero @@ -1001,7 +1001,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) GadgetStaticTextSetText(win, uStr); } - win = findWindow(NULL, parentWindowName, "ProgressBarRank"); + win = findWindow(nullptr, parentWindowName, "ProgressBarRank"); if(win && TheRankPointValues) { if( currentRank == MAX_RANKS - 1) @@ -1017,7 +1017,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) //calculate favorite side and rank overlay image UnicodeString rankStr; //, sideStr, sideRankStr; - const PlayerTemplate* pPlayerTemplate = NULL; //NULL == newbie + const PlayerTemplate* pPlayerTemplate = nullptr; //nullptr == newbie { //search all stats for side favorite side (highest numGames) Int mostGames = 0; Int favorite = 0; @@ -1039,7 +1039,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) // //favorite side (ex: Toxin, Tank, Stealth, etc.) // AsciiString side; -// if( mostGames > 0 && pPlayerTemplate != NULL ) +// if( mostGames > 0 && pPlayerTemplate != nullptr ) // { // if( stats.gamesAsRandom >= mostGames ) // side = "GUI:Random"; @@ -1053,10 +1053,10 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } //rank image; based on rank and primary faction (USA, China, GLA) - win = findWindow(NULL, parentWindowName, "WinRank"); + win = findWindow(nullptr, parentWindowName, "WinRank"); if(win && TheRankPointValues) { - if (rankPoints == 0 || pPlayerTemplate == NULL) + if (rankPoints == 0 || pPlayerTemplate == nullptr) win->winSetEnabledImage(0, TheMappedImageCollection->findImageByName("NewPlayer")); else win->winSetEnabledImage(0, lookupRankImage(pPlayerTemplate->getBaseSide(), currentRank)); @@ -1064,7 +1064,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } //sub-faction overlay icon (ex: Tank General, Toxin General, etc.) - win = findWindow(NULL, parentWindowName, "FactionImage"); + win = findWindow(nullptr, parentWindowName, "FactionImage"); if(win && pPlayerTemplate && TheRankPointValues && rankPoints) { win->winSetEnabledImage(0, pPlayerTemplate->getGeneralImage()); @@ -1072,14 +1072,14 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } //favorite side and rank text (Ex: Tank Corporal) - win = findWindow(NULL, parentWindowName, "StaticTextRank"); + win = findWindow(nullptr, parentWindowName, "StaticTextRank"); if(win) { GadgetStaticTextSetText(win, rankStr); //just rank //x win->setTooltipText(sideRankStr); //ex: Toxin General - Corporal } - win = findWindow(NULL, parentWindowName, "StaticTextInProgress"); + win = findWindow(nullptr, parentWindowName, "StaticTextInProgress"); if (win) { if (weHaveStats) @@ -1093,7 +1093,7 @@ void PopulatePlayerInfoWindows( AsciiString parentWindowName ) } } - win = findWindow(NULL, parentWindowName, "ListboxInfo"); + win = findWindow(nullptr, parentWindowName, "ListboxInfo"); if(win) { populateBattleHonors(stats, stats.battleHonors,stats.gamesInRowWithLastGeneral,stats.lastGeneral,stats.challengeMedals, win); @@ -1114,7 +1114,7 @@ void HandlePersistentStorageResponses( void ) case PSResponse::PSRESPONSE_COULDNOTCONNECT: { // message box & hide the window - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:PSCannotConnect"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:PSCannotConnect"), nullptr); GameSpyCloseOverlay(GSOVERLAY_PLAYERINFO); } break; @@ -1274,7 +1274,7 @@ void GameSpyPlayerInfoOverlayInit( WindowLayout *layout, void *userData ) checkBoxAsianFontID = TheNameKeyGenerator->nameToKey( "PopupPlayerInfo.wnd:CheckBoxAsianText" ); checkBoxNonAsianFontID = TheNameKeyGenerator->nameToKey( "PopupPlayerInfo.wnd:CheckBoxNonAsianText" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonClose = TheWindowManager->winGetWindowFromId( parent, buttonCloseID); buttonBuddies = TheWindowManager->winGetWindowFromId( parent, buttonBuddiesID); listboxInfo = TheWindowManager->winGetWindowFromId( parent, listboxInfoID); @@ -1345,7 +1345,7 @@ void GameSpyPlayerInfoOverlayShutdown( WindowLayout *layout, void *userData ) // hide menu layout->hide( TRUE ); - parent = NULL; + parent = nullptr; // our shutdown is complete isOverlayActive = false; @@ -1474,7 +1474,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne { RefreshGameListBoxes(); GameSpyCloseOverlay( GSOVERLAY_PLAYERINFO ); - MessageBoxYesNo(TheGameText->fetch("GUI:DeleteAccount"), TheGameText->fetch("GUI:AreYouSureDeleteAccount"),messageBoxYes, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:DeleteAccount"), TheGameText->fetch("GUI:AreYouSureDeleteAccount"),messageBoxYes, nullptr); } else if (controlID == checkBoxAsianFontID) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp index b4a6e905e1e..ad95903768b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp @@ -66,8 +66,8 @@ static NameKeyType buttonSaveKey = NAMEKEY_INVALID; static NameKeyType listboxGamesKey = NAMEKEY_INVALID; static NameKeyType textEntryReplayNameKey = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *replaySavedParent = NULL; +static GameWindow *parent = nullptr; +static GameWindow *replaySavedParent = nullptr; static time_t s_fileSavePopupStartTime = 0; static const time_t s_fileSavePopupDuration = 1000; @@ -83,7 +83,7 @@ extern std::string LastReplayFileName; //------------------------------------------------------------------------------------------------- void ShowReplaySavedPopup(Bool show) { - if (replaySavedParent != NULL) { + if (replaySavedParent != nullptr) { if (show) { replaySavedParent->winHide(FALSE); } else { @@ -118,13 +118,13 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplayMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType replaySavedParentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplaySaved"); - replaySavedParent = TheWindowManager->winGetWindowFromId( NULL, replaySavedParentID); - if (replaySavedParent == NULL) { - DEBUG_CRASH(("replaySavedParent == NULL")); + replaySavedParent = TheWindowManager->winGetWindowFromId( nullptr, replaySavedParentID); + if (replaySavedParent == nullptr) { + DEBUG_CRASH(("replaySavedParent == nullptr")); } ShowReplaySavedPopup(FALSE); @@ -134,8 +134,8 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) buttonFrame->winEnable( TRUE ); // get the listbox that will have the save games in it - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("PopupReplayInit - Unable to find games listbox") ); + GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplayInit - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -158,7 +158,7 @@ void PopupReplayInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void PopupReplayShutdown( WindowLayout *layout, void *userData ) { - parent = NULL; + parent = nullptr; } @@ -238,7 +238,7 @@ static std::string replayPath; // ------------------------------------------------------------------------------------------------ /** Save the replay */ // ------------------------------------------------------------------------------------------------ -static GameWindow *messageBoxWin = NULL; +static GameWindow *messageBoxWin = nullptr; static void saveReplay( UnicodeString filename ) { AsciiString translated; @@ -256,10 +256,10 @@ static void saveReplay( UnicodeString filename ) fullPath.concat(TheRecorder->getReplayExtention()); replayPath = fullPath.str(); - messageBoxWin = NULL; + messageBoxWin = nullptr; if (TheLocalFileSystem->doesFileExist(fullPath.str())) { - messageBoxWin = MessageBoxOkCancel(TheGameText->fetch("GUI:OverwriteReplayTitle"), TheGameText->fetch("GUI:OverwriteReplay"), reallySaveReplay, NULL); + messageBoxWin = MessageBoxOkCancel(TheGameText->fetch("GUI:OverwriteReplayTitle"), TheGameText->fetch("GUI:OverwriteReplay"), reallySaveReplay, nullptr); } else { @@ -283,20 +283,20 @@ void reallySaveReplay(void) if(DeleteFile(filename.str()) == 0) { wchar_t buffer[1024]; - FormatMessageW ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); if(messageBoxWin) { TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = NULL; + messageBoxWin = nullptr; } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); // get the listbox that will have the save games in it GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("reallySaveReplay - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -308,22 +308,22 @@ void reallySaveReplay(void) if(CopyFile(oldFilename.str(),filename.str(), FALSE) == 0) { wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); if(messageBoxWin) { TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = NULL; + messageBoxWin = nullptr; } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); return; } // get the listbox that will have the save games in it GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("reallySaveReplay - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); // populate the listbox with the save games on disk PopulateReplayFileListbox(listboxGames); @@ -375,7 +375,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("PopupReplaySystem - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplaySystem - Unable to find games listbox") ); // // handle games listbox, when certain items are selected in the listbox only some @@ -389,7 +389,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, UnicodeString filename; filename = GadgetListBoxGetText(listboxGames, rowSelected); GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != NULL, ("PopupReplaySystem - Unable to find text entry") ); + DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); GadgetTextEntrySetText(textEntryReplayName, filename); } } @@ -427,7 +427,7 @@ WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, { // get the filename, and see if we are overwriting GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != NULL, ("PopupReplaySystem - Unable to find text entry") ); + DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); UnicodeString filename = GadgetTextEntryGetText( textEntryReplayName ); if (filename.isEmpty()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index 7f4d4b990a5..63bdf6a7b71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -75,15 +75,15 @@ static NameKeyType buttonSaveDescConfirm = NAMEKEY_INVALID; static NameKeyType buttonDeleteConfirm = NAMEKEY_INVALID; static NameKeyType buttonDeleteCancel = NAMEKEY_INVALID; -static GameWindow *buttonFrame = NULL; -static GameWindow *overwriteConfirm = NULL; -static GameWindow *loadConfirm = NULL; -static GameWindow *saveDesc = NULL; -static GameWindow *listboxGames = NULL; -static GameWindow *editDesc = NULL; -static GameWindow *deleteConfirm = NULL; - -static GameWindow *parent = NULL; +static GameWindow *buttonFrame = nullptr; +static GameWindow *overwriteConfirm = nullptr; +static GameWindow *loadConfirm = nullptr; +static GameWindow *saveDesc = nullptr; +static GameWindow *listboxGames = nullptr; +static GameWindow *editDesc = nullptr; +static GameWindow *deleteConfirm = nullptr; + +static GameWindow *parent = nullptr; static SaveLoadLayoutType currentLayoutType = SLLT_INVALID; static Bool isPopup = FALSE; static Int initialGadgetDelay = 2; @@ -101,7 +101,7 @@ static void updateMenuActions( void ) { // for loading only, disable the save button, otherwise enable it - GameWindow *saveButton = TheWindowManager->winGetWindowFromId( NULL, buttonSaveKey ); + GameWindow *saveButton = TheWindowManager->winGetWindowFromId( nullptr, buttonSaveKey ); DEBUG_ASSERTCRASH( saveButton, ("SaveLoadMenuInit: Unable to find save button") ); if( currentLayoutType == SLLT_LOAD_ONLY ) saveButton->winEnable( FALSE ); @@ -109,17 +109,17 @@ static void updateMenuActions( void ) saveButton->winEnable( TRUE ); // get the games listbox - //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); + //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY( "PopupSaveLoad.wnd:ListboxGames" ) ); // if something with a game file is selected we can use load and delete Int selected; GadgetListBoxGetSelected( listboxGames, &selected ); AvailableGameInfo *selectedGameInfo; selectedGameInfo = (AvailableGameInfo *)GadgetListBoxGetItemData( listboxGames, selected ); - GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( NULL, buttonLoadKey ); - buttonLoad->winEnable( selectedGameInfo != NULL ); - GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( NULL, buttonDeleteKey ); - buttonDelete->winEnable( selectedGameInfo != NULL ); + GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( nullptr, buttonLoadKey ); + buttonLoad->winEnable( selectedGameInfo != nullptr ); + GameWindow *buttonDelete = TheWindowManager->winGetWindowFromId( nullptr, buttonDeleteKey ); + buttonDelete->winEnable( selectedGameInfo != nullptr ); } @@ -153,7 +153,7 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupSaveLoad.wnd:SaveLoadMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); TheWindowManager->winSetModal( parent ); @@ -171,8 +171,8 @@ void SaveLoadMenuInit( WindowLayout *layout, void *userData ) deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:DeleteConfirmParent" ) ); editDesc = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupSaveLoad.wnd:EntryDesc" ) ); // get the listbox that will have the save games in it - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // populate the listbox with the save games on disk TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); @@ -215,7 +215,7 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) //set keyboard focus to main parent and set modal NameKeyType parentID = TheNameKeyGenerator->nameToKey("SaveLoad.wnd:SaveLoadMenu"); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); // TheWindowManager->winSetModal( parent ); @@ -234,8 +234,8 @@ void SaveLoadMenuFullScreenInit( WindowLayout *layout, void *userData ) editDesc = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "SaveLoad.wnd:EntryDesc" ) ); deleteConfirm = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "SaveLoad.wnd:DeleteConfirmParent" ) ); // get the listbox that will have the save games in it - listboxGames = TheWindowManager->winGetWindowFromId( NULL, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // populate the listbox with the save games on disk TheGameState->populateSaveGameListbox( listboxGames, currentLayoutType ); @@ -367,7 +367,7 @@ static AvailableGameInfo *getSelectedSaveFileInfo( GameWindow *window ) // get the listbox //GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // which item is selected Int selected; @@ -560,9 +560,9 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, { GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); - if (listboxGames != NULL) { + if (listboxGames != nullptr) { int rowSelected = mData2; GadgetListBoxSetSelected(listboxGames, rowSelected); @@ -580,7 +580,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, GameWindow *control = (GameWindow *)mData1; GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != NULL, ("SaveLoadMenuInit - Unable to find games listbox") ); + DEBUG_ASSERTCRASH( listboxGames != nullptr, ("SaveLoadMenuInit - Unable to find games listbox") ); // // handle games listbox, when certain items are selected in the listbox only some @@ -616,7 +616,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, AvailableGameInfo *selectedGameInfo = getSelectedSaveFileInfo( window ); // if there is no file info, this is a new game - if( selectedGameInfo == NULL ) + if( selectedGameInfo == nullptr ) { // show the save description window diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 0d387b201c1..63829fde1ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -57,21 +57,21 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static WindowLayout *quitMenuLayout = NULL; -static WindowLayout *fullQuitMenuLayout = NULL; -static WindowLayout *noSaveLoadQuitMenuLayout = NULL; +static WindowLayout *quitMenuLayout = nullptr; +static WindowLayout *fullQuitMenuLayout = nullptr; +static WindowLayout *noSaveLoadQuitMenuLayout = nullptr; static Bool isVisible = FALSE; -static GameWindow *quitConfirmationWindow = NULL; +static GameWindow *quitConfirmationWindow = nullptr; //external declarations of the Gadgets the callbacks can use -static WindowLayout *saveLoadMenuLayout = NULL; +static WindowLayout *saveLoadMenuLayout = nullptr; -static GameWindow *buttonRestartWin = NULL; -static GameWindow *buttonSaveLoadWin = NULL; -static GameWindow *buttonOptionsWin = NULL; -static GameWindow *buttonExitWin = NULL; +static GameWindow *buttonRestartWin = nullptr; +static GameWindow *buttonSaveLoadWin = nullptr; +static GameWindow *buttonOptionsWin = nullptr; +static GameWindow *buttonExitWin = nullptr; static NameKeyType buttonExit = NAMEKEY_INVALID; static NameKeyType buttonRestart = NAMEKEY_INVALID; @@ -87,10 +87,10 @@ static void initGadgetsFullQuit( void ) buttonOptions = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonOptions" ); buttonSaveLoad = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonSaveLoad" ); - buttonRestartWin = TheWindowManager->winGetWindowFromId( NULL, buttonRestart ); - buttonSaveLoadWin = TheWindowManager->winGetWindowFromId( NULL, buttonSaveLoad ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( NULL, buttonOptions ); - buttonExitWin = TheWindowManager->winGetWindowFromId( NULL, buttonExit ); + buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); + buttonSaveLoadWin = TheWindowManager->winGetWindowFromId( nullptr, buttonSaveLoad ); + buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); + buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); } static void initGadgetsNoSaveQuit( void ) @@ -101,10 +101,10 @@ static void initGadgetsNoSaveQuit( void ) buttonOptions = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonOptions" ); buttonSaveLoad = NAMEKEY_INVALID; - buttonRestartWin = TheWindowManager->winGetWindowFromId( NULL, buttonRestart ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( NULL, buttonOptions ); - buttonSaveLoadWin = NULL; - buttonExitWin = TheWindowManager->winGetWindowFromId( NULL, buttonExit ); + buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); + buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); + buttonSaveLoadWin = nullptr; + buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); } @@ -113,20 +113,20 @@ static void initGadgetsNoSaveQuit( void ) void destroyQuitMenu() { // destroy the quit menu - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if(fullQuitMenuLayout) { fullQuitMenuLayout->destroyWindows(); deleteInstance(fullQuitMenuLayout); - fullQuitMenuLayout = NULL; + fullQuitMenuLayout = nullptr; } if(noSaveLoadQuitMenuLayout) { noSaveLoadQuitMenuLayout->destroyWindows(); deleteInstance(noSaveLoadQuitMenuLayout); - noSaveLoadQuitMenuLayout = NULL; + noSaveLoadQuitMenuLayout = nullptr; } - quitMenuLayout = NULL; + quitMenuLayout = nullptr; isVisible = FALSE; TheInGameUI->setQuitMenuVisible(FALSE); @@ -157,7 +157,7 @@ static void exitQuitMenu() } static void noExitQuitMenu() { - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; } static void quitToDesktopQuitMenu() @@ -245,7 +245,7 @@ static void restartMissionMenu() // InitGameLogicRandom(GameClientRandomValue(0, INT_MAX - 1)); } //TheTransitionHandler->remove("QuitFull"); //KRISMORNESS ADD - //quitMenuLayout = NULL; //KRISMORNESS ADD + //quitMenuLayout = nullptr; //KRISMORNESS ADD //isVisible = TRUE; //KRISMORNESS ADD //HideQuitMenu(); //KRISMORNESS ADD TheInGameUI->setClientQuiet( TRUE ); @@ -268,7 +268,7 @@ void HideQuitMenu( void ) isVisible = FALSE; if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if ( !TheGameLogic->isInMultiplayerGame() ) TheGameLogic->setGamePaused(FALSE); @@ -283,7 +283,7 @@ void ToggleQuitMenu() return; // BGC- If we are currently in the disconnect screen, don't let the quit menu come up. - if (TheDisconnectMenu != NULL) { + if (TheDisconnectMenu != nullptr) { if (TheDisconnectMenu->isScreenVisible() == TRUE) { return; } @@ -295,20 +295,20 @@ void ToggleQuitMenu() if (TheShell->getOptionsLayout(FALSE) != FALSE) { WindowLayout *optLayout = TheShell->getOptionsLayout(FALSE); GameWindow *optionsParent = optLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(optionsParent != NULL, ("Not able to get the options layout parent window")); + DEBUG_ASSERTCRASH(optionsParent != nullptr, ("Not able to get the options layout parent window")); GameWindow *optionsBack = TheWindowManager->winGetWindowFromId(optionsParent, TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(optionsBack != NULL, ("Not able to get the back button window from the options menu")); - TheWindowManager->winSendSystemMsg(optLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)optionsBack, NULL); + DEBUG_ASSERTCRASH(optionsBack != nullptr, ("Not able to get the back button window from the options menu")); + TheWindowManager->winSendSystemMsg(optLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)optionsBack, 0); return; } - if ((saveLoadMenuLayout != NULL) && (saveLoadMenuLayout->isHidden() == FALSE)) + if ((saveLoadMenuLayout != nullptr) && (saveLoadMenuLayout->isHidden() == FALSE)) { GameWindow *saveLoadParent = saveLoadMenuLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(saveLoadParent != NULL, ("Not able to get the save/load layout parent window")); + DEBUG_ASSERTCRASH(saveLoadParent != nullptr, ("Not able to get the save/load layout parent window")); GameWindow *saveLoadBack = TheWindowManager->winGetWindowFromId(saveLoadParent, TheNameKeyGenerator->nameToKey( "PopupSaveLoad.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(saveLoadBack != NULL, ("Not able to get the back button window from the save/load menu")); - TheWindowManager->winSendSystemMsg(saveLoadMenuLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)saveLoadBack, NULL); - saveLoadMenuLayout = NULL; + DEBUG_ASSERTCRASH(saveLoadBack != nullptr, ("Not able to get the back button window from the save/load menu")); + TheWindowManager->winSendSystemMsg(saveLoadMenuLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)saveLoadBack, 0); + saveLoadMenuLayout = nullptr; return; } @@ -320,7 +320,7 @@ void ToggleQuitMenu() if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; if ( !TheGameLogic->isInMultiplayerGame() ) TheGameLogic->setGamePaused(FALSE); @@ -335,7 +335,7 @@ void ToggleQuitMenu() //else //{ // TheTransitionHandler->remove("QuitFull"); - // quitMenuLayout = NULL; + // quitMenuLayout = nullptr; // isVisible = TRUE; // HideQuitMenu(); //} @@ -369,7 +369,7 @@ void ToggleQuitMenu() } // load the quit menu from the layout file if needed - if( quitMenuLayout == NULL ) + if( quitMenuLayout == nullptr ) { DEBUG_ASSERTCRASH(FALSE, ("Could not load a quit menu layout")); isVisible = FALSE; @@ -427,7 +427,7 @@ void ToggleQuitMenu() if (quitConfirmationWindow) TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = NULL; + quitConfirmationWindow = nullptr; HideDiplomacy(); HideInGameChat(); TheControlBar->hidePurchaseScience(); @@ -511,7 +511,7 @@ WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, else if( buttonOptions == controlID ) { WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); - DEBUG_ASSERTCRASH(optLayout != NULL, ("options menu layout is NULL")); + DEBUG_ASSERTCRASH(optLayout != nullptr, ("options menu layout is null")); optLayout->runInit(); optLayout->hide(FALSE); optLayout->bringForward(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp index 058841715ca..bd2ec5aaf8c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp @@ -66,18 +66,18 @@ static NameKeyType buttonCopyID = NAMEKEY_INVALID; static Bool isShuttingDown = false; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentReplayMenu = NULL; -static GameWindow *buttonLoad = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *listboxReplayFiles = NULL; -static GameWindow *buttonDelete = NULL; -static GameWindow *buttonCopy = NULL; +static GameWindow *parentReplayMenu = nullptr; +static GameWindow *buttonLoad = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *listboxReplayFiles = nullptr; +static GameWindow *buttonDelete = nullptr; +static GameWindow *buttonCopy = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; #if defined(RTS_DEBUG) -static GameWindow *buttonAnalyzeReplay = NULL; +static GameWindow *buttonAnalyzeReplay = nullptr; #endif void deleteReplay( void ); @@ -110,14 +110,14 @@ static Bool readReplayMapInfo(const AsciiString& filename, RecorderClass::Replay header.forPlayback = FALSE; header.filename = filename; - if (TheRecorder != NULL && TheRecorder->readReplayHeader(header)) + if (TheRecorder != nullptr && TheRecorder->readReplayHeader(header)) { if (ParseAsciiStringToGameInfo(&info, header.gameOptions)) { - if (TheMapCache != NULL) + if (TheMapCache != nullptr) mapData = TheMapCache->findMap(info.getMap()); else - mapData = NULL; + mapData = nullptr; return true; } @@ -193,7 +193,7 @@ static void showReplayTooltip(GameWindow* window, WinInstanceData* instData, Uns ReplayTooltipMap::const_iterator it = replayTooltipCache.find(replayFileName); if (it != replayTooltipCache.end()) - TheMouse->setCursorTooltip(it->second, -1, NULL, 1.5f); + TheMouse->setCursorTooltip(it->second, -1, nullptr, 1.5f); else TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); } @@ -310,7 +310,7 @@ void PopulateReplayFileListbox(GameWindow *listbox) Color color; Color mapColor; - const Bool hasMap = mapData != NULL; + const Bool hasMap = mapData != nullptr; const Bool isCrcCompatible = RecorderClass::replayMatchesGameVersion(header); @@ -380,7 +380,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) buttonDeleteID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonDeleteReplay" ); buttonCopyID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonCopyReplay" ); - parentReplayMenu = TheWindowManager->winGetWindowFromId( NULL, parentReplayMenuID ); + parentReplayMenu = TheWindowManager->winGetWindowFromId( nullptr, parentReplayMenuID ); buttonLoad = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonLoadID ); buttonBack = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonBackID ); listboxReplayFiles = TheWindowManager->winGetWindowFromId( parentReplayMenu, listboxReplayFilesID ); @@ -402,7 +402,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 4, 4, 180, 26, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); #endif // show menu @@ -412,7 +412,7 @@ void ReplayMenuInit( WindowLayout *layout, void *userData ) TheWindowManager->winSetFocus( parentReplayMenu ); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ReplayMenu.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ReplayMenu.wnd:GadgetParent")); if(win) win->winHide(TRUE); isShuttingDown = FALSE; @@ -525,7 +525,7 @@ void reallyLoadReplay(void) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } @@ -536,7 +536,7 @@ void reallyLoadReplay(void) TheRecorder->playbackFile(asciiFilename); - if(parentReplayMenu != NULL) + if(parentReplayMenu != nullptr) { parentReplayMenu->winHide(TRUE); } @@ -558,28 +558,28 @@ static void loadReplay(UnicodeString filename) UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFoundTitle", L"REPLAY NOT FOUND"); UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFound", L"This replay cannot be loaded because the file no longer exists on this device."); - MessageBoxOk(title, body, NULL); + MessageBoxOk(title, body, nullptr); } - else if(mapData == NULL) + else if(mapData == nullptr) { // TheSuperHackers @bugfix Prompts a message box when the map used by the replay was not found. UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFoundTitle", L"MAP NOT FOUND"); UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFound", L"This replay cannot be loaded because the map was not found on this device."); - MessageBoxOk(title, body, NULL); + MessageBoxOk(title, body, nullptr); } else if(!TheRecorder->replayMatchesGameVersion(header)) { // Pressing OK loads the replay. - MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"), reallyLoadReplay, NULL); + MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"), reallyLoadReplay, nullptr); } else { TheRecorder->playbackFile(asciiFilename); - if(parentReplayMenu != NULL) + if(parentReplayMenu != nullptr) { parentReplayMenu->winHide(TRUE); } @@ -657,7 +657,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(L"Blah Blah",L"Please select something munkee boy", NULL); + MessageBoxOk(L"Blah Blah",L"Please select something munkee boy", nullptr); break; } @@ -684,7 +684,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } @@ -705,11 +705,11 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:DeleteFile"), TheGameText->fetch("GUI:AreYouSureDelete"), deleteReplayFlag, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:DeleteFile"), TheGameText->fetch("GUI:AreYouSureDelete"), deleteReplayFlag, nullptr); } else if( controlID == buttonCopyID ) { @@ -717,11 +717,11 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); break; } filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, NULL); + MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, nullptr); } break; } @@ -740,7 +740,7 @@ void deleteReplay( void ) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } AsciiString filename, translate; @@ -750,11 +750,11 @@ void deleteReplay( void ) if(DeleteFile(filename.str()) == 0) { char buffer[1024]; - FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, sizeof(buffer), NULL); + FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, sizeof(buffer), nullptr); UnicodeString errorStr; translate.set(buffer); errorStr.translate(translate); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); } //Load the listbox shiznit GadgetListBoxReset(listboxReplayFiles); @@ -769,7 +769,7 @@ void copyReplay( void ) GadgetListBoxGetSelected( listboxReplayFiles, &selected ); if(selected < 0) { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); return; } AsciiString filename, translate; @@ -779,7 +779,7 @@ void copyReplay( void ) char path[1024]; LPITEMIDLIST pidl; - SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &pidl); + SHGetSpecialFolderLocation(nullptr, CSIDL_DESKTOPDIRECTORY, &pidl); SHGetPathFromIDList(pidl,path); AsciiString newFilename; newFilename.set(path); @@ -788,11 +788,11 @@ void copyReplay( void ) if(CopyFile(filename.str(),newFilename.str(), FALSE) == 0) { wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), NULL); + FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); UnicodeString errorStr; errorStr.set(buffer); errorStr.trim(); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, NULL); + MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index d1edfbd099f..3e16150c71e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -117,31 +117,31 @@ static NameKeyType buttonBuddiesID = NAMEKEY_INVALID; static NameKeyType buttonSaveReplayID = NAMEKEY_INVALID; static NameKeyType backdropID = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *buttonOk = NULL; -//static GameWindow *buttonRehost = NULL; -static GameWindow *buttonContinue = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *chatBoxBorder = NULL; -static GameWindow *buttonBuddies = NULL; -static GameWindow *staticTextGameSaved = NULL; -static GameWindow *backdrop = NULL; -static GameWindow *challengePortrait = NULL; -static GameWindow *challengeRemarks = NULL; -static GameWindow *challengeWinLossText = NULL; -static GameWindow *gadgetParent = NULL; +static GameWindow *parent = nullptr; +static GameWindow *buttonOk = nullptr; +//static GameWindow *buttonRehost = nullptr; +static GameWindow *buttonContinue = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *chatBoxBorder = nullptr; +static GameWindow *buttonBuddies = nullptr; +static GameWindow *staticTextGameSaved = nullptr; +static GameWindow *backdrop = nullptr; +static GameWindow *challengePortrait = nullptr; +static GameWindow *challengeRemarks = nullptr; +static GameWindow *challengeWinLossText = nullptr; +static GameWindow *gadgetParent = nullptr; static Bool overidePlayerDisplayName = FALSE; //External declarations NameKeyType listboxChatWindowScoreScreenID = NAMEKEY_INVALID; -GameWindow *listboxChatWindowScoreScreen = NULL; +GameWindow *listboxChatWindowScoreScreen = nullptr; NameKeyType listboxAcademyWindowScoreScreenID = NAMEKEY_INVALID; -GameWindow *listboxAcademyWindowScoreScreen = NULL; +GameWindow *listboxAcademyWindowScoreScreen = nullptr; NameKeyType staticTextAcademyTitleID = NAMEKEY_INVALID; -GameWindow *staticTextAcademyTitle = NULL; +GameWindow *staticTextAcademyTitle = nullptr; std::string LastReplayFileName; @@ -152,7 +152,7 @@ void initSinglePlayer( void ); void finishSinglePlayerInit( void ); static Bool s_needToFinishSinglePlayerInit = FALSE; static Bool buttonIsFinishCampaign = FALSE; -static WindowLayout *s_blankLayout = NULL; +static WindowLayout *s_blankLayout = nullptr; void initSkirmish( void ); void initLANMultiPlayer(void); @@ -229,20 +229,20 @@ void startNextCampaignGame(void) void ScoreScreenEnableControls(Bool enable) { // if we are using the button, do the enable thing. - if ((buttonOk != NULL) && (buttonOk->winIsHidden() == FALSE)) { + if ((buttonOk != nullptr) && (buttonOk->winIsHidden() == FALSE)) { buttonOk->winEnable(enable); } - if ((buttonContinue != NULL) && (buttonContinue->winIsHidden() == FALSE)) { + if ((buttonContinue != nullptr) && (buttonContinue->winIsHidden() == FALSE)) { buttonContinue->winEnable(enable); } - if ((buttonBuddies != NULL) && (buttonBuddies->winIsHidden() == FALSE)) { + if ((buttonBuddies != nullptr) && (buttonBuddies->winIsHidden() == FALSE)) { buttonBuddies->winEnable(enable); } GameWindow *buttonSaveReplay = TheWindowManager->winGetWindowFromId( parent, buttonSaveReplayID ); - if ((buttonSaveReplay != NULL) && (buttonSaveReplay->winIsHidden() == FALSE)) { + if ((buttonSaveReplay != nullptr) && (buttonSaveReplay->winIsHidden() == FALSE)) { if (!canSaveReplay) enable = FALSE; buttonSaveReplay->winEnable(enable); @@ -282,7 +282,7 @@ void ScoreScreenInit( WindowLayout *layout, void *userData ) buttonSaveReplayID = TheNameKeyGenerator->nameToKey( "ScoreScreen.wnd:ButtonSaveReplay" ); backdropID = TheNameKeyGenerator->nameToKey( "ScoreScreen.wnd:MainBackdrop" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); textEntryChat = TheWindowManager->winGetWindowFromId( parent, textEntryChatID ); buttonEmote = TheWindowManager->winGetWindowFromId( parent,buttonEmoteID ); @@ -305,7 +305,7 @@ void ScoreScreenInit( WindowLayout *layout, void *userData ) staticTextGameSaved->winHide(TRUE); overidePlayerDisplayName = FALSE; WindowLayout *replayLayout = TheShell->getPopupReplayLayout(); - if (replayLayout != NULL) { + if (replayLayout != nullptr) { replayLayout->hide(TRUE); } canSaveReplay = FALSE; @@ -411,9 +411,9 @@ void ScoreScreenShutdown( WindowLayout *layout, void *userData ) void ScoreScreenUpdate( WindowLayout * layout, void *userData) { WindowLayout *popupReplayLayout = TheShell->getPopupReplayLayout(); - if (popupReplayLayout != NULL) { + if (popupReplayLayout != nullptr) { if (popupReplayLayout->isHidden() == FALSE) { - PopupReplayUpdate(popupReplayLayout, NULL); + PopupReplayUpdate(popupReplayLayout, nullptr); } } @@ -614,7 +614,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, if( controlID == TheNameKeyGenerator->nameToKey(name)) { Bool notBuddy = TRUE; - Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(NULL,controlID)); + Int playerID = (Int)GadgetButtonGetData(TheWindowManager->winGetWindowFromId(nullptr,controlID)); // request to add a buddy BuddyInfoMap *buddies = TheGameSpyInfo->getBuddyMap(); BuddyInfoMap::iterator bIt; @@ -704,25 +704,25 @@ void initSkirmish( void ) void PlayMovieAndBlock(AsciiString movieTitle) { VideoStreamInterface *videoStream = TheVideoPlayer->open( movieTitle ); - if ( videoStream == NULL ) + if ( videoStream == nullptr ) { return; } // Create the new buffer VideoBuffer *videoBuffer = TheDisplay->createVideoBuffer(); - if ( videoBuffer == NULL || + if ( videoBuffer == nullptr || !videoBuffer->allocate( videoStream->width(), videoStream->height()) ) { delete videoBuffer; - videoBuffer = NULL; + videoBuffer = nullptr; if ( videoStream ) { videoStream->close(); - videoStream = NULL; + videoStream = nullptr; } return; @@ -767,15 +767,15 @@ void PlayMovieAndBlock(AsciiString movieTitle) TheDisplay->draw(); } TheWritableGlobalData->m_loadScreenRender = FALSE; - movieWindow->winGetInstanceData()->setVideoBuffer(NULL); + movieWindow->winGetInstanceData()->setVideoBuffer(nullptr); delete videoBuffer; - videoBuffer = NULL; + videoBuffer = nullptr; if (videoStream) { videoStream->close(); - videoStream = NULL; + videoStream = nullptr; } setFPMode(); @@ -959,7 +959,7 @@ void finishSinglePlayerInit( void ) { s_blankLayout->destroyWindows(); deleteInstance(s_blankLayout); - s_blankLayout = NULL; + s_blankLayout = nullptr; } // set keyboard focus to main parent @@ -1595,7 +1595,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); // win->winHide(TRUE); // const PlayerTemplate *fact = player->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { win->winSetEnabledImage(0, fact->getSideIconImage()); } @@ -2139,11 +2139,11 @@ void grabSinglePlayerInfo( void ) ++playerCount; break; } - localPlayer = NULL; + localPlayer = nullptr; } } PlayerTemplate const *fact = ThePlayerList->getLocalPlayer()->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { const Image *image = TheMappedImageCollection->findImageByName(ThePlayerList->getLocalPlayer()->getPlayerTemplate()->getScoreScreen()); if(image) @@ -2192,7 +2192,7 @@ void grabSinglePlayerInfo( void ) sg.m_totalUnitsBuilt = 0; sg.m_totalUnitsDestroyed = 0; sg.m_totalUnitsLost = 0; - sg.m_sideImage = NULL; + sg.m_sideImage = nullptr; Bool populate = FALSE; Color color; for(Int i = 0; i < MAX_PLAYER_COUNT; ++i) @@ -2410,7 +2410,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", i); DEBUG_ASSERTCRASH(win,("Could not find window %s on the score screen", winName.str())); win->winHide(FALSE); const PlayerTemplate *fact = player->getPlayerTemplate(); - if(fact != NULL) + if(fact != nullptr) { win->winSetEnabledImage(0, fact->getSideIconImage()); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp index 5f72983f75d..a396dfccaad 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp @@ -70,19 +70,19 @@ void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); NameKeyType buttonNewID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonNew" ); - GameWindow *buttonNew = TheWindowManager->winGetWindowFromId( NULL, buttonNewID ); + GameWindow *buttonNew = TheWindowManager->winGetWindowFromId( nullptr, buttonNewID ); TheShell->registerWithAnimateManager(buttonNew, WIN_ANIMATION_SLIDE_LEFT, TRUE,1); NameKeyType buttonLoadID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonLoad" ); - GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( NULL, buttonLoadID ); + GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( nullptr, buttonLoadID ); TheShell->registerWithAnimateManager(buttonLoad, WIN_ANIMATION_SLIDE_LEFT, TRUE,200); NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID ); + GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,1); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index d99f370cc3a..b2e09e0c3c2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -71,7 +71,7 @@ #include "WWDownload/Registry.h" -SkirmishGameInfo *TheSkirmishGameInfo = NULL; +SkirmishGameInfo *TheSkirmishGameInfo = nullptr; // window ids ------------------------------------------------------------------------------ static NameKeyType parentSkirmishGameOptionsID = NAMEKEY_INVALID; @@ -118,37 +118,31 @@ static NameKeyType checkBoxLimitSuperweaponsID = NAMEKEY_INVALID; static NameKeyType comboBoxStartingCashID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *staticTextGameSpeed = NULL; -static GameWindow *parentSkirmishGameOptions = NULL; -static GameWindow *buttonExit = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *buttonReset = NULL; -static GameWindow *windowMap = NULL; -static GameWindow *textEntryPlayerName = NULL; -static GameWindow *checkBoxLimitSuperweapons = NULL; -static GameWindow *comboBoxStartingCash = NULL; -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *staticTextGameSpeed = nullptr; +static GameWindow *parentSkirmishGameOptions = nullptr; +static GameWindow *buttonExit = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *buttonReset = nullptr; +static GameWindow *windowMap = nullptr; +static GameWindow *textEntryPlayerName = nullptr; +static GameWindow *checkBoxLimitSuperweapons = nullptr; +static GameWindow *comboBoxStartingCash = nullptr; +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; //external declarations of the Gadgets the callbacks can use -WindowLayout *skirmishMapSelectLayout = NULL; +WindowLayout *skirmishMapSelectLayout = nullptr; static Int initialGadgetDelay = 2; static Bool justEntered = FALSE; @@ -330,7 +324,7 @@ Money SkirmishPreferences::getStartingCash(void) const } Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE, FALSE ); + money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); return money; } @@ -521,7 +515,7 @@ static void startPressed(void) if (it == TheMapCache->end()) { buttonPushed = FALSE; - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:CantFindMap"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:CantFindMap"), nullptr); } MapMetaData mmd = it->second; if(playerCount > mmd.m_numPlayers) @@ -529,13 +523,13 @@ static void startPressed(void) buttonPushed = FALSE; UnicodeString msg; msg.format(TheGameText->fetch("GUI:TooManyPlayers"), mmd.m_numPlayers); - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), msg, NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), msg, nullptr); } /* else if (playerCount < 2 && !sandboxOk) { sandboxOk = TRUE; - MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:SandboxWarning"), NULL); + MessageBoxOk(TheGameText->fetch("GUI:ErrorStartingGame"), TheGameText->fetch("GUI:SandboxWarning"), nullptr); } */ else @@ -579,7 +573,7 @@ void MapSelectorTooltip(GameWindow *window, if ((x > (pixelX + it->x) && x < (pixelX + it->x + SUPPLY_TECH_SIZE)) && ( y > (pixelY + it->y) && y < (pixelY + it->y + SUPPLY_TECH_SIZE))) { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:TechBuilding"), -1, NULL); //, 1.5f + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:TechBuilding"), -1, nullptr); //, 1.5f return; } it++; @@ -594,7 +588,7 @@ void MapSelectorTooltip(GameWindow *window, if ((x > (pixelX + it2->x) && x < (pixelX + it2->x + SUPPLY_TECH_SIZE)) && ( y > (pixelY + it2->y) && y < (pixelY + it2->y + SUPPLY_TECH_SIZE))) { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:SupplyDock"), -1, NULL); // , 1.5f + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:SupplyDock"), -1, nullptr); // , 1.5f break; } it2++; @@ -664,9 +658,9 @@ void positionAdditionalImages( MapMetaData *mmd, GameWindow *mapWindow, Bool for if( !mmd || !mapWindow || mapWindow->winIsHidden()) return; - static MapMetaData *prevMMD = NULL; + static MapMetaData *prevMMD = nullptr; if(force) - prevMMD = NULL; + prevMMD = nullptr; // we already populated the supply and tech image locations. if(mmd == prevMMD) return; @@ -726,9 +720,9 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition std::map::iterator it = TheMapCache->find(lowerMap); if (it == TheMapCache->end()) { - mapWindow->winSetUserData(NULL); + mapWindow->winSetUserData(nullptr); - static const Image *unknownImage = NULL; + static const Image *unknownImage = nullptr; if (!unknownImage) unknownImage = TheMappedImageCollection->findImageByName("UnknownMap"); if (unknownImage) @@ -741,10 +735,10 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition mapWindow->winClearStatus(WIN_STATUS_IMAGE); } - positionAdditionalImages(NULL, mapWindow, TRUE); + positionAdditionalImages(nullptr, mapWindow, TRUE); for (Int i = 0; i < MAX_SLOTS; ++i) { - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -755,7 +749,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition MapMetaData mmd = it->second; Image *image = getMapPreviewImage(mapName); - if (mapWindow != NULL) { + if (mapWindow != nullptr) { mapWindow->winSetUserData((void *)TheMapCache->findMap(mapName)); if(image) { @@ -764,7 +758,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition } else { - static const Image *unknownImage = NULL; + static const Image *unknownImage = nullptr; if (!unknownImage) unknownImage = TheMappedImageCollection->findImageByName("UnknownMap"); if (unknownImage) @@ -791,7 +785,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition { Coord3D *pos = &wmIt->second; positionStartSpotControls(buttonMapStartPositions[i], mapWindow,pos, &mmd, buttonMapStartPositions); - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(FALSE); } @@ -804,7 +798,7 @@ void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPosition // hide the rest for (; i < MAX_SLOTS; ++i) { - if (buttonMapStartPositions[i] != NULL) + if (buttonMapStartPositions[i] != nullptr) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -840,7 +834,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ { for (Int i = 0; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] != NULL ) + if ( buttonMapStartPositions[i] != nullptr ) { buttonMapStartPositions[i]->winHide(TRUE); } @@ -852,7 +846,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ Int i = 0; for(; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] != NULL ) + if ( buttonMapStartPositions[i] != nullptr ) { GadgetButtonSetText(buttonMapStartPositions[i], UnicodeString::TheEmptyString); if (!onLoadScreen) @@ -863,7 +857,7 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ } for( i = 0; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] == NULL ) + if ( buttonMapStartPositions[i] == nullptr ) continue; GameSlot *gs =myGame->getSlot(i); @@ -1083,7 +1077,7 @@ void InitSkirmishGameGadgets( void ) comboBoxStartingCashID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:ComboBoxStartingCash" ); // Initialize the pointers to our gadgets - parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentSkirmishGameOptionsID ); + parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( nullptr, parentSkirmishGameOptionsID ); DEBUG_ASSERTCRASH(parentSkirmishGameOptions, ("Could not find the parentSkirmishGameOptions" )); buttonSelectMap = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions,buttonSelectMapID ); DEBUG_ASSERTCRASH(buttonSelectMap, ("Could not find the buttonSelectMap")); @@ -1104,7 +1098,7 @@ void InitSkirmishGameGadgets( void ) PopulateStartingCashComboBox(comboBoxStartingCash, TheSkirmishGameInfo ); textEntryPlayerNameID = TheNameKeyGenerator->nameToKey( "SkirmishGameOptionsMenu.wnd:TextEntryPlayerName" ); - textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID ); + textEntryPlayerName = TheWindowManager->winGetWindowFromId( nullptr, textEntryPlayerNameID ); DEBUG_ASSERTCRASH(textEntryPlayerName, ("Could not find the textEntryPlayerName" )); windowMap = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions,windowMapID ); @@ -1209,7 +1203,7 @@ void skirmishUpdateSlotList( void ) GadgetTextEntrySetText( textEntryPlayerName, TheSkirmishGameInfo->getSlot(0)->getName() ); UpdateSlotList( TheSkirmishGameInfo, comboBoxPlayer, comboBoxColor, comboBoxPlayerTemplate, - comboBoxTeam, NULL, buttonStart, buttonMapStartPosition ); + comboBoxTeam, nullptr, buttonStart, buttonMapStartPosition ); updateMapStartSpots(TheSkirmishGameInfo, buttonMapStartPosition, FALSE); doUpdateSlotList = TRUE; } @@ -1238,7 +1232,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -1246,7 +1240,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; //------------------------------------------------------------------------------------------------- @@ -1424,7 +1418,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) skirmishUpdateSlotList(); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:SubParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:SubParent")); if(win) win->winHide(TRUE); buttonPushed = FALSE; @@ -1443,14 +1437,14 @@ static void shutdownComplete( WindowLayout *layout ) // our shutdown is complete // what the munkees does this do? - //TheShell->shutdownComplete( layout, (LANnextScreen != NULL) ); + //TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - //if (LANnextScreen != NULL) + //if (LANnextScreen != nullptr) //{ // TheShell->push(LANnextScreen); //} - //LANnextScreen = NULL; + //LANnextScreen = nullptr; } @@ -1462,7 +1456,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) SignalUIInteraction(SHELL_SCRIPT_HOOK_SKIRMISH_CLOSED); TheMouse->setCursor(Mouse::ARROW); - TheMouse->setMouseText(UnicodeString::TheEmptyString,NULL,NULL); + TheMouse->setMouseText(UnicodeString::TheEmptyString,nullptr,nullptr); // if we are shutting down for an immediate pop, skip the animations Bool popImmediate = *(Bool *)userData; if( popImmediate ) @@ -1577,7 +1571,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1655,11 +1649,11 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } TheShell->pop(); delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } // else if ( controlID == buttonResetFPSID ) @@ -1798,7 +1792,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned void populateSkirmishBattleHonors(void) { - GameWindow *list = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:ListboxInfo")); + GameWindow *list = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:ListboxInfo")); if (!list) return; @@ -1811,25 +1805,25 @@ void populateSkirmishBattleHonors(void) Int honors = stats.getHonors(); UnicodeString uStr; - GameWindow *streakWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextStreakValue") ); + GameWindow *streakWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextStreakValue") ); if (streakWindow) { uStr.format(L"%d", stats.getWinStreak()); GadgetStaticTextSetText(streakWindow, uStr); } - GameWindow *bestStreakWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextBestStreakValue") ); + GameWindow *bestStreakWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextBestStreakValue") ); if (bestStreakWindow) { uStr.format(L"%d", stats.getBestWinStreak()); GadgetStaticTextSetText(bestStreakWindow, uStr); } - GameWindow *winsWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextWinsValue") ); + GameWindow *winsWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextWinsValue") ); if (winsWindow) { uStr.format(L"%d", stats.getWins()); GadgetStaticTextSetText(winsWindow, uStr); } - GameWindow *lossesWindow = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextLossesValue") ); + GameWindow *lossesWindow = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("SkirmishGameOptionsMenu.wnd:StaticTextLossesValue") ); if (lossesWindow) { uStr.format(L"%d", stats.getLosses()); @@ -1837,7 +1831,7 @@ void populateSkirmishBattleHonors(void) } ResetBattleHonorInsertion(); - GadgetListBoxAddEntryImage(list, NULL, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 0, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); // FIRST ROW OF HONORS row = 1; column = 0; @@ -1952,7 +1946,7 @@ void populateSkirmishBattleHonors(void) // TEST FOR BATTLE TANK HONOR InsertBattleHonor(list, TheMappedImageCollection->findImageByName("HonorBattleTank"), (honors & BATTLE_HONOR_BATTLE_TANK), BATTLE_HONOR_BATTLE_TANK, row, column); - GadgetListBoxAddEntryImage(list, NULL, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); + GadgetListBoxAddEntryImage(list, nullptr, 2, 0, 10, 10, TRUE, GameMakeColor(255,255,255,255)); // NEXT ROW OF HONORS row = 3; column = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 42ad7642cb6..32ea190a7c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -49,34 +49,33 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; -static GameWindow *parent = NULL; -static GameWindow *mapList = NULL; +static GameWindow *parent = nullptr; +static GameWindow *mapList = nullptr; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *winMapPreview = NULL; +static GameWindow *winMapPreview = nullptr; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; static void NullifyControls() { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; inameToKey( "SkirmishGameOptionsMenu.wnd:SkirmishGameOptionsMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!parent) return; @@ -252,7 +251,7 @@ void SkirmishMapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -528,7 +527,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } skirmishPositionStartSpots(); @@ -594,7 +593,7 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn { skirmishMapSelectLayout->destroyWindows(); deleteInstance(skirmishMapSelectLayout); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout = nullptr; } //TheShell->pop(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index e109cfb88e0..9634ee67db4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -77,26 +77,26 @@ static NameKeyType buttonNotificationID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = NULL; -static GameWindow *buttonHide = NULL; -static GameWindow *buttonAddBuddy = NULL; -static GameWindow *buttonDeleteBuddy = NULL; -static GameWindow *textEntry = NULL; -static GameWindow *listboxBuddy = NULL; -static GameWindow *listboxChat = NULL; -static GameWindow *buttonAcceptBuddy = NULL; -static GameWindow *buttonDenyBuddy = NULL; -static GameWindow *radioButtonBuddies = NULL; -static GameWindow *radioButtonIgnore = NULL; -static GameWindow *parentBuddies = NULL; -static GameWindow *parentIgnore = NULL; -static GameWindow *listboxIgnore = NULL; +static GameWindow *parent = nullptr; +static GameWindow *buttonHide = nullptr; +static GameWindow *buttonAddBuddy = nullptr; +static GameWindow *buttonDeleteBuddy = nullptr; +static GameWindow *textEntry = nullptr; +static GameWindow *listboxBuddy = nullptr; +static GameWindow *listboxChat = nullptr; +static GameWindow *buttonAcceptBuddy = nullptr; +static GameWindow *buttonDenyBuddy = nullptr; +static GameWindow *radioButtonBuddies = nullptr; +static GameWindow *radioButtonIgnore = nullptr; +static GameWindow *parentBuddies = nullptr; +static GameWindow *parentIgnore = nullptr; +static GameWindow *listboxIgnore = nullptr; static Bool isOverlayActive = false; void insertChat( BuddyMessage msg ); // RightClick pointers --------------------------------------------------------------------- -static GameWindow *rcMenu = NULL; -static WindowLayout *noticeLayout = NULL; +static GameWindow *rcMenu = nullptr; +static WindowLayout *noticeLayout = nullptr; static UnsignedInt noticeExpires = 0; enum { NOTIFICATION_EXPIRES = 3000 }; @@ -125,11 +125,11 @@ class BuddyControls static BuddyControls buddyControls; BuddyControls::BuddyControls( void ) { - listboxChat = NULL; + listboxChat = nullptr; listboxChatID = NAMEKEY_INVALID; - listboxBuddies = NULL; + listboxBuddies = nullptr; listboxBuddiesID = NAMEKEY_INVALID; - textEntryEdit = NULL; + textEntryEdit = nullptr; textEntryEditID = NAMEKEY_INVALID; isInit = FALSE; } @@ -147,41 +147,41 @@ void InitBuddyControls(Int type) if(!TheGameSpyInfo) { buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = NULL; + buddyControls.textEntryEdit = nullptr; buddyControls.listboxBuddiesID = NAMEKEY_INVALID; buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = NULL; - buddyControls.listboxChat = NULL; + buddyControls.listboxBuddies = nullptr; + buddyControls.listboxChat = nullptr; buddyControls.isInit = FALSE; return; } switch (type) { case BUDDY_RESETALL_CRAP: buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = NULL; + buddyControls.textEntryEdit = nullptr; buddyControls.listboxBuddiesID = NAMEKEY_INVALID; buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = NULL; - buddyControls.listboxChat = NULL; + buddyControls.listboxBuddies = nullptr; + buddyControls.listboxChat = nullptr; buddyControls.isInit = FALSE; break; case BUDDY_WINDOW_BUDDIES: buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(NULL, buddyControls.textEntryEditID); + buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddies" ); buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxChatID); + buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); + buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); buddyControls.isInit = TRUE; break; case BUDDY_WINDOW_DIPLOMACY: buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(NULL, buddyControls.textEntryEditID); + buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddies" ); buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( NULL, buddyControls.listboxChatID); + buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); + buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); buddyControls.isInit = TRUE; break; @@ -311,7 +311,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, // save message for future incarnations of the buddy window BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); BuddyMessage message; - message.m_timestamp = time(NULL); + message.m_timestamp = time(nullptr); message.m_senderID = TheGameSpyInfo->getLocalProfileID(); message.m_senderNick = TheGameSpyInfo->getLocalBaseName(); message.m_recipientID = selectedProfile; @@ -653,7 +653,7 @@ void showNotificationBox( AsciiString nick, UnicodeString message) { buttonNotificationID = TheNameKeyGenerator->nameToKey("PopupBuddyListNotification.wnd:ButtonNotification"); } - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,buttonNotificationID); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,buttonNotificationID); if(!win) { deleteNotificationBox(); @@ -689,7 +689,7 @@ void deleteNotificationBox( void ) { noticeLayout->destroyWindows(); deleteInstance(noticeLayout); - noticeLayout = NULL; + noticeLayout = nullptr; } } @@ -725,7 +725,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) listboxIgnoreID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxIgnore" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); buttonHide = TheWindowManager->winGetWindowFromId( parent, buttonHideID); buttonAddBuddy = TheWindowManager->winGetWindowFromId( parent, buttonAddBuddyID); buttonDeleteBuddy = TheWindowManager->winGetWindowFromId( parent, buttonDeleteBuddyID); @@ -766,7 +766,7 @@ void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData ) { - listboxIgnore = NULL; + listboxIgnore = nullptr; // hide menu layout->hide( TRUE ); @@ -1141,7 +1141,7 @@ static NameKeyType buttonPlayID = NAMEKEY_INVALID; static NameKeyType buttonIgnoreID = NAMEKEY_INVALID; static NameKeyType buttonStatsID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -//static GameWindow *rCparent = NULL; +//static GameWindow *rCparent = nullptr; //------------------------------------------------------------------------------------------------- @@ -1171,7 +1171,7 @@ static void closeRightClickMenu(GameWindow *win) return; winLay->destroyWindows(); deleteInstance(winLay); - winLay = NULL; + winLay = nullptr; } } @@ -1199,7 +1199,7 @@ void RequestBuddyAdd(Int profileID, AsciiString nick) // save message for future incarnations of the buddy window BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); BuddyMessage message; - message.m_timestamp = time(NULL); + message.m_timestamp = time(nullptr); message.m_senderID = 0; message.m_senderNick = ""; message.m_recipientID = TheGameSpyInfo->getLocalProfileID(); @@ -1240,14 +1240,14 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn case GWM_DESTROY: { - rcMenu = NULL; + rcMenu = nullptr; break; } case GGM_CLOSE: { closeRightClickMenu(window); - //rcMenu = NULL; + //rcMenu = nullptr; break; } @@ -1271,9 +1271,9 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn isRequest = TRUE; delete rcData; - rcData = NULL; + rcData = nullptr; - window->winSetUserData(NULL); + window->winSetUserData(nullptr); //DEBUG_ASSERTCRASH(profileID > 0, ("Bad profile ID in user data!")); if( controlID == buttonAddID ) @@ -1426,7 +1426,7 @@ void refreshIgnoreList( void ) UnicodeString name; name.translate(aName); Int pos = GadgetListBoxAddEntryText(listboxIgnore, name, GameMakeColor(255,100,100,255),-1); - GadgetListBoxSetItemData(listboxIgnore, 0,pos ); + GadgetListBoxSetItemData(listboxIgnore, nullptr,pos ); ++iListIt; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp index 359cac5d116..861ebd1aa4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp @@ -54,9 +54,9 @@ static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; static NameKeyType buttonLobbyID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLCustomScore = NULL; -static GameWindow *buttonDisconnect = NULL; -static GameWindow *buttonLobby = NULL; +static GameWindow *parentWOLCustomScore = nullptr; +static GameWindow *buttonDisconnect = nullptr; +static GameWindow *buttonLobby = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -66,9 +66,9 @@ void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData ) parentWOLCustomScoreID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:WOLCustomScoreScreenParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonDisconnect" ); buttonLobbyID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonLobby" ); - parentWOLCustomScore = TheWindowManager->winGetWindowFromId( NULL, parentWOLCustomScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); - buttonLobby = TheWindowManager->winGetWindowFromId( NULL, buttonLobbyID); + parentWOLCustomScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLCustomScoreID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); + buttonLobby = TheWindowManager->winGetWindowFromId( nullptr, buttonLobbyID); /* if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index c5a6755723a..bd6e95960b7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -87,7 +87,7 @@ void slotListDebugLog(const char *fmt, ...) { UnicodeString msg; msg.translate(buf); - TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], nullptr); } } #define SLOTLIST_DEBUG_LOG(x) slotListDebugLog x @@ -134,7 +134,7 @@ void SendStatsToOtherPlayers(const GameInfo *game) // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static Bool launchGameNext = FALSE; @@ -199,53 +199,44 @@ static NameKeyType comboBoxStartingCashID = NAMEKEY_INVALID; static NameKeyType checkBoxLimitArmiesID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLGameSetup = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonSelectMap = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *textEntryMapDisplay = NULL; -static GameWindow *windowMap = NULL; -static GameWindow *checkBoxUseStats = NULL; -static GameWindow *checkBoxLimitSuperweapons = NULL; -static GameWindow *comboBoxStartingCash = NULL; -static GameWindow *checkBoxLimitArmies = NULL; - -static GameWindow *comboBoxPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *staticTextPlayer[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; -static GameWindow *buttonAccept[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxColor[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -static GameWindow *comboBoxTeam[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; - -//static GameWindow *buttonStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, -// NULL,NULL,NULL,NULL }; +static GameWindow *parentWOLGameSetup = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonSelectMap = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *textEntryMapDisplay = nullptr; +static GameWindow *windowMap = nullptr; +static GameWindow *checkBoxUseStats = nullptr; +static GameWindow *checkBoxLimitSuperweapons = nullptr; +static GameWindow *comboBoxStartingCash = nullptr; +static GameWindow *checkBoxLimitArmies = nullptr; + +static GameWindow *comboBoxPlayer[MAX_SLOTS] = {0}; +static GameWindow *staticTextPlayer[MAX_SLOTS] = {0}; +static GameWindow *buttonAccept[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxColor[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxPlayerTemplate[MAX_SLOTS] = {0}; + +static GameWindow *comboBoxTeam[MAX_SLOTS] = {0}; + +//static GameWindow *buttonStartPosition[MAX_SLOTS] = {0}; // -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; -static GameWindow *genericPingWindow[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *genericPingWindow[MAX_SLOTS] = {0}; -static const Image *pingImages[3] = { NULL, NULL, NULL }; +static const Image *pingImages[3] = { nullptr, nullptr, nullptr }; -WindowLayout *WOLMapSelectLayout = NULL; +WindowLayout *WOLMapSelectLayout = nullptr; void PopBackToLobby( void ) { // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; if (TheGameSpyInfo) // this can be blown away by a disconnect on the map transfer screen { @@ -268,14 +259,14 @@ void positionStartSpots(AsciiString mapName, GameWindow *buttonMapStartPositions void WOLPositionStartSpots( void ) { GameWindow *win = windowMap; - if (WOLMapSelectLayout != NULL) { - win = TheWindowManager->winGetWindowFromId(NULL, windowMapSelectMapID); + if (WOLMapSelectLayout != nullptr) { + win = TheWindowManager->winGetWindowFromId(nullptr, windowMapSelectMapID); // get the controls. NameKeyType listboxMapID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:ListboxMap" ); - GameWindow *listboxMap = TheWindowManager->winGetWindowFromId( NULL, listboxMapID ); + GameWindow *listboxMap = TheWindowManager->winGetWindowFromId( nullptr, listboxMapID ); - if (listboxMap != NULL) { + if (listboxMap != nullptr) { Int selected; UnicodeString map; @@ -304,7 +295,7 @@ void WOLPositionStartSpots( void ) } } else { - DEBUG_ASSERTCRASH(win != NULL, ("no map preview window")); + DEBUG_ASSERTCRASH(win != nullptr, ("no map preview window")); positionStartSpots( TheGameSpyInfo->getCurrentStagingRoom(), buttonMapStartPosition, win); } } @@ -351,21 +342,21 @@ static void playerTooltip(GameWindow *window, } if (slotIdx < 0) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } GameSpyStagingRoom *game = TheGameSpyInfo->getCurrentStagingRoom(); if (!game) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } GameSpyGameSlot *slot = game->getGameSpySlot(slotIdx); if (!slot || !slot->isHuman()) { - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( UnicodeString::TheEmptyString, -1, nullptr, 1.5f ); return; } @@ -385,7 +376,7 @@ static void playerTooltip(GameWindow *window, PlayerInfoMap::iterator pmIt = TheGameSpyInfo->getPlayerInfoMap()->find(aName); if (pmIt == TheGameSpyInfo->getPlayerInfoMap()->end()) { - TheMouse->setCursorTooltip( uName, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( uName, -1, nullptr, 1.5f ); return; } Int profileID = pmIt->second.m_profileID; @@ -393,7 +384,7 @@ static void playerTooltip(GameWindow *window, PSPlayerStats stats = TheGameSpyPSMessageQueue->findPlayerStatsByID(profileID); if (stats.id == 0) { - TheMouse->setCursorTooltip( uName, -1, NULL, 1.5f ); + TheMouse->setCursorTooltip( uName, -1, nullptr, 1.5f ); return; } @@ -484,7 +475,7 @@ static void playerTooltip(GameWindow *window, tooltip.concat(playerInfo); - TheMouse->setCursorTooltip( tooltip, -1, NULL, 1.5f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( tooltip, -1, nullptr, 1.5f ); // the text and width are the only params used. the others are the default values. } void gameAcceptTooltip(GameWindow *window, WinInstanceData *instData, UnsignedInt mouse) @@ -501,7 +492,7 @@ void gameAcceptTooltip(GameWindow *window, WinInstanceData *instData, UnsignedIn if ((x > winPosX && x < (winPosX + winWidth)) && (y > winPosY && y < (winPosY + winHeight))) { - TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:GameAcceptance"), -1, NULL); + TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:GameAcceptance"), -1, nullptr); } } @@ -520,12 +511,12 @@ void pingTooltip(GameWindow *window, WinInstanceData *instData, UnsignedInt mous if ((x > winPosX && x < (winPosX + winWidth)) && (y > winPosY && y < (winPosY + winHeight))) { - TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:ConnectionSpeed"), -1, NULL); + TheMouse->setCursorTooltip(TheGameText->fetch("TOOLTIP:ConnectionSpeed"), -1, nullptr); } } //external declarations of the Gadgets the callbacks can use -GameWindow *listboxGameSetupChat = NULL; +GameWindow *listboxGameSetupChat = nullptr; NameKeyType listboxGameSetupChatID = NAMEKEY_INVALID; static void handleColorSelection(int index) @@ -937,7 +928,7 @@ static void StartPressed(void) // we've started, there's no going back // i.e. disable the back button. buttonBack->winEnable(FALSE); - GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); + GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -967,7 +958,7 @@ void WOLDisplayGameOptions( void ) if (!parentWOLGameSetup || !theGame) return; - const GameSlot *localSlot = NULL; + const GameSlot *localSlot = nullptr; if (theGame->getLocalSlotNum() >= 0) localSlot = theGame->getConstSlot(theGame->getLocalSlotNum()); @@ -1126,7 +1117,7 @@ void InitWOLGameGadgets( void ) NameKeyType staticTextTitleID = NAMEKEY("GameSpyGameOptionsMenu.wnd:StaticTextGameName"); // Initialize the pointers to our gadgets - parentWOLGameSetup = TheWindowManager->winGetWindowFromId( NULL, parentWOLGameSetupID ); + parentWOLGameSetup = TheWindowManager->winGetWindowFromId( nullptr, parentWOLGameSetupID ); buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); checkBoxUseStats = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxUseStatsID ); @@ -1268,7 +1259,7 @@ void InitWOLGameGadgets( void ) if( buttonAccept[0] ) buttonAccept[0]->winEnable(TRUE); - if (buttonBack != NULL) + if (buttonBack != nullptr) { buttonBack->winEnable(TRUE); } @@ -1277,35 +1268,35 @@ void InitWOLGameGadgets( void ) void DeinitWOLGameGadgets( void ) { - parentWOLGameSetup = NULL; - buttonEmote = NULL; - buttonSelectMap = NULL; - buttonStart = NULL; - buttonBack = NULL; - listboxGameSetupChat = NULL; - textEntryChat = NULL; - textEntryMapDisplay = NULL; + parentWOLGameSetup = nullptr; + buttonEmote = nullptr; + buttonSelectMap = nullptr; + buttonStart = nullptr; + buttonBack = nullptr; + listboxGameSetupChat = nullptr; + textEntryChat = nullptr; + textEntryMapDisplay = nullptr; if (windowMap) { - windowMap->winSetUserData(NULL); - windowMap = NULL; + windowMap->winSetUserData(nullptr); + windowMap = nullptr; } - checkBoxUseStats = NULL; - checkBoxLimitSuperweapons = NULL; - comboBoxStartingCash = NULL; + checkBoxUseStats = nullptr; + checkBoxLimitSuperweapons = nullptr; + comboBoxStartingCash = nullptr; -// GameWindow *staticTextTitle = NULL; +// GameWindow *staticTextTitle = nullptr; for (Int i = 0; i < MAX_SLOTS; i++) { - comboBoxPlayer[i] = NULL; - staticTextPlayer[i] = NULL; - comboBoxColor[i] = NULL; - comboBoxPlayerTemplate[i] = NULL; - comboBoxTeam[i] = NULL; - buttonAccept[i] = NULL; -// buttonStartPosition[i] = NULL; - buttonMapStartPosition[i] = NULL; - genericPingWindow[i] = NULL; + comboBoxPlayer[i] = nullptr; + staticTextPlayer[i] = nullptr; + comboBoxColor[i] = nullptr; + comboBoxPlayerTemplate[i] = nullptr; + comboBoxTeam[i] = nullptr; + buttonAccept[i] = nullptr; +// buttonStartPosition[i] = nullptr; + buttonMapStartPosition[i] = nullptr; + genericPingWindow[i] = nullptr; } } @@ -1353,9 +1344,9 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) TheGameSpyInfo->setCurrentGroupRoom(0); delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; launchGameNext = FALSE; @@ -1395,7 +1386,7 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) // Make sure host follows the old factions only restrictions! const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(hostSlot->getPlayerTemplate()); - if ( fac != NULL && !fac->isOldFaction() ) + if ( fac != nullptr && !fac->isOldFaction() ) { hostSlot->setPlayerTemplate( PLAYERTEMPLATE_RANDOM ); } @@ -1508,9 +1499,9 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { if (!TheGameSpyPeerMessageQueue || !TheGameSpyPeerMessageQueue->isConnected()) { @@ -1530,7 +1521,7 @@ static void shutdownComplete( WindowLayout *layout ) } */ - nextScreen = NULL; + nextScreen = nullptr; } @@ -1545,12 +1536,12 @@ void WOLGameSetupMenuShutdown( WindowLayout *layout, void *userData ) { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } - parentWOLGameSetup = NULL; + parentWOLGameSetup = nullptr; EnableSlotListUpdates(FALSE); DeinitWOLGameGadgets(); - if (TheEstablishConnectionsMenu != NULL) + if (TheEstablishConnectionsMenu != nullptr) { TheEstablishConnectionsMenu->endMenu(); } @@ -1612,7 +1603,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) if (TheGameSpyGame && TheGameSpyGame->isGameInProgress()) { - if (TheGameSpyInfo->isDisconnectedAfterGameStart(NULL)) + if (TheGameSpyInfo->isDisconnectedAfterGameStart(nullptr)) { return; // already been disconnected, so don't worry. } @@ -1632,7 +1623,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // check for scorescreen NameKeyType listboxChatWindowScoreScreenID = NAMEKEY("ScoreScreen.wnd:ListboxChatWindowScoreScreen"); - GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowScoreScreenID ); + GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowScoreScreenID ); if (listboxChatWindowScoreScreen) { GadgetListBoxAddEntryText(listboxChatWindowScoreScreen, TheGameText->fetch(disconMunkee), @@ -1672,7 +1663,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) return; } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1690,7 +1681,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; TheGameSpyInfo->getCurrentStagingRoom()->reset(); TheGameSpyInfo->leaveStagingRoom(); @@ -1728,7 +1719,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) case PeerResponse::PEERRESPONSE_FAILEDTOHOST: { // oops - we've not heard from the qr server. bail. - TheGameSpyInfo->addText(TheGameText->fetch("GUI:GSFailedToHost"), GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(TheGameText->fetch("GUI:GSFailedToHost"), GameSpyColor[GSCOLOR_DEFAULT], nullptr); } break; case PeerResponse::PEERRESPONSE_GAMESTART: @@ -1746,7 +1737,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // we've started, there's no going back // i.e. disable the back button. buttonBack->winEnable(FALSE); - GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); + GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(nullptr, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -1828,7 +1819,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // now get the number of starting spots on the map. Int numStartingSpots = MAX_SLOTS; const MapMetaData *md = TheMapCache->findMap(game->getMap()); - if (md != NULL) + if (md != nullptr) { numStartingSpots = md->m_numPlayers; } @@ -1887,7 +1878,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) break; } - if (TheNAT == NULL) // don't update slot list if we're trying to start a game + if (TheNAT == nullptr) // don't update slot list if we're trying to start a game { GameInfo *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -2143,7 +2134,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (stricmp(resp.command.c_str(), "NAT") == 0) { - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } @@ -2187,7 +2178,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) Int slotNum = game->getSlotNum(resp.nick.c_str()); if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); } } @@ -2305,7 +2296,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) if ( game->oldFactionsOnly() ) { const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(val); - if ( fac != NULL && !fac->isOldFaction()) + if ( fac != nullptr && !fac->isOldFaction()) { val = PLAYERTEMPLATE_RANDOM; } @@ -2506,19 +2497,19 @@ Bool handleGameSetupSlashCommands(UnicodeString uText) { UnicodeString s; s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "me" && uText.getLength()>4) { - TheGameSpyInfo->sendChat(UnicodeString(uText.str()+4), TRUE, NULL); + TheGameSpyInfo->sendChat(UnicodeString(uText.str()+4), TRUE, nullptr); return TRUE; // was a slash command } #if defined(RTS_DEBUG) else if (token == "slots") { g_debugSlots = !g_debugSlots; - TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "discon") @@ -2587,7 +2578,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -2693,11 +2684,11 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } TheGameSpyInfo->getCurrentStagingRoom()->reset(); - //peerLeaveRoom(TheGameSpyChat->getPeer(), StagingRoom, NULL); + //peerLeaveRoom(TheGameSpyChat->getPeer(), StagingRoom, nullptr); TheGameSpyInfo->leaveStagingRoom(); buttonPushed = true; nextScreen = "Menus/WOLCustomLobby.wnd"; @@ -2719,7 +2710,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg txtInput.trim(); // Echo the user's input to the chat window if (!txtInput.isEmpty()) - TheGameSpyInfo->sendChat(txtInput, FALSE, NULL); // 'emote' button is now carriage-return + TheGameSpyInfo->sendChat(txtInput, FALSE, nullptr); // 'emote' button is now carriage-return } else if ( controlID == buttonSelectMapID ) { @@ -2865,7 +2856,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg { if (!handleGameSetupSlashCommands(txtInput)) { - TheGameSpyInfo->sendChat(txtInput, false, NULL); + TheGameSpyInfo->sendChat(txtInput, false, nullptr); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp index 2e02bd29604..af3f8f4b1fe 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp @@ -45,9 +45,9 @@ static NameKeyType windowLadderID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- -static GameWindow *parentWindow = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *windowLadder = NULL; +static GameWindow *parentWindow = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *windowLadder = nullptr; //------------------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) buttonBackID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:ButtonBack" ); windowLadderID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:WindowLadder" ); - parentWindow = TheWindowManager->winGetWindowFromId( NULL, parentWindowID ); + parentWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWindowID ); buttonBack = TheWindowManager->winGetWindowFromId( parentWindow, buttonBackID ); windowLadder = TheWindowManager->winGetWindowFromId( parentWindow, windowLadderID ); @@ -70,7 +70,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) // PopulateReplayFileListbox(listboxReplayFiles); //TheWebBrowser->createBrowserWindow("Westwood", windowLadder); - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->createBrowserWindow("MessageBoard", windowLadder); } @@ -89,7 +89,7 @@ void WOLLadderScreenInit( WindowLayout *layout, void *userData ) void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) { - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->closeBrowserWindow(windowLadder); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 9f98a002a8c..6234fcf83d5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -84,7 +84,7 @@ static LogClass s_perfLog("Perf.txt"); // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static time_t gameListRefreshTime = 0; static const time_t gameListRefreshInterval = 10000; @@ -111,18 +111,18 @@ static NameKeyType comboLobbyGroupRoomsID = NAMEKEY_INVALID; //static NameKeyType // sliderChatAdjustID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLLobby = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonHost = NULL; -static GameWindow *buttonRefresh = NULL; -static GameWindow *buttonJoin = NULL; -static GameWindow *buttonBuddy = NULL; -static GameWindow *buttonEmote = NULL; -static GameWindow *textEntryChat = NULL; -static GameWindow *listboxLobbyPlayers = NULL; -static GameWindow *listboxLobbyChat = NULL; -static GameWindow *comboLobbyGroupRooms = NULL; -static GameWindow *parent = NULL; +static GameWindow *parentWOLLobby = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonHost = nullptr; +static GameWindow *buttonRefresh = nullptr; +static GameWindow *buttonJoin = nullptr; +static GameWindow *buttonBuddy = nullptr; +static GameWindow *buttonEmote = nullptr; +static GameWindow *textEntryChat = nullptr; +static GameWindow *listboxLobbyPlayers = nullptr; +static GameWindow *listboxLobbyChat = nullptr; +static GameWindow *comboLobbyGroupRooms = nullptr; +static GameWindow *parent = nullptr; static Int groupRoomToJoin = 0; static Int initialGadgetDelay = 2; @@ -160,7 +160,7 @@ Bool handleLobbySlashCommands(UnicodeString uText) { UnicodeString s; s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(s, GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "me" && uText.getLength()>4) @@ -201,13 +201,13 @@ Bool handleLobbySlashCommands(UnicodeString uText) else if (token == "fakecrc") { g_fakeCRC = !g_fakeCRC; - TheGameSpyInfo->addText(L"Toggled CRC fakery", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled CRC fakery", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } else if (token == "slots") { g_debugSlots = !g_debugSlots; - TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(L"Toggled SlotList debug", GameSpyColor[GSCOLOR_DEFAULT], nullptr); return TRUE; // was a slash command } #endif @@ -326,7 +326,7 @@ static void playerTooltip(GameWindow *window, tmp.format(L"\n%ls %ls", TheGameText->fetch(sideName).str(), TheGameText->fetch(rankName).str()); tooltip.concat(tmp); - TheMouse->setCursorTooltip( tooltip, -1, NULL, 1.5f ); // the text and width are the only params used. the others are the default values. + TheMouse->setCursorTooltip( tooltip, -1, nullptr, 1.5f ); // the text and width are the only params used. the others are the default values. } static void populateGroupRoomListbox(GameWindow *lb) @@ -384,7 +384,7 @@ static_assert(ARRAY_SIZE(rankNames) == MAX_RANKS, "Incorrect array size"); const Image* LookupSmallRankImage(Int side, Int rankPoints) { if (rankPoints == 0) - return NULL; + return nullptr; Int rank = 0; Int i = 0; @@ -393,7 +393,7 @@ const Image* LookupSmallRankImage(Int side, Int rankPoints) rank = i; if (rank < 0 || rank >= 10) - return NULL; + return nullptr; AsciiString sideStr = "N"; switch(side) @@ -468,7 +468,7 @@ static Int insertPlayerInListbox(const PlayerInfo& info, Color color) w = min(GadgetListBoxGetColumnWidth(listboxLobbyPlayers, 0), w); Int h = w; if (!isPreorder) - preorderImg = NULL; + preorderImg = nullptr; const Image *rankImg = LookupSmallRankImage(currentSide, currentRank); @@ -599,7 +599,7 @@ void PopulateLobbyPlayerListbox(void) if (indicesToSelect.size() != numSelected) { - TheWindowManager->winSetLoneWindow(NULL); + TheWindowManager->winSetLoneWindow(nullptr); } // restore top visible entry @@ -613,7 +613,7 @@ void PopulateLobbyPlayerListbox(void) //------------------------------------------------------------------------------------------------- void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; @@ -623,7 +623,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) playerListRefreshTime = 0; parentWOLLobbyID = TheNameKeyGenerator->nameToKey( "WOLCustomLobby.wnd:WOLLobbyMenuParent" ); - parent = TheWindowManager->winGetWindowFromId(NULL, parentWOLLobbyID); + parent = TheWindowManager->winGetWindowFromId(nullptr, parentWOLLobbyID); buttonBackID = TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:ButtonBack"); buttonBack = TheWindowManager->winGetWindowFromId(parent, buttonBackID); @@ -718,7 +718,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) TheLobbyQueuedUTMs.clear(); justEntered = TRUE; initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:GadgetParent")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("WOLCustomLobby.wnd:GadgetParent")); if(win) win->winHide(TRUE); DontShowMainMenu = TRUE; @@ -737,14 +737,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -778,8 +778,8 @@ void WOLLobbyMenuShutdown( WindowLayout *layout, void *userData ) req.peerRequestType = PeerRequest::PEERREQUEST_STOPGAMELIST; TheGameSpyPeerMessageQueue->addRequest(req); - listboxLobbyChat = NULL; - listboxLobbyPlayers = NULL; + listboxLobbyChat = nullptr; + listboxLobbyPlayers = nullptr; isShuttingDown = true; @@ -969,7 +969,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) GameSpyGroupRoom room = iter->second; UnicodeString msg; msg.format(TheGameText->fetch("GUI:LobbyJoined"), room.m_translatedName.str()); - TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], NULL); + TheGameSpyInfo->addText(msg, GameSpyColor[GSCOLOR_DEFAULT], nullptr); } } else @@ -1589,7 +1589,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, break; #endif } - Bool unknownLadder = (roomToJoin->getLadderPort() && TheLadderList->findLadder(roomToJoin->getLadderIP(), roomToJoin->getLadderPort()) == NULL); + Bool unknownLadder = (roomToJoin->getLadderPort() && TheLadderList->findLadder(roomToJoin->getLadderIP(), roomToJoin->getLadderPort()) == nullptr); if (unknownLadder) { GSMessageBoxOk(TheGameText->fetch("GUI:JoinFailedDefault"), TheGameText->fetch("GUI:JoinFailedUnknownLadder")); @@ -1623,12 +1623,12 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameInfo"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameInfo"), nullptr); } } else { - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameSelected"), NULL); + GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:NoGameSelected"), nullptr); } } else if ( controlID == buttonBuddyID ) @@ -1727,7 +1727,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, if( controlID == listboxLobbyPlayersID ) { RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout = NULL; + WindowLayout *rcLayout = nullptr; GameWindow *rcMenu; if(rc->pos < 0) { @@ -1789,7 +1789,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg, else if( controlID == GetGameListBoxID() ) { RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout = NULL; + WindowLayout *rcLayout = nullptr; GameWindow *rcMenu; if(rc->pos < 0) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp index 9c8aa8db08f..8a854851655 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp @@ -56,9 +56,9 @@ static NameKeyType buttonOkID = NAMEKEY_INVALID; static NameKeyType listboxLocaleID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLocaleSelect = NULL; -static GameWindow *buttonOk = NULL; -static GameWindow *listboxLocale = NULL; +static GameWindow *parentLocaleSelect = nullptr; +static GameWindow *buttonOk = nullptr; +static GameWindow *listboxLocale = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -68,9 +68,9 @@ void WOLLocaleSelectInit( WindowLayout *layout, void *userData ) parentLocaleSelectID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ParentLocaleSelect" ); buttonOkID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ButtonOk" ); listboxLocaleID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ListBoxLocaleSelect" ); - parentLocaleSelect = TheWindowManager->winGetWindowFromId( NULL, parentLocaleSelectID ); - buttonOk = TheWindowManager->winGetWindowFromId( NULL, buttonOkID); - listboxLocale = TheWindowManager->winGetWindowFromId( NULL, listboxLocaleID); + parentLocaleSelect = TheWindowManager->winGetWindowFromId( nullptr, parentLocaleSelectID ); + buttonOk = TheWindowManager->winGetWindowFromId( nullptr, buttonOkID); + listboxLocale = TheWindowManager->winGetWindowFromId( nullptr, listboxLocaleID); for (int i=LOC_MIN; i<=LOC_MAX; ++i) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp index 52955e817d2..994e1dcf461 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp @@ -79,7 +79,7 @@ static Bool useWebBrowserForTOS = FALSE; static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static const UnsignedInt loginTimeoutInMS = 10000; static UnsignedInt loginAttemptTime = 0; @@ -308,7 +308,7 @@ AsciiStringList GameSpyLoginPreferences::getEmails( void ) return theList; } -static GameSpyLoginPreferences *loginPref = NULL; +static GameSpyLoginPreferences *loginPref = nullptr; static void startPings( void ) { @@ -339,30 +339,30 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { if (loginPref) { loginPref->write(); delete loginPref; - loginPref = NULL; + loginPref = nullptr; } TheShell->push(nextScreen); } else { - DEBUG_ASSERTCRASH(loginPref != NULL, ("loginPref == NULL")); + DEBUG_ASSERTCRASH(loginPref != nullptr, ("loginPref == nullptr")); if (loginPref) { loginPref->write(); delete loginPref; - loginPref = NULL; + loginPref = nullptr; } } - nextScreen = NULL; + nextScreen = nullptr; } @@ -389,24 +389,24 @@ static NameKeyType textEntryDayID = NAMEKEY_INVALID; // profile static NameKeyType textEntryYearID = NAMEKEY_INVALID; // profile // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLLogin = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonLogin = NULL; -static GameWindow *buttonCreateAccount = NULL; -static GameWindow *buttonUseAccount = NULL; -static GameWindow *buttonDontUseAccount = NULL; -static GameWindow *buttonTOS = NULL; -static GameWindow *parentTOS = NULL; -static GameWindow *buttonTOSOK = NULL; -static GameWindow *listboxTOS = NULL; -static GameWindow *comboBoxEmail = NULL; -static GameWindow *comboBoxLoginName = NULL; -static GameWindow *textEntryLoginName = NULL; -static GameWindow *textEntryPassword = NULL; -static GameWindow *checkBoxRememberPassword = NULL; -static GameWindow *textEntryMonth = NULL; -static GameWindow *textEntryDay = NULL; -static GameWindow *textEntryYear = NULL; +static GameWindow *parentWOLLogin = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonLogin = nullptr; +static GameWindow *buttonCreateAccount = nullptr; +static GameWindow *buttonUseAccount = nullptr; +static GameWindow *buttonDontUseAccount = nullptr; +static GameWindow *buttonTOS = nullptr; +static GameWindow *parentTOS = nullptr; +static GameWindow *buttonTOSOK = nullptr; +static GameWindow *listboxTOS = nullptr; +static GameWindow *comboBoxEmail = nullptr; +static GameWindow *comboBoxLoginName = nullptr; +static GameWindow *textEntryLoginName = nullptr; +static GameWindow *textEntryPassword = nullptr; +static GameWindow *checkBoxRememberPassword = nullptr; +static GameWindow *textEntryMonth = nullptr; +static GameWindow *textEntryDay = nullptr; +static GameWindow *textEntryYear = nullptr; void EnableLoginControls( Bool state ) { @@ -444,7 +444,7 @@ void EnableLoginControls( Bool state ) //------------------------------------------------------------------------------------------------- void WOLLoginMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; loginAttemptTime = 0; @@ -455,8 +455,8 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) } // if the ESRB warning is blank (other country) hide the box - GameWindow *esrbTitle = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("GameSpyLoginProfile.wnd:StaticTextESRBTop") ); - GameWindow *esrbParent = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("GameSpyLoginProfile.wnd:ParentESRB") ); + GameWindow *esrbTitle = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:StaticTextESRBTop") ); + GameWindow *esrbParent = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:ParentESRB") ); if (esrbTitle && esrbParent) { if ( GadgetStaticTextGetText( esrbTitle ).getLength() < 2 ) @@ -484,24 +484,24 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) textEntryDayID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryDay" ); textEntryYearID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryYear" ); - parentWOLLogin = TheWindowManager->winGetWindowFromId( NULL, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( NULL, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( NULL, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonDontUseAccountID); - buttonTOS = TheWindowManager->winGetWindowFromId( NULL, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( NULL, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( NULL, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( NULL, listboxTOSID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( NULL, comboBoxEmailID); - comboBoxLoginName = TheWindowManager->winGetWindowFromId( NULL, comboBoxLoginNameID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( NULL, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( NULL, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( NULL, checkBoxRememberPasswordID); - textEntryMonth = TheWindowManager->winGetWindowFromId( NULL, textEntryMonthID); - textEntryDay = TheWindowManager->winGetWindowFromId( NULL, textEntryDayID); - textEntryYear = TheWindowManager->winGetWindowFromId( NULL, textEntryYearID); + parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); + buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); + buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); + buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); + buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); + parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); + buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); + listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); + comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); + comboBoxLoginName = TheWindowManager->winGetWindowFromId( nullptr, comboBoxLoginNameID); + textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); + textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); + checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); + textEntryMonth = TheWindowManager->winGetWindowFromId( nullptr, textEntryMonthID); + textEntryDay = TheWindowManager->winGetWindowFromId( nullptr, textEntryDayID); + textEntryYear = TheWindowManager->winGetWindowFromId( nullptr, textEntryYearID); GadgetTextEntrySetText(textEntryMonth, UnicodeString::TheEmptyString); @@ -569,20 +569,20 @@ void WOLLoginMenuInit( WindowLayout *layout, void *userData ) textEntryPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:TextEntryPassword" ); checkBoxRememberPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:CheckBoxRememberPassword" ); - parentWOLLogin = TheWindowManager->winGetWindowFromId( NULL, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( NULL, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( NULL, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( NULL, buttonDontUseAccountID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( NULL, comboBoxEmailID); - buttonTOS = TheWindowManager->winGetWindowFromId( NULL, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( NULL, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( NULL, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( NULL, listboxTOSID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( NULL, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( NULL, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( NULL, checkBoxRememberPasswordID); + parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); + buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); + buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); + buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); + buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); + comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); + buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); + parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); + buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); + listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); + textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); + textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); + checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); DEBUG_ASSERTCRASH(buttonBack, ("buttonBack missing!")); DEBUG_ASSERTCRASH(buttonLogin, ("buttonLogin missing!")); @@ -739,7 +739,7 @@ void WOLLoginMenuShutdown( WindowLayout *layout, void *userData ) TheWindowManager->clearTabList(); if (webBrowserActive) { - if (TheWebBrowser != NULL) + if (TheWebBrowser != nullptr) { TheWebBrowser->closeBrowserWindow(listboxTOS); } @@ -772,7 +772,7 @@ static void checkLogin( void ) DEBUG_LOG(("Ping string is %s", pingStr.str())); TheGameSpyInfo->setPingString(pingStr); //delete ThePinger; - //ThePinger = NULL; + //ThePinger = nullptr; buttonPushed = true; loggedInOK = false; // don't try this again @@ -962,7 +962,7 @@ static Bool isNickOkay(UnicodeString nick) return FALSE; WideChar newChar = nick.getCharAt(len-1); - if (wcschr(legalIRCChars, newChar) == NULL) + if (wcschr(legalIRCChars, newChar) == nullptr) return FALSE; return TRUE; @@ -986,7 +986,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) #define DATE_BUFFER_SIZE 256 char dateBuffer[ DATE_BUFFER_SIZE ]; GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "yyyy", dateBuffer, DATE_BUFFER_SIZE ); Int sysVal = atoi(dateBuffer); @@ -997,7 +997,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) return FALSE; GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "MM", dateBuffer, DATE_BUFFER_SIZE ); sysVal = atoi(dateBuffer); @@ -1008,7 +1008,7 @@ static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) return FALSE; // month.format("%02.2d",userVal); GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, NULL, + 0, nullptr, "dd", dateBuffer, DATE_BUFFER_SIZE ); sysVal = atoi(dateBuffer); @@ -1433,7 +1433,7 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, { parentTOS->winHide(FALSE); useWebBrowserForTOS = FALSE;//loginPref->getBool("UseTOSBrowser", TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != NULL)) + if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) { TheWebBrowser->createBrowserWindow("TermsOfService", listboxTOS); webBrowserActive = TRUE; @@ -1470,10 +1470,10 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, } delete[] fileBuf; - fileBuf = NULL; + fileBuf = nullptr; theFile->close(); - theFile = NULL; + theFile = nullptr; } } EnableLoginControls( FALSE ); @@ -1485,9 +1485,9 @@ WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, EnableLoginControls( TRUE ); parentTOS->winHide(TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != NULL)) + if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) { - if (listboxTOS != NULL) + if (listboxTOS != nullptr) { TheWebBrowser->closeBrowserWindow(listboxTOS); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index ea60f558561..76e1f49f759 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -49,38 +49,37 @@ static NameKeyType buttonBack = NAMEKEY_INVALID; static NameKeyType buttonOK = NAMEKEY_INVALID; static NameKeyType listboxMap = NAMEKEY_INVALID; -static GameWindow *parent = NULL; +static GameWindow *parent = nullptr; static Bool raiseMessageBoxes = FALSE; -static GameWindow *winMapPreview = NULL; +static GameWindow *winMapPreview = nullptr; static NameKeyType winMapPreviewID = NAMEKEY_INVALID; static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; extern WindowLayout *WOLMapSelectLayout; ///< Map selection overlay -static GameWindow *mapList = NULL; +static GameWindow *mapList = nullptr; -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID, NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *winMapWindow = NULL; +static GameWindow *winMapWindow = nullptr; static void NullifyControls(void) { - parent = NULL; - mapList = NULL; + parent = nullptr; + mapList = nullptr; if (winMapPreview) { - winMapPreview->winSetUserData(NULL); - winMapPreview = NULL; + winMapPreview->winSetUserData(nullptr); + winMapPreview = nullptr; } for (Int i=0; iwinGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("GameSpyGameOptionsMenu.wnd:ButtonBack") ); + GameWindow *win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("GameSpyGameOptionsMenu.wnd:ButtonBack") ); if(win) win->winEnable( show ); } @@ -128,7 +127,7 @@ void WOLMapSelectMenuInit( WindowLayout *layout, void *userData ) // set keyboard focus to main parent NameKeyType parentID = TheNameKeyGenerator->nameToKey( "WOLMapSelectMenu.wnd:WOLMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); TheWindowManager->winSetFocus( parent ); @@ -393,7 +392,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } WOLPositionStartSpots(); @@ -461,7 +460,7 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg { WOLMapSelectLayout->destroyWindows(); deleteInstance(WOLMapSelectLayout); - WOLMapSelectLayout = NULL; + WOLMapSelectLayout = nullptr; } showGameSpyGameOptionsUnderlyingGUIElements( TRUE ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp index 7eb372eb8c0..70e057bf6a1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp @@ -50,8 +50,8 @@ static NameKeyType parentWOLMessageWindowID = NAMEKEY_INVALID; static NameKeyType buttonCancelID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLMessageWindow = NULL; -static GameWindow *buttonCancel = NULL; +static GameWindow *parentWOLMessageWindow = nullptr; +static GameWindow *buttonCancel = nullptr; //------------------------------------------------------------------------------------------------- @@ -61,8 +61,8 @@ void WOLMessageWindowInit( WindowLayout *layout, void *userData ) { parentWOLMessageWindowID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:WOLMessageWindowParent" ); buttonCancelID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:ButtonCancel" ); - parentWOLMessageWindow = TheWindowManager->winGetWindowFromId( NULL, parentWOLMessageWindowID ); - buttonCancel = TheWindowManager->winGetWindowFromId( NULL, buttonCancelID); + parentWOLMessageWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWOLMessageWindowID ); + buttonCancel = TheWindowManager->winGetWindowFromId( nullptr, buttonCancelID); // Show Menu diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp index 94b1113afa1..e8df740905f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp @@ -51,9 +51,9 @@ static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; static NameKeyType buttonQuickmatchID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLQMScore = NULL; -static GameWindow *buttonDisconnect = NULL; -static GameWindow *buttonQuickmatch = NULL; +static GameWindow *parentWOLQMScore = nullptr; +static GameWindow *buttonDisconnect = nullptr; +static GameWindow *buttonQuickmatch = nullptr; //------------------------------------------------------------------------------------------------- /** Initialize the WOL Status Menu */ @@ -63,9 +63,9 @@ void WOLQMScoreScreenInit( WindowLayout *layout, void *userData ) parentWOLQMScoreID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:WOLQMScoreScreenParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonDisconnect" ); buttonQuickmatchID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonQuickMatch" ); - parentWOLQMScore = TheWindowManager->winGetWindowFromId( NULL, parentWOLQMScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); - buttonQuickmatch = TheWindowManager->winGetWindowFromId( NULL, buttonQuickmatchID); + parentWOLQMScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLQMScoreID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); + buttonQuickmatch = TheWindowManager->winGetWindowFromId( nullptr, buttonQuickmatchID); /* if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) @@ -99,7 +99,7 @@ void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); - //progressLayout = NULL; + //progressLayout = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 6ebb5c6804a..b4cf7680526 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -103,33 +103,33 @@ static NameKeyType comboBoxColorID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLQuickMatch = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonStart = NULL; -static GameWindow *buttonStop = NULL; -static GameWindow *buttonWiden = NULL; -GameWindow *quickmatchTextWindow = NULL; -static GameWindow *listboxMapSelect = NULL; -//static GameWindow *textEntryMaxDisconnects = NULL; -//static GameWindow *textEntryMaxPoints = NULL; -//static GameWindow *textEntryMinPoints = NULL; -static GameWindow *textEntryWaitTime = NULL; -static GameWindow *comboBoxNumPlayers = NULL; -static GameWindow *comboBoxMaxPing = NULL; -static GameWindow *comboBoxLadder = NULL; -static GameWindow *comboBoxDisabledLadder = NULL; // enable and disable this, but never use it. it is a stand-in for comboBoxLadder for when there are no ladders -static GameWindow *comboBoxMaxDisconnects = NULL; -static GameWindow *staticTextNumPlayers = NULL; -static GameWindow *comboBoxSide = NULL; -static GameWindow *comboBoxColor = NULL; +static GameWindow *parentWOLQuickMatch = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonStart = nullptr; +static GameWindow *buttonStop = nullptr; +static GameWindow *buttonWiden = nullptr; +GameWindow *quickmatchTextWindow = nullptr; +static GameWindow *listboxMapSelect = nullptr; +//static GameWindow *textEntryMaxDisconnects = nullptr; +//static GameWindow *textEntryMaxPoints = nullptr; +//static GameWindow *textEntryMinPoints = nullptr; +static GameWindow *textEntryWaitTime = nullptr; +static GameWindow *comboBoxNumPlayers = nullptr; +static GameWindow *comboBoxMaxPing = nullptr; +static GameWindow *comboBoxLadder = nullptr; +static GameWindow *comboBoxDisabledLadder = nullptr; // enable and disable this, but never use it. it is a stand-in for comboBoxLadder for when there are no ladders +static GameWindow *comboBoxMaxDisconnects = nullptr; +static GameWindow *staticTextNumPlayers = nullptr; +static GameWindow *comboBoxSide = nullptr; +static GameWindow *comboBoxColor = nullptr; static Bool isShuttingDown = false; static Bool buttonPushed = false; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; static Bool raiseMessageBoxes = false; static Bool isInInit = FALSE; -static const Image *selectedImage = NULL; -static const Image *unselectedImage = NULL; +static const Image *selectedImage = nullptr; +static const Image *unselectedImage = nullptr; static bool isPopulatingLadderBox = false; static Int maxPingEntries = 0; @@ -280,7 +280,7 @@ static void populateQMColorComboBox(QuickMatchPreferences& pref) // ----------------------------------------------------------------------------- -static void populateQMSideComboBox(Int favSide, const LadderInfo *li = NULL) +static void populateQMSideComboBox(Int favSide, const LadderInfo *li = nullptr) { Int numPlayerTemplates = ThePlayerTemplateStore->getPlayerTemplateCount(); UnicodeString playerTemplateName; @@ -411,7 +411,7 @@ void PopulateQMLadderListBox( GameWindow *win ) // start with "No Ladder" index = GadgetListBoxAddEntryText( win, TheGameText->fetch("GUI:NoLadder"), normalColor, -1 ); - GadgetListBoxSetItemData( win, 0, index ); + GadgetListBoxSetItemData( win, nullptr, index ); // add the last ladder Int selectedPos = 0; @@ -501,7 +501,7 @@ void PopulateQMLadderComboBox( void ) Int index; GadgetComboBoxReset( comboBoxLadder ); index = GadgetComboBoxAddEntry( comboBoxLadder, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxLadder, index, 0 ); + GadgetComboBoxSetItemData( comboBoxLadder, index, nullptr ); std::set usedLadders; @@ -562,7 +562,7 @@ static void populateQuickMatchMapSelectListbox( QuickMatchPreferences& pref ) GadgetComboBoxGetSelectedPos( comboBoxLadder, &selected ); index = (Int)GadgetComboBoxGetItemData( comboBoxLadder, selected ); const LadderInfo *li = TheLadderList->findLadderByIndex( index ); - //listboxMapSelect->winEnable( li == NULL || li->randomMaps == FALSE ); + //listboxMapSelect->winEnable( li == nullptr || li->randomMaps == FALSE ); Int numPlayers = 0; if (li) @@ -715,13 +715,13 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) } } - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = false; isShuttingDown = false; raiseMessageBoxes = true; delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; parentWOLQuickMatchID = NAMEKEY( "WOLQuickMatchMenu.wnd:WOLQuickMatchMenuParent" ); buttonBackID = NAMEKEY( "WOLQuickMatchMenu.wnd:ButtonBack" ); @@ -745,7 +745,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxSideID = NAMEKEY( "WOLQuickMatchMenu.wnd:ComboBoxSide" ); comboBoxColorID = NAMEKEY( "WOLQuickMatchMenu.wnd:ComboBoxColor" ); - parentWOLQuickMatch = TheWindowManager->winGetWindowFromId( NULL, parentWOLQuickMatchID ); + parentWOLQuickMatch = TheWindowManager->winGetWindowFromId( nullptr, parentWOLQuickMatchID ); buttonBack = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonBackID); buttonStart = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonStartID); buttonStop = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, buttonStopID); @@ -771,7 +771,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) { // no ladders, so just disable them comboBoxDisabledLadder = comboBoxLadder; - comboBoxLadder = NULL; + comboBoxLadder = nullptr; isPopulatingLadderBox = TRUE; @@ -779,7 +779,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) Int index; GadgetComboBoxReset( comboBoxDisabledLadder ); index = GadgetComboBoxAddEntry( comboBoxDisabledLadder, TheGameText->fetch("GUI:NoLadder"), normalColor ); - GadgetComboBoxSetItemData( comboBoxDisabledLadder, index, 0 ); + GadgetComboBoxSetItemData( comboBoxDisabledLadder, index, nullptr ); GadgetComboBoxSetSelectedPos( comboBoxDisabledLadder, index ); isPopulatingLadderBox = FALSE; @@ -791,7 +791,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) comboBoxLadder->winHide(TRUE); comboBoxLadder->winEnable(FALSE); } - comboBoxLadder = NULL; + comboBoxLadder = nullptr; GameWindow *staticTextLadder = TheWindowManager->winGetWindowFromId( parentWOLQuickMatch, NAMEKEY("WOLQuickMatchMenu.wnd:StaticTextLadder") ); if (staticTextLadder) @@ -799,7 +799,7 @@ void WOLQuickMatchMenuInit( WindowLayout *layout, void *userData ) */ } - GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(NULL, buttonBuddiesID); + GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(nullptr, buttonBuddiesID); if (buttonBuddies) buttonBuddies->winEnable(TRUE); @@ -907,14 +907,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -928,10 +928,10 @@ void WOLQuickMatchMenuShutdown( WindowLayout *layout, void *userData ) if (!TheGameEngine->getQuitting()) saveQuickMatchOptions(); - parentWOLQuickMatch = NULL; - buttonBack = NULL; - quickmatchTextWindow = NULL; - selectedImage = unselectedImage = NULL; + parentWOLQuickMatch = nullptr; + buttonBack = nullptr; + quickmatchTextWindow = nullptr; + selectedImage = unselectedImage = nullptr; isShuttingDown = true; @@ -1029,7 +1029,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) if (TheGameSpyGame && TheGameSpyGame->isGameInProgress()) { - if (TheGameSpyInfo->isDisconnectedAfterGameStart(NULL)) + if (TheGameSpyInfo->isDisconnectedAfterGameStart(nullptr)) { return; // already been disconnected, so don't worry. } @@ -1049,7 +1049,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) // check for scorescreen NameKeyType listboxChatWindowScoreScreenID = NAMEKEY("ScoreScreen.wnd:ListboxChatWindowScoreScreen"); - GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( NULL, listboxChatWindowScoreScreenID ); + GameWindow *listboxChatWindowScoreScreen = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowScoreScreenID ); if (listboxChatWindowScoreScreen) { GadgetListBoxAddEntryText(listboxChatWindowScoreScreen, TheGameText->fetch(disconMunkee), @@ -1068,7 +1068,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) return; // if we're in game, all we care about is if we've been disconnected from the chat server } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1081,7 +1081,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) { // delete TheNAT, its no good for us anymore. delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; // Just back out. This cleans up some slot list problems buttonPushed = true; @@ -1144,7 +1144,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT sawImportantMessage = TRUE; - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); } } @@ -1390,7 +1390,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) DEBUG_LOG(("Starting a QM game: options=[%s]", GameInfoToAsciiString(TheGameSpyGame).str())); SendStatsToOtherPlayers(TheGameSpyGame); TheGameSpyGame->startGame(0); - GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(NULL, buttonBuddiesID); + GameWindow *buttonBuddies = TheWindowManager->winGetWindowFromId(nullptr, buttonBuddiesID); if (buttonBuddies) buttonBuddies->winEnable(FALSE); GameSpyCloseOverlay(GSOVERLAY_BUDDY); @@ -1683,7 +1683,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms Int ladderIndex, index, selected; GadgetComboBoxGetSelectedPos( comboBoxLadder, &selected ); ladderIndex = (Int)GadgetComboBoxGetItemData( comboBoxLadder, selected ); - const LadderInfo *ladderInfo = NULL; + const LadderInfo *ladderInfo = nullptr; if (ladderIndex < 0) { ladderIndex = 0; @@ -1803,7 +1803,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms LadderPreferences ladPref; ladPref.loadProfile( TheGameSpyInfo->getLocalProfileID() ); LadderPref p; - p.lastPlayDate = time(NULL); + p.lastPlayDate = time(nullptr); p.address = ladderInfo->address; p.port = ladderInfo->port; p.name = ladderInfo->name; @@ -1838,7 +1838,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms for ( Int i=0; inameToKey( "WOLStatusMenu.wnd:WOLStatusMenuParent" ); buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ButtonDisconnect" ); - parentWOLStatus = TheWindowManager->winGetWindowFromId( NULL, parentWOLStatusID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( NULL, buttonDisconnectID); + parentWOLStatus = TheWindowManager->winGetWindowFromId( nullptr, parentWOLStatusID ); + buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); - progressTextWindow = TheWindowManager->winGetWindowFromId( NULL, + progressTextWindow = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ListboxStatus" ) ); // Show Menu @@ -90,7 +90,7 @@ void WOLStatusMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheShell->shutdownComplete( layout ); - //progressLayout = NULL; + //progressLayout = nullptr; //WOL::raiseWOLMessageBox(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp index f098089806f..d0a854556f5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp @@ -71,7 +71,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// static Bool isShuttingDown = FALSE; static Bool buttonPushed = FALSE; -static const char *nextScreen = NULL; +static const char *nextScreen = nullptr; // window ids ------------------------------------------------------------------------------ static NameKeyType parentWOLWelcomeID = NAMEKEY_INVALID; @@ -85,30 +85,30 @@ static NameKeyType buttonMyInfoID = NAMEKEY_INVALID; static NameKeyType listboxInfoID = NAMEKEY_INVALID; static NameKeyType buttonOptionsID = NAMEKEY_INVALID; // Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLWelcome = NULL; -static GameWindow *buttonBack = NULL; -static GameWindow *buttonQuickMatch = NULL; -static GameWindow *buttonLobby = NULL; -static GameWindow *buttonBuddies = NULL; -static GameWindow *buttonLadder = NULL; -static GameWindow *buttonMyInfo = NULL; -static GameWindow *buttonbuttonOptions = NULL; -static WindowLayout *welcomeLayout = NULL; -static GameWindow *listboxInfo = NULL; - -static GameWindow *staticTextServerName = NULL; -static GameWindow *staticTextLastUpdated = NULL; - -static GameWindow *staticTextLadderWins = NULL; -static GameWindow *staticTextLadderLosses = NULL; -static GameWindow *staticTextLadderRank = NULL; -static GameWindow *staticTextLadderPoints = NULL; -static GameWindow *staticTextLadderDisconnects = NULL; - -static GameWindow *staticTextHighscoreWins = NULL; -static GameWindow *staticTextHighscoreLosses = NULL; -static GameWindow *staticTextHighscoreRank = NULL; -static GameWindow *staticTextHighscorePoints = NULL; +static GameWindow *parentWOLWelcome = nullptr; +static GameWindow *buttonBack = nullptr; +static GameWindow *buttonQuickMatch = nullptr; +static GameWindow *buttonLobby = nullptr; +static GameWindow *buttonBuddies = nullptr; +static GameWindow *buttonLadder = nullptr; +static GameWindow *buttonMyInfo = nullptr; +static GameWindow *buttonbuttonOptions = nullptr; +static WindowLayout *welcomeLayout = nullptr; +static GameWindow *listboxInfo = nullptr; + +static GameWindow *staticTextServerName = nullptr; +static GameWindow *staticTextLastUpdated = nullptr; + +static GameWindow *staticTextLadderWins = nullptr; +static GameWindow *staticTextLadderLosses = nullptr; +static GameWindow *staticTextLadderRank = nullptr; +static GameWindow *staticTextLadderPoints = nullptr; +static GameWindow *staticTextLadderDisconnects = nullptr; + +static GameWindow *staticTextHighscoreWins = nullptr; +static GameWindow *staticTextHighscoreLosses = nullptr; +static GameWindow *staticTextHighscoreRank = nullptr; +static GameWindow *staticTextHighscorePoints = nullptr; static UnicodeString gServerName; void updateServerDisplay(UnicodeString serverName) @@ -193,14 +193,14 @@ static void shutdownComplete( WindowLayout *layout ) layout->hide( TRUE ); // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != NULL) ); + TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - if (nextScreen != NULL) + if (nextScreen != nullptr) { TheShell->push(nextScreen); } - nextScreen = NULL; + nextScreen = nullptr; } @@ -215,14 +215,14 @@ static UnsignedByte grabUByte(const char *s) char tmp[5] = "0xff"; tmp[2] = s[0]; tmp[3] = s[1]; - UnsignedByte b = strtol(tmp, NULL, 16); + UnsignedByte b = strtol(tmp, nullptr, 16); return b; } static void updateNumPlayersOnline(void) { GameWindow *playersOnlineWindow = TheWindowManager->winGetWindowFromId( - NULL, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextNumPlayersOnline") ); + nullptr, NAMEKEY("WOLWelcomeMenu.wnd:StaticTextNumPlayersOnline") ); if (playersOnlineWindow) { @@ -348,7 +348,7 @@ void HandleOverallStats( const char* szHTTPStats, unsigned len ) //find this side const char* pSide = strstr( pToday, side.str() ); - if( pSide == NULL ) + if( pSide == nullptr ) { //error, skip this side DEBUG_LOG(( "Unable to parse win/loss stats for %s in:\n%s", side.str(), szHTTPStats )); continue; @@ -383,7 +383,7 @@ static void updateOverallStats(void) int percent = REAL_TO_INT(100.0f * (it->second / s_totalWinPercent)); percStr.format( TheGameText->fetch("GUI:WinPercent"), percent ); wndName.format( "WOLWelcomeMenu.wnd:Percent%s", it->first.str() ); - pWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY(wndName) ); + pWin = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY(wndName) ); GadgetCheckBoxSetText( pWin, percStr ); //x DEBUG_LOG(("Initialized win percent: %s -> %s %f=%s", wndName.str(), it->first.str(), it->second, percStr.str() )); } @@ -397,7 +397,7 @@ static void updateOverallStats(void) void UpdateLocalPlayerStats(void) { - GameWindow *welcomeParent = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("WOLWelcomeMenu.wnd:WOLWelcomeMenuParent") ); + GameWindow *welcomeParent = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("WOLWelcomeMenu.wnd:WOLWelcomeMenuParent") ); if (welcomeParent) { @@ -417,7 +417,7 @@ static Bool raiseMessageBoxes = FALSE; //------------------------------------------------------------------------------------------------- void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) { - nextScreen = NULL; + nextScreen = nullptr; buttonPushed = FALSE; isShuttingDown = FALSE; @@ -427,13 +427,13 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) parentWOLWelcomeID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:WOLWelcomeMenuParent" ); buttonBackID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonBack" ); - parentWOLWelcome = TheWindowManager->winGetWindowFromId( NULL, parentWOLWelcomeID ); - buttonBack = TheWindowManager->winGetWindowFromId( NULL, buttonBackID); + parentWOLWelcome = TheWindowManager->winGetWindowFromId( nullptr, parentWOLWelcomeID ); + buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); buttonOptionsID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonOptions" ); - buttonbuttonOptions = TheWindowManager->winGetWindowFromId( NULL, buttonOptionsID); + buttonbuttonOptions = TheWindowManager->winGetWindowFromId( nullptr, buttonOptionsID); listboxInfoID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:InfoListbox" ); - listboxInfo = TheWindowManager->winGetWindowFromId( NULL, listboxInfoID); + listboxInfo = TheWindowManager->winGetWindowFromId( nullptr, listboxInfoID); staticTextServerName = TheWindowManager->winGetWindowFromId( parentWOLWelcome, TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:StaticTextServerName" )); @@ -505,13 +505,13 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) buttonLadderID = TheNameKeyGenerator->nameToKey( "WOLWelcomeMenu.wnd:ButtonLadder" ); buttonLadder = TheWindowManager->winGetWindowFromId( parentWOLWelcome, buttonLadderID ); - if (TheFirewallHelper == NULL) { + if (TheFirewallHelper == nullptr) { TheFirewallHelper = createFirewallHelper(); } if (TheFirewallHelper->detectFirewall() == TRUE) { // don't need to detect firewall, already been done. delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } /* @@ -532,9 +532,9 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) // // animate controls // TheShell->registerWithAnimateManager(buttonQuickMatch, WIN_ANIMATION_SLIDE_LEFT, TRUE, 800); // TheShell->registerWithAnimateManager(buttonLobby, WIN_ANIMATION_SLIDE_LEFT, TRUE, 600); -// //TheShell->registerWithAnimateManager(NULL, WIN_ANIMATION_SLIDE_LEFT, TRUE, 400); +// //TheShell->registerWithAnimateManager(nullptr, WIN_ANIMATION_SLIDE_LEFT, TRUE, 400); // TheShell->registerWithAnimateManager(buttonBuddies, WIN_ANIMATION_SLIDE_LEFT, TRUE, 200); -// //TheShell->registerWithAnimateManager(NULL, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); +// //TheShell->registerWithAnimateManager(nullptr, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); // TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_BOTTOM, TRUE, 1); // Show Menu @@ -567,10 +567,10 @@ void WOLWelcomeMenuInit( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- void WOLWelcomeMenuShutdown( WindowLayout *layout, void *userData ) { - listboxInfo = NULL; + listboxInfo = nullptr; delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; isShuttingDown = TRUE; @@ -607,7 +607,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) raiseMessageBoxes = FALSE; } - if (TheFirewallHelper != NULL) + if (TheFirewallHelper != nullptr) { if (TheFirewallHelper->behaviorDetectionUpdate()) { @@ -619,7 +619,7 @@ void WOLWelcomeMenuUpdate( WindowLayout * layout, void *userData) // we are now done with the firewall helper delete TheFirewallHelper; - TheFirewallHelper = NULL; + TheFirewallHelper = nullptr; } } @@ -813,9 +813,9 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, closeAllOverlays(); TheShell->pop(); delete TheWOL; - TheWOL = NULL; + TheWOL = nullptr; delete TheWOLGame; - TheWOLGame = NULL; + TheWOLGame = nullptr; **/ } @@ -845,7 +845,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else if (controlID == buttonLobbyID) { //TheGameSpyChat->clearGroupRoomList(); - //peerListGroupRooms(TheGameSpyChat->getPeer(), ListGroupRoomsCallback, NULL, PEERTrue); + //peerListGroupRooms(TheGameSpyChat->getPeer(), ListGroupRoomsCallback, nullptr, PEERTrue); TheGameSpyInfo->joinBestGroupRoom(); enableControls( FALSE ); @@ -874,7 +874,7 @@ WindowMsgHandledType WOLWelcomeMenuSystem( GameWindow *window, UnsignedInt msg, else { GameSpyCurrentGroupRoomID = 0; - GSMessageBoxOk(L"Oops", L"Unable to join title room", NULL); + GSMessageBoxOk(L"Oops", L"Unable to join title room", nullptr); } */ } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp index 998f9daee59..a63ca2aec60 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp @@ -60,34 +60,34 @@ GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, NULL, NULL); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr); } GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, NULL, NULL, TRUE); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr, TRUE); } GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Yes,No and Cancel buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, NULL, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, nullptr, cancelCallback); } GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Ok and Cancel buttons { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, NULL, NULL, okCallback, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, nullptr, nullptr, okCallback, cancelCallback); } GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback)///< convenience function for displaying a Message box with Ok button { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, NULL, NULL, okCallback, NULL); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, nullptr, nullptr, okCallback, nullptr); } GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Cancel button { - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, NULL, NULL, NULL, cancelCallback); + return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, nullptr, nullptr, nullptr, cancelCallback); } @@ -110,7 +110,7 @@ WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, case GWM_DESTROY: { delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } @@ -194,7 +194,7 @@ WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, case GWM_DESTROY: { delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp index 2adcad2546e..a37d5763705 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp @@ -316,7 +316,7 @@ void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index e4c715ab385..07796e9a5ee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -594,10 +594,10 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, // ------------------------------------------------------------------------ case GWM_DESTROY: { - TheWindowManager->winSetLoneWindow(NULL); // if we are transitioning screens, close all combo boxes + TheWindowManager->winSetLoneWindow(nullptr); // if we are transitioning screens, close all combo boxes delete (ComboBoxData *)window->winGetUserData(); - window->winSetUserData(NULL); - comboData = NULL; + window->winSetUserData(nullptr); + comboData = nullptr; break; } @@ -838,7 +838,7 @@ void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -854,7 +854,7 @@ void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLetters void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -870,7 +870,7 @@ void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) { //sanity - if(comboBox == NULL) + if(comboBox == nullptr) return; ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); @@ -896,7 +896,7 @@ UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return UnicodeString::TheEmptyString; // verify that this is a combo box @@ -911,7 +911,7 @@ UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) //============================================================================= void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) { - if( comboBox == NULL ) + if( comboBox == nullptr ) return; GadgetTextEntrySetText(GadgetComboBoxGetEditBox(comboBox), text); @@ -923,7 +923,7 @@ void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return -1; return (Int)TheWindowManager->winSendSystemMsg( comboBox, GCM_ADD_ENTRY, (WindowMsgData)&text, color ); } @@ -933,7 +933,7 @@ Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color colo void GadgetComboBoxReset( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // reset via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_DEL_ALL, 0, 0 ); @@ -944,7 +944,7 @@ void GadgetComboBoxReset( GameWindow *comboBox ) void GadgetComboBoxHideList( GameWindow *comboBox ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // reset via system message TheWindowManager->winSendSystemMsg( comboBox, GGM_CLOSE, 0, 0 ); @@ -955,7 +955,7 @@ void GadgetComboBoxHideList( GameWindow *comboBox ) void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // set the ListBox gadget's font @@ -986,7 +986,7 @@ void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) void GadgetComboBoxSetEnabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1002,7 +1002,7 @@ void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Colo { ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; if(comboBoxData->listBox) @@ -1016,7 +1016,7 @@ void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Colo void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1032,7 +1032,7 @@ void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, Color borderColor ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); @@ -1049,7 +1049,7 @@ void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get selected indeces via system message @@ -1064,7 +1064,7 @@ void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide ) { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get selected indeces via system message @@ -1083,7 +1083,7 @@ void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ) //============================================================================= void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ) { - void *data = NULL; + void *data = nullptr; if (comboBox) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index 94e9f3e5339..f5abf8391eb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -432,8 +432,8 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI // ------------------------------------------------------------------------ case GWM_DESTROY: delete ( (SliderData *)window->winGetUserData() ); - window->winSetUserData(NULL); - s = NULL; + window->winSetUserData(nullptr); + s = nullptr; break; // ------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 783f3607233..6f0ab398b0f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -252,7 +252,7 @@ static void adjustDisplay( GameWindow *window, Int adjustment, list->displayPos = 0; } - if( list->slider != NULL ) + if( list->slider != nullptr ) { ICoord2D sliderSize, sliderChildSize; GameWindow *child; @@ -310,7 +310,7 @@ static void computeTotalHeight( GameWindow *window ) { DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; if(displayString) - displayString->getSize( NULL, &cellHeight ); + displayString->getSize( nullptr, &cellHeight ); } } else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) @@ -403,7 +403,7 @@ static Int moveRowsDown(ListboxData *list, Int startingRow) // // remove the display or links to images after the shift // - list->listData[startingRow].cell = NULL; + list->listData[startingRow].cell = nullptr; list->listData[startingRow].height = 0; list->listData[startingRow].listHeight = 0; @@ -513,7 +513,7 @@ static Int addEntry( UnicodeString *string, Int color, Int row, Int column, Game oldTotalHeight = list->listData[row-1].listHeight; } - displayString->getSize( NULL, &rowHeight ); + displayString->getSize( nullptr, &rowHeight ); if (rowHeight > oldRowHeight) { totalHeight = oldTotalHeight + (rowHeight - oldRowHeight); @@ -709,7 +709,7 @@ WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, if( position >= list->endPos) position = 0; - ListEntryCell *cell = NULL; + ListEntryCell *cell = nullptr; // go through the columns until we find a column with text Int j = 0; for(; j < list->columns; ++j) @@ -1361,11 +1361,11 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, } } - cells[j].userData = NULL; - cells[j].data = NULL; + cells[j].userData = nullptr; + cells[j].data = nullptr; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } //zero out the header structure memset(list->listData,0,list->listLength * sizeof(ListEntryRow)); @@ -1404,12 +1404,12 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, { if( cells[i].cellType == LISTBOX_TEXT && cells[i].data ) TheDisplayStringManager->freeDisplayString((DisplayString *) cells[i].data ); - cells[i].data = NULL; - cells[i].userData = NULL; + cells[i].data = nullptr; + cells[i].userData = nullptr; } delete[](list->listData[mData1].cell); - list->listData[mData1].cell = NULL; + list->listData[mData1].cell = nullptr; memcpy( &list->listData[mData1], &list->listData[(mData1+1)], (list->endPos - mData1 - 1) * sizeof(ListEntryRow) ); @@ -1713,7 +1713,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // Loop through and remove all the entries from the top up until we reach // the position mData1 contains // - ListEntryCell *cells = NULL; + ListEntryCell *cells = nullptr; Int i = 0; for (; i < (Int)mData1; i++) { @@ -1726,14 +1726,14 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); // free(cells[i].userData); - cells[j].data = NULL; - cells[j].userData = NULL; + cells[j].data = nullptr; + cells[j].userData = nullptr; cells[j].color = 0; cells[j].cellType = 0; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } @@ -1751,7 +1751,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // for(i = 0; i < (Int)mData1; i ++) { - list->listData[list->endPos + i].cell = NULL; + list->listData[list->endPos + i].cell = nullptr; } @@ -1827,7 +1827,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, ICoord2D downSize = {0, 0}; ICoord2D upSize = {0, 0}; ICoord2D sliderSize = {0, 0}; - GameWindow *child = NULL; + GameWindow *child = nullptr; ICoord2D sliderChildSize = {0, 0}; // get needed window sizes @@ -1960,11 +1960,11 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, // free(cells[j].userData); // Null out the data pointers so they're not destroyed when we free up this listdata - cells[j].userData = NULL; - cells[j].data = NULL; + cells[j].userData = nullptr; + cells[j].data = nullptr; } delete[](list->listData[i].cell); - list->listData[i].cell = NULL; + list->listData[i].cell = nullptr; } delete[]( list->listData ); @@ -1974,8 +1974,8 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, delete[]( list->selections ); delete (ListboxData *)window->winGetUserData(); - window->winSetUserData( NULL ); - list = NULL; + window->winSetUserData( nullptr ); + list = nullptr; break; @@ -2037,7 +2037,7 @@ WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, pos = (ICoord2D *)mData1; void **data = (void **)mData2; - *data = NULL; // initialize to NULL + *data = nullptr; // initialize to nullptr if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) *data = list->listData[pos->y].cell[pos->x].userData; @@ -2174,7 +2174,7 @@ UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, I { *color = 0; // sanity - if( listbox == NULL || row == -1 || column == -1) + if( listbox == nullptr || row == -1 || column == -1) return UnicodeString::TheEmptyString; // verify that this is a list box @@ -2217,7 +2217,7 @@ Int GadgetListBoxAddEntryText( GameWindow *listbox, addInfo.width = -1; ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if (listData == NULL) + if (listData == nullptr) return -1; Bool wasFull = (listData->listLength <= listData->endPos); Int newEntryOffset = (wasFull)?0:1; @@ -2355,7 +2355,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth -2, top+2, buttonWidth, buttonHeight, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); // ---------------------------------------------------------------------- // Create Bottom Button @@ -2375,7 +2375,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) width - buttonWidth -2, (top + bottom - buttonHeight -2), buttonWidth, buttonHeight, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); // ---------------------------------------------------------------------- // create the slider @@ -2404,7 +2404,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) width - sliderButtonWidth - 2, (top + buttonHeight + 3), sliderButtonWidth, bottom - (2 * buttonHeight) - 6, - &winInstData, &sData, NULL, TRUE ); + &winInstData, &sData, nullptr, TRUE ); // we now have all the scrollbar parts, this better be set :) listData->scrollBar = TRUE; @@ -2424,17 +2424,17 @@ void GadgetListBoxAddMultiSelect( GameWindow *listbox ) { ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - DEBUG_ASSERTCRASH(listboxData && listboxData->selections == NULL, ("selections is not NULL")); + DEBUG_ASSERTCRASH(listboxData && listboxData->selections == nullptr, ("selections is not null")); listboxData->selections = NEW Int [listboxData->listLength]; DEBUG_LOG(( "Enable list box multi select: listLength (select) = %d * %d = %d bytes;", listboxData->listLength, sizeof(Int), listboxData->listLength *sizeof(Int) )); - if( listboxData->selections == NULL ) + if( listboxData->selections == nullptr ) { delete[]( listboxData->listData ); - listboxData->listData = NULL; + listboxData->listData = nullptr; return; } @@ -2458,7 +2458,7 @@ void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) ListboxData *listData = (ListboxData *)listbox->winGetUserData(); delete[]( listData->selections ); - listData->selections = NULL; + listData->selections = nullptr; listData->multiSelect = FALSE; @@ -2543,7 +2543,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) } if (i >= newLength) { delete[](listboxData->listData[i].cell); - listboxData->listData[i].cell = NULL; + listboxData->listData[i].cell = nullptr; } } @@ -2556,7 +2556,7 @@ void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) computeTotalHeight(listbox); // Sanity check that everything was created properly - if( listboxData->listData == NULL ) + if( listboxData->listData == nullptr ) { DEBUG_LOG(( "Unable to allocate listbox data pointer" )); @@ -2623,7 +2623,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // get selected indeces via system message @@ -2639,7 +2639,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // set selected index via system message @@ -2653,7 +2653,7 @@ void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // set selected index via system message TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)selectList, selectCount ); @@ -2666,7 +2666,7 @@ void GadgetListBoxReset( GameWindow *listbox ) { // sanity - if( listbox == NULL ) + if( listbox == nullptr ) return; // reset via system message @@ -2691,7 +2691,7 @@ void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int col //------------------------------------------------------------------------------------------------- void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column) { - void *data = NULL; + void *data = nullptr; ICoord2D pos; pos.x = column; pos.y = row; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp index 48e53b57271..ffc8d60d7cc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp @@ -78,7 +78,7 @@ WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt ms // ------------------------------------------------------------------------ case GWM_DESTROY: { - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp index 02eb8a7e385..db8362a61cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp @@ -135,7 +135,7 @@ WindowMsgHandledType GadgetPushButtonInput( GameWindow *window, if( BitIsSet( window->winGetStatus(), WIN_STATUS_CHECK_LIKE ) == FALSE ) if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) BitClear( instData->m_state, WIN_STATE_SELECTED ); - //TheWindowManager->winSetFocus( NULL ); + //TheWindowManager->winSetFocus( nullptr ); if(window->winGetParent() && BitIsSet(window->winGetParent()->winGetStyle(),GWS_HORZ_SLIDER) ) { WinInstanceData *instDataParent = window->winGetParent()->winGetInstanceData(); @@ -461,7 +461,7 @@ WindowMsgHandledType GadgetPushButtonSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { delete (PushButtonData *)window->winGetUserData(); - window->winSetUserData(NULL); + window->winSetUserData(nullptr); break; } @@ -500,12 +500,12 @@ void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; // get instance data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return; // sanity, must be a check like button @@ -536,12 +536,12 @@ Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ) { // sanity - if( g == NULL ) + if( g == nullptr ) return FALSE; // get instance data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return FALSE; // we just hold this "check like dual state thingie" using the selected state @@ -555,12 +555,12 @@ void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initia { // sanity - if( g == NULL ) + if( g == nullptr ) return; // get inst data WinInstanceData *instData = g->winGetInstanceData(); - if( instData == NULL ) + if( instData == nullptr ) return; // make it check like @@ -584,7 +584,7 @@ void GadgetButtonSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); @@ -595,12 +595,12 @@ PushButtonData * getNewPushButtonData( void ) { PushButtonData *p = NEW PushButtonData; if(!p) - return NULL; + return nullptr; - p->userData = NULL; + p->userData = nullptr; p->drawBorder = FALSE; p->drawClock = NO_CLOCK; - p->overlayImage = NULL; + p->overlayImage = nullptr; return p; } @@ -609,7 +609,7 @@ PushButtonData * getNewPushButtonData( void ) //============================================================================= void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -628,7 +628,7 @@ void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ) void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -649,7 +649,7 @@ void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ) void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -666,7 +666,7 @@ void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ) void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -684,7 +684,7 @@ void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ) //============================================================================= void GadgetButtonSetData(GameWindow *g, void *data) { - if( g == NULL ) + if( g == nullptr ) return; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); @@ -701,13 +701,13 @@ void GadgetButtonSetData(GameWindow *g, void *data) //============================================================================= void *GadgetButtonGetData(GameWindow *g) { - if( g == NULL ) - return NULL; + if( g == nullptr ) + return nullptr; PushButtonData *pData = (PushButtonData *)g->winGetUserData(); if(!pData) { - return NULL; + return nullptr; } return pData->userData; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp index 3843009576e..3365f6817cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp @@ -372,7 +372,7 @@ WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt ms { // free radio button user data delete (RadioButtonData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; @@ -411,7 +411,7 @@ void GadgetRadioSetText( GameWindow *g, UnicodeString text ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); @@ -439,7 +439,7 @@ void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) { // sanity - if( g == NULL ) + if( g == nullptr ) return; TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp index 9913fa9633b..4432cad079f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp @@ -160,7 +160,7 @@ WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg // free text data delete (TextData *)window->winGetUserData(); - window->winSetUserData( NULL ); + window->winSetUserData( nullptr ); break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp index 1a1d2e2b0ce..8d724625192 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp @@ -143,7 +143,7 @@ WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt { // free tab control user data delete (TabControlData *)tabControl->winGetUserData(); - tabControl->winSetUserData( NULL ); + tabControl->winSetUserData( nullptr ); break; @@ -282,7 +282,7 @@ void GadgetTabControlShowSubPane( GameWindow *tabControl, Int whichPane) for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) { - if( tabData->subPanes[paneIndex] != NULL ) + if( tabData->subPanes[paneIndex] != nullptr ) tabData->subPanes[paneIndex]->winHide( true ); } if( tabData->subPanes[whichPane] ) @@ -303,13 +303,13 @@ void GadgetTabControlCreateSubPanes( GameWindow *tabControl )///< Create User Wi for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) { - if( tabData->subPanes[paneIndex] == NULL )//This one is blank + if( tabData->subPanes[paneIndex] == nullptr )//This one is blank { tabData->subPanes[paneIndex] = TheWindowManager->winCreate( tabControl, WIN_STATUS_NONE, x, y, width, height, PassSelectedButtonsToParentSystem, - NULL); + nullptr); WinInstanceData *instData = tabData->subPanes[paneIndex]->winGetInstanceData(); BitSet( instData->m_style, GWS_TAB_PANE ); char buffer[20]; @@ -351,7 +351,7 @@ void GadgetTabControlFixupSubPaneList( GameWindow *tabControl ) GameWindow *child = tabControl->winGetChild(); if( child ) {//need to write down children, and they are reversed from our array - while( child->winGetNext() != NULL ) + while( child->winGetNext() != nullptr ) { child = child->winGetNext(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index 0319ca68282..e8f5f1115bf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -61,8 +61,8 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static Byte drawCnt = 0; -// static TbIME *ourIME = NULL; ///< @todo need this for IME kanji support -static GameWindow *curWindow = NULL; /**< so we can keep track of the input +// static TbIME *ourIME = nullptr; ///< @todo need this for IME kanji support +static GameWindow *curWindow = nullptr; /**< so we can keep track of the input window when using IME */ // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -202,7 +202,7 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if(parent) TheWindowManager->winNextTab(parent); else @@ -220,7 +220,7 @@ WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if(parent) TheWindowManager->winPrevTab(parent); else @@ -365,8 +365,8 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, // free all edit data delete( (EntryData *)window->winGetUserData() ); - window->winSetUserData(NULL); - e = NULL; + window->winSetUserData(nullptr); + e = nullptr; break; // ------------------------------------------------------------------------ @@ -376,7 +376,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, // If we're losing focus /// @todo need to enable this for IME support // ourIME->UnActivate(); - curWindow = NULL; + curWindow = nullptr; BitClear( instData->m_state, WIN_STATE_SELECTED ); BitClear( instData->m_state, WIN_STATE_HILITED ); @@ -385,7 +385,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, e->constructText->setText( UnicodeString::TheEmptyString ); e->conCharPos = 0; if(TheIMEManager && TheIMEManager->isAttachedTo(window)) - TheIMEManager->attach(NULL); + TheIMEManager->attach(nullptr); //TheIMEManager->detatch(); } else @@ -433,7 +433,7 @@ BoolCode InitializeEntryGadget( void ) BoolCode ShutdownEntryGadget( void ) { delete ourIME; - ourIME = NULL; + ourIME = nullptr; return TRUE; } @@ -443,7 +443,7 @@ void InformEntry( WideChar c ) Int i, listCount = 0; EntryData *e; - if( ourIME == NULL || curWindow == NULL ) + if( ourIME == nullptr || curWindow == nullptr ) return; e = (EntryData *)curWindow->winGetUserData(); @@ -495,7 +495,7 @@ void InformEntry( WideChar c ) else { Int maxWidth = 0; - ListboxData list = NULL; + ListboxData list = nullptr; ICoord2D constructSize, sliderSize; WinHide( e->constructList, FALSE ); @@ -513,7 +513,7 @@ void InformEntry( WideChar c ) WideChar *text = (WideChar *)ourIME->CandidateList_GetItem( i ); TheWindowManager->winGetTextSize( e->constructList->instData.font, - text, NULL, &tempWidth, 0 ); + text, nullptr, &tempWidth, 0 ); if( tempWidth > maxWidth ) maxWidth = tempWidth; @@ -570,7 +570,7 @@ UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) { // sanity - if( textentry == NULL ) + if( textentry == nullptr ) return UnicodeString::TheEmptyString; // verify that this is a list box diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index a5bf79259b7..be6599b4373 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -421,8 +421,8 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt // ------------------------------------------------------------------------ case GWM_DESTROY: delete( (SliderData *)window->winGetUserData() ); - window->winSetUserData(NULL); - s = NULL; + window->winSetUserData(nullptr); + s = nullptr; break; // ------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp index 799f7d2776c..983b9d4e94a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp @@ -32,7 +32,7 @@ #include "GameClient/GameFont.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -FontLibrary *TheFontLibrary = NULL; +FontLibrary *TheFontLibrary = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ void FontLibrary::linkFont( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return; // link it @@ -62,17 +62,17 @@ void FontLibrary::linkFont( GameFont *font ) //------------------------------------------------------------------------------------------------- void FontLibrary::unlinkFont( GameFont *font ) { - GameFont *other = NULL; + GameFont *other = nullptr; // sanity - if( font == NULL ) + if( font == nullptr ) return; // sanity check and make sure this font is actually in this library for( other = m_fontList; other; other = other->next ) if( other == font ) break; - if( other == NULL ) + if( other == nullptr ) { DEBUG_CRASH(( "Font '%s' not found in library", font->nameString.str() )); @@ -89,13 +89,13 @@ void FontLibrary::unlinkFont( GameFont *font ) // if nothing was fount this was at the head of the list, otherwise // remove from chain // - if( other == NULL ) + if( other == nullptr ) m_fontList = font->next; else other->next = font->next; // clean up this font we just unlinked just to be cool! - font->next = NULL; + font->next = nullptr; // we now have one less font on the list m_count--; @@ -138,7 +138,7 @@ void FontLibrary::deleteAllFonts( void ) FontLibrary::FontLibrary( void ) { - m_fontList = NULL; + m_fontList = nullptr; m_count = 0; } @@ -182,7 +182,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // TheSuperHackers @fix Now also no longer creates fonts with zero size. if (pointSize < 1 || pointSize > 100) { - return NULL; + return nullptr; } GameFont *font; @@ -201,11 +201,11 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) // font not found, allocate a new font element font = newInstance(GameFont); - if( font == NULL ) + if( font == nullptr ) { DEBUG_CRASH(( "getFont: Unable to allocate new font list element" )); - return NULL; + return nullptr; } @@ -213,7 +213,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) font->nameString = name; font->pointSize = pointSize; font->bold = bold; - font->fontData = NULL; + font->fontData = nullptr; //DEBUG_LOG(("Font: Loading font '%s' %d point", font->nameString.str(), font->pointSize)); // load the device specific data pointer @@ -222,7 +222,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold ) DEBUG_CRASH(( "getFont: Unable to load font data pointer '%s'", name.str() )); deleteInstance(font); - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 49d7e6ee54c..315c4bf373a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -94,9 +94,9 @@ GameWindow::GameWindow( void ) m_cursorX = 0; m_cursorY = 0; - m_userData = NULL; + m_userData = nullptr; - m_inputData = NULL; + m_inputData = nullptr; winSetDrawFunc( TheWindowManager->getDefaultDraw() ); winSetInputFunc( TheWindowManager->getDefaultInput() ); @@ -104,18 +104,18 @@ GameWindow::GameWindow( void ) // We use to set the default tooltip func to TheWindowManager->getDefaultTooltip() // but I removed this so that we can set in GUI edit a text string that will be the // default tool tip for a control. - winSetTooltipFunc( NULL ); + winSetTooltipFunc( nullptr ); - m_next = NULL; - m_prev = NULL; - m_parent = NULL; - m_child = NULL; + m_next = nullptr; + m_prev = nullptr; + m_parent = nullptr; + m_child = nullptr; - m_nextLayout = NULL; - m_prevLayout = NULL; - m_layout = NULL; + m_nextLayout = nullptr; + m_prevLayout = nullptr; + m_layout = nullptr; - m_editData = NULL; + m_editData = nullptr; } @@ -125,10 +125,10 @@ GameWindow::~GameWindow( void ) { delete m_inputData; - m_inputData = NULL; + m_inputData = nullptr; delete m_editData; - m_editData = NULL; + m_editData = nullptr; unlinkFromTransitionWindows(); @@ -306,11 +306,11 @@ GameWindow *GameWindow::findPrevLeaf( void ) if( leaf ) return leaf->findLastLeaf(); else - return NULL; + return nullptr; } - return NULL; + return nullptr; } @@ -328,7 +328,7 @@ GameWindow *GameWindow::findNextLeaf( void ) return leaf->m_next; for( leaf = leaf->m_next; leaf; leaf = leaf->m_child ) - if( leaf->m_child == NULL || BitIsSet( leaf->m_status, + if( leaf->m_child == nullptr || BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; @@ -345,7 +345,7 @@ GameWindow *GameWindow::findNextLeaf( void ) { for( leaf = leaf->m_next; leaf; leaf = leaf->m_child ) - if( leaf->m_child == NULL || + if( leaf->m_child == nullptr || BitIsSet( leaf->m_status, WIN_STATUS_TAB_STOP ) ) return leaf; @@ -356,11 +356,11 @@ GameWindow *GameWindow::findNextLeaf( void ) if( leaf ) return leaf->findFirstLeaf(); else - return NULL; + return nullptr; } - return NULL; + return nullptr; } @@ -379,7 +379,7 @@ Int GameWindow::winNextTab( void ) do { - if( m_parent == NULL && firstTry ) + if( m_parent == nullptr && firstTry ) { newTab = findLastLeaf( newTab ); @@ -414,7 +414,7 @@ Int GameWindow::winPrevTab( void ) do { - if( m_parent == NULL && firstTry ) + if( m_parent == nullptr && firstTry ) { newTab = findFirstLeaf( newTab ); @@ -460,7 +460,7 @@ Int GameWindow::winBringToTop( void ) for( current = TheWindowManager->winGetWindowList(); current != this; current = current->m_next) - if (current == NULL) + if (current == nullptr) return WIN_ERR_INVALID_PARAMETER; // move to head of windowList @@ -537,7 +537,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) { // sanity - if( x == NULL || y == NULL ) + if( x == nullptr || y == nullptr ) return WIN_ERR_INVALID_PARAMETER; *x = m_region.lo.x; @@ -660,7 +660,7 @@ Int GameWindow::winGetSize( Int *width, Int *height ) { // sanity - if( width == NULL || height == NULL ) + if( width == nullptr || height == nullptr ) return WIN_ERR_INVALID_PARAMETER; *width = m_size.x; @@ -830,7 +830,7 @@ void GameWindow::winGetDrawOffset( Int *x, Int *y ) { // sanity - if( x == NULL || y == NULL ) + if( x == nullptr || y == nullptr ) return; *x = m_instData.m_imageOffset.x; @@ -1071,7 +1071,7 @@ Int GameWindow::winSetInstanceData( WinInstanceData *data ) m_instData.m_tooltip = tooltipText; // make sure we didn't try to copy over a video buffer. - m_instData.m_videoBuffer = NULL; + m_instData.m_videoBuffer = nullptr; // set our text display instance text if present if( data->getTextLength() ) @@ -1151,7 +1151,7 @@ Int GameWindow::winGetWindowId( void ) Int GameWindow::winSetParent( GameWindow *parent ) { - if( m_parent == NULL) + if( m_parent == nullptr) { // Top level window so unlink it TheWindowManager->unlinkWindow( this ); @@ -1162,12 +1162,12 @@ Int GameWindow::winSetParent( GameWindow *parent ) TheWindowManager->unlinkChildWindow( this ); } - if( parent == NULL ) + if( parent == nullptr ) { // Want to make it a top level window so add to window list TheWindowManager->linkWindow( this ); - m_parent = NULL; + m_parent = nullptr; } else @@ -1229,7 +1229,7 @@ GameWindow *GameWindow::winGetChild( void ) Int GameWindow::winSetOwner( GameWindow *owner ) { - if( owner == NULL ) + if( owner == nullptr ) m_instData.m_owner = this; else m_instData.m_owner = owner; @@ -1553,7 +1553,7 @@ WindowMsgHandledType GameWinBlockInput( GameWindow *window, UnsignedInt msg, TheTacticalView->setMouseLock( FALSE ); TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp index d0fb42146af..67b0945a4e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp @@ -133,7 +133,7 @@ const Image *GameWindowManager::winFindImage( const char *name ) if( TheMappedImageCollection ) return TheMappedImageCollection->findImageByName( name ); - return NULL; + return nullptr; } @@ -185,7 +185,7 @@ void GameWindowManager::winGetTextSize( GameFont *font, UnicodeString text, Int GameWindowManager::winFontHeight( GameFont *font ) { - if (font == NULL) + if (font == nullptr) return 0; return font->height; @@ -234,7 +234,7 @@ GameFont *GameWindowManager::winFindFont( AsciiString fontName, if( TheFontLibrary ) return TheFontLibrary->getFont( fontName, pointSize, bold ); - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index bbe4bb38b91..a6348db2ae4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -55,7 +55,7 @@ #include "Common/NameKeyGenerator.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameWindowManager *TheWindowManager = NULL; +GameWindowManager *TheWindowManager = nullptr; UnsignedInt WindowLayoutCurrentVersion = 2; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ void GameWindowManager::processDestroyList( void ) doDestroy = m_destroyList; // set the list to empty - m_destroyList = NULL; + m_destroyList = nullptr; // do the destroys for( ; doDestroy; doDestroy = next ) @@ -101,21 +101,21 @@ void GameWindowManager::processDestroyList( void ) winRelease( doDestroy ); if( m_keyboardFocus == doDestroy ) - winSetFocus( NULL ); + winSetFocus( nullptr ); - if( (m_modalHead != NULL) && (doDestroy == m_modalHead->window) ) + if( (m_modalHead != nullptr) && (doDestroy == m_modalHead->window) ) winUnsetModal( m_modalHead->window ); if( m_currMouseRgn == doDestroy ) - m_currMouseRgn = NULL; + m_currMouseRgn = nullptr; if( m_grabWindow == doDestroy ) - m_grabWindow = NULL; + m_grabWindow = nullptr; // send the destroy message to the window we're about to kill winSendSystemMsg( doDestroy, GWM_DESTROY, 0, 0 ); - DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == NULL, ("Win user data is expected to be deleted now")); + DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == nullptr, ("Win user data is expected to be deleted now")); // free the memory deleteInstance(doDestroy); @@ -136,7 +136,7 @@ WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, Unsi { // sanity - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; if( (msg == GBM_SELECTED) || (msg == GBM_SELECTED_RIGHT) || (msg == GBM_MOUSE_ENTERING) || (msg == GBM_MOUSE_LEAVING) || (msg == GEM_EDIT_DONE)) @@ -160,7 +160,7 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt { // sanity - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; @@ -179,19 +179,19 @@ WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt GameWindowManager::GameWindowManager( void ) { - m_windowList = NULL; // list of all top level windows - m_windowTail = NULL; // last in windowList + m_windowList = nullptr; // list of all top level windows + m_windowTail = nullptr; // last in windowList - m_destroyList = NULL; // list of windows to destroy + m_destroyList = nullptr; // list of windows to destroy - m_currMouseRgn = NULL; // window that mouse is over - m_mouseCaptor = NULL; // window that captured mouse - m_keyboardFocus = NULL; // window that has input focus - m_modalHead = NULL; // top of windows in the modal stack - m_grabWindow = NULL; // window that grabbed the last down event - m_loneWindow = NULL; // Set if we just opened a combo box + m_currMouseRgn = nullptr; // window that mouse is over + m_mouseCaptor = nullptr; // window that captured mouse + m_keyboardFocus = nullptr; // window that has input focus + m_modalHead = nullptr; // top of windows in the modal stack + m_grabWindow = nullptr; // window that grabbed the last down event + m_loneWindow = nullptr; // Set if we just opened a combo box - m_cursorBitmap = NULL; + m_cursorBitmap = nullptr; m_captureFlags = 0; } @@ -206,7 +206,7 @@ GameWindowManager::~GameWindowManager( void ) freeStaticStrings(); delete TheTransitionHandler; - TheTransitionHandler = NULL; + TheTransitionHandler = nullptr; } //------------------------------------------------------------------------------------------------- @@ -250,7 +250,7 @@ void GameWindowManager::update( void ) //------------------------------------------------------------------------------------------------- void GameWindowManager::linkWindow( GameWindow *window ) { - GameWindow *lastModalWindow = NULL; + GameWindow *lastModalWindow = nullptr; GameWindow *tmp = m_windowList; while (tmp) { @@ -270,7 +270,7 @@ void GameWindowManager::linkWindow( GameWindow *window ) { // Add to head of the top level window list - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = m_windowList; if( m_windowList ) @@ -307,11 +307,11 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, { // sanity - if( window == NULL ) + if( window == nullptr ) return; // we'll say that an aheadOf window means at the head of the list - if( aheadOf == NULL ) + if( aheadOf == nullptr ) { linkWindow( window ); @@ -326,7 +326,7 @@ void GameWindowManager::insertWindowAheadOf( GameWindow *window, // if ahead of has no parent insert it in the master list just before // ahead of // - if( aheadOfParent == NULL ) + if( aheadOfParent == nullptr ) { window->m_prev = aheadOf->m_prev; @@ -405,20 +405,20 @@ void GameWindowManager::unlinkChildWindow( GameWindow *window ) window->m_next->m_prev = window->m_prev; - window->m_next = NULL; + window->m_next = nullptr; } else { - window->m_parent->m_child = NULL; + window->m_parent->m_child = nullptr; } } // remove the parent reference from this window - window->m_parent = NULL; + window->m_parent = nullptr; } @@ -429,7 +429,7 @@ Bool GameWindowManager::isEnabled( GameWindow *win ) { // sanity - if( win == NULL ) + if( win == nullptr ) return FALSE; if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) @@ -457,7 +457,7 @@ Bool GameWindowManager::isHidden( GameWindow *win ) { // we'll allow for the idea that if a window doesn't exist it is hidden - if( win == NULL ) + if( win == nullptr ) return TRUE; if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) @@ -488,7 +488,7 @@ void GameWindowManager::addWindowToParent( GameWindow *window, { // add to parent's list of children - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = parent->m_child; if( parent->m_child ) @@ -513,15 +513,15 @@ void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, if( parent ) { - window->m_prev = NULL; - window->m_next = NULL; + window->m_prev = nullptr; + window->m_next = nullptr; if( parent->m_child ) { GameWindow *last; // wind down to last child in list last = parent->m_child; - while( last->m_next != NULL ) + while( last->m_next != nullptr ) last = last->m_next; // tie to list @@ -547,7 +547,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) // if this window has keyboard focus remove it if( m_keyboardFocus == window ) - m_keyboardFocus = NULL; + m_keyboardFocus = nullptr; // if this is the modal head, unset it if( m_modalHead && m_modalHead->window == window ) @@ -555,7 +555,7 @@ void GameWindowManager::windowHiding( GameWindow *window ) // if this is the captor, it shall no longer be if( m_mouseCaptor == window ) - winCapture( NULL ); + winCapture( nullptr ); // // since hiding a parent will also hide the children, when a parent @@ -616,7 +616,7 @@ void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, Int GameWindowManager::winCapture( GameWindow *window ) { - if( m_mouseCaptor != NULL) + if( m_mouseCaptor != nullptr) return WIN_ERR_MOUSE_CAPTURED; m_mouseCaptor = window; @@ -632,7 +632,7 @@ Int GameWindowManager::winRelease( GameWindow *window ) { if( window == m_mouseCaptor ) - m_mouseCaptor = NULL; + m_mouseCaptor = nullptr; return WIN_ERR_OK; @@ -654,7 +654,7 @@ GameWindow *GameWindowManager::winGetCapture( void ) GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) { - if( window == NULL ) + if( window == nullptr ) window = m_windowList; for( ; window; window = window->m_next ) @@ -673,7 +673,7 @@ GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) } - return NULL; + return nullptr; } @@ -696,7 +696,7 @@ WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, WindowMsgData mData2 ) { - if( window == NULL) + if( window == nullptr) return MSG_IGNORED; if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -715,7 +715,7 @@ WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, WindowMsgData mData2 ) { - if( window == NULL ) + if( window == nullptr ) return MSG_IGNORED; if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -771,15 +771,15 @@ Int GameWindowManager::winSetFocus( GameWindow *window ) break; window = window->winGetParent(); - if( window == NULL ) + if( window == nullptr ) break; } } - // If new window doesn't want focus, set focus to NULL + // If new window doesn't want focus, set focus to nullptr if( wantsFocus == FALSE ) - m_keyboardFocus = NULL; + m_keyboardFocus = nullptr; return WIN_ERR_OK; @@ -808,7 +808,7 @@ WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, { win = win->winGetParent(); - if( win == NULL ) + if( win == nullptr ) { returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all @@ -834,8 +834,8 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; Bool objectTooltip = FALSE; UnsignedInt packedMouseCoords; - GameWindow *window = NULL; - GameWindow *toolTipWindow = NULL; + GameWindow *window = nullptr; + GameWindow *toolTipWindow = nullptr; Int dx, dy; Bool clearGrabWindow = FALSE; @@ -850,7 +850,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms { // no window grabbed as of yet - m_grabWindow = NULL; + m_grabWindow = nullptr; // what what window within the captured window are we in window = m_mouseCaptor->winPointInChild( mousePos->x, mousePos->y ); @@ -865,7 +865,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( win ) { - while( win != NULL ) + while( win != nullptr ) { if( winSendInputMsg( win, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) @@ -1008,11 +1008,11 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); // check !above, below and hidden - if( window == NULL ) + if( window == nullptr ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); // check below and !hidden - if( window == NULL ) + if( window == nullptr ) window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); } @@ -1022,7 +1022,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if(window->winGetParent() && BitIsSet( window->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) window = window->winGetParent(); else - window = NULL; + window = nullptr; } if( window ) @@ -1044,7 +1044,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms { tempWin = tempWin->m_parent; - if( tempWin == NULL ) + if( tempWin == nullptr ) break; } @@ -1055,7 +1055,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms &&( msg == GWM_LEFT_UP || msg == GWM_MIDDLE_UP || msg == GWM_RIGHT_UP || tempWin)) { if(!m_loneWindow->winIsChild(tempWin)) - winSetLoneWindow( NULL ); + winSetLoneWindow( nullptr ); /* ComboBoxData *cData = (ComboBoxData *)m_comboBoxOpen->winGetUserData(); // verify that the window that ate the message wasn't one of our own @@ -1066,7 +1066,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms cData->listboxData->downButton != tempWin && cData->listboxData->slider != tempWin && cData->listboxData->slider != tempWin->winGetParent()) - winSetOpenComboBoxWindow( NULL );*/ + winSetOpenComboBoxWindow( nullptr );*/ } if( tempWin ) @@ -1095,7 +1095,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms } - if( toolTipWindow == NULL ) + if( toolTipWindow == nullptr ) { if( isHidden( window ) == FALSE ) @@ -1146,7 +1146,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms // check if new current window is different from the last // but only if both windows fall within the mouseCaptor if one exists // - if( (m_grabWindow == NULL) && (window != m_currMouseRgn) ) + if( (m_grabWindow == nullptr) && (window != m_currMouseRgn) ) { if( m_mouseCaptor ) { @@ -1167,7 +1167,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms if( clearGrabWindow == TRUE ) { - m_grabWindow = NULL; + m_grabWindow = nullptr; clearGrabWindow = FALSE; } @@ -1193,7 +1193,7 @@ GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) continue; - if (toolTipWindow == NULL) + if (toolTipWindow == nullptr) { GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); @@ -1208,7 +1208,7 @@ GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1223,7 +1223,7 @@ Int GameWindowManager::drawWindow( GameWindow *window ) { GameWindow *child; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; if( BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) == FALSE ) @@ -1309,7 +1309,7 @@ void GameWindowManager::dumpWindow( GameWindow *window ) #ifndef FINAL GameWindow *child; - if( window == NULL ) + if( window == nullptr ) return; DEBUG_LOG(( "ID: %d\tRedraw: 0x%08X\tUser Data: %d", @@ -1336,7 +1336,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, // allocate new window window = allocateNewWindow(); - if( window == NULL ) + if( window == nullptr ) { DEBUG_LOG(( "WinCreate error: Could not allocate new window" )); @@ -1349,7 +1349,7 @@ GameWindow *GameWindowManager::winCreate( GameWindow *parent, } #endif - return NULL; + return nullptr; } @@ -1400,14 +1400,14 @@ Int GameWindowManager::winDestroy( GameWindow *window ) { GameWindow *child, *next; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // // we should never have edit data allocated in the window code, it's // completely handled by the editor ONLY // - DEBUG_ASSERTCRASH( window->winGetEditData() == NULL, + DEBUG_ASSERTCRASH( window->winGetEditData() == nullptr, ("winDestroy(): edit data should NOT be present!") ); if( BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) @@ -1420,16 +1420,16 @@ Int GameWindowManager::winDestroy( GameWindow *window ) winRelease( window ); if( m_keyboardFocus == window ) - winSetFocus( NULL ); + winSetFocus( nullptr ); - if( (m_modalHead != NULL) && (window == m_modalHead->window) ) + if( (m_modalHead != nullptr) && (window == m_modalHead->window) ) winUnsetModal( m_modalHead->window ); if( m_currMouseRgn == window ) - m_currMouseRgn = NULL; + m_currMouseRgn = nullptr; if( m_grabWindow == window ) - m_grabWindow = NULL; + m_grabWindow = nullptr; for( child = window->m_child; child; child = next ) { @@ -1438,13 +1438,13 @@ Int GameWindowManager::winDestroy( GameWindow *window ) } // Remove the top level window from list - if( window->m_parent == NULL ) + if( window->m_parent == nullptr ) unlinkWindow( window ); else unlinkChildWindow( window ); // Add to head of the destroy list - window->m_prev = NULL; + window->m_prev = nullptr; window->m_next = m_destroyList; m_destroyList = window; @@ -1498,18 +1498,18 @@ Int GameWindowManager::winSetModal( GameWindow *window ) { ModalWindow *modal; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // verify requesting window is a root window - if( window->m_parent != NULL ) + if( window->m_parent != nullptr ) { DEBUG_LOG(( "WinSetModal: Non Root window attempted to go modal." )); return WIN_ERR_INVALID_PARAMETER; // return error if not } // Allocate new Modal Window Entry modal = newInstance(ModalWindow); - if( modal == NULL ) + if( modal == nullptr ) { DEBUG_LOG(( "WinSetModal: Unable to allocate space for Modal Entry." )); return WIN_ERR_GENERAL_FAILURE; @@ -1532,11 +1532,11 @@ Int GameWindowManager::winUnsetModal( GameWindow *window ) { ModalWindow *next; - if( window == NULL ) + if( window == nullptr ) return WIN_ERR_INVALID_WINDOW; // verify entry is at top of list - if( (m_modalHead == NULL) || (m_modalHead->window != window) ) + if( (m_modalHead == nullptr) || (m_modalHead->window != window) ) { // return error if not @@ -1613,9 +1613,9 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh // first check to make sure we have some buttons to display if(buttonFlags == 0 ) { - return NULL; + return nullptr; } - GameWindow *trueParent = NULL; + GameWindow *trueParent = nullptr; //Changed by Chris if(useLogo) trueParent = winCreateFromScript( "Menus/QuitMessageBox.wnd" ); @@ -1629,13 +1629,13 @@ GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int heigh menuName.set("MessageBox.wnd:"); AsciiString tempName; - GameWindow *parent = NULL; + GameWindow *parent = nullptr; tempName = menuName; tempName.concat("MessageBoxParent"); parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); winSetModal( trueParent ); - winSetFocus( NULL ); // make sure we lose focus from other windows even if we refuse focus ourselves + winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves winSetFocus( parent ); // If the user wants the size to be different then the default @@ -1789,7 +1789,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, DEBUG_LOG(( "Cann't create button gadget, instance data not button type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1798,12 +1798,12 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, x, y, width, height, GadgetPushButtonSystem, instData ); - if( button == NULL ) + if( button == nullptr ) { DEBUG_LOG(( "Unable to create button for push button gadget" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1822,8 +1822,8 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, // set the owner to the parent, or if no parent it will be itself button->winSetOwner( parent ); - // Init the userdata to NULL - button->winSetUserData(NULL); + // Init the userdata to null + button->winSetUserData(nullptr); // assign the default images/colors assignDefaultGadgetLook( button, defaultFont, defaultVisual ); @@ -1857,7 +1857,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, DEBUG_LOG(( "Cann't create checkbox gadget, instance data not checkbox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1866,12 +1866,12 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, x, y, width, height, GadgetCheckBoxSystem, instData ); - if( checkbox == NULL ) + if( checkbox == nullptr ) { DEBUG_LOG(( "Unable to create checkbox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1924,7 +1924,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, DEBUG_LOG(( "Cann't create radioButton gadget, instance data not radioButton type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1933,12 +1933,12 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, x, y, width, height, GadgetRadioButtonSystem, instData ); - if( radioButton == NULL ) + if( radioButton == nullptr ) { DEBUG_LOG(( "Unable to create radio button window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -1996,7 +1996,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, DEBUG_LOG(( "Cann't create tabControl gadget, instance data not tabControl type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2005,12 +2005,12 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, x, y, width, height, GadgetTabControlSystem, instData ); - if( tabControl == NULL ) + if( tabControl == nullptr ) { DEBUG_LOG(( "Unable to create tab control window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2068,7 +2068,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, DEBUG_LOG(( "Cann't create listbox gadget, instance data not listbox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2076,12 +2076,12 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, listbox = winCreate( parent, status, x, y, width, height, GadgetListBoxSystem, instData ); - if( listbox == NULL ) + if( listbox == nullptr ) { DEBUG_LOG(( "Unable to create listbox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2163,10 +2163,10 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, else { if( !listboxData->columnWidthPercentage ) - return NULL; + return nullptr; listboxData->columnWidth = NEW Int[listboxData->columns]; if(!listboxData->columnWidth) - return NULL; + return nullptr; Int totalWidth = width; if( listboxData->slider ) @@ -2247,17 +2247,17 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, DEBUG_LOG(( "gogoGadgetSlider warning: unrecognized slider style." )); assert( 0 ); - return NULL; + return nullptr; } // sanity - if( slider == NULL ) + if( slider == nullptr ) { DEBUG_LOG(( "Unable to create slider control window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2282,10 +2282,10 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) button = gogoGadgetPushButton( slider, statusFlags, 0, HORIZONTAL_SLIDER_THUMB_POSITION, - HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, NULL, TRUE ); + HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, nullptr, TRUE ); else button = gogoGadgetPushButton( slider, statusFlags, 0, 0, - width, width+1, &buttonInstData, NULL, TRUE ); + width, width+1, &buttonInstData, nullptr, TRUE ); // Protect against divide by zero if( sliderData->maxVal == sliderData->minVal ) @@ -2336,7 +2336,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, DEBUG_LOG(( "Cann't create ComboBox gadget, instance data not ComboBox type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2344,12 +2344,12 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, comboBox = winCreate( parent, status, x, y, width, height, GadgetComboBoxSystem, instData ); - if( comboBox == NULL ) + if( comboBox == nullptr ) { DEBUG_LOG(( "Unable to create ComboBox window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2422,7 +2422,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, width - buttonWidth, 0, buttonWidth, height, - &winInstData, NULL, TRUE ); + &winInstData, nullptr, TRUE ); comboBoxData->dropDownButton->winSetTooltipFunc(comboBox->winGetTooltipFunc()); comboBoxData->dropDownButton->winSetTooltip(instData->getTooltipText()); comboBoxData->dropDownButton->setTooltipDelay(comboBox->getTooltipDelay()); @@ -2540,7 +2540,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, DEBUG_LOG(( "Cann't create progressBar gadget, instance data not progressBar type" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2549,12 +2549,12 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, x, y, width, height, GadgetProgressBarSystem, instData ); - if( progressBar == NULL ) + if( progressBar == nullptr ) { DEBUG_LOG(( "Unable to create progress bar control" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2605,10 +2605,10 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, else { DEBUG_LOG(( "gogoGadgetText warning: unrecognized text style." )); - return NULL; + return nullptr; } - if( textWin != NULL ) + if( textWin != nullptr ) { // set the owner to the parent, or if no parent it will be itself @@ -2622,7 +2622,7 @@ GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, textWin->winSetDrawFunc( getStaticTextDrawFunc() ); data = NEW TextData; - assert( textData != NULL ); + assert( textData != nullptr ); memcpy( data, textData, sizeof(TextData) ); // allocate a display string for the tet @@ -2668,19 +2668,19 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, DEBUG_LOG(( "Unable to create text entry, style not entry type" )); assert( 0 ); - return NULL; + return nullptr; } // create the window entry = winCreate( parent, status, x, y, width, height, GadgetTextEntrySystem, instData ); - if( entry == NULL ) + if( entry == nullptr ) { DEBUG_LOG(( "Unable to create text entry window" )); assert( 0 ); - return NULL; + return nullptr; } @@ -2733,7 +2733,7 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, entry->winSetUserData( data ); // asian languages get to have list box kanji character completion - data->constructList = NULL; + data->constructList = nullptr; if( OurLanguage == LANGUAGE_ID_KOREAN || OurLanguage == LANGUAGE_ID_JAPANESE ) { @@ -2753,11 +2753,11 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, lData.scrollBar = TRUE; lData.multiSelect = FALSE; lData.columns = 1; - lData.columnWidth = NULL; + lData.columnWidth = nullptr; boxInstData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - data->constructList = gogoGadgetListBox( NULL, + data->constructList = gogoGadgetListBox( nullptr, WIN_STATUS_ABOVE | WIN_STATUS_HIDDEN | WIN_STATUS_NO_FOCUS | @@ -2766,16 +2766,16 @@ GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, 110, 119, &boxInstData, &lData, - NULL, + nullptr, TRUE ); - if( data->constructList == NULL ) + if( data->constructList == nullptr ) { DEBUG_LOG(( "gogoGadgetEntry warning: Failed to create listbox." )); assert( 0 ); winDestroy( entry ); - return NULL; + return nullptr; } @@ -2836,7 +2836,7 @@ void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, WinInstanceData *instData; // sanity - if( gadget == NULL ) + if( gadget == nullptr ) return; // get instance data @@ -3549,7 +3549,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn return m_grabWindow->winPointInChild( x, y, ignoreEnabled ); } - GameWindow *window = NULL; + GameWindow *window = nullptr; if( m_modalHead && m_modalHead->window ) { return m_modalHead->window->winPointInChild( x, y, ignoreEnabled ); @@ -3577,7 +3577,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } // check !above, below and hidden - if( window == NULL ) + if( window == nullptr ) { for( window = m_windowList; window; window = window->m_next ) { @@ -3600,7 +3600,7 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn } // check below and !hidden - if( window == NULL ) + if( window == nullptr ) { for( window = m_windowList; window; window = window->m_next ) { @@ -3627,11 +3627,11 @@ GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEn if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT )) { // this window does not accept input, discard - window = NULL; + window = nullptr; } else if( ignoreEnabled && !( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) )) { - window = NULL; + window = nullptr; } } @@ -3676,11 +3676,11 @@ Bool GameWindowManager::initTestGUI( void ) WinInstanceData instData; // make some windows inside each other in the upper left - window = winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - window = winCreate( window, statusFlags, 10, 10, 50, 50, NULL, NULL ); + window = winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); @@ -3689,56 +3689,56 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "What Up?"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Enabled"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, WIN_STATUS_ENABLED, 330, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a push button instData.init(); BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); instData.m_textLabelString = "Disabled"; - window = gogoGadgetPushButton( NULL, + window = gogoGadgetPushButton( nullptr, 0, 450, 100, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a check box instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a check box instData.init(); instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( NULL, + window = gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED, 330, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make window to hold radio buttons - window = winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, - 200, 200, 250, 45, NULL ); + window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); @@ -3755,7 +3755,7 @@ Bool GameWindowManager::initTestGUI( void ) 10, 10, 100, 30, &instData, - &rData, NULL, TRUE ); + &rData, nullptr, TRUE ); // make a radio button instData.init(); @@ -3766,7 +3766,7 @@ Bool GameWindowManager::initTestGUI( void ) 130, 10, 100, 30, &instData, - &rData, NULL, TRUE ); + &rData, nullptr, TRUE ); GadgetRadioSetEnabledColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); GadgetRadioSetEnabledBorderColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); @@ -3781,15 +3781,15 @@ Bool GameWindowManager::initTestGUI( void ) listData.multiSelect = 1; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; + listData.columnWidth = nullptr; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( NULL, + window = gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", winMakeColor( 255, 255, 255, 255 ), -1, 0 ); GadgetListBoxAddEntryText( window, L"More text", @@ -3814,15 +3814,15 @@ Bool GameWindowManager::initTestGUI( void ) listData.multiSelect = 0; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; + listData.columnWidth = nullptr; instData.init(); instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( NULL, + window = gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", winMakeColor( 255, 255, 255, 255 ), -1, -1 ); GadgetListBoxAddEntryText( window, L"More text", @@ -3845,12 +3845,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED, 360, 250, 11, 100, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a vert slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3860,12 +3860,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 400, 250, 11, 100, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a horizontal slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3875,12 +3875,12 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED, 200, 400, 200, 11, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a horizontal slider memset( &sliderData, 0, sizeof( sliderData ) ); @@ -3890,30 +3890,30 @@ Bool GameWindowManager::initTestGUI( void ) sliderData.position = 0; instData.init(); instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( NULL, + window = gogoGadgetSlider( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 420, 200, 11, &instData, - &sliderData, NULL, TRUE ); + &sliderData, nullptr, TRUE ); // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( nullptr, WIN_STATUS_ENABLED, 200, 450, 250, 15, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make a progress bar instData.init(); instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( NULL, + window = gogoGadgetProgressBar( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 470, 250, 15, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make some static text TextData textData; @@ -3921,24 +3921,24 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Centered Static Text"; - window = gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED, 200, 490, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); // make some static text textData.centered = 0; instData.init(); instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; instData.m_textLabelString = "Not Centered Static Text"; - window = gogoGadgetStaticText( NULL, + window = gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), winMakeColor( 255, 255, 255, 255 ) ); @@ -3949,12 +3949,12 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( nullptr, WIN_STATUS_ENABLED, 450, 270, 400, 30, &instData, - &entryData, NULL, TRUE ); + &entryData, nullptr, TRUE ); // make some entry text memset( &entryData, 0, sizeof( entryData ) ); @@ -3962,12 +3962,12 @@ Bool GameWindowManager::initTestGUI( void ) instData.init(); instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( NULL, + window = gogoGadgetTextEntry( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 450, 310, 400, 30, &instData, - &entryData, NULL, TRUE ); + &entryData, nullptr, TRUE ); return TRUE; @@ -3995,7 +3995,7 @@ void GameWindowManager::winNextTab( GameWindow *window ) { winSetFocus(*m_tabList.begin()); } - winSetLoneWindow(NULL); + winSetLoneWindow(nullptr); } void GameWindowManager::winPrevTab( GameWindow *window ) @@ -4019,7 +4019,7 @@ void GameWindowManager::winPrevTab( GameWindow *window ) { winSetFocus(*m_tabList.rbegin()); } - winSetLoneWindow(NULL); + winSetLoneWindow(nullptr); } void GameWindowManager::registerTabList( GameWindowList tabList ) @@ -4037,7 +4037,7 @@ void GameWindowManager::clearTabList( void ) GameWindow *GameWindowManagerDummy::winGetWindowFromId(GameWindow *window, Int id) { window = GameWindowManager::winGetWindowFromId(window, id); - if (window != NULL) + if (window != nullptr) return window; // Just return any window, callers expect this to be non-null @@ -4052,7 +4052,7 @@ WindowMsgHandledType DummyWindowSystem(GameWindow *window, UnsignedInt msg, Wind GameWindow *GameWindowManagerDummy::winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) { WindowLayoutInfo scriptInfo; - GameWindow* dummyWindow = winCreate(NULL, 0, 0, 0, 100, 100, DummyWindowSystem, NULL); + GameWindow* dummyWindow = winCreate(nullptr, 0, 0, 0, 100, 100, DummyWindowSystem, nullptr); scriptInfo.windows.push_back(dummyWindow); if (info) *info = scriptInfo; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index b416fd0f5b1..044386f9134 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -115,10 +115,10 @@ struct GameWindowParse /////////////////////////////////////////////////////////////////////////////// // window methods and their string representations -static GameWinSystemFunc systemFunc = NULL; -static GameWinInputFunc inputFunc = NULL; -static GameWinTooltipFunc tooltipFunc = NULL; -static GameWinDrawFunc drawFunc = NULL; +static GameWinSystemFunc systemFunc = nullptr; +static GameWinInputFunc inputFunc = nullptr; +static GameWinTooltipFunc tooltipFunc = nullptr; +static GameWinDrawFunc drawFunc = nullptr; static AsciiString theSystemString; static AsciiString theInputString; static AsciiString theTooltipString; @@ -131,7 +131,7 @@ static Color defBackgroundColor = 0; static Color defHiliteColor = 0; static Color defSelectedColor = 0; static Color defTextColor = 0; -static GameFont *defFont = NULL; +static GameFont *defFont = nullptr; // // These strings must be in the same order as they are in their definitions @@ -144,7 +144,7 @@ const char *const WindowStatusNames[] = { "ACTIVE", "TOGGLE", "DRAGABLE", "ENABL "RIGHT_CLICK", "WRAP_CENTERED", "CHECK_LIKE","HOTKEY_TEXT", "USE_OVERLAY_STATES", "NOT_READY", "FLASHING", "ALWAYS_COLOR", "ON_MOUSE_DOWN", /*"SHORTCUT_BUTTON",*/ - NULL }; + nullptr }; const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX", "VERTSLIDER", "HORZSLIDER", "SCROLLLISTBOX", @@ -152,7 +152,7 @@ const char *const WindowStyleNames[] = { "PUSHBUTTON", "RADIOBUTTON", "CHECKBOX" "USER", "MOUSETRACK", "ANIMATED", "TABSTOP", "TABCONTROL", "TABPANE", "COMBOBOX", - NULL }; + nullptr }; // Implement a stack to keep track of parent/child nested window descriptions. static GameWindow *windowStack[ WIN_STACK_DEPTH ]; @@ -236,7 +236,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPt if( strncmp( buffer, "NULL", 4 ) != 0 ) { - for( tok = strtok( buffer, "+" ); tok; tok = strtok( NULL, "+" ) ) + for( tok = strtok( buffer, "+" ); tok; tok = strtok( nullptr, "+" ) ) { if ( !parseBitFlag( tok, bits, flagList ) ) { @@ -354,7 +354,7 @@ static void resetWindowDefaults( void ) defHiliteColor = 0; defSelectedColor = 0; defTextColor = 0; - defFont = 0; + defFont = nullptr; } @@ -363,7 +363,7 @@ static void resetWindowDefaults( void ) static GameWindow *peekWindow( void ) { if (stackPtr == windowStack) - return NULL; + return nullptr; return *(stackPtr - 1); @@ -375,7 +375,7 @@ static GameWindow *popWindow( void ) { if( stackPtr == windowStack ) - return NULL; + return nullptr; stackPtr--; return *stackPtr; @@ -411,10 +411,10 @@ static Bool parseColor( Color *color, char *buffer ) c = strtok( buffer, " \t\n\r" ); red = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); green = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); blue = atoi(c); *color = TheWindowManager->winMakeColor( red, green, blue, 255 ); @@ -466,7 +466,7 @@ static Bool parseDefaultFont( GameFont *font, File *inFile, char *buffer ) /// @todo font parsing for window files work needed here // *font = GetFont( buffer ); -// if( *font == NULL ) +// if( *font == nullptr ) // return FALSE; return TRUE; @@ -503,22 +503,22 @@ static Bool parseScreenRect( const char *token, char *buffer, const char *seps = " ,:=\n\r\t"; char *c; - c = strtok( NULL, seps ); // UPPERLEFT token - c = strtok( NULL, seps ); // x position + c = strtok( nullptr, seps ); // UPPERLEFT token + c = strtok( nullptr, seps ); // x position scanInt( c, screenRegion.lo.x ); - c = strtok( NULL, seps ); // y posotion + c = strtok( nullptr, seps ); // y posotion scanInt( c, screenRegion.lo.y ); - c = strtok( NULL, seps ); // BOTTOMRIGHT token - c = strtok( NULL, seps ); // x position + c = strtok( nullptr, seps ); // BOTTOMRIGHT token + c = strtok( nullptr, seps ); // x position scanInt( c, screenRegion.hi.x ); - c = strtok( NULL, seps ); // y posotion + c = strtok( nullptr, seps ); // y posotion scanInt( c, screenRegion.hi.y ); - c = strtok( NULL, seps ); // CREATIONRESOLUTION token - c = strtok( NULL, seps ); // x creation resolution + c = strtok( nullptr, seps ); // CREATIONRESOLUTION token + c = strtok( nullptr, seps ); // x creation resolution scanInt( c, createRes.x ); - c = strtok( NULL, seps ); // y creation resolution + c = strtok( nullptr, seps ); // y creation resolution scanInt( c, createRes.y ); // @@ -577,7 +577,7 @@ static Bool parseImageOffset( const char *token, WinInstanceData *instData, c = strtok( buffer, " \t\n\r" ); instData->m_imageOffset.x = atoi( c ); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); instData->m_imageOffset.y = atoi( c ); return TRUE; @@ -608,13 +608,13 @@ static Bool parseFont( const char *token, WinInstanceData *instData, strlcpy(fontName, c, ARRAY_SIZE(fontName)); // "SIZE" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, fontSize ); // "BOLD" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, fontBold ); if( TheFontLibrary ) @@ -829,21 +829,21 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // "LENGTH" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); + c = strtok( nullptr, seps ); scanShort( c, listData->listLength ); // "AUTOSCROLL" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->autoScroll ); // "SCROLLIFATEND" (optional) - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label if ( stricmp(c, "ScrollIfAtEnd") == 0 ) { - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, listData->scrollIfAtEnd ); - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label } else { @@ -851,22 +851,22 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, } // "AUTOPURGE" - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, listData->autoPurge ); // "SCROLLBAR" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->scrollBar ); // "MULTISELECT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->multiSelect ); // "COLUMNS" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanShort( c, listData->columns ); if(listData->columns > 1) { @@ -874,17 +874,17 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, for(Int i = 0; i < listData->columns; i++ ) { // "COLUMNS" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, listData->columnWidthPercentage[i] ); } } else - listData->columnWidthPercentage = NULL; - listData->columnWidth = NULL; + listData->columnWidthPercentage = nullptr; + listData->columnWidth = nullptr; // "FORCESELECT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, listData->forceSelect ); @@ -904,23 +904,23 @@ static Bool parseComboBoxData( const char *token, WinInstanceData *instData, const char *seps = " :,\n\r\t"; c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, comboData->isEditable ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, comboData->maxChars ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, comboData->maxDisplay ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, comboData->asciiOnly ); - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, comboData->lettersAndNumbersOnly ); @@ -939,12 +939,12 @@ static Bool parseSliderData( const char *token, WinInstanceData *instData, // "MINVALUE" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, sliderData->minVal ); // "MAXVALUE" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, sliderData->maxVal ); return TRUE; @@ -963,7 +963,7 @@ static Bool parseRadioButtonData( const char *token, WinInstanceData *instData, // "GROUP" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, radioData->group ); return TRUE; @@ -1090,27 +1090,27 @@ static Bool parseTextColor( const char *token, WinInstanceData *instData, if( first == TRUE ) c = strtok( buffer, seps ); // label else - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label first = FALSE; - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); textData->color = GameMakeColor( r, g, b, a ); // border color - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); textData->borderColor = GameMakeColor( r, g, b, a ); @@ -1132,7 +1132,7 @@ static Bool parseStaticTextData( const char *token, WinInstanceData *instData, // "CENTERED" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, textData->centered ); // @todo: add these to GUIEdit options and output @@ -1158,27 +1158,27 @@ static Bool parseTextEntryData( const char *token, WinInstanceData *instData, // "MAXLEN" c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanShort( c, entryData->maxTextLen ); // "SECRETTEXT" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->secretText ); // "NUMERICALONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->numericalOnly ); // "ALPHANUMERICALONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->alphaNumericalOnly ); // "ASCIIONLY" - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanBool( c, entryData->aSCIIOnly ); return TRUE; @@ -1197,43 +1197,43 @@ static Bool parseTabControlData( const char *token, WinInstanceData *instData, //TABORIENTATION c = strtok( buffer, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabOrientation ); //TABEDGE - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabEdge ); //TABWIDTH - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabWidth ); //TABHEIGHT - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabHeight ); //TABCOUNT - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->tabCount ); //PANEBORDER - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, tabControlData->paneBorder ); //PANEDISABLED Int entryCount = 0; - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanInt( c, entryCount ); for( Int paneIndex = 0; paneIndex < entryCount; paneIndex ++ ) { - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanBool( c, tabControlData->subPaneDisabled[paneIndex] ); } @@ -1318,35 +1318,35 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, if( first == TRUE ) c = strtok( buffer, seps ); // label else - c = strtok( NULL, seps ); // label + c = strtok( nullptr, seps ); // label first = FALSE; - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value if( strcmp( c, "NoImage" ) != 0 ) drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); else - drawData->image = NULL; + drawData->image = nullptr; // COLOR: R G B A - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); drawData->color = GameMakeColor( r, g, b, a ); // BORDERCOLOR: R G B A - c = strtok( NULL, seps ); // label - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // label + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, r ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, g ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, b ); - c = strtok( NULL, seps ); // value + c = strtok( nullptr, seps ); // value scanUnsignedInt( c, a ); drawData->borderColor = GameMakeColor( r, g, b, a ); @@ -1418,7 +1418,7 @@ void *getDataTemplate( char *type ) data = &cData; } else - data = NULL; + data = nullptr; return data; @@ -1462,7 +1462,7 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); sData.minVal = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); sData.maxVal = atoi(c); *data = &sData; @@ -1476,22 +1476,22 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); lData.listLength = atoi(c); -// c = strtok( NULL, " \t\n\r" ); +// c = strtok( nullptr, " \t\n\r" ); // lData.entryHeight = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.autoScroll = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.autoPurge = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.scrollBar = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.multiSelect = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); lData.forceSelect = atoi(c); *data = &lData; @@ -1505,13 +1505,13 @@ static Bool parseData( void **data, char *type, char *buffer ) c = strtok( buffer, " \t\n\r" ); eData.maxTextLen = atoi(c); - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); // if (c) // eData.entryWidth = atoi(c); // else // eData.entryWidth = -1; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); if (c) { eData.secretText = atoi(c); @@ -1522,7 +1522,7 @@ static Bool parseData( void **data, char *type, char *buffer ) else eData.secretText = FALSE; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); if (c) { eData.numericalOnly = ( atoi(c) == 1 ); @@ -1547,7 +1547,7 @@ static Bool parseData( void **data, char *type, char *buffer ) if( tData.centered != FALSE ) tData.centered = TRUE; - c = strtok( NULL, " \t\n\r" ); + c = strtok( nullptr, " \t\n\r" ); /** @todo need to get a label from the translation manager, uncomment the following line and remove the WideChar assignment when @@ -1572,7 +1572,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &rData; } else - *data = NULL; + *data = nullptr; return TRUE; @@ -1621,7 +1621,7 @@ static GameWindow *createGadget( char *type, WinInstanceData *instData, void *data ) { - GameWindow *window = NULL; + GameWindow *window = nullptr; instData->m_owner = parent; @@ -1853,8 +1853,8 @@ static GameWindow *createGadget( char *type, cData->listboxData->multiSelect = 0; cData->listboxData->forceSelect = 1; cData->listboxData->columns = 1; - cData->listboxData->columnWidth = NULL; - cData->listboxData->columnWidthPercentage = NULL; + cData->listboxData->columnWidth = nullptr; + cData->listboxData->columnWidthPercentage = nullptr; instData->m_style |= GWS_COMBO_BOX; window = TheWindowManager->gogoGadgetComboBox( parent, status, x, y, @@ -2089,7 +2089,7 @@ static GameWindow *createWindow( char *type, } - // assign the callbacks if they are not empty/NULL, that means they were read + // assign the callbacks if they are not empty/nullptr, that means they were read // in and parsed from the window definition file if( window ) { @@ -2148,7 +2148,7 @@ static Bool parseChildWindows( GameWindow *window, //of the ones from the script file. So kill them before reading. if( BitIsSet( window->winGetStyle(), GWS_TAB_CONTROL ) ) { - GameWindow *nextWindow = NULL; + GameWindow *nextWindow = nullptr; for( GameWindow *myChild = window->winGetChild(); myChild; myChild = nextWindow ) { nextWindow = myChild->winGetNext(); @@ -2223,7 +2223,7 @@ static Bool parseChildWindows( GameWindow *window, { // Parse window descriptions until the last END is read - if( parseWindow( inFile, buffer ) == NULL ) + if( parseWindow( inFile, buffer ) == nullptr ) { return FALSE; } @@ -2303,7 +2303,7 @@ static GameWindowParse gameWindowFieldList[] = { "IMAGEOFFSET", parseImageOffset }, { "TOOLTIP", parseTooltip }, - { NULL, NULL } + { nullptr, nullptr } }; // parseWindow ================================================================ @@ -2312,14 +2312,14 @@ static GameWindowParse gameWindowFieldList[] = static GameWindow *parseWindow( File *inFile, char *buffer ) { GameWindowParse *parse; - GameWindow *window = NULL; + GameWindow *window = nullptr; GameWindow *parent = peekWindow(); WinInstanceData instData; char type[64]; char token[ 256 ]; char *c; Int x, y, width, height; - void *data = NULL; + void *data = nullptr; ICoord2D parentSize; AsciiString asciibuf; @@ -2327,10 +2327,10 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) // reset our 'static globals' that house the current parsed window callback // definitions to empty // - systemFunc = NULL; - inputFunc = NULL; - tooltipFunc = NULL; - drawFunc = NULL; + systemFunc = nullptr; + inputFunc = nullptr; + tooltipFunc = nullptr; + drawFunc = nullptr; theSystemString.clear(); theInputString.clear(); theTooltipString.clear(); @@ -2369,7 +2369,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) readUntilSemicolon( inFile, buffer, WIN_BUFFER_LENGTH ); c = strtok( buffer, seps ); assert( strcmp( c, "WINDOWTYPE" ) == 0 ); - c = strtok( NULL, seps ); // get data to right of = sign + c = strtok( nullptr, seps ); // get data to right of = sign strlcpy(type, c, ARRAY_SIZE(type)); // @@ -2417,7 +2417,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) } - if( parse->parse == NULL ) + if( parse->parse == nullptr ) { // If it's the END keyword @@ -2443,7 +2443,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) instData.m_font = TheHeaderTemplateManager->getFontFromTemplate(instData.m_headerTemplateName); // Create a window using the current description - if( window == NULL ) + if( window == nullptr ) window = createWindow( type, instData.m_id, instData.getStatus(), x, y, width, height, &instData, data, systemFunc, inputFunc, tooltipFunc, drawFunc ); @@ -2460,7 +2460,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) width, height, &instData, data, systemFunc, inputFunc, tooltipFunc, drawFunc ); - if (window == NULL) + if (window == nullptr) goto cleanupAndExit; // Parses the CHILD's window info. @@ -2468,7 +2468,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) { TheWindowManager->winDestroy( window ); - window = NULL; + window = nullptr; goto cleanupAndExit; } @@ -2495,7 +2495,7 @@ static GameWindow *parseWindow( File *inFile, char *buffer ) // // I am commenting this out to get tooltips working, If for // some reason we start having displayString problems... CLH -// assert( instData.m_text == NULL && instData.m_tooltip == NULL ); +// assert( instData.m_text == nullptr && instData.m_tooltip == nullptr ); return window; @@ -2568,7 +2568,7 @@ static LayoutScriptParse layoutScriptTable[] = { "LAYOUTUPDATE", parseUpdate }, { "LAYOUTSHUTDOWN", parseShutdown }, - { NULL, NULL }, + { nullptr, nullptr }, }; @@ -2653,7 +2653,7 @@ WindowLayout *GameWindowManager::winCreateLayout( AsciiString filename ) { deleteInstance(layout); - return NULL; + return nullptr; } @@ -2675,9 +2675,9 @@ void GameWindowManager::freeStaticStrings(void) WindowLayoutInfo::WindowLayoutInfo() : version(0), - init(NULL), - update(NULL), - shutdown(NULL), + init(nullptr), + update(nullptr), + shutdown(nullptr), initNameString(AsciiString::TheEmptyString), updateNameString(AsciiString::TheEmptyString), shutdownNameString(AsciiString::TheEmptyString) @@ -2700,7 +2700,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, { const char* filename = filenameString.str(); static char buffer[ WIN_BUFFER_LENGTH ]; // input buffer for reading - GameWindow *firstWindow = NULL; + GameWindow *firstWindow = nullptr; GameWindow *window; char filepath[ _MAX_PATH ] = "Window\\"; File *inFile; @@ -2721,17 +2721,17 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // a filename only make sure the current directory is set to the right // place for the window files subdirectory // - if( strchr( filename, '\\' ) == NULL ) + if( strchr( filename, '\\' ) == nullptr ) sprintf( filepath, "Window\\%s", filename ); else strlcpy(filepath, filename, ARRAY_SIZE(filepath)); // Open the input file inFile = TheFileSystem->openFile(filepath, File::READ); - if (inFile == NULL) + if (inFile == nullptr) { DEBUG_LOG(( "WinCreateFromScript: Cannot access file '%s'.", filename )); - return NULL; + return nullptr; } // read into memory @@ -2739,7 +2739,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // read the file version Int version; - inFile->read(NULL, strlen("FILE_VERSION = ")); + inFile->read(nullptr, strlen("FILE_VERSION = ")); inFile->scanInt(version); inFile->nextLine(); @@ -2783,8 +2783,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defEnabledColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2794,8 +2794,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defDisabledColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2805,8 +2805,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defHiliteColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2816,8 +2816,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defSelectedColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2827,8 +2827,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defTextColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2838,8 +2838,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultColor( &defBackgroundColor, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2849,8 +2849,8 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, if( parseDefaultFont( defFont, inFile, buffer ) == FALSE ) { inFile->close(); - inFile = NULL; - return NULL; + inFile = nullptr; + return nullptr; } } @@ -2861,7 +2861,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, window = parseWindow( inFile, buffer ); // save first window created - if( firstWindow == NULL ) + if( firstWindow == nullptr ) firstWindow = window; scriptInfo.windows.push_back(window); @@ -2872,7 +2872,7 @@ GameWindow *GameWindowManager::winCreateFromScript( AsciiString filenameString, // close the file inFile->close(); - inFile = NULL; + inFile = nullptr; // if info parameter is provided, copy info to the param if( info ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 684b10dff8b..19458e64a61 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -58,14 +58,14 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -GameWindowTransitionsHandler *TheTransitionHandler = NULL; +GameWindowTransitionsHandler *TheTransitionHandler = nullptr; const FieldParse GameWindowTransitionsHandler::m_gameWindowTransitionsFieldParseTable[] = { - { "Window", GameWindowTransitionsHandler::parseWindow, NULL, NULL }, - { "FireOnce", INI::parseBool, NULL, offsetof( TransitionGroup, m_fireOnce) }, + { "Window", GameWindowTransitionsHandler::parseWindow, nullptr, 0 }, + { "FireOnce", INI::parseBool, nullptr, offsetof( TransitionGroup, m_fireOnce) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -136,9 +136,9 @@ Transition *getTransitionForStyle( Int style ) default: DEBUG_ASSERTCRASH(FALSE, ("getTransitionForStyle:: An invalid style was passed in. Style = %d", style)); - return NULL; + return nullptr; } - return NULL; + return nullptr; } TransitionWindow::TransitionWindow( void ) @@ -147,8 +147,8 @@ TransitionWindow::TransitionWindow( void ) m_style = 0; m_winID = NAMEKEY_INVALID; - m_win = NULL; - m_transition = NULL; + m_win = nullptr; + m_transition = nullptr; } TransitionWindow::~TransitionWindow( void ) @@ -156,16 +156,16 @@ TransitionWindow::~TransitionWindow( void ) if (m_win) m_win->unlinkTransitionWindow(this); - m_win = NULL; + m_win = nullptr; delete m_transition; - m_transition = NULL; + m_transition = nullptr; } Bool TransitionWindow::init( void ) { m_winID = TheNameKeyGenerator->nameToKey(m_winName); - m_win = TheWindowManager->winGetWindowFromId(NULL, m_winID); + m_win = TheWindowManager->winGetWindowFromId(nullptr, m_winID); m_currentFrameDelay = m_frameDelay; // DEBUG_ASSERTCRASH( m_win, ("TransitionWindow::init Failed to find window %s", m_winName.str())); // if( !m_win ) @@ -223,7 +223,7 @@ void TransitionWindow::unlinkGameWindow(GameWindow* win) return; m_transition->unlinkGameWindow(win); - m_win = NULL; + m_win = nullptr; } Int TransitionWindow::getTotalFrames( void ) @@ -359,19 +359,19 @@ void TransitionGroup::addWindow( TransitionWindow *transWin ) GameWindowTransitionsHandler::GameWindowTransitionsHandler(void) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } GameWindowTransitionsHandler::~GameWindowTransitionsHandler( void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; TransitionGroupList::iterator it = m_transitionGroupList.begin(); while( it != m_transitionGroupList.end() ) @@ -384,26 +384,26 @@ GameWindowTransitionsHandler::~GameWindowTransitionsHandler( void ) void GameWindowTransitionsHandler::init(void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } void GameWindowTransitionsHandler::load(void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\WindowTransitions", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\WindowTransitions", INI_LOAD_OVERWRITE, nullptr ); } void GameWindowTransitionsHandler::reset( void ) { - m_currentGroup = NULL; - m_pendingGroup = NULL; - m_drawGroup = NULL; - m_secondaryDrawGroup = NULL; + m_currentGroup = nullptr; + m_pendingGroup = nullptr; + m_drawGroup = nullptr; + m_secondaryDrawGroup = nullptr; } @@ -412,7 +412,7 @@ void GameWindowTransitionsHandler::update( void ) if(m_drawGroup != m_currentGroup) m_secondaryDrawGroup = m_drawGroup; else - m_secondaryDrawGroup = NULL; + m_secondaryDrawGroup = nullptr; m_drawGroup = m_currentGroup; if(m_currentGroup && !m_currentGroup->isFinished()) @@ -420,23 +420,23 @@ void GameWindowTransitionsHandler::update( void ) if(m_currentGroup && m_currentGroup->isFinished() && m_currentGroup->isFireOnce()) { - m_currentGroup = NULL; + m_currentGroup = nullptr; } if(m_currentGroup && m_pendingGroup && m_currentGroup->isFinished()) { m_currentGroup = m_pendingGroup; - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(!m_currentGroup && m_pendingGroup) { m_currentGroup = m_pendingGroup; - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(m_currentGroup && m_currentGroup->isFinished() && m_currentGroup->isReversed()) - m_currentGroup = NULL; + m_currentGroup = nullptr; } @@ -452,7 +452,7 @@ void GameWindowTransitionsHandler::draw( void ) void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immidiate ) { if(groupName.isEmpty() && immidiate) - m_currentGroup = NULL; + m_currentGroup = nullptr; if(immidiate && m_currentGroup) { m_currentGroup->skip(); @@ -490,7 +490,7 @@ void GameWindowTransitionsHandler::reverse( AsciiString groupName ) } if( m_pendingGroup == g) { - m_pendingGroup = NULL; + m_pendingGroup = nullptr; return; } if(m_currentGroup) @@ -502,7 +502,7 @@ void GameWindowTransitionsHandler::reverse( AsciiString groupName ) m_currentGroup->init(); m_currentGroup->skip(); m_currentGroup->reverse(); - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPending ) @@ -513,12 +513,12 @@ void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPend if(skipPending) m_pendingGroup->skip(); - m_pendingGroup = NULL; + m_pendingGroup = nullptr; } if(m_currentGroup == g) { m_currentGroup->skip(); - m_currentGroup = NULL; + m_currentGroup = nullptr; if(m_pendingGroup) m_currentGroup = m_pendingGroup; } @@ -527,13 +527,13 @@ void GameWindowTransitionsHandler::remove( AsciiString groupName, Bool skipPend TransitionGroup *GameWindowTransitionsHandler::getNewGroup( AsciiString name ) { if(name.isEmpty()) - return NULL; + return nullptr; // test to see if we're trying to add an already exisitng group. if(findGroup(name)) { DEBUG_ASSERTCRASH(FALSE, ("GameWindowTransitionsHandler::getNewGroup - We already have a group %s", name.str())); - return NULL; + return nullptr; } TransitionGroup *g = NEW TransitionGroup; g->setName(name); @@ -554,7 +554,7 @@ Bool GameWindowTransitionsHandler::isFinished( void ) TransitionGroup *GameWindowTransitionsHandler::findGroup( AsciiString groupName ) { if(groupName.isEmpty()) - return NULL; + return nullptr; TransitionGroupList::iterator it = m_transitionGroupList.begin(); while( it != m_transitionGroupList.end() ) @@ -564,17 +564,17 @@ TransitionGroup *GameWindowTransitionsHandler::findGroup( AsciiString groupName return g; it++; } - return NULL; + return nullptr; } void GameWindowTransitionsHandler::parseWindow( INI* ini, void *instance, void *store, const void *userData ) { static const FieldParse myFieldParse[] = { - { "WinName", INI::parseAsciiString, NULL, offsetof( TransitionWindow, m_winName ) }, + { "WinName", INI::parseAsciiString, nullptr, offsetof( TransitionWindow, m_winName ) }, { "Style", INI::parseLookupList, TransitionStyleNames, offsetof( TransitionWindow, m_style ) }, - { "FrameDelay", INI::parseInt, NULL, offsetof( TransitionWindow, m_frameDelay ) }, - { NULL, NULL, NULL, 0 } + { "FrameDelay", INI::parseInt, nullptr, offsetof( TransitionWindow, m_frameDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; TransitionWindow *transWin = NEW TransitionWindow; ini->initFromINI(transWin, myFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index dfedf3d0954..2f749338f93 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -83,14 +83,14 @@ Transition::~Transition( void ) FlashTransition::FlashTransition ( void ) { m_frameLength = FLASHTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } FlashTransition::~FlashTransition( void ) { - m_win = NULL; + m_win = nullptr; } void FlashTransition::init( GameWindow *win ) @@ -239,14 +239,14 @@ void FlashTransition::skip( void ) ButtonFlashTransition::ButtonFlashTransition ( void ) { m_frameLength = BUTTONFLASHTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ButtonFlashTransition::~ButtonFlashTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ButtonFlashTransition::init( GameWindow *win ) @@ -613,14 +613,14 @@ void ButtonFlashTransition::skip( void ) FadeTransition::FadeTransition ( void ) { m_frameLength = FADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } FadeTransition::~FadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } void FadeTransition::init( GameWindow *win ) @@ -750,14 +750,14 @@ void FadeTransition::skip( void ) ScaleUpTransition::ScaleUpTransition ( void ) { m_frameLength = SCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ScaleUpTransition::~ScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ScaleUpTransition::init( GameWindow *win ) @@ -873,14 +873,14 @@ void ScaleUpTransition::skip( void ) ScoreScaleUpTransition::ScoreScaleUpTransition ( void ) { m_frameLength = SCORESCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } ScoreScaleUpTransition::~ScoreScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void ScoreScaleUpTransition::init( GameWindow *win ) @@ -996,14 +996,14 @@ void ScoreScaleUpTransition::skip( void ) MainMenuScaleUpTransition::MainMenuScaleUpTransition ( void ) { m_frameLength = MAINMENUSCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuScaleUpTransition::~MainMenuScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuScaleUpTransition::init( GameWindow *win ) @@ -1014,7 +1014,7 @@ void MainMenuScaleUpTransition::init( GameWindow *win ) m_win->winGetSize(&m_size.x, &m_size.y); m_win->winGetScreenPosition(&m_pos.x, &m_pos.y ); } - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinGrowMarker")); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("MainMenu.wnd:WinGrowMarker")); if(!m_growWin) return; @@ -1113,14 +1113,14 @@ void MainMenuScaleUpTransition::skip( void ) MainMenuMediumScaleUpTransition::MainMenuMediumScaleUpTransition ( void ) { m_frameLength = MAINMENUMEDIUMSCALEUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuMediumScaleUpTransition::~MainMenuMediumScaleUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuMediumScaleUpTransition::init( GameWindow *win ) @@ -1134,7 +1134,7 @@ void MainMenuMediumScaleUpTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Medium"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(growWinName)); if(!m_growWin) return; @@ -1232,14 +1232,14 @@ void MainMenuMediumScaleUpTransition::skip( void ) MainMenuSmallScaleDownTransition::MainMenuSmallScaleDownTransition ( void ) { m_frameLength = MAINMENUSMALLSCALEDOWNTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; } MainMenuSmallScaleDownTransition::~MainMenuSmallScaleDownTransition( void ) { - m_win = NULL; + m_win = nullptr; } void MainMenuSmallScaleDownTransition::init( GameWindow *win ) @@ -1253,7 +1253,7 @@ void MainMenuSmallScaleDownTransition::init( GameWindow *win ) AsciiString growWinName; growWinName = m_win->winGetInstanceData()->m_decoratedNameString; growWinName.concat("Small"); - m_growWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey(growWinName)); + m_growWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(growWinName)); if(!m_growWin) return; @@ -1345,18 +1345,18 @@ void MainMenuSmallScaleDownTransition::skip( void ) TextTypeTransition::TextTypeTransition ( void ) { m_frameLength = TEXTTYPETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; - m_dStr = NULL; + m_dStr = nullptr; } TextTypeTransition::~TextTypeTransition( void ) { - m_win = NULL; + m_win = nullptr; if(m_dStr) TheDisplayStringManager->freeDisplayString(m_dStr); - m_dStr = NULL; + m_dStr = nullptr; } void TextTypeTransition::init( GameWindow *win ) @@ -1457,7 +1457,7 @@ void TextTypeTransition::skip( void ) CountUpTransition::CountUpTransition ( void ) { m_frameLength = COUNTUPTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1465,7 +1465,7 @@ CountUpTransition::CountUpTransition ( void ) CountUpTransition::~CountUpTransition( void ) { - m_win = NULL; + m_win = nullptr; } void CountUpTransition::init( GameWindow *win ) @@ -1606,7 +1606,7 @@ void CountUpTransition::skip( void ) ScreenFadeTransition::ScreenFadeTransition ( void ) { m_frameLength = SCREENFADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1614,7 +1614,7 @@ ScreenFadeTransition::ScreenFadeTransition ( void ) ScreenFadeTransition::~ScreenFadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1681,17 +1681,17 @@ void ScreenFadeTransition::skip( void ) ControlBarArrowTransition::ControlBarArrowTransition ( void ) { m_frameLength = CONTROLBARARROWTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; - m_arrowImage = NULL; + m_arrowImage = nullptr; } ControlBarArrowTransition::~ControlBarArrowTransition( void ) { - m_win = NULL; - m_arrowImage = NULL; + m_win = nullptr; + m_arrowImage = nullptr; } void ControlBarArrowTransition::init( GameWindow *win ) @@ -1705,7 +1705,7 @@ void ControlBarArrowTransition::init( GameWindow *win ) m_fadePercent = 1.0f/ (CONTROLBARARROWTRANSITION_END - CONTROLBARARROWTRANSITION_BEGIN_FADE); m_arrowImage = TheControlBar->getArrowImage(); - GameWindow *twin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + GameWindow *twin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(!twin || !m_arrowImage) { m_isFinished = TRUE; @@ -1790,7 +1790,7 @@ void ControlBarArrowTransition::skip( void ) FullFadeTransition::FullFadeTransition ( void ) { m_frameLength = FULLFADETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_drawState = -1; m_isForward = TRUE; @@ -1798,7 +1798,7 @@ FullFadeTransition::FullFadeTransition ( void ) FullFadeTransition::~FullFadeTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1890,14 +1890,14 @@ void FullFadeTransition::skip( void ) TextOnFrameTransition::TextOnFrameTransition ( void ) { m_frameLength = TEXTONFRAMETRANSITION_END; - m_win = NULL; + m_win = nullptr; m_isForward = TRUE; } TextOnFrameTransition::~TextOnFrameTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -1980,14 +1980,14 @@ void TextOnFrameTransition::skip( void ) ReverseSoundTransition::ReverseSoundTransition ( void ) { m_frameLength = REVERSESOUNDTRANSITION_END; - m_win = NULL; + m_win = nullptr; m_isForward = TRUE; } ReverseSoundTransition::~ReverseSoundTransition( void ) { - m_win = NULL; + m_win = nullptr; } @@ -2080,8 +2080,8 @@ void PushButtonImageDrawThree(GameWindow *window, Int alpha ) centerImage = GadgetButtonGetMiddleEnabledImage( window ); // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends @@ -2184,7 +2184,7 @@ static void drawTypeText( GameWindow *window, DisplayString *str) ICoord2D origin, size, textPos; IRegion2D clipRegion; // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; GameFont *font = text->getFont(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp index 4b873a3a771..d1afe4a1d73 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp @@ -65,13 +65,13 @@ //----------------------------------------------------------------------------- const FieldParse HeaderTemplateManager::m_headerFieldParseTable[] = { - { "Font", INI::parseQuotedAsciiString, NULL, offsetof( HeaderTemplate, m_fontName ) }, - { "Point", INI::parseInt, NULL, offsetof( HeaderTemplate, m_point) }, - { "Bold", INI::parseBool, NULL, offsetof( HeaderTemplate, m_bold ) }, - { NULL, NULL, NULL, 0 }, + { "Font", INI::parseQuotedAsciiString, nullptr, offsetof( HeaderTemplate, m_fontName ) }, + { "Point", INI::parseInt, nullptr, offsetof( HeaderTemplate, m_point) }, + { "Bold", INI::parseBool, nullptr, offsetof( HeaderTemplate, m_bold ) }, + { nullptr, nullptr, nullptr, 0 }, }; -HeaderTemplateManager *TheHeaderTemplateManager = NULL; +HeaderTemplateManager *TheHeaderTemplateManager = nullptr; //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- @@ -86,7 +86,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) // find existing item if present hTemplate = TheHeaderTemplateManager->findHeaderTemplate( name ); - if( hTemplate == NULL ) + if( hTemplate == nullptr ) { // allocate a new item @@ -103,7 +103,7 @@ void INI::parseHeaderTemplateDefinition( INI *ini ) } HeaderTemplate::HeaderTemplate( void ) : -m_font(NULL), +m_font(nullptr), m_point(0), m_bold(FALSE) { @@ -135,7 +135,7 @@ void HeaderTemplateManager::init( void ) fname.format("Data\\%s\\HeaderTemplate", GetRegistryLanguage().str()); INI ini; - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, nullptr ); } populateGameFonts(); @@ -151,7 +151,7 @@ HeaderTemplate *HeaderTemplateManager::findHeaderTemplate( AsciiString name ) return hTemplate; ++it; } - return NULL; + return nullptr; } HeaderTemplate *HeaderTemplateManager::newHeaderTemplate( AsciiString name ) @@ -159,7 +159,7 @@ HeaderTemplate *HeaderTemplateManager::newHeaderTemplate( AsciiString name ) HeaderTemplate *newHTemplate = NEW HeaderTemplate; DEBUG_ASSERTCRASH(newHTemplate, ("Unable to create a new Header Template in HeaderTemplateManager::newHeaderTemplate")); if(!newHTemplate) - return NULL; + return nullptr; newHTemplate->m_name = name; m_headerTemplateList.push_front(newHTemplate); @@ -173,7 +173,7 @@ GameFont *HeaderTemplateManager::getFontFromTemplate( AsciiString name ) if(!ht) { //DEBUG_LOG(("HeaderTemplateManager::getFontFromTemplate - Could not find header %s", name.str())); - return NULL; + return nullptr; } return ht->m_font; @@ -183,7 +183,7 @@ HeaderTemplate *HeaderTemplateManager::getFirstHeader( void ) { HeaderTemplateListIt it = m_headerTemplateList.begin(); if( it == m_headerTemplateList.end()) - return NULL; + return nullptr; return *it; } @@ -197,12 +197,12 @@ HeaderTemplate *HeaderTemplateManager::getNextHeader( HeaderTemplate *ht ) { ++it; if( it == m_headerTemplateList.end()) - return NULL; + return nullptr; return *it; } ++it; } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index ccc22ea9f7d..ca6e2798479 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -220,7 +220,7 @@ IMEManager::MessageInfo IMEManager::m_mainMessageInfo[] = { "WM_IME_ENDCOMPOSITION" , WM_IME_ENDCOMPOSITION }, { "WM_IME_COMPOSITION" , WM_IME_COMPOSITION }, { "WM_IME_KEYLAST" , WM_IME_KEYLAST }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_notifyInfo[] = @@ -239,7 +239,7 @@ IMEManager::MessageInfo IMEManager::m_notifyInfo[] = { "IMN_SETSTATUSWINDOWPOS" , IMN_SETSTATUSWINDOWPOS }, { "IMN_GUIDELINE" , IMN_GUIDELINE }, { "IMN_PRIVATE" , IMN_PRIVATE }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_requestInfo[] = @@ -251,7 +251,7 @@ IMEManager::MessageInfo IMEManager::m_requestInfo[] = { "IMR_RECONVERTSTRING" , IMR_RECONVERTSTRING }, { "IMR_CONFIRMRECONVERTSTRING" , IMR_CONFIRMRECONVERTSTRING}, #endif - { NULL, 0 } + { nullptr, 0 } }; @@ -267,7 +267,7 @@ IMEManager::MessageInfo IMEManager::m_controlInfo[] = { "IMC_SETSTATUSWINDOWPOS" , IMC_SETSTATUSWINDOWPOS }, { "IMC_CLOSESTATUSWINDOW" , IMC_CLOSESTATUSWINDOW }, { "IMC_OPENSTATUSWINDOW" , IMC_OPENSTATUSWINDOW }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setContextInfo[] = @@ -278,7 +278,7 @@ IMEManager::MessageInfo IMEManager::m_setContextInfo[] = { "CANDIDATEWINDOW4" , ISC_SHOWUICANDIDATEWINDOW<<3 }, { "COMPOSITIONWINDOW" , ISC_SHOWUICOMPOSITIONWINDOW }, { "GUIDELINE" , ISC_SHOWUIGUIDELINE }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setCmodeInfo[] = @@ -296,7 +296,7 @@ IMEManager::MessageInfo IMEManager::m_setCmodeInfo[] = { "EUDC" , IME_CMODE_EUDC }, { "SYMBOL" , IME_CMODE_SYMBOL }, { "FIXED" , IME_CMODE_FIXED }, - { NULL, 0 } + { nullptr, 0 } }; IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = @@ -307,7 +307,7 @@ IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = { "AUTOMATIC" , IME_SMODE_AUTOMATIC }, { "PHRASEPREDICT" , IME_SMODE_PHRASEPREDICT}, { "CONVERSATION" , IME_SMODE_CONVERSATION }, - { NULL, 0 } + { nullptr, 0 } }; #endif @@ -316,7 +316,7 @@ IMEManager::MessageInfo IMEManager::m_setSmodeInfo[] = // Public Data //---------------------------------------------------------------------------- -IMEManagerInterface *TheIMEManager = NULL; +IMEManagerInterface *TheIMEManager = nullptr; //---------------------------------------------------------------------------- @@ -337,7 +337,7 @@ IMEManagerInterface *TheIMEManager = NULL; Char* IMEManager::getMessageName( IMEManager::MessageInfo *msgTable, Int value ) { - Char *name = NULL; + Char *name = nullptr; if ( msgTable ) { @@ -395,14 +395,14 @@ void IMEManager::printMessageInfo( Int message, Int wParam, Int lParam ) case WM_IME_NOTIFY: { Char *notifyName = getMessageName( m_notifyInfo, wParam ); - if ( notifyName == NULL ) notifyName = "unknown"; + if ( notifyName == nullptr ) notifyName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, notifyName, wParam, lParam )); break; } case WM_IME_CONTROL: { Char *controlName = getMessageName( m_controlInfo, wParam ); - if ( controlName == NULL ) controlName = "unknown"; + if ( controlName == nullptr ) controlName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, controlName, wParam, lParam )); break; @@ -411,7 +411,7 @@ void IMEManager::printMessageInfo( Int message, Int wParam, Int lParam ) case WM_IME_REQUEST: { Char *requestName = getMessageName( m_requestInfo, wParam ); - if ( requestName == NULL ) requestName = "unknown"; + if ( requestName == nullptr ) requestName = "unknown"; DEBUG_LOG(( "IMM: %s(0x%04x) - %s(0x%04x) - 0x%08x", messageText, message, requestName, wParam, lParam )); break; @@ -444,7 +444,7 @@ void IMEManager::printConversionStatus( void ) DWORD mode; if ( m_context ) { - ImmGetConversionStatus( m_context, &mode, NULL ); + ImmGetConversionStatus( m_context, &mode, nullptr ); AsciiString flags; @@ -463,7 +463,7 @@ void IMEManager::printSentenceStatus( void ) DWORD mode; if ( m_context ) { - ImmGetConversionStatus( m_context, NULL, &mode ); + ImmGetConversionStatus( m_context, nullptr, &mode ); AsciiString flags; @@ -494,12 +494,12 @@ IMEManagerInterface *CreateIMEManagerInterface( void ) //============================================================================ IMEManager::IMEManager() -: m_window(NULL), - m_context(NULL), - m_candidateWindow(NULL), - m_statusWindow(NULL), +: m_window(nullptr), + m_context(nullptr), + m_candidateWindow(nullptr), + m_statusWindow(nullptr), m_candidateCount(0), - m_candidateString(NULL), + m_candidateString(nullptr), m_compositionStringLength(0), m_composing(FALSE), m_disabled(0), @@ -507,9 +507,9 @@ IMEManager::IMEManager() m_indexBase(1), m_compositionCharsDisplayed(0), - m_candidateDownArrow(NULL), - m_candidateTextArea(NULL), - m_candidateUpArrow(NULL), + m_candidateDownArrow(nullptr), + m_candidateTextArea(nullptr), + m_candidateUpArrow(nullptr), m_compositionCursorPos(0), m_pageSize(0), m_pageStart(0), @@ -526,8 +526,8 @@ IMEManager::~IMEManager() { if ( m_candidateWindow ) { - m_candidateWindow->winSetUserData( NULL ); - m_candidateTextArea->winSetUserData( NULL ); + m_candidateWindow->winSetUserData( nullptr ); + m_candidateTextArea->winSetUserData( nullptr ); TheWindowManager->winDestroy( m_candidateWindow ); } @@ -583,10 +583,10 @@ void IMEManager::init( void ) - if ( m_candidateTextArea == NULL ) + if ( m_candidateTextArea == nullptr ) { TheWindowManager->winDestroy( m_candidateWindow ); - m_candidateWindow = NULL; + m_candidateWindow = nullptr; } } @@ -598,7 +598,7 @@ void IMEManager::init( void ) } // attach IMEManager to each window - if ( m_candidateWindow != NULL ) + if ( m_candidateWindow != nullptr ) { m_candidateWindow->winSetUserData( TheIMEManager ); m_candidateTextArea->winSetUserData( TheIMEManager ); @@ -651,8 +651,8 @@ void IMEManager::attach( GameWindow *window ) void IMEManager::detatch( void ) { - //ImmAssociateContext( ApplicationHWnd, NULL ); - m_window = NULL; + //ImmAssociateContext( ApplicationHWnd, nullptr ); + m_window = nullptr; } @@ -999,7 +999,7 @@ void IMEManager::enable( void ) void IMEManager::disable( void ) { m_disabled++; - ImmAssociateContext( ApplicationHWnd, NULL ); + ImmAssociateContext( ApplicationHWnd, nullptr ); } //============================================================================ @@ -1008,7 +1008,7 @@ void IMEManager::disable( void ) Bool IMEManager::isEnabled( void ) { - return m_context != NULL && m_disabled == 0; + return m_context != nullptr && m_disabled == 0; } //============================================================================ @@ -1105,7 +1105,7 @@ void IMEManager::updateCompositionString( void ) if ( result >= 0 ) { m_compositionStringLength = result/2; - m_compositionCursorPos = (ImmGetCompositionStringW( m_context, GCS_CURSORPOS, NULL, 0) & 0xffff ); + m_compositionCursorPos = (ImmGetCompositionStringW( m_context, GCS_CURSORPOS, nullptr, 0) & 0xffff ); } else { @@ -1126,7 +1126,7 @@ void IMEManager::updateCompositionString( void ) } else { - m_compositionCursorPos = (ImmGetCompositionString( m_context, GCS_CURSORPOS, NULL, 0) & 0xffff ); + m_compositionCursorPos = (ImmGetCompositionString( m_context, GCS_CURSORPOS, nullptr, 0) & 0xffff ); convRes = wcslen( m_compositionString ); } @@ -1205,7 +1205,7 @@ void IMEManager::getResultsString ( void ) void IMEManager::convertToUnicode ( Char *mbcs, UnicodeString &unicode ) { - int size = MultiByteToWideChar( CP_ACP, 0, mbcs, strlen(mbcs), NULL, 0 ); + int size = MultiByteToWideChar( CP_ACP, 0, mbcs, strlen(mbcs), nullptr, 0 ); unicode.clear(); @@ -1240,7 +1240,7 @@ void IMEManager::convertToUnicode ( Char *mbcs, UnicodeString &unicode ) void IMEManager::openCandidateList( Int candidateFlags ) { - if ( m_candidateWindow == NULL ) + if ( m_candidateWindow == nullptr ) { return; } @@ -1309,14 +1309,14 @@ void IMEManager::openCandidateList( Int candidateFlags ) void IMEManager::closeCandidateList( Int candidateFlags ) { - if ( m_candidateWindow != NULL ) + if ( m_candidateWindow != nullptr ) { m_candidateWindow->winHide( TRUE ); TheWindowManager->winUnsetModal( m_candidateWindow ); } delete [] m_candidateString; - m_candidateString = NULL; + m_candidateString = nullptr; m_candidateCount = 0; @@ -1330,15 +1330,15 @@ void IMEManager::updateCandidateList( Int candidateFlags ) { delete [] m_candidateString; - m_candidateString = NULL; + m_candidateString = nullptr; m_pageSize = 10; m_candidateCount = 0; m_pageStart = 0; m_selectedIndex = 0; - if ( m_candidateWindow == NULL || - m_context == NULL || + if ( m_candidateWindow == nullptr || + m_context == nullptr || candidateFlags == 0) { return; @@ -1366,7 +1366,7 @@ void IMEManager::updateCandidateList( Int candidateFlags ) // create a temporary buffer for reading the candidate list Char *buffer = NEW Char[size]; - if ( buffer == NULL ) + if ( buffer == nullptr ) { return; } @@ -1478,14 +1478,14 @@ Int IMEManager::getIndexBase( void ) void IMEManager::resizeCandidateWindow( Int pageSize ) { - if ( m_candidateWindow == NULL ) + if ( m_candidateWindow == nullptr ) { return; } GameFont *font = m_candidateTextArea->winGetFont(); - if ( font == NULL ) + if ( font == nullptr ) { return; } @@ -1527,7 +1527,7 @@ Int IMEManager::getCandidateCount() const UnicodeString* IMEManager::getCandidate( Int index ) { - if ( m_candidateString != NULL && index >=0 && index < m_candidateCount ) + if ( m_candidateString != nullptr && index >=0 && index < m_candidateCount ) { return &m_candidateString[index]; } @@ -1568,7 +1568,7 @@ Int IMEManager::getCandidatePageStart() void IMEManager::openStatusWindow( void ) { - if ( m_statusWindow == NULL ) + if ( m_statusWindow == nullptr ) { return; } @@ -1581,7 +1581,7 @@ void IMEManager::openStatusWindow( void ) void IMEManager::closeStatusWindow( void ) { - if ( m_statusWindow == NULL ) + if ( m_statusWindow == nullptr ) { return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index ef054982dec..ffb718029d5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -145,7 +145,7 @@ static const Int TELETYPE_UPDATE_FREQ = 2; // how many frames between teletype u LoadScreen::LoadScreen( void ) { - m_loadScreen = NULL; + m_loadScreen = nullptr; } LoadScreen::~LoadScreen( void ) @@ -154,7 +154,7 @@ LoadScreen::~LoadScreen( void ) // delete (m_loadScreen); if(m_loadScreen) TheWindowManager->winDestroy( m_loadScreen ); - m_loadScreen = NULL; + m_loadScreen = nullptr; } void LoadScreen::update( Int percent ) @@ -178,37 +178,37 @@ SinglePlayerLoadScreen::SinglePlayerLoadScreen( void ) { m_currentObjectiveLine = 0; m_currentObjectiveLineCharacter = 0; - m_finishedObjectiveText = NULL; + m_finishedObjectiveText = FALSE; m_currentObjectiveWidthOffset = 0; - m_progressBar = NULL; - m_percent = NULL; - m_videoStream = NULL; - m_videoBuffer = NULL; - m_objectiveWin = NULL; + m_progressBar = nullptr; + m_percent = nullptr; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + m_objectiveWin = nullptr; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = NULL; + m_objectiveLines[i] = nullptr; } SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) { - m_progressBar = NULL; - m_percent = NULL; - m_objectiveWin = NULL; + m_progressBar = nullptr; + m_percent = nullptr; + m_objectiveWin = nullptr; for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = NULL; + m_objectiveLines[i] = nullptr; delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = NULL; + m_ambientLoopHandle = 0; } @@ -478,7 +478,7 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_ambientLoop.setEventName("LoadScreenAmbient"); // create the new stream m_videoStream = TheVideoPlayer->open( TheCampaignManager->getCurrentMission()->m_movieLabel ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { m_percent->winHide(TRUE); return; @@ -486,18 +486,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) // Create the new buffer m_videoBuffer = TheDisplay->createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } return; @@ -585,8 +585,8 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) // let the background image show through m_videoStream->close(); - m_videoStream = NULL; - m_loadScreen->winGetInstanceData()->setVideoBuffer( NULL ); + m_videoStream = nullptr; + m_loadScreen->winGetInstanceData()->setVideoBuffer( nullptr ); TheDisplay->draw(); } else @@ -621,8 +621,8 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) void SinglePlayerLoadScreen::reset( void ) { - setLoadScreen(NULL); - m_progressBar = NULL; + setLoadScreen(nullptr); + m_progressBar = nullptr; } void SinglePlayerLoadScreen::update( Int percent ) @@ -647,94 +647,94 @@ void SinglePlayerLoadScreen::setProgressRange( Int min, Int max ) //----------------------------------------------------------------------------- ChallengeLoadScreen::ChallengeLoadScreen( void ) { - m_progressBar = NULL; - m_videoStream = NULL; - m_videoBuffer = NULL; - - m_bioNameLeft = NULL; - m_bioAgeLeft = NULL; - m_bioBirthplaceLeft = NULL; - m_bioStrategyLeft = NULL; - m_bioBigNameEntryLeft = NULL; - m_bioNameEntryLeft = NULL; - m_bioAgeEntryLeft = NULL; - m_bioBirthplaceEntryLeft = NULL; - m_bioStrategyEntryLeft = NULL; - m_bioBigNameEntryRight = NULL; - m_bioNameRight = NULL; - m_bioAgeRight = NULL; - m_bioBirthplaceRight = NULL; - m_bioStrategyRight = NULL; - m_bioNameEntryRight = NULL; - m_bioAgeEntryRight = NULL; - m_bioBirthplaceEntryRight = NULL; - m_bioStrategyEntryRight = NULL; - - m_portraitLeft = NULL; - m_portraitRight = NULL; - m_portraitMovieLeft = NULL; - m_portraitMovieRight = NULL; - -// m_overlayReticleCrosshairs = NULL; -// m_overlayReticleCircleLineOuter = NULL; -// m_overlayReticleCircleLineInner = NULL; - m_overlayReticleCircleAlphaOuter = NULL; - m_overlayReticleCircleAlphaInner = NULL; - m_overlayVsBackdrop = NULL; - m_overlayVs = NULL; - m_wndVideoManager = NULL; + m_progressBar = nullptr; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + + m_bioNameLeft = nullptr; + m_bioAgeLeft = nullptr; + m_bioBirthplaceLeft = nullptr; + m_bioStrategyLeft = nullptr; + m_bioBigNameEntryLeft = nullptr; + m_bioNameEntryLeft = nullptr; + m_bioAgeEntryLeft = nullptr; + m_bioBirthplaceEntryLeft = nullptr; + m_bioStrategyEntryLeft = nullptr; + m_bioBigNameEntryRight = nullptr; + m_bioNameRight = nullptr; + m_bioAgeRight = nullptr; + m_bioBirthplaceRight = nullptr; + m_bioStrategyRight = nullptr; + m_bioNameEntryRight = nullptr; + m_bioAgeEntryRight = nullptr; + m_bioBirthplaceEntryRight = nullptr; + m_bioStrategyEntryRight = nullptr; + + m_portraitLeft = nullptr; + m_portraitRight = nullptr; + m_portraitMovieLeft = nullptr; + m_portraitMovieRight = nullptr; + +// m_overlayReticleCrosshairs = nullptr; +// m_overlayReticleCircleLineOuter = nullptr; +// m_overlayReticleCircleLineInner = nullptr; + m_overlayReticleCircleAlphaOuter = nullptr; + m_overlayReticleCircleAlphaInner = nullptr; + m_overlayVsBackdrop = nullptr; + m_overlayVs = nullptr; + m_wndVideoManager = nullptr; } ChallengeLoadScreen::~ChallengeLoadScreen( void ) { - m_progressBar = NULL; + m_progressBar = nullptr; delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; - } - - m_bioNameLeft = NULL; - m_bioAgeLeft = NULL; - m_bioBirthplaceLeft = NULL; - m_bioStrategyLeft = NULL; - m_bioBigNameEntryLeft = NULL; - m_bioNameEntryLeft = NULL; - m_bioAgeEntryLeft = NULL; - m_bioBirthplaceEntryLeft = NULL; - m_bioStrategyEntryLeft = NULL; - m_bioBigNameEntryRight = NULL; - m_bioNameRight = NULL; - m_bioAgeRight = NULL; - m_bioBirthplaceRight = NULL; - m_bioStrategyRight = NULL; - m_bioNameEntryRight = NULL; - m_bioAgeEntryRight = NULL; - m_bioBirthplaceEntryRight = NULL; - m_bioStrategyEntryRight = NULL; - - m_portraitLeft = NULL; - m_portraitRight = NULL; - m_portraitMovieLeft = NULL; - m_portraitMovieRight = NULL; - -// m_overlayReticleCrosshairs = NULL; -// m_overlayReticleCircleLineOuter = NULL; -// m_overlayReticleCircleLineInner = NULL; - m_overlayReticleCircleAlphaOuter = NULL; - m_overlayReticleCircleAlphaInner = NULL; - m_overlayVsBackdrop = NULL; - m_overlayVs = NULL; + m_videoStream = nullptr; + } + + m_bioNameLeft = nullptr; + m_bioAgeLeft = nullptr; + m_bioBirthplaceLeft = nullptr; + m_bioStrategyLeft = nullptr; + m_bioBigNameEntryLeft = nullptr; + m_bioNameEntryLeft = nullptr; + m_bioAgeEntryLeft = nullptr; + m_bioBirthplaceEntryLeft = nullptr; + m_bioStrategyEntryLeft = nullptr; + m_bioBigNameEntryRight = nullptr; + m_bioNameRight = nullptr; + m_bioAgeRight = nullptr; + m_bioBirthplaceRight = nullptr; + m_bioStrategyRight = nullptr; + m_bioNameEntryRight = nullptr; + m_bioAgeEntryRight = nullptr; + m_bioBirthplaceEntryRight = nullptr; + m_bioStrategyEntryRight = nullptr; + + m_portraitLeft = nullptr; + m_portraitRight = nullptr; + m_portraitMovieLeft = nullptr; + m_portraitMovieRight = nullptr; + +// m_overlayReticleCrosshairs = nullptr; +// m_overlayReticleCircleLineOuter = nullptr; +// m_overlayReticleCircleLineInner = nullptr; + m_overlayReticleCircleAlphaOuter = nullptr; + m_overlayReticleCircleAlphaInner = nullptr; + m_overlayVsBackdrop = nullptr; + m_overlayVs = nullptr; delete m_wndVideoManager; - m_wndVideoManager = NULL; + m_wndVideoManager = nullptr; TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = NULL; + m_ambientLoopHandle = 0; } // accepts the number of chars to advance, the window we're concerned with, the total text for final display, and the current position of the readout @@ -960,15 +960,15 @@ void ChallengeLoadScreen::init( GameInfo *game ) // Create the new buffer m_videoBuffer = TheDisplay->createVideoBuffer(); - if (m_videoBuffer == NULL || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height() )) + if (m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height() )) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } return; @@ -1154,8 +1154,8 @@ void ChallengeLoadScreen::init( GameInfo *game ) void ChallengeLoadScreen::reset( void ) { - setLoadScreen(NULL); - m_progressBar = NULL; + setLoadScreen(nullptr); + m_progressBar = nullptr; } void ChallengeLoadScreen::update( Int percent ) @@ -1179,13 +1179,13 @@ void ChallengeLoadScreen::setProgressRange( Int min, Int max ) //----------------------------------------------------------------------------- ShellGameLoadScreen::ShellGameLoadScreen( void ) { - m_progressBar = NULL; + m_progressBar = nullptr; } ShellGameLoadScreen::~ShellGameLoadScreen( void ) { - m_progressBar = NULL; + m_progressBar = nullptr; } void ShellGameLoadScreen::init( GameInfo *game ) @@ -1220,8 +1220,8 @@ void ShellGameLoadScreen::init( GameInfo *game ) void ShellGameLoadScreen::reset( void ) { - setLoadScreen(NULL); - m_progressBar = NULL; + setLoadScreen(nullptr); + m_progressBar = nullptr; } void ShellGameLoadScreen::update( Int percent ) @@ -1237,14 +1237,14 @@ void ShellGameLoadScreen::update( Int percent ) //----------------------------------------------------------------------------- MultiPlayerLoadScreen::MultiPlayerLoadScreen( void ) { - m_mapPreview = NULL; + m_mapPreview = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_buttonMapStartPosition[i] = NULL; - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_buttonMapStartPosition[i] = nullptr; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; } } @@ -1253,20 +1253,20 @@ MultiPlayerLoadScreen::~MultiPlayerLoadScreen( void ) { if(m_mapPreview) { - m_mapPreview->winSetUserData(NULL); + m_mapPreview->winSetUserData(nullptr); } for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; } - m_portraitLocalGeneral = NULL; - m_featuresLocalGeneral = NULL; - m_nameLocalGeneral = NULL; + m_portraitLocalGeneral = nullptr; + m_featuresLocalGeneral = nullptr; + m_nameLocalGeneral = nullptr; TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); // TheAudio->stopAudio( AudioAffect_Music ); @@ -1290,7 +1290,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) // add portrait, features, and name for the local player's general const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); - const Image *portrait = NULL; + const Image *portrait = nullptr; UnicodeString localName; if (localGeneral) { @@ -1308,7 +1308,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) else if (pt->getName() == "FactionChina") portrait = TheMappedImageCollection->findImageByName("SNFactionLogoLg_China"); else - DEBUG_ASSERTCRASH(NULL, ("Unexpected player template")); + DEBUG_ASSERTCRASH(nullptr, ("Unexpected player template")); localName = pt->getDisplayName(); } @@ -1342,7 +1342,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) Int i = 0; for (; i < MAX_SLOTS; ++i) { - teamWin[i] = NULL; + teamWin[i] = nullptr; } Int netSlot = 0; @@ -1448,12 +1448,12 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) void MultiPlayerLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; } } @@ -1497,23 +1497,23 @@ void MultiPlayerLoadScreen::processProgress(Int playerId, Int percentage) GameSpyLoadScreen::GameSpyLoadScreen( void ) { - m_mapPreview = NULL; + m_mapPreview = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_buttonMapStartPosition[i] = NULL; - m_playerRank[i] = NULL; + m_buttonMapStartPosition[i] = nullptr; + m_playerRank[i] = nullptr; - m_playerOfficerMedal[i] = NULL; - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_playerOfficerMedal[i] = nullptr; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= NULL; - m_playerTotalDisconnects[i]= NULL; - m_playerWin[i]= NULL; - m_playerWinLosses[i]= NULL; + m_playerFavoriteFactions[i]= nullptr; + m_playerTotalDisconnects[i]= nullptr; + m_playerWin[i]= nullptr; + m_playerWinLosses[i]= nullptr; } } @@ -1521,19 +1521,19 @@ GameSpyLoadScreen::~GameSpyLoadScreen( void ) { if(m_mapPreview) { - m_mapPreview->winSetUserData(NULL); + m_mapPreview->winSetUserData(nullptr); } for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= NULL; - m_playerTotalDisconnects[i]= NULL; - m_playerWin[i]= NULL; - m_playerWinLosses[i]= NULL; + m_playerFavoriteFactions[i]= nullptr; + m_playerTotalDisconnects[i]= nullptr; + m_playerWin[i]= nullptr; + m_playerWinLosses[i]= nullptr; } } @@ -1561,7 +1561,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); // add portrait, features, and name for the local player's general const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); - const Image *portrait = NULL; + const Image *portrait = nullptr; UnicodeString localName; if (localGeneral) { @@ -1579,7 +1579,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); else if (pt->getName() == "FactionChina") portrait = TheMappedImageCollection->findImageByName("SNFactionLogo144_China"); else - DEBUG_ASSERTCRASH(NULL, ("Unexpected player template")); + DEBUG_ASSERTCRASH(nullptr, ("Unexpected player template")); localName = pt->getDisplayName(); } @@ -1595,7 +1595,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); Int i = 0; for (; i < MAX_SLOTS; ++i) { - teamWin[i] = NULL; + teamWin[i] = nullptr; } Int netSlot = 0; @@ -1688,7 +1688,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); Int favSide = GetFavoriteSide(stats); const Image *preorderImg = TheMappedImageCollection->findImageByName("OfficersClubsmall"); if (!isPreorder) - preorderImg = NULL; + preorderImg = nullptr; const Image *rankImg = LookupSmallRankImage(favSide, rankPoints); m_playerOfficerMedal[i]->winSetEnabledImage(0, preorderImg); m_playerRank[i]->winSetEnabledImage(0, rankImg); @@ -1818,12 +1818,12 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); void GameSpyLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_playerSide[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_playerSide[i]= nullptr; } } @@ -1861,28 +1861,28 @@ MapTransferLoadScreen::MapTransferLoadScreen( void ) m_oldTimeout = 0; for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } MapTransferLoadScreen::~MapTransferLoadScreen( void ) { for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } void MapTransferLoadScreen::init( GameInfo *game ) @@ -1963,17 +1963,17 @@ void MapTransferLoadScreen::init( GameInfo *game ) void MapTransferLoadScreen::reset( void ) { - setLoadScreen(NULL); + setLoadScreen(nullptr); for(Int i = 0; i < MAX_SLOTS; ++i) { - m_progressBars[i] = NULL; - m_playerNames[i] = NULL; - m_progressText[i]= NULL; + m_progressBars[i] = nullptr; + m_playerNames[i] = nullptr; + m_progressText[i]= nullptr; m_playerLookup[i] = -1; m_oldProgress[i] = -1; } - m_fileNameText = NULL; - m_timeoutText = NULL; + m_fileNameText = nullptr; + m_timeoutText = nullptr; } void MapTransferLoadScreen::update( Int percent ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 7cc73e923f8..1fbecab0fd7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -92,7 +92,7 @@ void ProcessAnimateWindowSlideFromRight::initReverseAnimateWindow( wnd::AnimateW { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -116,7 +116,7 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } animWin->setFinished( FALSE ); @@ -126,7 +126,7 @@ void ProcessAnimateWindowSlideFromRight::initAnimateWindow( wnd::AnimateWindow * GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -156,7 +156,7 @@ Bool ProcessAnimateWindowSlideFromRight::updateAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -172,7 +172,7 @@ Bool ProcessAnimateWindowSlideFromRight::updateAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -204,7 +204,7 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -221,7 +221,7 @@ Bool ProcessAnimateWindowSlideFromRight::reverseAnimateWindow( wnd::AnimateWindo GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -276,7 +276,7 @@ void ProcessAnimateWindowSlideFromLeft::initReverseAnimateWindow( wnd::AnimateWi { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -298,7 +298,7 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -307,7 +307,7 @@ void ProcessAnimateWindowSlideFromLeft::initAnimateWindow( wnd::AnimateWindow *a GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -333,7 +333,7 @@ Bool ProcessAnimateWindowSlideFromLeft::updateAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -350,7 +350,7 @@ Bool ProcessAnimateWindowSlideFromLeft::updateAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -382,7 +382,7 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -399,7 +399,7 @@ Bool ProcessAnimateWindowSlideFromLeft::reverseAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -454,7 +454,7 @@ void ProcessAnimateWindowSlideFromTop::initReverseAnimateWindow( wnd::AnimateWin { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -476,7 +476,7 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -485,7 +485,7 @@ void ProcessAnimateWindowSlideFromTop::initAnimateWindow( wnd::AnimateWindow *an GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -511,7 +511,7 @@ Bool ProcessAnimateWindowSlideFromTop::updateAnimateWindow( wnd::AnimateWindow * if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -528,7 +528,7 @@ Bool ProcessAnimateWindowSlideFromTop::updateAnimateWindow( wnd::AnimateWindow * GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -561,7 +561,7 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -578,7 +578,7 @@ Bool ProcessAnimateWindowSlideFromTop::reverseAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -633,7 +633,7 @@ void ProcessAnimateWindowSlideFromBottom::initReverseAnimateWindow( wnd::Animate { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -656,7 +656,7 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -665,7 +665,7 @@ void ProcessAnimateWindowSlideFromBottom::initAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -691,7 +691,7 @@ Bool ProcessAnimateWindowSlideFromBottom::updateAnimateWindow( wnd::AnimateWindo if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -708,7 +708,7 @@ Bool ProcessAnimateWindowSlideFromBottom::updateAnimateWindow( wnd::AnimateWindo GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -741,7 +741,7 @@ Bool ProcessAnimateWindowSlideFromBottom::reverseAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -758,7 +758,7 @@ Bool ProcessAnimateWindowSlideFromBottom::reverseAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -814,7 +814,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initReverseAnimateWindow( wnd::An if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -823,7 +823,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initReverseAnimateWindow( wnd::An GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } restPos = animWin->getRestPos(); @@ -855,7 +855,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initAnimateWindow( wnd::AnimateWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -864,7 +864,7 @@ void ProcessAnimateWindowSlideFromBottomTimed::initAnimateWindow( wnd::AnimateWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -891,7 +891,7 @@ Bool ProcessAnimateWindowSlideFromBottomTimed::updateAnimateWindow( wnd::Animate if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -908,7 +908,7 @@ Bool ProcessAnimateWindowSlideFromBottomTimed::updateAnimateWindow( wnd::Animate GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -966,7 +966,7 @@ void ProcessAnimateWindowSpiral::initReverseAnimateWindow( wnd::AnimateWindow *a { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -990,7 +990,7 @@ void ProcessAnimateWindowSpiral::initAnimateWindow( wnd::AnimateWindow *animWin if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -999,7 +999,7 @@ void ProcessAnimateWindowSpiral::initAnimateWindow( wnd::AnimateWindow *animWin GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1025,7 +1025,7 @@ Bool ProcessAnimateWindowSpiral::updateAnimateWindow( wnd::AnimateWindow *animWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1042,7 +1042,7 @@ Bool ProcessAnimateWindowSpiral::updateAnimateWindow( wnd::AnimateWindow *animWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1079,7 +1079,7 @@ Bool ProcessAnimateWindowSpiral::reverseAnimateWindow( wnd::AnimateWindow *animW if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1094,7 +1094,7 @@ Bool ProcessAnimateWindowSpiral::reverseAnimateWindow( wnd::AnimateWindow *animW GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1147,7 +1147,7 @@ void ProcessAnimateWindowSlideFromTopFast::initReverseAnimateWindow( wnd::Animat { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -1170,7 +1170,7 @@ void ProcessAnimateWindowSlideFromTopFast::initAnimateWindow( wnd::AnimateWindow if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } @@ -1179,7 +1179,7 @@ void ProcessAnimateWindowSlideFromTopFast::initAnimateWindow( wnd::AnimateWindow GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1207,7 +1207,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::updateAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1224,7 +1224,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::updateAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1257,7 +1257,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::reverseAnimateWindow( wnd::AnimateWin if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1274,7 +1274,7 @@ Bool ProcessAnimateWindowSlideFromTopFast::reverseAnimateWindow( wnd::AnimateWin GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1332,7 +1332,7 @@ void ProcessAnimateWindowSlideFromRightFast::initReverseAnimateWindow( wnd::Anim { if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } if(animWin->getDelay() > 0) @@ -1374,7 +1374,7 @@ void ProcessAnimateWindowSlideFromRightFast::initAnimateWindow( wnd::AnimateWind if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into initAnimateWindow as a null... bad bad bad!")); return; } animWin->setFinished( FALSE ); @@ -1384,7 +1384,7 @@ void ProcessAnimateWindowSlideFromRightFast::initAnimateWindow( wnd::AnimateWind GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return; } win->winGetPosition(&restPos.x, &restPos.y); @@ -1415,7 +1415,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::updateAnimateWindow( wnd::AnimateWi if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1431,7 +1431,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::updateAnimateWindow( wnd::AnimateWi GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } @@ -1463,7 +1463,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::reverseAnimateWindow( wnd::AnimateW if(!animWin) { - DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a NULL Pointer... bad bad bad!")); + DEBUG_ASSERTCRASH( animWin, ("animWin was passed into updateAnimateWindow as a null... bad bad bad!")); return TRUE; } @@ -1480,7 +1480,7 @@ Bool ProcessAnimateWindowSlideFromRightFast::reverseAnimateWindow( wnd::AnimateW GameWindow *win = animWin->getGameWindow(); if(!win) { - DEBUG_ASSERTCRASH( win, ("animWin contains a NULL Pointer for it's GameWindow... Whatup wit dat?")); + DEBUG_ASSERTCRASH( win, ("animWin contains a null for it's GameWindow... Whatup wit dat?")); return TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 319c5cc475b..c5498126c4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -45,7 +45,7 @@ #include // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Shell *TheShell = NULL; ///< the shell singleton definition +Shell *TheShell = nullptr; ///< the shell singleton definition // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -72,20 +72,20 @@ void Shell::construct( void ) m_screenCount = 0; for( i = 0; i < MAX_SHELL_STACK; i++ ) - m_screenStack[ i ] = NULL; + m_screenStack[ i ] = nullptr; m_pendingPush = FALSE; m_pendingPop = FALSE; m_pendingPushName.set( "" ); m_isShellActive = TRUE; m_shellMapOn = FALSE; - m_background = NULL; + m_background = nullptr; m_clearBackground = FALSE; m_animateWindowManager = NEW AnimateWindowManager; m_schemeManager = NEW ShellMenuSchemeManager; - m_saveLoadMenuLayout = NULL; - m_popupReplayLayout = NULL; - m_optionsLayout = NULL; + m_saveLoadMenuLayout = nullptr; + m_popupReplayLayout = nullptr; + m_optionsLayout = nullptr; m_screenCount = 0; } @@ -103,14 +103,14 @@ void Shell::deconstruct( void ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } delete m_animateWindowManager; - m_animateWindowManager = NULL; + m_animateWindowManager = nullptr; delete m_schemeManager; - m_schemeManager = NULL; + m_schemeManager = nullptr; // delete the save/load menu if present if( m_saveLoadMenuLayout ) @@ -118,7 +118,7 @@ void Shell::deconstruct( void ) m_saveLoadMenuLayout->destroyWindows(); deleteInstance(m_saveLoadMenuLayout); - m_saveLoadMenuLayout = NULL; + m_saveLoadMenuLayout = nullptr; } @@ -128,15 +128,15 @@ void Shell::deconstruct( void ) m_popupReplayLayout->destroyWindows(); deleteInstance(m_popupReplayLayout); - m_popupReplayLayout = NULL; + m_popupReplayLayout = nullptr; } // delete the options menu if present. - if (m_optionsLayout != NULL) { + if (m_optionsLayout != nullptr) { m_optionsLayout->destroyWindows(); deleteInstance(m_optionsLayout); - m_optionsLayout = NULL; + m_optionsLayout = nullptr; } } @@ -147,8 +147,8 @@ void Shell::init( void ) { INI ini; // Read from INI all the ShellMenuScheme - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); if( m_schemeManager ) m_schemeManager->init(); @@ -194,8 +194,8 @@ void Shell::update( void ) for( Int i = m_screenCount - 1; i >= 0; i-- ) { - DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is NULL!") ); - m_screenStack[ i ]->runUpdate( NULL ); + DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is null!") ); + m_screenStack[ i ]->runUpdate( nullptr ); } if(TheGlobalData->m_shellMapOn && m_shellMapOn &&m_background) @@ -203,7 +203,7 @@ void Shell::update( void ) m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } @@ -273,7 +273,7 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) { if (filename.isEmpty()) - return NULL; + return nullptr; // search screen list WindowLayout *screen; @@ -287,7 +287,7 @@ WindowLayout *Shell::findScreenByFilename( AsciiString filename ) } - return NULL; + return nullptr; } @@ -297,7 +297,7 @@ WindowLayout *Shell::getScreenLayout( Int index ) const if (index >= 0 && index < m_screenCount) return m_screenStack[index]; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -371,7 +371,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) { // just call shutdownComplete() which will immediately cause the push to happen - shutdownComplete( NULL ); + shutdownComplete( nullptr ); } @@ -393,7 +393,7 @@ void Shell::pop( void ) // sanity - if( screen == NULL ) + if( screen == nullptr ) return; #ifdef DEBUG_LOGGING @@ -432,7 +432,7 @@ void Shell::popImmediate( void ) WindowLayout *screen = top(); // sanity - if( screen == NULL ) + if( screen == nullptr ) return; #ifdef DEBUG_LOGGING @@ -480,7 +480,7 @@ void Shell::showShell( Bool runInit ) if( layout ) { - layout->runInit( NULL ); + layout->runInit( nullptr ); // layout->bringForward(); } } @@ -608,7 +608,7 @@ WindowLayout *Shell::top( void ) // emtpy stack if( m_screenCount == 0 ) - return NULL; + return nullptr; // top layout is at count index return m_screenStack[ m_screenCount - 1 ]; @@ -623,7 +623,7 @@ void Shell::linkScreen( WindowLayout *screen ) { // sanity - if( screen == NULL ) + if( screen == nullptr ) return; // check to see if at top already @@ -647,7 +647,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) { // sanity - if( screen == NULL ) + if( screen == nullptr ) return; DEBUG_ASSERTCRASH( m_screenStack[ m_screenCount - 1 ] == screen, @@ -655,7 +655,7 @@ void Shell::unlinkScreen( WindowLayout *screen ) // remove reference to screen and decrease count if( m_screenStack[ m_screenCount - 1 ] == screen ) - m_screenStack[ --m_screenCount ] = NULL; + m_screenStack[ --m_screenCount ] = nullptr; } @@ -670,7 +670,7 @@ void Shell::doPush( AsciiString layoutFile ) // create new layout and load from window manager newScreen = TheWindowManager->winCreateLayout( layoutFile ); - DEBUG_ASSERTCRASH( newScreen != NULL, ("Shell unable to load pending push layout") ); + DEBUG_ASSERTCRASH( newScreen != nullptr, ("Shell unable to load pending push layout") ); // link screen to the top linkScreen( newScreen ); @@ -679,7 +679,7 @@ void Shell::doPush( AsciiString layoutFile ) TheIMEManager->detatch(); // run the init function automatically - newScreen->runInit( NULL ); + newScreen->runInit( nullptr ); newScreen->bringForward(); @@ -711,7 +711,7 @@ void Shell::doPop( Bool impendingPush ) WindowLayout *newTop = top(); if( newTop && !impendingPush ) { - newTop->runInit( NULL ); + newTop->runInit( nullptr ); //newTop->bringForward(); } @@ -726,7 +726,7 @@ void Shell::doPop( Bool impendingPush ) * popping the current screen off the top of the stack. It is here that we * can look for any pending push or pop operations and actually do them * - * NOTE: It is possible for the screen parameter to be NULL when we are + * NOTE: It is possible for the screen parameter to be nullptr when we are * short circuiting the shutdown logic because there is no layout * to actually shutdown (ie, the stack is empty and we push) */ //------------------------------------------------------------------------------------------------- @@ -769,7 +769,7 @@ void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; m_clearBackground = FALSE; } @@ -845,7 +845,7 @@ WindowLayout *Shell::getSaveLoadMenuLayout( void ) { // if layout has not been created, create it now - if( m_saveLoadMenuLayout == NULL ) + if( m_saveLoadMenuLayout == nullptr ) m_saveLoadMenuLayout = TheWindowManager->winCreateLayout( "Menus/PopupSaveLoad.wnd" ); // sanity @@ -862,7 +862,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) { // if layout has not been created, create it now - if( m_popupReplayLayout == NULL ) + if( m_popupReplayLayout == nullptr ) m_popupReplayLayout = TheWindowManager->winCreateLayout( "Menus/PopupReplay.wnd" ); // sanity @@ -878,7 +878,7 @@ WindowLayout *Shell::getPopupReplayLayout( void ) WindowLayout *Shell::getOptionsLayout( Bool create ) { // if layout has not been created, create it now - if ((m_optionsLayout == NULL) && (create == TRUE)) + if ((m_optionsLayout == nullptr) && (create == TRUE)) { m_optionsLayout = TheWindowManager->winCreateLayout( "Menus/OptionsMenu.wnd" ); @@ -893,9 +893,9 @@ WindowLayout *Shell::getOptionsLayout( Bool create ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void Shell::destroyOptionsLayout() { - if (m_optionsLayout != NULL) { + if (m_optionsLayout != nullptr) { m_optionsLayout->destroyWindows(); deleteInstance(m_optionsLayout); - m_optionsLayout = NULL; + m_optionsLayout = nullptr; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp index 276f0f5e0da..0f150795391 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp @@ -63,9 +63,9 @@ const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = { - { "ImagePart", ShellMenuSchemeManager::parseImagePart, NULL, NULL }, - { "LinePart", ShellMenuSchemeManager::parseLinePart, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "ImagePart", ShellMenuSchemeManager::parseImagePart, nullptr, 0 }, + { "LinePart", ShellMenuSchemeManager::parseLinePart, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; @@ -116,12 +116,12 @@ ShellMenuSchemeImage::ShellMenuSchemeImage( void ) m_name.clear(); m_position.x = m_position.y = 0; m_size.x = m_size.x = 0; - m_image = NULL; + m_image = nullptr; } ShellMenuSchemeImage::~ShellMenuSchemeImage( void ) { - m_image = NULL; + m_image = nullptr; } ShellMenuScheme::ShellMenuScheme( void ) @@ -200,12 +200,12 @@ void ShellMenuScheme::draw( void ) ShellMenuSchemeManager::ShellMenuSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; } ShellMenuSchemeManager::~ShellMenuSchemeManager( void ) { - m_currentScheme = NULL; + m_currentScheme = nullptr; ShellMenuSchemeListIt it = m_schemeList.begin(); @@ -222,10 +222,10 @@ void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*st { static const FieldParse myFieldParse[] = { - { "Position", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, NULL, offsetof( ShellMenuSchemeImage, m_image ) }, - { NULL, NULL, NULL, 0 } + { "Position", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_position ) }, + { "Size", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_size ) }, + { "ImageName", INI::parseMappedImage, nullptr, offsetof( ShellMenuSchemeImage, m_image ) }, + { nullptr, nullptr, nullptr, 0 } }; ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; @@ -238,12 +238,12 @@ void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*sto { static const FieldParse myFieldParse[] = { - { "StartPosition", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeLine, m_startPos ) }, - { "EndPosition", INI::parseICoord2D, NULL, offsetof( ShellMenuSchemeLine, m_endPos ) }, - { "Color", INI::parseColorInt, NULL, offsetof( ShellMenuSchemeLine, m_color ) }, - { "Width", INI::parseInt, NULL, offsetof( ShellMenuSchemeLine, m_width ) }, + { "StartPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_startPos ) }, + { "EndPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_endPos ) }, + { "Color", INI::parseColorInt, nullptr, offsetof( ShellMenuSchemeLine, m_color ) }, + { "Width", INI::parseInt, nullptr, offsetof( ShellMenuSchemeLine, m_width ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; @@ -279,8 +279,8 @@ void ShellMenuSchemeManager::init( void ) { INI ini; // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); } @@ -288,7 +288,7 @@ void ShellMenuSchemeManager::setShellMenuScheme( AsciiString name ) { if(name.isEmpty()) { - m_currentScheme = NULL; + m_currentScheme = nullptr; return; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp index 393296d7ba8..7e2473a8723 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp @@ -74,9 +74,9 @@ WinInstanceData::WinInstanceData( void ) { // we don't allocate strings unless we need them - m_text = NULL; - m_tooltip = NULL; - m_videoBuffer = NULL; + m_text = nullptr; + m_tooltip = nullptr; + m_videoBuffer = nullptr; init(); } @@ -92,7 +92,7 @@ WinInstanceData::~WinInstanceData( void ) if( m_tooltip ) TheDisplayStringManager->freeDisplayString( m_tooltip ); - m_videoBuffer = NULL; //Video Buffer needs to be clean up by the control that is in charge of the video. + m_videoBuffer = nullptr; //Video Buffer needs to be clean up by the control that is in charge of the video. } @@ -107,15 +107,15 @@ void WinInstanceData::init( void ) for( i = 0; i < MAX_DRAW_DATA; i++ ) { - m_enabledDrawData[ i ].image = NULL; + m_enabledDrawData[ i ].image = nullptr; m_enabledDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_enabledDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - m_disabledDrawData[ i ].image = NULL; + m_disabledDrawData[ i ].image = nullptr; m_disabledDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_disabledDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; - m_hiliteDrawData[ i ].image = NULL; + m_hiliteDrawData[ i ].image = nullptr; m_hiliteDrawData[ i ].color = WIN_COLOR_UNDEFINED; m_hiliteDrawData[ i ].borderColor = WIN_COLOR_UNDEFINED; @@ -133,7 +133,7 @@ void WinInstanceData::init( void ) m_state = 0; m_style = 0; m_status = WIN_STATUS_NONE; - m_owner = NULL; + m_owner = nullptr; m_textLabelString.clear(); m_tooltipString.clear(); m_tooltipDelay = -1; ///< default value @@ -143,23 +143,23 @@ void WinInstanceData::init( void ) m_imageOffset.y = 0; // reset all data for the text display strings and font for window - m_font = NULL; + m_font = nullptr; if( m_text ) { TheDisplayStringManager->freeDisplayString( m_text ); - m_text = NULL; + m_text = nullptr; } if( m_tooltip ) { TheDisplayStringManager->freeDisplayString( m_tooltip ); - m_tooltip = NULL; + m_tooltip = nullptr; } - m_videoBuffer = NULL; + m_videoBuffer = nullptr; } @@ -170,7 +170,7 @@ void WinInstanceData::setTooltipText( UnicodeString tip ) { // allocate a text tooltip string if needed - if( m_tooltip == NULL ) + if( m_tooltip == nullptr ) m_tooltip = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_tooltip, ("no tooltip") ); @@ -186,7 +186,7 @@ void WinInstanceData::setText( UnicodeString text ) { // allocate a text instance if needed - if( m_text == NULL ) + if( m_text == nullptr ) m_text = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_text, ("no text") ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp index e0b08d321f1..2fcdcfcb9c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp @@ -41,15 +41,15 @@ WindowLayout::WindowLayout( void ) { m_filenameString.set("EmptyLayout"); - m_windowList = NULL; - m_windowTail = NULL; + m_windowList = nullptr; + m_windowTail = nullptr; m_windowCount = 0; m_hidden = FALSE; - m_init = NULL; - m_update = NULL; - m_shutdown = NULL; + m_init = nullptr; + m_update = nullptr; + m_shutdown = nullptr; } @@ -63,8 +63,8 @@ WindowLayout::~WindowLayout( void ) // layout itself. This allows for maximum flexibility of the window layouts and you can // use them in any you see fit, as long as they are clean when they go away // - DEBUG_ASSERTCRASH( m_windowList == NULL, ("Window layout being destroyed still has window references") ); - DEBUG_ASSERTCRASH( m_windowTail == NULL, ("Window layout being destroyed still has window references") ); + DEBUG_ASSERTCRASH( m_windowList == nullptr, ("Window layout being destroyed still has window references") ); + DEBUG_ASSERTCRASH( m_windowTail == nullptr, ("Window layout being destroyed still has window references") ); } @@ -96,15 +96,15 @@ void WindowLayout::addWindow( GameWindow *window ) GameWindow *win = findWindow( window ); // only add window if window is not in this layout already - if( win == NULL ) + if( win == nullptr ) { - DEBUG_ASSERTCRASH( window->winGetNextInLayout() == NULL, - ("NextInLayout should be NULL before adding") ); - DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == NULL, - ("PrevInLayout should be NULL before adding") ); + DEBUG_ASSERTCRASH( window->winGetNextInLayout() == nullptr, + ("NextInLayout should be null before adding") ); + DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == nullptr, + ("PrevInLayout should be null before adding") ); - window->winSetPrevInLayout( NULL ); + window->winSetPrevInLayout( nullptr ); window->winSetNextInLayout( m_windowList ); if( m_windowList ) m_windowList->winSetPrevInLayout( window ); @@ -114,7 +114,7 @@ void WindowLayout::addWindow( GameWindow *window ) window->winSetLayout( this ); // if no tail pointer, this is it - if( m_windowTail == NULL ) + if( m_windowTail == nullptr ) m_windowTail = window; // we gots another window now @@ -147,9 +147,9 @@ void WindowLayout::removeWindow( GameWindow *window ) m_windowList = next; // set window as having no layout info - win->winSetLayout( NULL ); - win->winSetNextInLayout( NULL ); - win->winSetPrevInLayout( NULL ); + win->winSetLayout( nullptr ); + win->winSetNextInLayout( nullptr ); + win->winSetPrevInLayout( nullptr ); // if we removed the tail, set the new tail if( m_windowTail == win ) @@ -169,7 +169,7 @@ void WindowLayout::destroyWindows( void ) { GameWindow *window; - while( (window = getFirstWindow()) != 0 ) + while( (window = getFirstWindow()) != nullptr ) { // remove window from this layout @@ -204,7 +204,7 @@ Bool WindowLayout::load( AsciiString filename ) WindowLayoutInfo info; target = TheWindowManager->winCreateFromScript( filename, &info ); - if( target == NULL ) + if( target == nullptr ) { DEBUG_ASSERTCRASH( target, ("WindowLayout::load - Failed to load layout") ); @@ -293,6 +293,6 @@ GameWindow *WindowLayout::findWindow( GameWindow *window ) if( win == window ) return win; - return NULL; // window not found + return nullptr; // window not found } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 4b8c9f00e9b..e5bcfc4d3da 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -88,7 +88,7 @@ #define DRAWABLE_HASH_SIZE 8192 /// The GameClient singleton instance -GameClient *TheGameClient = NULL; +GameClient *TheGameClient = nullptr; //------------------------------------------------------------------------------------------------- GameClient::GameClient() @@ -98,14 +98,14 @@ GameClient::GameClient() for( Int i = 0; i < MAX_CLIENT_TRANSLATORS; i++ ) m_translators[ i ] = TRANSLATOR_ID_INVALID; m_numTranslators = 0; - m_commandTranslator = NULL; + m_commandTranslator = nullptr; m_drawableTOC.clear(); m_textBearingDrawableList.clear(); m_frame = 0; - m_drawableList = NULL; + m_drawableList = nullptr; m_nextDrawableID = (DrawableID)1; TheDrawGroupInfo = new DrawGroupInfo; @@ -119,11 +119,11 @@ GameClient::~GameClient() { #ifdef PERF_TIMERS delete TheGraphDraw; - TheGraphDraw = NULL; + TheGraphDraw = nullptr; #endif delete TheDrawGroupInfo; - TheDrawGroupInfo = NULL; + TheDrawGroupInfo = nullptr; // clear any drawable TOC we might have m_drawableTOC.clear(); @@ -141,7 +141,7 @@ GameClient::~GameClient() //DEBUG_LOG(("End Texture files ------------------------------------------------")); delete TheCampaignManager; - TheCampaignManager = NULL; + TheCampaignManager = nullptr; // destroy all Drawables Drawable *draw, *nextDraw; @@ -150,42 +150,42 @@ GameClient::~GameClient() nextDraw = draw->getNextDrawable(); destroyDrawable( draw ); } - m_drawableList = NULL; + m_drawableList = nullptr; // delete the ray effects delete TheRayEffects; - TheRayEffects = NULL; + TheRayEffects = nullptr; // delete the hot key manager delete TheHotKeyManager; - TheHotKeyManager = NULL; + TheHotKeyManager = nullptr; // destroy the in-game user interface delete TheInGameUI; - TheInGameUI = NULL; + TheInGameUI = nullptr; delete TheChallengeGenerals; - TheChallengeGenerals = NULL; + TheChallengeGenerals = nullptr; // delete the shell delete TheShell; - TheShell = NULL; + TheShell = nullptr; delete TheIMEManager; - TheIMEManager = NULL; + TheIMEManager = nullptr; // delete window manager delete TheWindowManager; - TheWindowManager = NULL; + TheWindowManager = nullptr; // delete the font library TheFontLibrary->reset(); delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; TheMouse->reset(); delete TheMouse; - TheMouse = NULL; + TheMouse = nullptr; ///@todo : TheTerrainVisual used to be the first thing destroyed. //I had to put in here so that drawables free their track marks before @@ -193,44 +193,44 @@ GameClient::~GameClient() // destroy the terrain visual representation delete TheTerrainVisual; - TheTerrainVisual = NULL; + TheTerrainVisual = nullptr; // destroy the display delete TheDisplay; - TheDisplay = NULL; + TheDisplay = nullptr; delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; + TheHeaderTemplateManager = nullptr; delete TheLanguageFilter; - TheLanguageFilter = NULL; + TheLanguageFilter = nullptr; delete TheVideoPlayer; - TheVideoPlayer = NULL; + TheVideoPlayer = nullptr; // destroy all translators for( UnsignedInt i = 0; i < m_numTranslators; i++ ) TheMessageStream->removeTranslator( m_translators[ i ] ); m_numTranslators = 0; - m_commandTranslator = NULL; + m_commandTranslator = nullptr; delete TheAnim2DCollection; - TheAnim2DCollection = NULL; + TheAnim2DCollection = nullptr; delete TheMappedImageCollection; - TheMappedImageCollection = NULL; + TheMappedImageCollection = nullptr; delete TheKeyboard; - TheKeyboard = NULL; + TheKeyboard = nullptr; delete TheDisplayStringManager; - TheDisplayStringManager = NULL; + TheDisplayStringManager = nullptr; delete TheEva; - TheEva = NULL; + TheEva = nullptr; delete TheSnowManager; - TheSnowManager = NULL; + TheSnowManager = nullptr; } @@ -244,7 +244,7 @@ void GameClient::init( void ) INI ini; // Load the DrawGroupInfo here, before the Display Manager is loaded. - ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, NULL); + ini.loadFileDirectory("Data\\INI\\DrawGroupInfo", INI_LOAD_OVERWRITE, nullptr); // Override the ini values with localized versions: if (TheGlobalLanguageData && TheGlobalLanguageData->m_drawGroupInfoFont.name.isNotEmpty()) @@ -448,7 +448,7 @@ void GameClient::reset( void ) // m_drawableHash.resize(DRAWABLE_HASH_SIZE); m_drawableVector.clear(); - m_drawableVector.resize(DRAWABLE_HASH_SIZE, NULL); + m_drawableVector.resize(DRAWABLE_HASH_SIZE, nullptr); // need to reset the in game UI to clear drawables before they are destroyed TheInGameUI->reset(); @@ -459,7 +459,7 @@ void GameClient::reset( void ) nextDraw = draw->getNextDrawable(); destroyDrawable( draw ); } - m_drawableList = NULL; + m_drawableList = nullptr; TheDisplay->reset(); TheTerrainVisual->reset(); @@ -657,7 +657,7 @@ void GameClient::update( void ) for (Int i=0; i < numPlayers; i++) { Player *player = ThePlayerList->getNthPlayer(i); - if (player->getPlayerTemplate() != NULL && player->getPlayerIndex() != localPlayerIndex) + if (player->getPlayerTemplate() != nullptr && player->getPlayerIndex() != localPlayerIndex) nonLocalPlayerIndices[numNonLocalPlayers++] = player->getPlayerIndex(); } //update ghost objects which don't have drawables or objects. @@ -665,7 +665,7 @@ void GameClient::update( void ) } else { - TheGhostObjectManager->updateOrphanedObjects(NULL, 0); + TheGhostObjectManager->updateOrphanedObjects(nullptr, 0); } } @@ -804,7 +804,7 @@ void GameClient::iterateDrawablesInRegion( Region3D *region, GameClientFuncPtr u nextDrawable = draw->getNextDrawable(); Coord3D pos = *draw->getPosition(); - if( region == NULL || + if( region == nullptr || (pos.x >= region->lo.x && pos.x <= region->hi.x && pos.y >= region->lo.y && pos.y <= region->hi.y && pos.z >= region->lo.z && pos.z <= region->hi.z) ) @@ -856,7 +856,7 @@ void GameClient::destroyDrawable( Drawable *draw ) { DEBUG_ASSERTCRASH( obj->getDrawable() == draw, ("Object/Drawable pointer mismatch!") ); - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -875,14 +875,14 @@ void GameClient::addDrawableToLookupTable(Drawable *draw ) { // sanity - if( draw == NULL ) + if( draw == nullptr ) return; // add to lookup // m_drawableHash[ draw->getID() ] = draw; DrawableID newID = draw->getID(); while( newID >= m_drawableVector.size() ) // Fail case is hella rare, so faster to double up on size() call - m_drawableVector.resize(m_drawableVector.size() * 2, NULL); + m_drawableVector.resize(m_drawableVector.size() * 2, nullptr); m_drawableVector[ newID ] = draw; @@ -896,12 +896,12 @@ void GameClient::removeDrawableFromLookupTable( Drawable *draw ) // sanity // TheSuperHackers @fix Mauller/Xezon 24/04/2025 Prevent out of range access to vector lookup table - if( draw == NULL || static_cast(draw->getID()) >= m_drawableVector.size() ) + if( draw == nullptr || static_cast(draw->getID()) >= m_drawableVector.size() ) return; // remove from table // m_drawableHash.erase( draw->getID() ); - m_drawableVector[ draw->getID() ] = NULL; + m_drawableVector[ draw->getID() ] = nullptr; } @@ -1006,7 +1006,7 @@ void GameClient::selectDrawablesInGroup( Int group ) // ------------------------------------------------------------------------------------------------ void GameClient::addTextBearingDrawable( Drawable *tbd ) { - if ( tbd != NULL ) + if ( tbd != nullptr ) m_textBearingDrawableList.push_back( tbd ); } // ------------------------------------------------------------------------------------------------ @@ -1235,7 +1235,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -1249,7 +1249,7 @@ GameClient::DrawableTOCEntry *GameClient::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -1271,7 +1271,7 @@ static Bool shouldSaveDrawable(const Drawable* draw) { if (draw->testDrawableStatus(DRAWABLE_STATUS_NO_SAVE)) { - if (draw->getObject() == NULL) + if (draw->getObject() == nullptr) { return false; } @@ -1313,7 +1313,7 @@ void GameClient::xferDrawableTOC( Xfer *xfer ) templateName = draw->getTemplate()->getName(); // if is this drawable name already in the TOC, skip it - if( findTOCEntryByName( templateName ) != NULL ) + if( findTOCEntryByName( templateName ) != nullptr ) continue; // add this entry to the TOC @@ -1427,7 +1427,7 @@ void GameClient::xfer( Xfer *xfer ) // get TOC entry for this drawable tocEntry = findTOCEntryByName( draw->getTemplate()->getName() ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Drawable TOC entry not found for '%s'", draw->getTemplate()->getName().str() )); @@ -1469,7 +1469,7 @@ void GameClient::xfer( Xfer *xfer ) // find TOC entry with this identifier tocEntry = findTOCEntryById( tocID ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - No TOC entry match for id '%d'", tocID )); @@ -1482,7 +1482,7 @@ void GameClient::xfer( Xfer *xfer ) // find matching thing template thingTemplate = TheThingFactory->findTemplate( tocEntry->name ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Unrecognized thing template '%s', skipping. ENGINEERS - Are you *sure* it's OK to be ignoring this object from the save file??? Think hard about it!", @@ -1504,7 +1504,7 @@ void GameClient::xfer( Xfer *xfer ) Object *object = TheGameLogic->findObjectByID( objectID ); // sanity - if( object == NULL ) + if( object == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Cannot find object '%d' that is supposed to be attached to this drawable '%s'", @@ -1515,7 +1515,7 @@ void GameClient::xfer( Xfer *xfer ) // get the drawable from the object draw = object->getDrawable(); - if( draw == NULL ) + if( draw == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - There is no drawable attached to the object '%s' (%d) and there should be", @@ -1550,7 +1550,7 @@ void GameClient::xfer( Xfer *xfer ) draw = TheThingFactory->newDrawable( thingTemplate ); // sanity - if( draw == NULL ) + if( draw == nullptr ) { DEBUG_CRASH(( "GameClient::xfer - Unable to create drawable for '%s'", diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp index 8f0a037f538..bc7bf2f8dc3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp @@ -145,8 +145,8 @@ class GameTextManager : public GameTextInterface virtual void update( void ) {}; ///< update text manager virtual void reset( void ); ///< Resets the text system - virtual UnicodeString fetch( const Char *label, Bool *exists = NULL ); ///< Returns the associated labeled unicode text - virtual UnicodeString fetch( AsciiString label, Bool *exists = NULL ); ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( const Char *label, Bool *exists = nullptr ); ///< Returns the associated labeled unicode text + virtual UnicodeString fetch( AsciiString label, Bool *exists = nullptr ); ///< Returns the associated labeled unicode text virtual UnicodeString fetchFormat( const Char *label, ... ); virtual UnicodeString fetchOrSubstitute( const Char *label, const WideChar *substituteText ); virtual UnicodeString fetchOrSubstituteFormat( const Char *label, const WideChar *substituteFormat, ... ); @@ -210,7 +210,7 @@ static int _cdecl compareLUT ( const void *, const void*); // Public Data //---------------------------------------------------------------------------- -GameTextInterface *TheGameText = NULL; +GameTextInterface *TheGameText = nullptr; //---------------------------------------------------------------------------- // Private Prototypes @@ -245,10 +245,10 @@ GameTextInterface* CreateGameTextInterface( void ) GameTextManager::GameTextManager() : m_textCount(0), m_maxLabelLen(0), - m_stringInfo(NULL), - m_stringLUT(NULL), + m_stringInfo(nullptr), + m_stringLUT(nullptr), m_initialized(FALSE), - m_noStringList(NULL), + m_noStringList(nullptr), #if defined(RTS_DEBUG) m_jabberWockie(FALSE), m_munkee(FALSE), @@ -256,8 +256,8 @@ GameTextManager::GameTextManager() #else m_useStringFile(TRUE), #endif - m_mapStringInfo(NULL), - m_mapStringLUT(NULL), + m_mapStringInfo(nullptr), + m_mapStringLUT(nullptr), m_failed(L"***FATAL*** String Manager failed to initialize properly") { for(Int i=0; i < MAX_UITEXT_LENGTH; i++) @@ -329,7 +329,7 @@ void GameTextManager::init( void ) m_stringInfo = NEW StringInfo[m_textCount]; - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { deinit(); return; @@ -377,10 +377,10 @@ void GameTextManager::deinit( void ) { delete [] m_stringInfo; - m_stringInfo = NULL; + m_stringInfo = nullptr; delete [] m_stringLUT; - m_stringLUT = NULL; + m_stringLUT = nullptr; m_textCount = 0; @@ -398,7 +398,7 @@ void GameTextManager::deinit( void ) DEBUG_LOG(("*** End missing strings ***")); DEBUG_LOG_RAW(("\n")); - m_noStringList = NULL; + m_noStringList = nullptr; m_initialized = FALSE; } @@ -410,10 +410,10 @@ void GameTextManager::deinit( void ) void GameTextManager::reset( void ) { delete [] m_mapStringInfo; - m_mapStringInfo = NULL; + m_mapStringInfo = nullptr; delete [] m_mapStringLUT; - m_mapStringLUT = NULL; + m_mapStringLUT = nullptr; } @@ -515,7 +515,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -572,7 +572,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w { if ( (ch = *in++) == 0 ) { - in = NULL; // have exhausted the input m_buffer + in = nullptr; // have exhausted the input m_buffer ch = readChar ( file ); } } @@ -678,7 +678,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) if ( m_jabberWockie ) { static Char buffer[MAX_UITEXT_LENGTH*2]; - Char *firstLetter = NULL, *lastLetter; + Char *firstLetter = nullptr, *lastLetter; Char *b = buffer; Int formatWord = FALSE; Char ch; @@ -694,7 +694,7 @@ void GameTextManager::translateCopy( WideChar *outbuf, Char *inbuf ) lastLetter = b-1; reverseWord ( firstLetter, lastLetter ); } - firstLetter = NULL; + firstLetter = nullptr; formatWord = FALSE; } *b++ = ch; @@ -807,7 +807,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) file = TheFileSystem->openFile(filename, File::READ | File::TEXT); DEBUG_LOG(("Looking in %s for string file", filename)); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -833,7 +833,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) textCount += 500; file->close(); - file = NULL; + file = nullptr; return TRUE; } @@ -848,7 +848,7 @@ Bool GameTextManager::getCSFInfo ( const Char *filename ) File *file = TheFileSystem->openFile(filename, File::READ | File::BINARY); DEBUG_LOG(("Looking in %s for compiled string file", filename)); - if ( file != NULL ) + if ( file != nullptr ) { if ( file->read( &header, sizeof ( header )) == sizeof ( header ) ) { @@ -870,7 +870,7 @@ Bool GameTextManager::getCSFInfo ( const Char *filename ) } file->close(); - file = NULL; + file = nullptr; } return ok; @@ -891,7 +891,7 @@ Bool GameTextManager::parseCSF( const Char *filename ) file = TheFileSystem->openFile(filename, File::READ | File::BINARY); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -997,7 +997,7 @@ Bool GameTextManager::parseCSF( const Char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1014,7 +1014,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) File *file = TheFileSystem->openFile(filename, File::READ | File::TEXT); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -1099,7 +1099,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1145,7 +1145,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) File *file; file = TheFileSystem->openFile(filename, File::READ | File::TEXT); - if ( file == NULL ) + if ( file == nullptr ) { return FALSE; } @@ -1234,7 +1234,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) quit: file->close(); - file = NULL; + file = nullptr; return ok; } @@ -1247,7 +1247,7 @@ UnicodeString GameTextManager::fetch( const Char *label, Bool *exists ) { DEBUG_ASSERTCRASH ( m_initialized, ("String Manager has not been m_initialized") ); - if( m_stringInfo == NULL ) + if( m_stringInfo == nullptr ) { if( exists ) *exists = FALSE; @@ -1258,17 +1258,17 @@ UnicodeString GameTextManager::fetch( const Char *label, Bool *exists ) StringLookUp key; AsciiString lb; lb = label; - key.info = NULL; + key.info = nullptr; key.label = &lb; lookUp = (StringLookUp *) bsearch( &key, (void*) m_stringLUT, m_textCount, sizeof(StringLookUp), compareLUT ); - if ( lookUp == NULL && m_mapStringLUT && m_mapTextCount ) + if ( lookUp == nullptr && m_mapStringLUT && m_mapTextCount ) { lookUp = (StringLookUp *) bsearch( &key, (void*) m_mapStringLUT, m_mapTextCount, sizeof(StringLookUp), compareLUT ); } - if( lookUp == NULL ) + if( lookUp == nullptr ) { // string not found diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 17c88e9480c..2683c02d7ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -64,7 +64,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -GlobalLanguage *TheGlobalLanguageData = NULL; ///< The global language singleton +GlobalLanguage *TheGlobalLanguageData = nullptr; ///< The global language singleton static const LookupListRec ResolutionFontSizeMethodNames[] = { @@ -72,38 +72,38 @@ static const LookupListRec ResolutionFontSizeMethodNames[] = { "CLASSIC_NO_CEILING", GlobalLanguage::ResolutionFontSizeMethod_ClassicNoCeiling }, { "STRICT", GlobalLanguage::ResolutionFontSizeMethod_Strict }, { "BALANCED", GlobalLanguage::ResolutionFontSizeMethod_Balanced }, - { NULL, 0 } + { nullptr, 0 } }; static const FieldParse TheGlobalLanguageDataFieldParseTable[] = { - { "UnicodeFontName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontName ) }, - //{ "UnicodeFontFileName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontFileName ) }, - { "LocalFontFile", GlobalLanguage::parseFontFileName, NULL, 0}, - { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) }, - { "UseHardWordWrap", INI::parseBool, NULL, offsetof( GlobalLanguage, m_useHardWrap) }, - { "ResolutionFontAdjustment", INI::parseReal, NULL, offsetof( GlobalLanguage, m_resolutionFontSizeAdjustment) }, + { "UnicodeFontName", INI::parseAsciiString,nullptr, offsetof( GlobalLanguage, m_unicodeFontName ) }, + //{ "UnicodeFontFileName", INI::parseAsciiString,nullptr, offsetof( GlobalLanguage, m_unicodeFontFileName ) }, + { "LocalFontFile", GlobalLanguage::parseFontFileName, nullptr, 0}, + { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) }, + { "UseHardWordWrap", INI::parseBool, nullptr, offsetof( GlobalLanguage, m_useHardWrap) }, + { "ResolutionFontAdjustment", INI::parseReal, nullptr, offsetof( GlobalLanguage, m_resolutionFontSizeAdjustment) }, { "ResolutionFontSizeMethod", INI::parseLookupList, ResolutionFontSizeMethodNames, offsetof( GlobalLanguage, m_resolutionFontSizeMethod) }, - { "CopyrightFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_copyrightFont ) }, - { "MessageFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_messageFont) }, - { "MilitaryCaptionTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_militaryCaptionTitleFont) }, - { "MilitaryCaptionDelayMS", INI::parseInt, NULL, offsetof( GlobalLanguage, m_militaryCaptionDelayMS ) }, - { "MilitaryCaptionFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_militaryCaptionFont) }, - { "SuperweaponCountdownNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_superweaponCountdownNormalFont) }, - { "SuperweaponCountdownReadyFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_superweaponCountdownReadyFont) }, - { "NamedTimerCountdownNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_namedTimerCountdownNormalFont) }, - { "NamedTimerCountdownReadyFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_namedTimerCountdownReadyFont) }, - { "DrawableCaptionFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_drawableCaptionFont) }, - { "DefaultWindowFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_defaultWindowFont) }, - { "DefaultDisplayStringFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_defaultDisplayStringFont) }, - { "TooltipFontName", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_tooltipFontName) }, - { "NativeDebugDisplay", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_nativeDebugDisplay) }, - { "DrawGroupInfoFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_drawGroupInfoFont) }, - { "CreditsTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsTitleFont) }, - { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsPositionFont) }, - { "CreditsNormalFont", GlobalLanguage::parseFontDesc, NULL, offsetof( GlobalLanguage, m_creditsNormalFont) }, + { "CopyrightFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_copyrightFont ) }, + { "MessageFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_messageFont) }, + { "MilitaryCaptionTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_militaryCaptionTitleFont) }, + { "MilitaryCaptionDelayMS", INI::parseInt, nullptr, offsetof( GlobalLanguage, m_militaryCaptionDelayMS ) }, + { "MilitaryCaptionFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_militaryCaptionFont) }, + { "SuperweaponCountdownNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_superweaponCountdownNormalFont) }, + { "SuperweaponCountdownReadyFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_superweaponCountdownReadyFont) }, + { "NamedTimerCountdownNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_namedTimerCountdownNormalFont) }, + { "NamedTimerCountdownReadyFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_namedTimerCountdownReadyFont) }, + { "DrawableCaptionFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_drawableCaptionFont) }, + { "DefaultWindowFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_defaultWindowFont) }, + { "DefaultDisplayStringFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_defaultDisplayStringFont) }, + { "TooltipFontName", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_tooltipFontName) }, + { "NativeDebugDisplay", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_nativeDebugDisplay) }, + { "DrawGroupInfoFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_drawGroupInfoFont) }, + { "CreditsTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsTitleFont) }, + { "CreditsMinorTitleFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsPositionFont) }, + { "CreditsNormalFont", GlobalLanguage::parseFontDesc, nullptr, offsetof( GlobalLanguage, m_creditsNormalFont) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; //----------------------------------------------------------------------------- @@ -153,7 +153,7 @@ void GlobalLanguage::init( void ) fname.format("Data\\%s\\Language", GetRegistryLanguage().str()); INI ini; - ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( fname, INI_LOAD_OVERWRITE, nullptr ); } StringListIt it = m_localFonts.begin(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GraphDraw.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GraphDraw.cpp index 76aff3d7c53..15e98545710 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GraphDraw.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GraphDraw.cpp @@ -119,6 +119,6 @@ void GraphDraw::clear() m_graphEntries.clear(); } -GraphDraw *TheGraphDraw = NULL; +GraphDraw *TheGraphDraw = nullptr; #endif /* PERF_TIMERS */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 6d41373cb14..778ff8f7a6d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -131,9 +131,9 @@ static UnicodeString formatIncomeValue(UnsignedInt cashPerMin) //------------------------------------------------------------------------------------------------- /// The InGameUI singleton instance. -InGameUI *TheInGameUI = NULL; +InGameUI *TheInGameUI = nullptr; -GameWindow *m_replayWindow = NULL; +GameWindow *m_replayWindow = nullptr; // ------------------------------------------------------------------------------------------------ struct KindOfSelectionData @@ -304,8 +304,8 @@ SuperweaponInfo::SuperweaponInfo( m_ready(ready), m_evaReadyPlayed( evaReadyPlayed ), m_forceUpdateText(false), - m_nameDisplayString(NULL), - m_timeDisplayString(NULL), + m_nameDisplayString(nullptr), + m_timeDisplayString(nullptr), m_color(c), m_powerTemplate(spt) { @@ -326,11 +326,11 @@ SuperweaponInfo::~SuperweaponInfo() { if (m_nameDisplayString) TheDisplayStringManager->freeDisplayString( m_nameDisplayString ); - m_nameDisplayString = NULL; + m_nameDisplayString = nullptr; if (m_timeDisplayString) TheDisplayStringManager->freeDisplayString( m_timeDisplayString ); - m_timeDisplayString = NULL; + m_timeDisplayString = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -493,7 +493,7 @@ void InGameUI::xfer( Xfer *xfer ) AsciiString templateName; xfer->xferAsciiString(&templateName); const SpecialPowerTemplate* powerTemplate = TheSpecialPowerStore->findSpecialPowerTemplate(templateName); - if (powerTemplate == NULL) + if (powerTemplate == nullptr) { DEBUG_CRASH(("power %s not found",templateName.str())); throw INI_INVALID_DATA; @@ -522,7 +522,7 @@ void InGameUI::xfer( Xfer *xfer ) // srj sez: due to order-of-operation stuff, sometimes these will already exist, // sometimes not. not sure why. so handle both cases. SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo == NULL) + if (swInfo == nullptr) { const Player* player = ThePlayerList->getNthPlayer(playerIndex); swInfo = newInstance(SuperweaponInfo)( @@ -592,19 +592,19 @@ SuperweaponInfo* InGameUI::findSWInfo(Int playerIndex, const AsciiString& powerN } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate) { - if (powerTemplate == NULL) + if (powerTemplate == nullptr) return; // srj sez: don't allow adding the same superweapon more than once. it can happen. not sure how. (srj) SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo != NULL) + if (swInfo != nullptr) return; const Player* player = ThePlayerList->getNthPlayer(playerIndex); @@ -803,135 +803,135 @@ void InGameUI::showNamedTimerDisplay( Bool show ) //------------------------------------------------------------------------------------------------- const FieldParse InGameUI::s_fieldParseTable[] = { - { "MaxSelectionSize", INI::parseInt, NULL, offsetof( InGameUI, m_maxSelectCount ) }, - - { "MessageColor1", INI::parseColorInt, NULL, offsetof( InGameUI, m_messageColor1 ) }, - { "MessageColor2", INI::parseColorInt, NULL, offsetof( InGameUI, m_messageColor2 ) }, - { "MessagePosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_messagePosition ) }, - { "MessageFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_messageFont ) }, - { "MessagePointSize", INI::parseInt, NULL, offsetof( InGameUI, m_messagePointSize ) }, - { "MessageBold", INI::parseBool, NULL, offsetof( InGameUI, m_messageBold ) }, - { "MessageDelayMS", INI::parseInt, NULL, offsetof( InGameUI, m_messageDelayMS ) }, - - { "MilitaryCaptionColor", INI::parseRGBAColorInt, NULL, offsetof( InGameUI, m_militaryCaptionColor ) }, - { "MilitaryCaptionPosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "MilitaryCaptionTitleFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, - { "MilitaryCaptionTitlePointSize", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, - { "MilitaryCaptionTitleBold", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, - - { "MilitaryCaptionFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_militaryCaptionFont ) }, - { "MilitaryCaptionPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionPointSize ) }, - { "MilitaryCaptionBold", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionBold ) }, - - { "MilitaryCaptionRandomizeTyping", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, - { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionSpeed ) }, - - { "MilitaryCaptionPosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "SuperweaponCountdownPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_superweaponPosition ) }, - { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, NULL, offsetof( InGameUI, m_superweaponFlashDuration ) }, - { "SuperweaponCountdownFlashColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_superweaponFlashColor ) }, - - { "SuperweaponCountdownNormalFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_superweaponNormalFont ) }, - { "SuperweaponCountdownNormalPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_superweaponNormalPointSize ) }, - { "SuperweaponCountdownNormalBold", INI::parseBool, NULL, offsetof( InGameUI, m_superweaponNormalBold ) }, - - { "SuperweaponCountdownReadyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_superweaponReadyFont ) }, - { "SuperweaponCountdownReadyPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_superweaponReadyPointSize ) }, - { "SuperweaponCountdownReadyBold", INI::parseBool, NULL, offsetof( InGameUI, m_superweaponReadyBold ) }, - - { "NamedTimerCountdownPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_namedTimerPosition ) }, - { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, NULL, offsetof( InGameUI, m_namedTimerFlashDuration ) }, - { "NamedTimerCountdownFlashColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerFlashColor ) }, - - { "NamedTimerCountdownNormalFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_namedTimerNormalFont ) }, - { "NamedTimerCountdownNormalPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, - { "NamedTimerCountdownNormalBold", INI::parseBool, NULL, offsetof( InGameUI, m_namedTimerNormalBold ) }, - { "NamedTimerCountdownNormalColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerNormalColor ) }, - - { "NamedTimerCountdownReadyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_namedTimerReadyFont ) }, - { "NamedTimerCountdownReadyPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, - { "NamedTimerCountdownReadyBold", INI::parseBool, NULL, offsetof( InGameUI, m_namedTimerReadyBold ) }, - { "NamedTimerCountdownReadyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_namedTimerReadyColor ) }, - - { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, NULL, offsetof( InGameUI, m_floatingTextTimeOut ) }, - { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, NULL, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, - { "FloatingTextVanishRate", INI::parseVelocityReal, NULL, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, - - { "PopupMessageColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_popupMessageColor ) }, - - { "DrawableCaptionFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_drawableCaptionFont ) }, - { "DrawableCaptionPointSize", INI::parseInt, NULL, offsetof( InGameUI, m_drawableCaptionPointSize ) }, - { "DrawableCaptionBold", INI::parseBool, NULL, offsetof( InGameUI, m_drawableCaptionBold ) }, - { "DrawableCaptionColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_drawableCaptionColor ) }, - - { "DrawRMBScrollAnchor", INI::parseBool, NULL, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, - { "MoveRMBScrollAnchor", INI::parseBool, NULL, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, - - { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, - { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, - { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, - { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, - { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, - { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, - - { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, - { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, - - { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, - { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, - { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, - { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, - { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, - { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, - { "SpectreGunshipRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPECTREGUNSHIP] ) }, - { "HelixNapalmBombRadiusCursor",RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_HELIX_NAPALM_BOMB] ) }, - - { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, - { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, - { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, - { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, - { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, - { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, - - { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, - { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, - { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, - { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, - { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, - - { "ClearMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) }, - { "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, + { "MaxSelectionSize", INI::parseInt, nullptr, offsetof( InGameUI, m_maxSelectCount ) }, + + { "MessageColor1", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor1 ) }, + { "MessageColor2", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor2 ) }, + { "MessagePosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_messagePosition ) }, + { "MessageFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_messageFont ) }, + { "MessagePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_messagePointSize ) }, + { "MessageBold", INI::parseBool, nullptr, offsetof( InGameUI, m_messageBold ) }, + { "MessageDelayMS", INI::parseInt, nullptr, offsetof( InGameUI, m_messageDelayMS ) }, + + { "MilitaryCaptionColor", INI::parseRGBAColorInt, nullptr, offsetof( InGameUI, m_militaryCaptionColor ) }, + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "MilitaryCaptionTitleFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, + { "MilitaryCaptionTitlePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, + { "MilitaryCaptionTitleBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, + + { "MilitaryCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionFont ) }, + { "MilitaryCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionPointSize ) }, + { "MilitaryCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionBold ) }, + + { "MilitaryCaptionRandomizeTyping", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, + { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionSpeed ) }, + + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "SuperweaponCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_superweaponPosition ) }, + { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_superweaponFlashDuration ) }, + { "SuperweaponCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_superweaponFlashColor ) }, + + { "SuperweaponCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponNormalFont ) }, + { "SuperweaponCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponNormalPointSize ) }, + { "SuperweaponCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponNormalBold ) }, + + { "SuperweaponCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponReadyFont ) }, + { "SuperweaponCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponReadyPointSize ) }, + { "SuperweaponCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponReadyBold ) }, + + { "NamedTimerCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_namedTimerPosition ) }, + { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_namedTimerFlashDuration ) }, + { "NamedTimerCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerFlashColor ) }, + + { "NamedTimerCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerNormalFont ) }, + { "NamedTimerCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, + { "NamedTimerCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerNormalBold ) }, + { "NamedTimerCountdownNormalColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerNormalColor ) }, + + { "NamedTimerCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerReadyFont ) }, + { "NamedTimerCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, + { "NamedTimerCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerReadyBold ) }, + { "NamedTimerCountdownReadyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerReadyColor ) }, + + { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, nullptr, offsetof( InGameUI, m_floatingTextTimeOut ) }, + { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, + { "FloatingTextVanishRate", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, + + { "PopupMessageColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_popupMessageColor ) }, + + { "DrawableCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_drawableCaptionFont ) }, + { "DrawableCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_drawableCaptionPointSize ) }, + { "DrawableCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_drawableCaptionBold ) }, + { "DrawableCaptionColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_drawableCaptionColor ) }, + + { "DrawRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, + { "MoveRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, + + { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, + { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, + { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, + { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, + { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, + { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, + + { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, + { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, + + { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, + { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, + { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, + { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, + { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, + { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, + { "SpectreGunshipRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPECTREGUNSHIP] ) }, + { "HelixNapalmBombRadiusCursor",RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_HELIX_NAPALM_BOMB] ) }, + + { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, + { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, + { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, + { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, + { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, + { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, + + { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, + { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, + { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, + { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, + { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, + + { "ClearMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) }, + { "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, // TheSuperHackers @info ui enhancement configuration - { "NetworkLatencyFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_networkLatencyFont ) }, - { "NetworkLatencyBold", INI::parseBool, NULL, offsetof( InGameUI, m_networkLatencyBold ) }, - { "NetworkLatencyPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_networkLatencyPosition ) }, - { "NetworkLatencyColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyColor ) }, - { "NetworkLatencyDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_networkLatencyDropColor ) }, - - { "RenderFpsFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_renderFpsFont ) }, - { "RenderFpsBold", INI::parseBool, NULL, offsetof( InGameUI, m_renderFpsBold ) }, - { "RenderFpsPosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_renderFpsPosition ) }, - { "RenderFpsColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsColor ) }, - { "RenderFpsLimitColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsLimitColor ) }, - { "RenderFpsDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_renderFpsDropColor ) }, - { "RenderFpsRefreshMs", INI::parseUnsignedInt, NULL, offsetof( InGameUI, m_renderFpsRefreshMs ) }, - - { "SystemTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_systemTimeFont ) }, - { "SystemTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_systemTimeBold ) }, - { "SystemTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_systemTimePosition ) }, - { "SystemTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_systemTimeColor ) }, - { "SystemTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_systemTimeDropColor ) }, - - { "GameTimeFont", INI::parseAsciiString, NULL, offsetof( InGameUI, m_gameTimeFont ) }, - { "GameTimeBold", INI::parseBool, NULL, offsetof( InGameUI, m_gameTimeBold ) }, - { "GameTimePosition", INI::parseCoord2D, NULL, offsetof( InGameUI, m_gameTimePosition ) }, - { "GameTimeColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeColor ) }, - { "GameTimeDropColor", INI::parseColorInt, NULL, offsetof( InGameUI, m_gameTimeDropColor ) }, - - { NULL, NULL, NULL, 0 } + { "NetworkLatencyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_networkLatencyFont ) }, + { "NetworkLatencyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_networkLatencyBold ) }, + { "NetworkLatencyPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_networkLatencyPosition ) }, + { "NetworkLatencyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyColor ) }, + { "NetworkLatencyDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyDropColor ) }, + + { "RenderFpsFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_renderFpsFont ) }, + { "RenderFpsBold", INI::parseBool, nullptr, offsetof( InGameUI, m_renderFpsBold ) }, + { "RenderFpsPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_renderFpsPosition ) }, + { "RenderFpsColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsColor ) }, + { "RenderFpsLimitColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsLimitColor ) }, + { "RenderFpsDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsDropColor ) }, + { "RenderFpsRefreshMs", INI::parseUnsignedInt, nullptr, offsetof( InGameUI, m_renderFpsRefreshMs ) }, + + { "SystemTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_systemTimeFont ) }, + { "SystemTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_systemTimeBold ) }, + { "SystemTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_systemTimePosition ) }, + { "SystemTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeColor ) }, + { "SystemTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeDropColor ) }, + + { "GameTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_gameTimeFont ) }, + { "GameTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_gameTimeBold ) }, + { "GameTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_gameTimePosition ) }, + { "GameTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeColor ) }, + { "GameTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeDropColor ) }, + + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -978,8 +978,8 @@ InGameUI::InGameUI() m_mousedOverDrawableID = INVALID_DRAWABLE_ID; m_currentlyPlayingMovie.clear(); - m_militarySubtitle = NULL; - m_popupMessageData = NULL; + m_militarySubtitle = nullptr; + m_popupMessageData = nullptr; m_waypointMode = FALSE; m_clientQuiet = FALSE; @@ -1026,46 +1026,46 @@ InGameUI::InGameUI() for( i = 0; i < MAX_BUILD_PROGRESS; i++ ) { - m_buildProgress[ i ].m_thingTemplate = NULL; + m_buildProgress[ i ].m_thingTemplate = nullptr; m_buildProgress[ i ].m_percentComplete = 0.0f; - m_buildProgress[ i ].m_control = NULL; + m_buildProgress[ i ].m_control = nullptr; } - m_pendingGUICommand = NULL; + m_pendingGUICommand = nullptr; // allocate an array for the placement icons m_placeIcon = NEW Drawable* [ TheGlobalData->m_maxLineBuildObjects ]; for( i = 0; i < TheGlobalData->m_maxLineBuildObjects; i++ ) - m_placeIcon[ i ] = NULL; - m_pendingPlaceType = NULL; + m_placeIcon[ i ] = nullptr; + m_pendingPlaceType = nullptr; m_pendingPlaceSourceObjectID = INVALID_ID; m_preventLeftClickDeselectionInAlternateMouseModeForOneClick = FALSE; m_placeAnchorStart.x = m_placeAnchorStart.y = 0; m_placeAnchorEnd.x = m_placeAnchorEnd.y = 0; m_placeAnchorInProgress = FALSE; - m_videoStream = NULL; - m_videoBuffer = NULL; - m_cameoVideoStream = NULL; - m_cameoVideoBuffer = NULL; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + m_cameoVideoStream = nullptr; + m_cameoVideoBuffer = nullptr; // message info for( i = 0; i < MAX_UI_MESSAGES; i++ ) { m_uiMessages[ i ].fullText.clear(); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; m_uiMessages[ i ].color = 0; } - m_replayWindow = NULL; + m_replayWindow = nullptr; m_messagesOn = TRUE; // TheSuperHackers @info the default font, size and positions of the various counters were chosen based on GenTools implementation - m_networkLatencyString = NULL; + m_networkLatencyString = nullptr; m_networkLatencyFont = "Tahoma"; m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; m_networkLatencyBold = TRUE; @@ -1075,8 +1075,8 @@ InGameUI::InGameUI() m_networkLatencyDropColor = GameMakeColor( 0, 0, 0, 255 ); m_lastNetworkLatencyFrames = ~0u; - m_renderFpsString = NULL; - m_renderFpsLimitString = NULL; + m_renderFpsString = nullptr; + m_renderFpsLimitString = nullptr; m_renderFpsFont = "Tahoma"; m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; m_renderFpsBold = TRUE; @@ -1090,7 +1090,7 @@ InGameUI::InGameUI() m_lastRenderFpsLimit = ~0u; m_lastRenderFpsUpdateMs = 0u; - m_systemTimeString = NULL; + m_systemTimeString = nullptr; m_systemTimeFont = "Tahoma"; m_systemTimePointSize = TheGlobalData->m_systemTimeFontSize; m_systemTimeBold = TRUE; @@ -1099,8 +1099,8 @@ InGameUI::InGameUI() m_systemTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_systemTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); - m_gameTimeString = NULL; - m_gameTimeFrameString = NULL; + m_gameTimeString = nullptr; + m_gameTimeFrameString = nullptr; m_gameTimeFont = "Tahoma"; m_gameTimePointSize = TheGlobalData->m_gameTimeFontSize; m_gameTimeBold = TRUE; @@ -1155,7 +1155,7 @@ InGameUI::InGameUI() m_moveRMBScrollAnchor = FALSE; m_displayedMaxWarning = FALSE; - m_idleWorkerWin = NULL; + m_idleWorkerWin = nullptr; m_currentIdleWorkerDisplay = -1; m_waypointMode = false; @@ -1175,7 +1175,7 @@ InGameUI::InGameUI() InGameUI::~InGameUI() { delete TheControlBar; - TheControlBar = NULL; + TheControlBar = nullptr; // free all the display strings if we're removeMilitarySubtitle(); @@ -1184,7 +1184,7 @@ InGameUI::~InGameUI() stopCameoMovie(); // remove any build available status - placeBuildAvailable( NULL, NULL ); + placeBuildAvailable( nullptr, nullptr ); setRadiusCursorNone(); // delete the message resources @@ -1195,7 +1195,7 @@ InGameUI::~InGameUI() // delete the array for the drawbles delete [] m_placeIcon; - m_placeIcon = NULL; + m_placeIcon = nullptr; // clear floating text clearFloatingText(); @@ -1211,7 +1211,7 @@ InGameUI::~InGameUI() void InGameUI::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, nullptr ); //override INI values with language localized values: if (TheGlobalLanguageData) @@ -1316,10 +1316,10 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe if (cursorType == RADIUSCURSOR_NONE) return; - Object* obj = NULL; + Object* obj = nullptr; if( m_pendingGUICommand && m_pendingGUICommand->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT ) { - if( ThePlayerList && ThePlayerList->getLocalPlayer() && specPowTempl != NULL ) + if( ThePlayerList && ThePlayerList->getLocalPlayer() && specPowTempl != nullptr ) { obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( specPowTempl->getSpecialPowerType() ); } @@ -1330,21 +1330,21 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe return; Drawable *draw = getFirstSelectedDrawable(); - if (draw == NULL) + if (draw == nullptr) return; obj = draw->getObject(); } - if (obj == NULL) + if (obj == nullptr) return; Player* controller = obj->getControllingPlayer(); - if (controller == NULL) + if (controller == nullptr) return; Real radius = 0.0f; - const Weapon* w = NULL; + const Weapon* w = nullptr; switch (cursorType) { // already handled @@ -1462,7 +1462,7 @@ void InGameUI::evaluateSoloNexus( Drawable *newlyAddedDrawable ) m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID;//failsafe... - // short test: If the thing just added is a nonmobster, bail with NULL + // short test: If the thing just added is a nonmobster, bail with nullptr if ( newlyAddedDrawable ) { const Object *newObj = newlyAddedDrawable->getObject(); @@ -1598,12 +1598,12 @@ void InGameUI::handleBuildPlacements( void ) BuildAssistant::SHROUD_REVEALED | BuildAssistant::IGNORE_STEALTHED, builderObject, - NULL ); + nullptr ); if( lbc != LBC_OK ) m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor ); else - m_placeIcon[ 0 ]->colorTint( NULL ); + m_placeIcon[ 0 ]->colorTint( nullptr ); @@ -1660,7 +1660,7 @@ void InGameUI::handleBuildPlacements( void ) for( i = 0; i < tileBuildInfo->tilesUsed; i++ ) { - if( m_placeIcon[ i ] == NULL ) + if( m_placeIcon[ i ] == nullptr ) { UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; @@ -1676,9 +1676,9 @@ void InGameUI::handleBuildPlacements( void ) for( i = tileBuildInfo->tilesUsed; i < maxObjects; i++ ) { - if( m_placeIcon[ i ] != NULL ) + if( m_placeIcon[ i ] != nullptr ) TheGameClient->destroyDrawable( m_placeIcon[ i ] ); - m_placeIcon[ i ] = NULL; + m_placeIcon[ i ] = nullptr; } @@ -1849,7 +1849,7 @@ void InGameUI::update( void ) { // increment the Block position's Y value to draw it on the next line Int height; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(NULL, &height); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(nullptr, &height); m_militarySubtitle->blockPos.y = m_militarySubtitle->blockPos.y + height; // Now add a new display string @@ -1877,7 +1877,7 @@ void InGameUI::update( void ) m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->appendChar(tempWChar); // increment the draw position of the block Int width; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,NULL); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,nullptr); m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x + width; // lets make a sound @@ -1921,13 +1921,13 @@ void InGameUI::update( void ) static NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); static NameKeyType powerWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ); - GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); - GameWindow *powerWin = TheWindowManager->winGetWindowFromId( NULL, powerWindowKey ); -// if( moneyWin == NULL ) + GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); + GameWindow *powerWin = TheWindowManager->winGetWindowFromId( nullptr, powerWindowKey ); +// if( moneyWin == nullptr ) // { // NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); // -// moneyWin = TheWindowManager->winGetWindowFromId( NULL, moneyWindowKey ); +// moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); // // } // end if Player* moneyPlayer = TheControlBar->getCurrentlyViewedPlayer(); @@ -2058,10 +2058,10 @@ void InGameUI::reset( void ) stopMovie(); // remove any pending GUI command - setGUICommand( NULL ); + setGUICommand( nullptr ); // remove any build available status - placeBuildAvailable( NULL, NULL ); + placeBuildAvailable( nullptr, nullptr ); // free any message resources allocated freeMessageResources(); @@ -2154,7 +2154,7 @@ void InGameUI::freeMessageResources( void ) // free display string if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; // set timestamp to zero m_uiMessages[ i ].timestamp = 0; @@ -2166,17 +2166,17 @@ void InGameUI::freeMessageResources( void ) void InGameUI::freeCustomUiResources( void ) { TheDisplayStringManager->freeDisplayString(m_networkLatencyString); - m_networkLatencyString = NULL; + m_networkLatencyString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsString); - m_renderFpsString = NULL; + m_renderFpsString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsLimitString); - m_renderFpsLimitString = NULL; + m_renderFpsLimitString = nullptr; TheDisplayStringManager->freeDisplayString(m_systemTimeString); - m_systemTimeString = NULL; + m_systemTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeString); - m_gameTimeString = NULL; + m_gameTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeFrameString); - m_gameTimeFrameString = NULL; + m_gameTimeFrameString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2215,7 +2215,7 @@ void InGameUI::message( AsciiString stringManagerLabel, ... ) //------------------------------------------------------------------------------------------------- void InGameUI::messageNoFormat( const UnicodeString& message ) { - addMessageText( message, NULL ); + addMessageText( message, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -2297,7 +2297,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC m_uiMessages[ MAX_UI_MESSAGES - 1 ].fullText.clear(); if( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ); - m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = NULL; + m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = nullptr; m_uiMessages[ MAX_UI_MESSAGES - 1 ].timestamp = 0; // shift all the messages down one index and remove the last one @@ -2320,7 +2320,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC // assign a color for this string instance that will stay with it no matter what // line it is rendered on // - if( m_uiMessages[ 1 ].displayString == NULL || m_uiMessages[ 1 ].color == color2 ) + if( m_uiMessages[ 1 ].displayString == nullptr || m_uiMessages[ 1 ].color == color2 ) m_uiMessages[ 0 ].color = color1; else m_uiMessages[ 0 ].color = color2; @@ -2336,7 +2336,7 @@ void InGameUI::removeMessageAtIndex( Int i ) m_uiMessages[ i ].fullText.clear(); if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = NULL; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; } @@ -2375,7 +2375,7 @@ void InGameUI::createMoveHint( const GameMessage *msg ) if( getSelectCount() == 1 ) { Drawable *draw = getFirstSelectedDrawable(); - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; if( obj && obj->isKindOf( KINDOF_IMMOBILE ) ) { //Don't allow move hints to be created if our selected object can't move! @@ -2442,7 +2442,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) if (m_isScrolling || m_isSelecting) return; // no mouseover for you - GameWindow *window = NULL; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2481,7 +2481,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->setCursorTooltip(UnicodeString::TheEmptyString ); m_mousedOverDrawableID = INVALID_DRAWABLE_ID; const Drawable *draw = TheGameClient->findDrawableByID(msg->getArgument(0)->drawableID); - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; if( obj ) { @@ -2512,14 +2512,14 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) #endif - const Player* player = NULL; + const Player* player = nullptr; const ThingTemplate *thingTemplate = obj->getTemplate(); ContainModuleInterface* contain = obj->getContain(); if( contain ) player = contain->getApparentControllingPlayer(ThePlayerList->getLocalPlayer()); - if (player == NULL) + if (player == nullptr) player = obj->getControllingPlayer(); Bool disguised = false; @@ -2612,7 +2612,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) // Add on dollar amount of warehouse contents so people don't freak out until the art is hooked up static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" ); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey ); - if( warehouseModule != NULL ) + if( warehouseModule != nullptr ) { Int boxes = warehouseModule->getBoxesStored(); Int value = boxes * TheGlobalData->m_baseValuePerSupplyBox; @@ -2689,7 +2689,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) Drawable *draw = TheGameClient->findDrawableByID(m_mousedOverDrawableID); //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { @@ -2752,7 +2752,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) { setMouseCursor(Mouse::FORCE_ATTACK_GROUND); setRadiusCursor(RADIUSCURSOR_GUARD_AREA, - NULL, + nullptr, PRIMARY_WEAPON); return; } @@ -2763,7 +2763,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) // set cursor to normal if there is a window under the cursor - GameWindow *window = NULL; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2788,19 +2788,19 @@ void InGameUI::createCommandHint( const GameMessage *msg ) } //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : NULL; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { drawSelectable = false; } - // Note: These are only non-NULL if there is exactly one thing selected. - const Drawable *srcDraw = NULL; - const Object *srcObj = NULL; + // Note: These are only non-null if there is exactly one thing selected. + const Drawable *srcDraw = nullptr; + const Object *srcObj = nullptr; if (getSelectCount() == 1) { srcDraw = getAllSelectedDrawables()->front(); - srcObj = (srcDraw ? srcDraw->getObject() : NULL); + srcObj = (srcDraw ? srcDraw->getObject() : nullptr); } switch (m_mouseMode) @@ -3017,7 +3017,7 @@ void InGameUI::setScrolling( Bool isScrolling ) // break any camera locks TheTacticalView->setCameraLock( INVALID_ID ); - TheTacticalView->setCameraLockDrawable( NULL ); + TheTacticalView->setCameraLockDrawable( nullptr ); } else { @@ -3094,7 +3094,7 @@ void InGameUI::setGUICommand( const CommandButton *command ) DEBUG_ASSERTCRASH( 0, ("setGUICommand: Command '%s' does not need additional user interaction", command->getName().str()) ); - m_pendingGUICommand = NULL; + m_pendingGUICommand = nullptr; m_mouseMode = MOUSEMODE_DEFAULT; return; @@ -3146,7 +3146,7 @@ const CommandButton *InGameUI::getGUICommand( void ) const } //------------------------------------------------------------------------------------------------- -/** Destroy any drawables we have in our placement icon array and set to NULL */ +/** Destroy any drawables we have in our placement icon array and set to null */ //------------------------------------------------------------------------------------------------- void InGameUI::destroyPlacementIcons( void ) { @@ -3160,7 +3160,7 @@ void InGameUI::destroyPlacementIcons( void ) TheTerrainVisual->removeFactionBibDrawable(m_placeIcon[ i ]); TheGameClient->destroyDrawable( m_placeIcon[ i ] ); } - m_placeIcon[ i ] = NULL; + m_placeIcon[ i ] = nullptr; } TheTerrainVisual->removeAllBibs(); @@ -3175,7 +3175,7 @@ void InGameUI::destroyPlacementIcons( void ) void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildDrawable ) { - if (build != NULL) + if (build != nullptr) { // if building something, no radius cursor, thankew setRadiusCursorNone(); @@ -3185,8 +3185,8 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD // if we're setting another place available, but we're somehow already in the placement // mode, get out of it before we start a new one // - if( m_pendingPlaceType != NULL && build != NULL ) - placeBuildAvailable( NULL, NULL ); + if( m_pendingPlaceType != nullptr && build != nullptr ) + placeBuildAvailable( nullptr, nullptr ); // // keep a record of what we are trying to place, if we are already trying to @@ -3199,7 +3199,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( m_pendingPlaceSourceObjectID != INVALID_ID ); m_pendingPlaceSourceObjectID = INVALID_ID; - Object *sourceObject = NULL; + Object *sourceObject = nullptr; if( buildDrawable ) sourceObject = buildDrawable->getObject(); if( sourceObject ) @@ -3257,7 +3257,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD draw->setDrawableOpacity( TheGlobalData->m_objectPlacementOpacity ); // set the "icon" in the icon array at the first index - DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == NULL, ("placeBuildAvailable, build icon array is not empty!") ); + DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == nullptr, ("placeBuildAvailable, build icon array is not empty!") ); m_placeIcon[ 0 ] = draw; } @@ -3270,7 +3270,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD } setMouseCursor( Mouse::ARROW ); - setPlacementStart( NULL ); + setPlacementStart( nullptr ); // if we have a place icons destroy them destroyPlacementIcons(); @@ -3282,7 +3282,7 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD { //Clear the special power mode for construction if we set it. Actually call it everytime //rather than checking if it's set before clearing (cheaper). - puInterface->setSpecialPowerConstructionCommandButton( NULL ); + puInterface->setSpecialPowerConstructionCommandButton( nullptr ); } } @@ -3519,7 +3519,7 @@ Drawable *InGameUI::getFirstSelectedDrawable( void ) // sanity if( m_selectedDrawables.empty() ) - return NULL; // this is valid, nothing is selected + return nullptr; // this is valid, nothing is selected return m_selectedDrawables.front(); @@ -3732,7 +3732,7 @@ void InGameUI::postDraw( void ) { m_militarySubtitle->displayStrings[i]->draw(pos.x,pos.y, m_militarySubtitle->color,dropColor ); Int height; - m_militarySubtitle->displayStrings[i]->getSize(NULL, &height); + m_militarySubtitle->displayStrings[i]->getSize(nullptr, &height); pos.y += height; } if( m_militarySubtitle->blockDrawn ) @@ -4139,7 +4139,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == NULL ) + if ( m_videoStream == nullptr ) { return; } @@ -4147,7 +4147,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_currentlyPlayingMovie = movieName; m_videoBuffer = TheDisplay->createVideoBuffer(); - if ( m_videoBuffer == NULL || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -4162,12 +4162,12 @@ void InGameUI::playMovie( const AsciiString& movieName ) void InGameUI::stopMovie( void ) { delete m_videoBuffer; - m_videoBuffer = NULL; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = NULL; + m_videoStream = nullptr; } if (!m_currentlyPlayingMovie.isEmpty()) { @@ -4194,14 +4194,14 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) m_cameoVideoStream = TheVideoPlayer->open( movieName ); - if ( m_cameoVideoStream == NULL ) + if ( m_cameoVideoStream == nullptr ) { return; } m_cameoVideoBuffer = TheDisplay->createVideoBuffer(); - if ( m_cameoVideoBuffer == NULL || + if ( m_cameoVideoBuffer == nullptr || !m_cameoVideoBuffer->allocate( m_cameoVideoStream->width(), m_cameoVideoStream->height()) ) @@ -4209,7 +4209,7 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) stopCameoMovie(); return; } - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); WinInstanceData *winData = window->winGetInstanceData(); winData->setVideoBuffer(m_cameoVideoBuffer); // window->winHide(FALSE); @@ -4220,19 +4220,19 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) void InGameUI::stopCameoMovie( void ) { //RightHUD - //GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + //GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); // window->winHide(FALSE); WinInstanceData *winData = window->winGetInstanceData(); - winData->setVideoBuffer(NULL); + winData->setVideoBuffer(nullptr); delete m_cameoVideoBuffer; - m_cameoVideoBuffer = NULL; + m_cameoVideoBuffer = nullptr; if ( m_cameoVideoStream ) { m_cameoVideoStream->close(); - m_cameoVideoStream = NULL; + m_cameoVideoStream = nullptr; } } @@ -4338,7 +4338,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * TheGlobalLanguageData->m_militaryCaptionDelayMS)/1000.0f); m_militarySubtitle->index = 0; for (int i = 1; i < MAX_SUBTITLE_LINES; i ++) - m_militarySubtitle->displayStrings[i] = NULL; + m_militarySubtitle->displayStrings[i] = nullptr; m_militarySubtitle->currentDisplayString = 0; m_militarySubtitle->displayStrings[0] = TheDisplayStringManager->newDisplayString(); @@ -4363,12 +4363,12 @@ void InGameUI::removeMilitarySubtitle( void ) for(UnsignedInt i = 0; i <= m_militarySubtitle->currentDisplayString; i ++) { TheDisplayStringManager->freeDisplayString(m_militarySubtitle->displayStrings[i]); - m_militarySubtitle->displayStrings[i] = NULL; + m_militarySubtitle->displayStrings[i] = nullptr; } //delete it man! delete m_militarySubtitle; - m_militarySubtitle= NULL; + m_militarySubtitle= nullptr; } @@ -4429,7 +4429,7 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const //Kris: Aug 16, 2003 //John McDonald added this code back in Oct 09, 2002. //Replaced it with palatable code. - //if( (objectToInteractWith == NULL) != (action == ACTIONTYPE_SET_RALLY_POINT)) <---BAD CODE + //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) <---BAD CODE if( !objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT || //No object to interact with (and not rally point mode) objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT ) //Object to interact with (and rally point mode) { @@ -4528,7 +4528,7 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje //and nearly two projects. I'm fixing this now by moving it to the rally point code... //because it would be nice if a saboteur could actually sabotage a building via a //commandbutton. - //if( (objectToInteractWith == NULL) != (action == ACTIONTYPE_SET_RALLY_POINT)) + //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) if( !objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT || //No object to interact with (and not rally point mode) objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT ) //Object to interact with (and rally point mode) { @@ -4689,7 +4689,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c } // get selected list of drawables - Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : NULL; + Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : nullptr; DrawableList tmpList; if (ignoreSelDraw) @@ -5082,7 +5082,7 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear) { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectAllUnitsByTypeAcrossRegion(NULL, mustBeSet, mustBeClear); + Int numSelected = selectAllUnitsByTypeAcrossRegion(nullptr, mustBeSet, mustBeClear); if (numSelected == -1) { UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); @@ -5111,7 +5111,7 @@ Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMask Int InGameUI::selectMatchingAcrossMap() { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectMatchingAcrossRegion(NULL); + Int numSelected = selectMatchingAcrossRegion(nullptr); if (numSelected == -1) { UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); @@ -5367,7 +5367,7 @@ void InGameUI::drawFloatingText( void ) // make drop color black, but use the alpha setting of the fill color specified (for fading) GameGetColorComponents( ftd->m_color, &r, &g, &b, &a ); dropColor = GameMakeColor( 0, 0, 0, a ); - ftd->m_dString->getSize(&width, NULL); + ftd->m_dString->getSize(&width, nullptr); // draw it! ftd->m_dString->draw(pos.x - (width / 2), pos.y, ftd->m_color,dropColor); } @@ -5452,12 +5452,12 @@ void InGameUI::clearPopupMessageData( void ) { m_popupMessageData->layout->destroyWindows(); deleteInstance(m_popupMessageData->layout); - m_popupMessageData->layout = NULL; + m_popupMessageData->layout = nullptr; } if( m_popupMessageData->pause ) TheGameLogic->setGamePaused(FALSE, m_popupMessageData->pauseMusic); deleteInstance(m_popupMessageData); - m_popupMessageData = NULL; + m_popupMessageData = nullptr; } @@ -5486,7 +5486,7 @@ FloatingTextData::~FloatingTextData(void) { if(m_dString) TheDisplayStringManager->freeDisplayString( m_dString ); - m_dString = NULL; + m_dString = nullptr; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -5500,7 +5500,7 @@ FloatingTextData::~FloatingTextData(void) WorldAnimationData::WorldAnimationData( void ) { - m_anim = NULL; + m_anim = nullptr; m_worldPos.zero(); m_expireFrame = 0; m_options = WORLD_ANIM_NO_OPTIONS; @@ -5519,13 +5519,13 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate, { // sanity - if( animTemplate == NULL || pos == NULL || durationInSeconds <= 0.0f ) + if( animTemplate == nullptr || pos == nullptr || durationInSeconds <= 0.0f ) return; // allocate a new world animation data struct // (huh huh, he said "wad") WorldAnimationData *wad = NEW WorldAnimationData; - if( wad == NULL ) + if( wad == nullptr ) return; // allocate a new animation instance @@ -5673,11 +5673,11 @@ void InGameUI::updateAndDrawWorldAnimations( void ) Object *InGameUI::findIdleWorker( Object *obj) { if(!obj) - return NULL; + return nullptr; Int index = obj->getControllingPlayer()->getPlayerIndex(); if(m_idleWorkers[index].empty()) - return NULL; + return nullptr; ObjectListIt it = m_idleWorkers[index].begin(); while(it != m_idleWorkers[index].end()) @@ -5690,7 +5690,7 @@ Object *InGameUI::findIdleWorker( Object *obj) } ++it; } - return NULL; + return nullptr; } void InGameUI::addIdleWorker( Object *obj ) @@ -5740,7 +5740,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(FALSE, ("InGameUI::selectNextIdleWorker We're trying to select a worker when our list is empty for player %ls", player->getPlayerDisplayName().str())); return; } - Object *selectThisObject = NULL; + Object *selectThisObject = nullptr; if(getSelectCount() == 0 || getSelectCount() > 1) { @@ -5779,7 +5779,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(selectThisObject, ("InGameUI::selectNextIdleWorker Could not select the next IDLE worker")); if(selectThisObject) { - DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == NULL, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); + DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == nullptr, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); deselectAllDrawables(); GameMessage *teamMsg = TheMessageStream->appendMessage( GameMessage::MSG_CREATE_SELECTED_GROUP ); @@ -5833,7 +5833,7 @@ void InGameUI::showIdleWorkerLayout( void ) { if (!m_idleWorkerWin) { - m_idleWorkerWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + m_idleWorkerWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); DEBUG_ASSERTCRASH(m_idleWorkerWin, ("InGameUI::showIdleWorkerLayout could not find IdleWorker.wnd to load")); return; } @@ -5887,10 +5887,10 @@ void InGameUI::resetIdleWorker( void ) void InGameUI::recreateControlBar( void ) { - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); deleteInstance(win); - m_idleWorkerWin = NULL; + m_idleWorkerWin = nullptr; createControlBar(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index 9ef9c3b1423..fd49fd14433 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -37,7 +37,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Keyboard *TheKeyboard = NULL; +Keyboard *TheKeyboard = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////////////////////////// @@ -51,11 +51,11 @@ void Keyboard::createStreamMessages( void ) { // sanity - if( TheMessageStream == NULL ) + if( TheMessageStream == nullptr ) return; KeyboardIO *key = getFirstKey(); - GameMessage *msg = NULL; + GameMessage *msg = nullptr; while( key->key != KEY_NONE ) { @@ -802,7 +802,7 @@ KeyboardIO *Keyboard::findKey( KeyDefType key, KeyboardIO::StatusType status ) return io; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 2310d9ccc6c..4080491eedf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -51,7 +51,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Mouse *TheMouse = NULL; +Mouse *TheMouse = nullptr; const char *const Mouse::RedrawModeName[] = { "Mouse:Windows", @@ -72,44 +72,44 @@ const char *const Mouse::CursorCaptureBlockReasonNames[] = { /////////////////////////////////////////////////////////////////////////////////////////////////// static const FieldParse TheMouseCursorFieldParseTable[] = { - { "CursorText", INI::parseAsciiString, NULL, offsetof( CursorInfo, cursorText ) }, - { "CursorTextColor", INI::parseRGBAColorInt, NULL, offsetof( CursorInfo, cursorTextColor ) }, - { "CursorTextDropColor", INI::parseRGBAColorInt, NULL, offsetof( CursorInfo, cursorTextDropColor ) }, - { "W3DModel", INI::parseAsciiString, NULL, offsetof( CursorInfo, W3DModelName ) }, - { "W3DAnim", INI::parseAsciiString, NULL, offsetof( CursorInfo, W3DAnimName ) }, - { "W3DScale", INI::parseReal, NULL, offsetof( CursorInfo, W3DScale ) }, - { "Loop", INI::parseBool, NULL, offsetof( CursorInfo, loop ) }, - { "Image", INI::parseAsciiString, NULL, offsetof( CursorInfo, imageName ) }, - { "Texture", INI::parseAsciiString, NULL, offsetof( CursorInfo, textureName ) }, - { "HotSpot", INI::parseICoord2D, NULL, offsetof( CursorInfo, hotSpotPosition ) }, - { "Frames", INI::parseInt, NULL, offsetof( CursorInfo, numFrames ) }, - { "FPS", INI::parseReal, NULL, offsetof( CursorInfo, fps)}, - { "Directions", INI::parseInt, NULL, offsetof( CursorInfo, numDirections ) }, + { "CursorText", INI::parseAsciiString, nullptr, offsetof( CursorInfo, cursorText ) }, + { "CursorTextColor", INI::parseRGBAColorInt, nullptr, offsetof( CursorInfo, cursorTextColor ) }, + { "CursorTextDropColor", INI::parseRGBAColorInt, nullptr, offsetof( CursorInfo, cursorTextDropColor ) }, + { "W3DModel", INI::parseAsciiString, nullptr, offsetof( CursorInfo, W3DModelName ) }, + { "W3DAnim", INI::parseAsciiString, nullptr, offsetof( CursorInfo, W3DAnimName ) }, + { "W3DScale", INI::parseReal, nullptr, offsetof( CursorInfo, W3DScale ) }, + { "Loop", INI::parseBool, nullptr, offsetof( CursorInfo, loop ) }, + { "Image", INI::parseAsciiString, nullptr, offsetof( CursorInfo, imageName ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( CursorInfo, textureName ) }, + { "HotSpot", INI::parseICoord2D, nullptr, offsetof( CursorInfo, hotSpotPosition ) }, + { "Frames", INI::parseInt, nullptr, offsetof( CursorInfo, numFrames ) }, + { "FPS", INI::parseReal, nullptr, offsetof( CursorInfo, fps)}, + { "Directions", INI::parseInt, nullptr, offsetof( CursorInfo, numDirections ) }, }; static const FieldParse TheMouseFieldParseTable[] = { - { "TooltipFontName", INI::parseAsciiString,NULL, offsetof( Mouse, m_tooltipFontName ) }, - { "TooltipFontSize", INI::parseInt, NULL, offsetof( Mouse, m_tooltipFontSize ) }, - { "TooltipFontIsBold", INI::parseBool, NULL, offsetof( Mouse, m_tooltipFontIsBold ) }, - { "TooltipAnimateBackground", INI::parseBool, NULL, offsetof( Mouse, m_tooltipAnimateBackground ) }, - { "TooltipFillTime", INI::parseInt, NULL, offsetof( Mouse, m_tooltipFillTime ) }, - { "TooltipDelayTime", INI::parseInt, NULL, offsetof( Mouse, m_tooltipDelayTime ) }, - { "TooltipTextColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorText ) }, - { "TooltipHighlightColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorHighlight ) }, - { "TooltipShadowColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorShadow ) }, - { "TooltipBackgroundColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorBackground ) }, - { "TooltipBorderColor", INI::parseRGBAColorInt, NULL, offsetof( Mouse, m_tooltipColorBorder ) }, - { "TooltipWidth", INI::parsePercentToReal,NULL, offsetof( Mouse, m_tooltipWidth ) }, - { "CursorMode", INI::parseInt, NULL, offsetof( Mouse, m_currentRedrawMode ) }, - { "UseTooltipAltTextColor", INI::parseBool, NULL, offsetof( Mouse, m_useTooltipAltTextColor ) }, - { "UseTooltipAltBackColor", INI::parseBool, NULL, offsetof( Mouse, m_useTooltipAltBackColor ) }, - { "AdjustTooltipAltColor", INI::parseBool, NULL, offsetof( Mouse, m_adjustTooltipAltColor ) }, - { "OrthoCamera", INI::parseBool, NULL, offsetof( Mouse, m_orthoCamera ) }, - { "OrthoZoom", INI::parseReal, NULL, offsetof( Mouse, m_orthoZoom ) }, - { "DragTolerance", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragTolerance) }, - { "DragTolerance3D", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragTolerance3D) }, - { "DragToleranceMS", INI::parseUnsignedInt, NULL, offsetof( Mouse, m_dragToleranceMS) }, + { "TooltipFontName", INI::parseAsciiString,nullptr, offsetof( Mouse, m_tooltipFontName ) }, + { "TooltipFontSize", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipFontSize ) }, + { "TooltipFontIsBold", INI::parseBool, nullptr, offsetof( Mouse, m_tooltipFontIsBold ) }, + { "TooltipAnimateBackground", INI::parseBool, nullptr, offsetof( Mouse, m_tooltipAnimateBackground ) }, + { "TooltipFillTime", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipFillTime ) }, + { "TooltipDelayTime", INI::parseInt, nullptr, offsetof( Mouse, m_tooltipDelayTime ) }, + { "TooltipTextColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorText ) }, + { "TooltipHighlightColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorHighlight ) }, + { "TooltipShadowColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorShadow ) }, + { "TooltipBackgroundColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorBackground ) }, + { "TooltipBorderColor", INI::parseRGBAColorInt, nullptr, offsetof( Mouse, m_tooltipColorBorder ) }, + { "TooltipWidth", INI::parsePercentToReal,nullptr, offsetof( Mouse, m_tooltipWidth ) }, + { "CursorMode", INI::parseInt, nullptr, offsetof( Mouse, m_currentRedrawMode ) }, + { "UseTooltipAltTextColor", INI::parseBool, nullptr, offsetof( Mouse, m_useTooltipAltTextColor ) }, + { "UseTooltipAltBackColor", INI::parseBool, nullptr, offsetof( Mouse, m_useTooltipAltBackColor ) }, + { "AdjustTooltipAltColor", INI::parseBool, nullptr, offsetof( Mouse, m_adjustTooltipAltColor ) }, + { "OrthoCamera", INI::parseBool, nullptr, offsetof( Mouse, m_orthoCamera ) }, + { "OrthoZoom", INI::parseReal, nullptr, offsetof( Mouse, m_orthoZoom ) }, + { "DragTolerance", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragTolerance) }, + { "DragTolerance3D", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragTolerance3D) }, + { "DragToleranceMS", INI::parseUnsignedInt, nullptr, offsetof( Mouse, m_dragToleranceMS) }, }; @@ -449,7 +449,7 @@ Mouse::Mouse( void ) m_dragToleranceMS = 0; //m_tooltipString.clear(); // redundant m_displayTooltip = FALSE; - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDelay = -1; // default value // initialize all the mouse io data memset( m_mouseEvents, 0, sizeof( m_mouseEvents ) ); @@ -498,7 +498,7 @@ Mouse::Mouse( void ) m_isTooltipEmpty = TRUE; - m_cursorTextDisplayString = NULL; + m_cursorTextDisplayString = nullptr; m_cursorTextColor.red = 255; m_cursorTextColor.green = 255; m_cursorTextColor.blue = 255; @@ -533,11 +533,11 @@ Mouse::~Mouse( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; if( m_cursorTextDisplayString ) TheDisplayStringManager->freeDisplayString( m_cursorTextDisplayString ); - m_cursorTextDisplayString = NULL; + m_cursorTextDisplayString = nullptr; } @@ -546,7 +546,7 @@ the Win32 version of the mouse (by preloading resources before D3D device is cre void Mouse::parseIni(void) { INI ini; - ini.loadFileDirectory( "Data\\INI\\Mouse", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Mouse", INI_LOAD_OVERWRITE, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -594,7 +594,7 @@ void Mouse::onResolutionChanged( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDisplayString = TheDisplayStringManager->newDisplayString(); @@ -673,10 +673,10 @@ void Mouse::createStreamMessages( void ) { // santiy - if( TheMessageStream == NULL ) + if( TheMessageStream == nullptr ) return; // no place to put messages - GameMessage *msg = NULL; + GameMessage *msg = nullptr; UnsignedInt now = timeGetTime(); // basic position messages are always created @@ -717,7 +717,7 @@ void Mouse::createStreamMessages( void ) m_stillTime = now; // button messages - msg = NULL; + msg = nullptr; switch( m_currMouse.leftEvent ) { @@ -751,7 +751,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.middleEvent ) { @@ -786,7 +786,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.rightEvent ) { @@ -822,7 +822,7 @@ void Mouse::createStreamMessages( void ) } // wheel pos - msg = NULL; + msg = nullptr; if( m_currMouse.wheelPos != 0 ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL ); @@ -921,7 +921,7 @@ void Mouse::setMouseText( UnicodeString text, { // sanity, if no display string has been created, get out of here - if( m_cursorTextDisplayString == NULL ) + if( m_cursorTextDisplayString == nullptr ) return; // set the text into the cursor display string @@ -1047,7 +1047,7 @@ Bool Mouse::canCapture() const if (m_captureBlockReasonBits != 0) return false; - DEBUG_ASSERTCRASH(TheDisplay != NULL, ("The Display is NULL")); + DEBUG_ASSERTCRASH(TheDisplay != nullptr, ("The Display is null")); const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); if (TheDisplay->getWindowed()) @@ -1208,7 +1208,7 @@ void Mouse::drawCursorText( void ) { // sanity - if( m_cursorTextDisplayString == NULL ) + if( m_cursorTextDisplayString == nullptr ) return; // get the colors to draw the text in an acceptable format @@ -1322,7 +1322,7 @@ void Mouse::setCursor( MouseCursor cursor ) return; // only if we have a display cursor do we do anything with mouse text - if( m_cursorTextDisplayString != NULL ) + if( m_cursorTextDisplayString != nullptr ) { CursorInfo *cursorInfo = &m_cursorInfo[ cursor ]; @@ -1335,7 +1335,7 @@ void Mouse::setCursor( MouseCursor cursor ) &(cursorInfo->cursorTextColor), &(cursorInfo->cursorTextDropColor) ); else - setMouseText( L"", NULL, NULL ); + setMouseText( L"", nullptr, nullptr ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp index 6185748421c..93c2513baae 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp @@ -31,7 +31,7 @@ -LanguageFilter *TheLanguageFilter = NULL; +LanguageFilter *TheLanguageFilter = nullptr; LanguageFilter::LanguageFilter() { @@ -46,7 +46,7 @@ void LanguageFilter::init() { // read in the file already. File *file1 = TheFileSystem->openFile(BadWordFileName, File::READ | File::BINARY); - if (file1 == NULL) { + if (file1 == nullptr) { return; } @@ -66,7 +66,7 @@ void LanguageFilter::init() { } file1->close(); - file1 = NULL; + file1 = nullptr; } void LanguageFilter::reset() { @@ -88,7 +88,7 @@ void LanguageFilter::filterLine(UnicodeString &line) while (newLine.nextToken(&token, L" ;,.!?:=\\/><`~()&^%#\n\t")) { wchar_t *pos = wcsstr(buf, token.str()); - if (pos == NULL) { + if (pos == nullptr) { DEBUG_CRASH(("Couldn't find the token in its own string.")); continue; } @@ -143,7 +143,7 @@ void LanguageFilter::unHaxor(UnicodeString &word) { newWord.concat(L's'); } else if (c == L'+') { newWord.concat(L't'); - } else if (wcsrchr(ignoredChars, c) == NULL) { + } else if (wcsrchr(ignoredChars, c) == nullptr) { newWord.concat(c); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp index 610ef69963f..227695aa473 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -274,12 +274,12 @@ Bool PointInsideRect2D(const Coord2D *bl, const Coord2D *tl, const Coord2D *br, Real uVal; // we're actually only interested in if the U value is (0,1) - ShortestDistancePointToSegment2D(bl, tl, inputPoint, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(bl, tl, inputPoint, nullptr, nullptr, &uVal); if (uVal <= 0.0f || uVal >= 1.0f) { return false; } - ShortestDistancePointToSegment2D(bl, br, inputPoint, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(bl, br, inputPoint, nullptr, nullptr, &uVal); return (uVal > 0.0f && uVal < 1.0f); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 653756fa318..140e50322cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -158,7 +158,7 @@ void objectUnderConstruction(Object* obj, void *underConstruction) } ProductionUpdateInterface *pui = ProductionUpdate::getProductionUpdateInterfaceFromObject(obj); - if(pui != NULL && pui->getProductionCount() > 0) + if(pui != nullptr && pui->getProductionCount() > 0) { *(Bool*)underConstruction = true; return; @@ -215,7 +215,7 @@ bool changeMaxRenderFps(FpsValueChange change) bool changeLogicTimeScale(FpsValueChange change) { - if (TheNetwork != NULL) + if (TheNetwork != nullptr) return false; const UnsignedInt maxRenderFps = TheFramePacer->getFramesPerSecondLimit(); @@ -387,7 +387,7 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, } else { - result = obj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, pos, CMD_FROM_PLAYER ); + result = obj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, nullptr, pos, CMD_FROM_PLAYER ); if( result != ATTACKRESULT_POSSIBLE ) // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase { ContainModuleInterface *contain = obj->getContain(); @@ -401,7 +401,7 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, } } //Now evaluate the testObj again to see if it is capable of force attacking the pos. - result = testObj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, pos, CMD_FROM_PLAYER ); + result = testObj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, nullptr, pos, CMD_FROM_PLAYER ); return result; } } @@ -440,12 +440,12 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m return; } - const AudioEventRTS* soundToPlayPtr = NULL; + const AudioEventRTS* soundToPlayPtr = nullptr; - Object *objectWithSound = NULL; + Object *objectWithSound = nullptr; Bool skip = false; - Object *target = NULL; + Object *target = nullptr; if( info && info->m_drawTarget ) { target = info->m_drawTarget->getObject(); @@ -654,7 +654,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m break; } else { // clear out the sound to play, and drop into the attack object logic. - soundToPlayPtr = NULL; + soundToPlayPtr = nullptr; FALLTHROUGH; } } @@ -971,7 +971,7 @@ void amIAHero(Object* obj, void* heroHolder) { - if (!obj || ((HeroHolder*)heroHolder)->hero != NULL) + if (!obj || ((HeroHolder*)heroHolder)->hero != nullptr) { return; } @@ -988,10 +988,10 @@ static Object *iNeedAHero( void ) { Player* localPlayer = rts::getObservedOrLocalPlayer(); if (!localPlayer->isPlayerActive()) - return NULL; + return nullptr; HeroHolder heroHolder; - heroHolder.hero = NULL; + heroHolder.hero = nullptr; localPlayer->iterateObjects(amIAHero, (void*)&heroHolder); @@ -1007,7 +1007,7 @@ GameMessage::Type CommandTranslator::issueMoveToLocationCommand( const Coord3D * CommandEvaluateType commandType ) { GameMessage::Type msgType = GameMessage::MSG_INVALID; - Object *obj = drawableInWay ? drawableInWay->getObject() : NULL; + Object *obj = drawableInWay ? drawableInWay->getObject() : nullptr; Bool isForceAttackable = FALSE; if (obj) { @@ -1072,11 +1072,11 @@ GameMessage::Type CommandTranslator::createAttackMessage( Drawable *draw, GameMessage::Type msgType = GameMessage::MSG_INVALID; // the drawable must have an object to be able to attack - if( draw->getObject() == NULL ) + if( draw->getObject() == nullptr ) return msgType; // the target must have an object to be attacked - if( other->getObject() == NULL ) + if( other->getObject() == nullptr ) return msgType; // insert object attack command message into stream @@ -1107,7 +1107,7 @@ GameMessage::Type CommandTranslator::issueAttackCommand( Drawable *target, { GameMessage::Type msgType = GameMessage::MSG_INVALID; - if (target == NULL) + if (target == nullptr) return msgType; // you cannot attack an enemy that has no object representation @@ -1298,7 +1298,7 @@ GameMessage::Type CommandTranslator::issueCombatDropCommand( const CommandButton return GameMessage::MSG_INVALID; } - if( target != NULL && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) + if( target != nullptr && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { // OBJECT BASED SPECIAL @@ -1492,7 +1492,7 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const if( draw ) { - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; if( !obj ) { return retVal; @@ -1526,7 +1526,7 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const } else if( pos ) { - CanAttackResult result = canAnyForceAttack( allSelected, NULL, pos ); + CanAttackResult result = canAnyForceAttack( allSelected, nullptr, pos ); if( result == ATTACKRESULT_POSSIBLE || result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { @@ -1561,13 +1561,13 @@ GameMessage::Type CommandTranslator::evaluateForceAttack( Drawable *draw, const * 'draw'. If type == DO_HINT, then the user hasn't actually clicked, but has moused over * the drawable 'draw' and we want to generate a hint message as to what the actual * command would be if clicked - * NOTE: draw can be NULL, in which case we give a hint for the location */ + * NOTE: draw can be null, in which case we give a hint for the location */ // ------------------------------------------------------------------------------------------------ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, const Coord3D *pos, CommandEvaluateType type ) { - Object *obj = draw ? draw->getObject() : NULL; + Object *obj = draw ? draw->getObject() : nullptr; Drawable *drawableInWay = draw; //This piece of code is used to prevent interaction with unselectable objects or masked objects. When we @@ -1575,28 +1575,28 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //drawable is invalid... then convert it to a position to be evaluated instead. //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything - if( obj == NULL || + if( obj == nullptr || obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } // If the thing is a mine, and is locally controlled, then we should issue a moveto to its location. if (obj && obj->isLocallyControlled() && obj->isKindOf(KINDOF_MINE)) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } if( TheInGameUI->isInForceMoveToMode() ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } else if (TheInGameUI->isInForceAttackMode() ) { // setting the drawableInWay to draw will allow us to force attack in the issue move command // if there is a location to which we should attack. @@ -1657,8 +1657,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //If our object is a shrubbery, and we don't allow targetting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } if( obj && obj->isKindOf( KINDOF_MINE ) && !BitIsSet( command->getOptions(), ALLOW_MINE_TARGET ) ) @@ -1666,8 +1666,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //If our object is a mine, and we don't allow targetting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } //Kris: September 27, 2002 @@ -1681,22 +1681,22 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, case ALLIES: if( !BitIsSet( command->getOptions(), NEED_TARGET_ALLY_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; case ENEMIES: if( !BitIsSet( command->getOptions(), NEED_TARGET_ENEMY_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; case NEUTRAL: if( !BitIsSet( command->getOptions(), NEED_TARGET_NEUTRAL_OBJECT ) ) { - draw = NULL; - obj = NULL; + draw = nullptr; + obj = nullptr; } break; } @@ -1734,7 +1734,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } case GUI_COMMAND_SPECIAL_POWER: - currentlyValid = TheInGameUI->canSelectedObjectsDoSpecialPower( command, obj, pos, InGameUI::SELECTION_ANY, command->getOptions(), NULL ); + currentlyValid = TheInGameUI->canSelectedObjectsDoSpecialPower( command, obj, pos, InGameUI::SELECTION_ANY, command->getOptions(), nullptr ); break; case GUI_COMMAND_FIRE_WEAPON: currentlyValid = TheInGameUI->canSelectedObjectsEffectivelyUseWeapon( command, obj, pos, InGameUI::SELECTION_ANY ); @@ -1768,7 +1768,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } case GUI_COMMAND_SPECIAL_POWER://lorenzen - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; case GUI_COMMAND_FIRE_WEAPON: msgType = issueFireWeaponCommand( command, type, draw, pos ); @@ -1778,10 +1778,10 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } - // NULL out the GUI command if we're actually doing something + // null out the GUI command if we're actually doing something if( type == DO_COMMAND ) { - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } } @@ -1819,7 +1819,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, break; } case GUI_COMMAND_SPECIAL_POWER://lorenzen - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2195,7 +2195,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, spType == SPECIAL_INFANTRY_CAPTURE_BUILDING ) { //Issue the capture building command - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2238,7 +2238,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2274,7 +2274,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_BLACKLOTUS_STEAL_CASH_HACK ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2310,7 +2310,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, SpecialPowerType spType = command->getSpecialPowerTemplate()->getSpecialPowerType(); if( spType == SPECIAL_HACKER_DISABLE_BUILDING ) { - msgType = issueSpecialPowerCommand( command, type, draw, pos, NULL ); + msgType = issueSpecialPowerCommand( command, type, draw, pos, nullptr ); break; } } @@ -2348,7 +2348,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, } #endif // ******************************************************************************************** - else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, NULL, InGameUI::SELECTION_ALL, FALSE )) + else if ( !draw && TheInGameUI->canSelectedObjectsDoAction( InGameUI::ACTIONTYPE_SET_RALLY_POINT, nullptr, InGameUI::SELECTION_ALL, FALSE )) { msgType = GameMessage::MSG_SET_RALLY_POINT; @@ -2404,8 +2404,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, const DrawableList *allSelectedDrawables = TheInGameUI->getAllSelectedDrawables(); for( DrawableList::const_iterator it = allSelectedDrawables->begin(); it != allSelectedDrawables->end(); ++it ) { - Object *obj = (*it) ? (*it)->getObject() : NULL; - AIUpdateInterface *ai = obj ? obj->getAI() : NULL; + Object *obj = (*it) ? (*it)->getObject() : nullptr; + AIUpdateInterface *ai = obj ? obj->getAI() : nullptr; if( ai ) { if ( ai->isQuickPathAvailable( pos ) ) @@ -2438,7 +2438,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, // to do. Therefore, lets not issue a move command, and instead we'll return that there // wasn't a command for us to perform. - if ( draw == NULL ) + if ( draw == nullptr ) msgType = issueMoveToLocationCommand( pos, drawableInWay, type ); } else @@ -2519,7 +2519,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through backwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; // if nothing is selected @@ -2528,11 +2528,11 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheInGameUI->getSelectCount() == 0 ) { // get the last drawable - for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } // temp is the last drawable - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2560,7 +2560,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; Bool hack = FALSE; Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); Object *selectedObject = selectedDrawable->getObject(); @@ -2577,9 +2577,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage hack = FALSE; } // if temp is null, set it to the last drawable and loop back to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { - for(temp = selectedDrawable; temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for(temp = selectedDrawable; temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } hack = TRUE; @@ -2597,7 +2597,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2629,7 +2629,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through forwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2638,7 +2638,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { // get the first drawable temp = TheGameClient->firstDrawable(); - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2666,7 +2666,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; TheGameClient->getDrawableList(); Bool hack = FALSE; // takes care of when for loop skips firstdrawable Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); @@ -2688,7 +2688,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } // if temp is null, set it to the first drawable and loop forward to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { temp = TheGameClient->firstDrawable(); hack = TRUE; @@ -2713,7 +2713,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2746,7 +2746,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through backwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2754,11 +2754,11 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if( TheInGameUI->getSelectCount() == 0 ) { // get the last drawable - for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for( temp = TheGameClient->firstDrawable(); temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } // temp is the last drawable - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2789,7 +2789,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; Bool hack = FALSE; Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); Object *selectedObject = selectedDrawable->getObject(); @@ -2806,9 +2806,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage hack = FALSE; } // if temp is null, set it to the last drawable and loop back to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { - for(temp = selectedDrawable; temp->getNextDrawable() != NULL; temp = temp->getNextDrawable() ) + for(temp = selectedDrawable; temp->getNextDrawable() != nullptr; temp = temp->getNextDrawable() ) { } hack = TRUE; @@ -2826,7 +2826,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2856,7 +2856,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* because list is prepended, iterate through forwards */ // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Drawable *temp; @@ -2865,7 +2865,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { // get the first drawable temp = TheGameClient->firstDrawable(); - for( temp; temp != NULL; temp = temp->getPrevDrawable() ) + for( temp; temp != nullptr; temp = temp->getPrevDrawable() ) { const Object *object = temp->getObject(); // if you've reached the end of the list, don't select anything @@ -2893,7 +2893,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } else { - Drawable *newDrawable = NULL; + Drawable *newDrawable = nullptr; TheGameClient->getDrawableList(); Bool hack = FALSE; // takes care of when for loop skips firstdrawable Drawable *selectedDrawable = TheInGameUI->getFirstSelectedDrawable(); @@ -2915,7 +2915,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } // if temp is null, set it to the first drawable and loop forward to selected drawable - if( temp == NULL ) + if( temp == nullptr ) { temp = TheGameClient->firstDrawable(); hack = TRUE; @@ -2941,7 +2941,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } } //if there is another selectable unit, select it - if(newDrawable != NULL ) + if(newDrawable != nullptr ) { //deselect other units TheInGameUI->deselectAllDrawables(); @@ -2981,12 +2981,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_SELECT_HERO: { // if there is nothing on the screen, bail - if( TheGameClient->firstDrawable() == NULL ) + if( TheGameClient->firstDrawable() == nullptr ) break; Object *hero = iNeedAHero(); - if ( hero == NULL ) + if ( hero == nullptr ) break; if ( hero->isContained() ) @@ -2994,7 +2994,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage Drawable *heroDraw = hero->getDrawable(); - if ( heroDraw == NULL ) + if ( heroDraw == nullptr ) break; TheInGameUI->deselectAllDrawables(); @@ -3369,7 +3369,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheWindowManager) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) hide = !window->winIsHidden(); @@ -3389,7 +3389,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (Player *observedPlayer = TheControlBar->getObservedPlayer()) { // Set no observed player. - rts::changeObservedPlayer(NULL); + rts::changeObservedPlayer(nullptr); // But keep the look-at player. TheControlBar->setObserverLookAtPlayer(lookAtPlayer); } @@ -3880,9 +3880,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // case we want to turn off the pick hint. // if (TheInGameUI->isInForceAttackMode()) { - evaluateForceAttack( NULL, &position, DO_HINT ); + evaluateForceAttack( nullptr, &position, DO_HINT ); } else { - evaluateContextCommand( NULL, &position, DO_HINT ); + evaluateContextCommand( nullptr, &position, DO_HINT ); } // Do not eat this message, as it will do something itself at HintSpy @@ -3919,7 +3919,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //via the deselect drawable code. if( TheMouse->isClick(&m_mouseRightDragAnchor, &m_mouseRightDragLift, m_mouseRightDown, m_mouseRightUp) ) { - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } break; @@ -3958,7 +3958,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Issue move command to all currently selected objects. // sanity - if( TheTacticalView == NULL ) + if( TheTacticalView == nullptr ) break; // translate from screen coordinates to terrain coords @@ -3976,10 +3976,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage (PickType) pickType); // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands - Object* obj = draw ? draw->getObject() : NULL; + Object* obj = draw ? draw->getObject() : nullptr; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) { - draw = NULL; + draw = nullptr; } if (TheInGameUI->isInForceAttackMode()) { @@ -4025,7 +4025,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage // Issue move command to all currently selected objects. // sanity - if( TheTacticalView == NULL ) + if( TheTacticalView == nullptr ) break; // translate from screen coordinates to terrain coords @@ -4055,10 +4055,10 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage (PickType) pickType); // TheSuperHackers @bugfix Stubbjax 07/08/2025 Prevent dead units blocking positional context commands - Object* obj = draw ? draw->getObject() : NULL; + Object* obj = draw ? draw->getObject() : nullptr; if (!obj || (obj->isEffectivelyDead() && !obj->isKindOf(KINDOF_ALWAYS_SELECTABLE))) { - draw = NULL; + draw = nullptr; } if (TheInGameUI->isInForceAttackMode()) { @@ -4210,7 +4210,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage /* if (TheWindowManager && TheNameKeyGenerator) { - GameWindow *motd = TheWindowManager->winGetWindowFromId(NULL, (Int)TheNameKeyGenerator->nameToKey("MOTD.wnd:MOTD")); + GameWindow *motd = TheWindowManager->winGetWindowFromId(nullptr, (Int)TheNameKeyGenerator->nameToKey("MOTD.wnd:MOTD")); if (motd) motd->winHide(!motd->winIsHidden()); }*/ @@ -4260,7 +4260,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheWindowManager) { Int id = (Int)TheNameKeyGenerator->nameToKey("ControlBar.wnd:ControlBarParent"); - GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr, id); if (window) hide = !window->winIsHidden(); @@ -4646,7 +4646,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_LOCK_CAMERA_TO_SELECTION: { ObjectID id = INVALID_ID; - Drawable *d = NULL; + Drawable *d = nullptr; for (d = TheGameClient->firstDrawable(); d; d = d->getNextDrawable()) { if (d->isSelected() && d->getObject()) @@ -4660,13 +4660,13 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheTacticalView->getCameraLockDrawable()) { id = INVALID_ID; // toggle it - d=NULL; + d=nullptr; TheTacticalView->forceRedraw(); //reset camera to normal } } else { - d = NULL; + d = nullptr; } TheTacticalView->setCameraLock(id); TheTacticalView->setCameraLockDrawable(d); @@ -4977,7 +4977,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGlobalData->m_showMetrics) { TheDisplay->setDebugDisplayCallback(StatMetricsDisplay); } else { - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); } break; } @@ -5124,7 +5124,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { line = "Objects are:"; TheScriptEngine->AppendDebugMessage(line, FALSE); - pPlayer->iterateObjects( printObjects, NULL ); + pPlayer->iterateObjects( printObjects, nullptr ); } } disp = DESTROY_MESSAGE; @@ -5135,7 +5135,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEBUG_TOGGLE_NETWORK: { - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { TheNetwork->toggleNetworkOn(); } disp = DESTROY_MESSAGE; @@ -5147,7 +5147,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_PARTICLEDEBUG: { if (TheDisplay->getDebugDisplayCallback() == ParticleSystemDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(ParticleSystemDebugDisplay); disp = DESTROY_MESSAGE; @@ -5274,7 +5274,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { if (TheGameLogic->isInGame()) { - if(TheInGameUI->cameoVideoBuffer() == NULL) + if(TheInGameUI->cameoVideoBuffer() == nullptr) TheInGameUI->playCameoMovie("CameoMovie"); else TheInGameUI->stopCameoMovie(); @@ -5409,7 +5409,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_DEBUG_STATS: { if (TheDisplay->getDebugDisplayCallback() == StatDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(StatDebugDisplay); disp = DESTROY_MESSAGE; @@ -5544,7 +5544,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_TOGGLE_AUDIODEBUG: { if (TheDisplay->getDebugDisplayCallback() == AudioDebugDisplay) - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); else TheDisplay->setDebugDisplayCallback(AudioDebugDisplay); disp = DESTROY_MESSAGE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp index 2479b0d89e7..b97895d35ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp @@ -60,8 +60,8 @@ enum CommandStatus PickAndPlayInfo::PickAndPlayInfo() { m_air = FALSE; - m_drawTarget = NULL; - m_weaponSlot = NULL; + m_drawTarget = nullptr; + m_weaponSlot = nullptr; m_specialPowerType = SPECIAL_INVALID; } @@ -84,7 +84,7 @@ GUICommandTranslator::~GUICommandTranslator() //------------------------------------------------------------------------------------------------- static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *command, PickType pickType ) { - Object *pickObj = NULL; + Object *pickObj = nullptr; // pick a drawable at the mouse location Drawable *pick = TheTacticalView->pickDrawable( mouse, FALSE, pickType ); @@ -98,7 +98,7 @@ static Object *validUnderCursor( const ICoord2D *mouse, const CommandButton *com pickObj = pick->getObject(); if (!command->isValidObjectTarget(player, pickObj)) - pickObj = NULL; + pickObj = nullptr; } @@ -113,7 +113,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -126,7 +126,7 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // get object id @@ -206,15 +206,15 @@ static CommandStatus doFireWeaponCommand( const CommandButton *command, const IC static CommandStatus doGuardCommand( const CommandButton *command, GuardMode guardMode, const ICoord2D *mouse ) { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; if( TheInGameUI->getSelectCount() == 0 ) return COMMAND_COMPLETE; - GameMessage *msg = NULL; + GameMessage *msg = nullptr; - if ( msg == NULL && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) + if ( msg == nullptr && BitIsSet( command->getOptions(), COMMAND_OPTION_NEED_OBJECT_TARGET ) ) { // get the target object under the cursor Object* target = validUnderCursor( mouse, command, PICK_TYPE_SELECTABLE ); @@ -227,7 +227,7 @@ static CommandStatus doGuardCommand( const CommandButton *command, GuardMode gua } } - if( msg == NULL ) + if( msg == nullptr ) { Coord3D world; if (BitIsSet( command->getOptions(), NEED_TARGET_POS )) @@ -238,7 +238,7 @@ static CommandStatus doGuardCommand( const CommandButton *command, GuardMode gua else { Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; world = *draw->getObject()->getPosition(); } @@ -261,7 +261,7 @@ static CommandStatus doAttackMoveCommand( const CommandButton *command, const IC { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -272,7 +272,7 @@ static CommandStatus doAttackMoveCommand( const CommandButton *command, const IC DEBUG_ASSERTCRASH( draw, ("doAttackMoveCommand: No selected object(s)") ); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -298,7 +298,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // @@ -311,7 +311,7 @@ static CommandStatus doSetRallyPointCommand( const CommandButton *command, const DEBUG_ASSERTCRASH( draw, ("doSetRallyPointCommand: No selected object") ); // sanity - if( draw == NULL || draw->getObject() == NULL ) + if( draw == nullptr || draw->getObject() == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -334,7 +334,7 @@ static CommandStatus doPlaceBeacon( const CommandButton *command, const ICoord2D { // sanity - if( command == NULL || mouse == NULL ) + if( command == nullptr || mouse == nullptr ) return COMMAND_COMPLETE; // convert mouse point to world coords @@ -357,7 +357,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess // only pay attention to clicks in this translator if there is a pending GUI command const CommandButton *command = TheInGameUI->getGUICommand(); - if( command == NULL ) + if( command == nullptr ) return disp; switch( msg->getType() ) @@ -489,7 +489,7 @@ GameMessageDisposition GUICommandTranslator::translateGameMessage(const GameMess if( commandStatus == COMMAND_COMPLETE ) { TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( TRUE ); - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp index 9e8ffd3a1c6..651512e4436 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp @@ -112,7 +112,7 @@ GameMessageDisposition HotKeyTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------- HotKey::HotKey() { - m_win = NULL; + m_win = nullptr; m_key.clear(); } @@ -223,7 +223,7 @@ AsciiString HotKeyManager::searchHotKey( const UnicodeString& uStr ) } //----------------------------------------------------------------------------- -HotKeyManager *TheHotKeyManager = NULL; +HotKeyManager *TheHotKeyManager = nullptr; //----------------------------------------------------------------------------- // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp index 6168f28233a..bfff012cbbd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp @@ -53,7 +53,7 @@ #include "Common/GlobalData.h" // for camera pitch angle only -LookAtTranslator *TheLookAtTranslator = NULL; +LookAtTranslator *TheLookAtTranslator = nullptr; enum { @@ -157,7 +157,7 @@ LookAtTranslator::LookAtTranslator() : LookAtTranslator::~LookAtTranslator() { if (TheLookAtTranslator == this) - TheLookAtTranslator = NULL; + TheLookAtTranslator = nullptr; } const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) @@ -166,7 +166,7 @@ const ICoord2D* LookAtTranslator::getRMBScrollAnchor(void) { return &m_anchor; } - return NULL; + return nullptr; } Bool LookAtTranslator::hasMouseMovedRecently( void ) @@ -670,12 +670,12 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage #if defined(RTS_DEBUG) case GameMessage::MSG_META_DEMO_LOCK_CAMERA_TO_PLANES: { - Drawable *first = NULL; + Drawable *first = nullptr; if (m_lastPlaneID) first = TheGameClient->findDrawableByID( m_lastPlaneID ); - if (first == NULL) + if (first == nullptr) first = TheGameClient->firstDrawable(); if (first) @@ -687,7 +687,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage { // get next Drawable, wrapping around to head of list if necessary d = d->getNextDrawable(); - if (d == NULL) + if (d == nullptr) d = TheGameClient->firstDrawable(); // if we've found an airborne object, lock onto it @@ -700,10 +700,10 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage Bool doLock = true; // but don't lock onto projectiles - ProjectileUpdateInterface* pui = NULL; + ProjectileUpdateInterface* pui = nullptr; for (BehaviorModule** u = d->getObject()->getBehaviorModules(); *u; ++u) { - if ((pui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((pui = (*u)->getProjectileUpdateInterface()) != nullptr) { doLock = false; break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 7c347eff727..9d9df747c00 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -61,7 +61,7 @@ #include "GameClient/Keyboard.h" #endif -MetaMap *TheMetaMap = NULL; +MetaMap *TheMetaMap = nullptr; @@ -350,7 +350,7 @@ static const LookupListRec GameMessageMetaTypeNames[] = #endif//DUMP_PERF_STATS - { NULL, 0 } + { nullptr, 0 } }; @@ -365,10 +365,10 @@ static const FieldParse TheMetaMapFieldParseTable[] = { "Modifiers", INI::parseLookupList, ModifierNames, offsetof( MetaMapRec, m_modState ) }, { "UseableIn", INI::parseBitString32, TheCommandUsableInNames, offsetof( MetaMapRec, m_usableIn ) }, { "Category", INI::parseLookupList, CategoryListName, offsetof( MetaMapRec, m_category ) }, - { "Description", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_description ) }, - { "DisplayName", INI::parseAndTranslateLabel, 0, offsetof( MetaMapRec, m_displayName ) }, + { "Description", INI::parseAndTranslateLabel, nullptr, offsetof( MetaMapRec, m_description ) }, + { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( MetaMapRec, m_displayName ) }, - { NULL, NULL, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -656,7 +656,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa //------------------------------------------------------------------------------------------------- MetaMap::MetaMap() : - m_metaMaps(NULL) + m_metaMaps(nullptr) { } @@ -718,7 +718,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t) throw INI_INVALID_DATA; MetaMapRec *map = TheMetaMap->getMetaMapRec(t); - if (map == NULL) + if (map == nullptr) throw INI_INVALID_DATA; ini->initFromINI(map, TheMetaMapFieldParseTable); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index 97f9b76ce93..0d6999bbd98 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -89,10 +89,10 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess Object *builderObject = TheGameLogic->findObjectByID( TheInGameUI->getPendingPlaceSourceObjectID() ); // if our source object is gone cancel this whole placement process - if( builderObject == NULL ) + if( builderObject == nullptr ) { - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); break; } @@ -209,11 +209,11 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess break; } // get out of pending placement mode, this will also clear the arrow anchor status - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); break; } - DEBUG_ASSERTCRASH(builderObj != NULL, ("builderObj is NULL")); + DEBUG_ASSERTCRASH(builderObj != nullptr, ("builderObj is null")); // check to see if this is a legal location to build something at LegalBuildCode lbc; @@ -227,7 +227,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess BuildAssistant::SHROUD_REVEALED | BuildAssistant::IGNORE_STEALTHED | BuildAssistant::FAIL_STEALTHED_WITHOUT_FEEDBACK, - builderObj, NULL ); + builderObj, nullptr ); if( lbc == LBC_OK ) { //Are we building this structure via the special power system? (special case for sneak attack) @@ -251,7 +251,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess placeMsg->appendObjectIDArgument( builderObj->getID() ); //The source object responsible for firing the special. // get out of pending placement mode, this will also clear the arrow anchor status - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); // used the input disp = DESTROY_MESSAGE; @@ -282,7 +282,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess pickAndPlayUnitVoiceResponse( TheInGameUI->getAllSelectedDrawables(), placeMsg->getType() ); // get out of pending placement mode, this will also clear the arrow anchor status - TheInGameUI->placeBuildAvailable( NULL, NULL ); + TheInGameUI->placeBuildAvailable( nullptr, nullptr ); } else @@ -300,7 +300,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess TheAudio->addAudioEvent( &noCanDoSound ); // unhook the anchor so they can try again - TheInGameUI->setPlacementStart( NULL ); + TheInGameUI->setPlacementStart( nullptr ); } @@ -331,7 +331,7 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess // if we have moved far enough away from the start point // ICoord2D start; - TheInGameUI->getPlacementPoints( &start, NULL ); + TheInGameUI->getPlacementPoints( &start, nullptr ); Int x, y; x = mouse.x - start.x; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index d4eb2977717..2c2e39d2bf2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -75,7 +75,7 @@ static Bool TheDebugSelectionMode = false; static Bool currentlyLookingForSelection( ) { // This needs to check if we are currently targetting for special weapons fire. - return TheInGameUI->getGUICommand() == NULL; + return TheInGameUI->getGUICommand() == nullptr; } //----------------------------------------------------------------------------- @@ -151,7 +151,7 @@ Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting ) } // ignore objects obscured by the GUI - GameWindow *window = NULL; + GameWindow *window = nullptr; if (TheWindowManager) { const Coord3D *c = draw->getPosition(); @@ -243,7 +243,7 @@ static Bool selectSingleDrawableWithoutSound( Drawable *draw ) TheInGameUI->selectDrawable( draw ); Object *obj = draw->getObject(); - if (obj != NULL) { + if (obj != nullptr) { GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_CREATE_SELECTED_GROUP_NO_SOUND); msg->appendBooleanArgument(TRUE); msg->appendObjectIDArgument(obj->getID()); @@ -253,7 +253,7 @@ static Bool selectSingleDrawableWithoutSound( Drawable *draw ) } -SelectionTranslator *TheSelectionTranslator = NULL; +SelectionTranslator *TheSelectionTranslator = nullptr; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -378,7 +378,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //Turn off drag select m_dragSelecting = FALSE; TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); TheTacticalView->setMouseLock( FALSE ); } return KEEP_MESSAGE; @@ -445,7 +445,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa UnsignedInt pickType = getPickTypesForContext( true /*TheInGameUI->isInForceAttackMode()*/ ); Drawable *underCursor = TheTacticalView->pickDrawable( &pixel, TheInGameUI->isInForceAttackMode(), (PickType) pickType ); - Object *objUnderCursor = underCursor ? underCursor->getObject() : NULL; + Object *objUnderCursor = underCursor ? underCursor->getObject() : nullptr; if( objUnderCursor && (!objUnderCursor->isEffectivelyDead() || objUnderCursor->isKindOf( KINDOF_ALWAYS_SELECTABLE )) ) { @@ -485,7 +485,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa Drawable *picked = TheTacticalView->pickDrawable( ®ion.lo, FALSE, PICK_TYPE_SELECTABLE); // If there wasn't anyone to pick, then we want to propagate this double click. - if (picked == NULL) + if (picked == nullptr) break; if (!picked->isMassSelectable()) @@ -496,7 +496,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // We have to have an object in order to be able to do interesting double click stuff on // him. Also, if it is a structure, it is already selected, so don't select all the units // like him. - if (pickedObj == NULL || !pickedObj->isLocallyControlled()) + if (pickedObj == nullptr || !pickedObj->isLocallyControlled()) break; // Ok. The logic is a little bit weird here. What we need to do is deselect everything @@ -726,7 +726,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // If this was a point, shift was pressed and we already have that unit selected, then we // need to deselect those units. GameMessage *newMsg = TheMessageStream->appendMessage(GameMessage::MSG_REMOVE_FROM_SELECTED_GROUP); - Drawable *draw = NULL; + Drawable *draw = nullptr; DrawableListIt it; for (it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) { @@ -759,7 +759,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa Player *localPlayer = ThePlayerList->getLocalPlayer(); Int newDrawablesSelected = 0; - Drawable *draw = NULL; + Drawable *draw = nullptr; DrawableListIt it; for (it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) { @@ -775,13 +775,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa continue; } - if (obj && obj->getContainedBy() != NULL) + if (obj && obj->getContainedBy() != nullptr) { // we're contained, and so we shouldn't be selectable. continue; } - Drawable *drawToSelect = NULL; + Drawable *drawToSelect = nullptr; ObjectID objToAppend = INVALID_ID; if (si.selectMine && obj->isLocallyControlled()) { @@ -929,7 +929,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa TheTacticalView->setMouseLock( FALSE ); TheInGameUI->setSelecting( FALSE ); - TheInGameUI->endAreaSelectHint(NULL); + TheInGameUI->endAreaSelectHint(nullptr); // insert area selection message into stream GameMessage *dragMsg = TheMessageStream->appendMessage( GameMessage::MSG_AREA_SELECTION ); @@ -999,7 +999,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if( TheInGameUI->getGUICommand() ) { //Cancel GUI command mode... don't deselect units. - TheInGameUI->setGUICommand( NULL ); + TheInGameUI->setGUICommand( nullptr ); //With a GUI command cancel, we want no other behavior. disp = DESTROY_MESSAGE; @@ -1011,7 +1011,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // TheSuperHackers @tweak Stubbjax 08/08/2025 Cancelling building placement no longer deselects the builder. if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { - TheInGameUI->placeBuildAvailable(NULL, NULL); + TheInGameUI->placeBuildAvailable(nullptr, nullptr); TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(FALSE); disp = DESTROY_MESSAGE; TheInGameUI->setScrolling(FALSE); @@ -1046,7 +1046,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa // Assign selected items to a group GameMessage *newmsg = TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_CREATE_TEAM0 + group)); Drawable *drawable = TheGameClient->getDrawableList(); - while (drawable != NULL) + while (drawable != nullptr) { if (drawable->isSelected() && drawable->getObject() && drawable->getObject()->isLocallyControlled()) { @@ -1095,7 +1095,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1120,7 +1120,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1172,7 +1172,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1203,7 +1203,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); @@ -1248,7 +1248,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if (player) { Squad *selectedSquad = player->getHotkeySquad(group); - if (selectedSquad != NULL) + if (selectedSquad != nullptr) { VecObjectPtr objlist = selectedSquad->getLiveObjects(); Int numObjs = objlist.size(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index 29d30e28731..9a4b5ac02bf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -203,7 +203,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage ICoord2D mousePos = TheMouse->getMouseStatus()->pos; if( TheWindowManager ) - TheWindowManager->winProcessMouseEvent( GWM_NONE, &mousePos, NULL ); + TheWindowManager->winProcessMouseEvent( GWM_NONE, &mousePos, nullptr ); // Force it to keep the message, regardless of what the window thinks it did with the input. return KEEP_MESSAGE; @@ -239,7 +239,7 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage // process the mouse event position GameWindowMessage gwm = rawMouseToWindowMessage( msg ); if( TheWindowManager ) - returnCode = TheWindowManager->winProcessMouseEvent( gwm, &mousePos, NULL ); + returnCode = TheWindowManager->winProcessMouseEvent( gwm, &mousePos, nullptr ); if( TheShell && TheShell->isShellActive() ) returnCode = WIN_INPUT_USED; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp index 0bc882eae48..c7863220aaf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp @@ -54,9 +54,9 @@ void RadiusDecalTemplate::createRadiusDecal(const Coord3D& pos, Real radius, con { result.clear(); - if (owningPlayer == NULL) + if (owningPlayer == nullptr) { - DEBUG_CRASH(("You MUST specify a non-NULL owningPlayer to createRadiusDecal. (srj)")); + DEBUG_CRASH(("You MUST specify a non-null owningPlayer to createRadiusDecal. (srj)")); return; } @@ -114,14 +114,14 @@ void RadiusDecalTemplate::xferRadiusDecalTemplate( Xfer *xfer ) { static const FieldParse dataFieldParse[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( RadiusDecalTemplate, m_name ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( RadiusDecalTemplate, m_name ) }, { "Style", INI::parseBitString32, TheShadowNames, offsetof( RadiusDecalTemplate, m_shadowType ) }, - { "OpacityMin", INI::parsePercentToReal, NULL, offsetof( RadiusDecalTemplate, m_minOpacity ) }, - { "OpacityMax", INI::parsePercentToReal, NULL, offsetof( RadiusDecalTemplate, m_maxOpacity) }, - { "OpacityThrobTime", INI::parseDurationUnsignedInt,NULL, offsetof( RadiusDecalTemplate, m_opacityThrobTime ) }, - { "Color", INI::parseColorInt, NULL, offsetof( RadiusDecalTemplate, m_color ) }, - { "OnlyVisibleToOwningPlayer", INI::parseBool, NULL, offsetof( RadiusDecalTemplate, m_onlyVisibleToOwningPlayer ) }, - { 0, 0, 0, 0 } + { "OpacityMin", INI::parsePercentToReal, nullptr, offsetof( RadiusDecalTemplate, m_minOpacity ) }, + { "OpacityMax", INI::parsePercentToReal, nullptr, offsetof( RadiusDecalTemplate, m_maxOpacity) }, + { "OpacityThrobTime", INI::parseDurationUnsignedInt,nullptr, offsetof( RadiusDecalTemplate, m_opacityThrobTime ) }, + { "Color", INI::parseColorInt, nullptr, offsetof( RadiusDecalTemplate, m_color ) }, + { "OnlyVisibleToOwningPlayer", INI::parseBool, nullptr, offsetof( RadiusDecalTemplate, m_onlyVisibleToOwningPlayer ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(store, dataFieldParse); @@ -129,16 +129,16 @@ void RadiusDecalTemplate::xferRadiusDecalTemplate( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ RadiusDecal::RadiusDecal() : - m_template(NULL), - m_decal(NULL), + m_template(nullptr), + m_decal(nullptr), m_empty(true) { } // ------------------------------------------------------------------------------------------------ RadiusDecal::RadiusDecal(const RadiusDecal& that) : - m_template(NULL), - m_decal(NULL), + m_template(nullptr), + m_decal(nullptr), m_empty(true) { DEBUG_CRASH(("not fully implemented")); @@ -149,10 +149,10 @@ RadiusDecal& RadiusDecal::operator=(const RadiusDecal& that) { if (this != &that) { - m_template = NULL; + m_template = nullptr; if (m_decal) m_decal->release(); - m_decal = NULL; + m_decal = nullptr; m_empty = true; DEBUG_CRASH(("not fully implemented")); } @@ -172,12 +172,12 @@ void RadiusDecal::xferRadiusDecal( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void RadiusDecal::clear() { - m_template = NULL; + m_template = nullptr; if (m_decal) { m_decal->release(); } - m_decal = NULL; + m_decal = nullptr; m_empty = true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index e2f1a26cee3..cfb37555f6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -63,7 +63,7 @@ SelectionInfo::SelectionInfo() : { } //------------------------------------------------------------------------------------------------- -PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL), isPointSelection(FALSE) +PickDrawableStruct::PickDrawableStruct() : drawableListToFill(nullptr), isPointSelection(FALSE) { forceAttackMode = TheInGameUI->isInForceAttackMode(); UnsignedInt pickType = getPickTypesForContext(forceAttackMode); @@ -126,10 +126,10 @@ extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedD } } - Drawable *newMine = NULL; - Drawable *newFriendly = NULL; - Drawable *newEnemy = NULL; - Drawable *newCivilian = NULL; + Drawable *newMine = nullptr; + Drawable *newFriendly = nullptr; + Drawable *newEnemy = nullptr; + Drawable *newCivilian = nullptr; for (it = newlySelectedDrawables->begin(); it != newlySelectedDrawables->end(); ++it) { if (!(*it)) { @@ -253,7 +253,7 @@ UnsignedInt getPickTypesForContext( Bool forceAttackMode ) // const CommandButton *command = TheInGameUI->getGUICommand(); - if (command != NULL) { + if (command != nullptr) { if (BitIsSet( command->getOptions(), ALLOW_MINE_TARGET)) { types |= PICK_TYPE_MINES; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index cabff15a158..34de5af2b15 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -40,7 +40,7 @@ // GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -Anim2DCollection *TheAnim2DCollection = NULL; +Anim2DCollection *TheAnim2DCollection = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,12 +52,12 @@ Anim2DTemplate::Anim2DTemplate( AsciiString name ) { m_name = name; - m_images = NULL; + m_images = nullptr; m_numFrames = NUM_FRAMES_INVALID; m_framesBetweenUpdates = 0; m_animMode = ANIM_2D_LOOP; m_randomizeStartFrame = FALSE; - m_nextTemplate = NULL; + m_nextTemplate = nullptr; } @@ -76,13 +76,13 @@ Anim2DTemplate::~Anim2DTemplate( void ) const FieldParse Anim2DTemplate::s_anim2DFieldParseTable[] = { - { "NumberImages", Anim2DTemplate::parseNumImages, NULL, 0 }, - { "Image", Anim2DTemplate::parseImage, NULL, 0 }, - { "ImageSequence", Anim2DTemplate::parseImageSequence, NULL, 0 }, + { "NumberImages", Anim2DTemplate::parseNumImages, nullptr, 0 }, + { "Image", Anim2DTemplate::parseImage, nullptr, 0 }, + { "ImageSequence", Anim2DTemplate::parseImageSequence, nullptr, 0 }, { "AnimationMode", INI::parseIndexList, Anim2DModeNames, offsetof( Anim2DTemplate, m_animMode ) }, - { "AnimationDelay", INI::parseDurationUnsignedShort, NULL, offsetof( Anim2DTemplate, m_framesBetweenUpdates ) }, - { "RandomizeStartFrame", INI::parseBool, NULL, offsetof( Anim2DTemplate, m_randomizeStartFrame ) }, - { NULL, NULL, NULL, 0 } + { "AnimationDelay", INI::parseDurationUnsignedShort, nullptr, offsetof( Anim2DTemplate, m_framesBetweenUpdates ) }, + { "RandomizeStartFrame", INI::parseBool, nullptr, offsetof( Anim2DTemplate, m_randomizeStartFrame ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -127,9 +127,9 @@ void Anim2DTemplate::allocateImages( UnsignedShort numFrames ) // allocate an array to hold the image pointers m_images = NEW const Image *[ m_numFrames ]; // pool[]ify - // set all the images to NULL; + // set all the images to nullptr; for( Int i = 0; i < m_numFrames; ++i ) - m_images[ i ] = NULL; + m_images[ i ] = nullptr; } @@ -144,7 +144,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo ini->parseMappedImage( ini, instance, &image, userData ); // sanity - if( image == NULL ) + if( image == nullptr ) { //We don't care if we're in the builder @@ -210,7 +210,7 @@ void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const vo image = TheMappedImageCollection->findImageByName( imageName ); // sanity - if( image == NULL ) + if( image == nullptr ) { DEBUG_CRASH(( "Anim2DTemplate::parseImageSequence - Image '%s' not found for animation '%s'. Check the number of images specified in INI and also make sure all the actual images exist.", @@ -233,14 +233,14 @@ void Anim2DTemplate::storeImage( const Image *image ) { // sanity - if( image == NULL ) + if( image == nullptr ) return; // search through the image list and store at the next free spot for( Int i = 0; i < m_numFrames; ++i ) { - if( m_images[ i ] == NULL ) + if( m_images[ i ] == nullptr ) { m_images[ i ] = image; @@ -264,8 +264,8 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const { // sanity - DEBUG_ASSERTCRASH( m_images != NULL, - ("Anim2DTemplate::getFrame - Image data is NULL for animation '%s'", + DEBUG_ASSERTCRASH( m_images != nullptr, + ("Anim2DTemplate::getFrame - Image data is null for animation '%s'", getName().str()) ); // sanity @@ -274,7 +274,7 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const DEBUG_CRASH(( "Anim2DTemplate::getFrame - Illegal frame number '%d' for animation '%s'", frameNumber, getName().str() )); - return NULL; + return nullptr; } else @@ -296,7 +296,7 @@ const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem ) { // sanity - DEBUG_ASSERTCRASH( animTemplate != NULL, ("Anim2D::Anim2D - NULL template") ); + DEBUG_ASSERTCRASH( animTemplate != nullptr, ("Anim2D::Anim2D - null template") ); m_currentFrame = 0; @@ -318,8 +318,8 @@ Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem m_framesBetweenUpdates = m_template->getNumFramesBetweenUpdates(); // we register ourselves to the System - m_collectionSystemNext = NULL; - m_collectionSystemPrev = NULL; + m_collectionSystemNext = nullptr; + m_collectionSystemPrev = nullptr; m_lastUpdateFrame = 0; @@ -347,10 +347,10 @@ void Anim2D::setCurrentFrame( UnsignedShort frame ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); // sanity - DEBUG_ASSERTCRASH( TheGameLogic != NULL, + DEBUG_ASSERTCRASH( TheGameLogic != nullptr, ("Anim2D::setCurrentFrame - TheGameLogic must exist to use animation instances (%s)", m_template->getName().str()) ); @@ -374,7 +374,7 @@ void Anim2D::randomizeCurrentFrame( void ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); // set the current frame to a random frame setCurrentFrame( GameClientRandomValue( 0, m_template->getNumFrames() - 1 ) ); @@ -388,7 +388,7 @@ void Anim2D::reset( void ) { // sanity - DEBUG_ASSERTCRASH( m_template != NULL, ("Anim2D::reset - No template for animation") ); + DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); switch( m_template->getAnimMode() ) { @@ -425,7 +425,7 @@ void Anim2D::tryNextFrame( void ) { // sanity - DEBUG_ASSERTCRASH( TheGameLogic != NULL, + DEBUG_ASSERTCRASH( TheGameLogic != nullptr, ("Anim2D::tryNextFrame - TheGameLogic must exist to use animation instances (%s)", m_template->getName().str()) ); @@ -613,7 +613,7 @@ void Anim2D::draw( Int x, Int y ) const Image *image = m_template->getFrame( m_currentFrame ); // sanity - DEBUG_ASSERTCRASH( image != NULL, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", + DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", m_currentFrame, m_template->getName().str()) ); // get the natural width and height of this image @@ -628,7 +628,7 @@ void Anim2D::draw( Int x, Int y ) // frame numbers for animation instances that are registered with a system as the // system will update them during its update phase // - if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) + if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); } @@ -643,7 +643,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) const Image *image = m_template->getFrame( m_currentFrame ); // sanity - DEBUG_ASSERTCRASH( image != NULL, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", + DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", m_currentFrame, m_template->getName().str()) ); @@ -656,7 +656,7 @@ void Anim2D::draw( Int x, Int y, Int width, Int height ) // frame numbers for animation instances that are registered with a system as the // system will update them during its update phase // - if( m_collectionSystem == NULL && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) + if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) tryNextFrame(); } @@ -706,8 +706,8 @@ void Anim2D::xfer( Xfer *xfer ) Anim2DCollection::Anim2DCollection( void ) { - m_templateList = NULL; - m_instanceList = NULL; + m_templateList = nullptr; + m_instanceList = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -716,7 +716,7 @@ Anim2DCollection::~Anim2DCollection( void ) { // there should not be any animation instances registered with us since we're being destroyed - DEBUG_ASSERTCRASH( m_instanceList == NULL, ("Anim2DCollection - instance list is not NULL") ); + DEBUG_ASSERTCRASH( m_instanceList == nullptr, ("Anim2DCollection - instance list is not null") ); // delete all the templates Anim2DTemplate *nextTemplate; @@ -743,7 +743,7 @@ void Anim2DCollection::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, nullptr ); } @@ -783,7 +783,7 @@ Anim2DTemplate *Anim2DCollection::findTemplate( const AsciiString& name ) } - return NULL; // template not found + return nullptr; // template not found } @@ -794,7 +794,7 @@ Anim2DTemplate* Anim2DCollection::getNextTemplate( Anim2DTemplate *animTemplate { return animTemplate->friend_getNextTemplate(); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -823,17 +823,17 @@ void Anim2DCollection::registerAnimation( Anim2D *anim ) { // sanity - if( anim == NULL ) + if( anim == nullptr ) return; // sanity - DEBUG_ASSERTCRASH( anim->m_collectionSystemNext == NULL && - anim->m_collectionSystemPrev == NULL, + DEBUG_ASSERTCRASH( anim->m_collectionSystemNext == nullptr && + anim->m_collectionSystemPrev == nullptr, ("Registering animation instance, instance '%s' is already in a system", anim->getAnimTemplate()->getName().str()) ); // tie to our list - anim->m_collectionSystemPrev = NULL; + anim->m_collectionSystemPrev = nullptr; anim->m_collectionSystemNext = m_instanceList; if( m_instanceList ) m_instanceList->m_collectionSystemPrev = anim; @@ -847,7 +847,7 @@ void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) { // sanity - if( anim == NULL ) + if( anim == nullptr ) return; // if animation is not registered with us do nothing diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index c04aadbe0e7..f9b2863a2c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -63,7 +63,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -CampaignManager *TheCampaignManager = NULL; +CampaignManager *TheCampaignManager = nullptr; @@ -71,14 +71,14 @@ CampaignManager *TheCampaignManager = NULL; const FieldParse CampaignManager::m_campaignFieldParseTable[] = { - { "Mission", CampaignManager::parseMissionPart, NULL, NULL }, - { "FirstMission", INI::parseAsciiString, NULL, offsetof( Campaign, m_firstMission ) }, - { "CampaignNameLabel", INI::parseAsciiString, NULL, offsetof( Campaign, m_campaignNameLabel ) }, - { "FinalVictoryMovie", INI::parseAsciiString, NULL, offsetof( Campaign, m_finalMovieName ) }, - { "IsChallengeCampaign", INI::parseBool, NULL, offsetof( Campaign, m_isChallengeCampaign ) }, - { "PlayerFaction", INI::parseAsciiString, NULL, offsetof( Campaign, m_playerFactionName ) }, + { "Mission", CampaignManager::parseMissionPart, nullptr, 0 }, + { "FirstMission", INI::parseAsciiString, nullptr, offsetof( Campaign, m_firstMission ) }, + { "CampaignNameLabel", INI::parseAsciiString, nullptr, offsetof( Campaign, m_campaignNameLabel ) }, + { "FinalVictoryMovie", INI::parseAsciiString, nullptr, offsetof( Campaign, m_finalMovieName ) }, + { "IsChallengeCampaign", INI::parseBool, nullptr, offsetof( Campaign, m_isChallengeCampaign ) }, + { "PlayerFaction", INI::parseAsciiString, nullptr, offsetof( Campaign, m_playerFactionName ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -167,7 +167,7 @@ Mission *Campaign::newMission( AsciiString name ) Mission *Campaign::getMission( AsciiString missionName ) { if(missionName.isEmpty()) - return NULL; + return nullptr; MissionListIt it; it = m_missions.begin(); // we've reached the end of the campaign @@ -179,7 +179,7 @@ Mission *Campaign::getMission( AsciiString missionName ) ++it; } DEBUG_ASSERTCRASH(FALSE, ("getMission couldn't find %s", missionName.str())); - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -198,7 +198,7 @@ Mission *Campaign::getNextMission( Mission *current) it = m_missions.begin(); // we've reached the end of the campaign if(name.isEmpty()) - return NULL; + return nullptr; while(it != m_missions.end()) { Mission *mission = *it; @@ -207,7 +207,7 @@ Mission *Campaign::getNextMission( Mission *current) ++it; } // DEBUG_ASSERTCRASH(FALSE, ("GetNextMission couldn't find %s", current->m_nextMission.str())); - return NULL; + return nullptr; } @@ -215,8 +215,8 @@ Mission *Campaign::getNextMission( Mission *current) CampaignManager::CampaignManager( void ) { m_campaignList.clear(); - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; m_victorious = FALSE; m_currentRankPoints = 0; m_difficulty = DIFFICULTY_NORMAL; @@ -226,8 +226,8 @@ CampaignManager::CampaignManager( void ) //----------------------------------------------------------------------------- CampaignManager::~CampaignManager( void ) { - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; CampaignListIt it = m_campaignList.begin(); @@ -244,7 +244,7 @@ void CampaignManager::init( void ) { INI ini; // Read from INI all the CampaignManager - ini.loadFileDirectory( "Data\\INI\\Campaign", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Campaign", INI_LOAD_OVERWRITE, nullptr ); } //----------------------------------------------------------------------------- @@ -263,7 +263,7 @@ Mission *CampaignManager::getCurrentMission( void ) Mission *CampaignManager::gotoNextMission( void ) { if (!m_currentCampaign || !m_currentMission) - return NULL; + return nullptr; m_currentMission = m_currentCampaign->getNextMission(m_currentMission); return m_currentMission; @@ -305,14 +305,14 @@ void CampaignManager::setCampaign( AsciiString campaign ) if(camp->m_name.compare(campaign) == 0) { m_currentCampaign = camp; - m_currentMission = camp->getNextMission( NULL ); + m_currentMission = camp->getNextMission( nullptr ); return; } ++it; } // could not find the mission. we are resetting the missions to nothing. - m_currentCampaign = NULL; - m_currentMission = NULL; + m_currentCampaign = nullptr; + m_currentMission = nullptr; m_currentRankPoints = 0; m_difficulty = DIFFICULTY_NORMAL; } @@ -358,23 +358,23 @@ void CampaignManager::parseMissionPart( INI* ini, void *instance, void *store, c { static const FieldParse myFieldParse[] = { - { "Map", INI::parseAsciiString, NULL, offsetof( Mission, m_mapName ) }, - { "NextMission", INI::parseAsciiString, NULL, offsetof( Mission, m_nextMission ) }, - { "IntroMovie", INI::parseAsciiString, NULL, offsetof( Mission, m_movieLabel ) }, - { "ObjectiveLine0", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[0] ) }, - { "ObjectiveLine1", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[1] ) }, - { "ObjectiveLine2", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[2] ) }, - { "ObjectiveLine3", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[3] ) }, - { "ObjectiveLine4", INI::parseAsciiString, NULL, offsetof( Mission, m_missionObjectivesLabel[4] ) }, - { "BriefingVoice", INI::parseAudioEventRTS, NULL, offsetof( Mission, m_briefingVoice ) }, - { "UnitNames0", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[0] ) }, - { "UnitNames1", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[1] ) }, - { "UnitNames2", INI::parseAsciiString, NULL, offsetof( Mission, m_unitNames[2] ) }, - { "GeneralName", INI::parseAsciiString, NULL, offsetof( Mission, m_generalName) }, - { "LocationNameLabel",INI::parseAsciiString, NULL, offsetof( Mission, m_locationNameLabel ) }, - { "VoiceLength", INI::parseInt , NULL, offsetof( Mission, m_voiceLength ) }, - - { NULL, NULL, NULL, 0 } + { "Map", INI::parseAsciiString, nullptr, offsetof( Mission, m_mapName ) }, + { "NextMission", INI::parseAsciiString, nullptr, offsetof( Mission, m_nextMission ) }, + { "IntroMovie", INI::parseAsciiString, nullptr, offsetof( Mission, m_movieLabel ) }, + { "ObjectiveLine0", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[0] ) }, + { "ObjectiveLine1", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[1] ) }, + { "ObjectiveLine2", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[2] ) }, + { "ObjectiveLine3", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[3] ) }, + { "ObjectiveLine4", INI::parseAsciiString, nullptr, offsetof( Mission, m_missionObjectivesLabel[4] ) }, + { "BriefingVoice", INI::parseAudioEventRTS, nullptr, offsetof( Mission, m_briefingVoice ) }, + { "UnitNames0", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[0] ) }, + { "UnitNames1", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[1] ) }, + { "UnitNames2", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[2] ) }, + { "GeneralName", INI::parseAsciiString, nullptr, offsetof( Mission, m_generalName) }, + { "LocationNameLabel",INI::parseAsciiString, nullptr, offsetof( Mission, m_locationNameLabel ) }, + { "VoiceLength", INI::parseInt , nullptr, offsetof( Mission, m_voiceLength ) }, + + { nullptr, nullptr, nullptr, 0 } }; AsciiString name; const char* c = ini->getNextToken(); @@ -460,7 +460,7 @@ void CampaignManager::xfer( Xfer *xfer ) if( isChallengeCampaign ) { - if( TheChallengeGameInfo==NULL ) + if( TheChallengeGameInfo==nullptr ) { TheChallengeGameInfo = NEW SkirmishGameInfo; TheChallengeGameInfo->init(); @@ -472,7 +472,7 @@ void CampaignManager::xfer( Xfer *xfer ) else { delete TheChallengeGameInfo; - TheChallengeGameInfo = NULL; + TheChallengeGameInfo = nullptr; } } @@ -490,7 +490,7 @@ void CampaignManager::xfer( Xfer *xfer ) void CampaignManager::loadPostProcess( void ) { - if(TheChallengeGenerals == NULL) + if(TheChallengeGenerals == nullptr) { DEBUG_CRASH(("TheChallengeGenerals singleton does not exist. This loaded game will not have a working Continue button for GC mode.")); return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index a701c037905..3d9511ed6b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -45,13 +45,13 @@ const FieldParse Image::m_imageFieldParseTable[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof( Image, m_filename ) }, - { "TextureWidth", INI::parseInt, NULL, offsetof( Image, m_textureSize.x ) }, - { "TextureHeight", INI::parseInt, NULL, offsetof( Image, m_textureSize.y ) }, - { "Coords", Image::parseImageCoords, NULL, offsetof( Image, m_UVCoords ) }, - { "Status", Image::parseImageStatus, NULL, offsetof( Image, m_status ) }, + { "Texture", INI::parseAsciiString, nullptr, offsetof( Image, m_filename ) }, + { "TextureWidth", INI::parseInt, nullptr, offsetof( Image, m_textureSize.x ) }, + { "TextureHeight", INI::parseInt, nullptr, offsetof( Image, m_textureSize.y ) }, + { "Coords", Image::parseImageCoords, nullptr, offsetof( Image, m_UVCoords ) }, + { "Status", Image::parseImageStatus, nullptr, offsetof( Image, m_status ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -134,7 +134,7 @@ void Image::parseImageStatus( INI* ini, void *instance, void *store, const void* } // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ImageCollection *TheMappedImageCollection = NULL; ///< mapped images +ImageCollection *TheMappedImageCollection = nullptr; ///< mapped images // PUBLIC FUNCTIONS//////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- @@ -152,7 +152,7 @@ Image::Image( void ) m_UVCoords.hi.y = 1.0f; m_imageSize.x = 0; m_imageSize.y = 0; - m_rawTextureData = NULL; + m_rawTextureData = nullptr; m_status = IMAGE_STATUS_NONE; } @@ -220,7 +220,7 @@ void ImageCollection::addImage( Image *image ) const Image *ImageCollection::findImage( NameKeyType namekey ) const { ImageMap::const_iterator i = m_imageMap.find(namekey); - return i == m_imageMap.end() ? NULL : i->second; + return i == m_imageMap.end() ? nullptr : i->second; } //------------------------------------------------------------------------------------------------- @@ -256,7 +256,7 @@ void ImageCollection::load( Int textureSize ) if(FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) { userDataPath.format("%sINI\\MappedImages",TheGlobalData->getPath_UserData().str()); - ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, nullptr ); } } @@ -265,9 +265,9 @@ void ImageCollection::load( Int textureSize ) // load all the ine files in that directory - ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, nullptr ); - ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, NULL ); + ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, nullptr ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 2cd89f13715..7e0be3c505a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -58,7 +58,7 @@ //------------------------------------------------------------------------------------------------- // the singleton -ParticleSystemManager *TheParticleSystemManager = NULL; +ParticleSystemManager *TheParticleSystemManager = nullptr; /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -299,7 +299,7 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_colorScale = info->m_colorScale; m_inSystemList = m_inOverallList = FALSE; - m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = NULL; + m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr; // add this particle to the global list, retaining particle creation order TheParticleSystemManager->addParticle(this, system->getPriority() ); @@ -324,7 +324,7 @@ Particle::~Particle() m_systemUnderControl->detachControlParticle( this ); m_systemUnderControl->destroy(); } - m_systemUnderControl = NULL; + m_systemUnderControl = nullptr; // remove from the global list TheParticleSystemManager->removeParticle(this); @@ -698,7 +698,7 @@ void Particle::loadPostProcess( void ) controlParticleSystem( system ); // sanity - if( m_systemUnderControlID == NULL ) + if( m_systemUnderControlID == INVALID_PARTICLE_SYSTEM_ID ) { DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); @@ -1023,7 +1023,7 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, ParticleSystemID id, Bool createSlaves ) { - m_systemParticlesHead = m_systemParticlesTail = NULL; + m_systemParticlesHead = m_systemParticlesTail = nullptr; m_isFirstPos = true; m_template = sysTemplate; @@ -1143,8 +1143,8 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, // set up slave particle system, if any m_masterSystemID = INVALID_PARTICLE_SYSTEM_ID; m_slaveSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_masterSystem = NULL; - m_slaveSystem = NULL; + m_masterSystem = nullptr; + m_slaveSystem = nullptr; if( createSlaves ) { ParticleSystem *slaveSystem = sysTemplate->createSlaveSystem(); @@ -1162,7 +1162,7 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, m_attachedSystemName = sysTemplate->m_attachedSystemName; m_particleCount = 0; m_personalityStore = 0; - m_controlParticle = NULL; + m_controlParticle = nullptr; TheParticleSystemManager->friend_addParticleSystem(this); @@ -1180,8 +1180,8 @@ ParticleSystem::~ParticleSystem() { DEBUG_ASSERTCRASH( m_slaveSystem->getMaster() == this, ("~ParticleSystem: Our slave doesn't have us as a master!") ); - m_slaveSystem->setMaster( NULL ); - setSlave( NULL ); + m_slaveSystem->setMaster( nullptr ); + setSlave( nullptr ); } @@ -1190,8 +1190,8 @@ ParticleSystem::~ParticleSystem() { DEBUG_ASSERTCRASH( m_masterSystem->getSlave() == this, ("~ParticleSystem: Our master doesn't have us as a slave!") ); - m_masterSystem->setSlave( NULL ); - setMaster( NULL ); + m_masterSystem->setSlave( nullptr ); + setMaster( nullptr ); } @@ -1207,7 +1207,7 @@ ParticleSystem::~ParticleSystem() if (m_controlParticle) m_controlParticle->detachControlledParticleSystem(); - m_controlParticle = NULL; + m_controlParticle = nullptr; TheParticleSystemManager->friend_removeParticleSystem(this); //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); @@ -1673,7 +1673,7 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, { if (TheGlobalData->m_useFX == FALSE) - return NULL; + return nullptr; // // Enforce particle limit. @@ -1689,10 +1689,10 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, if( priority < TheGameLODManager->getMinDynamicParticlePriority() || (priority < TheGameLODManager->getMinDynamicParticleSkipPriority() && TheGameLODManager->isParticleSkipped()) ) - return NULL; + return nullptr; if ( getParticleCount() > 0 && priority == AREA_EFFECT && m_isGroundAligned && TheParticleSystemManager->getFieldParticleCount() > (UnsignedInt)TheGlobalData->m_maxFieldParticleCount ) - return NULL; + return nullptr; // ALWAYS_RENDER particles are exempt from all count limits, and are always created, regardless of LOD issues. if (priority != ALWAYS_RENDER) @@ -1701,11 +1701,11 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info, if ( numInExcess > 0) { if( TheParticleSystemManager->removeOldestParticles((UnsignedInt) numInExcess, priority) != numInExcess ) - return NULL; // could not remove enough particles, don't create new stuff + return nullptr; // could not remove enough particles, don't create new stuff } if (TheGlobalData->m_maxParticleCount == 0) - return NULL; + return nullptr; } } @@ -1857,7 +1857,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) // matrix so generated particles' are relative to the parent Drawable's // position and orientation Bool transformSet = false; - const Matrix3D *parentXfrm = NULL; + const Matrix3D *parentXfrm = nullptr; Bool isShrouded = false; if (m_attachedToDrawableID) @@ -1976,7 +1976,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) { if (m_isForever || (m_isForever == false && m_systemLifetimeLeft > 0)) { - if (!isShrouded && m_isStopped == false && m_masterSystem == NULL) + if (!isShrouded && m_isStopped == false && m_masterSystem == nullptr) { if (m_burstDelayLeft == 0) { @@ -1995,7 +1995,7 @@ Bool ParticleSystem::update( Int localPlayerIndex ) { // actually create a particle Particle *p = createParticle( info, priority ); - if (p == NULL) + if (p == nullptr) continue; if (m_attachedSystemName.isEmpty() == false) @@ -2242,11 +2242,11 @@ void ParticleSystem::addParticle( Particle *particleToAdd ) } else { - particleToAdd->m_systemPrev = NULL; + particleToAdd->m_systemPrev = nullptr; } m_systemParticlesTail = particleToAdd; - particleToAdd->m_systemNext = NULL; + particleToAdd->m_systemNext = nullptr; particleToAdd->m_inSystemList = TRUE; ++m_particleCount; @@ -2275,7 +2275,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) if (particleToRemove == m_systemParticlesTail) m_systemParticlesTail = particleToRemove->m_systemPrev; - particleToRemove->m_systemNext = particleToRemove->m_systemPrev = NULL; + particleToRemove->m_systemNext = particleToRemove->m_systemPrev = nullptr; particleToRemove->m_inSystemList = FALSE; --m_particleCount; } @@ -2285,7 +2285,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *masterParticleSystem, ParticleSystem *slaveParticleSystem, Bool slaveNeedsFullPromotion) { if (!masterParticleSystem || !slaveParticleSystem) { - DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was NULL. Should not happen. JKMCD")); + DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was null. Should not happen. JKMCD")); ParticleInfo bogus; return bogus; } @@ -2530,10 +2530,10 @@ void ParticleSystem::loadPostProcess( void ) { // sanity - if( m_slaveSystem != NULL ) + if( m_slaveSystem != nullptr ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not NULL but should be" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not null but should be" )); throw SC_INVALID_DATA; } @@ -2542,10 +2542,10 @@ void ParticleSystem::loadPostProcess( void ) m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); // sanity - if( m_slaveSystem == NULL || m_slaveSystem->isDestroyed() == TRUE ) + if( m_slaveSystem == nullptr || m_slaveSystem->isDestroyed() == TRUE ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is NULL or destroyed" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is null or destroyed" )); throw SC_INVALID_DATA; } @@ -2557,10 +2557,10 @@ void ParticleSystem::loadPostProcess( void ) { // sanity - if( m_masterSystem != NULL ) + if( m_masterSystem != nullptr ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not NULL but should be" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not null but should be" )); throw SC_INVALID_DATA; } @@ -2569,10 +2569,10 @@ void ParticleSystem::loadPostProcess( void ) m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); // sanity - if( m_masterSystem == NULL || m_masterSystem->isDestroyed() == TRUE ) + if( m_masterSystem == nullptr || m_masterSystem->isDestroyed() == TRUE ) { - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is NULL or destroyed" )); + DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is null or destroyed" )); throw SC_INVALID_DATA; } @@ -2591,98 +2591,98 @@ void ParticleSystem::loadPostProcess( void ) const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = { { "Priority", INI::parseIndexList, ParticlePriorityNames, offsetof( ParticleSystemTemplate, m_priority ) }, - { "IsOneShot", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isOneShot ) }, + { "IsOneShot", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isOneShot ) }, { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, - { "ParticleName", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, - { "AngleZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angleZ ) }, - { "AngularRateZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, - { "AngularDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularDamping ) }, - - { "VelocityDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_velDamping ) }, - { "Gravity", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_gravity ) }, - { "SlaveSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, - { "SlavePosOffset", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, - { "PerParticleAttachedSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, - - { "Lifetime", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_lifetime ) }, - { "SystemLifetime", INI::parseUnsignedInt, NULL, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, - - { "Size", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSize ) }, - { "StartSizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, - { "SizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRate ) }, - { "SizeRateDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, - - { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, - { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, - { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, - { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, - { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, - { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, - { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, - { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, - - { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, - { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, - { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, - { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, - { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, - { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, - { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, - { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, - -// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, NULL, offsetof( ParticleSystemTemplate, m_color ) }, - { "ColorScale", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_colorScale ) }, - - { "BurstDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstDelay ) }, - { "BurstCount", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstCount ) }, - - { "InitialDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_initialDelay ) }, - - { "DriftVelocity", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, + { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, + { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, + { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, + { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, + + { "VelocityDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_velDamping ) }, + { "Gravity", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_gravity ) }, + { "SlaveSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, + { "SlavePosOffset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, + { "PerParticleAttachedSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, + + { "Lifetime", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_lifetime ) }, + { "SystemLifetime", INI::parseUnsignedInt, nullptr, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, + + { "Size", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSize ) }, + { "StartSizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, + { "SizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRate ) }, + { "SizeRateDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, + + { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, + { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, + { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, + { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, + { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, + { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, + { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, + { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, + + { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, + { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, + { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, + { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, + { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, + { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, + { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, + { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, + +// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, nullptr, offsetof( ParticleSystemTemplate, m_color ) }, + { "ColorScale", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_colorScale ) }, + + { "BurstDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstDelay ) }, + { "BurstCount", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstCount ) }, + + { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_initialDelay ) }, + + { "DriftVelocity", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, { "VelocityType", INI::parseIndexList, EmissionVelocityTypeNames, offsetof( ParticleSystemTemplate, m_emissionVelocityType ) }, - { "VelOrthoX", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, - { "VelOrthoY", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, - { "VelOrthoZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, + { "VelOrthoX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, + { "VelOrthoY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, + { "VelOrthoZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, - { "VelSpherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, - { "VelHemispherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, + { "VelSpherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, + { "VelHemispherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, - { "VelCylindricalRadial", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, - { "VelCylindricalNormal", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, + { "VelCylindricalRadial", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, + { "VelCylindricalNormal", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, - { "VelOutward", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, - { "VelOutwardOther", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, + { "VelOutward", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, + { "VelOutwardOther", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, { "VolumeType", INI::parseIndexList, EmissionVolumeTypeNames, offsetof( ParticleSystemTemplate, m_emissionVolumeType ) }, - { "VolLineStart", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, - { "VolLineEnd", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, + { "VolLineStart", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, + { "VolLineEnd", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, - { "VolBoxHalfSize", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, + { "VolBoxHalfSize", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, - { "VolSphereRadius", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, + { "VolSphereRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, - { "VolCylinderRadius", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, - { "VolCylinderLength", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, + { "VolCylinderRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, + { "VolCylinderLength", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, - { "IsHollow", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, - { "IsGroundAligned", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, - { "IsEmitAboveGroundOnly", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, - { "IsParticleUpTowardsEmitter", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, + { "IsHollow", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, + { "IsGroundAligned", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, + { "IsEmitAboveGroundOnly", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, + { "IsParticleUpTowardsEmitter", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, { "WindMotion", INI::parseIndexList, WindMotionNames, offsetof( ParticleSystemTemplate, m_windMotion ) }, - { "WindAngleChangeMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, - { "WindAngleChangeMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, + { "WindAngleChangeMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, + { "WindAngleChangeMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, - { "WindPingPongStartAngleMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, - { "WindPingPongStartAngleMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, + { "WindPingPongStartAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, + { "WindPingPongStartAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, - { "WindPingPongEndAngleMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, - { "WindPingPongEndAngleMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, + { "WindPingPongEndAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, + { "WindPingPongEndAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, - { NULL, NULL, NULL, 0 }, + { nullptr, nullptr, nullptr, 0 }, }; // ------------------------------------------------------------------------------------------------ @@ -2711,8 +2711,8 @@ void ParticleSystemTemplate::parseRGBColorKeyframe( INI* ini, void *instance, { RGBColorKeyframe *key = static_cast(store); - INI::parseRGBColor( ini, instance, &key->color, NULL ); - INI::parseUnsignedInt( ini, instance, &key->frame, NULL ); + INI::parseRGBColor( ini, instance, &key->color, nullptr ); + INI::parseUnsignedInt( ini, instance, &key->frame, nullptr ); } // ------------------------------------------------------------------------------------------------ @@ -2771,7 +2771,7 @@ void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, ParticleSystemTemplate::ParticleSystemTemplate( const AsciiString &name ) : m_name(name) { - m_slaveTemplate = NULL; + m_slaveTemplate = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -2782,16 +2782,16 @@ ParticleSystemTemplate::~ParticleSystemTemplate() } // ------------------------------------------------------------------------------------------------ -/** If returns non-NULL, it is a slave system for use ... the create slaves parameter +/** If returns non-null, it is a slave system for use ... the create slaves parameter * tells *this* slave system whether or not it should create any slaves itself * automatically during its own constructor */ // ------------------------------------------------------------------------------------------------ ParticleSystem *ParticleSystemTemplate::createSlaveSystem( Bool createSlaves ) const { - if (m_slaveTemplate == NULL && m_slaveSystemName.isEmpty() == false) + if (m_slaveTemplate == nullptr && m_slaveSystemName.isEmpty() == false) m_slaveTemplate = TheParticleSystemManager->findTemplate( m_slaveSystemName ); - ParticleSystem *slave = NULL; + ParticleSystem *slave = nullptr; if (m_slaveTemplate) slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves ); @@ -2820,8 +2820,8 @@ ParticleSystemManager::ParticleSystemManager( void ) for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) { - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -2847,19 +2847,19 @@ void ParticleSystemManager::init( void ) { /// Read INI data and build templates INI ini; - ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, nullptr ); // sanity, our lists must be empty!! for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) { // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == NULL, ("INIT: ParticleSystem all particles head[%d] is not NULL!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == NULL, ("INIT: ParticleSystem all particles tail[%d] is not NULL!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("INIT: ParticleSystem all particles head[%d] is not null!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not null!", i) ); - // just to be clean set them to NULL - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + // just to be clean set them to nullptr + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -2872,7 +2872,7 @@ void ParticleSystemManager::reset( void ) { while (!m_allParticleSystemList.empty()) { - DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != NULL, ("ParticleSystemManager::reset: ParticleSystem is null")); + DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != nullptr, ("ParticleSystemManager::reset: ParticleSystem is null")); deleteInstance(m_allParticleSystemList.front()); } DEBUG_ASSERTCRASH(m_particleSystemCount == 0, ("ParticleSystemManager::reset: m_particleSystemCount is %u, not 0", m_particleSystemCount)); @@ -2882,12 +2882,12 @@ void ParticleSystemManager::reset( void ) { // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == NULL, ("RESET: ParticleSystem all particles head[%d] is not NULL!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == NULL, ("RESET: ParticleSystem all particles tail[%d] is not NULL!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("RESET: ParticleSystem all particles head[%d] is not null!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not null!", i) ); - // just to be clean set them to NULL - m_allParticlesHead[ i ] = NULL; - m_allParticlesTail[ i ] = NULL; + // just to be clean set them to nullptr + m_allParticlesHead[ i ] = nullptr; + m_allParticlesTail[ i ] = nullptr; } @@ -2920,7 +2920,7 @@ void ParticleSystemManager::update( void ) { // TheSuperHackers @info Must increment the list iterator before potential element erasure from the list. ParticleSystem* sys = *it++; - DEBUG_ASSERTCRASH(sys != NULL, ("ParticleSystemManager::update: ParticleSystem is null")); + DEBUG_ASSERTCRASH(sys != nullptr, ("ParticleSystemManager::update: ParticleSystem is null")); if (sys->update(m_localPlayerIndex) == false) { @@ -2943,8 +2943,8 @@ void ParticleSystemManager::setOnScreenParticleCount(int count) ParticleSystem *ParticleSystemManager::createParticleSystem( const ParticleSystemTemplate *sysTemplate, Bool createSlaves ) { // sanity - if (sysTemplate == NULL) - return NULL; + if (sysTemplate == nullptr) + return nullptr; m_uniqueSystemID = (ParticleSystemID)((UnsignedInt)m_uniqueSystemID + 1); ParticleSystem *sys = newInstance(ParticleSystem)( sysTemplate, m_uniqueSystemID, createSlaves ); @@ -2971,20 +2971,20 @@ ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) { if (id == INVALID_PARTICLE_SYSTEM_ID) - return NULL; // my, that was easy + return nullptr; // my, that was easy - ParticleSystem *system = NULL; + ParticleSystem *system = nullptr; for( ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) { system = *it; - DEBUG_ASSERTCRASH(system != NULL, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); + DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); if( system->getSystemID() == id ) { return system; } } - return NULL; + return nullptr; } @@ -3003,7 +3003,7 @@ void ParticleSystemManager::destroyParticleSystemByID(ParticleSystemID id) // ------------------------------------------------------------------------------------------------ ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString &name ) const { - ParticleSystemTemplate *sysTemplate = NULL; + ParticleSystemTemplate *sysTemplate = nullptr; TemplateMap::const_iterator find(m_templateMap.find(name)); if (find != m_templateMap.end()) { @@ -3019,12 +3019,12 @@ ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString & ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &name ) { ParticleSystemTemplate *sysTemplate = findTemplate(name); - if (sysTemplate == NULL) { + if (sysTemplate == nullptr) { sysTemplate = newInstance(ParticleSystemTemplate)( name ); if (! m_templateMap.insert(std::make_pair(name, sysTemplate)).second) { deleteInstance(sysTemplate); - sysTemplate = NULL; + sysTemplate = nullptr; } } @@ -3037,7 +3037,7 @@ ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &n ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiString &name, Int parentNum ) const { if (name.isEmpty()) { - return NULL; + return nullptr; } TemplateMap::const_iterator begin(m_templateMap.begin()); @@ -3051,7 +3051,7 @@ ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiSt } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -3061,7 +3061,7 @@ void ParticleSystemManager::destroyAttachedSystems( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // iterate through all systems @@ -3071,7 +3071,7 @@ void ParticleSystemManager::destroyAttachedSystems( Object *obj ) { ParticleSystem *system = *it; - DEBUG_ASSERTCRASH(system != NULL, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); + DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); if( system->getAttachedObject() == obj->getID() ) system->destroy(); @@ -3100,11 +3100,11 @@ void ParticleSystemManager::addParticle( Particle *particleToAdd, ParticlePriori } else { - particleToAdd->m_overallPrev = NULL; + particleToAdd->m_overallPrev = nullptr; } m_allParticlesTail[ priority ] = particleToAdd; - particleToAdd->m_overallNext = NULL; + particleToAdd->m_overallNext = nullptr; particleToAdd->m_inOverallList = TRUE; ++m_particleCount; @@ -3135,7 +3135,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) if (particleToRemove == m_allParticlesTail[ priority ]) m_allParticlesTail[ priority ] = particleToRemove->m_overallPrev; - particleToRemove->m_overallNext = particleToRemove->m_overallPrev = NULL; + particleToRemove->m_overallNext = particleToRemove->m_overallPrev = nullptr; particleToRemove->m_inOverallList = FALSE; --m_particleCount; @@ -3147,7 +3147,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) // ------------------------------------------------------------------------------------------------ void ParticleSystemManager::friend_addParticleSystem( ParticleSystem *particleSystemToAdd ) { - DEBUG_ASSERTCRASH(particleSystemToAdd != NULL, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); + DEBUG_ASSERTCRASH(particleSystemToAdd != nullptr, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); m_allParticleSystemList.push_back(particleSystemToAdd); ++m_particleSystemCount; } @@ -3288,7 +3288,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) systemTemplate = findTemplate( systemName ); // sanity - if( systemTemplate == NULL ) + if( systemTemplate == nullptr ) { DEBUG_CRASH(( "ParticleSystemManager::xfer - Unknown particle system template '%s'", @@ -3300,7 +3300,7 @@ void ParticleSystemManager::xfer( Xfer *xfer ) // create system system = createParticleSystem( systemTemplate, FALSE ); - if( system == NULL ) + if( system == nullptr ) { DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to allocate particle system '%s'", diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp index fb2a11ab696..8216c25ea54 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp @@ -34,7 +34,7 @@ #include "GameClient/Drawable.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -class RayEffectSystem *TheRayEffects = NULL; +class RayEffectSystem *TheRayEffects = nullptr; // PRIVATE METHODS //////////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ class RayEffectSystem *TheRayEffects = NULL; RayEffectData *RayEffectSystem::findEntry( const Drawable *draw ) { Int i; - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // find the matching effect data entry for( i = 0; i < MAX_RAY_EFFECTS; i++ ) @@ -92,7 +92,7 @@ void RayEffectSystem::init( void ) for( i = 0; i < MAX_RAY_EFFECTS; i++ ) { - m_effectData[ i ].draw = NULL; + m_effectData[ i ].draw = nullptr; m_effectData[ i ].startLoc.zero(); m_effectData[ i ].endLoc.zero(); @@ -119,10 +119,10 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, const Coord3D *endLoc ) { Int i; - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // sanity - if( draw == NULL || startLoc == NULL || endLoc == NULL ) + if( draw == nullptr || startLoc == nullptr || endLoc == nullptr ) return; /** @todo this should be more intelligent and should not be limited @@ -133,7 +133,7 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, for( i = 0; i < MAX_RAY_EFFECTS; i++ ) { - if( m_effectData[ i ].draw == NULL ) + if( m_effectData[ i ].draw == nullptr ) { effectData = &m_effectData[ i ]; @@ -144,7 +144,7 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, } // if no free slots we can't do it - if( effectData == NULL ) + if( effectData == nullptr ) return; // add the data to the entry @@ -159,10 +159,10 @@ void RayEffectSystem::addRayEffect( const Drawable *draw, //------------------------------------------------------------------------------------------------- void RayEffectSystem::deleteRayEffect( const Drawable *draw ) { - RayEffectData *effectData = NULL; + RayEffectData *effectData = nullptr; // sanity - if( draw == NULL ) + if( draw == nullptr ) return; // find the effect entry @@ -171,7 +171,7 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) { // remove the data for this entry - effectData->draw = NULL; + effectData->draw = nullptr; } @@ -184,10 +184,10 @@ void RayEffectSystem::deleteRayEffect( const Drawable *draw ) void RayEffectSystem::getRayEffectData( const Drawable *draw, RayEffectData *effectData ) { - RayEffectData *entry = NULL; + RayEffectData *entry = nullptr; // sanity - if( draw == NULL || effectData == NULL ) + if( draw == nullptr || effectData == nullptr ) return; // find the effect data entry diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 2f4713f51c7..087f324eadc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -65,8 +65,8 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) if (buildList->m_side == info->m_side) { deleteInstance(info->m_buildList); info->m_buildList = buildList->m_buildList; - buildList->m_buildList = NULL; - buildList->m_next = NULL; + buildList->m_buildList = nullptr; + buildList->m_next = nullptr; deleteInstance(buildList); return; } @@ -79,7 +79,7 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList) TAiData::~TAiData() { AISideInfo *info = m_sideInfo; - m_sideInfo = NULL; + m_sideInfo = nullptr; while (info) { AISideInfo *cur = info; info = info->m_next; @@ -87,7 +87,7 @@ TAiData::~TAiData() } AISideBuildList *build = m_sideBuildLists; - m_sideBuildLists = NULL; + m_sideBuildLists = nullptr; while (build) { AISideBuildList *cur = build; build = build->m_next; @@ -101,31 +101,31 @@ TAiData::~TAiData() /////////////////////////////////////////////////////////////////////////////////////////////////// AISideBuildList::AISideBuildList( AsciiString side ) : m_side(side), - m_buildList(NULL), - m_next(NULL) + m_buildList(nullptr), + m_next(nullptr) { } AISideBuildList::~AISideBuildList() { deleteInstance(m_buildList); // note - deletes all in the list. - m_buildList = NULL; + m_buildList = nullptr; } void AISideBuildList::addInfo(BuildListInfo *info) { // Add to the end of the list. - if (m_buildList == NULL) { + if (m_buildList == nullptr) { m_buildList = info; } else { BuildListInfo *cur = m_buildList; while (cur && cur->getNext()) { cur = cur->getNext(); } - DEBUG_ASSERTCRASH(cur && cur->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(cur && cur->getNext()==nullptr, ("Logic error.")); cur->setNextBuildList(info); } - info->setNextBuildList(NULL); // should be at the end of the list. + info->setNextBuildList(nullptr); // should be at the end of the list. } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -134,70 +134,70 @@ void AISideBuildList::addInfo(BuildListInfo *info) static const FieldParse TheAIFieldParseTable[] = { - { "StructureSeconds", INI::parseReal,NULL, offsetof( TAiData, m_structureSeconds ) }, - { "TeamSeconds", INI::parseReal,NULL, offsetof( TAiData, m_teamSeconds ) }, - { "Wealthy", INI::parseInt,NULL, offsetof( TAiData, m_resourcesWealthy ) }, - { "Poor", INI::parseInt,NULL, offsetof( TAiData, m_resourcesPoor ) }, - { "ForceIdleMSEC", INI::parseDurationUnsignedInt,NULL,offsetof( TAiData, m_forceIdleFramesCount ) }, - { "StructuresWealthyRate", INI::parseReal,NULL, offsetof( TAiData, m_structuresWealthyMod ) }, - { "TeamsWealthyRate", INI::parseReal,NULL, offsetof( TAiData, m_teamWealthyMod ) }, - { "StructuresPoorRate", INI::parseReal,NULL, offsetof( TAiData, m_structuresPoorMod ) }, - { "TeamsPoorRate", INI::parseReal,NULL, offsetof( TAiData, m_teamPoorMod ) }, - { "TeamResourcesToStart", INI::parseReal,NULL, offsetof( TAiData, m_teamResourcesToBuild ) }, - { "GuardInnerModifierAI", INI::parseReal,NULL, offsetof( TAiData, m_guardInnerModifierAI ) }, - { "GuardOuterModifierAI", INI::parseReal,NULL, offsetof( TAiData, m_guardOuterModifierAI ) }, - { "GuardInnerModifierHuman",INI::parseReal,NULL, offsetof( TAiData, m_guardInnerModifierHuman ) }, - { "GuardOuterModifierHuman",INI::parseReal,NULL, offsetof( TAiData, m_guardOuterModifierHuman ) }, - { "GuardChaseUnitsDuration", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardChaseUnitFrames ) }, - { "GuardEnemyScanRate", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardEnemyScanRate ) }, - { "GuardEnemyReturnScanRate", INI::parseDurationUnsignedInt,NULL, offsetof( TAiData, m_guardEnemyReturnScanRate ) }, - { "SkirmishGroupFudgeDistance", INI::parseReal,NULL, offsetof( TAiData, m_skirmishGroupFudgeValue ) }, + { "StructureSeconds", INI::parseReal,nullptr, offsetof( TAiData, m_structureSeconds ) }, + { "TeamSeconds", INI::parseReal,nullptr, offsetof( TAiData, m_teamSeconds ) }, + { "Wealthy", INI::parseInt,nullptr, offsetof( TAiData, m_resourcesWealthy ) }, + { "Poor", INI::parseInt,nullptr, offsetof( TAiData, m_resourcesPoor ) }, + { "ForceIdleMSEC", INI::parseDurationUnsignedInt,nullptr,offsetof( TAiData, m_forceIdleFramesCount ) }, + { "StructuresWealthyRate", INI::parseReal,nullptr, offsetof( TAiData, m_structuresWealthyMod ) }, + { "TeamsWealthyRate", INI::parseReal,nullptr, offsetof( TAiData, m_teamWealthyMod ) }, + { "StructuresPoorRate", INI::parseReal,nullptr, offsetof( TAiData, m_structuresPoorMod ) }, + { "TeamsPoorRate", INI::parseReal,nullptr, offsetof( TAiData, m_teamPoorMod ) }, + { "TeamResourcesToStart", INI::parseReal,nullptr, offsetof( TAiData, m_teamResourcesToBuild ) }, + { "GuardInnerModifierAI", INI::parseReal,nullptr, offsetof( TAiData, m_guardInnerModifierAI ) }, + { "GuardOuterModifierAI", INI::parseReal,nullptr, offsetof( TAiData, m_guardOuterModifierAI ) }, + { "GuardInnerModifierHuman",INI::parseReal,nullptr, offsetof( TAiData, m_guardInnerModifierHuman ) }, + { "GuardOuterModifierHuman",INI::parseReal,nullptr, offsetof( TAiData, m_guardOuterModifierHuman ) }, + { "GuardChaseUnitsDuration", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardChaseUnitFrames ) }, + { "GuardEnemyScanRate", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardEnemyScanRate ) }, + { "GuardEnemyReturnScanRate", INI::parseDurationUnsignedInt,nullptr, offsetof( TAiData, m_guardEnemyReturnScanRate ) }, + { "SkirmishGroupFudgeDistance", INI::parseReal,nullptr, offsetof( TAiData, m_skirmishGroupFudgeValue ) }, - { "RepulsedDistance", INI::parseReal,NULL, offsetof( TAiData, m_repulsedDistance ) }, - { "EnableRepulsors", INI::parseBool,NULL, offsetof( TAiData, m_enableRepulsors ) }, + { "RepulsedDistance", INI::parseReal,nullptr, offsetof( TAiData, m_repulsedDistance ) }, + { "EnableRepulsors", INI::parseBool,nullptr, offsetof( TAiData, m_enableRepulsors ) }, - { "AlertRangeModifier", INI::parseReal,NULL, offsetof( TAiData, m_alertRangeModifier) }, - { "AggressiveRangeModifier",INI::parseReal,NULL, offsetof( TAiData, m_aggressiveRangeModifier) }, + { "AlertRangeModifier", INI::parseReal,nullptr, offsetof( TAiData, m_alertRangeModifier) }, + { "AggressiveRangeModifier",INI::parseReal,nullptr, offsetof( TAiData, m_aggressiveRangeModifier) }, - { "ForceSkirmishAI", INI::parseBool,NULL, offsetof( TAiData, m_forceSkirmishAI ) }, - { "RotateSkirmishBases", INI::parseBool,NULL, offsetof( TAiData, m_rotateSkirmishBases ) }, + { "ForceSkirmishAI", INI::parseBool,nullptr, offsetof( TAiData, m_forceSkirmishAI ) }, + { "RotateSkirmishBases", INI::parseBool,nullptr, offsetof( TAiData, m_rotateSkirmishBases ) }, - { "AttackUsesLineOfSight", INI::parseBool,NULL, offsetof( TAiData, m_attackUsesLineOfSight ) }, - { "AttackIgnoreInsignificantBuildings", INI::parseBool,NULL, offsetof( TAiData, m_attackIgnoreInsignificantBuildings ) }, + { "AttackUsesLineOfSight", INI::parseBool,nullptr, offsetof( TAiData, m_attackUsesLineOfSight ) }, + { "AttackIgnoreInsignificantBuildings", INI::parseBool,nullptr, offsetof( TAiData, m_attackIgnoreInsignificantBuildings ) }, - { "AttackPriorityDistanceModifier", INI::parseReal,NULL, offsetof( TAiData, m_attackPriorityDistanceModifier) }, - { "MaxRecruitRadius", INI::parseReal,NULL, offsetof( TAiData, m_maxRecruitDistance ) }, - { "SkirmishBaseDefenseExtraDistance", INI::parseReal,NULL, offsetof( TAiData, m_skirmishBaseDefenseExtraDistance ) }, + { "AttackPriorityDistanceModifier", INI::parseReal,nullptr, offsetof( TAiData, m_attackPriorityDistanceModifier) }, + { "MaxRecruitRadius", INI::parseReal,nullptr, offsetof( TAiData, m_maxRecruitDistance ) }, + { "SkirmishBaseDefenseExtraDistance", INI::parseReal,nullptr, offsetof( TAiData, m_skirmishBaseDefenseExtraDistance ) }, - { "WallHeight", INI::parseReal,NULL, offsetof( TAiData, m_wallHeight ) }, + { "WallHeight", INI::parseReal,nullptr, offsetof( TAiData, m_wallHeight ) }, - { "SideInfo", AI::parseSideInfo, NULL, NULL }, + { "SideInfo", AI::parseSideInfo, nullptr, 0 }, - { "SkirmishBuildList", AI::parseSkirmishBuildList, NULL, NULL }, + { "SkirmishBuildList", AI::parseSkirmishBuildList, nullptr, 0 }, - { "MinInfantryForGroup", INI::parseInt,NULL, offsetof( TAiData, m_minInfantryForGroup ) }, - { "MinVehiclesForGroup", INI::parseInt,NULL, offsetof( TAiData, m_minVehiclesForGroup ) }, + { "MinInfantryForGroup", INI::parseInt,nullptr, offsetof( TAiData, m_minInfantryForGroup ) }, + { "MinVehiclesForGroup", INI::parseInt,nullptr, offsetof( TAiData, m_minVehiclesForGroup ) }, - { "MinDistanceForGroup", INI::parseReal,NULL, offsetof( TAiData, m_minDistanceForGroup ) }, - { "DistanceRequiresGroup", INI::parseReal,NULL, offsetof( TAiData, m_distanceRequiresGroup ) }, - { "MinClumpDensity", INI::parseReal,NULL, offsetof( TAiData, m_minClumpDensity ) }, + { "MinDistanceForGroup", INI::parseReal,nullptr, offsetof( TAiData, m_minDistanceForGroup ) }, + { "DistanceRequiresGroup", INI::parseReal,nullptr, offsetof( TAiData, m_distanceRequiresGroup ) }, + { "MinClumpDensity", INI::parseReal,nullptr, offsetof( TAiData, m_minClumpDensity ) }, - { "InfantryPathfindDiameter", INI::parseInt,NULL, offsetof( TAiData, m_infantryPathfindDiameter ) }, - { "VehiclePathfindDiameter", INI::parseInt,NULL, offsetof( TAiData, m_vehiclePathfindDiameter ) }, - { "RebuildDelayTimeSeconds", INI::parseInt,NULL, offsetof( TAiData, m_rebuildDelaySeconds ) }, - { "SupplyCenterSafeRadius", INI::parseReal,NULL, offsetof( TAiData, m_supplyCenterSafeRadius ) }, + { "InfantryPathfindDiameter", INI::parseInt,nullptr, offsetof( TAiData, m_infantryPathfindDiameter ) }, + { "VehiclePathfindDiameter", INI::parseInt,nullptr, offsetof( TAiData, m_vehiclePathfindDiameter ) }, + { "RebuildDelayTimeSeconds", INI::parseInt,nullptr, offsetof( TAiData, m_rebuildDelaySeconds ) }, + { "SupplyCenterSafeRadius", INI::parseReal,nullptr, offsetof( TAiData, m_supplyCenterSafeRadius ) }, - { "AIDozerBoredRadiusModifier", INI::parseReal,NULL, offsetof( TAiData, m_aiDozerBoredRadiusModifier ) }, - { "AICrushesInfantry", INI::parseBool,NULL, offsetof( TAiData, m_aiCrushesInfantry ) }, + { "AIDozerBoredRadiusModifier", INI::parseReal,nullptr, offsetof( TAiData, m_aiDozerBoredRadiusModifier ) }, + { "AICrushesInfantry", INI::parseBool,nullptr, offsetof( TAiData, m_aiCrushesInfantry ) }, - { "MaxRetaliationDistance", INI::parseReal,NULL, offsetof( TAiData, m_maxRetaliateDistance ) }, - { "RetaliationFriendsRadius", INI::parseReal,NULL, offsetof( TAiData, m_retaliateFriendsRadius ) }, + { "MaxRetaliationDistance", INI::parseReal,nullptr, offsetof( TAiData, m_maxRetaliateDistance ) }, + { "RetaliationFriendsRadius", INI::parseReal,nullptr, offsetof( TAiData, m_retaliateFriendsRadius ) }, - { NULL, NULL, NULL, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -208,16 +208,16 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* static const FieldParse myFieldParse[] = { - { "ResourceGatherersEasy", INI::parseInt, NULL, offsetof( AISideInfo, m_easy ) }, - { "ResourceGatherersNormal", INI::parseInt, NULL, offsetof( AISideInfo, m_normal ) }, - { "ResourceGatherersHard", INI::parseInt, NULL, offsetof( AISideInfo, m_hard ) }, - { "BaseDefenseStructure1", INI::parseAsciiString, NULL, offsetof( AISideInfo, m_baseDefenseStructure1 ) }, - { "SkillSet1", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet1 ) }, - { "SkillSet2", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet2 ) }, - { "SkillSet3", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet3 ) }, - { "SkillSet4", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet4 ) }, - { "SkillSet5", AI::parseSkillSet, NULL, offsetof( AISideInfo, m_skillSet5 ) }, - { NULL, NULL, NULL, 0 } + { "ResourceGatherersEasy", INI::parseInt, nullptr, offsetof( AISideInfo, m_easy ) }, + { "ResourceGatherersNormal", INI::parseInt, nullptr, offsetof( AISideInfo, m_normal ) }, + { "ResourceGatherersHard", INI::parseInt, nullptr, offsetof( AISideInfo, m_hard ) }, + { "BaseDefenseStructure1", INI::parseAsciiString, nullptr, offsetof( AISideInfo, m_baseDefenseStructure1 ) }, + { "SkillSet1", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet1 ) }, + { "SkillSet2", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet2 ) }, + { "SkillSet3", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet3 ) }, + { "SkillSet4", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet4 ) }, + { "SkillSet5", AI::parseSkillSet, nullptr, offsetof( AISideInfo, m_skillSet5 ) }, + { nullptr, nullptr, nullptr, 0 } }; AISideInfo *resourceInfo = ((TAiData*)instance)->m_sideInfo; @@ -227,7 +227,7 @@ void AI::parseSideInfo(INI *ini, void *instance, void* /*store*/, const void* /* } resourceInfo = resourceInfo->m_next; } - if (resourceInfo==NULL) + if (resourceInfo==nullptr) { resourceInfo = newInstance(AISideInfo); ((TAiData*)instance)->addSideInfo(resourceInfo); @@ -241,8 +241,8 @@ void AI::parseSkillSet(INI *ini, void *instance, void* store, const void* /*user { static const FieldParse myFieldParse[] = { - { "Science", AI::parseScience, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Science", AI::parseScience, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; TSkillSet *skillset = ((TSkillSet*)store); @@ -261,7 +261,7 @@ void AI::parseScience(INI *ini, void *instance, void* /*store*/, const void* /*u return; } skillset->m_skills[skillset->m_numSkills] = SCIENCE_INVALID; - INI::parseScience(ini, instance, skillset->m_skills+skillset->m_numSkills, NULL); + INI::parseScience(ini, instance, skillset->m_skills+skillset->m_numSkills, nullptr); ScienceType science = skillset->m_skills[skillset->m_numSkills]; if (science != SCIENCE_INVALID) { if (TheScienceStore->getSciencePurchaseCost(science)==0) { @@ -280,8 +280,8 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const static const FieldParse myFieldParse[] = { - { "Structure", BuildListInfo::parseStructure, NULL, NULL }, - { NULL, NULL, NULL, 0 } + { "Structure", BuildListInfo::parseStructure, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; AISideBuildList *build = newInstance(AISideBuildList)(faction); @@ -293,7 +293,7 @@ void AI::parseSkirmishBuildList(INI *ini, void *instance, void* /*store*/, const //-------------------------------------------------------------------------------------------------------- /// The AI system singleton -AI *TheAI = NULL; +AI *TheAI = nullptr; /** @@ -336,7 +336,7 @@ void AI::reset( void ) } else { - m_groupList.pop_front(); // NULL group, just kill from list. Shouldn't really happen, but just in case. + m_groupList.pop_front(); // nullptr group, just kill from list. Shouldn't really happen, but just in case. } } #else @@ -371,7 +371,7 @@ void AI::update( void ) AI::~AI() { delete m_pathfinder; - m_pathfinder = NULL; + m_pathfinder = nullptr; while (m_aiData) { @@ -387,20 +387,20 @@ void AI::newOverride(void) TAiData *cur = m_aiData; m_aiData = NEW TAiData; *m_aiData = *cur; - m_aiData->m_sideInfo = NULL; + m_aiData->m_sideInfo = nullptr; AISideInfo *info = cur->m_sideInfo; while (info) { AISideInfo *newInfo = newInstance(AISideInfo); *newInfo = *info; - newInfo->m_next = NULL; + newInfo->m_next = nullptr; addSideInfo(newInfo); info = info->m_next; } - m_aiData->m_sideBuildLists = NULL; + m_aiData->m_sideBuildLists = nullptr; AISideBuildList *build = cur->m_sideBuildLists; while (build) { AISideBuildList *newbuild = newInstance(AISideBuildList)(build->m_side); - newbuild->m_next = NULL; + newbuild->m_next = nullptr; newbuild->m_buildList = build->m_buildList->duplicate(); m_aiData->addFactionBuildList(newbuild); build = build->m_next; @@ -473,7 +473,7 @@ void AI::destroyGroup( AIGroup *group ) if (i == m_groupList.end()) return; - DEBUG_ASSERTCRASH(group != NULL, ("A NULL group made its way into the AIGroup list.. jkmcd")); + DEBUG_ASSERTCRASH(group != nullptr, ("A null group made its way into the AIGroup list.. jkmcd")); // remove it // DEBUG_LOG(("***AIGROUP %x is being removed from m_groupList.", group )); @@ -494,7 +494,7 @@ AIGroup *AI::findGroup( UnsignedInt id ) if ((*i)->getID() == id) return (*i); - return NULL; + return nullptr; } //-------------------------------------------------------------------------------------------------------- @@ -552,7 +552,7 @@ class PartitionFilterWithinAttackRange : public PartitionFilter { // ignore empty slots. const Weapon* w = m_obj->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; if (w->isWithinAttackRange(m_obj, objOther)) @@ -600,7 +600,7 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie PartitionFilterPossibleToAttack would filter out everything anyway, so just punt here. */ - return NULL; + return nullptr; } // only consider live, on-map enemies. @@ -676,16 +676,16 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie filters[numFilters++] = optionalFilter; } - filters[numFilters] = NULL; + filters[numFilters] = nullptr; - if (info == NULL || info == TheScriptEngine->getDefaultAttackInfo()) + if (info == nullptr || info == TheScriptEngine->getDefaultAttackInfo()) { // No additional attack info, so just return the closest one. Object* o = ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); return o; } - Object *bestEnemy = NULL; + Object *bestEnemy = nullptr; Int effectivePriority=0; Int actualPriority=0; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(me, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR); @@ -769,7 +769,7 @@ Object *AI::findClosestAlly( const Object *me, Real range, UnsignedInt qualifier if (qualifiers & CAN_SEE) filters[numFilters++] = &filterLOS; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); } @@ -785,7 +785,7 @@ Object *AI::findClosestRepulsor( const Object *me, Real range) { if (!getAiData()->m_enableRepulsors) { - return NULL; + return nullptr; } // never target buildings (unless they can attack) @@ -801,7 +801,7 @@ Object *AI::findClosestRepulsor( const Object *me, Real range) filters[numFilters++] = &filter; filters[numFilters++] = &filterStealth; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( me, range, FROM_BOUNDINGSPHERE_2D, filters ); } @@ -841,7 +841,7 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons } } - if (object->getContainedBy() != NULL) + if (object->getContainedBy() != nullptr) { originalRange = object->getLargestWeaponRange(); } @@ -903,8 +903,8 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons //------------------------------------------------------------------------------------------------- TAiData::TAiData() : -m_next(NULL), -m_sideInfo(NULL), +m_next(nullptr), +m_sideInfo(nullptr), m_attackIgnoreInsignificantBuildings(false), m_skirmishGroupFudgeValue(0.0f), m_structureSeconds(0), @@ -942,7 +942,7 @@ m_vehiclePathfindDiameter(6), m_supplyCenterSafeRadius(250), m_rebuildDelaySeconds(10), m_distanceRequiresGroup(0.0f), -m_sideBuildLists(NULL), +m_sideBuildLists(nullptr), m_structuresPoorMod(0.0f), m_teamWealthyMod(0.0f), m_aiDozerBoredRadiusModifier(2.0), diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp index 1ac91b201cf..de2b3f76676 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIDock.cpp @@ -45,8 +45,8 @@ AIDockMachine::AIDockMachine( Object *obj ) : StateMachine( obj, "AIDockMachine" { static const StateConditionInfo waitForClearanceConditions[] = { - StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ableToAdvance, AI_DOCK_ADVANCE_POSITION, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -72,13 +72,13 @@ void AIDockMachine::halt() Object *goalObject = getGoalObject(); // sanity - if( goalObject != NULL ) + if( goalObject != nullptr ) { // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // We need to say goodbye, or we will leave our spot taken forever. - if( dock != NULL ) + if( dock != nullptr ) dock->cancelDock( getOwner() ); } @@ -122,13 +122,13 @@ void AIDockMachine::loadPostProcess( void ) Object *goalObject = thisState->getMachineGoalObject(); AIDockMachine *myMachine = (AIDockMachine *)thisState->getMachine(); - if( goalObject == NULL ) + if( goalObject == nullptr ) return FALSE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if( dock == NULL ) + if( dock == nullptr ) return FALSE; // if the dock says we can advance, then sidetrack to the scoot forward state @@ -169,14 +169,14 @@ StateReturnType AIDockApproachState::onEnter( void ) Object *goalObject = getMachineGoalObject(); // sanity - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -196,7 +196,7 @@ StateReturnType AIDockApproachState::onEnter( void ) AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } // this behavior is an extention of basic MoveTo return AIInternalMoveToState::onEnter(); @@ -208,7 +208,7 @@ StateReturnType AIDockApproachState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -220,7 +220,7 @@ void AIDockApproachState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -259,13 +259,13 @@ StateReturnType AIDockWaitForClearanceState::update( void ) { Object *goalObject = getMachineGoalObject(); - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -291,7 +291,7 @@ void AIDockWaitForClearanceState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -325,14 +325,14 @@ StateReturnType AIDockAdvancePositionState::onEnter( void ) Object *goalObject = getMachineGoalObject(); // sanity - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; // get dock update interface DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -352,7 +352,7 @@ StateReturnType AIDockAdvancePositionState::onEnter( void ) AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface(); if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } // this behavior is an extention of basic MoveTo return AIInternalMoveToState::onEnter(); @@ -364,7 +364,7 @@ StateReturnType AIDockAdvancePositionState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -376,7 +376,7 @@ void AIDockAdvancePositionState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -406,12 +406,12 @@ StateReturnType AIDockMoveToEntryState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -440,7 +440,7 @@ StateReturnType AIDockMoveToEntryState::onEnter( void ) StateReturnType AIDockMoveToEntryState::update( void ) { // if we have nothing to dock with, fail - if (getMachineGoalObject() == NULL) + if (getMachineGoalObject() == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -452,7 +452,7 @@ void AIDockMoveToEntryState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -486,12 +486,12 @@ StateReturnType AIDockMoveToDockState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // fail if the dock is closed @@ -524,7 +524,7 @@ StateReturnType AIDockMoveToDockState::update( void ) Object *goalObject = getMachineGoalObject(); // if we have nothing to dock with, fail - if (goalObject == NULL) + if (goalObject == nullptr) return STATE_FAILURE; DockUpdateInterface *dock = goalObject->getDockUpdateInterface(); @@ -540,7 +540,7 @@ void AIDockMoveToDockState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -592,12 +592,12 @@ StateReturnType AIDockProcessDockState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; setNextDockActionFrame(); @@ -614,12 +614,12 @@ StateReturnType AIDockProcessDockState::update( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // Some dockers can have a delay built in @@ -673,7 +673,7 @@ Object* AIDockProcessDockState::findMyDrone() Player *player = self->getControllingPlayer(); DroneInfo dInfo; dInfo.found = FALSE; - dInfo.drone = NULL; + dInfo.drone = nullptr; dInfo.owner = self; //Iterate the objects in search for a drone with a producer ID of me. @@ -709,12 +709,12 @@ StateReturnType AIDockMoveToExitState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // get the exit position @@ -735,7 +735,7 @@ StateReturnType AIDockMoveToExitState::onEnter( void ) StateReturnType AIDockMoveToExitState::update( void ) { // if we have nothing to dock with, fail - if (getMachineGoalObject() == NULL) + if (getMachineGoalObject() == nullptr) return STATE_FAILURE; // this behavior is an extention of basic MoveTo @@ -747,7 +747,7 @@ void AIDockMoveToExitState::onExit( StateExitType status ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); @@ -774,18 +774,18 @@ StateReturnType AIDockMoveToRallyState::onEnter( void ) { Object *goalObject = getMachineGoalObject(); - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; if( goalObject ) dock = goalObject->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) + if (dock == nullptr) return STATE_FAILURE; // if they don't have anywhere to send us, then we are good if( ! dock->isRallyPointAfterDockType() //Chooses not to - || goalObject->getObjectExitInterface() == NULL //or can't - || goalObject->getObjectExitInterface()->getRallyPoint() == NULL //or can't right now. + || goalObject->getObjectExitInterface() == nullptr //or can't + || goalObject->getObjectExitInterface()->getRallyPoint() == nullptr //or can't right now. ) { return STATE_SUCCESS; // Success in an Enter is like success in an update. We're all fine here diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index e09a4f24a7e..2f50b6ebbec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -71,7 +71,7 @@ AIGroup::AIGroup( void ) { // DEBUG_LOG(("***AIGROUP %x is being constructed.", this)); - m_groundPath = NULL; + m_groundPath = nullptr; m_speed = 0.0f; m_dirty = false; m_id = TheAI->getNextGroupID(); @@ -112,7 +112,7 @@ AIGroup::~AIGroup() #endif deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; //DEBUG_LOG(( "AIGroup #%d destroyed", m_id )); } @@ -133,7 +133,7 @@ const VecObjectID& AIGroup::getAllIDs( void ) const m_lastRequestedIDList.clear(); for (std::list::const_iterator cit = m_memberList.begin(); cit != m_memberList.end(); ++cit) { - if ((*cit) == NULL) + if ((*cit) == nullptr) continue; m_lastRequestedIDList.push_back((*cit)->getID()); @@ -174,8 +174,8 @@ Bool AIGroup::isMember( Object *obj ) void AIGroup::add( Object *obj ) { // DEBUG_LOG(("***AIGROUP %x is adding Object %x (%s).", this, obj, obj->getTemplate()->getName().str())); - DEBUG_ASSERTCRASH(obj != NULL, ("trying to add null obj to AIGroup")); - if (obj == NULL) + DEBUG_ASSERTCRASH(obj != nullptr, ("trying to add null obj to AIGroup")); + if (obj == nullptr) return; AIUpdateInterface *ai = obj->getAIUpdateInterface(); @@ -188,7 +188,7 @@ void AIGroup::add( Object *obj ) KindOfMaskType validNonAIKindofs; validNonAIKindofs.set(KINDOF_STRUCTURE); validNonAIKindofs.set(KINDOF_ALWAYS_SELECTABLE); - if( ai == NULL && !obj->isAnyKindOf( validNonAIKindofs ) ) + if( ai == nullptr && !obj->isAnyKindOf( validNonAIKindofs ) ) { return; } @@ -445,7 +445,7 @@ void AIGroup::recompute( void ) getCenter( ¢er ); deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; m_speed = 9999999999.9f; @@ -541,7 +541,7 @@ void AIGroup::computeIndividualDestination( Coord3D *dest, const Coord3D *groupD AIUpdateInterface *ai = obj->getAIUpdateInterface(); if (ai && ai->isDoingGroundMovement()) { if (isFormation) { - TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, NULL); + TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, nullptr); } else { TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), dest, groupDest); } @@ -581,7 +581,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm Int numInfantry = 0; Int numVehicles = 0; - Object *centerVehicle = NULL; + Object *centerVehicle = nullptr; Real distSqrCenterVeh = distSqr*10; for( i = m_memberList.begin(); i != m_memberList.end(); ++i ) { @@ -591,7 +591,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm { continue; // don't bother telling the occupants to move. } - if( obj->getAI()==NULL ) + if( obj->getAI()==nullptr ) { continue; } @@ -618,13 +618,13 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm // find object closest to the center. dx = unitPos.x-center.x; dy = unitPos.y-center.y; - if (centerVehicle==NULL || dx*dx+dy*dygetPosition(); dx = max.x - min.x; @@ -670,7 +670,7 @@ Bool AIGroup::friend_computeGroundPath( const Coord3D *pos, CommandSourceType cm if (!closeEnough) return false; m_groundPath = TheAI->pathfinder()->findGroundPath(¢er, pos, PATH_DIAMETER_IN_CELLS, false); - return m_groundPath!=NULL; + return m_groundPath!=nullptr; } @@ -717,7 +717,7 @@ static void clampToMap(Coord3D *dest, PlayerType pt) Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cmdSource ) { - if (m_groundPath==NULL) return false; + if (m_groundPath==nullptr) return false; Int numColumns = 3; Int halfNumColumns = numColumns/2; @@ -728,7 +728,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm // Get the start & end vectors for the path. Coord3D startPoint = *m_groundPath->getFirstNode()->getPosition(); Real farEnoughSqr = sqr(PATH_DIAMETER_IN_CELLS*PATHFIND_CELL_SIZE_F); - PathNode *startNode = NULL; + PathNode *startNode = nullptr; PathNode *node; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { dx = node->getPosition()->x - startPoint.x; @@ -739,7 +739,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm } } Coord3D endPoint = *m_groundPath->getLastNode()->getPosition(); - PathNode *endNode = NULL; + PathNode *endNode = nullptr; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - endPoint.x; Real dy = node->getPosition()->y - endPoint.y; @@ -747,9 +747,9 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm endNode = node; } } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; return false; } @@ -794,7 +794,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -971,7 +971,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm while (node) { Coord3D dest = *node->getPosition(); PathNode *tmpNode; - PathNode *nextNode=NULL; + PathNode *nextNode=nullptr; for (tmpNode = node->getNextOptimized(); tmpNode; tmpNode=tmpNode->getNextOptimized()) { Real dx = tmpNode->getPosition()->x - dest.x; Real dy = tmpNode->getPosition()->y - dest.y; @@ -980,7 +980,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm break; } } - if (nextNode==NULL) break; + if (nextNode==nullptr) break; Coord2D cornerVectorNormal; cornerVectorNormal.y = nextNode->getPosition()->x - previousNode->getPosition()->x; cornerVectorNormal.x = -(nextNode->getPosition()->y - previousNode->getPosition()->y); @@ -1060,10 +1060,10 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm } } clampToMap(&dest, controllingPlayerType); - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } return true; } @@ -1078,8 +1078,8 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c if (!getCenter( ¢er )) return; - PathNode *startNode = NULL; - PathNode *endNode = NULL; + PathNode *startNode = nullptr; + PathNode *endNode = nullptr; Coord3D endPoint = *pos; if (m_groundPath) { // Get the start & end vectors for the path. @@ -1105,15 +1105,15 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c PathNode *tmpNode = endNode; while (tmpNode) { if (tmpNode == startNode) { - endNode = NULL; + endNode = nullptr; } tmpNode = tmpNode->getNextOptimized(); } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; - startNode = NULL; - endNode = NULL; + m_groundPath = nullptr; + startNode = nullptr; + endNode = nullptr; } } @@ -1128,7 +1128,7 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c } Object *theUnit = (*i); AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) { continue; } @@ -1159,10 +1159,10 @@ void AIGroup::friend_moveFormationToPos( const Coord3D *pos, CommandSourceType c dest.x += offset.x; dest.y += offset.y; - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } else { Coord3D dest = endPoint; dest.x += offset.x; @@ -1183,7 +1183,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd { - if (m_groundPath==NULL) return false; + if (m_groundPath==nullptr) return false; Real dx, dy; Coord3D center; @@ -1199,7 +1199,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd // Get the start & end vectors for the path. Coord3D startPoint = *m_groundPath->getFirstNode()->getPosition(); Real farEnoughSqr = sqr(PATH_DIAMETER_IN_CELLS*PATHFIND_CELL_SIZE_F); - PathNode *startNode = NULL; + PathNode *startNode = nullptr; PathNode *node; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - startPoint.x; @@ -1210,7 +1210,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd } } Coord3D endPoint = *m_groundPath->getLastNode()->getPosition(); - PathNode *endNode = NULL; + PathNode *endNode = nullptr; for (node = m_groundPath->getFirstNode(); node; node=node->getNextOptimized()) { Real dx = node->getPosition()->x - endPoint.x; Real dy = node->getPosition()->y - endPoint.y; @@ -1219,11 +1219,11 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd } } if (endNode == m_groundPath->getFirstNode()) { - endNode = NULL; + endNode = nullptr; } - if (startNode==NULL || endNode==NULL) { + if (startNode==nullptr || endNode==nullptr) { deleteInstance(m_groundPath); - m_groundPath = NULL; + m_groundPath = nullptr; return false; } @@ -1268,7 +1268,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1452,7 +1452,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd while (node) { Coord3D dest = *node->getPosition(); PathNode *tmpNode; - PathNode *nextNode=NULL; + PathNode *nextNode=nullptr; for (tmpNode = node->getNextOptimized(); tmpNode; tmpNode=tmpNode->getNextOptimized()) { Real dx = tmpNode->getPosition()->x - dest.x; Real dy = tmpNode->getPosition()->y - dest.y; @@ -1461,7 +1461,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd break; } } - if (nextNode==NULL) break; + if (nextNode==nullptr) break; Coord2D cornerVectorNormal; cornerVectorNormal.y = nextNode->getPosition()->x - previousNode->getPosition()->x; cornerVectorNormal.x = -(nextNode->getPosition()->y - previousNode->getPosition()->y); @@ -1543,10 +1543,10 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd } } clampToMap(&dest, controllingPlayerType); - TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, NULL); + TheAI->pathfinder()->adjustDestination(theUnit, ai->getLocomotorSet(), &dest, nullptr); TheAI->pathfinder()->updateGoal(theUnit, &dest, LAYER_GROUND); path.push_back(dest); - ai->aiFollowPath( &path, NULL, cmdSource ); + ai->aiFollowPath( &path, nullptr, cmdSource ); } return true; } @@ -1693,7 +1693,7 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1827,7 +1827,7 @@ void AIGroup::groupScatter( CommandSourceType cmdSource ) { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -1925,7 +1925,7 @@ void AIGroup::groupTightenToPosition( const Coord3D *pos, Bool addWaypoint, Comm { continue; } - if( (*i)->getAI()==NULL ) + if( (*i)->getAI()==nullptr ) { continue; } @@ -2271,7 +2271,7 @@ void AIGroup::groupAttackPosition( const Coord3D *pos, Int maxShotsToFire, Comma { if( !pos ) { - //If you specify a NULL position, it means you are attacking your own location. + //If you specify a nullptr position, it means you are attacking your own location. attackPos.set( (*i)->getPosition() ); } @@ -2289,7 +2289,7 @@ void AIGroup::groupAttackPosition( const Coord3D *pos, Int maxShotsToFire, Comma for( ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) { Object* garrisonedMember = *it; - CanAttackResult result = garrisonedMember->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, &attackPos, cmdSource ) ; + CanAttackResult result = garrisonedMember->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, nullptr, &attackPos, cmdSource ) ; if( result == ATTACKRESULT_POSSIBLE || result == ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { AIUpdateInterface *memberAI = garrisonedMember->getAI(); @@ -3136,7 +3136,7 @@ void AIGroup::queueUpgrade( const UpgradeTemplate *upgrade ) // producer must have a production update ProductionUpdateInterface *pu = thisMember->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) continue; if ( pu->canQueueUpgrade( upgrade ) == CANMAKE_QUEUE_FULL ) @@ -3247,7 +3247,7 @@ Object *AIGroup::getSpecialPowerSourceObject( UnsignedInt specialPowerID ) return object; } } - return NULL; + return nullptr; } // Returns an object that has a command button for the GUI command type. @@ -3278,7 +3278,7 @@ Object *AIGroup::getCommandButtonSourceObject( GUICommandType type ) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index bf9f8b5934d..a14a14e9cc1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -59,7 +59,7 @@ const Real CLOSE_ENOUGH = (25.0f); static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ ) { Object *obj = thisState->getMachineOwner(); - BodyModuleInterface *bmi = obj ? obj->getBodyModule() : NULL; + BodyModuleInterface *bmi = obj ? obj->getBodyModule() : nullptr; if (!(obj && bmi)) { return FALSE; @@ -161,7 +161,7 @@ Bool ExitConditions::shouldExit(const StateMachine* machine) const AIGuardMachine::AIGuardMachine( Object *owner ) : StateMachine(owner, "AIGuardMachine"), m_targetToGuard(INVALID_ID), - m_areaToGuard(NULL), + m_areaToGuard(nullptr), m_nemesisToAttack(INVALID_ID), m_guardMode(GUARDMODE_NORMAL) { @@ -169,8 +169,8 @@ AIGuardMachine::AIGuardMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { - StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_ATTACK_AGGRESSOR, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -211,7 +211,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) } // Check if team auto targets same victim. - Object *teamVictim = NULL; + Object *teamVictim = nullptr; if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); @@ -282,7 +282,7 @@ Bool AIGuardMachine::lookForInnerTarget(void) filters[count++] = &f4; } - filters[count++] = NULL; + filters[count++] = nullptr; // SimpleObjectIterator* iter = ThePartitionManager->iterateObjectsInRange( // &pos, visionRange, FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR); @@ -391,9 +391,9 @@ StateReturnType AIGuardInnerState::onEnter( void ) if (getMachineOwner()->getTemplate()->isEnterGuard()) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardInnerState.")); return STATE_SUCCESS; } m_enterState = newInstance(AIEnterState)(getMachine()); @@ -411,9 +411,9 @@ StateReturnType AIGuardInnerState::onEnter( void ) Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); Coord3D pos = targetToGuard ? *targetToGuard->getPosition() : *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardInnerState.")); return STATE_SUCCESS; } m_exitConditions.m_center = pos; @@ -465,18 +465,18 @@ void AIGuardInnerState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } else if (m_enterState) { m_enterState->onExit(status); deleteInstance(m_enterState); - m_enterState = NULL; + m_enterState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } @@ -527,9 +527,9 @@ StateReturnType AIGuardOuterState::onEnter( void ) Coord3D pos = targetToGuard ? *targetToGuard->getPosition() : *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardInnerState.")); return STATE_SUCCESS; } Object *obj = getMachineOwner(); @@ -565,7 +565,7 @@ StateReturnType AIGuardOuterState::onEnter( void ) //-------------------------------------------------------------------------------------- StateReturnType AIGuardOuterState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; // if the position has moved (IE we're guarding an object), move with it. Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); @@ -599,7 +599,7 @@ void AIGuardOuterState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -814,7 +814,7 @@ void AIGuardPickUpCrateState::onExit( StateExitType status ) AIGuardAttackAggressorState::AIGuardAttackAggressorState( StateMachine *machine ) : State( machine, "AIGuardAttackAggressorState" ) { - m_attackState = NULL; + m_attackState = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -835,9 +835,9 @@ StateReturnType AIGuardAttackAggressorState::onEnter( void ) } Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardAttackAggressorState.")); return STATE_SUCCESS; } @@ -866,7 +866,7 @@ StateReturnType AIGuardAttackAggressorState::onEnter( void ) //------------------------------------------------------------------------------------------------- StateReturnType AIGuardAttackAggressorState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; // if the position has moved (IE we're guarding an object), move with it. Object* targetToGuard = getGuardMachine()->findTargetToGuardByID(); if (targetToGuard) @@ -885,12 +885,12 @@ void AIGuardAttackAggressorState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp index c66bc9cfd17..8c46db56d71 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp @@ -58,7 +58,7 @@ const Real CLOSE_ENOUGH = (25.0f); static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ ) { Object *obj = thisState->getMachineOwner(); - BodyModuleInterface *bmi = obj ? obj->getBodyModule() : NULL; + BodyModuleInterface *bmi = obj ? obj->getBodyModule() : nullptr; if (!(obj && bmi)) { return FALSE; @@ -176,8 +176,8 @@ AIGuardRetaliateMachine::AIGuardRetaliateMachine( Object *owner ) : static const StateConditionInfo attackAggressors[] = { - StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_RETALIATE_ATTACK_AGGRESSOR, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(hasAttackedMeAndICanReturnFire, AI_GUARD_RETALIATE_ATTACK_AGGRESSOR, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -224,7 +224,7 @@ Bool AIGuardRetaliateMachine::lookForInnerTarget(void) } // Check if team auto targets same victim. - Object *teamVictim = NULL; + Object *teamVictim = nullptr; if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); @@ -274,7 +274,7 @@ Bool AIGuardRetaliateMachine::lookForInnerTarget(void) Real visionRange = AIGuardRetaliateMachine::getStdGuardRange(owner); - filters[count++] = NULL; + filters[count++] = nullptr; // SimpleObjectIterator* iter = ThePartitionManager->iterateObjectsInRange( // &pos, visionRange, FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR); @@ -373,9 +373,9 @@ StateReturnType AIGuardRetaliateInnerState::onEnter( void ) if (getMachineOwner()->getTemplate()->isEnterGuard()) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardRetaliateInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardRetaliateInnerState.")); return STATE_SUCCESS; } m_enterState = newInstance(AIEnterState)(getMachine()); @@ -392,9 +392,9 @@ StateReturnType AIGuardRetaliateInnerState::onEnter( void ) { Coord3D pos = *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardRetaliateInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardRetaliateInnerState.")); return STATE_SUCCESS; } m_exitConditions.m_center = pos; @@ -439,18 +439,18 @@ void AIGuardRetaliateInnerState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } else if (m_enterState) { m_enterState->onExit(status); deleteInstance(m_enterState); - m_enterState = NULL; + m_enterState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } @@ -500,9 +500,9 @@ StateReturnType AIGuardRetaliateOuterState::onEnter( void ) Coord3D pos = *getGuardMachine()->getPositionToGuard(); Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardRetaliateOuterState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardRetaliateOuterState.")); return STATE_SUCCESS; } Object *obj = getMachineOwner(); @@ -531,7 +531,7 @@ StateReturnType AIGuardRetaliateOuterState::onEnter( void ) //-------------------------------------------------------------------------------------- StateReturnType AIGuardRetaliateOuterState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; Object* goalObj = m_attackState->getMachineGoalObject(); if (goalObj) @@ -558,7 +558,7 @@ void AIGuardRetaliateOuterState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -755,7 +755,7 @@ void AIGuardRetaliatePickUpCrateState::onExit( StateExitType status ) AIGuardRetaliateAttackAggressorState::AIGuardRetaliateAttackAggressorState( StateMachine *machine ) : State( machine, "AIGuardRetaliateAttackAggressorState" ) { - m_attackState = NULL; + m_attackState = nullptr; } #ifdef STATE_MACHINE_DEBUG //---------------------------------------------------------------------------------------------------------- @@ -764,7 +764,7 @@ AsciiString AIGuardRetaliateAttackAggressorState::getName( ) const AsciiString name = m_name; name.concat("/ "); if (m_attackState) name.concat(m_attackState->getName()); - else name.concat("*NULL m_attackState"); + else name.concat("*null m_attackState"); return name; } #endif @@ -798,7 +798,7 @@ StateReturnType AIGuardRetaliateAttackAggressorState::onEnter( void ) if( !nemesis ) { - DEBUG_LOG(("Unexpected NULL nemesis in AIGuardRetaliateAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AIGuardRetaliateAttackAggressorState.")); return STATE_SUCCESS; } @@ -828,7 +828,7 @@ StateReturnType AIGuardRetaliateAttackAggressorState::onEnter( void ) //------------------------------------------------------------------------------------------------- StateReturnType AIGuardRetaliateAttackAggressorState::update( void ) { - if (m_attackState==NULL) return STATE_SUCCESS; + if (m_attackState==nullptr) return STATE_SUCCESS; return m_attackState->update(); } @@ -841,12 +841,12 @@ void AIGuardRetaliateAttackAggressorState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index bc2eb2aed11..e5a67328b24 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -116,9 +116,9 @@ constexpr const UnsignedInt CELL_INFOS_TO_ALLOCATE = 30000; //----------------------------------------------------------------------------------- PathNode::PathNode() : - m_nextOpti(0), - m_next(0), - m_prev(0), + m_nextOpti(nullptr), + m_next(nullptr), + m_prev(nullptr), m_nextOptiDist2D(0), m_canOptimize(false), m_id(-1) @@ -164,7 +164,7 @@ PathNode *PathNode::prependToList( PathNode *list ) m_next = list; if (list) list->m_prev = this; - m_prev = NULL; + m_prev = nullptr; return this; } @@ -173,10 +173,10 @@ PathNode *PathNode::prependToList( PathNode *list ) /// @todo optimize this PathNode *PathNode::appendToList( PathNode *list ) { - if (list == NULL) + if (list == nullptr) { - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; return this; } @@ -186,7 +186,7 @@ PathNode *PathNode::appendToList( PathNode *list ) tail->m_next = this; m_prev = tail; - m_next = NULL; + m_next = nullptr; return list; } @@ -212,9 +212,9 @@ const Coord3D *PathNode::computeDirectionVector( void ) { static Coord3D dir; - if (m_next == NULL) + if (m_next == nullptr) { - if (m_prev == NULL) + if (m_prev == nullptr) { // only one node on whole path - no direction dir.x = 0.0f; @@ -240,11 +240,11 @@ const Coord3D *PathNode::computeDirectionVector( void ) //----------------------------------------------------------------------------------- Path::Path(): -m_path(NULL), -m_pathTail(NULL), +m_path(nullptr), +m_pathTail(nullptr), m_isOptimized(FALSE), m_blockedByAlly(FALSE), -m_cpopRecentStart(NULL), +m_cpopRecentStart(nullptr), m_cpopCountdown(MAX_CPOP), m_cpopValid(FALSE) { @@ -330,7 +330,7 @@ void Path::xfer( Xfer *xfer ) node->setPosition(&pos); node->setLayer(layer); node->setCanOptimize(canOpt); - PathNode *optNode = NULL; + PathNode *optNode = nullptr; if (optID > 0) { optNode = m_path; while (optNode && optNode->m_id != optID) { @@ -339,7 +339,7 @@ void Path::xfer( Xfer *xfer ) DEBUG_ASSERTCRASH (optNode && optNode->m_id == optID, ("Could not find optimized link.")); } m_path = node->prependToList(m_path); - if (m_pathTail == NULL) + if (m_pathTail == nullptr) m_pathTail = node; if (optNode) { node->setNextOptimized(optNode); @@ -364,7 +364,7 @@ void Path::xfer( Xfer *xfer ) color.blue = 0; color.red = color.green = 1; Coord3D pos; - addIcon(NULL, 0, 0, color); // erase feedback. + addIcon(nullptr, 0, 0, color); // erase feedback. for( PathNode *node = getFirstNode(); node; node = node->getNext() ) { @@ -404,13 +404,13 @@ void Path::prependNode( const Coord3D *pos, PathfindLayerEnum layer ) m_path = node->prependToList( m_path ); - if (m_pathTail == NULL) + if (m_pathTail == nullptr) m_pathTail = node; m_isOptimized = false; #ifdef CPOP_STARTS_FROM_PREV_SEG - m_cpopRecentStart = NULL; + m_cpopRecentStart = nullptr; #endif } @@ -442,7 +442,7 @@ void Path::appendNode( const Coord3D *pos, PathfindLayerEnum layer ) m_pathTail = node; #ifdef CPOP_STARTS_FROM_PREV_SEG - m_cpopRecentStart = NULL; + m_cpopRecentStart = nullptr; #endif } /** @@ -702,7 +702,7 @@ void Path::optimizeGroundPath( Bool crusher, Int pathDiameter ) } // Remove jig/jogs :) jba. - for (anchor=getFirstNode(); anchor!=NULL; anchor=anchor->getNextOptimized()) { + for (anchor=getFirstNode(); anchor!=nullptr; anchor=anchor->getNextOptimized()) { node = anchor->getNextOptimized(); if (node && node->getNextOptimized()) { Real dx = node->getPosition()->x - anchor->getPosition()->x; @@ -765,7 +765,7 @@ void Path::computePointOnPath( out.posOnPath.zero(); out.distAlongPath = 0; - if (m_path == NULL) + if (m_path == nullptr) { m_cpopValid = false; return; @@ -784,7 +784,7 @@ void Path::computePointOnPath( // default pathPos to end of the path out.posOnPath = *getLastNode()->getPosition(); - const PathNode* closeNode = NULL; + const PathNode* closeNode = nullptr; Coord2D toPos; Real closeDistSqr = 99999999.9f; Real totalPathLength = 0.0f; @@ -795,7 +795,7 @@ void Path::computePointOnPath( // #ifdef CPOP_STARTS_FROM_PREV_SEG const PathNode* prevNode = m_cpopRecentStart; - if (prevNode == NULL) + if (prevNode == nullptr) prevNode = m_path; #else const PathNode* prevNode = m_path; @@ -805,7 +805,7 @@ void Path::computePointOnPath( // note that the seg dir and len returned by this is the dist & vec from 'prevNode' to 'node' for ( const PathNode* node = prevNode->getNextOptimized(&segmentDirNorm, &segmentLength); - node != NULL; + node != nullptr; node = node->getNextOptimized(&segmentDirNorm, &segmentLength) ) { const Coord3D* prevNodePos = prevNode->getPosition(); @@ -828,7 +828,7 @@ void Path::computePointOnPath( else if (alongPathDist > segmentLength) { // projected point is beyond end of segment, use end point - if (node->getNextOptimized() == NULL) + if (node->getNextOptimized() == nullptr) { alongPathDist = segmentLength; pointOnPath = *nodePos; @@ -1044,7 +1044,7 @@ void Path::computePointOnPath( */ Real Path::computeFlightDistToGoal( const Coord3D *pos, Coord3D& goalPos ) { - if (m_path == NULL) + if (m_path == nullptr) { goalPos.x = 0.0f; goalPos.y = 0.0f; @@ -1099,8 +1099,8 @@ Real Path::computeFlightDistToGoal( const Coord3D *pos, Coord3D& goalPos ) } //----------------------------------------------------------------------------------- -PathfindCellInfo *PathfindCellInfo::s_infoArray = NULL; -PathfindCellInfo *PathfindCellInfo::s_firstFree = NULL; +PathfindCellInfo *PathfindCellInfo::s_infoArray = nullptr; +PathfindCellInfo *PathfindCellInfo::s_firstFree = nullptr; #if RETAIL_COMPATIBLE_PATHFINDING // TheSuperHackers @info This variable is here so the code will run down the retail compatible path till a failure mode is hit @@ -1111,8 +1111,8 @@ Bool s_forceCleanCells = false; void PathfindCellInfo::forceCleanPathFindCellInfos() { for (Int i = 0; i < CELL_INFOS_TO_ALLOCATE - 1; i++) { - s_infoArray[i].m_nextOpen = NULL; - s_infoArray[i].m_prevOpen = NULL; + s_infoArray[i].m_nextOpen = nullptr; + s_infoArray[i].m_prevOpen = nullptr; s_infoArray[i].m_open = FALSE; s_infoArray[i].m_closed = FALSE; } @@ -1121,8 +1121,8 @@ void PathfindCellInfo::forceCleanPathFindCellInfos() void Pathfinder::forceCleanCells() { PathfindCellInfo::forceCleanPathFindCellInfos(); - m_openList = NULL; - m_closedList = NULL; + m_openList = nullptr; + m_closedList = nullptr; for (int j = 0; j <= m_extent.hi.y; ++j) { for (int i = 0; i <= m_extent.hi.x; ++i) { @@ -1141,7 +1141,7 @@ void PathfindCellInfo::allocateCellInfos(void) { releaseCellInfos(); s_infoArray = MSGNEW("PathfindCellInfo") PathfindCellInfo[CELL_INFOS_TO_ALLOCATE]; // pool[]ify - s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_pathParent = NULL; + s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_pathParent = nullptr; s_infoArray[CELL_INFOS_TO_ALLOCATE-1].m_isFree = true; s_firstFree = s_infoArray; for (Int i=0; im_cell = cell; info->m_pos = pos; - info->m_nextOpen = NULL; - info->m_prevOpen = NULL; - info->m_pathParent = NULL; + info->m_nextOpen = nullptr; + info->m_prevOpen = nullptr; + info->m_pathParent = nullptr; info->m_costSoFar = 0; info->m_totalCost = 0; info->m_open = 0; @@ -1219,7 +1219,7 @@ void PathfindCellInfo::releaseACellInfo(PathfindCellInfo *theInfo) /** * Constructor */ -PathfindCell::PathfindCell( void ) :m_info(NULL) +PathfindCell::PathfindCell( void ) :m_info(nullptr) { reset(); } @@ -1230,7 +1230,7 @@ PathfindCell::PathfindCell( void ) :m_info(NULL) PathfindCell::~PathfindCell( void ) { if (m_info) PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; static Bool warn = true; if (warn) { warn = false; @@ -1251,7 +1251,7 @@ void PathfindCell::reset( ) if (m_info) { m_info->m_obstacleID = INVALID_ID; PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; } m_connectsToLayer = LAYER_INVALID; m_layer = LAYER_GROUND; @@ -1264,9 +1264,9 @@ void PathfindCell::reset( ) Bool PathfindCell::startPathfind( PathfindCell *goalCell ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; - m_info->m_pathParent = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; + m_info->m_pathParent = nullptr; m_info->m_costSoFar = 0; // start node, no cost to get here m_info->m_totalCost = 0; if (goalCell) { @@ -1312,7 +1312,7 @@ void PathfindCell::setParentCellHierarchical( PathfindCell* parent ) void PathfindCell::clearParentCell( void ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); - m_info->m_pathParent = NULL; + m_info->m_pathParent = nullptr; } @@ -1323,7 +1323,7 @@ Bool PathfindCell::allocateInfo( const ICoord2D &pos ) { if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); - return (m_info != NULL); + return (m_info != nullptr); } return true; } @@ -1341,7 +1341,7 @@ void PathfindCell::releaseInfo(void) #endif { if (m_info) { - m_info->m_pathParent = NULL; + m_info->m_pathParent = nullptr; } } @@ -1353,8 +1353,8 @@ void PathfindCell::releaseInfo(void) return; } - DEBUG_ASSERTCRASH(m_info->m_prevOpen==NULL && m_info->m_nextOpen==NULL, ("Shouldn't be linked.")); - DEBUG_ASSERTCRASH(m_info->m_open==NULL && m_info->m_closed==NULL, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_prevOpen==nullptr && m_info->m_nextOpen==nullptr, ("Shouldn't be linked.")); + DEBUG_ASSERTCRASH(m_info->m_open==0 && m_info->m_closed==0, ("Shouldn't be linked.")); DEBUG_ASSERTCRASH(m_info->m_goalUnitID==INVALID_ID && m_info->m_posUnitID==INVALID_ID, ("Shouldn't be occupied.")); DEBUG_ASSERTCRASH(m_info->m_goalAircraftID==INVALID_ID , ("Shouldn't be occupied by aircraft.")); if (m_info->m_prevOpen || m_info->m_nextOpen || m_info->m_open || m_info->m_closed) { @@ -1363,7 +1363,7 @@ void PathfindCell::releaseInfo(void) } PathfindCellInfo::releaseACellInfo(m_info); - m_info = NULL; + m_info = nullptr; } @@ -1559,16 +1559,16 @@ PathfindCell *PathfindCell::putOnSortedOpenList( PathfindCell *list ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); DEBUG_ASSERTCRASH(m_info->m_closed==FALSE && m_info->m_open==FALSE, ("Serious error - Invalid flags. jba")); - if (list == NULL) + if (list == nullptr) { list = this; - m_info->m_prevOpen = NULL; - m_info->m_nextOpen = NULL; + m_info->m_prevOpen = nullptr; + m_info->m_nextOpen = nullptr; } else { // insertion sort - PathfindCell *c, *lastCell = NULL; + PathfindCell *c, *lastCell = nullptr; #if RETAIL_COMPATIBLE_PATHFINDING // TheSuperHackers @bugfix In the retail compatible pathfinding, on rare ocassions, we get stuck in an infinite loop // External code should pickup on the bad behaviour and cleanup properly, but we need to explicitly break out here @@ -1606,7 +1606,7 @@ PathfindCell *PathfindCell::putOnSortedOpenList( PathfindCell *list ) // append after "lastCell" - end of list lastCell->m_info->m_nextOpen = this->m_info; m_info->m_prevOpen = lastCell->m_info; - m_info->m_nextOpen = NULL; + m_info->m_nextOpen = nullptr; } } @@ -1631,8 +1631,8 @@ PathfindCell *PathfindCell::removeFromOpenList( PathfindCell *list ) list = getNextOpen(); m_info->m_open = false; - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; return list; } @@ -1662,11 +1662,11 @@ Int PathfindCell::releaseOpenList( PathfindCell *list ) if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; } else { - list = NULL; + list = nullptr; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); - curInfo->m_nextOpen = NULL; - curInfo->m_prevOpen = NULL; + curInfo->m_nextOpen = nullptr; + curInfo->m_prevOpen = nullptr; curInfo->m_open = FALSE; cur->releaseInfo(); } @@ -1697,11 +1697,11 @@ Int PathfindCell::releaseClosedList( PathfindCell *list ) if (curInfo->m_nextOpen) { list = curInfo->m_nextOpen->m_cell; } else { - list = NULL; + list = nullptr; } DEBUG_ASSERTCRASH(cur == curInfo->m_cell, ("Bad backpointer in PathfindCellInfo")); - curInfo->m_nextOpen = NULL; - curInfo->m_prevOpen = NULL; + curInfo->m_nextOpen = nullptr; + curInfo->m_prevOpen = nullptr; curInfo->m_closed = FALSE; cur->releaseInfo(); } @@ -1719,8 +1719,8 @@ PathfindCell *PathfindCell::putOnClosedList( PathfindCell *list ) m_info->m_closed = FALSE; m_info->m_closed = TRUE; - m_info->m_prevOpen = NULL; - m_info->m_nextOpen = list?list->m_info:NULL; + m_info->m_prevOpen = nullptr; + m_info->m_nextOpen = list?list->m_info:nullptr; if (list) list->m_info->m_prevOpen = this->m_info; @@ -1744,8 +1744,8 @@ PathfindCell *PathfindCell::removeFromClosedList( PathfindCell *list ) list = getNextOpen(); m_info->m_closed = false; - m_info->m_nextOpen = NULL; - m_info->m_prevOpen = NULL; + m_info->m_nextOpen = nullptr; + m_info->m_prevOpen = nullptr; return list; } @@ -1796,7 +1796,7 @@ UnsignedInt PathfindCell::costSoFar( PathfindCell *parent ) { DEBUG_ASSERTCRASH(m_info, ("Has to have info.")); // very first node in path - no turns, no cost - if (parent == NULL) + if (parent == nullptr) return 0; // add in number of turns in path so far @@ -2039,10 +2039,10 @@ inline void applyBlockZone(PathfindCell &targetCell, const PathfindCell &sourceC //------------------------ ZoneBlock ------------------------------- ZoneBlock::ZoneBlock() : m_firstZone(0), m_numZones(0), -m_groundCliffZones(NULL), -m_groundWaterZones(NULL), -m_groundRubbleZones(NULL), -m_crusherZones(NULL), +m_groundCliffZones(nullptr), +m_groundWaterZones(nullptr), +m_groundRubbleZones(nullptr), +m_crusherZones(nullptr), m_zonesAllocated(0), m_interactsWithBridge(FALSE) { @@ -2060,16 +2060,16 @@ ZoneBlock::~ZoneBlock() void ZoneBlock::freeZones(void) { delete [] m_groundCliffZones; - m_groundCliffZones = NULL; + m_groundCliffZones = nullptr; delete [] m_groundWaterZones; - m_groundWaterZones = NULL; + m_groundWaterZones = nullptr; delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; + m_groundRubbleZones = nullptr; delete [] m_crusherZones; - m_crusherZones = NULL; + m_crusherZones = nullptr; } /* Allocate zone equivalency arrays large enough to hold required entries. If the arrays are already @@ -2210,7 +2210,7 @@ zoneStorageType ZoneBlock::getEffectiveZone( LocomotorSurfaceTypeMask acceptable large enough, just return. */ void ZoneBlock::allocateZones(void) { - if (m_zonesAllocated>m_numZones && m_groundCliffZones!=NULL) { + if (m_zonesAllocated>m_numZones && m_groundCliffZones!=nullptr) { return; } freeZones(); @@ -2236,14 +2236,14 @@ void ZoneBlock::allocateZones(void) //------------------------ PathfindZoneManager ------------------------------- PathfindZoneManager::PathfindZoneManager() : m_maxZone(0), m_nextFrameToCalculateZones(0), -m_groundCliffZones(NULL), -m_groundWaterZones(NULL), -m_groundRubbleZones(NULL), -m_terrainZones(NULL), -m_crusherZones(NULL), -m_hierarchicalZones(NULL), -m_blockOfZoneBlocks(NULL), -m_zoneBlocks(NULL), +m_groundCliffZones(nullptr), +m_groundWaterZones(nullptr), +m_groundRubbleZones(nullptr), +m_terrainZones(nullptr), +m_crusherZones(nullptr), +m_hierarchicalZones(nullptr), +m_blockOfZoneBlocks(nullptr), +m_zoneBlocks(nullptr), m_zonesAllocated(0) { m_zoneBlockExtent.x = 0; @@ -2259,22 +2259,22 @@ PathfindZoneManager::~PathfindZoneManager() void PathfindZoneManager::freeZones() { delete [] m_groundCliffZones; - m_groundCliffZones = NULL; + m_groundCliffZones = nullptr; delete [] m_groundWaterZones; - m_groundWaterZones = NULL; + m_groundWaterZones = nullptr; delete [] m_groundRubbleZones; - m_groundRubbleZones = NULL; + m_groundRubbleZones = nullptr; delete [] m_terrainZones; - m_terrainZones = NULL; + m_terrainZones = nullptr; delete [] m_crusherZones; - m_crusherZones = NULL; + m_crusherZones = nullptr; delete [] m_hierarchicalZones; - m_hierarchicalZones = NULL; + m_hierarchicalZones = nullptr; m_zonesAllocated = 0; } @@ -2282,10 +2282,10 @@ void PathfindZoneManager::freeZones() void PathfindZoneManager::freeBlocks() { delete [] m_blockOfZoneBlocks; - m_blockOfZoneBlocks = NULL; + m_blockOfZoneBlocks = nullptr; delete [] m_zoneBlocks; - m_zoneBlocks = NULL; + m_zoneBlocks = nullptr; m_zoneBlockExtent.x = 0; m_zoneBlockExtent.y = 0; @@ -2295,7 +2295,7 @@ void PathfindZoneManager::freeBlocks() large enough, just return. */ void PathfindZoneManager::allocateZones(void) { - if (m_zonesAllocated>m_maxZone && m_groundCliffZones!=NULL) { + if (m_zonesAllocated>m_maxZone && m_groundCliffZones!=nullptr) { return; } freeZones(); @@ -2665,7 +2665,7 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye extern void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color); RGBColor color; memset(&color, 0, sizeof(Color)); - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); for( j=0; j0) return false; - if (m_bridge==NULL) return true; + if (m_bridge==nullptr) return true; return false; } @@ -3202,7 +3202,7 @@ void PathfindLayer::doDebugIcons(void) { */ Bool PathfindLayer::init(Bridge *theBridge, PathfindLayerEnum layer) { - if (m_bridge!=NULL) return false; + if (m_bridge!=nullptr) return false; m_bridge = theBridge; m_layer = layer; m_destroyed = false; @@ -3214,7 +3214,7 @@ Bool PathfindLayer::init(Bridge *theBridge, PathfindLayerEnum layer) */ void PathfindLayer::allocateCells(const IRegion2D *extent) { - if (m_bridge == NULL) return; + if (m_bridge == nullptr) return; Region2D bridgeBounds = *m_bridge->getBounds(); Int maxX, maxY; m_xOrigin = REAL_TO_INT_FLOOR((bridgeBounds.lo.x-PATHFIND_CELL_SIZE/100)/PATHFIND_CELL_SIZE); @@ -3262,7 +3262,7 @@ void PathfindLayer::allocateCellsForWallLayer(const IRegion2D *extent, ObjectID for (i=0; ifindObjectByID(wallPieces[i]); Region2D objBounds; - if (obj==NULL) continue; + if (obj==nullptr) continue; obj->getGeometryInfo().get2DBounds(*obj->getPosition(), obj->getOrientation(), objBounds); if (first) { bridgeBounds = objBounds; @@ -3395,7 +3395,7 @@ void PathfindLayer::classifyWallCells(ObjectID *wallPieces, Int numPieces) { DEBUG_ASSERTCRASH(m_layer==LAYER_WALL, ("Wrong layer for wall.")); if (m_layer != LAYER_WALL) return; - if (m_layerCells == NULL) return; + if (m_layerCells == nullptr) return; Int i, j; for (i=0; i=m_width) return NULL; - if (y<0 || y>=m_height) return NULL; + if (x<0 || x>=m_width) return nullptr; + if (y<0 || y>=m_height) return nullptr; PathfindCell *cell = &m_layerCells[x][y]; if (cell->getType() == PathfindCell::CELL_IMPASSABLE) { - return NULL; // Impassable cells are ignored. + return nullptr; // Impassable cells are ignored. } return cell; } @@ -3579,7 +3579,7 @@ void PathfindLayer::classifyLayerMapCell( Int i, Int j , PathfindCell *cell, Bri if (!(cell->getConnectLayer()==LAYER_GROUND) ) { // Check for bridge clearance. If the ground isn't 1 pathfind cells below, mark impassable. Real groundHeight = TheTerrainLogic->getLayerHeight( center.x, center.y, LAYER_GROUND ); - Real bridgeHeight = theBridge->getBridgeHeight( ¢er, NULL ); + Real bridgeHeight = theBridge->getBridgeHeight( ¢er, nullptr ); if (groundHeight+LAYER_Z_CLOSE_ENOUGH_F > bridgeHeight) { PathfindCell *groundCell = TheAI->pathfinder()->getCell(LAYER_GROUND,i, j); if (!(groundCell->getType()==PathfindCell::CELL_OBSTACLE)) { @@ -3597,7 +3597,7 @@ Bool PathfindLayer::isPointOnWall(ObjectID *wallPieces, Int numPieces, const Coo Int i; for (i=0; ifindObjectByID(wallPieces[i]); - if (obj==NULL) continue; + if (obj==nullptr) continue; Real major = obj->getGeometryInfo().getMajorRadius(); Real minor = (obj->getGeometryInfo().getGeomType() == GEOMETRY_SPHERE) ? obj->getGeometryInfo().getMajorRadius() : obj->getGeometryInfo().getMinorRadius(); @@ -3668,9 +3668,9 @@ void PathfindLayer::classifyWallMapCell( Int i, Int j , PathfindCell *cell, Obje //----------------------- Pathfinder --------------------------------------- -Pathfinder::Pathfinder( void ) :m_map(NULL) +Pathfinder::Pathfinder( void ) :m_map(nullptr) { - debugPath = NULL; + debugPath = nullptr; PathfindCellInfo::allocateCellInfos(); reset(); } @@ -3686,10 +3686,10 @@ void Pathfinder::reset( void ) DEBUG_LOG(("Pathfind cell is %d bytes, PathfindCellInfo is %d bytes", sizeof(PathfindCell), sizeof(PathfindCellInfo))); delete [] m_blockOfMapCells; - m_blockOfMapCells = NULL; + m_blockOfMapCells = nullptr; delete [] m_map; - m_map = NULL; + m_map = nullptr; Int i; for (i=0; i<=LAYER_LAST; i++) { @@ -3699,8 +3699,8 @@ void Pathfinder::reset( void ) // reset the pathfind grid m_extent.lo.x=m_extent.lo.y=m_extent.hi.x=m_extent.hi.y=0; m_logicalExtent.lo.x=m_logicalExtent.lo.y=m_logicalExtent.hi.x=m_logicalExtent.hi.y=0; - m_openList = NULL; - m_closedList = NULL; + m_openList = nullptr; + m_closedList = nullptr; m_ignoreObstacleID = INVALID_ID; m_isTunneling = false; @@ -3716,7 +3716,7 @@ void Pathfinder::reset( void ) debugPathPos.z = 0.0f; deleteInstance(debugPath); - debugPath = NULL; + debugPath = nullptr; m_frameToShowObstacles = 0; @@ -3765,7 +3765,7 @@ void Pathfinder::removeWallPiece(Object *wallPiece) { // sanity - if( wallPiece == NULL ) + if( wallPiece == nullptr ) return; // find entry @@ -4300,7 +4300,7 @@ void Pathfinder::newMap( void ) bounds.hi.y--; Bool dataAllocated = false; if (m_extent.hi.x==bounds.hi.x && m_extent.hi.y==bounds.hi.y) { - if (m_blockOfMapCells != NULL && m_map!=NULL) { + if (m_blockOfMapCells != nullptr && m_map!=nullptr) { dataAllocated = true; } } @@ -4308,7 +4308,7 @@ void Pathfinder::newMap( void ) // so the second time through, dataAllocated==TRUE, so we skip the allocate. if (!dataAllocated) { m_extent = bounds; - DEBUG_ASSERTCRASH(m_map == NULL, ("Can't reallocate pathfind cells.")); + DEBUG_ASSERTCRASH(m_map == nullptr, ("Can't reallocate pathfind cells.")); m_zoneManager.allocateBlocks(m_extent); // Allocate cells. m_blockOfMapCells = MSGNEW("PathfindMapCells") PathfindCell[(bounds.hi.x+1)*(bounds.hi.y+1)]; @@ -4323,7 +4323,7 @@ void Pathfinder::newMap( void ) } } if (m_numWallPieces>0) { - m_layers[LAYER_WALL].init(NULL, LAYER_WALL); + m_layers[LAYER_WALL].init(nullptr, LAYER_WALL); m_layers[LAYER_WALL].allocateCellsForWallLayer(&m_extent, m_wallPieces, m_numWallPieces); } } @@ -4443,7 +4443,7 @@ void Pathfinder::debugShowSearch( Bool pathFound ) RGBColor color; color.red = color.blue = color.green = 1; if (!pathFound) { - addIcon(NULL, 0, 0, color); // erase. + addIcon(nullptr, 0, 0, color); // erase. } for( s = m_openList; s; s=s->getNextOpen() ) @@ -4527,10 +4527,10 @@ Bool Pathfinder::validMovementTerrain( PathfindLayerEnum layer, const Locomotor* Int x = REAL_TO_INT_FLOOR(pos->x/PATHFIND_CELL_SIZE); Int y = REAL_TO_INT_FLOOR(pos->y/PATHFIND_CELL_SIZE); - PathfindCell *toCell = NULL; + PathfindCell *toCell = nullptr; toCell = getCell( layer, x, y ); - if (toCell == NULL) + if (toCell == nullptr) return false; // Only do terrain, not obstacle cells. jba. if (toCell->getType()==PathfindCell::CELL_OBSTACLE) return true; @@ -4552,7 +4552,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { Int count = 0; if (m_openList) { count += PathfindCell::releaseOpenList(m_openList); - m_openList = NULL; + m_openList = nullptr; } #if RETAIL_COMPATIBLE_PATHFINDING @@ -4567,7 +4567,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { if (m_closedList) { count += PathfindCell::releaseClosedList(m_closedList); - m_closedList = NULL; + m_closedList = nullptr; } #if RETAIL_COMPATIBLE_PATHFINDING @@ -4589,7 +4589,7 @@ void Pathfinder::cleanOpenAndClosedLists(void) { Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, PathfindCell *toCell, PathfindCell *fromCell ) { - if (toCell == NULL) + if (toCell == nullptr) return false; // check if the destination cell is classified as an obstacle, @@ -4616,7 +4616,7 @@ Bool Pathfinder::validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask */ Bool Pathfinder::checkDestination(const Object *obj, Int cellX, Int cellY, PathfindLayerEnum layer, Int iRadius, Bool centerInCell) { - // If obj==NULL, means we are checking for any ground units present. jba. + // If obj==nullptr, means we are checking for any ground units present. jba. Int numCellsAbove = iRadius; if (centerInCell) numCellsAbove++; Bool checkForAircraft = false; @@ -4748,7 +4748,7 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) } Bool check = false; - Object *unit = NULL; + Object *unit = nullptr; if (flags == PathfindCell::UNIT_PRESENT_MOVING || flags == PathfindCell::UNIT_GOAL_OTHER_MOVING) { unit = TheGameLogic->findObjectByID(posUnit); // order matters: we want to know if I consider it to be an ally, not vice versa @@ -4763,7 +4763,7 @@ Bool Pathfinder::checkForMovement(const Object *obj, TCheckMovementInfo &info) check = true; unit = TheGameLogic->findObjectByID(posUnit); } - if (check && unit!=NULL) { + if (check && unit!=nullptr) { if (obj->getAIUpdateInterface() && obj->getAIUpdateInterface()->getIgnoredObstacleID()==unit->getID()) { // Don't check if it's the ignored obstacle. check = false; @@ -4918,7 +4918,7 @@ Bool Pathfinder::checkForAdjust(Object *obj, const LocomotorSet& locomotorSet, B { Coord3D adjustDest; PathfindCell *cellP = getCell(layer, cellX, cellY); - if (cellP==NULL) return false; + if (cellP==nullptr) return false; if (cellP && cellP->getType() == PathfindCell::CELL_CLIFF) { return false; // no final destinations on cliffs. } @@ -4968,7 +4968,7 @@ Bool Pathfinder::checkForLanding(Int cellX, Int cellY, PathfindLayerEnum layer, { Coord3D adjustDest; PathfindCell *cellP = getCell(layer, cellX, cellY); - if (cellP==NULL) return false; + if (cellP==nullptr) return false; switch (cellP->getType()) { case PathfindCell::CELL_CLIFF: @@ -4976,7 +4976,7 @@ Bool Pathfinder::checkForLanding(Int cellX, Int cellY, PathfindLayerEnum layer, case PathfindCell::CELL_IMPASSABLE: return false; // no final destinations on cliffs, water, etc. } - if (checkDestination(NULL, cellX, cellY, layer, iRadius, center)) { + if (checkDestination(nullptr, cellX, cellY, layer, iRadius, center)) { adjustCoordToCell(cellX, cellY, center, adjustDest, cellP->getLayer()); *dest = adjustDest; return true; @@ -5133,7 +5133,7 @@ Bool Pathfinder::adjustDestination(Object *obj, const LocomotorSet& locomotorSet } if (groupDest) { // Didn't work, so just do simple adjust. - return(adjustDestination(obj, locomotorSet, dest, NULL)); + return(adjustDestination(obj, locomotorSet, dest, nullptr)); } return false; } @@ -5272,7 +5272,7 @@ Bool Pathfinder::adjustToPossibleDestination(Object *obj, const LocomotorSet& lo layer = obj->getLayer(); } PathfindCell *parentCell = getClippedCell( layer, &from ); - if (parentCell == NULL) { + if (parentCell == nullptr) { return false; } @@ -5403,7 +5403,7 @@ void Pathfinder::doDebugIcons(void) { RGBColor color; color.red = color.green = color.blue = 0; - addIcon(NULL, 0, 0, color); // clear. + addIcon(nullptr, 0, 0, color); // clear. Coord3D topLeftCorner; Bool showCells = TheGlobalData->m_debugAI==AI_DEBUG_CELLS; Int i; @@ -6044,7 +6044,7 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const const Coord3D *rawTo) { if (!clientSafeQuickDoesPathExist(locomotorSet, from, rawTo)) { - return NULL; + return nullptr; } Bool isHuman = true; if (obj && obj->getControllingPlayer() && (obj->getControllingPlayer()->getPlayerType()==PLAYER_COMPUTER)) { @@ -6060,11 +6060,11 @@ Path *Pathfinder::findPath( Object *obj, const LocomotorSet& locomotorSet, const } Path *pat = internalFindPath(obj, locomotorSet, from, rawTo); - if (pat!=NULL) { + if (pat!=nullptr) { return pat; } - return NULL; + return nullptr; } /** * Find a short, valid path between given locations. @@ -6094,11 +6094,11 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -6116,15 +6116,15 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, to ); - if (goalCell == NULL) { - return NULL; + if (goalCell == nullptr) { + return nullptr; } ICoord2D cell; worldToCell( to, &cell ); if (!checkDestination(obj, cell.x, cell.y, destinationLayer, radius, centerInCell)) { - return NULL; + return nullptr; } // determine start cell ICoord2D startCellNdx; @@ -6134,20 +6134,20 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe layer = obj->getLayer(); } PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { - return NULL; + if (parentCell == nullptr) { + return nullptr; } ICoord2D pos2d; worldToCell(to, &pos2d); if (!goalCell->allocateInfo(pos2d)) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); if (!parentCell->allocateInfo(pos2d)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } // @@ -6171,7 +6171,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe goalCell->releaseInfo(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } if (goalCell->isObstaclePresent(m_ignoreObstacleID) || m_isTunneling) { @@ -6188,7 +6188,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe //DEBUG_LOG(("Intense Debug Info - Pathfind Zone screen failed-cannot reach desired location.")); goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } // sanity check - if destination is invalid, can't path there @@ -6196,7 +6196,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_isTunneling = false; goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } // sanity check - if source is invalid, we have to cheat @@ -6211,7 +6211,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int cellCount = 0; @@ -6219,7 +6219,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -6286,7 +6286,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -6350,7 +6350,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** @@ -6424,7 +6424,7 @@ Int Pathfinder::clearCellForDiameter(Bool crusher, Int cellX, Int cellY, Pathfin */ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Int pathDiameter ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -6473,7 +6473,7 @@ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, Pathfi */ Path *Pathfinder::buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -6549,7 +6549,7 @@ struct MADStruct return 0; // It's the one we are ignoring. } Object *otherObj = TheGameLogic->findObjectByID(to->getPosUnit()); - if (otherObj==NULL) return 0; + if (otherObj==nullptr) return 0; if (d->obj->getRelationship(otherObj)!=ALLIES) { return 0; // Only move allies. } @@ -6662,11 +6662,11 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -6707,37 +6707,37 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, cell = newCell; } if (offset >= MAX_OFFSET) { - return NULL; + return nullptr; } } // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); - if (goalCell == NULL) { - return NULL; + if (goalCell == nullptr) { + return nullptr; } if (!goalCell->allocateInfo(cell)) { - return NULL; + return nullptr; } // determine start cell ICoord2D startCellNdx; PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); - if (parentCell == NULL) { + if (parentCell == nullptr) { #if RETAIL_COMPATIBLE_PATHFINDING if (s_useFixedPathfinding) #endif { goalCell->releaseInfo(); } - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } @@ -6752,7 +6752,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, if ( zone1 != zone2) { goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } parentCell->startPathfind(goalCell); @@ -6760,7 +6760,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // TheSuperHackers @fix helmutbuhler This was originally uninitialized and in the loop below. #if RETAIL_COMPATIBLE_CRC @@ -6772,7 +6772,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, // until goal is found. // Int cellCount = 0; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -6858,7 +6858,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; if ((newCell->getLayer()==LAYER_GROUND) && !m_zoneManager.isPassable(newCellCoord.x, newCellCoord.y)) { @@ -6965,7 +6965,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -7012,7 +7012,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from, parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** @@ -7152,11 +7152,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if (rawTo->x == 0.0f && rawTo->y == 0.0f) { DEBUG_LOG(("Attempting pathfind to 0,0, generally a bug.")); - return NULL; + return nullptr; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); if (m_isMapReady == false) { - return NULL; + return nullptr; } Coord3D adjustTo = *rawTo; @@ -7174,11 +7174,11 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu // determine goal cell PathfindCell *goalCell = getCell( destinationLayer, cell.x, cell.y ); if (!goalCell) { - return NULL; + return nullptr; } if (!goalCell->allocateInfo(cell)) { - return NULL; + return nullptr; } // determine start cell @@ -7186,14 +7186,14 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu PathfindLayerEnum layer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getClippedCell( layer,&clipFrom ); if (!parentCell) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &startCellNdx); if (!parentCell->allocateInfo(startCellNdx)) { goalCell->releaseInfo(); - return NULL; + return nullptr; } } @@ -7205,13 +7205,13 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if ( zone1 != zone2) { goalCell->releaseInfo(); parentCell->releaseInfo(); - return NULL; + return nullptr; } parentCell->startPathfind(goalCell); // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int cellCount = 0; @@ -7259,7 +7259,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } startCell->setParentCellHierarchical(parentCell); cellCount++; @@ -7286,7 +7286,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } curCost = cell->costToHierGoal(parentCell); remCost = cell->costToHierGoal(goalCell); @@ -7298,14 +7298,14 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu } } - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistSqr = sqr(HUGE_DIST); // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -7389,7 +7389,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } startCell->setParentCellHierarchical(parentCell); if (!startCell->getClosed() && !startCell->getOpen()) { @@ -7410,7 +7410,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu cleanOpenAndClosedLists(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } cell->setParentCellHierarchical(startCell); @@ -7654,7 +7654,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu RGBColor color; color.blue = 0; color.red = color.green = 1; - addIcon(NULL, 0, 0, color); + addIcon(nullptr, 0, 0, color); debugShowSearch(false); Coord3D pos; pos = *from; @@ -7702,7 +7702,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu goalCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -7876,17 +7876,17 @@ Bool Pathfinder::slowDoesPathExist( Object *obj, ObjectID ignoreObject) { AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) { + if (ai==nullptr) { return false; } const LocomotorSet &locoSet = ai->getLocomotorSet(); m_ignoreObstacleID = ignoreObject; Path *path = findPath(obj, locoSet, from, to); m_ignoreObstacleID = INVALID_ID; - Bool found = (path!=NULL); + Bool found = (path!=nullptr); deleteInstance(path); - path = NULL; + path = nullptr; return found; } @@ -7916,7 +7916,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum layer, const Coord3D *groupDest) { //CRCDEBUG_LOG(("Pathfinder::pathDestination()")); - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return false; if (!obj) return false; @@ -7924,7 +7924,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet Coord3D adjustTo = *groupDest; Coord3D *to = &adjustTo; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -7932,13 +7932,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum desiredLayer = TheTerrainLogic->getLayerForDestination(dest); // determine desired PathfindCell *desiredCell = getClippedCell( desiredLayer, dest ); - if (desiredCell == NULL) + if (desiredCell == nullptr) return FALSE; PathfindLayerEnum goalLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( goalLayer, to ); - if (goalCell == NULL) + if (goalCell == nullptr) return FALSE; @@ -7954,7 +7954,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet ICoord2D startCellNdx; worldToCell(dest, &startCellNdx); PathfindCell *parentCell = getCell( layer, startCellNdx.x, startCellNdx.y ); - if (parentCell == NULL) + if (parentCell == nullptr) return FALSE; ICoord2D pos2d; worldToCell(to, &pos2d); @@ -7974,7 +7974,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet } } - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistanceSqr = FLT_MAX; Coord3D closestPos; @@ -7990,13 +7990,13 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -8054,7 +8054,7 @@ Bool Pathfinder::pathDestination( Object *obj, const LocomotorSet& locomotorSet newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; // check if this neighbor cell is already on the open (waiting to be tried) @@ -8172,12 +8172,12 @@ struct TightenPathStruct /*static*/ Int Pathfinder::tightenPathCallback(Pathfinder* pathfinder, PathfindCell* from, PathfindCell* to, Int to_x, Int to_y, void* userData) { TightenPathStruct* d = (TightenPathStruct*)userData; - if (from == NULL || to==NULL) return 0; + if (from == nullptr || to==nullptr) return 0; if (d->layer != to->getLayer()) { return 0; // abort. } Coord3D pos; - if (!TheAI->pathfinder()->checkForAdjust(d->obj, *d->locomotorSet, true, to_x, to_y, to->getLayer(), d->radius, d->center, &pos, NULL)) + if (!TheAI->pathfinder()->checkForAdjust(d->obj, *d->locomotorSet, true, to_x, to_y, to->getLayer(), d->radius, d->center, &pos, nullptr)) { return 0; // bail early } @@ -8210,7 +8210,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con const Coord3D *rawTo) { //CRCDEBUG_LOG(("Pathfinder::checkPathCost()")); - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return 0; enum {MAX_COST = 0x7fff0000}; if (!obj) return MAX_COST; @@ -8218,7 +8218,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con Coord3D adjustTo = *rawTo; Coord3D *to = &adjustTo; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -8226,7 +8226,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con PathfindLayerEnum goalLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( goalLayer, to ); - if (goalCell == NULL) + if (goalCell == nullptr) return MAX_COST; @@ -8239,7 +8239,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con worldToCell(from, &startCellNdx); PathfindLayerEnum fromLayer = TheTerrainLogic->getLayerForDestination(from); PathfindCell *parentCell = getCell( fromLayer, from ); - if (parentCell == NULL) + if (parentCell == nullptr) return MAX_COST; ICoord2D pos2d; worldToCell(to, &pos2d); @@ -8266,13 +8266,13 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -8338,7 +8338,7 @@ Int Pathfinder::checkPathCost(Object *obj, const LocomotorSet& locomotorSet, con newCell = getCell(parentCell->getLayer(), newCellCoord.x, newCellCoord.y ); // check if cell is on the map - if (newCell == NULL) + if (newCell == nullptr) continue; // check if this neighbor cell is already on the open (waiting to be tried) @@ -8464,14 +8464,14 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet if (locomotorSet.getValidSurfaces() == 0) { DEBUG_CRASH(("Attempting to path immobile unit.")); - return NULL; + return nullptr; } - if (m_isMapReady == false) return NULL; + if (m_isMapReady == false) return nullptr; m_isTunneling = false; - if (!obj) return NULL; + if (!obj) return nullptr; Bool canPathThroughUnits = false; if (obj && obj->getAIUpdateInterface()) { @@ -8487,7 +8487,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet adjustTo.x += PATHFIND_CELL_SIZE_F/2; adjustTo.y += PATHFIND_CELL_SIZE_F/2; } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; @@ -8499,11 +8499,11 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(to); // determine goal cell PathfindCell *goalCell = getClippedCell( destinationLayer, to ); - if (goalCell == NULL) - return NULL; + if (goalCell == nullptr) + return nullptr; if (goalCell->getZone()==0 && destinationLayer==LAYER_WALL) { - return NULL; + return nullptr; } Bool goalOnObstacle = false; @@ -8517,7 +8517,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet PathfindCell *ignoreCell = getClippedCell(goalObj->getLayer(), goalObj->getPosition()); if ( (goalCell->getObstacleID()==ignoreCell->getObstacleID()) && (goalCell->getObstacleID() != INVALID_ID) ) { Object* newObstacle = TheGameLogic->findObjectByID(goalCell->getObstacleID()); - if (newObstacle != NULL && newObstacle->isKindOf(KINDOF_FS_AIRFIELD)) + if (newObstacle != nullptr && newObstacle->isKindOf(KINDOF_FS_AIRFIELD)) { m_ignoreObstacleID = goalCell->getObstacleID(); goalOnObstacle = true; @@ -8536,8 +8536,8 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet ICoord2D startCellNdx; worldToCell(from, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &clipFrom ); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), parentCell ) == false) { m_isTunneling = true; // We can't move from our current location. So relax the constraints. @@ -8571,7 +8571,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet ICoord2D pos2d; worldToCell(to, &pos2d); if (!goalCell->allocateInfo(pos2d)) { - return NULL; + return nullptr; } if (parentCell!=goalCell) { worldToCell(&clipFrom, &pos2d); @@ -8582,12 +8582,12 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet { goalCell->releaseInfo(); } - return NULL; + return nullptr; } } parentCell->startPathfind(goalCell); - PathfindCell *closesetCell = NULL; + PathfindCell *closesetCell = nullptr; Real closestDistanceSqr = FLT_MAX; Real closestDistScreenSqr = FLT_MAX; @@ -8595,14 +8595,14 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; Int count = 0; // // Continue search until "open" list is empty, or // until goal is found. // Bool foundGoal = false; - while( m_openList != NULL ) + while( m_openList != nullptr ) { Real dx; Real dy; @@ -8616,7 +8616,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet // success - found a path to the goal if (!goalOnObstacle) { // See if the goal is a valid destination. If not, accept closest cell. - if (closesetCell!=NULL && !canPathThroughUnits && !checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { + if (closesetCell!=nullptr && !canPathThroughUnits && !checkDestination(obj, parentCell->getXIndex(), parentCell->getYIndex(), parentCell->getLayer(), radius, centerInCell)) { foundGoal = true; // Continue processing the open list to find a possibly closer cell. jba. [8/25/2003] continue; @@ -8782,7 +8782,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -8805,7 +8805,7 @@ void Pathfinder::adjustCoordToCell(Int cellX, Int cellY, Bool centerInCell, Coor Path *Pathfinder::buildActualPath( const Object *obj, LocomotorSurfaceTypeMask acceptableSurfaces, const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Bool blocked ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == NULL") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildActualPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -8861,8 +8861,8 @@ void Pathfinder::prependCells( Path *path, const Coord3D *fromPos, // traverse path cells in REVERSE order, creating path in desired order // skip the LAST node, as that will be in the same cell as the unit itself - so use the unit's position Coord3D pos; - PathfindCell *cell, *prevCell = NULL; - Bool goalCellNull = (goalCell->getParentCell()==NULL); + PathfindCell *cell, *prevCell = nullptr; + Bool goalCellNull = (goalCell->getParentCell()==nullptr); for( cell = goalCell; cell->getParentCell(); cell = cell->getParentCell() ) { m_zoneManager.setPassable(cell->getXIndex(), cell->getYIndex(), true); @@ -9025,11 +9025,11 @@ Int Pathfinder::iterateCellsAlongLine( const ICoord2D &start, const ICoord2D &en numpixels = delta_y; // There are more y-values than x-values } - PathfindCell* from = NULL; + PathfindCell* from = nullptr; for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { PathfindCell* to = getCell( layer, x, y ); - if (to==NULL) return 0; + if (to==nullptr) return 0; Int ret = (*proc)(this, from, to, x, y, userData); if (ret != 0) @@ -9043,7 +9043,7 @@ Int Pathfinder::iterateCellsAlongLine( const ICoord2D &start, const ICoord2D &en y += yinc1; // Change the y as appropriate from = to; to = getCell( layer, x, y ); - if (to==NULL) return 0; + if (to==nullptr) return 0; Int ret = (*proc)(this, from, to, x, y, userData); if (ret != 0) return ret; @@ -9064,7 +9064,7 @@ static ObjectID getSlaverID(const Object* o) for (BehaviorModule** update = o->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { return sdu->getSlaverID(); } @@ -9075,7 +9075,7 @@ static ObjectID getSlaverID(const Object* o) static ObjectID getContainerID(const Object* o) { - const Object* container = o ? o->getContainedBy() : NULL; + const Object* container = o ? o->getContainedBy() : nullptr; return container ? container->getID() : INVALID_ID; } @@ -9089,7 +9089,7 @@ struct segmentIntersectsStruct { segmentIntersectsStruct* d = (segmentIntersectsStruct*)userData; - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { Object *obj = TheGameLogic->findObjectByID(to->getObstacleID()); if (obj && obj->isKindOf(KINDOF_AIRCRAFT_PATH_AROUND)) { @@ -9117,7 +9117,7 @@ struct ViewBlockedStruct { const ViewBlockedStruct* d = (const ViewBlockedStruct*)userData; - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { // we never block our own view! @@ -9168,7 +9168,7 @@ struct ViewAttackBlockedStruct d->skipCount--; return 0; } - if (to != NULL && (to->getType() == PathfindCell::CELL_OBSTACLE)) + if (to != nullptr && (to->getType() == PathfindCell::CELL_OBSTACLE)) { // we never block our own view! if (to->isObstaclePresent(d->obj->getID())) @@ -9262,7 +9262,7 @@ Bool Pathfinder::isAttackViewBlockedByObstacle(const Object* attacker, const Coo const Weapon* w = attacker->getCurrentWeapon(); if (attacker->isKindOf(KINDOF_IMMOBILE)) { // Don't take terrain blockage into account, since we can't move around it. jba. - w = NULL; + w = nullptr; } if (w) { @@ -9342,7 +9342,7 @@ Bool Pathfinder::segmentIntersectsTallBuilding(const PathNode *curNode, PathNode *nextNode, ObjectID ignoreBuilding, Coord3D *insertPos1, Coord3D *insertPos2, Coord3D *insertPos3 ) { segmentIntersectsStruct info; - info.theTallBuilding = NULL; + info.theTallBuilding = nullptr; info.ignoreBuilding = ignoreBuilding; Coord3D fromPos = *curNode->getPosition(); @@ -9399,7 +9399,7 @@ Bool Pathfinder::segmentIntersectsTallBuilding(const PathNode *curNode, Bool Pathfinder::circleClipsTallBuilding( const Coord3D *from, const Coord3D *to, Real circleRadius, ObjectID ignoreBuilding, Coord3D *adjustTo) { PartitionFilterAcceptByKindOf filterKindof(MAKE_KINDOF_MASK(KINDOF_AIRCRAFT_PATH_AROUND), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKindof, NULL }; + PartitionFilter *filters[] = { &filterKindof, nullptr }; Object* tallBuilding = ThePartitionManager->getClosestObject(to, circleRadius, FROM_BOUNDINGSPHERE_2D, filters); if (tallBuilding) { Real radius = tallBuilding->getGeometryInfo().getBoundingCircleRadius() + 2*PATHFIND_CELL_SIZE_F; @@ -10062,7 +10062,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Path *pathToAvoid, Object *otherObj2, Path *pathToAvoid2) { if (!m_isMapReady) - return NULL; // Should always be ok. + return nullptr; // Should always be ok. #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); @@ -10083,7 +10083,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, Int radius; getRadiusAndCenter(obj, radius, centerInCell); - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // determine start cell ICoord2D startCellNdx; @@ -10095,10 +10095,10 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, worldToCell(&startPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); if (!parentCell) - return NULL; + return nullptr; if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move it without an ai. - return NULL; + return nullptr; const LocomotorSet& locomotorSet = obj->getAIUpdateInterface()->getLocomotorSet(); @@ -10119,15 +10119,15 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, } if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind(NULL); + parentCell->startPathfind(nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -10139,7 +10139,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, boxHalfWidth += otherRadius*PATHFIND_CELL_SIZE_F; if (otherCenter) boxHalfWidth+=PATHFIND_CELL_SIZE_F/2; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10214,7 +10214,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } @@ -10236,7 +10236,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj, cleanOpenAndClosedLists(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } @@ -10249,7 +10249,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet #ifdef DEBUG_LOGGING Int startTimeMS = ::GetTickCount(); #endif - if (originalPath==NULL) return NULL; + if (originalPath==nullptr) return nullptr; Bool centerInCell; Int radius; getRadiusAndCenter(obj, radius, centerInCell); @@ -10260,7 +10260,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet m_zoneManager.setAllPassable(); - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); enum {CELL_LIMIT = 2000}; // max cells to examine. Int cellCount = 0; @@ -10277,24 +10277,24 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet worldToCell(&startPos, &startCellNdx); //worldToCell(obj->getPosition(), &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), ¤tPosition); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. + return nullptr; // shouldn't happen, but can't move it without an ai. } m_isTunneling = false; if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind( NULL); + parentCell->startPathfind( nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -10307,7 +10307,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { RGBColor color; color.setFromInt(0); - addIcon(NULL, 0,0,color); + addIcon(nullptr, 0,0,color); } #endif @@ -10359,7 +10359,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { parentCell->releaseInfo(); } - return NULL; // no open nodes. + return nullptr; // no open nodes. } PathfindCell *candidateGoal; candidateGoal = getCell(LAYER_GROUND, &goalPos); // just using for cost estimates. @@ -10372,10 +10372,10 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet { parentCell->releaseInfo(); } - return NULL; + return nullptr; } - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10428,7 +10428,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet if (cellCount < CELL_LIMIT) { // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - cellCount += examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + cellCount += examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } } @@ -10457,7 +10457,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet parentCell->releaseInfo(); candidateGoal->releaseInfo(); } - return NULL; + return nullptr; } @@ -10466,7 +10466,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot const Object *victim, const Coord3D* victimPos, const Weapon *weapon ) { if (!m_isMapReady) - return NULL; // Should always be ok. + return nullptr; // Should always be ok. Bool isCrusher = obj ? obj->getCrusherLevel() > 0 : false; Int radius; @@ -10534,7 +10534,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot Int cellCount = 0; - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); Int attackDistance = weapon->getAttackDistance(obj, victim, victimPos); attackDistance += 3*PATHFIND_CELL_SIZE; @@ -10549,18 +10549,18 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot } if (!obj->getAIUpdateInterface()) // shouldn't happen, but can't move without an ai. - return NULL; + return nullptr; worldToCell(&objPos, &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), &objPos ); if (!parentCell) - return NULL; + return nullptr; if (!parentCell->allocateInfo(startCellNdx)) - return NULL; + return nullptr; const PathfindCell *startCell = parentCell; - parentCell->startPathfind(NULL); + parentCell->startPathfind(nullptr); // determine start cell ICoord2D victimCellNdx; @@ -10569,24 +10569,24 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot // determine goal cell PathfindCell *goalCell = getCell( LAYER_GROUND, victimCellNdx.x, victimCellNdx.y ); if (!goalCell) - return NULL; + return nullptr; if (!goalCell->allocateInfo(victimCellNdx)) { - return NULL; + return nullptr; } // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or // until goal is found. // - PathfindCell *closestCell = NULL; + PathfindCell *closestCell = nullptr; Real closestDistanceSqr = FLT_MAX; Bool checkLOS = false; if (!victim) { @@ -10596,7 +10596,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot checkLOS = true; } - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10663,7 +10663,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot // construct and return path if (obj->isKindOf(KINDOF_VEHICLE)) { // Strip backwards. - PathfindCell *lastBlocked = NULL; + PathfindCell *lastBlocked = nullptr; PathfindCell *cur = parentCell; Bool useLargeRadius = false; Int cellLimit = 12; // Magic number, yes I know - jba. It is about 4 * size of an average vehicle width (3 cells) [8/15/2003] @@ -10801,7 +10801,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot parentCell->releaseInfo(); goalCell->releaseInfo(); } - return NULL; + return nullptr; } /** Find a short, valid path to a location that is safe from the repulsors. */ @@ -10809,7 +10809,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor const Coord3D *from, const Coord3D* repulsorPos1, const Coord3D* repulsorPos2, Real repulsorRadius) { //CRCDEBUG_LOG(("Pathfinder::findSafePath()")); - if (m_isMapReady == false) return NULL; // Should always be ok. + if (m_isMapReady == false) return nullptr; // Should always be ok. #if defined(RTS_DEBUG) // Int startTimeMS = ::GetTickCount(); #endif @@ -10826,7 +10826,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor isHuman = false; // computer gets to cheat. } - DEBUG_ASSERTCRASH(m_openList==NULL && m_closedList == NULL, ("Dangling lists.")); + DEBUG_ASSERTCRASH(m_openList== nullptr && m_closedList == nullptr, ("Dangling lists.")); // create unique "mark" values for open and closed cells for this pathfind invocation m_zoneManager.setAllPassable(); @@ -10834,21 +10834,21 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor ICoord2D startCellNdx; worldToCell(obj->getPosition(), &startCellNdx); PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() ); - if (parentCell == NULL) - return NULL; + if (parentCell == nullptr) + return nullptr; if (!obj->getAIUpdateInterface()) { - return NULL; // shouldn't happen, but can't move it without an ai. + return nullptr; // shouldn't happen, but can't move it without an ai. } if (!parentCell->allocateInfo(startCellNdx)) { - return NULL; + return nullptr; } - parentCell->startPathfind( NULL); + parentCell->startPathfind( nullptr); // initialize "open" list to contain start cell m_openList = parentCell; // "closed" list is initially empty - m_closedList = NULL; + m_closedList = nullptr; // // Continue search until "open" list is empty, or @@ -10857,7 +10857,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor Real farthestDistanceSqr = 0; - while( m_openList != NULL ) + while( m_openList != nullptr ) { // take head cell off of open list - it has lowest estimated total path cost parentCell = m_openList; @@ -10880,7 +10880,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor if (distSqr>repulsorDistSqr) { ok = true; } - if (m_openList == NULL && cellCount>0) { + if (m_openList == nullptr && cellCount>0) { ok = true; // exhausted the search space, just take the last cell. } if (distSqr > farthestDistanceSqr) { @@ -10942,7 +10942,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor // Check to see if we can change layers in this cell. checkChangeLayers(parentCell); - cellCount += examineNeighboringCells(parentCell, NULL, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); + cellCount += examineNeighboringCells(parentCell, nullptr, locomotorSet, isHuman, centerInCell, radius, startCellNdx, obj, NO_ATTACK); } @@ -10976,7 +10976,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor cleanOpenAndClosedLists(); parentCell->releaseInfo(); } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 74ed1cf47eb..c69c4217d24 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -158,7 +158,7 @@ void AIPlayer::onStructureProduced( Object *factory, Object *bldg ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *obj = TheGameLogic->findObjectByID( info->getObjectID() ); - if (obj!=NULL) { + if (obj!=nullptr) { if (obj->isKindOf(KINDOF_REBUILD_HOLE)) { RebuildHoleBehaviorInterface *rhbi = RebuildHoleBehavior::getRebuildHoleBehaviorInterfaceFromObject( obj ); if( rhbi ) { @@ -284,7 +284,7 @@ void AIPlayer::queueSupplyTruck( void ) PartitionFilterPlayer f2(m_player, false); // Only find other. PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *supplySource = ThePartitionManager->getClosestObject(¢er, radius, FROM_BOUNDINGSPHERE_2D, filters); if (!supplySource) { @@ -355,7 +355,7 @@ void AIPlayer::queueSupplyTruck( void ) SupplyTruckAIInterface* supplyTruckAI = obj->getAI()->getSupplyTruckAIInterface(); if( supplyTruckAI ) { ObjectID dock = supplyTruckAI->getPreferredDockID(); - if (TheGameLogic->findObjectByID(dock)!=NULL) continue; + if (TheGameLogic->findObjectByID(dock)!=nullptr) continue; if (supplyTruckAI->isCurrentlyFerryingSupplies() || supplyTruckAI->isForcedIntoWantingState()) { // This thinks he is a gatherer, but doesn't have a preferred dock id. @@ -395,7 +395,7 @@ void AIPlayer::queueSupplyTruck( void ) order->m_required = true; order->m_isResourceGatherer =true; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; TeamInQueue *team = newInstance(TeamInQueue); // Put in front of queue. prependTo_TeamBuildQueue(team); @@ -450,7 +450,7 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo { // inst-construct the building - Object *bldg = TheBuildAssistant->buildObjectNow( NULL, + Object *bldg = TheBuildAssistant->buildObjectNow( nullptr, bldgPlan, info->getLocation(), info->getAngle(), @@ -511,20 +511,20 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi { // Find a dozer. Object *dozer = findDozer(info->getLocation()); - if (dozer==NULL) { - return NULL; + if (dozer==nullptr) { + return nullptr; } // Check available funds. Money *money = m_player->getMoney(); if (money->countMoney()calcCostToBuild(m_player)) { - return NULL; + return nullptr; } // construct the building Coord3D pos = *info->getLocation(); pos.z += TheTerrainLogic->getGroundHeight(pos.x, pos.y); if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } Real angle = info->getAngle(); if( TheBuildAssistant->isLocationLegalToBuild( &pos, bldgPlan, angle, @@ -532,7 +532,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi dozer, m_player ) != LBC_OK ) { // If there's enemy units or structures, don't build/rebuild. TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. - return NULL; + return nullptr; } // validate the the position to build at is valid @@ -605,7 +605,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLi BuildAssistant::NO_ENEMY_OBJECT_OVERLAP, dozer, m_player ) == LBC_OK; if (!valid) { - return NULL; + return nullptr; } } @@ -720,7 +720,7 @@ void AIPlayer::processBaseBuilding( void ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg==NULL) { + if (bldg==nullptr) { // got destroyed. ObjectID priorID; priorID = info->getObjectID(); @@ -747,10 +747,10 @@ void AIPlayer::processBaseBuilding( void ) // make sure dozer is working on him. ObjectID builder = bldg->getBuilderID(); Object* myDozer = TheGameLogic->findObjectByID(builder); - if (myDozer==NULL) { + if (myDozer==nullptr) { DEBUG_LOG(("AI's Dozer got killed. Find another dozer.")); myDozer = findDozer(bldg->getPosition()); - if (myDozer==NULL || myDozer->getAI()==NULL) { + if (myDozer==nullptr || myDozer->getAI()==nullptr) { continue; } myDozer->getAI()->aiResumeConstruction(bldg, CMD_FROM_AI); @@ -781,7 +781,7 @@ void AIPlayer::processBaseBuilding( void ) { Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg == NULL) + if (bldg == nullptr) { @@ -887,11 +887,11 @@ void AIPlayer::aiPreTeamDestroy( const Team *deletedTeam ) void AIPlayer::guardSupplyCenter( Team *team, Int minSupplies ) { m_supplySourceAttackCheckFrame = 0; // force check. - Object *warehouse = NULL; + Object *warehouse = nullptr; if (isSupplySourceAttacked()) { warehouse = TheGameLogic->findObjectByID(m_attackedSupplyCenter); } - if (warehouse==NULL) { + if (warehouse==nullptr) { warehouse = findSupplyCenter(minSupplies); } if (warehouse) { @@ -988,7 +988,7 @@ Bool AIPlayer::isSupplySourceAttacked( void ) Bool AIPlayer::isSupplySourceSafe( Int minSupplies ) { Object *warehouse = findSupplyCenter(minSupplies); - if (warehouse==NULL) return true; // it's safe cause it doesn't exist. + if (warehouse==nullptr) return true; // it's safe cause it doesn't exist. return (isLocationSafe(warehouse->getPosition(), warehouse->getTemplate())); } @@ -997,7 +997,7 @@ Bool AIPlayer::isSupplySourceSafe( Int minSupplies ) //------------------------------------------------------------------------------------------------- Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) { - if (tthing == NULL) return 0; + if (tthing == nullptr) return 0; // See if we have enemies. Real radius = TheAI->getAiData()->m_supplyCenterSafeRadius; @@ -1031,10 +1031,10 @@ Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) filters[numFilters++] = &filterInsignificant; filters[numFilters++] = &filterHarvesters; filters[numFilters++] = &filterDozer; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; Object *enemy = ThePartitionManager->getClosestObject( pos, radius, FROM_BOUNDINGSPHERE_2D, filters ); - if (enemy!=NULL) { + if (enemy!=nullptr) { return false; } return true; @@ -1056,8 +1056,8 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit ) Bool supplyTruck = false; #endif - // factory could be NULL at the start of the game. - if (factory == NULL) { + // factory could be null at the start of the game. + if (factory == nullptr) { return; } @@ -1085,7 +1085,7 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit ) std::vector path; path.push_back( *ai->getGoalPosition() ); path.push_back(team->m_team->getPrototype()->getTemplateInfo()->m_homeLocation); - ai->aiFollowExitProductionPath(&path, NULL, CMD_FROM_AI); + ai->aiFollowExitProductionPath(&path, nullptr, CMD_FROM_AI); } } @@ -1311,7 +1311,7 @@ Int AIPlayer::getPlayerSuperweaponValue(Coord3D *center, Int playerNdx, Real rad Real radSqr = sqr(radius); Player* pPlayer = ThePlayerList->getNthPlayer(playerNdx); - if (pPlayer == NULL) + if (pPlayer == nullptr) return 0; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { @@ -1421,7 +1421,7 @@ Bool AIPlayer::startTraining( WorkOrder *order, Bool busyOK, AsciiString teamNam // ------------------------------------------------------------------------------------------------ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) { - Object *busyFactory = NULL; // We prefer a factory that isn't busy. + Object *busyFactory = nullptr; // We prefer a factory that isn't busy. for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) { Object *factory = TheGameLogic->findObjectByID( info->getObjectID() ); @@ -1452,7 +1452,7 @@ Object *AIPlayer::findFactory(const ThingTemplate *thing, Bool busyOK) } // We didn't find an idle factory, so return the busy one. if (busyOK) return busyFactory; - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -1470,11 +1470,11 @@ Bool AIPlayer::isPossibleToBuildTeam( TeamPrototype *proto, Bool requireIdleFact const ThingTemplate *thing = TheThingFactory->findTemplate( unitInfo[i].unitThingName ); if (thing) { Int thingCost = thing->calcCostToBuild(m_player); - if (NULL == findFactory(thing, true)) { + if (nullptr == findFactory(thing, true)) { // Couldn't find a factory. return false; } - if (NULL != findFactory(thing, false)) { + if (nullptr != findFactory(thing, false)) { // Found an idle factory. anyIdle = true; } @@ -1548,9 +1548,9 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) { // Find a high production priority team that needs reinforcements. Player::PlayerTeamList::const_iterator t; - Team *curTeam = NULL; + Team *curTeam = nullptr; Int curPriority = minPriority; // Don't reinforce a team unless it is above min priority. - const ThingTemplate *curThing = NULL; + const ThingTemplate *curThing = nullptr; for (t = m_player->getPlayerTeams()->begin(); t != m_player->getPlayerTeams()->end(); ++t) { TeamPrototype *proto = (*t); @@ -1577,13 +1577,13 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) { if (unitInfo[i].maxUnits < 1) continue; const ThingTemplate *thing = TheThingFactory->findTemplate( unitInfo[i].unitThingName ); - if (thing==NULL) continue; + if (thing==nullptr) continue; Int count=0; team->countObjectsByThingTemplate(1, &thing, false, &count); if (count < unitInfo[i].maxUnits) { // See if there is a factory available. - if (NULL != findFactory(thing, false)) + if (nullptr != findFactory(thing, false)) { curTeam = team; curPriority = proto->getTemplateInfo()->m_productionPriority; @@ -1609,7 +1609,7 @@ Bool AIPlayer::selectTeamToReinforce( Int minPriority ) order->m_numRequired = 1; order->m_required = true; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; teamQ->m_workOrders = order; teamQ->m_frameStarted = TheGameLogic->getFrame(); teamQ->m_team = curTeam; @@ -1711,7 +1711,7 @@ Bool AIPlayer::selectTeamToBuild( void ) // pick a random team from the hi-priority set Int which = GameLogicRandomValue( 0, count-1 ); - TeamPrototype *teamProto = NULL; + TeamPrototype *teamProto = nullptr; Int i = 0; for (t = candidateList.begin(); t != candidateList.end(); ++t) { @@ -1762,7 +1762,7 @@ void AIPlayer::buildSpecificAIBuilding(const AsciiString &thingName) void AIPlayer::buildUpgrade(const AsciiString &upgrade) { const UpgradeTemplate *curUpgrade = TheUpgradeCenter->findUpgrade(upgrade); - if (curUpgrade==NULL) { + if (curUpgrade==nullptr) { AsciiString msg = "Upgrade "; msg.concat(upgrade); msg.concat(" does not exist. Ignoring request."); @@ -1817,14 +1817,14 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) continue; Bool canUpgradeHere = false; const CommandSet *commandSet = TheControlBar->findCommandSet( factory->getCommandSetString() ); - if( commandSet == NULL) continue; + if( commandSet == nullptr) continue; for( Int j = 0; j < MAX_COMMANDS_PER_SET; j++ ) { //Get the command button. const CommandButton *commandButton = commandSet->getCommandButton(j); - if (commandButton==NULL) continue; + if (commandButton==nullptr) continue; if (commandButton->getName().isEmpty() ) continue; - if (commandButton->getUpgradeTemplate() == NULL ) continue; + if (commandButton->getUpgradeTemplate() == nullptr ) continue; if (commandButton->getUpgradeTemplate()->getUpgradeName() == curUpgrade->getUpgradeName()) { canUpgradeHere = true; } @@ -1898,7 +1898,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) Coord3D newPos = location; if( TheBuildAssistant->isLocationLegalToBuild( &location, tTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) != LBC_OK ) { + nullptr, m_player ) != LBC_OK ) { // Warn. const Coord3D *warehouseLocation = bestSupplyWarehouse->getPosition(); AsciiString debugMessage; @@ -1924,7 +1924,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -1933,7 +1933,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -1947,7 +1947,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -1956,7 +1956,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if (valid) break; if( TheGlobalData->m_debugSupplyCenterPlacement ) DEBUG_LOG(("buildBySupplies -- Fail at (%.2f,%.2f)", newPos.x, newPos.y)); @@ -2000,7 +2000,7 @@ Bool AIPlayer::calcClosestConstructionZoneLocation( const ThingTemplate *constru // validate the the position to build at is valid Bool valid=false; Coord3D newPos = *location; - if( TheBuildAssistant->isLocationLegalToBuild( location, constructTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, NULL, m_player ) != LBC_OK ) + if( TheBuildAssistant->isLocationLegalToBuild( location, constructTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, nullptr, m_player ) != LBC_OK ) { // Warn. AsciiString bldgName = constructTemplate->getName(); @@ -2022,7 +2022,7 @@ Bool AIPlayer::calcClosestConstructionZoneLocation( const ThingTemplate *constru BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( valid ) break; @@ -2031,7 +2031,7 @@ Bool AIPlayer::calcClosestConstructionZoneLocation( const ThingTemplate *constru BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; } if( valid ) @@ -2046,7 +2046,7 @@ Bool AIPlayer::calcClosestConstructionZoneLocation( const ThingTemplate *constru BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( valid ) break; @@ -2055,7 +2055,7 @@ Bool AIPlayer::calcClosestConstructionZoneLocation( const ThingTemplate *constru BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; } if( valid ) @@ -2112,7 +2112,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c // validate the the position to build at is valid Bool valid=false; Coord3D newPos = *location; - if( TheBuildAssistant->isLocationLegalToBuild( location, tTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, NULL, m_player ) != LBC_OK ) + if( TheBuildAssistant->isLocationLegalToBuild( location, tTemplate, angle, BuildAssistant::NO_OBJECT_OVERLAP, nullptr, m_player ) != LBC_OK ) { // Warn. AsciiString bldgName = tTemplate->getName(); @@ -2134,7 +2134,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( valid ) break; @@ -2143,7 +2143,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; } if( valid ) @@ -2158,7 +2158,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; if( valid ) break; @@ -2167,7 +2167,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c BuildAssistant::CLEAR_PATH | BuildAssistant::TERRAIN_RESTRICTIONS | BuildAssistant::NO_OBJECT_OVERLAP, - NULL, m_player ) == LBC_OK; + nullptr, m_player ) == LBC_OK; } if( valid ) @@ -2189,7 +2189,7 @@ void AIPlayer::buildSpecificBuildingNearestTeam( const AsciiString &thingName, c // ------------------------------------------------------------------------------------------------ Object *AIPlayer::findSupplyCenter(Int minimumCash) { - Object *bestSupplyWarehouse = NULL; + Object *bestSupplyWarehouse = nullptr; Real bestDistSqr = 0; Object *obj; Coord3D enemyCenter; @@ -2224,7 +2224,7 @@ Object *AIPlayer::findSupplyCenter(Int minimumCash) PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *supplyCenter = ThePartitionManager->getClosestObject(¢er, radius, FROM_BOUNDINGSPHERE_2D, filters); if (supplyCenter) { @@ -2246,7 +2246,7 @@ Object *AIPlayer::findSupplyCenter(Int minimumCash) } } - if (bestSupplyWarehouse==NULL) { + if (bestSupplyWarehouse==nullptr) { bestSupplyWarehouse = obj; bestDistSqr = distSqr; } else if (bestDistSqr>distSqr) { @@ -2288,8 +2288,8 @@ void AIPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool fl void AIPlayer::repairStructure(ObjectID structure) { Object *structureObj = TheGameLogic->findObjectByID(structure); - if (structureObj==NULL) return; - if (structureObj->getBodyModule()==NULL) return; + if (structureObj==nullptr) return; + if (structureObj->getBodyModule()==nullptr) return; // If the structure is not noticably damaged, don't bother. BodyDamageType structureState = structureObj->getBodyModule()->getDamageState(); if (structureState==BODY_PRISTINE) { @@ -2334,10 +2334,10 @@ void AIPlayer::updateBridgeRepair(void) m_bridgeTimer--; if (m_bridgeTimer>0) return; m_bridgeTimer = LOGICFRAMES_PER_SECOND; - Object *bridgeObj=NULL; - while (bridgeObj==NULL && m_structuresInQueue>0) { + Object *bridgeObj=nullptr; + while (bridgeObj==nullptr && m_structuresInQueue>0) { bridgeObj = TheGameLogic->findObjectByID(m_structuresToRepair[0]); - if (bridgeObj==NULL) { + if (bridgeObj==nullptr) { Int i; for (i=0; igetPosition(); BodyDamageType bridgeState = bridgeObj->getBodyModule()->getDamageState(); if (m_repairDozer==INVALID_ID) { @@ -2372,14 +2372,14 @@ void AIPlayer::updateBridgeRepair(void) } dozer = TheGameLogic->findObjectByID(m_repairDozer); - if (dozer==NULL) { + if (dozer==nullptr) { m_repairDozer=INVALID_ID; // we got killed. m_bridgeTimer=0; return; // Just try to find a dozer next frame. } DozerAIInterface* dozerAI = dozer->getAI()->getDozerAIInterface(); - if (dozerAI==NULL) { + if (dozerAI==nullptr) { DEBUG_CRASH(("Unexpected - dozer doesn't have dozer interface.")); return; } @@ -2466,7 +2466,7 @@ void AIPlayer::buildSpecificAITeam( TeamPrototype *teamProto, Bool priorityBuild } } const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; - WorkOrder *orders = NULL; + WorkOrder *orders = nullptr; Int i; // Queue up optional units. for( i=0; igetTemplateInfo()->m_numUnitsInfo; i++ ) @@ -2578,7 +2578,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu teamName.concat(" - Recruiting."); TheScriptEngine->AppendDebugMessage(teamName, false); const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; -// WorkOrder *orders = NULL; +// WorkOrder *orders = nullptr; Int i; Int unitsRecruited = 0; // Recruit. @@ -2629,7 +2629,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu // Put in front of queue. prependTo_TeamReadyQueue(team); team->m_priorityBuild = false; - team->m_workOrders = NULL; + team->m_workOrders = nullptr; team->m_frameStarted = TheGameLogic->getFrame(); team->m_team = theTeam; AsciiString teamName = teamProto->getName(); @@ -2639,7 +2639,7 @@ void AIPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recruitRadiu //disband. if (!theTeam->getPrototype()->getIsSingleton()) { deleteInstance(theTeam); - theTeam = NULL; + theTeam = nullptr; } AsciiString teamName = teamProto->getName(); teamName.concat(" - Recruited 0 units, disbanding."); @@ -2957,7 +2957,7 @@ void AIPlayer::doUpgradesAndSkills( void ) } sideInfo = sideInfo->m_next; } - if (sideInfo == NULL) return; + if (sideInfo == nullptr) return; if (m_skillsetSelector == INVALID_SKILLSET_SELECTION) { Int limit = 0; @@ -3181,7 +3181,7 @@ void AIPlayer::queueDozer( void ) order->m_required = true; order->m_isResourceGatherer = FALSE; // prepend to head of list - order->m_next = NULL; + order->m_next = nullptr; TeamInQueue *team = newInstance(TeamInQueue); // Put in front of queue. prependTo_TeamBuildQueue(team); @@ -3222,9 +3222,9 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) { // Add any factories placed to the build list. Object *obj; - Object *dozer = NULL; + Object *dozer = nullptr; Bool needDozer = true; - Object *closestDozer=NULL; + Object *closestDozer=nullptr; Real closestDistSqr = 0; for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) @@ -3236,7 +3236,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) if (obj->isKindOf(KINDOF_DOZER)) { AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (ai==NULL) { + if (ai==nullptr) { continue; } @@ -3262,7 +3262,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) if (!dozerAI->isAnyTaskPending()) { dozer = obj; // prefer an idle dozer } - if (dozer==NULL) { + if (dozer==nullptr) { dozer = obj; // but we'll take one doing stuff. } if (dozer && !dozerAI->isAnyTaskPending()) { @@ -3272,7 +3272,7 @@ Object * AIPlayer::findDozer( const Coord3D *pos ) dx = pos->x - dozer->getPosition()->x; dy = pos->y - dozer->getPosition()->y; distSqr = dx*dx+dy*dy; - if (closestDozer == NULL) { + if (closestDozer == nullptr) { closestDozer = dozer; closestDistSqr = distSqr; } else if (distSqr < closestDistSqr) { @@ -3348,10 +3348,10 @@ void AIPlayer::xfer( Xfer *xfer ) { // sanity, the list must be empty - if( getFirstItemIn_TeamBuildQueue() != NULL ) + if( getFirstItemIn_TeamBuildQueue() != nullptr ) { - DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not NULL, you should delete it or something before loading a new list" )); + DEBUG_CRASH(( "AIPlayer::xfer - TeamBuildQueue head is not null, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; } @@ -3407,10 +3407,10 @@ void AIPlayer::xfer( Xfer *xfer ) { // sanity, the list must be empty - if( getFirstItemIn_TeamReadyQueue() != NULL ) + if( getFirstItemIn_TeamReadyQueue() != nullptr ) { - DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not NULL, you should delete it or something before loading a new list" )); + DEBUG_CRASH(( "AIPlayer::xfer - TeamReadyQueue head is not null, you should delete it or something before loading a new list" )); throw SC_INVALID_DATA; } @@ -3497,7 +3497,7 @@ TeamInQueue::~TeamInQueue() } // If we have a team, activate it. If it is empty, Team.cpp will remove empty active teams. if (m_team) m_team->setActive(); - m_workOrders = NULL; + m_workOrders = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -3596,7 +3596,7 @@ void TeamInQueue::disband() if (!m_team->getPrototype()->getIsSingleton()) { deleteInstance(m_team); } - m_team = NULL; + m_team = nullptr; } } @@ -3646,10 +3646,10 @@ void TeamInQueue::xfer( Xfer *xfer ) { // sanity - if( m_workOrders != NULL ) + if( m_workOrders != nullptr ) { - DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be NULL but isn't. Perhaps you should blow it away before loading" )); + DEBUG_CRASH(( "TeamInQueue::xfer - m_workOrders should be null but isn't. Perhaps you should blow it away before loading" )); throw SC_INVALID_DATA; } @@ -3662,14 +3662,14 @@ void TeamInQueue::xfer( Xfer *xfer ) workOrder = newInstance(WorkOrder); // attach to list at the end - workOrder->m_next = NULL; - if( m_workOrders == NULL ) + workOrder->m_next = nullptr; + if( m_workOrders == nullptr ) m_workOrders = workOrder; else { WorkOrder *last = m_workOrders; - while( last->m_next != NULL ) + while( last->m_next != nullptr ) last = last->m_next; last->m_next = workOrder; @@ -3725,7 +3725,7 @@ void WorkOrder::validateFactory( Player *thisPlayer ) if (m_factoryID == INVALID_ID) return; Object *factory = TheGameLogic->findObjectByID( m_factoryID ); - if ( factory == NULL) { + if ( factory == nullptr) { m_factoryID = INVALID_ID; return; } @@ -3802,7 +3802,7 @@ void AIPlayer::getPlayerStructureBounds( Region2D *bounds, Int playerNdx, Bool c objBounds.hi.x = objBounds.lo.x = objBounds.hi.y = objBounds.lo.y = 0; Player* pPlayer = ThePlayerList->getNthPlayer(playerNdx); - if (pPlayer == NULL) + if (pPlayer == nullptr) return; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 26db83cda7c..018acdb1e20 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -75,7 +75,7 @@ m_curLeftFlankRightDefenseAngle(0), m_curRightFlankLeftDefenseAngle(0), m_curRightFlankRightDefenseAngle(0), m_frameToCheckEnemy(0), -m_currentEnemy(NULL) +m_currentEnemy(nullptr) { m_frameLastBuildingBuilt = TheGameLogic->getFrame(); @@ -99,12 +99,12 @@ void AISkirmishPlayer::processBaseBuilding( void ) // if (m_readyToBuildStructure) { - const ThingTemplate *bldgPlan=NULL; - BuildListInfo *bldgInfo = NULL; + const ThingTemplate *bldgPlan=nullptr; + BuildListInfo *bldgInfo = nullptr; Bool isPriority = false; - Object *bldg = NULL; - const ThingTemplate *powerPlan=NULL; - BuildListInfo *powerInfo = NULL; + Object *bldg = nullptr; + const ThingTemplate *powerPlan=nullptr; + BuildListInfo *powerInfo = nullptr; Bool isUnderPowered = !m_player->getEnergy()->hasSufficientPower(); Bool powerUnderConstruction = false; for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) @@ -121,7 +121,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) if (info->getObjectID() != INVALID_ID) { // used to have a building. Object *bldg = TheGameLogic->findObjectByID( info->getObjectID() ); - if (bldg==NULL) { + if (bldg==nullptr) { // got destroyed. ObjectID priorID; priorID = info->getObjectID(); @@ -155,15 +155,15 @@ void AISkirmishPlayer::processBaseBuilding( void ) if (myDozer && ( myDozer->getControllingPlayer() != m_player || myDozer->isDisabledByType( DISABLED_UNMANNED ) ) ) {//I don't expect this dozer to work well with me. - myDozer = NULL; - bldg->setBuilder( NULL ); + myDozer = nullptr; + bldg->setBuilder( nullptr ); } - if (myDozer==NULL) { + if (myDozer==nullptr) { DEBUG_LOG(("AI's Dozer got killed (or captured). Find another dozer.")); queueDozer(); myDozer = findDozer(bldg->getPosition()); - if (myDozer==NULL || myDozer->getAI()==NULL) { + if (myDozer==nullptr || myDozer->getAI()==nullptr) { continue; } myDozer->getAI()->aiResumeConstruction(bldg, CMD_FROM_AI); @@ -205,7 +205,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } } if (curPlan->isKindOf(KINDOF_FS_POWER)) { - if (powerPlan==NULL && !curPlan->isKindOf(KINDOF_CASH_GENERATOR)) { + if (powerPlan==nullptr && !curPlan->isKindOf(KINDOF_CASH_GENERATOR)) { if (isUnderPowered || info->isAutomaticBuild()) { powerPlan = curPlan; powerInfo = info; @@ -216,7 +216,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) continue; // marked to not build automatically. } Object *dozer = findDozer(info->getLocation()); - if (dozer==NULL) { + if (dozer==nullptr) { if (isUnderPowered) { queueDozer(); } @@ -233,7 +233,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) // check if this building has any "rebuilds" left if (info->isBuildable()) { - if (bldgPlan == NULL) { + if (bldgPlan == nullptr) { bldgPlan = curPlan; bldgInfo = info; } @@ -478,7 +478,7 @@ Int AISkirmishPlayer::getMyEnemyPlayerIndex(void) { */ void AISkirmishPlayer::acquireEnemy(void) { - Player *bestEnemy = NULL; + Player *bestEnemy = nullptr; Real bestDistanceSqr = HUGE_DIST*HUGE_DIST; if (m_currentEnemy) { @@ -531,7 +531,7 @@ void AISkirmishPlayer::acquireEnemy(void) } } } - if (bestEnemy!=NULL && (bestEnemy!=m_currentEnemy)) { + if (bestEnemy!=nullptr && (bestEnemy!=m_currentEnemy)) { m_currentEnemy = bestEnemy; AsciiString msg = TheNameKeyGenerator->keyToName(m_player->getPlayerNameKey()); msg.concat(" acquiring target enemy player: "); @@ -598,7 +598,7 @@ void AISkirmishPlayer::buildAIBaseDefense(Bool flank) void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool flank) { const ThingTemplate *tTemplate = TheThingFactory->findTemplate(thingName); - if (tTemplate==NULL) { + if (tTemplate==nullptr) { DEBUG_CRASH(("Couldn't find base defense structure '%s' for side %s", thingName.str(), m_player->getSide().str())); return; } @@ -692,7 +692,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Bool canBuild; Real placeAngle = tTemplate->getPlacementViewAngle(); canBuild = LBC_OK == TheBuildAssistant->isLocationLegalToBuild(&buildPos, tTemplate, placeAngle, - BuildAssistant::TERRAIN_RESTRICTIONS|BuildAssistant::NO_OBJECT_OVERLAP, NULL, m_player); + BuildAssistant::TERRAIN_RESTRICTIONS|BuildAssistant::NO_OBJECT_OVERLAP, nullptr, m_player); TheTerrainVisual->removeAllBibs(); // isLocationLegalToBuild adds bib feedback, turn it off. jba. if (flank) { m_curFlankBaseDefense++; @@ -777,7 +777,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr teamName.concat(" - Recruiting."); TheScriptEngine->AppendDebugMessage(teamName, false); const TCreateUnitsInfo *unitInfo = &teamProto->getTemplateInfo()->m_unitsInfo[0]; -// WorkOrder *orders = NULL; +// WorkOrder *orders = nullptr; Int i; Int unitsRecruited = 0; // Recruit. @@ -828,7 +828,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr // Put in front of queue. prependTo_TeamReadyQueue(team); team->m_priorityBuild = false; - team->m_workOrders = NULL; + team->m_workOrders = nullptr; team->m_frameStarted = TheGameLogic->getFrame(); team->m_team = theTeam; AsciiString teamName = teamProto->getName(); @@ -838,7 +838,7 @@ void AISkirmishPlayer::recruitSpecificAITeam(TeamPrototype *teamProto, Real recr //disband. if (!theTeam->getPrototype()->getIsSingleton()) { deleteInstance(theTeam); - theTeam = NULL; + theTeam = nullptr; } AsciiString teamName = teamProto->getName(); teamName.concat(" - Recruited 0 units, disbanding."); @@ -1086,7 +1086,7 @@ void AISkirmishPlayer::newMap( void ) } build = build->m_next; } - DEBUG_ASSERTLOG(build!=NULL, ("Couldn't find build list for skirmish player.")); + DEBUG_ASSERTLOG(build!=nullptr, ("Couldn't find build list for skirmish player.")); // Build any with the initially built flag. for( BuildListInfo *info = m_player->getBuildList(); info; info = info->getNext() ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 019025d0126..ce939727b37 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -76,14 +76,14 @@ static Bool cannotPossiblyAttackObject( State *thisState, void* userData ); AICommandParms::AICommandParms(AICommandType cmd, CommandSourceType cmdSource) : m_cmd(cmd), m_cmdSource(cmdSource), - m_obj(NULL), - m_otherObj(NULL), - m_team(NULL), - m_waypoint(NULL), - m_polygon(NULL), + m_obj(nullptr), + m_otherObj(nullptr), + m_team(nullptr), + m_waypoint(nullptr), + m_polygon(nullptr), m_intValue(0), - m_commandButton(NULL), - m_path(NULL) + m_commandButton(nullptr), + m_path(nullptr) { m_pos.zero(); m_coords.clear(); @@ -180,13 +180,13 @@ void AICommandParmsStorage::doXfer(Xfer *xfer) cmdName = m_commandButton->getName(); } xfer->xferAsciiString(&cmdName); - if (cmdName.isNotEmpty() && m_commandButton==NULL) { + if (cmdName.isNotEmpty() && m_commandButton==nullptr) { m_commandButton = TheControlBar->findCommandButton(cmdName); } - Bool hasPath = m_path!=NULL; + Bool hasPath = m_path!=nullptr; xfer->xferBool(&hasPath); - if (hasPath && m_path==NULL) { + if (hasPath && m_path==nullptr) { m_path = newInstance(Path); } if (hasPath) { @@ -268,27 +268,27 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. static const StateConditionInfo objectConditionsNormal[] = { - StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), + StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, nullptr), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // we want to use the CONTINUE mode (not NEW) since we already have acquired the target. static const StateConditionInfo objectConditionsForced[] = { - StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, NULL), + StateConditionInfo(outOfWeaponRangeObject, AttackStateMachine::CHASE_TARGET, nullptr), StateConditionInfo(cannotPossiblyAttackObject, EXIT_MACHINE_WITH_FAILURE, (void*)ATTACK_CONTINUED_TARGET_FORCED), - StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(wantToSquishTarget, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; const StateConditionInfo* objectConditions = forceAttacking ? objectConditionsForced : objectConditionsNormal; static const StateConditionInfo positionConditions[] = { - StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(outOfWeaponRangePosition, AttackStateMachine::CHASE_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; #ifdef STATE_MACHINE_DEBUG @@ -331,8 +331,8 @@ AttackStateMachine::AttackStateMachine( Object *obj, AIAttackState* att, AsciiSt { static const StateConditionInfo portableStructureChaseConditions[] = { - StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(inWeaponRangeObject, AttackStateMachine::AIM_AT_TARGET, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; /* we're a rider on a mobile object, so we can't control our motion. @@ -409,7 +409,7 @@ AttackStateMachine::~AttackStateMachine() //----------------------------------------------------------------------------------------------------------- static Object* findEnemyInContainer(Object* killer, Object* bldg) { - const ContainedItemsList* items = bldg->getContain() ? bldg->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = bldg->getContain() ? bldg->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -427,7 +427,7 @@ static Object* findEnemyInContainer(Object* killer, Object* bldg) } } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------------------------------------- @@ -513,7 +513,7 @@ StateReturnType AIRappelState::onEnter() m_targetIsBldg = true; Object* bldg = getMachineGoalObject(); - if (bldg == NULL || bldg->isEffectivelyDead() || !bldg->isKindOf(KINDOF_STRUCTURE)) + if (bldg == nullptr || bldg->isEffectivelyDead() || !bldg->isKindOf(KINDOF_STRUCTURE)) m_targetIsBldg = false; const Coord3D* pos = obj->getPosition(); @@ -544,7 +544,7 @@ StateReturnType AIRappelState::update() const Coord3D* pos = obj->getPosition(); Object* bldg = getMachineGoalObject(); - if (m_targetIsBldg && (bldg == NULL || bldg->isEffectivelyDead())) + if (m_targetIsBldg && (bldg == nullptr || bldg->isEffectivelyDead())) { // if bldg is destroyed, just head for the ground // BGC - bldg could be destroyed as they are heading down the rope. @@ -580,7 +580,7 @@ StateReturnType AIRappelState::update() if (numKilled > 0) { const FXList* fx = obj->getTemplate()->getPerUnitFX("CombatDropKillFX"); - FXList::doFXObj(fx, bldg, NULL); + FXList::doFXObj(fx, bldg, nullptr); DEBUG_LOG(("Killing %d enemies in combat drop!",numKilled)); } @@ -675,10 +675,10 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( DEBUG_ASSERTCRASH(getOwner()->getAI(), ("An AI State Machine '%s' was constructed without an AIUpdateInterface, please tell JKMCD", name.str())); m_goalPath.clear(); - m_goalWaypoint = NULL; - m_goalSquad = NULL; + m_goalWaypoint = nullptr; + m_goalSquad = nullptr; - m_temporaryState = NULL; + m_temporaryState = nullptr; m_temporaryStateFramEnd = 0; // order matters: first state is the default state. @@ -702,12 +702,12 @@ AIStateMachine::AIStateMachine( Object *obj, AsciiString name ) : StateMachine( defineState( AI_MOVE_AND_EVACUATE_AND_EXIT, newInstance(AIMoveAndEvacuateState)( this ), AI_MOVE_AND_DELETE, AI_MOVE_AND_DELETE ); defineState( AI_MOVE_AND_DELETE, newInstance(AIMoveAndDeleteState)( this ), AI_IDLE, AI_IDLE ); defineState( AI_WAIT, newInstance(AIWaitState)( this ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_POSITION, newInstance(AIAttackState)( this, false, false, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_FORCE_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, true, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_POSITION, newInstance(AIAttackState)( this, false, false, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_FORCE_ATTACK_OBJECT, newInstance(AIAttackState)( this, false, true, true, nullptr ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_AND_FOLLOW_OBJECT, newInstance(AIAttackState)( this, true, true, false, NULL ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_SQUAD, newInstance(AIAttackSquadState)( this, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_AND_FOLLOW_OBJECT, newInstance(AIAttackState)( this, true, true, false, nullptr ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_SQUAD, newInstance(AIAttackSquadState)( this, nullptr ), AI_IDLE, AI_IDLE ); defineState( AI_WANDER, newInstance(AIWanderState)( this ), AI_IDLE, AI_MOVE_AWAY_FROM_REPULSORS ); defineState( AI_PANIC, newInstance(AIPanicState)( this ), AI_IDLE, AI_MOVE_AWAY_FROM_REPULSORS ); defineState( AI_DEAD, newInstance(AIDeadState)( this ), AI_IDLE, AI_IDLE ); @@ -781,11 +781,11 @@ void AIStateMachine::xfer( Xfer *xfer ) m_goalWaypoint = TheTerrainLogic->getWaypointByName(waypointName); } } - Bool hasSquad = (m_goalSquad!=NULL); + Bool hasSquad = (m_goalSquad!=nullptr); xfer->xferBool(&hasSquad); if (xfer->getXferMode() == XFER_LOAD) { - if (hasSquad && m_goalSquad==NULL) { + if (hasSquad && m_goalSquad==nullptr) { m_goalSquad = newInstance( Squad ); } } @@ -802,7 +802,7 @@ void AIStateMachine::xfer( Xfer *xfer ) if (xfer->getXferMode() == XFER_LOAD && id != INVALID_STATE_ID) { m_temporaryState = internalGetState( id ); } - if (m_temporaryState!=NULL) { + if (m_temporaryState!=nullptr) { xfer->xferSnapshot(m_temporaryState); } @@ -879,7 +879,7 @@ StateReturnType AIStateMachine::updateStateMachine() return status; } m_temporaryState->onExit(EXIT_NORMAL); - m_temporaryState = NULL; + m_temporaryState = nullptr; } StateReturnType retType = StateMachine::updateStateMachine(); @@ -943,14 +943,14 @@ StateReturnType AIStateMachine::setTemporaryState( StateID newStateID, Int frame #endif if (m_temporaryState) { m_temporaryState->onExit(EXIT_RESET); - m_temporaryState = NULL; + m_temporaryState = nullptr; } if (newState) { m_temporaryState = newState; StateReturnType ret = m_temporaryState->onEnter(); if (ret != STATE_CONTINUE) { m_temporaryState->onExit(EXIT_NORMAL); - m_temporaryState = NULL; + m_temporaryState = nullptr; return ret; } enum {FRAME_COUNT_MAX = 60*LOGICFRAMES_PER_SECOND}; @@ -989,7 +989,7 @@ void AIStateMachine::addToGoalPath( const Coord3D *pathPoint) const Coord3D *AIStateMachine::getGoalPathPosition( Int i ) const { if (i < 0 || i >= m_goalPath.size()) - return NULL; + return nullptr; return &m_goalPath[i]; } @@ -1018,8 +1018,8 @@ void AIStateMachine::clear() { StateMachine::clear(); m_goalPath.clear(); - m_goalWaypoint = NULL; - m_goalSquad = NULL; + m_goalWaypoint = nullptr; + m_goalSquad = nullptr; AIUpdateInterface* ai = getOwner()->getAI(); if (ai) @@ -1054,7 +1054,7 @@ StateReturnType AIStateMachine::setState(StateID newStateID) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalTeam( const Team *team ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1064,7 +1064,7 @@ void AIStateMachine::setGoalTeam( const Team *team ) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalSquad( const Squad *squad ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1074,7 +1074,7 @@ void AIStateMachine::setGoalSquad( const Squad *squad ) //---------------------------------------------------------------------------------------------------------- void AIStateMachine::setGoalAIGroup( const AIGroup *group ) { - if (m_goalSquad == NULL) { + if (m_goalSquad == nullptr) { m_goalSquad = newInstance( Squad ); } @@ -1214,7 +1214,7 @@ Bool outOfWeaponRangePosition( State *thisState, void* userData ) Bool viewBlocked = false; if (onGround) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(obj, *obj->getPosition(), NULL, *pos); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(obj, *obj->getPosition(), nullptr, *pos); } if (viewBlocked) { @@ -1336,7 +1336,7 @@ void AIIdleState::doInitIdleState() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); const Locomotor* loco = ai->getCurLocomotor(); - Bool ultraAccurate = (loco != NULL && loco->isUltraAccurate()); + Bool ultraAccurate = (loco != nullptr && loco->isUltraAccurate()); #define NO_STOP_AND_SLIDE if (ai->isIdle() && ai->isDoingGroundMovement()) { @@ -1375,7 +1375,7 @@ void AIIdleState::doInitIdleState() } ai->setLocomotorGoalNone(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); } //---------------------------------------------------------------------------------------------- @@ -1470,7 +1470,7 @@ StateReturnType AIDeadState::onEnter() { Object *obj = getMachineOwner(); - // How can an object be NULL here? I don't think it actually can, but this check must be + // How can an object be null here? I don't think it actually can, but this check must be // here for a reason. - jkmcd if (obj) { @@ -1738,7 +1738,7 @@ void AIInternalMoveToState::onExit( StateExitType status ) // (This is why destructors should not do game logic) if (ai) { ai->friend_endingMove(); - DEBUG_ASSERTLOG(obj->getTeam(), ("AIInternalMoveToState::onExit obj has NULL team.")); + DEBUG_ASSERTLOG(obj->getTeam(), ("AIInternalMoveToState::onExit obj has null team.")); if (obj->getTeam() && ai->isDoingGroundMovement() && ai->getCurLocomotor() && ai->getCurLocomotor()->isUltraAccurate()) { Real dx = m_goalPosition.x-obj->getPosition()->x; @@ -1784,7 +1784,7 @@ StateReturnType AIInternalMoveToState::update() /// @todo srj -- find a way to sleep for a number of frames here, if possible return STATE_CONTINUE; } - if (thePath==NULL) + if (thePath==nullptr) { //Kris: 7/01/03 (Temporary debug hook for units not being able to leave maps) if( blah ) @@ -1806,7 +1806,7 @@ StateReturnType AIInternalMoveToState::update() } Bool forceRecompute = false; - if (thePath==NULL) { + if (thePath==nullptr) { forceRecompute = true; } Bool blocked=false; @@ -1865,7 +1865,7 @@ StateReturnType AIInternalMoveToState::update() } } - if (thePath != NULL) + if (thePath != nullptr) ai->setLocomotorGoalPositionOnPath(); // if our goal has moved, recompute our path @@ -1886,7 +1886,7 @@ StateReturnType AIInternalMoveToState::update() // srj sez: must re-set setLocoGoal after computePath, since computePath // can set the loco goal to NONE... - if (ai->getPath() != NULL) + if (ai->getPath() != nullptr) ai->setLocomotorGoalPositionOnPath(); else { @@ -1989,7 +1989,7 @@ AIAttackMoveStateMachine::AIAttackMoveStateMachine(Object *owner, AsciiString na // order matters: first state is the default state. defineState( AI_IDLE, newInstance(AIIdleState)( this, AIIdleState::DO_NOT_LOOK_FOR_TARGETS ), AI_IDLE, AI_IDLE ); defineState( AI_PICK_UP_CRATE, newInstance(AIPickUpCrateState)( this ), AI_IDLE, AI_IDLE ); - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, NULL ), AI_IDLE, AI_IDLE); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, nullptr ), AI_IDLE, AI_IDLE); } //---------------------------------------------------------------------------------------------------------- @@ -2086,7 +2086,7 @@ StateReturnType AIMoveToState::update() if (goalObj) { m_goalPosition = *goalObj->getPosition(); - Bool gotPhysics = obj->getPhysics()!=NULL && goalObj->getPhysics()!=NULL; + Bool gotPhysics = obj->getPhysics()!=nullptr && goalObj->getPhysics()!=nullptr; Bool isMissile = obj->isKindOf(KINDOF_PROJECTILE); if (isMissile) { Real halfHeight = getMachineGoalObject()->getGeometryInfo().getMaxHeightAbovePosition()/2.0f; @@ -2144,7 +2144,7 @@ StateReturnType AIMoveOutOfTheWayState::onEnter() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); - if (ai->getPath()==NULL) { + if (ai->getPath()==nullptr) { // Must have existing path. return STATE_FAILURE; } @@ -2419,7 +2419,7 @@ Bool AIAttackApproachTargetState::computePath() } if (m_waitingForPath) return true; - if (!forceRepath && ai->getPath()==NULL && !ai->isWaitingForPath()) + if (!forceRepath && ai->getPath()==nullptr && !ai->isWaitingForPath()) { forceRepath = true; } @@ -2660,7 +2660,7 @@ StateReturnType AIAttackApproachTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = !ai->isAttackPath(); @@ -2735,7 +2735,7 @@ StateReturnType AIAttackApproachTargetState::updateInternal() Bool viewBlocked = false; if ( ai->isDoingGroundMovement() ) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), NULL, m_goalPosition); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), nullptr, m_goalPosition); } if (!viewBlocked) { @@ -2799,7 +2799,7 @@ void AIAttackApproachTargetState::onExit( StateExitType status ) AIUpdateInterface *ai = getMachineOwner()->getAI(); Object *obj = getMachineOwner(); if (ai) { - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // Per JohnA, this state should not be calling ai->destroyPath, because we can have spastic users // that click the target repeadedly. This will prevent the unit from stuttering for said spastic @@ -2854,7 +2854,7 @@ Bool AIAttackPursueTargetState::computePath() } if (m_waitingForPath) return true; - if (!forceRepath && ai->getPath()==NULL && !ai->isWaitingForPath()) + if (!forceRepath && ai->getPath()==nullptr && !ai->isWaitingForPath()) { forceRepath = true; } @@ -3030,7 +3030,7 @@ StateReturnType AIAttackPursueTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = false; @@ -3260,7 +3260,7 @@ StateReturnType AIFollowPathState::onEnter() m_index = 0; const Coord3D *pos = ai->friend_getGoalPathPosition( m_index ); - if (pos == NULL) + if (pos == nullptr) return STATE_FAILURE; // set initial movement goal @@ -3368,7 +3368,7 @@ StateReturnType AIFollowPathState::update() //determine which waypoints to plot in the waypoint renderer. ai->friend_setCurrentGoalPathIndex( m_index ); ai->ignoreObstacleID(INVALID_ID); // we have exited whatever object we are leaving, if any. jba. - if (pos == NULL) + if (pos == nullptr) { // reached the end of the path return STATE_SUCCESS; @@ -3568,7 +3568,7 @@ AsciiString AIAttackMoveToState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMoveMachine) name.concat(m_attackMoveMachine->getCurrentStateName()); - else name.concat("*NULL m_deployMachine"); + else name.concat("*null m_deployMachine"); return name; } #endif @@ -3641,7 +3641,7 @@ StateReturnType AIAttackMoveToState::update() Object* nextObjectToAttack; nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { ai->friend_endingMove(); m_attackMoveMachine->setGoalObject(nextObjectToAttack); @@ -3794,7 +3794,7 @@ const Waypoint * AIFollowWaypointPathState::getNextWaypoint(void) #else if (!hasNextWaypoint()) { m_priorWaypoint = m_currentWaypoint; - return NULL; + return nullptr; } Int skip = -1; Int i; @@ -3828,7 +3828,7 @@ Bool AIFollowWaypointPathState::hasNextWaypoint(void) if (m_currentWaypoint->getNumLinks()==0) { return false; // no links, no next. } - if (m_priorWaypoint==NULL) { + if (m_priorWaypoint==nullptr) { return m_currentWaypoint->getNumLinks()>0; } if (m_currentWaypoint->getNumLinks()>1) { @@ -3867,7 +3867,7 @@ Real AIFollowWaypointPathState::calcExtraPathDistance(void) //---------------------------------------------------------------------------------------------------------- void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) { - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return; Object *obj = getMachineOwner(); @@ -4016,11 +4016,11 @@ void AIFollowWaypointPathState::loadPostProcess( void ) StateReturnType AIFollowWaypointPathState::onEnter() { m_appendGoalPosition = false; // not moving off the map at this point. - m_priorWaypoint = NULL; + m_priorWaypoint = nullptr; m_currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - if (m_currentWaypoint == NULL && !m_moveAsGroup) return STATE_FAILURE; + if (m_currentWaypoint == nullptr && !m_moveAsGroup) return STATE_FAILURE; getMachine()->setGoalPosition(m_currentWaypoint->getLocation()); @@ -4062,7 +4062,7 @@ StateReturnType AIFollowWaypointPathState::onEnter() m_groupOffset.y = obj->getPosition()->y - center.y; } } - if (m_currentWaypoint==NULL && m_moveAsGroup) { + if (m_currentWaypoint==nullptr && m_moveAsGroup) { m_currentWaypoint = obj->getTeam()->getCurrentWaypoint(); } // set initial movement goal @@ -4144,7 +4144,7 @@ StateReturnType AIFollowWaypointPathState::update() if (m_moveAsGroup && m_currentWaypoint != obj->getTeam()->getCurrentWaypoint()) { m_priorWaypoint = m_currentWaypoint; m_currentWaypoint = obj->getTeam()->getCurrentWaypoint(); - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { return STATE_SUCCESS; } computeGoal(false); @@ -4215,7 +4215,7 @@ StateReturnType AIFollowWaypointPathState::update() // if there are no links from this waypoint, we're done - if (m_currentWaypoint==NULL) { + if (m_currentWaypoint==nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); return STATE_SUCCESS; @@ -4301,7 +4301,7 @@ StateReturnType AIFollowWaypointPathExactState::onEnter() const Waypoint *currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - if (currentWaypoint == NULL) return STATE_FAILURE; + if (currentWaypoint == nullptr) return STATE_FAILURE; getMachine()->setGoalPosition(currentWaypoint->getLocation()); @@ -4429,7 +4429,7 @@ AsciiString AIAttackFollowWaypointPathState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackFollowMachine) name.concat(m_attackFollowMachine->getCurrentStateName()); - else name.concat("*NULL m_attackFollowMachine"); + else name.concat("*null m_attackFollowMachine"); return name; } #endif @@ -4486,7 +4486,7 @@ StateReturnType AIAttackFollowWaypointPathState::update() nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); } - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { m_attackFollowMachine->setGoalObject(nextObjectToAttack); m_attackFollowMachine->setState( AI_ATTACK_OBJECT ); @@ -4564,8 +4564,8 @@ StateReturnType AIWanderState::onEnter() m_currentWaypoint = ((AIStateMachine *)getMachine())->getGoalWaypoint(); AIUpdateInterface *ai = getMachineOwner()->getAI(); - m_priorWaypoint = NULL; - if (m_currentWaypoint == NULL || ai==NULL) + m_priorWaypoint = nullptr; + if (m_currentWaypoint == nullptr || ai==nullptr) return STATE_FAILURE; m_groupOffset.x = m_groupOffset.y = 0; Locomotor* curLoco = ai->getCurLocomotor(); @@ -4608,7 +4608,7 @@ StateReturnType AIWanderState::update() m_currentWaypoint = getNextWaypoint(); // if there are no links from this waypoint, we're done - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); @@ -4798,7 +4798,7 @@ StateReturnType AIPanicState::onEnter() Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return STATE_FAILURE; // set initial movement goal Locomotor* curLoco = ai->getCurLocomotor(); @@ -4849,7 +4849,7 @@ StateReturnType AIPanicState::update() m_currentWaypoint = getNextWaypoint(); // if there are no links from this waypoint, we're done - if (m_currentWaypoint == NULL) { + if (m_currentWaypoint == nullptr) { /// Trigger "end of waypoint path" scripts (jba) ai->setCompletedWaypoint(m_priorWaypoint); @@ -4921,7 +4921,7 @@ StateReturnType AIAttackAimAtTargetState::onEnter() Object* victim = getMachineGoalObject(); const Coord3D* targetPos = getMachineGoalPosition(); AIUpdateInterface* sourceAI = source->getAI(); - AIUpdateInterface* victimAI = victim ? victim->getAI() : NULL; + AIUpdateInterface* victimAI = victim ? victim->getAI() : nullptr; Locomotor* curLoco = sourceAI->getCurLocomotor(); m_canTurnInPlace = curLoco ? curLoco->getMinSpeed() == 0.0f : false; @@ -4938,7 +4938,7 @@ StateReturnType AIAttackAimAtTargetState::onEnter() //to move to the best fire point, check if it's in firing range, and if not //move it back so another unit with longer range can! Object *containedBy = source->getContainedBy(); - ContainModuleInterface *contain = containedBy ? containedBy->getContain() : NULL; + ContainModuleInterface *contain = containedBy ? containedBy->getContain() : nullptr; if( containedBy && weapon && contain && contain->isEnclosingContainerFor( source ) ) { // non enclosing garrison containers do not use firepoints. Lorenzen, 6/11/03 @@ -5092,7 +5092,7 @@ StateReturnType AIAttackAimAtTargetState::update() if (fabs(relAngle) < aimDelta /*&& !m_preAttackFrames*/ ) { - AIUpdateInterface* victimAI = victim ? victim->getAI() : NULL; + AIUpdateInterface* victimAI = victim ? victim->getAI() : nullptr; // add ourself as a targeter BEFORE calling isTemporarilyPreventingAimSuccess(). // we do this every time thru, just in case we get into a squabble with our turret-ai // over whether or not we are a targeter... (srj) @@ -5173,7 +5173,7 @@ void AIAttackAimAtTargetState::onExit( StateExitType status ) StateReturnType AIAttackFireWeaponState::onEnter() { // contained by AIAttackState, so no separate timer - DEBUG_ASSERTCRASH(m_att != NULL, ("m_att may not be null")); + DEBUG_ASSERTCRASH(m_att != nullptr, ("m_att may not be null")); Object *obj = getMachineOwner(); AIUpdateInterface *ai = obj->getAI(); @@ -5187,7 +5187,7 @@ StateReturnType AIAttackFireWeaponState::onEnter() Object *victim = getMachineGoalObject(); if (victim && obj->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { - if (obj->getTeam()->getTeamTargetObject()==NULL) { + if (obj->getTeam()->getTeamTargetObject()==nullptr) { obj->getTeam()->setTeamTargetObject(victim); } } @@ -5276,7 +5276,7 @@ StateReturnType AIAttackFireWeaponState::update() (victim->isDestroyed() || victim->isEffectivelyDead() || (victim->isKindOf(KINDOF_MINE) && victim->testStatus(OBJECT_STATUS_MASKED))) ) { - const Coord3D* originalVictimPos = m_att ? m_att->getOriginalVictimPos() : NULL; + const Coord3D* originalVictimPos = m_att ? m_att->getOriginalVictimPos() : nullptr; if (originalVictimPos) { // note that it is important to use getLastCommandSource here; this allows @@ -5287,7 +5287,7 @@ StateReturnType AIAttackFireWeaponState::update() PartitionFilterSamePlayer filterPlayer( victim->getControllingPlayer() ); PartitionFilterSameMapStatus filterMapStatus(obj); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, obj, lastCmdSource); - PartitionFilter *filters[] = { &filterAttack, &filterPlayer, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAttack, &filterPlayer, &filterMapStatus, nullptr }; // note that we look around originalVictimPos, *not* the current victim's pos. victim = ThePartitionManager->getClosestObject( originalVictimPos, continueRange, FROM_CENTER_2D, filters );// could be null. this is ok. if (victim) @@ -5369,13 +5369,13 @@ StateReturnType AIWaitState::update() //---------------------------------------------------------------------------------------------------------- AIAttackState::AIAttackState( StateMachine *machine, Bool follow, Bool attackingObject, Bool forceAttacking, AttackExitConditionsInterface* attackParameters) : State( machine , "AIAttackState"), - m_attackMachine(NULL), + m_attackMachine(nullptr), m_attackParameters(attackParameters), - m_lockedWeaponOnEnter(NULL), + m_lockedWeaponOnEnter(nullptr), m_follow(follow), m_isAttackingObject(attackingObject), m_isForceAttacking(forceAttacking), - m_victimTeam( NULL ) + m_victimTeam( nullptr ) { m_originalVictimPos.zero(); #ifdef STATE_MACHINE_DEBUG @@ -5391,7 +5391,7 @@ AIAttackState::~AIAttackState() { // nope, don't do this, since we may well still have it targeted // even though we're leaving this state. - // turn it off when we do setCurrentVictim(NULL). + // turn it off when we do setCurrentVictim(nullptr). //addSelfAsTargeter(false); if (m_attackMachine) @@ -5418,12 +5418,12 @@ void AIAttackState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackMachine!=NULL; + Bool hasMachine = m_attackMachine!=nullptr; xfer->xferBool(&hasMachine); xfer->xferCoord3D(&m_originalVictimPos); - if (hasMachine && m_attackMachine==NULL) { + if (hasMachine && m_attackMachine==nullptr) { // create new state machine for attack behavior m_attackMachine = newInstance(AttackStateMachine)(getMachineOwner(), this, "AIAttackMachine", m_follow, m_isAttackingObject, m_isForceAttacking ); } @@ -5449,7 +5449,7 @@ void AIAttackState::loadPostProcess( void ) m_victimTeam = victim->getTeam(); } Object* source = getMachineOwner(); - m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : NULL; + m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? source->getCurrentWeapon() : nullptr; } #ifdef STATE_MACHINE_DEBUG @@ -5459,7 +5459,7 @@ AsciiString AIAttackState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMachine) name.concat(m_attackMachine->getCurrentStateName()); - else name.concat("*NULL m_attackMachine"); + else name.concat("*null m_attackMachine"); return name; } #endif @@ -5541,7 +5541,7 @@ StateReturnType AIAttackState::onEnter() if (m_isAttackingObject) { Object* victim = getMachineGoalObject(); - if (victim == NULL || victim->isEffectivelyDead()) + if (victim == nullptr || victim->isEffectivelyDead()) { ai->notifyVictimIsDead(); return STATE_FAILURE; // we have nothing to attack! @@ -5571,7 +5571,7 @@ StateReturnType AIAttackState::onEnter() source->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); } - m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? curWeapon : NULL; + m_lockedWeaponOnEnter = source->isCurWeaponLocked() ? curWeapon : nullptr; StateReturnType retType = m_attackMachine->initDefaultState(); if( retType == STATE_CONTINUE ) @@ -5609,7 +5609,7 @@ StateReturnType AIAttackState::update() { Object* victim = getMachineGoalObject(); - if (victim == NULL || victim->isEffectivelyDead()) + if (victim == nullptr || victim->isEffectivelyDead()) { source->getAI()->notifyVictimIsDead(); return STATE_SUCCESS; // my, that was easy @@ -5631,15 +5631,15 @@ StateReturnType AIAttackState::update() { if( !victim->getStatusBits().test( OBJECT_STATUS_CAN_ATTACK ) ) { - if ( victim->getContain() != NULL ) + if ( victim->getContain() != nullptr ) { if (victim->getContain()->isGarrisonable() && (victim->getContain()->getContainCount() == 0) ) { if ( source->getRelationship( victim ) == NEUTRAL ) { - ai->friend_setGoalObject(NULL); + ai->friend_setGoalObject(nullptr); if (victim==source->getTeam()->getTeamTargetObject()) { - source->getTeam()->setTeamTargetObject(NULL); + source->getTeam()->setTeamTargetObject(nullptr); } ai->notifyVictimIsDead(); // well, not "dead", but longer attackable return STATE_FAILURE; @@ -5653,9 +5653,9 @@ StateReturnType AIAttackState::update() // order matters: we want to know if I consider it to be an enemy, not vice versa if( source->getRelationship( victim ) != ENEMIES) { - ai->friend_setGoalObject(NULL); + ai->friend_setGoalObject(nullptr); if (victim==source->getTeam()->getTeamTargetObject()) { - source->getTeam()->setTeamTargetObject(NULL); + source->getTeam()->setTeamTargetObject(nullptr); } ai->notifyVictimIsDead(); // well, not "dead", but longer attackable return STATE_FAILURE; @@ -5682,11 +5682,11 @@ StateReturnType AIAttackState::update() // if we entered with a locked weapon (ie, a special weapon), then we will // only keep attacking as long as that weapon remains the cur weapon... // if anything ever changes that weapon, we exit attack mode immediately. - if (m_lockedWeaponOnEnter != NULL && m_lockedWeaponOnEnter != curWeapon) + if (m_lockedWeaponOnEnter != nullptr && m_lockedWeaponOnEnter != curWeapon) return STATE_FAILURE; // we've shot as many times as we are allowed to - if (curWeapon == NULL || curWeapon->getMaxShotCount() <= 0) + if (curWeapon == nullptr || curWeapon->getMaxShotCount() <= 0) return STATE_FAILURE; /** @@ -5706,12 +5706,12 @@ void AIAttackState::onExit( StateExitType status ) USE_PERF_TIMER(AIAttackState) // nope, don't do this, since we may well still have it targeted // even though we're leaving this state. turn it off when we - // turn it off when we do setCurrentVictim(NULL). + // turn it off when we do setCurrentVictim(nullptr). //addSelfAsTargeter(false); // destroy the attack machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; Object *obj = getMachineOwner(); obj->clearStatus( MAKE_OBJECT_STATUS_MASK4( OBJECT_STATUS_IS_FIRING_WEAPON, @@ -5726,10 +5726,10 @@ void AIAttackState::onExit( StateExitType status ) if (ai) { //ai->notifyVictimIsDead(); no, do NOT do this here. - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); for (int i = 0; i < MAX_TURRETS; ++i) - ai->setTurretTargetObject((WhichTurretType)i, NULL, NULL); - ai->friend_setGoalObject(NULL); + ai->setTurretTargetObject((WhichTurretType)i, nullptr, FALSE); + ai->friend_setGoalObject(nullptr); } } @@ -5784,7 +5784,7 @@ void AIAttackThenIdleStateMachine::loadPostProcess( void ) AIAttackThenIdleStateMachine::AIAttackThenIdleStateMachine(Object *owner, AsciiString name) : StateMachine(owner, name) { // order matters: first state is the default state. - defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, NULL ), AI_IDLE, AI_IDLE ); + defineState( AI_ATTACK_OBJECT, newInstance(AIAttackState)(this, false, true, false, nullptr ), AI_IDLE, AI_IDLE ); defineState( AI_PICK_UP_CRATE, newInstance(AIPickUpCrateState)( this ), AI_IDLE, AI_IDLE ); defineState( AI_IDLE, newInstance(AIIdleState)( this, AIIdleState::DO_NOT_LOOK_FOR_TARGETS ), AI_IDLE, AI_IDLE ); } @@ -5824,11 +5824,11 @@ void AIAttackSquadState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackSquadMachine!=NULL; + Bool hasMachine = m_attackSquadMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_attackSquadMachine==NULL) { + if (hasMachine && m_attackSquadMachine==nullptr) { // create new state machine for attack behavior m_attackSquadMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackMachine" ); } @@ -5852,7 +5852,7 @@ AsciiString AIAttackSquadState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackSquadMachine) name.concat(m_attackSquadMachine->getCurrentStateName()); - else name.concat("*NULL m_attackSquadMachine"); + else name.concat("*null m_attackSquadMachine"); return name; } #endif @@ -5927,7 +5927,7 @@ void AIAttackSquadState::onExit( StateExitType status ) { // destroy the attack machine deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; + m_attackSquadMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5936,7 +5936,7 @@ Object *AIAttackSquadState::chooseVictim(void) Squad *victimSquad = ((AIStateMachine*)getMachine())->getGoalSquad(); if (!victimSquad) { - return NULL; + return nullptr; } Object *owner = getMachineOwner(); @@ -5947,20 +5947,20 @@ Object *AIAttackSquadState::chooseVictim(void) { if (moodVal & MM_Mood_Sleep) { - return NULL; + return nullptr; } if (moodVal & MM_Mood_Passive) { BodyModuleInterface *bmi = owner->getBodyModule(); if (!bmi) { - return NULL; + return nullptr; } const DamageInfo *di = bmi->getLastDamageInfo(); if (!di) { - return NULL; + return nullptr; } return TheGameLogic->findObjectByID(di->in.m_sourceID); @@ -5990,7 +5990,7 @@ Object *AIAttackSquadState::chooseVictim(void) Int numUnits = objects.size(); if (numUnits == 0) { - return NULL; + return nullptr; } Int unitToAttack = GameLogicRandomValue(0, numUnits - 1); @@ -6004,9 +6004,9 @@ Object *AIAttackSquadState::chooseVictim(void) PartitionFilterAcceptOnSquad f1(victimSquad); PartitionFilterSameMapStatus filterMapStatus(getMachineOwner()); - PartitionFilter *filters[] = { &f1, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &f1, &filterMapStatus, nullptr }; - Object *victim = ThePartitionManager->getClosestObject(getMachineOwner(), HUGE_DIST, FROM_CENTER_2D, filters, NULL, NULL); + Object *victim = ThePartitionManager->getClosestObject(getMachineOwner(), HUGE_DIST, FROM_CENTER_2D, filters, nullptr, nullptr); return victim; break; } @@ -6020,12 +6020,12 @@ Object *AIAttackSquadState::chooseVictim(void) return objects[0]; } - return NULL; + return nullptr; break; } }; - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -6058,11 +6058,11 @@ void AIDockState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_dockMachine!=NULL; + Bool hasMachine = m_dockMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_dockMachine==NULL) { + if (hasMachine && m_dockMachine==nullptr) { // create new state machine for attack behavior m_dockMachine = newInstance(AIDockMachine)( getMachineOwner()); } @@ -6086,7 +6086,7 @@ AsciiString AIDockState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_dockMachine) name.concat(m_dockMachine->getCurrentStateName()); - else name.concat("*NULL m_dockMachine"); + else name.concat("*null m_dockMachine"); return name; } #endif @@ -6101,17 +6101,17 @@ StateReturnType AIDockState::onEnter() { // who are we docking with? Object *dockWithMe = getMachineGoalObject(); - if (dockWithMe == NULL) + if (dockWithMe == nullptr) { // we have nothing to dock with! DEBUG_LOG(("No goal in AIDockState::onEnter - exiting.")); return STATE_FAILURE; } - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; dock = dockWithMe->getDockUpdateInterface(); // if we have nothing to dock with, fail - if (dock == NULL) { + if (dock == nullptr) { DEBUG_LOG(("Goal is not a dock in AIDockState::onEnter - exiting.")); return STATE_FAILURE; } @@ -6142,7 +6142,7 @@ void AIDockState::onExit( StateExitType status ) if (m_dockMachine) { m_dockMachine->halt();// GS, you have to halt before you delete to do cleanup. deleteInstance(m_dockMachine); - m_dockMachine = NULL; + m_dockMachine = nullptr; } else { DEBUG_LOG(("Dock exited immediately")); } @@ -6152,7 +6152,7 @@ void AIDockState::onExit( StateExitType status ) if (ai) { ai->setCanPathThroughUnits(false); - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } } @@ -6271,7 +6271,7 @@ void AIEnterState::onExit( StateExitType status ) if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); if (ai->getCurLocomotor()) { ai->getCurLocomotor()->setAllowInvalidPosition(false); @@ -6308,7 +6308,7 @@ StateReturnType AIEnterState::update() // -- tell the humvee to enter a chinook // -- fly the chinook around; the rangers follow the chinook like dopes // this just bails in this case. (srj) - if (goal->getContainedBy() != NULL && goal->isAboveTerrain() && !obj->isAboveTerrain()) + if (goal->getContainedBy() != nullptr && goal->isAboveTerrain() && !obj->isAboveTerrain()) { return STATE_FAILURE; } @@ -6468,8 +6468,8 @@ StateReturnType AIExitState::update() //GS. The goal of unified ExitInterfaces dies a horrible death. I can't ask Object for the exit, // as removeFromContain is only in the Contain type. I'm spliting the names in shame. - ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : NULL; - if( goalExitInterface == NULL ) + ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : nullptr; + if( goalExitInterface == nullptr ) return STATE_FAILURE; if( goalExitInterface->isExitBusy() ) @@ -6563,8 +6563,8 @@ StateReturnType AIExitInstantlyState::onEnter() //GS. The goal of unified ExitInterfaces dies a horrible death. I can't ask Object for the exit, // as removeFromContain is only in the Contain type. I'm spliting the names in shame. - ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : NULL; - if( goalExitInterface == NULL ) + ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : nullptr; + if( goalExitInterface == nullptr ) return STATE_FAILURE; goalExitInterface->exitObjectViaDoor( obj, DOOR_1 ); @@ -6629,7 +6629,7 @@ AsciiString AIGuardState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_guardMachine) name.concat(m_guardMachine->getCurrentStateName()); - else name.concat("*NULL guardMachine"); + else name.concat("*null guardMachine"); return name; } #endif @@ -6650,11 +6650,11 @@ void AIGuardState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_guardMachine!=NULL; + Bool hasMachine = m_guardMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_guardMachine==NULL) { + if (hasMachine && m_guardMachine==nullptr) { // create new state machine for guard behavior m_guardMachine = newInstance(AIGuardMachine)( getMachineOwner()); } @@ -6728,7 +6728,7 @@ StateReturnType AIGuardState::onEnter() void AIGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6739,7 +6739,7 @@ StateReturnType AIGuardState::update() { //DEBUG_LOG(("AIGuardState frame %d: %08lx",TheGameLogic->getFrame(),getMachineOwner())); - if (m_guardMachine == NULL) + if (m_guardMachine == nullptr) { return STATE_FAILURE; // We actually already exited. } @@ -6785,7 +6785,7 @@ AsciiString AIGuardRetaliateState::getName( ) const } else { - name.concat("*NULL guardRetaliateMachine"); + name.concat("*null guardRetaliateMachine"); } return name; } @@ -6807,11 +6807,11 @@ void AIGuardRetaliateState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_guardRetaliateMachine!=NULL; + Bool hasMachine = m_guardRetaliateMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_guardRetaliateMachine==NULL) + if (hasMachine && m_guardRetaliateMachine==nullptr) { // create new state machine for guard behavior m_guardRetaliateMachine = newInstance(AIGuardRetaliateMachine)( getMachineOwner()); @@ -6875,7 +6875,7 @@ StateReturnType AIGuardRetaliateState::onEnter() void AIGuardRetaliateState::onExit( StateExitType status ) { deleteInstance(m_guardRetaliateMachine); - m_guardRetaliateMachine = NULL; + m_guardRetaliateMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6886,7 +6886,7 @@ StateReturnType AIGuardRetaliateState::update() { //DEBUG_LOG(("AIGuardRetaliateState frame %d: %08lx",TheGameLogic->getFrame(),getMachineOwner())); - if (m_guardRetaliateMachine == NULL) + if (m_guardRetaliateMachine == nullptr) { return STATE_FAILURE; // We actually already exited. } @@ -6925,7 +6925,7 @@ AsciiString AITunnelNetworkGuardState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_guardMachine) name.concat(m_guardMachine->getCurrentStateName()); - else name.concat("*NULL guardMachine"); + else name.concat("*null guardMachine"); return name; } #endif @@ -6946,11 +6946,11 @@ void AITunnelNetworkGuardState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_guardMachine!=NULL; + Bool hasMachine = m_guardMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_guardMachine==NULL) { + if (hasMachine && m_guardMachine==nullptr) { // create new state machine for guard behavior m_guardMachine = newInstance(AITNGuardMachine)( getMachineOwner()); } @@ -7006,7 +7006,7 @@ StateReturnType AITunnelNetworkGuardState::onEnter() void AITunnelNetworkGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -7017,7 +7017,7 @@ StateReturnType AITunnelNetworkGuardState::update() { //DEBUG_LOG(("AITunnelNetworkGuardState frame %d: %08lx",TheGameLogic->getFrame(),getMachineOwner())); - if (m_guardMachine == NULL) + if (m_guardMachine == nullptr) { return STATE_FAILURE; // We actually already exited. } @@ -7072,11 +7072,11 @@ void AIHuntState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_huntMachine!=NULL; + Bool hasMachine = m_huntMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_huntMachine==NULL) { + if (hasMachine && m_huntMachine==nullptr) { // create new state machine for hunt behavior m_huntMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackThenIdleStateMachine"); } @@ -7130,7 +7130,7 @@ void AIHuntState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_huntMachine); - m_huntMachine = NULL; + m_huntMachine = nullptr; Object *obj = getMachineOwner(); if (obj) @@ -7146,7 +7146,7 @@ AsciiString AIHuntState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_huntMachine) name.concat(m_huntMachine->getCurrentStateName()); - else name.concat("*NULL huntMachine"); + else name.concat("*null huntMachine"); return name; } #endif @@ -7178,17 +7178,17 @@ StateReturnType AIHuntState::update() m_nextEnemyScanTime = now + ENEMY_SCAN_RATE; - const AttackPriorityInfo *info = NULL; + const AttackPriorityInfo *info = nullptr; info = ai->getAttackInfo(); // Check if team auto targets same victim. - Object* teamVictim = NULL; + Object* teamVictim = nullptr; if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); } - Object* victim = NULL; - if (teamVictim && info==NULL) + Object* victim = nullptr; + if (teamVictim && info==nullptr) { victim = teamVictim; } @@ -7196,15 +7196,15 @@ StateReturnType AIHuntState::update() { // do NOT do line of sight check - we want to find everything victim = TheAI->findClosestEnemy( owner, 9999.9f, AI::CAN_ATTACK, info ); - if (victim==NULL && owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()) { + if (victim==nullptr && owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()) { // If we are doing an all hunt, try hunting without the attack priority info. jba. - victim = TheAI->findClosestEnemy(owner, 9999.9f, AI::CAN_ATTACK, NULL); + victim = TheAI->findClosestEnemy(owner, 9999.9f, AI::CAN_ATTACK, nullptr); } if (owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { // Check priorities. if (teamVictim && info) { - if (victim==NULL) { + if (victim==nullptr) { DEBUG_LOG(("Couldnt' find victim. hmm.")); victim = teamVictim; } @@ -7230,7 +7230,7 @@ StateReturnType AIHuntState::update() } if (owner->getControllingPlayer() && owner->getControllingPlayer()->getUnitsShouldHunt()==FALSE) { // If we are not doing an all hunt, then exit hunt state - no more victims. - if (m_huntMachine->getCurrentStateID() == AI_IDLE && victim==NULL) { + if (m_huntMachine->getCurrentStateID() == AI_IDLE && victim==nullptr) { return STATE_SUCCESS; // we killed everything :) jba. } } @@ -7279,11 +7279,11 @@ void AIAttackAreaState::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - Bool hasMachine = m_attackMachine!=NULL; + Bool hasMachine = m_attackMachine!=nullptr; xfer->xferBool(&hasMachine); - if (hasMachine && m_attackMachine==NULL) { + if (hasMachine && m_attackMachine==nullptr) { // create new state machine for hunt behavior m_attackMachine = newInstance(AIAttackThenIdleStateMachine)( getMachineOwner(), "AIAttackThenIdleStateMachine"); } @@ -7308,7 +7308,7 @@ AsciiString AIAttackAreaState::getName( ) const AsciiString name = m_name; name.concat("/"); if (m_attackMachine) name.concat(m_attackMachine->getCurrentStateName()); - else name.concat("*NULL m_attackMachine"); + else name.concat("*null m_attackMachine"); return name; } #endif @@ -7334,7 +7334,7 @@ void AIAttackAreaState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -7358,10 +7358,10 @@ StateReturnType AIAttackAreaState::update() m_nextEnemyScanTime = now + ENEMY_SCAN_RATE; AIUpdateInterface *ai = owner->getAI(); - if (ai->getAreaToGuard() == NULL) + if (ai->getAreaToGuard() == nullptr) return STATE_FAILURE; - const AttackPriorityInfo *info = NULL; + const AttackPriorityInfo *info = nullptr; info = ai->getAttackInfo(); PartitionFilterPolygonTrigger polyFilter(ai->getAreaToGuard()); @@ -7373,7 +7373,7 @@ StateReturnType AIAttackAreaState::update() { m_attackMachine->setState( AI_ATTACK_OBJECT ); } - if (victim==NULL) { + if (victim==nullptr) { return STATE_SUCCESS; } } @@ -7434,7 +7434,7 @@ StateReturnType AIFaceState::onEnter() m_canTurnInPlace = curLoco ? curLoco->getMinSpeed() == 0.0f : false; Object* target = getMachineGoalObject(); - if (m_obj && target == NULL ) + if (m_obj && target == nullptr ) { // Nothing to face... return STATE_FAILURE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp index 070292cd65c..1f74f40f22e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AITNGuard.cpp @@ -59,7 +59,7 @@ const Real CLOSE_ENOUGH = (25.0f); static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ ) { Object *obj = thisState->getMachineOwner(); - BodyModuleInterface *bmi = obj ? obj->getBodyModule() : NULL; + BodyModuleInterface *bmi = obj ? obj->getBodyModule() : nullptr; if (!(obj && bmi)) { return FALSE; @@ -102,9 +102,9 @@ static Bool hasAttackedMeAndICanReturnFire( State *thisState, void* /*userData*/ static Object *findBestTunnel(Player *ownerPlayer, const Coord3D *pos) { - if (!ownerPlayer) return NULL; // should never happen, but hey. jba. + if (!ownerPlayer) return nullptr; // should never happen, but hey. jba. TunnelTracker *tunnels = ownerPlayer->getTunnelSystem(); - Object *bestTunnel = NULL; + Object *bestTunnel = nullptr; Real bestDistSqr = 0; const std::list *allTunnels = tunnels->getContainerList(); for( std::list::const_iterator iter = allTunnels->begin(); iter != allTunnels->end(); iter++ ) { @@ -114,7 +114,7 @@ static Object *findBestTunnel(Player *ownerPlayer, const Coord3D *pos) Real dx = currentTunnel->getPosition()->x-pos->x; Real dy = currentTunnel->getPosition()->y-pos->y; Real distSqr = dx*dx+dy*dy; - if (bestTunnel==NULL || distSqrgetTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); @@ -205,7 +205,7 @@ Bool AITNGuardMachine::lookForInnerTarget(void) Player *ownerPlayer = getOwner()->getControllingPlayer(); if (!ownerPlayer) return false; // should never happen, but hey. jba. TunnelTracker *tunnels = ownerPlayer->getTunnelSystem(); - if (tunnels==NULL) return false; + if (tunnels==nullptr) return false; if (tunnels->getCurNemesis()) { setNemesisID(tunnels->getCurNemesis()->getID()); return true; // Transitions to AITNGuardInnerState. @@ -329,9 +329,9 @@ AITNGuardInnerState::~AITNGuardInnerState(void) StateReturnType AITNGuardInnerState::onEnter( void ) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardInnerState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardInnerState.")); return STATE_SUCCESS; } m_exitConditions.m_attackGiveUpFrame = TheGameLogic->getFrame() + TheAI->getAiData()->m_guardChaseUnitFrames; @@ -364,7 +364,7 @@ static Object *TunnelNetworkScan(Object *owner) Real visionRange = AITNGuardMachine::getStdGuardRange(owner); - filters[count++] = NULL; + filters[count++] = nullptr; Object* target = ThePartitionManager->getClosestObject(owner->getPosition(), visionRange, FROM_CENTER_2D, filters); return target; @@ -375,7 +375,7 @@ StateReturnType AITNGuardInnerState::update( void ) { Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -383,7 +383,7 @@ StateReturnType AITNGuardInnerState::update( void ) Object* owner = getMachineOwner(); // killed him. Object *teamVictim = owner->getTeam()->getTeamTargetObject(); - if (nemesis == NULL) + if (nemesis == nullptr) { if (teamVictim) { @@ -416,7 +416,7 @@ StateReturnType AITNGuardInnerState::update( void ) } } } else { - if (nemesis != teamVictim && teamVictim != NULL) { + if (nemesis != teamVictim && teamVictim != nullptr) { tunnels->updateNemesis(nemesis); getGuardMachine()->setNemesisID(teamVictim->getID()); } @@ -431,7 +431,7 @@ void AITNGuardInnerState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -479,9 +479,9 @@ StateReturnType AITNGuardOuterState::onEnter( void ) } Object* nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()) ; - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardOuterState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardOuterState.")); return STATE_SUCCESS; } @@ -511,8 +511,8 @@ StateReturnType AITNGuardOuterState::update( void ) goalObj = nemesis; } // Check if team auto targets same victim. - Object *teamVictim = NULL; - if (goalObj == NULL && owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) + Object *teamVictim = nullptr; + if (goalObj == nullptr && owner->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = owner->getTeam()->getTeamTargetObject(); if (teamVictim) @@ -534,7 +534,7 @@ void AITNGuardOuterState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } } @@ -595,7 +595,7 @@ StateReturnType AITNGuardReturnState::onEnter( void ) // Find tunnel network to enter. // Scan my tunnels. Object *bestTunnel = findBestTunnel(getMachineOwner()->getControllingPlayer(), getMachineOwner()->getPosition()); - if (bestTunnel==NULL) return STATE_FAILURE; + if (bestTunnel==nullptr) return STATE_FAILURE; getMachine()->setGoalObject(bestTunnel); getMachineOwner()->getAI()->friend_setGoalObject(bestTunnel); @@ -615,7 +615,7 @@ StateReturnType AITNGuardReturnState::update( void ) } } // Check tunnel for target. - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -681,7 +681,7 @@ StateReturnType AITNGuardIdleState::onEnter( void ) UnsignedInt now = TheGameLogic->getFrame(); m_nextEnemyScanTime = now + GameLogicRandomValue(0, TheAI->getAiData()->m_guardEnemyScanRate); - getMachineOwner()->getAI()->friend_setGoalObject(NULL); + getMachineOwner()->getAI()->friend_setGoalObject(nullptr); return STATE_CONTINUE; } @@ -696,7 +696,7 @@ StateReturnType AITNGuardIdleState::update( void ) m_nextEnemyScanTime = now + TheAI->getAiData()->m_guardEnemyScanRate; - getMachineOwner()->getAI()->friend_setGoalObject(NULL); + getMachineOwner()->getAI()->friend_setGoalObject(nullptr); #ifdef STATE_MACHINE_DEBUG //getMachine()->setDebugOutput(true); @@ -714,15 +714,15 @@ StateReturnType AITNGuardIdleState::update( void ) if (getGuardMachine()->lookForInnerTarget()) { Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardAttackAggressorState.")); return STATE_SLEEP(0); } if (getMachineOwner()->getContainedBy()) { Object *bestTunnel = findBestTunnel(owner->getControllingPlayer(), nemesis->getPosition()); - ExitInterface* goalExitInterface = bestTunnel->getContain() ? bestTunnel->getContain()->getContainExitInterface() : NULL; - if( goalExitInterface == NULL ) + ExitInterface* goalExitInterface = bestTunnel->getContain() ? bestTunnel->getContain()->getContainExitInterface() : nullptr; + if( goalExitInterface == nullptr ) return STATE_FAILURE; if( goalExitInterface->isExitBusy() ) @@ -787,7 +787,7 @@ void AITNGuardPickUpCrateState::onExit( StateExitType status ) AITNGuardAttackAggressorState::AITNGuardAttackAggressorState( StateMachine *machine ) : State( machine, "AITNGuardAttackAggressorState" ) { - m_attackState = NULL; + m_attackState = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -809,14 +809,14 @@ StateReturnType AITNGuardAttackAggressorState::onEnter( void ) } Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); - if (nemesis == NULL) + if (nemesis == nullptr) { - DEBUG_LOG(("Unexpected NULL nemesis in AITNGuardAttackAggressorState.")); + DEBUG_LOG(("Unexpected null nemesis in AITNGuardAttackAggressorState.")); return STATE_SUCCESS; } Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -841,7 +841,7 @@ StateReturnType AITNGuardAttackAggressorState::update( void ) if (m_attackState->getMachine()->getCurrentStateID() == AttackStateMachine::FIRE_WEAPON) { Object *nemesis = TheGameLogic->findObjectByID(getGuardMachine()->getNemesisID()); Player *ownerPlayer = getMachineOwner()->getControllingPlayer(); - TunnelTracker *tunnels = NULL; + TunnelTracker *tunnels = nullptr; if (ownerPlayer) { tunnels = ownerPlayer->getTunnelSystem(); } @@ -858,12 +858,12 @@ void AITNGuardAttackAggressorState::onExit( StateExitType status ) { m_attackState->onExit(status); deleteInstance(m_attackState); - m_attackState = NULL; + m_attackState = nullptr; } if (obj->getTeam()) { - obj->getTeam()->setTeamTargetObject(NULL); // clear the target. + obj->getTeam()->setTeamTargetObject(nullptr); // clear the target. } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 291e622e712..7f30415ce33 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -84,7 +84,7 @@ void Squad::clearSquad() { // getAllObjects ////////////////////////////////////////////////////////////////////////////////// const VecObjectPtr& Squad::getAllObjects(void) // Not a const function cause we clear away dead object here too { - // prunes all NULL objects + // prunes all null objects m_objectsCached.clear(); for (VecObjectIDIt it = m_objectIDs.begin(); it != m_objectIDs.end(); ) { Object *obj = TheGameLogic->findObjectByID(*it); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 073f5b4fd01..b77b76cd2c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -85,8 +85,8 @@ TurretStateMachine::TurretStateMachine( TurretAI* tai, Object *obj, AsciiString { static const StateConditionInfo fireConditions[] = { - StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(outOfWeaponRangeObject, TURRETAI_AIM, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -203,7 +203,7 @@ static void parseTWS(INI* ini, void * /*instance*/, void * store, const void* /* { UnsignedInt* tws = (UnsignedInt*)store; const char* token = ini->getNextToken(); - while (token != NULL) + while (token != nullptr) { WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(token, TheWeaponSlotTypeNames); *tws |= (1 << wslot); @@ -216,7 +216,7 @@ void TurretAIData::parseTurretSweep(INI* ini, void *instance, void * /*store*/, { TurretAIData* self = (TurretAIData*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseAngleReal( ini, instance, &self->m_turretFireAngleSweep[wslot], NULL ); + INI::parseAngleReal( ini, instance, &self->m_turretFireAngleSweep[wslot], nullptr ); } //------------------------------------------------------------------------------------------------- @@ -224,7 +224,7 @@ void TurretAIData::parseTurretSweepSpeed(INI* ini, void *instance, void * /*stor { TurretAIData* self = (TurretAIData*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseReal( ini, instance, &self->m_turretSweepSpeedModifier[wslot], NULL ); + INI::parseReal( ini, instance, &self->m_turretSweepSpeedModifier[wslot], nullptr ); } //---------------------------------------------------------------------------------------------------------- @@ -232,28 +232,28 @@ void TurretAIData::buildFieldParse(MultiIniFieldParse& p) { static const FieldParse dataFieldParse[] = { - { "TurretTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( TurretAIData, m_turnRate ) }, - { "TurretPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( TurretAIData, m_pitchRate ) }, - { "NaturalTurretAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_naturalTurretAngle ) }, - { "NaturalTurretPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_naturalTurretPitch ) }, - { "FirePitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_firePitch ) }, - { "MinPhysicalPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_minPitch ) }, - { "GroundUnitPitch", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_groundUnitPitch ) }, - { "TurretFireAngleSweep", TurretAIData::parseTurretSweep, NULL, NULL }, - { "TurretSweepSpeedModifier",TurretAIData::parseTurretSweepSpeed, NULL, NULL }, - { "ControlledWeaponSlots", parseTWS, NULL, offsetof( TurretAIData, m_turretWeaponSlots ) }, - { "AllowsPitch", INI::parseBool, NULL, offsetof( TurretAIData, m_isAllowsPitch ) }, + { "TurretTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( TurretAIData, m_turnRate ) }, + { "TurretPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( TurretAIData, m_pitchRate ) }, + { "NaturalTurretAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_naturalTurretAngle ) }, + { "NaturalTurretPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_naturalTurretPitch ) }, + { "FirePitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_firePitch ) }, + { "MinPhysicalPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_minPitch ) }, + { "GroundUnitPitch", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_groundUnitPitch ) }, + { "TurretFireAngleSweep", TurretAIData::parseTurretSweep, nullptr, 0 }, + { "TurretSweepSpeedModifier",TurretAIData::parseTurretSweepSpeed, nullptr, 0 }, + { "ControlledWeaponSlots", parseTWS, nullptr, offsetof( TurretAIData, m_turretWeaponSlots ) }, + { "AllowsPitch", INI::parseBool, nullptr, offsetof( TurretAIData, m_isAllowsPitch ) }, #ifdef INTER_TURRET_DELAY - { "InterTurretDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_interTurretDelay ) }, + { "InterTurretDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_interTurretDelay ) }, #endif - { "MinIdleScanAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_minIdleScanAngle ) }, - { "MaxIdleScanAngle", INI::parseAngleReal, NULL, offsetof( TurretAIData, m_maxIdleScanAngle ) }, - { "MinIdleScanInterval", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_minIdleScanInterval ) }, - { "MaxIdleScanInterval", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_maxIdleScanInterval ) }, - { "RecenterTime", INI::parseDurationUnsignedInt, NULL, offsetof( TurretAIData, m_recenterTime ) }, - { "InitiallyDisabled", INI::parseBool, NULL, offsetof( TurretAIData, m_initiallyDisabled ) }, - { "FiresWhileTurning", INI::parseBool, NULL, offsetof( TurretAIData, m_firesWhileTurning ) }, - { 0, 0, 0, 0 } + { "MinIdleScanAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_minIdleScanAngle ) }, + { "MaxIdleScanAngle", INI::parseAngleReal, nullptr, offsetof( TurretAIData, m_maxIdleScanAngle ) }, + { "MinIdleScanInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_minIdleScanInterval ) }, + { "MaxIdleScanInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_maxIdleScanInterval ) }, + { "RecenterTime", INI::parseDurationUnsignedInt, nullptr, offsetof( TurretAIData, m_recenterTime ) }, + { "InitiallyDisabled", INI::parseBool, nullptr, offsetof( TurretAIData, m_initiallyDisabled ) }, + { "FiresWhileTurning", INI::parseBool, nullptr, offsetof( TurretAIData, m_firesWhileTurning ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -268,7 +268,7 @@ TurretAI::TurretAI(Object* owner, const TurretAIData* data, WhichTurretType tur) m_owner(owner), m_whichTurret(tur), m_data(data), - m_turretStateMachine(NULL), + m_turretStateMachine(nullptr), m_playRotSound(false), m_playPitchSound(false), m_positiveSweep(true), @@ -280,7 +280,7 @@ TurretAI::TurretAI(Object* owner, const TurretAIData* data, WhichTurretType tur) m_enabled(!data->m_initiallyDisabled), m_firesWhileTurning(data->m_firesWhileTurning), m_isForceAttacking(false), - m_victimInitialTeam(NULL) + m_victimInitialTeam(nullptr) { m_continuousFireExpirationFrame = -1; if (!m_data) @@ -497,7 +497,7 @@ Bool TurretAI::isOwnersCurWeaponOnTurret() const { WeaponSlotType wslot; Weapon* w = m_owner->getCurrentWeapon(&wslot); - return w != NULL && isWeaponSlotOnTurret(wslot); + return w != nullptr && isWeaponSlotOnTurret(wslot); } //---------------------------------------------------------------------------------------------------------- @@ -509,7 +509,7 @@ Bool TurretAI::isWeaponSlotOnTurret(WeaponSlotType wslot) const //---------------------------------------------------------------------------------------------------------- TurretTargetType TurretAI::friend_getTurretTarget( Object*& obj, Coord3D& pos, Bool clearDeadTargets ) const { - obj = NULL; + obj = nullptr; pos.zero(); if (m_target == TARGET_OBJECT) @@ -519,9 +519,9 @@ TurretTargetType TurretAI::friend_getTurretTarget( Object*& obj, Coord3D& pos, B // old (bogus) objectid internally if( clearDeadTargets ) { - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { - m_turretStateMachine->setGoalObject(NULL); + m_turretStateMachine->setGoalObject(nullptr); m_target = TARGET_NONE; m_targetWasSetByIdleMood = false; } @@ -529,7 +529,7 @@ TurretTargetType TurretAI::friend_getTurretTarget( Object*& obj, Coord3D& pos, B } else if (m_target == TARGET_POSITION) { - obj = NULL; + obj = nullptr; pos = *m_turretStateMachine->getGoalPosition(); } @@ -540,11 +540,11 @@ TurretTargetType TurretAI::friend_getTurretTarget( Object*& obj, Coord3D& pos, B void TurretAI::removeSelfAsTargeter() { // be paranoid, in case we are called from dtors, etc. - if (m_target == TARGET_OBJECT && m_turretStateMachine != NULL) + if (m_target == TARGET_OBJECT && m_turretStateMachine != nullptr) { Object* self = m_owner; Object* target = m_turretStateMachine->getGoalObject(); - if (self != NULL && target != NULL) + if (self != nullptr && target != nullptr) { AIUpdateInterface* targetAI = target->getAI(); if (targetAI) @@ -562,11 +562,11 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) { if( !getOwner()->getAI()->areTurretsLinked() ) { - victim = NULL; + victim = nullptr; } } - if (victim == NULL) + if (victim == nullptr) { // if nuking the victim, remove self as targeter before doing anything else. // (note that we never ADD self as targeter here; that is done in the aim state) @@ -579,7 +579,7 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) m_isForceAttacking = forceAttacking; StateID sid = m_turretStateMachine->getCurrentStateID(); - if (victim != NULL) + if (victim != nullptr) { // if we're already in the aim state, don't call setState, since // it would go thru the exit/enter stuff, which we don't really want @@ -593,7 +593,7 @@ void TurretAI::setTurretTargetObject( Object *victim, Bool forceAttacking ) // only change states if we are aiming. if (sid == TURRETAI_AIM || sid == TURRETAI_FIRE) m_turretStateMachine->setState(TURRETAI_HOLD); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } } @@ -604,7 +604,7 @@ void TurretAI::setTurretTargetPosition( const Coord3D* pos ) { if( !getOwner()->getAI()->areTurretsLinked() ) { - pos = NULL; + pos = nullptr; } } @@ -612,28 +612,28 @@ void TurretAI::setTurretTargetPosition( const Coord3D* pos ) // (note that we never ADD self as targeter here; that is done in the aim state) removeSelfAsTargeter(); - m_turretStateMachine->setGoalObject( NULL ); + m_turretStateMachine->setGoalObject( nullptr ); if (pos) m_turretStateMachine->setGoalPosition( pos ); m_target = pos ? TARGET_POSITION : TARGET_NONE; m_targetWasSetByIdleMood = false; StateID sid = m_turretStateMachine->getCurrentStateID(); - if (pos != NULL) + if (pos != nullptr) { // if we're already in the aim state, don't call setState, since // it would go thru the exit/enter stuff, which we don't really want // to do... if (sid != TURRETAI_AIM && sid != TURRETAI_FIRE) m_turretStateMachine->setState( TURRETAI_AIM ); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } else { // only change states if we are aiming. if (sid == TURRETAI_AIM || sid == TURRETAI_FIRE) m_turretStateMachine->setState(TURRETAI_HOLD); - m_victimInitialTeam = NULL; + m_victimInitialTeam = nullptr; } } @@ -796,7 +796,7 @@ void TurretAI::getOtherTurretWeaponInfo(Int& numSelf, Int& numSelfReloading, Int { // ignore empty slots. const Weapon* w = getOwner()->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; // ignore the weapons on this turret. @@ -828,7 +828,7 @@ Bool TurretAI::friend_isAnyWeaponInRangeOf(const Object* o) const { // ignore empty slots. const Weapon* w = getOwner()->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL || !isWeaponSlotOnTurret((WeaponSlotType)i)) + if (w == nullptr || !isWeaponSlotOnTurret((WeaponSlotType)i)) continue; if (w->isWithinAttackRange(getOwner(), o) @@ -966,7 +966,7 @@ StateReturnType TurretAIAimTurretState::update() } Object* enemy; - AIUpdateInterface* enemyAI=NULL; + AIUpdateInterface* enemyAI=nullptr; Coord3D enemyPosition; Bool preventing = false; TurretTargetType targetType = turret->friend_getTurretTarget(enemy, enemyPosition); @@ -998,14 +998,14 @@ StateReturnType TurretAIAimTurretState::update() } nothingInRange = !turret->friend_isAnyWeaponInRangeOf(enemy); - if (enemy == NULL || !ableToAttackTarget || + if (enemy == nullptr || !ableToAttackTarget || (!isPrimaryEnemy && nothingInRange) || enemy->getTeam() != turret->friend_getVictimInitialTeam() ) { if (turret->friend_getTargetWasSetByIdleMood()) { - turret->setTurretTargetObject(NULL, FALSE); + turret->setTurretTargetObject(nullptr, FALSE); } return STATE_FAILURE; } @@ -1031,7 +1031,7 @@ StateReturnType TurretAIAimTurretState::update() enemyPosition = *enemy->getPosition(); } - enemyAI = enemy ? enemy->getAI() : NULL; + enemyAI = enemy ? enemy->getAI() : nullptr; // add ourself as a targeter BEFORE calling isTemporarilyPreventingAimSuccess(). // we do this every time thru, just in case we get into a squabble with our ai @@ -1043,7 +1043,7 @@ StateReturnType TurretAIAimTurretState::update() // don't use 'enemy' after this point, just the position. to help // enforce this, we'll null it out. - enemy = NULL; + enemy = nullptr; break; } @@ -1058,7 +1058,7 @@ StateReturnType TurretAIAimTurretState::update() Weapon *curWeapon = obj->getCurrentWeapon( &slot ); if (!curWeapon) { - DEBUG_CRASH(("TurretAIAimTurretState::update - curWeapon is NULL.")); + DEBUG_CRASH(("TurretAIAimTurretState::update - curWeapon is null.")); return STATE_FAILURE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 6059e774eac..5ae459da41e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -36,14 +36,14 @@ #include "GameLogic/TerrainLogic.h" /* ********* PolygonTrigger class ****************************/ -PolygonTrigger *PolygonTrigger::ThePolygonTriggerListPtr = NULL; +PolygonTrigger *PolygonTrigger::ThePolygonTriggerListPtr = nullptr; Int PolygonTrigger::s_currentID = 1; /** PolygonTrigger - Constructor. */ PolygonTrigger::PolygonTrigger(Int initialAllocation) : -m_nextPolygonTrigger(NULL), -m_points(NULL), +m_nextPolygonTrigger(nullptr), +m_points(nullptr), m_numPoints(0), m_sizePoints(0), m_exportWithScripts(false), @@ -69,14 +69,14 @@ m_riverStart(0) PolygonTrigger::~PolygonTrigger(void) { delete [] m_points; - m_points = NULL; + m_points = nullptr; if (m_nextPolygonTrigger) { PolygonTrigger *cur = m_nextPolygonTrigger; PolygonTrigger *next; while (cur) { next = cur->getNext(); - cur->setNextPoly(NULL); // prevents recursion. + cur->setNextPoly(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -121,7 +121,7 @@ PolygonTrigger *PolygonTrigger::getPolygonTriggerByID(Int triggerID) return poly; // not found - return NULL; + return nullptr; } @@ -145,7 +145,7 @@ Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChu AsciiString layerName; // Remove any existing polygon triggers, if any. PolygonTrigger::deleteTriggers(); // just in case. - PolygonTrigger *pPrevTrig = NULL; + PolygonTrigger *pPrevTrig = nullptr; ICoord3D loc; count = file.readInt(); while (count>0) { @@ -309,7 +309,7 @@ void PolygonTrigger::addPolygonTrigger(PolygonTrigger *pTrigger) */ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) { - PolygonTrigger *pPrev = NULL; + PolygonTrigger *pPrev = nullptr; PolygonTrigger *pTrig=getFirstPolygonTrigger(); for (; pTrig; pTrig = pTrig->getNext()) { if (pTrig==pTrigger) break; @@ -325,7 +325,7 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) ThePolygonTriggerListPtr = pTrig->m_nextPolygonTrigger; } } - pTrigger->m_nextPolygonTrigger = NULL; + pTrigger->m_nextPolygonTrigger = nullptr; } /** @@ -334,7 +334,7 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) void PolygonTrigger::deleteTriggers(void) { PolygonTrigger *pList = ThePolygonTriggerListPtr; - ThePolygonTriggerListPtr = NULL; + ThePolygonTriggerListPtr = nullptr; s_currentID = 1; deleteInstance(pList); } @@ -419,7 +419,7 @@ void PolygonTrigger::deletePoint(Int ndx) void PolygonTrigger::getCenterPoint(Coord3D* pOutCoord) const { - DEBUG_ASSERTCRASH(pOutCoord != NULL, ("pOutCoord was null. Non-Fatal, but shouldn't happen.")); + DEBUG_ASSERTCRASH(pOutCoord != nullptr, ("pOutCoord was null. Non-Fatal, but shouldn't happen.")); if (!pOutCoord) { return; } @@ -490,7 +490,7 @@ const WaterHandle* PolygonTrigger::getWaterHandle(void) const if( isWaterArea() ) return &m_waterHandle; - return NULL; // this polygon trigger is not a water area + return nullptr; // this polygon trigger is not a water area } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index 4824fa87b91..9871e2707a3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -63,14 +63,14 @@ static const Int K_SIDES_DATA_VERSION_3 = 3; // includes Team list. SidesInfo - Constructor. */ SidesInfo::SidesInfo(void) : - m_pBuildList(NULL), - m_scripts(NULL) + m_pBuildList(nullptr), + m_scripts(nullptr) { } SidesInfo::SidesInfo(const SidesInfo& thatref) : - m_pBuildList(NULL), - m_scripts(NULL) + m_pBuildList(nullptr), + m_scripts(nullptr) { *this = thatref; } @@ -86,12 +86,12 @@ SidesInfo::~SidesInfo(void) void SidesInfo::init(const Dict* d) { deleteInstance(m_pBuildList); - m_pBuildList = NULL; + m_pBuildList = nullptr; m_dict.clear(); deleteInstance(m_scripts); - m_scripts = NULL; + m_scripts = nullptr; if (d) m_dict = *d; @@ -105,12 +105,12 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) this->clear(); this->m_dict = that.m_dict; - BuildListInfo* thisBLTail = NULL; + BuildListInfo* thisBLTail = nullptr; for (BuildListInfo* thatBL = that.m_pBuildList; thatBL; thatBL = thatBL->getNext()) { BuildListInfo* thisBL = newInstance( BuildListInfo ); *thisBL = *thatBL; - thisBL->setNextBuildList(NULL); + thisBL->setNextBuildList(nullptr); if (thisBLTail) thisBLTail->setNextBuildList(thisBL); @@ -123,7 +123,7 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) if (that.m_scripts) this->m_scripts = that.m_scripts->duplicate(); else - this->m_scripts = NULL; + this->m_scripts = nullptr; } return *this; } @@ -134,11 +134,11 @@ SidesInfo& SidesInfo::operator=(const SidesInfo& that) */ void SidesInfo::addToBuildList(BuildListInfo *pBuildList, Int position) { - DEBUG_ASSERTLOG(pBuildList->getNext()==NULL, ("WARNING***Adding already linked element.")); - BuildListInfo *pCur = NULL; + DEBUG_ASSERTLOG(pBuildList->getNext()==nullptr, ("WARNING***Adding already linked element.")); + BuildListInfo *pCur = nullptr; while (position) { position--; - if (pCur==NULL) { + if (pCur==nullptr) { pCur = m_pBuildList; } else { if (pCur->getNext()) { @@ -148,7 +148,7 @@ void SidesInfo::addToBuildList(BuildListInfo *pBuildList, Int position) } } } - if (pCur==NULL) { + if (pCur==nullptr) { // add to front of list. pBuildList->setNextBuildList(m_pBuildList); m_pBuildList = pBuildList; @@ -175,8 +175,8 @@ void SidesInfo::reorderInBuildList(BuildListInfo *pBuildList, Int newPosition) */ Int SidesInfo::removeFromBuildList(BuildListInfo *pBuildList) { - DEBUG_ASSERTCRASH(pBuildList, ("Removing NULL list.")); - if (pBuildList==NULL) return 0; + DEBUG_ASSERTCRASH(pBuildList, ("Removing null list.")); + if (pBuildList==nullptr) return 0; Int position = 0; @@ -196,12 +196,12 @@ Int SidesInfo::removeFromBuildList(BuildListInfo *pBuildList) pPrev->setNextBuildList(pBuildList->getNext()); } } - pBuildList->setNextBuildList(NULL); + pBuildList->setNextBuildList(nullptr); return position; } /* ********* SidesList class ****************************/ -/*extern*/ SidesList *TheSidesList = NULL; ///< singleton instance of SidesList +/*extern*/ SidesList *TheSidesList = nullptr; ///< singleton instance of SidesList /** SidesList - Constructor. */ @@ -246,7 +246,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v { DEBUG_ASSERTCRASH(TheSidesList, ("TheSidesList is null")); - if (TheSidesList==NULL) + if (TheSidesList==nullptr) return false; TheSidesList->clear(); @@ -297,7 +297,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v } file.registerParser( "PlayerScriptsList", info->label, ScriptList::ParseScriptsDataChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { throw(ERROR_CORRUPT_FILE_FORMAT); } ScriptList *scripts[MAX_PLAYER_COUNT]; @@ -306,11 +306,11 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v if (igetNumSides()) { deleteInstance(TheSidesList->getSideInfo(i)->getScriptList()); TheSidesList->getSideInfo(i)->setScriptList(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } else { // Read in more players worth than we have. deleteInstance(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } } TheSidesList->validateSides(); @@ -330,7 +330,7 @@ Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, v void SidesList::WriteSidesDataChunk(DataChunkOutput &chunkWriter) { DEBUG_ASSERTCRASH(TheSidesList, ("TheSidesList is null")); - if (TheSidesList==NULL) + if (TheSidesList==nullptr) return; /**********HEIGHT MAP DATA ***********************/ chunkWriter.openDataChunk("SidesList", K_SIDES_DATA_VERSION_3); @@ -388,12 +388,12 @@ void SidesList::WriteSidesDataChunk(DataChunkOutput &chunkWriter) } -TeamsInfo *SidesList::findTeamInfo(AsciiString name, Int* index /*= NULL*/) +TeamsInfo *SidesList::findTeamInfo(AsciiString name, Int* index /*= nullptr*/) { return m_teamrec.findTeamInfo(name, index); } -SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= NULL*/) +SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numSides; i++) { @@ -404,10 +404,10 @@ SidesInfo *SidesList::findSideInfo(AsciiString name, Int* index /*= NULL*/) return &m_sides[i]; } } - return NULL; + return nullptr; } -SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= NULL*/) +SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numSkirmishSides; i++) { @@ -418,7 +418,7 @@ SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= NULL return &m_skirmishSides[i]; } } - return NULL; + return nullptr; } static AsciiString static_readPlayerNames[MAX_PLAYER_COUNT]; @@ -510,9 +510,9 @@ void SidesList::prepareForMP_or_Skirmish(void) // Don't consider FactionCivilian. continue; } - if (m_skirmishSides[i].getScriptList()==NULL) continue; - if (m_skirmishSides[i].getScriptList()->getScript() != NULL || - m_skirmishSides[i].getScriptList()->getScriptGroup()!=NULL) { + if (m_skirmishSides[i].getScriptList()==nullptr) continue; + if (m_skirmishSides[i].getScriptList()->getScript() != nullptr || + m_skirmishSides[i].getScriptList()->getScriptGroup()!=nullptr) { gotScripts = true; } } @@ -548,7 +548,7 @@ void SidesList::prepareForMP_or_Skirmish(void) deleteInstance(getSkirmishSideInfo(curSide)->getScriptList()); getSkirmishSideInfo(curSide)->setScriptList(scripts[i]); - scripts[i] = NULL; + scripts[i] = nullptr; } for (i=0; igetAsciiString(TheKey_teamName); AsciiString towner = tdict->getAsciiString(TheKey_teamOwner); SidesInfo* si = findSideInfo(towner); - if (si == NULL || towner == tname) + if (si == nullptr || towner == tname) { DEBUG_LOG(("bad owner %s; reparenting to neutral...",towner.str())); tdict->setAsciiString(TheKey_teamOwner, AsciiString::TheEmptyString); @@ -878,8 +878,8 @@ void SidesList::xfer( Xfer *xfer ) scriptList = getSideInfo( i )->getScriptList(); scriptListPresent = scriptList ? TRUE : FALSE; xfer->xferBool( &scriptListPresent ); - if( (scriptList == NULL && scriptListPresent == TRUE) || - (scriptList != NULL && scriptListPresent == FALSE) ) + if( (scriptList == nullptr && scriptListPresent == TRUE) || + (scriptList != nullptr && scriptListPresent == FALSE) ) { DEBUG_CRASH(( "SidesList::xfer - script list missing/present mismatch" )); @@ -906,9 +906,9 @@ void SidesList::loadPostProcess( void ) BuildListInfo - Constructor. */ BuildListInfo::BuildListInfo(void) : -m_nextBuildList(NULL), -m_renderObj(NULL), -m_shadowObj(NULL), +m_nextBuildList(nullptr), +m_renderObj(nullptr), +m_shadowObj(nullptr), m_isInitiallyBuilt(false), m_numRebuilds(0), m_angle(0), @@ -950,7 +950,7 @@ BuildListInfo::~BuildListInfo(void) BuildListInfo *next; while (cur) { next = cur->getNext(); - cur->setNextBuildList(NULL); // prevents recursion. + cur->setNextBuildList(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -964,14 +964,14 @@ void BuildListInfo::parseStructure(INI *ini, void *instance, void* /*store*/, co static const FieldParse myFieldParse[] = { - { "Name", INI::parseAsciiString, NULL, offsetof( BuildListInfo, m_buildingName ) }, - { "Location", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_location ) }, - { "Rebuilds", INI::parseInt, NULL, offsetof( BuildListInfo, m_numRebuilds ) }, - { "Angle", INI::parseAngleReal, NULL, offsetof( BuildListInfo, m_angle ) }, - { "InitiallyBuilt", INI::parseBool, NULL, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, - { "RallyPointOffset", INI::parseCoord2D, NULL, offsetof( BuildListInfo, m_rallyPointOffset ) }, - { "AutomaticallyBuild", INI::parseBool, NULL, offsetof( BuildListInfo, m_automaticallyBuild ) }, - { NULL, NULL, NULL, 0 } + { "Name", INI::parseAsciiString, nullptr, offsetof( BuildListInfo, m_buildingName ) }, + { "Location", INI::parseCoord2D, nullptr, offsetof( BuildListInfo, m_location ) }, + { "Rebuilds", INI::parseInt, nullptr, offsetof( BuildListInfo, m_numRebuilds ) }, + { "Angle", INI::parseAngleReal, nullptr, offsetof( BuildListInfo, m_angle ) }, + { "InitiallyBuilt", INI::parseBool, nullptr, offsetof( BuildListInfo, m_isInitiallyBuilt ) }, + { "RallyPointOffset", INI::parseCoord2D, nullptr, offsetof( BuildListInfo, m_rallyPointOffset ) }, + { "AutomaticallyBuild", INI::parseBool, nullptr, offsetof( BuildListInfo, m_automaticallyBuild ) }, + { nullptr, nullptr, nullptr, 0 } }; BuildListInfo *buildInfo = newInstance( BuildListInfo ); @@ -988,13 +988,13 @@ BuildListInfo *BuildListInfo::duplicate(void) { BuildListInfo *first = newInstance( BuildListInfo ); *first = *this; - first->m_nextBuildList = NULL; + first->m_nextBuildList = nullptr; BuildListInfo *next = this->m_nextBuildList; BuildListInfo *cur = first; while (next) { BuildListInfo *link = newInstance( BuildListInfo ); *link = *next; - link->m_nextBuildList = NULL; + link->m_nextBuildList = nullptr; cur->m_nextBuildList = link; cur = link; next = next->m_nextBuildList; @@ -1062,12 +1062,12 @@ void BuildListInfo::loadPostProcess( void ) /* ********* TeamsInfoRec class ****************************/ TeamsInfoRec::TeamsInfoRec() : - m_numTeams(0), m_numTeamsAllocated(0), m_teams(NULL) + m_numTeams(0), m_numTeamsAllocated(0), m_teams(nullptr) { } TeamsInfoRec::TeamsInfoRec(const TeamsInfoRec& thatref) : - m_numTeams(0), m_numTeamsAllocated(0), m_teams(NULL) + m_numTeams(0), m_numTeamsAllocated(0), m_teams(nullptr) { *this = thatref; } @@ -1102,10 +1102,10 @@ void TeamsInfoRec::clear() m_numTeams = 0; m_numTeamsAllocated = 0; delete [] m_teams; - m_teams = NULL; + m_teams = nullptr; } -TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= NULL*/) +TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= nullptr*/) { for (int i = 0; i < m_numTeams; ++i) { @@ -1116,7 +1116,7 @@ TeamsInfo *TeamsInfoRec::findTeamInfo(AsciiString name, Int* index /*= NULL*/) return &m_teams[i]; } } - return NULL; + return nullptr; } void TeamsInfoRec::addTeam(const Dict* d) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index daaa6f9f0d5..f58be0b9632 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -61,7 +61,7 @@ // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -TerrainLogic *TheTerrainLogic = NULL; +TerrainLogic *TheTerrainLogic = nullptr; // STATIC ///////////////////////////////////////////////////////////////////////////////////////// WaterHandle TerrainLogic::m_gridWaterHandle; @@ -73,7 +73,7 @@ WaterHandle TerrainLogic::m_gridWaterHandle; Waypoint::Waypoint(WaypointID id, AsciiString name, const Coord3D *pLoc, AsciiString label1, AsciiString label2, AsciiString label3, Bool biDirectional) : m_name(name), -m_pNext(NULL), +m_pNext(nullptr), m_location(*pLoc), m_id(id), m_pathLabel1(label1), @@ -84,7 +84,7 @@ m_biDirectional(biDirectional) { Int i; for (i=0; isetTower( towerType, tower ); // tie the bridge to us BridgeTowerBehaviorInterface *bridgeTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( tower ); - DEBUG_ASSERTCRASH( bridgeTowerInterface != NULL, ("Bridge::createTower - no 'BridgeTowerBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeTowerInterface != nullptr, ("Bridge::createTower - no 'BridgeTowerBehaviorInterface' found") ); if( bridgeTowerInterface ) { @@ -244,7 +244,7 @@ m_bridgeInfo(theInfo) DEBUG_LOG(("*** GenericBridge template not found.")); return; } - Object *bridge = TheThingFactory->newObject(genericBridgeTemplate, NULL); + Object *bridge = TheThingFactory->newObject(genericBridgeTemplate, nullptr); Coord3D center; center.x = (m_bridgeInfo.fromLeft.x + m_bridgeInfo.toRight.x)/2.0f; center.y = (m_bridgeInfo.fromLeft.y + m_bridgeInfo.toRight.y)/2.0f; @@ -268,7 +268,7 @@ m_bridgeInfo(theInfo) // get the template of the bridge TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - if( bridgeTemplate == NULL ) { + if( bridgeTemplate == nullptr ) { DEBUG_LOG(( "*** Bridge Template Not Found '%s'.", bridgeTemplateName.str() )); return; } @@ -319,7 +319,7 @@ m_bridgeInfo(theInfo) } #endif - m_next = NULL; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -379,7 +379,7 @@ Bridge::Bridge(Object *bridgeObj) // get the template of the bridge AsciiString bridgeTemplateName = bridgeObj->getTemplate()->getName(); TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - if( bridgeTemplate == NULL ) { + if( bridgeTemplate == nullptr ) { DEBUG_LOG(( "*** Bridge Template Not Found '%s'.", bridgeTemplateName.str() )); return; } @@ -433,7 +433,7 @@ Bridge::Bridge(Object *bridgeObj) } - m_next = NULL; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -862,7 +862,7 @@ Drawable *Bridge::pickBridge(const Vector3 &from, const Vector3 &to, Vector3 *po return bridge->getDrawable(); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -916,7 +916,7 @@ void Bridge::updateDamageState( void ) // code will take care of that // BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridge ); - if( bbi == NULL || bbi->isScaffoldPresent() == FALSE ) + if( bbi == nullptr || bbi->isScaffoldPresent() == FALSE ) TheAI->pathfinder()->changeBridgeState(m_layer, true); m_bridgeInfo.damageStateChanged = true; } @@ -964,7 +964,7 @@ TerrainLogic::TerrainLogic() for( i = 0; i < MAX_DYNAMIC_WATER; ++i ) { - m_waterToUpdate[ i ].waterTable = NULL; + m_waterToUpdate[ i ].waterTable = nullptr; m_waterToUpdate[ i ].changePerFrame = 0.0f; m_waterToUpdate[ i ].targetHeight = 0.0f; m_waterToUpdate[ i ].damageAmount = 0.0f; @@ -973,9 +973,9 @@ TerrainLogic::TerrainLogic() } m_numWaterToUpdate = 0; - m_waypointListHead = NULL; - m_bridgeListHead = NULL; - m_mapData = NULL; + m_waypointListHead = nullptr; + m_bridgeListHead = nullptr; + m_mapData = nullptr; m_bridgeDamageStatesChanged = FALSE; m_mapDX = 0; m_mapDY = 0; @@ -1214,19 +1214,19 @@ void TerrainLogic::enableWaterGrid( Bool enable ) } - TheTerrainVisual->setWaterGridHeightClamps( NULL, + TheTerrainVisual->setWaterGridHeightClamps( nullptr, TheGlobalData->m_vertexWaterHeightClampLow[ waterSettingIndex ], TheGlobalData->m_vertexWaterHeightClampHi[ waterSettingIndex ] ); - TheTerrainVisual->setWaterTransform( NULL, + TheTerrainVisual->setWaterTransform( nullptr, TheGlobalData->m_vertexWaterAngle[ waterSettingIndex ], TheGlobalData->m_vertexWaterXPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterYPosition[ waterSettingIndex ], TheGlobalData->m_vertexWaterZPosition[ waterSettingIndex ] ); - TheTerrainVisual->setWaterGridResolution( NULL, + TheTerrainVisual->setWaterGridResolution( nullptr, TheGlobalData->m_vertexWaterXGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterYGridCells[ waterSettingIndex ], TheGlobalData->m_vertexWaterGridSize[ waterSettingIndex ] ); - TheTerrainVisual->setWaterAttenuationFactors( NULL, + TheTerrainVisual->setWaterAttenuationFactors( nullptr, TheGlobalData->m_vertexWaterAttenuationA[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationB[ waterSettingIndex ], TheGlobalData->m_vertexWaterAttenuationC[ waterSettingIndex ], @@ -1367,8 +1367,8 @@ void TerrainLogic::addWaypoint(MapObject *pMapObj) //------------------------------------------------------------------------------------------------- void TerrainLogic::addWaypointLink(Int id1, Int id2) { - Waypoint *pWay1 = NULL; - Waypoint *pWay2 = NULL; + Waypoint *pWay1 = nullptr; + Waypoint *pWay2 = nullptr; Waypoint *pWay; // Traverse all waypoints. /// @todo ID's should be UnsignedInts (MSB) @@ -1406,15 +1406,15 @@ void TerrainLogic::addWaypointLink(Int id1, Int id2) //------------------------------------------------------------------------------------------------- void TerrainLogic::deleteWaypoints(void) { - Waypoint *pNext = NULL; + Waypoint *pNext = nullptr; Waypoint *pWay; // Traverse all waypoints. for (pWay = getFirstWaypoint(); pWay; pWay = pNext) { pNext = pWay->getNext(); - pWay->setNext(NULL); + pWay->setNext(nullptr); deleteInstance(pWay); } - m_waypointListHead = NULL; + m_waypointListHead = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1560,7 +1560,7 @@ Waypoint *TerrainLogic::getWaypointByName( AsciiString name ) if (way->getName() == name) return way; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1572,7 +1572,7 @@ Waypoint *TerrainLogic::getWaypointByID( UnsignedInt id ) if (way->getID() == id) return way; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1581,10 +1581,10 @@ Waypoint *TerrainLogic::getWaypointByID( UnsignedInt id ) Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiString label ) { Real distSqr = 0; - Waypoint *pClosestWay = NULL; + Waypoint *pClosestWay = nullptr; if (label.isEmpty()) { DEBUG_LOG(("***Warning - asking for empty path label.")); - return NULL; + return nullptr; } for( Waypoint *way = m_waypointListHead; way; way = way->getNext() ) { @@ -1595,7 +1595,7 @@ Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiStrin if (match) { Coord3D curPos = *way->getLocation(); Real newDistSqr = (curPos.x-pos->x)*(curPos.x-pos->x) + (curPos.y-pos->y)*(curPos.y-pos->y); - if (pClosestWay==NULL) { + if (pClosestWay==nullptr) { pClosestWay = way; distSqr = newDistSqr; } else if (newDistSqr < distSqr) { @@ -1613,7 +1613,7 @@ Waypoint *TerrainLogic::getClosestWaypointOnPath( const Coord3D *pos, AsciiStrin //------------------------------------------------------------------------------------------------- Bool TerrainLogic::isPurposeOfPath( Waypoint *pWay, AsciiString label ) { - if (label.isEmpty() || pWay==NULL) { + if (label.isEmpty() || pWay==nullptr) { DEBUG_LOG(("***Warning - asking for empth path label.")); return false; } @@ -1628,7 +1628,7 @@ Bool TerrainLogic::isPurposeOfPath( Waypoint *pWay, AsciiString label ) //------------------------------------------------------------------------------------------------- -/** Given a name, return the associated trigger area, or NULL if one doesn't exist. */ +/** Given a name, return the associated trigger area, or null if one doesn't exist. */ //------------------------------------------------------------------------------------------------- PolygonTrigger *TerrainLogic::getTriggerAreaByName( AsciiString name ) { @@ -1637,7 +1637,7 @@ PolygonTrigger *TerrainLogic::getTriggerAreaByName( AsciiString name ) if (name == trigName) return pTrig; } - return NULL; + return nullptr; } @@ -1654,7 +1654,7 @@ Bridge * TerrainLogic::findBridgeAt( const Coord3D *pLoc) const } pBridge = pBridge->getNext(); } - return(NULL); + return(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1663,7 +1663,7 @@ Bridge * TerrainLogic::findBridgeAt( const Coord3D *pLoc) const Bridge * TerrainLogic::findBridgeLayerAt( const Coord3D *pLoc, PathfindLayerEnum layer, Bool clip) const { if (layer == LAYER_GROUND) - return NULL; + return nullptr; Bridge *pBridge = getFirstBridge(); while (pBridge) @@ -1674,7 +1674,7 @@ Bridge * TerrainLogic::findBridgeLayerAt( const Coord3D *pLoc, PathfindLayerEnum } pBridge = pBridge->getNext(); } - return(NULL); + return(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1700,7 +1700,7 @@ PathfindLayerEnum TerrainLogic::getLayerForDestination(const Coord3D *pos) while (pBridge ) { if (pBridge->isPointOnBridge(pos) ) { - Real delta = fabs(pos->z-pBridge->getBridgeHeight(pos, NULL)); + Real delta = fabs(pos->z-pBridge->getBridgeHeight(pos, nullptr)); if (deltagetLayer(); bestDistance = delta; @@ -1731,13 +1731,13 @@ PathfindLayerEnum TerrainLogic::getHighestLayerForDestination(const Coord3D *pos } } - for (Bridge *pBridge = getFirstBridge(); pBridge != NULL; pBridge = pBridge->getNext()) { + for (Bridge *pBridge = getFirstBridge(); pBridge != nullptr; pBridge = pBridge->getNext()) { if (onlyHealthyBridges && pBridge->peekBridgeInfo()->curDamageState == BODY_RUBBLE) continue; if (pBridge->isPointOnBridge(pos) ) { - Real delta = pos->z - pBridge->getBridgeHeight(pos, NULL); + Real delta = pos->z - pBridge->getBridgeHeight(pos, nullptr); // must be ABOVE (or on) the bridge for this call. (srj) if (delta >= 0 && fabs(delta) < fabs(bestDistance)) { bestLayer = pBridge->getLayer(); @@ -1787,7 +1787,7 @@ Bool TerrainLogic::objectInteractsWithBridgeLayer(Object *obj, Int layer, Bool c } if (match) { - Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), NULL); + Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), nullptr); Real delta = fabs(obj->getPosition()->z-bridgeHeight); if (delta>LAYER_Z_CLOSE_ENOUGH_F) { return false; @@ -1814,7 +1814,7 @@ Bool TerrainLogic::objectInteractsWithBridgeLayer(Object *obj, Int layer, Bool c //------------------------------------------------------------------------------------------------- Bool TerrainLogic::objectInteractsWithBridgeEnd(Object *obj, Int layer) const { - if (layer == LAYER_GROUND) return NULL; + if (layer == LAYER_GROUND) return false; Bridge *pBridge = getFirstBridge(); while (pBridge ) { @@ -1836,7 +1836,7 @@ Bool TerrainLogic::objectInteractsWithBridgeEnd(Object *obj, Int layer) const } if (match) { - Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), NULL); + Real bridgeHeight = pBridge->getBridgeHeight(obj->getPosition(), nullptr); Real delta = fabs(obj->getPosition()->z-bridgeHeight); if (delta>LAYER_Z_CLOSE_ENOUGH_F) { @@ -1958,7 +1958,7 @@ void TerrainLogic::getBridgeAttackPoints(const Object *bridge, TBridgeAttackInfo //------------------------------------------------------------------------------------------------- Drawable *TerrainLogic::pickBridge(const Vector3 &from, const Vector3 &to, Vector3 *pos) { - Drawable *curDraw = NULL; + Drawable *curDraw = nullptr; Vector3 curPos(0,0,0); Bridge *pBridge = getFirstBridge(); @@ -1980,15 +1980,15 @@ Drawable *TerrainLogic::pickBridge(const Vector3 &from, const Vector3 &to, Vecto //------------------------------------------------------------------------------------------------- void TerrainLogic::deleteBridges(void) { - Bridge *pNext = NULL; + Bridge *pNext = nullptr; Bridge *pBridge; // Traverse all waypoints. for (pBridge = getFirstBridge(); pBridge; pBridge = pNext) { pNext = pBridge->getNext(); - pBridge->setNext(NULL); + pBridge->setNext(nullptr); deleteInstance(pBridge); } - m_bridgeListHead = NULL; + m_bridgeListHead = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1998,7 +1998,7 @@ void TerrainLogic::deleteBridge( Bridge *bridge ) { // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // check for removing the head @@ -2139,7 +2139,7 @@ Bool TerrainLogic::isUnderwater( Real x, Real y, Real *waterZ, Real *terrainZ ) const WaterHandle *waterHandle = getWaterHandle( x, y ); // if no water here, no height, no nuttin - if( waterHandle == NULL ) + if( waterHandle == nullptr ) { // but we have to return the terrain Z if requested! if (terrainZ) @@ -2175,7 +2175,7 @@ Bool TerrainLogic::isUnderwater( Real x, Real y, Real *waterZ, Real *terrainZ ) // ------------------------------------------------------------------------------------------------ const WaterHandle* TerrainLogic::getWaterHandle( Real x, Real y ) { - const WaterHandle *waterHandle = NULL; + const WaterHandle *waterHandle = nullptr; Real waterZ = 0.0f; ICoord3D iLoc; @@ -2250,7 +2250,7 @@ const WaterHandle* TerrainLogic::getWaterHandleByName( AsciiString name ) trig = trig->getNext(); } - return NULL; + return nullptr; } @@ -2260,7 +2260,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) { // sanity - if( water == NULL ) + if( water == nullptr ) return 0.0f; // @@ -2276,7 +2276,7 @@ Real TerrainLogic::getWaterHeight( const WaterHandle *water ) } // sanity - DEBUG_ASSERTCRASH( water->m_polygon != NULL, ("getWaterHeight: polygon trigger in water handle is NULL") ); + DEBUG_ASSERTCRASH( water->m_polygon != nullptr, ("getWaterHeight: polygon trigger in water handle is null") ); // return the height of the water using the polygon trigger return water->m_polygon->getPoint( 0 )->z; @@ -2292,7 +2292,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d { // sanity - if( water == NULL ) + if( water == nullptr ) return; // @@ -2376,7 +2376,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( ¢er, maxDist, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *obj; const Coord3D *objPos; @@ -2425,7 +2425,7 @@ void TerrainLogic::changeWaterHeightOverTime( const WaterHandle *water, } // sanity - if( water == NULL ) + if( water == nullptr ) return; // if this water table already has an entry in the array to update, remove it @@ -2474,7 +2474,7 @@ void TerrainLogic::findAxisAlignedBoundingRect( const WaterHandle *water, Region { // sanity - if( water == NULL || region == NULL ) + if( water == nullptr || region == nullptr ) return; // setup the lo and high of the region to the *opposite* side of the map plus some big number @@ -2965,7 +2965,7 @@ void TerrainLogic::xfer( Xfer *xfer ) PolygonTrigger *poly = PolygonTrigger::getPolygonTriggerByID( triggerID ); // sanity - if( poly == NULL ) + if( poly == nullptr ) { DEBUG_CRASH(( "TerrainLogic::xfer - Unable to find polygon trigger for water table with trigger ID '%d'", @@ -2978,7 +2978,7 @@ void TerrainLogic::xfer( Xfer *xfer ) m_waterToUpdate[ i ].waterTable = poly->getWaterHandle(); // sanity - if( m_waterToUpdate[ i ].waterTable == NULL ) + if( m_waterToUpdate[ i ].waterTable == nullptr ) { DEBUG_CRASH(( "TerrainLogic::xfer - Polygon trigger to use for water handle has no water handle!" )); @@ -3017,7 +3017,7 @@ void TerrainLogic::loadPostProcess( void ) { pNext = pBridge->getNext(); Object* obj = TheGameLogic->findObjectByID(pBridge->peekBridgeInfo()->bridgeObjectID); - if (obj == NULL) + if (obj == nullptr) { deleteBridge(pBridge); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp index 6d4578d1971..7cdc1d5ec28 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp @@ -39,7 +39,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -ArmorStore* TheArmorStore = NULL; ///< the ArmorTemplate store definition +ArmorStore* TheArmorStore = nullptr; ///< the ArmorTemplate store definition /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// @@ -121,7 +121,7 @@ const ArmorTemplate* ArmorStore::findArmorTemplate(NameKeyType namekey) const ArmorTemplateMap::const_iterator it = m_armorTemplates.find(namekey); if (it == m_armorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -146,7 +146,7 @@ const ArmorTemplate* ArmorStore::findArmorTemplate(const char* name) const { static const FieldParse myFieldParse[] = { - { "Armor", ArmorTemplate::parseArmorCoefficients, NULL, 0 } + { "Armor", ArmorTemplate::parseArmorCoefficients, nullptr, 0 } }; const char *c = ini->getNextToken(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp index 35fd1c79f96..948120ac01e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp @@ -245,7 +245,7 @@ UpdateSleepTime AutoHealBehavior::update( void ) PartitionFilterRelationship relationship( obj, PartitionFilterRelationship::ALLOW_ALLIES ); PartitionFilterSameMapStatus filterMapStatus(obj); PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, nullptr }; // scan objects in our region ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( obj->getPosition(), d->m_radius, FROM_CENTER_2D, filters ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp index 40e24c023fb..14d6fbfd88a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp @@ -60,11 +60,11 @@ enum BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( void ) { - m_fxStartUndeath = NULL; - m_oclStartUndeath = NULL; + m_fxStartUndeath = nullptr; + m_oclStartUndeath = nullptr; - m_fxHitGround = NULL; - m_oclHitGround = NULL; + m_fxHitGround = nullptr; + m_oclHitGround = nullptr; m_throwForce = 1.0f; m_percentDamageToPassengers = 0.0f; @@ -81,17 +81,17 @@ BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( void static const FieldParse dataFieldParse[] = { - { "FXStartUndeath", INI::parseFXList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_fxStartUndeath ) }, - { "OCLStartUndeath", INI::parseObjectCreationList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_oclStartUndeath ) }, + { "FXStartUndeath", INI::parseFXList, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_fxStartUndeath ) }, + { "OCLStartUndeath", INI::parseObjectCreationList, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_oclStartUndeath ) }, - { "FXHitGround", INI::parseFXList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_fxHitGround ) }, - { "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_oclHitGround ) }, + { "FXHitGround", INI::parseFXList, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_fxHitGround ) }, + { "OCLHitGround", INI::parseObjectCreationList, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_oclHitGround ) }, - { "ThrowForce", INI::parseReal, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_throwForce ) }, - { "PercentDamageToPassengers", INI::parsePercentToReal, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_percentDamageToPassengers ) }, - { "EmptyHulkDestructionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_emptyHulkDestructionDelay ) }, + { "ThrowForce", INI::parseReal, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_throwForce ) }, + { "PercentDamageToPassengers", INI::parsePercentToReal, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_percentDamageToPassengers ) }, + { "EmptyHulkDestructionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( BattleBusSlowDeathBehaviorModuleData, m_emptyHulkDestructionDelay ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -146,7 +146,7 @@ void BattleBusSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) // First do the special effects FXList::doFXObj(data->m_fxStartUndeath, me ); - ObjectCreationList::create(data->m_oclStartUndeath, me, NULL ); + ObjectCreationList::create(data->m_oclStartUndeath, me, nullptr ); if( me->getAI() ) { @@ -200,7 +200,7 @@ UpdateSleepTime BattleBusSlowDeathBehavior::update( void ) // Do the special FX FXList::doFXObj(data->m_fxHitGround, me ); - ObjectCreationList::create(data->m_oclHitGround, me, NULL ); + ObjectCreationList::create(data->m_oclHitGround, me, nullptr ); me->setModelConditionState(MODELCONDITION_SECOND_LIFE); // And stop us forever @@ -237,7 +237,7 @@ UpdateSleepTime BattleBusSlowDeathBehavior::update( void ) const ContainModuleInterface *contain = me->getContain(); // Safety, no need to be awake if no special case to wait for - if( contain == NULL ) + if( contain == nullptr ) return UPDATE_SLEEP_FOREVER; if( m_penaltyDeathFrame != 0 ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 464e4f11b5c..0d547fb8420 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -85,11 +85,11 @@ BridgeBehaviorModuleData::~BridgeBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "LateralScaffoldSpeed", INI::parseVelocityReal, NULL, offsetof( BridgeBehaviorModuleData, m_lateralScaffoldSpeed ) }, - { "VerticalScaffoldSpeed", INI::parseVelocityReal, NULL, offsetof( BridgeBehaviorModuleData, m_verticalScaffoldSpeed ) }, - { "BridgeDieFX", parseFX, NULL, offsetof( BridgeBehaviorModuleData, m_fx ) }, - { "BridgeDieOCL", parseOCL, NULL, offsetof( BridgeBehaviorModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "LateralScaffoldSpeed", INI::parseVelocityReal, nullptr, offsetof( BridgeBehaviorModuleData, m_lateralScaffoldSpeed ) }, + { "VerticalScaffoldSpeed", INI::parseVelocityReal, nullptr, offsetof( BridgeBehaviorModuleData, m_verticalScaffoldSpeed ) }, + { "BridgeDieFX", parseFX, nullptr, offsetof( BridgeBehaviorModuleData, m_fx ) }, + { "BridgeDieOCL", parseOCL, nullptr, offsetof( BridgeBehaviorModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -115,7 +115,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, } // delay value - ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, NULL ); + ini->parseDurationUnsignedInt( ini, instance, &timeAndLocationInfo->delay, nullptr ); // get optional bone label token = ini->getNextTokenOrNull( ini->getSepsColon() ); @@ -149,7 +149,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // create item we will read into and push on list BridgeFXInfo item; - item.fx = NULL; + item.fx = nullptr; // get list to store at BridgeFXList *bridgeFXList = (BridgeFXList *)store; @@ -166,7 +166,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // fx list name and store as pointer FXList *fx; - ini->parseFXList( ini, instance, &fx, NULL ); + ini->parseFXList( ini, instance, &fx, nullptr ); // store fx list to item item.fx = fx; @@ -190,7 +190,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // create item we will read into and push on list BridgeOCLInfo item; - item.ocl = NULL; + item.ocl = nullptr; // get list to store at BridgeOCLList *bridgeOCLList = (BridgeOCLList *)store; @@ -207,7 +207,7 @@ static void parseTimeAndLocationInfo( INI *ini, void *instance, // fx list name and store as pointer ObjectCreationList *ocl; - ini->parseObjectCreationList( ini, instance, &ocl, NULL ); + ini->parseObjectCreationList( ini, instance, &ocl, nullptr ); // store ocl list to item item.ocl = ocl; @@ -244,10 +244,10 @@ BridgeBehavior::BridgeBehavior( Thing *thing, const ModuleData *moduleData ) for( i = 0; i < MAX_BRIDGE_BODY_FX; ++i ) { - m_damageToOCL[ bodyState ][ i ] = NULL; - m_damageToFX[ bodyState ][ i ] = NULL; - m_repairToOCL[ bodyState ][ i ] = NULL; - m_repairToFX[ bodyState ][ i ] = NULL; + m_damageToOCL[ bodyState ][ i ] = nullptr; + m_damageToFX[ bodyState ][ i ] = nullptr; + m_repairToOCL[ bodyState ][ i ] = nullptr; + m_repairToFX[ bodyState ][ i ] = nullptr; } @@ -291,11 +291,11 @@ BridgeBehavior::~BridgeBehavior( void ) { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; BehaviorModule **bmi; - BridgeBehaviorInterface *bbi = NULL; + BridgeBehaviorInterface *bbi = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -306,7 +306,7 @@ BridgeBehavior::~BridgeBehavior( void ) } // interface not found - return NULL; + return nullptr; } @@ -328,7 +328,7 @@ void BridgeBehavior::resolveFX( void ) Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // get the bridge template name @@ -338,7 +338,7 @@ void BridgeBehavior::resolveFX( void ) TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); // sanity - if( bridgeTemplate == NULL ) + if( bridgeTemplate == nullptr ) return; AsciiString name; @@ -351,22 +351,22 @@ void BridgeBehavior::resolveFX( void ) name = bridgeTemplate->getDamageToOCLString( (BodyDamageType)bodyState, i ); m_damageToOCL[ bodyState ][ i ] = TheObjectCreationListStore->findObjectCreationList( name.str() ); - if( name.isEmpty() == FALSE && m_damageToOCL[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_damageToOCL[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "OCL list '%s' not found", name.str() )); name = bridgeTemplate->getDamageToFXString( (BodyDamageType)bodyState, i ); m_damageToFX[ bodyState ][ i ] = TheFXListStore->findFXList( name.str() ); - if( name.isEmpty() == FALSE && m_damageToFX[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_damageToFX[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); name = bridgeTemplate->getRepairedToOCLString( (BodyDamageType)bodyState, i ); m_repairToOCL[ bodyState ][ i ] = TheObjectCreationListStore->findObjectCreationList( name.str() ); - if( name.isEmpty() == FALSE && m_repairToOCL[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_repairToOCL[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "OCL list '%s' not found", name.str() )); name = bridgeTemplate->getRepairedToFXString( (BodyDamageType)bodyState, i ); m_repairToFX[ bodyState ][ i ] = TheFXListStore->findFXList( name.str() ); - if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == NULL ) + if( name.isEmpty() == FALSE && m_repairToFX[ bodyState ][ i ] == nullptr ) DEBUG_CRASH(( "FX list '%s' not found", name.str() )); } @@ -445,7 +445,7 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) // to all our towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + if( source == nullptr || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) { Object *tower; @@ -489,7 +489,7 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) // to all our towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + if( source == nullptr || source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) { Object *tower; @@ -519,7 +519,7 @@ void BridgeBehavior::getRandomSurfacePosition( TerrainRoadType *bridgeTemplate, { // sanity - if( bridgeInfo == NULL || pos == NULL ) + if( bridgeInfo == nullptr || pos == nullptr ) return; // @@ -568,11 +568,11 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, { // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // if no effects, don't bother - if( ocl == NULL && fx == NULL ) + if( ocl == nullptr && fx == nullptr ) return; // get bridge info @@ -598,7 +598,7 @@ void BridgeBehavior::doAreaEffects( TerrainRoadType *bridgeTemplate, { getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); - ObjectCreationList::create( ocl, getObject(), &pos, NULL, INVALID_ANGLE ); + ObjectCreationList::create( ocl, getObject(), &pos, nullptr, INVALID_ANGLE ); } @@ -635,7 +635,7 @@ void BridgeBehavior::onBodyDamageStateChange( const DamageInfo* damageInfo, Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) { DEBUG_CRASH(( "BridgeBehavior - Unable to find bridge" )); @@ -719,8 +719,8 @@ UpdateSleepTime BridgeBehavior::update( void ) // get bridge information Bridge *bridge = TheTerrainLogic->findBridgeAt( us->getPosition() ); - const BridgeInfo *bridgeInfo = NULL; - TerrainRoadType *bridgeTemplate = NULL; + const BridgeInfo *bridgeInfo = nullptr; + TerrainRoadType *bridgeTemplate = nullptr; if ( bridge ) { DEBUG_ASSERTCRASH( bridge, ("BridgeBehavior::update - Unable to find bridge") ); @@ -756,7 +756,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // boneName = (*fxIt).timeAndLocationInfo.boneName; if( boneName.isEmpty() == FALSE ) - us->getSingleLogicalBonePosition( boneName.str(), &pos, NULL ); + us->getSingleLogicalBonePosition( boneName.str(), &pos, nullptr ); else if ( bridge && bridgeTemplate && bridgeInfo)//we have valid Terrain data for the bridge getRandomSurfacePosition( bridgeTemplate, bridgeInfo, &pos ); else @@ -802,17 +802,17 @@ UpdateSleepTime BridgeBehavior::update( void ) { // launch the effects just using the parent object for location info - ObjectCreationList::create( (*oclIt).ocl, us, NULL ); + ObjectCreationList::create( (*oclIt).ocl, us, nullptr ); } else { // get bone position - us->getSingleLogicalBonePosition( boneName.str(), &pos, NULL ); + us->getSingleLogicalBonePosition( boneName.str(), &pos, nullptr ); // launch the fx list - ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL, INVALID_ANGLE ); + ObjectCreationList::create( (*oclIt).ocl, us, &pos, nullptr, INVALID_ANGLE ); } @@ -827,7 +827,7 @@ UpdateSleepTime BridgeBehavior::update( void ) pos.set( getObject()->getPosition() ); // launch the fx list - ObjectCreationList::create( (*oclIt).ocl, us, &pos, NULL, INVALID_ANGLE ); + ObjectCreationList::create( (*oclIt).ocl, us, &pos, nullptr, INVALID_ANGLE ); } @@ -965,7 +965,7 @@ void BridgeBehavior::setScaffoldData( Object *obj, { // sanity - if( obj == NULL || angle == NULL || riseToPos == NULL || buildPos == NULL ) + if( obj == nullptr || angle == nullptr || riseToPos == nullptr || buildPos == nullptr ) return; const BridgeBehaviorModuleData *modData = getBridgeBehaviorModuleData(); @@ -1041,7 +1041,7 @@ void BridgeBehavior::createScaffolding( void ) // get the thing template for the scaffold object we're going to use AsciiString scaffoldObjectName = bridgeTemplate->getScaffoldObjectName(); const ThingTemplate *scaffoldTemplate = TheThingFactory->findTemplate( scaffoldObjectName ); - if( scaffoldTemplate == NULL ) + if( scaffoldTemplate == nullptr ) { DEBUG_CRASH(( "Unable to find bridge scaffold template" )); @@ -1052,7 +1052,7 @@ void BridgeBehavior::createScaffolding( void ) // get thing template for scaffold support object AsciiString scaffoldSupportObjectName = bridgeTemplate->getScaffoldSupportObjectName(); const ThingTemplate *scaffoldSupportTemplate = TheThingFactory->findTemplate( scaffoldSupportObjectName ); - if( scaffoldSupportTemplate == NULL ) + if( scaffoldSupportTemplate == nullptr ) { DEBUG_CRASH(( "Unable to find bridge support scaffold template" )); @@ -1299,7 +1299,7 @@ void BridgeBehavior::removeScaffolding( void ) // get the object obj = TheGameLogic->findObjectByID( (*it) ); - if( obj == NULL ) + if( obj == nullptr ) continue; // get the scaffold behavior @@ -1346,12 +1346,12 @@ Bool BridgeBehavior::isScaffoldInMotion( void ) // get object obj = TheGameLogic->findObjectByID( (*it) ); - if( obj == NULL ) + if( obj == nullptr ) continue; // get scaffold interface BridgeScaffoldBehaviorInterface *bsbi = BridgeScaffoldBehavior::getBridgeScaffoldBehaviorInterfaceFromObject( obj ); - if( bsbi == NULL ) + if( bsbi == nullptr ) continue; // check in motion diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index aa3be3bdb92..f5988cfe255 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -284,11 +284,11 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi { // santiy - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; // get the bridge tower behavior interface - BridgeScaffoldBehaviorInterface *bridgeScaffoldInterface = NULL; + BridgeScaffoldBehaviorInterface *bridgeScaffoldInterface = nullptr; BehaviorModule **bmi; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -300,7 +300,7 @@ BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehavi } // interface not found - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index ecdb0c41a8f..d26f686b92a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -62,7 +62,7 @@ BridgeTowerBehavior::~BridgeTowerBehavior( void ) void BridgeTowerBehavior::setBridge( Object *bridge ) { - if( bridge == NULL ) + if( bridge == nullptr ) m_bridgeID = INVALID_ID; else m_bridgeID = bridge->getID(); @@ -94,7 +94,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) Object *bridge = TheGameLogic->findObjectByID( getBridgeID() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // @@ -106,7 +106,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // get the bridge behavior module for our bridge BehaviorModule **bmi; - BridgeBehaviorInterface *bridgeInterface = NULL; + BridgeBehaviorInterface *bridgeInterface = nullptr; for( bmi = bridge->getBehaviorModules(); *bmi; ++bmi ) { @@ -115,7 +115,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) break; } - DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeInterface != nullptr, ("BridgeTowerBehavior::onDamage - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -124,7 +124,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // or other towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || + if( source == nullptr || (source->isKindOf( KINDOF_BRIDGE ) == FALSE && source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE) ) { @@ -175,7 +175,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) Object *bridge = TheGameLogic->findObjectByID( getBridgeID() ); // sanity - if( bridge == NULL ) + if( bridge == nullptr ) return; // @@ -187,7 +187,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // get the bridge behavior module for our bridge BehaviorModule **bmi; - BridgeBehaviorInterface *bridgeInterface = NULL; + BridgeBehaviorInterface *bridgeInterface = nullptr; for( bmi = bridge->getBehaviorModules(); *bmi; ++bmi ) { @@ -196,7 +196,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) break; } - DEBUG_ASSERTCRASH( bridgeInterface != NULL, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); + DEBUG_ASSERTCRASH( bridgeInterface != nullptr, ("BridgeTowerBehavior::onHealing - no 'BridgeBehaviorInterface' found") ); if( bridgeInterface ) { @@ -205,7 +205,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // or other towers // Object *source = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); - if( source == NULL || + if( source == nullptr || (source->isKindOf( KINDOF_BRIDGE ) == FALSE && source->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE) ) { @@ -269,11 +269,11 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa { // sanity - if( obj == NULL || obj->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) - return NULL; + if( obj == nullptr || obj->isKindOf( KINDOF_BRIDGE_TOWER ) == FALSE ) + return nullptr; BehaviorModule **bmi; - BridgeTowerBehaviorInterface *bridgeTowerInterface = NULL; + BridgeTowerBehaviorInterface *bridgeTowerInterface = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -284,7 +284,7 @@ BridgeTowerBehaviorInterface *BridgeTowerBehavior::getBridgeTowerBehaviorInterfa } // interface not found - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp index bfed83b3a9c..3e6f1ce07a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp @@ -52,16 +52,16 @@ static DomeStyleSeismicFilter bunkerBusterHeavingEarthSeismicFilter; BunkerBusterBehaviorModuleData::BunkerBusterBehaviorModuleData( void ) { - m_upgradeRequired = NULL; - m_detonationFX = NULL; - m_crashThroughBunkerFX = NULL; + m_upgradeRequired = nullptr; + m_detonationFX = nullptr; + m_crashThroughBunkerFX = nullptr; m_crashThroughBunkerFXFrequency = 4; m_seismicEffectRadius = 140.0f; m_seismicEffectMagnitude = 6.0f; - m_shockwaveWeaponTemplate = NULL; - m_occupantDamageWeaponTemplate = NULL; + m_shockwaveWeaponTemplate = nullptr; + m_occupantDamageWeaponTemplate = nullptr; } @@ -73,16 +73,16 @@ BunkerBusterBehaviorModuleData::BunkerBusterBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "UpgradeRequired", INI::parseAsciiString, NULL, offsetof( BunkerBusterBehaviorModuleData, m_upgradeRequired ) }, - { "DetonationFX", INI::parseFXList, NULL, offsetof( BunkerBusterBehaviorModuleData, m_detonationFX ) }, - { "CrashThroughBunkerFX", INI::parseFXList, NULL, offsetof( BunkerBusterBehaviorModuleData, m_crashThroughBunkerFX ) }, - { "CrashThroughBunkerFXFrequency", INI::parseDurationUnsignedInt, NULL, offsetof( BunkerBusterBehaviorModuleData, m_crashThroughBunkerFXFrequency ) }, - { "SeismicEffectRadius", INI::parseReal, NULL, offsetof( BunkerBusterBehaviorModuleData, m_seismicEffectRadius ) }, - { "SeismicEffectMagnitude", INI::parseReal, NULL, offsetof( BunkerBusterBehaviorModuleData, m_seismicEffectMagnitude ) }, - { "ShockwaveWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( BunkerBusterBehaviorModuleData, m_shockwaveWeaponTemplate ) }, - { "OccupantDamageWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( BunkerBusterBehaviorModuleData, m_occupantDamageWeaponTemplate ) }, - - { 0, 0, 0, 0 } + { "UpgradeRequired", INI::parseAsciiString, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_upgradeRequired ) }, + { "DetonationFX", INI::parseFXList, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_detonationFX ) }, + { "CrashThroughBunkerFX", INI::parseFXList, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_crashThroughBunkerFX ) }, + { "CrashThroughBunkerFXFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_crashThroughBunkerFXFrequency ) }, + { "SeismicEffectRadius", INI::parseReal, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_seismicEffectRadius ) }, + { "SeismicEffectMagnitude", INI::parseReal, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_seismicEffectMagnitude ) }, + { "ShockwaveWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_shockwaveWeaponTemplate ) }, + { "OccupantDamageWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( BunkerBusterBehaviorModuleData, m_occupantDamageWeaponTemplate ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -101,7 +101,7 @@ BunkerBusterBehavior::BunkerBusterBehavior( Thing *thing, const ModuleData *modD // THIS HAS AN UPDATE... BECAUSE I FORSEE THE NEED FOR ONE, BUT RIGHT NOW IT DOES NOTHING setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); m_victimID = INVALID_ID; - m_upgradeRequired = NULL; + m_upgradeRequired = nullptr; } @@ -180,7 +180,7 @@ void BunkerBusterBehavior::bustTheBunker( void ) { const BunkerBusterBehaviorModuleData *modData = getBunkerBusterBehaviorModuleData(); - if ( m_upgradeRequired != NULL ) + if ( m_upgradeRequired != nullptr ) { Bool weaponUpgraded = getObject()->getControllingPlayer()->hasUpgradeComplete( m_upgradeRequired ); if ( ! weaponUpgraded ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp index 53127c72712..01aa02cbc21 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp @@ -121,10 +121,10 @@ void CountermeasuresBehavior::reportMissileForCountermeasures( Object *missile ) if( GameLogicRandomValueReal( 0.0f, 1.0f ) < data->m_evasionRate ) { //This missile will be diverted! - ProjectileUpdateInterface* pui = NULL; + ProjectileUpdateInterface* pui = nullptr; for( BehaviorModule** u = missile->getBehaviorModules(); *u; ++u ) { - if( (pui = (*u)->getProjectileUpdateInterface()) != NULL ) + if( (pui = (*u)->getProjectileUpdateInterface()) != nullptr ) { //Make sure the missile diverts after a delay. The delay needs to be larger than //the countermeasure reaction time or else the missile won't have a countermeasure to divert to! @@ -157,7 +157,7 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec // This can slightly change behavior but does not significantly impact the overall survivability of the aircraft Real closestFlareDist = 1e15f; - Object *closestFlare = NULL; + Object *closestFlare = nullptr; const int volleySize = data->m_volleySize; int volleyFlaresCounted = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index f53b524ee03..2753844751a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -65,7 +65,7 @@ DumbProjectileBehaviorModuleData::DumbProjectileBehaviorModuleData() : m_firstPercentIndent(0.0f), m_secondPercentIndent(0.0f), m_garrisonHitKillCount(0), - m_garrisonHitKillFX(NULL), + m_garrisonHitKillFX(nullptr), m_flightPathAdjustDistPerFrame(0.0f) { } @@ -77,25 +77,25 @@ void DumbProjectileBehaviorModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxLifespan", INI::parseDurationUnsignedInt, NULL, offsetof( DumbProjectileBehaviorModuleData, m_maxLifespan ) }, - { "TumbleRandomly", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_tumbleRandomly ) }, - { "DetonateCallsKill", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_detonateCallsKill ) }, - { "OrientToFlightPath", INI::parseBool, NULL, offsetof( DumbProjectileBehaviorModuleData, m_orientToFlightPath ) }, + { "MaxLifespan", INI::parseDurationUnsignedInt, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_maxLifespan ) }, + { "TumbleRandomly", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_tumbleRandomly ) }, + { "DetonateCallsKill", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_detonateCallsKill ) }, + { "OrientToFlightPath", INI::parseBool, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_orientToFlightPath ) }, - { "FirstHeight", INI::parseReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_firstHeight ) }, - { "SecondHeight", INI::parseReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_secondHeight ) }, - { "FirstPercentIndent", INI::parsePercentToReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_firstPercentIndent ) }, - { "SecondPercentIndent", INI::parsePercentToReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_secondPercentIndent ) }, + { "FirstHeight", INI::parseReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_firstHeight ) }, + { "SecondHeight", INI::parseReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_secondHeight ) }, + { "FirstPercentIndent", INI::parsePercentToReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_firstPercentIndent ) }, + { "SecondPercentIndent", INI::parsePercentToReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_secondPercentIndent ) }, - { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindof ) }, - { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindofNot ) }, - { "GarrisonHitKillCount", INI::parseUnsignedInt, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillCount ) }, - { "GarrisonHitKillFX", INI::parseFXList, NULL, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillFX ) }, + { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindof ) }, + { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillKindofNot ) }, + { "GarrisonHitKillCount", INI::parseUnsignedInt, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillCount ) }, + { "GarrisonHitKillFX", INI::parseFXList, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_garrisonHitKillFX ) }, - { "FlightPathAdjustDistPerSecond", INI::parseVelocityReal, NULL, offsetof( DumbProjectileBehaviorModuleData, m_flightPathAdjustDistPerFrame ) }, + { "FlightPathAdjustDistPerSecond", INI::parseVelocityReal, nullptr, offsetof( DumbProjectileBehaviorModuleData, m_flightPathAdjustDistPerFrame ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -110,7 +110,7 @@ DumbProjectileBehavior::DumbProjectileBehavior( Thing *thing, const ModuleData* { m_launcherID = INVALID_ID; m_victimID = INVALID_ID; - m_detonationWeaponTmpl = NULL; + m_detonationWeaponTmpl = nullptr; m_lifespanFrame = 0; m_flightPath.clear(); m_flightPathSegments = 0; @@ -409,7 +409,7 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments) controlPoints[3] = m_flightPathEnd; Real highestInterveningTerrain; - Bool onMap = ThePartitionManager->estimateTerrainExtremesAlongLine( controlPoints[0], controlPoints[3], NULL, &highestInterveningTerrain, NULL, NULL ); + Bool onMap = ThePartitionManager->estimateTerrainExtremesAlongLine( controlPoints[0], controlPoints[3], nullptr, &highestInterveningTerrain, nullptr, nullptr ); if( !onMap ) { return false; @@ -463,7 +463,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) { const DumbProjectileBehaviorModuleData* d = getDumbProjectileBehaviorModuleData(); - if (other != NULL) + if (other != nullptr) { Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); @@ -502,7 +502,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) if (numKilled > 0) { // note, fx is played at center of building, not at grenade's location - FXList::doFXObj(d->m_garrisonHitKillFX, other, NULL); + FXList::doFXObj(d->m_garrisonHitKillFX, other, nullptr); getObject()->getControllingPlayer()->getAcademyStats()->recordClearedGarrisonedBuilding(); @@ -756,7 +756,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) { if( weaponTemplateName == AsciiString::TheEmptyString ) - m_detonationWeaponTmpl = NULL; + m_detonationWeaponTmpl = nullptr; else { @@ -764,7 +764,7 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate( weaponTemplateName ); // sanity - if( m_detonationWeaponTmpl == NULL ) + if( m_detonationWeaponTmpl == nullptr ) { DEBUG_CRASH(( "DumbProjectileBehavior::xfer - Unknown weapon template '%s'", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp index 3e910e6bef1..f6f12b85693 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FireWeaponWhenDamagedBehavior.cpp @@ -57,14 +57,14 @@ const Real END_MIDPOINT_RATIO = 0.65f; //------------------------------------------------------------------------------------------------- FireWeaponWhenDamagedBehavior::FireWeaponWhenDamagedBehavior( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), - m_reactionWeaponPristine( NULL ), - m_reactionWeaponDamaged( NULL ), - m_reactionWeaponReallyDamaged( NULL ), - m_reactionWeaponRubble( NULL ), - m_continuousWeaponPristine( NULL ), - m_continuousWeaponDamaged( NULL ), - m_continuousWeaponReallyDamaged( NULL ), - m_continuousWeaponRubble( NULL ) + m_reactionWeaponPristine( nullptr ), + m_reactionWeaponDamaged( nullptr ), + m_reactionWeaponReallyDamaged( nullptr ), + m_reactionWeaponRubble( nullptr ), + m_continuousWeaponPristine( nullptr ), + m_continuousWeaponDamaged( nullptr ), + m_continuousWeaponReallyDamaged( nullptr ), + m_continuousWeaponRubble( nullptr ) { const FireWeaponWhenDamagedBehaviorModuleData *d = getFireWeaponWhenDamagedBehaviorModuleData(); @@ -127,10 +127,10 @@ FireWeaponWhenDamagedBehavior::FireWeaponWhenDamagedBehavior( Thing *thing, cons } if (isUpgradeActive() && - (d->m_continuousWeaponPristine != NULL || - d->m_continuousWeaponDamaged != NULL || - d->m_continuousWeaponReallyDamaged != NULL || - d->m_continuousWeaponRubble != NULL)) + (d->m_continuousWeaponPristine != nullptr || + d->m_continuousWeaponDamaged != nullptr || + d->m_continuousWeaponReallyDamaged != nullptr || + d->m_continuousWeaponRubble != nullptr)) { setWakeFrame(getObject(), UPDATE_SLEEP_NONE); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index 673cdc7441f..1ff88b7c199 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -89,37 +89,37 @@ void FlightDeckBehaviorModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "NumRunways", INI::parseInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_numCols ) }, - { "NumSpacesPerRunway", INI::parseInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_numRows ) }, - - { "Runway1Spaces", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_spacesBoneNames ) }, - { "Runway1Takeoff", parseRunwayStrip, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_takeoffBoneNames ) }, - { "Runway1Landing", parseRunwayStrip, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_landingBoneNames ) }, - { "Runway1Taxi", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_taxiBoneNames ) }, - { "Runway1Creation", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_creationBoneNames ) }, - { "Runway1CatapultSystem", INI::parseParticleSystemTemplate, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_catapultParticleSystem ) }, - - { "Runway2Spaces", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_spacesBoneNames ) }, - { "Runway2Takeoff", parseRunwayStrip, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_takeoffBoneNames ) }, - { "Runway2Landing", parseRunwayStrip, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_landingBoneNames ) }, - { "Runway2Taxi", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_taxiBoneNames ) }, - { "Runway2Creation", INI::parseAsciiStringVector, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_creationBoneNames ) }, - { "Runway2CatapultSystem", INI::parseParticleSystemTemplate, NULL, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_catapultParticleSystem ) }, - - { "ApproachHeight", INI::parseReal, NULL, offsetof( FlightDeckBehaviorModuleData, m_approachHeight ) }, - { "LandingDeckHeightOffset",INI::parseReal, NULL, offsetof( FlightDeckBehaviorModuleData, m_landingDeckHeightOffset ) }, - { "HealAmountPerSecond", INI::parseReal, NULL, offsetof( FlightDeckBehaviorModuleData, m_healAmount ) }, - { "ParkingCleanupPeriod", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_cleanupFrames ) }, - { "HumanFollowPeriod", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_humanFollowFrames ) }, - { "PayloadTemplate", INI::parseAsciiString, NULL, offsetof( FlightDeckBehaviorModuleData, m_thingTemplateName ) }, - { "ReplacementDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_replacementFrames ) }, - { "DockAnimationDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_dockAnimationFrames ) }, - { "LaunchWaveDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_launchWaveFrames ) }, - { "LaunchRampDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_launchRampFrames ) }, - { "LowerRampDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_lowerRampFrames ) }, - { "CatapultFireDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlightDeckBehaviorModuleData, m_catapultFireFrames ) }, - - { 0, 0, 0, 0 } + { "NumRunways", INI::parseInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_numCols ) }, + { "NumSpacesPerRunway", INI::parseInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_numRows ) }, + + { "Runway1Spaces", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_spacesBoneNames ) }, + { "Runway1Takeoff", parseRunwayStrip, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_takeoffBoneNames ) }, + { "Runway1Landing", parseRunwayStrip, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_landingBoneNames ) }, + { "Runway1Taxi", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_taxiBoneNames ) }, + { "Runway1Creation", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_creationBoneNames ) }, + { "Runway1CatapultSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 0 ].m_catapultParticleSystem ) }, + + { "Runway2Spaces", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_spacesBoneNames ) }, + { "Runway2Takeoff", parseRunwayStrip, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_takeoffBoneNames ) }, + { "Runway2Landing", parseRunwayStrip, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_landingBoneNames ) }, + { "Runway2Taxi", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_taxiBoneNames ) }, + { "Runway2Creation", INI::parseAsciiStringVector, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_creationBoneNames ) }, + { "Runway2CatapultSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( FlightDeckBehaviorModuleData, m_runwayInfo[ 1 ].m_catapultParticleSystem ) }, + + { "ApproachHeight", INI::parseReal, nullptr, offsetof( FlightDeckBehaviorModuleData, m_approachHeight ) }, + { "LandingDeckHeightOffset",INI::parseReal, nullptr, offsetof( FlightDeckBehaviorModuleData, m_landingDeckHeightOffset ) }, + { "HealAmountPerSecond", INI::parseReal, nullptr, offsetof( FlightDeckBehaviorModuleData, m_healAmount ) }, + { "ParkingCleanupPeriod", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_cleanupFrames ) }, + { "HumanFollowPeriod", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_humanFollowFrames ) }, + { "PayloadTemplate", INI::parseAsciiString, nullptr, offsetof( FlightDeckBehaviorModuleData, m_thingTemplateName ) }, + { "ReplacementDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_replacementFrames ) }, + { "DockAnimationDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_dockAnimationFrames ) }, + { "LaunchWaveDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_launchWaveFrames ) }, + { "LaunchRampDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_launchRampFrames ) }, + { "LowerRampDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_lowerRampFrames ) }, + { "CatapultFireDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlightDeckBehaviorModuleData, m_catapultFireFrames ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -149,7 +149,7 @@ FlightDeckBehavior::FlightDeckBehavior( Thing *thing, const ModuleData* moduleDa m_rampUp[ i ] = FALSE; } - m_thingTemplate = NULL; + m_thingTemplate = nullptr; } @@ -207,7 +207,7 @@ void FlightDeckBehavior::buildInfo(Bool createUnits) flightDeckInfo.m_objectInSpace = INVALID_ID; //Create the payload - Object *jet = NULL; + Object *jet = nullptr; if( m_thingTemplate && createUnits ) { jet = TheThingFactory->newObject( m_thingTemplate, getObject()->getControllingPlayer()->getDefaultTeam() ); @@ -237,10 +237,10 @@ void FlightDeckBehavior::buildInfo(Bool createUnits) { AsciiString tmp; - getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_takeoffBoneNames[ RUNWAY_START_BONE ].str(), &info.m_start, NULL); - getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_takeoffBoneNames[ RUNWAY_END_BONE ].str(), &info.m_end, NULL); - getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_landingBoneNames[ RUNWAY_START_BONE ].str(), &info.m_landingStart, NULL); - getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_landingBoneNames[ RUNWAY_END_BONE ].str(), &info.m_landingEnd, NULL); + getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_takeoffBoneNames[ RUNWAY_START_BONE ].str(), &info.m_start, nullptr); + getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_takeoffBoneNames[ RUNWAY_END_BONE ].str(), &info.m_end, nullptr); + getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_landingBoneNames[ RUNWAY_START_BONE ].str(), &info.m_landingStart, nullptr); + getObject()->getSingleLogicalBonePosition( data->m_runwayInfo[ col ].m_landingBoneNames[ RUNWAY_END_BONE ].str(), &info.m_landingEnd, nullptr); info.m_inUseByForTakeoff = INVALID_ID; info.m_inUseByForLanding = INVALID_ID; @@ -300,7 +300,7 @@ void FlightDeckBehavior::purgeDead() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_objectInSpace = INVALID_ID; } @@ -313,7 +313,7 @@ void FlightDeckBehavior::purgeDead() if (it->m_inUseByForTakeoff != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_inUseByForTakeoff); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_inUseByForTakeoff = INVALID_ID; } @@ -321,7 +321,7 @@ void FlightDeckBehavior::purgeDead() if (it->m_inUseByForLanding != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_inUseByForLanding); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_inUseByForLanding = INVALID_ID; } @@ -336,7 +336,7 @@ void FlightDeckBehavior::purgeDead() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); anythingPurged = true; @@ -395,7 +395,7 @@ FlightDeckBehavior::FlightDeckInfo* FlightDeckBehavior::findPPI(ObjectID id) DEBUG_ASSERTCRASH(id != INVALID_ID, ("call findEmptyPPI instead")); if (!m_gotInfo || id == INVALID_ID) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -403,14 +403,14 @@ FlightDeckBehavior::FlightDeckInfo* FlightDeckBehavior::findPPI(ObjectID id) return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- FlightDeckBehavior::FlightDeckInfo* FlightDeckBehavior::findEmptyPPI() { if (!m_gotInfo) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -418,7 +418,7 @@ FlightDeckBehavior::FlightDeckInfo* FlightDeckBehavior::findEmptyPPI() return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -443,7 +443,7 @@ Bool FlightDeckBehavior::hasAvailableSpaceFor(const ThingTemplate* thing) const if (id != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(id); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { id = INVALID_ID; } @@ -467,10 +467,10 @@ Bool FlightDeckBehavior::reserveSpace(ObjectID id, Real parkingOffset, ParkingPl const FlightDeckBehaviorModuleData* d = getFlightDeckBehaviorModuleData(); FlightDeckInfo* ppi = findPPI(id); - if (ppi == NULL) + if (ppi == nullptr) { ppi = findEmptyPPI(); - if (ppi == NULL) + if (ppi == nullptr) { DEBUG_CRASH(("No parking places!")); return false; // nothing available @@ -737,7 +737,7 @@ const std::vector* FlightDeckBehavior::getTaxiLocations( ObjectID id ) if( runway == -1 ) { DEBUG_CRASH(("only planes with reserved spaces can reserve runways")); - return NULL; + return nullptr; } //Now get the runway we're assigned to and return it's taxi vector @@ -761,7 +761,7 @@ const std::vector* FlightDeckBehavior::getCreationLocations( ObjectID i if( runway == -1 ) { DEBUG_CRASH(("only planes with reserved spaces can reserve runways")); - return NULL; + return nullptr; } //Now get the runway we're assigned to and return it's creation vector @@ -893,7 +893,7 @@ Bool FlightDeckBehavior::calcBestParkingAssignment( ObjectID id, Coord3D *pos, I Bool checkForPlaneInWay = FALSE; std::vector::iterator bestIt = m_spaces.end(); - Object *bestJet = NULL; + Object *bestJet = nullptr; Int bestIndex = 0, index = 0; for( std::vector::iterator thatIt = m_spaces.begin(); thatIt != m_spaces.end(); thatIt++, index++ ) { @@ -910,12 +910,12 @@ Bool FlightDeckBehavior::calcBestParkingAssignment( ObjectID id, Coord3D *pos, I /*if( bestJet ) { JetAIUpdate *jetAI = (JetAIUpdate*)bestJet->getAI(); - reserveSpace( bestJet->getID(), jetAI->friend_getParkingOffset(), NULL ); + reserveSpace( bestJet->getID(), jetAI->friend_getParkingOffset(), nullptr ); } if( nonIdleJet ) { JetAIUpdate *jetAI = (JetAIUpdate*)nonIdleJet->getAI(); - reserveSpace( nonIdleJet->getID(), jetAI->friend_getParkingOffset(), NULL ); + reserveSpace( nonIdleJet->getID(), jetAI->friend_getParkingOffset(), nullptr ); }*/ if( newIndex ) @@ -1024,7 +1024,7 @@ void FlightDeckBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detecti if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -1039,7 +1039,7 @@ void FlightDeckBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detecti { releaseSpace(obj->getID()); if (obj->getProducerID() == getObject()->getID()) - obj->setProducer(NULL); + obj->setProducer(nullptr); } } else @@ -1065,7 +1065,7 @@ void FlightDeckBehavior::killAllParkedUnits() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -1109,7 +1109,7 @@ UpdateSleepTime FlightDeckBehavior::update() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); } @@ -1214,14 +1214,14 @@ UpdateSleepTime FlightDeckBehavior::update() { //But are we already building one? ProductionUpdateInterface *pu = getObject()->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_CRASH( ("MSG_QUEUE_UNIT_CREATE: Producer '%s' doesn't have a unit production interface", getObject()->getTemplate()->getName().str()) ); break; } - DEBUG_ASSERTCRASH( m_thingTemplate != NULL, ("flightdeck has a null thingtemplate... no jets for you!") ); - if( !pu->getProductionCount() && now >= m_nextAllowedProductionFrame && m_thingTemplate != NULL ) + DEBUG_ASSERTCRASH( m_thingTemplate != nullptr, ("flightdeck has a null thingtemplate... no jets for you!") ); + if( !pu->getProductionCount() && now >= m_nextAllowedProductionFrame && m_thingTemplate != nullptr ) { //Queue the build pu->queueCreateUnit( m_thingTemplate, pu->requestUniqueUnitID() ); @@ -1319,7 +1319,7 @@ ExitDoorType FlightDeckBehavior::reserveDoorForExit( const ThingTemplate* objTyp //------------------------------------------------------------------------------------------------- void FlightDeckBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitDoor ) ///< Here is the thing I want you to exit { - FlightDeckInfo* ppi = NULL; + FlightDeckInfo* ppi = nullptr; if (exitDoor != DOOR_NONE_NEEDED) { for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) @@ -1353,7 +1353,7 @@ void FlightDeckBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitDoo DUMPCOORD3D(getObject()->getPosition()); CRCDEBUG_LOG(("Produced at hangar (door = %d)", exitDoor)); DEBUG_ASSERTCRASH(exitDoor != DOOR_NONE_NEEDED, ("Hmm, unlikely")); - if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, NULL, NULL, NULL, NULL, &hangarInternal, &hangOrient)) + if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, nullptr, nullptr, nullptr, nullptr, &hangarInternal, &hangOrient)) { DEBUG_CRASH(("no spaces available, how did we get here?")); ppinfo.parkingSpace = *getObject()->getPosition(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index 731fb65b48b..c0e9bf294a5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -61,7 +61,7 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() m_mineNameUpgraded.clear(); m_mineUpgradeTrigger.clear(); - m_genFX = NULL; + m_genFX = nullptr; m_distanceAroundObject = TheGlobalData->m_standardMinefieldDistance; m_minesPerSquareFoot = TheGlobalData->m_standardMinefieldDensity; m_onDeath = false; @@ -80,21 +80,21 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "MineName", INI::parseAsciiString, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_mineName ) }, - { "UpgradedMineName", INI::parseAsciiString, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_mineNameUpgraded ) }, - { "UpgradedTriggeredBy", INI::parseAsciiString, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_mineUpgradeTrigger ) }, - { "GenerationFX", INI::parseFXList, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_genFX ) }, - { "DistanceAroundObject", INI::parseReal, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_distanceAroundObject ) }, - { "MinesPerSquareFoot", INI::parseReal, NULL, offsetof( GenerateMinefieldBehaviorModuleData, m_minesPerSquareFoot ) }, - { "GenerateOnlyOnDeath", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_onDeath) }, - { "BorderOnly", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_borderOnly) }, - { "SmartBorder", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorder) }, - { "SmartBorderSkipInterior", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorderSkipInterior) }, - { "AlwaysCircular", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_alwaysCircular) }, - { "Upgradable", INI::parseBool, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_upgradable) }, - { "RandomJitter", INI::parsePercentToReal, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_randomJitter) }, - { "SkipIfThisMuchUnderStructure", INI::parsePercentToReal, NULL, offsetof(GenerateMinefieldBehaviorModuleData, m_skipIfThisMuchUnderStructure) }, - { 0, 0, 0, 0 } + { "MineName", INI::parseAsciiString, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_mineName ) }, + { "UpgradedMineName", INI::parseAsciiString, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_mineNameUpgraded ) }, + { "UpgradedTriggeredBy", INI::parseAsciiString, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_mineUpgradeTrigger ) }, + { "GenerationFX", INI::parseFXList, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_genFX ) }, + { "DistanceAroundObject", INI::parseReal, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_distanceAroundObject ) }, + { "MinesPerSquareFoot", INI::parseReal, nullptr, offsetof( GenerateMinefieldBehaviorModuleData, m_minesPerSquareFoot ) }, + { "GenerateOnlyOnDeath", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_onDeath) }, + { "BorderOnly", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_borderOnly) }, + { "SmartBorder", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorder) }, + { "SmartBorderSkipInterior", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_smartBorderSkipInterior) }, + { "AlwaysCircular", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_alwaysCircular) }, + { "Upgradable", INI::parseBool, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_upgradable) }, + { "RandomJitter", INI::parsePercentToReal, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_randomJitter) }, + { "SkipIfThisMuchUnderStructure", INI::parsePercentToReal, nullptr, offsetof(GenerateMinefieldBehaviorModuleData, m_skipIfThisMuchUnderStructure) }, + { nullptr, nullptr, nullptr, 0 } }; BehaviorModuleData::buildFieldParse(p); @@ -193,10 +193,10 @@ Object* GenerateMinefieldBehavior::placeMineAt(const Coord3D& pt, const ThingTem PathfindLayerEnum layer = TheTerrainLogic->getHighestLayerForDestination(&tmp); if (layer == LAYER_GROUND && TheTerrainLogic->isUnderwater(pt.x, pt.y)) - return NULL; + return nullptr; if (layer == LAYER_GROUND && TheTerrainLogic->isCliffCell(pt.x, pt.y)) - return NULL; + return nullptr; Real orient = GameLogicRandomValueReal(-PI, PI); @@ -211,7 +211,7 @@ Object* GenerateMinefieldBehavior::placeMineAt(const Coord3D& pt, const ThingTem for (Object* them = iter->first(); them; them = iter->next()) { if (them->isKindOf(KINDOF_STRUCTURE)) - return NULL; + return nullptr; } Object* mine = TheThingFactory->newObject(mineTemplate, team); @@ -378,7 +378,7 @@ void GenerateMinefieldBehavior::placeMines() const Object* obj = getObject(); const GenerateMinefieldBehaviorModuleData* d = getGenerateMinefieldBehaviorModuleData(); - const ThingTemplate* mineTemplate = 0; + const ThingTemplate* mineTemplate = nullptr; if (m_upgraded) mineTemplate = TheThingFactory->findTemplate(d->m_mineNameUpgraded); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp index 0ca3590becd..54a40ee733c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GrantStealthBehavior.cpp @@ -144,7 +144,7 @@ UpdateSleepTime GrantStealthBehavior::update( void ) PartitionFilterRelationship relationship( self, PartitionFilterRelationship::ALLOW_ALLIES ); PartitionFilterSameMapStatus filterMapStatus( self ); PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, nullptr }; m_currentScanRadius += d->m_radiusGrowRate; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index 348c4ea3256..b63b549a045 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -62,7 +62,7 @@ InstantDeathBehaviorModuleData::InstantDeathBehaviorModuleData() static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fx.push_back(fxl); @@ -73,7 +73,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls.push_back(ocl); @@ -84,7 +84,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* /*userData*/ ) { InstantDeathBehaviorModuleData* self = (InstantDeathBehaviorModuleData*)instance; - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const WeaponTemplate *wt = TheWeaponStore->findWeaponTemplate(token); // could be null! this is OK! self->m_weapons.push_back(wt); @@ -98,10 +98,10 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* static const FieldParse dataFieldParse[] = { - { "FX", parseFX, NULL, 0 }, - { "OCL", parseOCL, NULL, 0 }, - { "Weapon", parseWeapon, NULL, 0 }, - { 0, 0, 0, 0 } + { "FX", parseFX, nullptr, 0 }, + { "OCL", parseOCL, nullptr, 0 }, + { "Weapon", parseWeapon, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -144,7 +144,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) const FXListVec& v = d->m_fx; DEBUG_ASSERTCRASH(idx>=0&&idxm_ocls.size(); @@ -154,7 +154,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) const OCLVec& v = d->m_ocls; DEBUG_ASSERTCRASH(idx>=0&&idxm_weapons.size(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp index eddd748b5a0..01a3d3aed1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp @@ -53,22 +53,22 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) { - m_fxOnGroundDeath = NULL; - m_oclOnGroundDeath = NULL; + m_fxOnGroundDeath = nullptr; + m_oclOnGroundDeath = nullptr; - m_fxInitialDeath = NULL; - m_oclInitialDeath = NULL; + m_fxInitialDeath = nullptr; + m_oclInitialDeath = nullptr; m_delaySecondaryFromInitialDeath = 0; - m_fxSecondary = NULL; - m_oclSecondary = NULL; + m_fxSecondary = nullptr; + m_oclSecondary = nullptr; - m_fxHitGround = NULL; - m_oclHitGround = NULL; + m_fxHitGround = nullptr; + m_oclHitGround = nullptr; m_delayFinalBlowUpFromHitGround = 0; - m_fxFinalBlowUp = NULL; - m_oclFinalBlowUp = NULL; + m_fxFinalBlowUp = nullptr; + m_oclFinalBlowUp = nullptr; m_rollRate = 0.0f; m_rollRateDelta = 1.0f; @@ -86,32 +86,32 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "FXOnGroundDeath", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxOnGroundDeath ) }, - { "OCLOnGroundDeath", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclOnGroundDeath ) }, + { "FXOnGroundDeath", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxOnGroundDeath ) }, + { "OCLOnGroundDeath", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclOnGroundDeath ) }, - { "FXInitialDeath", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxInitialDeath ) }, - { "OCLInitialDeath", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclInitialDeath ) }, + { "FXInitialDeath", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxInitialDeath ) }, + { "OCLInitialDeath", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclInitialDeath ) }, - { "DelaySecondaryFromInitialDeath", INI::parseDurationUnsignedInt, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_delaySecondaryFromInitialDeath ) }, - { "FXSecondary", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxSecondary ) }, - { "OCLSecondary", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclSecondary ) }, + { "DelaySecondaryFromInitialDeath", INI::parseDurationUnsignedInt, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_delaySecondaryFromInitialDeath ) }, + { "FXSecondary", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxSecondary ) }, + { "OCLSecondary", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclSecondary ) }, - { "FXHitGround", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxHitGround ) }, - { "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclHitGround ) }, + { "FXHitGround", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxHitGround ) }, + { "OCLHitGround", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclHitGround ) }, - { "DelayFinalBlowUpFromHitGround", INI::parseDurationUnsignedInt, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_delayFinalBlowUpFromHitGround ) }, - { "FXFinalBlowUp", INI::parseFXList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, - { "OCLFinalBlowUp", INI::parseObjectCreationList, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, + { "DelayFinalBlowUpFromHitGround", INI::parseDurationUnsignedInt, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_delayFinalBlowUpFromHitGround ) }, + { "FXFinalBlowUp", INI::parseFXList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, + { "OCLFinalBlowUp", INI::parseObjectCreationList, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, - { "DeathLoopSound", INI::parseAudioEventRTS, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_deathLoopSound ) }, + { "DeathLoopSound", INI::parseAudioEventRTS, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_deathLoopSound ) }, // @todo srj -- RollRate and RollRateDelta and PitchRate should use parseAngularVelocityReal - { "RollRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) }, - { "RollRateDelta", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRateDelta ) }, - { "PitchRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) }, - { "FallHowFast", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fallHowFast ) }, + { "RollRate", INI::parseReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) }, + { "RollRateDelta", INI::parsePercentToReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_rollRateDelta ) }, + { "PitchRate", INI::parseReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) }, + { "FallHowFast", INI::parsePercentToReal, nullptr, offsetof( JetSlowDeathBehaviorModuleData, m_fallHowFast ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; @@ -157,7 +157,7 @@ void JetSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) FXList::doFXObj( modData->m_fxOnGroundDeath, us ); // execute ocl - ObjectCreationList::create( modData->m_oclOnGroundDeath, us, NULL ); + ObjectCreationList::create( modData->m_oclOnGroundDeath, us, nullptr ); // destroy object TheGameLogic->destroyObject( us ); @@ -192,7 +192,7 @@ void JetSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) // do some effects FXList::doFXObj( modData->m_fxInitialDeath, us ); - ObjectCreationList::create( modData->m_oclInitialDeath, us, NULL ); + ObjectCreationList::create( modData->m_oclInitialDeath, us, nullptr ); // start audio loop playing m_deathLoopSound = modData->m_deathLoopSound; @@ -291,7 +291,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxHitGround, us ); - ObjectCreationList::create( modData->m_oclHitGround, us, NULL ); + ObjectCreationList::create( modData->m_oclHitGround, us, nullptr ); // we are now on the ground m_timerOnGroundFrame = TheGameLogic->getFrame(); @@ -309,7 +309,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxSecondary, us ); - ObjectCreationList::create( modData->m_oclSecondary, us, NULL ); + ObjectCreationList::create( modData->m_oclSecondary, us, nullptr ); // clear the death frame timer since we've already executed the event now m_timerDeathFrame = 0; @@ -325,7 +325,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void ) // do some effects FXList::doFXObj( modData->m_fxFinalBlowUp, us ); - ObjectCreationList::create( modData->m_oclFinalBlowUp, us, NULL ); + ObjectCreationList::create( modData->m_oclFinalBlowUp, us, nullptr ); // we're all done now TheGameLogic->destroyObject( us ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index f2abac47bbf..a87d222b7a8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -53,7 +53,7 @@ const Real MIN_HEALTH = 0.1f; // ------------------------------------------------------------------------------------------------ MinefieldBehaviorModuleData::MinefieldBehaviorModuleData() { - m_detonationWeapon = NULL; + m_detonationWeapon = nullptr; m_detonatedBy = (1 << ENEMIES) | (1 << NEUTRAL); m_stopsRegenAfterCreatorDies = true; m_regenerates = false; @@ -63,7 +63,7 @@ MinefieldBehaviorModuleData::MinefieldBehaviorModuleData() m_repeatDetonateMoveThresh = 1.0f; m_numVirtualMines = 1; m_healthPercentToDrainPerSecond = 0.0f; - m_ocl = 0; + m_ocl = nullptr; } //------------------------------------------------------------------------------------------------- @@ -75,18 +75,18 @@ MinefieldBehaviorModuleData::MinefieldBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "DetonationWeapon", INI::parseWeaponTemplate, NULL, offsetof( MinefieldBehaviorModuleData, m_detonationWeapon ) }, + { "DetonationWeapon", INI::parseWeaponTemplate, nullptr, offsetof( MinefieldBehaviorModuleData, m_detonationWeapon ) }, { "DetonatedBy", INI::parseBitString32, TheRelationshipNames, offsetof( MinefieldBehaviorModuleData, m_detonatedBy ) }, - { "StopsRegenAfterCreatorDies", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_stopsRegenAfterCreatorDies ) }, - { "Regenerates", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_regenerates ) }, - { "WorkersDetonate", INI::parseBool, NULL, offsetof( MinefieldBehaviorModuleData, m_workersDetonate ) }, - { "CreatorDeathCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_creatorDeathCheckRate ) }, - { "ScootFromStartingPointTime", INI::parseDurationUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_scootFromStartingPointTime ) }, - { "NumVirtualMines", INI::parseUnsignedInt, NULL, offsetof( MinefieldBehaviorModuleData, m_numVirtualMines ) }, - { "RepeatDetonateMoveThresh", INI::parseReal, NULL, offsetof( MinefieldBehaviorModuleData, m_repeatDetonateMoveThresh ) }, - { "DegenPercentPerSecondAfterCreatorDies", INI::parsePercentToReal, NULL, offsetof( MinefieldBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, - { "CreationList", INI::parseObjectCreationList, NULL, offsetof( MinefieldBehaviorModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "StopsRegenAfterCreatorDies", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_stopsRegenAfterCreatorDies ) }, + { "Regenerates", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_regenerates ) }, + { "WorkersDetonate", INI::parseBool, nullptr, offsetof( MinefieldBehaviorModuleData, m_workersDetonate ) }, + { "CreatorDeathCheckRate", INI::parseDurationUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_creatorDeathCheckRate ) }, + { "ScootFromStartingPointTime", INI::parseDurationUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_scootFromStartingPointTime ) }, + { "NumVirtualMines", INI::parseUnsignedInt, nullptr, offsetof( MinefieldBehaviorModuleData, m_numVirtualMines ) }, + { "RepeatDetonateMoveThresh", INI::parseReal, nullptr, offsetof( MinefieldBehaviorModuleData, m_repeatDetonateMoveThresh ) }, + { "DegenPercentPerSecondAfterCreatorDies", INI::parsePercentToReal, nullptr, offsetof( MinefieldBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, + { "CreationList", INI::parseObjectCreationList, nullptr, offsetof( MinefieldBehaviorModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -217,7 +217,7 @@ UpdateSleepTime MinefieldBehavior::update() if (m_immunes[i].id == INVALID_ID) continue; - if (TheGameLogic->findObjectByID(m_immunes[i].id) == NULL || + if (TheGameLogic->findObjectByID(m_immunes[i].id) == nullptr || now > m_immunes[i].collideTime + 2) { //DEBUG_LOG(("expiring an immunity %d",m_immunes[i].id)); @@ -239,7 +239,7 @@ UpdateSleepTime MinefieldBehavior::update() if (producerID != INVALID_ID) { Object* producer = TheGameLogic->findObjectByID(producerID); - if (producer == NULL || producer->isEffectivelyDead()) + if (producer == nullptr || producer->isEffectivelyDead()) { m_regenerates = false; m_draining = true; @@ -339,7 +339,7 @@ static Real calcDistSquared(const Coord3D& a, const Coord3D& b) //------------------------------------------------------------------------------------------------- void MinefieldBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { - if (other == NULL || other->isEffectivelyDead()) + if (other == nullptr || other->isEffectivelyDead()) return; if (m_virtualMinesRemaining == 0) @@ -385,7 +385,7 @@ void MinefieldBehavior::onCollide( Object *other, const Coord3D *loc, const Coor // have a real mine they area trying to clear... it's possible they could be trying to // clear a position where there is no mine, in which case we grant them no immunity, muwahahaha) AIUpdateInterface* otherAI = other->getAI(); - if (otherAI && otherAI->isClearingMines() && otherAI->getGoalObject() != NULL) + if (otherAI && otherAI->isClearingMines() && otherAI->getGoalObject() != nullptr) { // mine-clearers are granted immunity to us for as long as they continuously // collide, even if no longer clearing mines. (this prevents the problem diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp index 048a90e69dc..035b582e606 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/NeutonBlastBehavior.cpp @@ -72,7 +72,7 @@ void NeutronBlastBehavior::onDie( const DamageInfo *damageInfo ) // setup scan filters PartitionFilterSameMapStatus filterMapStatus( self ); PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAlive, &filterMapStatus, nullptr }; // scan objects in our region ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( self->getPosition(), blastRadius, FROM_CENTER_2D, filters ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp index 742fb6066c3..05c05ab8733 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp @@ -63,9 +63,9 @@ OverchargeBehaviorModuleData::OverchargeBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "HealthPercentToDrainPerSecond", INI::parsePercentToReal, NULL, offsetof( OverchargeBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, - { "NotAllowedWhenHealthBelowPercent", INI::parsePercentToReal, NULL, offsetof( OverchargeBehaviorModuleData, m_notAllowedWhenHealthBelowPercent ) }, - { 0, 0, 0, 0 } + { "HealthPercentToDrainPerSecond", INI::parsePercentToReal, nullptr, offsetof( OverchargeBehaviorModuleData, m_healthPercentToDrainPerSecond ) }, + { "NotAllowedWhenHealthBelowPercent", INI::parsePercentToReal, nullptr, offsetof( OverchargeBehaviorModuleData, m_notAllowedWhenHealthBelowPercent ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp index dc9402efb0b..93a7a843bdb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/POWTruckBehavior.cpp @@ -93,12 +93,12 @@ void POWTruckBehavior::onCollide( Object *other, const Coord3D *loc, const Coord Object *us = getObject(); // sanity - if( other == NULL ) + if( other == nullptr ) return; // if other isn't slated to be picked up by us, ignore AIUpdateInterface *otherAi = other->getAIUpdateInterface(); - if( otherAi == NULL || otherAi->isSurrendered() == FALSE ) + if( otherAi == nullptr || otherAi->isSurrendered() == FALSE ) return; // get our AI info diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index ed1cfc4137d..5f83498228e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -98,7 +98,7 @@ void ParkingPlaceBehavior::buildInfo() info.m_orientation = mtx.Get_Z_Rotation(); tmp.format("Runway%dPrep%d",col+1,row+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_prep, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_prep, nullptr); info.m_runway = col; info.m_door = (ExitDoorType)door++; @@ -121,10 +121,10 @@ void ParkingPlaceBehavior::buildInfo() AsciiString tmp; tmp.format("RunwayStart%d",col+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_start, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_start, nullptr); tmp.format("RunwayEnd%d",col+1); - getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_end, NULL); + getObject()->getSingleLogicalBonePosition(tmp.str(), &info.m_end, nullptr); info.m_inUseBy = INVALID_ID; info.m_nextInLineForTakeoff = INVALID_ID; @@ -148,7 +148,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_objectInSpace = INVALID_ID; it->m_reservedForExit = false; @@ -166,7 +166,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_inUseBy != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_inUseBy); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_inUseBy = INVALID_ID; it->m_wasInLine = false; @@ -175,7 +175,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_nextInLineForTakeoff != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_nextInLineForTakeoff); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { it->m_nextInLineForTakeoff = INVALID_ID; } @@ -190,7 +190,7 @@ void ParkingPlaceBehavior::purgeDead() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); anythingPurged = true; @@ -249,7 +249,7 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findPPI(ObjectID i DEBUG_ASSERTCRASH(id != INVALID_ID, ("call findEmptyPPI instead")); if (!m_gotInfo || id == INVALID_ID) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -257,14 +257,14 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findPPI(ObjectID i return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findEmptyPPI() { if (!m_gotInfo) - return NULL; + return nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { @@ -272,7 +272,7 @@ ParkingPlaceBehavior::ParkingPlaceInfo* ParkingPlaceBehavior::findEmptyPPI() return &(*it); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -303,7 +303,7 @@ Bool ParkingPlaceBehavior::hasAvailableSpaceFor(const ThingTemplate* thing) cons if (id != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(id); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { id = INVALID_ID; } @@ -327,10 +327,10 @@ Bool ParkingPlaceBehavior::reserveSpace(ObjectID id, Real parkingOffset, Parking const ParkingPlaceBehaviorModuleData* d = getParkingPlaceBehaviorModuleData(); ParkingPlaceInfo* ppi = findPPI(id); - if (ppi == NULL) + if (ppi == nullptr) { ppi = findEmptyPPI(); - if (ppi == NULL) + if (ppi == nullptr) { DEBUG_CRASH(("No parking places!")); return false; // nothing available @@ -648,7 +648,7 @@ void ParkingPlaceBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detec if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -663,7 +663,7 @@ void ParkingPlaceBehavior::defectAllParkedUnits(Team* newTeam, UnsignedInt detec { releaseSpace(obj->getID()); if (obj->getProducerID() == getObject()->getID()) - obj->setProducer(NULL); + obj->setProducer(nullptr); } } else @@ -687,7 +687,7 @@ void ParkingPlaceBehavior::killAllParkedUnits() if (it->m_objectInSpace != INVALID_ID) { Object* obj = TheGameLogic->findObjectByID(it->m_objectInSpace); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) continue; // srj sez: evil. fix better someday. @@ -731,7 +731,7 @@ UpdateSleepTime ParkingPlaceBehavior::update() if (it->m_gettingHealedID != INVALID_ID) { Object* objToHeal = TheGameLogic->findObjectByID(it->m_gettingHealedID); - if (objToHeal == NULL || objToHeal->isEffectivelyDead()) + if (objToHeal == nullptr || objToHeal->isEffectivelyDead()) { it = m_healing.erase(it); } @@ -786,7 +786,7 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD { if (exitDoor != DOOR_NONE_NEEDED) { - ParkingPlaceInfo* ppi = NULL; + ParkingPlaceInfo* ppi = nullptr; for (std::vector::iterator it = m_spaces.begin(); it != m_spaces.end(); ++it) { if (it->m_objectInSpace == INVALID_ID && it->m_reservedForExit == TRUE && it->m_door == exitDoor) @@ -834,7 +834,7 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD { CRCDEBUG_LOG(("Produced at hangar (door = %d)", exitDoor)); DEBUG_ASSERTCRASH(exitDoor != DOOR_NONE_NEEDED, ("Hmm, unlikely")); - if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, NULL, NULL, NULL, NULL, &hangarInternal, &hangOrient)) + if (!reserveSpace(newObj->getID(), parkingOffset, &ppinfo)) //&loc, &orient, nullptr, nullptr, nullptr, nullptr, &hangarInternal, &hangOrient)) { DEBUG_CRASH(("no spaces available, how did we get here?")); ppinfo.parkingSpace = *getObject()->getPosition(); @@ -916,7 +916,7 @@ const Coord3D* ParkingPlaceBehavior::getRallyPoint( void ) const { return &m_heliRallyPoint; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp index d7887ce1899..941aba155af 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp @@ -54,9 +54,9 @@ PoisonedBehaviorModuleData::PoisonedBehaviorModuleData() static const FieldParse dataFieldParse[] = { - { "PoisonDamageInterval", INI::parseDurationUnsignedInt, NULL, offsetof(PoisonedBehaviorModuleData, m_poisonDamageIntervalData) }, - { "PoisonDuration", INI::parseDurationUnsignedInt, NULL, offsetof(PoisonedBehaviorModuleData, m_poisonDurationData) }, - { 0, 0, 0, 0 } + { "PoisonDamageInterval", INI::parseDurationUnsignedInt, nullptr, offsetof(PoisonedBehaviorModuleData, m_poisonDamageIntervalData) }, + { "PoisonDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(PoisonedBehaviorModuleData, m_poisonDurationData) }, + { nullptr, nullptr, nullptr, 0 } }; UpdateModuleData::buildFieldParse(p); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp index 47b95ce8dd6..1e305e95687 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp @@ -72,7 +72,7 @@ PrisonVisual::PrisonVisual( void ) m_objectID = INVALID_ID; m_drawableID = INVALID_DRAWABLE_ID; - m_next = NULL; + m_next = nullptr; } @@ -105,8 +105,8 @@ PrisonBehaviorModuleData::PrisonBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "ShowPrisoners", INI::parseBool, NULL, offsetof( PrisonBehaviorModuleData, m_showPrisoners ) }, - { "YardBonePrefix", INI::parseAsciiString, NULL, offsetof( PrisonBehaviorModuleData, m_prisonYardBonePrefix ) }, + { "ShowPrisoners", INI::parseBool, nullptr, offsetof( PrisonBehaviorModuleData, m_showPrisoners ) }, + { "YardBonePrefix", INI::parseAsciiString, nullptr, offsetof( PrisonBehaviorModuleData, m_prisonYardBonePrefix ) }, { 0, 0, 0, 0 } }; @@ -125,7 +125,7 @@ PrisonBehavior::PrisonBehavior( Thing *thing, const ModuleData *moduleData ) : OpenContain( thing, moduleData ) { - m_visualList = NULL; + m_visualList = nullptr; } @@ -214,7 +214,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) Int i; // sanity - if( pos == NULL ) + if( pos == nullptr ) return; // initialize the picked location to that of the prison center @@ -226,7 +226,7 @@ void PrisonBehavior::pickVisualLocation( Coord3D *pos ) Int yardBones = us->getMultiLogicalBonePosition( modData->m_prisonYardBonePrefix.str(), MAX_YARD_BONES, yardPositions, - NULL ); + nullptr ); // // we must have at least 3 bone locations to make a yard polygon, otherwise we'll @@ -300,7 +300,7 @@ void PrisonBehavior::addVisual( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // create a drawable @@ -338,14 +338,14 @@ void PrisonBehavior::removeVisual( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // initialize a drawable ID to invalid DrawableID drawableID = INVALID_DRAWABLE_ID; // find visual info in our list, once found, take this opportunity to remove it from that list - PrisonVisual *visual, *prevVisual = NULL; + PrisonVisual *visual, *prevVisual = nullptr; for( visual = m_visualList; visual; visual = visual->m_next ) { @@ -434,7 +434,7 @@ void PrisonBehavior::xfer( Xfer *xfer ) { // the visual list should be empty - if( m_visualList != NULL ) + if( m_visualList != nullptr ) { DEBUG_CRASH(( "PrisonBehavior::xfer - the visual list should be empty but is not" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp index a2f1f509dff..4bb892116f6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaCenterBehavior.cpp @@ -62,7 +62,7 @@ PropagandaCenterBehaviorModuleData::PropagandaCenterBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "BrainwashDuration", INI::parseDurationUnsignedInt, NULL, offsetof( PropagandaCenterBehaviorModuleData, m_brainwashDuration ) }, + { "BrainwashDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( PropagandaCenterBehaviorModuleData, m_brainwashDuration ) }, { 0, 0, 0, 0 } }; @@ -164,7 +164,7 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) // remove any surrender status from this object AIUpdateInterface *ai = brainwashingSubject->getAIUpdateInterface(); if( ai ) - ai->setSurrendered( NULL, FALSE ); + ai->setSurrendered( nullptr, FALSE ); // add this object to our brainwashed list if we're not already in it for( BrainwashedIDListIterator it = m_brainwashedList.begin(); @@ -216,7 +216,7 @@ UpdateSleepTime PropagandaCenterBehavior::update( void ) void PropagandaCenterBehavior::onRemoving( Object *obj ) { - // if we're removing the brainwashing subject, NULL the pointer + // if we're removing the brainwashing subject, nullptr the pointer if( m_brainwashingSubjectID == obj->getID() ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 0283d17197f..0b0672aa9df 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -61,7 +61,7 @@ class ObjectTracker : public MemoryPoolObject public: - ObjectTracker( void ) { objectID = INVALID_ID; next = NULL; } + ObjectTracker( void ) { objectID = INVALID_ID; next = nullptr; } ObjectID objectID; ObjectTracker *next; @@ -82,9 +82,9 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) m_scanDelayInFrames = 100; m_autoHealPercentPerSecond = 0.01f; m_upgradedAutoHealPercentPerSecond = 0.02f; - m_pulseFX = NULL; - m_upgradeRequired = NULL; - m_upgradedPulseFX = NULL; + m_pulseFX = nullptr; + m_upgradeRequired = nullptr; + m_upgradedPulseFX = nullptr; m_affectsSelf = FALSE; } @@ -97,15 +97,15 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "Radius", INI::parseReal, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_scanRadius ) }, - { "DelayBetweenUpdates", INI::parseDurationUnsignedInt, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_scanDelayInFrames ) }, - { "HealPercentEachSecond", INI::parsePercentToReal, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_autoHealPercentPerSecond ) }, - { "UpgradedHealPercentEachSecond", INI::parsePercentToReal,NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedAutoHealPercentPerSecond ) }, - { "PulseFX", INI::parseFXList, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_pulseFX ) }, - { "UpgradeRequired", INI::parseAsciiString, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradeRequired ) }, - { "UpgradedPulseFX", INI::parseFXList, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedPulseFX ) }, - { "AffectsSelf", INI::parseBool, NULL, offsetof( PropagandaTowerBehaviorModuleData, m_affectsSelf ) }, - { 0, 0, 0, 0 } + { "Radius", INI::parseReal, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_scanRadius ) }, + { "DelayBetweenUpdates", INI::parseDurationUnsignedInt, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_scanDelayInFrames ) }, + { "HealPercentEachSecond", INI::parsePercentToReal, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_autoHealPercentPerSecond ) }, + { "UpgradedHealPercentEachSecond", INI::parsePercentToReal,nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedAutoHealPercentPerSecond ) }, + { "PulseFX", INI::parseFXList, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_pulseFX ) }, + { "UpgradeRequired", INI::parseAsciiString, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradeRequired ) }, + { "UpgradedPulseFX", INI::parseFXList, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_upgradedPulseFX ) }, + { "AffectsSelf", INI::parseBool, nullptr, offsetof( PropagandaTowerBehaviorModuleData, m_affectsSelf ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -122,7 +122,7 @@ PropagandaTowerBehavior::PropagandaTowerBehavior( Thing *thing, const ModuleData : UpdateModule( thing, modData ) { m_lastScanFrame = 0; - m_insideList = NULL; + m_insideList = nullptr; setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); } @@ -230,7 +230,7 @@ UpdateSleepTime PropagandaTowerBehavior::update( void ) // go through any objects in our area of influence and do the effect logic on them Object *obj; - ObjectTracker *curr = NULL, *prev = NULL, *next = NULL; + ObjectTracker *curr = nullptr, *prev = nullptr, *next = nullptr; for( curr = m_insideList; curr; curr = next ) { @@ -383,7 +383,7 @@ void PropagandaTowerBehavior::doScan( void ) { const PropagandaTowerBehaviorModuleData *modData = getPropagandaTowerBehaviorModuleData(); Object *us = getObject(); - ObjectTracker *newInsideList = NULL; + ObjectTracker *newInsideList = nullptr; // The act of scanning is when we play our effect Bool upgradePresent = FALSE; @@ -485,7 +485,7 @@ void PropagandaTowerBehavior::doScan( void ) &filterAlive, &filterMapStatus, &filterOutBuildings, - NULL + nullptr }; // scan objects in our region @@ -521,13 +521,13 @@ void PropagandaTowerBehavior::doScan( void ) { // find this entry in the new list - ObjectTracker *o = NULL; + ObjectTracker *o = nullptr; for( o = newInsideList; o; o = o->next ) if( o->objectID == curr->objectID ) break; // if entry wasn't there, remove the bonus from this object - if( o == NULL ) + if( o == nullptr ) { obj = TheGameLogic->findObjectByID( curr->objectID ); @@ -607,7 +607,7 @@ void PropagandaTowerBehavior::xfer( Xfer *xfer ) { // sanity - if( m_insideList != NULL ) + if( m_insideList != nullptr ) { DEBUG_CRASH(( "PropagandaTowerBehavior::xfer - m_insideList should be empty but is not" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp index 13ea128aa94..6cfac09bad9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp @@ -62,10 +62,10 @@ RebuildHoleBehaviorModuleData::RebuildHoleBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "WorkerObjectName", INI::parseAsciiString, NULL, offsetof( RebuildHoleBehaviorModuleData, m_workerTemplateName ) }, - { "WorkerRespawnDelay", INI::parseDurationReal, NULL, offsetof( RebuildHoleBehaviorModuleData, m_workerRespawnDelay ) }, - { "HoleHealthRegen%PerSecond", INI::parsePercentToReal, NULL, offsetof( RebuildHoleBehaviorModuleData, m_holeHealthRegenPercentPerSecond ) }, - { 0, 0, 0, 0 } + { "WorkerObjectName", INI::parseAsciiString, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_workerTemplateName ) }, + { "WorkerRespawnDelay", INI::parseDurationReal, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_workerRespawnDelay ) }, + { "HoleHealthRegen%PerSecond", INI::parsePercentToReal, nullptr, offsetof( RebuildHoleBehaviorModuleData, m_holeHealthRegenPercentPerSecond ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -86,8 +86,8 @@ RebuildHoleBehavior::RebuildHoleBehavior( Thing *thing, const ModuleData* module m_reconstructingID = INVALID_ID; m_spawnerObjectID = INVALID_ID; m_workerWaitCounter = 0; - m_workerTemplate = NULL; - m_rebuildTemplate = NULL; + m_workerTemplate = nullptr; + m_rebuildTemplate = nullptr; } @@ -184,8 +184,8 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) { const RebuildHoleBehaviorModuleData *modData = getRebuildHoleBehaviorModuleData(); Object *hole = getObject(); - Object *reconstructing = NULL; - Object *worker = NULL; + Object *reconstructing = nullptr; + Object *worker = nullptr; // get the worker object if we have one if( m_workerID != 0 ) @@ -195,8 +195,8 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) worker = TheGameLogic->findObjectByID( m_workerID ); // if the worker is no longer there, start the respawning process for a worker again - if( worker == NULL ) - newWorkerRespawnProcess( NULL ); + if( worker == nullptr ) + newWorkerRespawnProcess( nullptr ); } @@ -211,7 +211,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) // if that object does not exist anymore, we need to kill a worker if we have one // and start the spawning process over again // - if( reconstructing == NULL ) + if( reconstructing == nullptr ) { newWorkerRespawnProcess( worker ); m_reconstructingID = INVALID_ID; @@ -220,7 +220,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) } // see if it's time for us to spawn a worker - if( worker == NULL && m_workerWaitCounter > 0 ) + if( worker == nullptr && m_workerWaitCounter > 0 ) { // decrement counter and respawn if it's time @@ -228,7 +228,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) { // resolve the worker template pointer if necessary - if( m_workerTemplate == NULL ) + if( m_workerTemplate == nullptr ) m_workerTemplate = TheThingFactory->findTemplate( modData->m_workerTemplateName ); // create a worker @@ -250,7 +250,7 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) if( ai ) { - if( reconstructing == NULL ) + if( reconstructing == nullptr ) reconstructing = ai->construct( m_rebuildTemplate, hole->getPosition(), hole->getOrientation(), @@ -361,7 +361,7 @@ void RebuildHoleBehavior::onDie( const DamageInfo *damageInfo ) // ------------------------------------------------------------------------------------------------ /*static*/ RebuildHoleBehaviorInterface* RebuildHoleBehavior::getRebuildHoleBehaviorInterfaceFromObject( Object *obj ) { - RebuildHoleBehaviorInterface *rhbi = NULL; + RebuildHoleBehaviorInterface *rhbi = nullptr; if( obj ) { @@ -432,7 +432,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) { m_workerTemplate = TheThingFactory->findTemplate( workerName ); - if( m_workerTemplate == NULL ) + if( m_workerTemplate == nullptr ) { DEBUG_CRASH(( "RebuildHoleBehavior::xfer - Unable to find template '%s'", @@ -443,7 +443,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) } else - m_workerTemplate = NULL; + m_workerTemplate = nullptr; } @@ -457,7 +457,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) { m_rebuildTemplate = TheThingFactory->findTemplate( rebuildName ); - if( m_rebuildTemplate == NULL ) + if( m_rebuildTemplate == nullptr ) { DEBUG_CRASH(( "RebuildHoleBehavior::xfer - Unable to find template '%s'", @@ -468,7 +468,7 @@ void RebuildHoleBehavior::xfer( Xfer *xfer ) } else - m_rebuildTemplate = NULL; + m_rebuildTemplate = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 47832bfadc5..6fe6ad02dac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -81,7 +81,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fx[sdphase].push_back(fxl); @@ -95,7 +95,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[sdphase].push_back(ocl); @@ -109,7 +109,7 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* { SlowDeathBehaviorModuleData* self = (SlowDeathBehaviorModuleData*)instance; SlowDeathPhaseType sdphase = (SlowDeathPhaseType)INI::scanIndexList(ini->getNextToken(), TheSlowDeathPhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const WeaponTemplate *wt = TheWeaponStore->findWeaponTemplate(token); // could be null! this is OK! self->m_weapons[sdphase].push_back(wt); @@ -125,22 +125,22 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void* static const FieldParse dataFieldParse[] = { - { "SinkRate", INI::parseVelocityReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkRate ) }, - { "ProbabilityModifier", INI::parseInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_probabilityModifier ) }, - { "ModifierBonusPerOverkillPercent", INI::parsePercentToReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_modifierBonusPerOverkillPercent ) }, - { "SinkDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkDelay ) }, - { "SinkDelayVariance", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_sinkDelayVariance ) }, - { "DestructionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionDelay ) }, - { "DestructionDelayVariance", INI::parseDurationUnsignedInt, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionDelayVariance ) }, - { "DestructionAltitude", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_destructionAltitude ) }, - { "FX", parseFX, NULL, 0 }, - { "OCL", parseOCL, NULL, 0 }, - { "Weapon", parseWeapon, NULL, 0 }, - { "FlingForce", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForce) }, - { "FlingForceVariance", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) }, - { "FlingPitch", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitch) }, - { "FlingPitchVariance", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitchVariance) }, - { 0, 0, 0, 0 } + { "SinkRate", INI::parseVelocityReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkRate ) }, + { "ProbabilityModifier", INI::parseInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_probabilityModifier ) }, + { "ModifierBonusPerOverkillPercent", INI::parsePercentToReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_modifierBonusPerOverkillPercent ) }, + { "SinkDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkDelay ) }, + { "SinkDelayVariance", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_sinkDelayVariance ) }, + { "DestructionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionDelay ) }, + { "DestructionDelayVariance", INI::parseDurationUnsignedInt, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionDelayVariance ) }, + { "DestructionAltitude", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_destructionAltitude ) }, + { "FX", parseFX, nullptr, 0 }, + { "OCL", parseOCL, nullptr, 0 }, + { "Weapon", parseWeapon, nullptr, 0 }, + { "FlingForce", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingForce) }, + { "FlingForceVariance", INI::parseReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) }, + { "FlingPitch", INI::parseAngleReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingPitch) }, + { "FlingPitchVariance", INI::parseAngleReal, nullptr, offsetof( SlowDeathBehaviorModuleData, m_flingPitchVariance) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( SlowDeathBehaviorModuleData, m_dieMuxData )); @@ -274,7 +274,7 @@ void SlowDeathBehavior::beginSlowDeath(const DamageInfo *damageInfo) SlavedUpdate* slave = (SlavedUpdate*)obj->findUpdateModule( key_SlavedUpdate ); if( slave ) { - slave->onSlaverDie( NULL ); + slave->onSlaverDie( nullptr ); } } @@ -345,7 +345,7 @@ void SlowDeathBehavior::doPhaseStuff(SlowDeathPhaseType sdphase) const FXListVec& v = d->m_fx[sdphase]; DEBUG_ASSERTCRASH(idx>=0&&idxm_ocls[sdphase].size(); @@ -355,7 +355,7 @@ void SlowDeathBehavior::doPhaseStuff(SlowDeathPhaseType sdphase) const OCLVec& v = d->m_ocls[sdphase]; DEBUG_ASSERTCRASH(idx>=0&&idxm_weapons[sdphase].size(); @@ -495,7 +495,7 @@ void SlowDeathBehavior::onDie( const DamageInfo *damageInfo ) for (; *update; ++update) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo)) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo)) { total += sdu->getProbabilityModifier( damageInfo ); } @@ -509,7 +509,7 @@ void SlowDeathBehavior::onDie( const DamageInfo *damageInfo ) for (/* UpdateModuleInterface** */ update = obj->getBehaviorModules(); *update; ++update) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo)) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo)) { roll -= sdu->getProbabilityModifier( damageInfo ); if (roll <= 0) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp index 81ca57e86ee..940a788aaed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp @@ -151,7 +151,7 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onSlaverDie( damageInfo ); break; @@ -159,7 +159,7 @@ void SpawnBehavior::onDie( const DamageInfo *damageInfo ) } // our spawner has died, we must invalidate the ID now in the spawned object - currentSpawn->setProducer( NULL ); + currentSpawn->setProducer( nullptr ); } } @@ -297,7 +297,7 @@ Bool SpawnBehavior::maySpawnSelfTaskAI( Real maxSelfTaskersRatio ) // ------------------------------------------------------------------------------------------------ Object* SpawnBehavior::getClosestSlave( const Coord3D *pos ) { - Object *closest = NULL; + Object *closest = nullptr; Real closestDistance; for( objectIDListIterator it = m_spawnIDs.begin(); it != m_spawnIDs.end(); ++it ) { @@ -527,9 +527,9 @@ class OrphanData OrphanData::OrphanData( void ) { - m_matchTemplate = NULL; - m_source = NULL; - m_closest = NULL; + m_matchTemplate = nullptr; + m_source = nullptr; + m_closest = nullptr; m_closestDistSq = BIG_DISTANCE; } @@ -583,7 +583,7 @@ Object *SpawnBehavior::reclaimOrphanSpawn( void ) continue; orphanData.m_matchTemplate = TheThingFactory->findTemplate( *tempName ); orphanData.m_source = getObject(); - orphanData.m_closest = NULL; + orphanData.m_closest = nullptr; orphanData.m_closestDistSq = BIG_DISTANCE; player->iterateObjects( findClosestOrphan, &orphanData ); prevName = *tempName; @@ -599,17 +599,17 @@ Bool SpawnBehavior::createSpawn() const SpawnBehaviorModuleData *md = getSpawnBehaviorModuleData(); ExitInterface* exitInterface = parent->getObjectExitInterface(); - if( exitInterface == NULL ) + if( exitInterface == nullptr ) { - DEBUG_ASSERTCRASH( exitInterface != NULL, ("Something cannot have SpawnBehavior without an exit interface") ); + DEBUG_ASSERTCRASH( exitInterface != nullptr, ("Something cannot have SpawnBehavior without an exit interface") ); return FALSE; } - ExitDoorType exitDoor = exitInterface->reserveDoorForExit(NULL, NULL); + ExitDoorType exitDoor = exitInterface->reserveDoorForExit(nullptr, nullptr); if (exitDoor == DOOR_NONE_AVAILABLE) return FALSE; - Object *newSpawn = NULL; + Object *newSpawn = nullptr; // try to reclaim orphaned objects if possible Bool reclaimedOrphan = FALSE; @@ -621,7 +621,7 @@ Bool SpawnBehavior::createSpawn() } // This assures that an orphan has not just been reclaimed, - if( newSpawn == NULL ) // and that we really want a new spawn, here. + if( newSpawn == nullptr ) // and that we really want a new spawn, here. { m_spawnTemplate = TheThingFactory->findTemplate( *m_templateNameIterator ); @@ -651,7 +651,7 @@ Bool SpawnBehavior::createSpawn() for (BehaviorModule** update = newSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onEnslave( parent ); break; @@ -675,7 +675,7 @@ Bool SpawnBehavior::createSpawn() ExitInterface* barracksExitInterface = barracks->getObjectExitInterface(); if ( barracksExitInterface ) { - ExitDoorType barracksDoor = barracksExitInterface->reserveDoorForExit(NULL, NULL); + ExitDoorType barracksDoor = barracksExitInterface->reserveDoorForExit(nullptr, nullptr); barracksExitInterface->exitObjectViaDoor( newSpawn, barracksDoor ); newSpawn->setProducer(parent);//let parents producer exit him, but he thinks it was me --m_initialBurstCountdown; @@ -690,8 +690,8 @@ Bool SpawnBehavior::createSpawn() { // find the closest spawn to the nexus... //there is probably a more elegant way to choose the budHost, but oh well - Object *budHost = NULL; - Object *curSpawn = NULL; + Object *budHost = nullptr; + Object *curSpawn = nullptr; Real tapeMeasure = 99999; Real closest = 999999.9f; // 1000 * 1000 objectIDListIterator iter; @@ -711,7 +711,7 @@ Bool SpawnBehavior::createSpawn() } } } - exitInterface->exitObjectByBudding( newSpawn, budHost );// also handles the NULL pointer okay + exitInterface->exitObjectByBudding( newSpawn, budHost );// also handles the nullptr pointer okay } @@ -765,7 +765,7 @@ void SpawnBehavior::onSpawnDeath( ObjectID deadSpawn, DamageInfo *damageInfo ) if ( (m_spawnCount == 0) && m_aggregateHealth) // I'm dead without my spawn { Object *killer = TheGameLogic->findObjectByID(damageInfo->in.m_sourceID); - if (killer != NULL) { + if (killer != nullptr) { killer->scoreTheKill(getObject()); } TheGameLogic->destroyObject(getObject()); @@ -803,7 +803,7 @@ void SpawnBehavior::onDamage( DamageInfo *info ) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onSlaverDamage( info ); break; @@ -874,8 +874,8 @@ void SpawnBehavior::computeAggregateStates(void) Bool SomebodyIsSelected = FALSE; Bool SomebodyIsNotSelected = FALSE; - Drawable *spawnDraw = NULL; - Object *currentSpawn = NULL; + Drawable *spawnDraw = nullptr; + Object *currentSpawn = nullptr; WeaponBonusConditionFlags spawnWeaponBonus; @@ -893,7 +893,7 @@ void SpawnBehavior::computeAggregateStates(void) for (BehaviorModule** update = currentSpawn->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { m_selfTaskingSpawnCount += ( sdu->isSelfTasking()); break; @@ -1094,12 +1094,12 @@ void SpawnBehavior::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - m_spawnTemplate = NULL; + m_spawnTemplate = nullptr; if( name.isEmpty() == FALSE ) { m_spawnTemplate = TheThingFactory->findTemplate( name ); - if( m_spawnTemplate == NULL ) + if( m_spawnTemplate == nullptr ) { DEBUG_CRASH(( "SpawnBehavior::xfer - Unable to find template '%s'", name.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index 78b096c4958..09dcb1b9593 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -50,10 +50,10 @@ SupplyWarehouseCripplingBehaviorModuleData::SupplyWarehouseCripplingBehaviorModu static const FieldParse dataFieldParse[] = { - { "SelfHealSupression", INI::parseDurationUnsignedInt, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealSupression) }, - { "SelfHealDelay", INI::parseDurationUnsignedInt, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealDelay) }, - { "SelfHealAmount", INI::parseReal, NULL, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealAmount) }, - { 0, 0, 0, 0 } + { "SelfHealSupression", INI::parseDurationUnsignedInt, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealSupression) }, + { "SelfHealDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealDelay) }, + { "SelfHealAmount", INI::parseReal, nullptr, offsetof(SupplyWarehouseCripplingBehaviorModuleData, m_selfHealAmount) }, + { nullptr, nullptr, nullptr, 0 } }; UpdateModuleData::buildFieldParse(p); @@ -103,7 +103,7 @@ UpdateSleepTime SupplyWarehouseCripplingBehavior::update() UnsignedInt now = TheGameLogic->getFrame(); m_nextHealingFrame = now + md->m_selfHealDelay; - getObject()->attemptHealing(md->m_selfHealAmount, NULL); + getObject()->attemptHealing(md->m_selfHealAmount, nullptr); if( getObject()->getBodyModule()->getHealth() == getObject()->getBodyModule()->getMaxHealth() ) return UPDATE_SLEEP_FOREVER;// this can't be in onHealing, as the healing comes from here diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp index 6f98771bbd3..32a8f198560 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/TechBuildingBehavior.cpp @@ -42,7 +42,7 @@ // ------------------------------------------------------------------------------------------------ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) { - m_pulseFX = NULL; + m_pulseFX = nullptr; m_pulseFXRate = 0; } @@ -54,9 +54,9 @@ TechBuildingBehaviorModuleData::TechBuildingBehaviorModuleData( void ) static const FieldParse dataFieldParse[] = { - { "PulseFX", INI::parseFXList, NULL, offsetof( TechBuildingBehaviorModuleData, m_pulseFX ) }, - { "PulseFXRate", INI::parseDurationUnsignedInt, NULL, offsetof( TechBuildingBehaviorModuleData, m_pulseFXRate ) }, - { 0, 0, 0, 0 } + { "PulseFX", INI::parseFXList, nullptr, offsetof( TechBuildingBehaviorModuleData, m_pulseFX ) }, + { "PulseFXRate", INI::parseDurationUnsignedInt, nullptr, offsetof( TechBuildingBehaviorModuleData, m_pulseFXRate ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -105,7 +105,7 @@ UpdateSleepTime TechBuildingBehavior::update( void ) } // if we have a pulse fx, and are owned, sleep only a little while, otherwise sleep forever - if (d->m_pulseFX != NULL && d->m_pulseFXRate > 0 && captured) + if (d->m_pulseFX != nullptr && d->m_pulseFXRate > 0 && captured) { FXList::doFXObj( d->m_pulseFX, us ); return UPDATE_SLEEP(d->m_pulseFXRate); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 6ea3f866f7b..9125ed86e88 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -141,13 +141,13 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxHealth", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_maxHealth ) }, - { "InitialHealth", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_initialHealth ) }, + { "MaxHealth", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_maxHealth ) }, + { "InitialHealth", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_initialHealth ) }, - { "SubdualDamageCap", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_subdualDamageCap ) }, - { "SubdualDamageHealRate", INI::parseDurationUnsignedInt, NULL, offsetof( ActiveBodyModuleData, m_subdualDamageHealRate ) }, - { "SubdualDamageHealAmount", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_subdualDamageHealAmount ) }, - { 0, 0, 0, 0 } + { "SubdualDamageCap", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_subdualDamageCap ) }, + { "SubdualDamageHealRate", INI::parseDurationUnsignedInt, nullptr, offsetof( ActiveBodyModuleData, m_subdualDamageHealRate ) }, + { "SubdualDamageHealAmount", INI::parseReal, nullptr, offsetof( ActiveBodyModuleData, m_subdualDamageHealAmount ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -156,8 +156,8 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- ActiveBody::ActiveBody( Thing *thing, const ModuleData* moduleData ) : BodyModule(thing, moduleData), - m_curDamageFX(NULL), - m_curArmorSet(NULL), + m_curDamageFX(nullptr), + m_curArmorSet(nullptr), m_frontCrushed(false), m_backCrushed(false), m_lastDamageTimestamp(0xffffffff),// So we don't think we just got damaged on the first frame @@ -166,7 +166,7 @@ ActiveBody::ActiveBody( Thing *thing, const ModuleData* moduleData ) : m_nextDamageFXTime(0), m_lastDamageFXDone((DamageType)-1), m_lastDamageCleared(false), - m_particleSystems(NULL), + m_particleSystems(nullptr), m_currentSubdualDamage(0), m_indestructible(false) { @@ -342,7 +342,7 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) validateArmorAndDamageFX(); // sanity - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if ( m_indestructible ) @@ -697,7 +697,7 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) { PartitionFilterPlayerAffiliation f1( controllingPlayer, ALLOW_ALLIES, true ); PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &filterMapStatus, nullptr }; Real distance = TheAI->getAiData()->m_retaliateFriendsRadius + obj->getGeometryInfo().getBoundingCircleRadius(); @@ -709,7 +709,7 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) continue; } AIUpdateInterface *ai = them->getAI(); - if (ai==NULL) { + if (ai==nullptr) { continue; } //If we have AI and we're mobile, then assist! @@ -734,7 +734,7 @@ Bool ActiveBody::shouldRetaliateAgainstAggressor(Object *obj, Object *damager) /* This considers whether obj should invoke his friends to retaliate against damager. Note that obj could be a structure, so we don't actually check whether obj will retaliate, as in many cases he wouldn't. */ - if (damager==NULL) { + if (damager==nullptr) { return false; } if (damager->isAirborneTarget()) { @@ -800,7 +800,7 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo ) validateArmorAndDamageFX(); // sanity - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType != DAMAGE_HEALING ) @@ -984,7 +984,7 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, Object *us = getObject(); // sanity - if( systemTemplate == NULL ) + if( systemTemplate == nullptr ) return; // get the bones @@ -993,7 +993,7 @@ void ActiveBody::createParticleSystems( const AsciiString &boneBaseName, Int numBones = us->getMultiLogicalBonePosition( boneBaseName.str(), MAX_BONES, bonePositions, - NULL, + nullptr, FALSE ); // if no bones found nothing else to do @@ -1625,7 +1625,7 @@ void ActiveBody::xfer( Xfer *xfer ) ParticleSystemID particleSystemID; // the list should be empty at this time - if( m_particleSystems != NULL ) + if( m_particleSystems != nullptr ) { DEBUG_CRASH(( "ActiveBody::xfer - m_particleSystems should be empty, but is not" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp index 434d1420530..85b4f4a3588 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/InactiveBody.cpp @@ -76,7 +76,7 @@ Real InactiveBody::estimateDamage( DamageInfoInput& damageInfo ) const //------------------------------------------------------------------------------------------------- void InactiveBody::attemptDamage( DamageInfo *damageInfo ) { - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType == DAMAGE_HEALING ) @@ -113,7 +113,7 @@ void InactiveBody::attemptDamage( DamageInfo *damageInfo ) //------------------------------------------------------------------------------------------------- void InactiveBody::attemptHealing( DamageInfo *damageInfo ) { - if( damageInfo == NULL ) + if( damageInfo == nullptr ) return; if( damageInfo->in.m_damageType != DAMAGE_HEALING ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp index cd5d795ef8f..94326258dfe 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp @@ -43,8 +43,8 @@ void UndeadBodyModuleData::buildFieldParse(MultiIniFieldParse& p) ActiveBodyModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "SecondLifeMaxHealth", INI::parseReal, NULL, offsetof( UndeadBodyModuleData, m_secondLifeMaxHealth ) }, - { 0, 0, 0, 0 } + { "SecondLifeMaxHealth", INI::parseReal, nullptr, offsetof( UndeadBodyModuleData, m_secondLifeMaxHealth ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -122,7 +122,7 @@ void UndeadBody::startSecondLife(DamageInfo *damageInfo) for( ; *update; ++update ) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo) ) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo) ) { total += sdu->getProbabilityModifier( damageInfo ); } @@ -136,7 +136,7 @@ void UndeadBody::startSecondLife(DamageInfo *damageInfo) for( update = getObject()->getBehaviorModules(); *update; ++update) { SlowDeathBehaviorInterface* sdu = (*update)->getSlowDeathBehaviorInterface(); - if (sdu != NULL && sdu->isDieApplicable(damageInfo)) + if (sdu != nullptr && sdu->isDieApplicable(damageInfo)) { roll -= sdu->getProbabilityModifier( damageInfo ); if (roll <= 0) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp index 44da72449dc..2d8f4a3ffea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp @@ -197,7 +197,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other ) Bool targetCanEject = FALSE; - BehaviorModule **dmi = NULL; + BehaviorModule **dmi = nullptr; for( dmi = other->getBehaviorModules(); *dmi; ++dmi ) { if( (*dmi)->getEjectPilotDieInterface() ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp index 6e4cbf8d39a..e81c884b836 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp @@ -53,7 +53,7 @@ CrateCollideModuleData::CrateCollideModuleData() m_executeAnimationFades = TRUE; m_isBuildingPickup = FALSE; m_isHumanOnlyPickup = FALSE; - m_executeFX = NULL; + m_executeFX = nullptr; m_pickupScience = SCIENCE_INVALID; m_executionAnimationTemplate = AsciiString::TheEmptyString; } @@ -66,19 +66,19 @@ void CrateCollideModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CrateCollideModuleData, m_kindof ) }, - { "ForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CrateCollideModuleData, m_kindofnot ) }, - { "ForbidOwnerPlayer", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) }, - { "BuildingPickup", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isBuildingPickup ) }, - { "HumanOnly", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) }, - { "PickupScience", INI::parseScience, NULL, offsetof( CrateCollideModuleData, m_pickupScience ) }, - { "ExecuteFX", INI::parseFXList, NULL, offsetof( CrateCollideModuleData, m_executeFX ) }, - { "ExecuteAnimation", INI::parseAsciiString, NULL, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) }, - { "ExecuteAnimationTime", INI::parseReal, NULL, offsetof( CrateCollideModuleData, m_executeAnimationDisplayTimeInSeconds ) }, - { "ExecuteAnimationZRise", INI::parseReal, NULL, offsetof( CrateCollideModuleData, m_executeAnimationZRisePerSecond ) }, - { "ExecuteAnimationFades", INI::parseBool, NULL, offsetof( CrateCollideModuleData, m_executeAnimationFades ) }, - - { 0, 0, 0, 0 } + { "RequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateCollideModuleData, m_kindof ) }, + { "ForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateCollideModuleData, m_kindofnot ) }, + { "ForbidOwnerPlayer", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) }, + { "BuildingPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isBuildingPickup ) }, + { "HumanOnly", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) }, + { "PickupScience", INI::parseScience, nullptr, offsetof( CrateCollideModuleData, m_pickupScience ) }, + { "ExecuteFX", INI::parseFXList, nullptr, offsetof( CrateCollideModuleData, m_executeFX ) }, + { "ExecuteAnimation", INI::parseAsciiString, nullptr, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) }, + { "ExecuteAnimationTime", INI::parseReal, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationDisplayTimeInSeconds ) }, + { "ExecuteAnimationZRise", INI::parseReal, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationZRisePerSecond ) }, + { "ExecuteAnimationFades", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_executeAnimationFades ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -99,7 +99,7 @@ CrateCollide::~CrateCollide( void ) //------------------------------------------------------------------------------------------------- /** The collide event. - * Note that when other is NULL it means "collide with ground" */ + * Note that when other is nullptr it means "collide with ground" */ //------------------------------------------------------------------------------------------------- void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) { @@ -109,7 +109,7 @@ void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) { if( executeCrateBehavior( other ) ) { - if( modData->m_executeFX != NULL ) + if( modData->m_executeFX != nullptr ) { // Note: We pass in other here, because the crate is owned by the neutral player, and // we want to do things that only the other person can see. @@ -140,7 +140,7 @@ void CrateCollide::onCollide( Object *other, const Coord3D *, const Coord3D * ) Bool CrateCollide::isValidToExecute( const Object *other ) const { //The ground never picks up a crate - if( other == NULL ) + if( other == nullptr ) return FALSE; //Nothing Neutral can pick up any type of crate @@ -151,7 +151,7 @@ Bool CrateCollide::isValidToExecute( const Object *other ) const Bool validBuildingAttempt = md->m_isBuildingPickup && other->isKindOf( KINDOF_STRUCTURE ); // Must be a "Unit" type thing. Real Game Object, not just Object - if( other->getAIUpdateInterface() == NULL && !validBuildingAttempt )// Building exception flag for Drop Zone + if( other->getAIUpdateInterface() == nullptr && !validBuildingAttempt )// Building exception flag for Drop Zone return FALSE; // must match our kindof flags (if any) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp index 047cc1d6d82..b819734f6aa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp @@ -122,7 +122,7 @@ Bool SalvageCrateCollide::executeCrateBehavior( Object *other ) // ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::eligibleForWeaponSet( Object *other ) { - if( other == NULL ) + if( other == nullptr ) return FALSE; // A kindof marks eligibility, and you must not be fully upgraded @@ -137,7 +137,7 @@ Bool SalvageCrateCollide::eligibleForWeaponSet( Object *other ) // ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::eligibleForArmorSet( Object *other ) { - if( other == NULL ) + if( other == nullptr ) return FALSE; // A kindof marks eligibility, and you must not be fully upgraded @@ -152,7 +152,7 @@ Bool SalvageCrateCollide::eligibleForArmorSet( Object *other ) // ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::eligibleForLevel( Object *other ) { - if( other == NULL ) + if( other == nullptr ) return FALSE; // Sorry, you are max level diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp index bed736f817b..d505d8c04cb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp @@ -58,7 +58,7 @@ Bool UnitCrateCollide::executeCrateBehavior( Object *other ) UnsignedInt unitCount = getUnitCrateCollideModuleData()->m_unitCount; ThingTemplate const *unitType = TheThingFactory->findTemplate( getUnitCrateCollideModuleData()->m_unitType ); - if( unitType == NULL ) + if( unitType == nullptr ) { return FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp index 0c35d459a90..efe0f78e804 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp @@ -139,7 +139,7 @@ Bool VeterancyCrateCollide::executeCrateBehavior( Object *other ) if (range == 0) { // do just the collider - if (other != NULL) + if (other != nullptr) { other->getExperienceTracker()->gainExpForLevel( levelsToGain, ( ! md->m_isPilot) ); } @@ -148,7 +148,7 @@ Bool VeterancyCrateCollide::executeCrateBehavior( Object *other ) { PartitionFilterSamePlayer othersPlayerFilter( other->getControllingPlayer() ); PartitionFilterSameMapStatus filterMapStatus(other); - PartitionFilter *filters[] = { &othersPlayerFilter, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &othersPlayerFilter, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( other, range, FROM_CENTER_2D, filters, ITER_FASTEST ); MemoryPoolObjectHolder hold(iter); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp index 0280700e07c..4ed22b276dc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp @@ -43,11 +43,11 @@ void FireWeaponCollideModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "CollideWeapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponCollideModuleData, m_collideWeaponTemplate ) }, - { "FireOnce", INI::parseBool, NULL, offsetof( FireWeaponCollideModuleData, m_fireOnce ) }, - { "RequiredStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( FireWeaponCollideModuleData, m_requiredStatus ) }, - { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( FireWeaponCollideModuleData, m_forbiddenStatus ) }, - { 0, 0, 0, 0 } + { "CollideWeapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponCollideModuleData, m_collideWeaponTemplate ) }, + { "FireOnce", INI::parseBool, nullptr, offsetof( FireWeaponCollideModuleData, m_fireOnce ) }, + { "RequiredStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( FireWeaponCollideModuleData, m_requiredStatus ) }, + { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( FireWeaponCollideModuleData, m_forbiddenStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -56,7 +56,7 @@ void FireWeaponCollideModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- FireWeaponCollide::FireWeaponCollide( Thing *thing, const ModuleData* moduleData ) : CollideModule( thing, moduleData ), - m_collideWeapon(NULL) + m_collideWeapon(nullptr) { m_collideWeapon = TheWeaponStore->allocateNewWeapon(getFireWeaponCollideModuleData()->m_collideWeaponTemplate, PRIMARY_WEAPON); m_everFired = FALSE; @@ -74,7 +74,7 @@ FireWeaponCollide::~FireWeaponCollide( void ) //------------------------------------------------------------------------------------------------- void FireWeaponCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { - if( other == NULL ) + if( other == nullptr ) return; //Don't shoot the ground Object *me = getObject(); @@ -144,7 +144,7 @@ void FireWeaponCollide::xfer( Xfer *xfer ) if( collideWeaponPresent ) { - DEBUG_ASSERTCRASH( m_collideWeapon != NULL, + DEBUG_ASSERTCRASH( m_collideWeapon != nullptr, ("FireWeaponCollide::xfer - m_collideWeapon present mismatch") ); xfer->xferSnapshot( m_collideWeapon ); @@ -152,7 +152,7 @@ void FireWeaponCollide::xfer( Xfer *xfer ) else { - DEBUG_ASSERTCRASH( m_collideWeapon == NULL, + DEBUG_ASSERTCRASH( m_collideWeapon == nullptr, ("FireWeaponCollide::Xfer - m_collideWeapon missing mismatch" )); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp index e66b5eaf701..0914f3af708 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp @@ -62,7 +62,7 @@ SquishCollide::~SquishCollide( void ) void SquishCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // Note that other == null means "collide with ground" - if (other == NULL) + if (other == nullptr) return; Object *self = getObject(); @@ -92,7 +92,7 @@ void SquishCollide::onCollide( Object *other, const Coord3D *loc, const Coord3D if( other->getCrusherLevel() > 0 && other->getRelationship(getObject()) != ALLIES) { PhysicsBehavior *otherPhysics = other->getPhysics(); - if (otherPhysics == NULL) + if (otherPhysics == nullptr) return; // use a 1.0 crush radius so the tank has to actually hit the infantry. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp index cca17ecd0c1..1dd7cfdec75 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/CaveContain.cpp @@ -55,7 +55,7 @@ CaveContain::CaveContain( Thing *thing, const ModuleData* moduleData ) : OpenCon { m_needToRunOnBuildComplete = true; m_caveIndex = 0; - m_originalTeam = NULL; + m_originalTeam = nullptr; } //------------------------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ void CaveContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // @@ -175,10 +175,10 @@ void CaveContain::onRemoving( Object *obj ) // (hokey exception: if our team is null, don't bother -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() != NULL) + if (getObject()->getTeam() != nullptr) { changeTeamOnAllConnectedCaves( m_originalTeam, FALSE ); - m_originalTeam = NULL; + m_originalTeam = nullptr; } // change the state back from garrisoned @@ -278,7 +278,7 @@ void CaveContain::tryToSetCaveIndex( Int newIndex ) void CaveContain::recalcApparentControllingPlayer( void ) { //Record original team first time through. - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { m_originalTeam = getObject()->getTeam(); } @@ -286,8 +286,8 @@ void CaveContain::recalcApparentControllingPlayer( void ) // (hokey trick: if our team is null, nuke originalTeam -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() == NULL) - m_originalTeam = NULL; + if (getObject()->getTeam() == nullptr) + m_originalTeam = nullptr; // This is called from onContaining, so a one is the edge trigger to do capture stuff if( getContainCount() == 1 ) @@ -324,10 +324,10 @@ static CaveInterface* findCave(Object* obj) for (BehaviorModule** i = obj->getBehaviorModules(); *i; ++i) { CaveInterface* c = (*i)->getCaveInterface(); - if (c != NULL) + if (c != nullptr) return c; } - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////////////// @@ -344,12 +344,12 @@ void CaveContain::changeTeamOnAllConnectedCaves( Team *newTeam, Bool setOriginal // This is a distributed Garrison in terms of capturing, so when one node // triggers the change, he needs to tell everyone, so anyone can do the un-change. CaveInterface *caveModule = findCave(currentCave); - if( caveModule == NULL ) + if( caveModule == nullptr ) continue; if( setOriginalTeams ) caveModule->setOriginalTeam( currentCave->getTeam() ); else - caveModule->setOriginalTeam( NULL ); + caveModule->setOriginalTeam( nullptr ); // Now do the actual switch for this one. @@ -408,7 +408,7 @@ void CaveContain::xfer( Xfer *xfer ) { m_originalTeam = TheTeamFactory->findTeamByID( teamID ); - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { DEBUG_CRASH(( "CaveContain::xfer - Unable to find original team by id" )); @@ -418,7 +418,7 @@ void CaveContain::xfer( Xfer *xfer ) } else - m_originalTeam = NULL; + m_originalTeam = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index cebefa404a7..b10b2437f2a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -96,7 +96,7 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, #endif // sanity - if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) + if( targetPos == nullptr || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) return GARRISON_INDEX_INVALID; Int closestIndex = GARRISON_INDEX_INVALID; @@ -106,7 +106,7 @@ Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, { // only consider free garrison points - if( m_garrisonPointData[ i ].object == NULL ) + if( m_garrisonPointData[ i ].object == nullptr ) { // compute the squared distance between these two points @@ -135,7 +135,7 @@ Int GarrisonContain::getObjectGarrisonPointIndex( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return GARRISON_INDEX_INVALID; for( Int i = 0; i < MAX_GARRISON_POINTS; ++i ) @@ -157,7 +157,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); // sanity - if( obj == NULL || pointIndex < 0 || pointIndex >= MAX_GARRISON_POINTS || + if( obj == nullptr || pointIndex < 0 || pointIndex >= MAX_GARRISON_POINTS || conditionIndex < 0 || conditionIndex >= MAX_GARRISON_POINT_CONDITIONS ) { @@ -167,7 +167,7 @@ void GarrisonContain::putObjectAtGarrisonPoint( Object *obj, } // make sure this point is empty - if( m_garrisonPointData[ pointIndex ].object != NULL ) + if( m_garrisonPointData[ pointIndex ].object != nullptr ) { DEBUG_CRASH(( "GarrisonContain::putObjectAtGarrisonPoint - Garrison Point '%d' is not empty", @@ -327,7 +327,7 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap removeObjectFromGarrisonPoint( source, existingIndex ); } - putObjectAtBestGarrisonPoint( source, victim, NULL ); + putObjectAtBestGarrisonPoint( source, victim, nullptr ); //Okay, now we have positioned the object in the best position for the victim. //Now check if we are able to fire on our victim. @@ -368,7 +368,7 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap removeObjectFromGarrisonPoint( source, existingIndex ); } - putObjectAtBestGarrisonPoint( source, NULL, targetPos ); + putObjectAtBestGarrisonPoint( source, nullptr, targetPos ); //Okay, now we have positioned the object in the best position for the targetPos. //Now check if we are able to fire on our targetPos. @@ -394,7 +394,7 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, { // sanity - if( obj == NULL || (target == NULL && targetPos == NULL) ) + if( obj == nullptr || (target == nullptr && targetPos == nullptr) ) return; #ifdef DEBUG_CRASHING @@ -402,7 +402,7 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif // if obj target, override pos - if (target != NULL) + if (target != nullptr) targetPos = target->getPosition(); // if this object is already at a garrison point do nothing @@ -438,7 +438,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) #endif // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // search for the object in the garrison point data, if found, remove it @@ -474,7 +474,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) } // remove from this spot - m_garrisonPointData[ removeIndex ].object = NULL; + m_garrisonPointData[ removeIndex ].object = nullptr; m_garrisonPointData[ removeIndex ].targetID = INVALID_ID; m_garrisonPointData[ removeIndex ].placeFrame = 0; m_garrisonPointData[ removeIndex ].lastEffectFrame = 0; @@ -483,7 +483,7 @@ void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) // destroy drawable for gun barrel and effects if present if( m_garrisonPointData[ removeIndex ].effect ) TheGameClient->destroyDrawable( m_garrisonPointData[ removeIndex ].effect ); - m_garrisonPointData[ removeIndex ].effect = NULL; + m_garrisonPointData[ removeIndex ].effect = nullptr; // set the position of the object to back to the center of the garrisoned building obj->setPosition( getObject()->getPosition() ); @@ -506,7 +506,7 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : { Int i, j; - m_originalTeam = NULL; + m_originalTeam = nullptr; m_hideGarrisonedStateFromNonallies = FALSE; m_garrisonPointsInUse = 0; m_garrisonPointsInitialized = FALSE; @@ -515,11 +515,11 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : for( i = 0; i < MAX_GARRISON_POINTS; i++ ) { - m_garrisonPointData[ i ].object = NULL; + m_garrisonPointData[ i ].object = nullptr; m_garrisonPointData[ i ].targetID = INVALID_ID; m_garrisonPointData[ i ].placeFrame = 0; m_garrisonPointData[ i ].lastEffectFrame = 0; - m_garrisonPointData[ i ].effect = NULL; + m_garrisonPointData[ i ].effect = nullptr; for( j = 0; j < MAX_GARRISON_POINT_CONDITIONS; ++j ) m_garrisonPoint[ j ][ i ].zero(); @@ -662,9 +662,9 @@ void GarrisonContain::addValidObjectsToGarrisonPoints( void ) // already in there // if( victim ) - putObjectAtBestGarrisonPoint( obj, victim, NULL ); + putObjectAtBestGarrisonPoint( obj, victim, nullptr ); else if( victimPos ) - putObjectAtBestGarrisonPoint( obj, NULL, victimPos ); + putObjectAtBestGarrisonPoint( obj, nullptr, victimPos ); } @@ -682,7 +682,7 @@ void GarrisonContain::trackTargets( void ) { - if ( ! isEnclosingContainerFor( 0 ) ) + if ( ! isEnclosingContainerFor( nullptr ) ) return; // since ina non-enclosing container, objects fire from their station points, instead of being juggled around between garrison firepoints @@ -974,7 +974,7 @@ UpdateSleepTime GarrisonContain::update( void ) // ------------------------------------------------------------------------------------------------ void GarrisonContain::matchObjectsToGarrisonPoints( void ) { - if ( isEnclosingContainerFor( NULL ) == FALSE ) + if ( isEnclosingContainerFor( nullptr ) == FALSE ) { // enforce that everybody stays at their pre-assigned space positionObjectsAtStationGarrisonPoints(); @@ -1070,7 +1070,7 @@ void GarrisonContain::removeObjectFromStationPoint( const Object *obj ) { //sanity - if ( obj == NULL ) + if ( obj == nullptr ) return; Bool foundOccupant = FALSE; @@ -1204,7 +1204,7 @@ const Player* GarrisonContain::getApparentControllingPlayer( const Player* obser void GarrisonContain::recalcApparentControllingPlayer( void ) { //Record original team first time through. - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { m_originalTeam = getObject()->getTeam(); } @@ -1212,8 +1212,8 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) // (hokey trick: if our team is null, nuke originalTeam -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() == NULL) - m_originalTeam = NULL; + if (getObject()->getTeam() == nullptr) + m_originalTeam = nullptr; // Check to see if we have any units contained in our object if( getContainCount() > 0 ) { @@ -1226,7 +1226,7 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) m_hideGarrisonedStateFromNonallies = ( !detected && ( getStealthUnitsContained() == getContainCount() ) ); Player* controller = rider->getControllingPlayer(); - Team *team = controller ? controller->getDefaultTeam() : NULL; + Team *team = controller ? controller->getDefaultTeam() : nullptr; if( team ) { getObject()->setTeam( team ); @@ -1280,7 +1280,7 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) // if we don't already have them. if( getContainCount() > 0 ) { - if ( isEnclosingContainerFor( 0 ) ) + if ( isEnclosingContainerFor( nullptr ) ) { if ( m_garrisonPointsInitialized == FALSE ) { @@ -1351,7 +1351,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_PRISTINE; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1365,7 +1365,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_DAMAGED; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1379,7 +1379,7 @@ void GarrisonContain::loadGarrisonPoints( void ) structure->clearAndSetModelConditionFlags( clearFlags, setFlags ); conditionIndex = GARRISON_POINT_REALLY_DAMAGED; - count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], NULL); + count = structure->getMultiLogicalBonePosition("FIREPOINT", MAX_GARRISON_POINTS, m_garrisonPoint[ conditionIndex ], nullptr); if ( count > 0) gBonesFound = TRUE; @@ -1677,10 +1677,10 @@ void GarrisonContain::onRemoving( Object *obj ) // (hokey exception: if our team is null, don't bother -- this // usually means we are being called during game-teardown and // the teams are no longer valid...) - if (getObject()->getTeam() != NULL) + if (getObject()->getTeam() != nullptr) { getObject()->setTeam( m_originalTeam ); - m_originalTeam = NULL; + m_originalTeam = nullptr; } // we also lose our transient attack ability @@ -1818,7 +1818,7 @@ void GarrisonContain::xfer( Xfer *xfer ) { m_originalTeam = TheTeamFactory->findTeamByID( teamID ); - if( m_originalTeam == NULL ) + if( m_originalTeam == nullptr ) { DEBUG_CRASH(( "GarrisonContain::xfer - Unable to find original team by id" )); @@ -1828,7 +1828,7 @@ void GarrisonContain::xfer( Xfer *xfer ) } else - m_originalTeam = NULL; + m_originalTeam = nullptr; } @@ -1937,7 +1937,7 @@ void GarrisonContain::loadPostProcess( void ) { m_garrisonPointData[ i ].object = TheGameLogic->findObjectByID( m_garrisonPointData[ i ].objectID ); - if( m_garrisonPointData[ i ].object == NULL ) + if( m_garrisonPointData[ i ].object == nullptr ) { DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find object for point data" )); @@ -1947,14 +1947,14 @@ void GarrisonContain::loadPostProcess( void ) } else - m_garrisonPointData[ i ].object = NULL; + m_garrisonPointData[ i ].object = nullptr; // drawable effect pointer if( m_garrisonPointData[ i ].effectID != INVALID_ID ) { m_garrisonPointData[ i ].effect = TheGameClient->findDrawableByID( m_garrisonPointData[ i ].effectID ); - if( m_garrisonPointData[ i ].effect == NULL ) + if( m_garrisonPointData[ i ].effect == nullptr ) { DEBUG_CRASH(( "GarrisonContain::loadPostProcess - Unable to find effect for point data" )); @@ -1964,7 +1964,7 @@ void GarrisonContain::loadPostProcess( void ) } else - m_garrisonPointData[ i ].effect = NULL; + m_garrisonPointData[ i ].effect = nullptr; } @@ -2015,7 +2015,7 @@ void GarrisonContain::loadStationGarrisonPoints( void ) for( ; t < MAX_GARRISON_POINTS; ++t ) tempBuffer[ t ] = *(structure->getPosition()); - count = structure->getMultiLogicalBonePosition("STATION", modData->m_containMax, tempBuffer, NULL); + count = structure->getMultiLogicalBonePosition("STATION", modData->m_containMax, tempBuffer, nullptr); if ( count > 0) stationBonesFound = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp index 6ad5180f880..7dc1f72d383 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HealContain.cpp @@ -59,8 +59,8 @@ HealContainModuleData::HealContainModuleData( void ) static const FieldParse dataFieldParse[] = { - { "TimeForFullHeal", INI::parseDurationUnsignedInt, NULL, offsetof( HealContainModuleData, m_framesForFullHeal ) }, - { 0, 0, 0, 0 } + { "TimeForFullHeal", INI::parseDurationUnsignedInt, nullptr, offsetof( HealContainModuleData, m_framesForFullHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp index 84f1f50988e..115b18caa1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/HelixContain.cpp @@ -66,10 +66,10 @@ void HelixContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(HelixContainModuleData, m_payloadTemplateNameData) }, - {"ShouldDrawPips", INI::parseBool, NULL, offsetof(HelixContainModuleData, m_drawPips) }, + { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, nullptr, offsetof(HelixContainModuleData, m_payloadTemplateNameData) }, + {"ShouldDrawPips", INI::parseBool, nullptr, offsetof(HelixContainModuleData, m_drawPips) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -317,7 +317,7 @@ const Object *HelixContain::friend_getRider() const return portableAsRider; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp index 4e1e5f6a184..4e1e5eb47e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/InternetHackContain.cpp @@ -51,7 +51,7 @@ void InternetHackContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp index b6eca3e85ea..90b2c6b756e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/MobNexusContain.cpp @@ -86,15 +86,15 @@ void MobNexusContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Slots", INI::parseInt, NULL, offsetof( MobNexusContainModuleData, m_slotCapacity ) }, - { "ScatterNearbyOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_scatterNearbyOnExit ) }, - { "OrientLikeContainerOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_orientLikeContainerOnExit ) }, - { "KeepContainerVelocityOnExit", INI::parseBool, NULL, offsetof( MobNexusContainModuleData, m_keepContainerVelocityOnExit ) }, - { "ExitBone", INI::parseAsciiString, NULL, offsetof( MobNexusContainModuleData, m_exitBone ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( MobNexusContainModuleData, m_exitPitchRate ) }, - { "InitialPayload", parseInitialPayload, NULL, 0 }, - { "HealthRegen%PerSec", INI::parseReal, NULL, offsetof( MobNexusContainModuleData, m_healthRegen ) }, - { 0, 0, 0, 0 } + { "Slots", INI::parseInt, nullptr, offsetof( MobNexusContainModuleData, m_slotCapacity ) }, + { "ScatterNearbyOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_scatterNearbyOnExit ) }, + { "OrientLikeContainerOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_orientLikeContainerOnExit ) }, + { "KeepContainerVelocityOnExit", INI::parseBool, nullptr, offsetof( MobNexusContainModuleData, m_keepContainerVelocityOnExit ) }, + { "ExitBone", INI::parseAsciiString, nullptr, offsetof( MobNexusContainModuleData, m_exitBone ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( MobNexusContainModuleData, m_exitPitchRate ) }, + { "InitialPayload", parseInitialPayload, nullptr, 0 }, + { "HealthRegen%PerSec", INI::parseReal, nullptr, offsetof( MobNexusContainModuleData, m_healthRegen ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -242,9 +242,9 @@ void MobNexusContain::onRemoving( Object *rider ) if (draw) { Coord3D bonePos, worldPos; - if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, NULL, 1) == 1) + if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, nullptr, 1) == 1) { - getObject()->convertBonePosToWorldPos(&bonePos, NULL, &worldPos, NULL); + getObject()->convertBonePosToWorldPos(&bonePos, nullptr, &worldPos, nullptr); rider->setPosition(&worldPos); } } @@ -383,7 +383,7 @@ UpdateSleepTime MobNexusContain::update() // ------------------------------------------------------------------------------------------------ ExitDoorType MobNexusContain::reserveDoorForExit( const ThingTemplate* objType, Object *specificObject ) { - if( specificObject == NULL ) + if( specificObject == nullptr ) return DOOR_1;// I can, in general, exit people. // This is an override, not an extend. I will check for game legality for diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 51f088d961a..fd99fe3d9b6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -90,22 +90,22 @@ OpenContainModuleData::OpenContainModuleData( void ) static const FieldParse dataFieldParse[] = { - { "ContainMax", INI::parseInt, NULL, offsetof( OpenContainModuleData, m_containMax ) }, - { "EnterSound", INI::parseAudioEventRTS, NULL, offsetof( OpenContainModuleData, m_enterSound ) }, - { "ExitSound", INI::parseAudioEventRTS, NULL, offsetof( OpenContainModuleData, m_exitSound ) }, - { "DamagePercentToUnits", INI::parsePercentToReal, NULL, offsetof( OpenContainModuleData, m_damagePercentageToUnits ) }, - { "BurnedDeathToUnits", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_isBurnedDeathToUnits ) }, - { "AllowInsideKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( OpenContainModuleData, m_allowInsideKindOf ) }, - { "ForbidInsideKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( OpenContainModuleData, m_forbidInsideKindOf ) }, - { "PassengersAllowedToFire", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_passengersAllowedToFire ) }, - { "PassengersInTurret", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_passengersInTurret ) }, - { "NumberOfExitPaths", INI::parseInt, NULL, offsetof( OpenContainModuleData, m_numberOfExitPaths ) }, - { "DoorOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( OpenContainModuleData, m_doorOpenTime ) }, - { "WeaponBonusPassedToPassengers", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_weaponBonusPassedToPassengers ) }, - { "AllowAlliesInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowAlliesInside ) }, - { "AllowEnemiesInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowEnemiesInside ) }, - { "AllowNeutralInside", INI::parseBool, NULL, offsetof( OpenContainModuleData, m_allowNeutralInside ) }, - { 0, 0, 0, 0 } + { "ContainMax", INI::parseInt, nullptr, offsetof( OpenContainModuleData, m_containMax ) }, + { "EnterSound", INI::parseAudioEventRTS, nullptr, offsetof( OpenContainModuleData, m_enterSound ) }, + { "ExitSound", INI::parseAudioEventRTS, nullptr, offsetof( OpenContainModuleData, m_exitSound ) }, + { "DamagePercentToUnits", INI::parsePercentToReal, nullptr, offsetof( OpenContainModuleData, m_damagePercentageToUnits ) }, + { "BurnedDeathToUnits", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_isBurnedDeathToUnits ) }, + { "AllowInsideKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( OpenContainModuleData, m_allowInsideKindOf ) }, + { "ForbidInsideKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( OpenContainModuleData, m_forbidInsideKindOf ) }, + { "PassengersAllowedToFire", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_passengersAllowedToFire ) }, + { "PassengersInTurret", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_passengersInTurret ) }, + { "NumberOfExitPaths", INI::parseInt, nullptr, offsetof( OpenContainModuleData, m_numberOfExitPaths ) }, + { "DoorOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( OpenContainModuleData, m_doorOpenTime ) }, + { "WeaponBonusPassedToPassengers", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_weaponBonusPassedToPassengers ) }, + { "AllowAlliesInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowAlliesInside ) }, + { "AllowEnemiesInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowEnemiesInside ) }, + { "AllowNeutralInside", INI::parseBool, nullptr, offsetof( OpenContainModuleData, m_allowNeutralInside ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( OpenContainModuleData, m_dieMuxData )); @@ -290,7 +290,7 @@ void OpenContain::addToContain( Object *rider ) } // sanity - if( rider == NULL ) + if( rider == nullptr ) return; Drawable *riderDraw = rider->getDrawable(); @@ -313,12 +313,12 @@ void OpenContain::addToContain( Object *rider ) reportObject = *items->begin(); } } - DEBUG_CRASH( ("OpenContain::addToContain() - Object %s not valid for container %s!", reportObject?reportObject->getTemplate()->getName().str():"NULL", getObject()->getTemplate()->getName().str() ) ); + DEBUG_CRASH( ("OpenContain::addToContain() - Object %s not valid for container %s!", reportObject?reportObject->getTemplate()->getName().str():"null", getObject()->getTemplate()->getName().str() ) ); } #endif // this object cannot be contained by this module if it is already contained in something - if( rider->getContainedBy() != NULL ) + if( rider->getContainedBy() != nullptr ) { DEBUG_LOG(( "'%s' is trying to contain '%s', but '%s' is already contained by '%s'", @@ -391,7 +391,7 @@ void OpenContain::removeFromContain( Object *rider, Bool exposeStealthUnits ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; // @@ -459,7 +459,7 @@ void OpenContain::killAllContained( void ) { Object *rider = *it++; - DEBUG_ASSERTCRASH( rider, ("Contain list must not contain NULL element")); + DEBUG_ASSERTCRASH( rider, ("Contain list must not contain null element")); if ( rider ) { onRemoving( rider ); @@ -481,7 +481,7 @@ void OpenContain::harmAndForceExitAllContained( DamageInfo *info ) { Object *rider = *it; - DEBUG_ASSERTCRASH( rider, ("Contain list must not contain NULL element")); + DEBUG_ASSERTCRASH( rider, ("Contain list must not contain null element")); if ( rider ) { removeFromContain( rider, true ); @@ -595,7 +595,7 @@ void OpenContain::iterateContained( ContainIterateFunc func, void *userData, Boo // ------------------------------------------------------------------------------------------------ Object* OpenContain::getClosestRider( const Coord3D *pos ) { - Object *closest = NULL; + Object *closest = nullptr; Real closestDistance; for(ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it) @@ -798,7 +798,7 @@ Real OpenContain::getContainedItemsMass() const void OpenContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // colliding with nothing? we don't care. - if( other == NULL ) + if( other == nullptr ) return; // ok, step two: only contain stuff that wants us to contain it. @@ -806,7 +806,7 @@ void OpenContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *n // must be an AI object.... AIUpdateInterface *ai = other->getAI(); - if (ai == NULL) + if (ai == nullptr) return; // ...and must be trying to enter our object. @@ -994,8 +994,8 @@ void OpenContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor ) startBone.concat(suffix); endBone.concat(suffix); } - me->getSingleLogicalBonePosition( startBone.str(), &startPosition, NULL ); - me->getSingleLogicalBonePosition( endBone.str(), &endPosition, NULL ); + me->getSingleLogicalBonePosition( startBone.str(), &startPosition, nullptr ); + me->getSingleLogicalBonePosition( endBone.str(), &endPosition, nullptr ); //startPosition.x = startPosition.y = 0; Real exitAngle = me->getOrientation(); @@ -1031,7 +1031,7 @@ void OpenContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor ) TheAI->pathfinder()->updatePos(me, me->getPosition()); TheAI->pathfinder()->updateGoal(me, me->getPosition(), TheTerrainLogic->getLayerForDestination(me->getPosition())); } - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // The units often come out at the same position, and need to ignore collisions briefly // as they move out. jba. ai->setIgnoreCollisionTime(LOGICFRAMES_PER_SECOND); @@ -1113,8 +1113,8 @@ void OpenContain::exitObjectInAHurry( Object *exitObj ) startBone.concat(suffix); endBone.concat(suffix); } - me->getSingleLogicalBonePosition( startBone.str(), &startPosition, NULL ); - me->getSingleLogicalBonePosition( endBone.str(), &endPosition, NULL ); + me->getSingleLogicalBonePosition( startBone.str(), &startPosition, nullptr ); + me->getSingleLogicalBonePosition( endBone.str(), &endPosition, nullptr ); //startPosition.x = startPosition.y = 0; Real exitAngle = me->getOrientation(); @@ -1136,7 +1136,7 @@ void OpenContain::exitObjectInAHurry( Object *exitObj ) TheAI->pathfinder()->updatePos(me, me->getPosition()); TheAI->pathfinder()->updateGoal(me, me->getPosition(), TheTerrainLogic->getLayerForDestination(me->getPosition())); } - ai->ignoreObstacle(NULL); + ai->ignoreObstacle(nullptr); // The units often come out at the same position, and need to ignore collisions briefly // as they move out. jba. ai->setIgnoreCollisionTime(LOGICFRAMES_PER_SECOND); @@ -1173,7 +1173,7 @@ Bool OpenContain::isPassengerAllowedToFire( ObjectID id ) const return FALSE;// Just no, no matter what. // If we are ourselves contained, our passengers need to check with them if they get past us - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return getObject()->getContainedBy()->getContain()->isPassengerAllowedToFire(); return TRUE;// We say yes, and we are not inside something. @@ -1251,7 +1251,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) if( m_firePointSize == 0 && m_noFirePointsInArt == false ) { - m_firePointSize = getObject()->getMultiLogicalBonePosition("FIREPOINT", MAX_FIRE_POINTS, NULL, m_firePoints, TRUE ); + m_firePointSize = getObject()->getMultiLogicalBonePosition("FIREPOINT", MAX_FIRE_POINTS, nullptr, m_firePoints, TRUE ); // // if there is still no firepoints in the art, we'll set a flag so that we don't @@ -1289,7 +1289,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) } firepoint.concat(suffix); - getObject()->getSingleLogicalBonePositionOnTurret(TURRET_MAIN, firepoint.str(), NULL, &matrix ); + getObject()->getSingleLogicalBonePositionOnTurret(TURRET_MAIN, firepoint.str(), nullptr, &matrix ); } else { @@ -1322,7 +1322,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) */ void OpenContain::onObjectWantsToEnterOrExit(Object* obj, ObjectEnterExitType wants) { - if (obj == NULL) + if (obj == nullptr) return; ObjectID id = obj->getID(); @@ -1345,7 +1345,7 @@ void OpenContain::pruneDeadWanters() { ObjectID id = (*it).first; Object* obj = TheGameLogic->findObjectByID(id); - if (obj == NULL || obj->isEffectivelyDead()) + if (obj == nullptr || obj->isEffectivelyDead()) { ObjectEnterExitMap::iterator tmp = it; ++it; @@ -1525,7 +1525,7 @@ void OpenContain::processDamageToContained(Real percentDamage) { Object *object = *it; - DEBUG_ASSERTCRASH( object, ("Contain list must not contain NULL element") ); + DEBUG_ASSERTCRASH( object, ("Contain list must not contain null element") ); // Calculate the damage to be inflicted on each unit. Real damage = object->getBodyModule()->getMaxHealth() * percentDamage; @@ -1604,7 +1604,7 @@ const Coord3D *OpenContain::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1618,7 +1618,7 @@ Bool OpenContain::getNaturalRallyPoint( Coord3D& rallyPoint, Bool offset ) cons { endBone.concat("01"); } - getObject()->getSingleLogicalBonePosition( endBone.str(), &rallyPoint, NULL ); + getObject()->getSingleLogicalBonePosition( endBone.str(), &rallyPoint, nullptr ); } else { @@ -1896,7 +1896,7 @@ void OpenContain::loadPostProcess( void ) obj = TheGameLogic->findObjectByID( *idIt ); // sanity - if( obj == NULL ) + if( obj == nullptr ) { DEBUG_CRASH(( "OpenContain::loadPostProcess - Unable to find object to put on contain list" )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index ce039ed6f84..b099f2b884c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -65,10 +65,10 @@ void OverlordContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(OverlordContainModuleData, m_payloadTemplateNameData) }, - { "ExperienceSinkForRider", INI::parseBool, NULL, offsetof(OverlordContainModuleData, m_experienceSinkForRider) }, + { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, nullptr, offsetof(OverlordContainModuleData, m_payloadTemplateNameData) }, + { "ExperienceSinkForRider", INI::parseBool, nullptr, offsetof(OverlordContainModuleData, m_experienceSinkForRider) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -180,17 +180,17 @@ ContainModuleInterface *OverlordContain::getRedirectedContain() const // If I am empty, say no. if( m_containListSize < 1 ) - return NULL; + return nullptr; if( !m_redirectionActivated ) - return NULL;// Shut off early to allow death to happen without my bunker having + return nullptr;// Shut off early to allow death to happen without my bunker having // trouble finding me to say goodbye as messages get sucked up the pipe to him. Object *myGuy = m_containList.front(); if( myGuy ) return myGuy->getContain(); - return NULL;// Or say no if they have no contain. + return nullptr;// Or say no if they have no contain. } @@ -204,7 +204,7 @@ ContainModuleInterface *OverlordContain::getRedirectedContain() const void OverlordContain::onDie( const DamageInfo *damageInfo ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onDie( damageInfo ); return; @@ -227,7 +227,7 @@ void OverlordContain::onDie( const DamageInfo *damageInfo ) void OverlordContain::onDelete( void ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onDelete( ); return; @@ -256,7 +256,7 @@ void OverlordContain::onCapture( Player *oldOwner, Player *newOwner ) //------------------------------------------------------------------------------------------------- Bool OverlordContain::isGarrisonable() const { - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE; return getRedirectedContain()->isGarrisonable(); @@ -265,7 +265,7 @@ Bool OverlordContain::isGarrisonable() const //------------------------------------------------------------------------------------------------- Bool OverlordContain::isKickOutOnCapture() { - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE;// Me the Overlord doesn't want to return getRedirectedContain()->isKickOutOnCapture(); @@ -275,7 +275,7 @@ Bool OverlordContain::isKickOutOnCapture() void OverlordContain::addToContainList( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::addToContainList( obj ); return; @@ -288,7 +288,7 @@ void OverlordContain::addToContainList( Object *obj ) void OverlordContain::addToContain( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::addToContain( obj ); return; @@ -306,7 +306,7 @@ void OverlordContain::addToContain( Object *obj ) void OverlordContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::removeFromContain( obj, exposeStealthUnits ); return; @@ -322,7 +322,7 @@ void OverlordContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) void OverlordContain::removeAllContained( Bool exposeStealthUnits ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::removeAllContained( exposeStealthUnits ); return; @@ -347,7 +347,7 @@ void OverlordContain::removeAllContained( Bool exposeStealthUnits ) void OverlordContain::iterateContained( ContainIterateFunc func, void *userData, Bool reverse ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::iterateContained( func, userData, reverse ); return; @@ -360,7 +360,7 @@ void OverlordContain::iterateContained( ContainIterateFunc func, void *userData, void OverlordContain::onContaining( Object *obj, Bool wasSelected ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onContaining( obj, wasSelected ); @@ -415,7 +415,7 @@ void OverlordContain::killAllContained( void ) void OverlordContain::onRemoving( Object *obj ) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { TransportContain::onRemoving( obj ); return; @@ -431,7 +431,7 @@ void OverlordContain::onRemoving( Object *obj ) Bool OverlordContain::isValidContainerFor(const Object* obj, Bool checkCapacity) const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::isValidContainerFor( obj, checkCapacity ); return getRedirectedContain()->isValidContainerFor( obj, checkCapacity ); @@ -443,7 +443,7 @@ UnsignedInt OverlordContain::getContainCount() const ContainModuleInterface* redir = getRedirectedContain(); // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( redir == NULL ) + if( redir == nullptr ) return TransportContain::getContainCount( ); return redir->getContainCount(); @@ -453,7 +453,7 @@ UnsignedInt OverlordContain::getContainCount() const Bool OverlordContain::getContainerPipsToShow(Int& numTotal, Int& numFull) { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) { numTotal = 0; numFull = 0; @@ -469,7 +469,7 @@ Bool OverlordContain::getContainerPipsToShow(Int& numTotal, Int& numFull) Int OverlordContain::getContainMax( ) const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::getContainMax( ); return getRedirectedContain()->getContainMax(); @@ -479,7 +479,7 @@ Int OverlordContain::getContainMax( ) const const ContainedItemsList* OverlordContain::getContainedItemsList() const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return TransportContain::getContainedItemsList( ); return getRedirectedContain()->getContainedItemsList(); @@ -502,7 +502,7 @@ Bool OverlordContain::isEnclosingContainerFor( const Object *obj ) const Bool OverlordContain::isDisplayedOnControlBar() const { // Do you mean me the Overlord, or my behavior of passing stuff on to my passengers? - if( getRedirectedContain() == NULL ) + if( getRedirectedContain() == nullptr ) return FALSE;//No need to call up inheritance, this is a module based question, and I say no. return getRedirectedContain()->isDisplayedOnControlBar(); @@ -519,7 +519,7 @@ const Object *OverlordContain::friend_getRider() const return m_containList.front(); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -573,7 +573,7 @@ Bool OverlordContain::isPassengerAllowedToFire( ObjectID id ) const { Object *passenger = TheGameLogic->findObjectByID(id); - if(passenger != NULL) + if(passenger != nullptr) { //only allow infantry, and turrets and such. no vehicles. if(passenger->isKindOf(KINDOF_INFANTRY) == FALSE && passenger->isKindOf(KINDOF_PORTABLE_STRUCTURE) == FALSE) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index f7dbe009737..f7aa9b345eb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -72,14 +72,14 @@ void ParachuteContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "PitchRateMax", INI::parseAngularVelocityReal, NULL, offsetof( ParachuteContainModuleData, m_pitchRateMax ) }, - { "RollRateMax", INI::parseAngularVelocityReal, NULL, offsetof( ParachuteContainModuleData, m_rollRateMax ) }, - { "LowAltitudeDamping", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_lowAltitudeDamping ) }, - { "ParachuteOpenDist", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_paraOpenDist ) }, - { "KillWhenLandingInWaterSlop", INI::parseReal, NULL, offsetof( ParachuteContainModuleData, m_killWhenLandingInWaterSlop ) }, - { "FreeFallDamagePercent", INI::parsePercentToReal, NULL, offsetof( ParachuteContainModuleData, m_freeFallDamagePercent ) }, - { "ParachuteOpenSound", INI::parseAudioEventRTS, NULL, offsetof( ParachuteContainModuleData, m_parachuteOpenSound ) }, - { 0, 0, 0, 0 } + { "PitchRateMax", INI::parseAngularVelocityReal, nullptr, offsetof( ParachuteContainModuleData, m_pitchRateMax ) }, + { "RollRateMax", INI::parseAngularVelocityReal, nullptr, offsetof( ParachuteContainModuleData, m_rollRateMax ) }, + { "LowAltitudeDamping", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_lowAltitudeDamping ) }, + { "ParachuteOpenDist", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_paraOpenDist ) }, + { "KillWhenLandingInWaterSlop", INI::parseReal, nullptr, offsetof( ParachuteContainModuleData, m_killWhenLandingInWaterSlop ) }, + { "FreeFallDamagePercent", INI::parsePercentToReal, nullptr, offsetof( ParachuteContainModuleData, m_freeFallDamagePercent ) }, + { "ParachuteOpenSound", INI::parseAudioEventRTS, nullptr, offsetof( ParachuteContainModuleData, m_parachuteOpenSound ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -158,13 +158,13 @@ void ParachuteContain::updateBonePositions() Drawable* parachuteDraw = getObject()->getDrawable(); if (parachuteDraw) { - if (parachuteDraw->getPristineBonePositions( "PARA_COG", 0, &m_paraSwayBone, NULL, 1) != 1) + if (parachuteDraw->getPristineBonePositions( "PARA_COG", 0, &m_paraSwayBone, nullptr, 1) != 1) { DEBUG_CRASH(("PARA_COG not found")); m_paraSwayBone.zero(); } - if (parachuteDraw->getPristineBonePositions( "PARA_ATTCH", 0, &m_paraAttachBone, NULL, 1 ) != 1) + if (parachuteDraw->getPristineBonePositions( "PARA_ATTCH", 0, &m_paraAttachBone, nullptr, 1 ) != 1) { DEBUG_CRASH(("PARA_ATTCH not found")); m_paraAttachBone.zero(); @@ -178,11 +178,11 @@ void ParachuteContain::updateBonePositions() m_needToUpdateRiderBones = false; // yeah, even if not found. - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; - Drawable* riderDraw = rider ? rider->getDrawable() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; + Drawable* riderDraw = rider ? rider->getDrawable() : nullptr; if (riderDraw) { - if (riderDraw->getPristineBonePositions( "PARA_MAN", 0, &m_riderAttachBone, NULL, 1) != 1) + if (riderDraw->getPristineBonePositions( "PARA_MAN", 0, &m_riderAttachBone, nullptr, 1) != 1) { //DEBUG_LOG(("*** No parachute-attach bone... using object height!")); m_riderAttachBone.zero(); @@ -199,22 +199,22 @@ void ParachuteContain::updateOffsetsFromBones() { const Coord3D* objPos = getObject()->getPosition(); - getObject()->convertBonePosToWorldPos(&m_paraSwayBone, NULL, &m_paraSwayOffset, NULL); + getObject()->convertBonePosToWorldPos(&m_paraSwayBone, nullptr, &m_paraSwayOffset, nullptr); m_paraSwayOffset.x -= objPos->x; m_paraSwayOffset.y -= objPos->y; m_paraSwayOffset.z -= objPos->z; - getObject()->convertBonePosToWorldPos(&m_paraAttachBone, NULL, &m_paraAttachOffset, NULL); + getObject()->convertBonePosToWorldPos(&m_paraAttachBone, nullptr, &m_paraAttachOffset, nullptr); m_paraAttachOffset.x -= objPos->x; m_paraAttachOffset.y -= objPos->y; m_paraAttachOffset.z -= objPos->z; - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (rider) { const Coord3D* riderPos = rider->getPosition(); - rider->convertBonePosToWorldPos(&m_riderAttachBone, NULL, &m_riderAttachOffset, NULL); + rider->convertBonePosToWorldPos(&m_riderAttachBone, nullptr, &m_riderAttachOffset, nullptr); m_riderAttachOffset.x -= riderPos->x; m_riderAttachOffset.y -= riderPos->y; m_riderAttachOffset.z -= riderPos->z; @@ -288,7 +288,7 @@ UpdateSleepTime ParachuteContain::update( void ) Drawable* draw = parachute->getDrawable(); const ParachuteContainModuleData* d = getParachuteContainModuleData(); - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (m_startZ == NO_START_Z) { m_startZ = parachute->getPosition()->z; @@ -336,7 +336,7 @@ UpdateSleepTime ParachuteContain::update( void ) FindPositionOptions fpOptions; fpOptions.minRadius = 0.0f; fpOptions.maxRadius = 100.0f; - fpOptions.relationshipObject = NULL; + fpOptions.relationshipObject = nullptr; fpOptions.flags = FPF_NONE; ThePartitionManager->findPositionAround( &target, &fpOptions, &target ); } @@ -608,7 +608,7 @@ void ParachuteContain::positionRider(Object* rider) } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } } @@ -636,7 +636,7 @@ void ParachuteContain::onDie( const DamageInfo * damageInfo ) // if we are airborne when killed, the guy falls screaming to his death... if (getObject()->isSignificantlyAboveTerrain()) { - Object* rider = (getContainCount() > 0) ? getContainList().front() : NULL; + Object* rider = (getContainCount() > 0) ? getContainList().front() : nullptr; if (rider) { removeAllContained(); @@ -674,10 +674,10 @@ void ParachuteContain::onDie( const DamageInfo * damageInfo ) void ParachuteContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { // Note that other == null means "collide with ground" - if( other == NULL ) + if( other == nullptr ) { // if we're in a container (eg, a transport plane), just ignore this... - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return; removeAllContained(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp index aca71d6d8b6..3236397d098 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RailedTransportContain.cpp @@ -40,13 +40,13 @@ static RailedTransportDockUpdateInterface *getRailedTransportDockUpdateInterface { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; // find us our dock interface - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = obj->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; return rtdui; @@ -109,7 +109,7 @@ void RailedTransportContain::exitObjectViaDoor( Object *newObj, ExitDoorType exi { RailedTransportDockUpdateInterface *rtdui = getRailedTransportDockUpdateInterface(); - if( rtdui == NULL ) + if( rtdui == nullptr ) return; // tell the railed dock to exit ONE object, this one diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp index 563071c09d9..218b10a3bd6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp @@ -99,17 +99,17 @@ void RiderChangeContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Rider1", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[0] ) }, - { "Rider2", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[1] ) }, - { "Rider3", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[2] ) }, - { "Rider4", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[3] ) }, - { "Rider5", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[4] ) }, - { "Rider6", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[5] ) }, - { "Rider7", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[6] ) }, - { "Rider8", parseRiderInfo, NULL, offsetof( RiderChangeContainModuleData, m_riders[7] ) }, - { "ScuttleDelay", INI::parseDurationUnsignedInt, NULL, offsetof( RiderChangeContainModuleData, m_scuttleFrames ) }, + { "Rider1", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[0] ) }, + { "Rider2", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[1] ) }, + { "Rider3", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[2] ) }, + { "Rider4", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[3] ) }, + { "Rider5", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[4] ) }, + { "Rider6", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[5] ) }, + { "Rider7", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[6] ) }, + { "Rider8", parseRiderInfo, nullptr, offsetof( RiderChangeContainModuleData, m_riders[7] ) }, + { "ScuttleDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( RiderChangeContainModuleData, m_scuttleFrames ) }, { "ScuttleStatus", INI::parseIndexList, ModelConditionFlags::getBitNames(), offsetof( RiderChangeContainModuleData, m_scuttleState ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -298,7 +298,7 @@ void RiderChangeContain::onRemoving( Object *rider ) //Also clear the object status bike->clearStatus( MAKE_OBJECT_STATUS_MASK( data->m_riders[ i ].m_objectStatusType ) ); - if( rider->getControllingPlayer() != NULL ) + if( rider->getControllingPlayer() != nullptr ) { //Wow, completely unforseeable game teardown order crash. SetVeterancyLevel results in a call to player //about upgrade masks. So if we have a null player, it is game teardown, so don't worry about transfering exp. @@ -440,7 +440,7 @@ const Object *RiderChangeContain::friend_getRider() const if( m_containListSize > 0 ) // Yes, this does assume that infantry never ride double on the bike return m_containList.front(); - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index e024d449da9..b4cf8b7b980 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -95,22 +95,22 @@ void TransportContainModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Slots", INI::parseInt, NULL, offsetof( TransportContainModuleData, m_slotCapacity ) }, - { "ScatterNearbyOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_scatterNearbyOnExit ) }, - { "OrientLikeContainerOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_orientLikeContainerOnExit ) }, - { "KeepContainerVelocityOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_keepContainerVelocityOnExit ) }, - { "GoAggressiveOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_goAggressiveOnExit ) }, - { "ResetMoodCheckTimeOnExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_resetMoodCheckTimeOnExit ) }, - { "DestroyRidersWhoAreNotFreeToExit", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_destroyRidersWhoAreNotFreeToExit ) }, - { "ExitBone", INI::parseAsciiString, NULL, offsetof( TransportContainModuleData, m_exitBone ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal, NULL, offsetof( TransportContainModuleData, m_exitPitchRate ) }, - { "InitialPayload", parseInitialPayload, NULL, 0 }, - { "HealthRegen%PerSec", INI::parseReal, NULL, offsetof( TransportContainModuleData, m_healthRegen ) }, - { "ExitDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TransportContainModuleData, m_exitDelay ) }, - { "ArmedRidersUpgradeMyWeaponSet", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_armedRidersUpgradeWeaponSet ) }, - { "DelayExitInAir", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_isDelayExitInAir ) }, - - { 0, 0, 0, 0 } + { "Slots", INI::parseInt, nullptr, offsetof( TransportContainModuleData, m_slotCapacity ) }, + { "ScatterNearbyOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_scatterNearbyOnExit ) }, + { "OrientLikeContainerOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_orientLikeContainerOnExit ) }, + { "KeepContainerVelocityOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_keepContainerVelocityOnExit ) }, + { "GoAggressiveOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_goAggressiveOnExit ) }, + { "ResetMoodCheckTimeOnExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_resetMoodCheckTimeOnExit ) }, + { "DestroyRidersWhoAreNotFreeToExit", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_destroyRidersWhoAreNotFreeToExit ) }, + { "ExitBone", INI::parseAsciiString, nullptr, offsetof( TransportContainModuleData, m_exitBone ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal, nullptr, offsetof( TransportContainModuleData, m_exitPitchRate ) }, + { "InitialPayload", parseInitialPayload, nullptr, 0 }, + { "HealthRegen%PerSec", INI::parseReal, nullptr, offsetof( TransportContainModuleData, m_healthRegen ) }, + { "ExitDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( TransportContainModuleData, m_exitDelay ) }, + { "ArmedRidersUpgradeMyWeaponSet", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_armedRidersUpgradeWeaponSet ) }, + { "DelayExitInAir", INI::parseBool, nullptr, offsetof( TransportContainModuleData, m_isDelayExitInAir ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -224,7 +224,7 @@ void TransportContain::letRidersUpgradeWeaponSet( void ) return; Object *self = getObject(); - if ( self == NULL ) + if ( self == nullptr ) return; Bool anyRiderHasViableWeapon = FALSE; @@ -246,7 +246,7 @@ void TransportContain::letRidersUpgradeWeaponSet( void ) { if(rider->isKindOf(KINDOF_INFANTRY) == false) continue; - Weapon *weapon = NULL; + Weapon *weapon = nullptr; for ( Int w = PRIMARY_WEAPON; w < WEAPONSLOT_COUNT; ++ w ) { weapon = rider->getWeaponInWeaponSlot( (WeaponSlotType)w ); @@ -337,9 +337,9 @@ void TransportContain::onRemoving( Object *rider ) if (draw) { Coord3D bonePos, worldPos; - if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, NULL, 1) == 1) + if (draw->getPristineBonePositions(d->m_exitBone.str(), 0, &bonePos, nullptr, 1) == 1) { - getObject()->convertBonePosToWorldPos(&bonePos, NULL, &worldPos, NULL); + getObject()->convertBonePosToWorldPos(&bonePos, nullptr, &worldPos, nullptr); rider->setPosition(&worldPos); } } @@ -549,7 +549,7 @@ void TransportContain::killRidersWhoAreNotFreeToExit() // ------------------------------------------------------------------------------------------------ Bool TransportContain::isSpecificRiderFreeToExit(Object* specificObject) { - if( specificObject == NULL ) + if( specificObject == nullptr ) return TRUE; // I can, in general, exit people. // This is a override, not an extend. I will check for game legality for @@ -585,7 +585,7 @@ Bool TransportContain::isPassengerAllowedToFire( ObjectID id ) const { Object *passenger = TheGameLogic->findObjectByID(id); - if( passenger != NULL ) + if( passenger != nullptr ) { //only allow infantry, and turrets and such. no vehicles. if( passenger->isKindOf(KINDOF_INFANTRY) == FALSE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 1f998a53ff4..b822682febd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -81,7 +81,7 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // trigger an onRemoving event for 'm_object' no longer containing 'itemToRemove->m_object' @@ -98,7 +98,7 @@ void TunnelContain::removeFromContain( Object *obj, Bool exposeStealthUnits ) // it is actually contained by this module // Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; //game tear down. We do the onRemove* stuff first because this is allowed to fail but that still needs to be done if(!owningPlayer->getTunnelSystem()) @@ -169,7 +169,7 @@ void TunnelContain::killAllContained( void ) while ( it != list.end() ) { Object *obj = *it++; - DEBUG_ASSERTCRASH( obj, ("Contain list must not contain NULL element")); + DEBUG_ASSERTCRASH( obj, ("Contain list must not contain null element")); removeFromContain( obj, true ); @@ -194,7 +194,7 @@ void TunnelContain::removeAllContained( Bool exposeStealthUnits ) while ( it != list.end() ) { Object *obj = *it++; - DEBUG_ASSERTCRASH( obj, ("Contain list must not contain NULL element")); + DEBUG_ASSERTCRASH( obj, ("Contain list must not contain null element")); removeFromContain( obj, exposeStealthUnits ); } @@ -263,10 +263,10 @@ void TunnelContain::onSelling() { // A TunnelContain tells everyone to leave if this is the last tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; // We are the last tunnel, so kick everyone out. This makes tunnels act like Palace and Bunker @@ -322,7 +322,7 @@ const ContainedItemsList* TunnelContain::getContainedItemsList() const { return owningPlayer->getTunnelSystem()->getContainedItemsList(); } - return NULL; + return nullptr; } UnsignedInt TunnelContain::getFullTimeForHeal(void) const @@ -400,10 +400,10 @@ void TunnelContain::onDie( const DamageInfo * damageInfo ) return;//it isn't registered as a tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelDestroyed( getObject() ); @@ -419,10 +419,10 @@ void TunnelContain::onDelete( void ) return;//it isn't registered as a tunnel Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelDestroyed( getObject() ); @@ -445,10 +445,10 @@ void TunnelContain::onObjectCreated() m_needToRunOnBuildComplete = false; Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelCreated( getObject() ); @@ -467,10 +467,10 @@ void TunnelContain::onBuildComplete( void ) m_needToRunOnBuildComplete = false; Player *owningPlayer = getObject()->getControllingPlayer(); - if( owningPlayer == NULL ) + if( owningPlayer == nullptr ) return; TunnelTracker *tunnelTracker = owningPlayer->getTunnelSystem(); - if( tunnelTracker == NULL ) + if( tunnelTracker == nullptr ) return; tunnelTracker->onTunnelCreated( getObject() ); @@ -531,7 +531,7 @@ UpdateSleepTime TunnelContain::update( void ) OpenContain::update(); Object *obj = getObject(); - Player *controllingPlayer = NULL; + Player *controllingPlayer = nullptr; if (obj) { controllingPlayer = obj->getControllingPlayer(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index 2c4e347f274..9c566821e6c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -51,9 +51,9 @@ void GrantUpgradeCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "UpgradeToGrant", INI::parseAsciiString, NULL, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, - { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, - { 0, 0, 0, 0 } + { "UpgradeToGrant", INI::parseAsciiString, nullptr, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, + { "ExemptStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp index 391f07d0b23..a64431636d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/LockWeaponCreate.cpp @@ -52,7 +52,7 @@ void LockWeaponCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { { "SlotToLock", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( LockWeaponCreateModuleData, m_slotToLock ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp index 6100a0824da..9e53fced135 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyCenterCreate.cpp @@ -63,16 +63,16 @@ void SupplyCenterCreate::onBuildComplete( void ) CreateModule::onBuildComplete(); // extend - if( ThePlayerList == NULL ) + if( ThePlayerList == nullptr ) return; for( Int playerIndex = ThePlayerList->getPlayerCount() - 1; playerIndex >= 0; playerIndex-- ) { Player *currentPlayer = ThePlayerList->getNthPlayer( playerIndex ); - if( currentPlayer == NULL ) + if( currentPlayer == nullptr ) continue; ResourceGatheringManager *manager = currentPlayer->getResourceGatheringManager(); - if( manager == NULL ) + if( manager == nullptr ) continue; manager->addSupplyCenter( getObject() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp index bfcb644e3e5..f482cfa7acd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/SupplyWarehouseCreate.cpp @@ -54,16 +54,16 @@ SupplyWarehouseCreate::~SupplyWarehouseCreate( void ) void SupplyWarehouseCreate::onCreate( void ) { // Warehouses are never Built. - if( ThePlayerList == NULL ) + if( ThePlayerList == nullptr ) return; for( Int playerIndex = ThePlayerList->getPlayerCount() - 1; playerIndex >= 0; playerIndex-- ) { Player *currentPlayer = ThePlayerList->getNthPlayer( playerIndex ); - if( currentPlayer == NULL ) + if( currentPlayer == nullptr ) continue; ResourceGatheringManager *manager = currentPlayer->getResourceGatheringManager(); - if( manager == NULL ) + if( manager == nullptr ) continue; manager->addSupplyWarehouse( getObject() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp index 9ebe0753568..bf0d13f57a7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp @@ -54,8 +54,8 @@ void VeterancyGainCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { { "StartingLevel", INI::parseIndexList, TheVeterancyNames, offsetof( VeterancyGainCreateModuleData, m_startingLevel ) }, - { "ScienceRequired", INI::parseScience, NULL, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) }, - { 0, 0, 0, 0 } + { "ScienceRequired", INI::parseScience, nullptr, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp index f6da3866e17..378ccba8f02 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/BoneFXDamage.cpp @@ -56,9 +56,9 @@ void BoneFXDamage::onObjectCreated() { static NameKeyType key_BoneFXUpdate = NAMEKEY("BoneFXUpdate"); BoneFXUpdate* bfxu = (BoneFXUpdate*)getObject()->findUpdateModule(key_BoneFXUpdate); - if (bfxu == NULL) + if (bfxu == nullptr) { - DEBUG_ASSERTCRASH(bfxu != NULL, ("BoneFXDamage requires BoneFXUpdate")); + DEBUG_ASSERTCRASH(bfxu != nullptr, ("BoneFXDamage requires BoneFXUpdate")); throw INI_INVALID_DATA; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 62082147f25..973265963db 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -50,19 +50,19 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) for( j = 0; j < DAMAGE_MODULE_MAX_FX; j++ ) { - m_fxList[ i ][ j ].fx = NULL; + m_fxList[ i ][ j ].fx = nullptr; m_fxList[ i ][ j ].locInfo.loc.x = 0.0f; m_fxList[ i ][ j ].locInfo.loc.y = 0.0f; m_fxList[ i ][ j ].locInfo.loc.z = 0.0f; m_fxList[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_fxList[ i ][ j ].locInfo.randomBone = FALSE; - m_OCL[ i ][ j ].ocl = NULL; + m_OCL[ i ][ j ].ocl = nullptr; m_OCL[ i ][ j ].locInfo.loc.x = 0.0f; m_OCL[ i ][ j ].locInfo.loc.y = 0.0f; m_OCL[ i ][ j ].locInfo.loc.z = 0.0f; m_OCL[ i ][ j ].locInfo.locType = FX_DAMAGE_LOC_TYPE_COORD; m_OCL[ i ][ j ].locInfo.randomBone = FALSE; - m_particleSystem[ i ][ j ].particleSysTemplate = NULL; + m_particleSystem[ i ][ j ].particleSysTemplate = nullptr; m_particleSystem[ i ][ j ].locInfo.loc.x = 0.0f; m_particleSystem[ i ][ j ].locInfo.loc.y = 0.0f; m_particleSystem[ i ][ j ].locInfo.loc.z = 0.0f; @@ -111,7 +111,7 @@ static void parseFXLocInfo( INI *ini, void *instance, FXLocInfo *locInfo ) } // parse the Bool definition - ini->parseBool( ini, instance, &locInfo->randomBone, NULL ); + ini->parseBool( ini, instance, &locInfo->randomBone, nullptr ); } else if( stricmp( token, "loc" ) == 0 ) @@ -158,7 +158,7 @@ void TransitionDamageFXModuleData::parseFXList( INI *ini, void *instance, } // parse the fx list name - ini->parseFXList( ini, instance, &info->fx, NULL ); + ini->parseFXList( ini, instance, &info->fx, nullptr ); } @@ -259,7 +259,7 @@ void TransitionDamageFX::onDelete( void ) static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) { - DEBUG_ASSERTCRASH( locInfo, ("getLocalEffectPos: locInfo is NULL") ); + DEBUG_ASSERTCRASH( locInfo, ("getLocalEffectPos: locInfo is null") ); if( locInfo->locType == FX_DAMAGE_LOC_TYPE_BONE && draw ) { @@ -269,7 +269,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) Coord3D pos; // get the bone position - Int count = draw->getPristineBonePositions( locInfo->boneName.str(), 0, &pos, NULL, 1 ); + Int count = draw->getPristineBonePositions( locInfo->boneName.str(), 0, &pos, nullptr, 1 ); // sanity, if bone not found revert back to location defined in struct (which is 0,0,0) if( count == 0 ) @@ -286,7 +286,7 @@ static Coord3D getLocalEffectPos( const FXLocInfo *locInfo, Drawable *draw ) // get the bone positions Int boneCount; - boneCount = draw->getPristineBonePositions( locInfo->boneName.str(), 1, positions, NULL, MAX_BONES ); + boneCount = draw->getPristineBonePositions( locInfo->boneName.str(), 1, positions, nullptr, MAX_BONES ); // sanity, if bone not found revert back to location defined in struct (which is 0,0,0) if( boneCount == 0 ) @@ -311,7 +311,7 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState ) { - Object *damageSource = NULL; + Object *damageSource = nullptr; Int i; Drawable *draw = getObject()->getDrawable(); const TransitionDamageFXModuleData *modData = getTransitionDamageFXModuleData(); @@ -353,12 +353,12 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( modData->m_fxList[ newState ][ i ].fx ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) { pos = getLocalEffectPos( &modData->m_fxList[ newState ][ i ].locInfo, draw ); - getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + getObject()->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); FXList::doFXPos( modData->m_fxList[ newState ][ i ].fx, &pos ); } @@ -369,12 +369,12 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( damageSource && modData->m_OCL[ newState ][ i ].ocl ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageOCLTypes, lastDamageInfo->in.m_damageType ) ) { pos = getLocalEffectPos( &modData->m_OCL[ newState ][ i ].locInfo, draw ); - getObject()->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + getObject()->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); ObjectCreationList::create( modData->m_OCL[ newState ][ i ].ocl, getObject(), &pos, damageSource->getPosition(), INVALID_ANGLE ); @@ -387,7 +387,7 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( pSystemT ) { - if( lastDamageInfo == NULL || + if( lastDamageInfo == nullptr || getDamageTypeFlag( modData->m_damageParticleTypes, lastDamageInfo->in.m_damageType ) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp index de3a54c8c2d..a915a89e158 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp @@ -72,7 +72,7 @@ void CreateCrateDie::onDie( const DamageInfo * damageInfo ) if (!isDieApplicable(damageInfo)) return; - CrateTemplate const *currentCrateData = NULL; + CrateTemplate const *currentCrateData = nullptr; Object *killer = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); Object *me = getObject(); @@ -144,7 +144,7 @@ Bool CreateCrateDie::testVeterancyLevel( CrateTemplate const *currentCrateData ) Bool CreateCrateDie::testKillerType( CrateTemplate const *currentCrateData, Object *killer ) { - if( killer == NULL ) + if( killer == nullptr ) return FALSE; // Must match the whole group of bits set in the KilledBy description (most likely One). @@ -156,13 +156,13 @@ Bool CreateCrateDie::testKillerType( CrateTemplate const *currentCrateData, Obje Bool CreateCrateDie::testKillerScience( CrateTemplate const *currentCrateData, Object *killer ) { - if( killer == NULL ) + if( killer == nullptr ) return FALSE; // killer's player must have the listed science Player *killerPlayer = killer->getControllingPlayer(); - if( killerPlayer == NULL ) + if( killerPlayer == nullptr ) return FALSE; if( ! killerPlayer->hasScience( currentCrateData->m_killerScience ) ) @@ -198,8 +198,8 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) // At this point, I could very well have a "" for the type, if the Designer didn't make the sum of chances 1 ThingTemplate const *crateType = TheThingFactory->findTemplate( crateName ); - if( crateType == NULL ) - return NULL; + if( crateType == nullptr ) + return nullptr; Bool spotFound = FALSE; Coord3D creationPoint; @@ -222,7 +222,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) // of the large dead thing (building rubble) fpOptions.minRadius = 0.0f; fpOptions.maxRadius = 125.0f; - fpOptions.relationshipObject = NULL; + fpOptions.relationshipObject = nullptr; fpOptions.flags = FPF_NONE; if( ThePartitionManager->findPositionAround( ¢erPoint, &fpOptions, &creationPoint ) ) { @@ -232,7 +232,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) if( spotFound ) { - Object *newCrate = TheThingFactory->newObject( crateType, NULL ); + Object *newCrate = TheThingFactory->newObject( crateType, nullptr ); newCrate->setPosition( &creationPoint ); newCrate->setOrientation( GameLogicRandomValueReal( 0, 2*PI ) ); newCrate->setLayer(layer); @@ -249,7 +249,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData ) return newCrate; } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp index 19db01c59b6..a7c67f237f1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateObjectDie.cpp @@ -45,7 +45,7 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() { - m_ocl = NULL; + m_ocl = nullptr; m_transferPreviousHealth = FALSE; m_transferSelection = FALSE; } @@ -58,10 +58,10 @@ CreateObjectDieModuleData::CreateObjectDieModuleData() static const FieldParse dataFieldParse[] = { - { "CreationList", INI::parseObjectCreationList, NULL, offsetof( CreateObjectDieModuleData, m_ocl ) }, - { "TransferPreviousHealth", INI::parseBool, NULL ,offsetof( CreateObjectDieModuleData, m_transferPreviousHealth ) }, - { "TransferSelection", INI::parseBool, NULL, offsetof( CreateObjectDieModuleData, m_transferSelection ) }, - { 0, 0, 0, 0 } + { "CreationList", INI::parseObjectCreationList, nullptr, offsetof( CreateObjectDieModuleData, m_ocl ) }, + { "TransferPreviousHealth", INI::parseBool, nullptr ,offsetof( CreateObjectDieModuleData, m_transferPreviousHealth ) }, + { "TransferSelection", INI::parseBool, nullptr, offsetof( CreateObjectDieModuleData, m_transferSelection ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp index 2bb5cf33b06..e6eb157529e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CrushDie.cpp @@ -48,7 +48,7 @@ // Figure out which crush point was hit so the correct crushed object can be swapped in static CrushEnum crushLocationCheck( Object* crusherObject, Object* victimObject ) { - if( (crusherObject == NULL) || (victimObject == NULL) ) + if( (crusherObject == nullptr) || (victimObject == nullptr) ) return NO_CRUSH; Bool frontCrushed = victimObject->getBodyModule()->getFrontCrushed(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp index adbd99e57f2..7ac20be6429 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DieModule.cpp @@ -53,11 +53,11 @@ const FieldParse* DieMuxData::getFieldParse() { static const FieldParse dataFieldParse[] = { - { "DeathTypes", INI::parseDeathTypeFlags, NULL, offsetof( DieMuxData, m_deathTypes ) }, - { "VeterancyLevels", INI::parseVeterancyLevelFlags, NULL, offsetof( DieMuxData, m_veterancyLevels ) }, - { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( DieMuxData, m_exemptStatus ) }, - { "RequiredStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( DieMuxData, m_requiredStatus ) }, - { 0, 0, 0, 0 } + { "DeathTypes", INI::parseDeathTypeFlags, nullptr, offsetof( DieMuxData, m_deathTypes ) }, + { "VeterancyLevels", INI::parseVeterancyLevelFlags, nullptr, offsetof( DieMuxData, m_veterancyLevels ) }, + { "ExemptStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( DieMuxData, m_exemptStatus ) }, + { "RequiredStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( DieMuxData, m_requiredStatus ) }, + { nullptr, nullptr, nullptr, 0 } }; return dataFieldParse; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp index 0e742370673..5b993f45020 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/EjectPilotDie.cpp @@ -43,8 +43,8 @@ //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- EjectPilotDieModuleData::EjectPilotDieModuleData() : - m_oclInAir(NULL), - m_oclOnGround(NULL), + m_oclInAir(nullptr), + m_oclOnGround(nullptr), m_invulnerableTime(0) { } @@ -57,11 +57,11 @@ void EjectPilotDieModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AirCreationList", INI::parseObjectCreationList, NULL, offsetof( EjectPilotDieModuleData, m_oclInAir ) }, - { "GroundCreationList", INI::parseObjectCreationList, NULL, offsetof( EjectPilotDieModuleData, m_oclOnGround ) }, - { "InvulnerableTime", INI::parseDurationUnsignedInt, NULL, offsetof(EjectPilotDieModuleData, m_invulnerableTime ) }, + { "AirCreationList", INI::parseObjectCreationList, nullptr, offsetof( EjectPilotDieModuleData, m_oclInAir ) }, + { "GroundCreationList", INI::parseObjectCreationList, nullptr, offsetof( EjectPilotDieModuleData, m_oclOnGround ) }, + { "InvulnerableTime", INI::parseDurationUnsignedInt, nullptr, offsetof(EjectPilotDieModuleData, m_invulnerableTime ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp index 819d7451d3d..7649ade54f0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp @@ -64,10 +64,10 @@ RebuildHoleExposeDieModuleData::RebuildHoleExposeDieModuleData() static const FieldParse dataFieldParse[] = { - { "HoleName", INI::parseAsciiString, NULL, offsetof( RebuildHoleExposeDieModuleData, m_holeName ) }, - { "HoleMaxHealth", INI::parseReal, NULL, offsetof( RebuildHoleExposeDieModuleData, m_holeMaxHealth ) }, - { "TransferAttackers", INI::parseBool, NULL, offsetof( RebuildHoleExposeDieModuleData, m_transferAttackers ) }, - { 0, 0, 0, 0 } + { "HoleName", INI::parseAsciiString, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_holeName ) }, + { "HoleMaxHealth", INI::parseReal, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_holeMaxHealth ) }, + { "TransferAttackers", INI::parseBool, nullptr, offsetof( RebuildHoleExposeDieModuleData, m_transferAttackers ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp index 61969926d65..361c1b9b27d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp @@ -66,7 +66,7 @@ FiringTracker::~FiringTracker() //------------------------------------------------------------------------------------------------- Int FiringTracker::getNumConsecutiveShotsAtVictim( const Object *victim ) const { - if( victim == NULL ) + if( victim == nullptr ) return 0;// safety, this function is for asking about shots at a victim if( victim->getID() != m_victimID ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp index 7c8dd524d64..d9bc1b5f924 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/GhostObject.cpp @@ -34,7 +34,7 @@ #include "GameLogic/GhostObject.h" #include "GameLogic/Object.h" -GhostObjectManager *TheGhostObjectManager = NULL; +GhostObjectManager *TheGhostObjectManager = nullptr; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -46,8 +46,8 @@ m_parentAngle(0.0f), m_parentGeometryIsSmall(true), m_parentGeometryMajorRadius(0.0f), m_parentGeometryminorRadius(0.0f), -m_parentObject(NULL), -m_partitionData(NULL) +m_parentObject(nullptr), +m_partitionData(nullptr) { m_parentPosition.zero(); } @@ -88,7 +88,7 @@ void GhostObject::xfer( Xfer *xfer ) m_parentObject = TheGameLogic->findObjectByID( parentObjectID ); // sanity - if( parentObjectID != INVALID_ID && m_parentObject == NULL ) + if( parentObjectID != INVALID_ID && m_parentObject == nullptr ) { DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject" )); throw INI_INVALID_DATA; @@ -152,7 +152,7 @@ void GhostObjectManager::reset(void) // ------------------------------------------------------------------------------------------------ GhostObject *GhostObjectManager::addGhostObject(Object *object, PartitionData *pd) { - return 0; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 9b2a9bba467..90d9494945f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -55,7 +55,7 @@ static const Real DONUT_DISTANCE=4.0*PATHFIND_CELL_SIZE_F; /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -LocomotorStore *TheLocomotorStore = NULL; ///< the Locomotor store definition +LocomotorStore *TheLocomotorStore = nullptr; ///< the Locomotor store definition const Real BIGNUM = 99999.0f; @@ -65,7 +65,7 @@ static const char *const TheLocomotorPriorityNames[] = "MOVES_MIDDLE", "MOVES_FRONT", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheLocomotorPriorityNames) == LOCOMOTOR_PRIORITY_COUNT + 1, "Array size"); @@ -438,69 +438,69 @@ const FieldParse* LocomotorTemplate::getFieldParse() const static const FieldParse TheFieldParse[] = { { "Surfaces", INI::parseBitString32, TheLocomotorSurfaceTypeNames, offsetof(LocomotorTemplate, m_surfaces) }, - { "Speed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_maxSpeed) }, - { "SpeedDamaged", INI::parseVelocityReal, NULL, offsetof( LocomotorTemplate, m_maxSpeedDamaged ) }, - { "TurnRate", INI::parseAngularVelocityReal, NULL, offsetof(LocomotorTemplate, m_maxTurnRate) }, - { "TurnRateDamaged", INI::parseAngularVelocityReal, NULL, offsetof( LocomotorTemplate, m_maxTurnRateDamaged ) }, - { "Acceleration", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_acceleration) }, - { "AccelerationDamaged", INI::parseAccelerationReal, NULL, offsetof( LocomotorTemplate, m_accelerationDamaged ) }, - { "Lift", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_lift) }, - { "LiftDamaged", INI::parseAccelerationReal, NULL, offsetof( LocomotorTemplate, m_liftDamaged ) }, - { "Braking", INI::parseAccelerationReal, NULL, offsetof(LocomotorTemplate, m_braking) }, - { "MinSpeed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_minSpeed) }, - { "MinTurnSpeed", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_minTurnSpeed) }, - { "PreferredHeight", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_preferredHeight) }, - { "PreferredHeightDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_preferredHeightDamping) }, - { "CirclingRadius", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_circlingRadius) }, - { "Extra2DFriction", parseFrictionPerSec, NULL, offsetof(LocomotorTemplate, m_extra2DFriction) }, - { "SpeedLimitZ", INI::parseVelocityReal, NULL, offsetof(LocomotorTemplate, m_speedLimitZ) }, - { "MaxThrustAngle", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_maxThrustAngle) }, // yes, angle, not angular-vel + { "Speed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_maxSpeed) }, + { "SpeedDamaged", INI::parseVelocityReal, nullptr, offsetof( LocomotorTemplate, m_maxSpeedDamaged ) }, + { "TurnRate", INI::parseAngularVelocityReal, nullptr, offsetof(LocomotorTemplate, m_maxTurnRate) }, + { "TurnRateDamaged", INI::parseAngularVelocityReal, nullptr, offsetof( LocomotorTemplate, m_maxTurnRateDamaged ) }, + { "Acceleration", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_acceleration) }, + { "AccelerationDamaged", INI::parseAccelerationReal, nullptr, offsetof( LocomotorTemplate, m_accelerationDamaged ) }, + { "Lift", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_lift) }, + { "LiftDamaged", INI::parseAccelerationReal, nullptr, offsetof( LocomotorTemplate, m_liftDamaged ) }, + { "Braking", INI::parseAccelerationReal, nullptr, offsetof(LocomotorTemplate, m_braking) }, + { "MinSpeed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_minSpeed) }, + { "MinTurnSpeed", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_minTurnSpeed) }, + { "PreferredHeight", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_preferredHeight) }, + { "PreferredHeightDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_preferredHeightDamping) }, + { "CirclingRadius", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_circlingRadius) }, + { "Extra2DFriction", parseFrictionPerSec, nullptr, offsetof(LocomotorTemplate, m_extra2DFriction) }, + { "SpeedLimitZ", INI::parseVelocityReal, nullptr, offsetof(LocomotorTemplate, m_speedLimitZ) }, + { "MaxThrustAngle", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_maxThrustAngle) }, // yes, angle, not angular-vel { "ZAxisBehavior", INI::parseIndexList, TheLocomotorBehaviorZNames, offsetof(LocomotorTemplate, m_behaviorZ) }, { "Appearance", INI::parseIndexList, TheLocomotorAppearanceNames, offsetof(LocomotorTemplate, m_appearance) }, \ { "GroupMovementPriority", INI::parseIndexList, TheLocomotorPriorityNames, offsetof(LocomotorTemplate, m_movePriority) }, \ - { "AccelerationPitchLimit", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_accelPitchLimit) }, - { "DecelerationPitchLimit", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_decelPitchLimit) }, - { "BounceAmount", INI::parseAngularVelocityReal, NULL, offsetof(LocomotorTemplate, m_bounceKick) }, - { "PitchStiffness", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchStiffness) }, - { "RollStiffness", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rollStiffness) }, - { "PitchDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchDamping) }, - { "RollDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rollDamping) }, - { "ThrustRoll", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_thrustRoll) }, - { "ThrustWobbleRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wobbleRate) }, - { "ThrustMinWobble", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_minWobble) }, - { "ThrustMaxWobble", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maxWobble) }, - { "PitchInDirectionOfZVelFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_pitchByZVelCoef) }, - { "ForwardVelocityPitchFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_forwardVelCoef) }, - { "LateralVelocityRollFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_lateralVelCoef) }, - { "ForwardAccelerationPitchFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_forwardAccelCoef) }, - { "LateralAccelerationRollFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_lateralAccelCoef) }, - { "UniformAxialDamping", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_uniformAxialDamping) }, - { "TurnPivotOffset", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_turnPivotOffset) }, - { "Apply2DFrictionWhenAirborne", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_apply2DFrictionWhenAirborne) }, - { "DownhillOnly", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_downhillOnly) }, - { "AllowAirborneMotiveForce", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_allowMotiveForceWhileAirborne) }, - { "LocomotorWorksWhenDead", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_locomotorWorksWhenDead) }, - { "AirborneTargetingHeight", INI::parseInt, NULL, offsetof( LocomotorTemplate, m_airborneTargetingHeight ) }, - { "StickToGround", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_stickToGround) }, - { "CanMoveBackwards", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_canMoveBackward) }, - { "HasSuspension", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_hasSuspension) }, - { "FrontWheelTurnAngle", INI::parseAngleReal, NULL, offsetof(LocomotorTemplate, m_wheelTurnAngle) }, - { "MaximumWheelExtension", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maximumWheelExtension) }, - { "MaximumWheelCompression", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_maximumWheelCompression) }, - { "CloseEnoughDist", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_closeEnoughDist) }, - { "CloseEnoughDist3D", INI::parseBool, NULL, offsetof(LocomotorTemplate, m_isCloseEnoughDist3D) }, - { "SlideIntoPlaceTime", INI::parseDurationReal, NULL, offsetof(LocomotorTemplate, m_ultraAccurateSlideIntoPlaceFactor) }, - - { "WanderWidthFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderWidthFactor) }, - { "WanderLengthFactor", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderLengthFactor) }, - { "WanderAboutPointRadius", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_wanderAboutPointRadius) }, - - { "RudderCorrectionDegree", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rudderCorrectionDegree) }, - { "RudderCorrectionRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_rudderCorrectionRate) }, - { "ElevatorCorrectionDegree", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_elevatorCorrectionDegree) }, - { "ElevatorCorrectionRate", INI::parseReal, NULL, offsetof(LocomotorTemplate, m_elevatorCorrectionRate) }, - { NULL, NULL, NULL, 0 } + { "AccelerationPitchLimit", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_accelPitchLimit) }, + { "DecelerationPitchLimit", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_decelPitchLimit) }, + { "BounceAmount", INI::parseAngularVelocityReal, nullptr, offsetof(LocomotorTemplate, m_bounceKick) }, + { "PitchStiffness", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchStiffness) }, + { "RollStiffness", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rollStiffness) }, + { "PitchDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchDamping) }, + { "RollDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rollDamping) }, + { "ThrustRoll", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_thrustRoll) }, + { "ThrustWobbleRate", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wobbleRate) }, + { "ThrustMinWobble", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_minWobble) }, + { "ThrustMaxWobble", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maxWobble) }, + { "PitchInDirectionOfZVelFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_pitchByZVelCoef) }, + { "ForwardVelocityPitchFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_forwardVelCoef) }, + { "LateralVelocityRollFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_lateralVelCoef) }, + { "ForwardAccelerationPitchFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_forwardAccelCoef) }, + { "LateralAccelerationRollFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_lateralAccelCoef) }, + { "UniformAxialDamping", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_uniformAxialDamping) }, + { "TurnPivotOffset", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_turnPivotOffset) }, + { "Apply2DFrictionWhenAirborne", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_apply2DFrictionWhenAirborne) }, + { "DownhillOnly", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_downhillOnly) }, + { "AllowAirborneMotiveForce", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_allowMotiveForceWhileAirborne) }, + { "LocomotorWorksWhenDead", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_locomotorWorksWhenDead) }, + { "AirborneTargetingHeight", INI::parseInt, nullptr, offsetof( LocomotorTemplate, m_airborneTargetingHeight ) }, + { "StickToGround", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_stickToGround) }, + { "CanMoveBackwards", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_canMoveBackward) }, + { "HasSuspension", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_hasSuspension) }, + { "FrontWheelTurnAngle", INI::parseAngleReal, nullptr, offsetof(LocomotorTemplate, m_wheelTurnAngle) }, + { "MaximumWheelExtension", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maximumWheelExtension) }, + { "MaximumWheelCompression", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_maximumWheelCompression) }, + { "CloseEnoughDist", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_closeEnoughDist) }, + { "CloseEnoughDist3D", INI::parseBool, nullptr, offsetof(LocomotorTemplate, m_isCloseEnoughDist3D) }, + { "SlideIntoPlaceTime", INI::parseDurationReal, nullptr, offsetof(LocomotorTemplate, m_ultraAccurateSlideIntoPlaceFactor) }, + + { "WanderWidthFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderWidthFactor) }, + { "WanderLengthFactor", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderLengthFactor) }, + { "WanderAboutPointRadius", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_wanderAboutPointRadius) }, + + { "RudderCorrectionDegree", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rudderCorrectionDegree) }, + { "RudderCorrectionRate", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_rudderCorrectionRate) }, + { "ElevatorCorrectionDegree", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_elevatorCorrectionDegree) }, + { "ElevatorCorrectionRate", INI::parseReal, nullptr, offsetof(LocomotorTemplate, m_elevatorCorrectionRate) }, + { nullptr, nullptr, nullptr, 0 } }; return TheFieldParse; @@ -529,11 +529,11 @@ LocomotorStore::~LocomotorStore() LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) { if (namekey == NAMEKEY_INVALID) - return NULL; + return nullptr; LocomotorTemplateMap::iterator it = m_locomotorTemplates.find(namekey); if (it == m_locomotorTemplates.end()) - return NULL; + return nullptr; else return (*it).second; } @@ -542,12 +542,12 @@ LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) const LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey) const { if (namekey == NAMEKEY_INVALID) - return NULL; + return nullptr; LocomotorTemplateMap::const_iterator it = m_locomotorTemplates.find(namekey); if (it == m_locomotorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -581,8 +581,8 @@ void LocomotorStore::reset() //------------------------------------------------------------------------------------------------- LocomotorTemplate *LocomotorStore::newOverride( LocomotorTemplate *locoTemplate ) { - if (locoTemplate == NULL) - return NULL; + if (locoTemplate == nullptr) + return nullptr; // allocate new template LocomotorTemplate *newTemplate = newInstance(LocomotorTemplate); @@ -862,11 +862,11 @@ void Locomotor::locoUpdate_moveTowardsAngle(Object* obj, Real goalAngle) { setFlag(MAINTAIN_POS_IS_VALID, false); - if (obj == NULL || m_template == NULL) + if (obj == nullptr || m_template == nullptr) return; PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -925,7 +925,7 @@ PhysicsTurningType Locomotor::rotateTowardsPosition(Object* obj, const Coord3D& void Locomotor::setPhysicsOptions(Object* obj) { PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -959,7 +959,7 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& goalP m_brakingFactor = 1.0f; } PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return; @@ -1857,7 +1857,7 @@ void Locomotor::moveTowardsPositionWings(Object* obj, PhysicsBehavior *physics, angleTowardPos += aimDir; BodyDamageType bdt = obj->getBodyModule()->getDamageState(); - Real turnRadius = calcMinTurnRadius(bdt, NULL) * 4; + Real turnRadius = calcMinTurnRadius(bdt, nullptr) * 4; // project a spot "radius" dist away from it, in that dir Coord3D desiredPos = goalPos; @@ -2434,7 +2434,7 @@ Bool Locomotor::locoUpdate_maintainCurrentPosition(Object* obj) m_donutTimer = TheGameLogic->getFrame()+DONUT_TIME_DELAY_SECONDS*LOGICFRAMES_PER_SECOND; setFlag(IS_BRAKING, false); PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) { DEBUG_CRASH(("you can only apply Locomotors to objects with Physics")); return TRUE; @@ -2510,7 +2510,7 @@ void Locomotor::maintainCurrentPositionWings(Object* obj, PhysicsBehavior *physi BodyDamageType bdt = obj->getBodyModule()->getDamageState(); Real turnRadius = m_template->m_circlingRadius; if (turnRadius == 0.0f) - turnRadius = calcMinTurnRadius(bdt, NULL); + turnRadius = calcMinTurnRadius(bdt, nullptr); // find the direction towards our "maintain pos" const Coord3D* pos = obj->getPosition(); @@ -2687,7 +2687,7 @@ void LocomotorSet::xfer( Xfer *xfer ) xfer->xferAsciiString(&name); const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(NAMEKEY(name)); - if (lt == NULL) + if (lt == nullptr) { DEBUG_CRASH(( "LocomotorSet::xfer - template %s not found", name.str() )); throw XFER_UNKNOWN_STRING; @@ -2731,7 +2731,7 @@ void LocomotorSet::xferSelfAndCurLocoPtr(Xfer *xfer, Locomotor** loco) if (name.isEmpty()) { - *loco = NULL; + *loco = nullptr; } else { @@ -2791,7 +2791,7 @@ Locomotor* LocomotorSet::findLocomotor(LocomotorSurfaceTypeMask t) if (curLocomotor && (curLocomotor->getLegalSurfaces() & t)) return curLocomotor; } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 7505e85e372..8acdf5a9751 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -178,36 +178,36 @@ AsciiString DebugDescribeObject(const Object *obj) Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatusMask, Team *team ) : Thing(tt), m_indicatorColor(0), - m_ai(NULL), - m_physics(NULL), + m_ai(nullptr), + m_physics(nullptr), m_geometryInfo(tt->getTemplateGeometryInfo()), - m_containedBy(NULL), + m_containedBy(nullptr), m_xferContainedByID(INVALID_ID), m_containedByFrame(0), - m_behaviors(NULL), - m_body(NULL), - m_contain(NULL), - m_stealth(NULL), - m_partitionData(NULL), - m_radarData(NULL), - m_drawable(NULL), - m_next(NULL), - m_prev(NULL), - m_team(NULL), - m_experienceTracker(NULL), - m_firingTracker(NULL), - m_repulsorHelper(NULL), - m_statusDamageHelper(NULL), - m_tempWeaponBonusHelper(NULL), - m_subdualDamageHelper(NULL), - m_smcHelper(NULL), - m_wsHelper(NULL), - m_defectionHelper(NULL), - m_partitionLastLook(NULL), - m_partitionRevealAllLastLook(NULL), - m_partitionLastShroud(NULL), - m_partitionLastThreat(NULL), - m_partitionLastValue(NULL), + m_behaviors(nullptr), + m_body(nullptr), + m_contain(nullptr), + m_stealth(nullptr), + m_partitionData(nullptr), + m_radarData(nullptr), + m_drawable(nullptr), + m_next(nullptr), + m_prev(nullptr), + m_team(nullptr), + m_experienceTracker(nullptr), + m_firingTracker(nullptr), + m_repulsorHelper(nullptr), + m_statusDamageHelper(nullptr), + m_tempWeaponBonusHelper(nullptr), + m_subdualDamageHelper(nullptr), + m_smcHelper(nullptr), + m_wsHelper(nullptr), + m_defectionHelper(nullptr), + m_partitionLastLook(nullptr), + m_partitionRevealAllLastLook(nullptr), + m_partitionLastShroud(nullptr), + m_partitionLastThreat(nullptr), + m_partitionLastValue(nullptr), m_smcUntil(NEVER), m_privateStatus(0), m_formationID(NO_FORMATION_ID), @@ -248,7 +248,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_curWeaponSetFlags.clear(); // sanity - if( TheGameLogic == NULL || tt == NULL ) + if( TheGameLogic == nullptr || tt == nullptr ) { assert( 0 ); @@ -278,7 +278,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_status = objectStatusMask; m_layer = LAYER_GROUND; - m_group = NULL; + m_group = nullptr; m_constructionPercent = CONSTRUCTION_COMPLETE; // complete by default @@ -349,7 +349,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu *curB++ = m_subdualDamageHelper; } - if (TheAI != NULL + if (TheAI != nullptr && TheAI->getAiData()->m_enableRepulsors && isKindOf(KINDOF_CAN_BE_REPULSED)) { @@ -412,21 +412,21 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu BodyModuleInterface* body = newMod->getBody(); if (body) { - DEBUG_ASSERTCRASH(m_body == NULL, ("Duplicate bodies")); + DEBUG_ASSERTCRASH(m_body == nullptr, ("Duplicate bodies")); m_body = body; } ContainModuleInterface* contain = newMod->getContain(); if (contain) { - DEBUG_ASSERTCRASH(m_contain == NULL, ("Duplicate containers")); + DEBUG_ASSERTCRASH(m_contain == nullptr, ("Duplicate containers")); m_contain = contain; } StealthUpdate* stealth = (StealthUpdate*)newMod->getStealth(); if ( stealth ) { - DEBUG_ASSERTCRASH( m_stealth == NULL, ("DuplicateStealthUpdates!") ); + DEBUG_ASSERTCRASH( m_stealth == nullptr, ("DuplicateStealthUpdates!") ); m_stealth = stealth; } @@ -436,7 +436,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu { if( m_ai ) { - DEBUG_ASSERTCRASH( m_ai == NULL, ("%s has more than one AI module. This is illegal!", getTemplate()->getName().str()) ); + DEBUG_ASSERTCRASH( m_ai == nullptr, ("%s has more than one AI module. This is illegal!", getTemplate()->getName().str()) ); } m_ai = ai; } @@ -444,12 +444,12 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu static NameKeyType key_PhysicsUpdate = NAMEKEY("PhysicsBehavior"); if (newMod->getModuleNameKey() == key_PhysicsUpdate) { - DEBUG_ASSERTCRASH(m_physics == NULL, ("You should never have more than one Physics module (%s)",getTemplate()->getName().str())); + DEBUG_ASSERTCRASH(m_physics == nullptr, ("You should never have more than one Physics module (%s)",getTemplate()->getName().str())); m_physics = (PhysicsBehavior*)newMod; } } - *curB = NULL; + *curB = nullptr; AIUpdateInterface *ai = getAIUpdateInterface(); if (ai) { @@ -608,7 +608,7 @@ Object::~Object() } // - // remove from radar before we NULL out the team ... the order of ops are critical here + // remove from radar before we null out the team ... the order of ops are critical here // because the radar code will sometimes look at the team info and it is assumed through // the team and player code that the team is valid // @@ -620,19 +620,19 @@ Object::~Object() TheGameLogic->sendObjectDestroyed( this ); // empty the team - setTeam( NULL ); + setTeam( nullptr ); // Object's set of these persist for the life of the object. deleteInstance(m_partitionLastLook); - m_partitionLastLook = NULL; + m_partitionLastLook = nullptr; deleteInstance(m_partitionRevealAllLastLook); - m_partitionRevealAllLastLook = NULL; + m_partitionRevealAllLastLook = nullptr; deleteInstance(m_partitionLastShroud); - m_partitionLastShroud = NULL; + m_partitionLastShroud = nullptr; deleteInstance(m_partitionLastThreat); - m_partitionLastThreat = NULL; + m_partitionLastThreat = nullptr; deleteInstance(m_partitionLastValue); - m_partitionLastValue = NULL; + m_partitionLastValue = nullptr; // remove the object from the partition system if present if( m_partitionData ) @@ -642,32 +642,32 @@ Object::~Object() leaveGroup(); // note, do NOT free these, there are just a shadow copy! - m_ai = NULL; - m_physics = NULL; + m_ai = nullptr; + m_physics = nullptr; // delete any modules present for (BehaviorModule** b = m_behaviors; *b; ++b) { deleteInstance(*b); - *b = NULL; // in case other modules call findModule from their dtor! + *b = nullptr; // in case other modules call findModule from their dtor! } delete [] m_behaviors; - m_behaviors = NULL; + m_behaviors = nullptr; deleteInstance(m_experienceTracker); - m_experienceTracker = NULL; + m_experienceTracker = nullptr; // we don't need to delete these, there were deleted on the m_behaviors list - m_firingTracker = NULL; - m_repulsorHelper = NULL; + m_firingTracker = nullptr; + m_repulsorHelper = nullptr; - m_statusDamageHelper = NULL; - m_tempWeaponBonusHelper = NULL; - m_subdualDamageHelper = NULL; - m_smcHelper = NULL; - m_wsHelper = NULL; - m_defectionHelper = NULL; + m_statusDamageHelper = nullptr; + m_tempWeaponBonusHelper = nullptr; + m_subdualDamageHelper = nullptr; + m_smcHelper = nullptr; + m_wsHelper = nullptr; + m_defectionHelper = nullptr; // reset id to zero so we never mistaken grab "dead" objects m_id = INVALID_ID; @@ -701,7 +701,7 @@ void Object::onContainedBy( Object *containedBy ) void Object::onRemovedFrom( Object *removedFrom ) { clearStatus( MAKE_OBJECT_STATUS_MASK2( OBJECT_STATUS_MASKED, OBJECT_STATUS_UNSELECTABLE ) ); - m_containedBy = NULL; + m_containedBy = nullptr; m_containedByFrame = 0; handlePartitionCellMaintenance(); // get a clean look, now that I am outdoors, again @@ -738,7 +738,7 @@ const Object* Object::getEnclosingContainedBy() const return container; } - return NULL; + return nullptr; } const Object* Object::getOuterObject() const @@ -815,11 +815,11 @@ void Object::friend_setUndetectedDefector( Bool status ) //============================================================================= void Object::restoreOriginalTeam() { - if( m_team == NULL || m_originalTeamName.isEmpty() ) + if( m_team == nullptr || m_originalTeamName.isEmpty() ) return; Team* origTeam = TheTeamFactory->findTeam(m_originalTeamName); - if (origTeam == NULL) + if (origTeam == nullptr) { DEBUG_CRASH(("Object original team (%s) could not be found or created! (srj)",m_originalTeamName.str())); return; @@ -950,13 +950,13 @@ Bool Object::checkAndDetonateBoobyTrap(const Object *victim) PartitionFilter *filters[3]; filters[0] = &kindFilter; filters[1] = &filterMapStatus; - filters[2] = NULL; + filters[2] = nullptr; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( getPosition(), BOOBY_TRAP_SCAN_RANGE + getGeometryInfo().getBoundingCircleRadius(), FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR ); MemoryPoolObjectHolder hold(iter);// This is the magic thing that frees the dynamically made iter in its destructor - Object *ourBoobyTrap = NULL; + Object *ourBoobyTrap = nullptr; for( Object *other = iter->first(); other; other = iter->next() ) { if( other->getProducerID() == getID() )// Sticky bombs call the thing they are on their producer for just such an occasion @@ -995,7 +995,7 @@ void Object::setStatus( ObjectStatusMaskType objectStatus, Bool set ) if (m_status != oldStatus) { - if( set && objectStatus.test( OBJECT_STATUS_REPULSOR ) && m_repulsorHelper != NULL ) + if( set && objectStatus.test( OBJECT_STATUS_REPULSOR ) && m_repulsorHelper != nullptr ) { // Damaged repulsable civilians scare (repulse) other civs, but only // for a short amount of time... use the repulsor helper to turn off repulsion shortly. @@ -1396,7 +1396,7 @@ void Object::clearSpecialModelConditionStates() // } // else // { -// DEBUG_CRASH(("NULL Drawable at this point, you can't get modelconditionflags now.")); +// DEBUG_CRASH(("null Drawable at this point, you can't get modelconditionflags now.")); // static ModelConditionFlags noFlags; // return noFlags; // } @@ -1406,7 +1406,7 @@ void Object::clearSpecialModelConditionStates() Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) { if (!m_weaponSet.hasAnyWeapon()) - return NULL; + return nullptr; if (wslot) *wslot = m_weaponSet.getCurWeaponSlot(); @@ -1417,7 +1417,7 @@ Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) const Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) const { if (!m_weaponSet.hasAnyWeapon()) - return NULL; + return nullptr; if (wslot) *wslot = m_weaponSet.getCurWeaponSlot(); @@ -1486,7 +1486,7 @@ void Object::fireCurrentWeapon(Object *target) //USE_PERF_TIMER(fireCurrentWeapon) // victim may have already been destroyed - if (target == NULL) + if (target == nullptr) return; Weapon* weapon = m_weaponSet.getCurWeapon(); @@ -1508,7 +1508,7 @@ void Object::fireCurrentWeapon(const Coord3D* pos) { //USE_PERF_TIMER(fireCurrentWeapon) - if (pos == NULL) + if (pos == nullptr) return; Weapon* weapon = m_weaponSet.getCurWeapon(); @@ -1611,7 +1611,7 @@ Player * Object::getControllingPlayer() const if (myTeam) return myTeam->getControllingPlayer(); - return NULL; + return nullptr; } //============================================================================= @@ -1915,7 +1915,7 @@ void Object::attemptDamage( DamageInfo *damageInfo ) damageInfo->in.m_damageType != DAMAGE_HEALING && getControllingPlayer() && !BitIsSet(damageInfo->in.m_sourcePlayerMask, getControllingPlayer()->getPlayerMask()) && - m_radarData != NULL && + m_radarData != nullptr && getControllingPlayer() == ThePlayerList->getLocalPlayer() ) TheRadar->tryUnderAttackEvent( this ); @@ -2014,7 +2014,7 @@ void Object::kill( DamageType damageType, DeathType deathType ) //------------------------------------------------------------------------------------------------- void Object::healCompletely() { - attemptHealing(HUGE_DAMAGE_AMOUNT, NULL); + attemptHealing(HUGE_DAMAGE_AMOUNT, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2470,7 +2470,7 @@ void Object::updateUpgradeModules() if( testStatus( OBJECT_STATUS_DESTROYED ) ) return; // Patch 1.03 -- Fixes crash when you upgrade a fake GLA command center to a real one if (toxic or demo). - if( getControllingPlayer() == NULL ) + if( getControllingPlayer() == nullptr ) return; // This can only happen in game teardown. No upgrades for you without a player. Weird crashes are bad. UpgradeMaskType playerMask = getControllingPlayer()->getCompletedUpgradeMask(); @@ -2589,17 +2589,17 @@ Bool Object::isInside(const PolygonTrigger *pTrigger) const // ------------------------------------------------------------------------------------------------ ExitInterface *Object::getObjectExitInterface() const { - ExitInterface *exitInterface = NULL; + ExitInterface *exitInterface = nullptr; for( BehaviorModule **umod = m_behaviors; *umod; ++umod ) { - if( (exitInterface = (*umod)->getUpdateExitInterface()) != NULL ) + if( (exitInterface = (*umod)->getUpdateExitInterface()) != nullptr ) break; } // If you don't have a fancy one, you may have one from your contain module, // since if you can contain something, they will need to get out. - if( exitInterface == NULL ) + if( exitInterface == nullptr ) { ContainModuleInterface *cmod = getContain(); if( cmod ) @@ -2742,7 +2742,7 @@ void Object::prependToList(Object **pListHead) { DEBUG_ASSERTCRASH(!isInList(pListHead), ("obj is already in a list")); - m_prev = NULL; + m_prev = nullptr; m_next = *pListHead; if (*pListHead) (*pListHead)->m_prev = this; @@ -2823,8 +2823,8 @@ void Object::removeFromList(Object **pListHead) else *pListHead = m_next; - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2901,14 +2901,14 @@ void Object::calcNaturalRallyPoint(Coord2D *pt) //------------------------------------------------------------------------------------------------- Module* Object::findModule(NameKeyType key) const { - Module* m = NULL; + Module* m = nullptr; for (BehaviorModule** b = m_behaviors; *b; ++b) { if ((*b)->getModuleNameKey() == key) { #ifdef INTENSE_DEBUG - if (m == NULL) + if (m == nullptr) { m = *b; } @@ -3225,7 +3225,7 @@ Bool Object::isAbleToAttack() const // if we're contained within a transport we cannot attack unless it specifically allows us const Object *containedBy = getContainedBy(); - DEBUG_ASSERTCRASH( (containedBy == NULL) || (containedBy->getContain() != NULL), ("A %s thinks they are contained by something with no contain module!", getTemplate()->getName().str() ) ); + DEBUG_ASSERTCRASH( (containedBy == nullptr) || (containedBy->getContain() != nullptr), ("A %s thinks they are contained by something with no contain module!", getTemplate()->getName().str() ) ); if( containedBy && containedBy->getContain() && !containedBy->getContain()->isPassengerAllowedToFire( getID() ) ) return false; @@ -3337,7 +3337,7 @@ Bool Object::isAbleToAttack() const return true; // if we have AI and a weapon, assume we know how to use it - if (getAIUpdateInterface() != NULL && m_weaponSet.hasAnyWeapon()) + if (getAIUpdateInterface() != nullptr && m_weaponSet.hasAnyWeapon()) { // actually, we don't want to do this; we want the troop crawler to be considered "able to attack" @@ -3674,7 +3674,7 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) Bool soundEnabledExists; Bool soundEnabled = properties->getBool( TheKey_objectSoundAmbientEnabled, &soundEnabledExists ); - DynamicAudioEventInfo * audioToModify = NULL; + DynamicAudioEventInfo * audioToModify = nullptr; Bool infoModified = false; valStr = properties->getAsciiString( TheKey_objectSoundAmbient, &exists ); if ( exists ) @@ -3688,8 +3688,8 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) else { const AudioEventInfo * baseInfo = TheAudio->findAudioEventInfo( valStr ); - DEBUG_ASSERTCRASH( baseInfo != NULL, ("Cannot find customized ambient sound '%s'", valStr.str() ) ); - if ( baseInfo != NULL ) + DEBUG_ASSERTCRASH( baseInfo != nullptr, ("Cannot find customized ambient sound '%s'", valStr.str() ) ); + if ( baseInfo != nullptr ) { audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); infoModified = true; @@ -3703,17 +3703,17 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) valBool = properties->getBool( TheKey_objectSoundAmbientCustomized, &exists ); if ( exists && valBool ) { - if ( audioToModify == NULL ) + if ( audioToModify == nullptr ) { const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); - DEBUG_ASSERTCRASH( baseInfo != NULL, ("getBaseSoundAmbientInfo() return NULL" ) ); - if ( baseInfo != NULL ) + DEBUG_ASSERTCRASH( baseInfo != nullptr, ("getBaseSoundAmbientInfo() return null" ) ); + if ( baseInfo != nullptr ) { audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); } } - if ( audioToModify != NULL ) + if ( audioToModify != nullptr ) { valBool = properties->getBool( TheKey_objectSoundAmbientLooping, &exists ); if ( exists ) @@ -3773,7 +3773,7 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) // a preference. Enable permanently looping sounds, disable one-shot sounds by default // NOTE: This test should match the tests done in MapObjectProps::mapObjectPageSound::dictToEnabled() // when it decided whether or not to show a customized sound as enabled - if ( audioToModify != NULL ) + if ( audioToModify != nullptr ) { soundEnabled = audioToModify->isPermanentSound(); soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. @@ -3782,7 +3782,7 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) { // Use default audio const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); - if ( baseInfo != NULL ) + if ( baseInfo != nullptr ) { soundEnabled = baseInfo->isPermanentSound(); soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. @@ -3797,7 +3797,7 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) drawable->enableAmbientSoundFromScript( false ); } - if ( infoModified && audioToModify != NULL ) + if ( infoModified && audioToModify != nullptr ) { // Give a custom, level-specific name drawable->mangleCustomAudioName( audioToModify ); @@ -3806,11 +3806,11 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) TheAudio->addAudioEventInfo( audioToModify ); drawable->setCustomSoundAmbientInfo( audioToModify ); - audioToModify = NULL; // Belongs to TheAudio now + audioToModify = nullptr; // Belongs to TheAudio now } deleteInstance(audioToModify); - audioToModify = NULL; + audioToModify = nullptr; if ( soundEnabledExists && soundEnabled ) { @@ -3852,7 +3852,7 @@ void Object::onDisabledEdge(Bool becomingDisabled) for( BehaviorModule **module = m_behaviors; *module; ++module ) (*module)->onDisabledEdge( becomingDisabled ); - DozerAIInterface *dozerAI = getAI() ? getAI()->getDozerAIInterface() : NULL; + DozerAIInterface *dozerAI = getAI() ? getAI()->getDozerAIInterface() : nullptr; if( becomingDisabled && dozerAI ) { // Have to say goodbye to the thing we might be building or repairing so someone else can do it. @@ -4146,7 +4146,7 @@ void Object::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { Team *team = TheTeamFactory->findTeamByID( teamID ); - if( team == NULL ) + if( team == nullptr ) { DEBUG_CRASH(( "Object::xfer - Unable to load team" )); throw SC_INVALID_DATA; @@ -4231,7 +4231,7 @@ void Object::xfer( Xfer *xfer ) // our responsibility. if( xfer->getXferMode() == XFER_SAVE ) { - if( m_containedBy != NULL ) + if( m_containedBy != nullptr ) m_xferContainedByID = m_containedBy->getID(); else m_xferContainedByID = INVALID_ID; @@ -4354,7 +4354,7 @@ void Object::xfer( Xfer *xfer ) NameKeyType moduleIdentifierKey = TheNameKeyGenerator->nameToKey(moduleIdentifier); // find the module with this identifier in the module list - module = NULL; + module = nullptr; for (BehaviorModule** b = m_behaviors; b && *b; ++b) { @@ -4374,7 +4374,7 @@ void Object::xfer( Xfer *xfer ) // it from the object definition in a future patch, if that is so, we need to // skip the module data in the file // - if( module == NULL ) + if( module == nullptr ) { // for testing purposes, this module better be found @@ -4416,7 +4416,7 @@ void Object::xfer( Xfer *xfer ) //m_group; // don't need to save m_partitionData. - DEBUG_ASSERTCRASH(!(xfer->getXferMode() == XFER_LOAD && m_partitionData == NULL), ("should not be in partitionmgr yet")); + DEBUG_ASSERTCRASH(!(xfer->getXferMode() == XFER_LOAD && m_partitionData == nullptr), ("should not be in partitionmgr yet")); // don't need to be saved or loaded; are inited & cached for runtime only by our ctor (srj) //m_repulsorHelper; @@ -4466,7 +4466,7 @@ void Object::loadPostProcess() if( m_xferContainedByID != INVALID_ID ) m_containedBy = TheGameLogic->findObjectByID(m_xferContainedByID); else - m_containedBy = NULL; + m_containedBy = nullptr; } @@ -4592,7 +4592,7 @@ void Object::onCapture( Player *oldOwner, Player *newOwner ) void Object::onDie( DamageInfo *damageInfo ) { - checkAndDetonateBoobyTrap(NULL);// Already dying, so no need to handle death case of explosion + checkAndDetonateBoobyTrap(nullptr);// Already dying, so no need to handle death case of explosion #if defined(RTS_DEBUG) DEBUG_ASSERTCRASH(m_hasDiedAlready == false, ("Object::onDie has been called multiple times. This is invalid. jkmcd")); @@ -4651,7 +4651,7 @@ void Object::onDie( DamageInfo *damageInfo ) } // This call won't do anything if we aren't actually in the list. - //Kris: Added NULL check to prevent crash with combat bikes & their riders getting deleted on exit. + //Kris: Added nullptr check to prevent crash with combat bikes & their riders getting deleted on exit. if( getControllingPlayer() ) { TheInGameUI->removeIdleWorker( this, getControllingPlayer()->getPlayerIndex() ); @@ -4807,10 +4807,10 @@ void Object::adjustModelConditionForWeaponStatus() //------------------------------------------------------------------------------------------------- Bool Object::hasGhostObject() const { - if (m_partitionData == NULL) + if (m_partitionData == nullptr) return false; - return m_partitionData->getGhostObject() != NULL; + return m_partitionData->getGhostObject() != nullptr; } //------------------------------------------------------------------------------------------------- @@ -4980,7 +4980,7 @@ void Object::look() if( !isDestroyed() && !isEffectivelyDead() ) { - ContainModuleInterface * contain = (getContainedBy() ? getContainedBy()->getContain() : NULL); + ContainModuleInterface * contain = (getContainedBy() ? getContainedBy()->getContain() : nullptr); if ( contain && !contain->isGarrisonable() ) return;// dont look, 'cause you are in a tunnel, now // GS 10-20 Need to expand that exception to all transports or else you get a perma reveal where @@ -5344,8 +5344,8 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe { // sanity - if( specialPowerTemplate == NULL ) - return NULL; + if( specialPowerTemplate == nullptr ) + return nullptr; // search the modules for the one with the matching template for( BehaviorModule** m = m_behaviors; *m; ++m ) @@ -5358,7 +5358,7 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe return sp; } - return NULL; + return nullptr; } @@ -5503,7 +5503,7 @@ void Object::doCommandButton( const CommandButton *commandButton, CommandSourceT const UpgradeTemplate *upgradeT = commandButton->getUpgradeTemplate(); DEBUG_ASSERTCRASH( upgradeT, ("Undefined upgrade '%s' in player upgrade command", "UNKNOWN") ); // sanity - if( upgradeT == NULL ) + if( upgradeT == nullptr ) break; if( upgradeT->getUpgradeType() == UPGRADE_TYPE_OBJECT ) { @@ -5512,7 +5512,7 @@ void Object::doCommandButton( const CommandButton *commandButton, CommandSourceT } // producer must have a production update ProductionUpdateInterface *pu = getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // queue the upgrade "research" pu->queueUpgrade( upgradeT ); @@ -5886,7 +5886,7 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) } - return NULL; + return nullptr; } @@ -5894,15 +5894,15 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) // ------------------------------------------------------------------------------------------------ DockUpdateInterface *Object::getDockUpdateInterface( void ) { - DockUpdateInterface *dock = NULL; + DockUpdateInterface *dock = nullptr; for( BehaviorModule **u = m_behaviors; *u; ++u ) { - if( (dock = (*u)->getDockUpdateInterface()) != NULL ) + if( (dock = (*u)->getDockUpdateInterface()) != nullptr ) return dock; } - return NULL; + return nullptr; } @@ -5923,7 +5923,7 @@ SpecialPowerModuleInterface* Object::findSpecialPowerModuleInterface( SpecialPow return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5943,7 +5943,7 @@ SpecialPowerModuleInterface* Object::findAnyShortcutSpecialPowerModuleInterface( return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5959,7 +5959,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const return sbi; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5973,7 +5973,7 @@ ProjectileUpdateInterface* Object::getProjectileUpdateInterface() const return pui; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5992,7 +5992,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -6011,7 +6011,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( } } } - return NULL; + return nullptr; } @@ -6033,7 +6033,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -6074,17 +6074,17 @@ Bool Object::getSingleLogicalBonePositionOnTurret( WhichTurretType whichTurret, { Coord3D turretPosition; Coord3D bonePosition; - if( getDrawable() == NULL || getAI() == NULL ) + if( getDrawable() == nullptr || getAI() == nullptr ) return FALSE; // We need to find the TurretBone's pristine position. - getDrawable()->getProjectileLaunchOffset( PRIMARY_WEAPON, 1, NULL, whichTurret, &turretPosition, NULL ); + getDrawable()->getProjectileLaunchOffset( PRIMARY_WEAPON, 1, nullptr, whichTurret, &turretPosition, nullptr ); // And the required bone's pristine position - if( getDrawable()->getPristineBonePositions(boneName, 0, &bonePosition, NULL, 1) != 1 ) + if( getDrawable()->getPristineBonePositions(boneName, 0, &bonePosition, nullptr, 1) != 1 ) return FALSE; //Then we mojo the Logic position of the required bone like Missile firing does. Using the logic twist of the turret Real turretRotation; - getAI()->getTurretRotAndPitch( whichTurret, &turretRotation, NULL ); + getAI()->getTurretRotAndPitch( whichTurret, &turretRotation, nullptr ); Matrix3D boneOffset(TRUE);// This will be from the turret to the requested bone @@ -6106,7 +6106,7 @@ Bool Object::getSingleLogicalBonePositionOnTurret( WhichTurretType whichTurret, boneLogicTransform.mul( turnAdjustment, boneOffset ); Matrix3D worldTransform; - convertBonePosToWorldPos(NULL, &boneLogicTransform, NULL, &worldTransform); + convertBonePosToWorldPos(nullptr, &boneLogicTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); Coord3D worldPos; @@ -6134,7 +6134,7 @@ Int Object::getMultiLogicalBonePosition(const char* boneNamePrefix, Int maxBones if( convertToWorld ) { for (Int i = 0; i < count; ++i) - m_drawable->convertBonePosToWorldPos( positions ? &positions[i] : NULL, transforms ? &transforms[i] : NULL, positions ? &positions[i] : NULL, transforms ? &transforms[i] : NULL ); + m_drawable->convertBonePosToWorldPos( positions ? &positions[i] : nullptr, transforms ? &transforms[i] : nullptr, positions ? &positions[i] : nullptr, transforms ? &transforms[i] : nullptr ); } return count; } @@ -6372,9 +6372,9 @@ void Object::leaveGroup( void ) // if we are in a group, remove ourselves from it if (m_group) { - // to avoid recursion, set m_group to NULL before removing + // to avoid recursion, set m_group to nullptr before removing AIGroupPtr group = m_group; - m_group = NULL; + m_group = nullptr; group->remove( this ); } } @@ -6409,7 +6409,7 @@ CountermeasuresBehaviorInterface* Object::getCountermeasuresBehaviorInterface() return cbi; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -6423,7 +6423,7 @@ const CountermeasuresBehaviorInterface* Object::getCountermeasuresBehaviorInterf return cbi; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 215763f9c50..a61e871853e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -78,7 +78,7 @@ // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -ObjectCreationListStore *TheObjectCreationListStore = NULL; ///< the ObjectCreationList store definition +ObjectCreationListStore *TheObjectCreationListStore = nullptr; ///< the ObjectCreationList store definition //------------------------------------------------------------------------------------------------- static void adjustVector(Coord3D *vec, const Matrix3D* mtx) @@ -103,13 +103,13 @@ static void adjustVector(Coord3D *vec, const Matrix3D* mtx) //------------------------------------------------------------------------------------------------- Object* ObjectCreationNugget::create( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames ) const { - return create( primary, primary ? primary->getPosition() : NULL, secondary ? secondary->getPosition() : NULL, INVALID_ANGLE, lifetimeFrames ); + return create( primary, primary ? primary->getPosition() : nullptr, secondary ? secondary->getPosition() : nullptr, INVALID_ANGLE, lifetimeFrames ); } //------------------------------------------------------------------------------------------------- //void ObjectCreationNugget::create( const Object* primaryObj, const Coord3D *primary, const Coord3D *secondary, Real angle, UnsignedInt lifetimeFrames ) const //{ -// create( primaryObj, primary ? primary->getPosition() : NULL, secondary ? secondary->getPosition() : NULL, angle, lifetimeFrames ); +// create( primaryObj, primary ? primary->getPosition() : nullptr, secondary ? secondary->getPosition() : nullptr, angle, lifetimeFrames ); //} //------------------------------------------------------------------------------------------------- @@ -128,7 +128,7 @@ class FireWeaponNugget : public ObjectCreationNugget public: FireWeaponNugget() : - m_weapon(NULL) + m_weapon(nullptr) { } @@ -137,22 +137,22 @@ class FireWeaponNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } if (m_weapon) { TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); } - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponNugget, m_weapon ) }, - { 0, 0, 0, 0 } + { "Weapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponNugget, m_weapon ) }, + { nullptr, nullptr, nullptr, 0 } }; FireWeaponNugget* nugget = newInstance(FireWeaponNugget); @@ -184,7 +184,7 @@ class AttackNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } // Star trekkin, across the universe. @@ -212,18 +212,18 @@ class AttackNugget : public ObjectCreationNugget rd->createRadiusDecal(m_deliveryDecalTemplate, m_deliveryDecalRadius, *secondary); rd->killWhenNoLongerAttacking(true); } - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "NumberOfShots", INI::parseInt, NULL, offsetof( AttackNugget, m_numberOfShots ) }, + { "NumberOfShots", INI::parseInt, nullptr, offsetof( AttackNugget, m_numberOfShots ) }, { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( AttackNugget, m_weaponSlot ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( AttackNugget, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof(AttackNugget, m_deliveryDecalRadius) }, - { 0, 0, 0, 0 } + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( AttackNugget, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof(AttackNugget, m_deliveryDecalRadius) }, + { nullptr, nullptr, nullptr, 0 } }; AttackNugget* nugget = newInstance(AttackNugget); @@ -271,10 +271,10 @@ class DeliverPayloadNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; + return nullptr; } - Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : NULL; + Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : nullptr; //What I'm doing for the purposes of the formations is to calculate the relative positions of @@ -310,7 +310,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget CWy = dx * s + dy * c + dy; } - Object *firstTransport = NULL; + Object *firstTransport = nullptr; for( UnsignedInt formationIndex = 0; formationIndex < m_formationSize; formationIndex++ ) { Coord3D offset; @@ -373,7 +373,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget transport = TheThingFactory->newObject( ttn, owner ); if( !transport ) { - return NULL; + return nullptr; } if( !firstTransport ) { @@ -435,7 +435,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget transport->setPosition(&startPos); } - const ThingTemplate* putInContainerTmpl = m_putInContainerName.isEmpty() ? NULL : TheThingFactory->findTemplate(m_putInContainerName); + const ThingTemplate* putInContainerTmpl = m_putInContainerName.isEmpty() ? nullptr : TheThingFactory->findTemplate(m_putInContainerName); for (std::vector::const_iterator it = m_payload.begin(); it != m_payload.end(); ++it) { const ThingTemplate* payloadTmpl = TheThingFactory->findTemplate(it->m_payloadName); @@ -443,7 +443,7 @@ class DeliverPayloadNugget : public ObjectCreationNugget { DEBUG_CRASH( ("DeliverPayloadNugget::create() -- %s couldn't create %s (template not found).", transport->getTemplate()->getName().str(), it->m_payloadName.str() ) ); - return NULL; + return nullptr; } for (int i = 0; i < it->m_payloadCount; ++i) { @@ -527,27 +527,27 @@ class DeliverPayloadNugget : public ObjectCreationNugget //*************************************************************** //OBJECT CREATION LIST SPECIFIC DATA -- once created data no longer needed //The transport(s) that carry all the payload items (and initial physics information) - { "Transport", INI::parseAsciiString, NULL, offsetof(DeliverPayloadNugget, m_transportName) }, - { "StartAtPreferredHeight", INI::parseBool, NULL, offsetof(DeliverPayloadNugget, m_startAtPreferredHeight) }, - { "StartAtMaxSpeed", INI::parseBool, NULL, offsetof(DeliverPayloadNugget, m_startAtMaxSpeed) }, + { "Transport", INI::parseAsciiString, nullptr, offsetof(DeliverPayloadNugget, m_transportName) }, + { "StartAtPreferredHeight", INI::parseBool, nullptr, offsetof(DeliverPayloadNugget, m_startAtPreferredHeight) }, + { "StartAtMaxSpeed", INI::parseBool, nullptr, offsetof(DeliverPayloadNugget, m_startAtMaxSpeed) }, //For multiple transports, this defines the formation (and convergence if all weapons will hit same target) - { "FormationSize", INI::parseUnsignedInt, NULL, offsetof( DeliverPayloadNugget, m_formationSize) }, - { "FormationSpacing", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_formationSpacing) }, - { "WeaponConvergenceFactor", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_convergenceFactor ) }, - { "WeaponErrorRadius", INI::parseReal, NULL, offsetof( DeliverPayloadNugget, m_errorRadius ) }, - { "DelayDeliveryMax", INI::parseDurationUnsignedInt, NULL, offsetof( DeliverPayloadNugget, m_delayDeliveryFramesMax ) }, + { "FormationSize", INI::parseUnsignedInt, nullptr, offsetof( DeliverPayloadNugget, m_formationSize) }, + { "FormationSpacing", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_formationSpacing) }, + { "WeaponConvergenceFactor", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_convergenceFactor ) }, + { "WeaponErrorRadius", INI::parseReal, nullptr, offsetof( DeliverPayloadNugget, m_errorRadius ) }, + { "DelayDeliveryMax", INI::parseDurationUnsignedInt, nullptr, offsetof( DeliverPayloadNugget, m_delayDeliveryFramesMax ) }, //Payload information (it's all created now and stored inside) - { "Payload", parsePayload, NULL, 0 }, - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( DeliverPayloadNugget, m_putInContainerName) }, + { "Payload", parsePayload, nullptr, 0 }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadNugget, m_putInContainerName) }, //END OBJECT CREATION LIST SPECIFIC DATA //*************************************************************** //*************************************************************** //DELIVERPAYLOADDATA contains the rest (and most) of the parsed data. //*************************************************************** - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; DeliverPayloadNugget* nugget = newInstance(DeliverPayloadNugget); @@ -647,25 +647,25 @@ class ApplyRandomForceNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } virtual Object* create(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Real angle, UnsignedInt lifetimeFrames = 0 ) const { DEBUG_CRASH(("You must call this effect with an object, not a location")); - return NULL; + return nullptr; } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { static const FieldParse myFieldParse[] = { - { "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(ApplyRandomForceNugget, m_spinRate) }, - { "MinForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_minMag) }, - { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_maxMag) }, - { "MinForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_minPitch) }, - { "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_maxPitch) }, - { 0, 0, 0, 0 } + { "SpinRate", INI::parseAngularVelocityReal, nullptr, offsetof(ApplyRandomForceNugget, m_spinRate) }, + { "MinForceMagnitude", INI::parseReal, nullptr, offsetof(ApplyRandomForceNugget, m_minMag) }, + { "MaxForceMagnitude", INI::parseReal, nullptr, offsetof(ApplyRandomForceNugget, m_maxMag) }, + { "MinForcePitch", INI::parseAngleReal, nullptr, offsetof(ApplyRandomForceNugget, m_minPitch) }, + { "MaxForcePitch", INI::parseAngleReal, nullptr, offsetof(ApplyRandomForceNugget, m_maxPitch) }, + { nullptr, nullptr, nullptr, 0 } }; ApplyRandomForceNugget* nugget = newInstance(ApplyRandomForceNugget); @@ -707,7 +707,7 @@ static const char* const DebrisDispositionNames[] = "FLOATING", "INHERIT_VELOCITY", "WHIRLING", - NULL + nullptr }; std::vector debrisModelNamesGlobalHack; @@ -768,7 +768,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget m_minFrames(0), m_maxFrames(0), m_shadowType(SHADOW_NONE), - m_fxFinal(NULL), + m_fxFinal(nullptr), m_preserveLayer(true), m_objectCount(0) { @@ -780,7 +780,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget if (primary) { if (m_skipIfSignificantlyAirborne && primary->isSignificantlyAboveTerrain()) - return NULL; + return nullptr; return reallyCreate( primary->getPosition(), primary->getTransformMatrix(), primary->getOrientation(), primary, lifetimeFrames ); } @@ -788,14 +788,14 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } virtual Object* create(const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Real angle, UnsignedInt lifetimeFrames = 0 ) const { if (primary) { - const Matrix3D *xfrm = NULL; + const Matrix3D *xfrm = nullptr; if( angle == INVALID_ANGLE ) { //Vast majority of OCL's don't care about the angle, so if it comes in invalid, default the angle to 0. @@ -807,44 +807,44 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { DEBUG_CRASH(("You must have a primary source for this effect")); } - return NULL; + return nullptr; } static const FieldParse* getCommonFieldParse() { static const FieldParse commonFieldParse[] = { - { "PutInContainer", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_putInContainer) }, - { "ParticleSystem", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_particleSysName) }, - { "Count", INI::parseInt, NULL, offsetof( GenericObjectCreationNugget, m_debrisToGenerate ) }, - { "IgnorePrimaryObstacle", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_ignorePrimaryObstacle) }, - { "OrientInForceDirection", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_orientInForceDirection) }, - { "ExtraBounciness", INI::parseReal, NULL, offsetof( GenericObjectCreationNugget, m_extraBounciness ) }, - { "ExtraFriction", parseFrictionPerSec, NULL, offsetof( GenericObjectCreationNugget, m_extraFriction ) }, - { "Offset", INI::parseCoord3D, NULL, offsetof( GenericObjectCreationNugget, m_offset ) }, + { "PutInContainer", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_putInContainer) }, + { "ParticleSystem", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_particleSysName) }, + { "Count", INI::parseInt, nullptr, offsetof( GenericObjectCreationNugget, m_debrisToGenerate ) }, + { "IgnorePrimaryObstacle", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_ignorePrimaryObstacle) }, + { "OrientInForceDirection", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_orientInForceDirection) }, + { "ExtraBounciness", INI::parseReal, nullptr, offsetof( GenericObjectCreationNugget, m_extraBounciness ) }, + { "ExtraFriction", parseFrictionPerSec, nullptr, offsetof( GenericObjectCreationNugget, m_extraFriction ) }, + { "Offset", INI::parseCoord3D, nullptr, offsetof( GenericObjectCreationNugget, m_offset ) }, { "Disposition", INI::parseBitString32, DebrisDispositionNames, offsetof( GenericObjectCreationNugget, m_disposition ) }, - { "DispositionIntensity", INI::parseReal, NULL, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) }, - { "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_spinRate) }, - { "YawRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_yawRate) }, - { "RollRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_rollRate) }, - { "PitchRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_pitchRate) }, - { "MinForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minMag) }, - { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_maxMag) }, - { "MinForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_minPitch) }, - { "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_maxPitch) }, - { "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( GenericObjectCreationNugget, m_minFrames ) }, - { "MaxLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( GenericObjectCreationNugget, m_maxFrames ) }, - { "SpreadFormation", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_spreadFormation) }, - { "MinDistanceAFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minDistanceAFormation) }, - { "MinDistanceBFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minDistanceBFormation) }, - { "MaxDistanceFormation", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_maxDistanceFormation) }, - { "FadeIn", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_fadeIn) }, - { "FadeOut", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_fadeOut) }, - { "FadeTime", INI::parseDurationUnsignedInt, NULL, offsetof(GenericObjectCreationNugget, m_fadeFrames) }, - { "FadeSound", INI::parseAsciiString, NULL, offsetof( GenericObjectCreationNugget, m_fadeSoundName) }, - { "PreserveLayer", INI::parseBool, NULL, offsetof( GenericObjectCreationNugget, m_preserveLayer) }, - { "DiesOnBadLand", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_diesOnBadLand) }, - { 0, 0, 0, 0 } + { "DispositionIntensity", INI::parseReal, nullptr, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) }, + { "SpinRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_spinRate) }, + { "YawRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_yawRate) }, + { "RollRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_rollRate) }, + { "PitchRate", INI::parseAngularVelocityReal, nullptr, offsetof(GenericObjectCreationNugget, m_pitchRate) }, + { "MinForceMagnitude", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minMag) }, + { "MaxForceMagnitude", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxMag) }, + { "MinForcePitch", INI::parseAngleReal, nullptr, offsetof(GenericObjectCreationNugget, m_minPitch) }, + { "MaxForcePitch", INI::parseAngleReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxPitch) }, + { "MinLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( GenericObjectCreationNugget, m_minFrames ) }, + { "MaxLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( GenericObjectCreationNugget, m_maxFrames ) }, + { "SpreadFormation", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_spreadFormation) }, + { "MinDistanceAFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minDistanceAFormation) }, + { "MinDistanceBFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_minDistanceBFormation) }, + { "MaxDistanceFormation", INI::parseReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxDistanceFormation) }, + { "FadeIn", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_fadeIn) }, + { "FadeOut", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_fadeOut) }, + { "FadeTime", INI::parseDurationUnsignedInt, nullptr, offsetof(GenericObjectCreationNugget, m_fadeFrames) }, + { "FadeSound", INI::parseAsciiString, nullptr, offsetof( GenericObjectCreationNugget, m_fadeSoundName) }, + { "PreserveLayer", INI::parseBool, nullptr, offsetof( GenericObjectCreationNugget, m_preserveLayer) }, + { "DiesOnBadLand", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_diesOnBadLand) }, + { nullptr, nullptr, nullptr, 0 } }; return commonFieldParse; } @@ -853,16 +853,16 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const FieldParse myFieldParse[] = { - { "ContainInsideSourceObject", INI::parseBool, NULL, offsetof( GenericObjectCreationNugget, m_containInsideSourceObject) }, - { "ObjectNames", parseDebrisObjectNames, NULL, 0 }, - { "ObjectCount", INI::parseInt, NULL, offsetof(GenericObjectCreationNugget, m_objectCount) }, - { "InheritsVeterancy", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_inheritsVeterancy) }, - { "SkipIfSignificantlyAirborne", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_skipIfSignificantlyAirborne) }, - { "InvulnerableTime", INI::parseDurationUnsignedInt, NULL, offsetof(GenericObjectCreationNugget, m_invulnerableTime) }, - { "MinHealth", INI::parsePercentToReal, NULL, offsetof(GenericObjectCreationNugget, m_minHealth) }, - { "MaxHealth", INI::parsePercentToReal, NULL, offsetof(GenericObjectCreationNugget, m_maxHealth) }, - { "RequiresLivePlayer", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_requiresLivePlayer) }, - { 0, 0, 0, 0 } + { "ContainInsideSourceObject", INI::parseBool, nullptr, offsetof( GenericObjectCreationNugget, m_containInsideSourceObject) }, + { "ObjectNames", parseDebrisObjectNames, nullptr, 0 }, + { "ObjectCount", INI::parseInt, nullptr, offsetof(GenericObjectCreationNugget, m_objectCount) }, + { "InheritsVeterancy", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_inheritsVeterancy) }, + { "SkipIfSignificantlyAirborne", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_skipIfSignificantlyAirborne) }, + { "InvulnerableTime", INI::parseDurationUnsignedInt, nullptr, offsetof(GenericObjectCreationNugget, m_invulnerableTime) }, + { "MinHealth", INI::parsePercentToReal, nullptr, offsetof(GenericObjectCreationNugget, m_minHealth) }, + { "MaxHealth", INI::parsePercentToReal, nullptr, offsetof(GenericObjectCreationNugget, m_maxHealth) }, + { "RequiresLivePlayer", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_requiresLivePlayer) }, + { nullptr, nullptr, nullptr, 0 } }; MultiIniFieldParse p; @@ -881,15 +881,15 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const FieldParse myFieldParse[] = { - { "ModelNames", parseDebrisObjectNames, NULL, 0 }, - { "Mass", INI::parsePositiveNonZeroReal, NULL, offsetof( GenericObjectCreationNugget, m_mass ) }, - { "AnimationSet", parseAnimSet, NULL, offsetof( GenericObjectCreationNugget, m_animSets) }, - { "FXFinal", INI::parseFXList, NULL, offsetof( GenericObjectCreationNugget, m_fxFinal) }, - { "OkToChangeModelColor", INI::parseBool, NULL, offsetof(GenericObjectCreationNugget, m_okToChangeModelColor) }, - { "MinLODRequired", INI::parseStaticGameLODLevel, NULL, offsetof(GenericObjectCreationNugget, m_minLODRequired) }, + { "ModelNames", parseDebrisObjectNames, nullptr, 0 }, + { "Mass", INI::parsePositiveNonZeroReal, nullptr, offsetof( GenericObjectCreationNugget, m_mass ) }, + { "AnimationSet", parseAnimSet, nullptr, offsetof( GenericObjectCreationNugget, m_animSets) }, + { "FXFinal", INI::parseFXList, nullptr, offsetof( GenericObjectCreationNugget, m_fxFinal) }, + { "OkToChangeModelColor", INI::parseBool, nullptr, offsetof(GenericObjectCreationNugget, m_okToChangeModelColor) }, + { "MinLODRequired", INI::parseStaticGameLODLevel, nullptr, offsetof(GenericObjectCreationNugget, m_minLODRequired) }, { "Shadow", INI::parseBitString32, TheShadowNames, offsetof( GenericObjectCreationNugget, m_shadowType ) }, - { "BounceSound", INI::parseAudioEventRTS, NULL, offsetof( GenericObjectCreationNugget, m_bounceSound) }, - { 0, 0, 0, 0 } + { "BounceSound", INI::parseAudioEventRTS, nullptr, offsetof( GenericObjectCreationNugget, m_bounceSound) }, + { nullptr, nullptr, nullptr, 0 } }; MultiIniFieldParse p; @@ -998,7 +998,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget for (BehaviorModule** update = obj->getBehaviorModules(); *update; ++update) { SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if (sdu != NULL) + if (sdu != nullptr) { sdu->onEnslave( sourceObj ); break; @@ -1304,20 +1304,20 @@ class GenericObjectCreationNugget : public ObjectCreationNugget { static const ThingTemplate* debrisTemplate = TheThingFactory->findTemplate("GenericDebris"); - if (m_names.empty()) - return NULL; + if (m_names.size() <= 0) + return nullptr; if (m_requiresLivePlayer && (!sourceObj || !sourceObj->getControllingPlayer() || !sourceObj->getControllingPlayer()->isPlayerActive())) - return NULL; // don't spawn useful objects for dead players. Avoid the zombie units from Yuri's. + return nullptr; // don't spawn useful objects for dead players. Avoid the zombie units from Yuri's. // Object type debris might need this information to process visual UpgradeModules. - Team *debrisOwner = ThePlayerList->getNeutralPlayer() ? ThePlayerList->getNeutralPlayer()->getDefaultTeam() : NULL; + Team *debrisOwner = ThePlayerList->getNeutralPlayer() ? ThePlayerList->getNeutralPlayer()->getDefaultTeam() : nullptr; if( sourceObj && sourceObj->getControllingPlayer() ) debrisOwner = sourceObj->getControllingPlayer()->getDefaultTeam(); - Object* container = NULL; - Object *firstObject = NULL; + Object* container = nullptr; + Object *firstObject = nullptr; if (!m_putInContainer.isEmpty()) { const ThingTemplate* containerTmpl = TheThingFactory->findTemplate(m_putInContainer); @@ -1365,14 +1365,14 @@ class GenericObjectCreationNugget : public ObjectCreationNugget firstObject = debris; } debris->setProducer(sourceObj); - if (m_preserveLayer && sourceObj != NULL && container == NULL) + if (m_preserveLayer && sourceObj != nullptr && container == nullptr) { PathfindLayerEnum layer = sourceObj->getLayer(); if (layer != LAYER_GROUND) debris->setLayer(layer); } - if (container != NULL && container->getContain() != NULL && container->getContain()->isValidContainerFor(debris, true)) + if (container != nullptr && container->getContain() != nullptr && container->getContain()->isValidContainerFor(debris, true)) container->getContain()->addToContain(debris); // if we want the objects being created to appear in a spread formation @@ -1499,13 +1499,13 @@ EMPTY_DTOR(GenericObjectCreationNugget) //------------------------------------------------------------------------------------------------- static const FieldParse TheObjectCreationListFieldParse[] = { - { "CreateObject", GenericObjectCreationNugget::parseObject, 0, 0}, - { "CreateDebris", GenericObjectCreationNugget::parseDebris, 0, 0}, - { "ApplyRandomForce", ApplyRandomForceNugget::parse, 0, 0}, - { "DeliverPayload", DeliverPayloadNugget::parse, 0, 0}, - { "FireWeapon", FireWeaponNugget::parse, 0, 0}, - { "Attack", AttackNugget::parse, 0, 0}, - { NULL, NULL, 0, 0 } + { "CreateObject", GenericObjectCreationNugget::parseObject, nullptr, 0}, + { "CreateDebris", GenericObjectCreationNugget::parseDebris, nullptr, 0}, + { "ApplyRandomForce", ApplyRandomForceNugget::parse, nullptr, 0}, + { "DeliverPayload", DeliverPayloadNugget::parse, nullptr, 0}, + { "FireWeapon", FireWeaponNugget::parse, nullptr, 0}, + { "Attack", AttackNugget::parse, nullptr, 0}, + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -1525,12 +1525,12 @@ void ObjectCreationList::addObjectCreationNugget(ObjectCreationNugget* nugget) //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Bool createOwner, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primaryObj != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primaryObj != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primaryObj, primary, secondary, createOwner, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1540,12 +1540,12 @@ Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coor //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coord3D *primary, const Coord3D* secondary, Real angle, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primaryObj != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primaryObj != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primaryObj, primary, secondary, angle, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1555,12 +1555,12 @@ Object* ObjectCreationList::createInternal( const Object* primaryObj, const Coor //------------------------------------------------------------------------------------------------- Object* ObjectCreationList::createInternal( const Object* primary, const Object* secondary, UnsignedInt lifetimeFrames ) const { - DEBUG_ASSERTCRASH(primary != NULL, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); - Object *theFirstObject = NULL; + DEBUG_ASSERTCRASH(primary != nullptr, ("You should always call OCLs with a non-null primary Obj, even for positional calls, to get team ownership right")); + Object *theFirstObject = nullptr; for (ObjectCreationNuggetVector::const_iterator i = m_nuggets.begin(); i != m_nuggets.end(); ++i) { Object *curObj = (*i)->create( primary, secondary, lifetimeFrames ); - if (theFirstObject==NULL) { + if (theFirstObject==nullptr) { theFirstObject = curObj; } } @@ -1590,12 +1590,12 @@ ObjectCreationListStore::~ObjectCreationListStore() const ObjectCreationList *ObjectCreationListStore::findObjectCreationList(const char* name) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; ObjectCreationListMap::const_iterator it = m_ocls.find(NAMEKEY(name)); if (it == m_ocls.end()) { - return NULL; + return nullptr; } else { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index e5f48c12136..8e3df913902 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -113,7 +113,7 @@ const Real HUGE_DIST_SQR = (HUGE_DIST*HUGE_DIST); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static PartitionContactList* TheContactList = NULL; +static PartitionContactList* TheContactList = nullptr; //----------------------------------------------------------------------------- // Local Types @@ -206,7 +206,7 @@ inline Bool filtersAllow(PartitionFilter **filters, Object *objOther) { for (idx = 0; idx < MAXR; ++idx) { - names[idx] = NULL; + names[idx] = nullptr; rejections[idx] = 0; usefulRejections[idx] = 0; } @@ -895,8 +895,8 @@ static Bool distCalcProc_BoundaryAndBoundary_3D( Real maxDistSqr ) { - const GeometryInfo* geomA = objA ? &objA->getGeometryInfo() : NULL; - const GeometryInfo* geomB = objB ? &objB->getGeometryInfo() : NULL; + const GeometryInfo* geomA = objA ? &objA->getGeometryInfo() : nullptr; + const GeometryInfo* geomB = objB ? &objB->getGeometryInfo() : nullptr; // note that object positions are defined as the bottom center of the geometry, // thus we must add the radius to the z coord to get the proper center of the bounding sphere. @@ -976,7 +976,7 @@ static CollideTestProc theCollideTestProcs[] = //----------------------------------------------------------------------------- // Public Data //----------------------------------------------------------------------------- -PartitionManager *ThePartitionManager = NULL; ///< the object manager singleton +PartitionManager *ThePartitionManager = nullptr; ///< the object manager singleton //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1021,7 +1021,7 @@ class PartitionContactList PartitionContactList() { memset(m_contactHash, 0, sizeof(m_contactHash)); - m_contactList = NULL; + m_contactList = nullptr; } ~PartitionContactList() @@ -1118,7 +1118,7 @@ PartitionCell *CellOutwardIterator::nextCell(Bool skipEmpties) goto try_again; } - return NULL; + return nullptr; } #endif @@ -1129,23 +1129,23 @@ PartitionCell *CellOutwardIterator::nextCell(Bool skipEmpties) //----------------------------------------------------------------------------- CellAndObjectIntersection::CellAndObjectIntersection() { - m_cell = NULL; - m_module = NULL; - m_prevCoi = NULL; - m_nextCoi = NULL; + m_cell = nullptr; + m_module = nullptr; + m_prevCoi = nullptr; + m_nextCoi = nullptr; } //----------------------------------------------------------------------------- CellAndObjectIntersection::~CellAndObjectIntersection() { - DEBUG_ASSERTCRASH(m_prevCoi == NULL && m_nextCoi == NULL, ("destroying a linked COI")); + DEBUG_ASSERTCRASH(m_prevCoi == nullptr && m_nextCoi == nullptr, ("destroying a linked COI")); DEBUG_ASSERTCRASH(!getModule(), ("destroying an in-use COI")); } //----------------------------------------------------------------------------- void CellAndObjectIntersection::friend_addToCellList(CellAndObjectIntersection **pListHead) { - DEBUG_ASSERTCRASH(m_prevCoi == NULL && m_nextCoi == NULL && *pListHead != this, ("trying to add a cell to list, but it appears to already be in a list")); + DEBUG_ASSERTCRASH(m_prevCoi == nullptr && m_nextCoi == nullptr && *pListHead != this, ("trying to add a cell to list, but it appears to already be in a list")); this->m_nextCoi = *pListHead; if (*pListHead) @@ -1157,7 +1157,7 @@ void CellAndObjectIntersection::friend_addToCellList(CellAndObjectIntersection * void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersection **pListHead) { #define DEBUG_ASSERTINLIST(c) \ - DEBUG_ASSERTCRASH((c)->m_prevCoi != NULL || (c)->m_nextCoi != NULL || *pListHead == (c), ("cell is not in list")); + DEBUG_ASSERTCRASH((c)->m_prevCoi != nullptr || (c)->m_nextCoi != nullptr || *pListHead == (c), ("cell is not in list")); DEBUG_ASSERTINLIST(this); @@ -1179,8 +1179,8 @@ void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersect this->m_nextCoi->m_prevCoi = this->m_prevCoi; } - this->m_prevCoi = NULL; - this->m_nextCoi = NULL; + this->m_prevCoi = nullptr; + this->m_nextCoi = nullptr; #undef DEBUG_ASSERTINLIST } @@ -1188,16 +1188,16 @@ void CellAndObjectIntersection::friend_removeFromCellList(CellAndObjectIntersect //----------------------------------------------------------------------------- void CellAndObjectIntersection::addCoverage(PartitionCell *cell, PartitionData *module) { - DEBUG_ASSERTCRASH(m_cell == NULL || m_cell == cell, ("mismatch")); - DEBUG_ASSERTCRASH(m_module == NULL || m_module == module, ("mismatch")); + DEBUG_ASSERTCRASH(m_cell == nullptr || m_cell == cell, ("mismatch")); + DEBUG_ASSERTCRASH(m_module == nullptr || m_module == module, ("mismatch")); - if (m_module != NULL && m_module != module) + if (m_module != nullptr && m_module != module) { DEBUG_CRASH(("COI already in use by another module!")); return; } - if (m_cell == NULL) + if (m_cell == nullptr) cell->friend_addToCellList(this); m_cell = cell; @@ -1207,15 +1207,15 @@ void CellAndObjectIntersection::addCoverage(PartitionCell *cell, PartitionData * //----------------------------------------------------------------------------- void CellAndObjectIntersection::removeAllCoverage() { - if (m_module == NULL) + if (m_module == nullptr) { DEBUG_CRASH(("COI not in use")); return; } m_cell->friend_removeFromCellList(this); - m_cell = NULL; - m_module = NULL; + m_cell = nullptr; + m_module = nullptr; } //----------------------------------------------------------------------------- @@ -1226,7 +1226,7 @@ void CellAndObjectIntersection::removeAllCoverage() PartitionCell::PartitionCell() { m_cellX = m_cellY = 0; - m_firstCoiInCell = NULL; + m_firstCoiInCell = nullptr; m_coiCount = 0; #ifdef PM_CACHE_TERRAIN_HEIGHT m_loTerrainZ = HUGE_DIST; // huge positive @@ -1255,7 +1255,7 @@ PartitionCell::PartitionCell() //----------------------------------------------------------------------------- PartitionCell::~PartitionCell() { - DEBUG_ASSERTCRASH(m_firstCoiInCell == NULL && m_coiCount == 0, ("destroying a nonempty PartitionCell")); + DEBUG_ASSERTCRASH(m_firstCoiInCell == nullptr && m_coiCount == 0, ("destroying a nonempty PartitionCell")); // but don't destroy the Cois; they don't belong to us } @@ -1492,9 +1492,9 @@ void PartitionCell::validateCoiList() { nextCoi = coi->getNextCoi(); DEBUG_ASSERTCRASH(coi->getPrevCoi() == prevCoi, ("coi link mismatch")); - DEBUG_ASSERTCRASH(prevCoi == NULL || prevCoi->getNextCoi() == coi, ("coi link mismatch")); - DEBUG_ASSERTCRASH((coi == getFirstCoiInCell()) == (prevCoi == NULL) , ("coi link mismatch")); - DEBUG_ASSERTCRASH(nextCoi == NULL || nextCoi->getPrevCoi() == coi, ("coi link mismatch")); + DEBUG_ASSERTCRASH(prevCoi == nullptr || prevCoi->getNextCoi() == coi, ("coi link mismatch")); + DEBUG_ASSERTCRASH((coi == getFirstCoiInCell()) == (prevCoi == nullptr) , ("coi link mismatch")); + DEBUG_ASSERTCRASH(nextCoi == nullptr || nextCoi->getPrevCoi() == coi, ("coi link mismatch")); } } #endif @@ -1543,18 +1543,18 @@ void PartitionCell::loadPostProcess( void ) PartitionData::PartitionData() { //DEBUG_LOG(("create pd %08lx",this)); - m_next = NULL; - m_prev = NULL; - m_nextDirty = NULL; - m_prevDirty = NULL; - m_object = NULL; - m_ghostObject = NULL; + m_next = nullptr; + m_prev = nullptr; + m_nextDirty = nullptr; + m_prevDirty = nullptr; + m_object = nullptr; + m_ghostObject = nullptr; m_coiArrayCount = 0; - m_coiArray = NULL; + m_coiArray = nullptr; m_coiInUseCount = 0; m_doneFlag = 0; m_dirtyStatus = NOT_DIRTY; - m_lastCell = NULL; + m_lastCell = nullptr; for (int i = 0; i < MAX_PLAYER_COUNT; ++i) { m_everSeenByPlayer[i] = false; @@ -1745,7 +1745,7 @@ void PartitionData::addSubPixToCoverage(PartitionCell *cell) { // see if we already have a coi for this cell. CellAndObjectIntersection *coi = m_coiArray; - CellAndObjectIntersection *coiToUse = NULL; + CellAndObjectIntersection *coiToUse = nullptr; for (Int i = __min(m_coiInUseCount,m_coiArrayCount); i; --i, ++coi) { if (coi->getCell() == cell) @@ -1754,8 +1754,8 @@ void PartitionData::addSubPixToCoverage(PartitionCell *cell) break; } } - DEBUG_ASSERTCRASH(coiToUse != NULL || m_coiInUseCount < m_coiArrayCount, ("not enough cois allocated for this object")); - if (coiToUse == NULL && m_coiInUseCount < m_coiArrayCount) + DEBUG_ASSERTCRASH(coiToUse != nullptr || m_coiInUseCount < m_coiArrayCount, ("not enough cois allocated for this object")); + if (coiToUse == nullptr && m_coiInUseCount < m_coiArrayCount) { // nope, no coi for this cell, allocate a new one coiToUse = &m_coiArray[m_coiInUseCount++]; @@ -2200,7 +2200,7 @@ Int PartitionData::calcMaxCoiForShape(GeometryType geom, Real majorRadius, Real Int PartitionData::calcMaxCoiForObject() { Object *obj = getObject(); - DEBUG_ASSERTCRASH(obj != NULL, ("must be attached to an Object here 2")); + DEBUG_ASSERTCRASH(obj != nullptr, ("must be attached to an Object here 2")); GeometryType geom = obj->getGeometryInfo().getGeomType(); Real majorRadius = obj->getGeometryInfo().getMajorRadius(); @@ -2235,7 +2235,7 @@ void PartitionData::makeDirty(Bool needToUpdateCells) //----------------------------------------------------------------------------- void PartitionData::allocCoiArray() { - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); m_coiArrayCount = calcMaxCoiForObject(); m_coiArray = MSGNEW("PartitionManager_COI") CellAndObjectIntersection[m_coiArrayCount]; // may throw! @@ -2247,7 +2247,7 @@ void PartitionData::allocCoiArray() void PartitionData::freeCoiArray() { delete [] m_coiArray; // yes, it's OK to call this on null... - m_coiArray = NULL; + m_coiArray = nullptr; m_coiArrayCount = 0; m_coiInUseCount = 0; makeDirty(true); @@ -2280,7 +2280,7 @@ void PartitionData::attachToObject(Object* object) //DEBUG_LOG(("attach pd for pd %08lx obj %08lx",this,m_object)); // (re)calc maxCoi and (re)alloc cois - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); freeCoiArray(); allocCoiArray(); // may throw! @@ -2304,16 +2304,16 @@ void PartitionData::detachFromObject() TheContactList->removeSpecificPartitionData(this); if (m_object) - m_object->friend_setPartitionData(NULL); + m_object->friend_setPartitionData(nullptr); removeAllTouchedCells(); freeCoiArray(); //DEBUG_LOG(("detach pd for pd %08lx obj %08lx",this,m_object)); // no longer attached to object - m_object = NULL; + m_object = nullptr; TheGhostObjectManager->removeGhostObject(m_ghostObject); - m_ghostObject = NULL; + m_ghostObject = nullptr; } //----------------------------------------------------------------------------- @@ -2321,11 +2321,11 @@ void PartitionData::attachToGhostObject(GhostObject* object) { // remember who contains us - m_object = NULL; //it's only attached to a ghost object, no parent object. + m_object = nullptr; //it's only attached to a ghost object, no parent object. m_ghostObject = object; // (re)calc maxCoi and (re)alloc cois - DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == NULL, ("hmm, coi should probably be null here")); + DEBUG_ASSERTCRASH(m_coiArrayCount == 0 && m_coiArray == nullptr, ("hmm, coi should probably be null here")); DEBUG_ASSERTCRASH(m_coiInUseCount == 0, ("hmm, coi count mismatch")); freeCoiArray(); @@ -2335,7 +2335,7 @@ void PartitionData::attachToGhostObject(GhostObject* object) makeDirty(true); if (m_ghostObject) - m_ghostObject->updateParentObject(NULL,this); + m_ghostObject->updateParentObject(nullptr,this); } //----------------------------------------------------------------------------- @@ -2357,8 +2357,8 @@ void PartitionData::detachFromGhostObject(void) //DEBUG_LOG(("detach pd for pd %08lx obj %08lx",this,m_object)); // no longer attached to object - m_object = NULL; - m_ghostObject = NULL; + m_object = nullptr; + m_ghostObject = nullptr; } //----------------------------------------------------------------------------- @@ -2385,12 +2385,12 @@ inline UnsignedInt hash2ints(Int a, Int b) //----------------------------------------------------------------------------- void PartitionContactList::addToContactList( PartitionData *obj, PartitionData *other ) { - if (obj == other || obj == NULL || other == NULL) + if (obj == other || obj == nullptr || other == nullptr) return; Object* obj_obj = obj->getObject(); Object* other_obj = other->getObject(); - if (obj_obj == NULL || other_obj == NULL) + if (obj_obj == nullptr || other_obj == nullptr) return; // compute hash index based on object's ids. @@ -2478,8 +2478,8 @@ void PartitionContactList::removeSpecificPartitionData(PartitionData* data) { if (cd->m_obj == data || cd->m_other == data) { - cd->m_obj = NULL; - cd->m_other = NULL; + cd->m_obj = nullptr; + cd->m_other = nullptr; } } } @@ -2496,7 +2496,7 @@ void PartitionContactList::resetContactList() } memset(m_contactHash, 0, sizeof(m_contactHash)); - m_contactList = NULL; + m_contactList = nullptr; } //----------------------------------------------------------------------------- @@ -2504,7 +2504,7 @@ void PartitionContactList::processContactList() { for (PartitionContactListNode* cd = m_contactList; cd; cd = cd->m_next) { - if (cd->m_obj == NULL || cd->m_other == NULL) + if (cd->m_obj == nullptr || cd->m_other == nullptr) continue; // we know that their partitions overlap; determine if they REALLY collide @@ -2526,8 +2526,8 @@ void PartitionContactList::processContactList() // the onCollide() calls can remove the object(s) from the partition mgr, // thus destroying the partitiondata for 'em. go ahead and null these out here // so we won't be tempted to use 'em (since they might be bogus). - cd->m_obj = NULL; - cd->m_other = NULL; + cd->m_obj = nullptr; + cd->m_other = nullptr; obj->onCollide(other, &cinfo.loc, &cinfo.normal); flipCoord3D(&cinfo.normal); @@ -2547,12 +2547,12 @@ void PartitionContactList::processContactList() // NOTE also that we re-get partitiondata from the object, since it might have been // removed from the partition system by the onCollide call... // - if (!obj->isDestroyed() && obj->friend_getPartitionData() != NULL && !obj->isKindOf(KINDOF_IMMOBILE)) + if (!obj->isDestroyed() && obj->friend_getPartitionData() != nullptr && !obj->isKindOf(KINDOF_IMMOBILE)) { //DEBUG_LOG(("%d: re-dirtying collision of %s %08lx with %s %08lx",TheGameLogic->getFrame(),obj->getTemplate()->getName().str(),obj,other->getTemplate()->getName().str(),other)); obj->friend_getPartitionData()->makeDirty(false); } - if (!other->isDestroyed() && other->friend_getPartitionData() != NULL && !other->isKindOf(KINDOF_IMMOBILE)) + if (!other->isDestroyed() && other->friend_getPartitionData() != nullptr && !other->isKindOf(KINDOF_IMMOBILE)) { //DEBUG_LOG(("%d: re-dirtying collision of %s %08lx with %s %08lx [other]",TheGameLogic->getFrame(),other->getTemplate()->getName().str(),other,obj->getTemplate()->getName().str(),obj)); other->friend_getPartitionData()->makeDirty(false); @@ -2567,15 +2567,15 @@ void PartitionContactList::processContactList() //----------------------------------------------------------------------------- PartitionManager::PartitionManager() { - m_moduleList = NULL; + m_moduleList = nullptr; m_cellSize = m_cellSizeInv = 0.0f; m_cellCountX = 0; m_cellCountY = 0; m_totalCellCount = 0; - m_cells = NULL; + m_cells = nullptr; m_worldExtents.lo.zero(); m_worldExtents.hi.zero(); - m_dirtyModules = NULL; + m_dirtyModules = nullptr; m_updatedSinceLastReset = false; #ifdef FASTER_GCO m_maxGcoRadius = 0; @@ -2623,7 +2623,7 @@ void PartitionManager::init() m_cellSizeInv = (Real)(1.0 / m_cellSize); - DEBUG_ASSERTCRASH(m_cells == NULL, ("double init")); + DEBUG_ASSERTCRASH(m_cells == nullptr, ("double init")); if (TheTerrainLogic) { @@ -2665,7 +2665,7 @@ void PartitionManager::init() m_cellCountX = 0; m_cellCountY = 0; m_totalCellCount = 0; - m_cells = NULL; + m_cells = nullptr; m_worldExtents.lo.zero(); m_worldExtents.hi.zero(); } @@ -2710,7 +2710,7 @@ void PartitionManager::shutdown() #ifdef RTS_DEBUG // the above *should* remove all the touched cells (via unRegisterObject), but let's check: - DEBUG_ASSERTCRASH( m_moduleList == NULL, ("hmm, modules left over")); + DEBUG_ASSERTCRASH( m_moduleList == nullptr, ("hmm, modules left over")); PartitionData *mod, *nextMod; for( mod = m_moduleList; mod; mod = nextMod ) { @@ -2727,7 +2727,7 @@ void PartitionManager::shutdown() resetPendingUndoShroudRevealQueue(); delete [] m_cells; - m_cells = NULL; + m_cells = nullptr; m_cellSize = m_cellSizeInv = 0.0f; m_cellCountX = 0; @@ -2761,7 +2761,7 @@ void PartitionManager::update() // save it. PartitionData *dirty = m_dirtyModules; - DEBUG_ASSERTCRASH(dirty->getObject() != NULL || dirty->getGhostObject() != NULL, + DEBUG_ASSERTCRASH(dirty->getObject() != nullptr || dirty->getGhostObject() != nullptr, ("must be attached to an Object here %08lx",dirty)); // get this BEFORE removing from dirty list, since that clears the @@ -2787,7 +2787,7 @@ void PartitionManager::update() #ifdef INTENSE_DEBUG DEBUG_ASSERTLOG(cc==0,("updated partition info for %d objects",cc)); #endif - TheContactList = NULL; + TheContactList = nullptr; processPendingUndoShroudRevealQueue(); } @@ -2859,11 +2859,11 @@ void PartitionManager::update() void PartitionManager::registerObject( Object* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // if object is already part of this system get out of here - if( object->friend_getPartitionData() != NULL ) + if( object->friend_getPartitionData() != nullptr ) { DEBUG_LOG(( "Object '%s' already registered with partition manager", object->getTemplate()->getName().str() )); @@ -2874,7 +2874,7 @@ void PartitionManager::registerObject( Object* object ) PartitionData *mod = newInstance( PartitionData ); // link the module to the list in the partition manager - mod->setPrev( NULL ); + mod->setPrev( nullptr ); mod->setNext( m_moduleList ); if( m_moduleList ) m_moduleList->setPrev( mod ); @@ -2889,26 +2889,26 @@ void PartitionManager::registerObject( Object* object ) void PartitionManager::unRegisterObject( Object* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // get the partition module PartitionData *mod = object->friend_getPartitionData(); - if( mod == NULL ) + if( mod == nullptr ) return; GhostObject *ghost; // need to figure out if any players have a fogged memory of this object. // if so, we can't remove it from the shroud system just yet. - if ((ghost=mod->getGhostObject()) != NULL && mod->wasSeenByAnyPlayers() < MAX_PLAYER_COUNT) + if ((ghost=mod->getGhostObject()) != nullptr && mod->wasSeenByAnyPlayers() < MAX_PLAYER_COUNT) { if (TheContactList) TheContactList->removeSpecificPartitionData(mod); - object->friend_setPartitionData(NULL); - mod->friend_setObject(NULL); + object->friend_setPartitionData(nullptr); + mod->friend_setObject(nullptr); //Tell the ghost object that its parent is dead. - ghost->updateParentObject(NULL, mod); + ghost->updateParentObject(nullptr, mod); return; } @@ -2934,11 +2934,11 @@ void PartitionManager::unRegisterObject( Object* object ) void PartitionManager::registerGhostObject( GhostObject* object) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // if object is already part of this system get out of here - if( object->friend_getPartitionData() != NULL ) + if( object->friend_getPartitionData() != nullptr ) { DEBUG_LOG(( "GhostObject already registered with partition manager")); return; @@ -2948,7 +2948,7 @@ void PartitionManager::registerGhostObject( GhostObject* object) PartitionData *mod = newInstance( PartitionData ); // link the module to the list in the partition manager - mod->setPrev( NULL ); + mod->setPrev( nullptr ); mod->setNext( m_moduleList ); if( m_moduleList ) m_moduleList->setPrev( mod ); @@ -2962,12 +2962,12 @@ void PartitionManager::registerGhostObject( GhostObject* object) void PartitionManager::unRegisterGhostObject( GhostObject* object ) { // sanity - if( object == NULL ) + if( object == nullptr ) return; // get the partition module PartitionData *mod = object->friend_getPartitionData(); - if( mod == NULL ) + if( mod == nullptr ) return; // detach the module from the object @@ -3255,7 +3255,7 @@ Object *PartitionManager::getClosestObjects( ++theEntrancyCount; #endif - DEBUG_ASSERTCRASH((obj==NULL) != (pos == NULL), ("either obj or pos must be null")); + DEBUG_ASSERTCRASH((obj==nullptr) != (pos == nullptr), ("either obj or pos must be null")); DistCalcProc distProc = theDistCalcProcs[dc]; @@ -3264,7 +3264,7 @@ Object *PartitionManager::getClosestObjects( if (pos) { objPos = pos; - objToUse = NULL; + objToUse = nullptr; } else { @@ -3274,7 +3274,7 @@ Object *PartitionManager::getClosestObjects( Int cellCenterX, cellCenterY; worldToCell(objPos->x, objPos->y, &cellCenterX, &cellCenterY); - Object* closestObj = NULL; + Object* closestObj = nullptr; Real closestDistSqr = maxDist * maxDist; // if it's not closer than this, we shouldn't consider it anyway... Coord3D closestVec; #if !RETAIL_COMPATIBLE_CRC // TheSuperHackers @info This should be safe to initialize because it is unused, but let us be extra safe for now. @@ -3319,7 +3319,7 @@ Object *PartitionManager::getClosestObjects( for (OffsetVec::const_iterator it = offsets.begin(); it != offsets.end(); ++it) { PartitionCell* thisCell = getCellAt(cellCenterX + it->x, cellCenterY + it->y); - if (thisCell == NULL) + if (thisCell == nullptr) continue; for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = thisCoi->getNextCoi()) @@ -3328,7 +3328,7 @@ Object *PartitionManager::getClosestObjects( Object *thisObj = thisMod->getObject(); // never compare against ourself. - if (thisObj == obj || thisObj == NULL) + if (thisObj == obj || thisObj == nullptr) continue; // since an object can exist in multiple COIs, we use this to avoid processing @@ -3391,7 +3391,7 @@ Object *PartitionManager::getClosestObjects( ++theIterFlag; PartitionCell *thisCell; - while ((thisCell = iter.nextNonEmpty()) != NULL) + while ((thisCell = iter.nextNonEmpty()) != nullptr) { CellAndObjectIntersection *nextCoi; for (CellAndObjectIntersection *thisCoi = thisCell->getFirstCoiInCell(); thisCoi; thisCoi = nextCoi) @@ -3482,7 +3482,7 @@ Object *PartitionManager::getClosestObject( Coord3D *closestDistVec ) { - return getClosestObjects(obj, NULL, maxDist, dc, filters, NULL, closestDist, closestDistVec); + return getClosestObjects(obj, nullptr, maxDist, dc, filters, nullptr, closestDist, closestDistVec); } //----------------------------------------------------------------------------- @@ -3495,7 +3495,7 @@ Object *PartitionManager::getClosestObject( Coord3D *closestDistVec ) { - return getClosestObjects(NULL, pos, maxDist, dc, filters, NULL, closestDist, closestDistVec); + return getClosestObjects(nullptr, pos, maxDist, dc, filters, nullptr, closestDist, closestDistVec); } //----------------------------------------------------------------------------- @@ -3511,7 +3511,7 @@ void PartitionManager::getVectorTo(const Object *obj, const Coord3D *pos, Distan { DistCalcProc distProc = theDistCalcProcs[dc]; Real distSqr; - (*distProc)(obj->getPosition(), obj, pos, NULL, distSqr, vec, HUGE_DIST_SQR); + (*distProc)(obj->getPosition(), obj, pos, nullptr, distSqr, vec, HUGE_DIST_SQR); } //----------------------------------------------------------------------------- @@ -3532,7 +3532,7 @@ Real PartitionManager::getDistanceSquared(const Object *obj, const Coord3D *pos, DistCalcProc distProc = theDistCalcProcs[dc]; Real thisDistSqr; Coord3D thisVec; - (*distProc)(obj->getPosition(), obj, pos, NULL, thisDistSqr, thisVec, HUGE_DIST_SQR); + (*distProc)(obj->getPosition(), obj, pos, nullptr, thisDistSqr, thisVec, HUGE_DIST_SQR); if (vec) *vec = thisVec; return thisDistSqr; @@ -3558,7 +3558,7 @@ Real PartitionManager::getGoalDistanceSquared(const Object *obj, const Coord3D * DistCalcProc distProc = theDistCalcProcs[dc]; Real thisDistSqr; Coord3D thisVec; - (*distProc)(goalPos, obj, otherPos, NULL, thisDistSqr, thisVec, HUGE_DIST_SQR); + (*distProc)(goalPos, obj, otherPos, nullptr, thisDistSqr, thisVec, HUGE_DIST_SQR); if (vec) *vec = thisVec; return thisDistSqr; @@ -3632,7 +3632,7 @@ SimpleObjectIterator *PartitionManager::iterateObjectsInRange( SimpleObjectIterator *iter = newInstance(SimpleObjectIterator); iterHolder.hold(iter); - getClosestObjects(obj, NULL, maxDist, dc, filters, iter, NULL, NULL); + getClosestObjects(obj, nullptr, maxDist, dc, filters, iter, nullptr, nullptr); iter->sort(order); iterHolder.release(); @@ -3652,7 +3652,7 @@ SimpleObjectIterator *PartitionManager::iterateObjectsInRange( SimpleObjectIterator *iter = newInstance(SimpleObjectIterator); iterHolder.hold(iter); - getClosestObjects(NULL, pos, maxDist, dc, filters, iter, NULL, NULL); + getClosestObjects(nullptr, pos, maxDist, dc, filters, iter, nullptr, nullptr); iter->sort(order); iterHolder.release(); @@ -3675,9 +3675,9 @@ SimpleObjectIterator* PartitionManager::iteratePotentialCollisions( iterHolder.hold(iter); PartitionFilterWouldCollide filter(*pos, geom, angle, true); - PartitionFilter *filters[] = { &filter, NULL }; + PartitionFilter *filters[] = { &filter, nullptr }; - getClosestObjects(NULL, pos, maxDist, use2D ? FROM_BOUNDINGSPHERE_2D : FROM_BOUNDINGSPHERE_3D, filters, iter, NULL, NULL); + getClosestObjects(nullptr, pos, maxDist, use2D ? FROM_BOUNDINGSPHERE_2D : FROM_BOUNDINGSPHERE_3D, filters, iter, nullptr, nullptr); iterHolder.release(); return iter; @@ -3703,7 +3703,7 @@ Bool PartitionManager::isColliding( const Object *a, const Object *b ) const } //See if the partition data collides. - return ad->friend_collidesWith( bd, NULL ); + return ad->friend_collidesWith( bd, nullptr ); } //----------------------------------------------------------------------------- @@ -3916,7 +3916,7 @@ Bool PartitionManager::findPositionAround( const Coord3D *center, { // sanity - if( center == NULL || result == NULL || options == NULL ) + if( center == nullptr || result == nullptr || options == nullptr ) return FALSE; Region3D extent; @@ -4413,7 +4413,7 @@ Int PartitionManager::iterateCellsAlongLine(const Coord3D& pos, const Coord3D& p for (Int curpixel = 0; curpixel <= numpixels; curpixel++) { PartitionCell* cell = getCellAt(x, y); // might be null if off the edge - DEBUG_ASSERTCRASH(cell != NULL, ("off the map")); + DEBUG_ASSERTCRASH(cell != nullptr, ("off the map")); if (cell) { Int ret = (*proc)(cell, userData); @@ -4560,7 +4560,7 @@ Bool PartitionManager::isClearLineOfSightTerrain(const Object* obj, const Coord3 */ Real maxZ; Coord2D maxZPos; - Bool valid = estimateTerrainExtremesAlongLine(pos, posOther, NULL, &maxZ, NULL, &maxZPos); + Bool valid = estimateTerrainExtremesAlongLine(pos, posOther, nullptr, &maxZ, nullptr, &maxZPos); DEBUG_ASSERTCRASH(valid, ("this should never happen unless both positions are off-map")); if (!valid) return true; @@ -4736,7 +4736,7 @@ Real PartitionManager::getGroundOrStructureHeight(Real posx, Real posy) // scan all objects in the radius of our extent and find the tallest height among them PartitionFilterAcceptByKindOf filter1( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ), KINDOFMASK_NONE ); - PartitionFilter *filters[] = { &filter1, NULL }; + PartitionFilter *filters[] = { &filter1, nullptr }; Coord3D pos; pos.x = posx; pos.y = posy; @@ -4971,7 +4971,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) // Get the controlling team of other. ContainModuleInterface* contain = other->getContain(); - const Player* otherPlayer = contain ? contain->getApparentControllingPlayer(myPlayer) : NULL; + const Player* otherPlayer = contain ? contain->getApparentControllingPlayer(myPlayer) : nullptr; if (!otherPlayer) otherPlayer = other->getControllingPlayer(); @@ -4993,7 +4993,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) return true; } - if (other->getContain() != NULL && other->isAbleToAttack()) + if (other->getContain() != nullptr && other->isAbleToAttack()) { // Don't reject garrisoned buildings that can attack return true; @@ -5176,7 +5176,7 @@ Bool PartitionFilterUnmannedObject::allow( Object *other ) //----------------------------------------------------------------------------- Bool PartitionFilterValidCommandButtonTarget::allow( Object *other ) { - return (m_commandButton->isValidToUseOn(m_source, other, NULL, m_commandSource) == m_match); + return (m_commandButton->isValidToUseOn(m_source, other, nullptr, m_commandSource) == m_match); } //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp index d31cb753e99..1e2156204bf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SimpleObjectIterator.cpp @@ -37,7 +37,7 @@ SimpleObjectIterator::ClumpCompareProc SimpleObjectIterator::theClumpCompareProcs[] = { - NULL, // "fastest" gets no proc + nullptr, // "fastest" gets no proc SimpleObjectIterator::sortNearToFar, SimpleObjectIterator::sortFarToNear, SimpleObjectIterator::sortCheapToExpensive, @@ -47,7 +47,7 @@ SimpleObjectIterator::ClumpCompareProc SimpleObjectIterator::theClumpCompareProc //============================================================================= SimpleObjectIterator::Clump::Clump() { - m_nextClump = NULL; + m_nextClump = nullptr; } //============================================================================= @@ -58,8 +58,8 @@ SimpleObjectIterator::Clump::~Clump() //============================================================================= SimpleObjectIterator::SimpleObjectIterator() { - m_firstClump = NULL; - m_curClump = NULL; + m_firstClump = nullptr; + m_curClump = nullptr; m_clumpCount = 0; } @@ -88,7 +88,7 @@ void SimpleObjectIterator::insert(Object *obj, Real numeric) //============================================================================= Object *SimpleObjectIterator::nextWithNumeric(Real *num) { - Object *obj = NULL; + Object *obj = nullptr; if (num) *num = 0.0f; @@ -121,8 +121,8 @@ void SimpleObjectIterator::makeEmpty() } DEBUG_ASSERTCRASH(m_clumpCount == 0, ("hmm")); - m_firstClump = NULL; - m_curClump = NULL; + m_firstClump = nullptr; + m_curClump = nullptr; m_clumpCount = 0; } @@ -153,8 +153,8 @@ void SimpleObjectIterator::sort(IterOrderType order) for ( Int n = 1 ; ; n *= 2 ) { Clump *to_do = m_firstClump; - Clump *tail = NULL; - m_firstClump = NULL; + Clump *tail = nullptr; + m_firstClump = nullptr; Int mergeCount = 0; @@ -225,7 +225,7 @@ void SimpleObjectIterator::sort(IterOrderType order) to_do = sub; } if (tail) - tail->m_nextClump = NULL; + tail->m_nextClump = nullptr; if (mergeCount <= 1) // when we have done just one (or none) swap, we're done break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp index 999841efe80..66a4e46383f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp @@ -64,8 +64,8 @@ BaikonurLaunchPowerModuleData::BaikonurLaunchPowerModuleData( void ) static const FieldParse dataFieldParse[] = { - { "DetonationObject", INI::parseAsciiString, NULL, offsetof( BaikonurLaunchPowerModuleData, m_detonationObject ) }, - { 0, 0, 0, 0 } + { "DetonationObject", INI::parseAsciiString, nullptr, offsetof( BaikonurLaunchPowerModuleData, m_detonationObject ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp index c0a9ba4bcac..4ef023055a5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashBountyPower.cpp @@ -86,8 +86,8 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, { CashBountyPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parsePercentToReal(ini, NULL, &up.m_bounty, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parsePercentToReal(ini, nullptr, &up.m_bounty, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -103,10 +103,10 @@ static void parseBountyUpgradePair( INI* ini, void * /*instance*/, void *store, static const FieldParse dataFieldParse[] = { #ifdef NOT_IN_USE - { "UpgradeBounty", parseBountyUpgradePair, NULL, offsetof( CashBountyPowerModuleData, m_upgrades ) }, + { "UpgradeBounty", parseBountyUpgradePair, nullptr, offsetof( CashBountyPowerModuleData, m_upgrades ) }, #endif - { "Bounty", INI::parsePercentToReal, NULL, offsetof( CashBountyPowerModuleData, m_defaultBounty ) }, - { 0, 0, 0, 0 } + { "Bounty", INI::parsePercentToReal, nullptr, offsetof( CashBountyPowerModuleData, m_defaultBounty ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -150,7 +150,7 @@ Real CashBountyPower::findBounty() const const CashBountyPowerModuleData* d = getCashBountyPowerModuleData(); #ifdef NOT_IN_USE const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgrades.begin(); it != d->m_upgrades.end(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp index 1e5b9b75d9c..f7cf07584d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CashHackSpecialPower.cpp @@ -53,8 +53,8 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store { CashHackSpecialPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parseInt(ini, NULL, &up.m_amountToSteal, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parseInt(ini, nullptr, &up.m_amountToSteal, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -68,9 +68,9 @@ static void parseCashHackUpgradePair( INI* ini, void * /*instance*/, void *store static const FieldParse dataFieldParse[] = { - { "UpgradeMoneyAmount", parseCashHackUpgradePair, NULL, offsetof( CashHackSpecialPowerModuleData, m_upgrades ) }, - { "MoneyAmount", INI::parseInt, NULL, offsetof( CashHackSpecialPowerModuleData, m_defaultAmountToSteal ) }, - { 0, 0, 0, 0 } + { "UpgradeMoneyAmount", parseCashHackUpgradePair, nullptr, offsetof( CashHackSpecialPowerModuleData, m_upgrades ) }, + { "MoneyAmount", INI::parseInt, nullptr, offsetof( CashHackSpecialPowerModuleData, m_defaultAmountToSteal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -112,7 +112,7 @@ Int CashHackSpecialPower::findAmountToSteal() const { const CashHackSpecialPowerModuleData* d = getCashHackSpecialPowerModuleData(); const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgrades.begin(); it != d->m_upgrades.end(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp index 5183b4e100c..17817785d1a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/CleanupAreaPower.cpp @@ -64,8 +64,8 @@ void CleanupAreaPowerModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "MaxMoveDistanceFromLocation", INI::parseReal, NULL, offsetof( CleanupAreaPowerModuleData, m_cleanupMoveRange ) }, - { 0, 0, 0, 0 } + { "MaxMoveDistanceFromLocation", INI::parseReal, nullptr, offsetof( CleanupAreaPowerModuleData, m_cleanupMoveRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp index 55f414cbf8e..5aa0ccd886f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DefectorSpecialPower.cpp @@ -61,8 +61,8 @@ DefectorSpecialPowerModuleData::DefectorSpecialPowerModuleData( void ) static const FieldParse dataFieldParse[] = { - { "FatCursorRadius", INI::parseReal, NULL, offsetof( DefectorSpecialPowerModuleData, m_fatCursorRadius ) }, - { 0, 0, 0, 0 } + { "FatCursorRadius", INI::parseReal, nullptr, offsetof( DefectorSpecialPowerModuleData, m_fatCursorRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp index 7d3d18fb89c..23987639e2b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/DemoralizeSpecialPower.cpp @@ -52,7 +52,7 @@ DemoralizeSpecialPowerModuleData::DemoralizeSpecialPowerModuleData( void ) m_baseDurationInFrames = 0; m_bonusDurationPerCapturedInFrames = 0; m_maxDurationInFrames = 0; - m_fxList = NULL; + m_fxList = nullptr; } @@ -64,13 +64,13 @@ void DemoralizeSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BaseRange", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_baseRange ) }, - { "BonusRangePerCaptured", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_bonusRangePerCaptured ) }, - { "MaxRange", INI::parseReal, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_maxRange ) }, - { "BaseDuration", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_baseDurationInFrames ) }, - { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, - { "MaxDuration", INI::parseDurationUnsignedInt, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_maxDurationInFrames ) }, - { "FXList", INI::parseFXList, NULL, offsetof( DemoralizeSpecialPowerModuleData, m_fxList ) }, + { "BaseRange", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_baseRange ) }, + { "BonusRangePerCaptured", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_bonusRangePerCaptured ) }, + { "MaxRange", INI::parseReal, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_maxRange ) }, + { "BaseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_baseDurationInFrames ) }, + { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, + { "MaxDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_maxDurationInFrames ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( DemoralizeSpecialPowerModuleData, m_fxList ) }, { 0, 0, 0, 0 } }; p.add( dataFieldParse ); @@ -104,7 +104,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // call the base class action cause we are *EXTENDING* functionality @@ -148,7 +148,7 @@ void DemoralizeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real PartitionFilterAcceptByKindOf filter2( MAKE_KINDOF_MASK( KINDOF_INFANTRY ), KINDOFMASK_NONE ); PartitionFilterSameMapStatus filterMapStatus(source); - PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( loc, range, FROM_CENTER_2D, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp index 523f1e89554..0f2d731c3fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/FireWeaponPower.cpp @@ -71,8 +71,8 @@ FireWeaponPowerModuleData::FireWeaponPowerModuleData( void ) static const FieldParse dataFieldParse[] = { - { "MaxShotsToFire", INI::parseUnsignedInt, NULL, offsetof( FireWeaponPowerModuleData, m_maxShotsToFire ) }, - { 0, 0, 0, 0 } + { "MaxShotsToFire", INI::parseUnsignedInt, nullptr, offsetof( FireWeaponPowerModuleData, m_maxShotsToFire ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp index 175a99b57d5..59d2773bbb9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/OCLSpecialPower.cpp @@ -59,7 +59,7 @@ static const char* const TheOCLCreateLocTypeNames[] = "USE_OWNER_OBJECT", "CREATE_ABOVE_LOCATION", "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, "Incorrect array size"); @@ -67,7 +67,7 @@ static_assert(ARRAY_SIZE(TheOCLCreateLocTypeNames) == OCL_CREATE_LOC_COUNT + 1, //------------------------------------------------------------------------------------------------- OCLSpecialPowerModuleData::OCLSpecialPowerModuleData( void ) { - m_defaultOCL = NULL; + m_defaultOCL = nullptr; m_upgradeOCL.clear(); m_createLoc = CREATE_AT_EDGE_NEAR_SOURCE; m_isOCLAdjustPositionToPassable = FALSE; @@ -79,8 +79,8 @@ static void parseOCLUpgradePair( INI* ini, void * /*instance*/, void *store, con { OCLSpecialPowerModuleData::Upgrades up; - INI::parseScience(ini, NULL, &up.m_science, NULL); - INI::parseObjectCreationList(ini, NULL, &up.m_ocl, NULL); + INI::parseScience(ini, nullptr, &up.m_science, nullptr); + INI::parseObjectCreationList(ini, nullptr, &up.m_ocl, nullptr); std::vector* s = (std::vector*)store; s->push_back(up); @@ -94,12 +94,12 @@ static void parseOCLUpgradePair( INI* ini, void * /*instance*/, void *store, con static const FieldParse dataFieldParse[] = { - { "UpgradeOCL", parseOCLUpgradePair, NULL, offsetof( OCLSpecialPowerModuleData, m_upgradeOCL ) }, - { "OCL", INI::parseObjectCreationList, NULL, offsetof( OCLSpecialPowerModuleData, m_defaultOCL ) }, + { "UpgradeOCL", parseOCLUpgradePair, nullptr, offsetof( OCLSpecialPowerModuleData, m_upgradeOCL ) }, + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( OCLSpecialPowerModuleData, m_defaultOCL ) }, { "CreateLocation", INI::parseIndexList, TheOCLCreateLocTypeNames, offsetof( OCLSpecialPowerModuleData, m_createLoc ) }, - { "ReferenceObject", INI::parseAsciiString, NULL, offsetof( OCLSpecialPowerModuleData, m_referenceThingName ) }, - { "OCLAdjustPositionToPassable", INI::parseBool, NULL, offsetof( OCLSpecialPowerModuleData, m_isOCLAdjustPositionToPassable ) }, - { 0, 0, 0, 0 } + { "ReferenceObject", INI::parseAsciiString, nullptr, offsetof( OCLSpecialPowerModuleData, m_referenceThingName ) }, + { "OCLAdjustPositionToPassable", INI::parseBool, nullptr, offsetof( OCLSpecialPowerModuleData, m_isOCLAdjustPositionToPassable ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -123,7 +123,7 @@ const ObjectCreationList* OCLSpecialPower::findOCL() const { const OCLSpecialPowerModuleData* d = getOCLSpecialPowerModuleData(); const Player* controller = getObject()->getControllingPlayer(); - if (controller != NULL) + if (controller != nullptr) { for (std::vector::const_iterator it = d->m_upgradeOCL.begin(); it != d->m_upgradeOCL.end(); @@ -152,7 +152,7 @@ void OCLSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // get the module data diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp index a90ac83b697..39da76e94ee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialAbility.cpp @@ -63,7 +63,7 @@ void SpecialAbility::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, U return; // sanity - if( loc == NULL ) + if( loc == nullptr ) return; // call the base class action cause we are *EXTENDING* functionality diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 5ab7d481272..b36aec53c50 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -61,7 +61,7 @@ SpecialPowerModuleData::SpecialPowerModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_updateModuleStartsAttack = false; m_startsPaused = FALSE; m_scriptedSpecialPowerOnly = FALSE; @@ -76,12 +76,12 @@ SpecialPowerModuleData::SpecialPowerModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, - { "UpdateModuleStartsAttack", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, - { "StartsPaused", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_startsPaused ) }, - { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerModuleData, m_initiateSound ) }, - { "ScriptedSpecialPowerOnly", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_scriptedSpecialPowerOnly ) }, - { 0, 0, 0, 0 } + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, + { "UpdateModuleStartsAttack", INI::parseBool, nullptr, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, + { "StartsPaused", INI::parseBool, nullptr, offsetof( SpecialPowerModuleData, m_startsPaused ) }, + { "InitiateSound", INI::parseAudioEventRTS, nullptr, offsetof( SpecialPowerModuleData, m_initiateSound ) }, + { "ScriptedSpecialPowerOnly", INI::parseBool, nullptr, offsetof( SpecialPowerModuleData, m_scriptedSpecialPowerOnly ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -344,7 +344,7 @@ Real SpecialPowerModule::getPercentReady() const const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); // sanity - if( modData->m_specialPowerTemplate == NULL ) + if( modData->m_specialPowerTemplate == nullptr ) return 0.0f; UnsignedInt readyFrame = m_availableOnFrame; @@ -397,7 +397,7 @@ void SpecialPowerModule::startPowerRecharge() const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); // sanity - if( modData->m_specialPowerTemplate == NULL ) + if( modData->m_specialPowerTemplate == nullptr ) { DEBUG_CRASH(("special power not found")); return; @@ -497,7 +497,7 @@ void SpecialPowerModule::createViewObject( const Coord3D *location ) const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); const SpecialPowerTemplate *powerTemplate = modData->m_specialPowerTemplate; - if( modData == NULL || powerTemplate == NULL ) + if( modData == nullptr || powerTemplate == nullptr ) return; Real visionRange = powerTemplate->getViewObjectRange(); @@ -511,12 +511,12 @@ void SpecialPowerModule::createViewObject( const Coord3D *location ) return; const ThingTemplate *viewObjectTemplate = TheThingFactory->findTemplate( objectName ); - if( viewObjectTemplate == NULL ) + if( viewObjectTemplate == nullptr ) return; Object *viewObject = TheThingFactory->newObject( viewObjectTemplate, getObject()->getControllingPlayer()->getDefaultTeam() ); - if( viewObject == NULL ) + if( viewObject == nullptr ) return; viewObject->setPosition( location ); @@ -679,7 +679,7 @@ void SpecialPowerModule::doSpecialPower( UnsignedInt commandOptions ) //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, NULL, NULL, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, nullptr, nullptr, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -687,7 +687,7 @@ void SpecialPowerModule::doSpecialPower( UnsignedInt commandOptions ) //is the napalm strike. If we don't call this now, it's up to the update module to do so. if( !getSpecialPowerModuleData()->m_updateModuleStartsAttack ) { - triggerSpecialPower( NULL );// Location-less trigger + triggerSpecialPower( nullptr );// Location-less trigger } } @@ -701,7 +701,7 @@ void SpecialPowerModule::doSpecialPowerAtObject( Object *obj, UnsignedInt comman //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( obj, NULL, NULL, commandOptions ); + initiateIntentToDoSpecialPower( obj, nullptr, nullptr, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -723,7 +723,7 @@ void SpecialPowerModule::doSpecialPowerAtLocation( const Coord3D *loc, Real angl //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, loc, NULL, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, loc, nullptr, commandOptions ); #if RETAIL_COMPATIBLE_CRC // TheSuperHackers @info we need to leave early if we are in the MissileLauncherBuildingUpdate crash fix codepath @@ -751,7 +751,7 @@ void SpecialPowerModule::doSpecialPowerUsingWaypoints( const Waypoint *way, Unsi //This tells the update module that we want to do our special power. The update modules //will then start processing each frame. - initiateIntentToDoSpecialPower( NULL, NULL, way, commandOptions ); + initiateIntentToDoSpecialPower( nullptr, nullptr, way, commandOptions ); //Only trigger the special power immediately if the updatemodule doesn't start the attack. //An example of a case that wouldn't trigger immediately is for a unit that needs to @@ -759,7 +759,7 @@ void SpecialPowerModule::doSpecialPowerUsingWaypoints( const Waypoint *way, Unsi //is the napalm strike. If we don't call this now, it's up to the update module to do so. if( !getSpecialPowerModuleData()->m_updateModuleStartsAttack ) { - triggerSpecialPower( NULL );// This type doesn't create view objects + triggerSpecialPower( nullptr );// This type doesn't create view objects } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp index a9891985b94..bcf310cbd7e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpyVisionSpecialPower.cpp @@ -55,10 +55,10 @@ void SpyVisionSpecialPowerModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BaseDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_baseDurationInFrames ) }, - { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, - { "MaxDuration", INI::parseDurationUnsignedInt, NULL, offsetof( SpyVisionSpecialPowerModuleData, m_maxDurationInFrames ) }, - { 0, 0, 0, 0 } + { "BaseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_baseDurationInFrames ) }, + { "BonusDurationPerCaptured", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_bonusDurationPerCapturedInFrames ) }, + { "MaxDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( SpyVisionSpecialPowerModuleData, m_maxDurationInFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 821a56e7eb4..9f085c94a4a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -79,7 +79,7 @@ AIUpdateModuleData::AIUpdateModuleData() { //m_locomotorTemplates -- nothing to do for (int i = 0; i < MAX_TURRETS; i++) - m_turretData[i] = NULL; + m_turretData[i] = nullptr; m_autoAcquireEnemiesWhenIdle = 0; m_moodAttackCheckRate = LOGICFRAMES_PER_SECOND * 2; #ifdef ALLOW_SURRENDER @@ -107,12 +107,12 @@ AIUpdateModuleData::~AIUpdateModuleData() const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(LocomotorSetType t) const { if (m_locomotorTemplates.empty()) - return NULL; + return nullptr; LocomotorTemplateMap::const_iterator it = m_locomotorTemplates.find(t); if (it == m_locomotorTemplates.end()) { - return NULL; + return nullptr; } else { @@ -127,16 +127,16 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L static const FieldParse dataFieldParse[] = { - { "Turret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[0]) }, - { "AltTurret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[1]) }, + { "Turret", AIUpdateModuleData::parseTurret, nullptr, offsetof(AIUpdateModuleData, m_turretData[0]) }, + { "AltTurret", AIUpdateModuleData::parseTurret, nullptr, offsetof(AIUpdateModuleData, m_turretData[1]) }, { "AutoAcquireEnemiesWhenIdle", INI::parseBitString32, TheAutoAcquireEnemiesNames, offsetof(AIUpdateModuleData, m_autoAcquireEnemiesWhenIdle) }, - { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, + { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, nullptr, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, #ifdef ALLOW_SURRENDER - { "SurrenderDuration", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_surrenderDuration) }, + { "SurrenderDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(AIUpdateModuleData, m_surrenderDuration) }, #endif - { "ForbidPlayerCommands", INI::parseBool, NULL, offsetof(AIUpdateModuleData, m_forbidPlayerCommands) }, - { "TurretsLinked", INI::parseBool, NULL, offsetof( AIUpdateModuleData, m_turretsLinked ) }, - { 0, 0, 0, 0 } + { "ForbidPlayerCommands", INI::parseBool, nullptr, offsetof(AIUpdateModuleData, m_forbidPlayerCommands) }, + { "TurretsLinked", INI::parseBool, nullptr, offsetof( AIUpdateModuleData, m_turretsLinked ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -210,7 +210,7 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_priorWaypointID = 0xfacade; m_currentWaypointID = 0xfacade; - m_stateMachine = NULL; + m_stateMachine = nullptr; m_nextEnemyScanTime = 0; m_currentVictimID = INVALID_ID; m_desiredSpeed = FAST_AS_POSSIBLE; @@ -219,12 +219,12 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_guardTargetType[0] = m_guardTargetType[1] = GUARDTARGET_NONE; m_locationToGuard.zero(); m_objectToGuard = INVALID_ID; - m_areaToGuard = NULL; - m_attackInfo = NULL; + m_areaToGuard = nullptr; + m_attackInfo = nullptr; m_waypointCount = 0; m_waypointIndex = 0; - m_completedWaypoint = NULL; - m_path = NULL; + m_completedWaypoint = nullptr; + m_path = nullptr; m_requestedVictimID = INVALID_ID; m_requestedDestination.zero(); m_requestedDestination2.zero(); @@ -245,12 +245,12 @@ AIUpdateInterface::AIUpdateInterface( Thing *thing, const ModuleData* moduleData m_moveOutOfWay1 = INVALID_ID; m_moveOutOfWay2 = INVALID_ID; m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; m_curLocomotorSet = LOCOMOTORSET_INVALID; m_locomotorGoalType = NONE; m_locomotorGoalData.zero(); for (i = 0; i < MAX_TURRETS; i++) - m_turretAI[i] = NULL; + m_turretAI[i] = nullptr; m_turretSyncFlag = TURRET_INVALID; m_attitude = ATTITUDE_NORMAL; m_nextMoodCheckTime = 0; @@ -315,7 +315,7 @@ void AIUpdateInterface::setSurrendered( const Object *objWeSurrenderedTo, Bool s if (m_surrenderedFramesLeft < d->m_surrenderDuration) m_surrenderedFramesLeft = d->m_surrenderDuration; - const Player* playerWeSurrenderedTo = objWeSurrenderedTo ? objWeSurrenderedTo->getControllingPlayer() : NULL; + const Player* playerWeSurrenderedTo = objWeSurrenderedTo ? objWeSurrenderedTo->getControllingPlayer() : nullptr; m_surrenderedPlayerIndex = playerWeSurrenderedTo ? playerWeSurrenderedTo->getPlayerIndex() : -1; if (!wasSurrendered) @@ -356,7 +356,7 @@ void AIUpdateInterface::setGoalPositionClipped(const Coord3D* in, CommandSourceT if (cmdSource == CMD_FROM_PLAYER) { Real fudge = TheGlobalData->m_partitionCellSize * 0.5f; - if (getObject()->isKindOf(KINDOF_AIRCRAFT) && getObject()->isSignificantlyAboveTerrain() && m_curLocomotor != NULL) + if (getObject()->isKindOf(KINDOF_AIRCRAFT) && getObject()->isSignificantlyAboveTerrain() && m_curLocomotor != nullptr) { // aircraft must stay further away from the map edges, to prevent getting "lost" fudge = max(fudge, m_curLocomotor->getPreferredHeight()); @@ -384,7 +384,7 @@ void AIUpdateInterface::setGoalPositionClipped(const Coord3D* in, CommandSourceT } else { - getStateMachine()->setGoalPosition(NULL); + getStateMachine()->setGoalPosition(nullptr); } } @@ -433,7 +433,7 @@ void AIUpdateInterface::doPathfind( PathfindServicesInterface *pathfinder ) return; } if (m_isAttackPath) { - Object *victim = NULL; + Object *victim = nullptr; if (m_requestedVictimID != INVALID_ID) { victim = TheGameLogic->findObjectByID(m_requestedVictimID); } @@ -601,7 +601,7 @@ void AIUpdateInterface::setPathFromWaypoint(const Waypoint *way, const Coord2D * Coord3D wayPos = *way->getLocation(); wayPos.x += offset->x; wayPos.y += offset->y; - if (way->getLink(0) == NULL) { + if (way->getLink(0) == nullptr) { TheAI->pathfinder()->snapPosition(getObject(), &wayPos); } m_path->appendNode( &wayPos, LAYER_GROUND ); @@ -623,7 +623,7 @@ void AIUpdateInterface::onObjectCreated() // create the behavior state machine. // can't do this in the ctor because makeStateMachine is a protected virtual func, // and overrides to virtual funcs don't exist in our ctor. (look it up.) - if (m_stateMachine == NULL) + if (m_stateMachine == nullptr) { m_stateMachine = makeStateMachine(); m_stateMachine->initDefaultState(); @@ -634,7 +634,7 @@ void AIUpdateInterface::onObjectCreated() AIUpdateInterface::~AIUpdateInterface( void ) { m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; if( m_stateMachine ) { m_stateMachine->halt(); @@ -644,11 +644,11 @@ AIUpdateInterface::~AIUpdateInterface( void ) for (int i = 0; i < MAX_TURRETS; i++) { deleteInstance(m_turretAI[i]); - m_turretAI[i] = NULL; + m_turretAI[i] = nullptr; } - m_stateMachine = NULL; + m_stateMachine = nullptr; - // destroy the current path. (destroyPath is NULL savvy) + // destroy the current path. (destroyPath is nullptr savvy) destroyPath(); } @@ -674,7 +674,7 @@ Object* AIUpdateInterface::getTurretTargetObject( WhichTurretType tur, Bool clea return obj; } } - return NULL; + return nullptr; } //============================================================================= @@ -754,7 +754,7 @@ Bool AIUpdateInterface::getTurretRotAndPitch(WhichTurretType tur, Real* turretAn //============================================================================= Real AIUpdateInterface::getTurretTurnRate(WhichTurretType tur) const { - return (tur != TURRET_INVALID && m_turretAI[tur] != NULL) ? + return (tur != TURRET_INVALID && m_turretAI[tur] != nullptr) ? m_turretAI[tur]->getTurnRate() : 0.0f; } @@ -790,7 +790,7 @@ WhichTurretType AIUpdateInterface::getWhichTurretForWeaponSlot(WeaponSlotType ws //============================================================================= Real AIUpdateInterface::getCurLocomotorSpeed() const { - if (m_curLocomotor != NULL) + if (m_curLocomotor != nullptr) return m_curLocomotor->getMaxSpeedForCondition(getObject()->getBodyModule()->getDamageState()); DEBUG_LOG(("no current locomotor!")); @@ -833,7 +833,7 @@ Bool AIUpdateInterface::chooseLocomotorSetExplicit(LocomotorSetType wst) if (set) { m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; for (size_t i = 0; i < set->size(); ++i) { const LocomotorTemplate* lt = set->at(i); @@ -853,9 +853,9 @@ void AIUpdateInterface::chooseGoodLocomotorFromCurrentSet( void ) Locomotor* newLoco = TheAI->pathfinder()->chooseBestLocomotorForPosition(getObject()->getLayer(), &m_locomotorSet, getObject()->getPosition()); - if (newLoco == NULL) + if (newLoco == nullptr) { - if (prevLoco != NULL) + if (prevLoco != nullptr) { /* due to physics, we might slight into a cell for which we have no loco (eg, cliff) and get stuck. this is bad. as a solution, we do this. @@ -911,7 +911,7 @@ Object* AIUpdateInterface::checkForCrateToPickup() } } } - return NULL; + return nullptr; } #ifdef ALLOW_SURRENDER @@ -1007,7 +1007,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) m_isInUpdate = TRUE; - m_completedWaypoint = NULL; // Reset so state machine update can set it if we just completed the path. + m_completedWaypoint = nullptr; // Reset so state machine update can set it if we just completed the path. // assume we can sleep forever, unless the state machine (or turret, etc) demand otherwise UpdateSleepTime subMachineSleep = UPDATE_SLEEP_FOREVER; @@ -1058,7 +1058,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) TheAI->pathfinder()->updateGoal(getObject(), &goalPos, getObject()->getLayer()); } m_movementComplete = FALSE; - ignoreObstacle(NULL); + ignoreObstacle(nullptr); } UnsignedInt now = TheGameLogic->getFrame(); @@ -1131,7 +1131,7 @@ UpdateSleepTime AIUpdateInterface::update( void ) m_isInUpdate = FALSE; - if (m_completedWaypoint != NULL) + if (m_completedWaypoint != nullptr) { // sleep NONE here so that it will get reset next frame. // this happen infrequently, so it shouldn't be an issue. @@ -1438,7 +1438,7 @@ Bool AIUpdateInterface::processCollision(PhysicsBehavior *physics, Object *other return FALSE; AIUpdateInterface* aiOther = other->getAI(); - if (aiOther == NULL) + if (aiOther == nullptr) return FALSE; Bool selfMoving = isMoving(); @@ -1485,7 +1485,7 @@ Bool AIUpdateInterface::processCollision(PhysicsBehavior *physics, Object *other } #define dont_MOVE_AROUND // It just causes more problems than it fixes. jba. #ifdef MOVE_AROUND - if (m_curLocomotor!=NULL && (other->isKindOf(KINDOF_INFANTRY)==getObject()->isKindOf(KINDOF_INFANTRY))) { + if (m_curLocomotor!= nullptr && (other->isKindOf(KINDOF_INFANTRY)==getObject()->isKindOf(KINDOF_INFANTRY))) { Real myMaxSpeed = m_curLocomotor->getMaxSpeedForCondition(getObject()->getBodyModule()->getDamageState()); Locomotor *hisLoco = aiOther->getCurLocomotor(); if (hisLoco) { @@ -1620,9 +1620,9 @@ Bool AIUpdateInterface::computeQuickPath( const Coord3D *destination ) // First, see if our path already goes to the destination. if (m_path) { - PathNode *closeNode = NULL; + PathNode *closeNode = nullptr; closeNode = m_path->getLastNode(); - if (closeNode && closeNode->getNextOptimized()==NULL) { + if (closeNode && closeNode->getNextOptimized()==nullptr) { Real dxSqr = destination->x - closeNode->getPosition()->x; dxSqr *= dxSqr; Real dySqr = destination->y - closeNode->getPosition()->y; @@ -1699,7 +1699,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co } } - Path *theNewPath = NULL; + Path *theNewPath = nullptr; TheAI->pathfinder()->setIgnoreObstacleID( getIgnoredObstacleID() ); Coord3D originalDestination = *destination; @@ -1714,7 +1714,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co PathfindLayerEnum destinationLayer = TheTerrainLogic->getLayerForDestination(destination); if (TheAI->pathfinder()->validMovementPosition( getObject()->getCrusherLevel()>0, destinationLayer, m_locomotorSet, destination ) == FALSE) { - theNewPath = NULL; + theNewPath = nullptr; } else { @@ -1727,7 +1727,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co destination); } } - if (theNewPath==NULL && m_path==NULL) { + if (theNewPath==nullptr && m_path==nullptr) { Real pathCostFactor = 0.0f; theNewPath = pathServices->findClosestPath( getObject(), m_locomotorSet, getObject()->getPosition(), destination, m_isBlockedAndStuck, pathCostFactor, FALSE ); @@ -1807,7 +1807,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic Object* source = getObject(); if (!victim && !victimPos) { - //CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() - victim is NULL")); + //CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() - victim is null")); return FALSE; } @@ -1825,7 +1825,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic // is our weapon within attack range? // if so, just return TRUE with no path. - if (victim != NULL) + if (victim != nullptr) { if (weapon->isWithinAttackRange(source, victim)) { @@ -1843,14 +1843,14 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic } } - else if (victimPos != NULL) + else if (victimPos != nullptr) { if (weapon->isWithinAttackRange(source, victimPos)) { Bool viewBlocked = FALSE; if (isDoingGroundMovement()) { - viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), NULL, *victimPos); + viewBlocked = TheAI->pathfinder()->isAttackViewBlockedByObstacle(source, *source->getPosition(), nullptr, *victimPos); } if (!viewBlocked) { destroyPath(); @@ -1872,7 +1872,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic getCurLocomotor()->setNoSlowDownAsApproachingDest(TRUE); } Bool ok = computePath(pathServices, &tmp); - if (m_path==NULL) return false; + if (m_path==nullptr) return false; Real dx, dy; dx = victimPos->x - m_path->getLastNode()->getPosition()->x; dy = victimPos->y - m_path->getLastNode()->getPosition()->y; @@ -1895,7 +1895,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic Coord3D localVictimPos; - if (victim != NULL) + if (victim != nullptr) { if (victim->isKindOf(KINDOF_BRIDGE)) { @@ -1927,16 +1927,16 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic // build a trivial one-node path containing destination weapon->computeApproachTarget(getObject(), victim, &localVictimPos, 0, localVictimPos); - //DEBUG_ASSERTCRASH(weapon->isGoalPosWithinAttackRange(getObject(), &localVictimPos, victim, victimPos, NULL), + //DEBUG_ASSERTCRASH(weapon->isGoalPosWithinAttackRange(getObject(), &localVictimPos, victim, victimPos, nullptr), // ("position we just calced is not acceptable")); // First, see if our path already goes to the destination. if (m_path) { - PathNode *startNode, *closeNode = NULL; + PathNode *startNode, *closeNode = nullptr; startNode = m_path->getFirstNode(); closeNode = startNode->getNextOptimized(); - if (closeNode && closeNode->getNextOptimized()==NULL) { + if (closeNode && closeNode->getNextOptimized()==nullptr) { Real dxSqr = localVictimPos.x - closeNode->getPosition()->x; dxSqr *= dxSqr; Real dySqr = localVictimPos.y - closeNode->getPosition()->y; @@ -1984,7 +1984,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic m_path = pathServices->findClosestPath(getObject(), m_locomotorSet, getObject()->getPosition(), &objPos, false, 0.2f, true ); } - if (m_path==NULL) { + if (m_path==nullptr) { return false; } } @@ -2013,13 +2013,13 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic //------------------------------------------------------------------------------------------------- /** - * Destroy the current path, and set it to NULL + * Destroy the current path, and set it to null */ void AIUpdateInterface::destroyPath( void ) { // destroy previous path deleteInstance(m_path); - m_path = NULL; + m_path = nullptr; m_waitingForPath = FALSE; // we no longer need it. //CRCDEBUG_LOG(("AIUpdateInterface::destroyPath() - m_isAttackPath = FALSE for object %d", getObject()->getID())); @@ -2080,7 +2080,7 @@ Bool AIUpdateInterface::isPathAvailable( const Coord3D *destination ) const { // sanity - if( destination == NULL ) + if( destination == nullptr ) return FALSE; const Coord3D *myPos = getObject()->getPosition(); @@ -2097,7 +2097,7 @@ Bool AIUpdateInterface::isQuickPathAvailable( const Coord3D *destination ) const { // sanity - if( destination == NULL ) + if( destination == nullptr ) return FALSE; const Coord3D *myPos = getObject()->getPosition(); @@ -2297,7 +2297,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void ) m_curMaxBlockedSpeed = FAST_AS_POSSIBLE; } - if (m_curLocomotor != NULL + if (m_curLocomotor != nullptr && m_locomotorGoalType == NONE && m_doFinalPosition == FALSE && m_isBlocked == FALSE @@ -2366,7 +2366,7 @@ Bool AIUpdateInterface::isDoingGroundMovement(void) const return FALSE; // air only loco. } - if (m_curLocomotor == NULL) + if (m_curLocomotor == nullptr) { return FALSE; // No loco, so we aren't moving. } @@ -2386,7 +2386,7 @@ Bool AIUpdateInterface::isDoingGroundMovement(void) const // if we're airborne and "allowed to fall", we are probably deliberately in midair // due to rappel or accident... const PhysicsBehavior* physics = getObject()->getPhysics(); - if (getObject()->isAboveTerrain() && physics != NULL && physics->getAllowToFall()) + if (getObject()->isAboveTerrain() && physics != nullptr && physics->getAllowToFall()) { return FALSE; } @@ -2403,7 +2403,7 @@ destinations, and this routine identifies non-ground units that should unstack. Bool AIUpdateInterface::isAircraftThatAdjustsDestination(void) const { - if (m_curLocomotor == NULL) + if (m_curLocomotor == nullptr) { return FALSE; // No loco, so we aren't moving. } @@ -2540,9 +2540,9 @@ void AIUpdateInterface::joinTeam( void ) chooseLocomotorSet(LOCOMOTORSET_NORMAL); getStateMachine()->clear(); - getStateMachine()->setGoalWaypoint(NULL); + getStateMachine()->setGoalWaypoint(nullptr); Object *obj = getObject(); - Object *other = NULL; + Object *other = nullptr; Team *team = obj->getTeam(); for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -3103,7 +3103,7 @@ void AIUpdateInterface::privateIdle(CommandSourceType cmdSource) for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it) { Object* obj = *it; - AIUpdateInterface* ai = obj ? obj->getAI() : NULL; + AIUpdateInterface* ai = obj ? obj->getAI() : nullptr; if (ai) ai->aiIdle(cmdSource); } @@ -3165,7 +3165,7 @@ void AIUpdateInterface::privateTightenToPosition( const Coord3D *pos, CommandSou if (getObject()->isMobile() == FALSE) return; getStateMachine()->clear(); - getStateMachine()->setGoalObject( NULL ); + getStateMachine()->setGoalObject( nullptr ); setGoalPositionClipped(pos, cmdSource); setLastCommandSource( cmdSource ); getStateMachine()->setState( AI_MOVE_AND_TIGHTEN ); @@ -3236,18 +3236,18 @@ void AIUpdateInterface::privateMoveAwayFromUnit( Object *unit, CommandSourceType m_moveOutOfWay2 = m_moveOutOfWay1; m_moveOutOfWay1 = id; Object *obj2 = TheGameLogic->findObjectByID(m_moveOutOfWay2); - Path *path2 = NULL; + Path *path2 = nullptr; if (obj2 && obj2->getAI()) { path2 = obj2->getAI()->getPath(); } - Path* unitPath = NULL; + Path* unitPath = nullptr; if (unit && unit->getAI()) { unitPath = unit->getAI()->getPath(); } - if (unitPath == NULL) return; + if (unitPath == nullptr) return; Path *newPath = TheAI->pathfinder()->getMoveAwayFromPath(getObject(), unit, unitPath, obj2, path2); - if (newPath==NULL && !canPathThroughUnits()) { + if (newPath==nullptr && !canPathThroughUnits()) { setCanPathThroughUnits(TRUE); newPath = TheAI->pathfinder()->getMoveAwayFromPath(getObject(), unit, unitPath, obj2, path2); } @@ -3368,14 +3368,14 @@ void AIUpdateInterface::privateFollowPathAppend( const Coord3D *pos, CommandSour std::vector path; path.push_back( *getGoalPosition() ); path.push_back( *pos ); - privateFollowPath( &path, NULL, cmdSource, false ); + privateFollowPath( &path, nullptr, cmdSource, false ); } else { //Hopefully we're idle or doing something that doesn't require movement. std::vector path; path.push_back( *pos ); - privateFollowPath( &path, NULL, cmdSource, false ); + privateFollowPath( &path, nullptr, cmdSource, false ); } } @@ -3517,7 +3517,7 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT //chooseLocomotorSet(LOCOMOTORSET_NORMAL); Coord3D localPos = *pos; - pos = NULL; + pos = nullptr; // ick... rather grody hack for disarming stuff. if we attack a position, // but have a "continue range" for the weapon, try to find a suitable object @@ -3530,7 +3530,7 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT getObject()->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, getObject(), cmdSource); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter *filters[] = { &filterAttack, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAttack, &filterMapStatus, nullptr }; Object* victim = ThePartitionManager->getClosestObject(&localPos, continueRange, FROM_CENTER_2D, filters); getObject()->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) ); @@ -3568,9 +3568,9 @@ void AIUpdateInterface::privateAttackPosition( const Coord3D *pos, Int maxShotsT getStateMachine()->setState( AI_ATTACK_POSITION ); - //Set the goal object to NULL because if we are attacking a location, we need to be able to move up to it properly. + //Set the goal object to nullptr because if we are attacking a location, we need to be able to move up to it properly. //When this isn't set, the move aborts before getting into firing range, thus deadlocks. - getStateMachine()->setGoalObject( NULL ); + getStateMachine()->setGoalObject( nullptr ); // do this after setting it as the current state, as the max-shots-to-fire is reset in AttackState::onEnter() weapon = getObject()->getCurrentWeapon(); @@ -4198,14 +4198,14 @@ void AIUpdateInterface::transferAttack(ObjectID fromID, ObjectID toID) */ void AIUpdateInterface::setCurrentVictim( const Object *victim ) { - if (victim == NULL) + if (victim == nullptr) { // be paranoid, in case we are called from dtors, etc. if (m_currentVictimID != INVALID_ID) { Object* self = getObject(); Object* target = TheGameLogic->findObjectByID(m_currentVictimID); - if (self != NULL && target != NULL) + if (self != nullptr && target != nullptr) { AIUpdateInterface* targetAI = target->getAI(); if (targetAI) @@ -4234,7 +4234,7 @@ Object *AIUpdateInterface::getCurrentVictim( void ) const if (m_currentVictimID != INVALID_ID) return TheGameLogic->findObjectByID( m_currentVictimID ); - return NULL; + return nullptr; } // if we are attacking a position (and NOT an object), return it. otherwise return null. @@ -4248,7 +4248,7 @@ const Coord3D *AIUpdateInterface::getCurrentVictimPos( void ) const } } - return NULL; + return nullptr; } @@ -4302,7 +4302,7 @@ Object* AIUpdateInterface::getEnterTarget() if( stateType != AI_ENTER && stateType != AI_GUARD_TUNNEL_NETWORK && stateType != AI_GET_REPAIRED ) - return NULL; + return nullptr; return getStateMachine()->getGoalObject(); } @@ -4360,7 +4360,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixValue( void ) const } else { - if (m_turretAI[0] != NULL) + if (m_turretAI[0] != nullptr) { returnVal |= MM_UnitType_Turreted; } @@ -4504,10 +4504,10 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring // if we're dead, we can't attack if (obj->isEffectivelyDead()) - return NULL; + return nullptr; if (obj->testStatus(OBJECT_STATUS_IS_USING_ABILITY)) { - return NULL; // we are doing a special ability. Shouldn't auto-acquire a target at this time. jba. + return nullptr; // we are doing a special ability. Shouldn't auto-acquire a target at this time. jba. } const AIUpdateModuleData* d = getAIUpdateModuleData(); @@ -4516,14 +4516,14 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { if ((d->m_autoAcquireEnemiesWhenIdle & AAS_Idle) == 0) { - return NULL; + return nullptr; } } // srj sez: this should ignore calledDuringIdle, despite what the name of the bit implies. if (isAttacking() && BitIsSet(d->m_autoAcquireEnemiesWhenIdle, AAS_Idle_Not_While_Attacking)) { - return NULL; + return nullptr; } //Check if unit is stealthed... is so we won't acquire targets unless he has @@ -4539,7 +4539,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { // Sorry, stealthed and not allowed to idle fire when stealthed. // Being in a firing container is an exception to this veto. - return NULL; + return nullptr; } } } @@ -4548,7 +4548,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring UnsignedInt now = TheGameLogic->getFrame(); // Check if team auto targets same victim. - Object *teamVictim = NULL; + Object *teamVictim = nullptr; if (calledByAI && obj->getTeam()->getPrototype()->getTemplateInfo()->m_attackCommonTarget) { teamVictim = obj->getTeam()->getTeamTargetObject(); @@ -4557,7 +4557,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring // like toxin tractors shouldn't acquire aircraft. jba. [8/27/2003] CanAttackResult result = obj->getAbleToAttackSpecificObject( ATTACK_NEW_TARGET, teamVictim, CMD_FROM_AI ); if( result != ATTACKRESULT_POSSIBLE && result != ATTACKRESULT_POSSIBLE_AFTER_MOVING ) { - teamVictim = NULL; // Can't attack him. jba [8/27/2003] + teamVictim = nullptr; // Can't attack him. jba [8/27/2003] } } @@ -4571,7 +4571,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { // make sure it's time to check again. if (now < m_nextMoodCheckTime) - return NULL; + return nullptr; Int checkRate = d->m_moodAttackCheckRate; m_nextMoodCheckTime = now + checkRate; @@ -4587,7 +4587,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring Real rangeToFindWithin = TheAI->getAdjustedVisionRangeForObject(obj, AI_VISIONFACTOR_OWNERTYPE | AI_VISIONFACTOR_MOOD); if (rangeToFindWithin <= 0.0f) - return NULL; + return nullptr; //If we are contained by an object, add it's bounding radius so that large buildings can auto acquire everything in //outer ranges. Calculating this from the center is bad... although this code makes it possible to acquire a target @@ -4603,7 +4603,7 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { BodyModuleInterface *bmi = obj->getBodyModule(); if (!bmi) - return NULL; + return nullptr; //Kris: August 26, 2003 //Do not allow units that healed me to get acquired! They are our friends!!! @@ -4657,7 +4657,7 @@ DEBUG_LOG(("GNMT frame %d: %s %08lx (con %s %08lx) uses range %f, flags %08lx, % container, rangeToFindWithin, flags, - getAttackInfo() != NULL && getAttackInfo() != TheScriptEngine->getDefaultAttackInfo() ? "ATTACKINFO," : "", + getAttackInfo() != nullptr && getAttackInfo() != TheScriptEngine->getDefaultAttackInfo() ? "ATTACKINFO," : "", newVictim ? newVictim->getTemplate()->getName().str() : "", newVictim )); @@ -4686,7 +4686,7 @@ Bool AIUpdateInterface::hasNationalism() const { ///@todo Find a better way to represent nationalism without hard coding here (CBD) static const UpgradeTemplate *nationalismTemplate = TheUpgradeCenter->findUpgrade( "Upgrade_Nationalism" ); - if (nationalismTemplate != NULL) + if (nationalismTemplate != nullptr) { return player->hasUpgradeComplete( nationalismTemplate ); } @@ -4702,7 +4702,7 @@ Bool AIUpdateInterface::hasFanaticism() const { ///@todo Find a better way to represent fanaticism without hard coding here (MAL) static const UpgradeTemplate *fanaticismTemplate = TheUpgradeCenter->findUpgrade( "Upgrade_Fanaticism" ); - if (fanaticismTemplate != NULL) + if (fanaticismTemplate != nullptr) { return player->hasUpgradeComplete( fanaticismTemplate ); } @@ -5127,7 +5127,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) } xfer->xferBool(&m_waitingForPath); - Bool gotPath = (m_path != NULL); + Bool gotPath = (m_path != nullptr); xfer->xferBool(&gotPath); if (xfer->getXferMode() == XFER_LOAD) { if (gotPath) { @@ -5206,7 +5206,7 @@ void AIUpdateInterface::xfer( Xfer *xfer ) // xferSelfAndCurLocoPtr() to continue to require a pristine, // empty set. (srj) m_locomotorSet.clear(); - m_curLocomotor = NULL; + m_curLocomotor = nullptr; } m_locomotorSet.xferSelfAndCurLocoPtr(xfer, &m_curLocomotor); xfer->xferUser(&m_curLocomotorSet, sizeof(m_curLocomotorSet)); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp index 32ec0f80af8..a2993b1ea87 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp @@ -159,7 +159,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( !member || member->isEffectivelyDead() || ai->getLastCommandSource() != CMD_FROM_AI ) { //Member is toast -- so remove him from our list! @@ -264,7 +264,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) Object *designatedTarget = TheGameLogic->findObjectByID( m_designatedTarget ); if( designatedTarget && designatedTarget->isEffectivelyDead() ) { - designatedTarget = NULL; + designatedTarget = nullptr; } if( designatedTarget ) { @@ -272,7 +272,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { @@ -439,7 +439,7 @@ void AssaultTransportAIUpdate::retrieveMembers() for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { Bool contained = member->isContained(); @@ -461,7 +461,7 @@ void AssaultTransportAIUpdate::giveFinalOrders() for( int i = 0; i < m_currentMembers; i++ ) { Object *member = TheGameLogic->findObjectByID( m_memberIDs[ i ] ); - AIUpdateInterface *ai = member ? member->getAI() : NULL; + AIUpdateInterface *ai = member ? member->getAI() : nullptr; if( member && ai ) { Object *designatedTarget = TheGameLogic->findObjectByID( m_designatedTarget ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index afed8280036..256cf47bfd0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -93,7 +93,7 @@ static Real calcDistSqr(const Coord3D& a, const Coord3D& b) //------------------------------------------------------------------------------------------------- static Object* getPotentialRappeller(Object* obj) { - const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : NULL; + const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : nullptr; if (items) { for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it ) @@ -105,7 +105,7 @@ static Object* getPotentialRappeller(Object* obj) } } } - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -363,9 +363,9 @@ class ChinookCombatDropState : public State { Object* rappeller = TheGameLogic->findObjectByID(*oit); #if RETAIL_COMPATIBLE_CRC - if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) + if (rappeller == nullptr || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain()) #else - if (rappeller == NULL || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) + if (rappeller == nullptr || rappeller->isEffectivelyDead() || !rappeller->isAboveTerrain() || rappeller->isContained()) #endif { oit = it->rappellerIDs.erase(oit); @@ -380,10 +380,10 @@ class ChinookCombatDropState : public State static void initRopeParms(Drawable* rope, Real length, Real width, const RGBColor& color, Real wobbleLen, Real wobbleAmp, Real wobbleRate) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->initRopeParms(length, width, color, wobbleLen, wobbleAmp, wobbleRate); } @@ -392,10 +392,10 @@ class ChinookCombatDropState : public State static void setRopeCurLen(Drawable* rope, Real length) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->setRopeCurLen(length); } @@ -404,10 +404,10 @@ class ChinookCombatDropState : public State static void setRopeSpeed(Drawable* rope, Real curSpeed, Real maxSpeed, Real accel) { - RopeDrawInterface* tdi = NULL; + RopeDrawInterface* tdi = nullptr; for (DrawModule** d = rope->getDrawModules(); *d; ++d) { - if ((tdi = (*d)->getRopeDrawInterface()) != NULL) + if ((tdi = (*d)->getRopeDrawInterface()) != nullptr) { tdi->setRopeSpeed(curSpeed, maxSpeed, accel); } @@ -461,7 +461,7 @@ class ChinookCombatDropState : public State xfer->xferSTLObjectIDList(&info.rappellerIDs); if (xfer->getXferMode() == XFER_LOAD) { - info.ropeDrawable = NULL; // filled in via loadPostProcess + info.ropeDrawable = nullptr; // filled in via loadPostProcess m_ropes[i] = info; } } @@ -486,7 +486,7 @@ class ChinookCombatDropState : public State { Object* obj = getMachineOwner(); Drawable* draw = obj->getDrawable(); - if (draw == NULL) + if (draw == nullptr) return STATE_FAILURE; ChinookAIUpdate* ai = (ChinookAIUpdate*)obj->getAIUpdateInterface(); @@ -506,8 +506,8 @@ class ChinookCombatDropState : public State Coord3D ropePos[MAX_BONES]; Matrix3D dropMtx[MAX_BONES]; - Int ropeCount = draw->getPristineBonePositions("RopeStart", 1, ropePos, NULL, MAX_BONES); - Int dropCount = draw->getPristineBonePositions("RopeEnd", 1, NULL, dropMtx, MAX_BONES); + Int ropeCount = draw->getPristineBonePositions("RopeStart", 1, ropePos, nullptr, MAX_BONES); + Int dropCount = draw->getPristineBonePositions("RopeEnd", 1, nullptr, dropMtx, MAX_BONES); Int numRopes = d->m_numRopes; if (numRopes > ropeCount) numRopes = ropeCount; @@ -520,12 +520,12 @@ class ChinookCombatDropState : public State { RopeInfo info; - obj->convertBonePosToWorldPos( NULL, &dropMtx[i], NULL, &info.dropStartMtx ); + obj->convertBonePosToWorldPos( nullptr, &dropMtx[i], nullptr, &info.dropStartMtx ); - info.ropeDrawable = ropeTmpl ? TheThingFactory->newDrawable(ropeTmpl) : NULL; + info.ropeDrawable = ropeTmpl ? TheThingFactory->newDrawable(ropeTmpl) : nullptr; if (info.ropeDrawable) { - obj->convertBonePosToWorldPos( &ropePos[i], NULL, &ropePos[i], NULL ); + obj->convertBonePosToWorldPos( &ropePos[i], nullptr, &ropePos[i], nullptr ); info.ropeDrawable->setPosition(&ropePos[i]); info.ropeSpeed = 0.0f; info.ropeLen = 1.0f; @@ -586,7 +586,7 @@ class ChinookCombatDropState : public State if (now >= it->nextDropTime) { Object* rappeller = getPotentialRappeller(obj); - if (rappeller != NULL) + if (rappeller != nullptr) { #if RETAIL_COMPATIBLE_CRC ExitInterface *exitInterface = obj->getObjectExitInterface(); @@ -611,7 +611,7 @@ class ChinookCombatDropState : public State rappeller->setTransformMatrix(&it->dropStartMtx); - AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : NULL; + AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : nullptr; if (rappellerAI) { rappellerAI->setDesiredSpeed(d->m_rappelSpeed); @@ -630,7 +630,7 @@ class ChinookCombatDropState : public State } } - if (numRopesInUse == 0 && getPotentialRappeller(obj) == NULL) + if (numRopesInUse == 0 && getPotentialRappeller(obj) == nullptr) { // we're done! return STATE_SUCCESS; @@ -657,8 +657,8 @@ class ChinookCombatDropState : public State for (std::list::iterator oit = it->rappellerIDs.begin(); oit != it->rappellerIDs.end(); ++oit) { Object* rappeller = TheGameLogic->findObjectByID(*oit); - AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : NULL; - if (rappellerAI != NULL) + AIUpdateInterface* rappellerAI = rappeller ? rappeller->getAIUpdateInterface() : nullptr; + if (rappellerAI != nullptr) { rappellerAI->aiIdle(CMD_FROM_AI); } @@ -675,7 +675,7 @@ class ChinookCombatDropState : public State const Real initialSpeed = TheGlobalData->m_gravity * 30; // give it a little kick setRopeSpeed(m_ropes[i].ropeDrawable, initialSpeed, d->m_ropeDropSpeed, TheGlobalData->m_gravity); m_ropes[i].ropeDrawable->setExpirationDate(now + ROPE_EXPIRATION_TIME); - m_ropes[i].ropeDrawable = NULL; // we're done with it, so null it so we won't save it + m_ropes[i].ropeDrawable = nullptr; // we're done with it, so null it so we won't save it } } @@ -735,7 +735,7 @@ class ChinookMoveToBldgState : public AIMoveToState const Coord3D* destPos; Object* bldg = getMachineGoalObject(); - if (bldg != NULL && !bldg->isEffectivelyDead() && bldg->isKindOf(KINDOF_STRUCTURE)) + if (bldg != nullptr && !bldg->isEffectivelyDead() && bldg->isKindOf(KINDOF_STRUCTURE)) { destPos = bldg->getPosition(); m_newPreferredHeight = bldg->getGeometryInfo().getMaxHeightAbovePosition() + d->m_minDropHeight; @@ -920,8 +920,8 @@ ChinookAIUpdateModuleData::ChinookAIUpdateModuleData() { "PerRopeDelayMax", INI::parseDurationUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMax) }, { "MinDropHeight", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_minDropHeight) }, { "WaitForRopesToDrop", INI::parseBool, 0, offsetof(ChinookAIUpdateModuleData, m_waitForRopesToDrop) }, - { "RotorWashParticleSystem", INI::parseAsciiString, NULL, offsetof( ChinookAIUpdateModuleData, m_rotorWashParticleSystem ) }, - { "UpgradedSupplyBoost", INI::parseInt, NULL, offsetof( ChinookAIUpdateModuleData, m_upgradedSupplyBoost) }, + { "RotorWashParticleSystem", INI::parseAsciiString, nullptr, offsetof( ChinookAIUpdateModuleData, m_rotorWashParticleSystem ) }, + { "UpgradedSupplyBoost", INI::parseInt, nullptr, offsetof( ChinookAIUpdateModuleData, m_upgradedSupplyBoost) }, { 0, 0, 0, 0 } }; @@ -957,13 +957,13 @@ ChinookAIUpdate::~ChinookAIUpdate() static ParkingPlaceBehaviorInterface* getPP(ObjectID id) { Object* airfield = TheGameLogic->findObjectByID( id ); - if (airfield == NULL || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_FS_AIRFIELD)) - return NULL; + if (airfield == nullptr || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_FS_AIRFIELD)) + return nullptr; - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) break; } @@ -977,7 +977,7 @@ void ChinookAIUpdate::setAirfieldForHealing(ObjectID id) if (m_airfieldForHealing != INVALID_ID && m_airfieldForHealing != id) { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - if (pp != NULL) + if (pp != nullptr) { pp->setHealee(getObject(), false); } @@ -1081,7 +1081,7 @@ UpdateSleepTime ChinookAIUpdate::update() const ContainModuleInterface* contain = getObject()->getContain(); const Bool waitingToEnterOrExit = contain && contain->hasObjectsWantingToEnterOrExit(); - if (pp != NULL) + if (pp != nullptr) { if (m_flightStatus == CHINOOK_LANDED && #if !RETAIL_COMPATIBLE_CRC @@ -1093,7 +1093,7 @@ UpdateSleepTime ChinookAIUpdate::update() { // we're completely healed, so take off again pp->setHealee(getObject(), false); - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); } else { @@ -1122,11 +1122,11 @@ UpdateSleepTime ChinookAIUpdate::update() } else if (waitingToEnterOrExit && m_flightStatus != CHINOOK_LANDED) { - setMyState(LANDING, NULL, NULL, CMD_FROM_AI); + setMyState(LANDING, nullptr, nullptr, CMD_FROM_AI); } else if (!waitingToEnterOrExit && m_flightStatus == CHINOOK_LANDED && m_airfieldForHealing == INVALID_ID) { - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); } } @@ -1152,7 +1152,7 @@ UpdateSleepTime ChinookAIUpdate::update() passengerIterator++; AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); - if( passengerAI && (passengerAI->getCurrentVictim() == NULL) ) + if( passengerAI && (passengerAI->getCurrentVictim() == nullptr) ) { passengerAI->aiAttackObject( victim, 999, CMD_FROM_AI ); } @@ -1238,7 +1238,7 @@ void ChinookAIUpdate::privateGetRepaired( Object *repairDepot, CommandSourceType if (ThePartitionManager->findPositionAround(&pos, &options, &tmp)) pos = tmp; - setMyState(MOVE_TO_AND_LAND, NULL, &pos, cmdSource); + setMyState(MOVE_TO_AND_LAND, nullptr, &pos, cmdSource); } @@ -1250,12 +1250,12 @@ void ChinookAIUpdate::privateCombatDrop( Object* target, const Coord3D& pos, Com // when there is a target present, we must verify that we can logically do the action when // we get commands from players (we'll assume AI knows what its doing) // - if( target != NULL && cmdSource == CMD_FROM_PLAYER && + if( target != nullptr && cmdSource == CMD_FROM_PLAYER && TheActionManager->canEnterObject( getObject(), target, cmdSource, COMBATDROP_INTO ) == FALSE ) return; Coord3D localPos = pos; - if (target == NULL) + if (target == nullptr) { // if target is null, we are dropping at a pos, not into a bldg. // in this case, ensure there is no structure at the pos... this can happen @@ -1323,7 +1323,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } else @@ -1331,7 +1331,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) // do this INSTEAD of the standard stuff setMyState( (parms->m_cmd == AICMD_MOVE_TO_POSITION_AND_EVACUATE) ? MOVE_TO_AND_EVAC : MOVE_TO_AND_EVAC_AND_EXIT_INIT, - NULL, &parms->m_pos, CMD_FROM_AI); + nullptr, &parms->m_pos, CMD_FROM_AI); passItThru = false; } } @@ -1346,7 +1346,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(LANDING, NULL, NULL, CMD_FROM_AI); + setMyState(LANDING, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } } @@ -1360,7 +1360,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) m_pendingCommand.store(*parms); m_hasPendingCommand = true; - setMyState(TAKING_OFF, NULL, NULL, CMD_FROM_AI); + setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } } @@ -1433,7 +1433,7 @@ void ChinookAIUpdate::privateIdle(CommandSourceType cmdSource) // Just an extra step, here, before extending idle to parent classes. // Living in you own privateIdle-ho. ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL ) + if( contain != nullptr ) { Object *rider = (Object*)contain->friend_getRider(); if ( rider ) @@ -1460,7 +1460,7 @@ void ChinookAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, C return; ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL ) + if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -1517,7 +1517,7 @@ void ChinookAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, C void ChinookAIUpdate::private___TellPortableStructureToAttackWithMe( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL ) + if( contain != nullptr ) { //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- Object *rider = (Object*)contain->friend_getRider(); @@ -1549,7 +1549,7 @@ void ChinookAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFi return; ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL ) + if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -1626,7 +1626,7 @@ void ChinookAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsToF return; ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL ) + if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index f69f7004ad9..b3424e0a466 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -57,41 +57,41 @@ const FieldParse* DeliverPayloadData::getFieldParse() static const FieldParse dataFieldParse[] = { - { "DeliveryDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_distToTarget) }, - { "PreOpenDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_preOpenDistance) }, - { "MaxAttempts", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_maxAttempts) }, + { "DeliveryDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_distToTarget) }, + { "PreOpenDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_preOpenDistance) }, + { "MaxAttempts", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_maxAttempts) }, //Drop information - { "DropDelay", INI::parseDurationUnsignedInt,NULL, offsetof( DeliverPayloadData, m_dropDelay ) }, - { "DropOffset", INI::parseCoord3D, NULL, offsetof( DeliverPayloadData, m_dropOffset ) }, - { "DropVariance", INI::parseCoord3D, NULL, offsetof( DeliverPayloadData, m_dropVariance ) }, - { "InheritTransportVelocity", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_inheritTransportVelocity ) }, - { "ExitPitchRate", INI::parseAngularVelocityReal,NULL, offsetof( DeliverPayloadData, m_exitPitchRate ) }, - { "ParachuteDirectly", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_isParachuteDirectly) }, + { "DropDelay", INI::parseDurationUnsignedInt,nullptr, offsetof( DeliverPayloadData, m_dropDelay ) }, + { "DropOffset", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadData, m_dropOffset ) }, + { "DropVariance", INI::parseCoord3D, nullptr, offsetof( DeliverPayloadData, m_dropVariance ) }, + { "InheritTransportVelocity", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_inheritTransportVelocity ) }, + { "ExitPitchRate", INI::parseAngularVelocityReal,nullptr, offsetof( DeliverPayloadData, m_exitPitchRate ) }, + { "ParachuteDirectly", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_isParachuteDirectly) }, //Visible payload information (payload assumed to be show visibly and it's created only when dropped) - { "VisibleItemsDroppedPerInterval", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_visibleItemsDroppedPerInterval ) }, - { "VisibleDropBoneBaseName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visibleDropBoneName ) }, - { "VisibleSubObjectBaseName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visibleSubObjectName ) }, - { "VisibleNumBones", INI::parseInt, NULL, offsetof( DeliverPayloadData, m_visibleNumBones ) }, - { "VisiblePayloadTemplateName", INI::parseAsciiString, NULL, offsetof( DeliverPayloadData, m_visiblePayloadTemplateName ) }, - { "VisiblePayloadWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( DeliverPayloadData, m_visiblePayloadWeaponTemplate ) }, - { "SelfDestructObject", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_selfDestructObject ) }, + { "VisibleItemsDroppedPerInterval", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_visibleItemsDroppedPerInterval ) }, + { "VisibleDropBoneBaseName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visibleDropBoneName ) }, + { "VisibleSubObjectBaseName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visibleSubObjectName ) }, + { "VisibleNumBones", INI::parseInt, nullptr, offsetof( DeliverPayloadData, m_visibleNumBones ) }, + { "VisiblePayloadTemplateName", INI::parseAsciiString, nullptr, offsetof( DeliverPayloadData, m_visiblePayloadTemplateName ) }, + { "VisiblePayloadWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( DeliverPayloadData, m_visiblePayloadWeaponTemplate ) }, + { "SelfDestructObject", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_selfDestructObject ) }, //Weapon based payload - { "FireWeapon", INI::parseBool, NULL, offsetof( DeliverPayloadData, m_fireWeapon ) }, + { "FireWeapon", INI::parseBool, nullptr, offsetof( DeliverPayloadData, m_fireWeapon ) }, //Specify an additional weaponslot to be fired while strafing - { "DiveStartDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_diveStartDistance ) }, - { "DiveEndDistance", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_diveEndDistance ) }, + { "DiveStartDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_diveStartDistance ) }, + { "DiveEndDistance", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_diveEndDistance ) }, { "StrafingWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DeliverPayloadData, m_strafingWeaponSlot ) }, - { "StrafeWeaponFX", INI::parseFXList, NULL, offsetof( DeliverPayloadData, m_strafeFX ) }, - { "StrafeLength", INI::parseReal, NULL, offsetof( DeliverPayloadData, m_strafeLength ) }, + { "StrafeWeaponFX", INI::parseFXList, nullptr, offsetof( DeliverPayloadData, m_strafeFX ) }, + { "StrafeLength", INI::parseReal, nullptr, offsetof( DeliverPayloadData, m_strafeLength ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DeliverPayloadData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof(DeliverPayloadData, m_deliveryDecalRadius) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DeliverPayloadData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof(DeliverPayloadData, m_deliveryDecalRadius) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; return dataFieldParse; } @@ -110,7 +110,7 @@ AIStateMachine* DeliverPayloadAIUpdate::makeStateMachine() //------------------------------------------------------------------------------------------------- DeliverPayloadAIUpdate::DeliverPayloadAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdateInterface( thing, moduleData ) { - m_deliverPayloadStateMachine = NULL; + m_deliverPayloadStateMachine = nullptr; m_targetPos.zero(); m_moveToPos.zero(); m_visibleItemsDelivered = 0; @@ -248,7 +248,7 @@ void DeliverPayloadAIUpdate::deliverPayload( //**************************************************** deleteInstance(m_deliverPayloadStateMachine); - m_deliverPayloadStateMachine = NULL; + m_deliverPayloadStateMachine = nullptr; m_moveToPos = *moveToPos; m_targetPos = *targetPos; @@ -321,7 +321,7 @@ void DeliverPayloadAIUpdate::deliverPayloadViaModuleData( const Coord3D *moveToP const ThingTemplate* DeliverPayloadAIUpdate::getPutInContainerTemplateViaModuleData() const { AsciiString name = getDeliverPayloadAIUpdateModuleData()->m_putInContainerName; - return name.isEmpty() ? NULL : TheThingFactory->findTemplate( name ); + return name.isEmpty() ? nullptr : TheThingFactory->findTemplate( name ); } //------------------------------------------------------------------------------------------------- @@ -459,9 +459,9 @@ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) xfer->xferReal(&data.m_deliveryDecalRadius); *((DeliverPayloadData*)&m_data) = data; - Bool hasStateMachine = m_deliverPayloadStateMachine!=NULL; + Bool hasStateMachine = m_deliverPayloadStateMachine!=nullptr; xfer->xferBool(&hasStateMachine); - if (hasStateMachine && m_deliverPayloadStateMachine==NULL) + if (hasStateMachine && m_deliverPayloadStateMachine==nullptr) { m_deliverPayloadStateMachine = newInstance(DeliverPayloadStateMachine)( getObject() ); } @@ -508,8 +508,8 @@ DeliverPayloadStateMachine::DeliverPayloadStateMachine( Object *owner ) : StateM static const StateConditionInfo considerConditions[] = { - StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(DeliverPayloadStateMachine::isOffMap, RECOVER_FROM_OFF_MAP, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -696,8 +696,8 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often if (!ai->isCloseEnoughToTarget()) return STATE_FAILURE; - const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : NULL; - if( (!items || items->empty()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) + const ContainedItemsList* items = owner->getContain() ? owner->getContain()->getContainedItemsList() : nullptr; + if( (!items || !items->size()) && ai->getVisibleItemsDelivered() == ai->getData()->m_visibleNumBones ) { //We are out of payload to drop AND our visible payload is empty. It's possible for deliverers to //have one or the other or even both. @@ -723,7 +723,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often AIUpdateInterface* itemAI = item->getAIUpdateInterface(); if (itemAI) { - itemAI->aiExit(NULL, CMD_FROM_AI); + itemAI->aiExit(nullptr, CMD_FROM_AI); } Coord3D pos = *item->getPosition(); @@ -811,9 +811,9 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often Coord3D pos; AsciiString bone; bone.format( "%s%02d", ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1 ); - if( draw->getPristineBonePositions( ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1, &pos, NULL, 1 ) > 0 ) + if( draw->getPristineBonePositions( ai->getData()->m_visibleDropBoneName.str(), ai->getVisibleItemsDelivered() + 1, &pos, nullptr, 1 ) > 0 ) { - draw->convertBonePosToWorldPos( &pos, NULL, &pos, NULL ); + draw->convertBonePosToWorldPos( &pos, nullptr, &pos, nullptr ); payload->setPosition( &pos ); } else @@ -856,7 +856,7 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often break; } VeterancyLevel v = owner->getVeterancyLevel(); - pui->projectileFireAtObjectOrPosition( NULL, ai->getTargetPos(), weaponTemplate, weaponTemplate->getProjectileExhaust(v) ); + pui->projectileFireAtObjectOrPosition( nullptr, ai->getTargetPos(), weaponTemplate, weaponTemplate->getProjectileExhaust(v) ); projectileFired = true; //damageInfo.in.m_sourceID = pui->projectileGetLauncherID(); break; @@ -968,7 +968,7 @@ StateReturnType ConsiderNewApproachState::onEnter() // Increment local counter o // based on loco values, move off far enough so we can turn, then head back. (if we just say // "head back directly", the code will just keep turning in circles, not realizing that our // turning radius is too large for that ever to work.) - Real minTurnRadius = ai->calcMinTurnRadius(NULL); + Real minTurnRadius = ai->calcMinTurnRadius(nullptr); // how far is "far enough"? we must be at least 2*radius dist away from our target. // (we add a little fudge since we may not be able to travel our max speed while diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 40c16a53d47..7150ffe5a5c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -167,11 +167,11 @@ StateReturnType DozerActionPickActionPosState::update( void ) Object *goalObject = TheGameLogic->findObjectByID( dozerAI->getTaskTarget( m_task ) ); // if there is no goal, get out of this machine with a failure code (success is done in the action state ) - if( goalObject == NULL ) + if( goalObject == nullptr ) { // to be clean get rid of the goal object we set - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); // cancel our task dozerAI->cancelTask( m_task ); @@ -295,7 +295,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) Object *dozer = getMachineOwner(); // sanity - if( goalObject == NULL || dozer == NULL ) + if( goalObject == nullptr || dozer == nullptr ) return STATE_FAILURE; AIUpdateInterface *ai = dozer->getAIUpdateInterface(); @@ -308,7 +308,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) if ( dozerAI ) dozerAI->internalTaskComplete( m_task ); } - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -330,7 +330,7 @@ StateReturnType DozerActionMoveToActionPosState::update( void ) if ( dozerAI ) dozerAI->internalTaskComplete( m_task ); } - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -478,7 +478,7 @@ StateReturnType DozerActionDoActionState::update( void ) // const UnsignedInt ACTION_TIME = LOGICFRAMES_PER_SECOND * 4 ; // frames to spend here in this state doing the action // check for object gone - if( goalObject == NULL ) + if( goalObject == nullptr ) return STATE_FAILURE; if ( dozer->isDisabledByType( DISABLED_UNMANNED ) )// Yipes, I've been sniped! @@ -722,7 +722,7 @@ StateReturnType DozerActionDoActionState::update( void ) // remember who has been healing it, and will return false to everybody else //or if the goalObject is already receiving healing, I must stop, since my healing is getting rejected here dozerAI->internalTaskComplete( m_task ); - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); return STATE_FAILURE; } @@ -766,7 +766,7 @@ StateReturnType DozerActionDoActionState::update( void ) dozerAI->internalTaskComplete( m_task ); // to be clean get rid of the goal object we set - getMachine()->setGoalObject( NULL ); + getMachine()->setGoalObject( nullptr ); getMachineOwner()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it @@ -862,11 +862,11 @@ static Object *findObjectToRepair( Object *dozer ) { // sanity - if( dozer == NULL ) - return NULL; + if( dozer == nullptr ) + return nullptr; if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } const DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); @@ -874,7 +874,7 @@ static Object *findObjectToRepair( Object *dozer ) PartitionFilterAcceptByKindOf filter2( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ), KINDOFMASK_NONE ); PartitionFilterSameMapStatus filterMapStatus(dozer); - PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filter1, &filter2, &filterMapStatus, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( dozer->getPosition(), dozerAI->getBoredRange(), FROM_CENTER_2D, @@ -882,7 +882,7 @@ static Object *findObjectToRepair( Object *dozer ) MemoryPoolObjectHolder hold( iter ); Object *obj; - Object *closestRepairTarget = NULL; + Object *closestRepairTarget = nullptr; Real closestRepairTargetDistSqr = 0.0f; for( obj = iter->first(); obj; obj = iter->next() ) { @@ -892,7 +892,7 @@ static Object *findObjectToRepair( Object *dozer ) continue; // target the closest valid repair target - if( closestRepairTarget == NULL ) + if( closestRepairTarget == nullptr ) { closestRepairTarget = obj; @@ -926,11 +926,11 @@ static Object *findMine( Object *dozer ) { // sanity - if( dozer == NULL ) - return NULL; + if( dozer == nullptr ) + return nullptr; if( !dozer->getAIUpdateInterface() ) { - return NULL; + return nullptr; } const DozerAIInterface *dozerAI = dozer->getAIUpdateInterface()->getDozerAIInterface(); @@ -939,7 +939,7 @@ static Object *findMine( Object *dozer ) PartitionFilterRelationship filterTeam(dozer, PartitionFilterRelationship::ALLOW_ENEMIES | PartitionFilterRelationship::ALLOW_NEUTRAL); PartitionFilterPossibleToAttack filterAttack(ATTACK_NEW_TARGET, dozer, CMD_FROM_DOZER); PartitionFilterSameMapStatus filterMapStatus(dozer); - PartitionFilter *filters[] = { &filterTeam, &filterAttack, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAttack, &filterMapStatus, nullptr }; Object* mine = ThePartitionManager->getClosestObject(dozer, dozerAI->getBoredRange(), FROM_CENTER_2D, filters); return mine; @@ -1128,7 +1128,7 @@ StateReturnType DozerPrimaryIdleState::update( void ) } else { getMachineOwner()->setWeaponSetFlag(WEAPONSET_MINE_CLEARING_DETAIL);//maybe go clear some mines, if I feel like it Object *mine = findMine(dozer); - if (mine!=NULL) { + if (mine!=nullptr) { ai->aiAttackObject( mine, 1, CMD_FROM_DOZER); } } @@ -1276,10 +1276,10 @@ DozerPrimaryStateMachine::DozerPrimaryStateMachine( Object *owner ) : StateMachi { static const StateConditionInfo idleConditions[] = { - StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, NULL), - StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, NULL), - StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isBuildMostImportant, DOZER_PRIMARY_BUILD, nullptr), + StateConditionInfo(isRepairMostImportant, DOZER_PRIMARY_REPAIR, nullptr), + StateConditionInfo(isFortifyMostImportant, DOZER_PRIMARY_FORTIFY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -1423,10 +1423,10 @@ void DozerAIUpdateModuleData::buildFieldParse( MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RepairHealthPercentPerSecond", INI::parsePercentToReal, NULL, offsetof( DozerAIUpdateModuleData, m_repairHealthPercentPerSecond ) }, - { "BoredTime", INI::parseDurationReal, NULL, offsetof( DozerAIUpdateModuleData, m_boredTime ) }, - { "BoredRange", INI::parseReal, NULL, offsetof( DozerAIUpdateModuleData, m_boredRange ) }, - { 0, 0, 0, 0 } + { "RepairHealthPercentPerSecond", INI::parsePercentToReal, nullptr, offsetof( DozerAIUpdateModuleData, m_repairHealthPercentPerSecond ) }, + { "BoredTime", INI::parseDurationReal, nullptr, offsetof( DozerAIUpdateModuleData, m_boredTime ) }, + { "BoredRange", INI::parseReal, nullptr, offsetof( DozerAIUpdateModuleData, m_boredRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -1461,10 +1461,10 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value // - // initialize the dozer machine to NULL, we want to do this and create it during the update + // initialize the dozer machine to nullptr, we want to do this and create it during the update // implementation because at this point we don't have the object all setup // - m_dozerMachine = NULL; + m_dozerMachine = nullptr; createMachines(); } @@ -1494,7 +1494,7 @@ DozerAIUpdate::~DozerAIUpdate( void ) void DozerAIUpdate::createMachines( void ) { - if( m_dozerMachine == NULL ) + if( m_dozerMachine == nullptr ) { m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); @@ -1511,18 +1511,18 @@ void DozerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to create scaffolding if necessary @@ -1537,18 +1537,18 @@ void DozerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to end any scaffolding from repairing @@ -1604,7 +1604,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; #if !RETAIL_COMPATIBLE_CRC - else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + else if (currentTask == DOZER_TASK_BUILD && targetObject == nullptr) invalidTask = TRUE; #endif @@ -1643,8 +1643,8 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, createMachines(); // sanity - if( what == NULL || pos == NULL || owningPlayer == NULL ) - return NULL; + if( what == nullptr || pos == nullptr || owningPlayer == nullptr ) + return nullptr; // sanity DEBUG_ASSERTCRASH( getObject()->getControllingPlayer() == owningPlayer, @@ -1667,7 +1667,7 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, // make sure the player is capable of building this if( TheBuildAssistant->canMakeUnit( getObject(), what ) != CANMAKE_OK) - return NULL; + return nullptr; // validate the the position to build at is valid if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, @@ -1675,8 +1675,8 @@ Object *DozerAIUpdate::construct( const ThingTemplate *what, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } @@ -1748,7 +1748,7 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; // if we're not repairing right now, we don't have any accept restrictions @@ -1769,14 +1769,14 @@ Bool DozerAIUpdate::canAcceptNewRepair( Object *obj ) if( currentRepair->isKindOf( KINDOF_BRIDGE_TOWER ) && obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) { - BridgeTowerBehaviorInterface *currentTowerInterface = NULL; - BridgeTowerBehaviorInterface *newTowerInterface = NULL; + BridgeTowerBehaviorInterface *currentTowerInterface = nullptr; + BridgeTowerBehaviorInterface *newTowerInterface = nullptr; currentTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( currentRepair ); newTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( obj ); // sanity - if( currentTowerInterface == NULL || newTowerInterface == NULL ) + if( currentTowerInterface == nullptr || newTowerInterface == nullptr ) { DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); @@ -1859,7 +1859,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -1929,7 +1929,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm // have to repair at a tower. Real bestDistSqr = 1e10f; - Object* bestTower = NULL; + Object* bestTower = nullptr; for (Int i = 0; i < BRIDGE_MAX_TOWERS; ++i) { Object* tower = TheGameLogic->findObjectByID(bbi->getTowerID((BridgeTowerType)i)); @@ -1955,7 +1955,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm return bestTower; DEBUG_CRASH(("should not happen, no reachable tower found")); - return NULL; + return nullptr; } } @@ -1973,7 +1973,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) DEBUG_ASSERTCRASH( task >= 0 && task < DOZER_NUM_TASKS, ("Illegal dozer task '%d'", task) ); // sanity - if( target == NULL ) + if( target == nullptr ) return; // @@ -1993,7 +1993,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) Coord3D position; target = findGoodBuildOrRepairPositionAndTarget(me, target, position); - if (target == NULL) + if (target == nullptr) return; // could happen for some bridges // @@ -2165,7 +2165,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) ///@todo This would be correct except that we don't have idle crane animations and it is December. // Object* goalObject = TheGameLogic->findObjectByID(m_task[task].m_targetObjectID); -// if (goalObject != NULL) +// if (goalObject != nullptr) // { // goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); // } @@ -2181,7 +2181,7 @@ void DozerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) getObject()->clearModelConditionState( MODELCONDITION_ACTIVELY_CONSTRUCTING ); // Bridges have been made indestructible, so the code below was meaningless. -- ML - // Object *obj = NULL; + // Object *obj = nullptr; // get object to reapir (if present) //obj = TheGameLogic->findObjectByID( m_task[ task ].m_targetObjectID ); // @@ -2252,7 +2252,7 @@ void DozerAIUpdate::onDelete( void ) for( i = 0; i < DOZER_NUM_TASKS; i++ ) { Object* goalObject = TheGameLogic->findObjectByID(m_task[i].m_targetObjectID); - if (goalObject != NULL) + if (goalObject != nullptr) { goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); } @@ -2297,18 +2297,18 @@ const Coord3D* DozerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint point // sanity if( task < 0 || task >= DOZER_NUM_TASKS ) - return NULL; + return nullptr; // sanity if( point < 0 || point >= DOZER_NUM_DOCK_POINTS ) - return NULL; + return nullptr; // if the point has been set (is valid) then return it if( m_dockPoint[ task ][ point ].valid ) return &m_dockPoint[ task ][ point ].location; // no valid point has been set for this dock point on this task - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index d7f60873e89..97e28944458 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp @@ -164,7 +164,7 @@ void HackInternetAIUpdate::hackInternet() { //if (m_hackInternetStateMachine) // deleteInstance(m_hackInternetStateMachine); - //m_hackInternetStateMachine = NULL; + //m_hackInternetStateMachine = nullptr; // must make the state machine AFTER initing the other stuff, since it may inquire of its values... //m_hackInternetStateMachine = newInstance(HackInternetStateMachine)( getObject() ); @@ -185,7 +185,7 @@ UnsignedInt HackInternetAIUpdate::getUnpackTime() const // ------------------------------------------------------------------------------------------------ UnsignedInt HackInternetAIUpdate::getPackTime() const { - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return 0; //We don't need to pack if exiting a building return getHackInternetAIUpdateModuleData()->m_packTime; @@ -194,7 +194,7 @@ UnsignedInt HackInternetAIUpdate::getPackTime() const // ------------------------------------------------------------------------------------------------ UnsignedInt HackInternetAIUpdate::getCashUpdateDelay() const { - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) return getHackInternetAIUpdateModuleData()->m_cashUpdateDelayFast; else return getHackInternetAIUpdateModuleData()->m_cashUpdateDelay; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index dc2a4162b7c..6d19079fe18 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -109,7 +109,7 @@ Bool JetAIUpdate::isOutOfSpecialReloadAmmo() const for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { const Weapon* weapon = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (weapon == NULL || weapon->getReloadType() != RETURN_TO_BASE_TO_RELOAD) + if (weapon == nullptr || weapon->getReloadType() != RETURN_TO_BASE_TO_RELOAD) continue; ++specials; if (weapon->getStatus() == OUT_OF_AMMO) @@ -119,22 +119,22 @@ Bool JetAIUpdate::isOutOfSpecialReloadAmmo() const } //------------------------------------------------------------------------------------------------- -static ParkingPlaceBehaviorInterface* getPP(ObjectID id, Object** airfieldPP = NULL) +static ParkingPlaceBehaviorInterface* getPP(ObjectID id, Object** airfieldPP = nullptr) { if (airfieldPP) - *airfieldPP = NULL; + *airfieldPP = nullptr; Object* airfield = TheGameLogic->findObjectByID( id ); - if (airfield == NULL || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_FS_AIRFIELD) || airfield->testStatus(OBJECT_STATUS_SOLD)) - return NULL; + if (airfield == nullptr || airfield->isEffectivelyDead() || !airfield->isKindOf(KINDOF_FS_AIRFIELD) || airfield->testStatus(OBJECT_STATUS_SOLD)) + return nullptr; if (airfieldPP) *airfieldPP = airfield; - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) break; } @@ -155,7 +155,7 @@ class PartitionFilterHasParkingPlace : public PartitionFilter virtual Bool allow(Object *objOther) { ParkingPlaceBehaviorInterface* pp = getPP(objOther->getID()); - if (pp != NULL && pp->reserveSpace(m_id, 0.0f, NULL)) + if (pp != nullptr && pp->reserveSpace(m_id, 0.0f, nullptr)) return true; return false; } @@ -181,7 +181,7 @@ static Object* findSuitableAirfield(Object* jet) filters[numFilters++] = &filterAlive; filters[numFilters++] = &filterPP; filters[numFilters++] = &filterMapStatus; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; return ThePartitionManager->getClosestObject( jet, HUGE_DIST, FROM_CENTER_2D, filters ); } @@ -233,14 +233,14 @@ class JetAwaitingRunwayState : public State return STATE_FAILURE; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) { // no producer? just skip this step. return STATE_SUCCESS; } // gotta reserve a space in order to reserve a runway - if (!pp->reserveSpace(jet->getID(), jetAI->friend_getParkingOffset(), NULL)) + if (!pp->reserveSpace(jet->getID(), jetAI->friend_getParkingOffset(), nullptr)) { DEBUG_ASSERTCRASH(m_landing, ("hmm, this should never happen for taking-off things")); return STATE_FAILURE; @@ -507,7 +507,7 @@ class JetOrHeliTaxiState : public AIMoveOutOfTheWayState Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID(), &airfield); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step. ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -658,7 +658,7 @@ class JetOrHeliTaxiState : public AIMoveOutOfTheWayState Coord3D bestPos; Int oldIndex, newIndex; // Check pp for null, as it is possible for your airfield to get destroyed while taxiing.jba [8/27/2003] - if( pp!=NULL && pp->calcBestParkingAssignment( jet->getID(), &bestPos, &oldIndex, &newIndex ) ) + if( pp!=nullptr && pp->calcBestParkingAssignment( jet->getID(), &bestPos, &oldIndex, &newIndex ) ) { Path *path = jetAI->friend_getPath(); if( path ) @@ -746,7 +746,7 @@ class JetTakeoffOrLandingState : public AIFollowPathState jetAI->ignoreObstacleID(jet->getProducerID()); ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -997,7 +997,7 @@ class HeliTakeoffOrLandingState : public State Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID(), &airfield); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step Coord3D landingApproach; @@ -1191,7 +1191,7 @@ class JetOrHeliParkOrientState : public State } ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_FAILURE; ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -1302,11 +1302,11 @@ class JetPauseBeforeTakeoffState : public AIFaceState for (Int i = 0; i < count; ++i) { Object* otherJet = TheGameLogic->findObjectByID( pp->getRunwayReservation( i, RESERVATION_TAKEOFF ) ); - if (otherJet == NULL || otherJet == jet) + if (otherJet == nullptr || otherJet == jet) continue; AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) continue; if (ai->getCurrentStateID() == TAXI_TO_TAKEOFF) @@ -1327,7 +1327,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState const Object* thisJet = getMachineOwner(); ParkingPlaceBehaviorInterface* pp = getPP(getMachineOwner()->getProducerID()); - if (pp != NULL) + if (pp != nullptr) { const Int thisJetRunway = pp->getRunwayIndex(thisJet->getID()); const Int runwayCount = pp->getRunwayCount(); @@ -1338,11 +1338,11 @@ class JetPauseBeforeTakeoffState : public AIFaceState continue; Object* otherJet = TheGameLogic->findObjectByID(pp->getRunwayReservation(runway, RESERVATION_TAKEOFF)); - if (otherJet == NULL) + if (otherJet == nullptr) continue; AIUpdateInterface* ai = otherJet->getAIUpdateInterface(); - if (ai == NULL) + if (ai == nullptr) continue; if (ai->getCurrentStateID() != TAXI_TO_TAKEOFF) @@ -1351,7 +1351,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState return otherJet; } } - return NULL; + return nullptr; } #endif @@ -1388,7 +1388,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState #endif ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) return STATE_SUCCESS; // no airfield? just skip this step. ParkingPlaceBehaviorInterface::PPInfo ppinfo; @@ -1590,7 +1590,7 @@ class JetOrHeliReloadAmmoState : public State for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { const Weapon* w = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; Int remaining = w->getRemainingAmmo(); @@ -1620,7 +1620,7 @@ class JetOrHeliReloadAmmoState : public State for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { Weapon* w = jet->getWeaponInWeaponSlot((WeaponSlotType)i); - if (w == NULL) + if (w == nullptr) continue; if (now >= m_reloadDoneFrame) @@ -1666,13 +1666,13 @@ class JetOrHeliReturnForLandingState : public AIInternalMoveToState JetAIUpdate* jetAI = (JetAIUpdate*)jet->getAIUpdateInterface(); ParkingPlaceBehaviorInterface* pp = getPP(jet->getProducerID()); - if (pp == NULL) + if (pp == nullptr) { // nuke the producer id, since it's dead - jet->setProducer(NULL); + jet->setProducer(nullptr); Object* airfield = findSuitableAirfield( jet ); - pp = airfield ? getPP(airfield->getID()) : NULL; + pp = airfield ? getPP(airfield->getID()) : nullptr; if (airfield && pp) { jet->setProducer(airfield); @@ -1807,26 +1807,26 @@ JetAIUpdateModuleData::JetAIUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OutOfAmmoDamagePerSecond", INI::parsePercentToReal, NULL, offsetof( JetAIUpdateModuleData, m_outOfAmmoDamagePerSecond ) }, - { "NeedsRunway", INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_needsRunway ) }, - { "KeepsParkingSpaceWhenAirborne",INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_keepsParkingSpaceWhenAirborne ) }, - { "TakeoffDistForMaxLift", INI::parsePercentToReal, NULL, offsetof( JetAIUpdateModuleData, m_takeoffDistForMaxLift ) }, - { "TakeoffPause", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_takeoffPause ) }, - { "MinHeight", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_minHeight ) }, - { "ParkingOffset", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_parkingOffset ) }, - { "SneakyOffsetWhenAttacking", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_sneakyOffsetWhenAttacking ) }, + { "OutOfAmmoDamagePerSecond", INI::parsePercentToReal, nullptr, offsetof( JetAIUpdateModuleData, m_outOfAmmoDamagePerSecond ) }, + { "NeedsRunway", INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_needsRunway ) }, + { "KeepsParkingSpaceWhenAirborne",INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_keepsParkingSpaceWhenAirborne ) }, + { "TakeoffDistForMaxLift", INI::parsePercentToReal, nullptr, offsetof( JetAIUpdateModuleData, m_takeoffDistForMaxLift ) }, + { "TakeoffPause", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_takeoffPause ) }, + { "MinHeight", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_minHeight ) }, + { "ParkingOffset", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_parkingOffset ) }, + { "SneakyOffsetWhenAttacking", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_sneakyOffsetWhenAttacking ) }, { "AttackLocomotorType", INI::parseIndexList, TheLocomotorSetNames, offsetof( JetAIUpdateModuleData, m_attackingLoco ) }, - { "AttackLocomotorPersistTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_attackLocoPersistTime ) }, - { "AttackersMissPersistTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_attackersMissPersistTime ) }, + { "AttackLocomotorPersistTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_attackLocoPersistTime ) }, + { "AttackersMissPersistTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_attackersMissPersistTime ) }, { "ReturnForAmmoLocomotorType", INI::parseIndexList, TheLocomotorSetNames, offsetof( JetAIUpdateModuleData, m_returningLoco ) }, - { "LockonTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_lockonTime ) }, - { "LockonCursor", INI::parseAsciiString, NULL, offsetof( JetAIUpdateModuleData, m_lockonCursor ) }, - { "LockonInitialDist", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonInitialDist ) }, - { "LockonFreq", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonFreq ) }, - { "LockonAngleSpin", INI::parseAngleReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonAngleSpin ) }, - { "LockonBlinky", INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_lockonBlinky ) }, - { "ReturnToBaseIdleTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_returnToBaseIdleTime ) }, - { 0, 0, 0, 0 } + { "LockonTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_lockonTime ) }, + { "LockonCursor", INI::parseAsciiString, nullptr, offsetof( JetAIUpdateModuleData, m_lockonCursor ) }, + { "LockonInitialDist", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonInitialDist ) }, + { "LockonFreq", INI::parseReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonFreq ) }, + { "LockonAngleSpin", INI::parseAngleReal, nullptr, offsetof( JetAIUpdateModuleData, m_lockonAngleSpin ) }, + { "LockonBlinky", INI::parseBool, nullptr, offsetof( JetAIUpdateModuleData, m_lockonBlinky ) }, + { "ReturnToBaseIdleTime", INI::parseDurationUnsignedInt, nullptr, offsetof( JetAIUpdateModuleData, m_returnToBaseIdleTime ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -1854,7 +1854,7 @@ JetAIUpdate::JetAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdat m_attackersMissExpireFrame = 0; m_untargetableExpireFrame = 0; m_returnToBaseFrame = 0; - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; m_landingPosForHelipadStuff.zero(); m_producerLocation.zero(); @@ -1867,7 +1867,7 @@ JetAIUpdate::~JetAIUpdate() if (m_lockonDrawable) { TheGameClient->destroyDrawable(m_lockonDrawable); - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; } } @@ -1937,7 +1937,7 @@ void JetAIUpdate::getProducerLocation() Object* jet = getObject(); Object* airfield = TheGameLogic->findObjectByID( jet->getProducerID() ); - if (airfield == NULL) + if (airfield == nullptr) m_producerLocation = *jet->getPosition(); else m_producerLocation = *airfield->getPosition(); @@ -1985,7 +1985,7 @@ UpdateSleepTime JetAIUpdate::update() // that jets (and ESPECIALLY comanches) are still getting healed at airfields. if (AIUpdateInterface::isIdle() || getStateMachine()->getCurrentStateID() == RELOAD_AMMO) { - if (pp != NULL) + if (pp != nullptr) { if (!getFlag(ALLOW_AIR_LOCO) && !getFlag(HAS_PENDING_COMMAND) && @@ -2044,7 +2044,7 @@ UpdateSleepTime JetAIUpdate::update() } else { - if (pp != NULL) + if (pp != nullptr) { pp->setHealee(getObject(), false); } @@ -2067,7 +2067,7 @@ UpdateSleepTime JetAIUpdate::update() } Drawable* draw = jet->getDrawable(); - if (draw != NULL) + if (draw != nullptr) { StateID id = getStateMachine()->getCurrentStateID(); Bool needToCheckMinHeight = (id >= JETAISTATETYPE_FIRST && id <= JETAISTATETYPE_LAST) || @@ -2084,12 +2084,12 @@ UpdateSleepTime JetAIUpdate::update() } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } else { - draw->setInstanceMatrix(NULL); + draw->setInstanceMatrix(nullptr); } } @@ -2234,7 +2234,7 @@ void JetAIUpdate::pruneDeadTargeters() { for (std::list::iterator it = m_targetedBy.begin(); it != m_targetedBy.end(); /* empty */ ) { - if (TheGameLogic->findObjectByID(*it) == NULL) + if (TheGameLogic->findObjectByID(*it) == nullptr) { it = m_targetedBy.erase(it); } @@ -2255,7 +2255,7 @@ void JetAIUpdate::positionLockon() if (m_untargetableExpireFrame == 0) { TheGameClient->destroyDrawable(m_lockonDrawable); - m_lockonDrawable = NULL; + m_lockonDrawable = nullptr; return; } @@ -2312,7 +2312,7 @@ void JetAIUpdate::buildLockonDrawableIfNecessary() return; const JetAIUpdateModuleData* d = getJetAIUpdateModuleData(); - if (d->m_lockonCursor.isNotEmpty() && m_lockonDrawable == NULL) + if (d->m_lockonCursor.isNotEmpty() && m_lockonDrawable == nullptr) { const ThingTemplate* tt = TheThingFactory->findTemplate(d->m_lockonCursor); if (tt) @@ -2442,15 +2442,15 @@ void JetAIUpdate::doLandingCommand(Object *airfield, CommandSourceType cmdSource for (BehaviorModule** i = airfield->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp == NULL) + if (pp == nullptr) continue; if (getObject()->isKindOf(KINDOF_PRODUCED_AT_HELIPAD) || - pp->reserveSpace(getObject()->getID(), friend_getParkingOffset(), NULL)) + pp->reserveSpace(getObject()->getID(), friend_getParkingOffset(), nullptr)) { // if we had a space at another airfield, release it ParkingPlaceBehaviorInterface* oldPP = getPP(getObject()->getProducerID()); - if (oldPP != NULL && oldPP != pp) + if (oldPP != nullptr && oldPP != pp) { oldPP->releaseSpace(getObject()->getID()); } @@ -2513,11 +2513,11 @@ Bool JetAIUpdate::isParkedAt(const Object* obj) const { if (!getFlag(ALLOW_AIR_LOCO) && !getObject()->isKindOf(KINDOF_PRODUCED_AT_HELIPAD) && - obj != NULL) + obj != nullptr) { Object* airfield; ParkingPlaceBehaviorInterface* pp = getPP(getObject()->getProducerID(), &airfield); - if (pp != NULL && airfield != NULL && airfield == obj) + if (pp != nullptr && airfield != nullptr && airfield == obj) { return true; } @@ -2707,7 +2707,7 @@ void JetAIUpdate::xfer( Xfer *xfer ) drawName = m_lockonDrawable->getTemplate()->getName(); } xfer->xferAsciiString(&drawName); - if (drawName.isNotEmpty() && m_lockonDrawable==NULL) + if (drawName.isNotEmpty() && m_lockonDrawable==nullptr) { const ThingTemplate* tt = TheThingFactory->findTemplate(drawName); if (tt) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 385fadf28e4..ba1a7899b7b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -66,11 +66,11 @@ MissileAIUpdateModuleData::MissileAIUpdateModuleData() m_initialVel = 0; m_initialDist = 0.0f; m_diveDistance = 0.0f; - m_ignitionFX = NULL; + m_ignitionFX = nullptr; m_useWeaponSpeed = false; m_detonateOnNoFuel = FALSE; m_garrisonHitKillCount = 0; - m_garrisonHitKillFX = NULL; + m_garrisonHitKillFX = nullptr; m_lockDistance = 75.0f; m_distanceScatterWhenJammed = 75.0f; m_detonateCallsKill = FALSE; @@ -84,25 +84,25 @@ void MissileAIUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TryToFollowTarget", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_tryToFollowTarget ) }, - { "FuelLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_fuelLifetime ) }, - { "IgnitionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_ignitionDelay ) }, - { "InitialVelocity", INI::parseVelocityReal, NULL, offsetof( MissileAIUpdateModuleData, m_initialVel) }, - { "DistanceToTravelBeforeTurning", INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_initialDist ) }, - { "DistanceToTargetBeforeDiving", INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_diveDistance ) }, - { "DistanceToTargetForLock",INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_lockDistance ) }, - { "IgnitionFX", INI::parseFXList, NULL, offsetof( MissileAIUpdateModuleData, m_ignitionFX ) }, - { "UseWeaponSpeed", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_useWeaponSpeed ) }, - { "DetonateOnNoFuel", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_detonateOnNoFuel ) }, - { "DistanceScatterWhenJammed",INI::parseReal, NULL, offsetof( MissileAIUpdateModuleData, m_distanceScatterWhenJammed ) }, - - { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindof ) }, - { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindofNot ) }, - { "GarrisonHitKillCount", INI::parseUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillCount ) }, - { "GarrisonHitKillFX", INI::parseFXList, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillFX ) }, - { "DetonateCallsKill", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_detonateCallsKill ) }, - { "KillSelfDelay", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_killSelfDelay ) }, - { 0, 0, 0, 0 } + { "TryToFollowTarget", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_tryToFollowTarget ) }, + { "FuelLifetime", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_fuelLifetime ) }, + { "IgnitionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_ignitionDelay ) }, + { "InitialVelocity", INI::parseVelocityReal, nullptr, offsetof( MissileAIUpdateModuleData, m_initialVel) }, + { "DistanceToTravelBeforeTurning", INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_initialDist ) }, + { "DistanceToTargetBeforeDiving", INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_diveDistance ) }, + { "DistanceToTargetForLock",INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_lockDistance ) }, + { "IgnitionFX", INI::parseFXList, nullptr, offsetof( MissileAIUpdateModuleData, m_ignitionFX ) }, + { "UseWeaponSpeed", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_useWeaponSpeed ) }, + { "DetonateOnNoFuel", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_detonateOnNoFuel ) }, + { "DistanceScatterWhenJammed",INI::parseReal, nullptr, offsetof( MissileAIUpdateModuleData, m_distanceScatterWhenJammed ) }, + + { "GarrisonHitKillRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindof ) }, + { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindofNot ) }, + { "GarrisonHitKillCount", INI::parseUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillCount ) }, + { "GarrisonHitKillFX", INI::parseFXList, nullptr, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillFX ) }, + { "DetonateCallsKill", INI::parseBool, nullptr, offsetof( MissileAIUpdateModuleData, m_detonateCallsKill ) }, + { "KillSelfDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( MissileAIUpdateModuleData, m_killSelfDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -127,8 +127,8 @@ MissileAIUpdate::MissileAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_noTurnDistLeft = d->m_initialDist; m_prevPos = *getObject()->getPosition(); m_maxAccel = BIGNUM; - m_detonationWeaponTmpl = NULL; - m_exhaustSysTmpl = NULL; + m_detonationWeaponTmpl = nullptr; + m_exhaustSysTmpl = nullptr; m_isTrackingTarget = FALSE; m_exhaustID = INVALID_PARTICLE_SYSTEM_ID; m_extraBonusFlags = 0; @@ -304,7 +304,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) if (projectileIsArmed() == false) return true; - if (other==NULL) { + if (other==nullptr) { // we hit the ground. Check to see if we hit something unexpected. Coord3D goal = *getGoalPosition(); Coord3D pos = *obj->getPosition(); @@ -321,7 +321,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) } } - if (other != NULL) + if (other != nullptr) { Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); @@ -360,7 +360,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) if (numKilled > 0) { // note, fx is played at center of building, not at grenade's location - FXList::doFXObj(d->m_garrisonHitKillFX, other, NULL); + FXList::doFXObj(d->m_garrisonHitKillFX, other, nullptr); // don't do the normal explosion; just destroy ourselves & return TheGameLogic->destroyObject(obj); @@ -479,7 +479,7 @@ void MissileAIUpdate::doIgnitionState() } FXList::doFXObj(d->m_ignitionFX, getObject()); - if (m_exhaustSysTmpl != NULL) + if (m_exhaustSysTmpl != nullptr) { m_exhaustID = TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject()); } @@ -526,7 +526,7 @@ void MissileAIUpdate::doAttackState(Bool turnOK) { Real lockDistanceSquared = d->m_lockDistance; Real distanceToTargetSquared; - if (m_isTrackingTarget && (getGoalObject() != NULL)) { + if (m_isTrackingTarget && (getGoalObject() != nullptr)) { distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalObject(), FROM_CENTER_2D); } else { distanceToTargetSquared = ThePartitionManager->getDistanceSquared( getObject(), getGoalPosition(), FROM_CENTER_2D ); @@ -568,7 +568,7 @@ void MissileAIUpdate::doAttackState(Bool turnOK) // If I was fired at a flyer and have lost target (most likely they died), then I need to do something better // than cloverleaf around their last spot. - if( m_isTrackingTarget && (getGoalObject() == NULL) ) + if( m_isTrackingTarget && (getGoalObject() == nullptr) ) airborneTargetGone(); } @@ -603,7 +603,7 @@ void MissileAIUpdate::doKillState(void) } if (isIdle()) { // we finished the move - if (getGoalObject()!=NULL) { + if (getGoalObject()!=nullptr) { Locomotor* curLoco = getCurLocomotor(); Real closeEnough = 1.0f; if (curLoco) @@ -625,7 +625,7 @@ void MissileAIUpdate::doKillState(void) } // If I was fired at a flyer and have lost target (most likely they died), then I need to do something better // than cloverleaf around their last spot. - if( m_isTrackingTarget && (getGoalObject() == NULL) ) + if( m_isTrackingTarget && (getGoalObject() == nullptr) ) airborneTargetGone(); } @@ -817,7 +817,7 @@ void MissileAIUpdate::projectileNowJammed() targetPosition.y, TheTerrainLogic->getHighestLayerForDestination(&targetPosition) ); - getStateMachine()->setGoalObject(NULL); + getStateMachine()->setGoalObject(nullptr); // Projectiles are expressly forbidden from getting AIIdle. Who am I to argue. // I need to do something though, because I can no longer give a new move command // while moving because of the big state machine crash fix. @@ -873,7 +873,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) weaponName = m_detonationWeaponTmpl->getName(); } xfer->xferAsciiString(&weaponName); - if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == NULL) + if (weaponName.isNotEmpty() && m_detonationWeaponTmpl == nullptr) { m_detonationWeaponTmpl = TheWeaponStore->findWeaponTemplate(weaponName); } @@ -884,7 +884,7 @@ void MissileAIUpdate::xfer( Xfer *xfer ) exhaustName = m_exhaustSysTmpl->getName(); } xfer->xferAsciiString(&exhaustName); - if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == NULL) + if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == nullptr) { m_exhaustSysTmpl = TheParticleSystemManager->findTemplate(exhaustName); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index 2939167495a..80050db4914 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -67,8 +67,8 @@ void POWTruckAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "BoredTime", INI::parseDurationUnsignedInt, NULL, offsetof( POWTruckAIUpdateModuleData, m_boredTimeInFrames ) }, - { "AtPrisonDistance", INI::parseReal, NULL, offsetof( POWTruckAIUpdateModuleData, m_hangAroundPrisonDistance ) }, + { "BoredTime", INI::parseDurationUnsignedInt, nullptr, offsetof( POWTruckAIUpdateModuleData, m_boredTimeInFrames ) }, + { "AtPrisonDistance", INI::parseReal, nullptr, offsetof( POWTruckAIUpdateModuleData, m_hangAroundPrisonDistance ) }, { 0, 0, 0, 0 } }; @@ -220,7 +220,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) // sanity, POW_TRUCK_TASK_COLLECTING_TARGET and POW_TRUCK_TASK_RETURNING_PRISONERS require taskObject parameters if( (task == POW_TRUCK_TASK_COLLECTING_TARGET || task == POW_TRUCK_TASK_RETURNING_PRISONERS) && - taskObject == NULL ) + taskObject == nullptr ) { DEBUG_CRASH(( "POWTruckAIUpdate::setTask - Illegal arguments" )); @@ -329,11 +329,11 @@ void POWTruckAIUpdate::privateReturnPrisoners( Object *prison, CommandSourceType setAIMode( AUTOMATIC ); // if no prison is provided, find one if possible - if( prison == NULL ) + if( prison == nullptr ) prison = findBestPrison(); // still no prison, nothing to do - if( prison == NULL ) + if( prison == nullptr ) return; // set us into the return prisoners "state" @@ -430,7 +430,7 @@ void POWTruckAIUpdate::updateFindTarget( void ) if( contain->getContainCount() != 0 ) doReturnPrisoners(); else - doReturnToPrison( NULL ); + doReturnToPrison( nullptr ); } @@ -509,7 +509,7 @@ static void putContainedInPrison( Object *obj, void *userData ) PrisonerReturnData *returnData = (PrisonerReturnData *)userData; // sanity - DEBUG_ASSERTCRASH( returnData != NULL && returnData->source != NULL && returnData->dest != NULL, + DEBUG_ASSERTCRASH( returnData != nullptr && returnData->source != nullptr && returnData->dest != nullptr, ("putContainedInPrison: Invalid arguments") ); // take 'obj' out of the source @@ -541,7 +541,7 @@ void POWTruckAIUpdate::updateReturnPrisoners( void ) Object *prison = TheGameLogic->findObjectByID( m_prisonID ); // prison has gone away, do this all over again - if( prison == NULL ) + if( prison == nullptr ) { doReturnPrisoners(); @@ -575,7 +575,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) Object *prison = findBestPrison(); // if no prison is available, nothing to do - if( prison == NULL ) + if( prison == nullptr ) { setTask( POW_TRUCK_TASK_WAITING ); @@ -605,11 +605,11 @@ void POWTruckAIUpdate::doReturnToPrison( Object *prison ) setTask( POW_TRUCK_TASK_WAITING ); // find the closest prison if one was not provided - if( prison == NULL ) + if( prison == nullptr ) prison = findBestPrison(); // if no prison found forget it - if( prison == NULL ) + if( prison == nullptr ) return; // get our info @@ -634,7 +634,7 @@ Object *POWTruckAIUpdate::findBestPrison( void ) ObjectID prisonID = getObject()->getProducerID(); if( prisonID == INVALID_ID ) - return NULL; + return nullptr; // find prison object Object *prison = TheGameLogic->findObjectByID( prisonID ); @@ -652,8 +652,8 @@ Object *POWTruckAIUpdate::findBestTarget( void ) Player *player = us->getControllingPlayer(); // sanity - if( player == NULL ) - return NULL; + if( player == nullptr ) + return nullptr; // get our info const AIUpdateInterface *ai = us->getAIUpdateInterface(); @@ -663,7 +663,7 @@ Object *POWTruckAIUpdate::findBestTarget( void ) // scan all objects, there is no range Object *other; Real closestTargetDistSq = HUGE_DIST; - Object *closestTarget = NULL; + Object *closestTarget = nullptr; for( other = TheGameLogic->getFirstObject(); other; other = other->getNextObject() ) { @@ -680,7 +680,7 @@ Object *POWTruckAIUpdate::findBestTarget( void ) // is this target closer than the one we've found so far Real distSq = ThePartitionManager->getDistanceSquared( us, other, FROM_CENTER_2D ); - if( closestTarget == NULL || distSq < closestTargetDistSq ) + if( closestTarget == nullptr || distSq < closestTargetDistSq ) { // we must be able to pathfind to this target @@ -727,13 +727,13 @@ static void putPrisonersInPrison( Object *obj, void *userData ) Object *prison = prisonUnloadData->destPrison; // sanity - DEBUG_ASSERTCRASH( prison, ("putPrisonersInPrison: NULL user data") ); - DEBUG_ASSERTCRASH( obj->getContainedBy() != NULL, + DEBUG_ASSERTCRASH( prison, ("putPrisonersInPrison: null user data") ); + DEBUG_ASSERTCRASH( obj->getContainedBy() != nullptr, ("putPrisonersInPrison: Prisoner '%s' is not contained by anything, it should be contained by a POW truck", obj->getTemplate()->getName().str()) ); // extra super sanity, just so that we don't crash ... this is in the assert above - if( obj->getContainedBy() == NULL ) + if( obj->getContainedBy() == nullptr ) return; // take 'obj' out of the truck @@ -764,7 +764,7 @@ void POWTruckAIUpdate::unloadPrisonersToPrison( Object *prison ) Object *us = getObject(); // sanity - if( prison == NULL ) + if( prison == nullptr ) return; // get contain modules @@ -834,7 +834,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) Object *us = getObject(); // sanity - if( prisoner == NULL ) + if( prisoner == nullptr ) return; // validate that we can load this prisoner @@ -862,7 +862,7 @@ void POWTruckAIUpdate::loadPrisoner( Object *prisoner ) // AIUpdateInterface *prisonerAI = prisoner->getAIUpdateInterface(); if( prisonerAI ) - prisonerAI->setSurrendered( NULL, FALSE ); + prisonerAI->setSurrendered( nullptr, FALSE ); // done adding prisoner, for automatic AI find another target, for manual just wait if( m_aiMode == AUTOMATIC ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp index 46de82863b4..86951f5455a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp @@ -55,8 +55,8 @@ void RailedTransportAIUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { "PathPrefixName", INI::parseAsciiString, NULL, offsetof( RailedTransportAIUpdateModuleData, m_pathPrefixName ) }, - { 0, 0, 0, 0 } + { "PathPrefixName", INI::parseAsciiString, nullptr, offsetof( RailedTransportAIUpdateModuleData, m_pathPrefixName ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); @@ -135,7 +135,7 @@ void RailedTransportAIUpdate::pickAndMoveToInitialLocation( void ) const Coord3D *ourPos = us->getPosition(); // select the path with the closest ending waypoint to our location - Waypoint *waypoint, *closestEndWaypoint = NULL; + Waypoint *waypoint, *closestEndWaypoint = nullptr; Int closestPath = INVALID_PATH; Real closestDist = 99999999.9f; for( Int i = 0; i < m_numPaths; ++i ) @@ -309,13 +309,13 @@ void RailedTransportAIUpdate::privateExecuteRailedTransport( CommandSourceType c // if we just call the method getReailedTransportDockUpdateInterface, it will execute // the method for *THIS AI UPDATE MODULE* which of course is not our dock update // - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = us->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; // if we've in the process of loading or unloading anything we can't do a transport sequence - if( rtdui == NULL || rtdui->isLoadingOrUnloading() ) + if( rtdui == nullptr || rtdui->isLoadingOrUnloading() ) return; // pick the next path @@ -345,13 +345,13 @@ void RailedTransportAIUpdate::privateEvacuate( Int exposeStealthUnits, CommandSo // if we just call the method getReailedTransportDockUpdateInterface, it will execute // the method for *THIS AI UPDATE MODULE* which of course is not our dock update // - RailedTransportDockUpdateInterface *rtdui = NULL; + RailedTransportDockUpdateInterface *rtdui = nullptr; for( BehaviorModule **u = us->getBehaviorModules(); *u; ++u ) - if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != NULL ) + if( (rtdui = (*u)->getRailedTransportDockUpdateInterface()) != nullptr ) break; // sanity - if( rtdui == NULL ) + if( rtdui == nullptr ) return; // can't unload when in transit diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index 4551ebea2e1..04a21d7cc38 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -137,7 +137,7 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_whistleSound.setObjectID( getObject()->getID() ) ; m_clicketyClackSound.setObjectID( getObject()->getID() ) ; - m_track = NULL; + m_track = nullptr; m_currentPointHandle = 0xfacade; m_waitAtStationTimer = 0; @@ -171,12 +171,12 @@ RailroadBehavior::~RailroadBehavior( void ) TheAudio->removeAudioEvent( m_runningSound.getPlayingHandle() );// no more chugchug when I'm dead - if( m_track != NULL ) + if( m_track != nullptr ) { if (m_track->releaseReference()) delete m_track; - m_track = NULL; + m_track = nullptr; } @@ -497,7 +497,7 @@ void RailroadBehavior::playImpactSound(Object *victim, const Coord3D *impactPosi void RailroadBehavior::loadTrackData( void ) { - if ( m_track != NULL ) + if ( m_track != nullptr ) return;// lets do this only once! @@ -511,7 +511,7 @@ void RailroadBehavior::loadTrackData( void ) // m_anchorWaypointID COULD HAVE BEEN RECORDED IN XFER, WHICH MEANS I LOADED MY TRACK DATA IN A PRIOR LIFE, // SO LETS JUST RE_INIT THE TRACK BASED ON THAT POINT, AUTOMAGICALLY - Waypoint *anchorWaypoint = NULL; + Waypoint *anchorWaypoint = nullptr; if ( m_anchorWaypointID == INVALID_WAYPOINT_ID ) { Waypoint *anyWaypoint = TheTerrainLogic->getFirstWaypoint(); @@ -551,7 +551,7 @@ void RailroadBehavior::loadTrackData( void ) m_track = NEW( TrainTrack );// this constructor inc's the refcount to 1 // From now until the next carriage is added, this track is writable using getWritablePointList(); - // This method will return NULL when refcount is 2 or more + // This method will return nullptr when refcount is 2 or more // getPointList returns the list as const to any caller // each carriage must increment the reference when this pointer is passed to it, // any subsequent carriage (destructor) will delete this memory here if it releases refcount to zero @@ -590,7 +590,7 @@ void RailroadBehavior::loadTrackData( void ) Waypoint *anotherWaypoint = scanner->getLink( 0 ); // if scanner's link is valid, we'll add it to the track. now - if ( anotherWaypoint != NULL ) + if ( anotherWaypoint != nullptr ) { //measure the track while we are at it @@ -605,7 +605,7 @@ void RailroadBehavior::loadTrackData( void ) trackPoint.m_distanceFromPrev = distFromTo; trackPoint.m_distanceFromFirst = m_track->m_length; trackPoint.m_isFirstPoint = FALSE; - trackPoint.m_isLastPoint = anotherWaypoint->getLink( 0 ) == NULL; + trackPoint.m_isLastPoint = anotherWaypoint->getLink( 0 ) == nullptr; trackPoint.m_isTunnelOrBridge = anotherWaypoint->getName().endsWith("Tunnel"); trackPoint.m_isStation = anotherWaypoint->getName().endsWith("Station"); trackPoint.m_isPingPong = scanner->getName().endsWith("PingPong"); @@ -910,7 +910,7 @@ class PartitionFilterIsValidCarriage : public PartitionFilter { // must exist! - if ( m_obj == NULL || objOther == NULL) + if ( m_obj == nullptr || objOther == nullptr) return FALSE; //must not be me! @@ -959,19 +959,19 @@ void RailroadBehavior::createCarriages( void ) PartitionFilterIsValidCarriage pfivc(self, md); - PartitionFilter *filters[] = { &pfivc, 0 }; + PartitionFilter *filters[] = { &pfivc, nullptr }; - Object* xferCarriage = NULL; - Object *closeCarriage = NULL; - Object *firstCarriage = NULL; + Object* xferCarriage = nullptr; + Object *closeCarriage = nullptr; + Object *firstCarriage = nullptr; if ( m_trailerID != INVALID_ID ) { xferCarriage = TheGameLogic->findObjectByID( m_trailerID ); } - if (xferCarriage != NULL) + if (xferCarriage != nullptr) closeCarriage = xferCarriage; else closeCarriage = ThePartitionManager->getClosestObject( &myHitchLoc, maxRadius, FROM_CENTER_2D, filters); @@ -1050,7 +1050,7 @@ void RailroadBehavior::hitchNewCarriagebyTemplate( ObjectID locoID, const Templa //Okay that's me, now for the next guy //--------------------------------------- - Object *newCarriage = NULL; + Object *newCarriage = nullptr; if ( iter != list.end() )// this test is bogus { @@ -1119,16 +1119,16 @@ void RailroadBehavior::hitchNewCarriagebyProximity( ObjectID locoID, TrainTrack myHitchLoc.add( & hitchOffset ); PartitionFilterIsValidCarriage pfivc(self, md); - PartitionFilter *filters[] = { &pfivc, 0 }; + PartitionFilter *filters[] = { &pfivc, nullptr }; - Object* xferCarriage = NULL; - Object *closeCarriage = NULL; + Object* xferCarriage = nullptr; + Object *closeCarriage = nullptr; if ( m_trailerID != INVALID_ID ) { xferCarriage = TheGameLogic->findObjectByID( m_trailerID ); } - if (xferCarriage != NULL) + if (xferCarriage != nullptr) closeCarriage = xferCarriage; else closeCarriage = ThePartitionManager->getClosestObject( &myHitchLoc, maxRadius, FROM_CENTER_2D, filters); @@ -1425,7 +1425,7 @@ void RailroadBehavior::FindPosByPathDistance( Coord3D *pos, const Real dist, con if (thisPoint && thisPoint->m_distanceFromFirst < actualDistance)// I am after this point, and { Coord3D thisPointPos = thisPoint->m_position; - const TrackPoint *nextPoint = NULL; + const TrackPoint *nextPoint = nullptr; // TheSuperHackers Mauller 02/04/2025 Prevent dereferencing of endpoint pointer which throws asserts during Debug if (pointIter != pointList->end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp index 0abfd3b1270..ce7a8cc5af3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp @@ -74,7 +74,7 @@ AIStateMachine* SupplyTruckAIUpdate::makeStateMachine() //------------------------------------------------------------------------------------------------- SupplyTruckAIUpdate::SupplyTruckAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdateInterface( thing, moduleData ) { - m_supplyTruckStateMachine = NULL; + m_supplyTruckStateMachine = nullptr; m_preferredDock = INVALID_ID; m_numberBoxes = 0; m_forcePending = FALSE; @@ -365,9 +365,9 @@ TheInGameUI->DEBUG_addFloatingText("entering idle state", getMachineOwner()->get #endif Object *owner = getMachineOwner(); - if (owner != NULL) { + if (owner != nullptr) { AIUpdateInterface * ownerAI = owner->getAIUpdateInterface(); - if (ownerAI != NULL) { + if (ownerAI != nullptr) { // This is to get idle workers to always show up on the // "idle worker button." // Basically if you have a worker interface, and we are entering @@ -375,7 +375,7 @@ TheInGameUI->DEBUG_addFloatingText("entering idle state", getMachineOwner()->get // know so it can decide which idle state it wants us to actually // be in from its perspective. WorkerAIInterface *workerAI = ownerAI->getWorkerAIInterface(); - if (workerAI != NULL) { + if (workerAI != nullptr) { workerAI->exitingSupplyTruckState(); } } @@ -394,39 +394,39 @@ SupplyTruckStateMachine::SupplyTruckStateMachine( Object *owner ) : StateMachine { static const StateConditionInfo busyConditions[] = { - StateConditionInfo(ownerIdle, ST_IDLE, NULL), - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerIdle, ST_IDLE, nullptr), + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo idleConditions[] = { - StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), - StateConditionInfo(isForcedIntoWantingState, ST_WANTING, NULL), - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isForcedIntoBusyState, ST_BUSY, nullptr), + StateConditionInfo(isForcedIntoWantingState, ST_WANTING, nullptr), + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo wantingConditions[] = { - StateConditionInfo(ownerDocking, ST_DOCKING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerDocking, ST_DOCKING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo regroupingConditions[] = { - StateConditionInfo(ownerPlayerCommanded, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(ownerPlayerCommanded, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo dockingConditions[] = { - StateConditionInfo(isForcedIntoBusyState, ST_BUSY, NULL), - StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, NULL), - StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(isForcedIntoBusyState, ST_BUSY, nullptr), + StateConditionInfo(ownerAvailableForSupplying, ST_WANTING, nullptr), + StateConditionInfo(ownerNotDockingOrIdle, ST_BUSY, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -564,14 +564,14 @@ TheInGameUI->DEBUG_addFloatingText("entering regrouping state", getMachineOwner( if( !ownerPlayer || !ownerAI ) return STATE_FAILURE; - ownerAI->ignoreObstacle( NULL ); + ownerAI->ignoreObstacle( nullptr ); SupplyTruckAIInterface *update = owner->getAIUpdateInterface()->getSupplyTruckAIInterface(); if( !update ) { return STATE_FAILURE; } - Object *destinationObject = NULL; + Object *destinationObject = nullptr; KindOfMaskType kindof; KindOfMaskType kindofnot; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index 849d6630982..047072d58ed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -62,7 +62,7 @@ TransportAIUpdate::~TransportAIUpdate( void ) void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -107,7 +107,7 @@ void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) @@ -152,7 +152,7 @@ void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsTo void TransportAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsToFire, CommandSourceType cmdSource ) { ContainModuleInterface* contain = getObject()->getContain(); - if( contain != NULL && contain->isPassengerAllowedToFire() ) + if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack // too, but only if this is a direct command. (As opposed to a passive aquire) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 5233e93bf05..59c238d7834 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -85,10 +85,10 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : { // - // initialize the dozer machine to NULL, we want to do this and create it during the update + // initialize the dozer machine to nullptr, we want to do this and create it during the update // implementation because at this point we don't have the object all setup m_isRebuild = FALSE; - m_dozerMachine = NULL; + m_dozerMachine = nullptr; for( Int i = 0; i < DOZER_NUM_TASKS; i++ ) { m_task[ i ].m_targetObjectID = INVALID_ID; @@ -102,12 +102,12 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : m_currentTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value - m_supplyTruckStateMachine = NULL; + m_supplyTruckStateMachine = nullptr; m_numberBoxes = 0; m_forcePending = FALSE; m_forcedBusyPending = FALSE; - m_workerMachine = NULL; + m_workerMachine = nullptr; m_suppliesDepletedVoice = getWorkerAIUpdateModuleData()->m_suppliesDepletedVoice; @@ -172,17 +172,17 @@ Real WorkerAIUpdate::getBoredRange( void ) const void WorkerAIUpdate::createMachines( void ) { - if( m_workerMachine == NULL ) + if( m_workerMachine == nullptr ) { m_workerMachine = newInstance(WorkerStateMachine)( getObject() ); - if( m_dozerMachine == NULL ) + if( m_dozerMachine == nullptr ) { m_dozerMachine = newInstance(DozerPrimaryStateMachine)( getObject() ); m_dozerMachine->initDefaultState(); } - if( m_supplyTruckStateMachine == NULL ) + if( m_supplyTruckStateMachine == nullptr ) { m_supplyTruckStateMachine = newInstance(SupplyTruckStateMachine)( getObject() ); m_supplyTruckStateMachine->initDefaultState(); @@ -280,7 +280,7 @@ UpdateSleepTime WorkerAIUpdate::update( void ) TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; #if !RETAIL_COMPATIBLE_CRC - else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + else if (currentTask == DOZER_TASK_BUILD && targetObject == nullptr) invalidTask = TRUE; #endif @@ -337,8 +337,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, createMachines(); // sanity - if( what == NULL || pos == NULL || owningPlayer == NULL ) - return NULL; + if( what == nullptr || pos == nullptr || owningPlayer == nullptr ) + return nullptr; // sanity DEBUG_ASSERTCRASH( getObject()->getControllingPlayer() == owningPlayer, @@ -357,8 +357,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } else @@ -366,7 +366,7 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, // make sure the player is capable of building this if( TheBuildAssistant->canMakeUnit( getObject(), what ) != CANMAKE_OK ) - return NULL; + return nullptr; // validate the the position to build at is valid if( TheBuildAssistant->isLocationLegalToBuild( pos, what, angle, @@ -374,8 +374,8 @@ Object *WorkerAIUpdate::construct( const ThingTemplate *what, BuildAssistant::CLEAR_PATH | BuildAssistant::NO_OBJECT_OVERLAP | BuildAssistant::SHROUD_REVEALED, - getObject(), NULL ) != LBC_OK ) - return NULL; + getObject(), nullptr ) != LBC_OK ) + return nullptr; } @@ -477,7 +477,7 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return FALSE; // if we're not repairing right now, we don't have any accept restrictions @@ -498,14 +498,14 @@ Bool WorkerAIUpdate::canAcceptNewRepair( Object *obj ) if( currentRepair->isKindOf( KINDOF_BRIDGE_TOWER ) && obj->isKindOf( KINDOF_BRIDGE_TOWER ) ) { - BridgeTowerBehaviorInterface *currentTowerInterface = NULL; - BridgeTowerBehaviorInterface *newTowerInterface = NULL; + BridgeTowerBehaviorInterface *currentTowerInterface = nullptr; + BridgeTowerBehaviorInterface *newTowerInterface = nullptr; currentTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( currentRepair ); newTowerInterface = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( obj ); // sanity - if( currentTowerInterface == NULL || newTowerInterface == NULL ) + if( currentTowerInterface == nullptr || newTowerInterface == nullptr ) { DEBUG_CRASH(( "Unable to find bridge tower interface on object" )); @@ -588,7 +588,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -610,7 +610,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) DEBUG_ASSERTCRASH( task >= 0 && task < DOZER_NUM_TASKS, ("Illegal dozer task '%d'", task) ); // sanity - if( target == NULL ) + if( target == nullptr ) return; m_preferredDock = INVALID_ID; // If we are dozing, we don't want any supply truck stuff going on. jba. @@ -632,7 +632,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) Coord3D position; target = DozerAIUpdate::findGoodBuildOrRepairPositionAndTarget(me, target, position); - if (target == NULL) + if (target == nullptr) return; // could happen for some bridges // @@ -819,7 +819,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) ///@todo This would be correct except that we don't have idle crane animations and it is December. // Object* goalObject = TheGameLogic->findObjectByID(m_task[task].m_targetObjectID); -// if (goalObject != NULL) +// if (goalObject != nullptr) // { // goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); // } @@ -830,7 +830,7 @@ void WorkerAIUpdate::internalTaskCompleteOrCancelled( DozerTask task ) // -------------------------------------------------------------------------------------------- case DOZER_TASK_REPAIR: { - Object *obj = NULL; + Object *obj = nullptr; // the builder is no longer actively repairing something getObject()->clearModelConditionState( MODELCONDITION_ACTIVELY_CONSTRUCTING ); @@ -890,7 +890,7 @@ void WorkerAIUpdate::onDelete( void ) for( i = 0; i < DOZER_NUM_TASKS; i++ ) { Object* goalObject = TheGameLogic->findObjectByID(m_task[i].m_targetObjectID); - if (goalObject != NULL) + if (goalObject != nullptr) { goalObject->clearModelConditionState(MODELCONDITION_ACTIVELY_BEING_CONSTRUCTED); } @@ -927,18 +927,18 @@ const Coord3D* WorkerAIUpdate::getDockPoint( DozerTask task, DozerDockPoint poin // sanity if( task < 0 || task >= DOZER_NUM_TASKS ) - return NULL; + return nullptr; // sanity if( point < 0 || point >= DOZER_NUM_DOCK_POINTS ) - return NULL; + return nullptr; // if the point has been set (is valid) then return it if( m_dockPoint[ task ][ point ].valid ) return &m_dockPoint[ task ][ point ].location; // no valid point has been set for this dock point on this task - return NULL; + return nullptr; } @@ -1171,14 +1171,14 @@ WorkerStateMachine::WorkerStateMachine( Object *owner ) : StateMachine( owner, " { static const StateConditionInfo asDozerConditions[] = { - StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(supplyTruckSubMachineWantsToEnter, AS_SUPPLY_TRUCK, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; static const StateConditionInfo asTruckConditions[] = { - StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, NULL), - StateConditionInfo(NULL, NULL, NULL) + StateConditionInfo(supplyTruckSubMachineReadyToLeave, AS_DOZER, nullptr), + StateConditionInfo(nullptr, INVALID_STATE_ID, nullptr) }; // order matters: first state is the default state. @@ -1255,7 +1255,7 @@ Bool WorkerStateMachine::supplyTruckSubMachineReadyToLeave( State *thisState, vo // so there is no transition out on the way in. Active and Busy means it isn't doing // anything Supply related. - return !supplyTruckSubMachineWantsToEnter( thisState, NULL ) + return !supplyTruckSubMachineWantsToEnter( thisState, nullptr ) && update->isSupplyTruckBrainActiveAndBusy(); } @@ -1327,18 +1327,18 @@ void WorkerAIUpdate::createBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to create scaffolding if necessary @@ -1353,18 +1353,18 @@ void WorkerAIUpdate::removeBridgeScaffolding( Object *bridgeTower ) { // sanity - if( bridgeTower == NULL ) + if( bridgeTower == nullptr ) return; // get the bridge behavior interface from the bridge object that this tower is a part of BridgeTowerBehaviorInterface *btbi = BridgeTowerBehavior::getBridgeTowerBehaviorInterfaceFromObject( bridgeTower ); - if( btbi == NULL ) + if( btbi == nullptr ) return; Object *bridgeObject = TheGameLogic->findObjectByID( btbi->getBridgeID() ); - if( bridgeObject == NULL ) + if( bridgeObject == nullptr ) return; BridgeBehaviorInterface *bbi = BridgeBehavior::getBridgeBehaviorInterfaceFromObject( bridgeObject ); - if( bbi == NULL ) + if( bbi == nullptr ) return; // tell the bridge to end any scaffolding from repairing diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index 0c91b46ac67..04c527d390c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -52,11 +52,11 @@ void AssistedTargetingUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "AssistingClipSize", INI::parseInt, NULL, offsetof( AssistedTargetingUpdateModuleData, m_clipSize ) }, + { "AssistingClipSize", INI::parseInt, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_clipSize ) }, { "AssistingWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( AssistedTargetingUpdateModuleData, m_weaponSlot ) }, - { "LaserFromAssisted", INI::parseAsciiString, NULL, offsetof( AssistedTargetingUpdateModuleData, m_laserFromAssistedName ) }, - { "LaserToTarget", INI::parseAsciiString, NULL, offsetof( AssistedTargetingUpdateModuleData, m_laserToTargetName ) }, - { 0, 0, 0, 0 } + { "LaserFromAssisted", INI::parseAsciiString, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_laserFromAssistedName ) }, + { "LaserToTarget", INI::parseAsciiString, nullptr, offsetof( AssistedTargetingUpdateModuleData, m_laserToTargetName ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -65,8 +65,8 @@ void AssistedTargetingUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- AssistedTargetingUpdate::AssistedTargetingUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ) { - m_laserFromAssisted = NULL; - m_laserToTarget = NULL; + m_laserFromAssisted = nullptr; + m_laserToTarget = nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp index aacb8a3e7b3..e75087bd79c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoFindHealingUpdate.cpp @@ -67,11 +67,11 @@ AutoFindHealingUpdateModuleData::AutoFindHealingUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( AutoFindHealingUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_scanRange ) }, - { "NeverHeal", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_neverHeal ) }, - { "AlwaysHeal", INI::parseReal, NULL, offsetof( AutoFindHealingUpdateModuleData, m_alwaysHeal ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_scanRange ) }, + { "NeverHeal", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_neverHeal ) }, + { "AlwaysHeal", INI::parseReal, nullptr, offsetof( AutoFindHealingUpdateModuleData, m_alwaysHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -117,7 +117,7 @@ UpdateSleepTime AutoFindHealingUpdate::update() m_nextScanFrames = data->m_scanFrames; AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) return UPDATE_SLEEP_NONE; + if (ai==nullptr) return UPDATE_SLEEP_NONE; // Check health. BodyModuleInterface *body = obj->getBodyModule(); @@ -152,7 +152,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() { const AutoFindHealingUpdateModuleData *data = getAutoFindHealingUpdateModuleData(); Object *me = getObject(); - Object *bestTarget = NULL; + Object *bestTarget = nullptr; Real closestDistSqr=0; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( me->getPosition(), data->m_scanRange, FROM_CENTER_2D ); @@ -167,7 +167,7 @@ Object* AutoFindHealingUpdate::scanClosestTarget() } Real fDistSqr = ThePartitionManager->getDistanceSquared( me, other, FROM_CENTER_2D ) ; - if (bestTarget==NULL) { + if (bestTarget==nullptr) { bestTarget = other; closestDistSqr = fDistSqr; continue; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp index ba7a4650447..3e071a6619e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp @@ -56,7 +56,7 @@ void BaseRegenerateUpdateModuleData::buildFieldParse( MultiIniFieldParse &p ) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add( dataFieldParse ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index 2cf23405c6c..c5f46810106 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -66,7 +66,7 @@ //------------------------------------------------------------------------------------------------- BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_bombardmentPlanAnimationFrames = 0; m_holdTheLinePlanAnimationFrames = 0; m_searchAndDestroyPlanAnimationFrames = 0; @@ -89,41 +89,41 @@ BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( BattlePlanUpdateModuleData, m_specialPowerTemplate ) }, - - { "BombardmentPlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentPlanAnimationFrames ) }, - { "HoldTheLinePlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePlanAnimationFrames ) }, - { "SearchAndDestroyPlanAnimationTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPlanAnimationFrames ) }, - { "TransitionIdleTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_transitionIdleFrames ) }, - - { "BombardmentPlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentUnpackName ) }, - { "BombardmentPlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentPackName ) }, - { "BombardmentMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentMessageLabel ) }, - { "BombardmentAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_bombardmentAnnouncementName ) }, - { "SearchAndDestroyPlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyUnpackName ) }, - { "SearchAndDestroyPlanIdleLoopSoundName",INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyIdleName ) }, - { "SearchAndDestroyPlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPackName ) }, - { "SearchAndDestroyMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyMessageLabel ) }, - { "SearchAndDestroyAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyAnnouncementName ) }, - { "HoldTheLinePlanUnpackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineUnpackName ) }, - { "HoldTheLinePlanPackSoundName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePackName ) }, - { "HoldTheLineMessageLabel", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineMessageLabel ) }, - { "HoldTheLineAnnouncementName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineAnnouncementName ) }, - - { "ValidMemberKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( BattlePlanUpdateModuleData, m_validMemberKindOf ) }, - { "InvalidMemberKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( BattlePlanUpdateModuleData, m_invalidMemberKindOf ) }, - { "BattlePlanChangeParalyzeTime", INI::parseDurationUnsignedInt, NULL, offsetof( BattlePlanUpdateModuleData, m_battlePlanParalyzeFrames ) }, - { "HoldTheLinePlanArmorDamageScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_holdTheLineArmorDamageScalar ) }, - { "SearchAndDestroyPlanSightRangeScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroySightRangeScalar ) }, - - { "StrategyCenterSearchAndDestroySightRangeScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroySightRangeScalar ) }, - { "StrategyCenterSearchAndDestroyDetectsStealth", INI::parseBool, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroyDetectsStealth ) }, - { "StrategyCenterHoldTheLineMaxHealthScalar", INI::parseReal, NULL, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthScalar ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( BattlePlanUpdateModuleData, m_specialPowerTemplate ) }, + + { "BombardmentPlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentPlanAnimationFrames ) }, + { "HoldTheLinePlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePlanAnimationFrames ) }, + { "SearchAndDestroyPlanAnimationTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPlanAnimationFrames ) }, + { "TransitionIdleTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_transitionIdleFrames ) }, + + { "BombardmentPlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentUnpackName ) }, + { "BombardmentPlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentPackName ) }, + { "BombardmentMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentMessageLabel ) }, + { "BombardmentAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_bombardmentAnnouncementName ) }, + { "SearchAndDestroyPlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyUnpackName ) }, + { "SearchAndDestroyPlanIdleLoopSoundName",INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyIdleName ) }, + { "SearchAndDestroyPlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyPackName ) }, + { "SearchAndDestroyMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyMessageLabel ) }, + { "SearchAndDestroyAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroyAnnouncementName ) }, + { "HoldTheLinePlanUnpackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineUnpackName ) }, + { "HoldTheLinePlanPackSoundName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLinePackName ) }, + { "HoldTheLineMessageLabel", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineMessageLabel ) }, + { "HoldTheLineAnnouncementName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineAnnouncementName ) }, + + { "ValidMemberKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( BattlePlanUpdateModuleData, m_validMemberKindOf ) }, + { "InvalidMemberKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( BattlePlanUpdateModuleData, m_invalidMemberKindOf ) }, + { "BattlePlanChangeParalyzeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( BattlePlanUpdateModuleData, m_battlePlanParalyzeFrames ) }, + { "HoldTheLinePlanArmorDamageScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_holdTheLineArmorDamageScalar ) }, + { "SearchAndDestroyPlanSightRangeScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_searchAndDestroySightRangeScalar ) }, + + { "StrategyCenterSearchAndDestroySightRangeScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroySightRangeScalar ) }, + { "StrategyCenterSearchAndDestroyDetectsStealth", INI::parseBool, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterSearchAndDestroyDetectsStealth ) }, + { "StrategyCenterHoldTheLineMaxHealthScalar", INI::parseReal, nullptr, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthScalar ) }, { "StrategyCenterHoldTheLineMaxHealthChangeType", INI::parseIndexList, TheMaxHealthChangeTypeNames, offsetof( BattlePlanUpdateModuleData, m_strategyCenterHoldTheLineMaxHealthChangeType ) }, - { "VisionObjectName", INI::parseAsciiString, NULL, offsetof( BattlePlanUpdateModuleData, m_visionObjectName ) }, + { "VisionObjectName", INI::parseAsciiString, nullptr, offsetof( BattlePlanUpdateModuleData, m_visionObjectName ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -131,7 +131,7 @@ BattlePlanUpdateModuleData::BattlePlanUpdateModuleData() //------------------------------------------------------------------------------------------------- BattlePlanUpdate::BattlePlanUpdate( Thing *thing, const ModuleData* moduleData ) : SpecialPowerUpdateModule( thing, moduleData ), - m_bonuses(NULL) + m_bonuses(nullptr) { const BattlePlanUpdateModuleData *data = getBattlePlanUpdateModuleData(); @@ -155,7 +155,7 @@ BattlePlanUpdate::BattlePlanUpdate( Thing *thing, const ModuleData* moduleData ) m_visionObjectID = INVALID_ID; - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; } //------------------------------------------------------------------------------------------------- @@ -196,7 +196,7 @@ void BattlePlanUpdate::onDelete() Player* player = getObject()->getControllingPlayer(); // however, player CAN legitimately be null during game reset cycles // (and which point it doesn't really matter if we can remove the bonus or not) - //DEBUG_ASSERTCRASH(player != NULL, ("Hmm, controller is null")); + //DEBUG_ASSERTCRASH(player != nullptr, ("Hmm, controller is null")); if( player && m_planAffectingArmy != PLANSTATUS_NONE ) { player->changeBattlePlan( m_planAffectingArmy, -1, m_bonuses ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp index d2bd3ef3d1d..efbb3e358be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp @@ -54,11 +54,11 @@ BoneFXUpdateModuleData::BoneFXUpdateModuleData(void) Int i, j; for (i = 0; i < BODYDAMAGETYPE_COUNT; ++i) { for (j = 0; j < BONE_FX_MAX_BONES; ++j) { - m_fxList[i][j].fx = NULL; + m_fxList[i][j].fx = nullptr; m_fxList[i][j].onlyOnce = TRUE; - m_OCL[i][j].ocl = NULL; + m_OCL[i][j].ocl = nullptr; m_OCL[i][j].onlyOnce = TRUE; - m_particleSystem[i][j].particleSysTemplate = NULL; + m_particleSystem[i][j].particleSysTemplate = nullptr; m_particleSystem[i][j].onlyOnce = TRUE; } } @@ -99,7 +99,7 @@ void BoneFXUpdate::onObjectCreated() { static NameKeyType key_BoneFXDamage = NAMEKEY("BoneFXDamage"); BoneFXDamage* bfxd = (BoneFXDamage*)getObject()->findDamageModule(key_BoneFXDamage); - if (bfxd == NULL) + if (bfxd == nullptr) { DEBUG_CRASH(("BoneFXUpdate requires BoneFXDamage")); throw INI_INVALID_DATA; @@ -143,8 +143,8 @@ static void parseFXLocInfo( INI *ini, void *instance, BoneLocInfo *locInfo ) static void parseGameClientRandomDelay( INI *ini, void *instance, GameClientRandomVariable *delay) { Real min, max; - INI::parseDurationReal(ini, instance, &min, NULL); - INI::parseDurationReal(ini, instance, &max, NULL); + INI::parseDurationReal(ini, instance, &min, nullptr); + INI::parseDurationReal(ini, instance, &max, nullptr); delay->setRange(min, max, GameClientRandomVariable::DistributionType::UNIFORM); } @@ -152,8 +152,8 @@ static void parseGameClientRandomDelay( INI *ini, void *instance, GameClientRand static void parseGameLogicRandomDelay( INI *ini, void *instance, GameLogicRandomVariable *delay) { Real min, max; - INI::parseDurationReal(ini, instance, &min, NULL); - INI::parseDurationReal(ini, instance, &max, NULL); + INI::parseDurationReal(ini, instance, &min, nullptr); + INI::parseDurationReal(ini, instance, &max, nullptr); delay->setRange(min, max, GameLogicRandomVariable::DistributionType::UNIFORM); } @@ -181,7 +181,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr); parseGameLogicRandomDelay( ini, instance, &info->gameLogicDelay); @@ -196,7 +196,7 @@ void BoneFXUpdateModuleData::parseFXList( INI *ini, void *instance, } // parse the fx list name - ini->parseFXList( ini, instance, &info->fx, NULL ); + ini->parseFXList( ini, instance, &info->fx, nullptr ); } @@ -223,7 +223,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL ); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr ); parseGameLogicRandomDelay(ini, instance, &info->gameLogicDelay); @@ -238,7 +238,7 @@ void BoneFXUpdateModuleData::parseObjectCreationList( INI *ini, void *instance, } // parse the ocl name - ini->parseObjectCreationList( ini, instance, &info->ocl, NULL ); + ini->parseObjectCreationList( ini, instance, &info->ocl, nullptr ); } @@ -265,7 +265,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, } - ini->parseBool( ini, instance, &info->onlyOnce, NULL ); + ini->parseBool( ini, instance, &info->onlyOnce, nullptr ); parseGameClientRandomDelay(ini, instance, &info->gameClientDelay); @@ -280,7 +280,7 @@ void BoneFXUpdateModuleData::parseParticleSystem( INI *ini, void *instance, } // parse the particle system name - ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, NULL ); + ini->parseParticleSystemTemplate( ini, instance, &info->particleSysTemplate, nullptr ); } @@ -399,10 +399,10 @@ void BoneFXUpdate::doFXListAtBone(const FXList *fxList, const Coord3D *bonePosit // Convert the bone's position relative to the origin of the building to the current // bone position in the world. Coord3D newPos; - building->convertBonePosToWorldPos(bonePosition, NULL, &newPos, NULL); + building->convertBonePosToWorldPos(bonePosition, nullptr, &newPos, nullptr); // execute the fx list at the calculated bone position. - FXList::doFXPos(fxList, &newPos, NULL); + FXList::doFXPos(fxList, &newPos, nullptr); } //------------------------------------------------------------------------------------------------- @@ -424,9 +424,9 @@ void BoneFXUpdate::doOCLAtBone(const ObjectCreationList *ocl, const Coord3D *bon Object *building = getObject(); Coord3D newPos; - building->convertBonePosToWorldPos(bonePosition, NULL, &newPos, NULL); + building->convertBonePosToWorldPos(bonePosition, nullptr, &newPos, nullptr); - ObjectCreationList::create( ocl, building, &newPos, NULL, INVALID_ANGLE ); + ObjectCreationList::create( ocl, building, &newPos, nullptr, INVALID_ANGLE ); } @@ -447,7 +447,7 @@ void BoneFXUpdate::doParticleSystemAtBone(const ParticleSystemTemplate *particle Object *building = getObject(); ParticleSystem *psys = TheParticleSystemManager->createParticleSystem(particleSystemTemplate); - if (psys != NULL) + if (psys != nullptr) { m_particleSystemIDs.push_back(psys->getSystemID()); psys->setPosition(bonePosition); @@ -502,14 +502,14 @@ void BoneFXUpdate::resolveBoneLocations() { Int i; const BoneFXUpdateModuleData *d = getBoneFXUpdateModuleData(); Object *building = getObject(); - if (building == NULL) { - DEBUG_ASSERTCRASH(building != NULL, ("There is no object?")); + if (building == nullptr) { + DEBUG_ASSERTCRASH(building != nullptr, ("There is no object?")); return; } Drawable *drawable = building->getDrawable(); - if (drawable == NULL) { - DEBUG_ASSERTCRASH(drawable != NULL, ("There is no drawable?")); + if (drawable == nullptr) { + DEBUG_ASSERTCRASH(drawable != nullptr, ("There is no drawable?")); return; } @@ -517,19 +517,19 @@ void BoneFXUpdate::resolveBoneLocations() { if (d->m_fxList[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneFXListInfo *info = &(d->m_fxList[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_FXBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_FXBonePositions[m_curBodyState][i], nullptr, 1); } if (d->m_OCL[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneOCLInfo *info = &(d->m_OCL[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_OCLBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_OCLBonePositions[m_curBodyState][i], nullptr, 1); } if (d->m_particleSystem[m_curBodyState][i].locInfo.boneName.compare(AsciiString::TheEmptyString) != 0) { const BoneParticleSystemInfo *info = &(d->m_particleSystem[m_curBodyState][i]); - drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_PSBonePositions[m_curBodyState][i], NULL, 1); + drawable->getPristineBonePositions(info->locInfo.boneName.str(), 0, &m_PSBonePositions[m_curBodyState][i], nullptr, 1); } } m_bonesResolved[m_curBodyState] = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp index 0d04efe6106..ccd456c3705 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp @@ -81,14 +81,14 @@ void CheckpointUpdate::checkForAlliesAndEnemies( void ) geom.setMinorRadius( m_maxMinorRadius ); obj->setGeometryInfo( geom ); - Object *enemy, *ally = NULL; + Object *enemy, *ally = nullptr; Real visionRange = obj->getVisionRange(); enemy = TheAI->findClosestEnemy( obj, visionRange, 0 ); - m_enemyNear = (enemy != NULL); + m_enemyNear = (enemy != nullptr); ally = TheAI->findClosestAlly( obj, visionRange, 0 ); - m_allyNear = (ally != NULL); + m_allyNear = (ally != nullptr); // here we restore the radius so that other units can path past the open gate geom.setMinorRadius( restoreSpecialRadius ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp index 82633a38927..14e0923eaba 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp @@ -64,9 +64,9 @@ CleanupHazardUpdateModuleData::CleanupHazardUpdateModuleData() static const FieldParse dataFieldParse[] = { { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( CleanupHazardUpdateModuleData, m_weaponSlot ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( CleanupHazardUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( CleanupHazardUpdateModuleData, m_scanRange ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( CleanupHazardUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( CleanupHazardUpdateModuleData, m_scanRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -78,7 +78,7 @@ CleanupHazardUpdate::CleanupHazardUpdate( Thing *thing, const ModuleData* module m_nextScanFrames = 0; m_nextShotAvailableInFrames = 0; m_inRange = false; - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; m_moveRange = 0.0f; m_pos.zero(); @@ -222,7 +222,7 @@ void CleanupHazardUpdate::fireWhenReady() { scanClosestTarget(); m_nextScanFrames = data->m_scanFrames; - target = NULL; //Set target to NULL so we don't shoot at it (might be out of range) + target = nullptr; //Set target to nullptr so we don't shoot at it (might be out of range) } } else @@ -261,12 +261,12 @@ Object* CleanupHazardUpdate::scanClosestTarget() { const CleanupHazardUpdateModuleData *data = getCleanupHazardUpdateModuleData(); Object *me = getObject(); - Object *bestTargetInRange = NULL; + Object *bestTargetInRange = nullptr; m_bestTargetID = INVALID_ID; PartitionFilterAcceptByKindOf kindFilter(MAKE_KINDOF_MASK(KINDOF_CLEANUP_HAZARD), KINDOFMASK_NONE); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter* filters[] = { &kindFilter, &filterMapStatus, NULL }; + PartitionFilter* filters[] = { &kindFilter, &filterMapStatus, nullptr }; if( m_moveRange > 0.0f ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp index 3ed8abdbdc0..3b8eea2e893 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CommandButtonHuntUpdate.cpp @@ -68,9 +68,9 @@ CommandButtonHuntUpdateModuleData::CommandButtonHuntUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( CommandButtonHuntUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( CommandButtonHuntUpdateModuleData, m_scanRange ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( CommandButtonHuntUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( CommandButtonHuntUpdateModuleData, m_scanRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -78,7 +78,7 @@ CommandButtonHuntUpdateModuleData::CommandButtonHuntUpdateModuleData() //------------------------------------------------------------------------------------------------- CommandButtonHuntUpdate::CommandButtonHuntUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), -m_commandButton(NULL) +m_commandButton(nullptr) { setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); m_commandButtonName = AsciiString::TheEmptyString; @@ -103,7 +103,7 @@ void CommandButtonHuntUpdate::setCommandButton(const AsciiString& buttonName) { Object *obj = getObject(); m_commandButtonName = buttonName; - m_commandButton = NULL; + m_commandButton = nullptr; const CommandSet *commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() ); if( commandSet ) { @@ -122,14 +122,14 @@ void CommandButtonHuntUpdate::setCommandButton(const AsciiString& buttonName) } } } - m_commandButton = NULL; + m_commandButton = nullptr; } } - if (m_commandButton==NULL) { + if (m_commandButton==nullptr) { return; } AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL ) return; + if (ai==nullptr ) return; // Stop whatever we're doing. ai->aiIdle(CMD_FROM_AI); @@ -146,12 +146,12 @@ UpdateSleepTime CommandButtonHuntUpdate::update() Object *obj = getObject(); AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL || m_commandButton==NULL) return UPDATE_SLEEP_FOREVER; + if (ai==nullptr || m_commandButton==nullptr) return UPDATE_SLEEP_FOREVER; if (ai->getLastCommandSource() != CMD_FROM_AI) { // If a script or the player (in this case should only be script, but either way) // we quit hunting. - m_commandButton = NULL; + m_commandButton = nullptr; m_commandButtonName.clear(); return UPDATE_SLEEP_FOREVER; } @@ -205,7 +205,7 @@ UpdateSleepTime CommandButtonHuntUpdate::huntSpecialPower(AIUpdateInterface *ai) if( spTemplate ) { SpecialAbilityUpdate* spUpdate = obj->findSpecialAbilityUpdate( spTemplate->getSpecialPowerType() ); - if (spUpdate == NULL) return UPDATE_SLEEP_FOREVER; + if (spUpdate == nullptr) return UPDATE_SLEEP_FOREVER; if (spUpdate->isActive()) { return UPDATE_SLEEP(data->m_scanFrames); } @@ -273,7 +273,7 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) filters[1] = &filterMapStatus; filters[2] = &filterStealthed; filters[3] = &filterTeam; - filters[4] = NULL; + filters[4] = nullptr; Bool isBlackLotusVehicleHack = FALSE; Bool isCaptureBuilding = FALSE; @@ -282,12 +282,12 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) if( !isEnter ) { if( !spTemplate ) - return NULL; // isn't going to happen. + return nullptr; // isn't going to happen. isBlackLotusVehicleHack = (spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK); isCaptureBuilding = (spTemplate->getSpecialPowerType() == SPECIAL_INFANTRY_CAPTURE_BUILDING); if (isCaptureBuilding) { - filters[3] = NULL; // It's ok (in fact necessary for oil derricks) to capture special buildings. + filters[3] = nullptr; // It's ok (in fact necessary for oil derricks) to capture special buildings. if (spTemplate->getSpecialPowerType() == SPECIAL_TIMED_CHARGES) isPlaceExplosive = true; if (spTemplate->getSpecialPowerType() == SPECIAL_TANKHUNTER_TNT_ATTACK) @@ -299,10 +299,10 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR ); MemoryPoolObjectHolder hold(iter); - Object *bestTarget = NULL; + Object *bestTarget = nullptr; Int effectivePriority=0; Int actualPriority=0; - const AttackPriorityInfo *info=NULL; + const AttackPriorityInfo *info=nullptr; if (me->getAI()) { info = me->getAI()->getAttackInfo(); } @@ -331,7 +331,7 @@ Object* CommandButtonHuntUpdate::scanClosestTarget(void) // Don't target things near explosives... It's just not a good idea. PartitionFilterSamePlayer filterPlayer( me->getControllingPlayer() ); // Look for our own mines. PartitionFilterAcceptByKindOf filterKind(MAKE_KINDOF_MASK(KINDOF_MINE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKind, &filterPlayer, NULL }; + PartitionFilter *filters[] = { &filterKind, &filterPlayer, nullptr }; Object *mine = ThePartitionManager->getClosestObject( other, range, FROM_BOUNDINGSPHERE_2D, filters );// could be null. this is ok. if (mine) { continue; @@ -426,7 +426,7 @@ void CommandButtonHuntUpdate::xfer( Xfer *xfer ) { // initialize to no command button - m_commandButton = NULL; + m_commandButton = nullptr; // find command button pointer if name is present if( m_commandButtonName.isEmpty() == FALSE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp index e4d7dfb820a..92645e696cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp @@ -56,7 +56,7 @@ DemoTrapUpdateModuleData::DemoTrapUpdateModuleData() m_proximityModeWeaponSlot = PRIMARY_WEAPON; m_triggerDetonationRange = 0.0f; m_scanFrames = 0; - m_detonationWeaponTemplate = NULL; + m_detonationWeaponTemplate = nullptr; m_detonateWhenKilled = false; } @@ -67,17 +67,17 @@ DemoTrapUpdateModuleData::DemoTrapUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "DefaultProximityMode", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_defaultsToProximityMode ) }, + { "DefaultProximityMode", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_defaultsToProximityMode ) }, { "DetonationWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponSlot ) }, { "ProximityModeWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_proximityModeWeaponSlot ) }, { "ManualModeWeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( DemoTrapUpdateModuleData, m_manualModeWeaponSlot ) }, - { "TriggerDetonationRange", INI::parseReal, NULL, offsetof( DemoTrapUpdateModuleData, m_triggerDetonationRange ) }, - { "IgnoreTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( DemoTrapUpdateModuleData, m_ignoreKindOf ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( DemoTrapUpdateModuleData, m_scanFrames ) }, - { "AutoDetonationWithFriendsInvolved", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_friendlyDetonation ) }, - { "DetonationWeapon", INI::parseWeaponTemplate, NULL, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponTemplate ) }, - { "DetonateWhenKilled", INI::parseBool, NULL, offsetof( DemoTrapUpdateModuleData, m_detonateWhenKilled ) }, - { 0, 0, 0, 0 } + { "TriggerDetonationRange", INI::parseReal, nullptr, offsetof( DemoTrapUpdateModuleData, m_triggerDetonationRange ) }, + { "IgnoreTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( DemoTrapUpdateModuleData, m_ignoreKindOf ) }, + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( DemoTrapUpdateModuleData, m_scanFrames ) }, + { "AutoDetonationWithFriendsInvolved", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_friendlyDetonation ) }, + { "DetonationWeapon", INI::parseWeaponTemplate, nullptr, offsetof( DemoTrapUpdateModuleData, m_detonationWeaponTemplate ) }, + { "DetonateWhenKilled", INI::parseBool, nullptr, offsetof( DemoTrapUpdateModuleData, m_detonateWhenKilled ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp index 78e61ac97da..647bf403029 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp @@ -53,9 +53,9 @@ DockUpdateModuleData::DockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "NumberApproachPositions" ,INI::parseInt, NULL, offsetof( DockUpdateModuleData, m_numberApproachPositionsData ) }, - { "AllowsPassthrough" ,INI::parseBool, NULL, offsetof( DockUpdateModuleData, m_isAllowPassthrough ) }, - { 0, 0, 0, 0 } + { "NumberApproachPositions" ,INI::parseInt, nullptr, offsetof( DockUpdateModuleData, m_numberApproachPositionsData ) }, + { "AllowsPassthrough" ,INI::parseBool, nullptr, offsetof( DockUpdateModuleData, m_isAllowPassthrough ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -141,7 +141,7 @@ Bool DockUpdate::reserveApproachPosition( Object* docker, Coord3D *position, Int loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return FALSE; ObjectID dockerID = docker->getID(); @@ -192,7 +192,7 @@ Bool DockUpdate::advanceApproachPosition( Object* docker, Coord3D *position, Int loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return FALSE; if( *index <= 0 ) return FALSE; @@ -240,7 +240,7 @@ void DockUpdate::getEnterPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are, unless you fly, in which case I should recenter you @@ -258,7 +258,7 @@ void DockUpdate::getEnterPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_enterPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_enterPosition, nullptr, position, nullptr ); } @@ -270,7 +270,7 @@ void DockUpdate::getDockPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are. @@ -283,7 +283,7 @@ void DockUpdate::getDockPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_dockPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_dockPosition, nullptr, position, nullptr ); } @@ -295,7 +295,7 @@ void DockUpdate::getExitPosition( Object* docker, Coord3D *position ) loadDockPositions(); // sanity - if( position == NULL ) + if( position == nullptr ) return; // If I don't have a bone, you are fine where you are. @@ -308,7 +308,7 @@ void DockUpdate::getExitPosition( Object* docker, Coord3D *position ) } // take local space position and convert to world space - getObject()->convertBonePosToWorldPos( &m_exitPosition, NULL, position, NULL ); + getObject()->convertBonePosToWorldPos( &m_exitPosition, nullptr, position, nullptr ); } @@ -457,7 +457,7 @@ Coord3D DockUpdate::computeApproachPosition( Int positionIndex, Object *forWhom // Start with the pristine bone, then convert it to the world, then find a clean spot around it. Object *us = getObject(); - us->convertBonePosToWorldPos( &m_approachPositions[positionIndex], NULL, &workingPosition, NULL ); + us->convertBonePosToWorldPos( &m_approachPositions[positionIndex], nullptr, &workingPosition, nullptr ); if( m_numberApproachPositionBones == 0 ) { @@ -504,9 +504,9 @@ void DockUpdate::loadDockPositions() if( !obj->isKindOf( KINDOF_IGNORE_DOCKING_BONES ) ) { - myDrawable->getPristineBonePositions( "DockStart", 0, &m_enterPosition, NULL, 1); - myDrawable->getPristineBonePositions( "DockAction", 0, &m_dockPosition, NULL, 1); - myDrawable->getPristineBonePositions( "DockEnd", 0, &m_exitPosition, NULL, 1); + myDrawable->getPristineBonePositions( "DockStart", 0, &m_enterPosition, nullptr, 1); + myDrawable->getPristineBonePositions( "DockAction", 0, &m_dockPosition, nullptr, 1); + myDrawable->getPristineBonePositions( "DockEnd", 0, &m_exitPosition, nullptr, 1); if( m_numberApproachPositions != DYNAMIC_APPROACH_VECTOR_FLAG ) { // Dynamic means no bones @@ -517,7 +517,7 @@ void DockUpdate::loadDockPositions() // TheSuperHackers @fix helmutbuhler 19/04/2025 Zero initialize array to prevent uninitialized memory reads. // Important: the entire target vector is used for serialization and crc and must not contain random data. Coord3D approachBones[DEFAULT_APPROACH_VECTOR_SIZE] = {0}; - m_numberApproachPositionBones = myDrawable->getPristineBonePositions( "DockWaiting", 1, approachBones, NULL, m_numberApproachPositions); + m_numberApproachPositionBones = myDrawable->getPristineBonePositions( "DockWaiting", 1, approachBones, nullptr, m_numberApproachPositions); if( m_numberApproachPositions == m_approachPositions.size() )//safeguard: will always be true { for( Int copyIndex = 0; copyIndex < m_numberApproachPositions; ++copyIndex ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp index 3ec47ffad9d..5fdfc5b7fdf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/PrisonDockUpdate.cpp @@ -63,7 +63,7 @@ Bool PrisonDockUpdate::action( Object *docker, Object *drone ) { // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // if docker has no contents, do nothing and stop the dock process diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index 4fc9e293c6f..ec124c5ca0c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -64,10 +64,10 @@ RailedTransportDockUpdateModuleData::RailedTransportDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "PullInsideDuration", INI::parseDurationUnsignedInt, NULL, offsetof( RailedTransportDockUpdateModuleData, m_pullInsideDurationInFrames ) }, - { "PushOutsideDuration",INI::parseDurationUnsignedInt, NULL, offsetof( RailedTransportDockUpdateModuleData, m_pushOutsideDurationInFrames ) }, - { "ToleranceDistance", INI::parseReal, NULL, offsetof( RailedTransportDockUpdateModuleData, m_toleranceDistance ) }, - { 0, 0, 0, 0 } + { "PullInsideDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( RailedTransportDockUpdateModuleData, m_pullInsideDurationInFrames ) }, + { "PushOutsideDuration",INI::parseDurationUnsignedInt, nullptr, offsetof( RailedTransportDockUpdateModuleData, m_pushOutsideDurationInFrames ) }, + { "ToleranceDistance", INI::parseReal, nullptr, offsetof( RailedTransportDockUpdateModuleData, m_toleranceDistance ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -127,7 +127,7 @@ Bool RailedTransportDockUpdate::action( Object *docker, Object *drone ) Object *us = getObject(); // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // set this object as docking with us if not already done so @@ -261,7 +261,7 @@ void RailedTransportDockUpdate::doPullInDocking( void ) Object *docker = TheGameLogic->findObjectByID( m_dockingObjectID ); // check for docker gone - if( docker == NULL ) + if( docker == nullptr ) m_dockingObjectID = INVALID_ID; // pull it @@ -342,7 +342,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) Object *unloader = TheGameLogic->findObjectByID( m_unloadingObjectID ); // if unloader is not found (like they got destroyed) unload the next object inside - if( unloader == NULL ) + if( unloader == nullptr ) { unloadNext(); @@ -413,8 +413,8 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) { Coord3D finalPos; - draw->getPristineBonePositions( "DOCKWAITING07", 0, &finalPos, NULL, 1 ); - us->convertBonePosToWorldPos( &finalPos, NULL, &finalPos, NULL ); + draw->getPristineBonePositions( "DOCKWAITING07", 0, &finalPos, nullptr, 1 ); + us->convertBonePosToWorldPos( &finalPos, nullptr, &finalPos, nullptr ); unloaderAI->aiMoveToPosition( &finalPos, CMD_FROM_AI ); } @@ -438,7 +438,7 @@ static void getFirstContain( Object *obj, void *userData ) Object **firstContain = (Object **)userData; // if object has been found get out of here - if( *firstContain != NULL ) + if( *firstContain != nullptr ) return; // assign this as the first object found @@ -465,12 +465,12 @@ void RailedTransportDockUpdate::unloadNext( void ) // better be an open container ContainModuleInterface *contain = us->getContain(); - OpenContain *openContain = contain ? contain->asOpenContain() : NULL; + OpenContain *openContain = contain ? contain->asOpenContain() : nullptr; DEBUG_ASSERTCRASH( openContain, ("Unloading next from railed transport, but '%s' has no open container", us->getTemplate()->getName().str()) ); // get the first contained object - Object *unloader = NULL; + Object *unloader = nullptr; openContain->iterateContained( getFirstContain, &unloader, FALSE ); if( unloader ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp index 62f452f4986..97b295c3f2f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RepairDockUpdate.cpp @@ -53,8 +53,8 @@ RepairDockUpdateModuleData::RepairDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "TimeForFullHeal", INI::parseDurationReal, NULL, offsetof( RepairDockUpdateModuleData, m_framesForFullHeal ) }, - { 0, 0, 0, 0 } + { "TimeForFullHeal", INI::parseDurationReal, nullptr, offsetof( RepairDockUpdateModuleData, m_framesForFullHeal ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -92,7 +92,7 @@ Bool RepairDockUpdate::action( Object *docker, Object *drone ) { // sanity - if( docker == NULL ) + if( docker == nullptr ) return FALSE; // get our module data diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp index 769a8843bfb..d48d282718d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp @@ -55,8 +55,8 @@ SupplyCenterDockUpdateModuleData::SupplyCenterDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "GrantTemporaryStealth", INI::parseDurationUnsignedInt, NULL, offsetof( SupplyCenterDockUpdateModuleData, m_grantTemporaryStealthFrames ) }, - { 0, 0, 0, 0 } + { "GrantTemporaryStealth", INI::parseDurationUnsignedInt, nullptr, offsetof( SupplyCenterDockUpdateModuleData, m_grantTemporaryStealthFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -84,14 +84,14 @@ SupplyCenterDockUpdate::~SupplyCenterDockUpdate() Bool SupplyCenterDockUpdate::action( Object* docker, Object *drone ) { const SupplyCenterDockUpdateModuleData *data = getSupplyCenterDockUpdateModuleData(); - SupplyTruckAIInterface* supplyTruckAI = NULL; - if( docker->getAIUpdateInterface() == NULL ) + SupplyTruckAIInterface* supplyTruckAI = nullptr; + if( docker->getAIUpdateInterface() == nullptr ) return FALSE; supplyTruckAI = docker->getAIUpdateInterface()->getSupplyTruckAIInterface(); - DEBUG_ASSERTCRASH( supplyTruckAI != NULL, ("Something Docking with a Supply Center must have a Supply-truck like AIUpdate") ); - if( supplyTruckAI == NULL ) + DEBUG_ASSERTCRASH( supplyTruckAI != nullptr, ("Something Docking with a Supply Center must have a Supply-truck like AIUpdate") ); + if( supplyTruckAI == nullptr ) return FALSE; UnsignedInt value = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp index 364da3d25dd..24c91d1b99b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp @@ -55,9 +55,9 @@ SupplyWarehouseDockUpdateModuleData::SupplyWarehouseDockUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "StartingBoxes", INI::parseInt, NULL, offsetof( SupplyWarehouseDockUpdateModuleData, m_startingBoxesData ) }, - { "DeleteWhenEmpty", INI::parseBool, NULL, offsetof( SupplyWarehouseDockUpdateModuleData, m_deleteWhenEmpty ) }, - { 0, 0, 0, 0 } + { "StartingBoxes", INI::parseInt, nullptr, offsetof( SupplyWarehouseDockUpdateModuleData, m_startingBoxesData ) }, + { "DeleteWhenEmpty", INI::parseBool, nullptr, offsetof( SupplyWarehouseDockUpdateModuleData, m_deleteWhenEmpty ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp index 4f7892ae6c8..f3ea999c78f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicGeometryInfoUpdate.cpp @@ -62,20 +62,20 @@ DynamicGeometryInfoUpdateModuleData::DynamicGeometryInfoUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialDelay) }, + { "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialDelay) }, - { "InitialHeight", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialHeight) }, - { "InitialMajorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMajorRadius) }, - { "InitialMinorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMinorRadius) }, + { "InitialHeight", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialHeight) }, + { "InitialMajorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMajorRadius) }, + { "InitialMinorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_initialMinorRadius) }, - { "FinalHeight", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalHeight) }, - { "FinalMajorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMajorRadius) }, - { "FinalMinorRadius", INI::parseReal, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMinorRadius) }, + { "FinalHeight", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalHeight) }, + { "FinalMajorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMajorRadius) }, + { "FinalMinorRadius", INI::parseReal, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_finalMinorRadius) }, - { "TransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof(DynamicGeometryInfoUpdateModuleData, m_transitionTime) }, - { "ReverseAtTransitionTime", INI::parseBool, NULL, offsetof( DynamicGeometryInfoUpdateModuleData, m_reverseAtTransitionTime ) }, + { "TransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof(DynamicGeometryInfoUpdateModuleData, m_transitionTime) }, + { "ReverseAtTransitionTime", INI::parseBool, nullptr, offsetof( DynamicGeometryInfoUpdateModuleData, m_reverseAtTransitionTime ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index b7934fe544d..11a12f92e5c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -59,15 +59,15 @@ DynamicShroudClearingRangeUpdateModuleData::DynamicShroudClearingRangeUpdateModu static const FieldParse dataFieldParse[] = { - { "ChangeInterval", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_changeInterval ) }, - { "GrowInterval", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growInterval ) }, - { "ShrinkDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkDelay ) }, - { "ShrinkTime", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkTime ) }, - { "GrowDelay", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growDelay ) }, - { "GrowTime", INI::parseDurationUnsignedInt, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growTime ) }, - { "FinalVision", INI::parseReal, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_finalVision ) }, - { "GridDecalTemplate", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_gridDecalTemplate ) }, - { 0, 0, 0, 0 } + { "ChangeInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_changeInterval ) }, + { "GrowInterval", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growInterval ) }, + { "ShrinkDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkDelay ) }, + { "ShrinkTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_shrinkTime ) }, + { "GrowDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growDelay ) }, + { "GrowTime", INI::parseDurationUnsignedInt, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_growTime ) }, + { "FinalVision", INI::parseReal, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_finalVision ) }, + { "GridDecalTemplate", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( DynamicShroudClearingRangeUpdateModuleData, m_gridDecalTemplate ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index 8023998b8f0..43ba1abc65e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -86,7 +86,7 @@ EMPUpdate::EMPUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModul if ( data ) { //SANITY - DEBUG_ASSERTCRASH( TheGameLogic, ("EMPUpdate::EMPUpdate - TheGameLogic is NULL" ) ); + DEBUG_ASSERTCRASH( TheGameLogic, ("EMPUpdate::EMPUpdate - TheGameLogic is null" ) ); UnsignedInt now = TheGameLogic->getFrame(); m_currentScale = data->m_startScale; @@ -108,7 +108,7 @@ EMPUpdate::EMPUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModul } //SANITY - DEBUG_ASSERTCRASH( data, ("EMPUpdate::EMPUpdate - getEMPUpdateModuleData is NULL" ) ); + DEBUG_ASSERTCRASH( data, ("EMPUpdate::EMPUpdate - getEMPUpdateModuleData is null" ) ); m_currentScale = 1.0f; m_dieFrame = 0; m_tintEnvFadeFrames = 0; @@ -181,7 +181,7 @@ void EMPUpdate::doDisableAttack( void ) //If the EMP hits an airborne target, then don't allow the EMP //blast to effect anything on the ground. Object *producer = TheGameLogic->findObjectByID( object->getProducerID() ); - Object *intendedVictim = NULL; + Object *intendedVictim = nullptr; Bool onlyEffectAirborne = FALSE; Bool intendedVictimProcessed = FALSE; if( producer && producer->getAI() ) @@ -193,8 +193,8 @@ void EMPUpdate::doDisableAttack( void ) } } - SimpleObjectIterator *iter = NULL; - Object *curVictim = NULL; + SimpleObjectIterator *iter = nullptr; + Object *curVictim = nullptr; if (radius > 0.0f) { @@ -206,7 +206,7 @@ void EMPUpdate::doDisableAttack( void ) MemoryPoolObjectHolder hold(iter); - for ( ; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for ( ; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { if ( curVictim != object) { @@ -420,7 +420,7 @@ LeafletDropBehavior::LeafletDropBehavior( Thing *thing, const ModuleData* module if ( data ) { //SANITY - DEBUG_ASSERTCRASH( TheGameLogic, ("LeafletDropBehavior::LeafletDropBehavior - TheGameLogic is NULL" ) ); + DEBUG_ASSERTCRASH( TheGameLogic, ("LeafletDropBehavior::LeafletDropBehavior - TheGameLogic is null" ) ); UnsignedInt now = TheGameLogic->getFrame(); m_startFrame = now + data->m_delayFrames; @@ -428,7 +428,7 @@ LeafletDropBehavior::LeafletDropBehavior( Thing *thing, const ModuleData* module } //SANITY - DEBUG_ASSERTCRASH( data, ("LeafletDropBehavior::LeafletDropBehavior - getLeafletDropBehaviorModuleData is NULL" ) ); + DEBUG_ASSERTCRASH( data, ("LeafletDropBehavior::LeafletDropBehavior - getLeafletDropBehaviorModuleData is null" ) ); m_startFrame = TheGameLogic->getFrame() + 1; } @@ -494,8 +494,8 @@ void LeafletDropBehavior::doDisableAttack( void ) Real curVictimDistSqr; const Coord3D *pos = object->getPosition(); - SimpleObjectIterator *iter = NULL; - Object *curVictim = NULL; + SimpleObjectIterator *iter = nullptr; + Object *curVictim = nullptr; if (radius > 0.0f) { @@ -507,7 +507,7 @@ void LeafletDropBehavior::doDisableAttack( void ) MemoryPoolObjectHolder hold(iter); - for ( ; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for ( ; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { if ( curVictim != object) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp index b752365d731..46a98979fa4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EnemyNearUpdate.cpp @@ -71,7 +71,7 @@ void EnemyNearUpdate::checkForEnemies( void ) Real visionRange = getObject()->getVisionRange(); Object* enemy = TheAI->findClosestEnemy( getObject(), visionRange, AI::CAN_SEE ); - m_enemyNear = (enemy != NULL); + m_enemyNear = (enemy != nullptr); } else { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index c2d48595eac..35f9565bd7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -59,7 +59,7 @@ FireOCLAfterWeaponCooldownUpdateModuleData::FireOCLAfterWeaponCooldownUpdateModu m_minShotsRequired = 1; m_oclLifetimePerSecond = 1000; m_oclMaxFrames = 1000; - m_ocl = NULL; + m_ocl = nullptr; } //------------------------------------------------------------------------------------------------- @@ -69,11 +69,11 @@ void FireOCLAfterWeaponCooldownUpdateModuleData::buildFieldParse(MultiIniFieldPa static const FieldParse dataFieldParse[] = { { "WeaponSlot", INI::parseLookupList, TheWeaponSlotTypeNamesLookupList, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_weaponSlot ) }, - { "OCL", INI::parseObjectCreationList, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_ocl ) }, - { "MinShotsToCreateOCL", INI::parseUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_minShotsRequired ) }, - { "OCLLifetimePerSecond", INI::parseUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclLifetimePerSecond ) }, - { "OCLLifetimeMaxCap", INI::parseDurationUnsignedInt, NULL, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclMaxFrames ) }, - { 0, 0, 0, 0 } + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_ocl ) }, + { "MinShotsToCreateOCL", INI::parseUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_minShotsRequired ) }, + { "OCLLifetimePerSecond", INI::parseUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclLifetimePerSecond ) }, + { "OCLLifetimeMaxCap", INI::parseDurationUnsignedInt, nullptr, offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_oclMaxFrames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(UpgradeMuxData::getFieldParse(), offsetof( FireOCLAfterWeaponCooldownUpdateModuleData, m_upgradeMuxData )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp index e28c8238cd5..86c81b0755e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireSpreadUpdate.cpp @@ -62,7 +62,7 @@ Bool PartitionFilterFlammable::allow(Object *objOther) // It must be burnable in general, and burnable now static NameKeyType key_FlammableUpdate = NAMEKEY("FlammableUpdate"); FlammableUpdate* fu = (FlammableUpdate*)objOther->findUpdateModule(key_FlammableUpdate); - if (fu == NULL) + if (fu == nullptr) return FALSE; if( ! fu->wouldIgnite() ) @@ -79,7 +79,7 @@ FireSpreadUpdateModuleData::FireSpreadUpdateModuleData() { m_minSpreadTryDelayData = 0; m_maxSpreadTryDelayData = 0; - m_oclEmbers = NULL; + m_oclEmbers = nullptr; m_spreadTryRange = 0; } @@ -90,11 +90,11 @@ FireSpreadUpdateModuleData::FireSpreadUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OCLEmbers", INI::parseObjectCreationList, NULL, offsetof( FireSpreadUpdateModuleData, m_oclEmbers ) }, - { "MinSpreadDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireSpreadUpdateModuleData, m_minSpreadTryDelayData ) }, - { "MaxSpreadDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireSpreadUpdateModuleData, m_maxSpreadTryDelayData ) }, - { "SpreadTryRange", INI::parseReal, NULL, offsetof( FireSpreadUpdateModuleData, m_spreadTryRange ) }, - { 0, 0, 0, 0 } + { "OCLEmbers", INI::parseObjectCreationList, nullptr, offsetof( FireSpreadUpdateModuleData, m_oclEmbers ) }, + { "MinSpreadDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireSpreadUpdateModuleData, m_minSpreadTryDelayData ) }, + { "MaxSpreadDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireSpreadUpdateModuleData, m_maxSpreadTryDelayData ) }, + { "SpreadTryRange", INI::parseReal, nullptr, offsetof( FireSpreadUpdateModuleData, m_spreadTryRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -122,15 +122,15 @@ UpdateSleepTime FireSpreadUpdate::update( void ) if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) ) return UPDATE_SLEEP_FOREVER; // not on fire -- sleep forever { - ObjectCreationList::create( d->m_oclEmbers, getObject(), NULL ); + ObjectCreationList::create( d->m_oclEmbers, getObject(), nullptr ); if( d->m_spreadTryRange != 0 ) { // This will spread fire explicitly PartitionFilterFlammable fFilter; - PartitionFilter *filters[] = { &fFilter, NULL }; + PartitionFilter *filters[] = { &fFilter, nullptr }; -// SimpleObjectIterator *iter = NULL; +// SimpleObjectIterator *iter = nullptr; // iter = ThePartitionManager->iterateObjectsInRange(getObject(), // d->m_spreadTryRange, // FROM_CENTER_3D, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index 539288e56d7..d9bc8fb3b5f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -41,7 +41,7 @@ //------------------------------------------------------------------------------------------------- FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() { - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; m_initialDelayFrames = 0; m_exclusiveWeaponDelay = 0; } @@ -53,10 +53,10 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, - { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireWeaponUpdateModuleData, m_initialDelayFrames ) }, - { "ExclusiveWeaponDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireWeaponUpdateModuleData, m_exclusiveWeaponDelay ) }, - { 0, 0, 0, 0 } + { "Weapon", INI::parseWeaponTemplate, nullptr, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, + { "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireWeaponUpdateModuleData, m_initialDelayFrames ) }, + { "ExclusiveWeaponDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FireWeaponUpdateModuleData, m_exclusiveWeaponDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -65,7 +65,7 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() //------------------------------------------------------------------------------------------------- FireWeaponUpdate::FireWeaponUpdate( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ), - m_weapon(NULL) + m_weapon(nullptr) { const WeaponTemplate *tmpl = getFireWeaponUpdateModuleData()->m_weaponTemplate; if (tmpl) @@ -110,7 +110,7 @@ Bool FireWeaponUpdate::isOkayToFire() const Object *me = getObject(); const FireWeaponUpdateModuleData *data = getFireWeaponUpdateModuleData(); - if( m_weapon == NULL ) + if( m_weapon == nullptr ) return FALSE; // Weapon is reloading diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp index 3ea46047374..cb81e10d126 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FirestormDynamicGeometryInfoUpdate.cpp @@ -51,8 +51,8 @@ FirestormDynamicGeometryInfoUpdateModuleData::FirestormDynamicGeometryInfoUpdate { for( Int i = 0; i < MAX_FIRESTORM_SYSTEMS; i++ ) - m_particleSystem[ i ] = NULL; - m_fxList = NULL; + m_particleSystem[ i ] = nullptr; + m_fxList = nullptr; m_particleOffsetZ = 0.0f; m_scorchSize = 0.0f; m_delayBetweenDamageFrames = 0.0f; @@ -68,29 +68,29 @@ FirestormDynamicGeometryInfoUpdateModuleData::FirestormDynamicGeometryInfoUpdate static const FieldParse dataFieldParse[] = { - { "DelayBetweenDamageFrames", INI::parseDurationReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_delayBetweenDamageFrames ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_damageAmount ) }, - { "MaxHeightForDamage", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_maxHeightForDamage ) }, - { "ParticleSystem1", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 0 ] ) }, - { "ParticleSystem2", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 1 ] ) }, - { "ParticleSystem3", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 2 ] ) }, - { "ParticleSystem4", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 3 ] ) }, - { "ParticleSystem5", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 4 ] ) }, - { "ParticleSystem6", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 5 ] ) }, - { "ParticleSystem7", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 6 ] ) }, - { "ParticleSystem8", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 7 ] ) }, - { "ParticleSystem9", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 8 ] ) }, - { "ParticleSystem10", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 9 ] ) }, - { "ParticleSystem11", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 10 ] ) }, - { "ParticleSystem12", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 11 ] ) }, - { "ParticleSystem13", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 12 ] ) }, - { "ParticleSystem14", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 13 ] ) }, - { "ParticleSystem15", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 14 ] ) }, - { "ParticleSystem16", INI::parseParticleSystemTemplate, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 15 ] ) }, - { "FXList", INI::parseFXList, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_fxList ) }, - { "ParticleOffsetZ", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleOffsetZ ) }, - { "ScorchSize", INI::parseReal, NULL, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_scorchSize ) }, - { 0, 0, 0, 0 } + { "DelayBetweenDamageFrames", INI::parseDurationReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_delayBetweenDamageFrames ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_damageAmount ) }, + { "MaxHeightForDamage", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_maxHeightForDamage ) }, + { "ParticleSystem1", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 0 ] ) }, + { "ParticleSystem2", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 1 ] ) }, + { "ParticleSystem3", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 2 ] ) }, + { "ParticleSystem4", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 3 ] ) }, + { "ParticleSystem5", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 4 ] ) }, + { "ParticleSystem6", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 5 ] ) }, + { "ParticleSystem7", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 6 ] ) }, + { "ParticleSystem8", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 7 ] ) }, + { "ParticleSystem9", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 8 ] ) }, + { "ParticleSystem10", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 9 ] ) }, + { "ParticleSystem11", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 10 ] ) }, + { "ParticleSystem12", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 11 ] ) }, + { "ParticleSystem13", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 12 ] ) }, + { "ParticleSystem14", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 13 ] ) }, + { "ParticleSystem15", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 14 ] ) }, + { "ParticleSystem16", INI::parseParticleSystemTemplate, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleSystem[ 15 ] ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_fxList ) }, + { "ParticleOffsetZ", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_particleOffsetZ ) }, + { "ScorchSize", INI::parseReal, nullptr, offsetof( FirestormDynamicGeometryInfoUpdateModuleData, m_scorchSize ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -251,7 +251,7 @@ void FirestormDynamicGeometryInfoUpdate::doDamageScan( void ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( firestormPos, boundingCircle, FROM_BOUNDINGSPHERE_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; for( other = iter->first(); other; other = iter->next() ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index 98b046391f2..174474eab41 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -59,14 +59,14 @@ FlammableUpdateModuleData::FlammableUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "BurnedDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_burnedDelay ) }, - { "AflameDuration", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDuration ) }, - { "AflameDamageDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDamageDelay ) }, - { "AflameDamageAmount", INI::parseInt, NULL, offsetof( FlammableUpdateModuleData, m_aflameDamageAmount ) }, - { "BurningSoundName", INI::parseAsciiString, NULL, offsetof( FlammableUpdateModuleData, m_burningSoundName) }, - { "FlameDamageLimit", INI::parseReal, NULL, offsetof( FlammableUpdateModuleData, m_flameDamageLimitData ) }, - { "FlameDamageExpiration", INI::parseDurationUnsignedInt, NULL, offsetof( FlammableUpdateModuleData, m_flameDamageExpirationDelay ) }, - { 0, 0, 0, 0 } + { "BurnedDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_burnedDelay ) }, + { "AflameDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDuration ) }, + { "AflameDamageDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDamageDelay ) }, + { "AflameDamageAmount", INI::parseInt, nullptr, offsetof( FlammableUpdateModuleData, m_aflameDamageAmount ) }, + { "BurningSoundName", INI::parseAsciiString, nullptr, offsetof( FlammableUpdateModuleData, m_burningSoundName) }, + { "FlameDamageLimit", INI::parseReal, nullptr, offsetof( FlammableUpdateModuleData, m_flameDamageLimitData ) }, + { "FlameDamageExpiration", INI::parseDurationUnsignedInt, nullptr, offsetof( FlammableUpdateModuleData, m_flameDamageExpirationDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -79,7 +79,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_aflameEndFrame = 0; m_burnedEndFrame = 0; m_damageEndFrame = 0; - m_audioHandle = NULL; + m_audioHandle = 0; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; @@ -208,7 +208,7 @@ void FlammableUpdate::tryToIgnite() // bleah. this sucks. (srj) static const NameKeyType key_FireSpreadUpdate = NAMEKEY("FireSpreadUpdate"); FireSpreadUpdate* fu = (FireSpreadUpdate*)getObject()->findUpdateModule(key_FireSpreadUpdate); - if (fu != NULL) + if (fu != nullptr) { fu->startFireSpreading(); } @@ -257,7 +257,7 @@ void FlammableUpdate::stopBurningSound() if (m_audioHandle) { TheAudio->removeAudioEvent( m_audioHandle ); - m_audioHandle = NULL; + m_audioHandle = 0; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp index 18e1ceb8903..f994e65250e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp @@ -60,8 +60,8 @@ FloatUpdateModuleData::FloatUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "Enabled", INI::parseBool, NULL, offsetof( FloatUpdateModuleData, m_enabled ) }, - { 0, 0, 0, 0 } + { "Enabled", INI::parseBool, nullptr, offsetof( FloatUpdateModuleData, m_enabled ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp index 40bc35633a6..62800ab66c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp @@ -66,13 +66,13 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TargetHeight", INI::parseReal, NULL, offsetof( HeightDieUpdateModuleData, m_targetHeightAboveTerrain ) }, - { "TargetHeightIncludesStructures", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_targetHeightIncludesStructures ) }, - { "OnlyWhenMovingDown", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_onlyWhenMovingDown ) }, - { "DestroyAttachedParticlesAtHeight", INI::parseReal, NULL, offsetof( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) }, - { "SnapToGroundOnDeath", INI::parseBool, NULL, offsetof( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) }, - { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof( HeightDieUpdateModuleData, m_initialDelay ) }, - { 0, 0, 0, 0 } + { "TargetHeight", INI::parseReal, nullptr, offsetof( HeightDieUpdateModuleData, m_targetHeightAboveTerrain ) }, + { "TargetHeightIncludesStructures", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_targetHeightIncludesStructures ) }, + { "OnlyWhenMovingDown", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_onlyWhenMovingDown ) }, + { "DestroyAttachedParticlesAtHeight", INI::parseReal, nullptr, offsetof( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) }, + { "SnapToGroundOnDeath", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) }, + { "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( HeightDieUpdateModuleData, m_initialDelay ) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -119,7 +119,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) return UPDATE_SLEEP_NONE; // do nothing if we're contained within other objects ... like a transport - if( getObject()->getContainedBy() != NULL ) + if( getObject()->getContainedBy() != nullptr ) { // keep track of our last position even though we're not doing anything yet @@ -179,7 +179,7 @@ UpdateSleepTime HeightDieUpdate::update( void ) // scan all objects in the radius of our extent and find the tallest height among them PartitionFilterAcceptByKindOf filter1( MAKE_KINDOF_MASK( KINDOF_STRUCTURE ),KINDOFMASK_NONE ); - PartitionFilter *filters[] = { &filter1, NULL }; + PartitionFilter *filters[] = { &filter1, nullptr }; Real range = getObject()->getGeometryInfo().getBoundingCircleRadius(); ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( getObject(), range, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp index 03b7d9ed595..30885ca59d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp @@ -77,17 +77,17 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo m_minBladeFlyOffDelay = 0.0; m_maxBladeFlyOffDelay = 0.0; - m_attachParticleSystem = NULL; + m_attachParticleSystem = nullptr; m_attachParticleLoc.x = 0.0f; m_attachParticleLoc.y = 0.0f; m_attachParticleLoc.z = 0.0f; - m_oclEjectPilot = NULL; - m_fxBlade = NULL; - m_oclBlade = NULL; - m_fxHitGround = NULL; - m_oclHitGround = NULL; - m_fxFinalBlowUp = NULL; - m_oclFinalBlowUp = NULL; + m_oclEjectPilot = nullptr; + m_fxBlade = nullptr; + m_oclBlade = nullptr; + m_fxHitGround = nullptr; + m_oclHitGround = nullptr; + m_fxFinalBlowUp = nullptr; + m_oclFinalBlowUp = nullptr; m_delayFromGroundToFinalDeath = 0; m_maxBraking = 99999.0f; @@ -101,34 +101,34 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo static const FieldParse dataFieldParse[] = { - { "SpiralOrbitTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitTurnRate ) }, - { "SpiralOrbitForwardSpeed", INI::parseVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeed ) }, - { "SpiralOrbitForwardSpeedDamping", INI::parseReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) }, - { "MinSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minSelfSpin ) }, - { "MaxSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxSelfSpin ) }, - { "SelfSpinUpdateDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateDelay ) }, - { "SelfSpinUpdateAmount", INI::parseAngleReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateAmount ) }, - { "FallHowFast", INI::parsePercentToReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fallHowFast ) }, - { "MinBladeFlyOffDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minBladeFlyOffDelay ) }, - { "MaxBladeFlyOffDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBladeFlyOffDelay ) }, - { "AttachParticle", INI::parseParticleSystemTemplate, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleSystem ) }, - { "AttachParticleBone", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleBone ) }, - { "AttachParticleLoc", INI::parseCoord3D, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleLoc ) }, - { "BladeObjectName", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeObjectName ) }, - { "BladeBoneName", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeBone ) }, - { "OCLEjectPilot", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclEjectPilot ) }, - { "FXBlade", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxBlade ) }, - { "OCLBlade", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclBlade ) }, - { "FXHitGround", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxHitGround ) }, - { "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclHitGround ) }, - { "FXFinalBlowUp", INI::parseFXList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, - { "OCLFinalBlowUp", INI::parseObjectCreationList, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, - { "DelayFromGroundToFinalDeath", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_delayFromGroundToFinalDeath ) }, - { "FinalRubbleObject", INI::parseAsciiString, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_finalRubbleObject ) }, - { "SoundDeathLoop", INI::parseAudioEventRTS, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_deathSound) }, - { "MaxBraking", INI::parseAccelerationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBraking) }, - - { 0, 0, 0, 0 } + { "SpiralOrbitTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitTurnRate ) }, + { "SpiralOrbitForwardSpeed", INI::parseVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeed ) }, + { "SpiralOrbitForwardSpeedDamping", INI::parseReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) }, + { "MinSelfSpin", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minSelfSpin ) }, + { "MaxSelfSpin", INI::parseAngularVelocityReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxSelfSpin ) }, + { "SelfSpinUpdateDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateDelay ) }, + { "SelfSpinUpdateAmount", INI::parseAngleReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateAmount ) }, + { "FallHowFast", INI::parsePercentToReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fallHowFast ) }, + { "MinBladeFlyOffDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minBladeFlyOffDelay ) }, + { "MaxBladeFlyOffDelay", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBladeFlyOffDelay ) }, + { "AttachParticle", INI::parseParticleSystemTemplate, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleSystem ) }, + { "AttachParticleBone", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleBone ) }, + { "AttachParticleLoc", INI::parseCoord3D, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_attachParticleLoc ) }, + { "BladeObjectName", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeObjectName ) }, + { "BladeBoneName", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_bladeBone ) }, + { "OCLEjectPilot", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclEjectPilot ) }, + { "FXBlade", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxBlade ) }, + { "OCLBlade", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclBlade ) }, + { "FXHitGround", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxHitGround ) }, + { "OCLHitGround", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclHitGround ) }, + { "FXFinalBlowUp", INI::parseFXList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_fxFinalBlowUp ) }, + { "OCLFinalBlowUp", INI::parseObjectCreationList, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_oclFinalBlowUp ) }, + { "DelayFromGroundToFinalDeath", INI::parseDurationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_delayFromGroundToFinalDeath ) }, + { "FinalRubbleObject", INI::parseAsciiString, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_finalRubbleObject ) }, + { "SoundDeathLoop", INI::parseAudioEventRTS, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_deathSound) }, + { "MaxBraking", INI::parseAccelerationReal, nullptr, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxBraking) }, + + { nullptr, nullptr, nullptr, 0 } }; @@ -244,7 +244,7 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo ) { Coord3D pos; - if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, NULL, 1 ) ) + if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, nullptr, 1 ) ) pSys->setPosition( &pos ); } @@ -384,8 +384,8 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) if( draw ) { - draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, NULL, 1 ); - draw->convertBonePosToWorldPos( &bladePos, NULL, &bladePos, NULL ); + draw->getPristineBonePositions( modData->m_bladeBone.str(), 0, &bladePos, nullptr, 1 ); + draw->convertBonePosToWorldPos( &bladePos, nullptr, &bladePos, nullptr ); } @@ -395,7 +395,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // run the fx at the blade position FXList::doFXPos( modData->m_fxBlade, &bladePos ); - ObjectCreationList::create( modData->m_oclBlade, copter, &bladePos, NULL, INVALID_ANGLE ); + ObjectCreationList::create( modData->m_oclBlade, copter, &bladePos, nullptr, INVALID_ANGLE ); // // if we have (potentially) a pilot ejection, do it here. @@ -403,7 +403,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // because the former makes the right sounds, and also constrains to veteran-or-better status. // if( modData->m_oclEjectPilot && copter->getVeterancyLevel() > LEVEL_REGULAR ) - EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, NULL ); + EjectPilotDie::ejectPilot( modData->m_oclEjectPilot, copter, nullptr ); } @@ -449,7 +449,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // make hit ground effect FXList::doFXObj( modData->m_fxHitGround, copter ); - ObjectCreationList::create( modData->m_oclHitGround, copter, NULL ); + ObjectCreationList::create( modData->m_oclHitGround, copter, nullptr ); // hold the copter in place now copter->setDisabled( DISABLED_HELD ); @@ -472,7 +472,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) // make effect FXList::doFXObj( modData->m_fxFinalBlowUp, copter ); - ObjectCreationList::create( modData->m_oclFinalBlowUp, copter, NULL ); + ObjectCreationList::create( modData->m_oclFinalBlowUp, copter, nullptr ); // we are now all done, destroy us and make a rubble shell copter const ThingTemplate* ttn = TheThingFactory->findTemplate(modData->m_finalRubbleObject); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index 1315d661762..b8fe6836d25 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -57,7 +57,7 @@ HijackerUpdate::HijackerUpdate( Thing *thing, const ModuleData *moduleData ) : U setIsInVehicle( FALSE ); m_wasTargetAirborne = false; m_ejectPos.zero(); -// m_ejectPilotDMI = NULL; +// m_ejectPilotDMI = nullptr; } //------------------------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ UpdateSleepTime HijackerUpdate::update( void ) } - setTargetObject( NULL ); + setTargetObject( nullptr ); setIsInVehicle( FALSE ); setUpdate( FALSE ); m_wasTargetAirborne = false; @@ -174,9 +174,9 @@ void HijackerUpdate::setTargetObject( const Object *object ) // here we also test the target to see whether it ejects pilots // when it dies... if so, stores a pointer to that diemoduleinterface - // NULL if not... + // nullptr if not... -// BehaviorModule **dmi = NULL; +// BehaviorModule **dmi = nullptr; // for( dmi = object->getBehaviorModules(); *dmi; ++dmi ) // { // m_ejectPilotDMI = (*dmi)->getEjectPilotDieInterface(); @@ -187,7 +187,7 @@ void HijackerUpdate::setTargetObject( const Object *object ) else { m_targetID = INVALID_ID; -// m_ejectPilotDMI = NULL; +// m_ejectPilotDMI = nullptr; } } @@ -198,7 +198,7 @@ Object* HijackerUpdate::getTargetObject() const { return TheGameLogic->findObjectByID( m_targetID ); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index aac30b83c4f..e5bfbcf3dc3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -57,7 +57,7 @@ static HordeUpdateInterface* getHUI(Object* obj) if( hui ) return hui; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -132,17 +132,17 @@ HordeUpdateModuleData::HordeUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "UpdateRate", INI::parseDurationUnsignedInt, NULL, offsetof(HordeUpdateModuleData, m_updateRate) }, - { "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof(HordeUpdateModuleData, m_kindof) }, - { "Count", INI::parseInt, NULL, offsetof(HordeUpdateModuleData, m_minCount) }, - { "Radius", INI::parseReal, NULL, offsetof(HordeUpdateModuleData, m_minDist) }, - { "RubOffRadius", INI::parseReal, NULL, offsetof(HordeUpdateModuleData, m_rubOffRadius) }, - { "AlliesOnly", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_alliesOnly) }, - { "ExactMatch", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_exactMatch) }, + { "UpdateRate", INI::parseDurationUnsignedInt, nullptr, offsetof(HordeUpdateModuleData, m_updateRate) }, + { "KindOf", KindOfMaskType::parseFromINI, nullptr, offsetof(HordeUpdateModuleData, m_kindof) }, + { "Count", INI::parseInt, nullptr, offsetof(HordeUpdateModuleData, m_minCount) }, + { "Radius", INI::parseReal, nullptr, offsetof(HordeUpdateModuleData, m_minDist) }, + { "RubOffRadius", INI::parseReal, nullptr, offsetof(HordeUpdateModuleData, m_rubOffRadius) }, + { "AlliesOnly", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_alliesOnly) }, + { "ExactMatch", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_exactMatch) }, { "Action", INI::parseIndexList, TheHordeActionTypeNames, offsetof(HordeUpdateModuleData, m_action) }, - { "FlagSubObjectNames", INI::parseAsciiStringVector, NULL, offsetof(HordeUpdateModuleData, m_flagSubObjNames) }, - { "AllowedNationalism", INI::parseBool, NULL, offsetof(HordeUpdateModuleData, m_allowedNationalism) }, - { 0, 0, 0, 0 } + { "FlagSubObjectNames", INI::parseAsciiStringVector, nullptr, offsetof(HordeUpdateModuleData, m_flagSubObjNames) }, + { "AllowedNationalism", INI::parseBool, nullptr, offsetof(HordeUpdateModuleData, m_allowedNationalism) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -257,7 +257,7 @@ UpdateSleepTime HordeUpdate::update( void ) m_lastHordeRefreshFrame = TheGameLogic->getFrame(); PartitionFilterHordeMember hmFilter(getObject(), md); - PartitionFilter *filters[] = { &hmFilter, NULL }; + PartitionFilter *filters[] = { &hmFilter, nullptr }; SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(getObject(), md->m_minDist, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); @@ -275,7 +275,7 @@ UpdateSleepTime HordeUpdate::update( void ) for (Object* other = iter->first(); other; other = iter->next()) { HordeUpdateInterface* hui = getHUI(other); - if ( hui != NULL && hui->isTrueHordeMember() ) + if ( hui != nullptr && hui->isTrueHordeMember() ) { Real dist = ThePartitionManager->getDistanceSquared(getObject(), other, FROM_CENTER_2D); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp index 60d0baf30e2..5214a726b5f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp @@ -59,10 +59,10 @@ LaserUpdateModuleData::LaserUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "MuzzleParticleSystem", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_particleSystemName ) }, - { "TargetParticleSystem", INI::parseAsciiString, NULL, offsetof( LaserUpdateModuleData, m_targetParticleSystemName ) }, - { "PunchThroughScalar", INI::parseReal, NULL, offsetof( LaserUpdateModuleData, m_punchThroughScalar ) }, - { 0, 0, 0, 0 } + { "MuzzleParticleSystem", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_particleSystemName ) }, + { "TargetParticleSystem", INI::parseAsciiString, nullptr, offsetof( LaserUpdateModuleData, m_targetParticleSystemName ) }, + { "PunchThroughScalar", INI::parseReal, nullptr, offsetof( LaserUpdateModuleData, m_punchThroughScalar ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -116,7 +116,7 @@ void LaserUpdate::updateStartPos() return;// Can't update if not told to update const Drawable *parentDrawable = TheGameClient->findDrawableByID(m_parentID); - if( parentDrawable == NULL ) + if( parentDrawable == nullptr ) return;// Can't update if no one to ask if( m_parentBoneName.isNotEmpty() ) @@ -167,7 +167,7 @@ void LaserUpdate::updateEndPos() Bool targetDead = (targetDrawable && targetDrawable->getObject()) ? targetDrawable->getObject()->isEffectivelyDead() : FALSE; - if( targetDrawable == NULL || targetDead ) + if( targetDrawable == nullptr || targetDead ) { // If here, we used to track something, but now it is gone. So make our end point pierce through // the old spot, and then stop trying to find a target Drawable @@ -344,7 +344,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C } // Create special particle systems - //PLEASE NOTE You cannot check an ID for NULL. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. + //PLEASE NOTE You cannot check an ID for nullptr. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. if( !m_particleSystemID ) { const Player *localPlayer = rts::getObservedOrLocalPlayer(); @@ -384,7 +384,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C } //Adjust the position of any existing particle system. - //PLEASE NOTE You cannot check an ID for NULL. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. + //PLEASE NOTE You cannot check an ID for nullptr. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. if( m_particleSystemID ) { system = TheParticleSystemManager->findParticleSystem( m_particleSystemID ); @@ -394,7 +394,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C } } - //PLEASE NOTE You cannot check an ID for NULL. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. + //PLEASE NOTE You cannot check an ID for nullptr. This should be a check against INVALID_PARTICLE_SYSTEM_ID. Can't change it on the last day without a bug though. if( m_targetParticleSystemID ) { system = TheParticleSystemManager->findParticleSystem( m_targetParticleSystemID ); @@ -408,7 +408,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C //it probably won't get rendered!!! // And as a client update, we cannot set the logic position. Coord3D posToUse; - if( parent == NULL ) + if( parent == nullptr ) { posToUse.set( startPos ); posToUse.add( endPos ); @@ -432,7 +432,7 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C Real LaserUpdate::getTemplateLaserRadius() const { const Drawable *draw = getDrawable(); - const LaserDrawInterface* ldi = NULL; + const LaserDrawInterface* ldi = nullptr; for( const DrawModule** d = draw->getDrawModules(); *d; ++d ) { ldi = (*d)->getLaserDrawInterface(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp index 0edb6bb8a62..0d85f7f42fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp @@ -135,7 +135,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) } Object *master = TheGameLogic->findObjectByID( m_slaver ); - if( master == NULL ) + if( master == nullptr ) { stopSlavedEffects(); @@ -304,7 +304,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) if ( masterAI->isIdle() ) // if controlling player has pressed stop, we stop! That's it! { myAI->aiIdle(CMD_FROM_AI); - primaryVictim = NULL; + primaryVictim = nullptr; m_primaryVictimID = INVALID_ID; return UPDATE_SLEEP_NONE; } @@ -339,7 +339,7 @@ UpdateSleepTime MobMemberSlavedUpdate::update( void ) } else { - DEBUG_ASSERTCRASH(( spawnerBehavior != NULL ),("Hey!, why for this mob member got no spawner? MLorenzen")); + DEBUG_ASSERTCRASH(( spawnerBehavior != nullptr ),("Hey!, why for this mob member got no spawner? MLorenzen")); } } @@ -378,7 +378,7 @@ void MobMemberSlavedUpdate::doCatchUpLogic( Coord3D *pos ) //------------------------------------------------------------------------------------------------- void MobMemberSlavedUpdate::startSlavedEffects( const Object *slaver ) { - if( slaver == NULL ) + if( slaver == nullptr ) return; m_slaver = slaver->getID(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp index 13814396128..cb74afdd15b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp @@ -69,7 +69,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule } m_scorchSize = 0.0f; - m_fxList = NULL; + m_fxList = nullptr; } @@ -82,100 +82,100 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule static const FieldParse dataFieldParse[] = { - { "ScorchMarkSize", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_scorchSize ) }, - { "FXList", INI::parseFXList, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_fxList ) }, - - { "Blast1Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].enabled ) }, - { "Blast1Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].delay ) }, - { "Blast1ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].scorchDelay ) }, - { "Blast1InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].innerRadius ) }, - { "Blast1OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].outerRadius ) }, - { "Blast1MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].maxDamage ) }, - { "Blast1MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].minDamage ) }, - { "Blast1ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) }, - { "Blast1PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) }, - - { "Blast2Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].enabled ) }, - { "Blast2Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].delay ) }, - { "Blast2ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].scorchDelay ) }, - { "Blast2InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].innerRadius ) }, - { "Blast2OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].outerRadius ) }, - { "Blast2MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].maxDamage ) }, - { "Blast2MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].minDamage ) }, - { "Blast2ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) }, - { "Blast2PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) }, - - { "Blast3Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].enabled ) }, - { "Blast3Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].delay ) }, - { "Blast3ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].scorchDelay ) }, - { "Blast3InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].innerRadius ) }, - { "Blast3OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].outerRadius ) }, - { "Blast3MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].maxDamage ) }, - { "Blast3MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].minDamage ) }, - { "Blast3ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) }, - { "Blast3PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) }, - - { "Blast4Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].enabled ) }, - { "Blast4Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].delay ) }, - { "Blast4ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].scorchDelay ) }, - { "Blast4InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].innerRadius ) }, - { "Blast4OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].outerRadius ) }, - { "Blast4MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].maxDamage ) }, - { "Blast4MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].minDamage ) }, - { "Blast4ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) }, - { "Blast4PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) }, - - { "Blast5Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].enabled ) }, - { "Blast5Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].delay ) }, - { "Blast5ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].scorchDelay ) }, - { "Blast5InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].innerRadius ) }, - { "Blast5OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].outerRadius ) }, - { "Blast5MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].maxDamage ) }, - { "Blast5MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].minDamage ) }, - { "Blast5ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) }, - { "Blast5PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) }, - - { "Blast6Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].enabled ) }, - { "Blast6Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].delay ) }, - { "Blast6ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].scorchDelay ) }, - { "Blast6InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].innerRadius ) }, - { "Blast6OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].outerRadius ) }, - { "Blast6MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].maxDamage ) }, - { "Blast6MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].minDamage ) }, - { "Blast6ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) }, - { "Blast6PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) }, - - { "Blast7Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].enabled ) }, - { "Blast7Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].delay ) }, - { "Blast7ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].scorchDelay ) }, - { "Blast7InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].innerRadius ) }, - { "Blast7OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].outerRadius ) }, - { "Blast7MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].maxDamage ) }, - { "Blast7MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].minDamage ) }, - { "Blast7ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) }, - { "Blast7PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) }, - - { "Blast8Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].enabled ) }, - { "Blast8Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].delay ) }, - { "Blast8ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].scorchDelay ) }, - { "Blast8InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].innerRadius ) }, - { "Blast8OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].outerRadius ) }, - { "Blast8MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].maxDamage ) }, - { "Blast8MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].minDamage ) }, - { "Blast8ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) }, - { "Blast8PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) }, - - { "Blast9Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].enabled ) }, - { "Blast9Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].delay ) }, - { "Blast9ScorchDelay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].scorchDelay ) }, - { "Blast9InnerRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].innerRadius ) }, - { "Blast9OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].outerRadius ) }, - { "Blast9MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].maxDamage ) }, - { "Blast9MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].minDamage ) }, - { "Blast9ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) }, - { "Blast9PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) }, - - { 0, 0, 0, 0 } + { "ScorchMarkSize", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_scorchSize ) }, + { "FXList", INI::parseFXList, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_fxList ) }, + + { "Blast1Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].enabled ) }, + { "Blast1Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].delay ) }, + { "Blast1ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].scorchDelay ) }, + { "Blast1InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].innerRadius ) }, + { "Blast1OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].outerRadius ) }, + { "Blast1MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].maxDamage ) }, + { "Blast1MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].minDamage ) }, + { "Blast1ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) }, + { "Blast1PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) }, + + { "Blast2Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].enabled ) }, + { "Blast2Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].delay ) }, + { "Blast2ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].scorchDelay ) }, + { "Blast2InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].innerRadius ) }, + { "Blast2OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].outerRadius ) }, + { "Blast2MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].maxDamage ) }, + { "Blast2MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].minDamage ) }, + { "Blast2ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) }, + { "Blast2PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) }, + + { "Blast3Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].enabled ) }, + { "Blast3Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].delay ) }, + { "Blast3ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].scorchDelay ) }, + { "Blast3InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].innerRadius ) }, + { "Blast3OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].outerRadius ) }, + { "Blast3MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].maxDamage ) }, + { "Blast3MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].minDamage ) }, + { "Blast3ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) }, + { "Blast3PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) }, + + { "Blast4Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].enabled ) }, + { "Blast4Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].delay ) }, + { "Blast4ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].scorchDelay ) }, + { "Blast4InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].innerRadius ) }, + { "Blast4OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].outerRadius ) }, + { "Blast4MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].maxDamage ) }, + { "Blast4MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].minDamage ) }, + { "Blast4ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) }, + { "Blast4PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) }, + + { "Blast5Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].enabled ) }, + { "Blast5Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].delay ) }, + { "Blast5ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].scorchDelay ) }, + { "Blast5InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].innerRadius ) }, + { "Blast5OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].outerRadius ) }, + { "Blast5MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].maxDamage ) }, + { "Blast5MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].minDamage ) }, + { "Blast5ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) }, + { "Blast5PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) }, + + { "Blast6Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].enabled ) }, + { "Blast6Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].delay ) }, + { "Blast6ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].scorchDelay ) }, + { "Blast6InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].innerRadius ) }, + { "Blast6OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].outerRadius ) }, + { "Blast6MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].maxDamage ) }, + { "Blast6MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].minDamage ) }, + { "Blast6ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) }, + { "Blast6PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) }, + + { "Blast7Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].enabled ) }, + { "Blast7Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].delay ) }, + { "Blast7ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].scorchDelay ) }, + { "Blast7InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].innerRadius ) }, + { "Blast7OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].outerRadius ) }, + { "Blast7MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].maxDamage ) }, + { "Blast7MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].minDamage ) }, + { "Blast7ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) }, + { "Blast7PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) }, + + { "Blast8Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].enabled ) }, + { "Blast8Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].delay ) }, + { "Blast8ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].scorchDelay ) }, + { "Blast8InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].innerRadius ) }, + { "Blast8OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].outerRadius ) }, + { "Blast8MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].maxDamage ) }, + { "Blast8MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].minDamage ) }, + { "Blast8ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) }, + { "Blast8PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) }, + + { "Blast9Enabled", INI::parseBool, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].enabled ) }, + { "Blast9Delay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].delay ) }, + { "Blast9ScorchDelay", INI::parseDurationReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].scorchDelay ) }, + { "Blast9InnerRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].innerRadius ) }, + { "Blast9OuterRadius", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].outerRadius ) }, + { "Blast9MaxDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].maxDamage ) }, + { "Blast9MinDamage", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].minDamage ) }, + { "Blast9ToppleSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) }, + { "Blast9PushForce", INI::parseReal, nullptr, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -294,7 +294,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) { // sanity - if( blastInfo == NULL ) + if( blastInfo == nullptr ) return; // get the module data @@ -317,7 +317,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( missilePos, blastInfo->outerRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; const Coord3D *otherPos; @@ -413,7 +413,7 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo { // sanity - if( blastInfo == NULL ) + if( blastInfo == nullptr ) return; // get the module data @@ -429,7 +429,7 @@ void NeutronMissileSlowDeathBehavior::doScorchBlast( const BlastInfo *blastInfo ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( missilePos, blastInfo->outerRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *other; for( other = iter->first(); other; other = iter->next() ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp index 695c65a63af..b8362c82f2f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp @@ -62,8 +62,8 @@ NeutronMissileUpdateModuleData::NeutronMissileUpdateModuleData() m_forwardDamping = 0; m_relativeSpeed = 1.0f; m_targetFromDirectlyAbove = 0.0f; - m_ignitionFX = NULL; - m_launchFX = NULL; + m_ignitionFX = nullptr; + m_launchFX = nullptr; m_specialAccelFactor = 1.0f; m_specialSpeedTime = 0; m_specialSpeedHeight = 0.0f; @@ -78,20 +78,20 @@ void NeutronMissileUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DistanceToTravelBeforeTurning", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_initialDist ) }, - { "MaxTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_maxTurnRate ) }, - { "ForwardDamping", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_forwardDamping ) }, - { "RelativeSpeed", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_relativeSpeed ) }, - { "TargetFromDirectlyAbove", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_targetFromDirectlyAbove ) }, - { "LaunchFX", INI::parseFXList, NULL, offsetof( NeutronMissileUpdateModuleData, m_launchFX ) }, - { "SpecialSpeedTime", INI::parseDurationUnsignedInt, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedTime ) }, - { "SpecialSpeedHeight", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedHeight ) }, - { "SpecialAccelFactor", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialAccelFactor ) }, - { "SpecialJitterDistance", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_specialJitterDistance ) }, - { "IgnitionFX", INI::parseFXList, NULL, offsetof( NeutronMissileUpdateModuleData, m_ignitionFX ) }, - { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalTemplate ) }, - { "DeliveryDecalRadius", INI::parseReal, NULL, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalRadius ) }, - { 0, 0, 0, 0 } + { "DistanceToTravelBeforeTurning", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_initialDist ) }, + { "MaxTurnRate", INI::parseAngularVelocityReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_maxTurnRate ) }, + { "ForwardDamping", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_forwardDamping ) }, + { "RelativeSpeed", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_relativeSpeed ) }, + { "TargetFromDirectlyAbove", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_targetFromDirectlyAbove ) }, + { "LaunchFX", INI::parseFXList, nullptr, offsetof( NeutronMissileUpdateModuleData, m_launchFX ) }, + { "SpecialSpeedTime", INI::parseDurationUnsignedInt, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedTime ) }, + { "SpecialSpeedHeight", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialSpeedHeight ) }, + { "SpecialAccelFactor", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialAccelFactor ) }, + { "SpecialJitterDistance", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_specialJitterDistance ) }, + { "IgnitionFX", INI::parseFXList, nullptr, offsetof( NeutronMissileUpdateModuleData, m_ignitionFX ) }, + { "DeliveryDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalTemplate ) }, + { "DeliveryDecalRadius", INI::parseReal, nullptr, offsetof( NeutronMissileUpdateModuleData, m_deliveryDecalRadius ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -124,7 +124,7 @@ NeutronMissileUpdate::NeutronMissileUpdate( Thing *thing, const ModuleData* modu m_heightAtLaunch = 0; m_frameAtLaunch = 0; - m_exhaustSysTmpl = NULL; + m_exhaustSysTmpl = nullptr; } @@ -204,7 +204,7 @@ void NeutronMissileUpdate::doLaunch( void ) Object *launcher = TheGameLogic->findObjectByID( m_launcherID ); // if our launch vehicle is gone, destroy ourselves - if (launcher == NULL) + if (launcher == nullptr) { m_launcherID = INVALID_ID; TheGameLogic->destroyObject( getObject() ); @@ -213,14 +213,14 @@ void NeutronMissileUpdate::doLaunch( void ) Matrix3D attachTransform; if (!launcher->getDrawable() || - !launcher->getDrawable()->getProjectileLaunchOffset(m_attach_wslot, m_attach_specificBarrelToUse, &attachTransform, TURRET_INVALID, NULL)) + !launcher->getDrawable()->getProjectileLaunchOffset(m_attach_wslot, m_attach_specificBarrelToUse, &attachTransform, TURRET_INVALID, nullptr)) { DEBUG_CRASH(("ProjectileLaunchPos %d %d not found!",m_attach_wslot, m_attach_specificBarrelToUse)); attachTransform.Make_Identity(); } Matrix3D worldTransform; - launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); + launcher->convertBonePosToWorldPos(nullptr, &attachTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); Coord3D worldPos; @@ -264,7 +264,7 @@ void NeutronMissileUpdate::doLaunch( void ) FXList::doFXObj(getNeutronMissileUpdateModuleData()->m_ignitionFX, getObject()); - if (m_exhaustSysTmpl != NULL) + if (m_exhaustSysTmpl != nullptr) TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject()); m_state = ATTACK; @@ -383,7 +383,7 @@ void NeutronMissileUpdate::doAttack( void ) UnsignedInt now = TheGameLogic->getFrame(); if (d->m_specialSpeedTime > 0 && now <= m_frameAtLaunch + d->m_specialSpeedTime) { - getObject()->getDrawable()->setInstanceMatrix(NULL); + getObject()->getDrawable()->setInstanceMatrix(nullptr); UnsignedInt elapsed = now - m_frameAtLaunch; if (elapsed < d->m_specialSpeedTime) { @@ -436,7 +436,7 @@ Bool NeutronMissileUpdate::projectileHandleCollision( Object *other ) return true; // Don't hit your own launcher, ever. - if (other != NULL && projectileGetLauncherID() == other->getID()) + if (other != nullptr && projectileGetLauncherID() == other->getID()) return true; // collided with something... blow'd up! @@ -524,7 +524,7 @@ UpdateSleepTime NeutronMissileUpdate::update( void ) Coord3D normal; normal.x = normal.y = 0.0f; normal.z = -1.0f; - getObject()->onCollide(NULL, getObject()->getPosition(), &normal); + getObject()->onCollide(nullptr, getObject()->getPosition(), &normal); } return UPDATE_SLEEP_NONE; } @@ -610,13 +610,13 @@ void NeutronMissileUpdate::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - // make system template NULL to be safe - m_exhaustSysTmpl = NULL; + // make system template nullptr to be safe + m_exhaustSysTmpl = nullptr; if( name.isEmpty() == FALSE ) { m_exhaustSysTmpl = TheParticleSystemManager->findTemplate( name ); - if( m_exhaustSysTmpl == NULL ) + if( m_exhaustSysTmpl == nullptr ) { DEBUG_CRASH(( "NeutronMissileUpdate::xfer - Unable to find particle system '%s'", name.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp index a05d9ff2b3c..a4e33d33eb4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp @@ -46,7 +46,7 @@ void parseFactionObjectCreationList( INI *ini, void *instance, void *store, const void *userData ) { OCLUpdateModuleData::FactionOCLInfo info; - info.m_ocl = NULL; + info.m_ocl = nullptr; const char *token = ini->getNextToken( ini->getSepsColon() ); @@ -63,7 +63,7 @@ void parseFactionObjectCreationList( INI *ini, void *instance, void *store, cons token = ini->getNextTokenOrNull( ini->getSepsColon() ); if ( stricmp(token, "OCL") == 0 ) - ini->parseObjectCreationList( ini, instance, &info.m_ocl, NULL ); + ini->parseObjectCreationList( ini, instance, &info.m_ocl, nullptr ); else throw INI_INVALID_DATA; @@ -78,7 +78,7 @@ OCLUpdateModuleData::OCLUpdateModuleData() { m_minDelay = 0; m_maxDelay = 0; - m_ocl = NULL; + m_ocl = nullptr; m_factionOCL.clear(); m_isCreateAtEdge = FALSE; m_isFactionTriggered = FALSE; @@ -91,13 +91,13 @@ OCLUpdateModuleData::OCLUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "OCL", INI::parseObjectCreationList, NULL, offsetof( OCLUpdateModuleData, m_ocl ) }, - { "FactionOCL", parseFactionObjectCreationList, NULL, offsetof( OCLUpdateModuleData, m_factionOCL ) }, - { "MinDelay", INI::parseDurationUnsignedInt, NULL, offsetof( OCLUpdateModuleData, m_minDelay ) }, - { "MaxDelay", INI::parseDurationUnsignedInt, NULL, offsetof( OCLUpdateModuleData, m_maxDelay ) }, - { "CreateAtEdge", INI::parseBool, NULL, offsetof( OCLUpdateModuleData, m_isCreateAtEdge ) }, - { "FactionTriggered", INI::parseBool, NULL, offsetof( OCLUpdateModuleData, m_isFactionTriggered ) }, - { 0, 0, 0, 0 } + { "OCL", INI::parseObjectCreationList, nullptr, offsetof( OCLUpdateModuleData, m_ocl ) }, + { "FactionOCL", parseFactionObjectCreationList, nullptr, offsetof( OCLUpdateModuleData, m_factionOCL ) }, + { "MinDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( OCLUpdateModuleData, m_minDelay ) }, + { "MaxDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( OCLUpdateModuleData, m_maxDelay ) }, + { "CreateAtEdge", INI::parseBool, nullptr, offsetof( OCLUpdateModuleData, m_isCreateAtEdge ) }, + { "FactionTriggered", INI::parseBool, nullptr, offsetof( OCLUpdateModuleData, m_isFactionTriggered ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index bb41f47e125..bc8292da4cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -64,7 +64,7 @@ //------------------------------------------------------------------------------------------------- ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_beginChargeFrames = 0; m_raiseAntennaFrames = 0; m_readyDelayFrames = 0; @@ -75,8 +75,8 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() m_totalScorchMarks = 0; m_scorchMarkScalar = 1.0f; m_damageRadiusScalar = 1.0f; - m_groundHitFX = NULL; - m_beamLaunchFX = NULL; + m_groundHitFX = nullptr; + m_beamLaunchFX = nullptr; m_framesBetweenLaunchFXRefresh = 30; m_totalDamagePulses = 0; m_damagePerSecond = 0.0f; @@ -97,59 +97,59 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_specialPowerTemplate ) }, - { "BeginChargeTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beginChargeFrames ) }, - { "RaiseAntennaTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_raiseAntennaFrames ) }, - { "ReadyDelayTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_readyDelayFrames ) }, - { "WidthGrowTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_widthGrowFrames ) }, - { "BeamTravelTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamTravelFrames ) }, - { "TotalFiringTime", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalFiringFrames ) }, - { "RevealRange", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_revealRange ) }, - - { "OuterEffectBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectBaseBoneName ) }, - { "OuterEffectNumBones", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectNumBones ) }, - { "OuterNodesLightFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesLightFlareParticleSystemName ) }, - { "OuterNodesMediumFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesMediumFlareParticleSystemName ) }, - { "OuterNodesIntenseFlareParticleSystem", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesIntenseFlareParticleSystemName ) }, - - { "ConnectorBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorBoneName ) }, - { "ConnectorMediumLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumLaserNameName ) }, - { "ConnectorIntenseLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseLaserNameName ) }, - { "ConnectorMediumFlare", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumFlareParticleSystemName ) }, - { "ConnectorIntenseFlare", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseFlareParticleSystemName ) }, - - { "FireBoneName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_fireBoneName ) }, - { "LaserBaseLightFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseLightFlareParticleSystemName ) }, - { "LaserBaseMediumFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseMediumFlareParticleSystemName ) }, - { "LaserBaseIntenseFlareParticleSystemName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseIntenseFlareParticleSystemName ) }, - - { "ParticleBeamLaserName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_particleBeamLaserName ) }, - - { "SwathOfDeathDistance", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathDistance ) }, - { "SwathOfDeathAmplitude", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathAmplitude ) }, - { "TotalScorchMarks", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalScorchMarks ) }, - { "ScorchMarkScalar", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_scorchMarkScalar ) }, - { "BeamLaunchFX", INI::parseFXList, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamLaunchFX ) }, - { "DelayBetweenLaunchFX", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_framesBetweenLaunchFXRefresh ) }, - { "GroundHitFX", INI::parseFXList, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_groundHitFX ) }, - - { "DamagePerSecond", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePerSecond ) }, - { "TotalDamagePulses", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalDamagePulses ) }, - { "DamageType", DamageTypeFlags::parseSingleBitFromINI, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageType ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_specialPowerTemplate ) }, + { "BeginChargeTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beginChargeFrames ) }, + { "RaiseAntennaTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_raiseAntennaFrames ) }, + { "ReadyDelayTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_readyDelayFrames ) }, + { "WidthGrowTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_widthGrowFrames ) }, + { "BeamTravelTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamTravelFrames ) }, + { "TotalFiringTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalFiringFrames ) }, + { "RevealRange", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_revealRange ) }, + + { "OuterEffectBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectBaseBoneName ) }, + { "OuterEffectNumBones", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerEffectNumBones ) }, + { "OuterNodesLightFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesLightFlareParticleSystemName ) }, + { "OuterNodesMediumFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesMediumFlareParticleSystemName ) }, + { "OuterNodesIntenseFlareParticleSystem", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_outerNodesIntenseFlareParticleSystemName ) }, + + { "ConnectorBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorBoneName ) }, + { "ConnectorMediumLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumLaserNameName ) }, + { "ConnectorIntenseLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseLaserNameName ) }, + { "ConnectorMediumFlare", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorMediumFlareParticleSystemName ) }, + { "ConnectorIntenseFlare", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_connectorIntenseFlareParticleSystemName ) }, + + { "FireBoneName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_fireBoneName ) }, + { "LaserBaseLightFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseLightFlareParticleSystemName ) }, + { "LaserBaseMediumFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseMediumFlareParticleSystemName ) }, + { "LaserBaseIntenseFlareParticleSystemName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_laserBaseIntenseFlareParticleSystemName ) }, + + { "ParticleBeamLaserName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_particleBeamLaserName ) }, + + { "SwathOfDeathDistance", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathDistance ) }, + { "SwathOfDeathAmplitude", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_swathOfDeathAmplitude ) }, + { "TotalScorchMarks", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalScorchMarks ) }, + { "ScorchMarkScalar", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_scorchMarkScalar ) }, + { "BeamLaunchFX", INI::parseFXList, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_beamLaunchFX ) }, + { "DelayBetweenLaunchFX", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_framesBetweenLaunchFXRefresh ) }, + { "GroundHitFX", INI::parseFXList, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_groundHitFX ) }, + + { "DamagePerSecond", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePerSecond ) }, + { "TotalDamagePulses", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalDamagePulses ) }, + { "DamageType", DamageTypeFlags::parseSingleBitFromINI, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageType ) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof( ParticleUplinkCannonUpdateModuleData, m_deathType ) }, - { "DamageRadiusScalar", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageRadiusScalar ) }, + { "DamageRadiusScalar", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageRadiusScalar ) }, - { "PoweringUpSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_powerupSoundName ) }, - { "UnpackToIdleSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_unpackToReadySoundName ) }, - { "FiringToPackSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_firingToIdleSoundName ) }, - { "GroundAnnihilationSoundLoop", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_annihilationSoundName ) }, - { "DamagePulseRemnantObjectName", INI::parseAsciiString, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePulseRemnantObjectName ) }, + { "PoweringUpSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_powerupSoundName ) }, + { "UnpackToIdleSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_unpackToReadySoundName ) }, + { "FiringToPackSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_firingToIdleSoundName ) }, + { "GroundAnnihilationSoundLoop", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_annihilationSoundName ) }, + { "DamagePulseRemnantObjectName", INI::parseAsciiString, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePulseRemnantObjectName ) }, - { "ManualDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) }, - { "ManualFastDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) }, - { "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) }, + { "ManualDrivingSpeed", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) }, + { "ManualFastDrivingSpeed", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) }, + { "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -161,7 +161,7 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu m_status = STATUS_IDLE; m_laserStatus = LASERSTATUS_NONE; m_frames = 0; - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; m_groundToOrbitBeamID = INVALID_DRAWABLE_ID; m_orbitToTargetBeamID = INVALID_DRAWABLE_ID; m_connectorSystemID = INVALID_PARTICLE_SYSTEM_ID; @@ -275,7 +275,7 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow if( !BitIsSet( commandOptions, COMMAND_FIRED_BY_SCRIPT ) ) { - DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be NULL")); + DEBUG_ASSERTCRASH(targetPos, ("Particle Cannon target data must not be null")); //All human players have manual control and must "drive" the beam around! m_startAttackFrame = TheGameLogic->getFrame(); @@ -322,7 +322,7 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow } else { - DEBUG_ASSERTCRASH(targetPos || targetObj, ("Particle Cannon target data must not be NULL")); + DEBUG_ASSERTCRASH(targetPos || targetObj, ("Particle Cannon target data must not be null")); //All computer controlled players have automatic control -- the "S" curve. UnsignedInt now = TheGameLogic->getFrame(); @@ -640,7 +640,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ); if( update ) { - update->initLaser( NULL, NULL, &orbitPosition, &m_currentTargetPosition, "" ); + update->initLaser( nullptr, nullptr, &orbitPosition, &m_currentTargetPosition, "" ); // TheSuperHackers @logic-client-separation The GameLogic has a dependency on this drawable. // The logical laser radius for the damage should probably be part of ParticleUplinkCannonUpdateModuleData. templateLaserRadius = update->getTemplateLaserRadius(); @@ -675,7 +675,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() //Generate iteration of fxlist for beam hitting ground. if( data->m_groundHitFX ) { - FXList::doFXPos( data->m_groundHitFX, &m_currentTargetPosition, NULL ); + FXList::doFXPos( data->m_groundHitFX, &m_currentTargetPosition, nullptr ); } //Also reveal vision because the owning player has full rights to watch the carnage he created! @@ -699,7 +699,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() damageInfo.in.m_deathType = data->m_deathType; PartitionFilterAlive filterAlive; - PartitionFilter *filters[] = { &filterAlive, NULL }; + PartitionFilter *filters[] = { &filterAlive, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( &m_currentTargetPosition, damageRadius, FROM_CENTER_2D, filters ); MemoryPoolObjectHolder hold( iter ); @@ -780,7 +780,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() //Generate iteration of fxlist for beam launching if( data->m_beamLaunchFX ) { - FXList::doFXPos( data->m_beamLaunchFX, &m_laserOriginPosition, NULL ); + FXList::doFXPos( data->m_beamLaunchFX, &m_laserOriginPosition, nullptr ); } m_nextLaunchFXFrame = now + data->m_framesBetweenLaunchFXRefresh; } @@ -896,7 +896,7 @@ void ParticleUplinkCannonUpdate::createConnectorLasers( IntensityTypes intensity LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ); if( update ) { - update->initLaser( NULL, NULL, &m_outerNodePositions[ i ], &m_connectorNodePosition, "" ); + update->initLaser( nullptr, nullptr, &m_outerNodePositions[ i ], &m_connectorNodePosition, "" ); } } } @@ -1004,7 +1004,7 @@ void ParticleUplinkCannonUpdate::createGroundToOrbitLaser( UnsignedInt growthFra Coord3D orbitPosition; orbitPosition.set( &m_laserOriginPosition ); orbitPosition.z += 500.0f; - update->initLaser( NULL, NULL, &m_laserOriginPosition, &orbitPosition, "", growthFrames ); + update->initLaser( nullptr, nullptr, &m_laserOriginPosition, &orbitPosition, "", growthFrames ); } } } @@ -1043,7 +1043,7 @@ void ParticleUplinkCannonUpdate::createOrbitToTargetLaser( UnsignedInt growthFra Coord3D orbitPosition; orbitPosition.set( &m_initialTargetPosition ); orbitPosition.z += 500.0f; - update->initLaser( NULL, NULL, &orbitPosition, &m_initialTargetPosition, "", growthFrames ); + update->initLaser( nullptr, nullptr, &orbitPosition, &m_initialTargetPosition, "", growthFrames ); } } } @@ -1541,11 +1541,11 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void ) if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID ) { Drawable* drawable = TheGameClient->findDrawableByID( m_orbitToTargetBeamID ); - if( drawable != NULL ) + if( drawable != nullptr ) { static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" ); LaserUpdate *update = (LaserUpdate*)drawable->findClientUpdateModule( nameKeyClientUpdate ); - if( update != NULL ) + if( update != nullptr ) { m_orbitToTargetLaserRadius = update->getLaserRadiusUpdate(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index ed6fc31c190..e58f80b5eef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -162,31 +162,31 @@ static void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, con static const FieldParse dataFieldParse[] = { - { "Mass", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_mass ) }, + { "Mass", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_mass ) }, - { "ShockResistance", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockResistance ) }, - { "ShockMaxYaw", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxYaw ) }, - { "ShockMaxPitch", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxPitch ) }, - { "ShockMaxRoll", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxRoll ) }, + { "ShockResistance", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_shockResistance ) }, + { "ShockMaxYaw", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_shockMaxYaw ) }, + { "ShockMaxPitch", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_shockMaxPitch ) }, + { "ShockMaxRoll", INI::parsePositiveNonZeroReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_shockMaxRoll ) }, - { "ForwardFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_forwardFriction ) }, - { "LateralFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_lateralFriction ) }, - { "ZFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_ZFriction ) }, - { "AerodynamicFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_aerodynamicFriction ) }, + { "ForwardFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_forwardFriction ) }, + { "LateralFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_lateralFriction ) }, + { "ZFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_ZFriction ) }, + { "AerodynamicFriction", parseFrictionPerSec, nullptr, offsetof( PhysicsBehaviorModuleData, m_aerodynamicFriction ) }, - { "CenterOfMassOffset", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_centerOfMassOffset ) }, - { "AllowBouncing", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_allowBouncing ) }, - { "AllowCollideForce", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_allowCollideForce ) }, - { "KillWhenRestingOnGround", INI::parseBool, NULL, offsetof( PhysicsBehaviorModuleData, m_killWhenRestingOnGround) }, + { "CenterOfMassOffset", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_centerOfMassOffset ) }, + { "AllowBouncing", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_allowBouncing ) }, + { "AllowCollideForce", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_allowCollideForce ) }, + { "KillWhenRestingOnGround", INI::parseBool, nullptr, offsetof( PhysicsBehaviorModuleData, m_killWhenRestingOnGround) }, - { "MinFallHeightForDamage", parseHeightToSpeed, NULL, offsetof( PhysicsBehaviorModuleData, m_minFallSpeedForDamage) }, - { "FallHeightDamageFactor", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_fallHeightDamageFactor) }, - { "PitchRollYawFactor", INI::parseReal, NULL, offsetof( PhysicsBehaviorModuleData, m_pitchRollYawFactor) }, + { "MinFallHeightForDamage", parseHeightToSpeed, nullptr, offsetof( PhysicsBehaviorModuleData, m_minFallSpeedForDamage) }, + { "FallHeightDamageFactor", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_fallHeightDamageFactor) }, + { "PitchRollYawFactor", INI::parseReal, nullptr, offsetof( PhysicsBehaviorModuleData, m_pitchRollYawFactor) }, - { "VehicleCrashesIntoBuildingWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoBuildingWeaponTemplate) }, - { "VehicleCrashesIntoNonBuildingWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoNonBuildingWeaponTemplate) }, + { "VehicleCrashesIntoBuildingWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoBuildingWeaponTemplate) }, + { "VehicleCrashesIntoNonBuildingWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof(PhysicsBehaviorModuleData, m_vehicleCrashesIntoNonBuildingWeaponTemplate) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -223,8 +223,8 @@ PhysicsBehavior::PhysicsBehavior( Thing *thing, const ModuleData* moduleData ) : setAllowBouncing(getPhysicsBehaviorModuleData()->m_allowBouncing); setAllowCollideForce(getPhysicsBehaviorModuleData()->m_allowCollideForce); - m_pui = NULL; - m_bounceSound = NULL; + m_pui = nullptr; + m_bounceSound = nullptr; #ifdef SLEEPY_PHYSICS setWakeFrame(getObject(), UPDATE_SLEEP_NONE); @@ -235,15 +235,15 @@ PhysicsBehavior::PhysicsBehavior( Thing *thing, const ModuleData* moduleData ) : static ProjectileUpdateInterface* getPui(Object* obj) { if (!obj->isKindOf(KINDOF_PROJECTILE)) - return NULL; + return nullptr; - ProjectileUpdateInterface* objPui = NULL; + ProjectileUpdateInterface* objPui = nullptr; for (BehaviorModule** u = obj->getBehaviorModules(); *u; ++u) { - if ((objPui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((objPui = (*u)->getProjectileUpdateInterface()) != nullptr) return objPui; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -256,7 +256,7 @@ void PhysicsBehavior::onObjectCreated() PhysicsBehavior::~PhysicsBehavior() { deleteInstance(m_bounceSound); - m_bounceSound = NULL; + m_bounceSound = nullptr; } //------------------------------------------------------------------------------------------------- @@ -597,7 +597,7 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) { if (bounceSound) { - if (m_bounceSound == NULL) + if (m_bounceSound == nullptr) m_bounceSound = newInstance(DynamicAudioEventRTS); m_bounceSound->m_event = *bounceSound; @@ -605,7 +605,7 @@ void PhysicsBehavior::setBounceSound(const AudioEventRTS* bounceSound) else { deleteInstance(m_bounceSound); - m_bounceSound = NULL; + m_bounceSound = nullptr; } } @@ -844,7 +844,7 @@ UpdateSleepTime PhysicsBehavior::update() Coord3D normal; normal.x = normal.y = 0.0f; normal.z = -1.0f; - obj->onCollide(NULL, obj->getPosition(), &normal); + obj->onCollide(nullptr, obj->getPosition(), &normal); // // don't bother trying to remember how far we've fallen; instead, @@ -856,7 +856,7 @@ UpdateSleepTime PhysicsBehavior::update() // Real netSpeed = -activeVelZ - d->m_minFallSpeedForDamage; - if (netSpeed > 0.0f && m_pui == NULL) + if (netSpeed > 0.0f && m_pui == nullptr) { // only apply force if it's a pretty steep fall, so that things // going down hills don't injure themselves (unless the hill is really steep) @@ -998,13 +998,13 @@ Real PhysicsBehavior::getForwardSpeed3D() const //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::isCurrentlyOverlapped(Object *obj) const { - return obj != NULL && obj->getID() == m_currentOverlap; + return obj != nullptr && obj->getID() == m_currentOverlap; } //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::wasPreviouslyOverlapped(Object *obj) const { - return obj != NULL && obj->getID() == m_previousOverlap; + return obj != nullptr && obj->getID() == m_previousOverlap; } //------------------------------------------------------------------------------------------------- @@ -1058,7 +1058,7 @@ void PhysicsBehavior::addOverlap(Object *obj) //------------------------------------------------------------------------------------------------- void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const { - if (that != NULL) + if (that != nullptr) { that->m_vel.add(&m_vel); that->m_velMag = INVALID_VEL_MAG; @@ -1068,7 +1068,7 @@ void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const //------------------------------------------------------------------------------------------------- void PhysicsBehavior::addVelocityTo( const Coord3D *vel) { - if (vel != NULL) + if (vel != nullptr) m_vel.add( vel ); } @@ -1159,7 +1159,7 @@ void PhysicsBehavior::doBounceSound(const Coord3D& prevPos) void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) { //USE_PERF_TIMER(PhysicsBehavioronCollide) - if (m_pui != NULL) + if (m_pui != nullptr) { // projectiles always get a chance to handle their own collisions, and not go thru here if (m_pui->projectileHandleCollision(other)) @@ -1171,7 +1171,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 Object* objContainedBy = obj->getContainedBy(); // Note that other == null means "collide with ground" - if (other == NULL) + if (other == nullptr) { // if we are in a container, tell the container we collided with the ground. // (handy for parachutes.) @@ -1198,7 +1198,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 // ignore collisions with our "ignore" thingie, if any (and vice versa) AIUpdateInterface* ai = obj->getAIUpdateInterface(); - if (ai != NULL && ai->getIgnoredObstacleID() == other->getID()) + if (ai != nullptr && ai->getIgnoredObstacleID() == other->getID()) { /// @todo srj -- what the hell is this code doing here? ack! //Before we return, check for a very special case of an infantry colliding with an unmanned vehicle. @@ -1226,7 +1226,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 } AIUpdateInterface* aiOther = other->getAIUpdateInterface(); - if (aiOther != NULL && aiOther->getIgnoredObstacleID() == obj->getID()) + if (aiOther != nullptr && aiOther->getIgnoredObstacleID() == obj->getID()) { return; } @@ -1338,7 +1338,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 // don't let us intersect buildings. cheat. applying a force won't work // cuz we are usually braking. jam it. Object* objToBounce = obj; - while (objToBounce->getContainedBy() != NULL) + while (objToBounce->getContainedBy() != nullptr) objToBounce = objToBounce->getContainedBy(); Real bounceOutDist = usRadius * 0.1f; @@ -1471,7 +1471,7 @@ Bool PhysicsBehavior::checkForOverlapCollision(Object *other) // grab physics modules if there PhysicsBehavior *crusherPhysics = this; - if( crusherPhysics == NULL ) + if( crusherPhysics == nullptr ) { return false; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp index fcf555c705c..e5d2829b05c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PilotFindVehicleUpdate.cpp @@ -66,10 +66,10 @@ PilotFindVehicleUpdateModuleData::PilotFindVehicleUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_scanRange ) }, - { "MinHealth", INI::parseReal, NULL, offsetof( PilotFindVehicleUpdateModuleData, m_minHealth ) }, - { 0, 0, 0, 0 } + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_scanRange ) }, + { "MinHealth", INI::parseReal, nullptr, offsetof( PilotFindVehicleUpdateModuleData, m_minHealth ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -109,7 +109,7 @@ UpdateSleepTime PilotFindVehicleUpdate::update() const PilotFindVehicleUpdateModuleData *data = getPilotFindVehicleUpdateModuleData(); AIUpdateInterface *ai = obj->getAI(); - if (ai==NULL) return UPDATE_SLEEP_FOREVER; + if (ai==nullptr) return UPDATE_SLEEP_FOREVER; if( !ai->isIdle() ) { @@ -149,7 +149,7 @@ Object* PilotFindVehicleUpdate::scanClosestTarget() filters[1] = &aliveFilter; filters[2] = &playerFilter; filters[3] = &filterMapStatus; - filters[4] = NULL; + filters[4] = nullptr; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( me->getPosition(), data->m_scanRange, FROM_CENTER_2D, filters, ITER_SORTED_NEAR_TO_FAR ); @@ -178,7 +178,7 @@ Object* PilotFindVehicleUpdate::scanClosestTarget() } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp index e1424a2da39..e413820208c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp @@ -51,7 +51,7 @@ //------------------------------------------------------------------------------------------------- PointDefenseLaserUpdateModuleData::PointDefenseLaserUpdateModuleData() { - m_weaponTemplate = NULL; + m_weaponTemplate = nullptr; m_scanFrames = 0; m_scanRange = 0.0f; m_velocityFactor = 0.0f; @@ -64,13 +64,13 @@ PointDefenseLaserUpdateModuleData::PointDefenseLaserUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "WeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_weaponTemplate ) }, - { "PrimaryTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_primaryTargetKindOf ) }, - { "SecondaryTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_secondaryTargetKindOf ) }, - { "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanFrames ) }, - { "ScanRange", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanRange ) }, - { "PredictTargetVelocityFactor", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) }, - { 0, 0, 0, 0 } + { "WeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_weaponTemplate ) }, + { "PrimaryTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_primaryTargetKindOf ) }, + { "SecondaryTargetTypes", KindOfMaskType::parseFromINI, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_secondaryTargetKindOf ) }, + { "ScanRate", INI::parseDurationUnsignedInt, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_scanFrames ) }, + { "ScanRange", INI::parseReal, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_scanRange ) }, + { "PredictTargetVelocityFactor", INI::parseReal, nullptr, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -185,7 +185,7 @@ void PointDefenseLaserUpdate::fireWhenReady() { scanClosestTarget(); m_nextScanFrames = data->m_scanFrames; - target = NULL; //Set target to NULL so we don't shoot at it (might be out of range) + target = nullptr; //Set target to nullptr so we don't shoot at it (might be out of range) } } else @@ -242,8 +242,8 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() { const PointDefenseLaserUpdateModuleData *data = getPointDefenseLaserUpdateModuleData(); Object *me = getObject(); - Object *bestTargetOutOfRange[2] = { NULL, NULL }; - Object *bestTargetInRange[2] = { NULL, NULL }; + Object *bestTargetOutOfRange[2] = { nullptr, nullptr }; + Object *bestTargetInRange[2] = { nullptr, nullptr }; Real closestDist[2]; Real closestOutsideRange[2]; Int index; @@ -365,7 +365,7 @@ Object* PointDefenseLaserUpdate::scanClosestTarget() //Utter failure -- nothing on the scope. m_bestTargetID = INVALID_ID; m_inRange = false; - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp index f7748360caa..f931c039f17 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp @@ -111,7 +111,7 @@ void QueueProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoorType PhysicsBehavior *newObjectPhysics = newObj->getPhysics(); PhysicsBehavior *myPhysics = creationObject->getPhysics(); - if( (myPhysics != NULL) && creationInAir && (newObjectPhysics != NULL) ) + if( (myPhysics != nullptr) && creationInAir && (newObjectPhysics != nullptr) ) { Coord3D startingForce = *myPhysics->getVelocity(); startingForce.x *= newObjectPhysics->getMass(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp index 469155cbe7d..e6d782d2597 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp @@ -146,7 +146,7 @@ void SpawnPointProductionExitUpdate::initializeBonePositions() Drawable *myDrawable = me->getDrawable(); // This fundamental failure will result in this never ever thinking it is free - if( myDrawable == NULL ) + if( myDrawable == nullptr ) return; Matrix3D boneTransforms[MAX_SPAWN_POINTS]; @@ -156,13 +156,13 @@ void SpawnPointProductionExitUpdate::initializeBonePositions() // Get all the bones of the right name const SpawnPointProductionExitUpdateModuleData* md = getSpawnPointProductionExitUpdateModuleData(); - m_spawnPointCount = myDrawable->getPristineBonePositions( md->m_spawnPointBoneNameData.str(), 1, NULL, boneTransforms, MAX_SPAWN_POINTS ); + m_spawnPointCount = myDrawable->getPristineBonePositions( md->m_spawnPointBoneNameData.str(), 1, nullptr, boneTransforms, MAX_SPAWN_POINTS ); for( matrixIndex = 0; matrixIndex < m_spawnPointCount; matrixIndex++ ) { Matrix3D *currentTransform = &(boneTransforms[matrixIndex]); // Convert their matrix one by one - me->convertBonePosToWorldPos( NULL, currentTransform, NULL, currentTransform ); + me->convertBonePosToWorldPos( nullptr, currentTransform, nullptr, currentTransform ); // Then save the world coord and angle m_worldCoordSpawnPoints[matrixIndex].x = currentTransform->Get_X_Translation(); @@ -183,7 +183,7 @@ void SpawnPointProductionExitUpdate::revalidateOccupiers() if( m_spawnPointOccupier[positionIndex] == INVALID_ID ) continue; - if( TheGameLogic->findObjectByID( m_spawnPointOccupier[positionIndex] ) == NULL ) + if( TheGameLogic->findObjectByID( m_spawnPointOccupier[positionIndex] ) == nullptr ) m_spawnPointOccupier[positionIndex] = INVALID_ID; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 9eb841a70bf..94aaed79b24 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -127,15 +127,15 @@ ProductionUpdateModuleData::ProductionUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "MaxQueueEntries", INI::parseInt, NULL, offsetof( ProductionUpdateModuleData, m_maxQueueEntries ) }, - { "NumDoorAnimations", INI::parseInt, NULL, offsetof( ProductionUpdateModuleData, m_numDoorAnimations ) }, - { "DoorOpeningTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorOpeningTime ) }, - { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorWaitOpenTime ) }, - { "DoorCloseTime", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_doorClosingTime ) }, - { "ConstructionCompleteDuration", INI::parseDurationUnsignedInt, NULL, offsetof( ProductionUpdateModuleData, m_constructionCompleteDuration ) }, - { "QuantityModifier", parseAppendQuantityModifier, NULL, offsetof( ProductionUpdateModuleData, m_quantityModifiers ) }, - { "DisabledTypesToProcess", DisabledMaskType::parseFromINI, NULL, offsetof( ProductionUpdateModuleData, m_disabledTypesToProcess ) }, - { 0, 0, 0, 0 } + { "MaxQueueEntries", INI::parseInt, nullptr, offsetof( ProductionUpdateModuleData, m_maxQueueEntries ) }, + { "NumDoorAnimations", INI::parseInt, nullptr, offsetof( ProductionUpdateModuleData, m_numDoorAnimations ) }, + { "DoorOpeningTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorOpeningTime ) }, + { "DoorWaitOpenTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorWaitOpenTime ) }, + { "DoorCloseTime", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_doorClosingTime ) }, + { "ConstructionCompleteDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( ProductionUpdateModuleData, m_constructionCompleteDuration ) }, + { "QuantityModifier", parseAppendQuantityModifier, nullptr, offsetof( ProductionUpdateModuleData, m_quantityModifiers ) }, + { "DisabledTypesToProcess", DisabledMaskType::parseFromINI, nullptr, offsetof( ProductionUpdateModuleData, m_disabledTypesToProcess ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -151,13 +151,13 @@ ProductionEntry::ProductionEntry( void ) { m_type = PRODUCTION_INVALID; - m_objectToProduce = NULL; - m_upgradeToResearch = NULL; + m_objectToProduce = nullptr; + m_upgradeToResearch = nullptr; m_productionID = (ProductionID)1; m_percentComplete = 0.0f; m_framesUnderConstruction = 0; - m_next = NULL; - m_prev = NULL; + m_next = nullptr; + m_prev = nullptr; m_productionQuantityProduced = 0; m_productionQuantityTotal = 0; } @@ -179,8 +179,8 @@ ProductionUpdate::ProductionUpdate( Thing *thing, const ModuleData* moduleData ) UpdateModule( thing, moduleData ) { - m_productionQueue = NULL; - m_productionQueueTail = NULL; + m_productionQueue = nullptr; + m_productionQueueTail = nullptr; m_productionCount = 0; m_uniqueID = (ProductionID)1; for (Int i = 0; i < DOOR_COUNT_MAX; ++i) @@ -194,7 +194,7 @@ ProductionUpdate::ProductionUpdate( Thing *thing, const ModuleData* moduleData ) m_clearFlags.clear(); m_setFlags.clear(); m_flagsDirty = FALSE; - m_specialPowerConstructionCommandButton = NULL; + m_specialPowerConstructionCommandButton = nullptr; } @@ -234,10 +234,10 @@ CanMakeType ProductionUpdate::canQueueCreateUnit( const ThingTemplate *unitType /// @todo srj -- this is horrible, but the "right" way to do it is to move // ProductionUpdate to be part of ParkingPlaceBehavior, which I don't currently // have time for... - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = getObject()->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) { if (pp->shouldReserveDoorWhenQueued(unitType) && !pp->hasAvailableSpaceFor(unitType)) return CANMAKE_PARKING_PLACES_FULL; @@ -258,7 +258,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return FALSE; // get the player @@ -327,7 +327,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) { // sanity - if( upgrade == NULL ) + if( upgrade == nullptr ) return; // get the player @@ -352,7 +352,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) } // sanity, entry not found - if( production == NULL ) + if( production == nullptr ) return; // refund money back to the player @@ -391,17 +391,17 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio /// @todo srj -- this is horrible, but the "right" way to do it is to move // ProductionUpdate to be part of ParkingPlaceBehavior, which I don't currently // have time for... - ParkingPlaceBehaviorInterface* pp = NULL; + ParkingPlaceBehaviorInterface* pp = nullptr; for (BehaviorModule** i = getObject()->getBehaviorModules(); *i; ++i) { - if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != NULL) + if ((pp = (*i)->getParkingPlaceBehaviorInterface()) != nullptr) { if (pp->shouldReserveDoorWhenQueued(unitType)) { ExitInterface* exitInterface = getObject()->getObjectExitInterface(); if (exitInterface) { - exitDoor = exitInterface->reserveDoorForExit(unitType, NULL); + exitDoor = exitInterface->reserveDoorForExit(unitType, nullptr); } if (exitDoor == DOOR_NONE_AVAILABLE) { @@ -652,7 +652,7 @@ UpdateSleepTime ProductionUpdate::update( void ) } // if nothing in the queue get outta here - if( production == NULL ) + if( production == nullptr ) return UPDATE_SLEEP_NONE; // @@ -669,7 +669,7 @@ UpdateSleepTime ProductionUpdate::update( void ) Player *player = us->getControllingPlayer(); // sanity - if( player == NULL ) + if( player == nullptr ) { // remove from queue list @@ -743,14 +743,14 @@ UpdateSleepTime ProductionUpdate::update( void ) ExitDoorType exitDoor = production->getExitDoor(); if (exitDoor == DOOR_NONE_AVAILABLE) { - exitDoor = exitInterface->reserveDoorForExit(production->m_objectToProduce, NULL); + exitDoor = exitInterface->reserveDoorForExit(production->m_objectToProduce, nullptr); production->setExitDoor(exitDoor); } if (exitDoor != DOOR_NONE_AVAILABLE) { // note, could be DOOR_NONE_NEEDED! so door could be null. (srj) - DoorInfo* door = (exitDoor >= 0 && exitDoor < DOOR_COUNT_MAX) ? &m_doors[exitDoor] : NULL; + DoorInfo* door = (exitDoor >= 0 && exitDoor < DOOR_COUNT_MAX) ? &m_doors[exitDoor] : nullptr; // // if the producing structure has a door opening animation we will set the condition @@ -758,7 +758,7 @@ UpdateSleepTime ProductionUpdate::update( void ) // that had us previously closing a door) // const ProductionUpdateModuleData *d = getProductionUpdateModuleData(); - if( d->m_numDoorAnimations > 0 && door != NULL ) + if( d->m_numDoorAnimations > 0 && door != nullptr ) { // if the door is closed, open it @@ -810,7 +810,7 @@ UpdateSleepTime ProductionUpdate::update( void ) // animations we will not make the object until the door has been totally // opened // - if( d->m_numDoorAnimations == 0 || door == NULL || door->m_doorWaitOpenFrame != 0 ) + if( d->m_numDoorAnimations == 0 || door == nullptr || door->m_doorWaitOpenFrame != 0 ) { Object *newObj = TheThingFactory->newObject( production->m_objectToProduce, creationBuilding->getControllingPlayer()->getDefaultTeam() ); @@ -950,7 +950,7 @@ UpdateSleepTime ProductionUpdate::update( void ) //Also mark the UI dirty -- incase object with upgrade cameo is selected. Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - Object *selectedObject = draw ? draw->getObject() : NULL; + Object *selectedObject = draw ? draw->getObject() : nullptr; if( selectedObject ) { const ThingTemplate *thing = selectedObject->getTemplate(); @@ -987,7 +987,7 @@ void ProductionUpdate::addToProductionQueue( ProductionEntry *production ) { // check for empty list - if( m_productionQueue == NULL ) + if( m_productionQueue == nullptr ) m_productionQueue = production; // make any existing tail pointer now point to us, and we point back to them @@ -1182,11 +1182,11 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) { // sanity - if( obj == NULL ) - return NULL; + if( obj == nullptr ) + return nullptr; BehaviorModule **bmi; - ProductionUpdateInterface *pui = NULL; + ProductionUpdateInterface *pui = nullptr; for( bmi = obj->getBehaviorModules(); *bmi; ++bmi ) { @@ -1197,7 +1197,7 @@ void ProductionUpdate::setHoldDoorOpen(ExitDoorType exitDoor, Bool holdIt) } // interface not found - return NULL; + return nullptr; } @@ -1281,7 +1281,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) AsciiString name; // the queue should be emtpy now - if( m_productionQueue != NULL ) + if( m_productionQueue != nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - m_productionQueue is not empty, but should be" )); @@ -1297,7 +1297,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) production = newInstance(ProductionEntry); // tie to list at end - if( m_productionQueue == NULL ) + if( m_productionQueue == nullptr ) m_productionQueue = production; // make any existing tail pointer now point to us, and we point back to them @@ -1321,7 +1321,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) { production->m_objectToProduce = TheThingFactory->findTemplate( name ); - if( production->m_objectToProduce == NULL ) + if( production->m_objectToProduce == nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find template '%s'", name.str() )); @@ -1334,7 +1334,7 @@ void ProductionUpdate::xfer( Xfer *xfer ) { production->m_upgradeToResearch = TheUpgradeCenter->findUpgrade( name ); - if( production->m_upgradeToResearch == NULL ) + if( production->m_upgradeToResearch == nullptr ) { DEBUG_CRASH(( "ProductionUpdate::xfer - Cannot find upgrade '%s'", name.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp index 96bb28994cd..d5d172169a7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp @@ -100,7 +100,7 @@ void ProjectileStreamUpdate::addProjectile( ObjectID sourceID, ObjectID newID, O // Clear position so we know we are an object shot m_targetPosition.zero(); } - else if( victimPos != NULL ) + else if( victimPos != nullptr ) { if( ! (m_targetPosition == (*victimPos)) ) { @@ -128,7 +128,7 @@ void ProjectileStreamUpdate::addProjectile( ObjectID sourceID, ObjectID newID, O void ProjectileStreamUpdate::cullFrontOfList() { - while( (m_firstValidIndex != m_nextFreeIndex) && (TheGameLogic->findObjectByID( m_projectileIDs[m_firstValidIndex] ) == NULL) ) + while( (m_firstValidIndex != m_nextFreeIndex) && (TheGameLogic->findObjectByID( m_projectileIDs[m_firstValidIndex] ) == nullptr) ) { // Chew off the front if they are gone. Don't chew on the middle, as bad ones there are just a break in the chain m_firstValidIndex = (m_firstValidIndex + 1) % MAX_PROJECTILE_STREAM; @@ -140,7 +140,7 @@ Bool ProjectileStreamUpdate::considerDying() if( m_firstValidIndex == m_nextFreeIndex && m_owningObject != INVALID_ID ) { //If I have no projectiles to watch, and my master is dead, then yes, I want to die - if( TheGameLogic->findObjectByID(m_owningObject) == NULL ) + if( TheGameLogic->findObjectByID(m_owningObject) == nullptr ) return TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp index 78d66c09640..55c95ddcedd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp @@ -53,8 +53,8 @@ ProneUpdateModuleData::ProneUpdateModuleData() : static const FieldParse dataFieldParse[] = { - { "DamageToFramesRatio", INI::parseReal, NULL, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) }, - { 0, 0, 0, 0 } + { "DamageToFramesRatio", INI::parseReal, nullptr, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp index eed6fa5f8b6..40412b44e4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp @@ -182,7 +182,7 @@ UpdateSleepTime SlavedUpdate::update( void ) //Get my master's AI. If he is attacking something, grant him a range bonus, //and I'll fly over the target. - Object *target = NULL; + Object *target = nullptr; AIUpdateInterface *masterAI = master->getAIUpdateInterface(); if( masterAI ) { @@ -628,7 +628,7 @@ void SlavedUpdate::setRepairState( RepairStates repairState ) { Coord3D pos; //Get the bone position - if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, NULL, 1 ) ) + if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, nullptr, 1 ) ) { pos.add( obj->getPosition() ); } @@ -704,7 +704,7 @@ void SlavedUpdate::moveToNewRepairSpot() //------------------------------------------------------------------------------------------------- void SlavedUpdate::startSlavedEffects( const Object *slaver ) { - if( slaver == NULL ) + if( slaver == nullptr ) return; m_slaver = slaver->getID(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 0d87c22f891..ebd65ef708e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -257,7 +257,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) { Object* target = TheGameLogic->findObjectByID(m_targetID); - if (target != NULL) + if (target != nullptr) { if (target->isEffectivelyDead()) shouldAbort = TRUE; @@ -321,7 +321,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) SpecialPowerModuleInterface *spm = getMySPM(); - if ( shouldAbort || spm == NULL ) + if ( shouldAbort || spm == nullptr ) { // doh, a colleague has already captured it. just stop. ai->aiIdle( CMD_FROM_AI ); @@ -828,7 +828,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const } Real fDistSquared = 0.0f; - Object *target = NULL; + Object *target = nullptr; if( m_targetID != INVALID_ID ) { target = TheGameLogic->findObjectByID( m_targetID ); @@ -870,7 +870,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const { //Make sure we can see the target! PartitionFilterLineOfSight filterLOS( self ); - PartitionFilter *filters[] = { &filterLOS, NULL }; + PartitionFilter *filters[] = { &filterLOS, nullptr }; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( self, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR ); MemoryPoolObjectHolder hold(iter); for( Object *theTarget = iter->first(); theTarget; theTarget = iter->next() ) @@ -903,7 +903,7 @@ Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const range = __max( 0.0f, range - UNDERSIZE ); Real fDistSquared = 0.0f; - Object *target = NULL; + Object *target = nullptr; if( m_targetID != INVALID_ID ) { target = TheGameLogic->findObjectByID( m_targetID ); @@ -1080,7 +1080,7 @@ void SpecialAbilityUpdate::startPreparation() SpecialPowerModuleInterface *spmInterface = getMySPM(); if( spmInterface ) { - spmInterface->markSpecialPowerTriggered(NULL);// Null for not creating a view object + spmInterface->markSpecialPowerTriggered(nullptr);// Null for not creating a view object } if (getObject()->getAI()) { @@ -1120,7 +1120,7 @@ Bool SpecialAbilityUpdate::initLaser(Object* specialObject, Object* target ) } Coord3D startPos; - if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, NULL ) ) + if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, nullptr ) ) { //If we can't find the bone, then set it to our current position. startPos.set( getObject()->getPosition() ); @@ -1621,7 +1621,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() Object* SpecialAbilityUpdate::createSpecialObject() { const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - Object *specialObject = NULL; + Object *specialObject = nullptr; if( m_specialObjectEntries == data->m_maxSpecialObjects ) { @@ -1631,7 +1631,7 @@ Object* SpecialAbilityUpdate::createSpecialObject() //limit we can have, then don't allow any more to be created.... //We could add recycling code if need be.. but the logic that handles //canDoSpecialPowerXXX should prevent this triggering. - return NULL; + return nullptr; } else { @@ -1792,7 +1792,7 @@ void SpecialAbilityUpdate::finishAbility() if (contPlayer) { PartitionFilterSamePlayer filterPlayer( contPlayer ); // Look for our own mines. PartitionFilterAcceptByKindOf filterKind(MAKE_KINDOF_MASK(KINDOF_MINE), KINDOFMASK_NONE); - PartitionFilter *filters[] = { &filterKind, &filterPlayer, NULL }; + PartitionFilter *filters[] = { &filterKind, &filterPlayer, nullptr }; Object *mine = ThePartitionManager->getClosestObject( &pos, data->m_fleeRangeAfterCompletion, FROM_CENTER_2D, filters );// could be null. this is ok. if (mine) { dir.set(pos.x-mine->getPosition()->x, pos.y-mine->getPosition()->y, 0); @@ -1948,7 +1948,7 @@ Object* SpecialAbilityUpdate::findSpecialObjectWithProducerID( const Object *tar } } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp index 8282a29d2fe..efac56d1a54 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp @@ -68,7 +68,7 @@ //------------------------------------------------------------------------------------------------- SpectreGunshipDeploymentUpdateModuleData::SpectreGunshipDeploymentUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; m_extraRequiredScience = SCIENCE_INVALID; /******BOTH*******//*BOTH*//******BOTH*******//******BOTH*******/ m_attackAreaRadius = 200.0f; m_createLoc = CREATE_GUNSHIP_AT_EDGE_FARTHEST_FROM_TARGET; @@ -82,7 +82,7 @@ static const char* const TheGunshipCreateLocTypeNames[] = "CREATE_AT_EDGE_FARTHEST_FROM_SOURCE", "CREATE_AT_EDGE_NEAR_TARGET", "CREATE_AT_EDGE_FARTHEST_FROM_TARGET", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheGunshipCreateLocTypeNames) == GUNSHIP_CREATE_LOC_COUNT + 1, "Wrong array size"); @@ -95,13 +95,13 @@ static Real zero = 0.0f; static const FieldParse dataFieldParse[] = { - { "GunshipTemplateName", INI::parseAsciiString, NULL, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_gunshipTemplateName ) }, - { "RequiredScience", INI::parseScience, NULL, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_extraRequiredScience ) }, -/******BOTH*******/ { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_specialPowerTemplate ) }, -/*******BOTH******/ { "AttackAreaRadius", INI::parseReal, NULL, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_attackAreaRadius ) }, + { "GunshipTemplateName", INI::parseAsciiString, nullptr, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_gunshipTemplateName ) }, + { "RequiredScience", INI::parseScience, nullptr, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_extraRequiredScience ) }, +/******BOTH*******/ { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_specialPowerTemplate ) }, +/*******BOTH******/ { "AttackAreaRadius", INI::parseReal, nullptr, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_attackAreaRadius ) }, { "CreateLocation", INI::parseIndexList, TheGunshipCreateLocTypeNames, offsetof( SpectreGunshipDeploymentUpdateModuleData, m_createLoc ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -109,7 +109,7 @@ static Real zero = 0.0f; //------------------------------------------------------------------------------------------------- SpectreGunshipDeploymentUpdate::SpectreGunshipDeploymentUpdate( Thing *thing, const ModuleData* moduleData ) : SpecialPowerUpdateModule( thing, moduleData ) { - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; m_gunshipID = INVALID_ID; } @@ -162,11 +162,11 @@ Bool SpectreGunshipDeploymentUpdate::initiateIntentToDoSpecialPower(const Specia Object *newGunship = TheGameLogic->findObjectByID( m_gunshipID ); const ThingTemplate *gunshipTemplate = TheThingFactory->findTemplate( data->m_gunshipTemplateName ); - if( newGunship != NULL ) + if( newGunship != nullptr ) { // disengageAndDepartAO( newGunship ); m_gunshipID = INVALID_ID; - newGunship = NULL; + newGunship = nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp index 201a1580eb2..17de4f00054 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp @@ -80,10 +80,10 @@ //------------------------------------------------------------------------------------------------- SpectreGunshipUpdateModuleData::SpectreGunshipUpdateModuleData() { - m_specialPowerTemplate = NULL; + m_specialPowerTemplate = nullptr; /******BOTH*******//*BOTH*//******BOTH*******//******BOTH*******/ m_attackAreaRadius = 200.0f; -/*************/ m_gattlingStrafeFXParticleSystem = NULL; -/*************/ m_howitzerWeaponTemplate = NULL; +/*************/ m_gattlingStrafeFXParticleSystem = nullptr; +/*************/ m_howitzerWeaponTemplate = nullptr; /*************/ m_orbitFrames = 0; /*************/ m_targetingReticleRadius = 25.0f; /*************/ m_gunshipOrbitRadius = 250.0f; @@ -102,26 +102,26 @@ static Real zero = 0.0f; static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpectreGunshipUpdateModuleData, m_specialPowerTemplate ) }, - { "GattlingTemplateName", INI::parseAsciiString, NULL, offsetof( SpectreGunshipUpdateModuleData, m_gattlingTemplateName ) }, - { "HowitzerFiringRate", INI::parseDurationUnsignedInt, NULL, offsetof( SpectreGunshipUpdateModuleData, m_howitzerFiringRate ) }, - { "OrbitTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpectreGunshipUpdateModuleData, m_orbitFrames ) }, - { "HowitzerFollowLag", INI::parseDurationUnsignedInt, NULL, offsetof( SpectreGunshipUpdateModuleData, m_howitzerFollowLag ) }, - { "AttackAreaRadius", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_attackAreaRadius ) }, - { "StrafingIncrement", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_strafingIncrement ) }, - { "OrbitInsertionSlope", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_orbitInsertionSlope ) }, - { "RandomOffsetForHowitzer", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_randomOffsetForHowitzer ) }, - { "TargetingReticleRadius", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_targetingReticleRadius ) }, - { "GunshipOrbitRadius", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_gunshipOrbitRadius ) }, - { "HowitzerWeaponTemplate", INI::parseWeaponTemplate, NULL, offsetof( SpectreGunshipUpdateModuleData, m_howitzerWeaponTemplate ) }, - { "GattlingStrafeFXParticleSystem", INI::parseParticleSystemTemplate, NULL, offsetof( SpectreGunshipUpdateModuleData, m_gattlingStrafeFXParticleSystem ) }, - { "AttackAreaDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( SpectreGunshipUpdateModuleData, m_attackAreaDecalTemplate ) }, - { "TargetingReticleDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( SpectreGunshipUpdateModuleData, m_targetingReticleDecalTemplate ) }, - - - - - { 0, 0, 0, 0 } + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_specialPowerTemplate ) }, + { "GattlingTemplateName", INI::parseAsciiString, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_gattlingTemplateName ) }, + { "HowitzerFiringRate", INI::parseDurationUnsignedInt, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_howitzerFiringRate ) }, + { "OrbitTime", INI::parseDurationUnsignedInt, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_orbitFrames ) }, + { "HowitzerFollowLag", INI::parseDurationUnsignedInt, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_howitzerFollowLag ) }, + { "AttackAreaRadius", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_attackAreaRadius ) }, + { "StrafingIncrement", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_strafingIncrement ) }, + { "OrbitInsertionSlope", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_orbitInsertionSlope ) }, + { "RandomOffsetForHowitzer", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_randomOffsetForHowitzer ) }, + { "TargetingReticleRadius", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_targetingReticleRadius ) }, + { "GunshipOrbitRadius", INI::parseReal, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_gunshipOrbitRadius ) }, + { "HowitzerWeaponTemplate", INI::parseWeaponTemplate, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_howitzerWeaponTemplate ) }, + { "GattlingStrafeFXParticleSystem", INI::parseParticleSystemTemplate, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_gattlingStrafeFXParticleSystem ) }, + { "AttackAreaDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_attackAreaDecalTemplate ) }, + { "TargetingReticleDecal", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( SpectreGunshipUpdateModuleData, m_targetingReticleDecalTemplate ) }, + + + + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -129,7 +129,7 @@ static Real zero = 0.0f; //------------------------------------------------------------------------------------------------- SpectreGunshipUpdate::SpectreGunshipUpdate( Thing *thing, const ModuleData* moduleData ) : SpecialPowerUpdateModule( thing, moduleData ) { - m_specialPowerModule = NULL; + m_specialPowerModule = nullptr; m_gattlingID = INVALID_ID; m_status = GUNSHIP_STATUS_IDLE; m_initialTargetPosition.zero(); @@ -235,10 +235,10 @@ Bool SpectreGunshipUpdate::initiateIntentToDoSpecialPower(const SpecialPowerTemp Object *newGattling = TheGameLogic->findObjectByID( m_gattlingID ); const ThingTemplate *gattlingTemplate = TheThingFactory->findTemplate( data->m_gattlingTemplateName ); - if( newGattling != NULL ) + if( newGattling != nullptr ) { m_gattlingID = INVALID_ID; - newGattling = NULL; + newGattling = nullptr; } if ( gattlingTemplate ) { @@ -374,7 +374,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() #endif AIUpdateInterface *shipAI = gunship->getAIUpdateInterface(); - AIUpdateInterface *gattlingAI = NULL; + AIUpdateInterface *gattlingAI = nullptr; Object *gattling = TheGameLogic->findObjectByID( m_gattlingID ); if ( gattling ) @@ -492,7 +492,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() if ( m_status == GUNSHIP_STATUS_ORBITING ) { - Object *validTargetObject = NULL; + Object *validTargetObject = nullptr; if ( TheGameLogic->getFrame() >= m_orbitEscapeFrame ) @@ -524,7 +524,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() filters[numFilters++] = &filterStealth; filters[numFilters++] = &filterAttack; filters[numFilters++] = &filterFogged; - filters[numFilters] = NULL; + filters[numFilters] = nullptr; @@ -781,7 +781,7 @@ void SpectreGunshipUpdate::cleanUp() void SpectreGunshipUpdate::disengageAndDepartAO( Object *gunship ) { - if ( gunship == NULL ) + if ( gunship == nullptr ) return; AIUpdateInterface *shipAI = gunship->getAIUpdateInterface(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp index bd35bb5849a..c56bf519340 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpyVisionUpdate.cpp @@ -189,7 +189,7 @@ UpdateSleepTime SpyVisionUpdate::update( void ) void SpyVisionUpdate::doActivationWork( Player *playerToSetFor, Bool setting ) { const SpyVisionUpdateModuleData *data = getSpyVisionUpdateModuleData(); - if( playerToSetFor == NULL || ThePlayerList == NULL ) + if( playerToSetFor == nullptr || ThePlayerList == nullptr ) return; for (Int i=0; i < ThePlayerList->getPlayerCount(); ++i) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index 15eb2a74ebe..bfb7b2b4975 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -60,22 +60,22 @@ void StealthDetectorUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DetectionRate", INI::parseDurationUnsignedInt, NULL, offsetof( StealthDetectorUpdateModuleData, m_updateRate ) }, - { "DetectionRange", INI::parseReal, NULL, offsetof( StealthDetectorUpdateModuleData, m_detectionRange ) }, - { "InitiallyDisabled", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_initiallyDisabled ) }, - { "PingSound", INI::parseAudioEventRTS, NULL, offsetof( StealthDetectorUpdateModuleData, m_pingSound ) }, - { "LoudPingSound", INI::parseAudioEventRTS, NULL, offsetof( StealthDetectorUpdateModuleData, m_loudPingSound ) }, - { "IRBeaconParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRBeaconParticleSysTmpl ) }, - { "IRParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysTmpl ) }, - { "IRBrightParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRBrightParticleSysTmpl ) }, - { "IRGridParticleSysName", INI::parseParticleSystemTemplate, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRGridParticleSysTmpl ) }, - { "IRParticleSysBone", INI::parseAsciiString, NULL, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysBone ) }, - { "ExtraRequiredKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindof ) }, - { "ExtraForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindofNot ) }, - { "CanDetectWhileGarrisoned", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileGarrisoned ) }, - { "CanDetectWhileContained", INI::parseBool, NULL, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileTransported ) }, - - { 0, 0, 0, 0 } + { "DetectionRate", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthDetectorUpdateModuleData, m_updateRate ) }, + { "DetectionRange", INI::parseReal, nullptr, offsetof( StealthDetectorUpdateModuleData, m_detectionRange ) }, + { "InitiallyDisabled", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_initiallyDisabled ) }, + { "PingSound", INI::parseAudioEventRTS, nullptr, offsetof( StealthDetectorUpdateModuleData, m_pingSound ) }, + { "LoudPingSound", INI::parseAudioEventRTS, nullptr, offsetof( StealthDetectorUpdateModuleData, m_loudPingSound ) }, + { "IRBeaconParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRBeaconParticleSysTmpl ) }, + { "IRParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysTmpl ) }, + { "IRBrightParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRBrightParticleSysTmpl ) }, + { "IRGridParticleSysName", INI::parseParticleSystemTemplate, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRGridParticleSysTmpl ) }, + { "IRParticleSysBone", INI::parseAsciiString, nullptr, offsetof( StealthDetectorUpdateModuleData, m_IRParticleSysBone ) }, + { "ExtraRequiredKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindof ) }, + { "ExtraForbiddenKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( StealthDetectorUpdateModuleData, m_extraDetectKindofNot ) }, + { "CanDetectWhileGarrisoned", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileGarrisoned ) }, + { "CanDetectWhileContained", INI::parseBool, nullptr, offsetof( StealthDetectorUpdateModuleData, m_canDetectWhileTransported ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -187,7 +187,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) PartitionFilterRelationship filterTeam(self, PartitionFilterRelationship::ALLOW_ENEMIES | PartitionFilterRelationship::ALLOW_NEUTRAL ); PartitionFilterAcceptByKindOf filterKindof(data->m_extraDetectKindof, data->m_extraDetectKindofNot); PartitionFilterSameMapStatus filterMapStatus(getObject()); - PartitionFilter* filters[] = { &filterStealthOrStealthGarrisoned, &filterTeam, &filterKindof, &filterMapStatus, NULL }; + PartitionFilter* filters[] = { &filterStealthOrStealthGarrisoned, &filterTeam, &filterKindof, &filterMapStatus, nullptr }; Real visionRange = self->getVisionRange(); if( data->m_detectionRange > 0.0f ) @@ -252,7 +252,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) // If revealing this unit is suppose to cause an Eva event, do it EvaMessage message = stealth->getEnemyDetectionEvaEvent(); - if ( message != EVA_Invalid && TheEva != NULL ) + if ( message != EVA_Invalid && TheEva != nullptr ) { TheEva->setShouldPlay( message ); } @@ -288,7 +288,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) // If revealing this unit is suppose to cause an Eva event, do it EvaMessage message = stealth->getOwnDetectionEvaEvent(); - if ( message != EVA_Invalid && TheEva != NULL ) + if ( message != EVA_Invalid && TheEva != nullptr ) { TheEva->setShouldPlay( message ); } @@ -333,7 +333,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) ContainModuleInterface *contain = them->getContain(); if( contain && contain->isGarrisonable() && contain->getStealthUnitsContained() ) { - Object* rider = NULL; + Object* rider = nullptr; for(ContainedItemsList::const_iterator it = contain->getContainedItemsList()->begin(); it != contain->getContainedItemsList()->end(); ++it) { rider = *it; @@ -365,7 +365,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) Drawable *myDraw = self->getDrawable(); Coord3D bonePosition = {-1.66f,5.5f,15}; if (myDraw) - myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, NULL, 1); + myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, nullptr, 1); const ParticleSystemTemplate *pingTemplate; if ( foundSomeone ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index a390bc943f5..09dc2545abb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -64,8 +64,8 @@ StealthUpdateModuleData::StealthUpdateModuleData() { - m_disguiseFX = NULL; - m_disguiseRevealFX = NULL; + m_disguiseFX = nullptr; + m_disguiseRevealFX = nullptr; m_stealthDelay = UINT_MAX; m_stealthLevel = 0; m_stealthSpeed = 0.0f; @@ -92,30 +92,30 @@ void StealthUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "StealthDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_stealthDelay ) }, - { "MoveThresholdSpeed", INI::parseVelocityReal, NULL, offsetof( StealthUpdateModuleData, m_stealthSpeed ) }, + { "StealthDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_stealthDelay ) }, + { "MoveThresholdSpeed", INI::parseVelocityReal, nullptr, offsetof( StealthUpdateModuleData, m_stealthSpeed ) }, { "StealthForbiddenConditions", INI::parseBitString32, TheStealthLevelNames, offsetof( StealthUpdateModuleData, m_stealthLevel) }, - { "HintDetectableConditions", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StealthUpdateModuleData, m_hintDetectableStates) }, - { "RequiredStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StealthUpdateModuleData, m_requiredStatus ) }, - { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StealthUpdateModuleData, m_forbiddenStatus ) }, - { "FriendlyOpacityMin", INI::parsePercentToReal, NULL, offsetof( StealthUpdateModuleData, m_friendlyOpacityMin ) }, - { "FriendlyOpacityMax", INI::parsePercentToReal, NULL, offsetof( StealthUpdateModuleData, m_friendlyOpacityMax ) }, - { "PulseFrequency", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_pulseFrames ) }, - { "DisguisesAsTeam", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_teamDisguised ) }, - { "RevealDistanceFromTarget", INI::parseReal, NULL, offsetof( StealthUpdateModuleData, m_revealDistanceFromTarget ) }, - { "OrderIdleEnemiesToAttackMeUponReveal", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_orderIdleEnemiesToAttackMeUponReveal ) }, - { "DisguiseFX", INI::parseFXList, NULL, offsetof( StealthUpdateModuleData, m_disguiseFX ) }, - { "DisguiseRevealFX", INI::parseFXList, NULL, offsetof( StealthUpdateModuleData, m_disguiseRevealFX ) }, - { "DisguiseTransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_disguiseTransitionFrames ) }, - { "DisguiseRevealTransitionTime", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_disguiseRevealTransitionFrames ) }, - { "InnateStealth", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_innateStealth ) }, - { "UseRiderStealth", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_useRiderStealth ) }, - { "EnemyDetectionEvaEvent", Eva::parseEvaMessageFromIni, NULL, offsetof( StealthUpdateModuleData, m_enemyDetectionEvaEvent ) }, - { "OwnDetectionEvaEvent", Eva::parseEvaMessageFromIni, NULL, offsetof( StealthUpdateModuleData, m_ownDetectionEvaEvent ) }, - { "BlackMarketCheckDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StealthUpdateModuleData, m_blackMarketCheckFrames ) }, - { "GrantedBySpecialPower", INI::parseBool, NULL, offsetof( StealthUpdateModuleData, m_grantedBySpecialPower ) }, - - { 0, 0, 0, 0 } + { "HintDetectableConditions", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StealthUpdateModuleData, m_hintDetectableStates) }, + { "RequiredStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StealthUpdateModuleData, m_requiredStatus ) }, + { "ForbiddenStatus", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StealthUpdateModuleData, m_forbiddenStatus ) }, + { "FriendlyOpacityMin", INI::parsePercentToReal, nullptr, offsetof( StealthUpdateModuleData, m_friendlyOpacityMin ) }, + { "FriendlyOpacityMax", INI::parsePercentToReal, nullptr, offsetof( StealthUpdateModuleData, m_friendlyOpacityMax ) }, + { "PulseFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_pulseFrames ) }, + { "DisguisesAsTeam", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_teamDisguised ) }, + { "RevealDistanceFromTarget", INI::parseReal, nullptr, offsetof( StealthUpdateModuleData, m_revealDistanceFromTarget ) }, + { "OrderIdleEnemiesToAttackMeUponReveal", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_orderIdleEnemiesToAttackMeUponReveal ) }, + { "DisguiseFX", INI::parseFXList, nullptr, offsetof( StealthUpdateModuleData, m_disguiseFX ) }, + { "DisguiseRevealFX", INI::parseFXList, nullptr, offsetof( StealthUpdateModuleData, m_disguiseRevealFX ) }, + { "DisguiseTransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_disguiseTransitionFrames ) }, + { "DisguiseRevealTransitionTime", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_disguiseRevealTransitionFrames ) }, + { "InnateStealth", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_innateStealth ) }, + { "UseRiderStealth", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_useRiderStealth ) }, + { "EnemyDetectionEvaEvent", Eva::parseEvaMessageFromIni, nullptr, offsetof( StealthUpdateModuleData, m_enemyDetectionEvaEvent ) }, + { "OwnDetectionEvaEvent", Eva::parseEvaMessageFromIni, nullptr, offsetof( StealthUpdateModuleData, m_ownDetectionEvaEvent ) }, + { "BlackMarketCheckDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StealthUpdateModuleData, m_blackMarketCheckFrames ) }, + { "GrantedBySpecialPower", INI::parseBool, nullptr, offsetof( StealthUpdateModuleData, m_grantedBySpecialPower ) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -135,7 +135,7 @@ StealthUpdate::StealthUpdate( Thing *thing, const ModuleData* moduleData ) : Upd m_pulsePhase = GameClientRandomValueReal(0, PI); m_disguiseAsPlayerIndex = -1; - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; m_transitioningToDisguise = false; m_disguised = false; m_disguiseTransitionFrames = 0; @@ -192,7 +192,7 @@ void isBlackMarket( Object *obj, void *userData ) void StealthUpdate::receiveGrant( Bool active, UnsignedInt frames ) { Object *obj = getObject(); - if ( obj == NULL ) + if ( obj == nullptr ) return; if (this->canDisguise()) @@ -403,7 +403,7 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const const PhysicsBehavior *physics = self->getPhysics(); - if ((flags & STEALTH_NOT_WHILE_MOVING) && physics != NULL && + if ((flags & STEALTH_NOT_WHILE_MOVING) && physics != nullptr && physics->getVelocityMagnitude() > getStealthUpdateModuleData()->m_stealthSpeed) return FALSE; @@ -894,7 +894,7 @@ void StealthUpdate::markAsDetected(UnsignedInt numFrames) //If we are disguised, remove the disguise permanently! if( isDisguised() ) { - disguiseAsObject( NULL ); + disguiseAsObject( nullptr ); } UnsignedInt now = TheGameLogic->getFrame(); @@ -961,7 +961,7 @@ void StealthUpdate::disguiseAsObject( const Object *target ) } else if( m_disguised ) { - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; m_disguiseAsPlayerIndex = 0; m_disguiseTransitionFrames = data->m_disguiseRevealTransitionFrames; m_transitioningToDisguise = false; //Means we are losing the disguise over time. @@ -1169,12 +1169,12 @@ void StealthUpdate::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_LOAD ) { - m_disguiseAsTemplate = NULL; + m_disguiseAsTemplate = nullptr; if( name.isEmpty() == FALSE ) { m_disguiseAsTemplate = TheThingFactory->findTemplate( name ); - if( m_disguiseAsTemplate == NULL ) + if( m_disguiseAsTemplate == nullptr ) { DEBUG_CRASH(( "StealthUpdate::xfer - Unknown template '%s'", name.str() )); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index a94c348d04b..7a69872664c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -84,7 +84,7 @@ void StickyBombUpdate::onObjectCreated() Object *target = ai->getGoalObject(); if( target ) { - initStickyBomb( target, NULL); + initStickyBomb( target, nullptr); } } } @@ -259,7 +259,7 @@ void StickyBombUpdate::detonate() damageInfo.in.m_sourcePlayerMask = getObject()->getControllingPlayer()->getPlayerMask(); damageInfo.in.m_damageStatusType = data->m_geometryBasedDamageWeaponTemplate->getDamageStatusType(); - for (; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for (; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { damageInfo.in.m_amount = (curVictimDistSqr <= primaryDamageRangeSqr) ? primaryDamage : secondaryDamage; curVictim->attemptDamage(&damageInfo); @@ -268,7 +268,7 @@ void StickyBombUpdate::detonate() if( data->m_geometryBasedDamageFX ) { // And we make FX based on that size too. - FXList::doFXPos(data->m_geometryBasedDamageFX, boobyTrappedObject->getPosition(), NULL, 0, NULL, secondaryDamageRange); + FXList::doFXPos(data->m_geometryBasedDamageFX, boobyTrappedObject->getPosition(), nullptr, 0, nullptr, secondaryDamageRange); } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp index 11128be257d..b498bd5221f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureCollapseUpdate.cpp @@ -57,7 +57,7 @@ static const char *const TheStructureCollapsePhaseNames[] = "BURST", "FINAL", - NULL + nullptr }; static_assert(ARRAY_SIZE(TheStructureCollapsePhaseNames) == SC_PHASE_COUNT + 1, "Wrong array size"); @@ -84,7 +84,7 @@ static void parseFX( INI* ini, void *instance, void * /*store*/, const void* /*u { StructureCollapseUpdateModuleData* self = (StructureCollapseUpdateModuleData*)instance; StructureCollapsePhaseType scphase = (StructureCollapsePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureCollapsePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const FXList *fxl = TheFXListStore->findFXList((token)); // could be null! this is OK! self->m_fxs[scphase].push_back(fxl); @@ -96,7 +96,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { StructureCollapseUpdateModuleData* self = (StructureCollapseUpdateModuleData*)instance; StructureCollapsePhaseType stphase = (StructureCollapsePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureCollapsePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[stphase].push_back(ocl); @@ -110,16 +110,16 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* static const FieldParse dataFieldParse[] = { - { "MinCollapseDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_minCollapseDelay ) }, - { "MaxCollapseDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxCollapseDelay ) }, - { "MinBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_minBurstDelay ) }, - { "MaxBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxBurstDelay ) }, - { "CollapseDamping", INI::parseReal, NULL, offsetof( StructureCollapseUpdateModuleData, m_collapseDamping ) }, - { "MaxShudder", INI::parseReal, NULL, offsetof( StructureCollapseUpdateModuleData, m_maxShudder ) }, - { "BigBurstFrequency", INI::parseInt, NULL, offsetof( StructureCollapseUpdateModuleData, m_bigBurstFrequency ) }, - { "OCL", parseOCL, NULL, 0 }, - { "FXList", parseFX, NULL, 0 }, - { 0, 0, 0, 0 } + { "MinCollapseDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_minCollapseDelay ) }, + { "MaxCollapseDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxCollapseDelay ) }, + { "MinBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_minBurstDelay ) }, + { "MaxBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxBurstDelay ) }, + { "CollapseDamping", INI::parseReal, nullptr, offsetof( StructureCollapseUpdateModuleData, m_collapseDamping ) }, + { "MaxShudder", INI::parseReal, nullptr, offsetof( StructureCollapseUpdateModuleData, m_maxShudder ) }, + { "BigBurstFrequency", INI::parseInt, nullptr, offsetof( StructureCollapseUpdateModuleData, m_bigBurstFrequency ) }, + { "OCL", parseOCL, nullptr, 0 }, + { "FXList", parseFX, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( StructureCollapseUpdateModuleData, m_dieMuxData )); @@ -333,7 +333,7 @@ void StructureCollapseUpdate::doPhaseStuff(StructureCollapsePhaseType scphase, c const OCLVec& v = d->m_ocls[scphase]; DEBUG_ASSERTCRASH(idx>=0&&idxgetOrientation() ); + ObjectCreationList::create(ocl, getObject(), target, nullptr, getObject()->getOrientation() ); } } } @@ -344,7 +344,7 @@ void StructureCollapseUpdate::doCollapseDoneStuff() { static NameKeyType key_BoneFXUpdate = NAMEKEY("BoneFXUpdate"); BoneFXUpdate *bfxu = (BoneFXUpdate *)getObject()->findUpdateModule(key_BoneFXUpdate); - if (bfxu != NULL) + if (bfxu != nullptr) { bfxu->stopAllBoneFX(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index 005fa4a8afa..d3609537bfd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -83,7 +83,7 @@ static void parseOCL( INI* ini, void *instance, void * /*store*/, const void* /* { StructureToppleUpdateModuleData* self = (StructureToppleUpdateModuleData*)instance; StructureTopplePhaseType stphase = (StructureTopplePhaseType)INI::scanIndexList(ini->getNextToken(), TheStructureTopplePhaseNames); - for (const char* token = ini->getNextToken(); token != NULL; token = ini->getNextTokenOrNull()) + for (const char* token = ini->getNextToken(); token != nullptr; token = ini->getNextTokenOrNull()) { const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! this is OK! self->m_ocls[stphase].push_back(ocl); @@ -95,9 +95,9 @@ static void parseAngleFX(INI* ini, void *instance, void * /* store */, const voi { StructureToppleUpdateModuleData* self = (StructureToppleUpdateModuleData*)instance; AngleFXInfo info; - INI::parseReal(ini, instance, &(info.angle), NULL); + INI::parseReal(ini, instance, &(info.angle), nullptr); info.angle = info.angle * PI / 180.0f; // convert from degrees to radians. - INI::parseFXList(ini, instance, &(info.fxList), NULL); + INI::parseFXList(ini, instance, &(info.fxList), nullptr); self->angleFX.push_back(info); } @@ -108,22 +108,22 @@ static void parseAngleFX(INI* ini, void *instance, void * /* store */, const voi static const FieldParse dataFieldParse[] = { - { "MinToppleDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_minToppleDelay ) }, - { "MaxToppleDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_maxToppleDelay ) }, - { "MinToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_minToppleBurstDelay ) }, - { "MaxToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_maxToppleBurstDelay ) }, - { "StructuralIntegrity", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralIntegrity ) }, - { "StructuralDecay", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) }, - { "DamageFXTypes", INI::parseDamageTypeFlags, NULL, offsetof( StructureToppleUpdateModuleData, m_damageFXTypes ) }, - { "TopplingFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleFXList ) }, - { "ToppleDelayFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleDelayFXList ) }, - { "ToppleStartFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleStartFXList ) }, - { "ToppleDoneFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleDoneFXList ) }, - { "CrushingFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_crushingFXList ) }, - { "CrushingWeaponName", INI::parseAsciiString, NULL, offsetof( StructureToppleUpdateModuleData, m_crushingWeaponName ) }, - { "OCL", parseOCL, NULL, 0 }, - { "AngleFX", parseAngleFX, NULL, 0 }, - { 0, 0, 0, 0 } + { "MinToppleDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_minToppleDelay ) }, + { "MaxToppleDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_maxToppleDelay ) }, + { "MinToppleBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_minToppleBurstDelay ) }, + { "MaxToppleBurstDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( StructureToppleUpdateModuleData, m_maxToppleBurstDelay ) }, + { "StructuralIntegrity", INI::parseReal, nullptr, offsetof( StructureToppleUpdateModuleData, m_structuralIntegrity ) }, + { "StructuralDecay", INI::parseReal, nullptr, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) }, + { "DamageFXTypes", INI::parseDamageTypeFlags, nullptr, offsetof( StructureToppleUpdateModuleData, m_damageFXTypes ) }, + { "TopplingFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleFXList ) }, + { "ToppleDelayFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleDelayFXList ) }, + { "ToppleStartFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleStartFXList ) }, + { "ToppleDoneFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_toppleDoneFXList ) }, + { "CrushingFX", INI::parseFXList, nullptr, offsetof( StructureToppleUpdateModuleData, m_crushingFXList ) }, + { "CrushingWeaponName", INI::parseAsciiString, nullptr, offsetof( StructureToppleUpdateModuleData, m_crushingWeaponName ) }, + { "OCL", parseOCL, nullptr, 0 }, + { "AngleFX", parseAngleFX, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); p.add(DieMuxData::getFieldParse(), offsetof( StructureToppleUpdateModuleData, m_dieMuxData )); @@ -144,7 +144,7 @@ void StructureToppleUpdate::beginStructureTopple(const DamageInfo *damageInfo) Object *building = getObject(); Real toppleAngle = 0.0; - if (attacker == NULL) { + if (attacker == nullptr) { toppleAngle = GameLogicRandomValueReal(0.0, 2*PI); } else { const Coord3D *attackerPos = attacker->getPosition(); @@ -259,7 +259,7 @@ UpdateSleepTime StructureToppleUpdate::update( void ) applyCrushingDamage(0.0f); doPhaseStuff(STPHASE_FINAL, getObject()->getPosition()); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXObj(d->m_toppleDoneFXList, getObject()); m_toppleFrame = TheGameLogic->getFrame(); @@ -310,7 +310,7 @@ void StructureToppleUpdate::doToppleDoneStuff() { static NameKeyType key_BoneFXUpdate = NAMEKEY("BoneFXUpdate"); BoneFXUpdate *bfxu = (BoneFXUpdate *)getObject()->findUpdateModule(key_BoneFXUpdate); - if (bfxu != NULL) { + if (bfxu != nullptr) { bfxu->stopAllBoneFX(); } @@ -337,7 +337,7 @@ void StructureToppleUpdate::doAngleFX(Real curAngle, Real newAngle) { if ((it->angle > curAngle) && (it->angle <= newAngle)) { - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXObj(it->fxList, getObject()); } } @@ -380,7 +380,7 @@ void StructureToppleUpdate::applyCrushingDamage(Real theta) // Get the crushing weapon. const WeaponTemplate* wt = TheWeaponStore->findWeaponTemplate(d->m_crushingWeaponName); - if (wt == NULL) { + if (wt == nullptr) { return; } @@ -431,7 +431,7 @@ void StructureToppleUpdate::doDamageLine(Object *building, const WeaponTemplate* TheWeaponStore->createAndFireTempWeapon(wt, building, &target); // do the crushing particle effects - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_crushingFXList, &target); } @@ -443,7 +443,7 @@ void StructureToppleUpdate::doDamageLine(Object *building, const WeaponTemplate* TheWeaponStore->createAndFireTempWeapon(wt, building, &target); // do the crushing particle effects - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_crushingFXList, &target); // Do the flying debris for this line. @@ -461,7 +461,7 @@ void StructureToppleUpdate::doToppleStartFX(Object *building, const DamageInfo * const StructureToppleUpdateModuleData *d = getStructureToppleUpdateModuleData(); const DamageInfo *lastDamageInfo = getObject()->getBodyModule()->getLastDamageInfo(); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_toppleStartFXList, building->getPosition()); doPhaseStuff(STPHASE_INITIAL, building->getPosition()); @@ -475,22 +475,22 @@ void StructureToppleUpdate::doToppleDelayBurstFX() const DamageInfo *lastDamageInfo = getObject()->getBodyModule()->getLastDamageInfo(); DEBUG_LOG(("Doing topple delay burst on frame %d", TheGameLogic->getFrame())); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) FXList::doFXPos(d->m_toppleDelayFXList, &m_delayBurstLocation); Object *building = getObject(); Drawable *drawable = building->getDrawable(); - if( lastDamageInfo == NULL || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) + if( lastDamageInfo == nullptr || getDamageTypeFlag( d->m_damageFXTypes, lastDamageInfo->in.m_damageType ) ) { for (std::vector::const_iterator it = d->fxbones.begin(); it != d->fxbones.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(it->particleSystemTemplate); - if (sys != NULL) + if (sys != nullptr) { Coord3D pos; - if (drawable->getPristineBonePositions(it->boneName.str(), 0, &pos, NULL, 1) == 1) + if (drawable->getPristineBonePositions(it->boneName.str(), 0, &pos, nullptr, 1) == 1) { // got the bone position... sys->setPosition(&pos); @@ -553,7 +553,7 @@ void StructureToppleUpdate::doPhaseStuff(StructureTopplePhaseType stphase, const const OCLVec& v = d->m_ocls[stphase]; DEBUG_ASSERTCRASH(idx>=0&&idxiterateObjectsInRange(getObject(), 1000.0f, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); @@ -386,8 +386,8 @@ UpdateSleepTime TensileFormationUpdate::update( void ) void TensileFormationUpdate::propagateDislodgement ( Bool enabled ) { PartitionFilterTensileFormationMember tfmFilter( getObject() ); - PartitionFilter *filters[] = { &tfmFilter, NULL }; - SimpleObjectIterator *iter = NULL; + PartitionFilter *filters[] = { &tfmFilter, nullptr }; + SimpleObjectIterator *iter = nullptr; iter = ThePartitionManager->iterateObjectsInRange(getObject(), 100.0f, FROM_BOUNDINGSPHERE_3D, filters); MemoryPoolObjectHolder hold(iter); for (Object* other = iter->first(); other; other = iter->next()) @@ -405,7 +405,7 @@ void TensileFormationUpdate::propagateDislodgement ( Bool enabled ) //TensileFormationUpdate* tfu = getTFU(other); - //if ( tfu != NULL ) + //if ( tfu != nullptr ) //{ // tfu->setEnabled( enabled ); //} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index 7af9b83cfcc..17d1fd053ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -59,8 +59,8 @@ ToppleUpdateModuleData::ToppleUpdateModuleData() const Real START_VELOCITY_PERCENT = 0.2f; const Real START_ACCEL_PERCENT = 0.01f; const Real VELOCITY_BOUNCE_PERCENT = 0.3f; // multiply the velocity by this when you bounce - m_toppleFX = NULL; - m_bounceFX = NULL; + m_toppleFX = nullptr; + m_bounceFX = nullptr; m_stumpName.clear(); m_killWhenToppled = true; m_killWhenStartToppled = false; @@ -80,18 +80,18 @@ void ToppleUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ToppleFX", INI::parseFXList, NULL, offsetof( ToppleUpdateModuleData, m_toppleFX ) }, - { "BounceFX", INI::parseFXList, NULL, offsetof( ToppleUpdateModuleData, m_bounceFX ) }, - { "StumpName", INI::parseAsciiString, NULL, offsetof( ToppleUpdateModuleData, m_stumpName ) }, - { "KillWhenStartToppling", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killWhenStartToppled ) }, - { "KillWhenFinishedToppling", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killWhenToppled ) }, - { "KillStumpWhenToppled", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_killStumpWhenToppled ) }, - { "ToppleLeftOrRightOnly", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_toppleLeftOrRightOnly ) }, - { "ReorientToppledRubble", INI::parseBool, NULL, offsetof( ToppleUpdateModuleData, m_reorientToppledRubble ) }, - { "InitialVelocityPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_initialVelocityPercent ) }, - { "InitialAccelPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_initialAccelPercent ) }, - { "BounceVelocityPercent", INI::parsePercentToReal, NULL, offsetof( ToppleUpdateModuleData, m_bounceVelocityPercent ) }, - { 0, 0, 0, 0 } + { "ToppleFX", INI::parseFXList, nullptr, offsetof( ToppleUpdateModuleData, m_toppleFX ) }, + { "BounceFX", INI::parseFXList, nullptr, offsetof( ToppleUpdateModuleData, m_bounceFX ) }, + { "StumpName", INI::parseAsciiString, nullptr, offsetof( ToppleUpdateModuleData, m_stumpName ) }, + { "KillWhenStartToppling", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killWhenStartToppled ) }, + { "KillWhenFinishedToppling", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killWhenToppled ) }, + { "KillStumpWhenToppled", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_killStumpWhenToppled ) }, + { "ToppleLeftOrRightOnly", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_toppleLeftOrRightOnly ) }, + { "ReorientToppledRubble", INI::parseBool, nullptr, offsetof( ToppleUpdateModuleData, m_reorientToppledRubble ) }, + { "InitialVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_initialVelocityPercent ) }, + { "InitialAccelPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_initialAccelPercent ) }, + { "BounceVelocityPercent", INI::parsePercentToReal, nullptr, offsetof( ToppleUpdateModuleData, m_bounceVelocityPercent ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -213,7 +213,7 @@ void ToppleUpdate::applyTopplingForce( const Coord3D* toppleDirection, Real topp if (!d->m_stumpName.isEmpty()) { const ThingTemplate* ttn = TheThingFactory->findTemplate(d->m_stumpName); - Object *stump = TheThingFactory->newObject( ttn, NULL ); + Object *stump = TheThingFactory->newObject( ttn, nullptr ); if (stump) { stump->setPosition( getObject()->getPosition() ); @@ -364,7 +364,7 @@ void ToppleUpdate::onCollide( Object *other, const Coord3D *loc, const Coord3D * { // Note that other == null means "collide with ground" // - if (other == NULL) + if (other == nullptr) return; //@todo JohnA -- Should you get around to adding trees to avoidance pathfinding, then you'll diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index a628657312c..e3db1a41d9a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -83,22 +83,22 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ) static const FieldParse dataFieldParse[] = { - { "WaveDelay", INI::parseDurationReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waveDelay ) }, - { "YSize", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_ySize ) }, - { "LinearWaveSpacing", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_linearWaveSpacing ) }, - { "WaveBendMagnitude", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waveBendMagnitude ) }, - { "WaterVelocity", INI::parseVelocityReal, NULL, offsetof( WaveGuideUpdateModuleData, m_waterVelocity ) }, - { "PreferredHeight", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_preferredHeight ) }, - { "ShorelineEffectDistance", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_shorelineEffectDistance ) }, - { "DamageRadius", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageRadius ) }, - { "DamageAmount", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageAmount ) }, - { "ToppleForce", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) }, - { "RandomSplashSound", INI::parseAudioEventRTS, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSound ) }, - { "RandomSplashSoundFrequency", INI::parseInt, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSoundFrequency ) }, - { "BridgeParticle", INI::parseParticleSystemTemplate, NULL, offsetof( WaveGuideUpdateModuleData, m_bridgeParticle ) }, - { "BridgeParticleAngleFudge", INI::parseAngleReal, NULL, offsetof( WaveGuideUpdateModuleData, m_bridgeParticleAngleFudge ) }, - { "LoopingSound", INI::parseAudioEventRTS, NULL, offsetof( WaveGuideUpdateModuleData, m_loopingSound ) }, - { 0, 0, 0, 0 } + { "WaveDelay", INI::parseDurationReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waveDelay ) }, + { "YSize", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_ySize ) }, + { "LinearWaveSpacing", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_linearWaveSpacing ) }, + { "WaveBendMagnitude", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waveBendMagnitude ) }, + { "WaterVelocity", INI::parseVelocityReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_waterVelocity ) }, + { "PreferredHeight", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_preferredHeight ) }, + { "ShorelineEffectDistance", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_shorelineEffectDistance ) }, + { "DamageRadius", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_damageRadius ) }, + { "DamageAmount", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_damageAmount ) }, + { "ToppleForce", INI::parseReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) }, + { "RandomSplashSound", INI::parseAudioEventRTS, nullptr, offsetof( WaveGuideUpdateModuleData, m_randomSplashSound ) }, + { "RandomSplashSoundFrequency", INI::parseInt, nullptr, offsetof( WaveGuideUpdateModuleData, m_randomSplashSoundFrequency ) }, + { "BridgeParticle", INI::parseParticleSystemTemplate, nullptr, offsetof( WaveGuideUpdateModuleData, m_bridgeParticle ) }, + { "BridgeParticleAngleFudge", INI::parseAngleReal, nullptr, offsetof( WaveGuideUpdateModuleData, m_bridgeParticleAngleFudge ) }, + { "LoopingSound", INI::parseAudioEventRTS, nullptr, offsetof( WaveGuideUpdateModuleData, m_loopingSound ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -191,7 +191,7 @@ Bool WaveGuideUpdate::startMoving( void ) // there must be at least one link Waypoint *next = waypoint->getLink( 0 ); - if( next == NULL ) + if( next == nullptr ) { DEBUG_CRASH(( "WaveGuideUpdate:startMoving - There must be a linked waypoint path to follow" )); @@ -560,7 +560,7 @@ void WaveGuideUpdate::doDamage( void ) ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( &m_transformedShapePoints[ i ], modData->m_damageRadius, FROM_CENTER_2D, - NULL ); + nullptr ); MemoryPoolObjectHolder hold( iter ); Object *obj; const Coord3D *objPos; @@ -676,7 +676,7 @@ void WaveGuideUpdate::doDamage( void ) if( obj->isKindOf( KINDOF_BRIDGE ) ) { const ThingTemplate* ttn = TheThingFactory->findTemplate("WaterWaveBridge"); - Object *newBridge = TheThingFactory->newObject( ttn, NULL ); + Object *newBridge = TheThingFactory->newObject( ttn, nullptr ); if( newBridge ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp index d4d670b02d2..a4aa0062988 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WeaponBonusUpdate.cpp @@ -79,13 +79,13 @@ void WeaponBonusUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) UpdateModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { - { "RequiredAffectKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( WeaponBonusUpdateModuleData, m_requiredAffectKindOf ) }, - { "ForbiddenAffectKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( WeaponBonusUpdateModuleData, m_forbiddenAffectKindOf ) }, - { "BonusDuration", INI::parseDurationUnsignedInt, NULL, offsetof( WeaponBonusUpdateModuleData, m_bonusDuration ) }, - { "BonusDelay", INI::parseDurationUnsignedInt, NULL, offsetof( WeaponBonusUpdateModuleData, m_bonusDelay ) }, - { "BonusRange", INI::parseReal, NULL, offsetof( WeaponBonusUpdateModuleData, m_bonusRange ) }, + { "RequiredAffectKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( WeaponBonusUpdateModuleData, m_requiredAffectKindOf ) }, + { "ForbiddenAffectKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( WeaponBonusUpdateModuleData, m_forbiddenAffectKindOf ) }, + { "BonusDuration", INI::parseDurationUnsignedInt, nullptr, offsetof( WeaponBonusUpdateModuleData, m_bonusDuration ) }, + { "BonusDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( WeaponBonusUpdateModuleData, m_bonusDelay ) }, + { "BonusRange", INI::parseReal, nullptr, offsetof( WeaponBonusUpdateModuleData, m_bonusRange ) }, { "BonusConditionType", INI::parseIndexList, TheWeaponBonusNames, offsetof( WeaponBonusUpdateModuleData, m_bonusConditionType ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -135,7 +135,7 @@ UpdateSleepTime WeaponBonusUpdate::update( void ) // Leaving this here commented out to show that I need to reach valid contents of invalid transports. // So these checks are on an individual basis, not in the Partition query // PartitionFilterAcceptByKindOf filterKindof(data->m_requiredAffectKindOf,data->m_forbiddenAffectKindOf); - PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &relationship, &filterAlive, &filterMapStatus, nullptr }; // scan objects in our region ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( me->getPosition(), @@ -149,7 +149,7 @@ UpdateSleepTime WeaponBonusUpdate::update( void ) weaponBonusData.m_requiredMask = data->m_requiredAffectKindOf; weaponBonusData.m_forbiddenMask = data->m_forbiddenAffectKindOf; - for( Object *currentObj = iter->first(); currentObj != NULL; currentObj = iter->next() ) + for( Object *currentObj = iter->first(); currentObj != nullptr; currentObj = iter->next() ) { if( currentObj->isKindOfMulti(data->m_requiredAffectKindOf, data->m_forbiddenAffectKindOf) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp index 9b95be8397c..f9773bdb590 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp @@ -51,8 +51,8 @@ ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "NewShroudRange", INI::parseReal, NULL, offsetof( ActiveShroudUpgradeModuleData, m_newShroudRange ) }, - { 0, 0, 0, 0 } + { "NewShroudRange", INI::parseReal, nullptr, offsetof( ActiveShroudUpgradeModuleData, m_newShroudRange ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index 56c7b3b76bf..bb2f5ff9e4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -42,10 +42,10 @@ void CommandSetUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "CommandSet", INI::parseAsciiString, NULL, offsetof( CommandSetUpgradeModuleData, m_newCommandSet ) }, - { "CommandSetAlt", INI::parseAsciiString, NULL, offsetof( CommandSetUpgradeModuleData, m_newCommandSetAlt ) }, - { "TriggerAlt", INI::parseAsciiString, NULL, offsetof( CommandSetUpgradeModuleData, m_triggerAlt ) }, - { 0, 0, 0, 0 } + { "CommandSet", INI::parseAsciiString, nullptr, offsetof( CommandSetUpgradeModuleData, m_newCommandSet ) }, + { "CommandSetAlt", INI::parseAsciiString, nullptr, offsetof( CommandSetUpgradeModuleData, m_newCommandSetAlt ) }, + { "TriggerAlt", INI::parseAsciiString, nullptr, offsetof( CommandSetUpgradeModuleData, m_triggerAlt ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp index 5c6b7ed9550..0287b7f3d98 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CostModifierUpgrade.cpp @@ -88,9 +88,9 @@ CostModifierUpgradeModuleData::CostModifierUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "EffectKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( CostModifierUpgradeModuleData, m_kindOf ) }, - { "Percentage", INI::parsePercentToReal, NULL, offsetof( CostModifierUpgradeModuleData, m_percentage ) }, - { 0, 0, 0, 0 } + { "EffectKindOf", KindOfMaskType::parseFromINI, nullptr, offsetof( CostModifierUpgradeModuleData, m_kindOf ) }, + { "Percentage", INI::parsePercentToReal, nullptr, offsetof( CostModifierUpgradeModuleData, m_percentage ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp index 2ec700db65f..a0205737ecb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ExperienceScalarUpgrade.cpp @@ -51,8 +51,8 @@ void ExperienceScalarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AddXPScalar", INI::parseReal, NULL, offsetof( ExperienceScalarUpgradeModuleData, m_addXPScalar ) }, - { 0, 0, 0, 0 } + { "AddXPScalar", INI::parseReal, nullptr, offsetof( ExperienceScalarUpgradeModuleData, m_addXPScalar ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp index 4f35f73bdf6..87a721fc807 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/GrantScienceUpgrade.cpp @@ -61,8 +61,8 @@ void GrantScienceUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "GrantScience", INI::parseAsciiString, NULL, offsetof( GrantScienceUpgradeModuleData, m_grantScienceName ) }, - { 0, 0, 0, 0 } + { "GrantScience", INI::parseAsciiString, nullptr, offsetof( GrantScienceUpgradeModuleData, m_grantScienceName ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp index f66a9db86ae..dcbd4e54963 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/MaxHealthUpgrade.cpp @@ -54,9 +54,9 @@ void MaxHealthUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AddMaxHealth", INI::parseReal, NULL, offsetof( MaxHealthUpgradeModuleData, m_addMaxHealth ) }, + { "AddMaxHealth", INI::parseReal, nullptr, offsetof( MaxHealthUpgradeModuleData, m_addMaxHealth ) }, { "ChangeType", INI::parseIndexList, TheMaxHealthChangeTypeNames, offsetof( MaxHealthUpgradeModuleData, m_maxHealthChangeType ) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp index 92a6b84b83c..2ef8772f74b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ModelConditionUpgrade.cpp @@ -48,8 +48,8 @@ void ModelConditionUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ConditionFlag", ModelConditionFlags::parseSingleBitFromINI, NULL, offsetof( ModelConditionUpgradeModuleData, m_conditionFlag ) }, - { 0, 0, 0, 0 } + { "ConditionFlag", ModelConditionFlags::parseSingleBitFromINI, nullptr, offsetof( ModelConditionUpgradeModuleData, m_conditionFlag ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp index e486ff7a85d..1bf9585271c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ObjectCreationUpgrade.cpp @@ -43,7 +43,7 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) { - m_ocl = NULL; + m_ocl = nullptr; } @@ -55,8 +55,8 @@ ObjectCreationUpgradeModuleData::ObjectCreationUpgradeModuleData( void ) static const FieldParse dataFieldParse[] = { - { "UpgradeObject", INI::parseObjectCreationList, NULL, offsetof( ObjectCreationUpgradeModuleData, m_ocl ) }, - { 0, 0, 0, 0 } + { "UpgradeObject", INI::parseObjectCreationList, nullptr, offsetof( ObjectCreationUpgradeModuleData, m_ocl ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -94,7 +94,7 @@ void ObjectCreationUpgrade::upgradeImplementation( void ) // spawn everything in the OCL if (getObjectCreationUpgradeModuleData() && getObjectCreationUpgradeModuleData()->m_ocl) { - ObjectCreationList::create((getObjectCreationUpgradeModuleData()->m_ocl), getObject(), NULL); + ObjectCreationList::create((getObjectCreationUpgradeModuleData()->m_ocl), getObject(), nullptr); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp index 4be2d345ac6..d86105e06e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/RadarUpgrade.cpp @@ -46,8 +46,8 @@ void RadarUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "DisableProof", INI::parseBool, NULL, offsetof( RadarUpgradeModuleData, m_isDisableProof ) }, - { 0, 0, 0, 0 } + { "DisableProof", INI::parseBool, nullptr, offsetof( RadarUpgradeModuleData, m_isDisableProof ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp index 3406cc3545a..761fcc61b6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/ReplaceObjectUpgrade.cpp @@ -48,8 +48,8 @@ void ReplaceObjectUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ReplaceObject", INI::parseAsciiString, NULL, offsetof( ReplaceObjectUpgradeModuleData, m_replaceObjectName ) }, - { 0, 0, 0, 0 } + { "ReplaceObject", INI::parseAsciiString, nullptr, offsetof( ReplaceObjectUpgradeModuleData, m_replaceObjectName ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -84,9 +84,9 @@ void ReplaceObjectUpgrade::upgradeImplementation( ) myMatrix = *me->getTransformMatrix(); myTeam = me->getTeam();// Team implies player. It is a subset. - if (replacementTemplate == NULL) + if (replacementTemplate == nullptr) { - DEBUG_ASSERTCRASH(replacementTemplate != NULL, ("No such object '%s' in ReplaceObjectUpgrade.", data->m_replaceObjectName.str())); + DEBUG_ASSERTCRASH(replacementTemplate != nullptr, ("No such object '%s' in ReplaceObjectUpgrade.", data->m_replaceObjectName.str())); return; } @@ -116,7 +116,7 @@ void ReplaceObjectUpgrade::upgradeImplementation( ) if( replacementObject->getControllingPlayer() ) { - replacementObject->getControllingPlayer()->onStructureConstructionComplete(NULL, replacementObject, FALSE); + replacementObject->getControllingPlayer()->onStructureConstructionComplete(nullptr, replacementObject, FALSE); // TheSuperHackers @bugfix Stubbjax 26/05/2025 If the old object was selected, select the new one. if (oldObjectSelected) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp index 18b889e7ba4..beb6005fce7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/StatusBitsUpgrade.cpp @@ -79,9 +79,9 @@ void StatusBitsUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "StatusToSet", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StatusBitsUpgradeModuleData, m_statusToSet ) }, - { "StatusToClear", ObjectStatusMaskType::parseFromINI, NULL, offsetof( StatusBitsUpgradeModuleData, m_statusToClear ) }, - { 0, 0, 0, 0 } + { "StatusToSet", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StatusBitsUpgradeModuleData, m_statusToSet ) }, + { "StatusToClear", ObjectStatusMaskType::parseFromINI, nullptr, offsetof( StatusBitsUpgradeModuleData, m_statusToClear ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp index 2c1fe9a2358..67b5b7dd60a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/SubObjectsUpgrade.cpp @@ -61,9 +61,9 @@ void SubObjectsUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "ShowSubObjects", INI::parseAsciiStringVectorAppend, NULL, offsetof( SubObjectsUpgradeModuleData, m_showSubObjectNames ) }, - { "HideSubObjects", INI::parseAsciiStringVectorAppend, NULL, offsetof( SubObjectsUpgradeModuleData, m_hideSubObjectNames ) }, - { 0, 0, 0, 0 } + { "ShowSubObjects", INI::parseAsciiStringVectorAppend, nullptr, offsetof( SubObjectsUpgradeModuleData, m_showSubObjectNames ) }, + { "HideSubObjects", INI::parseAsciiStringVectorAppend, nullptr, offsetof( SubObjectsUpgradeModuleData, m_hideSubObjectNames ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp index 135f71b26a5..da475a648cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UnpauseSpecialPowerUpgrade.cpp @@ -41,7 +41,7 @@ //------------------------------------------------------------------------------------------------- UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void ) { - m_specialPower = NULL; + m_specialPower = nullptr; } //------------------------------------------------------------------------------------------------- @@ -52,8 +52,8 @@ UnpauseSpecialPowerUpgradeModuleData::UnpauseSpecialPowerUpgradeModuleData( void static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( UnpauseSpecialPowerUpgradeModuleData, m_specialPower ) }, - { 0, 0, 0, 0 } + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, nullptr, offsetof( UnpauseSpecialPowerUpgradeModuleData, m_specialPower ) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 473f284ab41..94d8ac84b87 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -112,8 +112,8 @@ static void parsePerVetLevelFXList( INI* ini, void* /*instance*/, void * store, typedef const FXList* ConstFXListPtr; ConstFXListPtr* s = (ConstFXListPtr*)store; VeterancyLevel v = (VeterancyLevel)INI::scanIndexList(ini->getNextToken(), TheVeterancyNames); - const FXList* fx = NULL; - INI::parseFXList(ini, NULL, &fx, NULL); + const FXList* fx = nullptr; + INI::parseFXList(ini, nullptr, &fx, nullptr); s[v] = fx; } @@ -122,8 +122,8 @@ static void parseAllVetLevelsFXList( INI* ini, void* /*instance*/, void * store, { typedef const FXList* ConstFXListPtr; ConstFXListPtr* s = (ConstFXListPtr*)store; - const FXList* fx = NULL; - INI::parseFXList(ini, NULL, &fx, NULL); + const FXList* fx = nullptr; + INI::parseFXList(ini, nullptr, &fx, nullptr); for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) s[i] = fx; } @@ -134,8 +134,8 @@ static void parsePerVetLevelPSys( INI* ini, void* /*instance*/, void * store, co typedef const ParticleSystemTemplate* ConstParticleSystemTemplatePtr; ConstParticleSystemTemplatePtr* s = (ConstParticleSystemTemplatePtr*)store; VeterancyLevel v = (VeterancyLevel)INI::scanIndexList(ini->getNextToken(), TheVeterancyNames); - ConstParticleSystemTemplatePtr pst = NULL; - INI::parseParticleSystemTemplate(ini, NULL, &pst, NULL); + ConstParticleSystemTemplatePtr pst = nullptr; + INI::parseParticleSystemTemplate(ini, nullptr, &pst, nullptr); s[v] = pst; } @@ -144,8 +144,8 @@ static void parseAllVetLevelsPSys( INI* ini, void* /*instance*/, void * store, c { typedef const ParticleSystemTemplate* ConstParticleSystemTemplatePtr; ConstParticleSystemTemplatePtr* s = (ConstParticleSystemTemplatePtr*)store; - ConstParticleSystemTemplatePtr pst = NULL; - INI::parseParticleSystemTemplate(ini, NULL, &pst, NULL); + ConstParticleSystemTemplatePtr pst = nullptr; + INI::parseParticleSystemTemplate(ini, nullptr, &pst, nullptr); for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) s[i] = pst; } @@ -153,7 +153,7 @@ static void parseAllVetLevelsPSys( INI* ini, void* /*instance*/, void * store, c /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -WeaponStore *TheWeaponStore = NULL; ///< the weapon store definition +WeaponStore *TheWeaponStore = nullptr; ///< the weapon store definition /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -162,52 +162,52 @@ WeaponStore *TheWeaponStore = NULL; ///< the weapon store definition const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { - { "PrimaryDamage", INI::parseReal, NULL, offsetof(WeaponTemplate, m_primaryDamage) }, - { "PrimaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_primaryDamageRadius) }, - { "SecondaryDamage", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamage) }, - { "SecondaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamageRadius) }, - { "ShockWaveAmount", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveAmount) }, - { "ShockWaveRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveRadius) }, - { "ShockWaveTaperOff", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveTaperOff) }, - { "AttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_attackRange) }, - { "MinimumAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_minimumAttackRange) }, - { "RequestAssistRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_requestAssistRange) }, - { "AcceptableAimDelta", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_aimDelta) }, - { "ScatterRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_scatterRadius) }, - { "ScatterTargetScalar", INI::parseReal, NULL, offsetof(WeaponTemplate, m_scatterTargetScalar) }, - { "ScatterRadiusVsInfantry", INI::parseReal, NULL, offsetof( WeaponTemplate, m_infantryInaccuracyDist ) }, - { "DamageType", DamageTypeFlags::parseSingleBitFromINI, NULL, offsetof(WeaponTemplate, m_damageType) }, - { "DamageStatusType", ObjectStatusMaskType::parseSingleBitFromINI, NULL, offsetof(WeaponTemplate, m_damageStatusType) }, + { "PrimaryDamage", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_primaryDamage) }, + { "PrimaryDamageRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_primaryDamageRadius) }, + { "SecondaryDamage", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_secondaryDamage) }, + { "SecondaryDamageRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_secondaryDamageRadius) }, + { "ShockWaveAmount", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_shockWaveAmount) }, + { "ShockWaveRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_shockWaveRadius) }, + { "ShockWaveTaperOff", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_shockWaveTaperOff) }, + { "AttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_attackRange) }, + { "MinimumAttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_minimumAttackRange) }, + { "RequestAssistRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_requestAssistRange) }, + { "AcceptableAimDelta", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_aimDelta) }, + { "ScatterRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterRadius) }, + { "ScatterTargetScalar", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterTargetScalar) }, + { "ScatterRadiusVsInfantry", INI::parseReal, nullptr, offsetof( WeaponTemplate, m_infantryInaccuracyDist ) }, + { "DamageType", DamageTypeFlags::parseSingleBitFromINI, nullptr, offsetof(WeaponTemplate, m_damageType) }, + { "DamageStatusType", ObjectStatusMaskType::parseSingleBitFromINI, nullptr, offsetof(WeaponTemplate, m_damageStatusType) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof(WeaponTemplate, m_deathType) }, - { "WeaponSpeed", INI::parseVelocityReal, NULL, offsetof(WeaponTemplate, m_weaponSpeed) }, - { "MinWeaponSpeed", INI::parseVelocityReal, NULL, offsetof(WeaponTemplate, m_minWeaponSpeed) }, - { "ScaleWeaponSpeed", INI::parseBool, NULL, offsetof(WeaponTemplate, m_isScaleWeaponSpeed) }, - { "WeaponRecoil", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_weaponRecoil) }, - { "MinTargetPitch", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_minTargetPitch) }, - { "MaxTargetPitch", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_maxTargetPitch) }, - { "RadiusDamageAngle", INI::parseAngleReal, NULL, offsetof(WeaponTemplate, m_radiusDamageAngle) }, - { "ProjectileObject", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_projectileName) }, - { "FireSound", INI::parseAudioEventRTS, NULL, offsetof(WeaponTemplate, m_fireSound) }, - { "FireSoundLoopTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_fireSoundLoopTime) }, - { "FireFX", parseAllVetLevelsFXList, NULL, offsetof(WeaponTemplate, m_fireFXs) }, - { "ProjectileDetonationFX", parseAllVetLevelsFXList, NULL, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, - { "FireOCL", parseAllVetLevelsAsciiString, NULL, offsetof(WeaponTemplate, m_fireOCLNames) }, - { "ProjectileDetonationOCL", parseAllVetLevelsAsciiString, NULL, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, - { "ProjectileExhaust", parseAllVetLevelsPSys, NULL, offsetof(WeaponTemplate, m_projectileExhausts) }, - { "VeterancyFireFX", parsePerVetLevelFXList, NULL, offsetof(WeaponTemplate, m_fireFXs) }, - { "VeterancyProjectileDetonationFX", parsePerVetLevelFXList, NULL, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, - { "VeterancyFireOCL", parsePerVetLevelAsciiString, NULL, offsetof(WeaponTemplate, m_fireOCLNames) }, - { "VeterancyProjectileDetonationOCL", parsePerVetLevelAsciiString, NULL, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, - { "VeterancyProjectileExhaust", parsePerVetLevelPSys, NULL, offsetof(WeaponTemplate, m_projectileExhausts) }, - { "ClipSize", INI::parseInt, NULL, offsetof(WeaponTemplate, m_clipSize) }, - { "ContinuousFireOne", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireOneShotsNeeded) }, - { "ContinuousFireTwo", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireTwoShotsNeeded) }, - { "ContinuousFireCoast", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_continuousFireCoastFrames) }, - { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, - { "ClipReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_clipReloadTime) }, - { "DelayBetweenShots", WeaponTemplate::parseShotDelay, NULL, 0 }, - { "ShotsPerBarrel", INI::parseInt, NULL, offsetof(WeaponTemplate, m_shotsPerBarrel) }, - { "DamageDealtAtSelfPosition",INI::parseBool, NULL, offsetof(WeaponTemplate, m_damageDealtAtSelfPosition) }, + { "WeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_weaponSpeed) }, + { "MinWeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_minWeaponSpeed) }, + { "ScaleWeaponSpeed", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_isScaleWeaponSpeed) }, + { "WeaponRecoil", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_weaponRecoil) }, + { "MinTargetPitch", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_minTargetPitch) }, + { "MaxTargetPitch", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_maxTargetPitch) }, + { "RadiusDamageAngle", INI::parseAngleReal, nullptr, offsetof(WeaponTemplate, m_radiusDamageAngle) }, + { "ProjectileObject", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileName) }, + { "FireSound", INI::parseAudioEventRTS, nullptr, offsetof(WeaponTemplate, m_fireSound) }, + { "FireSoundLoopTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_fireSoundLoopTime) }, + { "FireFX", parseAllVetLevelsFXList, nullptr, offsetof(WeaponTemplate, m_fireFXs) }, + { "ProjectileDetonationFX", parseAllVetLevelsFXList, nullptr, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, + { "FireOCL", parseAllVetLevelsAsciiString, nullptr, offsetof(WeaponTemplate, m_fireOCLNames) }, + { "ProjectileDetonationOCL", parseAllVetLevelsAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, + { "ProjectileExhaust", parseAllVetLevelsPSys, nullptr, offsetof(WeaponTemplate, m_projectileExhausts) }, + { "VeterancyFireFX", parsePerVetLevelFXList, nullptr, offsetof(WeaponTemplate, m_fireFXs) }, + { "VeterancyProjectileDetonationFX", parsePerVetLevelFXList, nullptr, offsetof(WeaponTemplate, m_projectileDetonateFXs) }, + { "VeterancyFireOCL", parsePerVetLevelAsciiString, nullptr, offsetof(WeaponTemplate, m_fireOCLNames) }, + { "VeterancyProjectileDetonationOCL", parsePerVetLevelAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileDetonationOCLNames) }, + { "VeterancyProjectileExhaust", parsePerVetLevelPSys, nullptr, offsetof(WeaponTemplate, m_projectileExhausts) }, + { "ClipSize", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_clipSize) }, + { "ContinuousFireOne", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_continuousFireOneShotsNeeded) }, + { "ContinuousFireTwo", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_continuousFireTwoShotsNeeded) }, + { "ContinuousFireCoast", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_continuousFireCoastFrames) }, + { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, + { "ClipReloadTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_clipReloadTime) }, + { "DelayBetweenShots", WeaponTemplate::parseShotDelay, nullptr, 0 }, + { "ShotsPerBarrel", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_shotsPerBarrel) }, + { "DamageDealtAtSelfPosition",INI::parseBool, nullptr, offsetof(WeaponTemplate, m_damageDealtAtSelfPosition) }, { "RadiusDamageAffects", INI::parseBitString32, TheWeaponAffectsMaskNames, offsetof(WeaponTemplate, m_affectsMask) }, { "ProjectileCollidesWith", INI::parseBitString32, TheWeaponCollideMaskNames, offsetof(WeaponTemplate, m_collideMask) }, { "AntiAirborneVehicle", INI::parseBitInInt32, (void*)WEAPON_ANTI_AIRBORNE_VEHICLE, offsetof(WeaponTemplate, m_antiMask) }, @@ -219,26 +219,26 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "AntiAirborneInfantry", INI::parseBitInInt32, (void*)WEAPON_ANTI_AIRBORNE_INFANTRY, offsetof(WeaponTemplate, m_antiMask) }, { "AntiBallisticMissile", INI::parseBitInInt32, (void*)WEAPON_ANTI_BALLISTIC_MISSILE, offsetof(WeaponTemplate, m_antiMask) }, { "AutoReloadsClip", INI::parseIndexList, TheWeaponReloadNames, offsetof(WeaponTemplate, m_reloadType) }, - { "ProjectileStreamName", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_projectileStreamName) }, - { "LaserName", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_laserName) }, - { "LaserBoneName", INI::parseAsciiString, NULL, offsetof(WeaponTemplate, m_laserBoneName) }, - { "WeaponBonus", WeaponTemplate::parseWeaponBonusSet, NULL, 0 }, - { "HistoricBonusTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_historicBonusTime) }, - { "HistoricBonusRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_historicBonusRadius) }, - { "HistoricBonusCount", INI::parseInt, NULL, offsetof(WeaponTemplate, m_historicBonusCount) }, - { "HistoricBonusWeapon", INI::parseWeaponTemplate, NULL, offsetof(WeaponTemplate, m_historicBonusWeapon) }, - { "LeechRangeWeapon", INI::parseBool, NULL, offsetof(WeaponTemplate, m_leechRangeWeapon) }, - { "ScatterTarget", WeaponTemplate::parseScatterTarget, NULL, 0 }, - { "CapableOfFollowingWaypoints", INI::parseBool, NULL, offsetof(WeaponTemplate, m_capableOfFollowingWaypoint) }, - { "ShowsAmmoPips", INI::parseBool, NULL, offsetof(WeaponTemplate, m_isShowsAmmoPips) }, - { "AllowAttackGarrisonedBldgs", INI::parseBool, NULL, offsetof(WeaponTemplate, m_allowAttackGarrisonedBldgs) }, - { "PlayFXWhenStealthed", INI::parseBool, NULL, offsetof(WeaponTemplate, m_playFXWhenStealthed) }, - { "PreAttackDelay", INI::parseDurationUnsignedInt, NULL, offsetof( WeaponTemplate, m_preAttackDelay ) }, + { "ProjectileStreamName", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_projectileStreamName) }, + { "LaserName", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_laserName) }, + { "LaserBoneName", INI::parseAsciiString, nullptr, offsetof(WeaponTemplate, m_laserBoneName) }, + { "WeaponBonus", WeaponTemplate::parseWeaponBonusSet, nullptr, 0 }, + { "HistoricBonusTime", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_historicBonusTime) }, + { "HistoricBonusRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_historicBonusRadius) }, + { "HistoricBonusCount", INI::parseInt, nullptr, offsetof(WeaponTemplate, m_historicBonusCount) }, + { "HistoricBonusWeapon", INI::parseWeaponTemplate, nullptr, offsetof(WeaponTemplate, m_historicBonusWeapon) }, + { "LeechRangeWeapon", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_leechRangeWeapon) }, + { "ScatterTarget", WeaponTemplate::parseScatterTarget, nullptr, 0 }, + { "CapableOfFollowingWaypoints", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_capableOfFollowingWaypoint) }, + { "ShowsAmmoPips", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_isShowsAmmoPips) }, + { "AllowAttackGarrisonedBldgs", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_allowAttackGarrisonedBldgs) }, + { "PlayFXWhenStealthed", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_playFXWhenStealthed) }, + { "PreAttackDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( WeaponTemplate, m_preAttackDelay ) }, { "PreAttackType", INI::parseIndexList, TheWeaponPrefireNames, offsetof(WeaponTemplate, m_prefireType) }, - { "ContinueAttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_continueAttackRange) }, - { "SuspendFXDelay", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_suspendFXDelay) }, - { "MissileCallsOnDie", INI::parseBool, NULL, offsetof(WeaponTemplate, m_dieOnDetonate) }, - { NULL, NULL, NULL, 0 } + { "ContinueAttackRange", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_continueAttackRange) }, + { "SuspendFXDelay", INI::parseDurationUnsignedInt, nullptr, offsetof(WeaponTemplate, m_suspendFXDelay) }, + { "MissileCallsOnDie", INI::parseBool, nullptr, offsetof(WeaponTemplate, m_dieOnDetonate) }, + { nullptr, nullptr, nullptr, 0 } }; @@ -247,7 +247,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = /////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- -WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) +WeaponTemplate::WeaponTemplate() : m_nextTemplate(nullptr) { m_name = "NoNameWeapon"; @@ -275,16 +275,16 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_maxTargetPitch = PI; m_radiusDamageAngle = PI; // PI each way, so full circle m_projectileName.clear(); // no projectile - m_projectileTmpl = NULL; + m_projectileTmpl = nullptr; for (Int i = LEVEL_FIRST; i <= LEVEL_LAST; ++i) { m_fireOCLNames[i].clear(); m_projectileDetonationOCLNames[i].clear(); - m_projectileExhausts[i] = NULL; - m_fireOCLs[i] = NULL; - m_projectileDetonationOCLs[i] = NULL; - m_fireFXs[i] = NULL; - m_projectileDetonateFXs[i] = NULL; + m_projectileExhausts[i] = nullptr; + m_fireOCLs[i] = nullptr; + m_projectileDetonationOCLs[i] = nullptr; + m_fireFXs[i] = nullptr; + m_projectileDetonateFXs[i] = nullptr; } m_damageDealtAtSelfPosition = false; m_affectsMask = (WEAPON_AFFECTS_ALLIES | WEAPON_AFFECTS_ENEMIES | WEAPON_AFFECTS_NEUTRALS); @@ -301,7 +301,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_minDelayBetweenShots = 0; m_maxDelayBetweenShots = 0; m_fireSoundLoopTime = 0; - m_extraBonus = NULL; + m_extraBonus = nullptr; m_shotsPerBarrel = 1; m_antiMask = WEAPON_ANTI_GROUND; // but not air or projectile. m_projectileStreamName.clear(); @@ -310,7 +310,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_historicBonusTime = 0; m_historicBonusCount = 0; m_historicBonusRadius = 0; - m_historicBonusWeapon = NULL; + m_historicBonusWeapon = nullptr; m_leechRangeWeapon = FALSE; m_capableOfFollowingWaypoint = FALSE; m_isShowsAmmoPips = FALSE; @@ -361,7 +361,7 @@ void WeaponTemplate::reset( void ) Coord2D target; target.x = 0; target.y = 0; - INI::parseCoord2D( ini, NULL, &target, NULL ); + INI::parseCoord2D( ini, nullptr, &target, nullptr ); self->m_scatterTargets.push_back(target); } @@ -414,7 +414,7 @@ void WeaponTemplate::postProcessLoad() if (m_projectileName.isEmpty()) { - m_projectileTmpl = NULL; + m_projectileTmpl = nullptr; } else { @@ -427,7 +427,7 @@ void WeaponTemplate::postProcessLoad() // And the OCL if there is one if (m_fireOCLNames[i].isEmpty()) { - m_fireOCLs[i] = NULL; + m_fireOCLs[i] = nullptr; } else { @@ -439,7 +439,7 @@ void WeaponTemplate::postProcessLoad() // And the other OCL if there is one if (m_projectileDetonationOCLNames[i].isEmpty() ) { - m_projectileDetonationOCLs[i] = NULL; + m_projectileDetonationOCLs[i] = nullptr; } else { @@ -568,14 +568,14 @@ Real WeaponTemplate::estimateWeaponTemplateDamage( const WeaponBonus& bonus ) const { - if (sourceObj == NULL || (victimObj == NULL && victimPos == NULL)) + if (sourceObj == nullptr || (victimObj == nullptr && victimPos == nullptr)) { DEBUG_CRASH(("bad args to estimate")); return 0.0f; } const Real damageAmount = getPrimaryDamage(bonus); - if ( victimObj == NULL ) + if ( victimObj == nullptr ) { return damageAmount; } @@ -660,7 +660,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( if (intendedVictimID == thingWeCollidedWith->getID()) return true; - if (projectileLauncher != NULL) + if (projectileLauncher != nullptr) { // Don't hit your own launcher, ever. @@ -701,7 +701,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( for (BehaviorModule** i = thingWeCollidedWith->getBehaviorModules(); *i; ++i) { ParkingPlaceBehaviorInterface* pp = (*i)->getParkingPlaceBehaviorInterface(); - if (pp != NULL && pp->hasReservedSpace(intendedVictimID)) + if (pp != nullptr && pp->hasReservedSpace(intendedVictimID)) return false; } } @@ -709,7 +709,7 @@ Bool WeaponTemplate::shouldProjectileCollideWith( // if something has a Sneaky Target offset, it is momentarily immune to being hit... // normally this shouldn't happen, but occasionally can by accident. so avoid it. (srj) const AIUpdateInterface* ai = thingWeCollidedWith->getAI(); - if (ai != NULL && ai->getSneakyTargetingOffset(NULL)) + if (ai != nullptr && ai->getSneakyTargetingOffset(nullptr)) { return false; } @@ -779,19 +779,19 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate //CRCDEBUG_LOG(("WeaponTemplate::fireWeaponTemplate() from %s", DescribeObject(sourceObj).str())); DEBUG_ASSERTCRASH(specificBarrelToUse >= 0, ("specificBarrelToUse should no longer be -1")); - if (sourceObj == NULL || (victimObj == NULL && victimPos == NULL)) + if (sourceObj == nullptr || (victimObj == nullptr && victimPos == nullptr)) { //-extraLogging #if defined(RTS_DEBUG) if( TheGlobalData->m_extraLogging ) - DEBUG_LOG( ("FAIL 1 (sourceObj %d == NULL || (victimObj %d == NULL && victimPos %d == NULL)", sourceObj != 0, victimObj != 0, victimPos != 0) ); + DEBUG_LOG( ("FAIL 1 (sourceObj %d == nullptr || (victimObj %d == nullptr && victimPos %d == nullptr)", sourceObj != 0, victimObj != 0, victimPos != 0) ); #endif //end -extraLogging return 0; } - DEBUG_ASSERTCRASH((m_primaryDamage > 0) || (victimObj == NULL), ("You can't really shoot a zero damage weapon at an Object.") ); + DEBUG_ASSERTCRASH((m_primaryDamage > 0) || (victimObj == nullptr), ("You can't really shoot a zero damage weapon at an Object.") ); ObjectID sourceID = sourceObj->getID(); const Coord3D* sourcePos = sourceObj->getPosition(); @@ -808,7 +808,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate Coord3D sneakyOffset; const AIUpdateInterface* ai = victimObj->getAI(); - if (ai != NULL && ai->getSneakyTargetingOffset(&sneakyOffset)) + if (ai != nullptr && ai->getSneakyTargetingOffset(&sneakyOffset)) { victimPosStorage = *victimPos; victimPosStorage.x += sneakyOffset.x; @@ -817,7 +817,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate victimPos = &victimPosStorage; // for a sneaky offset, we always target a position rather than an object - victimObj = NULL; + victimObj = nullptr; victimID = INVALID_ID; distSqr = ThePartitionManager->getDistanceSquared(sourceObj, victimPos, ATTACK_RANGE_CALC_TYPE); } @@ -850,7 +850,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate } // DEBUG_LOG(("WeaponTemplate::fireWeaponTemplate: firing weapon %s (source=%s, victim=%s)", -// m_name.str(),sourceObj->getTemplate()->getName().str(),victimObj?victimObj->getTemplate()->getName().str():"NULL")); +// m_name.str(),sourceObj->getTemplate()->getName().str(),victimObj?victimObj->getTemplate()->getName().str():"null")); //Only perform this check if the weapon isn't a leech range weapon (which can have unlimited range!) if( !ignoreRanges && !isLeechRangeWeapon() ) @@ -911,7 +911,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate const FXList* fx = isProjectileDetonation ? getProjectileDetonateFX(v) : getFireFX(v); if ( TheGameLogic->getFrame() < firingWeapon->getSuspendFXFrame() ) - fx = NULL; + fx = nullptr; Bool handled; @@ -937,7 +937,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate ); } - if (handled == false && fx != NULL) + if (handled == false && fx != nullptr) { // bah. just play it at the drawable's pos. //DEBUG_LOG(("*** WeaponFireFX not fully handled by the client")); @@ -952,7 +952,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate VeterancyLevel v = sourceObj->getVeterancyLevel(); const ObjectCreationList *oclToUse = isProjectileDetonation ? getProjectileDetonationOCL(v) : getFireOCL(v); if( oclToUse ) - ObjectCreationList::create( oclToUse, sourceObj, NULL ); + ObjectCreationList::create( oclToUse, sourceObj, nullptr ); } Coord3D projectileDestination = *victimPos; //Need to copy this, as we have a pointer to their actual position @@ -980,7 +980,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate targetLayer = victimObj->getLayer(); } - //victimObj = NULL; // his position is already in victimPos, if he existed + //victimObj = nullptr; // his position is already in victimPos, if he existed //Randomize the scatter radius (sometimes it can be more accurate than others) scatterRadius = GameLogicRandomValueReal( 0, scatterRadius ); @@ -1001,7 +1001,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate projectileDestination.z = TheTerrainLogic->getLayerHeight( projectileDestination.x, projectileDestination.y, targetLayer ); } - if (getProjectileTemplate() == NULL || isProjectileDetonation) + if (getProjectileTemplate() == nullptr || isProjectileDetonation) { // see if we need to be called back at a later point to deal the damage. Coord3D v; @@ -1029,7 +1029,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate { //We are missing our intended target, so now we want to aim at the ground at the projectile offset. damageID = INVALID_ID; - firingWeapon->createLaser( sourceObj, NULL, &projectileDestination ); + firingWeapon->createLaser( sourceObj, nullptr, &projectileDestination ); } if( inflictDamage ) { @@ -1121,10 +1121,10 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate firingWeapon->newProjectileFired( sourceObj, projectile, victimObj, victimPos );//The actual logic weapon needs to know this was created. - ProjectileUpdateInterface* pui = NULL; + ProjectileUpdateInterface* pui = nullptr; for (BehaviorModule** u = projectile->getBehaviorModules(); *u; ++u) { - if ((pui = (*u)->getProjectileUpdateInterface()) != NULL) + if ((pui = (*u)->getProjectileUpdateInterface()) != nullptr) break; } if (pui) @@ -1133,7 +1133,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate if( scatterRadius > 0.0f ) { //With a scatter radius, don't follow the victim (overriding the intent). - pui->projectileLaunchAtObjectOrPosition( NULL, &projectileDestination, sourceObj, wslot, specificBarrelToUse, this, m_projectileExhausts[v] ); + pui->projectileLaunchAtObjectOrPosition( nullptr, &projectileDestination, sourceObj, wslot, specificBarrelToUse, this, m_projectileExhausts[v] ); } else { @@ -1329,7 +1329,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co if (sourceID == 0) // must have a source return; - if (victimID == 0 && pos == NULL) // must have some sort of destination + if (victimID == 0 && pos == nullptr) // must have some sort of destination return; Object *source = TheGameLogic->findObjectByID(sourceID); // might be null... @@ -1339,7 +1339,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co //DEBUG_LOG(("WeaponTemplate::dealDamageInternal: dealing damage %s at frame %d",m_name.str(),TheGameLogic->getFrame())); // if there's a specific victim, use it's pos (overriding the value passed in) - Object *primaryVictim = victimID ? TheGameLogic->findObjectByID(victimID) : NULL; // might be null... + Object *primaryVictim = victimID ? TheGameLogic->findObjectByID(victimID) : nullptr; // might be null... if (primaryVictim) { pos = primaryVictim->getPosition(); @@ -1348,7 +1348,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co DamageType damageType = getDamageType(); DeathType deathType = getDeathType(); ObjectStatusTypes damageStatusType = getDamageStatusType(); - if (getProjectileTemplate() == NULL || isProjectileDetonation) + if (getProjectileTemplate() == nullptr || isProjectileDetonation) { SimpleObjectIterator *iter; Object *curVictim; @@ -1371,11 +1371,11 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co } else { - //DEBUG_ASSERTCRASH(primaryVictim != NULL, ("weapons without radii should always pass in specific victims")); + //DEBUG_ASSERTCRASH(primaryVictim != nullptr, ("weapons without radii should always pass in specific victims")); // check against victimID rather than primaryVictim, since we may have targeted a legitimate victim // that got killed before the damage was dealt... (srj) //DEBUG_ASSERTCRASH(victimID != 0, ("weapons without radii should always pass in specific victims")); - iter = NULL; + iter = nullptr; curVictim = primaryVictim; curVictimDistSqr = 0.0f; @@ -1394,10 +1394,10 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co } MemoryPoolObjectHolder hold(iter); - for (; curVictim != NULL; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : NULL) + for (; curVictim != nullptr; curVictim = iter ? iter->nextWithNumeric(&curVictimDistSqr) : nullptr) { Bool killSelf = false; - if (source != NULL) + if (source != nullptr) { // anytime something is designated as the "primary victim" (ie, the direct target // of the weapon), we ignore all the "affects" flags. @@ -1479,7 +1479,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co Real allowedAngle = getRadiusDamageAngle(); if( allowedAngle < PI ) { - if( curVictim == NULL || source == NULL ) + if( curVictim == nullptr || source == nullptr ) continue; // We are directional damage, but can't figure out our direction. Just bail. // People can only be hit in a cone oriented as the firer is oriented @@ -1545,7 +1545,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co for (BehaviorModule** u = source->getBehaviorModules(); *u; ++u) { ProjectileUpdateInterface* pui = (*u)->getProjectileUpdateInterface(); - if (pui != NULL) + if (pui != nullptr) { damageInfo.in.m_sourceID = pui->projectileGetLauncherID(); break; @@ -1598,7 +1598,7 @@ void WeaponStore::handleProjectileDetonation(const WeaponTemplate* wt, const Obj //------------------------------------------------------------------------------------------------- void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object *source, const Coord3D* pos) { - if (wt == NULL) + if (wt == nullptr) return; Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1610,7 +1610,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object *source, Object *target) { //CRCDEBUG_LOG(("WeaponStore::createAndFireTempWeapon() for %s", DescribeObject(source))); - if (wt == NULL) + if (wt == nullptr) return; Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1622,9 +1622,9 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object const WeaponTemplate *WeaponStore::findWeaponTemplate( const AsciiString& name ) const { if (name.compareNoCase("None") == 0) - return NULL; + return nullptr; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); + DEBUG_ASSERTCRASH(wt != nullptr, ("Weapon %s not found!",name)); return wt; } @@ -1632,9 +1632,9 @@ const WeaponTemplate *WeaponStore::findWeaponTemplate( const AsciiString& name ) const WeaponTemplate *WeaponStore::findWeaponTemplate( const char* name ) const { if (stricmp(name, "None") == 0) - return NULL; + return nullptr; const WeaponTemplate * wt = findWeaponTemplatePrivate( TheNameKeyGenerator->nameToKey( name ) ); - DEBUG_ASSERTCRASH(wt != NULL, ("Weapon %s not found!",name)); + DEBUG_ASSERTCRASH(wt != nullptr, ("Weapon %s not found!",name)); return wt; } @@ -1646,7 +1646,7 @@ WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const if(it != m_weaponTemplateHashMap.end()) return it->second; - return NULL; + return nullptr; } @@ -1656,7 +1656,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -1672,7 +1672,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) WeaponTemplate *WeaponStore::newOverride(WeaponTemplate *weaponTemplate) { if (!weaponTemplate) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -2344,7 +2344,7 @@ Bool Weapon::isGoalPosWithinAttackRange(const Object *source, const Coord3D* goa // otherwise if it teters on the edge, attacks can fail. jba. Real attackRangeSqr = sqr(getAttackRange(source)-(PATHFIND_CELL_SIZE_F*0.25f)); - if (target != NULL) + if (target != nullptr) { if (target->isKindOf(KINDOF_BRIDGE)) { @@ -2450,7 +2450,7 @@ Real Weapon::getAttackDistance(const Object *source, const Object *victimObj, co { Real range = getAttackRange(source); - if (victimObj != NULL) + if (victimObj != nullptr) { #ifdef ATTACK_RANGE_IS_2D range += source->getGeometryInfo().getBoundingCircleRadius(); @@ -2489,12 +2489,12 @@ void Weapon::newProjectileFired(const Object *sourceObj, const Object *projectil return; // nope, no streak logic to do Object* projectileStream = TheGameLogic->findObjectByID(m_projectileStreamID); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) { m_projectileStreamID = INVALID_ID; // reset, since it might have been "valid" but deleted out from under us const ThingTemplate* pst = TheThingFactory->findTemplate(m_template->getProjectileStreamName()); projectileStream = TheThingFactory->newObject( pst, sourceObj->getControllingPlayer()->getDefaultTeam() ); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) return; m_projectileStreamID = projectileStream->getID(); } @@ -2522,7 +2522,7 @@ void Weapon::createLaser( const Object *sourceObj, const Object *victimObj, cons return; } Object* laser = TheThingFactory->newObject( pst, sourceObj->getControllingPlayer()->getDefaultTeam() ); - if( laser == NULL ) + if( laser == nullptr ) return; // Give it a good basis in reality to ensure it can draw when on screen. @@ -2686,7 +2686,7 @@ Bool Weapon::privateFireWeapon( if( victimObj ) { victimPos = victimObj->getPosition(); - victimObj = NULL; + victimObj = nullptr; } Coord3D targetPos = *victimPos; // need to copy, as this pointer is actually inside somebody potentially Int randomPick = GameLogicRandomValue( 0, m_scatterTargetsUnused.size() - 1 ); @@ -2791,7 +2791,7 @@ void Weapon::preFireWeapon( const Object *source, const Object *victim ) Bool Weapon::fireWeapon(const Object *source, Object *target, ObjectID* projectileID) { //CRCDEBUG_LOG(("Weapon::fireWeapon() for %s at %s", DescribeObject(source).str(), DescribeObject(target).str())); - return privateFireWeapon( source, target, NULL, false, false, 0, projectileID, TRUE ); + return privateFireWeapon( source, target, nullptr, false, false, 0, projectileID, TRUE ); } //------------------------------------------------------------------------------------------------- @@ -2799,21 +2799,21 @@ Bool Weapon::fireWeapon(const Object *source, Object *target, ObjectID* projecti Bool Weapon::fireWeapon(const Object *source, const Coord3D* pos, ObjectID* projectileID) { //CRCDEBUG_LOG(("Weapon::fireWeapon() for %s", DescribeObject(source).str())); - return privateFireWeapon( source, NULL, pos, false, false, 0, projectileID, TRUE ); + return privateFireWeapon( source, nullptr, pos, false, false, 0, projectileID, TRUE ); } //------------------------------------------------------------------------------------------------- void Weapon::fireProjectileDetonationWeapon(const Object *source, Object *target, WeaponBonusConditionFlags extraBonusFlags, Bool inflictDamage ) { //CRCDEBUG_LOG(("Weapon::fireProjectileDetonationWeapon() for %sat %s", DescribeObject(source).str(), DescribeObject(target).str())); - privateFireWeapon( source, target, NULL, true, false, extraBonusFlags, NULL, inflictDamage ); + privateFireWeapon( source, target, nullptr, true, false, extraBonusFlags, nullptr, inflictDamage ); } //------------------------------------------------------------------------------------------------- void Weapon::fireProjectileDetonationWeapon(const Object *source, const Coord3D* pos, WeaponBonusConditionFlags extraBonusFlags, Bool inflictDamage ) { //CRCDEBUG_LOG(("Weapon::fireProjectileDetonationWeapon() for %s", DescribeObject(source).str())); - privateFireWeapon( source, NULL, pos, true, false, extraBonusFlags, NULL, inflictDamage ); + privateFireWeapon( source, nullptr, pos, true, false, extraBonusFlags, nullptr, inflictDamage ); } //------------------------------------------------------------------------------------------------- @@ -2827,7 +2827,7 @@ Object* Weapon::forceFireWeapon( const Object *source, const Coord3D *pos) //Fire the weapon at the position. Internally, it'll store the weapon projectile ID if so created. ObjectID projectileID = INVALID_ID; const Bool ignoreRange = true; - privateFireWeapon(source, NULL, pos, false, ignoreRange, NULL, &projectileID, TRUE ); + privateFireWeapon(source, nullptr, pos, false, ignoreRange, 0, &projectileID, TRUE ); return TheGameLogic->findObjectByID( projectileID ); } @@ -2955,8 +2955,8 @@ class AssistanceRequestData //------------------------------------------------------------------------------------------------- AssistanceRequestData::AssistanceRequestData() { - m_requestingObject = NULL; - m_victimObject = NULL; + m_requestingObject = nullptr; + m_victimObject = nullptr; m_requestDistanceSquared = 0.0f; } @@ -2981,7 +2981,7 @@ static void makeAssistanceRequest( Object *requestOf, void *userData ) // and respond to requests static const NameKeyType key_assistUpdate = NAMEKEY("AssistedTargetingUpdate"); AssistedTargetingUpdate *assistModule = (AssistedTargetingUpdate*)requestOf->findUpdateModule(key_assistUpdate); - if( assistModule == NULL ) + if( assistModule == nullptr ) return; // and say yes @@ -3042,7 +3042,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v Coord3D turretRotPos = {0.0f, 0.0f, 0.0f}; Coord3D turretPitchPos = {0.0f, 0.0f, 0.0f}; const Drawable* draw = launcher->getDrawable(); - //CRCDEBUG_LOG(("Do we have a drawable? %d", (draw != NULL))); + //CRCDEBUG_LOG(("Do we have a drawable? %d", (draw != nullptr))); if (!draw || !draw->getProjectileLaunchOffset(wslot, specificBarrelToUse, &attachTransform, tur, &turretRotPos, &turretPitchPos)) { //CRCDEBUG_LOG(("ProjectileLaunchPos %d %d not found!",wslot, specificBarrelToUse)); @@ -3083,7 +3083,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v // DEBUG_ASSERTCRASH( muzzleHeight > 0.001f, ("YOUR TURRET HAS A VERY LOW PROJECTILE LAUNCH POSITION, BUT FOUND A VALID BONE. DID YOU PICK THE WRONG ONE? %s", launcher->getTemplate()->getName().str())); //#endif - launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); + launcher->convertBonePosToWorldPos(nullptr, &attachTransform, nullptr, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); worldPos.x = tmp.X; @@ -3103,7 +3103,7 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v //DescribeObject(projectile).str(), DescribeObject(launcher).str())); // if our launch vehicle is gone, destroy ourselves - if (launcher == NULL) + if (launcher == nullptr) { TheGameLogic->destroyObject( projectile ); return; @@ -3140,7 +3140,7 @@ void Weapon::getFiringLineOfSightOrigin(const Object* source, Coord3D& origin) c origin.z += source->getGeometryInfo().getMaxHeightAbovePosition(); /* - if (m_template->getProjectileTemplate() == NULL) + if (m_template->getProjectileTemplate() == nullptr) { // note that we want to measure from the top of the collision // shape, not the bottom! (most objects have eyes a lot closer @@ -3174,7 +3174,7 @@ Bool Weapon::isClearFiringLineOfSightTerrain(const Object* source, const Object* //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain() - victimPos is (%g,%g,%g) (%X,%X,%X)", // victimPos.x, victimPos.y, victimPos.z, // AS_INT(victimPos.x),AS_INT(victimPos.y),AS_INT(victimPos.z))); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -3186,7 +3186,7 @@ Bool Weapon::isClearFiringLineOfSightTerrain(const Object* source, const Coord3D //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain(Coord3D) for %s", DescribeObject(source).str())); //DUMPCOORD3D(&origin); getFiringLineOfSightOrigin(source, origin); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -3200,7 +3200,7 @@ Bool Weapon::isClearGoalFiringLineOfSightTerrain(const Object* source, const Coo getFiringLineOfSightOrigin(source, origin); Coord3D victimPos; victim->getGeometryInfo().getCenterPosition( *victim->getPosition(), victimPos ); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -3215,7 +3215,7 @@ Bool Weapon::isClearGoalFiringLineOfSightTerrain(const Object* source, const Coo //CRCDEBUG_LOG(("Weapon::isClearFiringLineOfSightTerrain() - victimPos is (%g,%g,%g) (%X,%X,%X)", // victimPos.x, victimPos.y, victimPos.z, // AS_INT(victimPos.x),AS_INT(victimPos.y),AS_INT(victimPos.z))); - return ThePartitionManager->isClearLineOfSightTerrain(NULL, origin, NULL, victimPos); + return ThePartitionManager->isClearLineOfSightTerrain(nullptr, origin, nullptr, victimPos); } //------------------------------------------------------------------------------------------------- @@ -3451,7 +3451,7 @@ void Weapon::xfer( Xfer *xfer ) if (xfer->getXferMode() == XFER_LOAD) { m_template = TheWeaponStore->findWeaponTemplate(tmplName); - if (m_template == NULL) + if (m_template == nullptr) throw INI_INVALID_DATA; } } @@ -3548,7 +3548,7 @@ void Weapon::loadPostProcess( void ) if( m_projectileStreamID != INVALID_ID ) { Object* projectileStream = TheGameLogic->findObjectByID( m_projectileStreamID ); - if( projectileStream == NULL ) + if( projectileStream == nullptr ) { m_projectileStreamID = INVALID_ID; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 79235cd92b4..a8303e7760d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -79,7 +79,7 @@ const char* const WeaponSetFlags::s_bitNameList[] = "WEAPON_RIDER7", "WEAPON_RIDER8", - NULL + nullptr }; static_assert(ARRAY_SIZE(WeaponSetFlags::s_bitNameList) == WeaponSetFlags::NumBits + 1, "Incorrect array size"); @@ -103,7 +103,7 @@ void WeaponTemplateSet::clear() m_types.clear(); for (int i = 0; i < WEAPONSLOT_COUNT; ++i) { - m_template[i] = NULL; + m_template[i] = nullptr; m_autoChooseMask[i] = 0xffffffff; // by default, allow autochoosing from any CommandSource CLEAR_KINDOFMASK(m_preferredAgainst[i]); // by default, weapon isn't preferred against anything in particular } @@ -125,7 +125,7 @@ void WeaponTemplateSet::parseWeapon(INI* ini, void *instance, void * /*store*/, { WeaponTemplateSet* self = (WeaponTemplateSet*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - INI::parseWeaponTemplate(ini, instance, &self->m_template[wslot], NULL); + INI::parseWeaponTemplate(ini, instance, &self->m_template[wslot], nullptr); } //------------------------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ void WeaponTemplateSet::parsePreferredAgainst(INI* ini, void *instance, void * / { WeaponTemplateSet* self = (WeaponTemplateSet*)instance; WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames); - KindOfMaskType::parseFromINI(ini, instance, &self->m_preferredAgainst[wslot], NULL); + KindOfMaskType::parseFromINI(ini, instance, &self->m_preferredAgainst[wslot], nullptr); } //------------------------------------------------------------------------------------------------- @@ -149,13 +149,13 @@ void WeaponTemplateSet::parseWeaponTemplateSet( INI* ini, const ThingTemplate* t { static const FieldParse myFieldParse[] = { - { "Conditions", WeaponSetFlags::parseFromINI, NULL, offsetof( WeaponTemplateSet, m_types ) }, - { "Weapon", WeaponTemplateSet::parseWeapon, NULL, 0 }, - { "AutoChooseSources", WeaponTemplateSet::parseAutoChoose, NULL, 0 }, - { "PreferredAgainst", WeaponTemplateSet::parsePreferredAgainst, NULL, 0 }, - { "ShareWeaponReloadTime", INI::parseBool, NULL, offsetof( WeaponTemplateSet, m_isReloadTimeShared ) }, - { "WeaponLockSharedAcrossSets", INI::parseBool, NULL, offsetof( WeaponTemplateSet, m_isWeaponLockSharedAcrossSets ) }, - { 0, 0, 0, 0 } + { "Conditions", WeaponSetFlags::parseFromINI, nullptr, offsetof( WeaponTemplateSet, m_types ) }, + { "Weapon", WeaponTemplateSet::parseWeapon, nullptr, 0 }, + { "AutoChooseSources", WeaponTemplateSet::parseAutoChoose, nullptr, 0 }, + { "PreferredAgainst", WeaponTemplateSet::parsePreferredAgainst, nullptr, 0 }, + { "ShareWeaponReloadTime", INI::parseBool, nullptr, offsetof( WeaponTemplateSet, m_isReloadTimeShared ) }, + { "WeaponLockSharedAcrossSets", INI::parseBool, nullptr, offsetof( WeaponTemplateSet, m_isWeaponLockSharedAcrossSets ) }, + { nullptr, nullptr, nullptr, 0 } }; ini->initFromINI(this, myFieldParse); @@ -177,14 +177,14 @@ WeaponSet::WeaponSet() { m_curWeapon = PRIMARY_WEAPON; m_curWeaponLockedStatus = NOT_LOCKED; - m_curWeaponTemplateSet = NULL; + m_curWeaponTemplateSet = nullptr; m_filledWeaponSlotMask = 0; m_totalAntiMask = 0; m_totalDamageTypeMask.clear(); m_hasPitchLimit = false; m_hasDamageWeapon = false; for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) - m_weapons[i] = NULL; + m_weapons[i] = nullptr; } //------------------------------------------------------------------------------------------------- @@ -224,16 +224,16 @@ void WeaponSet::xfer( Xfer *xfer ) if (ttName.isEmpty()) { - m_curWeaponTemplateSet = NULL; + m_curWeaponTemplateSet = nullptr; } else { const ThingTemplate* tt = TheThingFactory->findTemplate(ttName); - if (tt == NULL) + if (tt == nullptr) throw INI_INVALID_DATA; m_curWeaponTemplateSet = tt->findWeaponTemplateSet(wsFlags); - if (m_curWeaponTemplateSet == NULL) + if (m_curWeaponTemplateSet == nullptr) throw INI_INVALID_DATA; } } @@ -241,10 +241,10 @@ void WeaponSet::xfer( Xfer *xfer ) { AsciiString ttName; // leave 'em empty in case we're null WeaponSetFlags wsFlags; - if (m_curWeaponTemplateSet != NULL) + if (m_curWeaponTemplateSet != nullptr) { const ThingTemplate* tt = m_curWeaponTemplateSet->friend_getThingTemplate(); - if (tt == NULL) + if (tt == nullptr) throw INI_INVALID_DATA; ttName = tt->getName(); @@ -256,14 +256,14 @@ void WeaponSet::xfer( Xfer *xfer ) for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) { - Bool hasWeaponInSlot = (m_weapons[i] != NULL); + Bool hasWeaponInSlot = (m_weapons[i] != nullptr); xfer->xferBool(&hasWeaponInSlot); if (hasWeaponInSlot) { - if (xfer->getXferMode() == XFER_LOAD && m_weapons[i] == NULL) + if (xfer->getXferMode() == XFER_LOAD && m_weapons[i] == nullptr) { const WeaponTemplate* wt = m_curWeaponTemplateSet->getNth((WeaponSlotType)i); - if (wt==NULL) { + if (wt==nullptr) { DEBUG_CRASH(("xfer backwards compatibility code - old save file??? jba.")); wt = m_curWeaponTemplateSet->getNth((WeaponSlotType)0); } @@ -312,7 +312,7 @@ void WeaponSet::updateWeaponSet(const Object* obj) for (Int i = WEAPONSLOT_COUNT - 1; i >= PRIMARY_WEAPON ; --i) { deleteInstance(m_weapons[i]); - m_weapons[i] = NULL; + m_weapons[i] = nullptr; if (set->getNth((WeaponSlotType)i)) { @@ -561,7 +561,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac // if the victim is contained within an enclosing container, it cannot be attacked directly const Object* victimsContainer = victim->getContainedBy(); - if (victimsContainer != NULL && victimsContainer->getContain()->isEnclosingContainerFor(victim) == TRUE) + if (victimsContainer != nullptr && victimsContainer->getContain()->isEnclosingContainerFor(victim) == TRUE) { return ATTACKRESULT_NOT_POSSIBLE; } @@ -645,7 +645,7 @@ CanAttackResult WeaponSet::getAbleToUseWeaponAgainstTarget( AbleToAttackType att continue; Bool handled = FALSE; - ContainModuleInterface *contain = containedBy ? containedBy->getContain() : NULL; + ContainModuleInterface *contain = containedBy ? containedBy->getContain() : nullptr; if( contain && contain->isGarrisonable() && contain->isEnclosingContainerFor( source )) { // non enclosing garrison containers do not use firepoints. Lorenzen, 6/11/03 //For contained things, we need to fake-move objects to the best garrison point in order @@ -799,7 +799,7 @@ Bool WeaponSet::chooseBestWeaponForTarget(const Object* obj, const Object* victi if( isCurWeaponLocked() ) return TRUE; // I have been forced into choosing a specific weapon, so it is right until someone says otherwise - if (victim == NULL) + if (victim == nullptr) { // Weapon lock is checked first for specific attack- ground powers. Otherwise, we will reproduce the old behavior // and make only Primary attack the ground. @@ -840,7 +840,7 @@ Bool WeaponSet::chooseBestWeaponForTarget(const Object* obj, const Object* victi } Weapon* weapon = m_weapons[i]; - if (weapon == NULL) + if (weapon == nullptr) continue; // No bad wrong! Being out of range does not mean this weapon can not affect the target! @@ -971,7 +971,7 @@ void WeaponSet::reloadAllAmmo(const Object *obj, Bool now) for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { Weapon* weapon = m_weapons[i]; - if (weapon != NULL) + if (weapon != nullptr) { if (now) weapon->loadAmmoNow(obj); @@ -987,7 +987,7 @@ Bool WeaponSet::isOutOfAmmo() const for( Int i = 0; i < WEAPONSLOT_COUNT; i++ ) { const Weapon* weapon = m_weapons[i]; - if (weapon == NULL) + if (weapon == nullptr) continue; if (weapon->getStatus() != OUT_OF_AMMO) { @@ -1008,7 +1008,7 @@ const Weapon* WeaponSet::findAmmoPipShowingWeapon() const return weapon; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1021,7 +1021,7 @@ Weapon* WeaponSet::findWaypointFollowingCapableWeapon() return m_weapons[i]; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1059,7 +1059,7 @@ Bool WeaponSet::setWeaponLock( WeaponSlotType weaponSlot, WeaponLockType lockTyp // Verify the asked for weapon exists , choose it, and then lock it as choosen until unlocked // the old code was just plain wrong. (look at it in perforce and you'll see...) - if (m_weapons[weaponSlot] != NULL) + if (m_weapons[weaponSlot] != nullptr) { if( lockType == LOCKED_PERMANENTLY ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 753a0d57cec..7d244708774 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -121,8 +121,8 @@ static void updateTeamAndPlayerStuff( Object *obj, void *userData ) #define REALLY_FAR (100000 * MAP_XY_FACTOR) // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptActionsInterface *TheScriptActions = NULL; -GameWindow *ScriptActions::m_messageWindow = NULL; +ScriptActionsInterface *TheScriptActions = nullptr; +GameWindow *ScriptActions::m_messageWindow = nullptr; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- @@ -178,7 +178,7 @@ void ScriptActions::closeWindows( Bool suppressNewWindows ) if (m_messageWindow) { TheWindowManager->winDestroy(m_messageWindow); - m_messageWindow = NULL; + m_messageWindow = nullptr; } } @@ -508,7 +508,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS Bool needToMoveToDestination = false; //Validate the waypoint Waypoint *way = TheTerrainLogic->getWaypointByName(waypoint); - if (way==NULL) + if (way==nullptr) { return; } @@ -530,7 +530,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Create the team (not the units inside team). Team *theTeam = TheTeamFactory->createInactiveTeam( team ); - if (theTeam==NULL) { + if (theTeam==nullptr) { return; } const ThingTemplate *transportTemplate; @@ -538,8 +538,8 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Create the transport first (if applicable), so we can determine if it has paradrop capabilities. //If so, we'll be doing a lot of things differently! - Object *transport=NULL; - ContainModuleInterface *contain = NULL; + Object *transport=nullptr; + ContainModuleInterface *contain = nullptr; transportTemplate = TheThingFactory->findTemplate( pInfo->m_transportUnitType ); if( transportTemplate ) { @@ -556,7 +556,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Check to see if we have a transport, and if our transport has paradrop capabilities. If this is the //case, we'll need to create each unit inside "parachute containers". static NameKeyType key_DeliverPayloadAIUpdate = NAMEKEY("DeliverPayloadAIUpdate"); - DeliverPayloadAIUpdate *dp = NULL; + DeliverPayloadAIUpdate *dp = nullptr; if( transport ) { dp = (DeliverPayloadAIUpdate*)transport->findUpdateModule(key_DeliverPayloadAIUpdate); @@ -564,7 +564,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS //Our tranport has a deliverPayload update module. This means it'll do airborned drops. - const ThingTemplate* putInContainerTemplate = NULL; + const ThingTemplate* putInContainerTemplate = nullptr; if( dp ) { //Check to see if we are packaging our units @@ -580,7 +580,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS Coord3D pos = origin; if (unitTemplate && theTeam) { - Object *obj = NULL; + Object *obj = nullptr; for (j=0; jm_unitsInfo[i].maxUnits; j++) { // create new object in the world @@ -655,7 +655,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS } } - contain = NULL; + contain = nullptr; if( transport ) { contain = transport->getContain(); @@ -674,7 +674,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS // it's our transport. continue; } - if (obj->getContainedBy() != NULL) + if (obj->getContainedBy() != nullptr) { continue; } @@ -848,10 +848,10 @@ void ScriptActions::doOversizeTheTerrain(Int amount) void ScriptActions::doSetupCamera(const AsciiString& waypoint, Real zoom, Real pitch, const AsciiString& lookAtWaypoint) { Waypoint *way = TheTerrainLogic->getWaypointByName(waypoint); - if (way==NULL) return; + if (way==nullptr) return; Coord3D pos = *way->getLocation(); Waypoint *lookat = TheTerrainLogic->getWaypointByName(lookAtWaypoint); - if (lookat==NULL) return; + if (lookat==nullptr) return; Coord3D destination = *lookat->getLocation(); TheTacticalView->moveCameraTo(&pos, 0, 0, true, 0.0f, 0.0f); TheTacticalView->cameraModLookToward(&destination); @@ -955,7 +955,7 @@ void ScriptActions::doRotateCameraTowardObject(const AsciiString& unitName, Real void ScriptActions::doRotateCameraTowardWaypoint(const AsciiString& waypointName, Real sec, Real easeIn, Real easeOut, Bool reverseRotation) { Waypoint *way = TheTerrainLogic->getWaypointByName(waypointName); - if (way==NULL) return; + if (way==nullptr) return; TheTacticalView->rotateCameraTowardPosition(way->getLocation(), sec*1000.0f, easeIn*1000.0f, easeOut*1000.0f, reverseRotation); } @@ -977,7 +977,7 @@ void ScriptActions::doMoveCameraAlongWaypointPath(const AsciiString& waypoint, R //------------------------------------------------------------------------------------------------- void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiString& thingName, const AsciiString& teamName, Coord3D *pos, Real angle ) { - Object* pOldObj = NULL; + Object* pOldObj = nullptr; if (objectName != m_unnamedUnit) { pOldObj = TheScriptEngine->getUnitNamed(objectName); @@ -995,7 +995,7 @@ void ScriptActions::doCreateObject(const AsciiString& objectName, const AsciiStr Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); // The team is the team based on the name, and the calling team (if any) and the team that // triggered the condition. jba. :) - if (theTeam==NULL) { + if (theTeam==nullptr) { // We may need to create the team. theTeam = TheTeamFactory->createTeam( teamName ); } @@ -1049,7 +1049,7 @@ void ScriptActions::doAttack(const AsciiString& attackerName, const AsciiString& const Team *victimTeam = TheScriptEngine->getTeamNamed( victimName ); // sanity - if( attackingTeam == NULL || victimTeam == NULL ) + if( attackingTeam == nullptr || victimTeam == nullptr ) return; AIGroupPtr aiGroup = TheAI->createGroup(); @@ -1186,7 +1186,7 @@ void ScriptActions::createUnitOnTeamAt(const AsciiString& unitName, const AsciiS Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); // The team is the team based on the name, and the calling team (if any) and the team that // triggered the condition. jba. :) - if (theTeam==NULL) { + if (theTeam==nullptr) { // We may need to create the team. theTeam = TheTeamFactory->createTeam( teamName ); } @@ -1723,7 +1723,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName Coord3D pos; pos.x=pos.y=pos.z=0; - Object *firstUnit=NULL; + Object *firstUnit=nullptr; // Get the center point for the team for (DLINK_ITERATOR iter = theTeam->iterate_TeamMemberList(); !iter.done(); iter.advance()) { @@ -1733,7 +1733,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName pos.y += objPos.y; pos.z += objPos.z; // Not actually used by getClosestWaypointOnPath, but hey, might as well be correct. count++; - if (firstUnit==NULL) { + if (firstUnit==nullptr) { firstUnit = obj; } } @@ -1743,7 +1743,7 @@ void ScriptActions::doTeamFollowSkirmishApproachPath(const AsciiString& teamName pos.z /= count; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer==NULL) return; + if (enemyPlayer==nullptr) return; Int mpNdx = enemyPlayer->getMpStartIndex()+1; AsciiString pathLabel; @@ -1806,7 +1806,7 @@ void ScriptActions::doTeamMoveToSkirmishApproachPath(const AsciiString& teamName pos.z /= count; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer==NULL) return; + if (enemyPlayer==nullptr) return; Int mpNdx = enemyPlayer->getMpStartIndex()+1; AsciiString pathLabel; @@ -2679,7 +2679,7 @@ void ScriptActions::doCameoFlash(const AsciiString& name, Int timeInSeconds) //sanity button = TheControlBar->findCommandButton( name ); - if( button == NULL ) + if( button == nullptr ) { DEBUG_CRASH(( "ScriptActions::doCameoFlash can't find AsciiString cameoflash" )); return; @@ -2741,7 +2741,7 @@ void ScriptActions::doNamedFlash(const AsciiString& unitName, Int timeInSeconds, Int frames = LOGICFRAMES_PER_SECOND * timeInSeconds; // every time the framecount % 20 == 0, drawable::update will call doNamedFlash Int count = frames / DRAWABLE_FRAMES_PER_FLASH; - Color flashy = (color == NULL) ? obj->getIndicatorColor() : color->getAsInt(); + Color flashy = (color == nullptr) ? obj->getIndicatorColor() : color->getAsInt(); drawable->setFlashColor( flashy ); drawable->setFlashCount( count ); return; @@ -2754,7 +2754,7 @@ void ScriptActions::doNamedFlash(const AsciiString& unitName, Int timeInSeconds, void ScriptActions::doTeamFlash(const AsciiString& teamName, Int timeInSeconds, const RGBColor *color) { Team *team = TheScriptEngine->getTeamNamed( teamName ); - if (team == NULL || !team->hasAnyObjects()) + if (team == nullptr || !team->hasAnyObjects()) return; DLINK_ITERATOR iter = team->iterate_TeamMemberList(); @@ -2773,7 +2773,7 @@ void ScriptActions::doTeamFlash(const AsciiString& teamName, Int timeInSeconds, Int frames = LOGICFRAMES_PER_SECOND * timeInSeconds; Int count = frames / DRAWABLE_FRAMES_PER_FLASH; - Color flashy = (color == NULL) ? obj->getIndicatorColor() : color->getAsInt(); + Color flashy = (color == nullptr) ? obj->getIndicatorColor() : color->getAsInt(); draw->setFlashColor( flashy ); draw->setFlashCount( count ); } @@ -2877,7 +2877,7 @@ void ScriptActions::doNamedTransferAssetsToPlayer(const AsciiString& unitName, c } pObj->setTeam(playerTeam); - updateTeamAndPlayerStuff(pObj, NULL); + updateTeamAndPlayerStuff(pObj, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2886,7 +2886,7 @@ void ScriptActions::doNamedTransferAssetsToPlayer(const AsciiString& unitName, c void ScriptActions::excludePlayerFromScoreScreen(const AsciiString& playerName) { Player *pPlayer = TheScriptEngine->getPlayerFromAsciiString(playerName); - if (pPlayer == NULL) { + if (pPlayer == nullptr) { return; } @@ -3224,7 +3224,7 @@ void ScriptActions::doMergeTeamIntoTeam(const AsciiString& teamSrcName, const As { Team *teamSrc = TheScriptEngine->getTeamNamed(teamSrcName); Team *teamDest = TheScriptEngine->getTeamNamed(teamDestName); - if (teamDest==NULL) { + if (teamDest==nullptr) { teamDest = TheTeamFactory->findTeam( teamDestName ); } if (!teamSrc || !teamDest) { @@ -3246,12 +3246,12 @@ void ScriptActions::doMergeTeamIntoTeam(const AsciiString& teamSrcName, const As nextObj = iter.cur(); iter.advance(); obj->setTeam(teamDest); - updateTeamAndPlayerStuff(obj, NULL); + updateTeamAndPlayerStuff(obj, nullptr); } if (nextObj) { nextObj->setTeam(teamDest); - updateTeamAndPlayerStuff(nextObj, NULL); + updateTeamAndPlayerStuff(nextObj, nullptr); } teamSrc->deleteTeam(); @@ -3480,7 +3480,7 @@ void ScriptActions::doTeamGarrisonNearestBuilding(const AsciiString& teamName) PartitionFilterSameMapStatus filterMapStatus(leader); filters[ count++ ] = &filterMapStatus; - filters[count++] = NULL; + filters[count++] = nullptr; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(leader, REALLY_FAR, FROM_CENTER_3D, filters, ITER_SORTED_NEAR_TO_FAR); MemoryPoolObjectHolder hold(iter); @@ -3534,7 +3534,7 @@ void ScriptActions::doTeamExitAllBuildings(const AsciiString& teamName) } ai->chooseLocomotorSet(LOCOMOTORSET_NORMAL); - ai->aiExit(NULL, CMD_FROM_SCRIPT); + ai->aiExit(nullptr, CMD_FROM_SCRIPT); } } @@ -3614,7 +3614,7 @@ void ScriptActions::doUnitGarrisonNearestBuilding(const AsciiString& unitName) filters[ count++ ] = &f3; } - filters[count++] = NULL; + filters[count++] = nullptr; ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(theUnit, REALLY_FAR, FROM_CENTER_3D, filters, ITER_SORTED_NEAR_TO_FAR); MemoryPoolObjectHolder hold(iter); @@ -3741,7 +3741,7 @@ void ScriptActions::doNamedSetBoobytrapped( const AsciiString& thingTemplateName const Matrix3D *transform = obj->getTransformMatrix(); transform->Transform_Vector( *transform, *(Vector3*)(&pos), (Vector3*)(&pos) ); - update->initStickyBomb( obj, NULL, &pos ); + update->initStickyBomb( obj, nullptr, &pos ); } } } @@ -3780,7 +3780,7 @@ void ScriptActions::doTeamSetBoobytrapped( const AsciiString& thingTemplateName, const Matrix3D *transform = obj->getTransformMatrix(); transform->Transform_Vector( *transform, *(Vector3*)(&pos), (Vector3*)(&pos) ); - update->initStickyBomb( obj, NULL, &pos ); + update->initStickyBomb( obj, nullptr, &pos ); } } } @@ -3803,7 +3803,7 @@ void ScriptActions::doUnitExitBuilding(const AsciiString& unitName) } ai->chooseLocomotorSet(LOCOMOTORSET_NORMAL); - ai->aiExit(NULL, CMD_FROM_SCRIPT); + ai->aiExit(nullptr, CMD_FROM_SCRIPT); } //------------------------------------------------------------------------------------------------- @@ -4062,7 +4062,7 @@ void ScriptActions::doTransferTeamToPlayer(const AsciiString& teamName, const As theTeam->setControllingPlayer(playerDest); // srj sez: ensure that all these guys get the upgrades that belong to the new player - theTeam->iterateObjects(updateTeamAndPlayerStuff, NULL); + theTeam->iterateObjects(updateTeamAndPlayerStuff, nullptr); } //------------------------------------------------------------------------------------------------- @@ -4234,11 +4234,11 @@ void ScriptActions::doSkirmishFireSpecialPowerAtMostCost( const AsciiString &pla { Int enemyNdx; Player *enemyPlayer = TheScriptEngine->getSkirmishEnemyPlayer(); - if (enemyPlayer == NULL) return; + if (enemyPlayer == nullptr) return; enemyNdx = enemyPlayer->getPlayerIndex(); const SpecialPowerTemplate *power = TheSpecialPowerStore->findSpecialPowerTemplate(specialPower); - if (power==NULL) + if (power==nullptr) return; Real radius = 50.0f; if (power->getRadiusCursorRadius()>radius) { @@ -4248,7 +4248,7 @@ void ScriptActions::doSkirmishFireSpecialPowerAtMostCost( const AsciiString &pla Player::PlayerTeamList::const_iterator it; Player *pPlayer = TheScriptEngine->getPlayerFromAsciiString(player); - if (pPlayer==NULL) + if (pPlayer==nullptr) return; @@ -4750,8 +4750,8 @@ void ScriptActions::doTeamRemoveAllOverrideRelations(const AsciiString& teamName Team *theTeam = TheScriptEngine->getTeamNamed( teamName ); if (theTeam) { // invalid ID is OK -- it removes all relationships - theTeam->removeOverrideTeamRelationship( NULL ); - theTeam->removeOverridePlayerRelationship( NULL ); + theTeam->removeOverrideTeamRelationship( TEAM_ID_INVALID ); + theTeam->removeOverridePlayerRelationship( PLAYER_INDEX_INVALID ); } } //------------------------------------------------------------------------------------------------- @@ -5020,11 +5020,11 @@ void ScriptActions::doBorderSwitch(Int borderToUse) * and re-reveal the map. BGC */ Int observerPlayerIndex = -1; - if (ThePlayerList != NULL) + if (ThePlayerList != nullptr) { Player *observer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); - if (observer != NULL) { + if (observer != nullptr) { observerPlayerIndex = observer->getPlayerIndex(); } } @@ -5055,7 +5055,7 @@ void ScriptActions::doForceObjectSelection(const AsciiString& teamName, const As return; } - Object *bestGuess = NULL; + Object *bestGuess = nullptr; for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { Object *obj = iter.cur(); @@ -5064,7 +5064,7 @@ void ScriptActions::doForceObjectSelection(const AsciiString& teamName, const As } if (obj->getTemplate() && obj->getTemplate()->getName() == objectType) { - if (bestGuess == NULL || obj->getID() < bestGuess->getID()) { // lower ID means its newer + if (bestGuess == nullptr || obj->getID() < bestGuess->getID()) { // lower ID means its newer bestGuess = obj; } } @@ -5092,7 +5092,7 @@ void* __cdecl killTheObject( Object *obj, void* userObj ) userObj; if (obj) obj->kill(); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5111,7 +5111,7 @@ void ScriptActions::doDestroyAllContained(const AsciiString& unitName, Int damag return; } - cmi->iterateContained((ContainIterateFunc)killTheObject, NULL, false); + cmi->iterateContained((ContainIterateFunc)killTheObject, nullptr, false); } //------------------------------------------------------------------------------------------------- @@ -5160,10 +5160,10 @@ static CaveInterface* findCave(Object* obj) for (BehaviorModule** i = obj->getBehaviorModules(); *i; ++i) { CaveInterface* c = (*i)->getCaveInterface(); - if (c != NULL) + if (c != nullptr) return c; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5178,7 +5178,7 @@ void ScriptActions::doSetCaveIndex( const AsciiString& caveName, Int caveIndex ) } CaveInterface *caveModule = findCave(obj); - if( caveModule == NULL ) + if( caveModule == nullptr ) return; caveModule->tryToSetCaveIndex( caveIndex ); @@ -5197,7 +5197,7 @@ void ScriptActions::doSetWarehouseValue( const AsciiString& warehouseName, Int c static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" ); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey ); - if( warehouseModule == NULL ) + if( warehouseModule == nullptr ) return; warehouseModule->setCashValue( cashValue ); @@ -5262,7 +5262,7 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const return; } - Object *bestObj = NULL; + Object *bestObj = nullptr; const ThingTemplate *templ = TheThingFactory->findTemplate( objectType, FALSE ); if( templ ) @@ -5271,7 +5271,7 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const PartitionFilterPolygonTrigger acceptWithin(trig); PartitionFilterSameMapStatus filterMapStatus(obj); - PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, nullptr }; bestObj = ThePartitionManager->getClosestObject( obj->getPosition(), REALLY_FAR, FROM_CENTER_2D, filters ); if( !bestObj ) @@ -5298,7 +5298,7 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const if( thisType ) { PartitionFilterThing f2( thisType, true ); - PartitionFilter *filters[] = { &f2, &acceptWithin, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f2, &acceptWithin, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject( &pos, REALLY_FAR, FROM_CENTER_2D, filters, &dist ); if( obj ) @@ -5336,7 +5336,7 @@ void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const } //Get the first object (to use in the partition filter checks). - Object *teamObj = NULL; + Object *teamObj = nullptr; DLINK_ITERATOR iter = team->iterate_TeamMemberList(); for (; !iter.done(); iter.advance()) { @@ -5358,14 +5358,14 @@ void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const Coord3D teamPos = *team->getEstimateTeamPosition(); PartitionFilterSameMapStatus filterMapStatus( teamObj ); PartitionFilterPolygonTrigger acceptWithin( trig ); - Object *bestObj = NULL; + Object *bestObj = nullptr; const ThingTemplate *templ = TheThingFactory->findTemplate( objectType, FALSE ); if( templ ) { //Find the closest specified template. PartitionFilterThing thingsToAccept( templ, true ); - PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, nullptr }; bestObj = ThePartitionManager->getClosestObject( &teamPos, REALLY_FAR, FROM_CENTER_2D, filters ); if (!bestObj) { @@ -5387,7 +5387,7 @@ void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const if( thisType ) { PartitionFilterThing thingToAccept( thisType, true ); - PartitionFilter *filters[] = { &thingToAccept, &acceptWithin, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &thingToAccept, &acceptWithin, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject( &teamPos, REALLY_FAR, FROM_CENTER_2D, filters, &dist ); if( obj ) @@ -5498,7 +5498,7 @@ void ScriptActions::doSkirmishCommandButtonOnMostValuable( const AsciiString& te return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5516,7 +5516,7 @@ void ScriptActions::doSkirmishCommandButtonOnMostValuable( const AsciiString& te PartitionFilterValidCommandButtonTarget f2(srcObj, commandButton, true, CMD_FROM_SCRIPT); PartitionFilterSameMapStatus filterMapStatus(srcObj); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; // @todo: Should we add the group's radius to the range? Seems like a possibility. SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(&pos, range, FROM_CENTER_2D, filters, ITER_SORTED_EXPENSIVE_TO_CHEAP); MemoryPoolObjectHolder hold(iter); @@ -5561,7 +5561,7 @@ void ScriptActions::doTeamUseCommandButtonOnNamed( const AsciiString& teamName, return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5577,7 +5577,7 @@ void ScriptActions::doTeamUseCommandButtonOnNamed( const AsciiString& teamName, return; } - if (commandButton->isValidToUseOn(srcObj, obj, NULL, CMD_FROM_SCRIPT)) { + if (commandButton->isValidToUseOn(srcObj, obj, nullptr, CMD_FROM_SCRIPT)) { theGroup->groupDoCommandButtonAtObject(commandButton, obj, CMD_FROM_SCRIPT); } } @@ -5604,7 +5604,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestEnemy( const AsciiString& tea return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5622,7 +5622,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestEnemy( const AsciiString& tea Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5654,7 +5654,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestGarrisonedBuilding( const Asc return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5674,7 +5674,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestGarrisonedBuilding( const Asc Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5706,7 +5706,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestKindof( const AsciiString& te return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5725,7 +5725,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestKindof( const AsciiString& te Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5757,7 +5757,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuilding( const AsciiString& return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5776,7 +5776,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuilding( const AsciiString& Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5808,7 +5808,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuildingClass( const AsciiStr return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5828,7 +5828,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestBuildingClass( const AsciiStr Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -5860,7 +5860,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString return; } - Object *srcObj = NULL; + Object *srcObj = nullptr; if (commandButton->getSpecialPowerTemplate()) { srcObj = theGroup->getSpecialPowerSourceObject(commandButton->getSpecialPowerTemplate()->getID()); } else { @@ -5871,7 +5871,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString return; } - Object *bestObj = NULL; + Object *bestObj = nullptr; //First look for a specific object type (object lists will fail) const ThingTemplate *thingTemplate = TheThingFactory->findTemplate( objectType, FALSE ); @@ -5881,7 +5881,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString PartitionFilterThing f2(thingTemplate, true); PartitionFilterValidCommandButtonTarget f3(srcObj, commandButton, true, CMD_FROM_SCRIPT); PartitionFilterSameMapStatus filterMapStatus(srcObj); - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; Coord3D pos; theGroup->getCenter(&pos); @@ -5913,7 +5913,7 @@ void ScriptActions::doTeamUseCommandButtonOnNearestObjectType( const AsciiString if( thisType ) { PartitionFilterThing f2( thisType, true ); - PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &f4, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters, &dist ); if( obj ) @@ -5958,7 +5958,7 @@ void ScriptActions::doTeamPartialUseCommandButton( Real percentage, const AsciiS for (iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { Object *obj = iter.cur(); - if (commandButton->isValidToUseOn(obj, NULL, NULL, CMD_FROM_SCRIPT)) { + if (commandButton->isValidToUseOn(obj, nullptr, nullptr, CMD_FROM_SCRIPT)) { objList.push_back(obj); } } @@ -6001,7 +6001,7 @@ void ScriptActions::doTeamCaptureNearestUnownedFactionUnit( const AsciiString& t Coord3D pos; theGroup->getCenter(&pos); - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; Object *obj = ThePartitionManager->getClosestObject(&pos, REALLY_FAR, FROM_CENTER_2D, filters); if (!obj) { return; @@ -6230,7 +6230,7 @@ void ScriptActions::doC3CameraShake ) { Waypoint *way = TheTerrainLogic->getWaypointByName(waypointName); - DEBUG_ASSERTLOG( (way != NULL), ("Camera shake with No Valid Waypoint") ); + DEBUG_ASSERTLOG( (way != nullptr), ("Camera shake with No Valid Waypoint") ); Coord3D pos = *way->getLocation(); TheTacticalView->Add_Camera_Shake(pos, radius, duration_seconds, amplitude); @@ -6432,7 +6432,7 @@ void ScriptActions::doRemoveCommandBarButton(const AsciiString& buttonName, cons if (slotNum >= 0) { - TheGameLogic->setControlBarOverride(templ->friend_getCommandSetString(), slotNum, NULL); + TheGameLogic->setControlBarOverride(templ->friend_getCommandSetString(), slotNum, nullptr); } } @@ -6445,7 +6445,7 @@ void ScriptActions::doAddCommandBarButton(const AsciiString& buttonName, const A } const CommandButton *commandButton = TheControlBar->findCommandButton( buttonName ); - if (commandButton == NULL) + if (commandButton == nullptr) { // not here. use doRemoveCommandBarButton to remove one. return; @@ -6903,10 +6903,10 @@ void ScriptActions::executeAction( ScriptAction *pAction ) doCameoFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt()); return; case ScriptAction::NAMED_FLASH: - doNamedFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), NULL); + doNamedFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), nullptr); return; case ScriptAction::TEAM_FLASH: - doTeamFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), NULL); + doTeamFlash(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt(), nullptr); return; case ScriptAction::NAMED_FLASH_WHITE: { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 23020d21599..a85f03d9887 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -66,7 +66,7 @@ class ObjectTypesTemp public: ObjectTypes* m_types; - ObjectTypesTemp() : m_types(NULL) + ObjectTypesTemp() : m_types(nullptr) { m_types = newInstance(ObjectTypes); } @@ -93,7 +93,7 @@ namespace rts }; // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptConditionsInterface *TheScriptConditions = NULL; +ScriptConditionsInterface *TheScriptConditions = nullptr; class TransportStatus : public MemoryPoolObject { @@ -105,7 +105,7 @@ class TransportStatus : public MemoryPoolObject Int m_unitCount; public: - TransportStatus() : m_objID(INVALID_ID), m_frameNumber(0), m_unitCount(0), m_nextStatus(NULL) {} + TransportStatus() : m_objID(INVALID_ID), m_frameNumber(0), m_unitCount(0), m_nextStatus(nullptr) {} //~TransportStatus(); }; @@ -149,7 +149,7 @@ void ScriptConditions::reset( void ) { deleteInstance(s_transportStatuses); - s_transportStatuses = NULL; + s_transportStatuses = nullptr; // Empty for now. jba. } @@ -170,7 +170,7 @@ parameter so we don't have to do a name search. May return null if the player d Player *ScriptConditions::playerFromParam(Parameter *pSideParm) { DEBUG_ASSERTCRASH(Parameter::SIDE == pSideParm->getParameterType(), ("Wrong parameter type.")); - Player *pPlayer=NULL; + Player *pPlayer=nullptr; UnsignedInt mask = (UnsignedInt)pSideParm->getInt(); if (mask) { pPlayer = ThePlayerList->getPlayerFromMask(mask); @@ -373,7 +373,7 @@ Bool ScriptConditions::evaluateHasUnits(Parameter *pTeamParm) // It isn't THIS_TEAM, and doesn't match the THIS_TEAM, so check if any team with this name // has units. - TeamPrototype *pProto = NULL; + TeamPrototype *pProto = nullptr; pProto = TheTeamFactory->findTeamPrototype(desiredTeamName); if (pProto) { @@ -399,7 +399,7 @@ Bool ScriptConditions::evaluateTeamInsideAreaPartially(Parameter *pTeamParm, Par AsciiString triggerName = pTriggerAreaParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerAreaParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; if (theTeam) { return (theTeam->someInsideSomeOutside(pTrig, (UnsignedInt) pTypeParm->getInt()) || theTeam->allInside(pTrig, (UnsignedInt) pTypeParm->getInt())); @@ -420,7 +420,7 @@ Bool ScriptConditions::evaluateNamedInsideArea(Parameter *pUnitParm, Parameter * AsciiString triggerName = pTriggerAreaParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerAreaParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; if (theObj) { Coord3D pCoord = *theObj->getPosition(); ICoord3D iCoord; @@ -437,7 +437,7 @@ Bool ScriptConditions::evaluatePlayerHasUnitTypeInArea(Condition *pCondition, Pa { AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; Player* pPlayer = playerFromParam(pPlayerParm); if (!pPlayer) { @@ -530,7 +530,7 @@ Bool ScriptConditions::evaluatePlayerHasUnitKindInArea(Condition *pCondition, Pa { AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; KindOfType kind = (KindOfType)pKindParm->getInt(); @@ -655,7 +655,7 @@ Bool ScriptConditions::evaluateTeamInsideAreaEntirely(Parameter *pTeamParm, Para AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) + if (pTrig == nullptr) return false; if (theTeam) { @@ -812,7 +812,7 @@ Bool ScriptConditions::evaluateNamedAttackedByPlayer(Parameter *pUnitParm, Param ObjectID id = lastDamageInfo->in.m_sourceID; Object* pAttacker = TheGameLogic->findObjectByID(id); - Player *pPlayer = NULL; + Player *pPlayer = nullptr; if (lastDamageInfo->in.m_sourcePlayerMask) { pPlayer = ThePlayerList->getPlayerFromMask(lastDamageInfo->in.m_sourcePlayerMask); } @@ -919,7 +919,7 @@ Bool ScriptConditions::evaluateNamedCreated(Parameter* pUnitParm) { // This is actually evaluateNamedExists(...) ///@todo - evaluate created, not exists... - return (TheScriptEngine->getUnitNamed(pUnitParm->getString()) != NULL); + return (TheScriptEngine->getUnitNamed(pUnitParm->getString()) != nullptr); } //------------------------------------------------------------------------------------------------- @@ -1084,7 +1084,7 @@ Bool ScriptConditions::evaluateEnemySighted(Parameter *pItemParm, Parameter *pAl // and only on-map (or not) PartitionFilterSameMapStatus filterMapStatus(theObj); - PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterStealth, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterTeam, &filterAlive, &filterStealth, &filterMapStatus, nullptr }; Real visionRange = theObj->getVisionRange(); @@ -1129,7 +1129,7 @@ Bool ScriptConditions::evaluateTypeSighted(Parameter *pItemParm, Parameter *pTyp // and only on-map (or not) PartitionFilterSameMapStatus filterMapStatus(theObj); - PartitionFilter *filters[] = { &filterAlive, &filterStealth, &filterMapStatus, NULL }; + PartitionFilter *filters[] = { &filterAlive, &filterStealth, &filterMapStatus, nullptr }; Real visionRange = theObj->getVisionRange(); @@ -1903,14 +1903,14 @@ Bool ScriptConditions::evaluateSkirmishSpecialPowerIsReady(Parameter *pSkirmishP } Int nextFrame = TheGameLogic->getFrame() + 10*LOGICFRAMES_PER_SECOND; const SpecialPowerTemplate *power = TheSpecialPowerStore->findSpecialPowerTemplate(pPower->getString()); - if (power==NULL) { + if (power==nullptr) { pPower->friend_setInt(-1); // flag as never true. return false; } Bool found = false; Player::PlayerTeamList::const_iterator it; Player *pPlayer = playerFromParam(pSkirmishPlayerParm); - if (pPlayer==NULL) + if (pPlayer==nullptr) return false; for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { @@ -1985,7 +1985,7 @@ Bool ScriptConditions::evaluateUnitHasEmptied(Parameter *pUnitParm) UnsignedInt frameNum = TheGameLogic->getFrame(); - if (stats == NULL) + if (stats == nullptr) { TransportStatus *transportStatus = newInstance(TransportStatus); transportStatus->m_objID = object->getID(); @@ -2025,7 +2025,7 @@ Bool ScriptConditions::evaluateTeamIsContained(Parameter *pTeamParm, Bool allCon continue; } - Bool isContained = (obj->getContainedBy() != NULL); + Bool isContained = (obj->getContainedBy() != nullptr); if (!isContained) { // we could still be exiting, in which case we should pretend like we are contained. @@ -2224,7 +2224,7 @@ Bool ScriptConditions::evaluateSkirmishSuppliesWithinDistancePerimeter(Parameter PartitionFilterPlayerAffiliation f2(player, ALLOW_NEUTRAL, true); PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &filterMapStatus, nullptr }; SimpleObjectIterator *iter = ThePartitionManager->iterateObjectsInRange(¢er, distance, FROM_CENTER_2D, filters, ITER_FASTEST); MemoryPoolObjectHolder hold(iter); @@ -2275,9 +2275,9 @@ Bool ScriptConditions::evaluateSkirmishPlayerTechBuildingWithinDistancePerimeter PartitionFilterOnMap filterMapStatus; - PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, 0 }; + PartitionFilter *filters[] = { &f1, &f2, &f3, &filterMapStatus, nullptr }; - Bool comparison = ThePartitionManager->getClosestObject(¢er, radius, FROM_CENTER_2D, filters) != NULL; + Bool comparison = ThePartitionManager->getClosestObject(¢er, radius, FROM_CENTER_2D, filters) != nullptr; pCondition->setCustomData(-1); // false. if (comparison) { pCondition->setCustomData(1); // true. @@ -2485,7 +2485,7 @@ Bool ScriptConditions::evaluateSkirmishPlayerHasComparisonCapturedUnits(Paramete Bool ScriptConditions::evaluateSkirmishNamedAreaExists(Parameter *, Parameter *pTriggerParm) { PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - return (pTrig != NULL); + return (pTrig != nullptr); } //------------------------------------------------------------------------------------------------- @@ -2493,7 +2493,7 @@ Bool ScriptConditions::evaluateSkirmishPlayerHasUnitsInArea(Condition *pConditio { AsciiString triggerName = pTriggerParm->getString(); PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (pTrig == NULL) return false; + if (pTrig == nullptr) return false; Player* pPlayer = playerFromParam(pSkirmishPlayerParm); if (!pPlayer) { @@ -2847,15 +2847,15 @@ Bool ScriptConditions::evaluateCondition( Condition *pCondition ) case Condition::UNIT_HEALTH: return evaluateUnitHealth(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_TRIGGERED_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_TRIGGERED_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitTriggered(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_MIDWAY_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_MIDWAY_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitMidway(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_COMPLETED_SPECIAL_POWER: - return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_COMPLETED_SPECIAL_POWER_FROM_NAMED: return evaluatePlayerSpecialPowerFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_ACQUIRED_SCIENCE: @@ -2871,7 +2871,7 @@ Bool ScriptConditions::evaluateCondition( Condition *pCondition ) DEBUG_CRASH(("PLAYER_SELECTED_GENERAL script conditions are no longer in use")); return false; case Condition::PLAYER_BUILT_UPGRADE: - return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), NULL); + return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), nullptr); case Condition::PLAYER_BUILT_UPGRADE_FROM_NAMED: return evaluateUpgradeFromUnitComplete(pCondition->getParameter(0), pCondition->getParameter(1), pCondition->getParameter(2)); case Condition::PLAYER_HAS_OBJECT_COMPARISON: diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 1afe8e19c1e..9fb0bbf42e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -110,9 +110,9 @@ Bool st_particleSystemNeedsStopping = FALSE; ///< Set along with st_particleSyst typedef void (*VTProc)(); static Bool st_EnableVTune = false; - static HMODULE st_vTuneDLL = NULL; - static VTProc VTPause = NULL; - static VTProc VTResume = NULL; + static HMODULE st_vTuneDLL = nullptr; + static VTProc VTPause = nullptr; + static VTProc VTResume = nullptr; static void _initVTune( void ); static void _updateVTune ( void ); @@ -135,7 +135,7 @@ static const Int FRAMES_TO_FADE_IN_AT_START = 33; //#include "Common/PerfTimer.h" // GLOBALS //////////////////////////////////////////////////////////////////////////////////////// -ScriptEngine *TheScriptEngine = NULL; +ScriptEngine *TheScriptEngine = nullptr; /// Local classes /// AttackPriorityInfo class @@ -144,7 +144,7 @@ static const Int ATTACK_PRIORITY_DEFAULT = 1; //------------------------------------------------------------------------------------------------- /** Ctor */ //------------------------------------------------------------------------------------------------- -AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFAULT), m_priorityMap(NULL) +AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFAULT), m_priorityMap(nullptr) { m_name.clear(); } @@ -155,7 +155,7 @@ AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFA AttackPriorityInfo::~AttackPriorityInfo() { delete m_priorityMap; - m_priorityMap = NULL; + m_priorityMap = nullptr; } //------------------------------------------------------------------------------------------------- @@ -163,8 +163,8 @@ AttackPriorityInfo::~AttackPriorityInfo() //------------------------------------------------------------------------------------------------- void AttackPriorityInfo::setPriority(const ThingTemplate *tThing, Int priority) { - if (tThing==NULL) return; - if (m_priorityMap==NULL) { + if (tThing==nullptr) return; + if (m_priorityMap==nullptr) { m_priorityMap = NEW AttackPriorityMap; // STL type, so impractical to use memorypool } tThing = (const ThingTemplate *)tThing->getFinalOverride(); @@ -177,7 +177,7 @@ void AttackPriorityInfo::setPriority(const ThingTemplate *tThing, Int priority) Int AttackPriorityInfo::getPriority(const ThingTemplate *tThing) const { Int priority = m_defaultPriority; - if (tThing==NULL) return priority; + if (tThing==nullptr) return priority; tThing = (const ThingTemplate *)tThing->getFinalOverride(); if (m_priorityMap && !m_priorityMap->empty()) { AttackPriorityMap::const_iterator it = m_priorityMap->find(tThing); @@ -196,7 +196,7 @@ void AttackPriorityInfo::dumpPriorityInfo(void) { #ifdef DEBUG_LOGGING DEBUG_LOG(("Attack priority '%s', default %d", m_name.str(), m_defaultPriority)); - if (m_priorityMap==NULL) return; + if (m_priorityMap==nullptr) return; for (AttackPriorityMap::const_iterator it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it) { const ThingTemplate *tThing = (*it).first; @@ -220,7 +220,7 @@ void AttackPriorityInfo::reset( void ) m_defaultPriority = ATTACK_PRIORITY_DEFAULT; delete m_priorityMap; - m_priorityMap = NULL; + m_priorityMap = nullptr; } @@ -320,7 +320,7 @@ void AttackPriorityInfo::xfer( Xfer *xfer ) // read thing template name, and get template xfer->xferAsciiString( &thingTemplateName ); thingTemplate = TheThingFactory->findTemplate( thingTemplateName ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "AttackPriorityInfo::xfer - Unable to find thing template '%s'", @@ -352,11 +352,11 @@ void AttackPriorityInfo::loadPostProcess( void ) // ScriptEngine class static const FieldParse TheTemplateFieldParseTable[] = { - { "InternalName", INI::parseAsciiString,NULL, offsetof( Template, m_internalName ) }, - { "UIName", INI::parseAsciiString,NULL, offsetof( Template, m_uiName ) }, - { "UIName2", INI::parseAsciiString,NULL, offsetof( Template, m_uiName2 ) }, - { "HelpText", INI::parseAsciiString,NULL, offsetof( Template, m_helpText ) }, - { NULL, NULL, NULL, 0 } + { "InternalName", INI::parseAsciiString,nullptr, offsetof( Template, m_internalName ) }, + { "UIName", INI::parseAsciiString,nullptr, offsetof( Template, m_uiName ) }, + { "UIName2", INI::parseAsciiString,nullptr, offsetof( Template, m_uiName2 ) }, + { "HelpText", INI::parseAsciiString,nullptr, offsetof( Template, m_helpText ) }, + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -436,12 +436,12 @@ void ScriptEngine::addConditionTemplateInfo( Template *actionTemplate) ScriptEngine::ScriptEngine(): m_numCounters(0), m_numFlags(0), -m_callingTeam(NULL), -m_callingObject(NULL), -m_conditionTeam(NULL), -m_conditionObject(NULL), -m_currentPlayer(NULL), -m_skirmishHumanPlayer(NULL), +m_callingTeam(nullptr), +m_callingObject(nullptr), +m_conditionTeam(nullptr), +m_conditionObject(nullptr), +m_currentPlayer(nullptr), +m_skirmishHumanPlayer(nullptr), m_fade(FADE_NONE), m_freezeByScript(FALSE), m_frameObjectCountChanged(0), @@ -478,7 +478,7 @@ ScriptEngine::~ScriptEngine() } FreeLibrary(st_DebugDLL); - st_DebugDLL = NULL; + st_DebugDLL = nullptr; } if (st_ParticleDLL) { @@ -488,7 +488,7 @@ ScriptEngine::~ScriptEngine() } FreeLibrary(st_ParticleDLL); - st_ParticleDLL = NULL; + st_ParticleDLL = nullptr; } #ifdef DO_VTUNE_STUFF @@ -521,13 +521,13 @@ void ScriptEngine::init( void ) if (TheGlobalData->m_scriptDebug) { st_DebugDLL = LoadLibrary("DebugWindow.dll"); } else { - st_DebugDLL = NULL; + st_DebugDLL = nullptr; } if (TheGlobalData->m_particleEdit) { st_ParticleDLL = LoadLibrary("ParticleEditor.dll"); } else { - st_ParticleDLL = NULL; + st_ParticleDLL = nullptr; } if (st_DebugDLL) { @@ -5277,12 +5277,12 @@ void ScriptEngine::reset( void ) m_endGameTimer = -1; m_closeWindowTimer = -1; - m_callingTeam = NULL; - m_callingObject = NULL; - m_conditionTeam = NULL; - m_conditionObject = NULL; - m_currentPlayer = NULL; - m_skirmishHumanPlayer = NULL; + m_callingTeam = nullptr; + m_callingObject = nullptr; + m_conditionTeam = nullptr; + m_conditionObject = nullptr; + m_currentPlayer = nullptr; + m_skirmishHumanPlayer = nullptr; m_frameObjectCountChanged = 0; m_shownMPLocalDefeatWindow = FALSE; @@ -5327,12 +5327,12 @@ void ScriptEngine::reset( void ) if (TheSidesList) { for (numToDump=0; numToDump<10; numToDump++) { Real maxTime = 0; - Script *maxScript = NULL; + Script *maxScript = nullptr; /* Run through scripts & set condition team names. */ for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (pScr->getConditionTime()>maxTime) { @@ -5369,7 +5369,7 @@ void ScriptEngine::reset( void ) VecSequentialScriptPtrIt seqScriptIt = m_sequentialScripts.begin(); while (seqScriptIt != m_sequentialScripts.end()) { SequentialScript* seqScript = *seqScriptIt; - while (seqScript != NULL) { + while (seqScript != nullptr) { SequentialScript* scriptToDelete = seqScript; seqScript = seqScript->m_nextScriptInSequence; deleteInstance(scriptToDelete); @@ -5466,7 +5466,7 @@ void ScriptEngine::newMap( void ) for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { checkConditionsForTeamNames(pScr); @@ -5585,7 +5585,7 @@ void ScriptEngine::update( void ) } executeScripts(pGroup->getScript()); } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } // Reset the entered/exited flag in teams, so the next update sets them @@ -5652,12 +5652,12 @@ AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *sc if (TheSidesList) { for (numToDump=0; numToDump<2; numToDump++) { Real maxTime = 0; - Script *maxScript = NULL; + Script *maxScript = nullptr; /* Run through scripts & set condition team names. */ for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); if (!pSL) continue; - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (pScr->getCurTime()>maxTime) { @@ -5751,8 +5751,8 @@ void ScriptEngine::updateFades( void ) //------------------------------------------------------------------------------------------------- Player *ScriptEngine::getCurrentPlayer(void) { - if (m_currentPlayer==NULL) - AppendDebugMessage("***Unexpected NULL player:***", false); + if (m_currentPlayer==nullptr) + AppendDebugMessage("***Unexpected null player:***", false); return m_currentPlayer; } @@ -5799,7 +5799,7 @@ Player *ScriptEngine::getSkirmishEnemyPlayer(void) Bool is_GeneralsChallengeContext = TheCampaignManager->getCurrentCampaign() && TheCampaignManager->getCurrentCampaign()->m_isChallengeCampaign; if (m_currentPlayer) { Player *enemy = m_currentPlayer->getCurrentEnemy(); - if (enemy==NULL) { + if (enemy==nullptr) { // get the human player. Int i; for (i=0; igetPlayerCount(); i++) { @@ -5811,13 +5811,13 @@ Player *ScriptEngine::getSkirmishEnemyPlayer(void) return enemy; } - enemy = NULL; + enemy = nullptr; } } return enemy; } DEBUG_CRASH(("No enemy found. Unexpected but not fatal. jba.")); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5838,14 +5838,14 @@ Player *ScriptEngine::getPlayerFromAsciiString(const AsciiString& playerString) else { NameKeyType key = NAMEKEY(playerString); Player *pPlayer = ThePlayerList->findPlayerWithNameKey(key); - if (pPlayer!=NULL) { + if (pPlayer!=nullptr) { return pPlayer; } } AppendDebugMessage("***Invalid Player name:***", false); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5856,8 +5856,8 @@ ObjectTypes *ScriptEngine::getObjectTypes(const AsciiString& objectTypeList) AllObjectTypesIt it; for (it = m_allObjectTypeLists.begin(); it != m_allObjectTypeLists.end(); ++it) { - if ((*it) == NULL) { - DEBUG_CRASH(("NULL object type list was unexpected. jkmcd")); + if ((*it) == nullptr) { + DEBUG_CRASH(("null object type list was unexpected. jkmcd")); continue; } @@ -5866,7 +5866,7 @@ ObjectTypes *ScriptEngine::getObjectTypes(const AsciiString& objectTypeList) } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -5895,12 +5895,12 @@ void ScriptEngine::doObjectTypeListMaintenance(const AsciiString& objectTypeList removeObjectTypes(currentObjectTypeVec); // Semantic emphasis - currentObjectTypeVec = NULL; + currentObjectTypeVec = nullptr; } } //------------------------------------------------------------------------------------------------- -/** Given a name, return the associated trigger area, or NULL if one doesn't exist. +/** Given a name, return the associated trigger area, or null if one doesn't exist. Handles skirmish name qualification. */ //------------------------------------------------------------------------------------------------- PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) @@ -5914,7 +5914,7 @@ PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) name.format("%s%d", OUTER_PERIMETER, ndx); } } else { - return NULL; + return nullptr; } } else if (name == ENEMY_INNER_PERIMETER || name == ENEMY_OUTER_PERIMETER) { @@ -5933,7 +5933,7 @@ PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name ) } } PolygonTrigger *trig = TheTerrainLogic->getTriggerAreaByName(name); - if (trig==NULL) { + if (trig==nullptr) { AsciiString msg = "!!!WARNING!!! Trigger area '"; msg.concat(name); msg.concat("' not found."); @@ -5967,13 +5967,13 @@ Team * ScriptEngine::getTeamNamed(const AsciiString& teamName) return m_conditionTeam; } TeamPrototype *theTeamProto = TheTeamFactory->findTeamPrototype( teamName ); - if (theTeamProto == NULL) return NULL; + if (theTeamProto == nullptr) return nullptr; if (theTeamProto->getIsSingleton()) { Team *theTeam = theTeamProto->getFirstItemIn_TeamInstanceList(); if (theTeam && theTeam->isActive()) { return theTeam; } - return NULL; // team wasn't active. + return nullptr; // team wasn't active. } static int warnCount = 0; @@ -6004,7 +6004,7 @@ Object * ScriptEngine::getUnitNamed(const AsciiString& unitName) return it->second; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -6014,7 +6014,7 @@ Bool ScriptEngine::didUnitExist(const AsciiString& unitName) { for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (unitName == (it->first)) { - return (it->second == NULL); + return (it->second == nullptr); } } return false; @@ -6037,12 +6037,12 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) // Team *pSavConditionTeam = m_conditionTeam; LatchRestore latch(m_callingTeam, pThisTeam); - m_conditionTeam = NULL; - m_currentPlayer = NULL; + m_conditionTeam = nullptr; + m_currentPlayer = nullptr; if (m_callingTeam) { m_currentPlayer = m_callingTeam->getControllingPlayer(); } - Script *pScript = NULL; + Script *pScript = nullptr; ScriptGroup *pGroup = findGroup(scriptName); if (pGroup) { if (pGroup->isSubroutine()) { @@ -6056,7 +6056,7 @@ void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam) } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -6089,7 +6089,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } Object *pSavCallingObject = m_callingObject; m_callingObject = pThisObject; - Script *pScript = NULL; + Script *pScript = nullptr; ScriptGroup *pGroup = findGroup(scriptName); if (pGroup) { if (pGroup->isSubroutine()) { @@ -6103,7 +6103,7 @@ void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisO } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -6156,7 +6156,7 @@ const TCounter *ScriptEngine::getCounter(const AsciiString& counterName) return &(m_counters[i]); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -6185,7 +6185,7 @@ void ScriptEngine::doNamedMapReveal(const AsciiString& revealName) { VecNamedRevealIt it; - NamedReveal *reveal = NULL; + NamedReveal *reveal = nullptr; for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) { if (it->m_revealName == revealName) { reveal = &(*it); @@ -6218,7 +6218,7 @@ void ScriptEngine::undoNamedMapReveal(const AsciiString& revealName) { VecNamedRevealIt it; - NamedReveal *reveal = NULL; + NamedReveal *reveal = nullptr; for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) { if (it->m_revealName == revealName) { reveal = &(*it); @@ -6289,7 +6289,7 @@ ScriptGroup *ScriptEngine::findGroup(const AsciiString& name) Int i; for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - if (pSL==NULL) continue; + if (pSL==nullptr) continue; ScriptGroup *pGroup; for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) { if (pGroup->getName() == name) { @@ -6297,7 +6297,7 @@ ScriptGroup *ScriptEngine::findGroup(const AsciiString& name) } } } - return 0; // Shouldn't ever happen. + return nullptr; // Shouldn't ever happen. } //------------------------------------------------------------------------------------------------- @@ -6308,7 +6308,7 @@ Script *ScriptEngine::findScript(const AsciiString& name) Int i; for (i=0; igetNumSides(); i++) { ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList(); - if (pSL==NULL) continue; + if (pSL==nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if ((name==pScr->getName())) { @@ -6324,7 +6324,7 @@ Script *ScriptEngine::findScript(const AsciiString& name) } } } - return 0; // Shouldn't ever happen. + return nullptr; // Shouldn't ever happen. } //------------------------------------------------------------------------------------------------- @@ -6512,7 +6512,7 @@ AttackPriorityInfo * ScriptEngine::findAttackInfo(const AsciiString& name, Bool m_numAttackInfo++; return &m_attackPriorityInfo[m_numAttackInfo-1]; } - return NULL; + return nullptr; } /// Attack priority stuff. @@ -6559,13 +6559,13 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) const ThingTemplate *thingTemplate; // get thing template based from map object name thingTemplate = TheThingFactory->findTemplate(typeArgument); - if (thingTemplate==NULL) { + if (thingTemplate==nullptr) { AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false); AppendDebugMessage(pAction->getParameter(0)->getString(), false); return; } AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -6590,13 +6590,13 @@ void ScriptEngine::setPriorityThing( ScriptAction *pAction ) { AsciiString thisTypeName = types->getNthInList(typeIndex); const ThingTemplate *thisType = TheThingFactory->findTemplate(thisTypeName); - if (thisType==NULL) { + if (thisType==nullptr) { AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false); AppendDebugMessage(pAction->getParameter(0)->getString(), false); return; } AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -6624,7 +6624,7 @@ void ScriptEngine::setPriorityKind( ScriptAction *pAction ) { DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 3, ("Not enough parameters.")); AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -6648,7 +6648,7 @@ void ScriptEngine::setPriorityDefault( ScriptAction *pAction ) { DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.")); AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true); - if (info==NULL) { + if (info==nullptr) { AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false); return; } @@ -6688,7 +6688,7 @@ void ScriptEngine::setObjectCount(Int playerIndex, const AsciiString& objectType //------------------------------------------------------------------------------------------------- void ScriptEngine::removeObjectTypes(ObjectTypes *typesToRemove) { - if (typesToRemove == NULL) { + if (typesToRemove == nullptr) { return; } @@ -6862,7 +6862,7 @@ void ScriptEngine::callSubroutine( ScriptAction *pAction ) } } else { pScript = findScript(scriptName); - if (pScript != NULL) { + if (pScript != nullptr) { if (pScript->isSubroutine()) { executeScript(pScript); } else { @@ -6904,7 +6904,7 @@ void ScriptEngine::checkConditionsForTeamNames(Script *pScript) if (Parameter::TEAM == pCondition->getParameter(i)->getParameterType()) { AsciiString teamName = pCondition->getParameter(i)->getString(); TeamPrototype *proto = TheTeamFactory->findTeamPrototype(teamName); - if (proto==NULL) continue; // Undefined team - don't bother. + if (proto==nullptr) continue; // Undefined team - don't bother. Bool singleton = proto->getIsSingleton(); if (proto->getTemplateInfo()->m_maxInstances < 2) { singleton = true; @@ -6979,7 +6979,7 @@ void ScriptEngine::executeScript( Script *pScript ) #endif Team *pSavConditionTeam = m_conditionTeam; - TeamPrototype *pProto = NULL; + TeamPrototype *pProto = nullptr; if (!pScript->getConditionTeamName().isEmpty()) { pProto = TheTeamFactory->findTeamPrototype(pScript->getConditionTeamName()); @@ -7012,7 +7012,7 @@ void ScriptEngine::executeScript( Script *pScript ) } } else { - m_conditionTeam = NULL; + m_conditionTeam = nullptr; // If conditions evaluate to true, execute actions. if (evaluateConditions(pScript)) { if (pScript->getAction()) { @@ -7071,7 +7071,7 @@ void ScriptEngine::friend_executeAction( ScriptAction *pActionHead, Team *pThisT Team *pSavCallingTeam = m_callingTeam; Player *pSavPlayer = m_currentPlayer; m_callingTeam = pThisTeam; - m_currentPlayer = NULL; + m_currentPlayer = nullptr; if (pThisTeam) { m_currentPlayer = pThisTeam->getControllingPlayer(); } @@ -7097,7 +7097,7 @@ void ScriptEngine::addObjectToCache(Object* pNewObject) for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (it->first == objName) { - if (it->second == NULL) { + if (it->second == nullptr) { AsciiString newNameForDead; newNameForDead.format("Reassigning dead object's name '%s' to object (%d) of type '%s'", objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str()); AppendDebugMessage(newNameForDead, FALSE); @@ -7133,7 +7133,7 @@ void ScriptEngine::removeObjectFromCache( Object* pDeadObject ) { for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) { if (pDeadObject == (it->second)) { - it->second = NULL; // Don't remove it, cause we want to check whether we ever knew a name later + it->second = nullptr; // Don't remove it, cause we want to check whether we ever knew a name later break; } } @@ -7198,11 +7198,11 @@ void ScriptEngine::notifyOfObjectDestruction( Object *pDeadObject ) } if (m_conditionObject == pDeadObject) { - m_conditionObject = NULL; + m_conditionObject = nullptr; } if (m_callingObject == pDeadObject) { - m_callingObject = NULL; + m_callingObject = nullptr; } } @@ -7577,7 +7577,7 @@ Bool ScriptEngine::evaluateConditions( Script *pScript, Team *thisTeam, Player * { LatchRestore latch(m_callingTeam, thisTeam); if (thisTeam) player = thisTeam->getControllingPlayer(); - if (player==NULL) player=m_currentPlayer; + if (player==nullptr) player=m_currentPlayer; LatchRestore latch2(m_currentPlayer, player); OrCondition *pConditionHead = pScript->getOrCondition(); Bool testValue = false; @@ -7734,8 +7734,8 @@ void ScriptEngine::appendSequentialScript(const SequentialScript *scriptToSequen SequentialScript *newSequentialScript = newInstance( SequentialScript ); (*newSequentialScript) = (*scriptToSequence); - // Must set this to NULL, as we don't want an infinite loop. - newSequentialScript->m_nextScriptInSequence = NULL; + // Must set this to nullptr, as we don't want an infinite loop. + newSequentialScript->m_nextScriptInSequence = nullptr; // reset the instruction pointer newSequentialScript->m_currentInstruction = -1; @@ -7826,9 +7826,9 @@ void ScriptEngine::notifyOfTeamDestruction(Team *teamDestroyed) } if (m_callingTeam == teamDestroyed) - m_callingTeam = NULL; + m_callingTeam = nullptr; if (m_conditionTeam == teamDestroyed) - m_conditionTeam = NULL; + m_conditionTeam = nullptr; } void ScriptEngine::setSequentialTimer(Object *obj, Int frameCount) @@ -7878,7 +7878,7 @@ void ScriptEngine::setSequentialTimer(Team *team, Int frameCount) void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) { VecSequentialScriptPtrIt it; - SequentialScript* lastScript = NULL; + SequentialScript* lastScript = nullptr; Bool itAdvanced = false; Int spinCount = 0; @@ -7904,7 +7904,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = false; SequentialScript *seqScript = (*it); - if (seqScript == NULL) { + if (seqScript == nullptr) { it = cleanupSequentialScript(it, false); continue; } @@ -7916,18 +7916,18 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = true; continue; } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; if (obj) { m_currentPlayer = obj->getControllingPlayer(); } else if (team) { m_currentPlayer = team->getControllingPlayer(); } if (m_currentPlayer && !m_currentPlayer->isSkirmishAIPlayer()) { - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } - AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : NULL; - AIGroupPtr aigroup = (team ? TheAI->createGroup() : NULL); + AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : nullptr; + AIGroupPtr aigroup = (team ? TheAI->createGroup() : nullptr); if (aigroup) { #if RETAIL_COMPATIBLE_AIGROUP team->getTeamAsAIGroup(aigroup); @@ -7975,13 +7975,13 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) // Save off the next action ScriptAction *nextAction = action->getNext(); - action->setNextAction(NULL); + action->setNextAction(nullptr); if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_ALL) { - if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), true)) { + if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(nullptr, action->getParameter(1), action->getParameter(2), true)) { seqScript->m_dontAdvanceInstruction = TRUE; } } else if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_PARTIAL) { - if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), false)) { + if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(nullptr, action->getParameter(1), action->getParameter(2), false)) { seqScript->m_dontAdvanceInstruction = TRUE; } } else if (action->getActionType() == ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_ALL) { @@ -8017,7 +8017,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) itAdvanced = true; } else if (team) { // attempt to rebuild the aigroup, as it probably expired during the action execution - aigroup = (team ? TheAI->createGroup() : NULL); + aigroup = (team ? TheAI->createGroup() : nullptr); #if RETAIL_COMPATIBLE_AIGROUP team->getTeamAsAIGroup(aigroup); #else @@ -8063,7 +8063,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) ++it; } } - m_currentPlayer = NULL; + m_currentPlayer = nullptr; } ScriptEngine::VecSequentialScriptPtrIt ScriptEngine::cleanupSequentialScript(VecSequentialScriptPtrIt it, Bool cleanDanglers) @@ -8080,18 +8080,18 @@ ScriptEngine::VecSequentialScriptPtrIt ScriptEngine::cleanupSequentialScript(Vec scriptToDelete = seqScript; seqScript = seqScript->m_nextScriptInSequence; deleteInstance(scriptToDelete); - scriptToDelete = NULL; + scriptToDelete = nullptr; } - (*it) = NULL; + (*it) = nullptr; } else { // we want to make sure to not delete any dangling scripts. (*it) = scriptToDelete->m_nextScriptInSequence; deleteInstance(scriptToDelete); - scriptToDelete = NULL; + scriptToDelete = nullptr; } - if ((*it) == NULL) { + if ((*it) == nullptr) { return m_sequentialScripts.erase(it); } @@ -8127,14 +8127,14 @@ void ScriptEngine::setEnableVTune(Bool value) } //----SequentialScript----------------------------------------------------------------------------- -SequentialScript::SequentialScript() : m_teamToExecOn(NULL), +SequentialScript::SequentialScript() : m_teamToExecOn(nullptr), m_objectID(INVALID_ID), - m_scriptToExecuteSequentially(NULL), + m_scriptToExecuteSequentially(nullptr), m_currentInstruction(START_INSTRUCTION), m_timesToLoop(0), m_framesToWait(-1), m_dontAdvanceInstruction(FALSE), - m_nextScriptInSequence(NULL) + m_nextScriptInSequence(nullptr) { } @@ -8169,7 +8169,7 @@ void SequentialScript::xfer( Xfer *xfer ) m_teamToExecOn = TheTeamFactory->findTeamByID( teamID ); // sanity - if( teamID != TEAM_ID_INVALID && m_teamToExecOn == NULL ) + if( teamID != TEAM_ID_INVALID && m_teamToExecOn == nullptr ) { DEBUG_CRASH(( "SequentialScript::xfer - Unable to find team by ID (#%d) for m_teamToExecOn", @@ -8200,14 +8200,14 @@ void SequentialScript::xfer( Xfer *xfer ) xfer->xferAsciiString( &scriptName ); // script pointer - DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially == NULL, ("SequentialScript::xfer - m_scripttoExecuteSequentially") ); + DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially == nullptr, ("SequentialScript::xfer - m_scripttoExecuteSequentially") ); // find script m_scriptToExecuteSequentially = const_cast(TheScriptEngine->findScriptByName(scriptName)); // sanity - DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != NULL, - ("SequentialScript::xfer - m_scriptToExecuteSequentially is NULL but should not be") ); + DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != nullptr, + ("SequentialScript::xfer - m_scriptToExecuteSequentially is null but should not be") ); } @@ -8538,7 +8538,7 @@ static void xferListAsciiString( Xfer *xfer, ListAsciiString *list ) { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiString - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiString - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8601,7 +8601,7 @@ static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list ) { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringUINT - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringUINT - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8676,7 +8676,7 @@ static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *li { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringObjectID - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringObjectID - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8751,7 +8751,7 @@ static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list { // sanity - DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringCoord3D - Invalid parameters") ); + DEBUG_ASSERTCRASH( list != nullptr, ("xferListAsciiStringCoord3D - Invalid parameters") ); // version XferVersion currentVersion = 1; @@ -8989,7 +8989,7 @@ void ScriptEngine::xfer( Xfer *xfer ) namedObjectName = it->first; xfer->xferAsciiString( &namedObjectName ); - // write object id (note that object may be NULL) + // write object id (note that object may be null) obj = it->second; objectID = obj ? obj->getID() : INVALID_ID; xfer->xferObjectID( &objectID ); @@ -9017,7 +9017,7 @@ void ScriptEngine::xfer( Xfer *xfer ) // read object id and turn into object pointer xfer->xferObjectID( &objectID ); obj = TheGameLogic->findObjectByID( objectID ); - if( obj == NULL && objectID != INVALID_ID ) + if( obj == nullptr && objectID != INVALID_ID ) { DEBUG_CRASH(( "ScriptEngine::xfer - Unable to find object by ID for m_namedObjects" )); @@ -9611,9 +9611,9 @@ extern void _updateAsciiStringParmsFromSystem( ParticleSystemTemplate *particleT return; } - ((funcptr) proc)(0, particleTemplate->m_particleTypeName.str(), NULL); // PARM_ParticleTypeName - ((funcptr) proc)(1, particleTemplate->m_slaveSystemName.str(), NULL); // PARM_SlaveSystemName - ((funcptr) proc)(2, particleTemplate->m_attachedSystemName.str(), NULL); // PARM_AttachedSystemName + ((funcptr) proc)(0, particleTemplate->m_particleTypeName.str(), nullptr); // PARM_ParticleTypeName + ((funcptr) proc)(1, particleTemplate->m_slaveSystemName.str(), nullptr); // PARM_SlaveSystemName + ((funcptr) proc)(2, particleTemplate->m_attachedSystemName.str(), nullptr); // PARM_AttachedSystemName } @@ -9626,13 +9626,13 @@ static void _writeOutINI( void ) const int maxFileLength = 128; char buff[maxFileLength]; - File *saveFile = NULL; + File *saveFile = nullptr; int i = 0; do { if (saveFile) { saveFile->close(); - saveFile = NULL; + saveFile = nullptr; } sprintf(buff, "%s%d.%s", BACKUP_FILE_NAME, i, BACKUP_EXT); saveFile = TheFileSystem->openFile(buff, File::READ | File::TEXT); @@ -9654,9 +9654,9 @@ static void _writeOutINI( void ) saveFile->write(&singleChar, 1); } oldINI->close(); - oldINI = NULL; + oldINI = nullptr; saveFile->close(); - saveFile = NULL; + saveFile = nullptr; } @@ -9677,7 +9677,7 @@ static void _writeOutINI( void ) } newINI->close(); - newINI = NULL; + newINI = nullptr; } @@ -10123,7 +10123,7 @@ static void _updateAndSetCurrentSystem( void ) ParticleSystemTemplate *parentTemp = TheParticleSystemManager->findParentTemplate(pTemp->getName(), 0); if (parentTemp) { - ParticleSystem *parentSystem = NULL; + ParticleSystem *parentSystem = nullptr; parentSystem = TheParticleSystemManager->createParticleSystem(parentTemp); if (parentSystem) { @@ -10158,7 +10158,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) // save the old file File *iniFile = TheFileSystem->openFile("Data\\INI\\ParticleSystem.ini", File::READ | File::TEXT); - File *outTempINI = NULL; + File *outTempINI = nullptr; if (!iniFile) { return; @@ -10194,7 +10194,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) // write out the closing "END" outTempINI->write(linebuff, strlen(linebuff)); outTempINI->close(); - outTempINI = NULL; + outTempINI = nullptr; } // force the current system to stop. @@ -10206,7 +10206,7 @@ static void _reloadParticleSystemFromINI( AsciiString particleSystemName ) } // reload that entry INI ini; - ini.load("temporary.ini", INI_LOAD_OVERWRITE, NULL); + ini.load("temporary.ini", INI_LOAD_OVERWRITE, nullptr); // delete the file // unlink("temporary.ini"); @@ -10293,18 +10293,18 @@ static void _initVTune() // always try loading it, even if -vtune wasn't specified. st_vTuneDLL = ::LoadLibrary("vtuneapi.dll"); // nope, not here... -//DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, "VTuneAPI DLL not found!")); +//DEBUG_ASSERTCRASH(st_vTuneDLL != nullptr, "VTuneAPI DLL not found!")); if (st_vTuneDLL) { VTPause = (VTProc)::GetProcAddress(st_vTuneDLL, "VTPause"); VTResume = (VTProc)::GetProcAddress(st_vTuneDLL, "VTResume"); - DEBUG_ASSERTCRASH(VTPause != NULL && VTResume != NULL, ("VTuneAPI procs not found!")); + DEBUG_ASSERTCRASH(VTPause != nullptr && VTResume != nullptr, ("VTuneAPI procs not found!")); } else { - VTPause = NULL; - VTResume = NULL; + VTPause = nullptr; + VTResume = nullptr; } if (TheGlobalData->m_vTune) @@ -10314,7 +10314,7 @@ static void _initVTune() if (VTPause) VTPause(); // only complain about it being missing if they were expecting it to be present - DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, ("VTuneAPI DLL not found!")); + DEBUG_ASSERTCRASH(st_vTuneDLL != nullptr, ("VTuneAPI DLL not found!")); } else { @@ -10348,9 +10348,9 @@ static void _cleanUpVTune() { FreeLibrary(st_vTuneDLL); } - st_vTuneDLL = NULL; - VTPause = NULL; - VTResume = NULL; + st_vTuneDLL = nullptr; + VTPause = nullptr; + VTResume = nullptr; } #endif // VTUNE diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 31b589c9055..ab4e28f81fd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -69,8 +69,8 @@ -static Script *s_mtScript = NULL; -static ScriptGroup *s_mtGroup = NULL; +static Script *s_mtScript = nullptr; +static ScriptGroup *s_mtGroup = nullptr; // // These strings must be in the same order as they are in their definitions @@ -166,7 +166,7 @@ enum { AT_END = 0x00FFFFFF }; // ******************************** class ScriptList ********************************************* //------------------------------------------------------------------------------------------------- // Statics /////////////////////////////////////////////////////////////////////////////////////// -ScriptList *ScriptList::s_readLists[MAX_PLAYER_COUNT] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; +ScriptList *ScriptList::s_readLists[MAX_PLAYER_COUNT] = {0}; Int ScriptList::s_numInReadList = 0; Int ScriptList::m_curId = 0; @@ -181,7 +181,7 @@ void ScriptList::updateDefaults(void) for (i=0; igetNumSides(); i++) { ScriptList* pList = TheSidesList->getSideInfo(i)->getScriptList(); - if (pList == NULL) { + if (pList == nullptr) { pList = newInstance(ScriptList); TheSidesList->getSideInfo(i)->setScriptList(pList); } @@ -194,11 +194,11 @@ void ScriptList::updateDefaults(void) void ScriptList::reset(void) { Int i; - if (TheSidesList == NULL) return; /// @todo - move this code into sides list. + if (TheSidesList == nullptr) return; /// @todo - move this code into sides list. for (i=0; igetNumSides(); i++) { ScriptList* pList = TheSidesList->getSideInfo(i)->getScriptList(); - TheSidesList->getSideInfo(i)->setScriptList(NULL); + TheSidesList->getSideInfo(i)->setScriptList(nullptr); deleteInstance(pList); } } @@ -209,8 +209,8 @@ void ScriptList::reset(void) Ctor. */ ScriptList::ScriptList(void) : -m_firstGroup(NULL), -m_firstScript(NULL) +m_firstGroup(nullptr), +m_firstScript(nullptr) { } @@ -221,10 +221,10 @@ m_firstScript(NULL) ScriptList::~ScriptList(void) { deleteInstance(m_firstGroup); - m_firstGroup = NULL; + m_firstGroup = nullptr; deleteInstance(m_firstScript); - m_firstScript = NULL; + m_firstScript = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -272,7 +272,7 @@ void ScriptList::xfer( Xfer *xfer ) } if (scriptCount>0) { DEBUG_CRASH(("Stripping out extra scripts - Bad...")); - if (s_mtScript==NULL) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. + if (s_mtScript==nullptr) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. while (scriptCount) { xfer->xferSnapshot(s_mtScript); scriptCount--; @@ -301,7 +301,7 @@ void ScriptList::xfer( Xfer *xfer ) } if (scriptGroupCount>0) { DEBUG_CRASH(("Stripping out extra groups. - Bad...")); - if (s_mtGroup == NULL) s_mtGroup = newInstance(ScriptGroup); // Yes it leaks, but this is only for recovery. + if (s_mtGroup == nullptr) s_mtGroup = newInstance(ScriptGroup); // Yes it leaks, but this is only for recovery. while (scriptGroupCount) { xfer->xferSnapshot(s_mtGroup); scriptGroupCount--; @@ -327,7 +327,7 @@ ScriptList *ScriptList::duplicate(void) const { const ScriptGroup *src = this->m_firstGroup; - ScriptGroup *dst = NULL; + ScriptGroup *dst = nullptr; while (src) { ScriptGroup *tmp = src->duplicate(); @@ -344,7 +344,7 @@ ScriptList *ScriptList::duplicate(void) const { const Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicate(); @@ -373,7 +373,7 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, { const ScriptGroup *src = this->m_firstGroup; - ScriptGroup *dst = NULL; + ScriptGroup *dst = nullptr; while (src) { ScriptGroup *tmp = src->duplicateAndQualify( qualifier, playerTemplateName, newPlayerName); @@ -390,7 +390,7 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, { const Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); @@ -413,8 +413,8 @@ ScriptList *ScriptList::duplicateAndQualify(const AsciiString& qualifier, */ void ScriptList::discard(void) { - m_firstGroup = NULL; - m_firstScript = NULL; + m_firstGroup = nullptr; + m_firstScript = nullptr; deleteInstance(this); } @@ -423,9 +423,9 @@ void ScriptList::discard(void) */ void ScriptList::addGroup(ScriptGroup *pGrp, Int ndx) { - ScriptGroup *pPrev = NULL; + ScriptGroup *pPrev = nullptr; ScriptGroup *pCur = m_firstGroup; - DEBUG_ASSERTCRASH(pGrp->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pGrp->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -447,9 +447,9 @@ void ScriptList::addGroup(ScriptGroup *pGrp, Int ndx) */ void ScriptList::addScript(Script *pScr, Int ndx) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; - DEBUG_ASSERTCRASH(pScr->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pScr->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -469,14 +469,14 @@ void ScriptList::addScript(Script *pScr, Int ndx) */ void ScriptList::deleteScript(Script *pScr) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; while (pCur != pScr) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find script.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { // unlink from previous script. @@ -486,7 +486,7 @@ void ScriptList::deleteScript(Script *pScr) m_firstScript = pCur->getNext(); } // Clear the link & delete. - pCur->setNextScript(NULL); + pCur->setNextScript(nullptr); deleteInstance(pCur); } @@ -495,14 +495,14 @@ void ScriptList::deleteScript(Script *pScr) */ void ScriptList::deleteGroup(ScriptGroup *pGrp) { - ScriptGroup *pPrev = NULL; + ScriptGroup *pPrev = nullptr; ScriptGroup *pCur = m_firstGroup; while (pCur != pGrp) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find group.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { // unlink from previous group. pPrev->setNextGroup(pCur->getNext()); @@ -511,7 +511,7 @@ void ScriptList::deleteGroup(ScriptGroup *pGrp) m_firstGroup = pCur->getNext(); } // Clear the link & delete. - pCur->setNextGroup(NULL); + pCur->setNextGroup(nullptr); deleteInstance(pCur); } @@ -529,11 +529,11 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); for (i=0; igetNext(); - cur->setNextGroup(NULL); // prevents recursion. + cur->setNextGroup(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -712,7 +712,7 @@ void ScriptGroup::xfer( Xfer *xfer ) } if (scriptCount>0) { DEBUG_CRASH(("Stripping out extra scripts - Bad...")); - if (s_mtScript==NULL) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. + if (s_mtScript==nullptr) s_mtScript = newInstance(Script); // Yes it leaks, but this is unusual recovery only. jba. while (scriptCount) { xfer->xferSnapshot(s_mtScript); scriptCount--; @@ -731,7 +731,7 @@ void ScriptGroup::loadPostProcess( void ) /** ScriptGroup::duplicate - Creates a full, "deep" copy of ScriptGroup. - m_nextGroup is NULL on the copy. + m_nextGroup is nullptr on the copy. */ ScriptGroup *ScriptGroup::duplicate(void) const { @@ -739,7 +739,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const { Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicate(); @@ -757,7 +757,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const pNew->m_groupName = this->m_groupName; pNew->m_isGroupActive = this->m_isGroupActive; pNew->m_isGroupSubroutine = this->m_isGroupSubroutine; - pNew->m_nextGroup = NULL; + pNew->m_nextGroup = nullptr; return pNew; } @@ -765,7 +765,7 @@ ScriptGroup *ScriptGroup::duplicate(void) const /** ScriptGroup::duplicateAndQualify - Creates a full, "deep" copy of ScriptGroup, adding qualifier to names. - m_nextGroup is NULL on the copy. + m_nextGroup is nullptr on the copy. */ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const @@ -774,7 +774,7 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, { Script *src = this->m_firstScript; - Script *dst = NULL; + Script *dst = nullptr; while (src) { Script *tmp = src->duplicateAndQualify(qualifier, playerTemplateName, newPlayerName); @@ -793,7 +793,7 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, pNew->m_groupName.concat(qualifier); pNew->m_isGroupActive = this->m_isGroupActive; pNew->m_isGroupSubroutine = this->m_isGroupSubroutine; - pNew->m_nextGroup = NULL; + pNew->m_nextGroup = nullptr; return pNew; } @@ -803,21 +803,21 @@ ScriptGroup *ScriptGroup::duplicateAndQualify(const AsciiString& qualifier, */ void ScriptGroup::deleteScript(Script *pScr) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; while (pScr != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find script.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextScript(pCur->getNext()); } else { m_firstScript = pCur->getNext(); } // Clear link & delete. - pCur->setNextScript(NULL); + pCur->setNextScript(nullptr); deleteInstance(pCur); } @@ -826,9 +826,9 @@ void ScriptGroup::deleteScript(Script *pScr) */ void ScriptGroup::addScript(Script *pScr, Int ndx) { - Script *pPrev = NULL; + Script *pPrev = nullptr; Script *pCur = m_firstScript; - DEBUG_ASSERTCRASH(pScr->getNext()==NULL, ("Adding already linked group.")); + DEBUG_ASSERTCRASH(pScr->getNext()==nullptr, ("Adding already linked group.")); while (ndx && pCur) { pPrev = pCur; pCur = pCur->getNext(); @@ -908,10 +908,10 @@ m_conditionExecutedCount(0), m_frameToEvaluateAt(0), m_isSubroutine(false), m_hasWarnings(false), -m_nextScript(NULL), -m_condition(NULL), -m_action(NULL), -m_actionFalse(NULL), +m_nextScript(nullptr), +m_condition(nullptr), +m_action(nullptr), +m_actionFalse(nullptr), m_curTime(0.0f) { } @@ -927,7 +927,7 @@ Script::~Script(void) Script *next; while (cur) { next = cur->getNext(); - cur->setNextScript(NULL); // prevents recursion. + cur->setNextScript(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -977,7 +977,7 @@ void Script::loadPostProcess( void ) /** Script::duplicate - Creates a full, "deep" copy of script. Condition list and action list is duplicated as well. Note - just the script, doesn't - duplicate a list of scripts. m_nextScript is NULL on the copy. + duplicate a list of scripts. m_nextScript is nullptr on the copy. */ Script *Script::duplicate(void) const { @@ -1011,7 +1011,7 @@ Script *Script::duplicate(void) const Script::duplicate - Creates a full, "deep" copy of script, with qualifier added to names. Condition list and action list is duplicated as well. Note - just the script, doesn't - duplicate a list of scripts. m_nextScript is NULL on the copy. + duplicate a list of scripts. m_nextScript is nullptr on the copy. */ Script *Script::duplicateAndQualify(const AsciiString& qualifier, const AsciiString& playerTemplateName, const AsciiString& newPlayerName) const @@ -1065,15 +1065,15 @@ void Script::updateFrom(Script *pSrc) deleteInstance(this->m_condition); this->m_condition = pSrc->m_condition; - pSrc->m_condition = NULL; + pSrc->m_condition = nullptr; deleteInstance(this->m_action); this->m_action = pSrc->m_action; - pSrc->m_action = NULL; + pSrc->m_action = nullptr; deleteInstance(this->m_actionFalse); this->m_actionFalse = pSrc->m_actionFalse; - pSrc->m_actionFalse = NULL; + pSrc->m_actionFalse = nullptr; } /** @@ -1081,20 +1081,20 @@ void Script::updateFrom(Script *pSrc) */ void Script::deleteOrCondition(OrCondition *pCond) { - OrCondition *pPrev = NULL; + OrCondition *pPrev = nullptr; OrCondition *pCur = m_condition; while (pCond != pCur) { pPrev = pCur; pCur = pCur->getNextOrCondition(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextOrCondition(pCur->getNextOrCondition()); } else { m_condition = pCur->getNextOrCondition(); } - pCur->setNextOrCondition(NULL); + pCur->setNextOrCondition(nullptr); deleteInstance(pCur); } @@ -1104,20 +1104,20 @@ void Script::deleteOrCondition(OrCondition *pCond) */ void Script::deleteAction(ScriptAction *pAct) { - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; ScriptAction *pCur = m_action; while (pAct != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find action.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextAction(pCur->getNext()); } else { m_action = pCur->getNext(); } - pCur->setNextAction(NULL); + pCur->setNextAction(nullptr); deleteInstance(pCur); } @@ -1127,20 +1127,20 @@ void Script::deleteAction(ScriptAction *pAct) */ void Script::deleteFalseAction(ScriptAction *pAct) { - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; ScriptAction *pCur = m_actionFalse; while (pAct != pCur) { pPrev = pCur; pCur = pCur->getNext(); } DEBUG_ASSERTCRASH(pCur, ("Couldn't find action.")); - if (pCur==NULL) return; + if (pCur==nullptr) return; if (pPrev) { pPrev->setNextAction(pCur->getNext()); } else { m_actionFalse = pCur->getNext(); } - pCur->setNextAction(NULL); + pCur->setNextAction(nullptr); deleteInstance(pCur); } @@ -1252,7 +1252,7 @@ Script *Script::ParseScript(DataChunkInput &file, unsigned short version) file.registerParser( "ScriptActionFalse", "Script", ScriptAction::ParseActionFalseDataChunk ); if (! file.parse(pScript) ) { - return NULL; + return nullptr; } DEBUG_ASSERTCRASH(file.atEndOfChunk(), ("Unexpected data left over.")); return pScript; @@ -1300,7 +1300,7 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) { OrCondition *myConditions = getOrCondition(); if ( myConditions == curOr ) { - return NULL; + return nullptr; } while (myConditions) { @@ -1311,7 +1311,7 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) } DEBUG_CRASH(("Tried to find an OrCondition that doesn't seem to exist (jkmcd)")); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1320,14 +1320,14 @@ OrCondition *Script::findPreviousOrCondition( OrCondition *curOr ) OrCondition::~OrCondition(void) { deleteInstance(m_firstAnd); - m_firstAnd = NULL; + m_firstAnd = nullptr; if (m_nextOr) { OrCondition *cur = m_nextOr; OrCondition *next; while (cur) { next = cur->getNextOrCondition(); - cur->setNextOrCondition(NULL); // prevents recursion. + cur->setNextOrCondition(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -1375,7 +1375,7 @@ OrCondition *OrCondition::duplicateAndQualify(const AsciiString& qualifier, Condition *OrCondition::removeCondition(Condition *pCond) { - Condition *pPrev = NULL; + Condition *pPrev = nullptr; Condition *pCur = m_firstAnd; while (pCond != pCur) { pPrev = pCur; @@ -1383,15 +1383,15 @@ Condition *OrCondition::removeCondition(Condition *pCond) } DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) - return NULL; + if (pCur==nullptr) + return nullptr; if (pPrev) { pPrev->setNextCondition(pCur->getNext()); } else { m_firstAnd = pCur->getNext(); } - pCur->setNextCondition(NULL); + pCur->setNextCondition(nullptr); return pCur; } @@ -1399,7 +1399,7 @@ void OrCondition::deleteCondition(Condition *pCond) { Condition *pCur = removeCondition(pCond); DEBUG_ASSERTCRASH(pCur, ("Couldn't find condition.")); - if (pCur==NULL) + if (pCur==nullptr) return; deleteInstance(pCur); } @@ -1459,7 +1459,7 @@ Condition *OrCondition::findPreviousCondition( Condition *curCond ) { Condition *myConditions = getFirstAndCondition(); if (myConditions == curCond) { - return NULL; + return nullptr; } while (myConditions) { @@ -1470,7 +1470,7 @@ Condition *OrCondition::findPreviousCondition( Condition *curCond ) } DEBUG_CRASH(("Searched for non-existent And Condition. (jkmcd)")); - return NULL; + return nullptr; } @@ -1483,12 +1483,12 @@ m_hasWarnings(false), m_customData(0), m_customFrame(0), m_numParms(0), -m_nextAndCondition(NULL) +m_nextAndCondition(nullptr) { Int i; for (i = 0; i < MAX_PARMS; i++) { - m_parms[i] = NULL; + m_parms[i] = nullptr; } } @@ -1498,11 +1498,11 @@ m_hasWarnings(false), m_customData(0), m_customFrame(0), m_numParms(0), -m_nextAndCondition(NULL) +m_nextAndCondition(nullptr) { Int i; for (i=0; igetConditionTemplate(m_conditionType); @@ -1570,14 +1570,14 @@ Condition::~Condition(void) Int i; for (i=0; igetNext(); - cur->setNextCondition(NULL); // prevents recursion. + cur->setNextCondition(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -2241,7 +2241,7 @@ ScriptAction::ScriptAction(): m_actionType(NO_OP), m_hasWarnings(false), m_numParms(0), -m_nextAction(NULL) +m_nextAction(nullptr) { } @@ -2251,7 +2251,7 @@ m_numParms(0) { Int i; for (i=0; igetActionTemplate(m_actionType); @@ -2327,14 +2327,14 @@ ScriptAction::~ScriptAction(void) Int i; for (i=0; igetNext(); - cur->setNextAction(NULL); // prevents recursion. + cur->setNextAction(nullptr); // prevents recursion. deleteInstance(cur); cur = next; } @@ -2676,5 +2676,5 @@ const char* const TheObjectFlagsNames[] = "Selectable", "AI Recruitable", "Player Targetable", - NULL, + nullptr, }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp index 901ea818d55..ae5a84d361e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/VictoryConditions.cpp @@ -58,7 +58,7 @@ #define ISSET(x) (m_victoryConditions & VICTORY_##x) //------------------------------------------------------------------------------------------------- -VictoryConditionsInterface *TheVictoryConditions = NULL; +VictoryConditionsInterface *TheVictoryConditions = nullptr; //------------------------------------------------------------------------------------------------- inline static Bool areAllies(const Player *p1, const Player *p2) @@ -126,7 +126,7 @@ void VictoryConditions::reset( void ) { for (Int i=0; igetPlayerNameKey() == NAMEKEY(pName)) { - GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):NULL; + GameSlot *slot = (TheGameInfo)?TheGameInfo->getSlot(idx):nullptr; if (slot && slot->isAI()) { DEBUG_LOG(("Marking AI player %s as defeated", pName.str())); @@ -226,7 +226,7 @@ void VictoryConditions::update( void ) { if (!m_singleAllianceRemaining) { - //MessageBoxOk(TheGameText->fetch("GUI:Defeat"), TheGameText->fetch("GUI:LocalDefeat"), NULL); + //MessageBoxOk(TheGameText->fetch("GUI:Defeat"), TheGameText->fetch("GUI:LocalDefeat"), nullptr); } m_localPlayerDefeated = true; // don't check again TheRadar->forceOn(localPlayer->getPlayerIndex(), TRUE); @@ -323,7 +323,7 @@ void VictoryConditions::cachePlayerPtrs( void ) } while (playerCount < MAX_PLAYER_COUNT) { - m_players[playerCount++] = NULL; + m_players[playerCount++] = nullptr; } if (m_localSlotNum < 0) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp index 878e3e70551..9945368e3e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CaveSystem.cpp @@ -34,7 +34,7 @@ #include "Common/Xfer.h" #include "GameLogic/CaveSystem.h" -CaveSystem *TheCaveSystem = NULL; +CaveSystem *TheCaveSystem = nullptr; CaveSystem::CaveSystem() { @@ -52,7 +52,7 @@ void CaveSystem::reset() { for( std::vector::iterator iter = m_tunnelTrackerVector.begin(); iter != m_tunnelTrackerVector.end(); iter++ ) { - TunnelTracker *currentTracker = *iter; // could be NULL, since we don't slide back to fill deleted entries so offsets don't shift + TunnelTracker *currentTracker = *iter; // could be null, since we don't slide back to fill deleted entries so offsets don't shift deleteInstance(currentTracker); } m_tunnelTrackerVector.clear(); @@ -65,8 +65,8 @@ void CaveSystem::update() Bool CaveSystem::canSwitchIndexToIndex( Int oldIndex, Int newIndex ) { // When I grant permission, you need to do it. ie call Unregister and then re-register with the new number - TunnelTracker *oldTracker = NULL; - TunnelTracker *newTracker = NULL; + TunnelTracker *oldTracker = nullptr; + TunnelTracker *newTracker = nullptr; if( m_tunnelTrackerVector.size() > oldIndex ) { oldTracker = m_tunnelTrackerVector[oldIndex]; @@ -93,18 +93,18 @@ void CaveSystem::registerNewCave( Int theIndex ) { // You are new and off the edge, so I will fill NULLs up to you and then make a newTracker at that spot while( theIndex >= m_tunnelTrackerVector.size() ) - m_tunnelTrackerVector.push_back( NULL ); + m_tunnelTrackerVector.push_back( nullptr ); needToCreate = TRUE; } else { // else you either exist or have existed, so I will either let things be or re-create that slot - if( m_tunnelTrackerVector[theIndex] == NULL ) + if( m_tunnelTrackerVector[theIndex] == nullptr ) needToCreate = TRUE; } - if( needToCreate )// if true, we new theIndex is the index of a NULL to be filled + if( needToCreate )// if true, we new theIndex is the index of a nullptr to be filled m_tunnelTrackerVector[theIndex] = newInstance(TunnelTracker); } @@ -117,13 +117,13 @@ void CaveSystem::unregisterCave( Int theIndex ) TunnelTracker *CaveSystem::getTunnelTrackerForCaveIndex( Int theIndex ) { - TunnelTracker *theTracker = NULL; + TunnelTracker *theTracker = nullptr; if( theIndex < m_tunnelTrackerVector.size() ) { theTracker = m_tunnelTrackerVector[theIndex]; } - DEBUG_ASSERTCRASH( theTracker != NULL, ("No one should be interested in a sub-cave that doesn't exist.") ); + DEBUG_ASSERTCRASH( theTracker != nullptr, ("No one should be interested in a sub-cave that doesn't exist.") ); return theTracker; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp index 33eb9cef8e6..b09946e6c4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp @@ -34,7 +34,7 @@ #include "GameLogic/CrateSystem.h" #include "Common/BitFlagsIO.h" -CrateSystem *TheCrateSystem = NULL; +CrateSystem *TheCrateSystem = nullptr; CrateSystem::CrateSystem() { @@ -93,7 +93,7 @@ void CrateSystem::parseCrateTemplateDefinition(INI* ini) name.set(c); CrateTemplate *crateTemplate = TheCrateSystem->friend_findCrateTemplate(name); - if (crateTemplate == NULL) { + if (crateTemplate == nullptr) { crateTemplate = TheCrateSystem->newCrateTemplate(name); if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) { @@ -113,7 +113,7 @@ CrateTemplate *CrateSystem::newCrateTemplate( AsciiString name ) { // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon CrateTemplate *ct = newInstance(CrateTemplate); @@ -134,7 +134,7 @@ CrateTemplate *CrateSystem::newCrateTemplate( AsciiString name ) CrateTemplate *CrateSystem::newCrateTemplateOverride( CrateTemplate *crateToOverride ) { if (!crateToOverride) { - return NULL; + return nullptr; } CrateTemplate *newOverride = newInstance(CrateTemplate); @@ -156,7 +156,7 @@ const CrateTemplate *CrateSystem::findCrateTemplate(AsciiString name) const } - return NULL; + return nullptr; } CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) @@ -167,7 +167,7 @@ CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) CrateTemplateOverride overridable(m_crateTemplateVector[i]); return const_cast((const CrateTemplate *)overridable); } - return NULL; + return nullptr; } @@ -179,13 +179,13 @@ CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name) //-------------------------------------------------------------------------------- const FieldParse CrateTemplate::TheCrateTemplateFieldParseTable[] = { - { "CreationChance", INI::parseReal, NULL, offsetof( CrateTemplate, m_creationChance ) }, + { "CreationChance", INI::parseReal, nullptr, offsetof( CrateTemplate, m_creationChance ) }, { "VeterancyLevel", INI::parseIndexList, TheVeterancyNames, offsetof( CrateTemplate, m_veterancyLevel ) }, - { "KilledByType", KindOfMaskType::parseFromINI, NULL, offsetof( CrateTemplate, m_killedByTypeKindof) }, - { "CrateObject", CrateTemplate::parseCrateCreationEntry, NULL, NULL }, - { "KillerScience", INI::parseScience, NULL, offsetof( CrateTemplate, m_killerScience) }, - { "OwnedByMaker", INI::parseBool, NULL, offsetof( CrateTemplate, m_isOwnedByMaker) }, - { NULL, NULL, NULL, NULL }, + { "KilledByType", KindOfMaskType::parseFromINI, nullptr, offsetof( CrateTemplate, m_killedByTypeKindof) }, + { "CrateObject", CrateTemplate::parseCrateCreationEntry, nullptr, 0 }, + { "KillerScience", INI::parseScience, nullptr, offsetof( CrateTemplate, m_killerScience) }, + { "OwnedByMaker", INI::parseBool, nullptr, offsetof( CrateTemplate, m_isOwnedByMaker) }, + { nullptr, nullptr, nullptr, 0 }, }; CrateTemplate::CrateTemplate() diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 15a07b0c608..88e6204e5d0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -81,7 +81,7 @@ const char* const DamageTypeFlags::s_bitNameList[] = "KILL_GARRISONED", "STATUS", - NULL + nullptr }; static_assert(ARRAY_SIZE(DamageTypeFlags::s_bitNameList) == DamageTypeFlags::NumBits + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 67a23d92c0d..e6852c63059 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -120,10 +120,10 @@ DECLARE_PERF_TIMER(SleepyMaintenance) #ifdef DO_UNIT_TIMINGS #pragma MESSAGE("*** WARNING *** DOING DO_UNIT_TIMINGS!!!!") Bool g_UT_gotUnit = false; -const ThingTemplate *g_UT_curThing = NULL; +const ThingTemplate *g_UT_curThing = nullptr; Bool g_UT_startTiming = false; -FILE *g_UT_timingLog=NULL; -FILE *g_UT_commaLog=NULL; +FILE *g_UT_timingLog=nullptr; +FILE *g_UT_commaLog=nullptr; // Note - this is only for gathering timing data! DO NOT DO THIS IN REGULAR CODE!!! JBA #define BRUTAL_TIMING_HACK #include "../../GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h" @@ -139,7 +139,7 @@ extern void externalAddTree(Coord3D location, Real scale, Real angle, AsciiStrin enum { OBJ_HASH_SIZE = 8192 }; /// The GameLogic singleton instance -GameLogic *TheGameLogic = NULL; +GameLogic *TheGameLogic = nullptr; static void findAndSelectCommandCenter(Object *obj, void* alreadyFound); @@ -186,7 +186,7 @@ static Waypoint * findNamedWaypoint(AsciiString name) return way; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -218,7 +218,7 @@ void setFPMode( void ) // ------------------------------------------------------------------------------------------------ GameLogic::GameLogic( void ) { - m_background = NULL; + m_background = nullptr; m_CRC = 0; m_isInUpdate = FALSE; @@ -239,8 +239,8 @@ GameLogic::GameLogic( void ) m_frameObjectsChangedTriggerAreas = 0; m_width = 0; m_height = 0; - m_objList = NULL; - m_curUpdateModule = NULL; + m_objList = nullptr; + m_curUpdateModule = nullptr; m_nextObjID = INVALID_ID; m_startNewGame = FALSE; m_gameMode = GAME_NONE; @@ -253,7 +253,7 @@ GameLogic::GameLogic( void ) m_inputEnabledMemory = TRUE; m_mouseVisibleMemory = TRUE; m_logicTimeScaleEnabledMemory = FALSE; - m_loadScreen = NULL; + m_loadScreen = nullptr; m_forceGameStartByTimeOut = FALSE; #ifdef DUMP_PERF_STATS m_overallFailedPathfinds = 0; @@ -298,7 +298,7 @@ void GameLogic::destroyAllObjectsImmediate() // process the destroy list immediately processDestroyList(); - DEBUG_ASSERTCRASH( m_objList == NULL, ("destroyAllObjectsImmediate: Object list not cleared") ); + DEBUG_ASSERTCRASH( m_objList == nullptr, ("destroyAllObjectsImmediate: Object list not cleared") ); } @@ -316,7 +316,7 @@ GameLogic::~GameLogic() { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } // destroy all remaining objects @@ -324,27 +324,27 @@ GameLogic::~GameLogic() // delete the logical terrain delete TheTerrainLogic; - TheTerrainLogic = NULL; + TheTerrainLogic = nullptr; delete TheGhostObjectManager; - TheGhostObjectManager=NULL; + TheGhostObjectManager=nullptr; // delete the partition manager delete ThePartitionManager; - ThePartitionManager = NULL; + ThePartitionManager = nullptr; delete TheScriptActions; - TheScriptActions = NULL; + TheScriptActions = nullptr; delete TheScriptConditions; - TheScriptConditions = NULL; + TheScriptConditions = nullptr; // delete the Script Engine delete TheScriptEngine; - TheScriptEngine = NULL; + TheScriptEngine = nullptr; // Null out TheGameLogic - TheGameLogic = NULL; + TheGameLogic = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -397,7 +397,7 @@ void GameLogic::reset( void ) // m_objHash.clear(); // m_objHash.resize(OBJ_HASH_SIZE); m_objVector.clear(); - m_objVector.resize(OBJ_HASH_SIZE, NULL); + m_objVector.resize(OBJ_HASH_SIZE, nullptr); m_pauseFrame = 0; m_gamePaused = FALSE; @@ -432,7 +432,7 @@ void GameLogic::reset( void ) m_forceGameStartByTimeOut = FALSE; delete TheStatsCollector; - TheStatsCollector = NULL; + TheStatsCollector = nullptr; // clear any table of contents we have m_objectTOC.clear(); @@ -441,7 +441,7 @@ void GameLogic::reset( void ) m_hasUpdated = FALSE; m_width = DEFAULT_WORLD_WIDTH; m_height = DEFAULT_WORLD_HEIGHT; - m_objList = NULL; + m_objList = nullptr; #ifdef ALLOW_NONSLEEPY_UPDATES m_normalUpdates.clear(); #endif @@ -450,7 +450,7 @@ void GameLogic::reset( void ) (*it)->friend_setIndexInLogic(-1); } m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; m_isScoringEnabled = TRUE; m_showBehindBuildingMarkers = TRUE; @@ -549,8 +549,8 @@ static void placeNetworkBuildingsForPlayer(Int slotNum, const GameSlot *pSlot, P if (!conYard) return; - pPlayer->onStructureCreated(NULL, conYard); - pPlayer->onStructureConstructionComplete(NULL, conYard, FALSE); + pPlayer->onStructureCreated(nullptr, conYard); + pPlayer->onStructureConstructionComplete(nullptr, conYard, FALSE); //pos.x -= conYard->getGeometryInfo().getBoundingSphereRadius()/2; pos.y -= conYard->getGeometryInfo().getBoundingSphereRadius()/2; @@ -578,7 +578,7 @@ static void placeNetworkBuildingsForPlayer(Int slotNum, const GameSlot *pSlot, P { Object *unit = placeObjectAtPosition(slotNum, objName, objPos, pPlayer, pTemplate); if (unit) { - pPlayer->onUnitCreated(NULL, unit); + pPlayer->onUnitCreated(nullptr, unit); } } else @@ -627,7 +627,7 @@ LoadScreen *GameLogic::getLoadScreen( Bool loadingSaveGame ) break; case GAME_NONE: default: - return NULL; + return nullptr; } } @@ -1070,7 +1070,7 @@ void GameLogic::deleteLoadScreen( void ) { delete m_loadScreen; - m_loadScreen = NULL; + m_loadScreen = nullptr; } @@ -1151,13 +1151,13 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } m_loadScreen = getLoadScreen( loadingSaveGame ); if(m_loadScreen) { TheWritableGlobalData->m_loadScreenRender = TRUE; ///< mark it so only a few select things are rendered during load - m_loadScreen->init(NULL); + m_loadScreen->init(nullptr); } } @@ -1186,7 +1186,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) Bool isChallengeCampaign = m_gameMode == GAME_SINGLE_PLAYER && currentCampaign && currentCampaign->m_isChallengeCampaign; // Fill in the game color and Factions before we do the Load Screen - TheGameInfo = NULL; + TheGameInfo = nullptr; Int localSlot = 0; if (TheNetwork) { @@ -1252,7 +1252,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } else { if (m_gameMode == GAME_SINGLE_PLAYER) { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } } @@ -1279,7 +1279,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } setFPMode(); if(TheCampaignManager) @@ -1536,7 +1536,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) ChunkInputStream *pStrm = &theInputStream; DataChunkInput file( pStrm ); file.registerParser( "PlayerScriptsList", AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk ); - if (!file.parse(NULL)) { + if (!file.parse(nullptr)) { DEBUG_LOG(("ERROR - Unable to read in multiplayer scripts.")); return; } @@ -1545,7 +1545,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (count) { ScriptList *pSL = TheSidesList->getSideInfo(0)->getScriptList(); - if (pSL != NULL) + if (pSL != nullptr) { Script *next = scripts[0]->getScript(); while (next) @@ -1694,7 +1694,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // get thing template based from map object name thingTemplate = pMapObj->getThingTemplate(); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) continue; if (!thingTemplate->isBridgeLike()) @@ -1800,7 +1800,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { // get thing template based from map object name thingTemplate = pMapObj->getThingTemplate(); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) continue; // don't create trees and shrubs if this is one and we have that option off if( thingTemplate->isKindOf( KINDOF_SHRUBBERY ) && !useTrees ) @@ -1838,7 +1838,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // have temporary templates created 'on the fly' during a // ThingFactory->findTemplate() call when loading from the map file // - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) continue; if (thingTemplate->isBridgeLike()) @@ -1965,7 +1965,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } else { - const PlayerTemplate* pt = NULL; + const PlayerTemplate* pt = nullptr; pt = ThePlayerTemplateStore->getNthPlayerTemplate(slot->getPlayerTemplate()); // Prevent from loading the disabled Generals, in case your game peer hacked their GUI. @@ -2152,7 +2152,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { Player *pPlayer = ThePlayerList->getNthPlayer(i); if (pPlayer && pPlayer->getPlayerType() != PLAYER_HUMAN) - pPlayer = NULL; + pPlayer = nullptr; if (pPlayer) { @@ -2179,7 +2179,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } // if we're in a load game, don't fade yet - if(loadingSaveGame == FALSE && TheTransitionHandler != NULL && m_loadScreen) + if(loadingSaveGame == FALSE && TheTransitionHandler != nullptr && m_loadScreen) { TheTransitionHandler->setGroup("FadeWholeScreen"); while(!TheTransitionHandler->isFinished()) @@ -2341,7 +2341,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // Drawables need to do some work on level start; give them a chance to do it Drawable * drawable = TheGameClient->getDrawableList(); - while ( drawable != NULL ) + while ( drawable != nullptr ) { drawable->onLevelStart(); drawable = drawable->getNextDrawable(); @@ -2445,7 +2445,7 @@ void GameLogic::loadMapINI( AsciiString mapName ) if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading map.ini")); INI ini; - ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); + ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, nullptr ); } // TheSuperHackers @todo Implement ini load directory for map folder. @@ -2455,7 +2455,7 @@ void GameLogic::loadMapINI( AsciiString mapName ) if (TheFileSystem->doesFileExist(fullFledgeFilename)) { DEBUG_LOG(("Loading solo.ini")); INI ini; - ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, NULL ); + ini.load( AsciiString(fullFledgeFilename), INI_LOAD_CREATE_OVERRIDES, nullptr ); } // No error here. There could've just *not* been a map.ini file. @@ -2566,9 +2566,9 @@ void GameLogic::processCommandList( CommandList *list ) for( msg = list->getFirstMessage(); msg; msg = msg->next() ) { #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(msg != NULL && msg != (GameMessage*)0xdeadbeef, ("bad msg")); + DEBUG_ASSERTCRASH(msg != nullptr && msg != (GameMessage*)0xdeadbeef, ("bad msg")); #endif - logicMessageDispatcher( msg, NULL ); + logicMessageDispatcher( msg, nullptr ); } if (m_shouldValidateCRCs && !TheNetwork->sawCRCMismatch()) @@ -2732,8 +2732,8 @@ void GameLogic::deselectObject(Object *obj, PlayerMaskType playerMask, Bool affe group->removeAll(); #endif } else { - // NULL will clear the group. - player->setCurrentlySelectedAIGroup(NULL); + // nullptr will clear the group. + player->setCurrentlySelectedAIGroup(nullptr); } if (affectClient) { @@ -2965,7 +2965,7 @@ void GameLogic::pushSleepyUpdate(UpdateModulePtr u) { USE_PERF_TIMER(SleepyMaintenance) - DEBUG_ASSERTCRASH(u != NULL, ("You may not pass null for sleepy update info")); + DEBUG_ASSERTCRASH(u != nullptr, ("You may not pass null for sleepy update info")); m_sleepyUpdates.push_back(u); u->friend_setIndexInLogic(m_sleepyUpdates.size() - 1); @@ -3246,7 +3246,7 @@ static void unitTimings(void) timeNoSpawn = timeToUpdate; drawCallNoSpawn = (float)drawCallTotal / (float)(TIME_FRAMES * TOTAL_UNITS); // 100 units for TIME_FRAMES } - if (g_UT_curThing==NULL) return; + if (g_UT_curThing==nullptr) return; char remark[2048]; @@ -3314,7 +3314,7 @@ static void unitTimings(void) if (mi.getCount() > 0) { const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; if (md) { modelName = md->getBestModelNameForWB(state); @@ -3342,11 +3342,11 @@ static void unitTimings(void) if (g_UT_curThing->getName()==SINGLE_UNIT) { if (g_UT_timingLog) { fclose(g_UT_timingLog); - g_UT_timingLog = NULL; + g_UT_timingLog = nullptr; } if (g_UT_commaLog) { fclose(g_UT_commaLog); - g_UT_commaLog = NULL; + g_UT_commaLog = nullptr; } return; } @@ -3373,7 +3373,7 @@ static void unitTimings(void) } g_UT_curThing = g_UT_curThing->friend_getNextTemplate(); - if (g_UT_curThing == NULL) { + if (g_UT_curThing == nullptr) { unitTypes++; if (unitTypes==END) { side++; @@ -3384,12 +3384,12 @@ static void unitTimings(void) if (g_UT_timingLog) { fclose(g_UT_timingLog); - g_UT_timingLog = NULL; + g_UT_timingLog = nullptr; } if (g_UT_commaLog) { fclose(g_UT_commaLog); - g_UT_commaLog = NULL; + g_UT_commaLog = nullptr; } break; } @@ -3456,14 +3456,14 @@ static void unitTimings(void) "Ambient", "GC_", "SpecialEffectsTrainCrashObject", - NULL + nullptr }; Bool skip = FALSE; for ( Int test = 0; test < sizeof( illegalTemplateNames ) ; ++test ) { - if ( illegalTemplateNames[test] == NULL ) + if ( illegalTemplateNames[test] == nullptr ) break; if (btt->getName().startsWith(illegalTemplateNames[test])) @@ -3536,7 +3536,7 @@ static void unitTimings(void) pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ); Team *team = ThePlayerList->getNthPlayer(1)->getDefaultTeam(); Object *obj = TheThingFactory->newObject( btt, team ); - if (obj==NULL) break; + if (obj==nullptr) break; #define dont_DO_TREE 1 #ifdef DO_TREE TheGameLogic->destroyObject(obj); @@ -3729,7 +3729,7 @@ void GameLogic::update( void ) u->update(); #endif - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } } } @@ -3768,7 +3768,7 @@ void GameLogic::update( void ) if (sleepLen < 1) sleepLen = UPDATE_SLEEP_NONE; - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } @@ -3874,14 +3874,14 @@ void GameLogic::addObjectToLookupTable( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // add to lookup // m_objHash[ obj->getID() ] = obj; ObjectID newID = obj->getID(); while( newID >= m_objVector.size() ) // Fail case is hella rare, so faster to double up on size() call - m_objVector.resize(m_objVector.size() * 2, NULL); + m_objVector.resize(m_objVector.size() * 2, nullptr); m_objVector[ newID ] = obj; @@ -3895,12 +3895,12 @@ void GameLogic::removeObjectFromLookupTable( Object *obj ) // sanity // TheSuperHackers @fix Mauller/Xezon 24/04/2025 Prevent out of range access to vector lookup table - if( obj == NULL || static_cast(obj->getID()) >= m_objVector.size() ) + if( obj == nullptr || static_cast(obj->getID()) >= m_objVector.size() ) return; // remove from lookup table // m_objHash.erase( obj->getID() ); - m_objVector[ obj->getID() ] = NULL; + m_objVector[ obj->getID() ] = nullptr; } @@ -3981,7 +3981,7 @@ Object *GameLogic::friend_createObject( const ThingTemplate *thing, const Object // ------------------------------------------------------------------------------------------------ void GameLogic::destroyObject( Object *obj ) { - DEBUG_ASSERTCRASH(obj != NULL, ("destroying null object")); + DEBUG_ASSERTCRASH(obj != nullptr, ("destroying null object")); // if already flagged for destruction, ignore if (!obj || obj->isDestroyed()) @@ -4150,7 +4150,7 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) UnsignedInt theCRC = xferCRC->getCRC(); delete xferCRC; - xferCRC = NULL; + xferCRC = nullptr; if (isInGameLogicUpdate()) { @@ -4200,7 +4200,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) // Because this implementation is a bridge between the Logic and Interface, // we must take extra care to handle such cases as when the system it // shutting down. - if(TheGameClient == NULL) + if(TheGameClient == nullptr) return; // destroy the drawable @@ -4211,7 +4211,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) } // erase the binding of the drawable to this object - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -4607,7 +4607,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -4621,7 +4621,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -4666,7 +4666,7 @@ void GameLogic::xferObjectTOC( Xfer *xfer ) templateName = obj->getTemplate()->getName(); // if is this object name already in the TOC, skip it - if( findTOCEntryByName( templateName ) != NULL ) + if( findTOCEntryByName( templateName ) != nullptr ) continue; // add this entry to the TOC @@ -4787,7 +4787,7 @@ void GameLogic::prepareLogicForObjectLoad( void ) processDestroyList(); // there should be no objects anywhere - DEBUG_ASSERTCRASH( getFirstObject() == NULL, + DEBUG_ASSERTCRASH( getFirstObject() == nullptr, ("GameLogic::prepareLogicForObjectLoad - There are still objects loaded in the engine, but it should be empty (Top is '%s')", getFirstObject()->getTemplate()->getName().str()) ); @@ -4849,7 +4849,7 @@ void GameLogic::xfer( Xfer *xfer ) // get the object TOC entry for this template tocEntry = findTOCEntryByName( obj->getTemplate()->getName() ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Object TOC entry not found for '%s'", obj->getTemplate()->getName().str() )); @@ -4889,7 +4889,7 @@ void GameLogic::xfer( Xfer *xfer ) // find Object TOC entry with this identifier tocEntry = findTOCEntryById( tocID ); - if( tocEntry == NULL ) + if( tocEntry == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - No TOC entry match for id '%d'", tocID )); @@ -4902,7 +4902,7 @@ void GameLogic::xfer( Xfer *xfer ) // find matching thing template thingTemplate = TheThingFactory->findTemplate( tocEntry->name ); - if( thingTemplate == NULL ) + if( thingTemplate == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Unrecognized thing template name '%s', skipping. ENGINEERS - Are you *sure* it's OK to be ignoring this object from the save file??? Think hard about it!", @@ -5001,7 +5001,7 @@ void GameLogic::xfer( Xfer *xfer ) poly = PolygonTrigger::getPolygonTriggerByID( triggerID ); // sanity - if( poly == NULL ) + if( poly == nullptr ) { DEBUG_CRASH(( "GameLogic::xfer - Unable to find polygon trigger with id '%d'", @@ -5107,11 +5107,11 @@ void GameLogic::xfer( Xfer *xfer ) break; AsciiString value; xfer->xferAsciiString(&value); - ConstCommandButtonPtr button = NULL; + ConstCommandButtonPtr button = nullptr; if (value.isNotEmpty()) { button = TheControlBar->findCommandButton(value); - DEBUG_ASSERTCRASH(button != NULL, ("Could not find button %s",value.str())); + DEBUG_ASSERTCRASH(button != nullptr, ("Could not find button %s",value.str())); } m_controlBarOverrides[name] = button; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index ef0b9794c01..397edece8d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -93,7 +93,7 @@ static Bool theBuildPlan = false; static Object *thePlanSubject[ MAX_PATH_SUBJECTS ]; static int thePlanSubjectCount = 0; -//static WindowLayout *background = NULL; +//static WindowLayout *background = nullptr; // ------------------------------------------------------------------------------------------------ /** Issue the movement command to the object */ @@ -215,7 +215,7 @@ static Object * getSingleObjectFromSelection(const AIGroup *currentlySelectedGro VecObjectID::const_iterator it = selectedObjects.begin(); return TheGameLogic->findObjectByID(*it); } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -232,8 +232,8 @@ void GameLogic::closeWindows( void ) // hide the options menu NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( NULL, buttonID ); - GameWindow *window = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey("OptionsMenu.wnd:OptionsMenuParent") ); + GameWindow *button = TheWindowManager->winGetWindowFromId( nullptr, buttonID ); + GameWindow *window = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("OptionsMenu.wnd:OptionsMenuParent") ); if(window) TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)button, buttonID ); @@ -294,7 +294,7 @@ void GameLogic::clearGameData( Bool showScoreScreen ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } setClearingGameData( FALSE ); @@ -346,14 +346,14 @@ void GameLogic::prepareNewGame( GameMode gameMode, GameDifficulty diff, Int rank void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { #ifdef RTS_DEBUG - DEBUG_ASSERTCRASH(msg != NULL && msg != (GameMessage*)0xdeadbeef, ("bad msg")); + DEBUG_ASSERTCRASH(msg != nullptr && msg != (GameMessage*)0xdeadbeef, ("bad msg")); #endif Player *thisPlayer = ThePlayerList->getNthPlayer( msg->getPlayerIndex() ); DEBUG_ASSERTCRASH( thisPlayer, ("logicMessageDispatcher: Processing message from unknown player (player index '%d')", msg->getPlayerIndex()) ); - AIGroupPtr currentlySelectedGroup = NULL; + AIGroupPtr currentlySelectedGroup = nullptr; if (isInGame()) { @@ -377,13 +377,13 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #if RETAIL_COMPATIBLE_AIGROUP TheAI->destroyGroup(currentlySelectedGroup); #endif - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; } // If there are any units that the player doesn't own, then remove them from the "currentlySelectedGroup" if (currentlySelectedGroup) if (currentlySelectedGroup->removeAnyObjectsNotOwnedByPlayer(thisPlayer)) - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; if(TheStatsCollector) TheStatsCollector->collectMsgStats(msg); @@ -465,7 +465,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) currentlySelectedGroup->removeAll(); #endif } - currentlySelectedGroup = NULL; + currentlySelectedGroup = nullptr; clearGameData(); break; @@ -529,7 +529,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // lock it just till the weapon is empty or the attack is "done" if( currentlySelectedGroup && currentlySelectedGroup->setWeaponLockForGroup( weaponSlot, LOCKED_TEMPORARILY )) { - currentlySelectedGroup->groupAttackPosition( NULL, maxShotsToFire, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupAttackPosition( nullptr, maxShotsToFire, CMD_FROM_PLAYER ); } break; @@ -567,7 +567,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Coord3D targetLoc = msg->getArgument( 0 )->location; if( currentlySelectedGroup ) - currentlySelectedGroup->groupCombatDrop( NULL, targetLoc, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupCombatDrop( nullptr, targetLoc, CMD_FROM_PLAYER ); /* if( sourceObject ) @@ -575,7 +575,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) AIUpdateInterface* sourceAI = sourceObject->getAIUpdateInterface(); if (sourceAI) { - sourceAI->aiCombatDrop( NULL, targetLoc, CMD_FROM_PLAYER ); + sourceAI->aiCombatDrop( nullptr, targetLoc, CMD_FROM_PLAYER ); } } */ @@ -594,7 +594,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Int maxShotsToFire = msg->getArgument( 2 )->integer; // sanity - if( targetObject == NULL ) + if( targetObject == nullptr ) break; @@ -678,7 +678,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(2)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -723,7 +723,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(5)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -766,7 +766,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // check for possible specific source, ignoring selection. ObjectID sourceID = msg->getArgument(3)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -1003,7 +1003,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *enter = findObjectByID( msg->getArgument( 1 )->objectID ); // sanity - if( enter == NULL ) + if( enter == nullptr ) break; if( currentlySelectedGroup ) @@ -1027,10 +1027,10 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif // sanity - if( objectWantingToExit == NULL ) + if( objectWantingToExit == nullptr ) break; - if( objectContainingExiter == NULL ) + if( objectContainingExiter == nullptr ) break; // sanity, the player must actually control this object @@ -1112,7 +1112,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *repairDepot = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( repairDepot == NULL ) + if( repairDepot == nullptr ) break; // tell the currently selected group to go get repaired @@ -1129,7 +1129,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *dockBuilding = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( dockBuilding == NULL ) + if( dockBuilding == nullptr ) break; // tell the currently selected group to go get repaired @@ -1146,7 +1146,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *healDest = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( healDest == NULL ) + if( healDest == nullptr ) break; // tell the currently selected group to enter the building for healing @@ -1163,7 +1163,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *repairTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( repairTarget == NULL ) + if( repairTarget == nullptr ) break; // @@ -1183,7 +1183,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Object *constructTarget = findObjectByID( msg->getArgument( 0 )->objectID ); // sanity - if( constructTarget == NULL ) + if( constructTarget == nullptr ) break; // @@ -1209,7 +1209,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ObjectID sourceID = msg->getArgument(2)->objectID; Object* source = findObjectByID(sourceID); - if (source != NULL) + if (source != nullptr) { AIGroupPtr theGroup = TheAI->createGroup(); theGroup->add(source); @@ -1338,7 +1338,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) const UpgradeTemplate *upgradeT = TheUpgradeCenter->findUpgradeByKey( (NameKeyType)(msg->getArgument( 0 )->integer) ); // sanity - if( producer == NULL || upgradeT == NULL ) + if( producer == nullptr || upgradeT == nullptr ) break; // the player must actually control the producer object @@ -1347,7 +1347,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // producer must have a production update ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // cancel the upgrade @@ -1373,12 +1373,12 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) productionID = (ProductionID)msg->getArgument( 1 )->integer; // sanity - if ( producer == NULL || whatToCreate == NULL ) + if ( producer == nullptr || whatToCreate == nullptr ) break; // get the production interface for the producer ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) { DEBUG_ASSERTCRASH( 0, ("MSG_QUEUE_UNIT_CREATE: Producer '%s' doesn't have a unit production interface", @@ -1405,7 +1405,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ProductionID productionID = (ProductionID)msg->getArgument( 0 )->integer; // sanity - if( producer == NULL ) + if( producer == nullptr ) break; // sanity, the player must control the producer @@ -1414,7 +1414,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // get the unit production interface ProductionUpdateInterface *pu = producer->getProductionUpdateInterface(); - if( pu == NULL ) + if( pu == nullptr ) break; // cancel the production @@ -1442,7 +1442,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) loc = msg->getArgument( 1 )->location; angle = msg->getArgument( 2 )->real; - if( place == NULL || constructorObject == NULL ) + if( place == nullptr || constructorObject == nullptr ) break; //These are not crashes, as the object may have died before this message came in if( msg->getType() == GameMessage::MSG_DOZER_CONSTRUCT ) @@ -1489,7 +1489,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #else Object *building = getSingleObjectFromSelection(currentlySelectedGroup.Peek()); #endif - if( building == NULL ) + if( building == nullptr ) break; // the player sending this message must actually control this building @@ -1570,7 +1570,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // use selected group if( currentlySelectedGroup ) - currentlySelectedGroup->groupReturnToPrison( NULL, CMD_FROM_PLAYER ); + currentlySelectedGroup->groupReturnToPrison( nullptr, CMD_FROM_PLAYER ); break; @@ -1585,7 +1585,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Bool createNewGroup = msg->getArgument( 0 )->boolean; Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player == NULL) { + if (player == nullptr) { DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); break; } @@ -1611,7 +1611,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player == NULL) { + if (player == nullptr) { DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); break; } @@ -1634,9 +1634,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) case GameMessage::MSG_DESTROY_SELECTED_GROUP: { Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); - if (player != NULL) + if (player != nullptr) { - player->setCurrentlySelectedAIGroup(NULL); + player->setCurrentlySelectedAIGroup(nullptr); } break; @@ -1654,7 +1654,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) // -------------------------------------------------------------------------------------------- case GameMessage::MSG_PLACE_BEACON: { - if (thisPlayer->getPlayerTemplate() == NULL) + if (thisPlayer->getPlayerTemplate() == nullptr) break; Coord3D pos = msg->getArgument( 0 )->location; Region3D r; @@ -1686,7 +1686,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } Object *object = TheThingFactory->newObject( thing, thisPlayer->getDefaultTeam() ); object->setPosition( &pos ); - object->setProducer(NULL); + object->setProducer(nullptr); if (thisPlayer->getRelationship( ThePlayerList->getLocalPlayer()->getDefaultTeam() ) == ALLIES || ThePlayerList->getLocalPlayer()->isPlayerObserver()) { @@ -1804,7 +1804,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (allSelectedObjects->isEmpty()) { TheAI->destroyGroup(allSelectedObjects); - allSelectedObjects = NULL; + allSelectedObjects = nullptr; } #endif } @@ -1928,7 +1928,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for create team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for create team message")); // TheSuperHackers @tweak Stubbjax 17/08/2025 The local player processes this message in CommandXlat for immediate assignment. if (player && !player->isLocalPlayer()) @@ -1950,9 +1950,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for select team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for select team message")); - if (player == NULL) + if (player == nullptr) { break; } @@ -1974,9 +1974,9 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) { Int playerIndex = msg->getPlayerIndex(); Player *player = ThePlayerList->getNthPlayer(playerIndex); - DEBUG_ASSERTCRASH(player != NULL, ("Could not find player for add team message")); + DEBUG_ASSERTCRASH(player != nullptr, ("Could not find player for add team message")); - if (player == NULL) + if (player == nullptr) { break; } @@ -2041,7 +2041,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) ScienceType science = (ScienceType)msg->getArgument( 0 )->integer; // sanity - if( science == SCIENCE_INVALID || thisPlayer == NULL ) + if( science == SCIENCE_INVALID || thisPlayer == nullptr ) break; thisPlayer->attemptToPurchaseScience(science); @@ -2078,7 +2078,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } /**/ - if( currentlySelectedGroup != NULL ) + if( currentlySelectedGroup != nullptr ) { #if RETAIL_COMPATIBLE_AIGROUP TheAI->destroyGroup(currentlySelectedGroup); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp index f7435bcd740..7ec48b5c37a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp @@ -33,7 +33,7 @@ #include "Common/Player.h" #include "GameLogic/RankInfo.h" -RankInfoStore* TheRankInfoStore = NULL; +RankInfoStore* TheRankInfoStore = nullptr; //----------------------------------------------------------------------------- @@ -105,7 +105,7 @@ const RankInfo* RankInfoStore::getRankInfo(Int level) const return (const RankInfo*)ri->getFinalOverride(); } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -117,11 +117,11 @@ void RankInfoStore::friend_parseRankDefinition( INI* ini ) static const FieldParse myFieldParse[] = { - { "RankName", INI::parseAndTranslateLabel, NULL, offsetof( RankInfo, m_rankName ) }, - { "SkillPointsNeeded", INI::parseInt, NULL, offsetof( RankInfo, m_skillPointsNeeded ) }, - { "SciencesGranted", INI::parseScienceVector, NULL, offsetof( RankInfo, m_sciencesGranted ) }, - { "SciencePurchasePointsGranted", INI::parseUnsignedInt, NULL, offsetof( RankInfo, m_sciencePurchasePointsGranted ) }, - { 0, 0, 0, 0 } + { "RankName", INI::parseAndTranslateLabel, nullptr, offsetof( RankInfo, m_rankName ) }, + { "SkillPointsNeeded", INI::parseInt, nullptr, offsetof( RankInfo, m_skillPointsNeeded ) }, + { "SciencesGranted", INI::parseScienceVector, nullptr, offsetof( RankInfo, m_sciencesGranted ) }, + { "SciencePurchasePointsGranted", INI::parseUnsignedInt, nullptr, offsetof( RankInfo, m_sciencePurchasePointsGranted ) }, + { nullptr, nullptr, nullptr, 0 } }; if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index 40eab1badfe..f5ef398b0f8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -73,7 +73,7 @@ void EnableAcceptControls(Bool Enabled, GameInfo *myGame, GameWindow *comboPlaye Bool isObserver = myGame->getConstSlot(slotNum)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER; - if( !myGame->amIHost() && (buttonStart != NULL) ) + if( !myGame->amIHost() && (buttonStart != nullptr) ) buttonStart->winEnable(Enabled); if(comboColor[slotNum]) { @@ -134,7 +134,7 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha AsciiString parentNameStr; parentNameStr.format("%s:%s", layoutFilename, parentName); NameKeyType parentID = NAMEKEY(parentNameStr); - GameWindow *parent = TheWindowManager->winGetWindowFromId( NULL, parentID ); + GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); if (!parent) { DEBUG_CRASH(("Window %s not found", parentNameStr.str())); @@ -467,10 +467,10 @@ void UpdateSlotList( GameInfo *myGame, GameWindow *comboPlayer[], comboPlayer[i]->winEnable( FALSE ); } //if( i == myGame->getLocalSlotNum()) - if((comboColor[i] != NULL) && BitIsSet(comboColor[i]->winGetStatus(), WIN_STATUS_ENABLED)) + if((comboColor[i] != nullptr) && BitIsSet(comboColor[i]->winGetStatus(), WIN_STATUS_ENABLED)) PopulateColorComboBox(i, comboColor, myGame, myGame->getConstSlot(i)->getPlayerTemplate() == PLAYERTEMPLATE_OBSERVER); Int max, idx; - if (comboColor[i] != NULL) { + if (comboColor[i] != nullptr) { max = GadgetComboBoxGetLength(comboColor[i]); for (idx=0; idxprofile, arg->message)); - //gpGetInfo(pconn, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, NULL); + //gpGetInfo(pconn, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, nullptr); //printf("MESSAGE (%d): %s: %s\n", msgCount,whois, arg->message); } @@ -135,7 +135,7 @@ void GPErrorCallback(GPConnection * pconnection, GPErrorArg * arg, void * param) GameSpyCloseOverlay(GSOVERLAY_BUDDY); if (TheGameSpyChat->isConnected()) { - GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, NULL); + GSMessageBoxYesNo(TheGameText->fetch("GUI:GPErrorTitle"), TheGameText->fetch("GUI:GPDisconnected"), buddyTryReconnect, nullptr); } } else diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp index 5cfe1211d04..8c358429459 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp @@ -46,7 +46,7 @@ // Singleton ------------------------------------------ -GameSpyGameInfo *TheGameSpyGame = NULL; +GameSpyGameInfo *TheGameSpyGame = nullptr; // Helper Functions ---------------------------------------- @@ -187,7 +187,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load INETMIB1.DLL")); HINSTANCE mib_ii_dll = LoadLibrary("inetmib1.dll"); - if (mib_ii_dll == NULL) { + if (mib_ii_dll == nullptr) { DEBUG_LOG(("Failed to load INETMIB1.DLL")); return(false); } @@ -195,7 +195,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP DEBUG_LOG(("About to load SNMPAPI.DLL")); HINSTANCE snmpapi_dll = LoadLibrary("snmpapi.dll"); - if (snmpapi_dll == NULL) { + if (snmpapi_dll == nullptr) { DEBUG_LOG(("Failed to load SNMPAPI.DLL")); FreeLibrary(mib_ii_dll); return(false); @@ -208,7 +208,7 @@ Bool GetLocalChatConnectionAddress(AsciiString serverName, UnsignedShort serverP SnmpExtensionQueryPtr = (int (__stdcall *)(unsigned char,SnmpVarBindList *,long *,long *)) GetProcAddress(mib_ii_dll, "SnmpExtensionQuery"); SnmpUtilMemAllocPtr = (void *(__stdcall *)(unsigned long)) GetProcAddress(snmpapi_dll, "SnmpUtilMemAlloc"); SnmpUtilMemFreePtr = (void (__stdcall *)(void *)) GetProcAddress(snmpapi_dll, "SnmpUtilMemFree"); - if (SnmpExtensionInitPtr == NULL || SnmpExtensionQueryPtr == NULL || SnmpUtilMemAllocPtr == NULL || SnmpUtilMemFreePtr == NULL) { + if (SnmpExtensionInitPtr == nullptr || SnmpExtensionQueryPtr == nullptr || SnmpUtilMemAllocPtr == nullptr || SnmpUtilMemFreePtr == nullptr) { DEBUG_LOG(("Failed to get proc addresses for linked functions")); FreeLibrary(snmpapi_dll); FreeLibrary(mib_ii_dll); @@ -449,8 +449,8 @@ GameSpyGameInfo::GameSpyGameInfo() { setLocalIP(0); } - m_server = NULL; - m_transport = NULL; + m_server = nullptr; + m_transport = nullptr; } // Misc game-related functionality -------------------- @@ -475,7 +475,7 @@ void GameSpyStartGame( void ) { UnicodeString text; text.format(TheGameText->fetch("LAN:NeedMorePlayers"),numUsers); - TheGameSpyInfo->addText(text, GSCOLOR_DEFAULT, NULL); + TheGameSpyInfo->addText(text, GSCOLOR_DEFAULT, nullptr); } return; } @@ -492,11 +492,11 @@ void GameSpyLaunchGame( void ) // Set up the game network AsciiString user; AsciiString userList; - DEBUG_ASSERTCRASH(TheNetwork == NULL, ("For some reason TheNetwork isn't NULL at the start of this game. Better look into that.")); + DEBUG_ASSERTCRASH(TheNetwork == nullptr, ("For some reason TheNetwork isn't null at the start of this game. Better look into that.")); - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; } // Time to initialize TheNetwork for this game. @@ -518,7 +518,7 @@ void GameSpyLaunchGame( void ) { DEBUG_CRASH(("No GameSlot[%d]!", i)); delete TheNetwork; - TheNetwork = NULL; + TheNetwork = nullptr; return; } @@ -566,9 +566,9 @@ void GameSpyLaunchGame( void ) InitGameLogicRandom( TheGameSpyGame->getSeed() ); DEBUG_LOG(("InitGameLogicRandom( %d )", TheGameSpyGame->getSeed())); - if (TheNAT != NULL) { + if (TheNAT != nullptr) { delete TheNAT; - TheNAT = NULL; + TheNAT = nullptr; } } } @@ -603,7 +603,7 @@ Int GameSpyGameInfo::getLocalSlotNum( void ) const for (Int i=0; iisPlayer(localName)) @@ -621,8 +621,8 @@ void GameSpyGameInfo::gotGOACall( void ) void GameSpyGameInfo::startGame(Int gameID) { DEBUG_LOG(("GameSpyGameInfo::startGame - game id = %d", gameID)); - DEBUG_ASSERTCRASH(m_transport == NULL, ("m_transport is not NULL when it should be")); - DEBUG_ASSERTCRASH(TheNAT == NULL, ("TheNAT is not NULL when it should be")); + DEBUG_ASSERTCRASH(m_transport == nullptr, ("m_transport is not null when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not null when it should be")); // fill in GS-specific info for (Int i=0; iattachSlotList(m_slot, getLocalSlotNum(), m_localIP); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 1d33cb947ee..bd0109ce24d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -375,7 +375,7 @@ class W3DModelDraw : public DrawModule, public ObjectDrawInterface virtual Int getPristineBonePositionsForConditionState(const ModelConditionFlags& condition, const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const; virtual Int getCurrentBonePositions(const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const; virtual Bool getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const; - virtual Bool getProjectileLaunchOffset(const ModelConditionFlags& condition, WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = NULL) const; + virtual Bool getProjectileLaunchOffset(const ModelConditionFlags& condition, WeaponSlotType wslot, Int specificBarrelToUse, Matrix3D* launchPos, WhichTurretType tur, Coord3D* turretRotPos, Coord3D* turretPitchPos = nullptr) const; virtual void updateProjectileClipStatus( UnsignedInt shotsRemaining, UnsignedInt maxShots, WeaponSlotType slot ); ///< This will do the show/hide work if ProjectileBoneFeedbackEnabled is set. virtual void updateDrawModuleSupplyStatus( Int maxSupply, Int currentSupply ); ///< This will do visual feedback on Supplies carried virtual void notifyDrawModuleDependencyCleared( ){}///< if you were waiting for something before you drew, it's ready now diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h index e987096c35f..d7080a933e1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h @@ -78,7 +78,7 @@ class W3DAssetManager: public WW3DAssetManager void Report_Used_Font3DDatas( void ); void Report_Used_FontChars (void); - virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=NULL, const char *newTexture=NULL); + virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=nullptr, const char *newTexture=nullptr); ///Swaps the specified textures in the render object prototype. int replacePrototypeTexture(RenderObjClass *robj, const char * oldname, const char * newname); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h index dbe3f4c491e..63643650732 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h @@ -143,9 +143,9 @@ class W3DBufferManager void freeAllBuffers(void); ///m_nextVB; }; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h index 64124a64a15..92e8fb03f2a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h @@ -42,7 +42,7 @@ class W3DShadowManager // shadow list management void Reset( void ); - Shadow* addShadow( RenderObjClass *robj,Shadow::ShadowTypeInfo *shadowInfo=NULL, Drawable *draw=NULL); ///< adds shadow caster to rendering system. + Shadow* addShadow( RenderObjClass *robj,Shadow::ShadowTypeInfo *shadowInfo=nullptr, Drawable *draw=nullptr); ///< adds shadow caster to rendering system. void removeShadow(Shadow *shadow); ///< removed shadow from rendering system and frees its resources. void removeAllShadows(void); ///< Remove all shadows. void setShadowColor(UnsignedInt color) { m_shadowColor=color;} ///removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } if (m_renderObject) { - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } for (int i = 0; i < STATECOUNT; ++i) { REF_PTR_RELEASE(m_anims[i]); - m_anims[i] = NULL; + m_anims[i] = nullptr; } } @@ -103,7 +103,7 @@ void W3DDebrisDraw::setFullyObscuredByShroud(Bool fullyObscured) //------------------------------------------------------------------------------------------------- void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) { - if (m_renderObject == NULL && !name.isEmpty()) + if (m_renderObject == nullptr && !name.isEmpty()) { Int hexColor = 0; if (color != 0) @@ -112,7 +112,7 @@ void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) DEBUG_ASSERTCRASH(m_renderObject, ("Debris model %s not found!",name.str())); if (m_renderObject) { - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object(m_renderObject); m_renderObject->Set_User_Data(getDrawable()->getDrawableInfo()); @@ -138,7 +138,7 @@ void W3DDebrisDraw::setModelName(AsciiString name, Color color, ShadowType t) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } } @@ -156,11 +156,11 @@ void W3DDebrisDraw::setAnimNames(AsciiString initial, AsciiString flying, AsciiS for (i = 0; i < STATECOUNT; ++i) { REF_PTR_RELEASE(m_anims[i]); - m_anims[i] = NULL; + m_anims[i] = nullptr; } - m_anims[INITIAL] = initial.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(initial.str()); - m_anims[FLYING] = flying.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(flying.str()); + m_anims[INITIAL] = initial.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(initial.str()); + m_anims[FLYING] = flying.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(flying.str()); if (stricmp(final.str(), "STOP") == 0) { m_finalStop = true; @@ -170,7 +170,7 @@ void W3DDebrisDraw::setAnimNames(AsciiString initial, AsciiString flying, AsciiS { m_finalStop = false; } - m_anims[FINAL] = final.isEmpty() ? NULL : W3DDisplay::m_assetManager->Get_HAnim(final.str()); + m_anims[FINAL] = final.isEmpty() ? nullptr : W3DDisplay::m_assetManager->Get_HAnim(final.str()); m_state = 0; m_frames = 0; m_fxFinal = finalFX; @@ -237,7 +237,7 @@ void W3DDebrisDraw::doDrawModule(const Matrix3D* transformMtx) Int oldState = m_state; Object* obj = getDrawable()->getObject(); const Int MIN_FINAL_FRAMES = 3; - if (m_state != FINAL && obj != NULL && !obj->isAboveTerrain() && m_frames > MIN_FINAL_FRAMES) + if (m_state != FINAL && obj != nullptr && !obj->isAboveTerrain() && m_frames > MIN_FINAL_FRAMES) { m_state = FINAL; } @@ -246,12 +246,12 @@ void W3DDebrisDraw::doDrawModule(const Matrix3D* transformMtx) ++m_state; } HAnimClass* hanim = m_anims[m_state]; - if (hanim != NULL && (hanim != m_renderObject->Peek_Animation() || oldState != m_state)) + if (hanim != nullptr && (hanim != m_renderObject->Peek_Animation() || oldState != m_state)) { RenderObjClass::AnimMode m = TheAnimModes[m_state]; if (m_state == FINAL) { - FXList::doFXPos(m_fxFinal, getDrawable()->getPosition(), getDrawable()->getTransformMatrix(), 0, NULL, 0.0f); + FXList::doFXPos(m_fxFinal, getDrawable()->getPosition(), getDrawable()->getTransformMatrix(), 0, nullptr, 0.0f); if (m_finalStop) m = RenderObjClass::ANIM_MODE_MANUAL; } @@ -309,7 +309,7 @@ void W3DDebrisDraw::xfer( Xfer *xfer ) // when loading, set the animations if( xfer->getXferMode() == XFER_LOAD ) - setAnimNames( m_animInitial, m_animFlying, m_animFinal, NULL ); + setAnimNames( m_animInitial, m_animFlying, m_animFinal, nullptr ); // state xfer->xferInt( &m_state ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp index 471494eab85..c6b30a4fdf5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp @@ -54,8 +54,8 @@ W3DDefaultDraw::W3DDefaultDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData) { #ifdef LOAD_TEST_ASSETS - m_renderObject = NULL; - m_shadow = NULL; + m_renderObject = nullptr; + m_shadow = nullptr; if (!getDrawable()->getTemplate()->getLTAName().isEmpty()) { m_renderObject = W3DDisplay::m_assetManager->Create_Render_Obj(getDrawable()->getTemplate()->getLTAName().str(), getDrawable()->getScale(), 0); @@ -108,13 +108,13 @@ W3DDefaultDraw::~W3DDefaultDraw(void) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->removeShadow(m_shadow); - m_shadow = NULL; + m_shadow = nullptr; } if (m_renderObject) { W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } #endif } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp index 8582b2e5b1b..3b5a5b5b9b1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp @@ -59,9 +59,9 @@ void W3DDependencyModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "AttachToBoneInContainer", INI::parseAsciiString, NULL, offsetof(W3DDependencyModelDrawModuleData, m_attachToDrawableBoneInContainer) }, + { "AttachToBoneInContainer", INI::parseAsciiString, nullptr, offsetof(W3DDependencyModelDrawModuleData, m_attachToDrawableBoneInContainer) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -98,7 +98,7 @@ void W3DDependencyModelDraw::doDrawModule(const Matrix3D* transformMtx) if ( ! me ) return; - Drawable *theirDrawable = NULL; + Drawable *theirDrawable = nullptr; if( me->getContainedBy() && !me->getContainedBy()->getContain()->isEnclosingContainerFor(me) ) theirDrawable = me->getContainedBy()->getDrawable(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index fccd5c32e02..05c0e467717 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -98,7 +98,7 @@ class LogClass LogClass::LogClass(const char *fname) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -238,7 +238,7 @@ static const char *const ACBitsNames[] = "MAINTAIN_FRAME_ACROSS_STATES3", "MAINTAIN_FRAME_ACROSS_STATES4", - NULL + nullptr }; static_assert(ARRAY_SIZE(ACBitsNames) == AC_BITS_COUNT + 1, "Incorrect array size"); @@ -295,7 +295,7 @@ const UnsignedInt NO_NEXT_DURATION = 0xffffffff; //------------------------------------------------------------------------------------------------- W3DAnimationInfo::W3DAnimationInfo(const AsciiString& name, Bool isIdle, Real distanceCovered) : #ifdef RETAIN_ANIM_HANDLES - m_handle(NULL), + m_handle(nullptr), m_naturalDurationInMsec(0), #else m_naturalDurationInMsec(-1), @@ -346,7 +346,7 @@ W3DAnimationInfo& W3DAnimationInfo::operator=(const W3DAnimationInfo &r) HAnimClass* W3DAnimationInfo::getAnimHandle() const { #ifdef RETAIN_ANIM_HANDLES - if (m_handle == NULL) + if (m_handle == nullptr) { // Get_HAnim addrefs it, so we'll have to release it in our dtor. m_handle = W3DDisplay::m_assetManager->Get_HAnim(m_name.str()); @@ -363,7 +363,7 @@ HAnimClass* W3DAnimationInfo::getAnimHandle() const #else HAnimClass* handle = W3DDisplay::m_assetManager->Get_HAnim(m_name.str()); DEBUG_ASSERTCRASH(handle, ("*** ASSET ERROR: animation %s not found",m_name.str())); - if (handle != NULL && m_naturalDurationInMsec < 0) + if (handle != nullptr && m_naturalDurationInMsec < 0) { m_naturalDurationInMsec = handle->Get_Num_Frames() * 1000.0f / handle->Get_Frame_Rate(); } @@ -379,7 +379,7 @@ W3DAnimationInfo::~W3DAnimationInfo() { #ifdef RETAIN_ANIM_HANDLES REF_PTR_RELEASE(m_handle); - m_handle = NULL; + m_handle = nullptr; #endif } @@ -393,8 +393,8 @@ void ModelConditionInfo::preloadAssets( TimeOfDay timeOfDay, Real scale ) } // this can be called from the client, which is problematic -// validateStuff(NULL, getDrawable()->getScale()); - //validateCachedBones(NULL, scale); +// validateStuff(nullptr, getDrawable()->getScale()); + //validateCachedBones(nullptr, scale); //validateTurretInfo(); //validateWeaponBarrelInfo(); } @@ -476,7 +476,7 @@ static Bool findSingleSubObj(RenderObjClass* robj, const AsciiString& boneName, #if defined(RTS_DEBUG) test->Release_Ref(); test = robj->Get_Sub_Object_On_Bone(0, boneIndex); - DEBUG_ASSERTCRASH(test != NULL && test == childObject, ("*** ASSET ERROR: Hmm, bone problem")); + DEBUG_ASSERTCRASH(test != nullptr && test == childObject, ("*** ASSET ERROR: Hmm, bone problem")); #endif } if (test) test->Release_Ref(); @@ -612,7 +612,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c m_validStuff |= PRISTINE_BONES_VALID; Bool tossRobj = false; - if (robj == NULL) + if (robj == nullptr) { if (m_modelName.isEmpty()) { @@ -631,8 +631,8 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c } Matrix3D originalTransform = robj->Get_Transform(); // save the transform - HLodClass* hlod = NULL; - HAnimClass* curAnim = NULL; + HLodClass* hlod = nullptr; + HAnimClass* curAnim = nullptr; int numFrames = 0; float frame = 0.0f; int mode = 0; @@ -657,14 +657,14 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c if (animToUse) animToUse->Add_Ref(); } - if (animToUse != NULL) + if (animToUse != nullptr) { // make sure we're in frame zero. Int whichFrame = testFlagBit(m_flags, PRISTINE_BONE_POS_IN_FINAL_FRAME) ? animToUse->Get_Num_Frames()-1 : 0; robj->Set_Animation(animToUse, whichFrame, RenderObjClass::ANIM_MODE_MANUAL); // must balance the addref, above REF_PTR_RELEASE(animToUse); - animToUse = NULL; + animToUse = nullptr; } Matrix3D tmp(true); @@ -700,7 +700,7 @@ void ModelConditionInfo::validateCachedBones(RenderObjClass* robj, Real scale) c } robj->Set_Transform(originalTransform); // restore previous transform - if (curAnim != NULL) + if (curAnim != nullptr) { robj->Set_Animation(curAnim, frame, mode); hlod->Set_Animation_Frame_Rate_Multiplier(mult); @@ -789,7 +789,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const { sprintf(buffer, "%s%02d", plbName.str(), i); const Matrix3D* mtx = findPristineBone(NAMEKEY(buffer), &plbBoneIndex); - if (mtx != NULL) + if (mtx != nullptr) info.m_projectileOffsetMtx = *mtx; } @@ -823,8 +823,8 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const info.m_muzzleFlashBoneName = mfName; #endif - const Matrix3D* plbMtx = plbName.isEmpty() ? NULL : findPristineBone(NAMEKEY(plbName), NULL); - if (plbMtx != NULL) + const Matrix3D* plbMtx = plbName.isEmpty() ? nullptr : findPristineBone(NAMEKEY(plbName), nullptr); + if (plbMtx != nullptr) info.m_projectileOffsetMtx = *plbMtx; else info.m_projectileOffsetMtx.Make_Identity(); @@ -832,7 +832,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const if (!fxBoneName.isEmpty()) findPristineBone(NAMEKEY(fxBoneName), &info.m_fxBone); - if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != NULL) + if (info.m_fxBone != 0 || info.m_recoilBone != 0 || info.m_muzzleFlashBone != 0 || plbMtx != nullptr) { CRCDEBUG_LOG(("validateWeaponBarrelInfo() - model name %s (unadorned) wslot %d", m_modelName.str(), wslot)); DUMPMATRIX3D(&(info.m_projectileOffsetMtx)); @@ -876,7 +876,7 @@ void ModelConditionInfo::validateTurretInfo() const if (tur.m_turretAngleNameKey != NAMEKEY_INVALID) { - if (findPristineBone(tur.m_turretAngleNameKey, &tur.m_turretAngleBone) == NULL) + if (findPristineBone(tur.m_turretAngleNameKey, &tur.m_turretAngleBone) == nullptr) { DEBUG_CRASH(("*** ASSET ERROR: TurretBone %s not found! (%s)",KEYNAME(tur.m_turretAngleNameKey).str(),m_modelName.str())); tur.m_turretAngleBone = 0; @@ -889,7 +889,7 @@ void ModelConditionInfo::validateTurretInfo() const if (tur.m_turretPitchNameKey != NAMEKEY_INVALID) { - if (findPristineBone(tur.m_turretPitchNameKey, &tur.m_turretPitchBone) == NULL) + if (findPristineBone(tur.m_turretPitchNameKey, &tur.m_turretPitchBone) == nullptr) { DEBUG_CRASH(("*** ASSET ERROR: TurretBone %s not found! (%s)",KEYNAME(tur.m_turretPitchNameKey).str(),m_modelName.str())); tur.m_turretPitchBone = 0; @@ -916,7 +916,7 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero, some callers rely on this if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } if (boneName == NAMEKEY_INVALID) @@ -924,7 +924,7 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero, some callers rely on this if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } PristineBoneInfoMap::const_iterator it = m_pristineBones.find(boneName); @@ -939,14 +939,14 @@ const Matrix3D* ModelConditionInfo::findPristineBone(NameKeyType boneName, Int* // set it to zero -- some callers rely on this! if (boneIndex) *boneIndex = 0; - return NULL; + return nullptr; } } //------------------------------------------------------------------------------------------------- Bool ModelConditionInfo::findPristineBonePos(NameKeyType boneName, Coord3D& pos) const { - const Matrix3D* mtx = findPristineBone(boneName, NULL); + const Matrix3D* mtx = findPristineBone(boneName, nullptr); if (mtx) { Vector3 v = mtx->Get_Translation(); @@ -970,7 +970,7 @@ void ModelConditionInfo::loadAnimations() const { HAnimClass* h = it2->getAnimHandle(); // just force it to get loaded REF_PTR_RELEASE(h); - h = NULL; + h = nullptr; } #else // srj sez: I think there is no real reason to preload these all anymore. things that need the anims @@ -1080,7 +1080,7 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw if (!c_it->matchesMode(false, false) && !c_it->matchesMode(night, snowy)) continue; - c_it->validateStuff(NULL, draw->getScale(), m_extraPublicBones); + c_it->validateStuff(nullptr, draw->getScale(), m_extraPublicBones); } for (TransitionMap::iterator t_it = m_transitionMap.begin(); t_it != m_transitionMap.end(); ++t_it) @@ -1109,7 +1109,7 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw //it->addPublicBone(m_extraPublicBones); // srj sez: hm, this doesn't make sense; I think we really do need to validate transition states. - t_it->second.validateStuff(NULL, draw->getScale(), m_extraPublicBones); + t_it->second.validateStuff(nullptr, draw->getScale(), m_extraPublicBones); } } } @@ -1150,7 +1150,7 @@ const Vector3* W3DModelDrawModuleData::getAttachToDrawableBoneOffset(const Drawa { if (m_attachToDrawableBone.isEmpty()) { - return NULL; + return nullptr; } else { @@ -1158,7 +1158,7 @@ const Vector3* W3DModelDrawModuleData::getAttachToDrawableBoneOffset(const Drawa { // must use pristine bone here since the result is used by logic Matrix3D boneMtx; - if (draw->getPristineBonePositions(m_attachToDrawableBone.str(), 0, NULL, &boneMtx, 1) == 1) + if (draw->getPristineBonePositions(m_attachToDrawableBone.str(), 0, nullptr, &boneMtx, 1) == 1) { m_attachToDrawableBoneOffset = boneMtx.Get_Translation(); } @@ -1199,25 +1199,25 @@ void W3DModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "InitialRecoilSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_initialRecoil) }, - { "MaxRecoilDistance", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_maxRecoil) }, - { "RecoilDamping", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilDamping) }, - { "RecoilSettleSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilSettle) }, - { "OkToChangeModelColor", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) }, - { "AnimationsRequirePower", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) }, - { "ParticlesAttachedToAnimatedBones", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_particlesAttachedToAnimatedBones) }, - { "MinLODRequired", INI::parseStaticGameLODLevel, NULL, offsetof(W3DModelDrawModuleData, m_minLODRequired) }, + { "InitialRecoilSpeed", INI::parseVelocityReal, nullptr, offsetof(W3DModelDrawModuleData, m_initialRecoil) }, + { "MaxRecoilDistance", INI::parseReal, nullptr, offsetof(W3DModelDrawModuleData, m_maxRecoil) }, + { "RecoilDamping", INI::parseReal, nullptr, offsetof(W3DModelDrawModuleData, m_recoilDamping) }, + { "RecoilSettleSpeed", INI::parseVelocityReal, nullptr, offsetof(W3DModelDrawModuleData, m_recoilSettle) }, + { "OkToChangeModelColor", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) }, + { "AnimationsRequirePower", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) }, + { "ParticlesAttachedToAnimatedBones", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_particlesAttachedToAnimatedBones) }, + { "MinLODRequired", INI::parseStaticGameLODLevel, nullptr, offsetof(W3DModelDrawModuleData, m_minLODRequired) }, { "ProjectileBoneFeedbackEnabledSlots", INI::parseBitString32, TheWeaponSlotTypeNames, offsetof(W3DModelDrawModuleData, m_projectileBoneFeedbackEnabledSlots) }, { "DefaultConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_DEFAULT, 0 }, { "ConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_NORMAL, 0 }, { "AliasConditionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_ALIAS, 0 }, { "TransitionState", W3DModelDrawModuleData::parseConditionState, (void*)PARSE_TRANSITION, 0 }, - { "TrackMarks", parseAsciiStringLC, NULL, offsetof(W3DModelDrawModuleData, m_trackFile) }, - { "ExtraPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(W3DModelDrawModuleData, m_extraPublicBones) }, - { "AttachToBoneInAnotherModule", parseAsciiStringLC, NULL, offsetof(W3DModelDrawModuleData, m_attachToDrawableBone) }, - { "IgnoreConditionStates", ModelConditionFlags::parseFromINI, NULL, offsetof(W3DModelDrawModuleData, m_ignoreConditionStates) }, - { "ReceivesDynamicLights", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_receivesDynamicLights) }, - { 0, 0, 0, 0 } + { "TrackMarks", parseAsciiStringLC, nullptr, offsetof(W3DModelDrawModuleData, m_trackFile) }, + { "ExtraPublicBone", INI::parseAsciiStringVectorAppend, nullptr, offsetof(W3DModelDrawModuleData, m_extraPublicBones) }, + { "AttachToBoneInAnotherModule", parseAsciiStringLC, nullptr, offsetof(W3DModelDrawModuleData, m_attachToDrawableBone) }, + { "IgnoreConditionStates", ModelConditionFlags::parseFromINI, nullptr, offsetof(W3DModelDrawModuleData, m_ignoreConditionStates) }, + { "ReceivesDynamicLights", INI::parseBool, nullptr, offsetof(W3DModelDrawModuleData, m_receivesDynamicLights) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); @@ -1288,7 +1288,7 @@ static void parseShowHideSubObject(INI* ini, void *instance, void *store, const { if (stricmp(it->subObjName.str(), subObjName.str()) == 0) { - it->hide = (userData != NULL); + it->hide = (userData != nullptr); found = true; } } @@ -1297,7 +1297,7 @@ static void parseShowHideSubObject(INI* ini, void *instance, void *store, const { ModelConditionInfo::HideShowSubObjInfo info; info.subObjName = subObjName; - info.hide = (userData != NULL); + info.hide = (userData != nullptr); vec->push_back(info); } subObjName = ini->getNextAsciiString(); @@ -1354,7 +1354,7 @@ static void parseParticleSysBone(INI* ini, void *instance, void * store, const v ParticleSysBoneInfo info; info.boneName = ini->getNextAsciiString(); info.boneName.toLower(); - ini->parseParticleSystemTemplate(ini, instance, &(info.particleSystemTemplate), NULL); + ini->parseParticleSystemTemplate(ini, instance, &(info.particleSystemTemplate), nullptr); ModelConditionInfo *self = (ModelConditionInfo *)instance; self->m_particleSysBones.push_back(info); } @@ -1418,31 +1418,31 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void { static const FieldParse myFieldParse[] = { - { "Model", parseAsciiStringLC, NULL, offsetof(ModelConditionInfo, m_modelName) }, - { "Turret", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretAngleNameKey) }, - { "TurretArtAngle", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtAngle) }, - { "TurretPitch", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretPitchNameKey) }, - { "TurretArtPitch", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtPitch) }, - { "AltTurret", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretAngleNameKey) }, - { "AltTurretArtAngle", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtAngle) }, - { "AltTurretPitch", parseBoneNameKey, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretPitchNameKey) }, - { "AltTurretArtPitch", INI::parseAngleReal, NULL, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtPitch) }, - { "ShowSubObject", parseShowHideSubObject, (void*)0, offsetof(ModelConditionInfo, m_hideShowVec) }, + { "Model", parseAsciiStringLC, nullptr, offsetof(ModelConditionInfo, m_modelName) }, + { "Turret", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretAngleNameKey) }, + { "TurretArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtAngle) }, + { "TurretPitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretPitchNameKey) }, + { "TurretArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtPitch) }, + { "AltTurret", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretAngleNameKey) }, + { "AltTurretArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtAngle) }, + { "AltTurretPitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretPitchNameKey) }, + { "AltTurretArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtPitch) }, + { "ShowSubObject", parseShowHideSubObject, (void*)nullptr, offsetof(ModelConditionInfo, m_hideShowVec) }, { "HideSubObject", parseShowHideSubObject, (void*)1, offsetof(ModelConditionInfo, m_hideShowVec) }, - { "WeaponFireFXBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponFireFXBoneName[0]) }, - { "WeaponRecoilBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponRecoilBoneName[0]) }, - { "WeaponMuzzleFlash", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponMuzzleFlashName[0]) }, - { "WeaponLaunchBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponProjectileLaunchBoneName[0]) }, - { "WeaponHideShowBone", parseWeaponBoneName, NULL, offsetof(ModelConditionInfo, m_weaponProjectileHideShowName[0]) }, + { "WeaponFireFXBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponFireFXBoneName[0]) }, + { "WeaponRecoilBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponRecoilBoneName[0]) }, + { "WeaponMuzzleFlash", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponMuzzleFlashName[0]) }, + { "WeaponLaunchBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponProjectileLaunchBoneName[0]) }, + { "WeaponHideShowBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponProjectileHideShowName[0]) }, { "Animation", parseAnimation, (void*)ANIM_NORMAL, offsetof(ModelConditionInfo, m_animations) }, { "IdleAnimation", parseAnimation, (void*)ANIM_IDLE, offsetof(ModelConditionInfo, m_animations) }, { "AnimationMode", INI::parseIndexList, TheAnimModeNames, offsetof(ModelConditionInfo, m_mode) }, - { "TransitionKey", parseLowercaseNameKey, NULL, offsetof(ModelConditionInfo, m_transitionKey) }, - { "WaitForStateToFinishIfPossible", parseLowercaseNameKey, NULL, offsetof(ModelConditionInfo, m_allowToFinishKey) }, + { "TransitionKey", parseLowercaseNameKey, nullptr, offsetof(ModelConditionInfo, m_transitionKey) }, + { "WaitForStateToFinishIfPossible", parseLowercaseNameKey, nullptr, offsetof(ModelConditionInfo, m_allowToFinishKey) }, { "Flags", INI::parseBitString32, ACBitsNames, offsetof(ModelConditionInfo, m_flags) }, - { "ParticleSysBone", parseParticleSysBone, NULL, 0 }, - { "AnimationSpeedFactorRange", parseRealRange, NULL, 0 }, - { 0, 0, 0, 0 } + { "ParticleSysBone", parseParticleSysBone, nullptr, 0 }, + { "AnimationSpeedFactorRange", parseRealRange, nullptr, 0 }, + { nullptr, nullptr, nullptr, 0 } }; ModelConditionInfo info; @@ -1543,7 +1543,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void prevState.m_description.concat("\nAKA: "); prevState.m_description.concat(description); #else - conditionsYes.parse(ini, NULL); + conditionsYes.parse(ini, nullptr); #endif if (conditionsYes.anyIntersectionWith(self->m_ignoreConditionStates)) @@ -1597,7 +1597,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void info.m_description.concat("\n "); info.m_description.concat(description); #else - conditionsYes.parse(ini, NULL); + conditionsYes.parse(ini, nullptr); #endif if (conditionsYes.anyIntersectionWith(self->m_ignoreConditionStates)) @@ -1726,15 +1726,15 @@ W3DModelDraw::W3DModelDraw(Thing *thing, const ModuleData* moduleData) : DrawMod m_animationMode = RenderObjClass::ANIM_MODE_LOOP; m_hideHeadlights = true; m_pauseAnimation = false; - m_curState = NULL; + m_curState = nullptr; m_hexColor = 0; - m_renderObject = NULL; - m_shadow = NULL; + m_renderObject = nullptr; + m_shadow = nullptr; m_shadowEnabled = TRUE; - m_terrainDecal = NULL; - m_trackRenderObject = NULL; + m_terrainDecal = nullptr; + m_trackRenderObject = nullptr; m_whichAnimInCurState = -1; - m_nextState = NULL; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; for (i = 0; i < WEAPONSLOT_COUNT; ++i) { @@ -1796,10 +1796,10 @@ W3DModelDraw::~W3DModelDraw(void) if (m_trackRenderObject && TheTerrainTracksRenderObjClassSystem) { TheTerrainTracksRenderObjClassSystem->unbindTrack(m_trackRenderObject); - m_trackRenderObject = NULL; + m_trackRenderObject = nullptr; } - nukeCurrentRender(NULL); + nukeCurrentRender(nullptr); } //------------------------------------------------------------------------------------------------- @@ -1811,8 +1811,8 @@ void W3DModelDraw::doStartOrStopParticleSys() //for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); - if (sys != NULL) { - // this can be NULL + if (sys != nullptr) { + // this can be null if (hidden) { sys->stop(); } else { @@ -1849,7 +1849,7 @@ void W3DModelDraw::releaseShadows(void) ///< frees all shadow resources used by { if (m_shadow) m_shadow->release(); - m_shadow = NULL; + m_shadow = nullptr; } /** Create shadow resources if not already present. This is used to dynamically enable/disable shadows by the options screen*/ @@ -1858,7 +1858,7 @@ void W3DModelDraw::allocateShadows(void) const ThingTemplate *tmplate=getDrawable()->getTemplate(); //Check if we don't already have a shadow but need one for this type of model. - if (m_shadow == NULL && m_renderObject && TheW3DShadowManager && tmplate->getShadowType() != SHADOW_NONE) + if (m_shadow == nullptr && m_renderObject && TheW3DShadowManager && tmplate->getShadowType() != SHADOW_NONE) { Shadow::ShadowTypeInfo shadowInfo; strlcpy(shadowInfo.m_ShadowName, tmplate->getShadowTextureName().str(), ARRAY_SIZE(shadowInfo.m_ShadowName)); @@ -1902,7 +1902,7 @@ void W3DModelDraw::getRenderCost(RenderCost & rc) const #if defined(RTS_DEBUG) void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) const { - if (robj == NULL) return; + if (robj == nullptr) return; // recurse through sub-objects for (int i=0; iGet_Num_Sub_Objects(); i++) { @@ -1919,7 +1919,7 @@ void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) if (robj->Class_ID() == RenderObjClass::CLASSID_MESH) { MeshClass * mesh = (MeshClass*)robj; MeshModelClass * model = mesh->Peek_Model(); - if (model != NULL) + if (model != nullptr) { if (model->Get_Flag(MeshGeometryClass::SORT)) rc.addSortedMeshes(1); if (model->Get_Flag(MeshGeometryClass::SKIN)) @@ -1931,7 +1931,7 @@ void W3DModelDraw::getRenderCostRecursive(RenderCost & rc,RenderObjClass * robj) // collect bone stats. const HTreeClass * htree = robj->Get_HTree(); - if (htree != NULL) { + if (htree != nullptr) { rc.addBones(htree->Num_Pivots()); } } @@ -2058,12 +2058,12 @@ void W3DModelDraw::doDrawModule(const Matrix3D* transformMtx) if (isAnimationComplete(m_renderObject)) { - if (m_curState != NULL && m_nextState != NULL) + if (m_curState != nullptr && m_nextState != nullptr) { //DEBUG_LOG(("transition %s is complete",m_curState->m_description.str())); const ModelConditionInfo* nextState = m_nextState; UnsignedInt nextDuration = m_nextStateAnimLoopDuration; - m_nextState = NULL; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; setModelState(nextState); if (nextDuration != NO_NEXT_DURATION) @@ -2074,7 +2074,7 @@ void W3DModelDraw::doDrawModule(const Matrix3D* transformMtx) } if (m_renderObject && - m_curState != NULL && + m_curState != nullptr && m_whichAnimInCurState != -1) { if (m_curState->m_animations[m_whichAnimInCurState].isIdleAnim()) @@ -2123,15 +2123,15 @@ const ModelConditionInfo* W3DModelDraw::findTransitionForSig(TransitionSig sig) { return &(*it).second; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- Real W3DModelDraw::getCurrentAnimFraction() const { - if (m_curState != NULL + if (m_curState != nullptr && isAnyMaintainFrameFlagSet(m_curState->m_flags) - && m_renderObject != NULL + && m_renderObject != nullptr && m_renderObject->Class_ID() == RenderObjClass::CLASSID_HLOD) { float framenum, dummy; @@ -2215,7 +2215,7 @@ void W3DModelDraw::adjustAnimation(const ModelConditionInfo* prevState, Real pre m_renderObject->Set_Animation(animHandle, startFrame, m_curState->m_mode); REF_PTR_RELEASE(animHandle); - animHandle = NULL; + animHandle = nullptr; if (m_renderObject->Class_ID() == RenderObjClass::CLASSID_HLOD) { @@ -2258,7 +2258,7 @@ Bool W3DModelDraw::setCurAnimDurationInMsec(Real desiredDurationInMsec) //------------------------------------------------------------------------------------------------- Real W3DModelDraw::getCurAnimDistanceCovered() const { - if (m_curState != NULL && m_whichAnimInCurState >= 0) + if (m_curState != nullptr && m_whichAnimInCurState >= 0) { const W3DAnimationInfo& animInfo = m_curState->m_animations[m_whichAnimInCurState]; #if defined(RTS_DEBUG) @@ -2354,7 +2354,7 @@ void W3DModelDraw::doHideShowSubObjs(const std::vectorGet_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != nullptr) { subObj->Set_Hidden(it->hide); @@ -2391,9 +2391,9 @@ void W3DModelDraw::stopClientParticleSystems() //for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); - if (sys != NULL) + if (sys != nullptr) { - // this can be NULL + // this can be null sys->destroy(); } } @@ -2594,15 +2594,15 @@ void W3DModelDraw::recalcBonesForClientParticleSystems() if (m_needRecalcBoneParticleSystems) { const Drawable* drawable = getDrawable(); - if (drawable != NULL ) + if (drawable != nullptr ) { - if( m_curState != NULL && drawable->testDrawableStatus( DRAWABLE_STATUS_NO_STATE_PARTICLES ) == FALSE ) + if( m_curState != nullptr && drawable->testDrawableStatus( DRAWABLE_STATUS_NO_STATE_PARTICLES ) == FALSE ) { for (std::vector::const_iterator it = m_curState->m_particleSysBones.begin(); it != m_curState->m_particleSysBones.end(); ++it) { ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(it->particleSystemTemplate); - if (sys != NULL) + if (sys != nullptr) { Coord3D pos; pos.zero(); @@ -2680,7 +2680,7 @@ void W3DModelDraw::recalcBonesForClientParticleSystems() Bool W3DModelDraw::updateBonesForClientParticleSystems() { const Drawable* drawable = getDrawable(); - if (drawable != NULL && m_curState != NULL && m_renderObject != NULL ) + if (drawable != nullptr && m_curState != nullptr && m_renderObject != nullptr ) { // Matrix3D originalTransform = m_renderObject->Get_Transform(); @@ -2696,7 +2696,7 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() { ParticleSystem *sys = TheParticleSystemManager->findParticleSystem((*it).id); Int boneIndex = (*it).boneIndex; - if ( (sys != NULL) && (boneIndex != 0) ) + if ( (sys != nullptr) && (boneIndex != 0) ) { const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);// just a little worried about state changes @@ -2736,7 +2736,7 @@ void W3DModelDraw::setTerrainDecal(TerrainDecalType type) if (m_terrainDecal) m_terrainDecal->release(); - m_terrainDecal = NULL; + m_terrainDecal = nullptr; if (type == TERRAIN_DECAL_NONE || type >= TERRAIN_DECAL_MAX) //turning off decals on this object. (or bad value.) @@ -2795,11 +2795,11 @@ void W3DModelDraw::nukeCurrentRender(Matrix3D* xform) // changing geometry, so we need to remove shadow if present if (m_shadow) m_shadow->release(); - m_shadow = NULL; + m_shadow = nullptr; if(m_terrainDecal) m_terrainDecal->release(); - m_terrainDecal = NULL; + m_terrainDecal = nullptr; // remove existing render object from the scene if (m_renderObject) @@ -2807,10 +2807,10 @@ void W3DModelDraw::nukeCurrentRender(Matrix3D* xform) // save the transform for the new model if (xform) *xform = m_renderObject->Get_Transform(); - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Remove_Render_Object(m_renderObject); REF_PTR_RELEASE(m_renderObject); - m_renderObject = NULL; + m_renderObject = nullptr; } else { @@ -2831,7 +2831,7 @@ void W3DModelDraw::hideGarrisonFlags(Bool hide) Int objIndex; RenderObjClass* subObj; - if ((subObj = m_renderObject->Get_Sub_Object_By_Name("POLE", &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name("POLE", &objIndex)) != nullptr) { subObj->Set_Hidden(hide); @@ -2922,8 +2922,8 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) DEBUG_LOG(("REQUEST switching to state %s for obj %s %d",newState->m_description.str(),getDrawable()->getObject()->getTemplate()->getName().str(),getDrawable()->getObject()->getID())); } #endif - const ModelConditionInfo* nextState = NULL; - if (m_curState != NULL && newState != NULL) + const ModelConditionInfo* nextState = nullptr; + if (m_curState != nullptr && newState != nullptr) { // if the requested state is the current state (and nothing is pending), // or if the requested state is pending, just punt. @@ -2944,8 +2944,8 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // -- curState is a real state, nextState is a real state without a wait-to-finish clause // -- should be impossible! - if ((m_curState == newState && m_nextState == NULL) || - (m_curState != NULL && m_nextState == newState)) + if ((m_curState == newState && m_nextState == nullptr) || + (m_curState != nullptr && m_nextState == newState)) { #ifdef DEBUG_OBJECT_ID_EXISTS if (getDrawable() && getDrawable()->getObject() && getDrawable()->getObject()->getID() == TheObjectIDToDebug) @@ -2981,7 +2981,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) { TransitionSig sig = buildTransitionSig(m_curState->m_transitionKey, newState->m_transitionKey); const ModelConditionInfo* transState = findTransitionForSig(sig); - if (transState != NULL) + if (transState != nullptr) { #ifdef DEBUG_OBJECT_ID_EXISTS if (getDrawable() && getDrawable()->getObject() && getDrawable()->getObject()->getID() == TheObjectIDToDebug) @@ -3015,7 +3015,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // note that different states might use the same model; for these, don't go thru the // expense of creating a new render-object. (exception: if color is changing, or subobjs are changing, // or a few other things...) - if (m_curState == NULL || + if (m_curState == nullptr || newState->m_modelName != m_curState->m_modelName || turretNamesDiffer(newState, m_curState) // srj sez: I'm not sure why we want to do the "hard stuff" if we have projectile bones; I think @@ -3031,7 +3031,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) // create a new render object and set into drawable if (newState->m_modelName.isEmpty()) { - m_renderObject = NULL; + m_renderObject = nullptr; } else { @@ -3059,7 +3059,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) if (m_renderObject && TheGlobalData->m_makeTrackMarks && !m_trackRenderObject && - TheTerrainTracksRenderObjClassSystem != NULL && + TheTerrainTracksRenderObjClassSystem != nullptr && !getW3DModelDrawModuleData()->m_trackFile.isEmpty()) { m_trackRenderObject = TheTerrainTracksRenderObjClassSystem->bindTrack(m_renderObject, 1.0f*MAP_XY_FACTOR, getW3DModelDrawModuleData()->m_trackFile.str()); @@ -3081,7 +3081,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) shadowInfo.m_offsetX = tmplate->getShadowOffsetX(); shadowInfo.m_offsetY = tmplate->getShadowOffsetY(); - DEBUG_ASSERTCRASH(m_shadow == NULL, ("m_shadow is not NULL")); + DEBUG_ASSERTCRASH(m_shadow == nullptr, ("m_shadow is not null")); m_shadow = TheW3DShadowManager->addShadow(m_renderObject, &shadowInfo, draw); if (m_shadow) { m_shadow->enableShadowInvisible(m_fullyObscuredByShroud); @@ -3137,7 +3137,7 @@ void W3DModelDraw::setModelState(const ModelConditionInfo* newState) } // add render object to our scene - if (W3DDisplay::m_3DScene != NULL) + if (W3DDisplay::m_3DScene != nullptr) W3DDisplay::m_3DScene->Add_Render_Object(m_renderObject); // tie in our drawable as the user data pointer in the render object @@ -3226,10 +3226,10 @@ void W3DModelDraw::replaceIndicatorColor(Color color) { m_hexColor = newColor; - // set these to NULL to force a regen of everything in setModelState. + // set these to nullptr to force a regen of everything in setModelState. const ModelConditionInfo* tmp = m_curState; - m_curState = NULL; - m_nextState = NULL; + m_curState = nullptr; + m_nextState = nullptr; m_nextStateAnimLoopDuration = NO_NEXT_DURATION; setModelState(tmp); } @@ -3301,7 +3301,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( //DUMPREAL(getDrawable()->getScale()); //BONEPOS_LOG(("validateStuffs() from within W3DModelDraw::getProjectileLaunchOffset()")); //BONEPOS_DUMPREAL(getDrawable()->getScale()); - stateToUse->validateStuff(NULL, getDrawable()->getScale(), d->m_extraPublicBones); + stateToUse->validateStuff(nullptr, getDrawable()->getScale(), d->m_extraPublicBones); DEBUG_ASSERTCRASH(stateToUse->m_transitionSig == NO_TRANSITION, ("It is never legal to getProjectileLaunchOffset from a Transition state (they vary on a per-client basis)... however, we can fix this (see srj)\n")); @@ -3315,7 +3315,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( // must use pristine bone here since the result is used by logic Matrix3D pivot; if (d->m_attachToDrawableBone.isNotEmpty() && - getDrawable()->getPristineBonePositions( d->m_attachToDrawableBone.str(), 0, NULL, &pivot, 1 ) == 1) + getDrawable()->getPristineBonePositions( d->m_attachToDrawableBone.str(), 0, nullptr, &pivot, 1 ) == 1) { pivot.Pre_Rotate_Z(getDrawable()->getOrientation()); techOffset.x = pivot.Get_X_Translation(); @@ -3331,7 +3331,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( // Can't find the launch pos, but they might still want the other info they asked for CRCDEBUG_LOG(("empty wbvec")); //BONEPOS_LOG(("empty wbvec")); - launchPos = NULL; + launchPos = nullptr; } else { @@ -3401,7 +3401,7 @@ Bool W3DModelDraw::getProjectileLaunchOffset( #endif } } - return launchPos != NULL;// return if LaunchPos is valid or not + return launchPos != nullptr;// return if LaunchPos is valid or not } //------------------------------------------------------------------------------------------------- @@ -3428,7 +3428,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( // { // CRCDEBUG_LOG(("W3DModelDraw::getPristineBonePositionsForConditionState() - state = '%s'", // stateToUse->getDescription().str())); -// //CRCDEBUG_LOG(("renderObject == NULL: %d", (stateToUse==m_curState)?(m_renderObject == NULL):1)); +// //CRCDEBUG_LOG(("renderObject == nullptr: %d", (stateToUse==m_curState)?(m_renderObject == nullptr):1)); // } //BONEPOS_LOG(("validateStuff() from within W3DModelDraw::getPristineBonePositionsForConditionState()")); @@ -3437,7 +3437,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( stateToUse->validateStuff( // if the state is the current state, pass in the current render object // so that we don't have to re-create it! - stateToUse == m_curState ? m_renderObject : NULL, + stateToUse == m_curState ? m_renderObject : nullptr, getDrawable()->getScale(), getW3DModelDrawModuleData()->m_extraPublicBones); @@ -3447,7 +3447,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( if (maxBones > MAX_BONE_GET) maxBones = MAX_BONE_GET; - if (transforms == NULL) + if (transforms == nullptr) transforms = tmpMtx; Int posCount = 0; @@ -3467,7 +3467,7 @@ Int W3DModelDraw::getPristineBonePositionsForConditionState( *c = tolower(*c); } - const Matrix3D* mtx = stateToUse->findPristineBone(NAMEKEY(buffer), NULL); + const Matrix3D* mtx = stateToUse->findPristineBone(NAMEKEY(buffer), nullptr); if (mtx) { transforms[posCount] = *mtx; @@ -3586,7 +3586,7 @@ Int W3DModelDraw::getCurrentBonePositions( if (maxBones > MAX_BONE_GET) maxBones = MAX_BONE_GET; - if (transforms == NULL) + if (transforms == nullptr) transforms = tmpMtx; if( !m_renderObject ) @@ -3728,7 +3728,7 @@ Bool W3DModelDraw::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelTo if (info.m_fxBone && m_renderObject) { const Object *logicObject = getDrawable()->getObject();// This is slow, so store it - if( ! m_renderObject->Is_Hidden() || (logicObject == NULL) ) + if( ! m_renderObject->Is_Hidden() || (logicObject == nullptr) ) { // I can ask the drawable's bone position if I am not hidden (if I have no object I have no choice) Matrix3D mtx = m_renderObject->Get_Bone_Transform(info.m_fxBone); @@ -3780,8 +3780,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) { // this is never defined -- srj #ifdef NO_DURATIONS_ON_TRANSITIONS - if (m_curState != NULL && m_curState->m_transition != NO_TRANSITION && - m_nextState != NULL && m_nextState->m_transition == NO_TRANSITION) + if (m_curState != nullptr && m_curState->m_transition != NO_TRANSITION && + m_nextState != nullptr && m_nextState->m_transition == NO_TRANSITION) { DEBUG_LOG(("deferring pending duration of %d frames",numFrames)); m_nextStateAnimLoopDuration = numFrames; @@ -3789,7 +3789,7 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) } m_nextStateAnimLoopDuration = NO_NEXT_DURATION; - DEBUG_ASSERTCRASH(m_curState != NULL && m_curState->m_transition == NO_TRANSITION, ("Hmm, setAnimationLoopDuration on a transition state is probably not right... see srj")); + DEBUG_ASSERTCRASH(m_curState != nullptr && m_curState->m_transition == NO_TRANSITION, ("Hmm, setAnimationLoopDuration on a transition state is probably not right... see srj")); #else m_nextStateAnimLoopDuration = NO_NEXT_DURATION; #endif @@ -3805,8 +3805,8 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { - if (m_curState != NULL && m_curState->m_transitionSig != NO_TRANSITION && !m_curState->m_animations.empty() && - m_nextState != NULL && m_nextState->m_transitionSig == NO_TRANSITION && !m_nextState->m_animations.empty()) + if (m_curState != nullptr && m_curState->m_transitionSig != NO_TRANSITION && m_curState->m_animations.size() > 0 && + m_nextState != nullptr && m_nextState->m_transitionSig == NO_TRANSITION && m_nextState->m_animations.size() > 0) { // we have a transition; split up the time suitably. // note that this is just a guess, and assumes that the states @@ -3882,7 +3882,7 @@ void W3DModelDraw::rebuildWeaponRecoilInfo(const ModelConditionInfo* state) { Int wslot; - if (state == NULL) + if (state == nullptr) { for (wslot = 0; wslot < WEAPONSLOT_COUNT; ++wslot) { @@ -3994,7 +3994,7 @@ void W3DModelDraw::updateSubObjects() Int objIndex; RenderObjClass* subObj; - if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != NULL) + if ((subObj = m_renderObject->Get_Sub_Object_By_Name(it->subObjName.str(), &objIndex)) != nullptr) { subObj->Set_Hidden(it->hide); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp index fb3d7795d56..47d73176ddb 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp @@ -35,6 +35,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// + #include "Common/Xfer.h" #include "GameClient/Drawable.h" #include "GameLogic/Object.h" @@ -61,7 +62,7 @@ void W3DOverlordAircraftDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index 0a4c356cc0a..994370e5c0d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -29,6 +29,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// + #include "Common/Xfer.h" #include "GameClient/Drawable.h" #include "GameLogic/Object.h" @@ -52,7 +53,7 @@ void W3DOverlordTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp index e748a8e167c..2d8cac63d1a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp @@ -29,6 +29,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// + #include "Common/Xfer.h" #include "GameClient/Drawable.h" #include "GameLogic/Object.h" @@ -52,7 +53,7 @@ void W3DOverlordTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp index 5dd2dcf89e8..c80cb4aa7d4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp @@ -29,6 +29,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include + #include "Common/STLTypedefs.h" #include "Common/Thing.h" #include "Common/Xfer.h" @@ -46,7 +47,7 @@ //------------------------------------------------------------------------------------------------- W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) { - W3DDynamicLight *light = NULL; + W3DDynamicLight *light = nullptr; // get me a dynamic light from the scene light = W3DDisplay::m_3DScene->getADynamicLight(); @@ -74,7 +75,7 @@ W3DDynamicLight *W3DPoliceCarDraw::createDynamicLight( void ) //------------------------------------------------------------------------------------------------- W3DPoliceCarDraw::W3DPoliceCarDraw( Thing *thing, const ModuleData* moduleData ) : W3DTruckDraw( thing, moduleData ) { - m_light = NULL; + m_light = nullptr; m_curFrame = GameClientRandomValueReal(0, 10 ); } @@ -91,7 +92,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void ) m_light->setFrameFade(0, 5); m_light->setDecayRange(); m_light->setDecayColor(); - m_light = NULL; + m_light = nullptr; } } @@ -105,7 +106,7 @@ void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx) // get pointers to our render objects that we'll need RenderObjClass* policeCarRenderObj = getRenderObject(); - if( policeCarRenderObj == NULL ) + if( policeCarRenderObj == nullptr ) return; HAnimClass *anim = policeCarRenderObj->Peek_Animation(); @@ -139,7 +140,7 @@ void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx) } // make us a light if we don't already have one - if( m_light == NULL ) + if( m_light == nullptr ) m_light = createDynamicLight(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp index 6aa69be1c09..67394ae6e81 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DProjectileStreamDraw.cpp @@ -59,12 +59,12 @@ void W3DProjectileStreamDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Texture", INI::parseAsciiString, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_textureName) }, - { "Width", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_width) }, - { "TileFactor", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_tileFactor) }, - { "ScrollRate", INI::parseReal, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_scrollRate) }, - { "MaxSegments", INI::parseInt, NULL, offsetof(W3DProjectileStreamDrawModuleData, m_maxSegments) }, - { 0, 0, 0, 0 } + { "Texture", INI::parseAsciiString, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_textureName) }, + { "Width", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_width) }, + { "TileFactor", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_tileFactor) }, + { "ScrollRate", INI::parseReal, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_scrollRate) }, + { "MaxSegments", INI::parseInt, nullptr, offsetof(W3DProjectileStreamDrawModuleData, m_maxSegments) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -93,7 +93,7 @@ W3DProjectileStreamDraw::W3DProjectileStreamDraw( Thing *thing, const ModuleData const W3DProjectileStreamDrawModuleData* d = getW3DProjectileStreamDrawModuleData(); m_texture = WW3DAssetManager::Get_Instance()->Get_Texture( d->m_textureName.str() ); for( Int index = 0; index < MAX_PROJECTILE_STREAM; index++ ) - m_allLines[index] = NULL; + m_allLines[index] = nullptr; m_linesValid = 0; } @@ -126,7 +126,7 @@ void W3DProjectileStreamDraw::doDrawModule(const Matrix3D* ) { // get object from logic Object *me = getDrawable()->getObject(); - if (me == NULL) + if (me == nullptr) return; static NameKeyType key_ProjectileStreamUpdate = NAMEKEY("ProjectileStreamUpdate"); @@ -186,7 +186,7 @@ void W3DProjectileStreamDraw::doDrawModule(const Matrix3D* ) W3DDisplay::m_3DScene->Remove_Render_Object( deadLine ); REF_PTR_RELEASE( deadLine ); - m_allLines[lineIndex] = NULL; + m_allLines[lineIndex] = nullptr; m_linesValid--; } } @@ -195,7 +195,7 @@ void W3DProjectileStreamDraw::makeOrUpdateLine( Vector3 *points, UnsignedInt poi { Bool newLine = FALSE; - if( m_allLines[lineIndex] == NULL ) + if( m_allLines[lineIndex] == nullptr ) { //Need a new one if this is blank, otherwise I'll reset the existing one m_allLines[lineIndex] = NEW SegmentedLineClass; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp index d94d3ced65f..61afe059376 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DScienceModelDraw.cpp @@ -53,9 +53,9 @@ void W3DScienceModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "RequiredScience", INI::parseScience, NULL, offsetof(W3DScienceModelDrawModuleData, m_requiredScience) }, + { "RequiredScience", INI::parseScience, nullptr, offsetof(W3DScienceModelDrawModuleData, m_requiredScience) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp index bde8a4caddc..105de57b6f2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DSupplyDraw.cpp @@ -48,9 +48,9 @@ void W3DSupplyDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "SupplyBonePrefix", INI::parseAsciiString, NULL, offsetof(W3DSupplyDrawModuleData, m_supplyBonePrefix) }, + { "SupplyBonePrefix", INI::parseAsciiString, nullptr, offsetof(W3DSupplyDrawModuleData, m_supplyBonePrefix) }, - { 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -75,7 +75,7 @@ void W3DSupplyDraw::updateDrawModuleSupplyStatus( Int maxSupply, Int currentSupp AsciiString boneName = getW3DSupplyDrawModuleData()->m_supplyBonePrefix; if( m_totalBones == -1 ) { - m_totalBones = getDrawable()->getPristineBonePositions( boneName.str(), 1, NULL, NULL, INT_MAX );// The last arg is to guard the size of the arrays. I am not passing any in, I am just counting bones. + m_totalBones = getDrawable()->getPristineBonePositions( boneName.str(), 1, nullptr, nullptr, INT_MAX );// The last arg is to guard the size of the arrays. I am not passing any in, I am just counting bones. m_lastNumberShown = m_totalBones; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp index 56af0e77ca1..1d5387e7bfe 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp @@ -30,6 +30,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include #include + #include "Common/Thing.h" #include "Common/ThingFactory.h" #include "Common/GameAudio.h" @@ -72,12 +73,12 @@ void W3DTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "TreadDebrisLeft", INI::parseAsciiString, NULL, offsetof(W3DTankDrawModuleData, m_treadDebrisNameLeft) }, - { "TreadDebrisRight", INI::parseAsciiString, NULL, offsetof(W3DTankDrawModuleData, m_treadDebrisNameRight) }, - { "TreadAnimationRate", INI::parseVelocityReal, NULL, offsetof(W3DTankDrawModuleData, m_treadAnimationRate) }, - { "TreadPivotSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankDrawModuleData, m_treadPivotSpeedFraction) }, - { "TreadDriveSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankDrawModuleData, m_treadDriveSpeedFraction) }, - { 0, 0, 0, 0 } + { "TreadDebrisLeft", INI::parseAsciiString, nullptr, offsetof(W3DTankDrawModuleData, m_treadDebrisNameLeft) }, + { "TreadDebrisRight", INI::parseAsciiString, nullptr, offsetof(W3DTankDrawModuleData, m_treadDebrisNameRight) }, + { "TreadAnimationRate", INI::parseVelocityReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadAnimationRate) }, + { "TreadPivotSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadPivotSpeedFraction) }, + { "TreadDriveSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankDrawModuleData, m_treadDriveSpeedFraction) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -85,13 +86,13 @@ void W3DTankDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTankDraw::W3DTankDraw( Thing *thing, const ModuleData* moduleData ) -: W3DModelDraw( thing, moduleData ),m_prevRenderObj(NULL), m_treadDebrisLeft(NULL), m_treadDebrisRight(NULL) +: W3DModelDraw( thing, moduleData ),m_prevRenderObj(nullptr), m_treadDebrisLeft(nullptr), m_treadDebrisRight(nullptr) { - m_treadDebrisLeft = NULL; - m_treadDebrisRight = NULL; + m_treadDebrisLeft = nullptr; + m_treadDebrisRight = nullptr; for (Int i=0; iattachToObject(NULL); + m_treadDebrisLeft->attachToObject(nullptr); m_treadDebrisLeft->destroy(); - m_treadDebrisLeft = NULL; + m_treadDebrisLeft = nullptr; } if (m_treadDebrisRight) { - m_treadDebrisRight->attachToObject(NULL); + m_treadDebrisRight->attachToObject(nullptr); m_treadDebrisRight->destroy(); - m_treadDebrisRight = NULL; + m_treadDebrisRight = nullptr; } } @@ -261,7 +262,7 @@ void W3DTankDraw::updateTreadObjects(void) const char *meshName; //Check if subobject name starts with "TREADS". if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH && subObj->Get_Name() - && ( (meshName=strchr(subObj->Get_Name(),'.') ) != 0 && *(meshName++)) + && ( (meshName=strchr(subObj->Get_Name(),'.') ) != nullptr && *(meshName++)) &&_strnicmp(meshName,"TREADS", 6) == 0) { //check if sub-object has the correct material to do texture scrolling. MaterialInfoClass *mat=subObj->Get_Material_Info(); @@ -319,19 +320,19 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx) const Real DEBRIS_THRESHOLD = 0.00001f; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { updateTreadObjects(); } // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp index 83945bf5f38..4a17f4083c9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp @@ -70,25 +70,25 @@ void W3DTankTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Dust", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_dustEffectName) }, - { "DirtSpray", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_dirtEffectName) }, - { "PowerslideSpray", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideEffectName) }, - { "LeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_frontLeftTireBoneName) }, - { "RightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_frontRightTireBoneName) }, - { "LeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_rearLeftTireBoneName) }, - { "RightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_rearRightTireBoneName) }, - { "MidLeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midFrontLeftTireBoneName) }, - { "MidRightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midFrontRightTireBoneName) }, - { "MidLeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearLeftTireBoneName) }, - { "MidRightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearRightTireBoneName) }, - { "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_rotationSpeedMultiplier) }, - { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) }, - { "TreadDebrisLeft", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameLeft) }, - { "TreadDebrisRight", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameRight) }, - { "TreadAnimationRate", INI::parseVelocityReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadAnimationRate) }, - { "TreadPivotSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadPivotSpeedFraction) }, - { "TreadDriveSpeedFraction", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDriveSpeedFraction) }, - { 0, 0, 0, 0 } + { "Dust", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_dustEffectName) }, + { "DirtSpray", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_dirtEffectName) }, + { "PowerslideSpray", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_powerslideEffectName) }, + { "LeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_frontLeftTireBoneName) }, + { "RightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_frontRightTireBoneName) }, + { "LeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rearLeftTireBoneName) }, + { "RightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rearRightTireBoneName) }, + { "MidLeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midFrontLeftTireBoneName) }, + { "MidRightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midFrontRightTireBoneName) }, + { "MidLeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midRearLeftTireBoneName) }, + { "MidRightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_midRearRightTireBoneName) }, + { "TireRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_rotationSpeedMultiplier) }, + { "PowerslideRotationAddition", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) }, + { "TreadDebrisLeft", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameLeft) }, + { "TreadDebrisRight", INI::parseAsciiString, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameRight) }, + { "TreadAnimationRate", INI::parseVelocityReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadAnimationRate) }, + { "TreadPivotSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadPivotSpeedFraction) }, + { "TreadDriveSpeedFraction", INI::parseReal, nullptr, offsetof(W3DTankTruckDrawModuleData, m_treadDriveSpeedFraction) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -96,21 +96,21 @@ void W3DTankTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTankTruckDraw::W3DTankTruckDraw( Thing *thing, const ModuleData* moduleData ) : W3DModelDraw( thing, moduleData ), -m_dirtEffect(NULL), m_dustEffect(NULL), m_powerslideEffect(NULL), m_effectsInitialized(false), +m_dirtEffect(nullptr), m_dustEffect(nullptr), m_powerslideEffect(nullptr), m_effectsInitialized(false), m_wasAirborne(false), m_isPowersliding(false), m_frontWheelRotation(0), m_rearWheelRotation(0), m_frontRightTireBone(0), m_frontLeftTireBone(0), m_rearLeftTireBone(0),m_rearRightTireBone(0), -m_prevRenderObj(NULL) +m_prevRenderObj(nullptr) { //Truck Data m_landingSound = *(thing->getTemplate()->getPerUnitSound("TruckLandingSound")); m_powerslideSound = *(thing->getTemplate()->getPerUnitSound("TruckPowerslideSound")); //Tank data - m_treadDebrisLeft = NULL; - m_treadDebrisRight = NULL; + m_treadDebrisLeft = nullptr; + m_treadDebrisRight = nullptr; for (Int i=0; iattachToObject(NULL); + m_dustEffect->attachToObject(nullptr); m_dustEffect->destroy(); - m_dustEffect = NULL; + m_dustEffect = nullptr; } if (m_dirtEffect) { - m_dirtEffect->attachToObject(NULL); + m_dirtEffect->attachToObject(nullptr); m_dirtEffect->destroy(); - m_dirtEffect = NULL; + m_dirtEffect = nullptr; } if (m_powerslideEffect) { - m_powerslideEffect->attachToObject(NULL); + m_powerslideEffect->attachToObject(nullptr); m_powerslideEffect->destroy(); - m_powerslideEffect = NULL; + m_powerslideEffect = nullptr; } } @@ -446,7 +446,7 @@ void W3DTankTruckDraw::updateTreadObjects(void) const char *meshName; //Check if subobject name starts with "TREADS". if (subObj && subObj->Class_ID() == RenderObjClass::CLASSID_MESH && subObj->Get_Name() - && ( (meshName=strchr(subObj->Get_Name(),'.') ) != 0 && *(meshName++)) + && ( (meshName=strchr(subObj->Get_Name(),'.') ) != nullptr && *(meshName++)) &&_strnicmp(meshName,"TREADS", 6) == 0) { //check if sub-object has the correct material to do texture scrolling. MaterialInfoClass *mat=subObj->Get_Material_Info(); @@ -491,7 +491,7 @@ void W3DTankTruckDraw::onRenderObjRecreated(void) //DEBUG_LOG(("Old obj %x, newObj %x, new bones %d, old bones %d", // m_prevRenderObj, getRenderObject(), getRenderObject()->Get_Num_Bones(), // m_prevNumBones)); - m_prevRenderObj = NULL; + m_prevRenderObj = nullptr; m_frontLeftTireBone = 0; m_frontRightTireBone = 0; m_rearLeftTireBone = 0; @@ -524,17 +524,17 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Real SIZE_CAP = 2.0f; // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { updateBones(); updateTreadObjects(); } // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp index 8398f8c0ece..15554b3a5b3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp @@ -59,7 +59,7 @@ W3DTracerDraw::W3DTracerDraw( Thing *thing, const ModuleData* moduleData ) : Dra m_color.green = 0.8f; m_color.blue = 0.7f; m_speedInDistPerFrame = 1.0f; - m_theTracer = NULL; + m_theTracer = nullptr; } @@ -111,7 +111,7 @@ void W3DTracerDraw::doDrawModule(const Matrix3D* transformMtx) { // create tracer - if( m_theTracer == NULL ) + if( m_theTracer == nullptr ) { Vector3 start( 0.0f, 0.0f, 0.0f ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index 49625d66289..74821c5167e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -67,30 +67,30 @@ void W3DTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "Dust", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_dustEffectName) }, - { "DirtSpray", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_dirtEffectName) }, - { "PowerslideSpray", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideEffectName) }, - - { "LeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_frontLeftTireBoneName) }, - { "RightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_frontRightTireBoneName) }, - { "LeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_rearLeftTireBoneName) }, - { "RightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_rearRightTireBoneName) }, - { "MidLeftFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midFrontLeftTireBoneName) }, - { "MidRightFrontTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midFrontRightTireBoneName) }, - { "MidLeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midRearLeftTireBoneName) }, - { "MidRightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midRearRightTireBoneName) }, - { "MidLeftMidTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midMidLeftTireBoneName) }, - { "MidRightMidTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midMidRightTireBoneName) }, - - { "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_rotationSpeedMultiplier) }, - { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) }, - { "CabBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_cabBoneName) }, - { "TrailerBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_trailerBoneName) }, - { "CabRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_cabRotationFactor) }, - { "TrailerRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_trailerRotationFactor) }, - { "RotationDamping", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_rotationDampingFactor) }, - - { 0, 0, 0, 0 } + { "Dust", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_dustEffectName) }, + { "DirtSpray", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_dirtEffectName) }, + { "PowerslideSpray", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_powerslideEffectName) }, + + { "LeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_frontLeftTireBoneName) }, + { "RightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_frontRightTireBoneName) }, + { "LeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_rearLeftTireBoneName) }, + { "RightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_rearRightTireBoneName) }, + { "MidLeftFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midFrontLeftTireBoneName) }, + { "MidRightFrontTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midFrontRightTireBoneName) }, + { "MidLeftRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midRearLeftTireBoneName) }, + { "MidRightRearTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midRearRightTireBoneName) }, + { "MidLeftMidTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midMidLeftTireBoneName) }, + { "MidRightMidTireBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_midMidRightTireBoneName) }, + + { "TireRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_rotationSpeedMultiplier) }, + { "PowerslideRotationAddition", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) }, + { "CabBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_cabBoneName) }, + { "TrailerBone", INI::parseAsciiString, nullptr, offsetof(W3DTruckDrawModuleData, m_trailerBoneName) }, + { "CabRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_cabRotationFactor) }, + { "TrailerRotationMultiplier", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_trailerRotationFactor) }, + { "RotationDamping", INI::parseReal, nullptr, offsetof(W3DTruckDrawModuleData, m_rotationDampingFactor) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -98,12 +98,12 @@ void W3DTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p) //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- W3DTruckDraw::W3DTruckDraw( Thing *thing, const ModuleData* moduleData ) : W3DModelDraw( thing, moduleData ), -m_dirtEffect(NULL), m_dustEffect(NULL), m_powerslideEffect(NULL), m_effectsInitialized(false), +m_dirtEffect(nullptr), m_dustEffect(nullptr), m_powerslideEffect(nullptr), m_effectsInitialized(false), m_wasAirborne(false), m_isPowersliding(false), m_frontWheelRotation(0), m_rearWheelRotation(0), m_midFrontWheelRotation(0), m_midRearWheelRotation(0), m_frontRightTireBone(0), m_frontLeftTireBone(0), m_rearLeftTireBone(0),m_rearRightTireBone(0), m_midFrontRightTireBone(0), m_midFrontLeftTireBone(0), m_midRearLeftTireBone(0),m_midRearRightTireBone(0), -m_midMidRightTireBone(0), m_midMidLeftTireBone(0), m_prevRenderObj(NULL) +m_midMidRightTireBone(0), m_midMidLeftTireBone(0), m_prevRenderObj(nullptr) { const AudioEventRTS * event; event = thing->getTemplate()->getPerUnitSound("TruckLandingSound"); @@ -129,21 +129,21 @@ void W3DTruckDraw::tossEmitters() { if (m_dustEffect) { - m_dustEffect->attachToObject(NULL); + m_dustEffect->attachToObject(nullptr); m_dustEffect->destroy(); - m_dustEffect = NULL; + m_dustEffect = nullptr; } if (m_dirtEffect) { - m_dirtEffect->attachToObject(NULL); + m_dirtEffect->attachToObject(nullptr); m_dirtEffect->destroy(); - m_dirtEffect = NULL; + m_dirtEffect = nullptr; } if (m_powerslideEffect) { - m_powerslideEffect->attachToObject(NULL); + m_powerslideEffect->attachToObject(nullptr); m_powerslideEffect->destroy(); - m_powerslideEffect = NULL; + m_powerslideEffect = nullptr; } } @@ -364,7 +364,7 @@ void W3DTruckDraw::onRenderObjRecreated(void) //DEBUG_LOG(("Old obj %x, newObj %x, new bones %d, old bones %d", // m_prevRenderObj, getRenderObject(), getRenderObject()->Get_Num_Bones(), // m_prevNumBones)); - m_prevRenderObj = NULL; + m_prevRenderObj = nullptr; m_frontLeftTireBone = 0; m_frontRightTireBone = 0; m_rearLeftTireBone = 0; @@ -390,7 +390,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) return; const W3DTruckDrawModuleData *moduleData = getW3DTruckDrawModuleData(); - if (moduleData==NULL) + if (moduleData==nullptr) return; // shouldn't ever happen. // TheSuperHackers @tweak Update the draw on every WW Sync only. @@ -402,10 +402,10 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) const Real SIZE_CAP = 2.0f; // get object from logic Object *obj = getDrawable()->getObject(); - if (obj == NULL) + if (obj == nullptr) return; - if (getRenderObject()==NULL) return; + if (getRenderObject()==nullptr) return; if (getRenderObject() != m_prevRenderObj) { DEBUG_LOG(("W3DTruckDraw::doDrawModule - shouldn't update bones. jba")); updateBones(); @@ -413,7 +413,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx) // get object physics state PhysicsBehavior *physics = obj->getPhysics(); - if (physics == NULL) + if (physics == nullptr) return; const Coord3D *vel = physics->getVelocity(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp index 5cf8d3c4f63..3310b688c5c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp @@ -26,6 +26,7 @@ // Author: Colin Day // Desc: Control bar callbacks /////////////////////////////////////////////////////////////////////////////////////////////////// + #include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/Radar.h" @@ -118,16 +119,16 @@ void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) //static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); //static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerPointG"); - //const Image *endBar = NULL; - //const Image *beginBar = NULL; - const Image *centerBar = NULL; + //const Image *endBar = nullptr; + //const Image *beginBar = nullptr; + const Image *centerBar = nullptr; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; Energy *energy = player->getEnergy(); - if( energy == NULL ) + if( energy == nullptr ) return; Int consumption = energy->getConsumption(); @@ -277,16 +278,16 @@ void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreen"); - const Image *endBar = NULL; - const Image *beginBar = NULL; - const Image *centerBar = NULL; + const Image *endBar = nullptr; + const Image *beginBar = nullptr; + const Image *centerBar = nullptr; static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); Player* player = TheControlBar->getCurrentlyViewedPlayer(); if(!player || !TheGlobalData) return; Energy *energy = player->getEnergy(); - if( energy == NULL ) + if( energy == nullptr ) return; Int consumption = energy->getConsumption(); @@ -600,7 +601,7 @@ void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) void W3DCommandBarTopDraw( GameWindow *window, WinInstanceData *instData ) { - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); if(!win || win->winIsHidden() || !ThePlayerList->getLocalPlayer()->isPlayerActive()) return; @@ -625,12 +626,12 @@ void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData if(!man) return; static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!win) { return; - //win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); } TheControlBar->getBackgroundMarkerPos(&basePos.x, &basePos.y); ICoord2D pos, offset; @@ -650,12 +651,12 @@ void W3DCommandBarForegroundDraw( GameWindow *window, WinInstanceData *instData return; static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(NULL,winNamekey); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); static ICoord2D basePos; if(!win) { return; - //win = TheWindowManager->winGetWindowFromId(NULL,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); + //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); } TheControlBar->getForegroundMarkerPos(&basePos.x, &basePos.y); ICoord2D pos, offset; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index a81ccef2ac4..51e0b0f76ca 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -211,7 +211,7 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) - advancePosition(NULL, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); + advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); //TheDisplay->drawLine(); @@ -275,7 +275,7 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) - advancePosition(NULL, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); + advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); //TheDisplay->drawLine(); @@ -419,7 +419,7 @@ void W3DMainMenuMapBorder( GameWindow *window, WinInstanceData *instData ) Int size = 20; Int halfSize = size / 2; - const Image *image = NULL; + const Image *image = nullptr; // Draw Horizontal Lines // All border pieces are based on a 10 pixel offset from the centerline @@ -635,8 +635,8 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends @@ -786,7 +786,7 @@ static void drawText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -944,7 +944,7 @@ void W3DMainMenuInit( WindowLayout *layout, void *userData ) if (buttonChina) buttonChina->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - GameWindow *win = NULL; + GameWindow *win = nullptr; win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonMultiBack")); if(win) win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp index eeb266b2087..4d36ff040d6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp @@ -74,7 +74,7 @@ static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -251,7 +251,7 @@ void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) { Int checkOffsetFromLeft; - const Image *boxImage = NULL;//*backgroundImage = NULL, + const Image *boxImage = nullptr;//*backgroundImage = nullptr, ICoord2D origin, start, end, size; // get window position and size diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp index adc27efe9df..804b0c2b9d8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp @@ -371,10 +371,10 @@ void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImageLeft == NULL || rightImageLeft == NULL || - centerImageLeft == NULL || smallCenterImageLeft == NULL || - leftImageRight == NULL || rightImageRight == NULL || - centerImageRight == NULL || smallCenterImageRight == NULL ) + if( leftImageLeft == nullptr || rightImageLeft == nullptr || + centerImageLeft == nullptr || smallCenterImageLeft == nullptr || + leftImageRight == nullptr || rightImageRight == nullptr || + centerImageRight == nullptr || smallCenterImageRight == nullptr ) return; // get image sizes for the ends diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp index 23099a7226f..39c989c585d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp @@ -283,10 +283,10 @@ void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instDat } // sanity - if( backLeft == NULL || backRight == NULL || - backCenter == NULL || - barRight == NULL) - // backSmallCenter == NULL ||barLeft == NULL ||barCenter == NULL || barSmallCenter == NULL ) + if( backLeft == nullptr || backRight == nullptr || + backCenter == nullptr || + barRight == nullptr) + // backSmallCenter == nullptr ||barLeft == nullptr ||barCenter == nullptr || barSmallCenter == nullptr ) return; // get image sizes for the ends diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp index dbb3c3e54be..2b89eb1e564 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp @@ -86,7 +86,7 @@ static void drawButtonText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -282,7 +282,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ) void W3DGadgetPushButtonImageDraw( GameWindow *window, WinInstanceData *instData ) { - // if we return NULL then we'll call the one picture drawing code, if we return a value + // if we return nullptr then we'll call the one picture drawing code, if we return a value // then we'll call the 3 picture drawing code if( GadgetButtonGetMiddleEnabledImage( window ) ) { @@ -313,7 +313,7 @@ void W3DGadgetPushButtonImageDraw( GameWindow *window, void W3DGadgetPushButtonImageDrawOne( GameWindow *window, WinInstanceData *instData ) { - const Image *image = NULL; + const Image *image = nullptr; ICoord2D size, start, end; // @@ -453,7 +453,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window, if( BitIsSet( window->winGetStatus(), WIN_STATUS_USE_OVERLAY_STATES ) ) { - image = NULL; + image = nullptr; static const Image *pushedOverlayIcon = TheMappedImageCollection->findImageByName( "Cameo_push" ); static const Image *hilitedOverlayIcon = TheMappedImageCollection->findImageByName( "Cameo_hilited" ); if( pushedOverlayIcon && hilitedOverlayIcon ) @@ -564,8 +564,8 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst } // sanity, we need to have these images to make it look right - if( leftImage == NULL || rightImage == NULL || - centerImage == NULL ) + if( leftImage == nullptr || rightImage == nullptr || + centerImage == nullptr ) return; // get image sizes for the ends diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp index f3dd9dde95e..d913a57bb0e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp @@ -74,7 +74,7 @@ static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) DisplayString *text = instData->getTextDisplayString(); // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size @@ -314,8 +314,8 @@ void W3DGadgetRadioButtonImageDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( leftImage == NULL || centerImage == NULL || - rightImage == NULL ) + if( leftImage == nullptr || centerImage == nullptr || + rightImage == nullptr ) return; // get image sizes for the ends diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index 2c837c45747..8640566cccb 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -83,7 +83,7 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, ICoord2D origin, size, textPos; IRegion2D clipRegion; // sanity - if( text == NULL || text->getTextLength() == 0 ) + if( text == nullptr || text->getTextLength() == 0 ) return; // get window position and size diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp index 6ea10bd26a0..f1401011861 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp @@ -418,7 +418,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, tabDeltaY = tabHeight; } - const Image *image = NULL; + const Image *image = nullptr; if( tabData->tabCount >= 1 )//Does exist { @@ -435,7 +435,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabZero( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -464,7 +464,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabOne( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -493,7 +493,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabTwo( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -522,7 +522,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabThree( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -551,7 +551,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabFour( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -580,7 +580,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabFive( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -609,7 +609,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabSix( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, @@ -638,7 +638,7 @@ void W3DGadgetTabControlImageDraw( GameWindow *tabControl, image = GadgetTabControlGetEnabledImageTabSeven( tabControl ); } - if( image != NULL ) + if( image != nullptr ) { TheWindowManager->winDrawImage( image, tabX, diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp index 9a34a5ee159..cf11ddebf9a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp @@ -196,7 +196,7 @@ static void drawTextEntryText( GameWindow *window, WinInstanceData *instData, GameWindow *parent; parent = window->winGetParent(); if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = NULL; + parent = nullptr; if( (window == TheWindowManager->winGetFocus() || (parent && parent == TheWindowManager->winGetFocus())) && ((drawCnt++ >> 3) & 0x1) ) TheWindowManager->winFillRect( textColor, WIN_DRAW_LINE_WIDTH, diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp index 56545f26a05..38f6d0b33f4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp @@ -182,8 +182,8 @@ void W3DGadgetVerticalSliderImageDraw( GameWindow *window, } // sanity, we need to have these images to make it look right - if( topImage == NULL || bottomImage == NULL || - centerImage == NULL || smallCenterImage == NULL ) + if( topImage == nullptr || bottomImage == nullptr || + centerImage == nullptr || smallCenterImage == nullptr ) return; // get image sizes for the ends diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp index 0352b2301a5..b91335f4e89 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp @@ -74,7 +74,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return FALSE; const char* name = font->nameString.str(); @@ -84,7 +84,7 @@ Bool W3DFontLibrary::loadFontData( GameFont *font ) // get the font data from the asset manager FontCharsClass *fontChar = WW3DAssetManager::Get_Instance()->Get_FontChars( name, size, bold ); - if( fontChar == NULL ) + if( fontChar == nullptr ) { DEBUG_CRASH(( "Unable to find font '%s' in Asset Manager", name )); return FALSE; @@ -115,7 +115,7 @@ void W3DFontLibrary::releaseFontData( GameFont *font ) ((FontCharsClass *)(font->fontData))->AlternateUnicodeFont->Release_Ref(); ((FontCharsClass *)(font->fontData))->Release_Ref(); - font->fontData = NULL; + font->fontData = nullptr; } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp index dbabe8bfe58..b4bc7550d23 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp @@ -66,7 +66,7 @@ enum // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static Bool bordersInit = FALSE; -static const Image *borderPieces[NUM_BORDER_PIECES] = { 0 }; +static const Image *borderPieces[NUM_BORDER_PIECES] = { nullptr }; // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -438,7 +438,7 @@ void W3DGameWindow::winDrawBorder( void ) TheWindowManager->winGetTextSize( m_instData.getFont(), m_instData.getText(), - &textWidth, NULL, 0 ); + &textWidth, nullptr, 0 ); width -= textWidth + 6; x += textWidth + 6; @@ -525,7 +525,7 @@ void W3DGameWindow::winDrawBorder( void ) void W3DGameWindow::winSetFont( GameFont *font ) { - if (font == NULL) + if (font == nullptr) return; // extending functionality @@ -549,7 +549,7 @@ Int W3DGameWindow::winSetText( UnicodeString newText ) GameWindow::winSetText( newText ); // rebuild the sentence in our text renderer - m_textRenderer.Build_Sentence( m_instData.getText().str(),NULL, NULL ); + m_textRenderer.Build_Sentence( m_instData.getText().str(),nullptr, nullptr ); // this is a visual change m_needPolyDraw = TRUE; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp index 62eb49594ae..874145bac2d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp @@ -26,7 +26,7 @@ #include "Common/Debug.h" #include "W3DDevice/GameClient/W3DBufferManager.h" -W3DBufferManager *TheW3DBufferManager=NULL; //singleton +W3DBufferManager *TheW3DBufferManager=nullptr; //singleton static int FVFTypeIndexList[W3DBufferManager::MAX_FVF]= { @@ -64,14 +64,14 @@ W3DBufferManager::W3DBufferManager(void) Int i=0; for (; im_prevSameVB) vbSlot->m_prevSameVB->m_nextSameVB=vbSlot->m_nextSameVB; else - vbSlot->m_VB->m_usedSlots=NULL; + vbSlot->m_VB->m_usedSlots=nullptr; if (vbSlot->m_nextSameVB) vbSlot->m_nextSameVB->m_prevSameVB=vbSlot->m_prevSameVB; vbSlot=vbSlot->m_nextSameSize; m_numEmptySlotsAllocated--; } - m_W3DVertexBufferSlots[i][j]=NULL; + m_W3DVertexBufferSlots[i][j]=nullptr; } } @@ -115,14 +115,14 @@ void W3DBufferManager::freeAllSlots(void) if (ibSlot->m_prevSameIB) ibSlot->m_prevSameIB->m_nextSameIB=ibSlot->m_nextSameIB; else - ibSlot->m_IB->m_usedSlots=NULL; + ibSlot->m_IB->m_usedSlots=nullptr; if (ibSlot->m_nextSameIB) ibSlot->m_nextSameIB->m_prevSameIB=ibSlot->m_prevSameIB; ibSlot=ibSlot->m_nextSameSize; m_numEmptyIndexSlotsAllocated--; } - m_W3DIndexBufferSlots[j]=NULL; + m_W3DIndexBufferSlots[j]=nullptr; } DEBUG_ASSERTCRASH(m_numEmptySlotsAllocated==0, ("Failed to free all empty vertex buffer slots")); @@ -140,22 +140,22 @@ void W3DBufferManager::freeAllBuffers(void) { W3DVertexBuffer *vb = m_W3DVertexBuffers[i]; while (vb) - { DEBUG_ASSERTCRASH(vb->m_usedSlots == NULL, ("Freeing Non-Empty Vertex Buffer")); + { DEBUG_ASSERTCRASH(vb->m_usedSlots == nullptr, ("Freeing Non-Empty Vertex Buffer")); REF_PTR_RELEASE(vb->m_DX8VertexBuffer); m_numEmptyVertexBuffersAllocated--; vb=vb->m_nextVB; //get next vertex buffer of this type } - m_W3DVertexBuffers[i]=NULL; + m_W3DVertexBuffers[i]=nullptr; } W3DIndexBuffer *ib = m_W3DIndexBuffers; while (ib) - { DEBUG_ASSERTCRASH(ib->m_usedSlots == NULL, ("Freeing Non-Empty Index Buffer")); + { DEBUG_ASSERTCRASH(ib->m_usedSlots == nullptr, ("Freeing Non-Empty Index Buffer")); REF_PTR_RELEASE(ib->m_DX8IndexBuffer); m_numEmptyIndexBuffersAllocated--; ib=ib->m_nextIB; //get next vertex buffer of this type } - m_W3DIndexBuffers=NULL; + m_W3DIndexBuffers=nullptr; DEBUG_ASSERTCRASH(m_numEmptyVertexBuffersAllocated==0, ("Failed to free all empty vertex buffers")); DEBUG_ASSERTCRASH(m_numEmptyIndexBuffersAllocated==0, ("Failed to free all empty index buffers")); @@ -187,7 +187,7 @@ Bool W3DBufferManager::ReAcquireResources(void) { W3DVertexBuffer *vb = m_W3DVertexBuffers[i]; while (vb) - { DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer == NULL, ("ReAcquire of existing vertex buffer")); + { DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer == nullptr, ("ReAcquire of existing vertex buffer")); vb->m_DX8VertexBuffer=NEW_REF(DX8VertexBufferClass,(FVFTypeIndexList[vb->m_format],vb->m_size,DX8VertexBufferClass::USAGE_DEFAULT)); DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer, ("Failed ReAcquire of vertex buffer")); if (!vb->m_DX8VertexBuffer) @@ -198,7 +198,7 @@ Bool W3DBufferManager::ReAcquireResources(void) W3DIndexBuffer *ib = m_W3DIndexBuffers; while (ib) - { DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer == NULL, ("ReAcquire of existing index buffer")); + { DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer == nullptr, ("ReAcquire of existing index buffer")); ib->m_DX8IndexBuffer=NEW_REF(DX8IndexBufferClass,(ib->m_size,DX8IndexBufferClass::USAGE_DEFAULT)); DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer, ("Failed ReAcquire of index buffer")); if (!ib->m_DX8IndexBuffer) @@ -211,11 +211,11 @@ Bool W3DBufferManager::ReAcquireResources(void) /**Searches through previously allocated vertex buffer slots and returns a matching type. If none found, creates a new slot and adds it to the pool. Returns a pointer to the VB slot. - Returns NULL in case of failure. + Returns nullptr in case of failure. */ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES fvfType, Int size) { - W3DVertexBufferSlot *vbSlot=NULL; + W3DVertexBufferSlot *vbSlot=nullptr; //round size to next multiple of minimum slot size. //should help avoid fragmentation. @@ -226,14 +226,14 @@ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES f // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. // This will happen when a mesh is too complex to draw shadows with. if (sizeIndex >= MAX_VB_SIZES || size <= 0) { - return NULL; + return nullptr; } - if ((vbSlot=m_W3DVertexBufferSlots[fvfType][sizeIndex]) != NULL) + if ((vbSlot=m_W3DVertexBufferSlots[fvfType][sizeIndex]) != nullptr) { //found a previously allocated slot matching required size m_W3DVertexBufferSlots[fvfType][sizeIndex]=vbSlot->m_nextSameSize; if (vbSlot->m_nextSameSize) - vbSlot->m_nextSameSize->m_prevSameSize=NULL; + vbSlot->m_nextSameSize->m_prevSameSize=nullptr; return vbSlot; } else @@ -241,7 +241,7 @@ W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES f return allocateSlotStorage(fvfType, size); } - return NULL; + return nullptr; } /**Returns vertex buffer space back to pool so it can be reused later*/ @@ -269,7 +269,7 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. // This will happen when there are too many meshes in the scene to draw shadows with. if (m_numEmptySlotsAllocated >= MAX_NUMBER_SLOTS) { - return NULL; + return nullptr; } pVB=m_W3DVertexBuffers[fvfType]; @@ -283,10 +283,10 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB vbSlot->m_VB=pVB; //Link to VB list of slots vbSlot->m_nextSameVB=pVB->m_usedSlots; - vbSlot->m_prevSameVB=NULL; //this will be the new head + vbSlot->m_prevSameVB=nullptr; //this will be the new head if (pVB->m_usedSlots) pVB->m_usedSlots->m_prevSameVB=vbSlot; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=NULL; + vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; pVB->m_usedSlots=vbSlot; pVB->m_startFreeIndex += size; m_numEmptySlotsAllocated++; @@ -320,22 +320,22 @@ W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VB vbSlot->m_size=size; vbSlot->m_start=0; vbSlot->m_VB=pVB; - vbSlot->m_prevSameVB=vbSlot->m_nextSameVB=NULL; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=NULL; + vbSlot->m_prevSameVB=vbSlot->m_nextSameVB=nullptr; + vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; return vbSlot; } - return NULL; + return nullptr; } //******************************** Index Buffer code ****************************************************** /**Searches through previously allocated index buffer slots and returns a matching type. If none found, creates a new slot and adds it to the pool. Returns a pointer to the IB slot. - Returns NULL in case of failure. + Returns nullptr in case of failure. */ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) { - W3DIndexBufferSlot *ibSlot=NULL; + W3DIndexBufferSlot *ibSlot=nullptr; //round size to next multiple of minimum slot size. //should help avoid fragmentation. @@ -346,14 +346,14 @@ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. // This will happen when a mesh is too complex to draw shadows with. if (sizeIndex >= MAX_IB_SIZES || size <= 0) { - return NULL; + return nullptr; } - if ((ibSlot=m_W3DIndexBufferSlots[sizeIndex]) != NULL) + if ((ibSlot=m_W3DIndexBufferSlots[sizeIndex]) != nullptr) { //found a previously allocated slot matching required size m_W3DIndexBufferSlots[sizeIndex]=ibSlot->m_nextSameSize; if (ibSlot->m_nextSameSize) - ibSlot->m_nextSameSize->m_prevSameSize=NULL; + ibSlot->m_nextSameSize->m_prevSameSize=nullptr; return ibSlot; } else @@ -361,7 +361,7 @@ W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) return allocateSlotStorage(size); } - return NULL; + return nullptr; } /**Returns index buffer space back to pool so it can be reused later*/ @@ -389,7 +389,7 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. // This will happen when there are too many meshes in the scene to draw shadows with. if (m_numEmptyIndexSlotsAllocated >= MAX_NUMBER_SLOTS) { - return NULL; + return nullptr; } pIB=m_W3DIndexBuffers; @@ -403,10 +403,10 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int ibSlot->m_IB=pIB; //Link to IB list of slots ibSlot->m_nextSameIB=pIB->m_usedSlots; - ibSlot->m_prevSameIB=NULL; //this will be the new head + ibSlot->m_prevSameIB=nullptr; //this will be the new head if (pIB->m_usedSlots) pIB->m_usedSlots->m_prevSameIB=ibSlot; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=NULL; + ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; pIB->m_usedSlots=ibSlot; pIB->m_startFreeIndex += size; m_numEmptyIndexSlotsAllocated++; @@ -439,10 +439,10 @@ W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int ibSlot->m_size=size; ibSlot->m_start=0; ibSlot->m_IB=pIB; - ibSlot->m_prevSameIB=ibSlot->m_nextSameIB=NULL; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=NULL; + ibSlot->m_prevSameIB=ibSlot->m_nextSameIB=nullptr; + ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; return ibSlot; } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 54d75aa2c09..47cb4c8d3c0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -74,7 +74,7 @@ Maybe project onto a deformed terrain patch that molds to trays/bibs. #define DEFAULT_RENDER_TARGET_WIDTH 512 #define DEFAULT_RENDER_TARGET_HEIGHT 512 -W3DProjectedShadowManager *TheW3DProjectedShadowManager=NULL; //global singleton +W3DProjectedShadowManager *TheW3DProjectedShadowManager=nullptr; //global singleton ProjectedShadowManager *TheProjectedShadowManager; //global singleton with simpler interface. extern const FrustumClass *shadowCameraFrustum; //defined in W3DShadow. ///@todo: Externs from volumetric shadow renderer - these need to be moved into W3DBufferManager @@ -97,8 +97,8 @@ struct SHADOW_DECAL_VERTEX //vertex structure passed to D3D #define SHADOW_DECAL_FVF D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_DIFFUSE -LPDIRECT3DVERTEXBUFFER8 shadowDecalVertexBufferD3D=NULL; ///freeAllTextures(); @@ -258,10 +258,10 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) ///@todo: We should allocate our render target pool here. - DEBUG_ASSERTCRASH(m_dynamicRenderTarget == NULL, ("Acquire of existing shadow render target")); + DEBUG_ASSERTCRASH(m_dynamicRenderTarget == nullptr, ("Acquire of existing shadow render target")); m_renderTargetHasAlpha=TRUE; - if ((m_dynamicRenderTarget=DX8Wrapper::Create_Render_Target (DEFAULT_RENDER_TARGET_WIDTH, DEFAULT_RENDER_TARGET_HEIGHT, WW3D_FORMAT_A8R8G8B8)) == NULL) + if ((m_dynamicRenderTarget=DX8Wrapper::Create_Render_Target (DEFAULT_RENDER_TARGET_WIDTH, DEFAULT_RENDER_TARGET_HEIGHT, WW3D_FORMAT_A8R8G8B8)) == nullptr) { m_renderTargetHasAlpha=FALSE; @@ -273,7 +273,7 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DProjectedShadowManager without device")); - DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == NULL && shadowDecalIndexBufferD3D == NULL, ("ReAquireResources not released in W3DProjectedShadowManager")); + DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAquireResources not released in W3DProjectedShadowManager")); if (FAILED(m_pDev->CreateIndexBuffer ( @@ -285,7 +285,7 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) ))) return FALSE; - if (shadowDecalVertexBufferD3D == NULL) + if (shadowDecalVertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(m_pDev->CreateVertexBuffer @@ -310,8 +310,8 @@ void W3DProjectedShadowManager::ReleaseResources(void) shadowDecalIndexBufferD3D->Release(); if (shadowDecalVertexBufferD3D) shadowDecalVertexBufferD3D->Release(); - shadowDecalIndexBufferD3D=NULL; - shadowDecalVertexBufferD3D=NULL; + shadowDecalIndexBufferD3D=nullptr; + shadowDecalVertexBufferD3D=nullptr; } void W3DProjectedShadowManager::invalidateCachedLightPositions(void) @@ -531,9 +531,9 @@ Int W3DProjectedShadowManager::renderProjectedTerrainShadow(W3DProjectedShadow * #if 0 -TextureClass *snow=NULL; -TextureClass *grass=NULL; -TextureClass *ground=NULL; +TextureClass *snow=nullptr; +TextureClass *grass=nullptr; +TextureClass *ground=nullptr; #define V_COUNT (4*4) //4 vertices per cell #define I_COUNT (4*6) //6 indices per cell @@ -1319,7 +1319,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) TheDX8MeshRenderer.Set_Camera(&rinfo.Camera); //keep track of active decal texture so we can render all decals at once. - W3DShadowTexture *lastShadowDecalTexture=NULL; + W3DShadowTexture *lastShadowDecalTexture=nullptr; ShadowType lastShadowType = SHADOW_NONE; for( shadow = m_shadowList; shadow; shadow = shadow->m_next ) @@ -1328,7 +1328,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) { if (shadow->m_type & SHADOW_DECAL) { - if (lastShadowDecalTexture == NULL) + if (lastShadowDecalTexture == nullptr) lastShadowDecalTexture=m_shadowList->m_shadowTexture[0]; if (lastShadowType == SHADOW_NONE) lastShadowType = m_shadowList->m_type; @@ -1403,10 +1403,10 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) if (di) { W3DModelDraw *w3dDraw= (W3DModelDraw *)di; - RenderObjClass *robj=NULL; + RenderObjClass *robj=nullptr; ///@todo: don't apply shadows to translcuent objects unless they are MOBILE - hack to get tanks to work. - if ((robj=w3dDraw->getRenderObject()) != 0 && (!robj->Is_Alpha() || !obj->isKindOf(KINDOF_IMMOBILE)) && robj != shadow->m_robj && robj->Is_Really_Visible()) + if ((robj=w3dDraw->getRenderObject()) != nullptr && (!robj->Is_Alpha() || !obj->isKindOf(KINDOF_IMMOBILE)) && robj != shadow->m_robj && robj->Is_Really_Visible()) { //do a more accurate test against W3D render bounding boxes. if (robj->Intersect_AABox(boxtest)) @@ -1433,14 +1433,14 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) if (m_decalList) { //keep track of active decal texture so we can render all decals at once. - W3DShadowTexture *lastShadowDecalTexture=NULL; + W3DShadowTexture *lastShadowDecalTexture=nullptr; ShadowType lastShadowType = SHADOW_NONE; for( shadow = m_decalList; shadow; shadow = shadow->m_next ) { if (shadow->m_isEnabled && !shadow->m_isInvisibleEnabled) { - if (lastShadowDecalTexture == NULL) + if (lastShadowDecalTexture == nullptr) lastShadowDecalTexture=m_decalList->m_shadowTexture[0]; if (lastShadowType == SHADOW_NONE) lastShadowType = m_decalList->m_type; @@ -1469,7 +1469,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo) Some examples: Scorch marks, blood, stains, selection/status indicators, etc.*/ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. Real decalSizeX=0.0f; @@ -1479,7 +1479,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!shadowInfo) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected @@ -1490,7 +1490,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //Adding a new decal texture TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1498,10 +1498,10 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture: %s",texture_name)); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture: %s",texture_name)); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1519,10 +1519,10 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // poolify // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; - shadow->setRenderObject(NULL); + shadow->setRenderObject(nullptr); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights shadow->m_type = shadowType; /// type of projection shadow->m_allowWorldAlign=allowWorldAlign; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1543,7 +1543,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_decalList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1558,7 +1558,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_decalList; m_decalList = shadow; @@ -1572,7 +1572,7 @@ Shadow* W3DProjectedShadowManager::addDecal(Shadow::ShadowTypeInfo *shadowInfo) Some examples: Scorch marks, blood, stains, selection/status indicators, etc.*/ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. Real decalSizeX=0.0f; @@ -1584,7 +1584,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow Char texture_name[ARRAY_SIZE(shadowInfo->m_ShadowName)]; if (!robj || !shadowInfo) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support //simple decal using the premade texture specified. //can be always perpendicular to model's z-axis or projected @@ -1595,7 +1595,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow //Check if we previously added a decal using this texture st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //Adding a new decal texture TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1603,10 +1603,10 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture: %s",texture_name)); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture: %s",texture_name)); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; SET_REF_OWNER( st ); @@ -1626,8 +1626,8 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights @@ -1666,7 +1666,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_decalList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1681,7 +1681,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_decalList; m_decalList = shadow; @@ -1693,7 +1693,7 @@ Shadow* W3DProjectedShadowManager::addDecal(RenderObjClass *robj, Shadow::Shadow W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; static char defaultDecalName[]={"shadow.tga"}; ShadowType shadowType=SHADOW_NONE; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1707,7 +1707,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S if (!m_dynamicRenderTarget || !robj || !TheGlobalData->m_useShadowDecals) - return NULL; //right now we require hardware render-to-texture support + return nullptr; //right now we require hardware render-to-texture support if (shadowInfo) @@ -1730,7 +1730,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S } st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //need to add this texture without creating it from a real renderobject TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1738,10 +1738,10 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture")); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture")); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1773,16 +1773,16 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S strlcpy(texture_name, robj->Get_Name(), ARRAY_SIZE(texture_name)); //not texture name give, assume model name. st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //texture doesn't exist, use current render object to create it m_W3DShadowTextureManager->createTexture(robj,texture_name); //try loading again st=m_W3DShadowTextureManager->getTexture(texture_name); - DEBUG_ASSERTCRASH(st != NULL, ("Could not create shadow texture")); + DEBUG_ASSERTCRASH(st != nullptr, ("Could not create shadow texture")); - if (st==NULL) - return NULL; //could not create the shadow texture + if (st==nullptr) + return nullptr; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; } @@ -1793,13 +1793,13 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st==NULL) + if (st==nullptr) { //did not find a cached copy of the shadow geometry, create a new one m_W3DShadowTextureManager->createTexture(robj,texture_name); //try loading again st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st==NULL) - return NULL; //could not create the shadow texture + if (st==nullptr) + return nullptr; //could not create the shadow texture } shadowType=SHADOW_PROJECTION; } @@ -1807,8 +1807,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->setTexture(0,st); ///@todo: Fix projected shadows to allow multiple lights @@ -1855,7 +1855,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S // add to our shadow list through the shadow next links, insert next to other shadows using same texture - W3DProjectedShadow *nextShadow=NULL,*prevShadow=NULL; + W3DProjectedShadow *nextShadow=nullptr,*prevShadow=nullptr; for( nextShadow = m_shadowList; nextShadow; prevShadow=nextShadow,nextShadow = nextShadow->m_next ) { if (nextShadow->m_shadowTexture[0]==st) @@ -1870,7 +1870,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S } } - if (nextShadow==NULL) + if (nextShadow==nullptr) { //shadow with new texture. Add to top of list. shadow->m_next = m_shadowList; m_shadowList = shadow; @@ -1882,7 +1882,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowTypeInfo *shadowInfo) { - W3DShadowTexture *st=NULL; + W3DShadowTexture *st=nullptr; static char defaultDecalName[]={"shadow.tga"}; ShadowType shadowType=SHADOW_DECAL; /// type of projection Bool allowWorldAlign=FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. @@ -1909,7 +1909,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT } st=m_W3DShadowTextureManager->getTexture(texture_name); - if (st == NULL) + if (st == nullptr) { //need to add this texture without creating it from a real renderobject TextureClass *w3dTexture=WW3DAssetManager::Get_Instance()->Get_Texture(texture_name); @@ -1917,10 +1917,10 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT w3dTexture->Get_Filter().Set_V_Addr_Mode(TextureFilterClass::TEXTURE_ADDRESS_CLAMP); w3dTexture->Get_Filter().Set_Mip_Mapping(TextureFilterClass::FILTER_TYPE_NONE); - DEBUG_ASSERTCRASH(w3dTexture != NULL, ("Could not load decal texture")); + DEBUG_ASSERTCRASH(w3dTexture != nullptr, ("Could not load decal texture")); if (!w3dTexture) - return NULL; + return nullptr; st = NEW W3DShadowTexture; // poolify SET_REF_OWNER( st ); @@ -1937,8 +1937,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT W3DProjectedShadow *shadow = NEW W3DProjectedShadow; // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setTexture(0,st); shadow->m_type = shadowType; /// type of projection @@ -1984,8 +1984,8 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) { - W3DProjectedShadow *prev_shadow=NULL; - W3DProjectedShadow *next_shadow=NULL; + W3DProjectedShadow *prev_shadow=nullptr; + W3DProjectedShadow *next_shadow=nullptr; if (shadow->m_type & (SHADOW_ALPHA_DECAL|SHADOW_ADDITIVE_DECAL)) { @@ -2025,9 +2025,9 @@ void W3DProjectedShadowManager::removeShadow (W3DProjectedShadow *shadow) void W3DProjectedShadowManager::removeAllShadows(void) { - W3DProjectedShadow *cur_shadow=NULL; + W3DProjectedShadow *cur_shadow=nullptr; W3DProjectedShadow *next_shadow=m_shadowList; - m_shadowList = NULL; + m_shadowList = nullptr; m_numDecalShadows = 0; m_numProjectionShadows = 0; @@ -2035,17 +2035,17 @@ void W3DProjectedShadowManager::removeAllShadows(void) for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } next_shadow=m_decalList; - cur_shadow=NULL; - m_decalList=NULL; + cur_shadow=nullptr; + m_decalList=nullptr; for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } } @@ -2078,14 +2078,14 @@ void W3DProjectedShadow::getRenderCost(RenderCost & rc) const W3DProjectedShadow::W3DProjectedShadow(void) { m_diffuse=0xffffffff; - m_shadowProjector=NULL; + m_shadowProjector=nullptr; m_lastObjPosition.Set(0,0,0); m_type = SHADOW_NONE; /// type of projection m_allowWorldAlign = FALSE; /// wrap shadow around world geometry - else align perpendicular to local z-axis. m_isEnabled = TRUE; m_isInvisibleEnabled = FALSE; for (Int i=0; iAdd_Ref(); } return text; @@ -2351,7 +2351,7 @@ W3DShadowTexture * W3DShadowTextureManager::getTexture(const char * name) /** Add texture to cache */ Bool W3DShadowTextureManager::addTexture(W3DShadowTexture *newTexture) { - WWASSERT (newTexture != NULL); + WWASSERT (newTexture != nullptr); // Increment the refcount on the new texture and add it to our table. newTexture->Add_Ref (); @@ -2393,7 +2393,7 @@ class MissingTextureClass : public HashableClass { ** Missing Textures ** ** The idea here, allow the system to register which textures are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching again. +** so that if they are asked for again, we can quickly return nullptr, without searching again. */ void W3DShadowTextureManager::registerMissing( const char * name ) { @@ -2402,7 +2402,7 @@ void W3DShadowTextureManager::registerMissing( const char * name ) Bool W3DShadowTextureManager::isMissing( const char * name ) { - return ( missingTextureTable->Find( name ) != NULL ); + return ( missingTextureTable->Find( name ) != nullptr ); } /** Create shadow geometry from a reference W3D RenderObject*/ @@ -2412,7 +2412,7 @@ int W3DShadowTextureManager::createTexture(RenderObjClass *robj, const char *nam W3DShadowTexture * newTexture = NEW W3DShadowTexture; - if (newTexture == NULL) { + if (newTexture == nullptr) { goto Error; } @@ -2425,7 +2425,7 @@ int W3DShadowTextureManager::createTexture(RenderObjClass *robj, const char *nam { // load failed! newTexture->Release_Ref(); goto Error; - } else if (peekTexture(newTexture->Get_Name()) != NULL) + } else if (peekTexture(newTexture->Get_Name()) != nullptr) { // duplicate exists! newTexture->Release_Ref(); // Release the one we just loaded goto Error; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp index 4f2096efa7f..e5f828619e4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp @@ -54,7 +54,7 @@ #define SUN_DISTANCE_FROM_GROUND 10000.0f //distance of sun (our only light source). // Global Variables and Functions ///////////////////////////////////////////// -W3DShadowManager *TheW3DShadowManager=NULL; +W3DShadowManager *TheW3DShadowManager=nullptr; const FrustumClass *shadowCameraFrustum; Vector3 LightPosWorld[ MAX_SHADOW_LIGHTS ] = @@ -101,7 +101,7 @@ void DoShadows(RenderInfoClass & rinfo, Bool stencilPass) W3DShadowManager::W3DShadowManager( void ) { - DEBUG_ASSERTCRASH(TheW3DVolumetricShadowManager == NULL && TheW3DProjectedShadowManager == NULL, + DEBUG_ASSERTCRASH(TheW3DVolumetricShadowManager == nullptr && TheW3DProjectedShadowManager == nullptr, ("Creating new shadow managers without deleting old ones")); m_shadowColor = 0x7fa0a0a0; @@ -121,9 +121,9 @@ W3DShadowManager::W3DShadowManager( void ) W3DShadowManager::~W3DShadowManager( void ) { delete TheW3DVolumetricShadowManager; - TheW3DVolumetricShadowManager = NULL; + TheW3DVolumetricShadowManager = nullptr; delete TheW3DProjectedShadowManager; - TheProjectedShadowManager = TheW3DProjectedShadowManager = NULL; + TheProjectedShadowManager = TheW3DProjectedShadowManager = nullptr; } /** Do one-time initilalization of shadow systems that need to be @@ -196,10 +196,10 @@ Shadow *W3DShadowManager::addShadow( RenderObjClass *robj, Shadow::ShadowTypeInf return (Shadow *)TheW3DProjectedShadowManager->addShadow(robj, shadowInfo, draw); break; default: - return NULL; + return nullptr; } - return NULL; + return nullptr; } void W3DShadowManager::removeShadow(Shadow *shadow) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 2171bfe538a..478c1f78f24 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -65,7 +65,7 @@ // Global Variables and Functions ///////////////////////////////////////////// -W3DVolumetricShadowManager *TheW3DVolumetricShadowManager=NULL; +W3DVolumetricShadowManager *TheW3DVolumetricShadowManager=nullptr; extern const FrustumClass *shadowCameraFrustum; //defined in W3DShadow. /////////////////////////////////////////////////////////////////////////////// @@ -107,8 +107,8 @@ struct SHADOW_STATIC_VOLUME_VERTEX //vertex structure passed to D3D #define SHADOW_DYNAMIC_VOLUME_FVF D3DFVF_XYZ #endif -LPDIRECT3DVERTEXBUFFER8 shadowVertexBufferD3D=NULL; ///getMap(); if (!map) @@ -439,13 +439,13 @@ int W3DShadowGeometryHeightmapMesh::GetPolygonIndex (long dwPolyId, short *psInd Vector3 *W3DShadowGeometryHeightmapMesh::GetVertex (int dwVertId, Vector3 *pvVertex) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; if (TheTerrainRenderObject) map=TheTerrainRenderObject->getMap(); if (!map) - return NULL; + return nullptr; Int row=dwVertId/m_width; Int column=dwVertId-row*m_width; @@ -460,7 +460,7 @@ Vector3 *W3DShadowGeometryHeightmapMesh::GetVertex (int dwVertId, Vector3 *pvVer Bool isPatchShadowed(W3DShadowGeometryHeightmapMesh *hm_mesh) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; Short poly[ 3 ]; Vector3 vertex; Vector3 normal,lightVector; @@ -471,7 +471,7 @@ Bool isPatchShadowed(W3DShadowGeometryHeightmapMesh *hm_mesh) map=TheTerrainRenderObject->getMap(); if (!map) - return NULL; + return FALSE; hm_mesh->buildPolygonNormal( 0, &normal ); @@ -541,7 +541,7 @@ static Int numTerrainMeshes=0; void W3DVolumetricShadowManager::loadTerrainShadows(void) { - WorldHeightMap *map=NULL; + WorldHeightMap *map=nullptr; Int patchSize=3; if (TheTerrainRenderObject) @@ -719,7 +719,7 @@ Int W3DShadowGeometry::initFromHLOD(RenderObjClass *robj) if (sub_mesh->Get_Flag(MeshGeometryClass::SKIN)) continue; - geomMesh->m_mesh = NULL; //hope this doesn't cause problems! + geomMesh->m_mesh = nullptr; //hope this doesn't cause problems! geomMesh->m_meshRobjIndex=i; // Count the polygons and vertices @@ -855,10 +855,10 @@ Int W3DShadowGeometry::init(RenderObjClass *robj) W3DShadowGeometryMesh::W3DShadowGeometryMesh( void ) { // init polygon neighbor information - m_polyNeighbors = NULL; + m_polyNeighbors = nullptr; m_numPolyNeighbors = 0; - m_parentVerts = NULL; - m_polygonNormals = NULL; + m_parentVerts = nullptr; + m_polygonNormals = nullptr; } // ~W3DShadowGeometry ============================================================ @@ -888,7 +888,7 @@ if (!m_polyNeighbors) { // DBGPRINTF(( "Invalid neighbor index '%d'\n", polyIndex )); assert( 0 ); - return NULL; + return nullptr; } @@ -1092,11 +1092,11 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) // assure we're not re-allocating without deleting assert( m_numPolyNeighbors == 0 ); - assert( m_polyNeighbors == NULL ); + assert( m_polyNeighbors == nullptr ); // allocate the list m_polyNeighbors = NEW PolyNeighbor[ numPolys ]; - if( m_polyNeighbors == NULL ) + if( m_polyNeighbors == nullptr ) { // DBGPRINTF(( "Unable to allocate polygon neighbors\n" )); @@ -1120,12 +1120,12 @@ void W3DShadowGeometryMesh::deleteNeighbors( void ) // delete list delete [] m_polyNeighbors; - m_polyNeighbors = NULL; + m_polyNeighbors = nullptr; m_numPolyNeighbors = 0; // sanity error checking assert( m_numPolyNeighbors == 0 ); - assert( m_polyNeighbors == NULL ); + assert( m_polyNeighbors == nullptr ); } @@ -1222,7 +1222,7 @@ void W3DVolumetricShadow::updateOptimalExtrusionPadding(void) terrainPoint = Corners[i] + shadowRay*t; terrainPoint.Z=0; //ignore height - Real terrainHeight=TheTerrainRenderObject->getHeightMapHeight(terrainPoint.X,terrainPoint.Y,NULL); + Real terrainHeight=TheTerrainRenderObject->getHeightMapHeight(terrainPoint.X,terrainPoint.Y,nullptr); if (terrainHeight < (objPos.Z - MAX_SHADOW_EXTRUSION_UNDER_OBJECT_BEFORE_CLAMP)) //check if terrain dips more than 10 units under object. { if (j == 0) //this is the initial point so object must be right on the edge of a cliff. @@ -1302,7 +1302,7 @@ void W3DVolumetricShadow::getRenderCost(RenderCost & rc) const void W3DVolumetricShadow::RenderVolume(Int meshIndex, Int lightIndex) { HLodClass *hlod=(HLodClass *)m_robj; - MeshClass *mesh=NULL; + MeshClass *mesh=nullptr; Int meshRobjIndex=m_geometry->getMesh(meshIndex)->m_meshRobjIndex; @@ -1646,18 +1646,18 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) { Int i,j; - m_next = NULL; - m_geometry = NULL; + m_next = nullptr; + m_geometry = nullptr; m_shadowLengthScale = 0.0f; m_extraExtrusionPadding = 0.0f; - m_robj = NULL; + m_robj = nullptr; m_isEnabled = TRUE; m_isInvisibleEnabled = FALSE; for (j=0; j < MAX_SHADOW_CASTER_MESHES; j++) { m_numSilhouetteIndices[j] = 0; m_maxSilhouetteEntries[j] = 0; - m_silhouetteIndex[j] = NULL; + m_silhouetteIndex[j] = nullptr; m_shadowVolumeCount[j] = 0; } @@ -1665,9 +1665,9 @@ W3DVolumetricShadow::W3DVolumetricShadow( void ) { for (j=0; j < MAX_SHADOW_CASTER_MESHES; j++) { - m_shadowVolume[ i ][j] = NULL; - m_shadowVolumeVB[i][j] = NULL; - m_shadowVolumeIB[i][j] = NULL; + m_shadowVolume[ i ][j] = nullptr; + m_shadowVolumeVB[i][j] = nullptr; + m_shadowVolumeIB[i][j] = nullptr; m_shadowVolumeRenderTask[i][j].m_parentShadow = this; m_shadowVolumeRenderTask[i][j].m_meshIndex = (UnsignedByte)j; m_shadowVolumeRenderTask[i][j].m_lightIndex = (UnsignedByte)i; @@ -1704,8 +1704,8 @@ W3DVolumetricShadow::~W3DVolumetricShadow( void ) if (m_geometry) REF_PTR_RELEASE(m_geometry); - m_geometry=NULL; - m_robj=NULL; + m_geometry=nullptr; + m_robj=nullptr; } @@ -1765,7 +1765,7 @@ void W3DVolumetricShadow::Update() Vector3 pos; // sanity - if( m_geometry == NULL) + if( m_geometry == nullptr) return; // @@ -1792,7 +1792,7 @@ void W3DVolumetricShadow::Update() if (TheTerrainLogic) groundHeight=TheTerrainLogic->getGroundHeight(pos.X,pos.Y); //logic knows about bridges so use if available. else - groundHeight=TheTerrainRenderObject->getHeightMapHeight(pos.X,pos.Y, NULL); + groundHeight=TheTerrainRenderObject->getHeightMapHeight(pos.X,pos.Y, nullptr); if (fabs(pos.Z - groundHeight) >= AIRBORNE_UNIT_GROUND_DELTA) { Real extent = MAX_SHADOW_LENGTH_EXTRA_AIRBORNE_SCALE_FACTOR * m_robjExtent; @@ -1845,7 +1845,7 @@ void W3DVolumetricShadow::updateVolumes(Real zoffset) static SphereClass sphere; Int meshIndex; - DEBUG_ASSERTCRASH(hlod != NULL,("updateVolumes : hlod is NULL!")); + DEBUG_ASSERTCRASH(hlod != nullptr,("updateVolumes : hlod is null!")); Bool parentVis=m_robj->Is_Really_Visible(); @@ -2456,7 +2456,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject { // initialize this neighbor to nuttin - otherNeighbor = NULL; + otherNeighbor = nullptr; // get our neighbor if present and cull them if processed if( polyNeighbor->neighbor[ j ].neighborIndex != NO_NEIGHBOR ) @@ -2488,7 +2488,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject { // check for no neighbor edges - if( otherNeighbor == NULL ) + if( otherNeighbor == nullptr ) { visibleNeighborless = TRUE; @@ -2503,7 +2503,7 @@ void W3DVolumetricShadow::buildSilhouette(Int meshIndex, Vector3 *lightPosObject } } - else if( otherNeighbor != NULL && + else if( otherNeighbor != nullptr && BitIsSet( otherNeighbor->status, POLY_VISIBLE ) ) { @@ -2570,7 +2570,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx // sanity if( volumeIndex < 0 || volumeIndex >= MAX_SHADOW_LIGHTS || - lightPosObject == NULL ) + lightPosObject == nullptr ) { assert( 0 ); @@ -2581,7 +2581,7 @@ void W3DVolumetricShadow::constructVolume( Vector3 *lightPosObject,Real shadowEx // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "No volume allocated at index '%d'\n", volumeIndex )); @@ -2810,7 +2810,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow // sanity if( volumeIndex < 0 || volumeIndex >= MAX_SHADOW_LIGHTS || - lightPosObject == NULL ) + lightPosObject == nullptr ) { assert( 0 ); @@ -2821,7 +2821,7 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow // get the geometry struct we're storing the actual shadow volume data in shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]; - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "No volume allocated at index '%d'\n", volumeIndex )); @@ -2934,23 +2934,23 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow } //*********************************************************************************************** - DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Vertex Buffer Shadow")); + DEBUG_ASSERTCRASH(m_shadowVolumeVB[ volumeIndex ][meshIndex] == nullptr,("Updating Existing Static Vertex Buffer Shadow")); vbSlot=m_shadowVolumeVB[ volumeIndex ][meshIndex] = TheW3DBufferManager->getSlot(W3DBufferManager::VBM_FVF_XYZ, vertexCount); - DEBUG_ASSERTCRASH(vbSlot != NULL, ("Can't allocate vertex buffer slot for shadow volume")); - if (vbSlot != NULL) + DEBUG_ASSERTCRASH(vbSlot != nullptr, ("Can't allocate vertex buffer slot for shadow volume")); + if (vbSlot != nullptr) { DEBUG_ASSERTCRASH(vbSlot->m_size >= vertexCount,("Overflowing Shadow Vertex Buffer Slot")); } DEBUG_ASSERTCRASH(m_shadowVolume[ volumeIndex ][meshIndex]->GetNumPolygon() == 0,("Updating Existing Static Shadow Volume")); - DEBUG_ASSERTCRASH(m_shadowVolumeIB[ volumeIndex ][meshIndex] == NULL,("Updating Existing Static Index Buffer Shadow")); + DEBUG_ASSERTCRASH(m_shadowVolumeIB[ volumeIndex ][meshIndex] == nullptr,("Updating Existing Static Index Buffer Shadow")); ibSlot=m_shadowVolumeIB[ volumeIndex ][meshIndex] = TheW3DBufferManager->getSlot(polygonCount*3); - DEBUG_ASSERTCRASH(ibSlot != NULL, ("Can't allocate index buffer slot for shadow volume")); - if (ibSlot != NULL) + DEBUG_ASSERTCRASH(ibSlot != nullptr, ("Can't allocate index buffer slot for shadow volume")); + if (ibSlot != nullptr) { DEBUG_ASSERTCRASH(ibSlot->m_size >= (polygonCount*3),("Overflowing Shadow Index Buffer Slot")); } @@ -2962,8 +2962,8 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow if (vbSlot) TheW3DBufferManager->releaseSlot(vbSlot); - m_shadowVolumeIB[ volumeIndex ][meshIndex]=NULL; - m_shadowVolumeVB[ volumeIndex ][meshIndex]=NULL; + m_shadowVolumeIB[ volumeIndex ][meshIndex]=nullptr; + m_shadowVolumeVB[ volumeIndex ][meshIndex]=nullptr; return; } @@ -2972,13 +2972,13 @@ void W3DVolumetricShadow::constructVolumeVB( Vector3 *lightPosObject,Real shadow DX8VertexBufferClass::AppendLockClass lockVtxBuffer(vbSlot->m_VB->m_DX8VertexBuffer,vbSlot->m_start,vertexCount); VertexFormatXYZ *vb = (VertexFormatXYZ*)lockVtxBuffer.Get_Vertex_Array(); - if (vb == NULL) + if (vb == nullptr) return; DX8IndexBufferClass::AppendLockClass lockIdxBuffer(ibSlot->m_IB->m_DX8IndexBuffer,ibSlot->m_start,polygonCount*3); UnsignedShort *ib = (UnsignedShort*)lockIdxBuffer.Get_Index_Array(); - if (ib == NULL) + if (ib == nullptr) return; shadowVolume->SetNumActivePolygon(polygonCount); @@ -3133,7 +3133,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) } - if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == 0) + if ((shadowVolume = m_shadowVolume[ volumeIndex ][meshIndex]) == nullptr) { // poolify shadowVolume = NEW Geometry; // create the new geometry @@ -3141,7 +3141,7 @@ Bool W3DVolumetricShadow::allocateShadowVolume( Int volumeIndex, Int meshIndex ) m_shadowVolumeCount[meshIndex]++; } - if( shadowVolume == NULL ) + if( shadowVolume == nullptr ) { // DBGPRINTF(( "Unable to allocate '%d' shadow volume\n", volumeIndex )); @@ -3223,7 +3223,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) { delete m_shadowVolume[ volumeIndex ][meshIndex]; - m_shadowVolume[ volumeIndex ][meshIndex] = NULL; + m_shadowVolume[ volumeIndex ][meshIndex] = nullptr; // we now have one less shadow volume m_shadowVolumeCount[meshIndex]--; @@ -3259,11 +3259,11 @@ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) if (geometry) { if (m_shadowVolumeVB[volumeIndex][meshIndex]) { TheW3DBufferManager->releaseSlot(m_shadowVolumeVB[volumeIndex][meshIndex]); - m_shadowVolumeVB[volumeIndex][meshIndex]=NULL; + m_shadowVolumeVB[volumeIndex][meshIndex]=nullptr; } if (m_shadowVolumeIB[ volumeIndex ][meshIndex]) { TheW3DBufferManager->releaseSlot(m_shadowVolumeIB[volumeIndex][meshIndex]); - m_shadowVolumeIB[volumeIndex][meshIndex]=NULL; + m_shadowVolumeIB[volumeIndex][meshIndex]=nullptr; } geometry->Release(); } @@ -3281,13 +3281,13 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) Int numEntries = numVertices * 5; ///@todo: HACK, HACK... Should be 2! // sanity - assert( m_silhouetteIndex[meshIndex] == NULL && + assert( m_silhouetteIndex[meshIndex] == nullptr && m_numSilhouetteIndices[meshIndex] == 0 && numEntries > 0 ); // allocate memory m_silhouetteIndex[meshIndex] = NEW short[ numEntries ]; - if( m_silhouetteIndex[meshIndex] == NULL ) + if( m_silhouetteIndex[meshIndex] == nullptr ) { // DBGPRINTF(( "Unable to allcoate silhouette storage '%d'\n", numEntries )); @@ -3313,7 +3313,7 @@ void W3DVolumetricShadow::deleteSilhouette( Int meshIndex ) { delete [] m_silhouetteIndex[meshIndex]; - m_silhouetteIndex[meshIndex] = NULL; + m_silhouetteIndex[meshIndex] = nullptr; m_numSilhouetteIndices[meshIndex] = 0; } @@ -3440,8 +3440,8 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) REF_PTR_RELEASE(vmat); DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); //turn off textures - DX8Wrapper::Set_Texture(1,NULL); //turn off textures + DX8Wrapper::Set_Texture(0,nullptr); //turn off textures + DX8Wrapper::Set_Texture(1,nullptr); //turn off textures DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices // turn off z writing @@ -3464,8 +3464,8 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) m_pDev->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE); m_pDev->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); m_pDev->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 ); - m_pDev->SetTexture(0,NULL); - m_pDev->SetTexture(1,NULL); + m_pDev->SetTexture(0,nullptr); + m_pDev->SetTexture(1,nullptr); DWORD oldColorWriteEnable=0x12345678; @@ -3512,9 +3512,9 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) //m_pDev->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME); - lastActiveVertexBuffer=NULL; //reset + lastActiveVertexBuffer=nullptr; //reset - m_dynamicShadowVolumesToRender=NULL; //clear list of pending dynamic shadows + m_dynamicShadowVolumesToRender=nullptr; //clear list of pending dynamic shadows W3DVolumetricShadowRenderTask *shadowDynamicTasksStart,*shadowDynamicTask; // step through each of our shadows and render @@ -3544,7 +3544,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) //Empty queue of static shadow volumes to render. W3DBufferManager::W3DVertexBuffer *nextVb; W3DVolumetricShadowRenderTask *nextTask; - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { nextTask=(W3DVolumetricShadowRenderTask *)nextVb->m_renderTaskList; while (nextTask) @@ -3565,7 +3565,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) m_pDev->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW); - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { nextTask=(W3DVolumetricShadowRenderTask *)nextVb->m_renderTaskList; while (nextTask) @@ -3586,9 +3586,9 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) } //Reset all render tasks for next frame. - for (nextVb=TheW3DBufferManager->getNextVertexBuffer(NULL,W3DBufferManager::VBM_FVF_XYZ);nextVb != NULL; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) + for (nextVb=TheW3DBufferManager->getNextVertexBuffer(nullptr,W3DBufferManager::VBM_FVF_XYZ);nextVb != nullptr; nextVb=TheW3DBufferManager->getNextVertexBuffer(nextVb,W3DBufferManager::VBM_FVF_XYZ)) { - nextVb->m_renderTaskList=NULL; + nextVb->m_renderTaskList=nullptr; } m_pDev->SetRenderState(D3DRS_CULLMODE,D3DCULL_CW); @@ -3623,7 +3623,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill ) DX8Wrapper::Set_Material(vmat); REF_PTR_RELEASE(vmat); DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Apply_Render_State_Changes(); //force update of view and projection matrices renderStencilShadows(); @@ -3699,7 +3699,7 @@ void W3DVolumetricShadowManager::invalidateCachedLightPositions(void) W3DVolumetricShadowManager::W3DVolumetricShadowManager( void ) { - m_shadowList = NULL; + m_shadowList = nullptr; m_W3DShadowGeometryManager = NEW W3DShadowGeometryManager; @@ -3713,12 +3713,12 @@ W3DVolumetricShadowManager::~W3DVolumetricShadowManager( void ) { ReleaseResources(); delete m_W3DShadowGeometryManager; - m_W3DShadowGeometryManager = NULL; + m_W3DShadowGeometryManager = nullptr; delete TheW3DBufferManager; - TheW3DBufferManager=NULL; + TheW3DBufferManager=nullptr; //all shadows should be freed up at this point but check anyway - assert(m_shadowList==NULL); + assert(m_shadowList==nullptr); } @@ -3729,8 +3729,8 @@ void W3DVolumetricShadowManager::ReleaseResources(void) shadowIndexBufferD3D->Release(); if (shadowVertexBufferD3D) shadowVertexBufferD3D->Release(); - shadowIndexBufferD3D=NULL; - shadowVertexBufferD3D=NULL; + shadowIndexBufferD3D=nullptr; + shadowVertexBufferD3D=nullptr; if (TheW3DBufferManager) { TheW3DBufferManager->ReleaseResources(); invalidateCachedLightPositions(); //vertex buffers need to be refilled. @@ -3756,7 +3756,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) ))) return FALSE; - if (shadowVertexBufferD3D == NULL) + if (shadowVertexBufferD3D == nullptr) { // Create vertex buffer if (FAILED(m_pDev->CreateVertexBuffer @@ -3791,7 +3791,7 @@ Bool W3DVolumetricShadowManager::init( void ) void W3DVolumetricShadowManager::reset( void ) { - assert (m_shadowList == NULL); + assert (m_shadowList == nullptr); m_W3DShadowGeometryManager->Free_All_Geoms(); TheW3DBufferManager->freeAllBuffers(); @@ -3804,33 +3804,33 @@ void W3DVolumetricShadowManager::reset( void ) W3DVolumetricShadow* W3DVolumetricShadowManager::addShadow(RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw) { if (!DX8Wrapper::Has_Stencil() || !robj || !TheGlobalData->m_useShadowVolumes) - return NULL; //right now we require a stencil buffer + return nullptr; //right now we require a stencil buffer - W3DShadowGeometry *sg=NULL; + W3DShadowGeometry *sg=nullptr; if (!robj) - return NULL; //must have a render object in order to read shadow geometry + return nullptr; //must have a render object in order to read shadow geometry const char *name=robj->Get_Name(); if (!name) - return NULL; + return nullptr; sg=m_W3DShadowGeometryManager->Get_Geom(name); - if (sg==NULL) + if (sg==nullptr) { //did not find a cached copy of the shadow geometry, create a new one m_W3DShadowGeometryManager->Load_Geom(robj,name); //try loading again sg=m_W3DShadowGeometryManager->Get_Geom(name); - if (sg==NULL) - return NULL; //could not create the shadow geometry + if (sg==nullptr) + return nullptr; //could not create the shadow geometry } W3DVolumetricShadow *shadow = NEW W3DVolumetricShadow; // poolify // sanity - if( shadow == NULL ) - return NULL; + if( shadow == nullptr ) + return nullptr; shadow->setRenderObject(robj); shadow->SetGeometry(sg); @@ -3861,8 +3861,8 @@ W3DVolumetricShadow* W3DVolumetricShadowManager::addShadow(RenderObjClass *robj, */ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) { - W3DVolumetricShadow *prev_shadow=NULL; - W3DVolumetricShadow *next_shadow=NULL; + W3DVolumetricShadow *prev_shadow=nullptr; + W3DVolumetricShadow *next_shadow=nullptr; //search for this shadow for( next_shadow = m_shadowList; next_shadow; prev_shadow=next_shadow, next_shadow = next_shadow->m_next ) @@ -3887,15 +3887,15 @@ void W3DVolumetricShadowManager::removeShadow(W3DVolumetricShadow *shadow) */ void W3DVolumetricShadowManager::removeAllShadows(void) { - W3DVolumetricShadow *cur_shadow=NULL; + W3DVolumetricShadow *cur_shadow=nullptr; W3DVolumetricShadow *next_shadow=m_shadowList; - m_shadowList = NULL; + m_shadowList = nullptr; //search for this shadow for( cur_shadow = next_shadow; cur_shadow; cur_shadow = next_shadow ) { next_shadow = cur_shadow->m_next; - cur_shadow->m_next = NULL; + cur_shadow->m_next = nullptr; delete cur_shadow; } } @@ -3912,10 +3912,10 @@ W3DShadowGeometryManager::~W3DShadowGeometryManager(void) Free_All_Geoms(); delete GeomPtrTable; - GeomPtrTable = NULL; + GeomPtrTable = nullptr; delete MissingGeomTable; - MissingGeomTable = NULL; + MissingGeomTable = nullptr; } /** Release all loaded animations */ @@ -3942,7 +3942,7 @@ W3DShadowGeometry * W3DShadowGeometryManager::Peek_Geom(const char * name) W3DShadowGeometry * W3DShadowGeometryManager::Get_Geom(const char * name) { W3DShadowGeometry * geom = Peek_Geom( name ); - if ( geom != NULL ) { + if ( geom != nullptr ) { geom->Add_Ref(); } return geom; @@ -3951,7 +3951,7 @@ W3DShadowGeometry * W3DShadowGeometryManager::Get_Geom(const char * name) /** Add animation to cache */ Bool W3DShadowGeometryManager::Add_Geom(W3DShadowGeometry *new_geom) { - WWASSERT (new_geom != NULL); + WWASSERT (new_geom != nullptr); // Increment the refcount on the new animation and add it to our table. new_geom->Add_Ref (); @@ -3980,7 +3980,7 @@ class MissingGeomClass : public HashableClass { ** Missing Geoms ** ** The idea here, allow the system to register which anims are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching the +** so that if they are asked for again, we can quickly return nullptr, without searching the ** disk again. */ void W3DShadowGeometryManager::Register_Missing( const char * name ) @@ -3990,7 +3990,7 @@ void W3DShadowGeometryManager::Register_Missing( const char * name ) Bool W3DShadowGeometryManager::Is_Missing( const char * name ) { - return ( MissingGeomTable->Find( name ) != NULL ); + return ( MissingGeomTable->Find( name ) != nullptr ); } /** Create shadow geometry from a reference W3D RenderObject*/ @@ -4000,7 +4000,7 @@ int W3DShadowGeometryManager::Load_Geom(RenderObjClass *robj, const char *name) W3DShadowGeometry * newgeom = NEW W3DShadowGeometry; - if (newgeom == NULL) { + if (newgeom == nullptr) { goto Error; } @@ -4025,7 +4025,7 @@ int W3DShadowGeometryManager::Load_Geom(RenderObjClass *robj, const char *name) newgeom->Release_Ref(); //DEBUG_LOG(("****Shadow Volume Creation Failed on %s",name)); goto Error; - } else if (Peek_Geom(newgeom->Get_Name()) != NULL) + } else if (Peek_Geom(newgeom->Get_Name()) != nullptr) { // duplicate exists! newgeom->Release_Ref(); // Release the one we just loaded goto Error; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index a27412e974f..80dd1ad076d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -128,7 +128,7 @@ W3DPrototypeClass::~W3DPrototypeClass(void) { if (Proto) { Proto->Release_Ref(); - Proto = NULL; + Proto = nullptr; } } @@ -206,7 +206,7 @@ TextureClass *W3DAssetManager::Get_Texture( GetPrecisionTimer(&endTime64); Total_Get_Texture_Time += endTime64-startTime64; #endif - return NULL; + return nullptr; } StringClass lower_case_name(filename,true); @@ -226,7 +226,7 @@ TextureClass *W3DAssetManager::Get_Texture( */ if (!tex) { - tex = NEW_REF(TextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression)); + tex = NEW_REF(TextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression)); TextureHash.Insert(tex->Get_Texture_Name(),tex); // if (TheGlobalData->m_preloadAssets) // { @@ -652,8 +652,8 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, { const char *name=texture->Get_Texture_Name(); - // if texture is procedural return NULL - if (name && name[0]=='!') return NULL; + // if texture is procedural return nullptr + if (name && name[0]=='!') return nullptr; // make sure texture is loaded if (!texture->Is_Initialized()) @@ -703,7 +703,7 @@ __int64 Total_Create_Render_Obj_Time=0; #endif //--------------------------------------------------------------------- /** Generals specific code to generate customized render objects for each team color - Scale==1.0, color==0x00000000, and oldTexure==NULL are defaults that do nothing. + Scale==1.0, color==0x00000000, and oldTexure== nullptr are defaults that do nothing. */ RenderObjClass * W3DAssetManager::Create_Render_Obj( const char * name, @@ -720,7 +720,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( Bool reallyscale = (WWMath::Fabs(scale - ident_scale) > scale_epsilon); Bool reallycolor = (color & 0xFFFFFF) != 0; //black is not a valid color and assumes no custom coloring. - Bool reallytexture = (oldTexture != NULL && newTexture != NULL); + Bool reallytexture = (oldTexture != nullptr && newTexture != nullptr); // base case, no scale or color if (!reallyscale && !reallycolor && !reallytexture) @@ -737,7 +737,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( Munge_Render_Obj_Name(newname, name, scale, color, newTexture); // see if we got a cached version - RenderObjClass *rendobj = NULL; + RenderObjClass *rendobj = nullptr; Set_WW3D_Load_On_Demand(false); // munged name will never be found in a file. rendobj = WW3DAssetManager::Create_Render_Obj(newname); @@ -764,12 +764,12 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( PrototypeClass * proto = Find_Prototype(name); Set_WW3D_Load_On_Demand(true); // Auto Load. - if (WW3D_Load_On_Demand && proto == NULL) + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand char filename [MAX_PATH]; const char *mesh_name = strchr (name, '.'); - if (mesh_name != NULL) + if (mesh_name != nullptr) { lstrcpyn(filename, name, ((int)mesh_name) - ((int)name) + 1); lstrcat(filename, ".w3d"); @@ -787,7 +787,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( proto = Find_Prototype(name); // try again } - if (proto == NULL) + if (proto == nullptr) { static int warning_count = 0; if (++warning_count <= 20) @@ -798,7 +798,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( GetPrecisionTimer(&endTime64); Total_Create_Render_Obj_Time += endTime64-startTime64; #endif - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } rendobj = proto->Create(); @@ -809,7 +809,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj( GetPrecisionTimer(&endTime64); Total_Create_Render_Obj_Time += endTime64-startTime64; #endif - return NULL; + return nullptr; } if (reallyscale) @@ -880,7 +880,7 @@ int W3DAssetManager::Recolor_Mesh(RenderObjClass *robj, const int color) MaterialInfoClass *material = mesh->Get_Material_Info(); // recolor vertex material (assuming mesh is housecolor) - if ( (( (meshName=strchr(mesh->Get_Name(),'.') ) != 0 && *(meshName++)) || ( (meshName=mesh->Get_Name()) != NULL)) && + if ( (( (meshName=strchr(mesh->Get_Name(),'.') ) != nullptr && *(meshName++)) || ( (meshName=mesh->Get_Name()) != nullptr)) && _strnicmp(meshName,"HOUSECOLOR", 10) == 0) { for (i=0; iVertex_Material_Count(); i++) Recolor_Vertex_Material(material->Peek_Vertex_Material(i),color); @@ -1101,7 +1101,7 @@ static Bool getMeshColorMethods(MeshClass *mesh, Bool &vertexColor, Bool &textur //Meshes which are part of another model have names in the form "name.name" while //isolated meshes are just "name". We check for both starting with "HOUSECOLOR". const char *meshName; - if ( ( (meshName=strchr(mesh->Get_Name(),'.') ) != 0 && *(meshName++)) || ( (meshName=mesh->Get_Name()) != NULL) ) + if ( ( (meshName=strchr(mesh->Get_Name(),'.') ) != nullptr && *(meshName++)) || ( (meshName=mesh->Get_Name()) != nullptr) ) { //Check if this object has housecolors on mesh if ( _strnicmp(meshName,"HOUSECOLOR", 10) == 0) vertexColor = true; @@ -1341,7 +1341,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal Munge_Render_Obj_Name(newname, name, scale, hsv_shift); // see if we got a cached version - RenderObjClass *rendobj=NULL; + RenderObjClass *rendobj=nullptr; if (isGranny) { //Granny objects share the same prototype since they allow instance scaling. @@ -1367,10 +1367,10 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal PrototypeClass * proto = Find_Prototype(name); Set_WW3D_Load_On_Demand(true); // Auto Load. - if (WW3D_Load_On_Demand && proto == NULL) { // If we didn't find one, try to load on demand + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand char filename [MAX_PATH]; char *mesh_name = ::strchr (name, '.'); - if (mesh_name != NULL) { + if (mesh_name != nullptr) { ::lstrcpyn (filename, name, ((int)mesh_name) - ((int)name) + 1); if (isGranny) ::lstrcat (filename, ".gr2"); @@ -1395,17 +1395,17 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scal proto = Find_Prototype(name); // try again } - if (proto == NULL) { + if (proto == nullptr) { static int warning_count = 0; if (++warning_count <= 20) { WWDEBUG_SAY(("WARNING: Failed to create Render Object: %s",name)); } - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } rendobj=proto->Create(); - if (!rendobj) return NULL; + if (!rendobj) return nullptr; if (!isGranny) { Make_Unique(rendobj,reallyscale,reallyhsv_shift); @@ -1441,8 +1441,8 @@ TextureClass * W3DAssetManager::Get_Texture_With_HSV_Shift(const char * filename // // Bail if the user isn't really asking for anything // - if ((filename == NULL) || (strlen(filename) == 0)) { - return NULL; + if ((filename == nullptr) || (strlen(filename) == 0)) { + return nullptr; } TextureClass *newtex = Find_Texture(filename, hsv_shift); @@ -1455,7 +1455,7 @@ TextureClass * W3DAssetManager::Get_Texture_With_HSV_Shift(const char * filename _strlwr(lower_case_name); TextureClass *oldtex = TextureHash.Get(lower_case_name); if (!oldtex) { - oldtex = NEW_REF(TextureClass,(lower_case_name, NULL, mip_level_count)); + oldtex = NEW_REF(TextureClass,(lower_case_name, nullptr, mip_level_count)); TextureHash.Insert(oldtex->Get_Texture_Name(), oldtex); } @@ -1524,8 +1524,8 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, { const char *name=texture->Get_Texture_Name(); - // if texture is procedural return NULL - if (name && name[0]=='!') return NULL; + // if texture is procedural return nullptr + if (name && name[0]=='!') return nullptr; // make sure texture is loaded if (!texture->Is_Initialized()) @@ -1536,12 +1536,12 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, texture->Get_Level_Description(desc); // if texture is monochrome and no value shifting - // return NULL + // return nullptr smallsurf=texture->Get_Surface_Level((TextureClass::MipCountType)texture->Get_Mip_Level_Count()-1); if (hsv_shift.Z==0.0f && smallsurf->Is_Monochrome()) { REF_PTR_RELEASE(smallsurf); - return NULL; + return nullptr; } REF_PTR_RELEASE(smallsurf); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp index f9951feac90..4b87cf9abdf 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBibBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DBibBuffer.h" #include @@ -220,9 +221,9 @@ for the bibs. */ W3DBibBuffer::W3DBibBuffer(void) { m_initialized = false; - m_vertexBib = NULL; - m_indexBib = NULL; - m_bibTexture = NULL; + m_vertexBib = nullptr; + m_indexBib = nullptr; + m_bibTexture = nullptr; m_curNumBibVertices=0; m_curNumBibIndices=0; clearAllBibs(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp index 655f5e484dd..7c77f698e97 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DBridgeBuffer.h" #include "W3DDevice/GameClient/W3DAssetManager.h" @@ -101,10 +102,10 @@ static ShaderClass detailShader(SC_ALPHA_MIRROR); /** Initializes pointers & values. */ //============================================================================= W3DBridge::W3DBridge() : -m_bridgeTexture(NULL), -m_leftMesh(NULL), -m_sectionMesh(NULL), -m_rightMesh(NULL), +m_bridgeTexture(nullptr), +m_leftMesh(nullptr), +m_sectionMesh(nullptr), +m_rightMesh(nullptr), m_visible(false), m_curDamageState(BODY_PRISTINE), m_scale(1.0) @@ -279,13 +280,13 @@ Bool W3DBridge::load(BodyDamageType curDamageState) m_scale = scale; - if (m_leftMesh == NULL) { + if (m_leftMesh == nullptr) { clearBridge(); return(false); } m_bridgeType = SECTIONAL_BRIDGE; - if (m_rightMesh == NULL || m_sectionMesh == NULL) { + if (m_rightMesh == nullptr || m_sectionMesh == nullptr) { m_bridgeType = FIXED_BRIDGE; } @@ -405,7 +406,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer const Matrix3D &mtx, MeshClass *pMesh, RefRenderObjListIterator *pLightsIterator) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Int i; @@ -462,7 +463,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer #else normal = (normal.X) * vec + normal.Y*vecNormal + normal.Z*vecZ; normal.Normalize(); - TheTerrainRenderObject->doTheLight(&vb, lightRay, &normal, NULL, 1.0f); + TheTerrainRenderObject->doTheLight(&vb, lightRay, &normal, nullptr, 1.0f); curVb->nx = 0; //will these to keep AGP write buffer happy. curVb->ny = 0; curVb->nz = 1; @@ -483,7 +484,7 @@ Int W3DBridge::getModelVertices(VertexFormatXYZNDUV1 *destination_vb, Int curVer Int W3DBridge::getModelVerticesFixed(VertexFormatXYZNDUV1 *destination_vb, Int curVertex, const Matrix3D &mtx, MeshClass *pMesh, RefRenderObjListIterator *pLightsIterator) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Vector3 vec = m_end - m_start; @@ -517,7 +518,7 @@ void W3DBridge::getIndicesNVertices(UnsignedShort *destination_ib, VertexFormatX m_firstIndex = *curIndexP; m_numVertex = 0; m_numPolygons = 0; - if (m_sectionMesh == NULL) { + if (m_sectionMesh == nullptr) { numV = getModelVerticesFixed(destination_vb, *curVertexP, m_leftMtx, m_leftMesh, pLightsIterator); if (!numV) { //not enough room for vertices @@ -635,7 +636,7 @@ void W3DBridge::getIndicesNVertices(UnsignedShort *destination_ib, VertexFormatX //============================================================================= Int W3DBridge::getModelIndices(UnsignedShort *destination_ib, Int curIndex, Int vertexOffset, MeshClass *pMesh) { - if (pMesh == NULL) + if (pMesh == nullptr) return(0); Int numPoly = pMesh->Peek_Model()->Get_Polygon_Count(); const TriIndex *pPoly =pMesh->Peek_Model()->Get_Polygon_Array(); @@ -733,10 +734,10 @@ for the bridges. */ W3DBridgeBuffer::W3DBridgeBuffer(void) { m_initialized = false; - m_vertexMaterial = NULL; - m_vertexBridge = NULL; - m_indexBridge = NULL; - m_bridgeTexture = NULL; + m_vertexMaterial = nullptr; + m_vertexBridge = nullptr; + m_indexBridge = nullptr; + m_bridgeTexture = nullptr; m_curNumBridgeVertices=0; m_curNumBridgeIndices=0; clearAllBridges(); @@ -817,13 +818,13 @@ void W3DBridgeBuffer::loadBridges(W3DTerrainLogic *pTerrainLogic, Bool saveGame) if ( !pMapObj2 || !pMapObj2->getFlag(FLAG_BRIDGE_POINT2)) { DEBUG_LOG(("Missing second bridge point. Ignoring first.")); } - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_BRIDGE_POINT2)) continue; Vector3 from, to; from.Set(pMapObj->getLocation()->x, pMapObj->getLocation()->y, 0); - from.Z = TheTerrainRenderObject->getHeightMapHeight(from.X, from.Y, NULL) + BRIDGE_FLOAT_AMT; + from.Z = TheTerrainRenderObject->getHeightMapHeight(from.X, from.Y, nullptr) + BRIDGE_FLOAT_AMT; to.Set(pMapObj2->getLocation()->x, pMapObj2->getLocation()->y, 0); - to.Z = TheTerrainRenderObject->getHeightMapHeight(to.X, to.Y, NULL) + BRIDGE_FLOAT_AMT; + to.Z = TheTerrainRenderObject->getHeightMapHeight(to.X, to.Y, nullptr) + BRIDGE_FLOAT_AMT; addBridge(from, to, pMapObj->getName(), pTerrainLogic, pMapObj->getProperties()); pMapObj = pMapObj2; } @@ -841,21 +842,21 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, BridgeTowerType type, BridgeInfo *bridgeInfo ) { - RenderObjClass* tower = NULL; + RenderObjClass* tower = nullptr; // sanity - if( scene == NULL || - assetManager == NULL || - mapObject == NULL || - bridgeInfo == NULL || + if( scene == nullptr || + assetManager == nullptr || + mapObject == nullptr || + bridgeInfo == nullptr || type < 0 || type >= BRIDGE_MAX_TOWERS ) - return NULL; + return nullptr; // get template for this bridge - DEBUG_ASSERTCRASH( TheTerrainRoads, ("createTower: TheTerrainRoads is NULL") ); + DEBUG_ASSERTCRASH( TheTerrainRoads, ("createTower: TheTerrainRoads is null") ); TerrainRoadType *bridgeTemplate = TheTerrainRoads->findBridge( mapObject->getName() ); - if( bridgeTemplate == NULL ) - return NULL; + if( bridgeTemplate == nullptr ) + return nullptr; // given the type of tower (corner position) find the appropriate spot to put the tower Coord3D towerPos; @@ -866,28 +867,28 @@ static RenderObjClass* createTower( SimpleSceneClass *scene, case BRIDGE_TOWER_FROM_RIGHT: towerPos = bridgeInfo->fromRight; break; case BRIDGE_TOWER_TO_LEFT: towerPos = bridgeInfo->toLeft; break; case BRIDGE_TOWER_TO_RIGHT: towerPos = bridgeInfo->toRight; break; - default: return NULL; + default: return nullptr; } // set the Z position to that of the terrain - towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, NULL); + towerPos.z = TheTerrainRenderObject->getHeightMapHeight( towerPos.x, towerPos.y, nullptr); // find the thing template for the tower we want to construct AsciiString towerTemplateName = bridgeTemplate->getTowerObjectName( type ); - DEBUG_ASSERTCRASH( TheThingFactory, ("createTower: TheThingFactory is NULL") ); + DEBUG_ASSERTCRASH( TheThingFactory, ("createTower: TheThingFactory is null") ); const ThingTemplate *towerTemplate = TheThingFactory->findTemplate( towerTemplateName ); - if( towerTemplate == NULL ) - return NULL; + if( towerTemplate == nullptr ) + return nullptr; // find the name of the render object to show const ModuleInfo& mi = towerTemplate->getDrawModuleInfo( ); if( mi.getCount() <= 0 ) - return NULL; + return nullptr; const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; - if( md == NULL ) - return NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; + if( md == nullptr ) + return nullptr; ModelConditionFlags state; state.clear(); AsciiString modelName = md->getBestModelNameForWB( state ); @@ -926,7 +927,7 @@ static void updateTowerPos( RenderObjClass* tower, { // sanity - if( tower == NULL || type < 0 || type >= BRIDGE_MAX_TOWERS || bridgeInfo == NULL ) + if( tower == nullptr || type < 0 || type >= BRIDGE_MAX_TOWERS || bridgeInfo == nullptr ) return; // @@ -990,7 +991,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana if( !pMapObj2 || !pMapObj2->getFlag( FLAG_BRIDGE_POINT2 ) ) DEBUG_LOG(("Missing second bridge point. Ignoring first.")); - if( pMapObj2 == NULL ) + if( pMapObj2 == nullptr ) break; if( !pMapObj2->getFlag( FLAG_BRIDGE_POINT2 ) ) continue; @@ -1028,7 +1029,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana // create render object if needed created = FALSE; towerRenderObj = pMapObj->getBridgeRenderObject( (BridgeTowerType)j ); - if( towerRenderObj == NULL ) + if( towerRenderObj == nullptr ) { towerRenderObj = createTower( scene, assetManager, pMapObj, (BridgeTowerType)j, &bridgeInfo ); @@ -1037,7 +1038,7 @@ void W3DBridgeBuffer::worldBuilderUpdateBridgeTowers( W3DAssetManager *assetMana } // sanity - DEBUG_ASSERTCRASH( towerRenderObj != NULL, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", + DEBUG_ASSERTCRASH( towerRenderObj != nullptr, ("worldBuilderUpdateBridgeTowers: unable to create tower for bridge '%s'", m_bridges[ i ].getTemplateName().str()) ); // update the position of the towers @@ -1137,7 +1138,7 @@ void W3DBridgeBuffer::drawBridges(CameraClass * camera, Bool wireframe, TextureC } } if (changed) { - loadBridgesInVertexAndIndexBuffers(NULL); + loadBridgesInVertexAndIndexBuffers(nullptr); } } else { // In wb, all are enabled. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp index c3596341168..5bd2ebaa3f8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DCustomEdging.h" #include @@ -285,8 +286,8 @@ for the trees. */ W3DCustomEdging::W3DCustomEdging(void) { m_initialized = false; - m_vertexEdging = NULL; - m_indexEdging = NULL; + m_vertexEdging = nullptr; + m_indexEdging = nullptr; clearAllEdging(); allocateEdgingBuffers(); m_initialized = true; @@ -370,7 +371,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); DX8Wrapper::Set_Texture(0,edgeTex); - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); // Draw the custom edge. DX8Wrapper::Apply_Render_State_Changes(); @@ -384,7 +385,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, false); //test pixels if transparent(clipped) before rendering. DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); #endif - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); if (cloudTexture) { DX8Wrapper::Set_Shader(detailOpaqueShader); DX8Wrapper::Apply_Render_State_Changes(); @@ -413,7 +414,7 @@ void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int m DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); } if (noiseTexture) { - DX8Wrapper::Set_Texture(1, NULL); + DX8Wrapper::Set_Texture(1, nullptr); DX8Wrapper::Set_Texture(0,noiseTexture); DX8Wrapper::Apply_Render_State_Changes(); DX8Wrapper::Set_Texture(1,edgeTex); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp index c3d82523377..014c34464e0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp @@ -101,7 +101,7 @@ //============================================================================ W3DDebugDisplay::W3DDebugDisplay() -: m_displayString(NULL) +: m_displayString(nullptr) { } @@ -133,7 +133,7 @@ void W3DDebugDisplay::init( void ) void W3DDebugDisplay::drawText( Int x, Int y, Char *text ) { - if ( m_font == NULL || m_displayString == NULL ) + if ( m_font == nullptr || m_displayString == nullptr ) { return ; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp index 27cdd3c0ea5..ed687588948 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp @@ -93,14 +93,14 @@ struct DebugIcon { Int endFrame; // Frame when this disappears. }; -DebugIcon *W3DDebugIcons::m_debugIcons = NULL; +DebugIcon *W3DDebugIcons::m_debugIcons = nullptr; Int W3DDebugIcons::m_numDebugIcons = 0; W3DDebugIcons::~W3DDebugIcons(void) { REF_PTR_RELEASE(m_vertexMaterialClass); delete m_debugIcons; - m_debugIcons = NULL; + m_debugIcons = nullptr; m_numDebugIcons = 0; } @@ -185,7 +185,7 @@ static Int maxIcons = 0; void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color) { - if (pos==NULL) { + if (pos==nullptr) { if (m_numDebugIcons > maxIcons) { DEBUG_LOG(("Max icons %d", m_numDebugIcons)); maxIcons = m_numDebugIcons; @@ -194,7 +194,7 @@ void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuratio return; } if (m_numDebugIcons>= MAX_ICONS) return; - if (m_debugIcons==NULL) return; + if (m_debugIcons==nullptr) return; m_debugIcons[m_numDebugIcons].position = *pos; m_debugIcons[m_numDebugIcons].width = width; m_debugIcons[m_numDebugIcons].color = color; @@ -216,7 +216,7 @@ void W3DDebugIcons::Render(RenderInfoClass & rinfo) DX8Wrapper::Apply_Render_State_Changes(); DX8Wrapper::Set_Material(m_vertexMaterialClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Apply_Render_State_Changes(); Matrix3D tm(Transform); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 6f3c9ba6eb3..2f60e418a96 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -114,7 +114,7 @@ static void drawFramerateBar(void); #define no_SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT -static W3DDynamicLight * theDynamicLight = NULL; +static W3DDynamicLight * theDynamicLight = nullptr; static Real theLightXOffset = 0.1f; static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; @@ -146,7 +146,7 @@ class StatDumpClass StatDumpClass::StatDumpClass( const char *fname ) { char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -313,7 +313,7 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) #if defined(RTS_DEBUG) if ( ! beBrief ) { - TheAudio->audioDebugDisplay( NULL, NULL, m_fp ); + TheAudio->audioDebugDisplay( nullptr, nullptr, m_fp ); fprintf( m_fp, "\n" ); } #endif @@ -354,10 +354,10 @@ StatDumpClass TheStatDump("StatisticsDump.txt"); /////////////////////////////////////////////////////////////////////////////// //============================================================================= -RTS3DScene *W3DDisplay::m_3DScene = NULL; -RTS2DScene *W3DDisplay::m_2DScene = NULL; -RTS3DInterfaceScene *W3DDisplay::m_3DInterfaceScene = NULL; -W3DAssetManager *W3DDisplay::m_assetManager = NULL; +RTS3DScene *W3DDisplay::m_3DScene = nullptr; +RTS2DScene *W3DDisplay::m_2DScene = nullptr; +RTS3DInterfaceScene *W3DDisplay::m_3DInterfaceScene = nullptr; +W3DAssetManager *W3DDisplay::m_assetManager = nullptr; //============================================================================= // note, can't use the ones from PerfTimer.h 'cuz they are currently @@ -384,17 +384,17 @@ W3DDisplay::W3DDisplay() Int i; m_initialized = false; - m_assetManager = NULL; - m_3DScene = NULL; - m_2DScene = NULL; - m_3DInterfaceScene = NULL; + m_assetManager = nullptr; + m_3DScene = nullptr; + m_2DScene = nullptr; + m_3DInterfaceScene = nullptr; m_averageFPS = TheGlobalData->m_framesPerSecondLimit; #if defined(RTS_DEBUG) m_timerAtCumuFPSStart = 0; #endif for (i=0; iReset(); delete m_2DRender; - m_2DRender = NULL; + m_2DRender = nullptr; } @@ -462,7 +462,7 @@ W3DDisplay::~W3DDisplay() if (!TheGlobalData->m_headless) DX8WebBrowser::Shutdown(); delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; } @@ -851,7 +851,7 @@ void W3DDisplay::reset( void ) // Remove all render objects. - if (m_3DScene != NULL) + if (m_3DScene != nullptr) { SceneIterator *sceneIter = m_3DScene->Create_Iterator(); sceneIter->First(); @@ -930,7 +930,7 @@ void W3DDisplay::gatherDebugStats( void ) static Int s_sortedPolysSinceLastUpdate = 0; // allocate the display strings if needed - if( m_displayStrings[0] == NULL ) + if( m_displayStrings[0] == nullptr ) { GameFont *font; if (TheGlobalLanguageData && TheGlobalLanguageData->m_nativeDebugDisplay.name.isNotEmpty()) @@ -945,7 +945,7 @@ void W3DDisplay::gatherDebugStats( void ) for (int i = 0; i < DisplayStringCount; i++) { - if (m_displayStrings[i] == NULL) + if (m_displayStrings[i] == nullptr) { m_displayStrings[i] = TheDisplayStringManager->newDisplayString(); DEBUG_ASSERTCRASH( m_displayStrings[i], ("Failed to create DisplayString") ); @@ -955,7 +955,7 @@ void W3DDisplay::gatherDebugStats( void ) } - if (m_benchmarkDisplayString == NULL) + if (m_benchmarkDisplayString == nullptr) { GameFont *thisFont = TheFontLibrary->getFont( "FixedSys", 8, FALSE ); m_benchmarkDisplayString = TheDisplayStringManager->newDisplayString(); @@ -973,10 +973,10 @@ void W3DDisplay::gatherDebugStats( void ) s_timeSinceLastUpdateInSecs = ((double)(time64 - s_lastUpdateTime64) / (double)(freq64)); #ifdef EXTENDED_STATS - static FILE *pListFile = NULL; + static FILE *pListFile = nullptr; static Int64 lastFrameTime=0; static samples = 0; - if (pListFile == NULL) { + if (pListFile == nullptr) { pListFile = fopen("FrameRateLog.txt", "w"); } samples++; @@ -1305,7 +1305,7 @@ void W3DDisplay::gatherDebugStats( void ) unibuffer.concat( L"RMB " ); } - Object *object = NULL; + Object *object = nullptr; #if defined(RTS_DEBUG) //debug hack to view object under mouse stats Drawable *draw = TheTacticalView->pickDrawable(&TheMousePos, FALSE, (PickType)0xffffffff ); #else @@ -1347,7 +1347,7 @@ void W3DDisplay::gatherDebugStats( void ) m_displayStrings[Objects]->setText( unibuffer ); // Network incoming bandwidth stats - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { unibuffer.format(L"IN: %.2f bytes/sec, %.2f packets/sec", TheNetwork->getIncomingBytesPerSecond(), TheNetwork->getIncomingPacketsPerSecond()); m_displayStrings[NetIncoming]->setText( unibuffer ); @@ -1545,7 +1545,7 @@ void W3DDisplay::drawCurrentDebugDisplay( void ) if ( m_debugDisplay && m_debugDisplayCallback ) { m_debugDisplay->reset(); - m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, NULL ); + m_debugDisplayCallback( m_debugDisplay, m_debugDisplayUserData, nullptr ); } } } @@ -2046,7 +2046,7 @@ void W3DDisplay::createLightPulse( const Coord3D *pos, const RGBColor *color, UnsignedInt decayFrameTime//, Bool donut ) { - if (m_3DScene == NULL) + if (m_3DScene == nullptr) return; if (innerRadius+attenuationWidth<2.0*PATHFIND_CELL_SIZE_F + 1.0f) { return; // it basically won't make any visual difference. jba. @@ -2595,7 +2595,7 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, { // sanity - if( image == NULL ) + if( image == nullptr ) return; // !! @@ -2800,7 +2800,7 @@ VideoBuffer* W3DDisplay::createVideoBuffer( void ) else { // card does not support any of the formats we need - return NULL; + return nullptr; } } // on low mem machines, render every video in 16bit except for the EA Logo movie @@ -2935,7 +2935,7 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) PBITMAPINFO pbmi; pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)); - if (pbmi == NULL) + if (pbmi == nullptr) return; pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2954,10 +2954,10 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) hf = CreateFile(pszFile, GENERIC_READ | GENERIC_WRITE, (DWORD) 0, - NULL, + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - (HANDLE) NULL); + (HANDLE) nullptr); if (hf != INVALID_HANDLE_VALUE) { @@ -2976,15 +2976,15 @@ static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height) // Copy the BITMAPFILEHEADER into the .BMP file. if (WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), - (LPDWORD) &dwTmp, NULL)) + (LPDWORD) &dwTmp, nullptr)) { // Copy the BITMAPINFOHEADER and RGBQUAD array into the file. - if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, NULL)) + if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, nullptr)) { // Copy the array of color indices into the .BMP file. dwTotal = cb = pbih->biSizeImage; hp = lpBits; - WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, NULL); + WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, nullptr); } } @@ -3026,10 +3026,10 @@ void W3DDisplay::takeScreenShot(void) surface->Get_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -3038,7 +3038,7 @@ void W3DDisplay::takeScreenShot(void) } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -3069,7 +3069,7 @@ void W3DDisplay::takeScreenShot(void) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Targa targ; memset(&targ.Header,0,sizeof(targ.Header)); @@ -3100,7 +3100,7 @@ void W3DDisplay::takeScreenShot(void) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; //Flip the image char *ptr,*ptr1; @@ -3143,7 +3143,7 @@ void W3DDisplay::toggleMovieCapture(void) #if defined(RTS_DEBUG) -static FILE *AssetDumpFile=NULL; +static FILE *AssetDumpFile=nullptr; void dumpMeshAssets(MeshClass *mesh) { @@ -3160,7 +3160,7 @@ void dumpMeshAssets(MeshClass *mesh) { for (int i=0;iGet_Polygon_Count();++i) { - if ((texture=model->Peek_Texture(i,pass,stage)) != NULL) + if ((texture=model->Peek_Texture(i,pass,stage)) != nullptr) { fprintf(AssetDumpFile,"\t%s\n",texture->Get_Texture_Name().str()); } @@ -3168,7 +3168,7 @@ void dumpMeshAssets(MeshClass *mesh) } else { - if ((texture=model->Peek_Single_Texture(pass,stage)) != NULL) + if ((texture=model->Peek_Single_Texture(pass,stage)) != nullptr) { fprintf(AssetDumpFile,"\t%s\n",texture->Get_Texture_Name().str()); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 1636c46f247..88e7bb3cb80 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -173,7 +173,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr m_textRenderer.Build_Sentence( getText().str(), &m_hotKeyPos.x, &m_hotKeyPos.y ); m_hotkey.translate(TheHotKeyManager->searchHotKey(getText())); if(!m_hotkey.isEmpty()) - m_textRendererHotKey.Build_Sentence(m_hotkey.str(), NULL, NULL); + m_textRendererHotKey.Build_Sentence(m_hotkey.str(), nullptr, nullptr); else { m_useHotKey = FALSE; @@ -181,7 +181,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr } } else - m_textRenderer.Build_Sentence( getText().str(), NULL, NULL ); + m_textRenderer.Build_Sentence( getText().str(), nullptr, nullptr ); m_fontChanged = FALSE; m_textChanged = FALSE; needNewPolys = TRUE; @@ -287,7 +287,7 @@ void W3DDisplayString::setFont( GameFont *font ) { // sanity - if( font == NULL ) + if( font == nullptr ) return; // if the new font is the same as our existing font do nothing @@ -349,7 +349,7 @@ void W3DDisplayString::computeExtents( void ) UnsignedInt len = getTextLength(); // if we have no string, or no font we don't have a size yet - if( len == 0 || m_font == NULL ) + if( len == 0 || m_font == nullptr ) { m_size.x = 0; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index fe6294679b2..40a70da88dc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -46,10 +46,10 @@ W3DDisplayStringManager::W3DDisplayStringManager( void ) { for (Int i = 0; i < MAX_GROUPS; ++i) { - m_groupNumeralStrings[i] = NULL; + m_groupNumeralStrings[i] = nullptr; } - m_formationLetterDisplayString = NULL; + m_formationLetterDisplayString = nullptr; } @@ -60,12 +60,12 @@ W3DDisplayStringManager::~W3DDisplayStringManager( void ) { if (m_groupNumeralStrings[i]) freeDisplayString(m_groupNumeralStrings[i]); - m_groupNumeralStrings[i] = NULL; + m_groupNumeralStrings[i] = nullptr; } if (m_formationLetterDisplayString) freeDisplayString( m_formationLetterDisplayString ); - m_formationLetterDisplayString = NULL; + m_formationLetterDisplayString = nullptr; } @@ -113,12 +113,12 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) DisplayString *newString = newInstance(W3DDisplayString); // sanity - if( newString == NULL ) + if( newString == nullptr ) { DEBUG_LOG(( "newDisplayString: Could not allcoate new W3D display string" )); assert( 0 ); - return NULL; + return nullptr; } @@ -148,7 +148,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) { // sanity - if( string == NULL ) + if( string == nullptr ) return; // unlink @@ -156,7 +156,7 @@ void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) // if the string happens to fall where our current checkpoint was, set the checkpoint to null if ( m_currentCheckpoint == string) { - m_currentCheckpoint = NULL; + m_currentCheckpoint = nullptr; } // free data diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp index 054cc27966c..ad713be2285 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp @@ -73,7 +73,7 @@ typedef enum GameFileClass::GameFileClass( char const *filename ) { - m_theFile = NULL; + m_theFile = nullptr; m_fileExists = FALSE; m_filePath[0] = 0; m_filename[0] = 0; @@ -89,7 +89,7 @@ GameFileClass::GameFileClass( void ) { m_fileExists = FALSE; - m_theFile = NULL; + m_theFile = nullptr; m_filePath[ 0 ] = 0; m_filename[ 0 ] = 0; @@ -334,7 +334,7 @@ bool GameFileClass::Is_Available( int forced ) //------------------------------------------------------------------------------------------------- bool GameFileClass::Is_Open(void) const { - return m_theFile != NULL; + return m_theFile != nullptr; } //------------------------------------------------------------------------------------------------- @@ -361,7 +361,7 @@ int GameFileClass::Open(int rights) m_theFile = TheFileSystem->openFile( m_filePath, File::READ | File::BINARY ); - return (m_theFile != NULL); + return (m_theFile != nullptr); } //------------------------------------------------------------------------------------------------- @@ -421,7 +421,7 @@ void GameFileClass::Close(void) { if (m_theFile) { m_theFile->close(); - m_theFile = NULL; + m_theFile = nullptr; } } @@ -429,7 +429,7 @@ void GameFileClass::Close(void) /////////////////////////////////////////////////////////////////////////////////////////////////// // W3DFileSystem Class //////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// -extern W3DFileSystem *TheW3DFileSystem = NULL; +extern W3DFileSystem *TheW3DFileSystem = nullptr; //------------------------------------------------------------------------------------------------- /** Constructor. Creating an instance of this class overrides the default @@ -450,7 +450,7 @@ after W3D is shutdown. */ //------------------------------------------------------------------------------------------------- W3DFileSystem::~W3DFileSystem(void) { - _TheFileFactory = NULL; // remove the w3d file factory. + _TheFileFactory = nullptr; // remove the w3d file factory. } //------------------------------------------------------------------------------------------------- @@ -474,7 +474,7 @@ void W3DFileSystem::Return_File( FileClass *file ) void W3DFileSystem::reprioritizeTexturesBySize() { ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH); - if (dirInfo != NULL) + if (dirInfo != nullptr) { reprioritizeTexturesBySize(*dirInfo); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index 4f5dbd6dd62..d2f394e1589 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -117,11 +117,11 @@ void W3DGameClient::reset( void ) Drawable *W3DGameClient::friend_createDrawable( const ThingTemplate *tmplate, DrawableStatusBits statusBits ) { - Drawable *draw = NULL; + Drawable *draw = nullptr; // sanity - if( tmplate == NULL ) - return NULL; + if( tmplate == nullptr ) + return nullptr; draw = newInstance(Drawable)( tmplate, statusBits ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index 0c72dbf244a..f482b3ebb48 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -108,9 +108,9 @@ DebugHintObject::~DebugHintObject(void) } DebugHintObject::DebugHintObject(void) : - m_indexBuffer(NULL), - m_vertexMaterialClass(NULL), - m_vertexBufferTile(NULL), + m_indexBuffer(nullptr), + m_vertexMaterialClass(nullptr), + m_vertexBufferTile(nullptr), m_myColor(0), m_mySize(0) { @@ -200,7 +200,7 @@ void DebugHintObject::setLocAndColorAndSize(const Coord3D *loc, Int argb, Int si if (m_myLoc.z < 0 && TheTerrainRenderObject) { - m_myLoc.z = TheTerrainRenderObject->getHeightMapHeight(m_myLoc.x, m_myLoc.y, NULL); + m_myLoc.z = TheTerrainRenderObject->getHeightMapHeight(m_myLoc.x, m_myLoc.y, nullptr); } if (m_vertexBufferTile) @@ -242,7 +242,7 @@ void DebugHintObject::Render(RenderInfoClass & rinfo) { DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile); @@ -270,13 +270,13 @@ W3DInGameUI::W3DInGameUI() for( i = 0; i < MAX_MOVE_HINTS; i++ ) { - m_moveHintRenderObj[ i ] = NULL; - m_moveHintAnim[ i ] = NULL; + m_moveHintRenderObj[ i ] = nullptr; + m_moveHintAnim[ i ] = nullptr; } - m_buildingPlacementAnchor = NULL; - m_buildingPlacementArrow = NULL; + m_buildingPlacementAnchor = nullptr; + m_buildingPlacementArrow = nullptr; } @@ -313,13 +313,13 @@ static void loadText( char *filename, GameWindow *listboxText ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return; char buffer[ 1024 ]; UnicodeString line; Color color = GameMakeColor(255, 255, 255, 255); - while( fgets( buffer, 1024, fp ) != NULL ) + while( fgets( buffer, 1024, fp ) != nullptr ) { line.translate(buffer); line.trim(); @@ -482,7 +482,7 @@ void W3DInGameUI::drawMoveHints( View *view ) // continue; // create render object and add to scene of needed - if( m_moveHintRenderObj[ i ] == NULL ) + if( m_moveHintRenderObj[ i ] == nullptr ) { RenderObjClass *hint; HAnimClass *anim; @@ -495,7 +495,7 @@ void W3DInGameUI::drawMoveHints( View *view ) anim = W3DDisplay::m_assetManager->Get_HAnim(animName.str()); // sanity - if( hint == NULL ) + if( hint == nullptr ) { DEBUG_CRASH(("unable to create hint")); @@ -621,8 +621,8 @@ void W3DInGameUI::drawPlaceAngle( View *view ) } } - Bool anchorInScene = m_buildingPlacementAnchor->Peek_Scene() != NULL; - Bool arrowInScene = m_buildingPlacementArrow->Peek_Scene() != NULL; + Bool anchorInScene = m_buildingPlacementAnchor->Peek_Scene() != nullptr; + Bool arrowInScene = m_buildingPlacementArrow->Peek_Scene() != nullptr; // get out of here if this display isn't up anyway if( isPlacementAnchored() == FALSE ) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index b9c75e78378..9ece5013c32 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -88,9 +88,9 @@ W3DMouse::W3DMouse( void ) for (Int i=0; iGet_Texture(FrameName)) != NULL) + if ((cursorTextures[cursor][i]=am->Get_Texture(FrameName)) != nullptr) { m_currentD3DSurface[m_currentFrames]=cursorTextures[cursor][i]->Get_Surface_Level(); m_currentFrames++; } @@ -223,18 +223,18 @@ void W3DMouse::initD3DAssets(void) WW3DAssetManager *am=WW3DAssetManager::Get_Instance(); //Check if texture assets already loaded - if (m_currentRedrawMode == RM_DX8 && cursorTextures[1] == NULL && am) + if (m_currentRedrawMode == RM_DX8 && cursorTextures[1] == nullptr && am) { for (Int i=0; iGet_Texture(m_cursorInfo[i].textureName.str()); + cursorTextures[i][j]=nullptr;//am->Get_Texture(m_cursorInfo[i].textureName.str()); } } for (Int x = 0; x < MAX_2D_CURSOR_ANIM_FRAMES; x++) - m_currentD3DSurface[x]=NULL; + m_currentD3DSurface[x]=nullptr; } } @@ -264,7 +264,7 @@ void W3DMouse::initW3DAssets(void) return; //Check if model assets already loaded - if ((cursorModels[1] == NULL && W3DDisplay::m_assetManager)) + if ((cursorModels[1] == nullptr && W3DDisplay::m_assetManager)) { for (Int i=1; iGet_HAnim(m_cursorInfo[i].W3DAnimName.str()); if (cursorAnims[i] && cursorModels[i]) { @@ -387,12 +387,12 @@ void W3DMouse::setCursor( MouseCursor cursor ) //make sure Windows didn't reset our cursor if (m_currentRedrawMode == RM_DX8) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); Bool doImageChange=FALSE; - if (m_pDev != NULL) + if (m_pDev != nullptr) { m_pDev->ShowCursor(FALSE); //disable DX8 cursor if (cursor != m_currentD3DCursor) @@ -423,7 +423,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) } else if (m_currentRedrawMode == RM_POLYGON) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor m_currentD3DCursor=NONE; m_currentW3DCursor=NONE; m_currentPolygonCursor = cursor; @@ -431,7 +431,7 @@ void W3DMouse::setCursor( MouseCursor cursor ) } else if (m_currentRedrawMode == RM_W3D) { - SetCursor(NULL); //Kill Windows Cursor + SetCursor(nullptr); //Kill Windows Cursor m_currentD3DCursor=NONE; m_currentPolygonCursor=NONE; if (cursor != m_currentW3DCursor) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index 8920c2338d0..7f311c1aa39 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -46,18 +46,18 @@ W3DParticleSystemManager::W3DParticleSystemManager() { - m_pointGroup = NULL; - m_streakLine = NULL; - m_posBuffer = NULL; - m_RGBABuffer = NULL; - m_sizeBuffer = NULL; - m_angleBuffer = NULL; + m_pointGroup = nullptr; + m_streakLine = nullptr; + m_posBuffer = nullptr; + m_RGBABuffer = nullptr; + m_sizeBuffer = nullptr; + m_angleBuffer = nullptr; m_readyToRender = false; m_onScreenParticleCount = 0; m_pointGroup = NEW PointGroupClass(); - //m_streakLine = NULL; + //m_streakLine = nullptr; m_streakLine = NEW StreakLineClass(); m_posBuffer = NEW_REF( ShareBufferClass, (MAX_POINTS_PER_GROUP, "W3DParticleSystemManager::m_posBuffer") ); @@ -141,7 +141,7 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) m_fieldParticleCount = 0; - SmudgeSet *set=NULL; + SmudgeSet *set=nullptr; if (TheSmudgeManager) set=TheSmudgeManager->addSmudgeSet(); //global smudge set through which all smudges are rendered. @@ -322,7 +322,7 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) /// @todo Use both QUADS and TRIS for particles m_pointGroup->Set_Point_Mode( PointGroupClass::QUADS ); - m_pointGroup->Set_Arrays( m_posBuffer, m_RGBABuffer, NULL, m_sizeBuffer, m_angleBuffer, NULL, count ); + m_pointGroup->Set_Arrays( m_posBuffer, m_RGBABuffer, nullptr, m_sizeBuffer, m_angleBuffer, nullptr, count ); m_pointGroup->Set_Billboard(sys->shouldBillboard()); /// @todo Support animated texture particles diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp index 3e3ef84d7f4..3a51b258610 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp @@ -45,6 +45,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DRoadBuffer.h" #include @@ -130,9 +131,9 @@ static Bool s_dynamic = false; /** Nulls index & vertex data. */ //============================================================================= RoadType::RoadType(void): -m_roadTexture(NULL), -m_vertexRoad(NULL), -m_indexRoad(NULL), +m_roadTexture(nullptr), +m_vertexRoad(nullptr), +m_indexRoad(nullptr), m_stackingOrder(0), m_uniqueID(-1) { @@ -225,9 +226,9 @@ m_widthInTexture(1.0f), m_uniqueID(0), m_visible(false), m_numVertex(0), -m_vb(NULL), +m_vb(nullptr), m_numIndex(0), -m_ib(NULL), +m_ib(nullptr), m_bounds(Vector3(0.0f, 0.0f, 0.0f), 1.0f) { } @@ -241,11 +242,11 @@ RoadSegment::~RoadSegment(void) { m_numVertex = 0; delete[] m_vb; - m_vb = NULL; + m_vb = nullptr; m_numIndex = 0; delete[] m_ib; - m_ib = NULL; + m_ib = nullptr; } @@ -258,7 +259,7 @@ RoadSegment::~RoadSegment(void) void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) { delete[] m_vb; - m_vb = NULL; + m_vb = nullptr; m_numVertex = 0; Vector3 verts[MAX_SEG_VERTEX]; @@ -289,7 +290,7 @@ void RoadSegment::SetVertexBuffer(VertexFormatXYZDUV1 *vb, Int numVertex) void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) { delete[] m_ib; - m_ib = NULL; + m_ib = nullptr; m_numIndex = 0; if (numIndex < 1 || numIndex > MAX_SEG_INDEX) @@ -310,7 +311,7 @@ void RoadSegment::SetIndexBuffer(UnsignedShort *ib, Int numIndex) //============================================================================= Int RoadSegment::GetVertices(VertexFormatXYZDUV1 *destination_vb, Int numToCopy) { - if (m_vb == NULL || numToCopy<1) return (0); + if (m_vb == nullptr || numToCopy<1) return (0); if (numToCopy > m_numVertex) return(0); memcpy(destination_vb, m_vb, numToCopy*sizeof(VertexFormatXYZDUV1)); return(numToCopy); @@ -323,7 +324,7 @@ Int RoadSegment::GetVertices(VertexFormatXYZDUV1 *destination_vb, Int numToCopy) //============================================================================= Int RoadSegment::GetIndices(UnsignedShort *destination_ib, Int numToCopy, Int offset) { - if (m_ib == NULL || numToCopy<1) return (0); + if (m_ib == nullptr || numToCopy<1) return (0); if (numToCopy > m_numIndex) return(0); Int i; for (i=0; im_roadTypes[m_curRoadType].setNumVertices(0); this->m_roadTypes[m_curRoadType].setNumIndices(0); return; @@ -1602,7 +1603,7 @@ void W3DRoadBuffer::addMapObjects() #ifdef RTS_DEBUG DEBUG_ASSERTLOG(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("Bad Flag")); #endif - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; Vector2 loc1, loc2; loc1.Set(pMapObj->getLocation()->x, pMapObj->getLocation()->y); @@ -1772,15 +1773,15 @@ void W3DRoadBuffer::insertTee(Vector2 loc, Int index1, Real scale) // pr1-3 point to the points on the segments that form the tee. // They are the points on the segments that are != loc. - TRoadPt *pr1=NULL; - TRoadPt *pr2=NULL; - TRoadPt *pr3=NULL; + TRoadPt *pr1=nullptr; + TRoadPt *pr2=nullptr; + TRoadPt *pr3=nullptr; // pc1-3 point to the center points of the segments. These are the // points that are at loc. - TRoadPt *pc1=NULL; - TRoadPt *pc2=NULL; - TRoadPt *pc3=NULL; + TRoadPt *pc1=nullptr; + TRoadPt *pc2=nullptr; + TRoadPt *pc3=nullptr; if (m_roads[index1].m_pt1.loc == loc) { pr1 = &m_roads[index1].m_pt2; @@ -1795,7 +1796,7 @@ void W3DRoadBuffer::insertTee(Vector2 loc, Int index1, Real scale) for (i = index1+1; im_curNumRoadIndices == 0) continue; if (wireframe) { - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); } else { m_roadTypes[i].applyTexture(); if (cloudTexture) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 66a19d43b98..2cb1c0bfd7d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -96,7 +96,7 @@ RTS3DScene::RTS3DScene() Int i=0; for (; im_shroudOn) m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,()); else - m_shroudMaterialPass = NULL; + m_shroudMaterialPass = nullptr; #else m_shroudMaterialPass = NEW_REF(W3DShroudMaterialPassClass,()); #endif @@ -153,7 +153,7 @@ RTS3DScene::RTS3DScene() if (TheGlobalData->m_maxVisibleTranslucentObjects > 0) m_translucentObjectsBuffer = NEW RenderObjClass* [TheGlobalData->m_maxVisibleTranslucentObjects]; else - m_translucentObjectsBuffer = NULL; + m_translucentObjectsBuffer = nullptr; m_numPotentialOccluders=0; m_numPotentialOccludees=0; @@ -163,17 +163,17 @@ RTS3DScene::RTS3DScene() if (TheGlobalData->m_maxVisibleOccluderObjects > 0) m_potentialOccluders = NEW RenderObjClass* [TheGlobalData->m_maxVisibleOccluderObjects]; else - m_potentialOccluders = NULL; + m_potentialOccluders = nullptr; if (TheGlobalData->m_maxVisibleOccludeeObjects > 0) m_potentialOccludees = NEW RenderObjClass* [TheGlobalData->m_maxVisibleOccludeeObjects]; else - m_potentialOccludees = NULL; + m_potentialOccludees = nullptr; if (TheGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects > 0) m_nonOccludersOrOccludees = NEW RenderObjClass* [TheGlobalData->m_maxVisibleNonOccluderOrOccludeeObjects]; else - m_nonOccludersOrOccludees = NULL; + m_nonOccludersOrOccludees = nullptr; //Modify the shader to make occlusion transparent ShaderClass shader = PlayerColorShader; @@ -194,7 +194,7 @@ RTS3DScene::RTS3DScene() } #else for (i=0; iGet_User_Data(); if (drawInfo) draw=drawInfo->m_drawable; @@ -469,7 +469,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) { //need to keep track of occluders and occludees for subsequent code. drawInfo = (DrawableInfo *)robj->Get_User_Data(); - if (drawInfo && (draw=drawInfo->m_drawable) != NULL) + if (drawInfo && (draw=drawInfo->m_drawable) != nullptr) { if (draw->isDrawableEffectivelyHidden() || draw->getFullyObscuredByShroud()) { @@ -558,7 +558,7 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable it.Next(); //advance to next object in case this one gets deleted during renderOneObject(). DrawableInfo *drawInfo = (DrawableInfo *)robj->Get_User_Data(); - Drawable *draw=NULL; + Drawable *draw=nullptr; if (drawInfo) draw = drawInfo->m_drawable; if (!draw) continue; @@ -582,10 +582,10 @@ void RTS3DScene::renderSpecificDrawables(RenderInfoClass &rinfo, Int numDrawable //============================================================================= void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, Int localPlayerIndex) { - Drawable *draw = NULL; - DrawableInfo *drawInfo = NULL; + Drawable *draw = nullptr; + DrawableInfo *drawInfo = nullptr; Bool drawableHidden=FALSE; - Object* obj = NULL; + Object* obj = nullptr; ObjectShroudStatus ss=OBJECTSHROUD_INVALID; Bool doExtraMaterialPop=FALSE; Bool doExtraFlagsPop=FALSE; @@ -667,8 +667,8 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I // HANDLE THE SPECIAL DRAWABLE-LEVEL COLORING SETTINGS FIRST - const Vector3 *tintColor = NULL; - const Vector3 *selectionColor = NULL; + const Vector3 *tintColor = nullptr; + const Vector3 *selectionColor = nullptr; tintColor = draw->getTintColor(); selectionColor = draw->getSelectionColor(); @@ -752,7 +752,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I //lighting environment applied which emulates the look of fog. rinfo.light_environment = &m_foggedLightEnv; robj->Render(rinfo); - rinfo.light_environment = NULL; + rinfo.light_environment = nullptr; return; } else @@ -833,7 +833,7 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I } } - rinfo.light_environment = NULL; + rinfo.light_environment = nullptr; if (doExtraMaterialPop) //check if there is an extra material on the stack from the added material effect. rinfo.Pop_Material_Pass(); if (doExtraFlagsPop) @@ -1106,7 +1106,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) StDrawableDirtyStuffLocker lockDirtyStuff; #endif - RenderObjClass *terrainObject=NULL,*robj; + RenderObjClass *terrainObject=nullptr,*robj; m_translucentObjectsCount = 0; //start of new frame so no translucent objects m_occludedObjectsCount = 0; @@ -1142,7 +1142,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) if (terrainObject) // Don't check visibility - terrain is always visible. jba. { robj=terrainObject; - rinfo.light_environment = NULL; // Terrain is self lit. + rinfo.light_environment = nullptr; // Terrain is self lit. rinfo.Camera.Set_User_Data(this); //pass the scene to terrain via user data. if (m_customPassMode == SCENE_PASS_DEFAULT && m_shroudMaterialPass) { @@ -1181,7 +1181,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) if (robj->Is_Really_Visible()) { DrawableInfo *drawInfo = (DrawableInfo *)robj->Get_User_Data(); - Drawable *draw=NULL; + Drawable *draw=nullptr; if (drawInfo) draw = drawInfo->m_drawable; #ifdef USE_NON_STENCIL_OCCLUSION @@ -1202,7 +1202,7 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo ) } // only render particles once per frame - if (terrainObject != NULL && TheParticleSystemManager != NULL && + if (terrainObject != nullptr && TheParticleSystemManager != nullptr && Get_Extra_Pass_Polygon_Mode() == EXTRA_PASS_DISABLE) { TheParticleSystemManager->queueParticleRender(); @@ -1745,7 +1745,7 @@ void RTS3DScene::doRender( CameraClass * cam ) { m_camera = cam; DRAW(); - m_camera = NULL; + m_camera = nullptr; } @@ -1756,7 +1756,7 @@ void RTS3DScene::doRender( CameraClass * cam ) //============================================================================= void RTS3DScene::draw( ) { - if (m_camera == NULL) { + if (m_camera == nullptr) { DEBUG_CRASH(("Null m_camera in RTS3DScene::draw")); return; } @@ -1811,7 +1811,7 @@ void RTS2DScene::doRender( CameraClass * cam ) { m_camera = cam; DRAW(); - m_camera = NULL; + m_camera = nullptr; } //============================================================================= @@ -1821,7 +1821,7 @@ void RTS2DScene::doRender( CameraClass * cam ) //============================================================================= void RTS2DScene::draw( ) { - if (m_camera == NULL) { + if (m_camera == nullptr) { DEBUG_CRASH(("Null m_camera in RTS2DScene::draw")); return; } @@ -1876,8 +1876,8 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) #endif RefRenderObjListIterator it(&RenderList); - DrawableInfo *drawInfo = NULL; - Drawable *draw = NULL; + DrawableInfo *drawInfo = nullptr; + Drawable *draw = nullptr; RenderObjClass * robj; m_numPotentialOccluders=0; @@ -1901,7 +1901,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) robj = it.Peek_Obj(); - draw=NULL; + draw=nullptr; drawInfo = (DrawableInfo *)robj->Get_User_Data(); if (drawInfo) draw=drawInfo->m_drawable; @@ -1951,7 +1951,7 @@ void RTS3DScene::Visibility_Check(CameraClass * camera) { //need to keep track of occluders and ocludees for subsequent code. drawInfo = (DrawableInfo *)robj->Get_User_Data(); - if (drawInfo && (draw=drawInfo->m_drawable) != NULL) + if (drawInfo && (draw=drawInfo->m_drawable) != nullptr) { // now handled above in the cheater foil <<<<<<<<<<<< diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp index 1c120148b73..0c991ffdc9c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp @@ -70,12 +70,12 @@ //----------------------------------------------------------------------------- W3DShroud::W3DShroud(void) { - m_finalFogData=NULL; - m_currentFogData=NULL; - m_pSrcTexture=NULL; - m_pDstTexture=NULL; - m_srcTextureData=NULL; - m_srcTexturePitch=NULL; + m_finalFogData=nullptr; + m_currentFogData=nullptr; + m_pSrcTexture=nullptr; + m_pDstTexture=nullptr; + m_srcTextureData=nullptr; + m_srcTexturePitch=0; m_dstTextureWidth=m_numMaxVisibleCellsX=0; m_dstTextureHeight=m_numMaxVisibleCellsY=0; m_boderShroudLevel = (W3DShroudLevel)TheGlobalData->m_shroudAlpha; //assume border is black @@ -109,8 +109,8 @@ W3DShroud::~W3DShroud(void) */ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSizeY) { - DEBUG_ASSERTCRASH( m_pSrcTexture == NULL, ("ReAcquire of existing shroud textures")); - DEBUG_ASSERTCRASH( pMap != NULL, ("Shroud init with NULL WorldHeightMap")); + DEBUG_ASSERTCRASH( m_pSrcTexture == nullptr, ("ReAcquire of existing shroud textures")); + DEBUG_ASSERTCRASH( pMap != nullptr, ("Shroud init with null WorldHeightMap")); Int dstTextureWidth=0; Int dstTextureHeight=0; @@ -162,12 +162,12 @@ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSi #endif m_pSrcTexture = DX8Wrapper::_Create_DX8_Surface(srcWidth,srcHeight, WW3D_FORMAT_R5G6B5); - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Failed to Allocate Shroud Src Surface")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Failed to Allocate Shroud Src Surface")); D3DLOCKED_RECT rect; //Get a pointer to source surface pixels. - HRESULT res = m_pSrcTexture->LockRect(&rect,NULL,D3DLOCK_NO_DIRTY_UPDATE); + HRESULT res = m_pSrcTexture->LockRect(&rect,nullptr,D3DLOCK_NO_DIRTY_UPDATE); m_pSrcTexture->UnlockRect(); DEBUG_ASSERTCRASH( res == D3D_OK, ("Failed to lock shroud src surface")); @@ -206,14 +206,14 @@ void W3DShroud::reset() if (m_pSrcTexture) { m_pSrcTexture->Release(); - m_pSrcTexture=NULL; + m_pSrcTexture=nullptr; } delete [] m_finalFogData; - m_finalFogData=NULL; + m_finalFogData=nullptr; delete [] m_currentFogData; - m_currentFogData=NULL; + m_currentFogData=nullptr; m_clearDstTexture = TRUE; //always refill the destination texture after a reset } @@ -232,7 +232,7 @@ Bool W3DShroud::ReAcquireResources(void) if (!m_dstTextureWidth) return TRUE; //nothing to reaquire since shroud was never initialized with valid data - DEBUG_ASSERTCRASH( m_pDstTexture == NULL, ("ReAcquire of existing shroud texture")); + DEBUG_ASSERTCRASH( m_pDstTexture == nullptr, ("ReAcquire of existing shroud texture")); // Create destination texture (stored in video memory). // Since we control the video memory copy, we can do partial updates more efficiently. Or do shift blits. @@ -243,7 +243,7 @@ Bool W3DShroud::ReAcquireResources(void) #endif m_pDstTexture = MSGNEW("TextureClass") TextureClass(m_dstTextureWidth,m_dstTextureHeight,WW3D_FORMAT_R5G6B5,MIP_LEVELS_1, TextureClass::POOL_DEFAULT); - DEBUG_ASSERTCRASH( m_pDstTexture != NULL, ("Failed ReAcquire of shroud texture")); + DEBUG_ASSERTCRASH( m_pDstTexture != nullptr, ("Failed ReAcquire of shroud texture")); if (!m_pDstTexture) { //could not create a valid texture @@ -262,7 +262,7 @@ Bool W3DShroud::ReAcquireResources(void) //----------------------------------------------------------------------------- W3DShroudLevel W3DShroud::getShroudLevel(Int x, Int y) { - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Reading empty shroud")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Reading empty shroud")); if (x < m_numCellsX && y < m_numCellsY) { @@ -283,7 +283,7 @@ W3DShroudLevel W3DShroud::getShroudLevel(Int x, Int y) //----------------------------------------------------------------------------- void W3DShroud::setShroudLevel(Int x, Int y, W3DShroudLevel level, Bool textureOnly) { - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Writing empty shroud. Usually means that map failed to load.")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Writing empty shroud. Usually means that map failed to load.")); if (!m_pSrcTexture) return; @@ -512,7 +512,7 @@ void W3DShroud::setBorderShroudLevel(W3DShroudLevel level) //----------------------------------------------------------------------------- ///@todo: remove this -TextureClass *DummyTexture=NULL; +TextureClass *DummyTexture=nullptr; //#define LOAD_DUMMY_SHROUD @@ -542,7 +542,7 @@ void W3DShroud::render(CameraClass *cam) } #endif - DEBUG_ASSERTCRASH( m_pSrcTexture != NULL, ("Updating unallocated shroud texture")); + DEBUG_ASSERTCRASH( m_pSrcTexture != nullptr, ("Updating unallocated shroud texture")); #ifdef LOAD_DUMMY_SHROUD diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp index 11e6747038b..6d200011899 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp @@ -77,10 +77,10 @@ W3DStatusCircle::~W3DStatusCircle(void) W3DStatusCircle::W3DStatusCircle(void) { - m_indexBuffer=NULL; - m_vertexMaterialClass=NULL; - m_vertexBufferCircle=NULL; - m_vertexBufferScreen=NULL; + m_indexBuffer=nullptr; + m_vertexMaterialClass=nullptr; + m_vertexBufferCircle=nullptr; + m_vertexBufferScreen=nullptr; } @@ -304,10 +304,10 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) if (!TheGameLogic->isInGame() || TheGameLogic->getGameMode() == GAME_SHELL) return; - if (m_indexBuffer == NULL) { + if (m_indexBuffer == nullptr) { initData(); } - if (m_indexBuffer == NULL) { + if (m_indexBuffer == nullptr) { return; } Bool setIndex = false; @@ -320,7 +320,7 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) //Apply the shader and material DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferCircle); setIndex = true; @@ -343,7 +343,7 @@ void W3DStatusCircle::Render(RenderInfoClass & rinfo) if (!setIndex) { DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); } tm.Make_Identity(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp index b7ee59abd34..2239a0b2307 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp @@ -52,7 +52,7 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win) WebBrowserURL *url = findURL( AsciiString(tag) ); - if (url == NULL) { + if (url == nullptr) { DEBUG_LOG(("W3DWebBrowser::createBrowserWindow - couldn't find URL for page %s", tag)); return FALSE; } @@ -62,7 +62,7 @@ Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win) #else CComQIPtr idisp(m_dispatch); #endif - if (m_dispatch == NULL) + if (m_dispatch == nullptr) { return FALSE; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index 6c073b501d6..a49fa800784 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -51,6 +51,7 @@ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- + #include "W3DDevice/GameClient/W3DWaypointBuffer.h" #include @@ -424,9 +425,9 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) corners[3].x = ctr->x - exc + eys; corners[3].y = ctr->y - eyc - exs; - Coord2D *pNearElbow = NULL;//find the closest corner to the rallyPoint same end as door - Coord2D *pFarElbow = NULL; //find the closest corner to the rallypoint away from door - Coord2D *nearCandidate = NULL; + Coord2D *pNearElbow = nullptr;//find the closest corner to the rallyPoint same end as door + Coord2D *pFarElbow = nullptr; //find the closest corner to the rallypoint away from door + Coord2D *nearCandidate = nullptr; Coord3D cornerToRPDelta, cornerToExitDelta; cornerToRPDelta.z = 0.0f; cornerToExitDelta.z = 0.0f; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 7ef77aff298..c66681a7ad8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -177,8 +177,8 @@ Bool W3DRenderObjectSnapshot::removeFromScene() W3DRenderObjectSnapshot::W3DRenderObjectSnapshot(RenderObjClass *robj, DrawableInfo *drawInfo, Bool cloneParentRobj) { - m_robj = NULL; - m_next = NULL; + m_robj = nullptr; + m_next = nullptr; update(robj, drawInfo, cloneParentRobj); } @@ -298,15 +298,15 @@ void W3DRenderObjectSnapshot::loadPostProcess( void ) W3DGhostObject::W3DGhostObject() { for (Int i = 0; i < MAX_PLAYER_COUNT; i++) - m_parentSnapshots[i] = NULL; + m_parentSnapshots[i] = nullptr; - m_drawableInfo.m_drawable = NULL; + m_drawableInfo.m_drawable = nullptr; m_drawableInfo.m_flags = 0; - m_drawableInfo.m_ghostObject = NULL; + m_drawableInfo.m_ghostObject = nullptr; m_drawableInfo.m_shroudStatusObjectID = INVALID_ID; - m_nextSystem = NULL; - m_prevSystem = NULL; + m_nextSystem = nullptr; + m_prevSystem = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -318,12 +318,12 @@ W3DGhostObject::~W3DGhostObject() { for (Int i = 0; i < MAX_PLAYER_COUNT; i++) { - DEBUG_ASSERTCRASH(m_parentSnapshots[i] == NULL, ("Delete of non-empty GhostObject")); + DEBUG_ASSERTCRASH(m_parentSnapshots[i] == nullptr, ("Delete of non-empty GhostObject")); } } else { - DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == NULL, ("Delete of non-empty GhostObject")); + DEBUG_ASSERTCRASH(m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] == nullptr, ("Delete of non-empty GhostObject")); } #endif } @@ -351,7 +351,7 @@ void W3DGhostObject::snapShot(int playerIndex) draw->setShroudClearFrame(InvalidShroudClearFrame); W3DRenderObjectSnapshot *snap = m_parentSnapshots[playerIndex]; - W3DRenderObjectSnapshot *prevSnap = NULL; + W3DRenderObjectSnapshot *prevSnap = nullptr; //walk through all W3D render objects used by this object for (DrawModule ** dm = draw->getDrawModules(); *dm; ++dm) @@ -366,7 +366,7 @@ void W3DGhostObject::snapShot(int playerIndex) //as for build-ups that are currently disabled. if (robj) { - if (snap == NULL) + if (snap == nullptr) { snap = NEW W3DRenderObjectSnapshot(robj, &m_drawableInfo); // poolify if (prevSnap) @@ -417,7 +417,7 @@ void W3DGhostObject::snapShot(int playerIndex) void W3DGhostObject::removeParentObject(void) { // sanity - if( m_parentObject == NULL ) + if( m_parentObject == nullptr ) return; Drawable *draw = m_parentObject->getDrawable(); @@ -441,7 +441,7 @@ void W3DGhostObject::removeParentObject(void) RenderObjClass *robj = w3dDraw->getRenderObject(); if (robj) { - DEBUG_ASSERTCRASH(robj->Peek_Scene() != NULL, ("Removing GhostObject parent not in scene")); + DEBUG_ASSERTCRASH(robj->Peek_Scene() != nullptr, ("Removing GhostObject parent not in scene")); robj->Remove(); } } @@ -534,7 +534,7 @@ void W3DGhostObject::freeSnapShot(int playerIndex) delete snap; snap = nextSnap; } - m_parentSnapshots[playerIndex] = NULL; + m_parentSnapshots[playerIndex] = nullptr; } } @@ -628,7 +628,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) m_drawableInfo.m_drawable = TheGameClient->findDrawableByID( drawableID ); // sanity - if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == NULL ) + if( drawableID != INVALID_DRAWABLE_ID && m_drawableInfo.m_drawable == nullptr ) DEBUG_CRASH(( "W3DGhostObject::xfer - Unable to find drawable for ghost object" )); } @@ -661,7 +661,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // sanity, this catches when we read from the file a count of zero, but our data // structure already has something allocated in this snapshot index // - if( snapshotCount == 0 && m_parentSnapshots[ i ] != NULL ) + if( snapshotCount == 0 && m_parentSnapshots[ i ] != nullptr ) { DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; @@ -700,7 +700,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) else { RenderObjClass *renderObject; - W3DRenderObjectSnapshot *prevObjectSnapshot = NULL; + W3DRenderObjectSnapshot *prevObjectSnapshot = nullptr; for( UnsignedByte j = 0; j < snapshotCount; ++j ) { @@ -741,7 +741,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // in the world, we need to remove it // if( m_parentObject && - m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != NULL && + m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr && xfer->getXferMode() == XFER_LOAD ) removeParentObject(); @@ -811,8 +811,8 @@ void W3DGhostObject::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ W3DGhostObjectManager::W3DGhostObjectManager(void) { - m_freeModules = NULL; - m_usedModules = NULL; + m_freeModules = nullptr; + m_usedModules = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -853,7 +853,7 @@ void W3DGhostObjectManager::reset(void) mod = nextmod; } - DEBUG_ASSERTCRASH(m_usedModules == NULL, ("Reset of Non-Empty GhostObjectManager")); + DEBUG_ASSERTCRASH(m_usedModules == nullptr, ("Reset of Non-Empty GhostObjectManager")); //Delete any remaining modules (should be none) mod = m_usedModules; @@ -885,7 +885,7 @@ void W3DGhostObjectManager::removeGhostObject(GhostObject *object) m_usedModules = mod->m_nextSystem; // add module to free list - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_freeModules; if( m_freeModules ) m_freeModules->m_prevSystem = mod; @@ -898,11 +898,11 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData { // we disabled adding new ghost objects - used during map border resizing and loading if (m_lockGhostObjects || m_saveLockGhostObjects ) - return NULL; + return nullptr; #if defined(DEBUG_FOG_MEMORY) && defined(DEBUG_CRASHING) // sanity - if( object != NULL ) + if( object != nullptr ) { W3DGhostObject *sanity = m_usedModules; while( sanity ) @@ -930,7 +930,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData mod = NEW W3DGhostObject; // poolify } - mod->m_prevSystem = NULL; + mod->m_prevSystem = nullptr; mod->m_nextSystem = m_usedModules; if( m_usedModules ) m_usedModules->m_prevSystem = mod; @@ -938,7 +938,7 @@ GhostObject *W3DGhostObjectManager::addGhostObject(Object *object, PartitionData //Copy settings from parent object mod->m_parentObject = object; - mod->m_drawableInfo.m_drawable = NULL; //these dummy render objects don't have drawables. + mod->m_drawableInfo.m_drawable = nullptr; //these dummy render objects don't have drawables. mod->m_drawableInfo.m_ghostObject = mod; mod->m_partitionData = pd; @@ -990,10 +990,10 @@ void W3DGhostObjectManager::setLocalPlayerIndex(int playerIndex) // TheSuperHackers @bugfix xezon 06/09/2025 This function now properly updates // all real objects when changing players without waiting for another logic step. // This is particularly noticeable when changing the player while the game is paused. - for (Drawable* draw = TheGameClient->firstDrawable(); draw != NULL; draw = draw->getNextDrawable()) + for (Drawable* draw = TheGameClient->firstDrawable(); draw != nullptr; draw = draw->getNextDrawable()) { Object* obj = draw->getObject(); - if (obj == NULL) + if (obj == nullptr) continue; const ObjectShroudStatus shroudStatus = obj->getShroudedStatus(playerIndex); @@ -1028,7 +1028,7 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play { numStoredSnapshots = 0; - if (playerIndexList != NULL && playerIndexCount > 0) + if (playerIndexList != nullptr && playerIndexCount > 0) { int* playerIndex = playerIndexList; int* const playerIndexEnd = playerIndexList + playerIndexCount; @@ -1050,7 +1050,7 @@ void W3DGhostObjectManager::updateOrphanedObjects(int *playerIndexList, int play if (!numStoredSnapshots) { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData = NULL; + mod->m_partitionData = nullptr; removeGhostObject(mod); } } @@ -1078,14 +1078,14 @@ void W3DGhostObjectManager::releasePartitionData(void) if (!mod->m_parentObject) { ThePartitionManager->unRegisterGhostObject(mod); - mod->m_partitionData = NULL; + mod->m_partitionData = nullptr; } else { //The parent object will handle unregistering so just tell to break the //ghost object link. - mod->friend_getPartitionData()->friend_setGhostObject(NULL); - mod->m_partitionData = NULL; + mod->friend_getPartitionData()->friend_setGhostObject(nullptr); + mod->m_partitionData = nullptr; } mod=nextmod; } @@ -1183,8 +1183,8 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) else { // sanity, there should be no ghost objects loaded at this time - DEBUG_ASSERTCRASH( m_usedModules == NULL, - ("W3DGhostObjectManager::xfer - The used module list is not NULL upon load, but should be!") ); + DEBUG_ASSERTCRASH( m_usedModules == nullptr, + ("W3DGhostObjectManager::xfer - The used module list is not null upon load, but should be!") ); // now it's time to unlock the ghost objects for loading DEBUG_ASSERTCRASH( m_saveLockGhostObjects == TRUE, @@ -1211,11 +1211,11 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) ghostObject = addGhostObject( object, object->friend_getPartitionData() ); // sanity - DEBUG_ASSERTCRASH( ghostObject != NULL, + DEBUG_ASSERTCRASH( ghostObject != nullptr, ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'", object->getTemplate()->getName().str()) ); // link the ghost object and logical object togehter through partition/ghostObject dat - DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == NULL, + DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == nullptr, ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'", object->getTemplate()->getName().str()) ); object->friend_getPartitionData()->friend_setGhostObject( ghostObject ); @@ -1223,7 +1223,7 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) else { // create object with no object or partition data - ghostObject = addGhostObject( NULL, NULL ); + ghostObject = addGhostObject( nullptr, nullptr ); // register ghost object object with partition system and fill out partition data ThePartitionManager->registerGhostObject( ghostObject ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 0b7a8ef24a1..6161951a55d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -48,7 +48,7 @@ W3DTerrainLogic::W3DTerrainLogic(): m_mapMinZ(0), m_mapMaxZ(1) { - m_mapData = NULL; + m_mapData = nullptr; } //------------------------------------------------------------------------------------------------- @@ -318,7 +318,7 @@ Real W3DTerrainLogic::getLayerHeight( Real x, Real y, PathfindLayerEnum layer, C } } Bridge* pBridge; - if ((pBridge = findBridgeLayerAt(&loc, layer, clip)) != 0) + if ((pBridge = findBridgeLayerAt(&loc, layer, clip)) != nullptr) { Real bridgeHeight = pBridge->getBridgeHeight(&loc, normal); if (bridgeHeight > height) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp index 4b0f2b791ef..75e0fb827da 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp @@ -131,7 +131,7 @@ void Win32CDDrive::refreshInfo( void ) Bool mayRequireUpdate = (m_disk != CD::NO_DISK); Char volName[1024]; // read the volume info - if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, NULL, NULL, NULL, NULL, 0 )) + if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, nullptr, nullptr, nullptr, nullptr, 0 )) { m_diskName = volName; m_disk = CD::UNKNOWN_DISK; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 02597c45675..286f442ae91 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -30,6 +30,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include + #include "Win32Device/Common/Win32GameEngine.h" #include "Common/PerfTimer.h" @@ -97,7 +98,7 @@ void Win32GameEngine::update( void ) Sleep(5); serviceWindowsOS(); - if (TheLAN != NULL) { + if (TheLAN != nullptr) { // BGC - need to update TheLAN so we can process and respond to other // people's messages who may not be alt-tabbed out like we are. TheLAN->setIsActive(isActive()); @@ -136,14 +137,14 @@ void Win32GameEngine::serviceWindowsOS( void ) Int returnValue; // - // see if we have any messages to process, a NULL window handle tells the + // see if we have any messages to process, a nullptr window handle tells the // OS to look at the main window associated with the calling thread, us! // - while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // get the message - returnValue = GetMessage( &msg, NULL, 0, 0 ); + returnValue = GetMessage( &msg, nullptr, 0, 0 ); // this is one possible way to check for quitting conditions as a message // of WM_QUIT will cause GetMessage() to return 0 diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp index 085edf99f4d..4296ef53d1f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp @@ -103,7 +103,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn Int returnResult = 0; if (TheSystemIsUnicode) { - returnResult = ::MessageBoxW(NULL, mesgStr.str(), promptStr.str(), windowsOptionsFlags); + returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags); } else { @@ -114,7 +114,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn mesgA.translate(mesgStr); //Make sure main window is not TOP_MOST ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - returnResult = ::MessageBoxA(NULL, mesgA.str(), promptA.str(), windowsOptionsFlags); + returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags); } if (returnResult == IDOK) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index 0591902e29f..5055c7e5d57 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -80,7 +80,7 @@ static ErrorLookup errorLookup[] = { (HRESULT)DIERR_REPORTFULL, "DIERR_REPORTFULL" }, { (HRESULT)DIERR_UNPLUGGED, "DIERR_UNPLUGGED" }, { (HRESULT)DIERR_UNSUPPORTED, "DIERR_UNSUPPORTED" }, -{ 0, NULL } +{ 0, nullptr } }; @@ -95,7 +95,7 @@ static void printReturnCode( char *label, HRESULT hr ) { ErrorLookup *error = errorLookup; - while( error->string != NULL ) + while( error->string != nullptr ) { if( error->error == hr ) @@ -121,7 +121,7 @@ void DirectInputKeyboard::openKeyboard( void ) DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&m_pDirectInput, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -135,7 +135,7 @@ void DirectInputKeyboard::openKeyboard( void ) // obtain an interface to the system keyboard device hr = m_pDirectInput->CreateDevice( GUID_SysKeyboard, &m_pKeyboardDevice, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -222,7 +222,7 @@ void DirectInputKeyboard::closeKeyboard( void ) m_pKeyboardDevice->Unacquire(); m_pKeyboardDevice->Release(); - m_pKeyboardDevice = NULL; + m_pKeyboardDevice = nullptr; DEBUG_LOG(( "OK - Keyboard deviced closed" )); } @@ -230,7 +230,7 @@ void DirectInputKeyboard::closeKeyboard( void ) { m_pDirectInput->Release(); - m_pDirectInput = NULL; + m_pDirectInput = nullptr; DEBUG_LOG(( "OK - Keyboard direct input interface closed" )); } @@ -345,8 +345,8 @@ void DirectInputKeyboard::getKey( KeyboardIO *key ) DirectInputKeyboard::DirectInputKeyboard( void ) { - m_pDirectInput = NULL; - m_pKeyboardDevice = NULL; + m_pDirectInput = nullptr; + m_pKeyboardDevice = nullptr; if( GetKeyState( VK_CAPITAL ) & 0x01 ) @@ -411,7 +411,7 @@ void DirectInputKeyboard::update( void ) DWORD items = INFINITE; m_pKeyboardDevice->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ), - NULL, &items, 0 ); + nullptr, &items, 0 ); } */ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index c8b59e10e62..c7dbf108713 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -50,7 +50,7 @@ void DirectInputMouse::openMouse( void ) DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&m_pDirectInput, - NULL ); + nullptr ); if( FAILED( hr ) ) { @@ -62,9 +62,7 @@ void DirectInputMouse::openMouse( void ) } // create a device for the system mouse - hr = m_pDirectInput->CreateDevice( GUID_SysMouse, - &m_pMouseDevice, - NULL ); + hr = m_pDirectInput->CreateDevice( GUID_SysMouse, &m_pMouseDevice, nullptr ); if( FAILED( hr ) ) { @@ -171,7 +169,7 @@ void DirectInputMouse::closeMouse( void ) m_pMouseDevice->Unacquire(); m_pMouseDevice->Release(); - m_pMouseDevice = NULL; + m_pMouseDevice = nullptr; DEBUG_LOG(( "OK - Mouse device closed" )); } @@ -181,7 +179,7 @@ void DirectInputMouse::closeMouse( void ) { m_pDirectInput->Release(); - m_pDirectInput = NULL; + m_pDirectInput = nullptr; DEBUG_LOG(( "OK - Mouse direct input interface closed" )); } @@ -320,8 +318,8 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, DirectInputMouse::DirectInputMouse( void ) { - m_pDirectInput = NULL; - m_pMouseDevice = NULL; + m_pDirectInput = nullptr; + m_pMouseDevice = nullptr; } @@ -466,20 +464,20 @@ void DirectInputMouse::setCursor( MouseCursor cursor ) { case NONE: - SetCursor( NULL ); + SetCursor( nullptr ); break; case NORMAL: case ARROW: - SetCursor( LoadCursor( NULL, IDC_ARROW ) ); + SetCursor( LoadCursor( nullptr, IDC_ARROW ) ); break; case SCROLL: - SetCursor( LoadCursor( NULL, IDC_SIZEALL ) ); + SetCursor( LoadCursor( nullptr, IDC_SIZEALL ) ); break; case CROSS: - SetCursor( LoadCursor( NULL, IDC_CROSS ) ); + SetCursor( LoadCursor( nullptr, IDC_CROSS ) ); break; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp index 085bcd461d3..9f1e55c21a5 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -254,7 +254,7 @@ Win32Mouse::Win32Mouse( void ) m_currentWin32Cursor = NONE; for (Int i=0; i 0); WWASSERT(vertcount > 0); - WWASSERT(polys != NULL); - WWASSERT(verts != NULL); + WWASSERT(polys != nullptr); + WWASSERT(verts != nullptr); /* ** If we already have allocated data, release it @@ -185,7 +185,7 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,TriIndex * polys,int vertc */ Root = W3DNEW CullNodeStruct; Build_Tree(Root,PolyCount,polyindices); - polyindices = NULL; + polyindices = nullptr; /* ** fill in the remaining information needed in the tree: @@ -213,8 +213,8 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertc { WWASSERT(polycount > 0); WWASSERT(vertcount > 0); - WWASSERT(polys != NULL); - WWASSERT(verts != NULL); + WWASSERT(polys != nullptr); + WWASSERT(verts != nullptr); /* ** If we already have allocated data, release it @@ -252,7 +252,7 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertc */ Root = new CullNodeStruct; Build_Tree(Root,PolyCount,polyindices); - polyindices = NULL; + polyindices = nullptr; /* ** fill in the remaining information needed in the tree: @@ -332,10 +332,10 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the poly array. */ if (arrays.FrontCount) { - WWASSERT(arrays.FrontPolys != NULL); + WWASSERT(arrays.FrontPolys != nullptr); node->Front = W3DNEW CullNodeStruct; Build_Tree(node->Front,arrays.FrontCount,arrays.FrontPolys); - arrays.FrontPolys = NULL; + arrays.FrontPolys = nullptr; } /* @@ -343,11 +343,11 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p ** deletes the tile array. */ if (arrays.BackCount) { - WWASSERT(arrays.BackPolys != NULL); + WWASSERT(arrays.BackPolys != nullptr); node->Back = W3DNEW CullNodeStruct; Build_Tree(node->Back,arrays.BackCount,arrays.BackPolys); - arrays.BackPolys = NULL; + arrays.BackPolys = nullptr; } } @@ -368,7 +368,7 @@ void AABTreeBuilderClass::Build_Tree(CullNodeStruct * node,int polycount,int * p AABTreeBuilderClass::SplitChoiceStruct AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { - WWASSERT(polyindices != NULL); + WWASSERT(polyindices != nullptr); const int NUM_TRYS = 50; @@ -956,9 +956,9 @@ void AABTreeBuilderClass::Build_W3D_AABTree_Recursive /* ** If this is a non-leaf node, set up the child indices, otherwise set up the polygon indices */ - if (node->Front != NULL) { + if (node->Front != nullptr) { - WWASSERT(node->Back != NULL); // if we have one child, we better have both! + WWASSERT(node->Back != nullptr); // if we have one child, we better have both! newnode->FrontOrPoly0 = node->Front->Index; newnode->BackOrPolyCount = node->Back->Index; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h index b3b25842637..569bcb40794 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h @@ -86,7 +86,7 @@ class AABTreeBuilderClass */ struct CullNodeStruct { - CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(NULL),Back(NULL),PolyCount(0),PolyIndices(NULL) {} + CullNodeStruct(void) : Index(0),Min(0,0,0),Max(0,0,0),Front(nullptr),Back(nullptr),PolyCount(0),PolyIndices(nullptr) {} ~CullNodeStruct(void) { delete Front; @@ -135,8 +135,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys(nullptr) { } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 910f1f7d2f9..b83b1c8f8f0 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -86,32 +86,32 @@ Animatable3DObjClass::Animatable3DObjClass(const char * htree_name) : CurMotionMode(BASE_POSE) { // Inline struct members can't be initialized in init list for some reason... - ModeAnim.Motion=NULL; + ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; ModeAnim.LastSyncTime=WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0=NULL; - ModeInterp.Motion1=NULL; + ModeInterp.Motion0=nullptr; + ModeInterp.Motion1=nullptr; ModeInterp.Frame0=0.0f; ModeInterp.PrevFrame0=0.0f; ModeInterp.PrevFrame1=0.0f; ModeInterp.Frame1=0.0f; ModeInterp.Percentage=0.0f; - ModeCombo.AnimCombo=NULL; + ModeCombo.AnimCombo=nullptr; /* ** Store a pointer to the htree */ - if (htree_name == NULL) { - HTree = NULL; + if (htree_name == nullptr) { + HTree = nullptr; } else if (htree_name[0] == 0) { HTree = W3DNEW HTreeClass; HTree->Init_Default (); } else { HTreeClass * source = WW3DAssetManager::Get_Instance()->Get_HTree(htree_name); - if (source != NULL) { + if (source != nullptr) { HTree = W3DNEW HTreeClass(*source); } else { WWDEBUG_SAY(("Unable to find HTree: %s",htree_name)); @@ -139,23 +139,23 @@ Animatable3DObjClass::Animatable3DObjClass(const Animatable3DObjClass & src) : CompositeRenderObjClass(src), IsTreeValid(0), CurMotionMode(BASE_POSE), - HTree(NULL) + HTree(nullptr) { // Inline struct members can't be initialized in init list for some reason... - ModeAnim.Motion=NULL; + ModeAnim.Motion=nullptr; ModeAnim.Frame=0.0f; ModeAnim.PrevFrame=0.0f; ModeAnim.LastSyncTime=WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0=NULL; - ModeInterp.Motion1=NULL; + ModeInterp.Motion0=nullptr; + ModeInterp.Motion1=nullptr; ModeInterp.Frame0=0.0f; ModeInterp.PrevFrame0=0.0f; ModeInterp.PrevFrame1=0.0f; ModeInterp.Frame1=0.0f; ModeInterp.Percentage=0.0f; - ModeCombo.AnimCombo=NULL; + ModeCombo.AnimCombo=nullptr; *this = src; } @@ -202,20 +202,20 @@ Animatable3DObjClass & Animatable3DObjClass::operator = (const Animatable3DObjCl IsTreeValid = 0; CurMotionMode = BASE_POSE; - ModeAnim.Motion = NULL; + ModeAnim.Motion = nullptr; ModeAnim.Frame = 0.0f; ModeAnim.PrevFrame = 0.0f; ModeAnim.LastSyncTime = WW3D::Get_Logic_Time_Milliseconds(); ModeAnim.frameRateMultiplier=1.0; // 020607 srj -- added ModeAnim.animDirection=1.0; // 020607 srj -- added - ModeInterp.Motion0 = NULL; - ModeInterp.Motion1 = NULL; + ModeInterp.Motion0 = nullptr; + ModeInterp.Motion1 = nullptr; ModeInterp.Frame0 = 0.0f; ModeInterp.PrevFrame0 = 0.0f; ModeInterp.PrevFrame1 = 0.0f; ModeInterp.Frame1 = 0.0f; ModeInterp.Percentage = 0.0f; - ModeCombo.AnimCombo = NULL; + ModeCombo.AnimCombo = nullptr; delete HTree; HTree = W3DNEW HTreeClass(*that.HTree); @@ -243,21 +243,21 @@ void Animatable3DObjClass::Release( void ) break; case SINGLE_ANIM: - if ( ModeAnim.Motion != NULL ) { + if ( ModeAnim.Motion != nullptr ) { ModeAnim.Motion->Release_Ref(); - ModeAnim.Motion = NULL; + ModeAnim.Motion = nullptr; } break; case DOUBLE_ANIM: - if ( ModeInterp.Motion0 != NULL ) { + if ( ModeInterp.Motion0 != nullptr ) { ModeInterp.Motion0->Release_Ref(); - ModeInterp.Motion0 = NULL; + ModeInterp.Motion0 = nullptr; } - if ( ModeInterp.Motion1 != NULL ) { + if ( ModeInterp.Motion1 != nullptr ) { ModeInterp.Motion1->Release_Ref(); - ModeInterp.Motion1 = NULL; + ModeInterp.Motion1 = nullptr; } break; @@ -283,7 +283,7 @@ void Animatable3DObjClass::Release( void ) *=============================================================================================*/ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) { - if (HTree == NULL) return; + if (HTree == nullptr) return; if (Is_Not_Hidden_At_All() == false) { return; @@ -313,7 +313,7 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) *=============================================================================================*/ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { - if (HTree == NULL) return; + if (HTree == nullptr) return; // // Force the hierarchy to be recalculated for single animations. @@ -531,7 +531,7 @@ void Animatable3DObjClass::Set_Animation ModeInterp.Percentage = percentage; Set_Hierarchy_Valid(false); - if ( ModeInterp.Motion0 != NULL ) { + if ( ModeInterp.Motion0 != nullptr ) { ModeInterp.Motion0->Add_Ref(); const char* sound_name = AnimatedSoundMgrClass::Get_Embedded_Sound_Name(motion0); if (sound_name) { @@ -540,7 +540,7 @@ void Animatable3DObjClass::Set_Animation } } - if ( ModeInterp.Motion1 != NULL ) { + if ( ModeInterp.Motion1 != nullptr ) { ModeInterp.Motion1->Add_Ref(); const char* sound_name = AnimatedSoundMgrClass::Get_Embedded_Sound_Name(motion1); if (sound_name) { @@ -606,7 +606,7 @@ HAnimClass * Animatable3DObjClass::Peek_Animation( void ) if ( CurMotionMode == SINGLE_ANIM ) { return ModeAnim.Motion; } else { - return NULL; + return nullptr; } } @@ -831,7 +831,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) for (int index = 0; index < count; index ++) { HAnimClass *motion = ModeCombo.AnimCombo->Peek_Motion(index); - if ( motion != NULL && motion->Has_Embedded_Sounds() ) { + if ( motion != nullptr && motion->Has_Embedded_Sounds() ) { float prev_frame = AnimatedSoundMgrClass::Trigger_Sound(motion, ModeCombo.AnimCombo->Get_Prev_Frame(index), ModeCombo.AnimCombo->Get_Frame(index), HTree->Get_Transform(motion->Get_Embedded_Sound_Bone_Index())); ModeCombo.AnimCombo->Set_Prev_Frame(index, prev_frame); @@ -910,7 +910,7 @@ bool Animatable3DObjClass::Simple_Evaluate_Bone(int boneindex, float frame, Matr // // Only do this for simple animations // - if (HTree != NULL) { + if (HTree != nullptr) { if (CurMotionMode == SINGLE_ANIM) { retval = HTree->Simple_Evaluate_Pivot (ModeAnim.Motion, boneindex, frame, Get_Transform (), tm); @@ -1099,7 +1099,7 @@ HAnimClass * Animatable3DObjClass::Peek_Animation_And_Info(float& frame, int& nu mult = ModeAnim.frameRateMultiplier; return ModeAnim.Motion; } else { - return NULL; + return nullptr; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 2168a3f37a7..fed654af69b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -123,7 +123,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass protected: // internally used to compute the current frame if the object is in ANIM_MODE_MANUAL - float Compute_Current_Frame(float *newDirection=NULL) const; + float Compute_Current_Frame(float *newDirection=nullptr) const; // Update the sub-object transforms according to the current anim state and root transform. virtual void Update_Sub_Object_Transforms(void); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index 56b257de897..a0af1ac87cc 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -123,7 +123,7 @@ /* ** Static member variable which keeps track of the single instanced asset manager */ -WW3DAssetManager * WW3DAssetManager::TheInstance = NULL; +WW3DAssetManager * WW3DAssetManager::TheInstance = nullptr; /* ** Static instance of the Null prototype. This render object is special cased @@ -179,7 +179,7 @@ class Font3DDataIterator : public AssetIterator virtual void First(void) { Node = WW3DAssetManager::Get_Instance()->Font3DDatas.Head(); } virtual void Next(void) { Node = Node->Next(); } - virtual bool Is_Done(void) { return Node==NULL; } + virtual bool Is_Done(void) { return Node==nullptr; } virtual const char * Current_Item_Name(void) { return Node->Data()->Name; } protected: @@ -208,9 +208,9 @@ WW3DAssetManager::WW3DAssetManager(void) : WW3D_Load_On_Demand (false), Activate_Fog_On_Load (false), - MetalManager(0) + MetalManager(nullptr) { - assert(TheInstance == NULL); + assert(TheInstance == nullptr); TheInstance = this; // set the growth rates @@ -258,10 +258,10 @@ WW3DAssetManager::~WW3DAssetManager(void) delete MetalManager; Free(); - TheInstance = NULL; + TheInstance = nullptr; delete [] PrototypeHashTable; - PrototypeHashTable = NULL; + PrototypeHashTable = nullptr; } static void Create_Number_String(StringClass& number, unsigned value) @@ -453,7 +453,7 @@ void WW3DAssetManager::Free_Assets(void) PrototypeClass * proto = Prototypes[count]; Prototypes.Delete(count); - if (proto != NULL) { + if (proto != nullptr) { proto->DeleteSelf(); } } @@ -532,7 +532,7 @@ void WW3DAssetManager::Free_Assets_With_Exclusion_List(const DynamicVectorClass< for (; iGet_Name())); proto->DeleteSelf(); } - Prototypes[i] = NULL; + Prototypes[i] = nullptr; } } @@ -594,7 +594,7 @@ void WW3DAssetManager::Create_Asset_List(DynamicVectorClass & model if (proto) { const char * name = proto->Get_Name(); - if ((strchr(name,'#') == NULL) && (strchr(name,'.') == NULL)) { + if ((strchr(name,'#') == nullptr) && (strchr(name,'.') == nullptr)) { model_list.Add(StringClass(name)); } } @@ -712,9 +712,9 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) ** Find a loader that handles that type of chunk */ PrototypeLoaderClass * loader = Find_Prototype_Loader(chunk_id); - PrototypeClass * newproto = NULL; + PrototypeClass * newproto = nullptr; - if (loader != NULL) { + if (loader != nullptr) { /* ** Ask it to create a prototype from the contents of the @@ -735,7 +735,7 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) ** Now, see if the prototype that we loaded has a duplicate ** name with any of our currently loaded prototypes (can't have that!) */ - if (newproto != NULL) { + if (newproto != nullptr) { if (!Render_Obj_Exists(newproto->Get_Name())) { @@ -752,7 +752,7 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload) */ WWDEBUG_SAY(("Render Object Name Collision: %s",newproto->Get_Name())); newproto->DeleteSelf(); - newproto = NULL; + newproto = nullptr; return false; } @@ -793,12 +793,12 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) // Try to find a prototype PrototypeClass * proto = Find_Prototype(name); - if (WW3D_Load_On_Demand && proto == NULL) { // If we didn't find one, try to load on demand + if (WW3D_Load_On_Demand && proto == nullptr) { // If we didn't find one, try to load on demand AssetStatusClass::Peek_Instance()->Report_Load_On_Demand_RObj(name); char filename [MAX_PATH]; const char *mesh_name = ::strchr (name, '.'); - if (mesh_name != NULL) { + if (mesh_name != nullptr) { ::lstrcpyn (filename, name, ((int)mesh_name) - ((int)name) + 1); ::lstrcat (filename, ".w3d"); } else { @@ -815,7 +815,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) proto = Find_Prototype(name); // try again } - if (proto == NULL) { + if (proto == nullptr) { static int warning_count = 0; // Note - objects named "#..." are scaled cached objects, so don't warn... if (name[0] != '#') { @@ -824,7 +824,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) } AssetStatusClass::Peek_Instance()->Report_Missing_RObj(name); } - return NULL; // Failed to find a prototype + return nullptr; // Failed to find a prototype } return proto->Create(); @@ -845,7 +845,7 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name) *=============================================================================================*/ bool WW3DAssetManager::Render_Obj_Exists(const char * name) { - if (Find_Prototype(name) == NULL) return false; + if (Find_Prototype(name) == nullptr) return false; else return true; } @@ -886,7 +886,7 @@ RenderObjIterator * WW3DAssetManager::Create_Render_Obj_Iterator(void) *=============================================================================================*/ void WW3DAssetManager::Release_Render_Obj_Iterator(RenderObjIterator * it) { - WWASSERT(it != NULL); + WWASSERT(it != nullptr); delete it; } @@ -971,7 +971,7 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) // Try to find the hanim HAnimClass * anim = HAnimManager.Get_Anim(name); - if (WW3D_Load_On_Demand && anim == NULL) { // If we didn't find it, try to load on demand + if (WW3D_Load_On_Demand && anim == nullptr) { // If we didn't find it, try to load on demand if ( !HAnimManager.Is_Missing( name ) ) { // if this is NOT a known missing anim @@ -979,12 +979,12 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) char filename[ MAX_PATH ]; const char *animname = strchr( name, '.'); - if (animname != NULL) { + if (animname != nullptr) { sprintf( filename, "%s.w3d", animname+1); } else { WWDEBUG_SAY(( "Animation %s has no . in the name", name )); WWASSERT( 0 ); - return NULL; + return nullptr; } // If we can't find it, try the parent directory @@ -994,7 +994,7 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) } anim = HAnimManager.Get_Anim(name); // Try agai - if (anim == NULL) { + if (anim == nullptr) { HAnimManager.Register_Missing( name ); // This is now a KNOWN missing anim AssetStatusClass::Peek_Instance()->Report_Missing_HAnim(name); } @@ -1025,7 +1025,7 @@ HTreeClass * WW3DAssetManager::Get_HTree(const char * name) // Try to find the htree HTreeClass * htree = HTreeManager.Get_Tree(name); - if (WW3D_Load_On_Demand && htree == NULL) { // If we didn't find it, try to load on demand + if (WW3D_Load_On_Demand && htree == nullptr) { // If we didn't find it, try to load on demand AssetStatusClass::Peek_Instance()->Report_Load_On_Demand_HTree(name); @@ -1041,7 +1041,7 @@ HTreeClass * WW3DAssetManager::Get_HTree(const char * name) htree = HTreeManager.Get_Tree(name); // Try again - if (htree == NULL) { + if (htree == nullptr) { AssetStatusClass::Peek_Instance()->Report_Missing_HTree(name); } } @@ -1084,9 +1084,9 @@ TextureClass * WW3DAssetManager::Get_Texture /* ** Bail if the user isn't really asking for anything */ - if ((filename == NULL) || (strlen(filename) == 0)) + if ((filename == nullptr) || (strlen(filename) == 0)) { - return NULL; + return nullptr; } StringClass lower_case_name(filename,true); @@ -1108,20 +1108,20 @@ TextureClass * WW3DAssetManager::Get_Texture { if (type==TextureBaseClass::TEX_REGULAR) { - tex = NEW_REF (TextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (TextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else if (type==TextureBaseClass::TEX_CUBEMAP) { - tex = NEW_REF (CubeTextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (CubeTextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else if (type==TextureBaseClass::TEX_VOLUME) { - tex = NEW_REF (VolumeTextureClass, (lower_case_name, NULL, mip_level_count, texture_format, allow_compression, allow_reduction)); + tex = NEW_REF (VolumeTextureClass, (lower_case_name, nullptr, mip_level_count, texture_format, allow_compression, allow_reduction)); } else { WWASSERT_PRINT(false, ("Unhandled case")); - return NULL; + return nullptr; } TextureHash.Insert(tex->Get_Texture_Name(),tex); @@ -1403,7 +1403,7 @@ void WW3DAssetManager::Release_All_Font3DDatas( void ) { // for each mat in the list, get it and release ref it Font3DDataClass *head; - while ((head = Font3DDatas.Remove_Head()) != NULL ) { + while ((head = Font3DDatas.Remove_Head()) != nullptr ) { head->Release_Ref(); } } @@ -1471,7 +1471,7 @@ FontCharsClass * WW3DAssetManager::Get_FontChars( const char * name, int point_s } font->Release_Ref(); - return NULL; + return nullptr; } @@ -1516,7 +1516,7 @@ void WW3DAssetManager::Release_All_FontChars( void ) *=============================================================================================*/ void WW3DAssetManager::Register_Prototype_Loader(PrototypeLoaderClass * loader) { - WWASSERT(loader != NULL); + WWASSERT(loader != nullptr); PrototypeLoaders.Add(loader); } @@ -1528,7 +1528,7 @@ void WW3DAssetManager::Register_Prototype_Loader(PrototypeLoaderClass * loader) * chunk_id - chunk type that the loader needs to handle * * * * OUTPUT: * - * pointer to the appropriate loader or NULL if one wasn't found * + * pointer to the appropriate loader or null if one wasn't found * * * * WARNINGS: * * * @@ -1543,7 +1543,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) return loader; } } - return NULL; + return nullptr; } @@ -1563,7 +1563,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) *=============================================================================================*/ void WW3DAssetManager::Add_Prototype(PrototypeClass * newproto) { - WWASSERT(newproto != NULL); + WWASSERT(newproto != nullptr); int hash = CRC_Stringi(newproto->Get_Name()) & PROTOTYPE_HASH_MASK; newproto->friend_setNextHash(PrototypeHashTable[hash]); PrototypeHashTable[hash] = newproto; @@ -1585,25 +1585,25 @@ void WW3DAssetManager::Add_Prototype(PrototypeClass * newproto) *=============================================================================================*/ void WW3DAssetManager::Remove_Prototype(PrototypeClass *proto) { - WWASSERT(proto != NULL); - if (proto != NULL) { + WWASSERT(proto != nullptr); + if (proto != nullptr) { // // Find the prototype in the hash table. // const char *pname = proto->Get_Name (); bool bfound = false; - PrototypeClass *prev = NULL; + PrototypeClass *prev = nullptr; int hash = CRC_Stringi(pname) & PROTOTYPE_HASH_MASK; for (PrototypeClass *test = PrototypeHashTable[hash]; - (test != NULL) && (bfound == false); + (test != nullptr) && (bfound == false); test = test->friend_getNextHash()) { // Is this the prototype? if (::stricmp (test->Get_Name(), pname) == 0) { // Remove this prototype from the linked list for this hash index. - if (prev == NULL) { + if (prev == nullptr) { PrototypeHashTable[hash] = test->friend_getNextHash(); } else { prev->friend_setNextHash(test->friend_getNextHash()); @@ -1639,12 +1639,12 @@ void WW3DAssetManager::Remove_Prototype(PrototypeClass *proto) *=============================================================================================*/ void WW3DAssetManager::Remove_Prototype(const char *name) { - WWASSERT(name != NULL); - if (name != NULL) { + WWASSERT(name != nullptr); + if (name != nullptr) { // Lookup the prototype by name PrototypeClass *proto = Find_Prototype (name); - if (proto != NULL) { + if (proto != nullptr) { // Remove the prototype from our lists, and free its memory Remove_Prototype (proto); @@ -1680,13 +1680,13 @@ PrototypeClass * WW3DAssetManager::Find_Prototype(const char * name) int hash = CRC_Stringi(name) & PROTOTYPE_HASH_MASK; PrototypeClass * test = PrototypeHashTable[hash]; - while (test != NULL) { + while (test != nullptr) { if (stricmp(test->Get_Name(),name) == 0) { return test; } test = test->friend_getNextHash(); } - return NULL; + return nullptr; } /* @@ -1706,7 +1706,7 @@ const char * RObjIterator::Current_Item_Name(void) if (Index < WW3DAssetManager::Get_Instance()->Prototypes.Count()) { return WW3DAssetManager::Get_Instance()->Prototypes[Index]->Get_Name(); } else { - return NULL; + return nullptr; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h index 82f5b6b763d..390ed1f723b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -201,7 +201,7 @@ class WW3DAssetManager ** WW3DAssetManager::Get_Instance(); */ static WW3DAssetManager * Get_Instance(void) { return TheInstance; } - static void Delete_This(void) { delete TheInstance; TheInstance=NULL; } + static void Delete_This(void) { delete TheInstance; TheInstance=nullptr; } /* ** Load data from any type of w3d file diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp index f2bb6637b5c..db4e369e77d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp @@ -158,7 +158,7 @@ static Vector3 _BoxVertexNormals[NUM_BOX_VERTS] = bool BoxRenderObjClass::IsInitted = false; int BoxRenderObjClass::DisplayMask = 0; -static VertexMaterialClass * _BoxMaterial = NULL; +static VertexMaterialClass * _BoxMaterial = nullptr; static ShaderClass _BoxShader; @@ -306,7 +306,7 @@ const char * BoxRenderObjClass::Get_Name(void) const *=============================================================================================*/ void BoxRenderObjClass::Set_Name(const char * name) { - WWASSERT(name != NULL); + WWASSERT(name != nullptr); size_t nameLen = strlcpy(Name, name, ARRAY_SIZE(Name)); (void)nameLen; WWASSERT(nameLen < ARRAY_SIZE(Name)); } @@ -351,7 +351,7 @@ void BoxRenderObjClass::Init(void) /* ** Set up the materials */ - WWASSERT(_BoxMaterial == NULL); + WWASSERT(_BoxMaterial == nullptr); _BoxMaterial = NEW_REF(VertexMaterialClass,()); _BoxMaterial->Set_Ambient(0,0,0); _BoxMaterial->Set_Diffuse(0,0,0); @@ -506,7 +506,7 @@ void BoxRenderObjClass::render_box(RenderInfoClass & rinfo,const Vector3 & cente */ DX8Wrapper::Set_Material(_BoxMaterial); DX8Wrapper::Set_Shader(_BoxShader); - DX8Wrapper::Set_Texture(0,NULL); + DX8Wrapper::Set_Texture(0,nullptr); DX8Wrapper::Set_Index_Buffer(ibaccess,0); DX8Wrapper::Set_Vertex_Buffer(vbaccess); @@ -724,7 +724,7 @@ void AABoxRenderObjClass::Render(RenderInfoClass & rinfo) void AABoxRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); Matrix3D temp(1); temp.Translate(Transform.Get_Translation()); rinfo.VisRasterizer->Set_Model_Transform(temp); @@ -1108,7 +1108,7 @@ void OBBoxRenderObjClass::Render(RenderInfoClass & rinfo) void OBBoxRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Set_Model_Transform(Transform); vis_render_box(rinfo,ObjSpaceCenter,ObjSpaceExtent); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp index ba12206dea5..40ea25f6f21 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -771,7 +771,7 @@ float CameraClass::Get_Aspect_Ratio(void) const void CameraClass::Get_Projection_Matrix(Matrix4x4 * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = ProjectionTransform; @@ -779,7 +779,7 @@ void CameraClass::Get_Projection_Matrix(Matrix4x4 * set_tm) void CameraClass::Get_D3D_Projection_Matrix(Matrix4x4 * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = ProjectionTransform; @@ -800,7 +800,7 @@ void CameraClass::Get_D3D_Projection_Matrix(Matrix4x4 * set_tm) void CameraClass::Get_View_Matrix(Matrix3D * set_tm) { - WWASSERT(set_tm != NULL); + WWASSERT(set_tm != nullptr); Update_Frustum(); *set_tm = CameraInvTransform; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h index 8766dea3a10..d1952b37e42 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -287,10 +287,10 @@ inline void CameraClass::Set_Depth_Range(float zmin,float zmax) inline void CameraClass::Get_Depth_Range(float * set_zmin,float * set_zmax) const { - if (set_zmin != NULL) { + if (set_zmin != nullptr) { *set_zmin = ZBufferMin; } - if (set_zmax != NULL) { + if (set_zmax != nullptr) { *set_zmax = ZBufferMax; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 6b0b4d736e4..a86c721108c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -232,7 +232,7 @@ static DazzleTypeClass** types; static unsigned type_count; // Current dazzle layer - must be set before rendering -static DazzleLayerClass * current_dazzle_layer = NULL; +static DazzleLayerClass * current_dazzle_layer = nullptr; static LensflareTypeClass** lensflares; static unsigned lensflare_count; @@ -300,9 +300,9 @@ class DazzleINIClass : public INIClass { const Vector2 DazzleINIClass::Get_Vector2(char const *section, char const *entry, const Vector2 & defvalue) { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector2 ret; if ( sscanf( entryptr->Value, "%f,%f", &ret[0], &ret[1] ) == 2 ) { return ret; @@ -314,9 +314,9 @@ const Vector2 DazzleINIClass::Get_Vector2(char const *section, char const *entry const Vector3 DazzleINIClass::Get_Vector3(char const *section, char const * entry, const Vector3 & defvalue ) { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector3 ret; if ( sscanf( entryptr->Value, "%f,%f,%f", &ret[0], &ret[1], &ret[2] ) == 3 ) { return ret; @@ -328,9 +328,9 @@ const Vector3 DazzleINIClass::Get_Vector3(char const *section, char const * entr const Vector4 DazzleINIClass::Get_Vector4(char const *section, char const *entry, const Vector4 & defvalue) const { - if (section != NULL && entry != NULL) { + if (section != nullptr && entry != nullptr) { INIEntry * entryptr = Find_Entry(section, entry); - if (entryptr && entryptr->Value != NULL) { + if (entryptr && entryptr->Value != nullptr) { Vector4 ret; if ( sscanf( entryptr->Value, "%f,%f,%f,%f", &ret[0], &ret[1], &ret[2], &ret[3] ) == 4 ) { return ret; @@ -345,7 +345,7 @@ const Vector4 DazzleINIClass::Get_Vector4(char const *section, char const *entry LensflareTypeClass::LensflareTypeClass(const LensflareInitClass& is) : lic(is), - texture(NULL) + texture(nullptr) { } @@ -434,8 +434,8 @@ DazzleTypeClass::DazzleTypeClass(const DazzleInitClass& is) ic(is), dazzle_shader(default_dazzle_shader), halo_shader(default_halo_shader), - primary_texture(NULL), - secondary_texture(NULL), + primary_texture(nullptr), + secondary_texture(nullptr), lensflare_id(DazzleRenderObjClass::Get_Lensflare_ID(is.lensflare_name)), radius(is.radius) { @@ -590,9 +590,9 @@ void DazzleRenderObjClass::Init_From_INI(const INIClass* ini) lic.flare_uv=W3DNEWARRAY Vector4[lic.flare_count]; } else { - lic.flare_locations=NULL; - lic.flare_sizes=NULL; - lic.flare_colors=NULL; + lic.flare_locations=nullptr; + lic.flare_sizes=nullptr; + lic.flare_colors=nullptr; } for (int flare=0;flare=type_count) return NULL; + if (id>=type_count) return nullptr; return types[id]; } @@ -1331,13 +1331,13 @@ unsigned DazzleRenderObjClass::Get_Lensflare_ID(const char* name) // // Return pointer to LensflareTypeClass object with given id. If the id is out // of range (usually UINT_MAX, in can the id was obtained with invalid name -// string) return NULL. +// string) return null. // // ---------------------------------------------------------------------------- -LensflareTypeClass* DazzleRenderObjClass::Get_Lensflare_Class(unsigned id) // Return lensflare type class pointer, or NULL if not found +LensflareTypeClass* DazzleRenderObjClass::Get_Lensflare_Class(unsigned id) // Return lensflare type class pointer, or null if not found { - if (id>=lensflare_count) return NULL; + if (id>=lensflare_count) return nullptr; return lensflares[id]; } @@ -1351,7 +1351,7 @@ LensflareTypeClass* DazzleRenderObjClass::Get_Lensflare_Class(unsigned id) // Re void DazzleRenderObjClass::vis_render_dazzle(SpecialRenderInfoClass & rinfo) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Enable_Two_Sided_Rendering(true); /* @@ -1453,7 +1453,7 @@ uint32 DazzlePersistFactoryClass::Chunk_ID(void) const PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const { - DazzleRenderObjClass * old_obj = NULL; + DazzleRenderObjClass * old_obj = nullptr; Matrix3D tm(1); char dazzle_type[256]; dazzle_type[0] = 0; @@ -1493,18 +1493,18 @@ PersistClass * DazzlePersistFactoryClass::Load(ChunkLoadClass & cload) const RenderObjClass * new_obj = NEW_REF(DazzleRenderObjClass,(dazzle_type)); /* - ** If we failed to create it, replace it with a NULL + ** If we failed to create it, replace it with a nullptr */ - if (new_obj == NULL) { + if (new_obj == nullptr) { static int count = 0; if ( count++ < 10 ) { WWDEBUG_SAY(("DazzlePersistFactory failed to create dazzle of type: %s!!",dazzle_type)); - WWDEBUG_SAY(("Replacing it with a NULL render object!")); + WWDEBUG_SAY(("Replacing it with a null render object!")); } new_obj = WW3DAssetManager::Get_Instance()->Create_Render_Obj("NULL"); } - WWASSERT(new_obj != NULL); + WWASSERT(new_obj != nullptr); if (new_obj) { new_obj->Set_Transform(tm); } @@ -1548,7 +1548,7 @@ const PersistFactoryClass & DazzleRenderObjClass::Get_Factory (void) const ** **********************************************************************************************/ DazzleLayerClass::DazzleLayerClass(void) : - visible_lists(NULL) + visible_lists(nullptr) { if (type_count != 0) { @@ -1559,7 +1559,7 @@ DazzleLayerClass::DazzleLayerClass(void) : visible_lists = W3DNEWARRAY DazzleRenderObjClass *[type_count]; for (unsigned int i = 0; i < type_count; i++) { - visible_lists[i] = NULL; + visible_lists[i] = nullptr; } } } @@ -1582,7 +1582,7 @@ void DazzleLayerClass::Render(CameraClass* camera) camera->Apply(); - DX8Wrapper::Set_Material(NULL); + DX8Wrapper::Set_Material(nullptr); for (unsigned type=0;typeSucc(); } - visible_lists[type] = NULL; + visible_lists[type] = nullptr; } /********************************************************************************************** @@ -1660,7 +1660,7 @@ float DazzleVisibilityClass::Compute_Dazzle_Visibility */ SceneClass * scene = dazzle->Get_Scene(); RenderObjClass * container = dazzle->Get_Container(); - while ((scene == NULL) && (container != NULL)) { + while ((scene == nullptr) && (container != nullptr)) { scene = container->Get_Scene(); container = container->Get_Container(); } @@ -1668,7 +1668,7 @@ float DazzleVisibilityClass::Compute_Dazzle_Visibility /* ** If we found the scene (we SHOULD!) then ask it to compute the visibility */ - if (scene != NULL) { + if (scene != nullptr) { float value = scene->Compute_Point_Visibility(rinfo,point); scene->Release_Ref(); return value; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h index 24d38779401..d686856ae80 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h @@ -313,11 +313,11 @@ class DazzleRenderObjClass : public RenderObjClass static void Init_From_INI(const INIClass* ini); static unsigned Get_Type_ID(const char* name); // Return the ID of type with given name, or INT_MAX if failed static const char * Get_Type_Name(unsigned int id); // Return the name of the type with the given ID - static DazzleTypeClass* Get_Type_Class(unsigned id); // Return dazzle type class pointer, or NULL if not found + static DazzleTypeClass* Get_Type_Class(unsigned id); // Return dazzle type class pointer, or null if not found // The pointer is NOT refcounted - all types are deinitialised // when exiting the level. static unsigned Get_Lensflare_ID(const char* name); // Return the ID of lensflare with given name, or INT_MAX if failed - static LensflareTypeClass* Get_Lensflare_Class(unsigned id); // Return lensflare type class pointer, or NULL if not found + static LensflareTypeClass* Get_Lensflare_Class(unsigned id); // Return lensflare type class pointer, or null if not found static void Deinit(); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp index 58f13203c0f..f88a59f2cc6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp @@ -17,6 +17,7 @@ */ // 08/06/02 KM Added cube map and volume texture support + #include "ddsfile.h" #include "ffactory.h" #include "bufffile.h" @@ -30,15 +31,15 @@ DDSFileClass::DDSFileClass(const char* name,unsigned reduction_factor) : - DDSMemory(NULL), + DDSMemory(nullptr), Width(0), Height(0), Depth(0), FullWidth(0), FullHeight(0), FullDepth(0), - LevelSizes(NULL), - LevelOffsets(NULL), + LevelSizes(nullptr), + LevelOffsets(nullptr), MipLevels(0), ReductionFactor(reduction_factor), Format(WW3D_FORMAT_UNKNOWN), @@ -342,7 +343,7 @@ void DDSFileClass::Copy_Level_To_Surface(unsigned level,IDirect3DSurface8* d3d_s // First lock the surface D3DLOCKED_RECT locked_rect; - DX8_ErrorCode(d3d_surface->LockRect(&locked_rect,NULL,0)); + DX8_ErrorCode(d3d_surface->LockRect(&locked_rect,nullptr,0)); Copy_Level_To_Surface( level, @@ -683,7 +684,7 @@ void DDSFileClass::Copy_CubeMap_Level_To_Surface // volume texture copy const unsigned char* DDSFileClass::Get_Volume_Memory_Pointer(unsigned int level) const { - return NULL;//DDSMemory[ + return nullptr;//DDSMemory[ } void DDSFileClass::Copy_Volume_Level_To_Surface diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp index 936d25c396b..747864e6a1c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp @@ -199,8 +199,8 @@ DecalMeshClass::DecalMeshClass(MeshClass * parent,DecalSystemClass * system) : Parent(parent), DecalSystem(system) { - WWASSERT(Parent != NULL); - WWASSERT(DecalSystem != NULL); + WWASSERT(Parent != nullptr); + WWASSERT(DecalSystem != nullptr); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 12bd6d00682..309e46689a6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -53,7 +53,7 @@ static unsigned short _DynamicSortingIndexArraySize=0; static unsigned short _DynamicSortingIndexArrayOffset=0; static bool _DynamicDX8IndexBufferInUse=false; -static DX8IndexBufferClass* _DynamicDX8IndexBuffer=NULL; +static DX8IndexBufferClass* _DynamicDX8IndexBuffer=nullptr; static unsigned short _DynamicDX8IndexBufferSize=DEFAULT_IB_SIZE; static unsigned short _DynamicDX8IndexBufferOffset=0; @@ -373,7 +373,7 @@ SortingIndexBufferClass::~SortingIndexBufferClass() DynamicIBAccessClass::DynamicIBAccessClass(unsigned short type_, unsigned short index_count_) : IndexCount(index_count_), - IndexBuffer(0), + IndexBuffer(nullptr), Type(type_) { WWASSERT(Type==BUFFER_TYPE_DYNAMIC_DX8 || Type==BUFFER_TYPE_DYNAMIC_SORTING); @@ -400,13 +400,13 @@ DynamicIBAccessClass::~DynamicIBAccessClass() void DynamicIBAccessClass::_Deinit() { - WWASSERT ((_DynamicDX8IndexBuffer == NULL) || (_DynamicDX8IndexBuffer->Num_Refs() == 1)); + WWASSERT ((_DynamicDX8IndexBuffer == nullptr) || (_DynamicDX8IndexBuffer->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicDX8IndexBuffer); _DynamicDX8IndexBufferInUse=false; _DynamicDX8IndexBufferSize=DEFAULT_IB_SIZE; _DynamicDX8IndexBufferOffset=0; - WWASSERT ((_DynamicSortingIndexArray == NULL) || (_DynamicSortingIndexArray->Num_Refs() == 1)); + WWASSERT ((_DynamicSortingIndexArray == nullptr) || (_DynamicSortingIndexArray->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicSortingIndexArray); _DynamicSortingIndexArrayInUse=false; _DynamicSortingIndexArraySize=0; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp index ae773e36076..9b760e15e28 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -103,10 +103,10 @@ class PolyRenderTaskClass : public AutoPoolClass PolyRenderTaskClass(DX8PolygonRendererClass * p_renderer,MeshClass * p_mesh) : Renderer(p_renderer), Mesh(p_mesh), - NextVisible(NULL) + NextVisible(nullptr) { - WWASSERT(Renderer != NULL); - WWASSERT(Mesh != NULL); + WWASSERT(Renderer != nullptr); + WWASSERT(Mesh != nullptr); Mesh->Add_Ref(); } @@ -144,10 +144,10 @@ class MatPassTaskClass : public AutoPoolClass MatPassTaskClass(MaterialPassClass * pass,MeshClass * mesh) : MaterialPass(pass), Mesh(mesh), - NextVisible(NULL) + NextVisible(nullptr) { - WWASSERT(MaterialPass != NULL); - WWASSERT(Mesh != NULL); + WWASSERT(MaterialPass != nullptr); + WWASSERT(Mesh != nullptr); MaterialPass->Add_Ref(); Mesh->Add_Ref(); } @@ -194,7 +194,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( : pass(pass_), shader(shd), - render_task_head(NULL), + render_task_head(nullptr), material(mat), container(container_) { @@ -203,7 +203,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( for (int a=0;aSet_Texture_Category(NULL); - if (PolygonRendererList.Peek_Head() == NULL) { + p_renderer->Set_Texture_Category(nullptr); + if (PolygonRendererList.Peek_Head() == nullptr) { container->Remove_Texture_Category(this); texture_category_delete_list.Add_Tail(this); } @@ -269,7 +269,7 @@ void DX8FVFCategoryContainer::Remove_Texture_Category(DX8TextureCategoryClass* t } for (pass=0; passSet_Next_Visible(new_mpr); } @@ -294,10 +294,10 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) { // additional passes MatPassTaskClass * mpr = visible_matpass_head; - MatPassTaskClass * last_mpr = NULL; + MatPassTaskClass * last_mpr = nullptr; bool renderTasksRemaining=false; - while (mpr != NULL) { + while (mpr != nullptr) { SNAPSHOT_SAY(("Render_Procedural_Material_Pass")); MeshClass * mesh = mpr->Peek_Mesh(); @@ -314,7 +314,7 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) MatPassTaskClass * next_mpr = mpr->Get_Next_Visible(); // remove from list, then delete - if (last_mpr == NULL) { + if (last_mpr == nullptr) { visible_matpass_head = next_mpr; } else { last_mpr->Set_Next_Visible(next_mpr); @@ -324,18 +324,18 @@ void DX8FVFCategoryContainer::Render_Procedural_Material_Passes(void) mpr = next_mpr; } - visible_matpass_tail = renderTasksRemaining ? last_mpr : NULL; + visible_matpass_tail = renderTasksRemaining ? last_mpr : nullptr; } void DX8RigidFVFCategoryContainer::Add_Delayed_Visible_Material_Pass(MaterialPassClass * pass, MeshClass * mesh) { MatPassTaskClass * new_mpr = new MatPassTaskClass(pass,mesh); - if (delayed_matpass_head == NULL) { - WWASSERT(delayed_matpass_tail == NULL); + if (delayed_matpass_head == nullptr) { + WWASSERT(delayed_matpass_tail == nullptr); delayed_matpass_head = new_mpr; } else { - WWASSERT(delayed_matpass_tail != NULL); + WWASSERT(delayed_matpass_tail != nullptr); delayed_matpass_tail->Set_Next_Visible(new_mpr); } @@ -355,7 +355,7 @@ void DX8RigidFVFCategoryContainer::Render_Delayed_Procedural_Material_Passes(voi // additional passes MatPassTaskClass * mpr = delayed_matpass_head; - while (mpr != NULL) { + while (mpr != nullptr) { mpr->Peek_Mesh()->Render_Material_Pass(mpr->Peek_Material_Pass(),index_buffer); MatPassTaskClass * next_mpr = mpr->Get_Next_Visible(); @@ -364,7 +364,7 @@ void DX8RigidFVFCategoryContainer::Render_Delayed_Procedural_Material_Passes(voi mpr = next_mpr; } - delayed_matpass_head = delayed_matpass_tail = NULL; + delayed_matpass_head = delayed_matpass_tail = nullptr; } @@ -404,7 +404,7 @@ void DX8TextureCategoryClass::Log(bool only_visible) prtc = prtc->Get_Next_Visible(); } - if (prtc != NULL) { + if (prtc != nullptr) { WWDEBUG_SAY(("+")); p_renderer->Log(); } else { @@ -424,9 +424,9 @@ DX8FVFCategoryContainer::DX8FVFCategoryContainer(unsigned FVF_,bool sorting_) : FVF(FVF_), sorting(sorting_), - visible_matpass_head(NULL), - visible_matpass_tail(NULL), - index_buffer(0), + visible_matpass_head(nullptr), + visible_matpass_tail(nullptr), + index_buffer(nullptr), used_indices(0), passes(MAX_PASSES), uv_coordinate_channels(0), @@ -465,7 +465,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category DX8TextureCategoryClass* ref_category) { // Find texture category which matches ref_category's properties but has 'texture' on given pass and stage. - DX8TextureCategoryClass* dest_tex_category=NULL; + DX8TextureCategoryClass* dest_tex_category=nullptr; TextureCategoryListIterator dest_it(&texture_category_list[pass]); while (!dest_it.Is_Done()) { if (dest_it.Peek_Obj()->Peek_Texture(stage)==texture) { @@ -485,7 +485,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category( @@ -494,7 +494,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category DX8TextureCategoryClass* ref_category) { // Find texture category which matches ref_category's properties but has 'vmat' on given pass - DX8TextureCategoryClass* dest_tex_category=NULL; + DX8TextureCategoryClass* dest_tex_category=nullptr; TextureCategoryListIterator dest_it(&texture_category_list[pass]); while (!dest_it.Is_Done()) { if (Equal_Material(dest_it.Peek_Obj()->Peek_Material(),vmat)) { @@ -510,7 +510,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( @@ -743,10 +743,10 @@ unsigned DX8FVFCategoryContainer::Define_FVF(MeshModelClass* mmc,bool enable_lig DX8RigidFVFCategoryContainer::DX8RigidFVFCategoryContainer(unsigned FVF,bool sorting_) : DX8FVFCategoryContainer(FVF,sorting_), - vertex_buffer(0), + vertex_buffer(nullptr), used_vertices(0), - delayed_matpass_head(NULL), - delayed_matpass_tail(NULL) + delayed_matpass_head(nullptr), + delayed_matpass_tail(nullptr) { } @@ -1255,8 +1255,8 @@ DX8SkinFVFCategoryContainer::DX8SkinFVFCategoryContainer(bool sorting) : DX8FVFCategoryContainer(DX8_FVF_XYZNUV1,sorting), VisibleVertexCount(0), - VisibleSkinHead(NULL), - VisibleSkinTail(NULL) + VisibleSkinHead(nullptr), + VisibleSkinTail(nullptr) { } @@ -1304,7 +1304,7 @@ void DX8SkinFVFCategoryContainer::Render(void) } AnythingToRender=false; - DX8Wrapper::Set_Vertex_Buffer(NULL); // Free up the reference to the current vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); // Free up the reference to the current vertex buffer // (in case it is the dynamic, which may have to be resized) //'Generals' customization to allow more than 65535 vertices @@ -1329,9 +1329,9 @@ void DX8SkinFVFCategoryContainer::Render(void) { DynamicVBAccessClass::WriteLockClass l(&vb); VertexFormatXYZNDUV2 * dest_verts = l.Get_Formatted_Vertex_Array(); unsigned vertex_offset=0; - remainingMesh = NULL; + remainingMesh = nullptr; - while (mesh != NULL) { + while (mesh != nullptr) { MeshModelClass * mmc = mesh->Peek_Model(); int mesh_vertex_count=mmc->Get_Vertex_Count(); @@ -1339,7 +1339,7 @@ void DX8SkinFVFCategoryContainer::Render(void) if (vertex_offset+mesh_vertex_count > maxVertexCount || remainingMesh) { //flag mesh so we know it didn't fit in the vertex buffer mesh->Set_Base_Vertex_Offset(VERTEX_BUFFER_OVERFLOW); - if (remainingMesh == NULL) + if (remainingMesh == nullptr) remainingMesh = mesh; //start of meshes that didn't fit in buffer mesh = mesh->Peek_Next_Visible_Skin(); //skip rendering this mesh continue; @@ -1455,24 +1455,24 @@ bool DX8SkinFVFCategoryContainer::Check_If_Mesh_Fits(MeshModelClass* mmc) void DX8SkinFVFCategoryContainer::clearVisibleSkinList() { - while (VisibleSkinHead != NULL) + while (VisibleSkinHead != nullptr) { MeshClass* next = VisibleSkinHead->Peek_Next_Visible_Skin(); - VisibleSkinHead->Set_Next_Visible_Skin(NULL); + VisibleSkinHead->Set_Next_Visible_Skin(nullptr); VisibleSkinHead = next; } - VisibleSkinHead = NULL; - VisibleSkinTail = NULL; + VisibleSkinHead = nullptr; + VisibleSkinTail = nullptr; VisibleVertexCount = 0; } void DX8SkinFVFCategoryContainer::Add_Visible_Skin(MeshClass * mesh) { - if (mesh->Peek_Next_Visible_Skin() != NULL || mesh == VisibleSkinTail) + if (mesh->Peek_Next_Visible_Skin() != nullptr || mesh == VisibleSkinTail) { DEBUG_CRASH(("Mesh %s is already a visible skin, and we tried to add it again... please notify Mark W or Steven J immediately!",mesh->Get_Name())); return; } - if (VisibleSkinHead == NULL) + if (VisibleSkinHead == nullptr) VisibleSkinTail = mesh; mesh->Set_Next_Visible_Skin(VisibleSkinHead); VisibleSkinHead = mesh; @@ -1694,7 +1694,7 @@ void DX8TextureCategoryClass::Render(void) for (unsigned i=0;iGet_Texture_Name().str() : "NULL")); + SNAPSHOT_SAY(("Set_Texture(%d,%s)",i,Peek_Texture(i) ? Peek_Texture(i)->Get_Texture_Name().str() : "null")); DX8Wrapper::Set_Texture(i,Peek_Texture(i)); } @@ -1702,7 +1702,7 @@ void DX8TextureCategoryClass::Render(void) } #endif - SNAPSHOT_SAY(("Set_Material(%s)",Peek_Material() ? Peek_Material()->Get_Name() : "NULL")); + SNAPSHOT_SAY(("Set_Material(%s)",Peek_Material() ? Peek_Material()->Get_Name() : "null")); VertexMaterialClass *vmaterial=(VertexMaterialClass *)Peek_Material(); //ugly cast from const but we'll restore it after changes so okay. -MW DX8Wrapper::Set_Material(vmaterial); @@ -1734,7 +1734,7 @@ void DX8TextureCategoryClass::Render(void) bool renderTasksRemaining=false; PolyRenderTaskClass * prt = render_task_head; - PolyRenderTaskClass * last_prt = NULL; + PolyRenderTaskClass * last_prt = nullptr; while (prt) { @@ -1766,7 +1766,7 @@ void DX8TextureCategoryClass::Render(void) // Disable texturing on all stages and passes. for (i = 0; i < MeshMatDescClass::MAX_TEX_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } break; @@ -1780,7 +1780,7 @@ void DX8TextureCategoryClass::Render(void) } } else { for (i = 0; i < MAX_TEXTURE_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } } break; @@ -1791,7 +1791,7 @@ void DX8TextureCategoryClass::Render(void) DX8Wrapper::Set_Texture (0, Peek_Texture (0)); for (i = 1; i < MeshMatDescClass::MAX_TEX_STAGES; i++) { - DX8Wrapper::Set_Texture (i, NULL); + DX8Wrapper::Set_Texture (i, nullptr); } break; @@ -1810,7 +1810,7 @@ void DX8TextureCategoryClass::Render(void) ** states untouched. This way they can set a couple global lights that affect the entire scene. */ LightEnvironmentClass * lenv = mesh->Get_Lighting_Environment(); - if (lenv != NULL) { + if (lenv != nullptr) { SNAPSHOT_SAY(("LightEnvironment, lights: %d",lenv->Get_Light_Count())); DX8Wrapper::Set_Light_Environment(lenv); } @@ -1900,7 +1900,7 @@ void DX8TextureCategoryClass::Render(void) oldMapper->Set_Current_UV_Offset(matOverride->customUVOffset); } else - oldMapper=NULL; + oldMapper=nullptr; if (mesh->Get_Alpha_Override() != 1.0) { if (mesh->Is_Additive()) @@ -1926,7 +1926,7 @@ void DX8TextureCategoryClass::Render(void) { oldMapper->Set_LastUsedSyncTime(oldUVOffsetSyncTime); oldMapper->Set_Current_UV_Offset(oldUVOffset); } - DX8Wrapper::Set_Material(NULL); //force a reset of vertex material since we secretly changed opacity + DX8Wrapper::Set_Material(nullptr); //force a reset of vertex material since we secretly changed opacity DX8Wrapper::Set_Material(vmaterial); //restore previous material. } else @@ -1948,7 +1948,7 @@ void DX8TextureCategoryClass::Render(void) PolyRenderTaskClass * next_prt = prt->Get_Next_Visible(); // remove from list, then delete - if (last_prt == NULL) { + if (last_prt == nullptr) { render_task_head = next_prt; } else { last_prt->Set_Next_Visible(next_prt); @@ -1967,7 +1967,7 @@ void DX8TextureCategoryClass::Render(void) void DX8TextureCategoryClass::Clear_Render_List() { - while (render_task_head != NULL) + while (render_task_head != nullptr) { PolyRenderTaskClass* next = render_task_head->Get_Next_Visible(); delete render_task_head; @@ -1978,10 +1978,10 @@ void DX8TextureCategoryClass::Clear_Render_List() DX8MeshRendererClass::DX8MeshRendererClass() : - camera(NULL), + camera(nullptr), enable_lighting(true), - texture_category_container_list_skin(NULL), - visible_decal_meshes(NULL) + texture_category_container_list_skin(nullptr), + visible_decal_meshes(nullptr) { } @@ -1999,8 +1999,8 @@ void DX8MeshRendererClass::Init(void) void DX8MeshRendererClass::Shutdown(void) { - camera = NULL; - visible_decal_meshes = NULL; + camera = nullptr; + visible_decal_meshes = nullptr; Invalidate(true); Clear_Pending_Delete_Lists(); _TempVertexBuffer.Clear(); //free memory @@ -2024,7 +2024,7 @@ void DX8MeshRendererClass::Clear_Pending_Delete_Lists() static void Add_Rigid_Mesh_To_Container(FVFCategoryList* container_list,unsigned fvf,MeshModelClass* mmc) { WWASSERT(container_list); - DX8FVFCategoryContainer * container = NULL; + DX8FVFCategoryContainer * container = nullptr; bool sorting=((!!mmc->Get_Flag(MeshModelClass::SORT)) && WW3D::Is_Sorting_Enabled() && (mmc->Get_Sort_Level() == SORT_LEVEL_NONE)); FVFCategoryListIterator it(container_list); @@ -2054,7 +2054,7 @@ void DX8MeshRendererClass::Unregister_Mesh_Type(MeshModelClass* mmc) // Also remove the gap filler! if (mmc->GapFiller) { GapFillerClass* gf=mmc->GapFiller; - mmc->GapFiller=NULL; + mmc->GapFiller=nullptr; delete gf; } @@ -2210,14 +2210,14 @@ void DX8MeshRendererClass::Flush(void) Render_FVF_Category_Container_List_Delayed_Passes(*texture_category_container_lists_rigid[i]); } - DX8Wrapper::Set_Vertex_Buffer(NULL); - DX8Wrapper::Set_Index_Buffer(NULL,0); + DX8Wrapper::Set_Vertex_Buffer(nullptr); + DX8Wrapper::Set_Index_Buffer(nullptr,0); } void DX8MeshRendererClass::Add_To_Render_List(DecalMeshClass * decalmesh) { - WWASSERT(decalmesh != NULL); + WWASSERT(decalmesh != nullptr); decalmesh->Set_Next_Visible(visible_decal_meshes); visible_decal_meshes = decalmesh; } @@ -2229,11 +2229,11 @@ void DX8MeshRendererClass::Render_Decal_Meshes(void) DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,8); - while (decal_mesh != NULL) { + while (decal_mesh != nullptr) { decal_mesh->Render(); decal_mesh = decal_mesh->Peek_Next_Visible(); } - visible_decal_meshes = NULL; + visible_decal_meshes = nullptr; DX8Wrapper::Set_DX8_Render_State(D3DRS_ZBIAS,0); } @@ -2279,7 +2279,7 @@ void DX8MeshRendererClass::Invalidate( bool shutdown) if (texture_category_container_list_skin) { Invalidate_FVF_Category_Container_List(*texture_category_container_list_skin); delete texture_category_container_list_skin; - texture_category_container_list_skin=NULL; + texture_category_container_list_skin=nullptr; } if (!shutdown) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h index c040eee6ea4..8e704f4c16d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h @@ -93,7 +93,7 @@ class DX8TextureCategoryClass : public MultiListObjectClass void Add_Render_Task(DX8PolygonRendererClass * p_renderer,MeshClass * p_mesh); void Render(void); - bool Anything_To_Render() { return (render_task_head != NULL); } + bool Anything_To_Render() { return (render_task_head != nullptr); } void Clear_Render_List(); TextureClass * Peek_Texture(int stage) { return textures[stage]; } @@ -111,7 +111,7 @@ class DX8TextureCategoryClass : public MultiListObjectClass void Log(bool only_visible); void Remove_Polygon_Renderer(DX8PolygonRendererClass* p_renderer); - void Add_Polygon_Renderer(DX8PolygonRendererClass* p_renderer,DX8PolygonRendererClass* add_after_this=NULL); + void Add_Polygon_Renderer(DX8PolygonRendererClass* p_renderer,DX8PolygonRendererClass* add_after_this=nullptr); DX8FVFCategoryContainer * Get_Container(void) { return container; } @@ -208,7 +208,7 @@ class DX8FVFCategoryContainer : public MultiListObjectClass void Add_Visible_Texture_Category(DX8TextureCategoryClass * tex_category,int pass) { WWASSERT(passNum_Refs() == 1)); + WWASSERT ((_DynamicDX8VertexBuffer == nullptr) || (_DynamicDX8VertexBuffer->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicDX8VertexBuffer); _DynamicDX8VertexBufferInUse=false; _DynamicDX8VertexBufferSize=DEFAULT_VB_SIZE; _DynamicDX8VertexBufferOffset=0; - WWASSERT ((_DynamicSortingVertexArray == NULL) || (_DynamicSortingVertexArray->Num_Refs() == 1)); + WWASSERT ((_DynamicSortingVertexArray == nullptr) || (_DynamicSortingVertexArray->Num_Refs() == 1)); REF_PTR_RELEASE(_DynamicSortingVertexArray); WWASSERT(!_DynamicSortingVertexArrayInUse); _DynamicSortingVertexArrayInUse=false; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 9fa4fa06867..8fe4cf45b38 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -103,7 +103,7 @@ int DX8Wrapper_PreserveFPU = 0; ** ***********************************************************************************/ -static HWND _Hwnd = NULL; +static HWND _Hwnd = nullptr; bool DX8Wrapper::IsInitted = false; bool DX8Wrapper::_EnableTriangleDraw = true; @@ -126,8 +126,8 @@ DWORD DX8Wrapper::Pixel_Shader = 0; Vector4 DX8Wrapper::Vertex_Shader_Constants[MAX_VERTEX_SHADER_CONSTANTS]; Vector4 DX8Wrapper::Pixel_Shader_Constants[MAX_PIXEL_SHADER_CONSTANTS]; -LightEnvironmentClass* DX8Wrapper::Light_Environment = NULL; -RenderInfoClass* DX8Wrapper::Render_Info = NULL; +LightEnvironmentClass* DX8Wrapper::Light_Environment = nullptr; +RenderInfoClass* DX8Wrapper::Render_Info = nullptr; DWORD DX8Wrapper::Vertex_Processing_Behavior = 0; ZTextureClass* DX8Wrapper::Shadow_Map[MAX_SHADOW_MAPS]; @@ -145,12 +145,12 @@ unsigned DX8Wrapper::render_state_changed; bool DX8Wrapper::FogEnable = false; D3DCOLOR DX8Wrapper::FogColor = 0; -IDirect3D8 * DX8Wrapper::D3DInterface = NULL; -IDirect3DDevice8 * DX8Wrapper::D3DDevice = NULL; -IDirect3DSurface8 * DX8Wrapper::CurrentRenderTarget = NULL; -IDirect3DSurface8 * DX8Wrapper::CurrentDepthBuffer = NULL; -IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = NULL; -IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = NULL; +IDirect3D8 * DX8Wrapper::D3DInterface = nullptr; +IDirect3DDevice8 * DX8Wrapper::D3DDevice = nullptr; +IDirect3DSurface8 * DX8Wrapper::CurrentRenderTarget = nullptr; +IDirect3DSurface8 * DX8Wrapper::CurrentDepthBuffer = nullptr; +IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = nullptr; +IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = nullptr; bool DX8Wrapper::IsRenderToTexture = false; unsigned DX8Wrapper::matrix_changes = 0; @@ -171,7 +171,7 @@ float DX8Wrapper::ZFar; Matrix4x4 DX8Wrapper::ProjectionMatrix; Matrix4x4 DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; -DX8Caps* DX8Wrapper::CurrentCaps = 0; +DX8Caps* DX8Wrapper::CurrentCaps = nullptr; // Hack test... this disables rendering of batches of too few polygons. unsigned DX8Wrapper::DrawPolygonLowBoundLimit=0; @@ -203,10 +203,10 @@ static DynamicVectorClass _RenderDeviceDescriptionTable; typedef IDirect3D8* (WINAPI *Direct3DCreate8Type) (UINT SDKVersion); -Direct3DCreate8Type Direct3DCreate8Ptr = NULL; -HINSTANCE D3D8Lib = NULL; +Direct3DCreate8Type Direct3DCreate8Ptr = nullptr; +HINSTANCE D3D8Lib = nullptr; -DX8_CleanupHook *DX8Wrapper::m_pCleanupHook=NULL; +DX8_CleanupHook *DX8Wrapper::m_pCleanupHook=nullptr; #ifdef EXTENDED_STATS DX8_Stats DX8Wrapper::stats; #endif @@ -310,8 +310,8 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) //world_identity; //CurrentFogColor; - D3DInterface = NULL; - D3DDevice = NULL; + D3DInterface = nullptr; + D3DDevice = nullptr; WWDEBUG_SAY(("Reset DX8Wrapper statistics")); Reset_Statistics(); @@ -321,10 +321,10 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) if (!lite) { D3D8Lib = LoadLibrary("D3D8.DLL"); - if (D3D8Lib == NULL) return false; // Return false at this point if init failed + if (D3D8Lib == nullptr) return false; // Return false at this point if init failed Direct3DCreate8Ptr = (Direct3DCreate8Type) GetProcAddress(D3D8Lib, "Direct3DCreate8"); - if (Direct3DCreate8Ptr == NULL) return false; + if (Direct3DCreate8Ptr == nullptr) return false; /* ** Create the D3D interface object @@ -337,7 +337,7 @@ bool DX8Wrapper::Init(void * hwnd, bool lite) D3DInterface = Direct3DCreate8Ptr(D3D_SDK_VERSION); // TODO: handle failure cases... } - if (D3DInterface == NULL) { + if (D3DInterface == nullptr) { return(false); } IsInitted = true; @@ -357,13 +357,13 @@ void DX8Wrapper::Shutdown(void) { if (D3DDevice) { - Set_Render_Target ((IDirect3DSurface8 *)NULL); + Set_Render_Target ((IDirect3DSurface8 *)nullptr); Release_Device(); } if (D3DInterface) { D3DInterface->Release(); - D3DInterface=NULL; + D3DInterface=nullptr; } @@ -375,19 +375,19 @@ void DX8Wrapper::Shutdown(void) if (Textures[i]) { Textures[i]->Release(); - Textures[i] = NULL; + Textures[i] = nullptr; } } } if (D3DInterface) { UINT newRefCount=D3DInterface->Release(); - D3DInterface=NULL; + D3DInterface=nullptr; } if (D3D8Lib) { FreeLibrary(D3D8Lib); - D3D8Lib = NULL; + D3D8Lib = nullptr; } _RenderDeviceNameTable.Clear(); // note - Delete_All() resizes the vector, causing a reallocation. Clear is better. jba. @@ -468,19 +468,19 @@ void DX8Wrapper::Invalidate_Cached_Render_States(void) { TextureStageStates[a][b]=0x12345678; } - //Need to explicitly set texture to NULL, otherwise app will not be able to + //Need to explicitly set texture to null, otherwise app will not be able to //set it to null because of redundant state checker. MW if (_Get_D3D_Device8()) - _Get_D3D_Device8()->SetTexture(a,NULL); - if (Textures[a] != NULL) { + _Get_D3D_Device8()->SetTexture(a,nullptr); + if (Textures[a] != nullptr) { Textures[a]->Release(); } - Textures[a]=NULL; + Textures[a]=nullptr; } ShaderClass::Invalidate(); - //Need to explicitly set render_state texture pointers to NULL. MW + //Need to explicitly set render_state texture pointers to null. MW Release_Render_State(); // (gth) clear the matrix shadows too @@ -522,14 +522,14 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Shutdowns(void) MissingTexture::_Deinit(); delete CurrentCaps; - CurrentCaps=NULL; + CurrentCaps=nullptr; } bool DX8Wrapper::Create_Device(void) { - WWASSERT(D3DDevice==NULL); // for now, once you've created a device, you're stuck with it! + WWASSERT(D3DDevice==nullptr); // for now, once you've created a device, you're stuck with it! D3DCAPS8 caps; if @@ -656,15 +656,15 @@ bool DX8Wrapper::Reset_Device(bool reload_assets) { WWDEBUG_SAY(("Resetting device.")); DX8_THREAD_ASSERT(); - if ((IsInitted) && (D3DDevice != NULL)) { + if ((IsInitted) && (D3DDevice != nullptr)) { // Release all non-MANAGED stuff WW3D::_Invalidate_Textures(); for (unsigned i=0;iReleaseResources(); } @@ -711,11 +711,11 @@ void DX8Wrapper::Release_Device(void) for (int a=0;aRelease(); - D3DDevice=NULL; + D3DDevice=nullptr; } } @@ -968,7 +968,7 @@ void DX8Wrapper::Resize_And_Position_Window() rectClient.bottom = rectClient.top + ResolutionHeight; MoveRectIntoOtherRect(rectClient, mi.rcMonitor, &left, &top); - ::SetWindowPos (_Hwnd, NULL, left, top, width, height, SWP_NOZORDER); + ::SetWindowPos (_Hwnd, nullptr, left, top, width, height, SWP_NOZORDER); DEBUG_LOG(("Window positioned to x:%d y:%d, resized to w:%d h:%d", left, top, width, height)); } @@ -1020,7 +1020,7 @@ bool DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int } #endif //must be either resetting existing device or creating a new one. - WWASSERT(reset_device || D3DDevice == NULL); + WWASSERT(reset_device || D3DDevice == nullptr); /* ** Initialize values for D3DPRESENT_PARAMETERS members. @@ -1259,7 +1259,7 @@ const char * DX8Wrapper::Get_Render_Device_Name(int device_index) bool DX8Wrapper::Set_Device_Resolution(int width,int height,int bits,int windowed, bool resize_window) { - if (D3DDevice != NULL) { + if (D3DDevice != nullptr) { if (width != -1) { _PresentParameters.BackBufferWidth = ResolutionWidth = width; @@ -1295,7 +1295,7 @@ void DX8Wrapper::Get_Render_Target_Resolution(int & set_w,int & set_h,int & set_ { WWASSERT(IsInitted); - if (CurrentRenderTarget != NULL) { + if (CurrentRenderTarget != nullptr) { D3DSURFACE_DESC info; CurrentRenderTarget->GetDesc (&info); @@ -1477,7 +1477,7 @@ bool DX8Wrapper::Find_Color_And_Z_Mode(int resx,int resy,int bitdepth,D3DFORMAT /* ** Select the table that we're going to use to search for a valid backbuffer format */ - D3DFORMAT * format_table = NULL; + D3DFORMAT * format_table = nullptr; int format_count = 0; if (BitDepth == 16) { @@ -1741,7 +1741,7 @@ void DX8Wrapper::End_Scene(bool flip_frames) HRESULT hr; { WWPROFILE("DX8Device::Present()"); - hr=_Get_D3D_Device8()->Present(NULL, NULL, NULL, NULL); + hr=_Get_D3D_Device8()->Present(nullptr, nullptr, nullptr, nullptr); } number_of_DX8_calls++; @@ -1777,10 +1777,10 @@ void DX8Wrapper::End_Scene(bool flip_frames) } // Each frame, release all of the buffers and textures. - Set_Vertex_Buffer(NULL); - Set_Index_Buffer(NULL,0); - for (int i=0;iGet_Max_Textures_Per_Pass();++i) Set_Texture(i,NULL); - Set_Material(NULL); + Set_Vertex_Buffer(nullptr); + Set_Index_Buffer(nullptr,0); + for (int i=0;iGet_Max_Textures_Per_Pass();++i) Set_Texture(i,nullptr); + Set_Material(nullptr); } @@ -1817,7 +1817,7 @@ void DX8Wrapper::Flip_To_Primary(void) } } else { WWDEBUG_SAY(("Flipping: %ld", FrameCount)); - hr = _Get_D3D_Device8()->Present(NULL, NULL, NULL, NULL); + hr = _Get_D3D_Device8()->Present(nullptr, nullptr, nullptr, nullptr); if (SUCCEEDED(hr)) { IsDeviceLost=false; @@ -1876,7 +1876,7 @@ void DX8Wrapper::Clear(bool clear_color, bool clear_z_stencil, const Vector3 &co if (clear_z_stencil && has_stencil) flags |= D3DCLEAR_STENCIL; if (flags) { - DX8CALL(Clear(0, NULL, flags, Convert_Color(color,dest_alpha), z, stencil)); + DX8CALL(Clear(0, nullptr, flags, Convert_Color(color,dest_alpha), z, stencil)); } } @@ -1948,7 +1948,7 @@ void DX8Wrapper::Set_Vertex_Buffer(const DynamicVBAccessClass& vba_) { // Release all streams (only one stream allowed in the legacy pipeline) for (int i=1;iRelease_Engine_Ref(); @@ -2038,7 +2038,7 @@ void DX8Wrapper::Draw_Sorting_IB_VB( { DynamicIBAccessClass::WriteLockClass lock(&dyn_ib_access); unsigned short* dest=lock.Get_Index_Array(); - unsigned short* src=NULL; + unsigned short* src=nullptr; src=static_cast(render_state.index_buffer)->index_buffer; src+=render_state.iba_offset+start_index; @@ -2282,7 +2282,7 @@ void DX8Wrapper::Apply_Render_State_Changes() { if (render_state_changed&mask) { - SNAPSHOT_SAY(("DX8 - apply texture %d (%s)",i,render_state.Textures[i] ? render_state.Textures[i]->Get_Full_Path().str() : "NULL")); + SNAPSHOT_SAY(("DX8 - apply texture %d (%s)",i,render_state.Textures[i] ? render_state.Textures[i]->Get_Full_Path().str() : "null")); if (render_state.Textures[i]) { @@ -2333,7 +2333,7 @@ void DX8Wrapper::Apply_Render_State_Changes() Set_DX8_Light(index,&render_state.Lights[index]); } else { - Set_DX8_Light(index,NULL); + Set_DX8_Light(index,nullptr); SNAPSHOT_SAY((" clearing light to NULL")); } } @@ -2375,7 +2375,7 @@ void DX8Wrapper::Apply_Render_State_Changes() WWASSERT(0); } } else { - DX8CALL(SetStreamSource(i,NULL,0)); + DX8CALL(SetStreamSource(i,nullptr,0)); DX8_RECORD_VERTEX_BUFFER_CHANGE(); } } @@ -2400,7 +2400,7 @@ void DX8Wrapper::Apply_Render_State_Changes() } else { DX8CALL(SetIndices( - NULL, + nullptr, 0)); DX8_RECORD_INDEX_BUFFER_CHANGE(); } @@ -2423,7 +2423,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2432,7 +2432,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture // format that is supported and use that instead. // Render target may return NOTAVAILABLE, in - // which case we return NULL. + // which case we return null. if (rendertarget) { unsigned ret=D3DXCreateTexture( DX8Wrapper::_Get_D3D_Device8(), @@ -2446,7 +2446,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } // If ran out of texture ram, try invalidating some textures and mesh cache. @@ -2476,7 +2476,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture } if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2540,7 +2540,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; // NOTE: If the original image format is not supported as a texture format, it will // automatically be converted to an appropriate format. @@ -2559,8 +2559,8 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture D3DX_FILTER_BOX, D3DX_FILTER_BOX, 0, - NULL, - NULL, + nullptr, + nullptr, &texture); if (result != D3D_OK) { @@ -2585,7 +2585,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8 *texture = NULL; + IDirect3DTexture8 *texture = nullptr; D3DSURFACE_DESC surface_desc; ::ZeroMemory(&surface_desc, sizeof(D3DSURFACE_DESC)); @@ -2597,15 +2597,15 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture texture = _Create_DX8_Texture(surface_desc.Width, surface_desc.Height, format, mip_level_count); // Copy the surface to the texture - IDirect3DSurface8 *tex_surface = NULL; + IDirect3DSurface8 *tex_surface = nullptr; texture->GetSurfaceLevel(0, &tex_surface); - DX8_ErrorCode(D3DXLoadSurfaceFromSurface(tex_surface, NULL, NULL, surface, NULL, NULL, D3DX_FILTER_BOX, 0)); + DX8_ErrorCode(D3DXLoadSurfaceFromSurface(tex_surface, nullptr, nullptr, surface, nullptr, nullptr, D3DX_FILTER_BOX, 0)); tex_surface->Release(); // Create mipmaps if needed if (mip_level_count!=MIP_LEVELS_1) { - DX8_ErrorCode(D3DXFilterTexture(texture, NULL, 0, D3DX_FILTER_BOX)); + DX8_ErrorCode(D3DXFilterTexture(texture, nullptr, 0, D3DX_FILTER_BOX)); } return texture; @@ -2626,7 +2626,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DTexture8* texture = NULL; + IDirect3DTexture8* texture = nullptr; D3DFORMAT zfmt=WW3DZFormat_To_D3DFormat(zformat); @@ -2644,7 +2644,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } // If ran out of texture ram, try invalidating some textures and mesh cache. @@ -2679,7 +2679,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2709,7 +2709,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture WWASSERT(width==height); DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DCubeTexture8* texture=NULL; + IDirect3DCubeTexture8* texture=nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2718,7 +2718,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture // format that is supported and use that instead. // Render target may return NOTAVAILABLE, in - // which case we return NULL. + // which case we return null. if (rendertarget) { unsigned ret=D3DXCreateCubeTexture @@ -2735,7 +2735,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (ret==D3DERR_NOTAVAILABLE) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } // If ran out of texture ram, try invalidating some textures and mesh cache. @@ -2770,7 +2770,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2846,7 +2846,7 @@ IDirect3DVolumeTexture8* DX8Wrapper::_Create_DX8_Volume_Texture { DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DVolumeTexture8* texture=NULL; + IDirect3DVolumeTexture8* texture=nullptr; // Paletted textures not supported! WWASSERT(format!=D3DFMT_P8); @@ -2916,7 +2916,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(unsigned int width, unsigned DX8_THREAD_ASSERT(); DX8_Assert(); - IDirect3DSurface8 *surface = NULL; + IDirect3DSurface8 *surface = nullptr; // Paletted surfaces not supported! WWASSERT(format!=D3DFMT_P8); @@ -2940,7 +2940,7 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_) // the file data and use D3DXLoadSurfaceFromFile. This is a horrible hack, but it saves us // having to write file loaders. Will fix this when D3DX provides us with the right functions. // Create a surface the size of the file image data - IDirect3DSurface8 *surface = NULL; + IDirect3DSurface8 *surface = nullptr; { @@ -3167,12 +3167,12 @@ void DX8Wrapper::Set_Light_Environment(LightEnvironmentClass* light_env) } for (;l<4;++l) { - Set_Light(l,NULL); + Set_Light(l,nullptr); } } /* else { for (int l=0;l<4;++l) { - Set_Light(l,NULL); + Set_Light(l,nullptr); } } */ @@ -3185,7 +3185,7 @@ IDirect3DSurface8 * DX8Wrapper::_Get_DX8_Front_Buffer() DX8CALL(GetDisplayMode(&mode)); - IDirect3DSurface8 * fb=NULL; + IDirect3DSurface8 * fb=nullptr; DX8CALL(CreateImageSurface(mode.Width,mode.Height,D3DFMT_A8R8G8B8,&fb)); @@ -3198,7 +3198,7 @@ SurfaceClass * DX8Wrapper::_Get_DX8_Back_Buffer(unsigned int num) DX8_THREAD_ASSERT(); IDirect3DSurface8 * bb; - SurfaceClass *surf=NULL; + SurfaceClass *surf=nullptr; DX8CALL(GetBackBuffer(num,D3DBACKBUFFER_TYPE_MONO,&bb)); if (bb) { @@ -3224,10 +3224,10 @@ DX8Wrapper::Create_Render_Target (int width, int height, WW3DFormat format) format=D3DFormat_To_WW3DFormat(mode.Format); } - // If render target format isn't supported return NULL + // If render target format isn't supported return null if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format)) { WWDEBUG_SAY(("DX8Wrapper - Render target format is not supported")); - return NULL; + return nullptr; } // @@ -3256,7 +3256,7 @@ DX8Wrapper::Create_Render_Target (int width, int height, WW3DFormat format) // 3dfx drivers are lying in the CheckDeviceFormat call and claiming // that they support render targets! - if (tex->Peek_D3D_Base_Texture() == NULL) + if (tex->Peek_D3D_Base_Texture() == nullptr) { WWDEBUG_SAY(("DX8Wrapper - Render target creation failed!")); REF_PTR_RELEASE(tex); @@ -3286,15 +3286,15 @@ void DX8Wrapper::Create_Render_Target // Use the current display format if format isn't specified if (format==WW3D_FORMAT_UNKNOWN) { - *target=NULL; - *depth_buffer=NULL; + *target=nullptr; + *depth_buffer=nullptr; return; /* D3DDISPLAYMODE mode; DX8CALL(GetDisplayMode(&mode)); format=D3DFormat_To_WW3DFormat(mode.Format);*/ } - // If render target format isn't supported return NULL + // If render target format isn't supported return null if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format) || !Get_Current_Caps()->Support_Depth_Stencil_Format(zformat)) { @@ -3328,7 +3328,7 @@ void DX8Wrapper::Create_Render_Target // 3dfx drivers are lying in the CheckDeviceFormat call and claiming // that they support render targets! - if (tex->Peek_D3D_Base_Texture() == NULL) + if (tex->Peek_D3D_Base_Texture() == nullptr) { WWDEBUG_SAY(("DX8Wrapper - Render target creation failed!")); REF_PTR_RELEASE(tex); @@ -3360,16 +3360,16 @@ void DX8Wrapper::Set_Render_Target_With_Z ZTextureClass* ztexture ) { - WWASSERT(texture!=NULL); + WWASSERT(texture!=nullptr); IDirect3DSurface8 * d3d_surf = texture->Get_D3D_Surface_Level(); - WWASSERT(d3d_surf != NULL); + WWASSERT(d3d_surf != nullptr); - IDirect3DSurface8* d3d_zbuf=NULL; - if (ztexture!=NULL) + IDirect3DSurface8* d3d_zbuf=nullptr; + if (ztexture!=nullptr) { d3d_zbuf=ztexture->Get_D3D_Surface_Level(); - WWASSERT(d3d_zbuf!=NULL); + WWASSERT(d3d_zbuf!=nullptr); Set_Render_Target(d3d_surf,d3d_zbuf); d3d_zbuf->Release(); } @@ -3386,12 +3386,12 @@ void DX8Wrapper::Set_Render_Target(IDirect3DSwapChain8 *swap_chain) { DX8_THREAD_ASSERT(); - WWASSERT (swap_chain != NULL); + WWASSERT (swap_chain != nullptr); // // Get the back buffer for the swap chain // - LPDIRECT3DSURFACE8 render_target = NULL; + LPDIRECT3DSURFACE8 render_target = nullptr; swap_chain->GetBackBuffer (0, D3DBACKBUFFER_TYPE_MONO, &render_target); // @@ -3402,9 +3402,9 @@ DX8Wrapper::Set_Render_Target(IDirect3DSwapChain8 *swap_chain) // // Release our hold on the back buffer // - if (render_target != NULL) { + if (render_target != nullptr) { render_target->Release (); - render_target = NULL; + render_target = nullptr; } IsRenderToTexture = false; @@ -3422,62 +3422,62 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Should we restore the default render target set a new one? // - if (render_target == NULL || render_target == DefaultRenderTarget) + if (render_target == nullptr || render_target == DefaultRenderTarget) { - // If there is currently a custom render target, default must NOT be NULL. + // If there is currently a custom render target, default must NOT be null. if (CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget!=NULL); + WWASSERT(DefaultRenderTarget!=nullptr); } // // Restore the default render target // - if (DefaultRenderTarget != NULL) + if (DefaultRenderTarget != nullptr) { DX8CALL(SetRenderTarget (DefaultRenderTarget, DefaultDepthBuffer)); DefaultRenderTarget->Release (); - DefaultRenderTarget = NULL; + DefaultRenderTarget = nullptr; if (DefaultDepthBuffer) { DefaultDepthBuffer->Release (); - DefaultDepthBuffer = NULL; + DefaultDepthBuffer = nullptr; } } // // Release our hold on the "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } } else if (render_target != CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget==NULL); + WWASSERT(DefaultRenderTarget==nullptr); // // We'll need the depth buffer later... // - if (DefaultDepthBuffer == NULL) + if (DefaultDepthBuffer == nullptr) { -// IDirect3DSurface8 *depth_buffer = NULL; +// IDirect3DSurface8 *depth_buffer = nullptr; DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer)); } // // Get a pointer to the default render target (if necessary) // - if (DefaultRenderTarget == NULL) + if (DefaultRenderTarget == nullptr) { DX8CALL(GetRenderTarget (&DefaultRenderTarget)); } @@ -3485,24 +3485,24 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Release our hold on the old "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } // // Keep a copy of the current render target (for housekeeping) // CurrentRenderTarget = render_target; - WWASSERT (CurrentRenderTarget != NULL); - if (CurrentRenderTarget != NULL) + WWASSERT (CurrentRenderTarget != nullptr); + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->AddRef (); @@ -3515,7 +3515,7 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default } else { - DX8CALL(SetRenderTarget (CurrentRenderTarget, NULL)); + DX8CALL(SetRenderTarget (CurrentRenderTarget, nullptr)); } } } @@ -3523,9 +3523,9 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default // // Free our hold on the depth buffer // -// if (depth_buffer != NULL) { +// if (depth_buffer != nullptr) { // depth_buffer->Release (); -// depth_buffer = NULL; +// depth_buffer = nullptr; // } IsRenderToTexture = false; @@ -3551,61 +3551,61 @@ void DX8Wrapper::Set_Render_Target // // Should we restore the default render target set a new one? // - if (render_target == NULL || render_target == DefaultRenderTarget) + if (render_target == nullptr || render_target == DefaultRenderTarget) { - // If there is currently a custom render target, default must NOT be NULL. + // If there is currently a custom render target, default must NOT be null. if (CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget!=NULL); + WWASSERT(DefaultRenderTarget!=nullptr); } // // Restore the default render target // - if (DefaultRenderTarget != NULL) + if (DefaultRenderTarget != nullptr) { DX8CALL(SetRenderTarget (DefaultRenderTarget, DefaultDepthBuffer)); DefaultRenderTarget->Release (); - DefaultRenderTarget = NULL; + DefaultRenderTarget = nullptr; if (DefaultDepthBuffer) { DefaultDepthBuffer->Release (); - DefaultDepthBuffer = NULL; + DefaultDepthBuffer = nullptr; } } // // Release our hold on the "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } } else if (render_target != CurrentRenderTarget) { - WWASSERT(DefaultRenderTarget==NULL); + WWASSERT(DefaultRenderTarget==nullptr); // // We'll need the depth buffer later... // - if (DefaultDepthBuffer == NULL) + if (DefaultDepthBuffer == nullptr) { -// IDirect3DSurface8 *depth_buffer = NULL; +// IDirect3DSurface8 *depth_buffer = nullptr; DX8CALL(GetDepthStencilSurface (&DefaultDepthBuffer)); } // // Get a pointer to the default render target (if necessary) // - if (DefaultRenderTarget == NULL) + if (DefaultRenderTarget == nullptr) { DX8CALL(GetRenderTarget (&DefaultRenderTarget)); } @@ -3613,16 +3613,16 @@ void DX8Wrapper::Set_Render_Target // // Release our hold on the old "current" render target // - if (CurrentRenderTarget != NULL) + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->Release (); - CurrentRenderTarget = NULL; + CurrentRenderTarget = nullptr; } - if (CurrentDepthBuffer!=NULL) + if (CurrentDepthBuffer!=nullptr) { CurrentDepthBuffer->Release(); - CurrentDepthBuffer=NULL; + CurrentDepthBuffer=nullptr; } // @@ -3630,8 +3630,8 @@ void DX8Wrapper::Set_Render_Target // CurrentRenderTarget = render_target; CurrentDepthBuffer = depth_buffer; - WWASSERT (CurrentRenderTarget != NULL); - if (CurrentRenderTarget != NULL) + WWASSERT (CurrentRenderTarget != nullptr); + if (CurrentRenderTarget != nullptr) { CurrentRenderTarget->AddRef (); CurrentDepthBuffer->AddRef(); @@ -3672,7 +3672,7 @@ DX8Wrapper::Create_Additional_Swap_Chain (HWND render_window) // // Create the swap chain // - IDirect3DSwapChain8 *swap_chain = NULL; + IDirect3DSwapChain8 *swap_chain = nullptr; DX8CALL(CreateAdditionalSwapChain(¶ms, &swap_chain)); return swap_chain; } @@ -3868,15 +3868,15 @@ void DX8Wrapper::Apply_Default_State() //Set_DX8_Texture_Stage_State(i, D3DTSS_RESULTARG, D3DTA_CURRENT); Set_DX8_Texture_Stage_State(i, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); - Set_Texture(i,NULL); + Set_Texture(i,nullptr); } -// DX8Wrapper::Set_Material(NULL); +// DX8Wrapper::Set_Material(nullptr); VertexMaterialClass::Apply_Null(); for (unsigned index=0;index<4;++index) { SNAPSHOT_SAY(("Clearing light %d to NULL",index)); - Set_DX8_Light(index,NULL); + Set_DX8_Light(index,nullptr); } // set up simple default TSS diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index db5b93030cb..e7e08b11dc8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -468,9 +468,9 @@ class DX8Wrapper ** WW3D::Render (scene, camera, FALSE, FALSE); ** WW3D::End_Render (); ** - ** swap_chain_ptr->Present (NULL, NULL, NULL, NULL); + ** swap_chain_ptr->Present (nullptr, nullptr, nullptr, nullptr); ** - ** DX8Wrapper::Set_Render_Target ((IDirect3DSurface8 *)NULL); + ** DX8Wrapper::Set_Render_Target ((IDirect3DSurface8 *)nullptr); ** */ static IDirect3DSwapChain8 * Create_Additional_Swap_Chain (HWND render_window); @@ -496,7 +496,7 @@ class DX8Wrapper TextureClass** target, ZTextureClass** depth_buffer ); - static void Set_Render_Target_With_Z (TextureClass * texture, ZTextureClass* ztexture=NULL); + static void Set_Render_Target_With_Z (TextureClass * texture, ZTextureClass* ztexture=nullptr); static void Set_Shadow_Map(int idx, ZTextureClass* ztex) { Shadow_Map[idx]=ztex; } static ZTextureClass* Get_Shadow_Map(int idx) { return Shadow_Map[idx]; } @@ -837,7 +837,7 @@ WWINLINE void DX8Wrapper::Set_Ambient(const Vector3& color) // // Set vertex buffer to be used in the subsequent render calls. If there was // a vertex buffer being used earlier, release the reference to it. Passing -// NULL just will release the vertex buffer. +// nullptr just will release the vertex buffer. // // ---------------------------------------------------------------------------- @@ -1192,7 +1192,7 @@ WWINLINE void DX8Wrapper::Set_Material(const VertexMaterialClass* material) // } REF_PTR_SET(render_state.material,const_cast(material)); render_state_changed|=MATERIAL_CHANGED; - SNAPSHOT_SAY(("DX8Wrapper::Set_Material(%s)",material ? material->Get_Name() : "NULL")); + SNAPSHOT_SAY(("DX8Wrapper::Set_Material(%s)",material ? material->Get_Name() : "null")); } WWINLINE void DX8Wrapper::Set_Shader(const ShaderClass& shader) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp index 8d3faef5209..27501dede48 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp @@ -95,11 +95,11 @@ HAnimManagerClass::~HAnimManagerClass(void) Reset_Missing(); // Jani: Deleting missing animations as well delete AnimPtrTable; - AnimPtrTable = NULL; + AnimPtrTable = nullptr; Reset_Missing(); delete MissingAnimTable; - MissingAnimTable = NULL; + MissingAnimTable = nullptr; } @@ -154,7 +154,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) { HMorphAnimClass * newanim = W3DNEW HMorphAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -164,7 +164,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -197,7 +197,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) { HRawAnimClass * newanim = W3DNEW HRawAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -207,7 +207,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -240,7 +240,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) { HCompressedAnimClass * newanim = W3DNEW HCompressedAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -250,7 +250,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) // load failed! newanim->Release_Ref(); goto Error; - } else if (Peek_Anim(newanim->Get_Name()) != NULL) { + } else if (Peek_Anim(newanim->Get_Name()) != nullptr) { // duplicate exists! newanim->Release_Ref(); // Release the one we just loaded goto Error; @@ -299,7 +299,7 @@ HAnimClass * HAnimManagerClass::Peek_Anim(const char * name) HAnimClass * HAnimManagerClass::Get_Anim(const char * name) { HAnimClass * anim = Peek_Anim( name ); - if ( anim != NULL ) { + if ( anim != nullptr ) { anim->Add_Ref(); } return anim; @@ -385,7 +385,7 @@ void HAnimManagerClass::Create_Asset_List(DynamicVectorClass & excl // Anims are named in the format: . const char * anim_name = anim->Get_Name(); const char * filename = strchr(anim_name,'.'); - if (filename != NULL) { + if (filename != nullptr) { exclusion_list.Add(StringClass(filename+1)); } } @@ -406,7 +406,7 @@ void HAnimManagerClass::Create_Asset_List(DynamicVectorClass & excl *=============================================================================================*/ bool HAnimManagerClass::Add_Anim(HAnimClass *new_anim) { - WWASSERT (new_anim != NULL); + WWASSERT (new_anim != nullptr); // Increment the refcount on the W3DNEW animation and add it to our table. new_anim->Add_Ref (); @@ -420,7 +420,7 @@ bool HAnimManagerClass::Add_Anim(HAnimClass *new_anim) ** Missing Anims ** ** The idea here, allow the system to register which anims are determined to be missing -** so that if they are asked for again, we can quickly return NULL, without searching the +** so that if they are asked for again, we can quickly return nullptr, without searching the ** disk again. */ void HAnimManagerClass::Register_Missing( const char * name ) @@ -430,7 +430,7 @@ void HAnimManagerClass::Register_Missing( const char * name ) bool HAnimManagerClass::Is_Missing( const char * name ) { - return ( MissingAnimTable->Find( name ) != NULL ); + return ( MissingAnimTable->Find( name ) != nullptr ); } void HAnimManagerClass::Reset_Missing( void ) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 383a03d2825..a572399c2f4 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -71,8 +71,8 @@ * HLodClass::Peek_Additional_Model -- returns pointer to an additional model * * HLodClass::Get_Additional_Model -- returns pointer to an additional model * * HLodClass::Get_Additional_Model_Bone -- returns the bone index of an additional model * - * HLodClass::Is_NULL_Lod_Included -- does this HLod have NULL as its lowest LOD * - * HLodClass::Include_NULL_Lod -- Add NULL as the lowest LOD * + * HLodClass::Is_NULL_Lod_Included -- does this HLod have nullptr as its lowest LOD * + * HLodClass::Include_NULL_Lod -- Add nullptr as the lowest LOD * * HLodClass::Get_Num_Polys -- returns polycount of the current LOD * * HLodClass::Render -- render this HLod * * HLodClass::Special_Render -- Special_Render for HLod * @@ -213,21 +213,21 @@ PrototypeClass *HLodLoaderClass::Load_W3D( ChunkLoadClass &cload ) { HLodDefClass * def = W3DNEW HLodDefClass; - if (def == NULL) + if (def == nullptr) { - return NULL; + return nullptr; } if (def->Load_W3D(cload) != WW3D_ERROR_OK) { // load failed, delete the model and return an error delete def; - return NULL; + return nullptr; } else { // ok, accept this model! HLodPrototypeClass *proto = W3DNEW HLodPrototypeClass(def); return proto; } - return NULL; + return nullptr; } @@ -270,11 +270,11 @@ RenderObjClass * HLodPrototypeClass::Create(void) * HISTORY: * *=============================================================================================*/ HLodDefClass::HLodDefClass(void) : - Name(NULL), - HierarchyTreeName(NULL), + Name(nullptr), + HierarchyTreeName(nullptr), LodCount(0), - Lod(NULL), - ProxyArray(NULL) + Lod(nullptr), + ProxyArray(nullptr) { } @@ -292,11 +292,11 @@ HLodDefClass::HLodDefClass(void) : * 1/26/00 gth : Created. * *=============================================================================================*/ HLodDefClass::HLodDefClass(HLodClass &src_lod) : - Name(NULL), - HierarchyTreeName(NULL), + Name(nullptr), + HierarchyTreeName(nullptr), LodCount(0), - Lod(NULL), - ProxyArray(NULL) + Lod(nullptr), + ProxyArray(nullptr) { Initialize (src_lod); return ; @@ -337,13 +337,13 @@ HLodDefClass::~HLodDefClass(void) void HLodDefClass::Free(void) { ::free(Name); - Name = NULL; + Name = nullptr; ::free(HierarchyTreeName); - HierarchyTreeName = NULL; + HierarchyTreeName = nullptr; delete[] Lod; - Lod = NULL; + Lod = nullptr; LodCount = 0; REF_PTR_RELEASE(ProxyArray); @@ -372,7 +372,7 @@ void HLodDefClass::Initialize(HLodClass &src_lod) // Copy the name and hierarcy name from the source object Name = ::strdup (src_lod.Get_Name ()); const HTreeClass *phtree = src_lod.Get_HTree (); - if (phtree != NULL) { + if (phtree != nullptr) { HierarchyTreeName = ::strdup (phtree->Get_Name ()); } @@ -398,11 +398,11 @@ void HLodDefClass::Initialize(HLodClass &src_lod) // Record information about this model (if possible) RenderObjClass *prender_obj = src_lod.Peek_Lod_Model (index, model_index); - if (prender_obj != NULL) { + if (prender_obj != nullptr) { model_names[model_index] = ::strdup (prender_obj->Get_Name ()); bone_indicies[model_index] = src_lod.Get_Lod_Model_Bone (index, model_index); } else { - model_names[model_index] = NULL; + model_names[model_index] = nullptr; bone_indicies[model_index] = 0; } } @@ -723,8 +723,8 @@ bool HLodDefClass::read_proxy_array(ChunkLoadClass & cload) HLodDefClass::SubObjectArrayClass::SubObjectArrayClass(void) : MaxScreenSize(NO_MAX_SCREEN_SIZE), ModelCount(0), - ModelName(NULL), - BoneIndex(NULL) + ModelName(nullptr), + BoneIndex(nullptr) { } @@ -763,16 +763,16 @@ void HLodDefClass::SubObjectArrayClass::Reset(void) { MaxScreenSize = NO_MAX_SCREEN_SIZE; - if (ModelName != NULL) { + if (ModelName != nullptr) { for (int imodel=0; imodel 0) && (count < 256)); // Set the name @@ -1007,7 +1007,7 @@ HLodClass::HLodClass(const char * name,RenderObjClass ** lods,int count) : // Create our HTree from the highest LOD if it is an HModel // Otherwise, create a single node tree const HTreeClass * tree = lods[count-1]->Get_HTree(); - if (tree != NULL) { + if (tree != nullptr) { HTree = W3DNEW HTreeClass(*tree); } else { HTree = W3DNEW HTreeClass(); @@ -1078,13 +1078,13 @@ HLodClass::HLodClass(const HLodDefClass & def) : Animatable3DObjClass(def.HierarchyTreeName), LodCount(0), CurLod(0), - Lod(NULL), + Lod(nullptr), BoundingBoxIndex(-1), - Cost(NULL), - Value(NULL), + Cost(nullptr), + Value(nullptr), AdditionalModels(), - SnapPoints(NULL), - ProxyArray(NULL), + SnapPoints(nullptr), + ProxyArray(nullptr), LODBias(1.0f) { // Set the name @@ -1112,7 +1112,7 @@ HLodClass::HLodClass(const HLodDefClass & def) : RenderObjClass * robj = WW3DAssetManager::Get_Instance()->Create_Render_Obj(def.Lod[ilod].ModelName[imodel]); int boneindex = def.Lod[ilod].BoneIndex[imodel]; - if (robj != NULL) { + if (robj != nullptr) { Add_Lod_Model(ilod,robj,boneindex); robj->Release_Ref(); } @@ -1125,7 +1125,7 @@ HLodClass::HLodClass(const HLodDefClass & def) : for (int iagg=0; iaggCreate_Render_Obj(def.Aggregates.ModelName[iagg]); int boneindex = def.Aggregates.BoneIndex[iagg]; - if (robj != NULL) { + if (robj != nullptr) { Add_Sub_Object_To_Bone(robj,boneindex); robj->Release_Ref(); } @@ -1167,13 +1167,13 @@ HLodClass::HLodClass(const HModelDefClass & def) : Animatable3DObjClass(def.BasePoseName), LodCount(0), CurLod(0), - Lod(NULL), + Lod(nullptr), BoundingBoxIndex(-1), - Cost(NULL), - Value(NULL), + Cost(nullptr), + Value(nullptr), AdditionalModels(), - SnapPoints(NULL), - ProxyArray(NULL), + SnapPoints(nullptr), + ProxyArray(nullptr), LODBias(1.0f) { // Set the name @@ -1248,7 +1248,7 @@ HLodClass & HLodClass::operator = (const HLodClass & that) WWASSERT(LodCount >= 1); Lod = W3DNEWARRAY ModelArrayClass[LodCount]; - WWASSERT(Lod != NULL); + WWASSERT(Lod != nullptr); Cost = W3DNEWARRAY float[LodCount]; WWASSERT(Cost); // Value has LodCount + 1 entries so PostIncrementValue can always use @@ -1349,10 +1349,10 @@ void HLodClass::Free(void) for (model = 0; model < Lod[lod].Count(); model++) { RenderObjClass * robj = Lod[lod][model].Model; - Lod[lod][model].Model = NULL; + Lod[lod][model].Model = nullptr; WWASSERT(robj); - robj->Set_Container(NULL); + robj->Set_Container(nullptr); robj->Release_Ref(); } @@ -1361,21 +1361,21 @@ void HLodClass::Free(void) } delete[] Lod; - Lod = NULL; + Lod = nullptr; LodCount = 0; delete[] Cost; - Cost = NULL; + Cost = nullptr; delete[] Value; - Value = NULL; + Value = nullptr; for (model = 0; model < AdditionalModels.Count(); model++) { RenderObjClass * robj = AdditionalModels[model].Model; - AdditionalModels[model].Model = NULL; + AdditionalModels[model].Model = nullptr; WWASSERT(robj); - robj->Set_Container(NULL); + robj->Set_Container(nullptr); robj->Release_Ref(); } AdditionalModels.Delete_All(); @@ -1424,7 +1424,7 @@ void HLodClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const if (BoundingBoxIndex >= 0 && BoundingBoxIndex < count) { RenderObjClass *mesh = Lod[LodCount - 1][BoundingBoxIndex].Model; - if (mesh != NULL && mesh->Class_ID () == RenderObjClass::CLASSID_OBBOX) { + if (mesh != nullptr && mesh->Class_ID () == RenderObjClass::CLASSID_OBBOX) { OBBoxRenderObjClass *obbox_mesh = (OBBoxRenderObjClass *)mesh; @@ -1707,7 +1707,7 @@ int HLodClass::Get_Lod_Model_Count(int lod_index) const *=============================================================================================*/ RenderObjClass *HLodClass::Peek_Lod_Model(int lod_index, int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Params valid? WWASSERT(lod_index >= 0); @@ -1739,7 +1739,7 @@ RenderObjClass *HLodClass::Peek_Lod_Model(int lod_index, int model_index) const *=============================================================================================*/ RenderObjClass *HLodClass::Get_Lod_Model(int lod_index, int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Params valid? WWASSERT(lod_index >= 0); @@ -1750,7 +1750,7 @@ RenderObjClass *HLodClass::Get_Lod_Model(int lod_index, int model_index) const // Get a pointer to the requested model pmodel = Lod[lod_index][model_index].Model; - if (pmodel != NULL) { + if (pmodel != nullptr) { pmodel->Add_Ref (); } } @@ -1824,7 +1824,7 @@ int HLodClass::Get_Additional_Model_Count(void) const *=============================================================================================*/ RenderObjClass * HLodClass::Peek_Additional_Model (int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Param valid? WWASSERT(model_index >= 0); @@ -1855,7 +1855,7 @@ RenderObjClass * HLodClass::Peek_Additional_Model (int model_index) const *=============================================================================================*/ RenderObjClass * HLodClass::Get_Additional_Model (int model_index) const { - RenderObjClass *pmodel = NULL; + RenderObjClass *pmodel = nullptr; // Param valid? WWASSERT(model_index >= 0); @@ -1865,7 +1865,7 @@ RenderObjClass * HLodClass::Get_Additional_Model (int model_index) const // Get a pointer to the requested model pmodel = AdditionalModels[model_index].Model; - if (pmodel != NULL) { + if (pmodel != nullptr) { pmodel->Add_Ref (); } } @@ -1907,7 +1907,7 @@ int HLodClass::Get_Additional_Model_Bone (int model_index) const /*********************************************************************************************** - * HLodClass::Is_NULL_Lod_Included -- does this HLod have NULL as its lowest LOD * + * HLodClass::Is_NULL_Lod_Included -- does this HLod have nullptr as its lowest LOD * * * * INPUT: * * * @@ -1923,7 +1923,7 @@ bool HLodClass::Is_NULL_Lod_Included(void) const bool included = false; // Determine if the lowest-level LOD is the null render object or not... - if ((LodCount > 0) && (Lod[0][0].Model != NULL)) { + if ((LodCount > 0) && (Lod[0][0].Model != nullptr)) { included = (Lod[0][0].Model->Class_ID () == RenderObjClass::CLASSID_NULL); } @@ -1933,7 +1933,7 @@ bool HLodClass::Is_NULL_Lod_Included(void) const /*********************************************************************************************** - * HLodClass::Include_NULL_Lod -- Add NULL as the lowest LOD * + * HLodClass::Include_NULL_Lod -- Add nullptr as the lowest LOD * * * * INPUT: * * * @@ -1948,15 +1948,15 @@ void HLodClass::Include_NULL_Lod(bool include) { if ((include == false) && Is_NULL_Lod_Included ()) { - // Free the 'NULL' object's stored information + // Free the 'nullptr' object's stored information int index = 0; for (int model = 0; model < Lod[index].Count (); model++) { RenderObjClass * robj = Lod[index][model].Model; - Lod[index][model].Model = NULL; + Lod[index][model].Model = nullptr; WWASSERT(robj); - robj->Set_Container (NULL); + robj->Set_Container (nullptr); robj->Release_Ref (); } @@ -1984,10 +1984,10 @@ void HLodClass::Include_NULL_Lod(bool include) } else if (include && (Is_NULL_Lod_Included () == false)) { - // Tag the NULL render object onto the end + // Tag the nullptr render object onto the end RenderObjClass *null_object = WW3DAssetManager::Get_Instance ()->Create_Render_Obj ("NULL"); - WWASSERT (null_object != NULL); - if (null_object != NULL) { + WWASSERT (null_object != nullptr); + if (null_object != nullptr) { // Resize the lod array ModelArrayClass *temp_lods = W3DNEWARRAY ModelArrayClass[LodCount + 1]; @@ -2009,7 +2009,7 @@ void HLodClass::Include_NULL_Lod(bool include) Cost = temp_cost; LodCount ++; - // Add this NULL object to the start of the lod list + // Add this null object to the start of the lod list Add_Lod_Model (0, null_object, 0); null_object->Release_Ref (); } @@ -2039,7 +2039,7 @@ void HLodClass::Include_NULL_Lod(bool include) *=============================================================================================*/ int HLodClass::Get_Proxy_Count(void) const { - if (ProxyArray != NULL) { + if (ProxyArray != nullptr) { return ProxyArray->Length(); } else { return 0; @@ -2063,7 +2063,7 @@ bool HLodClass::Get_Proxy (int index, ProxyClass &proxy) const { bool retval = false; - if (ProxyArray != NULL) { + if (ProxyArray != nullptr) { // // Lookup the proxy's transform @@ -2376,7 +2376,7 @@ int HLodClass::Add_Sub_Object(RenderObjClass * subobj) int HLodClass::Remove_Sub_Object(RenderObjClass * removeme) { // no object given? - if (removeme == NULL) { + if (removeme == nullptr) { return 0; } @@ -2413,7 +2413,7 @@ int HLodClass::Remove_Sub_Object(RenderObjClass * removeme) if (found) { // clear the object's container pointer - removeme->Set_Container(NULL); + removeme->Set_Container(nullptr); // let him know in case he is removed from the scene as a result of this // this is the combination of this HLod being in the scene and and this model @@ -2499,7 +2499,7 @@ RenderObjClass * HLodClass::Get_Sub_Object_On_Bone(int index,int boneindex) cons count++; } } - return NULL; + return nullptr; } @@ -3206,7 +3206,7 @@ RenderObjClass * HLodClass::Get_Current_LOD(void) int count = Get_Lod_Model_Count(CurLod); if(!count) - return 0; + return nullptr; return Get_Lod_Model(CurLod, 0); } @@ -3318,7 +3318,7 @@ int HLodClass::Get_Num_Snap_Points(void) *=============================================================================================*/ void HLodClass::Get_Snap_Point(int index,Vector3 * set) { - WWASSERT(set != NULL); + WWASSERT(set != nullptr); if (SnapPoints) { *set = (*SnapPoints)[index]; } else { @@ -3418,7 +3418,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) { const char *name = model->Get_Name (); const char *name_seg = ::strchr (name, '.'); - if (name_seg != NULL) { + if (name_seg != nullptr) { name = name_seg + 1; } @@ -3433,7 +3433,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) int i; - RenderObjClass * robj = NULL; + RenderObjClass * robj = nullptr; // if we don't have any sub objects, just set default bounds if (Get_Num_Sub_Objects() <= 0) { @@ -3509,7 +3509,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) *=============================================================================================*/ void HLodClass::Add_Lod_Model(int lod, RenderObjClass * robj, int boneindex) { - WWASSERT(robj != NULL); + WWASSERT(robj != nullptr); // (gth) survive the case where the skeleton for this object no longer has // the bone that we're trying to use. This happens when a skeleton is re-exported diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp index 0696c96d364..f89bfe8da1c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -195,9 +195,9 @@ HMorphAnimClass::HMorphAnimClass(void) : FrameRate(0.0f), ChannelCount(0), NumNodes(0), - PoseData(NULL), - MorphKeyData(NULL), - PivotChannel(NULL) + PoseData(nullptr), + MorphKeyData(nullptr), + PivotChannel(nullptr) { memset(Name,0,sizeof(Name)); memset(AnimName,0,sizeof(AnimName)); @@ -211,19 +211,19 @@ HMorphAnimClass::~HMorphAnimClass(void) void HMorphAnimClass::Free(void) { - if (PoseData != NULL) { + if (PoseData != nullptr) { for (int i=0; i= '0' && str[0] <= '9') || str[0] == '-' || str[0] == '.'); str ++; } @@ -349,7 +349,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Attempt to load the new base pose // HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - WWASSERT (base_pose != NULL); + WWASSERT (base_pose != nullptr); NumNodes = base_pose->Num_Pivots(); // @@ -362,7 +362,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Get the list of comma-delimited strings from the header // - StringClass *column_list = NULL; + StringClass *column_list = nullptr; int column_count = Build_List_From_String (header, ",", &column_list); // @@ -394,7 +394,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // // Get the frame descriptions from this line // - StringClass *channel_list = NULL; + StringClass *channel_list = nullptr; int list_count = Build_List_From_String (frame_desc, ",", &channel_list); WWASSERT (list_count > 0); @@ -427,7 +427,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] channel_list; - channel_list = NULL; + channel_list = nullptr; } // @@ -441,7 +441,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] column_list; - column_list = NULL; + column_list = nullptr; } return retval; @@ -449,7 +449,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des void HMorphAnimClass::Resolve_Pivot_Channels(void) { - WWASSERT (PivotChannel != NULL); + WWASSERT (PivotChannel != nullptr); // // Loop over all the pivots in the HTree @@ -482,7 +482,7 @@ void HMorphAnimClass::Set_Name(const char * name) // StringClass full_name = name; char *separator = ::strchr (full_name.Peek_Buffer(), '.'); - if (separator != NULL) { + if (separator != nullptr) { // // Null out the separator and copy the two names @@ -510,7 +510,7 @@ int HMorphAnimClass::Create_New_Morph(const int channels, HAnimClass *anim[]) ChannelCount = channels; // read in the animation header - if (anim == NULL) { + if (anim == nullptr) { return LOAD_ERROR; } @@ -558,7 +558,7 @@ int HMorphAnimClass::Load_W3D(ChunkLoadClass & cload) strlcat(Name, AnimName, ARRAY_SIZE(Name)); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - if (base_pose == NULL) { + if (base_pose == nullptr) { return LOAD_ERROR; } NumNodes = base_pose->Num_Pivots(); @@ -606,7 +606,7 @@ void HMorphAnimClass::read_channel(ChunkLoadClass & cload,int channel) //StringClass channel_anim_name; //channel_anim_name.Format ("%s.%s", HierarchyName, anim_name); PoseData[channel] = WW3DAssetManager::Get_Instance()->Get_HAnim(anim_name); - WWASSERT(PoseData[channel] != NULL); + WWASSERT(PoseData[channel] != nullptr); cload.Open_Chunk(); WWASSERT(cload.Cur_Chunk_ID() == W3D_CHUNK_MORPHANIM_KEYDATA); @@ -654,7 +654,7 @@ int HMorphAnimClass::Save_W3D(ChunkSaveClass & csave) void HMorphAnimClass::write_channel(ChunkSaveClass & csave,int channel) { - WWASSERT(PoseData[channel] != NULL); + WWASSERT(PoseData[channel] != nullptr); const char * pose_name = PoseData[channel]->Get_Name(); csave.Begin_Chunk(W3D_CHUNK_MORPHANIM_POSENAME); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index 17875705d1b..4757374fcea 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -68,14 +68,14 @@ * HISTORY: * *=============================================================================================*/ NodeMotionStruct::NodeMotionStruct() : - X(NULL), - Y(NULL), - Z(NULL), - XR(NULL), - YR(NULL), - ZR(NULL), - Q(NULL), - Vis(NULL) + X(nullptr), + Y(nullptr), + Z(nullptr), + XR(nullptr), + YR(nullptr), + ZR(nullptr), + Q(nullptr), + Vis(nullptr) { } @@ -121,7 +121,7 @@ HRawAnimClass::HRawAnimClass(void) : NumFrames(0), NumNodes(0), FrameRate(0), - NodeMotion(NULL) + NodeMotion(nullptr) { memset(Name,0,W3D_NAME_LEN); memset(HierarchyName,0,W3D_NAME_LEN); @@ -161,7 +161,7 @@ HRawAnimClass::~HRawAnimClass(void) void HRawAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -220,7 +220,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) strcpy(HierarchyName, aheader.HierarchyName); HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName); - if (base_pose == NULL) { + if (base_pose == nullptr) { goto Error; } NumNodes = base_pose->Num_Pivots(); @@ -229,7 +229,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) FrameRate = aheader.FrameRate; NodeMotion = W3DNEWARRAY NodeMotionStruct[ NumNodes ]; - if (NodeMotion == NULL) { + if (NodeMotion == nullptr) { goto Error; } @@ -430,7 +430,7 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co { struct NodeMotionStruct * motion = &NodeMotion[pividx]; - if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) { + if ( (motion->X == nullptr) && (motion->Y == nullptr) && (motion->Z == nullptr) ) { trans.Set(0.0f,0.0f,0.0f); return; } @@ -449,13 +449,13 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co Vector3 trans0(0.0f,0.0f,0.0f); - if (motion->X != NULL) { + if (motion->X != nullptr) { motion->X->Get_Vector((int)frame0,&(trans0[0])); } - if (motion->Y != NULL) { + if (motion->Y != nullptr) { motion->Y->Get_Vector((int)frame0,&(trans0[1])); } - if (motion->Z != NULL) { + if (motion->Z != nullptr) { motion->Z->Get_Vector((int)frame0,&(trans0[2])); } @@ -466,13 +466,13 @@ void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) co Vector3 trans1(0.0f,0.0f,0.0f); - if (motion->X != NULL) { + if (motion->X != nullptr) { motion->X->Get_Vector((int)frame1,&(trans1[0])); } - if (motion->Y != NULL) { + if (motion->Y != nullptr) { motion->Y->Get_Vector((int)frame1,&(trans1[1])); } - if (motion->Z != NULL) { + if (motion->Z != nullptr) { motion->Z->Get_Vector((int)frame1,&(trans1[2])); } @@ -510,7 +510,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const Quaternion q0, q1; MotionChannelClass* mc = NodeMotion[pividx].Q; - if (mc != NULL) + if (mc != nullptr) { mc->Get_Vector_As_Quat((int)frame0, q0); mc->Get_Vector_As_Quat((int)frame1, q1); @@ -538,7 +538,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const float vals[4]; Quaternion q0(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame0,vals); q0.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -549,7 +549,7 @@ void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const } Quaternion q1(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame1,vals); q1.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -574,7 +574,7 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const { struct NodeMotionStruct * motion = &NodeMotion[pividx]; -// if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) { +// if ( (motion->X == nullptr) && (motion->Y == nullptr) && (motion->Z == nullptr) ) { // trans.Set(0.0f,0.0f,0.0f); // return; // } @@ -592,21 +592,21 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const float vals[4]; Quaternion q0(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame0,vals); q0.Set(vals[0],vals[1],vals[2],vals[3]); } if ( ratio == 0.0f ) { ::Build_Matrix3D(q0,mtx); - if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(mtx[0][3])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(mtx[1][3])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(mtx[2][3])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame0,&(mtx[0][3])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame0,&(mtx[1][3])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame0,&(mtx[2][3])); return; } Quaternion q1(1); - if (NodeMotion[pividx].Q != NULL) { + if (NodeMotion[pividx].Q != nullptr) { NodeMotion[pividx].Q->Get_Vector((int)frame1,vals); q1.Set(vals[0],vals[1],vals[2],vals[3]); } @@ -616,14 +616,14 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const ::Build_Matrix3D(q,mtx); Vector3 trans0(0.0f,0.0f,0.0f); - if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(trans0[0])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(trans0[1])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(trans0[2])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame0,&(trans0[0])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame0,&(trans0[1])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame0,&(trans0[2])); Vector3 trans1(0.0f,0.0f,0.0f); - if (motion->X != NULL) motion->X->Get_Vector((int)frame1,&(trans1[0])); - if (motion->Y != NULL) motion->Y->Get_Vector((int)frame1,&(trans1[1])); - if (motion->Z != NULL) motion->Z->Get_Vector((int)frame1,&(trans1[2])); + if (motion->X != nullptr) motion->X->Get_Vector((int)frame1,&(trans1[0])); + if (motion->Y != nullptr) motion->Y->Get_Vector((int)frame1,&(trans1[1])); + if (motion->Z != nullptr) motion->Z->Get_Vector((int)frame1,&(trans1[2])); Vector3 trans; Vector3::Lerp( trans0, trans1, ratio, &trans ); @@ -645,7 +645,7 @@ void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const *=============================================================================================*/ bool HRawAnimClass::Get_Visibility(int pividx,float frame) { - if (NodeMotion[pividx].Vis != NULL) { + if (NodeMotion[pividx].Vis != nullptr) { return (NodeMotion[pividx].Vis->Get_Bit((int)frame) == 1); } @@ -670,14 +670,14 @@ bool HRawAnimClass::Is_Node_Motion_Present(int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - if (NodeMotion[pividx].X != NULL) return true; - if (NodeMotion[pividx].Y != NULL) return true; - if (NodeMotion[pividx].Z != NULL) return true; - if (NodeMotion[pividx].XR != NULL) return true; - if (NodeMotion[pividx].YR != NULL) return true; - if (NodeMotion[pividx].ZR != NULL) return true; - if (NodeMotion[pividx].Q != NULL) return true; - if (NodeMotion[pividx].Vis != NULL) return true; + if (NodeMotion[pividx].X != nullptr) return true; + if (NodeMotion[pividx].Y != nullptr) return true; + if (NodeMotion[pividx].Z != nullptr) return true; + if (NodeMotion[pividx].XR != nullptr) return true; + if (NodeMotion[pividx].YR != nullptr) return true; + if (NodeMotion[pividx].ZR != nullptr) return true; + if (NodeMotion[pividx].Q != nullptr) return true; + if (NodeMotion[pividx].Vis != nullptr) return true; return false; } @@ -685,31 +685,31 @@ bool HRawAnimClass::Is_Node_Motion_Present(int pividx) bool HRawAnimClass::Has_X_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].X != NULL; + return NodeMotion[pividx].X != nullptr; } bool HRawAnimClass::Has_Y_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Y != NULL; + return NodeMotion[pividx].Y != nullptr; } bool HRawAnimClass::Has_Z_Translation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Z != NULL; + return NodeMotion[pividx].Z != nullptr; } bool HRawAnimClass::Has_Rotation (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Q != NULL; + return NodeMotion[pividx].Q != nullptr; } bool HRawAnimClass::Has_Visibility (int pividx) { WWASSERT((pividx >= 0) && (pividx < NumNodes)); - return NodeMotion[pividx].Vis != NULL; + return NodeMotion[pividx].Vis != nullptr; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp index fde4a853fac..5cd52a2da58 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp @@ -67,7 +67,7 @@ HTreeManagerClass::HTreeManagerClass(void) : NumTrees(0) { for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } } @@ -124,7 +124,7 @@ void HTreeManagerClass::Free_All_Trees(void) for (int treeidx=0; treeidx < MAX_TREES; treeidx++) { delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } NumTrees = 0; } @@ -149,7 +149,7 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis int treeidx=0; for (; treeidx < MAX_TREES; treeidx++) { - if (TreePtr[treeidx] != NULL) { + if (TreePtr[treeidx] != nullptr) { if (exclusion_list.Is_Excluded(TreePtr[treeidx])) { @@ -161,7 +161,7 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis //WWDEBUG_SAY(("deleting tree %s",TreePtr[treeidx]->Get_Name())); delete TreePtr[treeidx]; - TreePtr[treeidx] = NULL; + TreePtr[treeidx] = nullptr; } } } @@ -197,7 +197,7 @@ int HTreeManagerClass::Load_Tree(ChunkLoadClass & cload) WWMEMLOG(MEM_ANIMATION); HTreeClass * newtree = W3DNEW HTreeClass; - if (newtree == NULL) { + if (newtree == nullptr) { goto Error; } @@ -275,7 +275,7 @@ char *HTreeManagerClass::Get_Tree_Name(const int idx) } } - return NULL; + return nullptr; } @@ -304,7 +304,7 @@ HTreeClass * HTreeManagerClass::Get_Tree(const char * name) // return TreePtr[i]; // } // } -// return NULL; +// return nullptr; } @@ -325,6 +325,6 @@ HTreeClass * HTreeManagerClass::Get_Tree(int id) if ((id >= 0) && (id < NumTrees)) { return TreePtr[id]; } else { - return NULL; + return nullptr; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp index b42a36c3fdc..5a88dbba226 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.cpp @@ -57,15 +57,15 @@ // the V coordinate is always 0 at the flat end of the tetrahedron // and 1 at the apex LineGroupClass::LineGroupClass(void) : - StartLineLoc(NULL), - EndLineLoc(NULL), - LineDiffuse(NULL), - TailDiffuse(NULL), - ALT(NULL), - LineSize(NULL), - LineUCoord(NULL), + StartLineLoc(nullptr), + EndLineLoc(nullptr), + LineDiffuse(nullptr), + TailDiffuse(nullptr), + ALT(nullptr), + LineSize(nullptr), + LineUCoord(nullptr), LineCount(0), - Texture(NULL), + Texture(nullptr), Flags(0), Shader(ShaderClass::_PresetAdditiveSpriteShader), DefaultLineSize(0.0f), @@ -249,7 +249,7 @@ void LineGroupClass::Render(RenderInfoClass &rinfo) Shader.Set_Primary_Gradient(ShaderClass::GRADIENT_DISABLE); } - // If Texture is non-NULL enable texturing in shader - otherwise disable. + // If Texture is non-null enable texturing in shader - otherwise disable. if (Texture) { Shader.Set_Texturing(ShaderClass::TEXTURING_ENABLE); } else { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h index 1e37ea0cd4f..751d58d076f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h @@ -72,11 +72,11 @@ class LineGroupClass void Set_Arrays( ShareBufferClass *startlocs, ShareBufferClass *endlocs, - ShareBufferClass *diffuse = NULL, - ShareBufferClass *taildiffuse = NULL, - ShareBufferClass *alt = NULL, - ShareBufferClass *sizes = NULL, - ShareBufferClass *ucoords = NULL, + ShareBufferClass *diffuse = nullptr, + ShareBufferClass *taildiffuse = nullptr, + ShareBufferClass *alt = nullptr, + ShareBufferClass *sizes = nullptr, + ShareBufferClass *ucoords = nullptr, int active_line_count = -1 ); void Set_Line_Size(float size); @@ -106,11 +106,11 @@ class LineGroupClass ShareBufferClass * StartLineLoc; // World/cameraspace point locs ShareBufferClass * EndLineLoc; // World/cameraspace point locs - ShareBufferClass * LineDiffuse; // (NULL if not used) RGBA values - ShareBufferClass * TailDiffuse; // (NULL if not used) RGBA values - ShareBufferClass * ALT; // (NULL if not used) active line table - ShareBufferClass * LineSize; // (NULL if not used) size override table - ShareBufferClass * LineUCoord; // (NULL if not used) U coordinates + ShareBufferClass * LineDiffuse; // (null if not used) RGBA values + ShareBufferClass * TailDiffuse; // (null if not used) RGBA values + ShareBufferClass * ALT; // (null if not used) active line table + ShareBufferClass * LineSize; // (null if not used) size override table + ShareBufferClass * LineUCoord; // (null if not used) U coordinates int LineCount; // Active (if ALT) or total point count TextureClass* Texture; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.cpp index 005b2567f13..d7dde3f2a66 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.cpp @@ -334,7 +334,7 @@ CompositeMatrixMapperClass::CompositeMatrixMapperClass(TextureMapperClass *inter *=============================================================================================*/ CompositeMatrixMapperClass::CompositeMatrixMapperClass(const CompositeMatrixMapperClass & src) : MatrixMapperClass(src), - InternalMapper(src.InternalMapper ? src.InternalMapper->Clone() : NULL) + InternalMapper(src.InternalMapper ? src.InternalMapper->Clone() : nullptr) { if (InternalMapper) { InternalMapper->Add_Ref(); @@ -357,7 +357,7 @@ CompositeMatrixMapperClass::~CompositeMatrixMapperClass(void) { if (InternalMapper) { InternalMapper->Release_Ref(); - InternalMapper = NULL; + InternalMapper = nullptr; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h index 13d2f8c846d..d079a4f8815 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h @@ -94,7 +94,7 @@ class MatrixMapperClass : public TextureMapperClass void Compute_Texture_Coordinate(const Vector3 & point,Vector3 * set_stq); - TextureMapperClass* Clone(void) const { WWASSERT(0); return NULL; } + TextureMapperClass* Clone(void) const { WWASSERT(0); return nullptr; } virtual void Apply(int uv_array_index); virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix); @@ -117,7 +117,7 @@ class MatrixMapperClass : public TextureMapperClass ** it with it's own matrix, then applies that. It sets the texture source to camera space ** position. The idea is to use some transformation of the camera space position (like a planar ** projection) as the 'input coordinates' to some other mapper like a linear offset mapper -** which usually uses actual texture coordinates as input. If the internal mapper is NULL, it +** which usually uses actual texture coordinates as input. If the internal mapper is null, it ** simply applies it's own matrix. */ class CompositeMatrixMapperClass : public MatrixMapperClass diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp index f96e6a8c049..4a11693f629 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -157,11 +157,11 @@ static DynamicVectorClass _TempVertexBuffer; * 1/6/98 GTH : Created. * *=============================================================================================*/ MeshClass::MeshClass(void) : - Model(NULL), - DecalMesh(NULL), - LightEnvironment(NULL), + Model(nullptr), + DecalMesh(nullptr), + LightEnvironment(nullptr), BaseVertexOffset(0), - NextVisibleSkin(NULL), + NextVisibleSkin(nullptr), IsDisabledByDebugger(false), MeshDebugId(MeshDebugIdCount++), m_alphaOverride(1.0f), @@ -186,11 +186,11 @@ MeshClass::MeshClass(void) : *=============================================================================================*/ MeshClass::MeshClass(const MeshClass & that) : RenderObjClass(that), - Model(NULL), - DecalMesh(NULL), - LightEnvironment(NULL), + Model(nullptr), + DecalMesh(nullptr), + LightEnvironment(nullptr), BaseVertexOffset(that.BaseVertexOffset), - NextVisibleSkin(NULL), + NextVisibleSkin(nullptr), IsDisabledByDebugger(false), MeshDebugId(MeshDebugIdCount++), m_alphaOverride(1.0f), @@ -224,7 +224,7 @@ MeshClass & MeshClass::operator = (const MeshClass & that) // just dont copy the decals or light environment REF_PTR_RELEASE(DecalMesh); - LightEnvironment = NULL; + LightEnvironment = nullptr; } return * this; } @@ -398,7 +398,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) return Model->MatInfo; } } - return NULL; + return nullptr; } @@ -416,7 +416,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) *=============================================================================================*/ MeshModelClass * MeshClass::Get_Model(void) { - if (Model != NULL) { + if (Model != nullptr) { Model->Add_Ref(); } return Model; @@ -517,8 +517,8 @@ void MeshClass::Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm) void MeshClass::Get_Deformed_Vertices(Vector3 *dst_vert) { WWASSERT(Model->Get_Flag(MeshGeometryClass::SKIN)); - WWASSERT(Container != NULL); - WWASSERT(Container->Get_HTree() != NULL); + WWASSERT(Container != nullptr); + WWASSERT(Container->Get_HTree() != nullptr); Model->get_deformed_vertices(dst_vert,Container->Get_HTree()); } @@ -561,7 +561,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) Model->Generate_Rigid_APT(localbox, temp_apt); if (temp_apt.Count() > 0) { - if (DecalMesh == NULL) { + if (DecalMesh == nullptr) { DecalMesh = NEW_REF(RigidDecalMeshClass, (this, generator->Peek_Decal_System())); } DecalMesh->Create_Decal(generator, localbox, temp_apt); @@ -589,7 +589,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) // if it is not empty, add a decal if (temp_apt.Count() > 0) { - if (DecalMesh == NULL) { + if (DecalMesh == nullptr) { DecalMesh = NEW_REF(SkinDecalMeshClass, (this, generator->Peek_Decal_System())); } DecalMesh->Create_Decal(generator, worldbox, temp_apt, &_TempVertexBuffer); @@ -612,7 +612,7 @@ void MeshClass::Create_Decal(DecalGeneratorClass * generator) *=============================================================================================*/ void MeshClass::Delete_Decal(uint32 decal_id) { - if (DecalMesh != NULL) { + if (DecalMesh != nullptr) { DecalMesh->Delete_Decal(decal_id); } } @@ -783,14 +783,14 @@ void MeshClass::Render(RenderInfoClass & rinfo) ** to tell the mesh rendering system to process this skin */ if (rendered_something && Model->Get_Flag(MeshGeometryClass::SKIN)) { - //WWASSERT(dynamic_cast(fvf_container) != NULL); + //WWASSERT(dynamic_cast(fvf_container) != nullptr); static_cast(fvf_container)->Add_Visible_Skin(this); } /* ** If we have a decal mesh, link it into the mesh rendering system */ - if ( (DecalMesh != NULL) && + if ( (DecalMesh != nullptr) && ((rinfo.Current_Override_Flags() & RenderInfoClass::RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY) == 0)) { const SphereClass & ws_sphere = Get_Bounding_Sphere(); @@ -826,7 +826,7 @@ void MeshClass::Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass * float oldOpacity=-1.0f; Vector3 oldEmissive(-1,-1,-1); - if (LightEnvironment != NULL) { + if (LightEnvironment != nullptr) { DX8Wrapper::Set_Light_Environment(LightEnvironment); } @@ -877,7 +877,7 @@ void MeshClass::Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass * //MW: Need uninstall custom materials in case they leave D3D in unknown state pass->UnInstall_Materials(); - } else if ((pass->Get_Cull_Volume() != NULL) && (MaterialPassClass::Is_Per_Polygon_Culling_Enabled())) { + } else if ((pass->Get_Cull_Volume() != nullptr) && (MaterialPassClass::Is_Per_Polygon_Culling_Enabled())) { /* ** Generate the APT @@ -1027,7 +1027,7 @@ void MeshClass::Special_Render(SpecialRenderInfoClass & rinfo) if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_VIS) { - WWASSERT(rinfo.VisRasterizer != NULL); + WWASSERT(rinfo.VisRasterizer != nullptr); rinfo.VisRasterizer->Enable_Two_Sided_Rendering(!!Model->Get_Flag(MeshGeometryClass::TWO_SIDED)); if (Model->Get_Flag(MeshModelClass::SKIN) == 0) { @@ -1056,8 +1056,8 @@ void MeshClass::Special_Render(SpecialRenderInfoClass & rinfo) } if (rinfo.RenderType == SpecialRenderInfoClass::RENDER_SHADOW) { - const HTreeClass * htree = NULL; - if (Container!=NULL) { + const HTreeClass * htree = nullptr; + if (Container!=nullptr) { htree = Container->Get_HTree(); } Model->Shadow_Render(rinfo,Transform,htree); @@ -1144,7 +1144,7 @@ WW3DErrorType MeshClass::Load_W3D(ChunkLoadClass & cload) ** Create empty MaterialInfo and Model */ Model = NEW_REF(MeshModelClass,()); - if (Model == NULL) { + if (Model == nullptr) { WWDEBUG_SAY(("MeshClass::Load - Failed to allocate model")); return WW3D_ERROR_LOAD_FAILED; } @@ -1469,7 +1469,7 @@ void MeshClass::Add_Dependencies_To_List // Get a pointer to this mesh's material information object // MaterialInfoClass *material = Get_Material_Info (); - if (material != NULL) { + if (material != nullptr) { // // Loop through all the textures and add their filenames to our list @@ -1480,7 +1480,7 @@ void MeshClass::Add_Dependencies_To_List // Add this texture's filename to the list // TextureClass *texture = material->Peek_Texture (index); - if (texture != NULL) { + if (texture != nullptr) { file_list.Add (texture->Get_Full_Path ()); } } @@ -1574,7 +1574,7 @@ void MeshClass::Set_Sort_Level(int level) int MeshClass::Get_Draw_Call_Count(void) const { - if (Model != NULL) { + if (Model != nullptr) { // Prefer to return the number of polygon renderers int prcount = Model->PolygonRendererList.Count(); if (prcount > 0) { @@ -1582,7 +1582,7 @@ int MeshClass::Get_Draw_Call_Count(void) const } // Otherwise if we have textures, return the number of textures (e.g. dont have prs when sorting) - if ((Model->MatInfo != NULL) && (Model->MatInfo->Texture_Count() > 0)) { + if ((Model->MatInfo != nullptr) && (Model->MatInfo->Texture_Count() > 0)) { return Model->MatInfo->Texture_Count(); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h index 2a6697a7b1d..dca6c64db49 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h @@ -136,7 +136,7 @@ class MeshClass : public W3DMPO, public RenderObjClass void Get_Deformed_Vertices(Vector3 *dst_vert, Vector3 *dst_norm); void Get_Deformed_Vertices(Vector3 *dst_vert); - void Set_Lighting_Environment(LightEnvironmentClass * light_env) { if (light_env) {m_localLightEnv=*light_env;LightEnvironment = &m_localLightEnv;} else {LightEnvironment = NULL;} } + void Set_Lighting_Environment(LightEnvironmentClass * light_env) { if (light_env) {m_localLightEnv=*light_env;LightEnvironment = &m_localLightEnv;} else {LightEnvironment = nullptr;} } LightEnvironmentClass * Get_Lighting_Environment(void) { return LightEnvironment; } float Get_Alpha_Override(void) { return m_alphaOverride;} diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index 572aa03d385..6f9038a0c53 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -160,7 +160,7 @@ class VertexArrayClass VertexArrayClass(int maxsize,int match_normals = 0) { - Verts = NULL; + Verts = nullptr; assert(maxsize > 0); Verts = W3DNEWARRAY MeshBuilderClass::VertClass[maxsize]; assert(Verts); @@ -406,7 +406,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -557,16 +557,16 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ State(STATE_ACCEPTING_INPUT), PassCount(pass_count), FaceCount(0), - Faces(NULL), + Faces(nullptr), InputVertCount(0), VertCount(0), - Verts(NULL), + Verts(nullptr), CurFace(0), AllocFaceCount(0), AllocFaceGrowth(0), PolyOrderPass(0), PolyOrderStage(0), - WorldInfo (NULL) + WorldInfo (nullptr) { Reset(pass_count,face_count_guess,face_count_growth_rate); } @@ -586,7 +586,7 @@ MeshBuilderClass::MeshBuilderClass(int pass_count,int face_count_guess,int face_ MeshBuilderClass::~MeshBuilderClass(void) { Free(); - Set_World_Info(NULL); + Set_World_Info(nullptr); } @@ -605,10 +605,10 @@ MeshBuilderClass::~MeshBuilderClass(void) void MeshBuilderClass::Free(void) { delete[] Faces; - Faces = NULL; + Faces = nullptr; delete Verts; - Verts = NULL; + Verts = nullptr; FaceCount = 0; VertCount = 0; @@ -823,7 +823,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) /* ** Smooth this mesh with neighboring meshes! */ - if (WorldInfo != NULL && WorldInfo->Are_Meshes_Smoothed ()) { + if (WorldInfo != nullptr && WorldInfo->Are_Meshes_Smoothed ()) { for (vertidx = 0; vertidx < VertCount; vertidx++) { if (Verts[vertidx].ShadeIndex == vertidx) { Verts[vertidx].Normal += WorldInfo->Get_Shared_Vertex_Normal(Verts[vertidx].Position, Verts[vertidx].SharedSmGroup); @@ -1010,8 +1010,8 @@ void MeshBuilderClass::Compute_Bounding_Box(Vector3 * set_min,Vector3 * set_max) { int i; - assert(set_min != NULL); - assert(set_max != NULL); + assert(set_min != nullptr); + assert(set_max != nullptr); // Bounding Box // straightforward, axis-aligned bounding box. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp index 242f66da06e..d796fb1808c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -125,25 +125,25 @@ static SimpleVecClass _VNormArray(1024); * 11/9/2000 gth : Created. * *=============================================================================================*/ MeshGeometryClass::MeshGeometryClass(void) : - MeshName(NULL), - UserText(NULL), + MeshName(nullptr), + UserText(nullptr), Flags(0), SortLevel(SORT_LEVEL_NONE), W3dAttributes(0), PolyCount(0), VertexCount(0), - Poly(NULL), - PolySurfaceType(NULL), - Vertex(NULL), - VertexNorm(NULL), - PlaneEq(NULL), - VertexShadeIdx(NULL), - VertexBoneLink(NULL), + Poly(nullptr), + PolySurfaceType(nullptr), + Vertex(nullptr), + VertexNorm(nullptr), + PlaneEq(nullptr), + VertexShadeIdx(nullptr), + VertexBoneLink(nullptr), BoundBoxMin(0,0,0), BoundBoxMax(1,1,1), BoundSphereCenter(0,0,0), BoundSphereRadius(1), - CullTree(NULL) + CullTree(nullptr) { } @@ -161,25 +161,25 @@ MeshGeometryClass::MeshGeometryClass(void) : * 11/9/2000 gth : Created. * *=============================================================================================*/ MeshGeometryClass::MeshGeometryClass(const MeshGeometryClass & that) : - MeshName(NULL), - UserText(NULL), + MeshName(nullptr), + UserText(nullptr), Flags(0), SortLevel(SORT_LEVEL_NONE), W3dAttributes(0), PolyCount(0), VertexCount(0), - Poly(NULL), - PolySurfaceType(NULL), - Vertex(NULL), - VertexNorm(NULL), - PlaneEq(NULL), - VertexShadeIdx(NULL), - VertexBoneLink(NULL), + Poly(nullptr), + PolySurfaceType(nullptr), + Vertex(nullptr), + VertexNorm(nullptr), + PlaneEq(nullptr), + VertexShadeIdx(nullptr), + VertexBoneLink(nullptr), BoundBoxMin(0,0,0), BoundBoxMax(1,1,1), BoundSphereCenter(0,0,0), BoundSphereRadius(1), - CullTree(NULL) + CullTree(nullptr) { *this = that; } @@ -323,7 +323,7 @@ const char * MeshGeometryClass::Get_Name(void) const if (MeshName) { return MeshName->Get_Array(); } - return NULL; + return nullptr; } @@ -368,7 +368,7 @@ const char * MeshGeometryClass::Get_User_Text(void) if (UserText) { return UserText->Get_Array(); } - return NULL; + return nullptr; } @@ -410,7 +410,7 @@ void MeshGeometryClass::Set_User_Text(char * usertext) *=============================================================================================*/ void MeshGeometryClass::Get_Bounding_Box(AABoxClass * set_box) { - WWASSERT(set_box != NULL); + WWASSERT(set_box != nullptr); set_box->Center = (BoundBoxMax + BoundBoxMin) * 0.5f; set_box->Extent = (BoundBoxMax - BoundBoxMin) * 0.5f; } @@ -430,7 +430,7 @@ void MeshGeometryClass::Get_Bounding_Box(AABoxClass * set_box) *=============================================================================================*/ void MeshGeometryClass::Get_Bounding_Sphere(SphereClass * set_sphere) { - WWASSERT(set_sphere != NULL); + WWASSERT(set_sphere != nullptr); set_sphere->Center = BoundSphereCenter; set_sphere->Radius = BoundSphereRadius; } @@ -485,7 +485,7 @@ void MeshGeometryClass::Generate_Rigid_APT(const Vector3 & view_dir, SimpleDynVe *=============================================================================================*/ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box, SimpleDynVecClass & apt) { - if (CullTree != NULL) { + if (CullTree != nullptr) { CullTree->Generate_APT(local_box, apt); } else { @@ -524,7 +524,7 @@ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box, SimpleD *=============================================================================================*/ void MeshGeometryClass::Generate_Rigid_APT(const OBBoxClass & local_box,const Vector3 & viewdir,SimpleDynVecClass & apt) { - if (CullTree != NULL) { + if (CullTree != nullptr) { CullTree->Generate_APT(local_box, viewdir,apt); } else { @@ -1259,7 +1259,7 @@ bool MeshGeometryClass::cast_obbox_brute_force(OBBoxCollisionTestClass & boxtest *=============================================================================================*/ void MeshGeometryClass::Compute_Plane_Equations(Vector4 * peq) { - WWASSERT(peq!=NULL); + WWASSERT(peq!=nullptr); TriIndex * poly = Poly->Get_Array(); Vector3 * vert = Vertex->Get_Array(); @@ -1296,7 +1296,7 @@ void MeshGeometryClass::Compute_Plane_Equations(Vector4 * peq) *=============================================================================================*/ void MeshGeometryClass::Compute_Vertex_Normals(Vector3 * vnorm) { - WWASSERT(vnorm != NULL); + WWASSERT(vnorm != nullptr); if ((PolyCount == 0)|| (VertexCount == 0)) { return; } @@ -1388,7 +1388,7 @@ void MeshGeometryClass::Compute_Bounds(Vector3 * verts) } // find bounding box minimum and maximum - if (verts == NULL) { + if (verts == nullptr) { verts = Vertex->Get_Array(); } VectorProcessorClass::MinMax(verts,BoundBoxMin,BoundBoxMax,VertexCount); @@ -1477,7 +1477,7 @@ Vector4 * MeshGeometryClass::get_planes(bool create) if (PlaneEq) { return PlaneEq->Get_Array(); } - return NULL; + return nullptr; #endif } @@ -1552,7 +1552,7 @@ void MeshGeometryClass::Generate_Culling_Tree(void) AABTreeBuilderClass builder; builder.Build_AABTree(PolyCount,Poly->Get_Array(),VertexCount,Vertex->Get_Array()); - DEBUG_ASSERTCRASH(CullTree == NULL, ("MeshGeometryClass::Generate_Culling_Tree: Leaking CullTree")); + DEBUG_ASSERTCRASH(CullTree == nullptr, ("MeshGeometryClass::Generate_Culling_Tree: Leaking CullTree")); CullTree = NEW_REF(AABTreeClass,(&builder)); CullTree->Set_Mesh(this); } @@ -1623,7 +1623,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; /* ** Set Bounding Info @@ -1683,7 +1683,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) ** If this mesh is collideable and no AABTree was in the file, generate one now */ if ( (((W3dAttributes & W3D_MESH_FLAG_COLLISION_TYPE_MASK) >> W3D_MESH_FLAG_COLLISION_TYPE_SHIFT) != 0) && - (CullTree == NULL)) + (CullTree == nullptr)) { Generate_Culling_Tree(); } @@ -1904,9 +1904,9 @@ WW3DErrorType MeshGeometryClass::read_user_text(ChunkLoadClass & cload) ** This shouldn't happen but if there are more than one ** USER_TEXT chunks in the mesh file, store only the first ** one. I am assuming that if the UserText buffer is not - ** NULL, then a previous user text chunk has been read in... + ** nullptr, then a previous user text chunk has been read in... */ - if (UserText != NULL) { + if (UserText != nullptr) { return WW3D_ERROR_OK; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h index beced9e1581..0488011948d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h @@ -151,7 +151,7 @@ class MeshGeometryClass : public W3DMPO, public RefCountClass, public MultiListO void Get_Bounding_Sphere(SphereClass * set_sphere); // exposed culling support - bool Has_Cull_Tree(void) { return CullTree != NULL; } + bool Has_Cull_Tree(void) { return CullTree != nullptr; } void Generate_Rigid_APT(const Vector3 & view_dir, SimpleDynVecClass & apt); void Generate_Rigid_APT(const OBBoxClass & local_box, SimpleDynVecClass & apt); @@ -270,7 +270,7 @@ inline uint32 * MeshGeometryClass::get_shade_indices(bool create) if (VertexShadeIdx) { return VertexShadeIdx->Get_Array(); } - return NULL; + return nullptr; } inline uint16 * MeshGeometryClass::get_bone_links(bool create) @@ -281,7 +281,7 @@ inline uint16 * MeshGeometryClass::get_bone_links(bool create) if (VertexBoneLink) { return VertexBoneLink->Get_Array(); } - return NULL; + return nullptr; } inline uint8 MeshGeometryClass::Get_Poly_Surface_Type(int poly_index) const diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp index f901d669038..867f7871c20 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp @@ -181,26 +181,26 @@ MeshMatDescClass::MeshMatDescClass(void) : PolyCount(0) { for (int array=0;array < MAX_COLOR_ARRAYS; array++) { - ColorArray[array] = NULL; + ColorArray[array] = nullptr; } for (int uvarray=0;uvarrayGet_Element(vidx); - } else if (Material[pass] != NULL) { + } else if (Material[pass] != nullptr) { Material[pass]->Add_Ref(); return Material[pass]; } - return NULL; + return nullptr; } ShaderClass MeshMatDescClass::Get_Shader(int pidx,int pass) const @@ -523,13 +523,13 @@ TextureClass * MeshMatDescClass::Get_Texture(int pidx,int pass,int stage) const return TextureArray[pass][stage]->Get_Element(pidx); - } else if (Texture[pass][stage] != NULL) { + } else if (Texture[pass][stage] != nullptr) { Texture[pass][stage]->Add_Ref(); return Texture[pass][stage]; } - return NULL; + return nullptr; } VertexMaterialClass * MeshMatDescClass::Peek_Material(int vidx,int pass) const @@ -550,7 +550,7 @@ TextureClass * MeshMatDescClass::Peek_Texture(int pidx,int pass,int stage) const TexBufferClass * MeshMatDescClass::Get_Texture_Array(int pass,int stage,bool create) { - if (create && TextureArray[pass][stage] == NULL) { + if (create && TextureArray[pass][stage] == nullptr) { TextureArray[pass][stage] = NEW_REF(TexBufferClass,(PolyCount, "MeshMatDescClass::TextureArray")); } return TextureArray[pass][stage]; @@ -558,7 +558,7 @@ TexBufferClass * MeshMatDescClass::Get_Texture_Array(int pass,int stage,bool cre MatBufferClass * MeshMatDescClass::Get_Material_Array(int pass,bool create) { - if (create && MaterialArray[pass] == NULL) { + if (create && MaterialArray[pass] == nullptr) { MaterialArray[pass] = NEW_REF(MatBufferClass,(VertexCount, "MeshMatDescClass::MaterialArray")); } return MaterialArray[pass]; @@ -566,14 +566,14 @@ MatBufferClass * MeshMatDescClass::Get_Material_Array(int pass,bool create) ShaderClass * MeshMatDescClass::Get_Shader_Array(int pass,bool create) { - if (create && ShaderArray[pass] == NULL) { + if (create && ShaderArray[pass] == nullptr) { ShaderArray[pass] = NEW_REF(ShareBufferClass,(PolyCount, "MeshMatDescClass::ShaderArray")); ShaderArray[pass]->Clear(); } if (ShaderArray[pass]) { return ShaderArray[pass]->Get_Array(); } - return NULL; + return nullptr; } void MeshMatDescClass::Make_UV_Array_Unique(int pass,int stage) @@ -588,7 +588,7 @@ void MeshMatDescClass::Make_UV_Array_Unique(int pass,int stage) void MeshMatDescClass::Make_Color_Array_Unique(int array) { - if ((ColorArray[array] != NULL) && (ColorArray[array]->Num_Refs() > 1)) { + if ((ColorArray[array] != nullptr) && (ColorArray[array]->Num_Refs() > 1)) { ShareBufferClass * unique_color_array = NEW_REF(ShareBufferClass,(*ColorArray[array])); ColorArray[array]->Release_Ref(); ColorArray[array] = unique_color_array; @@ -624,13 +624,13 @@ void MeshMatDescClass::Install_UV_Array(int pass,int stage,Vector2 * uvs,int cou ** Find the first empty UV-array slot */ int new_index = 0; - while ((UV[new_index] != NULL) && (new_index < MAX_UV_ARRAYS)) { + while ((UV[new_index] != nullptr) && (new_index < MAX_UV_ARRAYS)) { new_index++; } if (new_index < MAX_UV_ARRAYS) { - WWASSERT(UV[new_index] == NULL); + WWASSERT(UV[new_index] == nullptr); UV[new_index] = NEW_REF(UVBufferClass,(count, "MeshMatDescClass::UV")); memcpy(UV[new_index]->Get_Array(),uvs,count * sizeof(Vector2)); UV[new_index]->Update_CRC(); // update the crc for future comparision @@ -653,25 +653,25 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * /* ** If this pass doesn't have a vertex material, create one */ - if ((Material[pass] == NULL) && (MaterialArray[pass] == NULL)) { + if ((Material[pass] == nullptr) && (MaterialArray[pass] == nullptr)) { Material[pass] = NEW_REF(VertexMaterialClass,()); } /* ** Configure the materials to source the uv coordinates and colors */ - if (Material[pass] != NULL) { + if (Material[pass] != nullptr) { Configure_Material(Material[pass],pass,lighting_enabled); } else { - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(pass,0); for (int vidx=0; vidxGet_Diffuse(&single_diffuse); @@ -745,8 +745,8 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * } // If both DCG and DIG arrays are submitted, multiply them together to DCG channel - if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != NULL) && - (DIGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[1] != NULL)) { + if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != nullptr) && + (DIGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[1] != nullptr)) { unsigned * diffuse_array = ColorArray[0]->Get_Array(); unsigned * emissive_array = ColorArray[1]->Get_Array(); @@ -761,12 +761,12 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * } DIGSource[pass]=VertexMaterialClass::MATERIAL; // DIG channel no more - if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != NULL)) { + if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != nullptr)) { unsigned * diffuse_array = ColorArray[0]->Get_Array(); Vector3 mtl_diffuse; float mtl_opacity = 1.0f; - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0,pass); for (int vidx=0; vidxSet_Ambient(0,0,0); Material[pass]->Set_Diffuse(0,0,0); Material[pass]->Set_Emissive(0,0,0); @@ -895,7 +895,7 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * Vector3 mtl_ambient; Vector3 mtl_emissive; - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0, pass); if (mtl) { mtl->Get_Diffuse(&single_diffuse); @@ -921,8 +921,8 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass * if (mtl_emissive.X || mtl_emissive.Y || mtl_emissive.Z) emissive_used=true; } - if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != NULL)) { - VertexMaterialClass * prev_mtl = NULL; + if ((DCGSource[pass] != VertexMaterialClass::MATERIAL) && (ColorArray[0] != nullptr)) { + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(0,pass); for (int vidx=0; vidxDo_Mappers_Need_Normals()) return true; } else { - VertexMaterialClass * prev_mtl = NULL; + VertexMaterialClass * prev_mtl = nullptr; VertexMaterialClass * mtl = Peek_Material(pass,0); for (int vidx=0; vidxDo_Mappers_Need_Normals()) return true; prev_mtl = mtl; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h index d0bbc93eec9..88dd72409d6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h @@ -145,11 +145,11 @@ class MeshMatDescClass : public W3DMPO ** Determine whether this material description contains data for the specified category */ bool Has_UV(int pass,int stage) { return UVSource[pass][stage] != -1; } - bool Has_Color_Array(int array) { return ColorArray[array] != NULL; } + bool Has_Color_Array(int array) { return ColorArray[array] != nullptr; } - bool Has_Texture_Data(int pass,int stage) { return (Texture[pass][stage] != NULL) || (TextureArray[pass][stage] != NULL); } - bool Has_Shader_Data(int pass) { return (Shader[pass] != NullShader) || (ShaderArray[pass] != NULL); } - bool Has_Material_Data(int pass) { return (Material[pass] != NULL) || (MaterialArray[pass] != NULL); } + bool Has_Texture_Data(int pass,int stage) { return (Texture[pass][stage] != nullptr) || (TextureArray[pass][stage] != nullptr); } + bool Has_Shader_Data(int pass) { return (Shader[pass] != NullShader) || (ShaderArray[pass] != nullptr); } + bool Has_Material_Data(int pass) { return (Material[pass] != nullptr) || (MaterialArray[pass] != nullptr); } /* ** "Get" functions for Materials, Textures, and Shaders when there are more than one (per-polygon or per-vertex) @@ -178,7 +178,7 @@ class MeshMatDescClass : public W3DMPO ** Post-Load processing, configures all materials to use the correct passes and ** material color sources, etc. */ - void Post_Load_Process(bool enable_lighting = true,MeshModelClass * parent = NULL); + void Post_Load_Process(bool enable_lighting = true,MeshModelClass * parent = nullptr); void Disable_Lighting(void); /* @@ -225,7 +225,7 @@ class MeshMatDescClass : public W3DMPO /** ** MatBufferClass ** This is a ShareBufferClass of pointers to vertex materials. Should be written as a template... -** Get and Peek work like normal, and all non-NULL pointers will be released when the buffer +** Get and Peek work like normal, and all non-null pointers will be released when the buffer ** is destroyed. */ class MatBufferClass : public ShareBufferClass < VertexMaterialClass * > @@ -303,12 +303,12 @@ class UVBufferClass : public ShareBufferClass < Vector2 > inline Vector2 * MeshMatDescClass::Get_UV_Array(int pass,int stage) { if (UVSource[pass][stage] == -1) { - return NULL; + return nullptr; } - if (UV[UVSource[pass][stage]] != NULL) { + if (UV[UVSource[pass][stage]] != nullptr) { return UV[UVSource[pass][stage]]->Get_Array(); } - return NULL; + return nullptr; } inline void MeshMatDescClass::Set_UV_Source(int pass,int stage,int sourceindex) @@ -332,7 +332,7 @@ inline int MeshMatDescClass::Get_UV_Source(int pass,int stage) inline int MeshMatDescClass::Get_UV_Array_Count(void) { int count = 0; - while ((UV[count] != NULL) && (count < MAX_UV_ARRAYS)) { + while ((UV[count] != nullptr) && (count < MAX_UV_ARRAYS)) { count++; } return count; @@ -345,10 +345,10 @@ inline Vector2 * MeshMatDescClass::Get_UV_Array_By_Index(int index, bool create) if (create && !UV[index]) { UV[index] = NEW_REF(UVBufferClass,(VertexCount, "MeshMatDescClass::UV")); } - if (UV[index] != NULL) { + if (UV[index] != nullptr) { return UV[index]->Get_Array(); } - return NULL; + return nullptr; } inline unsigned* MeshMatDescClass::Get_DCG_Array(int pass) @@ -357,25 +357,25 @@ inline unsigned* MeshMatDescClass::Get_DCG_Array(int pass) WWASSERT(pass < MAX_PASSES); switch (DCGSource[pass]) { case VertexMaterialClass::MATERIAL: - return NULL; + return nullptr; break; case VertexMaterialClass::COLOR1: if (ColorArray[0]) { return ColorArray[0]->Get_Array(); } else { - return NULL; + return nullptr; } break; case VertexMaterialClass::COLOR2: if (ColorArray[1]) { return ColorArray[1]->Get_Array(); } else { - return NULL; + return nullptr; } break; default: WWASSERT(0); - return(NULL); + return(nullptr); break; }; } @@ -386,25 +386,25 @@ inline unsigned * MeshMatDescClass::Get_DIG_Array(int pass) WWASSERT(pass < MAX_PASSES); switch (DIGSource[pass]) { case VertexMaterialClass::MATERIAL: - return NULL; + return nullptr; break; case VertexMaterialClass::COLOR1: if (ColorArray[0]) { return ColorArray[0]->Get_Array(); } else { - return NULL; + return nullptr; } break; case VertexMaterialClass::COLOR2: if (ColorArray[1]) { return ColorArray[1]->Get_Array(); } else { - return NULL; + return nullptr; } break; default: WWASSERT(0); - return(NULL); + return(nullptr); break; }; } @@ -437,7 +437,7 @@ inline unsigned * MeshMatDescClass::Get_Color_Array(int index,bool create) if (ColorArray[index]) { return ColorArray[index]->Get_Array(); } - return NULL; + return nullptr; } inline VertexMaterialClass * MeshMatDescClass::Get_Single_Material(int pass) const @@ -465,17 +465,17 @@ inline ShaderClass MeshMatDescClass::Get_Single_Shader(int pass) const inline bool MeshMatDescClass::Has_Material_Array(int pass) const { - return (MaterialArray[pass] != NULL); + return (MaterialArray[pass] != nullptr); } inline bool MeshMatDescClass::Has_Shader_Array(int pass) const { - return (ShaderArray[pass] != NULL); + return (ShaderArray[pass] != nullptr); } inline bool MeshMatDescClass::Has_Texture_Array(int pass,int stage) const { - return (TextureArray[pass][stage] != NULL); + return (TextureArray[pass][stage] != nullptr); } inline void MeshMatDescClass::Disable_Backface_Culling(void) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp index b83cbd89c12..b292172206b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp @@ -69,11 +69,11 @@ static DynamicVectorClass _TempClipFlagBuffer; MeshModelClass::MeshModelClass(void) : - DefMatDesc(NULL), - AlternateMatDesc(NULL), - CurMatDesc(NULL), - MatInfo(NULL), - GapFiller(NULL) + DefMatDesc(nullptr), + AlternateMatDesc(nullptr), + CurMatDesc(nullptr), + MatInfo(nullptr), + GapFiller(nullptr) { Set_Flag(DIRTY_BOUNDS,true); @@ -87,15 +87,15 @@ MeshModelClass::MeshModelClass(void) : MeshModelClass::MeshModelClass(const MeshModelClass & that) : MeshGeometryClass(that), - DefMatDesc(NULL), - AlternateMatDesc(NULL), - CurMatDesc(NULL), - MatInfo(NULL), - GapFiller(NULL), + DefMatDesc(nullptr), + AlternateMatDesc(nullptr), + CurMatDesc(nullptr), + MatInfo(nullptr), + GapFiller(nullptr), HasBeenInUse(false) { DefMatDesc = W3DNEW MeshMatDescClass(*(that.DefMatDesc)); - if (that.AlternateMatDesc != NULL) { + if (that.AlternateMatDesc != nullptr) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); } CurMatDesc = DefMatDesc; @@ -128,9 +128,9 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) CurMatDesc = DefMatDesc; delete AlternateMatDesc; - AlternateMatDesc = NULL; + AlternateMatDesc = nullptr; - if (that.AlternateMatDesc != NULL) { + if (that.AlternateMatDesc != nullptr) { AlternateMatDesc = W3DNEW MeshMatDescClass(*(that.AlternateMatDesc)); } @@ -138,7 +138,7 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) // DMS - using approriate deallocation method delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; if (that.GapFiller) GapFiller=W3DNEW GapFillerClass(*that.GapFiller); @@ -151,7 +151,7 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) //DMS - We must delete the gapfiller object BEFORE the geometry is reset. Otherwise, // the number of stages and passes gets reset and the gapfiller cannot deallocate properly. delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; Reset_Geometry(polycount,vertcount); @@ -163,7 +163,7 @@ void MeshModelClass::Reset(int polycount,int vertcount,int passcount) DefMatDesc->Reset(polycount,vertcount,passcount); delete AlternateMatDesc; - AlternateMatDesc = NULL; + AlternateMatDesc = nullptr; CurMatDesc = DefMatDesc; @@ -180,7 +180,7 @@ void MeshModelClass::Register_For_Rendering() } else { delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; } } else { @@ -189,7 +189,7 @@ void MeshModelClass::Register_For_Rendering() } else { delete GapFiller; - GapFiller=NULL; + GapFiller=nullptr; } } @@ -253,7 +253,7 @@ void MeshModelClass::Replace_VertexMaterial(VertexMaterialClass* vmat,VertexMate DX8FVFCategoryContainer* MeshModelClass::Peek_FVF_Category_Container() { - if (PolygonRendererList.Is_Empty()) return NULL; + if (PolygonRendererList.Is_Empty()) return nullptr; DX8PolygonRendererClass* polygon_renderer=PolygonRendererList.Get_Head(); WWASSERT(polygon_renderer); DX8TextureCategoryClass* texture_category=polygon_renderer->Get_Texture_Category(); @@ -265,7 +265,7 @@ DX8FVFCategoryContainer* MeshModelClass::Peek_FVF_Category_Container() void MeshModelClass::Shadow_Render(SpecialRenderInfoClass & rinfo,const Matrix3D & tm,const HTreeClass * htree) { - if (rinfo.BWRenderer != NULL) { + if (rinfo.BWRenderer != nullptr) { if (_TempTransformedVertexBuffer.Length() < VertexCount) _TempTransformedVertexBuffer.Resize(VertexCount); Vector4* transf_ptr=&(_TempTransformedVertexBuffer[0]); get_deformed_screenspace_vertices(transf_ptr,rinfo,tm,htree); @@ -311,7 +311,7 @@ void MeshModelClass::Make_Color_Array_Unique(int array_index) void MeshModelClass::Enable_Alternate_Material_Description(bool onoff) { - if ((onoff == true) && (AlternateMatDesc != NULL)) { + if ((onoff == true) && (AlternateMatDesc != nullptr)) { if (CurMatDesc != AlternateMatDesc) { CurMatDesc = AlternateMatDesc; @@ -440,7 +440,7 @@ HashTemplateClass SideHash; // // ---------------------------------------------------------------------------- -GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(NULL), PolygonCount(0) +GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(nullptr), PolygonCount(0) { //DMS - We cannot take a reference to the mesh model here! This is because the mesh model // class OWNS the GapFiller class (allocated via NEW). If we take a reference here, there @@ -457,22 +457,22 @@ GapFillerClass::GapFillerClass(MeshModelClass* mmc_) : mmc(NULL), PolygonCount(0 if (mmc->Has_Texture_Array(pass,stage)) { TextureArray[pass][stage]=W3DNEWARRAY TextureClass*[ArraySize]; } - else TextureArray[pass][stage]=NULL; + else TextureArray[pass][stage]=nullptr; } if (mmc->Has_Material_Array(pass)) { MaterialArray[pass]=W3DNEWARRAY VertexMaterialClass*[ArraySize]; } - else MaterialArray[pass]=NULL; + else MaterialArray[pass]=nullptr; if (mmc->Has_Shader_Array(pass)) { ShaderArray[pass]=W3DNEWARRAY ShaderClass[ArraySize]; } - else ShaderArray[pass]=NULL; + else ShaderArray[pass]=nullptr; } } -GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonCount(that.PolygonCount) +GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(nullptr), PolygonCount(that.PolygonCount) { //DMS - We cannot take a reference to the mesh model here! This is because the mesh model // class OWNS the GapFiller class (allocated via NEW). If we take a reference here, there @@ -493,7 +493,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC TextureArray[pass][stage][i]->Add_Ref(); } } - else TextureArray[pass][stage]=NULL; + else TextureArray[pass][stage]=nullptr; } if (that.MaterialArray[pass]) { @@ -503,7 +503,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC MaterialArray[pass][i]->Add_Ref(); } } - else MaterialArray[pass]=NULL; + else MaterialArray[pass]=nullptr; if (that.ShaderArray[pass]) { ShaderArray[pass]=W3DNEWARRAY ShaderClass[ArraySize]; @@ -511,7 +511,7 @@ GapFillerClass::GapFillerClass(const GapFillerClass& that) : mmc(NULL), PolygonC ShaderArray[pass][i]=that.ShaderArray[pass][i]; } } - else ShaderArray[pass]=NULL; + else ShaderArray[pass]=nullptr; } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h index c94234d9e13..47b801a0fbe 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h @@ -241,7 +241,7 @@ class MeshModelClass : public MeshGeometryClass // Process texture reductions // void Process_Texture_Reduction(void); - // FVF category container will be NULL if the mesh hasn't been registered to the rendering system + // FVF category container will be null if the mesh hasn't been registered to the rendering system DX8FVFCategoryContainer* Peek_FVF_Category_Container(); // Determine whether any rendering feature used by this mesh requires vertex normals diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index e4c76ef83e2..dd1e27c2938 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -236,7 +236,7 @@ class MeshSaveContextClass *=============================================================================================*/ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) { - MeshLoadContextClass * context = NULL; + MeshLoadContextClass * context = nullptr; /* ** Open the first chunk, it should be the mesh header @@ -280,7 +280,7 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; context->AlternateMatDesc.Set_Vertex_Count(VertexCount); context->AlternateMatDesc.Set_Polygon_Count(PolyCount); @@ -398,7 +398,7 @@ WW3DErrorType MeshModelClass::Load_W3D(ChunkLoadClass & cload) ** If this mesh is collideable and no AABTree was in the file, generate one now */ if ( (((W3dAttributes & W3D_MESH_FLAG_COLLISION_TYPE_MASK) >> W3D_MESH_FLAG_COLLISION_TYPE_SHIFT) != 0) && - (CullTree == NULL)) + (CullTree == nullptr)) { Generate_Culling_Tree(); } @@ -584,12 +584,12 @@ WW3DErrorType MeshModelClass::read_chunks(ChunkLoadClass & cload,MeshLoadContext WW3DErrorType MeshModelClass::read_texcoords(ChunkLoadClass & cload,MeshLoadContextClass * context) { W3dTexCoordStruct texcoord; - Vector2 * uvarray = 0; + Vector2 * uvarray = nullptr; int elementcount = cload.Cur_Chunk_Length() / sizeof (W3dTexCoordStruct); uvarray = context->Get_Temporary_UV_Array(elementcount); - if (uvarray != NULL) { + if (uvarray != nullptr) { /* ** Read the uv's into the first u-v pass array ** NOTE: this is an obsolete function. Texture coordinates are now @@ -643,9 +643,9 @@ WW3DErrorType MeshModelClass::read_v3_materials(ChunkLoadClass & cload,MeshLoadC ** W3D_MATERIAL3_SC_MAP - specular color map ** W3D_MATERIAL3_SI_MAP - specular illumination map */ - VertexMaterialClass * vmat = NULL; + VertexMaterialClass * vmat = nullptr; ShaderClass shader; - TextureClass * tex = NULL; + TextureClass * tex = nullptr; char name[256]; /* @@ -765,8 +765,8 @@ WW3DErrorType MeshModelClass::read_v3_materials(ChunkLoadClass & cload,MeshLoadC vmat->Release_Ref(); if (tex) tex->Release_Ref(); - vmat = NULL; - tex = NULL; + vmat = nullptr; + tex = nullptr; /* ** Close the W3D_CHUNK_MATERIAL3 @@ -885,10 +885,10 @@ WW3DErrorType MeshModelClass::read_vertex_colors(ChunkLoadClass & cload,MeshLoad ** ** A side effect is that if two DCG chunks are encountered, only the first is used... */ - if (CurMatDesc->Has_Color_Array(0) == NULL) { + if (CurMatDesc->Has_Color_Array(0) == false) { W3dRGBStruct color; unsigned * dcg = Get_Color_Array(0,true); - assert(dcg != NULL); + assert(dcg != nullptr); for (int i=0; iGet_Temporary_UV_Array(elementcount); - if (uvs != NULL) { + if (uvs != nullptr) { for (unsigned i = 0; i < elementcount; i++) { cload.Read (&texcoord, sizeof (texcoord)); uvs[i].X = texcoord.U; @@ -1553,7 +1553,7 @@ WW3DErrorType MeshModelClass::read_per_face_texcoord_ids (ChunkLoadClass &cload, // Vector3i *uvindices; // // uvindices = matdesc->Get_UVIndex_Array (context->CurPass, true); -// WWASSERT (uvindices != NULL); +// WWASSERT (uvindices != nullptr); //uvindices=W3DNEWARRAY Vector3i[Get_Polygon_Count()]; // cload.Read (uvindices, size); @@ -1660,7 +1660,7 @@ void MeshModelClass::post_process() if (Get_Flag(MeshGeometryClass::TWO_SIDED)) { DefMatDesc->Disable_Backface_Culling(); - if (AlternateMatDesc != NULL) { + if (AlternateMatDesc != nullptr) { AlternateMatDesc->Disable_Backface_Culling(); } @@ -1879,7 +1879,7 @@ void MeshModelClass::install_materials(MeshLoadContextClass * context) lighting_enabled=false; } DefMatDesc->Post_Load_Process (lighting_enabled,this); - if (AlternateMatDesc != NULL) { + if (AlternateMatDesc != nullptr) { AlternateMatDesc->Post_Load_Process (lighting_enabled,this); } @@ -1918,7 +1918,7 @@ void MeshModelClass::clone_materials(const MeshModelClass & srcmesh) void MeshModelClass::install_alternate_material_desc(MeshLoadContextClass * context) { if (context->AlternateMatDesc.Is_Empty() == false) { - WWASSERT(AlternateMatDesc == NULL); + WWASSERT(AlternateMatDesc == nullptr); AlternateMatDesc = W3DNEW MeshMatDescClass; AlternateMatDesc->Init_Alternate(*DefMatDesc,context->AlternateMatDesc); } @@ -1943,7 +1943,7 @@ MeshLoadContextClass::MeshLoadContextClass(void) PrelitChunkID = 0xffffffff; CurPass = 0; CurTexStage = 0; - TexCoords = NULL; + TexCoords = nullptr; LoadedDIG = false; } @@ -1965,7 +1965,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) int i; delete TexCoords; - TexCoords = NULL; + TexCoords = nullptr; for (i=0; iRelease_Ref(); @@ -1995,7 +1995,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) *=============================================================================================*/ W3dTexCoordStruct * MeshLoadContextClass::Get_Texcoord_Array(void) { - if (TexCoords == NULL) { + if (TexCoords == nullptr) { TexCoords = W3DNEWARRAY W3dTexCoordStruct[Header.NumVertices]; } return TexCoords; @@ -2036,7 +2036,7 @@ int MeshLoadContextClass::Add_Shader(ShaderClass shader) *=============================================================================================*/ int MeshLoadContextClass::Add_Vertex_Material(VertexMaterialClass * vmat) { - WWASSERT(vmat != NULL); + WWASSERT(vmat != nullptr); vmat->Add_Ref(); int index = VertexMaterials.Count(); VertexMaterials.Add(vmat); @@ -2058,7 +2058,7 @@ int MeshLoadContextClass::Add_Vertex_Material(VertexMaterialClass * vmat) *=============================================================================================*/ int MeshLoadContextClass::Add_Texture(TextureClass * tex) { - WWASSERT(tex != NULL); + WWASSERT(tex != nullptr); tex->Add_Ref(); int index = Textures.Count(); Textures.Add(tex); @@ -2098,7 +2098,7 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial } // add the vertex material if it is unique - if (vmat == NULL) { + if (vmat == nullptr) { mat->VertexMaterialIdx = -1; } else { unsigned long crc = vmat->Get_CRC(); @@ -2116,7 +2116,7 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial } // add the texture if it is unique - if (tex == NULL) { + if (tex == nullptr) { mat->TextureIdx = -1; } else { int ti=0; @@ -2179,7 +2179,7 @@ VertexMaterialClass * MeshLoadContextClass::Peek_Legacy_Vertex_Material(int lega if (vi != -1) { return Peek_Vertex_Material(vi); } else { - return NULL; + return nullptr; } } @@ -2204,7 +2204,7 @@ TextureClass * MeshLoadContextClass::Peek_Legacy_Texture(int legacy_material_ind if (ti != -1) { return Peek_Texture(ti); } else { - return NULL; + return nullptr; } } @@ -2321,7 +2321,7 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex char * mesh_name = strchr(name,'.'); int hierarchy_name_len = 0; - if (mesh_name == NULL) { + if (mesh_name == nullptr) { mesh_name = name; } else { hierarchy_name_len = (int)mesh_name - (int)name; @@ -2364,7 +2364,7 @@ WW3DErrorType MeshModelClass::write_header(ChunkSaveClass & csave,MeshSaveContex WW3DErrorType MeshModelClass::write_user_text(ChunkSaveClass & csave,MeshSaveContextClass * /*context*/) { - if (UserText == NULL) return WW3D_ERROR_OK; + if (UserText == nullptr) return WW3D_ERROR_OK; if (strlen(UserText->Get_Array()) < 1) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_MESH_USER_TEXT); @@ -2381,7 +2381,7 @@ WW3DErrorType MeshModelClass::write_triangles(ChunkSaveClass & csave,MeshSaveCon } TriIndex * poly_verts = Poly->Get_Array(); - Vector4 * poly_eq = (PlaneEq ? PlaneEq->Get_Array() : NULL); + Vector4 * poly_eq = (PlaneEq ? PlaneEq->Get_Array() : nullptr); for (int i=0; i 0); - if (VertexShadeIdx == NULL) return WW3D_ERROR_OK; + if (VertexShadeIdx == nullptr) return WW3D_ERROR_OK; if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_SHADE_INDICES)) { return WW3D_ERROR_SAVE_FAILED; @@ -2509,7 +2509,7 @@ WW3DErrorType MeshModelClass::write_vertex_shade_indices(ChunkSaveClass & csave, WW3DErrorType MeshModelClass::write_vertex_influences(ChunkSaveClass & csave,MeshSaveContextClass * /*context*/) { WWASSERT(Get_Vertex_Count() > 0); - if (VertexBoneLink == NULL) return WW3D_ERROR_OK; + if (VertexBoneLink == nullptr) return WW3D_ERROR_OK; if (!csave.Begin_Chunk(W3D_CHUNK_VERTEX_INFLUENCES)) { return WW3D_ERROR_SAVE_FAILED; @@ -2631,13 +2631,13 @@ WW3DErrorType MeshModelClass::write_material_pass(ChunkSaveClass & csave,MeshSav WW3DErrorType MeshModelClass::write_vertex_material_ids(ChunkSaveClass & csave,MeshSaveContextClass * context) { // first check if all vertex material pointers are Null (is this legal?) - if ( (DefMatDesc->Material[context->CurPass] == NULL) && - (DefMatDesc->MaterialArray[context->CurPass] == NULL)) return WW3D_ERROR_OK; + if ( (DefMatDesc->Material[context->CurPass] == nullptr) && + (DefMatDesc->MaterialArray[context->CurPass] == nullptr)) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_VERTEX_MATERIAL_IDS); uint32 id = 0; - if (DefMatDesc->MaterialArray[context->CurPass] == NULL) { + if (DefMatDesc->MaterialArray[context->CurPass] == nullptr) { id = context->Materials.Find_Vertex_Material(DefMatDesc->Material[context->CurPass]); csave.Write(&id,sizeof(id)); @@ -2661,7 +2661,7 @@ WW3DErrorType MeshModelClass::write_shader_ids(ChunkSaveClass & csave,MeshSaveCo csave.Begin_Chunk(W3D_CHUNK_SHADER_IDS); uint32 id = 0; - if (DefMatDesc->ShaderArray[context->CurPass] == NULL) { + if (DefMatDesc->ShaderArray[context->CurPass] == nullptr) { id = context->Materials.Find_Shader(DefMatDesc->Shader[context->CurPass]); csave.Write(&id,sizeof(id)); @@ -2681,7 +2681,7 @@ WW3DErrorType MeshModelClass::write_shader_ids(ChunkSaveClass & csave,MeshSaveCo WW3DErrorType MeshModelClass::write_scg(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->SCG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->SCG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_SCG); W3dRGBAStruct color; @@ -2697,7 +2697,7 @@ WW3DErrorType MeshModelClass::write_scg(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_dig(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->DIG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->DIG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_DIG); W3dRGBStruct color; @@ -2712,7 +2712,7 @@ WW3DErrorType MeshModelClass::write_dig(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_dcg(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->DCG[context->CurPass] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->DCG[context->CurPass] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_DCG); W3dRGBAStruct color; @@ -2727,8 +2727,8 @@ WW3DErrorType MeshModelClass::write_dcg(ChunkSaveClass & csave,MeshSaveContextCl WW3DErrorType MeshModelClass::write_texture_stage(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if ( (DefMatDesc->Texture[context->CurPass][context->CurStage] == NULL) && - (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == NULL)) return WW3D_ERROR_OK; + if ( (DefMatDesc->Texture[context->CurPass][context->CurStage] == nullptr) && + (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == nullptr)) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_TEXTURE_STAGE); write_texture_ids(csave,context); @@ -2744,7 +2744,7 @@ WW3DErrorType MeshModelClass::write_texture_ids(ChunkSaveClass & csave,MeshSaveC csave.Begin_Chunk(W3D_CHUNK_TEXTURE_IDS); uint32 id = 0; - if (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == NULL) { + if (DefMatDesc->TextureArray[context->CurPass][context->CurStage] == nullptr) { id = context->Materials.Find_Texture(DefMatDesc->Texture[context->CurPass][context->CurStage]); csave.Write(&id,sizeof(id)); @@ -2764,7 +2764,7 @@ WW3DErrorType MeshModelClass::write_texture_ids(ChunkSaveClass & csave,MeshSaveC WW3DErrorType MeshModelClass::write_stage_texcoords(ChunkSaveClass & csave,MeshSaveContextClass * context) { - if (DefMatDesc->UV[context->CurPass][context->CurStage] == NULL) return WW3D_ERROR_OK; + if (DefMatDesc->UV[context->CurPass][context->CurStage] == nullptr) return WW3D_ERROR_OK; csave.Begin_Chunk(W3D_CHUNK_STAGE_TEXCOORDS); W3dTexCoordStruct tex; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp index 79099864f77..68401bfb05c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp @@ -93,10 +93,10 @@ MotionChannelClass::MotionChannelClass(void) : PivotIdx(0), Type(0), VectorLen(0), - Data(NULL), + Data(nullptr), FirstFrame(-1), LastFrame(-1), - CompressedData(NULL), + CompressedData(nullptr), ValueScale(0.0f), ValueOffset(0.0f) { @@ -134,10 +134,10 @@ MotionChannelClass::~MotionChannelClass(void) void MotionChannelClass::Free(void) { delete[] CompressedData; - CompressedData=NULL; + CompressedData=nullptr; delete[] Data; - Data = NULL; + Data = nullptr; } @@ -209,7 +209,7 @@ BitChannelClass::BitChannelClass(void) : DefaultVal(0), FirstFrame(-1), LastFrame(-1), - Bits(NULL) + Bits(nullptr) { } @@ -247,7 +247,7 @@ BitChannelClass::~BitChannelClass(void) void BitChannelClass::Free(void) { delete[] Bits; - Bits = NULL; + Bits = nullptr; } @@ -319,7 +319,7 @@ TimeCodedMotionChannelClass::TimeCodedMotionChannelClass(void) : Type(0), VectorLen(0), PacketSize(0), - Data(NULL), + Data(nullptr), NumTimeCodes(0), LastTimeCodeIdx(0), // absolute index to last time code CachedIdx(0) // Last Index Used @@ -358,7 +358,7 @@ TimeCodedMotionChannelClass::~TimeCodedMotionChannelClass(void) void TimeCodedMotionChannelClass::Free(void) { delete[] Data; - Data = NULL; + Data = nullptr; } @@ -685,7 +685,7 @@ TimeCodedBitChannelClass::TimeCodedBitChannelClass(void) : PivotIdx(0), Type(0), DefaultVal(0), - Bits(NULL), + Bits(nullptr), CachedIdx(0) { } @@ -724,7 +724,7 @@ TimeCodedBitChannelClass::~TimeCodedBitChannelClass(void) void TimeCodedBitChannelClass::Free(void) { delete[] Bits; - Bits = NULL; + Bits = nullptr; } @@ -845,9 +845,9 @@ AdaptiveDeltaMotionChannelClass::AdaptiveDeltaMotionChannelClass(void) : PivotIdx(0), Type(0), VectorLen(0), - Data(NULL), + Data(nullptr), NumFrames(0), - CacheData(NULL), + CacheData(nullptr), Scale(0.0f) { @@ -902,10 +902,10 @@ AdaptiveDeltaMotionChannelClass::~AdaptiveDeltaMotionChannelClass(void) void AdaptiveDeltaMotionChannelClass::Free(void) { delete[] Data; - Data = NULL; + Data = nullptr; delete CacheData; - CacheData = NULL; + CacheData = nullptr; } @@ -1305,7 +1305,7 @@ return; } delete[] Data; - Data=NULL; + Data=nullptr; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index 6f8e52b0d59..91a3c86c1ad 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -33,6 +33,7 @@ *-------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + #include "part_buf.h" #include "part_emt.h" #include "ww3d.h" @@ -102,7 +103,7 @@ ParticleBufferClass::ParticleBufferClass int frame_mode, const W3dEmitterLinePropertiesStruct * line_props ) : - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -122,36 +123,36 @@ ParticleBufferClass::ParticleBufferClass BoundingBox(Vector3(0,0,0),Vector3(0,0,0)), BoundingBoxDirty(true), NumColorKeyFrames(0), - ColorKeyFrameTimes(NULL), - ColorKeyFrameValues(NULL), - ColorKeyFrameDeltas(NULL), + ColorKeyFrameTimes(nullptr), + ColorKeyFrameValues(nullptr), + ColorKeyFrameDeltas(nullptr), NumAlphaKeyFrames(0), - AlphaKeyFrameTimes(NULL), - AlphaKeyFrameValues(NULL), - AlphaKeyFrameDeltas(NULL), + AlphaKeyFrameTimes(nullptr), + AlphaKeyFrameValues(nullptr), + AlphaKeyFrameDeltas(nullptr), NumSizeKeyFrames(0), - SizeKeyFrameTimes(NULL), - SizeKeyFrameValues(NULL), - SizeKeyFrameDeltas(NULL), + SizeKeyFrameTimes(nullptr), + SizeKeyFrameValues(nullptr), + SizeKeyFrameDeltas(nullptr), NumRotationKeyFrames(0), - RotationKeyFrameTimes(NULL), - RotationKeyFrameValues(NULL), - HalfRotationKeyFrameDeltas(NULL), - OrientationKeyFrameValues(NULL), + RotationKeyFrameTimes(nullptr), + RotationKeyFrameValues(nullptr), + HalfRotationKeyFrameDeltas(nullptr), + OrientationKeyFrameValues(nullptr), NumFrameKeyFrames(0), - FrameKeyFrameTimes(NULL), - FrameKeyFrameValues(NULL), - FrameKeyFrameDeltas(NULL), + FrameKeyFrameTimes(nullptr), + FrameKeyFrameValues(nullptr), + FrameKeyFrameDeltas(nullptr), NumBlurTimeKeyFrames(0), - BlurTimeKeyFrameTimes(NULL), - BlurTimeKeyFrameValues(NULL), - BlurTimeKeyFrameDeltas(NULL), + BlurTimeKeyFrameTimes(nullptr), + BlurTimeKeyFrameValues(nullptr), + BlurTimeKeyFrameDeltas(nullptr), NumRandomColorEntriesMinus1(0), - RandomColorEntries(NULL), + RandomColorEntries(nullptr), NumRandomAlphaEntriesMinus1(0), - RandomAlphaEntries(NULL), + RandomAlphaEntries(nullptr), NumRandomSizeEntriesMinus1(0), - RandomSizeEntries(NULL), + RandomSizeEntries(nullptr), ColorRandom(0, 0, 0), OpacityRandom(0), SizeRandom(0), @@ -159,30 +160,30 @@ ParticleBufferClass::ParticleBufferClass FrameRandom(0), InitialOrientationRandom(0), NumRandomRotationEntriesMinus1(0), - RandomRotationEntries(NULL), + RandomRotationEntries(nullptr), NumRandomOrientationEntriesMinus1(0), - RandomOrientationEntries(NULL), + RandomOrientationEntries(nullptr), NumRandomFrameEntriesMinus1(0), - RandomFrameEntries(NULL), + RandomFrameEntries(nullptr), NumRandomBlurTimeEntriesMinus1(0), - RandomBlurTimeEntries(NULL), - PointGroup(NULL), - LineRenderer(NULL), - LineGroup(NULL), - Diffuse(NULL), - TailDiffuse(NULL), - Color(NULL), - Alpha(NULL), - Size(NULL), - Orientation(NULL), - Frame(NULL), - UCoord(NULL), - TailPosition(NULL), - APT(NULL), - GroupID(NULL), + RandomBlurTimeEntries(nullptr), + PointGroup(nullptr), + LineRenderer(nullptr), + LineGroup(nullptr), + Diffuse(nullptr), + TailDiffuse(nullptr), + Color(nullptr), + Alpha(nullptr), + Size(nullptr), + Orientation(nullptr), + Frame(nullptr), + UCoord(nullptr), + TailPosition(nullptr), + APT(nullptr), + GroupID(nullptr), PingPongPosition(pingpong), - Velocity(NULL), - TimeStamp(NULL), + Velocity(nullptr), + TimeStamp(nullptr), Emitter(emitter), DecimationThreshold(0U), ProjectedArea(0.0f), @@ -192,8 +193,8 @@ ParticleBufferClass::ParticleBufferClass LodCount = 17; LodBias = 1.0f; - Position[0] = NULL; - Position[1] = NULL; + Position[0] = nullptr; + Position[1] = nullptr; // Create color array, keyframes and randomizer table (if needed) Reset_Colors(color); @@ -255,7 +256,7 @@ ParticleBufferClass::ParticleBufferClass LineRenderer->Set_Texture(tex); LineRenderer->Set_Shader(shader); LineRenderer->Set_Width(Get_Particle_Size()); - if (line_props != NULL) { + if (line_props != nullptr) { LineRenderer->Init(*line_props); } else { // This code should not be run, but if it does, @@ -323,7 +324,7 @@ ParticleBufferClass::ParticleBufferClass // If the render mode is W3D_EMITTER_RENDER_MODE_LINE and we are supplied with // a line properties structure, set up a line renderer if (RenderMode == W3D_EMITTER_RENDER_MODE_LINE) { - if (line_props != NULL) { + if (line_props != nullptr) { LineRenderer = W3DNEW SegLineRendererClass; LineRenderer->Init(*line_props); LineRenderer->Set_Texture(tex); @@ -339,7 +340,7 @@ ParticleBufferClass::ParticleBufferClass ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : RenderObjClass(src), - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -359,33 +360,33 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : BoundingBox(Vector3(0,0,0),Vector3(0,0,0)), BoundingBoxDirty(true), NumColorKeyFrames(src.NumColorKeyFrames), - ColorKeyFrameTimes(NULL), - ColorKeyFrameValues(NULL), - ColorKeyFrameDeltas(NULL), + ColorKeyFrameTimes(nullptr), + ColorKeyFrameValues(nullptr), + ColorKeyFrameDeltas(nullptr), NumAlphaKeyFrames(src.NumAlphaKeyFrames), - AlphaKeyFrameTimes(NULL), - AlphaKeyFrameValues(NULL), - AlphaKeyFrameDeltas(NULL), + AlphaKeyFrameTimes(nullptr), + AlphaKeyFrameValues(nullptr), + AlphaKeyFrameDeltas(nullptr), NumSizeKeyFrames(src.NumSizeKeyFrames), - SizeKeyFrameTimes(NULL), - SizeKeyFrameValues(NULL), - SizeKeyFrameDeltas(NULL), + SizeKeyFrameTimes(nullptr), + SizeKeyFrameValues(nullptr), + SizeKeyFrameDeltas(nullptr), NumRotationKeyFrames(src.NumRotationKeyFrames), - RotationKeyFrameTimes(NULL), - RotationKeyFrameValues(NULL), - HalfRotationKeyFrameDeltas(NULL), - OrientationKeyFrameValues(NULL), + RotationKeyFrameTimes(nullptr), + RotationKeyFrameValues(nullptr), + HalfRotationKeyFrameDeltas(nullptr), + OrientationKeyFrameValues(nullptr), NumFrameKeyFrames(src.NumFrameKeyFrames), - FrameKeyFrameTimes(NULL), - FrameKeyFrameValues(NULL), - FrameKeyFrameDeltas(NULL), + FrameKeyFrameTimes(nullptr), + FrameKeyFrameValues(nullptr), + FrameKeyFrameDeltas(nullptr), NumBlurTimeKeyFrames(src.NumBlurTimeKeyFrames), - BlurTimeKeyFrameTimes(NULL), - BlurTimeKeyFrameValues(NULL), - BlurTimeKeyFrameDeltas(NULL), - RandomColorEntries(NULL), - RandomAlphaEntries(NULL), - RandomSizeEntries(NULL), + BlurTimeKeyFrameTimes(nullptr), + BlurTimeKeyFrameValues(nullptr), + BlurTimeKeyFrameDeltas(nullptr), + RandomColorEntries(nullptr), + RandomAlphaEntries(nullptr), + RandomSizeEntries(nullptr), ColorRandom(src.ColorRandom), OpacityRandom(src.OpacityRandom), SizeRandom(src.SizeRandom), @@ -393,37 +394,37 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : FrameRandom(src.FrameRandom), InitialOrientationRandom(src.InitialOrientationRandom), NumRandomRotationEntriesMinus1(0), - RandomRotationEntries(NULL), + RandomRotationEntries(nullptr), NumRandomOrientationEntriesMinus1(0), - RandomOrientationEntries(NULL), + RandomOrientationEntries(nullptr), NumRandomFrameEntriesMinus1(0), - RandomFrameEntries(NULL), + RandomFrameEntries(nullptr), NumRandomBlurTimeEntriesMinus1(0), - RandomBlurTimeEntries(NULL), - PointGroup(NULL), - LineRenderer(NULL), - LineGroup(NULL), - Diffuse(NULL), - TailDiffuse(NULL), - Color(NULL), - Alpha(NULL), - Size(NULL), - Orientation(NULL), - Frame(NULL), - UCoord(NULL), - TailPosition(NULL), - APT(NULL), - GroupID(NULL), + RandomBlurTimeEntries(nullptr), + PointGroup(nullptr), + LineRenderer(nullptr), + LineGroup(nullptr), + Diffuse(nullptr), + TailDiffuse(nullptr), + Color(nullptr), + Alpha(nullptr), + Size(nullptr), + Orientation(nullptr), + Frame(nullptr), + UCoord(nullptr), + TailPosition(nullptr), + APT(nullptr), + GroupID(nullptr), PingPongPosition(src.PingPongPosition), - Velocity(NULL), - TimeStamp(NULL), + Velocity(nullptr), + TimeStamp(nullptr), Emitter(src.Emitter), DecimationThreshold(src.DecimationThreshold), ProjectedArea(0.0f), DefaultTailDiffuse(src.DefaultTailDiffuse) { - Position[0] = NULL; - Position[1] = NULL; + Position[0] = nullptr; + Position[1] = nullptr; unsigned int i; @@ -551,7 +552,7 @@ ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : } } else { - // Unlike other properties, if there is no Orientation array then all the arrays are NULL + // Unlike other properties, if there is no Orientation array then all the arrays are nullptr // (including the Values array) - there is an implicit starting value of 0. } @@ -788,7 +789,7 @@ ParticleBufferClass::~ParticleBufferClass(void) // harmful (if emitter and buffer each have refcounted pointers to the // other neither would ever get deleted). // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } // Update Global Count @@ -933,7 +934,7 @@ void ParticleBufferClass::Combine_Color_And_Alpha() } else if (Diffuse) { Diffuse->Release_Ref(); - Diffuse=NULL; + Diffuse=nullptr; } } @@ -941,7 +942,7 @@ void ParticleBufferClass::Render_Particles(RenderInfoClass & rinfo) { // If the number of active points is less than the maximum or we need to decimate particles // (for LOD purposes), build the active point table: - ShareBufferClass *apt = NULL; + ShareBufferClass *apt = nullptr; unsigned int active_point_count = 0; @@ -1000,7 +1001,7 @@ void ParticleBufferClass::Render_Line(RenderInfoClass & rinfo) static SimpleDynVecClass tmp_id; Vector3 * positions = Position[pingpong]->Get_Array(); - Vector4 * diffuse = 0; + Vector4 * diffuse = nullptr; Vector4 default_diffuse(0, 0, 0, 0); unsigned char *ids = GroupID->Get_Array(); Combine_Color_And_Alpha(); @@ -1092,7 +1093,7 @@ void ParticleBufferClass::Render_Line_Group(RenderInfoClass & rinfo) { // If the number of active points is less than the maximum or we need to decimate particles // (for LOD purposes), build the active point table: - ShareBufferClass *apt = NULL; + ShareBufferClass *apt = nullptr; unsigned int active_point_count = 0; @@ -1442,14 +1443,14 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct &new_prop // ColorKeyFrameValues if the right size, otherwise release and reallocate. if (Color) { Color->Release_Ref(); - Color = NULL; + Color = nullptr; } delete [] ColorKeyFrameTimes; - ColorKeyFrameTimes = NULL; + ColorKeyFrameTimes = nullptr; delete [] ColorKeyFrameDeltas; - ColorKeyFrameDeltas = NULL; + ColorKeyFrameDeltas = nullptr; if (ColorKeyFrameValues) { if (NumColorKeyFrames > 1) { @@ -1590,14 +1591,14 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct &new_props // AlphaKeyFrameValues if the right size, otherwise release and reallocate. if (Alpha) { Alpha->Release_Ref(); - Alpha = NULL; + Alpha = nullptr; } delete [] AlphaKeyFrameTimes; - AlphaKeyFrameTimes = NULL; + AlphaKeyFrameTimes = nullptr; delete [] AlphaKeyFrameDeltas; - AlphaKeyFrameDeltas = NULL; + AlphaKeyFrameDeltas = nullptr; if (AlphaKeyFrameValues) { if (NumAlphaKeyFrames > 1) { @@ -1735,14 +1736,14 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct &new_props) // SizeKeyFrameValues if the right size, otherwise release and reallocate. if (Size) { Size->Release_Ref(); - Size = NULL; + Size = nullptr; } delete [] SizeKeyFrameTimes; - SizeKeyFrameTimes = NULL; + SizeKeyFrameTimes = nullptr; delete [] SizeKeyFrameDeltas; - SizeKeyFrameDeltas = NULL; + SizeKeyFrameDeltas = nullptr; if (SizeKeyFrameValues) { if (NumSizeKeyFrames > 1) { @@ -1886,7 +1887,7 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro RotationRandom = new_props.Rand * 0.001f; InitialOrientationRandom = orient_rnd; - // If both randomizers are effectively zero and rotation is constant zero, then all arrays are NULL. + // If both randomizers are effectively zero and rotation is constant zero, then all arrays are nullptr. static const float eps_orientation = 2.77777778e-4f; // Epsilon is equivalent to 0.1 degree static const float eps_rotation = 2.77777778e-4f; // Epsilon is equivalent to one rotation per hour (in rotations / second) bool orientation_rand_zero = fabs(orient_rnd) < eps_orientation; @@ -1897,16 +1898,16 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct &new_pro REF_PTR_RELEASE(Orientation); delete [] RotationKeyFrameTimes; - RotationKeyFrameTimes = NULL; + RotationKeyFrameTimes = nullptr; delete [] HalfRotationKeyFrameDeltas; - HalfRotationKeyFrameDeltas = NULL; + HalfRotationKeyFrameDeltas = nullptr; delete [] RotationKeyFrameValues; - RotationKeyFrameValues = NULL; + RotationKeyFrameValues = nullptr; delete [] OrientationKeyFrameValues; - OrientationKeyFrameValues = NULL; + OrientationKeyFrameValues = nullptr; NumRotationKeyFrames = 0; NumRandomRotationEntriesMinus1 = 0; @@ -2087,10 +2088,10 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct &new_props) REF_PTR_RELEASE(UCoord); delete [] FrameKeyFrameTimes; - FrameKeyFrameTimes = NULL; + FrameKeyFrameTimes = nullptr; delete [] FrameKeyFrameDeltas; - FrameKeyFrameDeltas = NULL; + FrameKeyFrameDeltas = nullptr; if (FrameKeyFrameValues) { if (NumFrameKeyFrames > 1) { @@ -2235,10 +2236,10 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct &new_bl // otherwise release and reallocate. delete [] BlurTimeKeyFrameTimes; - BlurTimeKeyFrameTimes = NULL; + BlurTimeKeyFrameTimes = nullptr; delete [] BlurTimeKeyFrameDeltas; - BlurTimeKeyFrameDeltas = NULL; + BlurTimeKeyFrameDeltas = nullptr; if (BlurTimeKeyFrameValues) { if (NumBlurTimeKeyFrames > 1) { @@ -2358,7 +2359,7 @@ void ParticleBufferClass::Emitter_Is_Dead(void) IsEmitterDead = true; // We do not have a ref for the emitter (see DTor for detailed explanation) // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } @@ -2370,7 +2371,7 @@ void ParticleBufferClass::Set_Emitter(ParticleEmitterClass *emitter) if (Emitter) { // We do not have a ref for the emitter (see DTor for detailed explanation) // Emitter->Release_Ref(); - Emitter = NULL; + Emitter = nullptr; } Emitter = emitter; @@ -2482,15 +2483,15 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) unsigned int bkey = NumBlurTimeKeyFrames -1; unsigned int part; - Vector3 *color = Color ? Color->Get_Array(): NULL; - float *alpha = Alpha ? Alpha->Get_Array(): NULL; - float *size = Size ? Size->Get_Array(): NULL; - uint8 *orientation = Orientation ? Orientation->Get_Array(): NULL; - uint8 *frame = Frame ? Frame->Get_Array(): NULL; - float *ucoord = UCoord ? UCoord->Get_Array() : NULL; - Vector3 *tailposition = TailPosition ? TailPosition->Get_Array() : NULL; + Vector3 *color = Color ? Color->Get_Array(): nullptr; + float *alpha = Alpha ? Alpha->Get_Array(): nullptr; + float *size = Size ? Size->Get_Array(): nullptr; + uint8 *orientation = Orientation ? Orientation->Get_Array(): nullptr; + uint8 *frame = Frame ? Frame->Get_Array(): nullptr; + float *ucoord = UCoord ? UCoord->Get_Array() : nullptr; + Vector3 *tailposition = TailPosition ? TailPosition->Get_Array() : nullptr; - Vector3 *position=NULL; + Vector3 *position=nullptr; if (PingPongPosition) { int pingpong = WW3D::Get_Frame_Count() & 0x1; @@ -2559,7 +2560,7 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) // Ensure the current frame keyframe is correct, and calculate frame state if (frame) { // Frame and ucoord are mutually exclusive - WWASSERT(ucoord==NULL); + WWASSERT(ucoord==nullptr); // We go from older to younger particles, so we go backwards from the last keyframe until // age >= keytime. This loop must terminate because the 0th keytime is 0. for (; part_age < FrameKeyFrameTimes[fkey]; fkey--); @@ -2575,7 +2576,7 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) // ucoord is the same as frame but in float if (ucoord) { // Frame and ucoord are mutually exclusive - WWASSERT(frame==NULL); + WWASSERT(frame==nullptr); // We go from older to younger particles, so we go backwards from the last keyframe until // age >= keytime. This loop must terminate because the 0th keytime is 0. for (; part_age < FrameKeyFrameTimes[fkey]; fkey--); @@ -2659,7 +2660,7 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) // Ensure the current frame keyframe is correct, and calculate frame state if (frame) { // Frame and ucoord are mutually exclusive - WWASSERT(ucoord==NULL); + WWASSERT(ucoord==nullptr); // We go from older to younger particles, so we go backwards from the last keyframe until // age >= keytime. This loop must terminate because the 0th keytime is 0. for (; part_age < FrameKeyFrameTimes[fkey]; fkey--); @@ -2675,7 +2676,7 @@ void ParticleBufferClass::Update_Visual_Particle_State(void) // ucoord is the same as frame but in float if (ucoord) { // Frame and ucoord are mutually exclusive - WWASSERT(frame==NULL); + WWASSERT(frame==nullptr); // We go from older to younger particles, so we go backwards from the last keyframe until // age >= keytime. This loop must terminate because the 0th keytime is 0. for (; part_age < FrameKeyFrameTimes[fkey]; fkey--); @@ -2785,7 +2786,7 @@ void ParticleBufferClass::Get_New_Particles(void) prev_pos = Position[pingpong ^ 0x1]->Get_Array(); } else { position = Position[0]->Get_Array(); - prev_pos = NULL; + prev_pos = nullptr; } unsigned char * ids = GroupID->Get_Array(); @@ -2969,7 +2970,7 @@ void ParticleBufferClass::Get_Color_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((ColorKeyFrameDeltas != NULL) && + if ((ColorKeyFrameDeltas != nullptr) && ((ColorKeyFrameDeltas[NumColorKeyFrames - 1].X != 0) || (ColorKeyFrameDeltas[NumColorKeyFrames - 1].Y != 0) || (ColorKeyFrameDeltas[NumColorKeyFrames - 1].Z != 0))) { @@ -2980,8 +2981,8 @@ void ParticleBufferClass::Get_Color_Key_Frames (ParticlePropertyStruct colors.Start = ColorKeyFrameValues[0]; colors.Rand = ColorRandom; colors.NumKeyFrames = real_keyframe_count; - colors.KeyTimes = NULL; - colors.Values = NULL; + colors.KeyTimes = nullptr; + colors.Values = nullptr; // // If we have more than just the start color, build @@ -3027,7 +3028,7 @@ void ParticleBufferClass::Get_Opacity_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((AlphaKeyFrameDeltas != NULL) && + if ((AlphaKeyFrameDeltas != nullptr) && (AlphaKeyFrameDeltas[NumAlphaKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -3036,8 +3037,8 @@ void ParticleBufferClass::Get_Opacity_Key_Frames (ParticlePropertyStruct opacities.Start = AlphaKeyFrameValues[0]; opacities.Rand = OpacityRandom; opacities.NumKeyFrames = real_keyframe_count; - opacities.KeyTimes = NULL; - opacities.Values = NULL; + opacities.KeyTimes = nullptr; + opacities.Values = nullptr; // // If we have more than just the start opacity, build @@ -3084,7 +3085,7 @@ void ParticleBufferClass::Get_Size_Key_Frames (ParticlePropertyStruct &si // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((SizeKeyFrameDeltas != NULL) && + if ((SizeKeyFrameDeltas != nullptr) && (SizeKeyFrameDeltas[NumSizeKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -3093,8 +3094,8 @@ void ParticleBufferClass::Get_Size_Key_Frames (ParticlePropertyStruct &si sizes.Start = SizeKeyFrameValues[0]; sizes.Rand = SizeRandom; sizes.NumKeyFrames = real_keyframe_count; - sizes.KeyTimes = NULL; - sizes.Values = NULL; + sizes.KeyTimes = nullptr; + sizes.Values = nullptr; // // If we have more than just the start opacity, build @@ -3145,7 +3146,7 @@ void ParticleBufferClass::Get_Rotation_Key_Frames (ParticlePropertyStruct // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((HalfRotationKeyFrameDeltas != NULL) && + if ((HalfRotationKeyFrameDeltas != nullptr) && (HalfRotationKeyFrameDeltas[NumRotationKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -3155,8 +3156,8 @@ void ParticleBufferClass::Get_Rotation_Key_Frames (ParticlePropertyStruct rotations.Start = RotationKeyFrameValues ? RotationKeyFrameValues[0] * 1000.0f : 0; rotations.Rand = RotationRandom * 1000.0f; rotations.NumKeyFrames = real_keyframe_count; - rotations.KeyTimes = NULL; - rotations.Values = NULL; + rotations.KeyTimes = nullptr; + rotations.Values = nullptr; // // If we have more than just the start rotation, build @@ -3203,7 +3204,7 @@ void ParticleBufferClass::Get_Frame_Key_Frames (ParticlePropertyStruct &f // // Determine if there is a keyframe at the very end of the particle's lifetime // - if ((FrameKeyFrameDeltas != NULL) && + if ((FrameKeyFrameDeltas != nullptr) && (FrameKeyFrameDeltas[NumFrameKeyFrames - 1] != 0)) { real_keyframe_count ++; create_last_keyframe = true; @@ -3212,8 +3213,8 @@ void ParticleBufferClass::Get_Frame_Key_Frames (ParticlePropertyStruct &f frames.Start = FrameKeyFrameValues[0]; frames.Rand = FrameRandom; frames.NumKeyFrames = real_keyframe_count; - frames.KeyTimes = NULL; - frames.Values = NULL; + frames.KeyTimes = nullptr; + frames.Values = nullptr; // // If we have more than just the start rotation, build @@ -3259,7 +3260,7 @@ void ParticleBufferClass::Get_Blur_Time_Key_Frames (ParticlePropertyStructGet_Texture_Mapping_Mode(); } return SegLineRendererClass::UNIFORM_WIDTH_TEXTURE_MAP; @@ -3335,7 +3336,7 @@ int ParticleBufferClass::Get_Line_Texture_Mapping_Mode(void) const int ParticleBufferClass::Is_Merge_Intersections(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Merge_Intersections(); } return false; @@ -3343,7 +3344,7 @@ int ParticleBufferClass::Is_Merge_Intersections(void) const int ParticleBufferClass::Is_Freeze_Random(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Freeze_Random(); } return false; @@ -3351,7 +3352,7 @@ int ParticleBufferClass::Is_Freeze_Random(void) const int ParticleBufferClass::Is_Sorting_Disabled(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Is_Sorting_Disabled(); } return false; @@ -3359,7 +3360,7 @@ int ParticleBufferClass::Is_Sorting_Disabled(void) const int ParticleBufferClass::Are_End_Caps_Enabled(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Are_End_Caps_Enabled(); } return false; @@ -3367,7 +3368,7 @@ int ParticleBufferClass::Are_End_Caps_Enabled(void) const int ParticleBufferClass::Get_Subdivision_Level(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Current_Subdivision_Level(); } return 0; @@ -3375,7 +3376,7 @@ int ParticleBufferClass::Get_Subdivision_Level(void) const float ParticleBufferClass::Get_Noise_Amplitude(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Noise_Amplitude(); } return 0.0f; @@ -3383,7 +3384,7 @@ float ParticleBufferClass::Get_Noise_Amplitude(void) const float ParticleBufferClass::Get_Merge_Abort_Factor(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Merge_Abort_Factor(); } return 0.0f; @@ -3391,7 +3392,7 @@ float ParticleBufferClass::Get_Merge_Abort_Factor(void) const float ParticleBufferClass::Get_Texture_Tile_Factor(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_Texture_Tile_Factor(); } return 1.0f; @@ -3399,7 +3400,7 @@ float ParticleBufferClass::Get_Texture_Tile_Factor(void) const Vector2 ParticleBufferClass::Get_UV_Offset_Rate(void) const { - if (LineRenderer != NULL) { + if (LineRenderer != nullptr) { return LineRenderer->Get_UV_Offset_Rate(); } return Vector2(0.0f,0.0f); @@ -3447,7 +3448,7 @@ TextureClass * ParticleBufferClass::Get_Texture (void) const if (PointGroup) return PointGroup->Get_Texture(); else if (LineGroup) return LineGroup->Get_Texture(); else if (LineRenderer) return LineRenderer->Get_Texture(); - return NULL; + return nullptr; } void ParticleBufferClass::Set_Texture (TextureClass *tex) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h index 95053db6306..686cdd1f4f0 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h @@ -312,13 +312,13 @@ class ParticleBufferClass : public RenderObjClass // At least one keyframe must exist for each property (time 0). // If a randomizer is zero and there are no additional keyframes for // that property (or the keyframes are all equal), all the arrays for - // that property are NULL (since they will never be used), except for + // that property are nullptr (since they will never be used), except for // the Values array which will have one entry (the constant value). // Note that the rotation and orientation properties are different - // only orientation is used in rendering. The rotation data is only // used to compute the orientations. So the condition is different - // if rotation and orientation randomizers, and all rotation keyframes - // are all zero, then all of the arrays will be NULL (including the + // are all zero, then all of the arrays will be null (including the // Values array). unsigned int NumColorKeyFrames; unsigned int * ColorKeyFrameTimes; // 0th entry is always 0 @@ -355,7 +355,7 @@ class ParticleBufferClass : public RenderObjClass // randomizer is zero, the table will have one entry (containing zero), // which is why each property has its own NumXXXRandomEntries variable. // If a randomizer is zero and the property has no keyframes, the table - // will be NULL since it will never be used (property is constant)). + // will be null since it will never be used (property is constant)). unsigned int NumRandomColorEntriesMinus1; // 2^n - 1 so can be used as a mask also Vector3 * RandomColorEntries; unsigned int NumRandomAlphaEntriesMinus1; // 2^n - 1 so can be used as a mask also diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 735610ee76c..e2b02421b96 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -99,11 +99,11 @@ ParticleEmitterClass::ParticleEmitterClass(float emit_rate, unsigned int burst_s MaxParticles(max_particles), IsComplete(false), NameString(::_strdup ("ParticleEmitter")), - UserString(NULL), + UserString(nullptr), RemoveOnComplete(DefaultRemoveOnComplete), IsInScene(false), GroupID(0), - Buffer(NULL), + Buffer(nullptr), IsInvisible(false) { max_age = max_age > 0.0f ? max_age : 1.0f; @@ -130,9 +130,9 @@ ParticleEmitterClass::ParticleEmitterClass(const ParticleEmitterClass & src) : BurstSize(src.BurstSize), OneTimeBurstSize(src.OneTimeBurstSize), OneTimeBurst(src.OneTimeBurst), - PosRand(src.PosRand ? src.PosRand->Clone() : NULL), + PosRand(src.PosRand ? src.PosRand->Clone() : nullptr), BaseVel(src.BaseVel), - VelRand(src.VelRand ? src.VelRand->Clone() : NULL), + VelRand(src.VelRand ? src.VelRand->Clone() : nullptr), OutwardVel(src.OutwardVel), VelInheritFactor(src.VelInheritFactor), EmitRemain(src.EmitRemain), @@ -149,7 +149,7 @@ ParticleEmitterClass::ParticleEmitterClass(const ParticleEmitterClass & src) : RemoveOnComplete(src.RemoveOnComplete), IsInScene(false), GroupID(0), - Buffer(NULL), + Buffer(nullptr), IsInvisible(src.IsInvisible) { Buffer = (ParticleBufferClass *) src.Buffer->Clone(); @@ -176,19 +176,19 @@ ParticleEmitterClass::~ParticleEmitterClass(void) Buffer->Release_Ref(); delete PosRand; - PosRand = NULL; + PosRand = nullptr; delete VelRand; - VelRand = NULL; + VelRand = nullptr; - if (NameString != NULL) { + if (NameString != nullptr) { ::free (NameString); - NameString = NULL; + NameString = nullptr; } - if (UserString != NULL) { + if (UserString != nullptr) { ::free (UserString); - UserString = NULL; + UserString = nullptr; } return ; @@ -199,11 +199,11 @@ ParticleEmitterClass * ParticleEmitterClass::Create_From_Definition (const ParticleEmitterDefClass &definition) { // Assume failure - ParticleEmitterClass *pemitter = NULL; + ParticleEmitterClass *pemitter = nullptr; // Attempt to load the texture for this emitter const char *ptexture_filename = definition.Get_Texture_Filename (); - TextureClass *ptexture = NULL; + TextureClass *ptexture = nullptr; if (ptexture_filename && ptexture_filename[0]) { ptexture = WW3DAssetManager::Get_Instance()->Get_Texture ( @@ -353,7 +353,7 @@ void ParticleEmitterClass::On_Frame_Update(void) // The particle buffer doesn't have a valid Scene yet - the emitter // finds out what scene it belongs to (goes up the container tree - // until it finds a non-NULL Scene), and then adds the particle + // until it finds a non-null Scene), and then adds the particle // buffer to it. if ( BufferSceneNeeded ) { @@ -460,8 +460,8 @@ void ParticleEmitterClass::Set_Velocity_Randomizer(Vector3Randomizer *rand) Vector3Randomizer *ParticleEmitterClass::Get_Creation_Volume (void) const { - Vector3Randomizer *randomizer = NULL; - if (PosRand != NULL) { + Vector3Randomizer *randomizer = nullptr; + if (PosRand != nullptr) { randomizer = PosRand->Clone (); //randomizer->Scale (1000.0F); } @@ -471,8 +471,8 @@ Vector3Randomizer *ParticleEmitterClass::Get_Creation_Volume (void) const Vector3Randomizer *ParticleEmitterClass::Get_Velocity_Random (void) const { - Vector3Randomizer *randomizer = NULL; - if (VelRand != NULL) { + Vector3Randomizer *randomizer = nullptr; + if (VelRand != nullptr) { randomizer = VelRand->Clone (); randomizer->Scale (1000.0F); } @@ -639,7 +639,7 @@ void ParticleEmitterClass::Create_New_Particles(const Quaternion & curr_quat, co // Initialize one new particle at the given NewParticleStruct address, with // the given age and emitter transform (expressed as a quaternion and origin -// vector). (must check if address is NULL). +// vector). (must check if address is nullptr). void ParticleEmitterClass::Initialize_Particle(NewParticleStruct * newpart, unsigned int timestamp, const Quaternion & quat, const Vector3 & orig) { @@ -698,12 +698,12 @@ ParticleEmitterClass::Build_Definition (void) const { // Allocate a new emitter definition object ParticleEmitterDefClass *pdefinition = W3DNEW ParticleEmitterDefClass; - WWASSERT (pdefinition != NULL); - if (pdefinition != NULL) { + WWASSERT (pdefinition != nullptr); + if (pdefinition != nullptr) { // Set the texture's filename TextureClass *ptexture = Get_Texture (); - if (ptexture != NULL) { + if (ptexture != nullptr) { pdefinition->Set_Texture_Filename (ptexture->Get_Texture_Name()); REF_PTR_RELEASE(ptexture); } @@ -823,7 +823,7 @@ ParticleEmitterClass::Save (ChunkSaveClass &chunk_save) const // Build a definition from this emitter instance, and save it // to the chunk. ParticleEmitterDefClass *pdefinition = Build_Definition (); - if (pdefinition != NULL) { + if (pdefinition != nullptr) { ret_val = pdefinition->Save_W3D (chunk_save); } @@ -836,9 +836,9 @@ void ParticleEmitterClass::Set_Name (const char *pname) { // Free the old name if necessary - if (NameString != NULL) { + if (NameString != nullptr) { ::free (NameString); - NameString = NULL; + NameString = nullptr; } // Copy the provided name @@ -873,7 +873,7 @@ ParticleEmitterClass::Add_Dependencies_To_List // Get the texture the emitter is using and add it to our list // TextureClass *texture = Get_Texture (); - if (texture != NULL) { + if (texture != nullptr) { file_list.Add (texture->Get_Full_Path ()); REF_PTR_RELEASE(texture); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h index bbd31a4975e..ece8ba7c080 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -77,8 +77,8 @@ void Copy_Emitter_Property_Struct dest.Start = src.Start; dest.Rand = src.Rand; dest.NumKeyFrames = src.NumKeyFrames; - dest.KeyTimes = NULL; - dest.Values = NULL; + dest.KeyTimes = nullptr; + dest.Values = nullptr; if (dest.NumKeyFrames > 0) { dest.KeyTimes = W3DNEWARRAY float[dest.NumKeyFrames]; @@ -117,7 +117,7 @@ class ParticleEmitterClass : public RenderObjClass int max_particles = 0, int max_buffer_size = -1, bool pingpong = false, int render_mode = W3D_EMITTER_RENDER_MODE_TRI_PARTICLES, int frame_mode = W3D_EMITTER_FRAME_MODE_1x1, - const W3dEmitterLinePropertiesStruct * line_props = NULL); + const W3dEmitterLinePropertiesStruct * line_props = nullptr); ParticleEmitterClass(const ParticleEmitterClass & src); ParticleEmitterClass & operator = (const ParticleEmitterClass &); @@ -179,7 +179,7 @@ class ParticleEmitterClass : public RenderObjClass void Set_Base_Velocity(const Vector3& base_vel); void Set_Outwards_Velocity(float out_vel); void Set_Velocity_Inheritance_Factor(float inh_factor); - void Set_Acceleration (const Vector3 &acceleration) { if (Buffer != NULL) Buffer->Set_Acceleration (acceleration/1000000.0f); } + void Set_Acceleration (const Vector3 &acceleration) { if (Buffer != nullptr) Buffer->Set_Acceleration (acceleration/1000000.0f); } // Change visual properties of emitter / buffer: void Reset_Colors(ParticlePropertyStruct &new_props) { if (Buffer) Buffer->Reset_Colors(new_props); } @@ -220,7 +220,7 @@ class ParticleEmitterClass : public RenderObjClass // Virtual accessors (used for type specific information) // virtual int Get_User_Type (void) const { return EMITTER_TYPEID_DEFAULT; } - virtual const char * Get_User_String (void) const { return NULL; } + virtual const char * Get_User_String (void) const { return nullptr; } // // Inline accessors. @@ -302,7 +302,7 @@ class ParticleEmitterClass : public RenderObjClass // Initialize one new particle at the given NewParticleStruct // address, with the given age and emitter transform (expressed as a - // quaternion and origin vector). (must check if address is NULL). + // quaternion and origin vector). (must check if address is nullptr). void Initialize_Particle(NewParticleStruct * newpart, unsigned int age, const Quaternion & quat, const Vector3 & orig); @@ -310,9 +310,9 @@ class ParticleEmitterClass : public RenderObjClass unsigned int BurstSize; // Burst size (how many particles in each emission). unsigned int OneTimeBurstSize; // Burst size for a one-time burst. bool OneTimeBurst; // Do we need to do a one-time burst? - Vector3Randomizer * PosRand; // Position randomizer pointer (may be NULL). + Vector3Randomizer * PosRand; // Position randomizer pointer (may be null). Vector3 BaseVel; // Base initial emission velocity. - Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be NULL). + Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be null). float OutwardVel; // Size of outwards velocity. float VelInheritFactor; // Affects emitter vel. inherited by particles. unsigned int EmitRemain; // Millisecond emitter remainder. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index 9b19d924f2f..8090e59eed7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -42,11 +42,11 @@ #include "texture.h" #ifndef SAFE_DELETE -#define SAFE_DELETE(pointer) { delete pointer; pointer = NULL; } +#define SAFE_DELETE(pointer) { delete pointer; pointer = nullptr; } #endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = NULL; } +#define SAFE_DELETE_ARRAY(pointer) { delete [] pointer; pointer = nullptr; } #endif @@ -68,13 +68,13 @@ const char *EMITTER_TYPE_NAMES[EMITTER_TYPEID_COUNT] = // ParticleEmitterDefClass // ParticleEmitterDefClass::ParticleEmitterDefClass (void) - : m_pName (NULL), + : m_pName (nullptr), m_Version (0L), - m_pUserString (NULL), + m_pUserString (nullptr), m_iUserType (EMITTER_TYPEID_DEFAULT), m_InitialOrientationRandom (0), - m_pCreationVolume (NULL), - m_pVelocityRandomizer (NULL) + m_pCreationVolume (nullptr), + m_pVelocityRandomizer (nullptr) { ::memset (&m_Info, 0, sizeof (m_Info)); ::memset (&m_InfoV2, 0, sizeof (m_InfoV2)); @@ -96,13 +96,13 @@ ParticleEmitterDefClass::ParticleEmitterDefClass (void) // ParticleEmitterDefClass // ParticleEmitterDefClass::ParticleEmitterDefClass (const ParticleEmitterDefClass &src) - : m_pName (NULL), + : m_pName (nullptr), m_Version (0L), - m_pUserString (NULL), + m_pUserString (nullptr), m_iUserType (EMITTER_TYPEID_DEFAULT), m_InitialOrientationRandom (src.m_InitialOrientationRandom), - m_pCreationVolume (NULL), - m_pVelocityRandomizer (NULL) + m_pCreationVolume (nullptr), + m_pVelocityRandomizer (nullptr) { ::memset (&m_Info, 0, sizeof (m_Info)); ::memset (&m_InfoV2, 0, sizeof (m_InfoV2)); @@ -128,19 +128,19 @@ ParticleEmitterDefClass::ParticleEmitterDefClass (const ParticleEmitterDefClass ParticleEmitterDefClass::~ParticleEmitterDefClass (void) { // Free the name buffer if necessary - if (m_pName != NULL) { + if (m_pName != nullptr) { // free() is used because the buffer was allocated with ::_strdup(). ::free (m_pName); - m_pName = NULL; + m_pName = nullptr; } // Free the user-string buffer if necessary - if (m_pUserString != NULL) { + if (m_pUserString != nullptr) { // free() is used because the buffer was allocated with ::malloc() or ::_strdup(). ::free (m_pUserString); - m_pUserString = NULL; + m_pUserString = nullptr; } Free_Props (); @@ -240,7 +240,7 @@ ParticleEmitterDefClass::Set_Velocity_Random (Vector3Randomizer *randomizer) // // Ensure our persistent structure is up-to-date so it will save correctly // - if (m_pVelocityRandomizer != NULL) { + if (m_pVelocityRandomizer != nullptr) { Initialize_Randomizer_Struct (*m_pVelocityRandomizer, m_InfoV2.VelRandom); } @@ -261,7 +261,7 @@ ParticleEmitterDefClass::Set_Creation_Volume (Vector3Randomizer *randomizer) // // Ensure our persistent structure is up-to-date so it will save correctly // - if (m_pCreationVolume != NULL) { + if (m_pCreationVolume != nullptr) { Initialize_Randomizer_Struct (*m_pCreationVolume, m_InfoV2.CreationVolume); } @@ -320,7 +320,7 @@ ParticleEmitterDefClass::Normalize_Filename (void) // Find the last occurance of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); - if (filename != NULL) { + if (filename != nullptr) { // Increment past the directory deliminator filename ++; @@ -458,7 +458,7 @@ ParticleEmitterDefClass::Convert_To_Ver2 (void) // ShaderClass shader = ShaderClass::_PresetAdditiveSpriteShader; TextureClass *ptexture = WW3DAssetManager::Get_Instance ()->Get_Texture (m_Info.TextureFilename); - if (ptexture != NULL) { + if (ptexture != nullptr) { // If texture has an alpha channel do alpha blending instead of additive // (which is the default for point groups): // SurfaceClass::SurfaceDescription surf_desc; @@ -635,7 +635,7 @@ ParticleEmitterDefClass::Read_Info (ChunkLoadClass &chunk_load) Vector3Randomizer * ParticleEmitterDefClass::Create_Randomizer (W3dVolumeRandomizerStruct &info) { - Vector3Randomizer *randomizer = NULL; + Vector3Randomizer *randomizer = nullptr; switch (info.ClassID) { case Vector3Randomizer::CLASSID_SOLIDBOX: @@ -794,7 +794,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the color keyframes from the chunk // - Read_Color_Keyframe (chunk_load, NULL, &m_ColorKeyframes.Start); + Read_Color_Keyframe (chunk_load, nullptr, &m_ColorKeyframes.Start); for (index = 0; index < m_ColorKeyframes.NumKeyFrames; index ++) { Read_Color_Keyframe (chunk_load, &m_ColorKeyframes.KeyTimes[index], @@ -821,7 +821,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the opacity keyframes from the chunk // - Read_Opacity_Keyframe (chunk_load, NULL, &m_OpacityKeyframes.Start); + Read_Opacity_Keyframe (chunk_load, nullptr, &m_OpacityKeyframes.Start); for (index = 0; index < m_OpacityKeyframes.NumKeyFrames; index ++) { Read_Opacity_Keyframe (chunk_load, &m_OpacityKeyframes.KeyTimes[index], @@ -831,7 +831,7 @@ ParticleEmitterDefClass::Read_Props (ChunkLoadClass &chunk_load) // // Read the size keyframes from the chunk // - Read_Size_Keyframe (chunk_load, NULL, &m_SizeKeyframes.Start); + Read_Size_Keyframe (chunk_load, nullptr, &m_SizeKeyframes.Start); for (index = 0; index < m_SizeKeyframes.NumKeyFrames; index ++) { Read_Size_Keyframe (chunk_load, &m_SizeKeyframes.KeyTimes[index], @@ -872,12 +872,12 @@ ParticleEmitterDefClass::Read_Color_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the oclor back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = RGBA_TO_VECTOR3 (key_frame.Color); } @@ -910,12 +910,12 @@ ParticleEmitterDefClass::Read_Opacity_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the value back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = key_frame.Opacity; } @@ -948,12 +948,12 @@ ParticleEmitterDefClass::Read_Size_Keyframe if (chunk_load.Read (&key_frame, sizeof (key_frame)) == sizeof (key_frame)) { // Pass the key time to the caller - if (key_time != NULL) { + if (key_time != nullptr) { (*key_time) = key_frame.Time; } // Pass the value back to the caller - if (value != NULL) { + if (value != nullptr) { (*value) = key_frame.Size; } @@ -1246,7 +1246,7 @@ ParticleEmitterDefClass::Save_User_Data (ChunkSaveClass &chunk_save) ret_val = WW3D_ERROR_OK; // Do we need to write the user string to the file? - if (m_pUserString != NULL) { + if (m_pUserString != nullptr) { // Now write the user string param to the file if (chunk_save.Write (m_pUserString, string_len) != string_len) { @@ -1853,11 +1853,11 @@ PrototypeClass * ParticleEmitterLoaderClass::Load_W3D (ChunkLoadClass &chunk_load) { // Assume failure - ParticleEmitterPrototypeClass *pprototype = NULL; + ParticleEmitterPrototypeClass *pprototype = nullptr; // Create a definition object ParticleEmitterDefClass *pdefinition = W3DNEW ParticleEmitterDefClass; - if (pdefinition != NULL) { + if (pdefinition != nullptr) { // Ask the definition object to load the emitter data if (pdefinition->Load_W3D (chunk_load) != WW3D_ERROR_OK) { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index acd1e195627..48f10b95ca9 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -67,7 +67,7 @@ RectClass Render2DClass::ScreenResolution( 0,0,0,0 ); Render2DClass::Render2DClass( TextureClass* tex ) : CoordinateScale( 1, 1 ), CoordinateOffset( 0, 0 ), - Texture(0), + Texture(nullptr), ZValue(0), IsHidden( false ), IsGrayScale (false), @@ -133,7 +133,7 @@ void Render2DClass::Set_Texture( const char * filename) { TextureClass * tex = WW3DAssetManager::Get_Instance()->Get_Texture( filename, MIP_LEVELS_1 ); Set_Texture( tex ); - if ( tex != NULL ) { + if ( tex != nullptr ) { SET_REF_OWNER( tex ); tex->Release_Ref(); } @@ -708,7 +708,7 @@ void Render2DClass::Render(void) Render2DTextClass::Render2DTextClass(Font3DInstanceClass *font) : Location(0.0f,0.0f), Cursor(0.0f,0.0f), - Font(NULL), + Font(nullptr), WrapWidth(0), ClipRect(0, 0, 0, 0), IsClippedEnabled(false) @@ -739,7 +739,7 @@ void Render2DTextClass::Set_Font( Font3DInstanceClass *font ) { REF_PTR_SET(Font,font); - if ( Font != NULL ) { + if ( Font != nullptr ) { Set_Texture( Font->Peek_Texture() ); #define BLOCK_CHAR 0 diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h index 8b485725e75..b7a616b68f6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h @@ -95,7 +95,7 @@ class Render2DClass : public W3DMPO { W3DMPO_GLUE(Render2DClass) public: - Render2DClass( TextureClass* tex = NULL ); + Render2DClass( TextureClass* tex = nullptr ); virtual ~Render2DClass(void); virtual void Reset(void); @@ -197,7 +197,7 @@ class Render2DClass : public W3DMPO */ class Render2DTextClass : public Render2DClass { public: - Render2DTextClass(Font3DInstanceClass *font=NULL); + Render2DTextClass(Font3DInstanceClass *font=nullptr); ~Render2DTextClass(); virtual void Reset(void); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp index 66ac05f3792..d21731a8be2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/rinfo.cpp @@ -53,11 +53,11 @@ RenderInfoClass::RenderInfoClass(CameraClass & cam) : fog_start(0.0f), fog_end(0.0f), fog_scale(0.0f), - light_environment(0), + light_environment(nullptr), AdditionalMaterialPassCount(0), RejectedMaterialPasses(0), OverrideFlagLevel(0), - Texture_Projector(NULL), + Texture_Projector(nullptr), alphaOverride(1.0f), materialPassAlphaOverride(1.0f), materialPassEmissiveOverride(1.0f) @@ -91,7 +91,7 @@ void RenderInfoClass::Pop_Material_Pass(void) WWASSERT(AdditionalMaterialPassCount>0); AdditionalMaterialPassCount--; MaterialPassClass * mpass = AdditionalMaterialPassArray[AdditionalMaterialPassCount]; - if (mpass != NULL) { + if (mpass != nullptr) { mpass->Release_Ref(); } } else { @@ -139,8 +139,8 @@ RenderInfoClass::RINFO_OVERRIDE_FLAGS & RenderInfoClass::Current_Override_Flags( SpecialRenderInfoClass::SpecialRenderInfoClass(CameraClass & cam,int render_type) : RenderInfoClass(cam), RenderType(render_type), - VisRasterizer(NULL), - BWRenderer(NULL) + VisRasterizer(nullptr), + BWRenderer(nullptr) { } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp index c18624f26f3..e1a66b05f3a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -361,7 +361,7 @@ SimpleSceneClass::~SimpleSceneClass(void) void SimpleSceneClass::Remove_All_Render_Objects(void) { RenderObjClass * obj; - while ( ( obj = RenderList.Remove_Head() ) != NULL ) { + while ( ( obj = RenderList.Remove_Head() ) != nullptr ) { SceneClass::Remove_Render_Object(obj); obj->Release_Ref(); // remove head gets a ref } @@ -554,13 +554,13 @@ void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo) // apply only the first four lights in the scene // derived classes should use light environment - WWASSERT(rinfo.light_environment==NULL); + WWASSERT(rinfo.light_environment==nullptr); int count=0; // Turn off lights in case we have none - DX8Wrapper::Set_Light(0,NULL); - DX8Wrapper::Set_Light(1,NULL); - DX8Wrapper::Set_Light(2,NULL); - DX8Wrapper::Set_Light(3,NULL); + DX8Wrapper::Set_Light(0,nullptr); + DX8Wrapper::Set_Light(1,nullptr); + DX8Wrapper::Set_Light(2,nullptr); + DX8Wrapper::Set_Light(3,nullptr); // (gth) WWShade only works with light environments. We need to upgrade LightEnvironment to // support real point lights, etc. It will likely just evolve into "the n most important" lights diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp index a711dbdfa19..619a9c364b7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/shader.cpp @@ -958,7 +958,7 @@ void ShaderClass::Apply() DX8CALL(SetTextureStageState(2,D3DTSS_ALPHAARG1,D3DTA_CURRENT)); DX8CALL(SetTextureStageState(2,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE)); DX8CALL(SetTextureStageState(2,D3DTSS_TEXCOORDINDEX,D3DTSS_TCI_PASSTHRU)); - DX8CALL(SetTexture(2,0)); + DX8CALL(SetTexture(2,nullptr)); kill_stage_2=false; ShaderDirty=true; } @@ -1009,7 +1009,7 @@ void ShaderClass::Apply() DX8CALL(SetTextureStageState(2,D3DTSS_ALPHAOP,D3DTOP_DISABLE)); } DX8CALL(SetTextureStageState(2,D3DTSS_TEXCOORDINDEX,D3DTSS_TCI_PASSTHRU)); - DX8CALL(SetTexture(2,0)); + DX8CALL(SetTexture(2,nullptr)); } if(!diff) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp index 68a58c327ff..bc855b2d529 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -272,7 +272,7 @@ void SortingRendererClass::Insert_Triangles( if (!node) sorted_list.Add_Tail(state); #ifdef WWDEBUG - unsigned short* indices=NULL; + unsigned short* indices=nullptr; SortingIndexBufferClass* index_buffer=static_cast(state->sorting_state.index_buffer); WWASSERT(index_buffer); indices=index_buffer->index_buffer; @@ -382,19 +382,19 @@ static void Apply_Render_State(RenderStateStruct& render_state) DX8Wrapper::Set_DX8_Light(3,&render_state.Lights[3]); } else { - DX8Wrapper::Set_DX8_Light(3,NULL); + DX8Wrapper::Set_DX8_Light(3,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(2,NULL); + DX8Wrapper::Set_DX8_Light(2,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(1,NULL); + DX8Wrapper::Set_DX8_Light(1,nullptr); } } else { - DX8Wrapper::Set_DX8_Light(0,NULL); + DX8Wrapper::Set_DX8_Light(0,nullptr); } @@ -426,7 +426,7 @@ void SortingRendererClass::Flush_Sorting_Pool() unsigned vertex_array_offset=0; for (unsigned node_id=0;node_id(state->sorting_state.vertex_buffers[0]); WWASSERT(vertex_buffer); src_verts=vertex_buffer->VertexBuffer; @@ -444,7 +444,7 @@ void SortingRendererClass::Flush_Sorting_Pool() D3DXMATRIX d3d_mtx=(D3DXMATRIX&)state->sorting_state.world*(D3DXMATRIX&)state->sorting_state.view; const Matrix4x4& mtx=(const Matrix4x4&)d3d_mtx; - unsigned short* indices=NULL; + unsigned short* indices=nullptr; SortingIndexBufferClass* index_buffer=static_cast(state->sorting_state.index_buffer); WWASSERT(index_buffer); indices=index_buffer->index_buffer; @@ -626,8 +626,8 @@ void SortingRendererClass::Flush() Flush_Sorting_Pool(); DX8Wrapper::_Enable_Triangle_Draw(old_enable); - DX8Wrapper::Set_Index_Buffer(0,0); - DX8Wrapper::Set_Vertex_Buffer(0); + DX8Wrapper::Set_Index_Buffer(nullptr,0); + DX8Wrapper::Set_Vertex_Buffer(nullptr); total_sorting_vertices=0; DynamicIBAccessClass::_Reset(false); @@ -643,12 +643,12 @@ void SortingRendererClass::Flush() void SortingRendererClass::Deinit() { - SortingNodeStruct *head = NULL; + SortingNodeStruct *head = nullptr; // // Flush the sorted list // - while ((head = sorted_list.Head ()) != NULL) { + while ((head = sorted_list.Head ()) != nullptr) { sorted_list.Remove_Head (); delete head; } @@ -656,13 +656,13 @@ void SortingRendererClass::Deinit() // // Flush the clean list // - while ((head = clean_list.Head ()) != NULL) { + while ((head = clean_list.Head ()) != nullptr) { clean_list.Remove_Head (); delete head; } delete[] temp_index_array; - temp_index_array=NULL; + temp_index_array=nullptr; temp_index_array_count=0; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp index 288d4cec6f8..ab3b5ada28a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp @@ -71,9 +71,9 @@ class DynD3DMATERIAL8 : public W3DMPO */ VertexMaterialClass::VertexMaterialClass(void): #ifdef DYN_MAT8 - MaterialDyn(NULL), + MaterialDyn(nullptr), #else - MaterialOld(NULL), + MaterialOld(nullptr), #endif Flags(0), AmbientColorSource(D3DMCS_MATERIAL), @@ -87,7 +87,7 @@ VertexMaterialClass::VertexMaterialClass(void): for (i=0; iClone(); @@ -156,7 +156,7 @@ VertexMaterialClass::~VertexMaterialClass(void) if (Mapper[i]) { REF_PTR_RELEASE(Mapper[i]); - Mapper[i]=NULL; + Mapper[i]=nullptr; } } @@ -181,9 +181,9 @@ VertexMaterialClass & VertexMaterialClass::operator = (const VertexMaterialClass CRCDirty=src.CRCDirty; int stage; for (stage=0;stageRelease_Ref(); - Mapper[stage] = NULL; + Mapper[stage] = nullptr; } } for (stage=0;stageGet_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -1371,7 +1371,7 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -1401,7 +1401,7 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; switch (format) { case TGA: @@ -1507,7 +1507,7 @@ void WW3D::Start_Movie_Capture( const char * filename_base, float frame_rate ) int width=bounds.right-bounds.left; int depth=24; - WWASSERT( Movie == NULL); + WWASSERT( Movie == nullptr); if (frame_rate == 0.0f) { frame_rate = 1.0f; @@ -1542,9 +1542,9 @@ void WW3D::Stop_Movie_Capture( void ) IsCapturing = false; WWDEBUG_SAY(( "Stoping Movie" )); - WWASSERT( Movie != NULL); + WWASSERT( Movie != nullptr); delete Movie; - Movie = NULL; + Movie = nullptr; } #endif } @@ -1658,7 +1658,7 @@ bool WW3D::Is_Movie_Paused() *=============================================================================================*/ bool WW3D::Is_Recording_Next_Frame() { - return (Movie != 0) && (!PauseRecord || RecordNextFrame); + return (Movie != nullptr) && (!PauseRecord || RecordNextFrame); } @@ -1676,7 +1676,7 @@ bool WW3D::Is_Recording_Next_Frame() *=============================================================================================*/ bool WW3D::Is_Movie_Ready() { - return Movie != 0; + return Movie != nullptr; } @@ -1709,10 +1709,10 @@ void WW3D::Update_Movie_Capture( void ) surface->Get_Description(surfaceDesc); SurfaceClass* surfaceCopy = NEW_REF(SurfaceClass, (DX8Wrapper::_Create_DX8_Surface(surfaceDesc.Width, surfaceDesc.Height, surfaceDesc.Format))); - DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), NULL, 0, surfaceCopy->Peek_D3D_Surface(), NULL); + DX8Wrapper::_Copy_DX8_Rects(surface->Peek_D3D_Surface(), nullptr, 0, surfaceCopy->Peek_D3D_Surface(), nullptr); surface->Release_Ref(); - surface = NULL; + surface = nullptr; struct Rect { @@ -1721,7 +1721,7 @@ void WW3D::Update_Movie_Capture( void ) } lrect; lrect.pBits = surfaceCopy->Lock(&lrect.Pitch); - if (lrect.pBits == NULL) + if (lrect.pBits == nullptr) { surfaceCopy->Release_Ref(); return; @@ -1751,7 +1751,7 @@ void WW3D::Update_Movie_Capture( void ) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Movie->Grab(image); #endif @@ -1880,7 +1880,7 @@ VertexMaterialClass * WW3D::Peek_Default_Debug_Material(void) WWASSERT(DefaultDebugMaterial); return DefaultDebugMaterial; #else - return NULL; + return nullptr; #endif } @@ -1933,7 +1933,7 @@ ShaderClass WW3D::Peek_Lightmap_Debug_Shader(void) void WW3D::Allocate_Debug_Resources(void) { #ifdef WWDEBUG - WWASSERT(DefaultDebugMaterial == NULL); + WWASSERT(DefaultDebugMaterial == nullptr); DefaultDebugMaterial = W3DNEW VertexMaterialClass; DefaultDebugMaterial->Set_Shininess(0.0f); DefaultDebugMaterial->Set_Opacity(1.0f); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 533396f1dec..5768f899fea 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -100,7 +100,7 @@ class WW3D }; - static WW3DErrorType Init(void * hwnd, char *defaultpal = NULL, bool lite = false); + static WW3DErrorType Init(void * hwnd, char *defaultpal = nullptr, bool lite = false); static WW3DErrorType Shutdown(void); static bool Is_Initted(void) { return IsInitted; } @@ -143,7 +143,7 @@ class WW3D ** special cases like generating a shadow texture for an object. Basically this function will have the ** entire scene rendering overhead. */ - static WW3DErrorType Begin_Render(bool clear = false,bool clearz = true,const Vector3 & color = Vector3(0,0,0), float dest_alpha=0.0f, void(*network_callback)(void) = NULL); + static WW3DErrorType Begin_Render(bool clear = false,bool clearz = true,const Vector3 & color = Vector3(0,0,0), float dest_alpha=0.0f, void(*network_callback)(void) = nullptr); static WW3DErrorType Render(const LayerListClass & layerlist); static WW3DErrorType Render(const LayerClass & layer); static WW3DErrorType Render(SceneClass * scene,CameraClass * cam,bool clear = false,bool clearz = false,const Vector3 & color = Vector3(0,0,0)); diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 3f887a07ca6..651ceada335 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -73,9 +73,9 @@ // GLOBALS //////////////////////////////////////////////////////////////////// -HINSTANCE ApplicationHInstance = NULL; ///< our application instance -HWND ApplicationHWnd = NULL; ///< our application window handle -Win32Mouse *TheWin32Mouse = NULL; ///< for the WndProc() only +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance +HWND ApplicationHWnd = nullptr; ///< our application window handle +Win32Mouse *TheWin32Mouse = nullptr; ///< for the WndProc() only DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows. const Char *g_strFile = "data\\Generals.str"; @@ -86,7 +86,7 @@ static Bool gInitializing = false; static Bool gDoPaint = true; static Bool isWinMainActive = false; -static HBITMAP gLoadScreenBitmap = NULL; +static HBITMAP gLoadScreenBitmap = nullptr; //#define DEBUG_WINDOWS_MESSAGES @@ -538,7 +538,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, //------------------------------------------------------------------------- case 0x020A: // WM_MOUSEWHEEL { - if( TheWin32Mouse == NULL ) + if( TheWin32Mouse == nullptr ) return 0; long x = (long) LOWORD(lParam); @@ -557,7 +557,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, //------------------------------------------------------------------------- case WM_MOUSEMOVE: { - if( TheWin32Mouse == NULL ) + if( TheWin32Mouse == nullptr ) return 0; // ignore when window is not active @@ -606,7 +606,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, ::SetBkColor(dc, RGB(0,0,0)); ::TextOut(dc, 30, 30, "Loading Command & Conquer Generals...", 37); #endif - if (gLoadScreenBitmap!=NULL) { + if (gLoadScreenBitmap!=nullptr) { Int savContext = ::SaveDC(dc); HDC tmpDC = ::CreateCompatibleDC(dc); HBITMAP savBitmap = (HBITMAP)::SelectObject(tmpDC, gLoadScreenBitmap); @@ -699,8 +699,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, WndProc, 0, 0, hInstance, LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ApplicationIcon)), - NULL/*LoadCursor(NULL, IDC_ARROW)*/, - (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, + nullptr/*LoadCursor(nullptr, IDC_ARROW)*/, + (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT("Game Window") }; RegisterClass( &wndClass ); @@ -737,10 +737,10 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin //(GetSystemMetrics( SM_CYSCREEN ) / 25) - (startHeight / 25),//this works with any screen res rect.right-rect.left, rect.bottom-rect.top, - 0L, - 0L, + nullptr, + nullptr, hInstance, - 0L ); + nullptr ); if (!runWindowed) @@ -822,7 +822,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, /// @todo remove this force set of working directory later Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (Char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -881,14 +881,14 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, // save our application instance for future use ApplicationHInstance = hInstance; - if (gLoadScreenBitmap!=NULL) { + if (gLoadScreenBitmap!=nullptr) { ::DeleteObject(gLoadScreenBitmap); - gLoadScreenBitmap = NULL; + gLoadScreenBitmap = nullptr; } // BGC - initialize COM - // OleInitialize(NULL); + // OleInitialize(nullptr); @@ -902,7 +902,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, if (!rts::ClientInstance::initialize()) { - HWND ccwindow = FindWindow(rts::ClientInstance::getFirstInstanceName(), NULL); + HWND ccwindow = FindWindow(rts::ClientInstance::getFirstInstanceName(), nullptr); if (ccwindow) { SetForegroundWindow(ccwindow); @@ -911,7 +911,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, DEBUG_LOG(("Generals is already running...Bail!")); delete TheVersion; - TheVersion = NULL; + TheVersion = nullptr; shutdownMemoryManager(); return exitcode; } @@ -923,7 +923,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, exitcode = GameMain(); delete TheVersion; - TheVersion = NULL; + TheVersion = nullptr; #ifdef MEMORYPOOL_DEBUG TheMemoryPoolFactory->debugMemoryReport(REPORT_POOLINFO | REPORT_POOL_OVERFLOW | REPORT_SIMPLE_LEAKS, 0, 0); @@ -945,9 +945,9 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, #ifdef RTS_ENABLE_CRASHDUMP MiniDumper::shutdownMiniDumper(); #endif - TheUnicodeStringCriticalSection = NULL; - TheDmaCriticalSection = NULL; - TheMemoryPoolCriticalSection = NULL; + TheUnicodeStringCriticalSection = nullptr; + TheDmaCriticalSection = nullptr; + TheMemoryPoolCriticalSection = nullptr; return exitcode; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h index e7741c4016c..45356e4ee16 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h @@ -95,7 +95,7 @@ class GUIEditDisplay : public Display // These are stub functions to allow compilation: /// Create a video buffer that can be used for this display - virtual VideoBuffer* createVideoBuffer( void ) { return NULL; } + virtual VideoBuffer* createVideoBuffer( void ) { return nullptr; } /// draw a video buffer fit within the screen coordinates virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) { } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h index 98e6f0f310e..bb140e534ca 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h @@ -55,7 +55,7 @@ class GUIEditWindowManager : public W3DGameWindowManager virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, Int x, Int y, Int width, Int height, GameWinSystemFunc system, - WinInstanceData *instData = NULL ); + WinInstanceData *instData = nullptr ); // ************************************************************************** // GUIEdit specific methods ************************************************* @@ -90,7 +90,7 @@ class GUIEditWindowManager : public W3DGameWindowManager also in the select list */ void removeSupervisedChildSelections( void ); /** selected windows that are children will cut loose their parents - and become adults (their parent will be NULL, otherwise the screen) */ + and become adults (their parent will be null, otherwise the screen) */ // void orphanSelectedChildren( void ); /// dupe a window and its children diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp index 7a1ef8e37ac..f4c2f73eb2f 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp @@ -64,7 +64,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static const char *noNameWindowString = "Un-named Window"; -static GameWindow *currentWindow = NULL; ///< current window we're editing +static GameWindow *currentWindow = nullptr; ///< current window we're editing // PUBLIC DATA //////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ void SaveCallbacks( GameWindow *window, HWND dialog ) { // sanity - if( window == NULL || dialog == NULL ) + if( window == nullptr || dialog == nullptr ) return; // get edit data for window @@ -122,7 +122,7 @@ void SaveCallbacks( GameWindow *window, HWND dialog ) //============================================================================= static void setCurrentWindow( GameWindow *window, HWND dialog ) { - GameWindowEditData *editData = NULL; + GameWindowEditData *editData = nullptr; // get edit data from window if present if( window ) @@ -132,7 +132,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) currentWindow = window; // sanity - if( dialog == NULL ) + if( dialog == nullptr ) return; // enable the callback combo boxes @@ -156,7 +156,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // input - name = NULL; + name = nullptr; if( editData ) name = editData->inputCallbackString; if( name.isEmpty() ) @@ -165,7 +165,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // tooltip - name = NULL; + name = nullptr; if( editData ) name = editData->tooltipCallbackString; if( name.isEmpty() ) @@ -174,7 +174,7 @@ static void setCurrentWindow( GameWindow *window, HWND dialog ) CB_SELECTSTRING, -1, (LPARAM)name.str() ); // draw - name = NULL; + name = nullptr; if( editData ) name = editData->drawCallbackString; if( name.isEmpty() ) @@ -209,7 +209,7 @@ static void loadUserWindows( HWND listbox, GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // is this a candidate @@ -286,7 +286,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, { // load the combos with the callbacks - InitCallbackCombos( hWndDialog, NULL ); + InitCallbackCombos( hWndDialog, nullptr ); // select the none string at the top index in each combo SendDlgItemMessage( hWndDialog, COMBO_SYSTEM, CB_SETCURSEL, 0, 0 ); @@ -299,7 +299,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, TheWindowManager->winGetWindowList() ); // no current window - setCurrentWindow( NULL, hWndDialog ); + setCurrentWindow( nullptr, hWndDialog ); return TRUE; @@ -337,7 +337,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, // sanity - DEBUG_ASSERTCRASH( win, ("NULL window set in listbox item data") ); + DEBUG_ASSERTCRASH( win, ("null window set in listbox item data") ); // save the callbacks for the curent window selected SaveCallbacks( currentWindow, hWndDialog ); @@ -361,7 +361,7 @@ BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message, // save callbacks, set current window to empty and end dialog SaveCallbacks( currentWindow, hWndDialog ); - setCurrentWindow( NULL, hWndDialog ); + setCurrentWindow( nullptr, hWndDialog ); // save the layout callbacks saveLayoutCallbacks( hWndDialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp index d1751313cb6..767796931b2 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CheckBoxProperties.cpp @@ -215,8 +215,8 @@ HWND InitCheckBoxPropertiesDialog( GameWindow *window ) (LPCTSTR)CHECK_BOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)checkBoxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp index c60c72551df..57a0b8e0bf1 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ColorDialog.cpp @@ -257,7 +257,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWnd, UINT uMsg, * * Returns: * Pointer to selected color - * NULL for canceled request + * nullptr for canceled request */ // ============================================================================ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, @@ -276,7 +276,7 @@ RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha, TheEditor->getWindowHandle(), SelectColorDlgProc ) ) return &selectedColor; else - return NULL; + return nullptr; } @@ -406,19 +406,19 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (mode == MODE_RGB) { rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); // convert to ranges 0 - 1 for RGB conversion hsvColor.saturation /= 100.0f; hsvColor.value /= 100.0f; @@ -444,7 +444,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, DeleteObject (hBrushNew); // validate this new area - ValidateRect (hWndControl, NULL); + ValidateRect (hWndControl, nullptr); break; @@ -531,7 +531,7 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // original pen if (mode == MODE_HSV) { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = 1.0f / 100.0f; hsvColor.value = 1; rgbColor = hsvToRGB (hsvColor); @@ -593,9 +593,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // original pen if (mode == MODE_HSV) { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = - (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE) / 100.0f; + (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE) / 100.0f; hsvColor.value = 1.0f / 100.0f; rgbColor = hsvToRGB (hsvColor); rgbColor.red *= 255.0f; @@ -722,24 +722,24 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, if (mode == MODE_RGB) { rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, - NULL, FALSE ); + nullptr, FALSE ); } else { hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, - NULL, FALSE); + nullptr, FALSE); hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, - NULL, FALSE); + nullptr, FALSE); hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, - NULL, FALSE); + nullptr, FALSE); hsvColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA, - NULL, FALSE ); + nullptr, FALSE ); // convert to ranges 0 - 1 for RGB conversion hsvColor.saturation /= 100.0f; @@ -759,13 +759,13 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, // force update of preview box // invalidate the preview box to force an update of its color - InvalidateRect( hWndPreview, NULL, FALSE); + InvalidateRect( hWndPreview, nullptr, FALSE); UpdateWindow (hWndPreview); // force updates of the colorbars - InvalidateRect (hWndColorBar1, NULL, FALSE); - InvalidateRect (hWndColorBar2, NULL, FALSE); - InvalidateRect (hWndColorBar3, NULL, FALSE); + InvalidateRect (hWndColorBar1, nullptr, FALSE); + InvalidateRect (hWndColorBar2, nullptr, FALSE); + InvalidateRect (hWndColorBar3, nullptr, FALSE); UpdateWindow (hWndColorBar1); UpdateWindow (hWndColorBar2); UpdateWindow (hWndColorBar3); @@ -811,9 +811,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, HSVColorReal hsvColor; if (mode == MODE_RGB) { // switch to HSV - rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); - rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); - rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); + rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); // convert rgb to range 0 - 1 rgbColor.red /= 255.0f; @@ -849,9 +849,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, } else { // switch to RGB - hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE); - hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE); - hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE); + hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, nullptr, FALSE); + hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, nullptr, FALSE); + hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, nullptr, FALSE); // convert saturation and value to range 0 - 1 hsvColor.saturation /= 100.0f; @@ -888,9 +888,9 @@ BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg, } // invalidate all the vertical color bars so they are redrawn - InvalidateRect (hWndColorBar1, NULL, TRUE); - InvalidateRect (hWndColorBar2, NULL, TRUE); - InvalidateRect (hWndColorBar3, NULL, TRUE); + InvalidateRect (hWndColorBar1, nullptr, TRUE); + InvalidateRect (hWndColorBar2, nullptr, TRUE); + InvalidateRect (hWndColorBar3, nullptr, TRUE); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp index e15c2950e2a..cb323c6d559 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ComboBoxProperties.cpp @@ -542,11 +542,11 @@ static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog, GadgetComboBoxSetLettersAndNumbersOnly(window, IsDlgButtonChecked( hWndDialog, CHECK_LETTERS_AND_NUMBERS )); // change in the size of the comboBox - Int newMaxChars = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, FALSE ); + Int newMaxChars = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, nullptr, FALSE ); if( newMaxChars != comboData->maxChars) GadgetComboBoxSetMaxChars( window, newMaxChars ); - Int newMaxDisplay = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS_DISPLAYED, NULL, FALSE ); + Int newMaxDisplay = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS_DISPLAYED, nullptr, FALSE ); if( newMaxDisplay != comboData->maxDisplay ) GadgetComboBoxSetMaxDisplay( window, newMaxDisplay ); @@ -607,8 +607,8 @@ HWND InitComboBoxPropertiesDialog( GameWindow *window ) (LPCTSTR)COMBO_BOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)comboBoxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp index fbd5fef5455..67de9b50bdc 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GenericProperties.cpp @@ -130,7 +130,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -179,7 +179,7 @@ static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog, newColor->blue, newColor->alpha ); SetControlColor( controlID, newGameColor ); - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } @@ -285,7 +285,7 @@ void InitCallbackCombos( HWND dialog, GameWindow *window ) { HWND combo; FunctionLexicon::TableEntry *entry; - GameWindowEditData *editData = NULL; + GameWindowEditData *editData = nullptr; AsciiString name; // get edit data from window @@ -434,8 +434,8 @@ HWND InitUserWinPropertiesDialog( GameWindow *window ) (LPCTSTR)GENERIC_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)genericPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp index e6bb26af6ce..fa10b0990d9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/GridSettings.cpp @@ -153,7 +153,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it return TRUE; @@ -194,7 +194,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, { gridColor = *newColor; - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } @@ -210,7 +210,7 @@ BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message, Int value; // get the pixels between marks - value = GetDlgItemInt( hWndDialog, EDIT_RESOLUTION, NULL, FALSE ); + value = GetDlgItemInt( hWndDialog, EDIT_RESOLUTION, nullptr, FALSE ); TheEditor->setGridResolution( value ); // get grid on/off flag diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 569de7ba74d..30fa3395608 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -46,6 +46,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////// + #include "GUIEdit.h" #include "Properties.h" #include "LayoutScheme.h" @@ -224,15 +225,15 @@ static void removeScrollbar( GameWindow *listbox ) // delete the up button TheWindowManager->winDestroy( listData->upButton ); - listData->upButton = NULL; + listData->upButton = nullptr; // delete down button TheWindowManager->winDestroy( listData->downButton ); - listData->downButton = NULL; + listData->downButton = nullptr; // delete the slider TheWindowManager->winDestroy( listData->slider ); - listData->slider = NULL; + listData->slider = nullptr; // remove the scrollbar flag from the listbox data listData->scrollBar = FALSE; @@ -577,7 +578,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, removeScrollbar( window ); // change in the size of the listbox - Int newMaxItems = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS, NULL, FALSE ); + Int newMaxItems = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS, nullptr, FALSE ); if( newMaxItems != listData->listLength ) GadgetListBoxSetListLength( window, newMaxItems ); @@ -596,7 +597,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, window->winSetStatus( bit ); // Multi-column - Int newColumns = GetDlgItemInt( hWndDialog, EDIT_NUM_COLUMNS,NULL,FALSE); + Int newColumns = GetDlgItemInt( hWndDialog, EDIT_NUM_COLUMNS,nullptr,FALSE); if(newColumns > 1) { @@ -604,7 +605,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, GetDlgItemText(hWndDialog,EDIT_COLUMN_PERCENT,percentages,sizeof(percentages)); if(strlen(percentages) == 0) { - MessageBox(NULL,"You have specified a column amount greater then 1, please enter the same about of percentages","whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr,"You have specified a column amount greater then 1, please enter the same about of percentages","whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); break; } @@ -612,17 +613,17 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, Int i = 0; Int total = 0; Char *token = strtok( percentages, "," ); - while( token != NULL ) + while( token != nullptr ) { newPercentages[i] = atoi(token); total += newPercentages[i]; - token = strtok( NULL, "," ); + token = strtok( nullptr, "," ); i++; if(i > newColumns && token) { Char whoopsMsg[250]; sprintf(whoopsMsg,"You have Specified %d columns but I have read in more then that for the percentages, please double check your data", newColumns); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -630,7 +631,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, { Char whoopsMsg[250]; sprintf(whoopsMsg,"You have Specified %d columns but I have read in only %d for the percentages, please double check your data", newColumns, i ); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -638,7 +639,7 @@ static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog, { Char whoopsMsg[250]; sprintf(whoopsMsg,"Please Double check to make sure your percentages add up to 100."); - MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); + MessageBox(nullptr, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL); delete[] newPercentages; return 0; } @@ -703,8 +704,8 @@ HWND InitListboxPropertiesDialog( GameWindow *window ) (LPCTSTR)LISTBOX_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)listboxPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp index 32c8ae17323..0adc7fef900 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ProgressBarProperties.cpp @@ -237,8 +237,8 @@ HWND InitProgressBarPropertiesDialog( GameWindow *window ) (LPCTSTR)PROGRESS_BAR_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)progressBarPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp index 065b7822544..9c28c846f46 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/PushButtonProperties.cpp @@ -206,8 +206,8 @@ HWND InitPushButtonPropertiesDialog( GameWindow *window ) (LPCTSTR)PUSH_BUTTON_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)pushButtonPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp index 524f483be84..e9a3a12fce3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/RadioButtonProperties.cpp @@ -175,9 +175,9 @@ static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog, GadgetRadioSetHiliteCheckedBoxColor( window, info->color ); GadgetRadioSetHiliteCheckedBoxBorderColor( window, info->borderColor ); - // save group - Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, NULL, FALSE ); - Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); + // save group + Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, nullptr, FALSE ); + Int screen = TheNameKeyGenerator->nameToKey( TheEditor->getSaveFilename() ); GadgetRadioSetGroup( window, group, screen ); } @@ -231,11 +231,11 @@ static void loadExistingGroupsCombo( HWND combo, GameWindow *window ) { // sanity - if( combo == NULL ) + if( combo == nullptr ) return; // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // if this is a radio button get the group @@ -275,8 +275,8 @@ HWND InitRadioButtonPropertiesDialog( GameWindow *window ) (LPCTSTR)RADIO_BUTTON_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)radioButtonPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index 23ec57af6e8..2456ebdd648 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -285,8 +285,8 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, // slider data SliderData *sliderData = (SliderData *)window->winGetUserData(); - sliderData->minVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MIN, NULL, FALSE ); - sliderData->maxVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MAX, NULL, FALSE ); + sliderData->minVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MIN, nullptr, FALSE ); + sliderData->maxVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MAX, nullptr, FALSE ); // sanity if( sliderData->minVal > sliderData->maxVal ) @@ -295,7 +295,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, sliderData->minVal = sliderData->maxVal; sliderData->maxVal = temp; - MessageBox( NULL, "Slider min greated than max, the values were swapped", + MessageBox( nullptr, "Slider min greated than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); } @@ -356,8 +356,8 @@ HWND InitSliderPropertiesDialog( GameWindow *window ) (LPCTSTR)SLIDER_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)sliderPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp index 2cf73abfe8e..9feabb143aa 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/StaticTextProperties.cpp @@ -207,8 +207,8 @@ HWND InitStaticTextPropertiesDialog( GameWindow *window ) (LPCTSTR)STATIC_TEXT_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)staticTextPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp index d11224b79a9..97fe8fd9887 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TabControlProperties.cpp @@ -278,11 +278,11 @@ static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog, TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - tabData->tabWidth = GetDlgItemInt( hWndDialog, TAB_WIDTH, NULL, FALSE ); - tabData->tabHeight = GetDlgItemInt(hWndDialog, TAB_HEIGHT, NULL, FALSE ); - tabData->tabCount = GetDlgItemInt(hWndDialog, TAB_COUNT, NULL, FALSE ); - tabData->paneBorder = GetDlgItemInt(hWndDialog, BORDER_WIDTH, NULL, FALSE ); - tabData->activeTab = GetDlgItemInt(hWndDialog, ACTIVE_TAB, NULL, FALSE ); + tabData->tabWidth = GetDlgItemInt( hWndDialog, TAB_WIDTH, nullptr, FALSE ); + tabData->tabHeight = GetDlgItemInt(hWndDialog, TAB_HEIGHT, nullptr, FALSE ); + tabData->tabCount = GetDlgItemInt(hWndDialog, TAB_COUNT, nullptr, FALSE ); + tabData->paneBorder = GetDlgItemInt(hWndDialog, BORDER_WIDTH, nullptr, FALSE ); + tabData->activeTab = GetDlgItemInt(hWndDialog, ACTIVE_TAB, nullptr, FALSE ); if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_0 ) ) tabData->subPaneDisabled[0] = TRUE; @@ -398,8 +398,8 @@ HWND InitTabControlPropertiesDialog( GameWindow *tabControl ) (LPCTSTR)TAB_CONTROL_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)tabControlPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( tabControl, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp index 3d9ef8bd4dd..f8cfd235f14 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/TextEntryProperties.cpp @@ -151,7 +151,7 @@ static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog, // text entry props EntryData *entryData = (EntryData *)window->winGetUserData(); - entryData->maxTextLen = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, TRUE ); + entryData->maxTextLen = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, nullptr, TRUE ); entryData->secretText = IsDlgButtonChecked( hWndDialog, CHECK_SECRET_TEXT ); entryData->aSCIIOnly = IsDlgButtonChecked( hWndDialog, CHECK_ASCII_TEXT ); if( IsDlgButtonChecked( hWndDialog, RADIO_LETTERS_AND_NUMBERS ) ) @@ -232,8 +232,8 @@ HWND InitTextEntryPropertiesDialog( GameWindow *window ) (LPCTSTR)TEXT_ENTRY_PROPERTIES_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)textEntryPropertiesCallback ); - if( dialog == NULL ) - return NULL; + if( dialog == nullptr ) + return nullptr; // do the common initialization CommonDialogInitialize( window, dialog ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index d541e5d0006..27d1404f3b5 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -74,7 +74,7 @@ const char *EditWindow::m_className = "EditWindowClass"; ///< edit window class /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -EditWindow *TheEditWindow = NULL; ///< edit window singleton +EditWindow *TheEditWindow = nullptr; ///< edit window singleton /////////////////////////////////////////////////////////////////////////////// // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -324,9 +324,9 @@ void EditWindow::registerEditWindowClass( void ) wcex.cbWndExtra = 0; wcex.hInstance = hInst; wcex.hIcon = LoadIcon( hInst, (LPCTSTR)IDI_GUIEDIT ); - wcex.hCursor = NULL; //LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = nullptr; //LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); - wcex.lpszMenuName = NULL; + wcex.lpszMenuName = nullptr; wcex.lpszClassName = m_className; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); @@ -352,15 +352,15 @@ EditWindow::EditWindow( void ) m_size.x = 0; m_size.y = 0; m_bitDepth = 32; - m_editWindowHWnd = NULL; - m_assetManager = NULL; - m_2DRender = NULL; + m_editWindowHWnd = nullptr; + m_assetManager = nullptr; + m_2DRender = nullptr; m_w3dInitialized = FALSE; m_popupMenuClickPos.x = 0; m_popupMenuClickPos.y = 0; - m_pickedWindow = NULL; + m_pickedWindow = nullptr; m_dragMoveOrigin.x = 0; m_dragMoveOrigin.y = 0; @@ -374,7 +374,7 @@ EditWindow::EditWindow( void ) m_selectRegion.hi.y = 0; m_resizingWindow = FALSE; - m_windowToResize = NULL; + m_windowToResize = nullptr; m_resizeOrigin.x = 0; m_resizeOrigin.y = 0; m_resizeDest.x = 0; @@ -447,9 +447,9 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) clientRect.right - clientRect.left, // width clientRect.bottom - clientRect.top, // height, TheEditor->getWindowHandle(), // parent - NULL, // menu + nullptr, // menu TheEditor->getInstance(), // instance - NULL ); // creation parameters + nullptr ); // creation parameters // display the window ShowWindow( m_editWindowHWnd, SW_SHOW ); @@ -483,7 +483,7 @@ void EditWindow::init( UnsignedInt clientWidth, UnsignedInt clientHeight ) m_w3dInitialized = TRUE; // set a timer for updating visual pulse drawing - SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, NULL ); + SetTimer( m_editWindowHWnd, TIMER_EDIT_WINDOW_PULSE, 5, nullptr ); } @@ -495,12 +495,12 @@ void EditWindow::shutdown( void ) // delete 2d renderer delete m_2DRender; - m_2DRender = NULL; + m_2DRender = nullptr; // delete asset manager m_assetManager->Free_Assets(); delete m_assetManager; - m_assetManager = NULL; + m_assetManager = nullptr; // shutdown WW3D WW3D::Shutdown(); @@ -508,12 +508,12 @@ void EditWindow::shutdown( void ) // delete the w3d file system delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; // destroy the edit window if( m_editWindowHWnd ) DestroyWindow( m_editWindowHWnd ); - m_editWindowHWnd = NULL; + m_editWindowHWnd = nullptr; // unregister our edit window class UnregisterClass( m_className, TheEditor->getInstance() ); @@ -625,9 +625,9 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // the edit window just make sure all our drag and drop stuff is // clear in the hierarchy // - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); if( TheEditor->getMode() == MODE_DRAG_MOVE ) { @@ -678,7 +678,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, // if( TheEditor->getMode() == MODE_DRAG_MOVE && TheEditor->selectionCount() == 1 && - TheHierarchyView->getPopupTarget() != NULL ) + TheHierarchyView->getPopupTarget() != nullptr ) break; // @@ -791,7 +791,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, TheEditor->dragMoveSelectedWindows( &m_dragMoveOrigin, &m_dragMoveDest ); } // release capture - SetCapture( NULL ); + SetCapture( nullptr ); // go back to normal mode TheEditor->setMode( MODE_EDIT ); @@ -932,7 +932,7 @@ Bool EditWindow::inCornerTolerance( ICoord2D *dest, ICoord2D *source, IRegion2D region; // sanity - if( dest == NULL || source == NULL ) + if( dest == nullptr || source == nullptr ) return FALSE; /// @todo we should write PointInRegion() stuff again like it was in Nox @@ -965,7 +965,7 @@ Bool EditWindow::inLineTolerance( ICoord2D *dest, IRegion2D region; // sanity - if( dest == NULL || lineStart == NULL || lineEnd == NULL ) + if( dest == nullptr || lineStart == nullptr || lineEnd == nullptr ) return FALSE; // setup region @@ -1118,7 +1118,7 @@ void EditWindow::drawSeeThruOutlines( GameWindow *windowList, Color c ) { // end recursion - if( windowList == NULL ) + if( windowList == nullptr ) return; // draw outline for this window @@ -1154,7 +1154,7 @@ void EditWindow::drawHiddenOutlines( GameWindow *windowList, Color c ) { // end recursion - if( windowList == NULL ) + if( windowList == nullptr ) return; // @@ -1429,7 +1429,7 @@ void EditWindow::drawGrid( void ) { TheDisplay->drawLine( 0, y, m_size.x, y, 1, color ); -// MoveToEx( hdc, 0, y, NULL ); +// MoveToEx( hdc, 0, y, nullptr ); // LineTo( hdc, m_size.x, y ); } @@ -1438,7 +1438,7 @@ void EditWindow::drawGrid( void ) { TheDisplay->drawLine( x, 0, x, m_size.y, 1, color ); -// MoveToEx( hdc, x, 0, NULL ); +// MoveToEx( hdc, x, 0, nullptr ); // LineTo( hdc, x, m_size.y ); } @@ -1450,7 +1450,7 @@ void EditWindow::drawGrid( void ) for( x = 0; x < m_size.x; x += res ) { - MoveToEx( hdc, x, y, NULL ); + MoveToEx( hdc, x, y, nullptr ); LineTo( hdc, x + 1, y + 1 ); // TheDisplay->drawLine( x, y, x + 1, y + 1, 1, 0xFFFFFFFF ); @@ -1559,7 +1559,7 @@ void EditWindow::openPopupMenu( Int x, Int y ) screen.x = x; screen.y = y; ClientToScreen( m_editWindowHWnd, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, m_editWindowHWnd, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, m_editWindowHWnd, nullptr ); // save the location click for the creation of the popup menu m_popupMenuClickPos.x = x; @@ -1633,7 +1633,7 @@ void EditWindow::drawImage( const Image *image, { // sanity - if( image == NULL ) + if( image == nullptr ) return; const Region2D *uv = image->getUV(); @@ -1752,7 +1752,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // check to see if the resizing window was deleted @@ -1760,7 +1760,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) { // get back to normal mode and clean up - m_windowToResize = NULL; + m_windowToResize = nullptr; m_resizingWindow = FALSE; TheEditor->setMode( MODE_EDIT ); @@ -1768,7 +1768,7 @@ void EditWindow::notifyWindowDeleted( GameWindow *window ) // null out picked window if needed if( m_pickedWindow == window ) - m_pickedWindow = NULL; + m_pickedWindow = nullptr; // // go back to edit mode, this keeps us from staying in a resize mode diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 301dc0c86e1..a682cf827ce 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -105,7 +105,7 @@ // PRIVATE DATA /////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// -GUIEdit *TheEditor = NULL; +GUIEdit *TheEditor = nullptr; // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -127,31 +127,31 @@ char *GUIEdit::saveAsDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = m_appHWnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "wnd"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetSaveFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -169,31 +169,31 @@ char *GUIEdit::openDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = m_appHWnd; - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "wnd"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetOpenFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -297,8 +297,8 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) - return NULL; + if( window == nullptr ) + return nullptr; // search the list entry = m_selectList; @@ -313,7 +313,7 @@ WindowSelectionEntry *GUIEdit::findSelectionEntry( GameWindow *window ) } - return NULL; // not found + return nullptr; // not found } @@ -365,7 +365,7 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) ICoord2D origin, size; // sanity - if( region == NULL ) + if( region == nullptr ) return; // unselect everything selected @@ -412,18 +412,18 @@ void GUIEdit::selectWindowsInRegion( IRegion2D *region ) GUIEdit::GUIEdit( void ) { - m_appInst = 0; - m_appHWnd = NULL; - m_statusBarHWnd = NULL; - m_toolbarHWnd = NULL; + m_appInst = nullptr; + m_appHWnd = nullptr; + m_statusBarHWnd = nullptr; + m_toolbarHWnd = nullptr; m_unsaved = FALSE; m_mode = MODE_UNDEFINED; strcpy( m_savePathAndFilename, "" ); strcpy( m_saveFilename, "" ); - m_selectList = NULL; - m_propertyTarget = NULL; + m_selectList = nullptr; + m_propertyTarget = nullptr; m_gridVisible = TRUE; m_snapToGrid = TRUE; @@ -446,14 +446,14 @@ GUIEdit::GUIEdit( void ) GUIEdit::~GUIEdit( void ) { delete TheHeaderTemplateManager; - TheHeaderTemplateManager = NULL; + TheHeaderTemplateManager = nullptr; delete TheGameText; - TheGameText = NULL; + TheGameText = nullptr; // delete the IME Manager // delete TheIMEManager; -// TheIMEManager = NULL; +// TheIMEManager = nullptr; // all the shutdown routine shutdown(); @@ -629,80 +629,80 @@ void GUIEdit::shutdown( void ) // delete the display delete TheDisplay; - TheDisplay = NULL; + TheDisplay = nullptr; // delete all windows properly in the editor deleteAllWindows(); // delete the mouse delete TheMouse; - TheMouse = NULL; - TheWin32Mouse = NULL; + TheMouse = nullptr; + TheWin32Mouse = nullptr; delete ThePlayerList; - ThePlayerList = NULL; + ThePlayerList = nullptr; delete TheRankInfoStore; - TheRankInfoStore = NULL; + TheRankInfoStore = nullptr; // delete the window manager delete TheWindowManager; - TheWindowManager = NULL; - TheGUIEditWindowManager = NULL; + TheWindowManager = nullptr; + TheGUIEditWindowManager = nullptr; // delete display string manager delete TheDisplayStringManager; - TheDisplayStringManager = NULL; + TheDisplayStringManager = nullptr; // delete image collection delete TheMappedImageCollection; - TheMappedImageCollection = NULL; + TheMappedImageCollection = nullptr; // delete the font library delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; delete TheCommandList; - TheCommandList = NULL; + TheCommandList = nullptr; delete TheMessageStream; - TheMessageStream = NULL; + TheMessageStream = nullptr; // delete the function lexicon delete TheFunctionLexicon; - TheFunctionLexicon = NULL; + TheFunctionLexicon = nullptr; // delete name key generator delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; delete TheGlobalLanguageData; - TheGlobalLanguageData = NULL; + TheGlobalLanguageData = nullptr; // delete file system delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheLocalFileSystem; - TheLocalFileSystem = NULL; + TheLocalFileSystem = nullptr; delete TheArchiveFileSystem; - TheArchiveFileSystem = NULL; + TheArchiveFileSystem = nullptr; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // delete the hierarchy view delete TheHierarchyView; - TheHierarchyView = NULL; + TheHierarchyView = nullptr; // destroy the edit window delete TheEditWindow; - TheEditWindow = NULL; + TheEditWindow = nullptr; delete TheKeyboard; - TheKeyboard = NULL; + TheKeyboard = nullptr; } @@ -744,7 +744,7 @@ Bool GUIEdit::writeConfigFile( const char *filename ) // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_LOG(( "writeConfigFile: Unable to open file '%s'", filename )); @@ -799,7 +799,7 @@ Bool GUIEdit::readConfigFile( const char *filename ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return TRUE; // version @@ -863,12 +863,12 @@ void GUIEdit::readFontFile( const char *filename ) FILE *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return; // read how many entries follow @@ -905,7 +905,7 @@ void GUIEdit::readFontFile( const char *filename ) // set the font GameFont *font = TheFontLibrary->getFont( AsciiString(fontBuffer), size, bold ); - if( font == NULL ) + if( font == nullptr ) { char buffer[ 1024 ]; @@ -931,12 +931,12 @@ void GUIEdit::writeFontFile( const char *filename ) FILE *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) return; // dont bother making an error, it's likely to be read only a lot // available fonts @@ -1116,7 +1116,7 @@ void GUIEdit::setCursor( CursorType type ) } // set the new cursor - SetCursor( LoadCursor( NULL, identifier ) ); + SetCursor( LoadCursor( nullptr, identifier ) ); } @@ -1212,7 +1212,7 @@ static GameWindow *pointInAnyChild( Int x, Int y, Bool ignoreHidden, GameWindow GameWindow *GUIEdit::getWindowAtPos( Int x, Int y ) { GameWindow *window; - GameWindow *pick = NULL; + GameWindow *pick = nullptr; IRegion2D region; for( window = TheWindowManager->winGetWindowList(); @@ -1314,9 +1314,9 @@ void GUIEdit::clipCreationParamsToParent( GameWindow *parent, newWidth, newHeight; // sanity - if( parent == NULL || - x == NULL || y == NULL || - width == NULL || height == NULL ) + if( parent == nullptr || + x == nullptr || y == nullptr || + width == nullptr || height == nullptr ) return; // get parent screen region and size @@ -1388,7 +1388,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) { // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // @@ -1402,7 +1402,7 @@ void GUIEdit::removeWindowCleanup( GameWindow *window ) // take this out of the property target if present if( m_propertyTarget == window ) - m_propertyTarget = NULL; + m_propertyTarget = nullptr; // notify the edit window this is going away TheEditWindow->notifyWindowDeleted( window ); @@ -1443,7 +1443,7 @@ GameWindow *GUIEdit::newWindow( UnsignedInt windowStyle, Int x, Int y, Int width, Int height ) { - GameWindow *window = NULL; + GameWindow *window = nullptr; // create the appropriate window based on style bit passed in switch( windowStyle ) @@ -1532,7 +1532,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // // if there is a parent present we need to translate the screen x and y @@ -1545,7 +1545,7 @@ GameWindow *GUIEdit::newUserWindow( GameWindow *parent, Int x, Int y, window = TheWindowManager->winCreate( parent, status, x, y, width, height, - NULL, NULL ); + nullptr, nullptr ); // a window created in the editor here is a user window WinInstanceData *instData = window->winGetInstanceData(); @@ -1591,7 +1591,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep the button inside a parent if present if( parent ) @@ -1606,7 +1606,7 @@ GameWindow *GUIEdit::newPushButton( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); @@ -1683,7 +1683,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1700,7 +1700,7 @@ GameWindow *GUIEdit::newCheckBox( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -1789,7 +1789,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1808,7 +1808,7 @@ GameWindow *GUIEdit::newRadioButton( GameWindow *parent, width, height, &instData, &radioData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -1897,7 +1897,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -1922,7 +1922,7 @@ GameWindow *GUIEdit::newTabControl( GameWindow *parent, width, height, &instData, &tabControlData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2095,7 +2095,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2120,7 +2120,7 @@ GameWindow *GUIEdit::newHorizontalSlider( GameWindow *parent, width, height, &instData, &sliderData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2216,7 +2216,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2241,7 +2241,7 @@ GameWindow *GUIEdit::newVerticalSlider( GameWindow *parent, width, height, &instData, &sliderData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2337,7 +2337,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2353,7 +2353,7 @@ GameWindow *GUIEdit::newProgressBar( GameWindow *parent, x, y, width, height, &instData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2472,7 +2472,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2518,8 +2518,8 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, comboData->listboxData->multiSelect = 0; comboData->listboxData->forceSelect = 1; comboData->listboxData->columns = 1; - comboData->listboxData->columnWidth = NULL; - comboData->listboxData->columnWidthPercentage = NULL; + comboData->listboxData->columnWidth = nullptr; + comboData->listboxData->columnWidthPercentage = nullptr; //create the control window = TheWindowManager->gogoGadgetComboBox( parent, @@ -2528,7 +2528,7 @@ GameWindow *GUIEdit::newComboBox( GameWindow *parent, width, height, &instData, comboData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -2887,7 +2887,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -2908,8 +2908,8 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, listData.multiSelect = 0; listData.forceSelect = 0; listData.columns = 1; - listData.columnWidth = NULL; - listData.columnWidthPercentage = NULL; + listData.columnWidth = nullptr; + listData.columnWidthPercentage = nullptr; // make control window = TheWindowManager->gogoGadgetListBox( parent, @@ -2918,7 +2918,7 @@ GameWindow *GUIEdit::newListbox( GameWindow *parent, width, height, &instData, &listData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3150,7 +3150,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -3173,7 +3173,7 @@ GameWindow *GUIEdit::newTextEntry( GameWindow *parent, width, height, &instData, &entryData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3256,7 +3256,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, // validate the parent to disallow illegal relationships if( validateParentForCreate( parent ) == FALSE ) - return NULL; + return nullptr; // keep inside a parent if present if( parent ) @@ -3279,7 +3279,7 @@ GameWindow *GUIEdit::newStaticText( GameWindow *parent, width, height, &instData, &textData, - NULL, + nullptr, TRUE ); // set default colors based on the default scheme @@ -3531,7 +3531,7 @@ void GUIEdit::stripNameDecorations( GameWindow *root ) { // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // strip off this name if present @@ -3574,7 +3574,7 @@ void GUIEdit::revertDefaultCallbacks( GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // if this is a user window, set the default callbacks @@ -3645,7 +3645,7 @@ Bool GUIEdit::menuOpen( void ) filePath = openDialog(); // if no filename came back they cancelled this operation - if( filePath == NULL ) + if( filePath == nullptr ) return FALSE; // file not opened // @@ -3739,7 +3739,7 @@ Bool GUIEdit::menuSaveAs( void ) filePath = saveAsDialog(); // if no filename came back they cancelled this operation - if( filePath == NULL ) + if( filePath == nullptr ) return FALSE; // save not done // OK, save the filename we're going to use @@ -3774,7 +3774,7 @@ Bool GUIEdit::menuCopy( void ) // trivial case, nothing selected select = getSelectList(); - if( select == NULL ) + if( select == nullptr ) { MessageBox( m_appHWnd, "You must have windows selected before you can copy them.", @@ -3813,7 +3813,7 @@ Bool GUIEdit::menuCut( void ) // trivial case, nothing selected select = getSelectList(); - if( select == NULL ) + if( select == nullptr ) { MessageBox( m_appHWnd, "You must have windows selected before you can cut.", @@ -3844,7 +3844,7 @@ Bool GUIEdit::isWindowSelected( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return FALSE; // find entry @@ -3864,7 +3864,7 @@ void GUIEdit::selectWindow( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return; // do not add to list if already on it @@ -3873,7 +3873,7 @@ void GUIEdit::selectWindow( GameWindow *window ) // allocate new entry and add to list entry = new WindowSelectionEntry; - if( entry == NULL ) + if( entry == nullptr ) { DEBUG_LOG(( "Unable to allocate selection entry for window" )); @@ -3884,7 +3884,7 @@ void GUIEdit::selectWindow( GameWindow *window ) // fill out information and tie to head of list entry->window = window; - entry->prev = NULL; + entry->prev = nullptr; entry->next = m_selectList; if( m_selectList ) m_selectList->prev = entry; @@ -3904,7 +3904,7 @@ void GUIEdit::unSelectWindow( GameWindow *window ) WindowSelectionEntry *entry; // sanity - if( window == NULL ) + if( window == nullptr ) return; // find entry @@ -3968,7 +3968,7 @@ void GUIEdit::notifyNewWindow( GameWindow *window ) { // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // @@ -4012,7 +4012,7 @@ void GUIEdit::deleteSelected( void ) // of the select list and delete those // deleteList = new GameWindow *[ count ]; - if( deleteList == NULL ) + if( deleteList == nullptr ) { DEBUG_LOG(( "Cannot allocate delete list!" )); @@ -4055,7 +4055,7 @@ void GUIEdit::bringSelectedToTop( void ) // GameWindow **snapshot; snapshot = new GameWindow *[ count ]; - if( snapshot == NULL ) + if( snapshot == nullptr ) { DEBUG_LOG(( "bringSelectedToTop: Unabled to allocate selectList" )); @@ -4101,7 +4101,7 @@ void GUIEdit::dragMoveSelectedWindows( ICoord2D *dragOrigin, ICoord2D origin; // sanity - if( dragOrigin == NULL || dragDest == NULL ) + if( dragOrigin == nullptr || dragDest == nullptr ) return; // traverse selection list @@ -4154,7 +4154,7 @@ GameWindow *GUIEdit::getFirstSelected( void ) if( m_selectList ) return m_selectList->window; - return NULL; + return nullptr; } @@ -4333,8 +4333,8 @@ void GUIEdit::computeResizeLocation( EditMode resizeMode, Int sizeLimit = 5; // sanity - if( window == NULL || resizeOrigin == NULL || resizeDest == NULL || - resultLoc == NULL || resultSize == NULL ) + if( window == nullptr || resizeOrigin == nullptr || resizeDest == nullptr || + resultLoc == nullptr || resultSize == nullptr ) return; // get the current position and size of the window @@ -4534,7 +4534,7 @@ Bool GUIEdit::windowIsGadget( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return FALSE; return BitIsSet( window->winGetStyle(), GWS_GADGET_WINDOW ); @@ -4549,7 +4549,7 @@ void GUIEdit::gridSnapLocation( ICoord2D *source, ICoord2D *snapped ) { // sanity - if( source == NULL || snapped == NULL ) + if( source == nullptr || snapped == nullptr ) return; snapped->x = (source->x / m_gridResolution) * m_gridResolution; @@ -4565,7 +4565,7 @@ void GUIEdit::checkMenuItem( Int item ) HMENU menu = GetMenu( m_appHWnd ); // sanity - if( menu == NULL ) + if( menu == nullptr ) return; // check it @@ -4581,7 +4581,7 @@ void GUIEdit::unCheckMenuItem( Int item ) HMENU menu = GetMenu( m_appHWnd ); // sanity - if( menu == NULL ) + if( menu == nullptr ) return; // check it @@ -4599,7 +4599,7 @@ Bool GUIEdit::isNameDuplicate( GameWindow *root, GameWindow *ignore, AsciiString WinInstanceData *instData; // end of recursion, sanity for name, and empty name ("") is always OK - if( root == NULL || name.isEmpty() ) + if( root == nullptr || name.isEmpty() ) return FALSE; // name is a-ok! :) // get instance data @@ -4628,7 +4628,7 @@ void GUIEdit::loadGUIEditFontLibrary( FontLibrary *library ) { // sanity - if( library == NULL ) + if( library == nullptr ) return; AsciiString fixedSys("FixedSys"); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index efc03f66915..dfd16627093 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -43,7 +43,7 @@ #include "HierarchyView.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GUIEditWindowManager *TheGUIEditWindowManager = NULL; ///< editor use only +GUIEditWindowManager *TheGUIEditWindowManager = nullptr; ///< editor use only /////////////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// @@ -59,7 +59,7 @@ Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, GameWindow *other; // sanity - if( list == NULL || window == NULL ) + if( list == nullptr || window == nullptr ) return FALSE; // just run through the window list in the clipboard to check @@ -83,14 +83,14 @@ void GUIEditWindowManager::linkToClipboard( GameWindow *window, { // sanity - if( window == NULL || list == NULL ) + if( window == nullptr || list == nullptr ) return; // debug sanity checking, can't add if already in it if( isWindowInClipboard( window, list ) ) return; - window->winSetPrev( NULL ); + window->winSetPrev( nullptr ); window->winSetNext( *list ); if( *list ) (*list)->winSetPrev( window ); @@ -107,7 +107,7 @@ void GUIEditWindowManager::unlinkFromClipboard( GameWindow *window, GameWindow *next, *prev; // sanity - if( window == NULL || list == NULL ) + if( window == nullptr || list == nullptr ) return; // debug sanity checking, can't remove if not in @@ -197,7 +197,7 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) window->winGetScreenPosition( &pos.x, &pos.y ); // remove the child from the parent and add to top level of window system - window->winSetParent( NULL ); + window->winSetParent( nullptr ); // // adjust the position, which previously was relative to the parent @@ -221,8 +221,8 @@ void GUIEditWindowManager::orphanSelectedChildren( void ) GUIEditWindowManager::GUIEditWindowManager( void ) { - m_clipboard = NULL; - m_clipboardDup = NULL; + m_clipboard = nullptr; + m_clipboardDup = nullptr; m_copySpacing = 8; m_numCopiesPasted = 0; @@ -235,7 +235,7 @@ GUIEditWindowManager::~GUIEditWindowManager( void ) { // the duplicate list is only used in the actual act of pasting - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); // free all data on the clipboard resetClipboard(); @@ -271,8 +271,8 @@ Int GUIEditWindowManager::winDestroy( GameWindow *window ) // delete it delete editData; - // set the edit data to NULL in the window - window->winSetEditData( NULL ); + // set the edit data to null in the window + window->winSetEditData( nullptr ); } @@ -351,7 +351,7 @@ void GUIEditWindowManager::resetClipboard( void ) processDestroyList(); // nothing in the buffer now - m_clipboard = NULL; + m_clipboard = nullptr; m_numCopiesPasted = 0; } @@ -407,7 +407,7 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) { // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // if widow is selected duplicate and continue on @@ -416,7 +416,7 @@ void GUIEditWindowManager::duplicateSelected( GameWindow *root ) GameWindow *duplicate; // perform the duplication of window and all children - duplicate = duplicateWindow( root, NULL ); + duplicate = duplicateWindow( root, nullptr ); if( duplicate ) { @@ -608,7 +608,7 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) Int sanityLoop = 0; // end of recursion - if( root == NULL ) + if( root == nullptr ) return; // get our inst data @@ -663,10 +663,10 @@ void GUIEditWindowManager::validateClipboardNames( GameWindow *root ) void GUIEditWindowManager::pasteClipboard( void ) { GameWindow *window, *next; - GameWindow *firstWindow = NULL; + GameWindow *firstWindow = nullptr; // check for empty clipboard - if( m_clipboard == NULL ) + if( m_clipboard == nullptr ) { MessageBox( TheEditor->getWindowHandle(), @@ -678,7 +678,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } // create a duplicate of everything in the clipboard - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); createClipboardDuplicate(); // @@ -729,7 +729,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } // the clipboard duplicate list is only for the act of pasting - assert( m_clipboardDup == NULL ); + assert( m_clipboardDup == nullptr ); // we've now completed another successful copy pasted in m_numCopiesPasted++; @@ -784,15 +784,15 @@ void InstDrawCopy ( WinInstanceData *instData, WinInstanceData *sourceInstData) GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, GameWindow *parent ) { - GameWindow *duplicate = NULL; + GameWindow *duplicate = nullptr; UnsignedInt style, status; WinInstanceData *instData; WinInstanceData instDataCopy; ICoord2D pos, size; // sanity - if( source == NULL ) - return NULL; + if( source == nullptr ) + return nullptr; // get the window instance data and make a copy of it for creating new stuff instData = source->winGetInstanceData(); @@ -803,8 +803,8 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // do NOT copy the display string instances, these MUST be allocated when // needed in real windows // - instDataCopy.m_text = NULL; - instDataCopy.m_tooltip = NULL; + instDataCopy.m_text = nullptr; + instDataCopy.m_tooltip = nullptr; // get a few properties we're going to need style = source->winGetStyle(); @@ -1128,7 +1128,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, } } else - listDataCopy.columnWidth = NULL; + listDataCopy.columnWidth = nullptr; if(listData->columnWidthPercentage) { @@ -1139,7 +1139,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, } } else - listDataCopy.columnWidthPercentage = NULL; + listDataCopy.columnWidthPercentage = nullptr; duplicate = TheWindowManager->gogoGadgetListBox( parent, @@ -1325,7 +1325,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, pos.y, size.x, size.y, - NULL, + nullptr, &instDataCopy ); } @@ -1337,19 +1337,19 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, "Internal Error", MB_OK ); assert( 0 ); memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below - return NULL; + return nullptr; } // sanity - if( duplicate == NULL ) + if( duplicate == nullptr ) { MessageBox( TheEditor->getWindowHandle(), "Unable to duplicate window", "Internal Error", MB_OK ); assert( 0 ); memset( &instDataCopy, 0, sizeof( instDataCopy ) ); // see comment below - return NULL; + return nullptr; } @@ -1361,7 +1361,7 @@ GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, // but that is totally isolated in the parent so that's OK and // necessary. // - if( parent == NULL ) + if( parent == nullptr ) unlinkWindow( duplicate ); // copy edit data, only for the editor @@ -1416,7 +1416,7 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) // find last window in clipboard lastWindow = m_clipboard; - while( lastWindow && lastWindow->winGetNext() != NULL ) + while( lastWindow && lastWindow->winGetNext() != nullptr ) lastWindow = lastWindow->winGetNext(); // @@ -1428,7 +1428,7 @@ void GUIEditWindowManager::createClipboardDuplicate( void ) { // duplicate the window and all its children - duplicate = duplicateWindow( window, NULL ); + duplicate = duplicateWindow( window, nullptr ); // add duplicate to list if( duplicate ) @@ -1446,18 +1446,18 @@ void GUIEditWindowManager::makeChildOf( GameWindow *target, { // sanity - if( target == NULL ) + if( target == nullptr ) return; // get target parent GameWindow *prevParent = target->winGetParent(); // check for no parent - if( parent == NULL ) + if( parent == nullptr ) { // if target already has no parent nothing to do - if( prevParent == NULL ) + if( prevParent == nullptr ) return; // @@ -1538,7 +1538,7 @@ void GUIEditWindowManager::moveAheadOf( GameWindow *windowToMove, { // sanity - if( windowToMove == NULL || aheadOf == NULL || windowToMove == aheadOf ) + if( windowToMove == nullptr || aheadOf == nullptr || windowToMove == aheadOf ) return; // diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 98648b24f23..f7e6a7980d8 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -70,7 +70,7 @@ static ICoord2D dialogSize; // PUBLIC DATA //////////////////////////////////////////////////////////////// -HierarchyView *TheHierarchyView = NULL; ///< the view singleton +HierarchyView *TheHierarchyView = nullptr; ///< the view singleton // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -186,9 +186,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // use the "no" cursor // if( TheHierarchyView->validateDragDropOperation( dragWindow, target ) ) - SetCursor( LoadCursor( NULL, IDC_CROSS ) ); + SetCursor( LoadCursor( nullptr, IDC_CROSS ) ); else - SetCursor( LoadCursor( NULL, IDC_NO ) ); + SetCursor( LoadCursor( nullptr, IDC_NO ) ); } @@ -225,7 +225,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // get the node info from the tree item we're over overItemInfo.hItem = overItem; - overItemInfo.lParam = NULL; + overItemInfo.lParam = 0; overItemInfo.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( TheHierarchyView->getTreeHandle(), &overItemInfo ); overWindow = (GameWindow *)overItemInfo.lParam; @@ -259,7 +259,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, screen.x = x; screen.y = y; ClientToScreen( hWndDialog, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); // // do not reset the drag window, and set the target window as @@ -289,8 +289,8 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, if( clearDragWindow ) { - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); } @@ -298,7 +298,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, ReleaseCapture(); // set the cursor back to normal - SetCursor( LoadCursor( NULL, IDC_ARROW ) ); + SetCursor( LoadCursor( nullptr, IDC_ARROW ) ); } @@ -349,7 +349,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, screen.x = x; screen.y = y; ClientToScreen( hWndDialog, &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); } @@ -433,7 +433,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, menu = LoadMenu( TheEditor->getInstance(), (LPCTSTR)HIERARCHY_POPUP_MENU ); subMenu = GetSubMenu( menu, 0 ); GetCursorPos( &screen ); - TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, NULL ); + TrackPopupMenuEx( subMenu, 0, screen.x, screen.y, hWndDialog, nullptr ); } @@ -452,7 +452,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // save the window being dragged TheHierarchyView->setDragWindow( (GameWindow *)newItem.lParam ); - TheHierarchyView->setDragTarget( NULL ); + TheHierarchyView->setDragTarget( nullptr ); // capture the mouse SetCapture( TheHierarchyView->getHierarchyHandle() ); @@ -492,9 +492,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheGUIEditWindowManager->moveAheadOf( drag, target ); // we're done with the drag and popup ops now - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); break; @@ -511,9 +511,9 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheGUIEditWindowManager->makeChildOf( drag, target ); // we're done with the drag and popup ops now - TheHierarchyView->setDragWindow( NULL ); - TheHierarchyView->setDragTarget( NULL ); - TheHierarchyView->setPopupTarget( NULL ); + TheHierarchyView->setDragWindow( nullptr ); + TheHierarchyView->setDragTarget( nullptr ); + TheHierarchyView->setPopupTarget( nullptr ); break; @@ -525,7 +525,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, GameWindow *target = TheHierarchyView->getPopupTarget(); // sanity - if( target == NULL ) + if( target == nullptr ) break; // @@ -607,8 +607,8 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) { // end of recursion - if( node == NULL || window == NULL ) - return NULL; + if( node == nullptr || window == nullptr ) + return nullptr; #if USE_FAST_FIND_ITEM @@ -618,7 +618,7 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) // is it in this node TVITEM item; item.hItem = node; - item.lParam = NULL; + item.lParam = nullptr; item.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( m_tree, &item ); if( (GameWindow *)item.lParam == window ) @@ -626,7 +626,7 @@ HTREEITEM HierarchyView::findItemEntry( HTREEITEM node, GameWindow *window ) // not there, check our children HTREEITEM child; - HTREEITEM found = NULL; + HTREEITEM found = nullptr; for( child = TreeView_GetNextItem( m_tree, node, TVGN_CHILD ); child; child = TreeView_GetNextItem( m_tree, child, TVGN_NEXT ) ) @@ -653,8 +653,8 @@ HTREEITEM HierarchyView::findTreeEntry( GameWindow *window ) { // no-op - if( window == NULL ) - return NULL; + if( window == nullptr ) + return nullptr; // get root and search from there return findItemEntry( TreeView_GetRoot( m_tree ), window ); @@ -670,15 +670,15 @@ void HierarchyView::addWindowToTree( GameWindow *window, Bool addChildren, Bool addSiblings ) { - HTREEITEM newItem = NULL; + HTREEITEM newItem = nullptr; // end of recursion - if( window == NULL ) + if( window == nullptr ) return; // add only if not in tree already newItem = findTreeEntry( window ); - if( newItem == NULL ) + if( newItem == nullptr ) { // setup insert struct @@ -701,7 +701,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, newItem = TreeView_InsertItem( m_tree, &insert ); // sanity - if( newItem == NULL ) + if( newItem == nullptr ) { DEBUG_LOG(( "Error adding window to tree" )); @@ -746,13 +746,13 @@ void HierarchyView::addWindowToTree( GameWindow *window, HierarchyView::HierarchyView( void ) { - m_dialog = NULL; - m_tree = NULL; + m_dialog = nullptr; + m_tree = nullptr; dialogPos.x = dialogPos.y = 0; dialogSize.x = dialogSize.y = 0; - m_dragWindow = NULL; - m_dragTarget = NULL; - m_popupTarget = NULL; + m_dragWindow = nullptr; + m_dragTarget = nullptr; + m_popupTarget = nullptr; } @@ -834,8 +834,8 @@ void HierarchyView::shutdown( void ) // destroy the control palette window DestroyWindow( m_dialog ); - m_dialog = NULL; - m_tree = NULL; + m_dialog = nullptr; + m_tree = nullptr; } @@ -851,7 +851,7 @@ char *HierarchyView::getWindowTreeName( GameWindow *window ) strcpy( buffer, "" ); // sanity - if( window == NULL ) + if( window == nullptr ) return buffer; // no name available, construct one based on type @@ -906,14 +906,14 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) { // sanity - if( window == NULL || m_dialog == NULL ) + if( window == nullptr || m_dialog == nullptr ) return; // do not add again if already in the tree - if( findTreeEntry( window ) != NULL ) + if( findTreeEntry( window ) != nullptr ) return; - // get the parent tree entry to this window, NULL if no parent + // get the parent tree entry to this window, nullptr if no parent GameWindow *parent = window->winGetParent(); HTREEITEM parentItem = findTreeEntry( parent ); @@ -924,7 +924,7 @@ void HierarchyView::addWindow( GameWindow *window, HierarchyOption option ) // force the tree control to redraw, it seems to have problems updating // the plus signs, lame ass Microsoft // - InvalidateRect( m_tree, NULL, TRUE ); + InvalidateRect( m_tree, nullptr, TRUE ); } @@ -936,26 +936,26 @@ void HierarchyView::removeWindow( GameWindow *window ) HTREEITEM item; // sanity - if( window == NULL ) + if( window == nullptr ) return; // if this window is the drag window clean that mode up if( window == m_dragWindow ) - m_dragWindow = NULL; + m_dragWindow = nullptr; // clean up drag target if( window == m_dragTarget ) - m_dragTarget = NULL; + m_dragTarget = nullptr; // if this window is the popup target remove it if( window == m_popupTarget ) - m_popupTarget = NULL; + m_popupTarget = nullptr; // find this entry in the tree item = findTreeEntry( window ); // if not in tree nothing to do - if( item == NULL ) + if( item == nullptr ) return; // remove it from the tree @@ -977,12 +977,12 @@ void HierarchyView::bringWindowToTop( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // find this window entry HTREEITEM item = findTreeEntry( window ); - if( item == NULL ) + if( item == nullptr ) { DEBUG_LOG(( "Cannot bring window to top, no entry in tree!" )); @@ -1010,12 +1010,12 @@ void HierarchyView::updateWindowName( GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get the tree entry HTREEITEM item = findTreeEntry( window ); - if( item == NULL ) + if( item == nullptr ) { DEBUG_LOG(( "updateWindowName: No hierarchy entry for window!" )); @@ -1042,7 +1042,7 @@ void HierarchyView::getDialogPos( ICoord2D *pos ) { // sanity - if( pos == NULL ) + if( pos == nullptr ) return; *pos = dialogPos; @@ -1056,7 +1056,7 @@ void HierarchyView::getDialogSize( ICoord2D *size ) { // sanity - if( size == NULL ) + if( size == nullptr ) return; *size = dialogSize; @@ -1102,14 +1102,14 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get the window hierarchy entry removeWindow( window ); - // we'll say and aheadOf of NULL means put at the top - if( aheadOf == NULL ) + // we'll say and aheadOf of null means put at the top + if( aheadOf == nullptr ) { addWindow( window, HIERARCHY_ADD_AT_TOP ); @@ -1119,7 +1119,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, // get the hierarchy item of the aheadOf window HTREEITEM aheadOfItem = findTreeEntry( aheadOf ); - if( aheadOfItem == NULL ) + if( aheadOfItem == nullptr ) { DEBUG_LOG(( "moveWindowAheadOf: aheadOf has no hierarchy entry!" )); @@ -1130,13 +1130,13 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, // // get the parent item we will be inserting the new entry at, a parent - // of NULL is OK and will put it at the root of the tree + // of nullptr is OK and will put it at the root of the tree // HTREEITEM parentItem = TreeView_GetNextItem( m_tree, aheadOfItem, TVGN_PARENT ); // // get the item that we will be inserting after (just previous to - // 'aheadOfItem' ... this can also be NULL for putting at the head + // 'aheadOfItem' ... this can also be null for putting at the head // HTREEITEM prevItem = TreeView_GetNextItem( m_tree, aheadOfItem, TVGN_PREVIOUS ); @@ -1144,7 +1144,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, TVINSERTSTRUCT insert; insert.itemex.mask = TVIF_TEXT | TVIF_PARAM; insert.hParent = parentItem; - if( prevItem == NULL ) + if( prevItem == nullptr ) insert.hInsertAfter = TVI_FIRST; else insert.hInsertAfter = prevItem; @@ -1155,7 +1155,7 @@ void HierarchyView::moveWindowAheadOf( GameWindow *window, HTREEITEM newItem = TreeView_InsertItem( m_tree, &insert ); // sanity - if( newItem == NULL ) + if( newItem == nullptr ) { DEBUG_LOG(( "moveWindowAheadOf: Error adding window to tree" )); @@ -1186,14 +1186,14 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // remvoe the window from the hierarchy removeWindow( window ); - // if parent is NULL we'll put at top of list - if( parent == NULL ) + // if parent is nullptr we'll put at top of list + if( parent == nullptr ) { addWindow( window, HIERARCHY_ADD_AT_TOP ); @@ -1203,7 +1203,7 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) // find the entry of the parent HTREEITEM parentItem = findTreeEntry( parent ); - if( parentItem == NULL ) + if( parentItem == nullptr ) { DEBUG_LOG(( "moveWindowChildOf: No parent entry" )); @@ -1229,7 +1229,7 @@ HTREEITEM HierarchyView::treePointToItem( Int x, Int y ) TVHITTESTINFO hitTest; hitTest.pt.x = x; hitTest.pt.y = y; - hitTest.hItem = NULL; + hitTest.hItem = nullptr; hitTest.flags = TVHT_ONITEM; return TreeView_HitTest( getTreeHandle(), &hitTest ); @@ -1243,15 +1243,15 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) { // sanity - if( treeItem == NULL ) - return NULL; + if( treeItem == nullptr ) + return nullptr; // get the node info from the tree item we're over TVITEM itemInfo; GameWindow *window; itemInfo.hItem = treeItem; - itemInfo.lParam = NULL; + itemInfo.lParam = 0; itemInfo.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem( m_tree, &itemInfo ); window = (GameWindow *)itemInfo.lParam; @@ -1266,13 +1266,13 @@ GameWindow *HierarchyView::getWindowFromItem( HTREEITEM treeItem ) //============================================================================= void HierarchyView::selectWindow( GameWindow *window ) { - HTREEITEM item = NULL; + HTREEITEM item = nullptr; // get the item associated with the window if( window ) item = findTreeEntry( window ); - // select the item, or no item NULL will select nothing + // select the item, or no item nullptr will select nothing TreeView_SelectItem( m_tree, item ); TreeView_Expand( m_tree, item, 0 ); @@ -1288,7 +1288,7 @@ Bool HierarchyView::validateDragDropOperation( GameWindow *source, { // sanity - if( source == NULL || target == NULL ) + if( source == nullptr || target == nullptr ) return FALSE; // if target is the source or is a child of source in any way this is illegal diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index bb83dbe0d30..754074ea2a1 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -78,12 +78,12 @@ /////////////////////////////////////////////////////////////////////////////// // PRIVATE DATA /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -static LayoutScheme *theScheme = NULL; +static LayoutScheme *theScheme = nullptr; /////////////////////////////////////////////////////////////////////////////// // PUBLIC DATA //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -LayoutScheme *TheDefaultScheme = NULL; +LayoutScheme *TheDefaultScheme = nullptr; // PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// @@ -207,31 +207,31 @@ char *saveAsDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "ls"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetSaveFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -249,31 +249,31 @@ char *openDialog( void ) ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = TheEditor->getWindowHandle(); - ofn.hInstance = NULL; + ofn.hInstance = nullptr; ofn.lpstrFilter = filter; - ofn.lpstrCustomFilter = NULL; + ofn.lpstrCustomFilter = nullptr; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 0; ofn.lpstrFile = filename; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; + ofn.lpstrFileTitle = nullptr; ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; + ofn.lpstrInitialDir = nullptr; + ofn.lpstrTitle = nullptr; ofn.Flags = OFN_NOREADONLYRETURN | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = "ls"; ofn.lCustData = 0L ; - ofn.lpfnHook = NULL ; - ofn.lpTemplateName = NULL ; + ofn.lpfnHook = nullptr ; + ofn.lpTemplateName = nullptr ; returnCode = GetOpenFileName( &ofn ); if( returnCode ) return filename; else - return NULL; + return nullptr; } @@ -329,7 +329,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, // layout, because this is such a large sweeping change we will // ask them if they are sure // - result = MessageBox( NULL, "This will apply these scheme color and image settings to ALL windows and gadgets currently loaded in the edit window. Are you sure you want to proceed?", + result = MessageBox( nullptr, "This will apply these scheme color and image settings to ALL windows and gadgets currently loaded in the edit window. Are you sure you want to proceed?", "Are You Sure?", MB_YESNO | MB_ICONWARNING ); if( result == IDNO ) break; @@ -441,7 +441,7 @@ void LayoutScheme::applyPropertyTablesToWindow( GameWindow *root ) { // end recursion - if( root == NULL ) + if( root == nullptr ) return; // apply changes to this window @@ -1488,7 +1488,7 @@ LayoutScheme::LayoutScheme( void ) m_disabledText.borderColor = GAME_COLOR_UNDEFINED; m_hiliteText.color = GAME_COLOR_UNDEFINED; m_hiliteText.borderColor = GAME_COLOR_UNDEFINED; - m_font = NULL; + m_font = nullptr; } @@ -1507,8 +1507,8 @@ LayoutScheme::~LayoutScheme( void ) { delete [] m_imageAndColorTable[ i ].stateNameBuffer; - m_imageAndColorTable[ i ].stateNameBuffer = NULL; - m_imageAndColorTable[ i ].stateName = NULL; + m_imageAndColorTable[ i ].stateNameBuffer = nullptr; + m_imageAndColorTable[ i ].stateName = nullptr; } @@ -2129,14 +2129,14 @@ void LayoutScheme::init( void ) image = TheMappedImageCollection->findImageByName( "TabControlSevenHilite" ); storeImageAndColor( TC_TAB_7_HILITE, image, green, darkGreen ); - storeImageAndColor( TAB_CONTROL_ENABLED, NULL, black, white ); - storeImageAndColor( TAB_CONTROL_DISABLED, NULL, darkGray, white ); - storeImageAndColor( TAB_CONTROL_HILITE, NULL, black, white ); + storeImageAndColor( TAB_CONTROL_ENABLED, nullptr, black, white ); + storeImageAndColor( TAB_CONTROL_DISABLED, nullptr, darkGray, white ); + storeImageAndColor( TAB_CONTROL_HILITE, nullptr, black, white ); // generic - storeImageAndColor( GENERIC_ENABLED, NULL, darkBlue, white ); - storeImageAndColor( GENERIC_DISABLED, NULL, darkGray, white ); - storeImageAndColor( GENERIC_HILITE, NULL, lightBlue, white ); + storeImageAndColor( GENERIC_ENABLED, nullptr, darkBlue, white ); + storeImageAndColor( GENERIC_DISABLED, nullptr, darkGray, white ); + storeImageAndColor( GENERIC_HILITE, nullptr, lightBlue, white ); // default text colors m_enabledText.color = white; @@ -2163,7 +2163,7 @@ void LayoutScheme::openDialog( void ) DialogBox( TheEditor->getInstance(), (LPCTSTR)LAYOUT_SCHEME_DIALOG, TheEditor->getWindowHandle(), (DLGPROC)layoutSchemeCallback ); - theScheme = NULL; + theScheme = nullptr; } @@ -2179,7 +2179,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) DEBUG_LOG(( "Illegal state to to layout 'findEntry' '%d'", id )); assert( 0 ); - return NULL; + return nullptr; } @@ -2192,7 +2192,7 @@ ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) } - return NULL; // not found + return nullptr; // not found } @@ -2208,7 +2208,7 @@ ImageAndColorInfo *LayoutScheme::getImageAndColor( StateIdentifier id ) DEBUG_LOG(( "getImageAndColor: Illegal state '%d'", id )); assert( 0 ); - return NULL; + return nullptr; } @@ -2258,7 +2258,7 @@ Bool LayoutScheme::saveScheme( char *filename ) // open the file fp = fopen( filename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) { DEBUG_LOG(( "saveScheme: Unable to open file '%s'", filename )); @@ -2340,7 +2340,7 @@ Bool LayoutScheme::loadScheme( char *filename ) // open the file fp = fopen( filename, "r" ); - if( fp == NULL ) + if( fp == nullptr ) return FALSE; // save the filename we're using now diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index 1b6c26daf0a..53823215495 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -99,280 +99,280 @@ ColorControl colorControlTable[] = ImageAndColorInfo imageAndColorTable[] = { - { GWS_PUSH_BUTTON, BUTTON_ENABLED, "[Button] Enabled (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_ENABLED_PUSHED, "[Button] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_DISABLED, "[Button] Disabled (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_DISABLED_PUSHED, "[Button] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_HILITE, "[Button] Hilite (Normal)", NULL, 0, 0 }, - { GWS_PUSH_BUTTON, BUTTON_HILITE_PUSHED, "[Button] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_RADIO_BUTTON, RADIO_ENABLED, "[Radio] Enabled Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_ENABLED_UNCHECKED_BOX, "[Radio] Enabled Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_ENABLED_CHECKED_BOX, "[Radio] Enabled Nubbin (Checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED, "[Radio] Disabled Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED_UNCHECKED_BOX, "[Radio] Disabled Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_DISABLED_CHECKED_BOX, "[Radio] Disabled Nubbin (Checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE, "[Radio] Hilite Surface", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE_UNCHECKED_BOX, "[Radio] Hilite Nubbin (Un-checked)", NULL, 0, 0 }, - { GWS_RADIO_BUTTON, RADIO_HILITE_CHECKED_BOX, "[Radio] Hilite Nubbin (Checked)", NULL, 0, 0 }, - - { GWS_CHECK_BOX, CHECK_BOX_ENABLED, "[Check Box] Enabled Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_ENABLED_UNCHECKED_BOX, "[Check Box] Enabled Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_ENABLED_CHECKED_BOX, "[Check Box] Enabled Box (Checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED, "[Check Box] Disabled Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED_UNCHECKED_BOX, "[Check Box] Disabled Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_DISABLED_CHECKED_BOX, "[Check Box] Disabled Box (Checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE, "[Check Box] Hilite Surface", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE_UNCHECKED_BOX, "[Check Box] Hilite Box (Un-checked)", NULL, 0, 0 }, - { GWS_CHECK_BOX, CHECK_BOX_HILITE_CHECKED_BOX, "[Check Box] Hilite Box (Checked)", NULL, 0, 0 }, - - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_LEFT, "[HSlider] Enabled Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_RIGHT, "[HSlider] Enabled Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_CENTER, "[HSlider] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_ENABLED_SMALL_CENTER, "[HSlider] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_LEFT, "[HSlider] Disabled Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_RIGHT, "[HSlider] Disabled Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_CENTER, "[HSlider] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_DISABLED_SMALL_CENTER, "[HSlider] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_LEFT, "[HSlider] Hilite Left End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_RIGHT, "[HSlider] Hilite Right End", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_CENTER, "[HSlider] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_HILITE_SMALL_CENTER, "[HSlider] Hilite Repeating Small Cener", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED, "[Thumb [HSlider]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [HSlider]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED, "[Thumb [HSlider]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [HSlider]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE, "[Thumb [HSlider]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE_PUSHED, "[Thumb [HSlider]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_VERT_SLIDER, VSLIDER_ENABLED_TOP, "[VSlider] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_BOTTOM, "[VSlider] Enabled Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_CENTER, "[VSlider] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_ENABLED_SMALL_CENTER, "[VSlider] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_TOP, "[VSlider] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_BOTTOM, "[VSlider] Disabled Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_CENTER, "[VSlider] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_DISABLED_SMALL_CENTER, "[VSlider] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_TOP, "[VSlider] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_BOTTOM, "[VSlider] Hilite Bottom End", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_CENTER, "[VSlider] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_HILITE_SMALL_CENTER, "[VSlider] Hilite Repeating Small Cener", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED, "[Thumb [VSlider]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [VSlider]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED, "[Thumb [VSlider]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [VSlider]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE, "[Thumb [VSlider]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE_PUSHED, "[Thumb [VSlider]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED, "[Listbox] Enabled Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED, "[Listbox] Disabled Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE, "[Listbox] Hilite Surface", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox]] Enabled Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox]] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox]] Disabled Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox]] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox]] Hilite Bottom End", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox]] Hilite Repeating Small Cener", NULL, 0, 0 }, - - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_ENABLED, "[ComboBox] Enabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, "[ComboBox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, "[ComboBox] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED, "[ComboBox] Disabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, "[ComboBox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, "[ComboBox] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE, "[ComboBox] Hilite Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_LEFT, "[ComboBox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, "[ComboBox] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_CENTER, "[ComboBox] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED, "[Button [ComboBox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, "[Button [ComboBox]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED, "[Button [ComboBox]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, "[Button [ComboBox]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE, "[Button [ComboBox]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, "[Button [ComboBox]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_LEFT, "[Text Entry [ComboBox]] Enabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_RIGHT, "[Text Entry [ComboBox]] Enabled Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_CENTER, "[Text Entry [ComboBox]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_LEFT, "[Text Entry [ComboBox]] Disabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_RIGHT, "[Text Entry [ComboBox]] Disabled Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_CENTER, "[Text Entry [ComboBox]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_LEFT, "[Text Entry [ComboBox]] Hilite Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_RIGHT, "[Text Entry [ComboBox]] Hilite Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_CENTER, "[Text Entry [ComboBox]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, "[Text Entry [ComboBox]] Hilite Small Repeating Center", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED, "[Listbox [ComboBox]] Enabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Enabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Enabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED, "[Listbox [ComboBox]] Disabled Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Disabled Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Disabled Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE, "[Listbox [ComboBox]] Hilite Surface", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Hilite Selected Item Left End (or colors)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Hilite Selected Item Right End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Small Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox [ComboBox]]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Enabled Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox [ComboBox]]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Disabled Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Small Cener", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox [ComboBox]]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox [ComboBox]]] Hilite Bottom End", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Small Cener", NULL, 0, 0 }, - - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 }, - { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 }, - - - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_LEFT, "[Bar] Enabled Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_RIGHT, "[Bar] Enabled Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_CENTER, "[Bar] Enabled Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_SMALL_CENTER, "[Bar] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_LEFT, "[Bar] Enabled Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_RIGHT, "[Bar] Enabled Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_CENTER, "[Bar] Enabled Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, "[Bar] Enabled Fill Bar Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_LEFT, "[Bar] Disabled Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_RIGHT, "[Bar] Disabled Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_CENTER, "[Bar] Disabled Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_SMALL_CENTER, "[Bar] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_LEFT, "[Bar] Disabled Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_RIGHT, "[Bar] Disabled Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_CENTER, "[Bar] Disabled Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, "[Bar] Disabled Fill Bar Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_LEFT, "[Bar] Hilite Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_RIGHT, "[Bar] Hilite Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_CENTER, "[Bar] Hilite Repeating Center End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_SMALL_CENTER, "[Bar] Hilite Small Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_LEFT, "[Bar] Hilite Fill Bar Left End (or color for no images)", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_RIGHT, "[Bar] Hilite Fill Bar Right End", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_CENTER, "[Bar] Hilite Fill Bar Repeating Center", NULL, 0, 0 }, - { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, "[Bar] Hilite Fill Bar Small Repeating Center", NULL, 0, 0 }, - - - { GWS_STATIC_TEXT, STATIC_TEXT_ENABLED, "[Static Text] Enabled", NULL, 0, 0 }, - { GWS_STATIC_TEXT, STATIC_TEXT_DISABLED, "[Static Text] Disabled", NULL, 0, 0 }, - { GWS_STATIC_TEXT, STATIC_TEXT_HILITE, "[Static Text] Hilite", NULL, 0, 0 }, - - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_LEFT, "[Text Entry] Enabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_RIGHT, "[Text Entry] Enabled Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_CENTER, "[Text Entry] Enabled Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_SMALL_CENTER, "[Text Entry] Enabled Small Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_LEFT, "[Text Entry] Disabled Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_RIGHT, "[Text Entry] Disabled Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_CENTER, "[Text Entry] Disabled Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_SMALL_CENTER, "[Text Entry] Disabled Small Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_LEFT, "[Text Entry] Hilite Left End (Or colors for no image)", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_RIGHT, "[Text Entry] Hilite Right End", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_CENTER, "[Text Entry] Hilite Repeating Center", NULL, 0, 0 }, - { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_SMALL_CENTER, "[Text Entry] Hilite Small Repeating Center", NULL, 0, 0 }, - - { GWS_TAB_CONTROL, TC_TAB_0_ENABLED, "[Tab Control] Tab 0 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_0_DISABLED, "[Tab Control] Tab 0 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_0_HILITE, "[Tab Control] Tab 0 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_ENABLED, "[Tab Control] Tab 1 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_DISABLED, "[Tab Control] Tab 1 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_1_HILITE, "[Tab Control] Tab 1 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_ENABLED, "[Tab Control] Tab 2 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_DISABLED, "[Tab Control] Tab 2 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_2_HILITE, "[Tab Control] Tab 2 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_ENABLED, "[Tab Control] Tab 3 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_DISABLED, "[Tab Control] Tab 3 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_3_HILITE, "[Tab Control] Tab 3 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_ENABLED, "[Tab Control] Tab 4 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_DISABLED, "[Tab Control] Tab 4 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_4_HILITE, "[Tab Control] Tab 4 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_ENABLED, "[Tab Control] Tab 5 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_DISABLED, "[Tab Control] Tab 5 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_5_HILITE, "[Tab Control] Tab 5 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_ENABLED, "[Tab Control] Tab 6 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_DISABLED, "[Tab Control] Tab 6 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_6_HILITE, "[Tab Control] Tab 6 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_ENABLED, "[Tab Control] Tab 7 Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_DISABLED, "[Tab Control] Tab 7 Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TC_TAB_7_HILITE, "[Tab Control] Tab 7 Hilite", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_ENABLED, "[Tab Control] Background Surface Enabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_DISABLED, "[Tab Control] Background Surface Disabled", NULL, 0, 0 }, - { GWS_TAB_CONTROL, TAB_CONTROL_HILITE, "[Tab Control] Background Surface Hilite", NULL, 0, 0 }, - - { GWS_USER_WINDOW, GENERIC_ENABLED, "[User]Enabled Surface", NULL, 0, 0 }, - { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", NULL, 0, 0 }, - { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", NULL, 0, 0 }, - - { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } + { GWS_PUSH_BUTTON, BUTTON_ENABLED, "[Button] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_ENABLED_PUSHED, "[Button] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_DISABLED, "[Button] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_DISABLED_PUSHED, "[Button] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_HILITE, "[Button] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_PUSH_BUTTON, BUTTON_HILITE_PUSHED, "[Button] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_RADIO_BUTTON, RADIO_ENABLED, "[Radio] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_ENABLED_UNCHECKED_BOX, "[Radio] Enabled Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_ENABLED_CHECKED_BOX, "[Radio] Enabled Nubbin (Checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED, "[Radio] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED_UNCHECKED_BOX, "[Radio] Disabled Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_DISABLED_CHECKED_BOX, "[Radio] Disabled Nubbin (Checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE, "[Radio] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE_UNCHECKED_BOX, "[Radio] Hilite Nubbin (Un-checked)", nullptr, nullptr, 0 }, + { GWS_RADIO_BUTTON, RADIO_HILITE_CHECKED_BOX, "[Radio] Hilite Nubbin (Checked)", nullptr, nullptr, 0 }, + + { GWS_CHECK_BOX, CHECK_BOX_ENABLED, "[Check Box] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_ENABLED_UNCHECKED_BOX, "[Check Box] Enabled Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_ENABLED_CHECKED_BOX, "[Check Box] Enabled Box (Checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED, "[Check Box] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED_UNCHECKED_BOX, "[Check Box] Disabled Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_DISABLED_CHECKED_BOX, "[Check Box] Disabled Box (Checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE, "[Check Box] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE_UNCHECKED_BOX, "[Check Box] Hilite Box (Un-checked)", nullptr, nullptr, 0 }, + { GWS_CHECK_BOX, CHECK_BOX_HILITE_CHECKED_BOX, "[Check Box] Hilite Box (Checked)", nullptr, nullptr, 0 }, + + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_LEFT, "[HSlider] Enabled Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_RIGHT, "[HSlider] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_CENTER, "[HSlider] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_ENABLED_SMALL_CENTER, "[HSlider] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_LEFT, "[HSlider] Disabled Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_RIGHT, "[HSlider] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_CENTER, "[HSlider] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_DISABLED_SMALL_CENTER, "[HSlider] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_LEFT, "[HSlider] Hilite Left End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_RIGHT, "[HSlider] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_CENTER, "[HSlider] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_HILITE_SMALL_CENTER, "[HSlider] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED, "[Thumb [HSlider]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [HSlider]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED, "[Thumb [HSlider]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [HSlider]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE, "[Thumb [HSlider]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE_PUSHED, "[Thumb [HSlider]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_VERT_SLIDER, VSLIDER_ENABLED_TOP, "[VSlider] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_BOTTOM, "[VSlider] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_CENTER, "[VSlider] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_ENABLED_SMALL_CENTER, "[VSlider] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_TOP, "[VSlider] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_BOTTOM, "[VSlider] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_CENTER, "[VSlider] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_DISABLED_SMALL_CENTER, "[VSlider] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_TOP, "[VSlider] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_BOTTOM, "[VSlider] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_CENTER, "[VSlider] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_HILITE_SMALL_CENTER, "[VSlider] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED, "[Thumb [VSlider]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [VSlider]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED, "[Thumb [VSlider]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [VSlider]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE, "[Thumb [VSlider]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE_PUSHED, "[Thumb [VSlider]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED, "[Listbox] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED, "[Listbox] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE, "[Listbox] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox]] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox]] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox]] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox]] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox]] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox]] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox]] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox]] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox]] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_ENABLED, "[ComboBox] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, "[ComboBox] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, "[ComboBox] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED, "[ComboBox] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, "[ComboBox] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, "[ComboBox] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE, "[ComboBox] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_LEFT, "[ComboBox] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, "[ComboBox] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_CENTER, "[ComboBox] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED, "[Button [ComboBox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, "[Button [ComboBox]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED, "[Button [ComboBox]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, "[Button [ComboBox]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE, "[Button [ComboBox]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, "[Button [ComboBox]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_LEFT, "[Text Entry [ComboBox]] Enabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_RIGHT, "[Text Entry [ComboBox]] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_CENTER, "[Text Entry [ComboBox]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_LEFT, "[Text Entry [ComboBox]] Disabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_RIGHT, "[Text Entry [ComboBox]] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_CENTER, "[Text Entry [ComboBox]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_LEFT, "[Text Entry [ComboBox]] Hilite Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_RIGHT, "[Text Entry [ComboBox]] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_CENTER, "[Text Entry [ComboBox]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, "[Text Entry [ComboBox]] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED, "[Listbox [ComboBox]] Enabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Enabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Enabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED, "[Listbox [ComboBox]] Disabled Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Disabled Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Disabled Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE, "[Listbox [ComboBox]] Hilite Surface", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Hilite Selected Item Left End (or colors)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Hilite Selected Item Right End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox [ComboBox]]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox [ComboBox]]] Enabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Enabled Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox [ComboBox]]] Disabled Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Disabled Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Small Cener", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox [ComboBox]]] Hilite Top End (or bar colors for no image)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox [ComboBox]]] Hilite Bottom End", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Small Cener", nullptr, nullptr, 0 }, + + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Pushed)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Normal)", nullptr, nullptr, 0 }, + { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Pushed)", nullptr, nullptr, 0 }, + + + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_LEFT, "[Bar] Enabled Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_RIGHT, "[Bar] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_CENTER, "[Bar] Enabled Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_SMALL_CENTER, "[Bar] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_LEFT, "[Bar] Enabled Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_RIGHT, "[Bar] Enabled Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_CENTER, "[Bar] Enabled Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, "[Bar] Enabled Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_LEFT, "[Bar] Disabled Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_RIGHT, "[Bar] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_CENTER, "[Bar] Disabled Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_SMALL_CENTER, "[Bar] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_LEFT, "[Bar] Disabled Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_RIGHT, "[Bar] Disabled Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_CENTER, "[Bar] Disabled Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, "[Bar] Disabled Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_LEFT, "[Bar] Hilite Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_RIGHT, "[Bar] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_CENTER, "[Bar] Hilite Repeating Center End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_SMALL_CENTER, "[Bar] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_LEFT, "[Bar] Hilite Fill Bar Left End (or color for no images)", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_RIGHT, "[Bar] Hilite Fill Bar Right End", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_CENTER, "[Bar] Hilite Fill Bar Repeating Center", nullptr, nullptr, 0 }, + { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, "[Bar] Hilite Fill Bar Small Repeating Center", nullptr, nullptr, 0 }, + + + { GWS_STATIC_TEXT, STATIC_TEXT_ENABLED, "[Static Text] Enabled", nullptr, nullptr, 0 }, + { GWS_STATIC_TEXT, STATIC_TEXT_DISABLED, "[Static Text] Disabled", nullptr, nullptr, 0 }, + { GWS_STATIC_TEXT, STATIC_TEXT_HILITE, "[Static Text] Hilite", nullptr, nullptr, 0 }, + + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_LEFT, "[Text Entry] Enabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_RIGHT, "[Text Entry] Enabled Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_CENTER, "[Text Entry] Enabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_SMALL_CENTER, "[Text Entry] Enabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_LEFT, "[Text Entry] Disabled Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_RIGHT, "[Text Entry] Disabled Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_CENTER, "[Text Entry] Disabled Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_SMALL_CENTER, "[Text Entry] Disabled Small Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_LEFT, "[Text Entry] Hilite Left End (Or colors for no image)", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_RIGHT, "[Text Entry] Hilite Right End", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_CENTER, "[Text Entry] Hilite Repeating Center", nullptr, nullptr, 0 }, + { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_SMALL_CENTER, "[Text Entry] Hilite Small Repeating Center", nullptr, nullptr, 0 }, + + { GWS_TAB_CONTROL, TC_TAB_0_ENABLED, "[Tab Control] Tab 0 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_0_DISABLED, "[Tab Control] Tab 0 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_0_HILITE, "[Tab Control] Tab 0 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_ENABLED, "[Tab Control] Tab 1 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_DISABLED, "[Tab Control] Tab 1 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_1_HILITE, "[Tab Control] Tab 1 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_ENABLED, "[Tab Control] Tab 2 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_DISABLED, "[Tab Control] Tab 2 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_2_HILITE, "[Tab Control] Tab 2 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_ENABLED, "[Tab Control] Tab 3 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_DISABLED, "[Tab Control] Tab 3 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_3_HILITE, "[Tab Control] Tab 3 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_ENABLED, "[Tab Control] Tab 4 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_DISABLED, "[Tab Control] Tab 4 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_4_HILITE, "[Tab Control] Tab 4 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_ENABLED, "[Tab Control] Tab 5 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_DISABLED, "[Tab Control] Tab 5 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_5_HILITE, "[Tab Control] Tab 5 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_ENABLED, "[Tab Control] Tab 6 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_DISABLED, "[Tab Control] Tab 6 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_6_HILITE, "[Tab Control] Tab 6 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_ENABLED, "[Tab Control] Tab 7 Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_DISABLED, "[Tab Control] Tab 7 Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TC_TAB_7_HILITE, "[Tab Control] Tab 7 Hilite", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_ENABLED, "[Tab Control] Background Surface Enabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_DISABLED, "[Tab Control] Background Surface Disabled", nullptr, nullptr, 0 }, + { GWS_TAB_CONTROL, TAB_CONTROL_HILITE, "[Tab Control] Background Surface Hilite", nullptr, nullptr, 0 }, + + { GWS_USER_WINDOW, GENERIC_ENABLED, "[User]Enabled Surface", nullptr, nullptr, 0 }, + { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", nullptr, nullptr, 0 }, + { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", nullptr, nullptr, 0 }, + + { 0, IDENTIFIER_INVALID, nullptr, nullptr, nullptr, 0 } }; @@ -395,7 +395,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) POINT screen; // sanity - if( window == NULL ) + if( window == nullptr ) return; // translate client position to screen coords of menu @@ -428,7 +428,7 @@ void InitPropertiesDialog( GameWindow *window, Int x, Int y ) dialog = InitUserWinPropertiesDialog( window ); // sanity check dialog - if( dialog == NULL ) + if( dialog == nullptr ) { DEBUG_LOG(( "Error creating properties dialog" )); @@ -459,7 +459,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) Int index; // sanity - if( comboBox == NULL || TheFontLibrary == NULL ) + if( comboBox == nullptr || TheFontLibrary == nullptr ) return; // reset the combo box @@ -491,7 +491,7 @@ void LoadFontCombo( HWND comboBox, GameFont *currFont ) SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[None]" ); // if no font select the top index - if( currFont == NULL ) + if( currFont == nullptr ) { SendMessage( comboBox, CB_SETCURSEL, 0, 0 ); @@ -533,8 +533,8 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) { // santiy - if( combo == NULL ) - return NULL; + if( combo == nullptr ) + return nullptr; // get the selected item Int selected; @@ -542,7 +542,7 @@ GameFont *GetSelectedFontFromCombo( HWND combo ) // index 0 is the "none" selector if( selected == 0 ) - return NULL; + return nullptr; // get the font from the selected item return (GameFont *)SendMessage( combo, CB_GETITEMDATA, selected, 0 ); @@ -557,7 +557,7 @@ static void saveFontSelection( HWND combo, GameWindow *window ) GameFont *font; // sanity - if( combo == NULL || window == NULL ) + if( combo == nullptr || window == nullptr ) return; // get the font @@ -575,7 +575,7 @@ static void saveHeaderSelection( HWND comboBox, GameWindow *window ) char buffer[ 512 ]; // santiy - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // get the selected index @@ -600,7 +600,7 @@ static void loadTooltipTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -619,7 +619,7 @@ static void loadTooltipDelayTextLabel( HWND dialog, HWND edit, GameWindow *windo { // sanity - if( dialog == NULL || edit == NULL || window == NULL ) + if( dialog == nullptr || edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -638,7 +638,7 @@ static void saveTooltipTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // get the text from the edit control into the label buffer @@ -657,11 +657,11 @@ static void saveTooltipDelayTextLabel(HWND dialog, HWND edit, GameWindow *window { // sanity - if( dialog == NULL || edit == NULL || window == NULL ) + if( dialog == nullptr || edit == nullptr || window == nullptr ) return; // WinInstanceData *instData = window->winGetInstanceData(); -// instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, NULL, TRUE ); +// instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, nullptr, TRUE ); } @@ -673,7 +673,7 @@ static void loadTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // limit the text entry field in size @@ -691,7 +691,7 @@ static void saveTextLabel( HWND edit, GameWindow *window ) { // sanity - if( edit == NULL || window == NULL ) + if( edit == nullptr || window == nullptr ) return; // get the text from the edit control into the label buffer @@ -733,7 +733,7 @@ void LoadTextStateCombo( HWND comboBox, { // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // @@ -767,7 +767,7 @@ void LoadStateCombo( UnsignedInt style, HWND comboBox ) Int index; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // load the combo box with matching bit fields @@ -799,7 +799,7 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) WinInstanceData *instData; // sanity - if( window == NULL || dialog == NULL ) + if( window == nullptr || dialog == nullptr ) return; // get instance data @@ -894,11 +894,11 @@ static Bool validateName( GameWindow *root, GameWindow *exception, char *name ) { // end recursion, note that "" is always a valid name - if( root == NULL || name == NULL || strlen( name ) == 0 ) + if( root == nullptr || name == nullptr || strlen( name ) == 0 ) return TRUE; // a name cannot have a colon in it cause we use it for decoration - if( strchr( name, ':' ) != NULL ) + if( strchr( name, ':' ) != nullptr ) { char buffer[ 1024 ]; @@ -945,7 +945,7 @@ static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window ) { // sanity - if( window == NULL ) + if( window == nullptr ) return; // get style of window @@ -1047,7 +1047,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) UnsignedInt bit; // sanity - if( dialog == NULL || window == NULL ) + if( dialog == nullptr || window == nullptr ) return FALSE; // get name in the name edit box @@ -1147,7 +1147,7 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) // save delay text label data if present HWND editTooltipDelayText = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY ); if( editTooltipDelayText ) - instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, NULL, TRUE ); + instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, nullptr, TRUE ); HWND headerCombo = GetDlgItem( dialog, COMBO_HEADER ); if( headerCombo ) @@ -1169,14 +1169,14 @@ void LoadImageListComboBox( HWND comboBox ) Image *image; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // clear the content of the box SendMessage( comboBox, CB_RESETCONTENT, 0, 0 ); // load the combo box with string names from the GUI image collection - for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=NULL;index++) + for (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=nullptr;index++) { SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() ); @@ -1200,7 +1200,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) HeaderTemplate *ht; // sanity - if( comboBox == NULL ) + if( comboBox == nullptr ) return; // clear the content of the box @@ -1235,7 +1235,7 @@ void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected ) * image Loc from the GUI collection * * NOTE: The image list combo boxes have a [NONE] at index 0, if that - * is selected NULL will be returned + * is selected nullptr will be returned */ //============================================================================= const Image *ComboBoxSelectionToImage( HWND comboBox ) @@ -1244,15 +1244,15 @@ const Image *ComboBoxSelectionToImage( HWND comboBox ) char buffer[ 512 ]; // santiy - if( comboBox == NULL ) - return NULL; + if( comboBox == nullptr ) + return nullptr; // get the selected index selected = SendMessage( comboBox, CB_GETCURSEL, 0, 0 ); // do nothing if index 0 is selected (contains the string "[NONE]") if( selected == CB_ERR || selected == 0 ) - return NULL; + return nullptr; // get the text of the selected item SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer ); @@ -1279,7 +1279,7 @@ RGBColorInt *GetControlColor( UnsignedInt controlID ) } // not found - return NULL; + return nullptr; } @@ -1327,7 +1327,7 @@ ImageAndColorInfo *GetStateInfo( StateIdentifier id ) } - return NULL; + return nullptr; } @@ -1345,7 +1345,7 @@ void SwitchToState( StateIdentifier id, HWND dialog ) // get the data for the new state info = GetStateInfo( id ); - if( info == NULL ) + if( info == nullptr ) { DEBUG_LOG(( "Invalid state request" )); @@ -1367,8 +1367,8 @@ void SwitchToState( StateIdentifier id, HWND dialog ) // invalidate the color previews, they will redraw with the new // state automatically // - InvalidateRect( colorButton, NULL, TRUE ); - InvalidateRect( borderColorButton, NULL, TRUE ); + InvalidateRect( colorButton, nullptr, TRUE ); + InvalidateRect( borderColorButton, nullptr, TRUE ); } @@ -1432,7 +1432,7 @@ ImageAndColorInfo *GetCurrentStateInfo( HWND dialog ) // get selected state selected = SendMessage( stateCombo, CB_GETCURSEL, 0, 0 ); if( selected == CB_ERR ) - return NULL; + return nullptr; // get the state ID of the selected item (stored in the item data) stateID = (StateIdentifier)SendMessage( stateCombo, CB_GETITEMDATA, selected, 0 ); @@ -1558,7 +1558,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, DeleteObject( hBrushNew ); // validate this new area - ValidateRect( hWndControl, NULL ); + ValidateRect( hWndControl, nullptr ); // we have taken care of it *returnCode = TRUE; @@ -1615,8 +1615,8 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, currTextIndex = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 ); // invalidate each of the preview windows for text colors - InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE ); - InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE ); + InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), nullptr, TRUE ); + InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), nullptr, TRUE ); } used = TRUE; @@ -1695,7 +1695,7 @@ Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message, assert( 0 ); // invalidate the color preview - InvalidateRect( hWndControl, NULL, TRUE ); + InvalidateRect( hWndControl, nullptr, TRUE ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 0cafceb9661..93ed63a9ac7 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -305,7 +305,7 @@ static Bool saveCallbacks( GameWindow *window, FILE *fp, Int dataIndent ) GameWindowEditData *editData = window->winGetEditData(); // if no edit data don't write anything for callbacks - if( editData == NULL ) + if( editData == nullptr ) return FALSE; // system @@ -365,7 +365,7 @@ static Bool saveFont( GameWindow *window, FILE *fp, Int dataIndent ) GameFont *font = window->winGetFont(); // if no font data don't write anything - if( font == NULL ) + if( font == nullptr ) return TRUE; // write the font data @@ -612,7 +612,7 @@ static Bool saveListboxData( GameWindow *window, FILE *fp, Int dataIndent ) ListboxData *listData = (ListboxData *)window->winGetUserData(); // sanity - if( listData == NULL ) + if( listData == nullptr ) { DEBUG_LOG(( "No listbox data to save for window '%d'", @@ -698,7 +698,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); // sanity - if( comboData == NULL ) + if( comboData == nullptr ) { DEBUG_LOG(( "No comboData data to save for window '%d'", @@ -797,7 +797,7 @@ static Bool saveRadioButtonData( GameWindow *window, FILE *fp, Int dataIndent ) { RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - if( radioData == NULL ) + if( radioData == nullptr ) { @@ -823,7 +823,7 @@ static Bool saveSliderData( GameWindow *window, FILE *fp, Int dataIndent ) SliderData *sliderData = (SliderData *)window->winGetUserData(); // sanity - if( sliderData == NULL ) + if( sliderData == nullptr ) { DEBUG_LOG(( "No slider data in window to save for window %d", @@ -861,7 +861,7 @@ static Bool saveStaticTextData( GameWindow *window, FILE *fp, Int dataIndent ) TextData *textData = (TextData *)window->winGetUserData(); // sanity - if( textData == NULL ) + if( textData == nullptr ) { DEBUG_LOG(( "No text data in window to save for window %d", @@ -886,7 +886,7 @@ static Bool saveTextEntryData( GameWindow *window, FILE *fp, Int dataIndent ) EntryData *entryData = (EntryData *)window->winGetUserData(); // sanity - if( entryData == NULL ) + if( entryData == nullptr ) { DEBUG_LOG(( "No text entry data in window to save for window %d", @@ -919,7 +919,7 @@ static Bool saveTabControlData( GameWindow *window, FILE *fp, Int dataIndent ) TabControlData *tabControlData = (TabControlData *)window->winGetUserData(); // sanity - if( tabControlData == NULL ) + if( tabControlData == nullptr ) { DEBUG_LOG(( "No text entry data in window to save for window %d", @@ -1038,7 +1038,7 @@ static Bool saveWindow( FILE *fp, GameWindow *window, Int indent ) { // traverse to end of child list - while( child->winGetNext() != NULL ) + while( child->winGetNext() != nullptr ) child = child->winGetNext(); // save children windows in reverse order @@ -1095,7 +1095,7 @@ void GUIEdit::validateNames( GameWindow *root, char *filename, Bool *valid ) { // the end of recursion - if( root == NULL ) + if( root == nullptr ) return; // trivial case @@ -1153,7 +1153,7 @@ void GUIEdit::updateRadioScreenIdentifiers( GameWindow *window, Int screenID ) { // end recursion - if( window == NULL ) + if( window == nullptr ) return; // is this a radio button @@ -1212,12 +1212,12 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) writeFontFile( GUIEDIT_FONT_FILENAME ); // sanity - if( filePathAndFilename == NULL ) + if( filePathAndFilename == nullptr ) return FALSE; // check for empty layout and just get out of here window = TheWindowManager->winGetWindowList(); - if( window == NULL ) + if( window == nullptr ) return TRUE; // check all the names for sizes once decorated with filename @@ -1239,7 +1239,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // open the file fp = fopen( filePathAndFilename, "w" ); - if( fp == NULL ) + if( fp == nullptr ) return FALSE; // write out a single line for our window file version @@ -1257,7 +1257,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // go to end of window list window = TheWindowManager->winGetWindowList(); - while( window->winGetNext() != NULL ) + while( window->winGetNext() != nullptr ) window = window->winGetNext(); // loop backwards saving all windows diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp index 52ea538ae19..68d90a2c2c3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -71,7 +71,7 @@ static const char *szWindowClass = "GUIEdit"; // PUBLIC DATA //////////////////////////////////////////////////////////////// HINSTANCE ApplicationHInstance; ///< main application instance HWND ApplicationHWnd; ///< main application HWnd -Win32Mouse *TheWin32Mouse = NULL; ///< for Win32 mouse +Win32Mouse *TheWin32Mouse = nullptr; ///< for Win32 mouse const char *gAppPrefix = "ge_"; /// So GuiEdit can have a different debug log file name if we need it const Char *g_strFile = "data\\Generals.str"; @@ -114,12 +114,12 @@ static BOOL initInstance( HINSTANCE hInstance, int nCmdShow ) 0, // y position GetSystemMetrics( SM_CXSCREEN ), // width GetSystemMetrics( SM_CYSCREEN ), // height - NULL, // parent - NULL, // menu + nullptr, // parent + nullptr, // menu ApplicationHInstance, // instance - NULL ); // creation data + nullptr ); // creation data - if( ApplicationHWnd == NULL ) + if( ApplicationHWnd == nullptr ) return FALSE; // display the window @@ -157,7 +157,7 @@ static ATOM registerClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)GUIEDIT_LARGE_ICON); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); wcex.lpszMenuName = (LPCSTR)GUIEDIT_MENU; wcex.lpszClassName = szWindowClass; @@ -186,7 +186,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, /// @todo remove this force set of working directory later Char buffer[ _MAX_PATH ]; - GetModuleFileName( NULL, buffer, sizeof( buffer ) ); + GetModuleFileName( nullptr, buffer, sizeof( buffer ) ); if (Char *pEnd = strrchr(buffer, '\\')) { *pEnd = 0; @@ -214,29 +214,29 @@ Int APIENTRY WinMain(HINSTANCE hInstance, // initialize GUIEdit data TheEditor = new GUIEdit; - if( TheEditor == NULL ) + if( TheEditor == nullptr ) return FALSE; TheEditor->init(); TheFramePacer = new FramePacer(); // - // see if we have any messages to process, a NULL window handle tells the + // see if we have any messages to process, a nullptr window handle tells the // OS to look at the main window associated with the calling thread, us! // while( quit == FALSE ) { // is there is message ready for us? - if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + if( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // process ALL messages waiting - while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) { // get the message - returnValue = GetMessage( &msg, NULL, 0, 0 ); + returnValue = GetMessage( &msg, nullptr, 0, 0 ); // check for quitting if( returnValue == 0 ) @@ -268,10 +268,10 @@ Int APIENTRY WinMain(HINSTANCE hInstance, // shutdown GUIEdit data delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheEditor; - TheEditor = NULL; + TheEditor = nullptr; shutdownMemoryManager(); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h index 1c8801e14ba..4d4ef457970 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h @@ -30,7 +30,7 @@ class CColorAlphaDialog : public CDialog void onColorPress( Int colorPressed ); public: enum {IDD = IDD_PSEd_EditColorAndAlpha}; - CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = NULL); + CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h b/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h index bc932935799..b6365147eb5 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h @@ -22,7 +22,7 @@ struct CParticleEditorPage : public CDialog { UINT m_templateID; public: - CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = NULL); + CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr); void InitPanel( int templateID ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h b/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h index 5b467b0c2b4..35adbf77c27 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h @@ -26,7 +26,7 @@ class CSwitchesDialog : public CDialog { public: enum {IDD = IDD_PSEd_EditSwitchesDialog}; - CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = NULL); + CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h b/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h index 347c65f152d..300973ed21a 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h @@ -49,7 +49,7 @@ class EmissionPanelPoint : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelPoint}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = NULL); + EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -67,7 +67,7 @@ class EmissionPanelLine : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelLine}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = NULL); + EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -85,7 +85,7 @@ class EmissionPanelBox : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelBox}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = NULL); + EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -103,7 +103,7 @@ class EmissionPanelSphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelSphere}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = NULL); + EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -121,7 +121,7 @@ class EmissionPanelCylinder : public ISwapablePanel public: enum {IDD = IDD_PSEd_EmissionPanelCylinder}; virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = NULL); + EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h b/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h index 96b12558989..2461474bcc1 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h @@ -43,7 +43,7 @@ interface ISwapablePanel : public CDialog { - ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = NULL) : CDialog(nIDTemplate, pParentWnd) {} + ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr) : CDialog(nIDTemplate, pParentWnd) {} virtual DWORD GetIDD( void ) = 0; virtual void performUpdate( IN Bool toUI ) = 0; virtual void InitPanel( void ) = 0; diff --git a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h b/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h index a8be3b1cd48..06555e88b8a 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h @@ -45,7 +45,7 @@ class MoreParmsDialog : public CDialog { public: enum { IDD = IDD_PSEd_EditMoreParms }; - MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = NULL); + MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = nullptr); virtual ~MoreParmsDialog(); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp index 00e8a591c92..781b4f66a6d 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp @@ -73,7 +73,7 @@ CDebugWindowApp::CDebugWindowApp() { AfxInitialize(true); AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = NULL; + m_DialogWindow = nullptr; } @@ -104,9 +104,9 @@ void __declspec(dllexport) CreateParticleSystemDialog(void) DebugWindowDialog* tmpWnd; tmpWnd = new DebugWindowDialog; - tmpWnd->Create(DebugWindowDialog::IDD, NULL); + tmpWnd->Create(DebugWindowDialog::IDD, nullptr); - tmpWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + tmpWnd->SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); tmpWnd->InitPanel(); tmpWnd->ShowWindow(SW_SHOW); if (tmpWnd->GetMainWndHWND()) { @@ -126,7 +126,7 @@ void __declspec(dllexport) DestroyParticleSystemDialog(void) if (tmpWnd) { tmpWnd->DestroyWindow(); delete tmpWnd; - theApp.SetDialogWindow(NULL); + theApp.SetDialogWindow(nullptr); } } catch (...) { } } diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index b41df2cc2f5..f0333c9bb23 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -35,11 +35,11 @@ m_colorAlphaDialog(CColorAlphaDialog::IDD, this), m_switchesDialog(CSwitchesDialog::IDD, this), m_moreParmsDialog(MoreParmsDialog::IDD, this) { - mMainWndHWND = ::FindWindow(NULL, "Command & Conquer: Generals"); + mMainWndHWND = ::FindWindow(nullptr, "Command & Conquer: Generals"); m_activeEmissionPage = 0; m_activeVelocityPage = 0; m_activeParticlePage = 0; - m_particleSystem = NULL; + m_particleSystem = nullptr; m_changeHasOcurred = false; @@ -157,7 +157,7 @@ void DebugWindowDialog::InitPanel( void ) m_emissionTypePanels[j]->Create(m_emissionTypePanels[j]->GetIDD(), this); m_emissionTypePanels[j]->InitPanel(); m_emissionTypePanels[j]->ShowWindow(SW_HIDE); - m_emissionTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_emissionTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_emissionTypePanels[0]->ShowWindow(SW_SHOW); @@ -172,7 +172,7 @@ void DebugWindowDialog::InitPanel( void ) m_velocityTypePanels[j]->Create(m_velocityTypePanels[j]->GetIDD(), this); m_velocityTypePanels[j]->InitPanel(); m_velocityTypePanels[j]->ShowWindow(SW_HIDE); - m_velocityTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_velocityTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_velocityTypePanels[0]->ShowWindow(SW_SHOW); @@ -187,7 +187,7 @@ void DebugWindowDialog::InitPanel( void ) m_particleTypePanels[j]->Create(m_particleTypePanels[j]->GetIDD(), this); m_particleTypePanels[j]->InitPanel(); m_particleTypePanels[j]->ShowWindow(SW_HIDE); - m_particleTypePanels[j]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); + m_particleTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); } pWnd->ShowWindow(SW_HIDE); m_particleTypePanels[0]->ShowWindow(SW_SHOW); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h index b38afd9d18f..52a5783c4e0 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h @@ -54,7 +54,7 @@ class DebugWindowDialog : public CDialog { public: enum {IDD = IDD_PSEd}; - DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = NULL); + DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = nullptr); virtual ~DebugWindowDialog(); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h b/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h index 3858e1256a5..a11b9966488 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h @@ -48,7 +48,7 @@ class ParticlePanelParticle : public ISwapablePanel public: enum {IDD = IDD_PSEd_ParticlePanelParticle}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = NULL); + ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -66,7 +66,7 @@ class ParticlePanelDrawable : public ISwapablePanel public: enum {IDD = IDD_PSEd_ParticlePanelDrawable}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = NULL); + ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); void clearAllThingTemplates( void ); @@ -85,7 +85,7 @@ class ParticlePanelStreak : public ParticlePanelParticle public: enum {IDD = IDD_PSEd_ParticlePanelStreak}; virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = NULL); + ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h b/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h index ecc4ac07382..9a1c0207aff 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h @@ -49,7 +49,7 @@ class VelocityPanelOrtho : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelOrtho}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = NULL); + VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -67,7 +67,7 @@ class VelocityPanelSphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelSphere}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = NULL); + VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -85,7 +85,7 @@ class VelocityPanelHemisphere : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelHemisphere}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = NULL); + VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -103,7 +103,7 @@ class VelocityPanelCylinder : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelCylinder}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = NULL); + VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); @@ -121,7 +121,7 @@ class VelocityPanelOutward : public ISwapablePanel public: enum {IDD = IDD_PSEd_VelocityPanelOutward}; virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = NULL); + VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = nullptr); void InitPanel( void ); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h index 309efe287fd..3616de46116 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h @@ -28,7 +28,7 @@ class BaseBuildProps : public CDialog { // Construction public: - BaseBuildProps(CWnd* pParent = NULL); // standard constructor + BaseBuildProps(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BaseBuildProps) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h index 713b517da49..0bcf63f0589 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h @@ -32,7 +32,7 @@ class BlendMaterial : public COptionsPanel { // Construction public: - BlendMaterial(CWnd* pParent = NULL); // standard constructor + BlendMaterial(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BlendMaterial) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/BuildList.h b/GeneralsMD/Code/Tools/WorldBuilder/include/BuildList.h index 51365043040..9d567242187 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BuildList.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BuildList.h @@ -34,7 +34,7 @@ class BuildList : public COptionsPanel, public PopupSliderOwner { // Construction public: - BuildList(CWnd* pParent = NULL); ///< standard constructor + BuildList(CWnd* pParent = nullptr); ///< standard constructor ~BuildList(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h index b0f88d8f2d7..4a119cb0800 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CFixTeamOwnerDialog.h @@ -28,7 +28,7 @@ class CFixTeamOwnerDialog : public CDialog { public: enum { IDD = IDD_CHANGE_TEAM_OWNER }; - CFixTeamOwnerDialog( TeamsInfo *ti, SidesList *sideList, UINT nIDTemplate = CFixTeamOwnerDialog::IDD, CWnd* pParentWnd = NULL ); + CFixTeamOwnerDialog( TeamsInfo *ti, SidesList *sideList, UINT nIDTemplate = CFixTeamOwnerDialog::IDD, CWnd* pParentWnd = nullptr ); AsciiString getSelectedOwner(); Bool pickedValidTeam() { return m_pickedValidTeam; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h index 32c27ecd8be..697292ee83c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h @@ -74,7 +74,7 @@ class WBDocUndoable : public Undoable public: - WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset = NULL); + WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset = nullptr); // destructor. ~WBDocUndoable(void); @@ -229,7 +229,7 @@ class DictItemUndoable : public Undoable // if you want to just add/modify/remove a single dict item, pass the item's key. // if you want to substitute the entire contents of the new dict, pass NAMEKEY_INVALID. - DictItemUndoable(Dict **d, Dict data, NameKeyType key, Int dictsToModify = 1, CWorldBuilderDoc *pDoc = NULL, Bool inval = false); + DictItemUndoable(Dict **d, Dict data, NameKeyType key, Int dictsToModify = 1, CWorldBuilderDoc *pDoc = nullptr, Bool inval = false); // destructor. ~DictItemUndoable(void); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h index 3ba623f52d9..f85a49b6497 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h @@ -31,7 +31,7 @@ class CameraOptions : public CDialog, public PopupSliderOwner { // Construction public: - CameraOptions(CWnd* pParent = NULL); // standard constructor + CameraOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CameraOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h index 8dd420e5c17..bf3fd543efe 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h @@ -28,7 +28,7 @@ class CellWidth : public CDialog { // Construction public: - CellWidth(int cellWidth, CWnd* pParent = NULL); // standard constructor + CellWidth(int cellWidth, CWnd* pParent = nullptr); // standard constructor int GetCellWidth(void) {return mCellWidth;}; // Dialog Data diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h index 974aeca6f83..707beb4ca8b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h @@ -35,7 +35,7 @@ class ContourOptions : public CDialog MIN_WIDTH=1, MAX_WIDTH=6}; - ContourOptions(CWnd* pParent = NULL); // standard constructor + ContourOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ContourOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h index 67c8affbb26..7f9ca36525a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h @@ -32,7 +32,7 @@ class EditAction : public CDialog { // Construction public: - EditAction(CWnd* pParent = NULL); // standard constructor + EditAction(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditAction) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h index 56dd2efe3a7..d15363517cf 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h @@ -38,7 +38,7 @@ class EditCondition : public CDialog { // Construction public: - EditCondition(CWnd* pParent = NULL); // standard constructor + EditCondition(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditCondition) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h index 1f007f9b470..c4050f7e64e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCoordParameter.h @@ -30,7 +30,7 @@ class EditCoordParameter : public CDialog friend class EditParameter; // Construction public: - EditCoordParameter(CWnd* pParent = NULL); // standard constructor + EditCoordParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditCoordParameter) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h index b75952dfefd..f0297ed6726 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h @@ -29,7 +29,7 @@ class EditGroup : public CDialog { // Construction public: - EditGroup(ScriptGroup *pGroup, CWnd* pParent = NULL); // standard constructor + EditGroup(ScriptGroup *pGroup, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditGroup) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h index 2f4c11394d4..0544cf79dec 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditObjectParameter.h @@ -30,7 +30,7 @@ class EditObjectParameter : public CDialog friend class EditParameter; // Construction public: - EditObjectParameter(CWnd* pParent = NULL); // standard constructor + EditObjectParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditObjectParameter) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h index 8141ef0df32..d5143cc538a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditParameter.h @@ -31,7 +31,7 @@ class EditParameter : public CDialog { // Construction public: - EditParameter(CWnd* pParent = NULL); // standard constructor + EditParameter(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EditParameter) @@ -57,7 +57,7 @@ class EditParameter : public CDialog static Bool loadScripts(CComboBox *pCombo, Bool subr, AsciiString match = AsciiString::TheEmptyString); static Bool loadWaypoints(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); static Bool loadTransports(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); - static Bool loadObjectTypeList(CComboBox *pCombo, std::vector *strings = NULL, AsciiString match = AsciiString::TheEmptyString); + static Bool loadObjectTypeList(CComboBox *pCombo, std::vector *strings = nullptr, AsciiString match = AsciiString::TheEmptyString); protected: static Bool loadSides(CComboBox *pCombo, AsciiString match = AsciiString::TheEmptyString); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h index 30a2a22e6ce..ae3d28a3fd5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h @@ -28,7 +28,7 @@ class ExportScriptsOptions : public CDialog { // Construction public: - ExportScriptsOptions(CWnd* pParent = NULL); // standard constructor + ExportScriptsOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ExportScriptsOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h index 66ef13d9171..196a176daba 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h @@ -37,7 +37,7 @@ class FeatherOptions : public COptionsPanel , public PopupSliderOwner MIN_RADIUS=1, MAX_RADIUS=5}; - FeatherOptions(CWnd* pParent = NULL); // standard constructor + FeatherOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(FeatherOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h index dff1241e7aa..d15832745c5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FenceOptions.h @@ -33,7 +33,7 @@ class FenceOptions : public COptionsPanel { // Construction public: - FenceOptions(CWnd* pParent = NULL); ///< standard constructor + FenceOptions(CWnd* pParent = nullptr); ///< standard constructor ~FenceOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h index 7ea4d1f37b6..96e9297e56e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h @@ -40,7 +40,7 @@ class GlobalLightOptions : public CDialog , public PopupSliderOwner int kUIBlueIDs[3];// = {IDC_BD_EDIT, IDC_BD_EDIT1, IDC_BD_EDIT2}; CButtonShowColor m_colorButton; - GlobalLightOptions(CWnd* pParent = NULL); // standard constructor + GlobalLightOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(GlobalLightOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h index 27101c97335..d574ccea489 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GroveOptions.h @@ -45,7 +45,7 @@ class GroveOptions : public COptionsPanel Int mNumTrees; public: - GroveOptions(CWnd* pParent = NULL); + GroveOptions(CWnd* pParent = nullptr); ~GroveOptions(); void makeMain(void); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h index ad3cbad52aa..1b86b2aee68 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -24,7 +24,7 @@ class ImpassableOptions : public CDialog enum { IDD = IDD_IMPASSABLEOPTIONS }; public: - ImpassableOptions(CWnd* pParent = NULL, Real defaultSlope = 45.0f); + ImpassableOptions(CWnd* pParent = nullptr, Real defaultSlope = 45.0f); virtual ~ImpassableOptions(); Real GetSlopeToShow() const { return m_slopeToShow; } Real GetDefaultSlope() const { return m_defaultSlopeToShow; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h index 00a8c5f5aa0..1cfa2c943e9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h @@ -86,7 +86,7 @@ class LayersList : public CDialog public: enum { IDD = IDD_LAYERSLIST }; - LayersList(UINT nIDTemplate = LayersList::IDD, CWnd *parentWnd = NULL); + LayersList(UINT nIDTemplate = LayersList::IDD, CWnd *parentWnd = nullptr); virtual ~LayersList(); void resetLayers(); @@ -145,19 +145,19 @@ class LayersList : public CDialog // layerIt points to a valid layer iterator in which the MapObject was found // MapObjectIt points to a valid MapObject iterator on the layerIts MapObjectsInLayer member // 2) Returns false if the MapObject cannot be found. - Bool findMapObjectAndList(IN MapObject *MapObjectToFind, OUT ListLayerIt *layerIt = NULL, OUT ListMapObjectPtrIt *MapObjectIt = NULL); - Bool findPolygonTriggerAndList(IN PolygonTrigger *PolygonTriggerToFind, OUT ListLayerIt *layerIt = NULL, OUT ListPolygonTriggerPtrIt *PolygonTriggerIt = NULL); + Bool findMapObjectAndList(IN MapObject *MapObjectToFind, OUT ListLayerIt *layerIt = nullptr, OUT ListMapObjectPtrIt *MapObjectIt = nullptr); + Bool findPolygonTriggerAndList(IN PolygonTrigger *PolygonTriggerToFind, OUT ListLayerIt *layerIt = nullptr, OUT ListPolygonTriggerPtrIt *PolygonTriggerIt = nullptr); // This function takes a layer name, and does one of the following: // 1) Return true if the layer can be found, and // layerIt points to a valid layer iterator named layerName // 2) Returns false if the layer cannot be found. - Bool findLayerNamed(IN AsciiString layerName, OUT ListLayerIt *layerIt = NULL); + Bool findLayerNamed(IN AsciiString layerName, OUT ListLayerIt *layerIt = nullptr); void addMapObjectToLayer(IN MapObject *objToAdd, IN ListLayerIt *layerIt); void addPolygonTriggerToLayer(IN PolygonTrigger *objToAdd, IN ListLayerIt *layerIt); - void removeMapObjectFromLayer(IN MapObject *objToRemove, IN ListLayerIt *layerIt = NULL, IN ListMapObjectPtrIt *MapObjectIt = NULL); - void removePolygonTriggerFromLayer(IN PolygonTrigger *triggerToRemove, IN ListLayerIt *layerIt = NULL, IN ListPolygonTriggerPtrIt *PolygonTriggerIt = NULL); + void removeMapObjectFromLayer(IN MapObject *objToRemove, IN ListLayerIt *layerIt = nullptr, IN ListMapObjectPtrIt *MapObjectIt = nullptr); + void removePolygonTriggerFromLayer(IN PolygonTrigger *triggerToRemove, IN ListLayerIt *layerIt = nullptr, IN ListPolygonTriggerPtrIt *PolygonTriggerIt = nullptr); void updateObjectRenderFlags(IN ListLayerIt *layerIt); void updateTreeImages(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h index 3e155832561..2436707271c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h @@ -31,7 +31,7 @@ class LightOptions : public COptionsPanel // Construction public: - LightOptions(CWnd* pParent = NULL); // standard constructor + LightOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(LightOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h index d6e1517d692..73b0ddad53e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h @@ -28,7 +28,7 @@ class MapSettings : public CDialog { // Construction public: - MapSettings(CWnd* pParent = NULL); // standard constructor + MapSettings(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(MapSettings) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h index 973c9c285ea..623164d30e9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MeshMoldOptions.h @@ -31,7 +31,7 @@ class MeshMoldOptions : public COptionsPanel , public PopupSliderOwner { // Construction public: - MeshMoldOptions(CWnd* pParent = NULL); // standard constructor + MeshMoldOptions(CWnd* pParent = nullptr); // standard constructor enum {MIN_ANGLE=-180, MAX_ANGLE=180, MIN_HEIGHT=-10, diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h index 2d0ef585e2f..19e2aed5cc5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h @@ -41,7 +41,7 @@ class MoundOptions : public COptionsPanel , public PopupSliderOwner MIN_FEATHER=0, MAX_FEATHER=20}; - MoundOptions(CWnd* pParent = NULL); // standard constructor + MoundOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(MoundOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h index 3a376456251..42fa791d437 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/NewHeightMap.h @@ -43,7 +43,7 @@ class CNewHeightMap : public CDialog { // Construction public: - CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent = NULL); // standard constructor + CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent = nullptr); // standard constructor void GetHeightInfo(TNewHeightInfo *hiP) {*hiP = mHeightInfo; }; // Dialog Data diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h index 94af9739d8a..b3061ad29b4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ObjectOptions.h @@ -33,7 +33,7 @@ class ObjectOptions : public COptionsPanel { // Construction public: - ObjectOptions(CWnd* pParent = NULL); ///< standard constructor + ObjectOptions(CWnd* pParent = nullptr); ///< standard constructor ~ObjectOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h index f43de286e75..6b5452038bc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h @@ -35,7 +35,7 @@ class OpenMap : public CDialog { // Construction public: - OpenMap(TOpenMapInfo *pInfo, CWnd* pParent = NULL); // standard constructor + OpenMap(TOpenMapInfo *pInfo, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(OpenMap) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h b/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h index b105a97c9f0..5b7847e1ace 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h @@ -32,7 +32,7 @@ class COptionsPanel : public CDialog { // Construction public: - COptionsPanel(Int dlgid = 0, CWnd* pParent = NULL); // standard constructor + COptionsPanel(Int dlgid = 0, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(COptionsPanel) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h index 18ee6f3dd22..adc8c759f85 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/PickUnitDialog.h @@ -46,8 +46,8 @@ class PickUnitDialog : public CDialog // Construction public: - PickUnitDialog(CWnd* pParent = NULL); // standard constructor - PickUnitDialog(UINT id, CWnd* pParent = NULL); // standard constructor + PickUnitDialog(CWnd* pParent = nullptr); // standard constructor + PickUnitDialog(UINT id, CWnd* pParent = nullptr); // standard constructor ~PickUnitDialog(void); ///< standard destructor // Dialog Data @@ -87,7 +87,7 @@ class PickUnitDialog : public CDialog class ReplaceUnitDialog : public PickUnitDialog { public: - ReplaceUnitDialog(CWnd* pParent = NULL); // standard constructor + ReplaceUnitDialog(CWnd* pParent = nullptr); // standard constructor void setMissing(AsciiString name) {m_missingName = name;}; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h index 8137f0a91cf..320ac87de1a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h @@ -47,7 +47,7 @@ class RampOptions : public COptionsPanel Real m_rampWidth; public: enum { IDD = IDD_RAMP_OPTIONS }; - RampOptions(CWnd* pParent = NULL); + RampOptions(CWnd* pParent = nullptr); virtual ~RampOptions(); Bool shouldApplyTheRamp(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h index 939e00a6197..c1444bd9248 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RoadOptions.h @@ -33,7 +33,7 @@ class RoadOptions : public COptionsPanel { // Construction public: - RoadOptions(CWnd* pParent = NULL); ///< standard constructor + RoadOptions(CWnd* pParent = nullptr); ///< standard constructor ~RoadOptions(void); ///< standard destructor enum { NAME_MAX_LEN = 64 }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h index 38cf6e0ba81..dd8dde7abba 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h @@ -31,7 +31,7 @@ class RulerOptions : public COptionsPanel // Construction public: - RulerOptions(CWnd* pParent = NULL); // standard constructor + RulerOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(RulerOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h index 553e42c6497..11c85a6e29d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h @@ -36,7 +36,7 @@ class SaveMap : public CDialog { // Construction public: - SaveMap(TSaveMapInfo *pInfo, CWnd* pParent = NULL); // standard constructor + SaveMap(TSaveMapInfo *pInfo, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(SaveMap) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h index 8746d039953..998af495aa4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScorchOptions.h @@ -34,7 +34,7 @@ class ScorchOptions : public COptionsPanel, public PopupSliderOwner { // Construction public: - ScorchOptions(CWnd* pParent = NULL); // standard constructor + ScorchOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ScorchOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h index 3bebff4376d..b18a6d978c0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h @@ -61,7 +61,7 @@ class ScriptDialog : public CDialog { // Construction public: - ScriptDialog(CWnd* pParent = NULL); // standard constructor + ScriptDialog(CWnd* pParent = nullptr); // standard constructor ~ScriptDialog(); // destructor // Dialog Data diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h b/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h index 1b6c2cba685..e5383b6f01b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h @@ -28,7 +28,7 @@ class SelectMacrotexture : public CDialog { // Construction public: - SelectMacrotexture(CWnd* pParent = NULL); // standard constructor + SelectMacrotexture(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(SelectMacrotexture) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h index a4b742afa20..25aa98d8294 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h @@ -28,7 +28,7 @@ class ShadowOptions : public CDialog { // Construction public: - ShadowOptions(CWnd* pParent = NULL); // standard constructor + ShadowOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(ShadowOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h index 95d4e713e72..a8d80c8dc6d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h @@ -35,7 +35,7 @@ class TeamObjectProperties : public CPropertyPage { // Construction public: - TeamObjectProperties(Dict* dictToEdit = NULL); + TeamObjectProperties(Dict* dictToEdit = nullptr); ~TeamObjectProperties(); // Dialog Data diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h index 98349d4ef41..9e92a4032dc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h @@ -32,7 +32,7 @@ class TerrainMaterial : public COptionsPanel, public PopupSliderOwner { // Construction public: - TerrainMaterial(CWnd* pParent = NULL); // standard constructor + TerrainMaterial(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(TerrainMaterial) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h index e2f5f6cca18..0154e392786 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainModal.h @@ -31,7 +31,7 @@ class TerrainModal : public CDialog { // Construction public: - TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent = NULL); // standard constructor + TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(TerrainModal) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/Tool.h b/GeneralsMD/Code/Tools/WorldBuilder/include/Tool.h index dcb2b9ead44..e997529e2b5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/Tool.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/Tool.h @@ -75,7 +75,7 @@ class Tool virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) {} - virtual WorldHeightMapEdit *getHeightMap(void) {return NULL;} + virtual WorldHeightMapEdit *getHeightMap(void) {return nullptr;} static Real calcRoundBlendFactor(CPoint center, Int x, Int y, Int brushWidth, Int featherWidth); static Real calcSquareBlendFactor(CPoint center, Int x, Int y, Int brushWidth, Int featherWidth); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h index f67256a84fb..5933bc1e9b1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h @@ -41,8 +41,8 @@ class CWBFrameWnd : public CFrameWnd public: virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, - CWnd* pParentWnd = NULL, - CCreateContext* pContext = NULL); + CWnd* pParentWnd = nullptr, + CCreateContext* pContext = nullptr); // ClassWizard generated virtual function overrides //}}AFX_VIRTUAL @@ -70,8 +70,8 @@ class CWB3dFrameWnd : public CMainFrame // Overrides virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, - CWnd* pParentWnd = NULL, - CCreateContext* pContext = NULL); + CWnd* pParentWnd = nullptr, + CCreateContext* pContext = nullptr); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWB3dFrameWnd) public: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index c748ad6fe1f..406d70d2bea 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -35,7 +35,7 @@ class CProcessNode Real m_len; ///< Length of texture coord on this node. CProcessNode *m_next; public: - CProcessNode(Int x, Int y):m_x(x),m_y(y),m_next(NULL),m_len(0) {}; + CProcessNode(Int x, Int y):m_x(x),m_y(y),m_next(nullptr),m_len(0) {}; ~CProcessNode(void) { }; }; @@ -90,7 +90,7 @@ class WorldHeightMapEdit : public WorldHeightMap UnsignedByte *pProcessed, TCliffInfo &cliffInfo); Bool adjustForTiling(TCliffInfo &cliffInfo, Real textureWidth); void updateFlatCellForAdjacentCliffs(Int xIndex, Int yIndex, - Int curTileClass, UnsignedByte *pProcessed=NULL); + Int curTileClass, UnsignedByte *pProcessed=nullptr); public: // construction WorldHeightMapEdit(Int xExtent, Int yExtent, UnsignedByte initialHeight, Int border); ///< create. @@ -157,7 +157,7 @@ class WorldHeightMapEdit : public WorldHeightMap void changeBoundary(Int ndx, ICoord2D *border); void removeLastBoundary(void); - // outNdx must not be NULL, but outHandle can be. + // outNdx must not be null, but outHandle can be. // outHandle: 0 means BL, 1 means TL, 2 means TR, 3 means BR void findBoundaryNear(Coord3D *pt, float okDistance, Int *outNdx, Int *outHandle); }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WaterOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WaterOptions.h index 7d55f6c7850..5a29ed82227 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WaterOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WaterOptions.h @@ -35,7 +35,7 @@ class WaterOptions : public COptionsPanel, public PopupSliderOwner // Construction public: - WaterOptions(CWnd* pParent = NULL); // standard constructor + WaterOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(WaterOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WaypointOptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WaypointOptions.h index 6934e7f6ba2..bd7e745dae8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WaypointOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WaypointOptions.h @@ -34,7 +34,7 @@ class WaypointOptions : public COptionsPanel // Construction public: - WaypointOptions(CWnd* pParent = NULL); // standard constructor + WaypointOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(WaypointOptions) @@ -82,7 +82,7 @@ class WaypointOptions : public COptionsPanel static void update(void); static MapObject *getSingleSelectedWaypoint(void); static PolygonTrigger *getSingleSelectedPolygon(void); - static Bool isUnique(AsciiString name, MapObject* theMapObj = NULL); + static Bool isUnique(AsciiString name, MapObject* theMapObj = nullptr); static AsciiString GenerateUniqueName(Int id); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h index 90159d4c738..b57edef72d6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h @@ -137,7 +137,7 @@ class CWorldBuilderApp : public CWinApp void deletePasteObjList(void) { deleteInstance(m_pasteMapObjList); - m_pasteMapObjList = NULL; + m_pasteMapObjList = nullptr; }; public: diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h index 5ee67174cc5..7bcc0c43fee 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderDoc.h @@ -89,7 +89,7 @@ class CWorldBuilderDoc : public CDocument void changeBoundary(Int ndx, ICoord2D *border); void removeLastBoundary(void); - // outNdx must not be NULL, but outHandle can be. + // outNdx must not be null, but outHandle can be. // outHandle: 0 means BL, 1 means TL, 2 means TR, 3 means BR void findBoundaryNear(Coord3D *pt, float okDistance, Int *outNdx, Int *outHandle); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderView.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderView.h index 3ed7c354825..a41a6427191 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderView.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilderView.h @@ -124,7 +124,7 @@ class CWorldBuilderView : public WbView /// the doc has changed size; readjust view as necessary. virtual void adjustDocSize(); - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj); /// Invalidates the area of one height map cell in the 2d view. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/addplayerdialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/addplayerdialog.h index 88d7b0ad09c..66d5e2775ff 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/addplayerdialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/addplayerdialog.h @@ -34,7 +34,7 @@ class AddPlayerDialog : public CDialog // Construction public: - AddPlayerDialog(AsciiString side, CWnd* pParent = NULL); // standard constructor + AddPlayerDialog(AsciiString side, CWnd* pParent = nullptr); // standard constructor AsciiString getAddedSide() { return m_addedSide; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h b/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h index 251eceee380..f50a3b62844 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h @@ -37,7 +37,7 @@ class BrushOptions : public COptionsPanel , public PopupSliderOwner FREQ_FEATHER_TICKS=4, MAX_FEATHER=20}; - BrushOptions(CWnd* pParent = NULL); // standard constructor + BrushOptions(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(BrushOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h index 1e9d912fadd..e7fa8b4745d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h @@ -28,7 +28,7 @@ class EulaDialog : public CDialog { // Construction public: - EulaDialog(CWnd* pParent = NULL); // standard constructor + EulaDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(EulaDialog) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h b/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h index 74942008725..8cdab83a94d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h @@ -44,7 +44,7 @@ class MapObjectProps : public COptionsPanel, public PopupSliderOwner { // Construction public: - MapObjectProps(Dict* dictToEdit = NULL, const char* title = NULL, CWnd* pParent = NULL); // standard constructor + MapObjectProps(Dict* dictToEdit = nullptr, const char* title = nullptr, CWnd* pParent = nullptr); // standard constructor ~MapObjectProps(); void makeMain(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/playerlistdlg.h b/GeneralsMD/Code/Tools/WorldBuilder/include/playerlistdlg.h index 37f4a3c9f42..f7dcb5e8cf9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/playerlistdlg.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/playerlistdlg.h @@ -31,7 +31,7 @@ class PlayerListDlg : public CDialog { // Construction public: - PlayerListDlg(CWnd* pParent = NULL); // standard constructor + PlayerListDlg(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(PlayerListDlg) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h b/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h index a6a1781381f..8debd03050d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h @@ -28,7 +28,7 @@ class PropEdit : public CDialog { // Construction public: - PropEdit(AsciiString* key, Dict::DataType* type, AsciiString* value, Bool valueOnly, CWnd *parent = NULL); + PropEdit(AsciiString* key, Dict::DataType* type, AsciiString* value, Bool valueOnly, CWnd *parent = nullptr); // Dialog Data //{{AFX_DATA(PropEdit) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/teamsdialog.h b/GeneralsMD/Code/Tools/WorldBuilder/include/teamsdialog.h index ea4e3419f1c..9f6fe5c9eca 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/teamsdialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/teamsdialog.h @@ -30,7 +30,7 @@ class CTeamsDialog : public CDialog { // Construction public: - CTeamsDialog(CWnd* pParent = NULL); // standard constructor + CTeamsDialog(CWnd* pParent = nullptr); // standard constructor // Dialog Data //{{AFX_DATA(CTeamsDialog) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview.h b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview.h index 60f9cdd6428..ec706a0b613 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview.h @@ -119,7 +119,7 @@ class WbView : public CView /// Scrolls the window by this amount. virtual void scrollInView(Real x, Real y, Bool end) { DEBUG_CRASH(("should not call")); } - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj) { } /// Invalidates the area of one height map cell in the 2d view. @@ -138,8 +138,8 @@ class WbView : public CView void snapPoint(Coord3D *thePt) {if (m_snapToGrid || m_lockAngle) {thePt->x = MAP_XY_FACTOR*floor(thePt->x/MAP_XY_FACTOR+0.5); thePt->y = MAP_XY_FACTOR*floor(thePt->y/MAP_XY_FACTOR+0.5);};}; virtual TPickedStatus picked(MapObject *pObj, Coord3D docPt); - virtual MapObject *picked3dObjectInView(CPoint viewPt) {return NULL;}; - virtual BuildListInfo *pickedBuildObjectInView(CPoint viewPt) {return NULL;}; + virtual MapObject *picked3dObjectInView(CPoint viewPt) {return nullptr;}; + virtual BuildListInfo *pickedBuildObjectInView(CPoint viewPt) {return nullptr;}; Bool isPolygonTriggerVisible(void) {return m_showPolygonTriggers;}; Bool isWaypointVisible(void) {return m_showWaypoints;}; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h index 95d71082e58..f34426b6782 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h @@ -240,7 +240,7 @@ class WbView3d : public WbView, public DX8_CleanupHook virtual void updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange); - /// Invalidates an object. Pass NULL to inval all objects. + /// Invalidates an object. Pass null to inval all objects. virtual void invalObjectInView(MapObject *pObj); // find the best model for an object diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp index 31f7891263d..1fe9c60f0ae 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BaseBuildProps.cpp @@ -28,7 +28,7 @@ // BaseBuildProps dialog -BaseBuildProps::BaseBuildProps(CWnd* pParent /*=NULL*/) +BaseBuildProps::BaseBuildProps(CWnd* pParent /*=nullptr*/) : CDialog(BaseBuildProps::IDD, pParent) { //{{AFX_DATA_INIT(BaseBuildProps) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp index 6dc85eadc1d..a6b5e6f9a35 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BlendMaterial.cpp @@ -31,7 +31,7 @@ #include "Common/TerrainTypes.h" #include "W3DDevice/GameClient/TerrainTex.h" -BlendMaterial *BlendMaterial::m_staticThis = NULL; +BlendMaterial *BlendMaterial::m_staticThis = nullptr; static Int defaultMaterialIndex = -1; @@ -40,7 +40,7 @@ static Int defaultMaterialIndex = -1; Int BlendMaterial::m_currentBlendTexture(-1); -BlendMaterial::BlendMaterial(CWnd* pParent /*=NULL*/) : +BlendMaterial::BlendMaterial(CWnd* pParent /*=nullptr*/) : m_updating(false) { //{{AFX_DATA_INIT(BlendMaterial) @@ -84,7 +84,7 @@ Bool BlendMaterial::setTerrainTreeViewSelection(HTREEITEM parent, Int selection) char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; @@ -126,7 +126,7 @@ BOOL BlendMaterial::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - //m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + //m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); //m_terrainSwatches.ShowWindow(SW_SHOW); m_staticThis = this; @@ -144,7 +144,7 @@ HTREEITEM BlendMaterial::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -268,7 +268,7 @@ BOOL BlendMaterial::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) m_currentBlendTexture = texClass; } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_terrainTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_terrainTreeView.GetChildItem(hItem); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp index 7cbef8f8547..b9f5f2b14ae 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp @@ -20,6 +20,7 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 + #include "StdAfx.h" #include "resource.h" @@ -46,8 +47,8 @@ Int BrushTool::m_brushHeight; BrushTool::BrushTool(void) : Tool(ID_BRUSH_TOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapFeatherCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapFeatherCopy = nullptr; m_brushWidth = 0; m_brushFeather = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp index 99ff8ccd63a..8ba092b4637 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cpp @@ -37,7 +37,7 @@ #include "Common/WellKnownKeys.h" #include "wbview3d.h" -BuildList *BuildList::m_staticThis = NULL; +BuildList *BuildList::m_staticThis = nullptr; Bool BuildList::m_updating = false; @@ -45,7 +45,7 @@ Bool BuildList::m_updating = false; // BuildList dialog -BuildList::BuildList(CWnd* pParent /*=NULL*/) +BuildList::BuildList(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(BuildList) // NOTE: the ClassWizard will add member initialization here @@ -213,7 +213,7 @@ void BuildList::OnMoveUp() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } Int newSel = m_curBuildList-1; pSide->reorderInBuildList(pBuildInfo, newSel); @@ -245,9 +245,9 @@ void BuildList::OnMoveDown() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } - if (pBuildInfo->getNext() == NULL) { + if (pBuildInfo->getNext() == nullptr) { // there isn't one to move down after. return; } @@ -336,16 +336,16 @@ void BuildList::OnSelchangeBuildList() m_curBuildList = pList->GetCurSel(); Int numBL = pList->GetCount(); - SidesInfo *pSide = NULL; + SidesInfo *pSide = nullptr; if (TheSidesList) { pSide = TheSidesList->getSideInfo(m_curSide); } Int count = m_curBuildList; - BuildListInfo *pBuildInfo = NULL; + BuildListInfo *pBuildInfo = nullptr; if (pSide) { pBuildInfo = pSide->getBuildList(); } - if (count<0) pBuildInfo = NULL; + if (count<0) pBuildInfo = nullptr; while (count && pBuildInfo) { count--; pBuildInfo = pBuildInfo->getNext(); @@ -373,7 +373,7 @@ void BuildList::OnSelchangeBuildList() Bool exists; AsciiString objectTeamName = d->getAsciiString(TheKey_originalOwner, &exists); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(objectTeamName); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):AsciiString::TheEmptyString; Int energy = 0; @@ -390,7 +390,7 @@ void BuildList::OnSelchangeBuildList() { count = m_curBuildList; BuildListInfo *pBuildInfo = pSide->getBuildList(); - if (count<0) pBuildInfo = NULL; + if (count<0) pBuildInfo = nullptr; while (count>=0 && pBuildInfo) { AsciiString tName = pBuildInfo->getTemplateName(); const ThingTemplate *templ = TheThingFactory->findTemplate(tName); @@ -427,7 +427,7 @@ void BuildList::OnSelchangeBuildList() progressWnd->SetPos((Int)((1.0f-energyUsed)*100)); } - if (pBuildInfo==NULL) { + if (pBuildInfo==nullptr) { enableAttrs = false; } if (m_curBuildList > 0) { @@ -465,7 +465,7 @@ void BuildList::OnSelchangeBuildList() CButton *pBtn = (CButton *)GetDlgItem(IDC_ALREADY_BUILD); if (pBtn) pBtn->SetCheck(pBuildInfo->isInitiallyBuilt()?1:0); CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; UnsignedInt nr = pBuildInfo->getNumRebuilds(); if (nr == BuildListInfo::UNLIMITED_REBUILDS) { pCombo->SetCurSel(6); @@ -496,7 +496,7 @@ void BuildList::OnAlreadyBuild() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } CButton *pBtn = (CButton *)GetDlgItem(IDC_ALREADY_BUILD); if (pBtn) { @@ -522,7 +522,7 @@ void BuildList::OnDeleteBuilding() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pSide->removeFromBuildList(pBuildInfo); @@ -539,7 +539,7 @@ void BuildList::OnDeleteBuilding() void BuildList::OnSelendokRebuilds() { CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; Int sel = pCombo->GetCurSel(); if (sel<0) return; // no selection. UnsignedInt nr; @@ -555,7 +555,7 @@ void BuildList::OnSelendokRebuilds() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setNumRebuilds(nr); } @@ -563,7 +563,7 @@ void BuildList::OnSelendokRebuilds() void BuildList::OnEditchangeRebuilds() { CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_REBUILDS); - if (pCombo==NULL) return; + if (pCombo==nullptr) return; Int sel = pCombo->GetCurSel(); if (sel>=0) return; // An entry is selected, and handled by OnSelendokRebuilds.. char buffer[_MAX_PATH]; @@ -579,7 +579,7 @@ void BuildList::OnEditchangeRebuilds() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setNumRebuilds(nr); } @@ -596,7 +596,7 @@ void BuildList::OnDblclkBuildList() while (count) { count--; pBI = pBI->getNext(); - if (pBI == NULL) return; + if (pBI == nullptr) return; } BaseBuildProps dlg; @@ -697,7 +697,7 @@ void BuildList::OnChangeZOffset() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } Coord3D loc = *pBuildInfo->getLocation(); loc.z = m_height; @@ -725,7 +725,7 @@ void BuildList::OnChangeAngle() while (count) { count--; pBuildInfo = pBuildInfo->getNext(); - if (pBuildInfo == NULL) return; + if (pBuildInfo == nullptr) return; } pBuildInfo->setAngle(m_angle * PI/180); WbView3d *p3View = CWorldBuilderDoc::GetActiveDoc()->GetActive3DView(); @@ -734,11 +734,11 @@ void BuildList::OnChangeAngle() void BuildList::OnExport() { - static FILE *theLogFile = NULL; + static FILE *theLogFile = nullptr; Bool open = false; try { char buffer[_MAX_PATH]; - ::GetModuleFileName(NULL, buffer, sizeof(buffer)); + ::GetModuleFileName(nullptr, buffer, sizeof(buffer)); if (char* pEnd = strrchr(buffer, '\\')) { *(pEnd + 1) = 0; @@ -751,12 +751,12 @@ void BuildList::OnExport() strlcat(buffer, "_BuildList.ini", ARRAY_SIZE(buffer)); theLogFile = fopen(buffer, "w"); - if (theLogFile == NULL) + if (theLogFile == nullptr) throw; AsciiString tmplname = d->getAsciiString(TheKey_playerFaction); const PlayerTemplate* pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(tmplname)); - DEBUG_ASSERTCRASH(pt != NULL, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); + DEBUG_ASSERTCRASH(pt != nullptr, ("PlayerTemplate %s not found -- this is an obsolete map (please open and resave in WB)",tmplname.str())); fprintf(theLogFile, ";Skirmish AI Build List\n"); fprintf(theLogFile, "SkirmishBuildList %s\n", pt->getSide().str()); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildListTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildListTool.cpp index 77e054a11fe..5965a0217d5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BuildListTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BuildListTool.cpp @@ -40,17 +40,17 @@ // Bool BuildListTool::m_isActive = false; -PickUnitDialog* BuildListTool::m_static_pickBuildingDlg = NULL; +PickUnitDialog* BuildListTool::m_static_pickBuildingDlg = nullptr; /// Constructor BuildListTool::BuildListTool(void) : Tool(ID_BUILD_LIST_TOOL, IDC_BUILD_LIST_TOOL), - m_rotateCursor(NULL), - m_pointerCursor(NULL), - m_moveCursor(NULL), + m_rotateCursor(nullptr), + m_pointerCursor(nullptr), + m_moveCursor(nullptr), m_created(false) { - m_curObject = NULL; + m_curObject = nullptr; } /// Destructor @@ -68,7 +68,7 @@ void BuildListTool::createWindow(void) m_pickBuildingDlg.SetFactionOnly(true); m_pickBuildingDlg.Create(IDD_PICKUNIT, CMainFrame::GetMainFrame()); m_pickBuildingDlg.SetupAsPanel(); - m_pickBuildingDlg.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_pickBuildingDlg.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_static_pickBuildingDlg = &m_pickBuildingDlg; m_created = true; } @@ -111,7 +111,7 @@ void BuildListTool::activate() if (!wasActive) { p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } if (!m_created) { createWindow(); @@ -126,9 +126,9 @@ void BuildListTool::deactivate() WbView3d *p3View = CWorldBuilderDoc::GetActive3DView(); Coord3D loc; loc.x=loc.y=loc.z=0; - p3View->setObjTracking(NULL, loc, 0, false); // Turn off object cursor tracking. + p3View->setObjTracking(nullptr, loc, 0, false); // Turn off object cursor tracking. p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); m_pickBuildingDlg.ShowWindow(SW_HIDE); } @@ -138,17 +138,17 @@ void BuildListTool::setCursor(void) if (isDoingAdd()) { Tool::setCursor(); // Default cursor is the adding cursor } else if (m_mouseUpMove) { - if (m_moveCursor == NULL) { + if (m_moveCursor == nullptr) { m_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_MOVE)); } ::SetCursor(m_moveCursor); } else if (m_mouseUpRotate) { - if (m_rotateCursor == NULL) { + if (m_rotateCursor == nullptr) { m_rotateCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_ROTATE)); } ::SetCursor(m_rotateCursor); } else { - if (m_pointerCursor == NULL) { + if (m_pointerCursor == nullptr) { m_pointerCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_BUILD_POINTER)); } ::SetCursor(m_pointerCursor); @@ -202,11 +202,11 @@ void BuildListTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CW p3View->setObjTracking(pCur, loc, 0, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, 0, false); + p3View->setObjTracking(nullptr, loc, 0, false); } return; } - p3View->setObjTracking(NULL, cpt, 0, false); + p3View->setObjTracking(nullptr, cpt, 0, false); if (m == TRACK_NONE) { // See if the cursor is over an object. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index 406793275f5..de89b87293c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -57,7 +57,7 @@ Undoable::~Undoable(void) /// Create a new undoable. // Undoable::Undoable(void): - mNext(NULL) + mNext(nullptr) { } @@ -90,7 +90,7 @@ WBDocUndoable::~WBDocUndoable(void) { REF_PTR_RELEASE(mPNewHeightMapData); REF_PTR_RELEASE(mPOldHeightMapData); - mPDoc = NULL; // not ref counted. + mPDoc = nullptr; // not ref counted. } @@ -98,9 +98,9 @@ WBDocUndoable::~WBDocUndoable(void) /// Create a new undoable. // WBDocUndoable::WBDocUndoable(CWorldBuilderDoc *pDoc, WorldHeightMapEdit *pNewHtMap, Coord3D *pObjOffset): - mPNewHeightMapData(NULL), - mPOldHeightMapData(NULL), - mPDoc(NULL) + mPNewHeightMapData(nullptr), + mPOldHeightMapData(nullptr), + mPDoc(nullptr) { if (pObjOffset) { m_offsetObjects = true; @@ -143,7 +143,7 @@ void WBDocUndoable::Do(void) pBuild->setLocation(loc); } } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPNewHeightMapData->dbgVerifyAfterUndo(); } @@ -168,7 +168,7 @@ void WBDocUndoable::Redo(void) pCur->setLocation(&loc); pCur = pCur->getNext(); } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPNewHeightMapData->dbgVerifyAfterUndo(); } @@ -193,7 +193,7 @@ void WBDocUndoable::Undo(void) pCur->setLocation(&loc); pCur = pCur->getNext(); } - mPDoc->invalObject(NULL); // Inval all objects. + mPDoc->invalObject(nullptr); // Inval all objects. } mPOldHeightMapData->dbgVerifyAfterUndo(); } @@ -206,10 +206,10 @@ void WBDocUndoable::Undo(void) // AddObjectUndoable::~AddObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. if (!m_addedToList) { deleteInstance(m_objectToAdd); - m_objectToAdd=NULL; + m_objectToAdd=nullptr; } } @@ -218,10 +218,10 @@ AddObjectUndoable::~AddObjectUndoable(void) // AddObjectUndoable - create a new undoable. // AddObjectUndoable::AddObjectUndoable(CWorldBuilderDoc *pDoc, MapObject *pObjectToAdd): - m_pDoc(NULL), + m_pDoc(nullptr), m_numObjects(0), m_addedToList(false), - m_objectToAdd(NULL) + m_objectToAdd(nullptr) { m_pDoc = pDoc; // not ref counted. m_objectToAdd = pObjectToAdd; @@ -234,7 +234,7 @@ void AddObjectUndoable::Do(void) { // WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); MapObject *pCur = m_objectToAdd; - MapObject *pLast = NULL; + MapObject *pLast = nullptr; // Clear selection. PointerTool::clearSelection(); @@ -248,7 +248,7 @@ void AddObjectUndoable::Do(void) m_numObjects++; pCur = pCur->getNext(); } - if (pLast==NULL) { + if (pLast==nullptr) { return; } pLast->setNextMap(MapObject::getFirstMapObject()); @@ -307,7 +307,7 @@ void AddObjectUndoable::Undo(void) } if ((m_numObjects == 1) && pCur) { MapObject::TheMapObjectListPtr = pCur->getNext(); - pCur->setNextMap(NULL); + pCur->setNextMap(nullptr); m_addedToList = false; } pCur = m_objectToAdd; @@ -325,19 +325,19 @@ void AddObjectUndoable::Undo(void) ***************************************************************************/ MoveInfo::~MoveInfo(void) { - m_objectToModify=NULL; // The map info list owns these, don't delete. + m_objectToModify=nullptr; // The map info list owns these, don't delete. MoveInfo *pCur = m_next; MoveInfo *tmp; while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } } MoveInfo::MoveInfo( MapObject *pObjToMove): - m_next(NULL) + m_next(nullptr) { m_objectToModify = pObjToMove; // Not copied. m_newAngle = m_objectToModify->getAngle(); @@ -434,28 +434,28 @@ void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc) // ModifyObjectUndoable::~ModifyObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. if (m_moveList) { delete m_moveList; } - m_moveList = NULL; + m_moveList = nullptr; } // // ModifyObjectUndoable - create a new undoable. // ModifyObjectUndoable::ModifyObjectUndoable(CWorldBuilderDoc *pDoc): - m_pDoc(NULL), - m_moveList(NULL), + m_pDoc(nullptr), + m_moveList(nullptr), m_inval(false) { m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - MoveInfo *pCurInfo = NULL; + MoveInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { MoveInfo *pNew = new MoveInfo(curMapObj); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_moveList = pNew; } else { pCurInfo->m_next = pNew; @@ -513,7 +513,7 @@ void ModifyObjectUndoable::SetThingTemplate(const ThingTemplate* thing) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -529,7 +529,7 @@ void ModifyObjectUndoable::SetName(AsciiString name) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -555,7 +555,7 @@ void ModifyObjectUndoable::Redo(void) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -573,7 +573,7 @@ void ModifyObjectUndoable::Undo(void) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -582,19 +582,19 @@ void ModifyObjectUndoable::Undo(void) ***************************************************************************/ FlagsInfo::~FlagsInfo(void) { - m_objectToModify=NULL; // The map info list owns these, don't delete. + m_objectToModify=nullptr; // The map info list owns these, don't delete. FlagsInfo *pCur = m_next; FlagsInfo *tmp; while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } } FlagsInfo::FlagsInfo( MapObject *pObjToMove, Int flagMask, Int flagValue): - m_next(NULL) + m_next(nullptr) { m_objectToModify = pObjToMove; // Not copied. m_flagMask = flagMask; @@ -648,26 +648,26 @@ void FlagsInfo::UndoFlags(CWorldBuilderDoc *pDoc) // ModifyFlagsUndoable::~ModifyFlagsUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. delete m_flagsList; - m_flagsList = NULL; + m_flagsList = nullptr; } // // ModifyFlagsUndoable - create a new undoable. // ModifyFlagsUndoable::ModifyFlagsUndoable(CWorldBuilderDoc *pDoc, Int flagMask, Int flagValue): - m_pDoc(NULL), - m_flagsList(NULL) + m_pDoc(nullptr), + m_flagsList(nullptr) { m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - FlagsInfo *pCurInfo = NULL; + FlagsInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { FlagsInfo *pNew = new FlagsInfo(curMapObj, flagMask, flagValue); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_flagsList = pNew; } else { pCurInfo->m_next = pNew; @@ -739,7 +739,7 @@ void SidesListUndoable::Do(void) BuildList::update(); WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } void SidesListUndoable::Undo(void) @@ -751,7 +751,7 @@ void SidesListUndoable::Undo(void) BuildList::update(); WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } /************************************************************************* @@ -798,7 +798,7 @@ void DictItemUndoable::Do(void) if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -815,7 +815,7 @@ void DictItemUndoable::Undo(void) if (m_inval && m_pDoc) { WbView3d *p3View = m_pDoc->GetActive3DView(); p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } } @@ -864,18 +864,18 @@ DeleteInfo::~DeleteInfo(void) while (pCur) { tmp = pCur; pCur = tmp->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; delete tmp; } - m_objectToDelete=NULL; - m_priorObject=NULL; + m_objectToDelete=nullptr; + m_priorObject=nullptr; } DeleteInfo::DeleteInfo( MapObject *pObjectToDelete): - m_objectToDelete(NULL), + m_objectToDelete(nullptr), m_didDelete(false), - m_next(NULL), - m_priorObject(NULL) + m_next(nullptr), + m_priorObject(nullptr) { m_objectToDelete = pObjectToDelete; // Not copied. } @@ -886,7 +886,7 @@ DeleteInfo::DeleteInfo( MapObject *pObjectToDelete): void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) { DEBUG_ASSERTCRASH(!m_didDelete,("oops")); - m_priorObject = NULL; + m_priorObject = nullptr; MapObject *curMapObj = MapObject::getFirstMapObject(); Bool found = false; while (curMapObj) { @@ -899,7 +899,7 @@ void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) } DEBUG_ASSERTCRASH(found,("not found")); if (!found) { - m_objectToDelete = NULL; + m_objectToDelete = nullptr; return; } if (m_priorObject) { @@ -908,7 +908,7 @@ void DeleteInfo::DoDelete(WorldHeightMapEdit *pMap) DEBUG_ASSERTCRASH(MapObject::TheMapObjectListPtr == m_objectToDelete,("oops")); MapObject::TheMapObjectListPtr = MapObject::TheMapObjectListPtr->getNext(); } - m_objectToDelete->setNextMap(NULL); + m_objectToDelete->setNextMap(nullptr); m_didDelete = true; } @@ -919,7 +919,7 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) if (m_priorObject) { m_objectToDelete->setNextMap(m_priorObject->getNext()); m_priorObject->setNextMap(m_objectToDelete); - m_priorObject = NULL; + m_priorObject = nullptr; } else { m_objectToDelete->setNextMap(MapObject::TheMapObjectListPtr); MapObject::TheMapObjectListPtr = m_objectToDelete; @@ -935,10 +935,10 @@ void DeleteInfo::UndoDelete(WorldHeightMapEdit *pMap) // DeleteObjectUndoable::~DeleteObjectUndoable(void) { - m_pDoc = NULL; // not ref counted. + m_pDoc = nullptr; // not ref counted. delete m_deleteList; - m_deleteList=NULL; + m_deleteList=nullptr; } @@ -946,8 +946,8 @@ DeleteObjectUndoable::~DeleteObjectUndoable(void) // DeleteObjectUndoable - create a new undoable. Deletes all selected objects. // DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): - m_pDoc(NULL), - m_deleteList(NULL) + m_pDoc(nullptr), + m_deleteList(nullptr) { // Note - you can't delete just one end of a map segment. So delete both. MapObject *pMapObj; @@ -956,7 +956,7 @@ DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); DEBUG_ASSERTCRASH(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("oops")); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; // If one end of a road segment is selected, both are. if (pMapObj->isSelected() || pMapObj2->isSelected()) { @@ -969,11 +969,11 @@ DeleteObjectUndoable::DeleteObjectUndoable(CWorldBuilderDoc *pDoc): m_pDoc = pDoc; // not ref counted. MapObject *curMapObj = MapObject::getFirstMapObject(); - DeleteInfo *pCurInfo = NULL; + DeleteInfo *pCurInfo = nullptr; while (curMapObj) { if (curMapObj->isSelected()) { DeleteInfo *pNew = new DeleteInfo(curMapObj); - if (pCurInfo == NULL) { + if (pCurInfo == nullptr) { m_deleteList = pNew; } else { pCurInfo->m_next = pNew; @@ -992,7 +992,7 @@ void DeleteObjectUndoable::Do(void) { WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); DeleteInfo *pCur = m_deleteList; - DeleteInfo *pInvertedList = NULL; + DeleteInfo *pInvertedList = nullptr; while (pCur) { // first, remove it from the Layers list. TheLayersList->removeMapObjectFromLayersList(pCur->m_objectToDelete); @@ -1007,7 +1007,7 @@ void DeleteObjectUndoable::Do(void) WbView3d *p3View = m_pDoc->GetActive3DView(); if (p3View) { // Shouldn't ever be null, but just in case... jba. p3View->resetRenderObjects(); - p3View->invalObjectInView(NULL); + p3View->invalObjectInView(nullptr); } m_deleteList = pInvertedList; } @@ -1019,7 +1019,7 @@ void DeleteObjectUndoable::Undo(void) { WorldHeightMapEdit *pMap = m_pDoc->GetHeightMap(); DeleteInfo *pCur = m_deleteList; - DeleteInfo *pInvertedList=NULL; + DeleteInfo *pInvertedList=nullptr; while (pCur) { // Re-Add it to the layers list Dict* objDict = pCur->m_objectToDelete->getProperties(); @@ -1047,10 +1047,10 @@ void DeleteObjectUndoable::Undo(void) AddPolygonUndoable::~AddPolygonUndoable(void) { if (m_trigger && !m_isTriggerInList) { - DEBUG_ASSERTCRASH(m_trigger->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(m_trigger->getNext()==nullptr, ("Logic error.")); deleteInstance(m_trigger); } - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1093,7 +1093,7 @@ void AddPolygonUndoable::Undo(void) // AddPolygonPointUndoable::~AddPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1132,7 +1132,7 @@ void AddPolygonPointUndoable::Undo(void) // ModifyPolygonPointUndoable::~ModifyPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1171,7 +1171,7 @@ void ModifyPolygonPointUndoable::Undo(void) // MovePolygonUndoable::~MovePolygonUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1244,7 +1244,7 @@ void MovePolygonUndoable::Undo(void) // InsertPolygonPointUndoable::~InsertPolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1281,7 +1281,7 @@ void InsertPolygonPointUndoable::Undo(void) // DeletePolygonPointUndoable::~DeletePolygonPointUndoable(void) { - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1319,10 +1319,10 @@ void DeletePolygonPointUndoable::Undo(void) DeletePolygonUndoable::~DeletePolygonUndoable(void) { if (m_trigger && !m_isTriggerInList) { - DEBUG_ASSERTCRASH(m_trigger->getNext()==NULL, ("Logic error.")); + DEBUG_ASSERTCRASH(m_trigger->getNext()==nullptr, ("Logic error.")); deleteInstance(m_trigger); } - m_trigger=NULL; + m_trigger=nullptr; } // @@ -1363,7 +1363,7 @@ void DeletePolygonUndoable::Undo(void) // MultipleUndoable - constructor. // MultipleUndoable::MultipleUndoable(void) - : m_undoableList( NULL ) + : m_undoableList( nullptr ) { } @@ -1396,7 +1396,7 @@ void MultipleUndoable::Do(void) { Undoable * undoable = m_undoableList; - while ( undoable != NULL ) + while ( undoable != nullptr ) { Undoable * next = undoable->GetNext(); undoable->Do(); @@ -1410,7 +1410,7 @@ void MultipleUndoable::Do(void) // static void undoHelper(Undoable * undoable) { - if ( undoable == NULL ) + if ( undoable == nullptr ) return; undoHelper( undoable->GetNext() ); @@ -1435,7 +1435,7 @@ void MultipleUndoable::Redo(void) { Undoable * undoable = m_undoableList; - while ( undoable != NULL ) + while ( undoable != nullptr ) { Undoable * next = undoable->GetNext(); undoable->Redo(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp index 9a5e47225c9..039ee5c71a9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -19,6 +19,7 @@ // CameraOptions.cpp : implementation file // + #include "StdAfx.h" #include "resource.h" #include "WorldBuilder.h" @@ -34,7 +35,7 @@ // CameraOptions dialog -CameraOptions::CameraOptions(CWnd* pParent /*=NULL*/) +CameraOptions::CameraOptions(CWnd* pParent /*=nullptr*/) : CDialog(CameraOptions::IDD, pParent) { m_updating = false; @@ -94,8 +95,8 @@ void CameraOptions::OnDropWaypointButton() // // MBL CNC3 INCURSION 10.29.2002 - Fix compile error w/ 10-15-2002 Drop // - // MapObject *pNew = new MapObject(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); - MapObject *pNew = newInstance(MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); + // MapObject *pNew = new MapObject(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); + MapObject *pNew = newInstance(MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); Int id = pDoc->getNextWaypointID(); AsciiString name = WaypointOptions::GenerateUniqueName(id); @@ -107,7 +108,7 @@ void CameraOptions::OnDropWaypointButton() AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. } //WST 11/25/2002 - New Center Camera button for Designers ----------- diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CellWidth.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CellWidth.cpp index 07aded667ca..35277afd30b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CellWidth.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CellWidth.cpp @@ -27,7 +27,7 @@ // CellWidth dialog /// Constructor and set initial cell width. -CellWidth::CellWidth(int cellWidth, CWnd* pParent /*=NULL*/) +CellWidth::CellWidth(int cellWidth, CWnd* pParent /*=nullptr*/) : CDialog(CellWidth::IDD, pParent), mCellWidth(cellWidth) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp index dba345f5082..a93020a5c1f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp @@ -33,7 +33,7 @@ Int ContourOptions::m_contourWidth = 1; /// ContourOptions dialog trivial construstor - Create does the real work. -ContourOptions::ContourOptions(CWnd* pParent /*=NULL*/) +ContourOptions::ContourOptions(CWnd* pParent /*=nullptr*/) : CDialog(ContourOptions::IDD, pParent) { //{{AFX_DATA_INIT(ContourOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index b5b794ba003..6d96e26c0bc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -135,29 +135,29 @@ DrawObject::~DrawObject(void) { freeMapResources(); REF_PTR_RELEASE(m_waterDrawObject); - TheWaterRenderObj = NULL; + TheWaterRenderObj = nullptr; } DrawObject::DrawObject(void) : m_drawObjects(true), m_drawPolygonAreas(true), - m_indexBuffer(NULL), - m_vertexMaterialClass(NULL), - m_vertexBufferTile1(NULL), - m_vertexBufferTile2(NULL), - m_vertexBufferWater(NULL), - m_vertexFeedback(NULL), - m_indexFeedback(NULL), - m_indexWater(NULL), - m_moldMesh(NULL), - m_lineRenderer(NULL), + m_indexBuffer(nullptr), + m_vertexMaterialClass(nullptr), + m_vertexBufferTile1(nullptr), + m_vertexBufferTile2(nullptr), + m_vertexBufferWater(nullptr), + m_vertexFeedback(nullptr), + m_indexFeedback(nullptr), + m_indexWater(nullptr), + m_moldMesh(nullptr), + m_lineRenderer(nullptr), m_drawSoundRanges(false) { m_feedbackPoint.x = 20; m_feedbackPoint.y = 20; initData(); m_waterDrawObject = new WaterRenderObjClass; - m_waterDrawObject->init(0, 0, 0, NULL, WaterRenderObjClass::WATER_TYPE_0_TRANSLUCENT); + m_waterDrawObject->init(0, 0, 0, nullptr, WaterRenderObjClass::WATER_TYPE_0_TRANSLUCENT); TheWaterRenderObj=m_waterDrawObject; //(gth) this was needed to fix the extents bug that is based off water and too small for our maps @@ -230,7 +230,7 @@ Int DrawObject::freeMapResources(void) REF_PTR_RELEASE(m_moldMesh); delete m_lineRenderer; - m_lineRenderer = NULL; + m_lineRenderer = nullptr; return 0; } @@ -297,11 +297,11 @@ void DrawObject::updateMeshVB(void) REF_PTR_RELEASE(m_moldMesh); m_curMeshModelName = MeshMoldOptions::getModelName(); } - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); pMgr->Set_WW3D_Load_On_Demand(false); // We don't want it fishing for these assets in the game assets. m_moldMesh = (MeshClass*)pMgr->Create_Render_Obj(m_curMeshModelName.str()); - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { // Try loading the mold asset. AsciiString path("data\\editor\\molds\\"); path.concat(m_curMeshModelName); @@ -314,7 +314,7 @@ void DrawObject::updateMeshVB(void) } pMgr->Set_WW3D_Load_On_Demand(true); } - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { return; } @@ -329,7 +329,7 @@ void DrawObject::updateMeshVB(void) VertexFormatXYZDUV1 *vb = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array(); VertexFormatXYZDUV1 *curVb = vb; - if (m_moldMesh == NULL) { + if (m_moldMesh == nullptr) { return; } Int i; @@ -369,7 +369,7 @@ void DrawObject::updateMeshVB(void) #if 1 curVb->diffuse = 0x0000ffff | (theAlpha << 24); // bright cyan. #else - TheTerrainRenderObject->doTheLight(&vb, &lightRay, (Vector3 *)(&pNormal[i]), NULL, 1.0f); + TheTerrainRenderObject->doTheLight(&vb, &lightRay, (Vector3 *)(&pNormal[i]), nullptr, 1.0f); vb.diffuse &= 0x0000ffff; curVb->diffuse = vb.diffuse | (theAlpha << 24); #endif @@ -592,33 +592,33 @@ void DrawObject::updateBoundaryVB(void) startPt.x = startPt.y = 0; startPt.x *= MAP_XY_FACTOR; startPt.y *= MAP_XY_FACTOR; - startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, NULL); + startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, nullptr); endPt.x = 0; endPt.y = curBoundary.y; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 1) { startPt = endPt; endPt.x = curBoundary.x; endPt.y = curBoundary.y; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 2) { startPt = endPt; endPt.x = curBoundary.x; endPt.y = 0; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } else if (j == 3) { startPt = endPt; endPt.x = 0; endPt.y = 0; endPt.x *= MAP_XY_FACTOR; endPt.y *= MAP_XY_FACTOR; - endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, NULL); + endPt.z = TheTerrainRenderObject->getHeightMapHeight(endPt.x, endPt.y, nullptr); } if (m_feedbackVertexCount + 8 > NUM_FEEDBACK_VERTEX) { @@ -758,7 +758,7 @@ void DrawObject::updateAmbientSoundVB(void) } Coord3D startPt = *mo->getLocation(); - startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, NULL); + startPt.z = TheTerrainRenderObject->getHeightMapHeight(startPt.x, startPt.y, nullptr); if (m_feedbackVertexCount + 6 > NUM_FEEDBACK_VERTEX) { return; @@ -918,8 +918,8 @@ void DrawObject::updateWaypointVB(void) normal *= 0.5f; // Rotate the normal 90 degrees. normal.Rotate_Z(PI/2); - loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, NULL); - loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, NULL); + loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, nullptr); + loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, nullptr); if (m_feedbackVertexCount+9>= NUM_FEEDBACK_VERTEX) { return; @@ -1104,7 +1104,7 @@ void DrawObject::updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOp ICoord3D iLoc = *pTrig->getPoint(i); loc1.x = iLoc.x; loc1.y = iLoc.y; - loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, NULL); + loc1.z = TheTerrainRenderObject->getHeightMapHeight(loc1.x, loc1.y, nullptr); if (igetNumPoints()-1) { iLoc = *pTrig->getPoint(i+1); } else { @@ -1113,7 +1113,7 @@ void DrawObject::updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOp } loc2.x = iLoc.x; loc2.y = iLoc.y; - loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, NULL); + loc2.z = TheTerrainRenderObject->getHeightMapHeight(loc2.x, loc2.y, nullptr); Vector3 normal(loc2.x-loc1.x, loc2.y-loc1.y, loc2.z-loc1.z); normal.Normalize(); normal *= 0.5f; @@ -1247,11 +1247,11 @@ void DrawObject::updateFeedbackVB(void) if (doubleResolution) { X = ADJUST_FROM_INDEX_TO_REAL(i)/2.0f + ADJUST_FROM_INDEX_TO_REAL(2*offset+m_cellCenter.x) / 2.0; Y = ADJUST_FROM_INDEX_TO_REAL(j)/2.0f + ADJUST_FROM_INDEX_TO_REAL(2*offset+m_cellCenter.y) / 2.0; - theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, NULL); + theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, nullptr); } else { X = ADJUST_FROM_INDEX_TO_REAL(i); Y = ADJUST_FROM_INDEX_TO_REAL(j); - theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, NULL); + theZ = TheTerrainRenderObject->getHeightMapHeight(X, Y, nullptr); } curVb->u1 = 0; curVb->v1 = 0; @@ -1621,7 +1621,7 @@ void DrawObject::updateVBWithBoundingBox(MapObject *pMapObj, CameraClass* camera Coord3D pos = *pMapObj->getLocation(); if (TheTerrainRenderObject) { // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } switch (ginfo.getGeomType()) @@ -1766,7 +1766,7 @@ void DrawObject::updateVBWithSightRange(MapObject *pMapObj, CameraClass* camera) Coord3D pos = *pMapObj->getLocation(); if (TheTerrainRenderObject) { // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } addCircleToLineRenderer(pos, radius, SIGHT_RANGE_LINE_WIDTH, color, camera ); @@ -1787,7 +1787,7 @@ void DrawObject::updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera Coord3D pos = *pMapObj->getLocation(); if (TheTerrainRenderObject) { // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } const WeaponTemplateSetVector& weapons = pMapObj->getThingTemplate()->getWeaponTemplateSets(); @@ -1800,7 +1800,7 @@ void DrawObject::updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera for (int i = 0; i < WEAPONSLOT_COUNT; i++) { const WeaponTemplate* tmpl = it->getNth((WeaponSlotType)i); - if (tmpl == NULL) { + if (tmpl == nullptr) { continue; } @@ -1827,11 +1827,11 @@ void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera Coord3D pos = *pMapObj->getLocation(); if (TheTerrainRenderObject) { // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } // Does this object actually have an attached sound? - const AudioEventInfo * audioInfo = NULL; + const AudioEventInfo * audioInfo = nullptr; Dict * properties = pMapObj->getProperties(); @@ -1847,15 +1847,15 @@ void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera } else { - if ( TheAudio == NULL ) + if ( TheAudio == nullptr ) { - DEBUG_CRASH( ("TheAudio is NULL! Can't draw sound circles") ); + DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); return; } audioInfo = TheAudio->findAudioEventInfo( ambientName ); - if ( audioInfo == NULL ) + if ( audioInfo == nullptr ) { DEBUG_CRASH( ("Override audio named %s is missing; Can't draw sound circles", ambientName.str() ) ); return; @@ -1865,7 +1865,7 @@ void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera else { const ThingTemplate * thingTemplate = pMapObj->getThingTemplate(); - if ( thingTemplate == NULL ) + if ( thingTemplate == nullptr ) { // No sound if no template return; @@ -1878,25 +1878,25 @@ void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera const AudioEventRTS * event = thingTemplate->getSoundAmbient(); - if ( event == NULL ) + if ( event == nullptr ) { return; } audioInfo = event->getAudioEventInfo(); - if ( audioInfo == NULL ) + if ( audioInfo == nullptr ) { // May just not be set up yet - if ( TheAudio == NULL ) + if ( TheAudio == nullptr ) { - DEBUG_CRASH( ("TheAudio is NULL! Can't draw sound circles") ); + DEBUG_CRASH( ("TheAudio is null! Can't draw sound circles") ); return; } audioInfo = TheAudio->findAudioEventInfo( event->getEventName() ); - if ( audioInfo == NULL ) + if ( audioInfo == nullptr ) { DEBUG_CRASH( ("Default ambient sound %s has no info; Can't draw sound circles", event->getEventName().str() ) ); return; @@ -1905,8 +1905,8 @@ void DrawObject::updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera } // Should have set up audioInfo or returned by now - DEBUG_ASSERTCRASH( audioInfo != NULL, ("Managed to finish setting up audio info without setting it?!?" ) ); - if ( audioInfo == NULL ) + DEBUG_ASSERTCRASH( audioInfo != nullptr, ("Managed to finish setting up audio info without setting it?!?" ) ); + if ( audioInfo == nullptr ) { return; } @@ -1951,7 +1951,7 @@ void DrawObject::updateVBWithTestArtHighlight(MapObject *pMapObj, CameraClass* c Coord3D pos = *pMapObj->getLocation(); if (TheTerrainRenderObject) { // Make sure that the position is on the terrain. - pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += TheTerrainRenderObject->getHeightMapHeight(pos.x, pos.y, nullptr); } Real angle, inc = PI/2.0f; @@ -1990,7 +1990,7 @@ void DrawObject::updateVBWithTestArtHighlight(MapObject *pMapObj, CameraClass* c bool DrawObject::worldToScreen(const Coord3D *w, ICoord2D *s, CameraClass* camera) { - if ((w == NULL) || (s == NULL) || (camera == NULL)) { + if ((w == nullptr) || (s == nullptr) || (camera == nullptr)) { return false; } @@ -2042,7 +2042,7 @@ void DrawObject::setFeedbackPos(Coord3D pos) void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, Real rampWidth) { - DEBUG_ASSERTCRASH(start && end, ("Parameter passed into setRampFeedbackParms was NULL. Not allowed")); + DEBUG_ASSERTCRASH(start && end, ("Parameter passed into setRampFeedbackParms was null. Not allowed")); if (!(start && end)) { return; } @@ -2064,7 +2064,7 @@ if (_skip_drawobject_render) { return; } - if (m_lineRenderer == NULL) { + if (m_lineRenderer == nullptr) { // This can't be created in init because the doc hasn't been created yet. m_lineRenderer = new Render2DClass(); ASSERT(m_lineRenderer); @@ -2082,7 +2082,7 @@ if (_skip_drawobject_render) { DX8Wrapper::Set_Material(m_vertexMaterialClass); DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, NULL); + DX8Wrapper::Set_Texture(0, nullptr); DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); DX8Wrapper::Apply_Render_State_Changes(); Int count=0; @@ -2116,7 +2116,7 @@ if (pMapObj->isSelected()) { } Coord3D loc = *pMapObj->getLocation(); if (TheTerrainRenderObject) { - loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); } // Cull. //SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); @@ -2242,7 +2242,7 @@ if (pMapObj->isSelected()) { Coord3D loc; loc.x = iLoc.x; loc.y = iLoc.y; - loc.z = TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z = TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); if (rinfo.Camera.Cull_Sphere(bounds)) { continue; @@ -2297,7 +2297,7 @@ if (pMapObj->isSelected()) { for (BuildListInfo *pBuild = pSide->getBuildList(); pBuild; pBuild = pBuild->getNext()) { Coord3D loc = *pBuild->getLocation(); if (TheTerrainRenderObject) { - loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += TheTerrainRenderObject->getHeightMapHeight(loc.x, loc.y, nullptr); } // Cull. SphereClass bounds(Vector3(loc.x, loc.y, loc.z), THE_RADIUS); @@ -2406,8 +2406,8 @@ if (pMapObj->isSelected()) { } #endif - DX8Wrapper::Set_Vertex_Buffer(NULL); //release reference to vertex buffer - DX8Wrapper::Set_Index_Buffer(NULL,0); //release reference to vertex buffer + DX8Wrapper::Set_Vertex_Buffer(nullptr); //release reference to vertex buffer + DX8Wrapper::Set_Index_Buffer(nullptr,0); //release reference to vertex buffer if (m_ambientSoundFeedback) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp index bae26db5dab..bf44491834d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp @@ -30,7 +30,7 @@ // EditAction dialog -EditAction::EditAction(CWnd* pParent /*=NULL*/) +EditAction::EditAction(CWnd* pParent /*=nullptr*/) : CDialog(EditAction::IDD, pParent) { //{{AFX_DATA_INIT(EditAction) @@ -62,7 +62,7 @@ static HTREEITEM findOrAdd(CTreeCtrl *tree, HTREEITEM parent, const char *pLabel char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = tree->GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -117,7 +117,7 @@ BOOL EditAction::OnInitDialog() m_myEditCtrl.SetEventMask(m_myEditCtrl.GetEventMask() | ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS); Int i; - HTREEITEM selItem = NULL; + HTREEITEM selItem = nullptr; for (i=0; igetActionTemplate(i); char prefix[_MAX_PATH]; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp index 6df3962f51b..85cd400fb28 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp @@ -41,7 +41,7 @@ LRESULT CMyTreeCtrl::WindowProc( UINT message, WPARAM wParam, LPARAM lParam ) // EditCondition dialog -EditCondition::EditCondition(CWnd* pParent /*=NULL*/) +EditCondition::EditCondition(CWnd* pParent /*=nullptr*/) : CDialog(EditCondition::IDD, pParent) { //{{AFX_DATA_INIT(EditCondition) @@ -74,7 +74,7 @@ static HTREEITEM findOrAdd(CTreeCtrl *tree, HTREEITEM parent, const char *pLabel char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = tree->GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -129,7 +129,7 @@ BOOL EditCondition::OnInitDialog() m_myEditCtrl.SetEventMask(m_myEditCtrl.GetEventMask() | ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS); Int i; - HTREEITEM selItem = NULL; + HTREEITEM selItem = nullptr; for (i=0; igetConditionTemplate(i); char prefix[_MAX_PATH]; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp index 7176f65ce43..67bdbd48039 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCoordParameter.cpp @@ -30,7 +30,7 @@ // EditCoordParameter dialog -EditCoordParameter::EditCoordParameter(CWnd* pParent /*=NULL*/) +EditCoordParameter::EditCoordParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditCoordParameter::IDD, pParent) { //{{AFX_DATA_INIT(EditCoordParameter) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditGroup.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditGroup.cpp index b0020a3f38d..eb422984a62 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditGroup.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditGroup.cpp @@ -28,7 +28,7 @@ // EditGroup dialog -EditGroup::EditGroup(ScriptGroup *pGroup, CWnd* pParent /*=NULL*/) +EditGroup::EditGroup(ScriptGroup *pGroup, CWnd* pParent /*=nullptr*/) : CDialog(EditGroup::IDD, pParent), m_scriptGroup(pGroup) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp index 4612838395e..4d319482548 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditObjectParameter.cpp @@ -38,7 +38,7 @@ // EditObjectParameter dialog -EditObjectParameter::EditObjectParameter(CWnd* pParent /*=NULL*/) +EditObjectParameter::EditObjectParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditObjectParameter::IDD, pParent) { //{{AFX_DATA_INIT(EditObjectParameter) @@ -119,7 +119,7 @@ void EditObjectParameter::addObject( const ThingTemplate *thingTemplate ) // first sort by Side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH(!side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH(!side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -176,7 +176,7 @@ void EditObjectParameter::addObjectLists( ) parent = findOrAdd(parent, "Object Lists"); std::vector strings; - EditParameter::loadObjectTypeList(NULL, &strings); + EditParameter::loadObjectTypeList(nullptr, &strings); Int numItems = strings.size(); @@ -209,7 +209,7 @@ HTREEITEM EditObjectParameter::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp index 94fb3dad935..1e9a6933c8e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -74,7 +74,7 @@ AsciiString EditParameter::m_selectedLocalizedString = AsciiString::TheEmptyString; AsciiString EditParameter::m_unitName = AsciiString::TheEmptyString; -EditParameter::EditParameter(CWnd* pParent /*=NULL*/) +EditParameter::EditParameter(CWnd* pParent /*=nullptr*/) : CDialog(EditParameter::IDD, pParent), m_int(0), m_real(0) @@ -103,7 +103,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // EditParameter message handlers -SidesList *EditParameter::m_sidesListP = NULL; +SidesList *EditParameter::m_sidesListP = nullptr; Int EditParameter::edit( Parameter *pParm, Int keyPressed, AsciiString unitName ) { @@ -167,13 +167,13 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) DEBUG_CRASH(("Unknown parameter type.")); break; case Parameter::SCRIPT: - if (!loadScripts(NULL, false, uiString)) { + if (!loadScripts(nullptr, false, uiString)) { warningText.format("Script '%s' does not exist.", uiString.str()); } break; case Parameter::SCRIPT_SUBROUTINE: - if (!loadScripts(NULL, true, uiString)) { - if (!loadScripts(NULL, false, uiString)) { + if (!loadScripts(nullptr, true, uiString)) { + if (!loadScripts(nullptr, false, uiString)) { warningText.format("Script '%s' does not exist.", uiString.str()); } else { warningText.format("Script '%s' is not a subroutine.", uiString.str()); @@ -181,32 +181,32 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) } break; case Parameter::ATTACK_PRIORITY_SET: - if (!loadAttackPrioritySets(NULL, uiString)) { + if (!loadAttackPrioritySets(nullptr, uiString)) { warningText.format("Attack priority set '%s' does not exist.", uiString.str()); } break; case Parameter::WAYPOINT: - if (!loadWaypoints(NULL, uiString)) { + if (!loadWaypoints(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::WAYPOINT_PATH: - if (!loadWaypointPaths(NULL, uiString)) { + if (!loadWaypointPaths(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::TRIGGER_AREA: - if (!loadTriggerAreas(NULL, uiString)) { + if (!loadTriggerAreas(nullptr, uiString)) { warningText.format("Waypoint '%s' does not exist.", uiString.str()); } break; case Parameter::COMMAND_BUTTON: - if (!loadCommandButtons(NULL, uiString)) { + if (!loadCommandButtons(nullptr, uiString)) { warningText.format("Command button '%s' does not exist.", uiString.str()); } break; case Parameter::FONT_NAME: - if(!loadFontNames(NULL, uiString)) { + if(!loadFontNames(nullptr, uiString)) { warningText.format("Font '%s' does not exist.", uiString.str()); } break; @@ -215,43 +215,43 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) case Parameter::TEXT_STRING: break; case Parameter::LOCALIZED_TEXT: - if (loadLocalizedText(NULL, uiString) == AsciiString::TheEmptyString) { + if (loadLocalizedText(nullptr, uiString) == AsciiString::TheEmptyString) { warningText.format("Localized string '%s' does not exist.", uiString.str()); } break; case Parameter::SOUND: - if (!loadAudioType(Parameter::SOUND, NULL, uiString)) { + if (!loadAudioType(Parameter::SOUND, nullptr, uiString)) { warningText.format("Sound '%s' does not exist.", uiString.str()); } break; case Parameter::TEAM: - if (!loadTeams(NULL, uiString)) { + if (!loadTeams(nullptr, uiString)) { warningText.format("Team '%s' does not exist.", uiString.str()); } break; case Parameter::BRIDGE: - if (!loadBridges(NULL, uiString)) { + if (!loadBridges(nullptr, uiString)) { warningText.format("Bridge '%s' does not exist.", uiString.str()); } break; case Parameter::UNIT: - if (!loadUnits(NULL, uiString)) { + if (!loadUnits(nullptr, uiString)) { warningText.format("Unit '%s' does not exist.", uiString.str()); } break; case Parameter::OBJECT_TYPE: - if (!loadObjectType(NULL, uiString)) { + if (!loadObjectType(nullptr, uiString)) { warningText.format("Object type '%s' does not exist.", uiString.str()); } break; case Parameter::SIDE: - if (!loadSides(NULL, uiString)) { + if (!loadSides(nullptr, uiString)) { warningText.format("Player '%s' does not exist.", uiString.str()); } break; case Parameter::OBJECT_PANEL_FLAG: - if (!loadObjectFlags(NULL, uiString)) { + if (!loadObjectFlags(nullptr, uiString)) { warningText.format("Object flag '%s' is unrecognized.", uiString.str()); } break; @@ -260,7 +260,7 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) // No warning is possible. break; case Parameter::COUNTER: - if (!isAction && !loadCounters(NULL, uiString)) { + if (!isAction && !loadCounters(nullptr, uiString)) { warningText.format("Counter/Timer '%s' does not exist.", uiString.str()); } break; @@ -283,7 +283,7 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) break; case Parameter::FLAG: - if (!isAction && !loadFlags(NULL, uiString)) { + if (!isAction && !loadFlags(nullptr, uiString)) { warningText.format("Flag '%s' is never initialized.", uiString.str()); } break; @@ -306,19 +306,19 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) break; case Parameter::DIALOG: - if (!loadAudioType(Parameter::DIALOG, NULL, uiString)) { + if (!loadAudioType(Parameter::DIALOG, nullptr, uiString)) { warningText.format("Dialog '%s' does not exist.", uiString.str()); } break; case Parameter::MUSIC: - if (!loadAudioType(Parameter::MUSIC, NULL, uiString)) { + if (!loadAudioType(Parameter::MUSIC, nullptr, uiString)) { warningText.format("Track '%s' does not exist.", uiString.str()); } break; case Parameter::MOVIE: - if (!loadMovies(NULL, uiString)) { + if (!loadMovies(nullptr, uiString)) { AsciiString commentFromINI; if (!getMovieComment(uiString, commentFromINI)) { warningText.format("Movie '%s' does not exit.", uiString.str()); @@ -329,26 +329,26 @@ AsciiString EditParameter::getWarningText(Parameter *pParm, Bool isAction) break; case Parameter::SPECIAL_POWER: - if (!loadSpecialPowers(NULL, uiString)) { + if (!loadSpecialPowers(nullptr, uiString)) { warningText.format("Special Power '%s' does not exist.", uiString.str()); } break; case Parameter::SCIENCE: - if (!loadSciences(NULL, uiString)) { + if (!loadSciences(nullptr, uiString)) { warningText.format("Science '%s' does not exist.", uiString.str()); } break; case Parameter::SCIENCE_AVAILABILITY: - if( !loadScienceAvailabilities( NULL, uiString ) ) + if( !loadScienceAvailabilities( nullptr, uiString ) ) { warningText.format( "Science availability '%s' does not exist.", uiString.str() ); } break; case Parameter::UPGRADE: - if (!loadUpgrades(NULL, uiString)) { + if (!loadUpgrades(nullptr, uiString)) { warningText.format("Upgrade '%s' does not exist.", uiString.str()); } break; @@ -494,7 +494,7 @@ void EditParameter::OnEditchangeCombo() void EditParameter::loadConditionParameter(Script *pScr, Parameter::ParameterType type, CComboBox *pCombo) { OrCondition *pOr; - if (pCombo==NULL) return; // null pcombo is used in syntaxing commands. jba. + if (pCombo==nullptr) return; // null pcombo is used in syntaxing commands. jba. for (pOr= pScr->getOrCondition(); pOr; pOr = pOr->getNextOrCondition()) { Condition *pCondition; for (pCondition = pOr->getFirstAndCondition(); pCondition; pCondition = pCondition->getNext()) { @@ -692,7 +692,7 @@ Bool EditParameter::loadCounters(CComboBox *pCombo, AsciiString match) if (pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -721,7 +721,7 @@ Bool EditParameter::loadAttackPrioritySets(CComboBox *pCombo, AsciiString match) Int i; Bool found = false; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -859,7 +859,7 @@ Bool EditParameter::loadAbilities( CComboBox *pCombo, AsciiString match ) break; } } - const ThingTemplate *theTemplate = NULL; + const ThingTemplate *theTemplate = nullptr; if ( theUnit ) { theTemplate = theUnit->getThingTemplate(); @@ -980,7 +980,7 @@ Bool EditParameter::loadFlags(CComboBox *pCombo, AsciiString match) if (pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); Script *pScr; @@ -1011,7 +1011,7 @@ Bool EditParameter::loadObjectType(CComboBox *pCombo, AsciiString match) Bool didMatch = false; - didMatch = loadObjectTypeList(pCombo, NULL, match); + didMatch = loadObjectTypeList(pCombo, nullptr, match); // add entries from the thing factory as the available objects to use const ThingTemplate *tTemplate; @@ -1245,12 +1245,12 @@ Bool EditParameter::loadCommandButtons(CComboBox *pCombo, AsciiString match) while (fp->eof() == FALSE) { token = strtok(string, seps); - if( token != NULL ) + if( token != nullptr ) { if( strcmp( token, "CommandButton" ) == 0) { - token = strtok(NULL, seps); - if( token != NULL ) + token = strtok(nullptr, seps); + if( token != nullptr ) { if (pCombo) pCombo->AddString(token); if (strcmp(match.str(), token) == 0) didMatch = true; @@ -1262,7 +1262,7 @@ Bool EditParameter::loadCommandButtons(CComboBox *pCombo, AsciiString match) } fp->close(); - fp = NULL; + fp = nullptr; return didMatch; } @@ -1303,7 +1303,7 @@ Bool EditParameter::loadFontNames(CComboBox *pCombo, AsciiString match) // delete the font library TheFontLibrary->reset(); delete TheFontLibrary; - TheFontLibrary = NULL; + TheFontLibrary = nullptr; return didMatch; } @@ -1316,17 +1316,17 @@ void EditParameter::readFontFile( const char *filename ) File *fp; // sanity - if( filename == NULL ) + if( filename == nullptr ) return; // open the file fp = TheFileSystem->openFile( filename, File::READ | File::TEXT); - if( fp == NULL ) + if( fp == nullptr ) return; // read how many entries follow Int fontCount; - fp->read(NULL, sizeof("AVAILABLE_FONT_COUNT = ")); + fp->read(nullptr, sizeof("AVAILABLE_FONT_COUNT = ")); fp->scanInt(fontCount); for( Int i = 0; i < fontCount; i++ ) @@ -1364,7 +1364,7 @@ void EditParameter::readFontFile( const char *filename ) // set the font GameFont *font = TheFontLibrary->getFont( AsciiString(fontBuffer), size, bold ); - if( font == NULL ) + if( font == nullptr ) { char buffer[ 1024 ]; @@ -1378,7 +1378,7 @@ void EditParameter::readFontFile( const char *filename ) // close the file fp->close(); - fp = NULL; + fp = nullptr; } @@ -1455,11 +1455,11 @@ Bool EditParameter::loadScripts(CComboBox *pCombo, Bool subr, AsciiString match) if (pCombo) pCombo->ResetContent(); Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; Bool didMatch = false; for (i=0; igetNumSides(); i++) { ScriptList *pSL = sidesListP->getSideInfo(i)->getScriptList(); - if (pSL == NULL) continue; + if (pSL == nullptr) continue; Script *pScr; for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) { if (subr && !pScr->isSubroutine()) continue; @@ -1496,7 +1496,7 @@ Bool EditParameter::loadSides(CComboBox *pCombo, AsciiString match) if (match == THIS_PLAYER_ENEMY) didMatch=true; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i=0; igetNumSides(); i++) { Dict *d = sidesListP->getSideInfo(i)->getDict(); AsciiString name = d->getAsciiString(TheKey_playerName); @@ -1519,7 +1519,7 @@ Bool EditParameter::loadTeams(CComboBox *pCombo, AsciiString match) if (match == ANY_TEAM) didMatch=true; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i = 0; i < sidesListP->getNumTeams(); i++) { Dict *d = sidesListP->getTeamInfo(i)->getDict(); @@ -1544,7 +1544,7 @@ Bool EditParameter::loadTeamOrUnit(CComboBox *pCombo, AsciiString match) Bool didMatch = false; Int i; SidesList *sidesListP = m_sidesListP; - if (sidesListP==NULL) sidesListP = TheSidesList; + if (sidesListP==nullptr) sidesListP = TheSidesList; for (i = 0; i < sidesListP->getNumTeams(); i++) { Dict *d = sidesListP->getTeamInfo(i)->getDict(); @@ -1617,7 +1617,7 @@ Bool EditParameter::loadUnits(CComboBox *pCombo, AsciiString match) SidesList *sidesListP = m_sidesListP; Int i; - if (sidesListP==NULL) + if (sidesListP==nullptr) { sidesListP = TheSidesList; } @@ -2273,7 +2273,7 @@ void EditParameter::OnOK() case Parameter::LOCALIZED_TEXT: pCombo->GetWindowText(txt); comboText = AsciiString(txt); - m_parameter->friend_setString(loadLocalizedText(NULL, comboText)); + m_parameter->friend_setString(loadLocalizedText(nullptr, comboText)); break; case Parameter::BOUNDARY: { @@ -2360,7 +2360,7 @@ void EditParameter::OnPreviewSound() event.generateFilename(); if (!event.getFilename().isEmpty()) { - PlaySound(event.getFilename().str(), NULL, SND_ASYNC | SND_FILENAME | SND_PURGE); + PlaySound(event.getFilename().str(), nullptr, SND_ASYNC | SND_FILENAME | SND_PURGE); } } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EulaDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EulaDialog.cpp index 605fd766cf3..0814e7f5a5d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EulaDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EulaDialog.cpp @@ -33,7 +33,7 @@ static char THIS_FILE[] = __FILE__; // EulaDialog dialog -EulaDialog::EulaDialog(CWnd* pParent /*=NULL*/) +EulaDialog::EulaDialog(CWnd* pParent /*=nullptr*/) : CDialog(EulaDialog::IDD, pParent) { //{{AFX_DATA_INIT(EulaDialog) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp index d1eb509c7c7..227df718459 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ExportScriptsOptions.cpp @@ -31,7 +31,7 @@ Bool ExportScriptsOptions::m_triggers = true; Bool ExportScriptsOptions::m_allScripts = false; Bool ExportScriptsOptions::m_sides = true; -ExportScriptsOptions::ExportScriptsOptions(CWnd* pParent /*=NULL*/) +ExportScriptsOptions::ExportScriptsOptions(CWnd* pParent /*=nullptr*/) : CDialog(ExportScriptsOptions::IDD, pParent) { //{{AFX_DATA_INIT(ExportScriptsOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index 806d74b6026..09a269a9704 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "FeatherTool.h" -FeatherOptions *FeatherOptions::m_staticThis = NULL; +FeatherOptions *FeatherOptions::m_staticThis = nullptr; Int FeatherOptions::m_currentFeather = 0; Int FeatherOptions::m_currentRate = 3; Int FeatherOptions::m_currentRadius = 1; @@ -34,7 +34,7 @@ Int FeatherOptions::m_currentRadius = 1; /// FeatherOptions dialog trivial construstor - Create does the real work. -FeatherOptions::FeatherOptions(CWnd* pParent /*=NULL*/) +FeatherOptions::FeatherOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(FeatherOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp index b50fbd0d40e..e881ca38ba8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp @@ -20,6 +20,7 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 + #include "StdAfx.h" #include "resource.h" @@ -42,9 +43,9 @@ Int FeatherTool::m_radius = 0; FeatherTool::FeatherTool(void) : Tool(ID_FEATHERTOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapFeatherCopy = NULL; - m_htMapRateCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapFeatherCopy = nullptr; + m_htMapRateCopy = nullptr; } /// Destructor diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp index c49e0a24b67..10fb78bb354 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceOptions.cpp @@ -45,7 +45,7 @@ so forth is all handled in the object options panel. jba. */ #include -FenceOptions *FenceOptions::m_staticThis = NULL; +FenceOptions *FenceOptions::m_staticThis = nullptr; Bool FenceOptions::m_updating = false; Int FenceOptions::m_currentObjectIndex=-1; Real FenceOptions::m_fenceSpacing=1; @@ -56,9 +56,9 @@ Real FenceOptions::m_fenceOffset=0; // FenceOptions dialog -FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) +FenceOptions::FenceOptions(CWnd* pParent /*=nullptr*/) { - m_objectsList = NULL; + m_objectsList = nullptr; m_customSpacing = false; //{{AFX_DATA_INIT(FenceOptions) // NOTE: the ClassWizard will add member initialization here @@ -69,7 +69,7 @@ FenceOptions::FenceOptions(CWnd* pParent /*=NULL*/) FenceOptions::~FenceOptions(void) { deleteInstance(m_objectsList); - m_objectsList = NULL; + m_objectsList = nullptr; } @@ -153,7 +153,7 @@ BOOL FenceOptions::OnInitDialog() if (tTemplate->getFenceWidth() == 0) continue; // create new map object - pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; @@ -206,7 +206,7 @@ HTREEITEM FenceOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -236,10 +236,10 @@ HTREEITEM FenceOptions::findOrAdd(HTREEITEM parent, const char *pLabel) void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const char *name, Int terrainNdx, HTREEITEM parent ) { - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -260,7 +260,7 @@ void FenceOptions::addObject( MapObject *mapObject, const char *pPath, const cha // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -334,7 +334,7 @@ Bool FenceOptions::setObjectTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp index 339dd71c606..28e7920b3fb 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FenceTool.cpp @@ -39,7 +39,7 @@ /// Constructor FenceTool::FenceTool(void) : Tool(ID_FENCE_TOOL, IDC_FENCE), - m_mapObjectList(NULL), + m_mapObjectList(nullptr), m_objectCount(1) { m_curObjectWidth = 27.35f; @@ -50,7 +50,7 @@ FenceTool::FenceTool(void) : FenceTool::~FenceTool(void) { deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; + m_mapObjectList = nullptr; } void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView, CWorldBuilderDoc *pDoc, Bool checkPlayers) @@ -83,22 +83,22 @@ void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView normalDelta.normalize(); Int i; - if (m_mapObjectList == NULL) return; + if (m_mapObjectList == nullptr) return; MapObject *pCurObj = m_mapObjectList; for (i=1; igetNext() == NULL) { + if (pCurObj->getNext() == nullptr) { pCurObj->setNextMap(ObjectOptions::duplicateCurMapObjectForPlace(&downPt, angle, checkPlayers)); } pCurObj=pCurObj->getNext(); - if (pCurObj == NULL) return; + if (pCurObj == nullptr) return; } WbView3d *p3View = pDoc->GetActive3DView(); MapObject *pXtraObjects = pCurObj->getNext(); - pCurObj->setNextMap(NULL); + pCurObj->setNextMap(nullptr); if (pXtraObjects) { p3View->removeFenceListObjects(pXtraObjects); deleteInstance(pXtraObjects); - pXtraObjects = NULL; + pXtraObjects = nullptr; } pCurObj = m_mapObjectList; @@ -126,9 +126,9 @@ void FenceTool::updateMapObjectList(Coord3D downPt, Coord3D curPt, WbView* pView void FenceTool::deactivate() { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// Shows the object options panel void FenceTool::activate() @@ -136,9 +136,9 @@ void FenceTool::activate() CMainFrame::GetMainFrame()->showOptionsDialog(IDD_FENCE_OPTIONS); DrawObject::setDoBrushFeedback(false); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); FenceOptions::update(); } @@ -154,7 +154,7 @@ void FenceTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB m_downPt3d = cpt; deleteInstance(m_mapObjectList); - m_mapObjectList = NULL; + m_mapObjectList = nullptr; if (FenceOptions::hasSelectedObject()) { FenceOptions::update(); @@ -177,12 +177,12 @@ void FenceTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld pView->snapPoint(&loc); Real angle = 0 ; if (m == TRACK_L) { // Mouse is down, so fence. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); updateMapObjectList(m_downPt3d,loc, pView, pDoc, false); return; } MapObject *pCur = ObjectOptions::getObjectNamed(AsciiString(ObjectOptions::getCurObjectName())); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); loc.z = ObjectOptions::getCurObjectHeight(); if (pCur && FenceOptions::hasSelectedObject()) { // Display the transparent version of this object. @@ -191,7 +191,7 @@ void FenceTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld p3View->setObjTracking(pCur, loc, angle, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); } } @@ -210,7 +210,7 @@ void FenceTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBui AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_mapObjectList); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObjectList = NULL; // undoable owns it now. + m_mapObjectList = nullptr; // undoable owns it now. } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp index 1bcc725ee75..6f8cff603ad 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp @@ -20,6 +20,7 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 + #include "StdAfx.h" #include "resource.h" @@ -40,7 +41,7 @@ Bool FloodFillTool::m_adjustCliffTextures = false; /// Constructor FloodFillTool::FloodFillTool(void) : Tool(ID_TILE_FLOOD_FILL, IDC_FLOOD_FILL), - m_cliffCursor(NULL) + m_cliffCursor(nullptr) { } @@ -66,7 +67,7 @@ void FloodFillTool::activate() void FloodFillTool::setCursor(void) { if (m_adjustCliffTextures) { - if (m_cliffCursor == NULL) { + if (m_cliffCursor == nullptr) { m_cliffCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_CLIFF)); } ::SetCursor(m_cliffCursor); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 31a8dbbc33f..897d6326a62 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -31,7 +31,7 @@ /// GlobalLightOptions dialog trivial construstor - Create does the real work. -GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=NULL*/) +GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=nullptr*/) : CDialog(GlobalLightOptions::IDD, pParent) { //{{AFX_DATA_INIT(GlobalLightOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveOptions.cpp index 7be64efb177..00c99ccb7f9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveOptions.cpp @@ -25,7 +25,7 @@ #define ARBITRARY_BUFF_SIZE 128 -/*extern*/ GroveOptions *TheGroveOptions = NULL; +/*extern*/ GroveOptions *TheGroveOptions = nullptr; void GroveOptions::makeMain(void) { @@ -168,7 +168,7 @@ BOOL GroveOptions::OnInitDialog() GroveOptions::~GroveOptions() { - TheGroveOptions = NULL; + TheGroveOptions = nullptr; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp index 753714f4574..75e1afabe3f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GroveTool.cpp @@ -64,7 +64,7 @@ Bool localIsUnderwater( Real x, Real y) if (pTrig->pointInTrigger(iLoc)) { Real wZ = pTrig->getPoint(0)->z; // See if the ground height is less than the water level. - Real curHeight = TheTerrainRenderObject->getHeightMapHeight(x, y, NULL); + Real curHeight = TheTerrainRenderObject->getHeightMapHeight(x, y, nullptr); return (curHeightInvalidate(); _plantGroveInBox(m_downPt, viewPt, pView); - if (m_headMapObj != NULL) { + if (m_headMapObj != nullptr) { AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_headMapObj); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_headMapObj = NULL; // undoable owns it now. + m_headMapObj = nullptr; // undoable owns it now. } return; } @@ -295,15 +295,15 @@ void GroveTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBui zeroDir.x = 0.0f; zeroDir.y = 0.0f; zeroDir.z = 0.0f; - loc.z = TheTerrainRenderObject ? TheTerrainRenderObject->getHeightMapHeight( loc.x, loc.y, NULL ) : 0; + loc.z = TheTerrainRenderObject ? TheTerrainRenderObject->getHeightMapHeight( loc.x, loc.y, nullptr ) : 0; // grow tree grove out from here plantGrove( loc, zeroDir, loc.z, depth, bounds ); - if (m_headMapObj != NULL) { + if (m_headMapObj != nullptr) { AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_headMapObj); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_headMapObj = NULL; // undoable owns it now. + m_headMapObj = nullptr; // undoable owns it now. } } @@ -334,12 +334,12 @@ void GroveTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld void GroveTool::addObj(Coord3D *pos, AsciiString name) { MapObject *pCur = ObjectOptions::getObjectNamed(name); - DEBUG_ASSERTCRASH(pCur!=NULL, ("oops")); + DEBUG_ASSERTCRASH(pCur!=nullptr, ("oops")); if (!pCur) return; Coord3D theLoc = *pos; theLoc.z = 0; Real angle = GameLogicRandomValueReal( 0.0f, 2.0f * PI ); - MapObject *pNew = newInstance( MapObject)(theLoc, pCur->getName(), angle, 0, NULL, pCur->getThingTemplate() ); + MapObject *pNew = newInstance( MapObject)(theLoc, pCur->getName(), angle, 0, nullptr, pCur->getThingTemplate() ); pNew->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); pNew->setNextMap(m_headMapObj); m_headMapObj = pNew; @@ -353,7 +353,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -362,7 +362,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -371,7 +371,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -380,7 +380,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / 1) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / 1) > MAX_TREE_RISE_OVER_RUN)) { @@ -390,7 +390,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -400,7 +400,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x += MAP_XY_FACTOR; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -410,7 +410,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; otherPos.y -= MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { @@ -420,7 +420,7 @@ static Bool _positionIsTooCliffyForTrees(Coord3D pos) otherPos = pos; otherPos.x -= MAP_XY_FACTOR; otherPos.y += MAP_XY_FACTOR; - otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, NULL); + otherPos.z = TheTerrainRenderObject->getHeightMapHeight(otherPos.x, otherPos.y, nullptr); if (((pos.z / otherPos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN) || ((otherPos.z / pos.z / SQRT_2) > MAX_TREE_RISE_OVER_RUN)) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp index edd9ebd3e8c..5135d70b704 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/LayersList.cpp @@ -91,7 +91,7 @@ void CLLTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) SelectItem(item); if (item) { - if (GetParentItem(item) == NULL) { + if (GetParentItem(item) == nullptr) { mLastClickedLayer = GetItemText(item); mLastClickedObject = AsciiString::TheEmptyString; contextIsLayer = true; @@ -120,7 +120,7 @@ void CLLTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) if (contextIsLayer) { CString itemText = GetItemText(item); if ((itemText.CompareNoCase(LayersList::TheActiveLayerName.c_str()) == 0) || - ((LayersList::TheActiveLayerName.c_str() == NULL) && + ((LayersList::TheActiveLayerName.c_str() == nullptr) && (LayersList::TheUnmutableDefaultLayerName.compare(LayersList::TheDefaultLayerName) == 0))) { // Don't allow the current layer to be hidden. // Because the objects will immediately disappear when placed. @@ -169,7 +169,7 @@ END_MESSAGE_MAP() LayersList::LayersList(UINT nIDTemplate, CWnd *parentWnd) : CDialog(nIDTemplate, parentWnd) { - mTree = NULL; + mTree = nullptr; m_activatedLayer = false; resetLayers(); } @@ -203,7 +203,7 @@ void LayersList::resetLayers(void) void LayersList::addMapObjectToLayersList(MapObject *objToAdd, AsciiString layerToAddTo) { if (!objToAdd || findMapObjectAndList(objToAdd)) { - DEBUG_CRASH(("MapObject added was NULL or object already in Layers List. jkmcd")); + DEBUG_CRASH(("MapObject added was null or object already in Layers List. jkmcd")); return; } ListLayerIt layerIt; @@ -228,7 +228,7 @@ void LayersList::addMapObjectToLayersList(MapObject *objToAdd, AsciiString layer void LayersList::addPolygonTriggerToLayersList(PolygonTrigger *triggerToAdd, AsciiString layerToAddTo) { if (!triggerToAdd || findPolygonTriggerAndList(triggerToAdd)) { - DEBUG_CRASH(("PolygonTrigger added was NULL or object already in Layers List. jkmcd")); + DEBUG_CRASH(("PolygonTrigger added was null or object already in Layers List. jkmcd")); return; } ListLayerIt layerIt; @@ -281,7 +281,7 @@ AsciiString LayersList::removePolygonTriggerFromLayersList(PolygonTrigger *trigg void LayersList::changeMapObjectLayer(MapObject *objToChange, AsciiString layerToPlaceOn) { if (!objToChange) { - DEBUG_CRASH(("Attempted to change location of NULL object. jkmcd")); + DEBUG_CRASH(("Attempted to change location of null object. jkmcd")); return; } @@ -292,7 +292,7 @@ void LayersList::changeMapObjectLayer(MapObject *objToChange, AsciiString layerT void LayersList::changePolygonTriggerLayer(PolygonTrigger *triggerToChange, AsciiString layerToPlaceOn) { if (!triggerToChange) { - DEBUG_CRASH(("Attempted to change location of NULL object. jkmcd")); + DEBUG_CRASH(("Attempted to change location of null object. jkmcd")); return; } @@ -631,7 +631,7 @@ void LayersList::addPolygonTriggerToLayer(IN PolygonTrigger *triggerToAdd, IN Li void LayersList::removeMapObjectFromLayer(IN MapObject *objectToRemove, IN ListLayerIt *layerIt, IN ListMapObjectPtrIt *objectIt) { if (!objectToRemove) { - DEBUG_CRASH(("Attempted to remove NULL object from layers list. jkmcd")); + DEBUG_CRASH(("Attempted to remove null object from layers list. jkmcd")); return; } @@ -671,7 +671,7 @@ void LayersList::removeMapObjectFromLayer(IN MapObject *objectToRemove, IN ListL void LayersList::removePolygonTriggerFromLayer(IN PolygonTrigger *triggerToRemove, IN ListLayerIt *layerIt, IN ListPolygonTriggerPtrIt *triggerIt) { if (!triggerToRemove) { - DEBUG_CRASH(("Attempted to remove NULL trigger from layers list. jkmcd")); + DEBUG_CRASH(("Attempted to remove null trigger from layers list. jkmcd")); return; } @@ -758,7 +758,7 @@ void LayersList::OnBeginEditLabel(NMHDR *pNotifyStruct, LRESULT* pResult) } TV_DISPINFO *ptvdi = (TV_DISPINFO*) pNotifyStruct; - if (ptvdi == NULL) { + if (ptvdi == nullptr) { (*pResult) = 1; return; } @@ -895,7 +895,7 @@ void LayersList::OnDeleteLayer() HTREEITEM LayersList::findTreeLayerNamed(const AsciiString& nameToFind) { if (!mTree) { - return NULL; + return nullptr; } HTREEITEM hItem = mTree->GetRootItem(); @@ -907,13 +907,13 @@ HTREEITEM LayersList::findTreeLayerNamed(const AsciiString& nameToFind) hItem = mTree->GetNextSiblingItem(hItem); } - return NULL; + return nullptr; } HTREEITEM LayersList::findTreeObjectNamed(const AsciiString& objectToFind, HTREEITEM layerItem) { if (!(layerItem && mTree)) { - return NULL; + return nullptr; } HTREEITEM hItem = mTree->GetChildItem(layerItem); @@ -925,7 +925,7 @@ HTREEITEM LayersList::findTreeObjectNamed(const AsciiString& objectToFind, HTREE hItem = mTree->GetNextSiblingItem(hItem); } - return NULL; + return nullptr; } void LayersList::OnHideShowLayer() @@ -1302,7 +1302,7 @@ MapObject *LayersList::findObjectByUID(AsciiString objectIDToFind) obj = obj->getNext(); } - return NULL; + return nullptr; } PolygonTrigger* LayersList::findPolygonTriggerByUID(AsciiString triggerIDToFind) @@ -1318,7 +1318,7 @@ PolygonTrigger* LayersList::findPolygonTriggerByUID(AsciiString triggerIDToFind) trigger = trigger->getNext(); } - return (NULL); + return (nullptr); } BEGIN_MESSAGE_MAP(LayersList, CDialog) @@ -1343,4 +1343,4 @@ std::string LayersList::TheDefaultNewLayerName = "New Layer"; std::string LayersList::ThePolygonTriggerLayerName = "Default Trigger Layer"; std::string LayersList::TheActiveLayerName; const std::string LayersList::TheUnmutableDefaultLayerName = "Default Object Layer"; -extern LayersList *TheLayersList = NULL; +extern LayersList *TheLayersList = nullptr; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp index 6fbbe7267f6..ee3a6de20d4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp @@ -28,12 +28,12 @@ #include "wbview3d.h" #include "Common/WellKnownKeys.h" -LightOptions *LightOptions::m_staticThis = NULL; +LightOptions *LightOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// /// LightOptions dialog trivial construstor - Create does the real work. -LightOptions::LightOptions(CWnd* pParent /*=NULL*/) +LightOptions::LightOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(LightOptions) // NOTE: the ClassWizard will add member initialization here @@ -52,7 +52,7 @@ void LightOptions::DoDataExchange(CDataExchange* pDX) MapObject *LightOptions::getSingleSelectedLight(void) { MapObject *pMapObj; - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { @@ -66,7 +66,7 @@ MapObject *LightOptions::getSingleSelectedLight(void) if (selCount==1 && theMapObj) { return theMapObj; } - return(NULL); + return(nullptr); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp index 8c45d2599cc..f86005ddfa8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MainFrm.cpp @@ -60,7 +60,7 @@ static UINT indicators[] = ID_INDICATOR_SCRL, }; -CMainFrame *CMainFrame::TheMainFrame = NULL; +CMainFrame *CMainFrame::TheMainFrame = nullptr; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction @@ -68,23 +68,23 @@ CMainFrame *CMainFrame::TheMainFrame = NULL; CMainFrame::CMainFrame() { TheMainFrame = this; - m_curOptions = NULL; - m_hAutoSaveTimer = NULL; + m_curOptions = nullptr; + m_hAutoSaveTimer = 0; m_autoSaving = false; - m_layersList = NULL; - m_scriptDialog = NULL; + m_layersList = nullptr; + m_scriptDialog = nullptr; } CMainFrame::~CMainFrame() { delete m_layersList; - m_layersList = NULL; + m_layersList = nullptr; delete m_scriptDialog; - m_scriptDialog = NULL; + m_scriptDialog = nullptr; SaveBarState("MainFrame"); - TheMainFrame = NULL; + TheMainFrame = nullptr; ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSave", m_autoSave); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "AutoSaveIntervalSeconds", m_autoSaveInterval); CoUninitialize(); @@ -105,7 +105,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) top.top += 10; top.top = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "Top", top.top); top.left =::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "Left", top.left); - SetWindowPos(NULL, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + SetWindowPos(nullptr, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); GetWindowRect(&frameRect); EnableDocking(CBRS_ALIGN_TOP); @@ -148,118 +148,118 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_brushOptions.Create(IDD_BRUSH_OPTIONS, this); - m_brushOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_brushOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_brushOptions.GetWindowRect(&frameRect); m_optionsPanelWidth = frameRect.Width(); m_optionsPanelHeight = frameRect.Height(); m_featherOptions.Create(IDD_FEATHER_OPTIONS, this); - m_featherOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_featherOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_featherOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_noOptions.Create(IDD_NO_OPTIONS, this); - m_noOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_noOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_noOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_terrainMaterial.Create(IDD_TERRAIN_MATERIAL, this); - m_terrainMaterial.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_terrainMaterial.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_terrainMaterial.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_blendMaterial.Create(IDD_BLEND_MATERIAL, this); - m_blendMaterial.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_blendMaterial.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_blendMaterial.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_moundOptions.Create(IDD_MOUND_OPTIONS, this); - m_moundOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_moundOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_moundOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_rulerOptions.Create(IDD_RULER_OPTIONS, this); - m_rulerOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_rulerOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_rulerOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_objectOptions.Create(IDD_OBJECT_OPTIONS, this); - m_objectOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_objectOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_objectOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_fenceOptions.Create(IDD_FENCE_OPTIONS, this); - m_fenceOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_fenceOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_fenceOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_mapObjectProps.Create(IDD_MAPOBJECT_PROPS, this); m_mapObjectProps.makeMain(); - m_mapObjectProps.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_mapObjectProps.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_mapObjectProps.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_roadOptions.Create(IDD_ROAD_OPTIONS, this); - m_roadOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_roadOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_roadOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waypointOptions.Create(IDD_WAYPOINT_OPTIONS, this); - m_waypointOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_waypointOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_waypointOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_waterOptions.Create(IDD_WATER_OPTIONS, this); - m_waterOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_waterOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_waterOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_lightOptions.Create(IDD_LIGHT_OPTIONS, this); - m_lightOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_lightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_lightOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_meshMoldOptions.Create(IDD_MESHMOLD_OPTIONS, this); - m_meshMoldOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_meshMoldOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_meshMoldOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_buildListOptions.Create(IDD_BUILD_LIST_PANEL, this); - m_buildListOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_buildListOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_buildListOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_groveOptions.Create(IDD_GROVE_OPTIONS, this); m_groveOptions.makeMain(); - m_groveOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_groveOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_groveOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_rampOptions.Create(IDD_RAMP_OPTIONS, this); - m_rampOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_rampOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_rampOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); m_scorchOptions.Create(IDD_SCORCH_OPTIONS, this); - m_scorchOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_scorchOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_scorchOptions.GetWindowRect(&frameRect); if (m_optionsPanelWidth < frameRect.Width()) m_optionsPanelWidth = frameRect.Width(); if (m_optionsPanelHeight < frameRect.Height()) m_optionsPanelHeight = frameRect.Height(); @@ -268,7 +268,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) frameRect.left =::AfxGetApp()->GetProfileInt(GLOBALLIGHT_OPTIONS_PANEL_SECTION, "Left", frameRect.left); m_globalLightOptions.Create(IDD_GLOBAL_LIGHT_OPTIONS, this); - m_globalLightOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_globalLightOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_globalLightOptions.GetWindowRect(&frameRect); m_globalLightOptionsWidth = frameRect.Width(); m_globalLightOptionsHeight = frameRect.Height(); @@ -277,7 +277,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) frameRect.left =::AfxGetApp()->GetProfileInt(CAMERA_OPTIONS_PANEL_SECTION, "Left", frameRect.left); m_cameraOptions.Create(IDD_CAMERA_OPTIONS, this); - m_cameraOptions.SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_cameraOptions.SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_cameraOptions.GetWindowRect(&frameRect); // now, setup the Layers Panel @@ -287,7 +287,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) CRect optionsRect; m_globalLightOptions.GetWindowRect(&optionsRect); - m_layersList->SetWindowPos(NULL, optionsRect.left, optionsRect.bottom + 100, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + m_layersList->SetWindowPos(nullptr, optionsRect.left, optionsRect.bottom + 100, 0, 0, SWP_NOZORDER | SWP_NOSIZE); Int sbf = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "ShowBrushFeedback", 1); if (sbf != 0) { @@ -300,7 +300,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_autoSave = autoSave != 0; autoSave = ::AfxGetApp()->GetProfileInt(MAIN_FRAME_SECTION, "AutoSaveIntervalSeconds", 120); m_autoSaveInterval = autoSave; - m_hAutoSaveTimer = this->SetTimer(1, m_autoSaveInterval*1000, NULL); + m_hAutoSaveTimer = this->SetTimer(1, m_autoSaveInterval*1000, nullptr); #if USE_STREAMING_AUDIO StartMusic(); @@ -334,7 +334,7 @@ void CMainFrame::adjustWindowSize(void) this->GetWindowRect(window); Int newWidth = window.Width()-widthDelta; Int newHeight = window.Height()-heightDelta; - this->SetWindowPos(NULL, 0, + this->SetWindowPos(nullptr, 0, 0, newWidth, newHeight, SWP_NOMOVE|SWP_NOZORDER); // MainFrm.cpp sets the top and left. if (pView) { @@ -352,30 +352,30 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) void CMainFrame::ResetWindowPositions(void) { - if (m_curOptions == NULL) { + if (m_curOptions == nullptr) { m_curOptions = &m_brushOptions; } - SetWindowPos(NULL, 20, 20, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + SetWindowPos(nullptr, 20, 20, 0, 0, SWP_NOSIZE|SWP_NOZORDER); ShowWindow(SW_SHOW); - m_curOptions->SetWindowPos(NULL, 40, 40, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + m_curOptions->SetWindowPos(nullptr, 40, 40, 0, 0, SWP_NOSIZE|SWP_NOZORDER); m_curOptions->ShowWindow(SW_SHOW); CView *pView = CWorldBuilderDoc::GetActive2DView(); if (pView) { CWnd *pParent = pView->GetParentFrame(); if (pParent) { - pParent->SetWindowPos(NULL, 60, 60, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + pParent->SetWindowPos(nullptr, 60, 60, 0, 0, SWP_NOSIZE|SWP_NOZORDER); } } CPoint pos(20,200); this->FloatControlBar(&m_floatingToolBar, pos, CBRS_ALIGN_LEFT); - m_floatingToolBar.SetWindowPos(NULL, pos.x, pos.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER); + m_floatingToolBar.SetWindowPos(nullptr, pos.x, pos.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER); m_floatingToolBar.ShowWindow(SW_SHOW); } void CMainFrame::showOptionsDialog(Int dialogID) { - CWnd *newOptions = NULL; + CWnd *newOptions = nullptr; switch(dialogID) { case IDD_BRUSH_OPTIONS : newOptions = &m_brushOptions; break; case IDD_TERRAIN_MATERIAL: newOptions = &m_terrainMaterial; break; @@ -433,7 +433,7 @@ void CMainFrame::onEditScripts() // This needs to be recreated each time so that it will have the current data. m_scriptDialog = new ScriptDialog(this); m_scriptDialog->Create(IDD_ScriptDialog, this); - m_scriptDialog->SetWindowPos(NULL, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + m_scriptDialog->SetWindowPos(nullptr, frameRect.left, frameRect.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); m_scriptDialog->GetWindowRect(&frameRect); m_scriptDialog->ShowWindow(SW_SHOWNA); } @@ -498,7 +498,7 @@ void CMainFrame::OnDestroy() if (m_hAutoSaveTimer) { KillTimer(m_hAutoSaveTimer); } - m_hAutoSaveTimer = NULL; + m_hAutoSaveTimer = 0; CFrameWnd::OnDestroy(); } @@ -507,7 +507,7 @@ void CMainFrame::OnTimer(UINT nIDEvent) CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); if (pDoc && pDoc->needAutoSave()) { m_autoSaving = true; - HCURSOR old = SetCursor(::LoadCursor(0, IDC_WAIT)); + HCURSOR old = SetCursor(::LoadCursor(nullptr, IDC_WAIT)); SetMessageText("Auto Saving map..."); pDoc->autoSave(); if (old) SetCursor(old); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp index c6ea342ee18..c4ef56b462b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MapPreview.cpp @@ -169,7 +169,7 @@ Bool MapPreview::mapPreviewToWorld(const ICoord2D *radar, Coord3D *world) Int x, y; // sanity - if( radar == NULL || world == NULL ) + if( radar == nullptr || world == nullptr ) return FALSE; // get the coords diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MapSettings.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MapSettings.cpp index cd020a3b988..3c1b832903a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MapSettings.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MapSettings.cpp @@ -33,7 +33,7 @@ // MapSettings dialog -MapSettings::MapSettings(CWnd* pParent /*=NULL*/) +MapSettings::MapSettings(CWnd* pParent /*=nullptr*/) : CDialog(MapSettings::IDD, pParent) { //{{AFX_DATA_INIT(MapSettings) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp index 7dd04077560..d97e2bfc42d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cpp @@ -31,12 +31,12 @@ Real MeshMoldOptions::m_currentHeight=0; Real MeshMoldOptions::m_currentScale=1.0f; Int MeshMoldOptions::m_currentAngle=0; -MeshMoldOptions * MeshMoldOptions::m_staticThis=NULL; +MeshMoldOptions * MeshMoldOptions::m_staticThis=nullptr; Bool MeshMoldOptions::m_doingPreview=false; Bool MeshMoldOptions::m_raiseOnly=false; Bool MeshMoldOptions::m_lowerOnly=false; -MeshMoldOptions::MeshMoldOptions(CWnd* pParent /*=NULL*/) +MeshMoldOptions::MeshMoldOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(MeshMoldOptions) // NOTE: the ClassWizard will add member initialization here @@ -86,8 +86,8 @@ BOOL MeshMoldOptions::OnInitDialog() FilenameList filenameList; TheFileSystem->getFileListInDirectory(".\\data\\Editor\\Molds\\", "*.w3d", filenameList, FALSE); - if (!filenameList.empty()) { - HTREEITEM child = NULL; + if (filenameList.size() > 0) { + HTREEITEM child = nullptr; FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp index 08a9d1dcee5..36773b6c53e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp @@ -20,6 +20,7 @@ // Terrain shaping tool for worldbuilder. // Author: John Ahlquist, Oct 2001 + #include "StdAfx.h" #include "resource.h" @@ -41,7 +42,7 @@ Bool MeshMoldTool::m_tracking = false; Coord3D MeshMoldTool::m_toolPos; -WorldHeightMapEdit *MeshMoldTool::m_htMapEditCopy = NULL; +WorldHeightMapEdit *MeshMoldTool::m_htMapEditCopy = nullptr; /// Constructor MeshMoldTool::MeshMoldTool(void) : @@ -95,7 +96,7 @@ void MeshMoldTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor if (!m_tracking) { m_tracking = true; m_toolPos = cpt; - Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, NULL); + Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, nullptr); MeshMoldOptions::setHeight(height); } DrawObject::setDoMeshFeedback(true); @@ -186,8 +187,8 @@ void MeshMoldTool::applyMesh(CWorldBuilderDoc *pDoc) { WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - HCURSOR old = SetCursor(::LoadCursor(0, IDC_WAIT)); - if (m_htMapEditCopy == NULL) { + HCURSOR old = SetCursor(::LoadCursor(nullptr, IDC_WAIT)); + if (m_htMapEditCopy == nullptr) { m_htMapEditCopy = pDoc->GetHeightMap()->duplicate(); } else { // Restore original heights to edit copy. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp index daf3d40e10b..c996ece7d5e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "MoundTool.h" -MoundOptions *MoundOptions::m_staticThis = NULL; +MoundOptions *MoundOptions::m_staticThis = nullptr; Int MoundOptions::m_currentWidth = 0; Int MoundOptions::m_currentHeight = 0; Int MoundOptions::m_currentFeather = 0; @@ -34,7 +34,7 @@ Int MoundOptions::m_currentFeather = 0; /// MoundOptions dialog trivial construstor - Create does the real work. -MoundOptions::MoundOptions(CWnd* pParent /*=NULL*/) +MoundOptions::MoundOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(MoundOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp index 174395e4b66..9c24413efac 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp @@ -20,6 +20,7 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 + #include "StdAfx.h" #include "resource.h" @@ -45,8 +46,8 @@ Int MoundTool::m_brushFeather; MoundTool::MoundTool(void) : Tool(ID_BRUSH_ADD_TOOL, IDC_BRUSH_CROSS) { - m_htMapEditCopy = NULL; - m_htMapSaveCopy = NULL; + m_htMapEditCopy = nullptr; + m_htMapSaveCopy = nullptr; m_raising = true; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MyToolbar.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MyToolbar.cpp index d7f5918ed44..8633cf1e09b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MyToolbar.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MyToolbar.cpp @@ -37,7 +37,7 @@ END_MESSAGE_MAP() #define MAX_POS 7 #define MIN_POS 1 -CellSizeToolBar *CellSizeToolBar::m_staticThis = NULL; +CellSizeToolBar *CellSizeToolBar::m_staticThis = nullptr; void CellSizeToolBar::CellSizeChanged(Int cellSize) { @@ -48,14 +48,14 @@ void CellSizeToolBar::CellSizeChanged(Int cellSize) if (newSize >= cellSize) break; } i = MAX_POS - i + MIN_POS; // Invert the range - if (m_staticThis != NULL) { + if (m_staticThis != nullptr) { m_staticThis->m_cellSlider.SetPos(i); } } CellSizeToolBar::~CellSizeToolBar(void) { - m_staticThis = NULL; + m_staticThis = nullptr; } void CellSizeToolBar::SetupSlider(void) @@ -89,7 +89,7 @@ void CellSizeToolBar::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) if (newSize>64) return; CWorldBuilderView* pView = CWorldBuilderDoc::GetActive2DView(); - if (pView == NULL || newSize == pView->getCellSize()) return; + if (pView == nullptr || newSize == pView->getCellSize()) return; pView->setCellSize(newSize); } @@ -98,7 +98,7 @@ LRESULT CellSizeToolBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam if (message == WM_VSCROLL) { int nScrollCode = (short)LOWORD(wParam); int nPos = (short)HIWORD(wParam); - OnVScroll(nScrollCode, nPos, NULL); + OnVScroll(nScrollCode, nPos, nullptr); return(0); } return(CDialogBar::WindowProc(message, wParam, lParam)); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp index fc866e5ea60..5a7172d7359 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp @@ -27,7 +27,7 @@ // CNewHeightMap dialog -CNewHeightMap::CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent /*=NULL*/) +CNewHeightMap::CNewHeightMap(TNewHeightInfo *hiP, const char *label, CWnd* pParent /*=nullptr*/) : CDialog(CNewHeightMap::IDD, pParent) { mHeightInfo = *hiP; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp index dc1dc5b7f5a..c15e1d3657d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectOptions.cpp @@ -41,7 +41,7 @@ #include -ObjectOptions *ObjectOptions::m_staticThis = NULL; +ObjectOptions *ObjectOptions::m_staticThis = nullptr; Bool ObjectOptions::m_updating = false; char ObjectOptions::m_currentObjectName[NAME_MAX_LEN]; Int ObjectOptions::m_currentObjectIndex=-1; @@ -51,9 +51,9 @@ AsciiString ObjectOptions::m_curOwnerName; // ObjectOptions dialog -ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) +ObjectOptions::ObjectOptions(CWnd* pParent /*=nullptr*/) { - m_objectsList = NULL; + m_objectsList = nullptr; strcpy(m_currentObjectName, "No Selection"); m_curOwnerName.clear(); //{{AFX_DATA_INIT(ObjectOptions) @@ -65,7 +65,7 @@ ObjectOptions::ObjectOptions(CWnd* pParent /*=NULL*/) ObjectOptions::~ObjectOptions(void) { deleteInstance(m_objectsList); - m_objectsList = NULL; + m_objectsList = nullptr; } @@ -159,7 +159,7 @@ void ObjectOptions::updateLabel() } else { - m_objectPreview.SetThingTemplate(NULL); + m_objectPreview.SetThingTemplate(nullptr); } m_objectPreview.Invalidate(); @@ -205,7 +205,7 @@ void ObjectOptions::updateLabel() static const PlayerTemplate* findFirstPlayerTemplateOnSide(AsciiString side) { if (side.isEmpty()) - return NULL; // neutral, this is ok + return nullptr; // neutral, this is ok for (int i = 0; i < ThePlayerTemplateStore->getPlayerTemplateCount(); i++) { @@ -217,7 +217,7 @@ static const PlayerTemplate* findFirstPlayerTemplateOnSide(AsciiString side) } DEBUG_CRASH(("no player found for %s!",side.str())); - return NULL; + return nullptr; } #endif @@ -244,7 +244,7 @@ BOOL ObjectOptions::OnInitDialog() MapObject *pMap; // create new map object - pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance( MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; @@ -258,7 +258,7 @@ BOOL ObjectOptions::OnInitDialog() { Coord3D pt = {0,0,0}; char base[1024] = "*Lights/Light"; - MapObject *pMap = newInstance(MapObject)(pt, AsciiString(base), 0.0f, 0, NULL, NULL ); + MapObject *pMap = newInstance(MapObject)(pt, AsciiString(base), 0.0f, 0, nullptr, nullptr ); pMap->setIsLight(); Dict *props = pMap->getProperties(); @@ -308,7 +308,7 @@ BOOL ObjectOptions::OnInitDialog() } } Coord3D pt = {0,0,0}; - MapObject *pMap = newInstance(MapObject)(pt, AsciiString(fileBuf), 0.0f, 0, NULL, NULL ); + MapObject *pMap = newInstance(MapObject)(pt, AsciiString(fileBuf), 0.0f, 0, nullptr, nullptr ); pMap->setNextMap(m_objectsList); m_objectsList = pMap; @@ -339,7 +339,7 @@ BOOL ObjectOptions::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_objectPreview.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_objectPreview.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_objectPreview.ShowWindow(SW_SHOW); MapObject *pMap = m_objectsList; @@ -368,7 +368,7 @@ HTREEITEM ObjectOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -432,7 +432,7 @@ HTREEITEM ObjectOptions::_FindOrDont(const char* pLabel, HTREEITEM startPoint) itemsToEx.push_back(m_objectTreeView.GetNextSiblingItem(hItem)); } } - return NULL; + return nullptr; } @@ -443,10 +443,10 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, Int terrainNdx, HTREEITEM parent ) { char buffer[ _MAX_PATH ]; - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -467,7 +467,7 @@ void ObjectOptions::addObject( MapObject *mapObject, const char *pPath, // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -548,7 +548,7 @@ Bool ObjectOptions::setObjectTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; @@ -625,7 +625,7 @@ MapObject *ObjectOptions::getCurMapObject(void) pObj = pObj->getNext(); } } - return(NULL); + return(nullptr); } AsciiString ObjectOptions::getCurGdfName(void) @@ -707,7 +707,7 @@ MapObject *ObjectOptions::duplicateCurMapObjectForPlace(const Coord3D* loc, Real } } AfxMessageBox("Unable to add object."); - return(NULL); + return(nullptr); } Real ObjectOptions::getCurObjectHeight(void) @@ -750,7 +750,7 @@ MapObject *ObjectOptions::getObjectNamed(AsciiString name) pObj = pObj->getNext(); } } - return(NULL); + return(nullptr); } Int ObjectOptions::getObjectNamedIndex(const AsciiString& name) @@ -776,7 +776,7 @@ Int ObjectOptions::getObjectNamedIndex(const AsciiString& name) pObj = pObj->getNext(); } } - return(NULL); + return(0); } @@ -802,7 +802,7 @@ void ObjectOptions::selectObject(const MapObject* pObj) char buffer[NAME_MAX_LEN]; HTREEITEM objToSel = m_staticThis->findOrDont(pObj->getName().str()); - if (objToSel == NULL) { + if (objToSel == nullptr) { return; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp index 477a307a3ab..ecbeace38ed 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectPreview.cpp @@ -54,7 +54,7 @@ ObjectPreview::ObjectPreview() { - m_tTempl = NULL; + m_tTempl = nullptr; } ObjectPreview::~ObjectPreview() @@ -89,11 +89,11 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) HRESULT hr=m_pDev->CreateImageSurface( desc.Width,desc.Height,desc.Format, &tempSurface); - hr=m_pDev->CopyRects(surface,NULL,0,tempSurface,NULL); + hr=m_pDev->CopyRects(surface,nullptr,0,tempSurface,nullptr); D3DLOCKED_RECT lrect; - DX8_ErrorCode(tempSurface->LockRect(&lrect,NULL,D3DLOCK_READONLY)); + DX8_ErrorCode(tempSurface->LockRect(&lrect,nullptr,D3DLOCK_READONLY)); unsigned int x,y,index,index2,width,height; @@ -129,7 +129,7 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) targ.Save("ObjectPreview.tga",TGAF_IMAGE,false); - return NULL; + return nullptr; #else @@ -184,7 +184,7 @@ static UnsignedByte * saveSurface(IDirect3DSurface8 *surface) static UnsignedByte * generatePreview( const ThingTemplate *tt ) { // find the default model to preview - RenderObjClass *model = NULL; + RenderObjClass *model = nullptr; Real scale = 1.0f; AsciiString modelName = "No Model Name"; if (tt) @@ -214,7 +214,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) if (!objectTexture) { model->Release_Ref(); - return NULL; + return nullptr; } // Set the render target @@ -248,7 +248,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) WW3D::End_Render(false); // Change the rendertarget back to the main backbuffer - DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)NULL); + DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)nullptr); SurfaceClass *surface = objectTexture->Get_Surface_Level(); UnsignedByte *data = saveSurface(surface->Peek_D3D_Surface()); @@ -261,7 +261,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) } } - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectTool.cpp index bba4bb20036..c8ba5bbfab3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ObjectTool.cpp @@ -84,9 +84,9 @@ Real ObjectTool::calcAngle(Coord3D downPt, Coord3D curPt, WbView* pView) void ObjectTool::deactivate() { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// Shows the object options panel void ObjectTool::activate() @@ -94,9 +94,9 @@ void ObjectTool::activate() CMainFrame::GetMainFrame()->showOptionsDialog(IDD_OBJECT_OPTIONS); DrawObject::setDoBrushFeedback(false); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /** Execute the tool on mouse down - Place an object. */ @@ -129,14 +129,14 @@ void ObjectTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl angle = pCur->getThingTemplate()->getPlacementViewAngle(); } WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); loc.z = ObjectOptions::getCurObjectHeight(); if (pCur) { // Display the transparent version of this object. p3View->setObjTracking(pCur, loc, angle, true); } else { // Don't display anything. - p3View->setObjTracking(NULL, loc, angle, false); + p3View->setObjTracking(nullptr, loc, angle, false); } } @@ -164,7 +164,7 @@ void ObjectTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp index 99101543322..c003e493bd0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp @@ -28,7 +28,7 @@ // OpenMap dialog -OpenMap::OpenMap(TOpenMapInfo *pInfo, CWnd* pParent /*=NULL*/) +OpenMap::OpenMap(TOpenMapInfo *pInfo, CWnd* pParent /*=nullptr*/) : CDialog(OpenMap::IDD, pParent), m_pInfo(pInfo) { @@ -81,7 +81,7 @@ void OpenMap::OnBrowse() void OpenMap::OnOK() { CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST); - if (pList == NULL) { + if (pList == nullptr) { OnCancel(); return; } @@ -108,7 +108,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) m_usingSystemDir = systemMaps; ::AfxGetApp()->WriteProfileInt(MAP_OPENSAVE_PANEL_SECTION, "UseSystemDir", m_usingSystemDir); - HANDLE hFindFile = 0; + HANDLE hFindFile = nullptr; WIN32_FIND_DATA findData; char dirBuf[_MAX_PATH]; char findBuf[_MAX_PATH]; @@ -121,7 +121,7 @@ void OpenMap::populateMapListbox( Bool systemMaps ) snprintf(dirBuf, ARRAY_SIZE(dirBuf), "%sMaps\\", TheGlobalData->getPath_UserData().str()); } CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST); - if (pList == NULL) return; + if (pList == nullptr) return; pList->ResetContent(); snprintf(findBuf, ARRAY_SIZE(findBuf), "%s*.*", dirBuf); @@ -164,11 +164,11 @@ BOOL OpenMap::OnInitDialog() CDialog::OnInitDialog(); CButton *pSystemMaps = (CButton *)this->GetDlgItem(IDC_SYSTEMMAPS); - if (pSystemMaps != NULL) + if (pSystemMaps != nullptr) pSystemMaps->SetCheck( m_usingSystemDir ); CButton *pUserMaps = (CButton *)this->GetDlgItem(IDC_USERMAPS); - if (pUserMaps != NULL) + if (pUserMaps != nullptr) pUserMaps->SetCheck( !m_usingSystemDir ); // TheSuperHackers @tweak Originally World Builder has hidden the System Maps tab button in Release builds, diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/OptionsPanel.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/OptionsPanel.cpp index d89ca14342f..c9973f81464 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/OptionsPanel.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/OptionsPanel.cpp @@ -28,7 +28,7 @@ // COptionsPanel dialog -COptionsPanel::COptionsPanel(Int dlgid /*=0*/, CWnd* pParent /*=NULL*/) +COptionsPanel::COptionsPanel(Int dlgid /*=0*/, CWnd* pParent /*=nullptr*/) : CDialog(dlgid ? dlgid : COptionsPanel::IDD, pParent) { //{{AFX_DATA_INIT(COptionsPanel) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp index 480ede7b2e4..99268d1550f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/PickUnitDialog.cpp @@ -35,10 +35,10 @@ // PickUnitDialog dialog -ReplaceUnitDialog::ReplaceUnitDialog(CWnd* pParent /*=NULL*/) +ReplaceUnitDialog::ReplaceUnitDialog(CWnd* pParent /*=nullptr*/) : PickUnitDialog(IDD, pParent) { - m_objectsList = NULL; + m_objectsList = nullptr; m_currentObjectIndex = -1; m_currentObjectName[0] = 0; for (int i = ES_FIRST; iisBuildableItem())) continue; // create new map object - pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, NULL, tTemplate ); + pMap = newInstance(MapObject)( loc, tTemplate->getName(), 0.0f, 0, nullptr, tTemplate ); pMap->setNextMap( m_objectsList ); m_objectsList = pMap; } @@ -212,7 +212,7 @@ HTREEITEM PickUnitDialog::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_objectTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -283,10 +283,10 @@ BOOL PickUnitDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int index, HTREEITEM parent ) { char buffer[ _MAX_PATH ]; - const char *leafName = NULL; + const char *leafName = nullptr; // sanity - if( mapObject == NULL ) + if( mapObject == nullptr ) return; // @@ -307,7 +307,7 @@ void PickUnitDialog::addObject( MapObject *mapObject, const char *pPath, Int ind // first sort by side, either create or find the tree item with matching side name AsciiString side = thingTemplate->getDefaultOwningSide(); - DEBUG_ASSERTCRASH( !side.isEmpty(), ("NULL default side in template") ); + DEBUG_ASSERTCRASH( !side.isEmpty(), ("null default side in template") ); parent = findOrAdd( parent, side.str()); // next tier uses the editor sorting that design can specify in the INI @@ -402,5 +402,5 @@ const ThingTemplate* PickUnitDialog::getPickedThing(void) return tTemplate; } } - return NULL; + return nullptr; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/PointerTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/PointerTool.cpp index 84704c37a0c..42df76f43eb 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/PointerTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/PointerTool.cpp @@ -88,10 +88,10 @@ static void helper_pickAllWaypointsInPath( Int sourceID, CWorldBuilderDoc *pDoc, /// Constructor PointerTool::PointerTool(void) : - m_modifyUndoable(NULL), - m_curObject(NULL), - m_rotateCursor(NULL), - m_moveCursor(NULL) + m_modifyUndoable(nullptr), + m_curObject(nullptr), + m_rotateCursor(nullptr), + m_moveCursor(nullptr) { m_toolID = ID_POINTER_TOOL; m_cursorID = IDC_POINTER; @@ -164,7 +164,7 @@ void PointerTool::clearSelection(void) ///< Clears the selected objects selected } } } - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; } /// Activate. @@ -175,15 +175,15 @@ void PointerTool::activate() m_mouseUpMove = false; checkForPropertiesPanel(); CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return; + if (pDoc==nullptr) return; WbView3d *p3View = pDoc->GetActive3DView(); - p3View->setObjTracking(NULL, m_downPt3d, 0, false); + p3View->setObjTracking(nullptr, m_downPt3d, 0, false); } /// deactivate. void PointerTool::deactivate() { - m_curObject = NULL; + m_curObject = nullptr; PolygonTool::deactivate(); } @@ -191,12 +191,12 @@ void PointerTool::deactivate() void PointerTool::setCursor(void) { if (m_mouseUpRotate) { - if (m_rotateCursor == NULL) { + if (m_rotateCursor == nullptr) { m_rotateCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_ROTATE)); } ::SetCursor(m_rotateCursor); } else if (m_mouseUpMove) { - if (m_moveCursor == NULL) { + if (m_moveCursor == nullptr) { m_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_MOVE_POINTER)); } ::SetCursor(m_moveCursor); @@ -276,7 +276,7 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl PolygonTool::startMouseDown(m, viewPt, pView, pDoc); return; } - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; m_poly_dragPointNdx = -1; } } @@ -284,10 +284,10 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl // WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - m_curObject = NULL; + m_curObject = nullptr; MapObject *pObj = MapObject::getFirstMapObject(); MapObject *p3DObj = pView->picked3dObjectInView(viewPt); - MapObject *pClosestPicked = NULL; + MapObject *pClosestPicked = nullptr; if (allowPick(p3DObj, pView)) { pClosestPicked = p3DObj; } @@ -312,7 +312,7 @@ void PointerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorl } } - Bool anySelected = (pClosestPicked!=NULL); + Bool anySelected = (pClosestPicked!=nullptr); if (shiftKey) { if (pClosestPicked && pClosestPicked->isSelected()) { pClosestPicked->setSelected(false); @@ -442,7 +442,7 @@ void PointerTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWor return; } - if (m_curObject == NULL) { + if (m_curObject == nullptr) { return; } pView->viewToDocCoords(viewPt, &cpt, !m_rotating); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/PolygonTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/PolygonTool.cpp index 32d54a67936..b579c587f23 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/PolygonTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/PolygonTool.cpp @@ -41,7 +41,7 @@ Bool PolygonTool::m_poly_isActive = false; Bool PolygonTool::m_poly_isAdding = false; -PolygonTrigger *PolygonTool::m_poly_curSelectedPolygon = NULL; +PolygonTrigger *PolygonTool::m_poly_curSelectedPolygon = nullptr; Int PolygonTool::m_poly_dragPointNdx = -1; enum {SNAP_DISTANCE = 5}; @@ -49,8 +49,8 @@ enum {SNAP_DISTANCE = 5}; /// Constructor PolygonTool::PolygonTool(void) : Tool(ID_POLYGON_TOOL, IDC_POLYGON), - m_poly_plusCursor(NULL), - m_poly_moveCursor(NULL) + m_poly_plusCursor(nullptr), + m_poly_moveCursor(nullptr) { } @@ -78,7 +78,7 @@ void PolygonTool::deactivate() } } m_poly_isActive = false; - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; } /// Shows the terrain materials options panel. @@ -150,7 +150,7 @@ PolygonTrigger *PolygonTool::pickPolygon(Coord3D loc, CPoint viewPt, WbView* pVi return pTrig; } } - return NULL; + return nullptr; } // Snap to other polys. @@ -177,7 +177,7 @@ Bool PolygonTool::poly_snapToPoly(Coord3D *pLoc) { // Pick a point. Int PolygonTool::poly_pickPoint(PolygonTrigger *pTrig, CPoint viewPt, WbView* pView) { - if (pTrig==NULL) return -1; + if (pTrig==nullptr) return -1; Int i; const Int PICK_PIXELS = pView->getPickPixels(); for (i=0; igetNumPoints(); i++) { @@ -202,7 +202,7 @@ Int PolygonTool::poly_pickPoint(PolygonTrigger *pTrig, CPoint viewPt, WbView* pV // Get the point to insert closest to loc. Int PolygonTool::poly_getInsertIndex(PolygonTrigger *pTrig, Coord3D loc) { - if (pTrig==NULL) return 0; + if (pTrig==nullptr) return 0; static Int tolerance = SNAP_DISTANCE; Int i; @@ -254,11 +254,11 @@ void PolygonTool::poly_pickOnMouseDown(CPoint viewPt, WbView* pView) } } if (!found) { - m_poly_curSelectedPolygon = NULL; // Undo probably made it go away. + m_poly_curSelectedPolygon = nullptr; // Undo probably made it go away. } } m_poly_justPicked = false; // Always false here. Pointer tool sets to true. - if (m_poly_curSelectedPolygon == NULL || !m_poly_isAdding) { + if (m_poly_curSelectedPolygon == nullptr || !m_poly_isAdding) { PolygonTrigger *pSel; Coord3D docPt = m_poly_unsnappedMouseDownPt; if (m_poly_curSelectedPolygon && poly_pickPoly(m_poly_curSelectedPolygon, docPt, SNAP_DISTANCE)) { @@ -302,8 +302,8 @@ void PolygonTool::startMouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, iDocPt.z = m_poly_curSelectedPolygon->getPoint(0)->z; } m_poly_dragPointNdx = -1; - m_poly_moveUndoable = NULL; - if (m_poly_curSelectedPolygon==NULL) { + m_poly_moveUndoable = nullptr; + if (m_poly_curSelectedPolygon==nullptr) { // adding a new polygon. m_poly_curSelectedPolygon = newInstance(PolygonTrigger)(32); AsciiString name; @@ -364,10 +364,10 @@ Bool PolygonTool::deleteSelectedPolygon(void) } } if (!found) { - m_poly_curSelectedPolygon = NULL; // Undo probably made it go away. + m_poly_curSelectedPolygon = nullptr; // Undo probably made it go away. } } - if (m_poly_curSelectedPolygon == NULL) { + if (m_poly_curSelectedPolygon == nullptr) { return false; } CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); @@ -383,7 +383,7 @@ Bool PolygonTool::deleteSelectedPolygon(void) DeletePolygonUndoable *pUndo = new DeletePolygonUndoable(m_poly_curSelectedPolygon); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_poly_curSelectedPolygon = NULL; + m_poly_curSelectedPolygon = nullptr; m_poly_dragPointNdx = -1; } WaypointOptions::update(); @@ -394,12 +394,12 @@ Bool PolygonTool::deleteSelectedPolygon(void) void PolygonTool::setCursor(void) { if (m_poly_mouseUpPlus || (m_poly_isAdding && m_poly_curSelectedPolygon)) { - if (m_poly_plusCursor == NULL) { + if (m_poly_plusCursor == nullptr) { m_poly_plusCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_POLYGON_PLUS)); } ::SetCursor(m_poly_plusCursor); } else if (m_poly_mouseUpMove) { - if (m_poly_moveCursor == NULL) { + if (m_poly_moveCursor == nullptr) { m_poly_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_POLYGON_MOVE)); } ::SetCursor(m_poly_moveCursor); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp index 0971a777387..509c76b68f2 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp @@ -48,7 +48,7 @@ RampOptions::RampOptions(CWnd* pParent) : COptionsPanel(RampOptions::IDD, pParen RampOptions::~RampOptions() { - TheRampOptions = NULL; + TheRampOptions = nullptr; } Bool RampOptions::shouldApplyTheRamp() @@ -79,7 +79,7 @@ void RampOptions::OnWidthChange() m_rampWidth = atof(str.GetBuffer(0)); } -extern RampOptions* TheRampOptions = NULL; +extern RampOptions* TheRampOptions = nullptr; BEGIN_MESSAGE_MAP(RampOptions, COptionsPanel) ON_BN_CLICKED(IDC_RO_APPLY, OnApply) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp index 1c97fd6879e..e1f741ec245 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp @@ -30,6 +30,8 @@ /* Revision History: */ /* 4/19/2002 : Initial creation */ /*---------------------------------------------------------------------------*/ + + #include "StdAfx.h" #include "RampTool.h" @@ -83,7 +85,7 @@ void RampTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB } else if (m == TRACK_L) { Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); - docPt.z = TheTerrainRenderObject->getHeightMapHeight(docPt.x, docPt.y, NULL); + docPt.z = TheTerrainRenderObject->getHeightMapHeight(docPt.x, docPt.y, nullptr); mEndPoint = docPt; } @@ -99,7 +101,7 @@ void RampTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); mStartPoint = docPt; - mStartPoint.z = TheTerrainRenderObject->getHeightMapHeight(mStartPoint.x, mStartPoint.y, NULL); + mStartPoint.z = TheTerrainRenderObject->getHeightMapHeight(mStartPoint.x, mStartPoint.y, nullptr); mIsMouseDown = true; } @@ -114,7 +116,7 @@ void RampTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuil Coord3D docPt; pView->viewToDocCoords(viewPt, &docPt); mEndPoint = docPt; - mEndPoint.z = TheTerrainRenderObject->getHeightMapHeight(mEndPoint.x, mEndPoint.y, NULL); + mEndPoint.z = TheTerrainRenderObject->getHeightMapHeight(mEndPoint.x, mEndPoint.y, nullptr); mIsMouseDown = false; } @@ -163,7 +165,7 @@ void RampTool::applyRamp(CWorldBuilderDoc* pDoc) Coord2D end = { mEndPoint.x, mEndPoint.y }; Coord2D pt2D = { pt.x, pt.y }; - ShortestDistancePointToSegment2D(&start, &end, &pt2D, NULL, NULL, &uVal); + ShortestDistancePointToSegment2D(&start, &end, &pt2D, nullptr, nullptr, &uVal); Real height = mStartPoint.z + uVal * (mEndPoint.z - mStartPoint.z); worldHeightDup->setHeight(indices[i].x, indices[i].y, (UnsignedByte) (height / MAP_HEIGHT_SCALE)); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp index 769a02996ce..f3c0d23d12f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp @@ -33,7 +33,7 @@ #include -RoadOptions *RoadOptions::m_staticThis = NULL; +RoadOptions *RoadOptions::m_staticThis = nullptr; Bool RoadOptions::m_updating = false; AsciiString RoadOptions::m_currentRoadName; Int RoadOptions::m_currentRoadIndex=0; @@ -48,7 +48,7 @@ Bool RoadOptions::m_doJoin = false; ///< Is a join to different road type. // RoadOptions dialog -RoadOptions::RoadOptions(CWnd* pParent /*=NULL*/) +RoadOptions::RoadOptions(CWnd* pParent /*=nullptr*/) { m_currentRoadName = "Road"; //{{AFX_DATA_INIT(RoadOptions) @@ -99,7 +99,7 @@ void RoadOptions::updateLabel(void) /** Returns true if only one or more roads is selected. */ Bool RoadOptions::selectionIsRoadsOnly(void) { -// MapObject *theMapObj = NULL; +// MapObject *theMapObj = nullptr; Bool foundRoad = false; Bool foundAnythingElse = false; MapObject *pMapObj; @@ -118,7 +118,7 @@ Bool RoadOptions::selectionIsRoadsOnly(void) /** Returns true if only one or more roads is selected. */ void RoadOptions::updateSelection(void) { -// MapObject *theMapObj = NULL; +// MapObject *theMapObj = nullptr; Int angled = 0; Int tight = 0; Int broad = 0; @@ -312,7 +312,7 @@ HTREEITEM RoadOptions::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -344,7 +344,7 @@ Bool RoadOptions::findAndSelect(HTREEITEM parent, AsciiString label) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -419,7 +419,7 @@ Bool RoadOptions::setRoadTreeViewSelection(HTREEITEM parent, Int selection) char buffer[NAME_MAX_LEN]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_roadTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; item.hItem = child; item.pszText = buffer; @@ -549,7 +549,7 @@ BOOL RoadOptions::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) updateLabel(); } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_roadTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_roadTreeView.GetChildItem(hItem); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadTool.cpp index 90e5f9d808b..b9b083b54a4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RoadTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RoadTool.cpp @@ -43,13 +43,13 @@ RoadTool::RoadTool(void) : Tool(ID_ROAD_TOOL, IDC_ROAD) { - m_mapObj = NULL; + m_mapObj = nullptr; } /// Destructor RoadTool::~RoadTool(void) { - m_mapObj = NULL; + m_mapObj = nullptr; } //----------------------------------------------------------------------------- // Public Functions @@ -62,7 +62,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { MapObject* pMapObj2 = pMapObj->getNext(); - if (pMapObj2==NULL) + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; @@ -76,7 +76,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) Real dist; Real u; - ShortestDistancePointToSegment2D(&start, &end, &loc, NULL, &snapLoc, &u); + ShortestDistancePointToSegment2D(&start, &end, &loc, nullptr, &snapLoc, &u); if (u < 0 || u > 1) { continue; } @@ -94,7 +94,7 @@ MapObject* RoadTool::findSegment(const Coord3D *pLoc, Coord3D *outLoc) } } } - return NULL; + return nullptr; } //============================================================================= @@ -117,7 +117,7 @@ Bool RoadTool::snap(Coord3D *pLoc, Bool skipFirst) } if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; Vector2 dist; if (!pMapObj->isSelected()) { @@ -177,13 +177,13 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu isLandmark = tt->isBridge(); } if (isLandmark) { - MapObject *pNew1 = newInstance(MapObject)(loc1, RoadOptions::getCurRoadName(), 0.0f, 0, NULL, tt ); + MapObject *pNew1 = newInstance(MapObject)(loc1, RoadOptions::getCurRoadName(), 0.0f, 0, nullptr, tt ); pNew1->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew1); pNew1->setSelected(true); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObj = NULL; + m_mapObj = nullptr; return; } } @@ -191,7 +191,7 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu Bool snapped = false; Bool divideSegment = false; - MapObject* pickedSegment = NULL; + MapObject* pickedSegment = nullptr; if (!isBridge) { snapped = snap(&loc1, false); if (!snapped) { @@ -222,13 +222,13 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu roadName = RoadOptions::getCurRoadName(); } - MapObject *pNew1 = newInstance(MapObject)(loc1, roadName, 0.0f, 0, NULL, NULL ); - MapObject *pNew2 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, NULL, NULL ); - MapObject *pNew3 = NULL; - MapObject *pNew4 = NULL; + MapObject *pNew1 = newInstance(MapObject)(loc1, roadName, 0.0f, 0, nullptr, nullptr ); + MapObject *pNew2 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, nullptr, nullptr ); + MapObject *pNew3 = nullptr; + MapObject *pNew4 = nullptr; if (divideSegment) { - pNew3 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, NULL, NULL ); - pNew4 = newInstance(MapObject)(loc3, roadName, 0.0f, 0, NULL, NULL ); + pNew3 = newInstance(MapObject)(loc2, roadName, 0.0f, 0, nullptr, nullptr ); + pNew4 = newInstance(MapObject)(loc3, roadName, 0.0f, 0, nullptr, nullptr ); } pNew1->setColor(RGB(255,255,0)); // make road endpoints yellow. @@ -295,7 +295,7 @@ void RoadTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBu AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew3); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_mapObj = NULL; + m_mapObj = nullptr; PointerTool::clearSelection(); pNew2->setSelected(true); pNew3->setSelected(true); @@ -308,7 +308,7 @@ void RoadTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB if (m != TRACK_L) return; Coord3D loc1 ; - if (m_mapObj == NULL) { + if (m_mapObj == nullptr) { return; } @@ -336,6 +336,6 @@ void RoadTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB void RoadTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc) { if (m != TRACK_L) return; - m_mapObj = NULL; + m_mapObj = nullptr; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerOptions.cpp index a8e0b2adf6b..98ee923eb86 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerOptions.cpp @@ -27,10 +27,10 @@ #include "WorldBuilderView.h" #include "RulerTool.h" -RulerOptions* RulerOptions::m_staticThis = NULL; +RulerOptions* RulerOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// -RulerOptions::RulerOptions(CWnd* pParent /*=NULL*/) +RulerOptions::RulerOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(RulerOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp index bb1a6dc8bf2..8b1fddc82ad 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp @@ -19,6 +19,7 @@ // RulerTool.cpp // Author: Mike Lytle, January 2003 + #include "StdAfx.h" #include "resource.h" @@ -31,7 +32,7 @@ // Saved off so that static functions can access its members. -RulerTool* RulerTool::m_staticThis = NULL; +RulerTool* RulerTool::m_staticThis = nullptr; /// Constructor RulerTool::RulerTool(void) : @@ -39,7 +40,7 @@ Tool(ID_RULER_TOOL, IDC_POINTER) { m_downPt3d.set(0.0f, 0.0f, 0.0f); m_rulerType = RULER_LINE; - m_View = NULL; + m_View = nullptr; m_staticThis = this; } @@ -53,7 +54,7 @@ void RulerTool::activate() { Tool::activate(); CMainFrame::GetMainFrame()->showOptionsDialog(IDD_RULER_OPTIONS); - if (m_View != NULL) { + if (m_View != nullptr) { // Is it dangerous to assume that the pointer is still good? m_View->doRulerFeedback(m_rulerType); } @@ -64,7 +65,7 @@ void RulerTool::deactivate() { Tool::deactivate(); - if (m_View != NULL) { + if (m_View != nullptr) { m_View->doRulerFeedback(RULER_NONE); } @@ -82,7 +83,7 @@ void RulerTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB { if (m != TRACK_L) return; - if (m_View == NULL) { + if (m_View == nullptr) { // Save so that when we are done the view can stop drawing the rulers. m_View = pView; } @@ -99,7 +100,7 @@ void RulerTool::mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld { if (m != TRACK_L) return; - if (m_View == NULL) { + if (m_View == nullptr) { // Save so that when we are done the view can stop drawing the rulers. m_View = pView; } @@ -160,7 +161,7 @@ Bool RulerTool::switchType() } else { m_staticThis->m_rulerType = RULER_LINE; } - if (m_staticThis->m_View != NULL) { + if (m_staticThis->m_View != nullptr) { m_staticThis->m_View->doRulerFeedback(m_staticThis->m_rulerType); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp index 22e6a197c7a..dd6ea4751fb 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cpp @@ -28,7 +28,7 @@ // SaveMap dialog -SaveMap::SaveMap(TSaveMapInfo *pInfo, CWnd* pParent /*=NULL*/) +SaveMap::SaveMap(TSaveMapInfo *pInfo, CWnd* pParent /*=nullptr*/) : CDialog(SaveMap::IDD, pParent), m_pInfo(pInfo) { @@ -74,7 +74,7 @@ void SaveMap::OnUserMaps() void SaveMap::OnOK() { CWnd *pEdit = GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit == NULL) { + if (pEdit == nullptr) { DEBUG_CRASH(("Bad resources.")); OnCancel(); return; @@ -119,7 +119,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) m_pInfo->usingSystemDir = m_usingSystemDir = systemMaps; ::AfxGetApp()->WriteProfileInt(MAP_OPENSAVE_PANEL_SECTION, "UseSystemDir", m_usingSystemDir); - HANDLE hFindFile = 0; + HANDLE hFindFile = nullptr; WIN32_FIND_DATA findData; char dirBuf[_MAX_PATH]; char findBuf[_MAX_PATH]; @@ -136,7 +136,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) dirBuf[len] = 0; } CListBox *pList = (CListBox *)this->GetDlgItem(IDC_SAVE_LIST); - if (pList == NULL) return; + if (pList == nullptr) return; pList->ResetContent(); snprintf(findBuf, ARRAY_SIZE(findBuf), "%s*.*", dirBuf); @@ -163,7 +163,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) if (hFindFile) FindClose(hFindFile); } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit != NULL) { + if (pEdit != nullptr) { strlcpy(fileBuf, m_pInfo->filename, ARRAY_SIZE(fileBuf)); Int len = strlen(fileBuf); if (len>4 && stricmp(".map", fileBuf+(len-4)) == 0) { @@ -186,7 +186,7 @@ void SaveMap::populateMapListbox( Bool systemMaps ) void SaveMap::OnSelchangeSaveList() { CListBox *pList = (CListBox *)this->GetDlgItem(IDC_SAVE_LIST); - if (pList == NULL) { + if (pList == nullptr) { return; } @@ -196,7 +196,7 @@ void SaveMap::OnSelchangeSaveList() pList->GetText(sel, filename); } CWnd *pEdit = GetDlgItem(IDC_SAVE_MAP_EDIT); - if (pEdit == NULL) { + if (pEdit == nullptr) { return; } pEdit->SetWindowText(filename); @@ -207,11 +207,11 @@ BOOL SaveMap::OnInitDialog() CDialog::OnInitDialog(); CButton *pSystemMaps = (CButton *)this->GetDlgItem(IDC_SYSTEMMAPS); - if (pSystemMaps != NULL) + if (pSystemMaps != nullptr) pSystemMaps->SetCheck( m_usingSystemDir ); CButton *pUserMaps = (CButton *)this->GetDlgItem(IDC_USERMAPS); - if (pUserMaps != NULL) + if (pUserMaps != nullptr) pUserMaps->SetCheck( !m_usingSystemDir ); // TheSuperHackers @tweak Originally World Builder has hidden the System Maps tab button in Release builds, diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp index dd802ca1cb9..a1eb231b753 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchOptions.cpp @@ -31,13 +31,13 @@ Scorches ScorchOptions::m_scorchtype = SCORCH_1; Real ScorchOptions::m_scorchsize = DEFAULT_SCORCHMARK_RADIUS; -ScorchOptions *ScorchOptions::m_staticThis = NULL; +ScorchOptions *ScorchOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// // ScorchOptions dialog -ScorchOptions::ScorchOptions(CWnd* pParent /*=NULL*/) +ScorchOptions::ScorchOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(ScorchOptions) // NOTE: the ClassWizard will add member initialization here @@ -63,7 +63,7 @@ END_MESSAGE_MAP() MapObject *ScorchOptions::getSingleSelectedScorch(void) { - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; MapObject *pMapObj; @@ -79,7 +79,7 @@ MapObject *ScorchOptions::getSingleSelectedScorch(void) return theMapObj; } - return(NULL); + return(nullptr); } void ScorchOptions::updateTheUI(void) @@ -261,7 +261,7 @@ void ScorchOptions::getAllSelectedDicts(void) Dict** ScorchOptions::getAllSelectedDictsData() { #if defined(USING_STLPORT) || __cplusplus < 201103L - return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : NULL; + return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : nullptr; #else return m_allSelectedDicts.data(); #endif diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchTool.cpp index 311897b00f0..4b258bf395e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScorchTool.cpp @@ -94,7 +94,7 @@ MapObject *ScorchTool::pickScorch(Coord3D loc){ return pObj; } } - return NULL; + return nullptr; } @@ -111,7 +111,7 @@ void ScorchTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld ScorchOptions::update(); } else { pView->snapPoint(&docPt); - MapObject *pNew = newInstance(MapObject)(docPt, "Scorch", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance(MapObject)(docPt, "Scorch", 0, 0, nullptr, nullptr ); pNew->getProperties()->setAsciiString(TheKey_originalOwner, NEUTRAL_TEAM_INTERNAL_STR); pNew->setSelected(true); pNew->setIsScorch(); @@ -120,7 +120,7 @@ void ScorchTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. ScorchOptions::update(); } m_mouseDownPt = docPt; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp index e0189ef2c72..08eb9e4f2ec 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsFalse.cpp @@ -32,7 +32,7 @@ IMPLEMENT_DYNCREATE(ScriptActionsFalse, CPropertyPage) ScriptActionsFalse::ScriptActionsFalse() : CPropertyPage(ScriptActionsFalse::IDD), -m_falseAction(NULL), +m_falseAction(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptActionsFalse) @@ -82,7 +82,7 @@ BOOL ScriptActionsFalse::OnInitDialog() void ScriptActionsFalse::loadList(void) { - m_falseAction = NULL; + m_falseAction = nullptr; ScriptDialog::updateScriptWarning(m_script); CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); Int count = 0; @@ -111,7 +111,7 @@ void ScriptActionsFalse::loadList(void) void ScriptActionsFalse::OnEditAction() { CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); - if (m_falseAction == NULL) { + if (m_falseAction == nullptr) { return; } EditAction cDlg; @@ -128,13 +128,13 @@ void ScriptActionsFalse::OnEditAction() void ScriptActionsFalse::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_DELETE); - pWnd->EnableWindow(m_falseAction!=NULL); + pWnd->EnableWindow(m_falseAction!=nullptr); pWnd = GetDlgItem(IDC_MOVE_DOWN); pWnd->EnableWindow(m_falseAction && m_falseAction->getNext()); @@ -146,7 +146,7 @@ void ScriptActionsFalse::enableUI() void ScriptActionsFalse::OnSelchangeActionList() { - m_falseAction = NULL; + m_falseAction = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -220,7 +220,7 @@ Bool ScriptActionsFalse::doMoveDown() if (m_falseAction && m_falseAction->getNext()) { ScriptAction *pNext = m_falseAction->getNext(); ScriptAction *pCur = m_script->getFalseAction(); - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; while (pCur != m_falseAction) { pPrev = pCur; pCur = pCur->getNext(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp index bef32638438..8ec67c302a9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptActionsTrue.cpp @@ -32,7 +32,7 @@ IMPLEMENT_DYNCREATE(ScriptActionsTrue, CPropertyPage) ScriptActionsTrue::ScriptActionsTrue() : CPropertyPage(ScriptActionsTrue::IDD), -m_action(NULL), +m_action(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptActionsTrue) @@ -82,7 +82,7 @@ BOOL ScriptActionsTrue::OnInitDialog() void ScriptActionsTrue::loadList(void) { - m_action = NULL; + m_action = nullptr; ScriptDialog::updateScriptWarning(m_script); CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); Int count = 0; @@ -111,7 +111,7 @@ void ScriptActionsTrue::loadList(void) void ScriptActionsTrue::OnEditAction() { CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); - if (m_action == NULL) { + if (m_action == nullptr) { return; } EditAction cDlg; @@ -128,13 +128,13 @@ void ScriptActionsTrue::OnEditAction() void ScriptActionsTrue::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_DELETE); - pWnd->EnableWindow(m_action!=NULL); + pWnd->EnableWindow(m_action!=nullptr); pWnd = GetDlgItem(IDC_MOVE_DOWN); pWnd->EnableWindow(m_action && m_action->getNext()); @@ -146,7 +146,7 @@ void ScriptActionsTrue::enableUI() void ScriptActionsTrue::OnSelchangeActionList() { - m_action = NULL; + m_action = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_ACTION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -220,7 +220,7 @@ Bool ScriptActionsTrue::doMoveDown() if (m_action && m_action->getNext()) { ScriptAction *pNext = m_action->getNext(); ScriptAction *pCur = m_script->getAction(); - ScriptAction *pPrev = NULL; + ScriptAction *pPrev = nullptr; while (pCur != m_action) { pPrev = pCur; pCur = pCur->getNext(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp index 43259ab28fe..0558cb6b04b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptConditions.cpp @@ -32,8 +32,8 @@ IMPLEMENT_DYNCREATE(ScriptConditionsDlg, CPropertyPage) ScriptConditionsDlg::ScriptConditionsDlg() : CPropertyPage(ScriptConditionsDlg::IDD), -m_condition(NULL), -m_orCondition(NULL), +m_condition(nullptr), +m_orCondition(nullptr), m_index(0) { //{{AFX_DATA_INIT(ScriptConditionsDlg) @@ -121,7 +121,7 @@ void ScriptConditionsDlg::loadList(void) void ScriptConditionsDlg::OnEditCondition() { CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); - if (m_condition == NULL) { + if (m_condition == nullptr) { return; } EditCondition cDlg; @@ -145,10 +145,10 @@ void ScriptConditionsDlg::OnEditCondition() void ScriptConditionsDlg::enableUI() { CWnd *pWnd = GetDlgItem(IDC_EDIT_CONDITION); - pWnd->EnableWindow(m_condition!=NULL); + pWnd->EnableWindow(m_condition!=nullptr); pWnd = GetDlgItem(IDC_COPY); - pWnd->EnableWindow(m_condition!=NULL); + pWnd->EnableWindow(m_condition!=nullptr); pWnd = GetDlgItem(IDC_DELETE); pWnd->EnableWindow(m_condition || m_orCondition); @@ -156,15 +156,15 @@ void ScriptConditionsDlg::enableUI() void ScriptConditionsDlg::setSel(OrCondition *pOr, Condition *pCond) { - m_orCondition = NULL; - m_condition = NULL; + m_orCondition = nullptr; + m_condition = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); if (pList) { pList->SetCurSel(-1); Int count = 0; m_orCondition = m_script->getOrCondition(); while (m_orCondition) { - if (m_orCondition==pOr && pCond==NULL) { + if (m_orCondition==pOr && pCond==nullptr) { pList->SetCurSel(count); enableUI(); return; @@ -188,8 +188,8 @@ void ScriptConditionsDlg::setSel(OrCondition *pOr, Condition *pCond) void ScriptConditionsDlg::OnSelchangeConditionList() { - m_orCondition = NULL; - m_condition = NULL; + m_orCondition = nullptr; + m_condition = nullptr; CListBox *pList = (CListBox *)GetDlgItem(IDC_CONDITION_LIST); if (pList) { Int count = pList->GetCurSel(); @@ -234,7 +234,7 @@ void ScriptConditionsDlg::OnOr() m_script->setOrCondition(pOr); } loadList(); - setSel(pOr, NULL); + setSel(pOr, nullptr); } void ScriptConditionsDlg::OnNew() @@ -248,7 +248,7 @@ void ScriptConditionsDlg::OnNew() pCond->setNextCondition(m_condition->getNext()); m_condition->setNextCondition(pCond); } else { - if (m_orCondition == NULL) { + if (m_orCondition == nullptr) { OrCondition *pOr = newInstance( OrCondition); pOr->setNextOrCondition(m_script->getOrCondition()); m_script->setOrCondition(pOr); @@ -292,7 +292,7 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) (*outWhichNow) = m_orCondition; if (m_condition && m_orCondition) { Condition *pNext = m_condition->getNext(); - if (pNext==NULL) { + if (pNext==nullptr) { OrCondition *pNOr = m_orCondition->getNextOrCondition(); if (!pNOr) { pNOr = newInstance( OrCondition); @@ -308,7 +308,7 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) } Condition *pCur = m_orCondition->getFirstAndCondition(); - Condition *pPrev = NULL; + Condition *pPrev = nullptr; while (pCur != m_condition) { pPrev = pCur; pCur = pCur->getNext(); @@ -328,9 +328,9 @@ Int ScriptConditionsDlg::doMoveDown( OrCondition **outWhichNow ) return 1; } else if (m_orCondition) { OrCondition *pNext = m_orCondition->getNextOrCondition(); - if (pNext==NULL) return 0; + if (pNext==nullptr) return 0; OrCondition *pCur = m_script->getOrCondition(); - OrCondition *pPrev = NULL; + OrCondition *pPrev = nullptr; while (pCur != m_orCondition) { pPrev = pCur; pCur = pCur->getNextOrCondition(); @@ -358,14 +358,14 @@ Int ScriptConditionsDlg::doMoveUp( OrCondition **outWhichNow ) if (m_condition && m_orCondition) { (*outWhichNow) = m_orCondition; Condition *pPrev = m_orCondition->findPreviousCondition(m_condition); - if (pPrev == NULL) { + if (pPrev == nullptr) { OrCondition *pNOr = m_script->findPreviousOrCondition(m_orCondition); if (!pNOr) { pNOr = newInstance( OrCondition); pNOr->setNextOrCondition(m_orCondition); m_script->setOrCondition(pNOr); } - Condition *previous = pNOr->findPreviousCondition(NULL); + Condition *previous = pNOr->findPreviousCondition(nullptr); if (previous) { m_orCondition->removeCondition(m_condition); previous->setNextCondition(m_condition); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp index c45f8ef396f..e98375ed77f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cpp @@ -48,7 +48,7 @@ static const Int K_LOCAL_TEAMS_VERSION_1 = 1; #define SCRIPT_DIALOG_SECTION "ScriptDialog" static const char* NEUTRAL_NAME_STR = "(neutral)"; -ScriptDialog *ScriptDialog::m_staticThis = NULL; +ScriptDialog *ScriptDialog::m_staticThis = nullptr; static AsciiString formatScriptLabel(Script *pScr) { AsciiString fmt; @@ -127,12 +127,12 @@ void CSDTreeCtrl::OnRButtonDown(UINT nFlags, CPoint point) if (item) { ScriptDialog *sd = (ScriptDialog*) GetParent(); - if (sd->friend_getCurScript() != NULL) + if (sd->friend_getCurScript() != nullptr) { Bool active = sd->friend_getCurScript()->isActive(); pPopup->CheckMenuItem(ID_SCRIPTACTIVATE, MF_BYCOMMAND | (active ? MF_CHECKED : MF_UNCHECKED)); } - else if (sd->friend_getCurGroup() != NULL) + else if (sd->friend_getCurGroup() != nullptr) { Bool active = sd->friend_getCurGroup()->isActive(); pPopup->CheckMenuItem(ID_SCRIPTACTIVATE, MF_BYCOMMAND | (active ? MF_CHECKED : MF_UNCHECKED)); @@ -150,7 +150,7 @@ END_MESSAGE_MAP() // ScriptDialog dialog -ScriptDialog::ScriptDialog(CWnd* pParent /*=NULL*/) +ScriptDialog::ScriptDialog(CWnd* pParent /*=nullptr*/) : CDialog(ScriptDialog::IDD, pParent) { m_draggingTreeView = false; @@ -162,8 +162,8 @@ ScriptDialog::ScriptDialog(CWnd* pParent /*=NULL*/) ScriptDialog::~ScriptDialog() { - EditParameter::setCurSidesList(NULL); - m_staticThis=NULL; + EditParameter::setCurSidesList(nullptr); + m_staticThis=nullptr; } @@ -205,7 +205,7 @@ void ScriptDialog::OnSelchangedScriptTree(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); - if (pNMTreeView->itemNew.hItem==NULL) { + if (pNMTreeView->itemNew.hItem==nullptr) { m_curSelection.IntToList(0); m_curSelection.m_objType = ListType::PLAYER_TYPE; } else { @@ -220,10 +220,10 @@ void ScriptDialog::OnSelchangedScriptTree(NMHDR* pNMHDR, LRESULT* pResult) ScriptGroup *pGroup = getCurGroup(); CWnd *pWnd = GetDlgItem(IDC_EDIT_SCRIPT); - pWnd->EnableWindow(pScript!=NULL || pGroup!=NULL); + pWnd->EnableWindow(pScript!=nullptr || pGroup!=nullptr); pWnd = GetDlgItem(IDC_COPY_SCRIPT); - pWnd->EnableWindow(pScript!=NULL); + pWnd->EnableWindow(pScript!=nullptr); pWnd = GetDlgItem(IDC_DELETE); pWnd->EnableWindow(m_curSelection.m_objType != ListType::PLAYER_TYPE); @@ -262,7 +262,7 @@ Script *ScriptDialog::getCurScript(void) if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE || m_curSelection.m_objType == ListType::SCRIPT_IN_GROUP_TYPE) { ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); if (pSL) { - Script *pScr=NULL; + Script *pScr=nullptr; if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE) { pScr = pSL->getScript(); } else { @@ -283,17 +283,17 @@ Script *ScriptDialog::getCurScript(void) } } } - return NULL; + return nullptr; } ScriptGroup *ScriptDialog::getCurGroup(void) { ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); if (m_curSelection.m_objType == ListType::PLAYER_TYPE) { - return NULL; + return nullptr; } if (m_curSelection.m_objType == ListType::SCRIPT_IN_PLAYER_TYPE) { - return NULL; + return nullptr; } if (pSL) { Int groupNdx; @@ -304,7 +304,7 @@ ScriptGroup *ScriptDialog::getCurGroup(void) } } } - return NULL; + return nullptr; } /** Updates the warning flags in a script, & script conditions & actions. */ @@ -546,7 +546,7 @@ BOOL ScriptDialog::OnInitDialog() pTree->SetImageList(&m_imageList, TVSIL_STATE); for (i=0; iSelectItem(hItem); didSelect = true; } @@ -558,7 +558,7 @@ BOOL ScriptDialog::OnInitDialog() GetWindowRect(&top); top.top = ::AfxGetApp()->GetProfileInt(SCRIPT_DIALOG_SECTION, "Top", top.top); top.left =::AfxGetApp()->GetProfileInt(SCRIPT_DIALOG_SECTION, "Left", top.left); - SetWindowPos(NULL, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); + SetWindowPos(nullptr, top.left, top.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -637,7 +637,7 @@ Bool ScriptDialog::updateIcons(HTREEITEM hItem) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM child = pTree->GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { ListType lt; lt.IntToList(pTree->GetItemData(child)); @@ -789,7 +789,7 @@ void ScriptDialog::reloadPlayer(Int playerIndex, ScriptList *pSL) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM player = pTree->GetChildItem(TVI_ROOT); - while (player != NULL) { + while (player != nullptr) { TVITEM item; ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; @@ -835,7 +835,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM player = pTree->GetChildItem(TVI_ROOT); TVITEM item; - while (player != NULL) { + while (player != nullptr) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = player; @@ -848,7 +848,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) player = pTree->GetNextSiblingItem(player); } DEBUG_ASSERTCRASH(player, ("Couldn't find player.")); - if (!player) return NULL; + if (!player) return nullptr; if (sel.m_objType == ListType::PLAYER_TYPE) { return player; } @@ -858,7 +858,7 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) group = player; // top level scripts are grouped under player. } else { group = pTree->GetChildItem(player); - while (group != NULL) { + while (group != nullptr) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = group; @@ -873,13 +873,13 @@ HTREEITEM ScriptDialog::findItem(ListType sel, Bool failSafe) } } DEBUG_ASSERTCRASH(group, ("Couldn't find group.")); - if (!group) return NULL; + if (!group) return nullptr; if (sel.m_objType == ListType::GROUP_TYPE) { return group; } HTREEITEM script; - for (script = pTree->GetChildItem(group); script != NULL; script = pTree->GetNextSiblingItem(script)) { + for (script = pTree->GetChildItem(group); script != nullptr; script = pTree->GetNextSiblingItem(script)) { ::memset(&item, 0, sizeof(item)); item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = script; @@ -1016,7 +1016,7 @@ void ScriptDialog::OnEditScript() Script *pScript = getCurScript(); ScriptGroup *pGroup = getCurGroup(); DEBUG_ASSERTCRASH(pScript || pGroup, ("Null script.")); - if (pScript == NULL) { + if (pScript == nullptr) { CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM item = findItem(m_curSelection); if (pGroup) { @@ -1024,7 +1024,7 @@ void ScriptDialog::OnEditScript() if (IDOK==editDlg.DoModal()) { if (item) { pTree->SetItemText(item, pGroup->getName().str()); - pTree->SelectItem(NULL); + pTree->SelectItem(nullptr); updateWarnings(); pTree->SelectItem(item); } @@ -1058,7 +1058,7 @@ void ScriptDialog::OnEditScript() HTREEITEM item = findItem(m_curSelection); if (item) { pTree->SetItemText(item, formatScriptLabel(pScript).str()); - pTree->SelectItem(NULL); + pTree->SelectItem(nullptr); updateWarnings(); pTree->SelectItem(item); // Updates the comment field & text field. } @@ -1071,7 +1071,7 @@ void ScriptDialog::OnCopyScript() { Script *pScript = getCurScript(); DEBUG_ASSERTCRASH(pScript, ("Null script.")); - if (pScript == NULL) return; + if (pScript == nullptr) return; Script *pDup = pScript->duplicate(); AsciiString newName = pDup->getName(); newName.concat(" C"); @@ -1096,7 +1096,7 @@ void ScriptDialog::OnDelete() m_curSelection.m_objType = ListType::PLAYER_TYPE; } else { pGroup->deleteScript(pScript); - if (pGroup->getScript()==NULL) { + if (pGroup->getScript()==nullptr) { m_curSelection.m_objType = ListType::GROUP_TYPE; } } @@ -1105,7 +1105,7 @@ void ScriptDialog::OnDelete() } } else { pSL->deleteScript(pScript); - if (pSL->getScript()==NULL) { + if (pSL->getScript()==nullptr) { m_curSelection.m_objType = ListType::PLAYER_TYPE; } } @@ -1283,10 +1283,10 @@ void ScriptDialog::OnSave() ScriptList *scripts[MAX_PLAYER_COUNT]; for (i=0; iaddScript(pScript, 0); } - if (scripts[0] == NULL) { + if (scripts[0] == nullptr) { ::AfxMessageBox("No scripts selected - aborting export.", MB_OK); return; } @@ -1505,7 +1505,7 @@ void ScriptDialog::OnSave() void ScriptDialog::OnLoad() { - CFileDialog fileDlg(true, ".scb", NULL, 0, + CFileDialog fileDlg(true, ".scb", nullptr, 0, "Script files (.scb)|*.scb||", this); Int result = fileDlg.DoModal(); @@ -1513,7 +1513,7 @@ void ScriptDialog::OnLoad() // Open document dialog may change working directory, // change it back. char buf[_MAX_PATH]; - ::GetModuleFileName(NULL, buf, sizeof(buf)); + ::GetModuleFileName(nullptr, buf, sizeof(buf)); if (char *pEnd = strrchr(buf, '\\')) { *pEnd = 0; } @@ -1530,8 +1530,8 @@ void ScriptDialog::OnLoad() try { ChunkInputStream *pStrm = &theInputStream; DataChunkInput file( pStrm ); - m_firstReadObject = NULL; - m_firstTrigger = NULL; + m_firstReadObject = nullptr; + m_firstTrigger = nullptr; m_waypointBase = pDoc->getNextWaypointID(); m_maxWaypoint = m_waypointBase; file.registerParser( "PlayerScriptsList", AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk ); @@ -1555,13 +1555,13 @@ void ScriptDialog::OnLoad() AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, m_firstReadObject); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - m_firstReadObject = NULL; // undoable owns it now. + m_firstReadObject = nullptr; // undoable owns it now. } PolygonTrigger *pTrig; PolygonTrigger *pNextTrig; for (pTrig=m_firstTrigger; pTrig; pTrig = pNextTrig) { pNextTrig = pTrig->getNext(); - pTrig->setNextPoly(NULL); + pTrig->setNextPoly(nullptr); PolygonTrigger::addPolygonTrigger(pTrig); } @@ -1569,7 +1569,7 @@ void ScriptDialog::OnLoad() Int count = ScriptList::getReadScripts(scripts); Int i; for (i=0; igetScript() == NULL && scripts[i]->getScriptGroup()==NULL) continue; + if (scripts[i]->getScript() == nullptr && scripts[i]->getScriptGroup()==nullptr) continue; Int curSide = -1; if (count==1) { curSide = m_curSelection.m_playerIndex; @@ -1603,7 +1603,7 @@ void ScriptDialog::OnLoad() Int j=0; for (pScr = scripts[i]->getScript(); pScr; pScr=pNextScr) { pNextScr=pScr->getNext(); - pScr->setNextScript(NULL); + pScr->setNextScript(nullptr); pSL->addScript(pScr, j); //unlink it and add. j++; } @@ -1612,13 +1612,13 @@ void ScriptDialog::OnLoad() ScriptGroup *pNextGroup; for (pGroup = scripts[i]->getScriptGroup(); pGroup; pGroup=pNextGroup) { pNextGroup=pGroup->getNext(); - pGroup->setNextGroup(NULL); + pGroup->setNextGroup(nullptr); pSL->addGroup(pGroup, j); j++; } scripts[i]->discard(); /* Frees the script list, but none of it's children, as they have been copied into the current scripts. */ - scripts[i] = NULL; + scripts[i] = nullptr; //reloadPlayer(curSide, pSL); } @@ -1645,7 +1645,7 @@ void ScriptDialog::OnLoad() */ Bool ScriptDialog::ParseObjectsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData) { - file.m_currentObject = NULL; + file.m_currentObject = nullptr; file.registerParser( "Object", info->label, ParseObjectDataChunk ); return (file.parse(userData)); } @@ -1715,10 +1715,10 @@ Bool ScriptDialog::ParseObjectDataChunk(DataChunkInput &file, DataChunkInfo *inf } if (pPrevious) { - DEBUG_ASSERTCRASH(pThis->m_firstReadObject != NULL && pPrevious->getNext() == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(pThis->m_firstReadObject != nullptr && pPrevious->getNext() == nullptr, ("Bad linkage.")); pPrevious->setNextMap(pThisOne); } else { - DEBUG_ASSERTCRASH(pThis->m_firstReadObject == NULL, ("Bad linkage.")); + DEBUG_ASSERTCRASH(pThis->m_firstReadObject == nullptr, ("Bad linkage.")); pThis->m_firstReadObject = pThisOne; } file.m_currentObject = pThisOne; @@ -1859,8 +1859,8 @@ Bool ScriptDialog::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChunk AsciiString triggerName; // Remove any existing polygon triggers, if any. ScriptDialog *pThis = (ScriptDialog *)userData; - pThis->m_firstTrigger = NULL; - PolygonTrigger *pPrevTrig = NULL; + pThis->m_firstTrigger = nullptr; + PolygonTrigger *pPrevTrig = nullptr; count = file.readInt(); Bool isRiver; Int riverStart; @@ -1924,7 +1924,7 @@ void ScriptDialog::OnDblclkScriptTree(NMHDR* pNMHDR, LRESULT* pResult) { Script *pScript = getCurScript(); ScriptGroup *pGroup = getCurGroup(); - if (pScript == NULL && pGroup == NULL) return; + if (pScript == nullptr && pGroup == nullptr) return; OnEditScript(); *pResult = 0; } @@ -1970,7 +1970,7 @@ void ScriptDialog::OnMouseMove(UINT nFlags, CPoint point) const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != NULL) { + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { pTree->SelectDropTarget(htiTarget); } } @@ -1991,7 +1991,7 @@ void ScriptDialog::OnLButtonUp(UINT nFlags, CPoint point) const Int CENTER_OFFSET = 12; point.y -= CENTER_OFFSET; tvht.pt = point; - if ((htiTarget = pTree->HitTest( &tvht)) != NULL) { + if ((htiTarget = pTree->HitTest( &tvht)) != nullptr) { pTree->SelectItem(htiTarget); pTree->SelectDropTarget(htiTarget); doDropOn(m_dragItem, htiTarget); @@ -2009,13 +2009,13 @@ void ScriptDialog::doDropOn(HTREEITEM hDrag, HTREEITEM hTarget) ListType target; target.IntToList(pTree->GetItemData(hTarget)); - Script *dragScript = NULL; - ScriptGroup *dragGroup = NULL; + Script *dragScript = nullptr; + ScriptGroup *dragGroup = nullptr; m_curSelection = drag; Script *pScript = getCurScript(); ScriptList *pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); ScriptGroup *pGroup = getCurGroup(); - if (pSL == NULL) return; + if (pSL == nullptr) return; if (pScript) { dragScript = pScript->duplicate(); if (pGroup) { @@ -2044,7 +2044,7 @@ void ScriptDialog::doDropOn(HTREEITEM hDrag, HTREEITEM hTarget) pSL = m_sides.getSideInfo(m_curSelection.m_playerIndex)->getScriptList(); pGroup = getCurGroup(); DEBUG_ASSERTCRASH((pSL), ("Hmm - bad data. jba.")); - if (pSL == NULL) return; + if (pSL == nullptr) return; // If we are dragging a group onto a script, adjust the group index so we add after. if (drag.m_objType == ListType::GROUP_TYPE) { @@ -2104,7 +2104,7 @@ void ScriptDialog::OnScriptActivate() CTreeCtrl *pTree = (CTreeCtrl*)GetDlgItem(IDC_SCRIPT_TREE); HTREEITEM item = findItem(m_curSelection); - if (getCurScript() != NULL) + if (getCurScript() != nullptr) { /// Updates attributes active = getCurScript()->isActive(); @@ -2126,7 +2126,7 @@ void ScriptDialog::OnScriptActivate() pTree->SetItemState(item, INDEXTOSTATEIMAGEMASK(6), TVIS_STATEIMAGEMASK); } } - else if (getCurGroup() != NULL) + else if (getCurGroup() != nullptr) { /// Updates attributes active = getCurGroup()->isActive(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptProperties.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptProperties.cpp index a6d0c4c7739..4f5cda9d1df 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptProperties.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ScriptProperties.cpp @@ -29,7 +29,7 @@ IMPLEMENT_DYNCREATE(ScriptProperties, CPropertyPage) -ScriptProperties::ScriptProperties() : m_updating(false), m_script(NULL), +ScriptProperties::ScriptProperties() : m_updating(false), m_script(nullptr), CPropertyPage(ScriptProperties::IDD) { //{{AFX_DATA_INIT(ScriptProperties) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index b5a2d134a29..9bb7546994a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -30,7 +30,7 @@ // SelectMacrotexture dialog -SelectMacrotexture::SelectMacrotexture(CWnd* pParent /*=NULL*/) +SelectMacrotexture::SelectMacrotexture(CWnd* pParent /*=nullptr*/) : CDialog(SelectMacrotexture::IDD, pParent) { //{{AFX_DATA_INIT(SelectMacrotexture) @@ -80,7 +80,7 @@ BOOL SelectMacrotexture::OnInitDialog() if (!filenameList.empty()) { TVINSERTSTRUCT ins; - HTREEITEM child = NULL; + HTREEITEM child = nullptr; FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ShadowOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ShadowOptions.cpp index d900c872046..bcd9904259e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ShadowOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ShadowOptions.cpp @@ -31,7 +31,7 @@ // ShadowOptions dialog -ShadowOptions::ShadowOptions(CWnd* pParent /*=NULL*/) +ShadowOptions::ShadowOptions(CWnd* pParent /*=nullptr*/) : CDialog(ShadowOptions::IDD, pParent) { //{{AFX_DATA_INIT(ShadowOptions) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SplashScreen.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SplashScreen.cpp index f3caf2281ee..ba08c559812 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SplashScreen.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SplashScreen.cpp @@ -66,7 +66,7 @@ void SplashScreen::outputText(UINT nIDString) m_loadString = str; - RedrawWindow(&m_rect, NULL); + RedrawWindow(&m_rect, nullptr); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp index d577f9c7a9e..77f2a89f60d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamGeneric.cpp @@ -84,8 +84,8 @@ void TeamGeneric::_fillComboBoxesWithScripts() void TeamGeneric::_dictToScripts() { - CWnd *pText = NULL; - CComboBox *pCombo = NULL; + CWnd *pText = nullptr; + CComboBox *pCombo = nullptr; if (!m_teamDict) { return; @@ -163,8 +163,8 @@ void TeamGeneric::_scriptsToDict() return; } - CWnd *pText = NULL; - CComboBox *pCombo = NULL; + CWnd *pText = nullptr; + CComboBox *pCombo = nullptr; int scriptNum = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp index 4f11bd26741..0a0a98420dd 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamObjectProperties.cpp @@ -597,12 +597,12 @@ void TeamObjectProperties::_UpdateTeamMembers() MapObject *pObj; for (pObj=MapObject::getFirstMapObject(); pObj; pObj=pObj->getNext()) { Dict* objectDict = pObj->getProperties(); - DEBUG_ASSERTCRASH(objectDict, ("objectDict shouldn't be NULL")); + DEBUG_ASSERTCRASH(objectDict, ("objectDict shouldn't be null")); AsciiString objectsTeam = objectDict->getAsciiString(TheKey_originalOwner); if (teamName == objectsTeam) { - DEBUG_ASSERTCRASH(m_dictToEdit, ("m_dictToEdit shouldn't be NULL")); + DEBUG_ASSERTCRASH(m_dictToEdit, ("m_dictToEdit shouldn't be null")); Bool exists; Int value = m_dictToEdit->getInt(TheKey_teamObjectInitialHealth, &exists); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp index 5582a7bbacc..ac5045b099a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TeamReinforcement.cpp @@ -31,7 +31,7 @@ TeamReinforcement::TeamReinforcement() : CPropertyPage(TeamReinforcement::IDD) , - m_teamDict(NULL) + m_teamDict(nullptr) { //{{AFX_DATA_INIT(TeamReinforcement) // NOTE: the ClassWizard will add member initialization here diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp index 1d2c46b3126..3ba4c7d028e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainMaterial.cpp @@ -33,7 +33,7 @@ #include "W3DDevice/GameClient/TerrainTex.h" #include "W3DDevice/GameClient/HeightMap.h" -TerrainMaterial *TerrainMaterial::m_staticThis = NULL; +TerrainMaterial *TerrainMaterial::m_staticThis = nullptr; static Int defaultMaterialIndex = 0; @@ -46,7 +46,7 @@ Int TerrainMaterial::m_currentBgTexture(6); Bool TerrainMaterial::m_paintingPathingInfo; Bool TerrainMaterial::m_paintingPassable; -TerrainMaterial::TerrainMaterial(CWnd* pParent /*=NULL*/) : +TerrainMaterial::TerrainMaterial(CWnd* pParent /*=nullptr*/) : m_updating(false), m_currentWidth(3) { @@ -141,10 +141,10 @@ void TerrainMaterial::updateLabel(void) AsciiString name = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture); const char *tName = name.str(); - if (tName == NULL || tName[0] == 0) { + if (tName == nullptr || tName[0] == 0) { tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); } - if (tName == NULL) { + if (tName == nullptr) { return; } const char *leaf = tName; @@ -175,7 +175,7 @@ Bool TerrainMaterial::setTerrainTreeViewSelection(HTREEITEM parent, Int selectio char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; @@ -217,7 +217,7 @@ BOOL TerrainMaterial::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_terrainSwatches.ShowWindow(SW_SHOW); m_paintingPathingInfo = false; @@ -247,7 +247,7 @@ HTREEITEM TerrainMaterial::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -496,7 +496,7 @@ BOOL TerrainMaterial::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) } } else if (!(item.state & TVIS_EXPANDEDONCE) ) { HTREEITEM child = m_terrainTreeView.GetChildItem(hItem); - while (child != NULL) { + while (child != nullptr) { hItem = child; child = m_terrainTreeView.GetChildItem(hItem); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp index ad41eebdd37..e27851b0b95 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TerrainModal.cpp @@ -34,7 +34,7 @@ // TerrainModal dialog -TerrainModal::TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent /*=NULL*/) +TerrainModal::TerrainModal(AsciiString path, WorldHeightMapEdit *pMap, CWnd* pParent /*=nullptr*/) : CDialog(TerrainModal::IDD, pParent) { //{{AFX_DATA_INIT(TerrainModal) @@ -60,10 +60,10 @@ void TerrainModal::updateLabel(void) if (!pDoc) return; const char *tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); - if (tName == NULL || tName[0] == 0) { + if (tName == nullptr || tName[0] == 0) { tName = pDoc->GetHeightMap()->getTexClassUiName(m_currentFgTexture).str(); } - if (tName == NULL) { + if (tName == nullptr) { return; } const char *leaf = tName; @@ -98,7 +98,7 @@ BOOL TerrainModal::OnInitDialog() pWnd->GetWindowRect(&rect); ScreenToClient(&rect); rect.DeflateRect(2,2,2,2); - m_terrainSwatches.Create(NULL, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); + m_terrainSwatches.Create(nullptr, "", WS_CHILD, rect, this, IDC_TERRAIN_SWATCHES); m_terrainSwatches.ShowWindow(SW_SHOW); pWnd = GetDlgItem(IDC_MISSING_NAME); @@ -119,7 +119,7 @@ HTREEITEM TerrainModal::findOrAdd(HTREEITEM parent, const char *pLabel) char buffer[_MAX_PATH]; ::memset(&ins, 0, sizeof(ins)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { ins.item.mask = TVIF_HANDLE|TVIF_TEXT; ins.item.hItem = child; ins.item.pszText = buffer; @@ -247,7 +247,7 @@ Bool TerrainModal::setTerrainTreeViewSelection(HTREEITEM parent, Int selection) char buffer[_MAX_PATH]; ::memset(&item, 0, sizeof(item)); HTREEITEM child = m_terrainTreeView.GetChildItem(parent); - while (child != NULL) { + while (child != nullptr) { item.mask = TVIF_HANDLE|TVIF_PARAM; item.hItem = child; item.pszText = buffer; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/TileTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/TileTool.cpp index 4c2be616c08..8ccf0173287 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/TileTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/TileTool.cpp @@ -40,7 +40,7 @@ TileTool::TileTool(void) : Tool(ID_TILE_TOOL, IDC_TILE_CURSOR) { - m_htMapEditCopy = NULL; + m_htMapEditCopy = nullptr; } /// Destructor diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/Tool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/Tool.cpp index 4ad1b4353f0..d0d75ccfd2f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/Tool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/Tool.cpp @@ -36,7 +36,7 @@ Tool::Tool(Int toolID, Int cursorID) { m_toolID = toolID; m_cursorID = cursorID; - m_cursor = NULL; + m_cursor = nullptr; } @@ -59,7 +59,7 @@ void Tool::activate() void Tool::setCursor(void) { - if (m_cursor == NULL) { + if (m_cursor == nullptr) { m_cursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(m_cursorID)); } ::SetCursor(m_cursor); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp index b6295224422..878a03f1909 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp @@ -50,7 +50,7 @@ BOOL CWBFrameWnd::LoadFrame(UINT nIDResource, if (ret) { Int top = ::AfxGetApp()->GetProfileInt(TWO_D_WINDOW_SECTION, "Top", 10); Int left =::AfxGetApp()->GetProfileInt(TWO_D_WINDOW_SECTION, "Left", 10); - this->SetWindowPos(NULL, left, + this->SetWindowPos(nullptr, left, top, 0, 0, SWP_NOZORDER|SWP_NOSIZE); if (!m_cellSizeToolBar.Create(this, IDD_CELL_SLIDER, CBRS_LEFT, IDD_CELL_SLIDER)) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp index be5ce2158b9..9f0d9218ddc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp @@ -71,7 +71,7 @@ void WBHeightMap::setFlattenHeights(Bool flat) #ifndef USE_FLAT_HEIGHT_MAP m_originX = 0; m_originY = 0; - updateBlock(0, 0, m_x-1, m_y-1, m_map, NULL); + updateBlock(0, 0, m_x-1, m_y-1, m_map, nullptr); #endif } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp index fb744e422c7..1d2d782a920 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBPopupSlider.cpp @@ -51,7 +51,7 @@ void WBPopupSliderButton::SetupPopSliderButton if (hbmOld) ::DeleteObject(hbmOld); - hbmOld = NULL; + hbmOld = nullptr; } @@ -61,7 +61,7 @@ void WBPopupSliderButton::SetupPopSliderButton WBPopupSliderButton::WBPopupSliderButton() { - m_owner = NULL; + m_owner = nullptr; } WBPopupSliderButton::~WBPopupSliderButton() @@ -118,7 +118,7 @@ point; ///////////////////////////////////////////////////////////////////////////// // PopupSlider static member variables -PopupSlider *PopupSlider::gPopupSlider = 0; +PopupSlider *PopupSlider::gPopupSlider = nullptr; ///////////////////////////////////////////////////////////////////////////// @@ -226,7 +226,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, DEBUG_ASSERTCRASH(((SB_HORZ == kind) || (SB_VERT == kind)), ("PopupSlider - unexpected kind of slider!")); - DEBUG_ASSERTCRASH(pSliderOwner, ("slider owner is NULL!")); + DEBUG_ASSERTCRASH(pSliderOwner, ("slider owner is null!")); try { CRect rect; @@ -257,7 +257,7 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, } catch (...) { // don't rethrow delete pPopupSlider; - pPopupSlider = NULL; + pPopupSlider = nullptr; } @@ -270,13 +270,13 @@ void PopupSlider::New(CWnd *pParentWnd, long kind, PopupSlider::PopupSlider() { - mSliderOwner = NULL; + mSliderOwner = nullptr; mDraggingThumb = false; mClickThrough = false; mSetOrigPt = false; mEverMoved = false; - mIcon = NULL; + mIcon = nullptr; m_lo = m_hi = m_curValue = 0; m_valOnLastFinished = 0; @@ -289,7 +289,7 @@ PopupSlider::~PopupSlider() (void)bRet; DEBUG_ASSERTCRASH(bRet != 0, ("Oops.")); - mIcon = NULL; + mIcon = nullptr; } } @@ -326,7 +326,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) DWORD dwExStyle = WS_EX_TOPMOST; DWORD dwStyle = WS_POPUP; UINT nClassStyle = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT | CS_SAVEBITS; - HCURSOR hCursor = ::LoadCursor(NULL, IDC_ARROW); + HCURSOR hCursor = ::LoadCursor(nullptr, IDC_ARROW); CString className = AfxRegisterWndClass(nClassStyle, hCursor, (HBRUSH) m_brush3dFaceColor); long winWidth, winHeight; @@ -341,7 +341,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) dwStyle, winRect.left, winRect.top, winRect.Width(), winRect.Height(), pParentWnd->GetSafeHwnd(), - NULL, NULL)) + nullptr, nullptr)) throw(-1); @@ -370,7 +370,7 @@ BOOL PopupSlider::Create(const RECT& rect, CWnd* pParentWnd) CRect myWindowRect; GetWindowRect(&myWindowRect); myWindowRect.OffsetRect(hAdjustToCenter, vAdjustToCenter); - SetWindowPos(NULL, myWindowRect.left, myWindowRect.top, myWindowRect.Width(), myWindowRect.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW); + SetWindowPos(nullptr, myWindowRect.left, myWindowRect.top, myWindowRect.Width(), myWindowRect.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOREDRAW); } // finally, make sure the window appears on screen @@ -400,7 +400,7 @@ void PopupSlider::PostNcDestroy() // now that the window has gone away, delete ourselves if (gPopupSlider == this) { delete gPopupSlider; - gPopupSlider = NULL; + gPopupSlider = nullptr; } } @@ -439,7 +439,7 @@ void PopupSlider::OnPaint() CRect iconRect; GetThumbIconRect(&iconRect); ::DrawIconEx(dc.GetSafeHdc(), iconRect.left, iconRect.top, - mIcon, 0, 0, 0, NULL, DI_NORMAL); + mIcon, 0, 0, 0, nullptr, DI_NORMAL); } // Do not call CWnd::OnPaint() for painting messages } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 186fbd80e79..c2a75804077 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -73,9 +73,9 @@ void WorldHeightMapEdit::init(void) Int i, j; for (i=0; im_alphaEdgeTex); REF_PTR_SET(m_terrainTex, pThis->m_terrainTex); @@ -220,7 +220,7 @@ m_warnTooManyBlend(false) memset(m_cellFlipState,0,numBytesX*numBytesY); //clear all flags memset(m_cellCliffState,0,numBytesX*numBytesY); //clear all flags m_data = new UnsignedByte[m_dataSize + m_width+1]; - if (m_data == NULL) { + if (m_data == nullptr) { AfxMessageBox(IDS_OUT_OF_MEMORY); m_dataSize = 0; } else { @@ -448,7 +448,7 @@ void WorldHeightMapEdit::loadImagesFromTerrainType( TerrainType *terrain ) { // sanity - if( terrain == NULL ) + if( terrain == nullptr ) return; char buffer[ _MAX_PATH ]; @@ -508,14 +508,14 @@ void WorldHeightMapEdit::loadImagesFromTerrainType( TerrainType *terrain ) UnsignedByte * WorldHeightMapEdit::getPointerToClassTileData(Int texClass) { - TileData *pSrc = NULL; + TileData *pSrc = nullptr; if (texClass >= 0 && texClass <= m_numGlobalTextureClasses) { pSrc = m_globalTextureClasses[texClass].tiles[0]; } - if (pSrc != NULL) { + if (pSrc != nullptr) { return(pSrc->getDataPtr()); } - return(NULL); + return(nullptr); } @@ -787,14 +787,14 @@ void WorldHeightMapEdit::saveToFile(DataChunkOutput &chunkWriter) // // duplicate - Makes a copy. -// Returns NULL if allocation failed. +// Returns null if allocation failed. WorldHeightMapEdit *WorldHeightMapEdit::duplicate(void) { WorldHeightMapEdit *newMap = new WorldHeightMapEdit(this); - if (newMap->m_data == NULL) { + if (newMap->m_data == nullptr) { delete newMap; - return(NULL); + return(nullptr); } return(newMap); } @@ -858,7 +858,7 @@ Int WorldHeightMapEdit::getTileIndexFromTerrainType( TerrainType *terrain ) { // sanity - if( terrain == NULL ) + if( terrain == nullptr ) return -1; // search the texture list for a matching texture filename @@ -892,7 +892,7 @@ Int WorldHeightMapEdit::allocateTiles(Int textureClass) m_textureClasses[m_numTextureClasses].isBlendEdgeTile = m_globalTextureClasses[textureClass].isBlendEdgeTile; m_numTextureClasses++; REF_PTR_RELEASE(m_terrainTex); // need to update the texture. - updateTileTexturePositions(NULL); + updateTileTexturePositions(nullptr); for (i=0; iblendNdx; sourceNdx = sourceNdx>>2; pBlendTile = m_sourceTiles[sourceNdx]; - if (pBlendTile == NULL) { + if (pBlendTile == nullptr) { return(-1); } // Make a quick scan through the blended tiles, and see if we already got this one. @@ -1102,7 +1102,7 @@ void WorldHeightMapEdit::blendSpecificTiles(Int xIndex, Int yIndex, Int srcXInde Bool baseNeedsFlip = false; UnsignedByte baseIsDiagonal = 0; Int ndx = (yIndex*m_width)+xIndex; - TBlendTileInfo *baseBlendInfo=NULL; + TBlendTileInfo *baseBlendInfo=nullptr; if (TheGlobalData->m_use3WayTerrainBlends && m_blendTileNdxes[ndx] != 0) { baseBlendInfo=&m_blendedTiles[m_blendTileNdxes[ndx]]; //Figure out if this tile will eventually need flipping when rendered @@ -1215,13 +1215,13 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas for (i=0; im_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int curNdx = (pCurNode->m_y*m_width)+pCurNode->m_x; for (i=pCurNode->m_x-1; im_x+2; i++) { if (i<0) continue; @@ -1282,11 +1282,11 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas } pNodesToProcess = pProcessedNodes; - pProcessedNodes = NULL; + pProcessedNodes = nullptr; while (pNodesToProcess) { CProcessNode *pCurNode = pNodesToProcess; pNodesToProcess = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int curNdx = (pCurNode->m_y*m_width)+pCurNode->m_x; for (i=pCurNode->m_x-1; im_x+2; i++) { if (i<0) continue; @@ -1316,7 +1316,7 @@ void WorldHeightMapEdit::autoBlendOut(Int xIndex, Int yIndex, Int globalEdgeClas } delete[] pProcessed; - pProcessed = NULL; + pProcessed = nullptr; } /****************************************************************** @@ -1506,13 +1506,13 @@ Bool WorldHeightMapEdit::floodFill(Int xIndex, Int yIndex, Int textureClass, Boo } } } else { - CProcessNode *pNodesToProcess = NULL; + CProcessNode *pNodesToProcess = nullptr; Int nodesProcessed = 0; pNodesToProcess = new CProcessNode(xIndex, yIndex); while (pNodesToProcess) { CProcessNode *pCurNode = pNodesToProcess; pNodesToProcess = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; Int ndx = (pCurNode->m_y*m_width)+pCurNode->m_x; Int blendNdx = m_blendTileNdxes[ndx]; setTileNdx(pCurNode->m_x, pCurNode->m_y, textureClass, false); @@ -1982,7 +1982,7 @@ void WorldHeightMapEdit::removeFirstObject(void) { MapObject *firstObj = MapObject::TheMapObjectListPtr; MapObject::TheMapObjectListPtr = firstObj->getNext(); - firstObj->setNextMap(NULL); // so we don't delete the whole list. + firstObj->setNextMap(nullptr); // so we don't delete the whole list. deleteInstance(firstObj); } @@ -1996,7 +1996,7 @@ Bool WorldHeightMapEdit::selectDuplicates(void) const float DELTA = 0.05f; MapObject *firstObj = MapObject::TheMapObjectListPtr; MapObject *pObj; -// MapObject *pPrevRoad = NULL; +// MapObject *pPrevRoad = nullptr; Bool anySelected = false; for (pObj=firstObj; pObj; pObj=pObj->getNext()) { pObj->setSelected(false); @@ -2020,7 +2020,7 @@ Bool WorldHeightMapEdit::selectDuplicates(void) } if (pObj->getFlag(FLAG_ROAD_FLAGS)) { - if (pObj->getNext() == NULL) continue; + if (pObj->getNext() == nullptr) continue; if (!pObj->getFlag(FLAG_ROAD_POINT1)) { continue; } @@ -2080,7 +2080,7 @@ Bool WorldHeightMapEdit::selectSimilar(void) return false; } - for (otherObj=firstObj; otherObj != NULL; otherObj=otherObj->getNext()) { + for (otherObj=firstObj; otherObj != nullptr; otherObj=otherObj->getNext()) { if (otherObj->getName() != selectedObj->getName()) { continue; // names don't match. } @@ -2178,7 +2178,7 @@ Bool WorldHeightMapEdit::selectInvalidTeam(void) if (anySelected) { DEBUG_LOG(("%s", report.str())); - MessageBox(NULL, report.str(), "Missing team report", MB_OK); + MessageBox(nullptr, report.str(), "Missing team report", MB_OK); } return anySelected; @@ -2227,15 +2227,15 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) for (i=0; im_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; - if (pNodesToProcess == NULL) { + if (pNodesToProcess == nullptr) { if (pMutantNodes) { pNodesToProcess = pMutantNodes; pMutantNodes = pMutantNodes->m_next; - pNodesToProcess->m_next = NULL; + pNodesToProcess->m_next = nullptr; pProcessTail = pNodesToProcess; } } @@ -2428,7 +2428,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (uvRange.hi.ym_x-1; im_x+2; i++) { if (i<0) continue; @@ -2479,16 +2479,16 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) if (cliffInfo.mutant) { pNodes[curNdx]->m_next = pMutantNodes; pMutantNodes = pNodes[curNdx]; - pNodes[curNdx] = NULL; + pNodes[curNdx] = nullptr; } else { if (pProcessTail) { pProcessTail->m_next = pNodes[curNdx]; } pProcessTail = pNodes[curNdx]; - if (pNodesToProcess == NULL) { + if (pNodesToProcess == nullptr) { pNodesToProcess = pNodes[curNdx]; } - pNodes[curNdx] = NULL; + pNodes[curNdx] = nullptr; } } else { k = 0; @@ -2505,7 +2505,7 @@ Bool WorldHeightMapEdit::doCliffAdjustment(Int xIndex, Int yIndex) while (pUnCliffyNodes) { CProcessNode *pCurNode = pUnCliffyNodes; pUnCliffyNodes = pCurNode->m_next; - pCurNode->m_next = NULL; + pCurNode->m_next = nullptr; ndx = (pCurNode->m_y*m_width)+pCurNode->m_x; if (!pProcessed[ndx]) { m_cliffInfoNdxes[ndx] = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp index d69fce7bd98..b49edde496e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterOptions.cpp @@ -34,7 +34,7 @@ #include "Common/WellKnownKeys.h" #include "LayersList.h" -WaterOptions *WaterOptions::m_staticThis = NULL; +WaterOptions *WaterOptions::m_staticThis = nullptr; Int WaterOptions::m_waterHeight = 7; Int WaterOptions::m_waterPointSpacing = MAP_XY_FACTOR; Bool WaterOptions::m_creatingWaterAreas = false; @@ -42,8 +42,8 @@ Bool WaterOptions::m_creatingWaterAreas = false; /// WaterOptions dialog trivial construstor - Create does the real work. -WaterOptions::WaterOptions(CWnd* pParent /*=NULL*/): -m_moveUndoable(NULL) +WaterOptions::WaterOptions(CWnd* pParent /*=nullptr*/): +m_moveUndoable(nullptr) { //{{AFX_DATA_INIT(WaterOptions) // NOTE: the ClassWizard will add member initialization here @@ -88,7 +88,7 @@ void WaterOptions::updateTheUI(void) } pButton = (CButton*)GetDlgItem(IDC_MAKE_RIVER); pButton->SetCheck(isRiver ? 1:0); - pButton->EnableWindow(theTrigger!=NULL); + pButton->EnableWindow(theTrigger!=nullptr); pWnd = m_staticThis->GetDlgItem(IDC_SPACING); char buffer[12]; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterTool.cpp index d2fb28cf319..f1c22892fee 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaterTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaterTool.cpp @@ -124,12 +124,12 @@ void WaterTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldB void WaterTool::setCursor(void) { if (m_poly_mouseUpPlus || (m_poly_isAdding && m_poly_curSelectedPolygon)) { - if (m_poly_plusCursor == NULL) { + if (m_poly_plusCursor == nullptr) { m_poly_plusCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_WATER_PLUS)); } ::SetCursor(m_poly_plusCursor); } else if (m_poly_mouseUpMove) { - if (m_poly_moveCursor == NULL) { + if (m_poly_moveCursor == nullptr) { m_poly_moveCursor = AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_WATER_MOVE)); } ::SetCursor(m_poly_moveCursor); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointOptions.cpp index cf0000da9ac..e2619e20760 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointOptions.cpp @@ -34,13 +34,13 @@ #include "Common/WellKnownKeys.h" #include "LayersList.h" -WaypointOptions *WaypointOptions::m_staticThis = NULL; +WaypointOptions *WaypointOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// /// WaypointOptions dialog trivial construstor - Create does the real work. -WaypointOptions::WaypointOptions(CWnd* pParent /*=NULL*/): -m_moveUndoable(NULL) +WaypointOptions::WaypointOptions(CWnd* pParent /*=nullptr*/): +m_moveUndoable(nullptr) { //{{AFX_DATA_INIT(WaypointOptions) // NOTE: the ClassWizard will add member initialization here @@ -58,7 +58,7 @@ void WaypointOptions::DoDataExchange(CDataExchange* pDX) MapObject *WaypointOptions::getSingleSelectedWaypoint(void) { - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; MapObject *pMapObj; @@ -74,13 +74,13 @@ MapObject *WaypointOptions::getSingleSelectedWaypoint(void) return theMapObj; } - return(NULL); + return(nullptr); } PolygonTrigger *WaypointOptions::getSingleSelectedPolygon(void) { CWorldBuilderDoc *pDoc = CWorldBuilderDoc::GetActiveDoc(); - if (pDoc==NULL) return NULL; + if (pDoc==nullptr) return nullptr; WbView3d *p3View = pDoc->GetActive3DView(); Bool showPoly = false; if (p3View) { @@ -93,7 +93,7 @@ PolygonTrigger *WaypointOptions::getSingleSelectedPolygon(void) } } } - return(NULL); + return(nullptr); } void WaypointOptions::updateTheUI(void) @@ -522,7 +522,7 @@ void WaypointOptions::OnEditchangeWaypointlabel1Edit() void WaypointOptions::changeWaypointLabel(Int editControlID, NameKeyType key) { MapObject *theMapObj = getSingleSelectedWaypoint(); - if (theMapObj==NULL) return; + if (theMapObj==nullptr) return; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); if (!pDoc->isWaypointLinked(theMapObj)) { return; @@ -552,7 +552,7 @@ void WaypointOptions::OnEditchangeWaypointlabel3Edit() void WaypointOptions::OnWaypointBidirectional() { MapObject *theMapObj = getSingleSelectedWaypoint(); - if (theMapObj==NULL) return; + if (theMapObj==nullptr) return; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); if (!pDoc->isWaypointLinked(theMapObj)) { return; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointTool.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointTool.cpp index 72a2506c656..fa6b63185ea 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WaypointTool.cpp @@ -100,7 +100,7 @@ MapObject *WaypointTool::pickWaypoint(Coord3D loc){ return pObj; } } - return NULL; + return nullptr; } @@ -119,7 +119,7 @@ void WaypointTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor WaypointOptions::update(); } else { pView->snapPoint(&docPt); - MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); Int id = pDoc->getNextWaypointID(); AsciiString name = WaypointOptions::GenerateUniqueName(id); pNew->setSelected(true); @@ -130,7 +130,7 @@ void WaypointTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWor AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pNew); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. m_downWaypointID = id; WaypointOptions::update(); } @@ -164,9 +164,9 @@ void WaypointTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld MapObject *pObj; PointerTool::clearSelection(); pObj = pickWaypoint(docPt); - if (pObj == NULL) { + if (pObj == nullptr) { pView->snapPoint(&docPt); - MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, NULL, NULL ); + MapObject *pNew = newInstance( MapObject)(docPt, "*Waypoints/Waypoint", 0, 0, nullptr, nullptr ); Int id = pDoc->getNextWaypointID(); AsciiString name; name.format("Waypoint %d", id); @@ -179,7 +179,7 @@ void WaypointTool::mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. pObj = pNew; - pNew = NULL; // undoable owns it now. + pNew = nullptr; // undoable owns it now. } if (pObj) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index ba2930f30a0..7671d40057a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -87,17 +87,17 @@ static SubsystemInterfaceList TheSubsystemListRecord; template -void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = NULL, const char* path2 = NULL) +void initSubsystem(SUBSYSTEM*& sysref, SUBSYSTEM* sys, const char* path1 = nullptr, const char* path2 = nullptr) { sysref = sys; - TheSubsystemListRecord.initSubsystem(sys, path1, path2, NULL); + TheSubsystemListRecord.initSubsystem(sys, path1, path2, nullptr); } #define APP_SECTION "WorldbuilderApp" #define OPEN_FILE_DIR "OpenDirectory" -Win32Mouse *TheWin32Mouse = NULL; +Win32Mouse *TheWin32Mouse = nullptr; const char *gAppPrefix = "wb_"; /// So WB can have a different debug log file name. const Char *g_strFile = "data\\Generals.str"; const Char *g_csfFile = "data\\%s\\Generals.csf"; @@ -160,7 +160,7 @@ FileClass * WB_W3DFileSystem::Get_File( char const *filename ) // The one and only CWorldBuilderApp object static CWorldBuilderApp theApp; -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; /** * The ApplicationHInstance is needed for the WOL code, @@ -168,9 +168,9 @@ HWND ApplicationHWnd = NULL; * Of course, the WOL code is in gameengine, while the * HINSTANCE is only in the various projects' main files. * So, we need to create the HINSTANCE, even if it always - * stays NULL. Just to make COM happy. Whee. + * stays null. Just to make COM happy. Whee. */ -HINSTANCE ApplicationHInstance = NULL; +HINSTANCE ApplicationHInstance = nullptr; ///////////////////////////////////////////////////////////////////////////// // CWorldBuilderApp @@ -196,15 +196,15 @@ static Int gFirstCP = 0; // CWorldBuilderApp construction CWorldBuilderApp::CWorldBuilderApp() : - m_curTool(NULL), - m_selTool(NULL), + m_curTool(nullptr), + m_selTool(nullptr), m_lockCurTool(0), - m_3dtemplate(NULL), - m_pasteMapObjList(NULL) + m_3dtemplate(nullptr), + m_pasteMapObjList(nullptr) { for (Int i=0; igetPath_UserData().str()); - CreateDirectory(buf, NULL); + CreateDirectory(buf, nullptr); // read the water settings from INI (must do prior to initing GameClient, apparently) - ini.loadFileDirectory( "Data\\INI\\Default\\Water", INI_LOAD_OVERWRITE, NULL ); - ini.loadFileDirectory( "Data\\INI\\Water", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\INI\\Default\\Water", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\Water", INI_LOAD_OVERWRITE, nullptr ); initSubsystem(TheGameText, CreateGameTextInterface()); initSubsystem(TheScienceStore, new ScienceStore(), "Data\\INI\\Default\\Science", "Data\\INI\\Science"); @@ -391,10 +391,10 @@ BOOL CWorldBuilderApp::InitInstance() TheScriptEngine->turnBreezeOff(); // stop the tree sway. // [2/11/2003] - ini.loadFileDirectory( "Data\\Scripts\\Scripts", INI_LOAD_OVERWRITE, NULL ); + ini.loadFileDirectory( "Data\\Scripts\\Scripts", INI_LOAD_OVERWRITE, nullptr ); // need this before TheAudio in case we're running off of CD - TheAudio can try to open Music.big on the CD... - initSubsystem(TheCDManager, CreateCDManager(), NULL); + initSubsystem(TheCDManager, CreateCDManager(), nullptr); initSubsystem(TheAudio, (AudioManager*)new MilesAudioManager()); if (!TheAudio->isMusicAlreadyLoaded()) return FALSE; @@ -403,16 +403,16 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheModuleFactory, (ModuleFactory*)(new W3DModuleFactory())); initSubsystem(TheSidesList, new SidesList()); initSubsystem(TheCaveSystem, new CaveSystem()); - initSubsystem(TheRankInfoStore, new RankInfoStore(), NULL, "Data\\INI\\Rank"); + initSubsystem(TheRankInfoStore, new RankInfoStore(), nullptr, "Data\\INI\\Rank"); initSubsystem(ThePlayerTemplateStore, new PlayerTemplateStore(), "Data\\INI\\Default\\PlayerTemplate", "Data\\INI\\PlayerTemplate"); initSubsystem(TheSpecialPowerStore, new SpecialPowerStore(), "Data\\INI\\Default\\SpecialPower", "Data\\INI\\SpecialPower" ); initSubsystem(TheParticleSystemManager, (ParticleSystemManager*)(new W3DParticleSystemManager())); initSubsystem(TheFXListStore, new FXListStore(), "Data\\INI\\Default\\FXList", "Data\\INI\\FXList"); - initSubsystem(TheWeaponStore, new WeaponStore(), NULL, "Data\\INI\\Weapon"); + initSubsystem(TheWeaponStore, new WeaponStore(), nullptr, "Data\\INI\\Weapon"); initSubsystem(TheObjectCreationListStore, new ObjectCreationListStore(), "Data\\INI\\Default\\ObjectCreationList", "Data\\INI\\ObjectCreationList"); - initSubsystem(TheLocomotorStore, new LocomotorStore(), NULL, "Data\\INI\\Locomotor"); - initSubsystem(TheDamageFXStore, new DamageFXStore(), NULL, "Data\\INI\\DamageFX"); - initSubsystem(TheArmorStore, new ArmorStore(), NULL, "Data\\INI\\Armor"); + initSubsystem(TheLocomotorStore, new LocomotorStore(), nullptr, "Data\\INI\\Locomotor"); + initSubsystem(TheDamageFXStore, new DamageFXStore(), nullptr, "Data\\INI\\DamageFX"); + initSubsystem(TheArmorStore, new ArmorStore(), nullptr, "Data\\INI\\Armor"); initSubsystem(TheThingFactory, new ThingFactory(), "Data\\INI\\Default\\Object", "Data\\INI\\Object"); initSubsystem(TheCrateSystem, new CrateSystem(), "Data\\INI\\Default\\Crate", "Data\\INI\\Crate"); initSubsystem(TheUpgradeCenter, new UpgradeCenter, "Data\\INI\\Default\\Upgrade", "Data\\INI\\Upgrade"); @@ -492,12 +492,12 @@ BOOL CWorldBuilderApp::InitInstance() BOOL CWorldBuilderApp::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { - // If pHandlerInfo is NULL, then handle the message - if (pHandlerInfo == NULL) + // If pHandlerInfo is null, then handle the message + if (pHandlerInfo == nullptr) { for (Int i=0; igetToolID()) { if (nCode == CN_COMMAND) { @@ -653,16 +653,16 @@ int CWorldBuilderApp::ExitInstance() WorldHeightMapEdit::shutdown(); delete TheFramePacer; - TheFramePacer = NULL; + TheFramePacer = nullptr; delete TheFileSystem; - TheFileSystem = NULL; + TheFileSystem = nullptr; delete TheW3DFileSystem; - TheW3DFileSystem = NULL; + TheW3DFileSystem = nullptr; delete TheNameKeyGenerator; - TheNameKeyGenerator = NULL; + TheNameKeyGenerator = nullptr; #ifdef MEMORYPOOL_CHECKPOINTING Int lastCP = TheMemoryPoolFactory->debugSetCheckpoint(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index dae135ea3e4..ebc31b3180e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -127,8 +127,8 @@ END_MESSAGE_MAP() // CWorldBuilderDoc construction/destruction CWorldBuilderDoc::CWorldBuilderDoc() : - m_heightMap(NULL), - m_undoList(NULL), + m_heightMap(nullptr), + m_undoList(nullptr), m_maxUndos(MAX_UNDOS), /// @todo: get from pref? m_curRedo(0), m_needAutosave(false), @@ -142,7 +142,7 @@ CWorldBuilderDoc::CWorldBuilderDoc() : CWorldBuilderDoc::~CWorldBuilderDoc() { #ifdef ONLY_ONE_AT_A_TIME - if (m_heightMap != NULL ) { + if (m_heightMap != nullptr ) { gAlreadyOpen = false; } #endif @@ -270,9 +270,9 @@ class CompressedCachedMFCFileOutputStream : public OutputStream m_file->Write(srcBuffer, m_totalBytes); } delete[] srcBuffer; - srcBuffer = NULL; + srcBuffer = nullptr; delete[] destBuffer; - destBuffer = NULL; + destBuffer = nullptr; } }; @@ -303,7 +303,7 @@ void CWorldBuilderDoc::Serialize(CArchive& ar) chunkWriter->closeDataChunk(); delete chunkWriter; - chunkWriter = NULL; + chunkWriter = nullptr; theStream.flush(); } catch(...) { const char *msg = "WorldHeightMapEdit::WorldHeightMapEdit height map file write failed: "; @@ -412,7 +412,7 @@ void CWorldBuilderDoc::Serialize(CArchive& ar) REF_PTR_RELEASE(m_undoList); m_curRedo = 0; POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -573,7 +573,7 @@ void CWorldBuilderDoc::validate(void) // swapDict contains a 'history' of missing model swaps done this load, so all objects with a // particular name are replaced with the exact same model. AsciiString name = pMapObj->getName(); - if (pMapObj->getThingTemplate() == NULL) + if (pMapObj->getThingTemplate() == nullptr) { Bool exists = false; swapName = swapDict.getAsciiString(NAMEKEY(name), &exists); @@ -675,12 +675,12 @@ void CWorldBuilderDoc::OnJumpToGame() DoFileSave(); CString filename; DEBUG_LOG(("strTitle=%s strPathName=%s", m_strTitle, m_strPathName)); - if (strstr(m_strPathName, TheGlobalData->getPath_UserData().str()) != NULL) + if (strstr(m_strPathName, TheGlobalData->getPath_UserData().str()) != nullptr) filename.Format("%sMaps\\%s", TheGlobalData->getPath_UserData().str(), static_cast(m_strTitle)); else filename.Format("Maps\\%s", static_cast(m_strTitle)); - /*int retval =*/ _spawnl(_P_NOWAIT, "\\projects\\rts\\run\\rtsi.exe", "ignored", "-scriptDebug", "-win", "-file", static_cast(filename), NULL); + /*int retval =*/ _spawnl(_P_NOWAIT, "\\projects\\rts\\run\\rtsi.exe", "ignored", "-scriptDebug", "-win", "-file", static_cast(filename), nullptr); } catch (...) { } } @@ -696,7 +696,7 @@ BOOL CWorldBuilderDoc::DoFileSave() } // File does not exist, dwAttrib==0xffffffff // we do not have read-write access or the file does not (now) exist - if (!DoSave(NULL)) + if (!DoSave(nullptr)) { TRACE0("Warning: File save with new name failed.\n"); return FALSE; @@ -716,7 +716,7 @@ BOOL CWorldBuilderDoc::DoFileSave() BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) // Save the document data to a file // lpszPathName = path name where to save document file - // if lpszPathName is NULL then the user will be prompted (SaveAs) + // if lpszPathName is null then the user will be prompted (SaveAs) // note: lpszPathName can be different than 'm_strPathName' // if 'bReplace' is TRUE will change file name if successful (SaveAs) // if 'bReplace' is FALSE will not change path name (SaveCopyAs) @@ -725,7 +725,7 @@ BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) if (newName.IsEmpty()) { CDocTemplate* pTemplate = GetDocTemplate(); - ASSERT(pTemplate != NULL); + ASSERT(pTemplate != nullptr); newName = m_strPathName; if (bReplace && newName.IsEmpty()) @@ -793,7 +793,7 @@ BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) if (!OnSaveDocument(newName)) { - if (lpszPathName == NULL) + if (lpszPathName == nullptr) { // be sure to delete the file try @@ -925,7 +925,7 @@ void CWorldBuilderDoc::SetHeightMap(WorldHeightMapEdit *pMap, Bool doUpdate) REF_PTR_SET(m_heightMap, pMap); if (doUpdate) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -941,7 +941,7 @@ void CWorldBuilderDoc::AddAndDoUndoable(Undoable *pUndo) { Undoable *pCurUndo = m_undoList; Int count = m_curRedo; - while(count>0 && pCurUndo != NULL) { + while(count>0 && pCurUndo != nullptr) { count--; pCurUndo = pCurUndo->GetNext(); } @@ -957,7 +957,7 @@ void CWorldBuilderDoc::AddAndDoUndoable(Undoable *pUndo) while (pCurUndo) { count++; if (count >= MAX_UNDOS) { - pCurUndo->LinkNext(NULL); + pCurUndo->LinkNext(nullptr); break; } pCurUndo = pCurUndo->GetNext(); @@ -975,7 +975,7 @@ void CWorldBuilderDoc::OnEditRedo() count--; pUndo = pUndo->GetNext(); } - DEBUG_ASSERTCRASH((pUndo != NULL),("oops")); + DEBUG_ASSERTCRASH((pUndo != nullptr),("oops")); if (pUndo) { pUndo->Redo(); SetModifiedFlag(); @@ -986,7 +986,7 @@ void CWorldBuilderDoc::OnEditRedo() void CWorldBuilderDoc::OnUpdateEditRedo(CCmdUI* pCmdUI) { - pCmdUI->Enable(m_undoList!=NULL && m_curRedo>0); + pCmdUI->Enable(m_undoList!=nullptr && m_curRedo>0); } void CWorldBuilderDoc::OnEditUndo() @@ -995,11 +995,11 @@ void CWorldBuilderDoc::OnEditUndo() m_needAutosave = true; m_waypointTableNeedsUpdate=true; Int count = m_curRedo; - while(count>0 && pUndo != NULL) { + while(count>0 && pUndo != nullptr) { count--; pUndo = pUndo->GetNext(); } - if (pUndo != NULL) { + if (pUndo != nullptr) { pUndo->Undo(); SetModifiedFlag(); m_curRedo++; @@ -1018,17 +1018,17 @@ void CWorldBuilderDoc::OnTogglePitchAndRotation( void ) void CWorldBuilderDoc::OnUpdateEditUndo(CCmdUI* pCmdUI) { Bool canUndo=false; - if (m_undoList!=NULL) { + if (m_undoList!=nullptr) { if (m_curRedo == 0) { canUndo = true; // haven't undone any yet. } else { Undoable *pUndo = m_undoList; Int count = m_curRedo; - while(count>0 && pUndo != NULL) { + while(count>0 && pUndo != nullptr) { count--; pUndo = pUndo->GetNext(); } - canUndo = pUndo != NULL; + canUndo = pUndo != nullptr; } } pCmdUI->Enable(canUndo); @@ -1048,7 +1048,7 @@ void CWorldBuilderDoc::OnTsCanonical() if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->optimizeTiles()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); @@ -1084,7 +1084,7 @@ void CWorldBuilderDoc::OnFileResize() } WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; Coord3D objOffset; if (htMapEditCopy->resize(hi.xExtent, hi.yExtent, hi.initialHeight, hi.borderWidth, hi.anchorTop, hi.anchorBottom, hi.anchorLeft, hi.anchorRight, &objOffset)) { // does all the work. @@ -1094,7 +1094,7 @@ void CWorldBuilderDoc::OnFileResize() POSITION pos = GetFirstViewPosition(); IRegion2D partialRange = {0,0,0,0}; Get3DView()->updateHeightMapInView(m_heightMap, false, partialRange); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1114,7 +1114,7 @@ void CWorldBuilderDoc::OnTsRemap() { if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->remapTextures()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); @@ -1150,7 +1150,7 @@ void CWorldBuilderDoc::OnTsRemap() // only works for SDI, not MDI return (CWorldBuilderDoc*)CMainFrame::GetMainFrame()->GetActiveDocument(); #endif - return NULL; + return nullptr; } /* static */ CWorldBuilderView *CWorldBuilderDoc::GetActive2DView() @@ -1159,7 +1159,7 @@ void CWorldBuilderDoc::OnTsRemap() if (pDoc) { return pDoc->Get2DView(); } - return NULL; + return nullptr; } /* static */ WbView3d *CWorldBuilderDoc::GetActive3DView() @@ -1168,33 +1168,33 @@ void CWorldBuilderDoc::OnTsRemap() if (pDoc) { return pDoc->Get3DView(); } - return NULL; + return nullptr; } CWorldBuilderView *CWorldBuilderDoc::Get2DView() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CWorldBuilderView))) return (CWorldBuilderView*)pView; } - return NULL; + return nullptr; } WbView3d *CWorldBuilderDoc::Get3DView() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(WbView3d))) return (WbView3d*)pView; } - return NULL; + return nullptr; } void CWorldBuilderDoc::Create2DView() @@ -1212,8 +1212,8 @@ void CWorldBuilderDoc::Create3DView() CDocTemplate* pTemplate = WbApp()->Get3dTemplate(); IRegion2D partialRange = {0,0,0,0}; ASSERT_VALID(pTemplate); - CFrameWnd* pFrame = pTemplate->CreateNewFrame(this, NULL); - if (pFrame == NULL) + CFrameWnd* pFrame = pTemplate->CreateNewFrame(this, nullptr); + if (pFrame == nullptr) { TRACE0("Warning: failed to create new frame.\n"); return; // command failed @@ -1310,7 +1310,7 @@ BOOL CWorldBuilderDoc::OnNewDocument() Create3DView(); POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1326,7 +1326,7 @@ BOOL CWorldBuilderDoc::OnNewDocument() void CWorldBuilderDoc::invalObject(MapObject *pMapObj) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1338,7 +1338,7 @@ void CWorldBuilderDoc::invalObject(MapObject *pMapObj) void CWorldBuilderDoc::invalCell(int xIndex, int yIndex) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1353,7 +1353,7 @@ void CWorldBuilderDoc::syncViewCenters(Real x, Real y) return; POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1366,7 +1366,7 @@ void CWorldBuilderDoc::syncViewCenters(Real x, Real y) void CWorldBuilderDoc::updateAllViews() { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1378,7 +1378,7 @@ void CWorldBuilderDoc::updateAllViews() void CWorldBuilderDoc::updateHeightMap(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange) { POSITION pos = GetFirstViewPosition(); - while (pos != NULL) + while (pos != nullptr) { CView* pView = GetNextView(pos); WbView* pWView = (WbView *)pView; @@ -1406,7 +1406,7 @@ BOOL CWorldBuilderDoc::OnOpenDocument(LPCTSTR lpszPathName) TheGameText->reset(); AsciiString s = lpszPathName; const char* lastSep = s.reverseFind('\\'); - if (lastSep != NULL) + if (lastSep != nullptr) { s.truncateTo(lastSep - s.str() + 1); } @@ -1415,7 +1415,7 @@ BOOL CWorldBuilderDoc::OnOpenDocument(LPCTSTR lpszPathName) TheGameText->initMapStringFile(s); WbApp()->setCurrentDirectory(AsciiString(buf)); - ::GetModuleFileName(NULL, buf, sizeof(buf)); + ::GetModuleFileName(nullptr, buf, sizeof(buf)); if (char *pEnd = strrchr(buf, '\\')) { *pEnd = 0; } @@ -1443,7 +1443,7 @@ Bool CWorldBuilderDoc::getCellIndexFromCoord(Coord3D cpt, CPoint *ndxP) Bool inMap = true; WorldHeightMapEdit *pMap = GetHeightMap(); - if (pMap == NULL) return false; + if (pMap == nullptr) return false; Int xIndex = floor(cpt.x/MAP_XY_FACTOR); xIndex += pMap->getBorderSize(); @@ -1548,7 +1548,7 @@ Bool CWorldBuilderDoc::getCellPositionFromCoord(Coord3D cpt, Coord3D *locP) locP->x = -1; locP->y = -1; WorldHeightMapEdit *pMap = GetHeightMap(); - if (pMap == NULL) return(false); + if (pMap == nullptr) return(false); // yLocation = pMap->getYExtent() - yLocation; CPoint curNdx; if (getCellIndexFromCoord(cpt, &curNdx)) { @@ -1645,7 +1645,7 @@ void CWorldBuilderDoc::compressWaypointIds(void) { updateWaypointTable(); m_curWaypointID = 0; - MapObject *pMapObj = NULL; + MapObject *pMapObj = nullptr; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->isWaypoint()) { Int nwpid = getNextWaypointID(); @@ -1701,17 +1701,17 @@ void CWorldBuilderDoc::updateWaypointTable(void) m_waypointTableNeedsUpdate=false; Int i; for (i=0; igetNext()) { if (pMapObj->isWaypoint()) { Int id = pMapObj->getWaypointID(); DEBUG_ASSERTCRASH(id>0 && id0 && idsetWaypointID(getNextWaypointID()); m_waypointTableNeedsUpdate=true; } else { @@ -1779,9 +1779,9 @@ MapObject *CWorldBuilderDoc::getWaypointByID(Int waypointID) if (pObj && pObj->isWaypoint()) { return pObj; } - DEBUG_ASSERTCRASH(pObj==NULL, ("Waypoint links to an obj that isn't a waypoint.")); + DEBUG_ASSERTCRASH(pObj==nullptr, ("Waypoint links to an obj that isn't a waypoint.")); } - return NULL; + return nullptr; } //============================================================================= @@ -1862,13 +1862,13 @@ void CWorldBuilderDoc::updateLWL(MapObject *pWay, MapObject *pSrcWay) } MapObject *pCurWay = pWay; - pWay = NULL; + pWay = nullptr; Int i; for (i=0; i=0 && waypointID1getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; writeRawDict( theLogFile, "MapObject",d ); writeRawDict( theLogFile, "MapObjectTeam",teamDict ); } @@ -2196,7 +2196,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) if (tt->getEditorSorting() == ES_STRUCTURE) { Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; Bool showScript = false; @@ -2236,7 +2236,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) Bool exists; Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; Int veterancy = d->getInt(TheKey_objectVeterancy, &exists); @@ -2335,7 +2335,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) if (tt->getEditorSorting() == ES_MISC_MAN_MADE) { Dict *d = pMapObj->getProperties(); TeamsInfo *teamInfo = TheSidesList->findTeamInfo(d->getAsciiString(TheKey_originalOwner)); - Dict *teamDict = (teamInfo)?teamInfo->getDict():NULL; + Dict *teamDict = (teamInfo)?teamInfo->getDict():nullptr; AsciiString objectOwnerName = (teamDict)?teamDict->getAsciiString(TheKey_teamOwner):noOwner; @@ -2614,7 +2614,7 @@ void CWorldBuilderDoc::OnRemoveclifftexmapping() if (m_heightMap) { WorldHeightMapEdit *htMapEditCopy = GetHeightMap()->duplicate(); - if (htMapEditCopy == NULL) return; + if (htMapEditCopy == nullptr) return; if (htMapEditCopy->removeCliffMapping()) { // does all the work. IRegion2D partialRange = {0,0,0,0}; updateHeightMap(htMapEditCopy, false, partialRange); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp index 2f9c4a74bc4..880f70a412d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderView.cpp @@ -268,7 +268,7 @@ void CWorldBuilderView::OnPaint() WorldHeightMapEdit *pMap = getTrackingHeightMap(); // If no map yet, there is nothing to draw. - if (pMap==NULL) return; + if (pMap==nullptr) return; Int minJ = 0; Int minI = 0; @@ -358,11 +358,11 @@ void CWorldBuilderView::OnPaint() ::Sleep(5); #endif Int width = m_cellSize; - UnsignedByte *pData = NULL; + UnsignedByte *pData = nullptr; if (m_showTexture) { } // Draw the texture if we have one, else the height color. - if ((pData!=NULL)) { + if ((pData!=nullptr)) { drawMyTexture(&dc, &rect, width, pData); } else { dc.FillSolidRect(&rect, getColorForHeight(ht)); @@ -416,7 +416,7 @@ void CWorldBuilderView::OnPaint() //============================================================================= void CWorldBuilderView::invalObjectInView(MapObject *pMapObj) { - if (pMapObj == NULL) { + if (pMapObj == nullptr) { Invalidate(false); return; } @@ -938,7 +938,7 @@ void CWorldBuilderView::scrollInView(Real xScroll, Real yScroll, Bool end) CPoint pt((client.left+client.right)/2+mXScrollOffset, (client.bottom+client.top)/2+mYScrollOffset); CWorldBuilderDoc* pDoc = WbDoc(); WorldHeightMapEdit *pMap = pDoc->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; m_centerPt.X = (Real)(pt.x)/m_cellSize; m_centerPt.Y = pMap->getYExtent() - (Real)(pt.y)/m_cellSize; constrainCenterPt(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp index 21e6149dc0f..f1ca63b41b6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/addplayerdialog.cpp @@ -32,7 +32,7 @@ // AddPlayerDialog dialog -AddPlayerDialog::AddPlayerDialog(AsciiString side, CWnd* pParent /*=NULL*/) +AddPlayerDialog::AddPlayerDialog(AsciiString side, CWnd* pParent /*=nullptr*/) : CDialog(AddPlayerDialog::IDD, pParent) { //{{AFX_DATA_INIT(AddPlayerDialog) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp index f8c50586f1a..357786b6279 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/brushoptions.cpp @@ -26,7 +26,7 @@ #include "WorldBuilderView.h" #include "BrushTool.h" -BrushOptions *BrushOptions::m_staticThis = NULL; +BrushOptions *BrushOptions::m_staticThis = nullptr; Int BrushOptions::m_currentWidth = 0; Int BrushOptions::m_currentHeight = 0; Int BrushOptions::m_currentFeather = 0; @@ -34,7 +34,7 @@ Int BrushOptions::m_currentFeather = 0; /// BrushOptions dialog trivial construstor - Create does the real work. -BrushOptions::BrushOptions(CWnd* pParent /*=NULL*/) +BrushOptions::BrushOptions(CWnd* pParent /*=nullptr*/) { //{{AFX_DATA_INIT(BrushOptions) // NOTE: the ClassWizard will add member initialization here diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index 2b0bab87209..a9cc0dfd1ba 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -44,25 +44,25 @@ const char* NEUTRAL_TEAM_INTERNAL_STR = "team"; ///////////////////////////////////////////////////////////////////////////// // MapObjectProps dialog -/*static*/ MapObjectProps *MapObjectProps::TheMapObjectProps = NULL; +/*static*/ MapObjectProps *MapObjectProps::TheMapObjectProps = nullptr; void MapObjectProps::makeMain() { - DEBUG_ASSERTCRASH(TheMapObjectProps == NULL, ("already have a main props")); - if (TheMapObjectProps == NULL) + DEBUG_ASSERTCRASH(TheMapObjectProps == nullptr, ("already have a main props")); + if (TheMapObjectProps == nullptr) TheMapObjectProps = this; } -MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParent /*=NULL*/) : +MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParent /*=nullptr*/) : COptionsPanel(MapObjectProps::IDD, pParent), m_dictToEdit(dictToEdit), m_title(title), - m_selectedObject(NULL), - m_dictSource(NULL), + m_selectedObject(nullptr), + m_dictSource(nullptr), m_scale( 1.0f ), m_height( 0 ), - m_posUndoable( NULL ), + m_posUndoable( nullptr ), m_angle( 0 ), m_defaultEntryIndex(0), m_defaultIsNone(true) @@ -77,9 +77,9 @@ MapObjectProps::MapObjectProps(Dict* dictToEdit, const char* title, CWnd* pParen MapObjectProps::~MapObjectProps() { if (TheMapObjectProps == this) - TheMapObjectProps = NULL; + TheMapObjectProps = nullptr; - if ( m_posUndoable != NULL ) + if ( m_posUndoable != nullptr ) { REF_PTR_RELEASE( m_posUndoable ); } @@ -532,7 +532,7 @@ void MapObjectProps::SetAngle(void) if (!cstr.IsEmpty()) { angle = atof(cstr); } - if (m_selectedObject==NULL) return; + if (m_selectedObject==nullptr) return; if (m_angle!=angle) { m_angle = angle; @@ -555,7 +555,7 @@ void MapObjectProps::SetPosition(void) edit->GetWindowText(cstr); Coord3D loc; loc = m_position; - if (m_selectedObject==NULL) return; + if (m_selectedObject==nullptr) return; if (!cstr.IsEmpty()) { if (sscanf(cstr, "%f, %f", &loc.x, &loc.y)!=2) loc = m_position; @@ -613,7 +613,7 @@ void MapObjectProps::GetPopSliderInfo(const long sliderID, long *pMin, long *pMa void MapObjectProps::PopSliderChanged(const long sliderID, long theVal) { CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc == NULL ) + if ( pDoc == nullptr ) return; CWnd* edit; @@ -663,11 +663,11 @@ void MapObjectProps::PopSliderFinished(const long sliderID, long theVal) switch (sliderID) { case IDC_HEIGHT_POPUP: case IDC_ANGLE_POPUP: - if ( m_posUndoable != NULL ) + if ( m_posUndoable != nullptr ) { REF_PTR_RELEASE(m_posUndoable); // belongs to pDoc now. } - m_posUndoable = NULL; + m_posUndoable = nullptr; break; case IDC_SCALE_POPUP: @@ -741,7 +741,7 @@ void MapObjectProps::_PrebuiltUpgradesToDict(void) // Now, do the Undoable CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { DictItemUndoable *pUndo = new DictItemUndoable(getAllSelectedDictsData(), newDict, NAMEKEY_INVALID, m_allSelectedDicts.size(), pDoc, true); pDoc->AddAndDoUndoable(pUndo); @@ -770,13 +770,13 @@ void MapObjectProps::_DictToPrebuiltUpgrades(void) return; } - if (m_selectedObject == NULL) { + if (m_selectedObject == nullptr) { return; } // Otherwise, fill it with the upgrades available for this unit const ThingTemplate *tt = m_selectedObject->getThingTemplate(); - if (tt == NULL) { + if (tt == nullptr) { // This is valid. For instance, Scorch marks do not have thing templates. return; } @@ -1162,7 +1162,7 @@ void MapObjectProps::_HealthToDict(void) value = atoi(cstr.GetBuffer(0)); } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setInt(TheKey_objectInitialHealth, value); @@ -1183,7 +1183,7 @@ void MapObjectProps::_EnabledToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool(TheKey_objectEnabled, isChecked); @@ -1203,7 +1203,7 @@ void MapObjectProps::_IndestructibleToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool(TheKey_objectIndestructible, isChecked); @@ -1223,7 +1223,7 @@ void MapObjectProps::_UnsellableToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool(TheKey_objectUnsellable, isChecked); @@ -1243,7 +1243,7 @@ void MapObjectProps::_TargetableToDict() Bool isChecked = owner->GetCheck() != 0; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool( TheKey_objectTargetable, isChecked ); @@ -1264,7 +1264,7 @@ void MapObjectProps::_PoweredToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool(TheKey_objectPowered, isChecked); @@ -1298,7 +1298,7 @@ void MapObjectProps::_AggressivenessToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setInt(TheKey_objectAggressiveness, value); @@ -1324,7 +1324,7 @@ void MapObjectProps::_VisibilityToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; if (value != -1) { @@ -1351,7 +1351,7 @@ void MapObjectProps::_VeterancyToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setInt(TheKey_objectVeterancy, value); @@ -1377,7 +1377,7 @@ void MapObjectProps::_ShroudClearingDistanceToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; if (value != -1) { @@ -1399,7 +1399,7 @@ void MapObjectProps::_RecruitableAIToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setBool(TheKey_objectRecruitableAI, isChecked); @@ -1420,7 +1420,7 @@ void MapObjectProps::_SelectableToDict(void) Bool isTristate = (owner->GetCheck() == 2); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; if (isTristate) { @@ -1450,7 +1450,7 @@ void MapObjectProps::_HPsToDict() value = -1; CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1478,7 +1478,7 @@ void MapObjectProps::_StoppingDistanceToDict(void) value = atof(cstr.GetBuffer(0)); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; newDict.setReal(TheKey_objectStoppingDistance, value); @@ -1601,7 +1601,7 @@ BOOL MapObjectProps::OnInitDialog() m_heightSlider.SetupPopSliderButton(this, IDC_HEIGHT_POPUP, this); m_angleSlider.SetupPopSliderButton(this, IDC_ANGLE_POPUP, this); m_scaleSlider.SetupPopSliderButton(this, IDC_SCALE_POPUP, this); - m_posUndoable = NULL; + m_posUndoable = nullptr; m_angle = 0; m_height = 0; m_scale = 1.0f; @@ -1633,7 +1633,7 @@ void MapObjectProps::updateTheUI(void) m_dictSource = pMapObj; // Select correct dictionary - m_dictToEdit = m_dictSource ? m_dictSource->getProperties() : NULL; + m_dictToEdit = m_dictSource ? m_dictSource->getProperties() : nullptr; updateTheUI(m_dictSource); @@ -1691,9 +1691,9 @@ void MapObjectProps::updateTheUI(MapObject *pMapObj) void MapObjectProps::InitSound(void) { CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - DEBUG_ASSERTCRASH( priorityComboBox != NULL, ("Cannot find sound priority combobox" ) ); + DEBUG_ASSERTCRASH( priorityComboBox != nullptr, ("Cannot find sound priority combobox" ) ); - if ( priorityComboBox != NULL ) + if ( priorityComboBox != nullptr ) { Int i; for ( i = 0; i <= AP_CRITICAL; i++ ) @@ -1705,12 +1705,12 @@ void MapObjectProps::InitSound(void) } CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - DEBUG_ASSERTCRASH( soundComboBox != NULL, ("Cannot find sound combobox" ) ); + DEBUG_ASSERTCRASH( soundComboBox != nullptr, ("Cannot find sound combobox" ) ); m_defaultEntryIndex = 0; m_defaultIsNone = true; // Load up combobox - if ( soundComboBox != NULL ) + if ( soundComboBox != nullptr ) { // Add all the sound names in order. Since the combobox has the SORTED style, // we can just add the strings in and let the combo box sort them @@ -1783,13 +1783,13 @@ void MapObjectProps::clearCustomizeFlag( CWorldBuilderDoc* pDoc, MultipleUndoabl void MapObjectProps::attachedSoundToDict(void) { CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { MultipleUndoable *pUndo = new MultipleUndoable; @@ -1830,13 +1830,13 @@ void MapObjectProps::attachedSoundToDict(void) void MapObjectProps::customizeToDict(void) { CButton * customizeCheckbox = (CButton *)GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL ) + if ( customizeCheckbox == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1864,13 +1864,13 @@ void MapObjectProps::customizeToDict(void) void MapObjectProps::enabledToDict(void) { CButton * enabledCheckbox = (CButton *)GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enabledCheckbox == NULL ) + if ( enabledCheckbox == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1887,13 +1887,13 @@ void MapObjectProps::enabledToDict(void) void MapObjectProps::loopingToDict(void) { CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == NULL ) + if ( loopingCheckbox == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1910,13 +1910,13 @@ void MapObjectProps::loopingToDict(void) void MapObjectProps::loopCountToDict(void) { CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == NULL ) + if ( loopCountEdit == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1936,13 +1936,13 @@ void MapObjectProps::loopCountToDict(void) void MapObjectProps::minVolumeToDict(void) { CEdit * minVolumeEdit = (CEdit *)GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == NULL ) + if ( minVolumeEdit == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1963,13 +1963,13 @@ void MapObjectProps::minVolumeToDict(void) void MapObjectProps::volumeToDict(void) { CEdit * volumeEdit = (CEdit *)GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == NULL ) + if ( volumeEdit == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -1991,13 +1991,13 @@ void MapObjectProps::volumeToDict(void) void MapObjectProps::minRangeToDict(void) { CEdit * minRangeEdit = (CEdit *)GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == NULL ) + if ( minRangeEdit == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -2017,13 +2017,13 @@ void MapObjectProps::minRangeToDict(void) void MapObjectProps::maxRangeToDict(void) { CEdit * maxRangeEdit = (CEdit *)GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == NULL ) + if ( maxRangeEdit == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -2043,13 +2043,13 @@ void MapObjectProps::maxRangeToDict(void) void MapObjectProps::priorityToDict(void) { CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == NULL ) + if ( priorityComboBox == nullptr ) return; getAllSelectedDicts(); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) + if ( pDoc != nullptr ) { Dict newDict; @@ -2067,14 +2067,14 @@ void MapObjectProps::priorityToDict(void) void MapObjectProps::dictToAttachedSound() { CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) return; // Update the string for the "default" entry m_defaultIsNone = true; m_defaultEntryName = NO_SOUND_STRING; soundComboBox->DeleteString(m_defaultEntryIndex); - const ThingTemplate * thingTemplate = NULL; + const ThingTemplate * thingTemplate = nullptr; if (m_dictSource) { thingTemplate = m_dictSource->getThingTemplate(); @@ -2086,17 +2086,17 @@ void MapObjectProps::dictToAttachedSound() const AudioEventRTS * defaultAudioEvent; - // Note: getSoundAmbient will return a non-NULL pointer even if there is no real sound attached to the object + // Note: getSoundAmbient will return a non-null pointer even if there is no real sound attached to the object if ( thingTemplate->hasSoundAmbient() ) { defaultAudioEvent = thingTemplate->getSoundAmbient(); } else { - defaultAudioEvent = NULL; + defaultAudioEvent = nullptr; } - if ( defaultAudioEvent == NULL || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) + if ( defaultAudioEvent == nullptr || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) { string.concat( " " ); } @@ -2153,12 +2153,12 @@ void MapObjectProps::dictToAttachedSound() void MapObjectProps::dictToCustomize() { CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL ) + if ( customizeCheckbox == nullptr ) return; // If the current sound is "none", disable the customize button CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) return; int index = soundComboBox->GetCurSel(); @@ -2190,12 +2190,12 @@ void MapObjectProps::dictToCustomize() void MapObjectProps::dictToLooping() { CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == NULL ) + if ( loopingCheckbox == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { loopingCheckbox->EnableWindow( false ); } @@ -2224,7 +2224,7 @@ void MapObjectProps::dictToLooping() // If we get here, we need the default for the looping checkbox CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { loopingCheckbox->SetCheck( 0 ); return; @@ -2254,15 +2254,15 @@ void MapObjectProps::dictToLooping() void MapObjectProps::dictToLoopCount() { CEdit * loopCountEdit = ( CEdit * )GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == NULL ) + if ( loopCountEdit == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled // If the looping checkbox is off, the loop count control is disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 || - loopingCheckbox == NULL || loopingCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 || + loopingCheckbox == nullptr || loopingCheckbox->GetCheck() == 0 ) { loopCountEdit->EnableWindow( false ); } @@ -2293,7 +2293,7 @@ void MapObjectProps::dictToLoopCount() // If we get here, we need the default for the loop count CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { loopCountEdit->SetWindowText( "0" ); return; @@ -2317,7 +2317,7 @@ void MapObjectProps::dictToLoopCount() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { loopCountEdit->SetWindowText( "0" ); return; @@ -2332,14 +2332,14 @@ void MapObjectProps::dictToLoopCount() void MapObjectProps::dictToEnabled() { CButton * enableCheckbox = ( CButton * )GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enableCheckbox == NULL ) + if ( enableCheckbox == nullptr ) return; CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); // If we don't have a sound, we can't enable it CString currentString; - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { enableCheckbox->EnableWindow( false ); enableCheckbox->SetCheck( 0 ); @@ -2406,12 +2406,12 @@ void MapObjectProps::dictToEnabled() void MapObjectProps::dictToMinVolume() { CEdit * minVolumeEdit = ( CEdit * )GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == NULL ) + if ( minVolumeEdit == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { minVolumeEdit->EnableWindow( false ); } @@ -2442,7 +2442,7 @@ void MapObjectProps::dictToMinVolume() // If we get here, we need the default for the minimum volume CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { minVolumeEdit->SetWindowText( "40" ); return; @@ -2466,7 +2466,7 @@ void MapObjectProps::dictToMinVolume() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { minVolumeEdit->SetWindowText( "40" ); return; @@ -2482,12 +2482,12 @@ void MapObjectProps::dictToMinVolume() void MapObjectProps::dictToVolume() { CEdit * volumeEdit = ( CEdit * )GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == NULL ) + if ( volumeEdit == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { volumeEdit->EnableWindow( false ); } @@ -2518,7 +2518,7 @@ void MapObjectProps::dictToVolume() // If we get here, we need the default for the volume CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { volumeEdit->SetWindowText( "100" ); return; @@ -2542,7 +2542,7 @@ void MapObjectProps::dictToVolume() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { volumeEdit->SetWindowText( "100" ); return; @@ -2559,12 +2559,12 @@ void MapObjectProps::dictToVolume() void MapObjectProps::dictToMinRange() { CEdit * minRangeEdit = ( CEdit * )GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == NULL ) + if ( minRangeEdit == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { minRangeEdit->EnableWindow( false ); } @@ -2594,7 +2594,7 @@ void MapObjectProps::dictToMinRange() // If we get here, we need the default for the minimum range CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { minRangeEdit->SetWindowText( "175" ); return; @@ -2618,7 +2618,7 @@ void MapObjectProps::dictToMinRange() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { minRangeEdit->SetWindowText( "175" ); return; @@ -2634,12 +2634,12 @@ void MapObjectProps::dictToMinRange() void MapObjectProps::dictToMaxRange() { CEdit * maxRangeEdit = ( CEdit * )GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == NULL ) + if ( maxRangeEdit == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { maxRangeEdit->EnableWindow( false ); } @@ -2669,7 +2669,7 @@ void MapObjectProps::dictToMaxRange() // If we get here, we need the default for the minimum range CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { maxRangeEdit->SetWindowText( "600" ); return; @@ -2693,7 +2693,7 @@ void MapObjectProps::dictToMaxRange() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { maxRangeEdit->SetWindowText( "600" ); return; @@ -2708,12 +2708,12 @@ void MapObjectProps::dictToMaxRange() void MapObjectProps::dictToPriority() { CComboBox * priorityComboBox = ( CComboBox * )GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == NULL ) + if ( priorityComboBox == nullptr ) return; // If the customized checkbox is off, all customization controls are disabled CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + if ( customizeCheckbox == nullptr || customizeCheckbox->GetCheck() == 0 ) { priorityComboBox->EnableWindow( false ); } @@ -2748,7 +2748,7 @@ void MapObjectProps::dictToPriority() // If we get here, we need the default for the priority CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) + if ( soundComboBox == nullptr ) { priorityComboBox->SetCurSel( AP_LOWEST ); return; @@ -2772,7 +2772,7 @@ void MapObjectProps::dictToPriority() AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) + if ( audioEventInfo == nullptr ) { priorityComboBox->SetCurSel( AP_LOWEST ); return; @@ -2801,7 +2801,7 @@ void MapObjectProps::enableButtons() /*static*/ MapObject *MapObjectProps::getSingleSelectedMapObject(void) { MapObject *pMapObj; - MapObject *theMapObj = NULL; + MapObject *theMapObj = nullptr; // Bool found = false; Int selCount=0; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { @@ -2816,7 +2816,7 @@ void MapObjectProps::enableButtons() if (selCount==1 && theMapObj) { return theMapObj; } - return(NULL); + return(nullptr); } @@ -2867,7 +2867,7 @@ void MapObjectProps::getAllSelectedDicts(void) Dict** MapObjectProps::getAllSelectedDictsData() { #if defined(USING_STLPORT) || __cplusplus < 201103L - return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : NULL; + return !m_allSelectedDicts.empty() ? &m_allSelectedDicts.front() : nullptr; #else return m_allSelectedDicts.data(); #endif diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp index a7e33d0ab9d..d53ac17c207 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/playerlistdlg.cpp @@ -238,7 +238,7 @@ static const char* calcRelationStr(SidesList& sides, int t1, int t2) // PlayerListDlg dialog -PlayerListDlg::PlayerListDlg(CWnd* pParent /*=NULL*/) +PlayerListDlg::PlayerListDlg(CWnd* pParent /*=nullptr*/) : CDialog(PlayerListDlg::IDD, pParent), m_updating(0) { //{{AFX_DATA_INIT(PlayerListDlg) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/teamsdialog.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/teamsdialog.cpp index 17a197dd839..98ec4a7f1b4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/teamsdialog.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/teamsdialog.cpp @@ -43,7 +43,7 @@ static const char* NEUTRAL_NAME_STR = "(neutral)"; // CTeamsDialog dialog -CTeamsDialog::CTeamsDialog(CWnd* pParent /*=NULL*/) +CTeamsDialog::CTeamsDialog(CWnd* pParent /*=nullptr*/) : CDialog(CTeamsDialog::IDD, pParent) { //{{AFX_DATA_INIT(CTeamsDialog) @@ -506,7 +506,7 @@ void CTeamsDialog::OnMoveUpTeam() // rebuild user interface to reflect changes /* - LVITEM *pItem = NULL; + LVITEM *pItem = nullptr; CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_TEAMS_LIST); Bool result = pList->GetItem(pItem); pList->DeleteItem(m_curTeam); @@ -564,7 +564,7 @@ void CTeamsDialog::OnMoveDownTeam() m_curTeam++; // rebuild user interface to reflect changes -/* LVITEM *pItem = NULL; +/* LVITEM *pItem = nullptr; CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_TEAMS_LIST); Bool result = pList->GetItem(pItem); pList->DeleteItem(m_curTeam); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview.cpp index c0e65b35e22..5796898fd7a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview.cpp @@ -257,10 +257,10 @@ void WbView::mouseMove(TTrackingMode m, CPoint viewPt) } pObj = pObj->getNext(); } - if (pObj==NULL) { + if (pObj==nullptr) { pObj = picked3dObjectInView(viewPt); } - Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, NULL); + Real height = TheTerrainRenderObject->getHeightMapHeight(cpt.x, cpt.y, nullptr); CString str, str2, str3; // If a layer has been activated, display it. if (strcmp(AsciiString::TheEmptyString.str(), LayersList::TheActiveLayerName.c_str()) != 0) { @@ -419,7 +419,7 @@ WorldHeightMapEdit *WbView::getTrackingHeightMap() pMap = WbApp()->getCurTool()->getHeightMap(); } // If we aren't editing, or the tool doesn't provide a map, use the current one. - if (pMap == NULL) { + if (pMap == nullptr) { pMap = WbDoc()->GetHeightMap(); } return pMap; @@ -429,7 +429,7 @@ WorldHeightMapEdit *WbView::getTrackingHeightMap() void WbView::constrainCenterPt() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; #if 0 if (m_centerPt.X >= pMap->getXExtent()) m_centerPt.X = pMap->getXExtent()-1; if (m_centerPt.X<0) m_centerPt.X = 0; @@ -453,7 +453,7 @@ BOOL WbView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) WbApp()->getCurTool()->setCursor(); } else { // Else just use the system arrow cursor. This shouldn't normally happen. - ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); + ::SetCursor(::LoadCursor(nullptr, IDC_ARROW)); } return(0); } @@ -499,8 +499,8 @@ void WbView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) void WbView::OnEditCopy() { - MapObject *pTheCopy = NULL; - MapObject *pTmp = NULL; + MapObject *pTheCopy = nullptr; + MapObject *pTmp = nullptr; MapObject *pObj = MapObject::getFirstMapObject(); // Note - map segments come in pairs. So copy both. @@ -510,7 +510,7 @@ void WbView::OnEditCopy() if (pMapObj->getFlag(FLAG_ROAD_POINT1)) { pMapObj2 = pMapObj->getNext(); DEBUG_ASSERTCRASH(pMapObj2 && pMapObj2->getFlag(FLAG_ROAD_POINT2), ("oops")); - if (pMapObj2==NULL) break; + if (pMapObj2==nullptr) break; if (!pMapObj2->getFlag(FLAG_ROAD_POINT2)) continue; // If one end of a road segment is selected, both are. if (pMapObj->isSelected() || pMapObj2->isSelected()) { @@ -533,7 +533,7 @@ void WbView::OnEditCopy() pObj = pObj->getNext(); } WbApp()->setMapObjPasteList(pTheCopy); - pTheCopy = NULL; // belongs to the app. + pTheCopy = nullptr; // belongs to the app. } void WbView::OnUpdateEditCopy(CCmdUI* pCmdUI) @@ -555,8 +555,8 @@ void WbView::OnUpdateEditCut(CCmdUI* pCmdUI) void WbView::OnEditPaste() { CWorldBuilderDoc* pDoc = WbDoc(); - MapObject *pTheCopy = NULL; - MapObject *pTmp = NULL; + MapObject *pTheCopy = nullptr; + MapObject *pTmp = nullptr; /* First, clear the selection. */ PointerTool::clearSelection(); @@ -574,7 +574,7 @@ void WbView::OnEditPaste() AddObjectUndoable *pUndo = new AddObjectUndoable(pDoc, pTheCopy); pDoc->AddAndDoUndoable(pUndo); REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - pTheCopy = NULL; // undoable owns it now. + pTheCopy = nullptr; // undoable owns it now. } @@ -584,7 +584,7 @@ void WbView::OnViewShowObjects() m_showObjects = !m_showObjects; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(!m_showObjects); } ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowObjectIcons", m_showObjects?1:0); @@ -599,7 +599,7 @@ void WbView::OnUpdateViewShowObjects(CCmdUI* pCmdUI) void WbView::OnUpdateEditPaste(CCmdUI* pCmdUI) { MapObject *pTheCopy = WbApp()->getMapObjPasteList(); - pCmdUI->Enable(pTheCopy != NULL); + pCmdUI->Enable(pTheCopy != nullptr); } void WbView::OnViewSnaptogrid() @@ -616,26 +616,26 @@ void WbView::OnUpdateViewSnaptogrid(CCmdUI* pCmdUI) void WbView::OnEditSelectdup() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectDuplicates(); } void WbView::OnEditSelectsimilar() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectSimilar(); } void WbView::OnEditSelectinvalidteam() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; pMap->selectInvalidTeam(); } void WbView::OnEditReplace() { WorldHeightMapEdit *pMap = WbDoc()->GetHeightMap(); - if (pMap==NULL) return; + if (pMap==nullptr) return; EditorSortingType sort = ES_NONE; for (MapObject* pObj = MapObject::getFirstMapObject(); pObj; pObj = pObj->getNext()) { @@ -793,7 +793,7 @@ void WbView::OnEditWorldinfo() #if 0 Dict *d = MapObject::getWorldDict(); Dict dcopy = *d; - MapObjectProps editor(&dcopy, "Edit World Info", NULL); + MapObjectProps editor(&dcopy, "Edit World Info", nullptr); if (editor.DoModal() == IDOK) { CWorldBuilderDoc* pDoc = WbDoc(); @@ -919,7 +919,7 @@ void WbView::OnShowNames() m_showNames = m_showNames ? false : true; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(false); } @@ -963,7 +963,7 @@ void WbView::OnValidationFixTeams() AsciiString oname = d->getAsciiString(TheKey_teamOwner); AsciiString tname = d->getAsciiString(TheKey_teamName); SidesInfo* pSide = TheSidesList->findSideInfo(oname); - Bool found = pSide!=NULL; + Bool found = pSide!=nullptr; if (!found) { CString msg; msg.Format(IDS_PLAYERLESS_TEAM_REMOVED, tname.str(), oname.str()); @@ -984,7 +984,7 @@ void WbView::OnValidationFixTeams() continue; } - if (pMapObj->getThingTemplate()==NULL) { + if (pMapObj->getThingTemplate()==nullptr) { continue; // Objects that don't have templates don't need teams. [8/8/2003] } // at this point, only objects with models and teams should be left to process @@ -1027,7 +1027,7 @@ void WbView::OnValidationFixTeams() AsciiString team; team.set("team"); team.concat(fix.getSelectedOwner()); - if (TheSidesList->findTeamInfo(team)==NULL) { + if (TheSidesList->findTeamInfo(team)==nullptr) { team.set("team"); // neutral. } pMapObj->getProperties()->setAsciiString(TheKey_originalOwner, team); @@ -1050,7 +1050,7 @@ void WbView::OnShowTerrain() m_showTerrain = !m_showTerrain; Invalidate(false); WbView *pView = (WbView *)WbDoc()->GetActive2DView(); - if (pView != NULL && pView != this) { + if (pView != nullptr && pView != this) { pView->Invalidate(false); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index c33edb6fee3..5a73e774719 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -112,7 +112,7 @@ class SkeletonSceneClass; #define SAMPLE_DYNAMIC_LIGHT 1 #ifdef SAMPLE_DYNAMIC_LIGHT -static W3DDynamicLight * theDynamicLight = NULL; +static W3DDynamicLight * theDynamicLight = nullptr; static Real theLightXOffset = 0.1f; static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; @@ -159,15 +159,15 @@ class PlaceholderView : public View Int m_originX, m_originY; ///< Location of top/left view corner protected: - virtual View *prependViewToList( View *list ) {return NULL;}; ///< Prepend this view to the given list, return the new list - virtual View *getNextView( void ) { return NULL; } ///< Return next view in the set + virtual View *prependViewToList( View *list ) {return nullptr;}; ///< Prepend this view to the given list, return the new list + virtual View *getNextView( void ) { return nullptr; } ///< Return next view in the set public: virtual void init( void ){}; virtual UnsignedInt getID( void ) { return 1; } - virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ){return NULL;}; ///< pick drawable given the screen pixel coords + virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ){return nullptr;}; ///< pick drawable given the screen pixel coords /// all drawables in the 2D screen region will call the 'callback' virtual Int iterateDrawablesInRegion( IRegion2D *screenRegion, @@ -254,7 +254,7 @@ class PlaceholderView : public View virtual void snapToCameraLock( void ) { } virtual void setSnapMode( CameraLockType lockType, Real lockDist ) { } - virtual Drawable *getCameraLockDrawable() const { return NULL; } + virtual Drawable *getCameraLockDrawable() const { return nullptr; } virtual void setCameraLockDrawable(Drawable *drawable) { } virtual void setMouseLock( Bool mouseLocked ) {} ///< lock/unlock the mouse input to the tactical view @@ -294,7 +294,7 @@ PlaceholderView bogusTacticalView; class SkeletonSceneClass : public RTS3DScene { public: - SkeletonSceneClass(void) : m_testPass(NULL) { } + SkeletonSceneClass(void) : m_testPass(nullptr) { } ~SkeletonSceneClass(void) { REF_PTR_RELEASE(m_testPass); } void Set_Material_Pass(MaterialPassClass * pass) { REF_PTR_SET(m_testPass, pass); } @@ -328,7 +328,7 @@ Bool SkeletonSceneClass::safeContains(RenderObjClass *obj) void SkeletonSceneClass::Remove_Render_Object(RenderObjClass * obj) { if (RenderList.Contains(obj)) { - RenderObjClass *refPtr = NULL; + RenderObjClass *refPtr = nullptr; REF_PTR_SET(refPtr, obj); // ref it, as when it gets removed from the scene, may get deleted otherwise. RTS3DScene::Remove_Render_Object(obj); REF_PTR_RELEASE(refPtr); @@ -347,10 +347,10 @@ void WbView3d::setObjTracking(MapObject *pMapObj, Coord3D pos, Real angle, Bool REF_PTR_RELEASE(m_objectToolTrackingObj); m_objectToolTrackingObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, 0); } - if (m_objectToolTrackingObj == NULL) { + if (m_objectToolTrackingObj == nullptr) { return; } - pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); Matrix3D renderObjPos(true); // init to identity renderObjPos.Translate(pos.x, pos.y, pos.z); renderObjPos.Rotate_Z(angle); @@ -366,15 +366,15 @@ IMPLEMENT_DYNCREATE(WbView3d, WbView) // ---------------------------------------------------------------------------- WbView3d::WbView3d() : - m_assetManager(NULL), - m_scene(NULL), - m_overlayScene(NULL), - m_transparentObjectsScene(NULL), - m_baseBuildScene(NULL), - m_objectToolTrackingObj(NULL), + m_assetManager(nullptr), + m_scene(nullptr), + m_overlayScene(nullptr), + m_transparentObjectsScene(nullptr), + m_baseBuildScene(nullptr), + m_objectToolTrackingObj(nullptr), m_showObjToolTrackingObj(false), - m_camera(NULL), - m_heightMapRenderObj(NULL), + m_camera(nullptr), + m_heightMapRenderObj(nullptr), m_mouseWheelOffset(0), m_actualWinSize(0, 0), m_cameraAngle(0.0), @@ -385,11 +385,11 @@ WbView3d::WbView3d() : m_time(0), m_updateCount(0), m_needToLoadRoads(0), - m_timer(NULL), - m_drawObject(NULL), - m_layer(NULL), - m_buildLayer(NULL), - m_intersector(NULL), + m_timer(0), + m_drawObject(nullptr), + m_layer(nullptr), + m_buildLayer(nullptr), + m_intersector(nullptr), m_showEntireMap(false), m_partialMapSize(129), m_showWireframe(false), @@ -416,7 +416,7 @@ WbView3d::WbView3d() : for (Int i=0; iGetProfileInt(MAIN_FRAME_SECTION, "ShowWireframe", 0) != 0); @@ -441,7 +441,7 @@ WbView3d::~WbView3d() { for (Int i=0; iRemove(); REF_PTR_RELEASE(m_lightFeedbackMesh[i]); } @@ -455,17 +455,17 @@ WbView3d::~WbView3d() void WbView3d::shutdownWW3D(void) { delete m_intersector; - m_intersector = NULL; + m_intersector = nullptr; delete m_layer; - m_layer = NULL; + m_layer = nullptr; delete m_buildLayer; - m_buildLayer = NULL; + m_buildLayer = nullptr; if (m3DFont) { m3DFont->Release(); - m3DFont = NULL; + m3DFont = nullptr; } if (m_ww3dInited) { m_lightList.Reset_List(); @@ -474,14 +474,14 @@ void WbView3d::shutdownWW3D(void) PredictiveLODOptimizerClass::Free(); /// @todo: where does this need to be done? m_assetManager->Free_Assets(); delete m_assetManager; - m_assetManager = NULL; + m_assetManager = nullptr; } if (TheW3DShadowManager) { TheW3DShadowManager->removeAllShadows(); delete TheW3DShadowManager; - TheW3DShadowManager=NULL; + TheW3DShadowManager=nullptr; } REF_PTR_RELEASE(m_transparentObjectsScene); REF_PTR_RELEASE(m_overlayScene); @@ -516,7 +516,7 @@ void WbView3d::ReleaseResources(void) if (m3DFont) { m3DFont->Release(); } - m3DFont = NULL; + m3DFont = nullptr; if (m_drawObject) { m_drawObject->freeMapResources(); } @@ -531,7 +531,7 @@ void WbView3d::ReAcquireResources(void) { if (TheTerrainRenderObject) { TheTerrainRenderObject->ReAcquireResources(); - TheTerrainRenderObject->loadRoadsAndBridges(NULL,FALSE); + TheTerrainRenderObject->loadRoadsAndBridges(nullptr,FALSE); TheTerrainRenderObject->worldBuilderUpdateBridgeTowers( m_assetManager, m_scene ); } m_drawObject->initData(); @@ -560,11 +560,11 @@ void WbView3d::ReAcquireResources(void) D3DXCreateFont(pDev, hFont, &m3DFont); DeleteObject(hFont); } else { - m3DFont = NULL; + m3DFont = nullptr; } } else { - m3DFont = NULL; + m3DFont = nullptr; } } @@ -572,9 +572,9 @@ void WbView3d::ReAcquireResources(void) // ---------------------------------------------------------------------------- void WbView3d::killTheTimer(void) { - if (m_timer != NULL) { + if (m_timer != 0) { KillTimer(m_timer); - m_timer = NULL; + m_timer = 0; } } @@ -609,14 +609,14 @@ void WbView3d::initAssets() #define TERRAIN_SAMPLE_SIZE 40.0f static Real getHeightAroundPos(WBHeightMap *heightMap, Real x, Real y) { - Real terrainHeight = heightMap->getHeightMapHeight(x, y, NULL); + Real terrainHeight = heightMap->getHeightMapHeight(x, y, nullptr); // find best approximation of max terrain height we can see Real terrainHeightMax = terrainHeight; - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, NULL)); - terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, NULL)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y-TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x+TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, nullptr)); + terrainHeightMax = max(terrainHeightMax, heightMap->getHeightMapHeight(x-TERRAIN_SAMPLE_SIZE, y+TERRAIN_SAMPLE_SIZE, nullptr)); return terrainHeightMax; } @@ -825,7 +825,7 @@ void WbView3d::resetRenderObjects() // Erase references to render objs that have been removed. while (pMapObj) { - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); pMapObj = pMapObj->getNext(); } @@ -834,7 +834,7 @@ void WbView3d::resetRenderObjects() SidesInfo *pSide = TheSidesList->getSideInfo(i); BuildListInfo *pBuild = pSide->getBuildList(); while (pBuild) { - pBuild->setRenderObj(NULL); + pBuild->setRenderObj(nullptr); pBuild = pBuild->getNext(); } } @@ -860,7 +860,7 @@ void WbView3d::stepTimeOfDay() TheWritableGlobalData->m_timeOfDay = TIME_OF_DAY_FIRST; } resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // ---------------------------------------------------------------------------- @@ -947,11 +947,11 @@ void WbView3d::updateLights() while (pMapObj && m_heightMapRenderObj) { if (pMapObj->isLight()) { Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); RenderObjClass *renderObj= pMapObj->getRenderObj(); if (renderObj) { m_scene->Remove_Render_Object(renderObj); - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); } // It is a light, and handled at the device level. jba. LightClass* lightP = NEW_REF(LightClass, (LightClass::POINT)); @@ -1022,12 +1022,12 @@ void WbView3d::updateTrees(void) { const ModuleData* mdd = mi.getNthData(0); AsciiString name = KEYNAME(mdd->getModuleTagNameKey()); - const W3DTreeDrawModuleData* md = mdd ? mdd->getAsW3DTreeDrawModuleData(): NULL; + const W3DTreeDrawModuleData* md = mdd ? mdd->getAsW3DTreeDrawModuleData(): nullptr; if (md) { Coord3D pos = *pMapObj->getLocation(); if (m_heightMapRenderObj) { - pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); TheTerrainRenderObject->addTree((DrawableID)(Int)pMapObj, pos, scale, pMapObj->getAngle(), 0.0f /*no random scaling*/, md); } @@ -1051,15 +1051,15 @@ void WbView3d::updateFenceListObjects(MapObject *pObject) { Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); - RenderObjClass *renderObj=NULL; + RenderObjClass *renderObj=nullptr; REF_PTR_SET( renderObj, pMapObj->getRenderObj() ); if (!renderObj) { Real scale = 1.0; AsciiString modelName = getModelNameAndScale(pMapObj, &scale, BODY_PRISTINE); // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) ) { @@ -1097,7 +1097,7 @@ void WbView3d::removeFenceListObjects(MapObject *pObject) { if (pMapObj->getRenderObj()) { m_scene->Remove_Render_Object(pMapObj->getRenderObj()); - pMapObj->setRenderObj(NULL); + pMapObj->setRenderObj(nullptr); } } @@ -1115,7 +1115,7 @@ AsciiString WbView3d::getBestModelName(const ThingTemplate* tt, const ModelCondi { // const W3DModelDrawModuleData* md = dynamic_cast(mi->getNthData(0)); const ModuleData* mdd = mi.getNthData(0); - const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : NULL; + const W3DModelDrawModuleData* md = mdd ? mdd->getAsW3DModelDrawModuleData() : nullptr; if (md) { return md->getBestModelNameForWB(c); @@ -1161,13 +1161,13 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) } // Update. Coord3D loc = *pBuild->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); - RenderObjClass *renderObj=NULL; - Shadow *shadowObj=NULL; + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); + RenderObjClass *renderObj=nullptr; + Shadow *shadowObj=nullptr; // Build list render obj is not refcounted, so check & make sure it exists in the scene. if (pBuild->getRenderObj()) { if (!m_baseBuildScene->safeContains(pBuild->getRenderObj())) { - pBuild->setRenderObj(NULL); + pBuild->setRenderObj(nullptr); } } @@ -1185,7 +1185,7 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) scale = tTemplate->getAssetScale(); } // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) ) { @@ -1227,12 +1227,12 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) // Build list render obj is not refcounted, so check & make sure it exists in the scene. if (!found && pBuildToInval && pBuildToInval->getRenderObj()) { if (!m_baseBuildScene->safeContains(pBuildToInval->getRenderObj())) { - pBuildToInval->setRenderObj(NULL); + pBuildToInval->setRenderObj(nullptr); } } if (!found && pBuildToInval && pBuildToInval->getRenderObj()) { m_baseBuildScene->Remove_Render_Object(pBuildToInval->getRenderObj()); - pBuildToInval->setRenderObj(NULL); + pBuildToInval->setRenderObj(nullptr); } Invalidate(false); } @@ -1349,19 +1349,19 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) { ++m_updateCount; Bool updateAllTrees = false; - if (m_heightMapRenderObj == NULL) { + if (m_heightMapRenderObj == nullptr) { m_heightMapRenderObj = NEW_REF(WBHeightMap,()); m_scene->Add_Render_Object(m_heightMapRenderObj); } - if (pMapObjIn == NULL) { - invalBuildListItemInView(NULL); + if (pMapObjIn == nullptr) { + invalBuildListItemInView(nullptr); } Bool found = false; Bool isRoad = false; Bool isLight = false; Bool isScorch = false; - if (pMapObjIn == NULL) + if (pMapObjIn == nullptr) isScorch = true; MapObject *pMapObj; for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) @@ -1369,7 +1369,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) if (found) break; if (pMapObjIn == pMapObj) found = true; - if (pMapObjIn != NULL && !found) { + if (pMapObjIn != nullptr && !found) { continue; } if (pMapObj->getFlags() & (FLAG_ROAD_FLAGS|FLAG_BRIDGE_FLAGS)) { @@ -1389,7 +1389,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) Coord3D loc = *pMapObj->getLocation(); - loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, NULL); + loc.z += m_heightMapRenderObj->getHeightMapHeight(loc.x, loc.y, nullptr); const ThingTemplate *tTemplate = pMapObj->getThingTemplate(); if (tTemplate && tTemplate->isKindOf(KINDOF_OPTIMIZED_TREE)) { @@ -1400,8 +1400,8 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) if (found) break; } - RenderObjClass *renderObj=NULL; - Shadow *shadowObj=NULL; + RenderObjClass *renderObj=nullptr; + Shadow *shadowObj=nullptr; REF_PTR_SET( renderObj, pMapObj->getRenderObj() ); Int playerColor = 0xFFFFFF; @@ -1459,7 +1459,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) Real scale = 1.0; AsciiString modelName = getModelNameAndScale(pMapObj, &scale, curDamageState); // set render object, or create if we need to - if( renderObj == NULL && modelName.isEmpty() == FALSE && + if( renderObj == nullptr && modelName.isEmpty() == FALSE && strncmp( modelName.str(), "No ", 3 ) ) { @@ -1531,12 +1531,12 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) if (!found && pMapObjIn && pMapObjIn->getRenderObj()) { if( m_showShadows ) { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); --m_updateCount; return; } m_scene->Remove_Render_Object(pMapObjIn->getRenderObj()); - pMapObjIn->setRenderObj(NULL); + pMapObjIn->setRenderObj(nullptr); } if (isRoad) { @@ -1560,11 +1560,11 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) // ---------------------------------------------------------------------------- void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const IRegion2D &partialRange) { - if (htMap == NULL) + if (htMap == nullptr) return; ++m_updateCount; - if (m_heightMapRenderObj == NULL) { + if (m_heightMapRenderObj == nullptr) { m_heightMapRenderObj = NEW_REF(WBHeightMap,()); m_scene->Add_Render_Object(m_heightMapRenderObj); partial = false; @@ -1595,7 +1595,7 @@ void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const if (curTicks < 1) curTicks = 1; } - invalObjectInView(NULL); // update all the map objects, to account for ground changes + invalObjectInView(nullptr); // update all the map objects, to account for ground changes --m_updateCount; } @@ -1641,7 +1641,7 @@ MapObject *WbView3d::picked3dObjectInView(CPoint viewPt) } } - return NULL; + return nullptr; } //============================================================================= @@ -1689,7 +1689,7 @@ BuildListInfo *WbView3d::pickedBuildObjectInView(CPoint viewPt) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1984,7 +1984,7 @@ Bool WbView3d::docToViewCoords(Coord3D curPt, CPoint* newPt) newPt->x = -1000; newPt->y = -1000; if (m_heightMapRenderObj) { - curPt.z += m_heightMapRenderObj->getHeightMapHeight(curPt.x, curPt.y, NULL); + curPt.z += m_heightMapRenderObj->getHeightMapHeight(curPt.x, curPt.y, nullptr); } world.Set( curPt.x, curPt.y, curPt.z ); @@ -2035,7 +2035,7 @@ void WbView3d::redraw(void) DEBUG_ASSERTCRASH((m_heightMapRenderObj),("oops")); if (m_heightMapRenderObj) { if (m_needToLoadRoads) { - m_heightMapRenderObj->loadRoadsAndBridges(NULL,FALSE); + m_heightMapRenderObj->loadRoadsAndBridges(nullptr,FALSE); m_heightMapRenderObj->worldBuilderUpdateBridgeTowers( m_assetManager, m_scene ); m_needToLoadRoads = false; } @@ -2129,7 +2129,7 @@ void WbView3d::render() WW3D::Render(m_overlayScene,m_camera); //if (mytext) mytext->Render(); if (m3DFont) { - drawLabels(NULL); + drawLabels(nullptr); } @@ -2286,11 +2286,11 @@ void WbView3d::initWW3D() D3DXCreateFont(pDev, hFont, &m3DFont); DeleteObject(hFont); } else { - m3DFont = NULL; + m3DFont = nullptr; } } else { - m3DFont = NULL; + m3DFont = nullptr; } WW3D::Enable_Static_Sort_Lists(true); @@ -2309,7 +2309,7 @@ void WbView3d::initWW3D() TheWritableGlobalData->m_useShadowVolumes = true; TheWritableGlobalData->m_useShadowDecals = true; TheWritableGlobalData->m_enableBehindBuildingMarkers = false; //this is only for the game. - if (TheW3DShadowManager==NULL) + if (TheW3DShadowManager==nullptr) { TheW3DShadowManager = new W3DShadowManager; TheW3DShadowManager->init(); } @@ -2332,7 +2332,7 @@ int WbView3d::OnCreate(LPCREATESTRUCT lpCreateStruct) WWDebug_Install_Message_Handler(WWDebug_Message_Callback); WWDebug_Install_Assert_Handler(WWAssert_Callback); - m_timer = SetTimer(0, UPDATE_TIME, NULL); + m_timer = SetTimer(0, UPDATE_TIME, nullptr); initWW3D(); TheWritableGlobalData->m_useCloudMap = AfxGetApp()->GetProfileInt("GameOptions", "cloudMap", 0); @@ -2440,7 +2440,7 @@ void WbView3d::drawLabels(HDC hdc) if (m_doLightFeedback && pMapObj->isSelected()) { //find out position of selected object in order to use it for light feedback tracking. selectedPos=*pMapObj->getLocation(); - selectedPos.z = m_heightMapRenderObj->getHeightMapHeight(selectedPos.x, selectedPos.y, NULL); + selectedPos.z = m_heightMapRenderObj->getHeightMapHeight(selectedPos.x, selectedPos.y, nullptr); RenderObjClass *selRobj=pMapObj->getRenderObj(); if (selRobj) { @@ -2454,12 +2454,12 @@ void WbView3d::drawLabels(HDC hdc) if (pMapObj->isWaypoint() && m_showWaypoints) { name = pMapObj->getWaypointName(); pos = *pMapObj->getLocation(); - pos.z = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } else if (pMapObj->getThingTemplate() && !(pMapObj->getFlags() & (FLAG_ROAD_FLAGS|FLAG_BRIDGE_FLAGS)) && - pMapObj->getRenderObj() == NULL && !pMapObj->getThingTemplate()->isKindOf(KINDOF_OPTIMIZED_TREE)) { + pMapObj->getRenderObj() == nullptr && !pMapObj->getThingTemplate()->isKindOf(KINDOF_OPTIMIZED_TREE)) { name = pMapObj->getThingTemplate()->getName(); pos = *pMapObj->getLocation(); - pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + pos.z += m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } Int i; for (i=0; i<4; i++) { @@ -2577,12 +2577,12 @@ void WbView3d::drawLabels(HDC hdc) selectedPos.y - m_lightDirection[lIndex].y*selectedRadius, selectedPos.z - m_lightDirection[lIndex].z*selectedRadius); - if (m_lightFeedbackMesh[lIndex] == NULL) + if (m_lightFeedbackMesh[lIndex] == nullptr) { char nameBuf[64]; snprintf(nameBuf, ARRAY_SIZE(nameBuf), "WB_LIGHT%d", lIndex+1); m_lightFeedbackMesh[lIndex]=WW3DAssetManager::Get_Instance()->Create_Render_Obj(nameBuf); } - if (m_lightFeedbackMesh[lIndex]==NULL) { + if (m_lightFeedbackMesh[lIndex]==nullptr) { break; } Matrix3D lightMat; @@ -2634,7 +2634,7 @@ void WbView3d::drawLabels(HDC hdc) for (Int lIndex=0; lIndexRemove(); REF_PTR_RELEASE(m_lightFeedbackMesh[lIndex]); } @@ -2721,7 +2721,7 @@ void WbView3d::setDefaultCamera() } if (m_heightMapRenderObj) { - m_groundLevel = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, NULL); + m_groundLevel = m_heightMapRenderObj->getHeightMapHeight(pos.x, pos.y, nullptr); } //m_cameraOffset.z = m_groundLevel+TheGlobalData->m_cameraHeight; @@ -2881,7 +2881,7 @@ void WbView3d::OnViewShowtopdownview() { m_projection = !m_projection; m_heightMapRenderObj->setFlattenHeights(m_projection); - invalObjectInView(NULL); + invalObjectInView(nullptr); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowTopDownView", m_projection?1:0); } @@ -2934,7 +2934,7 @@ void WbView3d::OnViewShowshadows() m_showShadows = false; } else { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } } else { TheW3DShadowManager->removeAllShadows(); @@ -2987,7 +2987,7 @@ void WbView3d::OnEditMapSettings() if (dlg.DoModal() == IDOK) { resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } } @@ -3005,7 +3005,7 @@ void WbView3d::OnViewShowModels() setShowModels(!getShowModels()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowModels", getShowModels()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewShowModels(CCmdUI* pCmdUI) { @@ -3018,7 +3018,7 @@ void WbView3d::OnViewBoundingBoxes() setShowBoundingBoxes(!getShowBoundingBoxes()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowBoundingBoxes", getShowBoundingBoxes()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // MLL C&C3 void WbView3d::OnUpdateViewBoundingBoxes(CCmdUI* pCmdUI) @@ -3033,7 +3033,7 @@ void WbView3d::OnViewSightRanges() setShowSightRanges(!getShowSightRanges()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowSightRanges", getShowSightRanges()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // MLL C&C3 void WbView3d::OnUpdateViewSightRanges(CCmdUI* pCmdUI) @@ -3047,7 +3047,7 @@ void WbView3d::OnViewWeaponRanges() setShowWeaponRanges(!getShowWeaponRanges()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowWeaponRanges", getShowWeaponRanges()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // MLL C&C3 void WbView3d::OnUpdateViewWeaponRanges(CCmdUI* pCmdUI) @@ -3061,7 +3061,7 @@ void WbView3d::OnHighlightTestArt() setHighlightTestArt(!getHighlightTestArt()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "HighlightTestArt", getHighlightTestArt()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } // MLL C&C3 void WbView3d::OnUpdateHighlightTestArt(CCmdUI* pCmdUI) @@ -3088,7 +3088,7 @@ void WbView3d::OnViewGarrisoned() setShowGarrisoned(!getShowGarrisoned()); ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowGarrisoned", getShowGarrisoned()?1:0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewGarrisoned(CCmdUI* pCmdUI) { @@ -3245,7 +3245,7 @@ void WbView3d::OnViewShowSoundCircles() m_showSoundCircles = !m_showSoundCircles; ::AfxGetApp()->WriteProfileInt(MAIN_FRAME_SECTION, "ShowSoundCircles", m_showSoundCircles ? 1 : 0); resetRenderObjects(); - invalObjectInView(NULL); + invalObjectInView(nullptr); } void WbView3d::OnUpdateViewShowSoundCircles(CCmdUI* pCmdUI) diff --git a/GeneralsMD/Code/Tools/wdump/FindDialog.cpp b/GeneralsMD/Code/Tools/wdump/FindDialog.cpp index a434d48516d..6ff92150990 100644 --- a/GeneralsMD/Code/Tools/wdump/FindDialog.cpp +++ b/GeneralsMD/Code/Tools/wdump/FindDialog.cpp @@ -37,7 +37,7 @@ bool FindDialog::_Found; // FindDialog dialog -FindDialog::FindDialog(CWnd* pParent /*=NULL*/) +FindDialog::FindDialog(CWnd* pParent /*=nullptr*/) : CDialog(FindDialog::IDD, pParent) { //{{AFX_DATA_INIT(FindDialog) diff --git a/GeneralsMD/Code/Tools/wdump/FindDialog.h b/GeneralsMD/Code/Tools/wdump/FindDialog.h index 07e3f616b9a..e1e6a549db7 100644 --- a/GeneralsMD/Code/Tools/wdump/FindDialog.h +++ b/GeneralsMD/Code/Tools/wdump/FindDialog.h @@ -31,7 +31,7 @@ class FindDialog : public CDialog { // Construction public: - FindDialog(CWnd* pParent = NULL); // standard constructor + FindDialog(CWnd* pParent = nullptr); // standard constructor static const char *String() { @@ -40,7 +40,7 @@ class FindDialog : public CDialog static void Compare (const char *string) { - _Found |= (strstr (string, _FindString) != NULL); + _Found |= (strstr (string, _FindString) != nullptr); } static bool Found() diff --git a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp index 9480b5ae113..1f645f923ed 100644 --- a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp +++ b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp @@ -68,7 +68,7 @@ void ChunkTableClass::NewType(int ID, const char *name, void (*callback)(ChunkIt } void ChunkTableClass::AddItem(CListCtrl *list, int &Counter, const char *Name, const char *Value, const char *Type) { - if (list != NULL) { + if (list != nullptr) { int list_item = list->InsertItem(Counter++, Name); list->SetItemText(list_item, 1, Type); list->SetItemText(list_item, 2, Value); @@ -2279,7 +2279,7 @@ ChunkType *ChunkTableClass::Lookup(int ID) { ChunkType *chunktype; if(Types.Lookup((void *) ID, (void *&) chunktype)) return chunktype; - return 0; + return nullptr; } ChunkItem::ChunkItem(ChunkLoadClass &cload) { @@ -2288,16 +2288,16 @@ ChunkItem::ChunkItem(ChunkLoadClass &cload) { Type = ChunkTable.Lookup(ID); // if the chunktype indicates that it has member chunks then do not load this chunk's data. Have the external caller do that. - if(Type != 0 && Type->Wrapper) { - Data = 0; + if(Type != nullptr && Type->Wrapper) { + Data = nullptr; return; } - if(Type != 0) { + if(Type != nullptr) { TRACE("%s %d\n", Type->Name, Length); } if(Length == 0) { - Data = 0; + Data = nullptr; } else { Data = new char[Length]; cload.Read(Data, Length); @@ -2394,14 +2394,14 @@ void ChunkData::Add_Chunk(ChunkLoadClass & cload, ChunkItem *Parent) existing.SetAt(data, data); - if(theApp.TextureDumpFile != 0) + if(theApp.TextureDumpFile != nullptr) fprintf(theApp.TextureDumpFile, "%s,%s\n", (LPCTSTR)theApp.Filename, data); TRACE("%s,%s\n", static_cast(theApp.Filename), data); } } } #endif - if((item->Type != 0) && item->Type->Wrapper) { + if((item->Type != nullptr) && item->Type->Wrapper) { while(cload.Open_Chunk()) { Add_Chunk(cload, item); cload.Close_Chunk(); diff --git a/GeneralsMD/Code/Tools/wdump/rawfilem.cpp b/GeneralsMD/Code/Tools/wdump/rawfilem.cpp index 6e551ac90b8..fbe7326fe38 100644 --- a/GeneralsMD/Code/Tools/wdump/rawfilem.cpp +++ b/GeneralsMD/Code/Tools/wdump/rawfilem.cpp @@ -141,16 +141,16 @@ char const * RawFileMClass::Set_Name(char const * filename) { if (Allocated) { free((char *)Filename); - Filename = NULL; + Filename = nullptr; Allocated = false; } - if (filename == NULL) return(NULL); + if (filename == nullptr) return(nullptr); Bias(0); Filename = strdup(filename); - if (Filename == NULL) { + if (Filename == nullptr) { Error(ENOMEM, false, filename); } Allocated = true; @@ -212,7 +212,7 @@ int RawFileMClass::Open(int rights) ** Verify that there is a filename associated with this file object. If not, then this is a ** big error condition. */ - if (Filename == NULL) { + if (Filename == nullptr) { Error(ENOENT, false); } @@ -242,17 +242,17 @@ int RawFileMClass::Open(int rights) case READ: Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); break; case WRITE: Handle = CreateFileA(Filename, GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); break; case READ|WRITE: Handle = CreateFileA(Filename, GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); break; } @@ -300,7 +300,7 @@ int RawFileMClass::Open(int rights) *=============================================================================================*/ bool RawFileMClass::Is_Available(int forced) { - if (Filename == NULL) return(false); + if (Filename == nullptr) return(false); /* ** If the file is already open, then is must have already passed the availability check. @@ -326,7 +326,7 @@ bool RawFileMClass::Is_Available(int forced) for (;;) { Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (Handle == NULL_HANDLE) { return(false); } @@ -391,10 +391,10 @@ void RawFileMClass::Close(void) * the file. This condition can result in fewer bytes being read than requested. Determine * * this by examining the return value. * * * - * INPUT: buffer -- Pointer to the buffer to read data into. If NULL is passed, no read * + * INPUT: buffer -- Pointer to the buffer to read data into. If nullptr is passed, no read * * is performed. * * * - * size -- The number of bytes to read. If NULL is passed, then no read is * + * size -- The number of bytes to read. If nullptr is passed, then no read is * * performed. * * * * OUTPUT: Returns with the number of bytes read into the buffer. If this number is less * @@ -437,7 +437,7 @@ int RawFileMClass::Read(void * buffer, int size) long total = 0; while (size > 0) { bytesread = 0; - if (!ReadFile(Handle, buffer, size, &(unsigned long&)bytesread, NULL)) { + if (!ReadFile(Handle, buffer, size, &(unsigned long&)bytesread, nullptr)) { size -= bytesread; total += bytesread; Error(GetLastError(), true, Filename); @@ -493,7 +493,7 @@ int RawFileMClass::Write(void const * buffer, int size) opened = true; } - if (!WriteFile(Handle, buffer, size, &(unsigned long&)bytesread, NULL)) { + if (!WriteFile(Handle, buffer, size, &(unsigned long&)bytesread, nullptr)) { Error(GetLastError(), false, Filename); } @@ -627,7 +627,7 @@ int RawFileMClass::Size(void) */ if (Is_Open()) { - size = GetFileSize(Handle, NULL); + size = GetFileSize(Handle, nullptr); /* ** If there was in internal error, then call the error function. @@ -905,7 +905,7 @@ int RawFileMClass::Raw_Seek(int pos, int dir) break; } - pos = SetFilePointer(Handle, pos, NULL, dir); + pos = SetFilePointer(Handle, pos, nullptr, dir); /* ** If there was an error in the seek, then bail with an error condition. diff --git a/GeneralsMD/Code/Tools/wdump/rawfilem.h b/GeneralsMD/Code/Tools/wdump/rawfilem.h index 9edd63a6a8a..272b6a32cf5 100644 --- a/GeneralsMD/Code/Tools/wdump/rawfilem.h +++ b/GeneralsMD/Code/Tools/wdump/rawfilem.h @@ -160,7 +160,7 @@ class RawFileMClass : public FileClass virtual void Close(void); virtual unsigned long Get_Date_Time(void); virtual bool Set_Date_Time(unsigned long datetime); - virtual void Error(int error, int canretry = false, char const * filename=NULL); + virtual void Error(int error, int canretry = false, char const * filename=nullptr); void Bias(int start, int length=-1); @@ -226,11 +226,11 @@ class RawFileMClass : public FileClass * RawFileMClass::File_Name -- Returns with the filename associate with the file object. * * * * Use this routine to determine what filename is associated with this file object. If no * - * filename has yet been assigned, then this routing will return NULL. * + * filename has yet been assigned, then this routing will return null. * * * * INPUT: none * * * - * OUTPUT: Returns with a pointer to the file name associated with this file object or NULL * + * OUTPUT: Returns with a pointer to the file name associated with this file object or nullptr * * if one doesn't exist. * * * * WARNINGS: none * @@ -294,7 +294,7 @@ inline RawFileMClass::~RawFileMClass(void) Close(); if (Allocated && Filename) { free((char *)Filename); - Filename = NULL; + Filename = nullptr; Allocated = false; } } diff --git a/GeneralsMD/Code/Tools/wdump/wdeview.cpp b/GeneralsMD/Code/Tools/wdump/wdeview.cpp index 0e5044b723f..2b4308c32c6 100644 --- a/GeneralsMD/Code/Tools/wdump/wdeview.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdeview.cpp @@ -86,7 +86,7 @@ void CWDumpEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) CWdumpDoc *doc= (CWdumpDoc *) GetDocument(); ChunkItem *item = doc->m_ChunkItem; - if(item == 0) { + if(item == nullptr) { edit.SetWindowText("Load a chunk file and select the chunk in the tree view to see it's hex data here."); return; // no selected chunk item, leave a clear screen. } @@ -100,7 +100,7 @@ void CWDumpEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) char * CWDumpEditView::Build_Hex_Text(unsigned char * Source, int Length) { - if(Source == 0) { + if(Source == nullptr) { char *c = new char[256]; sprintf(c, "This chunk is a wrapper chunk for other chunks. It's total length is %d", Length); return c; diff --git a/GeneralsMD/Code/Tools/wdump/wdlview.cpp b/GeneralsMD/Code/Tools/wdump/wdlview.cpp index e15f38eee43..a7e720b9e7b 100644 --- a/GeneralsMD/Code/Tools/wdump/wdlview.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdlview.cpp @@ -84,7 +84,7 @@ void CWDumpListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) list.DeleteAllItems(); - if((item != 0) && (item->Type != 0) && (item->Type->Callback != 0)) { + if((item != nullptr) && (item->Type != nullptr) && (item->Type->Callback != nullptr)) { (*item->Type->Callback)(item, &list); } } diff --git a/GeneralsMD/Code/Tools/wdump/wdtview.cpp b/GeneralsMD/Code/Tools/wdump/wdtview.cpp index b1d112364f3..55dee7370ba 100644 --- a/GeneralsMD/Code/Tools/wdump/wdtview.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdtview.cpp @@ -128,10 +128,10 @@ void CWDumpTreeView::InsertItem(ChunkItem * item, HTREEITEM Parent) CTreeCtrl &tree = GetTreeCtrl(); HTREEITEM tree_item = tree.InsertItem(name, Parent); - tree.SetItem(tree_item, TVIF_PARAM,0,0,0,0,0, (long) item); + tree.SetItem(tree_item, TVIF_PARAM,nullptr,0,0,0,0, (long) item); POSITION p = item->Chunks.GetHeadPosition(); - while(p != 0) { + while(p != nullptr) { ChunkItem *subitem = item->Chunks.GetNext(p); InsertItem(subitem, tree_item); } @@ -178,34 +178,34 @@ void CWDumpTreeView::OnToolsFindNext() // Get the currently selected chunk item. selectedtreeitem = GetTreeCtrl().GetSelectedItem(); - if (selectedtreeitem != NULL) { + if (selectedtreeitem != nullptr) { selectedchunkitem = (ChunkItem*) GetTreeCtrl().GetItemData (selectedtreeitem); searchstate = FIND_SELECTED_ITEM; } else { - selectedchunkitem = NULL; + selectedchunkitem = nullptr; searchstate = FIND_STRING; } - p = 0; - matchedchunkitem = NULL; + p = nullptr; + matchedchunkitem = nullptr; while (true) { ChunkItem *chunkitem; // Get the root chunk item. - if (p == 0) { + if (p == nullptr) { p = data->Chunks.GetHeadPosition(); - if (p == 0) break; + if (p == nullptr) break; } chunkitem = data->Chunks.GetNext (p); matchedchunkitem = FindChunkItem (selectedchunkitem, chunkitem, searchstate); - if ((matchedchunkitem != NULL) || (searchstate == SEARCH_WRAPPED)) break; + if ((matchedchunkitem != nullptr) || (searchstate == SEARCH_WRAPPED)) break; } } // Was a match found? - if (matchedchunkitem != NULL) { + if (matchedchunkitem != nullptr) { SelectTreeItem (GetTreeCtrl().GetRootItem(), matchedchunkitem); } else { @@ -214,7 +214,7 @@ void CWDumpTreeView::OnToolsFindNext() char *message; message = new char [strlen (controlstring) + strlen (FindDialog::String())]; - ASSERT (message != NULL); + ASSERT (message != nullptr); sprintf (message, controlstring, FindDialog::String()); MessageBox (message, "Find String", MB_OK | MB_ICONEXCLAMATION); delete [] message; @@ -240,10 +240,10 @@ ChunkItem *CWDumpTreeView::FindChunkItem (ChunkItem *selectedchunkitem, ChunkIte // Searching for a string associated with the chunk item. if (chunkitem == selectedchunkitem) { searchstate = SEARCH_WRAPPED; - return (NULL); + return (nullptr); } else { - if ((chunkitem != 0) && (chunkitem->Type != 0) && (chunkitem->Type->Callback != 0)) { - (*chunkitem->Type->Callback)(chunkitem, NULL); + if ((chunkitem != nullptr) && (chunkitem->Type != nullptr) && (chunkitem->Type->Callback != nullptr)) { + (*chunkitem->Type->Callback)(chunkitem, nullptr); } if (FindDialog::Found()) return (chunkitem); } @@ -254,23 +254,23 @@ ChunkItem *CWDumpTreeView::FindChunkItem (ChunkItem *selectedchunkitem, ChunkIte // This case should never occur at this point. As soon as it has been detected // that the search has wrapped the stack should unwind immediately. ASSERT (FALSE); - return (NULL); + return (nullptr); break; } // Iterate over all chunks in the hierarchy. Return immediately if a match is found or if the search has wrapped. POSITION p = chunkitem->Chunks.GetHeadPosition(); - while (p != 0) { + while (p != nullptr) { ChunkItem *subchunkitem, *matchedchunkitem; subchunkitem = chunkitem->Chunks.GetNext (p); matchedchunkitem = FindChunkItem (selectedchunkitem, subchunkitem, searchstate); - if ((matchedchunkitem != NULL) || (searchstate == SEARCH_WRAPPED)) return (matchedchunkitem); + if ((matchedchunkitem != nullptr) || (searchstate == SEARCH_WRAPPED)) return (matchedchunkitem); } // No match found. - return (NULL); + return (nullptr); } @@ -279,7 +279,7 @@ void CWDumpTreeView::SelectTreeItem (HTREEITEM treeitem, ChunkItem *chunkitem) CTreeCtrl &tree = GetTreeCtrl(); // Select a tree item that matches the given chunk item. Recurse if necessary. - while (treeitem != NULL) { + while (treeitem != nullptr) { HTREEITEM subtreeitem; @@ -287,7 +287,7 @@ void CWDumpTreeView::SelectTreeItem (HTREEITEM treeitem, ChunkItem *chunkitem) tree.SelectItem (treeitem); } subtreeitem = tree.GetChildItem (treeitem); - if (subtreeitem != NULL) { + if (subtreeitem != nullptr) { SelectTreeItem (subtreeitem, chunkitem); } treeitem = tree.GetNextSiblingItem (treeitem); diff --git a/GeneralsMD/Code/Tools/wdump/wdump.cpp b/GeneralsMD/Code/Tools/wdump/wdump.cpp index 6e704fdcc59..ccf59123749 100644 --- a/GeneralsMD/Code/Tools/wdump/wdump.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdump.cpp @@ -35,10 +35,10 @@ static char THIS_FILE[] = __FILE__; #endif -HINSTANCE ApplicationHInstance = NULL; ///< our application instance +HINSTANCE ApplicationHInstance = nullptr; ///< our application instance /// just to satisfy the game libraries we link to -HWND ApplicationHWnd = NULL; +HWND ApplicationHWnd = nullptr; const char *gAppPrefix = "wd_"; @@ -64,7 +64,7 @@ END_MESSAGE_MAP() // CWdumpApp construction CWdumpApp::CWdumpApp() -: DumpTextures(false), NoWindow(false), TextureDumpFile(0) +: DumpTextures(false), NoWindow(false), TextureDumpFile(nullptr) { // TODO: add construction code here, // Place all significant initialization in InitInstance @@ -146,7 +146,7 @@ BOOL CWdumpApp::InitInstance() if(NoWindow) { if(cmdInfo.m_nShellCommand == CWDumpCommandLineInfo::FileOpen) { const char *c = strrchr(cmdInfo.m_strFileName, '\\'); - if(c == 0) + if(c == nullptr) c = (LPCTSTR) cmdInfo.m_strFileName; if(*c == '\\') c++; @@ -158,7 +158,7 @@ BOOL CWdumpApp::InitInstance() /* STARTUPINFO info; GetStartupInfo(&info); - if(info.hStdOutput == NULL) { + if(info.hStdOutput == nullptr) { AllocConsole(); // Allocate console window freopen("CONOUT$", "a", stdout); freopen("CONIN$", "r", stdin); @@ -179,7 +179,7 @@ BOOL CWdumpApp::InitInstance() CWdumpDoc *doc = (CWdumpDoc *) pDocTemplate->OpenDocumentFile(cmdInfo.m_strFileName, FALSE); -/* if(info.hStdOutput == NULL) { +/* if(info.hStdOutput == nullptr) { printf("Press return to close this window.."); getchar(); FreeConsole(); @@ -202,7 +202,7 @@ BOOL CWdumpApp::InitInstance() POSITION p = pDocTemplate->GetFirstDocPosition(); CWdumpDoc *doc = (CWdumpDoc *) pDocTemplate->GetNextDoc(p); - doc->UpdateAllViews(0); + doc->UpdateAllViews(nullptr); return TRUE; } diff --git a/GeneralsMD/Code/Tools/wdump/wdumpdoc.cpp b/GeneralsMD/Code/Tools/wdump/wdumpdoc.cpp index c5f276b2873..2a8c35a73d2 100644 --- a/GeneralsMD/Code/Tools/wdump/wdumpdoc.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdumpdoc.cpp @@ -47,7 +47,7 @@ END_MESSAGE_MAP() CWdumpDoc::CWdumpDoc() { // TODO: add one-time construction code here - m_ChunkItem = 0; + m_ChunkItem = nullptr; } CWdumpDoc::~CWdumpDoc() @@ -56,7 +56,7 @@ CWdumpDoc::~CWdumpDoc() BOOL CWdumpDoc::OnNewDocument() { - m_ChunkItem = 0; + m_ChunkItem = nullptr; if (!CDocument::OnNewDocument()) return FALSE; @@ -107,8 +107,8 @@ void CWdumpDoc::OnFileOpen() static char szFilter[] = "W3D Files (*.w3d)|*.w3d|WLT Files (*.wlt)|*.wlt|WHT Files (*.wht)|*.wht|WHA Files (*.wha)|*.wha|WTM Files (*.wtm)|*.wtm|All Files (*.*)|*.*||"; CFileDialog f( true, - NULL, - NULL, + nullptr, + nullptr, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter); @@ -121,8 +121,8 @@ void CWdumpDoc::OnFileOpen() #if ! defined _W3DSHELLEXT theApp.AddToRecentFileList (f.m_ofn.lpstrFile); #endif - m_ChunkItem = 0; - UpdateAllViews(0); + m_ChunkItem = nullptr; + UpdateAllViews(nullptr); Read_File(f.m_ofn.lpstrFile); } @@ -130,6 +130,6 @@ void CWdumpDoc::OnFileOpen() void CWdumpDoc::Read_File(const char *filename) { m_ChunkData.Load(filename); - m_ChunkItem = 0; - UpdateAllViews(0); + m_ChunkItem = nullptr; + UpdateAllViews(nullptr); } From 373b0df2f2da9399d3cd4bd4445f5a7403ce5af0 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Wed, 14 Jan 2026 13:45:16 -0500 Subject: [PATCH 041/211] bugfix(scriptengine): Fix script dialog text spelling mistakes and errors in ScriptEngine (#2093) --- .gitignore | 6 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 76 ++++++++--------- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 82 +++++++++---------- 3 files changed, 84 insertions(+), 80 deletions(-) diff --git a/.gitignore b/.gitignore index 1c9c525ae12..07b7c71d282 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,8 @@ cmake-build-*/ ## Ninja .ninja_deps .ninja_log -build.ninja \ No newline at end of file +build.ninja + +## Python +__pycache__/ +*.pyc \ No newline at end of file diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index dbffa95e3e9..72d63deea2c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -556,10 +556,10 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = "Announce win."; curTemplate = &m_actionTemplates[ScriptAction::DEFEAT]; - curTemplate->m_name = "[User] Announce lose"; + curTemplate->m_name = "[User] Announce loss"; curTemplate->m_numParameters = 0; curTemplate->m_numUiStrings = 1; - curTemplate->m_uiStrings[0] = "Announce lose."; + curTemplate->m_uiStrings[0] = "Announce loss."; curTemplate = &m_actionTemplates[ScriptAction::NO_OP]; curTemplate->m_name = "[Scripting] Null operation."; @@ -693,7 +693,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Have "; - curTemplate->m_uiStrings[1] = " wander around it's current location."; + curTemplate->m_uiStrings[1] = " wander around its current location."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_INCREASE_PRIORITY]; curTemplate->m_name = "[Team] AI - Increase priority by Success Priority Increase amount."; @@ -701,7 +701,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Increase the AI priority for"; - curTemplate->m_uiStrings[1] = " by its Success Priority Increase amount."; + curTemplate->m_uiStrings[1] = " by its Success Priority Increase amount."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_DECREASE_PRIORITY]; curTemplate->m_name = "[Team] AI - Reduce priority by Failure Priority Decrease amount."; @@ -709,7 +709,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Reduce the AI priority for"; - curTemplate->m_uiStrings[1] = " by its Failure Priority Decrease amount."; + curTemplate->m_uiStrings[1] = " by its Failure Priority Decrease amount."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_WANDER]; curTemplate->m_name = "[Team] Set to follow a waypoint path -- wander."; @@ -786,7 +786,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 4; curTemplate->m_uiStrings[0] = "Have AI "; curTemplate->m_uiStrings[1] = " build a "; - curTemplate->m_uiStrings[2] = " near a supply src with at least "; + curTemplate->m_uiStrings[2] = " near a supply source with at least "; curTemplate->m_uiStrings[3] = " available resources."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_SUPPLY_CENTER]; @@ -796,7 +796,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::INT; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = "Have Team "; - curTemplate->m_uiStrings[1] = " guard attacked or closest supply src with at least "; + curTemplate->m_uiStrings[1] = " guard attacked or closest supply source with at least "; curTemplate->m_uiStrings[2] = " available resources"; curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_UPGRADE]; @@ -902,7 +902,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " adding toward white. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SUBTRACT]; @@ -918,7 +918,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " subtracting toward black. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_MULTIPLY]; @@ -934,7 +934,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " multiplying toward black. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SATURATE]; @@ -950,7 +950,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " increasing saturation. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::PITCH_CAMERA]; @@ -1440,7 +1440,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " load into transports."; curTemplate = &m_actionTemplates[ScriptAction::NAMED_ENTER_NAMED]; - curTemplate->m_name = "[Unit] Transport -- load unit into specific."; + curTemplate->m_name = "[Unit] Transport -- load unit into specific transport."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::UNIT; curTemplate->m_parameters[1] = Parameter::UNIT; @@ -1449,7 +1449,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " loads into "; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ENTER_NAMED]; - curTemplate->m_name = "[Team] Transport -- load team into specific."; + curTemplate->m_name = "[Team] Transport -- load team into specific transport."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_parameters[1] = Parameter::UNIT; @@ -1458,7 +1458,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " attempt to load into "; curTemplate = &m_actionTemplates[ScriptAction::NAMED_EXIT_ALL]; - curTemplate->m_name = "[Unit] Transport -- unload units from specific."; + curTemplate->m_name = "[Unit] Transport -- unload units from specific transport."; curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::UNIT; curTemplate->m_numUiStrings = 2; @@ -2531,7 +2531,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_TEAM]; curTemplate->m_name = "[Team] Remove an override to a team's relationship to another team."; @@ -2631,7 +2631,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_PLAYER]; curTemplate->m_name = "[Team] Remove an override to a team's relationship to another player."; @@ -2652,7 +2652,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::PLAYER_REMOVE_OVERRIDE_RELATION_TO_TEAM]; curTemplate->m_name = "[Player] Remove an override to a player's relationship to another team."; @@ -3081,7 +3081,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on "; + curTemplate->m_uiStrings[2] = " on "; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_UNIT]; curTemplate->m_name = "[Team] Use command ability -- all -- nearest enemy unit"; @@ -3091,7 +3091,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy unit."; + curTemplate->m_uiStrings[2] = " on nearest enemy unit."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_GARRISONED_BUILDING]; curTemplate->m_name = "[Team] Use command ability -- all -- nearest enemy garrisoned building."; @@ -3101,7 +3101,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy garrisoned building."; + curTemplate->m_uiStrings[2] = " on nearest enemy garrisoned building."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_KINDOF]; curTemplate->m_name = "[Team] Use command ability -- all -- nearest enemy object with kind of."; @@ -3112,7 +3112,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 4; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy with "; + curTemplate->m_uiStrings[2] = " on nearest enemy with "; curTemplate->m_uiStrings[4] = "."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING]; @@ -3123,7 +3123,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy building."; + curTemplate->m_uiStrings[2] = " on nearest enemy building."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING_CLASS]; curTemplate->m_name = "[Team] Use command ability -- all -- nearest enemy building kindof."; @@ -3134,7 +3134,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy building with "; + curTemplate->m_uiStrings[2] = " on nearest enemy building with "; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_OBJECTTYPE]; curTemplate->m_name = "[Team] Use command ability -- all -- nearest object type."; @@ -3576,7 +3576,7 @@ void ScriptEngine::init( void ) curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::SIDE; curTemplate->m_numUiStrings = 2; - curTemplate->m_uiStrings[0] = "Everything belonging to "; + curTemplate->m_uiStrings[0] = "Everything belonging to "; curTemplate->m_uiStrings[1] = " has been destroyed."; curTemplate = &m_conditionTemplates[Condition::PLAYER_ALL_BUILDFACILITIES_DESTROYED]; @@ -3584,7 +3584,7 @@ void ScriptEngine::init( void ) curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::SIDE; curTemplate->m_numUiStrings = 2; - curTemplate->m_uiStrings[0] = "All factories belonging to "; + curTemplate->m_uiStrings[0] = "All factories belonging to "; curTemplate->m_uiStrings[1] = " have been destroyed."; @@ -4454,7 +4454,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; - curTemplate->m_uiStrings[1] = " has doesn't have units in "; + curTemplate->m_uiStrings[1] = " doesn't have units in "; curTemplate->m_uiStrings[2] = "."; curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_DISCOVERED_PLAYER]; @@ -4485,7 +4485,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::INT; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = ""; - curTemplate->m_uiStrings[1] = " closest supply src with at least "; + curTemplate->m_uiStrings[1] = " closest supply source with at least "; curTemplate->m_uiStrings[2] = " available resources is SAFE from enemy influence."; curTemplate = &m_conditionTemplates[Condition::SUPPLY_SOURCE_ATTACKED]; @@ -4581,8 +4581,8 @@ void ScriptEngine::reset( void ) if (m_numFrames > 1) { DEBUG_LOG_RAW(("\n")); DEBUG_LOG(("***SCRIPT ENGINE STATS %.0f frames:", m_numFrames)); - DEBUG_LOG(("Avg time to update %.3f milisec", 1000*m_totalUpdateTime/m_numFrames)); - DEBUG_LOG((" Max time to update %.3f miliseconds.", m_maxUpdateTime*1000)); + DEBUG_LOG(("Avg time to update %.3f milliseconds", 1000*m_totalUpdateTime/m_numFrames)); + DEBUG_LOG((" Max time to update %.3f milliseconds.", m_maxUpdateTime*1000)); } m_numFrames=0; m_totalUpdateTime=0; @@ -6192,14 +6192,14 @@ void ScriptEngine::checkConditionsForTeamNames(Script *pScript) singletonTeamName = teamName; // Singleton team - use if it is the only one, but can have multiple of these. } else { if (multiTeamName.isEmpty()) { - multiTeamName = teamName; // Use one multiply defined team. Good. + multiTeamName = teamName; // Use one team defined multiple times. Good. } else if (multiTeamName!=teamName) { - // More than one multiply defined team - bad. - AppendDebugMessage("***WARNING: Script contains multiple non-singleton team conditions::***", false); + // More than one team defined multiple times - bad. + AppendDebugMessage("***WARNING: Script contains multiple conditions for teams defined multiple times::***", false); AppendDebugMessage(scriptName, false); AppendDebugMessage(multiTeamName, false); AppendDebugMessage(teamName, false); - DEBUG_LOG(("WARNING: Script '%s' contains multiple non-singleton team conditions: %s & %s.", scriptName.str(), + DEBUG_LOG(("WARNING: Script '%s' contains multiple conditions for teams defined multiple times: %s & %s.", scriptName.str(), multiTeamName.str(), teamName.str())); } } @@ -6285,7 +6285,7 @@ void ScriptEngine::executeScript( Script *pScript ) // Script Debug window _appendMessage(pScript->getName(), false); - // Only do this is there are actually false actions. + // Only do this if there are actually false actions. executeActions(pScript->getFalseAction()); } } @@ -6308,7 +6308,7 @@ void ScriptEngine::executeScript( Script *pScript ) // Script Debug window _appendMessage(pScript->getName(), false); - // Only do this is there are actually false actions. + // Only do this if there are actually false actions. executeActions(pScript->getFalseAction()); if (pScript->isOneShot()) { pScript->setActive(false); @@ -6441,7 +6441,7 @@ void ScriptEngine::transferObjectName( const AsciiString& unitName, Object *pNew removeObjectFromCache(pNewObject); } - pNewObject->setName(unitName); // make sure it's named the name. + pNewObject->setName(unitName); // make sure it has the correct name. //Loop through the cached list and find the string entry. If found, change the object //so it's pointing to the new one. @@ -7497,7 +7497,7 @@ void SequentialScript::xfer( Xfer *xfer ) // frames to wait xfer->xferInt( &m_framesToWait ); - // dont advance instruction + // don't advance instruction xfer->xferBool( &m_dontAdvanceInstruction ); } @@ -8469,7 +8469,7 @@ void ScriptEngine::xfer( Xfer *xfer ) else { - // the vector should be emtpy now + // the vector should be empty now if( m_namedReveals.empty() == FALSE ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 9fb0bbf42e3..08edd272242 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -664,10 +664,10 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::DEFEAT]; curTemplate->m_internalName = "DEFEAT"; - curTemplate->m_uiName = "User_/ Announce lose"; + curTemplate->m_uiName = "User_/ Announce loss"; curTemplate->m_numParameters = 0; curTemplate->m_numUiStrings = 1; - curTemplate->m_uiStrings[0] = "Announce lose."; + curTemplate->m_uiStrings[0] = "Announce loss."; curTemplate = &m_actionTemplates[ScriptAction::NO_OP]; curTemplate->m_internalName = "NO_OP"; @@ -816,7 +816,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Have "; - curTemplate->m_uiStrings[1] = " wander around it's current location."; + curTemplate->m_uiStrings[1] = " wander around its current location."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_INCREASE_PRIORITY]; curTemplate->m_internalName = "TEAM_INCREASE_PRIORITY"; @@ -825,7 +825,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Increase the AI priority for"; - curTemplate->m_uiStrings[1] = " by its Success Priority Increase amount."; + curTemplate->m_uiStrings[1] = " by its Success Priority Increase amount."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_DECREASE_PRIORITY]; curTemplate->m_internalName = "TEAM_DECREASE_PRIORITY"; @@ -834,7 +834,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_numUiStrings = 2; curTemplate->m_uiStrings[0] = "Reduce the AI priority for"; - curTemplate->m_uiStrings[1] = " by its Failure Priority Decrease amount."; + curTemplate->m_uiStrings[1] = " by its Failure Priority Decrease amount."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_WANDER]; curTemplate->m_internalName = "TEAM_WANDER"; @@ -908,7 +908,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 4; curTemplate->m_uiStrings[0] = "Have AI "; curTemplate->m_uiStrings[1] = " build a "; - curTemplate->m_uiStrings[2] = " near a supply src with at least "; + curTemplate->m_uiStrings[2] = " near a supply source with at least "; curTemplate->m_uiStrings[3] = " available resources."; curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_TYPE_NEAREST_TEAM]; @@ -932,7 +932,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::INT; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = "Have Team "; - curTemplate->m_uiStrings[1] = " guard attacked or closest supply src with at least "; + curTemplate->m_uiStrings[1] = " guard attacked or closest supply source with at least "; curTemplate->m_uiStrings[2] = " available resources"; curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_UPGRADE]; @@ -1057,7 +1057,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " adding toward white. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SUBTRACT]; @@ -1074,7 +1074,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " subtracting toward black. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_MULTIPLY]; @@ -1091,7 +1091,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " multiplying toward black. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SATURATE]; @@ -1108,7 +1108,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[1] = " to "; curTemplate->m_uiStrings[2] = " increasing saturation. Take "; curTemplate->m_uiStrings[3] = " frames to increase, hold for "; - curTemplate->m_uiStrings[4] = " fames, and decrease "; + curTemplate->m_uiStrings[4] = " frames, and decrease "; curTemplate->m_uiStrings[5] = " frames."; curTemplate = &m_actionTemplates[ScriptAction::PITCH_CAMERA]; @@ -1582,7 +1582,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " will delay "; - curTemplate->m_uiStrings[1] = " seconds between building teams."; + curTemplate->m_uiStrings[2] = " seconds between building teams."; curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_ATTITUDE]; curTemplate->m_internalName = "NAMED_SET_ATTITUDE"; @@ -1675,7 +1675,7 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::NAMED_ENTER_NAMED]; curTemplate->m_internalName = "NAMED_ENTER_NAMED"; - curTemplate->m_uiName = "Unit_/Transport/Transport -- load unit into specific."; + curTemplate->m_uiName = "Unit_/Transport/Transport -- load unit into specific transport."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::UNIT; curTemplate->m_parameters[1] = Parameter::UNIT; @@ -1685,7 +1685,7 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::TEAM_ENTER_NAMED]; curTemplate->m_internalName = "TEAM_ENTER_NAMED"; - curTemplate->m_uiName = "Team_/Transport/Transport -- load team into specific."; + curTemplate->m_uiName = "Team_/Transport/Transport -- load team into specific transport."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_parameters[1] = Parameter::UNIT; @@ -1695,7 +1695,7 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::NAMED_EXIT_ALL]; curTemplate->m_internalName = "NAMED_EXIT_ALL"; - curTemplate->m_uiName = "Unit_/Transport/Transport -- unload units from specific."; + curTemplate->m_uiName = "Unit_/Transport/Transport -- unload units from specific transport."; curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::UNIT; curTemplate->m_numUiStrings = 2; @@ -2182,7 +2182,7 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::OBJECT_CREATE_RADAR_EVENT]; curTemplate->m_internalName = "OBJECT_CREATE_RADAR_EVENT"; - curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific object."; + curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific object."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::UNIT; curTemplate->m_parameters[1] = Parameter::RADAR_EVENT_TYPE; @@ -2192,7 +2192,7 @@ void ScriptEngine::init( void ) curTemplate = &m_actionTemplates[ScriptAction::TEAM_CREATE_RADAR_EVENT]; curTemplate->m_internalName = "TEAM_CREATE_RADAR_EVENT"; - curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific team."; + curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific team."; curTemplate->m_numParameters = 2; curTemplate->m_parameters[0] = Parameter::TEAM; curTemplate->m_parameters[1] = Parameter::RADAR_EVENT_TYPE; @@ -2935,7 +2935,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_TEAM]; curTemplate->m_internalName = "TEAM_REMOVE_OVERRIDE_RELATION_TO_TEAM"; @@ -3055,7 +3055,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_PLAYER]; curTemplate->m_internalName = "TEAM_REMOVE_OVERRIDE_RELATION_TO_PLAYER"; @@ -3078,7 +3078,7 @@ void ScriptEngine::init( void ) curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " considers "; curTemplate->m_uiStrings[2] = " to be "; - curTemplate->m_uiStrings[3] = " (rather than using the the player relationship)."; + curTemplate->m_uiStrings[3] = " (rather than using the player relationship)."; curTemplate = &m_actionTemplates[ScriptAction::PLAYER_REMOVE_OVERRIDE_RELATION_TO_TEAM]; curTemplate->m_internalName = "PLAYER_REMOVE_OVERRIDE_RELATION_TO_TEAM"; @@ -3599,7 +3599,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on "; + curTemplate->m_uiStrings[2] = " on "; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_UNIT]; curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_UNIT"; @@ -3610,7 +3610,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy unit."; + curTemplate->m_uiStrings[2] = " on nearest enemy unit."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_GARRISONED_BUILDING]; curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_GARRISONED_BUILDING"; @@ -3621,7 +3621,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy garrisoned building."; + curTemplate->m_uiStrings[2] = " on nearest enemy garrisoned building."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_KINDOF]; curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_KINDOF"; @@ -3633,7 +3633,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 4; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy with "; + curTemplate->m_uiStrings[2] = " on nearest enemy with "; curTemplate->m_uiStrings[4] = "."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING]; @@ -3645,7 +3645,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy building."; + curTemplate->m_uiStrings[2] = " on nearest enemy building."; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING_CLASS]; curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING_CLASS"; @@ -3657,7 +3657,7 @@ void ScriptEngine::init( void ) curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; curTemplate->m_uiStrings[1] = " use "; - curTemplate->m_uiStrings[2] = " on nearest enemy building with "; + curTemplate->m_uiStrings[2] = " on nearest enemy building with "; curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_OBJECTTYPE]; curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_OBJECTTYPE"; @@ -4185,7 +4185,7 @@ void ScriptEngine::init( void ) curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::SIDE; curTemplate->m_numUiStrings = 2; - curTemplate->m_uiStrings[0] = "Everything belonging to "; + curTemplate->m_uiStrings[0] = "Everything belonging to "; curTemplate->m_uiStrings[1] = " has been destroyed."; curTemplate = &m_conditionTemplates[Condition::PLAYER_ALL_BUILDFACILITIES_DESTROYED]; @@ -4194,7 +4194,7 @@ void ScriptEngine::init( void ) curTemplate->m_numParameters = 1; curTemplate->m_parameters[0] = Parameter::SIDE; curTemplate->m_numUiStrings = 2; - curTemplate->m_uiStrings[0] = "All factories belonging to "; + curTemplate->m_uiStrings[0] = "All factories belonging to "; curTemplate->m_uiStrings[1] = " have been destroyed."; @@ -5160,7 +5160,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; - curTemplate->m_uiStrings[1] = " has doesn't have units in "; + curTemplate->m_uiStrings[1] = " doesn't have units in "; curTemplate->m_uiStrings[2] = "."; curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_DISCOVERED_PLAYER]; @@ -5194,7 +5194,7 @@ void ScriptEngine::init( void ) curTemplate->m_parameters[1] = Parameter::INT; curTemplate->m_numUiStrings = 3; curTemplate->m_uiStrings[0] = " "; - curTemplate->m_uiStrings[1] = " closest supply src with at least "; + curTemplate->m_uiStrings[1] = " closest supply source with at least "; curTemplate->m_uiStrings[2] = " available resources is SAFE from enemy influence."; curTemplate = &m_conditionTemplates[Condition::SUPPLY_SOURCE_ATTACKED]; @@ -5316,8 +5316,8 @@ void ScriptEngine::reset( void ) if (m_numFrames > 1) { DEBUG_LOG_RAW(("\n")); DEBUG_LOG(("***SCRIPT ENGINE STATS %.0f frames:", m_numFrames)); - DEBUG_LOG(("Avg time to update %.3f milisec", 1000*m_totalUpdateTime/m_numFrames)); - DEBUG_LOG((" Max time to update %.3f miliseconds.", m_maxUpdateTime*1000)); + DEBUG_LOG(("Avg time to update %.3f milliseconds", 1000*m_totalUpdateTime/m_numFrames)); + DEBUG_LOG((" Max time to update %.3f milliseconds.", m_maxUpdateTime*1000)); } m_numFrames=0; m_totalUpdateTime=0; @@ -6913,14 +6913,14 @@ void ScriptEngine::checkConditionsForTeamNames(Script *pScript) singletonTeamName = teamName; // Singleton team - use if it is the only one, but can have multiple of these. } else { if (multiTeamName.isEmpty()) { - multiTeamName = teamName; // Use one multiply defined team. Good. + multiTeamName = teamName; // Use one team defined multiple times. Good. } else if (multiTeamName!=teamName) { - // More than one multiply defined team - bad. - AppendDebugMessage("***WARNING: Script contains multiple non-singleton team conditions::***", false); + // More than one team defined multiple times - bad. + AppendDebugMessage("***WARNING: Script contains multiple conditions for teams defined multiple times::***", false); AppendDebugMessage(scriptName, false); AppendDebugMessage(multiTeamName, false); AppendDebugMessage(teamName, false); - DEBUG_LOG(("WARNING: Script '%s' contains multiple non-singleton team conditions: %s & %s.", scriptName.str(), + DEBUG_LOG(("WARNING: Script '%s' contains multiple conditions for teams defined multiple times: %s & %s.", scriptName.str(), multiTeamName.str(), teamName.str())); } } @@ -7006,7 +7006,7 @@ void ScriptEngine::executeScript( Script *pScript ) // Script Debug window _appendMessage(pScript->getName(), false); - // Only do this is there are actually false actions. + // Only do this if there are actually false actions. executeActions(pScript->getFalseAction()); } } @@ -7029,7 +7029,7 @@ void ScriptEngine::executeScript( Script *pScript ) // Script Debug window _appendMessage(pScript->getName(), false); - // Only do this is there are actually false actions. + // Only do this if there are actually false actions. executeActions(pScript->getFalseAction()); if (pScript->isOneShot()) { pScript->setActive(false); @@ -7162,7 +7162,7 @@ void ScriptEngine::transferObjectName( const AsciiString& unitName, Object *pNew removeObjectFromCache(pNewObject); } - pNewObject->setName(unitName); // make sure it's named the name. + pNewObject->setName(unitName); // make sure it has the correct name. //Loop through the cached list and find the string entry. If found, change the object //so it's pointing to the new one. @@ -8220,7 +8220,7 @@ void SequentialScript::xfer( Xfer *xfer ) // frames to wait xfer->xferInt( &m_framesToWait ); - // dont advance instruction + // don't advance instruction xfer->xferBool( &m_dontAdvanceInstruction ); } @@ -9192,7 +9192,7 @@ void ScriptEngine::xfer( Xfer *xfer ) else { - // the vector should be emtpy now + // the vector should be empty now if( m_namedReveals.empty() == FALSE ) { From e9895768f47f80c0479f7dbfba5a96843050420f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 14 Jan 2026 21:46:24 +0100 Subject: [PATCH 042/211] perf(heightmap): Optimize repeated calls to getXWithOrigin, getYWithOrigin in HeightMapRenderObjClass::updateVB (#2102) --- .../Source/W3DDevice/GameClient/HeightMap.cpp | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index b7297fb3cde..feec94bb68c 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -329,23 +329,25 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb += (j-originY)*vertsPerRow; //skip to correct row in vertex buffer vb += (x0-originX)*4; //skip to correct vertex in row. - vn0 = getYWithOrigin(j)-cellOffset; + const Int mapY = getYWithOrigin(j); + vn0 = mapY-cellOffset; if (vn0 < -pMap->getDrawOrgY()) vn0=-pMap->getDrawOrgY(); vp1 = getYWithOrigin(j+cellOffset)+cellOffset; if (vp1 >= pMap->getYExtent()-pMap->getDrawOrgY()) vp1=pMap->getYExtent()-pMap->getDrawOrgY()-1; - yCoord = getYWithOrigin(j)+pMap->getDrawOrgY(); + yCoord = mapY+pMap->getDrawOrgY(); for (i=x0; igetDrawOrgX()) un0=-pMap->getDrawOrgX(); up1 = getXWithOrigin(i+cellOffset)+cellOffset; if (up1 >= pMap->getXExtent()-pMap->getDrawOrgX()) up1=pMap->getXExtent()-pMap->getDrawOrgX()-1; - xCoord = getXWithOrigin(i)+pMap->getDrawOrgX(); + xCoord = mapX+pMap->getDrawOrgX(); //update the 4 vertices in this block float U[4], V[4]; @@ -353,11 +355,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int float UA[4], VA[4]; Bool flipForBlend = false; // True if the blend needs the triangles flipped. - if (pMap) { - pMap->getUVData(getXWithOrigin(i),getYWithOrigin(j),U, V); - pMap->getAlphaUVData(getXWithOrigin(i),getYWithOrigin(j), UA, VA, alpha, &flipForBlend); - } - + pMap->getUVData(mapX, mapY, U, V); + pMap->getAlphaUVData(mapX, mapY, UA, VA, alpha, &flipForBlend); for (Int lightIndex=0; lightIndex < TheGlobalData->m_numGlobalLights; lightIndex++) { @@ -366,8 +365,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int } //top-left sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset, getYWithOrigin(j)) - pMap->getDisplayHeight(un0, getYWithOrigin(j)))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i), (getYWithOrigin(j)+cellOffset)) - pMap->getDisplayHeight(getXWithOrigin(i), vn0))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX+cellOffset, mapY) - pMap->getDisplayHeight(un0, mapY))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX, (mapY+cellOffset)) - pMap->getDisplayHeight(mapX, vn0))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -377,7 +376,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb->x=xCoord; vb->y=yCoord; - vb->z= ((float)pMap->getDisplayHeight(getXWithOrigin(i), getYWithOrigin(j)))*MAP_HEIGHT_SCALE; + vb->z= ((float)pMap->getDisplayHeight(mapX, mapY))*MAP_HEIGHT_SCALE; vb->x = ADJUST_FROM_INDEX_TO_REAL(vb->x); vb->y = ADJUST_FROM_INDEX_TO_REAL(vb->y); vb->u1=U[0]; @@ -388,8 +387,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb++; //top-right sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(up1 , getYWithOrigin(j) ) - pMap->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset , (getYWithOrigin(j)+cellOffset) ) - pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset , vn0 ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(up1 , mapY ) - pMap->getDisplayHeight(mapX , mapY ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX+cellOffset , (mapY+cellOffset) ) - pMap->getDisplayHeight(mapX+cellOffset , vn0 ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -399,7 +398,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb->x=xCoord+cellOffset; vb->y=yCoord; - vb->z= ((float)pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset, getYWithOrigin(j)))*MAP_HEIGHT_SCALE; + vb->z= ((float)pMap->getDisplayHeight(mapX+cellOffset, mapY))*MAP_HEIGHT_SCALE; vb->x = ADJUST_FROM_INDEX_TO_REAL(vb->x); vb->y = ADJUST_FROM_INDEX_TO_REAL(vb->y); vb->u1=U[1]; @@ -410,8 +409,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb++; //bottom-right sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(up1 , (getYWithOrigin(j)+cellOffset) ) - pMap->getDisplayHeight(getXWithOrigin(i) , (getYWithOrigin(j)+cellOffset) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset , vp1 ) - pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(up1 , (mapY+cellOffset) ) - pMap->getDisplayHeight(mapX , (mapY+cellOffset) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX+cellOffset , vp1 ) - pMap->getDisplayHeight(mapX+cellOffset , mapY ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -425,7 +424,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int } else { vb->y=yCoord+cellOffset; } - vb->z= ((float)pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset, getYWithOrigin(j)+cellOffset))*MAP_HEIGHT_SCALE; + vb->z= ((float)pMap->getDisplayHeight(mapX+cellOffset, mapY+cellOffset))*MAP_HEIGHT_SCALE; vb->x = ADJUST_FROM_INDEX_TO_REAL(vb->x); vb->y = ADJUST_FROM_INDEX_TO_REAL(vb->y); vb->u1=U[2]; @@ -436,8 +435,8 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int vb++; //bottom-left sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i)+cellOffset , (getYWithOrigin(j)+cellOffset) ) - pMap->getDisplayHeight(un0 , (getYWithOrigin(j)+cellOffset) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(getXWithOrigin(i) , vp1 ) - pMap->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX+cellOffset , (mapY+cellOffset) ) - pMap->getDisplayHeight(un0 , (mapY+cellOffset) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(pMap->getDisplayHeight(mapX , vp1 ) - pMap->getDisplayHeight(mapX , mapY ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -456,7 +455,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int } else { vb->y=yCoord+cellOffset; } - vb->z= ((float)pMap->getDisplayHeight(getXWithOrigin(i), getYWithOrigin(j)+cellOffset))*MAP_HEIGHT_SCALE; + vb->z= ((float)pMap->getDisplayHeight(mapX, mapY+cellOffset))*MAP_HEIGHT_SCALE; vb->x = ADJUST_FROM_INDEX_TO_REAL(vb->x); vb->y = ADJUST_FROM_INDEX_TO_REAL(vb->y); vb->u1=U[3]; @@ -484,15 +483,14 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int Real borderHiX = (pMap->getXExtent()-2*pMap->getBorderSizeInline())*MAP_XY_FACTOR; Real borderHiY = (pMap->getYExtent()-2*pMap->getBorderSizeInline())*MAP_XY_FACTOR; Bool border = pCurVertices[0].x == -MAP_XY_FACTOR || pCurVertices[0].y == -MAP_XY_FACTOR; - Bool cliffMapped = pMap->isCliffMappedTexture(getXWithOrigin(i), getYWithOrigin(j)); + Bool cliffMapped = pMap->isCliffMappedTexture(mapX, mapY); if (pCurVertices[0].x == borderHiX) { border = true; } if (pCurVertices[0].y == borderHiY) { border = true; } - Bool isCliff = pMap->getCliffState(getXWithOrigin(i)+pMap->getDrawOrgX(), getYWithOrigin(j)+pMap->getDrawOrgY()) - || showAsVisibleCliff(getXWithOrigin(i) + pMap->getDrawOrgX(), getYWithOrigin(j)+pMap->getDrawOrgY()); + Bool isCliff = pMap->getCliffState(xCoord, yCoord) || showAsVisibleCliff(xCoord, yCoord); if ( isCliff || border || cliffMapped) { Int cellX, cellY; @@ -569,7 +567,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d for (j=y0; jgetDrawOrgY()-m_map->getBorderSizeInline(); + const Int mapY = getYWithOrigin(j); + const Int yCoord = mapY+m_map->getDrawOrgY()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; km_minY <= yCoord+1 && @@ -584,7 +583,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d if (!intersect) { continue; } - vn0 = getYWithOrigin(j)-1; + vn0 = mapY-1; if (vn0 < -m_map->getDrawOrgY()) vn0=-m_map->getDrawOrgY(); vp1 = getYWithOrigin(j+1)+1; @@ -593,7 +592,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d for (i=x0; igetDrawOrgX()-m_map->getBorderSizeInline(); + const Int mapX = getXWithOrigin(i); + const Int xCoord = mapX+m_map->getDrawOrgX()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; km_minX <= xCoord+1 && @@ -620,7 +620,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d // diffuse color, and xyz location. It is VERY SLOW to read out of the // hardware vertex buffer, possibly worse... jba. VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset; - un0 = getXWithOrigin(i)-1; + un0 = mapX-1; if (un0 < -m_map->getDrawOrgX()) un0=-m_map->getDrawOrgX(); up1 = getXWithOrigin(i+1)+1; @@ -630,8 +630,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d Vector3 lightRay(0,0,0); //top-left sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1, getYWithOrigin(j)) - m_map->getDisplayHeight(un0, getYWithOrigin(j)))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i), (getYWithOrigin(j)+1)) - m_map->getDisplayHeight(getXWithOrigin(i), vn0))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1, mapY) - m_map->getDisplayHeight(un0, mapY))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX, (mapY+1)) - m_map->getDisplayHeight(mapX, vn0))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -643,8 +643,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d vb++; vbMirror++; //top-right sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , getYWithOrigin(j) ) - m_map->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(getXWithOrigin(i)+1 , vn0 ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , mapY ) - m_map->getDisplayHeight(mapX , mapY ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , (mapY+1) ) - m_map->getDisplayHeight(mapX+1 , vn0 ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -656,8 +656,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d vb++; vbMirror++; //bottom-right sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(getXWithOrigin(i) , (getYWithOrigin(j)+1) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , vp1 ) - m_map->getDisplayHeight(getXWithOrigin(i)+1 , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , (mapY+1) ) - m_map->getDisplayHeight(mapX , (mapY+1) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , vp1 ) - m_map->getDisplayHeight(mapX+1 , mapY ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -669,8 +669,8 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d vb++; vbMirror++; //bottom-left sample - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(un0 , (getYWithOrigin(j)+1) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i) , vp1 ) - m_map->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , (mapY+1) ) - m_map->getDisplayHeight(un0 , (mapY+1) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX , vp1 ) - m_map->getDisplayHeight(mapX , mapY ))); #ifdef ALLOW_TEMPORARIES normalAtTexel= Normalize(Vector3::Cross_Product(l2r,n2f)); @@ -722,7 +722,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB // for (j=y0; jgetDrawOrgY()-m_map->getBorderSizeInline(); + const Int mapY = getYWithOrigin(j); + const Int yCoord = mapY+m_map->getDrawOrgY()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; km_minY <= yCoord+1 && @@ -737,7 +738,7 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB if (!intersect) { continue; } - vn0 = getYWithOrigin(j)-1; + vn0 = mapY-1; if (vn0 < -m_map->getDrawOrgY()) vn0=-m_map->getDrawOrgY(); vp1 = getYWithOrigin(j+1)+1; @@ -746,7 +747,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB for (i=x0; igetDrawOrgX()-m_map->getBorderSizeInline(); + const Int mapX = getXWithOrigin(i); + const Int xCoord = mapX+m_map->getDrawOrgX()-m_map->getBorderSizeInline(); Bool intersect = false; for (k=0; km_minX <= xCoord+1 && @@ -774,7 +776,7 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB // hardware vertex buffer, possibly worse... jba. VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset; VERTEX_FORMAT *vbaseMirror = ((VERTEX_FORMAT*)data); - un0 = getXWithOrigin(i)-1; + un0 = mapX-1; if (un0 < -m_map->getDrawOrgX()) un0=-m_map->getDrawOrgX(); up1 = getXWithOrigin(i+1)+1; @@ -794,8 +796,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB // top-left sample -> only compute when i==0 and j==0 if ((i==x0) && (j==y0)) { - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1, getYWithOrigin(j)) - m_map->getDisplayHeight(un0, getYWithOrigin(j)))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i), (getYWithOrigin(j)+1)) - m_map->getDisplayHeight(getXWithOrigin(i), vn0))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1, mapY) - m_map->getDisplayHeight(un0, mapY))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX, (mapY+1)) - m_map->getDisplayHeight(mapX, vn0))); Vector3::Normalized_Cross_Product(l2r, n2f, &normalAtTexel); doTheDynamicLight(vb, vbMirror, &lightRay, &normalAtTexel, pLights, numLights); } @@ -803,8 +805,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB //top-right sample -> compute when j==0, then copy to (right,0) if (j==y0) { - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , getYWithOrigin(j) ) - m_map->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(getXWithOrigin(i)+1 , vn0 ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , mapY ) - m_map->getDisplayHeight(mapX , mapY ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , (mapY+1) ) - m_map->getDisplayHeight(mapX+1 , vn0 ))); Vector3::Normalized_Cross_Product(l2r, n2f, &normalAtTexel); light_copy = doTheDynamicLight(vb, vbMirror, &lightRay, &normalAtTexel, pLights, numLights); @@ -816,8 +818,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB vb++; vbMirror++; //bottom-right sample -> always compute, then copy to (right,3), (down,1), (down+right,0) - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(getXWithOrigin(i) , (getYWithOrigin(j)+1) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , vp1 ) - m_map->getDisplayHeight(getXWithOrigin(i)+1 , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(up1 , (mapY+1) ) - m_map->getDisplayHeight(mapX , (mapY+1) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , vp1 ) - m_map->getDisplayHeight(mapX+1 , mapY ))); Vector3::Normalized_Cross_Product(l2r, n2f, &normalAtTexel); light_copy = doTheDynamicLight(vb, vbMirror, &lightRay, &normalAtTexel, pLights, numLights); @@ -840,8 +842,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB //bottom-left sample -> compute when i==0, otherwise copy from (left,2) if (i==x0) { - l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i)+1 , (getYWithOrigin(j)+1) ) - m_map->getDisplayHeight(un0 , (getYWithOrigin(j)+1) ))); - n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(getXWithOrigin(i) , vp1 ) - m_map->getDisplayHeight(getXWithOrigin(i) , getYWithOrigin(j) ))); + l2r.Set(2*MAP_XY_FACTOR,0,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX+1 , (mapY+1) ) - m_map->getDisplayHeight(un0 , (mapY+1) ))); + n2f.Set(0,2*MAP_XY_FACTOR,MAP_HEIGHT_SCALE*(m_map->getDisplayHeight(mapX , vp1 ) - m_map->getDisplayHeight(mapX , mapY ))); Vector3::Normalized_Cross_Product(l2r, n2f, &normalAtTexel); light_copy = doTheDynamicLight(vb, vbMirror, &lightRay, &normalAtTexel, pLights, numLights); From 833fb7c4c360c8d0f7ba338c9167cdf9c99bc444 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 14 Jan 2026 21:46:56 +0100 Subject: [PATCH 043/211] refactor(heightmap): Simplify functions getXWithOrigin(), getYWithOrigin() of HeightMapRenderObjClass (#2103) --- .../Source/W3DDevice/GameClient/HeightMap.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index feec94bb68c..e5a6191514a 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -257,15 +257,12 @@ is confusing, but it makes sliding the map 10x faster. */ //============================================================================= Int HeightMapRenderObjClass::getXWithOrigin(Int x) { + const Int xMax = m_x-1; x -= m_originX; - if (x<0) x+= m_x-1; - if (x>= m_x-1) x-=m_x-1; -#ifdef RTS_DEBUG - DEBUG_ASSERTCRASH (x>=0, ("X out of range.")); - DEBUG_ASSERTCRASH (x= m_x-1) x=m_x-1; + if (x < 0) x += xMax; + if (x >= xMax) x -= xMax; + if (x < 0) { DEBUG_CRASH(("X out of range.")); x = 0; } + if (x >= xMax) { DEBUG_CRASH(("X out of range.")); x = xMax; } return x; } @@ -278,15 +275,12 @@ is confusing, but it makes sliding the map 10x faster. */ //============================================================================= Int HeightMapRenderObjClass::getYWithOrigin(Int y) { + const Int yMax = m_y-1; y -= m_originY; - if (y<0) y+= m_y-1; - if (y>= m_y-1) y-=m_y-1; -#ifdef RTS_DEBUG - DEBUG_ASSERTCRASH (y>=0, ("Y out of range.")); - DEBUG_ASSERTCRASH (y= m_y-1) y=m_y-1; + if (y < 0) y += yMax; + if (y >= yMax) y -= yMax; + if (y < 0) { DEBUG_CRASH(("Y out of range.")); y = 0; } + if (y >= yMax) { DEBUG_CRASH(("Y out of range.")); y = yMax; } return y; } From de0fc8f3839b4385b0b9c1d6d2f4246b8f073004 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 14 Jan 2026 22:53:24 +0100 Subject: [PATCH 044/211] perf(heightmap): Optimize data locality for m_vertexBufferTiles and m_vertexBufferBackup in HeightMapRenderObjClass (#2104) --- .../Include/W3DDevice/GameClient/HeightMap.h | 21 +++-- .../W3DDevice/GameClient/WorldHeightMap.h | 5 +- .../Source/W3DDevice/GameClient/HeightMap.cpp | 93 +++++++++---------- Dependencies/Utility/Utility/CppMacros.h | 5 +- .../Source/WWVegas/WW3D2/dx8vertexbuffer.h | 9 +- .../Tools/WorldBuilder/src/WBHeightMap.cpp | 2 +- .../W3DDevice/GameClient/W3DStatusCircle.cpp | 3 +- .../Source/WWVegas/WW3D2/dx8vertexbuffer.h | 9 +- .../Tools/WorldBuilder/src/WBHeightMap.cpp | 7 +- 9 files changed, 80 insertions(+), 74 deletions(-) diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h index a0218322a74..827be581bbc 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h @@ -47,10 +47,10 @@ Custom W3D render object that's used to process the terrain. It handles virtually everything to do with the terrain, including: drawing, lighting, scorchmarks and intersection tests. -*/ - - +TheSuperHackers @performance xezon 13/01/2026 +Class now stores the vertex buffers as one big buffer each for optimal data locality. +*/ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass { @@ -88,9 +88,9 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass Int *m_extraBlendTilePositions; /// VecICoord2D; /** MapObject class Not ref counted. Do not store pointers to this class. */ -#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices). +#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices). +#define VERTS_IN_BLOCK_ROW (VERTEX_BUFFER_TILE_LENGTH + 1) +#define HEIGHTMAP_VERTEX_NUM (VERTEX_BUFFER_TILE_LENGTH * 2 * VERTEX_BUFFER_TILE_LENGTH * 2) +#define HEIGHTMAP_POLYGON_NUM (VERTEX_BUFFER_TILE_LENGTH * VERTEX_BUFFER_TILE_LENGTH * 2) #define K_MIN_HEIGHT 0 #define K_MAX_HEIGHT 255 diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp index e5a6191514a..e93ffda6c66 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -125,20 +125,18 @@ inline Int IABS(Int x) { if (x>=0) return x; return -x;}; void HeightMapRenderObjClass::freeIndexVertexBuffers(void) { REF_PTR_RELEASE(m_indexBuffer); - if (m_vertexBufferTiles) { - for (int i=0; i~DX8VertexBufferClass(); } - m_numVertexBufferTiles = 0; + ::operator delete(m_vertexBufferTiles); + m_vertexBufferTiles = nullptr; + delete[] m_vertexBufferBackup; + m_vertexBufferBackup = nullptr; + + m_numVertexBufferTiles = 0; } //============================================================================= @@ -154,6 +152,18 @@ Int HeightMapRenderObjClass::freeMapResources(void) return 0; } +//============================================================================= + +DX8VertexBufferClass *HeightMapRenderObjClass::getVertexBufferTile(Int x, Int y) +{ + return m_vertexBufferTiles + y*m_numVBTilesX+x; +} + +//============================================================================= +VERTEX_FORMAT *HeightMapRenderObjClass::getVertexBufferBackup(Int x, Int y) +{ + return m_vertexBufferBackup + y*m_numVBTilesX*HEIGHTMAP_VERTEX_NUM + x*HEIGHTMAP_VERTEX_NUM; +} //============================================================================= // HeightMapRenderObjClass::doTheDynamicLight @@ -292,7 +302,7 @@ data is expected to be an array same dimensions as current heightmap mapped into this VB. */ //============================================================================= -Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator) +Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator) { Int i,j; Vector3 lightRay[MAX_GLOBAL_LIGHTS]; @@ -312,7 +322,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int DX8VertexBufferClass::WriteLockClass lockVtxBuffer(pVB); VERTEX_FORMAT *vbHardware = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array(); - VERTEX_FORMAT *vBase = (VERTEX_FORMAT*)data; + VERTEX_FORMAT *vBase = data; // Note that we are building the vertex buffer data in the memory buffer, data. // At the bottom, we will copy the final vertex data for one cell into the // hardware vertex buffer. @@ -537,7 +547,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int /** Update the dynamic lighting values only in a rectangular block of the given Vertex Buffer. The vertex locations and texture coords are unchanged. */ -Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights) +Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights) { #if (OPTIMIZED_HEIGHTMAP_LIGHTING) // (gth) if optimizations are enabled, jump over to the "optimized" version of this function. @@ -613,7 +623,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d // The important point is that we can read out of our copy to get the original // diffuse color, and xyz location. It is VERY SLOW to read out of the // hardware vertex buffer, possibly worse... jba. - VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset; + VERTEX_FORMAT *vbMirror = data + offset; un0 = mapX-1; if (un0 < -m_map->getDrawOrgX()) un0=-m_map->getDrawOrgX(); @@ -682,7 +692,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d } -Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights) +Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights) { Int i,j,k; Int vn0,un0,vp1,up1; @@ -768,8 +778,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB // The important point is that we can read out of our copy to get the original // diffuse color, and xyz location. It is VERY SLOW to read out of the // hardware vertex buffer, possibly worse... jba. - VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset; - VERTEX_FORMAT *vbaseMirror = ((VERTEX_FORMAT*)data); + VERTEX_FORMAT *vbMirror = data + offset; + VERTEX_FORMAT *vbaseMirror = data; un0 = mapX-1; if (un0 < -m_map->getDrawOrgX()) un0=-m_map->getDrawOrgX(); @@ -973,7 +983,6 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH } Int i,j; - DX8VertexBufferClass **pVB; Int originX,originY; //step through each vertex buffer that needs updating for (j=0; j= xMax) { continue; } - pVB=m_vertexBufferTiles+j*m_numVBTilesX+i; //point to correct row/column of vertex buffers - char **pData = m_vertexBufferBackup+j*m_numVBTilesX+i; - updateVB(*pVB, *pData, xMin, yMin, xMax, yMax, originX, originY, pMap, pLightsIterator); + DX8VertexBufferClass *pVB = getVertexBufferTile(i, j); + VERTEX_FORMAT *pData = getVertexBufferBackup(i, j); + updateVB(pVB, pData, xMin, yMin, xMax, yMax, originX, originY, pMap, pLightsIterator); } } @@ -1293,8 +1302,7 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap, } //Get number of vertex buffers needed to hold current map - //First round dimensions to next multiple of VERTEX_BUFFER_TILE_LENGTH since that's our - //blocksize + //First round dimensions to next multiple of VERTEX_BUFFER_TILE_LENGTH since that's our block size m_numVBTilesX=1; for (i=VERTEX_BUFFER_TILE_LENGTH+1; i=m_numVertexBufferTiles) { ndx = 0; } - DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles[ndx]); + DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles + ndx); VERTEX_FORMAT *vb = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array(); vb = 0; } @@ -2008,11 +2013,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo) for (j=0; j= 201703L -#define NOEXCEPT noexcept #define REGISTER #define FALLTHROUGH [[fallthrough]] #else -#define NOEXCEPT #define REGISTER register #define FALLTHROUGH #endif // noexcept for methods of IUNKNOWN interface #if defined(_MSC_VER) -#define IUNKNOWN_NOEXCEPT NOEXCEPT +#define IUNKNOWN_NOEXCEPT noexcept #else #define IUNKNOWN_NOEXCEPT #endif diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h index 7419128a238..69b9eb9f140 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h @@ -196,12 +196,13 @@ inline VertexFormatXYZNDUV2 * DynamicVBAccessClass::WriteLockClass::Get_Formatte /** ** DX8VertexBufferClass ** This class wraps a DX8 vertex buffer. Use the lock objects to modify or append to the vertex buffer. +** +** TheSuperHackers @performance Allow placement new and bypass the W3DMemPool to create big buffers. */ class DX8VertexBufferClass : public VertexBufferClass { W3DMPO_GLUE(DX8VertexBufferClass) -protected: - ~DX8VertexBufferClass(); + public: enum UsageType { USAGE_DEFAULT=0, @@ -210,11 +211,15 @@ class DX8VertexBufferClass : public VertexBufferClass USAGE_NPATCHES=4 }; + void* operator new(size_t s, void* placement) noexcept { return placement; } + void operator delete(void* p, void* placement) noexcept {} + DX8VertexBufferClass(unsigned FVF, unsigned short VertexCount, UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); + ~DX8VertexBufferClass(); IDirect3DVertexBuffer8* Get_DX8_Vertex_Buffer() { return VertexBuffer; } diff --git a/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp b/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp index ef58aa73b74..e5782f59587 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp @@ -91,7 +91,7 @@ void WBHeightMap::flattenHeights(void) { static int count = 0; count++; Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2); - DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles[j*m_numVBTilesX+i]); + DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles + j*m_numVBTilesX+i); VERTEX_FORMAT *vbHardware = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array(); Int vtx; for (vtx=0; vtx #include @@ -62,8 +63,6 @@ ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_ENABLE, \ ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) -#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices). -#define VERTS_IN_BLOCK_ROW (VERTEX_BUFFER_TILE_LENGTH+1) static ShaderClass detailOpaqueShader(SC_ALPHA); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h index e5a7c5c5917..cf6a5341572 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h @@ -197,12 +197,13 @@ inline VertexFormatXYZNDUV2 * DynamicVBAccessClass::WriteLockClass::Get_Formatte /** ** DX8VertexBufferClass ** This class wraps a DX8 vertex buffer. Use the lock objects to modify or append to the vertex buffer. +** +** TheSuperHackers @performance Allow placement new and bypass the W3DMemPool to create big buffers. */ class DX8VertexBufferClass : public VertexBufferClass { W3DMPO_GLUE(DX8VertexBufferClass) -protected: - ~DX8VertexBufferClass(); + public: enum UsageType { USAGE_DEFAULT=0, @@ -211,11 +212,15 @@ class DX8VertexBufferClass : public VertexBufferClass USAGE_NPATCHES=4 }; + void* operator new(size_t s, void* placement) noexcept { return placement; } + void operator delete(void* p, void* placement) noexcept {} + DX8VertexBufferClass(unsigned FVF, unsigned short VertexCount, UsageType usage=USAGE_DEFAULT, unsigned vertex_size=0); // Vertex size not used with FVF formats DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); + ~DX8VertexBufferClass(); IDirect3DVertexBuffer8* Get_DX8_Vertex_Buffer() { return VertexBuffer; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp index 9f0d9218ddc..ce5ddac5561 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WBHeightMap.cpp @@ -91,13 +91,10 @@ void WBHeightMap::flattenHeights(void) { for (j=0; jz = theZ; vbHardware++; } From 1a19a5b71675b5ddf244d62f52605d23c513281e Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 14 Jan 2026 22:58:02 +0100 Subject: [PATCH 045/211] refactor(gamelogic): Rearrange local variables in GameLogic::startNewGame() (#2115) --- .../Source/GameLogic/System/GameLogic.cpp | 25 +++++++--------- .../Source/GameLogic/System/GameLogic.cpp | 29 ++++++++----------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index ba912efab45..2573c096aa4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1046,7 +1046,6 @@ void GameLogic::startNewGame( Bool saveGame ) // Fill in the game color and Factions before we do the Load Screen TheGameInfo = nullptr; - Int localSlot = 0; if (TheNetwork) { if (TheLAN) @@ -1150,6 +1149,7 @@ void GameLogic::startNewGame( Bool saveGame ) DEBUG_LOG(("%s", Buf)); #endif + Int localSlot = 0; Int progressCount = LOAD_PROGRESS_SIDE_POPULATION; if (TheGameInfo) { @@ -1161,7 +1161,6 @@ void GameLogic::startNewGame( Bool saveGame ) } //DEBUG_LOG(("Starting LAN game with %d players", TheGameInfo->getNumPlayers())); - Dict d; for (int i=0; iisOccupied()) continue; + Dict d; d.clear(); AsciiString playerName; playerName.format("player%d", i); @@ -1469,7 +1469,6 @@ void GameLogic::startNewGame( Bool saveGame ) updateLoadProgress(LOAD_PROGRESS_POST_VICTORY_CONDITION_SETUP); Player *localPlayer = ThePlayerList->getLocalPlayer(); - Player *observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); // set the radar as on a new map TheRadar->newMap( TheTerrainLogic ); @@ -1523,16 +1522,14 @@ void GameLogic::startNewGame( Bool saveGame ) #endif // Special case, load any bridge map objects. - const ThingTemplate *thingTemplate; - MapObject *pMapObj; - for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) + for (MapObject *pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->getFlag(FLAG_BRIDGE_FLAGS) || pMapObj->getFlag(FLAG_ROAD_FLAGS)) continue; // these roads & bridges are special cased in the terrain side. // get thing template based from map object name - thingTemplate = pMapObj->getThingTemplate(); + const ThingTemplate *thingTemplate = pMapObj->getThingTemplate(); if( thingTemplate == nullptr ) continue; @@ -1579,6 +1576,7 @@ void GameLogic::startNewGame( Bool saveGame ) updateLoadProgress(LOAD_PROGRESS_POST_PATHFINDER_NEW_MAP); // reveal the map for the permanent observer + Player *observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); ThePartitionManager->revealMapForPlayerPermanently( observerPlayer->getPlayerIndex() ); DEBUG_LOG(("Reveal shroud for %ls whose index is %d", observerPlayer->getPlayerDisplayName().str(), observerPlayer->getPlayerIndex())); @@ -1615,12 +1613,11 @@ void GameLogic::startNewGame( Bool saveGame ) DEBUG_LOG(("%s", Buf)); #endif - progressCount = LOAD_PROGRESS_LOOP_ALL_THE_FREAKN_OBJECTS; - Int timer = timeGetTime(); if( saveGame == FALSE ) { - - for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) + Int progressCount = LOAD_PROGRESS_LOOP_ALL_THE_FREAKN_OBJECTS; + Int timer = timeGetTime(); + for (MapObject *pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->getFlag(FLAG_BRIDGE_FLAGS) || pMapObj->getFlag(FLAG_ROAD_FLAGS)) { @@ -1631,7 +1628,7 @@ void GameLogic::startNewGame( Bool saveGame ) handleNameChange( pMapObj ); // get thing template based from map object name - thingTemplate = pMapObj->getThingTemplate(); + const ThingTemplate *thingTemplate = pMapObj->getThingTemplate(); // // if no template continue, some map objects don't have thing templates like @@ -1718,10 +1715,10 @@ void GameLogic::startNewGame( Bool saveGame ) DEBUG_LOG(("%s", Buf)); #endif - progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; // place initial network buildings/units if (TheGameInfo && !saveGame) { + Int progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; for (int i=0; igetSlot(i); @@ -4644,5 +4641,3 @@ void GameLogic::loadPostProcess( void ) remakeSleepyUpdate(); } - - diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index e6852c63059..c9dcff72557 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -1187,7 +1187,6 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) // Fill in the game color and Factions before we do the Load Screen TheGameInfo = nullptr; - Int localSlot = 0; if (TheNetwork) { if (TheLAN) @@ -1311,6 +1310,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) DEBUG_LOG(("%s", Buf)); #endif + Int localSlot = 0; Int progressCount = LOAD_PROGRESS_SIDE_POPULATION; if (TheGameInfo) { @@ -1322,7 +1322,6 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } //DEBUG_LOG(("Starting LAN game with %d players", game->getNumPlayers())); - Dict d; for (int i=0; iisOccupied()) continue; + Dict d; d.clear(); AsciiString playerName; playerName.format("player%d", i); @@ -1630,7 +1630,6 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) updateLoadProgress(LOAD_PROGRESS_POST_VICTORY_CONDITION_SETUP); Player *localPlayer = ThePlayerList->getLocalPlayer(); - Player *observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); // set the radar as on a new map TheRadar->newMap( TheTerrainLogic ); @@ -1684,16 +1683,14 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) #endif // Special case, load any bridge map objects. - const ThingTemplate *thingTemplate; - MapObject *pMapObj; - for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) + for (MapObject *pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->getFlag(FLAG_BRIDGE_FLAGS) || pMapObj->getFlag(FLAG_ROAD_FLAGS)) continue; // these roads & bridges are special cased in the terrain side. // get thing template based from map object name - thingTemplate = pMapObj->getThingTemplate(); + const ThingTemplate *thingTemplate = pMapObj->getThingTemplate(); if( thingTemplate == nullptr ) continue; @@ -1740,6 +1737,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) updateLoadProgress(LOAD_PROGRESS_POST_PATHFINDER_NEW_MAP); // reveal the map for the permanent observer + Player *observerPlayer = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey("ReplayObserver")); ThePartitionManager->revealMapForPlayerPermanently( observerPlayer->getPlayerIndex() ); DEBUG_LOG(("Reveal shroud for %ls whose index is %d", observerPlayer->getPlayerDisplayName().str(), observerPlayer->getPlayerIndex())); @@ -1792,14 +1790,12 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) forceFluffToProp = TRUE; // Always do client side fluff - faster, and syncs properly. jba. } - progressCount = LOAD_PROGRESS_LOOP_ALL_THE_FREAKN_OBJECTS; - Int timer = timeGetTime(); if( loadingSaveGame ) { // Loading a loadingSaveGame, need to add the trees to the client. jba. [8/11/2003] - for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) + for (MapObject *pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { // get thing template based from map object name - thingTemplate = pMapObj->getThingTemplate(); + const ThingTemplate *thingTemplate = pMapObj->getThingTemplate(); if( thingTemplate == nullptr ) continue; // don't create trees and shrubs if this is one and we have that option off @@ -1817,8 +1813,9 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } else { - - for (pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) + Int progressCount = LOAD_PROGRESS_LOOP_ALL_THE_FREAKN_OBJECTS; + Int timer = timeGetTime(); + for (MapObject *pMapObj = MapObject::getFirstMapObject(); pMapObj; pMapObj = pMapObj->getNext()) { if (pMapObj->getFlag(FLAG_BRIDGE_FLAGS) || pMapObj->getFlag(FLAG_ROAD_FLAGS)) { @@ -1829,7 +1826,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) handleNameChange( pMapObj ); // get thing template based from map object name - thingTemplate = pMapObj->getThingTemplate(); + const ThingTemplate *thingTemplate = pMapObj->getThingTemplate(); // // if no template continue, some map objects don't have thing templates like @@ -1931,10 +1928,10 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) DEBUG_LOG(("%s", Buf)); #endif - progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; // place initial network buildings/units if (TheGameInfo && !loadingSaveGame) { + Int progressCount = LOAD_PROGRESS_LOOP_INITIAL_NETWORK_BUILDINGS; for (int i=0; igetSlot(i); @@ -5212,5 +5209,3 @@ void GameLogic::loadPostProcess( void ) remakeSleepyUpdate(); } - - From 5c1e01e519b54b51a5a5b2f1f5bd18521384cf79 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:57:17 +0100 Subject: [PATCH 046/211] refactor(cmake): Move core_config into corei_always for simplification (#2091) --- Core/CMakeLists.txt | 2 ++ Core/GameEngine/CMakeLists.txt | 2 -- Core/Libraries/Source/Compression/CMakeLists.txt | 1 - Core/Libraries/Source/WWVegas/CMakeLists.txt | 2 -- Core/Libraries/Source/debug/CMakeLists.txt | 1 - Core/Libraries/Source/profile/CMakeLists.txt | 1 - Core/Tools/Autorun/CMakeLists.txt | 2 -- Core/Tools/Babylon/CMakeLists.txt | 1 - Core/Tools/CRCDiff/CMakeLists.txt | 2 -- Core/Tools/Compress/CMakeLists.txt | 1 - Core/Tools/DebugWindow/CMakeLists.txt | 1 - Core/Tools/Launcher/CMakeLists.txt | 2 -- Core/Tools/Launcher/DatGen/CMakeLists.txt | 1 - Core/Tools/assetcull/CMakeLists.txt | 1 - Core/Tools/buildVersionUpdate/CMakeLists.txt | 1 - Core/Tools/mangler/CMakeLists.txt | 1 - Core/Tools/matchbot/CMakeLists.txt | 3 +-- Core/Tools/textureCompress/CMakeLists.txt | 1 - Core/Tools/timingTest/CMakeLists.txt | 1 - Core/Tools/versionUpdate/CMakeLists.txt | 1 - Core/Tools/wolSetup/CMakeLists.txt | 1 - Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt | 2 -- Generals/Code/Tools/ParticleEditor/CMakeLists.txt | 1 - Generals/Code/Tools/W3DView/CMakeLists.txt | 1 - GeneralsMD/Code/Libraries/Source/WWVegas/CMakeLists.txt | 2 -- GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt | 1 - GeneralsMD/Code/Tools/W3DView/CMakeLists.txt | 1 - GeneralsMD/Code/Tools/wdump/CMakeLists.txt | 1 - 28 files changed, 3 insertions(+), 35 deletions(-) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 9bf7d20ccdb..37d9c3195f6 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -14,11 +14,13 @@ target_include_directories(corei_libraries_source_wwvegas_wwlib INTERFACE "Libra target_include_directories(corei_main INTERFACE "Main") target_link_libraries(corei_always INTERFACE + core_config core_utility corei_libraries_include resources ) target_link_libraries(corei_always_no_pch INTERFACE + core_config core_utility_no_pch corei_libraries_include resources diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index eb7b7541e14..aae2e821fbb 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -1192,9 +1192,7 @@ target_include_directories(corei_gameengine_public INTERFACE target_link_libraries(corei_gameengine_public INTERFACE core_compression - core_config core_browserdispatch - core_utility #core_wwvegas d3d8lib gamespy::gamespy diff --git a/Core/Libraries/Source/Compression/CMakeLists.txt b/Core/Libraries/Source/Compression/CMakeLists.txt index 035ad7ca9e0..5a5fbc8275a 100644 --- a/Core/Libraries/Source/Compression/CMakeLists.txt +++ b/Core/Libraries/Source/Compression/CMakeLists.txt @@ -29,7 +29,6 @@ target_include_directories(core_compression INTERFACE ) target_link_libraries(core_compression PRIVATE - core_config corei_libraries_include corei_always ) diff --git a/Core/Libraries/Source/WWVegas/CMakeLists.txt b/Core/Libraries/Source/WWVegas/CMakeLists.txt index 6c1a97bc6d9..70b13daf85c 100644 --- a/Core/Libraries/Source/WWVegas/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/CMakeLists.txt @@ -7,8 +7,6 @@ target_compile_definitions(core_wwcommon INTERFACE ) target_link_libraries(core_wwcommon INTERFACE - core_config - core_utility d3d8lib milesstub stlport diff --git a/Core/Libraries/Source/debug/CMakeLists.txt b/Core/Libraries/Source/debug/CMakeLists.txt index 61228d8fb95..ddce3092d16 100644 --- a/Core/Libraries/Source/debug/CMakeLists.txt +++ b/Core/Libraries/Source/debug/CMakeLists.txt @@ -39,7 +39,6 @@ target_precompile_headers(core_debug PRIVATE ) target_link_libraries(core_debug PRIVATE - core_config core_wwcommon corei_always ) diff --git a/Core/Libraries/Source/profile/CMakeLists.txt b/Core/Libraries/Source/profile/CMakeLists.txt index 73ac03e5d54..5fee2d17b0e 100644 --- a/Core/Libraries/Source/profile/CMakeLists.txt +++ b/Core/Libraries/Source/profile/CMakeLists.txt @@ -32,7 +32,6 @@ target_precompile_headers(core_profile PRIVATE ) target_link_libraries(core_profile PRIVATE - core_config core_wwcommon corei_always ) diff --git a/Core/Tools/Autorun/CMakeLists.txt b/Core/Tools/Autorun/CMakeLists.txt index ad06ebd5f99..52623b606bb 100644 --- a/Core/Tools/Autorun/CMakeLists.txt +++ b/Core/Tools/Autorun/CMakeLists.txt @@ -53,8 +53,6 @@ add_library(corei_autorun INTERFACE) target_sources(corei_autorun INTERFACE ${AUTORUN_SRC}) target_link_libraries(corei_autorun INTERFACE - core_config - core_utility winmm ) diff --git a/Core/Tools/Babylon/CMakeLists.txt b/Core/Tools/Babylon/CMakeLists.txt index 6a04a610d78..39dc7ca37fb 100644 --- a/Core/Tools/Babylon/CMakeLists.txt +++ b/Core/Tools/Babylon/CMakeLists.txt @@ -57,7 +57,6 @@ set_target_properties(core_babylon PROPERTIES OUTPUT_NAME babylon) target_sources(core_babylon PRIVATE ${BABYLON_SRC}) target_link_libraries(core_babylon PRIVATE - core_config corei_always ) diff --git a/Core/Tools/CRCDiff/CMakeLists.txt b/Core/Tools/CRCDiff/CMakeLists.txt index d630b7ab25e..323d2cc99a6 100644 --- a/Core/Tools/CRCDiff/CMakeLists.txt +++ b/Core/Tools/CRCDiff/CMakeLists.txt @@ -15,8 +15,6 @@ set_target_properties(core_crcdiff PROPERTIES OUTPUT_NAME crcdiff) target_sources(core_crcdiff PRIVATE ${CRCDIFF_SRC}) target_link_libraries(core_crcdiff PRIVATE - core_config - core_utility corei_always stlport ) diff --git a/Core/Tools/Compress/CMakeLists.txt b/Core/Tools/Compress/CMakeLists.txt index e83dba331c5..4678993e8d3 100644 --- a/Core/Tools/Compress/CMakeLists.txt +++ b/Core/Tools/Compress/CMakeLists.txt @@ -8,7 +8,6 @@ set_target_properties(core_compress PROPERTIES OUTPUT_NAME compress) target_sources(core_compress PRIVATE ${COMRPESS_SRC}) target_link_libraries(core_compress PRIVATE - core_config core_compression corei_always ) diff --git a/Core/Tools/DebugWindow/CMakeLists.txt b/Core/Tools/DebugWindow/CMakeLists.txt index 4405e253e4b..e3ee28abcf2 100644 --- a/Core/Tools/DebugWindow/CMakeLists.txt +++ b/Core/Tools/DebugWindow/CMakeLists.txt @@ -13,7 +13,6 @@ add_library(core_debugwindow SHARED) target_sources(core_debugwindow PRIVATE ${DEBUGWINDOW_SRC}) target_link_libraries(core_debugwindow PRIVATE - core_config corei_always_no_pch ) diff --git a/Core/Tools/Launcher/CMakeLists.txt b/Core/Tools/Launcher/CMakeLists.txt index 09b938a60ea..34966a27bd5 100644 --- a/Core/Tools/Launcher/CMakeLists.txt +++ b/Core/Tools/Launcher/CMakeLists.txt @@ -62,8 +62,6 @@ target_compile_definitions(corei_launcher INTERFACE target_link_libraries(corei_launcher INTERFACE comctl32 - core_config - core_utility ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/Launcher/DatGen/CMakeLists.txt b/Core/Tools/Launcher/DatGen/CMakeLists.txt index 4d38fbcfaf5..3816b6b4147 100644 --- a/Core/Tools/Launcher/DatGen/CMakeLists.txt +++ b/Core/Tools/Launcher/DatGen/CMakeLists.txt @@ -14,7 +14,6 @@ target_include_directories(corei_datgen INTERFACE ) target_link_libraries(corei_datgen INTERFACE - core_config ) target_sources(corei_datgen INTERFACE ${DATGEN_SRC}) diff --git a/Core/Tools/assetcull/CMakeLists.txt b/Core/Tools/assetcull/CMakeLists.txt index e49a60fce79..f38e1473d01 100644 --- a/Core/Tools/assetcull/CMakeLists.txt +++ b/Core/Tools/assetcull/CMakeLists.txt @@ -8,7 +8,6 @@ set_target_properties(core_assetcull PROPERTIES OUTPUT_NAME assetcull) target_sources(core_assetcull PRIVATE ${ASSETCULL_SRC}) target_link_libraries(core_assetcull PRIVATE - core_config corei_always ) diff --git a/Core/Tools/buildVersionUpdate/CMakeLists.txt b/Core/Tools/buildVersionUpdate/CMakeLists.txt index fc1a8c0bab2..9b66a560d39 100644 --- a/Core/Tools/buildVersionUpdate/CMakeLists.txt +++ b/Core/Tools/buildVersionUpdate/CMakeLists.txt @@ -8,7 +8,6 @@ set_target_properties(core_buildversionupdate PROPERTIES OUTPUT_NAME buildversio target_sources(core_buildversionupdate PRIVATE ${BUILDVERSIONUPDATE_SRC}) target_link_libraries(core_buildversionupdate PRIVATE - core_config core_wwlib corei_always ) diff --git a/Core/Tools/mangler/CMakeLists.txt b/Core/Tools/mangler/CMakeLists.txt index eab95cfced5..012961be88b 100644 --- a/Core/Tools/mangler/CMakeLists.txt +++ b/Core/Tools/mangler/CMakeLists.txt @@ -67,7 +67,6 @@ target_include_directories(core_manglerlib PRIVATE ) target_link_libraries(core_manglerlib PRIVATE wsock32) target_link_libraries(core_manglerlib PUBLIC - core_config corei_always ) diff --git a/Core/Tools/matchbot/CMakeLists.txt b/Core/Tools/matchbot/CMakeLists.txt index 54822e3ecbb..f9002e54272 100644 --- a/Core/Tools/matchbot/CMakeLists.txt +++ b/Core/Tools/matchbot/CMakeLists.txt @@ -71,9 +71,8 @@ target_include_directories(core_matchbot PRIVATE ) target_link_libraries(core_matchbot PRIVATE - gamespy::gamespy - core_config corei_always + gamespy::gamespy stlport ) diff --git a/Core/Tools/textureCompress/CMakeLists.txt b/Core/Tools/textureCompress/CMakeLists.txt index 3792175b32f..241355822b7 100644 --- a/Core/Tools/textureCompress/CMakeLists.txt +++ b/Core/Tools/textureCompress/CMakeLists.txt @@ -9,7 +9,6 @@ set_target_properties(core_texturecompress PROPERTIES OUTPUT_NAME texturecompres target_sources(core_texturecompress PRIVATE ${TEXTURECOMPRESS_SRC}) target_link_libraries(core_texturecompress PRIVATE - core_config core_wwlib corei_always ) diff --git a/Core/Tools/timingTest/CMakeLists.txt b/Core/Tools/timingTest/CMakeLists.txt index 11cd8d7be64..ad1d51be766 100644 --- a/Core/Tools/timingTest/CMakeLists.txt +++ b/Core/Tools/timingTest/CMakeLists.txt @@ -10,7 +10,6 @@ set_target_properties(core_timingtest PROPERTIES OUTPUT_NAME timingtest) target_sources(core_timingtest PRIVATE ${TIMINGTEST_SRC}) target_link_libraries(core_timingtest PRIVATE - core_config corei_always winmm ) diff --git a/Core/Tools/versionUpdate/CMakeLists.txt b/Core/Tools/versionUpdate/CMakeLists.txt index e6b4597b89b..052ae04d482 100644 --- a/Core/Tools/versionUpdate/CMakeLists.txt +++ b/Core/Tools/versionUpdate/CMakeLists.txt @@ -8,7 +8,6 @@ set_target_properties(core_versionupdate PROPERTIES OUTPUT_NAME versionupdate) target_sources(core_versionupdate PRIVATE ${VERSIONUPDATE_SRC}) target_link_libraries(core_versionupdate PRIVATE - core_config core_wwlib corei_always ) diff --git a/Core/Tools/wolSetup/CMakeLists.txt b/Core/Tools/wolSetup/CMakeLists.txt index 85182735765..8c8a2418cc9 100644 --- a/Core/Tools/wolSetup/CMakeLists.txt +++ b/Core/Tools/wolSetup/CMakeLists.txt @@ -21,7 +21,6 @@ set_target_properties(core_wolsetup PROPERTIES OUTPUT_NAME wolsetup) target_sources(core_wolsetup PRIVATE ${WOLSETUP_SRC}) target_link_libraries(core_wolsetup PRIVATE - core_config corei_always Version ) diff --git a/Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt index e26a5809cd2..4875e058e6b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt +++ b/Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt @@ -2,8 +2,6 @@ add_library(g_wwcommon INTERFACE) target_link_libraries(g_wwcommon INTERFACE - core_config - core_utility core_wwcommon d3d8lib milesstub diff --git a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt index 093917ad690..e15405e12b6 100644 --- a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt @@ -37,7 +37,6 @@ target_include_directories(g_particleeditor PRIVATE ) target_link_libraries(g_particleeditor PRIVATE - core_config corei_libraries_source_wwvegas corei_libraries_source_wwvegas_wwlib gi_always_no_pch diff --git a/Generals/Code/Tools/W3DView/CMakeLists.txt b/Generals/Code/Tools/W3DView/CMakeLists.txt index 2e3ce338411..4e48131e4c7 100644 --- a/Generals/Code/Tools/W3DView/CMakeLists.txt +++ b/Generals/Code/Tools/W3DView/CMakeLists.txt @@ -1,7 +1,6 @@ add_executable(g_w3dview WIN32) target_link_libraries(g_w3dview PRIVATE - core_config core_wwstub # avoid linking GameEngine corei_w3dview # this interface gets the source files for the tool d3d8 diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/CMakeLists.txt index 427c2c45122..9f979da9baa 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/CMakeLists.txt +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/CMakeLists.txt @@ -2,8 +2,6 @@ add_library(z_wwcommon INTERFACE) target_link_libraries(z_wwcommon INTERFACE - core_config - core_utility core_wwcommon d3d8lib milesstub diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt index 292fdebe0dd..7ddf4236472 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt @@ -37,7 +37,6 @@ target_include_directories(z_particleeditor PRIVATE ) target_link_libraries(z_particleeditor PRIVATE - core_config core_debug core_profile corei_libraries_source_wwvegas diff --git a/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt b/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt index c723893f49f..b73c883b3f6 100644 --- a/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/W3DView/CMakeLists.txt @@ -1,7 +1,6 @@ add_executable(z_w3dview WIN32) target_link_libraries(z_w3dview PRIVATE - core_config core_wwstub # avoid linking GameEngine corei_w3dview # this interface gets the source files for the tool d3d8 diff --git a/GeneralsMD/Code/Tools/wdump/CMakeLists.txt b/GeneralsMD/Code/Tools/wdump/CMakeLists.txt index 2ab4457ec3e..91cd0df3dc8 100644 --- a/GeneralsMD/Code/Tools/wdump/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/wdump/CMakeLists.txt @@ -18,7 +18,6 @@ set_target_properties(z_wdump PROPERTIES OUTPUT_NAME wdump) target_sources(z_wdump PRIVATE ${WDUMP_SRC}) target_link_libraries(z_wdump PRIVATE - core_config core_wwstub # avoid linking GameEngine imm32 vfw32 From 5e016fb044368382d4fed6c4f91a00dffebaf897 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:58:00 +0100 Subject: [PATCH 047/211] build(cmake): Expose source files of interface libraries core_utility, corei/gi/zi_libraries_include in Visual Studio solution (#2092) --- Core/CMakeLists.txt | 5 +++++ Dependencies/Utility/CMakeLists.txt | 25 +++++++++++++++++++++++++ Generals/Code/CMakeLists.txt | 8 +++++++- GeneralsMD/Code/CMakeLists.txt | 8 +++++++- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 37d9c3195f6..ccf2513e5e6 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -13,6 +13,11 @@ target_include_directories(corei_libraries_source_wwvegas INTERFACE "Libraries/S target_include_directories(corei_libraries_source_wwvegas_wwlib INTERFACE "Libraries/Source/WWVegas/WWLib") target_include_directories(corei_main INTERFACE "Main") +target_sources(corei_libraries_include PRIVATE + Libraries/Include/Lib/BaseTypeCore.h + Libraries/Include/rts/debug.h + Libraries/Include/rts/profile.h +) target_link_libraries(corei_always INTERFACE core_config core_utility diff --git a/Dependencies/Utility/CMakeLists.txt b/Dependencies/Utility/CMakeLists.txt index 9d728be9a16..a810813bd62 100644 --- a/Dependencies/Utility/CMakeLists.txt +++ b/Dependencies/Utility/CMakeLists.txt @@ -1,8 +1,33 @@ +set(UTILITY_SRC + Utility/compat.h + Utility/CppMacros.h + Utility/endian_compat.h + Utility/fstream_adapter.h + Utility/hash_map_adapter.h + Utility/intrin_compat.h + Utility/iostream_adapter.h + Utility/mem_compat.h + Utility/sstream_adapter.h + Utility/stdint_adapter.h + Utility/stdio_adapter.h + Utility/string_compat.h + Utility/tchar_compat.h + Utility/thread_compat.h + Utility/time_compat.h + Utility/wchar_compat.h +) + +## core_utility + add_library(core_utility INTERFACE) target_include_directories(core_utility INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_precompile_headers(core_utility INTERFACE [["Utility/CppMacros.h"]] # Must be first, to be removed when abandoning VC6 ) +target_sources(core_utility PRIVATE ${UTILITY_SRC}) + +## core_utility_no_pch add_library(core_utility_no_pch INTERFACE) target_include_directories(core_utility_no_pch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(core_utility_no_pch PRIVATE ${UTILITY_SRC}) diff --git a/Generals/Code/CMakeLists.txt b/Generals/Code/CMakeLists.txt index 293ec60d85e..e52d043e441 100644 --- a/Generals/Code/CMakeLists.txt +++ b/Generals/Code/CMakeLists.txt @@ -7,17 +7,23 @@ add_library(gi_always INTERFACE) add_library(gi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(gi_gameengine_include INTERFACE "GameEngine/Include") -target_link_libraries(gi_gameengine_include INTERFACE corei_gameengine_include) target_include_directories(gi_libraries_include INTERFACE "Libraries/Include") target_include_directories(gi_libraries_source_wwvegas INTERFACE "Libraries/Source/WWVegas") target_include_directories(gi_main INTERFACE "Main") +target_sources(gi_libraries_include PRIVATE + Libraries/Include/Lib/BaseType.h + Libraries/Include/Lib/trig.h +) target_compile_definitions(gi_always INTERFACE RTS_GENERALS=1 ) target_compile_definitions(gi_always_no_pch INTERFACE RTS_GENERALS=1 ) +target_link_libraries(gi_gameengine_include INTERFACE + corei_gameengine_include +) target_link_libraries(gi_always INTERFACE gi_libraries_include corei_always # Must stay below so headers from game are included first diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt index 0c4c21f934e..d173801dc98 100644 --- a/GeneralsMD/Code/CMakeLists.txt +++ b/GeneralsMD/Code/CMakeLists.txt @@ -7,17 +7,23 @@ add_library(zi_always INTERFACE) add_library(zi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(zi_gameengine_include INTERFACE "GameEngine/Include") -target_link_libraries(zi_gameengine_include INTERFACE corei_gameengine_include) target_include_directories(zi_libraries_include INTERFACE "Libraries/Include") target_include_directories(zi_libraries_source_wwvegas INTERFACE "Libraries/Source/WWVegas") target_include_directories(zi_main INTERFACE "Main") +target_sources(zi_libraries_include PRIVATE + Libraries/Include/Lib/BaseType.h + Libraries/Include/Lib/trig.h +) target_compile_definitions(zi_always INTERFACE RTS_ZEROHOUR=1 ) target_compile_definitions(zi_always_no_pch INTERFACE RTS_ZEROHOUR=1 ) +target_link_libraries(zi_gameengine_include INTERFACE + corei_gameengine_include +) target_link_libraries(zi_always INTERFACE zi_libraries_include corei_always # Must stay below so headers from game are included first From 3d12b3935fb5d1c20c4516b8c2a5af22f82fde9e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:15:29 +0100 Subject: [PATCH 048/211] refactor(ww3dformat): Merge function PixelSize into Get_Bytes_Per_Pixel (#2072) --- .../Source/WWVegas/WW3D2/surfaceclass.cpp | 72 +++---------------- .../Source/WWVegas/WW3D2/ww3dformat.cpp | 20 ++++-- .../W3DDevice/GameClient/W3DAssetManager.cpp | 5 +- .../W3DDevice/GameClient/W3DAssetManager.cpp | 5 +- 4 files changed, 29 insertions(+), 73 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp index 059900aabf3..5d262ae7009 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp @@ -37,7 +37,6 @@ * SurfaceClass::Clear -- Clears a surface to 0 * * SurfaceClass::Copy -- Copies a region from one surface to another of the same format * * SurfaceClass::FindBBAlpha -- Finds the bounding box of non zero pixels in the region (x0, * - * PixelSize -- Helper Function to find the size in bytes of a pixel * * SurfaceClass::Is_Transparent_Column -- Tests to see if the column is transparent or not * * SurfaceClass::Copy -- Copies from a byte array to the surface * * SurfaceClass::CreateCopy -- Creates a byte array copy of the surface * @@ -56,57 +55,6 @@ #include "bound.h" #include -/*********************************************************************************************** - * PixelSize -- Helper Function to find the size in bytes of a pixel * - * * - * * - * * - * * - * INPUT: * - * * - * OUTPUT: * - * * - * WARNINGS: * - * * - * HISTORY: * - * 2/13/2001 hy : Created. * - *=============================================================================================*/ - -unsigned int PixelSize(const SurfaceClass::SurfaceDescription &sd) -{ - unsigned int size=0; - - switch (sd.Format) - { - case WW3D_FORMAT_A8R8G8B8: - case WW3D_FORMAT_X8R8G8B8: - size=4; - break; - case WW3D_FORMAT_R8G8B8: - size=3; - break; - case WW3D_FORMAT_R5G6B5: - case WW3D_FORMAT_X1R5G5B5: - case WW3D_FORMAT_A1R5G5B5: - case WW3D_FORMAT_A4R4G4B4: - case WW3D_FORMAT_A8R3G3B2: - case WW3D_FORMAT_X4R4G4B4: - case WW3D_FORMAT_A8P8: - case WW3D_FORMAT_A8L8: - size=2; - break; - case WW3D_FORMAT_R3G3B2: - case WW3D_FORMAT_A8: - case WW3D_FORMAT_P8: - case WW3D_FORMAT_L8: - case WW3D_FORMAT_A4L4: - size=1; - break; - } - - return size; -} - void Convert_Pixel(Vector3 &rgb, const SurfaceClass::SurfaceDescription &sd, const unsigned char * pixel) { const float scale=1/255.0f; @@ -292,7 +240,7 @@ void SurfaceClass::Clear() Get_Description(sd); // size of each pixel in bytes - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -331,7 +279,7 @@ void SurfaceClass::Copy(const unsigned char *other) Get_Description(sd); // size of each pixel in bytes - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -370,7 +318,7 @@ void SurfaceClass::Copy(Vector2i &min,Vector2i &max, const unsigned char *other) Get_Description(sd); // size of each pixel in bytes - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -415,7 +363,7 @@ unsigned char *SurfaceClass::CreateCopy(int *width,int *height,int*size,bool fli Get_Description(sd); // size of each pixel in bytes - unsigned int mysize=PixelSize(sd); + unsigned int mysize=Get_Bytes_Per_Pixel(sd.Format); *width=sd.Width; *height=sd.Height; @@ -595,7 +543,7 @@ void SurfaceClass::FindBB(Vector2i *min,Vector2i*max) DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,&rect,D3DLOCK_READONLY)); int x,y; - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); Vector2i realmin=*max; Vector2i realmax=*min; @@ -658,7 +606,7 @@ bool SurfaceClass::Is_Transparent_Column(unsigned int column) break; } - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -808,7 +756,7 @@ void SurfaceClass::DrawPixel(const unsigned int x,const unsigned int y, unsigned SurfaceDescription sd; Get_Description(sd); - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -862,7 +810,7 @@ void SurfaceClass::DrawHLine(const unsigned int y,const unsigned int x1, const u SurfaceDescription sd; Get_Description(sd); - unsigned int size=PixelSize(sd); + unsigned int size=Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -963,7 +911,7 @@ bool SurfaceClass::Is_Monochrome(void) int pitch,size; - size=PixelSize(sd); + size=Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) Lock(&pitch); Vector3 rgb; @@ -1013,7 +961,7 @@ void SurfaceClass::Hue_Shift(const Vector3 &hsv_shift) Get_Description(sd); int pitch,size; - size=PixelSize(sd); + size=Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) Lock(&pitch); Vector3 rgb; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp index b5d6de1a736..accec5da22b 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp @@ -393,19 +393,29 @@ WW3DFormat Get_Valid_Texture_Format(WW3DFormat format, bool is_compression_allow unsigned Get_Bytes_Per_Pixel(WW3DFormat format) { switch (format) { + case WW3D_FORMAT_A8R8G8B8: case WW3D_FORMAT_X8R8G8B8: case WW3D_FORMAT_X8L8V8U8: - case WW3D_FORMAT_A8R8G8B8: return 4; - case WW3D_FORMAT_R8G8B8: return 3; + return 4; + case WW3D_FORMAT_R8G8B8: + return 3; + case WW3D_FORMAT_R5G6B5: + case WW3D_FORMAT_X1R5G5B5: case WW3D_FORMAT_A1R5G5B5: case WW3D_FORMAT_A4R4G4B4: + case WW3D_FORMAT_A8R3G3B2: + case WW3D_FORMAT_X4R4G4B4: + case WW3D_FORMAT_A8P8: + case WW3D_FORMAT_A8L8: case WW3D_FORMAT_U8V8: case WW3D_FORMAT_L6V5U5: - case WW3D_FORMAT_R5G6B5: return 2; + return 2; case WW3D_FORMAT_R3G3B2: - case WW3D_FORMAT_L8: case WW3D_FORMAT_A8: - case WW3D_FORMAT_P8: return 1; + case WW3D_FORMAT_P8: + case WW3D_FORMAT_L8: + case WW3D_FORMAT_A4L4: + return 1; default: WWASSERT(0); break; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index f0f81fc2c2e..b22a4425589 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -84,7 +84,6 @@ const float V_epsilon(0.01f); // Externs defined somewhere in W3D. //--------------------------------------------------------------------- -unsigned int PixelSize(const SurfaceClass::SurfaceDescription &sd); void Convert_Pixel(Vector3 &rgb, const SurfaceClass::SurfaceDescription &sd, const unsigned char * pixel); void Convert_Pixel(unsigned char * pixel,const SurfaceClass::SurfaceDescription &sd, const Vector3 &rgb); @@ -583,7 +582,7 @@ void W3DAssetManager::Remap_Palette(SurfaceClass *surface, const int color, Bool int pitch,size; // UnsignedInt newPalette[TEAM_COLOR_PALETTE_SIZE]; - size=PixelSize(sd); + size=Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) surface->Lock(&pitch); if (doPaletteOnly) @@ -634,7 +633,7 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, texture->Get_Level_Description(desc); Int psize; - psize=PixelSize(desc); + psize=Get_Bytes_Per_Pixel(desc.Format); DEBUG_ASSERTCRASH( psize == 2 || psize == 4, ("Can't Recolor Texture %s", name) ); oldsurf=texture->Get_Surface_Level(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index 80dd1ad076d..0aabefedfde 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -85,7 +85,6 @@ const float V_epsilon(0.01f); // Externs defined somewhere in W3D. //--------------------------------------------------------------------- -unsigned int PixelSize(const SurfaceClass::SurfaceDescription &sd); void Convert_Pixel(Vector3 &rgb, const SurfaceClass::SurfaceDescription &sd, const unsigned char * pixel); void Convert_Pixel(unsigned char * pixel,const SurfaceClass::SurfaceDescription &sd, const Vector3 &rgb); @@ -613,7 +612,7 @@ void W3DAssetManager::Remap_Palette(SurfaceClass *surface, const int color, Bool int pitch,size; // UnsignedInt newPalette[TEAM_COLOR_PALETTE_SIZE]; - size=PixelSize(sd); + size=Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) surface->Lock(&pitch); if (doPaletteOnly) @@ -664,7 +663,7 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture, texture->Get_Level_Description(desc); Int psize; - psize=PixelSize(desc); + psize=Get_Bytes_Per_Pixel(desc.Format); DEBUG_ASSERTCRASH( psize == 2 || psize == 4, ("Can't Recolor Texture %s", name) ); oldsurf=texture->Get_Surface_Level(); From bd376c43dae80958af693dd20f0fb06dbc351e97 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:16:01 +0100 Subject: [PATCH 049/211] perf(radar): Reduce cost of radar pixel draw in PartitionManager::refreshShroudForLocalPlayer by 96% (#2072) --- Core/GameEngine/Include/Common/Radar.h | 7 +- .../Include/W3DDevice/Common/W3DRadar.h | 9 +- .../W3DDevice/Common/System/W3DRadar.cpp | 93 +++++++++++++++---- .../Source/WWVegas/WW3D2/surfaceclass.cpp | 20 +++- .../Source/WWVegas/WW3D2/surfaceclass.h | 5 +- .../GameLogic/Object/PartitionManager.cpp | 22 +++-- .../GameLogic/Object/PartitionManager.cpp | 22 +++-- 7 files changed, 137 insertions(+), 41 deletions(-) diff --git a/Core/GameEngine/Include/Common/Radar.h b/Core/GameEngine/Include/Common/Radar.h index 0e187c0c0b3..7ab715970e1 100644 --- a/Core/GameEngine/Include/Common/Radar.h +++ b/Core/GameEngine/Include/Common/Radar.h @@ -218,8 +218,11 @@ class Radar : public Snapshot, /// empty the entire shroud virtual void clearShroud() = 0; - /// set the shroud level at shroud cell x,y - virtual void setShroudLevel( Int x, Int y, CellShroudStatus setting ) = 0; + /// TheSuperHackers @performance xezon 20/12/2025 Provides beginSetShroudLevel and endSetShroudLevel to improve performance. + /// Calling setShroudLevel many times is very expensive because it will lock a render resource on every call. + virtual void setShroudLevel( Int x, Int y, CellShroudStatus setting ) = 0; ///< set the shroud level at shroud cell x,y + virtual void beginSetShroudLevel() {} ///< call this once before multiple calls to setShroudLevel for better performance + virtual void endSetShroudLevel() {} ///< call this once after beginSetShroudLevel and setShroudLevel protected: diff --git a/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h index 528ddb52a92..38d650e6a09 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h +++ b/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h @@ -37,6 +37,7 @@ // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// class TextureClass; +class SurfaceClass; class TerrainLogic; // PROTOTYPES ///////////////////////////////////////////////////////////////////////////////////// @@ -63,7 +64,9 @@ class W3DRadar : public Radar virtual void draw( Int pixelX, Int pixelY, Int width, Int height ); ///< draw the radar virtual void clearShroud(); - virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting); + virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting); ///< set the shroud level at shroud cell x,y + virtual void beginSetShroudLevel(); ///< call this once before multiple calls to setShroudLevel for better performance + virtual void endSetShroudLevel(); ///< call this once after beginSetShroudLevel and setShroudLevel virtual void refreshTerrain( TerrainLogic *terrain ); virtual void refreshObjects(); @@ -104,6 +107,10 @@ class W3DRadar : public Radar WW3DFormat m_shroudTextureFormat; ///< format to use for shroud texture Image *m_shroudImage; ///< shroud image abstraction for drawing TextureClass *m_shroudTexture; ///< shroud texture + SurfaceClass *m_shroudSurface; ///< surface to shroud texture + void *m_shroudSurfaceBits; ///< shroud surface bits + int m_shroudSurfacePitch; ///< shroud surface pitch + UnsignedInt m_shroudSurfacePixelSize; ///< shroud surface pixel size Int m_textureWidth; ///< width for all radar textures Int m_textureHeight; ///< height for all radar textures diff --git a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 6c04bbc415b..4deeb1db6ca 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -54,6 +54,7 @@ #include "W3DDevice/GameClient/W3DShroud.h" #include "WW3D2/texture.h" #include "WW3D2/dx8caps.h" +#include "WWMath/vector2i.h" @@ -132,7 +133,7 @@ void W3DRadar::initializeTextureFormats( void ) } //------------------------------------------------------------------------------------------------- -/** Delete resources used specifically in this W3D radar implemetation */ +/** Delete resources used specifically in this W3D radar implementation */ //------------------------------------------------------------------------------------------------- void W3DRadar::deleteResources( void ) { @@ -167,6 +168,9 @@ void W3DRadar::deleteResources( void ) deleteInstance(m_shroudImage); m_shroudImage = nullptr; + DEBUG_ASSERTCRASH(m_shroudSurface == NULL, ("W3DRadar::deleteResources: m_shroudSurface is expected NULL")); + DEBUG_ASSERTCRASH(m_shroudSurfaceBits == NULL, ("W3DRadar::deleteResources: m_shroudSurfaceBits is expected NULL")); + } //------------------------------------------------------------------------------------------------- @@ -844,6 +848,10 @@ W3DRadar::W3DRadar( void ) m_shroudTextureFormat = WW3D_FORMAT_UNKNOWN; m_shroudImage = nullptr; m_shroudTexture = nullptr; + m_shroudSurface = nullptr; + m_shroudSurfaceBits = nullptr; + m_shroudSurfacePitch = 0; + m_shroudSurfacePixelSize = 0; m_textureWidth = RADAR_CELL_WIDTH; m_textureHeight = RADAR_CELL_HEIGHT; @@ -1301,9 +1309,6 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting if (!shroud) return; - SurfaceClass* surface = m_shroudTexture->Get_Surface_Level(); - DEBUG_ASSERTCRASH( surface, ("W3DRadar: Can't get surface for Shroud texture") ); - Int mapMinX = shroudX * shroud->getCellWidth(); Int mapMinY = shroudY * shroud->getCellHeight(); Int mapMaxX = (shroudX+1) * shroud->getCellWidth(); @@ -1315,21 +1320,19 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting worldPoint.x = mapMinX; worldPoint.y = mapMinY; worldToRadar( &worldPoint, &radarPoint ); - Int radarMinX = radarPoint.x; - Int radarMinY = radarPoint.y; + const Int radarMinX = radarPoint.x; + const Int radarMinY = radarPoint.y; worldPoint.x = mapMaxX; worldPoint.y = mapMaxY; worldToRadar( &worldPoint, &radarPoint ); - Int radarMaxX = radarPoint.x; - Int radarMaxY = radarPoint.y; + const Int radarMaxX = radarPoint.x; + const Int radarMaxY = radarPoint.y; -/* - Int radarMinX = REAL_TO_INT_FLOOR(mapMinX / getXSample()); - Int radarMinY = REAL_TO_INT_FLOOR(mapMinY / getYSample()); - Int radarMaxX = REAL_TO_INT_CEIL(mapMaxX / getXSample()); - Int radarMaxY = REAL_TO_INT_CEIL(mapMaxY / getYSample()); -*/ + // Int radarMinX = REAL_TO_INT_FLOOR(mapMinX / getXSample()); + // Int radarMinY = REAL_TO_INT_FLOOR(mapMinY / getYSample()); + // Int radarMaxX = REAL_TO_INT_CEIL(mapMaxX / getXSample()); + // Int radarMaxY = REAL_TO_INT_CEIL(mapMaxY / getYSample()); /// @todo srj -- this really needs to smooth the display! @@ -1343,15 +1346,69 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting else alpha = 0; - for( Int y = radarMinY; y <= radarMaxY; y++ ) + if (m_shroudSurface == NULL) { - for( Int x = radarMinX; x <= radarMaxX; x++ ) + // This is expensive. + SurfaceClass* surface = m_shroudTexture->Get_Surface_Level(); + DEBUG_ASSERTCRASH( surface, ("W3DRadar: Can't get surface for Shroud texture") ); + + for( Int y = radarMinY; y <= radarMaxY; y++ ) { - if( legalRadarPoint( x, y ) ) + for( Int x = radarMinX; x <= radarMaxX; x++ ) + { surface->DrawPixel( x, y, GameMakeColor( 0, 0, 0, alpha ) ); + } } + REF_PTR_RELEASE(surface); } - REF_PTR_RELEASE(surface); + else + { + // This is cheap. + DEBUG_ASSERTCRASH(m_shroudSurfaceBits != NULL, ("W3DRadar::setShroudLevel: m_shroudSurfaceBits is not expected NULL")); + DEBUG_ASSERTCRASH(m_shroudSurfacePixelSize != 0, ("W3DRadar::setShroudLevel: m_shroudSurfacePixelSize is not expected 0")); + const Color color = GameMakeColor( 0, 0, 0, alpha ); + + for( Int y = radarMinY; y <= radarMaxY; ++y ) + { + UnsignedByte* row = static_cast(m_shroudSurfaceBits) + y * m_shroudSurfacePitch; + for( Int x = radarMinX; x <= radarMaxX; ++x ) + { + UnsignedByte* column = row + x * m_shroudSurfacePixelSize; + + switch (m_shroudSurfacePixelSize) + { + case 1: *column = (UnsignedByte)(color & 0xFF); break; + case 2: *reinterpret_cast(column) = (UnsignedShort)(color & 0xFFFF); break; + case 4: *reinterpret_cast(column) = (UnsignedInt)color; break; + } + } + } + } +} + +void W3DRadar::beginSetShroudLevel() +{ + DEBUG_ASSERTCRASH( m_shroudSurface == NULL, ("W3DRadar::beginSetShroudLevel: m_shroudSurface is expected NULL") ); + m_shroudSurface = m_shroudTexture->Get_Surface_Level(); + DEBUG_ASSERTCRASH( m_shroudSurface != NULL, ("W3DRadar::beginSetShroudLevel: Can't get surface for Shroud texture") ); + + SurfaceClass::SurfaceDescription sd; + m_shroudSurface->Get_Description(sd); + m_shroudSurfaceBits = m_shroudSurface->Lock(&m_shroudSurfacePitch); + m_shroudSurfacePixelSize = Get_Bytes_Per_Pixel(sd.Format); +} + +void W3DRadar::endSetShroudLevel() +{ + DEBUG_ASSERTCRASH( m_shroudSurface != NULL, ("W3DRadar::endSetShroudLevel: m_shroudSurface is not expected NULL") ); + if (m_shroudSurfaceBits != NULL) + { + m_shroudSurface->Unlock(); + m_shroudSurfaceBits = NULL; + m_shroudSurfacePitch = 0; + m_shroudSurfacePixelSize = 0; + } + REF_PTR_RELEASE(m_shroudSurface); } //------------------------------------------------------------------------------------------------- diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp index 5d262ae7009..1c768fec1b9 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp @@ -205,7 +205,7 @@ void SurfaceClass::Get_Description(SurfaceDescription &surface_desc) surface_desc.Width = d3d_desc.Width; } -void * SurfaceClass::Lock(int * pitch) +void *SurfaceClass::Lock(int *pitch) { D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -214,6 +214,22 @@ void * SurfaceClass::Lock(int * pitch) return (void *)lock_rect.pBits; } +void *SurfaceClass::Lock(int *pitch, const Vector2i &min, const Vector2i &max) +{ + D3DLOCKED_RECT lock_rect; + ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); + + RECT rect; + rect.left = min.I; + rect.top = min.J; + rect.right = max.I; + rect.bottom = max.J; + DX8_ErrorCode(D3DSurface->LockRect(&lock_rect, &rect, 0)); + + *pitch = lock_rect.Pitch; + return (void *)lock_rect.pBits; +} + void SurfaceClass::Unlock(void) { DX8_ErrorCode(D3DSurface->UnlockRect()); @@ -312,7 +328,7 @@ void SurfaceClass::Copy(const unsigned char *other) * HISTORY: * * 5/2/2001 hy : Created. * *=============================================================================================*/ -void SurfaceClass::Copy(Vector2i &min,Vector2i &max, const unsigned char *other) +void SurfaceClass::Copy(const Vector2i &min, const Vector2i &max, const unsigned char *other) { SurfaceDescription sd; Get_Description(sd); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h index 947199f2cd1..4d227fe4fcf 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h @@ -79,7 +79,8 @@ class SurfaceClass : public W3DMPO, public RefCountClass void Get_Description(SurfaceDescription &surface_desc); // Lock / unlock the surface - void * Lock(int * pitch); + void *Lock(int *pitch); + void *Lock(int *pitch, const Vector2i &min, const Vector2i &max); void Unlock(void); // HY -- The following functions are support functions for font3d @@ -97,7 +98,7 @@ class SurfaceClass : public W3DMPO, public RefCountClass void Copy(const unsigned char *other); // support for copying from a byte array - void Copy(Vector2i &min,Vector2i &max, const unsigned char *other); + void Copy(const Vector2i &min, const Vector2i &max, const unsigned char *other); // copies the contents of one surface to another, stretches void Stretch_Copy( diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 55e5ae5c9ab..c13a30bd27b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3047,15 +3047,21 @@ void PartitionManager::refreshShroudForLocalPlayer() TheDisplay->clearShroud(); TheRadar->clearShroud(); - const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); - for (int i = 0; i < m_totalCellCount; ++i) + if (m_totalCellCount != 0) { - Int x = m_cells[i].getCellX(); - Int y = m_cells[i].getCellY(); - CellShroudStatus status = m_cells[i].getShroudStatusForPlayer(playerIndex); - TheDisplay->setShroudLevel(x, y, status); - TheRadar->setShroudLevel(x, y, status); - m_cells[i].invalidateShroudedStatusForAllCois(playerIndex); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + TheRadar->beginSetShroudLevel(); + + for (int i = 0; i < m_totalCellCount; ++i) + { + const Int x = m_cells[i].getCellX(); + const Int y = m_cells[i].getCellY(); + const CellShroudStatus status = m_cells[i].getShroudStatusForPlayer(playerIndex); + TheDisplay->setShroudLevel(x, y, status); + TheRadar->setShroudLevel(x, y, status); + m_cells[i].invalidateShroudedStatusForAllCois(playerIndex); + } + TheRadar->endSetShroudLevel(); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 8e3df913902..36a8adfa1d3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3054,15 +3054,21 @@ void PartitionManager::refreshShroudForLocalPlayer() TheDisplay->clearShroud(); TheRadar->clearShroud(); - const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); - for (int i = 0; i < m_totalCellCount; ++i) + if (m_totalCellCount != 0) { - Int x = m_cells[i].getCellX(); - Int y = m_cells[i].getCellY(); - CellShroudStatus status = m_cells[i].getShroudStatusForPlayer(playerIndex); - TheDisplay->setShroudLevel(x, y, status); - TheRadar->setShroudLevel(x, y, status); - m_cells[i].invalidateShroudedStatusForAllCois(playerIndex); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + TheRadar->beginSetShroudLevel(); + + for (int i = 0; i < m_totalCellCount; ++i) + { + const Int x = m_cells[i].getCellX(); + const Int y = m_cells[i].getCellY(); + const CellShroudStatus status = m_cells[i].getShroudStatusForPlayer(playerIndex); + TheDisplay->setShroudLevel(x, y, status); + TheRadar->setShroudLevel(x, y, status); + m_cells[i].invalidateShroudedStatusForAllCois(playerIndex); + } + TheRadar->endSetShroudLevel(); } } From 2ab6604d8c0bd5c08e069a11643c5fcef726bd6b Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 16 Jan 2026 21:59:22 +0100 Subject: [PATCH 050/211] bugfix(actionmanager): Restore retail compatibility after construction cursor change in ActionManager (#2125) --- .../Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 8 ++++++++ .../Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index a981c07b811..019faa7bb23 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -455,8 +455,16 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, return FALSE; // TheSuperHackers @bugfix Stubbjax 06/01/2025 Ensure only the owner of the construction can resume it. +#if RETAIL_COMPATIBLE_CRC + Relationship r = obj->getRelationship(objectBeingConstructed); + + // only available to our allies + if( r != ALLIES ) + return FALSE; +#else if (obj->getControllingPlayer() != objectBeingConstructed->getControllingPlayer()) return FALSE; +#endif // if the objectBeingConstructed is not actually under construction we can't resume that! if( !objectBeingConstructed->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 658000a6387..9c92f795854 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -459,8 +459,16 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, return FALSE; // TheSuperHackers @bugfix Stubbjax 06/01/2025 Ensure only the owner of the construction can resume it. +#if RETAIL_COMPATIBLE_CRC + Relationship r = obj->getRelationship(objectBeingConstructed); + + // only available to our allies + if( r != ALLIES ) + return FALSE; +#else if (obj->getControllingPlayer() != objectBeingConstructed->getControllingPlayer()) return FALSE; +#endif // if the objectBeingConstructed is not actually under construction we can't resume that! if( !objectBeingConstructed->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) From 1d9aa3a3af8f89f93fee146bb1065852b3405090 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 17 Jan 2026 07:59:54 +1100 Subject: [PATCH 051/211] bugfix(buildassistant): Restore retail compatibility after build assistant shroud logic change (#2131) --- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 2 ++ .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 431c40ccc91..fc11e4c6f5f 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -688,8 +688,10 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, } } +#if !RETAIL_COMPATIBLE_CRC if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED) return false; +#endif // an immobile object may obstruct our building depending on flags. if( them->isKindOf( KINDOF_IMMOBILE ) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 2f5db145e36..78e8e2a12d3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -710,8 +710,10 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos continue; } +#if !RETAIL_COMPATIBLE_CRC if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED) return LBC_SHROUD; +#endif //Kris: Patch 1.01 - November 5, 2003 //Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit). From d4466df52692d1760cc5ea8d50c752040bb9934f Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 17 Jan 2026 08:11:51 +1100 Subject: [PATCH 052/211] bugfix(dx8caps): Resolve greyscale texture rendering issues in VMWare environments (#2128) --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp | 13 +++++++++++-- .../Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h | 1 + .../Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp | 11 ++++++++++- .../Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp index 4b151ba7653..9a1f8d16780 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp @@ -50,7 +50,8 @@ static StringClass CapsWorkString; enum { VENDOR_ID_NVIDIA=0x10de, - VENROD_ID_ATI=0x1002 + VENROD_ID_ATI=0x1002, + VENDOR_ID_VMWARE=0x15AD, }; @@ -65,7 +66,8 @@ static const char* const VendorNames[]={ "3Dfx", "3DLabs", "CirrusLogic", - "Rendition" + "Rendition", + "VMware", }; static_assert(ARRAY_SIZE(VendorNames) == DX8Caps::VENDOR_COUNT, "Incorrect array size"); @@ -85,6 +87,7 @@ DX8Caps::VendorIdType DX8Caps::Define_Vendor(unsigned vendor_id) case 0x1142: // Alliance based reference cards case 0x109D: // Macronix based reference cards case 0x121A: return VENDOR_3DFX; + case 0x15AD: return VENDOR_VMWARE; default: return VENDOR_UNKNOWN; } @@ -704,6 +707,12 @@ void DX8Caps::Vendor_Specific_Hacks(const D3DADAPTER_IDENTIFIER8& adapter_id) SupportTextureFormat[WW3D_FORMAT_DXT5]; } + if (adapter_id.VendorId==VENDOR_ID_VMWARE) { + // TheSuperHackers @bugfix Stubbjax 15/01/2025 Disable DOT3 support for VMWare's virtual GPU. + // The D3DTA_ALPHAREPLICATE modifier fails when passed to a D3DTOP_MULTIPLYADD operation. + SupportDot3 = false; + } + // SupportDXTC=false; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h index 69a793ae812..30da6e2f432 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h @@ -65,6 +65,7 @@ class DX8Caps VENDOR_3DLABS, VENDOR_CIRRUSLOGIC, VENDOR_RENDITION, + VENDOR_VMWARE, VENDOR_COUNT }; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp index c63442871a5..f2b26f748d5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp @@ -61,7 +61,8 @@ static const char* const VendorNames[]={ "3Dfx", "3DLabs", "CirrusLogic", - "Rendition" + "Rendition", + "VMware", }; static_assert(ARRAY_SIZE(VendorNames) == DX8Caps::VENDOR_COUNT, "Incorrect array size"); @@ -81,6 +82,7 @@ DX8Caps::VendorIdType DX8Caps::Define_Vendor(unsigned vendor_id) case 0x1142: // Alliance based reference cards case 0x109D: // Macronix based reference cards case 0x121A: return VENDOR_3DFX; + case 0x15AD: return VENDOR_VMWARE; default: return VENDOR_UNKNOWN; } @@ -1158,5 +1160,12 @@ void DX8Caps::Vendor_Specific_Hacks(const D3DADAPTER_IDENTIFIER8& adapter_id) } + + if (VendorId==VENDOR_VMWARE) { + // TheSuperHackers @bugfix Stubbjax 15/01/2025 Disable DOT3 support for VMWare's virtual GPU. + // The D3DTA_ALPHAREPLICATE modifier fails when passed to a D3DTOP_MULTIPLYADD operation. + DXLOG(("Disabling DOT3 on VMWare\r\n")); + SupportDot3 = false; + } } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h index 88a1dba2621..aa9c6f75a5b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.h @@ -65,6 +65,7 @@ class DX8Caps VENDOR_3DLABS, VENDOR_CIRRUSLOGIC, VENDOR_RENDITION, + VENDOR_VMWARE, VENDOR_COUNT }; From 394f210c3148c1bff21085e91267b69f3c01eaec Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 05:59:21 -0500 Subject: [PATCH 053/211] bugfix: Fix spelling errors in debug/diagnostic strings (#2108) Co-authored-by: Stubbjax --- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 2 +- .../Source/Common/System/SaveGame/GameStateMap.cpp | 2 +- .../GUI/ControlBar/ControlBarStructureInventory.cpp | 2 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 4 ++-- .../GameEngine/Source/GameLogic/Object/Object.cpp | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../Source/GameLogic/System/GameLogicDispatch.cpp | 6 +++--- .../W3DDevice/GameClient/W3DDisplayStringManager.cpp | 2 +- .../Win32Device/GameClient/Win32DIKeyboard.cpp | 6 +++--- .../Source/Win32Device/GameClient/Win32DIMouse.cpp | 10 +++++----- .../Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | 8 ++++---- .../Source/Dialog Procedures/SliderProperties.cpp | 2 +- Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditParameter.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp | 2 +- .../Source/Common/INI/INITerrainBridge.cpp | 2 +- .../Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- .../Source/Common/System/SaveGame/GameStateMap.cpp | 2 +- .../GUI/ControlBar/ControlBarStructureInventory.cpp | 2 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 +- .../Source/GameLogic/Map/PolygonTrigger.cpp | 4 ++-- .../GameEngine/Source/GameLogic/Object/Object.cpp | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogic.cpp | 2 +- .../Source/GameLogic/System/GameLogicDispatch.cpp | 6 +++--- .../W3DDevice/GameClient/W3DDisplayStringManager.cpp | 2 +- .../Win32Device/GameClient/Win32DIKeyboard.cpp | 6 +++--- .../Source/Win32Device/GameClient/Win32DIMouse.cpp | 10 +++++----- .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 2 +- .../Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | 12 ++++++------ .../Source/Dialog Procedures/SliderProperties.cpp | 2 +- GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditParameter.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp | 2 +- 38 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index bed92b2f9c2..fb180b69806 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -809,7 +809,7 @@ void ImagePacker::addImage( char *path ) if( info->m_path == nullptr ) { - MessageBox( nullptr, "Unable to allcoate image path info", "Error", + MessageBox( nullptr, "Unable to allocate image path info", "Error", MB_OK | MB_ICONERROR ); delete info; return; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index 8a10f8d35b1..65c614e5c55 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -62,7 +62,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) if( bridge == nullptr ) bridge = TheTerrainRoads->newBridge( name ); - DEBUG_ASSERTCRASH( bridge, ("Unable to allcoate bridge '%s'", name.str()) ); + DEBUG_ASSERTCRASH( bridge, ("Unable to allocate bridge '%s'", name.str()) ); // parse the ini definition ini->initFromINI( bridge, bridge->getBridgeFieldParse() ); diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 5b5e9ac3fed..c2fb7db05df 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -111,7 +111,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) file->close(); // write the contents to the save file - DEBUG_ASSERTCRASH( xfer->getXferMode() == XFER_SAVE, ("embedPristineMap - Unsupposed xfer mode") ); + DEBUG_ASSERTCRASH( xfer->getXferMode() == XFER_SAVE, ("embedPristineMap - Unsupported xfer mode") ); xfer->beginBlock(); xfer->xferUser( buffer, fileSize ); xfer->endBlock(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index 2c96521351c..e6fa5f1643b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -213,7 +213,7 @@ void ControlBar::updateContextStructureInventory( void ) // about we need to repopulate the buttons of the interface // ContainModuleInterface *contain = source->getContain(); - DEBUG_ASSERTCRASH( contain, ("No contain module defined for object in the iventory bar") ); + DEBUG_ASSERTCRASH( contain, ("No contain module defined for object in the inventory bar") ); if (!contain) return; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index d6fc89193c7..18176013d0d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -1330,7 +1330,7 @@ static void saveOptions( void ) if(val > 0) { TheWritableGlobalData->m_keyboardScrollFactor = val/100.0f; - DEBUG_LOG(("Scroll Spped val %d, keyboard scroll factor %f", val, TheGlobalData->m_keyboardScrollFactor)); + DEBUG_LOG(("Scroll Speed val %d, keyboard scroll factor %f", val, TheGlobalData->m_keyboardScrollFactor)); AsciiString prefString; prefString.format("%d", val); (*pref)["ScrollFactor"] = prefString; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 81f6b5c8ad8..86491577398 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -302,10 +302,10 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) DEBUG_ASSERTCRASH(pTrig, ("Attempting to remove a polygon not in the list.")); if (pTrig) { if (pPrev) { - DEBUG_ASSERTCRASH(pTrigger==pPrev->m_nextPolygonTrigger, ("Logic errror. jba.")); + DEBUG_ASSERTCRASH(pTrigger==pPrev->m_nextPolygonTrigger, ("Logic error. jba.")); pPrev->m_nextPolygonTrigger = pTrig->m_nextPolygonTrigger; } else { - DEBUG_ASSERTCRASH(pTrigger==ThePolygonTriggerListPtr, ("Logic errror. jba.")); + DEBUG_ASSERTCRASH(pTrigger==ThePolygonTriggerListPtr, ("Logic error. jba.")); ThePolygonTriggerListPtr = pTrig->m_nextPolygonTrigger; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index fb88a6688d8..626737ef8ab 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2465,7 +2465,7 @@ void Object::setLayer(PathfindLayerEnum layer) DEBUG_LOG(("Changing layer from %d to %d", m_layer, layer)); if (m_layer != LAYER_GROUND) { if (TheTerrainLogic->objectInteractsWithBridgeLayer(this, m_layer)) { - DEBUG_CRASH(("Probably shouldn't be chaging layer. jba.")); + DEBUG_CRASH(("Probably shouldn't be changing layer. jba.")); } } #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index f66f27dd64e..387cb477d69 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -523,7 +523,7 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info { Int i; file.registerParser( "ScriptList", info->label, ScriptList::ParseScriptListDataChunk ); - DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); + DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating around.")); for (i=0; igetAIUpdateInterface(); - DEBUG_ASSERTCRASH(ai, ("Attemped doMoveTo() on an Object with no AI")); + DEBUG_ASSERTCRASH(ai, ("Attempted doMoveTo() on an Object with no AI")); if (ai) { if (theBuildPlan) @@ -1558,7 +1558,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); if (player == nullptr) { - DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); + DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player number")); break; } @@ -1584,7 +1584,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); if (player == nullptr) { - DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); + DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player number")); break; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index ba0ff1765cf..7a35fdeed55 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -116,7 +116,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) if( newString == nullptr ) { - DEBUG_LOG(( "newDisplayString: Could not allcoate new W3D display string" )); + DEBUG_LOG(( "newDisplayString: Could not allocate new W3D display string" )); assert( 0 ); return nullptr; diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index a81065e933e..d4915fd3f2c 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -139,7 +139,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to create keyboard device" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to create keyboard device" )); assert( 0 ); closeKeyboard(); return; @@ -151,7 +151,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to set data format for keyboard" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to set data format for keyboard" )); assert( 0 ); closeKeyboard(); return; @@ -169,7 +169,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to set cooperative level" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to set cooperative level" )); assert( 0 ); closeKeyboard(); return; diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 561ccd5f125..4933f3a84c7 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -54,7 +54,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to create direct input interface" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to create direct input interface" )); assert( 0 ); closeMouse(); return; @@ -80,7 +80,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set mouse data format" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set mouse data format" )); assert( 0 ); closeMouse(); return; @@ -94,7 +94,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set coop level" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set coop level" )); assert( 0 ); closeMouse(); return; @@ -112,7 +112,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set buffer property" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set buffer property" )); assert( 0 ); closeMouse(); return; @@ -124,7 +124,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to acquire mouse" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to acquire mouse" )); assert( 0 ); closeMouse(); return; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index f14322142fa..37ee893a97f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -468,7 +468,7 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) &VertexBuffer); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Vertex buffer creation succesful")); + WWDEBUG_SAY(("...Vertex buffer creation successful")); } // If it still fails it is fatal diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 297670eb2cf..9ad2a277c06 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -2445,7 +2445,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Render target creation succesful.")); + WWDEBUG_SAY(("...Render target creation successful.")); } else { @@ -2536,7 +2536,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Render target creation succesful.")); + WWDEBUG_SAY(("...Render target creation successful.")); } else { @@ -2591,7 +2591,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture ); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Texture creation succesful.")); + WWDEBUG_SAY(("...Texture creation successful.")); } else { @@ -2670,7 +2670,7 @@ IDirect3DVolumeTexture8* DX8Wrapper::_Create_DX8_Volume_Texture ); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Texture creation succesful.")); + WWDEBUG_SAY(("...Texture creation successful.")); } else { diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index db2da4e8138..88b73c6e7fd 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -295,7 +295,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, sliderData->minVal = sliderData->maxVal; sliderData->maxVal = temp; - MessageBox( nullptr, "Slider min greated than max, the values were swapped", + MessageBox( nullptr, "Slider min greater than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); } diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp index 150c5cf44f8..4b8eda4a6d7 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -4058,7 +4058,7 @@ void GUIEdit::bringSelectedToTop( void ) if( snapshot == nullptr ) { - DEBUG_LOG(( "bringSelectedToTop: Unabled to allocate selectList" )); + DEBUG_LOG(( "bringSelectedToTop: Unable to allocate selectList" )); assert( 0 ); return; diff --git a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp index d1321a2f06a..68b57b89a67 100644 --- a/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -1850,7 +1850,7 @@ BOOL EditParameter::OnInitDialog() pList->InsertString(-1, "Passive"); pList->InsertString(-1, "Normal"); pList->InsertString(-1, "Alert"); - pList->InsertString(-1, "Agressive"); + pList->InsertString(-1, "Aggressive"); pList->SetCurSel(m_parameter->getInt() - ATTITUDE_SLEEP); showList = true; break; diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index 94cdc3995d3..0278870e0d6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -2093,7 +2093,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) { MapObject *pMapObj = nullptr; const char* vetStrings[] = {"Green", "Regular", "Veteran", "Elite"}; - const char* aggroStrings[] = {"Passive", "Normal", "Guard", "Hunt", "Agressive", "Sleep"}; + const char* aggroStrings[] = {"Passive", "Normal", "Guard", "Hunt", "Aggressive", "Sleep"}; AsciiString noOwner = "No Owner"; static FILE *theLogFile = nullptr; Bool open = false; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp index 2bcb705c19b..c640a28a3ca 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INITerrainBridge.cpp @@ -62,7 +62,7 @@ void INI::parseTerrainBridgeDefinition( INI* ini ) if( bridge == nullptr ) bridge = TheTerrainRoads->newBridge( name ); - DEBUG_ASSERTCRASH( bridge, ("Unable to allcoate bridge '%s'", name.str()) ); + DEBUG_ASSERTCRASH( bridge, ("Unable to allocate bridge '%s'", name.str()) ); // parse the ini definition ini->initFromINI( bridge, bridge->getBridgeFieldParse() ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 1d2294c321f..8d5a869534e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -520,7 +520,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transisioning to state #d", (Int)id)); + DEBUG_LOG(("Transitioning to state %d", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 9efafb2ea29..1ce3b1a7de9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -113,7 +113,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) file->close(); // write the contents to the save file - DEBUG_ASSERTCRASH( xfer->getXferMode() == XFER_SAVE, ("embedPristineMap - Unsupposed xfer mode") ); + DEBUG_ASSERTCRASH( xfer->getXferMode() == XFER_SAVE, ("embedPristineMap - Unsupported xfer mode") ); xfer->beginBlock(); xfer->xferUser( buffer, fileSize ); xfer->endBlock(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index 3bece0dc76f..a454fe5c149 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -223,7 +223,7 @@ void ControlBar::updateContextStructureInventory( void ) // about we need to repopulate the buttons of the interface // ContainModuleInterface *contain = source->getContain(); - DEBUG_ASSERTCRASH( contain, ("No contain module defined for object in the iventory bar") ); + DEBUG_ASSERTCRASH( contain, ("No contain module defined for object in the inventory bar") ); if (!contain) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index f8f484e17dc..80e69828fe7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -1390,7 +1390,7 @@ static void saveOptions( void ) if(val > 0) { TheWritableGlobalData->m_keyboardScrollFactor = val/100.0f; - DEBUG_LOG(("Scroll Spped val %d, keyboard scroll factor %f", val, TheGlobalData->m_keyboardScrollFactor)); + DEBUG_LOG(("Scroll Speed val %d, keyboard scroll factor %f", val, TheGlobalData->m_keyboardScrollFactor)); AsciiString prefString; prefString.format("%d", val); (*pref)["ScrollFactor"] = prefString; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 5ae459da41e..26198e43b0a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp @@ -318,10 +318,10 @@ void PolygonTrigger::removePolygonTrigger(PolygonTrigger *pTrigger) DEBUG_ASSERTCRASH(pTrig, ("Attempting to remove a polygon not in the list.")); if (pTrig) { if (pPrev) { - DEBUG_ASSERTCRASH(pTrigger==pPrev->m_nextPolygonTrigger, ("Logic errror. jba.")); + DEBUG_ASSERTCRASH(pTrigger==pPrev->m_nextPolygonTrigger, ("Logic error. jba.")); pPrev->m_nextPolygonTrigger = pTrig->m_nextPolygonTrigger; } else { - DEBUG_ASSERTCRASH(pTrigger==ThePolygonTriggerListPtr, ("Logic errror. jba.")); + DEBUG_ASSERTCRASH(pTrigger==ThePolygonTriggerListPtr, ("Logic error. jba.")); ThePolygonTriggerListPtr = pTrig->m_nextPolygonTrigger; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 8acdf5a9751..e11db7d4c53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2759,7 +2759,7 @@ void Object::setLayer(PathfindLayerEnum layer) DEBUG_LOG(("Changing layer from %d to %d", m_layer, layer)); if (m_layer != LAYER_GROUND) { if (TheTerrainLogic->objectInteractsWithBridgeLayer(this, m_layer)) { - DEBUG_CRASH(("Probably shouldn't be chaging layer. jba.")); + DEBUG_CRASH(("Probably shouldn't be changing layer. jba.")); } } #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index ab4e28f81fd..4e9daf5e682 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -526,7 +526,7 @@ Bool ScriptList::ParseScriptsDataChunk(DataChunkInput &file, DataChunkInfo *info { Int i; file.registerParser( "ScriptList", info->label, ScriptList::ParseScriptListDataChunk ); - DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating aroung.")); + DEBUG_ASSERTCRASH(s_numInReadList==0, ("Leftover scripts floating around.")); for (i=0; isetStartPos(closestIdx); taken[closestIdx] = TRUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 397edece8d1..20245d16e50 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -101,7 +101,7 @@ static int thePlanSubjectCount = 0; static void doMoveTo( Object *obj, const Coord3D *pos ) { AIUpdateInterface *ai = obj->getAIUpdateInterface(); - DEBUG_ASSERTCRASH(ai, ("Attemped doMoveTo() on an Object with no AI")); + DEBUG_ASSERTCRASH(ai, ("Attempted doMoveTo() on an Object with no AI")); if (ai) { if (theBuildPlan) @@ -1586,7 +1586,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); if (player == nullptr) { - DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); + DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player number")); break; } @@ -1612,7 +1612,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) Player *player = ThePlayerList->getNthPlayer(msg->getPlayerIndex()); if (player == nullptr) { - DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player nubmer")); + DEBUG_CRASH(("GameLogicDispatch - MSG_CREATE_SELECTED_GROUP had an invalid player number")); break; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 40a70da88dc..2ecf7cdf808 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -116,7 +116,7 @@ DisplayString *W3DDisplayStringManager::newDisplayString( void ) if( newString == nullptr ) { - DEBUG_LOG(( "newDisplayString: Could not allcoate new W3D display string" )); + DEBUG_LOG(( "newDisplayString: Could not allocate new W3D display string" )); assert( 0 ); return nullptr; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp index 5055c7e5d57..cb33e1ba80d 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIKeyboard.cpp @@ -139,7 +139,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to create keyboard device" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to create keyboard device" )); assert( 0 ); closeKeyboard(); return; @@ -151,7 +151,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to set data format for keyboard" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to set data format for keyboard" )); assert( 0 ); closeKeyboard(); return; @@ -169,7 +169,7 @@ void DirectInputKeyboard::openKeyboard( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openKeyboard: Unabled to set cooperative level" )); + DEBUG_LOG(( "ERROR - openKeyboard: Unable to set cooperative level" )); assert( 0 ); closeKeyboard(); return; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index c7dbf108713..0cb6752bcb9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -54,7 +54,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to create direct input interface" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to create direct input interface" )); assert( 0 ); closeMouse(); return; @@ -78,7 +78,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set mouse data format" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set mouse data format" )); assert( 0 ); closeMouse(); return; @@ -92,7 +92,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set coop level" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set coop level" )); assert( 0 ); closeMouse(); return; @@ -110,7 +110,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to set buffer property" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to set buffer property" )); assert( 0 ); closeMouse(); return; @@ -122,7 +122,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "ERROR - openMouse: Unabled to acquire mouse" )); + DEBUG_LOG(( "ERROR - openMouse: Unable to acquire mouse" )); assert( 0 ); closeMouse(); return; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 309e46689a6..d799a596706 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -327,7 +327,7 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u &index_buffer); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Index buffer creation succesful")); + WWDEBUG_SAY(("...Index buffer creation successful")); } // If it still fails it is fatal diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index cd4dfe2cc80..8c61f2222c5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -478,7 +478,7 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) &VertexBuffer); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Vertex buffer creation succesful")); + WWDEBUG_SAY(("...Vertex buffer creation successful")); } // If it still fails it is fatal diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 8fe4cf45b38..97027d7e321 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -2469,7 +2469,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture &texture); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Render target creation succesful.")); + WWDEBUG_SAY(("...Render target creation successful.")); } else { WWDEBUG_SAY(("...Render target creation failed.")); @@ -2518,7 +2518,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture pool, &texture); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Texture creation succesful.")); + WWDEBUG_SAY(("...Texture creation successful.")); } else { StringClass format_name(0,true); @@ -2670,7 +2670,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Render target creation succesful.")); + WWDEBUG_SAY(("...Render target creation successful.")); } else { @@ -2761,7 +2761,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Render target creation succesful.")); + WWDEBUG_SAY(("...Render target creation successful.")); } else { @@ -2816,7 +2816,7 @@ IDirect3DCubeTexture8* DX8Wrapper::_Create_DX8_Cube_Texture ); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Texture creation succesful.")); + WWDEBUG_SAY(("...Texture creation successful.")); } else { @@ -2895,7 +2895,7 @@ IDirect3DVolumeTexture8* DX8Wrapper::_Create_DX8_Volume_Texture ); if (SUCCEEDED(ret)) { - WWDEBUG_SAY(("...Texture creation succesful.")); + WWDEBUG_SAY(("...Texture creation successful.")); } else { diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp index 2456ebdd648..fd6bc2d94c1 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/SliderProperties.cpp @@ -295,7 +295,7 @@ static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog, sliderData->minVal = sliderData->maxVal; sliderData->maxVal = temp; - MessageBox( nullptr, "Slider min greated than max, the values were swapped", + MessageBox( nullptr, "Slider min greater than max, the values were swapped", "Warning", MB_OK | MB_ICONINFORMATION ); } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp index a682cf827ce..a7954884e37 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cpp @@ -4058,7 +4058,7 @@ void GUIEdit::bringSelectedToTop( void ) if( snapshot == nullptr ) { - DEBUG_LOG(( "bringSelectedToTop: Unabled to allocate selectList" )); + DEBUG_LOG(( "bringSelectedToTop: Unable to allocate selectList" )); assert( 0 ); return; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp index 1e9a6933c8e..74525f8911b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -1893,7 +1893,7 @@ BOOL EditParameter::OnInitDialog() pList->InsertString(-1, "Passive"); pList->InsertString(-1, "Normal"); pList->InsertString(-1, "Alert"); - pList->InsertString(-1, "Agressive"); + pList->InsertString(-1, "Aggressive"); pList->SetCurSel(m_parameter->getInt() - ATTITUDE_SLEEP); showList = true; break; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp index ebc31b3180e..f05cf278bd8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp @@ -2150,7 +2150,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void) { MapObject *pMapObj = nullptr; const char* vetStrings[] = {"Green", "Regular", "Veteran", "Elite"}; - const char* aggroStrings[] = {"Passive", "Normal", "Guard", "Hunt", "Agressive", "Sleep"}; + const char* aggroStrings[] = {"Passive", "Normal", "Guard", "Hunt", "Aggressive", "Sleep"}; AsciiString noOwner = "No Owner"; static FILE *theLogFile = nullptr; Bool open = false; From 6d92cf3739a64491526aef64c25a5e906984fd0b Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 06:00:06 -0500 Subject: [PATCH 054/211] fix: Rename misspelled identifiers (#2109) --- .../Include/GameNetwork/ConnectionManager.h | 2 +- .../Include/GameNetwork/DisconnectManager.h | 4 +- .../Include/GameNetwork/NetworkInterface.h | 2 +- .../Source/GameNetwork/ConnectionManager.cpp | 4 +- .../Source/GameNetwork/DisconnectManager.cpp | 10 +-- .../GameEngine/Source/GameNetwork/Network.cpp | 6 +- .../Source/WWVegas/WW3D2/ringobj.cpp | 4 +- Core/Libraries/Source/WWVegas/WW3D2/ringobj.h | 10 +-- .../Source/WWVegas/WW3D2/soundrobj.cpp | 20 ++--- .../Source/WWVegas/WW3D2/soundrobj.h | 2 +- .../Source/WWVegas/WW3D2/sphereobj.cpp | 4 +- .../Source/WWVegas/WW3D2/sphereobj.h | 10 +-- .../Source/WWVegas/WWDebug/wwprofile.cpp | 86 +++++++++---------- .../Source/WWVegas/WWDebug/wwprofile.h | 72 ++++++++-------- Core/Tools/W3DView/ScreenCursor.cpp | 2 +- Core/Tools/WW3D/max2w3d/MeshDeform.cpp | 2 +- Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp | 2 +- Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp | 66 +++++++------- Core/Tools/WW3D/max2w3d/MeshDeformSet.h | 8 +- Core/Tools/WW3D/max2w3d/colboxsave.cpp | 10 +-- .../Tools/WW3D/max2w3d/geometryexporttask.cpp | 2 +- Core/Tools/WW3D/max2w3d/maxworldinfo.cpp | 4 +- Core/Tools/WW3D/max2w3d/w3d_file.h | 10 +-- .../GameEngine/Include/Common/StackDump.h | 2 +- .../Include/GameClient/ControlBar.h | 2 +- .../Include/GameClient/ControlBarScheme.h | 2 +- .../Include/GameClient/GameWindow.h | 2 +- .../GameClient/GameWindowTransitions.h | 2 +- .../Include/GameClient/IMEManager.h | 2 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 4 +- .../GameEngine/Source/GameClient/Credits.cpp | 24 +++--- .../GameClient/GUI/ControlBar/ControlBar.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 24 +++--- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 2 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 2 +- .../GameClient/GUI/GameWindowManager.cpp | 10 +-- .../GameClient/GUI/GameWindowTransitions.cpp | 6 +- .../Source/GameClient/GUI/IMEManager.cpp | 12 +-- .../Source/GameClient/GUI/LoadScreen.cpp | 20 ++--- .../Source/GameClient/GUI/Shell/Shell.cpp | 16 ++-- .../GameEngine/Source/GameClient/InGameUI.cpp | 10 +-- .../Source/GameLogic/AI/AIPathfind.cpp | 8 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 28 +++--- .../Source/GameLogic/Object/Weapon.cpp | 4 +- .../GameLogic/System/GameLogicDispatch.cpp | 2 +- .../W3DDevice/GameClient/W3DAssetManager.h | 2 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 32 +++---- .../W3DDevice/GameClient/W3DAssetManager.cpp | 2 +- .../Source/WWVegas/WW3D2/part_emt.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/part_emt.h | 10 +-- .../Source/WWVegas/WW3D2/render2d.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/w3d_file.h | 10 +-- .../Code/Tools/GUIEdit/Resource/GUIEdit.rc | 22 ++--- .../Code/Tools/GUIEdit/Resource/resource.h | 2 +- .../Code/Tools/GUIEdit/Source/Properties.cpp | 8 +- .../GameEngine/Include/Common/AcademyStats.h | 2 +- .../GameEngine/Include/Common/StackDump.h | 2 +- .../Include/GameClient/ControlBar.h | 2 +- .../Include/GameClient/ControlBarScheme.h | 2 +- .../Include/GameClient/GameWindow.h | 2 +- .../GameClient/GameWindowTransitions.h | 2 +- .../Include/GameClient/IMEManager.h | 2 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 4 +- .../Source/Common/RTS/AcademyStats.cpp | 2 +- .../GameEngine/Source/GameClient/Credits.cpp | 24 +++--- .../GameClient/GUI/ControlBar/ControlBar.cpp | 2 +- .../GUI/ControlBar/ControlBarScheme.cpp | 24 +++--- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 2 +- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 2 +- .../GameClient/GUI/GameWindowManager.cpp | 10 +-- .../GameClient/GUI/GameWindowTransitions.cpp | 6 +- .../Source/GameClient/GUI/IMEManager.cpp | 12 +-- .../Source/GameClient/GUI/LoadScreen.cpp | 20 ++--- .../Source/GameClient/GUI/Shell/Shell.cpp | 16 ++-- .../Source/GameLogic/AI/AIPathfind.cpp | 8 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 28 +++--- .../Source/GameLogic/Object/Weapon.cpp | 4 +- .../GameLogic/System/GameLogicDispatch.cpp | 2 +- .../W3DDevice/GameClient/W3DAssetManager.h | 2 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 32 +++---- .../W3DDevice/GameClient/W3DAssetManager.cpp | 2 +- .../Source/WWVegas/WW3D2/part_emt.cpp | 6 +- .../Libraries/Source/WWVegas/WW3D2/part_emt.h | 10 +-- .../Source/WWVegas/WW3D2/render2d.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/w3d_file.h | 10 +-- .../Code/Tools/GUIEdit/Resource/GUIEdit.rc | 22 ++--- .../Code/Tools/GUIEdit/Resource/resource.h | 2 +- .../Code/Tools/GUIEdit/Source/Properties.cpp | 8 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 8 +- GeneralsMD/Code/Tools/wdump/chunk_d.cpp | 20 ++--- 92 files changed, 466 insertions(+), 466 deletions(-) diff --git a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h index b10b79d2d62..956429dd422 100644 --- a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h +++ b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h @@ -144,7 +144,7 @@ class ConnectionManager // For disconnect blame assignment UnsignedInt getPingFrame(); Int getPingsSent(); - Int getPingsRecieved(); + Int getPingsReceived(); private: void doRelay(); diff --git a/Core/GameEngine/Include/GameNetwork/DisconnectManager.h b/Core/GameEngine/Include/GameNetwork/DisconnectManager.h index cfc1fb952e4..ccbb183881f 100644 --- a/Core/GameEngine/Include/GameNetwork/DisconnectManager.h +++ b/Core/GameEngine/Include/GameNetwork/DisconnectManager.h @@ -61,7 +61,7 @@ class DisconnectManager // For disconnect blame assignment UnsignedInt getPingFrame(); Int getPingsSent(); - Int getPingsRecieved(); + Int getPingsReceived(); protected: void sendKeepAlive(ConnectionManager *conMgr); @@ -120,6 +120,6 @@ class DisconnectManager time_t m_timeOfDisconnectScreenOn; Int m_pingsSent; - Int m_pingsRecieved; + Int m_pingsReceived; UnsignedInt m_pingFrame; }; diff --git a/Core/GameEngine/Include/GameNetwork/NetworkInterface.h b/Core/GameEngine/Include/GameNetwork/NetworkInterface.h index c0bf655eb64..3a577864f53 100644 --- a/Core/GameEngine/Include/GameNetwork/NetworkInterface.h +++ b/Core/GameEngine/Include/GameNetwork/NetworkInterface.h @@ -125,7 +125,7 @@ class NetworkInterface : public SubsystemInterface // For disconnect blame assignment virtual UnsignedInt getPingFrame() = 0; virtual Int getPingsSent() = 0; - virtual Int getPingsRecieved() = 0; + virtual Int getPingsReceived() = 0; }; diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index a9745c4ec70..ab7a87ef16b 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -295,9 +295,9 @@ Int ConnectionManager::getPingsSent() return (m_disconnectManager)?m_disconnectManager->getPingsSent():0; } -Int ConnectionManager::getPingsRecieved() +Int ConnectionManager::getPingsReceived() { - return (m_disconnectManager)?m_disconnectManager->getPingsRecieved():0; + return (m_disconnectManager)?m_disconnectManager->getPingsReceived():0; } Bool ConnectionManager::isPlayerConnected( Int playerID ) diff --git a/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp b/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp index 94beda05da6..6aec6e5868d 100644 --- a/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp @@ -90,7 +90,7 @@ void DisconnectManager::init() { m_pingFrame = 0; m_pingsSent = 0; - m_pingsRecieved = 0; + m_pingsReceived = 0; } void DisconnectManager::update(ConnectionManager *conMgr) { @@ -124,7 +124,7 @@ void DisconnectManager::update(ConnectionManager *conMgr) { { m_pingFrame = TheGameLogic->getFrame(); m_pingsSent = 0; - m_pingsRecieved = 0; + m_pingsReceived = 0; // Send the pings if (ThePinger) @@ -173,7 +173,7 @@ void DisconnectManager::update(ConnectionManager *conMgr) { resp.avgPing, resp.hostname.c_str(), resp.repetitions)); if (resp.avgPing < 2000) { - m_pingsRecieved += resp.repetitions; + m_pingsReceived += resp.repetitions; } } } @@ -191,9 +191,9 @@ Int DisconnectManager::getPingsSent() return m_pingsSent; } -Int DisconnectManager::getPingsRecieved() +Int DisconnectManager::getPingsReceived() { - return m_pingsRecieved; + return m_pingsReceived; } diff --git a/Core/GameEngine/Source/GameNetwork/Network.cpp b/Core/GameEngine/Source/GameNetwork/Network.cpp index a308536ffc8..0df69993cea 100644 --- a/Core/GameEngine/Source/GameNetwork/Network.cpp +++ b/Core/GameEngine/Source/GameNetwork/Network.cpp @@ -176,7 +176,7 @@ class Network : public NetworkInterface // For disconnect blame assignment UnsignedInt getPingFrame(); Int getPingsSent(); - Int getPingsRecieved(); + Int getPingsReceived(); protected: void GetCommandsFromCommandList(); ///< Remove commands from TheCommandList and put them on the Network command list. @@ -231,9 +231,9 @@ Int Network::getPingsSent() return (m_conMgr)?m_conMgr->getPingsSent():0; } -Int Network::getPingsRecieved() +Int Network::getPingsReceived() { - return (m_conMgr)?m_conMgr->getPingsRecieved():0; + return (m_conMgr)?m_conMgr->getPingsReceived():0; } Bool Network::isPlayerConnected( Int playerID ) { diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp index ddfa8904b2e..de5e0de92f9 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp @@ -1101,7 +1101,7 @@ void RingRenderObjClass::Scale(float scalex, float scaley, float scalez) /*********************************************************************************************** - * RingRenderObjClass::Update_On_Visibilty -- Either starts or stops the animation based on vis* + * RingRenderObjClass::Update_On_Visibility -- Either starts or stops the animation based on vis* * * * INPUT: * * * @@ -1112,7 +1112,7 @@ void RingRenderObjClass::Scale(float scalex, float scaley, float scalez) * HISTORY: * * 4/04/00 pds : Created. * *=============================================================================================*/ -void RingRenderObjClass::Update_On_Visibilty(void) +void RingRenderObjClass::Update_On_Visibility(void) { // Simply start or stop the animation based on // the visibility state of the primitive. diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h index 578effcfb3f..fafdffe9e0f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.h @@ -140,10 +140,10 @@ class RingRenderObjClass : public RenderObjClass virtual void Scale(float scale); virtual void Scale(float scalex, float scaley, float scalez); - virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibilty (); } - virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibilty (); } + virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibility (); } + virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibility (); } const AABoxClass & Get_Box(void); @@ -220,7 +220,7 @@ class RingRenderObjClass : public RenderObjClass protected: virtual void update_cached_box(void); - void Update_On_Visibilty(void); + void Update_On_Visibility(void); // Initialization stuff void Init_Material (void); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp index f8285b6085a..36434e71286 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.cpp @@ -195,7 +195,7 @@ SoundRenderObjClass::Set_Hidden (int onoff) // if (IsInitialized == false || Is_Not_Hidden_At_All () != before) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; @@ -218,7 +218,7 @@ SoundRenderObjClass::Set_Visible (int onoff) // if (IsInitialized == false || Is_Not_Hidden_At_All () != before) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; @@ -241,7 +241,7 @@ SoundRenderObjClass::Set_Animation_Hidden (int onoff) // if (IsInitialized == false || Is_Not_Hidden_At_All () != before) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; @@ -264,7 +264,7 @@ SoundRenderObjClass::Set_Force_Visible (int onoff) // if (IsInitialized == false || Is_Not_Hidden_At_All () != before) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; @@ -273,11 +273,11 @@ SoundRenderObjClass::Set_Force_Visible (int onoff) ////////////////////////////////////////////////////////////////////////////////// // -// Update_On_Visibilty +// Update_On_Visibility // ////////////////////////////////////////////////////////////////////////////////// void -SoundRenderObjClass::Update_On_Visibilty (void) +SoundRenderObjClass::Update_On_Visibility (void) { if (Sound == nullptr) { return ; @@ -363,7 +363,7 @@ SoundRenderObjClass::Notify_Added (SceneClass *scene) RenderObjClass::Notify_Added (scene); scene->Register (this, SceneClass::ON_FRAME_UPDATE); - Update_On_Visibilty (); + Update_On_Visibility (); return ; } @@ -379,7 +379,7 @@ SoundRenderObjClass::Notify_Removed (SceneClass *scene) scene->Unregister (this, SceneClass::ON_FRAME_UPDATE); RenderObjClass::Notify_Removed (scene); - Update_On_Visibilty (); + Update_On_Visibility (); return ; } @@ -396,7 +396,7 @@ SoundRenderObjClass::Set_Transform (const Matrix3D &tm) if (IsInitialized == false) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; @@ -415,7 +415,7 @@ SoundRenderObjClass::Set_Position (const Vector3 &pos) if (IsInitialized == false) { IsInitialized = true; - Update_On_Visibilty (); + Update_On_Visibility (); } return ; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h index c22687dba9d..3624a6172c5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h @@ -136,7 +136,7 @@ class SoundRenderObjClass : public RenderObjClass /////////////////////////////////////////////////////////// // Protected methods /////////////////////////////////////////////////////////// - virtual void Update_On_Visibilty (void); + virtual void Update_On_Visibility (void); private: diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp index 94aaeb7a9e2..72e8e9eed1e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -1058,7 +1058,7 @@ AlphaVectorStruct SphereRenderObjClass::Get_Default_Vector(void) const /*********************************************************************************************** - * SphereRenderObjClass::Update_On_Visibilty -- Either starts or stops the animation based on visibility* + * SphereRenderObjClass::Update_On_Visibility -- Either starts or stops the animation based on visibility* * * * INPUT: * * * @@ -1069,7 +1069,7 @@ AlphaVectorStruct SphereRenderObjClass::Get_Default_Vector(void) const * HISTORY: * * 4/04/00 pds : Created. * *=============================================================================================*/ -void SphereRenderObjClass::Update_On_Visibilty(void) +void SphereRenderObjClass::Update_On_Visibility(void) { // Simply start or stop the animation based on // the visibility state of the primitive. diff --git a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h index 57b8d1b9059..b681b91ed12 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.h @@ -266,10 +266,10 @@ class SphereRenderObjClass : public RenderObjClass virtual void Scale(float scale); virtual void Scale(float scalex, float scaley, float scalez); - virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibilty (); } - virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibilty (); } + virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibility (); } + virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibility (); } const AABoxClass & Get_Box(void); @@ -341,7 +341,7 @@ class SphereRenderObjClass : public RenderObjClass virtual void update_cached_box(void); virtual void Update_Cached_Bounding_Volumes(void) const; - void Update_On_Visibilty(void); + void Update_On_Visibility(void); // Initialization stuff void Init_Material (void); diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp index c3ed92b9e2f..00a0241bcda 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp @@ -32,12 +32,12 @@ * * *---------------------------------------------------------------------------------------------* * WWProfile_Get_Ticks -- Retrieves the cpu performance counter * - * WWProfileHierachyNodeClass::WWProfileHierachyNodeClass -- Constructor * - * WWProfileHierachyNodeClass::~WWProfileHierachyNodeClass -- Destructor * - * WWProfileHierachyNodeClass::Get_Sub_Node -- Searches for a child node by name (pointer) * - * WWProfileHierachyNodeClass::Reset -- Reset all profiling data in the tree * - * WWProfileHierachyNodeClass::Call -- Start timing * - * WWProfileHierachyNodeClass::Return -- Stop timing, record results * + * WWProfileHierarchyNodeClass::WWProfileHierarchyNodeClass -- Constructor * + * WWProfileHierarchyNodeClass::~WWProfileHierarchyNodeClass -- Destructor * + * WWProfileHierarchyNodeClass::Get_Sub_Node -- Searches for a child node by name (pointer) * + * WWProfileHierarchyNodeClass::Reset -- Reset all profiling data in the tree * + * WWProfileHierarchyNodeClass::Call -- Start timing * + * WWProfileHierarchyNodeClass::Return -- Stop timing, record results * * WWProfileManager::Start_Profile -- Begin a named profile * * WWProfileManager::Stop_Profile -- Stop timing and record the results. * * WWProfileManager::Reset -- Reset the contents of the profiling system * @@ -62,7 +62,7 @@ #include "hashtemplate.h" #include -static SimpleDynVecClass ProfileCollectVector; +static SimpleDynVecClass ProfileCollectVector; static double TotalFrameTimes; static bool ProfileCollecting; @@ -106,7 +106,7 @@ inline void WWProfile_Get_Ticks(_int64 * ticks) /*********************************************************************************************** - * WWProfileHierachyNodeClass::WWProfileHierachyNodeClass -- Constructor * + * WWProfileHierarchyNodeClass::WWProfileHierarchyNodeClass -- Constructor * * * * * * INPUT: * @@ -122,7 +122,7 @@ inline void WWProfile_Get_Ticks(_int64 * ticks) * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( const char * name, WWProfileHierachyNodeClass * parent ) : +WWProfileHierarchyNodeClass::WWProfileHierarchyNodeClass( const char * name, WWProfileHierarchyNodeClass * parent ) : Name( name ), TotalCalls( 0 ), TotalTime( 0 ), @@ -140,7 +140,7 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( const char * name, WWPro } } -WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( unsigned id, WWProfileHierachyNodeClass * parent ) : +WWProfileHierarchyNodeClass::WWProfileHierarchyNodeClass( unsigned id, WWProfileHierarchyNodeClass * parent ) : Name( nullptr ), TotalCalls( 0 ), TotalTime( 0 ), @@ -156,7 +156,7 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( unsigned id, WWProfileHi /*********************************************************************************************** - * WWProfileHierachyNodeClass::~WWProfileHierachyNodeClass -- Destructor * + * WWProfileHierarchyNodeClass::~WWProfileHierarchyNodeClass -- Destructor * * * * INPUT: * * * @@ -167,16 +167,16 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( unsigned id, WWProfileHi * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -WWProfileHierachyNodeClass::~WWProfileHierachyNodeClass( void ) +WWProfileHierarchyNodeClass::~WWProfileHierarchyNodeClass( void ) { delete Child; delete Sibling; } -WWProfileHierachyNodeClass* WWProfileHierachyNodeClass::Clone_Hierarchy(WWProfileHierachyNodeClass* parent) +WWProfileHierarchyNodeClass* WWProfileHierarchyNodeClass::Clone_Hierarchy(WWProfileHierarchyNodeClass* parent) { - WWProfileHierachyNodeClass* node=new WWProfileHierachyNodeClass(Name,parent); + WWProfileHierarchyNodeClass* node=new WWProfileHierarchyNodeClass(Name,parent); node->TotalCalls=TotalCalls; node->TotalTime=TotalTime; node->StartTime=StartTime; @@ -192,7 +192,7 @@ WWProfileHierachyNodeClass* WWProfileHierachyNodeClass::Clone_Hierarchy(WWProfil return node; } -void WWProfileHierachyNodeClass::Write_To_File(FileClass* file,int recursion) +void WWProfileHierarchyNodeClass::Write_To_File(FileClass* file,int recursion) { if (TotalTime!=0.0f) { int i; @@ -211,7 +211,7 @@ void WWProfileHierachyNodeClass::Write_To_File(FileClass* file,int recursion) } } -void WWProfileHierachyNodeClass::Add_To_String_Compact(StringClass& string,int recursion) +void WWProfileHierarchyNodeClass::Add_To_String_Compact(StringClass& string,int recursion) { if (TotalTime!=0.0f) { StringClass work; @@ -233,7 +233,7 @@ void WWProfileHierachyNodeClass::Add_To_String_Compact(StringClass& string,int r } /*********************************************************************************************** - * WWProfileHierachyNodeClass::Get_Sub_Node -- Searches for a child node by name (pointer) * + * WWProfileHierarchyNodeClass::Get_Sub_Node -- Searches for a child node by name (pointer) * * * * INPUT: * * name - static string pointer to the name of the node we are searching for * @@ -247,10 +247,10 @@ void WWProfileHierachyNodeClass::Add_To_String_Compact(StringClass& string,int r * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -WWProfileHierachyNodeClass * WWProfileHierachyNodeClass::Get_Sub_Node( const char * name ) +WWProfileHierarchyNodeClass * WWProfileHierarchyNodeClass::Get_Sub_Node( const char * name ) { // Try to find this sub node - WWProfileHierachyNodeClass * child = Child; + WWProfileHierarchyNodeClass * child = Child; while ( child ) { if ( child->Name == name ) { return child; @@ -259,7 +259,7 @@ WWProfileHierachyNodeClass * WWProfileHierachyNodeClass::Get_Sub_Node( const cha } // We didn't find it, so add it - WWProfileHierachyNodeClass * node = W3DNEW WWProfileHierachyNodeClass( name, this ); + WWProfileHierarchyNodeClass * node = W3DNEW WWProfileHierarchyNodeClass( name, this ); node->Sibling = Child; Child = node; return node; @@ -267,7 +267,7 @@ WWProfileHierachyNodeClass * WWProfileHierachyNodeClass::Get_Sub_Node( const cha /*********************************************************************************************** - * WWProfileHierachyNodeClass::Reset -- Reset all profiling data in the tree * + * WWProfileHierarchyNodeClass::Reset -- Reset all profiling data in the tree * * * * INPUT: * * * @@ -278,7 +278,7 @@ WWProfileHierachyNodeClass * WWProfileHierachyNodeClass::Get_Sub_Node( const cha * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -void WWProfileHierachyNodeClass::Reset( void ) +void WWProfileHierarchyNodeClass::Reset( void ) { TotalCalls = 0; TotalTime = 0.0f; @@ -293,7 +293,7 @@ void WWProfileHierachyNodeClass::Reset( void ) /*********************************************************************************************** - * WWProfileHierachyNodeClass::Call -- Start timing * + * WWProfileHierarchyNodeClass::Call -- Start timing * * * * INPUT: * * * @@ -304,7 +304,7 @@ void WWProfileHierachyNodeClass::Reset( void ) * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -void WWProfileHierachyNodeClass::Call( void ) +void WWProfileHierarchyNodeClass::Call( void ) { TotalCalls++; if (RecursionCounter++ == 0) { @@ -314,7 +314,7 @@ void WWProfileHierachyNodeClass::Call( void ) /*********************************************************************************************** - * WWProfileHierachyNodeClass::Return -- Stop timing, record results * + * WWProfileHierarchyNodeClass::Return -- Stop timing, record results * * * * INPUT: * * * @@ -325,7 +325,7 @@ void WWProfileHierachyNodeClass::Call( void ) * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -bool WWProfileHierachyNodeClass::Return( void ) +bool WWProfileHierarchyNodeClass::Return( void ) { if (--RecursionCounter == 0) { if ( TotalCalls != 0 ) { @@ -346,9 +346,9 @@ bool WWProfileHierachyNodeClass::Return( void ) ** ***************************************************************************************************/ bool WWProfileManager::IsProfileEnabled=false; -WWProfileHierachyNodeClass WWProfileManager::Root( "Root", nullptr ); -WWProfileHierachyNodeClass * WWProfileManager::CurrentNode = &WWProfileManager::Root; -WWProfileHierachyNodeClass * WWProfileManager::CurrentRootNode = &WWProfileManager::Root; +WWProfileHierarchyNodeClass WWProfileManager::Root( "Root", nullptr ); +WWProfileHierarchyNodeClass * WWProfileManager::CurrentNode = &WWProfileManager::Root; +WWProfileHierarchyNodeClass * WWProfileManager::CurrentRootNode = &WWProfileManager::Root; int WWProfileManager::FrameCounter = 0; __int64 WWProfileManager::ResetTime = 0; @@ -482,7 +482,7 @@ void WWProfileManager::Increment_Frame_Counter( void ) if (ProfileCollecting) { float time=Get_Time_Since_Reset(); TotalFrameTimes+=time; - WWProfileHierachyNodeClass* new_root=Root.Clone_Hierarchy(nullptr); + WWProfileHierarchyNodeClass* new_root=Root.Clone_Hierarchy(nullptr); new_root->Set_Total_Time(time); new_root->Set_Total_Calls(1); ProfileCollectVector.Add(new_root); @@ -717,14 +717,14 @@ static unsigned Read_ID(char* memory,unsigned pos,unsigned maxpos,StringClass& s return Read_Line(memory,pos,maxpos); } -static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHierachyInfoClass*& root,HashTemplateClass& id_hash) +static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHierarchyInfoClass*& root,HashTemplateClass& id_hash) { char statusstring[256]; unsigned framenumber=0; float frametime; root=nullptr; - WWProfileHierachyInfoClass* parent=nullptr; - WWProfileHierachyInfoClass* latest=nullptr; + WWProfileHierarchyInfoClass* parent=nullptr; + WWProfileHierarchyInfoClass* latest=nullptr; pos+=7; // "FRAME: " @@ -757,7 +757,7 @@ static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHi StringClass name="Unknown"; id_hash.Get(id,name); - WWProfileHierachyInfoClass* new_node=new WWProfileHierachyInfoClass(name,parent); + WWProfileHierarchyInfoClass* new_node=new WWProfileHierarchyInfoClass(name,parent); if (parent) { new_node->Set_Sibling(parent->Get_Child()); parent->Set_Child(new_node); @@ -785,7 +785,7 @@ static unsigned Read_Frame(char* memory,unsigned pos,unsigned maxpos,WWProfileHi return Read_Line(memory,pos,maxpos); } -void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyInfoClass**& array, unsigned& count) +void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierarchyInfoClass**& array, unsigned& count) { array=nullptr; count=0; @@ -795,7 +795,7 @@ void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyI if (file != nullptr && file->Is_Available()) { HashTemplateClass string_hash; HashTemplateClass id_hash; - SimpleDynVecClass vec; + SimpleDynVecClass vec; // // Open or create the file @@ -819,7 +819,7 @@ void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyI id_hash.Insert(id,string); } else if (tmp[0]=='F' && tmp[1]=='R' && tmp[2]=='A' && tmp[3]=='M' && tmp[4]=='E' && tmp[5]==':') { - WWProfileHierachyInfoClass* node=nullptr; + WWProfileHierarchyInfoClass* node=nullptr; pos=Read_Frame(memory,pos,size,node,id_hash); if (node) { vec.Add(node); @@ -833,7 +833,7 @@ void WWProfileManager::Load_Profile_Log(const char* filename, WWProfileHierachyI if (vec.Count()) { count=vec.Count(); - array=new WWProfileHierachyInfoClass*[count]; + array=new WWProfileHierarchyInfoClass*[count]; for (i=0;iGet_Child(); @@ -1080,7 +1080,7 @@ void WWMemoryAndTimeLog::Log_Intermediate(const char* text) } /*********************************************************************************************** - * WWProfileHierachyInfoClass::WWProfileHierachyInfoClass -- Constructor * + * WWProfileHierarchyInfoClass::WWProfileHierarchyInfoClass -- Constructor * * * * * * INPUT: * @@ -1093,7 +1093,7 @@ void WWMemoryAndTimeLog::Log_Intermediate(const char* text) * * * HISTORY: * *=============================================================================================*/ -WWProfileHierachyInfoClass::WWProfileHierachyInfoClass( const char * name, WWProfileHierachyInfoClass * parent ) : +WWProfileHierarchyInfoClass::WWProfileHierarchyInfoClass( const char * name, WWProfileHierarchyInfoClass * parent ) : Name( name ), TotalCalls( 0 ), TotalTime( 0 ), @@ -1104,7 +1104,7 @@ WWProfileHierachyInfoClass::WWProfileHierachyInfoClass( const char * name, WWPro } /*********************************************************************************************** - * WWProfileHierachyNodeClass::~WWProfileHierachyNodeClass -- Destructor * + * WWProfileHierarchyNodeClass::~WWProfileHierarchyNodeClass -- Destructor * * * * INPUT: * * * @@ -1115,7 +1115,7 @@ WWProfileHierachyInfoClass::WWProfileHierachyInfoClass( const char * name, WWPro * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -WWProfileHierachyInfoClass::~WWProfileHierachyInfoClass( void ) +WWProfileHierarchyInfoClass::~WWProfileHierarchyInfoClass( void ) { delete Child; delete Sibling; diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.h b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.h index ba76edea986..67bb3c832c7 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.h +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.h @@ -55,22 +55,22 @@ class FileClass; /* ** A node in the WWProfile Hierarchy Tree */ -class WWProfileHierachyNodeClass { +class WWProfileHierarchyNodeClass { public: - WWProfileHierachyNodeClass( const char * name, WWProfileHierachyNodeClass * parent ); - WWProfileHierachyNodeClass( unsigned id, WWProfileHierachyNodeClass * parent ); - ~WWProfileHierachyNodeClass( void ); + WWProfileHierarchyNodeClass( const char * name, WWProfileHierarchyNodeClass * parent ); + WWProfileHierarchyNodeClass( unsigned id, WWProfileHierarchyNodeClass * parent ); + ~WWProfileHierarchyNodeClass( void ); - WWProfileHierachyNodeClass * Get_Sub_Node( const char * name ); + WWProfileHierarchyNodeClass * Get_Sub_Node( const char * name ); - WWProfileHierachyNodeClass * Get_Parent( void ) { return Parent; } - WWProfileHierachyNodeClass * Get_Sibling( void ) { return Sibling; } - WWProfileHierachyNodeClass * Get_Child( void ) { return Child; } + WWProfileHierarchyNodeClass * Get_Parent( void ) { return Parent; } + WWProfileHierarchyNodeClass * Get_Sibling( void ) { return Sibling; } + WWProfileHierarchyNodeClass * Get_Child( void ) { return Child; } - void Set_Parent( WWProfileHierachyNodeClass *node ) { Parent=node; } - void Set_Sibling( WWProfileHierachyNodeClass *node ) { Sibling=node; } - void Set_Child( WWProfileHierachyNodeClass *node ) { Child=node; } + void Set_Parent( WWProfileHierarchyNodeClass *node ) { Parent=node; } + void Set_Sibling( WWProfileHierarchyNodeClass *node ) { Sibling=node; } + void Set_Child( WWProfileHierarchyNodeClass *node ) { Child=node; } void Reset( void ); void Call( void ); @@ -82,7 +82,7 @@ class WWProfileHierachyNodeClass { void Set_Total_Calls(int calls) { TotalCalls=calls; } void Set_Total_Time(float time) { TotalTime=time; } - WWProfileHierachyNodeClass* Clone_Hierarchy(WWProfileHierachyNodeClass* parent); + WWProfileHierarchyNodeClass* Clone_Hierarchy(WWProfileHierarchyNodeClass* parent); void Write_To_File(FileClass* file,int recursion); void Add_To_String_Compact(StringClass& string,int recursion); @@ -96,23 +96,23 @@ class WWProfileHierachyNodeClass { int RecursionCounter; unsigned ProfileStringID; - WWProfileHierachyNodeClass * Parent; - WWProfileHierachyNodeClass * Child; - WWProfileHierachyNodeClass * Sibling; + WWProfileHierarchyNodeClass * Parent; + WWProfileHierarchyNodeClass * Child; + WWProfileHierarchyNodeClass * Sibling; }; -class WWProfileHierachyInfoClass { +class WWProfileHierarchyInfoClass { public: - WWProfileHierachyInfoClass( const char * name, WWProfileHierachyInfoClass * parent ); - ~WWProfileHierachyInfoClass( void ); + WWProfileHierarchyInfoClass( const char * name, WWProfileHierarchyInfoClass * parent ); + ~WWProfileHierarchyInfoClass( void ); - WWProfileHierachyInfoClass * Get_Parent( void ) { return Parent; } - WWProfileHierachyInfoClass * Get_Sibling( void ) { return Sibling; } - WWProfileHierachyInfoClass * Get_Child( void ) { return Child; } + WWProfileHierarchyInfoClass * Get_Parent( void ) { return Parent; } + WWProfileHierarchyInfoClass * Get_Sibling( void ) { return Sibling; } + WWProfileHierarchyInfoClass * Get_Child( void ) { return Child; } - void Set_Parent( WWProfileHierachyInfoClass *node ) { Parent=node; } - void Set_Sibling( WWProfileHierachyInfoClass *node ) { Sibling=node; } - void Set_Child( WWProfileHierachyInfoClass *node ) { Child=node; } + void Set_Parent( WWProfileHierarchyInfoClass *node ) { Parent=node; } + void Set_Sibling( WWProfileHierarchyInfoClass *node ) { Sibling=node; } + void Set_Child( WWProfileHierarchyInfoClass *node ) { Child=node; } const char * Get_Name( void ) { return Name; } void Set_Name( const char* name ) { Name=name; } @@ -127,9 +127,9 @@ class WWProfileHierachyInfoClass { int TotalCalls; float TotalTime; - WWProfileHierachyInfoClass * Parent; - WWProfileHierachyInfoClass * Child; - WWProfileHierachyInfoClass * Sibling; + WWProfileHierarchyInfoClass * Parent; + WWProfileHierarchyInfoClass * Child; + WWProfileHierarchyInfoClass * Sibling; }; /* @@ -158,10 +158,10 @@ class WWProfileIterator float Get_Current_Parent_Total_Time( void ) { return CurrentParent->Get_Total_Time(); } protected: - WWProfileHierachyNodeClass * CurrentParent; - WWProfileHierachyNodeClass * CurrentChild; + WWProfileHierarchyNodeClass * CurrentParent; + WWProfileHierarchyNodeClass * CurrentChild; - WWProfileIterator( WWProfileHierachyNodeClass * start ); + WWProfileIterator( WWProfileHierarchyNodeClass * start ); friend class WWProfileManager; }; @@ -182,7 +182,7 @@ class WWProfileInOrderIterator float Get_Current_Total_Time( void ) { return CurrentNode->Get_Total_Time(); } protected: - WWProfileHierachyNodeClass * CurrentNode; + WWProfileHierarchyNodeClass * CurrentNode; WWProfileInOrderIterator( void ); friend class WWProfileManager; @@ -213,17 +213,17 @@ class WWProfileManager { static WWProfileInOrderIterator * Get_In_Order_Iterator( void ); static void Release_In_Order_Iterator( WWProfileInOrderIterator * iterator ); - static WWProfileHierachyNodeClass * Get_Root( void ) { return &Root; } + static WWProfileHierarchyNodeClass * Get_Root( void ) { return &Root; } static void Begin_Collecting(); static void End_Collecting(const char* filename); - static void Load_Profile_Log(const char* filename, WWProfileHierachyInfoClass**& array, unsigned& count); + static void Load_Profile_Log(const char* filename, WWProfileHierarchyInfoClass**& array, unsigned& count); private: - static WWProfileHierachyNodeClass Root; - static WWProfileHierachyNodeClass * CurrentNode; - static WWProfileHierachyNodeClass * CurrentRootNode; + static WWProfileHierarchyNodeClass Root; + static WWProfileHierarchyNodeClass * CurrentNode; + static WWProfileHierarchyNodeClass * CurrentRootNode; static int FrameCounter; static __int64 ResetTime; static bool IsProfileEnabled; diff --git a/Core/Tools/W3DView/ScreenCursor.cpp b/Core/Tools/W3DView/ScreenCursor.cpp index cc4d18f95ef..ac8323e67bd 100644 --- a/Core/Tools/W3DView/ScreenCursor.cpp +++ b/Core/Tools/W3DView/ScreenCursor.cpp @@ -227,7 +227,7 @@ ScreenCursorClass::On_Frame_Update (void) z_pos = 0; // - // Build the verticies from the position and extents + // Build the vertices from the position and extents // m_Verticies[0].X = x_pos; m_Verticies[0].Y = y_pos; diff --git a/Core/Tools/WW3D/max2w3d/MeshDeform.cpp b/Core/Tools/WW3D/max2w3d/MeshDeform.cpp index f9f7db87d38..4cfb0d1f56a 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeform.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeform.cpp @@ -499,7 +499,7 @@ MeshDeformClass::GetSubObjectCenters Matrix3 transform = node->GetObjectTM (time_val); Box3 box; - // Loop through all the selected verticies and create a bounding + // Loop through all the selected vertices and create a bounding // box which we can use to determine the selection center. for (int index = 0; index < mesh->getNumVerts (); index++ ) { if (sel_array[index]) { diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp index 52dc735ff6a..01b79720faa 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp @@ -277,7 +277,7 @@ MeshDeformSaveClass::Export_Keyframes if (retval) { // - // Loop through all the verticies in this keyframe + // Loop through all the vertices in this keyframe // int data_count = set_save.Get_Deform_Data_Count (keyframe_index); for (int index = 0; (index < data_count) && retval; index ++) { diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp index 165555a5dcd..66f7017bfc7 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp @@ -94,14 +94,14 @@ MeshDeformSetClass::Set_Vertex_Position const Point3 & value ) { - DEFORM_LIST &verticies = m_KeyFrames[m_CurrentKeyFrame]->verticies; + DEFORM_LIST &vertices = m_KeyFrames[m_CurrentKeyFrame]->vertices; BitArray &affected_verts = m_KeyFrames[m_CurrentKeyFrame]->affected_verts; // // Set the vert's position // m_pMesh->verts[index] = value; - verticies.Add (VERT_INFO (index, value)); + vertices.Add (VERT_INFO (index, value)); // // Make sure we remember that this vert is affected @@ -181,7 +181,7 @@ MeshDeformSetClass::Update_Set_Members (void) void MeshDeformSetClass::Collapse_Keyframe_Data (int keyframe) { - DEFORM_LIST &verticies = m_KeyFrames[keyframe]->verticies; + DEFORM_LIST &vertices = m_KeyFrames[keyframe]->vertices; DEFORM_LIST &colors = m_KeyFrames[keyframe]->colors; BitArray &affected_verts = m_KeyFrames[keyframe]->affected_verts; BitArray &affected_colors = m_KeyFrames[keyframe]->affected_colors; @@ -189,15 +189,15 @@ MeshDeformSetClass::Collapse_Keyframe_Data (int keyframe) // // Collapse the vertex position data // - for (int index = 0; index < verticies.Count (); index ++) { - VERT_INFO &info = verticies[index]; + for (int index = 0; index < vertices.Count (); index ++) { + VERT_INFO &info = vertices[index]; // // If this vertex is unchanged, then remove it // from the list. // if (m_pVertexArray[index] == info.value) { - verticies.Delete (index); + vertices.Delete (index); index --; } else { affected_verts.Set (info.index, 1); @@ -217,7 +217,7 @@ MeshDeformSetClass::Collapse_Keyframe_Data (int keyframe) // from the list. // if (m_pVertexColors[index] == info.value) { - verticies.Delete (index); + vertices.Delete (index); index --; } else { affected_colors.Set (info.index, 1); @@ -237,14 +237,14 @@ MeshDeformSetClass::Collapse_Keyframe_Data (int keyframe) void MeshDeformSetClass::Reset_Key_Frame_Verts (int keyframe) { - DEFORM_LIST &verticies = m_KeyFrames[keyframe]->verticies; + DEFORM_LIST &vertices = m_KeyFrames[keyframe]->vertices; BitArray &affected_verts = m_KeyFrames[keyframe]->affected_verts; // // Reset all data for this keyframe // affected_verts.ClearAll (); - verticies.Delete_All (); + vertices.Delete_All (); // // Regenerate the list of set members @@ -287,7 +287,7 @@ MeshDeformSetClass::Reset_Key_Frame_Colors (int keyframe) void MeshDeformSetClass::Update_Current_Data (void) { - DEFORM_LIST &verticies = m_KeyFrames[m_CurrentKeyFrame]->verticies; + DEFORM_LIST &vertices = m_KeyFrames[m_CurrentKeyFrame]->vertices; DEFORM_LIST &colors = m_KeyFrames[m_CurrentKeyFrame]->colors; BitArray &affected_verts = m_KeyFrames[m_CurrentKeyFrame]->affected_verts; BitArray &affected_colors = m_KeyFrames[m_CurrentKeyFrame]->affected_colors; @@ -297,7 +297,7 @@ MeshDeformSetClass::Update_Current_Data (void) // affected_verts.ClearAll (); affected_colors.ClearAll (); - verticies.Delete_All (); + vertices.Delete_All (); colors.Delete_All (); // @@ -319,7 +319,7 @@ MeshDeformSetClass::Update_Current_Data (void) // Record this vertex's position in our lists // affected_verts.Set (index, 1); - verticies.Add (VERT_INFO (index, m_pMesh->verts[index])); + vertices.Add (VERT_INFO (index, m_pMesh->verts[index])); } } @@ -350,7 +350,7 @@ MeshDeformSetClass::Update_Current_Data (void) } // - // Rebuild the list of verticies this 'set' affects + // Rebuild the list of vertices this 'set' affects // Update_Set_Members (); @@ -373,17 +373,17 @@ MeshDeformSetClass::Update_Current_Data (void) void MeshDeformSetClass::Update_Key_Frame (int key_frame) { - DEFORM_LIST &verticies = m_KeyFrames[key_frame]->verticies; + DEFORM_LIST &vertices = m_KeyFrames[key_frame]->vertices; DEFORM_LIST &colors = m_KeyFrames[key_frame]->colors; BitArray &affected_verts = m_KeyFrames[key_frame]->affected_verts; BitArray &affected_colors = m_KeyFrames[key_frame]->affected_colors; if ((key_frame == m_CurrentKeyFrame) || - (verticies.Count () > 0) || + (vertices.Count () > 0) || (colors.Count () > 0)) { // Clear all entries from this keyframe - verticies.Delete_All (); + vertices.Delete_All (); colors.Delete_All (); // @@ -391,7 +391,7 @@ MeshDeformSetClass::Update_Key_Frame (int key_frame) // for (int vert = 0; vert < m_pMesh->numVerts; vert ++) { if (affected_verts[vert]) { - verticies.Add (VERT_INFO (vert, m_pMesh->verts[vert])); + vertices.Add (VERT_INFO (vert, m_pMesh->verts[vert])); } } @@ -504,7 +504,7 @@ MeshDeformSetClass::Resize_Vertex_Array (int count, int color_count) { if (count != m_VertexCount) { - // Allocate a new array of verticies + // Allocate a new array of vertices Point3 *vertex_array = new Point3[count]; Point3 *opstart_array = new Point3[count]; @@ -588,7 +588,7 @@ MeshDeformSetClass::Determine_Interpolation_Indicies // Determine where we should start interpolation // for (int index = 0; index <= key_frame; index ++) { - if (position && m_KeyFrames[index]->verticies.Count () > 0) { + if (position && m_KeyFrames[index]->vertices.Count () > 0) { from = index; } else if (!position && m_KeyFrames[index]->colors.Count () > 0) { from = index; @@ -599,7 +599,7 @@ MeshDeformSetClass::Determine_Interpolation_Indicies // Determine where we should end interpolation // for (index = to; index < MAX_DEFORM_KEY_FRAMES; index ++) { - if (position && m_KeyFrames[index]->verticies.Count () > 0) { + if (position && m_KeyFrames[index]->vertices.Count () > 0) { to = index; break; } else if (!position && m_KeyFrames[index]->colors.Count () > 0) { @@ -678,7 +678,7 @@ MeshDeformSetClass::Apply_Position_Changes // Find the vertex value in the 'from' key frame and set the // triangle object's vertex to be this value (we will interplate from it). // - DEFORM_LIST &vert_from = m_KeyFrames[from]->verticies; + DEFORM_LIST &vert_from = m_KeyFrames[from]->vertices; for (int index = 0; index < vert_from.Count (); index ++) { VERT_INFO &info = vert_from[index]; if (info.index == vert) { @@ -700,7 +700,7 @@ MeshDeformSetClass::Apply_Position_Changes // Find the vertex value in the 'to' key frame and interpolate // this value from the triangle object's current vertex value. // - DEFORM_LIST &vert_to = m_KeyFrames[to]->verticies; + DEFORM_LIST &vert_to = m_KeyFrames[to]->vertices; for (int index = 0; index < vert_to.Count (); index ++) { VERT_INFO &info = vert_to[index]; if (info.index == vert) { @@ -909,7 +909,7 @@ MeshDeformSetClass::Update_Mesh (TriObject &tri_obj) } // - // Loop through all the verticies and interpolate their + // Loop through all the vertices and interpolate their // positions and colors based on the current 'deformation state'. // for (UINT vert = 0; vert < (UINT)m_pMesh->numVerts; vert ++) { @@ -940,19 +940,19 @@ MeshDeformSetClass::Update_Mesh (TriObject &tri_obj) for (int key_frame = 0; key_frame < m_KeyFrames.Count (); key_frame ++) { // - // Update the verticies + // Update the vertices // int from = 0; int to = 0; float state = 0; Determine_Interpolation_Indicies (key_frame, true, from, to, state); - DEFORM_LIST &vert_to = m_KeyFrames[to]->verticies; + DEFORM_LIST &vert_to = m_KeyFrames[to]->vertices; if (from <= m_CurrentKeyFrame) { if (from >= 0) { - DEFORM_LIST &vert_from = m_KeyFrames[from]->verticies; + DEFORM_LIST &vert_from = m_KeyFrames[from]->vertices; for (int index = 0; index < vert_from.Count (); index ++) { VERT_INFO &info = vert_from[index]; tri_obj.mesh.verts[info.index] = info.value; @@ -1100,7 +1100,7 @@ MeshDeformSetClass::Update_Members (DEFORM_CHANNELS flags) // // Finally, add this vertex to the list of all - // verticies affected by this set. + // vertices affected by this set. // m_SetMembers.Set (vert, 1); } @@ -1249,7 +1249,7 @@ MeshDeformSetClass::Save for (int key_frame = 0; key_frame < key_frames; key_frame ++) { // - // Loop through all the verticies and see if this keyframe + // Loop through all the vertices and see if this keyframe // modifies any of them // bool verts_affected = false; @@ -1345,7 +1345,7 @@ MeshDeformSetClass::Save (ISave *save_obj) DeformChunkKeyframeInfo keyframe_info = { 0 }; keyframe_info.DeformPercent = state_inc * (index + 1); - keyframe_info.VertexCount = key_frame.verticies.Count (); + keyframe_info.VertexCount = key_frame.vertices.Count (); keyframe_info.ColorCount = key_frame.colors.Count (); // @@ -1356,13 +1356,13 @@ MeshDeformSetClass::Save (ISave *save_obj) //save_obj->EndChunk (); // - // Loop through the verticies and save their position + // Loop through the vertices and save their position // for ( unsigned int pos_index = 0; (pos_index < keyframe_info.VertexCount) && (result == IO_OK); pos_index ++) { - VERT_INFO &deform_data = key_frame.verticies[pos_index]; + VERT_INFO &deform_data = key_frame.vertices[pos_index]; DeformDataChunk data; data.VertexIndex = deform_data.index; @@ -1378,7 +1378,7 @@ MeshDeformSetClass::Save (ISave *save_obj) } // - // Loop through the verticies and save their color + // Loop through the vertices and save their color // for ( unsigned int color_index = 0; (color_index < keyframe_info.ColorCount) && (result == IO_OK); @@ -1485,7 +1485,7 @@ MeshDeformSetClass::Load (ILoad *load_obj) DeformDataChunk data; result = load_obj->Read (&data, sizeof (data), &bytes); if (result == IO_OK) { - key_frame.verticies.Add (VERT_INFO (data.VertexIndex, data.Value, data.ColorIndex)); + key_frame.vertices.Add (VERT_INFO (data.VertexIndex, data.Value, data.ColorIndex)); key_frame.affected_verts.Set (data.VertexIndex, 1); m_SetMembers.Set (data.VertexIndex, 1); } diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h index 5e5bc62342e..7e5dc5cbbde 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h @@ -114,9 +114,9 @@ class MeshDeformSetClass // Information bool Is_Empty (void) const; - int Get_Vertex_Count (int keyframe) const { return m_KeyFrames[keyframe]->verticies.Count (); } + int Get_Vertex_Count (int keyframe) const { return m_KeyFrames[keyframe]->vertices.Count (); } int Get_Color_Count (int keyframe) const { return m_KeyFrames[keyframe]->colors.Count (); } - const VERT_INFO & Get_Vertex_Data (int keyframe, int index) const { return m_KeyFrames[keyframe]->verticies[index]; } + const VERT_INFO & Get_Vertex_Data (int keyframe, int index) const { return m_KeyFrames[keyframe]->vertices[index]; } const VERT_INFO & Get_Color_Data (int keyframe, int index) const { return m_KeyFrames[keyframe]->colors[index]; } // Persistent storage @@ -150,7 +150,7 @@ class MeshDeformSetClass ////////////////////////////////////////////////////////////////////// typedef struct { - DEFORM_LIST verticies; + DEFORM_LIST vertices; DEFORM_LIST colors; BitArray affected_verts; BitArray affected_colors; @@ -171,7 +171,7 @@ class MeshDeformSetClass float m_State; bool m_bAutoApply; - // Array representing which verticies are part of the set + // Array representing which vertices are part of the set BitArray m_SetMembers; // List of key frames diff --git a/Core/Tools/WW3D/max2w3d/colboxsave.cpp b/Core/Tools/WW3D/max2w3d/colboxsave.cpp index de09cf1b41f..918933e37c1 100644 --- a/Core/Tools/WW3D/max2w3d/colboxsave.cpp +++ b/Core/Tools/WW3D/max2w3d/colboxsave.cpp @@ -83,19 +83,19 @@ CollisionBoxSaveClass::CollisionBoxSaveClass BoxData.Attributes |= W3D_BOX_ATTRIBUTE_ORIENTED; } if (Is_Physical_Collision(inode)) { - BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL; + BoxData.Attributes |= W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL; } if (Is_Projectile_Collision(inode)) { - BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE; + BoxData.Attributes |= W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE; } if (Is_Vis_Collision(inode)) { - BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS; + BoxData.Attributes |= W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS; } if (Is_Camera_Collision(inode)) { - BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA; + BoxData.Attributes |= W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA; } if (Is_Vehicle_Collision(inode)) { - BoxData.Attributes |= W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE; + BoxData.Attributes |= W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE; } BoxData.Color.R = GetRValue(wirecolor); diff --git a/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp index b3042a8ce5e..d3a521c42be 100644 --- a/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp +++ b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp @@ -1125,7 +1125,7 @@ Point3 MeshGeometryExportTaskClass::Get_Shared_Vertex_Normal(const Point3 & worl if ((face_smgroup & smgroup) || (face_smgroup == smgroup)) { /* - ** Find out if any of the verticies of this face share the + ** Find out if any of the vertices of this face share the ** same space as the vertex we are looking for. */ bool found = false; diff --git a/Core/Tools/WW3D/max2w3d/maxworldinfo.cpp b/Core/Tools/WW3D/max2w3d/maxworldinfo.cpp index 095503f0980..651e660b6cb 100644 --- a/Core/Tools/WW3D/max2w3d/maxworldinfo.cpp +++ b/Core/Tools/WW3D/max2w3d/maxworldinfo.cpp @@ -42,7 +42,7 @@ /* ** Get_Shared_Vertex_Normal ** Loops through all the other meshes in the world and builds a vertex normal for -** the verticies that share the same space and are part of the same smoothing group. +** the vertices that share the same space and are part of the same smoothing group. */ Vector3 MaxWorldInfoClass::Get_Shared_Vertex_Normal (Vector3 pos, int smgroup) { @@ -51,7 +51,7 @@ Vector3 MaxWorldInfoClass::Get_Shared_Vertex_Normal (Vector3 pos, int smgroup) // // Loop through all the meshes in the world and see which ones contain - // verticies that share the same space and are part of the same smoothing group. + // vertices that share the same space and are part of the same smoothing group. // for(unsigned int index = 0; index < MeshList.Count(); index ++) { GeometryExportTaskClass * task = MeshList[index]; diff --git a/Core/Tools/WW3D/max2w3d/w3d_file.h b/Core/Tools/WW3D/max2w3d/w3d_file.h index 5ce8ac79cf2..034da603f34 100644 --- a/Core/Tools/WW3D/max2w3d/w3d_file.h +++ b/Core/Tools/WW3D/max2w3d/w3d_file.h @@ -1985,11 +1985,11 @@ struct W3dHLodSubObjectStruct #define W3D_BOX_ATTRIBUTE_ALIGNED 0x00000002 #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_MASK 0x00000FF0 // mask for the collision type bits #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_SHIFT 4 // shifting to get to the collision type bits -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh struct W3dBoxStruct { diff --git a/Generals/Code/GameEngine/Include/Common/StackDump.h b/Generals/Code/GameEngine/Include/Common/StackDump.h index 24983d70d15..944c029471c 100644 --- a/Generals/Code/GameEngine/Include/Common/StackDump.h +++ b/Generals/Code/GameEngine/Include/Common/StackDump.h @@ -24,7 +24,7 @@ #pragma once -#ifndef IG_DEGBUG_STACKTRACE +#ifndef IG_DEBUG_STACKTRACE #define IG_DEBUG_STACKTRACE 1 #endif diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index c95f8a332bf..df83634f15e 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -206,7 +206,7 @@ enum GUICommandType CPP_11(: Int) GUI_COMMAND_NUM_COMMANDS }; -#ifdef DEFINE_GUI_COMMMAND_NAMES +#ifdef DEFINE_GUI_COMMAND_NAMES static const char *const TheGuiCommandNames[] = { "NONE", diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/Generals/Code/GameEngine/Include/GameClient/ControlBarScheme.h index 7c4852c2626..b564a27563a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBarScheme.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBarScheme.h @@ -270,7 +270,7 @@ class ControlBarSchemeManager private: ControlBarScheme *m_currentScheme; ///< the current scheme that everythign uses - Coord2D m_multiplyer; + Coord2D m_multiplier; typedef std::list< ControlBarScheme* > ControlBarSchemeList; ///< list of control bar schemes ControlBarSchemeList m_schemeList; diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h index f9d27b3593c..a22648a8ed4 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h @@ -157,7 +157,7 @@ enum WIN_STATUS_NONE = 0x00000000, // No status bits set at all WIN_STATUS_ACTIVE = 0x00000001, // At the top of the window list WIN_STATUS_TOGGLE = 0x00000002, // If set, click to toggle - WIN_STATUS_DRAGABLE = 0x00000004, // Window can be dragged + WIN_STATUS_DRAGGABLE = 0x00000004, // Window can be dragged WIN_STATUS_ENABLED = 0x00000008, // Window can receive input WIN_STATUS_HIDDEN = 0x00000010, // Window is hidden, no input WIN_STATUS_ABOVE = 0x00000020, // Window is always above others diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index ce043f4a3b7..fdff9dbaf48 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -668,7 +668,7 @@ class GameWindowTransitionsHandler: public SubsystemInterface static const FieldParse m_gameWindowTransitionsFieldParseTable[]; ///< the parse table static void parseWindow( INI* ini, void *instance, void *store, const void *userData ); - void setGroup(AsciiString groupName, Bool immidiate = FALSE); // THis will be the next group to fire off. + void setGroup(AsciiString groupName, Bool immediate = FALSE); // THis will be the next group to fire off. void reverse( AsciiString groupName );// reverse the animations for the current group. void remove( AsciiString groupName, Bool skipPending = FALSE );// remove the animation from the current or pending groups. TransitionGroup *getNewGroup( AsciiString name ); diff --git a/Generals/Code/GameEngine/Include/GameClient/IMEManager.h b/Generals/Code/GameEngine/Include/GameClient/IMEManager.h index 7b245c5e845..4b304ed2953 100644 --- a/Generals/Code/GameEngine/Include/GameClient/IMEManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/IMEManager.h @@ -75,7 +75,7 @@ class IMEManagerInterface : public SubsystemInterface virtual ~IMEManagerInterface() {}; virtual void attach( GameWindow *window ) = 0; ///< attach IME to specified window - virtual void detatch( void ) = 0; ///< detatch IME from current window + virtual void detach( void ) = 0; ///< detach IME from current window virtual void enable( void ) = 0; ///< Enable IME virtual void disable( void ) = 0; ///< Disable IME virtual Bool isEnabled( void ) = 0; ///< Is IME enabled diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index a9bd8b2cd77..98df973bce0 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -812,7 +812,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Bool blocked ); ///< Work backwards from goal cell to construct final path Path *buildGroundPath( Bool isCrusher,const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Int pathDiameter ); ///< Work backwards from goal cell to construct final path - Path *buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell); ///< Work backwards from goal cell to construct final path + Path *buildHierarchicalPath( const Coord3D *fromPos, PathfindCell *goalCell); ///< Work backwards from goal cell to construct final path void prependCells( Path *path, const Coord3D *fromPos, PathfindCell *goalCell, Bool center ); ///< Add pathfind cells to a path. diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index f29c3d7730b..0e3307df26a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -281,8 +281,8 @@ class RailroadBehavior : public PhysicsBehavior Bool m_waitingInWings; /// I have not entered the real track yet, so leave me alone Bool m_endOfLine; /// I have reached the end of a non looping track Bool m_isLocomotive; ///< Am I a locomotive, - Bool m_isLeadCarraige; ///< Am the carraige in front, - Int m_wantsToBeLeadCarraige; ///< Am the carraige in front, + Bool m_isLeadCarriage; ///< Am the carraige in front, + Int m_wantsToBeLeadCarriage; ///< Am the carraige in front, Bool m_disembark; ///< If I wait at a station, I should also evacuate everybody when I get theres Bool m_inTunnel; ///< Am I in a tunnel, so I wil not snap to ground height, until the next waypoint, // i.e. do I provide the movement and scheduling AI for m_trailerID diff --git a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp index 8b0ebc7556b..21eafbbd786 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Credits.cpp @@ -193,16 +193,16 @@ void CreditsManager::update( void ) Int lastHeight = 0; Int start = m_scrollDown? 0:TheDisplay->getHeight(); Int end =m_scrollDown? TheDisplay->getHeight():0; - Int offsetStartMultiplyer = m_scrollDown? -1:0; // if we're scrolling from the top, we need to subtract the height - Int offsetEndMultiplyer = m_scrollDown? 0:1; - Int directionMultiplyer = m_scrollDown? 1:-1; + Int offsetStartMultiplier = m_scrollDown? -1:0; // if we're scrolling from the top, we need to subtract the height + Int offsetEndMultiplier = m_scrollDown? 0:1; + Int directionMultiplier = m_scrollDown? 1:-1; CreditsLineList::iterator drawIt = m_displayedCreditLineList.begin(); while (drawIt != m_displayedCreditLineList.end()) { CreditsLine *cLine = *drawIt; - y = cLine->m_pos.y = cLine->m_pos.y + (m_scrollRate * directionMultiplyer); + y = cLine->m_pos.y = cLine->m_pos.y + (m_scrollRate * directionMultiplier); lastHeight = cLine->m_height; - yTest = y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetEndMultiplyer); + yTest = y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetEndMultiplier); if(((m_scrollDown && (yTest > end)) || (!m_scrollDown && (yTest < end)))) { TheDisplayStringManager->freeDisplayString(cLine->m_displayString); @@ -215,7 +215,7 @@ void CreditsManager::update( void ) drawIt++; } - y= y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetStartMultiplyer); + y= y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetStartMultiplier); // is it time to add a new string? if(!((m_scrollDown && (yTest >= start)) || (!m_scrollDown && (yTest <= start)))) @@ -247,7 +247,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -268,7 +268,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -289,7 +289,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -310,7 +310,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } if(TheGlobalLanguageData && !cLine->m_secondText.isEmpty()) @@ -325,7 +325,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_secondDisplayString = ds; } @@ -334,7 +334,7 @@ void CreditsManager::update( void ) case CREDIT_STYLE_BLANK: { cLine->m_height = m_normalFontHeight; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); } break; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 1a15cb86512..b03d47f7774 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -30,7 +30,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_GUI_COMMMAND_NAMES +#define DEFINE_GUI_COMMAND_NAMES #define DEFINE_COMMAND_OPTION_NAMES #define DEFINE_WEAPONSLOTTYPE_NAMES #define DEFINE_RADIUSCURSOR_NAMES diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 634357b8624..e96ec55f7aa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -807,7 +807,7 @@ ControlBarSchemeManager::ControlBarSchemeManager( void ) { m_currentScheme = nullptr; m_schemeList.clear(); - m_multiplyer.x = m_multiplyer.y = 1; + m_multiplier.x = m_multiplier.y = 1; } // @@ -1026,9 +1026,9 @@ void ControlBarSchemeManager::setControlBarScheme(AsciiString schemeName) ControlBarScheme *tempScheme = findControlBarScheme( schemeName ); if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else @@ -1053,13 +1053,13 @@ void ControlBarSchemeManager::update( void ) void ControlBarSchemeManager::drawForeground( ICoord2D offset ) { if(m_currentScheme) - m_currentScheme->drawForeground( m_multiplyer, offset); + m_currentScheme->drawForeground( m_multiplier, offset); } //----------------------------------------------------------------------------- void ControlBarSchemeManager::drawBackground( ICoord2D offset ) { if(m_currentScheme) - m_currentScheme->drawBackground( m_multiplyer, offset ); + m_currentScheme->drawBackground( m_multiplier, offset ); } //----------------------------------------------------------------------------- @@ -1108,9 +1108,9 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else @@ -1176,9 +1176,9 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index bc466edec30..aaf601cff14 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -1468,7 +1468,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); { // we pinged on the last frame someone was there - i.e. game ended in a disconnect. // check if we were to blame. - if (TheNetwork->getPingsRecieved() < max(1, TheNetwork->getPingsSent()/2)) /// @todo: what's a good percent of pings to have gotten? + if (TheNetwork->getPingsReceived() < max(1, TheNetwork->getPingsSent()/2)) /// @todo: what's a good percent of pings to have gotten? { DEBUG_LOG(("We were to blame. Leaving gameEndedInDisconnect = true")); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index b278e8599cc..3ed3bcb551a 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -386,7 +386,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, e->conCharPos = 0; if(TheIMEManager && TheIMEManager->isAttachedTo(window)) TheIMEManager->attach(nullptr); - //TheIMEManager->detatch(); + //TheIMEManager->detach(); } else { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 3f1f07a8766..93b13ff6f91 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -917,7 +917,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms BitClear( m_grabWindow->m_status, WIN_STATUS_ACTIVE ); if( m_grabWindow->winPointInWindow( mousePos->x, mousePos->y ) ) winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGABLE )) + else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE )) { winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); } @@ -932,7 +932,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms case GWM_LEFT_DRAG: { - if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGABLE ) ) + if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE ) ) { ICoord2D *mouseDelta = (ICoord2D *)data; dx = mouseDelta->x; @@ -2266,7 +2266,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, // create the slider thumb button WinInstanceData buttonInstData; - UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE; + UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE; buttonInstData.init(); @@ -3672,7 +3672,7 @@ Bool GameWindowManager::initTestGUI( void ) // UnsignedByte alpha = 200; GameWindow *window; - UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE | WIN_STATUS_IMAGE; + UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE | WIN_STATUS_IMAGE; WinInstanceData instData; // make some windows inside each other in the upper left @@ -3737,7 +3737,7 @@ Bool GameWindowManager::initTestGUI( void ) &instData, nullptr, TRUE ); // make window to hold radio buttons - window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE, 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index f9913bfed2a..7040f8390b2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -449,11 +449,11 @@ void GameWindowTransitionsHandler::draw( void ) m_secondaryDrawGroup->draw(); } -void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immidiate ) +void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immediate ) { - if(groupName.isEmpty() && immidiate) + if(groupName.isEmpty() && immediate) m_currentGroup = nullptr; - if(immidiate && m_currentGroup) + if(immediate && m_currentGroup) { m_currentGroup->skip(); m_currentGroup = findGroup(groupName); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index 565b55f54e0..8f21a0884bf 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -97,7 +97,7 @@ class IMEManager : public IMEManagerInterface virtual void update( void ); virtual void attach( GameWindow *window ); ///< attach IME to specified window - virtual void detatch( void ); ///< detatch IME from current window + virtual void detach( void ); ///< detach IME from current window virtual void enable( void ); ///< Enable IME virtual void disable( void ); ///< Disable IME virtual Bool isEnabled( void ); ///< Is IME enabled @@ -539,7 +539,7 @@ IMEManager::~IMEManager() delete [] m_candidateString; - detatch(); + detach(); ImmAssociateContext( ApplicationHWnd, m_oldContext ); ImmReleaseContext( ApplicationHWnd, m_oldContext ); if ( m_context ) @@ -604,7 +604,7 @@ void IMEManager::init( void ) m_candidateTextArea->winSetUserData( TheIMEManager ); } - detatch(); + detach(); enable(); } @@ -634,7 +634,7 @@ void IMEManager::attach( GameWindow *window ) { if ( m_window != window ) { - detatch(); + detach(); if ( m_disabled == 0 ) { ImmAssociateContext( ApplicationHWnd, m_context ); @@ -646,10 +646,10 @@ void IMEManager::attach( GameWindow *window ) } //============================================================================ -// IMEManager::detatch +// IMEManager::detach //============================================================================ -void IMEManager::detatch( void ) +void IMEManager::detach( void ) { //ImmAssociateContext( ApplicationHWnd, nullptr ); m_window = nullptr; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index f251c55fc9d..b59692c25ae 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -196,7 +196,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) enum{ STATE_BEGIN = 250, STATE_SHOW_LOCATION = 251, - STATE_BEGIN_BREIFING = 255, + STATE_BEGIN_BRIEFING = 255, // STATE_BEGIN_ANIMATING_TEXT = 250, STATE_SHOW_CAMEO_1 = 434, STATE_BEGIN_ANIMATING_TEXT = 356, @@ -212,7 +212,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) if(frame < STATE_BEGIN || frame > STATE_END) return; - if( frame == STATE_BEGIN_BREIFING) + if( frame == STATE_BEGIN_BRIEFING) { // add sound support here TheAudio->friend_forcePlayAudioEventRTS(&TheCampaignManager->getCurrentMission()->m_briefingVoice); @@ -278,9 +278,9 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) STATE_BEGIN = 275, STATE_BEGIN_ANIM = 290, STATE_ANIM_CAMEO1 = 300, - STATE_ANIM_CAMEO1_TRASITION_CAMEO2 = 350, + STATE_ANIM_CAMEO1_TRANSITION_CAMEO2 = 350, STATE_ANIM_CAMEO2 = 400, - STATE_ANIM_CAMEO2_TRASITION_CAMEO3 = 450, + STATE_ANIM_CAMEO2_TRANSITION_CAMEO3 = 450, STATE_ANIM_CAMEO3 = 500, STATED_END_ANIM = 550, STATE_END = 800 @@ -300,7 +300,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) GadgetStaticTextSetText(m_cameoText, TheGameText->fetch(TheCampaignManager->getCurrentMission()->m_cameoImageName[0])); //save of positions } - else if( frame == STATE_ANIM_CAMEO1_TRASITION_CAMEO2) + else if( frame == STATE_ANIM_CAMEO1_TRANSITION_CAMEO2) { m_cameoWindow1->winEnable(FALSE); GadgetStaticTextSetText(m_cameoText, UnicodeString::TheEmptyString); @@ -314,11 +314,11 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) endPos.y = startPos.y; } - else if( frame > STATE_ANIM_CAMEO1_TRASITION_CAMEO2 && frame < STATE_ANIM_CAMEO2) + else if( frame > STATE_ANIM_CAMEO1_TRANSITION_CAMEO2 && frame < STATE_ANIM_CAMEO2) { //extrapolate between start and end pos - Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO1_TRASITION_CAMEO2)) / (STATE_ANIM_CAMEO2 - STATE_ANIM_CAMEO1_TRASITION_CAMEO2); + Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO1_TRANSITION_CAMEO2)) / (STATE_ANIM_CAMEO2 - STATE_ANIM_CAMEO1_TRANSITION_CAMEO2); m_cameoFrame->winSetPosition(startPos.x + (endPos.x - startPos.x) * percent, endPos.y); } else if( frame == STATE_ANIM_CAMEO2 ) @@ -327,7 +327,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) m_cameoFrame->winSetPosition(endPos.x, endPos.y); GadgetStaticTextSetText(m_cameoText, TheGameText->fetch(TheCampaignManager->getCurrentMission()->m_cameoImageName[1])); } - else if( frame == STATE_ANIM_CAMEO2_TRASITION_CAMEO3) + else if( frame == STATE_ANIM_CAMEO2_TRANSITION_CAMEO3) { m_cameoWindow2->winEnable(FALSE); GadgetStaticTextSetText(m_cameoText, UnicodeString::TheEmptyString); @@ -341,11 +341,11 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) endPos.y = startPos.y; } - else if( frame > STATE_ANIM_CAMEO2_TRASITION_CAMEO3 && frame < STATE_ANIM_CAMEO3) + else if( frame > STATE_ANIM_CAMEO2_TRANSITION_CAMEO3 && frame < STATE_ANIM_CAMEO3) { //extrapolate between start and end pos - Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO2_TRASITION_CAMEO3)) / (STATE_ANIM_CAMEO3 - STATE_ANIM_CAMEO2_TRASITION_CAMEO3); + Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO2_TRANSITION_CAMEO3)) / (STATE_ANIM_CAMEO3 - STATE_ANIM_CAMEO2_TRANSITION_CAMEO3); m_cameoFrame->winSetPosition(startPos.x + (endPos.x - startPos.x) * percent, endPos.y); } else if( frame == STATE_ANIM_CAMEO3 ) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index f5262b666ef..bf79ec1735d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -161,7 +161,7 @@ void Shell::reset( void ) { if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // pop all screens while( m_screenCount ) @@ -310,7 +310,7 @@ void Shell::hide( Bool hide ) m_screenStack[ i ]->hide( hide ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -374,7 +374,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) } // if (TheIMEManager) -// TheIMEManager->detatch(); +// TheIMEManager->detach(); } @@ -414,7 +414,7 @@ void Shell::pop( void ) screen->runShutdown( &immediatePop ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -452,7 +452,7 @@ void Shell::popImmediate( void ) doPop( FALSE ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -586,7 +586,7 @@ void Shell::hideShell( void ) } if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // Mark that the shell is no longer up. m_isShellActive = FALSE; @@ -669,7 +669,7 @@ void Shell::doPush( AsciiString layoutFile ) linkScreen( newScreen ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // run the init function automatically newScreen->runInit( nullptr ); @@ -709,7 +709,7 @@ void Shell::doPop( Bool impendingPush ) } if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index 48fcba3564a..14046b09523 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -4167,9 +4167,9 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) disableTooltipsUntil(messageTimeout); // calculate where this screen position should be since the position being passed in is based off 8x6 - Coord2D multiplyer; - multiplyer.x = TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; - multiplyer.y = TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; + Coord2D multiplier; + multiplier.x = TheDisplay->getWidth() / (Real)DEFAULT_DISPLAY_WIDTH; + multiplier.y = TheDisplay->getHeight() / (Real)DEFAULT_DISPLAY_HEIGHT; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; @@ -4178,8 +4178,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) m_militarySubtitle->blockDrawn = TRUE; m_militarySubtitle->blockBeginFrame = currLogicFrame; m_militarySubtitle->lifetime = messageTimeout; - m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = m_militaryCaptionPosition.x * multiplyer.x; - m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = m_militaryCaptionPosition.y * multiplyer.y; + m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = m_militaryCaptionPosition.x * multiplier.x; + m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = m_militaryCaptionPosition.y * multiplier.y; m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * m_militaryCaptionDelayMS)/1000.0f); m_militarySubtitle->index = 0; for (int i = 1; i < MAX_SUBTITLE_LINES; i ++) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index dcd1c7069a0..c54bcb0829d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -6175,9 +6175,9 @@ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, Pathfi /** * Work backwards from goal cell to construct final path. */ -Path *Pathfinder::buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) +Path *Pathfinder::buildHierarchicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == nullptr") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierarchicalPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -7101,7 +7101,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_isTunneling = false; // construct and return path - Path *path = buildHierachicalPath( from, goalCell ); + Path *path = buildHierarchicalPath( from, goalCell ); #if defined(RTS_DEBUG) Bool show = TheGlobalData->m_debugAI==AI_DEBUG_PATHS; show |= (TheGlobalData->m_debugAI==AI_DEBUG_GROUND_PATHS); @@ -7290,7 +7290,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if (closestOK && closestCell) { m_isTunneling = false; // construct and return path - Path *path = buildHierachicalPath( from, closestCell ); + Path *path = buildHierarchicalPath( from, closestCell ); #if RETAIL_COMPATIBLE_PATHFINDING if (!s_useFixedPathfinding) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index a4f8dce7872..48c43912c05 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -150,8 +150,8 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_waitingInWings = TRUE; m_endOfLine = FALSE; m_isLocomotive = modData->m_isLocomotive; - m_isLeadCarraige = m_isLocomotive; // for now, I am the lead, only if I am the locomotive - m_wantsToBeLeadCarraige = FALSE; + m_isLeadCarriage = m_isLocomotive; // for now, I am the lead, only if I am the locomotive + m_wantsToBeLeadCarriage = FALSE; m_disembark = FALSE; m_inTunnel = FALSE; @@ -191,7 +191,7 @@ Bool RailroadBehavior::isRailroad() const return FALSE; if (m_endOfLine) return FALSE; - if (m_isLeadCarraige) + if (m_isLeadCarriage) return TRUE; if (m_trailerID==INVALID_ID) return TRUE; @@ -234,7 +234,7 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord { other->kill(); } - else if ( m_isLeadCarraige ) //yikes! I just coasted into some other carriage + else if ( m_isLeadCarriage ) //yikes! I just coasted into some other carriage { other->kill(); obj->kill();//and I am dead, too @@ -729,12 +729,12 @@ UpdateSleepTime RailroadBehavior::update( void ) } - if ( m_wantsToBeLeadCarraige > FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )//if this flag survived until now, I have lost my puller + if ( m_wantsToBeLeadCarriage > FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )//if this flag survived until now, I have lost my puller { - m_isLeadCarraige = TRUE; + m_isLeadCarriage = TRUE; } - if ( m_isLeadCarraige ) + if ( m_isLeadCarriage ) { if ( m_conductorState == COAST ) @@ -779,9 +779,9 @@ UpdateSleepTime RailroadBehavior::update( void ) TheGameLogic->destroyObject( getObject() ); } } - else if ( m_wantsToBeLeadCarraige <= FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )// if I am not the lead carriage + else if ( m_wantsToBeLeadCarriage <= FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )// if I am not the lead carriage { - m_wantsToBeLeadCarraige ++; // like every young carriage, I aspire to be the lead carriage some day + m_wantsToBeLeadCarriage ++; // like every young carriage, I aspire to be the lead carriage some day // unless getpulled() set this false, I will be on the next update! Joy! } @@ -1125,7 +1125,7 @@ void RailroadBehavior::hitchNewCarriagebyProximity( ObjectID locoID, TrainTrack void RailroadBehavior::getPulled( PullInfo *info ) { //ENFORCE MY STATUS AS A PULLEE, NOT A PULLER, and update my position, speed etc. - m_wantsToBeLeadCarraige = 0; + m_wantsToBeLeadCarriage = 0; if ( ! m_track ) { @@ -1521,11 +1521,11 @@ void RailroadBehavior::xfer( Xfer *xfer ) //Bool m_isLocomotive; ///< Am I a locomotive, xfer->xferBool( &m_isLocomotive ); - //Bool m_isLeadCarraige; ///< Am the carraige in front, - xfer->xferBool( &m_isLeadCarraige ); + //Bool m_isLeadCarriage; ///< Am the carraige in front, + xfer->xferBool( &m_isLeadCarriage ); - //Int m_wantsToBeLeadCarraige; ///< Am the carraige in front, - xfer->xferInt( &m_wantsToBeLeadCarraige ); + //Int m_wantsToBeLeadCarriage; ///< Am the carraige in front, + xfer->xferInt( &m_wantsToBeLeadCarriage ); //Bool m_disembark; ///< If I wait at a station, I should also evacuate everybody when I get theres xfer->xferBool( &m_disembark ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index ef09e5cfcbe..0551f708a57 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -2648,8 +2648,8 @@ Bool Weapon::isWithinTargetPitch(const Object *source, const Object *victim) con const Coord3D* src = source->getPosition(); const Coord3D* dst = victim->getPosition(); - const Real ACCCEPTABLE_DZ = 10.0f; - if (fabs(dst->z - src->z) < ACCCEPTABLE_DZ) + const Real ACCEPTABLE_DZ = 10.0f; + if (fabs(dst->z - src->z) < ACCEPTABLE_DZ) return true; // always good enough if dz is small, regardless of pitch Real minPitch, maxPitch; diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index e676f57490c..3f408d500d9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1991,7 +1991,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //UnsignedInt oldCRC = m_cachedCRCs[msg->getPlayerIndex()]; UnsignedInt newCRC = msg->getArgument(0)->integer; - //DEBUG_LOG(("Recieved CRC of %8.8X from %ls on frame %d", newCRC, + //DEBUG_LOG(("Received CRC of %8.8X from %ls on frame %d", newCRC, //thisPlayer->getPlayerDisplayName().str(), m_frame)); m_cachedCRCs[msg->getPlayerIndex()] = newCRC; // to mask problem: = (oldCRC < newCRC)?newCRC:oldCRC; } diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h index eeaedcb31e7..9fc81ad0889 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h @@ -73,7 +73,7 @@ class W3DAssetManager: public WW3DAssetManager void Report_Used_Font3DDatas( void ); void Report_Used_FontChars (void); - virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=nullptr, const char *newTexture=nullptr); + virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexture=nullptr, const char *newTexture=nullptr); ///Swaps the specified textures in the render object prototype. int replacePrototypeTexture(RenderObjClass *robj, const char * oldname, const char * newname); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 97a88b6295b..7e2a58d1089 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -181,10 +181,10 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - IRegion2D verticle1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height }; - IRegion2D verticle2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height }; - IRegion2D verticle3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height }; - IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; + IRegion2D vertical1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height }; + IRegion2D vertical2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height }; + IRegion2D vertical3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height }; + IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; // static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; // static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; @@ -200,10 +200,10 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) - TheDisplay->drawLine(verticle1.lo.x,verticle1.lo.y,verticle1.hi.x,verticle1.hi.y,3,color); - TheDisplay->drawLine(verticle2.lo.x,verticle2.lo.y,verticle2.hi.x,verticle2.hi.y,3,color); - TheDisplay->drawLine(verticle3.lo.x,verticle3.lo.y,verticle3.hi.x,verticle3.hi.y,3,color); - TheDisplay->drawLine(verticle4.lo.x,verticle4.lo.y,verticle4.hi.x,verticle4.hi.y,3,color); + TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); + TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); + TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); + TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); // TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); // TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); // TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); @@ -245,10 +245,10 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - IRegion2D verticle1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height }; - IRegion2D verticle2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height }; - //IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height }; - IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; + IRegion2D vertical1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height }; + IRegion2D vertical2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height }; + //IRegion2D vertical3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height }; + IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; // static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; // static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; @@ -264,10 +264,10 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) - TheDisplay->drawLine(verticle1.lo.x,verticle1.lo.y,verticle1.hi.x,verticle1.hi.y,3,color); - TheDisplay->drawLine(verticle2.lo.x,verticle2.lo.y,verticle2.hi.x,verticle2.hi.y,3,color); - //TheDisplay->drawLine(verticle3.lo.x,verticle3.lo.y,verticle3.hi.x,verticle3.hi.y,3,color); - TheDisplay->drawLine(verticle4.lo.x,verticle4.lo.y,verticle4.hi.x,verticle4.hi.y,3,color); + TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); + TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); + //TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); + TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); // TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); // TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); // TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index b22a4425589..775f8b1829b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -672,7 +672,7 @@ __int64 Total_Create_Render_Obj_Time=0; #endif //--------------------------------------------------------------------- /** Generals specific code to generate customized render objects for each team color - Scale==1.0, color==0x00000000, and oldTexure== nullptr are defaults that do nothing. + Scale==1.0, color==0x00000000, and oldTexture==nullptr are defaults that do nothing. */ RenderObjClass * W3DAssetManager::Create_Render_Obj( const char * name, diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index 42289c9437f..ba3f6e9de28 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -383,7 +383,7 @@ void ParticleEmitterClass::Reset(void) // Note: This flag needs to be set first thing, otherwise // getting the transform will result in an 'update_x' call // which in turn results in a 'Set_Animation_Hidden' call, which - // in turn will cause the Update_Visibilty function to call + // in turn will cause the Update_Visibility function to call // Start(). This won't cause a stack overflow like in Start // but it would do some extra work. Active = true; @@ -403,7 +403,7 @@ void ParticleEmitterClass::Start(void) // Note: This flag needs to be set first thing, otherwise // getting the transform will result in an 'update_x' call // which in turn results in a 'Set_Animation_Hidden' call, which - // in turn will cause the Update_Visibilty function to call + // in turn will cause the Update_Visibility function to call // this method. And then... Stack Overflow! ;) Active = true; @@ -835,7 +835,7 @@ ParticleEmitterClass::Set_Name (const char *pname) void -ParticleEmitterClass::Update_On_Visibilty(void) +ParticleEmitterClass::Update_On_Visibility(void) { // Simply start or stop the emission based on // the visibility state of the emitter. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h index 47b450d0035..e6beffa1211 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -151,10 +151,10 @@ class ParticleEmitterClass : public RenderObjClass virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const { sphere.Center.Set(0,0,0); sphere.Radius = 0; } virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const { box.Center.Set(0,0,0); box.Extent.Set(0,0,0); } - virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibilty (); } - virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibilty (); } + virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibility (); } + virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibility (); } virtual void Set_LOD_Bias(float bias) { if (Buffer) Buffer->Set_LOD_Bias(bias); } @@ -277,7 +277,7 @@ class ParticleEmitterClass : public RenderObjClass virtual void Add_Dependencies_To_List (DynamicVectorClass &file_list, bool textures_only = false); // This method is called each time the visiblity state of the emitter changes. - virtual void Update_On_Visibilty (void); + virtual void Update_On_Visibility (void); private: diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 7ebdae2b037..d37617bfff6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -416,7 +416,7 @@ void Render2DClass::Add_Tri( const Vector2 & v0, const Vector2 & v1, const Vecto int new_vert_count = old_vert_count + 3; int new_index_count = Indices.Count() + 3; - // Add the verticies (translated to new coordinates) + // Add the vertices (translated to new coordinates) #if 0 Vertices.Add( Convert_Vert( v0 ), new_vert_count ); Vertices.Add( Convert_Vert( v1 ), new_vert_count ); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h index efd0ed87ce8..7a9235d10b4 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h @@ -2119,11 +2119,11 @@ struct W3dHLodSubObjectStruct #define W3D_BOX_ATTRIBUTE_ALIGNED 0x00000002 #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_MASK 0x00000FF0 // mask for the collision type bits #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_SHIFT 4 // shifting to get to the collision type bits -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh struct W3dBoxStruct { diff --git a/Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc b/Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc index 16e4db31812..1a7a964a811 100644 --- a/Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc +++ b/Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc @@ -258,7 +258,7 @@ BEGIN LTEXT "Name length + layout filename length (.wnd) must not exceed 'X' characters", STATIC_NAME_MAX,199,160,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,4,108,144,70 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,120,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,132,42,10 @@ -360,7 +360,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,17,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,31,42,10 @@ -441,7 +441,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -493,7 +493,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,395,166,50,14 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -575,7 +575,7 @@ BEGIN LTEXT "Name length + layout filename length (.wnd) must not exceed 'X' characters", STATIC_NAME_MAX,160,159,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,112,4,108,124 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,40,42,10 @@ -663,7 +663,7 @@ BEGIN STATIC_NAME_MAX,200,158,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,269,7,192,124 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -742,7 +742,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -817,7 +817,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -902,7 +902,7 @@ BEGIN LTEXT "Display Font",IDC_STATIC,14,146,128,8 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -1068,7 +1068,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -1178,7 +1178,7 @@ BEGIN GROUPBOX "Combo Box Data",IDC_STATIC,4,4,144,233 LTEXT "Display Font",IDC_STATIC,12,152,128,8 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 diff --git a/Generals/Code/Tools/GUIEdit/Resource/resource.h b/Generals/Code/Tools/GUIEdit/Resource/resource.h index f0c5de11600..3af3857b67c 100644 --- a/Generals/Code/Tools/GUIEdit/Resource/resource.h +++ b/Generals/Code/Tools/GUIEdit/Resource/resource.h @@ -41,7 +41,7 @@ #define TAB_CONTROL_PROPERTIES_DIALOG 153 #define COMBO_BOX_PROPERTIES_DIALOG 154 #define CHECK_SEE_THRU 1004 -#define CHECK_DRAGABLE 1005 +#define CHECK_DRAGGABLE 1005 #define CHECK_ENABLED 1006 #define CHECK_HIDDEN 1007 #define CHECK_NO_INPUT 1008 diff --git a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp index 371b3d853dc..e32032e8b35 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Properties.cpp @@ -808,8 +808,8 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) // populate common properties if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) ) CheckDlgButton( dialog, CHECK_ENABLED, BST_CHECKED ); - if( BitIsSet( window->winGetStatus(), WIN_STATUS_DRAGABLE ) ) - CheckDlgButton( dialog, CHECK_DRAGABLE, BST_CHECKED ); + if( BitIsSet( window->winGetStatus(), WIN_STATUS_DRAGGABLE ) ) + CheckDlgButton( dialog, CHECK_DRAGGABLE, BST_CHECKED ); if( BitIsSet( window->winGetStatus(), WIN_STATUS_HIDDEN ) ) CheckDlgButton( dialog, CHECK_HIDDEN, BST_CHECKED ); if( BitIsSet( window->winGetStatus(), WIN_STATUS_NO_INPUT ) ) @@ -1068,9 +1068,9 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) // save bits window->winEnable( IsDlgButtonChecked( dialog, CHECK_ENABLED ) ); - bit = WIN_STATUS_DRAGABLE; + bit = WIN_STATUS_DRAGGABLE; window->winClearStatus( bit ); - if( IsDlgButtonChecked( dialog, CHECK_DRAGABLE ) ) + if( IsDlgButtonChecked( dialog, CHECK_DRAGGABLE ) ) window->winSetStatus( bit ); bit = WIN_STATUS_HIDDEN; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h b/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h index 910b7dc6995..752bb8f3e24 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h @@ -91,7 +91,7 @@ class AcademyStats : public Snapshot Bool isFirstUpdate() const { return m_firstUpdate; } void setFirstUpdate( Bool set ) { m_firstUpdate = set; } - void recordProduction( const Object *obj, const Object *constructer ); + void recordProduction( const Object *obj, const Object *constructor ); void recordUpgrade( const UpgradeTemplate *upgrade, Bool granted ); void recordSpecialPowerUsed( const SpecialPowerTemplate *spTemplate ); void recordIncome(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h index 6312d3467ee..ce84c0af736 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h @@ -24,7 +24,7 @@ #pragma once -#ifndef IG_DEGBUG_STACKTRACE +#ifndef IG_DEBUG_STACKTRACE #define IG_DEBUG_STACKTRACE 1 #endif // Unsure about this one -ML 3/25/03 #if defined(RTS_DEBUG) || defined(IG_DEBUG_STACKTRACE) diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index b4a0dbbddb9..eec85e73123 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -216,7 +216,7 @@ enum GUICommandType CPP_11(: Int) GUI_COMMAND_NUM_COMMANDS }; -#ifdef DEFINE_GUI_COMMMAND_NAMES +#ifdef DEFINE_GUI_COMMAND_NAMES static const char *const TheGuiCommandNames[] = { "NONE", diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h index 19f4db31055..ba2c539a5be 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h @@ -272,7 +272,7 @@ class ControlBarSchemeManager private: ControlBarScheme *m_currentScheme; ///< the current scheme that everythign uses - Coord2D m_multiplyer; + Coord2D m_multiplier; typedef std::list< ControlBarScheme* > ControlBarSchemeList; ///< list of control bar schemes ControlBarSchemeList m_schemeList; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h index 4a490fef3e2..a49f4efffed 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h @@ -157,7 +157,7 @@ enum WIN_STATUS_NONE = 0x00000000, // No status bits set at all WIN_STATUS_ACTIVE = 0x00000001, // At the top of the window list WIN_STATUS_TOGGLE = 0x00000002, // If set, click to toggle - WIN_STATUS_DRAGABLE = 0x00000004, // Window can be dragged + WIN_STATUS_DRAGGABLE = 0x00000004, // Window can be dragged WIN_STATUS_ENABLED = 0x00000008, // Window can receive input WIN_STATUS_HIDDEN = 0x00000010, // Window is hidden, no input WIN_STATUS_ABOVE = 0x00000020, // Window is always above others diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h index 239014b8ece..2c98519bc8e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h @@ -668,7 +668,7 @@ class GameWindowTransitionsHandler: public SubsystemInterface static const FieldParse m_gameWindowTransitionsFieldParseTable[]; ///< the parse table static void parseWindow( INI* ini, void *instance, void *store, const void *userData ); - void setGroup(AsciiString groupName, Bool immidiate = FALSE); // THis will be the next group to fire off. + void setGroup(AsciiString groupName, Bool immediate = FALSE); // THis will be the next group to fire off. void reverse( AsciiString groupName );// reverse the animations for the current group. void remove( AsciiString groupName, Bool skipPending = FALSE );// remove the animation from the current or pending groups. TransitionGroup *getNewGroup( AsciiString name ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h index 5d916675274..2b78b9b6270 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h @@ -75,7 +75,7 @@ class IMEManagerInterface : public SubsystemInterface virtual ~IMEManagerInterface() {}; virtual void attach( GameWindow *window ) = 0; ///< attach IME to specified window - virtual void detatch( void ) = 0; ///< detatch IME from current window + virtual void detach( void ) = 0; ///< detach IME from current window virtual void enable( void ) = 0; ///< Enable IME virtual void disable( void ) = 0; ///< Disable IME virtual Bool isEnabled( void ) = 0; ///< Is IME enabled diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index 89f36104be3..52429c69c41 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -820,7 +820,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Bool blocked ); ///< Work backwards from goal cell to construct final path Path *buildGroundPath( Bool isCrusher,const Coord3D *fromPos, PathfindCell *goalCell, Bool center, Int pathDiameter ); ///< Work backwards from goal cell to construct final path - Path *buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell); ///< Work backwards from goal cell to construct final path + Path *buildHierarchicalPath( const Coord3D *fromPos, PathfindCell *goalCell); ///< Work backwards from goal cell to construct final path void prependCells( Path *path, const Coord3D *fromPos, PathfindCell *goalCell, Bool center ); ///< Add pathfind cells to a path. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index dc171244527..726db569112 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -284,8 +284,8 @@ class RailroadBehavior : public PhysicsBehavior Bool m_waitingInWings; /// I have not entered the real track yet, so leave me alone Bool m_endOfLine; /// I have reached the end of a non looping track Bool m_isLocomotive; ///< Am I a locomotive, - Bool m_isLeadCarraige; ///< Am the carraige in front, - Int m_wantsToBeLeadCarraige; ///< Am the carraige in front, + Bool m_isLeadCarriage; ///< Am the carraige in front, + Int m_wantsToBeLeadCarriage; ///< Am the carraige in front, Bool m_disembark; ///< If I wait at a station, I should also evacuate everybody when I get theres Bool m_inTunnel; ///< Am I in a tunnel, so I wil not snap to ground height, until the next waypoint, // i.e. do I provide the movement and scheduling AI for m_trailerID diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp index ad565ea87f3..3fc4206aed0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp @@ -359,7 +359,7 @@ void AcademyStats::update() } //------------------------------------------------------------------------------------------------ -void AcademyStats::recordProduction( const Object *obj, const Object *constructer ) +void AcademyStats::recordProduction( const Object *obj, const Object *constructor ) { UnsignedInt now = TheGameLogic->getFrame(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp index d3a1d8ed1a5..fc23c65eac8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Credits.cpp @@ -193,16 +193,16 @@ void CreditsManager::update( void ) Int lastHeight = 0; Int start = m_scrollDown? 0:TheDisplay->getHeight(); Int end =m_scrollDown? TheDisplay->getHeight():0; - Int offsetStartMultiplyer = m_scrollDown? -1:0; // if we're scrolling from the top, we need to subtract the height - Int offsetEndMultiplyer = m_scrollDown? 0:1; - Int directionMultiplyer = m_scrollDown? 1:-1; + Int offsetStartMultiplier = m_scrollDown? -1:0; // if we're scrolling from the top, we need to subtract the height + Int offsetEndMultiplier = m_scrollDown? 0:1; + Int directionMultiplier = m_scrollDown? 1:-1; CreditsLineList::iterator drawIt = m_displayedCreditLineList.begin(); while (drawIt != m_displayedCreditLineList.end()) { CreditsLine *cLine = *drawIt; - y = cLine->m_pos.y = cLine->m_pos.y + (m_scrollRate * directionMultiplyer); + y = cLine->m_pos.y = cLine->m_pos.y + (m_scrollRate * directionMultiplier); lastHeight = cLine->m_height; - yTest = y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetEndMultiplyer); + yTest = y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetEndMultiplier); if(((m_scrollDown && (yTest > end)) || (!m_scrollDown && (yTest < end)))) { TheDisplayStringManager->freeDisplayString(cLine->m_displayString); @@ -215,7 +215,7 @@ void CreditsManager::update( void ) drawIt++; } - y= y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetStartMultiplyer); + y= y + ((lastHeight + CREDIT_SPACE_OFFSET) * offsetStartMultiplier); // is it time to add a new string? if(!((m_scrollDown && (yTest >= start)) || (!m_scrollDown && (yTest <= start)))) @@ -247,7 +247,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -268,7 +268,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -289,7 +289,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } } @@ -310,7 +310,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_displayString = ds; } if(TheGlobalLanguageData && !cLine->m_secondText.isEmpty()) @@ -325,7 +325,7 @@ void CreditsManager::update( void ) ds->getSize(&pos.x,&pos.y); cLine->m_height = pos.y; cLine->m_pos.x = TheDisplay->getWidth()/2 - pos.x/2 ; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); cLine->m_secondDisplayString = ds; } @@ -334,7 +334,7 @@ void CreditsManager::update( void ) case CREDIT_STYLE_BLANK: { cLine->m_height = m_normalFontHeight; - cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplyer); + cLine->m_pos.y = start + (cLine->m_height * offsetStartMultiplier); } break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 9b1e52f7eed..61a2916e0d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -30,7 +30,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_GUI_COMMMAND_NAMES +#define DEFINE_GUI_COMMAND_NAMES #define DEFINE_COMMAND_OPTION_NAMES #define DEFINE_WEAPONSLOTTYPE_NAMES #define DEFINE_RADIUSCURSOR_NAMES diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index e8cc648bb69..0917eb073f6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -820,7 +820,7 @@ ControlBarSchemeManager::ControlBarSchemeManager( void ) { m_currentScheme = nullptr; m_schemeList.clear(); - m_multiplyer.x = m_multiplyer.y = 1; + m_multiplier.x = m_multiplier.y = 1; } // @@ -1039,9 +1039,9 @@ void ControlBarSchemeManager::setControlBarScheme(AsciiString schemeName) ControlBarScheme *tempScheme = findControlBarScheme( schemeName ); if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else @@ -1066,13 +1066,13 @@ void ControlBarSchemeManager::update( void ) void ControlBarSchemeManager::drawForeground( ICoord2D offset ) { if(m_currentScheme) - m_currentScheme->drawForeground( m_multiplyer, offset); + m_currentScheme->drawForeground( m_multiplier, offset); } //----------------------------------------------------------------------------- void ControlBarSchemeManager::drawBackground( ICoord2D offset ) { if(m_currentScheme) - m_currentScheme->drawBackground( m_multiplyer, offset ); + m_currentScheme->drawBackground( m_multiplier, offset ); } //----------------------------------------------------------------------------- @@ -1121,9 +1121,9 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayerTemplate( const PlayerT if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else @@ -1189,9 +1189,9 @@ void ControlBarSchemeManager::setControlBarSchemeByPlayer(Player *p) if(tempScheme) { - // setup the multiplyer value - m_multiplyer.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; - m_multiplyer.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; + // setup the multiplier value + m_multiplier.x = TheDisplay->getWidth() / (Real)tempScheme->m_ScreenCreationRes.x; + m_multiplier.y = TheDisplay->getHeight() / (Real)tempScheme->m_ScreenCreationRes.y; m_currentScheme = tempScheme; } else diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 3e16150c71e..208af49523c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -1731,7 +1731,7 @@ winName.format("ScoreScreen.wnd:StaticTextScore%d", pos); { // we pinged on the last frame someone was there - i.e. game ended in a disconnect. // check if we were to blame. - if (TheNetwork->getPingsRecieved() < max(1, TheNetwork->getPingsSent()/2)) /// @todo: what's a good percent of pings to have gotten? + if (TheNetwork->getPingsReceived() < max(1, TheNetwork->getPingsSent()/2)) /// @todo: what's a good percent of pings to have gotten? { DEBUG_LOG(("We were to blame. Leaving gameEndedInDisconnect = true")); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp index e8f5f1115bf..3ae6ee7d7d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp @@ -386,7 +386,7 @@ WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, e->conCharPos = 0; if(TheIMEManager && TheIMEManager->isAttachedTo(window)) TheIMEManager->attach(nullptr); - //TheIMEManager->detatch(); + //TheIMEManager->detach(); } else { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index a6348db2ae4..b7c996399c4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -917,7 +917,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms BitClear( m_grabWindow->m_status, WIN_STATUS_ACTIVE ); if( m_grabWindow->winPointInWindow( mousePos->x, mousePos->y ) ) winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGABLE )) + else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE )) { winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); } @@ -932,7 +932,7 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms case GWM_LEFT_DRAG: { - if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGABLE ) ) + if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE ) ) { ICoord2D *mouseDelta = (ICoord2D *)data; dx = mouseDelta->x; @@ -2266,7 +2266,7 @@ GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, // create the slider thumb button WinInstanceData buttonInstData; - UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE; + UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE; buttonInstData.init(); @@ -3672,7 +3672,7 @@ Bool GameWindowManager::initTestGUI( void ) // UnsignedByte alpha = 200; GameWindow *window; - UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE | WIN_STATUS_IMAGE; + UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE | WIN_STATUS_IMAGE; WinInstanceData instData; // make some windows inside each other in the upper left @@ -3737,7 +3737,7 @@ Bool GameWindowManager::initTestGUI( void ) &instData, nullptr, TRUE ); // make window to hold radio buttons - window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE, 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp index 19458e64a61..5879b8a07e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp @@ -449,11 +449,11 @@ void GameWindowTransitionsHandler::draw( void ) m_secondaryDrawGroup->draw(); } -void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immidiate ) +void GameWindowTransitionsHandler::setGroup(AsciiString groupName, Bool immediate ) { - if(groupName.isEmpty() && immidiate) + if(groupName.isEmpty() && immediate) m_currentGroup = nullptr; - if(immidiate && m_currentGroup) + if(immediate && m_currentGroup) { m_currentGroup->skip(); m_currentGroup = findGroup(groupName); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index ca6e2798479..2fb169b0b03 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -97,7 +97,7 @@ class IMEManager : public IMEManagerInterface virtual void update( void ); virtual void attach( GameWindow *window ); ///< attach IME to specified window - virtual void detatch( void ); ///< detatch IME from current window + virtual void detach( void ); ///< detach IME from current window virtual void enable( void ); ///< Enable IME virtual void disable( void ); ///< Disable IME virtual Bool isEnabled( void ); ///< Is IME enabled @@ -539,7 +539,7 @@ IMEManager::~IMEManager() delete [] m_candidateString; - detatch(); + detach(); ImmAssociateContext( ApplicationHWnd, m_oldContext ); ImmReleaseContext( ApplicationHWnd, m_oldContext ); if ( m_context ) @@ -604,7 +604,7 @@ void IMEManager::init( void ) m_candidateTextArea->winSetUserData( TheIMEManager ); } - detatch(); + detach(); enable(); } @@ -634,7 +634,7 @@ void IMEManager::attach( GameWindow *window ) { if ( m_window != window ) { - detatch(); + detach(); if ( m_disabled == 0 ) { ImmAssociateContext( ApplicationHWnd, m_context ); @@ -646,10 +646,10 @@ void IMEManager::attach( GameWindow *window ) } //============================================================================ -// IMEManager::detatch +// IMEManager::detach //============================================================================ -void IMEManager::detatch( void ) +void IMEManager::detach( void ) { //ImmAssociateContext( ApplicationHWnd, nullptr ); m_window = nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index ffb718029d5..08717b8c6db 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -217,7 +217,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) enum{ STATE_BEGIN = 250, STATE_SHOW_LOCATION = 251, - STATE_BEGIN_BREIFING = 255, + STATE_BEGIN_BRIEFING = 255, // STATE_BEGIN_ANIMATING_TEXT = 250, STATE_SHOW_CAMEO_1 = 434, STATE_BEGIN_ANIMATING_TEXT = 356, @@ -233,7 +233,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) if(frame < STATE_BEGIN || frame > STATE_END) return; - if( frame == STATE_BEGIN_BREIFING) + if( frame == STATE_BEGIN_BRIEFING) { // add sound support here TheAudio->friend_forcePlayAudioEventRTS(&TheCampaignManager->getCurrentMission()->m_briefingVoice); @@ -299,9 +299,9 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) STATE_BEGIN = 275, STATE_BEGIN_ANIM = 290, STATE_ANIM_CAMEO1 = 300, - STATE_ANIM_CAMEO1_TRASITION_CAMEO2 = 350, + STATE_ANIM_CAMEO1_TRANSITION_CAMEO2 = 350, STATE_ANIM_CAMEO2 = 400, - STATE_ANIM_CAMEO2_TRASITION_CAMEO3 = 450, + STATE_ANIM_CAMEO2_TRANSITION_CAMEO3 = 450, STATE_ANIM_CAMEO3 = 500, STATED_END_ANIM = 550, STATE_END = 800 @@ -321,7 +321,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) GadgetStaticTextSetText(m_cameoText, TheGameText->fetch(TheCampaignManager->getCurrentMission()->m_cameoImageName[0])); //save of positions } - else if( frame == STATE_ANIM_CAMEO1_TRASITION_CAMEO2) + else if( frame == STATE_ANIM_CAMEO1_TRANSITION_CAMEO2) { m_cameoWindow1->winEnable(FALSE); GadgetStaticTextSetText(m_cameoText, UnicodeString::TheEmptyString); @@ -335,11 +335,11 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) endPos.y = startPos.y; } - else if( frame > STATE_ANIM_CAMEO1_TRASITION_CAMEO2 && frame < STATE_ANIM_CAMEO2) + else if( frame > STATE_ANIM_CAMEO1_TRANSITION_CAMEO2 && frame < STATE_ANIM_CAMEO2) { //extrapolate between start and end pos - Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO1_TRASITION_CAMEO2)) / (STATE_ANIM_CAMEO2 - STATE_ANIM_CAMEO1_TRASITION_CAMEO2); + Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO1_TRANSITION_CAMEO2)) / (STATE_ANIM_CAMEO2 - STATE_ANIM_CAMEO1_TRANSITION_CAMEO2); m_cameoFrame->winSetPosition(startPos.x + (endPos.x - startPos.x) * percent, endPos.y); } else if( frame == STATE_ANIM_CAMEO2 ) @@ -348,7 +348,7 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) m_cameoFrame->winSetPosition(endPos.x, endPos.y); GadgetStaticTextSetText(m_cameoText, TheGameText->fetch(TheCampaignManager->getCurrentMission()->m_cameoImageName[1])); } - else if( frame == STATE_ANIM_CAMEO2_TRASITION_CAMEO3) + else if( frame == STATE_ANIM_CAMEO2_TRANSITION_CAMEO3) { m_cameoWindow2->winEnable(FALSE); GadgetStaticTextSetText(m_cameoText, UnicodeString::TheEmptyString); @@ -362,11 +362,11 @@ void SinglePlayerLoadScreen::moveWindows( Int frame ) endPos.y = startPos.y; } - else if( frame > STATE_ANIM_CAMEO2_TRASITION_CAMEO3 && frame < STATE_ANIM_CAMEO3) + else if( frame > STATE_ANIM_CAMEO2_TRANSITION_CAMEO3 && frame < STATE_ANIM_CAMEO3) { //extrapolate between start and end pos - Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO2_TRASITION_CAMEO3)) / (STATE_ANIM_CAMEO3 - STATE_ANIM_CAMEO2_TRASITION_CAMEO3); + Real percent = INT_TO_REAL((frame - STATE_ANIM_CAMEO2_TRANSITION_CAMEO3)) / (STATE_ANIM_CAMEO3 - STATE_ANIM_CAMEO2_TRANSITION_CAMEO3); m_cameoFrame->winSetPosition(startPos.x + (endPos.x - startPos.x) * percent, endPos.y); } else if( frame == STATE_ANIM_CAMEO3 ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index c5498126c4f..f1ae0af8f51 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -163,7 +163,7 @@ void Shell::reset( void ) { if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // pop all screens while( m_screenCount ) @@ -312,7 +312,7 @@ void Shell::hide( Bool hide ) m_screenStack[ i ]->hide( hide ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -376,7 +376,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) } // if (TheIMEManager) -// TheIMEManager->detatch(); +// TheIMEManager->detach(); } @@ -416,7 +416,7 @@ void Shell::pop( void ) screen->runShutdown( &immediatePop ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -454,7 +454,7 @@ void Shell::popImmediate( void ) doPop( FALSE ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } @@ -593,7 +593,7 @@ void Shell::hideShell( void ) } if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // Mark that the shell is no longer up. m_isShellActive = FALSE; @@ -676,7 +676,7 @@ void Shell::doPush( AsciiString layoutFile ) linkScreen( newScreen ); if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); // run the init function automatically newScreen->runInit( nullptr ); @@ -716,7 +716,7 @@ void Shell::doPop( Bool impendingPush ) } if (TheIMEManager) - TheIMEManager->detatch(); + TheIMEManager->detach(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index e5a67328b24..de89a8b5a29 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -6471,9 +6471,9 @@ Path *Pathfinder::buildGroundPath(Bool isCrusher, const Coord3D *fromPos, Pathfi /** * Work backwards from goal cell to construct final path. */ -Path *Pathfinder::buildHierachicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) +Path *Pathfinder::buildHierarchicalPath( const Coord3D *fromPos, PathfindCell *goalCell ) { - DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierachicalPath: goalCell == nullptr") ); + DEBUG_ASSERTCRASH( goalCell, ("Pathfinder::buildHierarchicalPath: goalCell == nullptr") ); Path *path = newInstance(Path); @@ -7437,7 +7437,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu m_isTunneling = false; // construct and return path - Path *path = buildHierachicalPath( from, goalCell ); + Path *path = buildHierarchicalPath( from, goalCell ); #if defined(RTS_DEBUG) Bool show = TheGlobalData->m_debugAI==AI_DEBUG_PATHS; show |= (TheGlobalData->m_debugAI==AI_DEBUG_GROUND_PATHS); @@ -7626,7 +7626,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu if (closestOK && closestCell) { m_isTunneling = false; // construct and return path - Path *path = buildHierachicalPath( from, closestCell ); + Path *path = buildHierarchicalPath( from, closestCell ); #if RETAIL_COMPATIBLE_PATHFINDING if (!s_useFixedPathfinding) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index 04a21d7cc38..700a1ea8cc9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -152,8 +152,8 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_waitingInWings = TRUE; m_endOfLine = FALSE; m_isLocomotive = modData->m_isLocomotive; - m_isLeadCarraige = m_isLocomotive; // for now, I am the lead, only if I am the locomotive - m_wantsToBeLeadCarraige = FALSE; + m_isLeadCarriage = m_isLocomotive; // for now, I am the lead, only if I am the locomotive + m_wantsToBeLeadCarriage = FALSE; m_disembark = FALSE; m_inTunnel = FALSE; m_held = FALSE; @@ -194,7 +194,7 @@ Bool RailroadBehavior::isRailroad() const return FALSE; if (m_endOfLine) return FALSE; - if (m_isLeadCarraige) + if (m_isLeadCarriage) return TRUE; if (m_trailerID==INVALID_ID) return TRUE; @@ -237,7 +237,7 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord { other->kill(); } - else if ( m_isLeadCarraige ) //yikes! I just coasted into some other carriage + else if ( m_isLeadCarriage ) //yikes! I just coasted into some other carriage { other->kill(); obj->kill();//and I am dead, too @@ -769,12 +769,12 @@ UpdateSleepTime RailroadBehavior::update( void ) - if ( m_wantsToBeLeadCarraige > FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )//if this flag survived until now, I have lost my puller + if ( m_wantsToBeLeadCarriage > FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )//if this flag survived until now, I have lost my puller { - m_isLeadCarraige = TRUE; + m_isLeadCarriage = TRUE; } - if ( m_isLeadCarraige ) + if ( m_isLeadCarriage ) { if ( m_conductorState == COAST ) @@ -819,9 +819,9 @@ UpdateSleepTime RailroadBehavior::update( void ) TheGameLogic->destroyObject( getObject() ); } } - else if ( m_wantsToBeLeadCarraige <= FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )// if I am not the lead carriage + else if ( m_wantsToBeLeadCarriage <= FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )// if I am not the lead carriage { - m_wantsToBeLeadCarraige ++; // like every young carriage, I aspire to be the lead carriage some day + m_wantsToBeLeadCarriage ++; // like every young carriage, I aspire to be the lead carriage some day // unless getpulled() set this false, I will be on the next update! Joy! } @@ -1165,7 +1165,7 @@ void RailroadBehavior::hitchNewCarriagebyProximity( ObjectID locoID, TrainTrack void RailroadBehavior::getPulled( PullInfo *info ) { //ENFORCE MY STATUS AS A PULLEE, NOT A PULLER, and update my position, speed etc. - m_wantsToBeLeadCarraige = 0; + m_wantsToBeLeadCarriage = 0; if ( ! m_track ) { @@ -1567,11 +1567,11 @@ void RailroadBehavior::xfer( Xfer *xfer ) //Bool m_isLocomotive; ///< Am I a locomotive, xfer->xferBool( &m_isLocomotive ); - //Bool m_isLeadCarraige; ///< Am the carraige in front, - xfer->xferBool( &m_isLeadCarraige ); + //Bool m_isLeadCarriage; ///< Am the carraige in front, + xfer->xferBool( &m_isLeadCarriage ); - //Int m_wantsToBeLeadCarraige; ///< Am the carraige in front, - xfer->xferInt( &m_wantsToBeLeadCarraige ); + //Int m_wantsToBeLeadCarriage; ///< Am the carraige in front, + xfer->xferInt( &m_wantsToBeLeadCarriage ); //Bool m_disembark; ///< If I wait at a station, I should also evacuate everybody when I get theres xfer->xferBool( &m_disembark ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 94d8ac84b87..c5693de7f61 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -2859,8 +2859,8 @@ Bool Weapon::isWithinTargetPitch(const Object *source, const Object *victim) con const Coord3D* src = source->getPosition(); const Coord3D* dst = victim->getPosition(); - const Real ACCCEPTABLE_DZ = 10.0f; - if (fabs(dst->z - src->z) < ACCCEPTABLE_DZ) + const Real ACCEPTABLE_DZ = 10.0f; + if (fabs(dst->z - src->z) < ACCEPTABLE_DZ) return true; // always good enough if dz is small, regardless of pitch Real minPitch, maxPitch; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 20245d16e50..5a8d617e393 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -2019,7 +2019,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) //UnsignedInt oldCRC = m_cachedCRCs[msg->getPlayerIndex()]; UnsignedInt newCRC = msg->getArgument(0)->integer; - //DEBUG_LOG(("Recieved CRC of %8.8X from %ls on frame %d", newCRC, + //DEBUG_LOG(("Received CRC of %8.8X from %ls on frame %d", newCRC, //thisPlayer->getPlayerDisplayName().str(), m_frame)); m_cachedCRCs[msg->getPlayerIndex()] = newCRC; // to mask problem: = (oldCRC < newCRC)?newCRC:oldCRC; } diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h index d7080a933e1..7e33fcd7552 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h @@ -78,7 +78,7 @@ class W3DAssetManager: public WW3DAssetManager void Report_Used_Font3DDatas( void ); void Report_Used_FontChars (void); - virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexure=nullptr, const char *newTexture=nullptr); + virtual RenderObjClass * Create_Render_Obj(const char * name,float scale, const int color, const char *oldTexture=nullptr, const char *newTexture=nullptr); ///Swaps the specified textures in the render object prototype. int replacePrototypeTexture(RenderObjClass *robj, const char * oldname, const char * newname); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 51e0b0f76ca..4d7f7168548 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -181,10 +181,10 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - IRegion2D verticle1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height }; - IRegion2D verticle2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height }; - IRegion2D verticle3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height }; - IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; + IRegion2D vertical1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height }; + IRegion2D vertical2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height }; + IRegion2D vertical3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height }; + IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; // static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; // static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; @@ -200,10 +200,10 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) - TheDisplay->drawLine(verticle1.lo.x,verticle1.lo.y,verticle1.hi.x,verticle1.hi.y,3,color); - TheDisplay->drawLine(verticle2.lo.x,verticle2.lo.y,verticle2.hi.x,verticle2.hi.y,3,color); - TheDisplay->drawLine(verticle3.lo.x,verticle3.lo.y,verticle3.hi.x,verticle3.hi.y,3,color); - TheDisplay->drawLine(verticle4.lo.x,verticle4.lo.y,verticle4.hi.x,verticle4.hi.y,3,color); + TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); + TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); + TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); + TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); // TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); // TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); // TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); @@ -245,10 +245,10 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - IRegion2D verticle1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height }; - IRegion2D verticle2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height }; - //IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height }; - IRegion2D verticle4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; + IRegion2D vertical1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height }; + IRegion2D vertical2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height }; + //IRegion2D vertical3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height }; + IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; // static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; // static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; @@ -264,10 +264,10 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) - TheDisplay->drawLine(verticle1.lo.x,verticle1.lo.y,verticle1.hi.x,verticle1.hi.y,3,color); - TheDisplay->drawLine(verticle2.lo.x,verticle2.lo.y,verticle2.hi.x,verticle2.hi.y,3,color); - //TheDisplay->drawLine(verticle3.lo.x,verticle3.lo.y,verticle3.hi.x,verticle3.hi.y,3,color); - TheDisplay->drawLine(verticle4.lo.x,verticle4.lo.y,verticle4.hi.x,verticle4.hi.y,3,color); + TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); + TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); + //TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); + TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); // TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); // TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); // TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp index 0aabefedfde..cf08c63a07c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp @@ -702,7 +702,7 @@ __int64 Total_Create_Render_Obj_Time=0; #endif //--------------------------------------------------------------------- /** Generals specific code to generate customized render objects for each team color - Scale==1.0, color==0x00000000, and oldTexure== nullptr are defaults that do nothing. + Scale==1.0, color==0x00000000, and oldTexture==nullptr are defaults that do nothing. */ RenderObjClass * W3DAssetManager::Create_Render_Obj( const char * name, diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp index e2b02421b96..e75b7d522ef 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -387,7 +387,7 @@ void ParticleEmitterClass::Reset(void) // Note: This flag needs to be set first thing, otherwise // getting the transform will result in an 'update_x' call // which in turn results in a 'Set_Animation_Hidden' call, which - // in turn will cause the Update_Visibilty function to call + // in turn will cause the Update_Visibility function to call // Start(). This won't cause a stack overflow like in Start // but it would do some extra work. Active = true; @@ -407,7 +407,7 @@ void ParticleEmitterClass::Start(void) // Note: This flag needs to be set first thing, otherwise // getting the transform will result in an 'update_x' call // which in turn results in a 'Set_Animation_Hidden' call, which - // in turn will cause the Update_Visibilty function to call + // in turn will cause the Update_Visibility function to call // this method. And then... Stack Overflow! ;) Active = true; @@ -848,7 +848,7 @@ ParticleEmitterClass::Set_Name (const char *pname) void -ParticleEmitterClass::Update_On_Visibilty(void) +ParticleEmitterClass::Update_On_Visibility(void) { // Simply start or stop the emission based on // the visibility state of the emitter. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h index ece8ba7c080..05dc24ed556 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -151,10 +151,10 @@ class ParticleEmitterClass : public RenderObjClass virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const { sphere.Center.Set(0,0,0); sphere.Radius = 0; } virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const { box.Center.Set(0,0,0); box.Extent.Set(0,0,0); } - virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibilty (); } - virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibilty (); } - virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibilty (); } + virtual void Set_Hidden(int onoff) { RenderObjClass::Set_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Visible(int onoff) { RenderObjClass::Set_Visible (onoff); Update_On_Visibility (); } + virtual void Set_Animation_Hidden(int onoff) { RenderObjClass::Set_Animation_Hidden (onoff); Update_On_Visibility (); } + virtual void Set_Force_Visible(int onoff) { RenderObjClass::Set_Force_Visible (onoff); Update_On_Visibility (); } virtual void Set_LOD_Bias(float bias) { if (Buffer) Buffer->Set_LOD_Bias(bias); } @@ -284,7 +284,7 @@ class ParticleEmitterClass : public RenderObjClass virtual void Add_Dependencies_To_List (DynamicVectorClass &file_list, bool textures_only = false); // This method is called each time the visiblity state of the emitter changes. - virtual void Update_On_Visibilty (void); + virtual void Update_On_Visibility (void); private: diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 48f10b95ca9..e27d11a055f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -488,7 +488,7 @@ void Render2DClass::Add_Tri( const Vector2 & v0, const Vector2 & v1, const Vecto { int old_vert_count = Vertices.Count(); - // Add the verticies (translated to new coordinates) + // Add the vertices (translated to new coordinates) #if 0 Vertices.Add( Convert_Vert( v0 ), new_vert_count ); Vertices.Add( Convert_Vert( v1 ), new_vert_count ); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h index 65201f6a9d5..6c21bf03522 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h @@ -2119,11 +2119,11 @@ struct W3dHLodSubObjectStruct #define W3D_BOX_ATTRIBUTE_ALIGNED 0x00000002 #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_MASK 0x00000FF0 // mask for the collision type bits #define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_SHIFT 4 // shifting to get to the collision type bits -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh -#define W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL 0x00000010 // physical collisions +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE 0x00000020 // projectiles (rays) collide with this +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS 0x00000040 // vis rays collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA 0x00000080 // cameras collide with this mesh +#define W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE 0x00000100 // vehicles collide with this mesh struct W3dBoxStruct { diff --git a/GeneralsMD/Code/Tools/GUIEdit/Resource/GUIEdit.rc b/GeneralsMD/Code/Tools/GUIEdit/Resource/GUIEdit.rc index 16e4db31812..1a7a964a811 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Resource/GUIEdit.rc +++ b/GeneralsMD/Code/Tools/GUIEdit/Resource/GUIEdit.rc @@ -258,7 +258,7 @@ BEGIN LTEXT "Name length + layout filename length (.wnd) must not exceed 'X' characters", STATIC_NAME_MAX,199,160,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,4,108,144,70 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,120,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,132,42,10 @@ -360,7 +360,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,17,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,31,42,10 @@ -441,7 +441,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -493,7 +493,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,395,166,50,14 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -575,7 +575,7 @@ BEGIN LTEXT "Name length + layout filename length (.wnd) must not exceed 'X' characters", STATIC_NAME_MAX,160,159,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,112,4,108,124 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,40,42,10 @@ -663,7 +663,7 @@ BEGIN STATIC_NAME_MAX,200,158,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,269,7,192,124 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -742,7 +742,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -817,7 +817,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -902,7 +902,7 @@ BEGIN LTEXT "Display Font",IDC_STATIC,14,146,128,8 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -1068,7 +1068,7 @@ BEGIN STATIC_NAME_MAX,200,135,244,12,SS_CENTERIMAGE GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 GROUPBOX "Images and Colors",IDC_STATIC,268,4,192,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 @@ -1178,7 +1178,7 @@ BEGIN GROUPBOX "Combo Box Data",IDC_STATIC,4,4,144,233 LTEXT "Display Font",IDC_STATIC,12,152,128,8 GROUPBOX "Window Status",IDC_STATIC,152,4,108,100 - CONTROL "Dragable",CHECK_DRAGABLE,"Button",BS_AUTOCHECKBOX | + CONTROL "Dragable",CHECK_DRAGGABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,20,45,10 CONTROL "Enabled",CHECK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,160,40,42,10 diff --git a/GeneralsMD/Code/Tools/GUIEdit/Resource/resource.h b/GeneralsMD/Code/Tools/GUIEdit/Resource/resource.h index b1c220f0d51..3158c6358b3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Resource/resource.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Resource/resource.h @@ -59,7 +59,7 @@ #define TAB_CONTROL_PROPERTIES_DIALOG 153 #define COMBO_BOX_PROPERTIES_DIALOG 154 #define CHECK_SEE_THRU 1004 -#define CHECK_DRAGABLE 1005 +#define CHECK_DRAGGABLE 1005 #define CHECK_ENABLED 1006 #define CHECK_HIDDEN 1007 #define CHECK_NO_INPUT 1008 diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp index 53823215495..72feb50dc80 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Properties.cpp @@ -808,8 +808,8 @@ void CommonDialogInitialize( GameWindow *window, HWND dialog ) // populate common properties if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) ) CheckDlgButton( dialog, CHECK_ENABLED, BST_CHECKED ); - if( BitIsSet( window->winGetStatus(), WIN_STATUS_DRAGABLE ) ) - CheckDlgButton( dialog, CHECK_DRAGABLE, BST_CHECKED ); + if( BitIsSet( window->winGetStatus(), WIN_STATUS_DRAGGABLE ) ) + CheckDlgButton( dialog, CHECK_DRAGGABLE, BST_CHECKED ); if( BitIsSet( window->winGetStatus(), WIN_STATUS_HIDDEN ) ) CheckDlgButton( dialog, CHECK_HIDDEN, BST_CHECKED ); if( BitIsSet( window->winGetStatus(), WIN_STATUS_NO_INPUT ) ) @@ -1068,9 +1068,9 @@ Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window ) // save bits window->winEnable( IsDlgButtonChecked( dialog, CHECK_ENABLED ) ); - bit = WIN_STATUS_DRAGABLE; + bit = WIN_STATUS_DRAGGABLE; window->winClearStatus( bit ); - if( IsDlgButtonChecked( dialog, CHECK_DRAGABLE ) ) + if( IsDlgButtonChecked( dialog, CHECK_DRAGGABLE ) ) window->winSetStatus( bit ); bit = WIN_STATUS_HIDDEN; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 5a73e774719..f41134b4a6f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1978,7 +1978,7 @@ void WbView3d::updateHysteresis(void) // ---------------------------------------------------------------------------- Bool WbView3d::docToViewCoords(Coord3D curPt, CPoint* newPt) { - Bool coordInsideFrustrum = true; + Bool coordInsideFrustum = true; Vector3 world; Vector3 screen; newPt->x = -1000; @@ -1989,9 +1989,9 @@ Bool WbView3d::docToViewCoords(Coord3D curPt, CPoint* newPt) world.Set( curPt.x, curPt.y, curPt.z ); if (m_camera->Project( screen, world ) != CameraClass::INSIDE_FRUSTUM) { - coordInsideFrustrum = false; + coordInsideFrustum = false; } else { - coordInsideFrustrum = true; + coordInsideFrustum = true; } CRect rClient; @@ -2011,7 +2011,7 @@ Bool WbView3d::docToViewCoords(Coord3D curPt, CPoint* newPt) newPt->x = rClient.left + sx; newPt->y = rClient.top + sy; - return coordInsideFrustrum; + return coordInsideFrustum; } // ---------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp index 1f645f923ed..373dff6a7af 100644 --- a/GeneralsMD/Code/Tools/wdump/chunk_d.cpp +++ b/GeneralsMD/Code/Tools/wdump/chunk_d.cpp @@ -2027,20 +2027,20 @@ void ChunkTableClass::List_W3D_CHUNK_BOX(ChunkItem * Item,CListCtrl * list) if (box->Attributes & W3D_BOX_ATTRIBUTE_ALIGNED) { AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_ALIGNED","flag"); } - if (box->Attributes & W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL) { - AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PHYSICAL","flag"); + if (box->Attributes & W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL) { + AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PHYSICAL","flag"); } - if (box->Attributes & W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE) { - AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBTUE_COLLISION_TYPE_PROJECTILE","flag"); + if (box->Attributes & W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE) { + AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_COLLISION_TYPE_PROJECTILE","flag"); } - if (box->Attributes & W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS) { - AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VIS","flag"); + if (box->Attributes & W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS) { + AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VIS","flag"); } - if (box->Attributes & W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA) { - AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBTUE_COLLISION_TYPE_CAMERA","flag"); + if (box->Attributes & W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA) { + AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_COLLISION_TYPE_CAMERA","flag"); } - if (box->Attributes & W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE) { - AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBTUE_COLLISION_TYPE_VEHICLE","flag"); + if (box->Attributes & W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE) { + AddItem(list,counter,"Attributes","W3D_BOX_ATTRIBUTE_COLLISION_TYPE_VEHICLE","flag"); } AddItem(list,counter,"Name",box->Name); From d731fcde06a6ba188241dde51811eeb869dad580 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 06:00:54 -0500 Subject: [PATCH 055/211] docs: Fix spelling errors in Core/Libraries comments (#2116) --- Core/Libraries/Source/Compression/EAC/codex.h | 2 +- Core/Libraries/Source/Compression/EAC/huffencode.cpp | 2 +- Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp | 2 +- Core/Libraries/Source/WWVegas/WW3D2/font3d.h | 2 +- Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp | 6 +++--- Core/Libraries/Source/WWVegas/WW3D2/intersec.inl | 2 +- Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WW3D2/rendobj.h | 6 +++--- .../Libraries/Source/WWVegas/WW3D2/shattersystem.cpp | 2 +- Core/Libraries/Source/WWVegas/WW3D2/texproject.h | 2 +- Core/Libraries/Source/WWVegas/WW3D2/textdraw.cpp | 2 +- Core/Libraries/Source/WWVegas/WW3D2/texture.h | 2 +- Core/Libraries/Source/WWVegas/WW3D2/ww3dids.h | 6 +++--- .../Source/WWVegas/WWAudio/SoundSceneObj.cpp | 2 +- .../Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h | 2 +- Core/Libraries/Source/WWVegas/WWAudio/Utils.h | 2 +- Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h | 4 ++-- Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp | 2 +- Core/Libraries/Source/WWVegas/WWDownload/Registry.h | 2 +- .../Libraries/Source/WWVegas/WWDownload/registry.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/INDEX.h | 12 ++++++------ Core/Libraries/Source/WWVegas/WWLib/Vector.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/argv.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWLib/argv.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/ffactory.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/ini.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/mempool.h | 8 ++++---- Core/Libraries/Source/WWVegas/WWLib/multilist.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/mutex.h | 2 +- Core/Libraries/Source/WWVegas/WWLib/random.cpp | 6 +++--- Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/search.h | 12 ++++++------ Core/Libraries/Source/WWVegas/WWLib/trim.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/verchk.h | 2 +- Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h | 4 ++-- Core/Libraries/Source/WWVegas/WWMath/castres.h | 2 +- .../Libraries/Source/WWVegas/WWMath/colmathaabox.cpp | 2 +- .../Source/WWVegas/WWMath/colmathaabtri.cpp | 2 +- Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp | 2 +- .../Source/WWVegas/WWMath/colmathobbobb.cpp | 4 ++-- .../Source/WWVegas/WWMath/colmathobbtri.cpp | 2 +- .../Source/WWVegas/WWMath/colmathsphere.cpp | 2 +- Core/Libraries/Source/WWVegas/WWMath/curve.h | 8 ++++---- Core/Libraries/Source/WWVegas/WWMath/obbox.cpp | 4 ++-- Core/Libraries/Source/WWVegas/WWMath/quat.cpp | 2 +- Core/Libraries/Source/WWVegas/WWMath/quat.h | 2 +- Core/Libraries/Source/WWVegas/WWMath/tri.h | 2 +- Core/Libraries/Source/WWVegas/WWMath/vector2.h | 10 +++++----- Core/Libraries/Source/WWVegas/WWMath/vector3.h | 4 ++-- Core/Libraries/Source/WWVegas/WWMath/vector4.h | 4 ++-- .../Source/WWVegas/WWSaveLoad/parameterlist.h | 4 ++-- Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h | 4 ++-- .../Source/WWVegas/WWSaveLoad/simpleparameter.h | 2 +- Core/Libraries/Source/debug/debug_cmd.h | 2 +- Core/Libraries/Source/debug/debug_debug.cpp | 2 +- Core/Libraries/Source/debug/debug_debug.h | 2 +- Core/Libraries/Source/debug/debug_macro.h | 2 +- Core/Libraries/Source/debug/test2/test2.cpp | 2 +- Core/Libraries/Source/profile/profile_funclevel.h | 4 ++-- Core/Libraries/Source/profile/profile_highlevel.h | 4 ++-- 64 files changed, 106 insertions(+), 106 deletions(-) diff --git a/Core/Libraries/Source/Compression/EAC/codex.h b/Core/Libraries/Source/Compression/EAC/codex.h index 2b80d2171fe..a0caafe6781 100644 --- a/Core/Libraries/Source/Compression/EAC/codex.h +++ b/Core/Libraries/Source/Compression/EAC/codex.h @@ -30,7 +30,7 @@ /* */ /* Version Date SE History */ /* ------- ------ -- ------- */ -/* 1.00 990824 FB codex API seperated from huff tool */ +/* 1.00 990824 FB codex API separated from huff tool */ /* 1.01 010427 FB fb6 32 bit size header */ /* 1.02 011011 FB c++ defaults */ /* 2.00 011015 FB bool, dest/source, new about struct,no QPUBLIC */ diff --git a/Core/Libraries/Source/Compression/EAC/huffencode.cpp b/Core/Libraries/Source/Compression/EAC/huffencode.cpp index db2ab7c9b30..06f51b39831 100644 --- a/Core/Libraries/Source/Compression/EAC/huffencode.cpp +++ b/Core/Libraries/Source/Compression/EAC/huffencode.cpp @@ -718,7 +718,7 @@ static void HUFF_analysis(struct HuffEncodeContext *EC, /* - maintains perfect tree - find intest code - - find intest branch thats shorter than maximum bits + - find intest branch that's shorter than maximum bits - graft one branch to the shorter branch - shorten the other code by 1 */ diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp index 441827de1c6..a100660b8de 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp @@ -765,7 +765,7 @@ int DynamicMeshClass::Set_Texture(TextureClass *texture, bool dont_search, int p Model->Initialize_Texture_Array(pass, 0, tex); tex->Release_Ref(); - // flag that we need to write the per polygon material overide array + // flag that we need to write the per polygon material override array MultiTexture[pass] = true; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/font3d.h b/Core/Libraries/Source/WWVegas/WW3D2/font3d.h index cbaf28a386d..1863fdaa0f6 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/font3d.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/font3d.h @@ -53,7 +53,7 @@ class SurfaceClass; ** 16-bit Targa files, then converted to proportional fonts by ** finding the minimum bounding box for each chacter. The font ** texture is then minimized to a 256x256 or 128x128 texture -** material by re-stacking chars by thier minimum bounding box. +** material by re-stacking chars by their minimum bounding box. ** ** During use, this class is really no more than a data table accessor ** Only during creation is any real code run. diff --git a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp index 7e69ad6bc2e..e6303a8fb42 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -314,7 +314,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) add_channel(tc_chan); } else { // PWG 12-14-98: we have only allocated space for NumNode pivots. - // If we have an index thats equal or higher than NumNode we are + // If we have an index that's equal or higher than NumNode we are // gonna trash memory. Boy will we trash memory. // GTH 09-25-2000: print a warning and survive this error delete tc_chan; @@ -331,7 +331,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) add_channel(ad_chan); } else { // PWG 12-14-98: we have only allocated space for NumNode pivots. - // If we have an index thats equal or higher than NumNode we are + // If we have an index that's equal or higher than NumNode we are // gonna trash memory. Boy will we trash memory. // GTH 09-25-2000: print a warning and survive this error delete ad_chan; @@ -349,7 +349,7 @@ int HCompressedAnimClass::Load_W3D(ChunkLoadClass & cload) add_bit_channel(newbitchan); } else { // PWG 12-14-98: we have only allocated space for NumNode pivots. - // If we have an index thats equal or higher than NumNode we are + // If we have an index that's equal or higher than NumNode we are // gonna trash memory. Boy will we trash memory. // GTH 09-25-2000: print a warning and survive this error delete newbitchan; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/intersec.inl b/Core/Libraries/Source/WWVegas/WW3D2/intersec.inl index db4027ba455..3fc05e586fb 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/intersec.inl +++ b/Core/Libraries/Source/WWVegas/WW3D2/intersec.inl @@ -150,7 +150,7 @@ inline bool IntersectionClass::_Point_In_Polygon_Z( Vector3 &Corner3 ) { -// these defines could be variables if support for other axis were neccessary +// these defines could be variables if support for other axis were necessary #define AXIS_1 0 #define AXIS_2 1 #define AXIS_3 2 diff --git a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp index bc938a38590..d2fec946b20 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp @@ -190,7 +190,7 @@ TextureClass * MaterialRemapperClass::Remap_Texture(TextureClass * src) return TextureRemaps[i].Dest; } } - WWASSERT(0); // uh-oh didn't find the texture, what happend??? + WWASSERT(0); // uh-oh didn't find the texture, what happened??? return nullptr; } @@ -205,7 +205,7 @@ VertexMaterialClass * MaterialRemapperClass::Remap_Vertex_Material(VertexMateria return VertexMaterialRemaps[i].Dest; } } - WWASSERT(0); // uh-oh didn't find the material, what happend??? + WWASSERT(0); // uh-oh didn't find the material, what happened??? return nullptr; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp index 55b052fa54a..46d037b9330 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp @@ -1182,7 +1182,7 @@ void RenderObjClass::Add_Dependencies_To_List /**************************************************************************************** - RenderObjClass - Persistant object support. + RenderObjClass - Persistent object support. NOTE: For now, the render obj PersistFactory is going to cheat by simply storing the name of the render object that was saved. At load time, it will ask the @@ -1301,7 +1301,7 @@ bool RenderObjClass::Save (ChunkSaveClass &csave) { // This should never hit with the persist factory we're using... // Yes this looks like a design flaw but the way we're saving render objects is - // a "shortcut". We specifically designed this capability into the persistant + // a "shortcut". We specifically designed this capability into the persistent // object system so that we could avoid making all render object's save and // load themselves if possible. WWASSERT(0); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h index d629a7be3fb..0b4861c00bd 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h @@ -157,7 +157,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL //Added for 'Generals' - MW enum {USER_DATA_MATERIAL_OVERRIDE = 0x01234567}; - //This strucutre is used to pass custom rendering parameters into the W3D + //This structure is used to pass custom rendering parameters into the W3D //mesh renderer so it can override settings which are usually shared across //all instances of a model - typically material settings like alpha, texture //animation, texture uv scrolling, etc. Added for 'Generals' -MW @@ -253,7 +253,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Render Object Interface - "Scene Graph" // Some of the functions in this group are non-virtual as they are meant - // to be never overriden or are supposed to be implemented in terms of + // to be never overridden or are supposed to be implemented in terms of // the other virtual functions. We want to keep the virtual interface // as small as possible /////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -483,7 +483,7 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL int Is_Self_Shadowed() const { return (Bits&IS_SELF_SHADOWED); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Persistant object save-load interface + // Persistent object save-load interface /////////////////////////////////////////////////////////////////////////////////////////////////////////////// virtual const PersistFactoryClass & Get_Factory (void) const; virtual bool Save (ChunkSaveClass &csave); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp index 9f43d6062d2..6902a26422e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp @@ -174,7 +174,7 @@ class PolygonClass ** plane. The plane is defined by the x-y plane of the coordinate system ** (i.e. z-axis is the normal of the plane, origin is a point on the plane). ** Leaf nodes of this tree will have two indices. These are indices into -** the MeshFragments array where they put the polygons in thier front and +** the MeshFragments array where they put the polygons in their front and ** back half-spaces. */ class BSPClass diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texproject.h b/Core/Libraries/Source/WWVegas/WW3D2/texproject.h index d14ff60ea41..bd3d5449cc0 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texproject.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/texproject.h @@ -86,7 +86,7 @@ class ZTextureClass; ** bounding volume first, then defer computing the actual texture until it is ** determined that the volume falls into the frustum and is applied to at least one ** object. -** solution: Code the bounding volume/projection paramter generation separate from +** solution: Code the bounding volume/projection parameter generation separate from ** the texture generation code. A derived texture projection object. Let texture ** projectors know about the object they are projecting so that they can have that ** object rendered from the desired viewpoint. Need a 'Dirty' flag and a pointer to diff --git a/Core/Libraries/Source/WWVegas/WW3D2/textdraw.cpp b/Core/Libraries/Source/WWVegas/WW3D2/textdraw.cpp index 281eac76ae5..eed9f5744dc 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/textdraw.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/textdraw.cpp @@ -267,7 +267,7 @@ float TextDrawClass::Print( Font3DInstanceClass *font, char ch, float screen_x, } /* - ** Get the font texture uv coordinate for teh upper right and lower left corners of the rect + ** Get the font texture uv coordinate for the upper right and lower left corners of the rect */ RectClass font_uv = font->Char_UV( ch ); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texture.h b/Core/Libraries/Source/WWVegas/WW3D2/texture.h index 8903caacb46..2239ec38d95 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texture.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/texture.h @@ -301,7 +301,7 @@ class TextureClass : public TextureBaseClass TextureClass(IDirect3DBaseTexture8* d3d_texture); - // defualt constructors for derived classes (cube & vol) + // default constructors for derived classes (cube & vol) TextureClass ( unsigned width, diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ww3dids.h b/Core/Libraries/Source/WWVegas/WW3D2/ww3dids.h index d308fcab62b..d6609919bfc 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ww3dids.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/ww3dids.h @@ -39,12 +39,12 @@ #include "saveloadids.h" /* -** These are the chunk-id's used by all persistant objects in WW3D. The persistant object +** These are the chunk-id's used by all persistent objects in WW3D. The persistent object ** framework is defined in the WWSaveLoad library. ** ** Sept 23, 1999 -** - Initial implementation of making the Commando engine persistant included making some -** of WW3D persistant. For this initial implementation, we're going to assume that we +** - Initial implementation of making the Commando engine persistent included making some +** of WW3D persistent. For this initial implementation, we're going to assume that we ** can re-create all of our game objects from the asset manager and patch up any state ** changes with custom game object code. Therefore, the base class RenderObjClass has ** a persist manager which simply saves the name of the render object and its transform diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp index 7e5f4fc6c2f..a0efe123fdf 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp @@ -69,7 +69,7 @@ CriticalSectionClass SoundSceneObjClass::m_IDListMutex; ////////////////////////////////////////////////////////////////////////////////// -// Mutex managment +// Mutex management ////////////////////////////////////////////////////////////////////////////////// /* class HandleMgrClass diff --git a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h index 0be511429e2..384d35cf81b 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h @@ -190,7 +190,7 @@ class SoundSceneObjClass : public MultiListObjectClass, public PersistClass, pub virtual void Set_Cullable_Wrapper (SoundCullObjClass *obj) { m_PhysWrapper = obj; } ////////////////////////////////////////////////////////////////////// - // Sound object managment + // Sound object management ////////////////////////////////////////////////////////////////////// static void Register_Sound_Object (SoundSceneObjClass *sound_obj); static void Unregister_Sound_Object (SoundSceneObjClass *sound_obj); diff --git a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h index d8f3d311b67..49af4be2615 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h @@ -74,7 +74,7 @@ class MMSLockClass __inline LPCTSTR Get_Filename_From_Path (LPCTSTR path) { - // Find the last occurance of the directory deliminator + // Find the last occurrence of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); if (filename != nullptr) { // Increment past the directory deliminator diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp index 582632827df..ca2a18ac0af 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -184,7 +184,7 @@ WWAudioClass::~WWAudioClass (void) void WWAudioClass::Flush_Cache (void) { - // Loop through all the hash indicies + // Loop through all the hash indices for (int hash_index = 0; hash_index < MAX_CACHE_HASH; hash_index ++) { // Loop through all the buffers at this hash index and free them all @@ -459,7 +459,7 @@ WWAudioClass::Free_Cache_Space (int bytes) { int bytes_freed = 0; - // Loop through all the hash indicies + // Loop through all the hash indices for (int hash_index = 0; (hash_index < MAX_CACHE_HASH) && (bytes_freed < bytes); hash_index ++) { diff --git a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h index 1b6a4ee5c8e..94c8e73b597 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h @@ -174,7 +174,7 @@ class WWAudioClass // // Note: After call Initialize () you can begin using the library, you don't - // need to explicity call Open_2D_Device () or Select_3D_Device (). Those + // need to explicitly call Open_2D_Device () or Select_3D_Device (). Those // methods were provided as a means of opening devices other than the default. // // The Initialize () method defaults to a stereo, 16bit, 44100hz 2D DirectSound @@ -560,7 +560,7 @@ class WWAudioClass DynamicVectorClass m_2DSampleHandles; DynamicVectorClass m_3DSampleHandles; - // Playlist managment + // Playlist management DynamicVectorClass m_Playlist; DynamicVectorClass m_CompletedSounds; diff --git a/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp b/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp index e900491f4e7..e0ff1106ad5 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp @@ -300,7 +300,7 @@ int Cftp::AsyncGetHostByName(char * szName, struct sockaddr_in &address ) * HRESULT Cftp::ConnectToServer(LPCSTR szServerName) * * $_Description : -* Overloaded funciton that makes a connection to a server. Will probably +* Overloaded function that makes a connection to a server. Will probably * fail on (at least) the first call, as it may take a while for the server * to send it's "ready" reply. * diff --git a/Core/Libraries/Source/WWVegas/WWDownload/Registry.h b/Core/Libraries/Source/WWVegas/WWDownload/Registry.h index 527e9adfde1..c8f0b5cda64 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/Registry.h +++ b/Core/Libraries/Source/WWVegas/WWDownload/Registry.h @@ -17,7 +17,7 @@ */ // Registry.h -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #pragma once diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index d553df93db3..d31c4222fd9 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -17,7 +17,7 @@ */ // Registry.cpp -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #include diff --git a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h index c2e72bcba99..8a45d4dc7fa 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h +++ b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h @@ -106,7 +106,7 @@ class FastAllocatorGeneral; //Allocates and deletes items of any size. Can use // StackAllocator stackAllocator; //Create an instance. We use the 'construct' hint feature here. // int** pArray = stackAllocator.New(nSize); //Allocate memory. // memset(pArray, 0, nSize*sizeof(int*)); //Do something with the memory. -// stackAllocator.Delete(pArray); //In this example, we explicity free the memory. +// stackAllocator.Delete(pArray); //In this example, we explicitly free the memory. // } // // void Example(int nSize){ diff --git a/Core/Libraries/Source/WWVegas/WWLib/INDEX.h b/Core/Libraries/Source/WWVegas/WWLib/INDEX.h index 219dc2c8536..f73d81c2f83 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/INDEX.h +++ b/Core/Libraries/Source/WWVegas/WWLib/INDEX.h @@ -40,7 +40,7 @@ * IndexClass::IndexClass -- Constructor for index handler. * * IndexClass::Invalidate_Archive -- Invalidate the archive pointer. * * IndexClass::Is_Archive_Same -- Checks to see if archive pointer is same as index. * - * IndexClass::Is_Present -- Checks for presense of index entry. * + * IndexClass::Is_Present -- Checks for presence of index entry. * * IndexClass::Remove_Index -- Find matching index and remove it from system. * * IndexClass::Search_For_Node -- Perform a search for the specified node ID * * IndexClass::Set_Archive -- Records the node pointer into the archive. * @@ -327,12 +327,12 @@ bool IndexClass::Increase_Table_Size(int amount) /*********************************************************************************************** * IndexClass::Count -- Fetch the number of index entries recorded. * * * - * This will return the quantity of index entries that have been recored by this index * + * This will return the quantity of index entries that have been recorded by this index * * handler. * * * * INPUT: none * * * - * OUTPUT: Returns with number of recored indecies present. * + * OUTPUT: Returns with number of recorded indices present. * * * * WARNINGS: none * * * @@ -347,7 +347,7 @@ int IndexClass::Count(void) const /*********************************************************************************************** - * IndexClass::Is_Present -- Checks for presense of index entry. * + * IndexClass::Is_Present -- Checks for presence of index entry. * * * * This routine will scan for the specified index entry. If it was found, then 'true' is * * returned. * @@ -414,7 +414,7 @@ bool IndexClass::Is_Present(INDEX const & id) const * * * WARNINGS: This routine presumes that the index exists. If it doesn't exist, then the * * default constructed object "T" is returned instead. To avoid this problem, * - * always verfiy the existance of the index by calling Is_Present() first. * + * always verfiy the existence of the index by calling Is_Present() first. * * * * HISTORY: * * 11/02/1996 JLB : Created. * @@ -653,7 +653,7 @@ bool IndexClass::Remove_Index(INDEX const & id) * * * OUTPUT: Returns with the comparision value between the two nodes. * * * - * WARNINGS: This is highly dependant upon the layout of the NodeElement structure. * + * WARNINGS: This is highly dependent upon the layout of the NodeElement structure. * * * * HISTORY: * * 11/02/1996 JLB : Created. * diff --git a/Core/Libraries/Source/WWVegas/WWLib/Vector.h b/Core/Libraries/Source/WWVegas/WWLib/Vector.h index c610aea2201..3c2cae49cbf 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Vector.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Vector.h @@ -656,7 +656,7 @@ int DynamicVectorClass::ID(T const & object) * DynamicVectorClass::Add -- Add an element to the vector. * * * * Use this routine to add an element to the vector. The vector will automatically be * - * resized to accomodate the new element IF the vector was allocated previously and the * + * resized to accommodate the new element IF the vector was allocated previously and the * * growth rate is not zero. * * * * INPUT: object -- Reference to the object that will be added to the vector. * diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp index e1d35885706..58f33c1ba7f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp @@ -54,7 +54,7 @@ char *ArgvClass::Argv[MAX_ARGC]; * * * INPUT: * * bool case_sensitive - Do you want to perform a case sensitive search (stricmp)? * - * bool exact_size - Do you want string of same lenght (strncmp) ? * + * bool exact_size - Do you want string of same length (strncmp) ? * * * * OUTPUT: * * * @@ -142,7 +142,7 @@ const char *ArgvClass::Find_Again(const char *arg) * ArgvClass::Init -- Setup the command line. * * * * INPUT: * - * LPSTR lpCmdLine - A string of white space seperated strings. Quotes force spaces to * + * LPSTR lpCmdLine - A string of white space separated strings. Quotes force spaces to * * be ignored. * * char *fileprefix - A prefix on an arguement telling system to load postfix file name * * as command line params. * diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.h b/Core/Libraries/Source/WWVegas/WWLib/argv.h index 898305094a3..15cae760e18 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.h +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.h @@ -46,7 +46,7 @@ // If there is a arguement (for example @file.arg) then the fname is loaded up, // parsed, and put into the command line. The format of the parameter file is as follows: // 1. a semicolon (;) at the start of the line is a comment and will be ignored. -// 2. Each line is a seperate parameter. This enables white space to be embeded. +// 2. Each line is a separate parameter. This enables white space to be embeded. // In typical Argv implementation, the first argument is the name of the application. This // is not the case with this. class ArgvClass diff --git a/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp b/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp index d019fc6ad20..88b0003ac2b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp @@ -270,7 +270,7 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename ) if (!SubDirectory.Is_Empty()) { // - // SubDirectory may contain a semicolon seperated search path... + // SubDirectory may contain a semicolon separated search path... // If the file doesn't exist, we'll set the path to the last dir in // the search path. Therefore newly created files will always go in the // last dir in the search path. diff --git a/Core/Libraries/Source/WWVegas/WWLib/ffactory.h b/Core/Libraries/Source/WWVegas/WWLib/ffactory.h index cb7acc11c16..77b70ab6e3d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ffactory.h +++ b/Core/Libraries/Source/WWVegas/WWLib/ffactory.h @@ -126,7 +126,7 @@ class SimpleFileFactoryClass : public FileFactoryClass { virtual FileClass * Get_File( char const *filename ); virtual void Return_File( FileClass *file ); - // sub_directory may be a semicolon seperated search path. New files will always + // sub_directory may be a semicolon separated search path. New files will always // go in the last dir in the path. void Get_Sub_Directory( StringClass& new_dir ) const; void Set_Sub_Directory( const char * sub_directory ); diff --git a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp index 4d6df821bb0..c0b47876263 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp @@ -386,7 +386,7 @@ int INIClass::Load(const char *filename) * 09/29/1997 JLB : Handles the merging case. * * 12/09/1997 EHC : Detects duplicate entry CRCs and fails in that case * * 03/22/2001 AJA : Treat "foobar=" as a valid entry with value " ". * - * 08/23/2001 AJA : Make the loading of "foobar=" dependant on the KeepBlankEntries flag. * + * 08/23/2001 AJA : Make the loading of "foobar=" dependent on the KeepBlankEntries flag. * *=============================================================================================*/ int INIClass::Load(Straw & ffile) { diff --git a/Core/Libraries/Source/WWVegas/WWLib/mempool.h b/Core/Libraries/Source/WWVegas/WWLib/mempool.h index fcf370bb6a6..df32692e96b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mempool.h +++ b/Core/Libraries/Source/WWVegas/WWLib/mempool.h @@ -38,8 +38,8 @@ * ObjectPoolClass::Free_Object -- releases obj back into the pool * * ObjectPoolClass::Allocate_Object_Memory -- internal function which returns memory for an * * ObjectPoolClass::Free_Object_Memory -- internal function, returns object's memory to the * - * AutoPoolClass::operator new -- overriden new which calls the internal ObjectPool * - * AutoPoolClass::operator delete -- overriden delete which calls the internal ObjectPool * + * AutoPoolClass::operator new -- overridden new which calls the internal ObjectPool * + * AutoPoolClass::operator delete -- overridden delete which calls the internal ObjectPool * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once @@ -330,7 +330,7 @@ void ObjectPoolClass::Free_Object_Memory(T * obj) /*********************************************************************************************** - * AutoPoolClass::operator new -- overriden new which calls the internal ObjectPool * + * AutoPoolClass::operator new -- overridden new which calls the internal ObjectPool * * * * INPUT: * * * @@ -350,7 +350,7 @@ void * AutoPoolClass::operator new( size_t size ) /*********************************************************************************************** - * AutoPoolClass::operator delete -- overriden delete which calls the internal ObjectPool * + * AutoPoolClass::operator delete -- overridden delete which calls the internal ObjectPool * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp b/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp index 49461c67b89..bc06cc6c0b3 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/multilist.cpp @@ -40,7 +40,7 @@ #include "wwmemlog.h" /* -** Delcare the pool for ListNodes +** Declare the pool for ListNodes */ DEFINE_AUTO_POOL(MultiListNodeClass, 256); diff --git a/Core/Libraries/Source/WWVegas/WWLib/mutex.h b/Core/Libraries/Source/WWVegas/WWLib/mutex.h index 2c0c8cfbbe9..a9c106ce196 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mutex.h +++ b/Core/Libraries/Source/WWVegas/WWLib/mutex.h @@ -40,7 +40,7 @@ class MutexClass unsigned locked; // Lock and unlock are private so that you can't use them directly. Use LockClass as a sentry instead! - // Lock returns true if lock was succesful, false otherwise + // Lock returns true if lock was successful, false otherwise bool Lock(int time); void Unlock(); diff --git a/Core/Libraries/Source/WWVegas/WWLib/random.cpp b/Core/Libraries/Source/WWVegas/WWLib/random.cpp index 3ebbd227e83..a99576267f4 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/random.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/random.cpp @@ -56,7 +56,7 @@ Time for Random3=1.281000 Time for Random4=0.375000 Time for Built in Rand()=0.813000 Results from DIEHARD battery of tests -A p-value of 0.0 or 1.0 means it fails. Anything inbetween is ok. +A p-value of 0.0 or 1.0 means it fails. Anything in between is ok. R0 - FAILED almost all tests, didn't complete squeeze test R2 - Passed all tests, p-value 0.6 R3 - Failed 11 of 253 tests, p-value 1.0 @@ -211,7 +211,7 @@ int Random2Class::operator() (void) * This routine will generate a random number between the two values specified. It uses * * a method that will not bias the values in any way. * * * - * INPUT: minval -- The minium return value (inclusive). * + * INPUT: minval -- The minimum return value (inclusive). * * * * maxval -- The maximum return value (inclusive). * * * @@ -320,7 +320,7 @@ int Random3Class::operator() (void) * This routine will generate a random number between the two values specified. It uses * * a method that will not bias the values in any way. * * * - * INPUT: minval -- The minium return value (inclusive). * + * INPUT: minval -- The minimum return value (inclusive). * * * * maxval -- The maximum return value (inclusive). * * * diff --git a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp index bcc20a10d89..2f88162d4a2 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp @@ -755,7 +755,7 @@ int RawFileClass::Seek(int pos, int dir) /* ** A file that is biased will have a seek operation modified so that the file appears to ** exist only within the bias range. All bytes outside of this range appear to be - ** non-existant. + ** non-existent. */ if (BiasLength != -1) { switch (dir) { diff --git a/Core/Libraries/Source/WWVegas/WWLib/search.h b/Core/Libraries/Source/WWVegas/WWLib/search.h index fbe7c0bc336..1c88c488adf 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/search.h +++ b/Core/Libraries/Source/WWVegas/WWLib/search.h @@ -40,7 +40,7 @@ * IndexClass::IndexClass -- Constructor for index handler. * * IndexClass::Invalidate_Archive -- Invalidate the archive pointer. * * IndexClass::Is_Archive_Same -- Checks to see if archive pointer is same as index. * - * IndexClass::Is_Present -- Checks for presense of index entry. * + * IndexClass::Is_Present -- Checks for presence of index entry. * * IndexClass::Remove_Index -- Find matching index and remove it from system. * * IndexClass::Search_For_Node -- Perform a search for the specified node ID * * IndexClass::Set_Archive -- Records the node pointer into the archive. * @@ -325,12 +325,12 @@ bool IndexClass::Increase_Table_Size(int amount) /*********************************************************************************************** * IndexClass::Count -- Fetch the number of index entries recorded. * * * - * This will return the quantity of index entries that have been recored by this index * + * This will return the quantity of index entries that have been recorded by this index * * handler. * * * * INPUT: none * * * - * OUTPUT: Returns with number of recored indecies present. * + * OUTPUT: Returns with number of recorded indices present. * * * * WARNINGS: none * * * @@ -345,7 +345,7 @@ int IndexClass::Count(void) const /*********************************************************************************************** - * IndexClass::Is_Present -- Checks for presense of index entry. * + * IndexClass::Is_Present -- Checks for presence of index entry. * * * * This routine will scan for the specified index entry. If it was found, then 'true' is * * returned. * @@ -412,7 +412,7 @@ bool IndexClass::Is_Present(int id) const * * * WARNINGS: This routine presumes that the index exists. If it doesn't exist, then the * * default constructed object "T" is returned instead. To avoid this problem, * - * always verfiy the existance of the index by calling Is_Present() first. * + * always verfiy the existence of the index by calling Is_Present() first. * * * * HISTORY: * * 11/02/1996 JLB : Created. * @@ -626,7 +626,7 @@ bool IndexClass::Remove_Index(int id) * * * OUTPUT: Returns with the comparision value between the two nodes. * * * - * WARNINGS: This is highly dependant upon the layout of the NodeElement structure. * + * WARNINGS: This is highly dependent upon the layout of the NodeElement structure. * * * * HISTORY: * * 11/02/1996 JLB : Created. * diff --git a/Core/Libraries/Source/WWVegas/WWLib/trim.cpp b/Core/Libraries/Source/WWVegas/WWLib/trim.cpp index 36a39d02114..ccc97c2ff88 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/trim.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/trim.cpp @@ -44,7 +44,7 @@ /*********************************************************************************************** * strtrim -- Trim leading and trailing white space off of string. * * * - * This routine will remove the leading and trailing whitespace from the string specifed. * + * This routine will remove the leading and trailing whitespace from the string specified. * * The string is modified in place. * * * * INPUT: buffer -- Pointer to the string to be trimmed. * diff --git a/Core/Libraries/Source/WWVegas/WWLib/verchk.h b/Core/Libraries/Source/WWVegas/WWLib/verchk.h index 2dbebead96d..6f5d492c434 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/verchk.h +++ b/Core/Libraries/Source/WWVegas/WWLib/verchk.h @@ -41,7 +41,7 @@ // Obtain version information from the specified file. bool GetVersionInfo(char* filename, VS_FIXEDFILEINFO* fileInfo); -// Retreive creation time of specified file. +// Retrieve creation time of specified file. bool GetFileCreationTime(char* filename, FILETIME* createTime); //////////////////////////////////////////////////////////////////////// diff --git a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h index fb075825bf3..c0009909155 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h +++ b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h @@ -72,9 +72,9 @@ class AABTreeCullSystemClass : public CullSystemClass /* ** Update_Bounding_Boxes. This function causes all bounding boxes in the tree to update themselves. ** If any box is found to not bound the objects it is supposed to contain, the box is updated - ** Note that this is normally not necessary, the reason this function existsis due to the fact + ** Note that this is normally not necessary, the reason this function exists is due to the fact ** that the renegade level editor tries to do everything possible to not discard the precalculated - ** visibilty data for a level. In some cases, we want to load geometry that has been edited back + ** visibility data for a level. In some cases, we want to load geometry that has been edited back ** into the same AABTree without re-partitioning. */ void Update_Bounding_Boxes(void); diff --git a/Core/Libraries/Source/WWVegas/WWMath/castres.h b/Core/Libraries/Source/WWVegas/WWMath/castres.h index 69a577df6fe..dc45230c745 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/castres.h +++ b/Core/Libraries/Source/WWVegas/WWMath/castres.h @@ -56,7 +56,7 @@ struct CastResultStruct CastResultStruct(void) { Reset(); } void Reset(void) { StartBad = false; Fraction = 1.0f; Normal.Set(0,0,0); SurfaceType = 0; ComputeContactPoint = false; ContactPoint.Set(0,0,0); } - bool StartBad; // was the inital configuration interpenetrating something? + bool StartBad; // was the initial configuration interpenetrating something? float Fraction; // fraction of the move up until collision Vector3 Normal; // surface normal at the collision point uint32 SurfaceType; // surface type of polygon at collision point (see W3D_SURFACE_TYPES in w3d_file.h) diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathaabox.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathaabox.cpp index 03c23aaca5b..decb97274f4 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathaabox.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathaabox.cpp @@ -449,7 +449,7 @@ struct AABCollisionStruct Vector3::Subtract(move1,move0,&M); // move vector relative to stationary box0 } - bool StartBad; // Inital configuration is intersecting? + bool StartBad; // Initial configuration is intersecting? float MaxFrac; // Longest move allowed so far int AxisId; // Last separating axis int Side; // which side of the interval diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp index 3a94671a51e..639f4925dc6 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathaabtri.cpp @@ -146,7 +146,7 @@ struct BTCollisionStruct Vector3::Cross_Product(E[0],E[1],&N); } - bool StartBad; // Inital configuration is intersecting? + bool StartBad; // Initial configuration is intersecting? float MaxFrac; // Longest move allowed so far int AxisId; // Last separating axis diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp index c7a0ec0bf3d..c55036b636d 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp @@ -48,7 +48,7 @@ /* ** Structure used in the line->box test. There was a lot of common code between the axis- -** aligned and oriented box tests so I package all of the truely relevant information into +** aligned and oriented box tests so I package all of the truly relevant information into ** this struct and pass it into a function local to this module. In the case of oriented ** boxes, the ray must be transformed into the box's coordinate system prior to the call ** and the normal is calculated slightly differently. diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathobbobb.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathobbobb.cpp index be254af2655..9af3fd1e007 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathobbobb.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathobbobb.cpp @@ -536,7 +536,7 @@ struct ObbCollisionStruct B[2].Set(box1.Basis[0][2],box1.Basis[1][2],box1.Basis[2][2]); } - bool StartBad; // Inital configuration is intersecting? + bool StartBad; // Initial configuration is intersecting? float MaxFrac; // Longest move allowed so far int AxisId; // Last separating axis int Side; // which side of the interval @@ -1314,7 +1314,7 @@ bool collide_obb_obb /* ** If our fraction is smaller, override the previous - ** values because our collision occured first. + ** values because our collision occurred first. */ if (context.MaxFrac < result->Fraction) { diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathobbtri.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathobbtri.cpp index 858c2aee20d..0fb50cce896 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathobbtri.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathobbtri.cpp @@ -167,7 +167,7 @@ struct BTCollisionStruct Vector3::Cross_Product(E[0],E[1],&N); } - bool StartBad; // Inital configuration is intersecting? + bool StartBad; // Initial configuration is intersecting? float MaxFrac; // Longest move allowed so far int AxisId; // Last separating axis int Point; // Index of the "closest" triangle point (or one of them) diff --git a/Core/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp b/Core/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp index c951728306d..1485c2efc19 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp @@ -54,7 +54,7 @@ #include "wwdebug.h" -// Sphere Intersection fucntions. Does the sphere intersect the passed in object +// Sphere Intersection functions. Does the sphere intersect the passed in object /*********************************************************************************************** * CollisionMath::Intersection_Test -- Sphere - AAbox intersection * * * diff --git a/Core/Libraries/Source/WWVegas/WWMath/curve.h b/Core/Libraries/Source/WWVegas/WWMath/curve.h index 40838a54457..26dab2eafc8 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/curve.h +++ b/Core/Libraries/Source/WWVegas/WWMath/curve.h @@ -66,7 +66,7 @@ class Curve3DClass : public PersistClass float Get_Start_Time(void); float Get_End_Time(void); - // persistant object support + // persistent object support virtual bool Save (ChunkSaveClass &csave); virtual bool Load (ChunkLoadClass &cload); @@ -93,7 +93,7 @@ class LinearCurve3DClass : public Curve3DClass public: virtual void Evaluate(float time,Vector3 * set_val); - // persistant object support + // persistent object support virtual const PersistFactoryClass & Get_Factory(void) const; virtual bool Save(ChunkSaveClass &csave); virtual bool Load(ChunkLoadClass &cload); @@ -124,7 +124,7 @@ class Curve1DClass : public PersistClass float Get_Start_Time(void); float Get_End_Time(void); - // persistant object support + // persistent object support virtual bool Save (ChunkSaveClass &csave); virtual bool Load (ChunkLoadClass &cload); @@ -152,7 +152,7 @@ class LinearCurve1DClass : public Curve1DClass public: virtual void Evaluate(float time,float * set_val); - // persistant object support + // persistent object support virtual const PersistFactoryClass & Get_Factory(void) const; virtual bool Save(ChunkSaveClass &csave); virtual bool Load(ChunkLoadClass &cload); diff --git a/Core/Libraries/Source/WWVegas/WWMath/obbox.cpp b/Core/Libraries/Source/WWVegas/WWMath/obbox.cpp index e92787a274c..68aa7c48456 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/obbox.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/obbox.cpp @@ -37,7 +37,7 @@ * Functions: * * OBBoxClass::OBBoxClass -- Constructor that computes the box for a set of point * * OBBoxClass::Init_From_Box_Points -- Create an OBBox from 8 corners of a box * - * OBBoxClass::Init_Random -- initalize a random oriented box * + * OBBoxClass::Init_Random -- initialize a random oriented box * * Oriented_Boxes_Intersect_On_Axis -- test if two boxes intersect on given axis * * Oriented_Boxes_Intersect -- test if two oriented boxes intersect * * Oriented_Boxes_Collide_On_Axis -- test if two boxes collide on the given axis * @@ -277,7 +277,7 @@ void OBBoxClass::Init_From_Box_Points(Vector3 * points,int num) /*********************************************************************************************** - * OBBoxClass::Init_Random -- initalize a random oriented box * + * OBBoxClass::Init_Random -- initialize a random oriented box * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWMath/quat.cpp b/Core/Libraries/Source/WWVegas/WWMath/quat.cpp index 6862836cb74..000561ca548 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/quat.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/quat.cpp @@ -354,7 +354,7 @@ void __cdecl Fast_Slerp(Quaternion& res, const Quaternion & p,const Quaternion & fmul st(0),st(1) // theta * (sin_table_size/2) fadd st(0),st(1) // theta * (sin_table_size/2) + (sin_table_size/2) - fistp beta // conver to integer + fistp beta // convert to integer mov ecx,SIN_TABLE_SIZE_MASK mov eax,beta and eax,ecx // & SIN_TABLE_SIZE_MASK diff --git a/Core/Libraries/Source/WWVegas/WWMath/quat.h b/Core/Libraries/Source/WWVegas/WWMath/quat.h index 85290f507ce..782b6b19698 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/quat.h +++ b/Core/Libraries/Source/WWVegas/WWMath/quat.h @@ -126,7 +126,7 @@ WWINLINE Quaternion operator + (const Quaternion & a,const Quaternion & b) return Quaternion(a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]); } -// Subract two quaternions +// Subtract two quaternions WWINLINE Quaternion operator - (const Quaternion & a,const Quaternion & b) { return Quaternion(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]); diff --git a/Core/Libraries/Source/WWVegas/WWMath/tri.h b/Core/Libraries/Source/WWVegas/WWMath/tri.h index 77c9889e0bf..e2e60c692d0 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/tri.h +++ b/Core/Libraries/Source/WWVegas/WWMath/tri.h @@ -49,7 +49,7 @@ ** The initial reason for this class is for Commando's collision detection code. Initially ** I wrote custom code inside the render object for the terrain to perform collision ** detection. Moving the low-level geometrical collision code into the math library makes it -** more re-useable and independent from changes in the rendering code. +** more re-usable and independent from changes in the rendering code. */ class TriClass { diff --git a/Core/Libraries/Source/WWVegas/WWMath/vector2.h b/Core/Libraries/Source/WWVegas/WWMath/vector2.h index 1540a6373c2..583378a9055 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector2.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector2.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Detemine if two vectors are identical * * Equal_Within_Epsilon -- Determine if two vectors are identical within * @@ -45,7 +45,7 @@ * Vector2::Is_Valid -- Verifies that all components are valid floats * * Vector2::Update_Min -- sets each component of the vector to the min of this and a. * * Vector2::Update_Max -- sets each component of the vector to the max of this and a. * - * Vector2::Scale -- multiply components of a vector by independant scaling factors. * + * Vector2::Scale -- multiply components of a vector by independent scaling factors. * * Vector2::Lerp -- linearly interpolates two Vector2's * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -215,7 +215,7 @@ WWINLINE Vector2 operator + (const Vector2 &a,const Vector2 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * @@ -545,7 +545,7 @@ WWINLINE void Vector2::Update_Max (const Vector2 & a) /*********************************************************************************************** - * Vector2::Scale -- multiply components of a vector by independant scaling factors. * + * Vector2::Scale -- multiply components of a vector by independent scaling factors. * * * * INPUT: * * * @@ -564,7 +564,7 @@ WWINLINE void Vector2::Scale (float a, float b) /*********************************************************************************************** - * Vector2::Scale -- multiply components of a vector by independant scaling factors. * + * Vector2::Scale -- multiply components of a vector by independent scaling factors. * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWMath/vector3.h b/Core/Libraries/Source/WWVegas/WWMath/vector3.h index 5f5339d33d1..595e42aa052 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector3.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector3.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Determine if two vectors are identical * * Vector Inequality Operator -- Determine if two vectors are identical * @@ -252,7 +252,7 @@ WWINLINE Vector3 operator + (const Vector3 &a,const Vector3 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWMath/vector4.h b/Core/Libraries/Source/WWVegas/WWMath/vector4.h index a512aaad300..0901e2b6c69 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector4.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector4.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Detemine if two vectors are identical * * Vector Inequality Operator -- Detemine if two vectors are identical * @@ -179,7 +179,7 @@ WWINLINE Vector4 operator + (const Vector4 &a,const Vector4 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h index 98167b5701a..10c6e130712 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h @@ -101,7 +101,7 @@ ParameterListClass::Add (void *data, const char *param_name, ParameterClass::Typ ParameterClass *new_param = ParameterClass::Construct (type, data, param_name); // - // Add the new paramter object to our list + // Add the new parameter object to our list // WWASSERT (new_param != nullptr); if (new_param != nullptr) { @@ -118,7 +118,7 @@ inline void ParameterListClass::Add (ParameterClass *new_param) { // - // Add the new paramter object to our list + // Add the new parameter object to our list // if (new_param != nullptr) { DynamicVectorClass::Add (new_param); diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h index 7bb19a0e9e0..137818210a8 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h @@ -70,7 +70,7 @@ class ChunkLoadClass; // // To achive this, we developed several core concepts: // -// - Persistant Objects: Most of the state of the game is contained in the objects +// - Persistent Objects: Most of the state of the game is contained in the objects // active at any given time. PersistClass is an abstract interface which will allow // objects to be used with the save-load system. It was also important to keep the // overhead caused by inheriting this class to an absolute minimum. @@ -90,7 +90,7 @@ class ChunkLoadClass; // (derived from SaveLoadSubSystemClass). The application in-effect creates file formats // by simply having the sub-systems that it wants write into a file. In this way you can // achieve things like saving only static data into one file and dynamic into another, etc. -// All persistant objects that get saved will be told to save by some sub-system. For +// All persistent objects that get saved will be told to save by some sub-system. For // example: in Commando, I have a PhysicsDynamicDataSubSystem which saves all of the // dynamic physics objects. In saving those objects I use the built-in PersistFactories // and am therefore completely safe from new object types being added to the system, it will just diff --git a/Core/Libraries/Source/WWVegas/WWSaveLoad/simpleparameter.h b/Core/Libraries/Source/WWVegas/WWSaveLoad/simpleparameter.h index af9f6dbd249..cb39c6c68e1 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/simpleparameter.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/simpleparameter.h @@ -171,7 +171,7 @@ typedef SimpleParameterClass StringsDBE // // RangedParameterClass // -// Extends simple paramter types so they can have minimum/maximum values. +// Extends simple parameter types so they can have minimum/maximum values. // ////////////////////////////////////////////////////////////////////////////////// template diff --git a/Core/Libraries/Source/debug/debug_cmd.h b/Core/Libraries/Source/debug/debug_cmd.h index 3e7f0bc45c6..d3cbec19222 100644 --- a/Core/Libraries/Source/debug/debug_cmd.h +++ b/Core/Libraries/Source/debug/debug_cmd.h @@ -38,7 +38,7 @@ command group and the commands implemented for this group. A Debug command group interface instance must register itself - using Debug::AddCommands. Ownership is then transfered to + using Debug::AddCommands. Ownership is then transferred to the Debug module unless the object is manually removed by calling Debug::RemoveCommands. diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index dd637d166a6..0bfa6ef5cfd 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -291,7 +291,7 @@ bool Debug::SkipNext(void) if (e->status==Unknown) Instance.UpdateFrameStatus(*e); - // now we now wether to skip or not + // now we now whether to skip or not return e->status==Skip; } diff --git a/Core/Libraries/Source/debug/debug_debug.h b/Core/Libraries/Source/debug/debug_debug.h index 02deada8f42..620bdfe1537 100644 --- a/Core/Libraries/Source/debug/debug_debug.h +++ b/Core/Libraries/Source/debug/debug_debug.h @@ -738,7 +738,7 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); /** \internal Undocumented default constructor. Initializes debugging library. - We can make this private as well so nobody accidently tries to create + We can make this private as well so nobody accidentally tries to create a Debug instance. Actually this function does not do anything - initialization is rather performed by PreStaticInit() and PostStaticInit(). diff --git a/Core/Libraries/Source/debug/debug_macro.h b/Core/Libraries/Source/debug/debug_macro.h index 1b95706b7cb..b24f9d3b40d 100644 --- a/Core/Libraries/Source/debug/debug_macro.h +++ b/Core/Libraries/Source/debug/debug_macro.h @@ -188,7 +188,7 @@ DFAIL_IF_MSG(!ptrval,"pointer must not be null") return; Works just like \ref DLOG but instead of using the current file as a logging group the logging group is explicitly specified. - \note Specifiy the group directly without quotes, e.g. + \note Specify the group directly without quotes, e.g. \code DLOG_GROUP(my_log_group,"hello world") \endcode diff --git a/Core/Libraries/Source/debug/test2/test2.cpp b/Core/Libraries/Source/debug/test2/test2.cpp index 6fae772f653..70756043f12 100644 --- a/Core/Libraries/Source/debug/test2/test2.cpp +++ b/Core/Libraries/Source/debug/test2/test2.cpp @@ -226,7 +226,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; } -// Mesage handler for about box. +// Message handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) diff --git a/Core/Libraries/Source/profile/profile_funclevel.h b/Core/Libraries/Source/profile/profile_funclevel.h index b36d583cf9d..f4ae3d8d41f 100644 --- a/Core/Libraries/Source/profile/profile_funclevel.h +++ b/Core/Libraries/Source/profile/profile_funclevel.h @@ -205,8 +205,8 @@ class ProfileFuncLevel /** \internal - Undocumented default constructor. Initializes function level profiler. - We can make this private as well so nobody accidently tries to create + Undocumented default constructor. Initializes function-level profiler. + We can make this private as well so nobody accidentally tries to create another instance. */ ProfileFuncLevel(void); diff --git a/Core/Libraries/Source/profile/profile_highlevel.h b/Core/Libraries/Source/profile/profile_highlevel.h index 41024847620..541892f0ff7 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.h +++ b/Core/Libraries/Source/profile/profile_highlevel.h @@ -223,8 +223,8 @@ class ProfileHighLevel /** \internal - Undocumented default constructor. Initializes high level profiler. - We can make this private as well so nobody accidently tries to create + Undocumented default constructor. Initializes high-level profiler. + We can make this private as well so nobody accidentally tries to create another instance. */ ProfileHighLevel(void); From e80bb51e944375ef90132eb5cdf9b81b0dca1c16 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 06:01:30 -0500 Subject: [PATCH 056/211] docs: Fix spelling errors in Core/Tools and Core/GameEngine comments (#2117) --- Core/GameEngine/Include/Common/AsciiString.h | 2 +- Core/GameEngine/Include/Common/AudioEventInfo.h | 2 +- Core/GameEngine/Include/Common/UnicodeString.h | 2 +- Core/GameEngine/Include/Common/file.h | 2 +- Core/GameEngine/Include/GameClient/TerrainRoads.h | 2 +- Core/GameEngine/Include/GameClient/View.h | 2 +- Core/GameEngine/Include/GameNetwork/Connection.h | 2 +- Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h | 2 +- Core/GameEngine/Include/GameNetwork/NetCommandList.h | 2 +- Core/GameEngine/Include/GameNetwork/NetworkDefs.h | 4 ++-- Core/GameEngine/Source/Common/System/AsciiString.cpp | 2 +- Core/GameEngine/Source/Common/System/UnicodeString.cpp | 2 +- Core/GameEngine/Source/GameNetwork/NAT.cpp | 2 +- Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp | 2 +- .../Include/W3DDevice/GameClient/HeightMap.h | 2 +- .../Source/W3DDevice/GameClient/BaseHeightMap.cpp | 4 ++-- .../Source/W3DDevice/GameClient/W3DTerrainVisual.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DTreeBuffer.cpp | 4 ++-- .../Source/W3DDevice/GameClient/W3DView.cpp | 2 +- .../Source/W3DDevice/GameClient/Water/W3DWater.cpp | 2 +- .../Source/W3DDevice/GameClient/WorldHeightMap.cpp | 4 ++-- Core/Tools/Autorun/CDCNTRL.cpp | 2 +- Core/Tools/Autorun/DrawButton.cpp | 2 +- Core/Tools/Autorun/Locale_API.cpp | 2 +- Core/Tools/Autorun/TTFont.h | 2 +- Core/Tools/Autorun/WSYS_file.h | 8 ++++---- Core/Tools/Autorun/locale.cpp | 2 +- Core/Tools/Babylon/BabylonDlg.cpp | 2 +- Core/Tools/ImagePacker/Source/TexturePage.cpp | 2 +- Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp | 2 +- Core/Tools/Launcher/Toolkit/Debug/DebugPrint.h | 2 +- Core/Tools/Launcher/Toolkit/Storage/File.cpp | 4 ++-- Core/Tools/Launcher/Toolkit/Support/UString.cpp | 8 ++++---- Core/Tools/Launcher/Toolkit/Support/UString.h | 4 ++-- Core/Tools/Launcher/wdebug.h | 4 ++-- Core/Tools/Launcher/wstring.cpp | 2 +- Core/Tools/PATCHGET/Registry.h | 2 +- Core/Tools/PATCHGET/registry.cpp | 2 +- Core/Tools/W3DView/AdvancedAnimSheet.h | 2 +- Core/Tools/W3DView/CameraSettingsDialog.cpp | 2 +- Core/Tools/W3DView/ColorPicker.cpp | 2 +- Core/Tools/W3DView/EmitterPropertySheet.cpp | 2 +- Core/Tools/W3DView/GraphicView.cpp | 4 ++-- Core/Tools/W3DView/MainFrm.cpp | 2 +- Core/Tools/W3DView/TextureMgrDialog.h | 2 +- Core/Tools/W3DView/Toolbar.cpp | 2 +- Core/Tools/W3DView/Utils.cpp | 6 +++--- Core/Tools/W3DView/ViewerScene.cpp | 4 ++-- Core/Tools/W3DView/W3DViewDoc.h | 2 +- Core/Tools/WW3D/max2w3d/GameMtl.cpp | 2 +- Core/Tools/WW3D/max2w3d/MeshDeform.h | 4 ++-- Core/Tools/WW3D/max2w3d/MeshDeformData.h | 4 ++-- Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h | 4 ++-- Core/Tools/WW3D/max2w3d/meshbuild.cpp | 2 +- Core/Tools/WW3D/max2w3d/meshbuild.h | 2 +- Core/Tools/WW3D/max2w3d/motion.cpp | 2 +- Core/Tools/WW3D/max2w3d/simpdib.cpp | 2 +- Core/Tools/WW3D/max2w3d/skin.cpp | 2 +- Core/Tools/WW3D/max2w3d/w3d_file.h | 2 +- Core/Tools/WW3D/max2w3d/w3dappdata.cpp | 2 +- Core/Tools/WW3D/max2w3d/w3dappdata.h | 2 +- Core/Tools/WW3D/max2w3d/w3dexp.cpp | 4 ++-- Core/Tools/WW3D/pluglib/Vector.h | 4 ++-- Core/Tools/WW3D/pluglib/always.h | 2 +- Core/Tools/WW3D/pluglib/rawfile.cpp | 2 +- Core/Tools/WW3D/pluglib/rgb.h | 4 ++-- Core/Tools/WW3D/pluglib/vector2.h | 8 ++++---- Core/Tools/WW3D/pluglib/vector3.h | 4 ++-- Core/Tools/WW3D/pluglib/vector4.h | 4 ++-- Core/Tools/WW3D/pluglib/w3dquat.h | 2 +- Core/Tools/mangler/wlib/wdebug.h | 4 ++-- Core/Tools/mangler/wlib/wstring.cpp | 2 +- Core/Tools/matchbot/generals.cpp | 2 +- Core/Tools/matchbot/matcher.cpp | 2 +- Core/Tools/matchbot/mydebug.h | 4 ++-- Core/Tools/matchbot/wlib/wdebug.h | 4 ++-- Core/Tools/matchbot/wlib/wstring.cpp | 2 +- Core/Tools/wolSetup/WOLAPI/chatdefs.h | 8 ++++---- Core/Tools/wolSetup/wolSetup.cpp | 4 ++-- 79 files changed, 114 insertions(+), 114 deletions(-) diff --git a/Core/GameEngine/Include/Common/AsciiString.h b/Core/GameEngine/Include/Common/AsciiString.h index c53fa59ee15..5259650dbef 100644 --- a/Core/GameEngine/Include/Common/AsciiString.h +++ b/Core/GameEngine/Include/Common/AsciiString.h @@ -252,7 +252,7 @@ class AsciiString void trimEnd(void); /** - Remove all consecutive occurances of c from the end of the string. + Remove all consecutive occurrences of c from the end of the string. */ void trimEnd(const char c); diff --git a/Core/GameEngine/Include/Common/AudioEventInfo.h b/Core/GameEngine/Include/Common/AudioEventInfo.h index 55b6a5b3207..8aefa8187e4 100644 --- a/Core/GameEngine/Include/Common/AudioEventInfo.h +++ b/Core/GameEngine/Include/Common/AudioEventInfo.h @@ -126,7 +126,7 @@ struct AudioEventInfo : public MemoryPoolObject virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return nullptr; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class - /// Is this a permenant sound? That is, if I start this sound up, will it ever end + /// Is this a permanent sound? That is, if I start this sound up, will it ever end /// "on its own" or only if I explicitly kill it? Bool isPermanentSound() const { return BitIsSet( m_control, AC_LOOP ) && (m_loopCount == 0 ); } diff --git a/Core/GameEngine/Include/Common/UnicodeString.h b/Core/GameEngine/Include/Common/UnicodeString.h index 1a3295f892e..ba49fbe05a1 100644 --- a/Core/GameEngine/Include/Common/UnicodeString.h +++ b/Core/GameEngine/Include/Common/UnicodeString.h @@ -252,7 +252,7 @@ class UnicodeString void trimEnd(void); /** - Remove all consecutive occurances of c from the end of the string. + Remove all consecutive occurrences of c from the end of the string. */ void trimEnd(const WideChar c); diff --git a/Core/GameEngine/Include/Common/file.h b/Core/GameEngine/Include/Common/file.h index 45e0ee9bf1c..73ebe1417a3 100644 --- a/Core/GameEngine/Include/Common/file.h +++ b/Core/GameEngine/Include/Common/file.h @@ -189,7 +189,7 @@ class File : public MemoryPoolObject virtual Bool scanReal(Real &newReal) = 0; ///< read a real number from the current file position. virtual Bool scanString(AsciiString &newString) = 0; ///< read a string from the current file position. - virtual Bool print ( const Char *format, ...); ///< Prints formated string to text file + virtual Bool print ( const Char *format, ...); ///< Prints formatted string to text file virtual Int size( void ); ///< Returns the size of the file virtual Int position( void ); ///< Returns the current read/write position diff --git a/Core/GameEngine/Include/GameClient/TerrainRoads.h b/Core/GameEngine/Include/GameClient/TerrainRoads.h index dd7669c9c1d..858a6e22b73 100644 --- a/Core/GameEngine/Include/GameClient/TerrainRoads.h +++ b/Core/GameEngine/Include/GameClient/TerrainRoads.h @@ -206,7 +206,7 @@ class TerrainRoadCollection : public SubsystemInterface void update() { } TerrainRoadType *findRoad( AsciiString name ); ///< find road with matching name - TerrainRoadType *newRoad( AsciiString name ); ///< allocate new road, assing name, and link to list + TerrainRoadType *newRoad( AsciiString name ); ///< allocate new road, assign name, and link to list TerrainRoadType *firstRoad( void ) { return m_roadList; } ///< return first road TerrainRoadType *nextRoad( TerrainRoadType *road ); ///< get next road diff --git a/Core/GameEngine/Include/GameClient/View.h b/Core/GameEngine/Include/GameClient/View.h index 9d26976debb..3bfff42c422 100644 --- a/Core/GameEngine/Include/GameClient/View.h +++ b/Core/GameEngine/Include/GameClient/View.h @@ -148,7 +148,7 @@ class View : public Snapshot virtual void cameraModFinalLookToward(Coord3D *pLoc){} ///< Sets a look at point during camera movement. virtual void cameraModFinalMoveTo(Coord3D *pLoc){ }; ///< Sets a final move to. - // (gth) C&C3 animation controled camera feature + // (gth) C&C3 animation controlled camera feature virtual void cameraEnableSlaveMode(const AsciiString & thingtemplateName, const AsciiString & boneName) {} virtual void cameraDisableSlaveMode(void) {} virtual void Add_Camera_Shake(const Coord3D & position,float radius, float duration, float power) {} diff --git a/Core/GameEngine/Include/GameNetwork/Connection.h b/Core/GameEngine/Include/GameNetwork/Connection.h index 660a3dcfbb6..5324e29677a 100644 --- a/Core/GameEngine/Include/GameNetwork/Connection.h +++ b/Core/GameEngine/Include/GameNetwork/Connection.h @@ -18,7 +18,7 @@ /** * The Connection class handles queues for individual players, one connection per player. - * Connections are identified by their names (m_name). This should accomodate changing IPs + * Connections are identified by their names (m_name). This should accommodate changing IPs * in the face of modem disconnects, NAT irregularities, etc. * Messages can be guaranteed or non-guaranteed, sequenced or not. * diff --git a/Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h b/Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h index 41332be23a1..50325a5d03c 100644 --- a/Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h +++ b/Core/GameEngine/Include/GameNetwork/GameSpy/PeerDefs.h @@ -291,7 +291,7 @@ void GetAdditionalDisconnectsFromUserFile(PSPlayerStats *stats); extern Int GetAdditionalDisconnectsFromUserFile(Int playerID); //------------------------------------------------------------------------- -// These functions set up the globals and threads neccessary for our GameSpy impl. +// These functions set up the globals and threads necessary for our GameSpy impl. void SetUpGameSpy( const char *motdBuffer, const char *configBuffer ); void TearDownGameSpy( void ); diff --git a/Core/GameEngine/Include/GameNetwork/NetCommandList.h b/Core/GameEngine/Include/GameNetwork/NetCommandList.h index 21aa6ff733b..3e042d92123 100644 --- a/Core/GameEngine/Include/GameNetwork/NetCommandList.h +++ b/Core/GameEngine/Include/GameNetwork/NetCommandList.h @@ -35,7 +35,7 @@ * adding commands in order more efficiently since that is whats going to be * done most of the time. If the new message doesn't go after the last message * inserted, then the list will be traversed linearly until the proper spot is - * found. We can get away with this inefficient method since these occurances + * found. We can get away with this inefficient method since these occurrences * will be rare. Also, the list is not expected to ever have more than 30 or so * commands on it at a time. Five commands would probably be a normal amount. */ diff --git a/Core/GameEngine/Include/GameNetwork/NetworkDefs.h b/Core/GameEngine/Include/GameNetwork/NetworkDefs.h index 171f33df3d1..da50e56b42f 100644 --- a/Core/GameEngine/Include/GameNetwork/NetworkDefs.h +++ b/Core/GameEngine/Include/GameNetwork/NetworkDefs.h @@ -136,7 +136,7 @@ enum NetCommandType CPP_11(: Int) { NETCOMMANDTYPE_PROGRESS, NETCOMMANDTYPE_LOADCOMPLETE, NETCOMMANDTYPE_TIMEOUTSTART, - NETCOMMANDTYPE_WRAPPER, // A wrapper command that holds a command thats too big to fit in a single packet. + NETCOMMANDTYPE_WRAPPER, // A wrapper command that holds a command that's too big to fit in a single packet. NETCOMMANDTYPE_FILE, NETCOMMANDTYPE_FILEANNOUNCE, NETCOMMANDTYPE_FILEPROGRESS, @@ -196,7 +196,7 @@ static const UnsignedShort GENERALS_MAGIC_NUMBER = 0xF00D; //static const Int NETWORK_DISCONNECT_TIME = 5000; // The number of miliseconds between when a player's last disconnect keep alive command -// was recieved and when they are considered disconnected from the game. +// was received and when they are considered disconnected from the game. //static const Int NETWORK_PLAYER_TIMEOUT_TIME = 60000; // The base port number used for the transport socket. A players slot number is added to this diff --git a/Core/GameEngine/Source/Common/System/AsciiString.cpp b/Core/GameEngine/Source/Common/System/AsciiString.cpp index 7dc6dc207f5..533ccd5ccf3 100644 --- a/Core/GameEngine/Source/Common/System/AsciiString.cpp +++ b/Core/GameEngine/Source/Common/System/AsciiString.cpp @@ -350,7 +350,7 @@ void AsciiString::trimEnd(const char c) if (m_data) { - // Clip trailing consecutive occurances of c from the string. + // Clip trailing consecutive occurrences of c from the string. const int len = strlen(peek()); int index = len; while (index > 0 && getCharAt(index - 1) == c) diff --git a/Core/GameEngine/Source/Common/System/UnicodeString.cpp b/Core/GameEngine/Source/Common/System/UnicodeString.cpp index 64c509f7dde..386778d321b 100644 --- a/Core/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/Core/GameEngine/Source/Common/System/UnicodeString.cpp @@ -302,7 +302,7 @@ void UnicodeString::trimEnd(const WideChar c) if (m_data) { - // Clip trailing consecutive occurances of c from the string. + // Clip trailing consecutive occurrences of c from the string. const int len = wcslen(peek()); int index = len; while (index > 0 && getCharAt(index - 1) == c) diff --git a/Core/GameEngine/Source/GameNetwork/NAT.cpp b/Core/GameEngine/Source/GameNetwork/NAT.cpp index be06e97ee3f..fa45f66741f 100644 --- a/Core/GameEngine/Source/GameNetwork/NAT.cpp +++ b/Core/GameEngine/Source/GameNetwork/NAT.cpp @@ -445,7 +445,7 @@ NATConnectionState NAT::connectionUpdate() { } // this is the function that starts the NAT/firewall negotiation process. -// after calling this, you should call the update function untill it returns +// after calling this, you should call the update function until it returns // NATSTATE_DONE. void NAT::establishConnectionPaths() { DEBUG_LOG(("NAT::establishConnectionPaths - entering")); diff --git a/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp b/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp index 920e9d641cb..c2855eca5ce 100644 --- a/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetMessageStream.cpp @@ -91,7 +91,7 @@ static Bool AddToNetCommandList(GameMessage *msg, UnsignedInt timestamp, Command } /** - * AddToRemoteNetCommandList is used by TheNetwork to queue up commands recieved from other players. + * AddToRemoteNetCommandList is used by TheNetwork to queue up commands received from other players. * Bool AddToNetCommandList(Int playerNum, GameMessage *msg, UnsignedInt timestamp) { diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h index 827be581bbc..be440404c96 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h @@ -110,7 +110,7 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass Int updateVBForLightOptimized(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights); ///update vertex buffer vertices inside given rectangle Int updateVB(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator); - ///upate vertex buffers associated with the given rectangle + ///update vertex buffers associated with the given rectangle void initDestAlphaLUT(void); ///getHeight( x,y ) ) - m_clientHeightMap->setRawHeight( x, y, height ); // if the client map is heigher than this height, it will fall down to it anyway! + m_clientHeightMap->setRawHeight( x, y, height ); // if the client map is higher than this height, it will fall down to it anyway! } #endif diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 461fa527315..27e6961332b 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -298,7 +298,7 @@ void W3DTreeBuffer::cull(const CameraClass * camera) { Int curTree; - // Calulate the vector direction that the camera is looking at. + // Calculate the vector direction that the camera is looking at. Matrix3D camera_matrix = camera->Get_Transform(); float zmod = -1; float x = zmod * camera_matrix[0][2] ; @@ -825,7 +825,7 @@ void W3DTreeBuffer::loadTreesInVertexAndIndexBuffers(RefRenderObjListIterator *p } // panel start is index offset, there are 3 index per triangle. if (m_trees[curTree].panelStart/3 + 2 > numIndex) { - continue; // not enought polygons for the offset. jba. + continue; // not enough polygons for the offset. jba. } for (j=0; j<6; j++) { i = ((Int *)pPoly)[j+m_trees[curTree].panelStart]; diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index aee8d750782..31038ed408f 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -905,7 +905,7 @@ static void drawAudioLocations( Drawable *draw, void *userData ) } // Copied in hideously inappropriate code copying ways from DrawObject.cpp - // Should definately be a global, probably read in from an INI file + // Should definitely be a global, probably read in from an INI file static const Int poleHeight = 20; static const Int flagHeight = 10; static const Int flagWidth = 10; diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 9a116cf8953..31a11d23f43 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -3408,7 +3408,7 @@ void WaterRenderObjClass::renderSkyBody(Matrix3D *mat) DX8Wrapper::Set_Vertex_Buffer(vb_access); Matrix3D tm(1); - //set postion of skybody in world + //set position of skybody in world // tm.Set_Translation(Vector3(40,0,0)); DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index ca2485db1e0..92715500831 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -1880,7 +1880,7 @@ Bool WorldHeightMap::getUVForTileIndex(Int ndx, Short tileNdx, float U[4], float return; #endif Real dx = (h3-h2)*HEIGHT_SCALE; - dx = sqrt(1+dx*dx); // lenght of the bottom of the cell + dx = sqrt(1+dx*dx); // length of the bottom of the cell Real dy = (h3-h0)*HEIGHT_SCALE; dy = sqrt(1+dy*dy); // length of the left side. if (dx diff --git a/Core/Tools/W3DView/AdvancedAnimSheet.h b/Core/Tools/W3DView/AdvancedAnimSheet.h index 236ea910e2a..fd2bf23f419 100644 --- a/Core/Tools/W3DView/AdvancedAnimSheet.h +++ b/Core/Tools/W3DView/AdvancedAnimSheet.h @@ -46,7 +46,7 @@ class CAdvancedAnimSheet : public CPropertySheet CAnimMixingPage m_MixingPage; CAnimReportPage m_ReportPage; - // Indeces of animations selected in the mixing page. + // Indices of animations selected in the mixing page. DynamicVectorClass m_SelectedAnims; // Operations diff --git a/Core/Tools/W3DView/CameraSettingsDialog.cpp b/Core/Tools/W3DView/CameraSettingsDialog.cpp index 5106424e8ba..401cdd10c5e 100644 --- a/Core/Tools/W3DView/CameraSettingsDialog.cpp +++ b/Core/Tools/W3DView/CameraSettingsDialog.cpp @@ -168,7 +168,7 @@ CameraSettingsDialogClass::OnOK (void) // // Update the fog settings. The fog near clip plane should always be equal // to the camera near clip plane, but the fog far clip plane is scene - // dependant. We will be sure to modify only the near clip plane here. + // dependent. We will be sure to modify only the near clip plane here. // float fog_near, fog_far; doc->GetScene()->Get_Fog_Range(&fog_near, &fog_far); diff --git a/Core/Tools/W3DView/ColorPicker.cpp b/Core/Tools/W3DView/ColorPicker.cpp index fdffa37a9c5..b98a48d6a22 100644 --- a/Core/Tools/W3DView/ColorPicker.cpp +++ b/Core/Tools/W3DView/ColorPicker.cpp @@ -590,7 +590,7 @@ ColorPickerClass::Paint_DIB width = rect.Width (); height = rect.Height (); - // Build an array of column indicies where we will switch color + // Build an array of column indices where we will switch color // components... int col_remainder = (width % 6); int channel_switch_cols[6]; diff --git a/Core/Tools/W3DView/EmitterPropertySheet.cpp b/Core/Tools/W3DView/EmitterPropertySheet.cpp index 9a013ea1c40..6258ebdf9fb 100644 --- a/Core/Tools/W3DView/EmitterPropertySheet.cpp +++ b/Core/Tools/W3DView/EmitterPropertySheet.cpp @@ -244,7 +244,7 @@ void EmitterPropertySheetClass::Update_Emitter (void) { // - // Update those pages that are dependant on the particle's + // Update those pages that are dependent on the particle's // lifetime. // float lifetime = m_GeneralPage.Get_Lifetime (); diff --git a/Core/Tools/W3DView/GraphicView.cpp b/Core/Tools/W3DView/GraphicView.cpp index 1b5af956d85..68ff4f5fd5d 100644 --- a/Core/Tools/W3DView/GraphicView.cpp +++ b/Core/Tools/W3DView/GraphicView.cpp @@ -1238,8 +1238,8 @@ CGraphicView::Reset_Camera_To_Display_Sphere (SphereClass &sphere) m_pCamera->Set_Clip_Planes (min_dist, max_dist); // Adjust the fog near clipping plane to the new value, but - // leave the far clip plane alone (since it is scene dependant - // not camera dependant). + // leave the far clip plane alone (since it is scene dependent + // not camera dependent). float fog_near, fog_far; doc->GetScene()->Get_Fog_Range(&fog_near, &fog_far); doc->GetScene()->Set_Fog_Range(min_dist, fog_far); diff --git a/Core/Tools/W3DView/MainFrm.cpp b/Core/Tools/W3DView/MainFrm.cpp index 31b60e51929..38563a531e1 100644 --- a/Core/Tools/W3DView/MainFrm.cpp +++ b/Core/Tools/W3DView/MainFrm.cpp @@ -4039,7 +4039,7 @@ CMainFrame::OnUpdateBindSubobjectLod (CCmdUI *pCmdUI) if (doc != nullptr && doc->GetDisplayedObject () != nullptr) { // - // Set the check if we are currenly forcing sub object matching + // Set the check if we are currently forcing sub object matching // RenderObjClass *render_obj = doc->GetDisplayedObject (); bool is_enabled = (render_obj->Is_Sub_Objects_Match_LOD_Enabled () != 0); diff --git a/Core/Tools/W3DView/TextureMgrDialog.h b/Core/Tools/W3DView/TextureMgrDialog.h index 2fd5e25ba37..09fea2c14f7 100644 --- a/Core/Tools/W3DView/TextureMgrDialog.h +++ b/Core/Tools/W3DView/TextureMgrDialog.h @@ -153,7 +153,7 @@ class TextureListNodeClass __inline void TextureListNodeClass::Free_Subobj_List (void) { - // Loop through all the subobject entries and free thier pointers + // Loop through all the subobject entries and free their pointers for (int index = 0; index < m_SubObjectList.Count (); index ++) { SAFE_DELETE (m_SubObjectList[index]); } diff --git a/Core/Tools/W3DView/Toolbar.cpp b/Core/Tools/W3DView/Toolbar.cpp index a2301d21174..7780f0233c6 100644 --- a/Core/Tools/W3DView/Toolbar.cpp +++ b/Core/Tools/W3DView/Toolbar.cpp @@ -351,7 +351,7 @@ CFancyToolbar::OnLButtonDown // 2 state button m_iCurrentButton = -1; - // Send the message to the window's parent to let them know a command has occured + // Send the message to the window's parent to let them know a command has occurred ::AfxGetMainWnd ()->PostMessage (WM_COMMAND, MAKELONG (m_pButtonArray[iButton].iCommandID, BN_CLICKED), (LPARAM)m_hWnd); diff --git a/Core/Tools/W3DView/Utils.cpp b/Core/Tools/W3DView/Utils.cpp index b4ae48c2ae4..b665f1c73db 100644 --- a/Core/Tools/W3DView/Utils.cpp +++ b/Core/Tools/W3DView/Utils.cpp @@ -414,7 +414,7 @@ Filename_From_Asset_Name (LPCTSTR asset_name) CString Get_Filename_From_Path (LPCTSTR path) { - // Find the last occurance of the directory deliminator + // Find the last occurrence of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); if (filename != nullptr) { // Increment past the directory deliminator @@ -439,7 +439,7 @@ Strip_Filename_From_Path (LPCTSTR path) TCHAR temp_path[MAX_PATH]; ::lstrcpy (temp_path, path); - // Find the last occurance of the directory deliminator + // Find the last occurrence of the directory deliminator LPTSTR filename = ::strrchr (temp_path, '\\'); if (filename != nullptr) { // Strip off the filename @@ -763,7 +763,7 @@ Load_RC_Texture (LPCTSTR resource_name) // TheSuperHackers @info Not implemented - // Reutrn a pointer to the new texture + // Return a pointer to the new texture return texture; } diff --git a/Core/Tools/W3DView/ViewerScene.cpp b/Core/Tools/W3DView/ViewerScene.cpp index 58a99220397..549934c81c0 100644 --- a/Core/Tools/W3DView/ViewerScene.cpp +++ b/Core/Tools/W3DView/ViewerScene.cpp @@ -105,7 +105,7 @@ RenderObjClass * ViewerSceneIterator::Current_Item(void) // // Visibility_Check // -// Note: We overide this method to remove the LOD preparation. We +// Note: We override this method to remove the LOD preparation. We // need to be able to specify an LOD and not have it switch on us. // //////////////////////////////////////////////////////////////////////// @@ -150,7 +150,7 @@ ViewerSceneClass::Add_To_Lineup (RenderObjClass *obj) assert(obj); // If this is an insignificant object (ie. we don't need to - // rearrange existing objects to accomodate it), don't bother + // rearrange existing objects to accommodate it), don't bother // adding it to the lineup. Ex: Adding a light to the lineup // is pretty silly. if (!Can_Line_Up(obj)) diff --git a/Core/Tools/W3DView/W3DViewDoc.h b/Core/Tools/W3DView/W3DViewDoc.h index 4c0d0b00592..4bbdb92d79d 100644 --- a/Core/Tools/W3DView/W3DViewDoc.h +++ b/Core/Tools/W3DView/W3DViewDoc.h @@ -238,7 +238,7 @@ class CW3DViewDoc : public CDocument void Update_LOD_Prototype (HLodClass &hlod); // - // Cursor managment + // Cursor management // void Show_Cursor (bool onoff); void Set_Cursor (LPCTSTR resource_name); diff --git a/Core/Tools/WW3D/max2w3d/GameMtl.cpp b/Core/Tools/WW3D/max2w3d/GameMtl.cpp index 9c0819fb59a..cc05f0658fd 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtl.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtl.cpp @@ -2227,7 +2227,7 @@ int GameMtl::Compute_PC_Shader_From_PS2_Shader(int pass) } } - // The alpha paramater. + // The alpha parameter. switch(param_value[3]) { case PSS_SRC_ALPHA: diff --git a/Core/Tools/WW3D/max2w3d/MeshDeform.h b/Core/Tools/WW3D/max2w3d/MeshDeform.h index 2dd32be2f0d..fca09e5b45a 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeform.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeform.h @@ -147,7 +147,7 @@ class MeshDeformClass : public OSModifier int SubObjectIndex (HitRecord *hitRec) { return hitRec->hitInfo; } void ClearSelection (int selLevel); - // Transformation managment + // Transformation management void Move (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &point, BOOL local_origin); void Rotate (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Quat &rotation, BOOL local_origin); void Scale (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &value, BOOL local_origin); @@ -186,7 +186,7 @@ class MeshDeformClass : public OSModifier NUScaleModBoxCMode * m_ModeNUScale; SquashModBoxCMode * m_ModeSquash; - // Set managment + // Set management bool m_bSetDirty; int m_CurrentSet; int m_MaxSets; diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformData.h b/Core/Tools/WW3D/max2w3d/MeshDeformData.h index 7e7170fe537..99c6e7745a0 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformData.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformData.h @@ -87,7 +87,7 @@ class MeshDeformModData : public LocalModData void Set_Vertex_Position (int index, const Point3 &value) { m_SetsList[m_CurrentSet]->Set_Vertex_Position (index, value); } void Set_Vertex_Color (int index, int color_index, const VertColor &value) { m_SetsList[m_CurrentSet]->Set_Vertex_Color (index, color_index, value); } - // Set managment + // Set management void Set_Max_Deform_Sets (int max); void Set_Current_Set (int set_index) { m_CurrentSet = set_index; } int Get_Current_Set (void) const { return m_CurrentSet; } @@ -117,7 +117,7 @@ class MeshDeformModData : public LocalModData // Private member data ////////////////////////////////////////////////////////////////////// - // Set managment + // Set management int m_CurrentSet; SETS_LIST m_SetsList; }; diff --git a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h index fb0f5c0dc72..4e74a9a1348 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h @@ -101,11 +101,11 @@ class MeshDeformSaveSetClass // Public methods ////////////////////////////////////////////////////////////////////// - // Keyframe managment + // Keyframe management void Begin_Keyframe (float state); void End_Keyframe (void); - // Vertex managment + // Vertex management void Add_Vert (UINT vert_index, const Point3 &position, const VertColor &color); // Misc diff --git a/Core/Tools/WW3D/max2w3d/meshbuild.cpp b/Core/Tools/WW3D/max2w3d/meshbuild.cpp index 1d8c7e6ee07..8a904c95320 100644 --- a/Core/Tools/WW3D/max2w3d/meshbuild.cpp +++ b/Core/Tools/WW3D/max2w3d/meshbuild.cpp @@ -834,7 +834,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) } /* - ** Propogate the accumulated normals to all of the other verts which share them + ** Propagate the accumulated normals to all of the other verts which share them */ for (vertidx = 0; vertidx < VertCount; vertidx++) { int shadeindex = Verts[vertidx].ShadeIndex; diff --git a/Core/Tools/WW3D/max2w3d/meshbuild.h b/Core/Tools/WW3D/max2w3d/meshbuild.h index bb48832aa63..348eff2823a 100644 --- a/Core/Tools/WW3D/max2w3d/meshbuild.h +++ b/Core/Tools/WW3D/max2w3d/meshbuild.h @@ -220,7 +220,7 @@ class MeshBuilderClass void Compute_Bounding_Sphere(Vector3 * set_center,float * set_radius); /* - ** World information managment. Used to give the mesh builder information + ** World information management. Used to give the mesh builder information ** about the world outside of its mesh. */ WorldInfoClass * Peek_World_Info(void) const { return WorldInfo; } diff --git a/Core/Tools/WW3D/max2w3d/motion.cpp b/Core/Tools/WW3D/max2w3d/motion.cpp index c05df5c803d..1d2ab8bf2aa 100644 --- a/Core/Tools/WW3D/max2w3d/motion.cpp +++ b/Core/Tools/WW3D/max2w3d/motion.cpp @@ -428,7 +428,7 @@ void MotionClass::compute_frame_motion(int frame) if ((node)&&(vis)) { if (frame != 0) { - // sample previous frame, and an inbetween time + // sample previous frame, and an in between time // to determine if there's a binary movement TimeValue frametime_prev = frametime - GetTicksPerFrame(); diff --git a/Core/Tools/WW3D/max2w3d/simpdib.cpp b/Core/Tools/WW3D/max2w3d/simpdib.cpp index e90ac377740..2699efa99c6 100644 --- a/Core/Tools/WW3D/max2w3d/simpdib.cpp +++ b/Core/Tools/WW3D/max2w3d/simpdib.cpp @@ -91,7 +91,7 @@ SimpleDIBClass::SimpleDIBClass(HWND hwnd,int width,int height,PaletteClass & pal Pitch = (Width + 3) & 0xfffffffC; // Check if the DIB is bottom-up or top-down. - // (it better be top-down, thats what I'm asking for!!!) + // (it better be top-down, that's what I'm asking for!!!) if (Info->bmiHeader.biHeight > 0) { // bottom-up DIB diff --git a/Core/Tools/WW3D/max2w3d/skin.cpp b/Core/Tools/WW3D/max2w3d/skin.cpp index ad43863ff46..d16804c9ab4 100644 --- a/Core/Tools/WW3D/max2w3d/skin.cpp +++ b/Core/Tools/WW3D/max2w3d/skin.cpp @@ -297,7 +297,7 @@ RefResult SkinWSMObjectClass::NotifyRefChanged(Interval changeInt,RefTargetHandl } if (i < BoneTab.Count()) { BoneTab.Delete(i,1); - // TODO: cause all Modifier objects to re-index to accomodate + // TODO: cause all Modifier objects to re-index to accommodate // the deletion of this bone!! } break; diff --git a/Core/Tools/WW3D/max2w3d/w3d_file.h b/Core/Tools/WW3D/max2w3d/w3d_file.h index 034da603f34..0f17c36a129 100644 --- a/Core/Tools/WW3D/max2w3d/w3d_file.h +++ b/Core/Tools/WW3D/max2w3d/w3d_file.h @@ -593,7 +593,7 @@ struct W3dRGBAStruct // MATERIALS // // Surrender 1.40 significantly changed the way that materials are described. To -// accomodate this, the w3d file format has changed since there are new features and +// accommodate this, the w3d file format has changed since there are new features and // optimizations that we want to take advangage of. // // The VertexMaterial defines parameters which control the calculation of the primary diff --git a/Core/Tools/WW3D/max2w3d/w3dappdata.cpp b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp index 5c544a7512d..5ac137255da 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp @@ -683,7 +683,7 @@ bool Is_Vehicle_Collision(INode * node) * * * WARNINGS: * * This has nothing to do with its hidden status inside of max. Things hidden in max are * - * ignored by the exporter. (artist request way back...wierd huh?) * + * ignored by the exporter. (artist request way back...weird huh?) * * * * HISTORY: * * 11/18/98 GTH : Created. * diff --git a/Core/Tools/WW3D/max2w3d/w3dappdata.h b/Core/Tools/WW3D/max2w3d/w3dappdata.h index 2ddbc3d0d9b..23eb9e86b96 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.h +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.h @@ -58,7 +58,7 @@ ** structure! ** ** - There are bits stored in AppData for each node -** - These bits indicate wether something should be exported as hierarchy, +** - These bits indicate whether something should be exported as hierarchy, ** geometry (and if so, what type of geometry: mesh, collision box, bitmap, etc) ** ** When we say something is "Hierarchy" that means its transform should be put diff --git a/Core/Tools/WW3D/max2w3d/w3dexp.cpp b/Core/Tools/WW3D/max2w3d/w3dexp.cpp index 5b1a4867b04..7d996d566eb 100644 --- a/Core/Tools/WW3D/max2w3d/w3dexp.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dexp.cpp @@ -1019,7 +1019,7 @@ INodeListClass * W3dExportClass::get_origin_list(void) /* ** If we didn't find any origins, add the scene root as an origin. ** NOTE: it would also be a problem if the origin list contained both the scene root - ** and the user placed origins. Thats not happening now because the OriginList + ** and the user placed origins. That's not happening now because the OriginList ** does not collect the scene root... were that to change we'd have to update this ** code as well. */ @@ -1219,7 +1219,7 @@ static bool check_lod_extensions (INodeListClass &list, INode *origin) { char *this_ext = strrchr(list[i]->GetName(), '.'); - // Check for the existance of an extension in this node. + // Check for the existence of an extension in this node. if (this_ext == nullptr) return false; diff --git a/Core/Tools/WW3D/pluglib/Vector.h b/Core/Tools/WW3D/pluglib/Vector.h index 8f1d9e28fef..627752273b1 100644 --- a/Core/Tools/WW3D/pluglib/Vector.h +++ b/Core/Tools/WW3D/pluglib/Vector.h @@ -637,7 +637,7 @@ int DynamicVectorClass::ID(T const & object) * DynamicVectorClass::Add -- Add an element to the vector. * * * * Use this routine to add an element to the vector. The vector will automatically be * - * resized to accomodate the new element IF the vector was allocated previously and the * + * resized to accommodate the new element IF the vector was allocated previously and the * * growth rate is not zero. * * * * INPUT: object -- Reference to the object that will be added to the vector. * @@ -809,7 +809,7 @@ bool DynamicVectorClass::Delete(int index) * INPUT: none. * * * * OUTPUT: T *; Points to the empty space where the new object is to be created. (If the * - * space was not added succesfully, returns nullptr). * + * space was not added successfully, returns nullptr). * * * * WARNINGS: If memory area is left uninitialized, Very Bad Things will happen. * * * diff --git a/Core/Tools/WW3D/pluglib/always.h b/Core/Tools/WW3D/pluglib/always.h index 228b25e2c32..85034e70b00 100644 --- a/Core/Tools/WW3D/pluglib/always.h +++ b/Core/Tools/WW3D/pluglib/always.h @@ -88,7 +88,7 @@ void* __cdecl operator new(unsigned int s); ** Define the MIN and MAX macros. ** NOTE: Joe used to #include in the various compiler header files. This ** header defines 'min' and 'max' macros which conflict with the surrender code so -** I'm relpacing all occurances of 'min' and 'max with 'MIN' and 'MAX'. For code which +** I'm relpacing all occurrences of 'min' and 'max with 'MIN' and 'MAX'. For code which ** is out of our domain (e.g. Max sdk) I'm declaring template functions for 'min' and 'max' */ #define NOMINMAX diff --git a/Core/Tools/WW3D/pluglib/rawfile.cpp b/Core/Tools/WW3D/pluglib/rawfile.cpp index 60bd1be9057..b56bbb7b85f 100644 --- a/Core/Tools/WW3D/pluglib/rawfile.cpp +++ b/Core/Tools/WW3D/pluglib/rawfile.cpp @@ -799,7 +799,7 @@ int RawFileClass::Seek(int pos, int dir) /* ** A file that is biased will have a seek operation modified so that the file appears to ** exist only within the bias range. All bytes outside of this range appear to be - ** non-existant. + ** non-existent. */ if (BiasLength != -1) { switch (dir) { diff --git a/Core/Tools/WW3D/pluglib/rgb.h b/Core/Tools/WW3D/pluglib/rgb.h index 20b76bd4a6e..cb9110c6d62 100644 --- a/Core/Tools/WW3D/pluglib/rgb.h +++ b/Core/Tools/WW3D/pluglib/rgb.h @@ -42,7 +42,7 @@ class HSVClass; /* ** Each color entry is represented by this class. It holds the values for the color -** guns. The gun values are recorded in device dependant format, but the interface +** guns. The gun values are recorded in device dependent format, but the interface ** uses gun values from 0 to 255. */ class RGBClass @@ -78,7 +78,7 @@ class RGBClass friend class PaletteClass; /* - ** These hold the actual color gun values in machine independant scale. This + ** These hold the actual color gun values in machine independent scale. This ** means the values range from 0 to 255. */ unsigned char Red; diff --git a/Core/Tools/WW3D/pluglib/vector2.h b/Core/Tools/WW3D/pluglib/vector2.h index e35f5e87ae7..8cbd0f38db3 100644 --- a/Core/Tools/WW3D/pluglib/vector2.h +++ b/Core/Tools/WW3D/pluglib/vector2.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Detemine if two vectors are identical * * Equal_Within_Epsilon -- Determine if two vectors are identical within * @@ -45,7 +45,7 @@ * Vector2::Is_Valid -- Verifies that all components are valid floats * * Vector2::Update_Min -- sets each component of the vector to the min of this and a. * * Vector2::Update_Max -- sets each component of the vector to the max of this and a. * - * Vector2::Scale -- multiply components of a vector by independant scaling factors. * + * Vector2::Scale -- multiply components of a vector by independent scaling factors. * * Vector2::Lerp -- linearly interpolates two Vector2's * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -208,7 +208,7 @@ inline Vector2 operator + (const Vector2 &a,const Vector2 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * @@ -533,7 +533,7 @@ inline void Vector2::Update_Max (const Vector2 & a) /*********************************************************************************************** - * Vector2::Scale -- multiply components of a vector by independant scaling factors. * + * Vector2::Scale -- multiply components of a vector by independent scaling factors. * * * * INPUT: * * * diff --git a/Core/Tools/WW3D/pluglib/vector3.h b/Core/Tools/WW3D/pluglib/vector3.h index ead1494f374..0cbb8c39e1f 100644 --- a/Core/Tools/WW3D/pluglib/vector3.h +++ b/Core/Tools/WW3D/pluglib/vector3.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Determine if two vectors are identical * * Vector Inequality Operator -- Determine if two vectors are identical * @@ -244,7 +244,7 @@ WWINLINE Vector3 operator + (const Vector3 &a,const Vector3 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * diff --git a/Core/Tools/WW3D/pluglib/vector4.h b/Core/Tools/WW3D/pluglib/vector4.h index 620664a313d..e0145c6f6a8 100644 --- a/Core/Tools/WW3D/pluglib/vector4.h +++ b/Core/Tools/WW3D/pluglib/vector4.h @@ -36,7 +36,7 @@ * Scalar Division Operator -- Divide a vector by a scalar * * Scalar Multiply Operator -- Multiply a vector by a scalar * * Vector Addition Operator -- Add two vectors * - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * Vector Inner Product Operator -- Compute the inner or dot product * * Vector Equality Operator -- Detemine if two vectors are identical * * Vector Inequality Operator -- Detemine if two vectors are identical * @@ -175,7 +175,7 @@ inline Vector4 operator + (const Vector4 &a,const Vector4 &b) } /************************************************************************** - * Vector Subtraction Operator -- Subract two vectors * + * Vector Subtraction Operator -- Subtract two vectors * * * * INPUT: * * * diff --git a/Core/Tools/WW3D/pluglib/w3dquat.h b/Core/Tools/WW3D/pluglib/w3dquat.h index 6ad98076d47..550396b2d7b 100644 --- a/Core/Tools/WW3D/pluglib/w3dquat.h +++ b/Core/Tools/WW3D/pluglib/w3dquat.h @@ -125,7 +125,7 @@ inline Quaternion operator + (const Quaternion & a,const Quaternion & b) return Quaternion(a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]); } -// Subract two quaternions +// Subtract two quaternions inline Quaternion operator - (const Quaternion & a,const Quaternion & b) { return Quaternion(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]); diff --git a/Core/Tools/mangler/wlib/wdebug.h b/Core/Tools/mangler/wlib/wdebug.h index e16319f4daf..5af0c8658f8 100644 --- a/Core/Tools/mangler/wlib/wdebug.h +++ b/Core/Tools/mangler/wlib/wdebug.h @@ -25,8 +25,8 @@ MT-LEVEL The debugging module is pretty good for debugging and it has some message printing stuff as well. The basic idea is that you write a class that inherits from OutputDevice (several are provided) and assign that output -device to a stream. There are seperate streams for debugging, information, -warning, and error messages. Each one can have a seperate output device, +device to a stream. There are separate streams for debugging, information, +warning, and error messages. Each one can have a separate output device, or they can all have the same one. Debugging messages only get compiled in if your module defines 'DEBUG'. If you don't define debug, then not even the text of the debugging message gets into the binary. All the other diff --git a/Core/Tools/mangler/wlib/wstring.cpp b/Core/Tools/mangler/wlib/wstring.cpp index 2d19f92e19b..5f5d558c1cb 100644 --- a/Core/Tools/mangler/wlib/wstring.cpp +++ b/Core/Tools/mangler/wlib/wstring.cpp @@ -517,7 +517,7 @@ bit8 Wstring::truncate(char c) return(TRUE); } -// Get a token from this string that's seperated by one or more +// Get a token from this string that's separated by one or more // chars from the 'delim' string , start at offset & return offset sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const { diff --git a/Core/Tools/matchbot/generals.cpp b/Core/Tools/matchbot/generals.cpp index 05ee3118536..408e3193b53 100644 --- a/Core/Tools/matchbot/generals.cpp +++ b/Core/Tools/matchbot/generals.cpp @@ -533,7 +533,7 @@ void GeneralsMatcher::checkMatchesInUserMap(UserMap& userMap, int ladderID, int s.append(intToString(userMap.size())); } - // iterate through users, timing them out as neccessary + // iterate through users, timing them out as necessary for (i1 = userMap.begin(); i1 != userMap.end(); ++i1) { if (showPoolSize) diff --git a/Core/Tools/matchbot/matcher.cpp b/Core/Tools/matchbot/matcher.cpp index 4d6e9d51c79..7549239d2e1 100644 --- a/Core/Tools/matchbot/matcher.cpp +++ b/Core/Tools/matchbot/matcher.cpp @@ -312,7 +312,7 @@ static void AuthenticateCDKeyCallback void MatcherClass::connectAndLoop(void) { - // Game-specific initializations, if neccessary + // Game-specific initializations, if necessary init(); // Check for possible quit from init()-based self-tests diff --git a/Core/Tools/matchbot/mydebug.h b/Core/Tools/matchbot/mydebug.h index 91227b3cfaa..698dd7a6db4 100644 --- a/Core/Tools/matchbot/mydebug.h +++ b/Core/Tools/matchbot/mydebug.h @@ -25,8 +25,8 @@ MT-LEVEL The debugging module is pretty good for debugging and it has some message printing stuff as well. The basic idea is that you write a class that inherits from OutputDevice (several are provided) and assign that output -device to a stream. There are seperate streams for debugging, information, -warning, and error messages. Each one can have a seperate output device, +device to a stream. There are separate streams for debugging, information, +warning, and error messages. Each one can have a separate output device, or they can all have the same one. Debugging messages only get compiled in if your module defines 'DEBUG'. If you don't define debug, then not even the text of the debugging message gets into the binary. All the other diff --git a/Core/Tools/matchbot/wlib/wdebug.h b/Core/Tools/matchbot/wlib/wdebug.h index 4b5a8568d12..142a881fb29 100644 --- a/Core/Tools/matchbot/wlib/wdebug.h +++ b/Core/Tools/matchbot/wlib/wdebug.h @@ -25,8 +25,8 @@ MT-LEVEL The debugging module is pretty good for debugging and it has some message printing stuff as well. The basic idea is that you write a class that inherits from OutputDevice (several are provided) and assign that output -device to a stream. There are seperate streams for debugging, information, -warning, and error messages. Each one can have a seperate output device, +device to a stream. There are separate streams for debugging, information, +warning, and error messages. Each one can have a separate output device, or they can all have the same one. Debugging messages only get compiled in if your module defines 'DEBUG'. If you don't define debug, then not even the text of the debugging message gets into the binary. All the other diff --git a/Core/Tools/matchbot/wlib/wstring.cpp b/Core/Tools/matchbot/wlib/wstring.cpp index 2d19f92e19b..5f5d558c1cb 100644 --- a/Core/Tools/matchbot/wlib/wstring.cpp +++ b/Core/Tools/matchbot/wlib/wstring.cpp @@ -517,7 +517,7 @@ bit8 Wstring::truncate(char c) return(TRUE); } -// Get a token from this string that's seperated by one or more +// Get a token from this string that's separated by one or more // chars from the 'delim' string , start at offset & return offset sint32 Wstring::getToken(int offset,const char *delim,Wstring &out) const { diff --git a/Core/Tools/wolSetup/WOLAPI/chatdefs.h b/Core/Tools/wolSetup/WOLAPI/chatdefs.h index 11fef9d3eee..c05e140794e 100644 --- a/Core/Tools/wolSetup/WOLAPI/chatdefs.h +++ b/Core/Tools/wolSetup/WOLAPI/chatdefs.h @@ -34,13 +34,13 @@ #define CHAT_E_NICKINUSE MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 100) // Your password is incorrect during login #define CHAT_E_BADPASS MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 101) -// Reference made to non-existant user or channel +// Reference made to non-existent user or channel #define CHAT_E_NONESUCH MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 102) // The network layer is down or cannot be initialized for some reason #define CHAT_E_CON_NETDOWN MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 103) // Name lookup (e.g DNS) failed for some reason #define CHAT_E_CON_LOOKUP_FAILED MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 104) -// Some fatal error occured with the net connection +// Some fatal error occurred with the net connection #define CHAT_E_CON_ERROR MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 105) // General request timeout for a request #define CHAT_E_TIMEOUT MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 106) @@ -48,7 +48,7 @@ #define CHAT_E_MUSTPATCH MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 107) // Miscellaneous internal status error #define CHAT_E_STATUSERROR MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 108) -// Server has returned something we don't recognise +// Server has returned something we don't recognize #define CHAT_E_UNKNOWNRESPONSE MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 109) // Tried to join a channel that has enough players already #define CHAT_E_CHANNELFULL MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 110) @@ -129,7 +129,7 @@ #define CHAT_E_LEAVECHANNEL MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 508) // Tried to send something to a channel when not a member of any channel #define CHAT_E_JOINCHANNEL MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 509) -// Tried to join a non-existant channel +// Tried to join a non-existent channel #define CHAT_E_UNKNOWNCHANNEL MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF, 510) diff --git a/Core/Tools/wolSetup/wolSetup.cpp b/Core/Tools/wolSetup/wolSetup.cpp index cb07f93dad5..0b044b6fe32 100644 --- a/Core/Tools/wolSetup/wolSetup.cpp +++ b/Core/Tools/wolSetup/wolSetup.cpp @@ -68,7 +68,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, } -// Mesage handler for generals setup box. +// Message handler for generals setup box. LRESULT CALLBACK GeneralsSetupDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -121,7 +121,7 @@ void updateDisplay(HWND hDlg) SetDlgItemText(hDlg, IDC_TEXT_GENERALSDIR, g_generalsFilename); } -// Mesage handler for main dialog box. +// Message handler for main dialog box. LRESULT CALLBACK MainDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) From a13b75441a1610298d7328979e093f2471599726 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 10:35:31 -0500 Subject: [PATCH 057/211] docs: Fix spelling errors in Generals Libraries, Tools, GameEngineDevice comments (#2120) --- .../Include/W3DDevice/Common/W3DFunctionLexicon.h | 2 +- .../Include/W3DDevice/GameClient/Module/W3DModelDraw.h | 2 +- .../W3DDevice/GameClient/Module/W3DOverlordTankDraw.h | 2 +- .../Include/W3DDevice/GameClient/Module/W3DTankDraw.h | 2 +- .../Include/W3DDevice/GameClient/W3DGameClient.h | 2 +- .../Include/W3DDevice/GameClient/W3DVolumetricShadow.h | 4 ++-- .../W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp | 6 +++--- .../GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp | 2 +- .../Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp | 2 +- .../W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp | 4 ++-- .../W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp | 8 ++++---- .../Source/W3DDevice/GameClient/W3DDebugDisplay.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | 4 ++-- Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.h | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/light.cpp | 8 ++++---- Generals/Code/Libraries/Source/WWVegas/WW3D2/light.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/lightenvironment.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h | 2 +- Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 4 ++-- Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h | 2 +- Generals/Code/Tools/GUIEdit/Include/HierarchyView.h | 2 +- .../Source/Dialog Procedures/ListboxProperties.cpp | 2 +- .../Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp | 4 ++-- Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp | 4 ++-- Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp | 2 +- Generals/Code/Tools/GUIEdit/Source/Save.cpp | 4 ++-- Generals/Code/Tools/GUIEdit/Source/WinMain.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp | 4 ++-- Generals/Code/Tools/WorldBuilder/src/WaterOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/WaypointOptions.cpp | 2 +- Generals/Code/Tools/WorldBuilder/src/brushoptions.cpp | 2 +- 47 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h index 8cb5492aef9..52e64e6e113 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h @@ -24,7 +24,7 @@ // FILE: W3DFunctionLexicon.h ///////////////////////////////////////////////////////////////////// // Created: Colin Day, September 2001 -// Desc: Function lexicon for w3d specific funtion pointers +// Desc: Function lexicon for w3d specific function pointers /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index 9bfaf45c1a2..9188bb3f0ae 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -391,7 +391,7 @@ class W3DModelDraw : public DrawModule, public ObjectDrawInterface /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ virtual void setAnimationCompletionTime(UnsignedInt numFrames); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h index 88f7297770b..c363d7caab8 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTankDraw.h //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTankDraw.h //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h index b01db7f9319..9632880429f 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DTankDraw.h //////////////////////////////////////////////////////////////////////////// +// FILE: W3DTankDraw.h //////////////////////////////////////////////////////////////////////////// // Draw a tank // Author: Michael S. Booth, October 2001 /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h index 5190395b813..ef05b814572 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h @@ -25,7 +25,7 @@ // FILE: W3DGameClient.h /////////////////////////////////////////////////// // // W3D implementation of the game interface. The GameClient is -// responsible for maintaining our drawbles, handling our GUI, and creating +// responsible for maintaining our drawables, handling our GUI, and creating // the display ... basically the Client if this were a Client/Server game. // // Author: Colin Day, April 2001 diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h index 13ce8651cac..a130e46ed9f 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h @@ -176,8 +176,8 @@ class W3DVolumetricShadow : public Shadow // silhouette building space Short *m_silhouetteIndex[MAX_SHADOW_CASTER_MESHES]; // silhouette vertex index list, edges occur - // as disjoint pairs. The acutal size of this - // piece of memory must accomodate #vertices*2 + // as disjoint pairs. The actual size of this + // piece of memory must accommodate #vertices*2 Short m_numSilhouetteIndices[MAX_SHADOW_CASTER_MESHES]; // total number of edge indices in the index // array, these are pairs and therefore // always a multiple of two diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 16b52a2ef17..7afabdada40 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -2593,7 +2593,7 @@ void W3DModelDraw::recalcBonesForClientParticleSystems() // and the direction, so that the system is oriented like the bone is sys->rotateLocalTransformZ(rotation); - // Attatch it to the object... + // Attach it to the object... sys->attachToDrawable(drawable); // important: mark it as do-not-save, since we'll just re-create it when we reload. @@ -3746,7 +3746,7 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { @@ -4177,7 +4177,7 @@ void W3DModelDraw::xfer( Xfer *xfer ) int curMode, dummy3; hlod->Peek_Animation_And_Info(dummy1, dummy3, curMode, dummy2); - // srj sez: do not change the animation mode. it's too risky, since if you change (say) a nonlooping + // srj sez: do not change the animation mode. it's too risky, since if you change (say) a non-looping // to a looping, something might break since it could rely on that anim terminating. // set animation data diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index 5546a77dc0e..ea03c7ac825 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTankDraw.cpp //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTankDraw.cpp //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp index de19dceee59..bd9bff8b9b4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp @@ -88,7 +88,7 @@ static void drawHiliteBar( const Image *left, const Image *right, barWindowSize.y = endY - startY; // - // the bar window size will always be at least big enough to accomodate + // the bar window size will always be at least big enough to accommodate // the left and right ends // if( barWindowSize.x < left->getImageWidth() + right->getImageWidth() ) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 85b679b6eb3..74efb1de3bb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -60,7 +60,7 @@ /** @todo: We're going to have a pool of a couple rendertargets to use in rare cases when dynamic shadows need to be generated. Maybe we can -even get away with a single one that gets used immediatly to render, then +even get away with a single one that gets used immediately to render, then recycled. For most of the objects, we need to have a static texture that is reused for all instances on the level. @@ -2128,7 +2128,7 @@ void W3DProjectedShadow::updateTexture(Vector3 &lightPos) m_shadowProjector->Compute_Perspective_Projection(m_robj,objToLight); m_shadowProjector->Set_Render_Target(TheW3DProjectedShadowManager->getRenderTarget()); - //Set ambient to 0, so we get a black shadow on solid backgroud + //Set ambient to 0, so we get a black shadow on solid background context=TheW3DProjectedShadowManager->getRenderContext(); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 46de1297442..7d2a3633a9b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -999,7 +999,7 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) } - // list is now acutally allocated + // list is now actually allocated m_numPolyNeighbors = numPolys; return TRUE; // success! @@ -3092,7 +3092,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) // resetShadowVolume ========================================================== // Reset the contents of the shadow volume information. Since we're using // a geometry class it would be ideal if these structures had a reset -// option where their resoures were released back to a pool rather than +// option where their resources were released back to a pool rather than // delete and allocate new storage space // ============================================================================ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) @@ -3129,7 +3129,7 @@ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) // allocateSilhouette ========================================================= // Allocate space for new silhouette storage, the number of vertices passed // in is the total vertices in the model, a silhouette must be able to -// accomodate that as a series of disjoint edge pairs, otherwise known +// accommodate that as a series of disjoint edge pairs, otherwise known // as numVertices * 2 // ============================================================================ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) @@ -3146,7 +3146,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) if( m_silhouetteIndex[meshIndex] == nullptr ) { -// DBGPRINTF(( "Unable to allcoate silhouette storage '%d'\n", numEntries )); +// DBGPRINTF(( "Unable to allocate silhouette storage '%d'\n", numEntries )); assert( 0 ); return FALSE; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp index 7f7ab7c11b4..a28841a02ab 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp @@ -35,7 +35,7 @@ // // Module: Debug // -// File name: W3DGameDevice/GameClisnt/W3DDebugDisplay.cpp +// File name: W3DGameDevice/GameClient/W3DDebugDisplay.cpp // // Created: 11/13/01 TR // diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index de50039400c..f8bb76df4ba 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1803,7 +1803,7 @@ void W3DDisplay::draw( void ) { DisplayString *displayString = TheDisplayStringManager->newDisplayString(); - // set word wrap if neccessary + // set word wrap if necessary Int wordWrapWidth = TheDisplay->getWidth() - 20; displayString->setWordWrap( wordWrapWidth ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index 848ea23b4e9..736c4c40f68 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -483,7 +483,7 @@ void W3DMouse::draw(void) if (m_currentRedrawMode == RM_DX8 && m_currentD3DCursor != NONE) { - //called from upate thread or rendering loop. Tells D3D where + //called from update thread or rendering loop. Tells D3D where //to draw the mouse cursor. LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); if (m_pDev) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index cb6472b884f..62e23d988fe 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -1025,7 +1025,7 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const } /*********************************************************************************************** - * Animatable3DObjClass::Single_Anim_Progress -- progess anims for loop and once * + * Animatable3DObjClass::Single_Anim_Progress -- progress anims for loop and once * * * * INPUT: * * * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp index bb9031fd477..77a1935d99c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -271,7 +271,7 @@ void CameraClass::Set_Transform(const Matrix3D &m) /*********************************************************************************************** * CameraClass::Set_Position -- Set the position of the camera * * * - * This is overriden to invalidate the cached frustum parameters * + * This is overridden to invalidate the cached frustum parameters * * * * INPUT: * * * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index 3e2949b08ea..bb19bf8df48 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -1317,7 +1317,7 @@ void DazzleRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) /**************************************************************************************** - DazzleRenderObjClass - Persistant object support. + DazzleRenderObjClass - Persistent object support. Dazzles are going to save their type and their transform and simply re-create another dazzle of the same type when loaded. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h index 28aede3f164..6e8b2de491a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h @@ -298,7 +298,7 @@ class DazzleRenderObjClass : public RenderObjClass // internally by the Render() function. void Set_Layer(DazzleLayerClass *layer); - // Persistant object save-load interface + // Persistent object save-load interface // Dazzles save their "dazzle-type" and transform virtual const PersistFactoryClass & Get_Factory (void) const; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 9ad2a277c06..e34b66ac244 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -400,7 +400,7 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Inits(void) Compute_Caps(D3DFormat_To_WW3DFormat(DisplayFormat)); /* - ** Initalize any other subsystems inside of WW3D + ** Initialize any other subsystems inside of WW3D */ MissingTexture::_Init(); TextureFilterClass::_Init_Filters((TextureFilterClass::TextureFilterMode)WW3D::Get_Texture_Filter()); @@ -1972,7 +1972,7 @@ void DX8Wrapper::Draw( break; } } -#endif // MESH_RENDER_SHAPSHOT_ENABLED +#endif // MESH_RENDER_SNAPSHOT_ENABLED SNAPSHOT_SAY(("DX8 - draw %d polygons (%d vertices)",polygon_count,vertex_count)); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 6993d836902..4e8dc5d665e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -3405,7 +3405,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) } // - // Attempt to find an OBBox mesh inside the heirarchy + // Attempt to find an OBBox mesh inside the hierarchy // int index = high_lod.Count (); while (index -- && BoundingBoxIndex == -1) { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.h index c4de3202164..c7cf558e206 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.h @@ -234,7 +234,7 @@ class HLodClass : public W3DMPO, public Animatable3DObjClass ModelArrayClass * Lod; // - // An animating heirarchy can use a hidden CLASSID_OBBOX mesh to represent its bounding + // An animating hierarchy can use a hidden CLASSID_OBBOX mesh to represent its bounding // box as it animates. This is the sub object index of that mesh (if it exists). // int BoundingBoxIndex; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.cpp index 7ab894984dc..81fbe8a2a7f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.cpp @@ -49,8 +49,8 @@ * LightClass::Load_W3D -- Initialize this light from a W3D file * * LightClass::Save_W3D -- Save this light's settings into a W3D file * * LightClass::Get_Factory -- get the PersistFactory for LightClass * - * LightClass::Save -- persistant object support * - * LightClass::Load -- persistant object support * + * LightClass::Save -- persistent object support * + * LightClass::Load -- persistent object support * * LightImpClass::LightImpClass -- constructor * * LightImpClass::Process_Push -- exposes the "push" process for an srLight * * LightImpClass::Process_Pop -- exposes the "pop" process for an srLight * @@ -508,7 +508,7 @@ const PersistFactoryClass & LightClass::Get_Factory (void) const /*********************************************************************************************** - * LightClass::Save -- persistant object support * + * LightClass::Save -- persistent object support * * * * INPUT: * * * @@ -535,7 +535,7 @@ bool LightClass::Save (ChunkSaveClass &csave) /*********************************************************************************************** - * LightClass::Load -- persistant object support * + * LightClass::Load -- persistent object support * * * * INPUT: * * * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.h index 4e0099d19c0..44af6bea46e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/light.h @@ -143,7 +143,7 @@ class LightClass : public RenderObjClass WW3DErrorType Save_W3D(ChunkSaveClass & csave); ///////////////////////////////////////////////////////////////////////////// - // Persistant object save-load interface + // Persistent object save-load interface ///////////////////////////////////////////////////////////////////////////// virtual const PersistFactoryClass & Get_Factory (void) const; virtual bool Save (ChunkSaveClass &csave); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h index 832d2ce4d65..2a86bb064fb 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h @@ -151,6 +151,6 @@ class LightEnvironmentClass InputLightStruct InputLights[MAX_LIGHTS]; // input lights Vector3 OutputAmbient; // scene ambient + lights' ambients - OutputLightStruct OutputLights[MAX_LIGHTS]; // ouput lights + OutputLightStruct OutputLights[MAX_LIGHTS]; // output lights }; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index 7923ba8496c..16ab03a5595 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -832,7 +832,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) } /* - ** Propogate the accumulated normals to all of the other verts which share them + ** Propagate the accumulated normals to all of the other verts which share them */ for (vertidx = 0; vertidx < VertCount; vertidx++) { int shadeindex = Verts[vertidx].ShadeIndex; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h index bf07f427bde..3ce352a6a1c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h @@ -227,7 +227,7 @@ class MeshBuilderClass void Compute_Tangent_Basis(); /* - ** World information managment. Used to give the mesh builder information + ** World information management. Used to give the mesh builder information ** about the world outside of its mesh. */ WorldInfoClass * Peek_World_Info(void) const { return WorldInfo; } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h index 7f126753486..66ad90c5014 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h @@ -261,7 +261,7 @@ class ParticleBufferClass : public RenderObjClass // last update. void Update_Non_New_Particles(unsigned int elapsed); - // Seperate circular buffer used by the emitter to pass new particles. + // Separate circular buffer used by the emitter to pass new particles. // It is implemented as an array, start and end indices and a count (to // differentiate between completely full and completely empty). NewParticleStruct * NewParticleQueue; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index a1b12dedf62..de2fee103d9 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -315,7 +315,7 @@ ParticleEmitterDefClass::Normalize_Filename (void) TCHAR path[MAX_PATH]; ::lstrcpy (path, m_Info.TextureFilename); - // Find the last occurance of the directory deliminator + // Find the last occurrence of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); if (filename != nullptr) { diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h index 7a9235d10b4..4682183dfe4 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h @@ -640,7 +640,7 @@ struct W3dRGBAStruct // MATERIALS // // Surrender 1.40 significantly changed the way that materials are described. To -// accomodate this, the w3d file format has changed since there are new features and +// accommodate this, the w3d file format has changed since there are new features and // optimizations that we want to take advangage of. // // The VertexMaterial defines parameters which control the calculation of the primary diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 3fddb5a4392..3e1757d9bbc 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -487,7 +487,7 @@ void *WW3D::Get_Window( void ) } /*********************************************************************************************** - * WW3D::Is_Windowed -- returns wether we are currently in a windowed mode * + * WW3D::Is_Windowed -- returns whether we are currently in a windowed mode * * * * INPUT: * * * @@ -964,7 +964,7 @@ WW3DErrorType WW3D::Render(SceneClass * scene,CameraClass * cam,bool clear,bool } // Set the global ambient light value here. If the scene is using the LightEnvironment system - // this setting will get overriden. + // this setting will get overridden. DX8Wrapper::Set_Ambient(scene->Get_Ambient_Light()); // render the scene diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 24906129b0e..012f4ba6a81 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -402,7 +402,7 @@ class WW3D // RenderObject on construction. The native screen size is the screen size // at which the object was designed to be viewed, and it is used in the // texture resizing algorithm (may be used in future for other things). - // If the default is overriden, it will usually be in the asset manager + // If the default is overridden, it will usually be in the asset manager // post-load callback. static float DefaultNativeScreenSize; diff --git a/Generals/Code/Tools/GUIEdit/Include/HierarchyView.h b/Generals/Code/Tools/GUIEdit/Include/HierarchyView.h index c622a266c8a..984d42d17c2 100644 --- a/Generals/Code/Tools/GUIEdit/Include/HierarchyView.h +++ b/Generals/Code/Tools/GUIEdit/Include/HierarchyView.h @@ -38,7 +38,7 @@ // // Created: Colin Day, July 2001 // -// Desc: Manipulation the widows heirarchy through the tree +// Desc: Manipulates the window's hierarchy through the tree // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 101dfeda44c..3062ebc1ba9 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -241,7 +241,7 @@ static void removeScrollbar( GameWindow *listbox ) } // resizeMaxItems ============================================================= -/** Change the max items that a listbox can accomodate */ +/** Change the max items that a listbox can accommodate */ //============================================================================= static void resizeMaxItems( GameWindow *listbox, UnsignedInt newMaxItems ) { diff --git a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index cc2c8989e62..75f55e99051 100644 --- a/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -50,7 +50,7 @@ GUIEditWindowManager *TheGUIEditWindowManager = nullptr; ///< editor use only /////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- -/** Is the given widnow in the clipboard at the top level. NOTE that +/** Is the given window in the clipboard at the top level. NOTE that * children are NOT included in this search */ //------------------------------------------------------------------------------------------------- Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, @@ -762,7 +762,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } //------------------------------------------------------------------------------------------------- -/** Convinience funtion to copy the Draw state info for a given instance */ +/** Convinience function to copy the Draw state info for a given instance */ //------------------------------------------------------------------------------------------------- void InstDrawCopy ( WinInstanceData *instData, WinInstanceData *sourceInstData) { diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index 4e86ad9c8ee..dd8a84b8787 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -38,7 +38,7 @@ // // Created: Colin Day, July 2001 // -// Desc: Manipulation the widows heirarchy through the tree +// Desc: Manipulate the window's hierarchy through the tree // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// @@ -707,7 +707,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, } // - // add children if requested, but not on gadgets no matter what becuase + // add children if requested, but not on gadgets no matter what because // they are "atomic units", except for tab controls. // if( addChildren && TheEditor->windowIsGadget( window ) == FALSE || (window->winGetStyle() & GWS_TAB_CONTROL) ) diff --git a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index 28f5ebc6204..45ac8c09809 100644 --- a/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -2173,7 +2173,7 @@ void LayoutScheme::openDialog( void ) ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) { - // santiy + // sanity if( id < 0 || id >= NUM_STATE_IDENTIFIERS ) { diff --git a/Generals/Code/Tools/GUIEdit/Source/Save.cpp b/Generals/Code/Tools/GUIEdit/Source/Save.cpp index db74eced264..92fd1616a09 100644 --- a/Generals/Code/Tools/GUIEdit/Source/Save.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/Save.cpp @@ -719,7 +719,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], " LETTERSANDNUMBERS: %d;\n", comboData->lettersAndNumbersOnly ); writeBufferToFile( fp, buffer ); - //Save teh dropDownButton draw data for the combo box + //Save the dropDownButton draw data for the combo box if( comboData->dropDownButton ) { @@ -1252,7 +1252,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // save each of the windows in reverse order, when we load a layout // file in this reverse order, the original window order we presently // see in the editor will be recreated because windows loaded after - // other windows are placed on the top of the widnow stack + // other windows are placed on the top of the window stack // // go to end of window list diff --git a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp index 36d262ed99b..fdc7ec2d34d 100644 --- a/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -766,7 +766,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } // AboutCallback ============================================================== -/** Mesage handler for about box. */ +/** Message handler for about box. */ //============================================================================= LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) diff --git a/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp index ea1bc9dea10..d4d0b00c39e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ContourOptions.cpp @@ -30,7 +30,7 @@ Int ContourOptions::m_contourStep = 5; Int ContourOptions::m_contourOffset = 0; Int ContourOptions::m_contourWidth = 1; ///////////////////////////////////////////////////////////////////////////// -/// ContourOptions dialog trivial construstor - Create does the real work. +/// ContourOptions dialog trivial constructor - Create does the real work. ContourOptions::ContourOptions(CWnd* pParent /*=nullptr*/) diff --git a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index 6d6db24f6da..e19a98632b4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -31,7 +31,7 @@ Int FeatherOptions::m_currentFeather = 0; Int FeatherOptions::m_currentRate = 3; Int FeatherOptions::m_currentRadius = 1; ///////////////////////////////////////////////////////////////////////////// -/// FeatherOptions dialog trivial construstor - Create does the real work. +/// FeatherOptions dialog trivial constructor - Create does the real work. FeatherOptions::FeatherOptions(CWnd* pParent /*=nullptr*/) diff --git a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 6879f5eb27f..107ad345e28 100644 --- a/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -28,7 +28,7 @@ #include "wbview3d.h" ///////////////////////////////////////////////////////////////////////////// -/// GlobalLightOptions dialog trivial construstor - Create does the real work. +/// GlobalLightOptions dialog trivial constructor - Create does the real work. GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=nullptr*/) diff --git a/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp index 10ee00a028d..6df468ce222 100644 --- a/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/LightOptions.cpp @@ -30,7 +30,7 @@ LightOptions *LightOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// -/// LightOptions dialog trivial construstor - Create does the real work. +/// LightOptions dialog trivial constructor - Create does the real work. LightOptions::LightOptions(CWnd* pParent /*=nullptr*/) diff --git a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp index bde4aa980f9..90a0e88ba54 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -31,7 +31,7 @@ Int MoundOptions::m_currentWidth = 0; Int MoundOptions::m_currentHeight = 0; Int MoundOptions::m_currentFeather = 0; ///////////////////////////////////////////////////////////////////////////// -/// MoundOptions dialog trivial construstor - Create does the real work. +/// MoundOptions dialog trivial constructor - Create does the real work. MoundOptions::MoundOptions(CWnd* pParent /*=nullptr*/) diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index 4ae9c528cb3..2c09922332e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -265,7 +265,7 @@ WorldHeightMapEdit::WorldHeightMapEdit(ChunkInputStream *pStrm): for (i=0; i Date: Sat, 17 Jan 2026 10:58:37 -0500 Subject: [PATCH 058/211] docs: Fix spelling errors in GeneralsMD Libraries, Tools, GameEngineDevice comments (#2124) --- .../Include/W3DDevice/Common/W3DFunctionLexicon.h | 2 +- .../W3DDevice/GameClient/Module/W3DModelDraw.h | 2 +- .../GameClient/Module/W3DOverlordAircraftDraw.h | 2 +- .../GameClient/Module/W3DOverlordTankDraw.h | 2 +- .../GameClient/Module/W3DOverlordTruckDraw.h | 2 +- .../W3DDevice/GameClient/Module/W3DTankDraw.h | 2 +- .../Include/W3DDevice/GameClient/W3DBufferManager.h | 2 +- .../Include/W3DDevice/GameClient/W3DDebugDisplay.h | 2 +- .../Include/W3DDevice/GameClient/W3DDisplay.h | 4 ++-- .../Include/W3DDevice/GameClient/W3DDisplayString.h | 2 +- .../Include/W3DDevice/GameClient/W3DGadget.h | 2 +- .../Include/W3DDevice/GameClient/W3DGameClient.h | 2 +- .../Include/W3DDevice/GameClient/W3DGameWindow.h | 4 ++-- .../Include/W3DDevice/GameClient/W3DPoly.h | 2 +- .../W3DDevice/GameClient/W3DProjectedShadow.h | 2 +- .../W3DDevice/GameClient/W3DVolumetricShadow.h | 6 +++--- .../Include/Win32Device/GameClient/Win32DIKeyboard.h | 2 +- .../Include/Win32Device/GameClient/Win32DIMouse.h | 2 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 6 +++--- .../Drawable/Draw/W3DOverlordAircraftDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp | 2 +- .../Drawable/Draw/W3DOverlordTruckDraw.cpp | 2 +- .../W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp | 2 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 10 +++++----- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 12 ++++++------ .../Source/W3DDevice/GameClient/W3DDebugDisplay.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 10 +++++----- .../Source/W3DDevice/GameClient/W3DDisplayString.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DGameClient.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DInGameUI.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DMouse.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DPoly.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DRoadBuffer.cpp | 10 +++++----- .../Source/W3DDevice/GameClient/W3DScene.cpp | 2 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 2 +- .../W3DDevice/GameClient/W3dWaypointBuffer.cpp | 6 +++--- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- .../Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp | 2 +- .../Source/Win32Device/Common/Win32GameEngine.cpp | 2 +- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/camera.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/camera.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/dazzle.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp | 2 +- .../Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp | 8 ++++---- .../Code/Libraries/Source/WWVegas/WW3D2/hlod.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/light.cpp | 8 ++++---- .../Code/Libraries/Source/WWVegas/WW3D2/light.h | 2 +- .../Source/WWVegas/WW3D2/lightenvironment.cpp | 2 +- .../Source/WWVegas/WW3D2/lightenvironment.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/mapper.h | 6 +++--- .../Libraries/Source/WWVegas/WW3D2/matrixmapper.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp | 4 ++-- .../Libraries/Source/WWVegas/WW3D2/meshbuild.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h | 2 +- .../Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/part_buf.h | 6 +++--- .../Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/scene.cpp | 4 ++-- .../Libraries/Source/WWVegas/WW3D2/vertmaterial.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 10 +++++----- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.h | 2 +- GeneralsMD/Code/Main/WinMain.cpp | 2 +- GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h | 2 +- .../Code/Tools/GUIEdit/Include/GUIEditDisplay.h | 2 +- .../Code/Tools/GUIEdit/Include/HierarchyView.h | 2 +- GeneralsMD/Code/Tools/GUIEdit/Include/LayoutScheme.h | 2 +- .../Source/Dialog Procedures/CallbackEditor.cpp | 2 +- .../Source/Dialog Procedures/ListboxProperties.cpp | 4 ++-- GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp | 2 +- .../Tools/GUIEdit/Source/GUIEditWindowManager.cpp | 8 ++++---- .../Code/Tools/GUIEdit/Source/HierarchyView.cpp | 10 +++++----- .../Code/Tools/GUIEdit/Source/LayoutScheme.cpp | 4 ++-- GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp | 4 ++-- GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp | 4 ++-- GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h | 2 +- .../Code/Tools/WorldBuilder/include/WBHeightMap.h | 2 +- .../Code/Tools/WorldBuilder/include/WHeightMapEdit.h | 4 ++-- .../Code/Tools/WorldBuilder/include/WorldBuilder.h | 2 +- GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp | 2 +- .../Code/Tools/WorldBuilder/src/ContourOptions.cpp | 4 ++-- .../Code/Tools/WorldBuilder/src/EditAction.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditCondition.cpp | 2 +- .../Code/Tools/WorldBuilder/src/EditParameter.cpp | 4 ++-- .../Code/Tools/WorldBuilder/src/FeatherOptions.cpp | 2 +- .../Tools/WorldBuilder/src/GlobalLightOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/LightOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/MoundOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp | 4 ++-- .../Code/Tools/WorldBuilder/src/WaterOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WaypointOptions.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WorldBuilder.cpp | 2 +- .../Code/Tools/WorldBuilder/src/WorldBuilderView.cpp | 2 +- .../Code/Tools/WorldBuilder/src/brushoptions.cpp | 2 +- GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp | 2 +- GeneralsMD/Code/Tools/wdump/rawfilem.cpp | 6 +++--- 107 files changed, 180 insertions(+), 180 deletions(-) diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h index 71e3dd5c472..2116e42d293 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/Common/W3DFunctionLexicon.h @@ -24,7 +24,7 @@ // FILE: W3DFunctionLexicon.h ///////////////////////////////////////////////////////////////////// // Created: Colin Day, September 2001 -// Desc: Function lexicon for w3d specific funtion pointers +// Desc: Function lexicon for w3d specific function pointers /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h index bd0109ce24d..d709e27e31f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h @@ -398,7 +398,7 @@ class W3DModelDraw : public DrawModule, public ObjectDrawInterface /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ virtual void setAnimationCompletionTime(UnsignedInt numFrames); diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordAircraftDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordAircraftDraw.h index b66926f9600..ef47b75b421 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordAircraftDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordAircraftDraw.h @@ -26,7 +26,7 @@ // // FILE: W3DOverlordAircraftDraw.h // Author: Mark Lorenzen, April 2003 -// Desc: Units that recieve portable structure upgrades (like the Overlord Tank) have a super specific special need. +// Desc: Units that receive portable structure upgrades (like the Overlord Tank) have a super specific special need. // He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. // In the case of aircraft (Helix, SpectreGunship, etc.) we need this draw module which mimics the OverlordTankDraw diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h index 72a39809598..b32133ecbb9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTankDraw.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTankDraw.h //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTankDraw.h //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTruckDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTruckDraw.h index b20059f8338..41fdb81d749 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTruckDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DOverlordTruckDraw.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTruckDraw.h //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTruckDraw.h //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h index 2c659194a9f..fdd76b97efa 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DTankDraw.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DTankDraw.h //////////////////////////////////////////////////////////////////////////// +// FILE: W3DTankDraw.h //////////////////////////////////////////////////////////////////////////// // Draw a tank // Author: Michael S. Booth, October 2001 /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h index 63643650732..358f55e058e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h @@ -142,7 +142,7 @@ class W3DBufferManager void freeAllSlots(void); ///rotateLocalTransformZ(rotation); - // Attatch it to the object... + // Attach it to the object... sys->attachToDrawable(drawable); // important: mark it as do-not-save, since we'll just re-create it when we reload. @@ -3801,7 +3801,7 @@ void W3DModelDraw::setAnimationLoopDuration(UnsignedInt numFrames) /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ void W3DModelDraw::setAnimationCompletionTime(UnsignedInt numFrames) { @@ -4244,7 +4244,7 @@ void W3DModelDraw::xfer( Xfer *xfer ) int curMode, dummy3; hlod->Peek_Animation_And_Info(dummy1, dummy3, curMode, dummy2); - // srj sez: do not change the animation mode. it's too risky, since if you change (say) a nonlooping + // srj sez: do not change the animation mode. it's too risky, since if you change (say) a non-looping // to a looping, something might break since it could rely on that anim terminating. // set animation data diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp index 47d73176ddb..bd404e2f34a 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordAircraftDraw.cpp @@ -26,7 +26,7 @@ // // FILE: W3DOverlordAircraftDraw.h // Author: Mark Lorenzen, April 2003 -// Desc: Units that recieve portable structure upgrades (like the OverlordTnk) have a super specific special need. +// Desc: Units that receive portable structure upgrades (like the OverlordTnk) have a super specific special need. // He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. // In the case of aircraft (Helix, SpectreGunship, etc.) we need this draw module which mimics the OverlordTnkDraw diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp index 994370e5c0d..ae6318fb465 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTankDraw.cpp @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTankDraw.cpp //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTankDraw.cpp //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp index 2d8cac63d1a..f349ca73e32 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DOverlordTruckDraw.cpp @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FIEL: W3DOverlordTruckDraw.cpp //////////////////////////////////////////////////////////////////////////// +// FILE: W3DOverlordTruckDraw.cpp //////////////////////////////////////////////////////////////////////////// // Author: Graham Smallwood, October 2002 // Desc: The Overlord has a super specific special need. He needs his rider to draw explicitly after him, // and he needs direct access to get that rider when everyone else can't see it because of the OverlordContain. diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp index ff3ee8a701c..e1cd24678b4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp @@ -88,7 +88,7 @@ static void drawHiliteBar( const Image *left, const Image *right, barWindowSize.y = endY - startY; // - // the bar window size will always be at least big enough to accomodate + // the bar window size will always be at least big enough to accommodate // the left and right ends // if( barWindowSize.x < left->getImageWidth() + right->getImageWidth() ) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 47cb4c8d3c0..170ec2ffcd9 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -60,7 +60,7 @@ /** @todo: We're going to have a pool of a couple rendertargets to use in rare cases when dynamic shadows need to be generated. Maybe we can -even get away with a single one that gets used immediatly to render, then +even get away with a single one that gets used immediately to render, then recycled. For most of the objects, we need to have a static texture that is reused for all instances on the level. @@ -855,7 +855,7 @@ void W3DProjectedShadowManager::queueDecal(W3DProjectedShadow *shadow) if (vecLength != 0.0f) //prevent divide by zero { uVector *= 1.0f/vecLength; vVector = uVector; - vVector.Rotate_Z(-1.0f,0.0f); //rotate u vector by -90 degress to get v vector. + vVector.Rotate_Z(-1.0f,0.0f); //rotate u vector by -90 degrees to get v vector. } else { @@ -868,7 +868,7 @@ void W3DProjectedShadowManager::queueDecal(W3DProjectedShadow *shadow) vVector.Set(0.0f,-1.0f,0.0f); //Point uvector in default direction uVector = vVector; - uVector.Rotate_Z(1.0f,0.0f); //rotate v vector by 90 degress to get u vector. + uVector.Rotate_Z(1.0f,0.0f); //rotate v vector by 90 degrees to get u vector. } //Compute bounding box of projection @@ -2132,7 +2132,7 @@ void W3DProjectedShadow::updateTexture(Vector3 &lightPos) m_shadowProjector->Compute_Perspective_Projection(m_robj,objToLight); m_shadowProjector->Set_Render_Target(TheW3DProjectedShadowManager->getRenderTarget()); - //Set ambient to 0, so we get a black shadow on solid backgroud + //Set ambient to 0, so we get a black shadow on solid background context=TheW3DProjectedShadowManager->getRenderContext(); @@ -2169,7 +2169,7 @@ void W3DProjectedShadow::updateTexture(Vector3 &lightPos) m_shadowTexture[0]->getTexture()->Get_Level_Description(surface_desc); //default shadow texture points along world -x axis (west). Rotate uv coordinates to fit actual light direction Vector3 uVec = objectToLight * DECAL_TEXELS_PER_WORLD_UNIT / (float)surface_desc.Width; - objectToLight.Rotate_Z(-1.0f,0.0f); //rotate u vector by -90 degress to get v vector. + objectToLight.Rotate_Z(-1.0f,0.0f); //rotate u vector by -90 degrees to get v vector. Vector3 vVec = objectToLight * DECAL_TEXELS_PER_WORLD_UNIT / (float)surface_desc.Height; m_shadowTexture[0]->setDecalUVAxis(uVec, vVec); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 478c1f78f24..954a3ab4796 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -898,7 +898,7 @@ if (!m_polyNeighbors) { // buildPolygonNeighbors ====================================================== // Whenever we set a new geometry we want to build some information about -// the faces in the new geometry so that we can efficienty traverse across +// the faces in the new geometry so that we can efficiently traverse across // the surface to neighboring polygons // ============================================================================ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) @@ -934,7 +934,7 @@ void W3DShadowGeometryMesh::buildPolygonNeighbors( void ) // building our neighbor information for the very first time ... // if our current geometry has a different number of polygons than // we had previously calculated we need to delete and reallocate a - // new storate space for the neighbor information + // new storage space for the neighbor information // if( numPolys != m_numPolyNeighbors ) { @@ -1105,7 +1105,7 @@ Bool W3DShadowGeometryMesh::allocateNeighbors( Int numPolys ) } - // list is now acutally allocated + // list is now actually allocated m_numPolyNeighbors = numPolys; return TRUE; // success! @@ -3236,7 +3236,7 @@ void W3DVolumetricShadow::deleteShadowVolume( Int volumeIndex ) // resetShadowVolume ========================================================== // Reset the contents of the shadow volume information. Since we're using // a geometry class it would be ideal if these structures had a reset -// option where their resoures were released back to a pool rather than +// option where their resources were released back to a pool rather than // delete and allocate new storage space // ============================================================================ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) @@ -3273,7 +3273,7 @@ void W3DVolumetricShadow::resetShadowVolume( Int volumeIndex, Int meshIndex ) // allocateSilhouette ========================================================= // Allocate space for new silhouette storage, the number of vertices passed // in is the total vertices in the model, a silhouette must be able to -// accomodate that as a series of disjoint edge pairs, otherwise known +// accommodate that as a series of disjoint edge pairs, otherwise known // as numVertices * 2 // ============================================================================ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) @@ -3290,7 +3290,7 @@ Bool W3DVolumetricShadow::allocateSilhouette(Int meshIndex, Int numVertices ) if( m_silhouetteIndex[meshIndex] == nullptr ) { -// DBGPRINTF(( "Unable to allcoate silhouette storage '%d'\n", numEntries )); +// DBGPRINTF(( "Unable to allocate silhouette storage '%d'\n", numEntries )); assert( 0 ); return FALSE; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp index 014c34464e0..455898b79a7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp @@ -35,7 +35,7 @@ // // Module: Debug // -// File name: W3DGameDevice/GameClisnt/W3DDebugDisplay.cpp +// File name: W3DGameDevice/GameClient/W3DDebugDisplay.cpp // // Created: 11/13/01 TR // diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 2f60e418a96..41f566c9dfc 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -25,7 +25,7 @@ // FILE: W3DDisplay.cpp /////////////////////////////////////////////////////// // // W3D Implementation for the Game Display which is responsible for creating -// and maintaning the entire visual display +// and maintaining the entire visual display // // Author: Colin Day, April 2001 // @@ -1892,7 +1892,7 @@ void W3DDisplay::draw( void ) { DisplayString *displayString = TheDisplayStringManager->newDisplayString(); - // set word wrap if neccessary + // set word wrap if necessary Int wordWrapWidth = TheDisplay->getWidth() - 20; displayString->setWordWrap( wordWrapWidth ); @@ -2259,7 +2259,7 @@ void W3DDisplay::drawRectClock(Int startX, Int startY, Int width, Int height, In m_2DRender->Reset(); m_2DRender->Enable_Texturing( FALSE ); -// The rectanges are numberd as follows +// The rectangles are numberd as follows //(x,y) |---------| // | 4 | 1 | // |----+----| @@ -2342,7 +2342,7 @@ void W3DDisplay::drawRectClock(Int startX, Int startY, Int width, Int height, In } else if(percent > 25) { - // rectangel #1 + // rectangle #1 m_2DRender->Add_Rect(RectClass( startX + width/2, startY, startX + width, startY + height/2), 0,0, color); // draw the part of rectangle 2 @@ -2423,7 +2423,7 @@ void W3DDisplay::drawRemainingRectClock(Int startX, Int startY, Int width, Int h m_2DRender->Reset(); m_2DRender->Enable_Texturing( FALSE ); -// The rectanges are numbered as follows +// The rectangles are numbered as follows //(x,y) |---------| // | 4 | 1 | // |----+----| diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp index 88e7bb3cb80..84cfd9d800f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp @@ -189,7 +189,7 @@ void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDr } // - // if our position has changed, or our colors have chagned, or our + // if our position has changed, or our colors have changed, or our // text data has changed, we need to redo the texture quads // if( needNewPolys || diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp index d2f394e1589..e870b5013bb 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp @@ -85,7 +85,7 @@ void W3DGameClient::init( void ) } //------------------------------------------------------------------------------------------------- -/** Per frame udpate, note we are extending functionality */ +/** Per frame update, note we are extending functionality */ //------------------------------------------------------------------------------------------------- void W3DGameClient::update( void ) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp index f482b3ebb48..83b4100c3e2 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp @@ -383,7 +383,7 @@ void W3DInGameUI::reset( void ) } //------------------------------------------------------------------------------------------------- -/** Draw member for the W3D implemenation of the game user interface */ +/** Draw member for the W3D implementation of the game user interface */ //------------------------------------------------------------------------------------------------- void W3DInGameUI::draw( void ) { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp index 9ece5013c32..206eae593b7 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DMouse.cpp @@ -483,7 +483,7 @@ void W3DMouse::draw(void) if (m_currentRedrawMode == RM_DX8 && m_currentD3DCursor != NONE) { - //called from upate thread or rendering loop. Tells D3D where + //called from update thread or rendering loop. Tells D3D where //to draw the mouse cursor. LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); if (m_pDev) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp index 8381408227a..2e518753ee6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp @@ -63,7 +63,7 @@ void ClipPolyClass::Clip(const PlaneClass & plane,ClipPolyClass & dest) const prev_point_in_front = !plane.In_Front(Verts[iprev]); // Note, plane normal is outward so we invert this test for (Int j=0; jgetStencilShadowMask(); DX8Wrapper::Set_DX8_Render_State(D3DRS_STENCILREF, 0x80808080 ); DX8Wrapper::Set_DX8_Render_State(D3DRS_STENCILMASK, occludedMask ); //isolate bits containing occluder|playerIndex diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp index 0c991ffdc9c..bb732827dba 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp @@ -230,7 +230,7 @@ void W3DShroud::ReleaseResources(void) Bool W3DShroud::ReAcquireResources(void) { if (!m_dstTextureWidth) - return TRUE; //nothing to reaquire since shroud was never initialized with valid data + return TRUE; //nothing to reacquire since shroud was never initialized with valid data DEBUG_ASSERTCRASH( m_pDstTexture == nullptr, ("ReAcquire of existing shroud texture")); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index a49fa800784..bb0dd802ae6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -162,7 +162,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) if( TheInGameUI->isInWaypointMode() ) { //Create a default light environment with no lights and only full ambient. - //@todo: Fix later by copying default scene light environement from W3DScene.cpp. + //@todo: Fix later by copying default scene light environment from W3DScene.cpp. LightEnvironmentClass lightEnv; lightEnv.Reset(Vector3(0,0,0), Vector3(1.0f,1.0f,1.0f)); lightEnv.Pre_Render_Update(rinfo.Camera.Get_Transform()); @@ -214,7 +214,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) else // maybe we want to draw rally points, then? { //Create a default light environment with no lights and only full ambient. - //@todo: Fix later by copying default scene light environement from W3DScene.cpp. + //@todo: Fix later by copying default scene light environment from W3DScene.cpp. LightEnvironmentClass lightEnv; lightEnv.Reset(Vector3(0,0,0), Vector3(1.0f,1.0f,1.0f)); lightEnv.Pre_Render_Update(rinfo.Camera.Get_Transform()); @@ -475,7 +475,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) numPoints++; - //and for that matter did we find a far side coner? + //and for that matter did we find a far side corner? if (pFarElbow)//did we find a nearest corner? { // but let's test the dot of the first elbow against the rally point to find out diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index c66681a7ad8..57b31e11271 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -1214,7 +1214,7 @@ void W3DGhostObjectManager::xfer( Xfer *xfer ) DEBUG_ASSERTCRASH( ghostObject != nullptr, ("W3DGhostObjectManager::xfer - Could not create ghost object for object '%s'", object->getTemplate()->getName().str()) ); - // link the ghost object and logical object togehter through partition/ghostObject dat + // link the ghost object and logical object together through partition/ghostObject dat DEBUG_ASSERTCRASH( object->friend_getPartitionData()->getGhostObject() == nullptr, ("W3DGhostObjectManager::xfer - Ghost object already on object '%s'", object->getTemplate()->getName().str()) ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp index 6161951a55d..d1eb4a8f825 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp @@ -135,7 +135,7 @@ Bool W3DTerrainLogic::loadMap( AsciiString filename , Bool query ) m_mapDX=terrainHeightMap->getXExtent(); m_mapDY=terrainHeightMap->getYExtent(); - // now, get all the boudnaries, and set the current active boundary to boundary 0. + // now, get all the boundaries, and set the current active boundary to boundary 0. m_boundaries = terrainHeightMap->getAllBoundaries(); m_activeBoundary = 0; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 286f442ae91..ff93216bd8e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -127,7 +127,7 @@ void Win32GameEngine::update( void ) //------------------------------------------------------------------------------------------------- /** This function may be called from within this application to let - * Microsoft Windows do its message processing and dispatching. Presumeably + * Microsoft Windows do its message processing and dispatching. Presumably * we would call this at least once each time around the game loop to keep * Windows services from backing up */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp index 20355a57b7f..eda1055a510 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp @@ -38,7 +38,7 @@ * AABTreeBuilderClass::~AABTreeBuilderClass -- Destructor * * AABTreeBuilderClass::Reset -- reset the builder, delete all arrays * * AABTreeBuilderClass::Build_AABTree -- Build an AABTree for the given mesh. * - * AABTreeBuilderClass::Build_Tree -- recursivly builds the culling tree * + * AABTreeBuilderClass::Build_Tree -- recursively builds the culling tree * * AABTreeBuilderClass::Select_Splitting_Plane -- select a partition for the given polys * * AABTreeBuilderClass::Compute_Plane_Score -- evaluate the suitability of a partition plane * * AABTreeBuilderClass::Which_Side -- which side of a plane is the given poly * @@ -264,7 +264,7 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,Vector3i * polys,int vertc } /*********************************************************************************************** - * AABTreeBuilderClass::Build_Tree -- recursivly builds the culling tree * + * AABTreeBuilderClass::Build_Tree -- recursively builds the culling tree * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index b83b1c8f8f0..56cab1628ff 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -1033,7 +1033,7 @@ float Animatable3DObjClass::Compute_Current_Frame(float *newDirection) const } /*********************************************************************************************** - * Animatable3DObjClass::Single_Anim_Progress -- progess anims for loop and once * + * Animatable3DObjClass::Single_Anim_Progress -- progress anims for loop and once * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index a0af1ac87cc..251ab342011 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -993,7 +993,7 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name) Load_3D_Assets( new_filename ); } - anim = HAnimManager.Get_Anim(name); // Try agai + anim = HAnimManager.Get_Anim(name); // Try again if (anim == nullptr) { HAnimManager.Register_Missing( name ); // This is now a KNOWN missing anim AssetStatusClass::Peek_Instance()->Report_Missing_HAnim(name); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h index 5a93e0e1c1b..f51658f7965 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.h @@ -64,7 +64,7 @@ class VertexMaterialClass; ** to the root and be constructed symmetrically... ** ** NOTE3: OBBoxRenderObjClass is an oriented box which is aligned with its transform -** but can have a center point that is offest from the transform's origin. +** but can have a center point that is offset from the transform's origin. ** */ class BoxRenderObjClass : public RenderObjClass diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp index 40ea25f6f21..d80d65cce28 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -133,7 +133,7 @@ CameraClass::CameraClass(const CameraClass & src) : ZBufferMin(src.ZBufferMin), ZBufferMax(src.ZBufferMax) { - // just being paraniod in case any parent class doesn't completely copy the entire state... + // just being paranoid in case any parent class doesn't completely copy the entire state... FrustumValid = false; } @@ -166,7 +166,7 @@ CameraClass & CameraClass::operator = (const CameraClass & that) ProjectionTransform = that.ProjectionTransform; CameraInvTransform = that.CameraInvTransform; - // just being paraniod in case any parent class doesn't completely copy the entire state... + // just being paranoid in case any parent class doesn't completely copy the entire state... FrustumValid = false; } @@ -271,7 +271,7 @@ void CameraClass::Set_Transform(const Matrix3D &m) /*********************************************************************************************** * CameraClass::Set_Position -- Set the position of the camera * * * - * This is overriden to invalidate the cached frustum parameters * + * This is overridden to invalidate the cached frustum parameters * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h index d1952b37e42..3fd53e51078 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -201,7 +201,7 @@ class CameraClass : public RenderObjClass bool Cull_Sphere_On_Frustum_Sides(const SphereClass & sphere) const; bool Cull_Box(const AABoxClass & box) const; - // Various properties of the camera's frustum: These funcitons return a + // Various properties of the camera's frustum: These functions return a // pointer to the internal storage of the descriptions. there will be // 6 frustum planes, 8 corner points, see the implementations of these // functions for definitions on which points/planes are associated with diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp index a86c721108c..009289e0ea2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -873,7 +873,7 @@ void DazzleRenderObjClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const void DazzleRenderObjClass::Set_Layer(DazzleLayerClass *layer) { - // Never insert a dazzle into a list if it already is on one - this caould create infinite + // Never insert a dazzle into a list if it already is on one - this could create infinite // loops in the dazzle list. if (on_list) return; @@ -909,7 +909,7 @@ RenderObjClass* DazzleRenderObjClass::Clone(void) const // ---------------------------------------------------------------------------- // // DazzleRenderObjClass's Render() function doesn't actually render the dazzle -// immediatelly but just sets the dazzle visible. This is due to the way the +// immediately but just sets the dazzle visible. This is due to the way the // dazzle system works (the dazzles need to be rendered after everything else). // Having the Render() function flag the visibility offers us the visibility // functionality of the scene graph. @@ -1420,7 +1420,7 @@ void DazzleRenderObjClass::Special_Render(SpecialRenderInfoClass & rinfo) /**************************************************************************************** - DazzleRenderObjClass - Persistant object support. + DazzleRenderObjClass - Persistent object support. Dazzles are going to save their type and their transform and simply re-create another dazzle of the same type when loaded. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h index d686856ae80..89831c4e5ff 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.h @@ -298,7 +298,7 @@ class DazzleRenderObjClass : public RenderObjClass // internally by the Render() function. void Set_Layer(DazzleLayerClass *layer); - // Persistant object save-load interface + // Persistent object save-load interface // Dazzles save their "dazzle-type" and transform virtual const PersistFactoryClass & Get_Factory (void) const; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp index 747864e6a1c..d46f8ee20b5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp @@ -77,7 +77,7 @@ ** verts - plug into DecalPolyClass, clip, pull back out ** vnorms - plug into DecalPolyClass, clip, copy back out ** texcoords - compute after poly is clipped -** material - contstant for entire poly, get from generator +** material - constant for entire poly, get from generator ** shader - constant for entire poly, get from generator ** texture - constant for entire poly, get from generator */ diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index 97027d7e321..a201b72f884 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -406,7 +406,7 @@ void DX8Wrapper::Do_Onetime_Device_Dependent_Inits(void) Compute_Caps(D3DFormat_To_WW3DFormat(DisplayFormat)); /* - ** Initalize any other subsystems inside of WW3D + ** Initialize any other subsystems inside of WW3D */ MissingTexture::_Init(); TextureFilterClass::_Init_Filters((TextureFilterClass::TextureFilterMode)WW3D::Get_Texture_Filter()); @@ -2137,7 +2137,7 @@ void DX8Wrapper::Draw( break; } } -#endif // MESH_RENDER_SHAPSHOT_ENABLED +#endif // MESH_RENDER_SNAPSHOT_ENABLED SNAPSHOT_SAY(("DX8 - draw %d polygons (%d vertices)",polygon_count,vertex_count)); @@ -3395,7 +3395,7 @@ DX8Wrapper::Set_Render_Target(IDirect3DSwapChain8 *swap_chain) swap_chain->GetBackBuffer (0, D3DBACKBUFFER_TYPE_MONO, &render_target); // - // Set this back buffer as the render targer + // Set this back buffer as the render target // Set_Render_Target (render_target, true); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index e7e08b11dc8..633d944bbb2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -502,7 +502,7 @@ class DX8Wrapper static ZTextureClass* Get_Shadow_Map(int idx) { return Shadow_Map[idx]; } // for depth map support KJM ^ - // shader system udpates KJM v + // shader system updates KJM v static void Apply_Default_State(); static void Set_Vertex_Shader(DWORD vertex_shader); @@ -713,7 +713,7 @@ class DX8Wrapper // shader system updates KJM v WWINLINE void DX8Wrapper::Set_Vertex_Shader(DWORD vertex_shader) { -#if 0 //(gth) some code is bypassing this acessor function so we can't count on this variable... +#if 0 //(gth) some code is bypassing this accessor function so we can't count on this variable... // may be incorrect if shaders are created and destroyed dynamically if (Vertex_Shader==vertex_shader) return; #endif @@ -1004,7 +1004,7 @@ WWINLINE unsigned int DX8Wrapper::Convert_Color(const Vector3& color,float alpha unsigned int col; // Multiply r, g, b and a components (0.0,...,1.0) by 255 and convert to integer. Or the integer values togerher - // such that 32 bit ingeger has AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB. + // such that 32 bit integer has AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB. __asm { sub esp,20 // space for a, r, g and b float plus fpu rounding mode diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index a572399c2f4..e65f7211d6e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp @@ -121,7 +121,7 @@ * HLodClass::Set_HTree -- replace the hierarchy tree * * HLodClass::Get_Proxy_Count -- Returns the number of proxy objects * * HLodClass::Get_Proxy -- returns the information for the i'th proxy * - * HLodClass::Set_Hidden -- Propogates the hidden bit to particle emitters. * + * HLodClass::Set_Hidden -- Propagates the hidden bit to particle emitters. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -369,7 +369,7 @@ void HLodDefClass::Initialize(HLodClass &src_lod) // Start with a fresh set of data Free (); - // Copy the name and hierarcy name from the source object + // Copy the name and hierarchy name from the source object Name = ::strdup (src_lod.Get_Name ()); const HTreeClass *phtree = src_lod.Get_HTree (); if (phtree != nullptr) { @@ -3405,7 +3405,7 @@ void HLodClass::Update_Obj_Space_Bounding_Volumes(void) } // - // Attempt to find an OBBox mesh inside the heirarchy + // Attempt to find an OBBox mesh inside the hierarchy // int index = high_lod.Count (); while (index -- && BoundingBoxIndex == -1) { @@ -3607,7 +3607,7 @@ void HLodClass::Set_HTree(HTreeClass * htree) /*********************************************************************************************** - * HLodClass::Set_Hidden -- Propogates the hidden bit to particle emitters. * + * HLodClass::Set_Hidden -- Propagates the hidden bit to particle emitters. * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h index 53c9dc95456..2a8e05031ee 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hlod.h @@ -235,7 +235,7 @@ class HLodClass : public W3DMPO, public Animatable3DObjClass ModelArrayClass * Lod; // - // An animating heirarchy can use a hidden CLASSID_OBBOX mesh to represent its bounding + // An animating hierarchy can use a hidden CLASSID_OBBOX mesh to represent its bounding // box as it animates. This is the sub object index of that mesh (if it exists). // int BoundingBoxIndex; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.cpp index aa415607bf8..c9efd20049e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.cpp @@ -49,8 +49,8 @@ * LightClass::Load_W3D -- Initialize this light from a W3D file * * LightClass::Save_W3D -- Save this light's settings into a W3D file * * LightClass::Get_Factory -- get the PersistFactory for LightClass * - * LightClass::Save -- persistant object support * - * LightClass::Load -- persistant object support * + * LightClass::Save -- persistent object support * + * LightClass::Load -- persistent object support * * LightImpClass::LightImpClass -- constructor * * LightImpClass::Process_Push -- exposes the "push" process for an srLight * * LightImpClass::Process_Pop -- exposes the "pop" process for an srLight * @@ -508,7 +508,7 @@ const PersistFactoryClass & LightClass::Get_Factory (void) const /*********************************************************************************************** - * LightClass::Save -- persistant object support * + * LightClass::Save -- persistent object support * * * * INPUT: * * * @@ -535,7 +535,7 @@ bool LightClass::Save (ChunkSaveClass &csave) /*********************************************************************************************** - * LightClass::Load -- persistant object support * + * LightClass::Load -- persistent object support * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h index cb8396e5a56..112f01550af 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/light.h @@ -144,7 +144,7 @@ class LightClass : public RenderObjClass WW3DErrorType Save_W3D(ChunkSaveClass & csave); ///////////////////////////////////////////////////////////////////////////// - // Persistant object save-load interface + // Persistent object save-load interface ///////////////////////////////////////////////////////////////////////////// virtual const PersistFactoryClass & Get_Factory (void) const; virtual bool Save (ChunkSaveClass &csave); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.cpp index 165647ea678..3f3fdb2dc65 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.cpp @@ -375,7 +375,7 @@ void LightEnvironmentClass::Add_Fill_Light(void) ** LightEnvironmentClass::Calculate_Fill_Light Implementation ** The fill light takes up to the top 3 lights in the InputList and averages them into 1 light source. ** The averaged light source is then flipped in direction and location as well as in HUE of the color. -** This final light is used to support the top 3 lights by providing a calulated fill to augment the lights. +** This final light is used to support the top 3 lights by providing a calculated fill to augment the lights. ** ************************************************************************************************/ void LightEnvironmentClass::Calculate_Fill_Light(void) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h index 437106e7feb..3f9b1fd17d6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/lightenvironment.h @@ -168,7 +168,7 @@ class LightEnvironmentClass InputLightStruct InputLights[MAX_LIGHTS]; // Sorted list of input lights from the greatest contributor to the least Vector3 OutputAmbient; // scene ambient + lights' ambients - OutputLightStruct OutputLights[MAX_LIGHTS]; // ouput lights + OutputLightStruct OutputLights[MAX_LIGHTS]; // output lights InputLightStruct FillLight; // Used to store the calculated fill light float FillIntensity; // Used to determine how strong the fill light should be diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.h index a22c3bb469c..314bfdd59db 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mapper.h @@ -246,7 +246,7 @@ class RotateTextureMapperClass : public ScaleTextureMapperClass /* ** SineLinearOffsetTextureMapperClass -** Modifies the UV coodinates by a sine linear offset +** Modifies the UV coordinates by a sine linear offset */ class SineLinearOffsetTextureMapperClass : public ScaleTextureMapperClass { @@ -273,7 +273,7 @@ class SineLinearOffsetTextureMapperClass : public ScaleTextureMapperClass /* ** StepLinearOffsetTextureMapperClass -** Modifies the UV coodinates by a Step linear offset +** Modifies the UV coordinates by a Step linear offset */ class StepLinearOffsetTextureMapperClass : public ScaleTextureMapperClass { @@ -303,7 +303,7 @@ class StepLinearOffsetTextureMapperClass : public ScaleTextureMapperClass /* ** ZigZagLinearOffsetTextureMapperClass -** Modifies the UV coodinates by a ZigZag linear offset +** Modifies the UV coordinates by a ZigZag linear offset */ class ZigZagLinearOffsetTextureMapperClass : public ScaleTextureMapperClass { diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h index d079a4f8815..a253f0fde55 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/matrixmapper.h @@ -48,7 +48,7 @@ // Hector Yee 1/29/01 /** -** MatrixMapperClass. Does the chore of computing the u-v coorinates for +** MatrixMapperClass. Does the chore of computing the u-v coordinates for ** a projected texture. Note that this VP must be "baby-sat" by something ** external to ensure that its ViewToTexture transform is up-to-date. I ** use it in the TexProjectClass to implement projected textures. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp index 4a11693f629..74d98d09a88 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -1274,7 +1274,7 @@ bool MeshClass::Cast_AABox(AABoxCollisionTestClass & boxtest) WWASSERT(Model); - // This function analyses the tranform to call optimized functions in certain cases + // This function analyses the transform to call optimized functions in certain cases bool hit = Model->Cast_World_Space_AABox(boxtest, Get_Transform()); if (hit) { @@ -1519,7 +1519,7 @@ void MeshClass::Update_Cached_Bounding_Volumes(void) const #endif // If we are camera-aligned or -oriented, we don't know which way we are facing at this point, - // so the box we return needs to contain the sphere. Otherewise do the normal computation. + // so the box we return needs to contain the sphere. Otherwise do the normal computation. if (Model->Get_Flag(MeshModelClass::ALIGNED) || Model->Get_Flag(MeshModelClass::ORIENTED)) { CachedBoundingBox.Center = CachedBoundingSphere.Center; CachedBoundingBox.Extent.Set(CachedBoundingSphere.Radius, CachedBoundingSphere.Radius, CachedBoundingSphere.Radius); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp index 6f9038a0c53..937774c325b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -832,7 +832,7 @@ void MeshBuilderClass::Compute_Vertex_Normals(void) } /* - ** Propogate the accumulated normals to all of the other verts which share them + ** Propagate the accumulated normals to all of the other verts which share them */ for (vertidx = 0; vertidx < VertCount; vertidx++) { int shadeindex = Verts[vertidx].ShadeIndex; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h index 8d64114a1f2..09c4896014c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.h @@ -227,7 +227,7 @@ class MeshBuilderClass void Compute_Tangent_Basis(); /* - ** World information managment. Used to give the mesh builder information + ** World information management. Used to give the mesh builder information ** about the world outside of its mesh. */ WorldInfoClass * Peek_World_Info(void) const { return WorldInfo; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp index b292172206b..da539dbce76 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp @@ -136,7 +136,7 @@ MeshModelClass & MeshModelClass::operator = (const MeshModelClass & that) clone_materials(that); - // DMS - using approriate deallocation method + // DMS - using appropriate deallocation method delete GapFiller; GapFiller=nullptr; @@ -590,7 +590,7 @@ WWASSERT(loc1==loc2 || loc1==loc3 || loc2==loc3); // ---------------------------------------------------------------------------- // -// Resize buffers to match the polygon count exatly. After this call no more +// Resize buffers to match the polygon count exactly. After this call no more // polygons can be added to the buffers. // // ---------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h index 47b801a0fbe..d3eeb6e26f0 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.h @@ -162,7 +162,7 @@ class MeshModelClass : public MeshGeometryClass ///////////////////////////////////////////////////////////////////////////////////// // Material interface, All of these functions call through to the current - // material decription. + // material description. ///////////////////////////////////////////////////////////////////////////////////// void Set_Pass_Count(int passes) { CurMatDesc->Set_Pass_Count(passes); } int Get_Pass_Count(void) const { return CurMatDesc->Get_Pass_Count(); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp index dd1e27c2938..45ff364772a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -1008,7 +1008,7 @@ WW3DErrorType MeshModelClass::read_textures(ChunkLoadClass & cload,MeshLoadConte newtex != nullptr; newtex = ::Load_Texture (cload)) { - // Add this texture to our contex and release our local hold on it + // Add this texture to our context and release our local hold on it context->Add_Texture(newtex); newtex->Release_Ref(); } @@ -1499,7 +1499,7 @@ WW3DErrorType MeshModelClass::read_stage_texcoords(ChunkLoadClass & cload,MeshLo } /* - ** Read in the texture coordiantes + ** Read in the texture coordinates */ elementcount = cload.Cur_Chunk_Length() / sizeof (W3dTexCoordStruct); uvs = context->Get_Temporary_UV_Array(elementcount); @@ -1544,7 +1544,7 @@ WW3DErrorType MeshModelClass::read_per_face_texcoord_ids (ChunkLoadClass &cload, // } /* - ** Read in the texture coordiante indices + ** Read in the texture coordinate indices ** There must be polygon count vectors in this chunk. */ size = sizeof (Vector3i) * Get_Polygon_Count(); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp index 68401bfb05c..8a20304d274 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp @@ -1039,7 +1039,7 @@ void AdaptiveDeltaMotionChannelClass::decompress(uint32 frame_idx, float *outdat void AdaptiveDeltaMotionChannelClass::decompress(uint32 src_idx, float *srcdata, uint32 frame_idx, float *outdata) { - // Contine decompressing from src_idx, up to frame_idx + // Continue decompressing from src_idx, up to frame_idx assert(src_idx < frame_idx); src_idx++; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp index 91a3c86c1ad..2e15a8a1a04 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -805,7 +805,7 @@ RenderObjClass * ParticleBufferClass::Clone(void) const int ParticleBufferClass::Get_Num_Polys(void) const { - // Currently in particle buffers, the cost happens to be equal to thwe polygon count. + // Currently in particle buffers, the cost happens to be equal to the polygon count. return (int)Get_Cost(); } @@ -1207,7 +1207,7 @@ void ParticleBufferClass::Scale(float scale) // The particle buffer never receives a Set_Transform/Position call, -// evem though its bounding volume changes. Since bounding volume +// even though its bounding volume changes. Since bounding volume // invalidations ordinarily occur when these functions are called, // the cached bounding volumes will not be invalidated unless we do // it elsewhere (such as here). We also need to call the particle @@ -2822,7 +2822,7 @@ void ParticleBufferClass::Get_New_Particles(void) prev_pos[NewEnd] = new_particle.Position; } - // upate the group id + // update the group id ids[NewEnd] = new_particle.GroupID; // Advance the 'end of new particles' index. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h index 686cdd1f4f0..efec3928d23 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.h @@ -113,7 +113,7 @@ class ParticleBufferClass : public RenderObjClass virtual void Scale(float scale); // The particle buffer never receives a Set_Transform/Position call, - // evem though its bounding volume changes. Since bounding volume + // even though its bounding volume changes. Since bounding volume // invalidations ordinarily occur when these functions are called, // the cached bounding volumes will not be invalidated unless we do // it elsewhere (such as here). We also need to call the particle @@ -262,7 +262,7 @@ class ParticleBufferClass : public RenderObjClass // Get new particles from the emitter and write them into the circular // particle buffer, possibly overwriting older particles. Perform - // partial-interval upddate on them as well. + // partial-interval update on them as well. void Get_New_Particles(void); // Kill all remaining particles which will be above their maxage at the @@ -273,7 +273,7 @@ class ParticleBufferClass : public RenderObjClass // last update. void Update_Non_New_Particles(unsigned int elapsed); - // Seperate circular buffer used by the emitter to pass new particles. + // Separate circular buffer used by the emitter to pass new particles. // It is implemented as an array, start and end indices and a count (to // differentiate between completely full and completely empty). NewParticleStruct * NewParticleQueue; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp index 8090e59eed7..f50cdbd0c2f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cpp @@ -318,14 +318,14 @@ ParticleEmitterDefClass::Normalize_Filename (void) TCHAR path[MAX_PATH]; ::lstrcpy (path, m_Info.TextureFilename); - // Find the last occurance of the directory deliminator + // Find the last occurrence of the directory deliminator LPCTSTR filename = ::strrchr (path, '\\'); if (filename != nullptr) { // Increment past the directory deliminator filename ++; - // Now copy the filename protion of the path to the structure + // Now copy the filename portion of the path to the structure ::lstrcpy (m_Info.TextureFilename, filename); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp index e1a66b05f3a..6e013496503 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -53,7 +53,7 @@ * SimpleSceneClass::Render -- internal scene rendering function * * SimpleSceneClass::Render -- Render this scene * * SimpleSceneClass::Create_Iterator -- create an iterator for this scene * - * SimpleSceneClass::Destroy_Iterator -- destroy an iterater of this scene * + * SimpleSceneClass::Destroy_Iterator -- destroy an iterator of this scene * * SceneClass::Save -- saves scene settings into a chunk * * SceneClass::Load -- loads scene settings from a chunk * * SimpleSceneClass::Compute_Point_Visibility -- returns visibility of a point * @@ -657,7 +657,7 @@ SceneIterator * SimpleSceneClass::Create_Iterator(bool onlyvisible) /*********************************************************************************************** - * SimpleSceneClass::Destroy_Iterator -- destroy an iterater of this scene * + * SimpleSceneClass::Destroy_Iterator -- destroy an iterator of this scene * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.h index 8706c8f4662..e3a3086dd9a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.h @@ -259,7 +259,7 @@ class VertexMaterialClass : public W3DMPO, public RefCountClass */ void Apply(void) const; /* - ** Apply the render states corresponding to a nullptr vetex material to D3D + ** Apply the render states corresponding to a nullptr vertex material to D3D */ static void Apply_Null(void); unsigned long Compute_CRC(void) const; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h index 6c21bf03522..81b441206b2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/w3d_file.h @@ -640,7 +640,7 @@ struct W3dRGBAStruct // MATERIALS // // Surrender 1.40 significantly changed the way that materials are described. To -// accomodate this, the w3d file format has changed since there are new features and +// accommodate this, the w3d file format has changed since there are new features and // optimizations that we want to take advangage of. // // The VertexMaterial defines parameters which control the calculation of the primary diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 20584b9b571..d37825e0a30 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -51,7 +51,7 @@ * WW3D::Render -- Render a 3D Scene using the given camera * * WW3D::Render -- Render a single render object * * WW3D::End_Render -- Mark the completion of a frame * - * WW3D::Sync -- Time sychronization * + * WW3D::Sync -- Time synchronization * * WW3D::Set_Ext_Swap_Interval -- Sets the swap interval the device should aim sync for. * * WW3D::Get_Ext_Swap_Interval -- Queries the swap interval the device is aiming sync for. * * WW3D::Get_Polygon_Mode -- returns the current rendering mode * @@ -488,7 +488,7 @@ void *WW3D::Get_Window( void ) } /*********************************************************************************************** - * WW3D::Is_Windowed -- returns wether we are currently in a windowed mode * + * WW3D::Is_Windowed -- returns whether we are currently in a windowed mode * * * * INPUT: * * * @@ -965,7 +965,7 @@ WW3DErrorType WW3D::Render(SceneClass * scene,CameraClass * cam,bool clear,bool } // Set the global ambient light value here. If the scene is using the LightEnvironment system - // this setting will get overriden. + // this setting will get overridden. DX8Wrapper::Set_Ambient(scene->Get_Ambient_Light()); // render the scene @@ -1167,7 +1167,7 @@ void WW3D::Update_Logic_Frame_Time(float milliseconds) /*********************************************************************************************** - * WW3D::Sync -- Time sychronization * + * WW3D::Sync -- Time synchronization * * * * INPUT: * * * @@ -1244,7 +1244,7 @@ void WW3D::Set_Collision_Box_Display_Mask(int mask) } /*********************************************************************************************** - * WW3D::Get_Collision_Box_Display_Mask -- returns the current display mask for collision boxe * + * WW3D::Get_Collision_Box_Display_Mask -- returns the current display mask for collision box * * * * INPUT: * * * diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h index 5768f899fea..5499ef06228 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -402,7 +402,7 @@ class WW3D // RenderObject on construction. The native screen size is the screen size // at which the object was designed to be viewed, and it is used in the // texture resizing algorithm (may be used in future for other things). - // If the default is overriden, it will usually be in the asset manager + // If the default is overridden, it will usually be in the asset manager // post-load callback. static float DefaultNativeScreenSize; diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index 651ceada335..c26688a081b 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -629,7 +629,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } // Well, it was a nice idea, but we don't get a message for an ejection. -// (Really unforunate, actually.) I'm leaving this in in-case some one wants +// (Really unfortunate, actually.) I'm leaving this in in-case some one wants // to trap a different device change (for instance, removal of a mouse) - jkmcd #if 0 case WM_DEVICECHANGE: diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h b/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h index e021fdc3f0e..4bf23d13661 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/EditWindow.h @@ -91,7 +91,7 @@ class EditWindow void setDragMoveOrigin( ICoord2D *pos ); ///< for drag moving void setDragMoveDest( ICoord2D *pos ); ///< for drag moving - ICoord2D getDragMoveOrigin( void ); ///< for keybord moving + ICoord2D getDragMoveOrigin( void ); ///< for keyboard moving ICoord2D getDragMoveDest( void ); ///< for keyboard moving void notifyWindowDeleted( GameWindow *window ); ///< window has been deleted diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h index 45356e4ee16..19f2f4803eb 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/GUIEditDisplay.h @@ -80,7 +80,7 @@ class GUIEditDisplay : public Display virtual void drawFillRect( Int startX, Int startY, Int width, Int height, UnsignedInt color ); - /// Draw a percentage of a rectange, much like a clock + /// Draw a percentage of a rectangle, much like a clock virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { } virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { } diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h b/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h index 8b319ef4742..bbe9c0b0083 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/HierarchyView.h @@ -38,7 +38,7 @@ // // Created: Colin Day, July 2001 // -// Desc: Manipulation the widows heirarchy through the tree +// Desc: Manipulates the window's hierarchy through the tree // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Tools/GUIEdit/Include/LayoutScheme.h b/GeneralsMD/Code/Tools/GUIEdit/Include/LayoutScheme.h index 747c588de07..b2f414c28c3 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Include/LayoutScheme.h +++ b/GeneralsMD/Code/Tools/GUIEdit/Include/LayoutScheme.h @@ -100,7 +100,7 @@ class LayoutScheme void setHiliteTextColor( Color c ); void setHiliteTextBorderColor( Color c ); - /** apply the image and color info stored in the state identifer tables + /** apply the image and color info stored in the state identifier tables used for "property editing" to all appropriate windows currently loaded in the editor */ void applyPropertyTablesToWindow( GameWindow *root ); diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp index f4c2f73eb2f..8e31952351d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/CallbackEditor.cpp @@ -39,7 +39,7 @@ // Created: Colin Day, Sepember 2001 // // Desc: A handy dandy little dialog to just edit the callbacks for -// user windows ... a super convient luxury at a bargain price! +// user windows ... a super convenient luxury at a bargain price! // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp index 30fa3395608..5a96c39be6d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Dialog Procedures/ListboxProperties.cpp @@ -217,7 +217,7 @@ static void addScrollbar( GameWindow *listbox ) } // removeScrollbar ============================================================ -/** Remove all scrollbar constructs froma listbox that has it already */ +/** Remove all scrollbar constructs from listbox that has it already */ //============================================================================= static void removeScrollbar( GameWindow *listbox ) { @@ -241,7 +241,7 @@ static void removeScrollbar( GameWindow *listbox ) } // resizeMaxItems ============================================================= -/** Change the max items that a listbox can accomodate */ +/** Change the max items that a listbox can accommodate */ //============================================================================= static void resizeMaxItems( GameWindow *listbox, UnsignedInt newMaxItems ) { diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp index 27d1404f3b5..5616d54a06d 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/EditWindow.cpp @@ -562,7 +562,7 @@ void EditWindow::mouseEvent( UnsignedInt windowsMessage, mouse.x = x; mouse.y = y; - // for mouse move messges always update the status bar + // for mouse move messages always update the status bar if( windowsMessage == WM_MOUSEMOVE ) { char buffer[ 64 ]; diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp index dfd16627093..2f0622c1f6b 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp @@ -50,7 +50,7 @@ GUIEditWindowManager *TheGUIEditWindowManager = nullptr; ///< editor use only /////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- -/** Is the given widnow in the clipboard at the top level. NOTE that +/** Is the given window in the clipboard at the top level. NOTE that * children are NOT included in this search */ //------------------------------------------------------------------------------------------------- Bool GUIEditWindowManager::isWindowInClipboard( GameWindow *window, @@ -739,7 +739,7 @@ void GUIEditWindowManager::pasteClipboard( void ) // the first window that we added ... since we know they were added // at the head of the window list we can traverse from the first // window added to the head of the window list to access each new - // window we just pasted. As a convenience we will unselct anything + // window we just pasted. As a convenience we will unselect anything // selected and select all the windows we added // TheEditor->clearSelections(); @@ -762,7 +762,7 @@ void GUIEditWindowManager::pasteClipboard( void ) } //------------------------------------------------------------------------------------------------- -/** Convinience funtion to copy the Draw state info for a given instance */ +/** Convenience function to copy the Draw state info for a given instance */ //------------------------------------------------------------------------------------------------- void InstDrawCopy ( WinInstanceData *instData, WinInstanceData *sourceInstData) { @@ -779,7 +779,7 @@ void InstDrawCopy ( WinInstanceData *instData, WinInstanceData *sourceInstData) } //------------------------------------------------------------------------------------------------- -/** Duplciate a window and all its children */ +/** Duplicate a window and all its children */ //------------------------------------------------------------------------------------------------- GameWindow *GUIEditWindowManager::duplicateWindow( GameWindow *source, GameWindow *parent ) diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index f7e6a7980d8..f92649732dd 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -38,7 +38,7 @@ // // Created: Colin Day, July 2001 // -// Desc: Manipulation the widows heirarchy through the tree +// Desc: Manipulation the widows hierarchy through the tree // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// @@ -174,7 +174,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, // // set this window as the drag target, we use it to draw visual - // feeback in the edit window + // feedback in the edit window // TheHierarchyView->setDragTarget( target ); @@ -536,7 +536,7 @@ LRESULT CALLBACK HierarchyView::dialogProc( HWND hWndDialog, UINT message, TheEditor->selectWindow( target ); TheEditor->setMode( MODE_DRAG_MOVE ); - // set the locatoin of the move to the window position for now + // set the location of the move to the window position for now ICoord2D pos; target->winGetScreenPosition( &pos.x, &pos.y ); TheEditWindow->setDragMoveDest( &pos ); @@ -717,7 +717,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, } // - // add children if requested, but not on gadgets no matter what becuase + // add children if requested, but not on gadgets no matter what because // they are "atomic units", except for tab controls. // if( addChildren && TheEditor->windowIsGadget( window ) == FALSE || (window->winGetStyle() & GWS_TAB_CONTROL) ) @@ -1189,7 +1189,7 @@ void HierarchyView::moveWindowChildOf( GameWindow *window, GameWindow *parent ) if( window == nullptr ) return; - // remvoe the window from the hierarchy + // remove the window from the hierarchy removeWindow( window ); // if parent is nullptr we'll put at top of list diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp index 754074ea2a1..eb20865d720 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/LayoutScheme.cpp @@ -433,7 +433,7 @@ static LRESULT CALLBACK layoutSchemeCallback( HWND hWndDialog, } // LayoutScheme::applyPropertyTablesToWindow ================================== -/** apply the image and color info stored in the state identifer tables +/** apply the image and color info stored in the state identifier tables used for "property editing" to all appropriate windows currently loaded in the editor */ //============================================================================= @@ -2173,7 +2173,7 @@ void LayoutScheme::openDialog( void ) ImageAndColorInfo *LayoutScheme::findEntry( StateIdentifier id ) { - // santiy + // sanity if( id < 0 || id >= NUM_STATE_IDENTIFIERS ) { diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp index 93ed63a9ac7..9976e7ea723 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/Save.cpp @@ -719,7 +719,7 @@ static Bool saveComboBoxData( GameWindow *window, FILE *fp, Int dataIndent ) sprintf( &buffer[ dataIndent ], " LETTERSANDNUMBERS: %d;\n", comboData->lettersAndNumbersOnly ); writeBufferToFile( fp, buffer ); - //Save teh dropDownButton draw data for the combo box + //Save the dropDownButton draw data for the combo box if( comboData->dropDownButton ) { @@ -1252,7 +1252,7 @@ Bool GUIEdit::saveData( char *filePathAndFilename, char *filename ) // save each of the windows in reverse order, when we load a layout // file in this reverse order, the original window order we presently // see in the editor will be recreated because windows loaded after - // other windows are placed on the top of the widnow stack + // other windows are placed on the top of the window stack // // go to end of window list diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp index 68d90a2c2c3..493d5aecc4e 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/WinMain.cpp @@ -203,7 +203,7 @@ Int APIENTRY WinMain(HINSTANCE hInstance, if( !initInstance( hInstance, nCmdShow ) ) return FALSE; - // load accellerator table + // load accelerator table hAccelTable = LoadAccelerators( hInstance, (LPCTSTR)GUIEDIT_ACCELERATORS ); // initialize the common controls @@ -766,7 +766,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, } // AboutCallback ============================================================== -/** Mesage handler for about box. */ +/** Message handler for about box. */ //============================================================================= LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h b/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h index 5f1176d1f6a..bd5d8643fe4 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h @@ -54,7 +54,7 @@ // I don't care that debug symbols are longer than 255, I won't read them anyways. #pragma warning (disable : 4786) -// Define IN and OUT. Use them for sementic emphasis. +// Define IN and OUT. Use them for semantic emphasis. #ifndef IN # define IN #endif diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h index e521aff4b87..e3dba63db72 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WBHeightMap.h @@ -20,7 +20,7 @@ #include "W3DDevice/GameClient/FlatHeightMap.h" #include "W3DDevice/GameClient/HeightMap.h" -#define dont_USE_FLAT_HEIGHT_MAP // Use the origina height map for mission disk. jba. [4/15/2003] +#define dont_USE_FLAT_HEIGHT_MAP // Use the original height map for mission disk. jba. [4/15/2003] #ifdef USE_FLAT_HEIGHT_MAP class WBHeightMap : public FlatHeightMapRenderObjClass #else diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index 406d70d2bea..3f5a8f56645 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -137,8 +137,8 @@ class WorldHeightMapEdit : public WorldHeightMap void showTileStatusInfo(void); ///< pops up a dialog box with tile mem usage. - Bool selectDuplicates(void); ///< Selects any dupicate map objects. - Bool selectSimilar(void); ///< Selects any dupicate map objects. + Bool selectDuplicates(void); ///< Selects any duplicate map objects. + Bool selectSimilar(void); ///< Selects any duplicate map objects. Bool selectInvalidTeam(void); ///< Selects any objects with invalid teams. Bool resize(Int newXSize, Int newYSize, Int newHeight, Int newBorder, Bool anchorTop, Bool anchorBottom, diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h index b57edef72d6..17db0268232 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WorldBuilder.h @@ -156,7 +156,7 @@ class CWorldBuilderApp : public CWinApp /// Set the tool that will be active. void setActiveTool(Tool *newTool); - /// Sets the current directry for file opens. + /// Sets the current directory for file opens. void setCurrentDirectory(AsciiString dir) {m_currentDirectory = dir;}; Tool *getCurTool() { return m_curTool; } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index de89b87293c..34419e2272f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -1406,7 +1406,7 @@ void MultipleUndoable::Do(void) // -// Recursive function to help tranverse a singly-linked list in reverse order +// Recursive function to help traverse a singly-linked list in reverse order // static void undoHelper(Undoable * undoable) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp index a93020a5c1f..63109221a7e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/ContourOptions.cpp @@ -30,7 +30,7 @@ Int ContourOptions::m_contourStep = 5; Int ContourOptions::m_contourOffset = 0; Int ContourOptions::m_contourWidth = 1; ///////////////////////////////////////////////////////////////////////////// -/// ContourOptions dialog trivial construstor - Create does the real work. +/// ContourOptions dialog trivial constructor - Create does the real work. ContourOptions::ContourOptions(CWnd* pParent /*=nullptr*/) @@ -108,7 +108,7 @@ BOOL ContourOptions::OnInitDialog() /// Handles slider ui messages. /** Gets the info, determines if it is the feather or width slider, - gets the new value, and updates the correspondig edit control + gets the new value, and updates the corresponding edit control and the brush tool. */ void ContourOptions::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp index bf44491834d..e1e31053733 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditAction.cpp @@ -333,7 +333,7 @@ BOOL EditAction::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) return TRUE; } - // Handle events from the rich edit control containg the action pieces. + // Handle events from the rich edit control containing the action pieces. if (LOWORD(wParam) == IDC_RICH_EDIT_HERE+1) { NMHDR *pHdr = (NMHDR *)lParam; if (pHdr->hwndFrom == m_myEditCtrl.m_hWnd) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp index 85cd400fb28..4b3a320592e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditCondition.cpp @@ -345,7 +345,7 @@ BOOL EditCondition::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) return TRUE; } - // Handle events from the rich edit control containg the condition pieces. + // Handle events from the rich edit control containing the condition pieces. if (LOWORD(wParam) == IDC_RICH_EDIT_HERE+1) { NMHDR *pHdr = (NMHDR *)lParam; if (pHdr->hwndFrom == m_myEditCtrl.m_hWnd) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp index 74525f8911b..809e6d63685 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/EditParameter.cpp @@ -1309,7 +1309,7 @@ Bool EditParameter::loadFontNames(CComboBox *pCombo, AsciiString match) } // EditParameter::readFontFile ====================================================== -/** Read the font file defintitions and load them */ +/** Read the font file definitions and load them */ //============================================================================= void EditParameter::readFontFile( const char *filename ) { @@ -1332,7 +1332,7 @@ void EditParameter::readFontFile( const char *filename ) for( Int i = 0; i < fontCount; i++ ) { - // read all the font defitions + // read all the font definitions char fontBuffer[ 512 ]; Int size, bold; char c; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp index 09a269a9704..08755866b46 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherOptions.cpp @@ -31,7 +31,7 @@ Int FeatherOptions::m_currentFeather = 0; Int FeatherOptions::m_currentRate = 3; Int FeatherOptions::m_currentRadius = 1; ///////////////////////////////////////////////////////////////////////////// -/// FeatherOptions dialog trivial construstor - Create does the real work. +/// FeatherOptions dialog trivial constructor - Create does the real work. FeatherOptions::FeatherOptions(CWnd* pParent /*=nullptr*/) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index 897d6326a62..0ca2889702c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -28,7 +28,7 @@ #include "wbview3d.h" ///////////////////////////////////////////////////////////////////////////// -/// GlobalLightOptions dialog trivial construstor - Create does the real work. +/// GlobalLightOptions dialog trivial constructor - Create does the real work. GlobalLightOptions::GlobalLightOptions(CWnd* pParent /*=nullptr*/) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp index ee3a6de20d4..2b7d1712552 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/LightOptions.cpp @@ -30,7 +30,7 @@ LightOptions *LightOptions::m_staticThis = nullptr; ///////////////////////////////////////////////////////////////////////////// -/// LightOptions dialog trivial construstor - Create does the real work. +/// LightOptions dialog trivial constructor - Create does the real work. LightOptions::LightOptions(CWnd* pParent /*=nullptr*/) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp index c996ece7d5e..63a05e0dde6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundOptions.cpp @@ -31,7 +31,7 @@ Int MoundOptions::m_currentWidth = 0; Int MoundOptions::m_currentHeight = 0; Int MoundOptions::m_currentFeather = 0; ///////////////////////////////////////////////////////////////////////////// -/// MoundOptions dialog trivial construstor - Create does the real work. +/// MoundOptions dialog trivial constructor - Create does the real work. MoundOptions::MoundOptions(CWnd* pParent /*=nullptr*/) diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index c2a75804077..63bbb234491 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -266,7 +266,7 @@ WorldHeightMapEdit::WorldHeightMapEdit(ChunkInputStream *pStrm): for (i=0; i Date: Sat, 17 Jan 2026 11:00:20 -0500 Subject: [PATCH 059/211] docs: Fix spelling errors in Generals/Code/GameEngine/Include comments (#2119) --- Generals/Code/GameEngine/Include/Common/BitFlags.h | 2 +- .../Code/GameEngine/Include/Common/BuildAssistant.h | 4 ++-- .../Code/GameEngine/Include/Common/DisabledTypes.h | 4 ++-- Generals/Code/GameEngine/Include/Common/DrawModule.h | 2 +- .../Code/GameEngine/Include/Common/FunctionLexicon.h | 2 +- Generals/Code/GameEngine/Include/Common/GameState.h | 2 +- Generals/Code/GameEngine/Include/Common/GameType.h | 2 +- Generals/Code/GameEngine/Include/Common/GlobalData.h | 12 ++++++------ Generals/Code/GameEngine/Include/Common/KindOf.h | 4 ++-- Generals/Code/GameEngine/Include/Common/List.h | 4 ++-- .../Code/GameEngine/Include/Common/MessageStream.h | 8 ++++---- Generals/Code/GameEngine/Include/Common/ModelState.h | 2 +- Generals/Code/GameEngine/Include/Common/Module.h | 2 +- .../Code/GameEngine/Include/Common/ModuleFactory.h | 4 ++-- Generals/Code/GameEngine/Include/Common/Override.h | 2 +- Generals/Code/GameEngine/Include/Common/Player.h | 12 ++++++------ Generals/Code/GameEngine/Include/Common/Registry.h | 2 +- .../Include/Common/ResourceGatheringManager.h | 4 ++-- Generals/Code/GameEngine/Include/Common/Science.h | 2 +- .../Code/GameEngine/Include/Common/ScoreKeeper.h | 2 +- Generals/Code/GameEngine/Include/Common/Team.h | 4 ++-- Generals/Code/GameEngine/Include/Common/Terrain.h | 2 +- .../Code/GameEngine/Include/Common/ThingFactory.h | 2 +- .../Code/GameEngine/Include/Common/ThingTemplate.h | 2 +- Generals/Code/GameEngine/Include/Common/version.h | 4 ++-- Generals/Code/GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Include/GameClient/AnimateWindowManager.h | 2 +- .../GameEngine/Include/GameClient/CampaignManager.h | 2 +- Generals/Code/GameEngine/Include/GameClient/Color.h | 2 +- .../Code/GameEngine/Include/GameClient/Drawable.h | 2 +- Generals/Code/GameEngine/Include/GameClient/Gadget.h | 2 +- .../Include/GameClient/GameWindowManager.h | 2 +- .../Code/GameEngine/Include/GameClient/MetaEvent.h | 2 +- .../Include/GameClient/ProcessAnimateWindow.h | 12 ++++++------ Generals/Code/GameEngine/Include/GameClient/Shell.h | 4 ++-- .../GameEngine/Include/GameClient/WinInstanceData.h | 4 ++-- .../GameEngine/Include/GameLogic/Module/ActiveBody.h | 4 ++-- .../GameEngine/Include/GameLogic/Module/BodyModule.h | 2 +- .../Include/GameLogic/Module/GarrisonContain.h | 2 +- .../GameLogic/Module/HelicopterSlowDeathUpdate.h | 2 +- .../Include/GameLogic/Module/JetSlowDeathBehavior.h | 2 +- .../Include/GameLogic/Module/LaserUpdate.h | 2 +- .../Include/GameLogic/Module/ProductionUpdate.h | 2 +- .../Module/SpawnPointProductionExitUpdate.h | 2 +- .../Include/GameLogic/Module/SpecialAbilityUpdate.h | 2 +- Generals/Code/GameEngine/Include/GameLogic/Object.h | 8 ++++---- .../GameEngine/Include/GameLogic/PartitionManager.h | 4 ++-- .../Code/GameEngine/Include/GameLogic/RankInfo.h | 2 +- 48 files changed, 81 insertions(+), 81 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index 3637d382829..65d5944a6ff 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -43,7 +43,7 @@ class AsciiString; us initialize stuff in useful ways, and (2) provide a default constructor that implicitly converts ints into bitsets in a "wrong" way (ie, it treats the int as a mask, not an index). So we wrap to correct this, but leave the bitset "exposed" so that we can use all the non-ctor - functions on it directly (since it doesn't overload operator= to do the "wrong" thing, strangley enough) + functions on it directly (since it doesn't overload operator= to do the "wrong" thing, strangely enough) */ template class BitFlags diff --git a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h index 84a2d206781..f478a709858 100644 --- a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h +++ b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h @@ -111,7 +111,7 @@ class BuildAssistant : public SubsystemInterface { TERRAIN_RESTRICTIONS = 0x00000001, ///< Check for basic terrain restrictions CLEAR_PATH = 0x00000002, ///< Must be able to path find to location - NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controled objects that can't move out of the way + NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controlled objects that can't move out of the way USE_QUICK_PATHFIND = 0x00000008, ///< Use the quick pathfind method for CLEAR_PATH SHROUD_REVEALED = 0x00000010, ///< Check to make sure the shroud is revealed NO_ENEMY_OBJECT_OVERLAP=0x00000020, ///< Can't overlap enemy objects only. @@ -165,7 +165,7 @@ class BuildAssistant : public SubsystemInterface /// tiling wall object helper function, we can use this to "tile" walls when building virtual TileBuildInfo *buildTiledLocations( const ThingTemplate *thingBeingTiled, - Real angle, // angle to consturct thing being tiled + Real angle, // angle to construct thing being tiled const Coord3D *start, const Coord3D *end, Real tilingSize, Int maxTiles, Object *builderObject ); diff --git a/Generals/Code/GameEngine/Include/Common/DisabledTypes.h b/Generals/Code/GameEngine/Include/Common/DisabledTypes.h index 31fd14a0b70..0e9991675c9 100644 --- a/Generals/Code/GameEngine/Include/Common/DisabledTypes.h +++ b/Generals/Code/GameEngine/Include/Common/DisabledTypes.h @@ -45,10 +45,10 @@ enum DisabledType CPP_11(: Int) DISABLED_HELD, //Special case -- held means it can fire and isHeld checks to make sure ONLY held is set! DISABLED_PARALYZED, //Battle plans have changed, and unit is confused/paralyzed DISABLED_UNMANNED, //Vehicle is unmanned - DISABLED_UNDERPOWERED,//Seperate from ScriptUnderpowered, the owning player has insufficient power. Energy status controls this + DISABLED_UNDERPOWERED,//Separate from ScriptUnderpowered, the owning player has insufficient power. Energy status controls this DISABLED_FREEFALL, //This unit has been disabled via being in free fall - //These ones are specificially for scripts to enable/reenable! + //These ones are specifically for scripts to enable/reenable! DISABLED_SCRIPT_DISABLED, DISABLED_SCRIPT_UNDERPOWERED, diff --git a/Generals/Code/GameEngine/Include/Common/DrawModule.h b/Generals/Code/GameEngine/Include/Common/DrawModule.h index 5ddde9c6307..a68ffba6b1d 100644 --- a/Generals/Code/GameEngine/Include/Common/DrawModule.h +++ b/Generals/Code/GameEngine/Include/Common/DrawModule.h @@ -199,7 +199,7 @@ class ObjectDrawInterface /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ virtual void setAnimationCompletionTime(UnsignedInt numFrames) = 0; virtual Bool updateBonesForClientParticleSystems( void ) = 0;///< this will reposition particle systems on the fly ML diff --git a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h index bdc82b65de3..e75b7172bda 100644 --- a/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/Generals/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -84,7 +84,7 @@ class FunctionLexicon : public SubsystemInterface TableEntry *getTable( TableIndex index ); // - // !NOTE! We do NOT have a functionToName() method becuase we assume + // !NOTE! We do NOT have a functionToName() method because we assume // that functions in the tables are unique and that there is a 1 to 1 // mapping of a symbol to a function address. However, when compiling // in release, functions that have the same arguments and the same diff --git a/Generals/Code/GameEngine/Include/Common/GameState.h b/Generals/Code/GameEngine/Include/Common/GameState.h index 5259cc99dab..bcdcc7edd25 100644 --- a/Generals/Code/GameEngine/Include/Common/GameState.h +++ b/Generals/Code/GameEngine/Include/Common/GameState.h @@ -165,7 +165,7 @@ class GameState : public SubsystemInterface, SaveGameInfo *getSaveGameInfo( void ) { return &m_gameInfo; } // snapshot interaction - void addPostProcessSnapshot( Snapshot *snapshot ); ///< add snapshot to post process laod + void addPostProcessSnapshot( Snapshot *snapshot ); ///< add snapshot to post process load // manipulating files Bool doesSaveGameExist( AsciiString filename ); ///< does the save file exist diff --git a/Generals/Code/GameEngine/Include/Common/GameType.h b/Generals/Code/GameEngine/Include/Common/GameType.h index 23a9a129281..c28b9e04fbd 100644 --- a/Generals/Code/GameEngine/Include/Common/GameType.h +++ b/Generals/Code/GameEngine/Include/Common/GameType.h @@ -182,7 +182,7 @@ enum WeaponSlotType CPP_11(: Int) // Layer 1 is the ground. // Layer 2 is the top layer - bridge if one is present, ground otherwise. // Layer 2 - LAYER_LAST -1 are bridges. -// Layer_WALL is a special "wall" layer for letting units run aroound on top of a wall +// Layer_WALL is a special "wall" layer for letting units run around on top of a wall // made of structures. // Note that the bridges just index in the pathfinder, so you don't actually // have a LAYER_BRIDGE_1 enum value. diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index cb7c0d1dda5..83dae4e9ecf 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -335,10 +335,10 @@ class GlobalData : public SubsystemInterface Int m_maxLineBuildObjects; ///< line style builds can be no longer than this Int m_maxTunnelCapacity; ///< Max people in Player's tunnel network Real m_horizontalScrollSpeedFactor; ///< Factor applied to the game screen scrolling speed. - Real m_verticalScrollSpeedFactor; ///< Seperated because of our aspect ratio + Real m_verticalScrollSpeedFactor; ///< Separated because of our aspect ratio Real m_scrollAmountCutoff; ///< Scroll speed to not adjust camera height Real m_cameraAdjustSpeed; ///< Rate at which we adjust camera height - Bool m_enforceMaxCameraHeight; ///< Enfoce max camera height while scrolling? + Bool m_enforceMaxCameraHeight; ///< Enforce max camera height while scrolling? Bool m_buildMapCache; AsciiString m_initialFile; ///< If this is specified, load a specific map from the command-line AsciiString m_pendingFile; ///< If this is specified, use this map at the next game start @@ -449,8 +449,8 @@ class GlobalData : public SubsystemInterface Bool m_debugShowGraphicalFramerate; ///< Whether or not to show the graphical framerate bar. - Int m_powerBarBase; ///< Logrithmic base for the power bar scale - Real m_powerBarIntervals; ///< how many logrithmic intervals the width will be divided into + Int m_powerBarBase; ///< Logarithmic base for the power bar scale + Real m_powerBarIntervals; ///< how many logarithmic intervals the width will be divided into Int m_powerBarYellowRange; ///< Red if consumption exceeds production, yellow if consumption this close but under, green if further under Real m_displayGamma; /// class OVERRIDE { public: - // Provide useful constructores to go from a T* to an OVERRIDE + // Provide useful constructors to go from a T* to an OVERRIDE OVERRIDE(const T *overridable = nullptr); // Copy constructor OVERRIDE(OVERRIDE &overridable); diff --git a/Generals/Code/GameEngine/Include/Common/Player.h b/Generals/Code/GameEngine/Include/Common/Player.h index 3eeae7466cb..2999c62ebe2 100644 --- a/Generals/Code/GameEngine/Include/Common/Player.h +++ b/Generals/Code/GameEngine/Include/Common/Player.h @@ -158,7 +158,7 @@ class PlayerRelationMap : public MemoryPoolObject, PlayerRelationMap( void ); // virtual destructor provided by memory pool object - /** @todo I'm jsut wrappign this up in a nice snapshot object, we really should isolate + /** @todo I'm just wrapping this up in a nice snapshot object, we really should isolate * m_map from public access and make access methods for our operations */ PlayerRelationMapType m_map; @@ -294,10 +294,10 @@ class Player : public Snapshot Bool hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ); ///< does player have this upgrade in progress right now Upgrade *addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStatusType status ); ///< add upgrade, or update existing upgrade status - void removeUpgrade( const UpgradeTemplate *upgradeTemplate ); ///< remove thsi upgrade from us + void removeUpgrade( const UpgradeTemplate *upgradeTemplate ); ///< remove this upgrade from us /** find upgrade, NOTE, the upgrade may *NOT* be "complete" and therefore "active", it could be in production - This function is for actually retrieving the Upgrade. To test existance, use the fast bit testers hasUpgradeX() + This function is for actually retrieving the Upgrade. To test existence, use the fast bit testers hasUpgradeX() */ Upgrade *findUpgrade( const UpgradeTemplate *upgradeTemplate ); @@ -434,7 +434,7 @@ class Player : public Snapshot /// Have the ai check for bridges. virtual void repairStructure(ObjectID structureID); - /// a structuer was just created, but is under construction + /// a structure was just created, but is under construction void onStructureCreated( Object *builder, Object *structure ); /// a structure that was under construction has become completed @@ -706,7 +706,7 @@ class Player : public Snapshot UnicodeString m_playerDisplayName; ///< This player's persistent name. Handicap m_handicap; ///< adjustment to varied capabilities (@todo: is this persistent or recalced each time?) - AsciiString m_playerName; ///< player's itnernal name 9for matching map objects) + AsciiString m_playerName; ///< player's internal name (for matching map objects) NameKeyType m_playerNameKey; ///< This player's internal name (for matching map objects) PlayerIndex m_playerIndex; ///< player unique index. AsciiString m_side; ///< the "side" this player is on @@ -733,7 +733,7 @@ class Player : public Snapshot AIPlayer* m_ai; ///< if PLAYER_COMPUTER, the entity that does the thinking Int m_mpStartIndex; ///< The player's starting index for multiplayer. ResourceGatheringManager* m_resourceGatheringManager; ///< Keeps track of all Supply Centers and Warehouses - TunnelTracker* m_tunnelSystem; ///< All TunnelContain buildings use this part of me for actual conatinment + TunnelTracker* m_tunnelSystem; ///< All TunnelContain buildings use this part of me for actual containment Team* m_defaultTeam; ///< our "default" team. ScienceVec m_sciences; ///< (SAVE) sciences that we know (either intrinsically or via later purchases) diff --git a/Generals/Code/GameEngine/Include/Common/Registry.h b/Generals/Code/GameEngine/Include/Common/Registry.h index 83ecb7dd24b..a969c759e1c 100644 --- a/Generals/Code/GameEngine/Include/Common/Registry.h +++ b/Generals/Code/GameEngine/Include/Common/Registry.h @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// // Registry.h -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #pragma once diff --git a/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h b/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h index 437f6d2fdd3..ed79ff6c44b 100644 --- a/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h +++ b/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h @@ -50,8 +50,8 @@ class ResourceGatheringManager : public MemoryPoolObject, void addSupplyCenter( Object *newCenter ); ///< I captured or built a Supply Center, so record it void removeSupplyCenter( Object *oldCenter ); ///< Lost a supply center - void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is starrt of game recording - void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replinish has run out of Supply + void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is start of game recording + void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replenish has run out of Supply protected: diff --git a/Generals/Code/GameEngine/Include/Common/Science.h b/Generals/Code/GameEngine/Include/Common/Science.h index f7bfcd6ce04..f5565c6d5c6 100644 --- a/Generals/Code/GameEngine/Include/Common/Science.h +++ b/Generals/Code/GameEngine/Include/Common/Science.h @@ -24,7 +24,7 @@ // FILE: Science.h //////////////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day November 2001 -// Desc: Science descriptoins +// Desc: Science descriptions /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h b/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h index 98bf12b894e..1d46551f8ab 100644 --- a/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h +++ b/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h @@ -107,7 +107,7 @@ class ScoreKeeper : public Snapshot Int m_totalMoneyEarned; ///< The total money that was harvested, refined, received in crates Int m_totalMoneySpent; ///< The total money spent on units, buildings, repairs - Int m_totalUnitsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of enimies that we've killed + Int m_totalUnitsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of enemies that we've killed Int m_totalUnitsBuilt; ///< The total number of units we've created (created meaning that we built from a building) Int m_totalUnitsLost; ///< The total number of our units lost Int m_totalBuildingsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of Buildings we've destroyed diff --git a/Generals/Code/GameEngine/Include/Common/Team.h b/Generals/Code/GameEngine/Include/Common/Team.h index 4c1c7a81250..83f6a544a35 100644 --- a/Generals/Code/GameEngine/Include/Common/Team.h +++ b/Generals/Code/GameEngine/Include/Common/Team.h @@ -54,7 +54,7 @@ class TeamRelationMap : public MemoryPoolObject, TeamRelationMap( void ); // virtual destructor provided by memory pool object - /** @todo I'm jsut wrappign this up in a nice snapshot object, we really should isolate + /** @todo I'm just wrapping this up in a nice snapshot object, we really should isolate * m_map from public access and make access methods for our operations */ TeamRelationMapType m_map; @@ -710,7 +710,7 @@ class TeamFactory : public SubsystemInterface, /// create a team. there must be a TeamPrototype with the given name, or an exception is thrown. Team *createTeam(const AsciiString& name); - /// create a team given an explicity team prototype rather than a prototype name + /// create a team given an explicitly team prototype rather than a prototype name Team *createTeamOnPrototype( TeamPrototype *prototype ); /// create a team. there must be a TeamPrototype with the given name, or an exception is thrown. diff --git a/Generals/Code/GameEngine/Include/Common/Terrain.h b/Generals/Code/GameEngine/Include/Common/Terrain.h index dd6ea409a39..fe1905568e1 100644 --- a/Generals/Code/GameEngine/Include/Common/Terrain.h +++ b/Generals/Code/GameEngine/Include/Common/Terrain.h @@ -37,4 +37,4 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// // DEFINE ///////////////////////////////////////////////////////////////////// -#define MAX_TERRAIN_NAME_LEN 64 ///< max size of map filename with extenstion +#define MAX_TERRAIN_NAME_LEN 64 ///< max size of map filename with extension diff --git a/Generals/Code/GameEngine/Include/Common/ThingFactory.h b/Generals/Code/GameEngine/Include/Common/ThingFactory.h index c9469239c2f..467a7f19fd1 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingFactory.h +++ b/Generals/Code/GameEngine/Include/Common/ThingFactory.h @@ -95,7 +95,7 @@ class ThingFactory : public SubsystemInterface private: - /// free all template databse data + /// free all template database data void freeDatabase( void ); void addTemplate( ThingTemplate *thing ); ///< add the template to the DB diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index 28e14647e4b..ac72b4a37ff 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -119,7 +119,7 @@ enum ThingTemplateAudioType CPP_11(: Int) TTAUDIO_soundStealthOff, ///< Sound when unit destealths TTAUDIO_soundCreated, ///< Sound when unit is created TTAUDIO_soundOnDamaged, ///< Sound when unit enters damaged state - TTAUDIO_soundOnReallyDamaged, ///< Sound when unit enters reallyd damaged state + TTAUDIO_soundOnReallyDamaged, ///< Sound when unit enters really damaged state TTAUDIO_soundDieFire, ///< Sound when unit dies by fire. NOTE: Replaces soundDie if present and unit dies by fire. TTAUDIO_soundDieToxin, ///< Sound when unit dies by Toxin. NOTE: Replaces soundDie if present and unit dies by fire. TTAUDIO_soundEnter, ///< Sound when another unit enters me. diff --git a/Generals/Code/GameEngine/Include/Common/version.h b/Generals/Code/GameEngine/Include/Common/version.h index 088a0f7217c..a9cfc2c01a3 100644 --- a/Generals/Code/GameEngine/Include/Common/version.h +++ b/Generals/Code/GameEngine/Include/Common/version.h @@ -47,8 +47,8 @@ class Version AsciiString getAsciiVersion() const; ///< Return a human-readable game version number UnicodeString getUnicodeVersion() const; ///< Return a human-readable game version number. Is decorated with localized string - AsciiString getAsciiBuildTime() const; ///< Return a formated date/time string for build time - UnicodeString getUnicodeBuildTime() const; ///< Return a formated date/time string for build time. Is decorated with localized string + AsciiString getAsciiBuildTime() const; ///< Return a formatted date/time string for build time + UnicodeString getUnicodeBuildTime() const; ///< Return a formatted date/time string for build time. Is decorated with localized string AsciiString getAsciiBuildLocation() const; ///< Return a string with the build location UnicodeString getUnicodeBuildLocation() const; ///< Return a string with the build location. Is decorated with localized string diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h index 8a4770cbe1c..19ea3841d53 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h @@ -160,7 +160,7 @@ friend class Anim2DCollection; UnsignedInt getCurrentFrameHeight( void ) const; ///< return natural height of image in the current frame const Anim2DTemplate *getAnimTemplate( void ) const { return m_template; } ///< return our template - void draw( Int x, Int y ); ///< draw iamge at location using natural width/height + void draw( Int x, Int y ); ///< draw image at location using natural width/height void draw( Int x, Int y, Int width, Int height ); ///< draw image at location using forced width/height protected: diff --git a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h index 523a4276f5c..2b907083278 100644 --- a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h @@ -139,7 +139,7 @@ class AnimateWindow : public MemoryPoolObject private: UnsignedInt m_delay; ///< Holds the delay time in which the animation will start (in milliseconds) ICoord2D m_startPos; ///< Holds the starting position of the animation - ///<(usuall is also the end position of the animation when the animation is reversed) + ///<(usually is also the end position of the animation when the animation is reversed) ICoord2D m_endPos; ///< Holds the target End Position (usually is the same as the rest position) ICoord2D m_curPos; ///< It's Current Position ICoord2D m_restPos; ///< When the Manager Resets, It sets the window's position to this position diff --git a/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h b/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h index 2ea11594e4d..77b4fe19875 100644 --- a/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h @@ -122,7 +122,7 @@ class CampaignManager : public Snapshot Campaign *getCurrentCampaign( void ); ///< Returns a point to the current Campaign Mission *getCurrentMission( void ); ///< Returns a point to the current mission Mission *gotoNextMission( void ); ///< Set the next mission as the current Mission, and returns a point to it - void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaing and Mission we're on + void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaign and Mission we're on void setCampaign( AsciiString campaign ); ///< sets the campaign and set's it's first mission AsciiString getCurrentMap( void ); ///< Get the map located in m_currentMission; enum { INVALID_MISSION_NUMBER = -1 }; diff --git a/Generals/Code/GameEngine/Include/GameClient/Color.h b/Generals/Code/GameEngine/Include/GameClient/Color.h index 87c497de181..842827c3028 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Color.h +++ b/Generals/Code/GameEngine/Include/GameClient/Color.h @@ -55,7 +55,7 @@ // TYPE DEFINES /////////////////////////////////////////////////////////////// enum { GAME_COLOR_UNDEFINED = 0x00FFFFFF }; // this is white with zero alpha... safe to use! -/** @todo we need real color representation, this is just palce holder so we +/** @todo we need real color representation, this is just placeholder so we can more easily identify sections of the code that need it */ typedef Int Color; diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index fff5c3f4466..e6e80414b5a 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -490,7 +490,7 @@ class Drawable : public Thing, /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ void setAnimationCompletionTime(UnsignedInt numFrames); void updateSubObjects(); diff --git a/Generals/Code/GameEngine/Include/GameClient/Gadget.h b/Generals/Code/GameEngine/Include/GameClient/Gadget.h index f0140ad47b8..e41c82efff4 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Gadget.h +++ b/Generals/Code/GameEngine/Include/GameClient/Gadget.h @@ -372,7 +372,7 @@ typedef struct _ListboxData Int *selections; // Pointer to array of selections (for MULTI select) Short displayHeight; // Height in pixels of listbox display region - // this is computed based on the existance + // this is computed based on the existence // of a title or not. UnsignedInt doubleClickTime; // Short displayPos; // Position of current display entry in pixels diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h index bdaa7863de4..3e299f29ba5 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h @@ -270,7 +270,7 @@ friend class GameWindow; WindowMsgData mData1, WindowMsgData mData2 ); /** get the window pointer from id, starting at 'window' and searching - down the heirarchy. If 'window' is nullptr then all windows will + down the hierarchy. If 'window' is nullptr then all windows will be searched */ virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id ); virtual Int winCapture( GameWindow *window ); ///< captures the mouse diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h index 64e9291d724..d6bc143d607 100644 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h @@ -343,7 +343,7 @@ class MetaMapRec : public MemoryPoolObject MappableKeyModState m_modState; ///< the required state of the ctrl-alt-shift keys CommandUsableInType m_usableIn; ///< the allowed place the command can be used in // Next fields are added for Key mapping Dialog - MappableKeyCategories m_category; ///< This is the catagory the key falls under + MappableKeyCategories m_category; ///< This is the category the key falls under UnicodeString m_description; ///< The description string for the keys UnicodeString m_displayName; ///< The display name of our command }; diff --git a/Generals/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h b/Generals/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h index 1e82c6d0e77..245cc4e7cb2 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h @@ -99,7 +99,7 @@ class ProcessAnimateWindowSlideFromRight : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up @@ -122,7 +122,7 @@ class ProcessAnimateWindowSlideFromLeft : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up @@ -145,7 +145,7 @@ class ProcessAnimateWindowSlideFromTop : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up @@ -166,7 +166,7 @@ class ProcessAnimateWindowSlideFromTopFast : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up @@ -189,7 +189,7 @@ class ProcessAnimateWindowSlideFromBottom : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up @@ -247,7 +247,7 @@ class ProcessAnimateWindowSlideFromRightFast : public ProcessAnimateWindow virtual Bool reverseAnimateWindow( wnd::AnimateWindow *animWin ); private: Coord2D m_maxVel; // top speed windows travel in x and y -Int m_slowDownThreshold; // when widnows get this close to their resting +Int m_slowDownThreshold; // when windows get this close to their resting // positions they start to slow down Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker) Real m_speedUpRatio; // how fast the windows speed up diff --git a/Generals/Code/GameEngine/Include/GameClient/Shell.h b/Generals/Code/GameEngine/Include/GameClient/Shell.h index 93dd2fbcfb3..dda9825ea29 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Shell.h +++ b/Generals/Code/GameEngine/Include/GameClient/Shell.h @@ -83,8 +83,8 @@ // the layout and then you are REQUIRED to notify the shell by calling // the Shell::shutdownComplete() method. // -// Shutdown() is also required to be able to handle the paramater "immediatePop". -// If this paramater is TRUE it means that when control returns from the +// Shutdown() is also required to be able to handle the parameter "immediatePop". +// If this parameter is TRUE it means that when control returns from the // shutdown function that the layout will immediately be popped off the // stack. We need to be able to handle this when in code we want to // traverse back down the stack rapidly (like when we lose connection to diff --git a/Generals/Code/GameEngine/Include/GameClient/WinInstanceData.h b/Generals/Code/GameEngine/Include/GameClient/WinInstanceData.h index 242dbeca0ae..1beaf34f9a6 100644 --- a/Generals/Code/GameEngine/Include/GameClient/WinInstanceData.h +++ b/Generals/Code/GameEngine/Include/GameClient/WinInstanceData.h @@ -116,7 +116,7 @@ class WinInstanceData Int getTextLength( void ); ///< get number of chars in instance text Int getTooltipTextLength( void ); ///< get number of chars in tooltip text UnsignedInt getStyle( void ); ///< return window style - UnsignedInt getStatus( void ); ///< return widnow status + UnsignedInt getStatus( void ); ///< return window status UnsignedInt getState( void ); ///< return window state GameWindow *getOwner( void ); ///< return window owner GameFont *getFont( void ); ///< return window font @@ -165,7 +165,7 @@ class WinInstanceData DisplayString *m_text; ///< generic text for any window to display DisplayString *m_tooltip; ///< tooltip for display - //NOTE Video Buffer cannot be transfered to another window. + //NOTE Video Buffer cannot be transferred to another window. VideoBuffer *m_videoBuffer; ///< Each window can be made to play a video in it. // NOTE if you add data to this make sure you update winSetInstanceData() diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h index 354e5933577..fd8641ca740 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ActiveBody.h @@ -89,8 +89,8 @@ class ActiveBody : public BodyModule virtual void setArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 1); } virtual void clearArmorSetFlag(ArmorSetType ast) { m_curArmorSetFlags.set(ast, 0); } - virtual void setInitialHealth(Int initialPercent); ///< Sets the inital load health %. - virtual void setMaxHealth( Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ); ///< Sets the inital max health + virtual void setInitialHealth(Int initialPercent); ///< Sets the initial load health %. + virtual void setMaxHealth( Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ); ///< Sets the initial max health virtual Bool getFrontCrushed() const { return m_frontCrushed; } virtual Bool getBackCrushed() const { return m_backCrushed; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index 7620e94d062..a421cd19ae1 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -252,7 +252,7 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface virtual Bool getFrontCrushed() const { return false; } virtual Bool getBackCrushed() const { return false; } - virtual void setInitialHealth(Int initialPercent) { } ///< Sets the inital load health %. + virtual void setInitialHealth(Int initialPercent) { } ///< Sets the initial load health %. virtual void setMaxHealth(Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ) { } ///< Sets the max health. virtual void setFrontCrushed(Bool v) { DEBUG_CRASH(("you should never call this for generic Bodys")); } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index 06f3e3e6f55..62c9f92fe50 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -167,7 +167,7 @@ class GarrisonContain : public OpenContain // // The max units inside any garrisoned structure is 10. Since the units will "move around" // the inside of the structure to be close to their targets, we need a max of 10 garrison points - // on each side of the building to accomodate everybody inside + // on each side of the building to accommodate everybody inside // // ---------------------------------------------------------------------------------------------- struct GarrisonPointData diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h index 2fe350c6b68..b9c126c29bd 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h @@ -52,7 +52,7 @@ class HelicopterSlowDeathBehaviorModuleData : public SlowDeathBehaviorModuleData Real m_spiralOrbitForwardSpeedDamping;///< every frame our forward speed in the orbit is adjusted by this amount Real m_minSelfSpin; ///< (rads per frame) min turning rate at which we spin around our center of gravity Real m_maxSelfSpin; ///< (rads per frame) max turning rate at which we spin around our center of gravity - Real m_selfSpinUpdateDelay; ///< (frames) every this many frames we will update the self spin angle, but we'll keep it inbetween the min and max self spin + Real m_selfSpinUpdateDelay; ///< (frames) every this many frames we will update the self spin angle, but we'll keep it in between the min and max self spin Real m_selfSpinUpdateAmount; ///< (radian) when we update the self spin every SelfSpinUpdateDelay frames, we change it this much, but keep it between min and max self spin Real m_fallHowFast; ///< a fraction of gravity we use to modify the helicopert locmotor lift Real m_minBladeFlyOffDelay; ///< (frames) min frame that the blade will fly off at diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h b/Generals/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h index f668cdb007e..0e20f8b67f5 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h @@ -48,7 +48,7 @@ class JetSlowDeathBehaviorModuleData : public SlowDeathBehaviorModuleData static void buildFieldParse( MultiIniFieldParse &p ); - const FXList *m_fxOnGroundDeath; ///< fx list executed on death when destoyed on ground + const FXList *m_fxOnGroundDeath; ///< fx list executed on death when destroyed on ground const ObjectCreationList *m_oclOnGroundDeath; ///< ocl list executed on death when destroyed on ground const FXList *m_fxInitialDeath; ///< FXList for initial death diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h index bedd3b2b556..57203e391a0 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h @@ -45,7 +45,7 @@ class LaserUpdateModuleData : public ClientUpdateModuleData public: AsciiString m_particleSystemName; ///< Used for the muzzle flare while laser active. AsciiString m_parentFireBoneName; ///< Used to fire laser at specified parent bone position. - Bool m_parentFireBoneOnTurret; ///< And used to specifiy where to look for the bone. + Bool m_parentFireBoneOnTurret; ///< And used to specify where to look for the bone. AsciiString m_targetParticleSystemName; ///< Used for the target effect while laser active. diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h index 9a9f5fce477..878288bacb6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h @@ -200,7 +200,7 @@ class ProductionUpdate : public UpdateModule, public ProductionUpdateInterface, /** this method is used to request a unique ID to assign to the production of a single unit. It is unique to all units that can be created from this source object, but is - not unique amoung multiple source objects */ + not unique among multiple source objects */ virtual ProductionID requestUniqueUnitID( void ) { ProductionID tmp = m_uniqueID; m_uniqueID = (ProductionID)(m_uniqueID+1); return tmp; } virtual Bool queueUpgrade( const UpgradeTemplate *upgrade ); ///< queue upgrade "research" diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h index 11c9a93b1b8..ab95c652937 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h @@ -89,7 +89,7 @@ class SpawnPointProductionExitUpdate : public UpdateModule, public ExitInterface Int m_spawnPointCount; ///< How many in the array are actually live and valid Coord3D m_worldCoordSpawnPoints[MAX_SPAWN_POINTS];///< Where my little friends will be created Real m_worldAngleSpawnPoints[MAX_SPAWN_POINTS]; ///< And what direction they should face - ObjectID m_spawnPointOccupier[MAX_SPAWN_POINTS]; ///< Who I think is in each spot. I can validate their existance to see if I am free to exit something. + ObjectID m_spawnPointOccupier[MAX_SPAWN_POINTS]; ///< Who I think is in each spot. I can validate their existence to see if I am free to exit something. // Required func to fufill Module requirement diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h index 790c7f8e18d..cee0756fb22 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h @@ -262,7 +262,7 @@ class SpecialAbilityUpdate : public UpdateModule, public SpecialPowerUpdateInter Int m_locationCount; std::list m_specialObjectIDList; //The list of special objects UnsignedInt m_specialObjectEntries; //The size of the list of member Objects - Real m_captureFlashPhase; ///< used to track the accellerating flash of the capture FX + Real m_captureFlashPhase; ///< used to track the accelerating flash of the capture FX PackingState m_packingState; Bool m_active; Bool m_noTargetCommand; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 76501f95dc2..28a5e2bfc55 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -292,7 +292,7 @@ class Object : public Thing, public Snapshot // // Find us our production update interface if we have one. This method exists simply - // because we do this in a lot of places in the code and I want a convenient way to get thsi (CBD) + // because we do this in a lot of places in the code and I want a convenient way to get this (CBD) // ProductionUpdateInterface* getProductionUpdateInterface( void ); @@ -332,7 +332,7 @@ class Object : public Thing, public Snapshot // Selectable is individually controlled on an object by object basis for design now. // It defaults to the thingTemplate->isKindof(KINDOF_SELECTABLE), however, it can be overridden on an - // object by object basis. Finally, it can be temporarily overriden by the OBJECT_STATUS_UNSELECTABLE. + // object by object basis. Finally, it can be temporarily overridden by the OBJECT_STATUS_UNSELECTABLE. // jba. void setSelectable(Bool selectable); Bool isSelectable() const; @@ -392,7 +392,7 @@ class Object : public Thing, public Snapshot const PartitionData *friend_getConstPartitionData() const { return m_partitionData; } Bool hasGhostObject() const; ///< This object has a ghost object. This does not imply that a ghost snapshot is taken or active. - void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' + void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenance that can be considered 'cell-based' void handlePartitionCellMaintenance(); ///< Undo and redo all shroud actions. Call when something has changed, like position or ownership or Death Real getVisionRange() const; ///< How far can you see? This is dynamic so it is in Object. @@ -441,7 +441,7 @@ class Object : public Thing, public Snapshot const AsciiString& getCommandSetString() const; void setCommandSetStringOverride( AsciiString newCommandSetString ) { m_commandSetStringOverride = newCommandSetString; } - /// People are faking their commandsets, and, Suprise!, they are authoritative. Challenge everything. + /// People are faking their commandsets, and, Surprise!, they are authoritative. Challenge everything. Bool canProduceUpgrade( const UpgradeTemplate *upgrade ); // Weapons & Damage ------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index b77828930fe..e893104da1d 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1265,7 +1265,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot friend void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); friend void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); - void processPendingUndoShroudRevealQueue(Bool considerTimestamp = TRUE); ///< keep popping and processing untill you get to one that is in the future + void processPendingUndoShroudRevealQueue(Bool considerTimestamp = TRUE); ///< keep popping and processing until you get to one that is in the future void resetPendingUndoShroudRevealQueue(); ///< Just delete everything in the queue without doing anything with them public: @@ -1303,7 +1303,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot PartitionCell *getCellAt(Int x, Int y); const PartitionCell *getCellAt(Int x, Int y) const; - /// A convenience funtion to reveal shroud at some location + /// A convenience function to reveal shroud at some location // Queueing does not give you control of the timestamp to enforce the queue. I own the delay, you don't. void doShroudReveal( Real centerX, Real centerY, Real radius, PlayerMaskType playerMask); void undoShroudReveal( Real centerX, Real centerY, Real radius, PlayerMaskType playerMask); diff --git a/Generals/Code/GameEngine/Include/GameLogic/RankInfo.h b/Generals/Code/GameEngine/Include/GameLogic/RankInfo.h index 581928a9eff..a84e1c7ce94 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/RankInfo.h +++ b/Generals/Code/GameEngine/Include/GameLogic/RankInfo.h @@ -24,7 +24,7 @@ // FILE: RankInfo.h //////////////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Sep 2002 -// Desc: RankInfo descriptoins +// Desc: RankInfo descriptions /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once From ca4015edb75efd030bc87cae50df1f895a3820b3 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 11:00:46 -0500 Subject: [PATCH 060/211] docs: Fix spelling errors in GeneralsMD/Code/GameEngine/Include comments (#2123) --- .../Code/GameEngine/Include/Common/AcademyStats.h | 2 +- .../Code/GameEngine/Include/Common/BitFlags.h | 2 +- .../GameEngine/Include/Common/BuildAssistant.h | 4 ++-- .../Code/GameEngine/Include/Common/DisabledTypes.h | 4 ++-- .../Code/GameEngine/Include/Common/DrawModule.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Energy.h | 2 +- .../GameEngine/Include/Common/FunctionLexicon.h | 4 ++-- .../Code/GameEngine/Include/Common/GameState.h | 2 +- .../Code/GameEngine/Include/Common/GameStateMap.h | 2 +- .../Code/GameEngine/Include/Common/GameType.h | 2 +- .../Code/GameEngine/Include/Common/GlobalData.h | 12 ++++++------ GeneralsMD/Code/GameEngine/Include/Common/KindOf.h | 4 ++-- GeneralsMD/Code/GameEngine/Include/Common/List.h | 4 ++-- .../Code/GameEngine/Include/Common/MessageStream.h | 8 ++++---- .../Code/GameEngine/Include/Common/ModelState.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Module.h | 2 +- .../Code/GameEngine/Include/Common/ModuleFactory.h | 4 ++-- .../Code/GameEngine/Include/Common/Override.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Player.h | 14 +++++++------- .../Code/GameEngine/Include/Common/Registry.h | 2 +- .../Include/Common/ResourceGatheringManager.h | 4 ++-- .../Code/GameEngine/Include/Common/Science.h | 2 +- .../Code/GameEngine/Include/Common/ScoreKeeper.h | 2 +- .../GameEngine/Include/Common/StatsCollector.h | 2 +- .../GameEngine/Include/Common/SubsystemInterface.h | 2 +- GeneralsMD/Code/GameEngine/Include/Common/Team.h | 4 ++-- .../Code/GameEngine/Include/Common/Terrain.h | 2 +- .../Code/GameEngine/Include/Common/ThingFactory.h | 2 +- .../Code/GameEngine/Include/Common/ThingTemplate.h | 2 +- .../Code/GameEngine/Include/Common/version.h | 4 ++-- .../Code/GameEngine/Include/GameClient/Anim2D.h | 2 +- .../Include/GameClient/AnimateWindowManager.h | 4 ++-- .../Include/GameClient/CampaignManager.h | 2 +- .../Code/GameEngine/Include/GameClient/Color.h | 2 +- .../GameEngine/Include/GameClient/ControlBar.h | 2 +- .../GameEngine/Include/GameClient/DebugDisplay.h | 2 +- .../Code/GameEngine/Include/GameClient/Display.h | 4 ++-- .../Code/GameEngine/Include/GameClient/Drawable.h | 2 +- .../Code/GameEngine/Include/GameClient/Gadget.h | 12 ++++++------ .../GameEngine/Include/GameClient/GadgetComboBox.h | 2 +- .../Include/GameClient/GameWindowManager.h | 4 ++-- .../Include/GameClient/GameWindowTransitions.h | 4 ++-- .../Code/GameEngine/Include/GameClient/HotKey.h | 2 +- .../Code/GameEngine/Include/GameClient/Image.h | 2 +- .../Code/GameEngine/Include/GameClient/InGameUI.h | 4 ++-- .../Code/GameEngine/Include/GameClient/MetaEvent.h | 2 +- .../Include/GameClient/ProcessAnimateWindow.h | 12 ++++++------ .../Code/GameEngine/Include/GameClient/Shell.h | 4 ++-- .../Include/GameClient/WinInstanceData.h | 4 ++-- GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h | 2 +- .../Code/GameEngine/Include/GameLogic/AIPathfind.h | 4 ++-- .../GameEngine/Include/GameLogic/CrateSystem.h | 4 ++-- .../Code/GameEngine/Include/GameLogic/Damage.h | 4 ++-- .../GameEngine/Include/GameLogic/Module/AIUpdate.h | 2 +- .../Include/GameLogic/Module/ActiveBody.h | 4 ++-- .../Include/GameLogic/Module/AutoHealBehavior.h | 2 +- .../Include/GameLogic/Module/BodyModule.h | 2 +- .../Include/GameLogic/Module/BridgeBehavior.h | 2 +- .../Include/GameLogic/Module/CollideModule.h | 2 +- .../Include/GameLogic/Module/ContainModule.h | 2 +- .../GameLogic/Module/CountermeasuresBehavior.h | 2 +- .../GameEngine/Include/GameLogic/Module/DamDie.h | 2 +- .../Include/GameLogic/Module/DozerAIUpdate.h | 4 ++-- .../Module/DynamicShroudClearingRangeUpdate.h | 4 ++-- .../Include/GameLogic/Module/FXListDie.h | 2 +- .../Module/FireOCLAfterWeaponCooldownUpdate.h | 2 +- .../Module/FireWeaponWhenDamagedBehavior.h | 4 ++-- .../GameLogic/Module/FireWeaponWhenDeadBehavior.h | 2 +- .../Include/GameLogic/Module/FloatUpdate.h | 2 +- .../Include/GameLogic/Module/GarrisonContain.h | 2 +- .../GameLogic/Module/GenerateMinefieldBehavior.h | 2 +- .../GameLogic/Module/HelicopterSlowDeathUpdate.h | 4 ++-- .../GameLogic/Module/JetSlowDeathBehavior.h | 2 +- .../GameLogic/Module/ObjectDefectionHelper.h | 2 +- .../Include/GameLogic/Module/ObjectHelper.h | 2 +- .../Include/GameLogic/Module/ObjectSMCHelper.h | 2 +- .../GameLogic/Module/ObjectWeaponStatusHelper.h | 2 +- .../Include/GameLogic/Module/OpenContain.h | 4 ++-- .../Include/GameLogic/Module/OverlordContain.h | 2 +- .../Include/GameLogic/Module/PhysicsUpdate.h | 2 +- .../Include/GameLogic/Module/ProductionUpdate.h | 4 ++-- .../GameLogic/Module/ProjectileStreamUpdate.h | 2 +- .../Module/SpawnPointProductionExitUpdate.h | 2 +- .../GameLogic/Module/SpecialAbilityUpdate.h | 2 +- .../Include/GameLogic/Module/SpyVisionUpdate.h | 2 +- .../Include/GameLogic/Module/UpgradeModule.h | 2 +- .../Include/GameLogic/Module/WorkerAIUpdate.h | 2 +- .../Code/GameEngine/Include/GameLogic/Object.h | 12 ++++++------ .../Include/GameLogic/PartitionManager.h | 4 ++-- .../Code/GameEngine/Include/GameLogic/RankInfo.h | 2 +- .../Code/GameEngine/Include/GameLogic/Scripts.h | 6 +++--- .../GameEngine/Include/GameLogic/TerrainLogic.h | 4 ++-- .../Code/GameEngine/Include/GameLogic/Weapon.h | 2 +- 93 files changed, 152 insertions(+), 152 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h b/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h index 752bb8f3e24..bf51ee10116 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/AcademyStats.h @@ -194,7 +194,7 @@ class AcademyStats : public Snapshot //13) Extra gathers built? UnsignedInt m_gatherersBuilt; - //14) Heros built? + //14) Heroes built? UnsignedInt m_heroesBuilt; //+------------------------------+ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h index c2d731229c9..28b2ab870e1 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h @@ -43,7 +43,7 @@ class AsciiString; us initialize stuff in useful ways, and (2) provide a default constructor that implicitly converts ints into bitsets in a "wrong" way (ie, it treats the int as a mask, not an index). So we wrap to correct this, but leave the bitset "exposed" so that we can use all the non-ctor - functions on it directly (since it doesn't overload operator= to do the "wrong" thing, strangley enough) + functions on it directly (since it doesn't overload operator= to do the "wrong" thing, strangely enough) */ template class BitFlags diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h b/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h index f56792d2827..0a4fd4b7788 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BuildAssistant.h @@ -112,7 +112,7 @@ class BuildAssistant : public SubsystemInterface { TERRAIN_RESTRICTIONS = 0x00000001, ///< Check for basic terrain restrictions CLEAR_PATH = 0x00000002, ///< Must be able to path find to location - NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controled objects that can't move out of the way + NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controlled objects that can't move out of the way USE_QUICK_PATHFIND = 0x00000008, ///< Use the quick pathfind method for CLEAR_PATH SHROUD_REVEALED = 0x00000010, ///< Check to make sure the shroud is revealed NO_ENEMY_OBJECT_OVERLAP = 0x00000020, ///< Can't overlap enemy objects only. @@ -168,7 +168,7 @@ class BuildAssistant : public SubsystemInterface /// tiling wall object helper function, we can use this to "tile" walls when building virtual TileBuildInfo *buildTiledLocations( const ThingTemplate *thingBeingTiled, - Real angle, // angle to consturct thing being tiled + Real angle, // angle to construct thing being tiled const Coord3D *start, const Coord3D *end, Real tilingSize, Int maxTiles, Object *builderObject ); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h index 2dc05b29628..68812c8aa8c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h @@ -46,13 +46,13 @@ enum DisabledType CPP_11(: Int) DISABLED_HELD, //Special case -- held means it can fire and isHeld checks to make sure ONLY held is set! DISABLED_PARALYZED, //Battle plans have changed, and unit is confused/paralyzed DISABLED_UNMANNED, //Vehicle is unmanned - DISABLED_UNDERPOWERED,//Seperate from ScriptUnderpowered, the owning player has insufficient power. Energy status controls this + DISABLED_UNDERPOWERED,//Separate from ScriptUnderpowered, the owning player has insufficient power. Energy status controls this DISABLED_FREEFALL, //This unit has been disabled via being in free fall DISABLED_AWESTRUCK, DISABLED_BRAINWASHED, DISABLED_SUBDUED, ///< Temporarily shut down by Subdual damage - //These ones are specificially for scripts to enable/reenable! + //These ones are specifically for scripts to enable/reenable! DISABLED_SCRIPT_DISABLED, DISABLED_SCRIPT_UNDERPOWERED, diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h b/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h index 0214bf86aeb..295715d98f6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DrawModule.h @@ -199,7 +199,7 @@ class ObjectDrawInterface /** similar to the above, but assumes that the current state is a "ONCE", and is smart about transition states... if there is a transition state - "inbetween", it is included in the completion time. + "in between", it is included in the completion time. */ virtual void setAnimationCompletionTime(UnsignedInt numFrames) = 0; virtual Bool updateBonesForClientParticleSystems( void ) = 0;///< this will reposition particle systems on the fly ML diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Energy.h b/GeneralsMD/Code/GameEngine/Include/Common/Energy.h index 6887530f704..0aea6f0c710 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Energy.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Energy.h @@ -44,7 +44,7 @@ #pragma once -// INLCUDES ///////////////////////////////////////////////////////////////////////////////////// +// INCLUDES ///////////////////////////////////////////////////////////////////////////////////// #include "Common/Snapshot.h" // ---------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h index b4873899b9b..00ba4e5f986 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/FunctionLexicon.h @@ -84,12 +84,12 @@ class FunctionLexicon : public SubsystemInterface TableEntry *getTable( TableIndex index ); // - // !NOTE! We do NOT have a functionToName() method becuase we assume + // !NOTE! We do NOT have a functionToName() method because we assume // that functions in the tables are unique and that there is a 1 to 1 // mapping of a symbol to a function address. However, when compiling // in release, functions that have the same arguments and the same // body (mainly empty stub functions) get optimized to the - // SAME ADDRESS. That destroyes our 1 to 1 mapping so it is something + // SAME ADDRESS. That destroys our 1 to 1 mapping so it is something // that we must avoid // // translate a function pointer to its symbolic name diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameState.h b/GeneralsMD/Code/GameEngine/Include/Common/GameState.h index 6d67933dd78..1d7cb27bf3d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameState.h @@ -165,7 +165,7 @@ class GameState : public SubsystemInterface, SaveGameInfo *getSaveGameInfo( void ) { return &m_gameInfo; } // snapshot interaction - void addPostProcessSnapshot( Snapshot *snapshot ); ///< add snapshot to post process laod + void addPostProcessSnapshot( Snapshot *snapshot ); ///< add snapshot to post process load // manipulating files Bool doesSaveGameExist( AsciiString filename ); ///< does the save file exist diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameStateMap.h b/GeneralsMD/Code/GameEngine/Include/Common/GameStateMap.h index af4f2587549..126bafdd353 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameStateMap.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameStateMap.h @@ -29,7 +29,7 @@ #pragma once -// INLCUDES /////////////////////////////////////////////////////////////////////////////////////// +// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "Common/Snapshot.h" #include "Common/SubsystemInterface.h" diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h index a079f07f81c..eab2ec3e846 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h @@ -182,7 +182,7 @@ enum WeaponSlotType CPP_11(: Int) // Layer 1 is the ground. // Layer 2 is the top layer - bridge if one is present, ground otherwise. // Layer 2 - LAYER_LAST -1 are bridges. -// Layer_WALL is a special "wall" layer for letting units run aroound on top of a wall +// Layer_WALL is a special "wall" layer for letting units run around on top of a wall // made of structures. // Note that the bridges just index in the pathfinder, so you don't actually // have a LAYER_BRIDGE_1 enum value. diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 0ffbd28506b..337477129cf 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -341,10 +341,10 @@ class GlobalData : public SubsystemInterface Int m_maxLineBuildObjects; ///< line style builds can be no longer than this Int m_maxTunnelCapacity; ///< Max people in Player's tunnel network Real m_horizontalScrollSpeedFactor; ///< Factor applied to the game screen scrolling speed. - Real m_verticalScrollSpeedFactor; ///< Seperated because of our aspect ratio + Real m_verticalScrollSpeedFactor; ///< Separated because of our aspect ratio Real m_scrollAmountCutoff; ///< Scroll speed to not adjust camera height Real m_cameraAdjustSpeed; ///< Rate at which we adjust camera height - Bool m_enforceMaxCameraHeight; ///< Enfoce max camera height while scrolling? + Bool m_enforceMaxCameraHeight; ///< Enforce max camera height while scrolling? Bool m_buildMapCache; AsciiString m_initialFile; ///< If this is specified, load a specific map from the command-line AsciiString m_pendingFile; ///< If this is specified, use this map at the next game start @@ -458,8 +458,8 @@ class GlobalData : public SubsystemInterface Bool m_debugShowGraphicalFramerate; ///< Whether or not to show the graphical framerate bar. - Int m_powerBarBase; ///< Logrithmic base for the power bar scale - Real m_powerBarIntervals; ///< how many logrithmic intervals the width will be divided into + Int m_powerBarBase; ///< Logarithmic base for the power bar scale + Real m_powerBarIntervals; ///< how many logarithmic intervals the width will be divided into Int m_powerBarYellowRange; ///< Red if consumption exceeds production, yellow if consumption this close but under, green if further under Real m_displayGamma; /// class OVERRIDE { public: - // Provide useful constructores to go from a T* to an OVERRIDE + // Provide useful constructors to go from a T* to an OVERRIDE OVERRIDE(const T *overridable = nullptr); // Copy constructor OVERRIDE(OVERRIDE &overridable); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h index a1a784be06c..67b9eb662ce 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h @@ -159,7 +159,7 @@ class PlayerRelationMap : public MemoryPoolObject, PlayerRelationMap( void ); // virtual destructor provided by memory pool object - /** @todo I'm jsut wrappign this up in a nice snapshot object, we really should isolate + /** @todo I'm just wrapping this up in a nice snapshot object, we really should isolate * m_map from public access and make access methods for our operations */ PlayerRelationMapType m_map; @@ -235,7 +235,7 @@ class Player : public Snapshot Money *getMoney() { return &m_money; } const Money *getMoney() const { return &m_money; } - UnsignedInt getSupplyBoxValue();///< Many things can affect the alue of a crate, but at heart it is a GlobalData ratio. + UnsignedInt getSupplyBoxValue();///< Many things can affect the value of a crate, but at heart it is a GlobalData ratio. Energy *getEnergy() { return &m_energy; } const Energy *getEnergy() const { return &m_energy; } @@ -315,10 +315,10 @@ class Player : public Snapshot Bool hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ); ///< does player have this upgrade in progress right now Upgrade *addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStatusType status ); ///< add upgrade, or update existing upgrade status - void removeUpgrade( const UpgradeTemplate *upgradeTemplate ); ///< remove thsi upgrade from us + void removeUpgrade( const UpgradeTemplate *upgradeTemplate ); ///< remove this upgrade from us /** find upgrade, NOTE, the upgrade may *NOT* be "complete" and therefore "active", it could be in production - This function is for actually retrieving the Upgrade. To test existance, use the fast bit testers hasUpgradeX() + This function is for actually retrieving the Upgrade. To test existence, use the fast bit testers hasUpgradeX() */ Upgrade *findUpgrade( const UpgradeTemplate *upgradeTemplate ); @@ -458,7 +458,7 @@ class Player : public Snapshot /// Have the ai check for bridges. virtual void repairStructure(ObjectID structureID); - /// a structuer was just created, but is under construction + /// a structure was just created, but is under construction void onStructureCreated( Object *builder, Object *structure ); /// a structure that was under construction has become completed @@ -741,7 +741,7 @@ class Player : public Snapshot UnicodeString m_playerDisplayName; ///< This player's persistent name. Handicap m_handicap; ///< adjustment to varied capabilities (@todo: is this persistent or recalced each time?) - AsciiString m_playerName; ///< player's itnernal name 9for matching map objects) + AsciiString m_playerName; ///< player's internal name (for matching map objects) NameKeyType m_playerNameKey; ///< This player's internal name (for matching map objects) PlayerIndex m_playerIndex; ///< player unique index. AsciiString m_side; ///< the "side" this player is on @@ -769,7 +769,7 @@ class Player : public Snapshot AIPlayer* m_ai; ///< if PLAYER_COMPUTER, the entity that does the thinking Int m_mpStartIndex; ///< The player's starting index for multiplayer. ResourceGatheringManager* m_resourceGatheringManager; ///< Keeps track of all Supply Centers and Warehouses - TunnelTracker* m_tunnelSystem; ///< All TunnelContain buildings use this part of me for actual conatinment + TunnelTracker* m_tunnelSystem; ///< All TunnelContain buildings use this part of me for actual containment Team* m_defaultTeam; ///< our "default" team. ScienceVec m_sciences; ///< (SAVE) sciences that we know (either intrinsically or via later purchases) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Registry.h b/GeneralsMD/Code/GameEngine/Include/Common/Registry.h index 9ec63c2c192..3b6ffe8ea9b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Registry.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Registry.h @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// // Registry.h -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h b/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h index 265081de2bb..dc26020ca76 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h @@ -50,8 +50,8 @@ class ResourceGatheringManager : public MemoryPoolObject, void addSupplyCenter( Object *newCenter ); ///< I captured or built a Supply Center, so record it void removeSupplyCenter( Object *oldCenter ); ///< Lost a supply center - void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is starrt of game recording - void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replinish has run out of Supply + void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is start of game recording + void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replenish has run out of Supply protected: diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Science.h b/GeneralsMD/Code/GameEngine/Include/Common/Science.h index 689b5078452..6c402af11e4 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Science.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Science.h @@ -24,7 +24,7 @@ // FILE: Science.h //////////////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day November 2001 -// Desc: Science descriptoins +// Desc: Science descriptions /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h b/GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h index d0148196885..d85f2df92ae 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h @@ -107,7 +107,7 @@ class ScoreKeeper : public Snapshot Int m_totalMoneyEarned; ///< The total money that was harvested, refined, received in crates Int m_totalMoneySpent; ///< The total money spent on units, buildings, repairs - Int m_totalUnitsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of enimies that we've killed + Int m_totalUnitsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of enemies that we've killed Int m_totalUnitsBuilt; ///< The total number of units we've created (created meaning that we built from a building) Int m_totalUnitsLost; ///< The total number of our units lost Int m_totalBuildingsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of Buildings we've destroyed diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StatsCollector.h b/GeneralsMD/Code/GameEngine/Include/Common/StatsCollector.h index a8406990152..73c2725ed34 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StatsCollector.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StatsCollector.h @@ -38,7 +38,7 @@ // // author: Chris Huybregts // -// purpose: Convinience class to help with collecting stats. +// purpose: Convenience class to help with collecting stats. // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index d0b6175a70c..f3cb210055d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -35,7 +35,7 @@ class Xfer; //------------------------------------------------------------------------------------------------- -/** This is the abstract base class from which all game engine subsytems should derive from. +/** This is the abstract base class from which all game engine subsystems should derive from. * In order to provide consistent behaviors across all these systems, any implementation * must obey the rules defined in here * diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Team.h b/GeneralsMD/Code/GameEngine/Include/Common/Team.h index cc332e97e41..ef15123da8a 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Team.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Team.h @@ -54,7 +54,7 @@ class TeamRelationMap : public MemoryPoolObject, TeamRelationMap( void ); // virtual destructor provided by memory pool object - /** @todo I'm jsut wrappign this up in a nice snapshot object, we really should isolate + /** @todo I'm just wrapping this up in a nice snapshot object, we really should isolate * m_map from public access and make access methods for our operations */ TeamRelationMapType m_map; @@ -710,7 +710,7 @@ class TeamFactory : public SubsystemInterface, /// create a team. there must be a TeamPrototype with the given name, or an exception is thrown. Team *createTeam(const AsciiString& name); - /// create a team given an explicity team prototype rather than a prototype name + /// create a team given an explicitly team prototype rather than a prototype name Team *createTeamOnPrototype( TeamPrototype *prototype ); /// create a team. there must be a TeamPrototype with the given name, or an exception is thrown. diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Terrain.h b/GeneralsMD/Code/GameEngine/Include/Common/Terrain.h index 69ce9299838..91c1559b787 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Terrain.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Terrain.h @@ -37,4 +37,4 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// // DEFINE ///////////////////////////////////////////////////////////////////// -#define MAX_TERRAIN_NAME_LEN 64 ///< max size of map filename with extenstion +#define MAX_TERRAIN_NAME_LEN 64 ///< max size of map filename with extension diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h index facde874381..b7971930c16 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingFactory.h @@ -95,7 +95,7 @@ class ThingFactory : public SubsystemInterface private: - /// free all template databse data + /// free all template database data void freeDatabase( void ); void addTemplate( ThingTemplate *thing ); ///< add the template to the DB diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index 3fb07704652..c76921b3326 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -117,7 +117,7 @@ enum ThingTemplateAudioType CPP_11(: Int) TTAUDIO_soundStealthOff, ///< Sound when unit destealths TTAUDIO_soundCreated, ///< Sound when unit is created TTAUDIO_soundOnDamaged, ///< Sound when unit enters damaged state - TTAUDIO_soundOnReallyDamaged, ///< Sound when unit enters reallyd damaged state + TTAUDIO_soundOnReallyDamaged, ///< Sound when unit enters really damaged state TTAUDIO_soundEnter, ///< Sound when another unit enters me. TTAUDIO_soundExit, ///< Sound when another unit exits me. TTAUDIO_soundPromotedVeteran, ///< Sound when unit gets promoted to Veteran level diff --git a/GeneralsMD/Code/GameEngine/Include/Common/version.h b/GeneralsMD/Code/GameEngine/Include/Common/version.h index 5c139fb6145..12e6b9ac93a 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/version.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/version.h @@ -47,8 +47,8 @@ class Version AsciiString getAsciiVersion() const; ///< Return a human-readable game version number UnicodeString getUnicodeVersion() const; ///< Return a human-readable game version number. Is decorated with localized string - AsciiString getAsciiBuildTime() const; ///< Return a formated date/time string for build time - UnicodeString getUnicodeBuildTime() const; ///< Return a formated date/time string for build time. Is decorated with localized string + AsciiString getAsciiBuildTime() const; ///< Return a formatted date/time string for build time + UnicodeString getUnicodeBuildTime() const; ///< Return a formatted date/time string for build time. Is decorated with localized string AsciiString getAsciiBuildLocation() const; ///< Return a string with the build location UnicodeString getUnicodeBuildLocation() const; ///< Return a string with the build location. Is decorated with localized string diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h index b0f4a2cb3ec..9ed15772c37 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h @@ -160,7 +160,7 @@ friend class Anim2DCollection; UnsignedInt getCurrentFrameHeight( void ) const; ///< return natural height of image in the current frame const Anim2DTemplate *getAnimTemplate( void ) const { return m_template; } ///< return our template - void draw( Int x, Int y ); ///< draw iamge at location using natural width/height + void draw( Int x, Int y ); ///< draw image at location using natural width/height void draw( Int x, Int y, Int width, Int height ); ///< draw image at location using forced width/height protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h index a43b0c8222a..9c1565daf30 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h @@ -139,7 +139,7 @@ class AnimateWindow : public MemoryPoolObject private: UnsignedInt m_delay; ///< Holds the delay time in which the animation will start (in milliseconds) ICoord2D m_startPos; ///< Holds the starting position of the animation - ///<(usuall is also the end position of the animation when the animation is reversed) + ///<(usually is also the end position of the animation when the animation is reversed) ICoord2D m_endPos; ///< Holds the target End Position (usually is the same as the rest position) ICoord2D m_curPos; ///< It's Current Position ICoord2D m_restPos; ///< When the Manager Resets, It sets the window's position to this position @@ -189,7 +189,7 @@ class AnimateWindowManager : public SubsystemInterface ProcessAnimateWindowSlideFromBottom *m_slideFromBottom; ///< Holds the process in which the windows slide from the Bottom ProcessAnimateWindowSpiral *m_spiral; ///< Holds the process in which the windows Spiral onto the screen ProcessAnimateWindowSlideFromBottomTimed *m_slideFromBottomTimed; ///< Holds the process in which the windows slide from the Bottom in a time-based fashion - ProcessAnimateWindowSlideFromTopFast *m_slideFromTopFast; ///< holds the process in wich the windows slide from the top,fast + ProcessAnimateWindowSlideFromTopFast *m_slideFromTopFast; ///< holds the process in which the windows slide from the top,fast ProcessAnimateWindow *getProcessAnimate( AnimTypes animType); ///< returns the process for the kind of animation we need. }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CampaignManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CampaignManager.h index f82e5a64b07..b894004aeff 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/CampaignManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/CampaignManager.h @@ -126,7 +126,7 @@ class CampaignManager : public Snapshot Campaign *getCurrentCampaign( void ); ///< Returns a point to the current Campaign Mission *getCurrentMission( void ); ///< Returns a point to the current mission Mission *gotoNextMission( void ); ///< Set the next mission as the current Mission, and returns a point to it - void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaing and Mission we're on + void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaign and Mission we're on void setCampaign( AsciiString campaign ); ///< sets the campaign and set's it's first mission AsciiString getCurrentMap( void ); ///< Get the map located in m_currentMission; enum { INVALID_MISSION_NUMBER = -1 }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Color.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Color.h index 34f4a5f2965..3146f86fc26 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Color.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Color.h @@ -55,7 +55,7 @@ // TYPE DEFINES /////////////////////////////////////////////////////////////// enum { GAME_COLOR_UNDEFINED = 0x00FFFFFF }; // this is white with zero alpha... safe to use! -/** @todo we need real color representation, this is just palce holder so we +/** @todo we need real color representation, this is just placeholder so we can more easily identify sections of the code that need it */ typedef Int Color; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index eec85e73123..fb3da09a608 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -194,7 +194,7 @@ enum GUICommandType CPP_11(: Int) GUI_COMMAND_COMBATDROP, ///< rappel contents to ground or bldg GUI_COMMAND_SWITCH_WEAPON, ///< switch weapon use - //Context senstive command modes + //Context sensitive command modes GUICOMMANDMODE_HIJACK_VEHICLE, GUICOMMANDMODE_CONVERT_TO_CARBOMB, GUICOMMANDMODE_SABOTAGE_BUILDING, diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h index 98dccebbf2d..10bb4cb5fec 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h @@ -96,7 +96,7 @@ class DebugDisplayInterface protected: - virtual void drawText( Int x, Int y, Char *text ) = 0; ///< Render null ternimated string at current cursor position + virtual void drawText( Int x, Int y, Char *text ) = 0; ///< Render null terminated string at current cursor position }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h index 352a2517d86..c6c69b62298 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h @@ -78,7 +78,7 @@ class Display : public SubsystemInterface virtual UnsignedInt getHeight( void ) { return m_height; } ///< Returns the height of the display virtual void setBitDepth( UnsignedInt bitDepth ) { m_bitDepth = bitDepth; } virtual UnsignedInt getBitDepth( void ) { return m_bitDepth; } - virtual void setWindowed( Bool windowed ) { m_windowed = windowed; } ///< set windowd/fullscreen flag + virtual void setWindowed( Bool windowed ) { m_windowed = windowed; } ///< set windowed/fullscreen flag virtual Bool getWindowed( void ) { return m_windowed; } ///< return widowed/fullscreen flag virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ); ///m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h index c39d7cf06a1..19bd8386315 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BodyModule.h @@ -269,7 +269,7 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface virtual Bool getFrontCrushed() const { return false; } virtual Bool getBackCrushed() const { return false; } - virtual void setInitialHealth(Int initialPercent) { } ///< Sets the inital load health %. + virtual void setInitialHealth(Int initialPercent) { } ///< Sets the initial load health %. virtual void setMaxHealth(Real maxHealth, MaxHealthChangeType healthChangeType = SAME_CURRENTHEALTH ) { } ///< Sets the max health. virtual void setFrontCrushed(Bool v) { DEBUG_CRASH(("you should never call this for generic Bodys")); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BridgeBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BridgeBehavior.h index 43b5d0bbe95..079d856613a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BridgeBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/BridgeBehavior.h @@ -151,7 +151,7 @@ class BridgeBehavior : public UpdateModule, // our own methods static BridgeBehaviorInterface *getBridgeBehaviorInterfaceFromObject( Object *obj ); virtual void setTower( BridgeTowerType towerType, Object *tower ); ///< connect tower to us - virtual ObjectID getTowerID( BridgeTowerType towerType ); ///< retrive one of our towers + virtual ObjectID getTowerID( BridgeTowerType towerType ); ///< retrieve one of our towers virtual void createScaffolding( void ); ///< create scaffolding around bridge virtual void removeScaffolding( void ); ///< remove scaffolding around bridge virtual Bool isScaffoldInMotion( void ); ///< is scaffold in motion diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h index 9ce9008c5c5..316cb721402 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CollideModule.h @@ -38,7 +38,7 @@ - Note in the 'collide' method that 'other' can be null, this indicates a collision with the ground - Also note the 'collide' method is the response for the object that THIS module - belongs to, we do not need to worry about the collision moudle of 'other', + belongs to, we do not need to worry about the collision module of 'other', it will have its own collide action called separately */ //------------------------------------------------------------------------------------------------- class CollideModuleInterface diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h index 5a2db53fd1a..a087c3272ca 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h @@ -159,7 +159,7 @@ class ContainModuleInterface virtual void removeFromContain( Object *obj, Bool exposeStealthUnits = FALSE ) = 0; ///< remove 'obj' from contain list virtual void removeAllContained( Bool exposeStealthUnits = FALSE ) = 0; ///< remove all objects on contain list virtual void killAllContained( void ) = 0; ///< kill all objects on contain list - virtual void harmAndForceExitAllContained( DamageInfo *info ) = 0; // apply canned damage against those containes + virtual void harmAndForceExitAllContained( DamageInfo *info ) = 0; // apply canned damage against those contains virtual Bool isEnclosingContainerFor( const Object *obj ) const = 0; ///< Does this type of Contain Visibly enclose its contents? virtual Bool isPassengerAllowedToFire( ObjectID id = INVALID_ID ) const = 0; ///< Hey, can I shoot out of this container? virtual void setPassengerAllowedToFire( Bool permission = TRUE ) = 0; ///< Hey, can I shoot out of this container? diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h index d49252ecdc7..a583b07dbe5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h @@ -164,7 +164,7 @@ class CountermeasuresBehavior : public UpdateModule, public UpgradeMux, public C virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getCountermeasuresBehaviorModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamDie.h index 896ead68132..8a58fd7ace7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DamDie.h @@ -56,7 +56,7 @@ class DamDie : public DieModule public: DamDie( Thing *thing, const ModuleData* moduleData ); - // virtual destructor prorotype provided by MemoryPoolObject + // virtual destructor prototype provided by MemoryPoolObject virtual void onDie( const DamageInfo *damageInfo ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index fd1b97ba629..dbf4e87eee8 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -138,7 +138,7 @@ class DozerAIInterface virtual Bool getIsRebuild( void ) = 0; ///< get whether or not this is a rebuild. // task actions - virtual void newTask( DozerTask task, Object *target ) = 0; ///< set a desire to do the requrested task + virtual void newTask( DozerTask task, Object *target ) = 0; ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ) = 0; ///< cancel this task from the queue, if it's the current task the dozer will stop working on it // internal methods to manage behavior from within the dozer state machine @@ -237,7 +237,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface virtual Bool getIsRebuild( void ) { return m_isRebuild; } ///< get whether or not this building is a rebuild. // task actions - virtual void newTask( DozerTask task, Object *target ); ///< set a desire to do the requrested task + virtual void newTask( DozerTask task, Object *target ); ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it // internal methods to manage behavior from within the dozer state machine diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DynamicShroudClearingRangeUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DynamicShroudClearingRangeUpdate.h index 7b84745ca59..d371cf459a6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DynamicShroudClearingRangeUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DynamicShroudClearingRangeUpdate.h @@ -47,7 +47,7 @@ class DynamicShroudClearingRangeUpdateModuleData : public UpdateModuleData Real m_finalVision; ///< Then change to this UnsignedInt m_changeInterval; ///< And update my Object every this long - UnsignedInt m_growInterval; ///< Update evey this long while growing + UnsignedInt m_growInterval; ///< Update every this long while growing Bool m_doSpySatFX; ///< Do I do the pseudo-wireframe decal and blip effects? RadiusDecalTemplate m_gridDecalTemplate;///< For the pseudo-wireframe decal effect @@ -111,7 +111,7 @@ class DynamicShroudClearingRangeUpdate : public UpdateModule UnsignedInt m_sustainDeadline; UnsignedInt m_shrinkStartDeadline; UnsignedInt m_doneForeverFrame; ///< Just in case interval and state timing goes awry - ///< This supercedes and makes us quit + ///< This supersedes and makes us quit UnsignedInt m_changeIntervalCountdown;///< How long till I change my vision range again diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h index ec82e7db403..92e3665382d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FXListDie.h @@ -112,7 +112,7 @@ class FXListDie : public DieModule, public UpgradeMux virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getFXListDieModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireOCLAfterWeaponCooldownUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireOCLAfterWeaponCooldownUpdate.h index 2c14a00b3c4..2d62be1ebe6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireOCLAfterWeaponCooldownUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireOCLAfterWeaponCooldownUpdate.h @@ -83,7 +83,7 @@ class FireOCLAfterWeaponCooldownUpdate : public UpdateModule, public UpgradeMux virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getFireOCLAfterWeaponCooldownUpdateModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h index 076de50a23f..d293c2acada 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDamagedBehavior.h @@ -112,7 +112,7 @@ class FireWeaponWhenDamagedBehavior : public UpdateModule, FireWeaponWhenDamagedBehavior( Thing *thing, const ModuleData* moduleData ); // virtual destructor prototype provided by memory pool declaration - // module methids + // module methods static Int getInterfaceMask() { return UpdateModule::getInterfaceMask() | (MODULEINTERFACE_UPGRADE) | (MODULEINTERFACE_DAMAGE); } // BehaviorModule @@ -146,7 +146,7 @@ class FireWeaponWhenDamagedBehavior : public UpdateModule, virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getFireWeaponWhenDamagedBehaviorModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h index 1467788d208..cd33e9afccb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponWhenDeadBehavior.h @@ -111,7 +111,7 @@ class FireWeaponWhenDeadBehavior : public BehaviorModule, virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getFireWeaponWhenDeadBehaviorModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FloatUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FloatUpdate.h index 7da2cbce24e..97718acd7a1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FloatUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FloatUpdate.h @@ -24,7 +24,7 @@ // FILE: FloatUpdate.h //////////////////////////////////////////////////////////////////////////// // Author: Colin Day, May 2002 -// Desc: Floting on water update +// Desc: Floating on water update /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h index bccf952d2c0..a43c4892dbb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GarrisonContain.h @@ -188,7 +188,7 @@ class GarrisonContain : public OpenContain // // The max units inside any garrisoned structure is 10. Since the units will "move around" // the inside of the structure to be close to their targets, we need a max of 10 garrison points - // on each side of the building to accomodate everybody inside + // on each side of the building to accommodate everybody inside // // ---------------------------------------------------------------------------------------------- struct GarrisonPointData diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GenerateMinefieldBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GenerateMinefieldBehavior.h index 99a659b2e74..84d68fc7f1d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GenerateMinefieldBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GenerateMinefieldBehavior.h @@ -106,7 +106,7 @@ class GenerateMinefieldBehavior : public UpdateModule, } virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getGenerateMinefieldBehaviorModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h index 1e3ae0e31a1..b3a5a24b77e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HelicopterSlowDeathUpdate.h @@ -24,7 +24,7 @@ // FILE: HelicopterSlowDeathUpdate.h ////////////////////////////////////////////////////////////// // Author: Colin Day, March 2002 -// Desc: Helicoptor slow deaths +// Desc: Helicopter slow deaths /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once @@ -52,7 +52,7 @@ class HelicopterSlowDeathBehaviorModuleData : public SlowDeathBehaviorModuleData Real m_spiralOrbitForwardSpeedDamping;///< every frame our forward speed in the orbit is adjusted by this amount Real m_minSelfSpin; ///< (rads per frame) min turning rate at which we spin around our center of gravity Real m_maxSelfSpin; ///< (rads per frame) max turning rate at which we spin around our center of gravity - Real m_selfSpinUpdateDelay; ///< (frames) every this many frames we will update the self spin angle, but we'll keep it inbetween the min and max self spin + Real m_selfSpinUpdateDelay; ///< (frames) every this many frames we will update the self spin angle, but we'll keep it in between the min and max self spin Real m_selfSpinUpdateAmount; ///< (radian) when we update the self spin every SelfSpinUpdateDelay frames, we change it this much, but keep it between min and max self spin Real m_fallHowFast; ///< a fraction of gravity we use to modify the helicopert locmotor lift Real m_minBladeFlyOffDelay; ///< (frames) min frame that the blade will fly off at diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h index f9d8f8b50fa..50eff30b992 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/JetSlowDeathBehavior.h @@ -48,7 +48,7 @@ class JetSlowDeathBehaviorModuleData : public SlowDeathBehaviorModuleData static void buildFieldParse( MultiIniFieldParse &p ); - const FXList *m_fxOnGroundDeath; ///< fx list executed on death when destoyed on ground + const FXList *m_fxOnGroundDeath; ///< fx list executed on death when destroyed on ground const ObjectCreationList *m_oclOnGroundDeath; ///< ocl list executed on death when destroyed on ground const FXList *m_fxInitialDeath; ///< FXList for initial death diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectDefectionHelper.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectDefectionHelper.h index 8a3985e59a3..7200df8108d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectDefectionHelper.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectDefectionHelper.h @@ -24,7 +24,7 @@ // FILE: ObjectDefectionHelper.h ////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day - September 202 -// Desc: Object helpder - defection +// Desc: Object helper - defection /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectHelper.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectHelper.h index cdf4c59607f..b66dba304e0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectHelper.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectHelper.h @@ -24,7 +24,7 @@ // FILE: ObjectHelper.h /////////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day - September 202 -// Desc: Object helpder +// Desc: Object helper /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectSMCHelper.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectSMCHelper.h index 34fc3cd8335..2587ddb3781 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectSMCHelper.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectSMCHelper.h @@ -24,7 +24,7 @@ // FILE: ObjectSMCHelper.h //////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day - September 202 -// Desc: Object helpder - SMC +// Desc: Object helper - SMC /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectWeaponStatusHelper.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectWeaponStatusHelper.h index 0a36cfea973..4b6582cf2d2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectWeaponStatusHelper.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ObjectWeaponStatusHelper.h @@ -24,7 +24,7 @@ // FILE: ObjectWeaponStatusHelper.h /////////////////////////////////////////////////////////////// // Author: Steven Johnson, Colin Day - September 202 -// Desc: Object helpder - WeaponStatus +// Desc: Object helper - WeaponStatus /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index dbeeaba5ff6..b6561d72f85 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -156,7 +156,7 @@ class OpenContain : public UpdateModule, virtual void removeFromContain( Object *obj, Bool exposeStealthUnits = FALSE ); ///< remove 'obj' from contain list virtual void removeAllContained( Bool exposeStealthUnits = FALSE ); ///< remove all objects on contain list virtual void killAllContained( void ); ///< kill all objects on contain list - virtual void harmAndForceExitAllContained( DamageInfo *info ); // apply canned damage against those containes + virtual void harmAndForceExitAllContained( DamageInfo *info ); // apply canned damage against those contains virtual Bool isEnclosingContainerFor( const Object *obj ) const; ///< Does this type of Contain Visibly enclose its contents? virtual Bool isPassengerAllowedToFire( ObjectID id = INVALID_ID ) const; ///< Hey, can I shoot out of this container? @@ -231,7 +231,7 @@ class OpenContain : public UpdateModule, virtual void setEvacDisposition( EvacDisposition disp ) {}; protected: - virtual void monitorConditionChanges( void ); ///< check to see if we need to update our occupant postions from a model change or anything else + virtual void monitorConditionChanges( void ); ///< check to see if we need to update our occupant positions from a model change or anything else virtual void putObjAtNextFirePoint( Object *obj ); ///< place object at position of the next fire point to use virtual void redeployOccupants( void ); ///< redeploy any objects at firepoints due to a model condition change diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index 0610fd3fb4b..40a0c718cc5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h @@ -113,7 +113,7 @@ class OverlordContain : public TransportContain virtual void createPayload(); private: - /**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns nullptr, + /**< An empty overlord is a container, but a full one redirects calls to its passengers. If this returns nullptr, we are either empty or carrying a non container. */ ContainModuleInterface *getRedirectedContain() const; ///< And this gets what are redirecting to. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h index 228b36bd313..97b0aa55291 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h @@ -280,7 +280,7 @@ class PhysicsBehavior : public UpdateModule, ProjectileUpdateInterface* m_pui; mutable Real m_velMag; ///< magnitude of cur vel (recalced when m_vel changes) - Bool m_originalAllowBounce; ///< orignal state of allow bounce + Bool m_originalAllowBounce; ///< original state of allow bounce void setFlag(PhysicsFlagsType f, Bool set) { if (set) m_flags |= f; else m_flags &= ~f; } Bool getFlag(PhysicsFlagsType f) const { return (m_flags & f) != 0; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h index 23f721ead53..4b59fa4032f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProductionUpdate.h @@ -34,7 +34,7 @@ #include "GameLogic/Module/DieModule.h" #include "GameLogic/Module/UpdateModule.h" -// FORWARD REFERNCES ////////////////////////////////////////////////////////////////////////////// +// FORWARD REFERENCES ////////////////////////////////////////////////////////////////////////////// class ProductionEntry; class ThingTemplate; class UpgradeTemplate; @@ -205,7 +205,7 @@ class ProductionUpdate : public UpdateModule, public ProductionUpdateInterface, /** this method is used to request a unique ID to assign to the production of a single unit. It is unique to all units that can be created from this source object, but is - not unique amoung multiple source objects */ + not unique among multiple source objects */ virtual ProductionID requestUniqueUnitID( void ) { ProductionID tmp = m_uniqueID; m_uniqueID = (ProductionID)(m_uniqueID+1); return tmp; } virtual Bool queueUpgrade( const UpgradeTemplate *upgrade ); ///< queue upgrade "research" diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h index 3f79ac99c5a..7632d184bfa 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h @@ -55,7 +55,7 @@ class ProjectileStreamUpdate : public UpdateModule // virtual destructor prototype provided by memory pool declaration void addProjectile( ObjectID sourceID, ObjectID newID, ObjectID victimID, const Coord3D *victimPos ); ///< This projectile was just shot, so keep track of it. - void getAllPoints( Vector3 *points, Int *count ); ///< unroll circlular array and write down all projectile positions + void getAllPoints( Vector3 *points, Int *count ); ///< unroll circular array and write down all projectile positions void setPosition( const Coord3D *newPosition ); ///< I need to exist at the place I want to draw since only (near) on screen Drawables get updated virtual UpdateSleepTime update(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h index fa81a352131..f05ef2a5943 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnPointProductionExitUpdate.h @@ -89,7 +89,7 @@ class SpawnPointProductionExitUpdate : public UpdateModule, public ExitInterface Int m_spawnPointCount; ///< How many in the array are actually live and valid Coord3D m_worldCoordSpawnPoints[MAX_SPAWN_POINTS];///< Where my little friends will be created Real m_worldAngleSpawnPoints[MAX_SPAWN_POINTS]; ///< And what direction they should face - ObjectID m_spawnPointOccupier[MAX_SPAWN_POINTS]; ///< Who I think is in each spot. I can validate their existance to see if I am free to exit something. + ObjectID m_spawnPointOccupier[MAX_SPAWN_POINTS]; ///< Who I think is in each spot. I can validate their existence to see if I am free to exit something. // Required func to fufill Module requirement diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h index 7e619c43bb7..2d0d11bc6ec 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h @@ -273,7 +273,7 @@ class SpecialAbilityUpdate : public SpecialPowerUpdateModule Int m_locationCount; std::list m_specialObjectIDList; //The list of special objects UnsignedInt m_specialObjectEntries; //The size of the list of member Objects - Real m_captureFlashPhase; ///< used to track the accellerating flash of the capture FX + Real m_captureFlashPhase; ///< used to track the accelerating flash of the capture FX PackingState m_packingState; Bool m_active; Bool m_noTargetCommand; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h index 135f48273ff..3e70d0f9a98 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpyVisionUpdate.h @@ -123,7 +123,7 @@ class SpyVisionUpdate : public UpdateModule, public UpgradeMux } virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getSpyVisionUpdateModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h index f9c53fe98a3..a44012a0291 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h @@ -188,7 +188,7 @@ class UpgradeModule : public BehaviorModule, public UpgradeMux virtual void processUpgradeRemoval() { - // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritence is CRAP. + // I can't take it any more. Let the record show that I think the UpgradeMux multiple inheritance is CRAP. getUpgradeModuleData()->m_upgradeMuxData.muxDataProcessUpgradeRemoval(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h index df22ede3cc6..793843bff40 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h @@ -156,7 +156,7 @@ class WorkerAIUpdate : public AIUpdateInterface, public DozerAIInterface, public virtual Bool getIsRebuild( void ) { return m_isRebuild; } ///< get whether or not our task is a rebuild. // task actions - virtual void newTask( DozerTask task, Object* target ); ///< set a desire to do the requrested task + virtual void newTask( DozerTask task, Object* target ); ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it // internal methods to manage behavior from within the dozer state machine diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 7be872efc2d..5c2851ef7bd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -310,7 +310,7 @@ class Object : public Thing, public Snapshot // // Find us our production update interface if we have one. This method exists simply - // because we do this in a lot of places in the code and I want a convenient way to get thsi (CBD) + // because we do this in a lot of places in the code and I want a convenient way to get this (CBD) // ProductionUpdateInterface* getProductionUpdateInterface( void ); @@ -353,7 +353,7 @@ class Object : public Thing, public Snapshot // Selectable is individually controlled on an object by object basis for design now. // It defaults to the thingTemplate->isKindof(KINDOF_SELECTABLE), however, it can be overridden on an - // object by object basis. Finally, it can be temporarily overriden by the OBJECT_STATUS_UNSELECTABLE. + // object by object basis. Finally, it can be temporarily overridden by the OBJECT_STATUS_UNSELECTABLE. // jba. void setSelectable(Bool selectable); Bool isSelectable() const; @@ -417,7 +417,7 @@ class Object : public Thing, public Snapshot const PartitionData *friend_getConstPartitionData() const { return m_partitionData; } Bool hasGhostObject() const; ///< This object has a ghost object. This does not imply that a ghost snapshot is taken or active. - void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenence that can be considered 'cell-based' + void onPartitionCellChange();///< We have moved a 'significant' amount, so do maintenance that can be considered 'cell-based' void handlePartitionCellMaintenance(); ///< Undo and redo all shroud actions. Call when something has changed, like position or ownership or Death Real getVisionRange() const; ///< How far can you see? This is dynamic so it is in Object. @@ -713,13 +713,13 @@ class Object : public Thing, public Snapshot // These will last for my lifetime. I will reuse them and reset them. The truly dynamic ones are in PartitionManager SightingInfo *m_partitionLastLook; ///< Where and for whom I last looked, so I can undo its effects when I stop - SightingInfo *m_partitionRevealAllLastLook; ///< And a seperate look to reveal at a different range if so marked + SightingInfo *m_partitionRevealAllLastLook; ///< And a separate look to reveal at a different range if so marked Int m_visionSpiedBy[MAX_PLAYER_COUNT]; ///< Reference count of having units spied on by players. PlayerMaskType m_visionSpiedMask; ///< For quick lookup and edge triggered maintenance SightingInfo *m_partitionLastShroud; ///< Where and for whom I last shrouded, so I can undo its effects when I stop - SightingInfo *m_partitionLastThreat; ///< Where and for whom I last delt with threat, so I can undo its effects when I stop - SightingInfo *m_partitionLastValue; ///< Where and for whom I last delt with value, so I can undo its effects when I stop + SightingInfo *m_partitionLastThreat; ///< Where and for whom I last dealt with threat, so I can undo its effects when I stop + SightingInfo *m_partitionLastValue; ///< Where and for whom I last dealt with value, so I can undo its effects when I stop Real m_visionRange; ///< looking range Real m_shroudClearingRange; ///< looking range for shroud ONLY diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index 9fd6bb4db26..365af131ed7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1302,7 +1302,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot friend void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); friend void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); - void processPendingUndoShroudRevealQueue(Bool considerTimestamp = TRUE); ///< keep popping and processing untill you get to one that is in the future + void processPendingUndoShroudRevealQueue(Bool considerTimestamp = TRUE); ///< keep popping and processing until you get to one that is in the future void resetPendingUndoShroudRevealQueue(); ///< Just delete everything in the queue without doing anything with them public: @@ -1340,7 +1340,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot PartitionCell *getCellAt(Int x, Int y); const PartitionCell *getCellAt(Int x, Int y) const; - /// A convenience funtion to reveal shroud at some location + /// A convenience function to reveal shroud at some location // Queueing does not give you control of the timestamp to enforce the queue. I own the delay, you don't. void doShroudReveal( Real centerX, Real centerY, Real radius, PlayerMaskType playerMask); void undoShroudReveal( Real centerX, Real centerY, Real radius, PlayerMaskType playerMask); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h index 3576c0c03e7..a50ec7f9025 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h @@ -24,7 +24,7 @@ // FILE: RankInfo.h //////////////////////////////////////////////////////////////////////////////// // Author: Steven Johnson, Sep 2002 -// Desc: RankInfo descriptoins +// Desc: RankInfo descriptions /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h index e9b0556dc75..ac05f72c48f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h @@ -229,7 +229,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class. CAMERA_MOD_SET_FINAL_PITCH, ///< Sets the final pitch for a camera movement CAMERA_MOD_FREEZE_ANGLE, ///< Freeze camera angle during a camera movement. CAMERA_MOD_SET_FINAL_SPEED_MULTIPLIER,///< Sets the final time multiplier for a camera movement. - CAMERA_MOD_SET_ROLLING_AVERAGE, ///< Sets the number of frames to average changes (angle, positoin) to smooth out a camera movement. + CAMERA_MOD_SET_ROLLING_AVERAGE, ///< Sets the number of frames to average changes (angle, position) to smooth out a camera movement. CAMERA_MOD_FINAL_LOOK_TOWARD, ///< Sets the look toward point for the end of a camera movement. CAMERA_MOD_LOOK_TOWARD, ///< Sets the look toward point during a camera movement. TEAM_ATTACK_TEAM, ///< Tell team to attack other team @@ -509,7 +509,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class. COMMANDBAR_REMOVE_BUTTON_OBJECTTYPE, ///< Remove a button from a command bar for an objecttype COMMANDBAR_ADD_BUTTON_OBJECTTYPE_SLOT, ///< Add a button to the command bar for an objecttype, in a specific slot UNIT_SPAWN_NAMED_LOCATION_ORIENTATION, ///< Create a named unit at the specified location, altitude, and orientation - PLAYER_AFFECT_RECEIVING_EXPERIENCE, ///< Adjust whether or not a player is receieving experience for kills + PLAYER_AFFECT_RECEIVING_EXPERIENCE, ///< Adjust whether or not a player is receiving experience for kills PLAYER_EXCLUDE_FROM_SCORE_SCREEN, ///< This player should be listed in the score screen. Should only be used in campaign games. TEAM_GUARD_SUPPLY_CENTER, ///< Have an ai team guard the nearest available supply center.. ENABLE_SCORING, ///< Turn on scoring of kills, units destroyed, etc. @@ -848,7 +848,7 @@ extern const char* const TheObjectFlagsNames[]; ConditionTemplates created in ScriptEngine::init. // SPECIAL NOTE ABOUT Skirmish Scripts: Please note that ALL Skirmish conditions should first pass a pSkirmishPlayerParm to -// prevet the necessity of having to write additional scripts for other players / skirmish types later. +// prevent the necessity of having to write additional scripts for other players / skirmish types later. */ class Condition : public MemoryPoolObject // This is the conditional class. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h index f68427d7503..d71048ebfce 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h @@ -265,7 +265,7 @@ class TerrainLogic : public Snapshot, /// Return the closest waypoint on the labeled path virtual Waypoint *getClosestWaypointOnPath( const Coord3D *pos, AsciiString label ); - /// Return true if the waypoint path containint pWay is labeled with the label. + /// Return true if the waypoint path containing pWay is labeled with the label. virtual Bool isPurposeOfPath( Waypoint *pWay, AsciiString label ); /// Return the trigger area with the given name @@ -356,7 +356,7 @@ class TerrainLogic : public Snapshot, static WaterHandle m_gridWaterHandle; ///< water handle for the grid water (we only presently have one) // - // we will force a limit of MAX_DYNAMIC_WATER as the max dynamically changable water + // we will force a limit of MAX_DYNAMIC_WATER as the max dynamically changeable water // tables for a map. We could use a list, but eh, this is fine and small anyway // enum { MAX_DYNAMIC_WATER = 64 }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index da552dcfa89..c3600e1f18b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -119,7 +119,7 @@ enum WeaponAffectsMaskType CPP_11(: Int) WEAPON_DOESNT_AFFECT_AIRBORNE = 0x40, // Radius damage doesn't affect airborne units, unless they are the primary target. (used for poison fields.) }; -//#ifdef DEFINE_WEAPONAFFECTSMASK_NAMES ; Removed protection so other clases can use these strings... not sure why this was protected in the 1st place +//#ifdef DEFINE_WEAPONAFFECTSMASK_NAMES ; Removed protection so other classes can use these strings... not sure why this was protected in the 1st place static const char *const TheWeaponAffectsMaskNames[] = { "SELF", From a61aa4976acb12e7e9fdaeb7cb1e729803b70151 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 14:08:02 -0500 Subject: [PATCH 061/211] docs: Fix spelling errors in Generals/Code/GameEngine/Source comments (#2118) --- .../Code/GameEngine/Source/Common/CommandLine.cpp | 2 +- .../Code/GameEngine/Source/Common/RTS/Player.cpp | 4 ++-- .../Source/Common/RTS/ProductionPrerequisite.cpp | 4 ++-- .../GameEngine/Source/Common/RTS/SpecialPower.cpp | 2 +- .../Source/Common/System/BuildAssistant.cpp | 4 ++-- .../Source/Common/System/FunctionLexicon.cpp | 4 ++-- .../GameEngine/Source/Common/System/registry.cpp | 2 +- .../GameEngine/Source/Common/Thing/ModuleFactory.cpp | 2 +- .../Code/GameEngine/Source/Common/Thing/Thing.cpp | 2 +- .../GameEngine/Source/Common/Thing/ThingFactory.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Display.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Drawable.cpp | 4 ++-- .../Source/GameClient/GUI/ControlBar/ControlBar.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBarCommand.cpp | 4 ++-- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp | 2 +- .../GUI/ControlBar/ControlBarUnderConstruction.cpp | 2 +- .../GameClient/GUI/GUICallbacks/IMECandidate.cpp | 4 ++-- .../GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 4 ++-- .../GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp | 2 +- .../Source/GameClient/GUI/Gadget/GadgetComboBox.cpp | 4 ++-- .../Source/GameClient/GUI/Gadget/GadgetListBox.cpp | 8 ++++---- .../GameClient/GUI/Gadget/GadgetVerticalSlider.cpp | 2 +- .../GameEngine/Source/GameClient/GUI/GameWindow.cpp | 10 +++++----- .../Source/GameClient/GUI/ProcessAnimateWindow.cpp | 12 ++++++------ .../Code/GameEngine/Source/GameClient/GameClient.cpp | 2 +- .../GameEngine/Source/GameClient/Input/Mouse.cpp | 4 ++-- .../Code/GameEngine/Source/GameClient/Line2D.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 4 ++-- .../GameClient/MessageStream/SelectionXlat.cpp | 4 ++-- .../GameEngine/Source/GameClient/System/Image.cpp | 2 +- .../Source/GameClient/System/ParticleSys.cpp | 6 +++--- .../GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++---- .../GameEngine/Source/GameLogic/Map/TerrainLogic.cpp | 2 +- .../GameLogic/Object/Behavior/BridgeBehavior.cpp | 4 ++-- .../Object/Behavior/BridgeScaffoldBehavior.cpp | 2 +- .../Object/Behavior/BridgeTowerBehavior.cpp | 4 ++-- .../Object/Behavior/DumbProjectileBehavior.cpp | 2 +- .../GameLogic/Object/Behavior/MinefieldBehavior.cpp | 2 +- .../Object/Behavior/PropagandaTowerBehavior.cpp | 2 +- .../Behavior/SupplyWarehouseCripplingBehavior.cpp | 4 ++-- .../Source/GameLogic/Object/Die/DamDie.cpp | 2 +- .../Source/GameLogic/Object/PartitionManager.cpp | 6 +++--- .../Source/GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 2 +- .../GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/POWTruckAIUpdate.cpp | 4 ++-- .../Object/Update/AIUpdate/TransportAIUpdate.cpp | 6 +++--- .../GameLogic/Object/Update/BattlePlanUpdate.cpp | 2 +- .../Update/DockUpdate/RailedTransportDockUpdate.cpp | 4 ++-- .../Update/DynamicShroudClearingRangeUpdate.cpp | 2 +- .../GameLogic/Object/Update/HijackerUpdate.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- .../GameLogic/Object/Update/ProductionUpdate.cpp | 4 ++-- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 8 ++++---- .../Object/Update/StructureToppleUpdate.cpp | 2 +- .../Source/GameLogic/Object/Update/ToppleUpdate.cpp | 2 +- .../GameLogic/Object/Update/WaveGuideUpdate.cpp | 4 ++-- .../GameLogic/ScriptEngine/ScriptConditions.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogic.cpp | 2 +- 62 files changed, 105 insertions(+), 105 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp index 8b6475e3885..661caa280af 100644 --- a/Generals/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/Generals/Code/GameEngine/Source/Common/CommandLine.cpp @@ -1418,7 +1418,7 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) // and functions to handle them. Comparisons can be case-(in)sensitive, and // can check the entire string (for testing the presence of a flag) or check // just the start (for a key=val argument). The handling function can also - // look at the next argument(s), to accomodate multi-arg parameters, e.g. "-p 1234". + // look at the next argument(s), to accommodate multi-arg parameters, e.g. "-p 1234". while (arg& units ) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 8ff183cf271..864c0952318 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -307,7 +307,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl // they cannot have all of them. // - // check for requried science + // check for required science ScienceType requiredScience = specialPowerTemplate->getRequiredScience(); if( requiredScience != SCIENCE_INVALID ) { diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index fc11e4c6f5f..1249b3eed59 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1074,7 +1074,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // // we will fill out our own internal array of positions, it better be big enough to - // accomodate max tiles, if it's not lets make it bigger! + // accommodate max tiles, if it's not lets make it bigger! // if( maxTiles > m_buildPositionSize ) { @@ -1102,7 +1102,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT placementVector.z = 0.0f; //end->z - start->z; // - // get the lengh of the placement vector in the world, we'll use this to see how + // get the length of the placement vector in the world, we'll use this to see how // many objects we'll need to fill the entire line // Real placementLength = placementVector.length(); diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index da6d08e0a68..c33fd2f3c0f 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -439,7 +439,7 @@ void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) if( key == NAMEKEY_INVALID ) return nullptr; - // search ALL tables for function if the index paramater allows if + // search ALL tables for function if the index parameter allows if if( index == TABLE_ANY ) { @@ -521,7 +521,7 @@ FunctionLexicon::~FunctionLexicon( void ) } //------------------------------------------------------------------------------------------------- -/** Initialize our dictionary of funtion pointers and symbols */ +/** Initialize our dictionary of function pointers and symbols */ //------------------------------------------------------------------------------------------------- void FunctionLexicon::init( void ) { diff --git a/Generals/Code/GameEngine/Source/Common/System/registry.cpp b/Generals/Code/GameEngine/Source/Common/System/registry.cpp index 0fae0ca8a5b..d43fd9830d4 100644 --- a/Generals/Code/GameEngine/Source/Common/System/registry.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/registry.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// // Registry.cpp -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 00dc58d63a8..55adfa463a9 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -25,7 +25,7 @@ // FILE: ModuleFactory.cpp //////////////////////////////////////////////////////////////////////// // Author: Colin Day, September 2001 // Desc: TheModuleFactory is where we actually instance modules for objects -// and drawbles. Those modules are things such as an UpdateModule +// and drawables. Those modules are things such as an UpdateModule // or DamageModule or DrawModule etc. // // TheModuleFactory will contain a list of ModuleTemplates, when we diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp index 0cf72ba4024..832498b557d 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -373,7 +373,7 @@ void Thing::convertBonePosToWorldPos(const Coord3D* bonePos, const Matrix3D* bon void Thing::transformPoint( const Coord3D *in, Coord3D *out ) { - // santiy + // sanity if( in == nullptr || out == nullptr ) return; diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 7022922ecae..af2eb25ac37 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -77,7 +77,7 @@ void ThingFactory::freeDatabase( void ) } //------------------------------------------------------------------------------------------------- -/** add the thing template passed in, into the databse */ +/** add the thing template passed in, into the database */ //------------------------------------------------------------------------------------------------- void ThingFactory::addTemplate( ThingTemplate *tmplate ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/Display.cpp b/Generals/Code/GameEngine/Source/GameClient/Display.cpp index 0ab2cbf5f0e..f1b99f48d51 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Display.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Display.cpp @@ -220,7 +220,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_currentlyPlayingMovie = movieName; m_movieHoldTime = minMovieLength; m_copyrightHoldTime = minCopyrightLength; - m_elapsedMovieTime = timeGetTime(); // we're using time get time becuase legal want's actual "Seconds" + m_elapsedMovieTime = timeGetTime(); // we're using time get time because legal wants actual "Seconds" m_videoBuffer = createVideoBuffer(); if ( m_videoBuffer == nullptr || diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index ea575b21fea..dc320228110 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -2097,7 +2097,7 @@ void Drawable::setStealthLook(StealthLookType look) Object *obj = getObject(); if( obj ) { - //Try to get the stealthupdate module and see if the opacity value is overriden. + //Try to get the stealthupdate module and see if the opacity value is overridden. StealthUpdate* stealth = obj->getStealth(); if( stealth ) { @@ -3338,7 +3338,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) return; // - // only draw health for selected drawbles and drawables that have been moused over + // only draw health for selected drawables and drawables that have been moused over // by the cursor // if( TheGlobalData->m_showObjectHealth && diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index b03d47f7774..0e5a5952e08 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1036,7 +1036,7 @@ void ControlBar::init( void ) // post process step after loading the command buttons and command sets postProcessCommands(); - // Init the scheme manager, this will call it's won INI init funciton. + // Init the scheme manager, this will call its own INI init function. m_controlBarSchemeManager = NEW ControlBarSchemeManager; m_controlBarSchemeManager->init(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index b64194a48cc..072acdaa4c6 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -1094,7 +1094,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com CanMakeType makeType = TheBuildAssistant->canMakeUnit( obj, command->getThingTemplate() ); if( makeType == CANMAKE_MAXED_OUT_FOR_PLAYER || makeType == CANMAKE_PARKING_PLACES_FULL ) { - //Disable the button if the player has a max amount of these units in build queue or existance. + //Disable the button if the player has a max amount of these units in build queue or existence. return COMMAND_RESTRICTED; } if( makeType == CANMAKE_NO_MONEY ) @@ -1181,7 +1181,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com /// @todo ml -- and note: that the "now-1" below causes zero-clip-reload weapons to never be ready, so I added this /// If you make changes to this code, make sure that the DragonTank's firewall weapon can be retargeted while active, /// that is, while the tank is squirting out flames all over the floor, you can click the firewall button (or "F"), -/// and re-target the firewall without having to stop or move in-betwen.. Thanks for reading +/// and re-target the firewall without having to stop or move in-between.. Thanks for reading || (w->getPossibleNextShotFrame()==now-1) ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index 0da5399cd58..a4cdd9a0b0f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -304,7 +304,7 @@ void ControlBar::updateContextMultiSelect( void ) // zero the array that counts how many objects can do each command memset( objectsThatCanDoCommand, 0, sizeof( objectsThatCanDoCommand ) ); - // santiy + // sanity DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, ("updateContextMultiSelect: TheInGameUI only has '%d' things selected", TheInGameUI->getSelectCount()) ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index 406550caaa4..ef464c35c0f 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -53,7 +53,7 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce static UnsignedInt barID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerProgressBar" ); GameWindow *barWindow = TheWindowManager->winGetWindowFromId( nullptr, barID ); - // santiy + // sanity DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); Int minutes = totalSeconds / 60; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index d26d08b98bc..f9f44930e3e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -51,7 +51,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); - // santiy + // sanity DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); // format the message diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index a97474b56c3..513c0292dbb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -54,7 +54,7 @@ WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt ms } //------------------------------------------------------------------------------------------------- -/** System callback for the IME Candidate widnow */ +/** System callback for the IME Candidate window */ //------------------------------------------------------------------------------------------------- WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) @@ -191,7 +191,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) selected = selected - first; UnicodeString number; - // calulate the widest number text + // calculate the widest number text Int width; Dstring->setText(L"00:"); width = Dstring->getWidth(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index 1fb425020a2..4ac876c7a8b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -281,7 +281,7 @@ void doKeyDown(EntryData *e, UnicodeString mod ) e->text->setText( mod ); e->sText->setText( mod ); e->charPos = e->text->getTextLength(); - // try reseting all mods first + // try resetting all mods first setKeyDown( shift, false ); setKeyDown( alt, false ); setKeyDown( ctrl, false ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index 9a17f1d31cc..a5c12513511 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -757,7 +757,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, closeSaveMenu( window ); // - // given the context of this menu figure out which type of save game we're acutally + // given the context of this menu figure out which type of save game we're actually // saving right now. As it turns out, when this menu is used in the save only // mode it means that the save is a mission save between maps because you can only // save the game between maps and can of course not load one @@ -820,7 +820,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, AvailableGameInfo *selectedGameInfo = getSelectedSaveFileInfo( listboxGames ); // - // given the context of this menu figure out which type of save game we're acutally + // given the context of this menu figure out which type of save game we're actually // saving right now. As it turns out, when this menu is used in the save only // mode it means that the save is a mission save between maps because you can only // save the game between maps and can of course not load one diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 2acd3f48f9d..9cb4b869650 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -312,7 +312,7 @@ void ToggleQuitMenu() return; } - // if we're visable hide our quit menu + // if we're visible hide our quit menu if(isVisible && quitMenuLayout) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index aef04f9e1ec..7913b610757 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -1052,7 +1052,7 @@ void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) if( comboBox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_SELECTION, 0, (WindowMsgData)selectedIndex ); } @@ -1067,7 +1067,7 @@ void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool if( comboBox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_SELECTION, selectedIndex, dontHide ); } // GadgetComboBoxSetItemData ================================================== diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 8c4e2e252da..5f02cad7021 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -2331,7 +2331,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) top = title ? (fontHeight + 1):0; bottom = title ? (height - (fontHeight + 1)):height; - // intialize instData + // initialize instData winInstData.init(); // size of button @@ -2385,7 +2385,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) sliderButtonWidth = buttonWidth;//GADGET_SIZE; sliderButtonHeight = GADGET_SIZE; - // intialize instData + // initialize instData winInstData.init(); winInstData.m_style = GWS_VERT_SLIDER; winInstData.m_owner = listbox; @@ -2394,7 +2394,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - // intialize sData + // initialize sData memset( &sData, 0, sizeof(SliderData) ); // Create Slider @@ -2626,7 +2626,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) if( listbox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index a87f92865a7..f60c27e6cfd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -67,7 +67,7 @@ // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -// GadgetVerticlaSliderInput ================================================== +// GadgetVerticalSliderInput ================================================== /** Handle input for vertical slider */ //============================================================================= WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt msg, diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 8e63e3a99b4..11b5174d18d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -531,7 +531,7 @@ Int GameWindow::winSetPosition( Int x, Int y ) } // WinGetPosition ============================================================= -/** Get the window's postion */ +/** Get the window's position */ //============================================================================= Int GameWindow::winGetPosition( Int *x, Int *y ) { @@ -548,7 +548,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) } // WinSetCursorPosition ============================================================= -/** Set the window's cursor postion */ +/** Set the window's cursor position */ //============================================================================= Int GameWindow::winSetCursorPosition( Int x, Int y ) { @@ -560,7 +560,7 @@ Int GameWindow::winSetCursorPosition( Int x, Int y ) } // WinGetCursorPosition ============================================================= -/** Get the window's cursor postion */ +/** Get the window's cursor position */ //============================================================================= Int GameWindow::winGetCursorPosition( Int *x, Int *y ) { @@ -579,7 +579,7 @@ Int GameWindow::winGetCursorPosition( Int *x, Int *y ) } // GameWindow::winGetScreenPosition =========================================== -/** Get the window's postion in screen coordinates */ +/** Get the window's position in screen coordinates */ //============================================================================= Int GameWindow::winGetScreenPosition( Int *x, Int *y ) { @@ -1193,7 +1193,7 @@ GameWindow *GameWindow::winGetParent( void ) } // GameWindow::winIsChild ===================================================== -/** Determins if a window is a child/grand-child of a parent */ +/** Determines if a window is a child/grand-child of a parent */ //============================================================================= Bool GameWindow::winIsChild( GameWindow *child ) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 1f5b7db3a49..e247cae758d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -77,7 +77,7 @@ ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { m_maxVel.x = -40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -263,7 +263,7 @@ ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { m_maxVel.x = 40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -441,7 +441,7 @@ ProcessAnimateWindowSlideFromTop::ProcessAnimateWindowSlideFromTop( void ) { m_maxVel.y = 40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -620,7 +620,7 @@ ProcessAnimateWindowSlideFromBottom::ProcessAnimateWindowSlideFromBottom( void ) { m_maxVel.y = -40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -1134,7 +1134,7 @@ ProcessAnimateWindowSlideFromTopFast::ProcessAnimateWindowSlideFromTopFast( void { m_maxVel.y = 60.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 40; // when widnows get this close to their resting + m_slowDownThreshold = 40; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 4.0f - m_slowDownRatio; // how fast the windows speed up @@ -1317,7 +1317,7 @@ ProcessAnimateWindowSlideFromRightFast::ProcessAnimateWindowSlideFromRightFast( { m_maxVel.x = -80.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 60; // when widnows get this close to their resting + m_slowDownThreshold = 60; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.77f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 3.0f - m_slowDownRatio; // how fast the windows speed up diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 517d674579f..b317344c680 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -275,7 +275,7 @@ void GameClient::init( void ) { // - // NOTE: Make sure m_translators[] is large enough to accomodate all the translators you + // NOTE: Make sure m_translators[] is large enough to accommodate all the translators you // are loading here. See MAX_CLIENT_TRANSLATORS // diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index bed852d4387..168b0458217 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -672,7 +672,7 @@ void Mouse::update( void ) void Mouse::createStreamMessages( void ) { - // santiy + // sanity if( TheMessageStream == nullptr ) return; // no place to put messages @@ -1145,7 +1145,7 @@ void Mouse::drawTooltip( void ) return; } - /// @todo: Still need to put in display logic so it puts the tool tips in a visable position on the edge of the screen + /// @todo: Still need to put in display logic so it puts the tool tips in a visible position on the edge of the screen if( m_displayTooltip && TheDisplay && m_tooltipDisplayString && (m_tooltipDisplayString->getTextLength() > 0) && !m_isTooltipEmpty) { Int width, xPos; diff --git a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp index 6596b16e931..30e558df9dc 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -263,7 +263,7 @@ Bool IntersectLine2D( const Coord2D *a, const Coord2D *b, return false; } -// determines whether a point lies within a rectangle. Doesnt' determine whether the shape is +// determines whether a point lies within a rectangle. Doesn't determine whether the shape is // actually a rectangle or not. Bool PointInsideRect2D(const Coord2D *bl, const Coord2D *tl, const Coord2D *br, const Coord2D *tr, const Coord2D *inputPoint) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 5bcee74c6dd..7e3e99eb2e9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -1573,7 +1573,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, { if( obj && obj->isKindOf( KINDOF_SHRUBBERY ) && !BitIsSet( command->getOptions(), ALLOW_SHRUBBERY_TARGET ) ) { - //If our object is a shrubbery, and we don't allow targetting it... then null it out. + //If our object is a shrubbery, and we don't allow targeting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. draw = nullptr; @@ -1582,7 +1582,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, if( obj && obj->isKindOf( KINDOF_MINE ) && !BitIsSet( command->getOptions(), ALLOW_MINE_TARGET ) ) { - //If our object is a mine, and we don't allow targetting it... then null it out. + //If our object is a mine, and we don't allow targeting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. draw = nullptr; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 6c26efffcbb..f6e40693456 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -69,7 +69,7 @@ static Bool TheDebugSelectionMode = false; //----------------------------------------------------------------------------- static Bool currentlyLookingForSelection( ) { - // This needs to check if we are currently targetting for special weapons fire. + // This needs to check if we are currently targeting for special weapons fire. return TheInGameUI->getGUICommand() == nullptr; } @@ -931,7 +931,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa else { //In alternate mouse mode, right click still cancels building placement. - // TheSuperHackers @tweak Stubbjax 08/08/2025 Cancelling building placement no longer deselects the builder. + // TheSuperHackers @tweak Stubbjax 08/08/2025 Canceling building placement no longer deselects the builder. if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { TheInGameUI->placeBuildAvailable(nullptr, nullptr); diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp index bc70cb3d98c..a089856fb21 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -27,7 +27,7 @@ // Desc: High level representation of images, this is currently being // written so we have a way to refer to images in the windows // GUI, this system should be replaced with something that can -// handle real image management or written to accomodate +// handle real image management or written to accommodate // all parts of the engine that need images. /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 8e78ca89c58..0307af98475 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2284,7 +2284,7 @@ void ParticleSystem::updateWindMotion( void ) case ParticleSystemInfo::WIND_MOTION_CIRCULAR: { - // give us a wind angle change if one hasn't been specifed (this plays nice with the particle editor) + // give us a wind angle change if one hasn't been specified (this plays nice with the particle editor) if( m_windAngleChange == 0.0f ) m_windAngleChange = GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); @@ -2359,7 +2359,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) if (particleToRemove->m_systemPrev) particleToRemove->m_systemPrev->m_systemNext = particleToRemove->m_systemNext; - // update head & tail if neccessary + // update head & tail if necessary if (particleToRemove == m_systemParticlesHead) m_systemParticlesHead = particleToRemove->m_systemNext; if (particleToRemove == m_systemParticlesTail) @@ -3227,7 +3227,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) if (particleToRemove->m_overallPrev) particleToRemove->m_overallPrev->m_overallNext = particleToRemove->m_overallNext; - // update head & tail if neccessary + // update head & tail if necessary if (particleToRemove == m_allParticlesHead[ priority ]) m_allParticlesHead[ priority ] = particleToRemove->m_overallNext; if (particleToRemove == m_allParticlesTail[ priority ]) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index c54bcb0829d..e37301a59b2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -2876,7 +2876,7 @@ void PathfindLayer::reset(void) } /** - * Returns true if the layer is avaialble for use. + * Returns true if the layer is available for use. */ Bool PathfindLayer::isUnused(void) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index cc580ee70f5..9d015540af3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -1657,7 +1657,7 @@ StateReturnType AIInternalMoveToState::onEnter() } // Target to stop at the end of this path. - // This value will be overriden by the FollowWaypoint ai state. + // This value will be overridden by the FollowWaypoint ai state. ai->setPathExtraDistance(0); ai->setDesiredSpeed( FAST_AS_POSSIBLE ); @@ -2364,7 +2364,7 @@ Bool AIAttackApproachTargetState::computePath() } // force minimum time between recomputation - /// @todo Unify recomputation conditions & account for obj ID so everyone doesnt compute on the same frame (MSB) + /// @todo Unify recomputation conditions & account for obj ID so everyone doesn't compute on the same frame (MSB) if (!forceRepath && TheGameLogic->getFrame() - m_approachTimestamp < MIN_RECOMPUTE_TIME) { //CRCDEBUG_LOG(("AIAttackApproachTargetState::computePath - bailing because of min time for object %d", getMachineOwner()->getID())); @@ -2774,7 +2774,7 @@ Bool AIAttackPursueTargetState::computePath() } // force minimum time between recomputation - /// @todo Unify recomputation conditions & account for obj ID so everyone doesnt compute on the same frame (MSB) + /// @todo Unify recomputation conditions & account for obj ID so everyone doesn't compute on the same frame (MSB) if (!forceRepath && TheGameLogic->getFrame() - m_approachTimestamp < MIN_RECOMPUTE_TIME) { return true; @@ -6269,7 +6269,7 @@ StateReturnType AIExitState::update() goalExitInterface->exitObjectViaDoor(obj, exitDoor); if( getMachine()->getCurrentStateID() != getID() ) - return STATE_CONTINUE;// Not sucess, because exitViaDoor has changed us to FollowPath, and if we say Success, our machine will think FollowPath succeeded + return STATE_CONTINUE;// Not success, because exitViaDoor has changed us to FollowPath, and if we say Success, our machine will think FollowPath succeeded else return STATE_SUCCESS; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index 76064d4bfb4..344c5e398b0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -2871,7 +2871,7 @@ void TerrainLogic::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - // active boundrary + // active boundary Int activeBoundary = m_activeBoundary; xfer->xferInt( &activeBoundary ); if( xfer->getXferMode() == XFER_LOAD ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 834310b9671..c43bc50134d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -435,7 +435,7 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) // // get our body info so we now how much damage percent is being done to us ... we need this - // so that we can propagate the same damage percentage amont the towers and the bridge + // so that we can propagate the same damage percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real damagePercentage = damageInfo->in.m_amount / body->getMaxHealth(); @@ -479,7 +479,7 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) // // get our body info so we now how much healing percent is being done to us ... we need this - // so that we can propagate the same healing percentage amont the towers and the bridge + // so that we can propagate the same healing percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real healingPercentage = damageInfo->in.m_amount / body->getMaxHealth(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index 43486d9c58d..6cb56636400 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -283,7 +283,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehaviorInterfaceFromObject( Object *obj ) { - // santiy + // sanity if( obj == nullptr ) return nullptr; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index 6b99c277002..4333b989add 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -99,7 +99,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // // get our body info so we now how much damage percent is being done to us ... we need this - // so that we can propagate the same damage percentage amont the towers and the bridge + // so that we can propagate the same damage percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real damagePercentage = damageInfo->in.m_amount / body->getMaxHealth(); @@ -180,7 +180,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // // get our body info so we now how much healing percent is being done to us ... we need this - // so that we can propagate the same healing percentage amont the towers and the bridge + // so that we can propagate the same healing percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real healingPercentage = damageInfo->in.m_amount / body->getMaxHealth(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 59edca33a3c..ea6937ceedb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -577,7 +577,7 @@ UpdateSleepTime DumbProjectileBehavior::update() { // No more steps to use. Would go out of bounds on vector, so have to do something. // We could allow physics to take over and make us fall, but the point of this whole task - // is to guarentee where the shell explodes. This way, it _will_ explode at the target point. + // is to guarantee where the shell explodes. This way, it _will_ explode at the target point. detonate(); return UPDATE_SLEEP_NONE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index a5c429ad1b6..8ac5358618b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -444,7 +444,7 @@ void MinefieldBehavior::onDamage( DamageInfo *damageInfo ) const MinefieldBehaviorModuleData* d = getMinefieldBehaviorModuleData(); - // detonate as many times as neccessary for our virtual mine count to match our health + // detonate as many times as necessary for our virtual mine count to match our health BodyModuleInterface* body = getObject()->getBodyModule(); for (;;) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index c0fff7a12cb..5e2f3843905 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -493,7 +493,7 @@ void PropagandaTowerBehavior::doScan( void ) } - // delete the inside list we have recoreded + // delete the inside list we have recorded ObjectTracker *next; while( m_insideList ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index 5a0c0de7853..a92ab6fe734 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -98,7 +98,7 @@ void SupplyWarehouseCripplingBehavior::onBodyDamageStateChange(const DamageInfo* // ------------------------------------------------------------------------------------------------ UpdateSleepTime SupplyWarehouseCripplingBehavior::update() { - // Supression is handled by sleeping the module, so if I am here, I know it is time to heal. + // Suppression is handled by sleeping the module, so if I am here, I know it is time to heal. const SupplyWarehouseCripplingBehaviorModuleData* md = getSupplyWarehouseCripplingBehaviorModuleData(); UnsignedInt now = TheGameLogic->getFrame(); m_nextHealingFrame = now + md->m_selfHealDelay; @@ -164,7 +164,7 @@ void SupplyWarehouseCripplingBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); - // healing supressed until frame + // healing suppressed until frame xfer->xferUnsignedInt( &m_healingSupressedUntilFrame ); // next healing frame diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp index 55d0a6e5de5..f407bdc5193 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp @@ -97,7 +97,7 @@ void DamDie::onDie( const DamageInfo *damageInfo ) for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) { - // only care aboue water waves + // only care about water waves if( obj->isKindOf( KINDOF_WAVEGUIDE ) == FALSE ) continue; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index c13a30bd27b..e9c1a12cea5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3899,7 +3899,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, static Real ringSpacing = 5.0f; //------------------------------------------------------------------------------------------------- -/** This method will attempt to find a legal postion from the center position specified, +/** This method will attempt to find a legal position from the center position specified, * at least minRadis away from it, but no more than maxRadius away. * * Return TRUE if position is found and that position is returned in 'result' @@ -4945,7 +4945,7 @@ PartitionFilterRejectBuildings::PartitionFilterRejectBuildings(const Object *o) m_self(o), m_acquireEnemies(false) { - // if I am a computer-controlled opponent, auto-aquire enemy buildings + // if I am a computer-controlled opponent, auto-acquire enemy buildings if (m_self->getControllingPlayer()->getPlayerType() == PLAYER_COMPUTER) { m_acquireEnemies = true; @@ -4979,7 +4979,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) if (relationship != ENEMIES) return false; - // if I am a computer-controlled opponent, auto-aquire enemy buildings (if we can see them!) + // if I am a computer-controlled opponent, auto-acquire enemy buildings (if we can see them!) if (m_acquireEnemies) return true; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index e8acc202c87..43b53be1bc4 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4149,7 +4149,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixActionAdjustment( MoodMatrixAction a { // Angry Mob Members (but not Nexi) are never subject to moods. In particular, // they must never, ever, ever convert a move into an attack move, or Bad Things - // will happend, since MobMemberSlavedUpdate expects a moveto to remain a moveto. + // will happen, since MobMemberSlavedUpdate expects a moveto to remain a moveto. // Mark L sez that members do not, in fact, need any mood adjustment whatsoever, // since the mood of the nexus wants to control all this anyway. Unfortunately, there // is no KINDOF_MOB_MEMBER, and we don't want to add one at the eleventh hour... diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 4484fe16fd8..f422f22de08 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -980,7 +980,7 @@ class DozerPrimaryIdleState : public State protected: UnsignedInt m_idleTooLongTimestamp; ///< when this is more than our idle too long time we try to do something about it - Int m_idlePlayerNumber; ///< Remeber what list we were added to. + Int m_idlePlayerNumber; ///< Remember what list we were added to. Bool m_isMarkedAsIdle; }; EMPTY_DTOR(DozerPrimaryIdleState) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 6e257287f31..5e08e1cd8a0 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1296,7 +1296,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState { // The other Jet (if any) is ready. Prepare runway transfer and takeoff. // Transfer the runway after one or two frames earliest to give the other - // Jet a chance to update as well before the runway is transfered. + // Jet a chance to update as well before the runway is transferred. if (m_waitedForTaxiID == INVALID_ID) { // Do not wait for any other Jet from now on. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index c57039d408a..9a4a382d8ef 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -229,7 +229,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) } - // when leaving the collecting target state, we need to do some bookeeping + // when leaving the collecting target state, we need to do some bookkeeping if( oldTask == POW_TRUCK_TASK_COLLECTING_TARGET ) { @@ -479,7 +479,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) if( targetAI->isIdle() ) { - // are we close enought to tell them to start moving to us + // are we close enough to tell them to start moving to us Real distSq = pow( us->getGeometryInfo().getBoundingSphereRadius() * 2.0f, 2 ); if( ThePartitionManager->getDistanceSquared( us, target, FROM_CENTER_2D ) <= distSq ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index 1fffd9bf8e1..133b4e880a5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -65,7 +65,7 @@ void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); @@ -109,7 +109,7 @@ void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsTo if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); @@ -153,7 +153,7 @@ void TransportAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsT if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index 7d3d6f72ad7..0bc8f1ea66b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -897,7 +897,7 @@ void BattlePlanUpdate::xfer( Xfer *xfer ) // next ready frame xfer->xferUnsignedInt( &m_nextReadyFrame ); - // don't need to save this interface, it's retrived on object creation + // don't need to save this interface, it's retrieved on object creation // SpecialPowerModuleInterface *m_specialPowerModule; // invalid settings diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index ad8def5579d..74f13e1c490 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -287,7 +287,7 @@ void RailedTransportDockUpdate::doPullInDocking( void ) // // set the model condition for the object as "moving" even though it really // isn't in the traditional sense, but we don't want them to scoot slide into - // the transport and look wierd + // the transport and look weird // docker->setModelConditionState( MODELCONDITION_MOVING ); @@ -377,7 +377,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) // // set the model condition for the object as "moving" even though it really // isn't in the traditional sense, but we don't want them to scoot slide into - // the transport and look wierd + // the transport and look weird // unloader->setModelConditionState( MODELCONDITION_MOVING ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index 4405b72fcf6..b76885713e3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -264,7 +264,7 @@ UpdateSleepTime DynamicShroudClearingRangeUpdate::update( void ) } if ( m_stateCountDown > 0 ) m_stateCountDown --;// it is important that this gets called every frame without sleeping - //beacuse it handles animation and may need to respond to changing vision range from scripts & stuff + //because it handles animation and may need to respond to changing vision range from scripts & stuff if( m_changeIntervalCountdown > 0 ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index d5e506481fb..d11987be535 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -254,7 +254,7 @@ void HijackerUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); - // set the target object, this will also tie up teh m_ejectPilotDMI pointer + // set the target object, this will also tie up the m_ejectPilotDMI pointer Object *obj = TheGameLogic->findObjectByID( m_targetID ); setTargetObject( obj ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index f161a6046bc..044d2ceeb3e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -1316,7 +1316,7 @@ static Bool perpsLogicallyEqual( Real perpOne, Real perpTwo ) //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::checkForOverlapCollision(Object *other) { - //This is the most Supreme Truth... that unless I am moving right now, I may not crush anyhing! + //This is the most Supreme Truth... that unless I am moving right now, I may not crush anything! if ( isVerySmall3D( *getVelocity() ) ) return false; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 8a1d6d75618..131ca05f773 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -301,7 +301,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) // allocate a new production entry ProductionEntry *production = newInstance(ProductionEntry); - // assing production entry data + // assign production entry data production->m_type = PRODUCTION_UPGRADE; production->m_upgradeToResearch = upgrade; production->m_productionID = PRODUCTIONID_INVALID; // not needed for upgrades, you can only have one of @@ -441,7 +441,7 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio } } - // assing production entry data + // assign production entry data production->m_type = PRODUCTION_UNIT; production->m_objectToProduce = unitType; production->m_productionID = productionID; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index a5357afb8c9..904df0b1937 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -104,7 +104,7 @@ that has every option will do the following in order: 2 -- UNPACK: If I need to unpack before I can prepare, then do so now (this uses the model condition unpack). 3 -- PREPARE: If I need to perform a task for a period of time before I can trigger my special - ability, then do so now. A good example is aiming with a targetting laser for a few + ability, then do so now. A good example is aiming with a targeting laser for a few seconds before firing your special weapon. 4 -- TRIGGER: Once preparation is complete, fire your special ability now. 5 -- PACK: If I need to pack after finishing my attack, do so now. @@ -1146,7 +1146,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() Object *object = getObject(); //Award experience to units for triggering the ability (optional and ini specified). - //NOTE: Be award of persistant abilities that call trigger over and over again! + //NOTE: Be aware of persistent abilities that call trigger over and over again! if( data->m_awardXPForTriggering ) { ExperienceTracker *xpTracker = object->getExperienceTracker(); @@ -1397,7 +1397,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() update->detonate(); okToLoseStealth = FALSE; //Note: while the objects are detonating, they will still exist in the game. - //Our update will be responsible for validating their existance and removing them.. + //Our update will be responsible for validating their existence and removing them.. //in case either the enemy player cleans one up, or after it's gone. } } @@ -1784,7 +1784,7 @@ void SpecialAbilityUpdate::endPreparation() // Based on the special that we just finished preparing (either by failure or success), // do we want to keep the "special objects" created? Some specials will -- others won't. - // Note that persistant specials will not call this until preparation is complete (not + // Note that persistent specials will not call this until preparation is complete (not // recycling). const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index ea7664dcc14..a14b66ce6d3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -495,7 +495,7 @@ void StructureToppleUpdate::doToppleDelayBurstFX() // got the bone position... sys->setPosition(&pos); - // Attatch it to the object... + // Attach it to the object... sys->attachToDrawable(drawable); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index 5db9614f8f4..2e03babefb5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -430,7 +430,7 @@ void ToppleUpdate::xfer( Xfer *xfer ) // topple state xfer->xferUser( &m_toppleState, sizeof( ToppleState ) ); - // angluar accumulation + // angular accumulation xfer->xferReal( &m_angularAccumulation ); // angle delta X diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index 027fb33bb40..42a38015d0e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -504,7 +504,7 @@ void WaveGuideUpdate::doShoreEffects( void ) // if( underWater == TRUE && i != 0 ) { - Coord3D *prevPoint = &effectPoints[ i - 1 ]; // the prev point is actuall on the water so we'll use it + Coord3D *prevPoint = &effectPoints[ i - 1 ]; // the prev point is actually on the water so we'll use it particleSystem = TheParticleSystemManager->createParticleSystem( right ); if( particleSystem ) @@ -715,7 +715,7 @@ void WaveGuideUpdate::doDamage( void ) z.z = 1.0f; // - // angle is rotated, becuase we computed from 'from' and 'to' points of + // angle is rotated, because we computed from 'from' and 'to' points of // the bridge going *across* the valley, not pointing *down* it // u.x = Cos( angle + modData->m_bridgeParticleAngleFudge ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 7a7fd6cd797..a7a90727b6a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -344,7 +344,7 @@ Bool ScriptConditions::evaluateNamedUnitTotallyDead(Parameter *pUnitParm) } if (TheScriptEngine->didUnitExist(pUnitParm->getString())) { - // Did exist, now it doesnt. So it is really, really dead. + // Did exist, now it doesn't. So it is really, really dead. return true; // totally killed } return false; // Non existent unit is not dead. diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 2573c096aa4..855d0942706 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -863,7 +863,7 @@ static void populateRandomStartPosition( GameInfo *game ) else { // We're the first real spot. Pick randomly. - // This while loop shouldn't be neccessary, since we're first. Why not, though? + // This while loop shouldn't be necessary, since we're first. Why not, though? while (posIdx == -1) { posIdx = GameLogicRandomValue(0, numPlayers-1); From 68192c0e685afdc1f2ee890f6190ea854128d875 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 14:08:31 -0500 Subject: [PATCH 062/211] docs: Fix spelling errors in GeneralsMD/Code/GameEngine/Source/GameLogic comments (#2121) --- .../Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp | 4 ++-- .../GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 8 ++++---- .../Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 12 ++++++------ .../GameEngine/Source/GameLogic/Map/SidesList.cpp | 2 +- .../GameEngine/Source/GameLogic/Map/TerrainLogic.cpp | 6 +++--- .../GameLogic/Object/Behavior/BehaviorModule.cpp | 2 +- .../GameLogic/Object/Behavior/BridgeBehavior.cpp | 6 +++--- .../Object/Behavior/BridgeScaffoldBehavior.cpp | 4 ++-- .../Object/Behavior/BridgeTowerBehavior.cpp | 4 ++-- .../Object/Behavior/CountermeasuresBehavior.cpp | 2 +- .../Object/Behavior/DumbProjectileBehavior.cpp | 2 +- .../GameLogic/Object/Behavior/FlightDeckBehavior.cpp | 2 +- .../GameLogic/Object/Behavior/MinefieldBehavior.cpp | 2 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 2 +- .../GameLogic/Object/Behavior/PrisonBehavior.cpp | 2 +- .../Object/Behavior/PropagandaTowerBehavior.cpp | 2 +- .../GameLogic/Object/Behavior/SlowDeathBehavior.cpp | 2 +- .../Behavior/SupplyWarehouseCripplingBehavior.cpp | 4 ++-- .../GameLogic/Object/Collide/CollideModule.cpp | 2 +- .../GameLogic/Object/Contain/GarrisonContain.cpp | 6 +++--- .../GameLogic/Object/Contain/OverlordContain.cpp | 6 +++--- .../GameLogic/Object/Damage/TransitionDamageFX.cpp | 4 ++-- .../Source/GameLogic/Object/Die/DamDie.cpp | 2 +- .../Source/GameLogic/Object/ObjectCreationList.cpp | 4 ++-- .../Source/GameLogic/Object/PartitionManager.cpp | 6 +++--- .../Object/SpecialPower/SpecialPowerModule.cpp | 2 +- .../Source/GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../Update/AIUpdate/AssaultTransportAIUpdate.cpp | 4 ++-- .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 6 +++--- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 12 ++++++------ .../GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp | 2 +- .../Object/Update/AIUpdate/POWTruckAIUpdate.cpp | 8 ++++---- .../Object/Update/AIUpdate/TransportAIUpdate.cpp | 6 +++--- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 4 ++-- .../Object/Update/AssistedTargetingUpdate.cpp | 2 +- .../GameLogic/Object/Update/BattlePlanUpdate.cpp | 2 +- .../Object/Update/DockUpdate/DockUpdate.cpp | 4 ++-- .../Update/DockUpdate/RailedTransportDockUpdate.cpp | 4 ++-- .../Update/DockUpdate/SupplyCenterDockUpdate.cpp | 2 +- .../Update/DynamicShroudClearingRangeUpdate.cpp | 2 +- .../GameLogic/Object/Update/FireWeaponUpdate.cpp | 2 +- .../Object/Update/HelicopterSlowDeathUpdate.cpp | 4 ++-- .../GameLogic/Object/Update/HijackerUpdate.cpp | 6 +++--- .../Source/GameLogic/Object/Update/OCLUpdate.cpp | 6 +++--- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 6 +++--- .../DefaultProductionExitUpdate.cpp | 2 +- .../QueueProductionExitUpdate.cpp | 2 +- .../SpawnPointProductionExitUpdate.cpp | 2 +- .../SupplyCenterProductionExitUpdate.cpp | 4 ++-- .../GameLogic/Object/Update/ProductionUpdate.cpp | 10 +++++----- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 12 ++++++------ .../Object/Update/SpecialPowerUpdateModule.cpp | 2 +- .../Object/Update/SpectreGunshipDeploymentUpdate.cpp | 2 +- .../GameLogic/Object/Update/SpectreGunshipUpdate.cpp | 2 +- .../Source/GameLogic/Object/Update/StealthUpdate.cpp | 2 +- .../Object/Update/StructureToppleUpdate.cpp | 2 +- .../Source/GameLogic/Object/Update/ToppleUpdate.cpp | 2 +- .../GameLogic/Object/Update/WaveGuideUpdate.cpp | 12 ++++++------ .../GameEngine/Source/GameLogic/Object/Weapon.cpp | 10 +++++----- .../GameEngine/Source/GameLogic/Object/WeaponSet.cpp | 4 ++-- .../Source/GameLogic/ScriptEngine/ScriptActions.cpp | 4 ++-- .../GameLogic/ScriptEngine/ScriptConditions.cpp | 4 ++-- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 6 +++--- 64 files changed, 135 insertions(+), 135 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index 2f50b6ebbec..8b69a9faa8c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -834,7 +834,7 @@ Bool AIGroup::friend_moveInfantryToPos( const Coord3D *pos, CommandSourceType cm Object *theUnit; if (useEndVector) { - // resort unsing the end vector. + // resort using the end vector. startVector = endVector; startVectorNormal = endVectorNormal; for (theUnit = iter->first(); theUnit; theUnit = iter->next()) iter2->insert(theUnit); @@ -1308,7 +1308,7 @@ Bool AIGroup::friend_moveVehicleToPos( const Coord3D *pos, CommandSourceType cmd Object *theUnit; if (useEndVector) { - // resort unsing the end vector. + // resort using the end vector. startVector = endVector; startVectorNormal = endVectorNormal; for (theUnit = iter->first(); theUnit; theUnit = iter->next()) iter2->insert(theUnit); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index de89a8b5a29..0e50e1adc5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -732,7 +732,7 @@ inline Bool isReallyClose(const Coord3D& a, const Coord3D& b) * If 'allowBacktrack' is true, the entire path is considered. * If it is false, the point computed cannot be prior to previously returned non-backtracking points on this path. * Because the path "knows" the direction of travel, it will "lead" the given position a bit - * to ensure the path is followed in the inteded direction. + * to ensure the path is followed in the intended direction. * * Note: The path cleanup does not take into account rolling terrain, so we can end up with * these situations: @@ -1570,7 +1570,7 @@ PathfindCell *PathfindCell::putOnSortedOpenList( PathfindCell *list ) // insertion sort PathfindCell *c, *lastCell = nullptr; #if RETAIL_COMPATIBLE_PATHFINDING - // TheSuperHackers @bugfix In the retail compatible pathfinding, on rare ocassions, we get stuck in an infinite loop + // TheSuperHackers @bugfix In the retail compatible pathfinding, on rare occasions, we get stuck in an infinite loop // External code should pickup on the bad behaviour and cleanup properly, but we need to explicitly break out here // The fixed pathfinding does not have this issue due to the proper cleanup of pathfindCells and their pathfindCellInfos UnsignedInt cellCount = 0; @@ -3094,7 +3094,7 @@ void PathfindLayer::reset(void) } /** - * Returns true if the layer is avaialble for use. + * Returns true if the layer is available for use. */ Bool PathfindLayer::isUnused(void) { @@ -7838,7 +7838,7 @@ Bool Pathfinder::clientSafeQuickDoesPathExistForUI( const LocomotorSet& locomoto return true; } /* Do the effective terrain zone. This feedback is for the ui, so we won't take structures into account, - beacuse if they are visible it will be obvious, and if they are stealthed they should be invisible to the + because if they are visible it will be obvious, and if they are stealthed they should be invisible to the pathing as well. jba. */ zone1 = parentCell->getZone(); zone1 = m_zoneManager.getEffectiveTerrainZone(zone1); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index c69c4217d24..e0ad3cc9d1f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -2290,7 +2290,7 @@ void AIPlayer::repairStructure(ObjectID structure) Object *structureObj = TheGameLogic->findObjectByID(structure); if (structureObj==nullptr) return; if (structureObj->getBodyModule()==nullptr) return; - // If the structure is not noticably damaged, don't bother. + // If the structure is not noticeably damaged, don't bother. BodyDamageType structureState = structureObj->getBodyModule()->getDamageState(); if (structureState==BODY_PRISTINE) { return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index ce939727b37..fee90eac22f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -1668,7 +1668,7 @@ StateReturnType AIInternalMoveToState::onEnter() } // Target to stop at the end of this path. - // This value will be overriden by the FollowWaypoint ai state. + // This value will be overridden by the FollowWaypoint ai state. ai->setPathExtraDistance(0); ai->setDesiredSpeed( FAST_AS_POSSIBLE ); @@ -2425,7 +2425,7 @@ Bool AIAttackApproachTargetState::computePath() } // force minimum time between recomputation - /// @todo Unify recomputation conditions & account for obj ID so everyone doesnt compute on the same frame (MSB) + /// @todo Unify recomputation conditions & account for obj ID so everyone doesn't compute on the same frame (MSB) if (!forceRepath && TheGameLogic->getFrame() - m_approachTimestamp < MIN_RECOMPUTE_TIME) { //CRCDEBUG_LOG(("AIAttackApproachTargetState::computePath - bailing because of min time for object %d", getMachineOwner()->getID())); @@ -2624,7 +2624,7 @@ StateReturnType AIAttackApproachTargetState::onEnter() return STATE_SUCCESS; // break out, and do the pursuit state. } } else { - // Attacking a position. For a varitey of reasons, we need to destroy any existing path or we spin. jba. [8/25/2003] + // Attacking a position. For a variety of reasons, we need to destroy any existing path or we spin. jba. [8/25/2003] ai->destroyPath(); } // If we have a turret, start aiming. @@ -2802,7 +2802,7 @@ void AIAttackApproachTargetState::onExit( StateExitType status ) ai->ignoreObstacle(nullptr); // Per JohnA, this state should not be calling ai->destroyPath, because we can have spastic users - // that click the target repeadedly. This will prevent the unit from stuttering for said spastic + // that click the target repeatedly. This will prevent the unit from stuttering for said spastic // users. // ai->destroyPath(); // urg. hacky. if we are a projectile, reset precise z-pos. @@ -2860,7 +2860,7 @@ Bool AIAttackPursueTargetState::computePath() } // force minimum time between recomputation - /// @todo Unify recomputation conditions & account for obj ID so everyone doesnt compute on the same frame (MSB) + /// @todo Unify recomputation conditions & account for obj ID so everyone doesn't compute on the same frame (MSB) if (!forceRepath && TheGameLogic->getFrame() - m_approachTimestamp < MIN_RECOMPUTE_TIME) { return true; @@ -6481,7 +6481,7 @@ StateReturnType AIExitState::update() goalExitInterface->exitObjectViaDoor(obj, exitDoor); if( getMachine()->getCurrentStateID() != getID() ) - return STATE_CONTINUE;// Not sucess, because exitViaDoor has changed us to FollowPath, and if we say Success, our machine will think FollowPath succeeded + return STATE_CONTINUE;// Not success, because exitViaDoor has changed us to FollowPath, and if we say Success, our machine will think FollowPath succeeded else return STATE_SUCCESS; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp index 9871e2707a3..3e1b879b447 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp @@ -185,7 +185,7 @@ Int SidesInfo::removeFromBuildList(BuildListInfo *pBuildList) m_pBuildList = pBuildList->getNext(); } else { position = 1; - // Not the first item, so find the preceeding list element. + // Not the first item, so find the preceding list element. BuildListInfo *pPrev = m_pBuildList; while (pPrev && (pPrev->getNext()!=pBuildList) ) { pPrev = pPrev->getNext(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index f58be0b9632..8f2050d08cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -1096,7 +1096,7 @@ void TerrainLogic::update( void ) // // because some water implementation store the height as integers, some changes // are too small to keep track of in the actual water data structures so we have to - // keep track of it outselves + // keep track of it ourselves // currentHeight += changePerFrame; m_waterToUpdate[ i ].currentHeight = currentHeight; @@ -2366,7 +2366,7 @@ void TerrainLogic::setWaterHeight( const WaterHandle *water, Real height, Real d Coord3D center; center.x = affectedRegion.lo.x + affectedRegion.width() / 2.0f; center.y = affectedRegion.lo.y + affectedRegion.height() / 2.0f; - center.z = 0.0f; // irrelavant + center.z = 0.0f; // irrelevant // the max radius to scan around us is the diagonal of the bounding region Real maxDist = sqrt( affectedRegion.width() * affectedRegion.width() + @@ -2928,7 +2928,7 @@ void TerrainLogic::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - // active boundrary + // active boundary Int activeBoundary = m_activeBoundary; xfer->xferInt( &activeBoundary ); if( xfer->getXferMode() == XFER_LOAD ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp index 6effee30f6f..1db96fe817e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BehaviorModule.cpp @@ -24,7 +24,7 @@ // FILE: BehaviorModule.cpp /////////////////////////////////////////////////////////////////////// // Author: Colin Day, September 2002 -// Desc: Implementaion for anything in the base BehaviorModule +// Desc: Implementation for anything in the base BehaviorModule /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 0d547fb8420..65c76b26281 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -435,7 +435,7 @@ void BridgeBehavior::onDamage( DamageInfo *damageInfo ) // // get our body info so we now how much damage percent is being done to us ... we need this - // so that we can propagate the same damage percentage amont the towers and the bridge + // so that we can propagate the same damage percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real damagePercentage = damageInfo->in.m_amount / body->getMaxHealth(); @@ -479,7 +479,7 @@ void BridgeBehavior::onHealing( DamageInfo *damageInfo ) // // get our body info so we now how much healing percent is being done to us ... we need this - // so that we can propagate the same healing percentage amont the towers and the bridge + // so that we can propagate the same healing percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real healingPercentage = damageInfo->in.m_amount / body->getMaxHealth(); @@ -917,7 +917,7 @@ void BridgeBehavior::handleObjectsOnBridgeOnDie( void ) for( other = iter->first(); other; other = iter->next() ) { - // ingnore some kind of objects + // ignore some kind of objects if( other->isKindOf( KINDOF_BRIDGE ) || other->isKindOf( KINDOF_BRIDGE_TOWER ) ) continue; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp index f5988cfe255..0649fd1cd48 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp @@ -231,7 +231,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) // // will this new position push us beyond our target destination, we will take the vector // from the new position to the destination and the vector from our current present position - // tot he destination and dot them togehter ... if the result is < 0 then we have will + // tot he destination and dot them together ... if the result is < 0 then we have will // overshoot the distance if we use the new position // Coord3D tooFarVector; @@ -283,7 +283,7 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void ) BridgeScaffoldBehaviorInterface *BridgeScaffoldBehavior::getBridgeScaffoldBehaviorInterfaceFromObject( Object *obj ) { - // santiy + // sanity if( obj == nullptr ) return nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp index d26f686b92a..828e75f6a4c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeTowerBehavior.cpp @@ -99,7 +99,7 @@ void BridgeTowerBehavior::onDamage( DamageInfo *damageInfo ) // // get our body info so we now how much damage percent is being done to us ... we need this - // so that we can propagate the same damage percentage amont the towers and the bridge + // so that we can propagate the same damage percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real damagePercentage = damageInfo->in.m_amount / body->getMaxHealth(); @@ -180,7 +180,7 @@ void BridgeTowerBehavior::onHealing( DamageInfo *damageInfo ) // // get our body info so we now how much healing percent is being done to us ... we need this - // so that we can propagate the same healing percentage amont the towers and the bridge + // so that we can propagate the same healing percentage amount the towers and the bridge // BodyModuleInterface *body = getObject()->getBodyModule(); Real healingPercentage = damageInfo->in.m_amount / body->getMaxHealth(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp index 01aa02cbc21..b00177b2334 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp @@ -303,7 +303,7 @@ void CountermeasuresBehavior::launchVolley() //Each flare in a volley will calculate a different vector to fly out. We have a +/- angle to //spread out equally. With only one flare, it'll come straight out the back. Two flares will //launch at the extreme positive and negative angle. Three flares will launch at extreme angles - //plus straight back. Four or more will divy it up equally. + //plus straight back. Four or more will divvy it up equally. Real currentVolley = (Real)i; Real ratio = 0.0f; if( volleySize != 1.0f ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 2753844751a..2cddeacf803 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -588,7 +588,7 @@ UpdateSleepTime DumbProjectileBehavior::update() { // No more steps to use. Would go out of bounds on vector, so have to do something. // We could allow physics to take over and make us fall, but the point of this whole task - // is to guarentee where the shell explodes. This way, it _will_ explode at the target point. + // is to guarantee where the shell explodes. This way, it _will_ explode at the target point. detonate(); return UPDATE_SLEEP_NONE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index 1ff88b7c199..59cdbe0e14f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -771,7 +771,7 @@ const std::vector* FlightDeckBehavior::getCreationLocations( ObjectID i //------------------------------------------------------------------------------------------------- Bool FlightDeckBehavior::isAbleToGiveUpParkingSpace( Object *jet ) { - //If we're airborne or non-existant, someone else can have my spot if they need it. + //If we're airborne or non-existent, someone else can have my spot if they need it. if( !jet || jet->isAirborneTarget() ) { return TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp index a87d222b7a8..ce46961c796 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp @@ -452,7 +452,7 @@ void MinefieldBehavior::onDamage( DamageInfo *damageInfo ) const MinefieldBehaviorModuleData* d = getMinefieldBehaviorModuleData(); - // detonate as many times as neccessary for our virtual mine count to match our health + // detonate as many times as necessary for our virtual mine count to match our health BodyModuleInterface* body = getObject()->getBodyModule(); for (;;) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 5f83498228e..1846360ac39 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -1020,7 +1020,7 @@ void ParkingPlaceBehavior::xfer( Xfer *xfer ) } - // runways cound and info + // runways could and info UnsignedByte runwaysCount = m_runways.size(); xfer->xferUnsignedByte( &runwaysCount ); if( xfer->getXferMode() == XFER_SAVE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp index 1e305e95687..279d0a4d854 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PrisonBehavior.cpp @@ -57,7 +57,7 @@ class PrisonVisual : public MemoryPoolObject public: PrisonVisual( void ); - // virtual destructor prototype provied by memory pool object + // virtual destructor prototype provided by memory pool object ObjectID m_objectID; ///< object that is contained DrawableID m_drawableID; ///< associated visual prisoner drawable diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 0b0672aa9df..efba7fd0a1d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -538,7 +538,7 @@ void PropagandaTowerBehavior::doScan( void ) } - // delete the inside list we have recoreded + // delete the inside list we have recorded ObjectTracker *next; while( m_insideList ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 6fe6ad02dac..9e0058ec887 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -176,7 +176,7 @@ SlowDeathBehavior::~SlowDeathBehavior( void ) Int SlowDeathBehavior::getProbabilityModifier( const DamageInfo *damageInfo ) const { // Calculating how far past dead we were allows us to pick more spectacular deaths when - // severly killed, and more sedate ones when only slightly killed. + // severely killed, and more sedate ones when only slightly killed. // eg ( 200 hp max, had 10 left, took 50 damage, 40 overkill, (40/200) * 100 = 20 overkill %) Int overkillDamage = damageInfo->out.m_actualDamageDealt - damageInfo->out.m_actualDamageClipped; Real overkillPercent = (float)overkillDamage / (float)getObject()->getBodyModule()->getMaxHealth(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp index 09dcb1b9593..33913d94a46 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SupplyWarehouseCripplingBehavior.cpp @@ -98,7 +98,7 @@ void SupplyWarehouseCripplingBehavior::onBodyDamageStateChange(const DamageInfo* // ------------------------------------------------------------------------------------------------ UpdateSleepTime SupplyWarehouseCripplingBehavior::update() { - // Supression is handled by sleeping the module, so if I am here, I know it is time to heal. + // Suppression is handled by sleeping the module, so if I am here, I know it is time to heal. const SupplyWarehouseCripplingBehaviorModuleData* md = getSupplyWarehouseCripplingBehaviorModuleData(); UnsignedInt now = TheGameLogic->getFrame(); m_nextHealingFrame = now + md->m_selfHealDelay; @@ -164,7 +164,7 @@ void SupplyWarehouseCripplingBehavior::xfer( Xfer *xfer ) // extend base class UpdateModule::xfer( xfer ); - // healing supressed until frame + // healing suppressed until frame xfer->xferUnsignedInt( &m_healingSupressedUntilFrame ); // next healing frame diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp index f802c789f2f..3ff6b43eaf9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp @@ -27,7 +27,7 @@ // Desc: Collide module base class implementations /////////////////////////////////////////////////////////////////////////////////////////////////// -// INLCUDES /////////////////////////////////////////////////////////////////////////////////////// +// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" #include "Common/Xfer.h" #include "GameLogic/Module/CollideModule.h" diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index b10b2437f2a..b3a28ce7076 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -798,7 +798,7 @@ void GarrisonContain::redeployOccupants( void ) // ATTENTION... setting this false allows each redeployOccupants() call to create fresh station points, based on the new transform - // if anything wierd ever happens, like rotating buildings and such, we will need a way of transforming the points without clearing the + // if anything weird ever happens, like rotating buildings and such, we will need a way of transforming the points without clearing the // list (and thus forgetting where everyone contained was stationed)... just a handy reminder. m_stationGarrisonPointsInitialized = FALSE; @@ -1334,7 +1334,7 @@ void GarrisonContain::loadGarrisonPoints( void ) Int conditionIndex; Int count = 0; - // save the original paramters for the model condition + // save the original parameters for the model condition Drawable* draw = structure->getDrawable(); const ModelConditionFlags originalFlags = draw->getModelConditionFlags(); ModelConditionFlags clearFlags; @@ -1992,7 +1992,7 @@ void GarrisonContain::loadStationGarrisonPoints( void ) Int conditionIndex; Int count = 0; - // save the original paramters for the model condition + // save the original parameters for the model condition Drawable* draw = structure->getDrawable(); const ModelConditionFlags originalFlags = draw->getModelConditionFlags(); ModelConditionFlags clearFlags; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index b099f2b884c..19afe47a88b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -160,7 +160,7 @@ void OverlordContain::onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState) ///< state change callback { - // I can't use any convienience functions, as they will all get routed to the bunker I may carry. + // I can't use any convenience functions, as they will all get routed to the bunker I may carry. // I want just me. // Oh, and I don't want this function trying to do death. That is more complicated and will be handled // on my death. @@ -175,7 +175,7 @@ void OverlordContain::onBodyDamageStateChange( const DamageInfo* damageInfo, //------------------------------------------------------------------------------------------------- ContainModuleInterface *OverlordContain::getRedirectedContain() const { - // Naturally, I can not use a redirectible convienience function + // Naturally, I can not use a redirectible convenience function // to answer if I am redirecting yet. // If I am empty, say no. @@ -404,7 +404,7 @@ void OverlordContain::onContaining( Object *obj, Bool wasSelected ) //------------------------------------------------------------------------------------------------- void OverlordContain::killAllContained( void ) { - // This is a game call meant to clear actual passengers. We don't want it to kill our turret. That'd be wierd. + // This is a game call meant to clear actual passengers. We don't want it to kill our turret. That'd be weird. if( getRedirectedContain() ) { getRedirectedContain()->killAllContained(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 973265963db..43251f8ef3e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -396,13 +396,13 @@ void TransitionDamageFX::onBodyDamageStateChange( const DamageInfo* damageInfo, if( pSystem ) { - // get the what is the position we're going to playe the effect at + // get the what is the position we're going to played the effect at pos = getLocalEffectPos( &modData->m_particleSystem[ newState ][ i ].locInfo, draw ); // // set position on system given any bone position provided, the bone position is // local to the object and that's what we want for the particle system ... the - // transormation into world space using the object position is taken care of in + // transformation into world space using the object position is taken care of in // the particle system attachToObject method // pSystem->setPosition( &pos ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp index e01942aa8f5..a2194b00761 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/DamDie.cpp @@ -97,7 +97,7 @@ void DamDie::onDie( const DamageInfo *damageInfo ) for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() ) { - // only care aboue water waves + // only care about water waves if( obj->isKindOf( KINDOF_WAVEGUIDE ) == FALSE ) continue; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index a61e871853e..f2052eed8c6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -188,7 +188,7 @@ class AttackNugget : public ObjectCreationNugget } // Star trekkin, across the universe. - // Boldly goin forward now, cause we can't find reverse! + // Boldly going forward now, cause we can't find reverse! // 1:30 left on the clock, Demo looming, should I de-const all of OCL since this one effect needs the // Primary to help make the objects? Should I rewrite superweapons to completely subsume them @@ -1475,7 +1475,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget Int m_objectCount; // how many objects will there be? AudioEventRTS m_bounceSound; Bool m_requiresLivePlayer; - Bool m_containInsideSourceObject; ///< The created stuff will be added to the Conatin module of the SourceObject + Bool m_containInsideSourceObject; ///< The created stuff will be added to the Contain module of the SourceObject Bool m_preserveLayer; Bool m_nameAreObjects; Bool m_okToChangeModelColor; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 36a8adfa1d3..6fad4be7eaf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -3909,7 +3909,7 @@ Bool PartitionManager::tryPosition( const Coord3D *center, static Real ringSpacing = 5.0f; //------------------------------------------------------------------------------------------------- -/** This method will attempt to find a legal postion from the center position specified, +/** This method will attempt to find a legal position from the center position specified, * at least minRadis away from it, but no more than maxRadius away. * * Return TRUE if position is found and that position is returned in 'result' @@ -4955,7 +4955,7 @@ PartitionFilterRejectBuildings::PartitionFilterRejectBuildings(const Object *o) m_self(o), m_acquireEnemies(false) { - // if I am a computer-controlled opponent, auto-aquire enemy buildings + // if I am a computer-controlled opponent, auto-acquire enemy buildings if (m_self->getControllingPlayer()->getPlayerType() == PLAYER_COMPUTER) { m_acquireEnemies = true; @@ -4989,7 +4989,7 @@ Bool PartitionFilterRejectBuildings::allow( Object *other ) if (relationship != ENEMIES) return false; - // if I am a computer-controlled opponent, auto-aquire enemy buildings (if we can see them!) + // if I am a computer-controlled opponent, auto-acquire enemy buildings (if we can see them!) if (m_acquireEnemies) return true; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index b36aec53c50..02bada53472 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -112,7 +112,7 @@ SpecialPowerModule::SpecialPowerModule( Thing *thing, const ModuleData *moduleDa if( !getObject()->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) { //A sharedNSync special only startPowerRecharges when first scienced or when executed, - //Since a new modue with same SPTemplates may construct at any time. + //Since a new module with same SPTemplates may construct at any time. if ( getSpecialPowerTemplate()->isSharedNSync() == FALSE ) startPowerRecharge(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 9f085c94a4a..28784f1907e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -4378,7 +4378,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixActionAdjustment( MoodMatrixAction a { // Angry Mob Members (but not Nexi) are never subject to moods. In particular, // they must never, ever, ever convert a move into an attack move, or Bad Things - // will happend, since MobMemberSlavedUpdate expects a moveto to remain a moveto. + // will happen, since MobMemberSlavedUpdate expects a moveto to remain a moveto. // Mark L sez that members do not, in fact, need any mood adjustment whatsoever, // since the mood of the nexus wants to control all this anyway. Unfortunately, there // is no KINDOF_MOB_MEMBER, and we don't want to add one at the eleventh hour... diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp index a2993b1ea87..a16a110e2b8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/AssaultTransportAIUpdate.cpp @@ -231,7 +231,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) passenger->getAI()->setAllowedToChase( TRUE ); } - //Check if the passenger is wounded below threshhold (if so make sure we heal him before ordering him to fight!) + //Check if the passenger is wounded below threshold (if so make sure we heal him before ordering him to fight!) if( isMemberWounded( passenger ) ) { m_memberHealing[ m_currentMembers ] = TRUE; @@ -334,7 +334,7 @@ UpdateSleepTime AssaultTransportAIUpdate::update( void ) { m_framesRemaining = 45; - //Get centriod pos now that we know the number of fighting members. + //Get centroid pos now that we know the number of fighting members. Real scale = 1.0f / (Real)fightingMembers; fighterCentroidPos.scale( scale ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 256cf47bfd0..cc9792d21d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1463,7 +1463,7 @@ void ChinookAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, C if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { //if ( contain->isPassengerAllowedToFire() )//moved to below @@ -1552,7 +1552,7 @@ void ChinookAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFi if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { // if ( contain->isPassengerAllowedToFire() ) @@ -1629,7 +1629,7 @@ void ChinookAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsToF if( contain != nullptr ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 7150ffe5a5c..9b723e932ef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -97,7 +97,7 @@ class DozerActionPickActionPosState : public State protected: DozerTask m_task; ///< our task - Int m_failedAttempts; /**< counter for successive unsuccessfull attempts to pick + Int m_failedAttempts; /**< counter for successive unsuccessful attempts to pick and move to an action position */ }; @@ -582,7 +582,7 @@ StateReturnType DozerActionDoActionState::update( void ) if( player ) { - // notification for build completeion + // notification for build completion player->onStructureConstructionComplete( dozer, goalObject, dozerAI->getIsRebuild() ); player->getAcademyStats()->recordProduction( goalObject, dozer ); @@ -985,7 +985,7 @@ class DozerPrimaryIdleState : public State protected: UnsignedInt m_idleTooLongTimestamp; ///< when this is more than our idle too long time we try to do something about it - Int m_idlePlayerNumber; ///< Remeber what list we were added to. + Int m_idlePlayerNumber; ///< Remember what list we were added to. Bool m_isMarkedAsIdle; }; EMPTY_DTOR(DozerPrimaryIdleState) @@ -1073,7 +1073,7 @@ StateReturnType DozerPrimaryIdleState::update( void ) // // These are to add into the IngameUI idle worker button thingy // we don't want to add in if we're already in the list or if - // we're "Effectivly dead" + // we're "Effectively dead" // if( ai->isIdle() && !m_isMarkedAsIdle && !dozer->isEffectivelyDead()) { @@ -1458,7 +1458,7 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } m_currentTask = DOZER_TASK_INVALID; - m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value + m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelevant, but I want non-garbage value // // initialize the dozer machine to nullptr, we want to do this and create it during the update @@ -2024,7 +2024,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target ) m_task[ task ].m_targetObjectID = target->getID(); m_task[ task ].m_taskOrderFrame = TheGameLogic->getFrame(); - // reset the dozer behavior so that it can re-evluate which task to continue working on + // reset the dozer behavior so that it can re-evaluate which task to continue working on m_dozerMachine->resetToDefaultState(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 6d19079fe18..101640d9cdd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -1488,7 +1488,7 @@ class JetPauseBeforeTakeoffState : public AIFaceState { // The other Jet (if any) is ready. Prepare runway transfer and takeoff. // Transfer the runway after one or two frames earliest to give the other - // Jet a chance to update as well before the runway is transfered. + // Jet a chance to update as well before the runway is transferred. if (m_waitedForTaxiID == INVALID_ID) { // Do not wait for any other Jet from now on. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp index 80050db4914..6950ab00109 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp @@ -229,7 +229,7 @@ void POWTruckAIUpdate::setTask( POWTruckTask task, Object *taskObject ) } - // when leaving the collecting target state, we need to do some bookeeping + // when leaving the collecting target state, we need to do some bookkeeping if( oldTask == POW_TRUCK_TASK_COLLECTING_TARGET ) { @@ -479,7 +479,7 @@ void POWTruckAIUpdate::updateCollectingTarget( void ) if( targetAI->isIdle() ) { - // are we close enought to tell them to start moving to us + // are we close enough to tell them to start moving to us Real distSq = pow( us->getGeometryInfo().getBoundingSphereRadius() * 2.0f, 2 ); if( ThePartitionManager->getDistanceSquared( us, target, FROM_CENTER_2D ) <= distSq ) { @@ -593,7 +593,7 @@ void POWTruckAIUpdate::doReturnPrisoners( void ) } // ------------------------------------------------------------------------------------------------ -/** Initate a return of our empty truck back near the closest prison */ +/** Initiate a return of our empty truck back near the closest prison */ // ------------------------------------------------------------------------------------------------ void POWTruckAIUpdate::doReturnToPrison( Object *prison ) { @@ -704,7 +704,7 @@ Object *POWTruckAIUpdate::findBestTarget( void ) } // ------------------------------------------------------------------------------------------------ -/** We are chosing to pass a structure through the iterate function to unload the +/** We are choosing to pass a structure through the iterate function to unload the * prisoners because it's more flexible in that, perhaps someday in the future, we * could fail to add an object to the prison (maybe it's full or something), and in * that case it's better to manually do actions each time a successful diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp index 047072d58ed..df00ae7d93d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/TransportAIUpdate.cpp @@ -65,7 +65,7 @@ void TransportAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); @@ -110,7 +110,7 @@ void TransportAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsTo if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); @@ -155,7 +155,7 @@ void TransportAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsT if( contain != nullptr && contain->isPassengerAllowedToFire() ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) + // too, but only if this is a direct command. (As opposed to a passive acquire) if( cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT ) { const ContainedItemsList *passengerList = contain->getContainedItemsList(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 59c238d7834..8e9a753daab 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -100,7 +100,7 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } } m_currentTask = DOZER_TASK_INVALID; - m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value + m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelevant, but I want non-garbage value m_supplyTruckStateMachine = nullptr; m_numberBoxes = 0; @@ -658,7 +658,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target ) m_task[ task ].m_targetObjectID = target->getID(); m_task[ task ].m_taskOrderFrame = TheGameLogic->getFrame(); - // reset the dozer behavior so that it can re-evluate which task to continue working on + // reset the dozer behavior so that it can re-evaluate which task to continue working on m_dozerMachine->resetToDefaultState(); // reset the workermachine, if we've been acting like a supply truck diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index 04c527d390c..f4677084230 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -79,7 +79,7 @@ AssistedTargetingUpdate::~AssistedTargetingUpdate( void ) //------------------------------------------------------------------------------------------------- Bool AssistedTargetingUpdate::isFreeToAssist() const { - // The reload times of my two weapons are tied together, so Ready is indicitive of either. + // The reload times of my two weapons are tied together, so Ready is indicative of either. const Object *me = getObject(); if( !me->isAbleToAttack() ) return FALSE;// This will cover under construction among other things diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp index c5f46810106..3f19d18ce7a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BattlePlanUpdate.cpp @@ -899,7 +899,7 @@ void BattlePlanUpdate::xfer( Xfer *xfer ) // next ready frame xfer->xferUnsignedInt( &m_nextReadyFrame ); - // don't need to save this interface, it's retrived on object creation + // don't need to save this interface, it's retrieved on object creation // SpecialPowerModuleInterface *m_specialPowerModule; // invalid settings diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp index 647bf403029..86299d46ad2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp @@ -409,7 +409,7 @@ void DockUpdate::cancelDock( Object* docker ) void DockUpdate::setDockCrippled( Bool setting ) { - // At this level, Crippling means I will accept Approach requests, but I will never grant Enter clearence. + // At this level, Crippling means I will accept Approach requests, but I will never grant Enter clearance. m_dockCrippled = setting; } @@ -417,7 +417,7 @@ UpdateSleepTime DockUpdate::update() { if( m_activeDocker == INVALID_ID && !m_dockCrippled ) { - // if setDockCrippled has been called, I will never give enterance permission. + // if setDockCrippled has been called, I will never give entrance permission. for( size_t positionIndex = 0; positionIndex < m_approachPositionReached.size(); ++positionIndex ) { if( m_approachPositionReached[positionIndex] ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp index ec124c5ca0c..4514da14b7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/RailedTransportDockUpdate.cpp @@ -292,7 +292,7 @@ void RailedTransportDockUpdate::doPullInDocking( void ) // // set the model condition for the object as "moving" even though it really // isn't in the traditional sense, but we don't want them to scoot slide into - // the transport and look wierd + // the transport and look weird // docker->setModelConditionState( MODELCONDITION_MOVING ); @@ -382,7 +382,7 @@ void RailedTransportDockUpdate::doPushOutDocking( void ) // // set the model condition for the object as "moving" even though it really // isn't in the traditional sense, but we don't want them to scoot slide into - // the transport and look wierd + // the transport and look weird // unloader->setModelConditionState( MODELCONDITION_MOVING ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp index d48d282718d..1c8400c6b14 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyCenterDockUpdate.cpp @@ -114,7 +114,7 @@ Bool SupplyCenterDockUpdate::action( Object* docker, Object *drone ) StealthUpdate *stealth = docker->getStealth(); //Only grant temporary stealth to the default stealth update. It's //possible that another type of stealth was granted... like the - //GPS scrambler. We want that to take precendence. + //GPS scrambler. We want that to take precedence. if( getObject()->testStatus( OBJECT_STATUS_STEALTHED ) ) { if( !stealth ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp index 11a12f92e5c..e7d63830827 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp @@ -264,7 +264,7 @@ UpdateSleepTime DynamicShroudClearingRangeUpdate::update( void ) } if ( m_stateCountDown > 0 ) m_stateCountDown --;// it is important that this gets called every frame without sleeping - //beacuse it handles animation and may need to respond to changing vision range from scripts & stuff + //because it handles animation and may need to respond to changing vision range from scripts & stuff if( m_changeIntervalCountdown > 0 ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index d9bc8fb3b5f..10385624530 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -120,7 +120,7 @@ Bool FireWeaponUpdate::isOkayToFire() if( me->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION) ) return FALSE; // no hitting with a 0% building, cheater - // Firing a real weapon surpresses this module + // Firing a real weapon suppresses this module if( data->m_exclusiveWeaponDelay > 0 && ( TheGameLogic->getFrame() < (me->getLastShotFiredFrame() + data->m_exclusiveWeaponDelay) ) ) return FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp index 30885ca59d2..e491e25c6cc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp @@ -24,7 +24,7 @@ // FILE: HelicopterSlowDeathBehavior.cpp //////////////////////////////////////////////////////////// // Author: Colin Day, March 2002 -// Desc: Helicoptor slow deaths +// Desc: Helicopter slow deaths /////////////////////////////////////////////////////////////////////////////////////////////////// // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// @@ -295,7 +295,7 @@ UpdateSleepTime HelicopterSlowDeathBehavior::update( void ) { // - // change the angle of the helicoptor based on the spiral rate for the turning on the + // change the angle of the helicopter based on the spiral rate for the turning on the // large downward spin circle // diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp index b8fe6836d25..cedffc54f10 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HijackerUpdate.cpp @@ -26,7 +26,7 @@ // // FILE: HijackerUpdate.cpp // Author: Mark Lorenzen, July 2002 -// Desc: Allows hijacker to kepp with his hijacked vehicle (though hidden) until it dies, then +// Desc: Allows hijacker to keep with his hijacked vehicle (though hidden) until it dies, then // to become a hijacker once more // ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -234,7 +234,7 @@ void HijackerUpdate::xfer( Xfer *xfer ) // eject pos xfer->xferCoord3D( &m_ejectPos ); - // udpate + // update xfer->xferBool( &m_update ); // is in vehicle @@ -254,7 +254,7 @@ void HijackerUpdate::loadPostProcess( void ) // extend base class UpdateModule::loadPostProcess(); - // set the target object, this will also tie up teh m_ejectPilotDMI pointer + // set the target object, this will also tie up the m_ejectPilotDMI pointer Object *obj = TheGameLogic->findObjectByID( m_targetID ); setTargetObject( obj ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp index a4e33d33eb4..52fcf359865 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp @@ -141,7 +141,7 @@ UpdateSleepTime OCLUpdate::update( void ) const OCLUpdateModuleData *data = getOCLUpdateModuleData(); - // Test if the OCL update is faction dependant. If so, check for faction changes + // Test if the OCL update is faction dependent. If so, check for faction changes if (data->m_isFactionTriggered) { Player *player = getObject()->getControllingPlayer(); @@ -172,7 +172,7 @@ UpdateSleepTime OCLUpdate::update( void ) } } - // If the building is neutal, skip futher update + // If the building is neutal, skip further update if (m_isFactionNeutral) return UPDATE_SLEEP_NONE; } @@ -209,7 +209,7 @@ UpdateSleepTime OCLUpdate::update( void ) // Get and store the faction side to compare with the faction ocl list if (playerT->getSide().str()) playerFactionName = playerT->getSide().str(); - // Loop through the list of faction ocls to find the matching faction that triggeres the specific ocls + // Loop through the list of faction ocls to find the matching faction that triggers the specific ocls for (OCLUpdateModuleData::FactionOCLList::const_iterator it = data->m_factionOCL.begin(); it != data->m_factionOCL.end(); ++it) { OCLUpdateModuleData::FactionOCLInfo info = *it; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index e58f80b5eef..eb81af5cb3b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -778,7 +778,7 @@ UpdateSleepTime PhysicsBehavior::update() // this flag is ALWAYS cleared once we hit the ground. setFlag(ALLOW_TO_FALL, false); - // When a stunned object hits the ground the first time, chage it's model state from stunned flailing to just stunned. + // When a stunned object hits the ground the first time, change it's model state from stunned flailing to just stunned. if (getFlag(IS_STUNNED)) { obj->clearModelConditionState(MODELCONDITION_STUNNED_FLAILING); @@ -1196,7 +1196,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3 return; } - // ignore collisions with our "ignore" thingie, if any (and vice versa) + // ignore collisions with our "ignore" thingy, if any (and vice versa) AIUpdateInterface* ai = obj->getAIUpdateInterface(); if (ai != nullptr && ai->getIgnoredObstacleID() == other->getID()) { @@ -1441,7 +1441,7 @@ static Bool perpsLogicallyEqual( Real perpOne, Real perpTwo ) //------------------------------------------------------------------------------------------------- Bool PhysicsBehavior::checkForOverlapCollision(Object *other) { - //This is the most Supreme Truth... that unless I am moving right now, I may not crush anyhing! + //This is the most Supreme Truth... that unless I am moving right now, I may not crush anything! if ( isVerySmall3D( *getVelocity() ) ) return false; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp index b6b360bae8e..040773e55c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/DefaultProductionExitUpdate.cpp @@ -90,7 +90,7 @@ void DefaultProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoorTyp newObj->setOrientation( exitAngle ); newObj->setLayer( creationObject->getLayer() ); - /** @todo This really should be automatically wrapped up in an actication sequence + /** @todo This really should be automatically wrapped up in an activation sequence for objects in general */ // tell the AI about it TheAI->pathfinder()->addObjectToPathfindMap( newObj ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp index f931c039f17..0e4c5aff7e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp @@ -125,7 +125,7 @@ void QueueProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoorType } - /** @todo This really should be automatically wrapped up in an actication sequence + /** @todo This really should be automatically wrapped up in an activation sequence for objects in general */ // tell the AI about it TheAI->pathfinder()->addObjectToPathfindMap( newObj ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp index e6d782d2597..61128e09a16 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SpawnPointProductionExitUpdate.cpp @@ -103,7 +103,7 @@ void SpawnPointProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoor newObj->setOrientation( createAngle ); newObj->setLayer(creationObject->getLayer()); - /** @todo This really should be automatically wrapped up in an actication sequence + /** @todo This really should be automatically wrapped up in an activation sequence for objects in general */ // tell the AI about it TheAI->pathfinder()->addObjectToPathfindMap( newObj ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp index 8f4a9af5363..b78f5f9ddef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/SupplyCenterProductionExitUpdate.cpp @@ -90,7 +90,7 @@ void SupplyCenterProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDo newObj->setPosition( &createPoint ); newObj->setOrientation( exitAngle ); - /** @todo This really should be automatically wrapped up in an actication sequence + /** @todo This really should be automatically wrapped up in an activation sequence for objects in general */ // tell the AI about it TheAI->pathfinder()->addObjectToPathfindMap( newObj ); @@ -135,7 +135,7 @@ void SupplyCenterProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDo StealthUpdate *stealth = newObj->getStealth(); //Only grant temporary stealth to the default stealth update. It's //possible that another type of stealth was granted... like the - //GPS scrambler. We want that to take precendence. + //GPS scrambler. We want that to take precedence. if( getObject()->testStatus( OBJECT_STATUS_STEALTHED ) ) { if( stealth->isTemporaryGrant() || !newObj->testStatus( OBJECT_STATUS_CAN_STEALTH ) ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 94aaed79b24..3e33f6e4bb8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -302,7 +302,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) // allocate a new production entry ProductionEntry *production = newInstance(ProductionEntry); - // assing production entry data + // assign production entry data production->m_type = PRODUCTION_UPGRADE; production->m_upgradeToResearch = upgrade; production->m_productionID = PRODUCTIONID_INVALID; // not needed for upgrades, you can only have one of @@ -375,7 +375,7 @@ void ProductionUpdate::cancelUpgrade( const UpgradeTemplate *upgrade ) } //------------------------------------------------------------------------------------------------- -/** Queue the prodcution of a unit. Returns TRUE if unit was added to queue, FALSE if it +/** Queue the production of a unit. Returns TRUE if unit was added to queue, FALSE if it * was not */ //------------------------------------------------------------------------------------------------- Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, ProductionID productionID ) @@ -442,7 +442,7 @@ Bool ProductionUpdate::queueCreateUnit( const ThingTemplate *unitType, Productio } } - // assing production entry data + // assign production entry data production->m_type = PRODUCTION_UNIT; production->m_objectToProduce = unitType; production->m_productionID = productionID; @@ -912,7 +912,7 @@ UpdateSleepTime ProductionUpdate::update( void ) msg.format( format.str(), upgradeName.str() ); TheInGameUI->message( msg ); - // upgrades are a more rare event, play a nifty radar event thingie + // upgrades are a more rare event, play a nifty radar event thingy TheRadar->createEvent( us->getPosition(), RADAR_EVENT_UPGRADE ); //Play the sound for the upgrade, because we just built it! @@ -1044,7 +1044,7 @@ void ProductionUpdate::removeFromProductionQueue( ProductionEntry *production ) else m_productionQueue = production->m_next; - // detach next pointer, keep tail poitner to the whole queue in tact + // detach next pointer, keep tail pointer to the whole queue in tact if( production->m_next ) production->m_next->m_prev = production->m_prev; else diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index ebd65ef708e..0fc36ff7929 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -105,7 +105,7 @@ that has every option will do the following in order: 2 -- UNPACK: If I need to unpack before I can prepare, then do so now (this uses the model condition unpack). 3 -- PREPARE: If I need to perform a task for a period of time before I can trigger my special - ability, then do so now. A good example is aiming with a targetting laser for a few + ability, then do so now. A good example is aiming with a targeting laser for a few seconds before firing your special weapon. 4 -- TRIGGER: Once preparation is complete, fire your special ability now. 5 -- PACK: If I need to pack after finishing my attack, do so now. @@ -815,7 +815,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); const Object *self = getObject(); - //Quickly convert very short range approachs to "contact" class requiring collision before + //Quickly convert very short range approaches to "contact" class requiring collision before //stopping. Real range = data->m_startAbilityRange; const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; @@ -896,7 +896,7 @@ Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); const Object *self = getObject(); - //Quickly convert very short range approachs to "contact" class requiring collision before + //Quickly convert very short range approaches to "contact" class requiring collision before //stopping. Real range = data->m_startAbilityRange; const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; @@ -1261,7 +1261,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() Object *object = getObject(); //Award experience to units for triggering the ability (optional and ini specified). - //NOTE: Be award of persistant abilities that call trigger over and over again! + //NOTE: Be aware of persistent abilities that call trigger over and over again! if( data->m_awardXPForTriggering ) { ExperienceTracker *xpTracker = object->getExperienceTracker(); @@ -1554,7 +1554,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() update->detonate(); okToLoseStealth = FALSE; //Note: while the objects are detonating, they will still exist in the game. - //Our update will be responsible for validating their existance and removing them.. + //Our update will be responsible for validating their existence and removing them.. //in case either the enemy player cleans one up, or after it's gone. } } @@ -1959,7 +1959,7 @@ void SpecialAbilityUpdate::endPreparation() // Based on the special that we just finished preparing (either by failure or success), // do we want to keep the "special objects" created? Some specials will -- others won't. - // Note that persistant specials will not call this until preparation is complete (not + // Note that persistent specials will not call this until preparation is complete (not // recycling). const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp index 9d54a458341..90f4604e485 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialPowerUpdateModule.cpp @@ -58,7 +58,7 @@ Bool SpecialPowerUpdateModule::doesSpecialPowerUpdatePassScienceTest() const //Kris: July 24, 2003 -- Added an additional optional check for objects with multiple SpecialPowerModules referencing //the same SpecialPowerTemplate but with special ScienceType checks. An example of this is the three //SpectreGunshipDeploymentUpdate modules inside AirF_AmericaCommandCenter. Each one has a different duration which - //is hooked into different objects. This sucked and became necessary because the way the stackable changable icon system + //is hooked into different objects. This sucked and became necessary because the way the stackable changeable icon system //for multilevel buttons. ScienceType science = getExtraRequiredScience(); if( science != SCIENCE_INVALID ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp index efac56d1a54..b6862036895 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipDeploymentUpdate.cpp @@ -203,7 +203,7 @@ Bool SpectreGunshipDeploymentUpdate::initiateIntentToDoSpecialPower(const Specia - // HERE WE NEED TO CREATE THE POINT FURTHER OFF THE MAP SO WE CANT SEE THE LAME HOVER AND ACCELLERATE BEHAVIOR + // HERE WE NEED TO CREATE THE POINT FURTHER OFF THE MAP SO WE CANT SEE THE LAME HOVER AND ACCELERATE BEHAVIOR Coord3D deltaToCreationPoint = m_initialTargetPosition; deltaToCreationPoint.sub( &creationCoord ); Real distanceFromTarget = deltaToCreationPoint.length(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp index 17de4f00054..9d117b02808 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp @@ -411,7 +411,7 @@ UpdateSleepTime SpectreGunshipUpdate::update() Real distanceToTarget = perigee.length(); perigee.normalize(); - //apogee is the anteclockwise point fathest from the perigee line + //apogee is the anteclockwise point farthest from the perigee line Coord3D apogee; apogee.z = zero; apogee.x = -perigee.y; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 09dc2545abb..635370717d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -480,7 +480,7 @@ StealthLookType StealthUpdate::calcStealthedStatusForPlayer(const Object* obj, c If detected, you always appears as (sd). Sorry, there is one more condition, stealthed, but visible to friendly folks, YET detected - In this state we render outselves visible and we ovlerlay the detection effect as a warning + In this state we render ourselves visible and we ovlerlay the detection effect as a warning we'll call this STEALTHLOOK_VISIBLE_FRIENDLY_DETECTED diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp index d3609537bfd..18e37486531 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp @@ -495,7 +495,7 @@ void StructureToppleUpdate::doToppleDelayBurstFX() // got the bone position... sys->setPosition(&pos); - // Attatch it to the object... + // Attach it to the object... sys->attachToDrawable(drawable); } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp index 17d1fd053ac..30a38735c33 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp @@ -430,7 +430,7 @@ void ToppleUpdate::xfer( Xfer *xfer ) // topple state xfer->xferUser( &m_toppleState, sizeof( ToppleState ) ); - // angluar accumulation + // angular accumulation xfer->xferReal( &m_angularAccumulation ); // angle delta X diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp index e3db1a41d9a..140454bbb76 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp @@ -345,7 +345,7 @@ void WaveGuideUpdate::computeWaveShapePoints( void ) // ------------------------------------------------------------------------------------------------ /** Given the current position and orientation of the wave guide, transform all the wave - * shape points so we can quickly access them for mutliple reasons */ + * shape points so we can quickly access them for multiple reasons */ // ------------------------------------------------------------------------------------------------ void WaveGuideUpdate::transformWaveShape( void ) { @@ -504,7 +504,7 @@ void WaveGuideUpdate::doShoreEffects( void ) // if( underWater == TRUE && i != 0 ) { - Coord3D *prevPoint = &effectPoints[ i - 1 ]; // the prev point is actuall on the water so we'll use it + Coord3D *prevPoint = &effectPoints[ i - 1 ]; // the prev point is actually on the water so we'll use it particleSystem = TheParticleSystemManager->createParticleSystem( right ); if( particleSystem ) @@ -542,7 +542,7 @@ void WaveGuideUpdate::doShoreEffects( void ) } // ------------------------------------------------------------------------------------------------ -/** Do damage to things that have fallen victim in the path of this enourmous wave */ +/** Do damage to things that have fallen victim in the path of this enormous wave */ // ------------------------------------------------------------------------------------------------ void WaveGuideUpdate::doDamage( void ) { @@ -715,7 +715,7 @@ void WaveGuideUpdate::doDamage( void ) z.z = 1.0f; // - // angle is rotated, becuase we computed from 'from' and 'to' points of + // angle is rotated, because we computed from 'from' and 'to' points of // the bridge going *across* the valley, not pointing *down* it // u.x = Cos( angle + modData->m_bridgeParticleAngleFudge ); @@ -801,7 +801,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) } - // every half second we try to play a random spash sound + // every half second we try to play a random splash sound if( TheGameLogic->getFrame() - m_splashSoundFrame > LOGICFRAMES_PER_SECOND / 2.0f ) { @@ -834,7 +834,7 @@ UpdateSleepTime WaveGuideUpdate::update( void ) static const ParticleSystemTemplate *waveSplash = TheParticleSystemManager->findTemplate( "WaveSplash01" ); ParticleSystem *particleSys; - // create spash effect + // create splash effect particleSys = TheParticleSystemManager->createParticleSystem( waveSplash ); if( particleSys ) particleSys->setLocalTransform( waveGuide->getTransformMatrix() ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index c5693de7f61..9cdf2e39ec4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1502,7 +1502,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co // Calculate the vector of the shockwave Coord3D shockWaveVector = damageDirection; - // Guard against zero vector. Make vector stright up if that is the case + // Guard against zero vector. Make vector straight up if that is the case if (fabs(shockWaveVector.x) < WWMATH_EPSILON && fabs(shockWaveVector.y) < WWMATH_EPSILON && fabs(shockWaveVector.z) < WWMATH_EPSILON) @@ -1510,7 +1510,7 @@ void WeaponTemplate::dealDamageInternal(ObjectID sourceID, ObjectID victimID, co shockWaveVector.z = 1.0f; } - // Populate the damge information with the shockwave information + // Populate the damage information with the shockwave information damageInfo.in.m_shockWaveVector = shockWaveVector; damageInfo.in.m_shockWaveRadius = m_shockWaveRadius; damageInfo.in.m_shockWaveTaperOff = m_shockWaveTaperOff; @@ -1723,7 +1723,7 @@ void WeaponStore::resetWeaponTemplates( void ) //------------------------------------------------------------------------------------------------- void WeaponStore::reset() { - // clean up any overriddes. + // clean up any overrides. for (size_t i = 0; i < m_weaponTemplateVector.size(); ++i) { WeaponTemplate *wt = m_weaponTemplateVector[i]; @@ -2586,7 +2586,7 @@ Bool Weapon::privateFireWeapon( setLeechRangeActive( TRUE ); } - //Special case damge type overrides requiring special handling. + //Special case damage type overrides requiring special handling. switch( m_template->getDamageType() ) { case DAMAGE_DEPLOY: @@ -3468,7 +3468,7 @@ void Weapon::xfer( Xfer *xfer ) // when can fire again xfer->xferUnsignedInt( &m_whenWeCanFireAgain ); - // wehn pre attack finished + // when pre attack finished xfer->xferUnsignedInt( &m_whenPreAttackFinished ); // when last reload started diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index a8303e7760d..a0bf30540cc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -554,7 +554,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac //care about relationships (and fixes broken scripts). if( commandSource == CMD_FROM_PLAYER && (!victim->testScriptStatusBit( OBJECT_STATUS_SCRIPT_TARGETABLE ) || r == ALLIES) ) { - //Unless the object has a map propertly that sets it to be targetable (and not allied), then give up. + //Unless the object has a map properly that sets it to be targetable (and not allied), then give up. return ATTACKRESULT_NOT_POSSIBLE; } } @@ -580,7 +580,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac //care about relationships (and fixes broken scripts). if( commandSource == CMD_FROM_PLAYER && (!victim->testScriptStatusBit( OBJECT_STATUS_SCRIPT_TARGETABLE ) || r == ALLIES) ) { - //Unless the object has a map propertly that sets it to be targetable (and not allied), then give up. + //Unless the object has a map properly that sets it to be targetable (and not allied), then give up. return ATTACKRESULT_NOT_POSSIBLE; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 7d244708774..546efa1ae32 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -562,7 +562,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS dp = (DeliverPayloadAIUpdate*)transport->findUpdateModule(key_DeliverPayloadAIUpdate); } - //Our tranport has a deliverPayload update module. This means it'll do airborned drops. + //Our transport has a deliverPayload update module. This means it'll do airborned drops. const ThingTemplate* putInContainerTemplate = nullptr; if( dp ) @@ -2838,7 +2838,7 @@ void ScriptActions::doSpeechPlay(const AsciiString& speechName, Bool allowOverla UnicodeString subtitle = TheGameText->fetch(subtitleLabel, &found); if( found && !subtitle.isEmpty() && subtitle.getCharAt(0) != '*') { - // Foreign versions can specify region specifc subtitle strings if they want. + // Foreign versions can specify region specific subtitle strings if they want. // English will have strings with / for easy translation, but they don't want to display. TheInGameUI->militarySubtitle( subtitleLabel, SUBTITLE_DURATION ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index a85f03d9887..ee4633fb9b7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -344,7 +344,7 @@ Bool ScriptConditions::evaluateNamedUnitTotallyDead(Parameter *pUnitParm) } if (TheScriptEngine->didUnitExist(pUnitParm->getString())) { - // Did exist, now it doesnt. So it is really, really dead. + // Did exist, now it doesn't. So it is really, really dead. return true; // totally killed } return false; // Non existent unit is not dead. @@ -2256,7 +2256,7 @@ Bool ScriptConditions::evaluateSkirmishPlayerTechBuildingWithinDistancePerimeter if (!player) { return false; } - // If we have a chached value, return it. [8/8/2003] + // If we have a cached value, return it. [8/8/2003] if (pCondition->getCustomData()==1) return true; if (pCondition->getCustomData()==-1) return false; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 08edd272242..b9702235210 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -6959,7 +6959,7 @@ void ScriptEngine::executeScript( Script *pScript ) case DIFFICULTY_NORMAL : if (!pScript->isNormal()) return; break; case DIFFICULTY_HARD : if (!pScript->isHard()) return; break; } - // If we are doing peridic evaluation, check the frame. + // If we are doing periodic evaluation, check the frame. if (TheGameLogic->getFrame()getFrameToEvaluate()) { return; } @@ -7706,7 +7706,7 @@ const ConditionTemplate * ScriptEngine::getConditionTemplate( Int ndx ) } //------------------------------------------------------------------------------------------------- -/** Fills the named object cache initally. */ +/** Fills the named object cache initially. */ //------------------------------------------------------------------------------------------------- void ScriptEngine::createNamedCache( void ) { @@ -8980,7 +8980,7 @@ void ScriptEngine::xfer( Xfer *xfer ) if( xfer->getXferMode() == XFER_SAVE ) { - // iterate elemnts + // iterate elements VecNamedRequestsIt it; for( it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it ) { From d9c3060aebbf8e24e30ad97e92cbed28eca9f602 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 14:09:04 -0500 Subject: [PATCH 063/211] docs: Fix spelling errors in GeneralsMD/Code/GameEngine/Source/GameClient and Common comments (#2122) --- .../GameEngine/Source/Common/CommandLine.cpp | 2 +- .../GameEngine/Source/Common/GlobalData.cpp | 6 ++-- .../Source/Common/PartitionSolver.cpp | 2 +- .../Source/Common/RTS/AcademyStats.cpp | 8 +++--- .../Source/Common/RTS/ActionManager.cpp | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 4 +-- .../Common/RTS/ProductionPrerequisite.cpp | 4 +-- .../Common/RTS/ResourceGatheringManager.cpp | 2 +- .../Source/Common/RTS/SpecialPower.cpp | 2 +- .../GameEngine/Source/Common/RTS/Team.cpp | 2 +- .../Source/Common/RTS/TunnelTracker.cpp | 2 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../Source/Common/StatsCollector.cpp | 2 +- .../Source/Common/System/BuildAssistant.cpp | 8 +++--- .../Source/Common/System/FunctionLexicon.cpp | 4 +-- .../Source/Common/System/registry.cpp | 2 +- .../Source/Common/Thing/ModuleFactory.cpp | 4 +-- .../GameEngine/Source/Common/Thing/Thing.cpp | 2 +- .../Source/Common/Thing/ThingFactory.cpp | 2 +- .../Source/Common/Thing/ThingTemplate.cpp | 2 +- .../GameEngine/Source/GameClient/Color.cpp | 2 +- .../GameEngine/Source/GameClient/Display.cpp | 2 +- .../GameEngine/Source/GameClient/Drawable.cpp | 10 +++---- .../GameClient/GUI/ControlBar/ControlBar.cpp | 8 +++--- .../GUI/ControlBar/ControlBarCommand.cpp | 8 +++--- .../GUI/ControlBar/ControlBarMultiSelect.cpp | 2 +- .../GUI/ControlBar/ControlBarOCLTimer.cpp | 2 +- .../ControlBarUnderConstruction.cpp | 2 +- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 2 +- .../GUI/GUICallbacks/IMECandidate.cpp | 4 +-- .../Menus/KeyboardOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/PopupSaveLoad.cpp | 4 +-- .../GUI/GUICallbacks/Menus/QuitMenu.cpp | 4 +-- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 4 +-- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 4 +-- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 14 +++++----- .../GUI/Gadget/GadgetPushButton.cpp | 2 +- .../GUI/Gadget/GadgetVerticalSlider.cpp | 2 +- .../Source/GameClient/GUI/GameFont.cpp | 2 +- .../Source/GameClient/GUI/GameWindow.cpp | 10 +++---- .../Source/GameClient/GUI/IMEManager.cpp | 10 +++---- .../GameClient/GUI/ProcessAnimateWindow.cpp | 12 ++++---- .../Source/GameClient/GUI/Shell/Shell.cpp | 4 +-- .../Source/GameClient/GUI/WindowLayout.cpp | 2 +- .../Source/GameClient/GameClient.cpp | 10 +++---- .../GameEngine/Source/GameClient/InGameUI.cpp | 28 +++++++++---------- .../Source/GameClient/Input/Keyboard.cpp | 2 +- .../Source/GameClient/Input/Mouse.cpp | 4 +-- .../GameEngine/Source/GameClient/Line2D.cpp | 2 +- .../GameClient/MessageStream/CommandXlat.cpp | 8 +++--- .../MessageStream/SelectionXlat.cpp | 6 ++-- .../GameClient/MessageStream/WindowXlat.cpp | 2 +- .../Source/GameClient/System/Anim2D.cpp | 2 +- .../Source/GameClient/System/Image.cpp | 2 +- .../Source/GameClient/System/ParticleSys.cpp | 8 +++--- 55 files changed, 128 insertions(+), 128 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp index 8b6475e3885..661caa280af 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp @@ -1418,7 +1418,7 @@ static void parseCommandLine(const CommandLineParam* params, int numParams) // and functions to handle them. Comparisons can be case-(in)sensitive, and // can check the entire string (for testing the presence of a flag) or check // just the start (for a key=val argument). The handling function can also - // look at the next argument(s), to accomodate multi-arg parameters, e.g. "-p 1234". + // look at the next argument(s), to accommodate multi-arg parameters, e.g. "-p 1234". while (argisKindOf( KINDOF_HERO ) ) { m_heroesBuilt++; @@ -702,7 +702,7 @@ void AcademyStats::evaluateTier1Advice( AcademyAdviceInfo *info, Int numAvailabl numAvailableTips--; } - //14) Heros built? + //14) Heroes built? if( !m_heroesBuilt ) { availableTips++; @@ -1174,7 +1174,7 @@ void AcademyStats::xfer( Xfer *xfer ) //13) Extra gathers built? xfer->xferUnsignedInt( &m_gatherersBuilt ); - //14) Heros built? + //14) Heroes built? xfer->xferUnsignedInt( &m_heroesBuilt ); //+------------------------------+ diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 9c92f795854..4bd4026e495 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -795,7 +795,7 @@ CanAttackResult ActionManager::getCanAttackObject( const Object *obj, const Obje } } } - else if( result == ATTACKRESULT_NOT_POSSIBLE )// oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + else if( result == ATTACKRESULT_NOT_POSSIBLE )// oh dear me. The weird case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase { ContainModuleInterface *contain = obj->getContain(); if ( contain ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 22e8272b31d..d44c0ac9fbf 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -1620,7 +1620,7 @@ void Player::preTeamDestroy( const Team *team ) } //------------------------------------------------------------------------------------------------- -/// a structuer was just created, but is under construction +/// a structure was just created, but is under construction //------------------------------------------------------------------------------------------------- void Player::onStructureCreated( Object *builder, Object *structure ) { @@ -3147,7 +3147,7 @@ Bool Player::okToPlayRadarEdgeSound( void ) } //------------------------------------------------------------------------------------------------- -/** The parameter object has just aquired a radar */ +/** The parameter object has just acquired a radar */ //------------------------------------------------------------------------------------------------- void Player::addRadar( Bool disableProof ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp index 49c560c2b1d..fb1d5f88a68 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp @@ -189,7 +189,7 @@ Bool ProductionPrerequisite::isSatisfied(const Player *player) const //------------------------------------------------------------------------------------------------- /** Add a unit prerequisite, if 'orWithPrevious' is set then this unit is said * to be an alternate prereq to the previously added unit, otherwise this becomes - * a new 'block' and is required in ADDDITION to other entries. + * a new 'block' and is required in ADDITION to other entries. * Return FALSE if no space left to add unit */ //------------------------------------------------------------------------------------------------- void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPrevious ) @@ -205,7 +205,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre //------------------------------------------------------------------------------------------------- /** Add a unit prerequisite, if 'orWithPrevious' is set then this unit is said * to be an alternate prereq to the previously added unit, otherwise this becomes - * a new 'block' and is required in ADDDITION to other entries. + * a new 'block' and is required in ADDITION to other entries. * Return FALSE if no space left to add unit */ //------------------------------------------------------------------------------------------------- void ProductionPrerequisite::addUnitPrereq( const std::vector& units ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp index 3db81c1a665..230a7b1935e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp @@ -117,7 +117,7 @@ static Real computeRelativeCost( Object *queryObject, Object *destObject, Real * return FLT_MAX; if( !TheActionManager->canTransferSuppliesAt(queryObject, destObject) ) - return FLT_MAX;// Handles emptyness and alliances + return FLT_MAX;// Handles emptiness and alliances DockUpdateInterface *dockInterface = destObject->getDockUpdateInterface(); if( !dockInterface->isClearToApproach( queryObject ) ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp index 159404daaba..219758917e2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp @@ -337,7 +337,7 @@ Bool SpecialPowerStore::canUseSpecialPower( Object *obj, const SpecialPowerTempl // they cannot have all of them. // - // check for requried science + // check for required science ScienceType requiredScience = specialPowerTemplate->getRequiredScience(); if( requiredScience != SCIENCE_INVALID ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 2322395a1d6..397f257b618 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1125,7 +1125,7 @@ Bool TeamPrototype::evaluateProductionCondition(void) return false; } if (m_productionConditionScript) { - // If we are doing peridic evaluation, check the frame. + // If we are doing periodic evaluation, check the frame. if (TheGameLogic->getFrame()getFrameToEvaluate()) { return false; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index f561de2d8e9..831b3e8782a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -250,7 +250,7 @@ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) void TunnelTracker::destroyObject( Object *obj, void * ) { // Now that tunnels consider ContainedBy to be "the tunnel you entered", I need to say goodbye - // llike other contain types so they don't look us up on their deletion and crash + // like other contain types so they don't look us up on their deletion and crash obj->onRemovedFrom( obj->getContainedBy() ); TheGameLogic->destroyObject( obj ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index 5da265409e9..c3094604143 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -483,7 +483,7 @@ void RecorderClass::stopPlayback() { } /** - * Update function for recording a game. Basically all the pertinant logic commands for this frame are written out + * Update function for recording a game. Basically all the pertinent logic commands for this frame are written out * to a file. */ void RecorderClass::updateRecord() diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp index e253300153f..aaf11cc05c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cpp @@ -38,7 +38,7 @@ // // author: Chris Huybregts // -// purpose: Convinience class to gather player stats +// purpose: Convenience class to gather player stats // //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 78e8e2a12d3..cff82dadd90 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1113,7 +1113,7 @@ void BuildAssistant::addBibs(const Coord3D *worldPos, * actually used for the tiling is returned along with a pointer to the array * of positions in the tile build info. * - * REQUIRES: Note that the array at 'postions' must be large enough to hold 'maxTiles' + * REQUIRES: Note that the array at 'positions' must be large enough to hold 'maxTiles' * entries of positions */ //------------------------------------------------------------------------------------------------- @@ -1132,7 +1132,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT // // we will fill out our own internal array of positions, it better be big enough to - // accomodate max tiles, if it's not lets make it bigger! + // accommodate max tiles, if it's not lets make it bigger! // if( maxTiles > m_buildPositionSize ) { @@ -1160,7 +1160,7 @@ BuildAssistant::TileBuildInfo *BuildAssistant::buildTiledLocations( const ThingT placementVector.z = 0.0f; //end->z - start->z; // - // get the lengh of the placement vector in the world, we'll use this to see how + // get the length of the placement vector in the world, we'll use this to see how // many objects we'll need to fill the entire line // Real placementLength = placementVector.length(); @@ -1604,7 +1604,7 @@ void BuildAssistant::sellObject( Object *obj ) // destroy any mines that are owned by this structure, right now. // unfortunately, structures don't keep list of mines they own, so we must do - // this the hard way :-( [fortunately, this doens't happen very often, so this + // this the hard way :-( [fortunately, this doesn't happen very often, so this // is probably an acceptable, if icky, solution.] (srj) for (Object* mine = TheGameLogic->getFirstObject(); mine; mine = mine->getNextObject()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index c269e5316fd..7af6926ad85 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -445,7 +445,7 @@ void *FunctionLexicon::findFunction( NameKeyType key, TableIndex index ) if( key == NAMEKEY_INVALID ) return nullptr; - // search ALL tables for function if the index paramater allows if + // search ALL tables for function if the index parameter allows if if( index == TABLE_ANY ) { @@ -527,7 +527,7 @@ FunctionLexicon::~FunctionLexicon( void ) } //------------------------------------------------------------------------------------------------- -/** Initialize our dictionary of funtion pointers and symbols */ +/** Initialize our dictionary of function pointers and symbols */ //------------------------------------------------------------------------------------------------- void FunctionLexicon::init( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp index df78c8ed782..afe2c92e82e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// // Registry.cpp -// Simple interface for storing/retreiving registry values +// Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index 07ba266dc19..e61c4794f2f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -25,7 +25,7 @@ // FILE: ModuleFactory.cpp //////////////////////////////////////////////////////////////////////// // Author: Colin Day, September 2001 // Desc: TheModuleFactory is where we actually instance modules for objects -// and drawbles. Those modules are things such as an UpdateModule +// and drawables. Those modules are things such as an UpdateModule // or DamageModule or DrawModule etc. // // TheModuleFactory will contain a list of ModuleTemplates, when we @@ -623,7 +623,7 @@ const ModuleFactory::ModuleTemplate* ModuleFactory::findModuleTemplate(const Asc } //------------------------------------------------------------------------------------------------- -/** Allocate a new acton class istance given the name */ +/** Allocate a new acton class instance given the name */ //------------------------------------------------------------------------------------------------- Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const ModuleData* moduleData, ModuleType type ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp index 50bd1d01e36..b8e79f7e9fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -373,7 +373,7 @@ void Thing::convertBonePosToWorldPos(const Coord3D* bonePos, const Matrix3D* bon void Thing::transformPoint( const Coord3D *in, Coord3D *out ) { - // santiy + // sanity if( in == nullptr || out == nullptr ) return; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 2f190e8d2df..f5bd7b72291 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -77,7 +77,7 @@ void ThingFactory::freeDatabase( void ) } //------------------------------------------------------------------------------------------------- -/** add the thing template passed in, into the databse */ +/** add the thing template passed in, into the database */ //------------------------------------------------------------------------------------------------- void ThingFactory::addTemplate( ThingTemplate *tmplate ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index e398a434676..9df3ffcf3fc 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -459,7 +459,7 @@ Bool ModuleInfo::clearCopiedFromDefaultEntries(Int interfaceMask, const AsciiStr ret = true; } else - ++it;//no match, preserve the default instnace of this Module for now + ++it;//no match, preserve the default instance of this Module for now } else // just dump this instance of this Module, since one of the same interface mask has been added by caller { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp index e98a90923dc..0e566ed0709 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Color.cpp @@ -76,7 +76,7 @@ //============================================================================= // GameGetColorComponents ===================================================== -/** Get the RGB color comonents of a color */ +/** Get the RGB color components of a color */ //============================================================================= diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp index 015b66c3e88..ee436052f4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp @@ -220,7 +220,7 @@ void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minC m_currentlyPlayingMovie = movieName; m_movieHoldTime = minMovieLength; m_copyrightHoldTime = minCopyrightLength; - m_elapsedMovieTime = timeGetTime(); // we're using time get time becuase legal want's actual "Seconds" + m_elapsedMovieTime = timeGetTime(); // we're using time get time because legal wants actual "Seconds" m_videoBuffer = createVideoBuffer(); if ( m_videoBuffer == nullptr || diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 3d8b0c30f93..edd2a717234 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -1244,14 +1244,14 @@ void Drawable::updateDrawable( void ) } else if( testTintStatus(TINT_STATUS_GAINING_SUBDUAL_DAMAGE) ) { - // Disabled has precendence, so it goes first + // Disabled has precedence, so it goes first if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); m_colorTintEnvelope->play( &SUBDUAL_DAMAGE_COLOR, 150, 150, SUSTAIN_INDEFINITELY); } else if( testTintStatus(TINT_STATUS_FRENZY) ) { - // Disabled has precendence, so it goes first + // Disabled has precedence, so it goes first if (m_colorTintEnvelope == nullptr) m_colorTintEnvelope = newInstance(TintEnvelope); @@ -2541,7 +2541,7 @@ void Drawable::setStealthLook(StealthLookType look) Object *obj = getObject(); if( obj ) { - //Try to get the stealthupdate module and see if the opacity value is overriden. + //Try to get the stealthupdate module and see if the opacity value is overridden. StealthUpdate *stealth = obj->getStealth(); if( stealth ) { @@ -3838,7 +3838,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion) return; // - // only draw health for selected drawbles and drawables that have been moused over + // only draw health for selected drawables and drawables that have been moused over // by the cursor // if( TheGlobalData->m_showObjectHealth && @@ -4714,7 +4714,7 @@ void Drawable::notifyDrawableDependencyCleared() //------------------------------------------------------------------------------------------------- void Drawable::setSelectable( Bool selectable ) { - // unselct drawable if it is no longer selectable. + // unselect drawable if it is no longer selectable. if( !selectable ) TheInGameUI->deselectDrawable( this ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 61a2916e0d2..5afdde344a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -1045,7 +1045,7 @@ ControlBar::~ControlBar( void ) void ControlBarPopupDescriptionUpdateFunc( WindowLayout *layout, void *param ); //------------------------------------------------------------------------------------------------- -/** Initialzie the control bar, this is our interface to the context sinsitive GUI */ +/** Initialize the control bar, this is our interface to the context sinsitive GUI */ //------------------------------------------------------------------------------------------------- void ControlBar::init( void ) { @@ -1061,7 +1061,7 @@ void ControlBar::init( void ) // post process step after loading the command buttons and command sets postProcessCommands(); - // Init the scheme manager, this will call it's won INI init funciton. + // Init the scheme manager, this will call its own INI init function. m_controlBarSchemeManager = NEW ControlBarSchemeManager; m_controlBarSchemeManager->init(); @@ -1294,7 +1294,7 @@ void ControlBar::init( void ) void ControlBar::reset( void ) { hideSpecialPowerShortcut(); - // do not destroy the rally drawable, it will get destroyed with everythign else during a reset + // do not destroy the rally drawable, it will get destroyed with everything else during a reset m_rallyPointDrawableID = INVALID_DRAWABLE_ID; if(m_radarAttackGlowWindow) m_radarAttackGlowWindow->winEnable(TRUE); @@ -1642,7 +1642,7 @@ void ControlBar::onDrawableDeselected( Drawable *draw ) // // always when becoming unselected should we remove any build placement icons because if - // we have some and are in the middle of a build process, it must obiously be over now + // we have some and are in the middle of a build process, it must obviously be over now // because we are no longer selecting the dozer or worker // TheInGameUI->placeBuildAvailable( nullptr, nullptr ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index e27312cbce9..91931a3e7e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -190,7 +190,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co // // since we're assuming all inventory exit commands appear in a continuous order, - // we need to also need to keep track of what is the last valid inventory commadn index + // we need to also need to keep track of what is the last valid inventory command index // lastInventoryIndex = i; @@ -700,7 +700,7 @@ void ControlBar::updateContextCommand( void ) obj = m_currentSelectedDrawable->getObject(); // - // the contents of objects are ususally showed on the UI, when those contents change + // the contents of objects are usually showed on the UI, when those contents change // we always to update the UI // ContainModuleInterface *contain = obj ? obj->getContain() : nullptr; @@ -1205,7 +1205,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com CanMakeType makeType = TheBuildAssistant->canMakeUnit( obj, command->getThingTemplate() ); if( makeType == CANMAKE_MAXED_OUT_FOR_PLAYER || makeType == CANMAKE_PARKING_PLACES_FULL ) { - //Disable the button if the player has a max amount of these units in build queue or existance. + //Disable the button if the player has a max amount of these units in build queue or existence. return COMMAND_RESTRICTED; } if( makeType == CANMAKE_NO_MONEY ) @@ -1309,7 +1309,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com /// @todo ml -- and note: that the "now-1" below causes zero-clip-reload weapons to never be ready, so I added this /// If you make changes to this code, make sure that the DragonTank's firewall weapon can be retargeted while active, /// that is, while the tank is squirting out flames all over the floor, you can click the firewall button (or "F"), -/// and re-target the firewall without having to stop or move in-betwen.. Thanks for reading +/// and re-target the firewall without having to stop or move in-between.. Thanks for reading || (w->getPossibleNextShotFrame()==now-1) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp index 903faa97a22..36d78f4211b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp @@ -304,7 +304,7 @@ void ControlBar::updateContextMultiSelect( void ) // zero the array that counts how many objects can do each command memset( objectsThatCanDoCommand, 0, sizeof( objectsThatCanDoCommand ) ); - // santiy + // sanity DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, ("updateContextMultiSelect: TheInGameUI only has '%d' things selected", TheInGameUI->getSelectCount()) ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp index 4f371e91799..561169f8622 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp @@ -53,7 +53,7 @@ void ControlBar::updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real perce static UnsignedInt barID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:OCLTimerProgressBar" ); GameWindow *barWindow = TheWindowManager->winGetWindowFromId( nullptr, barID ); - // santiy + // sanity DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); Int minutes = totalSeconds / 60; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp index 79ccbaf6d54..6283806f8d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp @@ -51,7 +51,7 @@ void ControlBar::updateConstructionTextDisplay( Object *obj ) static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); - // santiy + // sanity DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); // format the message diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp index a858dae4aad..3a623cfa1d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp @@ -73,7 +73,7 @@ static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, Unsigne if( width > 0 && height > 0 ) { ICoord2D temp; - //First grab the percent increase/decrease compaired to the default size + //First grab the percent increase/decrease compared to the default size parent->winGetSize( &temp.x, &temp.y); ratioX = (float)width / (float)temp.x; ratioY = (float)height / (float)temp.y; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp index 8648fb28a34..1f525a22f3c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp @@ -54,7 +54,7 @@ WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt ms } //------------------------------------------------------------------------------------------------- -/** System callback for the IME Candidate widnow */ +/** System callback for the IME Candidate window */ //------------------------------------------------------------------------------------------------- WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) @@ -191,7 +191,7 @@ void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) selected = selected - first; UnicodeString number; - // calulate the widest number text + // calculate the widest number text Int width; Dstring->setText(L"00:"); width = Dstring->getWidth(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp index 5d2353454a2..09909af03cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp @@ -281,7 +281,7 @@ void doKeyDown(EntryData *e, UnicodeString mod ) e->text->setText( mod ); e->sText->setText( mod ); e->charPos = e->text->getTextLength(); - // try reseting all mods first + // try resetting all mods first setKeyDown( shift, false ); setKeyDown( alt, false ); setKeyDown( ctrl, false ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp index 63bdf6a7b71..e17d7253dd2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp @@ -773,7 +773,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, closeSaveMenu( window ); // - // given the context of this menu figure out which type of save game we're acutally + // given the context of this menu figure out which type of save game we're actually // saving right now. As it turns out, when this menu is used in the save only // mode it means that the save is a mission save between maps because you can only // save the game between maps and can of course not load one @@ -836,7 +836,7 @@ WindowMsgHandledType SaveLoadMenuSystem( GameWindow *window, UnsignedInt msg, AvailableGameInfo *selectedGameInfo = getSelectedSaveFileInfo( listboxGames ); // - // given the context of this menu figure out which type of save game we're acutally + // given the context of this menu figure out which type of save game we're actually // saving right now. As it turns out, when this menu is used in the save only // mode it means that the save is a mission save between maps because you can only // save the game between maps and can of course not load one diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp index 63829fde1ff..58e2183df2a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp @@ -255,7 +255,7 @@ static void restartMissionMenu() //------------------------------------------------------------------------------------------------- void HideQuitMenu( void ) { - // Note: This is called as a safety a lot, without checking for the prescence of the quit menu. + // Note: This is called as a safety a lot, without checking for the presence of the quit menu. // So don't do anything that counts on that menu actually being here. if(!isVisible) return; @@ -312,7 +312,7 @@ void ToggleQuitMenu() return; } - // if we're visable hide our quit menu + // if we're visible hide our quit menu if(isVisible && quitMenuLayout) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index bd6e95960b7..9aa48349c14 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1156,7 +1156,7 @@ void InitWOLGameGadgets( void ) if (isUsingStats) { // Recorded stats games can never limit superweapons, limit armies, or have inflated starting cash. - // This should probably be enforced at the gamespy level as well, to prevent expoits. + // This should probably be enforced at the gamespy level as well, to prevent exploits. checkBoxLimitSuperweapons->winEnable( FALSE ); comboBoxStartingCash->winEnable( FALSE ); checkBoxLimitArmies->winEnable( FALSE ); @@ -1373,7 +1373,7 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) game->setMap(customPref.getPreferredMap()); // Recorded stats games can never limit superweapons, limit armies, or have inflated starting cash. - // This should probably be enforced at the gamespy level as well, to prevent expoits. + // This should probably be enforced at the gamespy level as well, to prevent exploits. Int isUsingStats = TheGameSpyGame->getUseStats(); game->setStartingCash( isUsingStats? TheMultiplayerSettings->getDefaultStartingMoney() : customPref.getStartingCash() ); game->setSuperweaponRestriction( isUsingStats? 0 : customPref.getSuperweaponRestricted() ? 1 : 0 ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp index 07796e9a5ee..627ff843de6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp @@ -1052,7 +1052,7 @@ void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) if( comboBox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_SELECTION, 0, (WindowMsgData)selectedIndex ); } @@ -1067,7 +1067,7 @@ void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool if( comboBox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_SELECTION, selectedIndex, dontHide ); } // GadgetComboBoxSetItemData ================================================== diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp index 6f0ab398b0f..2066baaf940 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp @@ -178,7 +178,7 @@ static Int getListboxTopEntry( ListboxData *list ) { Int entry; - // determin which entry is at the top of the display area + // determine which entry is at the top of the display area for( entry=0; ; entry++ ) { if( list->listData[entry].listHeight > list->displayPos ) @@ -227,7 +227,7 @@ static void removeSelection( ListboxData *list, Int i ) } // adjustDisplay ============================================================== -/** Update Display List information inlcuding scrollbar */ +/** Update Display List information including scrollbar */ //============================================================================= static void adjustDisplay( GameWindow *window, Int adjustment, Bool updateSlider ) @@ -236,7 +236,7 @@ static void adjustDisplay( GameWindow *window, Int adjustment, SliderData *sData; ListboxData *list = (ListboxData *)window->winGetUserData(); - // determin which entry is at the top of the display area + // determine which entry is at the top of the display area entry = getListboxTopEntry( list ) + adjustment; if( entry < 0 ) @@ -2331,7 +2331,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) top = title ? (fontHeight + 1):0; bottom = title ? (height - (fontHeight + 1)):height; - // intialize instData + // initialize instData winInstData.init(); // size of button @@ -2385,7 +2385,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) sliderButtonWidth = buttonWidth;//GADGET_SIZE; sliderButtonHeight = GADGET_SIZE; - // intialize instData + // initialize instData winInstData.init(); winInstData.m_style = GWS_VERT_SLIDER; winInstData.m_owner = listbox; @@ -2394,7 +2394,7 @@ void GadgetListboxCreateScrollbar( GameWindow *listbox ) if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - // intialize sData + // initialize sData memset( &sData, 0, sizeof(SliderData) ); // Create Slider @@ -2626,7 +2626,7 @@ void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) if( listbox == nullptr ) return; - // get selected indeces via system message + // get selected indices via system message TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp index db8362a61cd..b63e95a659e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp @@ -544,7 +544,7 @@ Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ) if( instData == nullptr ) return FALSE; - // we just hold this "check like dual state thingie" using the selected state + // we just hold this "check like dual state thingy" using the selected state return BitIsSet( instData->m_state, WIN_STATE_SELECTED ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index be6599b4373..bef33d32710 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -67,7 +67,7 @@ // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -// GadgetVerticlaSliderInput ================================================== +// GadgetVerticalSliderInput ================================================== /** Handle input for vertical slider */ //============================================================================= WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt msg, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp index 983b9d4e94a..824570bade6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp @@ -116,7 +116,7 @@ void FontLibrary::deleteAllFonts( void ) // get temp pointer to this font font = m_fontList; - // remove font fron the list, this will change m_fontList + // remove font from the list, this will change m_fontList unlinkFont( font ); // release font data diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 315c4bf373a..573a946cb12 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -531,7 +531,7 @@ Int GameWindow::winSetPosition( Int x, Int y ) } // WinGetPosition ============================================================= -/** Get the window's postion */ +/** Get the window's position */ //============================================================================= Int GameWindow::winGetPosition( Int *x, Int *y ) { @@ -548,7 +548,7 @@ Int GameWindow::winGetPosition( Int *x, Int *y ) } // WinSetCursorPosition ============================================================= -/** Set the window's cursor postion */ +/** Set the window's cursor position */ //============================================================================= Int GameWindow::winSetCursorPosition( Int x, Int y ) { @@ -560,7 +560,7 @@ Int GameWindow::winSetCursorPosition( Int x, Int y ) } // WinGetCursorPosition ============================================================= -/** Get the window's cursor postion */ +/** Get the window's cursor position */ //============================================================================= Int GameWindow::winGetCursorPosition( Int *x, Int *y ) { @@ -579,7 +579,7 @@ Int GameWindow::winGetCursorPosition( Int *x, Int *y ) } // GameWindow::winGetScreenPosition =========================================== -/** Get the window's postion in screen coordinates */ +/** Get the window's position in screen coordinates */ //============================================================================= Int GameWindow::winGetScreenPosition( Int *x, Int *y ) { @@ -1193,7 +1193,7 @@ GameWindow *GameWindow::winGetParent( void ) } // GameWindow::winIsChild ===================================================== -/** Determins if a window is a child/grand-child of a parent */ +/** Determines if a window is a child/grand-child of a parent */ //============================================================================= Bool GameWindow::winIsChild( GameWindow *child ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp index 2fb169b0b03..01abb7a7a47 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp @@ -138,7 +138,7 @@ class IMEManager : public IMEManagerInterface Int m_result; ///< last IME message's winProc return code GameWindow *m_window; ///< window we are accepting input for - HIMC m_context; ///< Imput Manager Context + HIMC m_context; ///< Input Manager Context HIMC m_oldContext; ///< Previous IME comtext Int m_disabled; ///< IME disable count 0 = enabled Bool m_composing; ///< Are we currently composing a new string @@ -152,7 +152,7 @@ class IMEManager : public IMEManagerInterface Int m_pageSize; ///< Number of candidate per page Int m_selectedIndex; ///< Index of the currently selected candidate Int m_candidateCount; ///< Total number of candidate strings - UnicodeString *m_candidateString; ///< table of canidate strings + UnicodeString *m_candidateString; ///< table of candidate strings Bool m_unicodeIME; ///< Is this an unicode IME Int m_compositionCharsDisplayed; ///< number of temporary composition characters displayed that need to be replaced with result string. @@ -1099,7 +1099,7 @@ void IMEManager::updateCompositionString( void ) if ( m_context ) { - // try reading unicode directy + // try reading unicode directly LONG result = ImmGetCompositionStringW( m_context, GCS_COMPSTR, m_compositionString, MAX_COMPSTRINGLEN ); if ( result >= 0 ) @@ -1165,7 +1165,7 @@ void IMEManager::getResultsString ( void ) if ( m_context ) { - // try reading unicode directy + // try reading unicode directly LONG result = ImmGetCompositionStringW( m_context, GCS_RESULTSTR, m_resultsString, MAX_COMPSTRINGLEN ); if ( result >= 0 ) @@ -1244,7 +1244,7 @@ void IMEManager::openCandidateList( Int candidateFlags ) { return; } - // first get lastest candidate list info + // first get latest candidate list info updateCandidateList( candidateFlags ); resizeCandidateWindow( m_pageSize ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp index 1fbecab0fd7..3c060e685c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp @@ -77,7 +77,7 @@ ProcessAnimateWindowSlideFromRight::ProcessAnimateWindowSlideFromRight( void ) { m_maxVel.x = -40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -263,7 +263,7 @@ ProcessAnimateWindowSlideFromLeft::ProcessAnimateWindowSlideFromLeft( void ) { m_maxVel.x = 40.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -441,7 +441,7 @@ ProcessAnimateWindowSlideFromTop::ProcessAnimateWindowSlideFromTop( void ) { m_maxVel.y = 40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -620,7 +620,7 @@ ProcessAnimateWindowSlideFromBottom::ProcessAnimateWindowSlideFromBottom( void ) { m_maxVel.y = -40.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 80; // when widnows get this close to their resting + m_slowDownThreshold = 80; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 2.0f - m_slowDownRatio; // how fast the windows speed up @@ -1134,7 +1134,7 @@ ProcessAnimateWindowSlideFromTopFast::ProcessAnimateWindowSlideFromTopFast( void { m_maxVel.y = 60.0f; // top speed windows travel in x and y m_maxVel.x = 0.0f; - m_slowDownThreshold = 40; // when widnows get this close to their resting + m_slowDownThreshold = 40; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.67f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 4.0f - m_slowDownRatio; // how fast the windows speed up @@ -1317,7 +1317,7 @@ ProcessAnimateWindowSlideFromRightFast::ProcessAnimateWindowSlideFromRightFast( { m_maxVel.x = -80.0f; // top speed windows travel in x and y m_maxVel.y = 0.0f; - m_slowDownThreshold = 60; // when widnows get this close to their resting + m_slowDownThreshold = 60; // when windows get this close to their resting // positions they start to slow down m_slowDownRatio = 0.77f; // how fast the windows slow down (smaller slows quicker) m_speedUpRatio = 3.0f - m_slowDownRatio; // how fast the windows speed up diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index f1ae0af8f51..4698d2fd630 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -184,7 +184,7 @@ void Shell::update( void ) Int now = timeGetTime(); // - // we keep the shell updates fixed in time so that we can write consitent animation + // we keep the shell updates fixed in time so that we can write consistent animation // speeds during the screen update functions // if( now - lastUpdate >= ((1000.0f / shellUpdateDelay ) - 1) ) @@ -355,7 +355,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate ) WindowLayout *currentTop = top(); // - // if we have someting on the top of the stack we won't do the push + // if we have something on the top of the stack we won't do the push // right now, we will instead shutdown the top, and when the top tells // us it's done shutting down (via the shutdownComplete() method) we do // the push then diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp index 2fcdcfcb9c5..dbcf6699e4f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp @@ -59,7 +59,7 @@ WindowLayout::~WindowLayout( void ) { // - // it is the users responsability to remove windows from the layout beforing destroying the + // it is the users responsibility to remove windows from the layout before destroying the // layout itself. This allows for maximum flexibility of the window layouts and you can // use them in any you see fit, as long as they are clean when they go away // diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index e5bcfc4d3da..583721ff51e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -283,7 +283,7 @@ void GameClient::init( void ) { // - // NOTE: Make sure m_translators[] is large enough to accomodate all the translators you + // NOTE: Make sure m_translators[] is large enough to accommodate all the translators you // are loading here. See MAX_CLIENT_TRANSLATORS // @@ -526,7 +526,7 @@ void GameClient::update( void ) playSizzle = TRUE; } - //Initial Game Codition. We must show the movie first and then we can display the shell + //Initial Game Condition. We must show the movie first and then we can display the shell if(TheGlobalData->m_afterIntro && !TheDisplay->isMoviePlaying()) { if( playSizzle && TheGlobalData->m_playSizzle ) @@ -1046,7 +1046,7 @@ void GameClient::getRayEffectData( Drawable *draw, RayEffectData *effectData ) } //------------------------------------------------------------------------------------------------- -/** remove the drawble from the ray effects sytem if present */ +/** remove the drawble from the ray effects system if present */ void GameClient::removeFromRayEffects( Drawable *draw ) { @@ -1396,7 +1396,7 @@ void GameClient::xfer( Xfer *xfer ) // !!!DON'T DO THIS!!! ----> xfer->xferDrawableID( &m_nextDrawableID ); <---- !!!DON'T DO THIS!!! // - // xfer a table of contents that contain thing template and indentifier pairs. this + // xfer a table of contents that contain thing template and identifier pairs. this // table of contents is good for this save file only as unique numbers are only // generated and stored for the actual things that are on this map // @@ -1613,7 +1613,7 @@ void GameClient::loadPostProcess( void ) // // due to the fact that during the load process we have called newDrawable for drawables - // without objects, and then overwrote their ids with data from the save file, our allocater + // without objects, and then overwrote their ids with data from the save file, our allocator // id may be far higher than it needs to be. We'll pull it back down as low as we can // Drawable *draw; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 778ff8f7a6d..71d4a81bfd1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1193,7 +1193,7 @@ InGameUI::~InGameUI() // free custom ui strings freeCustomUiResources(); - // delete the array for the drawbles + // delete the array for the drawables delete [] m_placeIcon; m_placeIcon = nullptr; @@ -1576,7 +1576,7 @@ void InGameUI::handleBuildPlacements( void ) // // check to see if this is a legal location to build something at and tint or "un-tint" // the cursor icons as appropriate. This involves a pathfind which could be - // expensive so we don't want to do it on every frame (althought that would be ideal) + // expensive so we don't want to do it on every frame (although that would be ideal) // If we discover there are cases that this is just too slow we should increase the // delay time between checks or we need to come up with a way of recording what is // valid and what isn't or "fudge" the results to feel "ok" @@ -2485,7 +2485,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) if( obj ) { - //Ahh, here is a wierd exception: if the moused-over drawable is a mob-member + //Ahh, here is a weird exception: if the moused-over drawable is a mob-member //(e.g. AngryMob), Lets fool the UI into creating the hint for the NEXUS instead... if (obj->isKindOf( KINDOF_IGNORED_IN_GUI )) { @@ -3512,7 +3512,7 @@ const DrawableList *InGameUI::getAllSelectedLocalDrawables( void ) } //------------------------------------------------------------------------------------------------- -/** Return poiner to the first selected drawable, if any */ +/** Return pointer to the first selected drawable, if any */ //------------------------------------------------------------------------------------------------- Drawable *InGameUI::getFirstSelectedDrawable( void ) { @@ -3790,7 +3790,7 @@ void InGameUI::postDraw( void ) { // We don't draw our timers until we are finished with construction. - // It is important that let the SpecialPowerUpdate is add its timer in its contructor,, + // It is important that let the SpecialPowerUpdate is add its timer in its constructor,, // since the science for it could be added before construction is finished, // And thus the timer set to READY before the timer is first drawn, here if ( owningObject->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION )) @@ -3880,7 +3880,7 @@ void InGameUI::postDraw( void ) // draw the text if ( !m_superweaponHiddenByScript && !marginExceeded ) { - // Similarly, only checking timers is not truly indicitive of readyness. + // Similarly, only checking timers is not truly indicative of readiness. Bool changeBolding = (readySecs != info->m_timestamp) || (isReady != info->m_ready) || info->m_forceUpdateText; if (changeBolding) { @@ -4671,7 +4671,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c //Get the special power template. const SpecialPowerTemplate *spTemplate = command->getSpecialPowerTemplate(); - //Order of precendence: + //Order of precedence: //1) NO TARGET OR POS //2) COMMAND_OPTION_NEED_OBJECT_TARGET //3) NEED_TARGET_POS @@ -4795,7 +4795,7 @@ Bool InGameUI::canSelectedObjectsEffectivelyUseWeapon( const CommandButton *comm //Get the special power template. WeaponSlotType slot = command->getWeaponSlot(); - //Order of precendence: + //Order of precedence: //1) NO TARGET OR POS //2) COMMAND_OPTION_NEED_OBJECT_TARGET //3) NEED_TARGET_POS @@ -4927,7 +4927,7 @@ Int InGameUI::selectAllUnitsByTypeAcrossRegion( IRegion2D *region, KindOfMaskTyp } // ------------------------------------------------------------------------------------------------ -/** Selects maching units on the screen */ +/** Selects matching units on the screen */ // ------------------------------------------------------------------------------------------------ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) { @@ -4949,7 +4949,7 @@ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) draw = *it; if( draw && draw->getObject() && draw->getObject()->isLocallyControlled() ) { - // Use the Object's thing template, doing so will prevent wierdness for disguised vehicles. + // Use the Object's thing template, doing so will prevent weirdness for disguised vehicles. drawableList.insert( draw->getObject()->getTemplate() ); if( draw->getObject()->testStatus( OBJECT_STATUS_IS_CARBOMB ) ) { @@ -5045,7 +5045,7 @@ Int InGameUI::selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfM } // ------------------------------------------------------------------------------------------------ -/** Selects maching units on the screen */ +/** Selects matching units on the screen */ // ------------------------------------------------------------------------------------------------ Int InGameUI::selectMatchingAcrossScreen( void ) { @@ -5293,7 +5293,7 @@ void InGameUI::updateFloatingText( void ) FloatingTextData *ftd; // pointer to our floating point data UnsignedInt currLogicFrame = TheGameLogic->getFrame(); // the current logic frame UnsignedByte r, g, b, a; // we'll need to break apart our color so we can modify the alpha - Int amount; // The amout we'll change the alpha + Int amount; // The amount we'll change the alpha static UnsignedInt lastLogicFrameUpdate = currLogicFrame; // We need to make sure our current frame is different then our last frame we updated. // only update the position if we're incrementing frames @@ -5330,7 +5330,7 @@ void InGameUI::updateFloatingText( void ) } } - // increase our itterator + // increase our iterator ++it; } @@ -5791,7 +5791,7 @@ void InGameUI::selectNextIdleWorker( void ) selectDrawable( selectThisObject->getDrawable() ); - /*// removed becuase we're already playing a select sound... left in, just in case i"m wrong. + /*// removed because we're already playing a select sound... left in, just in case i"m wrong. // play the units sound const AudioEventRTS *soundEvent = selectThisObject->getTemplate()->getVoiceSelect(); if (soundEvent) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp index fd49fd14433..25c358d358d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp @@ -714,7 +714,7 @@ Keyboard::~Keyboard( void ) } //------------------------------------------------------------------------------------------------- -/** Initialzie the keyboard */ +/** Initialize the keyboard */ //------------------------------------------------------------------------------------------------- void Keyboard::init( void ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 4080491eedf..89aeeff58be 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -672,7 +672,7 @@ void Mouse::update( void ) void Mouse::createStreamMessages( void ) { - // santiy + // sanity if( TheMessageStream == nullptr ) return; // no place to put messages @@ -1145,7 +1145,7 @@ void Mouse::drawTooltip( void ) return; } - /// @todo: Still need to put in display logic so it puts the tool tips in a visable position on the edge of the screen + /// @todo: Still need to put in display logic so it puts the tool tips in a visible position on the edge of the screen if( m_displayTooltip && TheDisplay && m_tooltipDisplayString && (m_tooltipDisplayString->getTextLength() > 0) && !m_isTooltipEmpty) { Int width, xPos; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp index 227695aa473..19267f6204a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Line2D.cpp @@ -263,7 +263,7 @@ Bool IntersectLine2D( const Coord2D *a, const Coord2D *b, return false; } -// determines whether a point lies within a rectangle. Doesnt' determine whether the shape is +// determines whether a point lies within a rectangle. Doesn't determine whether the shape is // actually a rectangle or not. Bool PointInsideRect2D(const Coord2D *bl, const Coord2D *tl, const Coord2D *br, const Coord2D *tr, const Coord2D *inputPoint) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 140e50322cf..df0d7a19486 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -344,7 +344,7 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, } } } - else // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + else // oh dear me. The weird case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase { ContainModuleInterface *contain = obj->getContain(); if ( contain ) @@ -388,7 +388,7 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, else { result = obj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, nullptr, pos, CMD_FROM_PLAYER ); - if( result != ATTACKRESULT_POSSIBLE ) // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + if( result != ATTACKRESULT_POSSIBLE ) // oh dear me. The weird case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase { ContainModuleInterface *contain = obj->getContain(); if ( contain ) @@ -1654,7 +1654,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, { if( obj && obj->isKindOf( KINDOF_SHRUBBERY ) && !BitIsSet( command->getOptions(), ALLOW_SHRUBBERY_TARGET ) ) { - //If our object is a shrubbery, and we don't allow targetting it... then null it out. + //If our object is a shrubbery, and we don't allow targeting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. draw = nullptr; @@ -1663,7 +1663,7 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, if( obj && obj->isKindOf( KINDOF_MINE ) && !BitIsSet( command->getOptions(), ALLOW_MINE_TARGET ) ) { - //If our object is a mine, and we don't allow targetting it... then null it out. + //If our object is a mine, and we don't allow targeting it... then null it out. //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. draw = nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 2c2e39d2bf2..3130e9ded04 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -74,7 +74,7 @@ static Bool TheDebugSelectionMode = false; //----------------------------------------------------------------------------- static Bool currentlyLookingForSelection( ) { - // This needs to check if we are currently targetting for special weapons fire. + // This needs to check if we are currently targeting for special weapons fire. return TheInGameUI->getGUICommand() == nullptr; } @@ -372,7 +372,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa if( !TheInGameUI->getInputEnabled() ) { - //Keep the message so the other translaters (WindowXlat) can handle. + //Keep the message so the other translators (WindowXlat) can handle. if( m_dragSelecting ) { //Turn off drag select @@ -1008,7 +1008,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa else { //In alternate mouse mode, right click still cancels building placement. - // TheSuperHackers @tweak Stubbjax 08/08/2025 Cancelling building placement no longer deselects the builder. + // TheSuperHackers @tweak Stubbjax 08/08/2025 Canceling building placement no longer deselects the builder. if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID) { TheInGameUI->placeBuildAvailable(nullptr, nullptr); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index 9a4b5ac02bf..d97380aff95 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -163,7 +163,7 @@ WindowTranslator::~WindowTranslator() // WindowTranslator =========================================================== /** Window translator that monitors raw input messages on the stream and - * acts on anything relavant to the windowing system */ + * acts on anything relevant to the windowing system */ //============================================================================= GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage *msg) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp index 34de5af2b15..3499a0f4412 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -854,7 +854,7 @@ void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) if( anim->m_collectionSystem != this ) return; - // unlink from our instnace list + // unlink from our instance list if( anim->m_collectionSystemNext ) anim->m_collectionSystemNext->m_collectionSystemPrev = anim->m_collectionSystemPrev; if( anim->m_collectionSystemPrev ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index 3d9511ed6b8..8ab27150cc3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -27,7 +27,7 @@ // Desc: High level representation of images, this is currently being // written so we have a way to refer to images in the windows // GUI, this system should be replaced with something that can -// handle real image management or written to accomodate +// handle real image management or written to accommodate // all parts of the engine that need images. /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 7e0be3c505a..7202e1134c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -549,7 +549,7 @@ void Particle::doWindMotion( void ) windForceStrength *= (1.0f - ((distFromWind - fullForceDistance) / (noForceDistance - fullForceDistance))); - // integate the wind motion into the position + // integrate the wind motion into the position m_pos.x += (Cos( windAngle ) * windForceStrength); m_pos.y += (Sin( windAngle ) * windForceStrength); @@ -2194,7 +2194,7 @@ void ParticleSystem::updateWindMotion( void ) case ParticleSystemInfo::WIND_MOTION_CIRCULAR: { - // give us a wind angle change if one hasn't been specifed (this plays nice with the particle editor) + // give us a wind angle change if one hasn't been specified (this plays nice with the particle editor) if( m_windAngleChange == 0.0f ) m_windAngleChange = GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); @@ -2269,7 +2269,7 @@ void ParticleSystem::removeParticle( Particle *particleToRemove ) if (particleToRemove->m_systemPrev) particleToRemove->m_systemPrev->m_systemNext = particleToRemove->m_systemNext; - // update head & tail if neccessary + // update head & tail if necessary if (particleToRemove == m_systemParticlesHead) m_systemParticlesHead = particleToRemove->m_systemNext; if (particleToRemove == m_systemParticlesTail) @@ -3129,7 +3129,7 @@ void ParticleSystemManager::removeParticle( Particle *particleToRemove) if (particleToRemove->m_overallPrev) particleToRemove->m_overallPrev->m_overallNext = particleToRemove->m_overallNext; - // update head & tail if neccessary + // update head & tail if necessary if (particleToRemove == m_allParticlesHead[ priority ]) m_allParticlesHead[ priority ] = particleToRemove->m_overallNext; if (particleToRemove == m_allParticlesTail[ priority ]) From 8913a77741c016c5cd64f0969d967907b4f5749e Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 17 Jan 2026 14:13:32 -0500 Subject: [PATCH 064/211] ci: Add workflow to trigger build from any commit for replay mismatch testing (#2114) --- .github/workflows/build-historical.yml | 278 +++++++++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 .github/workflows/build-historical.yml diff --git a/.github/workflows/build-historical.yml b/.github/workflows/build-historical.yml new file mode 100644 index 00000000000..46dd7daa7f3 --- /dev/null +++ b/.github/workflows/build-historical.yml @@ -0,0 +1,278 @@ +name: Build Historical + +permissions: + contents: write + +on: + workflow_dispatch: + inputs: + commit: + description: 'Commit SHA to build' + required: true + type: string + pull_requests: + description: 'PR numbers to cherry-pick (comma-separated, e.g., "545,876")' + required: false + default: '' + type: string + game: + description: 'Game to build' + required: true + default: 'GeneralsMD' + type: choice + options: + - 'Generals' + - 'GeneralsMD' + - 'Both' + create_release: + description: 'Create a GitHub release' + required: false + default: 'true' + type: choice + options: + - 'true' + - 'false' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.inputs.commit }} + cancel-in-progress: false + +jobs: + prepare: + name: Prepare Build Info + runs-on: ubuntu-latest + outputs: + short_sha: ${{ steps.info.outputs.short_sha }} + commit_date: ${{ steps.info.outputs.commit_date }} + commit_subject: ${{ steps.info.outputs.commit_subject }} + release_tag: ${{ steps.info.outputs.release_tag }} + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Gather Commit Info + id: info + run: | + COMMIT="${{ github.event.inputs.commit }}" + + if ! git cat-file -e "$COMMIT^{commit}" 2>/dev/null; then + echo "::error::Commit $COMMIT not found in repository" + exit 1 + fi + + SHORT_SHA=$(git rev-parse --short=7 "$COMMIT") + COMMIT_DATE=$(git show -s --format=%cs "$COMMIT") + COMMIT_SUBJECT=$(git show -s --format=%s "$COMMIT" | head -c 80) + + PR_SUFFIX="" + if [ -n "${{ github.event.inputs.pull_requests }}" ]; then + PR_SUFFIX="+pr${{ github.event.inputs.pull_requests }}" + fi + RELEASE_TAG="historical-${COMMIT_DATE}-${SHORT_SHA}${PR_SUFFIX}" + + echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT + echo "commit_date=$COMMIT_DATE" >> $GITHUB_OUTPUT + echo "commit_subject=$COMMIT_SUBJECT" >> $GITHUB_OUTPUT + echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT + + echo "### Build Info" >> $GITHUB_STEP_SUMMARY + echo "- Commit: \`$COMMIT\` ($SHORT_SHA)" >> $GITHUB_STEP_SUMMARY + echo "- Date: $COMMIT_DATE" >> $GITHUB_STEP_SUMMARY + echo "- Subject: $COMMIT_SUBJECT" >> $GITHUB_STEP_SUMMARY + echo "- PRs to apply: ${{ github.event.inputs.pull_requests || 'none' }}" >> $GITHUB_STEP_SUMMARY + echo "- Release tag: $RELEASE_TAG" >> $GITHUB_STEP_SUMMARY + + build: + name: Build ${{ matrix.game }} vc6 + needs: prepare + runs-on: windows-2022 + timeout-minutes: 30 + strategy: + matrix: + game: ${{ github.event.inputs.game == 'Both' && fromJson('["Generals", "GeneralsMD"]') || fromJson(format('["{0}"]', github.event.inputs.game)) }} + fail-fast: false + + steps: + - name: Checkout Target Commit + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.commit }} + fetch-depth: 0 + + - name: Apply Pull Requests + if: ${{ github.event.inputs.pull_requests != '' }} + shell: bash + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + PR_LIST="${{ github.event.inputs.pull_requests }}" + IFS=',' read -ra PRS <<< "$PR_LIST" + + for PR in "${PRS[@]}"; do + PR=$(echo "$PR" | xargs) + echo "::group::Applying PR #$PR" + + git fetch origin "pull/$PR/head:pr-$PR" + + PR_BASE=$(git merge-base pr-$PR HEAD) + PR_COMMITS=$(git rev-list --reverse "$PR_BASE..pr-$PR") + + for COMMIT in $PR_COMMITS; do + echo "Cherry-picking $COMMIT" + if ! git cherry-pick --no-commit "$COMMIT"; then + echo "::error::Failed to cherry-pick commit $COMMIT from PR #$PR" + git cherry-pick --abort || true + exit 1 + fi + done + + git commit -m "Apply PR #$PR" || echo "No changes to commit for PR #$PR" + echo "::endgroup::" + done + + - name: Cache VC6 Installation + id: cache-vc6 + uses: actions/cache@v4 + with: + path: C:\VC6 + key: vc6-permanent-cache-v2 + + - name: Download VC6 Portable + if: ${{ steps.cache-vc6.outputs.cache-hit != 'true' }} + env: + EXPECTED_HASH: "D0EE1F6DCEF7DB3AD703120D9FB4FAD49EBCA28F44372E40550348B1C00CA583" + VC6_COMMIT: "001c4bafdcf2ef4b474d693acccd35a91e848f40" + shell: pwsh + run: | + Invoke-WebRequest -Uri https://github.com/itsmattkc/MSVC600/archive/$env:VC6_COMMIT.zip -OutFile VS6_VisualStudio6.zip + + $fileHash = (Get-FileHash -Path VS6_VisualStudio6.zip -Algorithm SHA256).Hash + if ($fileHash -ne $env:EXPECTED_HASH) { + Write-Error "Hash verification failed!" + exit 1 + } + + Expand-Archive -Path VS6_VisualStudio6.zip -DestinationPath C:\VC6 + Move-Item -Path C:\VC6\MSVC600-$env:VC6_COMMIT -Destination C:\VC6\VC6SP6 + Remove-Item VS6_VisualStudio6.zip + + - name: Set Up VC6 Environment + shell: pwsh + run: | + $VSCommonDir = "C:\VC6\VC6SP6\Common" + $MSDevDir = "C:\VC6\VC6SP6\Common\msdev98" + $MSVCDir = "C:\VC6\VC6SP6\VC98" + $VcOsDir = "WINNT" + + "VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV + "MSDevDir=$MSDevDir" >> $env:GITHUB_ENV + "MSVCDir=$MSVCDir" >> $env:GITHUB_ENV + "VcOsDir=$VcOsDir" >> $env:GITHUB_ENV + "PATH=$MSDevDir\BIN;$MSVCDir\BIN;$VSCommonDir\TOOLS\$VcOsDir;$VSCommonDir\TOOLS;$env:PATH" >> $env:GITHUB_ENV + "INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV + "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV + + - name: Configure with CMake + shell: pwsh + run: | + $buildFlags = @( + "-DRTS_BUILD_ZEROHOUR=${{ matrix.game == 'GeneralsMD' && 'ON' || 'OFF' }}", + "-DRTS_BUILD_GENERALS=${{ matrix.game == 'Generals' && 'ON' || 'OFF' }}", + "-DRTS_BUILD_CORE_TOOLS=ON", + "-DRTS_BUILD_${{ matrix.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}_TOOLS=ON" + ) + cmake --preset vc6 $buildFlags + + - name: Build with CMake + shell: pwsh + run: | + cmake --build --preset vc6 + + - name: Collect Artifacts + shell: pwsh + run: | + $buildDir = "build\vc6" + $artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ matrix.game }}\artifacts" + + $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ matrix.game }}" -File | + Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } + + $files | Move-Item -Destination $artifactsDir -Force + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.game }}-vc6-${{ needs.prepare.outputs.short_sha }} + path: build\vc6\${{ matrix.game }}\artifacts + retention-days: 90 + + create-release: + name: Create Release + needs: [prepare, build] + if: ${{ github.event.inputs.create_release == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Download Generals Artifact + if: ${{ github.event.inputs.game == 'Generals' || github.event.inputs.game == 'Both' }} + uses: actions/download-artifact@v4 + with: + name: Generals-vc6-${{ needs.prepare.outputs.short_sha }} + path: generals-artifacts + + - name: Download GeneralsMD Artifact + if: ${{ github.event.inputs.game == 'GeneralsMD' || github.event.inputs.game == 'Both' }} + uses: actions/download-artifact@v4 + with: + name: GeneralsMD-vc6-${{ needs.prepare.outputs.short_sha }} + path: generalsmd-artifacts + + - name: Prepare Release Archives + run: | + if [ -d "generals-artifacts" ]; then + zip -jr generals-${{ needs.prepare.outputs.release_tag }}.zip generals-artifacts/* + fi + if [ -d "generalsmd-artifacts" ]; then + zip -jr generalszh-${{ needs.prepare.outputs.release_tag }}.zip generalsmd-artifacts/* + fi + + - name: Generate Release Notes + id: notes + run: | + BODY="## Historical Build + + **Commit:** \`${{ github.event.inputs.commit }}\` + **Date:** ${{ needs.prepare.outputs.commit_date }} + **Subject:** ${{ needs.prepare.outputs.commit_subject }}" + + if [ -n "${{ github.event.inputs.pull_requests }}" ]; then + BODY="${BODY} + + **Applied PRs:** ${{ github.event.inputs.pull_requests }}" + fi + + BODY="${BODY} + + --- + *Built for replay compatibility testing.*" + + echo "body<> $GITHUB_OUTPUT + echo "$BODY" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ needs.prepare.outputs.release_tag }} + name: ${{ needs.prepare.outputs.release_tag }} + prerelease: true + body: ${{ steps.notes.outputs.body }} + files: | + generals-${{ needs.prepare.outputs.release_tag }}.zip + generalszh-${{ needs.prepare.outputs.release_tag }}.zip + fail_on_unmatched_files: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b398d5cc94d3418a33314cdf2db3cb4cb9bb657d Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sat, 17 Jan 2026 20:16:06 +0100 Subject: [PATCH 065/211] bugfix(audio): Restore retail compatibility after optimization change in AudioManager::addAudioEvent (#2132) --- .../Source/Common/Audio/GameAudio.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 17dcb2f6ad6..b29b155a9bb 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -443,10 +443,14 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) break; } - if (!eventToAdd->getUninterruptable()) { - if (!shouldPlayLocally(eventToAdd)) { - return AHSV_NotForLocal; - } + // TheSuperHackers @info Scripted audio events are logical, i.e. synchronized across clients. + // This early return cannot be taken for such audio events as it skips code that changes the logical game seed values. + const Bool logicalAudio = eventToAdd->getIsLogicalAudio(); + const Bool notForLocal = !eventToAdd->getUninterruptable() && !shouldPlayLocally(eventToAdd); + + if (!logicalAudio && notForLocal) + { + return AHSV_NotForLocal; } AudioEventRTS *audioEvent = MSGNEW("AudioEventRTS") AudioEventRTS(*eventToAdd); // poolify @@ -463,6 +467,12 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) } } + if (notForLocal) + { + releaseAudioEventRTS(audioEvent); + return AHSV_NotForLocal; + } + // cull muted audio if (audioEvent->getVolume() < m_audioSettings->m_minVolume) { #ifdef INTENSIVE_AUDIO_DEBUG From fcc193a66a7c575e95ee2f201622aca55e581267 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 10:49:04 +0100 Subject: [PATCH 066/211] bugfix(script): Restore retail compatibility for sequential scripts in ScriptEngine (#2129) --- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 11 +++++++---- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 72d63deea2c..815a9574ead 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -7155,12 +7155,13 @@ void ScriptEngine::setSequentialTimer(Team *team, Int frameCount) void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) { VecSequentialScriptPtrIt it; - SequentialScript* lastScript = nullptr; + size_t currIndex = 0; + size_t prevIndex = ~0u; Bool itAdvanced = false; Int spinCount = 0; for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) { - if ((*it) == lastScript) { + if (currIndex == prevIndex) { ++spinCount; } else { spinCount = 0; @@ -7173,11 +7174,11 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) seqScript->m_scriptToExecuteSequentially->getName().str())); } ++it; + ++currIndex; continue; } - lastScript = (*it); - + prevIndex = currIndex; itAdvanced = false; SequentialScript *seqScript = (*it); @@ -7285,6 +7286,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) // Check to see if executing our action told us to wait. If so, skip to the next Sequential script if (seqScript->m_dontAdvanceInstruction) { ++it; + ++currIndex; itAdvanced = true; continue; } @@ -7338,6 +7340,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) if (!itAdvanced) { ++it; + ++currIndex; } } m_currentPlayer = nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index b9702235210..13ccb3db78f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -7878,12 +7878,13 @@ void ScriptEngine::setSequentialTimer(Team *team, Int frameCount) void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) { VecSequentialScriptPtrIt it; - SequentialScript* lastScript = nullptr; + size_t currIndex = 0; + size_t prevIndex = ~0u; Bool itAdvanced = false; Int spinCount = 0; for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) { - if ((*it) == lastScript) { + if (currIndex == prevIndex) { ++spinCount; } else { spinCount = 0; @@ -7896,11 +7897,11 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) seqScript->m_scriptToExecuteSequentially->getName().str())); } ++it; + ++currIndex; continue; } - lastScript = (*it); - + prevIndex = currIndex; itAdvanced = false; SequentialScript *seqScript = (*it); @@ -8008,6 +8009,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) // Check to see if executing our action told us to wait. If so, skip to the next Sequential script if (seqScript->m_dontAdvanceInstruction) { ++it; + ++currIndex; itAdvanced = true; continue; } @@ -8061,6 +8063,7 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) if (!itAdvanced) { ++it; + ++currIndex; } } m_currentPlayer = nullptr; From 20293864eecd63eb058e57137a671048cff41d40 Mon Sep 17 00:00:00 2001 From: Sebyx07 Date: Sun, 18 Jan 2026 05:43:35 -0500 Subject: [PATCH 067/211] feat(build): Add new docker build and game install scripts for Linux (#2085) Add convenience scripts for Linux users to build using Docker: - scripts/build-linux.sh: Docker-based build script for Linux that wraps the existing Docker infrastructure with Wine and VC6 toolchain - scripts/install-to-game.sh: Script to install built files to existing game installation with backup/restore support - .gitignore: Add /tmp/, /.claude/, /CLAUDE.md to ignored paths - README.md: Add quick start build section for Windows and Linux The Linux build uses the existing Docker infrastructure in resources/dockerbuild to produce Windows-compatible executables that can run under Wine. Usage: ./scripts/build-linux.sh # Build using Docker ./scripts/install-to-game.sh --detect # Install to your game --- .gitignore | 5 + README.md | 20 +- scripts/docker-build.sh | 274 ++++++++++++++++++++++++++ scripts/docker-install.sh | 405 ++++++++++++++++++++++++++++++++++++++ scripts/dockerbuild.sh | 12 +- 5 files changed, 712 insertions(+), 4 deletions(-) create mode 100755 scripts/docker-build.sh create mode 100755 scripts/docker-install.sh diff --git a/.gitignore b/.gitignore index 07b7c71d282..c8d724bcaef 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,11 @@ thumbs.db .clang-format /.vscode /Dependencies/MaxSDK/maxsdk +/tmp/ + +## AI assistant config (user-specific) +/.claude/ +/CLAUDE.md ## IntelliJ, CLion, etc. /.idea diff --git a/README.md b/README.md index 27149141ca0..84093136b79 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,23 @@ report bugs, and contribute to the project! ## Building the Game Yourself -We provide support for building the project using Visual Studio 6 (VS6) and Visual Studio 2022. For detailed build -instructions, check the [Wiki](https://github.com/TheSuperHackers/GeneralsGameCode/wiki/build_guides), which also -includes guides for building with Docker, CLion, and links to forks supporting additional versions. +We provide support for building the project on Windows and Linux. For detailed build instructions, check the +[Wiki](https://github.com/TheSuperHackers/GeneralsGameCode/wiki/build_guides), which includes guides for VS6, VS2022, +Docker, CLion, and links to forks supporting additional versions. + +### Quick Start + +**Windows (Visual Studio 2022)** +```bash +cmake --preset win32 +cmake --build build/win32 --config Release +``` + +**Linux (via Docker)** +```bash +./scripts/docker-build.sh # Build using Docker +./scripts/docker-install.sh --detect # Install to your game +``` ### Dependency management diff --git a/scripts/docker-build.sh b/scripts/docker-build.sh new file mode 100755 index 00000000000..46acd855bdf --- /dev/null +++ b/scripts/docker-build.sh @@ -0,0 +1,274 @@ +#!/usr/bin/env bash +# +# Build script for compiling Generals/Zero Hour on Linux using Docker +# +# This script builds Windows executables using a Docker container with Wine and VC6. +# The resulting binaries can be run on Linux using Wine or on Windows natively. +# +# Usage: +# ./scripts/docker-build.sh # Full build (both games) +# ./scripts/docker-build.sh --game zh # Build Zero Hour only +# ./scripts/docker-build.sh --game generals # Build Generals only +# ./scripts/docker-build.sh --target generalszh # Build specific target +# ./scripts/docker-build.sh --clean # Clean build directory +# ./scripts/docker-build.sh --interactive # Enter container shell +# + +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +PROJECT_DIR="$(dirname "$SCRIPT_DIR")" +BUILD_DIR="$PROJECT_DIR/build/docker" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +print_header() { + echo -e "${BLUE}======================================${NC}" + echo -e "${BLUE} Generals Game Code - Linux Builder${NC}" + echo -e "${BLUE}======================================${NC}" + echo "" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +usage() { + cat </dev/null; then + print_error "Docker is not installed. Please install Docker first." + echo " See: https://docs.docker.com/engine/install/" + exit 1 + fi + + if ! docker info &>/dev/null; then + print_error "Docker daemon is not running or you don't have permission." + echo " Try: sudo systemctl start docker" + echo " Or add your user to the docker group: sudo usermod -aG docker \$USER" + exit 1 + fi + + print_success "All dependencies satisfied" +} + +build_docker_image() { + print_info "Building Docker image (this may take a while on first run)..." + + docker build \ + --build-arg UID="$(id -u)" \ + --build-arg GID="$(id -g)" \ + "$PROJECT_DIR/resources/dockerbuild" \ + -t zerohour-build \ + || { + print_error "Failed to build Docker image" + exit 1 + } + + print_success "Docker image ready" +} + +run_build() { + local force_cmake="$1" + local target="$2" + local interactive="$3" + + local docker_flags="" + if [[ "$interactive" == "true" ]]; then + docker_flags="-it --entrypoint bash" + fi + + print_info "Starting build..." + if [[ -n "$target" ]]; then + print_info "Target: $target" + fi + + # shellcheck disable=SC2086 + docker run \ + -u "$(id -u):$(id -g)" \ + -e MAKE_TARGET="$target" \ + -e FORCE_CMAKE="$force_cmake" \ + -v "$PROJECT_DIR:/build/cnc" \ + --rm \ + $docker_flags \ + zerohour-build \ + || { + print_error "Build failed" + exit 1 + } + + if [[ "$interactive" != "true" ]]; then + print_success "Build completed" + fi +} + +clean_build() { + print_info "Cleaning build directory..." + rm -rf "$BUILD_DIR" + print_success "Build directory cleaned" +} + +list_outputs() { + echo "" + print_info "Build outputs:" + echo "" + + if [[ -d "$BUILD_DIR/GeneralsMD" ]]; then + echo "Zero Hour (GeneralsMD):" + find "$BUILD_DIR/GeneralsMD" -maxdepth 1 -name "*.exe" -printf " %f (%s bytes)\n" 2>/dev/null || true + fi + + if [[ -d "$BUILD_DIR/Generals" ]]; then + echo "" + echo "Generals:" + find "$BUILD_DIR/Generals" -maxdepth 1 -name "*.exe" -printf " %f (%s bytes)\n" 2>/dev/null || true + fi +} + +# Parse arguments +GAME="all" +TARGET="" +CLEAN=false +INTERACTIVE=false +FORCE_CMAKE=false + +while [[ $# -gt 0 ]]; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + -g|--game) + GAME="$2" + shift 2 + ;; + -t|--target) + TARGET="$2" + shift 2 + ;; + -c|--clean) + CLEAN=true + shift + ;; + -i|--interactive) + INTERACTIVE=true + shift + ;; + --cmake) + FORCE_CMAKE=true + shift + ;; + -j|--jobs) + # Jobs are handled by ninja in the container + shift 2 + ;; + -*) + print_error "Unknown option: $1" + usage + exit 1 + ;; + *) + # Positional argument treated as target + TARGET="$TARGET $1" + shift + ;; + esac +done + +# Set target based on game selection +if [[ -z "$TARGET" ]]; then + case "$GAME" in + zh|zerohour) + TARGET="generalszh generalszh_tools" + ;; + generals) + TARGET="generalsv generalsv_tools" + ;; + all) + TARGET="" # Build all + ;; + *) + print_error "Unknown game: $GAME (use 'zh', 'generals', or 'all')" + exit 1 + ;; + esac +fi + +# Main execution +print_header +check_dependencies + +if [[ "$CLEAN" == "true" ]]; then + clean_build +fi + +build_docker_image +run_build "$FORCE_CMAKE" "$TARGET" "$INTERACTIVE" + +if [[ "$INTERACTIVE" != "true" ]]; then + list_outputs + + echo "" + print_info "To run the game with Wine:" + echo " wine $BUILD_DIR/GeneralsMD/generalszh.exe" +fi diff --git a/scripts/docker-install.sh b/scripts/docker-install.sh new file mode 100755 index 00000000000..12135de56c8 --- /dev/null +++ b/scripts/docker-install.sh @@ -0,0 +1,405 @@ +#!/usr/bin/env bash +# +# Install built executables to an existing Generals/Zero Hour installation +# +# This script copies the built executables and tools to a game installation, +# allowing you to test your compiled version with the full game data. +# +# Usage: +# ./scripts/docker-install.sh /path/to/game/installation +# ./scripts/docker-install.sh --detect # Auto-detect game location +# ./scripts/docker-install.sh --restore # Restore original files +# + +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +PROJECT_DIR="$(dirname "$SCRIPT_DIR")" +BUILD_DIR="$PROJECT_DIR/build/docker" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; } +print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; } +print_error() { echo -e "${RED}[ERROR]${NC} $1"; } +print_info() { echo -e "${BLUE}[INFO]${NC} $1"; } + +usage() { + cat </dev/null; then + for key in \ + "HKLM\\SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour" \ + "HKLM\\SOFTWARE\\WOW6432Node\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"; do + local install_path + install_path=$(reg.exe query "$key" //v "InstallPath" 2>/dev/null | grep -oP 'REG_SZ\s+\K.*' | tr -d '\r') + if [ -n "$install_path" ] && [ -d "$install_path/Data" ]; then + candidates+=("$install_path") + fi + done + fi + + # Check Wine registry (for Linux with Wine) + for reg_file in ~/.wine/system.reg ~/.wine32/system.reg; do + if [ -f "$reg_file" ]; then + local install_path + install_path=$(grep -A1 '\[Software\\\\Electronic Arts\\\\EA Games\\\\Command and Conquer Generals Zero Hour\]' "$reg_file" 2>/dev/null | grep -oP '"InstallPath"="\K[^"]+' | sed 's/\\\\x0//g; s/\\\\/\//g; s/^C:/~\/.wine\/drive_c/') + if [ -n "$install_path" ] && [ -d "$install_path/Data" ]; then + candidates+=("$install_path") + fi + fi + done + + # Fallback: Common Linux Wine locations + for prefix in ~/.wine ~/.wine32 ~/.wine-*; do + if [ -d "$prefix" ]; then + for path in \ + "$prefix/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour" \ + "$prefix/drive_c/Program Files (x86)/EA Games/Command and Conquer Generals Zero Hour" \ + "$prefix/drive_c/Program Files/DODI-Repacks/Generals Zero Hour" \ + "$prefix/drive_c/GOG Games/Command Conquer Generals Zero Hour"; do + if [ -d "$path/Data" ]; then + candidates+=("$path") + fi + done + fi + done + + # Steam Proton prefixes (for games run through Proton) + for prefix in ~/.local/share/Steam/steamapps/compatdata/*/pfx; do + if [ -d "$prefix" ]; then + for path in \ + "$prefix/drive_c/Program Files/EA Games/Command and Conquer Generals Zero Hour" \ + "$prefix/drive_c/Program Files (x86)/EA Games/Command and Conquer Generals Zero Hour"; do + if [ -d "$path/Data" ]; then + candidates+=("$path") + fi + done + fi + done + + # Steam native game installations (steamapps/common) + for path in \ + ~/.local/share/Steam/steamapps/common/"Command and Conquer Generals Zero Hour" \ + ~/.local/share/Steam/steamapps/common/"Command & Conquer Generals - Zero Hour" \ + ~/.steam/steam/steamapps/common/"Command and Conquer Generals Zero Hour" \ + ~/.steam/steam/steamapps/common/"Command & Conquer Generals - Zero Hour"; do + if [ -d "$path/Data" ]; then + candidates+=("$path") + fi + done + + # Fallback: Windows paths (for Git Bash/WSL) + for path in \ + "/c/Program Files/EA Games/Command and Conquer Generals Zero Hour" \ + "/c/Program Files (x86)/EA Games/Command and Conquer Generals Zero Hour" \ + "C:/Program Files/EA Games/Command and Conquer Generals Zero Hour" \ + "C:/Program Files (x86)/EA Games/Command and Conquer Generals Zero Hour"; do + if [ -d "$path/Data" ]; then + candidates+=("$path") + fi + done + + if [ ${#candidates[@]} -eq 0 ]; then + print_error "No game installation found" >&2 + echo "" >&2 + echo "Please specify the game directory manually:" >&2 + echo " $(basename "$0") /path/to/game/installation" >&2 + exit 1 + fi + + if [ ${#candidates[@]} -eq 1 ]; then + echo "${candidates[0]}" + return + fi + + echo "Found multiple installations:" >&2 + for i in "${!candidates[@]}"; do + echo " $((i+1)). ${candidates[$i]}" >&2 + done + echo "" >&2 + read -p "Select installation (1-${#candidates[@]}): " selection >&2 + if [[ ! "$selection" =~ ^[0-9]+$ ]] || [ "$selection" -lt 1 ] || [ "$selection" -gt "${#candidates[@]}" ]; then + print_error "Invalid selection" >&2 + exit 1 + fi + echo "${candidates[$((selection-1))]}" +} + +check_build() { + if [ ! -d "$BUILD_DIR" ]; then + print_error "Build directory not found: $BUILD_DIR" + echo "" + echo "Please build the project first:" + echo " ./scripts/docker-build.sh" + exit 1 + fi + + if [ ! -f "$BUILD_DIR/GeneralsMD/generalszh.exe" ]; then + print_error "Built executables not found" + echo "" + echo "Please build the project first:" + echo " ./scripts/docker-build.sh" + exit 1 + fi + + print_success "Build directory found" +} + +backup_file() { + local file="$1" + local backup="${file}.backup" + + if [ -f "$file" ] && [ ! -f "$backup" ]; then + cp "$file" "$backup" + print_info "Backed up: $(basename "$file")" + fi +} + +install_file() { + local src="$1" + local dest="$2" + local dry_run="${3:-false}" + + if [ "$dry_run" == "true" ]; then + echo " Would copy: $(basename "$src") -> $dest" + else + backup_file "$dest" + cp "$src" "$dest" + print_success "Installed: $(basename "$src")" + fi +} + +install_game() { + local game_dir="$1" + local game_type="$2" # "zh" or "generals" + local dry_run="${3:-false}" + + local data_dir="$game_dir/Data" + local build_game_dir + local exe_name + local tools_prefix + + if [ "$game_type" == "zh" ]; then + build_game_dir="$BUILD_DIR/GeneralsMD" + exe_name="generalszh.exe" + tools_prefix="ZH" + else + build_game_dir="$BUILD_DIR/Generals" + exe_name="generalsv.exe" + tools_prefix="V" + fi + + if [ ! -d "$build_game_dir" ]; then + print_warning "Build for $game_type not found, skipping" + return + fi + + print_info "Installing $game_type executables..." + + # Main game executable + if [ -f "$build_game_dir/$exe_name" ]; then + install_file "$build_game_dir/$exe_name" "$data_dir/$exe_name" "$dry_run" + fi + + # Tools + for tool in WorldBuilder$tools_prefix W3DView$tools_prefix guiedit imagepacker mapcachebuilder wdump; do + local tool_exe="${tool}.exe" + if [ -f "$build_game_dir/$tool_exe" ]; then + install_file "$build_game_dir/$tool_exe" "$data_dir/$tool_exe" "$dry_run" + fi + done + + # DLLs (but NOT mss32.dll or binkw32.dll - keep originals) + for dll in DebugWindow.dll ParticleEditor.dll; do + if [ -f "$build_game_dir/$dll" ]; then + install_file "$build_game_dir/$dll" "$data_dir/$dll" "$dry_run" + fi + done + + # Also check Core directory for DLLs + if [ -f "$BUILD_DIR/Core/DebugWindow.dll" ]; then + install_file "$BUILD_DIR/Core/DebugWindow.dll" "$data_dir/DebugWindow.dll" "$dry_run" + fi +} + +restore_files() { + local game_dir="$1" + local data_dir="$game_dir/Data" + + print_info "Restoring original files..." + + local restored=0 + for backup in "$data_dir"/*.backup; do + if [ -f "$backup" ]; then + local original="${backup%.backup}" + cp "$backup" "$original" + print_success "Restored: $(basename "$original")" + ((restored++)) + fi + done + + if [ $restored -eq 0 ]; then + print_warning "No backup files found to restore" + else + print_success "Restored $restored files" + fi +} + +# Parse arguments +GAME_DIR="" +DETECT=false +RESTORE=false +GAME_TYPE="zh" +DRY_RUN=false + +while [[ $# -gt 0 ]]; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + -d|--detect) + DETECT=true + shift + ;; + -r|--restore) + RESTORE=true + shift + ;; + -g|--game) + GAME_TYPE="$2" + shift 2 + ;; + --dry-run) + DRY_RUN=true + shift + ;; + -*) + print_error "Unknown option: $1" + usage + exit 1 + ;; + *) + GAME_DIR="$1" + shift + ;; + esac +done + +# Main execution +echo "" +echo "===================================" +echo " Generals Game Code - Installer" +echo "===================================" +echo "" + +# Detect or validate game directory +if [ "$DETECT" == "true" ] || [ -z "$GAME_DIR" ]; then + print_info "Searching for game installations..." + GAME_DIR=$(detect_game) +fi + +print_info "Game directory: $GAME_DIR" + +# Validate game directory +if [ ! -d "$GAME_DIR/Data" ]; then + print_error "Invalid game directory (Data/ subdirectory not found)" + echo "" + echo "Expected directory structure:" + echo " $GAME_DIR/" + echo " Data/" + echo " generalszh.exe" + echo " *.big files" + exit 1 +fi + +# Restore mode +if [ "$RESTORE" == "true" ]; then + restore_files "$GAME_DIR" + exit 0 +fi + +# Check build exists +check_build + +# Install +if [ "$DRY_RUN" == "true" ]; then + print_info "Dry run - showing what would be installed:" +fi + +case "$GAME_TYPE" in + zh|zerohour) + install_game "$GAME_DIR" "zh" "$DRY_RUN" + ;; + generals) + install_game "$GAME_DIR" "generals" "$DRY_RUN" + ;; + both|all) + install_game "$GAME_DIR" "zh" "$DRY_RUN" + install_game "$GAME_DIR" "generals" "$DRY_RUN" + ;; + *) + print_error "Unknown game type: $GAME_TYPE" + exit 1 + ;; +esac + +if [ "$DRY_RUN" != "true" ]; then + echo "" + print_success "Installation complete!" + echo "" + echo "To run the game:" + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + echo " wine \"$GAME_DIR/Data/generalszh.exe\"" + else + echo " cd \"$GAME_DIR/Data\" && generalszh.exe" + fi + echo "" + echo "To restore original files:" + echo " $(basename "$0") --restore \"$GAME_DIR\"" +fi diff --git a/scripts/dockerbuild.sh b/scripts/dockerbuild.sh index ec8ae69856f..73e876acfb9 100755 --- a/scripts/dockerbuild.sh +++ b/scripts/dockerbuild.sh @@ -1,5 +1,15 @@ -#!/bin/bash #!/usr/bin/env bash +# +# Legacy Docker build script - consider using docker-build.sh instead +# +# docker-build.sh provides a more user-friendly interface with: +# - Game selection (--game zh/generals/all) +# - Colored output and progress messages +# - Target selection (--target) +# - Clean build option (--clean) +# +# This script is kept for backwards compatibility. +# set -euo pipefail From 8d6089672145ebee6e8efc5f7463a9236959e911 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sun, 18 Jan 2026 16:46:07 +0100 Subject: [PATCH 068/211] bugfix(logic): Decouple scripted audio events from CRC computation (#2075) --- .../Include/GameLogic/LogicRandomValue.h | 4 ++ .../Source/Common/Audio/AudioEventRTS.cpp | 6 +- .../Source/Common/Audio/GameAudio.cpp | 9 ++- Core/GameEngine/Source/Common/RandomValue.cpp | 62 +++++++++++++++++++ 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/Core/GameEngine/Include/GameLogic/LogicRandomValue.h b/Core/GameEngine/Include/GameLogic/LogicRandomValue.h index 0bc26ef7d14..ee2c6b936ec 100644 --- a/Core/GameEngine/Include/GameLogic/LogicRandomValue.h +++ b/Core/GameEngine/Include/GameLogic/LogicRandomValue.h @@ -33,11 +33,15 @@ // do NOT use these functions directly, rather use the macros below extern Int GetGameLogicRandomValue( int lo, int hi, const char *file, int line ); +extern Int GetGameLogicRandomValueUnchanged(int lo, int hi, const char* file, int line); extern Real GetGameLogicRandomValueReal( Real lo, Real hi, const char *file, int line ); +extern Real GetGameLogicRandomValueRealUnchanged(Real lo, Real hi, const char* file, int line); // use these macros to access the random value functions #define GameLogicRandomValue( lo, hi ) GetGameLogicRandomValue( lo, hi, __FILE__, __LINE__ ) +#define GameLogicRandomValueUnchanged( lo, hi ) GetGameLogicRandomValueUnchanged( lo, hi, __FILE__, __LINE__ ) #define GameLogicRandomValueReal( lo, hi ) GetGameLogicRandomValueReal( lo, hi, __FILE__, __LINE__ ) +#define GameLogicRandomValueRealUnchanged( lo, hi ) GetGameLogicRandomValueRealUnchanged( lo, hi, __FILE__, __LINE__ ) //-------------------------------------------------------------------------------------------------------------- class CColorAlphaDialog; diff --git a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp index fc0743c1f56..b9d847b23ca 100644 --- a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp +++ b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp @@ -340,7 +340,7 @@ void AudioEventRTS::generateFilename( void ) { if (m_isLogicalAudio) { - which = GameLogicRandomValue(0, m_eventInfo->m_sounds.size() - 1); + which = GameLogicRandomValueUnchanged(0, m_eventInfo->m_sounds.size() - 1); } else { @@ -388,7 +388,7 @@ void AudioEventRTS::generatePlayInfo( void ) // needs to be logic because it needs to be the same on all systems. Int attackToPlay; if (m_isLogicalAudio) { - attackToPlay = GameLogicRandomValue(0, attackSize - 1); + attackToPlay = GameLogicRandomValueUnchanged(0, attackSize - 1); } else { attackToPlay = GameAudioRandomValue(0, attackSize - 1); } @@ -406,7 +406,7 @@ void AudioEventRTS::generatePlayInfo( void ) // needs to be logic because it needs to be the same on all systems. Int decayToPlay; if (m_isLogicalAudio) { - decayToPlay = GameLogicRandomValue(0, decaySize - 1); + decayToPlay = GameLogicRandomValueUnchanged(0, decaySize - 1); } else { decayToPlay = GameAudioRandomValue(0, decaySize - 1); } diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index b29b155a9bb..3b3e93d67fc 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -444,8 +444,13 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) } // TheSuperHackers @info Scripted audio events are logical, i.e. synchronized across clients. - // This early return cannot be taken for such audio events as it skips code that changes the logical game seed values. + // In retail mode this early return cannot be taken for such audio events as it skips code that changes the logical game seed values. + // In non-retail mode logical audio events are decoupled from the CRC computation, so this early return is allowed. +#if RETAIL_COMPATIBLE_CRC const Bool logicalAudio = eventToAdd->getIsLogicalAudio(); +#else + const Bool logicalAudio = FALSE; +#endif const Bool notForLocal = !eventToAdd->getUninterruptable() && !shouldPlayLocally(eventToAdd); if (!logicalAudio && notForLocal) @@ -467,11 +472,13 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) } } +#if RETAIL_COMPATIBLE_CRC if (notForLocal) { releaseAudioEventRTS(audioEvent); return AHSV_NotForLocal; } +#endif // cull muted audio if (audioEvent->getVolume() < m_audioSettings->m_minVolume) { diff --git a/Core/GameEngine/Source/Common/RandomValue.cpp b/Core/GameEngine/Source/Common/RandomValue.cpp index c14816de3d5..0628c245eef 100644 --- a/Core/GameEngine/Source/Common/RandomValue.cpp +++ b/Core/GameEngine/Source/Common/RandomValue.cpp @@ -228,6 +228,37 @@ DEBUG_LOG(( "%d: GetGameLogicRandomValue = %d (%d - %d), %s line %d", return rval; } +// +// TheSuperHackers @info This function does not change the seed values with retail compatibility disabled. +// Consecutive calls always return the same value for the same combination of min / max values, assuming the seed values haven't changed in between. +// The intended use case for this function are randomized values that are desirable to be synchronized across clients, +// but should not result in a mismatch if they aren't synchronized; e.g. for scripted audio events. +// +Int GetGameLogicRandomValueUnchanged( int lo, int hi, const char *file, int line ) +{ +#if RETAIL_COMPATIBLE_CRC + return GetGameLogicRandomValue(lo, hi, file, line); +#endif + + const UnsignedInt delta = hi - lo + 1; + if (delta == 0) + return hi; + + UnsignedInt seed[ARRAY_SIZE(theGameLogicSeed)]; + memcpy(&seed[0], &theGameLogicSeed[0], sizeof(seed)); + + const Int rval = ((Int)(randomValue(seed) % delta)) + lo; + + DEBUG_ASSERTCRASH(rval >= lo && rval <= hi, ("Bad random val")); + +#ifdef DEBUG_RANDOM_LOGIC + DEBUG_LOG(( "%d: GetGameLogicRandomValueUnchanged = %d (%d - %d), %s line %d", + TheGameLogic->getFrame(), rval, lo, hi, file, line )); +#endif + + return rval; +} + // // Integer random value // @@ -298,6 +329,37 @@ DEBUG_LOG(( "%d: GetGameLogicRandomValueReal = %f, %s line %d", return rval; } +// +// TheSuperHackers @info This function does not change the seed values with retail compatibility disabled. +// Consecutive calls always return the same value for the same combination of min / max values, assuming the seed values haven't changed in between. +// The intended use case for this function are randomized values that are desirable to be synchronized across clients, +// but should not result in a mismatch if they aren't synchronized; e.g. for scripted audio events. +// +Real GetGameLogicRandomValueRealUnchanged( Real lo, Real hi, const char *file, int line ) +{ +#if RETAIL_COMPATIBLE_CRC + return GetGameLogicRandomValueReal(lo, hi, file, line); +#endif + + const Real delta = hi - lo; + if (delta <= 0.0f) + return hi; + + UnsignedInt seed[ARRAY_SIZE(theGameLogicSeed)]; + memcpy(&seed[0], &theGameLogicSeed[0], sizeof(seed)); + + const Real rval = ((Real)(randomValue(seed)) * theMultFactor) * delta + lo; + + DEBUG_ASSERTCRASH(rval >= lo && rval <= hi, ("Bad random val")); + +#ifdef DEBUG_RANDOM_LOGIC + DEBUG_LOG(( "%d: GetGameLogicRandomValueRealUnchanged = %f, %s line %d", + TheGameLogic->getFrame(), rval, file, line )); +#endif + + return rval; +} + // // Real valued random value // From cd2eef38030c8a0e0ebd187cd7f64b70de22b995 Mon Sep 17 00:00:00 2001 From: SkyAero <21192585+Skyaero42@users.noreply.github.com> Date: Sun, 18 Jan 2026 17:22:37 +0100 Subject: [PATCH 069/211] bugfix(ghostobject): Readd null check for 3DScene in W3DRenderObjectSnapshot::addToScene to prevent crash in headless replay playback (#2133) --- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index d223721b355..eb129086eb4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -153,7 +153,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ Bool W3DRenderObjectSnapshot::addToScene(void) { - if (!m_robj->Is_In_Scene()) + if (W3DDisplay::m_3DScene != nullptr && !m_robj->Is_In_Scene()) { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); return true; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 57b31e11271..89dda483da3 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -157,7 +157,7 @@ void W3DRenderObjectSnapshot::update(RenderObjClass *robj, DrawableInfo *drawInf // ------------------------------------------------------------------------------------------------ Bool W3DRenderObjectSnapshot::addToScene(void) { - if (!m_robj->Is_In_Scene()) + if (W3DDisplay::m_3DScene != nullptr && !m_robj->Is_In_Scene()) { W3DDisplay::m_3DScene->Add_Render_Object(m_robj); return true; From bd4e909ad0e6f788555032bcaf234ba842ddf371 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 21:42:27 +0100 Subject: [PATCH 070/211] bugfix(heightmap): Revert optimization for m_vertexBufferTiles in HeightMapRenderObjClass because it does not work properly (#2135) --- .../Include/W3DDevice/GameClient/HeightMap.h | 4 ++-- .../Source/W3DDevice/GameClient/HeightMap.cpp | 22 +++++++++---------- .../Source/WWVegas/WW3D2/dx8vertexbuffer.h | 9 ++------ .../Tools/WorldBuilder/src/WBHeightMap.cpp | 7 ++---- .../Source/WWVegas/WW3D2/dx8vertexbuffer.h | 9 ++------ 5 files changed, 19 insertions(+), 32 deletions(-) diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h index be440404c96..6352058dcf1 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h @@ -49,7 +49,7 @@ virtually everything to do with the terrain, including: drawing, lighting, scorchmarks and intersection tests. TheSuperHackers @performance xezon 13/01/2026 -Class now stores the vertex buffers as one big buffer each for optimal data locality. +Class now stores the vertex buffer backup as one big array for optimal data locality. */ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass { @@ -89,7 +89,7 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass Int m_numExtraBlendTiles; ///~DX8VertexBufferClass(); + if (m_vertexBufferTiles) { + for (int i=0; iz = theZ; vbHardware++; } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h index cf6a5341572..e5a7c5c5917 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h @@ -197,13 +197,12 @@ inline VertexFormatXYZNDUV2 * DynamicVBAccessClass::WriteLockClass::Get_Formatte /** ** DX8VertexBufferClass ** This class wraps a DX8 vertex buffer. Use the lock objects to modify or append to the vertex buffer. -** -** TheSuperHackers @performance Allow placement new and bypass the W3DMemPool to create big buffers. */ class DX8VertexBufferClass : public VertexBufferClass { W3DMPO_GLUE(DX8VertexBufferClass) - +protected: + ~DX8VertexBufferClass(); public: enum UsageType { USAGE_DEFAULT=0, @@ -212,15 +211,11 @@ class DX8VertexBufferClass : public VertexBufferClass USAGE_NPATCHES=4 }; - void* operator new(size_t s, void* placement) noexcept { return placement; } - void operator delete(void* p, void* placement) noexcept {} - DX8VertexBufferClass(unsigned FVF, unsigned short VertexCount, UsageType usage=USAGE_DEFAULT, unsigned vertex_size=0); // Vertex size not used with FVF formats DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); DX8VertexBufferClass(const Vector3* vertices, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT); - ~DX8VertexBufferClass(); IDirect3DVertexBuffer8* Get_DX8_Vertex_Buffer() { return VertexBuffer; } From 6818fae6278182c6cffee4b0e2e0752e647dd165 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sun, 18 Jan 2026 22:56:48 +0100 Subject: [PATCH 071/211] bugfix(ai): Fix crash when AI player attempts to build a supply center with an invalid name (#2095) --- .../Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp | 11 +++++++++-- .../Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index 6bb4f56e3c5..d71c274d255 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -1735,8 +1735,15 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) // ------------------------------------------------------------------------------------------------ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) { - Object *bestSupplyWarehouse = findSupplyCenter(minimumCash); const ThingTemplate* tTemplate = TheThingFactory->findTemplate(thingName); + if (!tTemplate) + { + DEBUG_CRASH(("Template %s should exist; check ini and script files.", thingName.str())); + return; + } + + Object *bestSupplyWarehouse = findSupplyCenter(minimumCash); + if (!tTemplate->isKindOf(KINDOF_CASH_GENERATOR)) { // Build by the current warehouse. Object *curWarehouse = TheGameLogic->findObjectByID(m_curWarehouseID); @@ -1746,7 +1753,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) } - if (bestSupplyWarehouse && tTemplate) { + if (bestSupplyWarehouse) { Coord3D location; location = *bestSupplyWarehouse->getPosition(); // offset back towards the base. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index e0ad3cc9d1f..1fa890c1ef5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -1859,8 +1859,15 @@ void AIPlayer::buildUpgrade(const AsciiString &upgrade) // ------------------------------------------------------------------------------------------------ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) { - Object *bestSupplyWarehouse = findSupplyCenter(minimumCash); const ThingTemplate* tTemplate = TheThingFactory->findTemplate(thingName); + if (!tTemplate) + { + DEBUG_CRASH(("Template %s should exist; check ini and script files.", thingName.str())); + return; + } + + Object *bestSupplyWarehouse = findSupplyCenter(minimumCash); + if (!tTemplate->isKindOf(KINDOF_CASH_GENERATOR)) { // Build by the current warehouse. Object *curWarehouse = TheGameLogic->findObjectByID(m_curWarehouseID); @@ -1870,7 +1877,7 @@ void AIPlayer::buildBySupplies(Int minimumCash, const AsciiString& thingName) } - if (bestSupplyWarehouse && tTemplate) { + if (bestSupplyWarehouse) { Coord3D location; location = *bestSupplyWarehouse->getPosition(); // offset back towards the base. From 114716a9d08b97d302df1bcb6303016b220bb087 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 20 Jan 2026 05:18:58 +1100 Subject: [PATCH 072/211] bugfix(object): Preserve unit behaviour when transferring assets to allies (#1885) --- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 10 +++++++++- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 626737ef8ab..63cef1714b7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4030,9 +4030,17 @@ void Object::removeUpgrade( const UpgradeTemplate *upgradeT ) //------------------------------------------------------------------------------------------------- void Object::onCapture( Player *oldOwner, Player *newOwner ) { - // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing + // Everybody chills when they captured so they don't keep doing something the new player might not want him to be doing + // TheSuperHackers @tweak Stubbjax 19/11/2025 Except when the new owner is an ally, so that Hackers keep on hacking, etc. if( getAIUpdateInterface() && (oldOwner != newOwner) ) + { +#if RETAIL_COMPATIBLE_CRC getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#else + if (oldOwner->getRelationship(newOwner->getDefaultTeam()) != ALLIES) + getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#endif + } // this gets the new owner some points newOwner->getScoreKeeper()->addObjectCaptured(this); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index e11db7d4c53..bec1bc96780 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4552,9 +4552,17 @@ void Object::removeUpgrade( const UpgradeTemplate *upgradeT ) //------------------------------------------------------------------------------------------------- void Object::onCapture( Player *oldOwner, Player *newOwner ) { - // Everybody dhills when they captured so they don't keep doing something the new player might not want him to be doing + // Everybody chills when they captured so they don't keep doing something the new player might not want him to be doing + // TheSuperHackers @tweak Stubbjax 19/11/2025 Except when the new owner is an ally, so that Hackers keep on hacking, etc. if( getAIUpdateInterface() && (oldOwner != newOwner) ) + { +#if RETAIL_COMPATIBLE_CRC getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#else + if (oldOwner->getRelationship(newOwner->getDefaultTeam()) != ALLIES) + getAIUpdateInterface()->aiIdle(CMD_FROM_AI); +#endif + } // this gets the new owner some points newOwner->getScoreKeeper()->addObjectCaptured(this); From 4f1bb33237ea5720b978447b56985b4bf39c10fa Mon Sep 17 00:00:00 2001 From: "Salem B." <46156444+jurassicLizard@users.noreply.github.com> Date: Mon, 19 Jan 2026 21:39:47 +0100 Subject: [PATCH 073/211] bugfix(wbview3d): Fix crash on window resize in Generals World Builder (#2151) --- Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index d4c2235c5fb..97f571864f9 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -574,9 +574,7 @@ void WbView3d::reset3dEngineDisplaySize(Int width, Int height) m_actualWinSize.x = width; m_actualWinSize.y = height; if (m_ww3dInited) { - W3DShaderManager::shutdown(); WW3D::Set_Device_Resolution(m_actualWinSize.x, m_actualWinSize.y, true); - W3DShaderManager::init(); } } From 5454eaa13b5fca56b9d0b033f391ded17c82c47a Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 19 Jan 2026 14:57:29 -0600 Subject: [PATCH 074/211] fix(debug): Fix spelling errors in DEBUG macro strings (#2148) --- Core/GameEngine/Source/Common/System/Radar.cpp | 2 +- .../Source/GameNetwork/FirewallHelper.cpp | 14 +++++++------- .../GameSpy/Thread/PersistentStorageThread.cpp | 2 +- Core/GameEngine/Source/GameNetwork/NAT.cpp | 4 ++-- .../Source/W3DDevice/GameClient/W3DSnow.cpp | 2 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 4 ++-- .../Source/WWVegas/WW3D2/shattersystem.cpp | 2 +- .../Source/Common/System/SaveGame/GameStateMap.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GUI/ControlBar/ControlBarCommandProcessing.cpp | 2 +- .../Source/GameClient/GUI/GameWindowManager.cpp | 14 +++++++------- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/Squad.cpp | 2 +- .../GameLogic/Object/Behavior/BridgeBehavior.cpp | 2 +- .../Object/Behavior/SlowDeathBehavior.cpp | 2 +- .../Source/GameLogic/Object/ObjectTypes.cpp | 2 +- .../Source/GameLogic/Object/WeaponSet.cpp | 2 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 4 ++-- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 2 +- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- .../Source/Win32Device/GameClient/Win32DIMouse.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 2 +- .../Source/Common/System/SaveGame/GameStateMap.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Drawable.cpp | 2 +- .../GUI/ControlBar/ControlBarCommandProcessing.cpp | 2 +- .../Source/GameClient/GUI/GameWindowManager.cpp | 14 +++++++------- .../Source/GameClient/System/ParticleSys.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/Squad.cpp | 2 +- .../GameLogic/Object/Behavior/BridgeBehavior.cpp | 2 +- .../Object/Behavior/SlowDeathBehavior.cpp | 2 +- .../Source/GameLogic/Object/ObjectTypes.cpp | 2 +- .../Source/GameLogic/Object/WeaponSet.cpp | 2 +- .../GameClient/Shadow/W3DProjectedShadow.cpp | 4 ++-- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 2 +- .../Source/W3DDevice/GameLogic/W3DGhostObject.cpp | 2 +- .../Source/Win32Device/GameClient/Win32DIMouse.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp | 2 +- 37 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Core/GameEngine/Source/Common/System/Radar.cpp b/Core/GameEngine/Source/Common/System/Radar.cpp index 65dc21acee1..4b482a2c188 100644 --- a/Core/GameEngine/Source/Common/System/Radar.cpp +++ b/Core/GameEngine/Source/Common/System/Radar.cpp @@ -1472,7 +1472,7 @@ void Radar::xfer( Xfer *xfer ) if( eventCount != eventCountVerify ) { - DEBUG_CRASH(( "Radar::xfer - size of MAX_RADAR_EVENTS has changed, you must version this xfer method to accomodate the new array size. Was '%d' and is now '%d'", + DEBUG_CRASH(( "Radar::xfer - size of MAX_RADAR_EVENTS has changed, you must version this xfer method to accommodate the new array size. Was '%d' and is now '%d'", eventCount, eventCountVerify )); throw SC_INVALID_DATA; diff --git a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp index f4f7bf4ab34..e6619efd0c8 100644 --- a/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -1027,7 +1027,7 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { return FALSE; } - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - starting 4th test")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - starting 4th test")); /* ** Fourth test. ** @@ -1037,7 +1037,7 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { if ((m_behavior & FIREWALL_TYPE_SIMPLE_PORT_ALLOCATION) != 0) { - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - simple port allocation, Testing to see if the NAT mangles differently per destination port at the same IP")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - simple port allocation, Testing to see if the NAT mangles differently per destination port at the same IP")); /* ** We need 2 source ports for this. @@ -1045,7 +1045,7 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { m_sparePorts[0] = getNextTemporarySourcePort(0); if (!openSpareSocket(m_sparePorts[0])) { m_currentState = DETECTIONSTATE_DONE; - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - Failed to open first spare port, bailing")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - Failed to open first spare port, bailing")); return TRUE; } @@ -1053,7 +1053,7 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { if (!openSpareSocket(m_sparePorts[1])) { closeSpareSocket(m_sparePorts[0]); m_currentState = DETECTIONSTATE_DONE; - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - Failed to open second spare port, bailing")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - Failed to open second spare port, bailing")); return TRUE; } @@ -1076,10 +1076,10 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { /* ** NAT32 uses different mangled source ports for different destination ports. */ - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - relative port allocation, NAT32 right?")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - relative port allocation, NAT32 right?")); UnsignedInt addbehavior = 0; addbehavior = (UnsignedInt)FIREWALL_TYPE_DESTINATION_PORT_DELTA; - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - adding DESTINATION PORT DELTA to behavior")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - adding DESTINATION PORT DELTA to behavior")); addbehavior |= (UnsignedInt)m_behavior; m_behavior = (FirewallBehaviorType) addbehavior; } @@ -1087,7 +1087,7 @@ Bool FirewallHelperClass::detectionTest3WaitForResponsesUpdate() { DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - We don't have smart mangling, skipping test 4, entering test 5")); } - DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForRepsonsesUpdate - entering test 5")); + DEBUG_LOG(("FirewallHelperClass::detectionTest3WaitForResponsesUpdate - entering test 5")); m_currentState = DETECTIONSTATE_TEST5; return FALSE; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp index c275120566c..784a802f5ae 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp @@ -635,7 +635,7 @@ Bool PSThreadClass::tryLogin( Int id, std::string nick, std::string password, st PreAuthenticatePlayerPM(id, id, validate, ::persAuthCallback, this); while (!m_doneTryingToLogin && IsStatsConnected()) PersistThink(); - DEBUG_LOG(("Persistant Storage Login success %d", m_loginOK)); + DEBUG_LOG(("Persistent Storage Login success %d", m_loginOK)); return m_loginOK; } diff --git a/Core/GameEngine/Source/GameNetwork/NAT.cpp b/Core/GameEngine/Source/GameNetwork/NAT.cpp index fa45f66741f..159d8532cfa 100644 --- a/Core/GameEngine/Source/GameNetwork/NAT.cpp +++ b/Core/GameEngine/Source/GameNetwork/NAT.cpp @@ -346,7 +346,7 @@ NATConnectionState NAT::connectionUpdate() { #ifdef DEBUG_LOGGING UnsignedInt slotIP = targetSlot->getIP(); #endif - DEBUG_LOG(("NAT::connectionUpdate - incomming packet has different from address than we expected, incoming: %d.%d.%d.%d expected: %d.%d.%d.%d", + DEBUG_LOG(("NAT::connectionUpdate - incoming packet has different from address than we expected, incoming: %d.%d.%d.%d expected: %d.%d.%d.%d", PRINTF_IP_AS_4_INTS(fromIP), PRINTF_IP_AS_4_INTS(slotIP))); targetSlot->setIP(fromIP); @@ -606,7 +606,7 @@ void NAT::attachSlotList(GameSlot *slotList[], Int localSlot, UnsignedInt localI m_slotList = slotList; m_localIP = localIP; m_transport = new Transport; - DEBUG_LOG(("NAT::attachSlotList - initting the transport socket with address %d.%d.%d.%d:%d", + DEBUG_LOG(("NAT::attachSlotList - initializing the transport socket with address %d.%d.%d.%d:%d", PRINTF_IP_AS_4_INTS(m_localIP), getSlotPort(localSlot))); m_startingPortNumber = NETWORK_BASE_PORT_NUMBER + ((timeGetTime() / 1000) % 20000); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp index f12a9c9733d..370fac9d7c9 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSnow.cpp @@ -80,7 +80,7 @@ Bool W3DSnowManager::ReAcquireResources(void) { LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); - DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DSnowManager without device")); + DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAcquireResources on W3DSnowManager without device")); if (m_VertexBufferD3D == nullptr) { // Create vertex buffer diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 49ccce61e2e..c76cdb1a23e 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -1189,7 +1189,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) if( width != getGridWidth() ) { - DEBUG_CRASH(( "W3DTerainVisual::xfer - grid width mismatch '%d' should be '%d'", + DEBUG_CRASH(( "W3DTerrainVisual::xfer - grid width mismatch '%d' should be '%d'", width, getGridWidth() )); throw SC_INVALID_DATA; @@ -1197,7 +1197,7 @@ void W3DTerrainVisual::xfer( Xfer *xfer ) if( height != getGridHeight() ) { - DEBUG_CRASH(( "W3DTerainVisual::xfer - grid height mismatch '%d' should be '%d'", + DEBUG_CRASH(( "W3DTerrainVisual::xfer - grid height mismatch '%d' should be '%d'", height, getGridHeight() )); throw SC_INVALID_DATA; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp index 6902a26422e..2a29cfb1ba7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp @@ -1180,7 +1180,7 @@ void ShatterSystem::Process_Clip_Pools SHATTER_DEBUG_SAY(("Begin Vertex:")); new_mesh->Begin_Vertex(); - SHATTER_DEBUG_SAY(("postion: %f %f %f",pos.X,pos.Y,pos.Z)); + SHATTER_DEBUG_SAY(("position: %f %f %f",pos.X,pos.Y,pos.Z)); new_mesh->Location_Inline(pos); new_mesh->Normal(norm); diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index c2fb7db05df..de3e7649b6a 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -102,7 +102,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) if( file->read( buffer, fileSize ) != fileSize ) { - DEBUG_CRASH(( "embeddPristineMap - Error reading from file '%s'", map.str() )); + DEBUG_CRASH(( "embedPristineMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; } diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index dc320228110..289a2fb7cbf 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -4660,7 +4660,7 @@ void Drawable::xfer( Xfer *xfer ) // #ifdef DIRTY_CONDITION_FLAGS if( xfer->getXferMode() == XFER_SAVE ) - DEBUG_ASSERTCRASH( m_isModelDirty == FALSE, ("Drawble::xfer - m_isModelDirty is not FALSE!") ); + DEBUG_ASSERTCRASH( m_isModelDirty == FALSE, ("Drawable::xfer - m_isModelDirty is not FALSE!") ); else m_isModelDirty = TRUE; #endif diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index ec07e9c51da..359d837ebfa 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -305,7 +305,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, if( pu == nullptr ) { - DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producting units", + DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producing units", whatToBuild->getName().str(), factory->getTemplate()->getName().str()) ); break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 93b13ff6f91..ddc72aac670 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1787,7 +1787,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) == FALSE ) { - DEBUG_LOG(( "Cann't create button gadget, instance data not button type" )); + DEBUG_LOG(( "Can't create button gadget, instance data not button type" )); assert( 0 ); return nullptr; @@ -1855,7 +1855,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) == FALSE ) { - DEBUG_LOG(( "Cann't create checkbox gadget, instance data not checkbox type" )); + DEBUG_LOG(( "Can't create checkbox gadget, instance data not checkbox type" )); assert( 0 ); return nullptr; @@ -1922,7 +1922,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) == FALSE ) { - DEBUG_LOG(( "Cann't create radioButton gadget, instance data not radioButton type" )); + DEBUG_LOG(( "Can't create radioButton gadget, instance data not radioButton type" )); assert( 0 ); return nullptr; @@ -1994,7 +1994,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_TAB_CONTROL ) == FALSE ) { - DEBUG_LOG(( "Cann't create tabControl gadget, instance data not tabControl type" )); + DEBUG_LOG(( "Can't create tabControl gadget, instance data not tabControl type" )); assert( 0 ); return nullptr; @@ -2066,7 +2066,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) { - DEBUG_LOG(( "Cann't create listbox gadget, instance data not listbox type" )); + DEBUG_LOG(( "Can't create listbox gadget, instance data not listbox type" )); assert( 0 ); return nullptr; @@ -2334,7 +2334,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX) == FALSE ) { - DEBUG_LOG(( "Cann't create ComboBox gadget, instance data not ComboBox type" )); + DEBUG_LOG(( "Can't create ComboBox gadget, instance data not ComboBox type" )); assert( 0 ); return nullptr; @@ -2538,7 +2538,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) == FALSE ) { - DEBUG_LOG(( "Cann't create progressBar gadget, instance data not progressBar type" )); + DEBUG_LOG(( "Can't create progressBar gadget, instance data not progressBar type" )); assert( 0 ); return nullptr; diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 0307af98475..a408bcec665 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2599,7 +2599,7 @@ void ParticleSystem::xfer( Xfer *xfer ) particle = createParticle( info, priority, TRUE ); // sanity - DEBUG_ASSERTCRASH( particle, ("ParticleSyste::xfer - Unable to create particle for loading") ); + DEBUG_ASSERTCRASH( particle, ("ParticleSystem::xfer - Unable to create particle for loading") ); // read in the particle data xfer->xferSnapshot( particle ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 6db33b94bf5..33cf2def194 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -236,7 +236,7 @@ void Squad::xfer( Xfer *xfer ) if( !m_objectsCached.empty() ) { - DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); + DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be empty, but is not" )); throw SC_INVALID_DATA; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index c43bc50134d..d22022daa75 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -731,7 +731,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // get the bridge template info AsciiString bridgeTemplateName = bridge->getBridgeTemplateName(); bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - DEBUG_ASSERTCRASH( bridgeTemplate, ("BridgeBeahvior::getRandomSurfacePosition - Encountered a bridge with no template!") ); + DEBUG_ASSERTCRASH( bridgeTemplate, ("BridgeBehavior::getRandomSurfacePosition - Encountered a bridge with no template!") ); } // how much time has passed between now and our destruction frame diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 1a44165671a..d60190bd614 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -158,7 +158,7 @@ SlowDeathBehavior::SlowDeathBehavior( Thing *thing, const ModuleData* moduleData if (getSlowDeathBehaviorModuleData()->m_probabilityModifier < 1) { - DEBUG_CRASH(("ProbabilityModifer must be >= 1.")); + DEBUG_CRASH(("ProbabilityModifier must be >= 1.")); throw INI_INVALID_DATA; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp index ebb220a392b..5dff77e2a01 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp @@ -179,7 +179,7 @@ void ObjectTypes::xfer(Xfer *xfer) if( m_objectTypes.empty() == FALSE ) { - DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be emtpy but is not!" )); + DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be empty but is not!" )); throw SC_INVALID_DATA; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index bdcedf09078..460e6d25116 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -388,7 +388,7 @@ static Int getVictimAntiMask(const Object* victim) } else if( !victim->isKindOf( KINDOF_UNATTACKABLE ) ) { - DEBUG_CRASH( ("Object %s is being targetted as airborne, but is not infantry, nor vehicle. Is this legit? -- tell Kris", victim->getTemplate()->getName().str() ) ); + DEBUG_CRASH( ("Object %s is being targeted as airborne, but is not infantry, nor vehicle. Is this legit? -- tell Kris", victim->getTemplate()->getName().str() ) ); } return 0; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 74efb1de3bb..cdd56e183f6 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -272,8 +272,8 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); - DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DProjectedShadowManager without device")); - DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAquireResources not released in W3DProjectedShadowManager")); + DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAcquireResources on W3DProjectedShadowManager without device")); + DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAcquireResources not released in W3DProjectedShadowManager")); if (FAILED(m_pDev->CreateIndexBuffer ( diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 7d2a3633a9b..310b90dec1e 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -3600,7 +3600,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); - DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DVolumetricShadowManager without device")); + DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAcquireResources on W3DVolumetricShadowManager without device")); if (FAILED(m_pDev->CreateIndexBuffer ( diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index eb129086eb4..b4f35ec3602 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -659,7 +659,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // if( snapshotCount == 0 && m_parentSnapshots[ i ] != nullptr ) { - DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); + DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentSnapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; } diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 4933f3a84c7..eb80ceef6ff 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -139,7 +139,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "WARNING - openMouse: Cann't get capabilities of mouse for button setup" )); + DEBUG_LOG(( "WARNING - openMouse: Can't get capabilities of mouse for button setup" )); } else diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index 3e1757d9bbc..e974cfa4fca 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -1537,7 +1537,7 @@ void WW3D::Stop_Movie_Capture( void ) #ifdef _WIN32 if (IsCapturing) { IsCapturing = false; - WWDEBUG_SAY(( "Stoping Movie" )); + WWDEBUG_SAY(( "Stopping Movie" )); WWASSERT( Movie != nullptr); delete Movie; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 1ce3b1a7de9..7e21b3ade8b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -104,7 +104,7 @@ static void embedPristineMap( AsciiString map, Xfer *xfer ) if( file->read( buffer, fileSize ) != fileSize ) { - DEBUG_CRASH(( "embeddPristineMap - Error reading from file '%s'", map.str() )); + DEBUG_CRASH(( "embedPristineMap - Error reading from file '%s'", map.str() )); throw SC_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index edd2a717234..8d50d7c945a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -5320,7 +5320,7 @@ void Drawable::xfer( Xfer *xfer ) // #ifdef DIRTY_CONDITION_FLAGS if( xfer->getXferMode() == XFER_SAVE ) - DEBUG_ASSERTCRASH( m_isModelDirty == FALSE, ("Drawble::xfer - m_isModelDirty is not FALSE!") ); + DEBUG_ASSERTCRASH( m_isModelDirty == FALSE, ("Drawable::xfer - m_isModelDirty is not FALSE!") ); else m_isModelDirty = TRUE; #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index 8177de95f75..1f404271984 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -438,7 +438,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, if( pu == nullptr ) { - DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producting units", + DEBUG_ASSERTCRASH( 0, ("Cannot create '%s' because the factory object '%s' is not capable of producing units", whatToBuild->getName().str(), factory->getTemplate()->getName().str()) ); break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index b7c996399c4..841ddaf5a0e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -1787,7 +1787,7 @@ GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) == FALSE ) { - DEBUG_LOG(( "Cann't create button gadget, instance data not button type" )); + DEBUG_LOG(( "Can't create button gadget, instance data not button type" )); assert( 0 ); return nullptr; @@ -1855,7 +1855,7 @@ GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) == FALSE ) { - DEBUG_LOG(( "Cann't create checkbox gadget, instance data not checkbox type" )); + DEBUG_LOG(( "Can't create checkbox gadget, instance data not checkbox type" )); assert( 0 ); return nullptr; @@ -1922,7 +1922,7 @@ GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) == FALSE ) { - DEBUG_LOG(( "Cann't create radioButton gadget, instance data not radioButton type" )); + DEBUG_LOG(( "Can't create radioButton gadget, instance data not radioButton type" )); assert( 0 ); return nullptr; @@ -1994,7 +1994,7 @@ GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_TAB_CONTROL ) == FALSE ) { - DEBUG_LOG(( "Cann't create tabControl gadget, instance data not tabControl type" )); + DEBUG_LOG(( "Can't create tabControl gadget, instance data not tabControl type" )); assert( 0 ); return nullptr; @@ -2066,7 +2066,7 @@ GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) { - DEBUG_LOG(( "Cann't create listbox gadget, instance data not listbox type" )); + DEBUG_LOG(( "Can't create listbox gadget, instance data not listbox type" )); assert( 0 ); return nullptr; @@ -2334,7 +2334,7 @@ GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX) == FALSE ) { - DEBUG_LOG(( "Cann't create ComboBox gadget, instance data not ComboBox type" )); + DEBUG_LOG(( "Can't create ComboBox gadget, instance data not ComboBox type" )); assert( 0 ); return nullptr; @@ -2538,7 +2538,7 @@ GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) == FALSE ) { - DEBUG_LOG(( "Cann't create progressBar gadget, instance data not progressBar type" )); + DEBUG_LOG(( "Can't create progressBar gadget, instance data not progressBar type" )); assert( 0 ); return nullptr; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 7202e1134c9..f6b3a14121b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -2505,7 +2505,7 @@ void ParticleSystem::xfer( Xfer *xfer ) particle = createParticle( info, priority, TRUE ); // sanity - DEBUG_ASSERTCRASH( particle, ("ParticleSyste::xfer - Unable to create particle for loading") ); + DEBUG_ASSERTCRASH( particle, ("ParticleSystem::xfer - Unable to create particle for loading") ); // read in the particle data xfer->xferSnapshot( particle ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp index 7f30415ce33..6cd00528a2a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/Squad.cpp @@ -236,7 +236,7 @@ void Squad::xfer( Xfer *xfer ) if( !m_objectsCached.empty() ) { - DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be emtpy, but is not" )); + DEBUG_CRASH(( "Squad::xfer - m_objectsCached should be empty, but is not" )); throw SC_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp index 65c76b26281..216c8bba6a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp @@ -731,7 +731,7 @@ UpdateSleepTime BridgeBehavior::update( void ) // get the bridge template info AsciiString bridgeTemplateName = bridge->getBridgeTemplateName(); bridgeTemplate = TheTerrainRoads->findBridge( bridgeTemplateName ); - DEBUG_ASSERTCRASH( bridgeTemplate, ("BridgeBeahvior::getRandomSurfacePosition - Encountered a bridge with no template!") ); + DEBUG_ASSERTCRASH( bridgeTemplate, ("BridgeBehavior::getRandomSurfacePosition - Encountered a bridge with no template!") ); } // how much time has passed between now and our destruction frame diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp index 9e0058ec887..71ac024273d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp @@ -158,7 +158,7 @@ SlowDeathBehavior::SlowDeathBehavior( Thing *thing, const ModuleData* moduleData if (getSlowDeathBehaviorModuleData()->m_probabilityModifier < 1) { - DEBUG_CRASH(("ProbabilityModifer must be >= 1.")); + DEBUG_CRASH(("ProbabilityModifier must be >= 1.")); throw INI_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp index ed071ac211a..6b7b30adda3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectTypes.cpp @@ -179,7 +179,7 @@ void ObjectTypes::xfer(Xfer *xfer) if( m_objectTypes.empty() == FALSE ) { - DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be emtpy but is not!" )); + DEBUG_CRASH(( "ObjectTypes::xfer - m_objectTypes vector should be empty but is not!" )); throw SC_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index a0bf30540cc..96b6da59e4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -396,7 +396,7 @@ static Int getVictimAntiMask(const Object* victim) } else if( !victim->isKindOf( KINDOF_UNATTACKABLE ) ) { - DEBUG_CRASH( ("Object %s is being targetted as airborne, but is not infantry, nor vehicle. Is this legit? -- tell Kris", victim->getTemplate()->getName().str() ) ); + DEBUG_CRASH( ("Object %s is being targeted as airborne, but is not infantry, nor vehicle. Is this legit? -- tell Kris", victim->getTemplate()->getName().str() ) ); } return 0; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp index 170ec2ffcd9..10a5798ca19 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp @@ -272,8 +272,8 @@ Bool W3DProjectedShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); - DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DProjectedShadowManager without device")); - DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAquireResources not released in W3DProjectedShadowManager")); + DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAcquireResources on W3DProjectedShadowManager without device")); + DEBUG_ASSERTCRASH(shadowDecalIndexBufferD3D == nullptr && shadowDecalIndexBufferD3D == nullptr, ("ReAcquireResources not released in W3DProjectedShadowManager")); if (FAILED(m_pDev->CreateIndexBuffer ( diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 954a3ab4796..9848ef4c18c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -3744,7 +3744,7 @@ Bool W3DVolumetricShadowManager::ReAcquireResources(void) LPDIRECT3DDEVICE8 m_pDev=DX8Wrapper::_Get_D3D_Device8(); - DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAquireResources on W3DVolumetricShadowManager without device")); + DEBUG_ASSERTCRASH(m_pDev, ("Trying to ReAcquireResources on W3DVolumetricShadowManager without device")); if (FAILED(m_pDev->CreateIndexBuffer ( diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 89dda483da3..8224425dbe1 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -663,7 +663,7 @@ void W3DGhostObject::xfer( Xfer *xfer ) // if( snapshotCount == 0 && m_parentSnapshots[ i ] != nullptr ) { - DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentShapshots[ %d ] has data present but the count from the xfer stream is empty", i )); + DEBUG_CRASH(( "W3DGhostObject::xfer - m_parentSnapshots[ %d ] has data present but the count from the xfer stream is empty", i )); throw INI_INVALID_DATA; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp index 0cb6752bcb9..0b4b28318a0 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp @@ -137,7 +137,7 @@ void DirectInputMouse::openMouse( void ) if( FAILED( hr ) ) { - DEBUG_LOG(( "WARNING - openMouse: Cann't get capabilities of mouse for button setup" )); + DEBUG_LOG(( "WARNING - openMouse: Can't get capabilities of mouse for button setup" )); } else diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp index d37825e0a30..ff03a86c0ee 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.cpp @@ -1540,7 +1540,7 @@ void WW3D::Stop_Movie_Capture( void ) #ifdef _WIN32 if (IsCapturing) { IsCapturing = false; - WWDEBUG_SAY(( "Stoping Movie" )); + WWDEBUG_SAY(( "Stopping Movie" )); WWASSERT( Movie != nullptr); delete Movie; From 52654364f7d402cc16466c2f686aae1387aa3698 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Mon, 19 Jan 2026 14:57:58 -0600 Subject: [PATCH 075/211] fix: Fix spelling errors in code words (#2149) --- Core/GameEngine/Include/Common/AudioEventRTS.h | 6 +++--- .../Source/Common/Audio/AudioEventRTS.cpp | 14 +++++++------- .../GameEngine/Source/Common/Audio/GameAudio.cpp | 2 +- .../Include/W3DDevice/GameClient/W3DView.h | 2 +- .../MilesAudioDevice/MilesAudioManager.cpp | 4 ++-- .../Source/WWVegas/WWMath/aabtreecull.cpp | 8 ++++---- Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp | 4 ++-- Core/Tools/mangler/wlib/threadfac.cpp | 16 ++++++++-------- Core/Tools/mangler/wlib/threadfac.h | 2 +- Core/Tools/matchbot/wlib/threadfac.cpp | 16 ++++++++-------- Core/Tools/matchbot/wlib/threadfac.h | 2 +- .../GameEngine/Include/GameClient/ControlBar.h | 2 +- .../GameEngine/Include/GameLogic/ScriptEngine.h | 4 ++-- .../GameClient/GUI/ControlBar/ControlBar.cpp | 4 ++-- .../GUI/ControlBar/ControlBarScheme.cpp | 2 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 2 +- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/scene.h | 2 +- .../GameEngine/Include/GameClient/ControlBar.h | 2 +- .../GameEngine/Include/GameLogic/ScriptEngine.h | 4 ++-- .../GameClient/GUI/ControlBar/ControlBar.cpp | 4 ++-- .../GUI/ControlBar/ControlBarScheme.cpp | 2 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 2 +- .../Source/WWVegas/WW3D2/aabtreebuilder.cpp | 4 ++-- .../Code/Libraries/Source/WWVegas/WW3D2/scene.h | 2 +- 25 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Core/GameEngine/Include/Common/AudioEventRTS.h b/Core/GameEngine/Include/Common/AudioEventRTS.h index 5a6f0f4510b..c11364bc4a1 100644 --- a/Core/GameEngine/Include/Common/AudioEventRTS.h +++ b/Core/GameEngine/Include/Common/AudioEventRTS.h @@ -144,8 +144,8 @@ class AudioEventRTS Int getPlayingAudioIndex( void ) { return m_playingAudioIndex; }; void setPlayingAudioIndex( Int pai ) { m_playingAudioIndex = pai; }; - Bool getUninterruptable( ) const { return m_uninterruptable; } - void setUninterruptable( Bool uninterruptable ) { m_uninterruptable = uninterruptable; } + Bool getUninterruptible( ) const { return m_uninterruptible; } + void setUninterruptible( Bool uninterruptible ) { m_uninterruptible = uninterruptible; } // This will retrieve the appropriate position based on type. @@ -184,7 +184,7 @@ class AudioEventRTS Bool m_shouldFade; ///< This should fade in or out (if it is starting or stopping) Bool m_isLogicalAudio; ///< Should probably only be true for scripted sounds - Bool m_uninterruptable; + Bool m_uninterruptible; // Playing attributes Real m_pitchShift; ///< Pitch shift that should occur on this piece of audio diff --git a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp index b9d847b23ca..367f894caef 100644 --- a/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp +++ b/Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp @@ -78,7 +78,7 @@ AudioEventRTS::AudioEventRTS() m_allCount(0), m_playerIndex(-1), m_delay(0.0f), - m_uninterruptable(FALSE) + m_uninterruptible(FALSE) { m_attackName.clear(); m_decayName.clear(); @@ -105,7 +105,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName ) m_allCount(0), m_playerIndex(-1), m_delay(0.0f), - m_uninterruptable(FALSE) + m_uninterruptible(FALSE) { m_attackName.clear(); m_decayName.clear(); @@ -133,7 +133,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, ObjectID ownerID ) m_allCount(0), m_playerIndex(-1), m_delay(0.0f), - m_uninterruptable(FALSE) + m_uninterruptible(FALSE) { m_attackName.clear(); m_decayName.clear(); @@ -169,7 +169,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, DrawableID drawableI m_allCount(0), m_playerIndex(-1), m_delay(0.0f), - m_uninterruptable(FALSE) + m_uninterruptible(FALSE) { m_attackName.clear(); m_decayName.clear(); @@ -204,7 +204,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, const Coord3D *posit m_allCount(0), m_playerIndex(-1), m_delay(0.0f), - m_uninterruptable(FALSE) + m_uninterruptible(FALSE) { m_positionOfAudio.set( positionOfAudio ); m_attackName.clear(); @@ -235,7 +235,7 @@ AudioEventRTS::AudioEventRTS( const AudioEventRTS& right ) m_attackName = right.m_attackName; m_decayName = right.m_decayName; m_portionToPlayNext = right.m_portionToPlayNext; - m_uninterruptable = right.m_uninterruptable; + m_uninterruptible = right.m_uninterruptible; if( m_ownerType == OT_Positional || m_ownerType == OT_Dead ) { @@ -276,7 +276,7 @@ AudioEventRTS& AudioEventRTS::operator=( const AudioEventRTS& right ) m_attackName = right.m_attackName; m_decayName = right.m_decayName; m_portionToPlayNext = right.m_portionToPlayNext; - m_uninterruptable = right.m_uninterruptable; + m_uninterruptible = right.m_uninterruptible; if( m_ownerType == OT_Positional || m_ownerType == OT_Dead ) { diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 3b3e93d67fc..a4df092b6d9 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -451,7 +451,7 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) #else const Bool logicalAudio = FALSE; #endif - const Bool notForLocal = !eventToAdd->getUninterruptable() && !shouldPlayLocally(eventToAdd); + const Bool notForLocal = !eventToAdd->getUninterruptible() && !shouldPlayLocally(eventToAdd); if (!logicalAudio && notForLocal) { diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h index df1dc768794..747a9167413 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h @@ -163,7 +163,7 @@ class W3DView : public View, public SubsystemInterface virtual void lookAt( const Coord3D *o ); ///< Center the view on the given coordinate virtual void initHeightForMap( void ); ///< Init the camera height for the map at the current position. - virtual void moveCameraTo(const Coord3D *o, Int miliseconds, Int shutter, Bool orient, Real easeIn, Real easeOut); + virtual void moveCameraTo(const Coord3D *o, Int milliseconds, Int shutter, Bool orient, Real easeIn, Real easeOut); virtual void moveCameraAlongWaypointPath(Waypoint *pWay, Int frames, Int shutter, Bool orient, Real easeIn, Real easeOut); virtual Bool isCameraMovementFinished(void); virtual Bool isCameraMovementAtWaypointAlongPath(void); diff --git a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index 2737f8e9863..61e7bccdb6b 100644 --- a/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -680,7 +680,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) DEBUG_LOG(("- Stream")); #endif - if ((info->m_soundType == AT_Streaming) && event->getUninterruptable()) { + if ((info->m_soundType == AT_Streaming) && event->getUninterruptible()) { stopAllSpeech(); } @@ -716,7 +716,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) audio->m_type = PAT_Stream; if (stream) { - if ((info->m_soundType == AT_Streaming) && event->getUninterruptable()) { + if ((info->m_soundType == AT_Streaming) && event->getUninterruptible()) { setDisallowSpeech(TRUE); } AIL_set_stream_volume_pan(stream, getEffectiveVolume(event), 0.5f); diff --git a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp index 50df49b2d25..49549ae4a64 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.cpp @@ -1317,14 +1317,14 @@ void AABTreeNodeClass::Select_Splitting_Plane SimpleDynVecClass & boxes ) { - const int NUM_TRYS = 300; + const int NUM_TRIES = 300; /* ** Try putting axis-aligned planes through some random vertices */ int objcount = boxes.Count(); - int trys = 0; - for (trys = 0; trys < MIN(NUM_TRYS,objcount); trys++) { + int tries = 0; + for (tries = 0; tries < MIN(NUM_TRIES,objcount); tries++) { int obj_index; SplitChoiceStruct test; @@ -1361,7 +1361,7 @@ void AABTreeNodeClass::Select_Splitting_Plane /* ** Still haven't found a valid splitting plane, uh-oh. */ - if ((trys >= MIN(NUM_TRYS,objcount)) && (sc->Cost == FLT_MAX)) { + if ((tries >= MIN(NUM_TRIES,objcount)) && (sc->Cost == FLT_MAX)) { Select_Splitting_Plane_Brute_Force(sc,boxes); return; } diff --git a/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp index 958d2cdea00..54380dccff9 100644 --- a/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp +++ b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp @@ -309,7 +309,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { WWASSERT(polyindices != nullptr); - const int NUM_TRYS = 50; + const int NUM_TRIES = 50; SplitChoiceStruct best_plane_stats; SplitChoiceStruct considered_plane_stats; @@ -317,7 +317,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) /* ** Try putting axis-aligned planes through some random vertices */ - for (int trys = 0; trys < MIN(NUM_TRYS,polycount); trys++) { + for (int tries = 0; tries < MIN(NUM_TRIES,polycount); tries++) { AAPlaneClass plane; diff --git a/Core/Tools/mangler/wlib/threadfac.cpp b/Core/Tools/mangler/wlib/threadfac.cpp index 7ba7f3b65a1..3973335f8fb 100644 --- a/Core/Tools/mangler/wlib/threadfac.cpp +++ b/Core/Tools/mangler/wlib/threadfac.cpp @@ -52,7 +52,7 @@ struct ThreadInformation // // Start a thread inside a class // -bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) +bit8 ThreadFactory::startThread(Runnable &runnable, void *data, bit8 destroy) { #ifdef _REENTRANT @@ -64,7 +64,7 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) ThreadInformation *tInfo=new ThreadInformation; - tInfo->startPoint=(void *)&runable; + tInfo->startPoint=(void *)&runnable; tInfo->data=data; tInfo->destroy=destroy; @@ -79,9 +79,9 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) else { { - runable.CritSec_.lock(); - runable.ThreadCount_--; // Ok, so it didn't really start - runable.CritSec_.unlock(); + runnable.CritSec_.lock(); + runnable.ThreadCount_--; // Ok, so it didn't really start + runnable.CritSec_.unlock(); } return(FALSE); } @@ -98,9 +98,9 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) else { { - runable.CritSec_.lock(); - runable.ThreadCount_--; // Ok, so it didn't really start - runable.CritSec_.unlock(); + runnable.CritSec_.lock(); + runnable.ThreadCount_--; // Ok, so it didn't really start + runnable.CritSec_.unlock(); } return(FALSE); } diff --git a/Core/Tools/mangler/wlib/threadfac.h b/Core/Tools/mangler/wlib/threadfac.h index 027de9be53b..68d8fe0bd71 100644 --- a/Core/Tools/mangler/wlib/threadfac.h +++ b/Core/Tools/mangler/wlib/threadfac.h @@ -74,7 +74,7 @@ class ThreadFactory { public: static bit8 startThread(void (*start_func)(void *), void *data); - static bit8 startThread(Runnable &runable, void *data, bit8 destroy=FALSE); + static bit8 startThread(Runnable &runnable, void *data, bit8 destroy=FALSE); }; diff --git a/Core/Tools/matchbot/wlib/threadfac.cpp b/Core/Tools/matchbot/wlib/threadfac.cpp index 7ba7f3b65a1..3973335f8fb 100644 --- a/Core/Tools/matchbot/wlib/threadfac.cpp +++ b/Core/Tools/matchbot/wlib/threadfac.cpp @@ -52,7 +52,7 @@ struct ThreadInformation // // Start a thread inside a class // -bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) +bit8 ThreadFactory::startThread(Runnable &runnable, void *data, bit8 destroy) { #ifdef _REENTRANT @@ -64,7 +64,7 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) ThreadInformation *tInfo=new ThreadInformation; - tInfo->startPoint=(void *)&runable; + tInfo->startPoint=(void *)&runnable; tInfo->data=data; tInfo->destroy=destroy; @@ -79,9 +79,9 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) else { { - runable.CritSec_.lock(); - runable.ThreadCount_--; // Ok, so it didn't really start - runable.CritSec_.unlock(); + runnable.CritSec_.lock(); + runnable.ThreadCount_--; // Ok, so it didn't really start + runnable.CritSec_.unlock(); } return(FALSE); } @@ -98,9 +98,9 @@ bit8 ThreadFactory::startThread(Runnable &runable, void *data, bit8 destroy) else { { - runable.CritSec_.lock(); - runable.ThreadCount_--; // Ok, so it didn't really start - runable.CritSec_.unlock(); + runnable.CritSec_.lock(); + runnable.ThreadCount_--; // Ok, so it didn't really start + runnable.CritSec_.unlock(); } return(FALSE); } diff --git a/Core/Tools/matchbot/wlib/threadfac.h b/Core/Tools/matchbot/wlib/threadfac.h index 027de9be53b..68d8fe0bd71 100644 --- a/Core/Tools/matchbot/wlib/threadfac.h +++ b/Core/Tools/matchbot/wlib/threadfac.h @@ -74,7 +74,7 @@ class ThreadFactory { public: static bit8 startThread(void (*start_func)(void *), void *data); - static bit8 startThread(Runnable &runable, void *data, bit8 destroy=FALSE); + static bit8 startThread(Runnable &runnable, void *data, bit8 destroy=FALSE); }; diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index df83634f15e..58fc87f96d9 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -973,7 +973,7 @@ class ControlBar : public SubsystemInterface void setCommandBarBorder( GameWindow *button, CommandButtonMappedBorderType type); public: - void updateCommanBarBorderColors(Color build, Color action, Color upgrade, Color system ); + void updateCommandBarBorderColors(Color build, Color action, Color upgrade, Color system ); private: diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h index 9b8afe8ea8a..b5f4785667a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -373,8 +373,8 @@ class ScriptEngine : public SubsystemInterface, void setFlag( ScriptAction *pAction ); void pauseTimer( ScriptAction *pAction ); void restartTimer( ScriptAction *pAction ); - void setTimer( ScriptAction *pAction, Bool milisecondTimer, Bool random); - void adjustTimer( ScriptAction *pAction, Bool milisecondTimer, Bool add); + void setTimer( ScriptAction *pAction, Bool millisecondTimer, Bool random); + void adjustTimer( ScriptAction *pAction, Bool millisecondTimer, Bool add); void enableScript( ScriptAction *pAction ); void disableScript( ScriptAction *pAction ); void callSubroutine( ScriptAction *pAction ); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 0e5a5952e08..1690c0c91be 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -931,7 +931,7 @@ ControlBar::ControlBar( void ) m_generalButtonHighlight = nullptr; m_genArrow = nullptr; m_sideSelectAnimateDown = FALSE; - updateCommanBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); + updateCommandBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); m_radarAttackGlowOn = FALSE; m_remainingRadarAttackGlowFrames = 0; @@ -2887,7 +2887,7 @@ void ControlBar::updateBuildUpClockColor( Color color) -void ControlBar::updateCommanBarBorderColors(Color build, Color action, Color upgrade, Color system ) +void ControlBar::updateCommandBarBorderColors(Color build, Color action, Color upgrade, Color system ) { m_commandButtonBorderBuildColor = build; m_commandButtonBorderActionColor = action; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index e96ec55f7aa..54f3c3e0eac 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -406,7 +406,7 @@ void ControlBarScheme::init(void) TheControlBar->updateBuildQueueDisabledImages( m_buttonQueueImage ); TheControlBar->updateRightHUDImage(m_rightHUDImage); TheControlBar->updateBuildUpClockColor( m_buildUpClockColor ); - TheControlBar->updateCommanBarBorderColors(m_borderBuildColor, m_borderActionColor, m_borderUpgradeColor,m_borderSystemColor); + TheControlBar->updateCommandBarBorderColors(m_borderBuildColor, m_borderActionColor, m_borderUpgradeColor,m_borderSystemColor); TheControlBar->updateBorderColor(m_commandBarBorderColor); //TheControlBar->updateCommandMarkerImage(m_commandMarkerImage); TheControlBar->updateSlotExitImage(m_commandMarkerImage); diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 5aa14860a19..3946161b6f6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -2744,7 +2744,7 @@ void ScriptActions::doSpeechPlay(const AsciiString& speechName, Bool allowOverla AudioEventRTS speech(speechName); speech.setIsLogicalAudio(true); speech.setPlayerIndex(ThePlayerList->getLocalPlayer()->getPlayerIndex()); - speech.setUninterruptable(!allowOverlap); + speech.setUninterruptible(!allowOverlap); TheAudio->addAudioEvent(&speech); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp index 67d3cacb9fa..e364ae3d366 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp @@ -304,7 +304,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { WWASSERT(polyindices != nullptr); - const int NUM_TRYS = 50; + const int NUM_TRIES = 50; SplitChoiceStruct best_plane_stats; SplitChoiceStruct considered_plane_stats; @@ -312,7 +312,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) /* ** Try putting axis-aligned planes through some random vertices */ - for (int trys = 0; trys < MIN(NUM_TRYS,polycount); trys++) { + for (int tries = 0; tries < MIN(NUM_TRIES,polycount); tries++) { AAPlaneClass plane; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.h index c90d8272303..20fc4a6e1be 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.h @@ -94,7 +94,7 @@ class SceneClass : public RefCountClass // RTTI information. /////////////////////////////////////////////////////////////////////////////////// enum { - SCENE_ID_UNKOWN = 0xFFFFFFFF, + SCENE_ID_UNKNOWN = 0xFFFFFFFF, SCENE_ID_SCENE = 0, SCENE_ID_SIMPLE, diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h index fb3da09a608..b4beb084eed 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h @@ -993,7 +993,7 @@ class ControlBar : public SubsystemInterface void setCommandBarBorder( GameWindow *button, CommandButtonMappedBorderType type); public: - void updateCommanBarBorderColors(Color build, Color action, Color upgrade, Color system ); + void updateCommandBarBorderColors(Color build, Color action, Color upgrade, Color system ); private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h index 0447dc20209..6e6de27516c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -382,8 +382,8 @@ class ScriptEngine : public SubsystemInterface, void setFlag( ScriptAction *pAction ); void pauseTimer( ScriptAction *pAction ); void restartTimer( ScriptAction *pAction ); - void setTimer( ScriptAction *pAction, Bool milisecondTimer, Bool random); - void adjustTimer( ScriptAction *pAction, Bool milisecondTimer, Bool add); + void setTimer( ScriptAction *pAction, Bool millisecondTimer, Bool random); + void adjustTimer( ScriptAction *pAction, Bool millisecondTimer, Bool add); void enableScript( ScriptAction *pAction ); void disableScript( ScriptAction *pAction ); void callSubroutine( ScriptAction *pAction ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 5afdde344a0..f6ffdb6d086 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -956,7 +956,7 @@ ControlBar::ControlBar( void ) m_generalButtonHighlight = nullptr; m_genArrow = nullptr; m_sideSelectAnimateDown = FALSE; - updateCommanBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); + updateCommandBarBorderColors(GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED,GAME_COLOR_UNDEFINED); m_radarAttackGlowOn = FALSE; m_remainingRadarAttackGlowFrames = 0; @@ -2912,7 +2912,7 @@ void ControlBar::updateBuildUpClockColor( Color color) -void ControlBar::updateCommanBarBorderColors(Color build, Color action, Color upgrade, Color system ) +void ControlBar::updateCommandBarBorderColors(Color build, Color action, Color upgrade, Color system ) { m_commandButtonBorderBuildColor = build; m_commandButtonBorderActionColor = action; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 0917eb073f6..f0183be7814 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -409,7 +409,7 @@ void ControlBarScheme::init(void) TheControlBar->updateBuildQueueDisabledImages( m_buttonQueueImage ); TheControlBar->updateRightHUDImage(m_rightHUDImage); TheControlBar->updateBuildUpClockColor( m_buildUpClockColor ); - TheControlBar->updateCommanBarBorderColors(m_borderBuildColor, m_borderActionColor, m_borderUpgradeColor,m_borderSystemColor); + TheControlBar->updateCommandBarBorderColors(m_borderBuildColor, m_borderActionColor, m_borderUpgradeColor,m_borderSystemColor); TheControlBar->updateBorderColor(m_commandBarBorderColor); //TheControlBar->updateCommandMarkerImage(m_commandMarkerImage); TheControlBar->updateSlotExitImage(m_commandMarkerImage); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 546efa1ae32..0b3157ae665 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -2825,7 +2825,7 @@ void ScriptActions::doSpeechPlay(const AsciiString& speechName, Bool allowOverla AudioEventRTS speech(speechName); speech.setIsLogicalAudio(true); speech.setPlayerIndex(ThePlayerList->getLocalPlayer()->getPlayerIndex()); - speech.setUninterruptable(!allowOverlap); + speech.setUninterruptible(!allowOverlap); TheAudio->addAudioEvent(&speech); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp index eda1055a510..8da112c923c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.cpp @@ -370,7 +370,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) { WWASSERT(polyindices != nullptr); - const int NUM_TRYS = 50; + const int NUM_TRIES = 50; SplitChoiceStruct best_plane_stats; SplitChoiceStruct considered_plane_stats; @@ -378,7 +378,7 @@ AABTreeBuilderClass::Select_Splitting_Plane(int polycount,int * polyindices) /* ** Try putting axis-aligned planes through some random vertices */ - for (int trys = 0; trys < MIN(NUM_TRYS,polycount); trys++) { + for (int tries = 0; tries < MIN(NUM_TRIES,polycount); tries++) { AAPlaneClass plane; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h index 3b243968bdf..72d239a69ce 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.h @@ -94,7 +94,7 @@ class SceneClass : public RefCountClass // RTTI information. /////////////////////////////////////////////////////////////////////////////////// enum { - SCENE_ID_UNKOWN = 0xFFFFFFFF, + SCENE_ID_UNKNOWN = 0xFFFFFFFF, SCENE_ID_SCENE = 0, SCENE_ID_SIMPLE, From a46a1452c435d6f3b21b49c4b857e203456dcb1e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 20 Jan 2026 18:25:06 +0100 Subject: [PATCH 076/211] refactor(math): Implement Matrix4x4::Inverse, Matrix3D::Get_Inverse and replace unsafe Matrix4x4 to D3DMATRIX casts with conversion functions that apply the required transpose (#2052) --- .../W3DDevice/GameClient/BaseHeightMap.cpp | 3 +- .../W3DDevice/GameClient/TerrainTex.cpp | 20 +- .../W3DDevice/GameClient/W3DShaderManager.cpp | 173 +++++++++--------- .../W3DDevice/GameClient/W3DTerrainTracks.cpp | 3 +- .../W3DDevice/GameClient/W3DTreeBuffer.cpp | 6 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 53 +++--- .../Source/WWVegas/WWMath/matrix3.cpp | 4 +- .../Source/WWVegas/WWMath/matrix3d.cpp | 129 ++++++++++--- .../Source/WWVegas/WWMath/matrix3d.h | 25 ++- .../Source/WWVegas/WWMath/matrix4.cpp | 71 +++++++ .../Libraries/Source/WWVegas/WWMath/matrix4.h | 137 ++++++++++---- .../GameClient/Shadow/W3DVolumetricShadow.cpp | 18 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 40 +++- .../Source/WWVegas/WW3D2/dx8wrapper.h | 97 ++++------ .../GameClient/Shadow/W3DVolumetricShadow.cpp | 18 +- .../Source/WWVegas/WW3D2/dx8wrapper.cpp | 40 +++- .../Source/WWVegas/WW3D2/dx8wrapper.h | 113 +++++------- 17 files changed, 566 insertions(+), 384 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index d376e73d1ca..eb27ee261d7 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -2964,8 +2964,7 @@ void BaseHeightMapRenderObjClass::renderTrees(CameraClass * camera) if (m_map==nullptr) return; if (Scene==nullptr) return; if (m_treeBuffer) { - Matrix3D tm(Transform); - DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); + DX8Wrapper::Set_Transform(D3DTS_WORLD,Transform); DX8Wrapper::Set_Material(m_vertexMaterialClass); RTS3DScene *pMyScene = (RTS3DScene *)Scene; RefRenderObjListIterator pDynamicLightsIterator(pMyScene->getDynamicLights()); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp index d9e0016badc..751779ff323 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp @@ -711,20 +711,20 @@ void LightMapTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); + D3DXMATRIX scale; D3DXMatrixScaling(&scale, STRETCH_FACTOR, STRETCH_FACTOR,1); inv *=scale; if (stage==0) { - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, *((Matrix4x4*)&inv)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, inv); } if (stage==1) { - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, *((Matrix4x4*)&inv)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, inv); } @@ -965,13 +965,13 @@ void CloudMapTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); + D3DXMATRIX scale; D3DXMatrixScaling(&scale, STRETCH_FACTOR, STRETCH_FACTOR,1); inv *=scale; @@ -999,7 +999,7 @@ void CloudMapTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, *((Matrix4x4*)&inv)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, inv); // Disable 3rd stage just in case. DX8Wrapper::Set_DX8_Texture_Stage_State( 2, D3DTSS_COLOROP, D3DTOP_DISABLE ); @@ -1018,7 +1018,7 @@ void CloudMapTerrainTextureClass::Apply(unsigned int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG1, D3DTA_CURRENT ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, *((Matrix4x4*)&inv)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, inv); } #endif } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp index 69397ece6c5..94c9331c4d7 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -1231,13 +1231,12 @@ Int ShroudTextureShader::set(Int stage) W3DShroud *shroud; if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { ///@todo: All this code really only need to be done once per camera/view. Find a way to optimize it out. - D3DXMATRIX inv; - float det; - - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset; @@ -1260,8 +1259,8 @@ Int ShroudTextureShader::set(Int stage) width = 1.0f/(width*shroud->getTextureWidth()); height = 1.0f/(height*shroud->getTextureHeight()); D3DXMatrixScaling(&scale, width, height, 1); - *((D3DXMATRIX *)&curView) = (inv * offset) * scale; - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), *((Matrix4x4*)&curView)); + curView = (inv * offset) * scale; + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), curView); } m_stageOfSet=stage; return TRUE; @@ -1324,13 +1323,12 @@ Int FlatShroudTextureShader::set(Int stage) W3DShroud *shroud; if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { ///@todo: All this code really only need to be done once per camera/view. Find a way to optimize it out. - D3DXMATRIX inv; - float det; - - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset; @@ -1353,8 +1351,8 @@ Int FlatShroudTextureShader::set(Int stage) width = 1.0f/(width*shroud->getTextureWidth()); height = 1.0f/(height*shroud->getTextureHeight()); D3DXMatrixScaling(&scale, width, height, 1); - *((D3DXMATRIX *)&curView) = (inv * offset) * scale; - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), *((Matrix4x4*)&curView)); + curView = (inv * offset) * scale; + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), curView); } m_stageOfSet=stage; return TRUE; @@ -1413,7 +1411,8 @@ Int MaskTextureShader::set(Int pass) shader.Set_Primary_Gradient(ShaderClass::GRADIENT_DISABLE); DX8Wrapper::Set_Shader(shader); DX8Wrapper::Apply_Render_State_Changes(); - Matrix4x4 curView; + + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); @@ -1423,7 +1422,7 @@ Int MaskTextureShader::set(Int pass) float det; //Get inverse view matrix so we can transform camera space points back to world space - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset,offsetTextureCenter; Coord3D centerPos; @@ -1450,17 +1449,19 @@ Int MaskTextureShader::set(Int pass) ///@todo: Fix this to work with non 128x128 textures. if (worldTexelWidth != 0 && worldTexelHeight != 0) - { Real widthScale = 1.0f/(worldTexelWidth*128.0f); + { + Real widthScale = 1.0f/(worldTexelWidth*128.0f); Real heightScale = 1.0f/(worldTexelHeight*128.0f); D3DXMatrixScaling(&scale, widthScale, heightScale, 1); - *((D3DXMATRIX *)&curView) = ((inv * offset) * scale)*offsetTextureCenter; + curView = ((inv * offset) * scale)*offsetTextureCenter; } else - { D3DXMatrixScaling(&scale, 0, 0, 1); //scaling by 0 will set uv coordinates to 0,0 - *((D3DXMATRIX *)&curView) = ((inv * offset) * scale); + { + D3DXMatrixScaling(&scale, 0, 0, 1); //scaling by 0 will set uv coordinates to 0,0 + curView = ((inv * offset) * scale); } - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, *((Matrix4x4*)&curView)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, curView); return TRUE; } @@ -1691,7 +1692,7 @@ Int TerrainShader2Stage::set(Int pass) break; case 2: // Noise/cloud pass - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); //these states apply to all noise/cloud combination passes @@ -1711,18 +1712,16 @@ Int TerrainShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_DESTCOLOR); DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND,D3DBLEND_ZERO); - D3DXMATRIX inv; float det; - - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_TERRAIN_BASE_NOISE12) { //setup cloud pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, W3DShaderManager::getShaderTexture(2)->Peek_D3D_Texture()); - updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, curView); //clouds always need bilinear filtering DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR); @@ -1731,7 +1730,7 @@ Int TerrainShader2Stage::set(Int pass) //setup noise pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(1, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - updateNoise2(((D3DXMATRIX*)&curView),&inv); + updateNoise2(&curView,&inv); DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, curView); //noise always needs point/linear filtering. Why point!? DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); @@ -1754,7 +1753,7 @@ Int TerrainShader2Stage::set(Int pass) if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_TERRAIN_BASE_NOISE1) { //setup cloud pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, W3DShaderManager::getShaderTexture(2)->Peek_D3D_Texture()); - updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } @@ -1762,14 +1761,14 @@ Int TerrainShader2Stage::set(Int pass) { //setup noise pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - updateNoise2(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + updateNoise2(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, *((Matrix4x4*)&curView)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, curView); } break; } @@ -2038,12 +2037,12 @@ Int TerrainShaderPixelShader::set(Int pass) if (W3DShaderManager::getCurrentShader() >= W3DShaderManager::ST_TERRAIN_BASE_NOISE1) { - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); // Two output coordinates are used. @@ -2066,10 +2065,10 @@ Int TerrainShaderPixelShader::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State(3, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(3, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, curView); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise2(&curView,&inv); //update curView with texture matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE3, curView); DX8Wrapper::Set_DX8_Texture_Stage_State(3, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); @@ -2083,14 +2082,14 @@ Int TerrainShaderPixelShader::set(Int pass) if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_TERRAIN_BASE_NOISE1) { //cloud map DX8Wrapper::_Get_D3D_Device8()->SetTexture(2, W3DShaderManager::getShaderTexture(2)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } else { //light map DX8Wrapper::_Get_D3D_Device8()->SetTexture(2, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise2(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } @@ -2158,16 +2157,16 @@ Int CloudTextureShader::init(void) /**Setup a certain texture stage to project our cloud texture*/ Int CloudTextureShader::set(Int stage) { - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); //Get a texture matrix that applies the current cloud position - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv,false); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView,&inv,false); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(stage, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); DX8Wrapper::Set_DX8_Texture_Stage_State(stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); @@ -2251,7 +2250,7 @@ Int RoadShaderPixelShader::init( void ) if (res >= DC_GENERIC_PIXEL_SHADER_1_1) { //this shader needs some assets that need to be loaded - //shader decleration + //shader declaration DWORD Declaration[]= { (D3DVSD_STREAM(0)), @@ -2293,12 +2292,12 @@ Int RoadShaderPixelShader::set(Int pass) DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA); - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex) { DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR); @@ -2330,10 +2329,10 @@ Int RoadShaderPixelShader::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv, false); //get texture projection matrix + terrainShader2Stage.updateNoise1(&curView,&inv, false); //get texture projection matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, curView); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv, false); //get texture projection matrix + terrainShader2Stage.updateNoise2(&curView,&inv, false); //get texture projection matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, curView); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); @@ -2408,12 +2407,12 @@ Int RoadShader2Stage::set(Int pass) if (W3DShaderManager::getCurrentShader() >= W3DShaderManager::ST_ROAD_BASE_NOISE1) { //second texture unit will contain a noise pass - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex) DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MIPFILTER, D3DTEXF_LINEAR); @@ -2440,7 +2439,7 @@ Int RoadShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv, false); //get texture projection matrix + terrainShader2Stage.updateNoise1(&curView, &inv, false); //get texture projection matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, curView); } else @@ -2448,14 +2447,14 @@ Int RoadShader2Stage::set(Int pass) if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_ROAD_BASE_NOISE1) { //cloud map DX8Wrapper::Set_Texture(1,W3DShaderManager::getShaderTexture(1)); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv, false); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView, &inv, false); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } else { //light map DX8Wrapper::Set_Texture(1,W3DShaderManager::getShaderTexture(2)); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv, false); //update curView with texture matrix + terrainShader2Stage.updateNoise2(&curView,&inv, false); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } @@ -2470,12 +2469,12 @@ Int RoadShader2Stage::set(Int pass) } else { //pass 1, apply additional noise pass - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex) DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MIPFILTER, D3DTEXF_LINEAR); @@ -2484,7 +2483,7 @@ Int RoadShader2Stage::set(Int pass) DX8Wrapper::Set_Texture(1,W3DShaderManager::getShaderTexture(2)); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv, false); //update curView with texture matrix + terrainShader2Stage.updateNoise2(&curView, &inv, false); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); @@ -3199,13 +3198,13 @@ Int W3DShaderManager::setShroudTex(Int stage) DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ALPHAARG2, D3DTA_CURRENT ); DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_COLOROP, D3DTOP_MODULATE ); DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 ); - D3DXMATRIX inv; - float det; - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset; @@ -3228,8 +3227,8 @@ Int W3DShaderManager::setShroudTex(Int stage) width = 1.0f/(width*shroud->getTextureWidth()); height = 1.0f/(height*shroud->getTextureHeight()); D3DXMatrixScaling(&scale, width, height, 1); - *((D3DXMATRIX *)&curView) = (inv * offset) * scale; - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), *((Matrix4x4*)&curView)); + curView = (inv * offset) * scale; + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), curView); return TRUE; } return FALSE; @@ -3318,13 +3317,12 @@ Int FlatTerrainShader2Stage::set(Int pass) W3DShroud *shroud; if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr) { - D3DXMATRIX inv; - float det; - - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset; @@ -3347,8 +3345,8 @@ Int FlatTerrainShader2Stage::set(Int pass) width = 1.0f/(width*shroud->getTextureWidth()); height = 1.0f/(height*shroud->getTextureHeight()); D3DXMatrixScaling(&scale, width, height, 1); - *((D3DXMATRIX *)&curView) = (inv * offset) * scale; - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0), *((Matrix4x4*)&curView)); + curView = (inv * offset) * scale; + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0), curView); } } else { DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 ); @@ -3371,7 +3369,7 @@ Int FlatTerrainShader2Stage::set(Int pass) break; case 1: // Noise/cloud pass - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); //these states apply to all noise/cloud combination passes @@ -3391,17 +3389,15 @@ Int FlatTerrainShader2Stage::set(Int pass) DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_DESTCOLOR); DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND,D3DBLEND_ZERO); - D3DXMATRIX inv; float det; - - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_FLAT_TERRAIN_BASE_NOISE12) { //setup cloud pass - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, curView); //clouds always need bilinear filtering DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR); @@ -3410,7 +3406,7 @@ Int FlatTerrainShader2Stage::set(Int pass) //setup noise pass - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv); + terrainShader2Stage.updateNoise2(&curView,&inv); DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, curView); //noise always needs point/linear filtering. Why point!? DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); @@ -3434,7 +3430,7 @@ Int FlatTerrainShader2Stage::set(Int pass) if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_FLAT_TERRAIN_BASE_NOISE1) { //setup cloud pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, W3DShaderManager::getShaderTexture(2)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise1(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } @@ -3442,14 +3438,14 @@ Int FlatTerrainShader2Stage::set(Int pass) { //setup noise pass DX8Wrapper::_Get_D3D_Device8()->SetTexture(0, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix + terrainShader2Stage.updateNoise2(&curView,&inv); //update curView with texture matrix DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); } DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, *((Matrix4x4*)&curView)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE0, curView); } break; } @@ -3589,13 +3585,12 @@ Int FlatTerrainShaderPixelShader::set(Int pass) //We need to scale so shroud texel stretches over one full terrain cell. Each texel //is 1/128 the size of full texture. (assuming 128x128 vid-mem texture). { - D3DXMATRIX inv; - float det; - - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale,offset; @@ -3618,8 +3613,8 @@ Int FlatTerrainShaderPixelShader::set(Int pass) width = 1.0f/(width*shroud->getTextureWidth()); height = 1.0f/(height*shroud->getTextureHeight()); D3DXMatrixScaling(&scale, width, height, 1); - *((D3DXMATRIX *)&curView) = (inv * offset) * scale; - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), *((Matrix4x4*)&curView)); + curView = (inv * offset) * scale; + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), curView); } DX8Wrapper::Set_DX8_Texture_Stage_State( curStage, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); DX8Wrapper::Set_DX8_Texture_Stage_State( curStage, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); @@ -3633,12 +3628,12 @@ Int FlatTerrainShaderPixelShader::set(Int pass) Bool doNoise1 = (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_FLAT_TERRAIN_BASE_NOISE1 || W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_FLAT_TERRAIN_BASE_NOISE12); if (doNoise1) { // Cloud pass. - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); // Two output coordinates are used. @@ -3647,8 +3642,8 @@ Int FlatTerrainShaderPixelShader::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); DX8Wrapper::_Get_D3D_Device8()->SetTexture(curStage, W3DShaderManager::getShaderTexture(2)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise1(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), *((Matrix4x4*)&curView)); + terrainShader2Stage.updateNoise1(&curView,&inv); //update curView with texture matrix + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), curView); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); @@ -3660,12 +3655,12 @@ Int FlatTerrainShaderPixelShader::set(Int pass) W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_FLAT_TERRAIN_BASE_NOISE12); if (doNoise2) { - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); D3DXMATRIX inv; float det; - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMatrixInverse(&inv, &det, &curView); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); // Two output coordinates are used. @@ -3674,8 +3669,8 @@ Int FlatTerrainShaderPixelShader::set(Int pass) DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); DX8Wrapper::_Get_D3D_Device8()->SetTexture(curStage, W3DShaderManager::getShaderTexture(3)->Peek_D3D_Texture()); - terrainShader2Stage.updateNoise2(((D3DXMATRIX*)&curView),&inv); //update curView with texture matrix - DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), *((Matrix4x4*)&curView)); + terrainShader2Stage.updateNoise2(&curView,&inv); //update curView with texture matrix + DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+curStage), curView); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_MINFILTER, D3DTEXF_LINEAR); DX8Wrapper::Set_DX8_Texture_Stage_State(curStage, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp index 1c3cc9e9bee..d49ead1e582 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp @@ -895,8 +895,7 @@ Try improving the fit to vertical surfaces like cliffs. trackStartIndex=0; mod=m_usedModules; - Matrix3D tm(mod->Transform); - DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); + DX8Wrapper::Set_Transform(D3DTS_WORLD,mod->Transform); while (mod) { if (mod->m_activeEdgeCount >= 2 && mod->Is_Really_Visible()) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp index 27e6961332b..204b14ec293 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp @@ -1718,9 +1718,9 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pD if (m_dwTreeVertexShader) { D3DXMATRIX matProj, matView, matWorld; - DX8Wrapper::_Get_DX8_Transform(D3DTS_WORLD, *(Matrix4x4*)&matWorld); - DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, *(Matrix4x4*)&matView); - DX8Wrapper::_Get_DX8_Transform(D3DTS_PROJECTION, *(Matrix4x4*)&matProj); + DX8Wrapper::_Get_DX8_Transform(D3DTS_WORLD, matWorld); + DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, matView); + DX8Wrapper::_Get_DX8_Transform(D3DTS_PROJECTION, matProj); D3DXMATRIX mat; D3DXMatrixMultiply( &mat, &matView, &matProj ); D3DXMatrixMultiply( &mat, &matWorld, &mat ); diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 31a11d23f43..8c25e70bd4a 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -238,19 +238,18 @@ void WaterRenderObjClass::setupJbaWaterShader(void) DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - D3DXMATRIX inv; - float det; - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale; - D3DXMatrixScaling(&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1); D3DXMATRIX destMatrix = inv * scale; D3DXMatrixTranslation(&scale, m_riverVOrigin, m_riverVOrigin,0); destMatrix = destMatrix*scale; - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, *(Matrix4x4*)&destMatrix); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, destMatrix); } m_pDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); @@ -1594,18 +1593,17 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo) // Alternate Clipping Method using alpha testing hack! /**************************************************************************************/ - D3DXMATRIX inv; - D3DXMATRIX clipMatrix; - Real det; - Matrix4x4 curView; - //get current view matrix + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); //get inverse of view matrix(= view to world matrix) - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + Real det; + D3DXMatrixInverse(&inv, &det, &curView); //create clipping matrix by inserting our plane equation into the 1st column + D3DXMATRIX clipMatrix; D3DXMatrixIdentity(&clipMatrix); clipMatrix(0,0)=WaterNormal.X; clipMatrix(1,0)=WaterNormal.Y; @@ -1623,7 +1621,7 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo) DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); // Set texture generation matrix for stage 1 - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, *((Matrix4*)&inv)); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE1, inv); // Disable bilinear filtering DX8Wrapper::Set_DX8_Texture_Stage_State(1, D3DTSS_MINFILTER, D3DTEXF_POINT); @@ -1788,9 +1786,7 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) matWW3D._23=1.0f; matWW3D._44=1.0f; - Matrix3D tm(Transform); - - DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); //position the water surface + DX8Wrapper::Set_Transform(D3DTS_WORLD,Transform); //position the water surface DX8Wrapper::Set_Texture(0,nullptr); //we'll be setting our own textures, so reset W3D DX8Wrapper::Set_Texture(1,nullptr); //we'll be setting our own textures, so reset W3D @@ -1801,8 +1797,8 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) rinfo.Camera.Get_Transform().Get_Translation(&camTran); - DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, *(Matrix4x4*)&matView); - DX8Wrapper::_Get_DX8_Transform(D3DTS_PROJECTION, *(Matrix4x4*)&matProj); + DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, matView); + DX8Wrapper::_Get_DX8_Transform(D3DTS_PROJECTION, matProj); //default setup from Kenny's demo m_pDev->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); @@ -1942,8 +1938,8 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) m_pDev->SetTextureStageState( 2, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); //Restore old transforms - DX8Wrapper::_Set_DX8_Transform(D3DTS_VIEW, *(Matrix4x4*)&matView); - DX8Wrapper::_Set_DX8_Transform(D3DTS_PROJECTION, *(Matrix4x4*)&matProj); + DX8Wrapper::_Set_DX8_Transform(D3DTS_VIEW, matView); + DX8Wrapper::_Set_DX8_Transform(D3DTS_PROJECTION, matProj); m_pDev->SetPixelShader(0); //turn off pixel shader m_pDev->SetVertexShader(DX8_FVF_XYZDUV1); //turn off custom vertex shader @@ -1967,7 +1963,7 @@ void WaterRenderObjClass::drawSea(RenderInfoClass & rinfo) D3DXMatrixMultiply(&matTemp, &patchMatrix, &matWW3D); - DX8Wrapper::_Set_DX8_Transform(D3DTS_WORLD, *(Matrix4x4*)&matTemp); + DX8Wrapper::_Set_DX8_Transform(D3DTS_WORLD, matTemp); m_pDev->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP,0,m_numVertices,0,m_numIndices); } @@ -2359,9 +2355,7 @@ void WaterRenderObjClass::renderWaterMesh(void) m_vertexBufferD3D->Unlock(); - Matrix3D tm(Transform); - - DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); //position the water surface + DX8Wrapper::Set_Transform(D3DTS_WORLD,Transform); //position the water surface DX8Wrapper::Set_Material(m_meshVertexMaterialClass); ShaderClass::CullModeType oldCullMode=m_shaderClass.Get_Cull_Mode(); @@ -2994,19 +2988,18 @@ void WaterRenderObjClass::setupFlatWaterShader(void) DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); - D3DXMATRIX inv; - float det; - Matrix4x4 curView; + D3DXMATRIX curView; DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView); - D3DXMatrixInverse(&inv, &det, (D3DXMATRIX*)&curView); + D3DXMATRIX inv; + float det; + D3DXMatrixInverse(&inv, &det, &curView); D3DXMATRIX scale; - D3DXMatrixScaling(&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1); D3DXMATRIX destMatrix = inv * scale; D3DXMatrixTranslation(&scale, m_riverVOrigin, m_riverVOrigin,0); destMatrix = destMatrix*scale; - DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, *(Matrix4x4*)&destMatrix); + DX8Wrapper::_Set_DX8_Transform(D3DTS_TEXTURE2, destMatrix); } m_pDev->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix3.cpp b/Core/Libraries/Source/WWVegas/WWMath/matrix3.cpp index 26de94bb921..40a3ea4d14b 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix3.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix3.cpp @@ -290,7 +290,7 @@ void Matrix3x3::Symmetric_Eigen_Solve(void) void Matrix3x3::Multiply(const Matrix3x3 & A,const Matrix3x3 & B,Matrix3x3 * set_res) { Matrix3x3 tmp; - Matrix3x3 * Aptr; + const Matrix3x3 * Aptr; float tmp1,tmp2,tmp3; // Check for aliased parameters, copy the 'A' matrix into a temporary if the @@ -300,7 +300,7 @@ void Matrix3x3::Multiply(const Matrix3x3 & A,const Matrix3x3 & B,Matrix3x3 * set tmp = A; Aptr = &tmp; } else { - Aptr = (Matrix3x3 *)&A; + Aptr = &A; } tmp1 = B[0][0]; diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp index 6e4cfab78d8..dd2009a659d 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp @@ -64,7 +64,10 @@ #include "matrix3.h" #include "matrix4.h" #include "quat.h" -#include "d3dx8math.h" + +#include "WWLib/win.h" +#include +#include // some static matrices which are sometimes useful const Matrix3D Matrix3D::Identity @@ -509,32 +512,76 @@ void Matrix3D::Obj_Look_At(const Vector3 &p,const Vector3 &t,float roll) * * * HISTORY: * * 8/7/98 GTH : Created. * + * 01/03/2026 TheSuperHackers : Implemented. * *=============================================================================================*/ -void Matrix3D::Get_Inverse(Matrix3D & inv) const +Matrix3D * Matrix3D::Get_Inverse(Matrix3D * out, float * detOut, const Matrix3D * m) { - // TODO: Implement the general purpose inverse function here (once we need it :-) - //Get_Orthogonal_Inverse(inv); + // Read linear + translation elements + + const float m00 = m->Row[0][0], m01 = m->Row[1][0], m02 = m->Row[2][0]; + const float m10 = m->Row[0][1], m11 = m->Row[1][1], m12 = m->Row[2][1]; + const float m20 = m->Row[0][2], m21 = m->Row[1][2], m22 = m->Row[2][2]; + + const float tx = m->Row[0][3]; + const float ty = m->Row[1][3]; + const float tz = m->Row[2][3]; + + // Compute 2x2 sub-determinants (minors) for cofactor expansion + // These correspond to minors of the 4x4 extended matrix (with last row 0,0,0,1) + + const float s0 = m00 * m11 - m10 * m01; + const float s1 = m00 * m12 - m10 * m02; + const float s3 = m01 * m12 - m11 * m02; + + const float c5 = m22; + const float c4 = m21; + const float c2 = m20; + + const float c3 = m21 * tz - ty * m22; + const float c1 = m20 * tz - tx * m22; + const float c0 = m20 * ty - tx * m21; + + // Compute determinant (matches 4x4 extended determinant) + + const float det = s0 * c5 - s1 * c4 + s3 * c2; + + if (detOut) + *detOut = det; + + if (fabsf(det) < 1e-8f) + return NULL; + + const float invDet = 1.0f / det; + + // Compute inverse using adjugate / determinant + // Adjugate = transpose of cofactor matrix + // Multiplies each cofactor by 1/det to get the inverse + // Writes in column-major order to match engine conventions + + out->Row[0][0] = ( m11 * c5 - m12 * c4) * invDet; + out->Row[1][0] = (-m01 * c5 + m02 * c4) * invDet; + out->Row[2][0] = ( s3) * invDet; - Matrix4x4 mat4(*this); - Matrix4x4 mat4Inv; + out->Row[0][1] = (-m10 * c5 + m12 * c2) * invDet; + out->Row[1][1] = ( m00 * c5 - m02 * c2) * invDet; + out->Row[2][1] = ( -s1) * invDet; - float det; - D3DXMatrixInverse((D3DXMATRIX *)&mat4Inv, &det, (D3DXMATRIX*)&mat4); + out->Row[0][2] = ( m10 * c4 - m11 * c2) * invDet; + out->Row[1][2] = (-m00 * c4 + m01 * c2) * invDet; + out->Row[2][2] = ( s0) * invDet; - inv.Row[0][0]=mat4Inv[0][0]; - inv.Row[0][1]=mat4Inv[0][1]; - inv.Row[0][2]=mat4Inv[0][2]; - inv.Row[0][3]=mat4Inv[0][3]; + // Translation (still from 4x4 cofactors) - inv.Row[1][0]=mat4Inv[1][0]; - inv.Row[1][1]=mat4Inv[1][1]; - inv.Row[1][2]=mat4Inv[1][2]; - inv.Row[1][3]=mat4Inv[1][3]; + out->Row[0][3] = (-m10 * c3 + m11 * c1 - m12 * c0) * invDet; + out->Row[1][3] = ( m00 * c3 - m01 * c1 + m02 * c0) * invDet; + out->Row[2][3] = (-tx * s3 + ty * s1 - tz * s0) * invDet; - inv.Row[2][0]=mat4Inv[2][0]; - inv.Row[2][1]=mat4Inv[2][1]; - inv.Row[2][2]=mat4Inv[2][2]; - inv.Row[2][3]=mat4Inv[2][3]; + return out; +} + +void Matrix3D::Get_Inverse(Matrix3D & inv) const +{ + Get_Inverse(&inv, NULL, this); } /*********************************************************************************************** @@ -641,7 +688,7 @@ void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res assert(set_res != nullptr); Matrix3D tmp; - Matrix3D * Aptr; + const Matrix3D * Aptr; // Check for aliased parameters, copy the 'A' matrix into a temporary if the // result is going into 'A'. (in this case, this function is no better than @@ -650,7 +697,7 @@ void Matrix3D::Multiply(const Matrix3D & A,const Matrix3D & B,Matrix3D * set_res tmp = A; Aptr = &tmp; } else { - Aptr = (Matrix3D *)&A; + Aptr = &A; } #ifdef ALLOW_TEMPORARIES @@ -1239,3 +1286,41 @@ bool Matrix3D::Solve_Linear_System(Matrix3D & system) return true; } + + +void To_D3DMATRIX(_D3DMATRIX& dxm, const Matrix3D& m) +{ + dxm.m[0][0] = m[0][0]; + dxm.m[0][1] = m[1][0]; + dxm.m[0][2] = m[2][0]; + dxm.m[0][3] = 0.0f; + + dxm.m[1][0] = m[0][1]; + dxm.m[1][1] = m[1][1]; + dxm.m[1][2] = m[2][1]; + dxm.m[1][3] = 0.0f; + + dxm.m[2][0] = m[0][2]; + dxm.m[2][1] = m[1][2]; + dxm.m[2][2] = m[2][2]; + dxm.m[2][3] = 0.0f; + + dxm.m[3][0] = m[0][3]; + dxm.m[3][1] = m[1][3]; + dxm.m[3][2] = m[2][3]; + dxm.m[3][3] = 1.0f; +} + +_D3DMATRIX To_D3DMATRIX(const Matrix3D& m) +{ + _D3DMATRIX dxm; + To_D3DMATRIX(dxm, m); + return dxm; +} + +D3DXMATRIX To_D3DXMATRIX(const Matrix3D& m) +{ + D3DXMATRIX dxm; + To_D3DMATRIX(dxm, m); + return dxm; +} diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.h b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.h index c849c8dab5c..6aa42037091 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.h +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.h @@ -115,7 +115,7 @@ class Quaternion; I use column-vectors so normally transformations are post-multiplied and camera transformations should be pre-multiplied. The methods of this class called Translate, Rotate_X, etc. all perform post-multiplication - with the current matix. These methods (Translate, Rotate_X, etc) also + with the current matrix. These methods (Translate, Rotate_X, etc) also have been hand-coded to only perform the necessary arithmetic. The * operator can be used for general purpose matrix multiplication or to transform a vector by a matrix. @@ -231,7 +231,7 @@ class Matrix3D // These functions will give you the approximate amount that the // matrix has been rotated about a given axis. These functions - // cannot be used to re-build a matrx. Use the EulerAnglesClass + // cannot be used to re-build a matrix. Use the EulerAnglesClass // to convert a matrix into a set of three Euler angles. float Get_X_Rotation(void) const; float Get_Y_Rotation(void) const; @@ -306,12 +306,9 @@ class Matrix3D WWINLINE void Get_Z_Vector(Vector3 * set_z) const { set_z->Set(Row[0][2], Row[1][2], Row[2][2]); } // Get the inverse of the matrix. - // TODO: currently the "intended-to-be" general inverse function just calls - // the special case Orthogonal inverse functions. Also, when we implement - // general case, check where we were using Get_Inverse since usually it should - // be changed to Get_Orthogonal_Inverse... - void Get_Inverse(Matrix3D & set_inverse) const; - void Get_Orthogonal_Inverse(Matrix3D & set_inverse) const; + static Matrix3D * Get_Inverse(Matrix3D * out, float * detOut, const Matrix3D * m); + void Get_Inverse(Matrix3D & inv) const; + void Get_Orthogonal_Inverse(Matrix3D & inv) const; // used for importing SurRender matrices void Copy_3x3_Matrix(float matrix[3][3]); @@ -1810,3 +1807,15 @@ class DynamicMatrix3D : public W3DMPO public: Matrix3D Mat; }; + + +// TheSuperHackers @info Always convert Matrix3D to D3DMATRIX or vice versa with the conversion functions below. +// Reason being, D3DMATRIX is row-major, and Matrix3D is column-major and therefore copying one matrix to the +// other will always require a transpose. + +struct _D3DMATRIX; +struct D3DXMATRIX; + +extern void To_D3DMATRIX(_D3DMATRIX& dxm, const Matrix3D& m); +extern _D3DMATRIX To_D3DMATRIX(const Matrix3D& m); +extern D3DXMATRIX To_D3DXMATRIX(const Matrix3D& m); diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix4.cpp b/Core/Libraries/Source/WWVegas/WWMath/matrix4.cpp index 69a0206e51b..0b489a40c72 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix4.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix4.cpp @@ -43,6 +43,10 @@ #include "matrix4.h" #include +#include "WWLib/win.h" +#include +#include + /*********************************************************************************************** * Matrix4x4::Multiply -- Multiply two Matrix4x4's together * * * @@ -195,3 +199,70 @@ int operator != (const Matrix4x4 & a, const Matrix4x4 & b) return (!(a == b)); } + +void To_D3DMATRIX(_D3DMATRIX& dxm, const Matrix4x4& m) +{ + dxm.m[0][0] = m[0][0]; + dxm.m[0][1] = m[1][0]; + dxm.m[0][2] = m[2][0]; + dxm.m[0][3] = m[3][0]; + + dxm.m[1][0] = m[0][1]; + dxm.m[1][1] = m[1][1]; + dxm.m[1][2] = m[2][1]; + dxm.m[1][3] = m[3][1]; + + dxm.m[2][0] = m[0][2]; + dxm.m[2][1] = m[1][2]; + dxm.m[2][2] = m[2][2]; + dxm.m[2][3] = m[3][2]; + + dxm.m[3][0] = m[0][3]; + dxm.m[3][1] = m[1][3]; + dxm.m[3][2] = m[2][3]; + dxm.m[3][3] = m[3][3]; +} + +_D3DMATRIX To_D3DMATRIX(const Matrix4x4& m) +{ + _D3DMATRIX dxm; + To_D3DMATRIX(dxm, m); + return dxm; +} + +D3DXMATRIX To_D3DXMATRIX(const Matrix4x4& m) +{ + D3DXMATRIX dxm; + To_D3DMATRIX(dxm, m); + return dxm; +} + +void To_Matrix4x4(Matrix4x4& m, const _D3DMATRIX& dxm) +{ + m[0][0] = dxm.m[0][0]; + m[0][1] = dxm.m[1][0]; + m[0][2] = dxm.m[2][0]; + m[0][3] = dxm.m[3][0]; + + m[1][0] = dxm.m[0][1]; + m[1][1] = dxm.m[1][1]; + m[1][2] = dxm.m[2][1]; + m[1][3] = dxm.m[3][1]; + + m[2][0] = dxm.m[0][2]; + m[2][1] = dxm.m[1][2]; + m[2][2] = dxm.m[2][2]; + m[2][3] = dxm.m[3][2]; + + m[3][0] = dxm.m[0][3]; + m[3][1] = dxm.m[1][3]; + m[3][2] = dxm.m[2][3]; + m[3][3] = dxm.m[3][3]; +} + +Matrix4x4 To_Matrix4x4(const _D3DMATRIX& dxm) +{ + Matrix4x4 m; + To_Matrix4x4(m, dxm); + return m; +} diff --git a/Core/Libraries/Source/WWVegas/WWMath/matrix4.h b/Core/Libraries/Source/WWVegas/WWMath/matrix4.h index 81211850c79..33e151363a3 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix4.h +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix4.h @@ -110,6 +110,7 @@ class Matrix4x4 ** Transpose and Inverse */ WWINLINE Matrix4x4 Transpose(void) const; + static WWINLINE Matrix4x4* Inverse(Matrix4x4* out, float* detOut, const Matrix4x4* m); WWINLINE Matrix4x4 Inverse(void) const; /* @@ -520,7 +521,7 @@ WWINLINE Matrix4x4 Matrix4x4::Transpose() const } /*********************************************************************************************** - * Matrix4x4::Inverse -- returns the inverse of the matrix * + * Matrix4x4::Inverse -- returns the inverse of the matrix * * * * INPUT: * * * @@ -530,46 +531,87 @@ WWINLINE Matrix4x4 Matrix4x4::Transpose() const * * * HISTORY: * * 06/02/1997 GH : Created. * + * 01/03/2026 TheSuperHackers : Implemented. * *=============================================================================================*/ -WWINLINE Matrix4x4 Matrix4x4::Inverse() const // Gauss-Jordan elimination with partial pivoting -{ - WWASSERT_PRINT(0,"Matrix4x4::Inverse does not work, re-implement!"); - - Matrix4x4 a(*this); // As a evolves from original mat into identity - Matrix4x4 b(true); // b evolves from identity into inverse(a) - int i, j, i1; - - // Loop over cols of a from left to right, eliminating above and below diagonal - for (j=0; j<4; j++) { - - // Find largest pivot in column j among rows j..3 - i1 = j; - for (i=j+1; i<4; i++) { - if (WWMath::Fabs(a[i][j]) > WWMath::Fabs(a[i1][j])) { - i1 = i; - } - } - - // Swap rows i1 and j in a and b to put pivot on diagonal - Swap(a.Row[i1], a.Row[j]); - Swap(b.Row[i1], b.Row[j]); - - // Scale row j to have a unit diagonal - if (a[j][j]==0.) { - //ALGEBRA_ERROR("Matrix4x4::inverse: singular matrix; can't invert\n"); - } - b.Row[j] /= a.Row[j][j]; - a.Row[j] /= a.Row[j][j]; - - // Eliminate off-diagonal elems in col j of a, doing identical ops to b - for (i=0; i<4; i++) { - if (i != j) { - b.Row[i] -= a[i][j] * b.Row[j]; - a.Row[i] -= a[i][j] * a.Row[j]; - } - } - } - return b; +WWINLINE Matrix4x4* Matrix4x4::Inverse(Matrix4x4* out, float* detOut, const Matrix4x4* m) +{ + // Read matrix elements + // Uses a column-major, column-vector convention (matches D3DXMatrixInverse) + // Row[i][j] stores the element at row i, column j. + + const float m00 = m->Row[0][0], m01 = m->Row[1][0], m02 = m->Row[2][0], m03 = m->Row[3][0]; + const float m10 = m->Row[0][1], m11 = m->Row[1][1], m12 = m->Row[2][1], m13 = m->Row[3][1]; + const float m20 = m->Row[0][2], m21 = m->Row[1][2], m22 = m->Row[2][2], m23 = m->Row[3][2]; + const float m30 = m->Row[0][3], m31 = m->Row[1][3], m32 = m->Row[2][3], m33 = m->Row[3][3]; + + // Compute 2x2 determinants (minors) used for cofactors + // s0..s5: sub-determinants of the upper-left 2x2 blocks, used in cofactor expansion + + const float s0 = m00 * m11 - m10 * m01; + const float s1 = m00 * m12 - m10 * m02; + const float s2 = m00 * m13 - m10 * m03; + const float s3 = m01 * m12 - m11 * m02; + const float s4 = m01 * m13 - m11 * m03; + const float s5 = m02 * m13 - m12 * m03; + + // c0..c5: sub-determinants of the lower-right 2x2 blocks, used in cofactor expansion + + const float c5 = m22 * m33 - m32 * m23; + const float c4 = m21 * m33 - m31 * m23; + const float c3 = m21 * m32 - m31 * m22; + const float c2 = m20 * m33 - m30 * m23; + const float c1 = m20 * m32 - m30 * m22; + const float c0 = m20 * m31 - m30 * m21; + + // Compute determinant of 4x4 matrix + // Using cofactor expansion along the first row + // If det is near zero, the matrix is singular and cannot be inverted + + const float det = + s0 * c5 - s1 * c4 + s2 * c3 + + s3 * c2 - s4 * c1 + s5 * c0; + + if (detOut) + *detOut = det; + + if (fabsf(det) < 1e-8f) + return NULL; + + const float invDet = 1.0f / det; + + // Compute inverse matrix using adjugate / determinant + // The adjugate matrix is the transpose of the cofactor matrix + // Multiplies each cofactor by 1/det to get the inverse + // Writes in column-major order to match engine conventions + + out->Row[0][0] = ( m11 * c5 - m12 * c4 + m13 * c3) * invDet; + out->Row[1][0] = (-m01 * c5 + m02 * c4 - m03 * c3) * invDet; + out->Row[2][0] = ( m31 * s5 - m32 * s4 + m33 * s3) * invDet; + out->Row[3][0] = (-m21 * s5 + m22 * s4 - m23 * s3) * invDet; + + out->Row[0][1] = (-m10 * c5 + m12 * c2 - m13 * c1) * invDet; + out->Row[1][1] = ( m00 * c5 - m02 * c2 + m03 * c1) * invDet; + out->Row[2][1] = (-m30 * s5 + m32 * s2 - m33 * s1) * invDet; + out->Row[3][1] = ( m20 * s5 - m22 * s2 + m23 * s1) * invDet; + + out->Row[0][2] = ( m10 * c4 - m11 * c2 + m13 * c0) * invDet; + out->Row[1][2] = (-m00 * c4 + m01 * c2 - m03 * c0) * invDet; + out->Row[2][2] = ( m30 * s4 - m31 * s2 + m33 * s0) * invDet; + out->Row[3][2] = (-m20 * s4 + m21 * s2 - m23 * s0) * invDet; + + out->Row[0][3] = (-m10 * c3 + m11 * c1 - m12 * c0) * invDet; + out->Row[1][3] = ( m00 * c3 - m01 * c1 + m02 * c0) * invDet; + out->Row[2][3] = (-m30 * s3 + m31 * s1 - m32 * s0) * invDet; + out->Row[3][3] = ( m20 * s3 - m21 * s1 + m22 * s0) * invDet; + + return out; +} + +WWINLINE Matrix4x4 Matrix4x4::Inverse() const +{ + Matrix4x4 inv; + Inverse(&inv, NULL, this); + return inv; } /*********************************************************************************************** @@ -836,3 +878,18 @@ WWINLINE void Matrix4x4::Transform_Vector(const Matrix4x4 & A,const Vector4 & in out->Z = (A[2][0] * v->X + A[2][1] * v->Y + A[2][2] * v->Z + A[2][3] * v->W); out->W = (A[3][0] * v->X + A[3][1] * v->Y + A[3][2] * v->Z + A[3][3] * v->W); } + + +// TheSuperHackers @info Always convert Matrix4x4 to D3DMATRIX or vice versa with the conversion functions below. +// Reason being, D3DMATRIX is row-major, and Matrix4x4 is column-major and therefore copying one matrix to the +// other will always require a transpose. + +struct _D3DMATRIX; +struct D3DXMATRIX; + +extern void To_D3DMATRIX(_D3DMATRIX& dxm, const Matrix4x4& m); +extern _D3DMATRIX To_D3DMATRIX(const Matrix4x4& m); +extern D3DXMATRIX To_D3DXMATRIX(const Matrix4x4& m); + +extern void To_Matrix4x4(Matrix4x4& m, const _D3DMATRIX& dxm); +extern Matrix4x4 To_Matrix4x4(const _D3DMATRIX& dxm); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 310b90dec1e..cf736e2b920 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -1245,11 +1245,8 @@ void W3DVolumetricShadow::RenderMeshVolume(Int meshIndex, Int lightIndex, const if( numVerts == 0 || numPolys == 0 ) return; - Matrix4x4 mWorld(*meshXform); - - ///@todo: W3D always does transpose on all of matrix sets. Slow??? Better to hack view matrix. - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(*meshXform); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); W3DBufferManager::W3DVertexBufferSlot *vbSlot=m_shadowVolumeVB[lightIndex][ meshIndex ]; if (!vbSlot) @@ -1362,9 +1359,8 @@ void W3DVolumetricShadow::RenderDynamicMeshVolume(Int meshIndex, Int lightIndex, m_pDev->SetIndices(shadowIndexBufferD3D,nShadowStartBatchVertex); - Matrix4x4 mWorld(*meshXform); - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(*meshXform); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); if (shadowVertexBufferD3D != lastActiveVertexBuffer) { m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX)); @@ -1518,8 +1514,8 @@ void W3DVolumetricShadow::RenderMeshVolumeBounds(Int meshIndex, Int lightIndex, //todo: replace this with mesh transform Matrix4x4 mWorld(1); //identity since boxes are pre-transformed to world space. - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(mWorld); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX)); m_pDev->SetVertexShader(SHADOW_DYNAMIC_VOLUME_FVF); @@ -1907,7 +1903,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const // system change, not the translations // Real det; - D3DXMatrixInverse((D3DXMATRIX*)&worldToObject, &det, (D3DXMATRIX*)&objectToWorld); + Matrix4x4::Inverse(&worldToObject, &det, &objectToWorld); // find out light position in object space Matrix4x4::Transform_Vector(worldToObject,lightPosWorld,&lightPosObject); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index e34b66ac244..0e20057d1f8 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -164,8 +164,8 @@ bool DX8Wrapper::IsDeviceLost; int DX8Wrapper::ZBias; float DX8Wrapper::ZNear; float DX8Wrapper::ZFar; -Matrix4x4 DX8Wrapper::ProjectionMatrix; -Matrix4x4 DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; +D3DMATRIX DX8Wrapper::ProjectionMatrix; +D3DMATRIX DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; DX8Caps* DX8Wrapper::CurrentCaps = nullptr; @@ -477,13 +477,7 @@ void DX8Wrapper::Invalidate_Cached_Render_States(void) Release_Render_State(); // (gth) clear the matrix shadows too - for (int i=0; i_11 = 1.0f; + dxm->_22 = 1.0f; + dxm->_33 = 1.0f; + dxm->_44 = 1.0f; +} +} // namespace wrapper + +void DX8Wrapper::Set_World_Identity() +{ + if (render_state_changed&(unsigned)WORLD_IDENTITY) + return; + wrapper::D3DMatrixIdentity(&render_state.world); + render_state_changed|=(unsigned)WORLD_CHANGED|(unsigned)WORLD_IDENTITY; +} + +void DX8Wrapper::Set_View_Identity() +{ + if (render_state_changed&(unsigned)VIEW_IDENTITY) + return; + wrapper::D3DMatrixIdentity(&render_state.view); + render_state_changed|=(unsigned)VIEW_CHANGED|(unsigned)VIEW_IDENTITY; +} + //********************************************************************************************** //! Resets render device to default state /*! diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index de29437b8bd..424474eadfc 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -173,8 +173,8 @@ struct RenderStateStruct TextureBaseClass * Textures[MAX_TEXTURE_STAGES]; D3DLIGHT8 Lights[4]; bool LightEnable[4]; - Matrix4x4 world; - Matrix4x4 view; + D3DMATRIX world; + D3DMATRIX view; unsigned vertex_buffer_type; unsigned index_buffer_type; unsigned short vba_offset; @@ -292,16 +292,15 @@ class DX8Wrapper static void Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m); static void Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m); static void Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m); - static void Set_World_Identity(); + static void Set_World_Identity(); static void Set_View_Identity(); - static bool Is_World_Identity(); + static bool Is_World_Identity(); static bool Is_View_Identity(); // Note that *_DX8_Transform() functions take the matrix in DX8 format - transposed from Westwood convention. - static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m); - static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m); - static void _Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m); + static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform, const D3DMATRIX& m); + static void _Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, D3DMATRIX& m); static void Set_DX8_Light(int index,D3DLIGHT8* light); static void Set_DX8_Render_State(D3DRENDERSTATETYPE state, unsigned value); @@ -613,7 +612,7 @@ class DX8Wrapper static RenderStateStruct render_state; static unsigned render_state_changed; - static Matrix4x4 DX8Transforms[D3DTS_WORLD+1]; + static D3DMATRIX DX8Transforms[D3DTS_WORLD+1]; static bool IsInitted; static bool IsDeviceLost; @@ -693,7 +692,7 @@ class DX8Wrapper static int ZBias; static float ZNear; static float ZFar; - static Matrix4x4 ProjectionMatrix; + static D3DMATRIX ProjectionMatrix; friend void DX8_Assert(); friend class WW3D; @@ -745,40 +744,27 @@ WWINLINE void DX8Wrapper::Set_Pixel_Shader_Constant(int reg, const void* data, i } // shader system updates KJM ^ - -WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m) -{ - WWASSERT(transform<=D3DTS_WORLD); -#if 0 // (gth) this optimization is breaking generals because they set the transform behind our backs. - if (m!=DX8Transforms[transform]) -#endif - { - DX8Transforms[transform]=m; - SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3],m[3][0],m[3][1],m[3][2],m[3][3])); - DX8_RECORD_MATRIX_CHANGE(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m)); - } -} - - -WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m) +WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform, const D3DMATRIX& m) { WWASSERT(transform<=D3DTS_WORLD); - Matrix4x4 mtx(m); #if 0 // (gth) this optimization is breaking generals because they set the transform behind our backs. if (mtx!=DX8Transforms[transform]) #endif { - DX8Transforms[transform]=mtx; - SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3])); + DX8Transforms[transform]=m; + SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]", + transform, + m.m[0][0],m.m[0][1],m.m[0][2],m.m[0][3], + m.m[1][0],m.m[1][1],m.m[1][2],m.m[1][3], + m.m[2][0],m.m[2][1],m.m[2][2],m.m[2][3])); DX8_RECORD_MATRIX_CHANGE(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m)); + DX8CALL(SetTransform(transform,&m)); } } -WWINLINE void DX8Wrapper::_Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m) +WWINLINE void DX8Wrapper::_Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, D3DMATRIX& m) { - DX8CALL(GetTransform(transform,(D3DMATRIX*)&m)); + DX8CALL(GetTransform(transform,&m)); } // ---------------------------------------------------------------------------- @@ -1195,67 +1181,52 @@ WWINLINE void DX8Wrapper::Set_Transform(D3DTRANSFORMSTATETYPE transform,const Ma { switch ((int)transform) { case D3DTS_WORLD: - render_state.world=m.Transpose(); + render_state.world=To_D3DMATRIX(m); render_state_changed|=(unsigned)WORLD_CHANGED; render_state_changed&=~(unsigned)WORLD_IDENTITY; break; case D3DTS_VIEW: - render_state.view=m.Transpose(); + render_state.view=To_D3DMATRIX(m); render_state_changed|=(unsigned)VIEW_CHANGED; render_state_changed&=~(unsigned)VIEW_IDENTITY; break; case D3DTS_PROJECTION: { - Matrix4x4 ProjectionMatrix=m.Transpose(); + D3DMATRIX ProjectionMatrix=To_D3DMATRIX(m); ZFar=0.0f; ZNear=0.0f; - DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&ProjectionMatrix)); + DX8CALL(SetTransform(D3DTS_PROJECTION,&ProjectionMatrix)); } break; default: DX8_RECORD_MATRIX_CHANGE(); - Matrix4x4 m2=m.Transpose(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2)); + D3DMATRIX dxm=To_D3DMATRIX(m); + DX8CALL(SetTransform(transform,&dxm)); break; } } WWINLINE void DX8Wrapper::Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m) { - Matrix4x4 m2(m); switch ((int)transform) { case D3DTS_WORLD: - render_state.world=m2.Transpose(); + render_state.world=To_D3DMATRIX(m); render_state_changed|=(unsigned)WORLD_CHANGED; render_state_changed&=~(unsigned)WORLD_IDENTITY; break; case D3DTS_VIEW: - render_state.view=m2.Transpose(); + render_state.view=To_D3DMATRIX(m); render_state_changed|=(unsigned)VIEW_CHANGED; render_state_changed&=~(unsigned)VIEW_IDENTITY; break; default: DX8_RECORD_MATRIX_CHANGE(); - m2=m2.Transpose(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2)); + D3DMATRIX dxm=To_D3DMATRIX(m); + DX8CALL(SetTransform(transform,&dxm)); break; } } -WWINLINE void DX8Wrapper::Set_World_Identity() -{ - if (render_state_changed&(unsigned)WORLD_IDENTITY) return; - render_state.world.Make_Identity(); - render_state_changed|=(unsigned)WORLD_CHANGED|(unsigned)WORLD_IDENTITY; -} - -WWINLINE void DX8Wrapper::Set_View_Identity() -{ - if (render_state_changed&(unsigned)VIEW_IDENTITY) return; - render_state.view.Make_Identity(); - render_state_changed|=(unsigned)VIEW_CHANGED|(unsigned)VIEW_IDENTITY; -} - WWINLINE bool DX8Wrapper::Is_World_Identity() { return !!(render_state_changed&(unsigned)WORLD_IDENTITY); @@ -1268,21 +1239,19 @@ WWINLINE bool DX8Wrapper::Is_View_Identity() WWINLINE void DX8Wrapper::Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m) { - D3DMATRIX mat; - switch ((int)transform) { case D3DTS_WORLD: if (render_state_changed&WORLD_IDENTITY) m.Make_Identity(); - else m=render_state.world.Transpose(); + else m=To_Matrix4x4(render_state.world); break; case D3DTS_VIEW: if (render_state_changed&VIEW_IDENTITY) m.Make_Identity(); - else m=render_state.view.Transpose(); + else m=To_Matrix4x4(render_state.view); break; default: - DX8CALL(GetTransform(transform,&mat)); - m=*(Matrix4x4*)&mat; - m=m.Transpose(); + D3DMATRIX dxm; + DX8CALL(GetTransform(transform,&dxm)); + m=To_Matrix4x4(dxm); break; } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp index 9848ef4c18c..72057691194 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp @@ -1351,11 +1351,8 @@ void W3DVolumetricShadow::RenderMeshVolume(Int meshIndex, Int lightIndex, const if( numVerts == 0 || numPolys == 0 ) return; - Matrix4x4 mWorld(*meshXform); - - ///@todo: W3D always does transpose on all of matrix sets. Slow??? Better to hack view matrix. - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(*meshXform); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); W3DBufferManager::W3DVertexBufferSlot *vbSlot=m_shadowVolumeVB[lightIndex][ meshIndex ]; if (!vbSlot) @@ -1468,9 +1465,8 @@ void W3DVolumetricShadow::RenderDynamicMeshVolume(Int meshIndex, Int lightIndex, m_pDev->SetIndices(shadowIndexBufferD3D,nShadowStartBatchVertex); - Matrix4x4 mWorld(*meshXform); - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(*meshXform); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); if (shadowVertexBufferD3D != lastActiveVertexBuffer) { m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX)); @@ -1624,8 +1620,8 @@ void W3DVolumetricShadow::RenderMeshVolumeBounds(Int meshIndex, Int lightIndex, //todo: replace this with mesh transform Matrix4x4 mWorld(1); //identity since boxes are pre-transformed to world space. - Matrix4x4 mWorldTransposed = mWorld.Transpose(); - m_pDev->SetTransform(D3DTS_WORLD,(_D3DMATRIX *)&mWorldTransposed); + D3DMATRIX dxmWorld = To_D3DMATRIX(mWorld); + m_pDev->SetTransform(D3DTS_WORLD,&dxmWorld); m_pDev->SetStreamSource(0,shadowVertexBufferD3D,sizeof(SHADOW_DYNAMIC_VOLUME_VERTEX)); m_pDev->SetVertexShader(SHADOW_DYNAMIC_VOLUME_FVF); @@ -2053,7 +2049,7 @@ void W3DVolumetricShadow::updateMeshVolume(Int meshIndex, Int lightIndex, const // system change, not the translations // Real det; - D3DXMatrixInverse((D3DXMATRIX*)&worldToObject, &det, (D3DXMATRIX*)&objectToWorld); + Matrix4x4::Inverse(&worldToObject, &det, &objectToWorld); // find out light position in object space Matrix4x4::Transform_Vector(worldToObject,lightPosWorld,&lightPosObject); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp index a201b72f884..c3f82d48ce1 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -168,8 +168,8 @@ bool DX8Wrapper::IsDeviceLost; int DX8Wrapper::ZBias; float DX8Wrapper::ZNear; float DX8Wrapper::ZFar; -Matrix4x4 DX8Wrapper::ProjectionMatrix; -Matrix4x4 DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; +D3DMATRIX DX8Wrapper::ProjectionMatrix; +D3DMATRIX DX8Wrapper::DX8Transforms[D3DTS_WORLD+1]; DX8Caps* DX8Wrapper::CurrentCaps = nullptr; @@ -484,13 +484,7 @@ void DX8Wrapper::Invalidate_Cached_Render_States(void) Release_Render_State(); // (gth) clear the matrix shadows too - for (int i=0; i_11 = 1.0f; + dxm->_22 = 1.0f; + dxm->_33 = 1.0f; + dxm->_44 = 1.0f; +} +} // namespace wrapper + +void DX8Wrapper::Set_World_Identity() +{ + if (render_state_changed&(unsigned)WORLD_IDENTITY) + return; + wrapper::D3DMatrixIdentity(&render_state.world); + render_state_changed|=(unsigned)WORLD_CHANGED|(unsigned)WORLD_IDENTITY; +} + +void DX8Wrapper::Set_View_Identity() +{ + if (render_state_changed&(unsigned)VIEW_IDENTITY) + return; + wrapper::D3DMatrixIdentity(&render_state.view); + render_state_changed|=(unsigned)VIEW_CHANGED|(unsigned)VIEW_IDENTITY; +} + //********************************************************************************************** //! Resets render device to default state /*! diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h index 633d944bbb2..1a5f56dcae7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -179,8 +179,8 @@ struct RenderStateStruct D3DLIGHT8 Lights[4]; bool LightEnable[4]; //unsigned lightsHash; - Matrix4x4 world; - Matrix4x4 view; + D3DMATRIX world; + D3DMATRIX view; unsigned vertex_buffer_types[MAX_VERTEX_STREAMS]; unsigned index_buffer_type; unsigned short vba_offset; @@ -301,16 +301,15 @@ class DX8Wrapper static void Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m); static void Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m); static void Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m); - static void Set_World_Identity(); + static void Set_World_Identity(); static void Set_View_Identity(); - static bool Is_World_Identity(); + static bool Is_World_Identity(); static bool Is_View_Identity(); // Note that *_DX8_Transform() functions take the matrix in DX8 format - transposed from Westwood convention. - static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m); - static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m); - static void _Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m); + static void _Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform, const D3DMATRIX& m); + static void _Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, D3DMATRIX& m); static void Set_DX8_Light(int index,D3DLIGHT8* light); static void Set_DX8_Render_State(D3DRENDERSTATETYPE state, unsigned value); @@ -622,7 +621,7 @@ class DX8Wrapper static RenderStateStruct render_state; static unsigned render_state_changed; - static Matrix4x4 DX8Transforms[D3DTS_WORLD+1]; + static D3DMATRIX DX8Transforms[D3DTS_WORLD+1]; static bool IsInitted; static bool IsDeviceLost; @@ -702,7 +701,7 @@ class DX8Wrapper static int ZBias; static float ZNear; static float ZFar; - static Matrix4x4 ProjectionMatrix; + static D3DMATRIX ProjectionMatrix; friend void DX8_Assert(); friend class WW3D; @@ -754,40 +753,27 @@ WWINLINE void DX8Wrapper::Set_Pixel_Shader_Constant(int reg, const void* data, i } // shader system updates KJM ^ - -WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix4x4& m) -{ - WWASSERT(transform<=D3DTS_WORLD); -#if 0 // (gth) this optimization is breaking generals because they set the transform behind our backs. - if (m!=DX8Transforms[transform]) -#endif - { - DX8Transforms[transform]=m; - SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3],m[3][0],m[3][1],m[3][2],m[3][3])); - DX8_RECORD_MATRIX_CHANGE(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m)); - } -} - - -WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m) +WWINLINE void DX8Wrapper::_Set_DX8_Transform(D3DTRANSFORMSTATETYPE transform, const D3DMATRIX& m) { WWASSERT(transform<=D3DTS_WORLD); - Matrix4x4 mtx(m); #if 0 // (gth) this optimization is breaking generals because they set the transform behind our backs. if (mtx!=DX8Transforms[transform]) #endif { - DX8Transforms[transform]=mtx; - SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]",transform,m[0][0],m[0][1],m[0][2],m[0][3],m[1][0],m[1][1],m[1][2],m[1][3],m[2][0],m[2][1],m[2][2],m[2][3])); + DX8Transforms[transform]=m; + SNAPSHOT_SAY(("DX8 - SetTransform %d [%f,%f,%f,%f][%f,%f,%f,%f][%f,%f,%f,%f]", + transform, + m.m[0][0],m.m[0][1],m.m[0][2],m.m[0][3], + m.m[1][0],m.m[1][1],m.m[1][2],m.m[1][3], + m.m[2][0],m.m[2][1],m.m[2][2],m.m[2][3])); DX8_RECORD_MATRIX_CHANGE(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m)); + DX8CALL(SetTransform(transform,&m)); } } -WWINLINE void DX8Wrapper::_Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m) +WWINLINE void DX8Wrapper::_Get_DX8_Transform(D3DTRANSFORMSTATETYPE transform, D3DMATRIX& m) { - DX8CALL(GetTransform(transform,(D3DMATRIX*)&m)); + DX8CALL(GetTransform(transform,&m)); } // ---------------------------------------------------------------------------- @@ -1212,18 +1198,18 @@ WWINLINE void DX8Wrapper::Set_Projection_Transform_With_Z_Bias(const Matrix4x4& { ZFar=zfar; ZNear=znear; - ProjectionMatrix=matrix.Transpose(); + ProjectionMatrix=To_D3DMATRIX(matrix); if (!Get_Current_Caps()->Support_ZBias() && ZNear!=ZFar) { - Matrix4x4 tmp=ProjectionMatrix; + D3DMATRIX tmp=ProjectionMatrix; float tmp_zbias=ZBias; tmp_zbias*=(1.0f/16.0f); tmp_zbias*=1.0f / (ZFar - ZNear); - tmp[2][2]-=tmp_zbias*tmp[3][2]; - DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&tmp)); + tmp.m[2][2]-=tmp_zbias*tmp.m[3][2]; + DX8CALL(SetTransform(D3DTS_PROJECTION,&tmp)); } else { - DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&ProjectionMatrix)); + DX8CALL(SetTransform(D3DTS_PROJECTION,&ProjectionMatrix)); } } @@ -1235,12 +1221,12 @@ WWINLINE void DX8Wrapper::Set_DX8_ZBias(int zbias) ZBias=zbias; if (!Get_Current_Caps()->Support_ZBias() && ZNear!=ZFar) { - Matrix4x4 tmp=ProjectionMatrix; + D3DMATRIX tmp=ProjectionMatrix; float tmp_zbias=ZBias; tmp_zbias*=(1.0f/16.0f); tmp_zbias*=1.0f / (ZFar - ZNear); - tmp[2][2]-=tmp_zbias*tmp[3][2]; - DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&tmp)); + tmp.m[2][2]-=tmp_zbias*tmp.m[3][2]; + DX8CALL(SetTransform(D3DTS_PROJECTION,&tmp)); } else { Set_DX8_Render_State (D3DRS_ZBIAS, ZBias); @@ -1251,67 +1237,52 @@ WWINLINE void DX8Wrapper::Set_Transform(D3DTRANSFORMSTATETYPE transform,const Ma { switch ((int)transform) { case D3DTS_WORLD: - render_state.world=m.Transpose(); + render_state.world=To_D3DMATRIX(m); render_state_changed|=(unsigned)WORLD_CHANGED; render_state_changed&=~(unsigned)WORLD_IDENTITY; break; case D3DTS_VIEW: - render_state.view=m.Transpose(); + render_state.view=To_D3DMATRIX(m); render_state_changed|=(unsigned)VIEW_CHANGED; render_state_changed&=~(unsigned)VIEW_IDENTITY; break; case D3DTS_PROJECTION: { - Matrix4x4 ProjectionMatrix=m.Transpose(); + D3DMATRIX ProjectionMatrix=To_D3DMATRIX(m); ZFar=0.0f; ZNear=0.0f; - DX8CALL(SetTransform(D3DTS_PROJECTION,(D3DMATRIX*)&ProjectionMatrix)); + DX8CALL(SetTransform(D3DTS_PROJECTION,&ProjectionMatrix)); } break; default: DX8_RECORD_MATRIX_CHANGE(); - Matrix4x4 m2=m.Transpose(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2)); + D3DMATRIX dxm=To_D3DMATRIX(m); + DX8CALL(SetTransform(transform,&dxm)); break; } } WWINLINE void DX8Wrapper::Set_Transform(D3DTRANSFORMSTATETYPE transform,const Matrix3D& m) { - Matrix4x4 m2(m); switch ((int)transform) { case D3DTS_WORLD: - render_state.world=m2.Transpose(); + render_state.world=To_D3DMATRIX(m); render_state_changed|=(unsigned)WORLD_CHANGED; render_state_changed&=~(unsigned)WORLD_IDENTITY; break; case D3DTS_VIEW: - render_state.view=m2.Transpose(); + render_state.view=To_D3DMATRIX(m); render_state_changed|=(unsigned)VIEW_CHANGED; render_state_changed&=~(unsigned)VIEW_IDENTITY; break; default: DX8_RECORD_MATRIX_CHANGE(); - m2=m2.Transpose(); - DX8CALL(SetTransform(transform,(D3DMATRIX*)&m2)); + D3DMATRIX dxm=To_D3DMATRIX(m); + DX8CALL(SetTransform(transform,&dxm)); break; } } -WWINLINE void DX8Wrapper::Set_World_Identity() -{ - if (render_state_changed&(unsigned)WORLD_IDENTITY) return; - render_state.world.Make_Identity(); - render_state_changed|=(unsigned)WORLD_CHANGED|(unsigned)WORLD_IDENTITY; -} - -WWINLINE void DX8Wrapper::Set_View_Identity() -{ - if (render_state_changed&(unsigned)VIEW_IDENTITY) return; - render_state.view.Make_Identity(); - render_state_changed|=(unsigned)VIEW_CHANGED|(unsigned)VIEW_IDENTITY; -} - WWINLINE bool DX8Wrapper::Is_World_Identity() { return !!(render_state_changed&(unsigned)WORLD_IDENTITY); @@ -1324,21 +1295,19 @@ WWINLINE bool DX8Wrapper::Is_View_Identity() WWINLINE void DX8Wrapper::Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4& m) { - D3DMATRIX mat; - switch ((int)transform) { case D3DTS_WORLD: if (render_state_changed&WORLD_IDENTITY) m.Make_Identity(); - else m=render_state.world.Transpose(); + else m=To_Matrix4x4(render_state.world); break; case D3DTS_VIEW: if (render_state_changed&VIEW_IDENTITY) m.Make_Identity(); - else m=render_state.view.Transpose(); + else m=To_Matrix4x4(render_state.view); break; default: - DX8CALL(GetTransform(transform,&mat)); - m=*(Matrix4x4*)&mat; - m=m.Transpose(); + D3DMATRIX dxm; + DX8CALL(GetTransform(transform,&dxm)); + m=To_Matrix4x4(dxm); break; } } From 25b1735160e185779546d7c7a06853d76efae04e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 20 Jan 2026 18:29:14 +0100 Subject: [PATCH 077/211] perf(radar): Reduce cost of W3DRadar::renderObjectList (by 80%), W3DRadar::buildTerrainTexture (by 25%) and W3DRadar::clearShroud (#2138) This is achieved by locking the radar surface only once instead of every pixel draw --- Core/GameEngine/Source/GameClient/MapUtil.cpp | 6 +- .../W3DDevice/Common/System/W3DRadar.cpp | 98 ++++++------ .../W3DDevice/GameClient/Water/W3DWater.cpp | 18 ++- .../Source/WWVegas/WW3D2/surfaceclass.cpp | 140 +++++------------- .../Source/WWVegas/WW3D2/surfaceclass.h | 23 ++- 5 files changed, 129 insertions(+), 156 deletions(-) diff --git a/Core/GameEngine/Source/GameClient/MapUtil.cpp b/Core/GameEngine/Source/GameClient/MapUtil.cpp index 1aab4551571..1a12c47e344 100644 --- a/Core/GameEngine/Source/GameClient/MapUtil.cpp +++ b/Core/GameEngine/Source/GameClient/MapUtil.cpp @@ -1290,12 +1290,15 @@ Bool parseMapPreviewChunk(DataChunkInput &file, DataChunkInfo *info, void *userD //texture->Get_Surface_Level(); DEBUG_LOG(("BeginMapPreviewInfo")); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); UnsignedInt *buffer = new UnsignedInt[size.x * size.y]; Int x,y; for (y=0; yDrawPixel( x, y, file.readInt() ); + surface->Draw_Pixel( x, y, file.readInt(), bytesPerPixel, pBits, pitch ); buffer[y + x] = file.readInt(); DEBUG_LOG(("x:%d, y:%d, %X", x, y, buffer[y + x])); } @@ -1303,6 +1306,7 @@ Bool parseMapPreviewChunk(DataChunkInput &file, DataChunkInfo *info, void *userD mapPreviewImage->setRawTextureData(buffer); DEBUG_ASSERTCRASH(file.atEndOfChunk(), ("Unexpected data left over.")); DEBUG_LOG(("EndMapPreviewInfo")); + surface->Unlock(); REF_PTR_RELEASE(surface); return true; */ diff --git a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 4deeb1db6ca..f62d68654a3 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -168,8 +168,8 @@ void W3DRadar::deleteResources( void ) deleteInstance(m_shroudImage); m_shroudImage = nullptr; - DEBUG_ASSERTCRASH(m_shroudSurface == NULL, ("W3DRadar::deleteResources: m_shroudSurface is expected NULL")); - DEBUG_ASSERTCRASH(m_shroudSurfaceBits == NULL, ("W3DRadar::deleteResources: m_shroudSurfaceBits is expected NULL")); + DEBUG_ASSERTCRASH(m_shroudSurface == nullptr, ("W3DRadar::deleteResources: m_shroudSurface is expected null")); + DEBUG_ASSERTCRASH(m_shroudSurfaceBits == nullptr, ("W3DRadar::deleteResources: m_shroudSurfaceBits is expected null")); } @@ -697,6 +697,10 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text Player *player = rts::getObservedOrLocalPlayer(); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + for( const RadarObject *rObj = listHead; rObj; rObj = rObj->friend_getNext() ) { if (!canRenderObject(rObj, player)) @@ -736,21 +740,23 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text // draw the blip, but make sure the points are legal if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.y++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.x++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.y--; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); } + + surface->Unlock(); REF_PTR_RELEASE(surface); } @@ -1068,6 +1074,11 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) ICoord2D radarPoint; Coord3D worldPoint; Bridge *bridge; + + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + for( y = 0; y < m_textureHeight; y++ ) { @@ -1253,25 +1264,17 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) } - // // draw the pixel for the terrain at this point, note that because of the orientation // of our world we draw it with positive y in the "up" direction - // - // FYI: I tried making this faster by pulling out all the code inside DrawPixel - // and locking only once ... but it made absolutely *no* performance difference, - // the sampling and interpolation algorithm for generating pretty looking terrain - // and water for the radar is just, well, expensive. - // - surface->DrawPixel( x, y, GameMakeColor( color.red * 255, - color.green * 255, - color.blue * 255, - 255 ) ); + Color pixelColor = GameMakeColor( color.red * 255, color.green * 255, color.blue * 255, 255 ); + surface->Draw_Pixel( x, y, pixelColor, bytesPerPixel, pBits, pitch ); } } // all done with the surface + surface->Unlock(); REF_PTR_RELEASE(surface); } @@ -1288,11 +1291,18 @@ void W3DRadar::clearShroud() SurfaceClass *surface = m_shroudTexture->Get_Surface_Level(); // fill to clear, shroud will make black. Don't want to make something black that logic can't clear - unsigned int color = GameMakeColor( 0, 0, 0, 0 ); + + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + const Color color = GameMakeColor( 0, 0, 0, 0 ); + for( Int y = 0; y < m_textureHeight; y++ ) { - surface->DrawHLine(y, 0, m_textureWidth-1, color); + surface->Draw_H_Line(y, 0, m_textureWidth-1, color, bytesPerPixel, pBits, pitch); } + + surface->Unlock(); REF_PTR_RELEASE(surface); } @@ -1346,41 +1356,39 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting else alpha = 0; - if (m_shroudSurface == NULL) + if (m_shroudSurface == nullptr) { // This is expensive. SurfaceClass* surface = m_shroudTexture->Get_Surface_Level(); DEBUG_ASSERTCRASH( surface, ("W3DRadar: Can't get surface for Shroud texture") ); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + const Color color = GameMakeColor( 0, 0, 0, alpha ); - for( Int y = radarMinY; y <= radarMaxY; y++ ) + for( Int y = radarMinY; y <= radarMaxY; ++y ) { - for( Int x = radarMinX; x <= radarMaxX; x++ ) + for( Int x = radarMinX; x <= radarMaxX; ++x ) { - surface->DrawPixel( x, y, GameMakeColor( 0, 0, 0, alpha ) ); + surface->Draw_Pixel( x, y, color, bytesPerPixel, pBits, pitch ); } } + + surface->Unlock(); REF_PTR_RELEASE(surface); } else { // This is cheap. - DEBUG_ASSERTCRASH(m_shroudSurfaceBits != NULL, ("W3DRadar::setShroudLevel: m_shroudSurfaceBits is not expected NULL")); + DEBUG_ASSERTCRASH(m_shroudSurfaceBits != nullptr, ("W3DRadar::setShroudLevel: m_shroudSurfaceBits is not expected null")); DEBUG_ASSERTCRASH(m_shroudSurfacePixelSize != 0, ("W3DRadar::setShroudLevel: m_shroudSurfacePixelSize is not expected 0")); const Color color = GameMakeColor( 0, 0, 0, alpha ); for( Int y = radarMinY; y <= radarMaxY; ++y ) { - UnsignedByte* row = static_cast(m_shroudSurfaceBits) + y * m_shroudSurfacePitch; for( Int x = radarMinX; x <= radarMaxX; ++x ) { - UnsignedByte* column = row + x * m_shroudSurfacePixelSize; - - switch (m_shroudSurfacePixelSize) - { - case 1: *column = (UnsignedByte)(color & 0xFF); break; - case 2: *reinterpret_cast(column) = (UnsignedShort)(color & 0xFFFF); break; - case 4: *reinterpret_cast(column) = (UnsignedInt)color; break; - } + m_shroudSurface->Draw_Pixel( x, y, color, m_shroudSurfacePixelSize, m_shroudSurfaceBits, m_shroudSurfacePitch ); } } } @@ -1388,9 +1396,9 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting void W3DRadar::beginSetShroudLevel() { - DEBUG_ASSERTCRASH( m_shroudSurface == NULL, ("W3DRadar::beginSetShroudLevel: m_shroudSurface is expected NULL") ); + DEBUG_ASSERTCRASH( m_shroudSurface == nullptr, ("W3DRadar::beginSetShroudLevel: m_shroudSurface is expected null") ); m_shroudSurface = m_shroudTexture->Get_Surface_Level(); - DEBUG_ASSERTCRASH( m_shroudSurface != NULL, ("W3DRadar::beginSetShroudLevel: Can't get surface for Shroud texture") ); + DEBUG_ASSERTCRASH( m_shroudSurface != nullptr, ("W3DRadar::beginSetShroudLevel: Can't get surface for Shroud texture") ); SurfaceClass::SurfaceDescription sd; m_shroudSurface->Get_Description(sd); @@ -1400,11 +1408,11 @@ void W3DRadar::beginSetShroudLevel() void W3DRadar::endSetShroudLevel() { - DEBUG_ASSERTCRASH( m_shroudSurface != NULL, ("W3DRadar::endSetShroudLevel: m_shroudSurface is not expected NULL") ); - if (m_shroudSurfaceBits != NULL) + DEBUG_ASSERTCRASH( m_shroudSurface != nullptr, ("W3DRadar::endSetShroudLevel: m_shroudSurface is not expected null") ); + if (m_shroudSurfaceBits != nullptr) { m_shroudSurface->Unlock(); - m_shroudSurfaceBits = NULL; + m_shroudSurfaceBits = nullptr; m_shroudSurfacePitch = 0; m_shroudSurfacePixelSize = 0; } @@ -1555,6 +1563,10 @@ void W3DRadar::refreshObjects() UnsignedByte minAlpha = 8; + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + for( const RadarObject *rObj = listHead; rObj; rObj = rObj->friend_getNext() ) { UnsignedByte h = (UnsignedByte)(rObj->isTemporarilyHidden()); @@ -1639,24 +1651,26 @@ void W3DRadar::refreshObjects() // draw the blip, but make sure the points are legal if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.x++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.y++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); radarPoint.x--; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->DrawPixel( radarPoint.x, radarPoint.y, c ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); } + + surface->Unlock(); REF_PTR_RELEASE(surface); } diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 8c25e70bd4a..32c1eee4741 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -964,7 +964,11 @@ void WaterRenderObjClass::ReAcquireResources(void) if (m_whiteTexture && !m_whiteTexture->Is_Initialized()) { m_whiteTexture->Init(); SurfaceClass *surface=m_whiteTexture->Get_Surface_Level(); - surface->DrawPixel(0,0,0xffffffff); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + surface->Draw_Pixel(0, 0, 0xffffffff, bytesPerPixel, pBits, pitch); + surface->Unlock(); REF_PTR_RELEASE(surface); } } @@ -1110,7 +1114,11 @@ Int WaterRenderObjClass::init(Real waterLevel, Real dx, Real dy, SceneClass *par //For some reason setting a null texture does not result in 0xffffffff for pixel shaders so using explicit "white" texture. m_whiteTexture=MSGNEW("TextureClass") TextureClass(1,1,WW3D_FORMAT_A4R4G4B4,MIP_LEVELS_1); SurfaceClass *surface=m_whiteTexture->Get_Surface_Level(); - surface->DrawPixel(0,0,0xffffffff); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + surface->Draw_Pixel(0, 0, 0xffffffff, bytesPerPixel, pBits, pitch); + surface->Unlock(); REF_PTR_RELEASE(surface); m_waterNoiseTexture=WW3DAssetManager::Get_Instance()->Get_Texture("Noise0000.tga"); @@ -2955,7 +2963,11 @@ void WaterRenderObjClass::setupFlatWaterShader(void) if (!m_whiteTexture->Is_Initialized()) { m_whiteTexture->Init(); SurfaceClass *surface=m_whiteTexture->Get_Surface_Level(); - surface->DrawPixel(0,0,0xffffffff); + int pitch; + void *pBits = surface->Lock(&pitch); + const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + surface->Draw_Pixel(0, 0, 0xffffffff, bytesPerPixel, pBits, pitch); + surface->Unlock(); REF_PTR_RELEASE(surface); } DX8Wrapper::_Get_D3D_Device8()->SetTexture(3,m_whiteTexture->Peek_D3D_Texture()); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp index 1c768fec1b9..140c2cd0f65 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.cpp @@ -205,16 +205,23 @@ void SurfaceClass::Get_Description(SurfaceDescription &surface_desc) surface_desc.Width = d3d_desc.Width; } -void *SurfaceClass::Lock(int *pitch) +unsigned int SurfaceClass::Get_Bytes_Per_Pixel() +{ + SurfaceDescription surfaceDesc; + Get_Description(surfaceDesc); + return ::Get_Bytes_Per_Pixel(surfaceDesc.Format); +} + +SurfaceClass::LockedSurfacePtr SurfaceClass::Lock(int *pitch) { D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); DX8_ErrorCode(D3DSurface->LockRect(&lock_rect, nullptr, 0)); *pitch = lock_rect.Pitch; - return (void *)lock_rect.pBits; + return static_cast(lock_rect.pBits); } -void *SurfaceClass::Lock(int *pitch, const Vector2i &min, const Vector2i &max) +SurfaceClass::LockedSurfacePtr SurfaceClass::Lock(int *pitch, const Vector2i &min, const Vector2i &max) { D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -227,7 +234,7 @@ void *SurfaceClass::Lock(int *pitch, const Vector2i &min, const Vector2i &max) DX8_ErrorCode(D3DSurface->LockRect(&lock_rect, &rect, 0)); *pitch = lock_rect.Pitch; - return (void *)lock_rect.pBits; + return static_cast(lock_rect.pBits); } void SurfaceClass::Unlock(void) @@ -256,7 +263,7 @@ void SurfaceClass::Clear() Get_Description(sd); // size of each pixel in bytes - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); + unsigned int size=::Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -295,7 +302,7 @@ void SurfaceClass::Copy(const unsigned char *other) Get_Description(sd); // size of each pixel in bytes - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); + unsigned int size=::Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -334,7 +341,7 @@ void SurfaceClass::Copy(const Vector2i &min, const Vector2i &max, const unsigned Get_Description(sd); // size of each pixel in bytes - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); + unsigned int size=::Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -379,7 +386,7 @@ unsigned char *SurfaceClass::CreateCopy(int *width,int *height,int*size,bool fli Get_Description(sd); // size of each pixel in bytes - unsigned int mysize=Get_Bytes_Per_Pixel(sd.Format); + unsigned int mysize=::Get_Bytes_Per_Pixel(sd.Format); *width=sd.Width; *height=sd.Height; @@ -559,7 +566,7 @@ void SurfaceClass::FindBB(Vector2i *min,Vector2i*max) DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,&rect,D3DLOCK_READONLY)); int x,y; - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); + unsigned int size=::Get_Bytes_Per_Pixel(sd.Format); Vector2i realmin=*max; Vector2i realmax=*min; @@ -622,7 +629,7 @@ bool SurfaceClass::Is_Transparent_Column(unsigned int column) break; } - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); + unsigned int size=::Get_Bytes_Per_Pixel(sd.Format); D3DLOCKED_RECT lock_rect; ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); @@ -656,7 +663,7 @@ bool SurfaceClass::Is_Transparent_Column(unsigned int column) } /*********************************************************************************************** - * SurfaceClass::Get_Pixel -- Returns the pixel's RGB valus to the caller * + * SurfaceClass::Get_Pixel -- Returns the pixel's RGB valus to the caller * * * * * * * @@ -669,28 +676,16 @@ bool SurfaceClass::Is_Transparent_Column(unsigned int column) * * * HISTORY: * * 2/13/2001 hy : Created. * + * 1/10/2025 TheSuperHackers : Added bits and pitch to argument list for better performance * *=============================================================================================*/ -void SurfaceClass::Get_Pixel(Vector3 &rgb, int x,int y) +void SurfaceClass::Get_Pixel(Vector3 &rgb, int x, int y, LockedSurfacePtr pBits, int pitch) { SurfaceDescription sd; Get_Description(sd); - x = min(x,(int)sd.Width - 1); - y = min(y,(int)sd.Height - 1); - - D3DLOCKED_RECT lock_rect; - ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - RECT rect; - ::ZeroMemory(&rect, sizeof(RECT)); - - rect.bottom=y+1; - rect.top=y; - rect.left=x; - rect.right=x+1; - - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,&rect,D3DLOCK_READONLY)); - Convert_Pixel(rgb,sd,(unsigned char *) lock_rect.pBits); - DX8_ErrorCode(D3DSurface->UnlockRect()); + unsigned int bytesPerPixel = ::Get_Bytes_Per_Pixel(sd.Format); + unsigned char* dst = static_cast(pBits) + y * pitch + x * bytesPerPixel; + Convert_Pixel(rgb,sd,dst); } /*********************************************************************************************** @@ -766,44 +761,16 @@ void SurfaceClass::Detach (void) * WARNINGS: * * * * HISTORY: * + * 1/10/2025 TheSuperHackers : Added bits and pitch to argument list for better performance * *=============================================================================================*/ -void SurfaceClass::DrawPixel(const unsigned int x,const unsigned int y, unsigned int color) +void SurfaceClass::Draw_Pixel(const unsigned int x, const unsigned int y, unsigned int color, + unsigned int bytesPerPixel, LockedSurfacePtr pBits, int pitch) { - SurfaceDescription sd; - Get_Description(sd); - - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); - - D3DLOCKED_RECT lock_rect; - ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - RECT rect; - ::ZeroMemory(&rect, sizeof(RECT)); - - rect.bottom=y+1; - rect.top=y; - rect.left=x; - rect.right=x+1; - - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,&rect,0)); - unsigned char *cptr=(unsigned char*)lock_rect.pBits; - unsigned short *sptr=(unsigned short*)lock_rect.pBits; - unsigned int *lptr=(unsigned int*)lock_rect.pBits; + unsigned char* dst = static_cast(pBits) + y * pitch + x * bytesPerPixel; + memcpy(dst, &color, bytesPerPixel); +} - switch (size) - { - case 1: - *cptr=(unsigned char) (color & 0xFF); - break; - case 2: - *sptr=(unsigned short) (color & 0xFFFF); - break; - case 4: - *lptr=color; - break; - } - DX8_ErrorCode(D3DSurface->UnlockRect()); -} /*********************************************************************************************** * SurfaceClass::DrawHLine -- draws a horizontal line * @@ -819,49 +786,18 @@ void SurfaceClass::DrawPixel(const unsigned int x,const unsigned int y, unsigned * * * HISTORY: * * 4/9/2001 hy : Created. * - * 4/9/2001 hy : Created. * + * 1/10/2025 TheSuperHackers : Added bits and pitch to argument list for better performance * *=============================================================================================*/ -void SurfaceClass::DrawHLine(const unsigned int y,const unsigned int x1, const unsigned int x2, unsigned int color) +void SurfaceClass::Draw_H_Line(const unsigned int y, const unsigned int x1, const unsigned int x2, + unsigned int color, unsigned int bytesPerPixel, LockedSurfacePtr pBits, int pitch) { - SurfaceDescription sd; - Get_Description(sd); - - unsigned int size=Get_Bytes_Per_Pixel(sd.Format); - - D3DLOCKED_RECT lock_rect; - ::ZeroMemory(&lock_rect, sizeof(D3DLOCKED_RECT)); - RECT rect; - ::ZeroMemory(&rect, sizeof(RECT)); - - rect.bottom=y+1; - rect.top=y; - rect.left=x1; - rect.right=x2+1; - - DX8_ErrorCode(D3DSurface->LockRect(&lock_rect,&rect,0)); - unsigned char *cptr=(unsigned char*)lock_rect.pBits; - unsigned short *sptr=(unsigned short*)lock_rect.pBits; - unsigned int *lptr=(unsigned int*)lock_rect.pBits; + unsigned char* row = static_cast(pBits) + y * pitch; - unsigned int x; - // the assumption here is that whenever a pixel has alpha it's in the MSB - for (x=x1; x<=x2; x++) + for (unsigned int x = x1; x <= x2; ++x) { - switch (size) - { - case 1: - *cptr++=(unsigned char) (color & 0xFF); - break; - case 2: - *sptr++=(unsigned short) (color & 0xFFFF); - break; - case 4: - *lptr++=color; - break; - } + unsigned char* dst = row + x * bytesPerPixel; + memcpy(dst, &color, bytesPerPixel); } - - DX8_ErrorCode(D3DSurface->UnlockRect()); } @@ -927,7 +863,7 @@ bool SurfaceClass::Is_Monochrome(void) int pitch,size; - size=Get_Bytes_Per_Pixel(sd.Format); + size=::Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) Lock(&pitch); Vector3 rgb; @@ -977,7 +913,7 @@ void SurfaceClass::Hue_Shift(const Vector3 &hsv_shift) Get_Description(sd); int pitch,size; - size=Get_Bytes_Per_Pixel(sd.Format); + size=::Get_Bytes_Per_Pixel(sd.Format); unsigned char *bits=(unsigned char*) Lock(&pitch); Vector3 rgb; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h index 4d227fe4fcf..fb1f5a12af7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/surfaceclass.h @@ -57,6 +57,7 @@ class SurfaceClass : public W3DMPO, public RefCountClass { W3DMPO_GLUE(SurfaceClass) public: + typedef void *LockedSurfacePtr; struct SurfaceDescription { WW3DFormat Format; // Surface format @@ -76,11 +77,14 @@ class SurfaceClass : public W3DMPO, public RefCountClass ~SurfaceClass(void); // Get surface description - void Get_Description(SurfaceDescription &surface_desc); + void Get_Description(SurfaceDescription &surface_desc); + + // Get the bytes per pixel count + unsigned int Get_Bytes_Per_Pixel(); // Lock / unlock the surface - void *Lock(int *pitch); - void *Lock(int *pitch, const Vector2i &min, const Vector2i &max); + LockedSurfacePtr Lock(int *pitch); + LockedSurfacePtr Lock(int *pitch, const Vector2i &min, const Vector2i &max); void Unlock(void); // HY -- The following functions are support functions for font3d @@ -102,7 +106,7 @@ class SurfaceClass : public W3DMPO, public RefCountClass // copies the contents of one surface to another, stretches void Stretch_Copy( - unsigned int dstx, unsigned int dsty,unsigned int dstwidth, unsigned int dstheight, + unsigned int dstx, unsigned int dsty, unsigned int dstwidth, unsigned int dstheight, unsigned int srcx, unsigned int srcy, unsigned int srcwidth, unsigned int srcheight, const SurfaceClass *source); @@ -123,12 +127,15 @@ class SurfaceClass : public W3DMPO, public RefCountClass void Detach (void); // draws a horizontal line - void DrawHLine(const unsigned int y,const unsigned int x1, const unsigned int x2, unsigned int color); + void Draw_H_Line(const unsigned int y, const unsigned int x1, const unsigned int x2, + unsigned int color, unsigned int bytesPerPixel, LockedSurfacePtr pBits, int pitch); - void DrawPixel(const unsigned int x,const unsigned int y, unsigned int color); + // draws a pixel + void Draw_Pixel(const unsigned int x, const unsigned int y, unsigned int color, + unsigned int bytesPerPixel, LockedSurfacePtr pBits, int pitch); - // get pixel function .. to be used infrequently - void Get_Pixel(Vector3 &rgb, int x,int y); + // get pixel function + void Get_Pixel(Vector3 &rgb, int x, int y, LockedSurfacePtr pBits, int pitch); void Hue_Shift(const Vector3 &hsv_shift); From a4482e02b46be4ce51a57e917359d7432823044f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 20 Jan 2026 22:38:39 +0100 Subject: [PATCH 078/211] fix(tunnel): Fix undefined behavior in TunnelTracker::onTunnelDestroyed() and incomplete asset transfer in Team::setControllingPlayer() (#1958) --- .../Include/GameLogic/Module/TunnelContain.h | 1 + .../GameEngine/Source/Common/RTS/Team.cpp | 11 ++++++++- .../Source/Common/RTS/TunnelTracker.cpp | 15 +++++++++--- .../Object/Contain/TunnelContain.cpp | 24 +++++++++++++++++++ .../GameEngine/Source/Common/RTS/Team.cpp | 11 ++++++++- .../Source/Common/RTS/TunnelTracker.cpp | 15 +++++++++--- 6 files changed, 69 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h index 23fb78ee010..8e779f1d14e 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/TunnelContain.h @@ -94,6 +94,7 @@ class TunnelContain : public OpenContain, public CreateModuleInterface virtual void onContaining( Object *obj ); ///< object now contains 'obj' virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj' virtual void onSelling();///< Container is being sold. Tunnel responds by kicking people out if this is the last tunnel. + virtual void onCapture( Player *oldOwner, Player *newOwner ); // Need to change who we are registered with. virtual void orderAllPassengersToExit( CommandSourceType commandSource ); ///< All of the smarts of exiting are in the passenger's AIExit. removeAllFrommContain is a last ditch system call, this is the game Evacuate diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index daf876904fb..fe3343dc8f0 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1390,6 +1390,7 @@ Player *Team::getControllingPlayer() const // ------------------------------------------------------------------------ void Team::setControllingPlayer(Player *newController) { + Player* oldOwner = m_proto->getControllingPlayer(); // nullptr is not allowed, but is caught by TeamPrototype::setControllingPlayer() m_proto->setControllingPlayer(newController); @@ -1398,6 +1399,7 @@ void Team::setControllingPlayer(Player *newController) // The Team doesn't change, it just starts to return a different answer when you ask for // the controlling player. I don't want to make the major change of onCapture on everyone, // so I will do the minor fix for the specific bug, which is harmless even when misused. + // TheSuperHackers @fix xezon 07/12/2025 Now does onCapture on everyone. // Tell all members to redo their looking status, as their Player has changed, but they don't know. for (DLINK_ITERATOR iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) @@ -1406,7 +1408,14 @@ void Team::setControllingPlayer(Player *newController) if (!obj) continue; - obj->handlePartitionCellMaintenance(); + if constexpr (RETAIL_COMPATIBLE_CRC) // Not sure if necessary. But likely is. + { + obj->handlePartitionCellMaintenance(); + } + else + { + obj->onCapture(oldOwner, newController); + } } } diff --git a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 981ef781a1f..68f6e81e802 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -219,9 +219,18 @@ void TunnelTracker::onTunnelCreated( const Object *newTunnel ) // ------------------------------------------------------------------------ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) { - m_tunnelCount--; - m_tunnelIDs.remove( deadTunnel->getID() ); - m_needsFullHealTimeUpdate = true; + { + std::list::iterator it = std::find(m_tunnelIDs.begin(), m_tunnelIDs.end(), deadTunnel->getID()); + if (it == m_tunnelIDs.end()) + { + DEBUG_CRASH(("TunnelTracker::onTunnelDestroyed - Attempting to remove object '%s' that has never been tracked as a tunnel", deadTunnel->getName().str())); + return; + } + + m_tunnelCount--; + m_tunnelIDs.erase(it); + m_needsFullHealTimeUpdate = true; + } if( m_tunnelCount == 0 ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index d62d8b0c5b2..25dc54e39d8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -376,6 +376,30 @@ void TunnelContain::onBuildComplete( void ) m_isCurrentlyRegistered = TRUE; } +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +void TunnelContain::onCapture( Player *oldOwner, Player *newOwner ) +{ + if( m_isCurrentlyRegistered ) + { + TunnelTracker *oldTunnelTracker = oldOwner->getTunnelSystem(); + if( oldTunnelTracker ) + { + DEBUG_ASSERTCRASH( oldTunnelTracker->getContainCount() == 0, ("You shouldn't force a capture of a Tunnel with people in it. Future ExitFromContainer scripts will fail.")); + oldTunnelTracker->onTunnelDestroyed(getObject()); + } + + TunnelTracker *newTunnelTracker = newOwner->getTunnelSystem(); + if( newTunnelTracker ) + { + newTunnelTracker->onTunnelCreated(getObject()); + } + } + + // extend base class + OpenContain::onCapture( oldOwner, newOwner ); +} + //------------------------------------------------------------------------------------------------- void TunnelContain::orderAllPassengersToExit( CommandSourceType commandSource ) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 397f257b618..4eaf9762641 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1391,6 +1391,7 @@ Player *Team::getControllingPlayer() const // ------------------------------------------------------------------------ void Team::setControllingPlayer(Player *newController) { + Player* oldOwner = m_proto->getControllingPlayer(); // nullptr is not allowed, but is caught by TeamPrototype::setControllingPlayer() m_proto->setControllingPlayer(newController); @@ -1399,6 +1400,7 @@ void Team::setControllingPlayer(Player *newController) // The Team doesn't change, it just starts to return a different answer when you ask for // the controlling player. I don't want to make the major change of onCapture on everyone, // so I will do the minor fix for the specific bug, which is harmless even when misused. + // TheSuperHackers @fix xezon 07/12/2025 Now does onCapture on everyone. // Tell all members to redo their looking status, as their Player has changed, but they don't know. for (DLINK_ITERATOR iter = iterate_TeamMemberList(); !iter.done(); iter.advance()) @@ -1407,7 +1409,14 @@ void Team::setControllingPlayer(Player *newController) if (!obj) continue; - obj->handlePartitionCellMaintenance(); + if constexpr (RETAIL_COMPATIBLE_CRC) // Not sure if necessary. But likely is. + { + obj->handlePartitionCellMaintenance(); + } + else + { + obj->onCapture(oldOwner, newController); + } } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp index 831b3e8782a..888551dd259 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp @@ -220,9 +220,18 @@ void TunnelTracker::onTunnelCreated( const Object *newTunnel ) // ------------------------------------------------------------------------ void TunnelTracker::onTunnelDestroyed( const Object *deadTunnel ) { - m_tunnelCount--; - m_tunnelIDs.remove( deadTunnel->getID() ); - m_needsFullHealTimeUpdate = true; + { + std::list::iterator it = std::find(m_tunnelIDs.begin(), m_tunnelIDs.end(), deadTunnel->getID()); + if (it == m_tunnelIDs.end()) + { + DEBUG_CRASH(("TunnelTracker::onTunnelDestroyed - Attempting to remove object '%s' that has never been tracked as a tunnel", deadTunnel->getName().str())); + return; + } + + m_tunnelCount--; + m_tunnelIDs.erase(it); + m_needsFullHealTimeUpdate = true; + } if( m_tunnelCount == 0 ) { From e16574e2601f239cc3e043ef00e27a7c604ae801 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:15:19 +0000 Subject: [PATCH 079/211] build(cmake): Add MinGW-w64 toolchain and base configuration (#2067) Add cross-compilation support for building with MinGW-w64 (GCC) on Linux targeting 32-bit Windows executables. This enables building Generals and Zero Hour without requiring MSVC or Windows. Core components: - Toolchain file for i686-w64-mingw32 cross-compiler - MinGW-specific compiler flags and library linking - MSVC compatibility macros (__forceinline, __int64, _int64) - Math constants header (mingw.h) with MinGW-specific definitions - Windows library dependencies (ole32, d3d8, dinput8, etc.) - d3dx8 library aliasing for MinGW compatibility The toolchain forces 32-bit compilation, disables MFC-dependent tools, and configures proper search paths for cross-compilation environment. Math constants are provided via mingw.h header (included through always.h) rather than CMake compile definitions, allowing proper scoping and avoiding global namespace pollution. Build with: cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64-i686.cmake Files: - cmake/toolchains/mingw-w64-i686.cmake: Cross-compilation toolchain - cmake/mingw.cmake: MinGW-specific build configuration - Core/Libraries/Source/WWVegas/WWLib/mingw.h: Math constants header - CMakeLists.txt: Include MinGW configuration when MINGW is detected --- CMakeLists.txt | 5 ++ Core/Libraries/Source/WWVegas/WWLib/always.h | 4 + Core/Libraries/Source/WWVegas/WWLib/mingw.h | 60 +++++++++++++ cmake/mingw.cmake | 91 ++++++++++++++++++++ cmake/toolchains/mingw-w64-i686.cmake | 33 +++++++ 5 files changed, 193 insertions(+) create mode 100644 Core/Libraries/Source/WWVegas/WWLib/mingw.h create mode 100644 cmake/mingw.cmake create mode 100644 cmake/toolchains/mingw-w64-i686.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4160c918c74..ed4b9157fa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,11 @@ include(cmake/compilers.cmake) include(FetchContent) +# MinGW-w64 specific configuration +if(MINGW) + include(cmake/mingw.cmake) +endif() + # Find/Add build dependencies and stubs shared by all projects if((WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) include(cmake/miles.cmake) diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index 4644d5b93ae..0bbe089cccf 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -254,6 +254,10 @@ template T max(T a,T b) #include "watcom.h" #endif +#if defined(__MINGW32__) || defined(__MINGW64__) +#include "mingw.h" +#endif + #ifndef size_of #define size_of(typ,id) sizeof(((typ*)0)->id) diff --git a/Core/Libraries/Source/WWVegas/WWLib/mingw.h b/Core/Libraries/Source/WWVegas/WWLib/mingw.h new file mode 100644 index 00000000000..388093a2462 --- /dev/null +++ b/Core/Libraries/Source/WWVegas/WWLib/mingw.h @@ -0,0 +1,60 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2026 TheSuperHackers +** +** 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +#pragma once + +#if defined(__MINGW32__) || defined(__MINGW64__) + +/* +** MinGW-w64 provides most mathematical constants in when _USE_MATH_DEFINES is set +** (which is done globally in cmake/mingw.cmake). +** +** However, MinGW's is missing one constant (M_1_SQRTPI) and uses a different name +** for another (M_SQRT1_2 instead of M_SQRT_2). We define those here to match MSVC and Watcom. +** +** This brings MinGW in line with MSVC (visualc.h) and Watcom (watcom.h) +** which provide all 14 mathematical constants. +*/ + +#include + +/* +** M_1_SQRTPI is not defined by MinGW's math.h +** Define it to match visualc.h and watcom.h +*/ +#ifndef M_1_SQRTPI +#define M_1_SQRTPI 0.564189583547756286948 +#endif + +/* +** MinGW defines M_SQRT1_2 instead of M_SQRT_2 +** Both represent 1/sqrt(2), just different naming +** Create an alias for compatibility +*/ +#ifndef M_SQRT_2 +#define M_SQRT_2 M_SQRT1_2 +#endif + +/* +** At this point, all 14 mathematical constants are available: +** M_E, M_LOG2E, M_LOG10E, M_LN2, M_LN10, +** M_PI, M_PI_2, M_PI_4, M_1_PI, M_2_PI, +** M_1_SQRTPI, M_2_SQRTPI, M_SQRT2, M_SQRT_2 +*/ + +#endif diff --git a/cmake/mingw.cmake b/cmake/mingw.cmake new file mode 100644 index 00000000000..c0953430552 --- /dev/null +++ b/cmake/mingw.cmake @@ -0,0 +1,91 @@ +# TheSuperHackers @build JohnsterID 05/01/2026 Add MinGW-w64 cross-compilation support +# MinGW-w64 specific compiler and linker configurations + +if(MINGW) + message(STATUS "Configuring MinGW-w64 build settings") + + # Detect if this is 32-bit or 64-bit MinGW + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(IS_MINGW32 TRUE) + message(STATUS "MinGW-w64 32-bit (i686) detected") + else() + message(FATAL_ERROR "MinGW-w64 64-bit (x86_64) detected, but this project only supports 32-bit builds. Use the i686-w64-mingw32 toolchain.") + endif() + + # Windows subsystem + add_link_options(-mwindows) + + # Static linking of GCC runtime libraries + # This embeds libgcc and libstdc++ into the executable to avoid DLL dependencies + add_link_options(-static-libgcc -static-libstdc++) + + # Compatibility flags for legacy code + add_compile_options( + -fno-strict-aliasing # Avoid type-punning issues with DX8/COM + ) + + # MSVC compatibility macros for MinGW + # Note: MinGW already defines _cdecl and _stdcall correctly, so we only add __forceinline + # The escaped syntax below expands to: -D__forceinline="inline __attribute__((always_inline))" + # Escaping rules: \( \) = literal parentheses, \ (backslash-space) = space in definition + add_compile_definitions( + __forceinline=inline\ __attribute__\(\(always_inline\)\) + __int64=long\ long + _int64=long\ long + ) + + # Enable math constants in MinGW's + # MinGW provides M_PI, M_E, etc. in , but only when -std=c++XX is NOT used (strict ANSI mode), + # or when _USE_MATH_DEFINES is defined. Since we compile with -std=c++20, we need this define. + # The header mingw.h (included via always.h) provides the missing constants (M_1_SQRTPI, M_SQRT_2 alias). + add_compile_definitions( + _USE_MATH_DEFINES + ) + + # Ensure proper calling conventions are defined + # MinGW-w64 should define these, but verify they exist + include(CheckCXXSymbolExists) + check_cxx_symbol_exists(STDMETHODCALLTYPE "windows.h" HAVE_STDMETHODCALLTYPE) + if(NOT HAVE_STDMETHODCALLTYPE) + add_compile_definitions( + STDMETHODCALLTYPE=__stdcall + STDMETHODIMP=HRESULT\ __stdcall + ) + endif() + + # Required Windows libraries for DX8 + COM + link_libraries( + uuid # COM GUIDs + ole32 # COM runtime + oleaut32 # COM automation + gdi32 # GDI + user32 # User interface + comctl32 # Common controls + winmm # Multimedia (timeGetTime, etc.) + vfw32 # Video for Windows (AVIFile functions) + d3d8 # Direct3D 8 + dinput8 # DirectInput 8 + dsound # DirectSound + imm32 # Input Method Manager (IME) + ) + + # Note: MinGW-w64 does not provide comsuppw (COM support utilities library). + # COM support utilities (_com_util::ConvertStringToBSTR, ConvertBSTRToString) + # are provided by Dependencies/Utility/Utility/comsupp_compat.h as header-only + # implementations. No library linking required. + + # MinGW-w64 compatibility: Create d3dx8 as an alias to d3dx8d + # MinGW-w64 only provides libd3dx8d.a (debug library), not libd3dx8.a + # The min-dx8-sdk (dx8.cmake) handles this correctly via d3d8lib interface target, + # but for compatibility with direct library references in main executables, + # we create an alias so that linking to d3dx8 automatically uses d3dx8d + if(NOT TARGET d3dx8) + add_library(d3dx8 INTERFACE IMPORTED GLOBAL) + set_target_properties(d3dx8 PROPERTIES + INTERFACE_LINK_LIBRARIES "d3dx8d" + ) + message(STATUS "Created d3dx8 -> d3dx8d alias for MinGW-w64") + endif() + + message(STATUS "MinGW-w64 configuration complete") +endif() diff --git a/cmake/toolchains/mingw-w64-i686.cmake b/cmake/toolchains/mingw-w64-i686.cmake new file mode 100644 index 00000000000..e55badcc3b1 --- /dev/null +++ b/cmake/toolchains/mingw-w64-i686.cmake @@ -0,0 +1,33 @@ +# TheSuperHackers @build JohnsterID 05/01/2026 Add MinGW-w64 i686 cross-compilation toolchain +# MinGW-w64 32-bit (i686) Toolchain File +# Use with: cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64-i686.cmake + +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# Specify the cross compiler +set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) +set(CMAKE_AR i686-w64-mingw32-ar) +set(CMAKE_RANLIB i686-w64-mingw32-ranlib) +set(CMAKE_DLLTOOL i686-w64-mingw32-dlltool) + +# Target environment +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + +# Adjust the default behavior of the FIND_XXX() commands: +# search programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# search headers and libraries in the target environment +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Force 32-bit pointer size +set(CMAKE_SIZEOF_VOID_P 4) + +# Disable MFC-dependent tools (not compatible with MinGW-w64) +set(RTS_BUILD_CORE_TOOLS OFF CACHE BOOL "Disable MFC-dependent core tools for MinGW" FORCE) +set(RTS_BUILD_GENERALS_TOOLS OFF CACHE BOOL "Disable MFC-dependent Generals tools for MinGW" FORCE) +set(RTS_BUILD_ZEROHOUR_TOOLS OFF CACHE BOOL "Disable MFC-dependent Zero Hour tools for MinGW" FORCE) From dfc395b90d05b1aa59dbfce3682775da79cb833e Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:15:59 +0000 Subject: [PATCH 080/211] build(cmake): Add widl integration for COM interface generation (#2067) Add Wine IDL Compiler (widl) as a replacement for Microsoft's MIDL compiler when building with MinGW-w64. This enables generation of COM interface code from IDL files on Linux cross-compilation environments. Features: - Auto-detect widl executable (widl or widl-stable) - Version detection and reporting - Dynamic Wine include path detection via wineg++ preprocessor - Configure Wine header paths for COM interface compilation - Fallback to known Wine stable/development include paths - IDL compilation function for generating headers and type libraries The widl compiler generates compatible COM interface definitions required for DirectX 8, Windows browser control, and other COM-based APIs used by the game engine. Files: - cmake/widl.cmake: widl detection and configuration - CMakeLists.txt: Include widl configuration for MinGW builds --- CMakeLists.txt | 1 + cmake/widl.cmake | 154 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 cmake/widl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ed4b9157fa1..c7df479a3a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ include(FetchContent) # MinGW-w64 specific configuration if(MINGW) include(cmake/mingw.cmake) + include(cmake/widl.cmake) endif() # Find/Add build dependencies and stubs shared by all projects diff --git a/cmake/widl.cmake b/cmake/widl.cmake new file mode 100644 index 00000000000..16b4bc97996 --- /dev/null +++ b/cmake/widl.cmake @@ -0,0 +1,154 @@ +# TheSuperHackers @build JohnsterID 05/01/2026 Add widl integration for COM interface generation +# WIDL (Wine IDL Compiler) detection and configuration +# Used as MIDL replacement for MinGW-w64 builds + +if(MINGW) + # Find widl executable + find_program(WIDL_EXECUTABLE + NAMES widl widl-stable + DOC "Wine IDL compiler for MinGW-w64" + ) + + if(WIDL_EXECUTABLE) + # Get widl version + execute_process( + COMMAND ${WIDL_EXECUTABLE} -V + OUTPUT_VARIABLE WIDL_VERSION_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(WIDL_VERSION_OUTPUT MATCHES "Wine IDL Compiler version ([0-9.]+)") + set(WIDL_VERSION ${CMAKE_MATCH_1}) + message(STATUS "Found widl: ${WIDL_EXECUTABLE} (version ${WIDL_VERSION})") + else() + message(STATUS "Found widl: ${WIDL_EXECUTABLE}") + endif() + + set(IDL_COMPILER ${WIDL_EXECUTABLE}) + set(IDL_COMPILER_FOUND TRUE) + + # Detect Wine include paths dynamically + find_path(WINE_WINDOWS_INCLUDE_DIR + NAMES oaidl.idl + PATHS + /usr/include/wine/wine/windows + /usr/include/wine/windows + /usr/include/wine-development/windows + /opt/wine-stable/include/wine/windows + /usr/local/include/wine/windows + NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH + DOC "Wine Windows headers directory" + ) + + if(WINE_WINDOWS_INCLUDE_DIR) + get_filename_component(WINE_BASE_INCLUDE_DIR "${WINE_WINDOWS_INCLUDE_DIR}/.." ABSOLUTE) + message(STATUS "Wine include directory: ${WINE_WINDOWS_INCLUDE_DIR}") + set(WIDL_INCLUDE_PATHS + -I${WINE_WINDOWS_INCLUDE_DIR} + -I${WINE_BASE_INCLUDE_DIR} + ) + else() + message(WARNING "Wine include directory not found. widl may fail to compile IDL files.") + set(WIDL_INCLUDE_PATHS "") + endif() + + else() + message(WARNING "widl not found. Install with: apt-get install wine-stable-dev (Debian/Ubuntu) or wine-devel (Fedora/RHEL)") + set(IDL_COMPILER_FOUND FALSE) + endif() + + # WIDL command function (compatible with MIDL) + function(add_idl_file target_name idl_file) + get_filename_component(idl_basename ${idl_file} NAME_WE) + get_filename_component(idl_dir ${idl_file} DIRECTORY) + + set(header_file "${CMAKE_CURRENT_BINARY_DIR}/${idl_basename}.h") + set(iid_file "${CMAKE_CURRENT_BINARY_DIR}/${idl_basename}_i.c") + + # Build widl flags with dynamically detected Wine paths + set(WIDL_FLAGS + --win32 + -I${idl_dir} + ${WIDL_INCLUDE_PATHS} + -D__WIDL__ + -DDECLSPEC_ALIGN\(x\)= + ) + + # Generate header file + add_custom_command( + OUTPUT ${header_file} + COMMAND ${IDL_COMPILER} + ${WIDL_FLAGS} + -h -o ${header_file} + ${idl_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${idl_file} + COMMENT "Compiling IDL to header with widl: ${idl_file}" + VERBATIM + ) + + # Generate IID file + add_custom_command( + OUTPUT ${iid_file} + COMMAND ${IDL_COMPILER} + ${WIDL_FLAGS} + -u -o ${iid_file} + ${idl_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${idl_file} + COMMENT "Compiling IDL to IID with widl: ${idl_file}" + VERBATIM + ) + + # Return output files to parent scope + set(${target_name}_HEADER ${header_file} PARENT_SCOPE) + set(${target_name}_IID ${iid_file} PARENT_SCOPE) + endfunction() + +elseif(MSVC) + # MSVC uses midl.exe + find_program(MIDL_EXECUTABLE + NAMES midl.exe midl + DOC "Microsoft IDL compiler" + ) + + if(MIDL_EXECUTABLE) + message(STATUS "Found midl: ${MIDL_EXECUTABLE}") + set(IDL_COMPILER ${MIDL_EXECUTABLE}) + set(IDL_COMPILER_FOUND TRUE) + else() + # midl.exe is usually in PATH with Visual Studio + set(IDL_COMPILER "midl.exe") + set(IDL_COMPILER_FOUND TRUE) + message(STATUS "Using midl.exe from PATH") + endif() + + # MIDL command function + function(add_idl_file target_name idl_file) + get_filename_component(idl_basename ${idl_file} NAME_WE) + + set(header_file "${CMAKE_CURRENT_BINARY_DIR}/${idl_basename}.h") + set(iid_file "${CMAKE_CURRENT_BINARY_DIR}/${idl_basename}_i.c") + + # Convert forward slashes to backslashes for MIDL + file(TO_NATIVE_PATH ${idl_file} idl_file_native) + + add_custom_command( + OUTPUT ${header_file} ${iid_file} + COMMAND ${IDL_COMPILER} "${idl_file_native}" /header ${idl_basename}.h /iid ${idl_basename}_i.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${idl_file} + COMMENT "Compiling IDL file ${idl_file} with midl" + VERBATIM + ) + + # Return output files to parent scope + set(${target_name}_HEADER ${header_file} PARENT_SCOPE) + set(${target_name}_IID ${iid_file} PARENT_SCOPE) + endfunction() +else() + message(WARNING "No IDL compiler configured for this platform") + set(IDL_COMPILER_FOUND FALSE) +endif() From bc0fcb268a334942e131ae0203e69c83ca06dc78 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:16:57 +0000 Subject: [PATCH 081/211] build(cmake): Add ReactOS ATL and PSEH compatibility layer (#2067) Add ReactOS Active Template Library (ATL) support for MinGW-w64 builds, enabling ATL/COM functionality without MSVC dependencies. This provides the ATL headers needed for COM-based browser control integration. Components: - ReactOS ATL headers (v0.4.15) fetched from ReactOS project - ReactOS PSEH (exception handling) in C++-compatible dummy mode - ATL compatibility header with MinGW-specific macro definitions - PSEH compatibility header ensuring proper exception handling The implementation uses ReactOS PSEH in dummy mode (_USE_DUMMY_PSEH) because MinGW-w64's native PSEH uses GNU C nested functions which are incompatible with C++. This provides ATL functionality needed for: - CComPtr and CComBSTR smart pointers - ATL string conversion macros - COM interface implementations Files: - cmake/reactos-atl.cmake: ReactOS ATL integration - Dependencies/Utility/Utility/atl_compat.h: ATL compatibility layer - Dependencies/Utility/Utility/pseh_compat.h: PSEH compatibility layer - CMakeLists.txt: Include ReactOS ATL configuration --- CMakeLists.txt | 1 + Dependencies/Utility/Utility/atl_compat.h | 89 ++++++++++++++++++++++ Dependencies/Utility/Utility/pseh_compat.h | 51 +++++++++++++ cmake/reactos-atl.cmake | 63 +++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 Dependencies/Utility/Utility/atl_compat.h create mode 100644 Dependencies/Utility/Utility/pseh_compat.h create mode 100644 cmake/reactos-atl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c7df479a3a1..7f55b4f4f99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ include(FetchContent) # MinGW-w64 specific configuration if(MINGW) include(cmake/mingw.cmake) + include(cmake/reactos-atl.cmake) include(cmake/widl.cmake) endif() diff --git a/Dependencies/Utility/Utility/atl_compat.h b/Dependencies/Utility/Utility/atl_compat.h new file mode 100644 index 00000000000..5be3b20f591 --- /dev/null +++ b/Dependencies/Utility/Utility/atl_compat.h @@ -0,0 +1,89 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2026 TheSuperHackers +** +** 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +/** + * @file atl_compat.h + * @brief ATL compatibility layer for MinGW-w64 with ReactOS ATL + * + * Provides compatibility definitions for using ReactOS ATL headers + * with MinGW-w64 GCC compiler. Uses ReactOS PSEH in C++-compatible + * dummy mode (_USE_DUMMY_PSEH) because MinGW-w64's PSEH uses GNU C + * nested functions which are not valid in C++. + */ + +#pragma once + +#ifdef __MINGW32__ + +// Include Windows types needed for ATL compatibility +#include + +// Include PSEH compatibility first (uses ReactOS PSEH in dummy mode) +#include "pseh_compat.h" + +// Define _ATL_IIDOF macro for ReactOS ATL (uses MinGW-w64's __uuidof) +#ifndef _ATL_IIDOF +#define _ATL_IIDOF(x) __uuidof(x) +#endif + +// Forward declare _Delegate function for COM aggregation support +// ReactOS ATL's COM_INTERFACE_ENTRY_AGGREGATE macro uses _Delegate but doesn't define it +// The actual function pointer will be defined after atlbase.h provides _ATL_CREATORARGFUNC +extern "C" HRESULT WINAPI _ATL_DelegateQueryInterface(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw); + +// Suppress additional warnings from ReactOS ATL headers +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wattributes" + +// NOTE: ReactOS ATL compile definitions are set in cmake/reactos-atl.cmake: +// - _ATL_CSTRING_EXPLICIT_CONSTRUCTORS +// - _ATL_NO_DEBUG_CRT +// - ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW +// - ATL_NO_DEFAULT_LIBS +// These are applied via target_compile_definitions() on the reactos_atl target. +// Any target linking to reactos_atl will automatically inherit these definitions. +// +// IMPORTANT: _ATL_NO_AUTOMATIC_NAMESPACE is NOT defined because the codebase +// uses ATL types (CComModule, CComObject, CString, etc.) without namespace +// qualification and relies on the automatic 'using namespace ATL;' from ATL headers. + +// Define _Delegate implementation and macro now that ATL types are available +inline HRESULT WINAPI _ATL_DelegateQueryInterface(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw) +{ + IUnknown** ppunk = reinterpret_cast(reinterpret_cast(pv) + dw); + if (*ppunk == nullptr) + return E_NOINTERFACE; + return (*ppunk)->QueryInterface(riid, ppv); +} + +#ifndef _Delegate +#define _Delegate ((ATL::_ATL_CREATORARGFUNC*)_ATL_DelegateQueryInterface) +#endif + +// Restore compiler warnings after ATL includes +#define ATL_COMPAT_RESTORE_WARNINGS() \ + do { \ + _Pragma("GCC diagnostic pop") \ + PSEH_COMPAT_RESTORE_WARNINGS() \ + } while(0) + +#else +// Non-MinGW platforms don't need these workarounds +#define ATL_COMPAT_RESTORE_WARNINGS() +#endif // __MINGW32__ diff --git a/Dependencies/Utility/Utility/pseh_compat.h b/Dependencies/Utility/Utility/pseh_compat.h new file mode 100644 index 00000000000..eeab3097632 --- /dev/null +++ b/Dependencies/Utility/Utility/pseh_compat.h @@ -0,0 +1,51 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2026 TheSuperHackers +** +** 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +/** + * @file pseh_compat.h + * @brief PSEH compatibility for MinGW-w64 with ReactOS ATL + * + * ReactOS ATL headers include . This header ensures + * that ReactOS PSEH is used in C++-compatible dummy mode (_USE_DUMMY_PSEH). + * The cmake configuration (reactos-atl.cmake) adds ReactOS PSEH headers + * to the include path before system headers, and defines _USE_DUMMY_PSEH. + */ + +#pragma once + +#ifdef __MINGW32__ + +// Suppress PSEH-related warnings from ReactOS PSEH headers +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wattributes" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#pragma GCC diagnostic ignored "-Wunused-label" + +// ReactOS PSEH headers will be included by ATL headers +// No need to include them explicitly here + +// Restore compiler warnings after PSEH includes +#define PSEH_COMPAT_RESTORE_WARNINGS() \ + _Pragma("GCC diagnostic pop") + +#else +// Non-MinGW platforms use native SEH or don't need PSEH +#define PSEH_COMPAT_RESTORE_WARNINGS() +#endif // __MINGW32__ diff --git a/cmake/reactos-atl.cmake b/cmake/reactos-atl.cmake new file mode 100644 index 00000000000..d7d578bf47e --- /dev/null +++ b/cmake/reactos-atl.cmake @@ -0,0 +1,63 @@ +# TheSuperHackers @build JohnsterID 05/01/2026 Add ReactOS ATL and PSEH compatibility for MinGW +# ReactOS ATL headers for MinGW-w64 builds +# Provides ATL/COM support without MSVC dependencies +# Uses ReactOS PSEH in C++-compatible dummy mode (_USE_DUMMY_PSEH) +# because MinGW-w64's PSEH uses GNU C nested functions which don't work in C++ + +if(MINGW) + message(STATUS "Setting up ReactOS ATL for MinGW-w64") + + FetchContent_Declare( + reactos_atl + GIT_REPOSITORY https://github.com/reactos/reactos.git + GIT_TAG 0.4.15-release + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE + SOURCE_SUBDIR sdk/lib/atl + ) + + FetchContent_GetProperties(reactos_atl) + if(NOT reactos_atl_POPULATED) + FetchContent_Populate(reactos_atl) + + # Create interface library for ReactOS ATL headers + add_library(reactos_atl INTERFACE) + + # Add ReactOS ATL and PSEH include directories with SYSTEM to suppress warnings + # ReactOS PSEH must come BEFORE system includes to override MinGW's pseh2.h + # (MinGW's pseh2.h uses GNU C nested functions which don't work in C++) + # NOTE: Do NOT include ReactOS CRT headers - use MinGW-w64's CRT instead + target_include_directories(reactos_atl SYSTEM INTERFACE + "${reactos_atl_SOURCE_DIR}/sdk/lib/pseh/include" + "${reactos_atl_SOURCE_DIR}/sdk/lib/atl" + ) + + # COM support (_com_util::ConvertStringToBSTR and ConvertBSTRToString) + # is provided by Dependencies/Utility/Utility/comsupp_compat.h as a + # header-only implementation. No library needs to be built or linked. + + # Add required ATL defines for MinGW compatibility + # NOTE: Do NOT define _ATL_NO_AUTOMATIC_NAMESPACE + # The codebase uses ATL types (CComModule, CComObject, CString, etc.) + # without ATL:: qualification and relies on automatic 'using namespace ATL;' + # + # _USE_DUMMY_PSEH: Use ReactOS PSEH's C++-compatible "dummy" mode + # which provides simple macros instead of GNU C nested functions + target_compile_definitions(reactos_atl INTERFACE + _ATL_CSTRING_EXPLICIT_CONSTRUCTORS + _ATL_NO_DEBUG_CRT + ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW + ATL_NO_DEFAULT_LIBS + _USE_DUMMY_PSEH + ) + + message(STATUS "ReactOS ATL headers: ${reactos_atl_SOURCE_DIR}/sdk/lib/atl") + message(STATUS "ReactOS PSEH headers: ${reactos_atl_SOURCE_DIR}/sdk/lib/pseh/include") + message(STATUS "COM support (comsupp): Header-only in Dependencies/Utility/Utility/comsupp_compat.h") + message(STATUS "Using ReactOS PSEH in C++-compatible dummy mode (_USE_DUMMY_PSEH)") + message(STATUS "Using MinGW-w64 CRT headers (NOT ReactOS CRT)") + endif() +else() + # Create dummy target for non-MinGW builds + add_library(reactos_atl INTERFACE) +endif() From 40310a89332cdb027a9c665c2ef2cf01a2c411df Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:17:25 +0000 Subject: [PATCH 082/211] build(cmake): Add ReactOS COM support utilities (comsupp) (#2067) Add header-only implementation of COM support string conversion utilities for MinGW-w64. These utilities are provided by comsuppw.lib in MSVC but are not available in MinGW-w64's standard library. Provides: - _com_util::ConvertStringToBSTR(): Convert char* to BSTR - _com_util::ConvertBSTRToString(): Convert BSTR to char* These functions are essential for COM string handling in the browser control integration and other COM-based APIs. The header-only approach eliminates the need for linking against an external library and provides a lightweight, portable solution compatible with both MSVC and MinGW-w64. Implementation uses standard Windows APIs (SysAllocString, WideCharToMultiByte, MultiByteToWideChar) to perform the conversions. Files: - Dependencies/Utility/Utility/comsupp_compat.h: COM string utilities --- Dependencies/Utility/Utility/comsupp_compat.h | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Dependencies/Utility/Utility/comsupp_compat.h diff --git a/Dependencies/Utility/Utility/comsupp_compat.h b/Dependencies/Utility/Utility/comsupp_compat.h new file mode 100644 index 00000000000..053e4e081ed --- /dev/null +++ b/Dependencies/Utility/Utility/comsupp_compat.h @@ -0,0 +1,143 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2026 TheSuperHackers +** +** 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +/** + * @file comsupp_compat.h + * @brief COM Support compatibility layer for MinGW-w64 + * + * Provides _com_util::ConvertStringToBSTR() and ConvertBSTRToString() + * as header-only implementations for MinGW-w64 builds. + * + * These functions are required by the _bstr_t class (from ReactOS comutil.h) + * for char* <-> BSTR conversions. They are called internally when constructing + * _bstr_t objects from C strings or converting _bstr_t back to char*. + * + * Used indirectly by: + * - Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp (8+ _bstr_t constructions) + * - Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h (_bstr_t usage) + * + * MinGW-w64 provides COM error handling (comdef.h) but lacks the string + * conversion utilities. ReactOS provides comsupp.cpp with implementations, + * but we use this header-only version to avoid building/linking an extra + * library. This must be included BEFORE comutil.h to provide definitions + * before _bstr_t's inline methods are instantiated. + * + * @note Include this header before in MinGW builds to provide + * symbol definitions for _bstr_t's internal string conversion calls. + * Without this, you will get "undefined reference" linker errors. + */ + +#pragma once + +#ifdef __MINGW32__ + +#include +#include +#include +#include + +namespace _com_util +{ + +inline BSTR WINAPI ConvertStringToBSTR(const char *pSrc) +{ + DWORD cwch; + BSTR wsOut = nullptr; + + if (!pSrc) + return nullptr; + + // Compute the needed size with the null terminator + cwch = MultiByteToWideChar(CP_ACP, 0, pSrc, -1, nullptr, 0); + if (cwch == 0) + return nullptr; + + // Allocate the BSTR (without the null terminator) + wsOut = SysAllocStringLen(nullptr, cwch - 1); + if (!wsOut) + { + _com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY)); + return nullptr; + } + + // Convert the string + if (MultiByteToWideChar(CP_ACP, 0, pSrc, -1, wsOut, cwch) == 0) + { + // We failed, clean everything up + cwch = GetLastError(); + + SysFreeString(wsOut); + wsOut = nullptr; + + _com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch); + } + + return wsOut; +} + +inline char* WINAPI ConvertBSTRToString(BSTR pSrc) +{ + DWORD cb, cwch; + char *szOut = nullptr; + + if (!pSrc) + return nullptr; + + // Retrieve the size of the BSTR with the null terminator + cwch = SysStringLen(pSrc) + 1; + + // Compute the needed size with the null terminator + cb = WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, nullptr, 0, nullptr, nullptr); + if (cb == 0) + { + cwch = GetLastError(); + _com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch); + return nullptr; + } + + // Allocate the string + szOut = (char*)::operator new(cb * sizeof(char)); + if (!szOut) + { + _com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY)); + return nullptr; + } + + // Convert the string and null-terminate + szOut[cb - 1] = '\0'; + if (WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, szOut, cb, nullptr, nullptr) == 0) + { + // We failed, clean everything up + cwch = GetLastError(); + + ::operator delete(szOut); + szOut = nullptr; + + _com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch); + } + + return szOut; +} + +} + +// Provide vtMissing global variable +// Use inline variable (C++17) to avoid multiple definition errors +inline _variant_t vtMissing(DISP_E_PARAMNOTFOUND, VT_ERROR); + +#endif // __MINGW32__ From c1caa58974eea25e3b10414025b097e27785090e Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:18:51 +0000 Subject: [PATCH 083/211] build(deps): Update external dependencies for MinGW-w64 support (#2067) Update DirectX 8, Miles Sound System, and Bink Video SDK to versions with MinGW-w64 compatibility fixes. --- cmake/bink.cmake | 2 +- cmake/dx8.cmake | 2 +- cmake/miles.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/bink.cmake b/cmake/bink.cmake index c1e0af8cb13..83b5317568a 100644 --- a/cmake/bink.cmake +++ b/cmake/bink.cmake @@ -1,7 +1,7 @@ FetchContent_Declare( bink GIT_REPOSITORY https://github.com/TheSuperHackers/bink-sdk-stub.git - GIT_TAG f554b7fa68c97d4e6b607d535e726ef37622fe65 + GIT_TAG 3241ee1e3739b21d9c0a0760c1a5d5622d21c093 ) FetchContent_MakeAvailable(bink) diff --git a/cmake/dx8.cmake b/cmake/dx8.cmake index 44216deb86d..dd08f56119a 100644 --- a/cmake/dx8.cmake +++ b/cmake/dx8.cmake @@ -1,7 +1,7 @@ FetchContent_Declare( dx8 GIT_REPOSITORY https://github.com/TheSuperHackers/min-dx8-sdk.git - GIT_TAG 20d31185872e1304e0573f7f4885ae11e50670d3 + GIT_TAG 7bddff8c01f5fb931c3cb73d4aa8e66d303d97bc ) FetchContent_MakeAvailable(dx8) diff --git a/cmake/miles.cmake b/cmake/miles.cmake index c25b27114c6..79ad6b6e28b 100644 --- a/cmake/miles.cmake +++ b/cmake/miles.cmake @@ -1,7 +1,7 @@ FetchContent_Declare( miles GIT_REPOSITORY https://github.com/TheSuperHackers/miles-sdk-stub.git - GIT_TAG 44c82ab6211028776facf53b0ce3a88a3e232c45 + GIT_TAG 6e32700d7ba4b4713a03bf1f5ffc3b0ac8d17264 ) FetchContent_MakeAvailable(miles) From 0fe7e020dde5698c1b55c81c757b30f1dd43ef30 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:19:00 +0000 Subject: [PATCH 084/211] build(cmake): Configure MinGW-specific compiler and linker settings (#2067) Add MinGW-w64 detection and configure compiler flags to optimize build output for cross-compilation: - Detect MinGW-w64 compiler and set IS_MINGW_BUILD flag - Skip debug symbols (-g) in MinGW Release builds to reduce executable size (MSVC Release builds already exclude debug info by default) - Maintain debug symbols for MinGW Debug builds This reduces the size of MinGW Release builds significantly while keeping compatibility with MSVC build configurations. Debug builds still include full debugging information for development. Files: - cmake/compilers.cmake: Add MinGW detection and conditional debug flags --- cmake/compilers.cmake | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmake/compilers.cmake b/cmake/compilers.cmake index bd8150860ab..f9478fc4a50 100644 --- a/cmake/compilers.cmake +++ b/cmake/compilers.cmake @@ -8,6 +8,15 @@ if (DEFINED MSVC_VERSION) message(STATUS "MSVC_VERSION: ${MSVC_VERSION}") endif() +# TheSuperHackers @build JohnsterID 05/01/2026 Add MinGW-w64 detection and configure compiler flags +# Detect MinGW-w64 +if(MINGW) + message(STATUS "MinGW-w64 detected") + set(IS_MINGW_BUILD TRUE) +else() + set(IS_MINGW_BUILD FALSE) +endif() + # Set variable for VS6 to handle special cases. if (DEFINED MSVC_VERSION AND MSVC_VERSION LESS 1300) set(IS_VS6_BUILD TRUE) @@ -25,8 +34,11 @@ if(MSVC) add_link_options("/INCREMENTAL:NO") else() # We go a bit wild here and assume any other compiler we are going to use supports -g for debug info. - string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g") - string(APPEND CMAKE_C_FLAGS_RELEASE " -g") + # For MinGW, skip adding -g to Release builds + if(NOT (MINGW AND CMAKE_BUILD_TYPE STREQUAL "Release")) + string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g") + string(APPEND CMAKE_C_FLAGS_RELEASE " -g") + endif() endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) From c2d156048a23fe6c08bf730ab4488cc5a22727d8 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:19:16 +0000 Subject: [PATCH 085/211] build(cmake): Add MinGW CMake presets for i686 (#2067) Add configure, build, and workflow presets for MinGW-w64 32-bit (i686) cross-compilation. Enables easy building with standardized configurations. Presets: - mingw-w64-i686: Release build (optimized, no debug symbols) - mingw-w64-i686-debug: Debug build (with debugging symbols) - mingw-w64-i686-profile: Profile build (optimized with profiling) All presets: - Use Unix Makefiles generator (as required for MinGW) - Reference the mingw-w64-i686.cmake toolchain file - Generate compile_commands.json for IDE integration - Build to build/mingw-w64-i686 directory - Include corresponding build and workflow presets Usage: cmake --preset mingw-w64-i686 cmake --build --preset mingw-w64-i686 Or use workflow preset: cmake --workflow --preset mingw-w64-i686 Files: - CMakePresets.json: Add MinGW i686 configure/build/workflow presets --- CMakePresets.json | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index ba1d2d194c2..3b0a69e7261 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -159,6 +159,37 @@ "inherits": "default-vcpkg", "hidden": false, "displayName": "Unix 32bit VCPKG Release" + }, + { + "name": "mingw-w64-i686", + "displayName": "MinGW-w64 32-bit (i686) Release", + "generator": "Unix Makefiles", + "hidden": false, + "binaryDir": "${sourceDir}/build/${presetName}", + "toolchainFile": "${sourceDir}/cmake/toolchains/mingw-w64-i686.cmake", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "mingw-w64-i686-debug", + "displayName": "MinGW-w64 32-bit (i686) Debug", + "hidden": false, + "inherits": "mingw-w64-i686", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "RTS_BUILD_OPTION_DEBUG": "ON" + } + }, + { + "name": "mingw-w64-i686-profile", + "displayName": "MinGW-w64 32-bit (i686) Profile", + "hidden": false, + "inherits": "mingw-w64-i686", + "cacheVariables": { + "RTS_BUILD_OPTION_PROFILE": "ON" + } } ], "buildPresets": [ @@ -240,6 +271,24 @@ "displayName": "Build Unix 32bit VCPKG Release", "description": "Build Unix 32bit VCPKG Release", "configuration": "Release" + }, + { + "name": "mingw-w64-i686", + "configurePreset": "mingw-w64-i686", + "displayName": "Build MinGW-w64 32-bit (i686) Release", + "description": "Build MinGW-w64 32-bit (i686) Release" + }, + { + "name": "mingw-w64-i686-debug", + "configurePreset": "mingw-w64-i686-debug", + "displayName": "Build MinGW-w64 32-bit (i686) Debug", + "description": "Build MinGW-w64 32-bit (i686) Debug" + }, + { + "name": "mingw-w64-i686-profile", + "configurePreset": "mingw-w64-i686-profile", + "displayName": "Build MinGW-w64 32-bit (i686) Profile", + "description": "Build MinGW-w64 32-bit (i686) Profile" } ], "workflowPresets": [ @@ -398,6 +447,45 @@ "name": "unix" } ] + }, + { + "name": "mingw-w64-i686", + "steps": [ + { + "type": "configure", + "name": "mingw-w64-i686" + }, + { + "type": "build", + "name": "mingw-w64-i686" + } + ] + }, + { + "name": "mingw-w64-i686-debug", + "steps": [ + { + "type": "configure", + "name": "mingw-w64-i686-debug" + }, + { + "type": "build", + "name": "mingw-w64-i686-debug" + } + ] + }, + { + "name": "mingw-w64-i686-profile", + "steps": [ + { + "type": "configure", + "name": "mingw-w64-i686-profile" + }, + { + "type": "build", + "name": "mingw-w64-i686-profile" + } + ] } ] } \ No newline at end of file From 5aca93a6dcc8bc0fb1d717d9c0d36cacd61effd7 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:20:49 +0000 Subject: [PATCH 086/211] fix(precompiled): Add ATL compatibility to precompiled headers (#2067) Include ATL compatibility layer in precompiled headers for both Generals and Zero Hour to enable MinGW-w64 builds with ReactOS ATL support. Changes: - Include atl_compat.h before atlbase.h for GCC/MinGW builds - Add pragma pop at end of header to restore warnings - Conditional compilation ensures MSVC builds remain unchanged The ATL compatibility header must be included before ATL headers to: - Define _USE_DUMMY_PSEH for C++-compatible exception handling - Configure ReactOS ATL include paths - Disable problematic GCC warnings for ATL code - Define ATL-specific macros for MinGW compatibility This change enables CComPtr, CComBSTR, and other ATL functionality in MinGW-w64 builds while maintaining full MSVC compatibility. Files: - Generals/Code/GameEngine/Include/Precompiled/PreRTS.h - GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h --- Generals/Code/GameEngine/Include/Precompiled/PreRTS.h | 8 ++++++++ GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Include/Precompiled/PreRTS.h b/Generals/Code/GameEngine/Include/Precompiled/PreRTS.h index 2432971b175..3ce15b0ab63 100644 --- a/Generals/Code/GameEngine/Include/Precompiled/PreRTS.h +++ b/Generals/Code/GameEngine/Include/Precompiled/PreRTS.h @@ -40,6 +40,10 @@ class STLSpecialAlloc; // PLEASE DO NOT ABUSE WINDOWS OR IT WILL BE REMOVED ENTIRELY. :-) //--------------------------------------------------------------------------------- System Includes #define WIN32_LEAN_AND_MEAN +// TheSuperHackers @build JohnsterID 05/01/2026 Add ATL compatibility for MinGW-w64 builds +#if defined(__GNUC__) && defined(_WIN32) + #include +#endif #include #include @@ -123,3 +127,7 @@ class STLSpecialAlloc; #include "Common/Thing.h" #include "Common/UnicodeString.h" + +#if defined(__GNUC__) && defined(_WIN32) + #pragma GCC diagnostic pop +#endif diff --git a/GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h b/GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h index f6af2534bae..c6f3131d78b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h +++ b/GeneralsMD/Code/GameEngine/Include/Precompiled/PreRTS.h @@ -40,6 +40,10 @@ class STLSpecialAlloc; // PLEASE DO NOT ABUSE WINDOWS OR IT WILL BE REMOVED ENTIRELY. :-) //--------------------------------------------------------------------------------- System Includes #define WIN32_LEAN_AND_MEAN +// TheSuperHackers @build JohnsterID 05/01/2026 Add ATL compatibility for MinGW-w64 builds +#if defined(__GNUC__) && defined(_WIN32) + #include +#endif #include #include @@ -124,3 +128,7 @@ class STLSpecialAlloc; #include "Common/Thing.h" #include "Common/UnicodeString.h" + +#if defined(__GNUC__) && defined(_WIN32) + #pragma GCC diagnostic pop +#endif From b873b9e2440bd19380b1342b60d79457a6c1d2be Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:21:26 +0000 Subject: [PATCH 087/211] fix(cmake): Fix CMake dependencies and library linking for MinGW (#2067) Update CMakeLists.txt files to fix library dependencies and ensure proper linking for MinGW-w64 builds: Core libraries: - WW3D2: Add core_wwdebug, core_wwlib, core_wwmath dependencies Make comsuppw library MSVC-only (MinGW uses header-only comsupp_compat.h) Link WW3D2 libraries for core_wwdebug target - WWMath: Add core_wwsaveload dependency - GameEngine: Add widl support for browser control IDL compilation - EABrowserDispatch/Engine: Include widl-generated headers Game executables: - Generals/GeneralsMD Main: Make NODEFAULTLIB and RC files MSVC-only (MinGW doesn't support /NODEFAULTLIB or .rc resource compilation via these paths) These changes ensure: - Proper link order and dependency resolution - MSVC-specific features don't break MinGW builds - COM interface code generation works with widl - All required libraries are linked Files: - Core/GameEngine/CMakeLists.txt - Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt - Core/Libraries/Source/EABrowserEngine/CMakeLists.txt - Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt - Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt - Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt - Generals/Code/Main/CMakeLists.txt - GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt - GeneralsMD/Code/Main/CMakeLists.txt --- Core/GameEngine/CMakeLists.txt | 5 +++ .../Source/EABrowserDispatch/CMakeLists.txt | 36 +++++++++++++------ .../Source/EABrowserEngine/CMakeLists.txt | 36 +++++++++++++------ .../Source/WWVegas/WW3D2/CMakeLists.txt | 4 ++- .../Source/WWVegas/WWMath/CMakeLists.txt | 1 + .../Source/WWVegas/WW3D2/CMakeLists.txt | 1 + Generals/Code/Main/CMakeLists.txt | 10 ++++-- .../Source/WWVegas/WW3D2/CMakeLists.txt | 1 + GeneralsMD/Code/Main/CMakeLists.txt | 9 +++-- 9 files changed, 78 insertions(+), 25 deletions(-) diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index aae2e821fbb..4e27570cf6d 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -1198,3 +1198,8 @@ target_link_libraries(corei_gameengine_public INTERFACE gamespy::gamespy stlport ) + +# ReactOS ATL for MinGW-w64 only (MSVC uses native ATL) +if(MINGW) + target_link_libraries(corei_gameengine_public INTERFACE reactos_atl) +endif() diff --git a/Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt b/Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt index 169ea2db465..baef7ddbca3 100644 --- a/Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt +++ b/Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt @@ -1,16 +1,32 @@ add_library(core_browserdispatch INTERFACE) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - add_custom_command( - OUTPUT BrowserDispatch_i.c BrowserDispatch.h - COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserDispatch.idl" /header BrowserDispatch.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl" - VERBATIM - ) - add_library(core_browserdispatchwin STATIC BrowserDispatch_i.c) - set_target_properties(core_browserdispatchwin PROPERTIES OUTPUT_NAME browserdispatchwin) - target_link_libraries(core_browserdispatch INTERFACE core_browserdispatchwin) + if(MINGW AND IDL_COMPILER_FOUND) + # Use widl for MinGW builds + add_idl_file(browserdispatch_idl "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl") + add_library(core_browserdispatchwin STATIC ${browserdispatch_idl_IID} ${browserdispatch_idl_HEADER}) + elseif(MSVC) + # Use midl for MSVC builds + add_custom_command( + OUTPUT BrowserDispatch_i.c BrowserDispatch.h + COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserDispatch.idl" /header BrowserDispatch.h /iid BrowserDispatch_i.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl" + VERBATIM + ) + add_library(core_browserdispatchwin STATIC BrowserDispatch_i.c) + else() + message(FATAL_ERROR + "EABrowserDispatch requires an IDL compiler for Windows builds:\n" + " - For MinGW: Install widl (apt-get install wine-stable-dev)\n" + " - For MSVC: midl.exe should be in PATH\n" + " - For other compilers: Not currently supported") + endif() + + if(TARGET core_browserdispatchwin) + set_target_properties(core_browserdispatchwin PROPERTIES OUTPUT_NAME browserdispatchwin) + target_link_libraries(core_browserdispatch INTERFACE core_browserdispatchwin) + endif() endif() target_include_directories(core_browserdispatch INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/..) diff --git a/Core/Libraries/Source/EABrowserEngine/CMakeLists.txt b/Core/Libraries/Source/EABrowserEngine/CMakeLists.txt index 6df92e01f92..58a12bb9c16 100644 --- a/Core/Libraries/Source/EABrowserEngine/CMakeLists.txt +++ b/Core/Libraries/Source/EABrowserEngine/CMakeLists.txt @@ -1,16 +1,32 @@ add_library(core_browserengine INTERFACE) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - add_custom_command( - OUTPUT BrowserEngine_i.c BrowserEngine.h - COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserEngine.idl" /header BrowserEngine.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl" - VERBATIM - ) - add_library(core_browserenginewin STATIC BrowserEngine_i.c) - set_target_properties(core_browserenginewin PROPERTIES OUTPUT_NAME browserenginewin) - target_link_libraries(core_browserengine INTERFACE core_browserenginewin) + if(MINGW AND IDL_COMPILER_FOUND) + # Use widl for MinGW builds + add_idl_file(browserengine_idl "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl") + add_library(core_browserenginewin STATIC ${browserengine_idl_IID} ${browserengine_idl_HEADER}) + elseif(MSVC) + # Use midl for MSVC builds + add_custom_command( + OUTPUT BrowserEngine_i.c BrowserEngine.h + COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserEngine.idl" /header BrowserEngine.h /iid BrowserEngine_i.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl" + VERBATIM + ) + add_library(core_browserenginewin STATIC BrowserEngine_i.c) + else() + message(FATAL_ERROR + "EABrowserEngine requires an IDL compiler for Windows builds:\n" + " - For MinGW: Install widl (apt-get install wine-stable-dev)\n" + " - For MSVC: midl.exe should be in PATH\n" + " - For other compilers: Not currently supported") + endif() + + if(TARGET core_browserenginewin) + set_target_properties(core_browserenginewin PROPERTIES OUTPUT_NAME browserenginewin) + target_link_libraries(core_browserengine INTERFACE core_browserenginewin) + endif() endif() target_include_directories(core_browserengine INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/..) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index 35c7ff4bd6e..d8a1a275779 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -237,7 +237,7 @@ add_library(corei_ww3d2 INTERFACE) target_sources(corei_ww3d2 INTERFACE ${WW3D2_SRC}) -if (NOT IS_VS6_BUILD) +if (MSVC AND NOT IS_VS6_BUILD) target_link_libraries(corei_ww3d2 INTERFACE comsuppw ) @@ -245,4 +245,6 @@ endif() target_link_libraries(corei_ww3d2 INTERFACE core_browserengine + core_wwlib + core_wwmath ) diff --git a/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt b/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt index 58f67690b28..dca9eb68fef 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt +++ b/Core/Libraries/Source/WWVegas/WWMath/CMakeLists.txt @@ -88,6 +88,7 @@ target_sources(core_wwmath PRIVATE ${WWMATH_SRC}) target_link_libraries(core_wwmath PRIVATE core_wwcommon corei_always + core_wwsaveload ) # @todo Test its impact and see what to do with the legacy functions. diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index 3bc272b2e82..ada976f2a3c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -249,6 +249,7 @@ target_precompile_headers(g_ww3d2 PRIVATE ) target_link_libraries(g_ww3d2 PRIVATE + core_wwdebug corei_ww3d2 g_wwcommon gi_always diff --git a/Generals/Code/Main/CMakeLists.txt b/Generals/Code/Main/CMakeLists.txt index f6b7a4640bd..5e9aa4c9cf1 100644 --- a/Generals/Code/Main/CMakeLists.txt +++ b/Generals/Code/Main/CMakeLists.txt @@ -54,7 +54,9 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BuildVersion.h ) endif() -target_link_options(g_generals PRIVATE "/NODEFAULTLIB:libci.lib") +if(MSVC) + target_link_options(g_generals PRIVATE "/NODEFAULTLIB:libci.lib") +endif() target_include_directories(g_generals PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} @@ -67,7 +69,11 @@ target_sources(g_generals PRIVATE WinMain.h ) -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") +# RC files are optional for MinGW builds +# Icon: LoadIcon() handles missing resource gracefully (uses default system icon) +# Manifest: DPI awareness metadata (nice to have but not essential) +# TYPELIB: Broken (0 bytes) and causes windres memory exhaustion errors +if(MSVC) # VS2005 and later adds default manifest, we need to turn it off to prevent conflict with custom manifest if(NOT IS_VS6_BUILD) target_link_options(g_generals PRIVATE diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt index f3bfa78cdb7..59617b6b451 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt @@ -254,6 +254,7 @@ target_precompile_headers(z_ww3d2 PRIVATE ) target_link_libraries(z_ww3d2 PRIVATE + core_wwdebug corei_ww3d2 z_wwcommon zi_always diff --git a/GeneralsMD/Code/Main/CMakeLists.txt b/GeneralsMD/Code/Main/CMakeLists.txt index cabc45befa4..49cee59a1ec 100644 --- a/GeneralsMD/Code/Main/CMakeLists.txt +++ b/GeneralsMD/Code/Main/CMakeLists.txt @@ -45,7 +45,9 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/BuildVersion.h " ) -target_link_options(z_generals PRIVATE "/NODEFAULTLIB:libci.lib") +if(MSVC) + target_link_options(z_generals PRIVATE "/NODEFAULTLIB:libci.lib") +endif() target_include_directories(z_generals PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} @@ -57,7 +59,10 @@ target_sources(z_generals PRIVATE WinMain.h ) -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") +# RC files optional for MinGW builds +# Icon: LoadIcon() handles missing resource gracefully (uses default system icon) +# Manifest: DPI awareness metadata (nice to have but not essential) +if(MSVC) # VS2005 and later adds default manifest, we need to turn it off to prevent conflict with custom manifest if(NOT IS_VS6_BUILD) target_link_options(z_generals PRIVATE From e4c78ab36150cd761fcafa275725c34c5c311e17 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:22:07 +0000 Subject: [PATCH 088/211] fix(core): Add MinGW-w64 compatibility fixes to Core libraries (#2067) Add comprehensive MinGW-w64 compatibility fixes to Core engine and library code: Type definitions and compatibility (always.h, BaseTypeCore.h): - Add __int64 and _int64 type definitions for MinGW - Add NOMINMAX and min/max template handling - Add __forceinline macro mapping Calling conventions (wwstring, widestring, GameText, profile): - Standardize Format() functions to __cdecl for cross-compiler compatibility - Fix variadic macro handling for GCC - Add explicit calling convention specifications where needed Headers and forward declarations: - Add missing forward declarations (WorldHeightMap.h, texture.h, textureloader.h) - Fix include path case sensitivity (endian_compat.h, winsock.h) - Include comsupp_compat.h before comutil.h for COM support Compiler guards and compatibility: - Guard MSVC SEH (MiniDumper.cpp) with _MSC_VER checks - Guard inline assembly with compiler checks (debug_stack.cpp, debug_except.cpp) - Add GCC inline assembly alternatives where needed - Disable MSVC SEH for MinGW (thread.cpp, Except.cpp) Linkage fixes: - Remove inappropriate static qualifiers (W3DWaterTracks.cpp) - Fix extern/static mismatches (missingtexture.cpp) - Add explicit void* casts for function pointers Includes and dependencies: - Add stddef.h for size_t (wwmemlog.h) - Add missing headers for MinGW compilation - Fix COM browser header inclusion order Audio and misc: - Fix __stdcall in AudioEvents.h function pointer typedefs - Fix volatile atomic operations (NoxCompress.cpp) - Use portable sint64 types (wwprofile.cpp) All changes are guarded with compiler checks to maintain MSVC compatibility. Files: 31 Core library source and header files --- .../GameNetwork/WOLBrowser/FEBDispatch.h | 5 ++ .../Source/Common/System/MiniDumper.cpp | 9 +++ .../Source/Common/System/XferCRC.cpp | 2 +- .../W3DDevice/GameClient/WorldHeightMap.h | 2 + .../GameClient/Water/W3DWaterTracks.cpp | 2 +- Core/Libraries/Include/Lib/BaseTypeCore.h | 8 +-- .../Compression/LZHCompress/NoxCompress.cpp | 4 +- .../Source/WWVegas/WW3D2/dx8webbrowser.cpp | 3 + .../Source/WWVegas/WW3D2/missingtexture.cpp | 4 +- Core/Libraries/Source/WWVegas/WW3D2/texture.h | 1 + .../Source/WWVegas/WW3D2/textureloader.h | 1 + .../Source/WWVegas/WWAudio/AudioEvents.h | 8 +-- .../Source/WWVegas/WWDebug/wwmemlog.cpp | 2 +- .../Source/WWVegas/WWDebug/wwmemlog.h | 2 + .../Source/WWVegas/WWDebug/wwprofile.cpp | 2 +- .../Libraries/Source/WWVegas/WWDownload/ftp.h | 2 +- .../Libraries/Source/WWVegas/WWLib/Except.cpp | 27 +++++---- Core/Libraries/Source/WWVegas/WWLib/Except.h | 4 +- Core/Libraries/Source/WWVegas/WWLib/always.h | 16 ++++++ .../Libraries/Source/WWVegas/WWLib/thread.cpp | 9 +++ .../Source/WWVegas/WWLib/widestring.cpp | 4 +- .../Source/WWVegas/WWLib/widestring.h | 4 +- .../Source/WWVegas/WWLib/wwstring.cpp | 4 +- .../Libraries/Source/WWVegas/WWLib/wwstring.h | 4 +- Core/Libraries/Source/debug/debug_debug.cpp | 56 +++++++++++++++++++ Core/Libraries/Source/debug/debug_debug.h | 6 ++ Core/Libraries/Source/debug/debug_except.cpp | 16 ++---- Core/Libraries/Source/debug/debug_stack.cpp | 12 ++++ Core/Libraries/Source/profile/internal.h | 2 +- .../Source/profile/profile_funclevel.cpp | 2 +- Core/Tools/Autorun/GameText.cpp | 2 +- .../Code/Libraries/Include/Lib/BaseType.h | 4 +- .../Code/Libraries/Include/Lib/BaseType.h | 4 +- 33 files changed, 179 insertions(+), 54 deletions(-) diff --git a/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h b/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h index 1c60b0bf50a..e7e0eb1135e 100644 --- a/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h +++ b/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h @@ -29,6 +29,11 @@ #pragma once +#if defined __MINGW32__ +#include "Utility/atl_compat.h" +#include "Utility/comsupp_compat.h" +#endif + #include extern CComModule _Module; #include diff --git a/Core/GameEngine/Source/Common/System/MiniDumper.cpp b/Core/GameEngine/Source/Common/System/MiniDumper.cpp index 9c48e39d12c..b5fcf376c88 100644 --- a/Core/GameEngine/Source/Common/System/MiniDumper.cpp +++ b/Core/GameEngine/Source/Common/System/MiniDumper.cpp @@ -93,6 +93,8 @@ void MiniDumper::TriggerMiniDump(DumpType dumpType) return; } +#if defined(_MSC_VER) + // MSVC supports structured exception handling (__try/__except) __try { // Use DebugBreak to raise an exception that can be caught in the __except block @@ -102,6 +104,13 @@ void MiniDumper::TriggerMiniDump(DumpType dumpType) { TriggerMiniDumpForException(g_dumpException, dumpType); } +#elif defined(__GNUC__) && defined(_WIN32) + // GCC/MinGW-w64 doesn't support MSVC's __try/__except syntax + // Trigger dump directly without SEH support + DEBUG_LOG(("MiniDumper::TriggerMiniDump: SEH not supported on this compiler, skipping manual dump trigger.")); +#else + #error "MiniDumper::TriggerMiniDump: Unsupported compiler. This code requires MSVC or GCC/MinGW-w64 targeting Windows." +#endif } void MiniDumper::TriggerMiniDumpForException(_EXCEPTION_POINTERS* e_info, DumpType dumpType) diff --git a/Core/GameEngine/Source/Common/System/XferCRC.cpp b/Core/GameEngine/Source/Common/System/XferCRC.cpp index 2db597097d2..c5c3297fd5c 100644 --- a/Core/GameEngine/Source/Common/System/XferCRC.cpp +++ b/Core/GameEngine/Source/Common/System/XferCRC.cpp @@ -34,7 +34,7 @@ #include "Common/XferDeepCRC.h" #include "Common/crc.h" #include "Common/Snapshot.h" -#include "utility/endian_compat.h" +#include "Utility/endian_compat.h" //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- diff --git a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h index e5ce499ba8b..66d736dbb01 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h +++ b/Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h @@ -91,6 +91,8 @@ class InputStream; class OutputStream; class DataChunkInput; struct DataChunkInfo; +class TerrainTextureClass; +class AlphaTerrainTextureClass; class AlphaEdgeTextureClass; #define NUM_ALPHA_TILES 12 diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 7b811190f92..8fb9cae3199 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -1083,7 +1083,7 @@ extern HWND ApplicationHWnd; //TODO: Fix editor so it actually draws the wave segment instead of line while editing //Could freeze all the water while editing? Or keep setting elapsed time on current segment. //Have to make it so seamless merge of segments at final position. -static void TestWaterUpdate(void) +void TestWaterUpdate(void) { static Int doInit=1; static WaterTracksObj *track=nullptr,*track2=nullptr; diff --git a/Core/Libraries/Include/Lib/BaseTypeCore.h b/Core/Libraries/Include/Lib/BaseTypeCore.h index f173ade19b4..ab702efd496 100644 --- a/Core/Libraries/Include/Lib/BaseTypeCore.h +++ b/Core/Libraries/Include/Lib/BaseTypeCore.h @@ -92,12 +92,12 @@ //#define abs(x) (((x) < 0) ? -(x) : (x)) //#endif -#ifndef min -#define min(x,y) (((x)<(y)) ? (x) : (y)) +#ifndef MIN +#define MIN(x,y) (((x)<(y)) ? (x) : (y)) #endif -#ifndef max -#define max(x,y) (((x)>(y)) ? (x) : (y)) +#ifndef MAX +#define MAX(x,y) (((x)>(y)) ? (x) : (y)) #endif #ifndef TRUE diff --git a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp index 638ab493c12..25d454c0b87 100644 --- a/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp +++ b/Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp @@ -164,7 +164,7 @@ Bool CompressFile (char *infile, char *outfile) compressor = LZHLCreateCompressor(); for ( i = 0; i < rawSize; i += BLOCKSIZE ) { - blocklen = min((UnsignedInt)BLOCKSIZE, rawSize - i); + blocklen = MIN((UnsignedInt)BLOCKSIZE, rawSize - i); compressed = LZHLCompress(compressor, outBlock + compressedSize, inBlock + i, blocklen); compressedSize += compressed; } @@ -282,7 +282,7 @@ Bool CompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int& compressor = LZHLCreateCompressor(); for ( i = 0; i < rawSize; i += BLOCKSIZE ) { - blocklen = min((UnsignedInt)BLOCKSIZE, rawSize - i); + blocklen = MIN((UnsignedInt)BLOCKSIZE, rawSize - i); compressed = LZHLCompress(compressor, outBuffer + compressedSize, inBuffer + i, blocklen); compressedSize += compressed; } diff --git a/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp b/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp index c3a5ef22b3a..75f014f3f56 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp @@ -46,6 +46,9 @@ #else +#ifdef __MINGW32__ +#include "Utility/comsupp_compat.h" // MinGW COM support compatibility +#endif #include #include diff --git a/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp b/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp index e857b831392..0a2867b12b7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp @@ -162,7 +162,7 @@ void MissingTexture::_Deinit() _MissingTexture=nullptr; } -static unsigned int missing_image_palette[]={ +unsigned int missing_image_palette[]={ 0x7F040204,0x7F048AC4,0x7F84829C,0x7FFC0204,0x7F0442AB,0x7FFCFE04,0x7F444244,0x7F0462FC, 0x7F84CEE4,0x7FC4C6CF,0x7F9CA6B2,0x7FC4E6F4,0x7F04FE04,0x7F4C82D4,0x7F2452A1,0x7F0442D4, 0x7F446AB0,0x7FA4A6B6,0x7F2C62C2,0x7FE4E6E9,0x7F646264,0x7F0402FC,0x7FC4D6E1,0x7F44B6DC, @@ -196,7 +196,7 @@ static unsigned int missing_image_palette[]={ 0x7FACDEEC,0x7F2CA6D4,0x7F0452E4,0x7FD4D6E4,0x7F849ED4,0x7FB4B6CC,0x7F4C7ACC,0x7FACC6FC, 0x7F9496B4,0x7F042AA4,0x7F1C62E4,0x7F74A6EC,0x7FE4EEFC,0x7F1C72FC,0x7FD4DEEC,0x7F2C5ABC}; -static unsigned int missing_image_pixels[]={ +unsigned int missing_image_pixels[]={ 0x03030303,0x03030303,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7, 0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7, 0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7, diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texture.h b/Core/Libraries/Source/WWVegas/WW3D2/texture.h index 2239ec38d95..968de859c34 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texture.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/texture.h @@ -58,6 +58,7 @@ class DX8Wrapper; class TextureLoader; class LoaderThreadClass; class TextureLoadTaskClass; +class TextureClass; class CubeTextureClass; class VolumeTextureClass; diff --git a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h index 66c8576f14d..af5b018cd84 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h @@ -45,6 +45,7 @@ class StringClass; struct IDirect3DTexture8; class TextureLoadTaskClass; +class TextureLoadTaskListClass; class TextureLoader { diff --git a/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h b/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h index 3141ff21630..f3db72c15db 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h @@ -60,10 +60,10 @@ class StringClass; // Callback declarations. These functions are called when a registered event occurs // in the sound library/ // -typedef void (_stdcall *LPFNSOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param); -typedef void (_stdcall *LPFNEOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param); -typedef void (_stdcall *LPFNHEARDCALLBACK) (LogicalListenerClass *listener, LogicalSoundClass *sound_obj, uint32 user_param); -typedef void (_stdcall *LPFNTEXTCALLBACK) (AudibleSoundClass *sound_obj, const StringClass &text, uint32 user_param); +typedef void (__stdcall *LPFNSOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param); +typedef void (__stdcall *LPFNEOSCALLBACK) (SoundSceneObjClass *sound_obj, uint32 user_param); +typedef void (__stdcall *LPFNHEARDCALLBACK) (LogicalListenerClass *listener, LogicalSoundClass *sound_obj, uint32 user_param); +typedef void (__stdcall *LPFNTEXTCALLBACK) (AudibleSoundClass *sound_obj, const StringClass &text, uint32 user_param); ///////////////////////////////////////////////////////////////////////////////// diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp index 52644fa4984..067a8b6b716 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp @@ -131,7 +131,7 @@ class MemoryCounterClass public: MemoryCounterClass(void) : CurrentAllocation(0), PeakAllocation(0) { } - void Memory_Allocated(int size) { CurrentAllocation+=size; PeakAllocation = max(PeakAllocation,CurrentAllocation); } + void Memory_Allocated(int size) { CurrentAllocation+=size; PeakAllocation = MAX(PeakAllocation,CurrentAllocation); } void Memory_Released(int size) { CurrentAllocation-=size; } int Get_Current_Allocated_Memory(void) { return CurrentAllocation; } diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.h b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.h index b994bbe16bc..3a87b80d83b 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.h +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.h @@ -38,6 +38,8 @@ #pragma once +#include + #define LOG_MEMORY // Comment this out to disable memlog compiling in class MemLogClass; diff --git a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp index 00a0241bcda..e6e4d0fb88c 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp @@ -95,7 +95,7 @@ WWINLINE double WWProfile_Get_Inv_Processor_Ticks_Per_Second(void) * HISTORY: * * 9/24/2000 gth : Created. * *=============================================================================================*/ -inline void WWProfile_Get_Ticks(_int64 * ticks) +static inline void WWProfile_Get_Ticks(_int64 * ticks) { #ifdef _UNIX *ticks = TIMEGETTIME(); diff --git a/Core/Libraries/Source/WWVegas/WWDownload/ftp.h b/Core/Libraries/Source/WWVegas/WWDownload/ftp.h index 08c5918ab47..bfbb39be77e 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/ftp.h +++ b/Core/Libraries/Source/WWVegas/WWDownload/ftp.h @@ -22,7 +22,7 @@ //#include "../resource.h" // main symbols -#include "winsock.h" +#include #include #include "WWDownload/ftpdefs.h" diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp index 863f6ed63dd..6a8cdb87a4f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp @@ -47,7 +47,7 @@ * Exception_Handler -- Exception handler filter function * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -#ifdef _MSC_VER + #if defined(_WIN32) #include "always.h" #include @@ -625,18 +625,13 @@ void Dump_Exception_Info(EXCEPTION_POINTERS *e_info) } void *fp_data_ptr = (void*)(&context->FloatSave.RegisterArea[fp*10]); - double fp_value; + // TheSuperHackers @refactor Replaced MSVC inline assembly with portable C++ cast for MinGW compatibility /* ** Convert FP dump from temporary real value (10 bytes) to double (8 bytes). + ** On x86, long double is the 10-byte x87 format, so we can just cast. */ - _asm { - push eax - mov eax,fp_data_ptr - fld tbyte ptr [eax] - fstp qword ptr [fp_value] - pop eax - } + double fp_value = (double)(*(long double*)fp_data_ptr); sprintf(scrap, " %+#.17e\r\n", fp_value); Add_Txt(scrap); } @@ -1232,6 +1227,7 @@ int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *cont unsigned long reg_eip, reg_ebp, reg_esp; +#if defined(_MSC_VER) __asm { here: lea eax,here @@ -1239,6 +1235,17 @@ int Stack_Walk(unsigned long *return_addresses, int num_addresses, CONTEXT *cont mov reg_ebp,ebp mov reg_esp,esp } +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + __asm__ __volatile__ ( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%ebp, %1\n\t" + "mov %%esp, %2" + : "=r" (reg_eip), "=r" (reg_ebp), "=r" (reg_esp) + ); +#else +#error "Unsupported compiler or architecture for register capture" +#endif stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrPC.Offset = reg_eip; @@ -1307,7 +1314,7 @@ bool Is_Trying_To_Exit(void) -#endif //_MSC_VER +#endif //_WIN32 diff --git a/Core/Libraries/Source/WWVegas/WWLib/Except.h b/Core/Libraries/Source/WWVegas/WWLib/Except.h index 69a7bf3b6cc..6b9daaeadb8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.h @@ -36,7 +36,7 @@ #pragma once -#ifdef _MSC_VER +#if defined(_WIN32) #include "win.h" /* @@ -80,4 +80,4 @@ typedef struct tThreadInfoType { -#endif //_MSC_VER +#endif //_WIN32 diff --git a/Core/Libraries/Source/WWVegas/WWLib/always.h b/Core/Libraries/Source/WWVegas/WWLib/always.h index 0bbe089cccf..946f5dab695 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/always.h +++ b/Core/Libraries/Source/WWVegas/WWLib/always.h @@ -200,7 +200,9 @@ class W3DMPO ** I'm replacing all occurrences of 'min' and 'max with 'MIN' and 'MAX'. For code which ** is out of our domain (e.g. Max sdk) I'm declaring template functions for 'min' and 'max' */ +#ifndef NOMINMAX #define NOMINMAX +#endif #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) @@ -218,6 +220,17 @@ class W3DMPO #undef max #endif +// Provide min/max template functions for compatibility with legacy code +#ifndef _MIN_MAX_TEMPLATES_DEFINED_ +#define _MIN_MAX_TEMPLATES_DEFINED_ + +#if defined(__MINGW32__) || defined(__MINGW64__) +// For MinGW, use STL's min/max +#include +using std::min; +using std::max; +#else +// For MSVC, provide custom templates template T min(T a,T b) { if (a T max(T a,T b) return b; } } +#endif + +#endif // _MIN_MAX_TEMPLATES_DEFINED_ /* diff --git a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp index 6bafc3314ad..7b30487e27b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp @@ -57,6 +57,8 @@ void __cdecl ThreadClass::Internal_Thread_Function(void* params) #ifdef _WIN32 Register_Thread_ID(tc->ThreadID, tc->ThreadName); +#if defined(_MSC_VER) + // MSVC supports structured exception handling (__try/__except) if (tc->ExceptionHandler != nullptr) { __try { tc->Thread_Function(); @@ -64,6 +66,13 @@ void __cdecl ThreadClass::Internal_Thread_Function(void* params) } else { tc->Thread_Function(); } +#elif defined(__GNUC__) && defined(_WIN32) + // GCC/MinGW-w64 doesn't support MSVC's __try/__except syntax + // Call Thread_Function directly without SEH support + tc->Thread_Function(); +#else + #error "ThreadClass::Internal_Thread_Function: Unsupported compiler. This code requires MSVC or GCC/MinGW-w64 targeting Windows." +#endif #else //_WIN32 tc->Thread_Function(); diff --git a/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp b/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp index 6fc6d12643d..fa421229b2b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/widestring.cpp @@ -242,7 +242,7 @@ WideStringClass::Free_String (void) // Format // /////////////////////////////////////////////////////////////////// -int _cdecl +int __cdecl WideStringClass::Format_Args (const WCHAR *format, va_list arg_list ) { if (format == nullptr) { @@ -273,7 +273,7 @@ WideStringClass::Format_Args (const WCHAR *format, va_list arg_list ) // Format // /////////////////////////////////////////////////////////////////// -int _cdecl +int __cdecl WideStringClass::Format (const WCHAR *format, ...) { if (format == nullptr) { diff --git a/Core/Libraries/Source/WWVegas/WWLib/widestring.h b/Core/Libraries/Source/WWVegas/WWLib/widestring.h index 3f08f9c3564..68421655bf5 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/widestring.h +++ b/Core/Libraries/Source/WWVegas/WWLib/widestring.h @@ -104,8 +104,8 @@ class WideStringClass bool Is_Empty (void) const; void Erase (int start_index, int char_count); - int _cdecl Format (const WCHAR *format, ...); - int _cdecl Format_Args (const WCHAR *format, va_list arg_list ); + int __cdecl Format (const WCHAR *format, ...); + int __cdecl Format_Args (const WCHAR *format, va_list arg_list ); bool Convert_From (const char *text); bool Convert_To (StringClass &string); bool Convert_To (StringClass &string) const; diff --git a/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp b/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp index 3793688c440..62c612d0856 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/wwstring.cpp @@ -235,7 +235,7 @@ StringClass::Free_String (void) // Format // /////////////////////////////////////////////////////////////////// -int _cdecl +int __cdecl StringClass::Format_Args (const TCHAR *format, va_list arg_list ) { // @@ -267,7 +267,7 @@ StringClass::Format_Args (const TCHAR *format, va_list arg_list ) // Format // /////////////////////////////////////////////////////////////////// -int _cdecl +int __cdecl StringClass::Format (const TCHAR *format, ...) { va_list arg_list; diff --git a/Core/Libraries/Source/WWVegas/WWLib/wwstring.h b/Core/Libraries/Source/WWVegas/WWLib/wwstring.h index 56981c4fdf4..6ae220b3787 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/wwstring.h +++ b/Core/Libraries/Source/WWVegas/WWLib/wwstring.h @@ -114,8 +114,8 @@ class StringClass bool Is_Empty (void) const; void Erase (int start_index, int char_count); - int _cdecl Format (const TCHAR *format, ...); - int _cdecl Format_Args (const TCHAR *format, va_list arg_list ); + int __cdecl Format (const TCHAR *format, ...); + int __cdecl Format_Args (const TCHAR *format, va_list arg_list ); // Trim leading and trailing whitespace characters (values <= 32) void Trim(void); diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index 0bfa6ef5cfd..7e218e9ad1b 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -47,11 +47,22 @@ bool __DebugIncludeInLink1; // .CRT$XCZ. We jam in our own two functions at the very beginning // and end of this list (B and Y respectively since the A and Z segments // contain list delimiters). +#if defined(_MSC_VER) #pragma data_seg(".CRT$XCB") void *Debug::PreStatic=&Debug::PreStaticInit; #pragma data_seg(".CRT$XCY") void *Debug::PostStatic=&Debug::PostStaticInit; #pragma data_seg() +#elif defined(__GNUC__) && defined(_WIN32) +// For GCC/MinGW-w64 targeting Windows, use constructor attributes +// Use priority 101 for PreStatic (very early) and 65434 for PostStatic (very late) +void __attribute__((constructor(101))) GccPreStaticInit() { Debug::PreStaticInit(); } +void __attribute__((constructor(65434))) GccPostStaticInit() { Debug::PostStaticInit(); } +void *Debug::PreStatic = nullptr; +void *Debug::PostStatic = nullptr; +#else +#error "Unsupported compiler or platform. This code requires MSVC or GCC/MinGW-w64 targeting Windows." +#endif Debug::LogDescription::LogDescription(const char *fileOrGroup, const char *description) { @@ -253,15 +264,36 @@ Debug::~Debug() // again, do not put any code in here } +#if defined(_MSC_VER) +// MSVC: Use SE Translator static void LocalSETranslator(unsigned, struct _EXCEPTION_POINTERS *pExPtrs) { // simply call our regular exception handler DebugExceptionhandler::ExceptionFilter(pExPtrs); } +#elif defined(__GNUC__) && defined(_WIN32) +// MinGW-w64: Use Vectored Exception Handler (Windows-only) +// Note: VEH is process-wide (unlike MSVC's per-thread _set_se_translator), +// but this matches the existing process-wide SetUnhandledExceptionFilter architecture. +// Returns EXCEPTION_CONTINUE_SEARCH to avoid interfering with normal exception handling. +static LONG WINAPI LocalVectoredExceptionHandler(struct _EXCEPTION_POINTERS *pExPtrs) +{ + // Call our regular exception handler + DebugExceptionhandler::ExceptionFilter(pExPtrs); + return EXCEPTION_CONTINUE_SEARCH; +} +#endif void Debug::InstallExceptionHandler(void) { +#if defined(_MSC_VER) _set_se_translator(LocalSETranslator); +#elif defined(__GNUC__) && defined(_WIN32) + // MinGW-w64 doesn't support _set_se_translator, use Vectored Exception Handler + AddVectoredExceptionHandler(1, LocalVectoredExceptionHandler); +#else + #error "Unsupported compiler for exception handling" +#endif } bool Debug::SkipNext(void) @@ -274,11 +306,23 @@ bool Debug::SkipNext(void) // do not implement this function inline, we do need // a valid frame pointer here! unsigned help; +#if defined(_MSC_VER) _asm { mov eax,[ebp+4] // return address mov help,eax }; +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + // GCC/Clang inline assembly for x86-32 + __asm__ __volatile__( + "mov 4(%%ebp), %0" + : "=r"(help) + : + : "memory" + ); +#else + #error "Unsupported compiler or architecture for inline assembly" +#endif curStackFrame=help; // do we know if to skip the following code? @@ -390,7 +434,13 @@ bool Debug::AssertDone(void) } break; case IDRETRY: +#if defined(_MSC_VER) _asm int 0x03 +#elif defined(__GNUC__) + __builtin_trap(); +#else + #error "Unsupported compiler for breakpoint" +#endif break; default: ((void)0); @@ -658,7 +708,13 @@ bool Debug::CrashDone(bool die) } break; case IDRETRY: +#if defined(_MSC_VER) _asm int 0x03 +#elif defined(__GNUC__) + __builtin_trap(); +#else + #error "Unsupported compiler for breakpoint" +#endif break; default: ((void)0); diff --git a/Core/Libraries/Source/debug/debug_debug.h b/Core/Libraries/Source/debug/debug_debug.h index 620bdfe1537..f49104985e2 100644 --- a/Core/Libraries/Source/debug/debug_debug.h +++ b/Core/Libraries/Source/debug/debug_debug.h @@ -731,6 +731,12 @@ DLOG( "My HResult is: " << Debug::HResult(SomeHRESULTValue) << "\n" ); void WriteBuildInfo(void); private: +#if defined(__GNUC__) && defined(_WIN32) + // For GCC/MinGW-w64 targeting Windows, allow constructor functions to call init methods + friend void GccPreStaticInit(); + friend void GccPostStaticInit(); +#endif + // no assignment, no copy constructor Debug(const Debug&); Debug& operator=(const Debug&); diff --git a/Core/Libraries/Source/debug/debug_except.cpp b/Core/Libraries/Source/debug/debug_except.cpp index 49df2d86be5..8a90948733f 100644 --- a/Core/Libraries/Source/debug/debug_except.cpp +++ b/Core/Libraries/Source/debug/debug_except.cpp @@ -172,17 +172,13 @@ void DebugExceptionhandler::LogFPURegisters(Debug &dbg, struct _EXCEPTION_POINTE for (unsigned i=0;i<10;i++) dbg << Debug::Width(2) << value[i]; - double fpVal; + // TheSuperHackers @refactor Replaced MSVC inline assembly with portable C++ cast for MinGW compatibility + // Convert from temporary real (10 byte) to double (8 bytes). + // On x86, long double is the 10-byte x87 format, so we can just cast. + double fpVal = (double)(*(long double*)value); + dbg << " " << fpVal; - // convert from temporary real (10 byte) to double - _asm - { - mov eax,value - fld tbyte ptr [eax] - fstp qword ptr [fpVal] - } - - dbg << " " << fpVal << "\n"; + dbg << "\n"; } dbg << Debug::FillChar() << Debug::Dec(); } diff --git a/Core/Libraries/Source/debug/debug_stack.cpp b/Core/Libraries/Source/debug/debug_stack.cpp index 50016506e1a..71d99058137 100644 --- a/Core/Libraries/Source/debug/debug_stack.cpp +++ b/Core/Libraries/Source/debug/debug_stack.cpp @@ -364,6 +364,7 @@ int DebugStackwalk::StackWalk(Signature &sig, struct _CONTEXT *ctx) { // walk stack back using current call chain unsigned long reg_eip, reg_ebp, reg_esp; +#if defined(_MSC_VER) __asm { here: @@ -372,6 +373,17 @@ int DebugStackwalk::StackWalk(Signature &sig, struct _CONTEXT *ctx) mov reg_ebp,ebp mov reg_esp,esp }; +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + __asm__ __volatile__ ( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%ebp, %1\n\t" + "mov %%esp, %2" + : "=r" (reg_eip), "=r" (reg_ebp), "=r" (reg_esp) + ); +#else +#error "Unsupported compiler or architecture for register capture" +#endif stackFrame.AddrPC.Offset = reg_eip; stackFrame.AddrStack.Offset = reg_esp; stackFrame.AddrFrame.Offset = reg_ebp; diff --git a/Core/Libraries/Source/profile/internal.h b/Core/Libraries/Source/profile/internal.h index 2bfd185182f..9d418018d85 100644 --- a/Core/Libraries/Source/profile/internal.h +++ b/Core/Libraries/Source/profile/internal.h @@ -86,7 +86,7 @@ class ProfileFastCS } #else - volatile std::atomic_flag Flag{}; + std::atomic_flag Flag{}; void ThreadSafeSetFlag() { diff --git a/Core/Libraries/Source/profile/profile_funclevel.cpp b/Core/Libraries/Source/profile/profile_funclevel.cpp index fe5129fe6ae..3e73367dec8 100644 --- a/Core/Libraries/Source/profile/profile_funclevel.cpp +++ b/Core/Libraries/Source/profile/profile_funclevel.cpp @@ -74,7 +74,7 @@ static void __declspec(naked) _pleave(void) } } -extern "C" void __declspec(naked) _cdecl _penter(void) +extern "C" void __declspec(naked) __cdecl _penter(void) { unsigned callerFunc,ESPonReturn,callerRet; ProfileFuncLevelTracer *p; diff --git a/Core/Tools/Autorun/GameText.cpp b/Core/Tools/Autorun/GameText.cpp index 8da8eba308e..d318b87ca1d 100644 --- a/Core/Tools/Autorun/GameText.cpp +++ b/Core/Tools/Autorun/GameText.cpp @@ -174,7 +174,7 @@ class GameTextManager : public GameTextInterface Char readChar( File *file ); }; -static int _cdecl compareLUT ( const void *, const void*); +static int __cdecl compareLUT ( const void *, const void*); //---------------------------------------------------------------------------- // Private Data //---------------------------------------------------------------------------- diff --git a/Generals/Code/Libraries/Include/Lib/BaseType.h b/Generals/Code/Libraries/Include/Lib/BaseType.h index ea7efe1f5ba..73b766ede9a 100644 --- a/Generals/Code/Libraries/Include/Lib/BaseType.h +++ b/Generals/Code/Libraries/Include/Lib/BaseType.h @@ -174,8 +174,8 @@ struct RealRange // both ranges void combine( RealRange &other ) { - lo = min( lo, other.lo ); - hi = max( hi, other.hi ); + lo = MIN( lo, other.lo ); + hi = MAX( hi, other.hi ); } }; diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h index e0a8c74641d..383c2471418 100644 --- a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h +++ b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h @@ -174,8 +174,8 @@ struct RealRange // both ranges void combine( RealRange &other ) { - lo = min( lo, other.lo ); - hi = max( hi, other.hi ); + lo = MIN( lo, other.lo ); + hi = MAX( hi, other.hi ); } }; From efca138c5ed131d2b25a6b789dd4f5afe4ac8d62 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:29:48 +0000 Subject: [PATCH 089/211] fix(headers): Add missing forward declarations for MinGW (#2067) Add forward declarations for PathfindCell and Anim2DCollection classes to resolve MinGW-w64 compilation errors due to incomplete types. MinGW-w64 is stricter about forward declarations than MSVC, requiring explicit forward declarations for classes used in header files before their first usage. Files modified: - Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h - Generals/Code/GameEngine/Include/GameClient/Anim2D.h - GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h - GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h --- Generals/Code/GameEngine/Include/GameClient/Anim2D.h | 1 + Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h | 3 ++- GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h | 1 + GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h index 19ea3841d53..9f469309ce1 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h @@ -33,6 +33,7 @@ #include "Common/Snapshot.h" // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// +class Anim2DCollection; class Image; // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index 98df973bce0..65db93f142b 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -36,8 +36,9 @@ class Bridge; class Object; -class Weapon; +class PathfindCell; class PathfindZoneManager; +class Weapon; // How close is close enough when moving. diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h index 9ed15772c37..2e571e16eb7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h @@ -34,6 +34,7 @@ // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// class Image; +class Anim2DCollection; // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index 2058f8b9cf2..07856f7bbd7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -39,6 +39,7 @@ class Bridge; class Object; class Weapon; class PathfindZoneManager; +class PathfindCell; // How close is close enough when moving. From 7c6cd3514648c7df7250df00c69fd0053d082c57 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:30:19 +0000 Subject: [PATCH 090/211] fix(linkage): Fix static/extern linkage mismatches for MinGW (#2067) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjust function and variable linkage to resolve MinGW-w64 linker errors caused by inconsistent static/extern declarations across translation units. MinGW-w64 is stricter about ODR (One Definition Rule) violations and requires consistent linkage specifications. Changes - Arrays and data: - Eva.cpp: Remove 'static' from TheEvaMessageNames array - Scripts.cpp: Remove 'static' from TheShellHookNames array - PopupPlayerInfo.cpp: Add 'static' to messageBoxYes to match definition Changes - Helper functions: - PartitionManager.cpp: Remove 'static' from hLine* functions Changes - Callback functions: - WOLBuddyOverlay.cpp: Remove 'static' from insertChat() - WOLLobbyMenu.cpp: Remove 'static' from WOL helper functions - W3DMainMenu.cpp: Remove 'static' from menu callback functions - GameWindowTransitionsStyles.cpp: Remove 'static' from transition functions All affected functions/variables are referenced from other translation units and require external linkage to resolve correctly with MinGW-w64. Files modified (8 files × 2 games = 16 total): - Eva.cpp, Scripts.cpp, PartitionManager.cpp, PopupPlayerInfo.cpp - WOLBuddyOverlay.cpp, WOLLobbyMenu.cpp - W3DMainMenu.cpp, GameWindowTransitionsStyles.cpp --- .../Source/W3DDevice/GameClient/W3DView.cpp | 4 +-- .../Code/GameEngine/Source/GameClient/Eva.cpp | 2 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 2 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 4 +-- .../GUI/GameWindowTransitionsStyles.cpp | 2 +- .../GameLogic/Object/PartitionManager.cpp | 32 +++++++++---------- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Eva.cpp | 2 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 2 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 4 +-- .../GUI/GameWindowTransitionsStyles.cpp | 2 +- .../GameLogic/Object/PartitionManager.cpp | 32 +++++++++---------- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 2 +- .../GUI/GUICallbacks/W3DMainMenu.cpp | 2 +- 17 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 31038ed408f..efd4c3a4d83 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -757,7 +757,7 @@ void drawDebugCircle( const Coord3D & center, Real radius, Real width, Color col } } -void drawDrawableExtents( Drawable *draw, void *userData ); // FORWARD DECLARATION +static void drawDrawableExtents( Drawable *draw, void *userData ); // FORWARD DECLARATION // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ static void drawContainedDrawable( Object *obj, void *userData ) @@ -867,7 +867,7 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) } -void drawAudioLocations( Drawable *draw, void *userData ); +static void drawAudioLocations( Drawable *draw, void *userData ); // ------------------------------------------------------------------------------------------------ // Helper for drawAudioLocations // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp index 24870d4ff97..2d2babdfb89 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Eva.cpp @@ -35,7 +35,7 @@ //------------------------------------------------------------------------------------------------- -static const char *const TheEvaMessageNames[] = +const char *const TheEvaMessageNames[] = { "LOWPOWER", "INSUFFICIENTFUNDS", diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index dd99652757d..180312fc0cd 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -1318,7 +1318,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlayInput( GameWindow *window, Unsigned return MSG_IGNORED; } -void messageBoxYes( void ); +static void messageBoxYes( void ); //------------------------------------------------------------------------------------------------- /** Overlay window system callback */ //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 59f7ba76f0e..0b5efc26d29 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -341,7 +341,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, } -static void insertChat( BuddyMessage msg ) +void insertChat( BuddyMessage msg ) { if (buddyControls.listboxChat) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 903bed54d4d..d3dc6c915fb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -848,7 +848,7 @@ static const char* getMessageString(Int t) /** refreshGameList The Bool is used to force refresh if the refresh button was hit.*/ //------------------------------------------------------------------------------------------------- -static void refreshGameList( Bool forceRefresh ) +void refreshGameList( Bool forceRefresh ) { Int refreshInterval = gameListRefreshInterval; @@ -871,7 +871,7 @@ static void refreshGameList( Bool forceRefresh ) /** refreshPlayerList The Bool is used to force refresh if the refresh button was hit.*/ //------------------------------------------------------------------------------------------------- -static void refreshPlayerList( Bool forceRefresh ) +void refreshPlayerList( Bool forceRefresh ) { Int refreshInterval = playerListRefreshInterval; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index 62a048a7778..877d067e21b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -65,7 +65,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -void drawTypeText( GameWindow *window, DisplayString *str); +static void drawTypeText( GameWindow *window, DisplayString *str); //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index e9c1a12cea5..7620e751e3c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -328,14 +328,14 @@ inline Real maxReal(Real a, Real b) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); +void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms); +void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms); +void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); +void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); static void projectCoord3D(Coord3D *coord, const Coord3D *unitDir, Real dist); static void flipCoord3D(Coord3D *coord); @@ -5586,7 +5586,7 @@ static int cellValueProc(PartitionCell* cell, void* userData) } // ----------------------------------------------------------------------------- -static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5603,7 +5603,7 @@ static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5620,7 +5620,7 @@ static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5637,7 +5637,7 @@ static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5654,7 +5654,7 @@ static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) +void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5682,7 +5682,7 @@ static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) +void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5710,7 +5710,7 @@ static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) +void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5738,7 +5738,7 @@ static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms) +void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 387cb477d69..f06028cfd03 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -75,7 +75,7 @@ static ScriptGroup *s_mtGroup = nullptr; // These strings must be in the same order as they are in their definitions // (See SHELL_SCRIPT_HOOK_* ) // -static const char *const TheShellHookNames[]= +const char *const TheShellHookNames[]= { "ShellMainMenuCampaignPushed", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED, "ShellMainMenuCampaignHighlighted", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 7e2a58d1089..d8119539ddb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -778,7 +778,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, // drawButtonText ============================================================= /** Draw button text to the screen */ //============================================================================= -static void drawText( GameWindow *window, WinInstanceData *instData ) +void drawText( GameWindow *window, WinInstanceData *instData ) { ICoord2D origin, size, textPos; Int width, height; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index c03a9ec8559..db60921d19d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -35,7 +35,7 @@ //------------------------------------------------------------------------------------------------- -static const char *const TheEvaMessageNames[] = +const char *const TheEvaMessageNames[] = { "LOWPOWER", "INSUFFICIENTFUNDS", diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 555b1ac888c..30b6a45dedd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -1408,7 +1408,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlayInput( GameWindow *window, Unsigned return MSG_IGNORED; } -void messageBoxYes( void ); +static void messageBoxYes( void ); //------------------------------------------------------------------------------------------------- /** Overlay window system callback */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 9634ee67db4..88e4f9a0071 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -341,7 +341,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, } -static void insertChat( BuddyMessage msg ) +void insertChat( BuddyMessage msg ) { if (buddyControls.listboxChat) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 6234fcf83d5..ad47750959a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -866,7 +866,7 @@ static const char* getMessageString(Int t) /** refreshGameList The Bool is used to force refresh if the refresh button was hit.*/ //------------------------------------------------------------------------------------------------- -static void refreshGameList( Bool forceRefresh ) +void refreshGameList( Bool forceRefresh ) { Int refreshInterval = gameListRefreshInterval; @@ -889,7 +889,7 @@ static void refreshGameList( Bool forceRefresh ) /** refreshPlayerList The Bool is used to force refresh if the refresh button was hit.*/ //------------------------------------------------------------------------------------------------- -static void refreshPlayerList( Bool forceRefresh ) +void refreshPlayerList( Bool forceRefresh ) { Int refreshInterval = playerListRefreshInterval; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp index 2f749338f93..9e8ea622eb2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitionsStyles.cpp @@ -65,7 +65,7 @@ //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -void drawTypeText( GameWindow *window, DisplayString *str); +static void drawTypeText( GameWindow *window, DisplayString *str); //----------------------------------------------------------------------------- // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 6fad4be7eaf..03d9bf6b746 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -332,14 +332,14 @@ inline Real maxReal(Real a, Real b) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); -static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); -static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); +void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid); +void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms); +void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms); +void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms); +void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms); static void projectCoord3D(Coord3D *coord, const Coord3D *unitDir, Real dist); static void flipCoord3D(Coord3D *coord); @@ -5628,7 +5628,7 @@ static int cellValueProc(PartitionCell* cell, void* userData) } // ----------------------------------------------------------------------------- -static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5645,7 +5645,7 @@ static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5662,7 +5662,7 @@ static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5679,7 +5679,7 @@ static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) +void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5696,7 +5696,7 @@ static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid) } // ----------------------------------------------------------------------------- -static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) +void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5724,7 +5724,7 @@ static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) +void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5752,7 +5752,7 @@ static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) +void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; @@ -5780,7 +5780,7 @@ static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms) } // ----------------------------------------------------------------------------- -static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms) +void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms) { if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 4e9daf5e682..a3dd63f4633 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -76,7 +76,7 @@ static ScriptGroup *s_mtGroup = nullptr; // These strings must be in the same order as they are in their definitions // (See SHELL_SCRIPT_HOOK_* ) // -static const char *const TheShellHookNames[]= +const char *const TheShellHookNames[]= { "ShellMainMenuCampaignPushed", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED, "ShellMainMenuCampaignHighlighted", //SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp index 4d7f7168548..30e91e179fa 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp @@ -778,7 +778,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window, // drawButtonText ============================================================= /** Draw button text to the screen */ //============================================================================= -static void drawText( GameWindow *window, WinInstanceData *instData ) +void drawText( GameWindow *window, WinInstanceData *instData ) { ICoord2D origin, size, textPos; Int width, height; From bb9acc6f56493864fc76997fa6b63c70fb840579 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:30:45 +0000 Subject: [PATCH 091/211] fix(calling-convention): Standardize calling conventions and variadic macros (#2067) Standardize function calling conventions and variadic macro definitions for MinGW-w64 compatibility. Changes: - Add missing __cdecl to function pointers in GameText.h - Fix VA_ARGS macro definitions to use __VA_ARGS__ properly - Ensure consistent calling conventions across platforms This resolves calling convention mismatches that could cause undefined behavior when crossing DLL boundaries or using variadic macros with MinGW-w64. --- Generals/Code/GameEngine/Include/GameClient/GameText.h | 10 ++++++++-- .../Code/GameEngine/Source/GameClient/GameText.cpp | 2 +- .../Code/GameEngine/Include/GameClient/GameText.h | 10 ++++++++-- .../Code/GameEngine/Source/GameClient/GameText.cpp | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/GameText.h b/Generals/Code/GameEngine/Include/GameClient/GameText.h index 11f530de6b7..bf8c94fb88c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameText.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameText.h @@ -110,18 +110,24 @@ extern GameTextInterface* CreateGameTextInterface( void ); // TheGameText->FETCH_OR_SUBSTITUTE("GUI:LabelName", L"Substitute Fallback Text") // TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:LabelName", L"Substitute Fallback Text %d %d", 1, 2) // The substitute text will be compiled out if ENABLE_GAMETEXT_SUBSTITUTES is not defined. +// +// Note: ##__VA_ARGS__ handles zero variadic arguments by removing the preceding comma when empty. +// Example: FETCH_OR_SUBSTITUTE_FORMAT("Label", L"Text") expands correctly without trailing comma. +// Without ##, it would expand to fetchOrSubstituteFormat("Label", L"Text",) causing a syntax error. +// This extension is widely supported (GCC, Clang, MSVC 2015+). C++20 __VA_OPT__ is the standard +// alternative, but ##__VA_ARGS__ is simpler and compatible across C++11/14/17/20. #if ENABLE_GAMETEXT_SUBSTITUTES #define FETCH_OR_SUBSTITUTE(labelA, substituteTextW) fetchOrSubstitute(labelA, substituteTextW) #if __cplusplus >= 201103L // TheSuperHackers @todo Remove condition when abandoning VC6 -#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchOrSubstituteFormat(labelA, substituteFormatW, __VA_ARGS__) +#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchOrSubstituteFormat(labelA, substituteFormatW, ##__VA_ARGS__) #endif #else #define FETCH_OR_SUBSTITUTE(labelA, substituteTextW) fetch(labelA) #if __cplusplus >= 201103L // TheSuperHackers @todo Remove condition when abandoning VC6 -#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteTextW, ...) fetchFormat(labelA, __VA_ARGS__) +#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchFormat(labelA, ##__VA_ARGS__) #endif #endif // ENABLE_GAMETEXT_SUBSTITUTES diff --git a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp index 5a374b7d710..e0ecde33a31 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp @@ -199,7 +199,7 @@ class GameTextManager : public GameTextInterface Char readChar( File *file ); }; -static int _cdecl compareLUT ( const void *, const void*); +static int __cdecl compareLUT ( const void *, const void*); //---------------------------------------------------------------------------- // Private Data //---------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h index 7dc1f79e041..b7a0012f46d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h @@ -110,18 +110,24 @@ extern GameTextInterface* CreateGameTextInterface( void ); // TheGameText->FETCH_OR_SUBSTITUTE("GUI:LabelName", L"Substitute Fallback Text") // TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:LabelName", L"Substitute Fallback Text %d %d", 1, 2) // The substitute text will be compiled out if ENABLE_GAMETEXT_SUBSTITUTES is not defined. +// +// Note: ##__VA_ARGS__ handles zero variadic arguments by removing the preceding comma when empty. +// Example: FETCH_OR_SUBSTITUTE_FORMAT("Label", L"Text") expands correctly without trailing comma. +// Without ##, it would expand to fetchOrSubstituteFormat("Label", L"Text",) causing a syntax error. +// This extension is widely supported (GCC, Clang, MSVC 2015+). C++20 __VA_OPT__ is the standard +// alternative, but ##__VA_ARGS__ is simpler and compatible across C++11/14/17/20. #if ENABLE_GAMETEXT_SUBSTITUTES #define FETCH_OR_SUBSTITUTE(labelA, substituteTextW) fetchOrSubstitute(labelA, substituteTextW) #if __cplusplus >= 201103L // TheSuperHackers @todo Remove condition when abandoning VC6 -#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchOrSubstituteFormat(labelA, substituteFormatW, __VA_ARGS__) +#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchOrSubstituteFormat(labelA, substituteFormatW, ##__VA_ARGS__) #endif #else #define FETCH_OR_SUBSTITUTE(labelA, substituteTextW) fetch(labelA) #if __cplusplus >= 201103L // TheSuperHackers @todo Remove condition when abandoning VC6 -#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteTextW, ...) fetchFormat(labelA, __VA_ARGS__) +#define FETCH_OR_SUBSTITUTE_FORMAT(labelA, substituteFormatW, ...) fetchFormat(labelA, ##__VA_ARGS__) #endif #endif // ENABLE_GAMETEXT_SUBSTITUTES diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp index bc7bf2f8dc3..97a2c9d5dfa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp @@ -199,7 +199,7 @@ class GameTextManager : public GameTextInterface Char readChar( File *file ); }; -static int _cdecl compareLUT ( const void *, const void*); +static int __cdecl compareLUT ( const void *, const void*); //---------------------------------------------------------------------------- // Private Data //---------------------------------------------------------------------------- From be30428a18d08d2b77b63eeb1c8c4c20db331dee Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:31:05 +0000 Subject: [PATCH 092/211] fix(compatibility): Add compiler guards and GCC inline assembly for StackDump (#2067) Add explicit compiler checks and GCC-specific inline assembly implementation for the StackDump function to enable MinGW-w64 support. Changes: - Add #ifdef _MSC_VER guards around MSVC-specific inline assembly - Implement GCC-compatible inline assembly version using __asm__ __volatile__ - Add #error directive for unsupported compilers - Maintain identical functionality across compilers This enables stack dumping functionality to work correctly with both MSVC and MinGW-w64/GCC toolchains. --- .../Source/Common/System/StackDump.cpp | 31 +++++++++++++++++++ .../Source/Common/System/StackDump.cpp | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp index e248d5d6ff3..f3025de863e 100644 --- a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -69,6 +69,7 @@ void StackDump(void (*callback)(const char*)) DWORD myeip,myesp,myebp; +#if defined(_MSC_VER) _asm { MYEIP1: @@ -79,6 +80,20 @@ _asm mov eax, ebp mov dword ptr [myebp] , eax } +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + // GCC/Clang inline assembly for x86-32 + __asm__ __volatile__( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%esp, %1\n\t" + "mov %%ebp, %2" + : "=r"(myeip), "=r"(myesp), "=r"(myebp) + : + : "memory" + ); +#else + #error "Unsupported compiler or architecture for register capture" +#endif MakeStackTrace(myeip,myesp,myebp, 2, callback); @@ -314,6 +329,7 @@ void FillStackAddresses(void**addresses, unsigned int count, unsigned int skip) gsContext.ContextFlags = CONTEXT_FULL; DWORD myeip,myesp,myebp; +#if defined(_MSC_VER) _asm { MYEIP2: @@ -325,6 +341,21 @@ _asm mov dword ptr [myebp] , eax xor eax,eax } +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + // GCC/Clang inline assembly for x86-32 + __asm__ __volatile__( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%esp, %1\n\t" + "mov %%ebp, %2\n\t" + "xor %%eax, %%eax" + : "=r"(myeip), "=r"(myesp), "=r"(myebp) + : + : "eax", "memory" + ); +#else + #error "Unsupported compiler or architecture for register capture" +#endif memset(&stack_frame, 0, sizeof(STACKFRAME)); stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrPC.Offset = myeip; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp index 74b0c151670..8bc48639027 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -69,6 +69,7 @@ void StackDump(void (*callback)(const char*)) DWORD myeip,myesp,myebp; +#if defined(_MSC_VER) _asm { MYEIP1: @@ -79,6 +80,20 @@ _asm mov eax, ebp mov dword ptr [myebp] , eax } +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + // GCC/Clang inline assembly for x86-32 + __asm__ __volatile__( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%esp, %1\n\t" + "mov %%ebp, %2" + : "=r"(myeip), "=r"(myesp), "=r"(myebp) + : + : "memory" + ); +#else + #error "Unsupported compiler or architecture for register capture" +#endif MakeStackTrace(myeip,myesp,myebp, 2, callback); @@ -314,6 +329,7 @@ void FillStackAddresses(void**addresses, unsigned int count, unsigned int skip) gsContext.ContextFlags = CONTEXT_FULL; DWORD myeip,myesp,myebp; +#if defined(_MSC_VER) _asm { MYEIP2: @@ -325,6 +341,21 @@ _asm mov dword ptr [myebp] , eax xor eax,eax } +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(_M_IX86)) + // GCC/Clang inline assembly for x86-32 + __asm__ __volatile__( + "call 1f\n\t" + "1: pop %0\n\t" + "mov %%esp, %1\n\t" + "mov %%ebp, %2\n\t" + "xor %%eax, %%eax" + : "=r"(myeip), "=r"(myesp), "=r"(myebp) + : + : "eax", "memory" + ); +#else + #error "Unsupported compiler or architecture for register capture" +#endif memset(&stack_frame, 0, sizeof(STACKFRAME)); stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrPC.Offset = myeip; From f8fd4a529f80b3a4db35d8ac9c07c6c4880e1e38 Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:31:55 +0000 Subject: [PATCH 093/211] fix(casts): Add explicit void* casts for function pointers (#2067) Add explicit void* casts to function pointers in function tables and callback registrations to resolve MinGW-w64 type-punning warnings. Changes: 1. FunctionLexicon.cpp: - Cast all GameWindow callback functions to (void*) in: * gameWinDrawTable * gameWinSystemTable * gameWinInputTable * gameWinHelpBoxTable * gameWinTooltipTable 2. W3DFunctionLexicon.cpp: - Cast all W3D callback functions to (void*) in lexicon tables 3. SkirmishGameOptionsMenu.cpp: - Cast aiPlayerControlCallback to (void*) in window registrations MinGW-w64 requires explicit casts when storing function pointers with different signatures in void* fields, as the compiler is stricter about type safety than MSVC in this context. These casts are safe because the functions are later cast back to their correct types before invocation. Files modified: - FunctionLexicon.cpp (both games) - W3DFunctionLexicon.cpp (both games) - SkirmishGameOptionsMenu.cpp (both games) --- .../Source/Common/System/FunctionLexicon.cpp | 508 ++++++++--------- .../Menus/SkirmishGameOptionsMenu.cpp | 2 +- .../Common/System/W3DFunctionLexicon.cpp | 110 ++-- .../Source/Common/System/FunctionLexicon.cpp | 520 +++++++++--------- .../Menus/SkirmishGameOptionsMenu.cpp | 2 +- .../Common/System/W3DFunctionLexicon.cpp | 110 ++-- 6 files changed, 626 insertions(+), 626 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index c33fd2f3c0f..1f731946137 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -63,9 +63,9 @@ extern WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, Unsign // game window draw table ----------------------------------------------------------------------- static FunctionLexicon::TableEntry gameWinDrawTable[] = { - { NAMEKEY_INVALID, "IMECandidateMainDraw", IMECandidateMainDraw }, - { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", IMECandidateTextAreaDraw }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "IMECandidateMainDraw", (void*)IMECandidateMainDraw }, + { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", (void*)IMECandidateTextAreaDraw }, + { NAMEKEY_INVALID, nullptr, nullptr } }; // game window system table ----------------------------------------------------------------------- @@ -73,82 +73,82 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = { - { NAMEKEY_INVALID, "PassSelectedButtonsToParentSystem", PassSelectedButtonsToParentSystem }, - { NAMEKEY_INVALID, "PassMessagesToParentSystem", PassMessagesToParentSystem }, - - { NAMEKEY_INVALID, "GameWinDefaultSystem", GameWinDefaultSystem }, - { NAMEKEY_INVALID, "GadgetPushButtonSystem", GadgetPushButtonSystem }, - { NAMEKEY_INVALID, "GadgetCheckBoxSystem", GadgetCheckBoxSystem }, - { NAMEKEY_INVALID, "GadgetRadioButtonSystem", GadgetRadioButtonSystem }, - { NAMEKEY_INVALID, "GadgetTabControlSystem", GadgetTabControlSystem }, - { NAMEKEY_INVALID, "GadgetListBoxSystem", GadgetListBoxSystem }, - { NAMEKEY_INVALID, "GadgetComboBoxSystem", GadgetComboBoxSystem }, - { NAMEKEY_INVALID, "GadgetHorizontalSliderSystem", GadgetHorizontalSliderSystem }, - { NAMEKEY_INVALID, "GadgetVerticalSliderSystem", GadgetVerticalSliderSystem }, - { NAMEKEY_INVALID, "GadgetProgressBarSystem", GadgetProgressBarSystem }, - { NAMEKEY_INVALID, "GadgetStaticTextSystem", GadgetStaticTextSystem }, - { NAMEKEY_INVALID, "GadgetTextEntrySystem", GadgetTextEntrySystem }, - { NAMEKEY_INVALID, "MessageBoxSystem", MessageBoxSystem }, - { NAMEKEY_INVALID, "QuitMessageBoxSystem", QuitMessageBoxSystem }, - - { NAMEKEY_INVALID, "ExtendedMessageBoxSystem", ExtendedMessageBoxSystem }, - - { NAMEKEY_INVALID, "MOTDSystem", MOTDSystem }, - { NAMEKEY_INVALID, "MainMenuSystem", MainMenuSystem }, - { NAMEKEY_INVALID, "OptionsMenuSystem", OptionsMenuSystem }, - { NAMEKEY_INVALID, "SinglePlayerMenuSystem", SinglePlayerMenuSystem }, - { NAMEKEY_INVALID, "QuitMenuSystem", QuitMenuSystem }, - { NAMEKEY_INVALID, "MapSelectMenuSystem", MapSelectMenuSystem }, - { NAMEKEY_INVALID, "ReplayMenuSystem", ReplayMenuSystem }, - { NAMEKEY_INVALID, "CreditsMenuSystem", CreditsMenuSystem }, - { NAMEKEY_INVALID, "LanLobbyMenuSystem", LanLobbyMenuSystem }, - { NAMEKEY_INVALID, "LanGameOptionsMenuSystem", LanGameOptionsMenuSystem }, - { NAMEKEY_INVALID, "LanMapSelectMenuSystem", LanMapSelectMenuSystem }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuSystem", SkirmishGameOptionsMenuSystem }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuSystem", SkirmishMapSelectMenuSystem }, - { NAMEKEY_INVALID, "SaveLoadMenuSystem", SaveLoadMenuSystem }, - { NAMEKEY_INVALID, "PopupCommunicatorSystem", PopupCommunicatorSystem }, - { NAMEKEY_INVALID, "PopupBuddyNotificationSystem", PopupBuddyNotificationSystem }, - { NAMEKEY_INVALID, "PopupReplaySystem", PopupReplaySystem }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuSystem", KeyboardOptionsMenuSystem }, - { NAMEKEY_INVALID, "WOLLadderScreenSystem", WOLLadderScreenSystem }, - { NAMEKEY_INVALID, "WOLLoginMenuSystem", WOLLoginMenuSystem }, - { NAMEKEY_INVALID, "WOLLocaleSelectSystem", WOLLocaleSelectSystem }, - { NAMEKEY_INVALID, "WOLLobbyMenuSystem", WOLLobbyMenuSystem }, - { NAMEKEY_INVALID, "WOLGameSetupMenuSystem", WOLGameSetupMenuSystem }, - { NAMEKEY_INVALID, "WOLMapSelectMenuSystem", WOLMapSelectMenuSystem }, - { NAMEKEY_INVALID, "WOLBuddyOverlaySystem", WOLBuddyOverlaySystem }, - { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuSystem", WOLBuddyOverlayRCMenuSystem }, - { NAMEKEY_INVALID, "RCGameDetailsMenuSystem", RCGameDetailsMenuSystem }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlaySystem",GameSpyPlayerInfoOverlaySystem }, - { NAMEKEY_INVALID, "WOLMessageWindowSystem", WOLMessageWindowSystem }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuSystem", WOLQuickMatchMenuSystem }, - { NAMEKEY_INVALID, "WOLWelcomeMenuSystem", WOLWelcomeMenuSystem }, - { NAMEKEY_INVALID, "WOLStatusMenuSystem", WOLStatusMenuSystem }, - { NAMEKEY_INVALID, "WOLQMScoreScreenSystem", WOLQMScoreScreenSystem }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenSystem", WOLCustomScoreScreenSystem }, - { NAMEKEY_INVALID, "NetworkDirectConnectSystem", NetworkDirectConnectSystem }, - { NAMEKEY_INVALID, "PopupHostGameSystem", PopupHostGameSystem }, - { NAMEKEY_INVALID, "PopupJoinGameSystem", PopupJoinGameSystem }, - { NAMEKEY_INVALID, "PopupLadderSelectSystem", PopupLadderSelectSystem }, - { NAMEKEY_INVALID, "InGamePopupMessageSystem", InGamePopupMessageSystem }, - { NAMEKEY_INVALID, "ControlBarSystem", ControlBarSystem }, - { NAMEKEY_INVALID, "ControlBarObserverSystem", ControlBarObserverSystem }, - { NAMEKEY_INVALID, "IMECandidateWindowSystem", IMECandidateWindowSystem }, - { NAMEKEY_INVALID, "ReplayControlSystem", ReplayControlSystem }, - { NAMEKEY_INVALID, "InGameChatSystem", InGameChatSystem }, - { NAMEKEY_INVALID, "DisconnectControlSystem", DisconnectControlSystem }, - { NAMEKEY_INVALID, "DiplomacySystem", DiplomacySystem }, - { NAMEKEY_INVALID, "GeneralsExpPointsSystem", GeneralsExpPointsSystem }, - { NAMEKEY_INVALID, "DifficultySelectSystem", DifficultySelectSystem }, - - { NAMEKEY_INVALID, "IdleWorkerSystem", IdleWorkerSystem }, - { NAMEKEY_INVALID, "EstablishConnectionsControlSystem", EstablishConnectionsControlSystem }, - { NAMEKEY_INVALID, "GameInfoWindowSystem", GameInfoWindowSystem }, - { NAMEKEY_INVALID, "ScoreScreenSystem", ScoreScreenSystem }, - { NAMEKEY_INVALID, "DownloadMenuSystem", DownloadMenuSystem }, - - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "PassSelectedButtonsToParentSystem", (void*)PassSelectedButtonsToParentSystem }, + { NAMEKEY_INVALID, "PassMessagesToParentSystem", (void*)PassMessagesToParentSystem }, + + { NAMEKEY_INVALID, "GameWinDefaultSystem", (void*)GameWinDefaultSystem }, + { NAMEKEY_INVALID, "GadgetPushButtonSystem", (void*)GadgetPushButtonSystem }, + { NAMEKEY_INVALID, "GadgetCheckBoxSystem", (void*)GadgetCheckBoxSystem }, + { NAMEKEY_INVALID, "GadgetRadioButtonSystem", (void*)GadgetRadioButtonSystem }, + { NAMEKEY_INVALID, "GadgetTabControlSystem", (void*)GadgetTabControlSystem }, + { NAMEKEY_INVALID, "GadgetListBoxSystem", (void*)GadgetListBoxSystem }, + { NAMEKEY_INVALID, "GadgetComboBoxSystem", (void*)GadgetComboBoxSystem }, + { NAMEKEY_INVALID, "GadgetHorizontalSliderSystem", (void*)GadgetHorizontalSliderSystem }, + { NAMEKEY_INVALID, "GadgetVerticalSliderSystem", (void*)GadgetVerticalSliderSystem }, + { NAMEKEY_INVALID, "GadgetProgressBarSystem", (void*)GadgetProgressBarSystem }, + { NAMEKEY_INVALID, "GadgetStaticTextSystem", (void*)GadgetStaticTextSystem }, + { NAMEKEY_INVALID, "GadgetTextEntrySystem", (void*)GadgetTextEntrySystem }, + { NAMEKEY_INVALID, "MessageBoxSystem", (void*)MessageBoxSystem }, + { NAMEKEY_INVALID, "QuitMessageBoxSystem", (void*)QuitMessageBoxSystem }, + + { NAMEKEY_INVALID, "ExtendedMessageBoxSystem", (void*)ExtendedMessageBoxSystem }, + + { NAMEKEY_INVALID, "MOTDSystem", (void*)MOTDSystem }, + { NAMEKEY_INVALID, "MainMenuSystem", (void*)MainMenuSystem }, + { NAMEKEY_INVALID, "OptionsMenuSystem", (void*)OptionsMenuSystem }, + { NAMEKEY_INVALID, "SinglePlayerMenuSystem", (void*)SinglePlayerMenuSystem }, + { NAMEKEY_INVALID, "QuitMenuSystem", (void*)QuitMenuSystem }, + { NAMEKEY_INVALID, "MapSelectMenuSystem", (void*)MapSelectMenuSystem }, + { NAMEKEY_INVALID, "ReplayMenuSystem", (void*)ReplayMenuSystem }, + { NAMEKEY_INVALID, "CreditsMenuSystem", (void*)CreditsMenuSystem }, + { NAMEKEY_INVALID, "LanLobbyMenuSystem", (void*)LanLobbyMenuSystem }, + { NAMEKEY_INVALID, "LanGameOptionsMenuSystem", (void*)LanGameOptionsMenuSystem }, + { NAMEKEY_INVALID, "LanMapSelectMenuSystem", (void*)LanMapSelectMenuSystem }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuSystem", (void*)SkirmishGameOptionsMenuSystem }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuSystem", (void*)SkirmishMapSelectMenuSystem }, + { NAMEKEY_INVALID, "SaveLoadMenuSystem", (void*)SaveLoadMenuSystem }, + { NAMEKEY_INVALID, "PopupCommunicatorSystem", (void*)PopupCommunicatorSystem }, + { NAMEKEY_INVALID, "PopupBuddyNotificationSystem", (void*)PopupBuddyNotificationSystem }, + { NAMEKEY_INVALID, "PopupReplaySystem", (void*)PopupReplaySystem }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuSystem", (void*)KeyboardOptionsMenuSystem }, + { NAMEKEY_INVALID, "WOLLadderScreenSystem", (void*)WOLLadderScreenSystem }, + { NAMEKEY_INVALID, "WOLLoginMenuSystem", (void*)WOLLoginMenuSystem }, + { NAMEKEY_INVALID, "WOLLocaleSelectSystem", (void*)WOLLocaleSelectSystem }, + { NAMEKEY_INVALID, "WOLLobbyMenuSystem", (void*)WOLLobbyMenuSystem }, + { NAMEKEY_INVALID, "WOLGameSetupMenuSystem", (void*)WOLGameSetupMenuSystem }, + { NAMEKEY_INVALID, "WOLMapSelectMenuSystem", (void*)WOLMapSelectMenuSystem }, + { NAMEKEY_INVALID, "WOLBuddyOverlaySystem", (void*)WOLBuddyOverlaySystem }, + { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuSystem", (void*)WOLBuddyOverlayRCMenuSystem }, + { NAMEKEY_INVALID, "RCGameDetailsMenuSystem", (void*)RCGameDetailsMenuSystem }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlaySystem", (void*)GameSpyPlayerInfoOverlaySystem }, + { NAMEKEY_INVALID, "WOLMessageWindowSystem", (void*)WOLMessageWindowSystem }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuSystem", (void*)WOLQuickMatchMenuSystem }, + { NAMEKEY_INVALID, "WOLWelcomeMenuSystem", (void*)WOLWelcomeMenuSystem }, + { NAMEKEY_INVALID, "WOLStatusMenuSystem", (void*)WOLStatusMenuSystem }, + { NAMEKEY_INVALID, "WOLQMScoreScreenSystem", (void*)WOLQMScoreScreenSystem }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenSystem", (void*)WOLCustomScoreScreenSystem }, + { NAMEKEY_INVALID, "NetworkDirectConnectSystem", (void*)NetworkDirectConnectSystem }, + { NAMEKEY_INVALID, "PopupHostGameSystem", (void*)PopupHostGameSystem }, + { NAMEKEY_INVALID, "PopupJoinGameSystem", (void*)PopupJoinGameSystem }, + { NAMEKEY_INVALID, "PopupLadderSelectSystem", (void*)PopupLadderSelectSystem }, + { NAMEKEY_INVALID, "InGamePopupMessageSystem", (void*)InGamePopupMessageSystem }, + { NAMEKEY_INVALID, "ControlBarSystem", (void*)ControlBarSystem }, + { NAMEKEY_INVALID, "ControlBarObserverSystem", (void*)ControlBarObserverSystem }, + { NAMEKEY_INVALID, "IMECandidateWindowSystem", (void*)IMECandidateWindowSystem }, + { NAMEKEY_INVALID, "ReplayControlSystem", (void*)ReplayControlSystem }, + { NAMEKEY_INVALID, "InGameChatSystem", (void*)InGameChatSystem }, + { NAMEKEY_INVALID, "DisconnectControlSystem", (void*)DisconnectControlSystem }, + { NAMEKEY_INVALID, "DiplomacySystem", (void*)DiplomacySystem }, + { NAMEKEY_INVALID, "GeneralsExpPointsSystem", (void*)GeneralsExpPointsSystem }, + { NAMEKEY_INVALID, "DifficultySelectSystem", (void*)DifficultySelectSystem }, + + { NAMEKEY_INVALID, "IdleWorkerSystem", (void*)IdleWorkerSystem }, + { NAMEKEY_INVALID, "EstablishConnectionsControlSystem", (void*)EstablishConnectionsControlSystem }, + { NAMEKEY_INVALID, "GameInfoWindowSystem", (void*)GameInfoWindowSystem }, + { NAMEKEY_INVALID, "ScoreScreenSystem", (void*)ScoreScreenSystem }, + { NAMEKEY_INVALID, "DownloadMenuSystem", (void*)DownloadMenuSystem }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -156,70 +156,70 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = static FunctionLexicon::TableEntry gameWinInputTable[] = { - { NAMEKEY_INVALID, "GameWinDefaultInput", GameWinDefaultInput }, - { NAMEKEY_INVALID, "GameWinBlockInput", GameWinBlockInput }, - { NAMEKEY_INVALID, "GadgetPushButtonInput", GadgetPushButtonInput }, - { NAMEKEY_INVALID, "GadgetCheckBoxInput", GadgetCheckBoxInput }, - { NAMEKEY_INVALID, "GadgetRadioButtonInput", GadgetRadioButtonInput }, - { NAMEKEY_INVALID, "GadgetTabControlInput", GadgetTabControlInput }, - { NAMEKEY_INVALID, "GadgetListBoxInput", GadgetListBoxInput }, - { NAMEKEY_INVALID, "GadgetListBoxMultiInput", GadgetListBoxMultiInput }, - { NAMEKEY_INVALID, "GadgetComboBoxInput", GadgetComboBoxInput }, - { NAMEKEY_INVALID, "GadgetHorizontalSliderInput", GadgetHorizontalSliderInput }, - { NAMEKEY_INVALID, "GadgetVerticalSliderInput", GadgetVerticalSliderInput }, - { NAMEKEY_INVALID, "GadgetStaticTextInput", GadgetStaticTextInput }, - { NAMEKEY_INVALID, "GadgetTextEntryInput", GadgetTextEntryInput }, - - { NAMEKEY_INVALID, "MainMenuInput", MainMenuInput }, - { NAMEKEY_INVALID, "MapSelectMenuInput", MapSelectMenuInput }, - { NAMEKEY_INVALID, "OptionsMenuInput", OptionsMenuInput }, - { NAMEKEY_INVALID, "SinglePlayerMenuInput", SinglePlayerMenuInput }, - { NAMEKEY_INVALID, "LanLobbyMenuInput", LanLobbyMenuInput }, - { NAMEKEY_INVALID, "ReplayMenuInput", ReplayMenuInput }, - { NAMEKEY_INVALID, "CreditsMenuInput", CreditsMenuInput }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuInput", KeyboardOptionsMenuInput }, - { NAMEKEY_INVALID, "PopupCommunicatorInput", PopupCommunicatorInput }, - { NAMEKEY_INVALID, "LanGameOptionsMenuInput", LanGameOptionsMenuInput }, - { NAMEKEY_INVALID, "LanMapSelectMenuInput", LanMapSelectMenuInput }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInput", SkirmishGameOptionsMenuInput }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuInput", SkirmishMapSelectMenuInput }, - { NAMEKEY_INVALID, "WOLLadderScreenInput", WOLLadderScreenInput }, - { NAMEKEY_INVALID, "WOLLoginMenuInput", WOLLoginMenuInput }, - { NAMEKEY_INVALID, "WOLLocaleSelectInput", WOLLocaleSelectInput }, - { NAMEKEY_INVALID, "WOLLobbyMenuInput", WOLLobbyMenuInput }, - { NAMEKEY_INVALID, "WOLGameSetupMenuInput", WOLGameSetupMenuInput }, - { NAMEKEY_INVALID, "WOLMapSelectMenuInput", WOLMapSelectMenuInput }, - { NAMEKEY_INVALID, "WOLBuddyOverlayInput", WOLBuddyOverlayInput }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInput", GameSpyPlayerInfoOverlayInput }, - { NAMEKEY_INVALID, "WOLMessageWindowInput", WOLMessageWindowInput }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuInput", WOLQuickMatchMenuInput }, - { NAMEKEY_INVALID, "WOLWelcomeMenuInput", WOLWelcomeMenuInput }, - { NAMEKEY_INVALID, "WOLStatusMenuInput", WOLStatusMenuInput }, - { NAMEKEY_INVALID, "WOLQMScoreScreenInput", WOLQMScoreScreenInput }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenInput", WOLCustomScoreScreenInput }, - { NAMEKEY_INVALID, "NetworkDirectConnectInput", NetworkDirectConnectInput }, - { NAMEKEY_INVALID, "PopupHostGameInput", PopupHostGameInput }, - { NAMEKEY_INVALID, "PopupJoinGameInput", PopupJoinGameInput }, - { NAMEKEY_INVALID, "PopupLadderSelectInput", PopupLadderSelectInput }, - { NAMEKEY_INVALID, "InGamePopupMessageInput", InGamePopupMessageInput }, - { NAMEKEY_INVALID, "ControlBarInput", ControlBarInput }, - { NAMEKEY_INVALID, "ReplayControlInput", ReplayControlInput }, - { NAMEKEY_INVALID, "InGameChatInput", InGameChatInput }, - { NAMEKEY_INVALID, "DisconnectControlInput", DisconnectControlInput }, - { NAMEKEY_INVALID, "DiplomacyInput", DiplomacyInput }, - { NAMEKEY_INVALID, "EstablishConnectionsControlInput", EstablishConnectionsControlInput }, - { NAMEKEY_INVALID, "LeftHUDInput", LeftHUDInput }, - { NAMEKEY_INVALID, "ScoreScreenInput", ScoreScreenInput }, - { NAMEKEY_INVALID, "SaveLoadMenuInput", SaveLoadMenuInput }, - { NAMEKEY_INVALID, "BeaconWindowInput", BeaconWindowInput }, - { NAMEKEY_INVALID, "DifficultySelectInput", DifficultySelectInput }, - { NAMEKEY_INVALID, "PopupReplayInput", PopupReplayInput }, - { NAMEKEY_INVALID, "GeneralsExpPointsInput", GeneralsExpPointsInput}, - - { NAMEKEY_INVALID, "DownloadMenuInput", DownloadMenuInput }, - - { NAMEKEY_INVALID, "IMECandidateWindowInput", IMECandidateWindowInput }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "GameWinDefaultInput", (void*)GameWinDefaultInput }, + { NAMEKEY_INVALID, "GameWinBlockInput", (void*)GameWinBlockInput }, + { NAMEKEY_INVALID, "GadgetPushButtonInput", (void*)GadgetPushButtonInput }, + { NAMEKEY_INVALID, "GadgetCheckBoxInput", (void*)GadgetCheckBoxInput }, + { NAMEKEY_INVALID, "GadgetRadioButtonInput", (void*)GadgetRadioButtonInput }, + { NAMEKEY_INVALID, "GadgetTabControlInput", (void*)GadgetTabControlInput }, + { NAMEKEY_INVALID, "GadgetListBoxInput", (void*)GadgetListBoxInput }, + { NAMEKEY_INVALID, "GadgetListBoxMultiInput", (void*)GadgetListBoxMultiInput }, + { NAMEKEY_INVALID, "GadgetComboBoxInput", (void*)GadgetComboBoxInput }, + { NAMEKEY_INVALID, "GadgetHorizontalSliderInput", (void*)GadgetHorizontalSliderInput }, + { NAMEKEY_INVALID, "GadgetVerticalSliderInput", (void*)GadgetVerticalSliderInput }, + { NAMEKEY_INVALID, "GadgetStaticTextInput", (void*)GadgetStaticTextInput }, + { NAMEKEY_INVALID, "GadgetTextEntryInput", (void*)GadgetTextEntryInput }, + + { NAMEKEY_INVALID, "MainMenuInput", (void*)MainMenuInput }, + { NAMEKEY_INVALID, "MapSelectMenuInput", (void*)MapSelectMenuInput }, + { NAMEKEY_INVALID, "OptionsMenuInput", (void*)OptionsMenuInput }, + { NAMEKEY_INVALID, "SinglePlayerMenuInput", (void*)SinglePlayerMenuInput }, + { NAMEKEY_INVALID, "LanLobbyMenuInput", (void*)LanLobbyMenuInput }, + { NAMEKEY_INVALID, "ReplayMenuInput", (void*)ReplayMenuInput }, + { NAMEKEY_INVALID, "CreditsMenuInput", (void*)CreditsMenuInput }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuInput", (void*)KeyboardOptionsMenuInput }, + { NAMEKEY_INVALID, "PopupCommunicatorInput", (void*)PopupCommunicatorInput }, + { NAMEKEY_INVALID, "LanGameOptionsMenuInput", (void*)LanGameOptionsMenuInput }, + { NAMEKEY_INVALID, "LanMapSelectMenuInput", (void*)LanMapSelectMenuInput }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInput", (void*)SkirmishGameOptionsMenuInput }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuInput", (void*)SkirmishMapSelectMenuInput }, + { NAMEKEY_INVALID, "WOLLadderScreenInput", (void*)WOLLadderScreenInput }, + { NAMEKEY_INVALID, "WOLLoginMenuInput", (void*)WOLLoginMenuInput }, + { NAMEKEY_INVALID, "WOLLocaleSelectInput", (void*)WOLLocaleSelectInput }, + { NAMEKEY_INVALID, "WOLLobbyMenuInput", (void*)WOLLobbyMenuInput }, + { NAMEKEY_INVALID, "WOLGameSetupMenuInput", (void*)WOLGameSetupMenuInput }, + { NAMEKEY_INVALID, "WOLMapSelectMenuInput", (void*)WOLMapSelectMenuInput }, + { NAMEKEY_INVALID, "WOLBuddyOverlayInput", (void*)WOLBuddyOverlayInput }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInput", (void*)GameSpyPlayerInfoOverlayInput }, + { NAMEKEY_INVALID, "WOLMessageWindowInput", (void*)WOLMessageWindowInput }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuInput", (void*)WOLQuickMatchMenuInput }, + { NAMEKEY_INVALID, "WOLWelcomeMenuInput", (void*)WOLWelcomeMenuInput }, + { NAMEKEY_INVALID, "WOLStatusMenuInput", (void*)WOLStatusMenuInput }, + { NAMEKEY_INVALID, "WOLQMScoreScreenInput", (void*)WOLQMScoreScreenInput }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenInput", (void*)WOLCustomScoreScreenInput }, + { NAMEKEY_INVALID, "NetworkDirectConnectInput", (void*)NetworkDirectConnectInput }, + { NAMEKEY_INVALID, "PopupHostGameInput", (void*)PopupHostGameInput }, + { NAMEKEY_INVALID, "PopupJoinGameInput", (void*)PopupJoinGameInput }, + { NAMEKEY_INVALID, "PopupLadderSelectInput", (void*)PopupLadderSelectInput }, + { NAMEKEY_INVALID, "InGamePopupMessageInput", (void*)InGamePopupMessageInput }, + { NAMEKEY_INVALID, "ControlBarInput", (void*)ControlBarInput }, + { NAMEKEY_INVALID, "ReplayControlInput", (void*)ReplayControlInput }, + { NAMEKEY_INVALID, "InGameChatInput", (void*)InGameChatInput }, + { NAMEKEY_INVALID, "DisconnectControlInput", (void*)DisconnectControlInput }, + { NAMEKEY_INVALID, "DiplomacyInput", (void*)DiplomacyInput }, + { NAMEKEY_INVALID, "EstablishConnectionsControlInput", (void*)EstablishConnectionsControlInput }, + { NAMEKEY_INVALID, "LeftHUDInput", (void*)LeftHUDInput }, + { NAMEKEY_INVALID, "ScoreScreenInput", (void*)ScoreScreenInput }, + { NAMEKEY_INVALID, "SaveLoadMenuInput", (void*)SaveLoadMenuInput }, + { NAMEKEY_INVALID, "BeaconWindowInput", (void*)BeaconWindowInput }, + { NAMEKEY_INVALID, "DifficultySelectInput", (void*)DifficultySelectInput }, + { NAMEKEY_INVALID, "PopupReplayInput", (void*)PopupReplayInput }, + { NAMEKEY_INVALID, "GeneralsExpPointsInput", (void*)GeneralsExpPointsInput }, + + { NAMEKEY_INVALID, "DownloadMenuInput", (void*)DownloadMenuInput }, + + { NAMEKEY_INVALID, "IMECandidateWindowInput", (void*)IMECandidateWindowInput }, + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -228,9 +228,9 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = { - { NAMEKEY_INVALID, "GameWinDefaultTooltip", GameWinDefaultTooltip }, + { NAMEKEY_INVALID, "GameWinDefaultTooltip", (void*)GameWinDefaultTooltip }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -238,50 +238,50 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = static FunctionLexicon::TableEntry winLayoutInitTable[] = { - { NAMEKEY_INVALID, "MainMenuInit", MainMenuInit }, - { NAMEKEY_INVALID, "OptionsMenuInit", OptionsMenuInit }, - { NAMEKEY_INVALID, "SaveLoadMenuInit", SaveLoadMenuInit }, - { NAMEKEY_INVALID, "SaveLoadMenuFullScreenInit", SaveLoadMenuFullScreenInit }, - - { NAMEKEY_INVALID, "PopupCommunicatorInit", PopupCommunicatorInit }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuInit", KeyboardOptionsMenuInit }, - { NAMEKEY_INVALID, "SinglePlayerMenuInit", SinglePlayerMenuInit }, - { NAMEKEY_INVALID, "MapSelectMenuInit", MapSelectMenuInit }, - { NAMEKEY_INVALID, "LanLobbyMenuInit", LanLobbyMenuInit }, - { NAMEKEY_INVALID, "ReplayMenuInit", ReplayMenuInit }, - { NAMEKEY_INVALID, "CreditsMenuInit", CreditsMenuInit }, - { NAMEKEY_INVALID, "LanGameOptionsMenuInit", LanGameOptionsMenuInit }, - { NAMEKEY_INVALID, "LanMapSelectMenuInit", LanMapSelectMenuInit }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInit", SkirmishGameOptionsMenuInit }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuInit", SkirmishMapSelectMenuInit }, - { NAMEKEY_INVALID, "WOLLadderScreenInit", WOLLadderScreenInit }, - { NAMEKEY_INVALID, "WOLLoginMenuInit", WOLLoginMenuInit }, - { NAMEKEY_INVALID, "WOLLocaleSelectInit", WOLLocaleSelectInit }, - { NAMEKEY_INVALID, "WOLLobbyMenuInit", WOLLobbyMenuInit }, - { NAMEKEY_INVALID, "WOLGameSetupMenuInit", WOLGameSetupMenuInit }, - { NAMEKEY_INVALID, "WOLMapSelectMenuInit", WOLMapSelectMenuInit }, - { NAMEKEY_INVALID, "WOLBuddyOverlayInit", WOLBuddyOverlayInit }, - { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuInit", WOLBuddyOverlayRCMenuInit }, - { NAMEKEY_INVALID, "RCGameDetailsMenuInit", RCGameDetailsMenuInit }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInit", GameSpyPlayerInfoOverlayInit }, - { NAMEKEY_INVALID, "WOLMessageWindowInit", WOLMessageWindowInit }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuInit", WOLQuickMatchMenuInit }, - { NAMEKEY_INVALID, "WOLWelcomeMenuInit", WOLWelcomeMenuInit }, - { NAMEKEY_INVALID, "WOLStatusMenuInit", WOLStatusMenuInit }, - { NAMEKEY_INVALID, "WOLQMScoreScreenInit", WOLQMScoreScreenInit }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenInit", WOLCustomScoreScreenInit }, - { NAMEKEY_INVALID, "NetworkDirectConnectInit", NetworkDirectConnectInit }, - { NAMEKEY_INVALID, "PopupHostGameInit", PopupHostGameInit }, - { NAMEKEY_INVALID, "PopupJoinGameInit", PopupJoinGameInit }, - { NAMEKEY_INVALID, "PopupLadderSelectInit", PopupLadderSelectInit }, - { NAMEKEY_INVALID, "InGamePopupMessageInit", InGamePopupMessageInit }, - { NAMEKEY_INVALID, "GameInfoWindowInit", GameInfoWindowInit }, - { NAMEKEY_INVALID, "ScoreScreenInit", ScoreScreenInit }, - { NAMEKEY_INVALID, "DownloadMenuInit", DownloadMenuInit }, - { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, - { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuInit", (void*)MainMenuInit }, + { NAMEKEY_INVALID, "OptionsMenuInit", (void*)OptionsMenuInit }, + { NAMEKEY_INVALID, "SaveLoadMenuInit", (void*)SaveLoadMenuInit }, + { NAMEKEY_INVALID, "SaveLoadMenuFullScreenInit", (void*)SaveLoadMenuFullScreenInit }, + + { NAMEKEY_INVALID, "PopupCommunicatorInit", (void*)PopupCommunicatorInit }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuInit", (void*)KeyboardOptionsMenuInit }, + { NAMEKEY_INVALID, "SinglePlayerMenuInit", (void*)SinglePlayerMenuInit }, + { NAMEKEY_INVALID, "MapSelectMenuInit", (void*)MapSelectMenuInit }, + { NAMEKEY_INVALID, "LanLobbyMenuInit", (void*)LanLobbyMenuInit }, + { NAMEKEY_INVALID, "ReplayMenuInit", (void*)ReplayMenuInit }, + { NAMEKEY_INVALID, "CreditsMenuInit", (void*)CreditsMenuInit }, + { NAMEKEY_INVALID, "LanGameOptionsMenuInit", (void*)LanGameOptionsMenuInit }, + { NAMEKEY_INVALID, "LanMapSelectMenuInit", (void*)LanMapSelectMenuInit }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInit", (void*)SkirmishGameOptionsMenuInit }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuInit", (void*)SkirmishMapSelectMenuInit }, + { NAMEKEY_INVALID, "WOLLadderScreenInit", (void*)WOLLadderScreenInit }, + { NAMEKEY_INVALID, "WOLLoginMenuInit", (void*)WOLLoginMenuInit }, + { NAMEKEY_INVALID, "WOLLocaleSelectInit", (void*)WOLLocaleSelectInit }, + { NAMEKEY_INVALID, "WOLLobbyMenuInit", (void*)WOLLobbyMenuInit }, + { NAMEKEY_INVALID, "WOLGameSetupMenuInit", (void*)WOLGameSetupMenuInit }, + { NAMEKEY_INVALID, "WOLMapSelectMenuInit", (void*)WOLMapSelectMenuInit }, + { NAMEKEY_INVALID, "WOLBuddyOverlayInit", (void*)WOLBuddyOverlayInit }, + { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuInit", (void*)WOLBuddyOverlayRCMenuInit }, + { NAMEKEY_INVALID, "RCGameDetailsMenuInit", (void*)RCGameDetailsMenuInit }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInit", (void*)GameSpyPlayerInfoOverlayInit }, + { NAMEKEY_INVALID, "WOLMessageWindowInit", (void*)WOLMessageWindowInit }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuInit", (void*)WOLQuickMatchMenuInit }, + { NAMEKEY_INVALID, "WOLWelcomeMenuInit", (void*)WOLWelcomeMenuInit }, + { NAMEKEY_INVALID, "WOLStatusMenuInit", (void*)WOLStatusMenuInit }, + { NAMEKEY_INVALID, "WOLQMScoreScreenInit", (void*)WOLQMScoreScreenInit }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenInit", (void*)WOLCustomScoreScreenInit }, + { NAMEKEY_INVALID, "NetworkDirectConnectInit", (void*)NetworkDirectConnectInit }, + { NAMEKEY_INVALID, "PopupHostGameInit", (void*)PopupHostGameInit }, + { NAMEKEY_INVALID, "PopupJoinGameInit", (void*)PopupJoinGameInit }, + { NAMEKEY_INVALID, "PopupLadderSelectInit", (void*)PopupLadderSelectInit }, + { NAMEKEY_INVALID, "InGamePopupMessageInit", (void*)InGamePopupMessageInit }, + { NAMEKEY_INVALID, "GameInfoWindowInit", (void*)GameInfoWindowInit }, + { NAMEKEY_INVALID, "ScoreScreenInit", (void*)ScoreScreenInit }, + { NAMEKEY_INVALID, "DownloadMenuInit", (void*)DownloadMenuInit }, + { NAMEKEY_INVALID, "DifficultySelectInit", (void*)DifficultySelectInit }, + { NAMEKEY_INVALID, "PopupReplayInit", (void*)PopupReplayInit }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -289,38 +289,38 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { - { NAMEKEY_INVALID, "MainMenuUpdate", MainMenuUpdate }, - { NAMEKEY_INVALID, "OptionsMenuUpdate", OptionsMenuUpdate }, - { NAMEKEY_INVALID, "SinglePlayerMenuUpdate", SinglePlayerMenuUpdate }, - { NAMEKEY_INVALID, "MapSelectMenuUpdate", MapSelectMenuUpdate }, - { NAMEKEY_INVALID, "LanLobbyMenuUpdate", LanLobbyMenuUpdate }, - { NAMEKEY_INVALID, "ReplayMenuUpdate", ReplayMenuUpdate }, - { NAMEKEY_INVALID, "SaveLoadMenuUpdate", SaveLoadMenuUpdate }, - - { NAMEKEY_INVALID, "CreditsMenuUpdate", CreditsMenuUpdate }, - { NAMEKEY_INVALID, "LanGameOptionsMenuUpdate", LanGameOptionsMenuUpdate }, - { NAMEKEY_INVALID, "LanMapSelectMenuUpdate", LanMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuUpdate", SkirmishGameOptionsMenuUpdate }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuUpdate", SkirmishMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "WOLLadderScreenUpdate", WOLLadderScreenUpdate }, - { NAMEKEY_INVALID, "WOLLoginMenuUpdate", WOLLoginMenuUpdate }, - { NAMEKEY_INVALID, "WOLLocaleSelectUpdate", WOLLocaleSelectUpdate }, - { NAMEKEY_INVALID, "WOLLobbyMenuUpdate", WOLLobbyMenuUpdate }, - { NAMEKEY_INVALID, "WOLGameSetupMenuUpdate", WOLGameSetupMenuUpdate }, - { NAMEKEY_INVALID, "WOLMapSelectMenuUpdate", WOLMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "WOLBuddyOverlayUpdate", WOLBuddyOverlayUpdate }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayUpdate",GameSpyPlayerInfoOverlayUpdate }, - { NAMEKEY_INVALID, "WOLMessageWindowUpdate", WOLMessageWindowUpdate }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuUpdate", WOLQuickMatchMenuUpdate }, - { NAMEKEY_INVALID, "WOLWelcomeMenuUpdate", WOLWelcomeMenuUpdate }, - { NAMEKEY_INVALID, "WOLStatusMenuUpdate", WOLStatusMenuUpdate }, - { NAMEKEY_INVALID, "WOLQMScoreScreenUpdate", WOLQMScoreScreenUpdate }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenUpdate", WOLCustomScoreScreenUpdate }, - { NAMEKEY_INVALID, "NetworkDirectConnectUpdate", NetworkDirectConnectUpdate }, - { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, - { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, - { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuUpdate", (void*)MainMenuUpdate }, + { NAMEKEY_INVALID, "OptionsMenuUpdate", (void*)OptionsMenuUpdate }, + { NAMEKEY_INVALID, "SinglePlayerMenuUpdate", (void*)SinglePlayerMenuUpdate }, + { NAMEKEY_INVALID, "MapSelectMenuUpdate", (void*)MapSelectMenuUpdate }, + { NAMEKEY_INVALID, "LanLobbyMenuUpdate", (void*)LanLobbyMenuUpdate }, + { NAMEKEY_INVALID, "ReplayMenuUpdate", (void*)ReplayMenuUpdate }, + { NAMEKEY_INVALID, "SaveLoadMenuUpdate", (void*)SaveLoadMenuUpdate }, + + { NAMEKEY_INVALID, "CreditsMenuUpdate", (void*)CreditsMenuUpdate }, + { NAMEKEY_INVALID, "LanGameOptionsMenuUpdate", (void*)LanGameOptionsMenuUpdate }, + { NAMEKEY_INVALID, "LanMapSelectMenuUpdate", (void*)LanMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuUpdate", (void*)SkirmishGameOptionsMenuUpdate }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuUpdate", (void*)SkirmishMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "WOLLadderScreenUpdate", (void*)WOLLadderScreenUpdate }, + { NAMEKEY_INVALID, "WOLLoginMenuUpdate", (void*)WOLLoginMenuUpdate }, + { NAMEKEY_INVALID, "WOLLocaleSelectUpdate", (void*)WOLLocaleSelectUpdate }, + { NAMEKEY_INVALID, "WOLLobbyMenuUpdate", (void*)WOLLobbyMenuUpdate }, + { NAMEKEY_INVALID, "WOLGameSetupMenuUpdate", (void*)WOLGameSetupMenuUpdate }, + { NAMEKEY_INVALID, "WOLMapSelectMenuUpdate", (void*)WOLMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "WOLBuddyOverlayUpdate", (void*)WOLBuddyOverlayUpdate }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayUpdate", (void*)GameSpyPlayerInfoOverlayUpdate }, + { NAMEKEY_INVALID, "WOLMessageWindowUpdate", (void*)WOLMessageWindowUpdate }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuUpdate", (void*)WOLQuickMatchMenuUpdate }, + { NAMEKEY_INVALID, "WOLWelcomeMenuUpdate", (void*)WOLWelcomeMenuUpdate }, + { NAMEKEY_INVALID, "WOLStatusMenuUpdate", (void*)WOLStatusMenuUpdate }, + { NAMEKEY_INVALID, "WOLQMScoreScreenUpdate", (void*)WOLQMScoreScreenUpdate }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenUpdate", (void*)WOLCustomScoreScreenUpdate }, + { NAMEKEY_INVALID, "NetworkDirectConnectUpdate", (void*)NetworkDirectConnectUpdate }, + { NAMEKEY_INVALID, "ScoreScreenUpdate", (void*)ScoreScreenUpdate }, + { NAMEKEY_INVALID, "DownloadMenuUpdate", (void*)DownloadMenuUpdate }, + { NAMEKEY_INVALID, "PopupReplayUpdate", (void*)PopupReplayUpdate }, + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -328,39 +328,39 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { - { NAMEKEY_INVALID, "MainMenuShutdown", MainMenuShutdown }, - { NAMEKEY_INVALID, "OptionsMenuShutdown", OptionsMenuShutdown }, - { NAMEKEY_INVALID, "SaveLoadMenuShutdown", SaveLoadMenuShutdown }, - { NAMEKEY_INVALID, "PopupCommunicatorShutdown", PopupCommunicatorShutdown }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuShutdown", KeyboardOptionsMenuShutdown }, - { NAMEKEY_INVALID, "SinglePlayerMenuShutdown", SinglePlayerMenuShutdown }, - { NAMEKEY_INVALID, "MapSelectMenuShutdown", MapSelectMenuShutdown }, - { NAMEKEY_INVALID, "LanLobbyMenuShutdown", LanLobbyMenuShutdown }, - { NAMEKEY_INVALID, "ReplayMenuShutdown", ReplayMenuShutdown }, - { NAMEKEY_INVALID, "CreditsMenuShutdown", CreditsMenuShutdown }, - { NAMEKEY_INVALID, "LanGameOptionsMenuShutdown", LanGameOptionsMenuShutdown }, - { NAMEKEY_INVALID, "LanMapSelectMenuShutdown", LanMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuShutdown",SkirmishGameOptionsMenuShutdown }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuShutdown", SkirmishMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "WOLLadderScreenShutdown", WOLLadderScreenShutdown }, - { NAMEKEY_INVALID, "WOLLoginMenuShutdown", WOLLoginMenuShutdown }, - { NAMEKEY_INVALID, "WOLLocaleSelectShutdown", WOLLocaleSelectShutdown }, - { NAMEKEY_INVALID, "WOLLobbyMenuShutdown", WOLLobbyMenuShutdown }, - { NAMEKEY_INVALID, "WOLGameSetupMenuShutdown", WOLGameSetupMenuShutdown }, - { NAMEKEY_INVALID, "WOLMapSelectMenuShutdown", WOLMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "WOLBuddyOverlayShutdown", WOLBuddyOverlayShutdown }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayShutdown",GameSpyPlayerInfoOverlayShutdown }, - { NAMEKEY_INVALID, "WOLMessageWindowShutdown", WOLMessageWindowShutdown }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuShutdown", WOLQuickMatchMenuShutdown }, - { NAMEKEY_INVALID, "WOLWelcomeMenuShutdown", WOLWelcomeMenuShutdown }, - { NAMEKEY_INVALID, "WOLStatusMenuShutdown", WOLStatusMenuShutdown }, - { NAMEKEY_INVALID, "WOLQMScoreScreenShutdown", WOLQMScoreScreenShutdown }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenShutdown", WOLCustomScoreScreenShutdown }, - { NAMEKEY_INVALID, "NetworkDirectConnectShutdown", NetworkDirectConnectShutdown }, - { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, - { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, - { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuShutdown", (void*)MainMenuShutdown }, + { NAMEKEY_INVALID, "OptionsMenuShutdown", (void*)OptionsMenuShutdown }, + { NAMEKEY_INVALID, "SaveLoadMenuShutdown", (void*)SaveLoadMenuShutdown }, + { NAMEKEY_INVALID, "PopupCommunicatorShutdown", (void*)PopupCommunicatorShutdown }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuShutdown", (void*)KeyboardOptionsMenuShutdown }, + { NAMEKEY_INVALID, "SinglePlayerMenuShutdown", (void*)SinglePlayerMenuShutdown }, + { NAMEKEY_INVALID, "MapSelectMenuShutdown", (void*)MapSelectMenuShutdown }, + { NAMEKEY_INVALID, "LanLobbyMenuShutdown", (void*)LanLobbyMenuShutdown }, + { NAMEKEY_INVALID, "ReplayMenuShutdown", (void*)ReplayMenuShutdown }, + { NAMEKEY_INVALID, "CreditsMenuShutdown", (void*)CreditsMenuShutdown }, + { NAMEKEY_INVALID, "LanGameOptionsMenuShutdown", (void*)LanGameOptionsMenuShutdown }, + { NAMEKEY_INVALID, "LanMapSelectMenuShutdown", (void*)LanMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuShutdown", (void*)SkirmishGameOptionsMenuShutdown }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuShutdown", (void*)SkirmishMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "WOLLadderScreenShutdown", (void*)WOLLadderScreenShutdown }, + { NAMEKEY_INVALID, "WOLLoginMenuShutdown", (void*)WOLLoginMenuShutdown }, + { NAMEKEY_INVALID, "WOLLocaleSelectShutdown", (void*)WOLLocaleSelectShutdown }, + { NAMEKEY_INVALID, "WOLLobbyMenuShutdown", (void*)WOLLobbyMenuShutdown }, + { NAMEKEY_INVALID, "WOLGameSetupMenuShutdown", (void*)WOLGameSetupMenuShutdown }, + { NAMEKEY_INVALID, "WOLMapSelectMenuShutdown", (void*)WOLMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "WOLBuddyOverlayShutdown", (void*)WOLBuddyOverlayShutdown }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayShutdown", (void*)GameSpyPlayerInfoOverlayShutdown }, + { NAMEKEY_INVALID, "WOLMessageWindowShutdown", (void*)WOLMessageWindowShutdown }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuShutdown", (void*)WOLQuickMatchMenuShutdown }, + { NAMEKEY_INVALID, "WOLWelcomeMenuShutdown", (void*)WOLWelcomeMenuShutdown }, + { NAMEKEY_INVALID, "WOLStatusMenuShutdown", (void*)WOLStatusMenuShutdown }, + { NAMEKEY_INVALID, "WOLQMScoreScreenShutdown", (void*)WOLQMScoreScreenShutdown }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenShutdown", (void*)WOLCustomScoreScreenShutdown }, + { NAMEKEY_INVALID, "NetworkDirectConnectShutdown", (void*)NetworkDirectConnectShutdown }, + { NAMEKEY_INVALID, "ScoreScreenShutdown", (void*)ScoreScreenShutdown }, + { NAMEKEY_INVALID, "DownloadMenuShutdown", (void*)DownloadMenuShutdown }, + { NAMEKEY_INVALID, "PopupReplayShutdown", (void*)PopupReplayShutdown }, + { NAMEKEY_INVALID, nullptr, nullptr } }; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index c14bf51feab..3cda3f62dee 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -484,7 +484,7 @@ void CheckForCDAtGameStart( gameStartCallback callback ) { // popup a dialog asking for a CD ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - callback, checkCDCallback, cancelStartBecauseOfNoCD); + (void*)callback, checkCDCallback, cancelStartBecauseOfNoCD); } else { diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp index 2b330295514..f5504ae88cb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp @@ -43,59 +43,59 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = { - { NAMEKEY_INVALID, "GameWinDefaultDraw", GameWinDefaultDraw }, - { NAMEKEY_INVALID, "W3DGameWinDefaultDraw", W3DGameWinDefaultDraw }, - - { NAMEKEY_INVALID, "W3DGadgetPushButtonDraw", W3DGadgetPushButtonDraw }, - { NAMEKEY_INVALID, "W3DGadgetPushButtonImageDraw", W3DGadgetPushButtonImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetCheckBoxDraw", W3DGadgetCheckBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetCheckBoxImageDraw", W3DGadgetCheckBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetRadioButtonDraw", W3DGadgetRadioButtonDraw }, - { NAMEKEY_INVALID, "W3DGadgetRadioButtonImageDraw", W3DGadgetRadioButtonImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetTabControlDraw", W3DGadgetTabControlDraw }, - { NAMEKEY_INVALID, "W3DGadgetTabControlImageDraw", W3DGadgetTabControlImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetListBoxDraw", W3DGadgetListBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetListBoxImageDraw", W3DGadgetListBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetComboBoxDraw", W3DGadgetComboBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetComboBoxImageDraw", W3DGadgetComboBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderDraw", W3DGadgetHorizontalSliderDraw }, - { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderImageDraw", W3DGadgetHorizontalSliderImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetVerticalSliderDraw", W3DGadgetVerticalSliderDraw }, - { NAMEKEY_INVALID, "W3DGadgetVerticalSliderImageDraw", W3DGadgetVerticalSliderImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetProgressBarDraw", W3DGadgetProgressBarDraw }, - { NAMEKEY_INVALID, "W3DGadgetProgressBarImageDraw", W3DGadgetProgressBarImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetStaticTextDraw", W3DGadgetStaticTextDraw }, - { NAMEKEY_INVALID, "W3DGadgetStaticTextImageDraw", W3DGadgetStaticTextImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetTextEntryDraw", W3DGadgetTextEntryDraw }, - { NAMEKEY_INVALID, "W3DGadgetTextEntryImageDraw", W3DGadgetTextEntryImageDraw }, - - { NAMEKEY_INVALID, "W3DLeftHUDDraw", W3DLeftHUDDraw }, - { NAMEKEY_INVALID, "W3DCameoMovieDraw", W3DCameoMovieDraw }, - { NAMEKEY_INVALID, "W3DRightHUDDraw", W3DRightHUDDraw }, - { NAMEKEY_INVALID, "W3DPowerDraw", W3DPowerDraw }, - { NAMEKEY_INVALID, "W3DMainMenuDraw", W3DMainMenuDraw }, - { NAMEKEY_INVALID, "W3DMainMenuFourDraw", W3DMainMenuFourDraw }, - { NAMEKEY_INVALID, "W3DMetalBarMenuDraw", W3DMetalBarMenuDraw }, - { NAMEKEY_INVALID, "W3DCreditsMenuDraw", W3DCreditsMenuDraw }, - { NAMEKEY_INVALID, "W3DClockDraw", W3DClockDraw }, - { NAMEKEY_INVALID, "W3DMainMenuMapBorder", W3DMainMenuMapBorder }, - { NAMEKEY_INVALID, "W3DMainMenuButtonDropShadowDraw", W3DMainMenuButtonDropShadowDraw }, - { NAMEKEY_INVALID, "W3DMainMenuRandomTextDraw", W3DMainMenuRandomTextDraw }, - { NAMEKEY_INVALID, "W3DThinBorderDraw", W3DThinBorderDraw }, - { NAMEKEY_INVALID, "W3DShellMenuSchemeDraw", W3DShellMenuSchemeDraw }, - { NAMEKEY_INVALID, "W3DCommandBarBackgroundDraw", W3DCommandBarBackgroundDraw }, - { NAMEKEY_INVALID, "W3DCommandBarTopDraw", W3DCommandBarTopDraw }, - { NAMEKEY_INVALID, "W3DCommandBarGenExpDraw", W3DCommandBarGenExpDraw }, - { NAMEKEY_INVALID, "W3DCommandBarHelpPopupDraw", W3DCommandBarHelpPopupDraw }, - - { NAMEKEY_INVALID, "W3DCommandBarGridDraw", W3DCommandBarGridDraw }, - - - { NAMEKEY_INVALID, "W3DCommandBarForegroundDraw", W3DCommandBarForegroundDraw }, - { NAMEKEY_INVALID, "W3DNoDraw", W3DNoDraw }, - { NAMEKEY_INVALID, "W3DDrawMapPreview", W3DDrawMapPreview }, - - { NAMEKEY_INVALID, nullptr, nullptr }, + { NAMEKEY_INVALID, "GameWinDefaultDraw", (void*)GameWinDefaultDraw }, + { NAMEKEY_INVALID, "W3DGameWinDefaultDraw", (void*)W3DGameWinDefaultDraw }, + + { NAMEKEY_INVALID, "W3DGadgetPushButtonDraw", (void*)W3DGadgetPushButtonDraw }, + { NAMEKEY_INVALID, "W3DGadgetPushButtonImageDraw", (void*)W3DGadgetPushButtonImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetCheckBoxDraw", (void*)W3DGadgetCheckBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetCheckBoxImageDraw", (void*)W3DGadgetCheckBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetRadioButtonDraw", (void*)W3DGadgetRadioButtonDraw }, + { NAMEKEY_INVALID, "W3DGadgetRadioButtonImageDraw", (void*)W3DGadgetRadioButtonImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetTabControlDraw", (void*)W3DGadgetTabControlDraw }, + { NAMEKEY_INVALID, "W3DGadgetTabControlImageDraw", (void*)W3DGadgetTabControlImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetListBoxDraw", (void*)W3DGadgetListBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetListBoxImageDraw", (void*)W3DGadgetListBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetComboBoxDraw", (void*)W3DGadgetComboBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetComboBoxImageDraw", (void*)W3DGadgetComboBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderDraw", (void*)W3DGadgetHorizontalSliderDraw }, + { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderImageDraw", (void*)W3DGadgetHorizontalSliderImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetVerticalSliderDraw", (void*)W3DGadgetVerticalSliderDraw }, + { NAMEKEY_INVALID, "W3DGadgetVerticalSliderImageDraw", (void*)W3DGadgetVerticalSliderImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetProgressBarDraw", (void*)W3DGadgetProgressBarDraw }, + { NAMEKEY_INVALID, "W3DGadgetProgressBarImageDraw", (void*)W3DGadgetProgressBarImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetStaticTextDraw", (void*)W3DGadgetStaticTextDraw }, + { NAMEKEY_INVALID, "W3DGadgetStaticTextImageDraw", (void*)W3DGadgetStaticTextImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetTextEntryDraw", (void*)W3DGadgetTextEntryDraw }, + { NAMEKEY_INVALID, "W3DGadgetTextEntryImageDraw", (void*)W3DGadgetTextEntryImageDraw }, + + { NAMEKEY_INVALID, "W3DLeftHUDDraw", (void*)W3DLeftHUDDraw }, + { NAMEKEY_INVALID, "W3DCameoMovieDraw", (void*)W3DCameoMovieDraw }, + { NAMEKEY_INVALID, "W3DRightHUDDraw", (void*)W3DRightHUDDraw }, + { NAMEKEY_INVALID, "W3DPowerDraw", (void*)W3DPowerDraw }, + { NAMEKEY_INVALID, "W3DMainMenuDraw", (void*)W3DMainMenuDraw }, + { NAMEKEY_INVALID, "W3DMainMenuFourDraw", (void*)W3DMainMenuFourDraw }, + { NAMEKEY_INVALID, "W3DMetalBarMenuDraw", (void*)W3DMetalBarMenuDraw }, + { NAMEKEY_INVALID, "W3DCreditsMenuDraw", (void*)W3DCreditsMenuDraw }, + { NAMEKEY_INVALID, "W3DClockDraw", (void*)W3DClockDraw }, + { NAMEKEY_INVALID, "W3DMainMenuMapBorder", (void*)W3DMainMenuMapBorder }, + { NAMEKEY_INVALID, "W3DMainMenuButtonDropShadowDraw", (void*)W3DMainMenuButtonDropShadowDraw }, + { NAMEKEY_INVALID, "W3DMainMenuRandomTextDraw", (void*)W3DMainMenuRandomTextDraw }, + { NAMEKEY_INVALID, "W3DThinBorderDraw", (void*)W3DThinBorderDraw }, + { NAMEKEY_INVALID, "W3DShellMenuSchemeDraw", (void*)W3DShellMenuSchemeDraw }, + { NAMEKEY_INVALID, "W3DCommandBarBackgroundDraw", (void*)W3DCommandBarBackgroundDraw }, + { NAMEKEY_INVALID, "W3DCommandBarTopDraw", (void*)W3DCommandBarTopDraw }, + { NAMEKEY_INVALID, "W3DCommandBarGenExpDraw", (void*)W3DCommandBarGenExpDraw }, + { NAMEKEY_INVALID, "W3DCommandBarHelpPopupDraw", (void*)W3DCommandBarHelpPopupDraw }, + + { NAMEKEY_INVALID, "W3DCommandBarGridDraw", (void*)W3DCommandBarGridDraw }, + + + { NAMEKEY_INVALID, "W3DCommandBarForegroundDraw", (void*)W3DCommandBarForegroundDraw }, + { NAMEKEY_INVALID, "W3DNoDraw", (void*)W3DNoDraw }, + { NAMEKEY_INVALID, "W3DDrawMapPreview", (void*)W3DDrawMapPreview }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -103,9 +103,9 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = static FunctionLexicon::TableEntry layoutInitTable [] = { - { NAMEKEY_INVALID, "W3DMainMenuInit", W3DMainMenuInit }, + { NAMEKEY_INVALID, "W3DMainMenuInit", (void*)W3DMainMenuInit }, - { NAMEKEY_INVALID, nullptr, nullptr }, + { NAMEKEY_INVALID, nullptr, nullptr } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp index 7af6926ad85..9d926d4f47c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FunctionLexicon.cpp @@ -63,9 +63,9 @@ extern WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, Unsign // game window draw table ----------------------------------------------------------------------- static FunctionLexicon::TableEntry gameWinDrawTable[] = { - { NAMEKEY_INVALID, "IMECandidateMainDraw", IMECandidateMainDraw }, - { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", IMECandidateTextAreaDraw }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "IMECandidateMainDraw", (void*)IMECandidateMainDraw }, + { NAMEKEY_INVALID, "IMECandidateTextAreaDraw", (void*)IMECandidateTextAreaDraw }, + { NAMEKEY_INVALID, nullptr, nullptr } }; // game window system table ----------------------------------------------------------------------- @@ -73,83 +73,83 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = { - { NAMEKEY_INVALID, "PassSelectedButtonsToParentSystem", PassSelectedButtonsToParentSystem }, - { NAMEKEY_INVALID, "PassMessagesToParentSystem", PassMessagesToParentSystem }, - - { NAMEKEY_INVALID, "GameWinDefaultSystem", GameWinDefaultSystem }, - { NAMEKEY_INVALID, "GadgetPushButtonSystem", GadgetPushButtonSystem }, - { NAMEKEY_INVALID, "GadgetCheckBoxSystem", GadgetCheckBoxSystem }, - { NAMEKEY_INVALID, "GadgetRadioButtonSystem", GadgetRadioButtonSystem }, - { NAMEKEY_INVALID, "GadgetTabControlSystem", GadgetTabControlSystem }, - { NAMEKEY_INVALID, "GadgetListBoxSystem", GadgetListBoxSystem }, - { NAMEKEY_INVALID, "GadgetComboBoxSystem", GadgetComboBoxSystem }, - { NAMEKEY_INVALID, "GadgetHorizontalSliderSystem", GadgetHorizontalSliderSystem }, - { NAMEKEY_INVALID, "GadgetVerticalSliderSystem", GadgetVerticalSliderSystem }, - { NAMEKEY_INVALID, "GadgetProgressBarSystem", GadgetProgressBarSystem }, - { NAMEKEY_INVALID, "GadgetStaticTextSystem", GadgetStaticTextSystem }, - { NAMEKEY_INVALID, "GadgetTextEntrySystem", GadgetTextEntrySystem }, - { NAMEKEY_INVALID, "MessageBoxSystem", MessageBoxSystem }, - { NAMEKEY_INVALID, "QuitMessageBoxSystem", QuitMessageBoxSystem }, - - { NAMEKEY_INVALID, "ExtendedMessageBoxSystem", ExtendedMessageBoxSystem }, - - { NAMEKEY_INVALID, "MOTDSystem", MOTDSystem }, - { NAMEKEY_INVALID, "MainMenuSystem", MainMenuSystem }, - { NAMEKEY_INVALID, "OptionsMenuSystem", OptionsMenuSystem }, - { NAMEKEY_INVALID, "SinglePlayerMenuSystem", SinglePlayerMenuSystem }, - { NAMEKEY_INVALID, "QuitMenuSystem", QuitMenuSystem }, - { NAMEKEY_INVALID, "MapSelectMenuSystem", MapSelectMenuSystem }, - { NAMEKEY_INVALID, "ReplayMenuSystem", ReplayMenuSystem }, - { NAMEKEY_INVALID, "CreditsMenuSystem", CreditsMenuSystem }, - { NAMEKEY_INVALID, "LanLobbyMenuSystem", LanLobbyMenuSystem }, - { NAMEKEY_INVALID, "LanGameOptionsMenuSystem", LanGameOptionsMenuSystem }, - { NAMEKEY_INVALID, "LanMapSelectMenuSystem", LanMapSelectMenuSystem }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuSystem", SkirmishGameOptionsMenuSystem }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuSystem", SkirmishMapSelectMenuSystem }, - { NAMEKEY_INVALID, "ChallengeMenuSystem", ChallengeMenuSystem }, - { NAMEKEY_INVALID, "SaveLoadMenuSystem", SaveLoadMenuSystem }, - { NAMEKEY_INVALID, "PopupCommunicatorSystem", PopupCommunicatorSystem }, - { NAMEKEY_INVALID, "PopupBuddyNotificationSystem", PopupBuddyNotificationSystem }, - { NAMEKEY_INVALID, "PopupReplaySystem", PopupReplaySystem }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuSystem", KeyboardOptionsMenuSystem }, - { NAMEKEY_INVALID, "WOLLadderScreenSystem", WOLLadderScreenSystem }, - { NAMEKEY_INVALID, "WOLLoginMenuSystem", WOLLoginMenuSystem }, - { NAMEKEY_INVALID, "WOLLocaleSelectSystem", WOLLocaleSelectSystem }, - { NAMEKEY_INVALID, "WOLLobbyMenuSystem", WOLLobbyMenuSystem }, - { NAMEKEY_INVALID, "WOLGameSetupMenuSystem", WOLGameSetupMenuSystem }, - { NAMEKEY_INVALID, "WOLMapSelectMenuSystem", WOLMapSelectMenuSystem }, - { NAMEKEY_INVALID, "WOLBuddyOverlaySystem", WOLBuddyOverlaySystem }, - { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuSystem", WOLBuddyOverlayRCMenuSystem }, - { NAMEKEY_INVALID, "RCGameDetailsMenuSystem", RCGameDetailsMenuSystem }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlaySystem",GameSpyPlayerInfoOverlaySystem }, - { NAMEKEY_INVALID, "WOLMessageWindowSystem", WOLMessageWindowSystem }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuSystem", WOLQuickMatchMenuSystem }, - { NAMEKEY_INVALID, "WOLWelcomeMenuSystem", WOLWelcomeMenuSystem }, - { NAMEKEY_INVALID, "WOLStatusMenuSystem", WOLStatusMenuSystem }, - { NAMEKEY_INVALID, "WOLQMScoreScreenSystem", WOLQMScoreScreenSystem }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenSystem", WOLCustomScoreScreenSystem }, - { NAMEKEY_INVALID, "NetworkDirectConnectSystem", NetworkDirectConnectSystem }, - { NAMEKEY_INVALID, "PopupHostGameSystem", PopupHostGameSystem }, - { NAMEKEY_INVALID, "PopupJoinGameSystem", PopupJoinGameSystem }, - { NAMEKEY_INVALID, "PopupLadderSelectSystem", PopupLadderSelectSystem }, - { NAMEKEY_INVALID, "InGamePopupMessageSystem", InGamePopupMessageSystem }, - { NAMEKEY_INVALID, "ControlBarSystem", ControlBarSystem }, - { NAMEKEY_INVALID, "ControlBarObserverSystem", ControlBarObserverSystem }, - { NAMEKEY_INVALID, "IMECandidateWindowSystem", IMECandidateWindowSystem }, - { NAMEKEY_INVALID, "ReplayControlSystem", ReplayControlSystem }, - { NAMEKEY_INVALID, "InGameChatSystem", InGameChatSystem }, - { NAMEKEY_INVALID, "DisconnectControlSystem", DisconnectControlSystem }, - { NAMEKEY_INVALID, "DiplomacySystem", DiplomacySystem }, - { NAMEKEY_INVALID, "GeneralsExpPointsSystem", GeneralsExpPointsSystem }, - { NAMEKEY_INVALID, "DifficultySelectSystem", DifficultySelectSystem }, - - { NAMEKEY_INVALID, "IdleWorkerSystem", IdleWorkerSystem }, - { NAMEKEY_INVALID, "EstablishConnectionsControlSystem", EstablishConnectionsControlSystem }, - { NAMEKEY_INVALID, "GameInfoWindowSystem", GameInfoWindowSystem }, - { NAMEKEY_INVALID, "ScoreScreenSystem", ScoreScreenSystem }, - { NAMEKEY_INVALID, "DownloadMenuSystem", DownloadMenuSystem }, - - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "PassSelectedButtonsToParentSystem", (void*)PassSelectedButtonsToParentSystem }, + { NAMEKEY_INVALID, "PassMessagesToParentSystem", (void*)PassMessagesToParentSystem }, + + { NAMEKEY_INVALID, "GameWinDefaultSystem", (void*)GameWinDefaultSystem }, + { NAMEKEY_INVALID, "GadgetPushButtonSystem", (void*)GadgetPushButtonSystem }, + { NAMEKEY_INVALID, "GadgetCheckBoxSystem", (void*)GadgetCheckBoxSystem }, + { NAMEKEY_INVALID, "GadgetRadioButtonSystem", (void*)GadgetRadioButtonSystem }, + { NAMEKEY_INVALID, "GadgetTabControlSystem", (void*)GadgetTabControlSystem }, + { NAMEKEY_INVALID, "GadgetListBoxSystem", (void*)GadgetListBoxSystem }, + { NAMEKEY_INVALID, "GadgetComboBoxSystem", (void*)GadgetComboBoxSystem }, + { NAMEKEY_INVALID, "GadgetHorizontalSliderSystem", (void*)GadgetHorizontalSliderSystem }, + { NAMEKEY_INVALID, "GadgetVerticalSliderSystem", (void*)GadgetVerticalSliderSystem }, + { NAMEKEY_INVALID, "GadgetProgressBarSystem", (void*)GadgetProgressBarSystem }, + { NAMEKEY_INVALID, "GadgetStaticTextSystem", (void*)GadgetStaticTextSystem }, + { NAMEKEY_INVALID, "GadgetTextEntrySystem", (void*)GadgetTextEntrySystem }, + { NAMEKEY_INVALID, "MessageBoxSystem", (void*)MessageBoxSystem }, + { NAMEKEY_INVALID, "QuitMessageBoxSystem", (void*)QuitMessageBoxSystem }, + + { NAMEKEY_INVALID, "ExtendedMessageBoxSystem", (void*)ExtendedMessageBoxSystem }, + + { NAMEKEY_INVALID, "MOTDSystem", (void*)MOTDSystem }, + { NAMEKEY_INVALID, "MainMenuSystem", (void*)MainMenuSystem }, + { NAMEKEY_INVALID, "OptionsMenuSystem", (void*)OptionsMenuSystem }, + { NAMEKEY_INVALID, "SinglePlayerMenuSystem", (void*)SinglePlayerMenuSystem }, + { NAMEKEY_INVALID, "QuitMenuSystem", (void*)QuitMenuSystem }, + { NAMEKEY_INVALID, "MapSelectMenuSystem", (void*)MapSelectMenuSystem }, + { NAMEKEY_INVALID, "ReplayMenuSystem", (void*)ReplayMenuSystem }, + { NAMEKEY_INVALID, "CreditsMenuSystem", (void*)CreditsMenuSystem }, + { NAMEKEY_INVALID, "LanLobbyMenuSystem", (void*)LanLobbyMenuSystem }, + { NAMEKEY_INVALID, "LanGameOptionsMenuSystem", (void*)LanGameOptionsMenuSystem }, + { NAMEKEY_INVALID, "LanMapSelectMenuSystem", (void*)LanMapSelectMenuSystem }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuSystem", (void*)SkirmishGameOptionsMenuSystem }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuSystem", (void*)SkirmishMapSelectMenuSystem }, + { NAMEKEY_INVALID, "ChallengeMenuSystem", (void*)ChallengeMenuSystem }, + { NAMEKEY_INVALID, "SaveLoadMenuSystem", (void*)SaveLoadMenuSystem }, + { NAMEKEY_INVALID, "PopupCommunicatorSystem", (void*)PopupCommunicatorSystem }, + { NAMEKEY_INVALID, "PopupBuddyNotificationSystem", (void*)PopupBuddyNotificationSystem }, + { NAMEKEY_INVALID, "PopupReplaySystem", (void*)PopupReplaySystem }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuSystem", (void*)KeyboardOptionsMenuSystem }, + { NAMEKEY_INVALID, "WOLLadderScreenSystem", (void*)WOLLadderScreenSystem }, + { NAMEKEY_INVALID, "WOLLoginMenuSystem", (void*)WOLLoginMenuSystem }, + { NAMEKEY_INVALID, "WOLLocaleSelectSystem", (void*)WOLLocaleSelectSystem }, + { NAMEKEY_INVALID, "WOLLobbyMenuSystem", (void*)WOLLobbyMenuSystem }, + { NAMEKEY_INVALID, "WOLGameSetupMenuSystem", (void*)WOLGameSetupMenuSystem }, + { NAMEKEY_INVALID, "WOLMapSelectMenuSystem", (void*)WOLMapSelectMenuSystem }, + { NAMEKEY_INVALID, "WOLBuddyOverlaySystem", (void*)WOLBuddyOverlaySystem }, + { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuSystem", (void*)WOLBuddyOverlayRCMenuSystem }, + { NAMEKEY_INVALID, "RCGameDetailsMenuSystem", (void*)RCGameDetailsMenuSystem }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlaySystem", (void*)GameSpyPlayerInfoOverlaySystem }, + { NAMEKEY_INVALID, "WOLMessageWindowSystem", (void*)WOLMessageWindowSystem }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuSystem", (void*)WOLQuickMatchMenuSystem }, + { NAMEKEY_INVALID, "WOLWelcomeMenuSystem", (void*)WOLWelcomeMenuSystem }, + { NAMEKEY_INVALID, "WOLStatusMenuSystem", (void*)WOLStatusMenuSystem }, + { NAMEKEY_INVALID, "WOLQMScoreScreenSystem", (void*)WOLQMScoreScreenSystem }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenSystem", (void*)WOLCustomScoreScreenSystem }, + { NAMEKEY_INVALID, "NetworkDirectConnectSystem", (void*)NetworkDirectConnectSystem }, + { NAMEKEY_INVALID, "PopupHostGameSystem", (void*)PopupHostGameSystem }, + { NAMEKEY_INVALID, "PopupJoinGameSystem", (void*)PopupJoinGameSystem }, + { NAMEKEY_INVALID, "PopupLadderSelectSystem", (void*)PopupLadderSelectSystem }, + { NAMEKEY_INVALID, "InGamePopupMessageSystem", (void*)InGamePopupMessageSystem }, + { NAMEKEY_INVALID, "ControlBarSystem", (void*)ControlBarSystem }, + { NAMEKEY_INVALID, "ControlBarObserverSystem", (void*)ControlBarObserverSystem }, + { NAMEKEY_INVALID, "IMECandidateWindowSystem", (void*)IMECandidateWindowSystem }, + { NAMEKEY_INVALID, "ReplayControlSystem", (void*)ReplayControlSystem }, + { NAMEKEY_INVALID, "InGameChatSystem", (void*)InGameChatSystem }, + { NAMEKEY_INVALID, "DisconnectControlSystem", (void*)DisconnectControlSystem }, + { NAMEKEY_INVALID, "DiplomacySystem", (void*)DiplomacySystem }, + { NAMEKEY_INVALID, "GeneralsExpPointsSystem", (void*)GeneralsExpPointsSystem }, + { NAMEKEY_INVALID, "DifficultySelectSystem", (void*)DifficultySelectSystem }, + + { NAMEKEY_INVALID, "IdleWorkerSystem", (void*)IdleWorkerSystem }, + { NAMEKEY_INVALID, "EstablishConnectionsControlSystem", (void*)EstablishConnectionsControlSystem }, + { NAMEKEY_INVALID, "GameInfoWindowSystem", (void*)GameInfoWindowSystem }, + { NAMEKEY_INVALID, "ScoreScreenSystem", (void*)ScoreScreenSystem }, + { NAMEKEY_INVALID, "DownloadMenuSystem", (void*)DownloadMenuSystem }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -157,71 +157,71 @@ static FunctionLexicon::TableEntry gameWinSystemTable[] = static FunctionLexicon::TableEntry gameWinInputTable[] = { - { NAMEKEY_INVALID, "GameWinDefaultInput", GameWinDefaultInput }, - { NAMEKEY_INVALID, "GameWinBlockInput", GameWinBlockInput }, - { NAMEKEY_INVALID, "GadgetPushButtonInput", GadgetPushButtonInput }, - { NAMEKEY_INVALID, "GadgetCheckBoxInput", GadgetCheckBoxInput }, - { NAMEKEY_INVALID, "GadgetRadioButtonInput", GadgetRadioButtonInput }, - { NAMEKEY_INVALID, "GadgetTabControlInput", GadgetTabControlInput }, - { NAMEKEY_INVALID, "GadgetListBoxInput", GadgetListBoxInput }, - { NAMEKEY_INVALID, "GadgetListBoxMultiInput", GadgetListBoxMultiInput }, - { NAMEKEY_INVALID, "GadgetComboBoxInput", GadgetComboBoxInput }, - { NAMEKEY_INVALID, "GadgetHorizontalSliderInput", GadgetHorizontalSliderInput }, - { NAMEKEY_INVALID, "GadgetVerticalSliderInput", GadgetVerticalSliderInput }, - { NAMEKEY_INVALID, "GadgetStaticTextInput", GadgetStaticTextInput }, - { NAMEKEY_INVALID, "GadgetTextEntryInput", GadgetTextEntryInput }, - - { NAMEKEY_INVALID, "MainMenuInput", MainMenuInput }, - { NAMEKEY_INVALID, "MapSelectMenuInput", MapSelectMenuInput }, - { NAMEKEY_INVALID, "OptionsMenuInput", OptionsMenuInput }, - { NAMEKEY_INVALID, "SinglePlayerMenuInput", SinglePlayerMenuInput }, - { NAMEKEY_INVALID, "LanLobbyMenuInput", LanLobbyMenuInput }, - { NAMEKEY_INVALID, "ReplayMenuInput", ReplayMenuInput }, - { NAMEKEY_INVALID, "CreditsMenuInput", CreditsMenuInput }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuInput", KeyboardOptionsMenuInput }, - { NAMEKEY_INVALID, "PopupCommunicatorInput", PopupCommunicatorInput }, - { NAMEKEY_INVALID, "LanGameOptionsMenuInput", LanGameOptionsMenuInput }, - { NAMEKEY_INVALID, "LanMapSelectMenuInput", LanMapSelectMenuInput }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInput", SkirmishGameOptionsMenuInput }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuInput", SkirmishMapSelectMenuInput }, - { NAMEKEY_INVALID, "ChallengeMenuInput", ChallengeMenuInput }, - { NAMEKEY_INVALID, "WOLLadderScreenInput", WOLLadderScreenInput }, - { NAMEKEY_INVALID, "WOLLoginMenuInput", WOLLoginMenuInput }, - { NAMEKEY_INVALID, "WOLLocaleSelectInput", WOLLocaleSelectInput }, - { NAMEKEY_INVALID, "WOLLobbyMenuInput", WOLLobbyMenuInput }, - { NAMEKEY_INVALID, "WOLGameSetupMenuInput", WOLGameSetupMenuInput }, - { NAMEKEY_INVALID, "WOLMapSelectMenuInput", WOLMapSelectMenuInput }, - { NAMEKEY_INVALID, "WOLBuddyOverlayInput", WOLBuddyOverlayInput }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInput", GameSpyPlayerInfoOverlayInput }, - { NAMEKEY_INVALID, "WOLMessageWindowInput", WOLMessageWindowInput }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuInput", WOLQuickMatchMenuInput }, - { NAMEKEY_INVALID, "WOLWelcomeMenuInput", WOLWelcomeMenuInput }, - { NAMEKEY_INVALID, "WOLStatusMenuInput", WOLStatusMenuInput }, - { NAMEKEY_INVALID, "WOLQMScoreScreenInput", WOLQMScoreScreenInput }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenInput", WOLCustomScoreScreenInput }, - { NAMEKEY_INVALID, "NetworkDirectConnectInput", NetworkDirectConnectInput }, - { NAMEKEY_INVALID, "PopupHostGameInput", PopupHostGameInput }, - { NAMEKEY_INVALID, "PopupJoinGameInput", PopupJoinGameInput }, - { NAMEKEY_INVALID, "PopupLadderSelectInput", PopupLadderSelectInput }, - { NAMEKEY_INVALID, "InGamePopupMessageInput", InGamePopupMessageInput }, - { NAMEKEY_INVALID, "ControlBarInput", ControlBarInput }, - { NAMEKEY_INVALID, "ReplayControlInput", ReplayControlInput }, - { NAMEKEY_INVALID, "InGameChatInput", InGameChatInput }, - { NAMEKEY_INVALID, "DisconnectControlInput", DisconnectControlInput }, - { NAMEKEY_INVALID, "DiplomacyInput", DiplomacyInput }, - { NAMEKEY_INVALID, "EstablishConnectionsControlInput", EstablishConnectionsControlInput }, - { NAMEKEY_INVALID, "LeftHUDInput", LeftHUDInput }, - { NAMEKEY_INVALID, "ScoreScreenInput", ScoreScreenInput }, - { NAMEKEY_INVALID, "SaveLoadMenuInput", SaveLoadMenuInput }, - { NAMEKEY_INVALID, "BeaconWindowInput", BeaconWindowInput }, - { NAMEKEY_INVALID, "DifficultySelectInput", DifficultySelectInput }, - { NAMEKEY_INVALID, "PopupReplayInput", PopupReplayInput }, - { NAMEKEY_INVALID, "GeneralsExpPointsInput", GeneralsExpPointsInput}, - - { NAMEKEY_INVALID, "DownloadMenuInput", DownloadMenuInput }, - - { NAMEKEY_INVALID, "IMECandidateWindowInput", IMECandidateWindowInput }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "GameWinDefaultInput", (void*)GameWinDefaultInput }, + { NAMEKEY_INVALID, "GameWinBlockInput", (void*)GameWinBlockInput }, + { NAMEKEY_INVALID, "GadgetPushButtonInput", (void*)GadgetPushButtonInput }, + { NAMEKEY_INVALID, "GadgetCheckBoxInput", (void*)GadgetCheckBoxInput }, + { NAMEKEY_INVALID, "GadgetRadioButtonInput", (void*)GadgetRadioButtonInput }, + { NAMEKEY_INVALID, "GadgetTabControlInput", (void*)GadgetTabControlInput }, + { NAMEKEY_INVALID, "GadgetListBoxInput", (void*)GadgetListBoxInput }, + { NAMEKEY_INVALID, "GadgetListBoxMultiInput", (void*)GadgetListBoxMultiInput }, + { NAMEKEY_INVALID, "GadgetComboBoxInput", (void*)GadgetComboBoxInput }, + { NAMEKEY_INVALID, "GadgetHorizontalSliderInput", (void*)GadgetHorizontalSliderInput }, + { NAMEKEY_INVALID, "GadgetVerticalSliderInput", (void*)GadgetVerticalSliderInput }, + { NAMEKEY_INVALID, "GadgetStaticTextInput", (void*)GadgetStaticTextInput }, + { NAMEKEY_INVALID, "GadgetTextEntryInput", (void*)GadgetTextEntryInput }, + + { NAMEKEY_INVALID, "MainMenuInput", (void*)MainMenuInput }, + { NAMEKEY_INVALID, "MapSelectMenuInput", (void*)MapSelectMenuInput }, + { NAMEKEY_INVALID, "OptionsMenuInput", (void*)OptionsMenuInput }, + { NAMEKEY_INVALID, "SinglePlayerMenuInput", (void*)SinglePlayerMenuInput }, + { NAMEKEY_INVALID, "LanLobbyMenuInput", (void*)LanLobbyMenuInput }, + { NAMEKEY_INVALID, "ReplayMenuInput", (void*)ReplayMenuInput }, + { NAMEKEY_INVALID, "CreditsMenuInput", (void*)CreditsMenuInput }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuInput", (void*)KeyboardOptionsMenuInput }, + { NAMEKEY_INVALID, "PopupCommunicatorInput", (void*)PopupCommunicatorInput }, + { NAMEKEY_INVALID, "LanGameOptionsMenuInput", (void*)LanGameOptionsMenuInput }, + { NAMEKEY_INVALID, "LanMapSelectMenuInput", (void*)LanMapSelectMenuInput }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInput", (void*)SkirmishGameOptionsMenuInput }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuInput", (void*)SkirmishMapSelectMenuInput }, + { NAMEKEY_INVALID, "ChallengeMenuInput", (void*)ChallengeMenuInput }, + { NAMEKEY_INVALID, "WOLLadderScreenInput", (void*)WOLLadderScreenInput }, + { NAMEKEY_INVALID, "WOLLoginMenuInput", (void*)WOLLoginMenuInput }, + { NAMEKEY_INVALID, "WOLLocaleSelectInput", (void*)WOLLocaleSelectInput }, + { NAMEKEY_INVALID, "WOLLobbyMenuInput", (void*)WOLLobbyMenuInput }, + { NAMEKEY_INVALID, "WOLGameSetupMenuInput", (void*)WOLGameSetupMenuInput }, + { NAMEKEY_INVALID, "WOLMapSelectMenuInput", (void*)WOLMapSelectMenuInput }, + { NAMEKEY_INVALID, "WOLBuddyOverlayInput", (void*)WOLBuddyOverlayInput }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInput", (void*)GameSpyPlayerInfoOverlayInput }, + { NAMEKEY_INVALID, "WOLMessageWindowInput", (void*)WOLMessageWindowInput }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuInput", (void*)WOLQuickMatchMenuInput }, + { NAMEKEY_INVALID, "WOLWelcomeMenuInput", (void*)WOLWelcomeMenuInput }, + { NAMEKEY_INVALID, "WOLStatusMenuInput", (void*)WOLStatusMenuInput }, + { NAMEKEY_INVALID, "WOLQMScoreScreenInput", (void*)WOLQMScoreScreenInput }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenInput", (void*)WOLCustomScoreScreenInput }, + { NAMEKEY_INVALID, "NetworkDirectConnectInput", (void*)NetworkDirectConnectInput }, + { NAMEKEY_INVALID, "PopupHostGameInput", (void*)PopupHostGameInput }, + { NAMEKEY_INVALID, "PopupJoinGameInput", (void*)PopupJoinGameInput }, + { NAMEKEY_INVALID, "PopupLadderSelectInput", (void*)PopupLadderSelectInput }, + { NAMEKEY_INVALID, "InGamePopupMessageInput", (void*)InGamePopupMessageInput }, + { NAMEKEY_INVALID, "ControlBarInput", (void*)ControlBarInput }, + { NAMEKEY_INVALID, "ReplayControlInput", (void*)ReplayControlInput }, + { NAMEKEY_INVALID, "InGameChatInput", (void*)InGameChatInput }, + { NAMEKEY_INVALID, "DisconnectControlInput", (void*)DisconnectControlInput }, + { NAMEKEY_INVALID, "DiplomacyInput", (void*)DiplomacyInput }, + { NAMEKEY_INVALID, "EstablishConnectionsControlInput", (void*)EstablishConnectionsControlInput }, + { NAMEKEY_INVALID, "LeftHUDInput", (void*)LeftHUDInput }, + { NAMEKEY_INVALID, "ScoreScreenInput", (void*)ScoreScreenInput }, + { NAMEKEY_INVALID, "SaveLoadMenuInput", (void*)SaveLoadMenuInput }, + { NAMEKEY_INVALID, "BeaconWindowInput", (void*)BeaconWindowInput }, + { NAMEKEY_INVALID, "DifficultySelectInput", (void*)DifficultySelectInput }, + { NAMEKEY_INVALID, "PopupReplayInput", (void*)PopupReplayInput }, + { NAMEKEY_INVALID, "GeneralsExpPointsInput", (void*)GeneralsExpPointsInput }, + + { NAMEKEY_INVALID, "DownloadMenuInput", (void*)DownloadMenuInput }, + + { NAMEKEY_INVALID, "IMECandidateWindowInput", (void*)IMECandidateWindowInput }, + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -230,9 +230,9 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = { - { NAMEKEY_INVALID, "GameWinDefaultTooltip", GameWinDefaultTooltip }, + { NAMEKEY_INVALID, "GameWinDefaultTooltip", (void*)GameWinDefaultTooltip }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -240,51 +240,51 @@ static FunctionLexicon::TableEntry gameWinTooltipTable[] = static FunctionLexicon::TableEntry winLayoutInitTable[] = { - { NAMEKEY_INVALID, "MainMenuInit", MainMenuInit }, - { NAMEKEY_INVALID, "OptionsMenuInit", OptionsMenuInit }, - { NAMEKEY_INVALID, "SaveLoadMenuInit", SaveLoadMenuInit }, - { NAMEKEY_INVALID, "SaveLoadMenuFullScreenInit", SaveLoadMenuFullScreenInit }, - - { NAMEKEY_INVALID, "PopupCommunicatorInit", PopupCommunicatorInit }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuInit", KeyboardOptionsMenuInit }, - { NAMEKEY_INVALID, "SinglePlayerMenuInit", SinglePlayerMenuInit }, - { NAMEKEY_INVALID, "MapSelectMenuInit", MapSelectMenuInit }, - { NAMEKEY_INVALID, "LanLobbyMenuInit", LanLobbyMenuInit }, - { NAMEKEY_INVALID, "ReplayMenuInit", ReplayMenuInit }, - { NAMEKEY_INVALID, "CreditsMenuInit", CreditsMenuInit }, - { NAMEKEY_INVALID, "LanGameOptionsMenuInit", LanGameOptionsMenuInit }, - { NAMEKEY_INVALID, "LanMapSelectMenuInit", LanMapSelectMenuInit }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInit", SkirmishGameOptionsMenuInit }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuInit", SkirmishMapSelectMenuInit }, - { NAMEKEY_INVALID, "ChallengeMenuInit", ChallengeMenuInit }, - { NAMEKEY_INVALID, "WOLLadderScreenInit", WOLLadderScreenInit }, - { NAMEKEY_INVALID, "WOLLoginMenuInit", WOLLoginMenuInit }, - { NAMEKEY_INVALID, "WOLLocaleSelectInit", WOLLocaleSelectInit }, - { NAMEKEY_INVALID, "WOLLobbyMenuInit", WOLLobbyMenuInit }, - { NAMEKEY_INVALID, "WOLGameSetupMenuInit", WOLGameSetupMenuInit }, - { NAMEKEY_INVALID, "WOLMapSelectMenuInit", WOLMapSelectMenuInit }, - { NAMEKEY_INVALID, "WOLBuddyOverlayInit", WOLBuddyOverlayInit }, - { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuInit", WOLBuddyOverlayRCMenuInit }, - { NAMEKEY_INVALID, "RCGameDetailsMenuInit", RCGameDetailsMenuInit }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInit", GameSpyPlayerInfoOverlayInit }, - { NAMEKEY_INVALID, "WOLMessageWindowInit", WOLMessageWindowInit }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuInit", WOLQuickMatchMenuInit }, - { NAMEKEY_INVALID, "WOLWelcomeMenuInit", WOLWelcomeMenuInit }, - { NAMEKEY_INVALID, "WOLStatusMenuInit", WOLStatusMenuInit }, - { NAMEKEY_INVALID, "WOLQMScoreScreenInit", WOLQMScoreScreenInit }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenInit", WOLCustomScoreScreenInit }, - { NAMEKEY_INVALID, "NetworkDirectConnectInit", NetworkDirectConnectInit }, - { NAMEKEY_INVALID, "PopupHostGameInit", PopupHostGameInit }, - { NAMEKEY_INVALID, "PopupJoinGameInit", PopupJoinGameInit }, - { NAMEKEY_INVALID, "PopupLadderSelectInit", PopupLadderSelectInit }, - { NAMEKEY_INVALID, "InGamePopupMessageInit", InGamePopupMessageInit }, - { NAMEKEY_INVALID, "GameInfoWindowInit", GameInfoWindowInit }, - { NAMEKEY_INVALID, "ScoreScreenInit", ScoreScreenInit }, - { NAMEKEY_INVALID, "DownloadMenuInit", DownloadMenuInit }, - { NAMEKEY_INVALID, "DifficultySelectInit", DifficultySelectInit }, - { NAMEKEY_INVALID, "PopupReplayInit", PopupReplayInit }, - - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuInit", (void*)MainMenuInit }, + { NAMEKEY_INVALID, "OptionsMenuInit", (void*)OptionsMenuInit }, + { NAMEKEY_INVALID, "SaveLoadMenuInit", (void*)SaveLoadMenuInit }, + { NAMEKEY_INVALID, "SaveLoadMenuFullScreenInit", (void*)SaveLoadMenuFullScreenInit }, + + { NAMEKEY_INVALID, "PopupCommunicatorInit", (void*)PopupCommunicatorInit }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuInit", (void*)KeyboardOptionsMenuInit }, + { NAMEKEY_INVALID, "SinglePlayerMenuInit", (void*)SinglePlayerMenuInit }, + { NAMEKEY_INVALID, "MapSelectMenuInit", (void*)MapSelectMenuInit }, + { NAMEKEY_INVALID, "LanLobbyMenuInit", (void*)LanLobbyMenuInit }, + { NAMEKEY_INVALID, "ReplayMenuInit", (void*)ReplayMenuInit }, + { NAMEKEY_INVALID, "CreditsMenuInit", (void*)CreditsMenuInit }, + { NAMEKEY_INVALID, "LanGameOptionsMenuInit", (void*)LanGameOptionsMenuInit }, + { NAMEKEY_INVALID, "LanMapSelectMenuInit", (void*)LanMapSelectMenuInit }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuInit", (void*)SkirmishGameOptionsMenuInit }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuInit", (void*)SkirmishMapSelectMenuInit }, + { NAMEKEY_INVALID, "ChallengeMenuInit", (void*)ChallengeMenuInit }, + { NAMEKEY_INVALID, "WOLLadderScreenInit", (void*)WOLLadderScreenInit }, + { NAMEKEY_INVALID, "WOLLoginMenuInit", (void*)WOLLoginMenuInit }, + { NAMEKEY_INVALID, "WOLLocaleSelectInit", (void*)WOLLocaleSelectInit }, + { NAMEKEY_INVALID, "WOLLobbyMenuInit", (void*)WOLLobbyMenuInit }, + { NAMEKEY_INVALID, "WOLGameSetupMenuInit", (void*)WOLGameSetupMenuInit }, + { NAMEKEY_INVALID, "WOLMapSelectMenuInit", (void*)WOLMapSelectMenuInit }, + { NAMEKEY_INVALID, "WOLBuddyOverlayInit", (void*)WOLBuddyOverlayInit }, + { NAMEKEY_INVALID, "WOLBuddyOverlayRCMenuInit", (void*)WOLBuddyOverlayRCMenuInit }, + { NAMEKEY_INVALID, "RCGameDetailsMenuInit", (void*)RCGameDetailsMenuInit }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayInit", (void*)GameSpyPlayerInfoOverlayInit }, + { NAMEKEY_INVALID, "WOLMessageWindowInit", (void*)WOLMessageWindowInit }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuInit", (void*)WOLQuickMatchMenuInit }, + { NAMEKEY_INVALID, "WOLWelcomeMenuInit", (void*)WOLWelcomeMenuInit }, + { NAMEKEY_INVALID, "WOLStatusMenuInit", (void*)WOLStatusMenuInit }, + { NAMEKEY_INVALID, "WOLQMScoreScreenInit", (void*)WOLQMScoreScreenInit }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenInit", (void*)WOLCustomScoreScreenInit }, + { NAMEKEY_INVALID, "NetworkDirectConnectInit", (void*)NetworkDirectConnectInit }, + { NAMEKEY_INVALID, "PopupHostGameInit", (void*)PopupHostGameInit }, + { NAMEKEY_INVALID, "PopupJoinGameInit", (void*)PopupJoinGameInit }, + { NAMEKEY_INVALID, "PopupLadderSelectInit", (void*)PopupLadderSelectInit }, + { NAMEKEY_INVALID, "InGamePopupMessageInit", (void*)InGamePopupMessageInit }, + { NAMEKEY_INVALID, "GameInfoWindowInit", (void*)GameInfoWindowInit }, + { NAMEKEY_INVALID, "ScoreScreenInit", (void*)ScoreScreenInit }, + { NAMEKEY_INVALID, "DownloadMenuInit", (void*)DownloadMenuInit }, + { NAMEKEY_INVALID, "DifficultySelectInit", (void*)DifficultySelectInit }, + { NAMEKEY_INVALID, "PopupReplayInit", (void*)PopupReplayInit }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -292,40 +292,40 @@ static FunctionLexicon::TableEntry winLayoutInitTable[] = static FunctionLexicon::TableEntry winLayoutUpdateTable[] = { - { NAMEKEY_INVALID, "MainMenuUpdate", MainMenuUpdate }, - { NAMEKEY_INVALID, "OptionsMenuUpdate", OptionsMenuUpdate }, - { NAMEKEY_INVALID, "SinglePlayerMenuUpdate", SinglePlayerMenuUpdate }, - { NAMEKEY_INVALID, "MapSelectMenuUpdate", MapSelectMenuUpdate }, - { NAMEKEY_INVALID, "LanLobbyMenuUpdate", LanLobbyMenuUpdate }, - { NAMEKEY_INVALID, "ReplayMenuUpdate", ReplayMenuUpdate }, - { NAMEKEY_INVALID, "SaveLoadMenuUpdate", SaveLoadMenuUpdate }, - - { NAMEKEY_INVALID, "CreditsMenuUpdate", CreditsMenuUpdate }, - { NAMEKEY_INVALID, "LanGameOptionsMenuUpdate", LanGameOptionsMenuUpdate }, - { NAMEKEY_INVALID, "LanMapSelectMenuUpdate", LanMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuUpdate", SkirmishGameOptionsMenuUpdate }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuUpdate", SkirmishMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "ChallengeMenuUpdate", ChallengeMenuUpdate }, - { NAMEKEY_INVALID, "WOLLadderScreenUpdate", WOLLadderScreenUpdate }, - { NAMEKEY_INVALID, "WOLLoginMenuUpdate", WOLLoginMenuUpdate }, - { NAMEKEY_INVALID, "WOLLocaleSelectUpdate", WOLLocaleSelectUpdate }, - { NAMEKEY_INVALID, "WOLLobbyMenuUpdate", WOLLobbyMenuUpdate }, - { NAMEKEY_INVALID, "WOLGameSetupMenuUpdate", WOLGameSetupMenuUpdate }, - { NAMEKEY_INVALID, "PopupHostGameUpdate", PopupHostGameUpdate }, - { NAMEKEY_INVALID, "WOLMapSelectMenuUpdate", WOLMapSelectMenuUpdate }, - { NAMEKEY_INVALID, "WOLBuddyOverlayUpdate", WOLBuddyOverlayUpdate }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayUpdate",GameSpyPlayerInfoOverlayUpdate }, - { NAMEKEY_INVALID, "WOLMessageWindowUpdate", WOLMessageWindowUpdate }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuUpdate", WOLQuickMatchMenuUpdate }, - { NAMEKEY_INVALID, "WOLWelcomeMenuUpdate", WOLWelcomeMenuUpdate }, - { NAMEKEY_INVALID, "WOLStatusMenuUpdate", WOLStatusMenuUpdate }, - { NAMEKEY_INVALID, "WOLQMScoreScreenUpdate", WOLQMScoreScreenUpdate }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenUpdate", WOLCustomScoreScreenUpdate }, - { NAMEKEY_INVALID, "NetworkDirectConnectUpdate", NetworkDirectConnectUpdate }, - { NAMEKEY_INVALID, "ScoreScreenUpdate", ScoreScreenUpdate }, - { NAMEKEY_INVALID, "DownloadMenuUpdate", DownloadMenuUpdate }, - { NAMEKEY_INVALID, "PopupReplayUpdate", PopupReplayUpdate }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuUpdate", (void*)MainMenuUpdate }, + { NAMEKEY_INVALID, "OptionsMenuUpdate", (void*)OptionsMenuUpdate }, + { NAMEKEY_INVALID, "SinglePlayerMenuUpdate", (void*)SinglePlayerMenuUpdate }, + { NAMEKEY_INVALID, "MapSelectMenuUpdate", (void*)MapSelectMenuUpdate }, + { NAMEKEY_INVALID, "LanLobbyMenuUpdate", (void*)LanLobbyMenuUpdate }, + { NAMEKEY_INVALID, "ReplayMenuUpdate", (void*)ReplayMenuUpdate }, + { NAMEKEY_INVALID, "SaveLoadMenuUpdate", (void*)SaveLoadMenuUpdate }, + + { NAMEKEY_INVALID, "CreditsMenuUpdate", (void*)CreditsMenuUpdate }, + { NAMEKEY_INVALID, "LanGameOptionsMenuUpdate", (void*)LanGameOptionsMenuUpdate }, + { NAMEKEY_INVALID, "LanMapSelectMenuUpdate", (void*)LanMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuUpdate", (void*)SkirmishGameOptionsMenuUpdate }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuUpdate", (void*)SkirmishMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "ChallengeMenuUpdate", (void*)ChallengeMenuUpdate }, + { NAMEKEY_INVALID, "WOLLadderScreenUpdate", (void*)WOLLadderScreenUpdate }, + { NAMEKEY_INVALID, "WOLLoginMenuUpdate", (void*)WOLLoginMenuUpdate }, + { NAMEKEY_INVALID, "WOLLocaleSelectUpdate", (void*)WOLLocaleSelectUpdate }, + { NAMEKEY_INVALID, "WOLLobbyMenuUpdate", (void*)WOLLobbyMenuUpdate }, + { NAMEKEY_INVALID, "WOLGameSetupMenuUpdate", (void*)WOLGameSetupMenuUpdate }, + { NAMEKEY_INVALID, "PopupHostGameUpdate", (void*)PopupHostGameUpdate }, + { NAMEKEY_INVALID, "WOLMapSelectMenuUpdate", (void*)WOLMapSelectMenuUpdate }, + { NAMEKEY_INVALID, "WOLBuddyOverlayUpdate", (void*)WOLBuddyOverlayUpdate }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayUpdate", (void*)GameSpyPlayerInfoOverlayUpdate }, + { NAMEKEY_INVALID, "WOLMessageWindowUpdate", (void*)WOLMessageWindowUpdate }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuUpdate", (void*)WOLQuickMatchMenuUpdate }, + { NAMEKEY_INVALID, "WOLWelcomeMenuUpdate", (void*)WOLWelcomeMenuUpdate }, + { NAMEKEY_INVALID, "WOLStatusMenuUpdate", (void*)WOLStatusMenuUpdate }, + { NAMEKEY_INVALID, "WOLQMScoreScreenUpdate", (void*)WOLQMScoreScreenUpdate }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenUpdate", (void*)WOLCustomScoreScreenUpdate }, + { NAMEKEY_INVALID, "NetworkDirectConnectUpdate", (void*)NetworkDirectConnectUpdate }, + { NAMEKEY_INVALID, "ScoreScreenUpdate", (void*)ScoreScreenUpdate }, + { NAMEKEY_INVALID, "DownloadMenuUpdate", (void*)DownloadMenuUpdate }, + { NAMEKEY_INVALID, "PopupReplayUpdate", (void*)PopupReplayUpdate }, + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -333,40 +333,40 @@ static FunctionLexicon::TableEntry winLayoutUpdateTable[] = static FunctionLexicon::TableEntry winLayoutShutdownTable[] = { - { NAMEKEY_INVALID, "MainMenuShutdown", MainMenuShutdown }, - { NAMEKEY_INVALID, "OptionsMenuShutdown", OptionsMenuShutdown }, - { NAMEKEY_INVALID, "SaveLoadMenuShutdown", SaveLoadMenuShutdown }, - { NAMEKEY_INVALID, "PopupCommunicatorShutdown", PopupCommunicatorShutdown }, - { NAMEKEY_INVALID, "KeyboardOptionsMenuShutdown", KeyboardOptionsMenuShutdown }, - { NAMEKEY_INVALID, "SinglePlayerMenuShutdown", SinglePlayerMenuShutdown }, - { NAMEKEY_INVALID, "MapSelectMenuShutdown", MapSelectMenuShutdown }, - { NAMEKEY_INVALID, "LanLobbyMenuShutdown", LanLobbyMenuShutdown }, - { NAMEKEY_INVALID, "ReplayMenuShutdown", ReplayMenuShutdown }, - { NAMEKEY_INVALID, "CreditsMenuShutdown", CreditsMenuShutdown }, - { NAMEKEY_INVALID, "LanGameOptionsMenuShutdown", LanGameOptionsMenuShutdown }, - { NAMEKEY_INVALID, "LanMapSelectMenuShutdown", LanMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "SkirmishGameOptionsMenuShutdown",SkirmishGameOptionsMenuShutdown }, - { NAMEKEY_INVALID, "SkirmishMapSelectMenuShutdown", SkirmishMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "ChallengeMenuShutdown", ChallengeMenuShutdown }, - { NAMEKEY_INVALID, "WOLLadderScreenShutdown", WOLLadderScreenShutdown }, - { NAMEKEY_INVALID, "WOLLoginMenuShutdown", WOLLoginMenuShutdown }, - { NAMEKEY_INVALID, "WOLLocaleSelectShutdown", WOLLocaleSelectShutdown }, - { NAMEKEY_INVALID, "WOLLobbyMenuShutdown", WOLLobbyMenuShutdown }, - { NAMEKEY_INVALID, "WOLGameSetupMenuShutdown", WOLGameSetupMenuShutdown }, - { NAMEKEY_INVALID, "WOLMapSelectMenuShutdown", WOLMapSelectMenuShutdown }, - { NAMEKEY_INVALID, "WOLBuddyOverlayShutdown", WOLBuddyOverlayShutdown }, - { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayShutdown",GameSpyPlayerInfoOverlayShutdown }, - { NAMEKEY_INVALID, "WOLMessageWindowShutdown", WOLMessageWindowShutdown }, - { NAMEKEY_INVALID, "WOLQuickMatchMenuShutdown", WOLQuickMatchMenuShutdown }, - { NAMEKEY_INVALID, "WOLWelcomeMenuShutdown", WOLWelcomeMenuShutdown }, - { NAMEKEY_INVALID, "WOLStatusMenuShutdown", WOLStatusMenuShutdown }, - { NAMEKEY_INVALID, "WOLQMScoreScreenShutdown", WOLQMScoreScreenShutdown }, - { NAMEKEY_INVALID, "WOLCustomScoreScreenShutdown", WOLCustomScoreScreenShutdown }, - { NAMEKEY_INVALID, "NetworkDirectConnectShutdown", NetworkDirectConnectShutdown }, - { NAMEKEY_INVALID, "ScoreScreenShutdown", ScoreScreenShutdown }, - { NAMEKEY_INVALID, "DownloadMenuShutdown", DownloadMenuShutdown }, - { NAMEKEY_INVALID, "PopupReplayShutdown", PopupReplayShutdown }, - { NAMEKEY_INVALID, nullptr, nullptr } + { NAMEKEY_INVALID, "MainMenuShutdown", (void*)MainMenuShutdown }, + { NAMEKEY_INVALID, "OptionsMenuShutdown", (void*)OptionsMenuShutdown }, + { NAMEKEY_INVALID, "SaveLoadMenuShutdown", (void*)SaveLoadMenuShutdown }, + { NAMEKEY_INVALID, "PopupCommunicatorShutdown", (void*)PopupCommunicatorShutdown }, + { NAMEKEY_INVALID, "KeyboardOptionsMenuShutdown", (void*)KeyboardOptionsMenuShutdown }, + { NAMEKEY_INVALID, "SinglePlayerMenuShutdown", (void*)SinglePlayerMenuShutdown }, + { NAMEKEY_INVALID, "MapSelectMenuShutdown", (void*)MapSelectMenuShutdown }, + { NAMEKEY_INVALID, "LanLobbyMenuShutdown", (void*)LanLobbyMenuShutdown }, + { NAMEKEY_INVALID, "ReplayMenuShutdown", (void*)ReplayMenuShutdown }, + { NAMEKEY_INVALID, "CreditsMenuShutdown", (void*)CreditsMenuShutdown }, + { NAMEKEY_INVALID, "LanGameOptionsMenuShutdown", (void*)LanGameOptionsMenuShutdown }, + { NAMEKEY_INVALID, "LanMapSelectMenuShutdown", (void*)LanMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "SkirmishGameOptionsMenuShutdown", (void*)SkirmishGameOptionsMenuShutdown }, + { NAMEKEY_INVALID, "SkirmishMapSelectMenuShutdown", (void*)SkirmishMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "ChallengeMenuShutdown", (void*)ChallengeMenuShutdown }, + { NAMEKEY_INVALID, "WOLLadderScreenShutdown", (void*)WOLLadderScreenShutdown }, + { NAMEKEY_INVALID, "WOLLoginMenuShutdown", (void*)WOLLoginMenuShutdown }, + { NAMEKEY_INVALID, "WOLLocaleSelectShutdown", (void*)WOLLocaleSelectShutdown }, + { NAMEKEY_INVALID, "WOLLobbyMenuShutdown", (void*)WOLLobbyMenuShutdown }, + { NAMEKEY_INVALID, "WOLGameSetupMenuShutdown", (void*)WOLGameSetupMenuShutdown }, + { NAMEKEY_INVALID, "WOLMapSelectMenuShutdown", (void*)WOLMapSelectMenuShutdown }, + { NAMEKEY_INVALID, "WOLBuddyOverlayShutdown", (void*)WOLBuddyOverlayShutdown }, + { NAMEKEY_INVALID, "GameSpyPlayerInfoOverlayShutdown", (void*)GameSpyPlayerInfoOverlayShutdown }, + { NAMEKEY_INVALID, "WOLMessageWindowShutdown", (void*)WOLMessageWindowShutdown }, + { NAMEKEY_INVALID, "WOLQuickMatchMenuShutdown", (void*)WOLQuickMatchMenuShutdown }, + { NAMEKEY_INVALID, "WOLWelcomeMenuShutdown", (void*)WOLWelcomeMenuShutdown }, + { NAMEKEY_INVALID, "WOLStatusMenuShutdown", (void*)WOLStatusMenuShutdown }, + { NAMEKEY_INVALID, "WOLQMScoreScreenShutdown", (void*)WOLQMScoreScreenShutdown }, + { NAMEKEY_INVALID, "WOLCustomScoreScreenShutdown", (void*)WOLCustomScoreScreenShutdown }, + { NAMEKEY_INVALID, "NetworkDirectConnectShutdown", (void*)NetworkDirectConnectShutdown }, + { NAMEKEY_INVALID, "ScoreScreenShutdown", (void*)ScoreScreenShutdown }, + { NAMEKEY_INVALID, "DownloadMenuShutdown", (void*)DownloadMenuShutdown }, + { NAMEKEY_INVALID, "PopupReplayShutdown", (void*)PopupReplayShutdown }, + { NAMEKEY_INVALID, nullptr, nullptr } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index b2e09e0c3c2..a72d2c29990 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -495,7 +495,7 @@ void CheckForCDAtGameStart( gameStartCallback callback ) { // popup a dialog asking for a CD ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - callback, checkCDCallback, cancelStartBecauseOfNoCD); + (void*)callback, checkCDCallback, cancelStartBecauseOfNoCD); } else { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp index 17f1b6cbdf7..93d0a02095c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp @@ -43,59 +43,59 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = { - { NAMEKEY_INVALID, "GameWinDefaultDraw", GameWinDefaultDraw }, - { NAMEKEY_INVALID, "W3DGameWinDefaultDraw", W3DGameWinDefaultDraw }, - - { NAMEKEY_INVALID, "W3DGadgetPushButtonDraw", W3DGadgetPushButtonDraw }, - { NAMEKEY_INVALID, "W3DGadgetPushButtonImageDraw", W3DGadgetPushButtonImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetCheckBoxDraw", W3DGadgetCheckBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetCheckBoxImageDraw", W3DGadgetCheckBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetRadioButtonDraw", W3DGadgetRadioButtonDraw }, - { NAMEKEY_INVALID, "W3DGadgetRadioButtonImageDraw", W3DGadgetRadioButtonImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetTabControlDraw", W3DGadgetTabControlDraw }, - { NAMEKEY_INVALID, "W3DGadgetTabControlImageDraw", W3DGadgetTabControlImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetListBoxDraw", W3DGadgetListBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetListBoxImageDraw", W3DGadgetListBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetComboBoxDraw", W3DGadgetComboBoxDraw }, - { NAMEKEY_INVALID, "W3DGadgetComboBoxImageDraw", W3DGadgetComboBoxImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderDraw", W3DGadgetHorizontalSliderDraw }, - { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderImageDraw", W3DGadgetHorizontalSliderImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetVerticalSliderDraw", W3DGadgetVerticalSliderDraw }, - { NAMEKEY_INVALID, "W3DGadgetVerticalSliderImageDraw", W3DGadgetVerticalSliderImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetProgressBarDraw", W3DGadgetProgressBarDraw }, - { NAMEKEY_INVALID, "W3DGadgetProgressBarImageDraw", W3DGadgetProgressBarImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetStaticTextDraw", W3DGadgetStaticTextDraw }, - { NAMEKEY_INVALID, "W3DGadgetStaticTextImageDraw", W3DGadgetStaticTextImageDraw }, - { NAMEKEY_INVALID, "W3DGadgetTextEntryDraw", W3DGadgetTextEntryDraw }, - { NAMEKEY_INVALID, "W3DGadgetTextEntryImageDraw", W3DGadgetTextEntryImageDraw }, - - { NAMEKEY_INVALID, "W3DLeftHUDDraw", W3DLeftHUDDraw }, - { NAMEKEY_INVALID, "W3DCameoMovieDraw", W3DCameoMovieDraw }, - { NAMEKEY_INVALID, "W3DRightHUDDraw", W3DRightHUDDraw }, - { NAMEKEY_INVALID, "W3DPowerDraw", W3DPowerDraw }, - { NAMEKEY_INVALID, "W3DMainMenuDraw", W3DMainMenuDraw }, - { NAMEKEY_INVALID, "W3DMainMenuFourDraw", W3DMainMenuFourDraw }, - { NAMEKEY_INVALID, "W3DMetalBarMenuDraw", W3DMetalBarMenuDraw }, - { NAMEKEY_INVALID, "W3DCreditsMenuDraw", W3DCreditsMenuDraw }, - { NAMEKEY_INVALID, "W3DClockDraw", W3DClockDraw }, - { NAMEKEY_INVALID, "W3DMainMenuMapBorder", W3DMainMenuMapBorder }, - { NAMEKEY_INVALID, "W3DMainMenuButtonDropShadowDraw", W3DMainMenuButtonDropShadowDraw }, - { NAMEKEY_INVALID, "W3DMainMenuRandomTextDraw", W3DMainMenuRandomTextDraw }, - { NAMEKEY_INVALID, "W3DThinBorderDraw", W3DThinBorderDraw }, - { NAMEKEY_INVALID, "W3DShellMenuSchemeDraw", W3DShellMenuSchemeDraw }, - { NAMEKEY_INVALID, "W3DCommandBarBackgroundDraw", W3DCommandBarBackgroundDraw }, - { NAMEKEY_INVALID, "W3DCommandBarTopDraw", W3DCommandBarTopDraw }, - { NAMEKEY_INVALID, "W3DCommandBarGenExpDraw", W3DCommandBarGenExpDraw }, - { NAMEKEY_INVALID, "W3DCommandBarHelpPopupDraw", W3DCommandBarHelpPopupDraw }, - - { NAMEKEY_INVALID, "W3DCommandBarGridDraw", W3DCommandBarGridDraw }, - - - { NAMEKEY_INVALID, "W3DCommandBarForegroundDraw", W3DCommandBarForegroundDraw }, - { NAMEKEY_INVALID, "W3DNoDraw", W3DNoDraw }, - { NAMEKEY_INVALID, "W3DDrawMapPreview", W3DDrawMapPreview }, - - { NAMEKEY_INVALID, nullptr, nullptr }, + { NAMEKEY_INVALID, "GameWinDefaultDraw", (void*)GameWinDefaultDraw }, + { NAMEKEY_INVALID, "W3DGameWinDefaultDraw", (void*)W3DGameWinDefaultDraw }, + + { NAMEKEY_INVALID, "W3DGadgetPushButtonDraw", (void*)W3DGadgetPushButtonDraw }, + { NAMEKEY_INVALID, "W3DGadgetPushButtonImageDraw", (void*)W3DGadgetPushButtonImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetCheckBoxDraw", (void*)W3DGadgetCheckBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetCheckBoxImageDraw", (void*)W3DGadgetCheckBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetRadioButtonDraw", (void*)W3DGadgetRadioButtonDraw }, + { NAMEKEY_INVALID, "W3DGadgetRadioButtonImageDraw", (void*)W3DGadgetRadioButtonImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetTabControlDraw", (void*)W3DGadgetTabControlDraw }, + { NAMEKEY_INVALID, "W3DGadgetTabControlImageDraw", (void*)W3DGadgetTabControlImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetListBoxDraw", (void*)W3DGadgetListBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetListBoxImageDraw", (void*)W3DGadgetListBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetComboBoxDraw", (void*)W3DGadgetComboBoxDraw }, + { NAMEKEY_INVALID, "W3DGadgetComboBoxImageDraw", (void*)W3DGadgetComboBoxImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderDraw", (void*)W3DGadgetHorizontalSliderDraw }, + { NAMEKEY_INVALID, "W3DGadgetHorizontalSliderImageDraw", (void*)W3DGadgetHorizontalSliderImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetVerticalSliderDraw", (void*)W3DGadgetVerticalSliderDraw }, + { NAMEKEY_INVALID, "W3DGadgetVerticalSliderImageDraw", (void*)W3DGadgetVerticalSliderImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetProgressBarDraw", (void*)W3DGadgetProgressBarDraw }, + { NAMEKEY_INVALID, "W3DGadgetProgressBarImageDraw", (void*)W3DGadgetProgressBarImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetStaticTextDraw", (void*)W3DGadgetStaticTextDraw }, + { NAMEKEY_INVALID, "W3DGadgetStaticTextImageDraw", (void*)W3DGadgetStaticTextImageDraw }, + { NAMEKEY_INVALID, "W3DGadgetTextEntryDraw", (void*)W3DGadgetTextEntryDraw }, + { NAMEKEY_INVALID, "W3DGadgetTextEntryImageDraw", (void*)W3DGadgetTextEntryImageDraw }, + + { NAMEKEY_INVALID, "W3DLeftHUDDraw", (void*)W3DLeftHUDDraw }, + { NAMEKEY_INVALID, "W3DCameoMovieDraw", (void*)W3DCameoMovieDraw }, + { NAMEKEY_INVALID, "W3DRightHUDDraw", (void*)W3DRightHUDDraw }, + { NAMEKEY_INVALID, "W3DPowerDraw", (void*)W3DPowerDraw }, + { NAMEKEY_INVALID, "W3DMainMenuDraw", (void*)W3DMainMenuDraw }, + { NAMEKEY_INVALID, "W3DMainMenuFourDraw", (void*)W3DMainMenuFourDraw }, + { NAMEKEY_INVALID, "W3DMetalBarMenuDraw", (void*)W3DMetalBarMenuDraw }, + { NAMEKEY_INVALID, "W3DCreditsMenuDraw", (void*)W3DCreditsMenuDraw }, + { NAMEKEY_INVALID, "W3DClockDraw", (void*)W3DClockDraw }, + { NAMEKEY_INVALID, "W3DMainMenuMapBorder", (void*)W3DMainMenuMapBorder }, + { NAMEKEY_INVALID, "W3DMainMenuButtonDropShadowDraw", (void*)W3DMainMenuButtonDropShadowDraw }, + { NAMEKEY_INVALID, "W3DMainMenuRandomTextDraw", (void*)W3DMainMenuRandomTextDraw }, + { NAMEKEY_INVALID, "W3DThinBorderDraw", (void*)W3DThinBorderDraw }, + { NAMEKEY_INVALID, "W3DShellMenuSchemeDraw", (void*)W3DShellMenuSchemeDraw }, + { NAMEKEY_INVALID, "W3DCommandBarBackgroundDraw", (void*)W3DCommandBarBackgroundDraw }, + { NAMEKEY_INVALID, "W3DCommandBarTopDraw", (void*)W3DCommandBarTopDraw }, + { NAMEKEY_INVALID, "W3DCommandBarGenExpDraw", (void*)W3DCommandBarGenExpDraw }, + { NAMEKEY_INVALID, "W3DCommandBarHelpPopupDraw", (void*)W3DCommandBarHelpPopupDraw }, + + { NAMEKEY_INVALID, "W3DCommandBarGridDraw", (void*)W3DCommandBarGridDraw }, + + + { NAMEKEY_INVALID, "W3DCommandBarForegroundDraw", (void*)W3DCommandBarForegroundDraw }, + { NAMEKEY_INVALID, "W3DNoDraw", (void*)W3DNoDraw }, + { NAMEKEY_INVALID, "W3DDrawMapPreview", (void*)W3DDrawMapPreview }, + + { NAMEKEY_INVALID, nullptr, nullptr } }; @@ -103,9 +103,9 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = static FunctionLexicon::TableEntry layoutInitTable [] = { - { NAMEKEY_INVALID, "W3DMainMenuInit", W3DMainMenuInit }, + { NAMEKEY_INVALID, "W3DMainMenuInit", (void*)W3DMainMenuInit }, - { NAMEKEY_INVALID, nullptr, nullptr }, + { NAMEKEY_INVALID, nullptr, nullptr } }; From 29dc6b40c50859e859c4d13ae84c6de78ea7073f Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Fri, 16 Jan 2026 12:00:59 +0000 Subject: [PATCH 094/211] fix(debug): Simplify unconditional DEBUG_ASSERTCRASH to DEBUG_CRASH (#2067) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace DEBUG_ASSERTCRASH(nullptr, ...) with DEBUG_CRASH(...) for unconditional crash assertions in MinGW-w64 debug builds. Changes: - PlayerTemplate.cpp: DEBUG_ASSERTCRASH(nullptr) → DEBUG_CRASH - ChallengeGenerals.cpp: DEBUG_ASSERTCRASH(nullptr) → DEBUG_CRASH - LoadScreen.cpp: 2× DEBUG_ASSERTCRASH(nullptr) → DEBUG_CRASH Total: 4 instances simplified across GeneralsMD codebase Rationale: DEBUG_ASSERTCRASH(nullptr, ...) was causing compilation errors with MinGW-w64 due to implicit nullptr-to-bool conversion. These instances represent "unconditional crash" assertions (always false condition). The DEBUG_CRASH macro is the semantically correct choice for this use case, making the intent explicit and avoiding type conversion issues. Error resolved: error: converting to 'bool' from 'std::nullptr_t' requires direct-initialization [-fpermissive] Historical note: These instances were introduced by commit f891c5f3 ("refactor: Modernize NULL to nullptr"). The original NULL was semantically 0 (false), not a null pointer check. Affects: GeneralsMD debug builds only --- .../Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp | 2 +- .../GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp | 2 +- .../Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 81c5cf6b32d..501e9e9d5b6 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -294,7 +294,7 @@ Int PlayerTemplateStore::getTemplateNumByName(AsciiString name) const if (m_playerTemplates[num].getName().compareNoCase(name.str()) == 0) return num; } - DEBUG_ASSERTCRASH(nullptr, ("Template doesn't exist for given name")); + DEBUG_CRASH(("Template doesn't exist for given name")); return -1; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp index ffe9a6b0974..eb5adf62d1b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp @@ -133,7 +133,7 @@ const GeneralPersona* ChallengeGenerals::getPlayerGeneralByCampaignName( AsciiSt if (campaignName.compareNoCase( name.str() ) == 0) return &m_position[i]; } - DEBUG_ASSERTCRASH(nullptr, ("Can't find General by Campaign Name")); + DEBUG_CRASH(("Can't find General by Campaign Name")); return nullptr; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 08717b8c6db..f0234729cb5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -1308,7 +1308,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) else if (pt->getName() == "FactionChina") portrait = TheMappedImageCollection->findImageByName("SNFactionLogoLg_China"); else - DEBUG_ASSERTCRASH(nullptr, ("Unexpected player template")); + DEBUG_CRASH(("Unexpected player template")); localName = pt->getDisplayName(); } @@ -1579,7 +1579,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); else if (pt->getName() == "FactionChina") portrait = TheMappedImageCollection->findImageByName("SNFactionLogo144_China"); else - DEBUG_ASSERTCRASH(nullptr, ("Unexpected player template")); + DEBUG_CRASH(("Unexpected player template")); localName = pt->getDisplayName(); } From f244a23c2e0095bb151b7e40dabb090cc6c2fe9d Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Mon, 19 Jan 2026 21:06:50 +0000 Subject: [PATCH 095/211] feat(cmake): Add debug symbol stripping for MinGW Release builds (#2067) Implement complete debug symbol separation for MinGW-w64 Release builds, matching MSVC PDB workflow. Debug symbols are now generated with -g and then stripped to separate .debug files post-build. Changes: - cmake/debug_strip.cmake: New module with add_debug_strip_target() function - Automatically finds toolchain objcopy and strip tools - Three-step process: extract symbols, strip exe, add debug link - Only applies to Release builds (Debug keeps embedded symbols) - cmake/compilers.cmake: Enable -g for all Release builds - Removed MinGW exception that was skipping debug symbols - Added comment explaining stripping workflow - CMakeLists.txt: Include debug_strip.cmake module - Generals/Code/Main/CMakeLists.txt: Apply stripping to g_generals - GeneralsMD/Code/Main/CMakeLists.txt: Apply stripping to z_generals Result files (Release): - generalsv.exe (12 MB, stripped) + generalsv.exe.debug (231 MB, symbols) - generalszh.exe (13 MB, stripped) + generalszh.exe.debug (250 MB, symbols) Benefits: - Crash dump analysis support (crashpad, breakpad) - Post-mortem debugging with full symbols - Performance profiling of optimized code - Parity with MSVC (exe + pdb workflow) - Smaller shipped binaries (symbols separate) Debug builds keep symbols embedded for development convenience. Tools used: GNU Binutils objcopy and strip --- CMakeLists.txt | 3 + Generals/Code/Main/CMakeLists.txt | 6 ++ GeneralsMD/Code/Main/CMakeLists.txt | 6 ++ cmake/compilers.cmake | 9 ++- cmake/debug_strip.cmake | 92 +++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 cmake/debug_strip.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f55b4f4f99..e6a43be6ed6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,9 @@ project(genzh LANGUAGES C CXX) # This file handles extra settings wanted/needed for different compilers. include(cmake/compilers.cmake) +# Debug symbol stripping for Release builds (MinGW) +include(cmake/debug_strip.cmake) + include(FetchContent) # MinGW-w64 specific configuration diff --git a/Generals/Code/Main/CMakeLists.txt b/Generals/Code/Main/CMakeLists.txt index 5e9aa4c9cf1..9e14a4cbe75 100644 --- a/Generals/Code/Main/CMakeLists.txt +++ b/Generals/Code/Main/CMakeLists.txt @@ -85,3 +85,9 @@ if(MSVC) RTS.RC ) endif() + +# Strip debug symbols to separate file for MinGW Release builds +# This creates generalsv.exe.debug (similar to MSVC .pdb files) +if(MINGW AND COMMAND add_debug_strip_target) + add_debug_strip_target(g_generals) +endif() diff --git a/GeneralsMD/Code/Main/CMakeLists.txt b/GeneralsMD/Code/Main/CMakeLists.txt index 49cee59a1ec..d6518f442ba 100644 --- a/GeneralsMD/Code/Main/CMakeLists.txt +++ b/GeneralsMD/Code/Main/CMakeLists.txt @@ -74,3 +74,9 @@ if(MSVC) RTS.RC ) endif() + +# Strip debug symbols to separate file for MinGW Release builds +# This creates generalszh.exe.debug (similar to MSVC .pdb files) +if(MINGW AND COMMAND add_debug_strip_target) + add_debug_strip_target(z_generals) +endif() diff --git a/cmake/compilers.cmake b/cmake/compilers.cmake index f9478fc4a50..523a07e946d 100644 --- a/cmake/compilers.cmake +++ b/cmake/compilers.cmake @@ -34,11 +34,10 @@ if(MSVC) add_link_options("/INCREMENTAL:NO") else() # We go a bit wild here and assume any other compiler we are going to use supports -g for debug info. - # For MinGW, skip adding -g to Release builds - if(NOT (MINGW AND CMAKE_BUILD_TYPE STREQUAL "Release")) - string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g") - string(APPEND CMAKE_C_FLAGS_RELEASE " -g") - endif() + # Add debug symbols to Release builds for crash dump analysis, profiling, and post-mortem debugging. + # For MinGW, symbols will be stripped to separate .debug files (matching MSVC PDB workflow). + string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g") + string(APPEND CMAKE_C_FLAGS_RELEASE " -g") endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/cmake/debug_strip.cmake b/cmake/debug_strip.cmake new file mode 100644 index 00000000000..be61f69699b --- /dev/null +++ b/cmake/debug_strip.cmake @@ -0,0 +1,92 @@ +# TheSuperHackers @build JohnsterID 05/01/2026 Add debug symbol stripping for MinGW Release builds +# Debug Symbol Stripping for MinGW-w64 Release Builds +# +# Separates debug symbols from executables into .debug files, matching MSVC PDB workflow. +# This reduces shipped binary size while preserving symbols for crash analysis. + +# Find the required tools for symbol stripping +if(MINGW) + # Use the cross-compiler toolchain's objcopy and strip + # These should be in the same directory as the compiler + get_filename_component(COMPILER_DIR ${CMAKE_CXX_COMPILER} DIRECTORY) + + find_program(MINGW_OBJCOPY + NAMES ${CMAKE_CXX_COMPILER_TARGET}-objcopy + ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-objcopy + objcopy + HINTS ${COMPILER_DIR} + DOC "MinGW objcopy tool for extracting debug symbols" + ) + + find_program(MINGW_STRIP + NAMES ${CMAKE_CXX_COMPILER_TARGET}-strip + ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-strip + strip + HINTS ${COMPILER_DIR} + DOC "MinGW strip tool for removing debug symbols" + ) + + if(MINGW_OBJCOPY AND MINGW_STRIP) + message(STATUS "Debug symbol stripping enabled:") + message(STATUS " objcopy: ${MINGW_OBJCOPY}") + message(STATUS " strip: ${MINGW_STRIP}") + set(DEBUG_STRIP_AVAILABLE TRUE) + else() + message(WARNING "Debug symbol stripping not available - tools not found") + if(NOT MINGW_OBJCOPY) + message(WARNING " objcopy not found") + endif() + if(NOT MINGW_STRIP) + message(WARNING " strip not found") + endif() + set(DEBUG_STRIP_AVAILABLE FALSE) + endif() + + # Function to strip debug symbols from a target and create a separate .debug file + # + # This implements a three-step process: + # 1. Extract debug symbols to separate file + # 2. Strip debug symbols from main executable + # 3. Add debug link so debuggers can find the symbols + # + # Usage: + # add_debug_strip_target(target_name) + # + # Result (for Release builds only): + # program.exe - Stripped executable (smaller) + # program.exe.debug - Debug symbols (can be distributed separately) + # + function(add_debug_strip_target target_name) + if(NOT DEBUG_STRIP_AVAILABLE) + return() + endif() + + # Only strip Release builds + # Debug builds keep symbols embedded for development convenience + if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_custom_command(TARGET ${target_name} POST_BUILD + # Step 1: Extract all debug sections to separate file + COMMAND ${MINGW_OBJCOPY} + --only-keep-debug + $ + $.debug + + # Step 2: Strip debug sections from executable + COMMAND ${MINGW_STRIP} + --strip-debug + --strip-unneeded + $ + + # Step 3: Add GNU debug link (debuggers use this to find symbols) + COMMAND ${MINGW_OBJCOPY} + --add-gnu-debuglink=$.debug + $ + + COMMENT "Stripping debug symbols from ${target_name} (Release)" + VERBATIM + ) + + message(STATUS "Debug symbol stripping configured for target: ${target_name}") + endif() + endfunction() +endif() From 3de159161baaddce6749f22ae662f1afcd3f7659 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 22 Jan 2026 19:15:06 +0100 Subject: [PATCH 096/211] refactor(bitflags): Simplify and improve setup for DAMAGE_TYPE_FLAGS_ALL, DISABLEDMASK_ALL, KINDOFMASK_FS (#2159) --- .../Code/GameEngine/Include/Common/BitFlags.h | 48 +++++++------------ .../GameEngine/Include/Common/DisabledTypes.h | 1 - .../GameEngine/Include/Common/ModelState.h | 1 - .../GameEngine/Source/Common/GameEngine.cpp | 4 -- .../Source/Common/System/DisabledTypes.cpp | 7 +-- .../Code/GameEngine/Include/Common/BitFlags.h | 48 +++++++------------ .../GameEngine/Include/Common/DisabledTypes.h | 1 - .../Code/GameEngine/Include/Common/KindOf.h | 1 - .../GameEngine/Include/Common/ModelState.h | 1 - .../GameEngine/Include/GameLogic/Damage.h | 1 - .../GameEngine/Source/Common/GameEngine.cpp | 6 --- .../Code/GameEngine/Source/Common/INI/INI.cpp | 6 +-- .../Source/Common/System/DisabledTypes.cpp | 7 +-- .../Source/Common/System/KindOf.cpp | 37 +++++++------- .../Object/Damage/TransitionDamageFX.cpp | 9 ++-- .../GameLogic/Object/Update/BoneFXUpdate.cpp | 9 ++-- .../Source/GameLogic/System/Damage.cpp | 7 +-- 17 files changed, 65 insertions(+), 129 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index 65d5944a6ff..6d06b54c8bd 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -58,15 +58,21 @@ class BitFlags /* just a little syntactic sugar so that there is no "foo = 0" compatible constructor */ - enum BogusInitType - { - kInit = 0 - }; + enum BogusInitType { kInit }; + enum InitSetAllType { kInitSetAll }; BitFlags() { } + // This constructor sets all bits to 1 + BitFlags(InitSetAllType) + { + m_bits.set(); + } + + // TheSuperHackers @todo Replace with variadic template + BitFlags(BogusInitType k, Int idx1) { m_bits.set(idx1); @@ -102,33 +108,15 @@ class BitFlags m_bits.set(idx5); } - BitFlags(BogusInitType k, - Int idx1, - Int idx2, - Int idx3, - Int idx4, - Int idx5, - Int idx6, - Int idx7, - Int idx8, - Int idx9, - Int idx10, - Int idx11, - Int idx12 - ) + // Set all given indices in the array. + BitFlags(BogusInitType, const Int* idxs, Int count) { - m_bits.set(idx1); - m_bits.set(idx2); - m_bits.set(idx3); - m_bits.set(idx4); - m_bits.set(idx5); - m_bits.set(idx6); - m_bits.set(idx7); - m_bits.set(idx8); - m_bits.set(idx9); - m_bits.set(idx10); - m_bits.set(idx11); - m_bits.set(idx12); + const Int* idx = idxs; + const Int* end = idxs + count; + for (; idx < end; ++idx) + { + m_bits.set(*idx); + } } Bool operator==(const BitFlags& that) const diff --git a/Generals/Code/GameEngine/Include/Common/DisabledTypes.h b/Generals/Code/GameEngine/Include/Common/DisabledTypes.h index 0e9991675c9..eb7e004eeb3 100644 --- a/Generals/Code/GameEngine/Include/Common/DisabledTypes.h +++ b/Generals/Code/GameEngine/Include/Common/DisabledTypes.h @@ -105,4 +105,3 @@ inline void FLIP_DISABLEDMASK(DisabledMaskType& m) extern const char *TheDisabledNames[]; extern DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes extern DisabledMaskType DISABLEDMASK_ALL; // inits to all bits set. -void initDisabledMasks(); diff --git a/Generals/Code/GameEngine/Include/Common/ModelState.h b/Generals/Code/GameEngine/Include/Common/ModelState.h index c0f61d875b7..b0eb182a2e0 100644 --- a/Generals/Code/GameEngine/Include/Common/ModelState.h +++ b/Generals/Code/GameEngine/Include/Common/ModelState.h @@ -222,7 +222,6 @@ typedef BitFlags ModelConditionFlags; #define MAKE_MODELCONDITION_MASK3(k,a,b) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b)) #define MAKE_MODELCONDITION_MASK4(k,a,b,c) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b), (c)) #define MAKE_MODELCONDITION_MASK5(k,a,b,c,d) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b), (c), (d)) -#define MAKE_MODELCONDITION_MASK12(a,b,c,d,e,f,g,h,i,j,k,l) ModelConditionFlags(ModelConditionFlags::kInit, (a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), (l)) //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index e6cc7f309fd..e429cebda68 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -564,8 +564,6 @@ void GameEngine::init() if(!TheGlobalData->m_playIntro) TheWritableGlobalData->m_afterIntro = TRUE; - initDisabledMasks(); - } catch (ErrorCode ec) { @@ -590,8 +588,6 @@ void GameEngine::init() if(!TheGlobalData->m_playIntro) TheWritableGlobalData->m_afterIntro = TRUE; - initDisabledMasks(); - resetSubsystems(); HideControlBar(); diff --git a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 339d71f9b1b..93e30cbe4b0 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -50,9 +50,4 @@ const char* const DisabledMaskType::s_bitNameList[] = static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes -DisabledMaskType DISABLEDMASK_ALL; - -void initDisabledMasks() -{ - SET_ALL_DISABLEDMASK_BITS( DISABLEDMASK_ALL ); -} +DisabledMaskType DISABLEDMASK_ALL(DisabledMaskType::kInitSetAll); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h index 28b2ab870e1..bb7d13f0430 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h @@ -58,15 +58,21 @@ class BitFlags /* just a little syntactic sugar so that there is no "foo = 0" compatible constructor */ - enum BogusInitType - { - kInit = 0 - }; + enum BogusInitType { kInit }; + enum InitSetAllType { kInitSetAll }; BitFlags() { } + // This constructor sets all bits to 1 + BitFlags(InitSetAllType) + { + m_bits.set(); + } + + // TheSuperHackers @todo Replace with variadic template + BitFlags(BogusInitType k, Int idx1) { m_bits.set(idx1); @@ -102,33 +108,15 @@ class BitFlags m_bits.set(idx5); } - BitFlags(BogusInitType k, - Int idx1, - Int idx2, - Int idx3, - Int idx4, - Int idx5, - Int idx6, - Int idx7, - Int idx8, - Int idx9, - Int idx10, - Int idx11, - Int idx12 - ) + // Set all given indices in the array. + BitFlags(BogusInitType, const Int* idxs, Int count) { - m_bits.set(idx1); - m_bits.set(idx2); - m_bits.set(idx3); - m_bits.set(idx4); - m_bits.set(idx5); - m_bits.set(idx6); - m_bits.set(idx7); - m_bits.set(idx8); - m_bits.set(idx9); - m_bits.set(idx10); - m_bits.set(idx11); - m_bits.set(idx12); + const Int* idx = idxs; + const Int* end = idxs + count; + for (; idx < end; ++idx) + { + m_bits.set(*idx); + } } Bool operator==(const BitFlags& that) const diff --git a/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h index 68812c8aa8c..de61b555344 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/DisabledTypes.h @@ -110,4 +110,3 @@ inline void FLIP_DISABLEDMASK(DisabledMaskType& m) // defined in Common/System/DisabledTypes.cpp extern DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes extern DisabledMaskType DISABLEDMASK_ALL; // inits to all bits set. -void initDisabledMasks(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h index f028c41d68c..ab6736ec2cf 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h @@ -215,4 +215,3 @@ inline void FLIP_KINDOFMASK(KindOfMaskType& m) // defined in Common/System/Kindof.cpp extern KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes extern KindOfMaskType KINDOFMASK_FS; // Initializes all FS types for faction structures. -void initKindOfMasks(); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h index 2d1df8f0b6b..8d2b8bbd3c7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h @@ -250,7 +250,6 @@ typedef BitFlags ModelConditionFlags; #define MAKE_MODELCONDITION_MASK3(k,a,b) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b)) #define MAKE_MODELCONDITION_MASK4(k,a,b,c) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b), (c)) #define MAKE_MODELCONDITION_MASK5(k,a,b,c,d) ModelConditionFlags(ModelConditionFlags::kInit, (k), (a), (b), (c), (d)) -#define MAKE_MODELCONDITION_MASK12(a,b,c,d,e,f,g,h,i,j,k,l) ModelConditionFlags(ModelConditionFlags::kInit, (a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), (l)) //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h index c20f6949f01..2f145c08ad9 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h @@ -155,7 +155,6 @@ inline void SET_ALL_DAMAGE_TYPE_BITS(DamageTypeFlags& m) extern DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE; extern DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL; -void initDamageTypeFlags(); //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index c37b6e99b04..5aa3a1e7b4d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -731,8 +731,6 @@ void GameEngine::init() if(!TheGlobalData->m_playIntro) TheWritableGlobalData->m_afterIntro = TRUE; - //initDisabledMasks(); - } catch (ErrorCode ec) { @@ -757,10 +755,6 @@ void GameEngine::init() if(!TheGlobalData->m_playIntro) TheWritableGlobalData->m_afterIntro = TRUE; - initKindOfMasks(); - initDisabledMasks(); - initDamageTypeFlags(); - resetSubsystems(); HideControlBar(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index b91fa9eb3f6..344f4de72e9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -1838,15 +1838,13 @@ void INI::parseSoundsList( INI* ini, void *instance, void *store, const void* /* //------------------------------------------------------------------------------------------------- void INI::parseDamageTypeFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/) { - DamageTypeFlags flags = DAMAGE_TYPE_FLAGS_NONE; - flags.flip(); + DamageTypeFlags flags = DAMAGE_TYPE_FLAGS_ALL; for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull()) { if (stricmp(token, "ALL") == 0) { - flags = DAMAGE_TYPE_FLAGS_NONE; - flags.flip(); + flags = DAMAGE_TYPE_FLAGS_ALL; continue; } if (stricmp(token, "NONE") == 0) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index e1259282ec0..5270dab6c33 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -54,9 +54,4 @@ const char* const DisabledMaskType::s_bitNameList[] = static_assert(ARRAY_SIZE(DisabledMaskType::s_bitNameList) == DisabledMaskType::NumBits + 1, "Incorrect array size"); DisabledMaskType DISABLEDMASK_NONE; // inits to all zeroes -DisabledMaskType DISABLEDMASK_ALL; - -void initDisabledMasks() -{ - SET_ALL_DISABLEDMASK_BITS( DISABLEDMASK_ALL ); -} +DisabledMaskType DISABLEDMASK_ALL(DisabledMaskType::kInitSetAll); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp index faae7432629..cd07c9f3504 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -163,23 +163,22 @@ const char* const KindOfMaskType::s_bitNameList[] = }; static_assert(ARRAY_SIZE(KindOfMaskType::s_bitNameList) == KindOfMaskType::NumBits + 1, "Incorrect array size"); -KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes -KindOfMaskType KINDOFMASK_FS; // inits to all zeroes +static const Int fsList[] = { + KINDOF_FS_FACTORY, + KINDOF_FS_BASE_DEFENSE, + KINDOF_FS_TECHNOLOGY, + KINDOF_FS_SUPPLY_DROPZONE, + KINDOF_FS_SUPERWEAPON, + KINDOF_FS_BLACK_MARKET, + KINDOF_FS_SUPPLY_CENTER, + KINDOF_FS_STRATEGY_CENTER, + KINDOF_FS_FAKE, + KINDOF_FS_INTERNET_CENTER, + KINDOF_FS_ADVANCED_TECH, + KINDOF_FS_BARRACKS, + KINDOF_FS_WARFACTORY, + KINDOF_FS_AIRFIELD, +}; -void initKindOfMasks() -{ - KINDOFMASK_FS.set( KINDOF_FS_FACTORY ); - KINDOFMASK_FS.set( KINDOF_FS_BASE_DEFENSE ); - KINDOFMASK_FS.set( KINDOF_FS_TECHNOLOGY ); - KINDOFMASK_FS.set( KINDOF_FS_SUPPLY_DROPZONE ); - KINDOFMASK_FS.set( KINDOF_FS_SUPERWEAPON ); - KINDOFMASK_FS.set( KINDOF_FS_BLACK_MARKET ); - KINDOFMASK_FS.set( KINDOF_FS_SUPPLY_CENTER ); - KINDOFMASK_FS.set( KINDOF_FS_STRATEGY_CENTER ); - KINDOFMASK_FS.set( KINDOF_FS_FAKE ); - KINDOFMASK_FS.set( KINDOF_FS_INTERNET_CENTER ); - KINDOFMASK_FS.set( KINDOF_FS_ADVANCED_TECH ); - KINDOFMASK_FS.set( KINDOF_FS_BARRACKS ); - KINDOFMASK_FS.set( KINDOF_FS_WARFACTORY ); - KINDOFMASK_FS.set( KINDOF_FS_AIRFIELD ); -} +KindOfMaskType KINDOFMASK_NONE; // inits to all zeroes +KindOfMaskType KINDOFMASK_FS(KindOfMaskType::kInit, fsList, ARRAY_SIZE(fsList)); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp index 43251f8ef3e..4918348b41e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Damage/TransitionDamageFX.cpp @@ -73,12 +73,9 @@ TransitionDamageFXModuleData::TransitionDamageFXModuleData( void ) } - m_damageFXTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageFXTypes.flip(); - m_damageOCLTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageOCLTypes.flip(); - m_damageParticleTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageParticleTypes.flip(); + m_damageFXTypes = DAMAGE_TYPE_FLAGS_ALL; + m_damageOCLTypes = DAMAGE_TYPE_FLAGS_ALL; + m_damageParticleTypes = DAMAGE_TYPE_FLAGS_ALL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp index efbb3e358be..5cc8c03700b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BoneFXUpdate.cpp @@ -63,12 +63,9 @@ BoneFXUpdateModuleData::BoneFXUpdateModuleData(void) } } - m_damageFXTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageFXTypes.flip(); - m_damageOCLTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageOCLTypes.flip(); - m_damageParticleTypes = DAMAGE_TYPE_FLAGS_NONE; - m_damageParticleTypes.flip(); + m_damageFXTypes = DAMAGE_TYPE_FLAGS_ALL; + m_damageOCLTypes = DAMAGE_TYPE_FLAGS_ALL; + m_damageParticleTypes = DAMAGE_TYPE_FLAGS_ALL; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 88e6204e5d0..27cc95b00e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -86,12 +86,7 @@ const char* const DamageTypeFlags::s_bitNameList[] = static_assert(ARRAY_SIZE(DamageTypeFlags::s_bitNameList) == DamageTypeFlags::NumBits + 1, "Incorrect array size"); DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE; // inits to all zeroes -DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL; - -void initDamageTypeFlags() -{ - SET_ALL_DAMAGE_TYPE_BITS( DAMAGE_TYPE_FLAGS_ALL ); -} +DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL(DamageTypeFlags::kInitSetAll); // ------------------------------------------------------------------------------------------------ /** Xfer method From ccd36fe9e190977537289f471b223f2978f30dc8 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 22 Jan 2026 21:53:27 +0100 Subject: [PATCH 097/211] build(cmake): Dial back BINK upgrade to get the CMake INSTALL target to work again (#2167) --- cmake/bink.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/bink.cmake b/cmake/bink.cmake index 83b5317568a..a851f6c8ca3 100644 --- a/cmake/bink.cmake +++ b/cmake/bink.cmake @@ -1,7 +1,7 @@ FetchContent_Declare( bink GIT_REPOSITORY https://github.com/TheSuperHackers/bink-sdk-stub.git - GIT_TAG 3241ee1e3739b21d9c0a0760c1a5d5622d21c093 + GIT_TAG 180fc4620ed72fd700347ab837a5271fd0259901 ) FetchContent_MakeAvailable(bink) From d38f6925abd1e885ccf09d4a4cef8b69e2fb5747 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 22 Jan 2026 21:54:42 +0100 Subject: [PATCH 098/211] unify(damage): Merge DamageTypeFlags from Zero Hour (#2141) --- .../Code/GameEngine/Include/Common/BitFlags.h | 16 ++ .../GameEngine/Include/GameLogic/Damage.h | 156 ++++++++++-------- .../GameEngine/Include/GameLogic/WeaponSet.h | 7 +- .../GameEngine/Source/Common/DamageFX.cpp | 4 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 6 +- .../Source/GameLogic/Object/Armor.cpp | 3 +- .../Source/GameLogic/Object/Die/FXListDie.cpp | 1 - .../Update/ParticleUplinkCannonUpdate.cpp | 3 +- .../Source/GameLogic/Object/Weapon.cpp | 3 +- .../Source/GameLogic/Object/WeaponSet.cpp | 35 +++- .../Source/GameLogic/System/Damage.cpp | 92 ++++++++++- .../Code/GameEngine/Include/Common/BitFlags.h | 16 ++ .../GameEngine/Include/GameLogic/Damage.h | 17 +- .../Source/GameLogic/Object/WeaponSet.cpp | 29 +++- .../Source/GameLogic/System/Damage.cpp | 25 ++- 15 files changed, 302 insertions(+), 111 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index 6d06b54c8bd..ed6bee9fd2f 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -71,6 +71,11 @@ class BitFlags m_bits.set(); } + BitFlags(UnsignedInt value) + : m_bits(static_cast(value)) + { + } + // TheSuperHackers @todo Replace with variadic template BitFlags(BogusInitType k, Int idx1) @@ -247,6 +252,17 @@ class BitFlags return true; } + // TheSuperHackers @info Function for rare use cases where we must access the flags as an integer. + // Not using to_ulong because that can throw. Truncates all bits above 32. + UnsignedInt toUnsignedInt() const noexcept + { + UnsignedInt val = 0; + const UnsignedInt count = min(m_bits.size(), sizeof(val) * 8); + for (UnsignedInt i = 0; i < count; ++i) + val |= m_bits.test(i) * (1u << i); + return val; + } + static const char* const* getBitNames() { return s_bitNameList; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Damage.h b/Generals/Code/GameEngine/Include/GameLogic/Damage.h index e4f5c9fc88c..df77815b168 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Damage.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Damage.h @@ -30,15 +30,19 @@ #pragma once // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// +#include "Common/BitFlags.h" #include "Common/GameType.h" +#include "Common/ObjectStatusTypes.h" // Precompiled header anyway, no detangling possibility #include "Common/Snapshot.h" + // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// class Object; class INI; +class ThingTemplate; //------------------------------------------------------------------------------------------------- -/** Damage types, keep this in sync with TheDamageNames[] */ +/** Damage types, keep this in sync with DamageTypeFlags::s_bitNameList[] */ //------------------------------------------------------------------------------------------------- enum DamageType CPP_11(: Int) { @@ -56,7 +60,6 @@ enum DamageType CPP_11(: Int) DAMAGE_UNRESISTABLE = 11, // this is for scripting to cause 'armorproof' damage DAMAGE_WATER = 12, DAMAGE_DEPLOY = 13, // for transports to deploy units and order them to all attack. -// this stays, even if ALLOW_SURRENDER is not defed, since flashbangs still use 'em DAMAGE_SURRENDER = 14, // if something "dies" to surrender damage, they surrender.... duh! DAMAGE_HACK = 15, DAMAGE_KILLPILOT = 16, // special snipe attack that kills the pilot and renders a vehicle unmanned. @@ -74,93 +77,89 @@ enum DamageType CPP_11(: Int) DAMAGE_STEALTHJET_MISSILES = 28, DAMAGE_MOLOTOV_COCKTAIL = 29, DAMAGE_COMANCHE_VULCAN = 30, +#if RTS_GENERALS DAMAGE_FLESHY_SNIPER = 31, // like DAMAGE_SNIPER, but (generally) does no damage to vehicles. +#endif + DAMAGE_SUBDUAL_MISSILE /*= 31*/, ///< Damage that does not kill you, but produces some special effect based on your Body Module. Separate HP from normal damage. + DAMAGE_SUBDUAL_VEHICLE /*= 32*/, + DAMAGE_SUBDUAL_BUILDING /*= 33*/, + DAMAGE_SUBDUAL_UNRESISTABLE /*= 34*/, + DAMAGE_MICROWAVE /*= 35*/, ///< Radiation that only affects infantry + DAMAGE_KILL_GARRISONED /*= 36*/, ///< Kills Passengers up to the number specified in Damage + DAMAGE_STATUS /*= 37*/, ///< Damage that gives a status condition, not that does hitpoint damage - // Please note: There is a string array below this enum, and when you change them, - // you need to search on the array names to find all the stuff that generates names - // based on these strings. (eg DamageFX does a strcat to make its array of names so - // change DamageFX.ini and its Default) - - - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // - // if you add additional damage types, you will PROBABLY HAVE TO - // ENLARGE A BITMASK IN WEAPONSET. - // - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // !!!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // Please note: There is a string array DamageTypeFlags::s_bitNameList[] DAMAGE_NUM_TYPES }; -#ifdef DEFINE_DAMAGE_NAMES -static const char *const TheDamageNames[] = -{ - "EXPLOSION", - "CRUSH", - "ARMOR_PIERCING", - "SMALL_ARMS", - "GATTLING", - "RADIATION", - "FLAME", - "LASER", - "SNIPER", - "POISON", - "HEALING", - "UNRESISTABLE", - "WATER", - "DEPLOY", - "SURRENDER", - "HACK", - "KILL_PILOT", - "PENALTY", - "FALLING", - "MELEE", - "DISARM", - "HAZARD_CLEANUP", - "PARTICLE_BEAM", - "TOPPLING", - "INFANTRY_MISSILE", - "AURORA_BOMB", - "LAND_MINE", - "JET_MISSILES", - "STEALTHJET_MISSILES", - "MOLOTOV_COCKTAIL", - "COMANCHE_VULCAN", - "FLESHY_SNIPER", - - nullptr -}; -static_assert(ARRAY_SIZE(TheDamageNames) == DAMAGE_NUM_TYPES + 1, "Incorrect array size"); -#endif // end DEFINE_DAMAGE_NAMES - - //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- -typedef UnsignedInt DamageTypeFlags; - -const DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL = 0xffffffff; -const DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE = 0x00000000; +typedef BitFlags DamageTypeFlags; inline Bool getDamageTypeFlag(DamageTypeFlags flags, DamageType dt) { - return (flags & (1UL << (dt - 1))) != 0; + return flags.test(dt); } inline DamageTypeFlags setDamageTypeFlag(DamageTypeFlags flags, DamageType dt) { - return (flags | (1UL << (dt - 1))); + flags.set(dt, TRUE); + return flags; } inline DamageTypeFlags clearDamageTypeFlag(DamageTypeFlags flags, DamageType dt) { - return (flags & ~(1UL << (dt - 1))); + flags.set(dt, FALSE); + return flags; +} + +// Instead of checking against a single damage type, gather the question here so we can have more than one +inline Bool IsSubdualDamage( DamageType type ) +{ + switch( type ) + { + case DAMAGE_SUBDUAL_MISSILE: + case DAMAGE_SUBDUAL_VEHICLE: + case DAMAGE_SUBDUAL_BUILDING: + case DAMAGE_SUBDUAL_UNRESISTABLE: + return TRUE; + } + + return FALSE; } +/// Does this type of damage go to internalChangeHealth? +inline Bool IsHealthDamagingDamage( DamageType type ) +{ + // The need for this function brought to you by "Have the guy with no game experience write the weapon code" Foundation. + // Health Damage should be one type of WeaponEffect. Thinking "Weapons can only do damage" is why AoE is boring. + switch( type ) + { + case DAMAGE_STATUS: + case DAMAGE_SUBDUAL_MISSILE: + case DAMAGE_SUBDUAL_VEHICLE: + case DAMAGE_SUBDUAL_BUILDING: + case DAMAGE_SUBDUAL_UNRESISTABLE: + case DAMAGE_KILLPILOT: + case DAMAGE_KILL_GARRISONED: + return FALSE; + } + + return TRUE; +} + +inline void SET_ALL_DAMAGE_TYPE_BITS(DamageTypeFlags& m) +{ + m.clear(); + m.flip(); +} + +extern DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE; +extern DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL; + + //------------------------------------------------------------------------------------------------- /** Death types, keep this in sync with TheDeathNames[] */ //------------------------------------------------------------------------------------------------- @@ -193,6 +192,7 @@ enum DeathType CPP_11(: Int) DEATH_EXTRA_6 = 17, DEATH_EXTRA_7 = 18, DEATH_EXTRA_8 = 19, + DEATH_POISONED_GAMMA = 20, DEATH_NUM_TYPES }; @@ -213,7 +213,6 @@ static const char *const TheDeathNames[] = "DETONATED", "SPLATTED", "POISONED_BETA", - "EXTRA_2", "EXTRA_3", "EXTRA_4", @@ -221,6 +220,7 @@ static const char *const TheDeathNames[] = "EXTRA_6", "EXTRA_7", "EXTRA_8", + "POISONED_GAMMA", nullptr }; @@ -262,17 +262,37 @@ class DamageInfoInput : public Snapshot DamageInfoInput( void ) { m_sourceID = INVALID_ID; + m_sourceTemplate = nullptr; m_sourcePlayerMask = 0; m_damageType = DAMAGE_EXPLOSION; + m_damageStatusType = OBJECT_STATUS_NONE; + m_damageFXOverride = DAMAGE_UNRESISTABLE; m_deathType = DEATH_NORMAL; m_amount = 0; + m_kill = FALSE; + + m_shockWaveVector.zero(); + m_shockWaveAmount = 0.0f; + m_shockWaveRadius = 0.0f; + m_shockWaveTaperOff = 0.0f; } ObjectID m_sourceID; ///< source of the damage + const ThingTemplate *m_sourceTemplate; ///< source of the damage (the template). PlayerMaskType m_sourcePlayerMask; ///< Player mask of m_sourceID. DamageType m_damageType; ///< type of damage + ObjectStatusTypes m_damageStatusType; ///< If status damage, what type + DamageType m_damageFXOverride; ///< If not marked as the default of Unresistable, the damage type to use in doDamageFX instead of the real damage type DeathType m_deathType; ///< if this kills us, death type to be used Real m_amount; ///< # value of how much damage to inflict + Bool m_kill; ///< will always cause object to die regardless of damage. + + // These are used for damage causing shockwave, forcing units affected to be pushed around + Coord3D m_shockWaveVector; ///< This represents the incoming damage vector + Real m_shockWaveAmount; ///< This represents the amount of shockwave created by the damage. 0 = no shockwave, 1.0 = shockwave equal to damage. + Real m_shockWaveRadius; ///< This represents the effect radius of the shockwave. + Real m_shockWaveTaperOff; ///< This represents the taper off effect of the shockwave at the tip of the radius. 0.0 means shockwave is 0% at the radius edge. + protected: diff --git a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h index b5c8fdbb568..3adcff2fce1 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h +++ b/Generals/Code/GameEngine/Include/GameLogic/WeaponSet.h @@ -32,6 +32,7 @@ #include "Common/ModelState.h" #include "Common/SparseMatchFinder.h" #include "Common/Snapshot.h" +#include "GameLogic/Damage.h" //------------------------------------------------------------------------------------------------- class INI; @@ -180,7 +181,7 @@ class WeaponSet : public Snapshot WeaponLockType m_curWeaponLockedStatus; UnsignedInt m_filledWeaponSlotMask; Int m_totalAntiMask; ///< anti mask of all current weapons - UnsignedInt m_totalDamageTypeMask; ///< damagetype mask of all current weapons + DamageTypeFlags m_totalDamageTypeMask; ///< damagetype mask of all current weapons Bool m_hasPitchLimit; Bool m_hasDamageWeapon; @@ -202,8 +203,8 @@ class WeaponSet : public Snapshot Bool isOutOfAmmo() const; Bool hasAnyWeapon() const { return m_filledWeaponSlotMask != 0; } Bool hasAnyDamageWeapon() const { return m_hasDamageWeapon; } - Bool hasWeaponToDealDamageType(DamageType typeToDeal) const { return (m_totalDamageTypeMask & (1 << typeToDeal)) != 0; } - Bool hasSingleDamageType(DamageType typeToDeal) const { return m_totalDamageTypeMask == (1 << typeToDeal); } + Bool hasWeaponToDealDamageType(DamageType typeToDeal) const { return m_totalDamageTypeMask.test(typeToDeal); } + Bool hasSingleDamageType(DamageType typeToDeal) const { return (m_totalDamageTypeMask.test(typeToDeal) && (m_totalDamageTypeMask.count() == 1) ); } Bool isCurWeaponLocked() const { return m_curWeaponLockedStatus != NOT_LOCKED; } Weapon* getCurWeapon() { return m_weapons[m_curWeapon]; } const Weapon* getCurWeapon() const { return m_weapons[m_curWeapon]; } diff --git a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp index 0b0b9cbb55e..b1d24b77fa2 100644 --- a/Generals/Code/GameEngine/Source/Common/DamageFX.cpp +++ b/Generals/Code/GameEngine/Source/Common/DamageFX.cpp @@ -31,8 +31,6 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES // for DamageNames[] - #include "Common/INI.h" #include "Common/ThingFactory.h" #include "Common/ThingTemplate.h" @@ -166,7 +164,7 @@ static void parseCommonStuff( } else { - damageFirst = (DamageType)INI::scanIndexList(damageName, TheDamageNames); + damageFirst = (DamageType)DamageTypeFlags::getSingleBitFromName(damageName); damageLast = damageFirst; } } diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index c9cf9cbee86..35729bfb52f 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -29,7 +29,6 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES #define DEFINE_DEATH_NAMES #include "Common/INI.h" @@ -1838,6 +1837,7 @@ void INI::parseSoundsList( INI* ini, void *instance, void *store, const void* /* void INI::parseDamageTypeFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/) { DamageTypeFlags flags = DAMAGE_TYPE_FLAGS_ALL; + for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull()) { if (stricmp(token, "ALL") == 0) @@ -1852,13 +1852,13 @@ void INI::parseDamageTypeFlags(INI* ini, void* /*instance*/, void* store, const } if (token[0] == '+') { - DamageType dt = (DamageType)INI::scanIndexList(token+1, TheDamageNames); + DamageType dt = (DamageType)DamageTypeFlags::getSingleBitFromName(token+1); flags = setDamageTypeFlag(flags, dt); continue; } if (token[0] == '-') { - DamageType dt = (DamageType)INI::scanIndexList(token+1, TheDamageNames); + DamageType dt = (DamageType)DamageTypeFlags::getSingleBitFromName(token+1); flags = clearDamageTypeFlag(flags, dt); continue; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp index b4e67c7f900..6051ce509cb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Armor.cpp @@ -30,7 +30,6 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES // for DamageNames[] #include "Common/INI.h" #include "Common/ThingFactory.h" @@ -95,7 +94,7 @@ Real ArmorTemplate::adjustDamage(DamageType t, Real damage) const return; } - DamageType dt = (DamageType)INI::scanIndexList(damageName, TheDamageNames); + DamageType dt = (DamageType)DamageTypeFlags::getSingleBitFromName(damageName); self->m_damageCoefficient[dt] = pct; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp index 2cb4d0adcd6..1a7727fad47 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Die/FXListDie.cpp @@ -31,7 +31,6 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES #include "Common/INI.h" #include "Common/ThingTemplate.h" #include "Common/Xfer.h" diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index 0abaa7cafe0..30b0230555f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -29,7 +29,6 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES #define DEFINE_DEATH_NAMES // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// @@ -136,7 +135,7 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData() { "DamagePerSecond", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damagePerSecond ) }, { "TotalDamagePulses", INI::parseUnsignedInt, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_totalDamagePulses ) }, - { "DamageType", INI::parseIndexList, TheDamageNames, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageType ) }, + { "DamageType", DamageTypeFlags::parseSingleBitFromINI, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageType ) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof( ParticleUplinkCannonUpdateModuleData, m_deathType ) }, { "DamageRadiusScalar", INI::parseReal, nullptr, offsetof( ParticleUplinkCannonUpdateModuleData, m_damageRadiusScalar ) }, diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 0551f708a57..10af5ac22b3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -30,7 +30,6 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DAMAGE_NAMES #define DEFINE_DEATH_NAMES #define DEFINE_WEAPONBONUSCONDITION_NAMES #define DEFINE_WEAPONBONUSFIELD_NAMES @@ -174,7 +173,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "ScatterRadius", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterRadius) }, { "ScatterTargetScalar", INI::parseReal, nullptr, offsetof(WeaponTemplate, m_scatterTargetScalar) }, { "ScatterRadiusVsInfantry", INI::parseReal, nullptr, offsetof( WeaponTemplate, m_infantryInaccuracyDist ) }, - { "DamageType", INI::parseIndexList, TheDamageNames, offsetof(WeaponTemplate, m_damageType) }, + { "DamageType", DamageTypeFlags::parseSingleBitFromINI, nullptr, offsetof(WeaponTemplate, m_damageType) }, { "DeathType", INI::parseIndexList, TheDeathNames, offsetof(WeaponTemplate, m_deathType) }, { "WeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_weaponSpeed) }, { "MinWeaponSpeed", INI::parseVelocityReal, nullptr, offsetof(WeaponTemplate, m_minWeaponSpeed) }, diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 460e6d25116..b2dc0fcbad9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -172,8 +172,7 @@ WeaponSet::WeaponSet() m_curWeaponTemplateSet = nullptr; m_filledWeaponSlotMask = 0; m_totalAntiMask = 0; - m_totalDamageTypeMask = 0; - DEBUG_ASSERTCRASH(DAMAGE_NUM_TYPES <= 32, ("m_totalDamageTypeMask will need to be enlarged in WeaponSet")); + m_totalDamageTypeMask.clear(); m_hasPitchLimit = false; m_hasDamageWeapon = false; for (Int i = 0; i < WEAPONSLOT_COUNT; ++i) @@ -198,12 +197,19 @@ void WeaponSet::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Upgrade damage type flags from integer to BitFlags for Generals. + * Zero Hour already had this at version 1. + */ // ------------------------------------------------------------------------------------------------ void WeaponSet::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 1; +#else + const XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -269,10 +275,25 @@ void WeaponSet::xfer( Xfer *xfer ) xfer->xferUser(&m_curWeaponLockedStatus, sizeof(m_curWeaponLockedStatus)); xfer->xferUnsignedInt(&m_filledWeaponSlotMask); xfer->xferInt(&m_totalAntiMask); - xfer->xferUnsignedInt(&m_totalDamageTypeMask); + +#if RTS_GENERALS + if (version < 2) + { + UnsignedInt totalDamageTypeMask = m_totalDamageTypeMask.toUnsignedInt(); + xfer->xferUnsignedInt(&totalDamageTypeMask); + m_totalDamageTypeMask = DamageTypeFlags(totalDamageTypeMask); + } +#endif + xfer->xferBool(&m_hasDamageWeapon); xfer->xferBool(&m_hasDamageWeapon); +#if RTS_GENERALS + if (version >= 2) +#endif + { + m_totalDamageTypeMask.xfer(xfer);// BitSet has built in xfer + } } // ------------------------------------------------------------------------------------------------ @@ -298,7 +319,7 @@ void WeaponSet::updateWeaponSet(const Object* obj) } m_filledWeaponSlotMask = 0; m_totalAntiMask = 0; - m_totalDamageTypeMask = 0; + m_totalDamageTypeMask.clear(); m_hasPitchLimit = false; m_hasDamageWeapon = false; for (Int i = WEAPONSLOT_COUNT - 1; i >= PRIMARY_WEAPON ; --i) @@ -312,7 +333,7 @@ void WeaponSet::updateWeaponSet(const Object* obj) m_weapons[i]->loadAmmoNow(obj); // start 'em all with full clips. m_filledWeaponSlotMask |= (1 << i); m_totalAntiMask |= m_weapons[i]->getAntiMask(); - m_totalDamageTypeMask |= (1 << m_weapons[i]->getDamageType()); + m_totalDamageTypeMask.set(m_weapons[i]->getDamageType()); if (m_weapons[i]->isPitchLimited()) m_hasPitchLimit = true; if (m_weapons[i]->isDamageWeapon()) @@ -534,7 +555,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac //care about relationships (and fixes broken scripts). if( commandSource == CMD_FROM_PLAYER && (!victim->testScriptStatusBit( OBJECT_STATUS_SCRIPT_TARGETABLE ) || r == ALLIES) ) { - //Unless the object has a map propertly that sets it to be targetable (and not allied), then give up. + //Unless the object has a map property that sets it to be targetable (and not allied), then give up. return ATTACKRESULT_NOT_POSSIBLE; } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 25a65e0c3fc..c77f9f8bb6b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -31,11 +31,66 @@ #include "PreRTS.h" #include "Common/Xfer.h" #include "GameLogic/Damage.h" +#include "Common/BitFlagsIO.h" +#include "Common/ThingFactory.h" +#include "Common/ThingTemplate.h" /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// +template<> +const char* const DamageTypeFlags::s_bitNameList[] = +{ + "EXPLOSION", + "CRUSH", + "ARMOR_PIERCING", + "SMALL_ARMS", + "GATTLING", + "RADIATION", + "FLAME", + "LASER", + "SNIPER", + "POISON", + "HEALING", + "UNRESISTABLE", + "WATER", + "DEPLOY", + "SURRENDER", + "HACK", + "KILL_PILOT", + "PENALTY", + "FALLING", + "MELEE", + "DISARM", + "HAZARD_CLEANUP", + "PARTICLE_BEAM", + "TOPPLING", + "INFANTRY_MISSILE", + "AURORA_BOMB", + "LAND_MINE", + "JET_MISSILES", + "STEALTHJET_MISSILES", + "MOLOTOV_COCKTAIL", + "COMANCHE_VULCAN", +#if RTS_GENERALS + "FLESHY_SNIPER", +#endif + "SUBDUAL_MISSILE", + "SUBDUAL_VEHICLE", + "SUBDUAL_BUILDING", + "SUBDUAL_UNRESISTABLE", + "MICROWAVE", + "KILL_GARRISONED", + "STATUS", + + nullptr +}; +static_assert(ARRAY_SIZE(DamageTypeFlags::s_bitNameList) == DamageTypeFlags::NumBits + 1, "Incorrect array size"); + +DamageTypeFlags DAMAGE_TYPE_FLAGS_NONE; // inits to all zeroes +DamageTypeFlags DAMAGE_TYPE_FLAGS_ALL(DamageTypeFlags::kInitSetAll); + // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: @@ -60,13 +115,21 @@ void DamageInfo::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Damage FX override (Added for Zero Hour) + * 3: Shock wave and damage status type (Added for Zero Hour) +*/ // ------------------------------------------------------------------------------------------------ void DamageInfoInput::xfer( Xfer *xfer ) { // version +#if RTS_GENERALS && RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 3; +#endif + XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -79,12 +142,39 @@ void DamageInfoInput::xfer( Xfer *xfer ) // damage type xfer->xferUser( &m_damageType, sizeof( DamageType ) ); + // damage FX Override + if( version >= 2 ) + xfer->xferUser( &m_damageFXOverride, sizeof( DamageType ) ); + // death type xfer->xferUser( &m_deathType, sizeof( DeathType ) ); // amount xfer->xferReal( &m_amount ); + // kill no matter what (old versions default to FALSE). + if( currentVersion >= 2 ) + { + xfer->xferBool( &m_kill ); + } + + if( version >= 3 ) + { + xfer->xferUser( &m_damageStatusType, sizeof(ObjectStatusTypes) );//It's an enum + + xfer->xferCoord3D(&m_shockWaveVector); + xfer->xferReal( &m_shockWaveAmount ); + xfer->xferReal( &m_shockWaveRadius ); + xfer->xferReal( &m_shockWaveTaperOff ); + + AsciiString thingString = m_sourceTemplate ? m_sourceTemplate->getName() : AsciiString::TheEmptyString; + xfer->xferAsciiString( &thingString ); + if( xfer->getXferMode() == XFER_LOAD ) + { + m_sourceTemplate = TheThingFactory->findTemplate( thingString ); + } + } + } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h index bb7d13f0430..0e06ee8d388 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h @@ -71,6 +71,11 @@ class BitFlags m_bits.set(); } + BitFlags(UnsignedInt value) + : m_bits(static_cast(value)) + { + } + // TheSuperHackers @todo Replace with variadic template BitFlags(BogusInitType k, Int idx1) @@ -247,6 +252,17 @@ class BitFlags return true; } + // TheSuperHackers @info Function for rare use cases where we must access the flags as an integer. + // Not using to_ulong because that can throw. Truncates all bits above 32. + UnsignedInt toUnsignedInt() const noexcept + { + UnsignedInt val = 0; + const UnsignedInt count = min(m_bits.size(), sizeof(val) * 8); + for (UnsignedInt i = 0; i < count; ++i) + val |= m_bits.test(i) * (1u << i); + return val; + } + static const char* const* getBitNames() { return s_bitNameList; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h index 2f145c08ad9..f62a64a112e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Damage.h @@ -77,13 +77,16 @@ enum DamageType CPP_11(: Int) DAMAGE_STEALTHJET_MISSILES = 28, DAMAGE_MOLOTOV_COCKTAIL = 29, DAMAGE_COMANCHE_VULCAN = 30, - DAMAGE_SUBDUAL_MISSILE = 31, ///< Damage that does not kill you, but produces some special effect based on your Body Module. Separate HP from normal damage. - DAMAGE_SUBDUAL_VEHICLE = 32, - DAMAGE_SUBDUAL_BUILDING = 33, - DAMAGE_SUBDUAL_UNRESISTABLE = 34, - DAMAGE_MICROWAVE = 35, ///< Radiation that only affects infantry - DAMAGE_KILL_GARRISONED = 36, ///< Kills Passengers up to the number specified in Damage - DAMAGE_STATUS = 37, ///< Damage that gives a status condition, not that does hitpoint damage +#if RTS_GENERALS + DAMAGE_FLESHY_SNIPER = 31, // like DAMAGE_SNIPER, but (generally) does no damage to vehicles. +#endif + DAMAGE_SUBDUAL_MISSILE /*= 31*/, ///< Damage that does not kill you, but produces some special effect based on your Body Module. Separate HP from normal damage. + DAMAGE_SUBDUAL_VEHICLE /*= 32*/, + DAMAGE_SUBDUAL_BUILDING /*= 33*/, + DAMAGE_SUBDUAL_UNRESISTABLE /*= 34*/, + DAMAGE_MICROWAVE /*= 35*/, ///< Radiation that only affects infantry + DAMAGE_KILL_GARRISONED /*= 36*/, ///< Kills Passengers up to the number specified in Damage + DAMAGE_STATUS /*= 37*/, ///< Damage that gives a status condition, not that does hitpoint damage // Please note: There is a string array DamageTypeFlags::s_bitNameList[] diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 96b6da59e4d..92669c10818 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -205,12 +205,19 @@ void WeaponSet::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Upgrade damage type flags from integer to BitFlags for Generals. + * Zero Hour already had this at version 1. + */ // ------------------------------------------------------------------------------------------------ void WeaponSet::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE const XferVersion currentVersion = 1; +#else + const XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -276,11 +283,25 @@ void WeaponSet::xfer( Xfer *xfer ) xfer->xferUser(&m_curWeaponLockedStatus, sizeof(m_curWeaponLockedStatus)); xfer->xferUnsignedInt(&m_filledWeaponSlotMask); xfer->xferInt(&m_totalAntiMask); + +#if RTS_GENERALS + if (version < 2) + { + UnsignedInt totalDamageTypeMask = m_totalDamageTypeMask.toUnsignedInt(); + xfer->xferUnsignedInt(&totalDamageTypeMask); + m_totalDamageTypeMask = DamageTypeFlags(totalDamageTypeMask); + } +#endif + xfer->xferBool(&m_hasDamageWeapon); xfer->xferBool(&m_hasDamageWeapon); - m_totalDamageTypeMask.xfer(xfer);// BitSet has built in xfer - +#if RTS_GENERALS + if (version >= 2) +#endif + { + m_totalDamageTypeMask.xfer(xfer);// BitSet has built in xfer + } } // ------------------------------------------------------------------------------------------------ @@ -554,7 +575,7 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac //care about relationships (and fixes broken scripts). if( commandSource == CMD_FROM_PLAYER && (!victim->testScriptStatusBit( OBJECT_STATUS_SCRIPT_TARGETABLE ) || r == ALLIES) ) { - //Unless the object has a map properly that sets it to be targetable (and not allied), then give up. + //Unless the object has a map property that sets it to be targetable (and not allied), then give up. return ATTACKRESULT_NOT_POSSIBLE; } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 27cc95b00e4..963d1aa8763 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -73,6 +73,9 @@ const char* const DamageTypeFlags::s_bitNameList[] = "STEALTHJET_MISSILES", "MOLOTOV_COCKTAIL", "COMANCHE_VULCAN", +#if RTS_GENERALS + "FLESHY_SNIPER", +#endif "SUBDUAL_MISSILE", "SUBDUAL_VEHICLE", "SUBDUAL_BUILDING", @@ -113,14 +116,20 @@ void DamageInfo::xfer( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Damage FX override + * 2: Damage FX override (Added for Zero Hour) + * 3: Shock wave and damage status type (Added for Zero Hour) */ // ------------------------------------------------------------------------------------------------ void DamageInfoInput::xfer( Xfer *xfer ) { // version +#if RTS_GENERALS && RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else XferVersion currentVersion = 3; +#endif + XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -149,15 +158,15 @@ void DamageInfoInput::xfer( Xfer *xfer ) xfer->xferBool( &m_kill ); } - xfer->xferUser( &m_damageStatusType, sizeof(ObjectStatusTypes) );//It's an enum - - xfer->xferCoord3D(&m_shockWaveVector); - xfer->xferReal( &m_shockWaveAmount ); - xfer->xferReal( &m_shockWaveRadius ); - xfer->xferReal( &m_shockWaveTaperOff ); - if( version >= 3 ) { + xfer->xferUser( &m_damageStatusType, sizeof(ObjectStatusTypes) );//It's an enum + + xfer->xferCoord3D(&m_shockWaveVector); + xfer->xferReal( &m_shockWaveAmount ); + xfer->xferReal( &m_shockWaveRadius ); + xfer->xferReal( &m_shockWaveTaperOff ); + AsciiString thingString = m_sourceTemplate ? m_sourceTemplate->getName() : AsciiString::TheEmptyString; xfer->xferAsciiString( &thingString ); if( xfer->getXferMode() == XFER_LOAD ) From ac6dbdcc287c94b5007b8787273e35bf9c5e5357 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sat, 17 Jan 2026 17:34:09 +0000 Subject: [PATCH 099/211] refactor(pathfinder): Move obstacle handling functions from PathfindCell header to the cpp (#2140) --- .../GameEngine/Include/GameLogic/AIPathfind.h | 40 +++++-------- .../Source/GameLogic/AI/AIPathfind.cpp | 58 ++++++++++++++++++- .../GameEngine/Include/GameLogic/AIPathfind.h | 40 +++++-------- .../Source/GameLogic/AI/AIPathfind.cpp | 56 +++++++++++++++++- 4 files changed, 137 insertions(+), 57 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index 65db93f142b..970aa37afad 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -289,9 +289,8 @@ class PathfindCell Bool isObstaclePresent( ObjectID objID ) const; ///< return true if the given object ID is registered as an obstacle in this cell - Bool isObstacleTransparent( ) const{return m_info?m_info->m_obstacleIsTransparent:false; } ///< return true if the obstacle in the cell is KINDOF_CAN_SEE_THROUGHT_STRUCTURE - - Bool isObstacleFence( void ) const {return m_info?m_info->m_obstacleIsFence:false; }///< return true if the given obstacle in the cell is a fence. + inline Bool isObstacleTransparent() const; + inline Bool isObstacleFence(void) const; /// Return estimated cost from given cell to reach goal cell UnsignedInt costToGoal( PathfindCell *goal ); @@ -323,8 +322,8 @@ class PathfindCell inline UnsignedShort getXIndex(void) const {return m_info->m_pos.x;} inline UnsignedShort getYIndex(void) const {return m_info->m_pos.y;} - inline Bool isBlockedByAlly(void) const {return m_info->m_blockedByAlly;} - inline void setBlockedByAlly(Bool blocked) {m_info->m_blockedByAlly = (blocked!=0);} + inline Bool isBlockedByAlly(void) const; + inline void setBlockedByAlly(Bool blocked); inline Bool getOpen(void) const {return m_info->m_open;} inline Bool getClosed(void) const {return m_info->m_closed;} @@ -355,7 +354,7 @@ class PathfindCell inline ObjectID getGoalAircraft(void) const {ObjectID id = m_info?m_info->m_goalAircraftID:INVALID_ID; return id;} inline ObjectID getPosUnit(void) const {ObjectID id = m_info?m_info->m_posUnitID:INVALID_ID; return id;} - inline ObjectID getObstacleID(void) const {ObjectID id = m_info?m_info->m_obstacleID:INVALID_ID; return id;} + inline ObjectID getObstacleID(void) const; void setLayer( PathfindLayerEnum layer ) { m_layer = layer; } ///< set the cell layer PathfindLayerEnum getLayer( void ) const { return (PathfindLayerEnum)m_layer; } ///< get the cell layer @@ -365,14 +364,14 @@ class PathfindCell private: PathfindCellInfo *m_info; - zoneStorageType m_zone:14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, - // you still may be able to if you can cross multiple terrain types. - UnsignedShort m_aircraftGoal:1; //< This is an aircraft goal cell. - UnsignedShort m_pinched:1; //< This cell is surrounded by obstacle cells. - UnsignedByte m_type:4; ///< what type of cell terrain this is. - UnsignedByte m_flags:4; ///< what type of units are in or moving through this cell. - UnsignedByte m_connectsToLayer:4; ///< This cell can pathfind onto this layer, if > LAYER_TOP. - UnsignedByte m_layer:4; ///< Layer of this cell. + zoneStorageType m_zone : 14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, + /// you still may be able to if you can cross multiple terrain types. + UnsignedShort m_aircraftGoal : 1; ///< This is an aircraft goal cell. + UnsignedShort m_pinched : 1; ///< This cell is surrounded by obstacle cells. + UnsignedByte m_type : 4; ///< what type of cell terrain this is. + UnsignedByte m_flags : 4; ///< what type of units are in or moving through this cell. + UnsignedByte m_connectsToLayer : 4; ///< This cell can pathfind onto this layer, if > LAYER_TOP. + UnsignedByte m_layer : 4; ///< Layer of this cell. }; typedef PathfindCell *PathfindCellP; @@ -965,16 +964,3 @@ inline Bool Pathfinder::worldToCell( const Coord3D *pos, ICoord2D *cell ) return overflow; } -/** - * Return true if the given object ID is registered as an obstacle in this cell - */ -inline Bool PathfindCell::isObstaclePresent( ObjectID objID ) const -{ - if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) - { - DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); - return (m_info && m_info->m_obstacleID == objID); - } - - return false; -} diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index e37301a59b2..c2c95e7d3bf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1268,6 +1268,19 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) m_info->m_closed = FALSE; return true; } + +/** + * Set the blocked by ally flag on the pathfind cell info. + */ +inline Bool PathfindCell::isBlockedByAlly(void) const +{ + return m_info->m_blockedByAlly; +} +inline void PathfindCell::setBlockedByAlly(Bool blocked) +{ + m_info->m_blockedByAlly = (blocked != 0); +} + /** * Set the parent pointer. */ @@ -1471,7 +1484,16 @@ void PathfindCell::setPosUnit(ObjectID unitID, const ICoord2D &pos ) /** - * Flag this cell as an obstacle, from the given one + * Return the relevant obstacle ID. + */ +inline ObjectID PathfindCell::getObstacleID(void) const +{ + return m_info ? m_info->m_obstacleID : INVALID_ID; +} + + +/** + * Flag this cell as an obstacle, from the given one. */ void PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoord2D &pos ) { @@ -1494,7 +1516,7 @@ void PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo return; } - m_type = PathfindCell::CELL_OBSTACLE ; + m_type = PathfindCell::CELL_OBSTACLE; if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); if (!m_info) { @@ -1733,6 +1755,38 @@ PathfindCell *PathfindCell::removeFromClosedList( PathfindCell *list ) return list; } +/** + * Return true if the given object ID is registered as an obstacle in this cell + */ +inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const +{ + if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) + { + DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); + return (m_info && m_info->m_obstacleID == objID); + } + + return false; +} + + +/** + * return true if the obstacle in the cell is KINDOF_CAN_SEE_THROUGHT_STRUCTURE + */ +inline Bool PathfindCell::isObstacleTransparent() const +{ + return m_info ? m_info->m_obstacleIsTransparent : false; +} + +/** + * return true if the given obstacle in the cell is a fence. + */ +inline Bool PathfindCell::isObstacleFence(void) const +{ + return m_info ? m_info->m_obstacleIsFence : false; +} + + const Int COST_ORTHOGONAL = 10; const Int COST_DIAGONAL = 14; const Real COST_TO_DISTANCE_FACTOR = 1.0f/10.0f; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index 07856f7bbd7..6d882eae3a2 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -290,9 +290,8 @@ class PathfindCell Bool isObstaclePresent( ObjectID objID ) const; ///< return true if the given object ID is registered as an obstacle in this cell - Bool isObstacleTransparent( ) const{return m_info?m_info->m_obstacleIsTransparent:false; } ///< return true if the obstacle in the cell is KINDOF_CAN_SEE_THROUGHT_STRUCTURE - - Bool isObstacleFence( void ) const {return m_info?m_info->m_obstacleIsFence:false; }///< return true if the given obstacle in the cell is a fence. + inline Bool isObstacleTransparent() const; + inline Bool isObstacleFence(void) const; /// Return estimated cost from given cell to reach goal cell UnsignedInt costToGoal( PathfindCell *goal ); @@ -324,8 +323,8 @@ class PathfindCell inline UnsignedShort getXIndex(void) const {return m_info->m_pos.x;} inline UnsignedShort getYIndex(void) const {return m_info->m_pos.y;} - inline Bool isBlockedByAlly(void) const {return m_info->m_blockedByAlly;} - inline void setBlockedByAlly(Bool blocked) {m_info->m_blockedByAlly = (blocked!=0);} + inline Bool isBlockedByAlly(void) const; + inline void setBlockedByAlly(Bool blocked); inline Bool getOpen(void) const {return m_info->m_open;} inline Bool getClosed(void) const {return m_info->m_closed;} @@ -356,7 +355,7 @@ class PathfindCell inline ObjectID getGoalAircraft(void) const {ObjectID id = m_info?m_info->m_goalAircraftID:INVALID_ID; return id;} inline ObjectID getPosUnit(void) const {ObjectID id = m_info?m_info->m_posUnitID:INVALID_ID; return id;} - inline ObjectID getObstacleID(void) const {ObjectID id = m_info?m_info->m_obstacleID:INVALID_ID; return id;} + inline ObjectID getObstacleID(void) const; void setLayer( PathfindLayerEnum layer ) { m_layer = layer; } ///< set the cell layer PathfindLayerEnum getLayer( void ) const { return (PathfindLayerEnum)m_layer; } ///< get the cell layer @@ -366,14 +365,14 @@ class PathfindCell private: PathfindCellInfo *m_info; - zoneStorageType m_zone:14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, - // you still may be able to if you can cross multiple terrain types. - UnsignedShort m_aircraftGoal:1; //< This is an aircraft goal cell. - UnsignedShort m_pinched:1; //< This cell is surrounded by obstacle cells. - UnsignedByte m_type:4; ///< what type of cell terrain this is. - UnsignedByte m_flags:4; ///< what type of units are in or moving through this cell. - UnsignedByte m_connectsToLayer:4; ///< This cell can pathfind onto this layer, if > LAYER_TOP. - UnsignedByte m_layer:4; ///< Layer of this cell. + zoneStorageType m_zone : 14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, + /// you still may be able to if you can cross multiple terrain types. + UnsignedShort m_aircraftGoal : 1; ///< This is an aircraft goal cell. + UnsignedShort m_pinched : 1; ///< This cell is surrounded by obstacle cells. + UnsignedByte m_type : 4; ///< what type of cell terrain this is. + UnsignedByte m_flags : 4; ///< what type of units are in or moving through this cell. + UnsignedByte m_connectsToLayer : 4; ///< This cell can pathfind onto this layer, if > LAYER_TOP. + UnsignedByte m_layer : 4; ///< Layer of this cell. }; typedef PathfindCell *PathfindCellP; @@ -973,16 +972,3 @@ inline Bool Pathfinder::worldToCell( const Coord3D *pos, ICoord2D *cell ) return overflow; } -/** - * Return true if the given object ID is registered as an obstacle in this cell - */ -inline Bool PathfindCell::isObstaclePresent( ObjectID objID ) const -{ - if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) - { - DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); - return (m_info && m_info->m_obstacleID == objID); - } - - return false; -} diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 0e50e1adc5e..a000ba283a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1283,6 +1283,19 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) m_info->m_closed = FALSE; return true; } + +/** + * Set the blocked by ally flag on the pathfind cell info. + */ +inline Bool PathfindCell::isBlockedByAlly(void) const +{ + return m_info->m_blockedByAlly; +} +inline void PathfindCell::setBlockedByAlly(Bool blocked) +{ + m_info->m_blockedByAlly = (blocked != 0); +} + /** * Set the parent pointer. */ @@ -1485,6 +1498,15 @@ void PathfindCell::setPosUnit(ObjectID unitID, const ICoord2D &pos ) } +/** + * Return the relevant obstacle ID. + */ +inline ObjectID PathfindCell::getObstacleID(void) const +{ + return m_info ? m_info->m_obstacleID : INVALID_ID; +} + + /** * Flag this cell as an obstacle, from the given one. * Return true if cell was flagged. @@ -1510,7 +1532,7 @@ Bool PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo return true; } - m_type = PathfindCell::CELL_OBSTACLE ; + m_type = PathfindCell::CELL_OBSTACLE; if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); if (!m_info) { @@ -1750,6 +1772,38 @@ PathfindCell *PathfindCell::removeFromClosedList( PathfindCell *list ) return list; } +/** + * Return true if the given object ID is registered as an obstacle in this cell + */ +inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const +{ + if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) + { + DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); + return (m_info && m_info->m_obstacleID == objID); + } + + return false; +} + + +/** + * return true if the obstacle in the cell is KINDOF_CAN_SEE_THROUGHT_STRUCTURE + */ +inline Bool PathfindCell::isObstacleTransparent() const +{ + return m_info ? m_info->m_obstacleIsTransparent : false; +} + +/** + * return true if the given obstacle in the cell is a fence. + */ +inline Bool PathfindCell::isObstacleFence(void) const +{ + return m_info ? m_info->m_obstacleIsFence : false; +} + + const Int COST_ORTHOGONAL = 10; const Int COST_DIAGONAL = 14; const Real COST_TO_DISTANCE_FACTOR = 1.0f/10.0f; From 0f01e2752c39884019c362dc302e11645cc368f8 Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 18 Jan 2026 15:18:21 +0000 Subject: [PATCH 100/211] bugfix(pathfinder): Fix late game unit lockups and erroneous impassable terrain (#2140) --- Core/GameEngine/Include/Common/GameDefines.h | 9 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 13 ++ .../Source/GameLogic/AI/AIPathfind.cpp | 128 +++++++++++++++++- .../GameEngine/Include/GameLogic/AIPathfind.h | 13 ++ .../Source/GameLogic/AI/AIPathfind.cpp | 118 ++++++++++++++++ 5 files changed, 273 insertions(+), 8 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index 667ea8aa9ff..47a661a963e 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -36,10 +36,13 @@ #endif // This is here to easily toggle between the retail compatible with fixed pathfinding fallback and pure fixed pathfinding mode -#if RETAIL_COMPATIBLE_CRC +#ifndef RETAIL_COMPATIBLE_PATHFINDING #define RETAIL_COMPATIBLE_PATHFINDING (1) -#else -#define RETAIL_COMPATIBLE_PATHFINDING (0) +#endif + +// This is here to easily toggle between the retail compatible pathfinding memory allocation and the new static allocated data mode +#ifndef RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION +#define RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION (1) #endif // This is essentially synonymous for RETAIL_COMPATIBLE_CRC. There is a lot wrong with AIGroup, such as use-after-free, double-free, leaks, diff --git a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h index 970aa37afad..d147c9650c5 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -47,6 +47,9 @@ class Weapon; #define INFANTRY_MOVES_THROUGH_INFANTRY +#if !RETAIL_COMPATIBLE_PATHFINDING +#undef RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION +#endif typedef UnsignedShort zoneStorageType; @@ -288,6 +291,11 @@ class PathfindCell Bool isAircraftGoal( void) const {return m_aircraftGoal != 0;} Bool isObstaclePresent( ObjectID objID ) const; ///< return true if the given object ID is registered as an obstacle in this cell +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @info isObstructionInvalid() and clearObstruction() only used during retail compatible pathfinding failover cleanup + Bool isObstructionInvalid() const { return m_obstacleID != INVALID_ID && m_info == nullptr && (m_type == CELL_OBSTACLE || m_type == CELL_IMPASSABLE); } + void clearObstruction() { m_type = CELL_CLEAR; m_obstacleID = INVALID_ID; m_obstacleIsFence = false; m_obstacleIsTransparent = false; } +#endif inline Bool isObstacleTransparent() const; inline Bool isObstacleFence(void) const; @@ -364,6 +372,11 @@ class PathfindCell private: PathfindCellInfo *m_info; + ObjectID m_obstacleID; ///< the object ID who overlaps this cell + UnsignedInt m_blockedByAlly : 1; ///< True if this cell is blocked by an allied unit. + UnsignedInt m_obstacleIsFence : 1; ///< True if occupied by a fence. + UnsignedInt m_obstacleIsTransparent : 1; ///< True if obstacle is transparent (undefined if obstacleid is invalid) + zoneStorageType m_zone : 14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, /// you still may be able to if you can cross multiple terrain types. UnsignedShort m_aircraftGoal : 1; ///< This is an aircraft goal cell. diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index c2c95e7d3bf..7bed98dabdc 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1111,6 +1111,15 @@ void Pathfinder::forceCleanCells() for (int j = 0; j <= m_extent.hi.y; ++j) { for (int i = 0; i <= m_extent.hi.x; ++i) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @bugfix Mauller/DrGoldFish 20/01/2026 when pathfinding resources cannot be allocated to a pathfindCell, + // The function to remove an obstacle returns early and PathfindCells remain flagged as obstacles. + // We need to make sure to reset pathfindCells with a set m_obstacleID and no m_info. + // The use of PathfindCellInfo data for obstacle handling also exausted them resulting in pathfinding lockups. + if (m_map[i][j].isObstructionInvalid()) { + m_map[i][j].clearObstruction(); + } +#endif if (m_map[i][j].hasInfo()) { m_map[i][j].releaseInfo(); } @@ -1238,6 +1247,11 @@ void PathfindCell::reset( ) PathfindCellInfo::releaseACellInfo(m_info); m_info = nullptr; } + m_obstacleID = INVALID_ID; + m_blockedByAlly = false; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; + m_connectsToLayer = LAYER_INVALID; m_layer = LAYER_GROUND; @@ -1274,11 +1288,29 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) */ inline Bool PathfindCell::isBlockedByAlly(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_blockedByAlly; + } + return m_info->m_blockedByAlly; +#else + return m_blockedByAlly; +#endif } + inline void PathfindCell::setBlockedByAlly(Bool blocked) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + m_blockedByAlly = (blocked != 0); + return; + } + m_info->m_blockedByAlly = (blocked != 0); +#else + m_blockedByAlly = (blocked != 0); +#endif } /** @@ -1488,7 +1520,15 @@ void PathfindCell::setPosUnit(ObjectID unitID, const ICoord2D &pos ) */ inline ObjectID PathfindCell::getObstacleID(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleID; + } + return m_info ? m_info->m_obstacleID : INVALID_ID; +#else + return m_obstacleID; +#endif } @@ -1509,14 +1549,33 @@ void PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo if (isRubble) { m_type = PathfindCell::CELL_RUBBLE; + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return; + } + if (m_info) { m_info->m_obstacleID = INVALID_ID; releaseInfo(); } +#endif return; } m_type = PathfindCell::CELL_OBSTACLE; + m_obstacleID = obstacle->getID(); + m_obstacleIsFence = isFence; + m_obstacleIsTransparent = obstacle->isKindOf(KINDOF_CAN_SEE_THROUGH_STRUCTURE); +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @info In retail mode we need to track orphaned cells set as obstacles so we can cleanup and failover properly + // So we always make sure to set and clear the local obstacle data on the PathfindCell regardless of retail compat or not + if (s_useFixedPathfinding) { + return; + } + if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); if (!m_info) { @@ -1527,6 +1586,8 @@ void PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo m_info->m_obstacleID = obstacle->getID(); m_info->m_obstacleIsFence = isFence; m_info->m_obstacleIsTransparent = obstacle->isKindOf(KINDOF_CAN_SEE_THROUGH_STRUCTURE); +#endif + return; } /** @@ -1534,29 +1595,62 @@ void PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo */ void PathfindCell::setType( CellType type ) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + if (m_obstacleID != INVALID_ID) { + DEBUG_ASSERTCRASH(type == PathfindCell::CELL_OBSTACLE, ("Wrong type.")); + m_type = PathfindCell::CELL_OBSTACLE; + return; + } + } + if (m_info && (m_info->m_obstacleID != INVALID_ID)) { DEBUG_ASSERTCRASH(type==PathfindCell::CELL_OBSTACLE, ("Wrong type.")); m_type = PathfindCell::CELL_OBSTACLE; return; } +#else + if (m_obstacleID != INVALID_ID) { + DEBUG_ASSERTCRASH(type == PathfindCell::CELL_OBSTACLE, ("Wrong type.")); + m_type = PathfindCell::CELL_OBSTACLE; + return; + } +#endif m_type = type; } /** - * Flag this cell as an obstacle, from the given one + * Unflag this cell as an obstacle, from the given one. */ void PathfindCell::removeObstacle( Object *obstacle ) { if (m_type == PathfindCell::CELL_RUBBLE) { m_type = PathfindCell::CELL_CLEAR; } +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + if (m_obstacleID != obstacle->getID()) return; + m_type = PathfindCell::CELL_CLEAR; + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; + return; + } + if (!m_info) return; if (m_info->m_obstacleID != obstacle->getID()) return; m_type = PathfindCell::CELL_CLEAR; - if (m_info) { - m_info->m_obstacleID = INVALID_ID; - releaseInfo(); - } + m_info->m_obstacleID = INVALID_ID; + releaseInfo(); + +#else + if (m_obstacleID != obstacle->getID()) return; + m_type = PathfindCell::CELL_CLEAR; +#endif + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; + return; } /// put self on "open" list in ascending cost order, return new list @@ -1762,8 +1856,16 @@ inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const { if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleID == objID; + } + DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); return (m_info && m_info->m_obstacleID == objID); +#else + return m_obstacleID == objID; +#endif } return false; @@ -1775,7 +1877,15 @@ inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const */ inline Bool PathfindCell::isObstacleTransparent() const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleIsTransparent; + } + return m_info ? m_info->m_obstacleIsTransparent : false; +#else + return m_obstacleIsTransparent; +#endif } /** @@ -1783,7 +1893,15 @@ inline Bool PathfindCell::isObstacleTransparent() const */ inline Bool PathfindCell::isObstacleFence(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleIsFence; + } + return m_info ? m_info->m_obstacleIsFence : false; +#else + return m_obstacleIsFence; +#endif } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h index 6d882eae3a2..a7ab136c909 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h @@ -48,6 +48,9 @@ class PathfindCell; #define INFANTRY_MOVES_THROUGH_INFANTRY +#if !RETAIL_COMPATIBLE_PATHFINDING +#undef RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION +#endif typedef UnsignedShort zoneStorageType; @@ -289,6 +292,11 @@ class PathfindCell Bool isAircraftGoal( void) const {return m_aircraftGoal != 0;} Bool isObstaclePresent( ObjectID objID ) const; ///< return true if the given object ID is registered as an obstacle in this cell +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @info isObstructionInvalid() and clearObstruction() only used during retail compatible pathfinding failover cleanup + Bool isObstructionInvalid() const { return m_obstacleID != INVALID_ID && m_info == nullptr && (m_type == CELL_OBSTACLE || m_type == CELL_IMPASSABLE); } + void clearObstruction() { m_type = CELL_CLEAR; m_obstacleID = INVALID_ID; m_obstacleIsFence = false; m_obstacleIsTransparent = false; } +#endif inline Bool isObstacleTransparent() const; inline Bool isObstacleFence(void) const; @@ -365,6 +373,11 @@ class PathfindCell private: PathfindCellInfo *m_info; + ObjectID m_obstacleID; ///< the object ID who overlaps this cell + UnsignedInt m_blockedByAlly : 1; ///< True if this cell is blocked by an allied unit. + UnsignedInt m_obstacleIsFence : 1; ///< True if occupied by a fence. + UnsignedInt m_obstacleIsTransparent : 1; ///< True if obstacle is transparent (undefined if obstacleid is invalid) + zoneStorageType m_zone : 14; ///< Zone. Each zone is a set of adjacent terrain type. If from & to in the same zone, you can successfully pathfind. If not, /// you still may be able to if you can cross multiple terrain types. UnsignedShort m_aircraftGoal : 1; ///< This is an aircraft goal cell. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index a000ba283a4..fea307e8310 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -1126,6 +1126,15 @@ void Pathfinder::forceCleanCells() for (int j = 0; j <= m_extent.hi.y; ++j) { for (int i = 0; i <= m_extent.hi.x; ++i) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @bugfix Mauller/DrGoldFish 20/01/2026 when pathfinding resources cannot be allocated to a pathfindCell, + // The function to remove an obstacle returns early and PathfindCells remain flagged as obstacles. + // We need to make sure to reset pathfindCells with a set m_obstacleID and no m_info. + // The use of PathfindCellInfo data for obstacle handling also exausted them resulting in pathfinding lockups. + if (m_map[i][j].isObstructionInvalid()) { + m_map[i][j].clearObstruction(); + } +#endif if (m_map[i][j].hasInfo()) { m_map[i][j].releaseInfo(); } @@ -1253,6 +1262,11 @@ void PathfindCell::reset( ) PathfindCellInfo::releaseACellInfo(m_info); m_info = nullptr; } + m_obstacleID = INVALID_ID; + m_blockedByAlly = false; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; + m_connectsToLayer = LAYER_INVALID; m_layer = LAYER_GROUND; @@ -1289,11 +1303,29 @@ Bool PathfindCell::startPathfind( PathfindCell *goalCell ) */ inline Bool PathfindCell::isBlockedByAlly(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_blockedByAlly; + } + return m_info->m_blockedByAlly; +#else + return m_blockedByAlly; +#endif } + inline void PathfindCell::setBlockedByAlly(Bool blocked) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + m_blockedByAlly = (blocked != 0); + return; + } + m_info->m_blockedByAlly = (blocked != 0); +#else + m_blockedByAlly = (blocked != 0); +#endif } /** @@ -1503,7 +1535,15 @@ void PathfindCell::setPosUnit(ObjectID unitID, const ICoord2D &pos ) */ inline ObjectID PathfindCell::getObstacleID(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleID; + } + return m_info ? m_info->m_obstacleID : INVALID_ID; +#else + return m_obstacleID; +#endif } @@ -1525,14 +1565,33 @@ Bool PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo if (isRubble) { m_type = PathfindCell::CELL_RUBBLE; + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return true; + } + if (m_info) { m_info->m_obstacleID = INVALID_ID; releaseInfo(); } +#endif return true; } m_type = PathfindCell::CELL_OBSTACLE; + m_obstacleID = obstacle->getID(); + m_obstacleIsFence = isFence; + m_obstacleIsTransparent = obstacle->isKindOf(KINDOF_CAN_SEE_THROUGH_STRUCTURE); +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + // TheSuperHackers @info In retail mode we need to track orphaned cells set as obstacles so we can cleanup and failover properly + // So we always make sure to set and clear the local obstacle data on the PathfindCell regardless of retail compat or not + if (s_useFixedPathfinding) { + return true; + } + if (!m_info) { m_info = PathfindCellInfo::getACellInfo(this, pos); if (!m_info) { @@ -1543,6 +1602,7 @@ Bool PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo m_info->m_obstacleID = obstacle->getID(); m_info->m_obstacleIsFence = isFence; m_info->m_obstacleIsTransparent = obstacle->isKindOf(KINDOF_CAN_SEE_THROUGH_STRUCTURE); +#endif return true; } @@ -1551,11 +1611,27 @@ Bool PathfindCell::setTypeAsObstacle( Object *obstacle, Bool isFence, const ICoo */ void PathfindCell::setType( CellType type ) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + if (m_obstacleID != INVALID_ID) { + DEBUG_ASSERTCRASH(type == PathfindCell::CELL_OBSTACLE, ("Wrong type.")); + m_type = PathfindCell::CELL_OBSTACLE; + return; + } + } + if (m_info && (m_info->m_obstacleID != INVALID_ID)) { DEBUG_ASSERTCRASH(type==PathfindCell::CELL_OBSTACLE, ("Wrong type.")); m_type = PathfindCell::CELL_OBSTACLE; return; } +#else + if (m_obstacleID != INVALID_ID) { + DEBUG_ASSERTCRASH(type == PathfindCell::CELL_OBSTACLE, ("Wrong type.")); + m_type = PathfindCell::CELL_OBSTACLE; + return; + } +#endif m_type = type; } @@ -1568,11 +1644,29 @@ Bool PathfindCell::removeObstacle( Object *obstacle ) if (m_type == PathfindCell::CELL_RUBBLE) { m_type = PathfindCell::CELL_CLEAR; } +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + if (m_obstacleID != obstacle->getID()) return false; + m_type = PathfindCell::CELL_CLEAR; + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; + return true; + } + if (!m_info) return false; if (m_info->m_obstacleID != obstacle->getID()) return false; m_type = PathfindCell::CELL_CLEAR; m_info->m_obstacleID = INVALID_ID; releaseInfo(); + +#else + if (m_obstacleID != obstacle->getID()) return false; + m_type = PathfindCell::CELL_CLEAR; +#endif + m_obstacleID = INVALID_ID; + m_obstacleIsFence = false; + m_obstacleIsTransparent = false; return true; } @@ -1779,8 +1873,16 @@ inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const { if (objID != INVALID_ID && (getType() == PathfindCell::CELL_OBSTACLE)) { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleID == objID; + } + DEBUG_ASSERTCRASH(m_info, ("Should have info to be obstacle.")); return (m_info && m_info->m_obstacleID == objID); +#else + return m_obstacleID == objID; +#endif } return false; @@ -1792,7 +1894,15 @@ inline Bool PathfindCell::isObstaclePresent(ObjectID objID) const */ inline Bool PathfindCell::isObstacleTransparent() const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleIsTransparent; + } + return m_info ? m_info->m_obstacleIsTransparent : false; +#else + return m_obstacleIsTransparent; +#endif } /** @@ -1800,7 +1910,15 @@ inline Bool PathfindCell::isObstacleTransparent() const */ inline Bool PathfindCell::isObstacleFence(void) const { +#if RETAIL_COMPATIBLE_PATHFINDING_ALLOCATION + if (s_useFixedPathfinding) { + return m_obstacleIsFence; + } + return m_info ? m_info->m_obstacleIsFence : false; +#else + return m_obstacleIsFence; +#endif } From 7879b577fde369c3ad3878f865f73d1cc1551826 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 23 Jan 2026 08:33:47 +1100 Subject: [PATCH 101/211] bugfix(aiupdate): Chinooks and Helixes now correctly wait for their passengers to disembark (#1792) Adjusts Chinook and Helix behavior so that they evacuate their passengers with the correct timing. Originally, the ExitDelay INI field of the TransportContain module was ignored and all passengers were immediately evacuated - unless the aircraft was already landed. With this change, the ExitDelay field is always respected and remains consistent across all evacuation pathways. If the immediate evacuation behavior is preferred, then the ExitDelay can be tweaked to 0. --- .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 10 +++++++++- .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 1e59de9261a..399e6a73f04 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1181,6 +1181,14 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) { const Real THRESH = 3.0f; const Real THRESH_SQR = THRESH*THRESH; +#if RETAIL_COMPATIBLE_CRC + const bool allowExit = true; +#else + // TheSuperHackers @bugfix Stubbjax 04/11/2025 Passengers are no longer all dumped in a single frame. + const ContainModuleInterface* contain = getObject()->getContain(); + const bool allowExit = contain && contain->hasObjectsWantingToEnterOrExit(); +#endif + if (calcDistSqr(*getObject()->getPosition(), parms->m_pos) > THRESH_SQR && m_flightStatus == CHINOOK_LANDED) { @@ -1191,7 +1199,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } - else + else if (allowExit) { // do this INSTEAD of the standard stuff setMyState( diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index cc9792d21d8..cf6e61f99b3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1316,6 +1316,14 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) { const Real THRESH = 3.0f; const Real THRESH_SQR = THRESH*THRESH; +#if RETAIL_COMPATIBLE_CRC + const bool allowExit = true; +#else + // TheSuperHackers @bugfix Stubbjax 04/11/2025 Passengers are no longer all dumped in a single frame. + const ContainModuleInterface* contain = getObject()->getContain(); + const bool allowExit = contain && contain->hasObjectsWantingToEnterOrExit(); +#endif + if (calcDistSqr(*getObject()->getPosition(), parms->m_pos) > THRESH_SQR && m_flightStatus == CHINOOK_LANDED) { @@ -1326,7 +1334,7 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setMyState(TAKING_OFF, nullptr, nullptr, CMD_FROM_AI); passItThru = false; } - else + else if (allowExit) { // do this INSTEAD of the standard stuff setMyState( From 15144de6dae49557aa79f0376a99f755aa7087c6 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 22 Jan 2026 22:47:18 +0100 Subject: [PATCH 102/211] fix(optionsmenu): Change incorrect OR/AND precedence of an unused condition in the OptionsMenu (#2164) --- .../Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 +- .../Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 18176013d0d..41a280cef98 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -985,7 +985,7 @@ static void setDefaults( void ) //------------------------------------------------------------------------------------------------- // Resolution //Find index of 800x600 mode. - if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE) && !TheGameSpyInfo) { + if ((TheGameLogic->isInGame() == FALSE || TheGameLogic->isInShellGame() == TRUE) && !TheGameSpyInfo) { Int numResolutions = TheDisplay->getDisplayModeCount(); Int defaultResIndex=0; for( Int i = 0; i < numResolutions; ++i ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 80e69828fe7..45d096faf4a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -1029,7 +1029,7 @@ static void setDefaults( void ) //------------------------------------------------------------------------------------------------- // Resolution //Find index of 800x600 mode. - if ((TheGameLogic->isInGame() == FALSE) || (TheGameLogic->isInShellGame() == TRUE) && !TheGameSpyInfo) { + if ((TheGameLogic->isInGame() == FALSE || TheGameLogic->isInShellGame() == TRUE) && !TheGameSpyInfo) { Int numResolutions = TheDisplay->getDisplayModeCount(); Int defaultResIndex=0; for( Int i = 0; i < numResolutions; ++i ) From 3e365521c6d2f94efe1dc78448ae360f390449f0 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 23 Jan 2026 22:13:09 +0100 Subject: [PATCH 103/211] refactor: Fix confusing use of logical AND and OR expressions (#954) --- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Input/Keyboard.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 6 +++--- .../Object/Update/AIUpdate/DeployStyleAIUpdate.cpp | 2 +- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 4 ++-- .../Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 2 +- .../Source/GameLogic/ScriptEngine/ScriptActions.cpp | 7 +++---- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 6 +++--- Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp | 2 +- .../GameEngine/Source/Common/System/BuildAssistant.cpp | 2 +- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | 8 ++++---- .../Code/GameEngine/Source/GameClient/Input/Keyboard.cpp | 2 +- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 6 +++--- .../GameLogic/Object/Behavior/FlightDeckBehavior.cpp | 4 ++-- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 7 ++++++- .../Source/GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../GameLogic/Object/Update/SpecialAbilityUpdate.cpp | 4 ++-- .../Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 4 ++-- .../Source/GameLogic/ScriptEngine/ScriptActions.cpp | 7 +++---- .../Source/GameLogic/ScriptEngine/ScriptEngine.cpp | 6 +++--- GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp | 2 +- 26 files changed, 50 insertions(+), 47 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 2c2a7e96c4d..1d9df298e12 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -159,7 +159,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetText())) + if (forceRecalc || (!m_isTooltipEmpty && tooltip.compare(m_tooltipDisplayString->getText()))) { m_tooltipDisplayString->setText(tooltip); //DEBUG_LOG(("Tooltip: %ls", tooltip.str())); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 7e3e99eb2e9..d554387cd3c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -1495,8 +1495,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything if( obj == nullptr || - obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && - !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) + ( obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && + !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. @@ -3049,7 +3049,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) + if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_ALLIES ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp index 2b29c968967..2e4c7473550 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp @@ -264,7 +264,7 @@ UpdateSleepTime DeployStyleAIUpdate::update( void ) break; case READY_TO_ATTACK: - if( !remainDeployed && (!inRange && isAttacking || !isAttacking && (isWaitingForPath() || getPath())) ) + if( !remainDeployed && ((!inRange && isAttacking) || (!isAttacking && (isWaitingForPath() || getPath()))) ) { WhichTurretType tur = getWhichTurretForCurWeapon(); if( tur != TURRET_INVALID ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 904df0b1937..d10dc994ce6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -422,7 +422,7 @@ Bool SpecialAbilityUpdate::initiateIntentToDoSpecialPower( const SpecialPowerTem //Determine whether we are triggering a command (rather than executing special at location or target) m_noTargetCommand = !targetObj && !targetPos; - if( data->m_unpackTime == 0 || m_noTargetCommand && data->m_skipPackingWithNoTarget ) + if( data->m_unpackTime == 0 || (m_noTargetCommand && data->m_skipPackingWithNoTarget) ) { //Only unpack if we need to -- setting it to unpacked will skip step 2 in the update m_packingState = STATE_UNPACKED; @@ -499,7 +499,7 @@ void SpecialAbilityUpdate::onExit( Bool cleanup ) TheAudio->removeAudioEvent( m_prepSoundLoop.getPlayingHandle() ); endPreparation(); - if( !data->m_specialObjectsPersistent || cleanup && !data->m_specialObjectsPersistWhenOwnerDies ) + if( !data->m_specialObjectsPersistent || (cleanup && !data->m_specialObjectsPersistWhenOwnerDies) ) { //Delete special objects that aren't considered persistent whenever we turn off //leave the special ability update. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 10af5ac22b3..c7db18ca7cf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -1021,7 +1021,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate firingWeapon->newProjectileFired( sourceObj, projectile );//The actual logic weapon needs to know this was created. - if( m_scatterRadius > 0.0f || m_infantryInaccuracyDist > 0.0f && victimObj && victimObj->isKindOf( KINDOF_INFANTRY ) ) + if( m_scatterRadius > 0.0f || ( m_infantryInaccuracyDist > 0.0f && victimObj && victimObj->isKindOf( KINDOF_INFANTRY ) ) ) { // This weapon scatters, so clear the victimObj, as we are no longer shooting it directly, // and find a random point within the radius to shoot at as victimPos diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 3946161b6f6..c7689253e5e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -3299,8 +3299,7 @@ void ScriptActions::doTeamGarrisonSpecificBuilding(const AsciiString& teamName, } PlayerMaskType player = theBuilding->getContain()->getPlayerWhoEntered(); - if (!(theBuilding->isKindOf(KINDOF_STRUCTURE) && - (player == 0) || (player == theTeam->getControllingPlayer()->getPlayerMask()))) { + if (!theBuilding->isKindOf(KINDOF_STRUCTURE) || (player != 0 && player != theTeam->getControllingPlayer()->getPlayerMask())) { return; } @@ -3446,10 +3445,10 @@ void ScriptActions::doUnitGarrisonSpecificBuilding(const AsciiString& unitName, } PlayerMaskType player = theBuilding->getContain()->getPlayerWhoEntered(); - if (!(theBuilding->isKindOf(KINDOF_STRUCTURE) && - (player == 0) || (player == theUnit->getControllingPlayer()->getPlayerMask()))) { + if (!theBuilding->isKindOf(KINDOF_STRUCTURE) || (player != 0 && player != theUnit->getControllingPlayer()->getPlayerMask())) { return; } + AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); if (!ai) { return; diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 815a9574ead..4dd90299907 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -7214,9 +7214,9 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) #endif } - if( ai || aigroup ) { - if (((ai && (ai->isIdle()) || (aigroup && aigroup->isIdle())) && - seqScript->m_framesToWait < 1) || (seqScript->m_framesToWait == 0)) { + if (ai || aigroup) { + if (seqScript->m_framesToWait == 0 || + (seqScript->m_framesToWait < 0 && ((ai && ai->isIdle()) || (aigroup && aigroup->isIdle())))) { // We want to supress messages if we're repeatedly waiting for an event to occur, cause // it KILLS our debug framerate. diff --git a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp index dd8a84b8787..3f6ecce7196 100644 --- a/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -710,7 +710,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, // add children if requested, but not on gadgets no matter what because // they are "atomic units", except for tab controls. // - if( addChildren && TheEditor->windowIsGadget( window ) == FALSE || (window->winGetStyle() & GWS_TAB_CONTROL) ) + if( (addChildren && TheEditor->windowIsGadget( window ) == FALSE) || (window->winGetStyle() & GWS_TAB_CONTROL) ) { GameWindow *child; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index cff82dadd90..73f6cd57c5b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -719,7 +719,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos //Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit). if (rel == ALLIES) { - if (them->testStatus(OBJECT_STATUS_IS_USING_ABILITY) || them->getAI() && them->getAI()->isBusy()) + if (them->testStatus(OBJECT_STATUS_IS_USING_ABILITY) || (them->getAI() && them->getAI()->isBusy())) { return LBC_OBJECTS_IN_THE_WAY; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index f38ccb5157d..3deebf2c917 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -166,7 +166,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetText())) + if (forceRecalc || (!m_isTooltipEmpty && tooltip.compare(m_tooltipDisplayString->getText()))) { m_tooltipDisplayString->setText(tooltip); //DEBUG_LOG(("Tooltip: %ls", tooltip.str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index df0d7a19486..7b48c8be309 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -1576,8 +1576,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything if( obj == nullptr || - obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && - !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) + ( obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && + !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. @@ -3195,7 +3195,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) + if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_ALLIES ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index 59cdbe0e14f..e310fa0351c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -679,11 +679,11 @@ Bool FlightDeckBehavior::reserveRunway(ObjectID id, Bool forLanding) } RunwayInfo& info = m_runways[runway]; - if( info.m_inUseByForTakeoff == id && !forLanding || info.m_inUseByForLanding == id && forLanding ) + if( (info.m_inUseByForTakeoff == id && !forLanding) || (info.m_inUseByForLanding == id && forLanding) ) { return true; } - else if( info.m_inUseByForTakeoff == INVALID_ID && !forLanding || info.m_inUseByForLanding == INVALID_ID && forLanding ) + else if( (info.m_inUseByForTakeoff == INVALID_ID && !forLanding) || (info.m_inUseByForLanding == INVALID_ID && forLanding) ) { if( forLanding ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index bec1bc96780..691247f610e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -5925,8 +5925,13 @@ SpecialPowerModuleInterface* Object::findSpecialPowerModuleInterface( SpecialPow if (!sp) continue; + if (type == SPECIAL_INVALID) + { + return sp; + } + const SpecialPowerTemplate *spTemplate = sp->getSpecialPowerTemplate(); - if (spTemplate && spTemplate->getSpecialPowerType() == type || type == SPECIAL_INVALID ) + if (spTemplate && spTemplate->getSpecialPowerType() == type) { return sp; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 28784f1907e..133cc07a229 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -1476,7 +1476,7 @@ Bool AIUpdateInterface::processCollision(PhysicsBehavior *physics, Object *other { //Kris: Patch 1.01 -- November 5, 2003 //Prevent busy units from being told to move out of the way! - if( other->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || other->getAI() && other->getAI()->isBusy() ) + if( other->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || (other->getAI() && other->getAI()->isBusy()) ) { return FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 0fc36ff7929..eb17ff3ea41 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -520,7 +520,7 @@ Bool SpecialAbilityUpdate::initiateIntentToDoSpecialPower( const SpecialPowerTem //Determine whether we are triggering a command (rather than executing special at location or target) m_noTargetCommand = !targetObj && !targetPos; - if( data->m_unpackTime == 0 || m_noTargetCommand && data->m_skipPackingWithNoTarget ) + if( data->m_unpackTime == 0 || (m_noTargetCommand && data->m_skipPackingWithNoTarget) ) { //Only unpack if we need to -- setting it to unpacked will skip step 2 in the update m_packingState = STATE_UNPACKED; @@ -603,7 +603,7 @@ void SpecialAbilityUpdate::onExit( Bool cleanup ) TheAudio->removeAudioEvent( m_prepSoundLoop.getPlayingHandle() ); endPreparation(); - if( !data->m_specialObjectsPersistent || cleanup && !data->m_specialObjectsPersistWhenOwnerDies ) + if( !data->m_specialObjectsPersistent || (cleanup && !data->m_specialObjectsPersistWhenOwnerDies) ) { //Delete special objects that aren't considered persistent whenever we turn off //leave the special ability update. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 9cdf2e39ec4..9295fc519d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -957,7 +957,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate Coord3D projectileDestination = *victimPos; //Need to copy this, as we have a pointer to their actual position Real scatterRadius = 0.0f; - if( m_scatterRadius > 0.0f || m_infantryInaccuracyDist > 0.0f && victimObj && victimObj->isKindOf( KINDOF_INFANTRY ) ) + if( m_scatterRadius > 0.0f || (m_infantryInaccuracyDist > 0.0f && victimObj && victimObj->isKindOf( KINDOF_INFANTRY )) ) { // This weapon scatters, so clear the victimObj, as we are no longer shooting it directly, // and find a random point within the radius to shoot at as victimPos @@ -2622,7 +2622,7 @@ Bool Weapon::privateFireWeapon( } // it's a mine, but doesn't have LandMineInterface... - if( !found && victimObj->isKindOf( KINDOF_MINE ) || victimObj->isKindOf( KINDOF_BOOBY_TRAP ) || victimObj->isKindOf( KINDOF_DEMOTRAP ) ) + if( (!found && victimObj->isKindOf( KINDOF_MINE )) || victimObj->isKindOf( KINDOF_BOOBY_TRAP ) || victimObj->isKindOf( KINDOF_DEMOTRAP ) ) { VeterancyLevel v = sourceObj->getVeterancyLevel(); FXList::doFXPos(m_template->getFireFX(v), victimObj->getPosition(), victimObj->getTransformMatrix(), 0, victimObj->getPosition(), 0); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index 0b3157ae665..a40902c7676 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -3395,8 +3395,7 @@ void ScriptActions::doTeamGarrisonSpecificBuilding(const AsciiString& teamName, } PlayerMaskType player = theBuilding->getContain()->getPlayerWhoEntered(); - if (!(theBuilding->isKindOf(KINDOF_STRUCTURE) && - (player == 0) || (player == theTeam->getControllingPlayer()->getPlayerMask()))) { + if (!theBuilding->isKindOf(KINDOF_STRUCTURE) || (player != 0 && player != theTeam->getControllingPlayer()->getPlayerMask())) { return; } @@ -3561,10 +3560,10 @@ void ScriptActions::doUnitGarrisonSpecificBuilding(const AsciiString& unitName, } PlayerMaskType player = theBuilding->getContain()->getPlayerWhoEntered(); - if (!(theBuilding->isKindOf(KINDOF_STRUCTURE) && - (player == 0) || (player == theUnit->getControllingPlayer()->getPlayerMask()))) { + if (!theBuilding->isKindOf(KINDOF_STRUCTURE) || (player != 0 && player != theUnit->getControllingPlayer()->getPlayerMask())) { return; } + AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); if (!ai) { return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 13ccb3db78f..361c16ec4d8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -7937,9 +7937,9 @@ void ScriptEngine::evaluateAndProgressAllSequentialScripts( void ) #endif } - if( ai || aigroup ) { - if (((ai && (ai->isIdle()) || (aigroup && aigroup->isIdle())) && - seqScript->m_framesToWait < 1) || (seqScript->m_framesToWait == 0)) { + if (ai || aigroup) { + if (seqScript->m_framesToWait == 0 || + (seqScript->m_framesToWait < 0 && ((ai && ai->isIdle()) || (aigroup && aigroup->isIdle())))) { // We want to supress messages if we're repeatedly waiting for an event to occur, cause // it KILLS our debug framerate. diff --git a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp index f92649732dd..4dad1818a42 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp +++ b/GeneralsMD/Code/Tools/GUIEdit/Source/HierarchyView.cpp @@ -720,7 +720,7 @@ void HierarchyView::addWindowToTree( GameWindow *window, // add children if requested, but not on gadgets no matter what because // they are "atomic units", except for tab controls. // - if( addChildren && TheEditor->windowIsGadget( window ) == FALSE || (window->winGetStyle() & GWS_TAB_CONTROL) ) + if( (addChildren && TheEditor->windowIsGadget( window ) == FALSE) || (window->winGetStyle() & GWS_TAB_CONTROL) ) { GameWindow *child; From 9be5485a4e031a7c4f61600b7e2632f9ea5c3138 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 23 Jan 2026 22:13:51 +0100 Subject: [PATCH 104/211] perf(ini): Simplify, optimize and merge INI read line buffer implementation (#2143) --- Generals/Code/GameEngine/Include/Common/INI.h | 10 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 116 ++++++++------- .../Code/GameEngine/Include/Common/INI.h | 12 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 133 ++++++++++-------- 4 files changed, 136 insertions(+), 135 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h index 3854f3f0480..59b2e596605 100644 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ b/Generals/Code/GameEngine/Include/Common/INI.h @@ -392,12 +392,14 @@ class INI void readLine( void ); -// FILE *m_file; ///< file pointer of file currently loading - File *m_file; ///< file pointer of file currently loading + char* m_readBuffer; ///< internal read buffer + unsigned m_readBufferNext; ///< next char in read buffer + unsigned m_readBufferUsed; ///< number of bytes in read buffer + AsciiString m_filename; ///< filename of file currently loading INILoadType m_loadType; ///< load time for current file UnsignedInt m_lineNum; ///< current line number that's been read - char m_buffer[ INI_MAX_CHARS_PER_LINE ]; ///< buffer to read file contents into + char m_buffer[ INI_MAX_CHARS_PER_LINE+1 ];///< buffer to read file contents into const char *m_seps; ///< for strtok parsing const char *m_sepsPercent; ///< m_seps with percent delimiter as well const char *m_sepsColon; ///< m_seps with colon delimiter as well @@ -405,6 +407,6 @@ class INI const char *m_blockEndToken; ///< token to represent end of data block Bool m_endOfFile; ///< TRUE when we've hit EOF #ifdef DEBUG_CRASHING - char m_curBlockStart[ INI_MAX_CHARS_PER_LINE ]; ///< first line of cur block + char m_curBlockStart[ INI_MAX_CHARS_PER_LINE+1 ]; ///< first line of cur block #endif }; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 35729bfb52f..0034379e44b 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -174,7 +174,9 @@ Bool INI::isValidINIFilename( const char *filename ) INI::INI( void ) { - m_file = nullptr; + m_readBuffer = nullptr; + m_readBufferNext = 0; + m_readBufferUsed = 0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -294,7 +296,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer void INI::prepFile( AsciiString filename, INILoadType loadType ) { // if we have a file open already -- we can't do another one - if( m_file != nullptr ) + if( m_readBuffer != nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); @@ -303,8 +305,8 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) } // open the file - m_file = TheFileSystem->openFile(filename.str(), File::READ); - if( m_file == nullptr ) + File* file = TheFileSystem->openFile(filename.str(), File::READ); + if( file == nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); @@ -312,7 +314,9 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) } - m_file = m_file->convertToRAMFile(); + m_readBufferNext = 0; + m_readBufferUsed = file->size(); + m_readBuffer = file->readEntireAndClose(); // save our filename m_filename = filename; @@ -325,9 +329,12 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) //------------------------------------------------------------------------------------------------- void INI::unPrepFile() { - // close the file - m_file->close(); - m_file = nullptr; + // delete the buffer + delete[] m_readBuffer; + m_readBuffer = nullptr; + m_readBufferNext = 0; + m_readBufferUsed = 0; + m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -447,89 +454,78 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) //------------------------------------------------------------------------------------------------- /** Read a line from the already open file. Any comments will be removed and - * therefore ignored from any given line */ + * therefore ignored from any given line + * + * TheSuperHackers @performance xezon 18/01/2026 The file contents are now read directly from a + * full File Ram buffer into the INI Line Buffer without a third buffer in between. + */ //------------------------------------------------------------------------------------------------- void INI::readLine( void ) { - Bool isComment = FALSE; - // sanity - DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is null") ); + DEBUG_ASSERTCRASH( m_readBuffer, ("readLine(), read buffer is null") ); - // if we've reached end of file we'll just keep returning empty string in our buffer - if( m_endOfFile ) + if (m_endOfFile) { - m_buffer[ 0 ] = '\0'; + *m_buffer = 0; } else { - // read up till the newline character or until out of space - Int i = 0; - Bool done = FALSE; - while( !done ) + // read up till the newline or semicolon character, or until out of space + char *p = m_buffer; + while (p != m_buffer+INI_MAX_CHARS_PER_LINE) { - - // read character - m_endOfFile = (m_file->read(m_buffer + i, 1) == 0); - - // check for end of file - if( m_endOfFile ) + // test end of read buffer + if (m_readBufferNext==m_readBufferUsed) { - - done = TRUE; - m_buffer[ i ] = '\0'; - + m_endOfFile = true; + *p = 0; + break; } - // check for new line - if( m_buffer[ i ] == '\n' ) - done = TRUE; + // get next character + *p = m_readBuffer[m_readBufferNext++]; - DEBUG_ASSERTCRASH(m_buffer[ i ] != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d",m_filename.str(), getLineNum())); + // check for new line + if (*p == '\n') + { + *p = 0; + break; + } - // make all whitespace characters actual spaces - if( isspace( m_buffer[ i ] ) ) - m_buffer[ i ] = ' '; + DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d", m_filename.str(), getLineNum())); // if this is a semicolon, that represents the start of a comment - if( m_buffer[ i ] == ';' ) - isComment = TRUE; - - // if we've set the comment flag, just insert terminators in the place of each character read - if( isComment == TRUE ) - m_buffer[ i ] = '\0'; - - // - // when we've become done, as the last thing just set the current index position + 1 - // to the string terminator - // - if( done == TRUE && i + 1 < INI_MAX_CHARS_PER_LINE ) - m_buffer[ i + 1 ] = '\0'; - - // increase our buffer index, but watch out for the max - if( ++i == INI_MAX_CHARS_PER_LINE ) - done = TRUE; + if (*p == ';') + { + *p = 0; + } + + // make whitespace characters actual spaces + else if (*p > 0 && *p < 32) + { + *p = ' '; + } + p++; } + *p = 0; + // increase our line count m_lineNum++; // check for at the max - if( i == INI_MAX_CHARS_PER_LINE ) + if ( p == m_buffer+INI_MAX_CHARS_PER_LINE ) { - - DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", - INI_MAX_CHARS_PER_LINE) ); - + DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) ); } } if (s_xfer) { s_xfer->xferUser( m_buffer, sizeof( char ) * strlen( m_buffer ) ); - //DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s", ((XferCRC *)s_xfer)->getCRC(), - //m_filename.str(), m_buffer)); + //DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s", ((XferCRC *)s_xfer)->getCRC(), m_filename.str(), m_buffer)); } } diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h index 86437a1b461..7073bb270f6 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h @@ -395,15 +395,9 @@ class INI void readLine( void ); - File *m_file; ///< file pointer of file currently loading - - enum - { - INI_READ_BUFFER = 8192 ///< size of internal read buffer - }; - char m_readBuffer[INI_READ_BUFFER]; ///< internal read buffer - unsigned m_readBufferNext; ///< next char in read buffer - unsigned m_readBufferUsed; ///< number of bytes in read buffer + char* m_readBuffer; ///< internal read buffer + unsigned m_readBufferNext; ///< next char in read buffer + unsigned m_readBufferUsed; ///< number of bytes in read buffer AsciiString m_filename; ///< filename of file currently loading INILoadType m_loadType; ///< load time for current file diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 344f4de72e9..f94e4e71384 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -179,8 +179,9 @@ Bool INI::isValidINIFilename( const char *filename ) INI::INI( void ) { - m_file = nullptr; - m_readBufferNext=m_readBufferUsed=0; + m_readBuffer = nullptr; + m_readBufferNext = 0; + m_readBufferUsed = 0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -300,7 +301,7 @@ UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer void INI::prepFile( AsciiString filename, INILoadType loadType ) { // if we have a file open already -- we can't do another one - if( m_file != nullptr ) + if( m_readBuffer != nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); @@ -309,8 +310,8 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) } // open the file - m_file = TheFileSystem->openFile(filename.str(), File::READ); - if( m_file == nullptr ) + File* file = TheFileSystem->openFile(filename.str(), File::READ); + if( file == nullptr ) { DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); @@ -318,7 +319,9 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) } - m_file = m_file->convertToRAMFile(); + m_readBufferNext = 0; + m_readBufferUsed = file->size(); + m_readBuffer = file->readEntireAndClose(); // save our filename m_filename = filename; @@ -331,10 +334,12 @@ void INI::prepFile( AsciiString filename, INILoadType loadType ) //------------------------------------------------------------------------------------------------- void INI::unPrepFile() { - // close the file - m_file->close(); - m_file = nullptr; - m_readBufferUsed=m_readBufferNext=0; + // delete the buffer + delete[] m_readBuffer; + m_readBuffer = nullptr; + m_readBufferNext = 0; + m_readBufferUsed = 0; + m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -454,55 +459,63 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) //------------------------------------------------------------------------------------------------- /** Read a line from the already open file. Any comments will be removed and - * therefore ignored from any given line */ + * therefore ignored from any given line + * + * TheSuperHackers @performance xezon 18/01/2026 The file contents are now read directly from a + * full File Ram buffer into the INI Line Buffer without a third buffer in between. + */ //------------------------------------------------------------------------------------------------- void INI::readLine( void ) { // sanity - DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is null") ); - - if (m_endOfFile) - *m_buffer=0; - else - { - char *p=m_buffer; - while (p!=m_buffer+INI_MAX_CHARS_PER_LINE) - { - // get next character - if (m_readBufferNext==m_readBufferUsed) - { - // refill buffer - m_readBufferNext=0; - m_readBufferUsed=m_file->read(m_readBuffer,INI_READ_BUFFER); - - // EOF? - if (!m_readBufferUsed) - { - m_endOfFile=true; - *p=0; - break; - } - } - *p=m_readBuffer[m_readBufferNext++]; - - // CR? - if (*p=='\n') - { - *p=0; - break; - } - - DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d",m_filename.str(), getLineNum())); - - // comment? - if (*p==';') - *p=0; - // whitespace? - else if (*p>0&&*p<32) - *p=' '; - p++; - } - *p=0; + DEBUG_ASSERTCRASH( m_readBuffer, ("readLine(), read buffer is null") ); + + if (m_endOfFile) + { + *m_buffer = 0; + } + else + { + // read up till the newline or semicolon character, or until out of space + char *p = m_buffer; + while (p != m_buffer+INI_MAX_CHARS_PER_LINE) + { + // test end of read buffer + if (m_readBufferNext==m_readBufferUsed) + { + m_endOfFile = true; + *p = 0; + break; + } + + // get next character + *p = m_readBuffer[m_readBufferNext++]; + + // check for new line + if (*p == '\n') + { + *p = 0; + break; + } + + DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d", m_filename.str(), getLineNum())); + + // if this is a semicolon, that represents the start of a comment + if (*p == ';') + { + *p = 0; + } + + // make whitespace characters actual spaces + else if (*p > 0 && *p < 32) + { + *p = ' '; + } + + p++; + } + + *p = 0; // increase our line count m_lineNum++; @@ -510,18 +523,14 @@ void INI::readLine( void ) // check for at the max if ( p == m_buffer+INI_MAX_CHARS_PER_LINE ) { - - DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", - INI_MAX_CHARS_PER_LINE) ); - + DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) ); } - } + } if (s_xfer) { s_xfer->xferUser( m_buffer, sizeof( char ) * strlen( m_buffer ) ); - //DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s", ((XferCRC *)s_xfer)->getCRC(), - //m_filename.str(), m_buffer)); + //DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s", ((XferCRC *)s_xfer)->getCRC(), m_filename.str(), m_buffer)); } } From 669e36f579e15184b586e86e059c6486b3ec5f6a Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sat, 24 Jan 2026 21:30:50 +0100 Subject: [PATCH 105/211] fix(thingfactory): Prevent use-after-free from assert in ThingFactory::reset() (#2172) --- Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp | 4 ++-- .../Code/GameEngine/Source/Common/Thing/ThingFactory.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index af2eb25ac37..cecdcb09dd4 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -215,6 +215,8 @@ void ThingFactory::reset( void ) // t itself can be deleted if it is something created for this map only. Therefore, // we need to store what the next item is so that we don't orphan a bunch of templates. ThingTemplate *nextT = t->friend_getNextTemplate(); + DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); + if (t == m_firstTemplate) { possibleAdjustment = TRUE; } @@ -236,8 +238,6 @@ void ThingFactory::reset( void ) m_templateHashMap.erase(templateName); } - DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); - t = nextT; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index f5bd7b72291..6a589b18208 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -215,6 +215,8 @@ void ThingFactory::reset( void ) // t itself can be deleted if it is something created for this map only. Therefore, // we need to store what the next item is so that we don't orphan a bunch of templates. ThingTemplate *nextT = t->friend_getNextTemplate(); + DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); + if (t == m_firstTemplate) { possibleAdjustment = TRUE; } @@ -236,8 +238,6 @@ void ThingFactory::reset( void ) m_templateHashMap.erase(templateName); } - DEBUG_ASSERTCRASH(!nextT || t->getTemplateID() == nextT->getTemplateID() + 1, ("Next template ID is unexpected")); - t = nextT; } From 56c9600c3b8965ad6033bb4d631659aa9d3f0787 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 25 Jan 2026 07:35:45 +1100 Subject: [PATCH 106/211] tweak(upgrade): Increase upgrade limit to 512 (#2162) --- Core/GameEngine/Source/Common/System/Xfer.cpp | 10 +++++- .../Code/GameEngine/Include/Common/BitFlags.h | 33 +++++++++++++++++++ .../Code/GameEngine/Include/Common/Player.h | 4 +-- .../Code/GameEngine/Include/Common/Upgrade.h | 6 ++-- .../Module/DelayedWeaponSetUpgradeUpdate.h | 2 +- .../Include/GameLogic/Module/UpdateModule.h | 2 +- .../Include/GameLogic/Module/UpgradeModule.h | 16 ++++----- .../GameEngine/Include/GameLogic/Object.h | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 10 +++--- .../Source/GameLogic/Object/Object.cpp | 16 ++++++--- .../Update/DelayedWeaponSetUpgradeUpdate.cpp | 2 +- .../FireOCLAfterWeaponCooldownUpdate.cpp | 4 +-- .../Object/Upgrade/UpgradeModule.cpp | 8 ++--- .../Code/GameEngine/Include/Common/BitFlags.h | 33 +++++++++++++++++++ .../Code/GameEngine/Include/Common/Player.h | 4 +-- .../Code/GameEngine/Include/Common/Upgrade.h | 6 ++-- .../Include/GameLogic/Module/UpgradeModule.h | 16 ++++----- .../GameEngine/Include/GameLogic/Object.h | 2 +- .../GameEngine/Source/Common/RTS/Player.cpp | 10 +++--- .../Behavior/GenerateMinefieldBehavior.cpp | 4 +-- .../Source/GameLogic/Object/Object.cpp | 16 ++++++--- .../FireOCLAfterWeaponCooldownUpdate.cpp | 4 +-- .../Object/Upgrade/CommandSetUpgrade.cpp | 6 ++-- .../Object/Upgrade/UpgradeModule.cpp | 8 ++--- 24 files changed, 159 insertions(+), 65 deletions(-) diff --git a/Core/GameEngine/Source/Common/System/Xfer.cpp b/Core/GameEngine/Source/Common/System/Xfer.cpp index 205504a19be..63e13bd5d63 100644 --- a/Core/GameEngine/Source/Common/System/Xfer.cpp +++ b/Core/GameEngine/Source/Common/System/Xfer.cpp @@ -810,7 +810,15 @@ void Xfer::xferUpgradeMask( UpgradeMaskType *upgradeMaskData ) { // just xfer implementation the data itself - xferImplementation( upgradeMaskData, sizeof( UpgradeMaskType ) ); +#if RETAIL_COMPATIBLE_CRC +#if RTS_GENERALS + xferImplementation(upgradeMaskData, 8); // The original upgrade mask was 8 bytes in Generals. +#else + xferImplementation(upgradeMaskData, 16); // The original upgrade mask was 16 bytes in Zero Hour. +#endif +#else + xferImplementation(upgradeMaskData, sizeof(UpgradeMaskType)); +#endif } else diff --git a/Generals/Code/GameEngine/Include/Common/BitFlags.h b/Generals/Code/GameEngine/Include/Common/BitFlags.h index ed6bee9fd2f..5c572210109 100644 --- a/Generals/Code/GameEngine/Include/Common/BitFlags.h +++ b/Generals/Code/GameEngine/Include/Common/BitFlags.h @@ -328,5 +328,38 @@ class BitFlags } } + // TheSuperHackers @feature Stubbjax 23/01/2026 Add function for outputting debug data. + AsciiString toHexString() const + { + constexpr const int numChunks = (NUMBITS + 63) / 64; + char chunkBuf[32]; // Enough for 16 hex digits + null terminator + AsciiString result; + bool printedAny = false; + + for (int chunk = numChunks - 1; chunk >= 0; --chunk) + { + unsigned long long val = 0; + for (int bit = 0; bit < 64 && (chunk * 64 + bit) < NUMBITS; ++bit) + { + if (m_bits.test(chunk * 64 + bit)) + val |= (unsigned long long)(1) << bit; + } + + if (val != 0 || chunk == 0 || printedAny) + { + if (printedAny) + snprintf(chunkBuf, sizeof(chunkBuf), "%016llX", val); + else + snprintf(chunkBuf, sizeof(chunkBuf), "%llX", val); + + result.concat(chunkBuf); + printedAny = true; + } + } + + if (!printedAny) + result = "0"; + return result; + } }; diff --git a/Generals/Code/GameEngine/Include/Common/Player.h b/Generals/Code/GameEngine/Include/Common/Player.h index 2999c62ebe2..3bcfa6d3502 100644 --- a/Generals/Code/GameEngine/Include/Common/Player.h +++ b/Generals/Code/GameEngine/Include/Common/Player.h @@ -289,8 +289,8 @@ class Player : public Snapshot Bool hasPrereqsForScience(ScienceType t) const; Bool hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const; ///< does player have totally done and produced upgrade - Bool hasUpgradeComplete( UpgradeMaskType testMask ) const; ///< does player have totally done and produced upgrade - UpgradeMaskType getCompletedUpgradeMask() const { return m_upgradesCompleted; } ///< get list of upgrades that are completed + Bool hasUpgradeComplete( const UpgradeMaskType& testMask ) const; ///< does player have totally done and produced upgrade + const UpgradeMaskType& getCompletedUpgradeMask() const { return m_upgradesCompleted; } ///< get list of upgrades that are completed Bool hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ); ///< does player have this upgrade in progress right now Upgrade *addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStatusType status ); ///< add upgrade, or update existing upgrade status diff --git a/Generals/Code/GameEngine/Include/Common/Upgrade.h b/Generals/Code/GameEngine/Include/Common/Upgrade.h index 9f587e36bc7..c43f5df46ad 100644 --- a/Generals/Code/GameEngine/Include/Common/Upgrade.h +++ b/Generals/Code/GameEngine/Include/Common/Upgrade.h @@ -51,7 +51,9 @@ enum UpgradeStatusType CPP_11(: Int) }; //The maximum number of upgrades. -#define UPGRADE_MAX_COUNT 64 +// TheSuperHackers @tweak Stubbjax 22/01/2026 Increases max upgrade count from 64 to allow for more upgrades. +// A value of 512 was chosen to allow room for plenty of upgrades while also conserving memory. +#define UPGRADE_MAX_COUNT 512 typedef BitFlags UpgradeMaskType; @@ -172,7 +174,7 @@ class UpgradeTemplate : public MemoryPoolObject void setUpgradeNameKey( NameKeyType key ) { m_nameKey = key; } NameKeyType getUpgradeNameKey( void ) const { return m_nameKey; } const AsciiString& getDisplayNameLabel( void ) const { return m_displayNameLabel; } - UpgradeMaskType getUpgradeMask() const { return m_upgradeMask; } + const UpgradeMaskType& getUpgradeMask() const { return m_upgradeMask; } UpgradeType getUpgradeType( void ) const { return m_type; } const AudioEventRTS* getResearchCompleteSound() const { return &m_researchSound; } const AudioEventRTS* getUnitSpecificSound() const { return &m_unitSpecificSound; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedWeaponSetUpgradeUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedWeaponSetUpgradeUpdate.h index 5e0811dc40e..65489136268 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedWeaponSetUpgradeUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DelayedWeaponSetUpgradeUpdate.h @@ -58,7 +58,7 @@ class DelayedWeaponSetUpgradeUpdate : public UpdateModule, public DelayedUpgrade DelayedWeaponSetUpgradeUpdate( Thing *thing, const ModuleData* moduleData ); // virtual destructor prototype provided by memory pool declaration - virtual Bool isTriggeredBy( UpgradeMaskType potentialMask ); ///< If you were an upgrade, would you trigger for this? + virtual Bool isTriggeredBy( const UpgradeMaskType& potentialMask ); ///< If you were an upgrade, would you trigger for this? virtual void setDelay( UnsignedInt startingDelay ); ///< Start the upgrade doing countdown virtual UpdateSleepTime update(); diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/UpdateModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/UpdateModule.h index f2869ab979c..d5f4dc85bd4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/UpdateModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/UpdateModule.h @@ -366,6 +366,6 @@ class ExitInterface class DelayedUpgradeUpdateInterface { public: - virtual Bool isTriggeredBy( UpgradeMaskType potentialMask ) = 0; ///< If you were an upgrade, would you trigger for this? + virtual Bool isTriggeredBy( const UpgradeMaskType& potentialMask ) = 0; ///< If you were an upgrade, would you trigger for this? virtual void setDelay( UnsignedInt startingDelay ) = 0; ///< Start the upgrade doing countdown }; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h index 5579599a3b9..06f34785b19 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h @@ -51,12 +51,12 @@ class UpgradeModuleInterface public: virtual Bool isAlreadyUpgraded() const = 0; - virtual Bool attemptUpgrade( UpgradeMaskType keyMask ) = 0; - virtual Bool wouldUpgrade( UpgradeMaskType keyMask ) const = 0; - virtual Bool resetUpgrade( UpgradeMaskType keyMask ) = 0; + virtual Bool attemptUpgrade( const UpgradeMaskType& keyMask ) = 0; + virtual Bool wouldUpgrade( const UpgradeMaskType& keyMask ) const = 0; + virtual Bool resetUpgrade( const UpgradeMaskType& keyMask ) = 0; virtual Bool isSubObjectsUpgrade() = 0; virtual void forceRefreshUpgrade() = 0; - virtual Bool testUpgradeConditions( UpgradeMaskType keyMask ) const = 0; + virtual Bool testUpgradeConditions( const UpgradeMaskType& keyMask ) const = 0; }; @@ -108,10 +108,10 @@ class UpgradeMux : public UpgradeModuleInterface virtual Bool isAlreadyUpgraded() const ; // ***DANGER! DANGER! Don't use this, unless you are forcing an already made upgrade to refresh!! virtual void forceRefreshUpgrade(); - virtual Bool attemptUpgrade( UpgradeMaskType keyMask ); - virtual Bool wouldUpgrade( UpgradeMaskType keyMask ) const; - virtual Bool resetUpgrade( UpgradeMaskType keyMask ); - virtual Bool testUpgradeConditions( UpgradeMaskType keyMask ) const; + virtual Bool attemptUpgrade( const UpgradeMaskType& keyMask ); + virtual Bool wouldUpgrade( const UpgradeMaskType& keyMask ) const; + virtual Bool resetUpgrade( const UpgradeMaskType& keyMask ); + virtual Bool testUpgradeConditions( const UpgradeMaskType& keyMask ) const; protected: diff --git a/Generals/Code/GameEngine/Include/GameLogic/Object.h b/Generals/Code/GameEngine/Include/GameLogic/Object.h index 28a5e2bfc55..2b47c36caa7 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Object.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Object.h @@ -315,7 +315,7 @@ class Object : public Thing, public Snapshot void setStatus( ObjectStatusMaskType objectStatus, Bool set = true ); inline void clearStatus( ObjectStatusMaskType objectStatus ) { setStatus( objectStatus, false ); } void updateUpgradeModules(); ///< We need to go through our Upgrade Modules and see which should be activated - UpgradeMaskType getObjectCompletedUpgradeMask() const { return m_objectUpgradesCompleted; } ///< Upgrades I complete locally + const UpgradeMaskType& getObjectCompletedUpgradeMask() const { return m_objectUpgradesCompleted; } ///< Upgrades I complete locally //This function sucks. //It was added for objects that can disguise as other objects and contain upgraded subobject overrides. diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 5e2a6366d4b..e9f29b1ec96 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -2515,7 +2515,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) //================================================================================================= Bool Player::hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const { - UpgradeMaskType testMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& testMask = upgradeTemplate->getUpgradeMask(); return hasUpgradeComplete( testMask ); } @@ -2524,7 +2524,7 @@ Bool Player::hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const Does the player have this completed upgrade. This form is exposed so Objects can do quick lookups. */ //================================================================================================= -Bool Player::hasUpgradeComplete( UpgradeMaskType testMask ) const +Bool Player::hasUpgradeComplete( const UpgradeMaskType& testMask ) const { return m_upgradesCompleted.testForAll( testMask ); } @@ -2534,7 +2534,7 @@ Bool Player::hasUpgradeComplete( UpgradeMaskType testMask ) const //================================================================================================= Bool Player::hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ) { - UpgradeMaskType testMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& testMask = upgradeTemplate->getUpgradeMask(); return m_upgradesInProgress.testForAll( testMask ); } @@ -2565,7 +2565,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat u->setStatus( status ); // Update our Bitmasks - UpgradeMaskType newMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& newMask = upgradeTemplate->getUpgradeMask(); if( status == UPGRADE_STATUS_IN_PRODUCTION ) { m_upgradesInProgress.set( newMask ); @@ -2631,7 +2631,7 @@ void Player::removeUpgrade( const UpgradeTemplate *upgradeTemplate ) m_upgradeList = upgrade->friend_getNext(); // Clear this upgrade's bits from our mind - UpgradeMaskType oldMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& oldMask = upgradeTemplate->getUpgradeMask(); m_upgradesInProgress.clear( oldMask ); m_upgradesCompleted.clear( oldMask ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 63cef1714b7..3761d1db50c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2185,8 +2185,8 @@ Bool Object::isSalvageCrate() const */ void Object::updateUpgradeModules() { - UpgradeMaskType playerMask = getControllingPlayer()->getCompletedUpgradeMask(); - UpgradeMaskType objectMask = getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = getObjectCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); // We need to add in all of the already owned upgrades to handle "AND" requiring upgrades. @@ -3459,11 +3459,19 @@ void Object::crc( Xfer *xfer ) logString.concat(tmp); } #endif // DEBUG_CRC +#if RETAIL_COMPATIBLE_CRC xfer->xferUser(&m_objectUpgradesCompleted, sizeof(Int64)); +#else + xfer->xferUser(&m_objectUpgradesCompleted, sizeof(m_objectUpgradesCompleted)); +#endif #ifdef DEBUG_CRC if (doLogging) { +#if RETAIL_COMPATIBLE_CRC tmp.format("m_objectUpgradesCompleted: %I64X, ", m_objectUpgradesCompleted); +#else + tmp.format("m_objectUpgradesCompleted: %s, ", m_objectUpgradesCompleted.toHexString().c_str()); +#endif logString.concat(tmp); } #endif // DEBUG_CRC @@ -3965,8 +3973,8 @@ Bool Object::hasUpgrade( const UpgradeTemplate *upgradeT ) const //------------------------------------------------------------------------------------------------- Bool Object::affectedByUpgrade( const UpgradeTemplate *upgradeT ) const { - UpgradeMaskType objectMask = getObjectCompletedUpgradeMask(); - UpgradeMaskType playerMask = getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = getControllingPlayer()->getCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); maskToCheck.set( upgradeT->getUpgradeMask() ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp index 1dc715090bb..b1a39e660a2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/DelayedWeaponSetUpgradeUpdate.cpp @@ -82,7 +82,7 @@ UpdateSleepTime DelayedWeaponSetUpgradeUpdate::update( void ) return UPDATE_SLEEP_NONE; } -Bool DelayedWeaponSetUpgradeUpdate::isTriggeredBy( UpgradeMaskType potentialMask ) +Bool DelayedWeaponSetUpgradeUpdate::isTriggeredBy(const UpgradeMaskType& potentialMask ) { potentialMask; return FALSE; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index 7add830fe8d..a4c36067f98 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -121,8 +121,8 @@ UpdateSleepTime FireOCLAfterWeaponCooldownUpdate::update( void ) validThisFrame = false; } - UpgradeMaskType objectMask = obj->getObjectCompletedUpgradeMask(); - UpgradeMaskType playerMask = obj->getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = obj->getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = obj->getControllingPlayer()->getCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); if( validThisFrame && !testUpgradeConditions( maskToCheck ) ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp index f9425513a97..b61fe7a3bcb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp @@ -108,7 +108,7 @@ void UpgradeMux::forceRefreshUpgrade() // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::attemptUpgrade( UpgradeMaskType keyMask ) +Bool UpgradeMux::attemptUpgrade( const UpgradeMaskType& keyMask ) { if (wouldUpgrade(keyMask)) { @@ -121,7 +121,7 @@ Bool UpgradeMux::attemptUpgrade( UpgradeMaskType keyMask ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::wouldUpgrade( UpgradeMaskType keyMask ) const +Bool UpgradeMux::wouldUpgrade( const UpgradeMaskType& keyMask ) const { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); @@ -156,7 +156,7 @@ Bool UpgradeMux::wouldUpgrade( UpgradeMaskType keyMask ) const } //------------------------------------------------------------------------------------------------- -Bool UpgradeMux::testUpgradeConditions( UpgradeMaskType keyMask ) const +Bool UpgradeMux::testUpgradeConditions( const UpgradeMaskType& keyMask ) const { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); @@ -197,7 +197,7 @@ Bool UpgradeMux::testUpgradeConditions( UpgradeMaskType keyMask ) const // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::resetUpgrade( UpgradeMaskType keyMask ) +Bool UpgradeMux::resetUpgrade( const UpgradeMaskType& keyMask ) { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h index 0e06ee8d388..2fb3ef744d7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h @@ -328,5 +328,38 @@ class BitFlags } } + // TheSuperHackers @feature Stubbjax 23/01/2026 Add function for outputting debug data. + AsciiString toHexString() const + { + constexpr const int numChunks = (NUMBITS + 63) / 64; + char chunkBuf[32]; // Enough for 16 hex digits + null terminator + AsciiString result; + bool printedAny = false; + + for (int chunk = numChunks - 1; chunk >= 0; --chunk) + { + unsigned long long val = 0; + for (int bit = 0; bit < 64 && (chunk * 64 + bit) < NUMBITS; ++bit) + { + if (m_bits.test(chunk * 64 + bit)) + val |= (unsigned long long)(1) << bit; + } + + if (val != 0 || chunk == 0 || printedAny) + { + if (printedAny) + snprintf(chunkBuf, sizeof(chunkBuf), "%016llX", val); + else + snprintf(chunkBuf, sizeof(chunkBuf), "%llX", val); + + result.concat(chunkBuf); + printedAny = true; + } + } + + if (!printedAny) + result = "0"; + return result; + } }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h index 67b9eb662ce..f57b7b58366 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h @@ -310,8 +310,8 @@ class Player : public Snapshot Bool hasPrereqsForScience(ScienceType t) const; Bool hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const; ///< does player have totally done and produced upgrade - Bool hasUpgradeComplete( UpgradeMaskType testMask ) const; ///< does player have totally done and produced upgrade - UpgradeMaskType getCompletedUpgradeMask() const { return m_upgradesCompleted; } ///< get list of upgrades that are completed + Bool hasUpgradeComplete( const UpgradeMaskType& testMask ) const; ///< does player have totally done and produced upgrade + const UpgradeMaskType& getCompletedUpgradeMask() const { return m_upgradesCompleted; } ///< get list of upgrades that are completed Bool hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ); ///< does player have this upgrade in progress right now Upgrade *addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStatusType status ); ///< add upgrade, or update existing upgrade status diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h index accd45dc049..18136c1cc81 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h @@ -52,7 +52,9 @@ enum UpgradeStatusType CPP_11(: Int) }; //The maximum number of upgrades. -#define UPGRADE_MAX_COUNT 128 +// TheSuperHackers @tweak Stubbjax 22/01/2026 Increases max upgrade count from 128 to allow for more upgrades. +// A value of 512 was chosen to allow room for plenty of upgrades while also conserving memory. +#define UPGRADE_MAX_COUNT 512 typedef BitFlags UpgradeMaskType; @@ -173,7 +175,7 @@ class UpgradeTemplate : public MemoryPoolObject void setUpgradeNameKey( NameKeyType key ) { m_nameKey = key; } NameKeyType getUpgradeNameKey( void ) const { return m_nameKey; } const AsciiString& getDisplayNameLabel( void ) const { return m_displayNameLabel; } - UpgradeMaskType getUpgradeMask() const { return m_upgradeMask; } + const UpgradeMaskType& getUpgradeMask() const { return m_upgradeMask; } UpgradeType getUpgradeType( void ) const { return m_type; } const AudioEventRTS* getResearchCompleteSound() const { return &m_researchSound; } const AudioEventRTS* getUnitSpecificSound() const { return &m_unitSpecificSound; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h index a44012a0291..168f719b028 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/UpgradeModule.h @@ -51,12 +51,12 @@ class UpgradeModuleInterface public: virtual Bool isAlreadyUpgraded() const = 0; - virtual Bool attemptUpgrade( UpgradeMaskType keyMask ) = 0; - virtual Bool wouldUpgrade( UpgradeMaskType keyMask ) const = 0; - virtual Bool resetUpgrade( UpgradeMaskType keyMask ) = 0; + virtual Bool attemptUpgrade( const UpgradeMaskType& keyMask ) = 0; + virtual Bool wouldUpgrade( const UpgradeMaskType& keyMask ) const = 0; + virtual Bool resetUpgrade( const UpgradeMaskType& keyMask ) = 0; virtual Bool isSubObjectsUpgrade() = 0; virtual void forceRefreshUpgrade() = 0; - virtual Bool testUpgradeConditions( UpgradeMaskType keyMask ) const = 0; + virtual Bool testUpgradeConditions( const UpgradeMaskType& keyMask ) const = 0; }; @@ -119,10 +119,10 @@ class UpgradeMux : public UpgradeModuleInterface virtual Bool isAlreadyUpgraded() const ; // ***DANGER! DANGER! Don't use this, unless you are forcing an already made upgrade to refresh!! virtual void forceRefreshUpgrade(); - virtual Bool attemptUpgrade( UpgradeMaskType keyMask ); - virtual Bool wouldUpgrade( UpgradeMaskType keyMask ) const; - virtual Bool resetUpgrade( UpgradeMaskType keyMask ); - virtual Bool testUpgradeConditions( UpgradeMaskType keyMask ) const; + virtual Bool attemptUpgrade( const UpgradeMaskType& keyMask ); + virtual Bool wouldUpgrade( const UpgradeMaskType& keyMask ) const; + virtual Bool resetUpgrade( const UpgradeMaskType& keyMask ); + virtual Bool testUpgradeConditions( const UpgradeMaskType& keyMask ) const; protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 5c2851ef7bd..a66b174c037 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -336,7 +336,7 @@ class Object : public Thing, public Snapshot void setStatus( ObjectStatusMaskType objectStatus, Bool set = true ); inline void clearStatus( ObjectStatusMaskType objectStatus ) { setStatus( objectStatus, false ); } void updateUpgradeModules(); ///< We need to go through our Upgrade Modules and see which should be activated - UpgradeMaskType getObjectCompletedUpgradeMask() const { return m_objectUpgradesCompleted; } ///< Upgrades I complete locally + const UpgradeMaskType& getObjectCompletedUpgradeMask() const { return m_objectUpgradesCompleted; } ///< Upgrades I complete locally //This function sucks. //It was added for objects that can disguise as other objects and contain upgraded subobject overrides. diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index d44c0ac9fbf..f9d527d4370 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -2996,7 +2996,7 @@ Upgrade *Player::findUpgrade( const UpgradeTemplate *upgradeTemplate ) //================================================================================================= Bool Player::hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const { - UpgradeMaskType testMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& testMask = upgradeTemplate->getUpgradeMask(); return hasUpgradeComplete( testMask ); } @@ -3005,7 +3005,7 @@ Bool Player::hasUpgradeComplete( const UpgradeTemplate *upgradeTemplate ) const Does the player have this completed upgrade. This form is exposed so Objects can do quick lookups. */ //================================================================================================= -Bool Player::hasUpgradeComplete( UpgradeMaskType testMask ) const +Bool Player::hasUpgradeComplete( const UpgradeMaskType& testMask ) const { return m_upgradesCompleted.testForAll( testMask ); } @@ -3015,7 +3015,7 @@ Bool Player::hasUpgradeComplete( UpgradeMaskType testMask ) const //================================================================================================= Bool Player::hasUpgradeInProduction( const UpgradeTemplate *upgradeTemplate ) { - UpgradeMaskType testMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& testMask = upgradeTemplate->getUpgradeMask(); return m_upgradesInProgress.testForAll( testMask ); } @@ -3046,7 +3046,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat u->setStatus( status ); // Update our Bitmasks - UpgradeMaskType newMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& newMask = upgradeTemplate->getUpgradeMask(); if( status == UPGRADE_STATUS_IN_PRODUCTION ) { m_upgradesInProgress.set( newMask ); @@ -3117,7 +3117,7 @@ void Player::removeUpgrade( const UpgradeTemplate *upgradeTemplate ) m_upgradeList = upgrade->friend_getNext(); // Clear this upgrade's bits from our mind - UpgradeMaskType oldMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& oldMask = upgradeTemplate->getUpgradeMask(); m_upgradesInProgress.clear( oldMask ); m_upgradesCompleted.clear( oldMask ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index c0e9bf294a5..0ecfef1564a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -464,8 +464,8 @@ UpdateSleepTime GenerateMinefieldBehavior::update() if (upgradeTemplate) { - UpgradeMaskType upgradeMask = upgradeTemplate->getUpgradeMask(); - UpgradeMaskType objMask = getObject()->getObjectCompletedUpgradeMask(); + const UpgradeMaskType& upgradeMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& objMask = getObject()->getObjectCompletedUpgradeMask(); if (objMask.testForAny(upgradeMask)) { m_upgraded = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 691247f610e..3d7f0031d6a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -2473,8 +2473,8 @@ void Object::updateUpgradeModules() if( getControllingPlayer() == nullptr ) return; // This can only happen in game teardown. No upgrades for you without a player. Weird crashes are bad. - UpgradeMaskType playerMask = getControllingPlayer()->getCompletedUpgradeMask(); - UpgradeMaskType objectMask = getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = getObjectCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); // We need to add in all of the already owned upgrades to handle "AND" requiring upgrades. @@ -3971,11 +3971,19 @@ void Object::crc( Xfer *xfer ) logString.concat(tmp); } #endif // DEBUG_CRC +#if RETAIL_COMPATIBLE_CRC xfer->xferUser(&m_objectUpgradesCompleted, sizeof(Int64)); +#else + xfer->xferUser(&m_objectUpgradesCompleted, sizeof(m_objectUpgradesCompleted)); +#endif #ifdef DEBUG_CRC if (doLogging) { +#if RETAIL_COMPATIBLE_CRC tmp.format("m_objectUpgradesCompleted: %I64X, ", m_objectUpgradesCompleted); +#else + tmp.format("m_objectUpgradesCompleted: %s, ", m_objectUpgradesCompleted.toHexString().c_str()); +#endif logString.concat(tmp); } #endif // DEBUG_CRC @@ -4487,8 +4495,8 @@ Bool Object::hasUpgrade( const UpgradeTemplate *upgradeT ) const //------------------------------------------------------------------------------------------------- Bool Object::affectedByUpgrade( const UpgradeTemplate *upgradeT ) const { - UpgradeMaskType objectMask = getObjectCompletedUpgradeMask(); - UpgradeMaskType playerMask = getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = getControllingPlayer()->getCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); maskToCheck.set( upgradeT->getUpgradeMask() ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp index 35f9565bd7c..70f769039a3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireOCLAfterWeaponCooldownUpdate.cpp @@ -121,8 +121,8 @@ UpdateSleepTime FireOCLAfterWeaponCooldownUpdate::update( void ) validThisFrame = false; } - UpgradeMaskType objectMask = obj->getObjectCompletedUpgradeMask(); - UpgradeMaskType playerMask = obj->getControllingPlayer()->getCompletedUpgradeMask(); + const UpgradeMaskType& objectMask = obj->getObjectCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = obj->getControllingPlayer()->getCompletedUpgradeMask(); UpgradeMaskType maskToCheck = playerMask; maskToCheck.set( objectMask ); if( validThisFrame && !testUpgradeConditions( maskToCheck ) ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp index bb2f5ff9e4f..aaa6a56eb69 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp @@ -73,13 +73,13 @@ void CommandSetUpgrade::upgradeImplementation( ) if (upgradeTemplate) { - UpgradeMaskType upgradeMask = upgradeTemplate->getUpgradeMask(); + const UpgradeMaskType& upgradeMask = upgradeTemplate->getUpgradeMask(); // See if upgrade is found in the player completed upgrades Player *player = obj->getControllingPlayer(); if (player) { - UpgradeMaskType playerMask = player->getCompletedUpgradeMask(); + const UpgradeMaskType& playerMask = player->getCompletedUpgradeMask(); if (playerMask.testForAny(upgradeMask)) { obj->setCommandSetStringOverride( getCommandSetUpgradeModuleData()->m_newCommandSetAlt ); @@ -89,7 +89,7 @@ void CommandSetUpgrade::upgradeImplementation( ) } // See if upgrade is found in the object completed upgrades - UpgradeMaskType objMask = obj->getObjectCompletedUpgradeMask(); + const UpgradeMaskType& objMask = obj->getObjectCompletedUpgradeMask(); if (objMask.testForAny(upgradeMask)) { obj->setCommandSetStringOverride( getCommandSetUpgradeModuleData()->m_newCommandSetAlt ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp index 314cb8ee26e..3324ed33cf0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Upgrade/UpgradeModule.cpp @@ -108,7 +108,7 @@ void UpgradeMux::forceRefreshUpgrade() // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::attemptUpgrade( UpgradeMaskType keyMask ) +Bool UpgradeMux::attemptUpgrade( const UpgradeMaskType& keyMask ) { if (wouldUpgrade(keyMask)) { @@ -121,7 +121,7 @@ Bool UpgradeMux::attemptUpgrade( UpgradeMaskType keyMask ) // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::wouldUpgrade( UpgradeMaskType keyMask ) const +Bool UpgradeMux::wouldUpgrade( const UpgradeMaskType& keyMask ) const { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); @@ -166,7 +166,7 @@ void UpgradeMux::giveSelfUpgrade() } //------------------------------------------------------------------------------------------------- -Bool UpgradeMux::testUpgradeConditions( UpgradeMaskType keyMask ) const +Bool UpgradeMux::testUpgradeConditions( const UpgradeMaskType& keyMask ) const { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); @@ -207,7 +207,7 @@ Bool UpgradeMux::testUpgradeConditions( UpgradeMaskType keyMask ) const // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ -Bool UpgradeMux::resetUpgrade( UpgradeMaskType keyMask ) +Bool UpgradeMux::resetUpgrade( const UpgradeMaskType& keyMask ) { UpgradeMaskType activation, conflicting; getUpgradeActivationMasks(activation, conflicting); From 84609c2e61116a4d03c4cc6bfdda884c0c52f62f Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 25 Jan 2026 07:43:52 +1100 Subject: [PATCH 107/211] bugfix(ai): Units located above the terrain can no longer teleport into airborne transports (#1794) --- .../GameEngine/Source/GameLogic/AI/AIStates.cpp | 15 +++++++++++++++ .../GameEngine/Source/GameLogic/AI/AIStates.cpp | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 9d015540af3..bef5b206ba8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -6082,6 +6082,15 @@ void AIEnterState::onExit( StateExitType status ) } } +static bool hasVerticalOverlap(const Object* a, const Object* b) +{ + const float aLower = a->getPosition()->z; + const float aUpper = aLower + a->getGeometryInfo().getMaxHeightAbovePosition(); + const float bLower = b->getPosition()->z; + const float bUpper = bLower + b->getGeometryInfo().getMaxHeightAbovePosition(); + return aUpper >= bLower && aLower <= bUpper; +} + //---------------------------------------------------------------------------------------------------------- StateReturnType AIEnterState::update() { @@ -6145,7 +6154,13 @@ StateReturnType AIEnterState::update() StateReturnType code = AIInternalMoveToState::update(); // if it's airborne, wait for it to land +#if RETAIL_COMPATIBLE_CRC if (code == STATE_SUCCESS && goal->isAboveTerrain() && !obj->isAboveTerrain()) +#else + // TheSuperHackers @bugfix Stubbjax 05/11/2025 Check for vertical overlap when entering containers. + // This prevents levitating or airborne units from entering containers they are not actually touching. + if (code == STATE_SUCCESS && !hasVerticalOverlap(goal, obj)) +#endif { code = STATE_CONTINUE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index fee90eac22f..8bd80191ef2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -6294,6 +6294,15 @@ void AIEnterState::onExit( StateExitType status ) } } +static bool hasVerticalOverlap(const Object* a, const Object* b) +{ + const float aLower = a->getPosition()->z; + const float aUpper = aLower + a->getGeometryInfo().getMaxHeightAbovePosition(); + const float bLower = b->getPosition()->z; + const float bUpper = bLower + b->getGeometryInfo().getMaxHeightAbovePosition(); + return aUpper >= bLower && aLower <= bUpper; +} + //---------------------------------------------------------------------------------------------------------- StateReturnType AIEnterState::update() { @@ -6357,7 +6366,13 @@ StateReturnType AIEnterState::update() StateReturnType code = AIInternalMoveToState::update(); // if it's airborne, wait for it to land +#if RETAIL_COMPATIBLE_CRC if (code == STATE_SUCCESS && goal->isAboveTerrain() && !obj->isAboveTerrain()) +#else + // TheSuperHackers @bugfix Stubbjax 05/11/2025 Check for vertical overlap when entering containers. + // This prevents levitating or airborne units from entering containers they are not actually touching. + if (code == STATE_SUCCESS && !hasVerticalOverlap(goal, obj)) +#endif { code = STATE_CONTINUE; } From ddccc0c7d6a7463b9e008aae624097def151f35e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 16:12:42 +0100 Subject: [PATCH 108/211] unity(basetype): Merge Lib/BaseType.h code (#2180) --- .../Code/Libraries/Include/Lib/BaseType.h | 25 ++++++++-- .../Code/Libraries/Include/Lib/BaseType.h | 49 +++++++++++++++++++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/Generals/Code/Libraries/Include/Lib/BaseType.h b/Generals/Code/Libraries/Include/Lib/BaseType.h index 73b766ede9a..274f700f76e 100644 --- a/Generals/Code/Libraries/Include/Lib/BaseType.h +++ b/Generals/Code/Libraries/Include/Lib/BaseType.h @@ -65,7 +65,7 @@ inline Real deg2rad(Real rad) { return rad * (PI/180); } //----------------------------------------------------------------------------- // For twiddling bits //----------------------------------------------------------------------------- -// TheSuperHackers @build xezon 22/03/2025 Renames BitTest to BitIsSet to prevent conflict with BitTest macro from winnt.h +// TheSuperHackers @build xezon 17/03/2025 Renames BitTest to BitIsSet to prevent conflict with BitTest macro from winnt.h #define BitIsSet( x, i ) ( ( (x) & (i) ) != 0 ) #define BitSet( x, i ) ( (x) |= (i) ) #define BitClear( x, i ) ( (x ) &= ~(i) ) @@ -151,8 +151,13 @@ __forceinline float fast_float_ceil(float f) #define INT_TO_REAL(x) ((Real)(x)) // once we've ceiled/floored, trunc and round are identical, and currently, round is faster... (srj) +#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ #define REAL_TO_INT_CEIL(x) (fast_float2long_round(ceilf(x))) #define REAL_TO_INT_FLOOR(x) (fast_float2long_round(floorf(x))) +#else +#define REAL_TO_INT_CEIL(x) (fast_float2long_round(fast_float_ceil(x))) +#define REAL_TO_INT_FLOOR(x) (fast_float2long_round(fast_float_floor(x))) +#endif #define FAST_REAL_TRUNC(x) fast_float_trunc(x) #define FAST_REAL_CEIL(x) fast_float_ceil(x) @@ -195,12 +200,13 @@ struct Coord2D } } - Real toAngle( void ); ///< turn 2D vector into angle (where angle 0 is down the +x axis) + Real toAngle( void ) const; ///< turn 2D vector into angle (where angle 0 is down the +x axis) }; -inline Real Coord2D::toAngle( void ) +inline Real Coord2D::toAngle( void ) const { +#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ Coord2D vector; vector.x = x; @@ -242,7 +248,20 @@ inline Real Coord2D::toAngle( void ) // S is sign of angle - MSB return value; +#else + const Real len = length(); + if (len == 0.0f) + return 0.0f; + Real c = x/len; + // bound it in case of numerical error + if (c < -1.0f) + c = -1.0f; + else if (c > 1.0f) + c = 1.0f; + + return y < 0.0f ? -ACos(c) : ACos(c); +#endif } struct ICoord2D diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h index 383c2471418..7d3da6b9f2b 100644 --- a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h +++ b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h @@ -151,8 +151,13 @@ __forceinline float fast_float_ceil(float f) #define INT_TO_REAL(x) ((Real)(x)) // once we've ceiled/floored, trunc and round are identical, and currently, round is faster... (srj) +#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ +#define REAL_TO_INT_CEIL(x) (fast_float2long_round(ceilf(x))) +#define REAL_TO_INT_FLOOR(x) (fast_float2long_round(floorf(x))) +#else #define REAL_TO_INT_CEIL(x) (fast_float2long_round(fast_float_ceil(x))) #define REAL_TO_INT_FLOOR(x) (fast_float2long_round(fast_float_floor(x))) +#endif #define FAST_REAL_TRUNC(x) fast_float_trunc(x) #define FAST_REAL_CEIL(x) fast_float_ceil(x) @@ -201,6 +206,49 @@ struct Coord2D inline Real Coord2D::toAngle( void ) const { +#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ + Coord2D vector; + + vector.x = x; + vector.y = y; + + Real dist = (Real)sqrt(vector.x * vector.x + vector.y * vector.y); + + // normalize + if (dist == 0.0f) + return 0.0f; + + Coord2D dir; + dir.x = 1.0f; + dir.y = 0.0f; + + Real distInv = 1.0f / dist; + vector.x *= distInv; + vector.y *= distInv; + + // dot of two unit vectors is cos of angle + Real c = dir.x*vector.x + dir.y*vector.y; + + // bound it in case of numerical error + if (c < -1.0) + c = -1.0; + else if (c > 1.0) + c = 1.0; + + Real value = (Real)ACos( (Real)c ); + + // Determine sign by checking Z component of dir cross vector + // Note this is assumes 2D, and is identical to dotting the perpendicular of v with dir + Real perpZ = dir.x * vector.y - dir.y * vector.x; + if (perpZ < 0.0f) + value = -value; + + // note: to make this 3D, 'dir' and 'vector' can be normalized and dotted just as they are + // to test sign, compute N = dir X vector, then P = N x dir, then S = P . vector, where sign of + // S is sign of angle - MSB + + return value; +#else const Real len = length(); if (len == 0.0f) return 0.0f; @@ -213,6 +261,7 @@ inline Real Coord2D::toAngle( void ) const c = 1.0f; return y < 0.0f ? -ACos(c) : ACos(c); +#endif } struct ICoord2D From f7c898fe50b33beb42045d0b1718cb992ebb6345 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 16:43:27 +0100 Subject: [PATCH 109/211] unify(subsystem): Merge SubsystemInterface code (#2180) --- .../Include/Common/SubsystemInterface.h | 6 ++++- .../Common/System/SubsystemInterface.cpp | 23 +++++++++++++------ .../Include/Common/SubsystemInterface.h | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h index 42296385138..c30e6f663c2 100644 --- a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -35,7 +35,7 @@ class Xfer; //------------------------------------------------------------------------------------------------- -/** This is the abstract base class from which all game engine subsytems should derive from. +/** This is the abstract base class from which all game engine subsystems should derive from. * In order to provide consistent behaviors across all these systems, any implementation * must obey the rules defined in here * @@ -114,6 +114,8 @@ class SubsystemInterface void DRAW(void); Real getUpdateTime(void) {return m_curUpdateTime;} Real getDrawTime(void) {return m_curDrawTime;} + Bool doDumpUpdate(void) {return m_dumpUpdate;} + Bool doDumpDraw(void) {return m_dumpDraw;} static Real getTotalTime(void) {return s_msConsumed;} static void clearTotalTime(void) {s_msConsumed = 0;} protected: @@ -123,6 +125,8 @@ class SubsystemInterface Real m_startDrawTimeConsumed; Real m_curDrawTime; + Bool m_dumpUpdate; + Bool m_dumpDraw; #else void UPDATE(void) {update();} void DRAW(void) {draw();} diff --git a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp b/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp index 02c6572acaf..d7aad22f1cf 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp @@ -43,7 +43,9 @@ SubsystemInterface::SubsystemInterface() :m_curDrawTime(0), m_startDrawTimeConsumed(0), m_startTimeConsumed(0), -m_curUpdateTime(0) +m_curUpdateTime(0), +m_dumpUpdate(false), +m_dumpDraw(false) #endif { if (TheSubsystemList) { @@ -60,6 +62,7 @@ SubsystemInterface::~SubsystemInterface() } #ifdef DUMP_PERF_STATS +static const Real MIN_TIME_THRESHOLD = 0.0002f; // .2 msec. [8/13/2003] void SubsystemInterface::UPDATE(void) { __int64 startTime64; @@ -72,8 +75,11 @@ void SubsystemInterface::UPDATE(void) m_curUpdateTime = ((double)(endTime64-startTime64))/((double)(freq64)); Real subTime = s_msConsumed - m_startTimeConsumed; if (m_name.isEmpty()) return; - if (m_curUpdateTime > 0.00001) { - //DEBUG_LOG(("Subsys %s total time %.2f, subTime %.2f, net time %.2f", + if (m_curUpdateTime>MIN_TIME_THRESHOLD) { + m_dumpUpdate = true; + } + if (m_curUpdateTime > MIN_TIME_THRESHOLD/10.0f) { + //DLOG(Debug::Format("Subsys %s total time %.2f, subTime %.2f, net time %.2f\n", // m_name.str(), m_curUpdateTime*1000, subTime*1000, (m_curUpdateTime-subTime)*1000 )); m_curUpdateTime -= subTime; @@ -95,8 +101,11 @@ void SubsystemInterface::DRAW(void) m_curDrawTime = ((double)(endTime64-startTime64))/((double)(freq64)); Real subTime = s_msConsumed - m_startDrawTimeConsumed; if (m_name.isEmpty()) return; - if (m_curDrawTime > 0.00001) { - //DEBUG_LOG(("Subsys %s total time %.2f, subTime %.2f, net time %.2f", + if (m_curDrawTime>MIN_TIME_THRESHOLD) { + m_dumpDraw = true; + } + if (m_curDrawTime > MIN_TIME_THRESHOLD/10.0f) { + //DLOG(Debug::Format("Subsys %s total time %.2f, subTime %.2f, net time %.2f\n", // m_name.str(), m_curUpdateTime*1000, subTime*1000, (m_curUpdateTime-subTime)*1000 )); m_curDrawTime -= subTime; @@ -203,7 +212,7 @@ AsciiString SubsystemInterfaceList::dumpTimesForAll() { SubsystemInterface* sys = *it; total += sys->getUpdateTime(); - if (sys->getUpdateTime()>0.00001f) { + if (sys->doDumpUpdate()) { AsciiString curLine; curLine.format(" Time %02.2f MS update() %s \n", sys->getUpdateTime()*1000.0f, sys->getName().str()); buffer.concat(curLine); @@ -211,7 +220,7 @@ AsciiString SubsystemInterfaceList::dumpTimesForAll() misc += sys->getUpdateTime(); } total += sys->getDrawTime(); - if (sys->getDrawTime()>0.00001f) { + if (sys->doDumpDraw()) { AsciiString curLine; curLine.format(" Time %02.2f MS draw () %s \n", sys->getDrawTime()*1000.0f, sys->getName().str()); buffer.concat(curLine); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index f3cb210055d..f7a9802d67f 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -154,7 +154,7 @@ class SubsystemInterfaceList void resetAll(); void shutdownAll(); #ifdef DUMP_PERF_STATS - AsciiString dumpTimesForAll(); + AsciiString dumpTimesForAll(); #endif private: From d5e1088e637c9ae67db1b6453c7033313dfb25f3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 23 Jan 2026 23:24:12 +0100 Subject: [PATCH 110/211] unify(ini): Merge INI and related code (#2180) --- Generals/Code/GameEngine/CMakeLists.txt | 2 + Generals/Code/GameEngine/Include/Common/INI.h | 5 +- .../Include/GameClient/ChallengeGenerals.h | 155 +++++++++++++++++ .../Include/GameLogic/ScriptEngine.h | 5 + .../Code/GameEngine/Source/Common/INI/INI.cpp | 33 +++- .../Source/Common/INI/INIMultiplayer.cpp | 3 + .../GameClient/GUI/ChallengeGenerals.cpp | 160 ++++++++++++++++++ .../GameLogic/ScriptEngine/ScriptEngine.cpp | 20 +++ .../Include/GameClient/ChallengeGenerals.h | 3 +- 9 files changed, 375 insertions(+), 11 deletions(-) create mode 100644 Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h create mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index a6d33955a42..316ce75f99a 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -132,6 +132,7 @@ set(GAMEENGINE_SRC # Include/Common/XferSave.h Include/GameClient/Anim2D.h Include/GameClient/AnimateWindowManager.h + Include/GameClient/ChallengeGenerals.h Include/GameClient/CampaignManager.h Include/GameClient/CDCheck.h Include/GameClient/ClientInstance.h @@ -657,6 +658,7 @@ set(GAMEENGINE_SRC Source/GameClient/GlobalLanguage.cpp Source/GameClient/GraphDraw.cpp Source/GameClient/GUI/AnimateWindowManager.cpp + Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h index 59b2e596605..f08d157f7dc 100644 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ b/Generals/Code/GameEngine/Include/Common/INI.h @@ -160,6 +160,8 @@ typedef void (*BuildMultiIniFieldProc)(MultiIniFieldParse& p); //------------------------------------------------------------------------------------------------- class INI { + INI(const INI&); + INI& operator=(const INI&); public: @@ -217,6 +219,7 @@ class INI static void parseObjectCreationListDefinition( INI* ini ); static void parseMultiplayerSettingsDefinition( INI* ini ); static void parseMultiplayerColorDefinition( INI* ini ); + static void parseMultiplayerStartingMoneyChoiceDefinition( INI* ini ); static void parseOnlineChatColorDefinition( INI* ini ); static void parseMapCacheDefinition( INI* ini ); static void parseVideoDefinition( INI* ini ); @@ -243,7 +246,7 @@ class INI static void parseEvaEvent( INI* ini ); static void parseCredits( INI* ini ); static void parseWindowTransitions( INI* ini ); - + static void parseChallengeModeDefinition( INI* ini ); AsciiString getFilename( void ) const { return m_filename; } INILoadType getLoadType( void ) const { return m_loadType; } diff --git a/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h b/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h new file mode 100644 index 00000000000..09d9ba2ebb7 --- /dev/null +++ b/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h @@ -0,0 +1,155 @@ +/* +** Command & Conquer Generals(tm) +** Copyright 2025 Electronic Arts 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +//////////////////////////////////////////////////////////////////////////////// +// // +// (c) 2001-2003 Electronic Arts Inc. // +// // +//////////////////////////////////////////////////////////////////////////////// + +// FILE: ChallengeGenerals.h ////////////////////////////////////////////////////////////////////// +// Author: Steve Copeland, 6/24/2003 +// Desc: This is a manager for data pertaining to the Generals' Challenge personas and related GUI. +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +// INCLUDES ////////////////////////////////////////////////////////////////////////////////// +#include "Common/GameType.h" +#include "Common/INI.h" +#include "Common/Overridable.h" + +// DEFINES //////////////////////////////////////////////////////////////////////////////////////// +//static const Int NUM_GENERALS = 12; // ChallengeMenu.wnd dependent +#define NUM_GENERALS (12) + +// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// +class Image; + +// CLASS DEFINITIONS ////////////////////////////////////////////////////////////////////////////// +class GeneralPersona +{ + friend class ChallengeGenerals; + +private: + Bool m_bStartsEnabled; + AsciiString m_strBioName; + AsciiString m_strBioDOB; + AsciiString m_strBioBirthplace; + AsciiString m_strBioStrategy; + AsciiString m_strBioRank; + AsciiString m_strBioBranch; + AsciiString m_strBioClassNumber; + Image *m_imageBioPortraitSmall; + Image *m_imageBioPortraitLarge; + AsciiString m_strCampaign; + AsciiString m_strPlayerTemplateName; + AsciiString m_strPortraitMovieLeftName; + AsciiString m_strPortraitMovieRightName; + Image *m_imageDefeated; + Image *m_imageVictorious; + AsciiString m_strDefeated; + AsciiString m_strVictorious; + AsciiString m_strSelectionSound; + AsciiString m_strTauntSound1; + AsciiString m_strTauntSound2; + AsciiString m_strTauntSound3; + AsciiString m_strWinSound; + AsciiString m_strLossSound; + AsciiString m_strPreviewSound; + AsciiString m_strNameSound ; + + +public: + GeneralPersona( void ) : + m_imageBioPortraitSmall(nullptr), + m_imageBioPortraitLarge(nullptr) + { + } +// ~GeneralPersona( void ); + + Bool isStartingEnabled() const { return m_bStartsEnabled; } + const AsciiString& getBioName() const { return m_strBioName; } + const AsciiString& getBioDOB() const { return m_strBioDOB; } + const AsciiString& getBioBirthplace() const { return m_strBioBirthplace; } + const AsciiString& getBioStrategy() const { return m_strBioStrategy; } + const AsciiString& getBioRank() const { return m_strBioRank; } + const AsciiString& getBioClassNumber() const { return m_strBioClassNumber; } + const AsciiString& getBioBranch() const { return m_strBioBranch; } + const Image *getBioPortraitSmall() const { return m_imageBioPortraitSmall; } + const Image *getBioPortraitLarge() const { return m_imageBioPortraitLarge; } + const AsciiString& getPortraitMovieLeftName() const { return m_strPortraitMovieLeftName; } + const AsciiString& getPortraitMovieRightName() const { return m_strPortraitMovieRightName; } + const AsciiString& getCampaign() const { return m_strCampaign; } + const AsciiString& getPlayerTemplateName() const { return m_strPlayerTemplateName; } // template name, as parsed in from ini + const Image *getImageDefeated() const { return m_imageDefeated; } + const Image *getImageVictorious() const { return m_imageVictorious; } + const AsciiString& getStringDefeated() const { return m_strDefeated; } + const AsciiString& getStringVictorious() const { return m_strVictorious; } + const AsciiString& getSelectionSound() const { return m_strSelectionSound; } + const AsciiString& getRandomTauntSound() const { + switch (rand()%3) // don't care about distribution or exactly how random this is + { + case 0: return m_strTauntSound1; + case 1: return m_strTauntSound2; + } + return m_strTauntSound3; + } + const AsciiString& getWinSound() const { return m_strWinSound; } + const AsciiString& getLossSound() const { return m_strLossSound; } + const AsciiString& getPreviewSound() const { return m_strPreviewSound; } + const AsciiString& getNameSound() const { return m_strNameSound; } +}; + + +class ChallengeGenerals +{ + +private: + /*const*/ GeneralPersona m_position[ NUM_GENERALS ]; + Int m_PlayerTemplateNum; // the template number as ThePlayerTemplateStore has it + GameDifficulty m_currentDifficulty; // the last selected game difficulty for the challenge generals + + static void parseGeneralPersona( INI* ini, void *instance, void *store, const void *userData ); + +public: + ChallengeGenerals( void ); + ~ChallengeGenerals( void ); + + void init( void ); + const GeneralPersona* getChallengeGenerals() const { return m_position; } + const FieldParse* getFieldParse( void ) const { return s_fieldParseTable; } // for INI file parsing + const GeneralPersona* getPlayerGeneralByCampaignName( AsciiString name ) const; + const GeneralPersona* getGeneralByGeneralName( AsciiString name ) const; + const GeneralPersona* getGeneralByTemplateName( AsciiString name ) const; + + void setCurrentPlayerTemplateNum( Int playerTemplateNum) { m_PlayerTemplateNum = playerTemplateNum; } + Int getCurrentPlayerTemplateNum( void ) { return m_PlayerTemplateNum; } + + void setCurrentDifficulty( GameDifficulty diff ) { m_currentDifficulty = diff; } + GameDifficulty getCurrentDifficulty( void ) { return m_currentDifficulty; } +protected: + static const FieldParse s_fieldParseTable[]; + +}; + + + +// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// +extern ChallengeGenerals *TheChallengeGenerals; +extern ChallengeGenerals *createChallengeGenerals( void ); diff --git a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h index b5f4785667a..12d3fbd3f67 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptEngine.h @@ -352,6 +352,11 @@ class ScriptEngine : public SubsystemInterface, //#if defined(RTS_DEBUG) void debugVictory( void ); //#endif + + + static void parseScriptAction( INI* ini ); + static void parseScriptCondition( INI* ini ); + protected: // snapshot methods diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp index 0034379e44b..1d941426b5f 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp @@ -56,6 +56,7 @@ #include "GameLogic/ExperienceTracker.h" #include "GameLogic/FPUControl.h" #include "GameLogic/ObjectCreationList.h" +#include "GameLogic/ScriptEngine.h" #include "GameLogic/Weapon.h" @@ -84,6 +85,7 @@ static const BlockParse theTypeTable[] = { "AudioSettings", INI::parseAudioSettingsDefinition }, { "Bridge", INI::parseTerrainBridgeDefinition }, { "Campaign", INI::parseCampaignDefinition }, + { "ChallengeGenerals", INI::parseChallengeModeDefinition }, { "CommandButton", INI::parseCommandButtonDefinition }, { "CommandMap", INI::parseMetaMapDefinition }, { "CommandSet", INI::parseCommandSetDefinition }, @@ -108,6 +110,7 @@ static const BlockParse theTypeTable[] = { "Mouse", INI::parseMouseDefinition }, { "MouseCursor", INI::parseMouseCursorDefinition }, { "MultiplayerColor", INI::parseMultiplayerColorDefinition }, + { "MultiplayerStartingMoneyChoice", INI::parseMultiplayerStartingMoneyChoiceDefinition }, { "OnlineChatColors", INI::parseOnlineChatColorDefinition }, { "MultiplayerSettings",INI::parseMultiplayerSettingsDefinition }, { "MusicTrack", INI::parseMusicTrackDefinition }, @@ -135,6 +138,8 @@ static const BlockParse theTypeTable[] = { "LODPreset", INI::parseLODPreset }, { "BenchProfile", INI::parseBenchProfile }, { "ReallyLowMHz", parseReallyLowMHz }, + { "ScriptAction", ScriptEngine::parseScriptAction }, + { "ScriptCondition", ScriptEngine::parseScriptCondition }, { nullptr, nullptr }, }; @@ -819,20 +824,27 @@ AsciiString INI::getNextAsciiString() else { static char buff[INI_MAX_CHARS_PER_LINE]; - + buff[0] = 0; if (strlen(token) > 1) { strlcpy(buff, &token[1], ARRAY_SIZE(buff)); } - token = getNextToken(getSepsQuote()); - - if (strlen(token) > 1 && token[1] != '\t') - { - strlcat(buff, " ", ARRAY_SIZE(buff)); + token = getNextTokenOrNull(getSepsQuote()); + if (token) { + if (strlen(token) > 1 && token[1] != '\t') + { + strlcat(buff, " ", ARRAY_SIZE(buff)); + } + strlcat(buff, token, ARRAY_SIZE(buff)); + result.set(buff); + } else { + Int len = strlen(buff); + if (len && buff[len-1] == '"') { // strip off trailing quote jba. [2/12/2003] + buff[len-1] = 0; + } + result.set(buff); } - strlcat(buff, token, ARRAY_SIZE(buff)); - result.set(buff); } } return result; @@ -1395,7 +1407,10 @@ void INI::parseSpecialPowerTemplate( INI* ini, void * /*instance*/, void *store, } const SpecialPowerTemplate *sPowerT = TheSpecialPowerStore->findSpecialPowerTemplate( AsciiString( token ) ); - DEBUG_ASSERTCRASH( sPowerT || stricmp( token, "None" ) == 0, ("Specialpower %s not found!",token) ); + if( !sPowerT && stricmp( token, "None" ) != 0 ) + { + DEBUG_CRASH( ("[LINE: %d in '%s'] Specialpower %s not found!", ini->getLineNum(), ini->getFilename().str(), token) ); + } typedef const SpecialPowerTemplate* ConstSpecialPowerTemplatePtr; ConstSpecialPowerTemplatePtr* theSpecialPowerTemplate = (ConstSpecialPowerTemplatePtr *)store; diff --git a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index 66d50d48f06..e2145deaeec 100644 --- a/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/Generals/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -78,3 +78,6 @@ void INI::parseMultiplayerColorDefinition( INI* ini ) multiplayerColorDefinition->setNightColor(multiplayerColorDefinition->getRGBNightValue()); } +void INI::parseMultiplayerStartingMoneyChoiceDefinition( INI* ini ) +{ +} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp new file mode 100644 index 00000000000..eb5adf62d1b --- /dev/null +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp @@ -0,0 +1,160 @@ +/* +** Command & Conquer Generals Zero Hour(tm) +** Copyright 2025 Electronic Arts 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + +//////////////////////////////////////////////////////////////////////////////// +// // +// (c) 2001-2003 Electronic Arts Inc. // +// // +//////////////////////////////////////////////////////////////////////////////// + +// FILE: ChallengeGenerals.h ////////////////////////////////////////////////////////////////////// +// Author: Steve Copeland, 6/24/2003 +// Desc: This is a manager for data pertaining to the Generals' Challenge personas and related GUI. +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine + +#include "GameClient/ChallengeGenerals.h" + + +ChallengeGenerals *TheChallengeGenerals = nullptr; + +ChallengeGenerals *createChallengeGenerals( void ) +{ + return MSGNEW("ChallengeGenerals") ChallengeGenerals; +} + + +ChallengeGenerals::ChallengeGenerals() +{ + //ctor +} + + +ChallengeGenerals::~ChallengeGenerals() +{ + //dtor +} + + +void ChallengeGenerals::init( void ) +{ + INI ini; + ini.loadFileDirectory( "Data\\INI\\ChallengeMode", INI_LOAD_OVERWRITE, nullptr ); +} + + +void ChallengeGenerals::parseGeneralPersona(INI *ini, void *instance, void *store, const void *userData) +{ + static const FieldParse dataFieldParse[] = + { + { "StartsEnabled", INI::parseBool, nullptr, offsetof( GeneralPersona, m_bStartsEnabled ) }, + { "BioNameString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioName ) }, + { "BioDOBString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioDOB ) }, + { "BioBirthplaceString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBirthplace ) }, + { "BioStrategyString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioStrategy ) }, + { "BioRankString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioRank ) }, + { "BioBranchString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBranch ) }, + { "BioClassNumberString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioClassNumber ) }, + { "BioPortraitSmall", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitSmall ) }, + { "BioPortraitLarge", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitLarge ) }, + { "Campaign", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strCampaign ) }, + { "PlayerTemplate", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPlayerTemplateName ) }, + { "PortraitMovieLeftName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieLeftName ) }, + { "PortraitMovieRightName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieRightName ) }, + { "DefeatedImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageDefeated ) }, + { "VictoriousImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageVictorious ) }, + { "DefeatedString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strDefeated ) }, + { "VictoriousString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strVictorious ) }, + { "SelectionSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strSelectionSound ) }, + { "TauntSound1", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound1 ) }, + { "TauntSound2", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound2 ) }, + { "TauntSound3", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound3 ) }, + { "WinSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strWinSound ) }, + { "LossSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strLossSound ) }, + { "PreviewSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPreviewSound ) }, + { "NameSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strNameSound ) }, + + { nullptr, nullptr, nullptr, 0 } + }; + ini->initFromINI(store, dataFieldParse); +} + + +const FieldParse ChallengeGenerals::s_fieldParseTable[] = +{ + { "GeneralPersona0", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[0] ) }, + { "GeneralPersona1", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[1] ) }, + { "GeneralPersona2", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[2] ) }, + { "GeneralPersona3", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[3] ) }, + { "GeneralPersona4", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[4] ) }, + { "GeneralPersona5", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[5] ) }, + { "GeneralPersona6", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[6] ) }, + { "GeneralPersona7", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[7] ) }, + { "GeneralPersona8", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[8] ) }, + { "GeneralPersona9", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[9] ) }, + { "GeneralPersona10", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[10] ) }, + { "GeneralPersona11", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[11] ) }, + { nullptr, nullptr, nullptr, 0 } +}; + + +//------------------------------------------------------------------------------------------------- +/** Parse Gen Challenge entries */ +//------------------------------------------------------------------------------------------------- +void INI::parseChallengeModeDefinition( INI* ini ) +{ + if( TheChallengeGenerals ) + { + ini->initFromINI( TheChallengeGenerals, TheChallengeGenerals->getFieldParse() ); + } +} + +const GeneralPersona* ChallengeGenerals::getPlayerGeneralByCampaignName( AsciiString name ) const +{ + for (Int i = 0; i < NUM_GENERALS; i++) + { + AsciiString campaignName = m_position[i].getCampaign(); + if (campaignName.compareNoCase( name.str() ) == 0) + return &m_position[i]; + } + DEBUG_CRASH(("Can't find General by Campaign Name")); + return nullptr; +} + +const GeneralPersona* ChallengeGenerals::getGeneralByGeneralName( AsciiString name ) const +{ + for (Int i = 0; i < NUM_GENERALS; i++) + { + AsciiString generalName = m_position[i].getBioName(); + if (generalName.compareNoCase( name.str() ) == 0) + return &m_position[i]; + } + return nullptr; +} + +const GeneralPersona* ChallengeGenerals::getGeneralByTemplateName( AsciiString name ) const +{ + for (Int i = 0; i < NUM_GENERALS; i++) + { + AsciiString templateName = m_position[i].getPlayerTemplateName(); + if (templateName.compareNoCase( name.str() ) == 0) + return &m_position[i]; + } + return nullptr; +} diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 4dd90299907..c1ec34fb967 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -348,6 +348,26 @@ void AttackPriorityInfo::loadPostProcess( void ) // ScriptEngine class +//------------------------------------------------------------------------------------------------- +/** Parse script action entry. The InternalName has to match the action's internal name, and then it +overrides the ui name and help text. If no entry is present in the ini file, the default code +initialized value in ScriptEngine::init() is used. jba*/ +//------------------------------------------------------------------------------------------------- +void ScriptEngine::parseScriptAction( INI* ini ) +{ +} + + +//------------------------------------------------------------------------------------------------- +/** Parse script condition entry. The InternalName has to match the condition's internal name, and then it +overrides the ui name and help text. If no entry is present in the ini file, the default code +initialized value in ScriptEngine::init() is used. jba*/ +//------------------------------------------------------------------------------------------------- +void ScriptEngine::parseScriptCondition( INI* ini ) +{ +} + + //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- ScriptEngine::ScriptEngine(): diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h index 73be82f6868..351d57d6ae1 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h @@ -31,6 +31,7 @@ // INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "Common/GameType.h" +#include "Common/INI.h" #include "Common/Overridable.h" // DEFINES //////////////////////////////////////////////////////////////////////////////////////// @@ -38,7 +39,7 @@ #define NUM_GENERALS (12) // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// - +class Image; // CLASS DEFINITIONS ////////////////////////////////////////////////////////////////////////////// class GeneralPersona From 2fb478ac663f810bc508a0de606a387e3d423047 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 23 Jan 2026 23:44:57 +0100 Subject: [PATCH 111/211] unify(common): Merge GameCommon and related code (#2180) --- .../GameEngine/Include/Common/GameCommon.h | 19 ++++++++++++++++++- .../GameEngine/Include/Common/GlobalData.h | 2 ++ .../Code/GameEngine/Include/GameLogic/AI.h | 6 ++++-- .../GameEngine/Source/Common/GlobalData.cpp | 2 ++ .../W3DDevice/GameClient/W3DDisplay.cpp | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h index 7163c0753c5..34e26d9b065 100644 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ b/Generals/Code/GameEngine/Include/Common/GameCommon.h @@ -47,6 +47,10 @@ #pragma once +#define DONT_ALLOW_DEBUG_CHEATS_IN_RELEASE ///< Take of the DONT to get cheats back in to release + +//#define _CAMPEA_DEMO + // ---------------------------------------------------------------------------------------------- #include "Lib/BaseType.h" #include "WWCommon.h" @@ -54,7 +58,7 @@ // ---------------------------------------------------------------------------------------------- #if defined(RTS_DEBUG) - #define NO_DUMP_PERF_STATS + #define DUMP_PERF_STATS #else #define NO_DUMP_PERF_STATS #endif @@ -119,6 +123,18 @@ enum #error "this is the wrong size" #endif +// ---------------------------------------------------------------------------------------------- +enum +{ + MAX_GLOBAL_GENERAL_TYPES = 9, ///< number of playable General Types, not including the boss) + + /// The start of the playable global generals playertemplates + GLOBAL_GENERAL_BEGIN = 5, + + /// The end of the playable global generals + GLOBAL_GENERAL_END = (GLOBAL_GENERAL_BEGIN + MAX_GLOBAL_GENERAL_TYPES - 1) +}; + //------------------------------------------------------------------------------------------------- enum GameDifficulty CPP_11(: Int) { @@ -207,6 +223,7 @@ enum CommandSourceType CPP_11(: Int) CMD_FROM_SCRIPT, CMD_FROM_AI, CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. + CMD_DEFAULT_SWITCH_WEAPON, // Special case: A weapon that can be chosen -- this is the default case (machine gun vs flashbang). COMMAND_SOURCE_TYPE_COUNT }; diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 83dae4e9ecf..2ee139bef3a 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -280,6 +280,8 @@ class GlobalData : public SubsystemInterface #ifdef DUMP_PERF_STATS Bool m_dumpPerformanceStatistics; + Bool m_dumpStatsAtInterval;///< should I automatically dum stats every in N frames + Int m_statsInterval; ///< if so, how many is N? #endif Bool m_forceBenchmark; ///getNumExtraBlendTiles(), TheTerrainRenderObject->getNumShoreLineTiles() ); + fprintf( m_fp, " 3-Way Blends: %d/%d, \n Shoreline Blends: %d/%d\n", TheTerrainRenderObject->getNumExtraBlendTiles(TRUE),TheTerrainRenderObject->getNumExtraBlendTiles(FALSE), TheTerrainRenderObject->getNumShoreLineTiles(TRUE),TheTerrainRenderObject->getNumShoreLineTiles(FALSE)); fprintf( m_fp, "\n" ); From e7af1192f2f769b9dadc3769c6fccd00b56ae6dd Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:28:56 +0100 Subject: [PATCH 112/211] unify(userpreferences): Merge UserPreferences and related code (#2182) --- .../GameEngine/Include/Common/GlobalData.h | 3 ++ .../Include/Common/PlayerTemplate.h | 2 ++ .../Include/Common/UserPreferences.h | 3 ++ .../GameEngine/Source/Common/GlobalData.cpp | 13 ++++--- .../Source/Common/RTS/PlayerTemplate.cpp | 2 ++ .../Source/Common/UserPreferences.cpp | 24 ++++++++++--- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 35 +++++++++++++++++++ .../Source/Common/UserPreferences.cpp | 3 +- 8 files changed, 76 insertions(+), 9 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 2ee139bef3a..d9d861d7e95 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -110,6 +110,7 @@ class GlobalData : public SubsystemInterface Bool m_useTrees; Bool m_useTreeSway; Bool m_useDrawModuleLOD; + Bool m_useHeatEffects; Bool m_useFpsLimit; Bool m_dumpAssetUsage; Int m_framesPerSecondLimit; @@ -138,6 +139,8 @@ class GlobalData : public SubsystemInterface Bool m_enableStaticLOD; Int m_terrainLODTargetTimeMS; Bool m_useAlternateMouse; + Bool m_clientRetaliationModeEnabled; + Bool m_doubleClickAttackMove; Bool m_rightMouseAlwaysScrolls; Bool m_useWaterPlane; Bool m_useCloudPlane; diff --git a/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h b/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h index 1caf4221674..f5c4964fecd 100644 --- a/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h @@ -125,6 +125,7 @@ class PlayerTemplate AsciiString getLoadScreenMusic( void ) const {return m_loadScreenMusic; } + Bool isOldFaction( void ) const { return m_oldFaction; } static const FieldParse* getFieldParse(); @@ -162,6 +163,7 @@ class PlayerTemplate AsciiString m_tooltip; ///< The tooltip describing this player template Bool m_observer; Bool m_playableSide; + Bool m_oldFaction; ///< Faction existed in the original Generals Int m_intrinsicSPP; diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h index aef49361d36..80d21d2c932 100644 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ b/Generals/Code/GameEngine/Include/Common/UserPreferences.h @@ -91,6 +91,8 @@ class OptionPreferences : public UserPreferences void setOnlineIPAddress(UnsignedInt IP); // convenience function Bool getArchiveReplaysEnabled() const; // convenience function Bool getAlternateMouseModeEnabled(void); // convenience function + Bool getRetaliationModeEnabled(); // convenience function + Bool getDoubleClickAttackMoveEnabled(void); // convenience function Real getScrollFactor(void); // convenience function Bool getDrawScrollAnchor(void); Bool getMoveScrollAnchor(void); @@ -130,6 +132,7 @@ class OptionPreferences : public UserPreferences Bool getSmoothWaterEnabled(void); Bool getTreesEnabled(void); Bool getExtraAnimationsDisabled(void); + Bool getUseHeatEffects(void); Bool getDynamicLODEnabled(void); Bool getFPSLimitEnabled(void); Bool getNoDynamicLODEnabled(void); diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index a6f4cc49b04..446d64d797d 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -311,7 +311,7 @@ GlobalData* GlobalData::m_theOriginal = nullptr; { "MaxTranslucentObjects", INI::parseInt, nullptr, offsetof( GlobalData, m_maxVisibleTranslucentObjects) }, { "OccludedColorLuminanceScale", INI::parseReal, nullptr, offsetof( GlobalData, m_occludedLuminanceScale) }, -/* These are internal use only, they do not need file definitons +/* These are internal use only, they do not need file definitions { "TerrainAmbientRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainAmbient ) }, { "TerrainDiffuseRGB", INI::parseRGBColor, nullptr, offsetof( GlobalData, m_terrainDiffuse ) }, { "TerrainLightPos", INI::parseCoord3D, nullptr, offsetof( GlobalData, m_terrainLightPos ) }, @@ -331,7 +331,7 @@ GlobalData* GlobalData::m_theOriginal = nullptr; { "VideoOn", INI::parseBool, nullptr, offsetof( GlobalData, m_videoOn ) }, { "DisableCameraMovements", INI::parseBool, nullptr, offsetof( GlobalData, m_disableCameraMovement ) }, -/* These are internal use only, they do not need file definitons +/* These are internal use only, they do not need file definitions /// @todo remove this hack { "InGame", INI::parseBool, nullptr, offsetof( GlobalData, m_inGame ) }, */ @@ -365,7 +365,7 @@ GlobalData* GlobalData::m_theOriginal = nullptr; { "AutoAflameParticleSystem", INI::parseAsciiString, nullptr, offsetof( GlobalData, m_autoAflameParticleSystem ) }, { "AutoAflameParticleMax", INI::parseInt, nullptr, offsetof( GlobalData, m_autoAflameParticleMax ) }, -/* These are internal use only, they do not need file definitons +/* These are internal use only, they do not need file definitions { "LatencyAverage", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAverage ) }, { "LatencyAmplitude", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyAmplitude ) }, { "LatencyPeriod", INI::parseInt, nullptr, offsetof( GlobalData, m_latencyPeriod ) }, @@ -621,6 +621,7 @@ GlobalData::GlobalData() m_useTrees = 0; m_useTreeSway = TRUE; m_useDrawModuleLOD = FALSE; + m_useHeatEffects = TRUE; m_useFpsLimit = FALSE; m_dumpAssetUsage = FALSE; m_framesPerSecondLimit = 0; @@ -1027,6 +1028,8 @@ GlobalData::GlobalData() m_keyboardCameraRotateSpeed = 0.1f; + m_clientRetaliationModeEnabled = TRUE; //On by default. + } //------------------------------------------------------------------------------------------------- @@ -1182,7 +1185,9 @@ void GlobalData::parseGameDataDefinition( INI* ini ) // override INI values with user preferences OptionPreferences optionPref; - TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled(); + TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled(); + TheWritableGlobalData->m_clientRetaliationModeEnabled = optionPref.getRetaliationModeEnabled(); + TheWritableGlobalData->m_doubleClickAttackMove = optionPref.getDoubleClickAttackMoveEnabled(); TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor(); TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor(); TheWritableGlobalData->m_moveScrollAnchor = optionPref.getMoveScrollAnchor(); diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index 3bc7b22e2bc..13c3bd37f49 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -94,6 +94,7 @@ { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, { "SpecialPowerShortcutButtonCount",INI::parseInt, nullptr, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, { "IsObserver", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_observer ) }, + { "OldFaction", INI::parseBool, nullptr, offsetof( PlayerTemplate, m_oldFaction ) }, { "IntrinsicSciencePurchasePoints", INI::parseInt, nullptr, offsetof( PlayerTemplate, m_intrinsicSPP ) }, { "ScoreScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_scoreScreenImage ) }, { "LoadScreenImage", INI::parseAsciiString, nullptr, offsetof( PlayerTemplate, m_loadScreenImage ) }, @@ -183,6 +184,7 @@ PlayerTemplate::PlayerTemplate() : m_nameKey(NAMEKEY_INVALID), m_observer(false), m_playableSide(false), + m_oldFaction(false), m_intrinsicSPP(0), m_specialPowerShortcutButtonCount(0) { diff --git a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp index eacd11a0a58..3fc13990fc2 100644 --- a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -48,6 +48,7 @@ #include "Common/QuotedPrintable.h" #include "Common/MultiplayerSettings.h" #include "GameClient/MapUtil.h" +#include "GameClient/ChallengeGenerals.h" #include "GameNetwork/GameSpy/PeerDefs.h" @@ -529,6 +530,18 @@ Int CustomMatchPreferences::getPreferredFaction(void) ret = PLAYERTEMPLATE_RANDOM; else if (fac->getStartingBuilding().isEmpty()) ret = PLAYERTEMPLATE_RANDOM; + else if (TheGameInfo && TheGameInfo->oldFactionsOnly() && !fac->isOldFaction()) + ret = PLAYERTEMPLATE_RANDOM; + else { + // Prevent from loading the disabled Generals, in case you had previously selected one as your preferred faction. + // This is also enforced at GUI setup (GUIUtil.cpp and GameLogic.cpp). + // @todo: unlock these when something rad happens + Bool disallowLockedGenerals = TRUE; + const GeneralPersona *general = TheChallengeGenerals->getGeneralByTemplateName(fac->getName()); + Bool startsLocked = general ? !general->isStartingEnabled() : FALSE; + if (disallowLockedGenerals && startsLocked) + ret = PLAYERTEMPLATE_RANDOM; + } } return ret; @@ -650,19 +663,22 @@ AsciiString CustomMatchPreferences::getPreferredMap(void) AsciiString ret; CustomMatchPreferences::const_iterator it = find("Map"); if (it == end()) - { - ret = getDefaultMap(TRUE); + { //map not found, use default instead + ret = getDefaultOfficialMap(); return ret; } ret = QuotedPrintableToAsciiString(it->second); ret.trim(); if (ret.isEmpty() || !isValidMap(ret, TRUE)) - { - ret = getDefaultMap(TRUE); + { //map is invalid, use default instead + ret = getDefaultOfficialMap(); return ret; } + //can only use official maps if recording stats + if( getUseStats() && !isOfficialMap(ret) ) + ret = getDefaultOfficialMap(); return ret; } diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 41a280cef98..7dabb1cef72 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -330,6 +330,29 @@ Bool OptionPreferences::getAlternateMouseModeEnabled(void) return FALSE; } +Bool OptionPreferences::getRetaliationModeEnabled(void) +{ + OptionPreferences::const_iterator it = find("Retaliation"); + if (it == end()) + return TheGlobalData->m_clientRetaliationModeEnabled; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + +Bool OptionPreferences::getDoubleClickAttackMoveEnabled(void) +{ + OptionPreferences::const_iterator it = find("UseDoubleClickAttackMove"); + if( it == end() ) + return TheGlobalData->m_doubleClickAttackMove; + + if( stricmp( it->second.str(), "yes" ) == 0 ) + return TRUE; + + return FALSE; +} Real OptionPreferences::getScrollFactor(void) { @@ -729,6 +752,18 @@ Bool OptionPreferences::getExtraAnimationsDisabled(void) return TRUE; } +Bool OptionPreferences::getUseHeatEffects(void) +{ + OptionPreferences::const_iterator it = find("HeatEffects"); + if (it == end()) + return TheGlobalData->m_useHeatEffects; + + if (stricmp(it->second.str(), "yes") == 0) { + return TRUE; + } + return FALSE; +} + Bool OptionPreferences::getDynamicLODEnabled(void) { OptionPreferences::const_iterator it = find("DynamicLOD"); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp index 1a77fdeee45..f4680919d8e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -663,7 +663,7 @@ AsciiString CustomMatchPreferences::getPreferredMap(void) AsciiString ret; CustomMatchPreferences::const_iterator it = find("Map"); if (it == end()) - { //found find map, use default instead + { //map not found, use default instead ret = getDefaultOfficialMap(); return ret; } @@ -814,6 +814,7 @@ Int GameSpyMiscPreferences::getMaxMessagesPerUpdate( void ) { return getInt("MaxMessagesPerUpdate", 100); } + //----------------------------------------------------------------------------- // IgnorePreferences base class //----------------------------------------------------------------------------- From 3966fa83a3e2318d093bd8928f86745ba4c61de3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:31:11 +0100 Subject: [PATCH 113/211] unify(userpreferences): Move UserPreferences files to Core (#2182) --- Core/GameEngine/CMakeLists.txt | 4 +- .../Include/Common/UserPreferences.h | 0 .../Source/Common/UserPreferences.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 4 +- .../Include/Common/UserPreferences.h | 178 ---- .../Source/Common/UserPreferences.cpp | 958 ------------------ GeneralsMD/Code/GameEngine/CMakeLists.txt | 4 +- scripts/cpp/unify_move_files.py | 3 + 8 files changed, 9 insertions(+), 1142 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/UserPreferences.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/UserPreferences.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/Common/UserPreferences.h delete mode 100644 Generals/Code/GameEngine/Source/Common/UserPreferences.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 4e27570cf6d..13fa1158a01 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -132,7 +132,7 @@ set(GAMEENGINE_SRC # Include/Common/UnitTimings.h # Include/Common/Upgrade.h #Include/Common/urllaunch.h # unused -# Include/Common/UserPreferences.h + Include/Common/UserPreferences.h # Include/Common/version.h # Include/Common/WellKnownKeys.h Include/Common/WorkerProcess.h @@ -688,7 +688,7 @@ set(GAMEENGINE_SRC # Source/Common/Thing/Thing.cpp # Source/Common/Thing/ThingFactory.cpp # Source/Common/Thing/ThingTemplate.cpp -# Source/Common/UserPreferences.cpp + Source/Common/UserPreferences.cpp # Source/Common/version.cpp Source/Common/WorkerProcess.cpp # Source/GameClient/ClientInstance.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/Core/GameEngine/Include/Common/UserPreferences.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h rename to Core/GameEngine/Include/Common/UserPreferences.h diff --git a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp b/Core/GameEngine/Source/Common/UserPreferences.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp rename to Core/GameEngine/Source/Common/UserPreferences.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 316ce75f99a..f4ef0c45917 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -121,7 +121,7 @@ set(GAMEENGINE_SRC # Include/Common/UnicodeString.h Include/Common/UnitTimings.h Include/Common/Upgrade.h - Include/Common/UserPreferences.h +# Include/Common/UserPreferences.h Include/Common/version.h Include/Common/WellKnownKeys.h # Include/Common/WorkerProcess.h @@ -636,7 +636,7 @@ set(GAMEENGINE_SRC Source/Common/Thing/Thing.cpp Source/Common/Thing/ThingFactory.cpp Source/Common/Thing/ThingTemplate.cpp - Source/Common/UserPreferences.cpp +# Source/Common/UserPreferences.cpp Source/Common/version.cpp # Source/Common/WorkerProcess.cpp Source/GameClient/ClientInstance.cpp diff --git a/Generals/Code/GameEngine/Include/Common/UserPreferences.h b/Generals/Code/GameEngine/Include/Common/UserPreferences.h deleted file mode 100644 index 80d21d2c932..00000000000 --- a/Generals/Code/GameEngine/Include/Common/UserPreferences.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: UserPreferences.h -// Author: Matthew D. Campbell, April 2002 -// Description: Saving/Loading of user preferences -/////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/STLTypedefs.h" - -class Money; -typedef UnsignedInt CursorCaptureMode; -typedef UnsignedInt ScreenEdgeScrollMode; - -//----------------------------------------------------------------------------- -// PUBLIC TYPES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -typedef std::map PreferenceMap; - -//----------------------------------------------------------------------------- -// UserPreferences base class -//----------------------------------------------------------------------------- -class UserPreferences : public PreferenceMap -{ -public: - UserPreferences(); - virtual ~UserPreferences(); - - // Loads or creates a file with the given name in the user data directory. - virtual Bool load(AsciiString fname); - virtual Bool write(void); - - Bool getBool(AsciiString key, Bool defaultValue) const; - Real getReal(AsciiString key, Real defaultValue) const; - Int getInt(AsciiString key, Int defaultValue) const; - AsciiString getAsciiString(AsciiString key, AsciiString defaultValue) const; - - void setBool(AsciiString key, Bool val); - void setReal(AsciiString key, Real val); - void setInt(AsciiString key, Int val); - void setAsciiString(AsciiString key, AsciiString val); - -protected: - AsciiString m_filename; -}; - -//----------------------------------------------------------------------------- -// OptionsPreferences options menu class -//----------------------------------------------------------------------------- -class OptionPreferences : public UserPreferences -{ -public: - OptionPreferences( ); - virtual ~OptionPreferences(); - - Bool loadFromIniFile(); - - UnsignedInt getLANIPAddress(void); // convenience function - UnsignedInt getOnlineIPAddress(void); // convenience function - void setLANIPAddress(AsciiString IP); // convenience function - void setOnlineIPAddress(AsciiString IP); // convenience function - void setLANIPAddress(UnsignedInt IP); // convenience function - void setOnlineIPAddress(UnsignedInt IP); // convenience function - Bool getArchiveReplaysEnabled() const; // convenience function - Bool getAlternateMouseModeEnabled(void); // convenience function - Bool getRetaliationModeEnabled(); // convenience function - Bool getDoubleClickAttackMoveEnabled(void); // convenience function - Real getScrollFactor(void); // convenience function - Bool getDrawScrollAnchor(void); - Bool getMoveScrollAnchor(void); - Bool getCursorCaptureEnabledInWindowedGame() const; - Bool getCursorCaptureEnabledInWindowedMenu() const; - Bool getCursorCaptureEnabledInFullscreenGame() const; - Bool getCursorCaptureEnabledInFullscreenMenu() const; - CursorCaptureMode getCursorCaptureMode() const; - Bool getScreenEdgeScrollEnabledInWindowedApp() const; - Bool getScreenEdgeScrollEnabledInFullscreenApp() const; - ScreenEdgeScrollMode getScreenEdgeScrollMode() const; - Bool getSendDelay(void); // convenience function - Int getFirewallBehavior(void); // convenience function - Short getFirewallPortAllocationDelta(void); // convenience function - UnsignedShort getFirewallPortOverride(void); // convenience function - Bool getFirewallNeedToRefresh(void); // convenience function - Bool usesSystemMapDir(void); // convenience function - AsciiString getPreferred3DProvider(void); // convenience function - AsciiString getSpeakerType(void); // convenience function - Real getSoundVolume(void); // convenience function - Real get3DSoundVolume(void); // convenience function - Real getSpeechVolume(void); // convenience function - Real getMusicVolume(void); // convenience function - Real getMoneyTransactionVolume(void) const; - Bool saveCameraInReplays(void); - Bool useCameraInReplays(void); - Bool getPlayerObserverEnabled() const; - Int getStaticGameDetail(void); // detail level selected by the user. - Int getIdealStaticGameDetail(void); // detail level detected for user. - Real getGammaValue(void); - Int getTextureReduction(void); - void getResolution(Int *xres, Int *yres); - Bool get3DShadowsEnabled(void); - Bool get2DShadowsEnabled(void); - Bool getCloudShadowsEnabled(void); - Bool getLightmapEnabled(void); - Bool getSmoothWaterEnabled(void); - Bool getTreesEnabled(void); - Bool getExtraAnimationsDisabled(void); - Bool getUseHeatEffects(void); - Bool getDynamicLODEnabled(void); - Bool getFPSLimitEnabled(void); - Bool getNoDynamicLODEnabled(void); - Bool getBuildingOcclusionEnabled(void); - Int getParticleCap(void); - - Int getCampaignDifficulty(void); - void setCampaignDifficulty( Int diff ); - - Int getNetworkLatencyFontSize(void); - Int getRenderFpsFontSize(void); - Int getSystemTimeFontSize(void); - Int getGameTimeFontSize(void); - - Real getResolutionFontAdjustment(void); - - Bool getShowMoneyPerMinute(void) const; -}; - -//----------------------------------------------------------------------------- -// LANPreferences class -//----------------------------------------------------------------------------- -class LANPreferences : public UserPreferences -{ -public: - LANPreferences(); - virtual ~LANPreferences(); - - Bool loadFromIniFile(); - - UnicodeString getUserName(void); // convenience function - Int getPreferredFaction(void); // convenience function - Int getPreferredColor(void); // convenience function - AsciiString getPreferredMap(void); // convenience function - Bool usesSystemMapDir(void); // convenience function - Int getNumRemoteIPs(void); // convenience function - UnicodeString getRemoteIPEntry(Int i); // convenience function - - Bool getSuperweaponRestricted(void) const; - Money getStartingCash(void) const; - void setSuperweaponRestricted( Bool superweaponRestricted); - void setStartingCash( const Money & startingCash ); -}; diff --git a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp b/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp deleted file mode 100644 index 3fc13990fc2..00000000000 --- a/Generals/Code/GameEngine/Source/Common/UserPreferences.cpp +++ /dev/null @@ -1,958 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: UserPreferences.cpp -// Author: Matthew D. Campbell, April 2002 -// Description: Saving/Loading of user preferences -/////////////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/GameSpyMiscPreferences.h" -#include "Common/UserPreferences.h" -#include "Common/LadderPreferences.h" -#include "Common/Player.h" -#include "Common/PlayerTemplate.h" -#include "Common/Registry.h" -#include "Common/QuickmatchPreferences.h" -#include "Common/CustomMatchPreferences.h" -#include "Common/IgnorePreferences.h" -#include "Common/QuotedPrintable.h" -#include "Common/MultiplayerSettings.h" -#include "GameClient/MapUtil.h" -#include "GameClient/ChallengeGenerals.h" -#include "GameNetwork/GameSpy/PeerDefs.h" - - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PRIVATE TYPES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PRIVATE DATA /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC DATA //////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static AsciiString intAsStr(Int val) -{ - AsciiString ret; - ret.format("%d", val); - return ret; -} - -static AsciiString boolAsStr(Bool val) -{ - AsciiString ret; - ret.format("%d", val); - return ret; -} - -static AsciiString realAsStr(Real val) -{ - AsciiString ret; - ret.format("%g", val); - return ret; -} - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- -// UserPreferences Class -//----------------------------------------------------------------------------- - -UserPreferences::UserPreferences( void ) -{ -} - -UserPreferences::~UserPreferences( void ) -{ -} - -#define LINE_LEN 2048 -Bool UserPreferences::load(AsciiString fname) -{ -// if (strstr(fname.str(), "\\")) -// throw INI_INVALID_DATA; // must be a leaf name - - m_filename = TheGlobalData->getPath_UserData(); - m_filename.concat(fname); - - FILE *fp = fopen(m_filename.str(), "r"); - if (fp) - { - char buf[LINE_LEN]; - while( fgets( buf, LINE_LEN, fp ) != nullptr ) - { - AsciiString line = buf; - line.trim(); - - AsciiString key, val; - line.nextToken(&key, "="); - val = line.str() + 1; - - key.trim(); - val.trim(); - - if (key.isEmpty() || val.isEmpty()) - continue; - - (*this)[key] = val; - } - fclose(fp); - return true; - } - return false; -} - -Bool UserPreferences::write( void ) -{ - if (m_filename.isEmpty()) - return false; - - FILE *fp = fopen(m_filename.str(), "w"); - if (fp) - { - PreferenceMap::const_iterator it = begin(); - while (it != end()) - { - fprintf(fp, "%s = %s\n", it->first.str(), it->second.str()); - ++it; - } - fclose(fp); - return true; - } - return false; -} - -Bool UserPreferences::getBool(AsciiString key, Bool defaultValue) const -{ - AsciiString val = getAsciiString(key, AsciiString::TheEmptyString); - if (val.isEmpty()) - { - return defaultValue; - } - - val.toLower(); - return (val == "1" || val == "t" || val == "true" || val == "y" || val == "yes" || val == "ok"); -} - -Real UserPreferences::getReal(AsciiString key, Real defaultValue) const -{ - AsciiString val = getAsciiString(key, AsciiString::TheEmptyString); - if (val.isEmpty()) - { - return defaultValue; - } - - return (Real)atof(val.str()); -} - -Int UserPreferences::getInt(AsciiString key, Int defaultValue) const -{ - AsciiString val = getAsciiString(key, AsciiString::TheEmptyString); - if (val.isEmpty()) - { - return defaultValue; - } - - return atoi(val.str()); -} - -AsciiString UserPreferences::getAsciiString(AsciiString key, AsciiString defaultValue) const -{ - UserPreferences::const_iterator it = find(key); - if (it == end()) - { - return defaultValue; - } - - return it->second; -} - -void UserPreferences::setBool(AsciiString key, Bool val) -{ - (*this)[key] = boolAsStr(val); -} - -void UserPreferences::setReal(AsciiString key, Real val) -{ - (*this)[key] = realAsStr(val); -} - -void UserPreferences::setInt(AsciiString key, Int val) -{ - (*this)[key] = intAsStr(val); -} - -void UserPreferences::setAsciiString(AsciiString key, AsciiString val) -{ - (*this)[key] = val; -} - -//----------------------------------------------------------------------------- -// QuickMatchPreferences base class -//----------------------------------------------------------------------------- - -QuickMatchPreferences::QuickMatchPreferences() -{ - AsciiString userPrefFilename; - Int localProfile = TheGameSpyInfo->getLocalProfileID(); - userPrefFilename.format("GeneralsOnline\\QMPref%d.ini", localProfile); - load(userPrefFilename); -} - -QuickMatchPreferences::~QuickMatchPreferences() -{ -} - -void QuickMatchPreferences::setMapSelected(const AsciiString& mapName, Bool selected) -{ - (*this)[AsciiStringToQuotedPrintable(mapName)] = (selected)?"1":"0"; -} - -Bool QuickMatchPreferences::isMapSelected(const AsciiString& mapName) -{ - Int ret; - QuickMatchPreferences::const_iterator it = find(AsciiStringToQuotedPrintable(mapName)); - if (it == end()) - { - return TRUE; - } - - ret = atoi(it->second.str()); - - return (ret != 0); -} - -void QuickMatchPreferences::setLastLadder(const AsciiString& addr, UnsignedShort port) -{ - AsciiString strVal; - strVal.format("%d", port); - (*this)["LastLadderAddr"] = addr; - (*this)["LastLadderPort"] = strVal; -} - -AsciiString QuickMatchPreferences::getLastLadderAddr( void ) -{ - QuickMatchPreferences::const_iterator it = find("LastLadderAddr"); - if (it == end()) - { - return AsciiString::TheEmptyString; - } - return it->second; -} - -UnsignedShort QuickMatchPreferences::getLastLadderPort( void ) -{ - QuickMatchPreferences::const_iterator it = find("LastLadderPort"); - if (it == end()) - { - return 0; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setMaxDisconnects(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["MaxDisconnects"] = strVal; -} - -Int QuickMatchPreferences::getMaxDisconnects( void ) -{ - QuickMatchPreferences::const_iterator it = find("MaxDisconnects"); - if (it == end()) - { - return 0; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setMaxPoints(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["MaxPoints"] = strVal; -} - -Int QuickMatchPreferences::getMaxPoints( void ) -{ - QuickMatchPreferences::const_iterator it = find("MaxPoints"); - if (it == end()) - { - return 1000; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setMinPoints(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["MinPoints"] = strVal; -} - -Int QuickMatchPreferences::getMinPoints( void ) -{ - QuickMatchPreferences::const_iterator it = find("MinPoints"); - if (it == end()) - { - return 0; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setWaitTime(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["WaitTime"] = strVal; -} - -Int QuickMatchPreferences::getWaitTime( void ) -{ - QuickMatchPreferences::const_iterator it = find("WaitTime"); - if (it == end()) - { - return 0; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setNumPlayers(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["NumPlayers"] = strVal; -} - -Int QuickMatchPreferences::getNumPlayers( void ) -{ - QuickMatchPreferences::const_iterator it = find("NumPlayers"); - if (it == end()) - { - return 0; // first in list, 1v1 - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setMaxPing(Int val) -{ - AsciiString strVal; - strVal.format("%d", val); - (*this)["MaxPing"] = strVal; -} - -Int QuickMatchPreferences::getMaxPing( void ) -{ - QuickMatchPreferences::const_iterator it = find("MaxPing"); - if (it == end()) - { - return 5; - } - return atoi(it->second.str()); -} - -void QuickMatchPreferences::setColor( Int val ) -{ - setInt("Color", val); -} - -Int QuickMatchPreferences::getColor( void ) -{ - return getInt("Color", 0); -} - -void QuickMatchPreferences::setSide( Int val ) -{ - setInt("Side", val); -} - -Int QuickMatchPreferences::getSide( void ) -{ - return getInt("Side", 0); -} - -//----------------------------------------------------------------------------- -// CustomMatchPreferences base class -//----------------------------------------------------------------------------- - -CustomMatchPreferences::CustomMatchPreferences() -{ - AsciiString userPrefFilename; - Int localProfile = TheGameSpyInfo->getLocalProfileID(); - userPrefFilename.format("GeneralsOnline\\CustomPref%d.ini", localProfile); - load(userPrefFilename); -} - -CustomMatchPreferences::~CustomMatchPreferences() -{ -} - -void CustomMatchPreferences::setLastLadder(const AsciiString& addr, UnsignedShort port) -{ - AsciiString strVal; - strVal.format("%d", port); - (*this)["LastLadderAddr"] = addr; - (*this)["LastLadderPort"] = strVal; -} - -AsciiString CustomMatchPreferences::getLastLadderAddr( void ) -{ - QuickMatchPreferences::const_iterator it = find("LastLadderAddr"); - if (it == end()) - { - return AsciiString::TheEmptyString; - } - return it->second; -} - -UnsignedShort CustomMatchPreferences::getLastLadderPort( void ) -{ - QuickMatchPreferences::const_iterator it = find("LastLadderPort"); - if (it == end()) - { - return 0; - } - return atoi(it->second.str()); -} - -Int CustomMatchPreferences::getPreferredColor(void) -{ - Int ret; - CustomMatchPreferences::const_iterator it = find("Color"); - if (it == end()) - { - return -1; - } - - ret = atoi(it->second.str()); - if (ret < -1 || ret >= TheMultiplayerSettings->getNumColors()) - ret = -1; - - return ret; -} - -void CustomMatchPreferences::setPreferredColor(Int val) -{ - AsciiString s; - s.format("%d", val); - (*this)["Color"] = s; -} - -Int CustomMatchPreferences::getChatSizeSlider(void) -{ - Int ret; - CustomMatchPreferences::const_iterator it = find("ChatSlider"); - if (it == end()) - { - return 45; - } - - ret = atoi(it->second.str()); - if (ret < 0 || ret > 100) - ret = 45; - - return ret; -} - -void CustomMatchPreferences::setChatSizeSlider(Int val) -{ - AsciiString s; - s.format("%d", val); - (*this)["ChatSlider"] = s; -} - -Int CustomMatchPreferences::getPreferredFaction(void) -{ - Int ret; - CustomMatchPreferences::const_iterator it = find("PlayerTemplate"); - if (it == end()) - { - return PLAYERTEMPLATE_RANDOM; - } - - ret = atoi(it->second.str()); - if (ret == PLAYERTEMPLATE_OBSERVER || ret < PLAYERTEMPLATE_MIN || ret >= ThePlayerTemplateStore->getPlayerTemplateCount()) - ret = PLAYERTEMPLATE_RANDOM; - - if (ret >= 0) - { - const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(ret); - if (!fac) - ret = PLAYERTEMPLATE_RANDOM; - else if (fac->getStartingBuilding().isEmpty()) - ret = PLAYERTEMPLATE_RANDOM; - else if (TheGameInfo && TheGameInfo->oldFactionsOnly() && !fac->isOldFaction()) - ret = PLAYERTEMPLATE_RANDOM; - else { - // Prevent from loading the disabled Generals, in case you had previously selected one as your preferred faction. - // This is also enforced at GUI setup (GUIUtil.cpp and GameLogic.cpp). - // @todo: unlock these when something rad happens - Bool disallowLockedGenerals = TRUE; - const GeneralPersona *general = TheChallengeGenerals->getGeneralByTemplateName(fac->getName()); - Bool startsLocked = general ? !general->isStartingEnabled() : FALSE; - if (disallowLockedGenerals && startsLocked) - ret = PLAYERTEMPLATE_RANDOM; - } - } - - return ret; -} - -void CustomMatchPreferences::setPreferredFaction(Int val) -{ - AsciiString s; - s.format("%d", val); - (*this)["PlayerTemplate"] = s; -} - -Bool CustomMatchPreferences::usesSystemMapDir(void) -{ - CustomMatchPreferences::const_iterator it = find("UseSystemMapDir"); - if (it == end()) - return TRUE; - - if (stricmp(it->second.str(), "1") == 0) { - return TRUE; - } - return FALSE; -} - -void CustomMatchPreferences::setUsesSystemMapDir(Bool val) -{ - AsciiString s; - s.format("%d", val); - (*this)["UseSystemMapDir"] = s; -} - -Bool CustomMatchPreferences::usesLongGameList(void) -{ - return TRUE; - CustomMatchPreferences::const_iterator it = find("UseLongGameList"); - if (it == end()) - return FALSE; - - if (stricmp(it->second.str(), "1") == 0) { - return TRUE; - } - return FALSE; -} - -void CustomMatchPreferences::setUsesLongGameList(Bool val) -{ - AsciiString s; - s.format("%d", val); - (*this)["UseLongGameList"] = s; -} - -Bool CustomMatchPreferences::allowsObservers(void) -{ - CustomMatchPreferences::const_iterator it = find("AllowObservers"); - if (it == end()) - return TRUE; - - if (stricmp(it->second.str(), "1") == 0) { - return TRUE; - } - return FALSE; -} - -void CustomMatchPreferences::setAllowsObserver(Bool val) -{ - AsciiString s; - s.format("%d", val); - (*this)["AllowObservers"] = s; -} - -Bool CustomMatchPreferences::getDisallowAsianText( void ) -{ - CustomMatchPreferences::const_iterator it = find("DisallowAsianText"); - if (it == end()) - { - // since English Win98 machines don't have a Unicode font installed by default, - // we're forced to disable asian chat by default for English builds. - if (GetRegistryLanguage().compareNoCase("chinese") == 0 || GetRegistryLanguage().compareNoCase("korean") == 0 ) - return FALSE; - else - return TRUE; - } - - if (stricmp(it->second.str(), "1") == 0) { - return TRUE; - } - return FALSE; -} - -void CustomMatchPreferences::setDisallowAsianText(Bool val) -{ - AsciiString s; - s.format("%d", val); - (*this)["DisallowAsianText"] = s; - -} - -Bool CustomMatchPreferences::getDisallowNonAsianText( void ) -{ - CustomMatchPreferences::const_iterator it = find("DisallowNonAsianText"); - if (it == end()) - return FALSE; - - if (stricmp(it->second.str(), "1") == 0) { - return TRUE; - } - return FALSE; -} - -void CustomMatchPreferences::setDisallowNonAsianText( Bool val ) -{ - AsciiString s; - s.format("%d", val); - (*this)["DisallowNonAsianText"] = s; -} - -AsciiString CustomMatchPreferences::getPreferredMap(void) -{ - AsciiString ret; - CustomMatchPreferences::const_iterator it = find("Map"); - if (it == end()) - { //map not found, use default instead - ret = getDefaultOfficialMap(); - return ret; - } - - ret = QuotedPrintableToAsciiString(it->second); - ret.trim(); - if (ret.isEmpty() || !isValidMap(ret, TRUE)) - { //map is invalid, use default instead - ret = getDefaultOfficialMap(); - return ret; - } - - //can only use official maps if recording stats - if( getUseStats() && !isOfficialMap(ret) ) - ret = getDefaultOfficialMap(); - return ret; -} - -void CustomMatchPreferences::setPreferredMap(AsciiString val) -{ - (*this)["Map"] = AsciiStringToQuotedPrintable(val); -} - - -static const char superweaponRestrictionKey[] = "SuperweaponRestrict"; - -Bool CustomMatchPreferences::getSuperweaponRestricted(void) const -{ - const_iterator it = find(superweaponRestrictionKey); - if (it == end()) - { - return false; - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); -} - -void CustomMatchPreferences::setSuperweaponRestricted( Bool superweaponRestricted ) -{ - (*this)[superweaponRestrictionKey] = superweaponRestricted ? "Yes" : "No"; -} - -static const char startingCashKey[] = "StartingCash"; -Money CustomMatchPreferences::getStartingCash(void) const -{ - const_iterator it = find(startingCashKey); - if (it == end()) - { - return TheMultiplayerSettings->getDefaultStartingMoney(); - } - - Money money; - money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); - - return money; -} - -void CustomMatchPreferences::setStartingCash( const Money & startingCash ) -{ - AsciiString option; - - option.format( "%d", startingCash.countMoney() ); - - (*this)[startingCashKey] = option; -} - - -static const char limitFactionsKey[] = "LimitArmies"; - -// Prefers to only use the original 3 sides, not USA Air Force General, GLA Toxin General, et al -Bool CustomMatchPreferences::getFactionsLimited(void) const -{ - const_iterator it = find(limitFactionsKey); - if (it == end()) - { - return false; // The default - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); -} - -void CustomMatchPreferences::setFactionsLimited( Bool factionsLimited ) -{ - (*this)[limitFactionsKey] = factionsLimited ? "Yes" : "No"; -} - - -static const char useStatsKey[] = "UseStats"; - -Bool CustomMatchPreferences::getUseStats(void) const -{ - const_iterator it = find(useStatsKey); - if (it == end()) - { - return true; // The default - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); -} - -void CustomMatchPreferences::setUseStats( Bool useStats ) -{ - (*this)[useStatsKey] = useStats ? "Yes" : "No"; -} - -//----------------------------------------------------------------------------- -// GameSpyMiscPreferences base class -//----------------------------------------------------------------------------- - -GameSpyMiscPreferences::GameSpyMiscPreferences() -{ - AsciiString userPrefFilename; - Int localProfile = TheGameSpyInfo->getLocalProfileID(); - userPrefFilename.format("GeneralsOnline\\GSMiscPref%d.ini", localProfile); - load(userPrefFilename); -} - -GameSpyMiscPreferences::~GameSpyMiscPreferences() -{ -} - -Int GameSpyMiscPreferences::getLocale( void ) -{ - return getInt("Locale", 0); -} - -void GameSpyMiscPreferences::setLocale( Int val ) -{ - setInt("Locale", val); -} - -AsciiString GameSpyMiscPreferences::getCachedStats( void ) -{ - return getAsciiString("CachedStats", AsciiString::TheEmptyString); -} - -void GameSpyMiscPreferences::setCachedStats( AsciiString val ) -{ - setAsciiString("CachedStats", val); -} - -Bool GameSpyMiscPreferences::getQuickMatchResLocked( void ) -{ - return getBool("QMResLock", FALSE); -} - -Int GameSpyMiscPreferences::getMaxMessagesPerUpdate( void ) -{ - return getInt("MaxMessagesPerUpdate", 100); -} - -//----------------------------------------------------------------------------- -// IgnorePreferences base class -//----------------------------------------------------------------------------- - -IgnorePreferences::IgnorePreferences() -{ - AsciiString userPrefFilename; -// if(!TheGameSpyInfo) - Int localProfile = TheGameSpyInfo->getLocalProfileID(); - userPrefFilename.format("GeneralsOnline\\IgnorePref%d.ini", localProfile); - load(userPrefFilename); -} - -IgnorePreferences::~IgnorePreferences() -{ -} - -void IgnorePreferences::setIgnore(const AsciiString& userName, Int profileID, Bool ignore) -{ - AsciiString strVal; - strVal.format("%d", profileID); - if (ignore) - { - (*this)[strVal] = userName; - } - else - { - erase(strVal); - } -} - -IgnorePrefMap IgnorePreferences::getIgnores(void) -{ - IgnorePrefMap ignores; - - IgnorePreferences::iterator it; - for (it = begin(); it != end(); ++it) - { - AsciiString profileStr = it->first; - AsciiString lastLoginStr = it->second; - Int profileID = atoi(profileStr.str()); - - ignores[profileID] = lastLoginStr; - } - - return ignores; -} - -//----------------------------------------------------------------------------- -// LadderPreferences base class -//----------------------------------------------------------------------------- - -LadderPreferences::LadderPreferences() -{ -} - -LadderPreferences::~LadderPreferences() -{ -} - -Bool LadderPreferences::loadProfile( Int profileID ) -{ - clear(); - m_ladders.clear(); - AsciiString userPrefFilename; - userPrefFilename.format("GeneralsOnline\\Ladders%d.ini", profileID); - Bool success = load(userPrefFilename); - if (!success) - return success; - - // parse out our ladders - for (LadderPreferences::iterator it = begin(); it != end(); ++it) - { - LadderPref p; - AsciiString ladName = it->first; - AsciiString ladData = it->second; - - DEBUG_LOG(("Looking at [%s] = [%s]", ladName.str(), ladData.str())); - - const char *ptr = ladName.reverseFind(':'); - DEBUG_ASSERTCRASH(ptr, ("Did not find ':' in ladder name - skipping")); - if (!ptr) - continue; - - p.port = atoi( ptr + 1 ); - ladName.truncateBy(strlen(ptr)); - p.address = QuotedPrintableToAsciiString(ladName); - - ptr = ladData.reverseFind(':'); - DEBUG_ASSERTCRASH(ptr, ("Did not find ':' in ladder data - skipping")); - if (!ptr) - continue; - - p.lastPlayDate = atoi( ptr + 1 ); - ladData.truncateBy(strlen(ptr)); - p.name = QuotedPrintableToUnicodeString(ladData); - - m_ladders[p.lastPlayDate] = p; - } - - return true; -} - -bool LadderPreferences::write( void ) -{ - clear(); - LadderPrefMap::iterator lpIt; - - static const Int MAX_LADDERS = 5; - Int count; - for (lpIt = m_ladders.begin(), count=0; lpIt != m_ladders.end() && countsecond; - AsciiString ladName; - AsciiString ladData; - ladName.format("%s:%d", AsciiStringToQuotedPrintable(p.address).str(), p.port); - ladData.format("%s:%d", UnicodeStringToQuotedPrintable(p.name).str(), p.lastPlayDate); - (*this)[ladName] = ladData; - } - - return UserPreferences::write(); -} - -const LadderPrefMap& LadderPreferences::getRecentLadders( void ) -{ - return m_ladders; -} - -void LadderPreferences::addRecentLadder( LadderPref ladder ) -{ - for (LadderPrefMap::iterator it = m_ladders.begin(); it != m_ladders.end(); ++it) - { - if (it->second == ladder) - { - m_ladders.erase(it); - break; - } - } - - m_ladders[ladder.lastPlayDate] = ladder; -} diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index b9be6228a4a..189ab821ffb 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -127,7 +127,7 @@ set(GAMEENGINE_SRC Include/Common/UnitTimings.h Include/Common/Upgrade.h # Include/Common/urllaunch.h - Include/Common/UserPreferences.h +# Include/Common/UserPreferences.h Include/Common/version.h Include/Common/WellKnownKeys.h # Include/Common/WorkerProcess.h @@ -677,7 +677,7 @@ set(GAMEENGINE_SRC Source/Common/Thing/Thing.cpp Source/Common/Thing/ThingFactory.cpp Source/Common/Thing/ThingTemplate.cpp - Source/Common/UserPreferences.cpp +# Source/Common/UserPreferences.cpp Source/Common/version.cpp # Source/Common/WorkerProcess.cpp Source/GameClient/ClientInstance.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index e2757328ad9..3430d4b450f 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -257,6 +257,9 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp", Game.CORE, "GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp") #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp", Game.CORE, "GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/UserPreferences.h", Game.CORE, "GameEngine/Include/Common/UserPreferences.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/UserPreferences.cpp", Game.CORE, "GameEngine/Source/Common/UserPreferences.cpp") + return From 2c26a90ad1b83033bdce238545131d32044c7ea2 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 25 Jan 2026 11:01:06 +0100 Subject: [PATCH 114/211] refactor(audioevent): Remove const casts for calling AudioEventRTS::setPlayingAudioIndex() (#2179) --- Core/GameEngine/Include/Common/AudioEventRTS.h | 8 ++++---- Core/GameEngine/Source/Common/Audio/GameAudio.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Core/GameEngine/Include/Common/AudioEventRTS.h b/Core/GameEngine/Include/Common/AudioEventRTS.h index c11364bc4a1..db321655fb6 100644 --- a/Core/GameEngine/Include/Common/AudioEventRTS.h +++ b/Core/GameEngine/Include/Common/AudioEventRTS.h @@ -99,7 +99,7 @@ class AudioEventRTS void decreaseLoopCount( void ); Bool hasMoreLoops( void ) const; - void setAudioEventInfo( const AudioEventInfo *eventInfo ) const; + void setAudioEventInfo( const AudioEventInfo *eventInfo ) const; // is mutable const AudioEventInfo *getAudioEventInfo( void ) const; void setPlayingHandle( AudioHandle handle ); // for ID of this audio piece. @@ -141,8 +141,8 @@ class AudioEventRTS Int getPlayerIndex( void ) const; void setPlayerIndex( Int playerNdx ); - Int getPlayingAudioIndex( void ) { return m_playingAudioIndex; }; - void setPlayingAudioIndex( Int pai ) { m_playingAudioIndex = pai; }; + Int getPlayingAudioIndex( void ) const { return m_playingAudioIndex; } + void setPlayingAudioIndex( Int pai ) const { m_playingAudioIndex = pai; } // is mutable Bool getUninterruptible( ) const { return m_uninterruptible; } void setUninterruptible( Bool uninterruptible ) { m_uninterruptible = uninterruptible; } @@ -191,7 +191,7 @@ class AudioEventRTS Real m_volumeShift; ///< Volume shift that should occur on this piece of audio Real m_delay; ///< Amount to delay before playing this sound Int m_loopCount; ///< The current loop count value. Only valid if this is a looping type event or the override has been set. - Int m_playingAudioIndex; ///< The sound index we are currently playing. In the case of non-random, we increment this to move to the next sound + mutable Int m_playingAudioIndex; ///< The sound index we are currently playing. In the case of non-random, we increment this to move to the next sound Int m_allCount; ///< If this sound is an ALL type, then this is how many sounds we have played so far. Int m_playerIndex; ///< The index of the player who owns this sound. Used for sounds that should have an owner, but don't have an object, etc. diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index a4df092b6d9..6f9e83de8f6 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -461,7 +461,7 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd) AudioEventRTS *audioEvent = MSGNEW("AudioEventRTS") AudioEventRTS(*eventToAdd); // poolify audioEvent->setPlayingHandle( allocateNewHandle() ); audioEvent->generateFilename(); // which file are we actually going to play? - ((AudioEventRTS*)eventToAdd)->setPlayingAudioIndex( audioEvent->getPlayingAudioIndex() ); + eventToAdd->setPlayingAudioIndex( audioEvent->getPlayingAudioIndex() ); audioEvent->generatePlayInfo(); // generate pitch shift and volume shift now as well std::list >::iterator it; diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index d554387cd3c..74521e94500 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -792,7 +792,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m // This seems really hacky, and MarkL admits that it is. However, we do this so that we // can "randomly" pick a different sound the next time, if we have 3 or more sounds. - jkmcd - ((AudioEventRTS*)soundToPlayPtr)->setPlayingAudioIndex( soundToPlay.getPlayingAudioIndex() ); + soundToPlayPtr->setPlayingAudioIndex( soundToPlay.getPlayingAudioIndex() ); if( objectWithSound->testStatus( OBJECT_STATUS_IS_CARBOMB ) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 7b48c8be309..1e2c2e53c40 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -850,7 +850,7 @@ void pickAndPlayUnitVoiceResponse( const DrawableList *list, GameMessage::Type m // This seems really hacky, and MarkL admits that it is. However, we do this so that we // can "randomly" pick a different sound the next time, if we have 3 or more sounds. - jkmcd - ((AudioEventRTS*)soundToPlayPtr)->setPlayingAudioIndex( soundToPlay.getPlayingAudioIndex() ); + soundToPlayPtr->setPlayingAudioIndex( soundToPlay.getPlayingAudioIndex() ); if( objectWithSound->testStatus( OBJECT_STATUS_IS_CARBOMB ) ) { From fa7b78e8e22442768196d00053c01b836ba9a4cc Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:00:09 +0100 Subject: [PATCH 115/211] unify(common): Merge TerrainTypes from Zero Hour (#2196) --- .../GameEngine/Include/Common/TerrainTypes.h | 42 +++++++++++++++++-- .../GameEngine/Include/Common/TerrainTypes.h | 4 -- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h index 3333c3c05fa..e29943bfeb2 100644 --- a/Generals/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/Generals/Code/GameEngine/Include/Common/TerrainTypes.h @@ -56,8 +56,6 @@ typedef enum TERRAIN_SNOW_3, // remove all the terrain types below when Todd says he's redone them all - TERRAIN_ASPHALT, - TERRAIN_CONCRETE, TERRAIN_DIRT, TERRAIN_GRASS, TERRAIN_TRANSITION, @@ -67,6 +65,25 @@ typedef enum TERRAIN_WOOD, TERRAIN_BLEND_EDGES, + // New terrain types (for Samm Ivri) + TERRAIN_LIVE_DESERT, + TERRAIN_DRY_DESERT, + TERRAIN_ACCENT_SAND, + TERRAIN_TROPICAL_BEACH, + TERRAIN_BEACH_PARK, + TERRAIN_RUGGED_MOUNTAIN, + TERRAIN_COBBLESTONE_GRASS, + TERRAIN_ACCENT_GRASS, + TERRAIN_RESIDENTIAL, + TERRAIN_RUGGED_SNOW, + TERRAIN_FLAT_SNOW, + TERRAIN_FIELD, + TERRAIN_ASPHALT, + TERRAIN_CONCRETE, + TERRAIN_CHINA, + TERRAIN_ACCENT_ROCK, + TERRAIN_URBAN, + TERRAIN_NUM_CLASSES } TerrainClass; @@ -88,8 +105,6 @@ static const char *const terrainTypeNames[] = "SNOW_3", // remove all the terrain types below when Todd says he's redone them all - "ASPHALT", - "CONCRETE", "DIRT", "GRASS", "TRANSITION", @@ -99,6 +114,25 @@ static const char *const terrainTypeNames[] = "WOOD", "BLEND_EDGE", + // New terrain types (for Samm Ivri) + "DESERT_LIVE", + "DESERT_DRY", + "SAND_ACCENT", + "BEACH_TROPICAL", + "BEACH_PARK", + "MOUNTAIN_RUGGED", + "GRASS_COBBLESTONE", + "GRASS_ACCENT", + "RESIDENTIAL", + "SNOW_RUGGED", + "SNOW_FLAT", + "FIELD", + "ASPHALT", + "CONCRETE", + "CHINA", + "ROCK_ACCENT", + "URBAN", + nullptr }; static_assert(ARRAY_SIZE(terrainTypeNames) == TERRAIN_NUM_CLASSES + 1, "Incorrect array size"); diff --git a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h index de3984df9ae..8450aecc320 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/TerrainTypes.h @@ -56,8 +56,6 @@ typedef enum TERRAIN_SNOW_3, // remove all the terrain types below when Todd says he's redone them all - //TERRAIN_ASPHALT, - //TERRAIN_CONCRETE, TERRAIN_DIRT, TERRAIN_GRASS, TERRAIN_TRANSITION, @@ -107,8 +105,6 @@ static const char *const terrainTypeNames[] = "SNOW_3", // remove all the terrain types below when Todd says he's redone them all - //"ASPHALT", - //"CONCRETE", "DIRT", "GRASS", "TRANSITION", From a5d9a267177215d9ddce19e1f85ab19534efb1e0 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:00:35 +0100 Subject: [PATCH 116/211] unify(common): Merge PerfTimer, StackDump code from Zero Hour (#2195) --- .../GameEngine/Include/Common/PerfTimer.h | 10 +- .../GameEngine/Include/Common/StackDump.h | 3 +- .../GameEngine/Source/Common/PerfTimer.cpp | 170 +++++++++++++----- .../Source/Common/System/StackDump.cpp | 1 + 4 files changed, 135 insertions(+), 49 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/PerfTimer.h b/Generals/Code/GameEngine/Include/Common/PerfTimer.h index 8f03af506d8..0b88b581394 100644 --- a/Generals/Code/GameEngine/Include/Common/PerfTimer.h +++ b/Generals/Code/GameEngine/Include/Common/PerfTimer.h @@ -85,7 +85,8 @@ __forceinline void GetPrecisionTimer(Int64* t) class PerfGather { public: - PerfGather( const char *identifier ); + // If net only (default), subtract perf timers running inside. [8/12/2003] + PerfGather( const char *identifier, Bool netOnly=true ); virtual ~PerfGather( ); __forceinline void startTimer(); @@ -126,6 +127,7 @@ class PerfGather PerfGather* m_next; PerfGather* m_prev; Bool m_ignore; + Bool m_netTimeOnly; }; //------------------------------------------------------------------------------------------------- @@ -161,7 +163,9 @@ void PerfGather::stopTimer() { // don't add the time it took for us to actually get the ticks (in startTimer) to our parent... (*m_activeHead)->m_runningTimeGross -= (s_stopStartOverhead); - (*m_activeHead)->m_runningTimeNet -= (runTime + s_stopStartOverhead); + if ((*m_activeHead)->m_netTimeOnly) { + (*m_activeHead)->m_runningTimeNet -= (runTime + s_stopStartOverhead); + } } } @@ -224,6 +228,7 @@ AutoPerfGatherIgnore::~AutoPerfGatherIgnore() } //------------------------------------------------------------------------------------------------- +#define DECLARE_TOTAL_PERF_TIMER(id) static PerfGather s_##id(#id, false); #define DECLARE_PERF_TIMER(id) static PerfGather s_##id(#id); #define USE_PERF_TIMER(id) AutoPerfGather a_##id(s_##id); #define IGNORE_PERF_TIMER(id) AutoPerfGatherIgnore a_##id(s_##id); @@ -308,6 +313,7 @@ extern void StatMetricsDisplay( DebugDisplayInterface *dd, void *, FILE *fp ); #else // PERF_TIMERS #define DECLARE_PERF_TIMER(id) + #define DECLARE_TOTAL_PERF_TIMER(id) #define USE_PERF_TIMER(id) #define IGNORE_PERF_TIMER(id) diff --git a/Generals/Code/GameEngine/Include/Common/StackDump.h b/Generals/Code/GameEngine/Include/Common/StackDump.h index 944c029471c..2d11b754b94 100644 --- a/Generals/Code/GameEngine/Include/Common/StackDump.h +++ b/Generals/Code/GameEngine/Include/Common/StackDump.h @@ -26,8 +26,7 @@ #ifndef IG_DEBUG_STACKTRACE #define IG_DEBUG_STACKTRACE 1 -#endif - +#endif // Unsure about this one -ML 3/25/03 #if defined(RTS_DEBUG) || defined(IG_DEBUG_STACKTRACE) // Writes a stackdump (provide a callback : gets called per line) diff --git a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp index 48a39364d19..d8d54a41d72 100644 --- a/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/Generals/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -35,6 +35,10 @@ #include "GameClient/Display.h" #include "GameClient/GraphDraw.h" +__forceinline void ProfileGetTime(__int64 &t) +{ + t = _rdtsc(); +} //------------------------------------------------------------------------------------------------- @@ -54,63 +58,139 @@ void GetPrecisionTimerTicksPerSec(Int64* t) *t = s_ticksPerSec; } +//Kris: Plugged in Martin's code to optimize timer setup. +#define HOFFESOMMER_REPLACEMENT_CODE + //------------------------------------------------------------------------------------------------- void InitPrecisionTimer() { -#ifdef USE_QPF - QueryPerformanceFrequency((LARGE_INTEGER*)&s_ticksPerSec); +#ifdef HOFFESOMMER_REPLACEMENT_CODE + + // measure clock cycles 3 times for 20 msec each + // then take the 2 counts that are closest, average + _int64 n[ 3 ]; + for( int k = 0; k < 3; k++ ) + { + // wait for end of current tick + unsigned timeEnd = timeGetTime() + 2; + while( timeGetTime() < timeEnd ); //do nothing + + // get cycles + _int64 start, startQPC, endQPC; + QueryPerformanceCounter( (LARGE_INTEGER *)&startQPC ); + ProfileGetTime( start ); + timeEnd += 20; + while( timeGetTime() < timeEnd ); //do nothing + ProfileGetTime( n[ k ] ); + n[ k ] -= start; + + // convert to 1 second + if( QueryPerformanceCounter( (LARGE_INTEGER*)&endQPC ) ) + { + QueryPerformanceFrequency( (LARGE_INTEGER*)&s_ticksPerSec ); + n[ k ] = ( n[ k ] * s_ticksPerSec ) / ( endQPC - startQPC ); + } + else + { + n[ k ] = ( n[ k ] * 1000 ) / 20; + } + } + + // find two closest values + _int64 d01 = n[ 1 ] - n[ 0 ]; + _int64 d02 = n[ 2 ] - n[ 0 ]; + _int64 d12 = n[ 2 ] - n[ 1 ]; + + if( d01 < 0 ) + { + d01 = -d01; + } + if( d02 < 0 ) + { + d02 = -d02; + } + if( d12 < 0 ) + { + d12 = -d12; + } + + _int64 avg; + if( d01 < d02 ) + { + avg = d01 < d12 ? n[ 0 ] + n[ 1 ] : n[ 1 ] + n[ 2 ]; + } + else + { + avg = d02 < d12 ? n[ 0 ] + n[ 2 ] : n[ 1 ] + n[ 2 ]; + } + + //s_ticksPerMSec = 1.0 * TotalTicks / totalTime; + s_ticksPerMSec = avg / 2000.0f; + s_ticksPerSec = s_ticksPerMSec * 1000.0f; + s_ticksPerUSec = s_ticksPerSec / 1000000.0f; + + #else - // Init the precision timers - Int64 totalTime = 0; - Int64 TotalTicks = 0; - static int TESTS = 5; - for (int i = 0; i < TESTS; ++i) - { - int TimeStart; - int TimeStop; - Int64 StartTicks; - Int64 EndTicks; - - TimeStart = timeGetTime(); - GetPrecisionTimer(&StartTicks); - for(;;) + //Kris: With total disrespect, this code costs 5 real seconds of init time + //whenever we fire up the game. + + #ifdef USE_QPF + QueryPerformanceFrequency((LARGE_INTEGER*)&s_ticksPerSec); + #else + // Init the precision timers + Int64 totalTime = 0; + Int64 TotalTicks = 0; + static int TESTS = 5; + + for (int i = 0; i < TESTS; ++i) { - TimeStop = timeGetTime(); - if ((TimeStop - TimeStart) > 1000) + int TimeStart; + int TimeStop; + Int64 StartTicks; + Int64 EndTicks; + + TimeStart = timeGetTime(); + GetPrecisionTimer(&StartTicks); + for(;;) { - GetPrecisionTimer(&EndTicks); - break; + TimeStop = timeGetTime(); + if ((TimeStop - TimeStart) > 1000) + { + GetPrecisionTimer(&EndTicks); + break; + } } - } - TotalTicks += (EndTicks - StartTicks); + TotalTicks += (EndTicks - StartTicks); - totalTime += (TimeStop - TimeStart); - } + totalTime += (TimeStop - TimeStart); + } - s_ticksPerMSec = 1.0 * TotalTicks / totalTime; - s_ticksPerSec = s_ticksPerMSec * 1000.0f; -#endif - s_ticksPerMSec = s_ticksPerSec / 1000.0f; - s_ticksPerUSec = s_ticksPerSec / 1000000.0f; + s_ticksPerMSec = 1.0 * TotalTicks / totalTime; + s_ticksPerSec = s_ticksPerMSec * 1000.0f; + #endif + s_ticksPerMSec = s_ticksPerSec / 1000.0f; + s_ticksPerUSec = s_ticksPerSec / 1000000.0f; + + #ifdef NOT_IN_USE + Int64 bogus[8]; + GetPrecisionTimer(&start); + for (Int ii = 0; ii < ITERS; ++ii) + { + GetPrecisionTimer(&bogus[0]); + GetPrecisionTimer(&bogus[1]); + GetPrecisionTimer(&bogus[2]); + GetPrecisionTimer(&bogus[3]); + GetPrecisionTimer(&bogus[4]); + GetPrecisionTimer(&bogus[5]); + GetPrecisionTimer(&bogus[6]); + GetPrecisionTimer(&bogus[7]); + } + TheTicksToGetTicks = (bogus[7] - start) / (ITERS*8); + DEBUG_LOG(("TheTicksToGetTicks is %d (%f usec)",(int)TheTicksToGetTicks,TheTicksToGetTicks/s_ticksPerUSec)); + #endif -#ifdef NOT_IN_USE - Int64 bogus[8]; - GetPrecisionTimer(&start); - for (Int ii = 0; ii < ITERS; ++ii) - { - GetPrecisionTimer(&bogus[0]); - GetPrecisionTimer(&bogus[1]); - GetPrecisionTimer(&bogus[2]); - GetPrecisionTimer(&bogus[3]); - GetPrecisionTimer(&bogus[4]); - GetPrecisionTimer(&bogus[5]); - GetPrecisionTimer(&bogus[6]); - GetPrecisionTimer(&bogus[7]); - } - TheTicksToGetTicks = (bogus[7] - start) / (ITERS*8); - DEBUG_LOG(("TheTicksToGetTicks is %d (%f usec)",(int)TheTicksToGetTicks,TheTicksToGetTicks/s_ticksPerUSec)); #endif } diff --git a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp index f3025de863e..60bc16d6ae1 100644 --- a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -474,6 +474,7 @@ void WriteStackLine(void*address, void (*callback)(const char*)) callback(line); } + //***************************************************************************** //***************************************************************************** void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) From 64786cc7413a89ff090cfc1ad260014622cce77e Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:30:50 +0100 Subject: [PATCH 117/211] unify(common): Merge CriticalSection, ScopedMutex code from Generals (#2194) --- GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h | 2 -- GeneralsMD/Code/GameEngine/Include/Common/ScopedMutex.h | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h index 9188ffb9ee1..1bf7178288d 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/CriticalSection.h @@ -92,8 +92,6 @@ class ScopedCriticalSection } }; -#include "mutex.h" - // These should be null on creation then non-null in WinMain or equivalent. // This allows us to be silently non-threadsafe for WB and other single-threaded apps. extern CriticalSection *TheAsciiStringCriticalSection; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ScopedMutex.h b/GeneralsMD/Code/GameEngine/Include/Common/ScopedMutex.h index c6c85bf9cd6..96de9910e5a 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ScopedMutex.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ScopedMutex.h @@ -31,10 +31,7 @@ class ScopedMutex public: ScopedMutex(HANDLE mutex) : m_mutex(mutex) { - DWORD status = WaitForSingleObject(m_mutex, 500); - if (status != WAIT_OBJECT_0) { - DEBUG_LOG(("ScopedMutex WaitForSingleObject timed out - status %d", status)); - } + WaitForSingleObject(m_mutex, INFINITE); } ~ScopedMutex() From f15abf3ee37f825cfca3673401c46343f9cea11a Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:31:23 +0100 Subject: [PATCH 118/211] unify(common): Merge Registry code (#2193) --- .../Code/GameEngine/Include/Common/Registry.h | 4 ++++ .../Source/Common/System/registry.cpp | 23 +++++++++++++++++++ .../Source/Common/System/registry.cpp | 8 +++++++ 3 files changed, 35 insertions(+) diff --git a/Generals/Code/GameEngine/Include/Common/Registry.h b/Generals/Code/GameEngine/Include/Common/Registry.h index a969c759e1c..ec20865c8c4 100644 --- a/Generals/Code/GameEngine/Include/Common/Registry.h +++ b/Generals/Code/GameEngine/Include/Common/Registry.h @@ -30,6 +30,10 @@ #include +/** + * Get a string from the original Generals Registry + */ +Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val); /** * Get a string from the registry */ diff --git a/Generals/Code/GameEngine/Source/Common/System/registry.cpp b/Generals/Code/GameEngine/Source/Common/System/registry.cpp index d43fd9830d4..8404c62de05 100644 --- a/Generals/Code/GameEngine/Source/Common/System/registry.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/registry.cpp @@ -115,9 +115,27 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns return (returnValue == ERROR_SUCCESS); } +Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiString& val) +{ + AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals"; + + fullPath.concat(path); + DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str())); + if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.str(), key.str(), val)) + { + return TRUE; + } + + return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.str(), key.str(), val); +} + Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val) { +#if RTS_GENERALS AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals"; +#elif RTS_ZEROHOUR + AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"; +#endif fullPath.concat(path); DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str())); @@ -131,7 +149,11 @@ Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val) Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt& val) { +#if RTS_GENERALS AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals"; +#elif RTS_ZEROHOUR + AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"; +#endif fullPath.concat(path); DEBUG_LOG(("GetUnsignedIntFromRegistry - looking in %s for key %s", fullPath.str(), key.str())); @@ -146,6 +168,7 @@ Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt& AsciiString GetRegistryLanguage(void) { static Bool cached = FALSE; + // NOTE: static causes a memory leak, but we have to keep it because the value is cached. static AsciiString val = "english"; if (cached) { return val; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp index afe2c92e82e..d882b6934d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/registry.cpp @@ -131,7 +131,11 @@ Bool GetStringFromGeneralsRegistry(AsciiString path, AsciiString key, AsciiStrin Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val) { +#if RTS_GENERALS + AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals"; +#elif RTS_ZEROHOUR AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"; +#endif fullPath.concat(path); DEBUG_LOG(("GetStringFromRegistry - looking in %s for key %s", fullPath.str(), key.str())); @@ -145,7 +149,11 @@ Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val) Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt& val) { +#if RTS_GENERALS + AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals"; +#elif RTS_ZEROHOUR AsciiString fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour"; +#endif fullPath.concat(path); DEBUG_LOG(("GetUnsignedIntFromRegistry - looking in %s for key %s", fullPath.str(), key.str())); From 077b657f72182b3887fc8fcf14f9c061591a31b5 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 25 Jan 2026 11:23:59 +0100 Subject: [PATCH 119/211] unify(lib): Move BaseType.h, trig.h to Core (#2185) --- Core/CMakeLists.txt | 2 + .../Libraries/Include/Lib/BaseType.h | 0 .../Libraries/Include/Lib/trig.h | 0 Generals/Code/CMakeLists.txt | 8 - .../Code/Libraries/Include/Lib/BaseType.h | 453 ------------------ Generals/Code/Libraries/Include/Lib/trig.h | 30 -- GeneralsMD/Code/CMakeLists.txt | 8 - scripts/cpp/unify_move_files.py | 3 + 8 files changed, 5 insertions(+), 499 deletions(-) rename {GeneralsMD/Code => Core}/Libraries/Include/Lib/BaseType.h (100%) rename {GeneralsMD/Code => Core}/Libraries/Include/Lib/trig.h (100%) delete mode 100644 Generals/Code/Libraries/Include/Lib/BaseType.h delete mode 100644 Generals/Code/Libraries/Include/Lib/trig.h diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index ccf2513e5e6..7c1269d1db9 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -14,7 +14,9 @@ target_include_directories(corei_libraries_source_wwvegas_wwlib INTERFACE "Libra target_include_directories(corei_main INTERFACE "Main") target_sources(corei_libraries_include PRIVATE + Libraries/Include/Lib/BaseType.h Libraries/Include/Lib/BaseTypeCore.h + Libraries/Include/Lib/trig.h Libraries/Include/rts/debug.h Libraries/Include/rts/profile.h ) diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/Core/Libraries/Include/Lib/BaseType.h similarity index 100% rename from GeneralsMD/Code/Libraries/Include/Lib/BaseType.h rename to Core/Libraries/Include/Lib/BaseType.h diff --git a/GeneralsMD/Code/Libraries/Include/Lib/trig.h b/Core/Libraries/Include/Lib/trig.h similarity index 100% rename from GeneralsMD/Code/Libraries/Include/Lib/trig.h rename to Core/Libraries/Include/Lib/trig.h diff --git a/Generals/Code/CMakeLists.txt b/Generals/Code/CMakeLists.txt index e52d043e441..85838bb94d6 100644 --- a/Generals/Code/CMakeLists.txt +++ b/Generals/Code/CMakeLists.txt @@ -1,20 +1,14 @@ # g stands for Generals, i stands for Interface add_library(gi_gameengine_include INTERFACE) -add_library(gi_libraries_include INTERFACE) add_library(gi_libraries_source_wwvegas INTERFACE) add_library(gi_main INTERFACE) add_library(gi_always INTERFACE) add_library(gi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(gi_gameengine_include INTERFACE "GameEngine/Include") -target_include_directories(gi_libraries_include INTERFACE "Libraries/Include") target_include_directories(gi_libraries_source_wwvegas INTERFACE "Libraries/Source/WWVegas") target_include_directories(gi_main INTERFACE "Main") -target_sources(gi_libraries_include PRIVATE - Libraries/Include/Lib/BaseType.h - Libraries/Include/Lib/trig.h -) target_compile_definitions(gi_always INTERFACE RTS_GENERALS=1 ) @@ -25,11 +19,9 @@ target_link_libraries(gi_gameengine_include INTERFACE corei_gameengine_include ) target_link_libraries(gi_always INTERFACE - gi_libraries_include corei_always # Must stay below so headers from game are included first ) target_link_libraries(gi_always_no_pch INTERFACE - gi_libraries_include corei_always_no_pch # Must stay below so headers from game are included first ) diff --git a/Generals/Code/Libraries/Include/Lib/BaseType.h b/Generals/Code/Libraries/Include/Lib/BaseType.h deleted file mode 100644 index 274f700f76e..00000000000 --- a/Generals/Code/Libraries/Include/Lib/BaseType.h +++ /dev/null @@ -1,453 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: BaseType.h /////////////////////////////////////////////////////////// -// -// Project: RTS3 -// -// Basic types and constants -// Author: Michael S. Booth, January 1995, September 2000 -// -/////////////////////////////////////////////////////////////////////////////// - -// tell the compiler to only load this file once - -#pragma once - -#include "Lib/BaseTypeCore.h" -#include "Lib/trig.h" - -//----------------------------------------------------------------------------- -typedef wchar_t WideChar; ///< multi-byte character representations - -//----------------------------------------------------------------------------- -template -inline NUM sqr(NUM x) -{ - return x*x; -} - -template -inline NUM clamp(NUM lo, NUM val, NUM hi) -{ - if (val < lo) return lo; - else if (val > hi) return hi; - else return val; -} - -template -inline int sign(NUM x) -{ - if (x > 0) return 1; - else if (x < 0) return -1; - else return 0; -} - -//----------------------------------------------------------------------------- -inline Real rad2deg(Real rad) { return rad * (180/PI); } -inline Real deg2rad(Real rad) { return rad * (PI/180); } - -//----------------------------------------------------------------------------- -// For twiddling bits -//----------------------------------------------------------------------------- -// TheSuperHackers @build xezon 17/03/2025 Renames BitTest to BitIsSet to prevent conflict with BitTest macro from winnt.h -#define BitIsSet( x, i ) ( ( (x) & (i) ) != 0 ) -#define BitSet( x, i ) ( (x) |= (i) ) -#define BitClear( x, i ) ( (x ) &= ~(i) ) -#define BitToggle( x, i ) ( (x) ^= (i) ) - -//------------------------------------------------------------------------------------------------- - -// note, this function depends on the cpu rounding mode, which we set to CHOP every frame, -// but apparently tends to be left in unpredictable modes by various system bits of -// code, so use this function with caution -- it might not round in the way you want. -__forceinline long fast_float2long_round(float f) -{ - long i; - -#if defined(_MSC_VER) && _MSC_VER < 1300 - __asm { - fld [f] - fistp [i] - } -#else - i = lroundf(f); -#endif - - return i; -} - -// super fast float trunc routine, works always (independent of any FPU modes) -// code courtesy of Martin Hoffesommer (grin) -__forceinline float fast_float_trunc(float f) -{ -#if defined(_MSC_VER) && _MSC_VER < 1300 - _asm - { - mov ecx,[f] - shr ecx,23 - mov eax,0xff800000 - xor ebx,ebx - sub cl,127 - cmovc eax,ebx - sar eax,cl - and [f],eax - } - return f; -#else - unsigned x = *(unsigned *)&f; - unsigned char exp = x >> 23; - int mask = exp < 127 ? 0 : 0xff800000; - exp -= 127; - mask >>= exp & 31; - x &= mask; - return *(float *)&x; -#endif -} - -// same here, fast floor function -__forceinline float fast_float_floor(float f) -{ - static unsigned almost1=(126<<23)|0x7fffff; - if (*(unsigned *)&f &0x80000000) - f-=*(float *)&almost1; - return fast_float_trunc(f); -} - -// same here, fast ceil function -__forceinline float fast_float_ceil(float f) -{ - static unsigned almost1=(126<<23)|0x7fffff; - if ( (*(unsigned *)&f &0x80000000)==0) - f+=*(float *)&almost1; - return fast_float_trunc(f); -} - -//------------------------------------------------------------------------------------------------- -#define REAL_TO_INT(x) ((Int)(x)) -#define REAL_TO_UNSIGNEDINT(x) ((UnsignedInt)(x)) -#define REAL_TO_SHORT(x) ((Short)(x)) -#define REAL_TO_UNSIGNEDSHORT(x) ((UnsignedShort)(x)) -#define REAL_TO_BYTE(x) ((Byte)(x)) -#define REAL_TO_UNSIGNEDBYTE(x) ((UnsignedByte)(x)) -#define REAL_TO_CHAR(x) ((Char)(x)) -#define DOUBLE_TO_REAL(x) ((Real)(x)) -#define DOUBLE_TO_INT(x) ((Int)(x)) -#define INT_TO_REAL(x) ((Real)(x)) - -// once we've ceiled/floored, trunc and round are identical, and currently, round is faster... (srj) -#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ -#define REAL_TO_INT_CEIL(x) (fast_float2long_round(ceilf(x))) -#define REAL_TO_INT_FLOOR(x) (fast_float2long_round(floorf(x))) -#else -#define REAL_TO_INT_CEIL(x) (fast_float2long_round(fast_float_ceil(x))) -#define REAL_TO_INT_FLOOR(x) (fast_float2long_round(fast_float_floor(x))) -#endif - -#define FAST_REAL_TRUNC(x) fast_float_trunc(x) -#define FAST_REAL_CEIL(x) fast_float_ceil(x) -#define FAST_REAL_FLOOR(x) fast_float_floor(x) - -//-------------------------------------------------------------------- -// Derived type definitions -//-------------------------------------------------------------------- - -// NOTE: Keep these derived types simple, and avoid constructors and destructors -// so they can be used within unions. - -// real-valued range defined by low and high values -struct RealRange -{ - Real lo, hi; // low and high values of the range - - // combine the given range with us such that we now encompass - // both ranges - void combine( RealRange &other ) - { - lo = MIN( lo, other.lo ); - hi = MAX( hi, other.hi ); - } -}; - -struct Coord2D -{ - Real x, y; - - Real length( void ) const { return (Real)sqrt( x*x + y*y ); } - - void normalize( void ) - { - Real len = length(); - if( len != 0 ) - { - x /= len; - y /= len; - } - } - - Real toAngle( void ) const; ///< turn 2D vector into angle (where angle 0 is down the +x axis) - -}; - -inline Real Coord2D::toAngle( void ) const -{ -#if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ - Coord2D vector; - - vector.x = x; - vector.y = y; - - Real dist = (Real)sqrt(vector.x * vector.x + vector.y * vector.y); - - // normalize - if (dist == 0.0f) - return 0.0f; - - Coord2D dir; - dir.x = 1.0f; - dir.y = 0.0f; - - Real distInv = 1.0f / dist; - vector.x *= distInv; - vector.y *= distInv; - - // dot of two unit vectors is cos of angle - Real c = dir.x*vector.x + dir.y*vector.y; - - // bound it in case of numerical error - if (c < -1.0) - c = -1.0; - else if (c > 1.0) - c = 1.0; - - Real value = (Real)ACos( (Real)c ); - - // Determine sign by checking Z component of dir cross vector - // Note this is assumes 2D, and is identical to dotting the perpendicular of v with dir - Real perpZ = dir.x * vector.y - dir.y * vector.x; - if (perpZ < 0.0f) - value = -value; - - // note: to make this 3D, 'dir' and 'vector' can be normalized and dotted just as they are - // to test sign, compute N = dir X vector, then P = N x dir, then S = P . vector, where sign of - // S is sign of angle - MSB - - return value; -#else - const Real len = length(); - if (len == 0.0f) - return 0.0f; - - Real c = x/len; - // bound it in case of numerical error - if (c < -1.0f) - c = -1.0f; - else if (c > 1.0f) - c = 1.0f; - - return y < 0.0f ? -ACos(c) : ACos(c); -#endif -} - -struct ICoord2D -{ - Int x, y; - - Int length( void ) const { return (Int)sqrt( (double)(x*x + y*y) ); } -}; - -struct Region2D -{ - Coord2D lo, hi; // bounds of 2D rectangular region - - Real width( void ) const { return hi.x - lo.x; } - Real height( void ) const { return hi.y - lo.y; } -}; - -struct IRegion2D -{ - ICoord2D lo, hi; // bounds of 2D rectangular region - - Int width( void ) const { return hi.x - lo.x; } - Int height( void ) const { return hi.y - lo.y; } -}; - - -struct Coord3D -{ - Real x, y, z; - - Real length( void ) const { return (Real)sqrt( x*x + y*y + z*z ); } - Real lengthSqr( void ) const { return ( x*x + y*y + z*z ); } - - void normalize( void ) - { - Real len = length(); - - if( len != 0 ) - { - x /= len; - y /= len; - z /= len; - } - } - - static void crossProduct( const Coord3D *a, const Coord3D *b, Coord3D *r ) - { - r->x = (a->y * b->z - a->z * b->y); - r->y = (a->z * b->x - a->x * b->z); - r->z = (a->x * b->y - a->y * b->x); - } - - void zero( void ) - { - x = 0.0f; - y = 0.0f; - z = 0.0f; - } - - void add( const Coord3D *a ) - { - x += a->x; - y += a->y; - z += a->z; - } - - void sub( const Coord3D *a ) - { - x -= a->x; - y -= a->y; - z -= a->z; - } - - void set( const Coord3D *a ) - { - x = a->x; - y = a->y; - z = a->z; - } - - void set( Real ax, Real ay, Real az ) - { - x = ax; - y = ay; - z = az; - } - - void scale( Real scale ) - { - x *= scale; - y *= scale; - z *= scale; - } - - Bool equals( const Coord3D &r ) - { - return (x == r.x && - y == r.y && - z == r.z); - } - - Bool operator==( const Coord3D &r ) const - { - return (x == r.x && - y == r.y && - z == r.z); - } -}; - -struct ICoord3D -{ - Int x, y, z; - - Int length( void ) const { return (Int)sqrt( (double)(x*x + y*y + z*z) ); } - void zero( void ) - { - - x = 0; - y = 0; - z = 0; - } -}; - -struct Region3D -{ - Coord3D lo, hi; // axis-aligned bounding box - - Real width( void ) const { return hi.x - lo.x; } - Real height( void ) const { return hi.y - lo.y; } - Real depth( void ) const { return hi.z - lo.z; } - - void zero() { lo.zero(); hi.zero(); } - Bool isInRegionNoZ( const Coord3D *query ) const - { - return (lo.x < query->x) && (query->x < hi.x) - && (lo.y < query->y) && (query->y < hi.y); - } - Bool isInRegionWithZ( const Coord3D *query ) const - { - return (lo.x < query->x) && (query->x < hi.x) - && (lo.y < query->y) && (query->y < hi.y) - && (lo.z < query->z) && (query->z < hi.z); - } -}; - -struct IRegion3D -{ - ICoord3D lo, hi; // axis-aligned bounding box - - Int width( void ) const { return hi.x - lo.x; } - Int height( void ) const { return hi.y - lo.y; } - Int depth( void ) const { return hi.z - lo.z; } -}; - - -struct RGBColor -{ - Real red, green, blue; // range between 0 and 1 - - Int getAsInt() const - { - return - ((Int)(red * 255.0) << 16) | - ((Int)(green * 255.0) << 8) | - ((Int)(blue * 255.0) << 0); - } - - void setFromInt(Int c) - { - red = ((c >> 16) & 0xff) / 255.0f; - green = ((c >> 8) & 0xff) / 255.0f; - blue = ((c >> 0) & 0xff) / 255.0f; - } - -}; - -struct RGBAColorReal -{ - - Real red, green, blue, alpha; // range between 0.0 and 1.0 - -}; - -struct RGBAColorInt -{ - - UnsignedInt red, green, blue, alpha; // range between 0 and 255 - -}; diff --git a/Generals/Code/Libraries/Include/Lib/trig.h b/Generals/Code/Libraries/Include/Lib/trig.h deleted file mode 100644 index 569f1ff3496..00000000000 --- a/Generals/Code/Libraries/Include/Lib/trig.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// Trig.h -// fast trig functions -// Author: Sondra Iverson, March 1998 -// Converted to Generals by Matthew D. Campbell, February 2002 - -#pragma once - -Real Sin(Real); -Real Cos(Real); -Real Tan(Real); -Real ACos(Real); -Real ASin(Real x); diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt index d173801dc98..a713dcc7c2b 100644 --- a/GeneralsMD/Code/CMakeLists.txt +++ b/GeneralsMD/Code/CMakeLists.txt @@ -1,20 +1,14 @@ # z stands for Zero Hour, i stands for Interface add_library(zi_gameengine_include INTERFACE) -add_library(zi_libraries_include INTERFACE) add_library(zi_libraries_source_wwvegas INTERFACE) add_library(zi_main INTERFACE) add_library(zi_always INTERFACE) add_library(zi_always_no_pch INTERFACE) # Use this for Shared Libs with MFC AFX target_include_directories(zi_gameengine_include INTERFACE "GameEngine/Include") -target_include_directories(zi_libraries_include INTERFACE "Libraries/Include") target_include_directories(zi_libraries_source_wwvegas INTERFACE "Libraries/Source/WWVegas") target_include_directories(zi_main INTERFACE "Main") -target_sources(zi_libraries_include PRIVATE - Libraries/Include/Lib/BaseType.h - Libraries/Include/Lib/trig.h -) target_compile_definitions(zi_always INTERFACE RTS_ZEROHOUR=1 ) @@ -25,11 +19,9 @@ target_link_libraries(zi_gameengine_include INTERFACE corei_gameengine_include ) target_link_libraries(zi_always INTERFACE - zi_libraries_include corei_always # Must stay below so headers from game are included first ) target_link_libraries(zi_always_no_pch INTERFACE - zi_libraries_include corei_always_no_pch # Must stay below so headers from game are included first ) diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 3430d4b450f..f0845dd95f3 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -260,6 +260,9 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/UserPreferences.h", Game.CORE, "GameEngine/Include/Common/UserPreferences.h") #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/UserPreferences.cpp", Game.CORE, "GameEngine/Source/Common/UserPreferences.cpp") + #unify_file(Game.ZEROHOUR, "Libraries/Include/Lib/BaseType.h", Game.CORE, "Libraries/Include/Lib/BaseType.h") + #unify_file(Game.ZEROHOUR, "Libraries/Include/Lib/trig.h", Game.CORE, "Libraries/Include/Lib/trig.h") + return From 1174285987b06035f70464ed2b25869f5df03fda Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 25 Jan 2026 11:27:47 +0100 Subject: [PATCH 120/211] unify(common): Move some common system files to Core (#2185) All that is needed for ParticleEditor to move to Core --- Core/GameEngine/CMakeLists.txt | 28 +- .../GameEngine/Include/Common/Errors.h | 0 .../GameEngine/Include/Common/GameCommon.h | 0 .../GameEngine/Include/Common/GameType.h | 0 .../GameEngine/Include/Common/INI.h | 0 .../GameEngine/Include/Common/STLTypedefs.h | 0 .../GameEngine/Include/Common/Snapshot.h | 0 .../Include/Common/SubsystemInterface.h | 0 .../Include/GameClient/ChallengeGenerals.h | 0 .../GameEngine/Source/Common/INI/INI.cpp | 0 .../Source/Common/System/GameCommon.cpp | 0 .../Source/Common/System/GameType.cpp | 0 .../Source/Common/System/Snapshot.cpp | 0 .../Common/System/SubsystemInterface.cpp | 0 .../GameClient/GUI/ChallengeGenerals.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 28 +- .../Code/GameEngine/Include/Common/Errors.h | 67 - .../GameEngine/Include/Common/GameCommon.h | 505 ----- .../Code/GameEngine/Include/Common/GameType.h | 191 -- Generals/Code/GameEngine/Include/Common/INI.h | 415 ---- .../GameEngine/Include/Common/STLTypedefs.h | 297 --- .../Code/GameEngine/Include/Common/Snapshot.h | 67 - .../Include/Common/SubsystemInterface.h | 168 -- .../GameEngine/Include/Common/ThingSort.h | 2 +- .../Include/GameClient/ChallengeGenerals.h | 155 -- .../Code/GameEngine/Source/Common/INI/INI.cpp | 2000 ----------------- .../Source/Common/System/GameCommon.cpp | 69 - .../Source/Common/System/GameType.cpp | 48 - .../Source/Common/System/Snapshot.cpp | 56 - .../Common/System/SubsystemInterface.cpp | 236 -- GeneralsMD/Code/GameEngine/CMakeLists.txt | 28 +- .../GameEngine/Include/Common/ThingSort.h | 2 +- .../GameClient/GUI/ChallengeGenerals.cpp | 160 -- scripts/cpp/unify_move_files.py | 14 + 34 files changed, 58 insertions(+), 4478 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/Errors.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/GameCommon.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/GameType.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/INI.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/STLTypedefs.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/Snapshot.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/Common/SubsystemInterface.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ChallengeGenerals.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/INI/INI.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/System/GameCommon.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/System/GameType.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/System/Snapshot.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/Common/System/SubsystemInterface.cpp (100%) rename {Generals/Code => Core}/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/Common/Errors.h delete mode 100644 Generals/Code/GameEngine/Include/Common/GameCommon.h delete mode 100644 Generals/Code/GameEngine/Include/Common/GameType.h delete mode 100644 Generals/Code/GameEngine/Include/Common/INI.h delete mode 100644 Generals/Code/GameEngine/Include/Common/STLTypedefs.h delete mode 100644 Generals/Code/GameEngine/Include/Common/Snapshot.h delete mode 100644 Generals/Code/GameEngine/Include/Common/SubsystemInterface.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h delete mode 100644 Generals/Code/GameEngine/Source/Common/INI/INI.cpp delete mode 100644 Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp delete mode 100644 Generals/Code/GameEngine/Source/Common/System/GameType.cpp delete mode 100644 Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp delete mode 100644 Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp delete mode 100644 GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 13fa1158a01..50636fc397f 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -37,14 +37,14 @@ set(GAMEENGINE_SRC Include/Common/DynamicAudioEventInfo.h # Include/Common/encrypt.h # Include/Common/Energy.h -# Include/Common/Errors.h + Include/Common/Errors.h Include/Common/file.h Include/Common/FileSystem.h Include/Common/FramePacer.h Include/Common/FrameRateLimit.h # Include/Common/FunctionLexicon.h Include/Common/GameAudio.h -# Include/Common/GameCommon.h + Include/Common/GameCommon.h Include/Common/GameDefines.h # Include/Common/GameEngine.h # Include/Common/GameLOD.h @@ -54,13 +54,13 @@ set(GAMEENGINE_SRC # Include/Common/GameSpyMiscPreferences.h # Include/Common/GameState.h # Include/Common/GameStateMap.h -# Include/Common/GameType.h + Include/Common/GameType.h Include/Common/GameUtility.h # Include/Common/Geometry.h # Include/Common/GlobalData.h # Include/Common/Handicap.h # Include/Common/IgnorePreferences.h -# Include/Common/INI.h + Include/Common/INI.h # Include/Common/INIException.h # Include/Common/KindOf.h # Include/Common/LadderPreferences.h @@ -108,7 +108,7 @@ set(GAMEENGINE_SRC #Include/Common/simpleplayer.h # unused # Include/Common/SkirmishBattleHonors.h # Include/Common/SkirmishPreferences.h -# Include/Common/Snapshot.h + Include/Common/Snapshot.h # Include/Common/SparseMatchFinder.h # Include/Common/SpecialPower.h # Include/Common/SpecialPowerMaskType.h @@ -116,9 +116,9 @@ set(GAMEENGINE_SRC # Include/Common/StackDump.h # Include/Common/StateMachine.h # Include/Common/StatsCollector.h -# Include/Common/STLTypedefs.h + Include/Common/STLTypedefs.h Include/Common/StreamingArchiveFile.h -# Include/Common/SubsystemInterface.h + Include/Common/SubsystemInterface.h # Include/Common/SystemInfo.h # Include/Common/Team.h # Include/Common/Terrain.h @@ -145,7 +145,7 @@ set(GAMEENGINE_SRC # Include/GameClient/AnimateWindowManager.h # Include/GameClient/CampaignManager.h # Include/GameClient/CDCheck.h -# Include/GameClient/ChallengeGenerals.h + Include/GameClient/ChallengeGenerals.h # Include/GameClient/ClientInstance.h Include/GameClient/ClientRandomValue.h # Include/GameClient/Color.h @@ -582,7 +582,7 @@ set(GAMEENGINE_SRC # Source/Common/GameMain.cpp Source/Common/GameUtility.cpp # Source/Common/GlobalData.cpp -# Source/Common/INI/INI.cpp + Source/Common/INI/INI.cpp # Source/Common/INI/INIAiData.cpp # Source/Common/INI/INIAnimation.cpp Source/Common/INI/INIAudioEventInfo.cpp @@ -653,10 +653,10 @@ set(GAMEENGINE_SRC Source/Common/System/File.cpp Source/Common/System/FileSystem.cpp # Source/Common/System/FunctionLexicon.cpp -# Source/Common/System/GameCommon.cpp + Source/Common/System/GameCommon.cpp #Source/Common/System/GameMemory.cpp # is conditionally appended #Source/Common/System/GameMemoryInit.cpp # is conditionally appended -# Source/Common/System/GameType.cpp + Source/Common/System/GameType.cpp # Source/Common/System/Geometry.cpp # Source/Common/System/KindOf.cpp # Source/Common/System/List.cpp @@ -670,10 +670,10 @@ set(GAMEENGINE_SRC # Source/Common/System/registry.cpp # Source/Common/System/SaveGame/GameState.cpp # Source/Common/System/SaveGame/GameStateMap.cpp -# Source/Common/System/Snapshot.cpp + Source/Common/System/Snapshot.cpp # Source/Common/System/StackDump.cpp Source/Common/System/StreamingArchiveFile.cpp -# Source/Common/System/SubsystemInterface.cpp + Source/Common/System/SubsystemInterface.cpp # Source/Common/System/Trig.cpp Source/Common/System/UnicodeString.cpp # Source/Common/System/Upgrade.cpp @@ -710,7 +710,7 @@ set(GAMEENGINE_SRC # Source/GameClient/GlobalLanguage.cpp # Source/GameClient/GraphDraw.cpp # Source/GameClient/GUI/AnimateWindowManager.cpp -# Source/GameClient/GUI/ChallengeGenerals.cpp + Source/GameClient/GUI/ChallengeGenerals.cpp # Source/GameClient/GUI/ControlBar/ControlBar.cpp # Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp # Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Errors.h b/Core/GameEngine/Include/Common/Errors.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/Errors.h rename to Core/GameEngine/Include/Common/Errors.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/Core/GameEngine/Include/Common/GameCommon.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h rename to Core/GameEngine/Include/Common/GameCommon.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h b/Core/GameEngine/Include/Common/GameType.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/GameType.h rename to Core/GameEngine/Include/Common/GameType.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/Core/GameEngine/Include/Common/INI.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/INI.h rename to Core/GameEngine/Include/Common/INI.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h b/Core/GameEngine/Include/Common/STLTypedefs.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h rename to Core/GameEngine/Include/Common/STLTypedefs.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Snapshot.h b/Core/GameEngine/Include/Common/Snapshot.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/Snapshot.h rename to Core/GameEngine/Include/Common/Snapshot.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/Core/GameEngine/Include/Common/SubsystemInterface.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h rename to Core/GameEngine/Include/Common/SubsystemInterface.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h b/Core/GameEngine/Include/GameClient/ChallengeGenerals.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ChallengeGenerals.h rename to Core/GameEngine/Include/GameClient/ChallengeGenerals.h diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/Core/GameEngine/Source/Common/INI/INI.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp rename to Core/GameEngine/Source/Common/INI/INI.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Core/GameEngine/Source/Common/System/GameCommon.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/System/GameCommon.cpp rename to Core/GameEngine/Source/Common/System/GameCommon.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp b/Core/GameEngine/Source/Common/System/GameType.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/System/GameType.cpp rename to Core/GameEngine/Source/Common/System/GameType.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp b/Core/GameEngine/Source/Common/System/Snapshot.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/System/Snapshot.cpp rename to Core/GameEngine/Source/Common/System/Snapshot.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp b/Core/GameEngine/Source/Common/System/SubsystemInterface.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp rename to Core/GameEngine/Source/Common/System/SubsystemInterface.cpp diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/Core/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp similarity index 100% rename from Generals/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp rename to Core/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index f4ef0c45917..217d7dcecba 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -33,12 +33,12 @@ set(GAMEENGINE_SRC Include/Common/DrawModule.h Include/Common/encrypt.h Include/Common/Energy.h - Include/Common/Errors.h +# Include/Common/Errors.h # Include/Common/file.h # Include/Common/FileSystem.h Include/Common/FunctionLexicon.h # Include/Common/GameAudio.h - Include/Common/GameCommon.h +# Include/Common/GameCommon.h # Include/Common/GameDefines.h Include/Common/GameEngine.h Include/Common/GameLOD.h @@ -48,12 +48,12 @@ set(GAMEENGINE_SRC Include/Common/GameSpyMiscPreferences.h Include/Common/GameState.h Include/Common/GameStateMap.h - Include/Common/GameType.h +# Include/Common/GameType.h Include/Common/Geometry.h Include/Common/GlobalData.h Include/Common/Handicap.h Include/Common/IgnorePreferences.h - Include/Common/INI.h +# Include/Common/INI.h Include/Common/INIException.h Include/Common/KindOf.h Include/Common/LadderPreferences.h @@ -98,7 +98,7 @@ set(GAMEENGINE_SRC Include/Common/ScoreKeeper.h Include/Common/SkirmishBattleHonors.h Include/Common/SkirmishPreferences.h - Include/Common/Snapshot.h +# Include/Common/Snapshot.h Include/Common/SparseMatchFinder.h Include/Common/SpecialPower.h Include/Common/SpecialPowerMaskType.h @@ -106,9 +106,9 @@ set(GAMEENGINE_SRC Include/Common/StackDump.h Include/Common/StateMachine.h Include/Common/StatsCollector.h - Include/Common/STLTypedefs.h +# Include/Common/STLTypedefs.h # Include/Common/StreamingArchiveFile.h - Include/Common/SubsystemInterface.h +# Include/Common/SubsystemInterface.h Include/Common/SystemInfo.h Include/Common/Team.h Include/Common/Terrain.h @@ -132,7 +132,7 @@ set(GAMEENGINE_SRC # Include/Common/XferSave.h Include/GameClient/Anim2D.h Include/GameClient/AnimateWindowManager.h - Include/GameClient/ChallengeGenerals.h +# Include/GameClient/ChallengeGenerals.h Include/GameClient/CampaignManager.h Include/GameClient/CDCheck.h Include/GameClient/ClientInstance.h @@ -533,7 +533,7 @@ set(GAMEENGINE_SRC Source/Common/GameLOD.cpp Source/Common/GameMain.cpp Source/Common/GlobalData.cpp - Source/Common/INI/INI.cpp +# Source/Common/INI/INI.cpp Source/Common/INI/INIAiData.cpp Source/Common/INI/INIAnimation.cpp # Source/Common/INI/INIAudioEventInfo.cpp @@ -602,9 +602,9 @@ set(GAMEENGINE_SRC # Source/Common/System/File.cpp # Source/Common/System/FileSystem.cpp Source/Common/System/FunctionLexicon.cpp - Source/Common/System/GameCommon.cpp +# Source/Common/System/GameCommon.cpp #Source/Common/System/GameMemory.cpp - Source/Common/System/GameType.cpp +# Source/Common/System/GameType.cpp Source/Common/System/Geometry.cpp Source/Common/System/KindOf.cpp Source/Common/System/List.cpp @@ -618,10 +618,10 @@ set(GAMEENGINE_SRC Source/Common/System/registry.cpp Source/Common/System/SaveGame/GameState.cpp Source/Common/System/SaveGame/GameStateMap.cpp - Source/Common/System/Snapshot.cpp +# Source/Common/System/Snapshot.cpp Source/Common/System/StackDump.cpp # Source/Common/System/StreamingArchiveFile.cpp - Source/Common/System/SubsystemInterface.cpp +# Source/Common/System/SubsystemInterface.cpp Source/Common/System/Trig.cpp # Source/Common/System/UnicodeString.cpp Source/Common/System/Upgrade.cpp @@ -658,7 +658,7 @@ set(GAMEENGINE_SRC Source/GameClient/GlobalLanguage.cpp Source/GameClient/GraphDraw.cpp Source/GameClient/GUI/AnimateWindowManager.cpp - Source/GameClient/GUI/ChallengeGenerals.cpp +# Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp diff --git a/Generals/Code/GameEngine/Include/Common/Errors.h b/Generals/Code/GameEngine/Include/Common/Errors.h deleted file mode 100644 index 2c2cec27c6c..00000000000 --- a/Generals/Code/GameEngine/Include/Common/Errors.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Errors.h -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: Errors.h -// -// Created: Steven Johnson, August 2001 -// -// Desc: Error codes -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -/** - An ErrorCode is the repository for failure modes. In almost all situations, - these values will be THROWN, not returned as error codes. Feel free - to add to this list as necessary; however, there should generally be very - few codes needed. -*/ -enum ErrorCode CPP_11(: UnsignedInt) -{ - ERROR_BASE = 0xdead0001, // a nice, distinctive value - - ERROR_BUG = (ERROR_BASE + 0x0000), ///< should not be possible under normal operation - ERROR_OUT_OF_MEMORY = (ERROR_BASE + 0x0001), ///< unable to allocate memory. - ERROR_BAD_ARG = (ERROR_BASE + 0x0002), ///< generic "bad argument". - ERROR_INVALID_FILE_VERSION = (ERROR_BASE + 0x0003), ///< Unrecognized file version. - ERROR_CORRUPT_FILE_FORMAT = (ERROR_BASE + 0x0004), ///< Invalid file format. - ERROR_BAD_INI = (ERROR_BASE + 0x0005), ///< Bad INI data. - ERROR_INVALID_D3D = (ERROR_BASE + 0x0006), ///< Error initing D3D - - ERROR_LAST -}; diff --git a/Generals/Code/GameEngine/Include/Common/GameCommon.h b/Generals/Code/GameEngine/Include/Common/GameCommon.h deleted file mode 100644 index 34e26d9b065..00000000000 --- a/Generals/Code/GameEngine/Include/Common/GameCommon.h +++ /dev/null @@ -1,505 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameCommon.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GameCommon.h -// -// Created: Steven Johnson, October 2001 -// -// Desc: This is a catchall header for some basic types and definitions -// needed by various bits of the GameLogic/GameClient, but that -// we haven't found a good place for yet. Hopefully this file -// should go away someday, but for now is a convenient spot. -// -//----------------------------------------------------------------------------- - -#pragma once - -#define DONT_ALLOW_DEBUG_CHEATS_IN_RELEASE ///< Take of the DONT to get cheats back in to release - -//#define _CAMPEA_DEMO - -// ---------------------------------------------------------------------------------------------- -#include "Lib/BaseType.h" -#include "WWCommon.h" -#include "Common/GameDefines.h" - -// ---------------------------------------------------------------------------------------------- -#if defined(RTS_DEBUG) - #define DUMP_PERF_STATS -#else - #define NO_DUMP_PERF_STATS -#endif - -// ---------------------------------------------------------------------------------------------- -enum -{ - BaseFps = 30, // The historic base frame rate for this game. This value must never change. - LOGICFRAMES_PER_SECOND = WWSyncPerSecond, - MSEC_PER_SECOND = 1000 -}; -const Real LOGICFRAMES_PER_MSEC_REAL = (((Real)LOGICFRAMES_PER_SECOND) / ((Real)MSEC_PER_SECOND)); -const Real MSEC_PER_LOGICFRAME_REAL = (((Real)MSEC_PER_SECOND) / ((Real)LOGICFRAMES_PER_SECOND)); -const Real LOGICFRAMES_PER_SECONDS_REAL = (Real)LOGICFRAMES_PER_SECOND; -const Real SECONDS_PER_LOGICFRAME_REAL = 1.0f / LOGICFRAMES_PER_SECONDS_REAL; - -// ---------------------------------------------------------------------------------------------- -// note that this returns a REAL value, not an int... most callers will want to -// call ceil() on the result, so that partial frames get converted to full frames! -inline Real ConvertDurationFromMsecsToFrames(Real msec) -{ - return (msec * LOGICFRAMES_PER_MSEC_REAL); -} - -// ---------------------------------------------------------------------------------------------- -inline Real ConvertVelocityInSecsToFrames(Real distPerMsec) -{ - // this looks wrong, but is the correct conversion factor. - return (distPerMsec * SECONDS_PER_LOGICFRAME_REAL); -} - -// ---------------------------------------------------------------------------------------------- -inline Real ConvertAccelerationInSecsToFrames(Real distPerSec2) -{ - // this looks wrong, but is the correct conversion factor. - const Real SEC_PER_LOGICFRAME_SQR = (SECONDS_PER_LOGICFRAME_REAL * SECONDS_PER_LOGICFRAME_REAL); - return (distPerSec2 * SEC_PER_LOGICFRAME_SQR); -} - -// ---------------------------------------------------------------------------------------------- -inline Real ConvertAngularVelocityInDegreesPerSecToRadsPerFrame(Real degPerSec) -{ - const Real RADS_PER_DEGREE = PI / 180.0f; - return (degPerSec * (SECONDS_PER_LOGICFRAME_REAL * RADS_PER_DEGREE)); -} - -// ---------------------------------------------------------------------------------------------- -enum -{ - MAX_PLAYER_COUNT = 16 ///< max number of Players. -}; - -// ---------------------------------------------------------------------------------------------- -/** - a bitmask that can uniquely represent each player. -*/ -#if MAX_PLAYER_COUNT <= 16 - typedef UnsignedShort PlayerMaskType; - const PlayerMaskType PLAYERMASK_ALL = 0xffff; - const PlayerMaskType PLAYERMASK_NONE = 0x0; -#else - #error "this is the wrong size" -#endif - -// ---------------------------------------------------------------------------------------------- -enum -{ - MAX_GLOBAL_GENERAL_TYPES = 9, ///< number of playable General Types, not including the boss) - - /// The start of the playable global generals playertemplates - GLOBAL_GENERAL_BEGIN = 5, - - /// The end of the playable global generals - GLOBAL_GENERAL_END = (GLOBAL_GENERAL_BEGIN + MAX_GLOBAL_GENERAL_TYPES - 1) -}; - -//------------------------------------------------------------------------------------------------- -enum GameDifficulty CPP_11(: Int) -{ - DIFFICULTY_EASY, - DIFFICULTY_NORMAL, - DIFFICULTY_HARD, - - DIFFICULTY_COUNT -}; - -//------------------------------------------------------------------------------------------------- -enum PlayerType CPP_11(: Int) -{ - PLAYER_HUMAN, ///< player is human-controlled - PLAYER_COMPUTER, ///< player is computer-controlled - - PLAYERTYPE_COUNT -}; - -//------------------------------------------------------------------------------------------------- -/// A PartitionCell can be one of three states for Shroud -enum CellShroudStatus CPP_11(: Int) -{ - CELLSHROUD_CLEAR, - CELLSHROUD_FOGGED, - CELLSHROUD_SHROUDED, -}; - -//------------------------------------------------------------------------------------------------- -/// Since an object can take up more than a single PartitionCell, this is a status that applies to the whole Object -enum ObjectShroudStatus CPP_11(: Int) -{ - OBJECTSHROUD_INVALID, ///< indeterminate state, will recompute - OBJECTSHROUD_CLEAR, ///< object is not shrouded at all (ie, completely visible) - OBJECTSHROUD_PARTIAL_CLEAR, ///< object is partly clear (rest is shroud or fog) - OBJECTSHROUD_FOGGED, ///< object is completely fogged - OBJECTSHROUD_SHROUDED, ///< object is completely shrouded - OBJECTSHROUD_INVALID_BUT_PREVIOUS_VALID, ///< indeterminate state, will recompute, BUT previous status is valid, don't reset (used for save/load) -}; - -//------------------------------------------------------------------------------------------------- -enum GuardMode CPP_11(: Int) -{ - GUARDMODE_NORMAL, - GUARDMODE_GUARD_WITHOUT_PURSUIT, // no pursuit out of guard area - GUARDMODE_GUARD_FLYING_UNITS_ONLY // ignore nonflyers -}; - -// --------------------------------------------------- -enum -{ - NEVER = 0, - FOREVER = 0x3fffffff // (we use 0x3fffffff so that we can add offsets and not overflow... - // at 30fps we're still pretty safe!) -}; - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- - -/// Veterancy level define needed by several files that don't need the full Experience code. -// NOTE NOTE NOTE: Keep TheVeterencyNames in sync with these. -enum VeterancyLevel CPP_11(: Int) -{ - LEVEL_REGULAR, - LEVEL_VETERAN, - LEVEL_ELITE, - LEVEL_HEROIC, - - LEVEL_COUNT, - LEVEL_INVALID, - - LEVEL_FIRST = 0, - LEVEL_LAST = LEVEL_HEROIC -}; - -// TheVeterancyNames is defined in GameCommon.cpp -extern const char *const TheVeterancyNames[]; - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -enum CommandSourceType CPP_11(: Int) -{ - - CMD_FROM_PLAYER = 0, - CMD_FROM_SCRIPT, - CMD_FROM_AI, - CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba. - CMD_DEFAULT_SWITCH_WEAPON, // Special case: A weapon that can be chosen -- this is the default case (machine gun vs flashbang). - - COMMAND_SOURCE_TYPE_COUNT -}; - -//------------------------------------------------------------------------------------------------- -enum AbleToAttackType CPP_11(: Int) -{ - _ATTACK_FORCED = 0x01, - _ATTACK_CONTINUED = 0x02, - _ATTACK_TUNNELNETWORK_GUARD = 0x04, - - /** - can we attack if this is a new target? - */ - ATTACK_NEW_TARGET = (0), - - /** - can we attack if this is a new target, via force-fire? - (The only current difference between this and ATTACK_NEW_TARGET is that disguised units - are force-attackable even when stealthed.) - */ - ATTACK_NEW_TARGET_FORCED= (_ATTACK_FORCED), - - /** - can we attack if this is continuation of an existing attack? - (The only current difference between this and ATTACK_NEW_TARGET is you are allowed to follow - immobile shrouded units into the fog) - */ - ATTACK_CONTINUED_TARGET = (_ATTACK_CONTINUED), - - /** - can we attack if this is continuation of an existing attack? - (The only current difference between this and ATTACK_NEW_TARGET is you are allowed to follow - immobile shrouded units into the fog) - */ - ATTACK_CONTINUED_TARGET_FORCED = (_ATTACK_FORCED | _ATTACK_CONTINUED), - - /** - Special case that bypasses some of the checks for units guarding from within tunnel networks! - For example, a unit inside couldn't normally see outside and would fail. - */ - ATTACK_TUNNEL_NETWORK_GUARD = (_ATTACK_TUNNELNETWORK_GUARD) - -}; - -//------------------------------------------------------------------------------------------------- -inline Bool isForcedAttack(AbleToAttackType t) -{ - return (((Int)t) & _ATTACK_FORCED) != 0; -} - -//------------------------------------------------------------------------------------------------- -inline Bool isContinuedAttack(AbleToAttackType t) -{ - return (((Int)t) & _ATTACK_CONTINUED) != 0; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- - -typedef UnsignedInt VeterancyLevelFlags; - -const VeterancyLevelFlags VETERANCY_LEVEL_FLAGS_ALL = 0xffffffff; -const VeterancyLevelFlags VETERANCY_LEVEL_FLAGS_NONE = 0x00000000; - -inline Bool getVeterancyLevelFlag(VeterancyLevelFlags flags, VeterancyLevel dt) -{ - return (flags & (1UL << (dt - 1))) != 0; -} - -inline VeterancyLevelFlags setVeterancyLevelFlag(VeterancyLevelFlags flags, VeterancyLevel dt) -{ - return (flags | (1UL << (dt - 1))); -} - -inline VeterancyLevelFlags clearVeterancyLevelFlag(VeterancyLevelFlags flags, VeterancyLevel dt) -{ - return (flags & ~(1UL << (dt - 1))); -} - -// ---------------------------------------------------------------------------------------------- -#define BOGUSPTR(p) ((((unsigned int)(p)) & 1) != 0) - -// ---------------------------------------------------------------------------------------------- -#define MAKE_DLINK_HEAD(OBJCLASS, LISTNAME) \ -public: \ - inline DLINK_ITERATOR iterate_##LISTNAME() const \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \ - return DLINK_ITERATOR(m_dlinkhead_##LISTNAME.m_head, &OBJCLASS::dlink_next_##LISTNAME); \ - } \ - inline OBJCLASS *getFirstItemIn_##LISTNAME() const \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \ - return m_dlinkhead_##LISTNAME.m_head; \ - } \ - inline Bool isInList_##LISTNAME(OBJCLASS* o) const \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \ - return o->dlink_isInList_##LISTNAME(&m_dlinkhead_##LISTNAME.m_head); \ - } \ - inline void prependTo_##LISTNAME(OBJCLASS* o) \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \ - if (!isInList_##LISTNAME(o)) \ - o->dlink_prependTo_##LISTNAME(&m_dlinkhead_##LISTNAME.m_head); \ - } \ - inline void removeFrom_##LISTNAME(OBJCLASS* o) \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr")); \ - if (isInList_##LISTNAME(o)) \ - o->dlink_removeFrom_##LISTNAME(&m_dlinkhead_##LISTNAME.m_head); \ - } \ - typedef void (*RemoveAllProc_##LISTNAME)(OBJCLASS* o); \ - inline void removeAll_##LISTNAME(RemoveAllProc_##LISTNAME p = nullptr) \ - { \ - while (m_dlinkhead_##LISTNAME.m_head) \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(m_dlinkhead_##LISTNAME.m_head), ("bogus head ptr"));\ - OBJCLASS *tmp = m_dlinkhead_##LISTNAME.m_head; \ - removeFrom_##LISTNAME(tmp); \ - if (p) (*p)(tmp); \ - } \ - } \ - inline void reverse_##LISTNAME() \ - { \ - OBJCLASS* cur = m_dlinkhead_##LISTNAME.m_head; \ - OBJCLASS* prev = nullptr; \ - while (cur) \ - { \ - OBJCLASS* originalNext = cur->dlink_next_##LISTNAME(); \ - cur->dlink_swapLinks_##LISTNAME(); \ - prev = cur; \ - cur = originalNext; \ - } \ - m_dlinkhead_##LISTNAME.m_head = prev; \ - } \ -private: \ - /* a trick: init head to zero */ \ - struct DLINKHEAD_##LISTNAME \ - { \ - public: \ - OBJCLASS* m_head; \ - inline DLINKHEAD_##LISTNAME() : \ - m_head(0) { } \ - inline ~DLINKHEAD_##LISTNAME() \ - { DEBUG_ASSERTCRASH(!m_head,("destroying dlinkhead still in a list " #LISTNAME)); } \ - }; \ - DLINKHEAD_##LISTNAME m_dlinkhead_##LISTNAME; - -// ---------------------------------------------------------------------------------------------- -#define MAKE_DLINK(OBJCLASS, LISTNAME) \ -public: \ - OBJCLASS* dlink_prev_##LISTNAME() const { return m_dlink_##LISTNAME.m_prev; } \ - OBJCLASS* dlink_next_##LISTNAME() const { return m_dlink_##LISTNAME.m_next; } \ - void dlink_swapLinks_##LISTNAME() \ - { \ - OBJCLASS* originalNext = m_dlink_##LISTNAME.m_next; \ - m_dlink_##LISTNAME.m_next = m_dlink_##LISTNAME.m_prev; \ - m_dlink_##LISTNAME.m_prev = originalNext; \ - } \ - Bool dlink_isInList_##LISTNAME(OBJCLASS* const* pListHead) const \ - { \ - DEBUG_ASSERTCRASH(!BOGUSPTR(*pListHead) && !BOGUSPTR(m_dlink_##LISTNAME.m_next) && !BOGUSPTR(m_dlink_##LISTNAME.m_prev), ("bogus ptrs")); \ - return *pListHead == this || m_dlink_##LISTNAME.m_prev || m_dlink_##LISTNAME.m_next; \ - } \ - void dlink_prependTo_##LISTNAME(OBJCLASS** pListHead) \ - { \ - DEBUG_ASSERTCRASH(!dlink_isInList_##LISTNAME(pListHead), ("already in list " #LISTNAME)); \ - DEBUG_ASSERTCRASH(!BOGUSPTR(*pListHead) && !BOGUSPTR(m_dlink_##LISTNAME.m_next) && !BOGUSPTR(m_dlink_##LISTNAME.m_prev), ("bogus ptrs")); \ - m_dlink_##LISTNAME.m_next = *pListHead; \ - if (*pListHead) \ - (*pListHead)->m_dlink_##LISTNAME.m_prev = this; \ - *pListHead = this; \ - DEBUG_ASSERTCRASH(!BOGUSPTR(*pListHead) && !BOGUSPTR(m_dlink_##LISTNAME.m_next) && !BOGUSPTR(m_dlink_##LISTNAME.m_prev), ("bogus ptrs")); \ - } \ - void dlink_removeFrom_##LISTNAME(OBJCLASS** pListHead) \ - { \ - DEBUG_ASSERTCRASH(dlink_isInList_##LISTNAME(pListHead), ("not in list" #LISTNAME)); \ - DEBUG_ASSERTCRASH(!BOGUSPTR(*pListHead) && !BOGUSPTR(m_dlink_##LISTNAME.m_next) && !BOGUSPTR(m_dlink_##LISTNAME.m_prev), ("bogus ptrs")); \ - if (m_dlink_##LISTNAME.m_next) \ - m_dlink_##LISTNAME.m_next->m_dlink_##LISTNAME.m_prev = m_dlink_##LISTNAME.m_prev; \ - if (m_dlink_##LISTNAME.m_prev) \ - m_dlink_##LISTNAME.m_prev->m_dlink_##LISTNAME.m_next = m_dlink_##LISTNAME.m_next; \ - else \ - *pListHead = m_dlink_##LISTNAME.m_next; \ - m_dlink_##LISTNAME.m_prev = 0; \ - m_dlink_##LISTNAME.m_next = 0; \ - DEBUG_ASSERTCRASH(!BOGUSPTR(*pListHead) && !BOGUSPTR(m_dlink_##LISTNAME.m_next) && !BOGUSPTR(m_dlink_##LISTNAME.m_prev), ("bogus ptrs")); \ - } \ -private: \ - /* a trick: init links to zero */ \ - struct DLINK_##LISTNAME \ - { \ - public: \ - OBJCLASS* m_prev; \ - OBJCLASS* m_next; \ - inline DLINK_##LISTNAME() : \ - m_prev(0), m_next(0) { } \ - inline ~DLINK_##LISTNAME() \ - { DEBUG_ASSERTCRASH(!m_prev && !m_next,("destroying dlink still in a list " #LISTNAME)); } \ - }; \ - DLINK_##LISTNAME m_dlink_##LISTNAME; - -// ------------------------------------------------------------------------ -// this is the weird C++ syntax for "call pointer-to-member-function"... see C++ FAQ LITE for details. -#define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember)) - -// ------------------------------------------------------------------------ -template -class DLINK_ITERATOR -{ -public: - // this is the weird C++ syntax for "pointer-to-member-function" - typedef OBJCLASS* (OBJCLASS::*GetNextFunc)() const; -private: - OBJCLASS* m_cur; - GetNextFunc m_getNextFunc; // this is the weird C++ syntax for "pointer-to-member-function" -public: - DLINK_ITERATOR(OBJCLASS* cur, GetNextFunc getNextFunc) : m_cur(cur), m_getNextFunc(getNextFunc) - { - } - - void advance() - { - if (m_cur) - m_cur = callMemberFunction(*m_cur, m_getNextFunc)(); - } - - Bool done() const - { - return m_cur == nullptr; - } - - OBJCLASS* cur() const - { - return m_cur; - } - -}; - -// ------------------------------------------------------------------------ - -enum WhichTurretType CPP_11(: Int) -{ - TURRET_INVALID = -1, - - TURRET_MAIN = 0, - TURRET_ALT, - - MAX_TURRETS -}; - -// ------------------------------------------------------------------------ -// this normalizes an angle to the range -PI...PI. -// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. -extern Real normalizeAngle(Real angle); - -// ------------------------------------------------------------------------ -// this returns the difference between a1 and a2, normalized. -inline Real stdAngleDiff(Real a1, Real a2) -{ - return normalizeAngle(a1 - a2); -} - -// ------------------------------------------------------------------------ -// NOTE NOTE NOTE: Keep TheRelationShipNames in sync with this enum -enum Relationship CPP_11(: Int) -{ - ENEMIES, - NEUTRAL, - ALLIES, - - RELATIONSHIP_COUNT -}; - - -// TheRelationShipNames is defined in Common/GameCommon.cpp -extern const char *const TheRelationshipNames[]; diff --git a/Generals/Code/GameEngine/Include/Common/GameType.h b/Generals/Code/GameEngine/Include/Common/GameType.h deleted file mode 100644 index c28b9e04fbd..00000000000 --- a/Generals/Code/GameEngine/Include/Common/GameType.h +++ /dev/null @@ -1,191 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// GameType.h -// Basic data types needed for the game engine. This is an extension of BaseType.h. -// Author: Michael S. Booth, April 2001 - -#pragma once - -#include "Lib/BaseType.h" - -// the default size of the world map -#define DEFAULT_WORLD_WIDTH 64 -#define DEFAULT_WORLD_HEIGHT 64 - -/// A unique, generic "identifier" used to access Objects. -enum ObjectID CPP_11(: Int) -{ - INVALID_ID = 0, - FORCE_OBJECTID_TO_LONG_SIZE = 0x7ffffff -}; - -/// A unique, generic "identifier" used to access Drawables. -enum DrawableID CPP_11(: Int) -{ - INVALID_DRAWABLE_ID = 0, - FORCE_DRAWABLEID_TO_LONG_SIZE = 0x7ffffff -}; - -/// A unique, generic "identifier" used to identify player specified formations. -enum FormationID CPP_11(: Int) -{ - NO_FORMATION_ID = 0, // Unit is not a member of any formation - FORCE_FORMATIONID_TO_LONG_SIZE = 0x7ffffff -}; - -#define INVALID_ANGLE -100.0f - -class INI; - -//------------------------------------------------------------------------------------------------- -/** The time of day enumeration, keep in sync with TimeOfDayNames[] */ -//------------------------------------------------------------------------------------------------- -enum TimeOfDay CPP_11(: Int) -{ - TIME_OF_DAY_INVALID, - - TIME_OF_DAY_MORNING, - TIME_OF_DAY_AFTERNOON, - TIME_OF_DAY_EVENING, - TIME_OF_DAY_NIGHT, - - TIME_OF_DAY_COUNT, - TIME_OF_DAY_FIRST = TIME_OF_DAY_MORNING, -}; - -extern const char *const TimeOfDayNames[]; -// defined in Common/GameType.cpp - -//------------------------------------------------------------------------------------------------- -enum Weather CPP_11(: Int) -{ - WEATHER_NORMAL = 0, - WEATHER_SNOWY = 1, - - WEATHER_COUNT -}; - -extern const char *const WeatherNames[]; - -enum Scorches CPP_11(: Int) -{ - SCORCH_1 = 0, - SCORCH_2 = 1, - SCORCH_3 = 2, - SCORCH_4 = 3, - SHADOW_SCORCH = 4, -/* SCORCH_6 = 5, - SCORCH_7 = 6, - SCORCH_8 = 7, - - CRATER_1 = 8, - CRATER_2 = 9, - CRATER_3 = 10, - CRATER_4 = 11, - CRATER_5 = 12, - CRATER_6 = 13, - CRATER_7 = 14, - CRATER_8 = 15, - - - MISC_DECAL_1 = 16, - MISC_DECAL_2 = 17, - MISC_DECAL_3 = 18, - MISC_DECAL_4 = 19, - MISC_DECAL_5 = 20, - MISC_DECAL_6 = 21, - MISC_DECAL_7 = 22, - MISC_DECAL_8 = 23, - - MISC_DECAL_9 = 24, - MISC_DECAL_10 = 25, - MISC_DECAL_11 = 26, - MISC_DECAL_12 = 27, - MISC_DECAL_13 = 28, - MISC_DECAL_14 = 29, - MISC_DECAL_15 = 30, - MISC_DECAL_16 = 31, - - MISC_DECAL_17 = 32, - MISC_DECAL_18 = 33, - MISC_DECAL_19 = 34, - MISC_DECAL_20 = 35, - MISC_DECAL_21 = 36, - MISC_DECAL_22 = 37, - MISC_DECAL_23 = 38, - MISC_DECAL_24 = 39, - - MISC_DECAL_25 = 40, - MISC_DECAL_26 = 41, - MISC_DECAL_27 = 42, - MISC_DECAL_28 = 43, - MISC_DECAL_29 = 44, - MISC_DECAL_30 = 45, - MISC_DECAL_31 = 46, - MISC_DECAL_32 = 47, - - MISC_DECAL_33 = 48, - MISC_DECAL_34 = 49, - MISC_DECAL_35 = 50, - MISC_DECAL_36 = 51, - MISC_DECAL_37 = 52, - MISC_DECAL_38 = 53, - MISC_DECAL_39 = 54, - MISC_DECAL_40 = 55, - - MISC_DECAL_41 = 56, - MISC_DECAL_42 = 57, - MISC_DECAL_43 = 58, - MISC_DECAL_44 = 59, - MISC_DECAL_45 = 60, - MISC_DECAL_46 = 61, - MISC_DECAL_47 = 62, - MISC_DECAL_48 = 63, -*/ - SCORCH_COUNT -}; - -//------------------------------------------------------------------------------------------------- -enum WeaponSlotType CPP_11(: Int) -{ - PRIMARY_WEAPON = 0, - SECONDARY_WEAPON, - TERTIARY_WEAPON, - - WEAPONSLOT_COUNT -}; - -//------------------------------------------------------------------------------------------------- -// Pathfind layers - ground is the first layer, each bridge is another. jba. -// Layer 1 is the ground. -// Layer 2 is the top layer - bridge if one is present, ground otherwise. -// Layer 2 - LAYER_LAST -1 are bridges. -// Layer_WALL is a special "wall" layer for letting units run around on top of a wall -// made of structures. -// Note that the bridges just index in the pathfinder, so you don't actually -// have a LAYER_BRIDGE_1 enum value. -enum PathfindLayerEnum CPP_11(: Int) {LAYER_INVALID = 0, LAYER_GROUND = 1, LAYER_WALL = 15, LAYER_LAST=15}; - -//------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/Common/INI.h b/Generals/Code/GameEngine/Include/Common/INI.h deleted file mode 100644 index f08d157f7dc..00000000000 --- a/Generals/Code/GameEngine/Include/Common/INI.h +++ /dev/null @@ -1,415 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: INI.h //////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, November 2001 -// Desc: INI Reader -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include // for offsetof, which we don't use but everyone who includes us does -#include "Common/STLTypedefs.h" -#include "Common/AsciiString.h" -#include "Common/GameCommon.h" - -//------------------------------------------------------------------------------------------------- -class INI; -class Xfer; -class File; -enum ScienceType CPP_11(: Int); - -//------------------------------------------------------------------------------------------------- -/** These control the behavior of loading the INI data into items */ -//------------------------------------------------------------------------------------------------- -enum INILoadType CPP_11(: Int) -{ - INI_LOAD_INVALID, ///< invalid load type - INI_LOAD_OVERWRITE, ///< create new or load *over* existing data instance - INI_LOAD_CREATE_OVERRIDES, ///< create new or load into *new* override data instance - INI_LOAD_MULTIFILE ///< create new or continue loading into existing data instance. -}; - -//------------------------------------------------------------------------------------------------- -/** INI constant defines */ -//------------------------------------------------------------------------------------------------- -enum -{ - INI_MAX_CHARS_PER_LINE = 1028, ///< max characters per line entry in any ini file -}; - -//------------------------------------------------------------------------------------------------- -/** Status return codes for the INI reader */ -//------------------------------------------------------------------------------------------------- -enum -{ - // we map all of these to the same "real" error code, because - // we generally don't care why it failed; but since the code distinguishes, - // I didn't want to wipe out that intelligence. if we ever need to distinguish - // failure modes at runtime, just put in real values for these. - INI_CANT_SEARCH_DIR = ERROR_BAD_INI, - INI_INVALID_DIRECTORY = ERROR_BAD_INI, - INI_INVALID_PARAMS = ERROR_BAD_INI, - INI_INVALID_NAME_LIST = ERROR_BAD_INI, - INI_INVALID_DATA = ERROR_BAD_INI, - INI_MISSING_END_TOKEN = ERROR_BAD_INI, - INI_UNKNOWN_TOKEN = ERROR_BAD_INI, - INI_BUFFER_TOO_SMALL = ERROR_BAD_INI, - INI_FILE_NOT_OPEN = ERROR_BAD_INI, - INI_FILE_ALREADY_OPEN = ERROR_BAD_INI, - INI_CANT_OPEN_FILE = ERROR_BAD_INI, - INI_UNKNOWN_ERROR = ERROR_BAD_INI, - INI_END_OF_FILE = ERROR_BAD_INI -}; - -//------------------------------------------------------------------------------------------------- -/** Function typedef for parsing data block fields. - * - * buffer - the character buffer of the line from INI that we are reading and parsing - * instance - instance of what we're loading (for example a ThingTemplate instance) - * store - where to store the data parsed, this is a field in the *instance* 'instance' - */ -//------------------------------------------------------------------------------------------------- -typedef void (*INIFieldParseProc)( INI *ini, void *instance, void *store, const void* userData ); - -//------------------------------------------------------------------------------------------------- -typedef const char* const ConstCharPtr; -typedef ConstCharPtr* ConstCharPtrArray; - -//------------------------------------------------------------------------------------------------- -struct LookupListRec -{ - const char* name; - Int value; -}; -typedef const LookupListRec *ConstLookupListRecArray; - -//------------------------------------------------------------------------------------------------- -/** Parse tables for all fields of each data block are created using these */ -//------------------------------------------------------------------------------------------------- -struct FieldParse -{ - const char* token; ///< token of the field - INIFieldParseProc parse; ///< the parse function - const void* userData; ///< field-specific data - Int offset; ///< offset to data field - - void set(const char* t, INIFieldParseProc p, const void* u, Int o) - { - token = t; - parse = p; - userData = u; - offset = o; - } -}; - -//------------------------------------------------------------------------------------------------- -class MultiIniFieldParse -{ -private: - enum { MAX_MULTI_FIELDS = 16 }; - - const FieldParse* m_fieldParse[MAX_MULTI_FIELDS]; - UnsignedInt m_extraOffset[MAX_MULTI_FIELDS]; - Int m_count; - -public: - MultiIniFieldParse() : m_count(0) - { - for(Int i = 0; i < MAX_MULTI_FIELDS; i++) - m_extraOffset[i] = 0; - } - - void add(const FieldParse* f, UnsignedInt e = 0); - - Int getCount() const { return m_count; } - const FieldParse* getNthFieldParse(Int i) const { return m_fieldParse[i]; } - UnsignedInt getNthExtraOffset(Int i) const { return m_extraOffset[i]; } -}; - -//------------------------------------------------------------------------------------------------- -/** Function typedef for parsing INI types blocks */ -//------------------------------------------------------------------------------------------------- -typedef void (*INIBlockParse)( INI *ini ); -typedef void (*BuildMultiIniFieldProc)(MultiIniFieldParse& p); - -//------------------------------------------------------------------------------------------------- -/** INI Reader interface */ -//------------------------------------------------------------------------------------------------- -class INI -{ - INI(const INI&); - INI& operator=(const INI&); - -public: - - INI(); - ~INI(); - - // TheSuperHackers @feature xezon 19/08/2025 - // Load a specific INI file by name and/or INI files from a directory (and its subdirectories). - // For example "Data\INI\Armor" loads "Data\INI\Armor.ini" and all *.ini files in "Data\INI\Armor". - // Throws if not a single INI file is found or one is not read correctly. - UnsignedInt loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); - - // Load INI files from a directory (and its subdirectories). - // Throws if one INI file is not read correctly. - UnsignedInt loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs = TRUE ); - - // Load one specific INI file by name. - // Throws if the INI file is not found or is not read correctly. - UnsignedInt load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); - - static Bool isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ); - static Bool isEndOfBlock( char *bufferToCheck ); - - // data type parsing (the highest level of what type of thing we're parsing) - static void parseObjectDefinition( INI *ini ); - static void parseObjectReskinDefinition( INI *ini ); - static void parseWeaponTemplateDefinition( INI *ini ); - static void parseScienceDefinition( INI *ini ); - static void parseRankDefinition( INI *ini ); - static void parseCrateTemplateDefinition( INI *ini ); - static void parseLocomotorTemplateDefinition( INI *ini ); - static void parseLanguageDefinition( INI *ini ); - static void parsePlayerTemplateDefinition( INI *ini ); - static void parseGameDataDefinition( INI *ini ); - static void parseMapDataDefinition( INI *ini ); - static void parseAnim2DDefinition( INI *ini ); - static void parseAudioEventDefinition( INI *ini ); - static void parseDialogDefinition( INI *ini ); - static void parseMusicTrackDefinition( INI *ini ); - static void parseWebpageURLDefinition( INI *ini ); - static void parseHeaderTemplateDefinition( INI *ini ); - static void parseParticleSystemDefinition( INI *ini ); - static void parseWaterSettingDefinition( INI *ini ); - static void parseWaterTransparencyDefinition( INI *ini ); - static void parseWeatherDefinition( INI *ini ); - static void parseMappedImageDefinition( INI *ini ); - static void parseArmorDefinition( INI *ini ); - static void parseDamageFXDefinition( INI *ini ); - static void parseDrawGroupNumberDefinition( INI *ini ); - static void parseTerrainDefinition( INI *ini ); - static void parseTerrainRoadDefinition( INI *ini ); - static void parseTerrainBridgeDefinition( INI *ini ); - static void parseMetaMapDefinition( INI *ini ); - static void parseFXListDefinition( INI *ini ); - static void parseObjectCreationListDefinition( INI* ini ); - static void parseMultiplayerSettingsDefinition( INI* ini ); - static void parseMultiplayerColorDefinition( INI* ini ); - static void parseMultiplayerStartingMoneyChoiceDefinition( INI* ini ); - static void parseOnlineChatColorDefinition( INI* ini ); - static void parseMapCacheDefinition( INI* ini ); - static void parseVideoDefinition( INI* ini ); - static void parseCommandButtonDefinition( INI *ini ); - static void parseCommandSetDefinition( INI *ini ); - static void parseUpgradeDefinition( INI *ini ); - static void parseMouseDefinition( INI* ini ); - static void parseMouseCursorDefinition( INI* ini ); - static void parseAIDataDefinition( INI *ini ); - static void parseSpecialPowerDefinition( INI *ini ); - static void parseInGameUIDefinition( INI *ini ); - static void parseControlBarSchemeDefinition( INI *ini ); - static void parseControlBarResizerDefinition( INI *ini ); - static void parseShellMenuSchemeDefinition( INI *ini ); - static void parseCampaignDefinition( INI *ini ); - static void parseAudioSettingsDefinition( INI *ini ); - static void parseMiscAudio( INI *ini ); - static void parseStaticGameLODDefinition( INI *ini); - static void parseDynamicGameLODDefinition( INI *ini); - static void parseStaticGameLODLevel( INI* ini, void * , void *store, const void*); - static void parseDynamicGameLODLevel( INI* ini, void * , void *store, const void*); - static void parseLODPreset( INI* ini); - static void parseBenchProfile( INI* ini); - static void parseEvaEvent( INI* ini ); - static void parseCredits( INI* ini ); - static void parseWindowTransitions( INI* ini ); - static void parseChallengeModeDefinition( INI* ini ); - - AsciiString getFilename( void ) const { return m_filename; } - INILoadType getLoadType( void ) const { return m_loadType; } - UnsignedInt getLineNum( void ) const { return m_lineNum; } - const char *getSeps( void ) const { return m_seps; } - const char *getSepsPercent( void ) const { return m_sepsPercent; } - const char *getSepsColon( void ) const { return m_sepsColon; } - const char *getSepsQuote( void ) { return m_sepsQuote; } - Bool isEOF( void ) const { return m_endOfFile; } - - void initFromINI( void *what, const FieldParse* parseTable ); - void initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList ); - void initFromINIMultiProc( void *what, BuildMultiIniFieldProc proc ); - - static void parseUnsignedByte( INI *ini, void *instance, void *store, const void* userData ); - static void parseShort( INI *ini, void *instance, void *store, const void* userData ); - static void parseUnsignedShort( INI *ini, void *instance, void *store, const void* userData ); - static void parseInt( INI *ini, void *instance, void *store, const void* userData ); - static void parseUnsignedInt( INI *ini, void *instance, void *store, const void* userData ); - static void parseReal( INI *ini, void *instance, void *store, const void* userData ); - static void parsePositiveNonZeroReal( INI *ini, void *instance, void *store, const void* userData ); - static void parseBool( INI *ini, void *instance, void *store, const void* userData ); - static void parseBitInInt32( INI *ini, void *instance, void *store, const void* userData ); - static void parseAsciiString( INI *ini, void *instance, void *store, const void* userData ); - static void parseQuotedAsciiString( INI *ini, void *instance, void *store, const void* userData ); - static void parseAsciiStringVector( INI *ini, void *instance, void *store, const void* userData ); - static void parseAsciiStringVectorAppend( INI *ini, void *instance, void *store, const void* userData ); - static void parseAndTranslateLabel( INI *ini, void *instance, void *store, const void* userData ); - static void parseMappedImage( INI *ini, void *instance, void *store, const void *userData ); - static void parseAnim2DTemplate( INI *ini, void *instance, void *store, const void *userData ); - static void parsePercentToReal( INI *ini, void *instance, void *store, const void* userData ); - static void parseRGBColor( INI *ini, void *instance, void *store, const void* userData ); - static void parseRGBAColorInt( INI *ini, void *instance, void *store, const void* userData ); - static void parseColorInt( INI *ini, void *instance, void *store, const void* userData ); - static void parseCoord3D( INI *ini, void *instance, void *store, const void* userData ); - static void parseCoord2D( INI *ini, void *instance, void *store, const void *userData ); - static void parseICoord2D( INI *ini, void *instance, void *store, const void *userData ); - static void parseDynamicAudioEventRTS( INI *ini, void *instance, void *store, const void* userData ); - static void parseAudioEventRTS( INI *ini, void *instance, void *store, const void* userData ); - static void parseFXList( INI *ini, void *instance, void *store, const void* userData ); - static void parseParticleSystemTemplate( INI *ini, void *instance, void *store, const void *userData ); - static void parseObjectCreationList( INI *ini, void *instance, void *store, const void* userData ); - static void parseSpecialPowerTemplate( INI *ini, void *instance, void *store, const void *userData ); - static void parseUpgradeTemplate( INI *ini, void *instance, void *store, const void *userData ); - static void parseScience( INI *ini, void *instance, void *store, const void *userData ); - static void parseScienceVector( INI *ini, void *instance, void *store, const void *userData ); - static void parseGameClientRandomVariable( INI* ini, void *instance, void *store, const void* userData ); - static void parseBitString8( INI *ini, void *instance, void *store, const void* userData ); - static void parseBitString32( INI *ini, void *instance, void *store, const void* userData ); - static void parseByteSizedIndexList( INI *ini, void *instance, void *store, const void* userData ); - static void parseIndexList( INI *ini, void *instance, void *store, const void* userData ); - static void parseLookupList( INI *ini, void *instance, void *store, const void* userData ); - static void parseThingTemplate( INI *ini, void *instance, void *store, const void* userData ); - static void parseArmorTemplate( INI *ini, void *instance, void *store, const void* userData ); - static void parseDamageFX( INI *ini, void *instance, void *store, const void* userData ); - static void parseWeaponTemplate( INI *ini, void *instance, void *store, const void* userData ); - // parse a duration in msec and convert to duration in frames - static void parseDurationReal( INI *ini, void *instance, void *store, const void* userData ); - // parse a duration in msec and convert to duration in integral number of frames, (unsignedint) rounding UP - static void parseDurationUnsignedInt( INI *ini, void *instance, void *store, const void* userData ); - static void parseDurationUnsignedShort( INI *ini, void *instance, void *store, const void *userData ); - // parse acceleration in (dist/sec) and convert to (dist/frame) - static void parseVelocityReal( INI *ini, void *instance, void *store, const void* userData ); - // parse acceleration in (dist/sec^2) and convert to (dist/frame^2) - static void parseAccelerationReal( INI *ini, void *instance, void *store, const void* userData ); - // parse angle in degrees and convert to radians - static void parseAngleReal( INI *ini, void *instance, void *store, const void *userData ); - // note that this parses in degrees/sec, and converts to rads/frame! - static void parseAngularVelocityReal( INI *ini, void *instance, void *store, const void *userData ); - static void parseDamageTypeFlags(INI* ini, void* instance, void* store, const void* userData); - static void parseDeathTypeFlags(INI* ini, void* instance, void* store, const void* userData); - static void parseVeterancyLevelFlags(INI* ini, void* instance, void* store, const void* userData); - static void parseSoundsList( INI* ini, void *instance, void *store, const void* /*userData*/ ); - - - /** - return the next token. if seps is null (or omitted), the standard seps are used. - - this will *never* return null; if there are no more tokens, an exception will be thrown. - */ - const char* getNextToken(const char* seps = nullptr); - - /** - just like getNextToken(), except that null is returned if no more tokens are present - (rather than throwing an exception). usually you should call getNextToken(), - but for some cases this is handier (ie, parsing a variable-length number of tokens). - */ - const char* getNextTokenOrNull(const char* seps = nullptr); - - /** - This is called when the next thing you expect is something like: - - Tag:value - - pass "Tag" (without the colon) for 'expected', and you will have the 'value' - token returned. - - If "Tag" is not the next token, an error is thrown. - */ - const char* getNextSubToken(const char* expected); - - /** - return the next ascii string. this is usually the same the result of getNextToken(), - except that it allows for quote-delimited strings (eg, "foo bar"), so you can - get strings with spaces, and/or empty strings. - */ - AsciiString getNextAsciiString(); - AsciiString getNextQuotedAsciiString(); //fixed version of above. We can't fix the regular one for fear of breaking existing code. :-( - - /** - utility routine that does a sscanf() on the string to get the Science, and throws - an exception if not of the right form. - */ - static ScienceType scanScience(const char* token); - - /** - utility routine that does a sscanf() on the string to get the int, and throws - an exception if not of the right form. - */ - static Int scanInt(const char* token); - - /** - utility routine that does a sscanf() on the string to get the unsigned int, and throws - an exception if not of the right form. - */ - static UnsignedInt scanUnsignedInt(const char* token); - - /** - utility routine that does a sscanf() on the string to get the real, and throws - an exception if not of the right form. - */ - static Real scanReal(const char* token); - static Real scanPercentToReal(const char* token); - - static Int scanIndexList(const char* token, ConstCharPtrArray nameList); - static Int scanLookupList(const char* token, ConstLookupListRecArray lookupList); - - static Bool scanBool(const char* token); - -protected: - - static Bool isValidINIFilename( const char *filename ); ///< is this a valid .ini filename - - void prepFile( AsciiString filename, INILoadType loadType ); - void unPrepFile(); - - void readLine( void ); - - char* m_readBuffer; ///< internal read buffer - unsigned m_readBufferNext; ///< next char in read buffer - unsigned m_readBufferUsed; ///< number of bytes in read buffer - - AsciiString m_filename; ///< filename of file currently loading - INILoadType m_loadType; ///< load time for current file - UnsignedInt m_lineNum; ///< current line number that's been read - char m_buffer[ INI_MAX_CHARS_PER_LINE+1 ];///< buffer to read file contents into - const char *m_seps; ///< for strtok parsing - const char *m_sepsPercent; ///< m_seps with percent delimiter as well - const char *m_sepsColon; ///< m_seps with colon delimiter as well - const char *m_sepsQuote; ///< token to represent a quoted ascii string - const char *m_blockEndToken; ///< token to represent end of data block - Bool m_endOfFile; ///< TRUE when we've hit EOF -#ifdef DEBUG_CRASHING - char m_curBlockStart[ INI_MAX_CHARS_PER_LINE+1 ]; ///< first line of cur block -#endif -}; diff --git a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h b/Generals/Code/GameEngine/Include/Common/STLTypedefs.h deleted file mode 100644 index 484b3f33e80..00000000000 --- a/Generals/Code/GameEngine/Include/Common/STLTypedefs.h +++ /dev/null @@ -1,297 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: STLTypedefs.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: STLTypedefs.h -// -// Created: John McDonald -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#pragma once - -//----------------------------------------------------------------------------- -// srj sez: this must come first, first, first. -#define _STLP_USE_NEWALLOC 1 -//#define _STLP_USE_CUSTOM_NEWALLOC STLSpecialAlloc -class STLSpecialAlloc; - -//----------------------------------------------------------------------------- -#include "Common/AsciiString.h" -#include "Common/UnicodeString.h" -#include "Common/GameCommon.h" -#include "Common/GameMemory.h" - -//----------------------------------------------------------------------------- - - -// FORWARD DECLARATIONS -class Object; -enum NameKeyType CPP_11(: Int); -enum ObjectID CPP_11(: Int); -enum DrawableID CPP_11(: Int); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// List of AsciiStrings to allow list of ThingTemplate names from INI and such -typedef std::list< AsciiString > AsciiStringList; -typedef std::list< AsciiString >::iterator AsciiStringListIterator; -typedef std::list< AsciiString >::const_iterator AsciiStringListConstIterator; - -// One is used in GameLogic to keep track of objects to be destroyed -typedef std::list ObjectPointerList; -typedef std::list::iterator ObjectPointerListIterator; - -typedef std::vector ObjectIDVector; -typedef std::vector::iterator ObjectIDVectorIterator; - -// Terribly useful, especially with Bezier curves -typedef std::vector VecCoord3D; -typedef VecCoord3D::iterator VecCoord3DIt; - -// Used for cursor->3D position request caching in the heightmap -typedef std::pair PosRequest; -typedef std::vector VecPosRequests; -typedef std::vector::iterator VecPosRequestsIt; - -// Used to cache off names of objects for faster lookup -typedef std::pair NamedRequest; -typedef std::vector VecNamedRequests; -typedef std::vector::iterator VecNamedRequestsIt; - -// Rumor has it that a Vector of Bools gets stored as a bitfield internally. -typedef std::vector BoolVector; -typedef std::vector::iterator BoolVectorIterator; - -typedef std::map< NameKeyType, Real, std::less > ProductionChangeMap; -typedef std::map< NameKeyType, VeterancyLevel, std::less > ProductionVeterancyMap; - -// Some useful, common hash and equal_to functors for use with hash_map -namespace rts -{ - - // Generic hash functor. This should almost always be overridden for - // specific types. - template struct hash - { - size_t operator()(const T& __t) const - { - std::hash tmp; - return tmp(__t); - } - }; - - // Generic equal_to functor. This should be overridden if there is no - // operator==, or if that isn't the behavior desired. (For instance, in - // the case of pointers.) - template struct equal_to - { - Bool operator()(const T& __t1, const T& __t2) const - { - return (__t1 == __t2); - } - }; - - // Generic less_than_nocase functor. This should be overridden if there is no - // operator<, or if that isn't the behavior desired. (For instance, in - // the case of pointers, or strings.) - template struct less_than_nocase - { - bool operator()(const T& __t1, const T& __t2) const - { - return (__t1 < __t2); - } - }; - - template<> struct hash - { - size_t operator()(NameKeyType nkt) const - { - std::hash tmp; - return tmp((UnsignedInt)nkt); - } - }; - - template<> struct hash - { - size_t operator()(DrawableID nkt) const - { - std::hash tmp; - return tmp((UnsignedInt)nkt); - } - }; - - template<> struct hash - { - size_t operator()(ObjectID nkt) const - { - std::hash tmp; - return tmp((UnsignedInt)nkt); - } - }; - - template<> struct hash - { - size_t operator()(const Char* s) const - { -#ifdef USING_STLPORT - std::hash hasher; - return hasher(s); -#else - std::hash hasher; - return hasher(s); -#endif - } - }; - - // This is the equal_to overload for char* comparisons. We compare the - // strings to determine whether they are equal or not. - // Other overloads should go into specific header files, not here (unless - // they are to be used in lots of places.) - template<> struct equal_to - { - Bool operator()(const char* s1, const char* s2) const - { - return strcmp(s1, s2) == 0; - } - }; - - template<> struct hash - { - size_t operator()(const AsciiString& ast) const - { -#ifdef USING_STLPORT - std::hash tmp; - return tmp((const char *) ast.str()); -#else - // TheSuperHackers @bugfix xezon 16/03/2024 Re-implements hash function that works with non-STLPort. - std::hash hasher; - return hasher(std::string_view(ast.str(), ast.getLength())); -#endif - } - }; - - template<> struct equal_to - { - Bool operator()(const AsciiString& __t1, const AsciiString& __t2) const - { - return (__t1 == __t2); - } - }; - - template<> struct less_than_nocase - { - bool operator()(const AsciiString& __t1, const AsciiString& __t2) const - { - return (__t1.compareNoCase(__t2) < 0); - } - }; - - template<> struct less_than_nocase - { - bool operator()(const UnicodeString& __t1, const UnicodeString& __t2) const - { - return (__t1.compareNoCase(__t2) < 0); - } - }; - - // TheSuperHackers @info Structs to help create maps that can use C strings for - // lookups without the need to allocate a string. - template - struct string_key - { - typedef typename String::const_pointer const_pointer; - - static string_key temporary(const_pointer s) - { - string_key key; - key.cstr = s; - return key; - } - - string_key(const_pointer s) - : storage(s) - , cstr(storage.str()) - {} - - string_key(const String& s) - : storage(s) - , cstr(storage.str()) - {} - - const_pointer c_str() const - { - return cstr; - } - - private: - string_key() {} - - String storage; - const_pointer cstr; - }; - - template - struct string_key_hash - { - typedef typename String::const_pointer const_pointer; - size_t operator()(const string_key& key) const - { - return hash()(key.c_str()); - } - }; - - template - struct string_key_equal - { - bool operator()(const string_key& a, const string_key& b) const - { - return strcmp(a.c_str(), b.c_str()) == 0; - } - }; - -} // namespace rts diff --git a/Generals/Code/GameEngine/Include/Common/Snapshot.h b/Generals/Code/GameEngine/Include/Common/Snapshot.h deleted file mode 100644 index e8a3ef7434c..00000000000 --- a/Generals/Code/GameEngine/Include/Common/Snapshot.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Snapshot.h /////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, February 2002 -// Desc: The Snapshot object is the base class interface for data structures that will -// be considered during game saves, loads, and CRC checks. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "Common/AsciiString.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Xfer; - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -class Snapshot -{ - -friend class GameState; -friend class XferLoad; -friend class XferSave; -friend class XferCRC; - -public: - - Snapshot( void ); - ~Snapshot( void ); - -protected: - - /// run the "light" crc check on this data structure - virtual void crc( Xfer *xfer ) = 0; - - /** run save, load, or deep CRC check on this data structure, the type depends on the - setup of the Xfer pointer */ - virtual void xfer( Xfer *xfer ) = 0; - - /** post process phase for loading save games. All save systems have their xfer - run using XferLoad mode, and then all systems each have their post process run */ - virtual void loadPostProcess( void ) = 0; - -}; diff --git a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h b/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h deleted file mode 100644 index c30e6f663c2..00000000000 --- a/Generals/Code/GameEngine/Include/Common/SubsystemInterface.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: SubsystemInterface.h ///////////////////////////////////////////////////////////////////// -// Author: Colin Day, October 2001 -// Description: Framework for subsystems singletons of the game engine -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/INI.h" -#include "Common/STLTypedefs.h" - -class Xfer; - -//------------------------------------------------------------------------------------------------- -/** This is the abstract base class from which all game engine subsystems should derive from. - * In order to provide consistent behaviors across all these systems, any implementation - * must obey the rules defined in here - * - * Nothing about the subsystems is automatic, this interface does not wrap up automated - * functions, it is only here to provide a basic interface and rules for behavior - * all subsystems - */ -class SubsystemInterface -{ - -public: - - //----------------------------------------------------------------------------------------------- - /** - Constructors should initialize any data to a valid state. That DOES NOT mean - * the data has default values (something done in the init() method), only that - * nothing is left pointing to garbage, un-initialized memory. In most cases - * this probably means just setting members to zero or nullptr. - */ - SubsystemInterface(); - - //----------------------------------------------------------------------------------------------- - /** - Free any resources allocated for this class. - * - * - DO NOT throw exceptions during any destruction ever, and do not call other - * methods that have the possibility of throwing exceptions. Try to keep it - * simple and keep as much work actually inside the destructor as possible. - */ - virtual ~SubsystemInterface(); - - //----------------------------------------------------------------------------------------------- - /** - Assign any default values to data required for the class - * - * - Allocate any memory and resources needed throughout the lifetime of the class - */ - virtual void init() = 0; - - //----------------------------------------------------------------------------------------------- - /** - Called for all subsystems after all other Subsystems are inited. - * (allows for initializing inter-system dependencies) - */ - virtual void postProcessLoad() { } - - //----------------------------------------------------------------------------------------------- - /** - Any system should be able to reset all data and go back to an empty state - * that is ready to accept a completely new set of data. Reset() can expect - * to be used in the context of resetting the engine in order to start or - * load a new game. - * - * - Do NOT free and re-allocate resources needed, where possible reorganize and - * re-initialize the resources already allocated. - * - * - After a reset, the system does not need to be in EXACTLY the same state as a - * fresh instantiation. If there are persistent state information for the - * system make sure you maintain it while restoring or re-initializing other - * transient parts. - */ - virtual void reset() = 0; - - //----------------------------------------------------------------------------------------------- - /** - Update methods are the place to do system per frame processing. You - * should call the system update once each time through the game loop - * to service the system. - * - * - Note that currently the GameClient and GameLogic will be updating - * at different rates where the logic is running real time, and the - * client will adjust how many loops can be done during one server - * time slice in order to improve performance on low end machines. - */ - virtual void update() = 0; - - - virtual void draw( void ){DEBUG_CRASH(("Shouldn't call base class. jba."));} - -#ifdef DUMP_PERF_STATS - void UPDATE(void); - void DRAW(void); - Real getUpdateTime(void) {return m_curUpdateTime;} - Real getDrawTime(void) {return m_curDrawTime;} - Bool doDumpUpdate(void) {return m_dumpUpdate;} - Bool doDumpDraw(void) {return m_dumpDraw;} - static Real getTotalTime(void) {return s_msConsumed;} - static void clearTotalTime(void) {s_msConsumed = 0;} -protected: - static Real s_msConsumed; - Real m_startTimeConsumed; - Real m_curUpdateTime; - - Real m_startDrawTimeConsumed; - Real m_curDrawTime; - Bool m_dumpUpdate; - Bool m_dumpDraw; -#else - void UPDATE(void) {update();} - void DRAW(void) {draw();} -#endif -protected: - AsciiString m_name; -public: - AsciiString getName(void) {return m_name;} - void setName(AsciiString name) {m_name = name;} - -}; - -//------------------------------------------------------------------------------------------------- -class SubsystemInterfaceList -{ -public: - - SubsystemInterfaceList(); - ~SubsystemInterfaceList(); - - void initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name=""); - void addSubsystem(SubsystemInterface* sys); - void removeSubsystem(SubsystemInterface* sys); - void postProcessLoadAll(); - void resetAll(); - void shutdownAll(); -#ifdef DUMP_PERF_STATS - AsciiString dumpTimesForAll(); -#endif - -private: - - typedef std::vector SubsystemList; - SubsystemList m_subsystems; - SubsystemList m_allSubsystems; - -}; - -extern SubsystemInterfaceList* TheSubsystemList; diff --git a/Generals/Code/GameEngine/Include/Common/ThingSort.h b/Generals/Code/GameEngine/Include/Common/ThingSort.h index 1accc3dd499..93cdf8cfd4f 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingSort.h +++ b/Generals/Code/GameEngine/Include/Common/ThingSort.h @@ -29,7 +29,7 @@ #pragma once -#include "GameCommon.h" +#include "Common/GameCommon.h" //------------------------------------------------------------------------------------------------- enum EditorSortingType CPP_11(: Int) diff --git a/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h b/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h deleted file mode 100644 index 09d9ba2ebb7..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ChallengeGenerals.h +++ /dev/null @@ -1,155 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ChallengeGenerals.h ////////////////////////////////////////////////////////////////////// -// Author: Steve Copeland, 6/24/2003 -// Desc: This is a manager for data pertaining to the Generals' Challenge personas and related GUI. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "Common/GameType.h" -#include "Common/INI.h" -#include "Common/Overridable.h" - -// DEFINES //////////////////////////////////////////////////////////////////////////////////////// -//static const Int NUM_GENERALS = 12; // ChallengeMenu.wnd dependent -#define NUM_GENERALS (12) - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Image; - -// CLASS DEFINITIONS ////////////////////////////////////////////////////////////////////////////// -class GeneralPersona -{ - friend class ChallengeGenerals; - -private: - Bool m_bStartsEnabled; - AsciiString m_strBioName; - AsciiString m_strBioDOB; - AsciiString m_strBioBirthplace; - AsciiString m_strBioStrategy; - AsciiString m_strBioRank; - AsciiString m_strBioBranch; - AsciiString m_strBioClassNumber; - Image *m_imageBioPortraitSmall; - Image *m_imageBioPortraitLarge; - AsciiString m_strCampaign; - AsciiString m_strPlayerTemplateName; - AsciiString m_strPortraitMovieLeftName; - AsciiString m_strPortraitMovieRightName; - Image *m_imageDefeated; - Image *m_imageVictorious; - AsciiString m_strDefeated; - AsciiString m_strVictorious; - AsciiString m_strSelectionSound; - AsciiString m_strTauntSound1; - AsciiString m_strTauntSound2; - AsciiString m_strTauntSound3; - AsciiString m_strWinSound; - AsciiString m_strLossSound; - AsciiString m_strPreviewSound; - AsciiString m_strNameSound ; - - -public: - GeneralPersona( void ) : - m_imageBioPortraitSmall(nullptr), - m_imageBioPortraitLarge(nullptr) - { - } -// ~GeneralPersona( void ); - - Bool isStartingEnabled() const { return m_bStartsEnabled; } - const AsciiString& getBioName() const { return m_strBioName; } - const AsciiString& getBioDOB() const { return m_strBioDOB; } - const AsciiString& getBioBirthplace() const { return m_strBioBirthplace; } - const AsciiString& getBioStrategy() const { return m_strBioStrategy; } - const AsciiString& getBioRank() const { return m_strBioRank; } - const AsciiString& getBioClassNumber() const { return m_strBioClassNumber; } - const AsciiString& getBioBranch() const { return m_strBioBranch; } - const Image *getBioPortraitSmall() const { return m_imageBioPortraitSmall; } - const Image *getBioPortraitLarge() const { return m_imageBioPortraitLarge; } - const AsciiString& getPortraitMovieLeftName() const { return m_strPortraitMovieLeftName; } - const AsciiString& getPortraitMovieRightName() const { return m_strPortraitMovieRightName; } - const AsciiString& getCampaign() const { return m_strCampaign; } - const AsciiString& getPlayerTemplateName() const { return m_strPlayerTemplateName; } // template name, as parsed in from ini - const Image *getImageDefeated() const { return m_imageDefeated; } - const Image *getImageVictorious() const { return m_imageVictorious; } - const AsciiString& getStringDefeated() const { return m_strDefeated; } - const AsciiString& getStringVictorious() const { return m_strVictorious; } - const AsciiString& getSelectionSound() const { return m_strSelectionSound; } - const AsciiString& getRandomTauntSound() const { - switch (rand()%3) // don't care about distribution or exactly how random this is - { - case 0: return m_strTauntSound1; - case 1: return m_strTauntSound2; - } - return m_strTauntSound3; - } - const AsciiString& getWinSound() const { return m_strWinSound; } - const AsciiString& getLossSound() const { return m_strLossSound; } - const AsciiString& getPreviewSound() const { return m_strPreviewSound; } - const AsciiString& getNameSound() const { return m_strNameSound; } -}; - - -class ChallengeGenerals -{ - -private: - /*const*/ GeneralPersona m_position[ NUM_GENERALS ]; - Int m_PlayerTemplateNum; // the template number as ThePlayerTemplateStore has it - GameDifficulty m_currentDifficulty; // the last selected game difficulty for the challenge generals - - static void parseGeneralPersona( INI* ini, void *instance, void *store, const void *userData ); - -public: - ChallengeGenerals( void ); - ~ChallengeGenerals( void ); - - void init( void ); - const GeneralPersona* getChallengeGenerals() const { return m_position; } - const FieldParse* getFieldParse( void ) const { return s_fieldParseTable; } // for INI file parsing - const GeneralPersona* getPlayerGeneralByCampaignName( AsciiString name ) const; - const GeneralPersona* getGeneralByGeneralName( AsciiString name ) const; - const GeneralPersona* getGeneralByTemplateName( AsciiString name ) const; - - void setCurrentPlayerTemplateNum( Int playerTemplateNum) { m_PlayerTemplateNum = playerTemplateNum; } - Int getCurrentPlayerTemplateNum( void ) { return m_PlayerTemplateNum; } - - void setCurrentDifficulty( GameDifficulty diff ) { m_currentDifficulty = diff; } - GameDifficulty getCurrentDifficulty( void ) { return m_currentDifficulty; } -protected: - static const FieldParse s_fieldParseTable[]; - -}; - - - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern ChallengeGenerals *TheChallengeGenerals; -extern ChallengeGenerals *createChallengeGenerals( void ); diff --git a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp b/Generals/Code/GameEngine/Source/Common/INI/INI.cpp deleted file mode 100644 index 1d941426b5f..00000000000 --- a/Generals/Code/GameEngine/Source/Common/INI/INI.cpp +++ /dev/null @@ -1,2000 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: INI.cpp ////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, November 2001 -// Desc: INI Reader -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_DEATH_NAMES - -#include "Common/INI.h" -#include "Common/INIException.h" - -#include "Common/DamageFX.h" -#include "Common/file.h" -#include "Common/FileSystem.h" -#include "Common/GameAudio.h" -#include "Common/Science.h" -#include "Common/SpecialPower.h" -#include "Common/ThingFactory.h" -#include "Common/ThingTemplate.h" -#include "Common/Upgrade.h" -#include "Common/Xfer.h" -#include "Common/XferCRC.h" - -#include "GameClient/Anim2D.h" -#include "GameClient/Color.h" -#include "GameClient/FXList.h" -#include "GameClient/GameText.h" -#include "GameClient/Image.h" -#include "GameClient/ParticleSys.h" -#include "GameLogic/Armor.h" -#include "GameLogic/ExperienceTracker.h" -#include "GameLogic/FPUControl.h" -#include "GameLogic/ObjectCreationList.h" -#include "GameLogic/ScriptEngine.h" -#include "GameLogic/Weapon.h" - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -static Xfer *s_xfer = nullptr; - -//------------------------------------------------------------------------------------------------- -/** This is the table of data types we can have in INI files. To add a new data type - * block make a new entry in this table and add an appropriate parsing function */ -//------------------------------------------------------------------------------------------------- -extern void parseReallyLowMHz( INI* ini); // yeah, so sue me (srj) -struct BlockParse -{ - const char *token; - INIBlockParse parse; -}; -static const BlockParse theTypeTable[] = -{ - { "AIData", INI::parseAIDataDefinition }, - { "Animation", INI::parseAnim2DDefinition }, - { "Armor", INI::parseArmorDefinition }, - { "AudioEvent", INI::parseAudioEventDefinition }, - { "AudioSettings", INI::parseAudioSettingsDefinition }, - { "Bridge", INI::parseTerrainBridgeDefinition }, - { "Campaign", INI::parseCampaignDefinition }, - { "ChallengeGenerals", INI::parseChallengeModeDefinition }, - { "CommandButton", INI::parseCommandButtonDefinition }, - { "CommandMap", INI::parseMetaMapDefinition }, - { "CommandSet", INI::parseCommandSetDefinition }, - { "ControlBarScheme", INI::parseControlBarSchemeDefinition }, - { "ControlBarResizer", INI::parseControlBarResizerDefinition }, - { "CrateData", INI::parseCrateTemplateDefinition }, - { "Credits", INI::parseCredits}, - { "WindowTransition", INI::parseWindowTransitions}, - { "DamageFX", INI::parseDamageFXDefinition }, - { "DialogEvent", INI::parseDialogDefinition }, - { "DrawGroupInfo", INI::parseDrawGroupNumberDefinition }, - { "EvaEvent", INI::parseEvaEvent }, - { "FXList", INI::parseFXListDefinition }, - { "GameData", INI::parseGameDataDefinition }, - { "InGameUI", INI::parseInGameUIDefinition }, - { "Locomotor", INI::parseLocomotorTemplateDefinition }, - { "Language", INI::parseLanguageDefinition }, - { "MapCache", INI::parseMapCacheDefinition }, - { "MapData", INI::parseMapDataDefinition }, - { "MappedImage", INI::parseMappedImageDefinition }, - { "MiscAudio", INI::parseMiscAudio}, - { "Mouse", INI::parseMouseDefinition }, - { "MouseCursor", INI::parseMouseCursorDefinition }, - { "MultiplayerColor", INI::parseMultiplayerColorDefinition }, - { "MultiplayerStartingMoneyChoice", INI::parseMultiplayerStartingMoneyChoiceDefinition }, - { "OnlineChatColors", INI::parseOnlineChatColorDefinition }, - { "MultiplayerSettings",INI::parseMultiplayerSettingsDefinition }, - { "MusicTrack", INI::parseMusicTrackDefinition }, - { "Object", INI::parseObjectDefinition }, - { "ObjectCreationList", INI::parseObjectCreationListDefinition }, - { "ObjectReskin", INI::parseObjectReskinDefinition }, - { "ParticleSystem", INI::parseParticleSystemDefinition }, - { "PlayerTemplate", INI::parsePlayerTemplateDefinition }, - { "Road", INI::parseTerrainRoadDefinition }, - { "Science", INI::parseScienceDefinition }, - { "Rank", INI::parseRankDefinition }, - { "SpecialPower", INI::parseSpecialPowerDefinition }, - { "ShellMenuScheme", INI::parseShellMenuSchemeDefinition }, - { "Terrain", INI::parseTerrainDefinition }, - { "Upgrade", INI::parseUpgradeDefinition }, - { "Video", INI::parseVideoDefinition }, - { "WaterSet", INI::parseWaterSettingDefinition }, - { "WaterTransparency", INI::parseWaterTransparencyDefinition}, - { "Weather", INI::parseWeatherDefinition}, - { "Weapon", INI::parseWeaponTemplateDefinition }, - { "WebpageURL", INI::parseWebpageURLDefinition }, - { "HeaderTemplate", INI::parseHeaderTemplateDefinition }, - { "StaticGameLOD", INI::parseStaticGameLODDefinition }, - { "DynamicGameLOD", INI::parseDynamicGameLODDefinition }, - { "LODPreset", INI::parseLODPreset }, - { "BenchProfile", INI::parseBenchProfile }, - { "ReallyLowMHz", parseReallyLowMHz }, - { "ScriptAction", ScriptEngine::parseScriptAction }, - { "ScriptCondition", ScriptEngine::parseScriptCondition }, - - { nullptr, nullptr }, -}; - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -Bool INI::isValidINIFilename( const char *filename ) -{ - if( filename == nullptr ) - return FALSE; - - Int len = strlen( filename ); - if( len < 3 ) - return FALSE; - - if( filename[ len - 1 ] != 'I' && filename[ len - 1 ] != 'i' ) - return FALSE; - - if( filename[ len - 2 ] != 'N' && filename[ len - 2 ] != 'n' ) - return FALSE; - - if( filename[ len - 3 ] != 'I' && filename[ len - 3 ] != 'i' ) - return FALSE; - - return TRUE; - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -INI::INI( void ) -{ - - m_readBuffer = nullptr; - m_readBufferNext = 0; - m_readBufferUsed = 0; - m_filename = "None"; - m_loadType = INI_LOAD_INVALID; - m_lineNum = 0; - m_seps = " \n\r\t="; ///< make sure you update m_sepsPercent/m_sepsColon as well - m_sepsPercent = " \n\r\t=%%"; - m_sepsColon = " \n\r\t=:"; - m_sepsQuote = "\"\n="; ///< stop at " = EOL - m_blockEndToken = "END"; - m_endOfFile = FALSE; - m_buffer[0] = 0; -#ifdef DEBUG_CRASHING - m_curBlockStart[0] = 0; -#endif - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -INI::~INI( void ) -{ - -} - -//------------------------------------------------------------------------------------------------- -UnsignedInt INI::loadFileDirectory( AsciiString fileDirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) -{ - UnsignedInt filesRead = 0; - - AsciiString iniDir = fileDirName; - AsciiString iniFile = fileDirName; - - char ext[] = ".ini"; - - if (iniDir.endsWithNoCase(ext)) - { - iniDir.truncateBy(ARRAY_SIZE(ext)-1); - } - - if (!iniFile.endsWithNoCase(ext)) - { - iniFile.concat(ext); - } - - if (TheFileSystem->doesFileExist(iniFile.str())) - { - filesRead += load(iniFile, loadType, pXfer); - } - - // Load any additional ini files from a "filename" directory and its subdirectories. - filesRead += loadDirectory(iniDir, loadType, pXfer, subdirs); - - // Expect to open and load at least one file. - if (filesRead == 0) - { - throw INI_CANT_OPEN_FILE; - } - - return filesRead; -} - -//------------------------------------------------------------------------------------------------- -/** Load all INI files in the specified directory (and subdirectories if indicated). - * If we are to load subdirectories, we will load them *after* we load all the - * files in the current directory */ -//------------------------------------------------------------------------------------------------- -UnsignedInt INI::loadDirectory( AsciiString dirName, INILoadType loadType, Xfer *pXfer, Bool subdirs ) -{ - UnsignedInt filesRead = 0; - - // sanity - if( dirName.isEmpty() ) - throw INI_INVALID_DIRECTORY; - - try - { - FilenameList filenameList; - dirName.concat('\\'); - TheFileSystem->getFileListInDirectory(dirName, "*.ini", filenameList, subdirs); - // Load the INI files in the dir now, in a sorted order. This keeps things the same between machines - // in a network game. - FilenameList::const_iterator it = filenameList.begin(); - while (it != filenameList.end()) - { - AsciiString tempname; - tempname = (*it).str() + dirName.getLength(); - - if ((tempname.find('\\') == nullptr) && (tempname.find('/') == nullptr)) { - // this file doesn't reside in a subdirectory, load it first. - filesRead += load( *it, loadType, pXfer ); - } - ++it; - } - - it = filenameList.begin(); - while (it != filenameList.end()) - { - AsciiString tempname; - tempname = (*it).str() + dirName.getLength(); - - if ((tempname.find('\\') != nullptr) || (tempname.find('/') != nullptr)) { - filesRead += load( *it, loadType, pXfer ); - } - ++it; - } - } - catch (...) - { - // propagate the exception - throw; - } - - return filesRead; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::prepFile( AsciiString filename, INILoadType loadType ) -{ - // if we have a file open already -- we can't do another one - if( m_readBuffer != nullptr ) - { - - DEBUG_CRASH(( "INI::load, cannot open file '%s', file already open", filename.str() )); - throw INI_FILE_ALREADY_OPEN; - - } - - // open the file - File* file = TheFileSystem->openFile(filename.str(), File::READ); - if( file == nullptr ) - { - - DEBUG_CRASH(( "INI::load, cannot open file '%s'", filename.str() )); - throw INI_CANT_OPEN_FILE; - - } - - m_readBufferNext = 0; - m_readBufferUsed = file->size(); - m_readBuffer = file->readEntireAndClose(); - - // save our filename - m_filename = filename; - - // save our load type - m_loadType = loadType; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::unPrepFile() -{ - // delete the buffer - delete[] m_readBuffer; - m_readBuffer = nullptr; - m_readBufferNext = 0; - m_readBufferUsed = 0; - - m_filename = "None"; - m_loadType = INI_LOAD_INVALID; - m_lineNum = 0; - m_endOfFile = FALSE; - s_xfer = nullptr; -} - -//------------------------------------------------------------------------------------------------- -static INIBlockParse findBlockParse(const char* token) -{ - for (const BlockParse* parse = theTypeTable; parse->token; ++parse) - { - if (strcmp( parse->token, token ) == 0) - { - return parse->parse; - } - } - return nullptr; -} - -//------------------------------------------------------------------------------------------------- -static INIFieldParseProc findFieldParse(const FieldParse* parseTable, const char* token, int& offset, const void*& userData) -{ - const FieldParse* parse = parseTable; - for (; parse->token; ++parse) - { - if (strcmp( parse->token, token ) == 0) - { - offset = parse->offset; - userData = parse->userData; - return parse->parse; - } - } - - if (!parse->token && parse->parse) - { - offset = parse->offset; - userData = token; - return parse->parse; - } - else - { - return nullptr; - } -} - -//------------------------------------------------------------------------------------------------- -/** Load and parse an INI file */ -//------------------------------------------------------------------------------------------------- -UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer ) -{ - setFPMode(); // so we have consistent Real values for GameLogic -MDC - - s_xfer = pXfer; - prepFile(filename, loadType); - - try - { - - // read all lines in the file - DEBUG_ASSERTCRASH( m_endOfFile == FALSE, ("INI::load, EOF at the beginning!") ); - while( m_endOfFile == FALSE ) - { - // read this line - readLine(); - - AsciiString currentLine = m_buffer; - - // the first word is the type of data we're processing - const char *token = strtok( m_buffer, m_seps ); - if( token ) - { - INIBlockParse parse = findBlockParse(token); - if (parse) - { - #ifdef DEBUG_CRASHING - static_assert(ARRAY_SIZE(m_curBlockStart) >= ARRAY_SIZE(m_buffer), "Incorrect array size"); - strcpy(m_curBlockStart, m_buffer); - #endif - try { - (*parse)( this ); - - } catch (...) { - DEBUG_CRASH(("Error parsing block '%s' in INI file '%s'", token, m_filename.str()) ); - char buff[1024]; - sprintf(buff, "Error parsing INI file '%s' (Line: '%s')\n", m_filename.str(), currentLine.str()); - - throw INIException(buff); - } - #ifdef DEBUG_CRASHING - strcpy(m_curBlockStart, "NO_BLOCK"); - #endif - } - else - { - DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown block '%s'", - getLineNum(), getFilename().str(), token ) ); - throw INI_UNKNOWN_TOKEN; - } - - } - - } - } - catch (...) - { - unPrepFile(); - - // propagate the exception. - throw; - } - - unPrepFile(); - - return 1; -} - -//------------------------------------------------------------------------------------------------- -/** Read a line from the already open file. Any comments will be removed and - * therefore ignored from any given line - * - * TheSuperHackers @performance xezon 18/01/2026 The file contents are now read directly from a - * full File Ram buffer into the INI Line Buffer without a third buffer in between. - */ -//------------------------------------------------------------------------------------------------- -void INI::readLine( void ) -{ - // sanity - DEBUG_ASSERTCRASH( m_readBuffer, ("readLine(), read buffer is null") ); - - if (m_endOfFile) - { - *m_buffer = 0; - } - else - { - // read up till the newline or semicolon character, or until out of space - char *p = m_buffer; - while (p != m_buffer+INI_MAX_CHARS_PER_LINE) - { - // test end of read buffer - if (m_readBufferNext==m_readBufferUsed) - { - m_endOfFile = true; - *p = 0; - break; - } - - // get next character - *p = m_readBuffer[m_readBufferNext++]; - - // check for new line - if (*p == '\n') - { - *p = 0; - break; - } - - DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d", m_filename.str(), getLineNum())); - - // if this is a semicolon, that represents the start of a comment - if (*p == ';') - { - *p = 0; - } - - // make whitespace characters actual spaces - else if (*p > 0 && *p < 32) - { - *p = ' '; - } - - p++; - } - - *p = 0; - - // increase our line count - m_lineNum++; - - // check for at the max - if ( p == m_buffer+INI_MAX_CHARS_PER_LINE ) - { - DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) ); - } - } - - if (s_xfer) - { - s_xfer->xferUser( m_buffer, sizeof( char ) * strlen( m_buffer ) ); - //DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s", ((XferCRC *)s_xfer)->getCRC(), m_filename.str(), m_buffer)); - } -} - -//------------------------------------------------------------------------------------------------- -/** Parse UnsignedByte from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseUnsignedByte( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - Int value = scanInt(token); - if (value < 0 || value > 255) - { - DEBUG_CRASH(("Bad value INI::parseUnsignedByte")); - throw ERROR_BUG; - } - *(Byte *)store = (Byte)value; -} - -//------------------------------------------------------------------------------------------------- -/** Parse signed short from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseShort( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - Int value = scanInt(token); - if (value < -32768 || value > 32767) - { - DEBUG_CRASH(("Bad value INI::parseShort")); - throw ERROR_BUG; - } - *(Short *)store = (Short)value; -} - -//------------------------------------------------------------------------------------------------- -/** Parse unsigned short from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseUnsignedShort( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - Int value = scanInt(token); - if (value < 0 || value > 65535) - { - DEBUG_CRASH(("Bad value INI::parseUnsignedShort")); - throw ERROR_BUG; - } - *(UnsignedShort *)store = (UnsignedShort)value; -} - -//------------------------------------------------------------------------------------------------- -/** Parse integer from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseInt( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - *(Int *)store = scanInt(token); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse unsigned integer from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseUnsignedInt( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - *(UnsignedInt *)store = scanUnsignedInt(token); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse real from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseReal( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - *(Real *)store = scanReal(token); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse real from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parsePositiveNonZeroReal( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - *(Real *)store = scanReal(token); - if (*(Real *)store <= 0.0f) - { - DEBUG_CRASH(("invalid Real value %f -- expected > 0",*(Real*)store)); - throw INI_INVALID_DATA; - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a degree value (0 to 360) and store the radian value of that degree - * in a Real */ -//------------------------------------------------------------------------------------------------- -void INI::parseAngleReal( INI *ini, void * /*instance*/, - void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - const Real RADS_PER_DEGREE = PI / 180.0f; - *(Real *)store = scanReal( token ) * RADS_PER_DEGREE; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an angular velocity in degrees-per-sec and store the rads-per-frame value of that degree - * in a Real */ -//------------------------------------------------------------------------------------------------- -void INI::parseAngularVelocityReal( INI *ini, void * /*instance*/, - void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - // scan the int and convert to radian and store as a real - *(Real *)store = ConvertAngularVelocityInDegreesPerSecToRadsPerFrame(scanReal( token )); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse Bool from buffer and assign at location 'store'. The buffer token must - * be in the form of a string "Yes" or "No" (case is ignored) */ -//------------------------------------------------------------------------------------------------- -void INI::parseBool( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - *(Bool*)store = INI::scanBool(ini->getNextToken()); -} - -//------------------------------------------------------------------------------------------------- -/** Parse Bool from buffer; if true, or in MASK, otherwise and out MASK. The buffer token must - * be in the form of a string "Yes" or "No" (case is ignored) */ -//------------------------------------------------------------------------------------------------- -void INI::parseBitInInt32( INI *ini, void *instance, void *store, const void* userData ) -{ - UnsignedInt* s = (UnsignedInt*)store; - UnsignedInt mask = (UnsignedInt)userData; - - if (INI::scanBool(ini->getNextToken())) - *s |= mask; - else - *s &= ~mask; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -/*static*/ Bool INI::scanBool(const char* token) -{ - // translate string yes/no into TRUE/FALSE - if( stricmp( token, "yes" ) == 0 ) - return TRUE; - else if( stricmp( token, "no" ) == 0 ) - return FALSE; - else - { - DEBUG_CRASH(("invalid boolean token %s -- expected Yes or No",token)); - throw INI_INVALID_DATA; - return false; // keep compiler happy - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an *ASCII* string from buffer and assign at location 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseAsciiString( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - AsciiString* asciiString = (AsciiString *)store; - *asciiString = ini->getNextAsciiString(); -} - -//------------------------------------------------------------------------------------------------- -/** Parse an *ASCII* string from buffer and assign at location 'store'. Has better support for quoted strings. -We don't really need this function, but parseString() is broken and we want to leave it broken to -maintain existing code. - */ -//------------------------------------------------------------------------------------------------- -void INI::parseQuotedAsciiString( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - AsciiString* asciiString = (AsciiString *)store; - *asciiString = ini->getNextQuotedAsciiString(); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseAsciiStringVector( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - std::vector* asv = (std::vector*)store; - asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) - { - asv->push_back(token); - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - std::vector* asv = (std::vector*)store; - // nope, don't clear. duh. - // asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) - { - asv->push_back(token); - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -/* static */void INI::parseScienceVector( INI *ini, void * /*instance*/, void *store, const void *userData ) -{ - ScienceVec* asv = (ScienceVec*)store; - asv->clear(); - for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) - { - if (stricmp(token, "None") == 0) - { - asv->clear(); - return; - } - asv->push_back(INI::scanScience( token )); - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -AsciiString INI::getNextQuotedAsciiString() -{ - AsciiString result; - char buff[INI_MAX_CHARS_PER_LINE]; - buff[0] = '\0'; - - const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != nullptr) - { - if (token[0] != '\"') - { - // if token is simply " - result.set( token ); // Start following the " - } - else - { int strLen=0; - Bool done=FALSE; - if ((strLen=strlen(token)) > 1) - { - strlcpy(buff, &token[1], ARRAY_SIZE(buff)); //skip the starting quote - //Check for end of quoted string. Checking here fixes cases where quoted string on same line with other data. - if (buff[strLen-2]=='"') //skip ending quote if present - { buff[strLen-2]='\0'; - done=TRUE; - } - } - - if (!done) - { - token = getNextToken(getSepsQuote()); - - if (strlen(token) > 1 && token[1] != '\t') - { - strlcat(buff, " ", ARRAY_SIZE(buff)); - strlcat(buff, token, ARRAY_SIZE(buff)); - } - else - { Int buflen=strlen(buff); - if (buff[buflen-1]=='\"') - buff[buflen-1]='\0'; - } - } - result.set(buff); - } - } - return result; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -AsciiString INI::getNextAsciiString() -{ - AsciiString result; - - const char *token = getNextTokenOrNull(); // if null, just leave an empty string - if (token != nullptr) - { - if (token[0] != '\"') - { - // if token is simply " - result.set( token ); // Start following the " - } - else - { - static char buff[INI_MAX_CHARS_PER_LINE]; - buff[0] = 0; - if (strlen(token) > 1) - { - strlcpy(buff, &token[1], ARRAY_SIZE(buff)); - } - - token = getNextTokenOrNull(getSepsQuote()); - if (token) { - if (strlen(token) > 1 && token[1] != '\t') - { - strlcat(buff, " ", ARRAY_SIZE(buff)); - } - strlcat(buff, token, ARRAY_SIZE(buff)); - result.set(buff); - } else { - Int len = strlen(buff); - if (len && buff[len-1] == '"') { // strip off trailing quote jba. [2/12/2003] - buff[len-1] = 0; - } - result.set(buff); - } - } - } - return result; -} - -//------------------------------------------------------------------------------------------------- -/** Parse a string label, get the *translated* actual text from the label and store - * into a *UNICODE* string. */ -//------------------------------------------------------------------------------------------------- -void INI::parseAndTranslateLabel( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - // translate - UnicodeString translated = TheGameText->fetch( token ); - if( translated.isEmpty() ) - throw INI_INVALID_DATA; - - // save the translated text - UnicodeString *theString = (UnicodeString *)store; - theString->set( translated.str() ); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a string label assumed as an image as part of the image collection. Translate - * to an image pointer for storage */ -//------------------------------------------------------------------------------------------------- -void INI::parseMappedImage( INI *ini, void * /*instance*/, void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - if( TheMappedImageCollection ) - { - typedef const Image* ConstImagePtr; - *(ConstImagePtr*)store = TheMappedImageCollection->findImageByName( token ); - } - - //KM: If we are in the worldbuilder, we want to parse commandbuttons for informational purposes, - //but we don't care about the images -- because we never access them. In RTS/GUIEdit, they always - //exist -- and in those cases, it will never call this code anyways because it'll throw long before. - //else - // throw INI_UNKNOWN_ERROR; - -} - -// ------------------------------------------------------------------------------------------------ -/** Parse a string label assumed as a Anim2D template name. Translate that name to an - * actual template pointer for storage */ -// ------------------------------------------------------------------------------------------------ -/*static*/ void INI::parseAnim2DTemplate( INI *ini, void *instance, void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - if( TheAnim2DCollection ) - { - Anim2DTemplate **anim2DTemplate = (Anim2DTemplate **)store; - *anim2DTemplate = TheAnim2DCollection->findTemplate( AsciiString( token ) ); - } - else - { - - DEBUG_CRASH(( "INI::parseAnim2DTemplate - TheAnim2DCollection is null" )); - throw INI_UNKNOWN_ERROR; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a percent in int or real form such as "23%" or "95.4%" and assign - * to location 'store' as a number from 0.0 to 1.0 */ -//------------------------------------------------------------------------------------------------- -void INI::parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(ini->getSepsPercent()); - Real *theReal = (Real *)store; - *theReal = scanPercentToReal(token); - -} - -//------------------------------------------------------------------------------------------------- -/** 'store' points to an 32 bit unsigned integer. We will zero that integer, parse each token - * in the buffer, if the token is in the userData table of strings, we will set the - * according bit flag for it */ -//------------------------------------------------------------------------------------------------- -void INI::parseBitString8( INI* ini, void * /*instance*/, void *store, const void* userData ) -{ - UnsignedInt tmp; - INI::parseBitString32(ini, nullptr, &tmp, userData); - if (tmp & 0xffffff00) - { - DEBUG_CRASH(("Bad bitstring list INI::parseBitString8")); - throw ERROR_BUG; - } - *(Byte*)store = (Byte)tmp; -} - -//------------------------------------------------------------------------------------------------- -/** 'store' points to an 32 bit unsigned integer. We will zero that integer, parse each token - * in the buffer, if the token is in the userData table of strings, we will set the - * according bit flag for it */ -//------------------------------------------------------------------------------------------------- -void INI::parseBitString32( INI* ini, void * /*instance*/, void *store, const void* userData ) -{ - ConstCharPtrArray flagList = (ConstCharPtrArray)userData; - UnsignedInt *bits = (UnsignedInt *)store; - - if( flagList == nullptr || flagList[ 0 ] == nullptr) - { - DEBUG_ASSERTCRASH( flagList, ("INTERNAL ERROR! parseBitString32: No flag list provided!") ); - throw INI_INVALID_NAME_LIST; - } - - Bool foundNormal = false; - Bool foundAddOrSub = false; - - // loop through all tokens - for (const char *token = ini->getNextTokenOrNull(); token != nullptr; token = ini->getNextTokenOrNull()) - { - if (stricmp(token, "NONE") == 0) - { - if (foundNormal || foundAddOrSub) - { - DEBUG_CRASH(("you may not mix normal and +- ops in bitstring lists")); - throw INI_INVALID_NAME_LIST; - } - *bits = 0; - break; - } - - if (token[0] == '+') - { - if (foundNormal) - { - DEBUG_CRASH(("you may not mix normal and +- ops in bitstring lists")); - throw INI_INVALID_NAME_LIST; - } - Int bitIndex = INI::scanIndexList(token+1, flagList); // this throws if the token is not found - *bits |= (1 << bitIndex); - foundAddOrSub = true; - } - else if (token[0] == '-') - { - if (foundNormal) - { - DEBUG_CRASH(("you may not mix normal and +- ops in bitstring lists")); - throw INI_INVALID_NAME_LIST; - } - Int bitIndex = INI::scanIndexList(token+1, flagList); // this throws if the token is not found - *bits &= ~(1 << bitIndex); - foundAddOrSub = true; - } - else - { - if (foundAddOrSub) - { - DEBUG_CRASH(("you may not mix normal and +- ops in bitstring lists")); - throw INI_INVALID_NAME_LIST; - } - - if (!foundNormal) - *bits = 0; - - Int bitIndex = INI::scanIndexList(token, flagList); // this throws if the token is not found - *bits |= (1 << bitIndex); - foundNormal = true; - } - } -} - -//------------------------------------------------------------------------------------------------- -/** Parse a color in the form of - * - * RGB_COLOR = R:100 G:114 B:245 - * and store in "RGBColor" structure pointed to by 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseRGBColor( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char* names[3] = { "R", "G", "B" }; - Int colors[3]; - for( Int i = 0; i < 3; i++ ) - { - colors[i] = scanInt(ini->getNextSubToken(names[i])); - if( colors[ i ] < 0 ) - throw INI_INVALID_DATA; - if( colors[ i ] > 255 ) - throw INI_INVALID_DATA; - } - - // assign the color components to the "RGBColor" pointer at 'store' - RGBColor *theColor = (RGBColor *)store; - theColor->red = (Real)colors[ 0 ] / 255.0f; - theColor->green = (Real)colors[ 1 ] / 255.0f; - theColor->blue = (Real)colors[ 2 ] / 255.0f; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a color in the form of - * - * RGB_COLOR = R:100 G:114 B:245 [A:233] - * and store in "RGBAColorInt" structure pointed to by 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseRGBAColorInt( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char* names[4] = { "R", "G", "B", "A" }; - Int colors[4]; - for( Int i = 0; i < 4; i++ ) - { - const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == nullptr) - { - if (i < 3) - { - throw INI_INVALID_DATA; - } - else - { - // it's ok for A to be omitted. - colors[i] = 255; - } - } - else - { - // if present, the token must match. - if (stricmp(token, names[i]) != 0) - { - throw INI_INVALID_DATA; - } - colors[i] = scanInt(ini->getNextToken(ini->getSepsColon())); - } - if( colors[ i ] < 0 ) - throw INI_INVALID_DATA; - if( colors[ i ] > 255 ) - throw INI_INVALID_DATA; - } - - // - // assign the color components to the "RGBColorInt" pointer at 'store', keep - // the numbers as between 0 and 255 - // - RGBAColorInt *theColor = (RGBAColorInt *)store; - theColor->red = colors[ 0 ]; - theColor->green = colors[ 1 ]; - theColor->blue = colors[ 2 ]; - theColor->alpha = colors[ 3 ]; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a color in the form of - * - * RGB_COLOR = R:100 G:114 B:245 [A:233] - * and store in "Color" structure pointed to by 'store' */ -//------------------------------------------------------------------------------------------------- -void INI::parseColorInt( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char* names[4] = { "R", "G", "B", "A" }; - Int colors[4]; - for( Int i = 0; i < 4; i++ ) - { - const char* token = ini->getNextTokenOrNull(ini->getSepsColon()); - if (token == nullptr) - { - if (i < 3) - { - throw INI_INVALID_DATA; - } - else - { - // it's ok for A to be omitted. - colors[i] = 255; - } - } - else - { - // if present, the token must match. - if (stricmp(token, names[i]) != 0) - { - throw INI_INVALID_DATA; - } - colors[i] = scanInt(ini->getNextToken(ini->getSepsColon())); - } - if( colors[ i ] < 0 ) - throw INI_INVALID_DATA; - if( colors[ i ] > 255 ) - throw INI_INVALID_DATA; - } - - // - // assign the color components to the "Color" pointer at 'store', keep - // the numbers as between 0 and 255 - // - Color *theColor = (Color *)store; - *theColor = GameMakeColor(colors[0], colors[1], colors[2], colors[3]); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a 3D coordinate of reals in the form of: - * FIELD_NAME = X:400 Y:-214.3 Z:8.6 */ -//------------------------------------------------------------------------------------------------- -void INI::parseCoord3D( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - Coord3D *theCoord = (Coord3D *)store; - - theCoord->x = scanReal(ini->getNextSubToken("X")); - theCoord->y = scanReal(ini->getNextSubToken("Y")); - theCoord->z = scanReal(ini->getNextSubToken("Z")); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a 2D coordinate of reals in the form of: - * FIELD_NAME = X:400 Y:-214.3 */ -//------------------------------------------------------------------------------------------------- -void INI::parseCoord2D( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - Coord2D *theCoord = (Coord2D *)store; - - theCoord->x = scanReal(ini->getNextSubToken("X")); - theCoord->y = scanReal(ini->getNextSubToken("Y")); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a 2D coordinate of Ints in the form of: - * FIELD_NAME = X:400 Y:-214 */ -//------------------------------------------------------------------------------------------------- -void INI::parseICoord2D( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - ICoord2D *theCoord = (ICoord2D *)store; - - theCoord->x = scanInt(ini->getNextSubToken("X")); - theCoord->y = scanInt(ini->getNextSubToken("Y")); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an audio event and assign to the 'AudioEventRTS*' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseDynamicAudioEventRTS( INI *ini, void * /*instance*/, void *store, const void* userData ) -{ - const char *token = ini->getNextToken(); - DynamicAudioEventRTS** theSound = (DynamicAudioEventRTS**)store; - - // translate the string into a sound - if (stricmp(token, "NoSound") == 0) - { - deleteInstance(*theSound); - *theSound = nullptr; - } - else - { - if (*theSound == nullptr) - *theSound = newInstance(DynamicAudioEventRTS); - (*theSound)->m_event.setEventName(AsciiString(token)); - } - - if (*theSound) - TheAudio->getInfoForAudioEvent(&(*theSound)->m_event); -} - -//------------------------------------------------------------------------------------------------- -/** Parse an audio event and assign to the 'AudioEventRTS*' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseAudioEventRTS( INI *ini, void * /*instance*/, void *store, const void* userData ) -{ - const char *token = ini->getNextToken(); - - AudioEventRTS *theSound = (AudioEventRTS*)store; - - // translate the string into a sound - if (stricmp(token, "NoSound") != 0) { - theSound->setEventName(AsciiString(token)); - } - - TheAudio->getInfoForAudioEvent(theSound); -} - -//------------------------------------------------------------------------------------------------- -/** Parse an ThingTemplate and assign to the 'ThingTemplate *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseThingTemplate( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - if (!TheThingFactory) - { - DEBUG_CRASH(("TheThingFactory not inited yet")); - throw ERROR_BUG; - } - - typedef const ThingTemplate *ConstThingTemplatePtr; - ConstThingTemplatePtr* theThingTemplate = (ConstThingTemplatePtr*)store; - - if (stricmp(token, "None") == 0) - { - *theThingTemplate = nullptr; - } - else - { - const ThingTemplate *tt = TheThingFactory->findTemplate(token); // could be null! - DEBUG_ASSERTCRASH(tt, ("ThingTemplate %s not found!",token)); - // assign it, even if null! - *theThingTemplate = tt; - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an ArmorTemplate and assign to the 'ArmorTemplate *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseArmorTemplate( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - typedef const ArmorTemplate *ConstArmorTemplatePtr; - ConstArmorTemplatePtr* theArmorTemplate = (ConstArmorTemplatePtr*)store; - - if (stricmp(token, "None") == 0) - { - *theArmorTemplate = nullptr; - } - else - { - const ArmorTemplate *tt = TheArmorStore->findArmorTemplate(token); // could be null! - DEBUG_ASSERTCRASH(tt, ("ArmorTemplate %s not found!",token)); - // assign it, even if null! - *theArmorTemplate = tt; - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an WeaponTemplate and assign to the 'WeaponTemplate *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseWeaponTemplate( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - typedef const WeaponTemplate *ConstWeaponTemplatePtr; - ConstWeaponTemplatePtr* theWeaponTemplate = (ConstWeaponTemplatePtr*)store; - - const WeaponTemplate *tt = TheWeaponStore->findWeaponTemplate(token); // could be null! - DEBUG_ASSERTCRASH(tt || stricmp(token, "None") == 0, ("WeaponTemplate %s not found!",token)); - // assign it, even if null! - *theWeaponTemplate = tt; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an FXList and assign to the 'FXList *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseFXList( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - typedef const FXList *ConstFXListPtr; - ConstFXListPtr* theFXList = (ConstFXListPtr*)store; - - const FXList *fxl = TheFXListStore->findFXList(token); // could be null! - DEBUG_ASSERTCRASH(fxl != nullptr || stricmp(token, "None") == 0, ("FXList %s not found!",token)); - // assign it, even if null! - *theFXList = fxl; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a particle system and assign to 'ParticleSystemTemplate *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseParticleSystemTemplate( INI *ini, void * /*instance*/, void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - const ParticleSystemTemplate *pSystemT = TheParticleSystemManager->findTemplate( AsciiString( token ) ); - DEBUG_ASSERTCRASH( pSystemT || stricmp( token, "None" ) == 0, ("ParticleSystem %s not found!",token) ); - - typedef const ParticleSystemTemplate* ConstParticleSystemTemplatePtr; - ConstParticleSystemTemplatePtr* theParticleSystemTemplate = (ConstParticleSystemTemplatePtr*)store; - - *theParticleSystemTemplate = pSystemT; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an DamageFX and assign to the 'DamageFX *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseDamageFX( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - typedef const DamageFX *ConstDamageFXPtr; - ConstDamageFXPtr* theDamageFX = (ConstDamageFXPtr*)store; - - if (stricmp(token, "None") == 0) - { - *theDamageFX = nullptr; - } - else - { - const DamageFX *fxl = TheDamageFXStore->findDamageFX(token); // could be null! - DEBUG_ASSERTCRASH(fxl, ("DamageFX %s not found!",token)); - // assign it, even if null! - *theDamageFX = fxl; - } - -} - -//------------------------------------------------------------------------------------------------- -/** Parse an ObjectCreationList and assign to the 'ObjectCreationList *' at store */ -//------------------------------------------------------------------------------------------------- -void INI::parseObjectCreationList( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - typedef const ObjectCreationList *ConstObjectCreationListPtr; - ConstObjectCreationListPtr* theObjectCreationList = (ConstObjectCreationListPtr*)store; - - const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null! - DEBUG_ASSERTCRASH(ocl || stricmp(token, "None") == 0, ("ObjectCreationList %s not found!",token)); - // assign it, even if null! - *theObjectCreationList = ocl; - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a upgrade template string and store as template pointer */ -//------------------------------------------------------------------------------------------------- -void INI::parseUpgradeTemplate( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - if (!TheUpgradeCenter) - { - DEBUG_CRASH(("TheUpgradeCenter not inited yet")); - throw ERROR_BUG; - } - - const UpgradeTemplate *uu = TheUpgradeCenter->findUpgrade( token ); - DEBUG_ASSERTCRASH( uu || stricmp( token, "None" ) == 0, ("Upgrade %s not found!",token) ); - - typedef const UpgradeTemplate* ConstUpgradeTemplatePtr; - ConstUpgradeTemplatePtr* theUpgradeTemplate = (ConstUpgradeTemplatePtr *)store; - *theUpgradeTemplate = uu; -} - -//------------------------------------------------------------------------------------------------- -/** Parse a special power template string and store as template pointer */ -//------------------------------------------------------------------------------------------------- -void INI::parseSpecialPowerTemplate( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - - if (!TheSpecialPowerStore) - { - DEBUG_CRASH(("TheSpecialPowerStore not inited yet")); - throw ERROR_BUG; - } - - const SpecialPowerTemplate *sPowerT = TheSpecialPowerStore->findSpecialPowerTemplate( AsciiString( token ) ); - if( !sPowerT && stricmp( token, "None" ) != 0 ) - { - DEBUG_CRASH( ("[LINE: %d in '%s'] Specialpower %s not found!", ini->getLineNum(), ini->getFilename().str(), token) ); - } - - typedef const SpecialPowerTemplate* ConstSpecialPowerTemplatePtr; - ConstSpecialPowerTemplatePtr* theSpecialPowerTemplate = (ConstSpecialPowerTemplatePtr *)store; - *theSpecialPowerTemplate = sPowerT; -} - -//------------------------------------------------------------------------------------------------- -/** Parse a science string and store as science type */ -//------------------------------------------------------------------------------------------------- -/* static */void INI::parseScience( INI *ini, void * /*instance*/, void *store, const void *userData ) -{ - const char *token = ini->getNextToken(); - - if (!TheScienceStore) - { - DEBUG_CRASH(("TheScienceStore not inited yet")); - throw ERROR_BUG; - } - - *((ScienceType *)store) = INI::scanScience(token); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse a single string token, check for that token in the index list - * of names provided and store the index into that list. - * - * NOTE: Is is assumed that we are going to store the index into - * a 4 byte integer. This works well for INT and ENUM definitions */ -//------------------------------------------------------------------------------------------------- -void INI::parseIndexList( INI* ini, void * /*instance*/, void *store, const void* userData ) -{ - ConstCharPtrArray nameList = (ConstCharPtrArray)userData; - *(Int *)store = scanIndexList(ini->getNextToken(), nameList); -} - -//------------------------------------------------------------------------------------------------- -/** Parse a single string token, check for that token in the index list - * of names provided and store the index into that list. - * - * NOTE: Is is assumed that we are going to store the index into - * a 4 byte integer. This works well for INT and ENUM definitions */ -//------------------------------------------------------------------------------------------------- -void INI::parseByteSizedIndexList( INI* ini, void * /*instance*/, void *store, const void* userData ) -{ - ConstCharPtrArray nameList = (ConstCharPtrArray)userData; - Int value = scanIndexList(ini->getNextToken(), nameList); - if (value < 0 || value > 255) - { - DEBUG_CRASH(("Bad index list INI::parseByteSizedIndexList")); - throw ERROR_BUG; - } - *(Byte *)store = (Byte)value; -} - -//------------------------------------------------------------------------------------------------- -/** Parse a single string token, check for that token in the index list - * of names provided and store the associated value into that list. - * - * NOTE: Is is assumed that we are going to store the index into - * a 4 byte integer. This works well for INT and ENUM definitions */ -//------------------------------------------------------------------------------------------------- -void INI::parseLookupList( INI* ini, void * /*instance*/, void *store, const void* userData ) -{ - ConstLookupListRecArray lookupList = (ConstLookupListRecArray)userData; - *(Int *)store = scanLookupList(ini->getNextToken(), lookupList); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -//------------------------------------------------------------------------------------------------- -void MultiIniFieldParse::add(const FieldParse* f, UnsignedInt e) -{ - if (m_count < MAX_MULTI_FIELDS) - { - m_fieldParse[m_count] = f; - m_extraOffset[m_count] = e; - ++m_count; - } - else - { - DEBUG_CRASH(("too many multi-fields in INI::initFromINIMultiProc")); - throw ERROR_BUG; - } -} - -//------------------------------------------------------------------------------------------------- -void INI::initFromINI( void *what, const FieldParse* parseTable ) -{ - MultiIniFieldParse p; - p.add(parseTable); - initFromINIMulti(what, p); -} - -//------------------------------------------------------------------------------------------------- -void INI::initFromINIMultiProc( void *what, BuildMultiIniFieldProc proc ) -{ - MultiIniFieldParse p; - (*proc)(p); - initFromINIMulti(what, p); -} - -//------------------------------------------------------------------------------------------------- -void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList ) -{ - Bool done = FALSE; - - if( what == nullptr ) - { - DEBUG_ASSERTCRASH( 0, ("INI::initFromINI - Invalid parameters supplied!") ); - throw INI_INVALID_PARAMS; - } - - // read each of the data fields - while( !done ) - { - - // read next line - readLine(); - - // check for end token - const char* field = strtok( m_buffer, INI::getSeps() ); - if( field ) - { - - if( stricmp( field, m_blockEndToken ) == 0 ) - { - done = TRUE; - } - else - { - Bool found = false; - for (int ptIdx = 0; ptIdx < parseTableList.getCount(); ++ptIdx) - { - int offset = 0; - const void* userData = nullptr; - INIFieldParseProc parse = findFieldParse(parseTableList.getNthFieldParse(ptIdx), field, offset, userData); - if (parse) - { - // parse this block and check for parse errors - try { - - (*parse)( this, what, (char *)what + offset + parseTableList.getNthExtraOffset(ptIdx), userData ); - - } catch (...) { - DEBUG_CRASH( ("[LINE: %d - FILE: '%s'] Error reading field '%s' of block '%s'", - INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); - - - char buff[1024]; - sprintf(buff, "[LINE: %d - FILE: '%s'] Error reading field '%s'\n", INI::getLineNum(), INI::getFilename().str(), field); - throw INIException(buff); - } - - found = true; - break; - - } - } - - if (!found) - { - DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown field '%s' in block '%s'", - INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) ); - } - - } - - } - - // sanity check for reaching end of file with no closing end token - if( done == FALSE && INI::isEOF() == TRUE ) - { - - done = TRUE; - DEBUG_ASSERTCRASH( 0, ("Error parsing block '%s', in INI file '%s'. Missing '%s' token", - m_curBlockStart, getFilename().str(), m_blockEndToken) ); - throw INI_MISSING_END_TOKEN; - - } - - } - -} - -//------------------------------------------------------------------------------------------------- -/*static*/ const char* INI::getNextToken(const char* seps) -{ - if (!seps) seps = getSeps(); - const char *token = ::strtok(nullptr, seps); - if (!token) - throw INI_INVALID_DATA; - return token; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ const char* INI::getNextTokenOrNull(const char* seps) -{ - if (!seps) seps = getSeps(); - const char *token = ::strtok(nullptr, seps); - return token; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ ScienceType INI::scanScience(const char* token) -{ - return TheScienceStore->friend_lookupScience( token ); -} - -//------------------------------------------------------------------------------------------------- -/*static*/ Int INI::scanInt(const char* token) -{ - Int value; - if (sscanf( token, "%d", &value ) != 1) - throw INI_INVALID_DATA; - return value; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ UnsignedInt INI::scanUnsignedInt(const char* token) -{ - UnsignedInt value; - if (sscanf( token, "%u", &value ) != 1) // unsigned int is %u, not %d - throw INI_INVALID_DATA; - return value; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ Real INI::scanReal(const char* token) -{ - Real value; - if (sscanf( token, "%f", &value ) != 1) - throw INI_INVALID_DATA; - return value; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ Real INI::scanPercentToReal(const char* token) -{ - Real value; - if (sscanf( token, "%f", &value ) != 1) - throw INI_INVALID_DATA; - return value / 100.0f; -} - -//------------------------------------------------------------------------------------------------- -/*static*/ Int INI::scanIndexList(const char* token, ConstCharPtrArray nameList) -{ - if( nameList == nullptr || nameList[ 0 ] == nullptr ) - { - - DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanIndexList, invalid name list") ); - throw INI_INVALID_NAME_LIST; - - } - - // search for matching name - Int count = 0; - for(ConstCharPtrArray name = nameList; *name; name++, count++ ) - { - if( stricmp( *name, token ) == 0 ) - { - return count; - } - } - - DEBUG_CRASH(("token %s is not a valid member of the index list",token)); - throw INI_INVALID_DATA; - return 0; // never executed, but keeps compiler happy - -} -//------------------------------------------------------------------------------------------------- -/*static*/ Int INI::scanLookupList(const char* token, ConstLookupListRecArray lookupList) -{ - if( lookupList == nullptr || lookupList[ 0 ].name == nullptr ) - { - DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanLookupList, invalid name list") ); - throw INI_INVALID_NAME_LIST; - } - - // search for matching name - Bool found = false; - for( const LookupListRec* lookup = &lookupList[0]; lookup->name; lookup++ ) - { - if( stricmp( lookup->name, token ) == 0 ) - { - return lookup->value; - found = true; - break; - } - } - - DEBUG_CRASH(("token %s is not a valid member of the lookup list",token)); - throw INI_INVALID_DATA; - return 0; // never executed, but keeps compiler happy - -} - -//------------------------------------------------------------------------------------------------- -const char* INI::getNextSubToken(const char* expected) -{ - const char* token = getNextToken(getSepsColon()); - if (stricmp(token, expected) != 0) - throw INI_INVALID_DATA; - return getNextToken(getSepsColon()); -} - -//------------------------------------------------------------------------------------------------- -/** - * Parse a "random variable". - * The format is "FIELD = low high [distribution]". - */ -void INI::parseGameClientRandomVariable( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - GameClientRandomVariable *var = static_cast(store); - - const char* token; - - token = ini->getNextToken(); - Real low = INI::scanReal(token); - - token = ini->getNextToken(); - Real high = INI::scanReal(token); - - // if omitted, assume uniform - GameClientRandomVariable::DistributionType type = GameClientRandomVariable::UNIFORM; - token = ini->getNextTokenOrNull(); - if (token) - type = (GameClientRandomVariable::DistributionType)INI::scanIndexList(token, GameClientRandomVariable::DistributionTypeNames); - - // set the range of the random variable - var->setRange( low, high, type ); -} - -//------------------------------------------------------------------------------------------------- -// parse a duration in msec and convert to duration in frames -void INI::parseDurationReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - Real val = scanReal(ini->getNextToken()); - *(Real *)store = ConvertDurationFromMsecsToFrames(val); -} - -//------------------------------------------------------------------------------------------------- -// parse a duration in msec and convert to duration in integral number of frames, (unsignedint) rounding UP -void INI::parseDurationUnsignedInt( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - UnsignedInt val = scanUnsignedInt(ini->getNextToken()); - *(UnsignedInt *)store = (UnsignedInt)ceilf(ConvertDurationFromMsecsToFrames((Real)val)); -} - -// ------------------------------------------------------------------------------------------------ -// parse a duration in msec and convert to duration in integral number of frames, (unsignedshort) rounding UP -void INI::parseDurationUnsignedShort( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - UnsignedInt val = scanUnsignedInt(ini->getNextToken()); - *(UnsignedShort *)store = (UnsignedShort)ceilf(ConvertDurationFromMsecsToFrames((Real)val)); -} - -//------------------------------------------------------------------------------------------------- -// parse acceleration in (dist/sec) and convert to (dist/frame) -void INI::parseVelocityReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - Real val = scanReal(token); - *(Real *)store = ConvertVelocityInSecsToFrames(val); -} - -//------------------------------------------------------------------------------------------------- -// parse acceleration in (dist/sec^2) and convert to (dist/frame^2) -void INI::parseAccelerationReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ ) -{ - const char *token = ini->getNextToken(); - Real val = scanReal(token); - *(Real *)store = ConvertAccelerationInSecsToFrames(val); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseVeterancyLevelFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/) -{ - VeterancyLevelFlags flags = VETERANCY_LEVEL_FLAGS_ALL; - for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull()) - { - if (stricmp(token, "ALL") == 0) - { - flags = VETERANCY_LEVEL_FLAGS_ALL; - continue; - } - else if (stricmp(token, "NONE") == 0) - { - flags = VETERANCY_LEVEL_FLAGS_NONE; - continue; - } - else if (token[0] == '+') - { - VeterancyLevel dt = (VeterancyLevel)INI::scanIndexList(token+1, TheVeterancyNames); - flags = setVeterancyLevelFlag(flags, dt); - continue; - } - else if (token[0] == '-') - { - VeterancyLevel dt = (VeterancyLevel)INI::scanIndexList(token+1, TheVeterancyNames); - flags = clearVeterancyLevelFlag(flags, dt); - continue; - } - else - { - throw INI_UNKNOWN_TOKEN; - } - } - *(VeterancyLevelFlags*)store = flags; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseSoundsList( INI* ini, void *instance, void *store, const void* /*userData*/ ) -{ - std::vector *vec = (std::vector*) store; - vec->clear(); - - const char* SEPS = " \t,="; - const char *c = ini->getNextTokenOrNull(SEPS); - while ( c ) - { - vec->push_back( c ); - c = ini->getNextTokenOrNull(SEPS); - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseDamageTypeFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/) -{ - DamageTypeFlags flags = DAMAGE_TYPE_FLAGS_ALL; - - for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull()) - { - if (stricmp(token, "ALL") == 0) - { - flags = DAMAGE_TYPE_FLAGS_ALL; - continue; - } - if (stricmp(token, "NONE") == 0) - { - flags = DAMAGE_TYPE_FLAGS_NONE; - continue; - } - if (token[0] == '+') - { - DamageType dt = (DamageType)DamageTypeFlags::getSingleBitFromName(token+1); - flags = setDamageTypeFlag(flags, dt); - continue; - } - if (token[0] == '-') - { - DamageType dt = (DamageType)DamageTypeFlags::getSingleBitFromName(token+1); - flags = clearDamageTypeFlag(flags, dt); - continue; - } - throw INI_UNKNOWN_TOKEN; - } - *(DamageTypeFlags*)store = flags; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void INI::parseDeathTypeFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/) -{ - DeathTypeFlags flags = DEATH_TYPE_FLAGS_ALL; - for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull()) - { - if (stricmp(token, "ALL") == 0) - { - flags = DEATH_TYPE_FLAGS_ALL; - continue; - } - if (stricmp(token, "NONE") == 0) - { - flags = DEATH_TYPE_FLAGS_NONE; - continue; - } - if (token[0] == '+') - { - DeathType dt = (DeathType)INI::scanIndexList(token+1, TheDeathNames); - flags = setDeathTypeFlag(flags, dt); - continue; - } - if (token[0] == '-') - { - DeathType dt = (DeathType)INI::scanIndexList(token+1, TheDeathNames); - flags = clearDeathTypeFlag(flags, dt); - continue; - } - throw INI_UNKNOWN_TOKEN; - } - *(DeathTypeFlags*)store = flags; -} - -//------------------------------------------------------------------------------------------------- -// parse the line and return whether the given line is a Block declaration of the form -// [whitespace] blockType [whitespace] blockName [EOL] -// both blockType and blockName are case insensitive -Bool INI::isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck ) -{ - if (!bufferToCheck || blockType.isEmpty() || blockName.isEmpty()) - return false; - - const char* tempBuff = bufferToCheck; - - while (isspace(*tempBuff)) - ++tempBuff; - - const int blockTypeLength = blockType.getLength(); - if (strnicmp(tempBuff, blockType.str(), blockTypeLength) != 0) - return false; - - tempBuff += blockTypeLength; - - if (!isspace(*tempBuff++)) - return false; - - while (isspace(*tempBuff)) - ++tempBuff; - - const int blockNameLength = blockName.getLength(); - if (strnicmp(tempBuff, blockName.str(), blockNameLength) != 0) - return false; - - tempBuff += blockNameLength; - - while (isspace(*tempBuff)) - ++tempBuff; - - if (*tempBuff != '\0') - return false; - - return true; -} - -//------------------------------------------------------------------------------------------------- -// parse the line and return whether the given line is a Block declaration of the form -// [whitespace] end [EOL] -Bool INI::isEndOfBlock( char *bufferToCheck ) -{ - Bool retVal = true; - if (!bufferToCheck) { - return false; - } - - // DO NOT RETURN EARLY FROM THIS FUNCTION (beyond this point) - // we have to restore the bufferToCheck to its previous state before returning, so - // it is important to get through all the checks. - - static const char* endString = "End"; - int endStringLength = strlen(endString); - char restoreChar; - char *tempBuff = bufferToCheck; - - - while (isspace(*tempBuff)) { - ++tempBuff; - } - - if (strlen(tempBuff) > endStringLength) { - restoreChar = tempBuff[endStringLength]; - tempBuff[endStringLength] = 0; - - if (stricmp(endString, tempBuff) != 0) { - retVal = false; - } - - tempBuff[endStringLength] = restoreChar; - tempBuff = tempBuff + endStringLength; - } else { - retVal = false; - } - - while (*tempBuff && retVal) { - retVal = isspace(*tempBuff); - ++tempBuff; - } - - return retVal; -} diff --git a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp deleted file mode 100644 index 480e7e3464d..00000000000 --- a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// GameCommon.h -// Part of header detangling -// John McDonald, Aug 2002 - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameCommon.h" - -const char *const TheVeterancyNames[] = -{ - "REGULAR", - "VETERAN", - "ELITE", - "HEROIC", - nullptr -}; -static_assert(ARRAY_SIZE(TheVeterancyNames) == LEVEL_COUNT + 1, "Incorrect array size"); - -const char *const TheRelationshipNames[] = -{ - "ENEMIES", - "NEUTRAL", - "ALLIES", - nullptr -}; -static_assert(ARRAY_SIZE(TheRelationshipNames) == RELATIONSHIP_COUNT + 1, "Incorrect array size"); - -//------------------------------------------------------------------------------------------------- -// TheSuperHackers @todo DO NOT USE THIS FUNCTION! Use WWMath::Normalize_Angle instead. Delete this. -Real normalizeAngle(Real angle) -{ - DEBUG_ASSERTCRASH(!_isnan(angle), ("Angle is NAN in normalizeAngle!")); - - if( _isnan(angle) ) - return 0;// ARGH!!!! Don't assert and then not handle it! Error bad! Fix error! - - while (angle > PI) - angle -= 2*PI; - - while (angle <= -PI) - angle += 2*PI; - - return angle; -} - diff --git a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp b/Generals/Code/GameEngine/Source/Common/System/GameType.cpp deleted file mode 100644 index f0f5adb9cd5..00000000000 --- a/Generals/Code/GameEngine/Source/Common/System/GameType.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// GameType.cpp /////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -const char *const TimeOfDayNames[] = -{ - "NONE", - "MORNING", - "AFTERNOON", - "EVENING", - "NIGHT", - - nullptr -}; -static_assert(ARRAY_SIZE(TimeOfDayNames) == TIME_OF_DAY_COUNT + 1, "Incorrect array size"); - -const char *const WeatherNames[] = -{ - "NORMAL", - "SNOWY", - - nullptr -}; -static_assert(ARRAY_SIZE(WeatherNames) == WEATHER_COUNT + 1, "Incorrect array size"); diff --git a/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp b/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp deleted file mode 100644 index 9f8be6a2cba..00000000000 --- a/Generals/Code/GameEngine/Source/Common/System/Snapshot.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Snapshot.cpp ///////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, February 2002 -// Desc: The Snapshot object is the base class interface for data structures that will -// be considered during game saves, loads, and CRC checks. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#include "Common/GameState.h" -#include "Common/Snapshot.h" - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Snapshot::Snapshot( void ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Snapshot::~Snapshot( void ) -{ - - // - // if we're loading, there are pathological cases where we could destroy snapshots while - // there is an entry for them in the post processing list ... need to clean this up - // - ///@ todo, this might be needed in theory in the future, but iterating the post process - // list in the game state is expensive because it's HUGE! - // -// TheGameState->notifySnapshotDeleted(); - -} diff --git a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp b/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp deleted file mode 100644 index d7aad22f1cf..00000000000 --- a/Generals/Code/GameEngine/Source/Common/System/SubsystemInterface.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: SubsystemInterface.cpp -// ---------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/SubsystemInterface.h" -#include "Common/Xfer.h" - - -#ifdef DUMP_PERF_STATS -#include "GameLogic/GameLogic.h" -#include "Common/PerfTimer.h" - -Real SubsystemInterface::s_msConsumed = 0; -#endif - -//----------------------------------------------------------------------------- -SubsystemInterface::SubsystemInterface() -#ifdef DUMP_PERF_STATS -:m_curDrawTime(0), -m_startDrawTimeConsumed(0), -m_startTimeConsumed(0), -m_curUpdateTime(0), -m_dumpUpdate(false), -m_dumpDraw(false) -#endif -{ - if (TheSubsystemList) { - TheSubsystemList->addSubsystem(this); - } -} - - -SubsystemInterface::~SubsystemInterface() -{ - if (TheSubsystemList) { - TheSubsystemList->removeSubsystem(this); - } -} - -#ifdef DUMP_PERF_STATS -static const Real MIN_TIME_THRESHOLD = 0.0002f; // .2 msec. [8/13/2003] -void SubsystemInterface::UPDATE(void) -{ - __int64 startTime64; - __int64 endTime64,freq64; - GetPrecisionTimerTicksPerSec(&freq64); - GetPrecisionTimer(&startTime64); - m_startTimeConsumed = s_msConsumed; - update(); - GetPrecisionTimer(&endTime64); - m_curUpdateTime = ((double)(endTime64-startTime64))/((double)(freq64)); - Real subTime = s_msConsumed - m_startTimeConsumed; - if (m_name.isEmpty()) return; - if (m_curUpdateTime>MIN_TIME_THRESHOLD) { - m_dumpUpdate = true; - } - if (m_curUpdateTime > MIN_TIME_THRESHOLD/10.0f) { - //DLOG(Debug::Format("Subsys %s total time %.2f, subTime %.2f, net time %.2f\n", - // m_name.str(), m_curUpdateTime*1000, subTime*1000, (m_curUpdateTime-subTime)*1000 )); - - m_curUpdateTime -= subTime; - s_msConsumed += m_curUpdateTime; - } else { - m_curUpdateTime = 0; - } - -} -void SubsystemInterface::DRAW(void) -{ - __int64 startTime64; - __int64 endTime64,freq64; - GetPrecisionTimerTicksPerSec(&freq64); - GetPrecisionTimer(&startTime64); - m_startDrawTimeConsumed = s_msConsumed; - draw(); - GetPrecisionTimer(&endTime64); - m_curDrawTime = ((double)(endTime64-startTime64))/((double)(freq64)); - Real subTime = s_msConsumed - m_startDrawTimeConsumed; - if (m_name.isEmpty()) return; - if (m_curDrawTime>MIN_TIME_THRESHOLD) { - m_dumpDraw = true; - } - if (m_curDrawTime > MIN_TIME_THRESHOLD/10.0f) { - //DLOG(Debug::Format("Subsys %s total time %.2f, subTime %.2f, net time %.2f\n", - // m_name.str(), m_curUpdateTime*1000, subTime*1000, (m_curUpdateTime-subTime)*1000 )); - - m_curDrawTime -= subTime; - s_msConsumed += m_curDrawTime; - } else { - m_curDrawTime = 0; - } - -} -#endif - - -//----------------------------------------------------------------------------- -SubsystemInterfaceList::SubsystemInterfaceList() -{ -} - -//----------------------------------------------------------------------------- -SubsystemInterfaceList::~SubsystemInterfaceList() -{ - DEBUG_ASSERTCRASH(m_subsystems.empty(), ("not empty")); - shutdownAll(); -} - -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::addSubsystem(SubsystemInterface* sys) -{ -#ifdef DUMP_PERF_STATS - m_allSubsystems.push_back(sys); -#endif -} -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::removeSubsystem(SubsystemInterface* sys) -{ -#ifdef DUMP_PERF_STATS - for (SubsystemList::iterator it = m_allSubsystems.begin(); it != m_allSubsystems.end(); ++it) - { - if ( (*it) == sys) { - m_allSubsystems.erase(it); - break; - } - } -#endif -} -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::initSubsystem(SubsystemInterface* sys, const char* path1, const char* path2, Xfer *pXfer, AsciiString name) -{ - sys->setName(name); - sys->init(); - - INI ini; - if (path1) - ini.loadFileDirectory(path1, INI_LOAD_OVERWRITE, pXfer ); - if (path2) - ini.loadFileDirectory(path2, INI_LOAD_OVERWRITE, pXfer ); - - m_subsystems.push_back(sys); -} - -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::postProcessLoadAll() -{ - for (SubsystemList::iterator it = m_subsystems.begin(); it != m_subsystems.end(); ++it) - { - (*it)->postProcessLoad(); - } -} - -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::resetAll() -{ -// for (SubsystemList::iterator it = m_subsystems.begin(); it != m_subsystems.end(); ++it) - for (SubsystemList::reverse_iterator it = m_subsystems.rbegin(); it != m_subsystems.rend(); ++it) - { - (*it)->reset(); - } -} - -//----------------------------------------------------------------------------- -void SubsystemInterfaceList::shutdownAll() -{ - // must go in reverse order! - for (SubsystemList::reverse_iterator it = m_subsystems.rbegin(); it != m_subsystems.rend(); ++it) - { - SubsystemInterface* sys = *it; - delete sys; - } - m_subsystems.clear(); -} - -#ifdef DUMP_PERF_STATS -//----------------------------------------------------------------------------- -AsciiString SubsystemInterfaceList::dumpTimesForAll() -{ - - AsciiString buffer; - buffer = "ALL SUBSYSTEMS:\n"; - //buffer.format("\nSUBSYSTEMS: total time %.2f MS\n", - // SubsystemInterface::getTotalTime()*1000.0f); - Real misc = 0; - Real total = 0; - SubsystemInterface::clearTotalTime(); - for (SubsystemList::reverse_iterator it = m_allSubsystems.rbegin(); it != m_allSubsystems.rend(); ++it) - { - SubsystemInterface* sys = *it; - total += sys->getUpdateTime(); - if (sys->doDumpUpdate()) { - AsciiString curLine; - curLine.format(" Time %02.2f MS update() %s \n", sys->getUpdateTime()*1000.0f, sys->getName().str()); - buffer.concat(curLine); - } else { - misc += sys->getUpdateTime(); - } - total += sys->getDrawTime(); - if (sys->doDumpDraw()) { - AsciiString curLine; - curLine.format(" Time %02.2f MS draw () %s \n", sys->getDrawTime()*1000.0f, sys->getName().str()); - buffer.concat(curLine); - } else { - misc += sys->getDrawTime(); - } - } - AsciiString tmp; - tmp.format("TOTAL %.2f MS, Misc time %.2f MS\n", total*1000.0f, misc*1000.0f); - buffer.concat(tmp); - return buffer; -} -#endif diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 189ab821ffb..d6990fc097c 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -36,12 +36,12 @@ set(GAMEENGINE_SRC # Include/Common/DynamicAudioEventInfo.h Include/Common/encrypt.h Include/Common/Energy.h - Include/Common/Errors.h +# Include/Common/Errors.h # Include/Common/file.h # Include/Common/FileSystem.h Include/Common/FunctionLexicon.h # Include/Common/GameAudio.h - Include/Common/GameCommon.h +# Include/Common/GameCommon.h # Include/Common/GameDefines.h Include/Common/GameEngine.h Include/Common/GameLOD.h @@ -51,12 +51,12 @@ set(GAMEENGINE_SRC Include/Common/GameSpyMiscPreferences.h Include/Common/GameState.h Include/Common/GameStateMap.h - Include/Common/GameType.h +# Include/Common/GameType.h Include/Common/Geometry.h Include/Common/GlobalData.h Include/Common/Handicap.h Include/Common/IgnorePreferences.h - Include/Common/INI.h +# Include/Common/INI.h Include/Common/INIException.h Include/Common/KindOf.h Include/Common/LadderPreferences.h @@ -103,7 +103,7 @@ set(GAMEENGINE_SRC # Include/Common/simpleplayer.h Include/Common/SkirmishBattleHonors.h Include/Common/SkirmishPreferences.h - Include/Common/Snapshot.h +# Include/Common/Snapshot.h Include/Common/SparseMatchFinder.h Include/Common/SpecialPower.h Include/Common/SpecialPowerMaskType.h @@ -111,9 +111,9 @@ set(GAMEENGINE_SRC Include/Common/StackDump.h Include/Common/StateMachine.h Include/Common/StatsCollector.h - Include/Common/STLTypedefs.h +# Include/Common/STLTypedefs.h # Include/Common/StreamingArchiveFile.h - Include/Common/SubsystemInterface.h +# Include/Common/SubsystemInterface.h Include/Common/SystemInfo.h Include/Common/Team.h Include/Common/Terrain.h @@ -140,7 +140,7 @@ set(GAMEENGINE_SRC Include/GameClient/AnimateWindowManager.h Include/GameClient/CampaignManager.h Include/GameClient/CDCheck.h - Include/GameClient/ChallengeGenerals.h +# Include/GameClient/ChallengeGenerals.h Include/GameClient/ClientInstance.h # Include/GameClient/ClientRandomValue.h Include/GameClient/Color.h @@ -572,7 +572,7 @@ set(GAMEENGINE_SRC Source/Common/GameLOD.cpp Source/Common/GameMain.cpp Source/Common/GlobalData.cpp - Source/Common/INI/INI.cpp +# Source/Common/INI/INI.cpp Source/Common/INI/INIAiData.cpp Source/Common/INI/INIAnimation.cpp # Source/Common/INI/INIAudioEventInfo.cpp @@ -643,9 +643,9 @@ set(GAMEENGINE_SRC # Source/Common/System/File.cpp # Source/Common/System/FileSystem.cpp Source/Common/System/FunctionLexicon.cpp - Source/Common/System/GameCommon.cpp +# Source/Common/System/GameCommon.cpp #Source/Common/System/GameMemory.cpp - Source/Common/System/GameType.cpp +# Source/Common/System/GameType.cpp Source/Common/System/Geometry.cpp Source/Common/System/KindOf.cpp Source/Common/System/List.cpp @@ -659,10 +659,10 @@ set(GAMEENGINE_SRC Source/Common/System/registry.cpp Source/Common/System/SaveGame/GameState.cpp Source/Common/System/SaveGame/GameStateMap.cpp - Source/Common/System/Snapshot.cpp +# Source/Common/System/Snapshot.cpp Source/Common/System/StackDump.cpp # Source/Common/System/StreamingArchiveFile.cpp - Source/Common/System/SubsystemInterface.cpp +# Source/Common/System/SubsystemInterface.cpp Source/Common/System/Trig.cpp # Source/Common/System/UnicodeString.cpp Source/Common/System/Upgrade.cpp @@ -699,7 +699,7 @@ set(GAMEENGINE_SRC Source/GameClient/GlobalLanguage.cpp Source/GameClient/GraphDraw.cpp Source/GameClient/GUI/AnimateWindowManager.cpp - Source/GameClient/GUI/ChallengeGenerals.cpp +# Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h index dcd47453391..64ceb9a9b78 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingSort.h @@ -29,7 +29,7 @@ #pragma once -#include "GameCommon.h" +#include "Common/GameCommon.h" //------------------------------------------------------------------------------------------------- enum EditorSortingType CPP_11(: Int) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp deleted file mode 100644 index eb5adf62d1b..00000000000 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ChallengeGenerals.h ////////////////////////////////////////////////////////////////////// -// Author: Steve Copeland, 6/24/2003 -// Desc: This is a manager for data pertaining to the Generals' Challenge personas and related GUI. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/ChallengeGenerals.h" - - -ChallengeGenerals *TheChallengeGenerals = nullptr; - -ChallengeGenerals *createChallengeGenerals( void ) -{ - return MSGNEW("ChallengeGenerals") ChallengeGenerals; -} - - -ChallengeGenerals::ChallengeGenerals() -{ - //ctor -} - - -ChallengeGenerals::~ChallengeGenerals() -{ - //dtor -} - - -void ChallengeGenerals::init( void ) -{ - INI ini; - ini.loadFileDirectory( "Data\\INI\\ChallengeMode", INI_LOAD_OVERWRITE, nullptr ); -} - - -void ChallengeGenerals::parseGeneralPersona(INI *ini, void *instance, void *store, const void *userData) -{ - static const FieldParse dataFieldParse[] = - { - { "StartsEnabled", INI::parseBool, nullptr, offsetof( GeneralPersona, m_bStartsEnabled ) }, - { "BioNameString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioName ) }, - { "BioDOBString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioDOB ) }, - { "BioBirthplaceString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBirthplace ) }, - { "BioStrategyString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioStrategy ) }, - { "BioRankString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioRank ) }, - { "BioBranchString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioBranch ) }, - { "BioClassNumberString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strBioClassNumber ) }, - { "BioPortraitSmall", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitSmall ) }, - { "BioPortraitLarge", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageBioPortraitLarge ) }, - { "Campaign", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strCampaign ) }, - { "PlayerTemplate", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPlayerTemplateName ) }, - { "PortraitMovieLeftName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieLeftName ) }, - { "PortraitMovieRightName", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPortraitMovieRightName ) }, - { "DefeatedImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageDefeated ) }, - { "VictoriousImage", INI::parseMappedImage, nullptr, offsetof( GeneralPersona, m_imageVictorious ) }, - { "DefeatedString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strDefeated ) }, - { "VictoriousString", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strVictorious ) }, - { "SelectionSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strSelectionSound ) }, - { "TauntSound1", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound1 ) }, - { "TauntSound2", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound2 ) }, - { "TauntSound3", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strTauntSound3 ) }, - { "WinSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strWinSound ) }, - { "LossSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strLossSound ) }, - { "PreviewSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strPreviewSound ) }, - { "NameSound", INI::parseAsciiString, nullptr, offsetof( GeneralPersona, m_strNameSound ) }, - - { nullptr, nullptr, nullptr, 0 } - }; - ini->initFromINI(store, dataFieldParse); -} - - -const FieldParse ChallengeGenerals::s_fieldParseTable[] = -{ - { "GeneralPersona0", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[0] ) }, - { "GeneralPersona1", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[1] ) }, - { "GeneralPersona2", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[2] ) }, - { "GeneralPersona3", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[3] ) }, - { "GeneralPersona4", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[4] ) }, - { "GeneralPersona5", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[5] ) }, - { "GeneralPersona6", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[6] ) }, - { "GeneralPersona7", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[7] ) }, - { "GeneralPersona8", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[8] ) }, - { "GeneralPersona9", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[9] ) }, - { "GeneralPersona10", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[10] ) }, - { "GeneralPersona11", ChallengeGenerals::parseGeneralPersona, nullptr, offsetof( ChallengeGenerals, m_position[11] ) }, - { nullptr, nullptr, nullptr, 0 } -}; - - -//------------------------------------------------------------------------------------------------- -/** Parse Gen Challenge entries */ -//------------------------------------------------------------------------------------------------- -void INI::parseChallengeModeDefinition( INI* ini ) -{ - if( TheChallengeGenerals ) - { - ini->initFromINI( TheChallengeGenerals, TheChallengeGenerals->getFieldParse() ); - } -} - -const GeneralPersona* ChallengeGenerals::getPlayerGeneralByCampaignName( AsciiString name ) const -{ - for (Int i = 0; i < NUM_GENERALS; i++) - { - AsciiString campaignName = m_position[i].getCampaign(); - if (campaignName.compareNoCase( name.str() ) == 0) - return &m_position[i]; - } - DEBUG_CRASH(("Can't find General by Campaign Name")); - return nullptr; -} - -const GeneralPersona* ChallengeGenerals::getGeneralByGeneralName( AsciiString name ) const -{ - for (Int i = 0; i < NUM_GENERALS; i++) - { - AsciiString generalName = m_position[i].getBioName(); - if (generalName.compareNoCase( name.str() ) == 0) - return &m_position[i]; - } - return nullptr; -} - -const GeneralPersona* ChallengeGenerals::getGeneralByTemplateName( AsciiString name ) const -{ - for (Int i = 0; i < NUM_GENERALS; i++) - { - AsciiString templateName = m_position[i].getPlayerTemplateName(); - if (templateName.compareNoCase( name.str() ) == 0) - return &m_position[i]; - } - return nullptr; -} diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index f0845dd95f3..458d51e38e1 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -262,6 +262,20 @@ def main(): #unify_file(Game.ZEROHOUR, "Libraries/Include/Lib/BaseType.h", Game.CORE, "Libraries/Include/Lib/BaseType.h") #unify_file(Game.ZEROHOUR, "Libraries/Include/Lib/trig.h", Game.CORE, "Libraries/Include/Lib/trig.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/Errors.h", Game.CORE, "GameEngine/Include/Common/Errors.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/GameCommon.h", Game.CORE, "GameEngine/Include/Common/GameCommon.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/GameType.h", Game.CORE, "GameEngine/Include/Common/GameType.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/INI.h", Game.CORE, "GameEngine/Include/Common/INI.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/Snapshot.h", Game.CORE, "GameEngine/Include/Common/Snapshot.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/STLTypedefs.h", Game.CORE, "GameEngine/Include/Common/STLTypedefs.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/SubsystemInterface.h", Game.CORE, "GameEngine/Include/Common/SubsystemInterface.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ChallengeGenerals.h", Game.CORE, "GameEngine/Include/GameClient/ChallengeGenerals.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/INI/INI.cpp", Game.CORE, "GameEngine/Source/Common/INI/INI.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/GameCommon.cpp", Game.CORE, "GameEngine/Source/Common/System/GameCommon.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/GameType.cpp", Game.CORE, "GameEngine/Source/Common/System/GameType.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/Snapshot.cpp", Game.CORE, "GameEngine/Source/Common/System/Snapshot.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/SubsystemInterface.cpp", Game.CORE, "GameEngine/Source/Common/System/SubsystemInterface.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp") return From d3b62e8e6c897db8daa16a4e4964455f5bda565c Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Wed, 28 Jan 2026 17:38:27 +0000 Subject: [PATCH 121/211] bugfix(network): Revert changes to ConnectionManager::getMaximumLatency() to avoid a higher latency runahead than required (#2199) --- .../Include/GameNetwork/ConnectionManager.h | 2 +- .../Source/GameNetwork/ConnectionManager.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h index 956429dd422..3bb96129831 100644 --- a/Core/GameEngine/Include/GameNetwork/ConnectionManager.h +++ b/Core/GameEngine/Include/GameNetwork/ConnectionManager.h @@ -171,7 +171,7 @@ class ConnectionManager // void doPerFrameMetrics(UnsignedInt frame); void getMinimumFps(Int &minFps, Int &minFpsPlayer); ///< Returns the smallest FPS in the m_fpsAverages list. - Real getMaximumLatency(); ///< Returns the highest average latency between players. + Real getMaximumLatency(); ///< Returns the average of the two highest average latencies between players. void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data. diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index ab7a87ef16b..959c882d625 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1362,15 +1362,25 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didS } Real ConnectionManager::getMaximumLatency() { - Real maxLatency = 0.0f; + + Real lat1 = 0.0f; + Real lat2 = 0.0f; for (Int i = 0; i < MAX_SLOTS; ++i) { - if (isPlayerConnected(i) && m_latencyAverages[i] > maxLatency) { - maxLatency = m_latencyAverages[i]; + if (isPlayerConnected(i)) { + if (m_latencyAverages[i] != 0.0f) { + if (m_latencyAverages[i] > lat1) { + lat2 = lat1; + lat1 = m_latencyAverages[i]; + } + else if (m_latencyAverages[i] > lat2) { + lat2 = m_latencyAverages[i]; + } + } } } - return maxLatency; + return (lat1 + lat2) / 2.0f; } void ConnectionManager::getMinimumFps(Int &minFps, Int &minFpsPlayer) { From 831b8106c26bd9bfb712badae759f876329bf09a Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Wed, 28 Jan 2026 17:39:43 +0000 Subject: [PATCH 122/211] fix(network): Fix slightly unstable latency calculation in FrameMetrics::processLatencyResponse() (#2200) --- Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp b/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp index 00cd5836ef5..c571f0a4955 100644 --- a/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp +++ b/Core/GameEngine/Source/GameNetwork/FrameMetrics.cpp @@ -26,6 +26,8 @@ #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine +#include + #include "GameNetwork/FrameMetrics.h" #include "GameClient/Display.h" #include "GameNetwork/networkutil.h" @@ -105,9 +107,9 @@ void FrameMetrics::processLatencyResponse(UnsignedInt frame) { time_t timeDiff = curTime - m_pendingLatencies[pendingIndex]; Int latencyListIndex = frame % TheGlobalData->m_networkLatencyHistoryLength; - m_averageLatency -= m_latencyList[latencyListIndex] / TheGlobalData->m_networkLatencyHistoryLength; m_latencyList[latencyListIndex] = (Real)timeDiff / (Real)1000; // convert to seconds from milliseconds. - m_averageLatency += m_latencyList[latencyListIndex] / TheGlobalData->m_networkLatencyHistoryLength; + const Real latencySum = std::accumulate(m_latencyList, m_latencyList + TheGlobalData->m_networkLatencyHistoryLength, 0.0f); + m_averageLatency = latencySum / (Real)TheGlobalData->m_networkLatencyHistoryLength; if (frame % 16 == 0) { // DEBUG_LOG(("ConnectionManager::processFrameInfoAck - average latency = %f", m_averageLatency)); From afe79cb76fffb45252a98d8de9e11addb94caa9b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 29 Jan 2026 05:04:35 +1100 Subject: [PATCH 123/211] bugfix(dozeraiupdate): Builders now resume their task after having been disabled (#1870) --- .../Include/GameLogic/Module/DozerAIUpdate.h | 10 ++++++ .../Include/GameLogic/Module/WorkerAIUpdate.h | 9 +++++ .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 36 +++++++++++++++++-- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 36 +++++++++++++++++-- .../Include/GameLogic/Module/DozerAIUpdate.h | 10 ++++++ .../Include/GameLogic/Module/WorkerAIUpdate.h | 9 +++++ .../Source/GameLogic/Object/Object.cpp | 18 +++++++--- .../Object/Update/AIUpdate/DozerAIUpdate.cpp | 36 +++++++++++++++++-- .../Object/Update/AIUpdate/WorkerAIUpdate.cpp | 36 +++++++++++++++++-- 9 files changed, 188 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index 63b325b5818..69ed020e4e4 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -140,6 +140,7 @@ class DozerAIInterface // task actions virtual void newTask( DozerTask task, Object *target ) = 0; ///< set a desire to do the requrested task virtual void cancelTask( DozerTask task ) = 0; ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void) = 0; ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ) = 0; ///< set a dozer task as successfully completed @@ -239,6 +240,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface // task actions virtual void newTask( DozerTask task, Object *target ); ///< set a desire to do the requrested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void); ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ); ///< set a dozer task as successfully completed @@ -276,12 +278,20 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface struct DozerTaskInfo { + DozerTaskInfo() + { + m_targetObjectID = INVALID_ID; + m_taskOrderFrame = 0; + } + ObjectID m_targetObjectID; ///< target object ID of task UnsignedInt m_taskOrderFrame; ///< logic frame we decided we wanted to do this task } m_task[ DOZER_NUM_TASKS ]; ///< tasks we want to do indexed by DozerTask DozerPrimaryStateMachine *m_dozerMachine; ///< the custom state machine for Dozer behavior DozerTask m_currentTask; ///< current task the dozer is attending to (if any) + DozerTask m_previousTask; ///< previous task the dozer was attending to (if any) + DozerTaskInfo m_previousTaskInfo; ///< info on the previous task the dozer was attending to (if any) AudioEventRTS m_buildingSound; ///< sound is pulled from the object we are building! Bool m_isRebuild; ///< is this a rebuild of a previous building? diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h index 67f2f9e4a9c..d042a4c4fb2 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h @@ -155,6 +155,7 @@ class WorkerAIUpdate : public AIUpdateInterface, public DozerAIInterface, public // task actions virtual void newTask( DozerTask task, Object* target ); ///< set a desire to do the requrested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void); ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ); ///< set a dozer task as successfully completed @@ -212,12 +213,20 @@ class WorkerAIUpdate : public AIUpdateInterface, public DozerAIInterface, public // Dozer data struct DozerTaskInfo { + DozerTaskInfo() + { + m_targetObjectID = INVALID_ID; + m_taskOrderFrame = 0; + } + ObjectID m_targetObjectID; ///< target object ID of task UnsignedInt m_taskOrderFrame; ///< logic frame we decided we wanted to do this task } m_task[ DOZER_NUM_TASKS ]; ///< tasks we want to do indexed by DozerTask DozerTask m_currentTask; ///< current task the dozer is attending to (if any) + DozerTask m_previousTask; ///< previous task the dozer was attending to (if any) + DozerTaskInfo m_previousTaskInfo; ///< info on the previous task the dozer was attending to (if any) // // the following info array can be used if we want to have more complicated approaches diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index f422f22de08..13478282f35 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1452,6 +1452,7 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } m_currentTask = DOZER_TASK_INVALID; + m_previousTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value @@ -2040,6 +2041,19 @@ void DozerAIUpdate::cancelTask( DozerTask task ) } +//------------------------------------------------------------------------------------------------- +/** Attempt to resume the previous task */ +//------------------------------------------------------------------------------------------------- +void DozerAIUpdate::resumePreviousTask(void) +{ + if (m_previousTask != DOZER_TASK_INVALID) + { + newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID)); + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + } +} + //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ //------------------------------------------------------------------------------------------------- @@ -2096,6 +2110,9 @@ void DozerAIUpdate::internalTaskComplete( DozerTask task ) m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + // remove dock point info for this task for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; @@ -2118,6 +2135,9 @@ void DozerAIUpdate::internalCancelTask( DozerTask task ) // call the single method that gets called for completing and canceling tasks internalTaskCompleteOrCancelled( task ); + m_previousTask = task; + m_previousTaskInfo = m_task[task]; + // remove the info for this task m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; @@ -2436,12 +2456,18 @@ void DozerAIUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Stubbjax 17/11/2025 Save the dozer's previous task + */ // ------------------------------------------------------------------------------------------------ void DozerAIUpdate::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -2462,6 +2488,12 @@ void DozerAIUpdate::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dozerMachine); xfer->xferUser(&m_currentTask, sizeof(m_currentTask)); + if (currentVersion >= 2) + { + xfer->xferUser(&m_previousTask, sizeof(m_previousTask)); + xfer->xferUser(&m_previousTaskInfo, sizeof(m_previousTaskInfo)); + } + Int dockPoints = DOZER_NUM_DOCK_POINTS; xfer->xferInt(&dockPoints); if (dockPoints!=DOZER_NUM_DOCK_POINTS) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index bd67b782cd2..5615f8d7794 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -100,6 +100,7 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } } m_currentTask = DOZER_TASK_INVALID; + m_previousTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelavant, but I want non-garbage value m_supplyTruckStateMachine = nullptr; @@ -695,6 +696,19 @@ void WorkerAIUpdate::cancelTask( DozerTask task ) } +//------------------------------------------------------------------------------------------------- +/** Attempt to resume the previous task */ +//------------------------------------------------------------------------------------------------- +void WorkerAIUpdate::resumePreviousTask(void) +{ + if (m_previousTask != DOZER_TASK_INVALID) + { + newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID)); + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + } +} + //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ //------------------------------------------------------------------------------------------------- @@ -751,6 +765,9 @@ void WorkerAIUpdate::internalTaskComplete( DozerTask task ) m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + // remove dock point info for this task for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; @@ -773,6 +790,9 @@ void WorkerAIUpdate::internalCancelTask( DozerTask task ) // call the single method that gets called for completing and canceling tasks internalTaskCompleteOrCancelled( task ); + m_previousTask = task; + m_previousTaskInfo = m_task[task]; + // remove the info for this task m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; @@ -1401,11 +1421,17 @@ void WorkerAIUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Stubbjax 17/11/2025 Save the worker's previous task + */ // ------------------------------------------------------------------------------------------------ void WorkerAIUpdate::xfer( Xfer *xfer ) { - XferVersion currentVersion = 1; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -1429,6 +1455,12 @@ void WorkerAIUpdate::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dozerMachine); xfer->xferUser(&m_currentTask, sizeof(m_currentTask)); + if (currentVersion >= 2) + { + xfer->xferUser(&m_previousTask, sizeof(m_previousTask)); + xfer->xferUser(&m_previousTaskInfo, sizeof(m_previousTaskInfo)); + } + Int dockPoints = DOZER_NUM_DOCK_POINTS; xfer->xferInt(&dockPoints); if (dockPoints!=DOZER_NUM_DOCK_POINTS) { diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h index dbf4e87eee8..20aff0af941 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DozerAIUpdate.h @@ -140,6 +140,7 @@ class DozerAIInterface // task actions virtual void newTask( DozerTask task, Object *target ) = 0; ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ) = 0; ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void) = 0; ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ) = 0; ///< set a dozer task as successfully completed @@ -239,6 +240,7 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface // task actions virtual void newTask( DozerTask task, Object *target ); ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void); ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ); ///< set a dozer task as successfully completed @@ -276,12 +278,20 @@ class DozerAIUpdate : public AIUpdateInterface, public DozerAIInterface struct DozerTaskInfo { + DozerTaskInfo() + { + m_targetObjectID = INVALID_ID; + m_taskOrderFrame = 0; + } + ObjectID m_targetObjectID; ///< target object ID of task UnsignedInt m_taskOrderFrame; ///< logic frame we decided we wanted to do this task } m_task[ DOZER_NUM_TASKS ]; ///< tasks we want to do indexed by DozerTask DozerPrimaryStateMachine *m_dozerMachine; ///< the custom state machine for Dozer behavior DozerTask m_currentTask; ///< current task the dozer is attending to (if any) + DozerTask m_previousTask; ///< previous task the dozer was attending to (if any) + DozerTaskInfo m_previousTaskInfo; ///< info on the previous task the dozer was attending to (if any) AudioEventRTS m_buildingSound; ///< sound is pulled from the object we are building! Bool m_isRebuild; ///< is this a rebuild of a previous building? diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h index 793843bff40..062e752a97c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h @@ -158,6 +158,7 @@ class WorkerAIUpdate : public AIUpdateInterface, public DozerAIInterface, public // task actions virtual void newTask( DozerTask task, Object* target ); ///< set a desire to do the requested task virtual void cancelTask( DozerTask task ); ///< cancel this task from the queue, if it's the current task the dozer will stop working on it + virtual void resumePreviousTask(void); ///< resume the previous task if there was one // internal methods to manage behavior from within the dozer state machine virtual void internalTaskComplete( DozerTask task ); ///< set a dozer task as successfully completed @@ -217,12 +218,20 @@ class WorkerAIUpdate : public AIUpdateInterface, public DozerAIInterface, public // Dozer data struct DozerTaskInfo { + DozerTaskInfo() + { + m_targetObjectID = INVALID_ID; + m_taskOrderFrame = 0; + } + ObjectID m_targetObjectID; ///< target object ID of task UnsignedInt m_taskOrderFrame; ///< logic frame we decided we wanted to do this task } m_task[ DOZER_NUM_TASKS ]; ///< tasks we want to do indexed by DozerTask DozerTask m_currentTask; ///< current task the dozer is attending to (if any) + DozerTask m_previousTask; ///< previous task the dozer was attending to (if any) + DozerTaskInfo m_previousTaskInfo; ///< info on the previous task the dozer was attending to (if any) // // the following info array can be used if we want to have more complicated approaches diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 3d7f0031d6a..6176bf1be7b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3853,11 +3853,21 @@ void Object::onDisabledEdge(Bool becomingDisabled) (*module)->onDisabledEdge( becomingDisabled ); DozerAIInterface *dozerAI = getAI() ? getAI()->getDozerAIInterface() : nullptr; - if( becomingDisabled && dozerAI ) + if (dozerAI) { - // Have to say goodbye to the thing we might be building or repairing so someone else can do it. - if( dozerAI->getCurrentTask() != DOZER_TASK_INVALID ) - dozerAI->cancelTask( dozerAI->getCurrentTask() ); + if (becomingDisabled) + { + // Have to say goodbye to the thing we might be building or repairing so someone else can do it. + if (dozerAI->getCurrentTask() != DOZER_TASK_INVALID) + dozerAI->cancelTask(dozerAI->getCurrentTask()); + } + else + { +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 17/11/2025 Resume previous task when re-enabled. + dozerAI->resumePreviousTask(); +#endif + } } Player* controller = getControllingPlayer(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 9b723e932ef..fb5da2d4373 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1457,6 +1457,7 @@ DozerAIUpdate::DozerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } m_currentTask = DOZER_TASK_INVALID; + m_previousTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelevant, but I want non-garbage value @@ -2045,6 +2046,19 @@ void DozerAIUpdate::cancelTask( DozerTask task ) } +//------------------------------------------------------------------------------------------------- +/** Attempt to resume the previous task */ +//------------------------------------------------------------------------------------------------- +void DozerAIUpdate::resumePreviousTask(void) +{ + if (m_previousTask != DOZER_TASK_INVALID) + { + newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID)); + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + } +} + //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ //------------------------------------------------------------------------------------------------- @@ -2101,6 +2115,9 @@ void DozerAIUpdate::internalTaskComplete( DozerTask task ) m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + // remove dock point info for this task for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; @@ -2123,6 +2140,9 @@ void DozerAIUpdate::internalCancelTask( DozerTask task ) // call the single method that gets called for completing and canceling tasks internalTaskCompleteOrCancelled( task ); + m_previousTask = task; + m_previousTaskInfo = m_task[task]; + // remove the info for this task m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; @@ -2448,12 +2468,18 @@ void DozerAIUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Stubbjax 17/11/2025 Save the dozer's previous task + */ // ------------------------------------------------------------------------------------------------ void DozerAIUpdate::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -2474,6 +2500,12 @@ void DozerAIUpdate::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dozerMachine); xfer->xferUser(&m_currentTask, sizeof(m_currentTask)); + if (currentVersion >= 2) + { + xfer->xferUser(&m_previousTask, sizeof(m_previousTask)); + xfer->xferUser(&m_previousTaskInfo, sizeof(m_previousTaskInfo)); + } + Int dockPoints = DOZER_NUM_DOCK_POINTS; xfer->xferInt(&dockPoints); if (dockPoints!=DOZER_NUM_DOCK_POINTS) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 8e9a753daab..5a7af64055a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -100,6 +100,7 @@ WorkerAIUpdate::WorkerAIUpdate( Thing *thing, const ModuleData* moduleData ) : } } m_currentTask = DOZER_TASK_INVALID; + m_previousTask = DOZER_TASK_INVALID; m_buildSubTask = DOZER_SELECT_BUILD_DOCK_LOCATION; // irrelevant, but I want non-garbage value m_supplyTruckStateMachine = nullptr; @@ -695,6 +696,19 @@ void WorkerAIUpdate::cancelTask( DozerTask task ) } +//------------------------------------------------------------------------------------------------- +/** Attempt to resume the previous task */ +//------------------------------------------------------------------------------------------------- +void WorkerAIUpdate::resumePreviousTask(void) +{ + if (m_previousTask != DOZER_TASK_INVALID) + { + newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID)); + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + } +} + //------------------------------------------------------------------------------------------------- /** Is there a given task waiting to be done */ //------------------------------------------------------------------------------------------------- @@ -751,6 +765,9 @@ void WorkerAIUpdate::internalTaskComplete( DozerTask task ) m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; + m_previousTask = DOZER_TASK_INVALID; + m_previousTaskInfo = DozerTaskInfo(); + // remove dock point info for this task for( Int i = 0; i < DOZER_NUM_DOCK_POINTS; i++ ) m_dockPoint[ task ][ i ].valid = FALSE; @@ -773,6 +790,9 @@ void WorkerAIUpdate::internalCancelTask( DozerTask task ) // call the single method that gets called for completing and canceling tasks internalTaskCompleteOrCancelled( task ); + m_previousTask = task; + m_previousTaskInfo = m_task[task]; + // remove the info for this task m_task[ task ].m_targetObjectID = INVALID_ID; m_task[ task ].m_taskOrderFrame = 0; @@ -1411,11 +1431,17 @@ void WorkerAIUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @tweak Stubbjax 17/11/2025 Save the worker's previous task + */ // ------------------------------------------------------------------------------------------------ void WorkerAIUpdate::xfer( Xfer *xfer ) { - XferVersion currentVersion = 1; +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -1439,6 +1465,12 @@ void WorkerAIUpdate::xfer( Xfer *xfer ) xfer->xferSnapshot(m_dozerMachine); xfer->xferUser(&m_currentTask, sizeof(m_currentTask)); + if (currentVersion >= 2) + { + xfer->xferUser(&m_previousTask, sizeof(m_previousTask)); + xfer->xferUser(&m_previousTaskInfo, sizeof(m_previousTaskInfo)); + } + Int dockPoints = DOZER_NUM_DOCK_POINTS; xfer->xferInt(&dockPoints); if (dockPoints!=DOZER_NUM_DOCK_POINTS) { From 58e8a2b8e0d7116a798c900041f57fb5fc075931 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 29 Jan 2026 05:05:04 +1100 Subject: [PATCH 124/211] bugfix(actionmanager): Allow immediate resumed construction of buildings if the existing builder dies (#1872) --- Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 5 +++++ .../Code/GameEngine/Source/Common/RTS/ActionManager.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 019faa7bb23..65c2ae5d7bb 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -482,7 +482,12 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, // in the future) // Object *builder = TheGameLogic->findObjectByID( objectBeingConstructed->getBuilderID() ); +#if RETAIL_COMPATIBLE_CRC if( builder ) +#else + // TheSuperHackers @bugfix Stubbjax 18/11/2025 Allow scaffold to be immediately resumed after builder death. + if (builder && !builder->isEffectivelyDead()) +#endif { AIUpdateInterface *ai = builder->getAI(); DEBUG_ASSERTCRASH( ai, ("Builder object does not have an AI interface!") ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index 4bd4026e495..22bd19494a0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -486,7 +486,12 @@ Bool ActionManager::canResumeConstructionOf( const Object *obj, // in the future) // Object *builder = TheGameLogic->findObjectByID( objectBeingConstructed->getBuilderID() ); +#if RETAIL_COMPATIBLE_CRC if( builder ) +#else + // TheSuperHackers @bugfix Stubbjax 18/11/2025 Allow scaffold to be immediately resumed after builder death. + if (builder && !builder->isEffectivelyDead()) +#endif { AIUpdateInterface *ai = builder->getAI(); DEBUG_ASSERTCRASH( ai, ("Builder object does not have an AI interface!") ); From 07b9d0ecccbf961f9d92c8d8cb77cbe80ee7f0d7 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Thu, 29 Jan 2026 05:28:24 +1100 Subject: [PATCH 125/211] fix(activebody): Subdual damage can no longer go negative (#2184) --- .../GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 9125ed86e88..7f7ed35db53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -1263,7 +1263,13 @@ void ActiveBody::internalAddSubdualDamage( Real delta ) const ActiveBodyModuleData *data = getActiveBodyModuleData(); m_currentSubdualDamage += delta; +#if RETAIL_COMPATIBLE_CRC m_currentSubdualDamage = min(m_currentSubdualDamage, data->m_subdualDamageCap); +#else + // TheSuperHackers @bugfix Stubbjax 25/01/2026 Subdual damage can no longer go negative, which + // stops weak subdual damage + rapid healing from negatively stacking subdual damage over time. + m_currentSubdualDamage = clamp(0.0f, m_currentSubdualDamage, data->m_subdualDamageCap); +#endif } //------------------------------------------------------------------------------------------------- From 55ee429b2ab44e0cfa341eaa30f206cce383bcbc Mon Sep 17 00:00:00 2001 From: JohnsterID <69278611+JohnsterID@users.noreply.github.com> Date: Wed, 28 Jan 2026 10:32:42 -0800 Subject: [PATCH 126/211] fix(basetype): Add min/max template functions to BaseType.h (#2183) Add lowercase min/max template functions to BaseType.h alongside existing uppercase MIN/MAX macros from BaseTypeCore.h. Problem: BitFlags.h and other GameEngine code needed readable min() calls, but VC6's lacks std::min/std::max. GameEngine code cannot rely on always.h (WWVegas layer). Solution: Add min/max templates to BaseType.h with header guard to prevent conflicts when GameEngine code includes both BaseType.h and WWVegas headers (which also define min/max in always.h). Implementation: - Use same header guard as always.h (_MIN_MAX_TEMPLATES_DEFINED_) - Templates coexist with uppercase MIN/MAX macros - Works with VC6, MSVC, and MinGW-w64 - Follows existing BaseType.h pattern (sqr, clamp, sign templates) --- Core/Libraries/Include/Lib/BaseType.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Core/Libraries/Include/Lib/BaseType.h b/Core/Libraries/Include/Lib/BaseType.h index 7d3da6b9f2b..743da75c726 100644 --- a/Core/Libraries/Include/Lib/BaseType.h +++ b/Core/Libraries/Include/Lib/BaseType.h @@ -58,6 +58,28 @@ inline int sign(NUM x) else return 0; } +// TheSuperHackers @refactor JohnsterID 24/01/2026 Add lowercase min/max templates for GameEngine layer. +// GameEngine code typically uses BaseType.h, but may include WWVegas headers (which define min/max in always.h). +// Header guard prevents duplicate definitions. VC6's lacks std::min/std::max. +#ifndef _MIN_MAX_TEMPLATES_DEFINED_ +#define _MIN_MAX_TEMPLATES_DEFINED_ + +#ifdef min +#undef min +#endif + +#ifdef max +#undef max +#endif + +template +inline T min(T a, T b) { return (a < b) ? a : b; } + +template +inline T max(T a, T b) { return (a > b) ? a : b; } + +#endif // _MIN_MAX_TEMPLATES_DEFINED_ + //----------------------------------------------------------------------------- inline Real rad2deg(Real rad) { return rad * (180/PI); } inline Real deg2rad(Real rad) { return rad * (PI/180); } @@ -179,8 +201,8 @@ struct RealRange // both ranges void combine( RealRange &other ) { - lo = MIN( lo, other.lo ); - hi = MAX( hi, other.hi ); + lo = min( lo, other.lo ); + hi = max( hi, other.hi ); } }; From aa37f911bccdee97db151895ef95ce7dd4f724a3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:52:49 +0100 Subject: [PATCH 127/211] bugfix(ghostobject): Add Ghost Objects of the local player to the scene correctly after loading a savegame (#2186) --- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 23 +++++++++---------- .../W3DDevice/GameLogic/W3DGhostObject.cpp | 23 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index b4f35ec3602..736dc2b2b08 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -725,22 +725,10 @@ void W3DGhostObject::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( objectSnapshot ); - - // add snapshot to the scene - objectSnapshot->addToScene(); } } } - // - // since there is a snapshot for this object, there cannot be a regular object/drawable - // in the world, we need to remove it - // - if( m_parentObject && - m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr && - xfer->getXferMode() == XFER_LOAD ) - removeParentObject(); - // count of partition shroudedness info to follow UnsignedByte shroudednessCount = 0; UnsignedByte playerIndex; @@ -801,6 +789,17 @@ void W3DGhostObject::loadPostProcess( void ) { // extend base class GhostObject::loadPostProcess(); + + const Int playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); + + // add snapshot to the scene + // TheSuperHackers @bugfix But only for the local player + if (addToScene(playerIndex)) + { + // since there is a snapshot for this object, there cannot be a regular object/drawable + // in the world, we need to remove it + removeParentObject(); + } } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp index 8224425dbe1..4e8a78c5498 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp @@ -729,22 +729,10 @@ void W3DGhostObject::xfer( Xfer *xfer ) // xfer data xfer->xferSnapshot( objectSnapshot ); - - // add snapshot to the scene - objectSnapshot->addToScene(); } } } - // - // since there is a snapshot for this object, there cannot be a regular object/drawable - // in the world, we need to remove it - // - if( m_parentObject && - m_parentSnapshots[TheGhostObjectManager->getLocalPlayerIndex()] != nullptr && - xfer->getXferMode() == XFER_LOAD ) - removeParentObject(); - // count of partition shroudedness info to follow UnsignedByte shroudednessCount = 0; UnsignedByte playerIndex; @@ -805,6 +793,17 @@ void W3DGhostObject::loadPostProcess( void ) { // extend base class GhostObject::loadPostProcess(); + + const Int playerIndex = TheGhostObjectManager->getLocalPlayerIndex(); + + // add snapshot to the scene + // TheSuperHackers @bugfix But only for the local player + if (addToScene(playerIndex)) + { + // since there is a snapshot for this object, there cannot be a regular object/drawable + // in the world, we need to remove it + removeParentObject(); + } } // ------------------------------------------------------------------------------------------------ From 64d9b08899713dfd49f17bf9a9c0fb57c5ab45bf Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:54:28 +0100 Subject: [PATCH 128/211] bugfix(mouse): Make Cursor Capture opt-in to prevent capture in GUIEdit (#2187) --- Generals/Code/GameEngine/Include/GameClient/Mouse.h | 2 +- Generals/Code/GameEngine/Source/GameClient/GameClient.cpp | 7 ++++--- Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 5 +---- GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h | 2 +- .../Code/GameEngine/Source/GameClient/GameClient.cpp | 7 ++++--- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 5 +---- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 376733a9680..b3955efc6cf 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -285,6 +285,7 @@ class Mouse : public SubsystemInterface virtual void setPosition( Int x, Int y ); ///< set the mouse position virtual void setCursor( MouseCursor cursor ) = 0; ///< set mouse cursor + void initCapture(); ///< called once to unlock the mouse capture functionality void setCursorCaptureMode(CursorCaptureMode mode); ///< set the rules for the mouse capture void refreshCursorCapture(); ///< refresh the mouse capture Bool isCursorCaptured(); ///< true if the mouse is captured in the game window @@ -348,7 +349,6 @@ class Mouse : public SubsystemInterface protected: - void initCapture(); Bool canCapture() const; ///< true if the mouse can be captured void unblockCapture(CursorCaptureBlockReason reason); // unset a reason to block mouse capture void blockCapture(CursorCaptureBlockReason reason); // set a reason to block mouse capture diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index b317344c680..0a2839ffe2e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -378,14 +378,15 @@ void GameClient::init( void ) TheRayEffects->setName("TheRayEffects"); } - TheMouse->init(); //finish initializing the mouse. - // set the limits of the mouse now that we've created the display and such if( TheMouse ) { + // finish initializing the mouse. + TheMouse->init(); + TheMouse->initCapture(); TheMouse->setPosition( 0, 0 ); TheMouse->setMouseLimits(); - TheMouse->setName("TheMouse"); + TheMouse->setName("TheMouse"); } // create the video player diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index 20845aca1b2..1ae52d75e0e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -520,7 +520,7 @@ Mouse::Mouse( void ) m_tooltipBackColor.blue = 0; m_tooltipBackColor.alpha = 255; - m_cursorCaptureMode = CursorCaptureMode_Default; + m_cursorCaptureMode = 0; m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit); DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit")); @@ -582,9 +582,6 @@ void Mouse::init( void ) // allocate a new display string m_cursorTextDisplayString = TheDisplayStringManager->newDisplayString(); - - initCapture(); - } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index 77cec327bea..73e6512381c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -285,6 +285,7 @@ class Mouse : public SubsystemInterface virtual void setPosition( Int x, Int y ); ///< set the mouse position virtual void setCursor( MouseCursor cursor ) = 0; ///< set mouse cursor + void initCapture(); ///< called once to unlock the mouse capture functionality void setCursorCaptureMode(CursorCaptureMode mode); ///< set the rules for the mouse capture void refreshCursorCapture(); ///< refresh the mouse capture Bool isCursorCaptured(); ///< true if the mouse is captured in the game window @@ -349,7 +350,6 @@ class Mouse : public SubsystemInterface protected: - void initCapture(); Bool canCapture() const; ///< true if the mouse can be captured void unblockCapture(CursorCaptureBlockReason reason); // unset a reason to block mouse capture void blockCapture(CursorCaptureBlockReason reason); // set a reason to block mouse capture diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 583721ff51e..1c6c5e8e9d1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -391,14 +391,15 @@ void GameClient::init( void ) TheRayEffects->setName("TheRayEffects"); } - TheMouse->init(); //finish initializing the mouse. - // set the limits of the mouse now that we've created the display and such if( TheMouse ) { + // finish initializing the mouse. + TheMouse->init(); + TheMouse->initCapture(); TheMouse->setPosition( 0, 0 ); TheMouse->setMouseLimits(); - TheMouse->setName("TheMouse"); + TheMouse->setName("TheMouse"); } // create the video player diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index ee58890a908..4fd76fdf4cb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -520,7 +520,7 @@ Mouse::Mouse( void ) m_tooltipBackColor.blue = 0; m_tooltipBackColor.alpha = 255; - m_cursorCaptureMode = CursorCaptureMode_Default; + m_cursorCaptureMode = 0; m_captureBlockReasonBits = (1 << CursorCaptureBlockReason_NoInit); DEBUG_LOG(("Mouse::Mouse: m_blockCaptureReason=CursorCaptureBlockReason_NoInit")); @@ -582,9 +582,6 @@ void Mouse::init( void ) // allocate a new display string m_cursorTextDisplayString = TheDisplayStringManager->newDisplayString(); - - initCapture(); - } //------------------------------------------------------------------------------------------------- From 49f0e5f068565c0be6c9b9c384e540350edeff83 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:42:55 +0100 Subject: [PATCH 129/211] unity(particlesys): Merge removal of Drawable Particle Attachments from Zero Hour (#2153) --- .../GameEngine/Include/GameClient/Drawable.h | 6 -- .../Include/GameClient/ParticleSys.h | 2 - .../GameEngine/Source/GameClient/Drawable.cpp | 22 ------- .../Source/GameClient/GameClient.cpp | 3 - .../Source/GameClient/System/ParticleSys.cpp | 59 +------------------ 5 files changed, 2 insertions(+), 90 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index e6e80414b5a..e74853b7ba2 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -432,9 +432,6 @@ class Drawable : public Thing, void clearAndSetModelConditionFlags( const ModelConditionFlags& clr, const ModelConditionFlags& set ); void replaceModelConditionFlags( const ModelConditionFlags &flags, Bool forceReplace = FALSE ); - void attachToParticleSystem( Particle *p ); ///< attach this Drawable to a particle system - void detachFromParticleSystem( void ); ///< detach this from any particle system - Bool handleWeaponFireFX( WeaponSlotType wslot, Int specificBarrelToUse, @@ -538,8 +535,6 @@ class Drawable : public Thing, Bool getShouldAnimate( Bool considerPower ) const; - void friend_setParticle( Particle *particle ) { m_particle = particle; } - // flash drawable methods --------------------------------------------------------- Int getFlashCount( void ) { return m_flashCount; } void setFlashCount( Int count ) { m_flashCount = count; } @@ -636,7 +631,6 @@ class Drawable : public Thing, Real m_decalOpacity; Object *m_object; ///< object (if any) that this drawable represents - Particle *m_particle; ///< particle (if any) that this Drawable is associated with DrawableID m_id; ///< this drawable's unique ID Drawable *m_nextDrawable; diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index 0a6f2078b45..d03ee1ed62d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -174,7 +174,6 @@ class Particle : public MemoryPoolObject, void doWindMotion( void ); ///< do wind motion (if present) from particle system void applyForce( const Coord3D *force ); ///< add the given acceleration - void detachDrawable( void ) { m_drawable = nullptr; } ///< detach the Drawable pointer from this particle const Coord3D *getPosition( void ) { return &m_pos; } Real getSize( void ) { return m_size; } @@ -231,7 +230,6 @@ class Particle : public MemoryPoolObject, RGBColor m_colorRate; ///< current rate of color change Int m_colorTargetKey; ///< next index into key array - Drawable * m_drawable; ///< drawable associated with this particle Bool m_isCulled; ///< status of particle relative to screen bounds public: diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 289a2fb7cbf..51a5e4b033c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -384,7 +384,6 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu // initially not bound to an object m_object = nullptr; - m_particle = nullptr; // tintStatusTracking m_tintStatus = 0; @@ -514,7 +513,6 @@ Drawable::~Drawable() // reset object to nullptr so we never mistaken grab "dead" objects m_object = nullptr; - m_particle = nullptr; // delete any icons present deleteInstance(m_iconInfo); @@ -762,26 +760,6 @@ Bool Drawable::getCurrentWorldspaceClientBonePositions(const char* boneName, Mat return false; } -//------------------------------------------------------------------------------------------------- -/** Attach to a particle system */ -//------------------------------------------------------------------------------------------------- -void Drawable::attachToParticleSystem( Particle *p ) -{ - m_particle = p; -} - -//------------------------------------------------------------------------------------------------- -/** Detach from a particle system, if attached */ -//------------------------------------------------------------------------------------------------- -void Drawable::detachFromParticleSystem( void ) -{ - if (m_particle) - { - m_particle->detachDrawable(); - m_particle = nullptr; - } -} - //------------------------------------------------------------------------------------------------- void Drawable::setTerrainDecal(TerrainDecalType type) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp index 0a2839ffe2e..a4b304949d1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -810,9 +810,6 @@ void GameClient::destroyDrawable( Drawable *draw ) // remove any notion of the Drawable in the in-game user interface TheInGameUI->disregardDrawable( draw ); - // detach this Drawable from any particle system that may be using it - draw->detachFromParticleSystem(); - // remove from the master list draw->removeFromList(&m_drawableList); diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index a408bcec665..f12d19e5c09 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -326,18 +326,6 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_colorScale = info->m_colorScale; - if (system->isUsingDrawables()) - { - const ThingTemplate *tmpl = TheThingFactory->findTemplate(system->getParticleTypeName()); - DEBUG_ASSERTCRASH(tmpl, ("Drawable %s not found",system->getParticleTypeName().str())); - if (tmpl) - { - m_drawable = TheThingFactory->newDrawable(tmpl); - if (m_drawable) - m_drawable->attachToParticleSystem( this ); - } - } - m_inSystemList = m_inOverallList = FALSE; m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr; @@ -358,10 +346,6 @@ Particle::~Particle() // tell the particle system that this particle is gone m_system->removeParticle( this ); - if (m_drawable) - TheGameClient->destroyDrawable( m_drawable ); - m_drawable = nullptr; - // if this particle was controlling another particle system, destroy that system if (m_systemUnderControl) { @@ -517,17 +501,6 @@ Bool Particle::update( void ) m_accel.y = 0.0f; m_accel.z = 0.0f; - if (m_drawable) - { - Matrix3D rot; - rot.Make_Identity(); - rot.Rotate_X( m_angleX ); - rot.Rotate_Y( m_angleY ); - rot.Rotate_Z( m_angleZ ); - m_drawable->setInstanceMatrix( &rot ); - m_drawable->setPosition( &m_pos ); - } - // monitor lifetime if (m_lifetimeLeft && --m_lifetimeLeft == 0) return false; @@ -640,11 +613,6 @@ ParticlePriorityType Particle::getPriority( void ) // ------------------------------------------------------------------------------------------------ Bool Particle::isInvisible( void ) { - // Drawables are never invisible (yet) - /// @todo Allow Drawables to fade via alpha (MSB) - if (m_drawable) - return false; - switch (m_system->getShaderType()) { case ParticleSystemInfo::ADDITIVE: @@ -742,31 +710,8 @@ void Particle::xfer( Xfer *xfer ) xfer->xferInt( &m_colorTargetKey ); // drawable - DrawableID drawableID = m_drawable ? m_drawable->getID() : INVALID_DRAWABLE_ID; - xfer->xferDrawableID( &drawableID ); - if( xfer->getXferMode() == XFER_LOAD && drawableID != INVALID_DRAWABLE_ID ) - { - - // - // save drawable pointer, note that this xfer block is after all the drawable stuff - // so we don't need to post process anything all the correct drawables are loaded - // and available to us - // - m_drawable = TheGameClient->findDrawableByID( drawableID ); - - // sanity - if( m_drawable == nullptr ) - { - - DEBUG_CRASH(( "Particle::xfer - Unable to find matching drawable id for particle" )); - throw SC_INVALID_DATA; - - } - - // set the particle pointer in the drawable - m_drawable->friend_setParticle( this ); - - } + DrawableID drawableID = INVALID_DRAWABLE_ID; + xfer->xferDrawableID( &drawableID ); //saving for backwards compatibility when we supported drawables. // system under control as an id ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; From 3cfe5500d346f8faf06bc716f8163ebef344864d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:45:58 +0100 Subject: [PATCH 130/211] unify(particlesys): Merge addition of ParticleSystem::setSkipParentXfrm from Zero Hour (#2153) --- .../Include/GameClient/ParticleSys.h | 2 + .../Source/GameClient/System/ParticleSys.cpp | 43 +++++++++----- .../Include/GameClient/ParticleSys.h | 4 +- .../Source/GameClient/System/ParticleSys.cpp | 58 +++++++++---------- 4 files changed, 58 insertions(+), 49 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index d03ee1ed62d..e96ac4f994f 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -557,6 +557,7 @@ class ParticleSystem : public MemoryPoolObject, void rotateLocalTransformX( Real x ); ///< rotate local transform matrix void rotateLocalTransformY( Real y ); ///< rotate local transform matrix void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix + void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } ///findObjectByID( m_attachedToObjectID ); + Object *objectAttachedTo = TheGameLogic->findObjectByID( m_attachedToObjectID ); - if (attachedTo) + if (objectAttachedTo) { if (!isShrouded) - isShrouded = (attachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); + isShrouded = (objectAttachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); + + const Drawable * draw = objectAttachedTo->getDrawable(); + if ( draw ) + parentXfrm = draw->getTransformMatrix(); + else + parentXfrm = objectAttachedTo->getTransformMatrix(); - parentXfrm = attachedTo->getTransformMatrix(); m_lastPos = m_pos; - m_pos = *attachedTo->getPosition(); + m_pos = *objectAttachedTo->getPosition(); } else { @@ -1961,15 +1966,23 @@ Bool ParticleSystem::update( Int localPlayerIndex ) if (parentXfrm) { - // if system has its own local transform, concatenate them - if (m_isLocalIdentity == false) -#ifdef ALLOW_TEMPORARIES - m_transform = (*parentXfrm) * m_localTransform; -#else - m_transform.mul(*parentXfrm, m_localTransform); -#endif + if (m_skipParentXfrm) + { + //this particle system is already in world space so no need to apply parent xform. + m_transform = m_localTransform; + } else - m_transform = *parentXfrm; + { + // if system has its own local transform, concatenate them + if (m_isLocalIdentity == false) + #ifdef ALLOW_TEMPORARIES + m_transform = (*parentXfrm) * m_localTransform; + #else + m_transform.mul(*parentXfrm, m_localTransform); + #endif + else + m_transform = *parentXfrm; + } m_isIdentity = false; transformSet = true; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index ccd6c6a1689..547fce613e0 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -549,7 +549,7 @@ class ParticleSystem : public MemoryPoolObject, void rotateLocalTransformX( Real x ); ///< rotate local transform matrix void rotateLocalTransformY( Real y ); ///< rotate local transform matrix void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix - void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } ///getTransformMatrix(); - m_lastPos = m_pos; m_pos = *attachedTo->getPosition(); } @@ -1892,14 +1891,11 @@ Bool ParticleSystem::update( Int localPlayerIndex ) if (!isShrouded) isShrouded = (objectAttachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); - const Drawable * draw = objectAttachedTo->getDrawable(); - if ( draw ) - parentXfrm = draw->getTransformMatrix(); - else - parentXfrm = objectAttachedTo->getTransformMatrix(); - - - + const Drawable * draw = objectAttachedTo->getDrawable(); + if ( draw ) + parentXfrm = draw->getTransformMatrix(); + else + parentXfrm = objectAttachedTo->getTransformMatrix(); m_lastPos = m_pos; m_pos = *objectAttachedTo->getPosition(); @@ -1914,30 +1910,28 @@ Bool ParticleSystem::update( Int localPlayerIndex ) } } - - if (parentXfrm) { - if (m_skipParentXfrm) - { - //this particle system is already in world space so no need to apply parent xform. - m_transform = m_localTransform; - } - else - { - // if system has its own local transform, concatenate them - if (m_isLocalIdentity == false) - #ifdef ALLOW_TEMPORARIES - m_transform = (*parentXfrm) * m_localTransform; - #else - m_transform.mul(*parentXfrm, m_localTransform); - #endif - else - m_transform = *parentXfrm; - } - - m_isIdentity = false; - transformSet = true; + if (m_skipParentXfrm) + { + //this particle system is already in world space so no need to apply parent xform. + m_transform = m_localTransform; + } + else + { + // if system has its own local transform, concatenate them + if (m_isLocalIdentity == false) + #ifdef ALLOW_TEMPORARIES + m_transform = (*parentXfrm) * m_localTransform; + #else + m_transform.mul(*parentXfrm, m_localTransform); + #endif + else + m_transform = *parentXfrm; + } + + m_isIdentity = false; + transformSet = true; } From f832a5d5bd562b5751bf2932cd30162d4fb15e8d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:49:11 +0100 Subject: [PATCH 131/211] unify(particlesys): Compile out superfluous X and Y particle angles in Generals (#2153) --- .../Include/GameClient/ParticleSys.h | 12 +++ .../Source/GameClient/System/ParticleSys.cpp | 59 +++++++++++++- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 4 + .../ParticleEditor/ParticleEditorDialog.cpp | 48 +++++++++++ .../Include/GameClient/ParticleSys.h | 20 +++++ .../Source/GameClient/System/ParticleSys.cpp | 81 ++++++++++++++++++- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 20 +++++ .../ParticleEditor/ParticleEditorDialog.cpp | 72 +++++++++++++++++ .../ParticleEditor/VelocityTypePanels.cpp | 1 - 9 files changed, 309 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index e96ac4f994f..a0030a9b7f1 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -61,6 +61,10 @@ enum ParticleSystemID CPP_11(: Int) #define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing! #define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 ) +// TheSuperHackers @info The X and Y angles are not necessary for particles because there are only 2 placement modes: +// Billboard (always facing camera) and Ground Aligned, which overwrite any rotations on the X and Y axis by design. +// Therefore particles can only be rotated on the Z axis. Zero Hour never had X and Y angles, but Generals did. +#define PARTICLE_USE_XY_ROTATION (0) //-------------------------------------------------------------------------------------------------------------- @@ -122,11 +126,15 @@ class ParticleInfo : public Snapshot Coord3D m_emitterPos; ///< position of the emitter Real m_velDamping; ///< velocity damping coefficient +#if PARTICLE_USE_XY_ROTATION Real m_angleX; ///< initial angle around X axis Real m_angleY; ///< initial angle around Y axis +#endif Real m_angleZ; ///< initial angle around Z axis +#if PARTICLE_USE_XY_ROTATION Real m_angularRateX; ///< initial angle around X axis Real m_angularRateY; ///< initial angle around Y axis +#endif Real m_angularRateZ; ///< initial angle around Z axis Real m_angularDamping; ///< angular velocity damping coefficient @@ -278,11 +286,15 @@ class ParticleSystemInfo : public Snapshot AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name +#if PARTICLE_USE_XY_ROTATION GameClientRandomVariable m_angleX; ///< initial angle around X axis GameClientRandomVariable m_angleY; ///< initial angle around Y axis +#endif GameClientRandomVariable m_angleZ; ///< initial angle around Z axis +#if PARTICLE_USE_XY_ROTATION GameClientRandomVariable m_angularRateX; ///< initial angle around X axis GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis +#endif GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 728409dfcd9..1a4c3594764 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -68,9 +68,17 @@ ParticleSystemManager *TheParticleSystemManager = nullptr; // ------------------------------------------------------------------------------------------------ ParticleInfo::ParticleInfo( void ) { - m_angleX = m_angleY = m_angleZ = 0.0f; +#if PARTICLE_USE_XY_ROTATION + m_angleX = 0.0f; + m_angleY = 0.0f; +#endif + m_angleZ = 0.0f; +#if PARTICLE_USE_XY_ROTATION + m_angularRateX = 0.0f; + m_angularRateY = 0.0f; +#endif + m_angularRateZ = 0.0f; m_angularDamping = 0.0f; - m_angularRateX = m_angularRateY = m_angularRateZ = 0.0f; m_colorScale =0.0f; m_size = 0.0f; m_sizeRate = 0.0f; @@ -122,13 +130,24 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_velDamping ); // angle +#if PARTICLE_USE_XY_ROTATION xfer->xferReal( &m_angleX ); xfer->xferReal( &m_angleY ); +#else + Real tempAngle=0; //temporary value to save out for backwards compatibility when we supported x,y + xfer->xferReal( &tempAngle ); + xfer->xferReal( &tempAngle ); +#endif xfer->xferReal( &m_angleZ ); // angular rate +#if PARTICLE_USE_XY_ROTATION xfer->xferReal( &m_angularRateX ); xfer->xferReal( &m_angularRateY ); +#else + xfer->xferReal( &tempAngle ); + xfer->xferReal( &tempAngle ); +#endif xfer->xferReal( &m_angularRateZ ); // lifetime @@ -281,8 +300,10 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_vel = info->m_vel; m_pos = info->m_pos; +#if PARTICLE_USE_XY_ROTATION m_angleX = info->m_angleX; m_angleY = info->m_angleY; +#endif m_angleZ = info->m_angleZ; m_lastPos.zero(); @@ -290,9 +311,10 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_particleUpTowardsEmitter = info->m_particleUpTowardsEmitter; m_emitterPos = info->m_emitterPos; - +#if PARTICLE_USE_XY_ROTATION m_angularRateX = info->m_angularRateX; m_angularRateY = info->m_angularRateY; +#endif m_angularRateZ = info->m_angularRateZ; m_angularDamping = info->m_angularDamping; @@ -394,11 +416,15 @@ Bool Particle::update( void ) doWindMotion(); // update orientation +#if PARTICLE_USE_XY_ROTATION m_angleX += m_angularRateX; m_angleY += m_angularRateY; +#endif m_angleZ += m_angularRateZ; +#if PARTICLE_USE_XY_ROTATION m_angularRateX *= m_angularDamping; m_angularRateY *= m_angularDamping; +#endif m_angularRateZ *= m_angularDamping; if (m_particleUpTowardsEmitter) { @@ -841,13 +867,24 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferAsciiString( &m_particleTypeName ); // angles +#if PARTICLE_USE_XY_ROTATION xfer->xferUser( &m_angleX, sizeof( GameClientRandomVariable ) ); xfer->xferUser( &m_angleY, sizeof( GameClientRandomVariable ) ); +#else + GameClientRandomVariable tempRandom; //for backwards compatibility when we supported x,y + xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); + xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); +#endif xfer->xferUser( &m_angleZ, sizeof( GameClientRandomVariable ) ); // angular rate +#if PARTICLE_USE_XY_ROTATION xfer->xferUser( &m_angularRateX, sizeof( GameClientRandomVariable ) ); xfer->xferUser( &m_angularRateY, sizeof( GameClientRandomVariable ) ); +#else + xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); + xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); +#endif xfer->xferUser( &m_angularRateZ, sizeof( GameClientRandomVariable ) ); // angular damping @@ -1145,11 +1182,15 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, m_velDamping = sysTemplate->m_velDamping; +#if PARTICLE_USE_XY_ROTATION m_angleX = sysTemplate->m_angleX; m_angleY = sysTemplate->m_angleY; +#endif m_angleZ = sysTemplate->m_angleZ; +#if PARTICLE_USE_XY_ROTATION m_angularRateX = sysTemplate->m_angularRateX; m_angularRateY = sysTemplate->m_angularRateY; +#endif m_angularRateZ = sysTemplate->m_angularRateZ; m_angularDamping = sysTemplate->m_angularDamping; @@ -1829,11 +1870,15 @@ const ParticleInfo *ParticleSystem::generateParticleInfo( Int particleNum, Int p info.m_velDamping = m_velDamping.getValue(); info.m_angularDamping = m_angularDamping.getValue(); +#if PARTICLE_USE_XY_ROTATION info.m_angleX = m_angleX.getValue(); info.m_angleY = m_angleY.getValue(); +#endif info.m_angleZ = m_angleZ.getValue(); +#if PARTICLE_USE_XY_ROTATION info.m_angularRateX = m_angularRateX.getValue(); info.m_angularRateY = m_angularRateY.getValue(); +#endif info.m_angularRateZ = m_angularRateZ.getValue(); info.m_lifetime = (UnsignedInt)m_lifetime.getValue(); @@ -2352,11 +2397,15 @@ ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *master mergeInfo.m_sizeRate *= info->m_sizeRate; mergeInfo.m_sizeRateDamping *= info->m_sizeRateDamping; +#if PARTICLE_USE_XY_ROTATION mergeInfo.m_angleX = info->m_angleX; mergeInfo.m_angleY = info->m_angleY; +#endif mergeInfo.m_angleZ = info->m_angleZ; +#if PARTICLE_USE_XY_ROTATION mergeInfo.m_angularRateX = info->m_angularRateX; mergeInfo.m_angularRateY = info->m_angularRateY; +#endif mergeInfo.m_angularRateZ = info->m_angularRateZ; mergeInfo.m_angularDamping = info->m_angularDamping; @@ -2647,11 +2696,15 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, +#if PARTICLE_USE_XY_ROTATION { "AngleX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleX ) }, { "AngleY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleY ) }, +#endif { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, +#if PARTICLE_USE_XY_ROTATION { "AngularRateX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateX ) }, { "AngularRateY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateY ) }, +#endif { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index c1ec34fb967..d521d610c61 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -9111,6 +9111,7 @@ void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ) thisEntry.append(SEP_HEAD).append(F_TYPE).append(EQ_WITH_SPACES).append(ParticleTypeNames[templ->m_particleType]).append(SEP_EOL); thisEntry.append(SEP_HEAD).append(F_PARTICLENAME).append(EQ_WITH_SPACES).append(templ->m_particleTypeName.str()).append(SEP_EOL); +#if PARTICLE_USE_XY_ROTATION sprintf(buff1, FORMAT_STRING, templ->m_angleX.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angleX.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLEX).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); @@ -9118,11 +9119,13 @@ void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ) sprintf(buff1, FORMAT_STRING, templ->m_angleY.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angleY.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLEY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#endif sprintf(buff1, FORMAT_STRING, templ->m_angleZ.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angleZ.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLEZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#if PARTICLE_USE_XY_ROTATION sprintf(buff1, FORMAT_STRING, templ->m_angularRateX.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angularRateX.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLERATEX).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); @@ -9130,6 +9133,7 @@ void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ) sprintf(buff1, FORMAT_STRING, templ->m_angularRateY.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angularRateY.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLERATEY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#endif sprintf(buff1, FORMAT_STRING, templ->m_angularRateZ.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angularRateZ.getMaximumValue()); diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index cb5bfef2994..3f5b16ef72b 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -1342,22 +1342,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngleXMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMinimumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angleX.m_low = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngleYMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMinimumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angleY.m_low = atof(buff); +#endif } } @@ -1375,22 +1387,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngleXMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMaximumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angleX.m_high = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngleYMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMaximumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angleY.m_high = atof(buff); +#endif } } @@ -1408,22 +1432,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngularRateXMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMinimumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angularRateX.m_low = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngularRateYMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMinimumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angularRateY.m_low = atof(buff); +#endif } } @@ -1441,22 +1477,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngularRateXMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMaximumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angularRateX.m_high = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngularRateYMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMaximumValue()); +#else + sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); } else { +#if PARTICLE_USE_XY_ROTATION pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); m_particleSystem->m_angularRateY.m_high = atof(buff); +#endif } } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index 547fce613e0..9bd4c336a57 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -61,6 +61,10 @@ enum ParticleSystemID CPP_11(: Int) #define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing! #define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 ) +// TheSuperHackers @info The X and Y angles are not necessary for particles because there are only 2 placement modes: +// Billboard (always facing camera) and Ground Aligned, which overwrite any rotations on the X and Y axis by design. +// Therefore particles can only be rotated on the Z axis. Zero Hour never had X and Y angles, but Generals did. +#define PARTICLE_USE_XY_ROTATION (0) //-------------------------------------------------------------------------------------------------------------- @@ -122,7 +126,15 @@ class ParticleInfo : public Snapshot Coord3D m_emitterPos; ///< position of the emitter Real m_velDamping; ///< velocity damping coefficient +#if PARTICLE_USE_XY_ROTATION + Real m_angleX; ///< initial angle around X axis + Real m_angleY; ///< initial angle around Y axis +#endif Real m_angleZ; ///< initial angle around Z axis +#if PARTICLE_USE_XY_ROTATION + Real m_angularRateX; ///< initial angle around X axis + Real m_angularRateY; ///< initial angle around Y axis +#endif Real m_angularRateZ; ///< initial angle around Z axis Real m_angularDamping; ///< angular velocity damping coefficient @@ -274,7 +286,15 @@ class ParticleSystemInfo : public Snapshot AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name +#if PARTICLE_USE_XY_ROTATION + GameClientRandomVariable m_angleX; ///< initial angle around X axis + GameClientRandomVariable m_angleY; ///< initial angle around Y axis +#endif GameClientRandomVariable m_angleZ; ///< initial angle around Z axis +#if PARTICLE_USE_XY_ROTATION + GameClientRandomVariable m_angularRateX; ///< initial angle around X axis + GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis +#endif GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 5f8401d6b7a..4b12c1efb13 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -68,9 +68,17 @@ ParticleSystemManager *TheParticleSystemManager = nullptr; // ------------------------------------------------------------------------------------------------ ParticleInfo::ParticleInfo( void ) { +#if PARTICLE_USE_XY_ROTATION + m_angleX = 0.0f; + m_angleY = 0.0f; +#endif m_angleZ = 0.0f; - m_angularDamping = 0.0f; +#if PARTICLE_USE_XY_ROTATION + m_angularRateX = 0.0f; + m_angularRateY = 0.0f; +#endif m_angularRateZ = 0.0f; + m_angularDamping = 0.0f; m_colorScale =0.0f; m_size = 0.0f; m_sizeRate = 0.0f; @@ -122,14 +130,24 @@ void ParticleInfo::xfer( Xfer *xfer ) xfer->xferReal( &m_velDamping ); // angle +#if PARTICLE_USE_XY_ROTATION + xfer->xferReal( &m_angleX ); + xfer->xferReal( &m_angleY ); +#else Real tempAngle=0; //temporary value to save out for backwards compatibility when we supported x,y xfer->xferReal( &tempAngle ); xfer->xferReal( &tempAngle ); +#endif xfer->xferReal( &m_angleZ ); // angular rate +#if PARTICLE_USE_XY_ROTATION + xfer->xferReal( &m_angularRateX ); + xfer->xferReal( &m_angularRateY ); +#else xfer->xferReal( &tempAngle ); xfer->xferReal( &tempAngle ); +#endif xfer->xferReal( &m_angularRateZ ); // lifetime @@ -257,6 +275,10 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_vel = info->m_vel; m_pos = info->m_pos; +#if PARTICLE_USE_XY_ROTATION + m_angleX = info->m_angleX; + m_angleY = info->m_angleY; +#endif m_angleZ = info->m_angleZ; m_lastPos.zero(); @@ -264,7 +286,10 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) m_particleUpTowardsEmitter = info->m_particleUpTowardsEmitter; m_emitterPos = info->m_emitterPos; - +#if PARTICLE_USE_XY_ROTATION + m_angularRateX = info->m_angularRateX; + m_angularRateY = info->m_angularRateY; +#endif m_angularRateZ = info->m_angularRateZ; m_angularDamping = info->m_angularDamping; @@ -370,7 +395,15 @@ Bool Particle::update( void ) doWindMotion(); // update orientation +#if PARTICLE_USE_XY_ROTATION + m_angleX += m_angularRateX; + m_angleY += m_angularRateY; +#endif m_angleZ += m_angularRateZ; +#if PARTICLE_USE_XY_ROTATION + m_angularRateX *= m_angularDamping; + m_angularRateY *= m_angularDamping; +#endif m_angularRateZ *= m_angularDamping; if (m_particleUpTowardsEmitter) { @@ -380,8 +413,6 @@ Bool Particle::update( void ) emitterDir.x = m_pos.x - m_emitterPos.x; emitterDir.y = m_pos.y - m_emitterPos.y; m_angleZ = (angleBetween(&upVec, &emitterDir) + PI); - - } // update size @@ -798,14 +829,24 @@ void ParticleSystemInfo::xfer( Xfer *xfer ) xfer->xferAsciiString( &m_particleTypeName ); // angles +#if PARTICLE_USE_XY_ROTATION + xfer->xferUser( &m_angleX, sizeof( GameClientRandomVariable ) ); + xfer->xferUser( &m_angleY, sizeof( GameClientRandomVariable ) ); +#else GameClientRandomVariable tempRandom; //for backwards compatibility when we supported x,y xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); +#endif xfer->xferUser( &m_angleZ, sizeof( GameClientRandomVariable ) ); // angular rate +#if PARTICLE_USE_XY_ROTATION + xfer->xferUser( &m_angularRateX, sizeof( GameClientRandomVariable ) ); + xfer->xferUser( &m_angularRateY, sizeof( GameClientRandomVariable ) ); +#else xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); +#endif xfer->xferUser( &m_angularRateZ, sizeof( GameClientRandomVariable ) ); // angular damping @@ -1103,7 +1144,15 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, m_velDamping = sysTemplate->m_velDamping; +#if PARTICLE_USE_XY_ROTATION + m_angleX = sysTemplate->m_angleX; + m_angleY = sysTemplate->m_angleY; +#endif m_angleZ = sysTemplate->m_angleZ; +#if PARTICLE_USE_XY_ROTATION + m_angularRateX = sysTemplate->m_angularRateX; + m_angularRateY = sysTemplate->m_angularRateY; +#endif m_angularRateZ = sysTemplate->m_angularRateZ; m_angularDamping = sysTemplate->m_angularDamping; @@ -1783,7 +1832,15 @@ const ParticleInfo *ParticleSystem::generateParticleInfo( Int particleNum, Int p info.m_velDamping = m_velDamping.getValue(); info.m_angularDamping = m_angularDamping.getValue(); +#if PARTICLE_USE_XY_ROTATION + info.m_angleX = m_angleX.getValue(); + info.m_angleY = m_angleY.getValue(); +#endif info.m_angleZ = m_angleZ.getValue(); +#if PARTICLE_USE_XY_ROTATION + info.m_angularRateX = m_angularRateX.getValue(); + info.m_angularRateY = m_angularRateY.getValue(); +#endif info.m_angularRateZ = m_angularRateZ.getValue(); info.m_lifetime = (UnsignedInt)m_lifetime.getValue(); @@ -2298,7 +2355,15 @@ ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *master mergeInfo.m_sizeRate *= info->m_sizeRate; mergeInfo.m_sizeRateDamping *= info->m_sizeRateDamping; +#if PARTICLE_USE_XY_ROTATION + mergeInfo.m_angleX = info->m_angleX; + mergeInfo.m_angleY = info->m_angleY; +#endif mergeInfo.m_angleZ = info->m_angleZ; +#if PARTICLE_USE_XY_ROTATION + mergeInfo.m_angularRateX = info->m_angularRateX; + mergeInfo.m_angularRateY = info->m_angularRateY; +#endif mergeInfo.m_angularRateZ = info->m_angularRateZ; mergeInfo.m_angularDamping = info->m_angularDamping; @@ -2589,7 +2654,15 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, +#if PARTICLE_USE_XY_ROTATION + { "AngleX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleX ) }, + { "AngleY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleY ) }, +#endif { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, +#if PARTICLE_USE_XY_ROTATION + { "AngularRateX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateX ) }, + { "AngularRateY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateY ) }, +#endif { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 361c16ec4d8..30bc02b5779 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -9814,10 +9814,30 @@ void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ) thisEntry.append(SEP_HEAD).append(F_TYPE).append(EQ_WITH_SPACES).append(ParticleTypeNames[templ->m_particleType]).append(SEP_EOL); thisEntry.append(SEP_HEAD).append(F_PARTICLENAME).append(EQ_WITH_SPACES).append(templ->m_particleTypeName.str()).append(SEP_EOL); +#if PARTICLE_USE_XY_ROTATION + sprintf(buff1, FORMAT_STRING, templ->m_angleX.getMinimumValue()); + sprintf(buff2, FORMAT_STRING, templ->m_angleX.getMaximumValue()); + thisEntry.append(SEP_HEAD).append(F_ANGLEX).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); + + sprintf(buff1, FORMAT_STRING, templ->m_angleY.getMinimumValue()); + sprintf(buff2, FORMAT_STRING, templ->m_angleY.getMaximumValue()); + thisEntry.append(SEP_HEAD).append(F_ANGLEY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#endif + sprintf(buff1, FORMAT_STRING, templ->m_angleZ.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angleZ.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLEZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#if PARTICLE_USE_XY_ROTATION + sprintf(buff1, FORMAT_STRING, templ->m_angularRateX.getMinimumValue()); + sprintf(buff2, FORMAT_STRING, templ->m_angularRateX.getMaximumValue()); + thisEntry.append(SEP_HEAD).append(F_ANGLERATEX).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); + + sprintf(buff1, FORMAT_STRING, templ->m_angularRateY.getMinimumValue()); + sprintf(buff2, FORMAT_STRING, templ->m_angularRateY.getMaximumValue()); + thisEntry.append(SEP_HEAD).append(F_ANGLERATEY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); +#endif + sprintf(buff1, FORMAT_STRING, templ->m_angularRateZ.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_angularRateZ.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_ANGLERATEZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp index f0333c9bb23..ace9b9650fc 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp @@ -1342,16 +1342,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngleXMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMinimumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angleX.m_low = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngleYMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMinimumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angleY.m_low = atof(buff); +#endif } } @@ -1369,16 +1387,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngleXMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMaximumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angleX.m_high = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngleYMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMaximumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angleY.m_high = atof(buff); +#endif } } @@ -1396,16 +1432,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngularRateXMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMinimumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angularRateX.m_low = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngularRateYMin); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMinimumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angularRateY.m_low = atof(buff); +#endif } } @@ -1423,16 +1477,34 @@ void DebugWindowDialog::performUpdate( IN Bool toUI ) pWnd = GetDlgItem(IDC_PSEd_AngularRateXMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMaximumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angularRateX.m_high = atof(buff); +#endif } } pWnd = GetDlgItem(IDC_PSEd_AngularRateYMax); if (pWnd) { if (toUI) { +#if PARTICLE_USE_XY_ROTATION + sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMaximumValue()); +#else sprintf(buff, FORMAT_STRING, 0.0f); +#endif pWnd->SetWindowText(buff); + } else { +#if PARTICLE_USE_XY_ROTATION + pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); + m_particleSystem->m_angularRateY.m_high = atof(buff); +#endif } } diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp b/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp index b1dbfaa6df7..72da56265b8 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp +++ b/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp @@ -16,7 +16,6 @@ ** along with this program. If not, see . */ - // FILE: VelocityTypePanels.cpp /*---------------------------------------------------------------------------*/ /* EA Pacific */ From 69e3d6a475f85f55bcc7f1a645a0840b3029596c Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:51:08 +0100 Subject: [PATCH 132/211] unify(particlesys): Merge addition of SMUDGE particle type from Zero Hour (#2153) --- .../Include/GameClient/ParticleSys.h | 5 +++-- .../ParticleEditor/ParticleTypePanels.cpp | 1 + Generals/Code/Tools/ParticleEditor/Resource.h | 18 ++++++++++++++++++ .../Include/GameClient/ParticleSys.h | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h index a0030a9b7f1..92cbe71e17c 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -279,7 +279,7 @@ class ParticleSystemInfo : public Snapshot enum ParticleType { - INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? + INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? PARTICLE_TYPE_COUNT } m_particleType; @@ -471,7 +471,7 @@ static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICL static const char *const ParticleTypeNames[] = { - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", nullptr + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", "SMUDGE", nullptr }; static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); @@ -605,6 +605,7 @@ class ParticleSystem : public MemoryPoolObject, AsciiString getParticleTypeName( void ) { return m_particleTypeName; } ///< return the name of the particles Bool isUsingDrawables( void ) { return (m_particleType == DRAWABLE) ? true : false; } Bool isUsingStreak( void ) { return (m_particleType == STREAK) ? true : false; } + Bool isUsingSmudge( void ) { return (m_particleType == SMUDGE) ? true : false; } UnsignedInt getVolumeParticleDepth( void ) { return ( m_particleType == VOLUME_PARTICLE ) ? OPTIMUM_VOLUME_PARTICLE_DEPTH : 0; } Bool shouldBillboard( void ) { return !m_isGroundAligned; } diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp index 32a0439f485..ed7ed1750c3 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp +++ b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp @@ -70,6 +70,7 @@ void ParticlePanelParticle::InitPanel( void ) bWorkin = finder.FindNextFile(); pWnd->AddString(finder.GetFileName()); } + pWnd->AddString("SMUDGE RESERVED"); //smudges don't use textures so we're hardcoding one to tell them apart. } void ParticlePanelParticle::performUpdate( IN Bool toUI ) diff --git a/Generals/Code/Tools/ParticleEditor/Resource.h b/Generals/Code/Tools/ParticleEditor/Resource.h index 795c2d09ab8..bf7d6396bb6 100644 --- a/Generals/Code/Tools/ParticleEditor/Resource.h +++ b/Generals/Code/Tools/ParticleEditor/Resource.h @@ -1,3 +1,21 @@ +/* +** Command & Conquer Generals(tm) +** Copyright 2025 Electronic Arts 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 3 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see . +*/ + //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by ParticleEditor.rc diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index 9bd4c336a57..a6e4ab28bb7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -471,7 +471,7 @@ static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICL static const char *const ParticleTypeNames[] = { - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE","SMUDGE", nullptr + "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", "SMUDGE", nullptr }; static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); From e0befc802eeba68c44c50c83b72b1214252008c9 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:52:41 +0100 Subject: [PATCH 133/211] unify(particlesys): Merge optimization of alpha particle update from Zero Hour (#2153) --- .../Source/GameClient/System/ParticleSys.cpp | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 1a4c3594764..4a6e2a2d4a9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -455,26 +455,30 @@ Bool Particle::update( void ) m_sizeRate *= m_sizeRateDamping; // - // Update alpha + // Update alpha (if used) // - m_alpha += m_alphaRate; - if (m_alphaTargetKey < MAX_KEYFRAMES && m_alphaKey[ m_alphaTargetKey ].frame) + if (m_system->getShaderType() != ParticleSystemInfo::ADDITIVE) { - if (TheGameClient->getFrame() - m_createTimestamp >= m_alphaKey[ m_alphaTargetKey ].frame) + m_alpha += m_alphaRate; + + if (m_alphaTargetKey < MAX_KEYFRAMES && m_alphaKey[ m_alphaTargetKey ].frame) { - m_alpha = m_alphaKey[ m_alphaTargetKey ].value; - m_alphaTargetKey++; - computeAlphaRate(); + if (TheGameClient->getFrame() - m_createTimestamp >= m_alphaKey[ m_alphaTargetKey ].frame) + { + m_alpha = m_alphaKey[ m_alphaTargetKey ].value; + m_alphaTargetKey++; + computeAlphaRate(); + } } - } - else - m_alphaRate = 0.0f; + else + m_alphaRate = 0.0f; - if (m_alpha < 0.0f) - m_alpha = 0.0f; - else if (m_alpha > 1.0f) - m_alpha = 1.0f; + if (m_alpha < 0.0f) + m_alpha = 0.0f; + else if (m_alpha > 1.0f) + m_alpha = 1.0f; + } // From 13cce535a2f21cd0674d4adffeb9f8d695bb50d0 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:59:37 +0100 Subject: [PATCH 134/211] unify(particlesys): Merge fix for erroneous particle visibility thresholds in Particle::isInvisible from Generals (#2153) This merge fixes 13 broken particle effects in Zero Hour: airCarrierExplosion2 airCarrierHotPillarArms airCarrierJet01Explosion airCarrierJetExplosion1 airCarrierJetExplosion2 airCarrierJetExplosion3 ArmExplosionSmall01 BarrelExplosion BuggyNewExplosionArms FireBaseHowitzerPillarArms HotPillarArms MammothTankExplosionArms SpectreHotPillarArms --- .../GameEngine/Source/GameClient/System/ParticleSys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 4b12c1efb13..83d33d9d163 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -609,14 +609,14 @@ Bool Particle::isInvisible( void ) // check that we're not in the process of going to another color if (m_colorKey[ m_colorTargetKey ].frame == 0) { - if ((m_color.red + m_color.green + m_color.blue) <= 0.06f) + if (m_color.red < 0.01f && m_color.green < 0.01f && m_color.blue < 0.01f) return true; } return false; case ParticleSystemInfo::ALPHA: // if alpha is zero, this particle is invisible - if (m_alpha < 0.02f) + if (m_alpha < 0.01f) return true; return false; @@ -630,7 +630,7 @@ Bool Particle::isInvisible( void ) // check that we're not in the process of going to another color if (m_colorKey[ m_colorTargetKey ].frame == 0) { - if ((m_color.red * m_color.green * m_color.blue) > 0.95f) + if (m_color.red > 0.99f && m_color.green > 0.99f && m_color.blue > 0.99f) return true; } return false; From 68e17c038fd003c211f3c643cb2532231aeb89c1 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:02:57 +0100 Subject: [PATCH 135/211] unify(particlesys): Merge optimization for wind motion particle update when disabled from Zero Hour (#2153) --- .../Source/GameClient/System/ParticleSys.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 4a6e2a2d4a9..729558583e9 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -413,7 +413,11 @@ Bool Particle::update( void ) m_pos.z += m_vel.z + driftVel->z; // integrate the wind (if specified) into position - doWindMotion(); + ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion(); + + // see if we should even do anything + if( windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) + doWindMotion(); // update orientation #if PARTICLE_USE_XY_ROTATION @@ -548,11 +552,6 @@ Bool Particle::update( void ) // ------------------------------------------------------------------------------------------------ void Particle::doWindMotion( void ) { - ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion(); - - // see if we should even do anything - if( windMotion == ParticleSystemInfo::WIND_MOTION_NOT_USED ) - return; // get the angle of the wind Real windAngle = m_system->getWindAngle(); @@ -622,7 +621,7 @@ void Particle::doWindMotion( void ) windForceStrength *= (1.0f - ((distFromWind - fullForceDistance) / (noForceDistance - fullForceDistance))); - // integate the wind motion into the position + // integrate the wind motion into the position m_pos.x += (Cos( windAngle ) * windForceStrength); m_pos.y += (Sin( windAngle ) * windForceStrength); @@ -1954,7 +1953,8 @@ Bool ParticleSystem::update( Int localPlayerIndex ) } // update the wind motion - updateWindMotion(); + if (m_windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) + updateWindMotion(); // if this system is attached to a Drawable/Object, update the current transform // matrix so generated particles' are relative to the parent Drawable's From f5880713153784a7fc40c0096c3981df6ed01727 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:07:16 +0100 Subject: [PATCH 136/211] unify(particlesys): Merge changes to math for aligning particle Z rotation with emitter direction from Zero Hour (#2153) --- .../Source/GameClient/System/ParticleSys.cpp | 75 ++++++++----------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 729558583e9..7fde2459908 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -213,32 +213,7 @@ enum //todo move this somewhere more useful. -// ------------------------------------------------------------------------------------------------ -#if 0 -static Real angleBetween(const Coord2D &vecA, const Coord2D &vecB) -{ - Real lengthA = vecA->length(); - if (lengthA < FLT_EPSILON) { - return 0.0f; - } - - Real lengthB = vecB->length(); - if (lengthB < FLT_EPSILON) { - return 0.0f; - } - - Real dotProduct = (vecA->x * vecB->x + vecA->y * vecB->y); - - // If the dotproduct is 0.0, then they are orthogonal - if (dotProduct < FLT_EPSILON && dotProduct > -FLT_EPSILON) { - return vecB->x > 0.0f ? PI : 0.0f; - } - - Real cosTheta = dotProduct / (lengthA * lengthB); - Real theta = ACos(cosTheta); - return vecB->x > 0.0f ? theta : -theta; -} -#endif +static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB); /////////////////////////////////////////////////////////////////////////////////////////////////// // Particle /////////////////////////////////////////////////////////////////////////////////////// @@ -433,25 +408,11 @@ Bool Particle::update( void ) if (m_particleUpTowardsEmitter) { // adjust the up position back towards the particle + static const Coord2D upVec = { 0.0f, 1.0f }; Coord2D emitterDir; emitterDir.x = m_pos.x - m_emitterPos.x; emitterDir.y = m_pos.y - m_emitterPos.y; -#if 0 - static const Coord2D upVec = { 0.0f, 1.0f }; - m_angleZ = angleBetween(upVec, emitterDir) + PI; -#else - if (emitterDir.y < FLT_EPSILON && emitterDir.y > -FLT_EPSILON) { - m_angleZ = emitterDir.x > 0.0f ? PI + PI : PI; - } else { - Real emitterDirLength = emitterDir.length(); - if (emitterDirLength < FLT_EPSILON) { - m_angleZ = PI; - } else { - Real theta = ACos(emitterDir.y/emitterDirLength); - m_angleZ = emitterDir.x > 0.0f ? PI + theta : PI - theta; - } - } -#endif + m_angleZ = (angleBetween(&upVec, &emitterDir) + PI); } // update size @@ -3495,3 +3456,33 @@ void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp ) } // ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB) +{ + if (!(vecA && vecA->length() && vecB && vecB->length())) { + return 0.0; + } + + Real lengthA = vecA->length(); + Real lengthB = vecB->length(); + Real dotProduct = (vecA->x * vecB->x + vecA->y * vecB->y); + Real cosTheta = dotProduct / (lengthA * lengthB); + + // If the dotproduct is 0.0, then they are orthogonal + if (dotProduct == 0.0f) { + if (vecB->x > 0) { + return PI; + } + + return 0.0f; + } + + Real theta = ACos( cosTheta ); + + if (vecB->x > 0) { + return theta; + } + + return -theta; +} + From 5c4df79bdd8165dea5c7239f345566a5dcac3bf5 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:08:09 +0100 Subject: [PATCH 137/211] unify(particlesys): Merge minor refactors in ParticleSystem (#2153) --- .../GameEngine/Source/GameClient/System/ParticleSys.cpp | 9 ++------- .../Code/GameEngine/Include/GameClient/ParticleSys.h | 4 ++-- .../GameEngine/Source/GameClient/System/ParticleSys.cpp | 4 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 7fde2459908..85da15b0ce0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -1857,11 +1857,11 @@ const ParticleInfo *ParticleSystem::generateParticleInfo( Int particleNum, Int p if( m_accumulatedSizeBonus ) m_accumulatedSizeBonus = min( m_accumulatedSizeBonus, (float)MAX_SIZE_BONUS ); - int i=0; - for( ; i Date: Wed, 28 Jan 2026 20:16:50 +0100 Subject: [PATCH 138/211] refactor(view): Fix variable names in View::getScreenCornerWorldPointsAtZ() (#2201) --- Core/GameEngine/Include/GameClient/View.h | 2 +- Core/GameEngine/Source/GameClient/View.cpp | 37 ++++++++++--------- .../W3DDevice/Common/System/W3DRadar.cpp | 3 ++ .../Source/W3DDevice/GameClient/W3DView.cpp | 3 ++ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 2 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Core/GameEngine/Include/GameClient/View.h b/Core/GameEngine/Include/GameClient/View.h index 3bfff42c422..d03a160f211 100644 --- a/Core/GameEngine/Include/GameClient/View.h +++ b/Core/GameEngine/Include/GameClient/View.h @@ -118,7 +118,7 @@ class View : public Snapshot /** project the 4 corners of this view into the world and return each point as a parameter, the world points are at the requested Z */ virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, - Coord3D *bottomLeft, Coord3D *bottomRight, + Coord3D *bottomRight, Coord3D *bottomLeft, Real z ); virtual void setWidth( Int width ) { m_width = width; } diff --git a/Core/GameEngine/Source/GameClient/View.cpp b/Core/GameEngine/Source/GameClient/View.cpp index d529ff7255e..c9ad03c4239 100644 --- a/Core/GameEngine/Source/GameClient/View.cpp +++ b/Core/GameEngine/Source/GameClient/View.cpp @@ -226,35 +226,38 @@ void View::setLocation( const ViewLocation *location ) the world points are at the requested Z */ //------------------------------------------------------------------------------------------------- void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, - Coord3D *bottomLeft, Coord3D *bottomRight, + Coord3D *bottomRight, Coord3D *bottomLeft, Real z ) { - ICoord2D screenTopLeft, screenTopRight, screenBottomLeft, screenBottomRight; - ICoord2D origin; - Int viewWidth = getWidth(); - Int viewHeight = getHeight(); - // sanity - if( topLeft == nullptr || topRight == nullptr || bottomLeft == nullptr || bottomRight == nullptr ) + if( topLeft == nullptr || topRight == nullptr || bottomRight == nullptr || bottomLeft == nullptr) return; + ICoord2D screenTopLeft; + ICoord2D screenTopRight; + ICoord2D screenBottomRight; + ICoord2D screenBottomLeft; + ICoord2D origin; + const Int viewWidth = getWidth(); + const Int viewHeight = getHeight(); + // setup the screen coords for the 4 corners of the viewable display getOrigin( &origin.x, &origin.y ); - screenTopLeft.x = origin.x; // upper left - screenTopLeft.y = origin.y; // upper left - screenTopRight.x = origin.x + viewWidth; // upper right - screenTopRight.y = origin.y; // upper right - screenBottomLeft.x = origin.x + viewWidth; // lower right - screenBottomLeft.y = origin.y + viewHeight; // lower right - screenBottomRight.x = origin.x; // lower left - screenBottomRight.y = origin.y + viewHeight; // lower left + + screenTopLeft.x = origin.x; + screenTopLeft.y = origin.y; + screenTopRight.x = origin.x + viewWidth; + screenTopRight.y = origin.y; + screenBottomRight.x = origin.x + viewWidth; + screenBottomRight.y = origin.y + viewHeight; + screenBottomLeft.x = origin.x; + screenBottomLeft.y = origin.y + viewHeight; // project screenToWorldAtZ( &screenTopLeft, topLeft, z ); screenToWorldAtZ( &screenTopRight, topRight, z ); - screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); screenToWorldAtZ( &screenBottomRight, bottomRight, z ); - + screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); } // ------------------------------------------------------------------------------------------------ diff --git a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index f62d68654a3..065d725184d 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -183,6 +183,9 @@ void W3DRadar::reconstructViewBox( void ) Int i; // get the 4 points of the view corners in the 3D world at the average Z height in the map + // 1-------2 + // \ / + // 4---3 TheTacticalView->getScreenCornerWorldPointsAtZ( &world[ 0 ], &world[ 1 ], &world[ 2 ], diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index efd4c3a4d83..7d545f29ebc 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1418,6 +1418,9 @@ void W3DView::getAxisAlignedViewRegion(Region3D &axisAlignedRegion) // get the 4 points in 3D space of the 4 corners of the view, we will use a z = 0.0f // value so that we can get everything ... even stuff below the terrain // + // 1-------2 + // \ / + // 4---3 Coord3D box[ 4 ]; getScreenCornerWorldPointsAtZ( &box[ 0 ], &box[ 1 ], &box[ 2 ], &box[ 3 ], 0.0f ); diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 97f571864f9..7508a17af66 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -178,7 +178,7 @@ class PlaceholderView : public View virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) {}; ///< transform screen coord to a point on the 3D terrain virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) {}; ///< transform screen point to world point at the specified world Z value virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, - Coord3D *bottomLeft, Coord3D *bottomRight, + Coord3D *bottomRight, Coord3D *bottomLeft, Real z ){}; virtual void drawView( void ) {}; ///< Render the world visible in this view. diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 5bc1fe6671d..91d6c315ec0 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -178,7 +178,7 @@ class PlaceholderView : public View virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) {}; ///< transform screen coord to a point on the 3D terrain virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) {}; ///< transform screen point to world point at the specified world Z value virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, - Coord3D *bottomLeft, Coord3D *bottomRight, + Coord3D *bottomRight, Coord3D *bottomLeft, Real z ){}; virtual void drawView( void ) {}; ///< Render the world visible in this view. From 22d757fcc121f94991ef59a16de92d2ff0773c16 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 29 Jan 2026 18:50:44 +0100 Subject: [PATCH 139/211] unify(particlesys): Move ParticleSys and ParticleEditor files to Core (#2212) --- Core/GameEngine/CMakeLists.txt | 4 +- .../Include/GameClient/ParticleSys.h | 0 .../Source/GameClient/System/ParticleSys.cpp | 0 Core/Tools/CMakeLists.txt | 1 + .../Tools/ParticleEditor/CButtonShowColor.cpp | 0 .../Tools/ParticleEditor/CButtonShowColor.h | 0 .../ParticleEditor/CColorAlphaDialog.cpp | 0 .../Tools/ParticleEditor/CColorAlphaDialog.h | 0 .../Tools/ParticleEditor/CMakeLists.txt | 25 +- .../ParticleEditor/CParticleEditorPage.h | 0 .../Tools/ParticleEditor/CSwitchesDialog.cpp | 0 .../Tools/ParticleEditor/CSwitchesDialog.h | 0 .../ParticleEditor/EmissionTypePanels.cpp | 0 .../Tools/ParticleEditor/EmissionTypePanels.h | 0 .../Tools/ParticleEditor/ISwapablePanel.h | 0 .../Tools/ParticleEditor/MoreParmsDialog.cpp | 0 .../Tools/ParticleEditor/MoreParmsDialog.h | 0 .../Tools/ParticleEditor/ParticleEditor.cpp | 0 .../Tools/ParticleEditor/ParticleEditor.def | 0 .../Tools/ParticleEditor/ParticleEditor.h | 0 .../Tools/ParticleEditor/ParticleEditor.rc | 0 .../ParticleEditor/ParticleEditorDialog.cpp | 0 .../ParticleEditor/ParticleEditorDialog.h | 0 .../ParticleEditor/ParticleEditorExport.h | 0 .../ParticleEditor/ParticleTypePanels.cpp | 0 .../Tools/ParticleEditor/ParticleTypePanels.h | 0 .../Tools/ParticleEditor/Resource.h | 0 .../Tools/ParticleEditor/ShaderTypePanels.cpp | 0 .../Tools/ParticleEditor/ShaderTypePanels.h | 0 .../Tools/ParticleEditor/StdAfx.cpp | 0 .../Tools/ParticleEditor/StdAfx.h | 0 .../ParticleEditor/VelocityTypePanels.cpp | 0 .../Tools/ParticleEditor/VelocityTypePanels.h | 0 .../ParticleEditor/post-build-Release.bat | 0 .../Tools/ParticleEditor/post-build.bat | 0 .../ParticleEditor/res/ParticleEditor.rc2 | 0 Generals/CMakeLists.txt | 12 +- Generals/Code/GameEngine/CMakeLists.txt | 4 +- .../Include/GameClient/ParticleSys.h | 840 ---- .../Source/GameClient/System/ParticleSys.cpp | 3483 ----------------- Generals/Code/Tools/CMakeLists.txt | 1 - .../Tools/ParticleEditor/CButtonShowColor.cpp | 76 - .../Tools/ParticleEditor/CButtonShowColor.h | 43 - .../ParticleEditor/CColorAlphaDialog.cpp | 327 -- .../Tools/ParticleEditor/CColorAlphaDialog.h | 56 - .../Code/Tools/ParticleEditor/CMakeLists.txt | 55 - .../ParticleEditor/CParticleEditorPage.h | 33 - .../Tools/ParticleEditor/CSwitchesDialog.cpp | 136 - .../Tools/ParticleEditor/CSwitchesDialog.h | 42 - .../ParticleEditor/EmissionTypePanels.cpp | 426 -- .../Tools/ParticleEditor/EmissionTypePanels.h | 134 - .../Tools/ParticleEditor/ISwapablePanel.h | 50 - .../Tools/ParticleEditor/MoreParmsDialog.cpp | 677 ---- .../Tools/ParticleEditor/MoreParmsDialog.h | 60 - .../Tools/ParticleEditor/ParticleEditor.cpp | 422 -- .../Tools/ParticleEditor/ParticleEditor.h | 65 - .../ParticleEditor/ParticleEditorDialog.cpp | 1837 --------- .../ParticleEditor/ParticleEditorDialog.h | 317 -- .../ParticleEditor/ParticleEditorExport.h | 82 - .../ParticleEditor/ParticleTypePanels.cpp | 212 - .../Tools/ParticleEditor/ParticleTypePanels.h | 98 - Generals/Code/Tools/ParticleEditor/Resource.h | 205 - .../Tools/ParticleEditor/ShaderTypePanels.cpp | 35 - .../Tools/ParticleEditor/ShaderTypePanels.h | 39 - Generals/Code/Tools/ParticleEditor/StdAfx.cpp | 26 - Generals/Code/Tools/ParticleEditor/StdAfx.h | 74 - .../ParticleEditor/VelocityTypePanels.cpp | 517 --- .../Tools/ParticleEditor/VelocityTypePanels.h | 134 - GeneralsMD/CMakeLists.txt | 12 +- GeneralsMD/Code/GameEngine/CMakeLists.txt | 4 +- GeneralsMD/Code/Tools/CMakeLists.txt | 1 - .../Tools/ParticleEditor/ParticleEditor.def | 6 - .../Tools/ParticleEditor/ParticleEditor.rc | 648 --- .../ParticleEditor/post-build-Release.bat | 1 - .../Code/Tools/ParticleEditor/post-build.bat | 1 - .../ParticleEditor/res/ParticleEditor.rc2 | 13 - scripts/cpp/unify_move_files.py | 34 + 77 files changed, 65 insertions(+), 11203 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ParticleSys.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/System/ParticleSys.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CButtonShowColor.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CButtonShowColor.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CColorAlphaDialog.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CColorAlphaDialog.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CMakeLists.txt (53%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CParticleEditorPage.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CSwitchesDialog.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/CSwitchesDialog.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/EmissionTypePanels.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/EmissionTypePanels.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ISwapablePanel.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/MoreParmsDialog.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/MoreParmsDialog.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleEditor.cpp (100%) rename {Generals/Code => Core}/Tools/ParticleEditor/ParticleEditor.def (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleEditor.h (100%) rename {Generals/Code => Core}/Tools/ParticleEditor/ParticleEditor.rc (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleEditorDialog.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleEditorDialog.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleEditorExport.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleTypePanels.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ParticleTypePanels.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/Resource.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ShaderTypePanels.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/ShaderTypePanels.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/StdAfx.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/StdAfx.h (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/VelocityTypePanels.cpp (100%) rename {GeneralsMD/Code => Core}/Tools/ParticleEditor/VelocityTypePanels.h (100%) rename {Generals/Code => Core}/Tools/ParticleEditor/post-build-Release.bat (100%) rename {Generals/Code => Core}/Tools/ParticleEditor/post-build.bat (100%) rename {Generals/Code => Core}/Tools/ParticleEditor/res/ParticleEditor.rc2 (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ParticleSys.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/CButtonShowColor.h delete mode 100644 Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h delete mode 100644 Generals/Code/Tools/ParticleEditor/CMakeLists.txt delete mode 100644 Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h delete mode 100644 Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h delete mode 100644 Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ISwapablePanel.h delete mode 100644 Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleEditor.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h delete mode 100644 Generals/Code/Tools/ParticleEditor/Resource.h delete mode 100644 Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h delete mode 100644 Generals/Code/Tools/ParticleEditor/StdAfx.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/StdAfx.h delete mode 100644 Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp delete mode 100644 Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h delete mode 100644 GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def delete mode 100644 GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc delete mode 100644 GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat delete mode 100644 GeneralsMD/Code/Tools/ParticleEditor/post-build.bat delete mode 100644 GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 50636fc397f..e30907d3acb 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -212,7 +212,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Module/SwayClientUpdate.h # Include/GameClient/Mouse.h Include/GameClient/ParabolicEase.h -# Include/GameClient/ParticleSys.h + Include/GameClient/ParticleSys.h # Include/GameClient/PlaceEventTranslator.h # Include/GameClient/ProcessAnimateWindow.h # Include/GameClient/RadiusDecal.h @@ -828,7 +828,7 @@ set(GAMEENGINE_SRC Source/GameClient/System/Debug/AudioDebugDisplay.cpp # Source/GameClient/System/DebugDisplay.cpp # Source/GameClient/System/Image.cpp -# Source/GameClient/System/ParticleSys.cpp + Source/GameClient/System/ParticleSys.cpp # Source/GameClient/System/RayEffect.cpp Source/GameClient/System/Smudge.cpp Source/GameClient/Terrain/TerrainRoads.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/Core/GameEngine/Include/GameClient/ParticleSys.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h rename to Core/GameEngine/Include/GameClient/ParticleSys.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp rename to Core/GameEngine/Source/GameClient/System/ParticleSys.cpp diff --git a/Core/Tools/CMakeLists.txt b/Core/Tools/CMakeLists.txt index f2e820ad74b..0175ddaf1c7 100644 --- a/Core/Tools/CMakeLists.txt +++ b/Core/Tools/CMakeLists.txt @@ -3,6 +3,7 @@ # Build useful tool binaries. if(RTS_BUILD_CORE_TOOLS) add_subdirectory(DebugWindow) + add_subdirectory(ParticleEditor) endif() # Build less useful tool/test binaries. diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.cpp b/Core/Tools/ParticleEditor/CButtonShowColor.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.cpp rename to Core/Tools/ParticleEditor/CButtonShowColor.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.h b/Core/Tools/ParticleEditor/CButtonShowColor.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.h rename to Core/Tools/ParticleEditor/CButtonShowColor.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp b/Core/Tools/ParticleEditor/CColorAlphaDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp rename to Core/Tools/ParticleEditor/CColorAlphaDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/Core/Tools/ParticleEditor/CColorAlphaDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h rename to Core/Tools/ParticleEditor/CColorAlphaDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt b/Core/Tools/ParticleEditor/CMakeLists.txt similarity index 53% rename from GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt rename to Core/Tools/ParticleEditor/CMakeLists.txt index 7ddf4236472..61c879d51ff 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/Core/Tools/ParticleEditor/CMakeLists.txt @@ -26,32 +26,31 @@ set(PARTICLEED_SRC "VelocityTypePanels.h" ) -add_library(z_particleeditor SHARED) -set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") +add_library(core_particleeditor SHARED) +set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") -target_sources(z_particleeditor PRIVATE ${PARTICLEED_SRC}) +target_sources(core_particleeditor PRIVATE ${PARTICLEED_SRC}) -target_include_directories(z_particleeditor PRIVATE +target_include_directories(core_particleeditor PRIVATE include res ) -target_link_libraries(z_particleeditor PRIVATE +target_link_libraries(core_particleeditor PRIVATE core_debug core_profile + corei_always_no_pch + corei_gameengine_include corei_libraries_source_wwvegas corei_libraries_source_wwvegas_wwlib stlport - zi_always_no_pch - zi_gameengine_include - zi_libraries_source_wwvegas ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_link_options(z_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) - target_compile_definitions(z_particleeditor PRIVATE _AFXDLL) - target_sources(z_particleeditor PRIVATE ParticleEditor.rc) - set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) + target_link_options(core_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) + target_compile_definitions(core_particleeditor PRIVATE _AFXDLL) + target_sources(core_particleeditor PRIVATE ParticleEditor.rc) + set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) else() - set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME particleeditor) + set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME particleeditor) endif() diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h b/Core/Tools/ParticleEditor/CParticleEditorPage.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h rename to Core/Tools/ParticleEditor/CParticleEditorPage.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.cpp b/Core/Tools/ParticleEditor/CSwitchesDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.cpp rename to Core/Tools/ParticleEditor/CSwitchesDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h b/Core/Tools/ParticleEditor/CSwitchesDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h rename to Core/Tools/ParticleEditor/CSwitchesDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.cpp b/Core/Tools/ParticleEditor/EmissionTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.cpp rename to Core/Tools/ParticleEditor/EmissionTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h b/Core/Tools/ParticleEditor/EmissionTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h rename to Core/Tools/ParticleEditor/EmissionTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h b/Core/Tools/ParticleEditor/ISwapablePanel.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h rename to Core/Tools/ParticleEditor/ISwapablePanel.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.cpp b/Core/Tools/ParticleEditor/MoreParmsDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.cpp rename to Core/Tools/ParticleEditor/MoreParmsDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h b/Core/Tools/ParticleEditor/MoreParmsDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h rename to Core/Tools/ParticleEditor/MoreParmsDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp b/Core/Tools/ParticleEditor/ParticleEditor.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp rename to Core/Tools/ParticleEditor/ParticleEditor.cpp diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.def b/Core/Tools/ParticleEditor/ParticleEditor.def similarity index 100% rename from Generals/Code/Tools/ParticleEditor/ParticleEditor.def rename to Core/Tools/ParticleEditor/ParticleEditor.def diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.h b/Core/Tools/ParticleEditor/ParticleEditor.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.h rename to Core/Tools/ParticleEditor/ParticleEditor.h diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.rc b/Core/Tools/ParticleEditor/ParticleEditor.rc similarity index 100% rename from Generals/Code/Tools/ParticleEditor/ParticleEditor.rc rename to Core/Tools/ParticleEditor/ParticleEditor.rc diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Core/Tools/ParticleEditor/ParticleEditorDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp rename to Core/Tools/ParticleEditor/ParticleEditorDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/Core/Tools/ParticleEditor/ParticleEditorDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h rename to Core/Tools/ParticleEditor/ParticleEditorDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h b/Core/Tools/ParticleEditor/ParticleEditorExport.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h rename to Core/Tools/ParticleEditor/ParticleEditorExport.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.cpp b/Core/Tools/ParticleEditor/ParticleTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.cpp rename to Core/Tools/ParticleEditor/ParticleTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h b/Core/Tools/ParticleEditor/ParticleTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h rename to Core/Tools/ParticleEditor/ParticleTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/Resource.h b/Core/Tools/ParticleEditor/Resource.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/Resource.h rename to Core/Tools/ParticleEditor/Resource.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.cpp b/Core/Tools/ParticleEditor/ShaderTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.cpp rename to Core/Tools/ParticleEditor/ShaderTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.h b/Core/Tools/ParticleEditor/ShaderTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.h rename to Core/Tools/ParticleEditor/ShaderTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.cpp b/Core/Tools/ParticleEditor/StdAfx.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/StdAfx.cpp rename to Core/Tools/ParticleEditor/StdAfx.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h b/Core/Tools/ParticleEditor/StdAfx.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h rename to Core/Tools/ParticleEditor/StdAfx.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp b/Core/Tools/ParticleEditor/VelocityTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp rename to Core/Tools/ParticleEditor/VelocityTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h b/Core/Tools/ParticleEditor/VelocityTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h rename to Core/Tools/ParticleEditor/VelocityTypePanels.h diff --git a/Generals/Code/Tools/ParticleEditor/post-build-Release.bat b/Core/Tools/ParticleEditor/post-build-Release.bat similarity index 100% rename from Generals/Code/Tools/ParticleEditor/post-build-Release.bat rename to Core/Tools/ParticleEditor/post-build-Release.bat diff --git a/Generals/Code/Tools/ParticleEditor/post-build.bat b/Core/Tools/ParticleEditor/post-build.bat similarity index 100% rename from Generals/Code/Tools/ParticleEditor/post-build.bat rename to Core/Tools/ParticleEditor/post-build.bat diff --git a/Generals/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 b/Core/Tools/ParticleEditor/res/ParticleEditor.rc2 similarity index 100% rename from Generals/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 rename to Core/Tools/ParticleEditor/res/ParticleEditor.rc2 diff --git a/Generals/CMakeLists.txt b/Generals/CMakeLists.txt index 78f920244e6..bfacf3af3b6 100644 --- a/Generals/CMakeLists.txt +++ b/Generals/CMakeLists.txt @@ -48,14 +48,14 @@ if(RTS_INSTALL_PREFIX_GENERALS) install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() - if(TARGET g_particleeditor) - install(TARGETS g_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) + if(TARGET core_particleeditor) + install(TARGETS core_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() - if(TARGET g_debugwindow) - install(TARGETS g_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) + if(TARGET core_debugwindow) + install(TARGETS core_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() if(TARGET g_guiedit) diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 217d7dcecba..068df25e965 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -200,7 +200,7 @@ set(GAMEENGINE_SRC Include/GameClient/Module/BeaconClientUpdate.h Include/GameClient/Module/SwayClientUpdate.h Include/GameClient/Mouse.h - Include/GameClient/ParticleSys.h +# Include/GameClient/ParticleSys.h Include/GameClient/PlaceEventTranslator.h Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h @@ -773,7 +773,7 @@ set(GAMEENGINE_SRC # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" Source/GameClient/System/DebugDisplay.cpp Source/GameClient/System/Image.cpp - Source/GameClient/System/ParticleSys.cpp +# Source/GameClient/System/ParticleSys.cpp Source/GameClient/System/RayEffect.cpp # Source/GameClient/Terrain/TerrainRoads.cpp # Source/GameClient/Terrain/TerrainVisual.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h deleted file mode 100644 index 92cbe71e17c..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ /dev/null @@ -1,840 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// ParticleSys.h ////////////////////////////////////////////////////////////////////////////////// -// Particle System type definitions -// Author: Michael S. Booth, November 2001 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/AsciiString.h" -#include "Common/GameMemory.h" -#include "Common/GameType.h" -#include "Common/Snapshot.h" -#include "Common/SubsystemInterface.h" -#include "GameClient/ClientRandomValue.h" - -#include "WWMath/matrix3d.h" ///< @todo Replace with our own matrix library -#include "Common/STLTypedefs.h" - - -/// @todo Once the client framerate is decoupled, the frame counters within will have to become time-based - -class Particle; -class ParticleSystem; -class ParticleSystemManager; -class Drawable; -class Object; -struct FieldParse; -class INI; -class DebugWindowDialog; // really ParticleEditorDialog -class RenderInfoClass; // ick - -enum ParticleSystemID CPP_11(: Int) -{ - INVALID_PARTICLE_SYSTEM_ID = 0 -}; - -#define MAX_VOLUME_PARTICLE_DEPTH ( 16 ) -#define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing! -#define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 ) - -// TheSuperHackers @info The X and Y angles are not necessary for particles because there are only 2 placement modes: -// Billboard (always facing camera) and Ground Aligned, which overwrite any rotations on the X and Y axis by design. -// Therefore particles can only be rotated on the Z axis. Zero Hour never had X and Y angles, but Generals did. -#define PARTICLE_USE_XY_ROTATION (0) - -//-------------------------------------------------------------------------------------------------------------- - -enum { MAX_KEYFRAMES=8 }; - -struct Keyframe -{ - Real value; - UnsignedInt frame; -}; - -struct RGBColorKeyframe -{ - RGBColor color; - UnsignedInt frame; -}; - -enum ParticlePriorityType CPP_11(: Int) -{ - INVALID_PRIORITY = 0, - PARTICLE_PRIORITY_LOWEST = 1, -// FLUFF = PARTICLE_PRIORITY_LOWEST, ///< total and absolute fluff -// DEBRIS, ///< debris related particles -// NATURE, ///< neato effects we just might see in the world -// WEAPON, ///< Weapons firing and flying in the air -// DAMAGE, ///< taking damage/dying explosions -// SPECIAL, ///< super special top priority like a superweapon - - WEAPON_EXPLOSION = PARTICLE_PRIORITY_LOWEST, - SCORCHMARK, - DUST_TRAIL, - BUILDUP, - DEBRIS_TRAIL, - UNIT_DAMAGE_FX, - DEATH_EXPLOSION, - SEMI_CONSTANT, - CONSTANT, - WEAPON_TRAIL, - AREA_EFFECT, - CRITICAL, ///< super special top priority like a superweapon - ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc - // !!! *Noting* goes here ... special is the top priority !!! - NUM_PARTICLE_PRIORITIES, - PARTICLE_PRIORITY_HIGHEST = NUM_PARTICLE_PRIORITIES - 1, -}; - -/** - * This structure is filled out and passed to the constructor of a Particle to initialize it - */ -class ParticleInfo : public Snapshot -{ - -public: - - ParticleInfo( void ); - - Coord3D m_vel; ///< initial velocity - Coord3D m_pos; ///< initial position - Coord3D m_emitterPos; ///< position of the emitter - Real m_velDamping; ///< velocity damping coefficient - -#if PARTICLE_USE_XY_ROTATION - Real m_angleX; ///< initial angle around X axis - Real m_angleY; ///< initial angle around Y axis -#endif - Real m_angleZ; ///< initial angle around Z axis -#if PARTICLE_USE_XY_ROTATION - Real m_angularRateX; ///< initial angle around X axis - Real m_angularRateY; ///< initial angle around Y axis -#endif - Real m_angularRateZ; ///< initial angle around Z axis - Real m_angularDamping; ///< angular velocity damping coefficient - - UnsignedInt m_lifetime; ///< lifetime of this particle - - Real m_size; ///< size of the particle - Real m_sizeRate; ///< rate of change of size - Real m_sizeRateDamping; ///< damping of size change rate - - Keyframe m_alphaKey[ MAX_KEYFRAMES ]; - RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ]; - - Real m_colorScale; ///< color "scaling" coefficient - - Real m_windRandomness; ///< multiplier for wind randomness per particle - - Bool m_particleUpTowardsEmitter; ///< if this is true, then the 0.0 Z rotation should actually - ///< correspond to the direction of the emitter. - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - -}; - - -/** - * An individual particle created by a ParticleSystem. - * NOTE: Particles cannot exist without a parent particle system. - */ -class Particle : public MemoryPoolObject, - public ParticleInfo -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Particle, "ParticlePool" ) - -public: - - Particle( ParticleSystem *system, const ParticleInfo *data ); - - Bool update( void ); ///< update this particle's behavior - return false if dead - void doWindMotion( void ); ///< do wind motion (if present) from particle system - - void applyForce( const Coord3D *force ); ///< add the given acceleration - - const Coord3D *getPosition( void ) { return &m_pos; } - Real getSize( void ) { return m_size; } - Real getAngle( void ) { return m_angleZ; } - Real getAlpha( void ) { return m_alpha; } - const RGBColor *getColor( void ) { return &m_color; } - void setColor( RGBColor *color ) { m_color = *color; } - - Bool isInvisible( void ); ///< return true if this particle is invisible - Bool isCulled (void) {return m_isCulled;} ///< return true if the particle falls off the edge of the screen - void setIsCulled (Bool enable) { m_isCulled = enable;} ///< set particle to not visible because it's outside view frustum - - void controlParticleSystem( ParticleSystem *sys ) { m_systemUnderControl = sys; } - void detachControlledParticleSystem( void ) { m_systemUnderControl = nullptr; } - - // get priority of this particle ... which is the priority of the system it belongs to - ParticlePriorityType getPriority( void ); - - UnsignedInt getPersonality(void) { return m_personality; }; - void setPersonality(UnsignedInt p) { m_personality = p; }; - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - void computeAlphaRate( void ); ///< compute alpha rate to get to next key - void computeColorRate( void ); ///< compute color change to get to next key - -public: - Particle * m_systemNext; - Particle * m_systemPrev; - Particle * m_overallNext; - Particle * m_overallPrev; - -protected: - ParticleSystem * m_system; ///< the particle system this particle belongs to - UnsignedInt m_personality; ///< each new particle assigned a number one higher than the previous - - // most of the particle data is derived from ParticleInfo - - Coord3D m_accel; ///< current acceleration - Coord3D m_lastPos; ///< previous position - UnsignedInt m_lifetimeLeft; ///< lifetime remaining, if zero -> destroy - UnsignedInt m_createTimestamp; ///< frame this particle was created - - Real m_alpha; ///< current alpha of this particle - Real m_alphaRate; ///< current rate of alpha change - Int m_alphaTargetKey; ///< next index into key array - - RGBColor m_color; ///< current color of this particle - RGBColor m_colorRate; ///< current rate of color change - Int m_colorTargetKey; ///< next index into key array - - - Bool m_isCulled; ///< status of particle relative to screen bounds -public: - Bool m_inSystemList; - Bool m_inOverallList; - - union - { - ParticleSystem * m_systemUnderControl; ///< the particle system attached to this particle (not the system that created us) - ParticleSystemID m_systemUnderControlID; ///< id of system attached to this particle (not the system that created us); - }; - -}; - -/** - * All of the properties of a particle system, used by both ParticleSystemTemplates - * and ParticleSystem classes. - */ -class ParticleSystemInfo : public Snapshot -{ - -public: - - ParticleSystemInfo(); ///< to set defaults. - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - Bool m_isOneShot; ///< if true, destroy system after one burst has occurred - - enum ParticleShaderType - { - INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY, - PARTICLE_SHADER_TYPE_COUNT - } - m_shaderType; ///< how this particle is rendered - - enum ParticleType - { - INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? - PARTICLE_TYPE_COUNT - } - m_particleType; - - AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name - -#if PARTICLE_USE_XY_ROTATION - GameClientRandomVariable m_angleX; ///< initial angle around X axis - GameClientRandomVariable m_angleY; ///< initial angle around Y axis -#endif - GameClientRandomVariable m_angleZ; ///< initial angle around Z axis -#if PARTICLE_USE_XY_ROTATION - GameClientRandomVariable m_angularRateX; ///< initial angle around X axis - GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis -#endif - GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis - GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient - - GameClientRandomVariable m_velDamping; ///< velocity damping factor - - GameClientRandomVariable m_lifetime; ///< lifetime of emitted particles - UnsignedInt m_systemLifetime; ///< lifetime of the particle system - - GameClientRandomVariable m_startSize; ///< initial size of emitted particles - GameClientRandomVariable m_startSizeRate; ///< change in start size of emitted particles - GameClientRandomVariable m_sizeRate; ///< rate of change of size - GameClientRandomVariable m_sizeRateDamping; ///< damping of size change - - - UnsignedInt m_volumeParticleDepth; ///< how many layers deep to draw the particle, if >1 - - struct RandomKeyframe - { - GameClientRandomVariable var; ///< the range of values at this keyframe - UnsignedInt frame; ///< the frame number - }; - - - RandomKeyframe m_alphaKey[ MAX_KEYFRAMES ]; - RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ]; ///< color of particle - - typedef Int Color; - - void tintAllColors( Color tintColor ); - - GameClientRandomVariable m_colorScale; ///< color coefficient - - GameClientRandomVariable m_burstDelay; ///< time between particle emissions - GameClientRandomVariable m_burstCount; ///< number of particles emitted per burst - - GameClientRandomVariable m_initialDelay; ///< delay before particles begin emitting - - Coord3D m_driftVelocity; ///< additional velocity added to all particles - Real m_gravity; ///< gravity acceleration (global Z) for particles in this system - - AsciiString m_slaveSystemName; ///< if non-empty, create a system whose particles track this system's - Coord3D m_slavePosOffset; ///< positional offset of slave particles relative to master's - - AsciiString m_attachedSystemName; ///< if non-empty, create a system attached to each particle of this system - - //------------------------------------------------------- - // The direction and speed at which particles are emitted - enum EmissionVelocityType - { - INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD, - EMISSION_VELOCITY_TYPE_COUNT - } - m_emissionVelocityType; - - ParticlePriorityType m_priority; - - union - { - struct - { - GameClientRandomVariable x; ///< initial speed of particle along X axis - GameClientRandomVariable y; ///< initial speed of particle along Y axis - GameClientRandomVariable z; ///< initial speed of particle along Z axis - } - ortho; - - struct - { - GameClientRandomVariable speed; ///< initial speed of particle along random radial direction - } - spherical, hemispherical; - - struct - { - GameClientRandomVariable radial; ///< initial speed of particle in the disk - GameClientRandomVariable normal; ///< initial speed of particle perpendicular to disk - } - cylindrical; - - struct - { - GameClientRandomVariable speed; ///< speed outward from emission volume - GameClientRandomVariable otherSpeed; ///< speed along "other" axis, such as cylinder length - } - outward; - } - m_emissionVelocity; - - //---------------------------------------------------------- - // The volume of space where particles are initially created - // Note that the volume is relative to the system's position and orientation - enum EmissionVolumeType - { - INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER, - EMISSION_VOLUME_TYPE_COUNT - } - m_emissionVolumeType; ///< the type of volume where particles are created - - union emissionVolumeUnion - { - // point just uses system's position - - // line - struct - { - Coord3D start, end; - } - line; - - // box - struct - { - Coord3D halfSize; - } - box; - - // sphere - struct - { - Real radius; - } - sphere; - - // cylinder - struct - { - Real radius; - Real length; - } - cylinder; - } - m_emissionVolume; ///< the dimensions of the emission volume - - Bool m_isEmissionVolumeHollow; ///< if true, only create particles at boundary of volume - Bool m_isGroundAligned; ///< if true, align with the ground. if false, then do the normal billboarding. - Bool m_isEmitAboveGroundOnly; ///< if true, only emit particles when the system is above ground. - Bool m_isParticleUpTowardsEmitter; ///< if true, align the up direction to be towards the emitter. - - enum WindMotion - { - WIND_MOTION_INVALID = 0, - WIND_MOTION_NOT_USED, - WIND_MOTION_PING_PONG, - WIND_MOTION_CIRCULAR, - - WIND_MOTION_COUNT - }; - WindMotion m_windMotion; ///< motion of the wind angle updating - Real m_windAngle; ///< angle of the "wind" associated with this system - Real m_windAngleChange; ///< current how fast the angle changes (higher=faster change) - Real m_windAngleChangeMin; ///< min for angle change - Real m_windAngleChangeMax; ///< max for angle change - Real m_windMotionStartAngle; ///< (for ping pong) angle 1 of the ping pong - Real m_windMotionStartAngleMin; ///< (for ping pong) min angle for angle 1 - Real m_windMotionStartAngleMax; ///< (for ping pong) max angle for angle 1 - Real m_windMotionEndAngle; ///< (for ping pong) angle 2 of the ping pong - Real m_windMotionEndAngleMin; ///< (for ping pong) min angle for angle 2 - Real m_windMotionEndAngleMax; ///< (for ping pong) max angel for angle 2 - Byte m_windMotionMovingToEndAngle; ///< (for ping pong) TRUE if we're moving "towards" the end angle - -}; - -//-------------------------------------------------------------------------------------------------------------- - -#ifdef DEFINE_PARTICLE_SYSTEM_NAMES - -/**** NOTE: These MUST be kept in sync with the enumerations above *****/ - -static const char *const ParticleShaderTypeNames[] = -{ - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", nullptr -}; -static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const ParticleTypeNames[] = -{ - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", "SMUDGE", nullptr -}; -static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const EmissionVelocityTypeNames[] = -{ - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", nullptr -}; -static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const EmissionVolumeTypeNames[] = -{ - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", nullptr -}; -static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const ParticlePriorityNames[] = -{ - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", nullptr -}; -static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); - -static const char *const WindMotionNames[] = -{ - "NONE", "Unused", "PingPong", "Circular", nullptr -}; -static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); - -#endif - -/** - * A ParticleSystemTemplate, used by the ParticleSystemManager to instantiate ParticleSystems. - */ -class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystemInfo -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystemTemplate, "ParticleSystemTemplatePool" ) - -public: - ParticleSystemTemplate( const AsciiString &name ); - - AsciiString getName( void ) const { return m_name; } - - // This function was made const because of update modules' module data being all const. - ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-null, it is a slave system for use - - const FieldParse *getFieldParse( void ) const { return m_fieldParseTable; } ///< Parsing from INI access - static void parseRGBColorKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomRGBColor( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomRGBColorRate( INI* ini, void *instance, void *store, const void* /*userData*/ ); - -protected: - friend class ParticleSystemManager; ///< @todo remove this friendship - friend class ParticleSystem; ///< @todo remove this friendship - - // These friendships are naughty but necessary for particle editing. - friend class DebugWindowDialog; ///< @todo remove this friendship when no longer editing particles - friend void _updateAsciiStringParmsToSystem(ParticleSystemTemplate *particleTemplate); - friend void _updateAsciiStringParmsFromSystem(ParticleSystemTemplate *particleTemplate); - friend void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ); - - static const FieldParse m_fieldParseTable[]; ///< the parse table for INI definition - -protected: - AsciiString m_name; ///< the name of this template - - // This has to be mutable because of the delayed initialization thing in createSlaveSystem - mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-null, use this to create a slave system - - // template attribute data inherited from ParticleSystemInfo class -}; - -/** - * A particle system, responsible for creating Particles. - * If a particle system has finished, but still has particles "in the air", it must wait - * before destroying itself in order to ensure everything can be cleaned up if the system - * is reset. - */ -class ParticleSystem : public MemoryPoolObject, - public ParticleSystemInfo -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystem, "ParticleSystemPool" ) - -public: - - ParticleSystem( const ParticleSystemTemplate *sysTemplate, - ParticleSystemID id, - Bool createSlaves ); ///< create a particle system from a template and assign it this ID - - ParticleSystemID getSystemID( void ) const { return m_systemID; } ///< get unique system ID - - void setPosition( const Coord3D *pos ); ///< set the position of the particle system - void getPosition( Coord3D *pos ); ///< get the position of the particle system - void setLocalTransform( const Matrix3D *matrix ); ///< set the system's local transform - void rotateLocalTransformX( Real x ); ///< rotate local transform matrix - void rotateLocalTransformY( Real y ); ///< rotate local transform matrix - void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix - void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } /// ParticleSystemList; - typedef std::list::iterator ParticleSystemListIt; - typedef std::hash_map, rts::equal_to > TemplateMap; - - ParticleSystemManager( void ); - virtual ~ParticleSystemManager(); - - virtual void init( void ); ///< initialize the manager - virtual void reset( void ); ///< reset the manager and all particle systems - virtual void update( void ); ///< update all particle systems - - virtual Int getOnScreenParticleCount( void ) = 0; ///< returns the number of particles on screen - virtual void setOnScreenParticleCount(int count); - - ParticleSystemTemplate *findTemplate( const AsciiString &name ) const; - ParticleSystemTemplate *findParentTemplate( const AsciiString &name, int parentNum ) const; - ParticleSystemTemplate *newTemplate( const AsciiString &name ); - - /// given a template, instantiate a particle system - ParticleSystem *createParticleSystem( const ParticleSystemTemplate *sysTemplate, - Bool createSlaves = TRUE ); - - /** given a template, instantiate a particle system. - if attachTo is not null, attach the particle system to the given object. - return the particle system's ID, NOT its pointer. - */ - ParticleSystemID createAttachedParticleSystemID( const ParticleSystemTemplate *sysTemplate, - Object* attachTo, - Bool createSlaves = TRUE ); - - /// find a particle system given a unique system identifier - ParticleSystem *findParticleSystem( ParticleSystemID id ); - - /// destroy the particle system with the given id (if it still exists) - void destroyParticleSystemByID(ParticleSystemID id); - - /// return iterators to the particle system template - TemplateMap::iterator beginParticleSystemTemplate() { return m_templateMap.begin(); } - TemplateMap::iterator endParticleSystemTemplate() { return m_templateMap.end(); } - TemplateMap::const_iterator beginParticleSystemTemplate() const { return m_templateMap.begin(); } - TemplateMap::const_iterator endParticleSystemTemplate() const { return m_templateMap.end(); } - - /// destroy attached systems to object - void destroyAttachedSystems( Object *obj ); - - void setLocalPlayerIndex(Int index) {m_localPlayerIndex=index;} - void addParticle( Particle *particleToAdd, ParticlePriorityType priority ); - void removeParticle( Particle *particleToRemove ); - Int removeOldestParticles( UnsignedInt count, ParticlePriorityType priorityCap ); - UnsignedInt getParticleCount( void ) const { return m_particleCount; } - - UnsignedInt getFieldParticleCount( void ) const { return m_fieldParticleCount; } - - UnsignedInt getParticleSystemCount( void ) const { return m_particleSystemCount; } - - // @todo const this jkmcd - ParticleSystemList &getAllParticleSystems( void ) { return m_allParticleSystemList; } - - virtual void doParticles(RenderInfoClass &rinfo) = 0; - virtual void queueParticleRender() = 0; - - virtual void preloadAssets( TimeOfDay timeOfDay ); - - // these are only for use by partcle systems to link and unlink themselves - void friend_addParticleSystem( ParticleSystem *particleSystemToAdd ); - void friend_removeParticleSystem( ParticleSystem *particleSystemToRemove ); - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - Particle *m_allParticlesHead[ NUM_PARTICLE_PRIORITIES ]; - Particle *m_allParticlesTail[ NUM_PARTICLE_PRIORITIES ]; - - ParticleSystemID m_uniqueSystemID; ///< unique system ID to assign to each system created - - ParticleSystemList m_allParticleSystemList; - - UnsignedInt m_particleCount; - UnsignedInt m_fieldParticleCount; ///< this does not need to be xfered, since it is evaluated every frame - UnsignedInt m_particleSystemCount; - Int m_onScreenParticleCount; ///< number of particles displayed on screen per frame - UnsignedInt m_lastLogicFrameUpdate; - Int m_localPlayerIndex; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// ParticleSys.cpp //////////////////////////////////////////////////////////////////////////////// -// Particle System implementation -// Author: Michael S. Booth, November 2001 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#define DEFINE_PARTICLE_SYSTEM_NAMES - -#include "Common/GameState.h" -#include "Common/INI.h" -#include "Common/PerfTimer.h" -#include "Common/ThingFactory.h" -#include "Common/GameLOD.h" -#include "Common/Xfer.h" - -#include "GameClient/Drawable.h" -#include "GameClient/DebugDisplay.h" -#include "GameClient/Display.h" -#include "GameClient/GameClient.h" -#include "GameClient/InGameUI.h" -#include "GameClient/ParticleSys.h" - -#include "GameLogic/GameLogic.h" -#include "GameLogic/Object.h" -#include "GameLogic/TerrainLogic.h" - - -//------------------------------------------------------------------------------ Performance Timers -//#include "Common/PerfMetrics.h" -//#include "Common/PerfTimer.h" - -//static PerfTimer s_particleSys("ParticleSys::update", false, PERFMETRICS_LOGIC_STARTFRAME, PERFMETRICS_LOGIC_STOPFRAME); -//------------------------------------------------------------------------------------------------- - -// the singleton -ParticleSystemManager *TheParticleSystemManager = nullptr; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleInfo::ParticleInfo( void ) -{ -#if PARTICLE_USE_XY_ROTATION - m_angleX = 0.0f; - m_angleY = 0.0f; -#endif - m_angleZ = 0.0f; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = 0.0f; - m_angularRateY = 0.0f; -#endif - m_angularRateZ = 0.0f; - m_angularDamping = 0.0f; - m_colorScale =0.0f; - m_size = 0.0f; - m_sizeRate = 0.0f; - m_sizeRateDamping = 0.0f; - m_velDamping = 0.0f; - m_windRandomness = 0.0f; - - m_emitterPos.zero(); - m_pos.zero(); - m_vel.zero(); - - m_lifetime = 0; - m_particleUpTowardsEmitter = FALSE; - -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::xfer( Xfer *xfer ) -{ - Int i; - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // velocity - xfer->xferCoord3D( &m_vel ); - - // position - xfer->xferCoord3D( &m_pos ); - - // emitter position - xfer->xferCoord3D( &m_emitterPos ); - - // velocity damping - xfer->xferReal( &m_velDamping ); - - // angle -#if PARTICLE_USE_XY_ROTATION - xfer->xferReal( &m_angleX ); - xfer->xferReal( &m_angleY ); -#else - Real tempAngle=0; //temporary value to save out for backwards compatibility when we supported x,y - xfer->xferReal( &tempAngle ); - xfer->xferReal( &tempAngle ); -#endif - xfer->xferReal( &m_angleZ ); - - // angular rate -#if PARTICLE_USE_XY_ROTATION - xfer->xferReal( &m_angularRateX ); - xfer->xferReal( &m_angularRateY ); -#else - xfer->xferReal( &tempAngle ); - xfer->xferReal( &tempAngle ); -#endif - xfer->xferReal( &m_angularRateZ ); - - // lifetime - xfer->xferUnsignedInt( &m_lifetime ); - - // size - xfer->xferReal( &m_size ); - - // size rate - xfer->xferReal( &m_sizeRate ); - - // size rate damping - xfer->xferReal( &m_sizeRateDamping ); - - // alpha keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferReal( &m_alphaKey[ i ].value ); - xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - - } - - // color keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferRGBColor( &m_colorKey[ i ].color ); - xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - - } - - // color scale - xfer->xferReal( &m_colorScale ); - - // particle up towards emitter - xfer->xferBool( &m_particleUpTowardsEmitter ); - - // wind randomness - xfer->xferReal( &m_windRandomness ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::loadPostProcess( void ) -{ - -} - -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -enum -{ - MAX_SIZE_BONUS = 50 -}; - - -//todo move this somewhere more useful. -static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB); - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Particle /////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** Compute alpha rate to get to next key on given frame */ -// ------------------------------------------------------------------------------------------------ -void Particle::computeAlphaRate( void ) -{ - if (m_alphaKey[ m_alphaTargetKey ].frame == 0) - { - m_alphaRate = 0.0f; - return; - } - - Real delta = m_alphaKey[ m_alphaTargetKey ].value - m_alphaKey[ m_alphaTargetKey-1 ].value; - UnsignedInt time = m_alphaKey[ m_alphaTargetKey ].frame - m_alphaKey[ m_alphaTargetKey-1 ].frame; - - m_alphaRate = delta/time; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute color rate to get to next key on given frame */ -// ------------------------------------------------------------------------------------------------ -void Particle::computeColorRate( void ) -{ - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - m_colorRate.red = 0.0f; - m_colorRate.green = 0.0f; - m_colorRate.blue = 0.0f; - return; - } - - UnsignedInt time = m_colorKey[ m_colorTargetKey ].frame - m_colorKey[ m_colorTargetKey-1 ].frame; - Real delta = m_colorKey[ m_colorTargetKey ].color.red - m_colorKey[ m_colorTargetKey-1 ].color.red; - m_colorRate.red = delta/time; - - delta = m_colorKey[ m_colorTargetKey ].color.green - m_colorKey[ m_colorTargetKey-1 ].color.green; - m_colorRate.green = delta/time; - - delta = m_colorKey[ m_colorTargetKey ].color.blue - m_colorKey[ m_colorTargetKey-1 ].color.blue; - m_colorRate.blue = delta/time; -} - -// ------------------------------------------------------------------------------------------------ -/** Construct a particle from a particle template */ -// ------------------------------------------------------------------------------------------------ -Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) -{ - m_system = system; - - m_isCulled = FALSE; - m_accel.x = 0.0f; - m_accel.y = 0.0f; - m_accel.z = 0.0f; - - m_vel = info->m_vel; - m_pos = info->m_pos; - -#if PARTICLE_USE_XY_ROTATION - m_angleX = info->m_angleX; - m_angleY = info->m_angleY; -#endif - m_angleZ = info->m_angleZ; - - m_lastPos.zero(); - m_windRandomness = info->m_windRandomness; - m_particleUpTowardsEmitter = info->m_particleUpTowardsEmitter; - m_emitterPos = info->m_emitterPos; - -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = info->m_angularRateX; - m_angularRateY = info->m_angularRateY; -#endif - m_angularRateZ = info->m_angularRateZ; - m_angularDamping = info->m_angularDamping; - - m_velDamping = info->m_velDamping; - - m_lifetime = info->m_lifetime; - m_lifetimeLeft = info->m_lifetime; - m_createTimestamp = TheGameClient->getFrame(); - m_personality = 0; - - m_size = info->m_size; - m_sizeRate = info->m_sizeRate; - m_sizeRateDamping = info->m_sizeRateDamping; - - // set up alpha - int i=0; - for( ; im_alphaKey[i]; - - m_alpha = m_alphaKey[0].value; - m_alphaTargetKey = 1; - computeAlphaRate(); - - // set up colors - for( i=0; im_colorKey[i]; - - m_color = m_colorKey[0].color; - m_colorTargetKey = 1; - computeColorRate(); - - m_colorScale = info->m_colorScale; - - m_inSystemList = m_inOverallList = FALSE; - m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr; - - // add this particle to the global list, retaining particle creation order - TheParticleSystemManager->addParticle(this, system->getPriority() ); - - // add this particle to the Particle System list, retaining local creation order - m_system->addParticle(this); - - //DEBUG_ASSERTLOG(!(totalParticleCount % 100 == 0), ( "TotalParticleCount = %d", m_totalParticleCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Destructor */ -// ------------------------------------------------------------------------------------------------ -Particle::~Particle() -{ - // tell the particle system that this particle is gone - m_system->removeParticle( this ); - - // if this particle was controlling another particle system, destroy that system - if (m_systemUnderControl) - { - m_systemUnderControl->detachControlParticle( this ); - m_systemUnderControl->destroy(); - } - m_systemUnderControl = nullptr; - - // remove from the global list - TheParticleSystemManager->removeParticle(this); - - //DEBUG_ASSERTLOG(!(totalParticleCount % 100 == 0), ( "TotalParticleCount = %d", m_totalParticleCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Add the given acceleration */ -// ------------------------------------------------------------------------------------------------ -void Particle::applyForce( const Coord3D *force ) -{ - m_accel.x += force->x; - m_accel.y += force->y; - m_accel.z += force->z; -} - -// ------------------------------------------------------------------------------------------------ -/** Update the behavior of an individual particle */ -// ------------------------------------------------------------------------------------------------ -Bool Particle::update( void ) -{ - // integrate acceleration into velocity - m_vel.x += m_accel.x; - m_vel.y += m_accel.y; - m_vel.z += m_accel.z; - - m_vel.x *= m_velDamping; - m_vel.y *= m_velDamping; - m_vel.z *= m_velDamping; - - // integrate velocity into position - const Coord3D *driftVel = m_system->getDriftVelocity(); - m_pos.x += m_vel.x + driftVel->x; - m_pos.y += m_vel.y + driftVel->y; - m_pos.z += m_vel.z + driftVel->z; - - // integrate the wind (if specified) into position - ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion(); - - // see if we should even do anything - if( windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) - doWindMotion(); - - // update orientation -#if PARTICLE_USE_XY_ROTATION - m_angleX += m_angularRateX; - m_angleY += m_angularRateY; -#endif - m_angleZ += m_angularRateZ; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX *= m_angularDamping; - m_angularRateY *= m_angularDamping; -#endif - m_angularRateZ *= m_angularDamping; - - if (m_particleUpTowardsEmitter) { - // adjust the up position back towards the particle - static const Coord2D upVec = { 0.0f, 1.0f }; - Coord2D emitterDir; - emitterDir.x = m_pos.x - m_emitterPos.x; - emitterDir.y = m_pos.y - m_emitterPos.y; - m_angleZ = (angleBetween(&upVec, &emitterDir) + PI); - } - - // update size - m_size += m_sizeRate; - m_sizeRate *= m_sizeRateDamping; - - // - // Update alpha (if used) - // - - if (m_system->getShaderType() != ParticleSystemInfo::ADDITIVE) - { - m_alpha += m_alphaRate; - - if (m_alphaTargetKey < MAX_KEYFRAMES && m_alphaKey[ m_alphaTargetKey ].frame) - { - if (TheGameClient->getFrame() - m_createTimestamp >= m_alphaKey[ m_alphaTargetKey ].frame) - { - m_alpha = m_alphaKey[ m_alphaTargetKey ].value; - m_alphaTargetKey++; - computeAlphaRate(); - } - } - else - m_alphaRate = 0.0f; - - if (m_alpha < 0.0f) - m_alpha = 0.0f; - else if (m_alpha > 1.0f) - m_alpha = 1.0f; - } - - - // - // Update color - // - m_color.red += m_colorRate.red; - m_color.green += m_colorRate.green; - m_color.blue += m_colorRate.blue; - - if (m_colorTargetKey < MAX_KEYFRAMES && m_colorKey[ m_colorTargetKey ].frame) - { - if (TheGameClient->getFrame() - m_createTimestamp >= m_colorKey[ m_colorTargetKey ].frame) - { - // can't set, because of colorscale - // m_color = m_colorKey[ m_colorTargetKey ].color; - m_colorTargetKey++; - computeColorRate(); - } - } - else - { - m_colorRate.red = 0.0f; - m_colorRate.green = 0.0f; - m_colorRate.blue = 0.0f; - } - - /// @todo Rethink this - at least its name - m_color.red += m_colorScale; - m_color.green += m_colorScale; - m_color.blue += m_colorScale; - - if (m_color.red < 0.0f) - m_color.red = 0.0f; - else if (m_color.red > 1.0f) - m_color.red = 1.0f; - - if (m_color.red < 0.0f) - m_color.green = 0.0f; - else if (m_color.green > 1.0f) - m_color.green = 1.0f; - - if (m_color.blue < 0.0f) - m_color.blue = 0.0f; - else if (m_color.blue > 1.0f) - m_color.blue = 1.0f; - - - // reset the acceleration for accumulation next frame - m_accel.x = 0.0f; - m_accel.y = 0.0f; - m_accel.z = 0.0f; - - // monitor lifetime - if (m_lifetimeLeft && --m_lifetimeLeft == 0) - return false; - - DEBUG_ASSERTCRASH( m_lifetimeLeft, ( "A particle has an infinite lifetime..." )); - - // if we've gone totally invisible, destroy ourselves - if (isInvisible()) - return false; - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** Do wind motion as specified by the particle system template, if present */ -// ------------------------------------------------------------------------------------------------ -void Particle::doWindMotion( void ) -{ - - // get the angle of the wind - Real windAngle = m_system->getWindAngle(); - - // get the system position - Coord3D systemPos; - m_system->getPosition( &systemPos ); - - // when we're attached objects and drawables we offset by that position as well - if( ObjectID attachedObj = m_system->getAttachedObject() ) - { - Object *obj = TheGameLogic->findObjectByID( attachedObj ); - - if( obj ) - { - const Coord3D *objPos = obj->getPosition(); - - systemPos.x += objPos->x; - systemPos.y += objPos->y; - systemPos.z += objPos->z; - - } - - } - else if( DrawableID attachedDraw = m_system->getAttachedDrawable() ) - { - Drawable *draw = TheGameClient->findDrawableByID( attachedDraw ); - - if( draw ) - { - const Coord3D *drawPos = draw->getPosition(); - - systemPos.x += drawPos->x; - systemPos.y += drawPos->y; - systemPos.z += drawPos->z; - - } - - } - - // - // compute a vector from the system position in the world to the particle ... we will use - // this to compute how much force we apply - // - Coord3D v; - v.x = m_pos.x - systemPos.x; - v.y = m_pos.y - systemPos.y; - v.z = m_pos.z - systemPos.z; - - // distance amounts for full force from wind and no force at all - Real fullForceDistance = 75.0f; - Real noForceDistance = 200.0f; - - // - // given the distance from the wind position to the particle ... figure out how much - // force we're going to apply to it. When it's further away (outside of the full force - // distance) we will apply only a fraction of the force - // - - Real distFromWind = v.length(); - if( distFromWind < noForceDistance ) - { - Real windForceStrength = 2.0f * m_windRandomness; - - // only apply force if still within the circle of influence - if( distFromWind > fullForceDistance ) - windForceStrength *= (1.0f - ((distFromWind - fullForceDistance) / - (noForceDistance - fullForceDistance))); - - // integrate the wind motion into the position - m_pos.x += (Cos( windAngle ) * windForceStrength); - m_pos.y += (Sin( windAngle ) * windForceStrength); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Get priority of a particle ... which is the priority of it's attached system */ -// ------------------------------------------------------------------------------------------------ -ParticlePriorityType Particle::getPriority( void ) -{ - return m_system->getPriority(); -} - -// ------------------------------------------------------------------------------------------------ -/** Return true if this particle is invisible */ -// ------------------------------------------------------------------------------------------------ -Bool Particle::isInvisible( void ) -{ - switch (m_system->getShaderType()) - { - case ParticleSystemInfo::ADDITIVE: - // if color is black, this particle is invisible - - // check that we're not in the process of going to another color - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - if (m_color.red < 0.01f && m_color.green < 0.01f && m_color.blue < 0.01f) - return true; - } - return false; - - case ParticleSystemInfo::ALPHA: - // if alpha is zero, this particle is invisible - if (m_alpha < 0.01f) - return true; - return false; - - case ParticleSystemInfo::ALPHA_TEST: - // hmm... assume these particles are never invisible - return false; - - case ParticleSystemInfo::MULTIPLY: - // if color is white, this particle is invisible - - // check that we're not in the process of going to another color - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - if (m_color.red > 0.99f && m_color.green > 0.99f && m_color.blue > 0.99f) - return true; - } - return false; - } - - // should never get here - if we do, data is incorrect - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void Particle::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void Particle::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // base class particle info - ParticleInfo::xfer( xfer ); - - // personality - xfer->xferUnsignedInt( &m_personality ); - - // acceleration - xfer->xferCoord3D( &m_accel ); - - // last position - xfer->xferCoord3D( &m_lastPos ); - - // lifetime left - xfer->xferUnsignedInt( &m_lifetimeLeft ); - - // creation timestamp - xfer->xferUnsignedInt( &m_createTimestamp ); - - // alpha - xfer->xferReal( &m_alpha ); - - // alpha rate - xfer->xferReal( &m_alphaRate ); - - // alpha target key - xfer->xferInt( &m_alphaTargetKey ); - - // color - xfer->xferRGBColor( &m_color ); - - // color rate - xfer->xferRGBColor( &m_colorRate ); - - // color target key - xfer->xferInt( &m_colorTargetKey ); - - // drawable - DrawableID drawableID = INVALID_DRAWABLE_ID; - xfer->xferDrawableID( &drawableID ); //saving for backwards compatibility when we supported drawables. - - // system under control as an id - ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - xfer->xferUser( &systemUnderControlID, sizeof( ParticleSystemID ) ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void Particle::loadPostProcess( void ) -{ - - // call base class post process - ParticleInfo::loadPostProcess(); - - // tidy up the m_systemUnderControl pointer - if( m_systemUnderControlID != INVALID_PARTICLE_SYSTEM_ID ) - { - ParticleSystem *system; - - // find system - system = TheParticleSystemManager->findParticleSystem( m_systemUnderControlID ); - - // set us as the control particle for this system - system->setControlParticle( this ); - controlParticleSystem( system ); - - // sanity - if( m_systemUnderControlID == INVALID_PARTICLE_SYSTEM_ID ) - { - - DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); - throw SC_INVALID_DATA; - - } - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemInfo::ParticleSystemInfo() -{ - m_priority = PARTICLE_PRIORITY_LOWEST; - m_isGroundAligned = false; - m_isEmitAboveGroundOnly = false; - m_isParticleUpTowardsEmitter = false; - - m_driftVelocity.zero(); - m_gravity = 0.0f; - m_isEmissionVolumeHollow = FALSE; - m_isOneShot = FALSE; - m_slavePosOffset.zero(); - m_systemLifetime = 0; - - // some default values for the wind motion values - m_windMotion = WIND_MOTION_NOT_USED; - m_windAngle = 0.0f; - m_windAngleChange = 0.15f; // higher is ping pong faster - m_windAngleChangeMin = 0.15f; - m_windAngleChangeMax = 0.45f; - m_windMotionStartAngleMin = 0.0f; - m_windMotionStartAngleMax = PI / 4.0f; - m_windMotionStartAngle = m_windMotionStartAngleMin; - m_windMotionEndAngleMin = TWO_PI - (PI / 4.0f); - m_windMotionEndAngleMax = TWO_PI; - m_windMotionEndAngle = m_windMotionEndAngleMin; - m_windMotionMovingToEndAngle = TRUE; - m_volumeParticleDepth = DEFAULT_VOLUME_PARTICLE_DEPTH; - -} - - -void ParticleSystemInfo::tintAllColors( Color tintColor ) -{ - RGBColor rgb; - rgb.setFromInt(tintColor); - - //This tints all but the first colorKey!!! - for (int key = 1; key < MAX_KEYFRAMES; ++key ) - { - m_colorKey[ key ].color.red *= (Real)(rgb.red ) / 255.0f; - m_colorKey[ key ].color.green *= (Real)(rgb.green) / 255.0f; - m_colorKey[ key ].color.blue *= (Real)(rgb.blue ) / 255.0f; - } - -} - - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::xfer( Xfer *xfer ) -{ - Int i; - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // is one shot - xfer->xferBool( &m_isOneShot ); - - // shader type - xfer->xferUser( &m_shaderType, sizeof( ParticleShaderType ) ); - - // particle type - xfer->xferUser( &m_particleType, sizeof( ParticleType ) ); - - // particle type name - xfer->xferAsciiString( &m_particleTypeName ); - - // angles -#if PARTICLE_USE_XY_ROTATION - xfer->xferUser( &m_angleX, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_angleY, sizeof( GameClientRandomVariable ) ); -#else - GameClientRandomVariable tempRandom; //for backwards compatibility when we supported x,y - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); -#endif - xfer->xferUser( &m_angleZ, sizeof( GameClientRandomVariable ) ); - - // angular rate -#if PARTICLE_USE_XY_ROTATION - xfer->xferUser( &m_angularRateX, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_angularRateY, sizeof( GameClientRandomVariable ) ); -#else - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); -#endif - xfer->xferUser( &m_angularRateZ, sizeof( GameClientRandomVariable ) ); - - // angular damping - xfer->xferUser( &m_angularDamping, sizeof( GameClientRandomVariable ) ); - - // velocity damping - xfer->xferUser( &m_velDamping, sizeof( GameClientRandomVariable ) ); - - // lifetime - xfer->xferUser( &m_lifetime, sizeof( GameClientRandomVariable ) ); - - // system lifetime - xfer->xferUnsignedInt( &m_systemLifetime ); - - // start size - xfer->xferUser( &m_startSize, sizeof( GameClientRandomVariable ) ); - - // start size rate - xfer->xferUser( &m_startSizeRate, sizeof( GameClientRandomVariable ) ); - - // size rate - xfer->xferUser( &m_sizeRate, sizeof( GameClientRandomVariable ) ); - - // size rate damping - xfer->xferUser( &m_sizeRateDamping, sizeof( GameClientRandomVariable ) ); - - // alpha keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferUser( &m_alphaKey[ i ].var, sizeof( GameClientRandomVariable ) ); - xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - - } - - // color keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferRGBColor( &m_colorKey[ i ].color ); - xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - - } - - // color scale - xfer->xferUser( &m_colorScale, sizeof( GameClientRandomVariable ) ); - - // burst delay - xfer->xferUser( &m_burstDelay, sizeof( GameClientRandomVariable ) ); - - // burst count - xfer->xferUser( &m_burstCount, sizeof( GameClientRandomVariable ) ); - - // initial delay - xfer->xferUser( &m_initialDelay, sizeof( GameClientRandomVariable ) ); - - // drift velocity - xfer->xferCoord3D( &m_driftVelocity ); - - // gravity - xfer->xferReal( &m_gravity ); - - // slave system name - xfer->xferAsciiString( &m_slaveSystemName ); - - // slave position offset - xfer->xferCoord3D( &m_slavePosOffset ); - - // attached system name - xfer->xferAsciiString( &m_attachedSystemName ); - - // emission velocity type, this must come before m_emissionVelocity - xfer->xferUser( &m_emissionVelocityType, sizeof( EmissionVelocityType ) ); - - // particle priority - xfer->xferUser( &m_priority, sizeof( ParticlePriorityType ) ); - - // emission velocity - switch( m_emissionVelocityType ) - { - - // -------------------------------------------------------------------------------------------- - case ORTHO: - xfer->xferUser( &m_emissionVelocity.ortho.x, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.ortho.y, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.ortho.z, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case SPHERICAL: - xfer->xferUser( &m_emissionVelocity.spherical.speed, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case HEMISPHERICAL: - xfer->xferUser( &m_emissionVelocity.hemispherical.speed, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case CYLINDRICAL: - xfer->xferUser( &m_emissionVelocity.cylindrical.radial, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.cylindrical.normal, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case OUTWARD: - xfer->xferUser( &m_emissionVelocity.outward.speed, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.outward.otherSpeed, sizeof( GameClientRandomVariable ) ); - break; - - } - - // emission volume type - xfer->xferUser( &m_emissionVolumeType, sizeof( EmissionVolumeType ) ); - - // emission volume - switch( m_emissionVolumeType ) - { - - // -------------------------------------------------------------------------------------------- - case POINT: - // point has no data, it uses the systems position - break; - - // -------------------------------------------------------------------------------------------- - case LINE: - xfer->xferCoord3D( &m_emissionVolume.line.start ); - xfer->xferCoord3D( &m_emissionVolume.line.end ); - break; - - // -------------------------------------------------------------------------------------------- - case BOX: - xfer->xferCoord3D( &m_emissionVolume.box.halfSize ); - break; - - // -------------------------------------------------------------------------------------------- - case SPHERE: - xfer->xferReal( &m_emissionVolume.sphere.radius ); - break; - - // -------------------------------------------------------------------------------------------- - case CYLINDER: - xfer->xferReal( &m_emissionVolume.cylinder.radius ); - xfer->xferReal( &m_emissionVolume.cylinder.length ); - break; - - } - - // is emission volume hollow - xfer->xferBool( &m_isEmissionVolumeHollow ); - - // is ground aligned - xfer->xferBool( &m_isGroundAligned ); - - // emit above ground only - xfer->xferBool( &m_isEmitAboveGroundOnly ); - - // is particle up towards emitter - xfer->xferBool( &m_isParticleUpTowardsEmitter ); - - // wind motion - xfer->xferUser( &m_windMotion, sizeof( WindMotion ) ); - - // wind angle - xfer->xferReal( &m_windAngle ); - - // wind angle change - xfer->xferReal( &m_windAngleChange ); - - // wind angle change min - xfer->xferReal( &m_windAngleChangeMin ); - - // wind angle change max - xfer->xferReal( &m_windAngleChangeMax ); - - // wind motion start angle - xfer->xferReal( &m_windMotionStartAngle ); - - // wind motion start angle min - xfer->xferReal( &m_windMotionStartAngleMin ); - - // wind motion start angle max - xfer->xferReal( &m_windMotionStartAngleMax ); - - // wind motion end angle - xfer->xferReal( &m_windMotionEndAngle ); - - // wind motion end angle min - xfer->xferReal( &m_windMotionEndAngleMin ); - - // wind motion end angle max - xfer->xferReal( &m_windMotionEndAngleMax ); - - // wind motion moving to end angle - xfer->xferByte( &m_windMotionMovingToEndAngle ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::loadPostProcess( void ) -{ - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystem ///////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** Read particle system properties from given file */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, - ParticleSystemID id, - Bool createSlaves ) -{ - m_systemParticlesHead = m_systemParticlesTail = nullptr; - - m_isFirstPos = true; - m_template = sysTemplate; - m_systemID = id; - - m_lastPos.zero(); - m_pos.zero(); - m_velCoeff.zero(); - - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - m_attachedToObjectID = INVALID_ID; - - m_isLocalIdentity = true; - m_localTransform.Make_Identity(); - - m_isIdentity = true; - m_transform.Make_Identity(); - m_skipParentXfrm = false; - - m_isStopped = false; - m_isDestroyed = false; - m_isSaveable = true; - - m_slavePosOffset = sysTemplate->m_slavePosOffset; - - - ///@todo: further formalize this parameter with an UnsignedInt field in the editor - m_volumeParticleDepth = DEFAULT_VOLUME_PARTICLE_DEPTH; - - - m_driftVelocity = sysTemplate->m_driftVelocity; - - m_velCoeff.x = 1.0f; - m_velCoeff.y = 1.0f; - m_velCoeff.z = 1.0f; - m_countCoeff = 1.0f; - m_delayCoeff = 1.0f; - m_sizeCoeff = 1.0f; - - m_gravity = sysTemplate->m_gravity; - - m_lifetime = sysTemplate->m_lifetime; - m_startSize = sysTemplate->m_startSize; - m_startSizeRate = sysTemplate->m_startSizeRate; - m_sizeRate = sysTemplate->m_sizeRate; - m_sizeRateDamping = sysTemplate->m_sizeRateDamping; - - int i=0; - for( ; im_alphaKey[i]; - - for( i=0; im_colorKey[i]; - - /// @todo It is confusing to do this conversion here... - Real low = sysTemplate->m_colorScale.getMinimumValue(); - Real hi = sysTemplate->m_colorScale.getMaximumValue(); - m_colorScale.setRange( low / 255.0f, hi / 255.0f ); - - m_burstDelay = sysTemplate->m_burstDelay; - m_burstDelayLeft = 0; - - m_burstCount = sysTemplate->m_burstCount; - - m_isOneShot = sysTemplate->m_isOneShot; - - m_delayLeft = (UnsignedInt)sysTemplate->m_initialDelay.getValue(); - - m_startTimestamp = TheGameClient->getFrame(); - m_systemLifetimeLeft = sysTemplate->m_systemLifetime; - if (sysTemplate->m_systemLifetime) - m_isForever = false; - else - m_isForever = true; - - m_accumulatedSizeBonus = 0; - - m_velDamping = sysTemplate->m_velDamping; - -#if PARTICLE_USE_XY_ROTATION - m_angleX = sysTemplate->m_angleX; - m_angleY = sysTemplate->m_angleY; -#endif - m_angleZ = sysTemplate->m_angleZ; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = sysTemplate->m_angularRateX; - m_angularRateY = sysTemplate->m_angularRateY; -#endif - m_angularRateZ = sysTemplate->m_angularRateZ; - m_angularDamping = sysTemplate->m_angularDamping; - - m_priority = sysTemplate->m_priority; - - m_emissionVelocityType = sysTemplate->m_emissionVelocityType; - m_emissionVelocity = sysTemplate->m_emissionVelocity; - - m_emissionVolumeType = sysTemplate->m_emissionVolumeType; - m_emissionVolume = sysTemplate->m_emissionVolume; - - m_isEmissionVolumeHollow = sysTemplate->m_isEmissionVolumeHollow; - m_isGroundAligned = sysTemplate->m_isGroundAligned; - m_isEmitAboveGroundOnly = sysTemplate->m_isEmitAboveGroundOnly; - m_isParticleUpTowardsEmitter = sysTemplate->m_isParticleUpTowardsEmitter; - - m_windMotion = sysTemplate->m_windMotion; - m_windAngleChange = sysTemplate->m_windAngleChange; - m_windAngleChangeMin = sysTemplate->m_windAngleChangeMin; - m_windAngleChangeMax = sysTemplate->m_windAngleChangeMax; - m_windMotionStartAngleMin = sysTemplate->m_windMotionStartAngleMin; - m_windMotionStartAngleMax = sysTemplate->m_windMotionStartAngleMax; - m_windMotionEndAngleMin = sysTemplate->m_windMotionEndAngleMin; - m_windMotionEndAngleMax = sysTemplate->m_windMotionEndAngleMax; - m_windMotionMovingToEndAngle = sysTemplate->m_windMotionMovingToEndAngle; - m_windMotionStartAngle = GameClientRandomValueReal( m_windMotionStartAngleMin, m_windMotionStartAngleMax ); - m_windMotionEndAngle = GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - m_windAngle = GameClientRandomValueReal( m_windMotionStartAngle, m_windMotionEndAngle ); - - m_shaderType = sysTemplate->m_shaderType; - - m_particleType = sysTemplate->m_particleType; - m_particleTypeName = sysTemplate->m_particleTypeName; - - m_isStopped = false; - - // set up slave particle system, if any - m_masterSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_slaveSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_masterSystem = nullptr; - m_slaveSystem = nullptr; - if( createSlaves ) - { - ParticleSystem *slaveSystem = sysTemplate->createSlaveSystem(); - - if( slaveSystem ) - { - - setSlave( slaveSystem ); - m_slaveSystem->setMaster( this ); - - } - - } - - m_attachedSystemName = sysTemplate->m_attachedSystemName; - m_particleCount = 0; - m_personalityStore = 0; - m_controlParticle = nullptr; - - TheParticleSystemManager->friend_addParticleSystem(this); - - //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Destroy particle system and all of its particles */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem::~ParticleSystem() -{ - - // tell any of our slave systems that we are going away - if( m_slaveSystem ) - { - - DEBUG_ASSERTCRASH( m_slaveSystem->getMaster() == this, ("~ParticleSystem: Our slave doesn't have us as a master!") ); - m_slaveSystem->setMaster( nullptr ); - setSlave( nullptr ); - - } - - // tell any master system that *we* are going away - if( m_masterSystem ) - { - - DEBUG_ASSERTCRASH( m_masterSystem->getSlave() == this, ("~ParticleSystem: Our master doesn't have us as a slave!") ); - m_masterSystem->setSlave( nullptr ); - setMaster( nullptr ); - - } - - - // destroy all particles "in the air" - while (m_systemParticlesHead) - deleteInstance(m_systemParticlesHead); - - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - m_attachedToObjectID = INVALID_ID; - - // if this system was controlled by a particle, detach - if (m_controlParticle) - m_controlParticle->detachControlledParticleSystem(); - - m_controlParticle = nullptr; - - TheParticleSystemManager->friend_removeParticleSystem(this); - //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setMaster( ParticleSystem *master ) -{ - - m_masterSystem = master; - m_masterSystemID = master ? master->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setSlave( ParticleSystem *slave ) -{ - - m_slaveSystem = slave; - m_slaveSystemID = slave ? slave->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setSaveable(Bool b) -{ - m_isSaveable = b; - if (m_slaveSystem) - m_slaveSystem->setSaveable(b); -} - -// ------------------------------------------------------------------------------------------------ -/** (Re)start a stopped particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::start( void ) -{ - m_isStopped = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Stop a particle system from emitting */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::stop( void ) -{ - m_isStopped = true; -} - -// ------------------------------------------------------------------------------------------------ -/** Stop emitting, wait for all of our particles to die, then destroy self. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::destroy( void ) -{ - m_isDestroyed = true; - if( m_slaveSystem ) - { - m_slaveSystem->destroy(); // If we don't it will leak forever. We are solely responsible for it. - } -} - -// ------------------------------------------------------------------------------------------------ -/** Get the position of the particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::getPosition( Coord3D *pos ) -{ - Vector3 vec; - m_localTransform.Get_Translation(&vec); - if (pos) - { pos->x=vec.X; - pos->y=vec.Y; - pos->z=vec.Z; - } -} - -// ------------------------------------------------------------------------------------------------ -/** Set the position of the particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setPosition( const Coord3D *pos ) -{ - m_localTransform.Set_X_Translation( pos->x ); - m_localTransform.Set_Y_Translation( pos->y ); - m_localTransform.Set_Z_Translation( pos->z ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Set the system's local transform */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setLocalTransform( const Matrix3D *matrix ) -{ - m_localTransform = *matrix; - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformX( Real x ) -{ - m_localTransform.Rotate_X( x ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformY( Real y ) -{ - m_localTransform.Rotate_Y( y ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformZ( Real z ) -{ - m_localTransform.Rotate_Z( z ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Attach this particle system to a Drawable */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::attachToDrawable( const Drawable *draw ) -{ - if (draw) - m_attachedToDrawableID = draw->getID(); - else - m_attachedToDrawableID = INVALID_DRAWABLE_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Attach this particle system to a Drawable */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::attachToObject( const Object *obj ) -{ - if (obj) - m_attachedToObjectID = obj->getID(); - else - m_attachedToObjectID = INVALID_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a random point on a unit sphere - * @todo The density of random points generated is not uniform within the sphere */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computePointOnUnitSphere( void ) -{ - static Coord3D point; - - do - { - point.x = GameClientRandomValueReal( -1.0f, 1.0f ); - point.y = GameClientRandomValueReal( -1.0f, 1.0f ); - point.z = GameClientRandomValueReal( -1.0f, 1.0f ); - } - while (point.x == 0.0f && point.y == 0.0f && point.z == 0.0f); - - point.normalize(); - - return &point; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a velocity vector based on emission properties */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computeParticleVelocity( const Coord3D *pos ) -{ - static Coord3D newVel; - - switch( m_emissionVelocityType ) - { - case ORTHO: - newVel.x = m_emissionVelocity.ortho.x.getValue(); - newVel.y = m_emissionVelocity.ortho.y.getValue(); - newVel.z = m_emissionVelocity.ortho.z.getValue(); - break; - - case CYLINDRICAL: - { - Real radialSpeed, angle; - radialSpeed = m_emissionVelocity.cylindrical.radial.getValue(); - - angle = GameClientRandomValueReal( 0, 2.0f*PI ); - newVel.x = radialSpeed * cos( angle ); - newVel.y = radialSpeed * sin( angle ); - - newVel.z = m_emissionVelocity.cylindrical.normal.getValue(); - break; - } - - // "outward" velocity is directed along the surface normal of the emission volume - case OUTWARD: - { - Real speed = m_emissionVelocity.outward.speed.getValue(); - Real otherSpeed = m_emissionVelocity.outward.otherSpeed.getValue(); - Coord3D sysPos; - - /* - sysPos.x = m_localTransform.Get_X_Translation(); - sysPos.y = m_localTransform.Get_Y_Translation(); - sysPos.z = m_localTransform.Get_Z_Translation(); - */ - sysPos.x = 0.0f; - sysPos.y = 0.0f; - sysPos.z = 0.0f; - - switch( m_emissionVolumeType ) - { - case CYLINDER: - Coord2D disk; - - disk.x = pos->x - sysPos.x; - disk.y = pos->y - sysPos.y; - disk.normalize(); - - newVel.x = speed * disk.x; - newVel.y = speed * disk.y; - newVel.z = otherSpeed; - break; - - case BOX: ///< @todo Implement BOX OUTWARD velocity - case SPHERE: - { - newVel.x = pos->x - sysPos.x; - newVel.y = pos->y - sysPos.y; - newVel.z = pos->z - sysPos.z; - newVel.normalize(); - - newVel.x *= speed; - newVel.y *= speed; - newVel.z *= speed; - break; - } - - case LINE: - { - Coord3D along; // unit vector along line direction - - along.x = m_emissionVolume.line.end.x - m_emissionVolume.line.start.x; - along.y = m_emissionVolume.line.end.y - m_emissionVolume.line.start.y; - along.z = m_emissionVolume.line.end.z - m_emissionVolume.line.start.z; - along.normalize(); - - Coord3D perp; // unit vector perpendicular to the along/up plane - Coord3D up; // unit vector in the up direction (Z) - up.x = 0.0; - up.y = 0.0; - up.z = 1.0; - perp.crossProduct( &up, &along, &perp ); - up.crossProduct( &along, &perp, &up ); - - // "speed" is in 'horizontal' plane, and "otherSpeed" is 'vertical' - newVel.x = speed * perp.x + otherSpeed * up.x; - newVel.y = speed * perp.y + otherSpeed * up.y; - newVel.z = speed * perp.z + otherSpeed * up.z; - break; - } - - case POINT: - { - Coord3D vel = *computePointOnUnitSphere(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - } - - break; - } - - case SPHERICAL: - { - Real speed = m_emissionVelocity.spherical.speed.getValue(); - Coord3D vel = *computePointOnUnitSphere(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - - case HEMISPHERICAL: - { - Coord3D vel; - Real speed = m_emissionVelocity.spherical.speed.getValue(); - - do - { - vel.x = GameClientRandomValueReal( -1.0f, 1.0f ); - vel.y = GameClientRandomValueReal( -1.0f, 1.0f ); - vel.z = GameClientRandomValueReal( 0.0f, 1.0f ); - } - while (vel.x == 0.0f && vel.y == 0.0f && vel.z == 0.0f); - - vel.normalize(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - - default: - newVel.x = 0.0f; - newVel.y = 0.0f; - newVel.z = 0.0f; - break; - } - - // scale the velocity by the velocity multiplier - newVel.x *= m_velCoeff.x*(0.5f+TheGlobalData->m_particleScale/2.0f); - newVel.y *= m_velCoeff.y*(0.5f+TheGlobalData->m_particleScale/2.0f); - newVel.z *= m_velCoeff.z*(0.5f+TheGlobalData->m_particleScale/2.0f); - - return &newVel; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a position based on emission properties */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computeParticlePosition( void ) -{ - static Coord3D newPos; - - switch( m_emissionVolumeType ) - { - case CYLINDER: - { - Real angle = GameClientRandomValueReal( 0, 2.0f*PI ); - Real radius; - - if (m_isEmissionVolumeHollow) - radius = m_emissionVolume.cylinder.radius; - else - radius = GameClientRandomValueReal( 0.0f, m_emissionVolume.cylinder.radius ); - - newPos.x = radius * cos( angle ); - newPos.y = radius * sin( angle ); - - Real halfLength = m_emissionVolume.cylinder.length/2.0f; - newPos.z = GameClientRandomValueReal( -halfLength, halfLength ); - - break; - } - - case SPHERE: - { - Real radius; - - if (m_isEmissionVolumeHollow) - radius = m_emissionVolume.sphere.radius; - else - radius = GameClientRandomValueReal( 0.0f, m_emissionVolume.sphere.radius ); - - newPos = *computePointOnUnitSphere(); - - newPos.x *= radius; - newPos.y *= radius; - newPos.z *= radius; - - break; - } - - case BOX: - { - if (m_isEmissionVolumeHollow) { - // determine which side to generate on. - // 0 is bottom, 3 is top, - // 1 is left , 4 is right - // 2 is front, 5 is right back - - int side = GameClientRandomValue(0, 6); - if (side % 3 == 0) { - // generate X, Y - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - if (side == 0) { - newPos.z = -m_emissionVolume.box.halfSize.z; - } else { - newPos.z = m_emissionVolume.box.halfSize.z; - } - - } else if (side % 3 == 1) { - // generate Y, Z - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - if (side == 1) { - newPos.x = -m_emissionVolume.box.halfSize.x; - } else { - newPos.x = m_emissionVolume.box.halfSize.y; - } - - } else if (side % 3 == 2) { - // generate X, Z - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - if (side == 2) { - newPos.y = -m_emissionVolume.box.halfSize.y; - } else { - newPos.y = m_emissionVolume.box.halfSize.y; - } - } - } else { - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - } - break; - } - - case LINE: - { - Coord3D delta, start, end; - - start = m_emissionVolume.line.start; - end = m_emissionVolume.line.end; - - delta.x = end.x - start.x; - delta.y = end.y - start.y; - delta.z = end.z - start.z; - - Real t = GameClientRandomValueReal( 0.0f, 1.0f ); - - newPos.x = start.x + t * delta.x; - newPos.y = start.y + t * delta.y; - newPos.z = start.z + t * delta.z; - break; - } - - case POINT: - default: - newPos.x = 0.0f; - newPos.y = 0.0f; - newPos.z = 0.0f; - break; - } - newPos.x *= (0.5f+TheGlobalData->m_particleScale/2.0f); - newPos.y *= (0.5f+TheGlobalData->m_particleScale/2.0f); - newPos.z *= (0.5f+TheGlobalData->m_particleScale/2.0f); - return &newPos; -} - -// ------------------------------------------------------------------------------------------------ -/** Factory method for particles. */ -// ------------------------------------------------------------------------------------------------ -Particle *ParticleSystem::createParticle( const ParticleInfo *info, - ParticlePriorityType priority, - Bool forceCreate ) -{ - - // - // if we aren't absolutely forcing this particle to be created (which is needed when - // loading and creating particle systems from the save games) we need to check a few - // restrictions before this particle can really be created - // - if( forceCreate == FALSE ) - { - - if (TheGlobalData->m_useFX == FALSE) - return nullptr; - - // - // Enforce particle limit. - // If we are at the limit, destroy the oldest particle in order - // to make room for this one. - // - - // - // Check if particle is below priorities we allow for this FPS or if it being skipped because - // all particesl are being skipped (excluding special fps independent particles at - // getMinDynamicParticleSkipPriority()) - // - if( priority < TheGameLODManager->getMinDynamicParticlePriority() || - (priority < TheGameLODManager->getMinDynamicParticleSkipPriority() && - TheGameLODManager->isParticleSkipped()) ) - return nullptr; - - if ( getParticleCount() > 0 && priority == AREA_EFFECT && m_isGroundAligned && TheParticleSystemManager->getFieldParticleCount() > (UnsignedInt)TheGlobalData->m_maxFieldParticleCount ) - return nullptr; - - // ALWAYS_RENDER particles are exempt from all count limits, and are always created, regardless of LOD issues. - if (priority != ALWAYS_RENDER) - { - int numInExcess = TheParticleSystemManager->getParticleCount() - (UnsignedInt)TheGlobalData->m_maxParticleCount; - if ( numInExcess > 0) - { - if( TheParticleSystemManager->removeOldestParticles((UnsignedInt) numInExcess, priority) != numInExcess ) - return nullptr; // could not remove enough particles, don't create new stuff - } - - if (TheGlobalData->m_maxParticleCount == 0) - return nullptr; - } - - } - - Particle *p = newInstance(Particle)( this, info ); - return p; - -} - -// ------------------------------------------------------------------------------------------------ -/** Generate a new, random set of ParticleInfo - * particleNum and particleCount are used to get 'tween frame particles emitted in the correct - * place. (jkmcd) */ -// ------------------------------------------------------------------------------------------------ -const ParticleInfo *ParticleSystem::generateParticleInfo( Int particleNum, Int particleCount ) -{ - static ParticleInfo info; - if (particleCount == 0) { - DEBUG_CRASH(("particleCount must NOT be 0. Set to 1 or greater.")); - return &info; - } - - // NOTE: position MUST be computed before velocity, in case OUTWARD velocity is - // specified, which must know where the particle is in space. - info.m_pos = *computeParticlePosition(); - info.m_vel = *computeParticleVelocity( &info.m_pos ); - - // transform the position and velocity, if necessary - /// @todo Avoid conversion from Coord3D to Vector3 somehow - if (m_isIdentity == false) - { - // transform particle position to world coordinates - Vector3 p, pr; - - Coord3D emissionAdjustment; // this is the adjustment for inter-frame emission - // @todo : This should work, if m_lastPos = m_pos is removed from here but it doesn't. - // @todo : Investigate why. jkmcd - if (m_isFirstPos) { - m_lastPos = m_pos; - m_isFirstPos = false; - } - - emissionAdjustment.x = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.x - m_lastPos.x); - emissionAdjustment.y = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.y - m_lastPos.y); - emissionAdjustment.z = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.z - m_lastPos.z); - - p.X = info.m_pos.x; - p.Y = info.m_pos.y; - p.Z = info.m_pos.z; - -#ifdef ALLOW_TEMPORARIES - pr = m_transform * p; -#else - m_transform.mulVector3(p, pr); -#endif - - info.m_pos.x = pr.X - emissionAdjustment.x; - info.m_pos.y = pr.Y - emissionAdjustment.y; - info.m_pos.z = pr.Z - emissionAdjustment.z; - - // transform particle velocity to world coordinates - Vector3 v, vr; - - v.X = info.m_vel.x; - v.Y = info.m_vel.y; - v.Z = info.m_vel.z; - - Matrix3D::Rotate_Vector( m_transform, v, &vr ); - - info.m_vel.x = vr.X; - info.m_vel.y = vr.Y; - info.m_vel.z = vr.Z; - } - - info.m_velDamping = m_velDamping.getValue(); - info.m_angularDamping = m_angularDamping.getValue(); - -#if PARTICLE_USE_XY_ROTATION - info.m_angleX = m_angleX.getValue(); - info.m_angleY = m_angleY.getValue(); -#endif - info.m_angleZ = m_angleZ.getValue(); -#if PARTICLE_USE_XY_ROTATION - info.m_angularRateX = m_angularRateX.getValue(); - info.m_angularRateY = m_angularRateY.getValue(); -#endif - info.m_angularRateZ = m_angularRateZ.getValue(); - - info.m_lifetime = (UnsignedInt)m_lifetime.getValue(); - - info.m_size = m_startSize.getValue()*m_sizeCoeff*TheGlobalData->m_particleScale; - info.m_sizeRate = m_sizeRate.getValue()*m_sizeCoeff*TheGlobalData->m_particleScale; - info.m_sizeRateDamping = m_sizeRateDamping.getValue(); - - // Keeping a running tally makes each successive particle spawned start a bit bigger (or smaller). - info.m_size += m_accumulatedSizeBonus; - m_accumulatedSizeBonus += m_startSizeRate.getValue(); - if( m_accumulatedSizeBonus ) - m_accumulatedSizeBonus = min( m_accumulatedSizeBonus, (float)MAX_SIZE_BONUS ); - - for( int i=0; im_useFX == FALSE) - return false; - - // do initial delay ... note, this currently delays the lifetime - if (m_delayLeft) - { - --m_delayLeft; - - // system actually "starts" once initial delay is over - /// @todo reset start time when system is stopped/started - if (m_delayLeft == 0) - m_startTimestamp = TheGameClient->getFrame(); - - return true; - } - - // update the wind motion - if (m_windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) - updateWindMotion(); - - // if this system is attached to a Drawable/Object, update the current transform - // matrix so generated particles' are relative to the parent Drawable's - // position and orientation - Bool transformSet = false; - const Matrix3D *parentXfrm = nullptr; - Bool isShrouded = false; - - if (m_attachedToDrawableID) - { - Drawable *attachedTo = TheGameClient->findDrawableByID( m_attachedToDrawableID ); - - if (attachedTo) - { - if (attachedTo->getFullyObscuredByShroud()) - isShrouded = true; - - parentXfrm = attachedTo->getTransformMatrix(); - m_lastPos = m_pos; - m_pos = *attachedTo->getPosition(); - } - else - { - // Drawable has been destroyed - lose our attachment to it - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - - // destroy ourselves - destroy(); - } - } - else if (m_attachedToObjectID) - { - Object *objectAttachedTo = TheGameLogic->findObjectByID( m_attachedToObjectID ); - - if (objectAttachedTo) - { - if (!isShrouded) - isShrouded = (objectAttachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); - - const Drawable * draw = objectAttachedTo->getDrawable(); - if ( draw ) - parentXfrm = draw->getTransformMatrix(); - else - parentXfrm = objectAttachedTo->getTransformMatrix(); - - m_lastPos = m_pos; - m_pos = *objectAttachedTo->getPosition(); - } - else - { - // Drawable has been destroyed - lose our attachment to it - m_attachedToObjectID = INVALID_ID; - - // destroy ourselves - destroy(); - } - } - - if (parentXfrm) - { - if (m_skipParentXfrm) - { - //this particle system is already in world space so no need to apply parent xform. - m_transform = m_localTransform; - } - else - { - // if system has its own local transform, concatenate them - if (m_isLocalIdentity == false) - #ifdef ALLOW_TEMPORARIES - m_transform = (*parentXfrm) * m_localTransform; - #else - m_transform.mul(*parentXfrm, m_localTransform); - #endif - else - m_transform = *parentXfrm; - } - - m_isIdentity = false; - transformSet = true; - } - - - if (transformSet == false) - { - if (m_isLocalIdentity == false) - { - m_transform = m_localTransform; - m_isIdentity = false; - } - else - { - m_isIdentity = true; - } - } - - // if we are controlled by a particle, its position is local origin - if (m_controlParticle) - { - const Coord3D *controlPos = m_controlParticle->getPosition(); - /// @todo Concatenate this, instead of overriding (MSB) - m_transform.Set_X_Translation( controlPos->x ); - m_transform.Set_Y_Translation( controlPos->y ); - m_transform.Set_Z_Translation( controlPos->z ); - m_isIdentity = false; - m_lastPos = m_pos; - m_pos = *controlPos; - } - - - // - // Generate new particles if the system hasn't been 'stopped' or 'destroyed' - // If we are a slave system, do not generate particles ourselves - our master will force us to - // - if (m_isDestroyed == false) - { - if (m_isForever || (m_isForever == false && m_systemLifetimeLeft > 0)) - { - if (!isShrouded && m_isStopped == false && m_masterSystem == nullptr) - { - if (m_burstDelayLeft == 0) - { - ParticlePriorityType priority = getPriority(); - - // emit a burst of particles - Int count = REAL_TO_INT(m_burstCount.getValue()); - - count *= m_countCoeff; - - for( Int i=0; im_pos.z >= TheTerrainLogic->getGroundHeight(info->m_pos.x, info->m_pos.y))) - { - // actually create a particle - Particle *p = createParticle( info, priority ); - if (p == nullptr) - continue; - - if (m_attachedSystemName.isEmpty() == false) - { - const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( m_attachedSystemName ); - if (tmp) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( tmp, TRUE ); - sys->setControlParticle( p ); - p->controlParticleSystem( sys ); - } - } - - // create a slave particle, if necessary - if (m_slaveSystem) - { - ParticleInfo mergeInfo = ParticleSystem::mergeRelatedParticleSystems(this, m_slaveSystem, false); - - // create slaved particle - m_slaveSystem->createParticle( &mergeInfo, priority ); - } - } - } - - // compute next burst delay - m_burstDelayLeft = (UnsignedInt)m_burstDelay.getValue(); - m_burstDelayLeft *= m_delayCoeff; - } - else - { - m_burstDelayLeft--; - } - - } - } - } - - // - // Update all particles in the system - // - Particle *p = m_systemParticlesHead; - Particle *oldParticle; - while (p) - { - - // apply 'gravity' force - if (m_gravity != 0.0f) - { - Coord3D force; - force.x = 0.0f; - force.y = 0.0f; - force.z = m_gravity; - p->applyForce( &force ); - } - - if (p->update() == false) - { - oldParticle = p; - p = p->m_systemNext; - deleteInstance(oldParticle); - } else { - p = p->m_systemNext; - } - } - - // - // If we have been "destroyed", wait for all of our particles to die off, - // then destroy ourselves (return false). - // - if (m_isDestroyed && !m_systemParticlesHead) - return false; - - - // monitor particle system lifetime - if (m_isForever == false) - { - // decrement lifetime if not zero - if (m_systemLifetimeLeft) - m_systemLifetimeLeft--; - - // if there are still particles "in the air", don't destroy yet - if (getParticleCount()) - return true; - - // check if time is up - if (m_systemLifetimeLeft == 0) - return false; - } - - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** Update the wind motion */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::updateWindMotion( void ) -{ - - switch( m_windMotion ) - { - - // -------------------------------------------------------------------------------------------- - case ParticleSystemInfo::WIND_MOTION_PING_PONG: - { - Real startAngle = m_windMotionStartAngle; - Real endAngle = m_windMotionEndAngle; - - // this only works when start angle is less than end angle - DEBUG_ASSERTCRASH( startAngle < endAngle, ("updateWindMotion: startAngle must be < endAngle") ); - - // how big is the total angle span - Real totalSpan = endAngle - startAngle; - Real halfSpan = totalSpan / 2.0f; - - // given our current angle ... how far away from the "center" of the span are we - Real diffFromCenter = fabs( halfSpan - m_windAngle + startAngle ); - - // - // given our distance from the center ... we need to compute how much we will change - // the angle. When we are closer to the center we change it faster (more), and when - // we are near the edges we change is slower (less) - // - Real change = (1.0f - (diffFromCenter / halfSpan)) * m_windAngleChange; - - // we will always change a little bit - #define MINIMUM_CHANGE 0.005f // lower #'s have softer swings at the edge angles - if( change < MINIMUM_CHANGE ) - change = MINIMUM_CHANGE; - - // - // if we are moving toward the end angle we add the change, if we're moving away - // from it we subtract it - // - if( m_windMotionMovingToEndAngle ) - { - - // add angle - m_windAngle += change; - - // see if we're at the end and should switch directions - if( m_windAngle >= endAngle ) - { - - // change directions - m_windMotionMovingToEndAngle = FALSE; - - // pick a new change delta - m_windAngleChange = - GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // pick new start and end angles - m_windMotionStartAngle = - GameClientRandomValueReal( m_windMotionStartAngleMin, - m_windMotionStartAngleMax ); - m_windMotionEndAngle = - GameClientRandomValueReal( m_windMotionEndAngleMin, - m_windMotionEndAngleMax ); - - } - - } - else - { - - // subtract angle - m_windAngle -= change; - - // see if we're at the end and should switch directions - if( m_windAngle <= startAngle ) - { - - // change directions - m_windMotionMovingToEndAngle = TRUE; - - // pick a new change delta - m_windAngleChange = - GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // pick new start and end angles - m_windMotionStartAngle = - GameClientRandomValueReal( m_windMotionStartAngleMin, - m_windMotionStartAngleMax ); - m_windMotionEndAngle = - GameClientRandomValueReal( m_windMotionEndAngleMin, - m_windMotionEndAngleMax ); - - } - - } - - break; - - } - - // -------------------------------------------------------------------------------------------- - case ParticleSystemInfo::WIND_MOTION_CIRCULAR: - { - - // give us a wind angle change if one hasn't been specified (this plays nice with the particle editor) - if( m_windAngleChange == 0.0f ) - m_windAngleChange = GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // add to our wind angle - m_windAngle += m_windAngleChange; - - // keep in 0 to 2PI range just to keep the numbers safe and sane - if( m_windAngle > TWO_PI ) - m_windAngle -= TWO_PI; - else if( m_windAngle < 0.0f ) - m_windAngle += TWO_PI; - - break; - - } - - // --------------------------------------------------------------------------------------------- - default: - { - - break; - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::addParticle( Particle *particleToAdd ) -{ - if (particleToAdd->m_inSystemList) - return; - - if (!m_systemParticlesHead) - { - m_systemParticlesHead = particleToAdd; - } - - if (m_systemParticlesTail) - { - m_systemParticlesTail->m_systemNext = particleToAdd; - particleToAdd->m_systemPrev = m_systemParticlesTail; - } - else - { - particleToAdd->m_systemPrev = nullptr; - } - - m_systemParticlesTail = particleToAdd; - particleToAdd->m_systemNext = nullptr; - particleToAdd->m_inSystemList = TRUE; - - ++m_particleCount; - - particleToAdd->setPersonality( m_personalityStore++ ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Remove given particle from the list - ONLY FOR USE BY PARTICLE */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::removeParticle( Particle *particleToRemove ) -{ - if (!particleToRemove->m_inSystemList) - return; - - // remove links from prev & next objs - if (particleToRemove->m_systemNext) - particleToRemove->m_systemNext->m_systemPrev = particleToRemove->m_systemPrev; - if (particleToRemove->m_systemPrev) - particleToRemove->m_systemPrev->m_systemNext = particleToRemove->m_systemNext; - - // update head & tail if necessary - if (particleToRemove == m_systemParticlesHead) - m_systemParticlesHead = particleToRemove->m_systemNext; - if (particleToRemove == m_systemParticlesTail) - m_systemParticlesTail = particleToRemove->m_systemPrev; - - particleToRemove->m_systemNext = particleToRemove->m_systemPrev = nullptr; - particleToRemove->m_inSystemList = FALSE; - --m_particleCount; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *masterParticleSystem, ParticleSystem *slaveParticleSystem, Bool slaveNeedsFullPromotion) -{ - if (!masterParticleSystem || !slaveParticleSystem) { - DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was null. Should not happen. JKMCD")); - ParticleInfo bogus; - return bogus; - } - - // copy info - ParticleInfo mergeInfo = *masterParticleSystem->generateParticleInfo(1, 1); - - // generate one from the slave system - const ParticleInfo *info = slaveParticleSystem->generateParticleInfo(1, 1); - - // override unique attributes of slave particle - mergeInfo.m_lifetime = info->m_lifetime; - - // size becomes a scale factor of master's particles - mergeInfo.m_size *= info->m_size; - mergeInfo.m_sizeRate *= info->m_sizeRate; - mergeInfo.m_sizeRateDamping *= info->m_sizeRateDamping; - -#if PARTICLE_USE_XY_ROTATION - mergeInfo.m_angleX = info->m_angleX; - mergeInfo.m_angleY = info->m_angleY; -#endif - mergeInfo.m_angleZ = info->m_angleZ; -#if PARTICLE_USE_XY_ROTATION - mergeInfo.m_angularRateX = info->m_angularRateX; - mergeInfo.m_angularRateY = info->m_angularRateY; -#endif - mergeInfo.m_angularRateZ = info->m_angularRateZ; - mergeInfo.m_angularDamping = info->m_angularDamping; - - int i=0; - for( ; im_alphaKey[i]; - - for( i=0; im_colorKey[i]; - - mergeInfo.m_colorScale = info->m_colorScale; - - // offset slave's position relative to master's - const Coord3D *offset = slaveParticleSystem->getSlavePositionOffset(); - mergeInfo.m_pos.x += offset->x; - mergeInfo.m_pos.y += offset->y; - mergeInfo.m_pos.z += offset->z; - - if (slaveNeedsFullPromotion) { - slaveParticleSystem->m_burstCount = masterParticleSystem->m_burstCount; - slaveParticleSystem->m_burstDelay = masterParticleSystem->m_burstDelay; - - slaveParticleSystem->m_priority = masterParticleSystem->m_priority; - slaveParticleSystem->m_emissionVelocity = masterParticleSystem->m_emissionVelocity; - slaveParticleSystem->m_emissionVelocityType = masterParticleSystem->m_emissionVelocityType; - slaveParticleSystem->m_emissionVolume = masterParticleSystem->m_emissionVolume; - slaveParticleSystem->m_emissionVolumeType = masterParticleSystem->m_emissionVolumeType; - slaveParticleSystem->m_isEmissionVolumeHollow = masterParticleSystem->m_isEmissionVolumeHollow; - - - slaveParticleSystem->m_startSize.setRange(masterParticleSystem->m_startSize.getMinimumValue() * slaveParticleSystem->m_startSize.getMinimumValue(), - masterParticleSystem->m_startSize.getMaximumValue() * slaveParticleSystem->m_startSize.getMaximumValue(), - masterParticleSystem->m_startSize.getDistributionType()); - - slaveParticleSystem->m_sizeRate.setRange(masterParticleSystem->m_sizeRate.getMinimumValue() * slaveParticleSystem->m_sizeRate.getMinimumValue(), - masterParticleSystem->m_sizeRate.getMaximumValue() * slaveParticleSystem->m_sizeRate.getMaximumValue(), - masterParticleSystem->m_sizeRate.getDistributionType()); - - slaveParticleSystem->m_sizeRateDamping.setRange(masterParticleSystem->m_sizeRateDamping.getMinimumValue() * slaveParticleSystem->m_sizeRateDamping.getMinimumValue(), - masterParticleSystem->m_sizeRateDamping.getMaximumValue() * slaveParticleSystem->m_sizeRateDamping.getMaximumValue(), - masterParticleSystem->m_sizeRateDamping.getDistributionType()); - -// slaveParticleSystem->m_burstCount.setRange(masterParticleSystem->m_burstCount.getMinimumValue() / 2, -// masterParticleSystem->m_burstCount.getMaximumValue() / 2, -// masterParticleSystem->m_burstCount.getDistributionType()); - - } - - return mergeInfo; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setLifetimeRange( Real min, Real max ) -{ - m_lifetime.setRange( min, max ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setControlParticle( Particle *p ) -{ - m_controlParticle = p; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // base class info - ParticleSystemInfo::xfer( xfer ); - - // particle system ID - xfer->xferUser( &m_systemID, sizeof( ParticleSystemID ) ); - - // attached to drawable id - xfer->xferDrawableID( &m_attachedToDrawableID ); - - // attached to object id - xfer->xferObjectID( &m_attachedToObjectID ); - - // is local identity - xfer->xferBool( &m_isLocalIdentity ); - - // local transform - xfer->xferUser( &m_localTransform, sizeof( Matrix3D ) ); - - // is identity - xfer->xferBool( &m_isIdentity ); - - // transform - xfer->xferUser( &m_transform, sizeof( Matrix3D ) ); - - // burst delay left - xfer->xferUnsignedInt( &m_burstDelayLeft ); - - // delay left - xfer->xferUnsignedInt( &m_delayLeft ); - - // start timestamp - xfer->xferUnsignedInt( &m_startTimestamp ); - - // system lifetime left - xfer->xferUnsignedInt( &m_systemLifetimeLeft ); - - // personality store - xfer->xferUnsignedInt( &m_personalityStore ); - - // is forever - xfer->xferBool( &m_isForever ); - - // accumulated size bonus - xfer->xferReal( &m_accumulatedSizeBonus ); - - // is stopped - xfer->xferBool( &m_isStopped ); - - // we never save destroyed particle systems so there is no need to consider m_isDestroyed - // m_isDestroyed <-- do nothing with me - - // ditto for m_isSaveable - // m_isSaveable <-- do nothing with me - - // velCoeff - xfer->xferCoord3D( &m_velCoeff ); - - // count coeff - xfer->xferReal( &m_countCoeff ); - - // delay coeff - xfer->xferReal( &m_delayCoeff ); - - // size coeff - xfer->xferReal( &m_sizeCoeff ); - - // position - xfer->xferCoord3D( &m_pos ); - - // last position - xfer->xferCoord3D( &m_lastPos ); - - // is first pos - xfer->xferBool( &m_isFirstPos ); - - // slave system id - xfer->xferUser( &m_slaveSystemID, sizeof( ParticleSystemID ) ); - - // master system - xfer->xferUser( &m_masterSystemID, sizeof( ParticleSystemID ) ); - - // particle count - UnsignedInt particleCount = m_particleCount; - xfer->xferUnsignedInt( &particleCount ); - - // particles - if( xfer->getXferMode() == XFER_SAVE ) - { - Particle *particle; - - // go through all particles in this system - for( particle = m_systemParticlesHead; particle; particle = particle->m_systemNext ) - { - - // write particle information - xfer->xferSnapshot( particle ); - - } - - } - else - { - ParticlePriorityType priority = getPriority(); - const ParticleInfo *info = generateParticleInfo( 0, 1 ); - Particle *particle; - - // read each particle data block - for( UnsignedInt i = 0; i < particleCount; ++i ) - { - - // create a new particle - particle = createParticle( info, priority, TRUE ); - - // sanity - DEBUG_ASSERTCRASH( particle, ("ParticleSystem::xfer - Unable to create particle for loading") ); - - // read in the particle data - xfer->xferSnapshot( particle ); - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::loadPostProcess( void ) -{ - - // call base class post process - ParticleSystemInfo::loadPostProcess(); - - // reconnect slave pointers if needed - if( m_slaveSystemID != INVALID_PARTICLE_SYSTEM_ID ) - { - - // sanity - if( m_slaveSystem != nullptr ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not null but should be" )); - throw SC_INVALID_DATA; - - } - - // assign system - m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); - - // sanity - if( m_slaveSystem == nullptr || m_slaveSystem->isDestroyed() == TRUE ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is null or destroyed" )); - throw SC_INVALID_DATA; - - } - - } - - // reconnect master pointers if needed - if( m_masterSystemID != INVALID_PARTICLE_SYSTEM_ID ) - { - - // sanity - if( m_masterSystem != nullptr ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not null but should be" )); - throw SC_INVALID_DATA; - - } - - // assign system - m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); - - // sanity - if( m_masterSystem == nullptr || m_masterSystem->isDestroyed() == TRUE ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is null or destroyed" )); - throw SC_INVALID_DATA; - - } - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystemTemplate ///////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** INI parse data */ -// ------------------------------------------------------------------------------------------------ -const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = -{ - { "Priority", INI::parseIndexList, ParticlePriorityNames, offsetof( ParticleSystemTemplate, m_priority ) }, - { "IsOneShot", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isOneShot ) }, - { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, - { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, - { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, -#if PARTICLE_USE_XY_ROTATION - { "AngleX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleX ) }, - { "AngleY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleY ) }, -#endif - { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, -#if PARTICLE_USE_XY_ROTATION - { "AngularRateX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateX ) }, - { "AngularRateY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateY ) }, -#endif - { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, - { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, - - { "VelocityDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_velDamping ) }, - { "Gravity", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_gravity ) }, - { "SlaveSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, - { "SlavePosOffset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, - { "PerParticleAttachedSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, - - { "Lifetime", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_lifetime ) }, - { "SystemLifetime", INI::parseUnsignedInt, nullptr, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, - - { "Size", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSize ) }, - { "StartSizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, - { "SizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRate ) }, - { "SizeRateDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, - - { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, - { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, - { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, - { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, - { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, - { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, - { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, - { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, - - { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, - { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, - { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, - { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, - { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, - { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, - { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, - { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, - -// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, nullptr, offsetof( ParticleSystemTemplate, m_color ) }, - { "ColorScale", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_colorScale ) }, - - { "BurstDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstDelay ) }, - { "BurstCount", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstCount ) }, - - { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_initialDelay ) }, - - { "DriftVelocity", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, - { "VelocityType", INI::parseIndexList, EmissionVelocityTypeNames, offsetof( ParticleSystemTemplate, m_emissionVelocityType ) }, - { "VelOrthoX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, - { "VelOrthoY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, - { "VelOrthoZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, - - { "VelSpherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, - { "VelHemispherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, - - { "VelCylindricalRadial", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, - { "VelCylindricalNormal", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, - - { "VelOutward", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, - { "VelOutwardOther", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, - - { "VolumeType", INI::parseIndexList, EmissionVolumeTypeNames, offsetof( ParticleSystemTemplate, m_emissionVolumeType ) }, - { "VolLineStart", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, - { "VolLineEnd", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, - - { "VolBoxHalfSize", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, - - { "VolSphereRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, - - { "VolCylinderRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, - { "VolCylinderLength", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, - - { "IsHollow", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, - { "IsGroundAligned", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, - { "IsEmitAboveGroundOnly", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, - { "IsParticleUpTowardsEmitter", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, - - { "WindMotion", INI::parseIndexList, WindMotionNames, offsetof( ParticleSystemTemplate, m_windMotion ) }, - - { "WindAngleChangeMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, - { "WindAngleChangeMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, - - { "WindPingPongStartAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, - { "WindPingPongStartAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, - - { "WindPingPongEndAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, - { "WindPingPongEndAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, - - - { nullptr, nullptr, nullptr, 0 }, -}; - -// ------------------------------------------------------------------------------------------------ -/** Parse a "random keyframe". - * The format is "FIELD = low high frame". */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRandomKeyframe( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ - RandomKeyframe *key = static_cast(store); - - Real low = ini->scanReal(ini->getNextToken()); - Real high = ini->scanReal(ini->getNextToken()); - key->frame = ini->scanUnsignedInt(ini->getNextToken()); - - // set the range of the random variable - key->var.setRange( low, high ); -} - -// ------------------------------------------------------------------------------------------------ -/** Parse a "color keyframe". - * The format is "FIELD = R:r G:g B:b frame". */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRGBColorKeyframe( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ - RGBColorKeyframe *key = static_cast(store); - - INI::parseRGBColor( ini, instance, &key->color, nullptr ); - INI::parseUnsignedInt( ini, instance, &key->frame, nullptr ); -} - -// ------------------------------------------------------------------------------------------------ -/** Parse a RandomVariable RGB color. - * Note that the components may be negative, as this is used for rates, as well. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ -#if 0 - char seps[] = " \n\r\t=:RGB,"; - const char *token; - Int colors[2][3]; - Int result; - - enum { LO = 0, HI = 1 }; - enum { RED = 0, GREEN = 1, BLUE = 2 }; - - // initialize to invalid values - colors[ LO ][ RED ] = -1; - colors[ LO ][ GREEN ] = -1; - colors[ LO ][ BLUE ] = -1; - colors[ HI ][ RED ] = -1; - colors[ HI ][ GREEN ] = -1; - colors[ HI ][ BLUE ] = -1; - - // do each color part - for( Int i = 0; i < 3; i++ ) - { - for( Int j = 0; j < 2; j++ ) - { - // get the color number - token = ini->getNextToken(seps); - - // convert to number - colors[j][i] = ini->scanInt(token); - - // check to see if it's within range - if( colors[j][i] < -255 || colors[j][i] > 255 ) - throw INI_INVALID_DATA; - - } - } - - // assign the color components to the "RGBColor" pointer at 'store' - ParticleSystemInfo::RandomRGBColor *theColor = (ParticleSystemInfo::RandomRGBColor *)store; - - theColor->red.setRange( (Real)colors[ LO ][ RED ] / 255.0f, (Real)colors[ HI ][ RED ] / 255.0f ); - theColor->green.setRange( (Real)colors[ LO ][ GREEN ] / 255.0f, (Real)colors[ HI ][ GREEN ] / 255.0f ); - theColor->blue.setRange( (Real)colors[ LO ][ BLUE ] / 255.0f, (Real)colors[ HI ][ BLUE ] / 255.0f ); -#endif -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate::ParticleSystemTemplate( const AsciiString &name ) : - m_name(name) -{ - m_slaveTemplate = nullptr; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate::~ParticleSystemTemplate() -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** If returns non-null, it is a slave system for use ... the create slaves parameter - * tells *this* slave system whether or not it should create any slaves itself - * automatically during its own constructor */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemTemplate::createSlaveSystem( Bool createSlaves ) const -{ - if (m_slaveTemplate == nullptr && m_slaveSystemName.isEmpty() == false) - m_slaveTemplate = TheParticleSystemManager->findTemplate( m_slaveSystemName ); - - ParticleSystem *slave = nullptr; - if (m_slaveTemplate) - slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves ); - - return slave; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystemManager ////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemManager::ParticleSystemManager( void ) -{ - - m_uniqueSystemID = INVALID_PARTICLE_SYSTEM_ID; - - m_onScreenParticleCount = 0; - m_localPlayerIndex = 0; - - m_lastLogicFrameUpdate = 0; - m_particleCount = 0; - m_fieldParticleCount = 0; - m_particleSystemCount = 0; - - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemManager::~ParticleSystemManager() -{ - reset(); - - TemplateMap::iterator begin(m_templateMap.begin()); - TemplateMap::iterator end(m_templateMap.end()); - for (; begin != end; ++begin) { - deleteInstance((*begin).second); - } -} - -// ------------------------------------------------------------------------------------------------ -/** Initialize the manager */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::init( void ) -{ - /// Read INI data and build templates - INI ini; - ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, nullptr ); - - // sanity, our lists must be empty!! - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("INIT: ParticleSystem all particles head[%d] is not null!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not null!", i) ); - - // just to be clean set them to nullptr - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Reset the manager and all particle systems */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::reset( void ) -{ - while (!m_allParticleSystemList.empty()) - { - DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != nullptr, ("ParticleSystemManager::reset: ParticleSystem is null")); - deleteInstance(m_allParticleSystemList.front()); - } - DEBUG_ASSERTCRASH(m_particleSystemCount == 0, ("ParticleSystemManager::reset: m_particleSystemCount is %u, not 0", m_particleSystemCount)); - - // sanity, our lists must be empty!! - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("RESET: ParticleSystem all particles head[%d] is not null!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not null!", i) ); - - // just to be clean set them to nullptr - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - - m_particleCount = 0; - m_fieldParticleCount = 0; - m_particleSystemCount = 0; - - m_uniqueSystemID = INVALID_PARTICLE_SYSTEM_ID; - - m_lastLogicFrameUpdate = -1; - // leave templates as-is -} - -// ------------------------------------------------------------------------------------------------ -/** Update all particle systems */ -// ------------------------------------------------------------------------------------------------ -//DECLARE_PERF_TIMER(ParticleSystemManager) -void ParticleSystemManager::update( void ) -{ - if (m_lastLogicFrameUpdate == TheGameLogic->getFrame()) { - return; - } - - // update the last logic frame. - m_lastLogicFrameUpdate = TheGameLogic->getFrame(); - - //USE_PERF_TIMER(ParticleSystemManager) - ParticleSystemListIt it = m_allParticleSystemList.begin(); - while( it != m_allParticleSystemList.end() ) - { - // TheSuperHackers @info Must increment the list iterator before potential element erasure from the list. - ParticleSystem* sys = *it++; - DEBUG_ASSERTCRASH(sys != nullptr, ("ParticleSystemManager::update: ParticleSystem is null")); - - if (sys->update(m_localPlayerIndex) == false) - { - deleteInstance(sys); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** sets the count of the particles on screen after each frame */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::setOnScreenParticleCount(int count) -{ - m_onScreenParticleCount = count; -} - -// ------------------------------------------------------------------------------------------------ -/** Given a file containing particle system properties, create a new instance of it */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemManager::createParticleSystem( const ParticleSystemTemplate *sysTemplate, Bool createSlaves ) -{ - // sanity - if (sysTemplate == nullptr) - return nullptr; - - m_uniqueSystemID = (ParticleSystemID)((UnsignedInt)m_uniqueSystemID + 1); - ParticleSystem *sys = newInstance(ParticleSystem)( sysTemplate, m_uniqueSystemID, createSlaves ); - return sys; -} - -// ------------------------------------------------------------------------------------------------ -/// given a template, instantiate a particle system attached to the given object, and return its ID -// ------------------------------------------------------------------------------------------------ -ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( - const ParticleSystemTemplate *sysTemplate, - Object* attachTo, - Bool createSlaves ) -{ - ParticleSystem* pSystem = createParticleSystem(sysTemplate, createSlaves); - if (pSystem && attachTo) - pSystem->attachToObject(attachTo); - return pSystem ? pSystem->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Find a particle system with the matching system id */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) -{ - if (id == INVALID_PARTICLE_SYSTEM_ID) - return nullptr; // my, that was easy - - ParticleSystem *system = nullptr; - - for( ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) { - system = *it; - DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); - - if( system->getSystemID() == id ) { - return system; - } - } - - return nullptr; - -} - -// ------------------------------------------------------------------------------------------------ -/** destroy the particle system with the given id (if it still exists) */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::destroyParticleSystemByID(ParticleSystemID id) -{ - ParticleSystem* pSystem = findParticleSystem(id); - if( pSystem ) - pSystem->destroy(); -} - -// ------------------------------------------------------------------------------------------------ -/** Locate an existing ParticleSystemTemplate */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString &name ) const -{ - ParticleSystemTemplate *sysTemplate = nullptr; - - TemplateMap::const_iterator find(m_templateMap.find(name)); - if (find != m_templateMap.end()) { - sysTemplate = (*find).second; - } - - return sysTemplate; -} - -// ------------------------------------------------------------------------------------------------ -/** Create a new ParticleSystemTemplate */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &name ) -{ - ParticleSystemTemplate *sysTemplate = findTemplate(name); - if (sysTemplate == nullptr) { - sysTemplate = newInstance(ParticleSystemTemplate)( name ); - - if (! m_templateMap.insert(std::make_pair(name, sysTemplate)).second) { - deleteInstance(sysTemplate); - sysTemplate = nullptr; - } - } - - return sysTemplate; -} - -// ------------------------------------------------------------------------------------------------ -/** Find a particle system's parent. Should really only be called by TheScriptEngine */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiString &name, Int parentNum ) const -{ - if (name.isEmpty()) { - return nullptr; - } - - TemplateMap::const_iterator begin(m_templateMap.begin()); - TemplateMap::const_iterator end(m_templateMap.end()); - for(; begin != end; ++begin) { - ParticleSystemTemplate *sysTemplate = (*begin).second; - if (name.compare(sysTemplate->m_slaveSystemName) == 0) { - if (! parentNum--) { - return sysTemplate; - } - } - } - - return nullptr; -} - -// ------------------------------------------------------------------------------------------------ -/** Destroy any particle systems that are attached to this object */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::destroyAttachedSystems( Object *obj ) -{ - - // sanity - if( obj == nullptr ) - return; - - // iterate through all systems - for( ParticleSystemListIt it = m_allParticleSystemList.begin(); - it != m_allParticleSystemList.end(); - ++it ) - { - - ParticleSystem *system = *it; - DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); - - if( system->getAttachedObject() == obj->getID() ) - system->destroy(); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Add a particle to the global particle list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::addParticle( Particle *particleToAdd, ParticlePriorityType priority ) -{ - if (particleToAdd->m_inOverallList) - return; - - if (!m_allParticlesHead[ priority ]) - { - m_allParticlesHead[ priority ] = particleToAdd; - } - - if (m_allParticlesTail[ priority ]) - { - m_allParticlesTail[ priority ]->m_overallNext = particleToAdd; - particleToAdd->m_overallPrev = m_allParticlesTail[ priority ]; - } - else - { - particleToAdd->m_overallPrev = nullptr; - } - - m_allParticlesTail[ priority ] = particleToAdd; - particleToAdd->m_overallNext = nullptr; - particleToAdd->m_inOverallList = TRUE; - - ++m_particleCount; - - -} - -// ------------------------------------------------------------------------------------------------ -/** Remove a particle from the global particle list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::removeParticle( Particle *particleToRemove) -{ - if (!particleToRemove->m_inOverallList) - return; - - // get priority of the particle we're removing - ParticlePriorityType priority = particleToRemove->getPriority(); - - // remove links from prev & next objs - if (particleToRemove->m_overallNext) - particleToRemove->m_overallNext->m_overallPrev = particleToRemove->m_overallPrev; - if (particleToRemove->m_overallPrev) - particleToRemove->m_overallPrev->m_overallNext = particleToRemove->m_overallNext; - - // update head & tail if necessary - if (particleToRemove == m_allParticlesHead[ priority ]) - m_allParticlesHead[ priority ] = particleToRemove->m_overallNext; - if (particleToRemove == m_allParticlesTail[ priority ]) - m_allParticlesTail[ priority ] = particleToRemove->m_overallPrev; - - particleToRemove->m_overallNext = particleToRemove->m_overallPrev = nullptr; - particleToRemove->m_inOverallList = FALSE; - --m_particleCount; - - -} - -// ------------------------------------------------------------------------------------------------ -/** Add a particle system to the master particle system list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::friend_addParticleSystem( ParticleSystem *particleSystemToAdd ) -{ - DEBUG_ASSERTCRASH(particleSystemToAdd != nullptr, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); - m_allParticleSystemList.push_back(particleSystemToAdd); - ++m_particleSystemCount; -} - -// ------------------------------------------------------------------------------------------------ -/** Remove a particle system from the master particle system list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::friend_removeParticleSystem( ParticleSystem *particleSystemToRemove ) -{ - ParticleSystemListIt it = std::find(m_allParticleSystemList.begin(), m_allParticleSystemList.end(), particleSystemToRemove); - if (it != m_allParticleSystemList.end()) { - m_allParticleSystemList.erase(it); - --m_particleSystemCount; - } else { - DEBUG_CRASH(("ParticleSystemManager::friend_removeParticleSystem: ParticleSystem to remove was not recognized")); - } -} - -// ------------------------------------------------------------------------------------------------ -/** Remove the oldest N number of particles from the lowest priority lists first. We will - * not remove particles from any priorities higher or equal to the priorityCap parameter. */ -// ------------------------------------------------------------------------------------------------ -Int ParticleSystemManager::removeOldestParticles( UnsignedInt count, - ParticlePriorityType priorityCap ) -{ - Int countToRemove = count; - - while (count-- && getParticleCount()) - { - for( Int i = PARTICLE_PRIORITY_LOWEST; - i < priorityCap; - ++i ) - { - if( m_allParticlesHead[ i ] ) - { - deleteInstance(m_allParticlesHead[ i ]); - break; // exit for - } - } - } - - // return the number of particles actually removed - return countToRemove - count; - -} - -// ------------------------------------------------------------------------------------------------ -/** Preload particle system textures */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::preloadAssets( TimeOfDay timeOfDay ) -{ - TemplateMap::iterator begin(m_templateMap.begin()); - TemplateMap::iterator end(m_templateMap.end()); - - for (; begin != end; ++begin) { - const ParticleSystemTemplate *tmplate = (*begin).second; - if (tmplate->m_particleType == ParticleSystemInfo::PARTICLE && - (! tmplate->m_particleTypeName.isEmpty())) - { - TheDisplay->preloadTextureAssets(tmplate->m_particleTypeName); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // unique system ID counter - xfer->xferUser( &m_uniqueSystemID, sizeof( ParticleSystemID ) ); - - // count of particle systems in the world - UnsignedInt systemCount = m_particleSystemCount; - xfer->xferUnsignedInt( &systemCount ); - - // particle systems data - AsciiString systemName; - ParticleSystem *system; - if( xfer->getXferMode() == XFER_SAVE ) - { - - // iterate each particle system - ParticleSystemListIt it; - for( it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) - { - systemCount--; - // get system - system = *it; - - // ignore destroyed systems and non-saveable systems - if( system->isDestroyed() == TRUE || system->isSaveable() == FALSE ) { - AsciiString mtString; - xfer->xferAsciiString(&mtString); // write null string as key for destroyed system. - continue; - } - - // write template name - systemName = system->getTemplate()->getName(); - xfer->xferAsciiString( &systemName ); - - // write system data - xfer->xferSnapshot( system ); - - } - DEBUG_ASSERTCRASH(systemCount==0, ("Mismatch in write count.")); - - } - else - { - const ParticleSystemTemplate *systemTemplate; - - // read each particle system - for( UnsignedInt i = 0; i < systemCount; ++i ) - { - - // read system name and find template - xfer->xferAsciiString( &systemName ); - if (systemName.isEmpty()) { - continue; // destroyed particle system. - } - systemTemplate = findTemplate( systemName ); - - // sanity - if( systemTemplate == nullptr ) - { - - DEBUG_CRASH(( "ParticleSystemManager::xfer - Unknown particle system template '%s'", - systemName.str() )); - throw SC_INVALID_DATA; - - } - - // create system - system = createParticleSystem( systemTemplate, FALSE ); - - if( system == nullptr ) - { - - DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to allocate particle system '%s'", - systemName.str() )); - throw SC_INVALID_DATA; - - } - - // read system data - xfer->xferSnapshot( system ); - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::loadPostProcess( void ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Output particle system statistics to the screen - * @todo Implement a real console (MSB) */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp ) -{ - if (!dd) - return; - - dd->setCursorPos( 0, 0 ); - dd->setRightMargin( 2 ); - - dd->printf( "Total Particles: %d\n", TheParticleSystemManager->getParticleCount() ); - dd->printf( "Total Particles (On Screen): %d\n", TheParticleSystemManager->getOnScreenParticleCount()); - dd->printf( "Total Particle Systems: %d\n", TheParticleSystemManager->getParticleSystemCount() ); - - ParticleSystemManager::ParticleSystemList list = TheParticleSystemManager->getAllParticleSystems(); - ParticleSystemManager::ParticleSystemList::iterator it; - - std::map templateMap; - std::map templateMapParticleCount; - - std::map::iterator templateMapIt; - std::map::iterator templateMapParticleCountIt; - - for ( it = list.begin(); it != list.end(); ++it ) - { - AsciiString templateName = (*it)->getTemplate()->getName(); - templateMapIt = templateMap.find(templateName); - if (templateMapIt == templateMap.end()) - { - templateMap.insert(std::make_pair(templateName, 1)); - templateMapParticleCount.insert(std::make_pair(templateName, (*it)->getParticleCount())); - } - else - { - ++templateMapIt->second; - - templateMapParticleCountIt = templateMapParticleCount.find(templateName); - if (templateMapParticleCountIt != templateMapParticleCount.end()) - templateMapParticleCountIt->second += (*it)->getParticleCount(); - } - } - - for (templateMapIt = templateMap.begin(); templateMapIt != templateMap.end(); ++templateMapIt) - { - templateMapParticleCountIt = templateMapParticleCount.find(templateMapIt->first); - - dd->printf(" %s: %d instances", templateMapIt->first.str(), templateMapIt->second); - if (templateMapParticleCountIt != templateMapParticleCount.end()) - dd->printf(" (Avg per system %.2f)", INT_TO_REAL(templateMapParticleCountIt->second) / templateMapIt->second); - dd->printf("\n"); - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB) -{ - if (!(vecA && vecA->length() && vecB && vecB->length())) { - return 0.0; - } - - Real lengthA = vecA->length(); - Real lengthB = vecB->length(); - Real dotProduct = (vecA->x * vecB->x + vecA->y * vecB->y); - Real cosTheta = dotProduct / (lengthA * lengthB); - - // If the dotproduct is 0.0, then they are orthogonal - if (dotProduct == 0.0f) { - if (vecB->x > 0) { - return PI; - } - - return 0.0f; - } - - Real theta = ACos( cosTheta ); - - if (vecB->x > 0) { - return theta; - } - - return -theta; -} - diff --git a/Generals/Code/Tools/CMakeLists.txt b/Generals/Code/Tools/CMakeLists.txt index e1d0da9bd4d..73404b55a63 100644 --- a/Generals/Code/Tools/CMakeLists.txt +++ b/Generals/Code/Tools/CMakeLists.txt @@ -5,7 +5,6 @@ if(RTS_BUILD_GENERALS_TOOLS) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) - add_subdirectory(ParticleEditor) add_subdirectory(W3DView) add_subdirectory(WorldBuilder) endif() diff --git a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp b/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp deleted file mode 100644 index 590c8ef381d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" - -#include "GameClient/ParticleSys.h" -#include "CButtonShowColor.h" - -// CButtonShowColor /////////////////////////////////////////////////////////////////////////////// -void CButtonShowColor::OnPaint() -{ - try { - CPaintDC paintDC(this); - - CPen pen(PS_SOLID, 1, 0xFFFFFF00); - CBrush brush(RGBtoBGR(m_color.getAsInt())); - // Select my stuff - CPen *oldPen = paintDC.SelectObject(&pen); - - CRect rect; - GetWindowRect(&rect); - ScreenToClient(&rect); - - paintDC.FillRect(&rect, &brush); - paintDC.MoveTo(rect.left, rect.top); - paintDC.LineTo(rect.right, rect.top); - paintDC.LineTo(rect.right, rect.bottom); - paintDC.LineTo(rect.left, rect.bottom); - paintDC.LineTo(rect.left, rect.top); - - // Restore the states. - paintDC.SelectObject(oldPen); - - } catch (...) { - // Unlikely, but possible. - return; - } -} - -CButtonShowColor::~CButtonShowColor() -{ - DestroyWindow(); -} - -// Convert from 0x00RRGGBB to 0x00BBGGRR -COLORREF CButtonShowColor::RGBtoBGR(Int color) -{ - return ((color & 0x00FF0000) >> 16 | - (color & 0x0000FF00) << 0 | - (color & 0x000000FF) << 16); -} - -// Convert from 0x00BBGGRR to 0x00RRGGBB -Int CButtonShowColor::BGRtoRGB(COLORREF color) -{ - return RGBtoBGR(color); -} - -BEGIN_MESSAGE_MAP(CButtonShowColor, CButton) - ON_WM_PAINT() -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h b/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h deleted file mode 100644 index b11567c6253..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class CButtonShowColor : public CButton -{ - protected: - RGBColor m_color; - - public: - const RGBColor& getColor(void) const { return m_color; } - void setColor(Int color) { m_color.setFromInt(color); } - void setColor(const RGBColor& color) { m_color = color; } - ~CButtonShowColor(); - - - static COLORREF RGBtoBGR(Int color); - static Int BGRtoRGB(COLORREF color); - - - protected: - afx_msg void OnPaint(); - - DECLARE_MESSAGE_MAP(); -}; diff --git a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp deleted file mode 100644 index f37ac48b493..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "CColorAlphaDialog.h" - -#include "GameClient/ParticleSys.h" - -#include "CParticleEditorPage.h" -#include "EmissionTypePanels.h" -#include "ParticleEditorDialog.h" -#include "ParticleEditorExport.h" -#include "ParticleTypePanels.h" -#include "VelocityTypePanels.h" - -#define ARBITRARY_BUFF_SIZE 128 - -static const UINT colorControls[][2] = -{ - {IDC_PSEd_Color1, IDC_PSEd_CF1_Frame}, - {IDC_PSEd_Color2, IDC_PSEd_CF2_Frame}, - {IDC_PSEd_Color3, IDC_PSEd_CF3_Frame}, - {IDC_PSEd_Color4, IDC_PSEd_CF4_Frame}, - {IDC_PSEd_Color5, IDC_PSEd_CF5_Frame}, - {IDC_PSEd_Color6, IDC_PSEd_CF6_Frame}, - {IDC_PSEd_Color7, IDC_PSEd_CF7_Frame}, - {IDC_PSEd_Color8, IDC_PSEd_CF8_Frame} -}; - -static const UINT alphaControls[][3] = -{ - {IDC_PSEd_AF1_Min, IDC_PSEd_AF1_Max, IDC_PSEd_AF1_Frame}, - {IDC_PSEd_AF2_Min, IDC_PSEd_AF2_Max, IDC_PSEd_AF2_Frame}, - {IDC_PSEd_AF3_Min, IDC_PSEd_AF3_Max, IDC_PSEd_AF3_Frame}, - {IDC_PSEd_AF4_Min, IDC_PSEd_AF4_Max, IDC_PSEd_AF4_Frame}, - {IDC_PSEd_AF5_Min, IDC_PSEd_AF5_Max, IDC_PSEd_AF5_Frame}, - {IDC_PSEd_AF6_Min, IDC_PSEd_AF6_Max, IDC_PSEd_AF6_Frame}, - {IDC_PSEd_AF7_Min, IDC_PSEd_AF7_Max, IDC_PSEd_AF7_Frame}, - {IDC_PSEd_AF8_Min, IDC_PSEd_AF8_Max, IDC_PSEd_AF8_Frame} -}; - - - -CColorAlphaDialog::CColorAlphaDialog(UINT nIDTemplate, CWnd* pParentWnd) : - CDialog(nIDTemplate, pParentWnd) -{} - -void CColorAlphaDialog::InitPanel( void ) -{ - CString custColor; - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color1", "0"); - m_customColors[0] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color2", "0"); - m_customColors[1] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color3", "0"); - m_customColors[2] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color4", "0"); - m_customColors[3] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color5", "0"); - m_customColors[4] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color6", "0"); - m_customColors[5] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color7", "0"); - m_customColors[6] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color8", "0"); - m_customColors[7] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color9", "0"); - m_customColors[8] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color10", "0"); - m_customColors[9] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color11", "0"); - m_customColors[10] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color12", "0"); - m_customColors[11] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color13", "0"); - m_customColors[12] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color14", "0"); - m_customColors[13] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color15", "0"); - m_customColors[14] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color16", "0"); - m_customColors[15] = atol(custColor.GetBuffer(0)); -} - -void CColorAlphaDialog::performUpdate(IN Bool toUI) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update the colors - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - // update the color swatch - CButtonShowColor *pSwatch = (CButtonShowColor*) GetDlgItem(colorControls[i][0]); - CWnd *pFrame = GetDlgItem(colorControls[i][1]); - RGBColorKeyframe colorFrame; - - if (pSwatch && pFrame) { - if (toUI) { - pParent->getColorValueFromSystem(i, colorFrame); - - pSwatch->setColor(colorFrame.color); - pSwatch->Invalidate(TRUE); - - sprintf(buff, "%u", colorFrame.frame); - pFrame->SetWindowText(buff); - } else { - colorFrame.color = pSwatch->getColor(); - - pFrame->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorFrame.frame = atoi(buff); - pParent->updateColorValueToSystem(i, colorFrame); - } - } - } - } - - { // update the values - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - ParticleSystemInfo::RandomKeyframe keyFrame; - - pParent->getAlphaRangeFromSystem(i, keyFrame); - - { // Minimum first - CWnd *pMin = GetDlgItem(alphaControls[i][0]); - if (pMin) { - if (toUI) { - sprintf(buff, FORMAT_STRING, keyFrame.var.getMinimumValue()); - pMin->SetWindowText(buff); - } else { - pMin->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.var.m_low = atof(buff); - } - } - } - - { // then maximum - CWnd *pMax = GetDlgItem(alphaControls[i][1]); - if (pMax) { - if (toUI) { - sprintf(buff, FORMAT_STRING, keyFrame.var.getMaximumValue()); - pMax->SetWindowText(buff); - } else { - pMax->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.var.m_high = atof(buff); - } - } - } - - { // then the frame - CWnd *pFrame = GetDlgItem(alphaControls[i][2]); - if (pFrame) { - if (toUI) { - // Unsigned int - sprintf(buff, "%u", keyFrame.frame); - pFrame->SetWindowText(buff); - } else { - pFrame->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.frame = (unsigned) atoi(buff); - } - } - } - - if (toUI) { - // We're all done. - } else { - pParent->updateAlphaRangeToSystem(i, keyFrame); - } - } - } -} - -void CColorAlphaDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BOOL CColorAlphaDialog::OnInitDialog() -{ - // replace all the buttons with our buttons. - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - CRect rect; - CWnd *item = GetDlgItem(colorControls[i][0]); - if (!item) { - continue; - } - - item->GetWindowRect(&rect); - ScreenToClient(&rect); - DWORD style = item->GetStyle(); - m_colorButton[i].Create("", style, rect, this, colorControls[i][0]); - - item->DestroyWindow(); - } - - return CDialog::OnInitDialog(); -} - -#define ONCOLORDLG(x) void CColorAlphaDialog::OnColor##x() { onColorPress( x ); } -ONCOLORDLG(1) -ONCOLORDLG(2) -ONCOLORDLG(3) -ONCOLORDLG(4) -ONCOLORDLG(5) -ONCOLORDLG(6) -ONCOLORDLG(7) -ONCOLORDLG(8) -#undef ONCOLORDLG - -void CColorAlphaDialog::onColorPress(Int colorPressed) -{ - CColorDialog dlg(CButtonShowColor::RGBtoBGR(m_colorButton[colorPressed - 1].getColor().getAsInt())); - dlg.m_cc.Flags |= (CC_FULLOPEN | CC_ANYCOLOR); - dlg.m_cc.lpCustColors = m_customColors; - if (dlg.DoModal() == IDOK) { - - m_colorButton[colorPressed - 1].setColor(CButtonShowColor::BGRtoRGB(dlg.GetColor())); - static char buff[ARBITRARY_BUFF_SIZE]; - - ltoa(m_customColors[0], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color1", buff); - ltoa(m_customColors[1], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color2", buff); - ltoa(m_customColors[2], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color3", buff); - ltoa(m_customColors[3], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color4", buff); - ltoa(m_customColors[4], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color5", buff); - ltoa(m_customColors[5], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color6", buff); - ltoa(m_customColors[6], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color7", buff); - ltoa(m_customColors[7], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color8", buff); - ltoa(m_customColors[8], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color9", buff); - ltoa(m_customColors[9], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color10", buff); - ltoa(m_customColors[10], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color11", buff); - ltoa(m_customColors[11], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color12", buff); - ltoa(m_customColors[12], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color13", buff); - ltoa(m_customColors[13], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color14", buff); - ltoa(m_customColors[14], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color15", buff); - ltoa(m_customColors[15], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color16", buff); - - - - OnParticleSystemEdit(); - } -} - -BEGIN_MESSAGE_MAP(CColorAlphaDialog, CDialog) - ON_BN_CLICKED(IDC_PSEd_Color1, OnColor1) - ON_BN_CLICKED(IDC_PSEd_Color2, OnColor2) - ON_BN_CLICKED(IDC_PSEd_Color3, OnColor3) - ON_BN_CLICKED(IDC_PSEd_Color4, OnColor4) - ON_BN_CLICKED(IDC_PSEd_Color5, OnColor5) - ON_BN_CLICKED(IDC_PSEd_Color6, OnColor6) - ON_BN_CLICKED(IDC_PSEd_Color7, OnColor7) - ON_BN_CLICKED(IDC_PSEd_Color8, OnColor8) - - ON_EN_KILLFOCUS(IDC_PSEd_CF1_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF2_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF3_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF4_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF5_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF6_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF7_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF8_Frame, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Min, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Max, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Frame, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h deleted file mode 100644 index f1a4fe80d63..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "CButtonShowColor.h" -#include "GameClient/ParticleSys.h" - -class CColorAlphaDialog : public CDialog -{ - protected: - DWORD m_customColors[16]; - CButtonShowColor m_colorButton[MAX_KEYFRAMES]; - - void onColorPress( Int colorPressed ); - public: - enum {IDD = IDD_PSEd_EditColorAndAlpha}; - CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - - protected: - virtual BOOL OnInitDialog(); - - afx_msg void OnColor1(); - afx_msg void OnColor2(); - afx_msg void OnColor3(); - afx_msg void OnColor4(); - afx_msg void OnColor5(); - afx_msg void OnColor6(); - afx_msg void OnColor7(); - afx_msg void OnColor8(); - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt deleted file mode 100644 index e15405e12b6..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -set(PARTICLEED_SRC - "CButtonShowColor.cpp" - "CButtonShowColor.h" - "CColorAlphaDialog.cpp" - "CColorAlphaDialog.h" - "CSwitchesDialog.cpp" - "CSwitchesDialog.h" - "EmissionTypePanels.cpp" - "EmissionTypePanels.h" - "ISwapablePanel.h" - "MoreParmsDialog.cpp" - "MoreParmsDialog.h" - "ParticleEditor.cpp" - "ParticleEditor.h" - "ParticleEditorDialog.cpp" - "ParticleEditorDialog.h" - "ParticleEditorExport.h" - "ParticleTypePanels.cpp" - "ParticleTypePanels.h" - "Resource.h" - "ShaderTypePanels.cpp" - "ShaderTypePanels.h" - "StdAfx.cpp" - "StdAfx.h" - "VelocityTypePanels.cpp" - "VelocityTypePanels.h" -) - -add_library(g_particleeditor SHARED) -set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") - -target_sources(g_particleeditor PRIVATE ${PARTICLEED_SRC}) - -target_include_directories(g_particleeditor PRIVATE - include - res -) - -target_link_libraries(g_particleeditor PRIVATE - corei_libraries_source_wwvegas - corei_libraries_source_wwvegas_wwlib - gi_always_no_pch - gi_gameengine_include - gi_libraries_source_wwvegas - stlport -) - -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_link_options(g_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) - target_compile_definitions(g_particleeditor PRIVATE _AFXDLL) - target_sources(g_particleeditor PRIVATE ParticleEditor.rc) - set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) -else() - set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME particleeditor) -endif() diff --git a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h b/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h deleted file mode 100644 index b2458f3002d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -struct CParticleEditorPage : public CDialog -{ - UINT m_templateID; - public: - CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr); - void InitPanel( int templateID ); - - - protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp deleted file mode 100644 index 4839ed89743..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "CSwitchesDialog.h" - -#include "ParticleEditorDialog.h" - -CSwitchesDialog::CSwitchesDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd) -{ - -} - -void CSwitchesDialog::InitPanel( void ) -{ - -} - -// if true, updates the UI from the Particle System. -// if false, updates the Particle System from the UI -void CSwitchesDialog::performUpdate( IN Bool toUI ) -{ - DebugWindowDialog *parent = GetDWDParent(); - if (!parent) { - return; - } - - { // update hollowness - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_Hollow); - if (pWnd) { - Bool hollow; - if (toUI) { - parent->getSwitchFromSystem(ST_HOLLOW, hollow); - pWnd->SetCheck(hollow); - } else { - hollow = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_HOLLOW, hollow); - } - } - } - - { // update one shot - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_OneShot); - if (pWnd) { - Bool oneShot; - if (toUI) { - parent->getSwitchFromSystem(ST_ONESHOT, oneShot); - pWnd->SetCheck(oneShot); - } else { - oneShot = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_ONESHOT, oneShot); - } - } - } - - { // update Ground Aligned - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_GroundAligned); - if (pWnd) { - Bool groundAlign; - if (toUI) { - parent->getSwitchFromSystem(ST_ALIGNXY, groundAlign); - pWnd->SetCheck(groundAlign); - } else { - groundAlign = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_ALIGNXY, groundAlign); - } - } - } - - { // update Emit above ground only - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_EmitAboveGroundOnly); - if (pWnd) { - Bool aboveGroundOnly; - if (toUI) { - parent->getSwitchFromSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly); - pWnd->SetCheck(aboveGroundOnly); - } else { - aboveGroundOnly = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly); - } - } - } - - { // update Particle Up towards emitter - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_ParticleUpTowardsEmitter); - if (pWnd) { - Bool upTowardsEmitter; - if (toUI) { - parent->getSwitchFromSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter); - pWnd->SetCheck(upTowardsEmitter); - } else { - upTowardsEmitter = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter); - } - } - } -} - -void CSwitchesDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = GetDWDParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(CSwitchesDialog, CDialog) - ON_BN_CLICKED(IDC_PSEd_OneShot, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_Hollow, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_GroundAligned, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_EmitAboveGroundOnly, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_ParticleUpTowardsEmitter, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h deleted file mode 100644 index 6a3f2d30373..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class DebugWindowDialog; - -class CSwitchesDialog : public CDialog -{ - public: - enum {IDD = IDD_PSEd_EditSwitchesDialog}; - CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - DebugWindowDialog* GetDWDParent(void) { return (DebugWindowDialog*) GetParent(); } - - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp deleted file mode 100644 index 4de83a2a1ec..00000000000 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: EmissionTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: EmissionTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "EmissionTypePanels.h" -#include "ParticleEditorDialog.h" - -// Defines //////////////////////////////////////////////////////////////////// -#define ARBITRARY_BUFF_SIZE 128 - - -// EmissionPanelLine ////////////////////////////////////////////////////////// -EmissionPanelPoint::EmissionPanelPoint(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelPoint::InitPanel( void ) -{ - -} - -void EmissionPanelPoint::performUpdate( IN Bool toUI ) -{ - -} - -void EmissionPanelPoint::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelPoint, ISwapablePanel) -END_MESSAGE_MAP() - - -// Defines //////////////////////////////////////////////////////////////////// -#define ARBITRARY_BUFF_SIZE 128 - -// EmissionPanelLine ////////////////////////////////////////////////////////// -EmissionPanelLine::EmissionPanelLine(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelLine::InitPanel( void ) -{ - -} - -void EmissionPanelLine::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update line parameters - Real linePoint; - CWnd *pWnd; - - // first X1 - pWnd = GetDlgItem(IDC_PSEd_LineStartX); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(0, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(0, linePoint); - } - } - - // now the Y1 - pWnd = GetDlgItem(IDC_PSEd_LineStartY); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(1, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(1, linePoint); - } - } - - // now the Z1 - pWnd = GetDlgItem(IDC_PSEd_LineStartZ); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(2, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(2, linePoint); - } - } - - // first the X2 - pWnd = GetDlgItem(IDC_PSEd_LineEndX); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(3, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(3, linePoint); - } - } - - // now the Y2 - pWnd = GetDlgItem(IDC_PSEd_LineEndY); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(4, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(4, linePoint); - } - } - - // the Z2 - pWnd = GetDlgItem(IDC_PSEd_LineEndZ); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(5, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(5, linePoint); - } - } - } - -} - -void EmissionPanelLine::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelLine, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartZ, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndZ, OnParticleSystemEdit) - -END_MESSAGE_MAP() - - -// EmissionPanelBox /////////////////////////////////////////////////////////// -EmissionPanelBox::EmissionPanelBox(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelBox::InitPanel( void ) -{ - -} - -void EmissionPanelBox::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update half size of box - Real halfSize; - CWnd *pWnd; - - // first the X - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeX); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(0, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(0, halfSize); - } - } - - // now the Y - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeY); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(1, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(1, halfSize); - } - } - - // finally, the Z - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeZ); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(2, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(2, halfSize); - } - } - } -} - -void EmissionPanelBox::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelBox, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeZ, OnParticleSystemEdit) -END_MESSAGE_MAP() - - -// EmissionPanelSphere //////////////////////////////////////////////////////// -EmissionPanelSphere::EmissionPanelSphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelSphere::InitPanel( void ) -{ - -} - -void EmissionPanelSphere::performUpdate( IN Bool toUI ) -{ - - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update sphere radius - Real radius; - CWnd *pWnd; - - // first the X - pWnd = GetDlgItem(IDC_PSEd_SphereRadius); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(0, radius); - - sprintf(buff, FORMAT_STRING, radius); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radius = atof(buff); - pParent->updateHalfSizeToSystem(0, radius); - } - } - } -} - -void EmissionPanelSphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelSphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadius, OnParticleSystemEdit) -END_MESSAGE_MAP() - - - -// EmissionPanelCylinder ////////////////////////////////////////////////////// -EmissionPanelCylinder::EmissionPanelCylinder(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelCylinder::InitPanel( void ) -{ - -} - -void EmissionPanelCylinder::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update cylinder parameters - CWnd *pWnd; - - // first the Radius - pWnd = GetDlgItem(IDC_PSEd_CylRadius); - if (pWnd) { - Real radius; - if (toUI) { - pParent->getCylinderRadiusFromSystem(radius); - - sprintf(buff, FORMAT_STRING, radius); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radius = atof(buff); - pParent->updateCylinderRadiusToSystem(radius); - } - } - - // now the Length - pWnd = GetDlgItem(IDC_PSEd_CylLength); - if (pWnd) { - Real length; - if (toUI) { - - pParent->getCylinderLengthFromSystem(length); - - sprintf(buff, FORMAT_STRING, length); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - length = atof(buff); - pParent->updateCylinderLengthToSystem(length); - } - } - } -} - -void EmissionPanelCylinder::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelCylinder, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_CylRadius, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylLength, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h deleted file mode 100644 index 3082593c715..00000000000 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: EmissionTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: EmissionTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: Emission panels are pretty similar, they all go here. */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// EmissionPanelPoint ////////////////////////////////////////////////////////// -class EmissionPanelPoint : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelPoint}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelLine ////////////////////////////////////////////////////////// -class EmissionPanelLine : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelLine}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelBox /////////////////////////////////////////////////////////// -class EmissionPanelBox : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelBox}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelSphere //////////////////////////////////////////////////////// -class EmissionPanelSphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelSphere}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelCylinder ////////////////////////////////////////////////////// -class EmissionPanelCylinder : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelCylinder}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h b/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h deleted file mode 100644 index fc8e38cd2bd..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ISwapablePanel.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ISwapablePanel.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: Swapable panels derive from this so that we can easily call */ -/* the update function */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -#include "Lib/BaseType.h" - -// INCLUDES /////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -interface ISwapablePanel : public CDialog -{ - ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr) : CDialog(nIDTemplate, pParentWnd) {} - virtual DWORD GetIDD( void ) = 0; - virtual void performUpdate( IN Bool toUI ) = 0; - virtual void InitPanel( void ) = 0; -}; diff --git a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp deleted file mode 100644 index 38f8c687dbf..00000000000 --- a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: MoreParmsDialog.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: MoreParmsDialog.cpp */ -/* Created: John K. McDonald, Jr., 3/23/2002 */ -/* Desc: Additional particle system parameters */ -/* Revision History: */ -/* 3/23/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ -#include "StdAfx.h" -#include "MoreParmsDialog.h" -#include "ParticleEditorDialog.h" - -#define ARBITRARY_BUFF_SIZE 128 - -MoreParmsDialog::MoreParmsDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd) -{ - -} - -MoreParmsDialog::~MoreParmsDialog() -{ - -} - -void MoreParmsDialog::InitPanel( void ) -{ - CComboBox* pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_WindMotion); - if (pCombo) { - for (int i = 1; WindMotionNames[i]; ++i) { - pCombo->AddString(WindMotionNames[i]); - } - pCombo->SetCurSel(0); - } - -} - -void MoreParmsDialog::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - - { // Update all fields on this panel. - CWnd *pWnd; - - { // initial delay - Real initialDelay; - - pWnd = GetDlgItem(IDC_PSEd_InitialDelayMin); - if (pWnd) { - if (toUI) { - pParent->getInitialDelayFromSystem(0, initialDelay); - sprintf(buff, FORMAT_STRING, initialDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - initialDelay = atof(buff); - pParent->updateInitialDelayToSystem(0, initialDelay); - } - } - - pWnd = GetDlgItem(IDC_PSEd_InitialDelayMax); - if (pWnd) { - if (toUI) { - pParent->getInitialDelayFromSystem(1, initialDelay); - sprintf(buff, FORMAT_STRING, initialDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - initialDelay = atof(buff); - pParent->updateInitialDelayToSystem(1, initialDelay); - } - } - } - - { // burst delay - Real burstDelay; - - pWnd = GetDlgItem(IDC_PSEd_BurstDelayMin); - if (pWnd) { - if (toUI) { - pParent->getBurstDelayFromSystem(0, burstDelay); - sprintf(buff, FORMAT_STRING, burstDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstDelay = atof(buff); - pParent->updateBurstDelayToSystem(0, burstDelay); - } - } - - pWnd = GetDlgItem(IDC_PSEd_BurstDelayMax); - if (pWnd) { - if (toUI) { - pParent->getBurstDelayFromSystem(1, burstDelay); - sprintf(buff, FORMAT_STRING, burstDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstDelay = atof(buff); - pParent->updateBurstDelayToSystem(1, burstDelay); - } - } - } - - { // burst count - Real burstCount; - - pWnd = GetDlgItem(IDC_PSEd_BurstCountMin); - if (pWnd) { - if (toUI) { - pParent->getBurstCountFromSystem(0, burstCount); - sprintf(buff, FORMAT_STRING, burstCount); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstCount = atof(buff); - pParent->updateBurstCountToSystem(0, burstCount); - } - } - - pWnd = GetDlgItem(IDC_PSEd_BurstCountMax); - if (pWnd) { - if (toUI) { - pParent->getBurstCountFromSystem(1, burstCount); - sprintf(buff, FORMAT_STRING, burstCount); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstCount = atof(buff); - pParent->updateBurstCountToSystem(1, burstCount); - } - } - } - - { // color scale - Real colorScale; - - pWnd = GetDlgItem(IDC_PSEd_ColorScaleMin); - if (pWnd) { - if (toUI) { - pParent->getColorScaleFromSystem(0, colorScale); - sprintf(buff, FORMAT_STRING, colorScale); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorScale = atof(buff); - pParent->updateColorScaleToSystem(0, colorScale); - } - } - - pWnd = GetDlgItem(IDC_PSEd_ColorScaleMax); - if (pWnd) { - if (toUI) { - pParent->getColorScaleFromSystem(1, colorScale); - sprintf(buff, FORMAT_STRING, colorScale); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorScale = atof(buff); - pParent->updateColorScaleToSystem(1, colorScale); - } - } - } - - { // particle lifetime - Real particleLifetime; - - pWnd = GetDlgItem(IDC_PSEd_ParticleLifetimeMin); - if (pWnd) { - if (toUI) { - pParent->getParticleLifetimeFromSystem(0, particleLifetime); - sprintf(buff, FORMAT_STRING, particleLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleLifetime = atof(buff); - pParent->updateParticleLifetimeToSystem(0, particleLifetime); - } - } - - pWnd = GetDlgItem(IDC_PSEd_ParticleLifetimeMax); - if (pWnd) { - if (toUI) { - pParent->getParticleLifetimeFromSystem(1, particleLifetime); - sprintf(buff, FORMAT_STRING, particleLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleLifetime = atof(buff); - pParent->updateParticleLifetimeToSystem(1, particleLifetime); - } - } - } - - { // particle size - Real particleSize; - - pWnd = GetDlgItem(IDC_PSEd_SizeMin); - if (pWnd) { - if (toUI) { - pParent->getParticleSizeFromSystem(0, particleSize); - sprintf(buff, FORMAT_STRING, particleSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleSize = atof(buff); - pParent->updateParticleSizeToSystem(0, particleSize); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeMax); - if (pWnd) { - if (toUI) { - pParent->getParticleSizeFromSystem(1, particleSize); - sprintf(buff, FORMAT_STRING, particleSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleSize = atof(buff); - pParent->updateParticleSizeToSystem(1, particleSize); - } - } - } - - { // start size rate - Real startSizeRate; - - pWnd = GetDlgItem(IDC_PSEd_StartSizeRateMin); - if (pWnd) { - if (toUI) { - pParent->getStartSizeRateFromSystem(0, startSizeRate); - sprintf(buff, FORMAT_STRING, startSizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - startSizeRate = atof(buff); - pParent->updateStartSizeRateToSystem(0, startSizeRate); - } - } - - pWnd = GetDlgItem(IDC_PSEd_StartSizeRateMax); - if (pWnd) { - if (toUI) { - pParent->getStartSizeRateFromSystem(1, startSizeRate); - sprintf(buff, FORMAT_STRING, startSizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - startSizeRate = atof(buff); - pParent->updateStartSizeRateToSystem(1, startSizeRate); - } - } - } - - { // size rate - Real sizeRate; - - pWnd = GetDlgItem(IDC_PSEd_SizeRateMin); - if (pWnd) { - if (toUI) { - pParent->getSizeRateFromSystem(0, sizeRate); - sprintf(buff, FORMAT_STRING, sizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeRate = atof(buff); - pParent->updateSizeRateToSystem(0, sizeRate); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeRateMax); - if (pWnd) { - if (toUI) { - pParent->getSizeRateFromSystem(1, sizeRate); - sprintf(buff, FORMAT_STRING, sizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeRate = atof(buff); - pParent->updateSizeRateToSystem(1, sizeRate); - } - } - } - - { // size damping - Real sizeDamping; - - pWnd = GetDlgItem(IDC_PSEd_SizeDampingMin); - if (pWnd) { - if (toUI) { - pParent->getSizeDampingFromSystem(0, sizeDamping); - sprintf(buff, FORMAT_STRING, sizeDamping); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeDamping = atof(buff); - pParent->updateSizeDampingToSystem(0, sizeDamping); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeDampingMax); - if (pWnd) { - if (toUI) { - pParent->getSizeDampingFromSystem(1, sizeDamping); - sprintf(buff, FORMAT_STRING, sizeDamping); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeDamping = atof(buff); - pParent->updateSizeDampingToSystem(1, sizeDamping); - } - } - } - - { // system lifetime - Real systemLifetime; - - pWnd = GetDlgItem(IDC_PSEd_SystemLifetime); - if (pWnd) { - if (toUI) { - pParent->getSystemLifetimeFromSystem(systemLifetime); - sprintf(buff, FORMAT_STRING, systemLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - systemLifetime = atof(buff); - pParent->updateSystemLifetimeToSystem(systemLifetime); - } - } - } - - { // slave position offset - Real slaveOffset; - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetX); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(0, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(0, slaveOffset); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetY); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(1, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(1, slaveOffset); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetZ); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(2, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(2, slaveOffset); - } - } - } - - { // drift velocity - Real driftVelocity; - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityX); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(0, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(0, driftVelocity); - } - } - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityY); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(1, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(1, driftVelocity); - } - } - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityZ); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(2, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(2, driftVelocity); - } - } - } - - { // slave system - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_SlaveSystem); - if (pCombo->GetCount() == 0) { - // This is done here because InitPanel is called before Particle Systems have been sent over. - pCombo->AddString(NONE_STRING); - std::list::const_iterator cit; - const std::list &r = pParent->getAllParticleSystems(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pCombo->AddString(cit->c_str()); - } - } - - if (pCombo) { - if (toUI) { - pParent->getSlaveSystemFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - if (buff[0] == 0) { - pCombo->SelectString(-1, NONE_STRING); - } else { - pCombo->SelectString(-1, buff); - } - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pCombo->GetLBText(selndx, buff); - if (strcmp(buff, NONE_STRING) == 0) { - pParent->updateSlaveSystemToSystem(""); - } else { - pParent->updateSlaveSystemToSystem(buff); - } - } - } - } - } - - { // slave system - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_PerParticleSystem); - if (pCombo->GetCount() == 0) { - // This is done here because InitPanel is called before Particle Systems have been sent over. - pCombo->AddString(NONE_STRING); - std::list::const_iterator cit; - const std::list &r = pParent->getAllParticleSystems(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pCombo->AddString(cit->c_str()); - } - } - - if (pCombo) { - if (toUI) { - pParent->getPerParticleSystemFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - if (buff[0] == 0) { - pCombo->SelectString(-1, NONE_STRING); - } else { - pCombo->SelectString(-1, buff); - } - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pCombo->GetLBText(selndx, buff); - if (strcmp(buff, NONE_STRING) == 0) { - pParent->updatePerParticleSystemToSystem(""); - } else { - pParent->updatePerParticleSystemToSystem(buff); - } - } - } - } - } - - { // ping pong wind start angle - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongStartAngleMin); - if (pWnd) { - if (toUI) { - pParent->getPingPongStartAngleFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongStartAngleToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongStartAngleMax); - if (pWnd) { - if (toUI) { - pParent->getPingPongStartAngleFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongStartAngleToSystem(1, angle); - } - } - } - - { // ping pong wind end angle - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongEndAngleMin); - if (pWnd) { - if (toUI) { - pParent->getPingPongEndAngleFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongEndAngleToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongEndAngleMax); - if (pWnd) { - if (toUI) { - pParent->getPingPongEndAngleFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongEndAngleToSystem(1, angle); - } - } - } - - { // wind angle change - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindAngleChangeMin); - if (pWnd) { - if (toUI) { - pParent->getWindAngleChangeFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updateWindAngleChangeToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindAngleChangeMax); - if (pWnd) { - if (toUI) { - pParent->getWindAngleChangeFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updateWindAngleChangeToSystem(1, angle); - } - } - } - - { // wind motion - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_WindMotion); - - if (pCombo) { - int selndx; - if (toUI) { - ParticleSystemInfo::WindMotion windMotion; - - pParent->getWindMotionFromSystem( windMotion ); - selndx = pCombo->SelectString(-1, WindMotionNames[(long) windMotion]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pParent->updateWindMotionToSystem( (ParticleSystemInfo::WindMotion)(selndx + 1) ); - } - } - } - } - - - } -} - -void MoreParmsDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(MoreParmsDialog, CDialog) - ON_EN_KILLFOCUS(IDC_PSEd_InitialDelayMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_InitialDelayMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstDelayMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstDelayMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstCountMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstCountMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ColorScaleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ColorScaleMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ParticleLifetimeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ParticleLifetimeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_StartSizeRateMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_StartSizeRateMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeRateMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeRateMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SystemLifetime, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetZ, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityZ, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_SlaveSystem, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_PerParticleSystem, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindAngleChangeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindAngleChangeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongStartAngleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongStartAngleMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongEndAngleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongEndAngleMax, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_WindMotion, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h deleted file mode 100644 index f7f3dc0d13e..00000000000 --- a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: MoreParmsDialog.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: MoreParmsDialog.h */ -/* Created: John K. McDonald, Jr., 3/23/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/23/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "Lib/BaseType.h" - -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -class MoreParmsDialog : public CDialog -{ - public: - enum { IDD = IDD_PSEd_EditMoreParms }; - MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = nullptr); - virtual ~MoreParmsDialog(); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp deleted file mode 100644 index bd4b45e05d0..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// DebugWindow.cpp : Defines the initialization routines for the DLL. -// - -#include "StdAfx.h" -#include "ParticleEditor.h" -#include "ParticleEditorDialog.h" - -#ifdef RTS_DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// -// Note! -// -// If this DLL is dynamically linked against the MFC -// DLLs, any functions exported from this DLL which -// call into MFC must have the AFX_MANAGE_STATE macro -// added at the very beginning of the function. -// -// For example: -// -// extern "C" BOOL PASCAL EXPORT ExportedFunction() -// { -// AFX_MANAGE_STATE(AfxGetStaticModuleState()); -// // normal function body here -// } -// -// It is very important that this macro appear in each -// function, prior to any calls into MFC. This means that -// it must appear as the first statement within the -// function, even before any object variable declarations -// as their constructors may generate calls into the MFC -// DLL. -// -// Please see MFC Technical Notes 33 and 58 for additional -// details. -// - -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp - -BEGIN_MESSAGE_MAP(CDebugWindowApp, CWinApp) - //{{AFX_MSG_MAP(CDebugWindowApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp construction - -CDebugWindowApp::CDebugWindowApp() -{ - AfxInitialize(true); - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = nullptr; - -} - -DebugWindowDialog* CDebugWindowApp::GetDialogWindow(void) -{ - return m_DialogWindow; -} - -void CDebugWindowApp::SetDialogWindow(DebugWindowDialog* pWnd) -{ - m_DialogWindow = pWnd; -} - -CDebugWindowApp::~CDebugWindowApp() -{ -} - - -///////////////////////////////////////////////////////////////////////////// -// The one and only CDebugWindowApp object - -CDebugWindowApp theApp; - -void __declspec(dllexport) CreateParticleSystemDialog(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - - DebugWindowDialog* tmpWnd; - tmpWnd = new DebugWindowDialog; - tmpWnd->Create(DebugWindowDialog::IDD, nullptr); - - tmpWnd->SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); - tmpWnd->InitPanel(); - tmpWnd->ShowWindow(SW_SHOW); - if (tmpWnd->GetMainWndHWND()) { - SetFocus(tmpWnd->GetMainWndHWND()); - } - - theApp.SetDialogWindow(tmpWnd); - } catch (...) { } -} - -void __declspec(dllexport) DestroyParticleSystemDialog(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->DestroyWindow(); - delete tmpWnd; - theApp.SetDialogWindow(nullptr); - } - } catch (...) { } -} - -void __declspec(dllexport) RemoveAllParticleSystems(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->clearAllParticleSystems(); - } - } catch (...) { } -} - -void __declspec(dllexport) AppendParticleSystem(const char* particleSystemName) -{ - try{ - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->addParticleSystem(particleSystemName); - } - } catch (...) { } -} - -void __declspec(dllexport) RemoveAllThingTemplates( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->clearAllThingTemplates(); - } - } catch (...) { } -} - - -void __declspec(dllexport) AppendThingTemplate( const char* thingTemplateName ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->addThingTemplate(thingTemplateName); - } - } catch (...) { } -} - - -Bool __declspec(dllexport) HasUpdatedSelectedParticleSystem( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->hasSelectionChanged(); - } - } catch (...) { } - - return false; -} - -void __declspec(dllexport) GetSelectedParticleSystemName( char *bufferToCopyInto ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->getSelectedSystemName(bufferToCopyInto); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentParticleCap( int currentParticleCap ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentParticleCap(currentParticleCap); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentNumParticles( int currentParticleCount ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentNumParticles(currentParticleCount); - } - } catch (...) { } -} - -int __declspec(dllexport) GetNewParticleCap( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->getNewParticleCap(); - } - } catch (...) { } - return -1; -} - - -void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->getSelectedParticleAsciiStringParm(parmNum, bufferToCopyInto); - if (whichTemplate) { - (*whichTemplate) = tmpWnd->getCurrentParticleSystem(); - } - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateParticleAsciiStringParm(parmNum, bufferToCopyFrom); - if (whichTemplate) { - (*whichTemplate) = tmpWnd->getCurrentParticleSystem(); - } - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentParticleSystem( ParticleSystemTemplate *particleTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentParticleSystem(particleTemplate); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateSystemUseParameters( ParticleSystemTemplate *particleTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateSystemUseParameters(particleTemplate); - } - } catch(...) { } -} - -Bool __declspec(dllexport) ShouldWriteINI( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldWriteINI(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) HasRequestedReload( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->hasRequestedReload(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldBusyWait( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldBusyWait(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldUpdateParticleCap( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldUpdateParticleCap(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldReloadTextures( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldReloadTextures(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) HasRequestedKillAllSystems( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldKillAllParticleSystems(); - } - } catch (...) { } - - return false; -} - -int __declspec(dllexport) NextParticleEditorBehavior( void ) -{ - try { - if (HasUpdatedSelectedParticleSystem()) { - return PEB_UpdateCurrentSystem; - } - - if (ShouldWriteINI()) { - return PEB_SaveAllSystems; - } - - if (HasRequestedReload()) { - return PEB_ReloadCurrentSystem; - } - - if (ShouldBusyWait()) { - return PEB_BusyWait; - } - - if (ShouldUpdateParticleCap()) { - return PEB_SetParticleCap; - } - - if (ShouldReloadTextures()) { - return PEB_ReloadTextures; - } - - if (HasRequestedKillAllSystems()) { - return PEB_KillAllSystems; - } - - return PEB_Continue; - } catch (...) { } - return PEB_Error; -} - - diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.h b/Generals/Code/Tools/ParticleEditor/ParticleEditor.h deleted file mode 100644 index 5c2b350047a..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditor.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// DebugWindow.h : main header file for the DEBUGWINDOW DLL -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "Resource.h" // main symbols -#include "ParticleEditorExport.h" -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp -// See DebugWindow.cpp for the implementation of this class -// - -class DebugWindowDialog; - -class CDebugWindowApp : public CWinApp -{ - public: - CDebugWindowApp(); - ~CDebugWindowApp(); - DebugWindowDialog* GetDialogWindow(void); - void SetDialogWindow(DebugWindowDialog* pWnd); - - protected: - DebugWindowDialog* m_DialogWindow; - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDebugWindowApp) - //}}AFX_VIRTUAL - - //{{AFX_MSG(CDebugWindowApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp deleted file mode 100644 index 3f5b16ef72b..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ /dev/null @@ -1,1837 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "ParticleEditorDialog.h" - -#include "CParticleEditorPage.h" -#include "EmissionTypePanels.h" -#include "GameClient/ParticleSys.h" -#include "ParticleEditorExport.h" -#include "ParticleTypePanels.h" -#include "VelocityTypePanels.h" - - -#define ARBITRARY_BUFF_SIZE 128 - -DebugWindowDialog::DebugWindowDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd), -m_colorAlphaDialog(CColorAlphaDialog::IDD, this), -m_switchesDialog(CSwitchesDialog::IDD, this), -m_moreParmsDialog(MoreParmsDialog::IDD, this) -{ - mMainWndHWND = ::FindWindow(nullptr, "Command & Conquer: Generals"); - m_activeEmissionPage = 0; - m_activeVelocityPage = 0; - m_activeParticlePage = 0; - m_particleSystem = nullptr; - - - m_changeHasOcurred = false; - m_shouldWriteINI = false; - m_showColorDlg = false; - m_showSwitchesDlg = false; - m_showMoreParmsDlg = false; - m_shouldBusyWait = false; - m_shouldReload = false; - m_shouldUpdateParticleCap = false; - m_shouldReloadTextures = false; - m_shouldKillAllParticleSystems = false; - - m_emissionTypePanels[0] = new EmissionPanelPoint; - m_emissionTypePanels[1] = new EmissionPanelLine; - m_emissionTypePanels[2] = new EmissionPanelBox; - m_emissionTypePanels[3] = new EmissionPanelSphere; - m_emissionTypePanels[4] = new EmissionPanelCylinder; - - m_velocityTypePanels[0] = new VelocityPanelOrtho; - m_velocityTypePanels[1] = new VelocityPanelSphere; - m_velocityTypePanels[2] = new VelocityPanelHemisphere; - m_velocityTypePanels[3] = new VelocityPanelCylinder; - m_velocityTypePanels[4] = new VelocityPanelOutward; - - m_particleTypePanels[0] = new ParticlePanelParticle; - m_particleTypePanels[1] = new ParticlePanelDrawable; - m_particleTypePanels[2] = new ParticlePanelStreak; - m_particleParmValues.resize(PARM_NumParms); -} - -DebugWindowDialog::~DebugWindowDialog() -{ - int i; - for (i = 0; i < NUM_EMISSION_TYPES; ++i) { - delete m_emissionTypePanels[i]; - } - - for (i = 0; i < NUM_VELOCITY_TYPES; ++i) { - delete m_velocityTypePanels[i]; - } - - for (i = 0; i < NUM_PARTICLE_TYPES; ++i) { - delete m_particleTypePanels[i]; - } -} - -int DebugWindowDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - return CDialog::OnCreate(lpCreateStruct); -} - -void DebugWindowDialog::InitPanel( void ) -{ - CComboBox* pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_Priority); - if (pCombo) { - for (int i = 1; ParticlePriorityNames[i]; ++i) { - pCombo->AddString(ParticlePriorityNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_EmissionType); - if (pCombo) { - for (int i = 1; EmissionVolumeTypeNames[i]; ++i) { - pCombo->AddString(EmissionVolumeTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_VelocityType); - if (pCombo) { - for (int i = 1; EmissionVelocityTypeNames[i]; ++i) { - pCombo->AddString(EmissionVelocityTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleType); - if (pCombo) { - for (int i = 1; ParticleTypeNames[i]; ++i) { - pCombo->AddString(ParticleTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ShaderType); - if (pCombo) { - for (int i = 1; ParticleShaderTypeNames[i]; ++i) { - pCombo->AddString(ParticleShaderTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - m_colorAlphaDialog.Create(CColorAlphaDialog::IDD, this); - m_colorAlphaDialog.InitPanel(); - - m_switchesDialog.Create(CSwitchesDialog::IDD, this); - m_switchesDialog.InitPanel(); - - m_moreParmsDialog.Create(MoreParmsDialog::IDD, this); - m_moreParmsDialog.InitPanel(); - - CWnd *pWnd; - int j; - - pWnd = GetDlgItem(IDC_PSEd_EmissionPanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_EMISSION_TYPES; ++j) { - m_emissionTypePanels[j]->Create(m_emissionTypePanels[j]->GetIDD(), this); - m_emissionTypePanels[j]->InitPanel(); - m_emissionTypePanels[j]->ShowWindow(SW_HIDE); - m_emissionTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_emissionTypePanels[0]->ShowWindow(SW_SHOW); - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityPanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_VELOCITY_TYPES; ++j) { - m_velocityTypePanels[j]->Create(m_velocityTypePanels[j]->GetIDD(), this); - m_velocityTypePanels[j]->InitPanel(); - m_velocityTypePanels[j]->ShowWindow(SW_HIDE); - m_velocityTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_velocityTypePanels[0]->ShowWindow(SW_SHOW); - } - - pWnd = GetDlgItem(IDC_PSEd_ParticlePanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_PARTICLE_TYPES; ++j) { - m_particleTypePanels[j]->Create(m_particleTypePanels[j]->GetIDD(), this); - m_particleTypePanels[j]->InitPanel(); - m_particleTypePanels[j]->ShowWindow(SW_HIDE); - m_particleTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_particleTypePanels[0]->ShowWindow(SW_SHOW); - } -} - -HWND DebugWindowDialog::GetMainWndHWND(void) -{ - return mMainWndHWND; -} - -void DebugWindowDialog::addParticleSystem(const char *particleSystem) -{ - if (!particleSystem) { - return; - } - - std::string particleSystemName = particleSystem; - appendParticleSystemToList(particleSystemName); -} - -void DebugWindowDialog::addThingTemplate(const char *thingTemplate) -{ - if (!thingTemplate) { - return; - } - - std::string thingTemplateName = thingTemplate; - appendThingTemplateToList(thingTemplateName); -} - -void DebugWindowDialog::OnClose() -{ - ShowWindow(SW_MINIMIZE); -} - -void DebugWindowDialog::OnSize(UINT nType, int cx, int cy) -{ - CDialog::OnSize(nType, cx, cy); - if (nType == SIZE_MINIMIZED) { - if (mMainWndHWND) { - ::SetFocus(mMainWndHWND); - } - } -} - -void DebugWindowDialog::clearAllParticleSystems(void) -{ - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - return; - } - - m_listOfParticleSystems.clear(); - combo->ResetContent(); -} - -void DebugWindowDialog::clearAllThingTemplates( void ) -{ - m_listOfThingTemplates.clear(); - // this is a kindof(dirty_hack), because there's no way at runtime to verify that - // particleTypePanels[1] is actually a PArticlePanelDrawable - ((ParticlePanelDrawable*)m_particleTypePanels[1])->clearAllThingTemplates(); -} - -void DebugWindowDialog::appendParticleSystemToList( const std::string &rString ) -{ - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - return; - } - - m_listOfParticleSystems.push_front(rString); - combo->AddString(rString.c_str()); -} - -void DebugWindowDialog::appendThingTemplateToList( IN const std::string &rString ) -{ - m_listOfThingTemplates.push_back(rString); -} - -void DebugWindowDialog::OnParticleSystemChange() -{ - m_changeHasOcurred = true; -} - -void DebugWindowDialog::OnPushSave() -{ - m_shouldWriteINI = true; -} - -void DebugWindowDialog::OnReloadTextures() -{ - // First, reload the textures - ParticlePanelParticle* pParticle = (ParticlePanelParticle*) m_particleTypePanels[0]; - if (!pParticle) { - return; - } - - pParticle->InitPanel(); - - // Then, force an update to the ui, to repick the appropriate texture. - performUpdate(true); - - // Finally, signal a flag to the asset manager to reload the actual textures. - m_shouldReloadTextures = true; -} - -Bool DebugWindowDialog::hasSelectionChanged(void) -{ - if (m_changeHasOcurred) { - m_changeHasOcurred = false; - return true; - } - - return false; -} - -void DebugWindowDialog::getSelectedSystemName(char *bufferToCopyInto) const -{ - if (!bufferToCopyInto) { - return; - } - - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - bufferToCopyInto[0] = '\0'; - return; - } - - int ndx = combo->GetCurSel(); - CString string; - - if (ndx > -1) { - combo->GetLBText(ndx, string); - strcpy(bufferToCopyInto, string.GetBuffer(0)); - } else { - combo->GetWindowText(string); - strcpy(bufferToCopyInto, string.GetBuffer(0)); - } -} - -void DebugWindowDialog::getSelectedParticleAsciiStringParm( IN int parmNum, OUT char *bufferToCopyInto ) const -{ - if (parmNum < 0 || parmNum >= PARM_NumParms || !bufferToCopyInto || !m_particleSystem) { - return; - } - - if (!m_particleParmValues[parmNum].empty()) { - strcpy(bufferToCopyInto, m_particleParmValues[parmNum].c_str()); - } else { - bufferToCopyInto[0] = 0; - } -} - -void DebugWindowDialog::updateParticleAsciiStringParm( IN int parmNum, OUT const char *bufferToCopyFrom ) -{ - if (parmNum < 0 || parmNum >= PARM_NumParms || !bufferToCopyFrom) { - return; - } - - m_particleParmValues[parmNum] = bufferToCopyFrom; -} - -void DebugWindowDialog::getColorValueFromSystem(IN Int systemNum, OUT RGBColorKeyframe &colorFrame) const -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - colorFrame = m_particleSystem->m_colorKey[systemNum]; -} - -void DebugWindowDialog::updateColorValueToSystem(IN Int systemNum, IN const RGBColorKeyframe &colorFrame) -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - m_particleSystem->m_colorKey[systemNum] = colorFrame; -} - -void DebugWindowDialog::getAlphaRangeFromSystem(IN Int systemNum, OUT ParticleSystemInfo::RandomKeyframe &randomVar) const -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - randomVar = m_particleSystem->m_alphaKey[systemNum]; -} - -void DebugWindowDialog::updateAlphaRangeToSystem(IN Int systemNum, IN const ParticleSystemInfo::RandomKeyframe &randomVar) -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - m_particleSystem->m_alphaKey[systemNum] = randomVar; -} - -void DebugWindowDialog::getHalfSizeFromSystem( IN Int coordNum, OUT Real& halfSize) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.x; return; - case 1: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.y; return; - case 2: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateHalfSizeToSystem( IN Int coordNum, IN const Real& halfSize) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVolume.box.halfSize.x = halfSize; return; - case 1: m_particleSystem->m_emissionVolume.box.halfSize.y = halfSize; return; - case 2: m_particleSystem->m_emissionVolume.box.halfSize.z = halfSize; return; - default: return; - }; -} - -void DebugWindowDialog::getSphereRadiusFromSystem( OUT Real &radius ) const -{ - if (!m_particleSystem) { - return; - } - - radius = m_particleSystem->m_emissionVolume.sphere.radius; -} - -void DebugWindowDialog::updateSphereRadiusToSystem( IN const Real &radius ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.sphere.radius = radius; -} - -void DebugWindowDialog::getCylinderRadiusFromSystem( OUT Real &radius ) const -{ - if (!m_particleSystem) { - return; - } - - radius = m_particleSystem->m_emissionVolume.cylinder.radius; -} - -void DebugWindowDialog::updateCylinderRadiusToSystem( IN const Real &radius ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.cylinder.radius = radius; -} - -void DebugWindowDialog::getCylinderLengthFromSystem( OUT Real &length ) const -{ - if (!m_particleSystem) { - return; - } - - length = m_particleSystem->m_emissionVolume.cylinder.length; -} - -void DebugWindowDialog::updateCylinderLengthToSystem( IN const Real &length ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.cylinder.length = length; -} - -void DebugWindowDialog::getLineFromSystem( IN Int coordNum, OUT Real& linePoint) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: linePoint = m_particleSystem->m_emissionVolume.line.start.x; return; - case 1: linePoint = m_particleSystem->m_emissionVolume.line.start.y; return; - case 2: linePoint = m_particleSystem->m_emissionVolume.line.start.z; return; - case 3: linePoint = m_particleSystem->m_emissionVolume.line.end.x; return; - case 4: linePoint = m_particleSystem->m_emissionVolume.line.end.y; return; - case 5: linePoint = m_particleSystem->m_emissionVolume.line.end.z; return; - default: return; - }; -} - - -void DebugWindowDialog::updateLineToSystem( IN Int coordNum, IN const Real& linePoint) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVolume.line.start.x = linePoint; return; - case 1: m_particleSystem->m_emissionVolume.line.start.y = linePoint; return; - case 2: m_particleSystem->m_emissionVolume.line.start.z = linePoint; return; - case 3: m_particleSystem->m_emissionVolume.line.end.x = linePoint; return; - case 4: m_particleSystem->m_emissionVolume.line.end.y = linePoint; return; - case 5: m_particleSystem->m_emissionVolume.line.end.z = linePoint; return; - default: return; - }; -} - -void DebugWindowDialog::getVelSphereFromSystem( IN Int velNum, OUT Real &radius) const -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: radius = m_particleSystem->m_emissionVelocity.spherical.speed.m_low; return; - case 1: radius = m_particleSystem->m_emissionVelocity.spherical.speed.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateVelSphereToSystem( IN Int velNum, IN const Real &radius) -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: m_particleSystem->m_emissionVelocity.spherical.speed.m_low = radius; return; - case 1: m_particleSystem->m_emissionVelocity.spherical.speed.m_high = radius; return; - default: return; - }; -} - -void DebugWindowDialog::getVelHemisphereFromSystem( IN Int velNum, OUT Real &radius) const -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: radius = m_particleSystem->m_emissionVelocity.hemispherical.speed.m_low; return; - case 1: radius = m_particleSystem->m_emissionVelocity.hemispherical.speed.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateVelHemisphereToSystem( IN Int velNum, IN const Real &radius) -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: m_particleSystem->m_emissionVelocity.hemispherical.speed.m_low = radius; return; - case 1: m_particleSystem->m_emissionVelocity.hemispherical.speed.m_high = radius; return; - default: return; - }; -} - -void DebugWindowDialog::getVelOrthoFromSystem( IN Int coordNum, OUT Real& ortho) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: ortho = m_particleSystem->m_emissionVelocity.ortho.x.m_low; return; - case 1: ortho = m_particleSystem->m_emissionVelocity.ortho.y.m_low; return; - case 2: ortho = m_particleSystem->m_emissionVelocity.ortho.z.m_low; return; - case 3: ortho = m_particleSystem->m_emissionVelocity.ortho.x.m_high; return; - case 4: ortho = m_particleSystem->m_emissionVelocity.ortho.y.m_high; return; - case 5: ortho = m_particleSystem->m_emissionVelocity.ortho.z.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelOrthoToSystem( IN Int coordNum, IN const Real& ortho) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.ortho.x.m_low = ortho; return; - case 1: m_particleSystem->m_emissionVelocity.ortho.y.m_low = ortho; return; - case 2: m_particleSystem->m_emissionVelocity.ortho.z.m_low = ortho; return; - case 3: m_particleSystem->m_emissionVelocity.ortho.x.m_high = ortho; return; - case 4: m_particleSystem->m_emissionVelocity.ortho.y.m_high = ortho; return; - case 5: m_particleSystem->m_emissionVelocity.ortho.z.m_high = ortho; return; - default: return; - }; -} - -void DebugWindowDialog::getVelCylinderFromSystem( IN Int coordNum, OUT Real& cylinder) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.radial.m_low; return; - case 1: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.normal.m_low; return; - case 2: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.radial.m_high; return; - case 3: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.normal.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelCylinderToSystem( IN Int coordNum, IN const Real& cylinder) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.cylindrical.radial.m_low = cylinder; return; - case 1: m_particleSystem->m_emissionVelocity.cylindrical.normal.m_low = cylinder; return; - case 2: m_particleSystem->m_emissionVelocity.cylindrical.radial.m_high = cylinder; return; - case 3: m_particleSystem->m_emissionVelocity.cylindrical.normal.m_high = cylinder; return; - default: return; - }; -} - -void DebugWindowDialog::getVelOutwardFromSystem( IN Int coordNum, OUT Real& cylinder) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: cylinder = m_particleSystem->m_emissionVelocity.outward.speed.m_low; return; - case 1: cylinder = m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_low; return; - case 2: cylinder = m_particleSystem->m_emissionVelocity.outward.speed.m_high; return; - case 3: cylinder = m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelOutwardToSystem( IN Int coordNum, IN const Real& cylinder) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.outward.speed.m_low = cylinder; return; - case 1: m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_low = cylinder; return; - case 2: m_particleSystem->m_emissionVelocity.outward.speed.m_high = cylinder; return; - case 3: m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_high = cylinder; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleNameFromSystem( OUT char *buffer, IN int buffLen ) const -{ - if (!m_particleSystem) { - return; - } - - if (!buffer) { - return; - } - - getSelectedParticleAsciiStringParm( PARM_ParticleTypeName, buffer); -} - -void DebugWindowDialog::updateParticleNameToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - if (!buffer) { - return; - } - - updateParticleAsciiStringParm( PARM_ParticleTypeName, buffer); -} - -void DebugWindowDialog::getDrawableNameFromSystem( OUT char *buffer, IN int buffLen ) const -{ - getParticleNameFromSystem(buffer, buffLen); -} - -void DebugWindowDialog::updateDrawableNameToSystem( IN const char* buffer ) -{ - updateParticleNameToSystem(buffer); -} - -void DebugWindowDialog::updateCurrentParticleSystem(ParticleSystemTemplate *particleTemplate ) -{ - m_particleSystem = particleTemplate; - performUpdate(true); -} - -void DebugWindowDialog::updateSystemUseParameters(IN ParticleSystemTemplate *particleTemplate ) -{ - m_particleSystem = particleTemplate; - performUpdate(false); -} - -void DebugWindowDialog::getInitialDelayFromSystem( IN Int parmNum, OUT Real& initialDelay ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: initialDelay = m_particleSystem->m_initialDelay.m_low; return; - case 1: initialDelay = m_particleSystem->m_initialDelay.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateInitialDelayToSystem( IN Int parmNum, IN const Real& initialDelay ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_initialDelay.m_low = initialDelay; return; - case 1: m_particleSystem->m_initialDelay.m_high = initialDelay; return; - default: return; - }; -} - -void DebugWindowDialog::getBurstDelayFromSystem( IN Int parmNum, OUT Real& burstDelay ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: burstDelay = m_particleSystem->m_burstDelay.m_low; return; - case 1: burstDelay = m_particleSystem->m_burstDelay.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateBurstDelayToSystem( IN Int parmNum, IN const Real& burstDelay ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_burstDelay.m_low = burstDelay; return; - case 1: m_particleSystem->m_burstDelay.m_high = burstDelay; return; - default: return; - }; -} - -void DebugWindowDialog::getBurstCountFromSystem( IN Int parmNum, OUT Real& burstCount ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: burstCount = m_particleSystem->m_burstCount.m_low; return; - case 1: burstCount = m_particleSystem->m_burstCount.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateBurstCountToSystem( IN Int parmNum, IN const Real& burstCount ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_burstCount.m_low = burstCount; return; - case 1: m_particleSystem->m_burstCount.m_high = burstCount; return; - default: return; - }; -} - -void DebugWindowDialog::getColorScaleFromSystem( IN Int parmNum, OUT Real& colorScale ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: colorScale = m_particleSystem->m_colorScale.m_low; return; - case 1: colorScale = m_particleSystem->m_colorScale.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateColorScaleToSystem( IN Int parmNum, IN const Real& colorScale ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_colorScale.m_low = colorScale; return; - case 1: m_particleSystem->m_colorScale.m_high = colorScale; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleLifetimeFromSystem( IN Int parmNum, OUT Real& particleLifetime ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: particleLifetime = m_particleSystem->m_lifetime.m_low; return; - case 1: particleLifetime = m_particleSystem->m_lifetime.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateParticleLifetimeToSystem( IN Int parmNum, IN const Real& particleLifetime ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_lifetime.m_low = particleLifetime; return; - case 1: m_particleSystem->m_lifetime.m_high = particleLifetime; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleSizeFromSystem( IN Int parmNum, OUT Real& particleSize ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: particleSize = m_particleSystem->m_startSize.m_low; return; - case 1: particleSize = m_particleSystem->m_startSize.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateParticleSizeToSystem( IN Int parmNum, IN const Real& particleSize ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_startSize.m_low = particleSize; return; - case 1: m_particleSystem->m_startSize.m_high = particleSize; return; - default: return; - }; -} - -void DebugWindowDialog::getStartSizeRateFromSystem( IN Int parmNum, OUT Real& startSizeRate ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: startSizeRate = m_particleSystem->m_startSizeRate.m_low; return; - case 1: startSizeRate = m_particleSystem->m_startSizeRate.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateStartSizeRateToSystem( IN Int parmNum, IN const Real& startSizeRate ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_startSizeRate.m_low = startSizeRate; return; - case 1: m_particleSystem->m_startSizeRate.m_high = startSizeRate; return; - default: return; - }; -} - -void DebugWindowDialog::getSizeRateFromSystem( IN Int parmNum, OUT Real& sizeRate ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: sizeRate = m_particleSystem->m_sizeRate.m_low; return; - case 1: sizeRate = m_particleSystem->m_sizeRate.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateSizeRateToSystem( IN Int parmNum, IN const Real& sizeRate ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_sizeRate.m_low = sizeRate; return; - case 1: m_particleSystem->m_sizeRate.m_high = sizeRate; return; - default: return; - }; -} - -void DebugWindowDialog::getSizeDampingFromSystem( IN Int parmNum, OUT Real& sizeDamping ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: sizeDamping = m_particleSystem->m_sizeRateDamping.m_low; return; - case 1: sizeDamping = m_particleSystem->m_sizeRateDamping.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateSizeDampingToSystem( IN Int parmNum, IN const Real& sizeDamping ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_sizeRateDamping.m_low = sizeDamping; return; - case 1: m_particleSystem->m_sizeRateDamping.m_high = sizeDamping; return; - default: return; - }; -} - -void DebugWindowDialog::getSystemLifetimeFromSystem( OUT Real& systemLifetime ) const -{ - if (!m_particleSystem) { - return; - } - - systemLifetime = m_particleSystem->m_systemLifetime; -} - -void DebugWindowDialog::updateSystemLifetimeToSystem( IN const Real& systemLifetime ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_systemLifetime = systemLifetime; -} - -void DebugWindowDialog::getSlaveOffsetFromSystem( IN Int parmNum, OUT Real& slaveOffset ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: slaveOffset = m_particleSystem->m_slavePosOffset.x; return; - case 1: slaveOffset = m_particleSystem->m_slavePosOffset.y; return; - case 2: slaveOffset = m_particleSystem->m_slavePosOffset.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateSlaveOffsetToSystem( IN Int parmNum, IN const Real& slaveOffset ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_slavePosOffset.x = slaveOffset; return; - case 1: m_particleSystem->m_slavePosOffset.y = slaveOffset; return; - case 2: m_particleSystem->m_slavePosOffset.z = slaveOffset; return; - default: return; - }; -} - -void DebugWindowDialog::getDriftVelocityFromSystem( IN Int parmNum, OUT Real& driftVelocity ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: driftVelocity = m_particleSystem->m_driftVelocity.x; return; - case 1: driftVelocity = m_particleSystem->m_driftVelocity.y; return; - case 2: driftVelocity = m_particleSystem->m_driftVelocity.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateDriftVelocityToSystem( IN Int parmNum, IN const Real& driftVelocity ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_driftVelocity.x = driftVelocity; return; - case 1: m_particleSystem->m_driftVelocity.y = driftVelocity; return; - case 2: m_particleSystem->m_driftVelocity.z = driftVelocity; return; - default: return; - }; -} - -void DebugWindowDialog::getSlaveSystemFromSystem( OUT char *buffer, IN Int bufferSize) const -{ - if (!m_particleSystem) { - return; - } - - getSelectedParticleAsciiStringParm(PARM_SlaveSystemName, buffer); -} - -void DebugWindowDialog::updateSlaveSystemToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - updateParticleAsciiStringParm(PARM_SlaveSystemName, buffer); -} - -void DebugWindowDialog::getPerParticleSystemFromSystem( OUT char *buffer, IN Int bufferSize) const -{ - if (!m_particleSystem) { - return; - } - - getSelectedParticleAsciiStringParm(PARM_AttachedSystemName, buffer); -} - -void DebugWindowDialog::updatePerParticleSystemToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - updateParticleAsciiStringParm(PARM_AttachedSystemName, buffer); -} - -void DebugWindowDialog::getSwitchFromSystem( IN SwitchType switchType, OUT Bool& switchVal) const -{ - if (!m_particleSystem) { - return; - } - - switch (switchType) - { - case ST_HOLLOW: switchVal = m_particleSystem->m_isEmissionVolumeHollow; break; - case ST_ONESHOT: switchVal = m_particleSystem->m_isOneShot; break; - case ST_ALIGNXY: switchVal = m_particleSystem->m_isGroundAligned; break; - case ST_EMITABOVEGROUNDONLY: switchVal = m_particleSystem->m_isEmitAboveGroundOnly; break; - case ST_PARTICLEUPTOWARDSEMITTER: switchVal = m_particleSystem->m_isParticleUpTowardsEmitter; break; - }; -} - -void DebugWindowDialog::updateSwitchToSystem( IN SwitchType switchType, IN const Bool& switchVal) -{ - if (!m_particleSystem) { - return; - } - - switch (switchType) - { - case ST_HOLLOW: m_particleSystem->m_isEmissionVolumeHollow = switchVal; break; - case ST_ONESHOT: m_particleSystem->m_isOneShot = switchVal; break; - case ST_ALIGNXY: m_particleSystem->m_isGroundAligned = switchVal; break; - case ST_EMITABOVEGROUNDONLY: m_particleSystem->m_isEmitAboveGroundOnly = switchVal; break; - case ST_PARTICLEUPTOWARDSEMITTER: m_particleSystem->m_isParticleUpTowardsEmitter = switchVal; break; - }; -} - -// ------------------------------------------------------------------------------------------------ -static Real degreeToRadian( Real degree ) { return (degree / 180.0f) * PI; } -static Real radianToDegree( Real radian ) { return (180.0f * radian) / PI; } - -void DebugWindowDialog::getPingPongStartAngleFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windMotionStartAngleMin; break; - case 1: angle = m_particleSystem->m_windMotionStartAngleMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updatePingPongStartAngleToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windMotionStartAngleMin = radian; return; - case 1: m_particleSystem->m_windMotionStartAngleMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getPingPongEndAngleFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windMotionEndAngleMin; break; - case 1: angle = m_particleSystem->m_windMotionEndAngleMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updatePingPongEndAngleToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windMotionEndAngleMin = radian; return; - case 1: m_particleSystem->m_windMotionEndAngleMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getWindAngleChangeFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windAngleChangeMin; break; - case 1: angle = m_particleSystem->m_windAngleChangeMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updateWindAngleChangeToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windAngleChangeMin = radian; return; - case 1: m_particleSystem->m_windAngleChangeMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getWindMotionFromSystem( OUT ParticleSystemInfo::WindMotion& windMotion ) const -{ - if (!m_particleSystem) { - return; - } - - windMotion = m_particleSystem->m_windMotion; -} - -void DebugWindowDialog::updateWindMotionToSystem( IN const ParticleSystemInfo::WindMotion& windMotion ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_windMotion = windMotion; -} - -// The reason I'm using this function is to prohibit me from forgetting to add an update -// one way or the other. The idea is that when you implement one, you might as well implement -// the other, and this way they're in one place. -void DebugWindowDialog::performUpdate( IN Bool toUI ) -{ - if (!m_particleSystem) { - return; - } - - static char buff[ARBITRARY_BUFF_SIZE]; - - { // Update the emission type, velocity type, particle type and shader type. - - CComboBox *pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_Priority); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, ParticlePriorityNames[(long) m_particleSystem->m_priority]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_priority = (ParticlePriorityType)(selndx + 1); - } - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_EmissionType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, EmissionVolumeTypeNames[(long) m_particleSystem->m_emissionVolumeType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_emissionVolumeType = (ParticleSystemInfo::EmissionVolumeType) (selndx + 1); - } - } - - // do the page swap - if (selndx != m_activeEmissionPage && selndx >= 0) { - m_emissionTypePanels[m_activeEmissionPage]->ShowWindow(SW_HIDE); - m_activeEmissionPage = selndx; - m_emissionTypePanels[m_activeEmissionPage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_VelocityType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, EmissionVelocityTypeNames[(long) m_particleSystem->m_emissionVelocityType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_emissionVelocityType = (ParticleSystemInfo::EmissionVelocityType) (selndx + 1); - } - } - - // do the page swap - if (selndx != m_activeVelocityPage && selndx >= 0) { - m_velocityTypePanels[m_activeVelocityPage]->ShowWindow(SW_HIDE); - m_activeVelocityPage = selndx; - m_velocityTypePanels[m_activeVelocityPage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, ParticleTypeNames[(long) m_particleSystem->m_particleType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_particleType = (ParticleSystemInfo::ParticleType) (selndx + 1); - } - } - - // do the swap - if (selndx != m_activeParticlePage && selndx >= 0) { - m_particleTypePanels[m_activeParticlePage]->ShowWindow(SW_HIDE); - m_activeParticlePage = selndx; - m_particleTypePanels[m_activeParticlePage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ShaderType); - if (pCombo) { - if (toUI) { - pCombo->SelectString(-1, ParticleShaderTypeNames[(long) m_particleSystem->m_shaderType]); - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_shaderType = (ParticleSystemInfo::ParticleShaderType) (selndx + 1); - } - } - } - } - - { // update the minimum and maximum for Angle X, Y and Z, and Angular X, Y, and Z - - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_AngleXMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleX.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleYMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleY.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleZMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleZ.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleZ.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleXMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleX.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleYMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleY.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleZMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleZ.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleZ.m_high = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateXMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateX.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateYMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateY.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateZMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateZ.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateZ.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateXMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateX.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateYMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateY.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateZMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateZ.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateZ.m_high = atof(buff); - } - } - } - - { // update the damping values. - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_AngleDampingMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularDamping.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularDamping.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleDampingMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularDamping.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularDamping.m_high = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityDampingMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_velDamping.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_velDamping.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityDampingMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_velDamping.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_velDamping.m_high = atof(buff); - } - } - } - - { // update gravity - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_Gravity); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_gravity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_gravity = atof(buff); - } - } - } - - { // all the kids need to update too. - m_colorAlphaDialog.performUpdate(toUI); - m_switchesDialog.performUpdate(toUI); - m_moreParmsDialog.performUpdate(toUI); - m_emissionTypePanels[m_activeEmissionPage]->performUpdate(toUI); - m_velocityTypePanels[m_activeVelocityPage]->performUpdate(toUI); - m_particleTypePanels[m_activeParticlePage]->performUpdate(toUI); - } -} - -void DebugWindowDialog::OnParticleSystemEdit() -{ - signalParticleSystemEdit(); -} - -void DebugWindowDialog::signalParticleSystemEdit( void ) -{ - performUpdate(false); -} - -void DebugWindowDialog::OnEditColorAlpha() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_EditColorButton); - if (!pButton) { - return; - } - - m_showColorDlg = !m_showColorDlg; - - if (m_showColorDlg) { - m_colorAlphaDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_colorAlphaDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -void DebugWindowDialog::OnEditSwitches() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_EditSwitchesButton); - if (!pButton) { - return; - } - - m_showSwitchesDlg = !m_showSwitchesDlg ; - - if (m_showSwitchesDlg) { - m_switchesDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_switchesDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -// kill all particle systems in the world -- one time effect -void DebugWindowDialog::OnKillAllParticleSystems() -{ - m_shouldKillAllParticleSystems = true; -} - - -void DebugWindowDialog::OnEditMoreParms() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_Continued); - if (!pButton) { - return; - } - - m_showMoreParmsDlg = !m_showMoreParmsDlg ; - - if (m_showMoreParmsDlg ) { - m_moreParmsDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_moreParmsDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -Bool DebugWindowDialog::shouldWriteINI( void ) -{ - if (m_shouldWriteINI) { - m_shouldWriteINI = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::hasRequestedReload( void ) -{ - if (m_shouldReload) { - m_shouldReload = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldBusyWait( void ) -{ - return m_shouldBusyWait; -} - -Bool DebugWindowDialog::shouldUpdateParticleCap( void ) -{ - if (m_shouldUpdateParticleCap) { - m_shouldUpdateParticleCap = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldReloadTextures( void ) -{ - if (m_shouldReloadTextures) { - m_shouldReloadTextures = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldKillAllParticleSystems( void ) -{ - if (m_shouldKillAllParticleSystems) { - m_shouldKillAllParticleSystems = false; - return true; - } - - return false; -} - -void DebugWindowDialog::OnSysCommand(UINT nID, LPARAM lParam) -{ - CDialog::OnSysCommand(nID, lParam); -} - -void DebugWindowDialog::OnReloadSystem( void ) -{ - m_shouldReload = true; -} - -void DebugWindowDialog::OnReloadCurrent() -{ - OnReloadSystem(); -} - -void DebugWindowDialog::OnReloadAll() -{ - OnReloadSystem(); -} - -void DebugWindowDialog::OnSaveCurrent() -{ - OnPushSave(); -} - -void DebugWindowDialog::OnSaveAll() -{ - OnPushSave(); -} - -void DebugWindowDialog::OnParticleCapEdit() -{ - m_shouldUpdateParticleCap = true; -} - -void DebugWindowDialog::updateCurrentParticleCap( IN int particleCap ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCap); - if (!pWnd) { - return; - } - - sprintf(buff, "%d", particleCap); - pWnd->SetWindowText(buff); -} - -void DebugWindowDialog::updateCurrentNumParticles( IN int particleCount ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCount); - if (!pWnd) { - return; - } - - sprintf(buff, "%d", particleCount); - pWnd->SetWindowText(buff); -} - -int DebugWindowDialog::getNewParticleCap( void ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCap); - if (!pWnd) { - return -1; - } - - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - - return atoi(buff); -} - -BEGIN_MESSAGE_MAP(DebugWindowDialog, CDialog) - ON_WM_CREATE() - ON_WM_CLOSE() - ON_WM_SIZE() - ON_WM_SYSCOMMAND() - ON_CBN_SELCHANGE(IDC_PSEd_ParticleSystem, OnParticleSystemChange) - ON_BN_CLICKED(IDC_PSEd_Go, OnParticleSystemChange) - ON_BN_CLICKED(IDC_PSEd_EditColorButton, OnEditColorAlpha) - ON_BN_CLICKED(IDC_PSEd_Continued, OnEditMoreParms) - ON_BN_CLICKED(IDC_PSEd_Save, OnPushSave) - ON_BN_CLICKED(IDC_PSEd_EditSwitchesButton, OnEditSwitches) - ON_BN_CLICKED(IDC_PSEd_KillAll, OnKillAllParticleSystems) - - ON_CBN_SELCHANGE(IDC_PSEd_Priority, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_EmissionType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_VelocityType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_ShaderType, OnParticleSystemEdit) - ON_COMMAND(ID_FILE_RELOADCURRENT, OnReloadCurrent) - ON_COMMAND(ID_FILE_RELOADALL, OnReloadAll) - ON_COMMAND(ID_FILE_SAVECURRENT, OnSaveCurrent) - ON_COMMAND(ID_FILE_SAVEALL, OnSaveAll) - ON_COMMAND(ID_FILE_RELOADTEXTURES, OnReloadTextures) - - - ON_EN_KILLFOCUS(IDC_PSEd_CurrentParticleCap, OnParticleCapEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleZMax, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateZMax, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AngleDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_VelocityDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_VelocityDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_Gravity, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h deleted file mode 100644 index 0b1e474b4d5..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h +++ /dev/null @@ -1,317 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include // for std::pair -#include // for std::string -#include // for std::vector -#include // for std::list - -#define DEFINE_PARTICLE_SYSTEM_NAMES 1 -#include "GameClient/ParticleSys.h" - -#include "CColorAlphaDialog.h" -#include "CSwitchesDialog.h" -#include "MoreParmsDialog.h" - -#define FORMAT_STRING "%.2f" -#define NONE_STRING "(None)" -struct RGBColorKeyframe; -struct RandomKeyframe; -interface ISwapablePanel; - -#define NUM_EMISSION_TYPES 5 -#define NUM_VELOCITY_TYPES 5 -#define NUM_PARTICLE_TYPES 3 -#define NUM_SHADER_TYPES 3 - -enum SwitchType -{ - ST_HOLLOW = 0, - ST_ONESHOT, - ST_ALIGNXY, - ST_EMITABOVEGROUNDONLY, - ST_PARTICLEUPTOWARDSEMITTER, -}; - -class DebugWindowDialog : public CDialog -{ - public: - enum {IDD = IDD_PSEd}; - DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = nullptr); - virtual ~DebugWindowDialog(); - - void InitPanel( void ); - HWND GetMainWndHWND( void ); - void addParticleSystem( IN const char *particleSystem ); - void addThingTemplate( IN const char *thingTemplate ); - void clearAllParticleSystems( void ); - void clearAllThingTemplates( void ); - Bool hasSelectionChanged( void ); - void getSelectedSystemName( OUT char *bufferToCopyInto ) const; - void getSelectedParticleAsciiStringParm( IN int parmNum, OUT char *bufferToCopyInto ) const; - void updateParticleAsciiStringParm( IN int parmNum, IN const char *bufferToCopyFrom ); - void updateCurrentParticleCap( IN int particleCap ); - void updateCurrentNumParticles( IN int particleCount ); - int getNewParticleCap( void ); - - void updateCurrentParticleSystem( IN ParticleSystemTemplate *particleTemplate ); - void updateSystemUseParameters( IN ParticleSystemTemplate *particleTemplate ); - void signalParticleSystemEdit( void ); - - - // The purpose of these is to add as few friends as possible to the particle system classes. - // Therefore, this class has ALL the access to ParticleSystems, and dances on the data directly. - // Child panels make calls here - void getColorValueFromSystem( IN Int systemNum, - OUT RGBColorKeyframe &colorFrame ) const; - - void updateColorValueToSystem( IN Int systemNum, - IN const RGBColorKeyframe &colorFrame ); - - void getAlphaRangeFromSystem( IN Int systemNum, - OUT ParticleSystemInfo::RandomKeyframe &randomVar ) const; - - void updateAlphaRangeToSystem( IN Int systemNum, - IN const ParticleSystemInfo::RandomKeyframe &randomVar ); - - void getHalfSizeFromSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z - OUT Real& halfSize ) const; - - void updateHalfSizeToSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z - IN const Real &halfSize ); - - void getSphereRadiusFromSystem( OUT Real &radius ) const; - void updateSphereRadiusToSystem( IN const Real &radius ); - - void getCylinderRadiusFromSystem( OUT Real &radius ) const; - void updateCylinderRadiusToSystem( IN const Real &radius ); - - void getCylinderLengthFromSystem( OUT Real &length ) const; - void updateCylinderLengthToSystem( IN const Real &length ); - - void getLineFromSystem( IN Int coordNum, // 0:X1, 1:Y1, 2:Z1, 3:X2, 4:Y2, 5:Z2 - OUT Real& linePoint ) const; - - void updateLineToSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z, 3:X2, 4:Y2, 5:Z2 - IN const Real &linePoint ); - - void getVelSphereFromSystem( IN Int velNum, // 0:min 1:max - OUT Real &radius ) const; - - void updateVelSphereToSystem( IN Int velNum, // 0:min 1:max - IN const Real &radius ); - - void getVelHemisphereFromSystem( IN Int velNum, // 0:min 1:max - OUT Real &radius ) const; - - void updateVelHemisphereToSystem( IN Int velNum, // 0:min 1:max - IN const Real &radius ); - - void getVelOrthoFromSystem( IN Int coordNum, // 0:Xmin, 1:Ymin, 2:Zmin, 3:Xmax, 4:Ymax, 5:Zmax - OUT Real& ortho ) const; - - void updateVelOrthoToSystem( IN Int coordNum, // 0:Xmin, 1:Ymin, 2:Zmin, 3:Xmax, 4:Ymax, 5:Zmax - IN const Real& ortho ); - - void getVelCylinderFromSystem( IN Int coordNum, // 0:Radialmin, 1:Lengthmin, 2:Radialmax, 3:Lengthmax - OUT Real& ortho ) const; - - void updateVelCylinderToSystem( IN Int coordNum, // 0:Radialmin, 1:Lengthmin, 2:Radialmax, 3:Lengthmax - IN const Real& ortho ); - - void getVelOutwardFromSystem( IN Int coordNum, // 0:Outwardmin, 1:Othermin, 2:Outwardmax, 3:Othermax - OUT Real& ortho ) const; - - void updateVelOutwardToSystem( IN Int coordNum, // 0:Outwardmin, 1:Othermin, 2:Outwardmax, 3:Othermax - IN const Real& ortho ); - - void getParticleNameFromSystem( OUT char *buffer, IN int buffLen ) const; - void updateParticleNameToSystem( IN const char *buffer ); - void getDrawableNameFromSystem( OUT char *buffer, IN int buffLen ) const; - void updateDrawableNameToSystem( IN const char *buffer ); - - void getInitialDelayFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& initialDelay ) const; - - void updateInitialDelayToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& initialDelay ); - - void getBurstDelayFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& burstDelay ) const; - - void updateBurstDelayToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& burstDelay ); - - void getBurstCountFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& burstCount ) const; - - void updateBurstCountToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& burstCount ); - - void getColorScaleFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& colorScale ) const; - - void updateColorScaleToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& colorScale ); - - void getParticleLifetimeFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& particleLifetime ) const; - - void updateParticleLifetimeToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& particleLifetime ); - - void getParticleSizeFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& particleSize ) const; - - void updateParticleSizeToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& particleSize ); - - void getStartSizeRateFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& startSizeRate ) const; - - void updateStartSizeRateToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& startSizeRate ); - - void getSizeRateFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& sizeRate ) const; - - void updateSizeRateToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& sizeRate ); - - void getSizeDampingFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& sizeDamping ) const; - - void updateSizeDampingToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& sizeDamping ); - - void getSystemLifetimeFromSystem( OUT Real& systemLifetime ) const; - - void updateSystemLifetimeToSystem( IN const Real& systemLifetime ); - - void getSlaveOffsetFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& slaveOffset ) const; - - void updateSlaveOffsetToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& slaveOffset ); - - void getDriftVelocityFromSystem( IN Int parmNum, // 0:X, 1:Y, 2:Z - OUT Real& driftVelocity ) const; - - void updateDriftVelocityToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& driftVelocity ); - - void getSwitchFromSystem( IN SwitchType switchType, - OUT Bool& switchVal ) const; - - void updateSwitchToSystem( IN SwitchType switchType, - IN const Bool& switchVal ); - - void getSlaveSystemFromSystem( OUT char *buffer, IN Int bufferSize) const; - void updateSlaveSystemToSystem( IN const char *buffer ); - - void getPerParticleSystemFromSystem( OUT char *buffer, IN Int bufferSize) const; - void updatePerParticleSystemToSystem( IN const char *buffer ); - - void getWindMotionFromSystem( OUT ParticleSystemInfo::WindMotion& windMotion ) const; - void updateWindMotionToSystem( IN const ParticleSystemInfo::WindMotion& windMotion ); - - void getPingPongStartAngleFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updatePingPongStartAngleToSystem( IN Int parmNum, IN const Real& angle ); - - void getPingPongEndAngleFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updatePingPongEndAngleToSystem( IN Int parmNum, IN const Real& angle ); - - void getWindAngleChangeFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updateWindAngleChangeToSystem( IN Int parmNum, IN const Real& angle ); - - Bool shouldWriteINI( void ); - Bool hasRequestedReload( void ); - Bool shouldBusyWait( void ); - Bool shouldUpdateParticleCap( void ); - Bool shouldReloadTextures( void ); - Bool shouldKillAllParticleSystems( void ); - - - - const std::list &getAllThingTemplates( void ) const { return m_listOfThingTemplates; } - const std::list &getAllParticleSystems( void ) const { return m_listOfParticleSystems; } - - ParticleSystemTemplate *getCurrentParticleSystem( void ) { return m_particleSystem; } - - protected: - HWND mMainWndHWND; - Bool m_changeHasOcurred; - ParticleSystemTemplate *m_particleSystem; - std::list m_listOfThingTemplates; - std::vector m_particleParmValues; - std::list m_listOfParticleSystems; - - Bool m_shouldWriteINI; - Bool m_showColorDlg; - Bool m_showSwitchesDlg; - Bool m_showMoreParmsDlg; - Bool m_shouldReload; - Bool m_shouldBusyWait; - Bool m_shouldUpdateParticleCap; - Bool m_shouldReloadTextures; - Bool m_shouldKillAllParticleSystems; - - CColorAlphaDialog m_colorAlphaDialog; - CSwitchesDialog m_switchesDialog; - MoreParmsDialog m_moreParmsDialog; - - - int m_activeEmissionPage; - int m_activeVelocityPage; - int m_activeParticlePage; - - ISwapablePanel *m_emissionTypePanels[NUM_EMISSION_TYPES]; - ISwapablePanel *m_velocityTypePanels[NUM_VELOCITY_TYPES]; - ISwapablePanel *m_particleTypePanels[NUM_PARTICLE_TYPES]; - - void appendParticleSystemToList( IN const std::string &rString ); - void appendThingTemplateToList( IN const std::string &rString ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - - protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnClose(); - afx_msg void OnParticleSystemChange(); // the current particle system isn't the same as the previous system - afx_msg void OnParticleSystemEdit(); // this system has been edited - afx_msg void OnKillAllParticleSystems(); // kill all particle systems in the world - afx_msg void OnEditColorAlpha(); - afx_msg void OnEditMoreParms(); - afx_msg void OnEditSwitches(); - afx_msg void OnPushSave(); - afx_msg void OnReloadTextures(); - afx_msg void OnReloadSystem(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnReloadCurrent(); - afx_msg void OnReloadAll(); - afx_msg void OnSaveCurrent(); - afx_msg void OnSaveAll(); - afx_msg void OnParticleCapEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h deleted file mode 100644 index dfcaf5fef4d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class ParticleSystemTemplate; - -// Declared extern C to prevent name mangling, which makes life very unhappy -extern "C" { - // Called to create the dialog - void __declspec(dllexport) CreateParticleSystemDialog( void ); - - // Called to (not surprisingly) destroy the dialog (and free the resources) - void __declspec(dllexport) DestroyParticleSystemDialog( void ); - - void __declspec(dllexport) RemoveAllParticleSystems( void ); - void __declspec(dllexport) AppendParticleSystem( const char* particleSystemName ); - void __declspec(dllexport) RemoveAllThingTemplates( void ); - void __declspec(dllexport) AppendThingTemplate( const char* thingTemplateName ); - - Bool __declspec(dllexport) HasUpdatedSelectedParticleSystem( void ); - - void __declspec(dllexport) GetSelectedParticleSystemName( char *bufferToCopyInto ); - - void __declspec(dllexport) UpdateCurrentParticleCap( int currentParticleCap ); - void __declspec(dllexport) UpdateCurrentNumParticles( int currentParticleCount ); - int __declspec(dllexport) GetNewParticleCap( void ); - - -# define PARM_ParticleTypeName 0x00 -# define PARM_SlaveSystemName 0x01 -# define PARM_AttachedSystemName 0x02 -# define PARM_NumParms 0x03 - - // parmNum can be exactly one of the above defines (PARM_*) - void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate ); - void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate ); - - - void __declspec(dllexport) UpdateCurrentParticleSystem( ParticleSystemTemplate *particleTemplate ); - void __declspec(dllexport) UpdateSystemUseParameters( ParticleSystemTemplate *particleTemplate ); - - Bool __declspec(dllexport) ShouldWriteINI( void ); - Bool __declspec(dllexport) ShouldBusyWait( void ); - Bool __declspec(dllexport) ShouldUpdateParticleCap( void ); - Bool __declspec(dllexport) ShouldReloadTextures( void ); - - -# define PEB_Continue 0x00 -# define PEB_UpdateCurrentSystem 0x01 -# define PEB_ChangeToAnotherSystem 0x02 -# define PEB_SaveCurrentSystem 0x03 -# define PEB_SaveAllSystems 0x03 -# define PEB_ReloadCurrentSystem 0x04 -# define PEB_SetParticleCap 0x05 -# define PEB_ReloadTextures 0x06 -# define PEB_KillAllSystems 0x07 -# define PEB_BusyWait 0xFE -# define PEB_Error 0xFF - - - int __declspec(dllexport) NextParticleEditorBehavior( void ); - - -} diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp deleted file mode 100644 index ed7ed1750c3..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ParticleTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ParticleTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "ParticleTypePanels.h" -#include "ParticleEditorDialog.h" -#include - -#define ARBITRARY_BUFF_SIZE 128 -static const char *PATH = "Art\\Textures\\"; -//static const char *PATH = "..\\FinalArt\\Textures\\"; -static const char *PREFIX = "EX"; -static const char *POSTFIX = "*.*"; - -// ParticlePanelParticle ////////////////////////////////////////////////////////// -ParticlePanelParticle::ParticlePanelParticle(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelParticle::InitPanel( void ) -{ - CFileFind finder; - - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeParticle); - if (!pWnd) { - return; - } - - // first, clear out any items. - pWnd->ResetContent(); - - std::string findString; - findString = PATH; - findString += PREFIX; - findString += POSTFIX; -// DEBUG_LOG(("ParticlePanedParticle::InitPanel - looking for textures, search string is '%s'", findString.begin())); - BOOL bWorkin = finder.FindFile(findString.c_str()); - while (bWorkin) { - bWorkin = finder.FindNextFile(); - pWnd->AddString(finder.GetFileName()); - } - pWnd->AddString("SMUDGE RESERVED"); //smudges don't use textures so we're hardcoding one to tell them apart. -} - -void ParticlePanelParticle::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Particle parameters - CComboBox *pWnd; - - // first Xmin - pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeParticle); - if (pWnd) { - if (toUI) { - pParent->getParticleNameFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - pWnd->SelectString(-1, buff); - } else { - int curSel = pWnd->GetCurSel(); - if (curSel >= 0) { - pWnd->GetLBText(curSel, buff); - pParent->updateParticleNameToSystem(buff); - } - } - } - } -} - -void ParticlePanelParticle::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelParticle, ISwapablePanel) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeParticle, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// ParticlePanelDrawable ////////////////////////////////////////////////////////// -ParticlePanelDrawable::ParticlePanelDrawable(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelDrawable::InitPanel( void ) -{ - -} - -void ParticlePanelDrawable::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Drawable parameters - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeDrawable); - if (pWnd) { - if (pWnd->GetCount() == 0) { - // This is done here because InitPanel is called before ThingTemplates have been sent over. - std::list::const_iterator cit; - pWnd->AddString(NONE_STRING); - const std::list &r = pParent->getAllThingTemplates(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pWnd->AddString(cit->c_str()); - } - } - - - if (toUI) { - pParent->getDrawableNameFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - pWnd->SelectString(-1, buff); - } else { - int curSel = pWnd->GetCurSel(); - if (curSel >= 0) { - pWnd->GetLBText(curSel, buff); - pParent->updateDrawableNameToSystem(buff); - } - } - } - } -} - -void ParticlePanelDrawable::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -void ParticlePanelDrawable::clearAllThingTemplates( void ) -{ - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeDrawable); - if (!pWnd) { - return; - } - - pWnd->Clear(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelDrawable, ISwapablePanel) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeDrawable, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// ParticlePanelStreak ////////////////////////////////////////////////////////// -ParticlePanelStreak::ParticlePanelStreak(UINT nIDTemplate, CWnd* pParentWnd) : ParticlePanelParticle(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelStreak::InitPanel( void ) -{ - ParticlePanelParticle::InitPanel(); -} - -void ParticlePanelStreak::performUpdate( IN Bool toUI ) -{ - ParticlePanelParticle::performUpdate(toUI); -} - -void ParticlePanelStreak::OnParticleSystemEdit() -{ - ParticlePanelParticle::OnParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelStreak, ParticlePanelParticle) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeParticle, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h deleted file mode 100644 index 5dc146d78cb..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ParticleTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ParticleTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// ParticlePanelParticle ////////////////////////////////////////////////////////// -class ParticlePanelParticle : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelParticle}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// ParticlePanelDrawable ////////////////////////////////////////////////////////// -class ParticlePanelDrawable : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelDrawable}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - void clearAllThingTemplates( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// ParticlePanelStreak ////////////////////////////////////////////////////////// -class ParticlePanelStreak : public ParticlePanelParticle -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelStreak}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/Resource.h b/Generals/Code/Tools/ParticleEditor/Resource.h deleted file mode 100644 index bf7d6396bb6..00000000000 --- a/Generals/Code/Tools/ParticleEditor/Resource.h +++ /dev/null @@ -1,205 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ParticleEditor.rc -// -#define IDD_PSEd 1000 -#define IDC_PSEd_ParticleSystem 1000 -#define IDC_PSEd_Go 1001 -#define IDC_PSEd_ParentSystem 1002 -#define IDD_PSEd_EditColorAndAlpha 1002 -#define IDC_PSEd_EmissionType 1003 -#define IDD_PSEd_EmissionPanelLine 1003 -#define IDC_PSEd_AngleXMin 1004 -#define IDD_PSEd_EmissionPanelSphere 1004 -#define IDC_PSEd_VelocityType 1005 -#define IDD_PSEd_EmissionPanelBox 1005 -#define IDC_PSEd_LineStartY 1005 -#define IDC_PSEd_DriftVelocityX 1005 -#define IDC_PSEd_ParticleType 1006 -#define IDD_PSEd_EmissionPanelCylinder 1006 -#define IDC_PSEd_LineStartZ 1006 -#define IDC_PSEd_SlaveOffsetX 1006 -#define IDC_PSEd_ShaderType 1007 -#define IDC_PSEd_LineEndX 1007 -#define IDC_PSEd_AngleYMin 1008 -#define IDC_PSEd_LineEndY 1008 -#define IDD_PSEd_EmissionPanelPoint 1008 -#define IDC_PSEd_AngleZMin 1009 -#define IDC_PSEd_LineEndZ 1009 -#define IDD_PSEd_VelocityPanelOrtho 1009 -#define IDC_PSEd_AngularRateXMin 1010 -#define IDD_PSEd_VelocityPanelSphere 1010 -#define IDC_PSEd_AngularRateYMin 1011 -#define IDD_PSEd_VelocityPanelHemisphere 1011 -#define IDC_PSEd_AngularRateZMin 1012 -#define IDD_PSEd_VelocityPanelCylinder 1012 -#define IDC_PSEd_AngleXMax 1013 -#define IDD_PSEd_VelocityPanelOutward 1013 -#define IDC_PSEd_AngleYMax 1014 -#define IDD_PSEd_ParticlePanelDrawable 1014 -#define IDC_PSEd_AngleZMax 1015 -#define IDD_PSEd_ParticlePanelParticle 1015 -#define IDC_PSEd_AngularRateXMax 1016 -#define IDD_PSEd_EditMoreParms 1016 -#define IDR_FileMenu 1016 -#define IDC_PSEd_AngularRateYMax 1017 -#define IDD_PSEd_EditSwitchesDialog 1017 -#define IDC_PSEd_AngularRateZMax 1018 -#define IDD_PSEd_ParticlePanelStreak 1018 -#define IDC_PSEd_AngleDampingMin 1019 -#define IDC_PSEd_DriftVelocityY 1019 -#define IDC_PSEd_AngleDampingMax 1020 -#define IDC_PSEd_DriftVelocityZ 1020 -#define IDC_PSEd_VelocityDampingMin 1021 -#define IDC_PSEd_VelocityDampingMax 1022 -#define IDC_PSEd_SlaveOffsetY 1023 -#define IDC_PSEd_Save 1023 -#define IDC_PSEd_Priority 1023 -#define IDC_PSEd_Gravity 1024 -#define IDC_PSEd_SlaveOffsetZ 1025 -#define IDC_PSEd_Reload 1025 -#define IDC_PSEd_KillAll 1025 -#define IDC_PSEd_SystemLifetime 1026 -#define IDC_PSEd_ParticleLifetimeMin 1027 -#define IDC_PSEd_ParticleLifetimeMax 1028 -#define IDC_PSEd_SizeRateMin 1029 -#define IDC_PSEd_SizeRateMax 1030 -#define IDC_PSEd_Color1 1031 -#define IDC_PSEd_Color2 1032 -#define IDC_PSEd_Color3 1033 -#define IDC_PSEd_Color4 1034 -#define IDC_PSEd_Color5 1035 -#define IDC_PSEd_Color6 1036 -#define IDC_PSEd_Color7 1037 -#define IDC_PSEd_Color8 1038 -#define IDC_PSEd_EditColorButton 1039 -#define IDC_PSEd_Continued 1040 -#define IDC_PSEd_EditSwitchesButton 1041 -#define IDC_EmissionProperties 1045 -#define IDC_PSEd_CylRadius 1046 -#define IDC_PSEd_CylLength 1047 -#define IDC_PSEd_BoxHalfSizeX 1048 -#define IDC_PSEd_BoxHalfSizeY 1049 -#define IDC_PSEd_BoxHalfSizeZ 1050 -#define IDC_PSEd_LineStartX 1051 -#define IDC_PSEd_SphereRadius 1052 -#define IDC_PSEd_EmissionPanel 1053 -#define IDC_PSEd_CylinderRadialMax 1053 -#define IDC_PSEd_VelocityPanel 1054 -#define IDC_PSEd_CylinderNormalMin 1054 -#define IDC_PSEd_ParticlePanel 1055 -#define IDC_PSEd_CylinderNormalMax 1055 -#define IDC_VelocityProperties 1057 -#define IDC_PSEd_CylinderRadialMin 1059 -#define IDC_PSEd_HemisphereRadialMin 1060 -#define IDC_PSEd_HemisphereRadialMax 1061 -#define IDC_PSEd_SphereRadialMin 1062 -#define IDC_PSEd_SphereRadialMax 1063 -#define IDC_PSEd_OutwardOtherMin 1064 -#define IDC_PSEd_OutwardOtherMax 1065 -#define IDC_PSEd_OutwardSpeedMin 1066 -#define IDC_PSEd_OutwardSpeedMax 1067 -#define IDC_PSEd_CF1_Frame 1068 -#define IDC_PSEd_OrthoZMin 1068 -#define IDC_PSEd_CF2_Frame 1069 -#define IDC_PSEd_OrthoZMax 1069 -#define IDC_PSEd_CF3_Frame 1070 -#define IDC_PSEd_OrthoXMin 1070 -#define IDC_PSEd_CF4_Frame 1071 -#define IDC_PSEd_OrthoXMax 1071 -#define IDC_PSEd_CF5_Frame 1072 -#define IDC_PSEd_OrthoYMin 1072 -#define IDC_PSEd_CF6_Frame 1073 -#define IDC_PSEd_OrthoYMax 1073 -#define IDC_PSEd_CF7_Frame 1074 -#define IDC_PSEd_OneShot 1074 -#define IDC_PSEd_CF8_Frame 1075 -#define IDC_PSEd_Hollow 1075 -#define IDC_PSEd_AF1_Min 1076 -#define IDC_PSEd_ParticleTypeDrawable 1076 -#define IDC_PSEd_AF2_Min 1077 -#define IDC_PSEd_ParticleTypeParticle 1077 -#define IDC_PSEd_AF3_Min 1078 -#define IDC_PSEd_BurstDelayMin 1078 -#define IDC_PSEd_AF1_Max 1079 -#define IDC_PSEd_BurstDelayMax 1079 -#define IDC_PSEd_AF2_Max 1080 -#define IDC_PSEd_InitialDelayMin 1080 -#define IDC_PSEd_AF3_Max 1081 -#define IDC_PSEd_InitialDelayMax 1081 -#define IDC_PSEd_AF4_Min 1082 -#define IDC_PSEd_BurstCountMin 1082 -#define IDC_PSEd_AF5_Min 1083 -#define IDC_PSEd_BurstCountMax 1083 -#define IDC_PSEd_AF6_Min 1084 -#define IDC_PSEd_ColorScaleMin 1084 -#define IDC_PSEd_AF4_Max 1085 -#define IDC_PSEd_ColorScaleMax 1085 -#define IDC_PSEd_AF5_Max 1086 -#define IDC_PSEd_AF6_Max 1087 -#define IDC_PSEd_SlaveSystem 1087 -#define IDC_PSEd_AF7_Min 1088 -#define IDC_PSEd_PerParticleSystem 1088 -#define IDC_PSEd_AF8_Min 1089 -#define IDC_PSEd_SizeMin 1089 -#define IDC_PSEd_AF7_Max 1090 -#define IDC_PSEd_SizeMax 1090 -#define IDC_PSEd_AF8_Max 1091 -#define IDC_PSEd_SizeDampingMin 1091 -#define IDC_PSEd_CurrentParticleCap 1091 -#define IDC_PSEd_AF1_Frame 1092 -#define IDC_PSEd_SizeDampingMax 1092 -#define IDC_PSEd_CurrentParticleCount 1092 -#define IDC_PSEd_AF2_Frame 1093 -#define IDC_PSEd_GroundAligned 1093 -#define IDC_PSEd_StartSizeRateMin 1093 -#define IDC_PSEd_AF3_Frame 1094 -#define IDC_PSEd_EmitAboveGroundOnly 1094 -#define IDC_PSEd_StartSizeRateMax 1094 -#define IDC_PSEd_AF4_Frame 1095 -#define IDC_PSEd_ParticleUpTowardsEmitter 1095 -#define IDC_PSEd_AF5_Frame 1096 -#define IDC_PSEd_AF6_Frame 1097 -#define IDC_PSEd_AF7_Frame 1098 -#define IDC_PSEd_WindAngleChangeMin 1098 -#define IDC_PSEd_AF8_Frame 1099 -#define IDC_PSEd_WindPingPongStartAngleMin 1099 -#define IDC_PSEd_WindPingPongStartAngleMax 1100 -#define IDC_PSEd_WindMotion 1101 -#define IDC_PSEd_WindAngleChangeMax 1102 -#define IDC_PSEd_WindPingPongEndAngleMin 1103 -#define IDC_PSEd_WindPingPongEndAngleMax 1104 -#define ID_FILE_SAVEALL 32771 -#define ID_FILE_SAVECURRENT 32772 -#define ID_FILE_RELOADCURRENT 32773 -#define ID_FILE_RELOADALL 32775 -#define ID_FILE_RELOADTEXTURES 32776 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 1019 -#define _APS_NEXT_COMMAND_VALUE 32777 -#define _APS_NEXT_CONTROL_VALUE 1102 -#define _APS_NEXT_SYMED_VALUE 1000 -#endif -#endif diff --git a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp deleted file mode 100644 index 3092ee2aef4..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ShaderTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ShaderTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "ShaderTypePanels.h" diff --git a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h b/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h deleted file mode 100644 index f3d5ffe6f62..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ShaderTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ShaderTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// diff --git a/Generals/Code/Tools/ParticleEditor/StdAfx.cpp b/Generals/Code/Tools/ParticleEditor/StdAfx.cpp deleted file mode 100644 index 7e214580f01..00000000000 --- a/Generals/Code/Tools/ParticleEditor/StdAfx.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// stdafx.cpp : source file that includes just the standard includes -// DebugWindow.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "StdAfx.h" - - - diff --git a/Generals/Code/Tools/ParticleEditor/StdAfx.h b/Generals/Code/Tools/ParticleEditor/StdAfx.h deleted file mode 100644 index 31a9a456d21..00000000000 --- a/Generals/Code/Tools/ParticleEditor/StdAfx.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -// TheSuperHackers @build xezon 24/03/2025 Prevent afxwin.h from loading d3d9types.h, colliding with our own DirectX library. -#define _d3d9TYPES_H_ - -#include // MFC core and standard components -#include // MFC extensions - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC OLE classes -#include // MFC OLE dialog classes -#include // MFC Automation classes -#endif // _AFX_NO_OLE_SUPPORT - - -#ifndef _AFX_NO_DB_SUPPORT -#include // MFC ODBC database classes -#endif // _AFX_NO_DB_SUPPORT - -#ifndef _AFX_NO_DAO_SUPPORT -#include // MFC DAO database classes -#endif // _AFX_NO_DAO_SUPPORT - -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -// I don't care that debug symbols are longer than 255, I won't read them anyways. -#pragma warning (disable : 4786) - -// Define IN and OUT. Use them for sementic emphasis. -#ifndef IN -# define IN -#endif - -#ifndef OUT -# define OUT -#endif - -#ifndef interface -# define interface struct -#endif - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#include diff --git a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp deleted file mode 100644 index 5adc1e5ea25..00000000000 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: VelocityTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: VelocityTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "VelocityTypePanels.h" -#include "ParticleEditorDialog.h" - -#define ARBITRARY_BUFF_SIZE 128 - -// VelocityPanelOrtho ////////////////////////////////////////////////////////// -VelocityPanelOrtho::VelocityPanelOrtho(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelOrtho::InitPanel( void ) -{ - -} - -void VelocityPanelOrtho::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update ortho parameters - Real ortho; - CWnd *pWnd; - - // first Xmin - pWnd = GetDlgItem(IDC_PSEd_OrthoXMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(0, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(0, ortho); - } - } - - // now the Ymin - pWnd = GetDlgItem(IDC_PSEd_OrthoYMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(1, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(1, ortho); - } - } - - // now the Zmin - pWnd = GetDlgItem(IDC_PSEd_OrthoZMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(2, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(2, ortho); - } - } - - // first the Xmax - pWnd = GetDlgItem(IDC_PSEd_OrthoXMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(3, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(3, ortho); - } - } - - // now the Ymax - pWnd = GetDlgItem(IDC_PSEd_OrthoYMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(4, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(4, ortho); - } - } - - // the Zmax - pWnd = GetDlgItem(IDC_PSEd_OrthoZMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(5, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(5, ortho); - } - } - } -} - -void VelocityPanelOrtho::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelOrtho, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoZMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelSphere //////////////////////////////////////////////////////// -VelocityPanelSphere::VelocityPanelSphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelSphere::InitPanel( void ) -{ - -} - -void VelocityPanelSphere::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Sphere Velocity Parameters - Real radial; - CWnd *pWnd; - - // radial min - pWnd = GetDlgItem(IDC_PSEd_SphereRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelSphereFromSystem(0, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelSphereToSystem(0, radial); - } - } - - // radial max - pWnd = GetDlgItem(IDC_PSEd_SphereRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelSphereFromSystem(1, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelSphereToSystem(1, radial); - } - } - } -} - -void VelocityPanelSphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelSphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadialMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - - -// VelocityPanelHemisphere ////////////////////////////////////////////////////////// -VelocityPanelHemisphere::VelocityPanelHemisphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelHemisphere::InitPanel( void ) -{ - -} - -void VelocityPanelHemisphere::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Sphere Velocity Parameters - Real radial; - CWnd *pWnd; - - // radial min - pWnd = GetDlgItem(IDC_PSEd_HemisphereRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelHemisphereFromSystem(0, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelHemisphereToSystem(0, radial); - } - } - - // radial max - pWnd = GetDlgItem(IDC_PSEd_HemisphereRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelHemisphereFromSystem(1, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelHemisphereToSystem(1, radial); - } - } - } -} - -void VelocityPanelHemisphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelHemisphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_HemisphereRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_HemisphereRadialMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelCylinder ////////////////////////////////////////////////////// -VelocityPanelCylinder::VelocityPanelCylinder(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelCylinder::InitPanel( void ) -{ - -} - -void VelocityPanelCylinder::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update cylinder parameters - Real cylinder; - CWnd *pWnd; - - // first radial min - pWnd = GetDlgItem(IDC_PSEd_CylinderRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(0, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(0, cylinder); - } - } - - // now the normal min - pWnd = GetDlgItem(IDC_PSEd_CylinderNormalMin); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(1, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(1, cylinder); - } - } - - // now the radial max - pWnd = GetDlgItem(IDC_PSEd_CylinderRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(2, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(2, cylinder); - } - } - - // now normal max - pWnd = GetDlgItem(IDC_PSEd_CylinderNormalMax); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(3, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(3, cylinder); - } - } - } -} - -void VelocityPanelCylinder::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelCylinder, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderNormalMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderRadialMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderNormalMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelOutward /////////////////////////////////////////////////////////// -VelocityPanelOutward::VelocityPanelOutward(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelOutward::InitPanel( void ) -{ - -} - -void VelocityPanelOutward::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update outward parameters - Real outward; - CWnd *pWnd; - - // first radial min - pWnd = GetDlgItem(IDC_PSEd_OutwardSpeedMin); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(0, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(0, outward); - } - } - - // now the normal min - pWnd = GetDlgItem(IDC_PSEd_OutwardOtherMin); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(1, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(1, outward); - } - } - - // now the radial max - pWnd = GetDlgItem(IDC_PSEd_OutwardSpeedMax); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(2, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(2, outward); - } - } - - // first the normal max - pWnd = GetDlgItem(IDC_PSEd_OutwardOtherMax); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(3, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(3, outward); - } - } - } -} - -void VelocityPanelOutward::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelOutward, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardSpeedMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardOtherMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardSpeedMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardOtherMax, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h deleted file mode 100644 index 4568438d940..00000000000 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts 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 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: VelocityTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: VelocityTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// VelocityPanelOrtho ////////////////////////////////////////////////////////// -class VelocityPanelOrtho : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelOrtho}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelSphere //////////////////////////////////////////////////////// -class VelocityPanelSphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelSphere}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelHemisphere ////////////////////////////////////////////////////////// -class VelocityPanelHemisphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelHemisphere}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelCylinder ////////////////////////////////////////////////////// -class VelocityPanelCylinder : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelCylinder}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelOutward /////////////////////////////////////////////////////////// -class VelocityPanelOutward : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelOutward}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/GeneralsMD/CMakeLists.txt b/GeneralsMD/CMakeLists.txt index 2a9a65fb780..1285409e7fc 100644 --- a/GeneralsMD/CMakeLists.txt +++ b/GeneralsMD/CMakeLists.txt @@ -48,14 +48,14 @@ if(RTS_INSTALL_PREFIX_ZEROHOUR) install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() - if(TARGET z_particleeditor) - install(TARGETS z_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) + if(TARGET core_particleeditor) + install(TARGETS core_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() - if(TARGET z_debugwindow) - install(TARGETS z_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) + if(TARGET core_debugwindow) + install(TARGETS core_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() if(TARGET z_guiedit) diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index d6990fc097c..4cccb799075 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -207,7 +207,7 @@ set(GAMEENGINE_SRC Include/GameClient/Module/SwayClientUpdate.h Include/GameClient/Mouse.h # Include/GameClient/ParabolicEase.h - Include/GameClient/ParticleSys.h +# Include/GameClient/ParticleSys.h Include/GameClient/PlaceEventTranslator.h Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h @@ -817,7 +817,7 @@ set(GAMEENGINE_SRC # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" Source/GameClient/System/DebugDisplay.cpp Source/GameClient/System/Image.cpp - Source/GameClient/System/ParticleSys.cpp +# Source/GameClient/System/ParticleSys.cpp Source/GameClient/System/RayEffect.cpp # Source/GameClient/System/Smudge.cpp # Source/GameClient/Terrain/TerrainRoads.cpp diff --git a/GeneralsMD/Code/Tools/CMakeLists.txt b/GeneralsMD/Code/Tools/CMakeLists.txt index b5d2b2a878d..eb85f07f4b8 100644 --- a/GeneralsMD/Code/Tools/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/CMakeLists.txt @@ -5,7 +5,6 @@ if(RTS_BUILD_ZEROHOUR_TOOLS) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) - add_subdirectory(ParticleEditor) add_subdirectory(W3DView) add_subdirectory(wdump) add_subdirectory(WorldBuilder) diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def deleted file mode 100644 index c35776d57d7..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def +++ /dev/null @@ -1,6 +0,0 @@ -; ParticleEditor.def : Declares the module parameters for the DLL. - -LIBRARY "ParticleEditor" -DESCRIPTION 'ParticleEditor Windows Dynamic Link Library' - -EXPORTS diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc deleted file mode 100644 index 8010aaa685e..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc +++ /dev/null @@ -1,648 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\ParticleEditor.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef RTS_DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "DebugWindow DLL\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "DebugWindow\0" - VALUE "LegalCopyright", "Copyright (C) 2002\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "DebugWindow.DLL\0" - VALUE "ProductName", "DebugWindow Dynamic Link Library\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PSEd DIALOGEX 0, 0, 215, 441 -STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | - WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT -CAPTION "Particle Editor" -MENU IDR_FileMenu -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - COMBOBOX IDC_PSEd_ParticleSystem,38,19,137,419,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - COMBOBOX IDC_PSEd_ParentSystem,38,35,137,403,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_EmissionType,77,78,103,189,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_VelocityType,77,94,103,206,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_ParticleType,77,110,103,205,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_ShaderType,77,126,103,186,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_PSEd_AngleXMin,25,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleXMax,53,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleYMin,25,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleYMax,53,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleZMin,25,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleZMax,53,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateXMin,98,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateXMax,127,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateYMin,98,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateYMax,127,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateZMin,98,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateZMax,127,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_Gravity,164,156,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleDampingMin,18,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleDampingMax,46,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_VelocityDampingMin,93,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_VelocityDampingMax,121,230,26,14,ES_AUTOHSCROLL - CONTROL "",IDC_PSEd_EmissionPanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,258,186,55 - CONTROL "",IDC_PSEd_VelocityPanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,317,186,55 - CONTROL "",IDC_PSEd_ParticlePanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,376,186,39 - CONTROL "Colors/Alpha",IDC_PSEd_EditColorButton,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,12,421,50,14 - CONTROL "Continued...",IDC_PSEd_Continued,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,148,421,50,14 - PUSHBUTTON "Go",IDC_PSEd_Go,188,19,20,14 - LTEXT "System:",IDC_STATIC,7,21,26,8 - LTEXT "Parent:",IDC_STATIC,8,37,24,8 - GROUPBOX "System Parameters",IDC_STATIC,7,52,201,386 - LTEXT "Emission Type:",IDC_STATIC,19,81,48,8 - LTEXT "Velocity Type:",IDC_STATIC,19,97,46,8 - LTEXT "Particle Type:",IDC_STATIC,19,113,44,8 - LTEXT "Shader Type:",IDC_STATIC,19,129,44,8 - LTEXT "X:",IDC_STATIC,15,164,8,8 - LTEXT "Y:",IDC_STATIC,15,180,8,8 - LTEXT "Z:",IDC_STATIC,15,196,8,8 - LTEXT "X:",IDC_STATIC,88,164,8,8 - LTEXT "Y:",IDC_STATIC,88,180,8,8 - LTEXT "Z:",IDC_STATIC,88,196,8,8 - LTEXT "Min",IDC_STATIC,31,153,12,8 - LTEXT "Max",IDC_STATIC,59,153,14,8 - LTEXT "Min",IDC_STATIC,105,153,12,8 - LTEXT "Max",IDC_STATIC,133,153,14,8 - LTEXT "Min",IDC_STATIC,24,222,12,8 - LTEXT "Max",IDC_STATIC,52,222,14,8 - LTEXT "Min",IDC_STATIC,99,222,12,8 - LTEXT "Max",IDC_STATIC,127,222,14,8 - GROUPBOX "Angle",IDC_STATIC,12,145,70,65 - GROUPBOX "Angular Rate",IDC_STATIC,85,145,70,65 - GROUPBOX "Angular Damping",IDC_STATIC,12,212,70,35 - GROUPBOX "Velocity Damping",IDC_STATIC,85,212,70,35 - GROUPBOX "Gravity",IDC_STATIC,158,145,39,27 - LTEXT "Particle Cap:",IDC_STATIC,7,5,41,8 - EDITTEXT IDC_PSEd_CurrentParticleCap,50,2,25,14,ES_AUTOHSCROLL | - ES_NUMBER - LTEXT "Current Count:",IDC_STATIC,133,5,46,8 - EDITTEXT IDC_PSEd_CurrentParticleCount,182,2,25,14,ES_AUTOHSCROLL | - ES_READONLY | ES_NUMBER - CONTROL "Switches",IDC_PSEd_EditSwitchesButton,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,92,421,50,14 - COMBOBOX IDC_PSEd_Priority,77,63,103,198,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "Priority",IDC_STATIC,19,67,22,8 - PUSHBUTTON "Kill All",IDC_PSEd_KillAll,181,36,27,14 -END - -IDD_PSEd_EditColorAndAlpha DIALOGEX 0, 0, 199, 186 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "Color and Alpha" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - LTEXT "1",IDC_STATIC,16,30,8,8 - LTEXT "2",IDC_STATIC,16,45,8,8 - LTEXT "3",IDC_STATIC,16,61,8,8 - GROUPBOX "Color Keyframes",IDC_STATIC,12,11,67,163 - LTEXT "4",IDC_STATIC,15,79,8,8 - LTEXT "5",IDC_STATIC,15,94,8,8 - LTEXT "6",IDC_STATIC,15,110,8,8 - LTEXT "7",IDC_STATIC,15,126,8,8 - LTEXT "8",IDC_STATIC,15,142,8,8 - EDITTEXT IDC_PSEd_CF1_Frame,48,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF2_Frame,48,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF3_Frame,48,59,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF4_Frame,48,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF5_Frame,48,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF6_Frame,48,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF7_Frame,48,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF8_Frame,48,139,26,14,ES_AUTOHSCROLL - LTEXT "Frame",IDC_STATIC,51,19,20,8 - EDITTEXT IDC_PSEd_AF1_Min,97,27,26,14,ES_AUTOHSCROLL - LTEXT "1",IDC_STATIC,87,30,8,8 - EDITTEXT IDC_PSEd_AF2_Min,97,43,26,14,ES_AUTOHSCROLL - LTEXT "2",IDC_STATIC,87,45,8,8 - EDITTEXT IDC_PSEd_AF3_Min,97,59,26,14,ES_AUTOHSCROLL - LTEXT "3",IDC_STATIC,87,61,8,8 - EDITTEXT IDC_PSEd_AF1_Max,125,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF2_Max,125,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF3_Max,125,59,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,103,19,12,8 - LTEXT "Max",IDC_STATIC,131,19,14,8 - GROUPBOX "Alpha Keyframes",IDC_STATIC,83,11,105,163 - EDITTEXT IDC_PSEd_AF4_Min,97,75,26,14,ES_AUTOHSCROLL - LTEXT "4",IDC_STATIC,87,78,8,8 - EDITTEXT IDC_PSEd_AF5_Min,97,91,26,14,ES_AUTOHSCROLL - LTEXT "5",IDC_STATIC,87,94,8,8 - EDITTEXT IDC_PSEd_AF6_Min,97,107,26,14,ES_AUTOHSCROLL - LTEXT "6",IDC_STATIC,87,110,8,8 - EDITTEXT IDC_PSEd_AF4_Max,125,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF5_Max,125,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF6_Max,125,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF7_Min,97,123,26,14,ES_AUTOHSCROLL - LTEXT "7",IDC_STATIC,87,126,8,8 - EDITTEXT IDC_PSEd_AF8_Min,97,139,26,14,ES_AUTOHSCROLL - LTEXT "8",IDC_STATIC,87,142,8,8 - EDITTEXT IDC_PSEd_AF7_Max,125,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF8_Max,125,139,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF1_Frame,153,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF2_Frame,153,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF3_Frame,153,59,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF4_Frame,153,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF5_Frame,153,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF6_Frame,153,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF7_Frame,153,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF8_Frame,153,139,26,14,ES_AUTOHSCROLL - LTEXT "Frame",IDC_STATIC,155,19,20,8 - PUSHBUTTON "",IDC_PSEd_Color1,25,28,14,12 - PUSHBUTTON "",IDC_PSEd_Color2,25,44,14,12 - PUSHBUTTON "",IDC_PSEd_Color3,25,60,14,12 - PUSHBUTTON "",IDC_PSEd_Color4,25,76,14,12 - PUSHBUTTON "",IDC_PSEd_Color5,25,92,14,12 - PUSHBUTTON "",IDC_PSEd_Color6,25,108,14,12 - PUSHBUTTON "",IDC_PSEd_Color7,25,124,14,12 - PUSHBUTTON "",IDC_PSEd_Color8,25,140,14,12 -END - -IDD_PSEd_EmissionPanelLine DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Line Properties",IDC_EmissionProperties,0,0, - 185,54 - LTEXT "X",IDC_STATIC,49,10,8,8 - LTEXT "Y",IDC_STATIC,75,10,8,8 - LTEXT "Z",IDC_STATIC,100,10,8,8 - EDITTEXT IDC_PSEd_LineStartX,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineStartY,65,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineStartZ,92,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndX,38,35,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndY,65,35,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndZ,92,35,26,14,ES_AUTOHSCROLL - LTEXT "Start",IDC_STATIC,17,23,16,8 - LTEXT "End",IDC_STATIC,17,36,14,8 -END - -IDD_PSEd_EmissionPanelSphere DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Sphere Properties",IDC_EmissionProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_SphereRadius,41,12,26,14,ES_AUTOHSCROLL - LTEXT "Radius",IDC_STATIC,16,16,23,8 -END - -IDD_PSEd_EmissionPanelBox DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Box Properties",IDC_EmissionProperties,0,0,185, - 54 - LTEXT "X",IDC_STATIC,49,10,8,8 - LTEXT "Y",IDC_STATIC,75,10,8,8 - LTEXT "Z",IDC_STATIC,100,10,8,8 - EDITTEXT IDC_PSEd_BoxHalfSizeX,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BoxHalfSizeY,65,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BoxHalfSizeZ,92,19,26,14,ES_AUTOHSCROLL - LTEXT "Half-Size",IDC_STATIC,5,23,29,8 -END - -IDD_PSEd_EmissionPanelCylinder DIALOG DISCARDABLE 0, 0, 186, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Cylinder Properties",IDC_EmissionProperties,0, - 0,185,54 - EDITTEXT IDC_PSEd_CylRadius,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylLength,38,35,26,14,ES_AUTOHSCROLL - LTEXT "Radius",IDC_STATIC,13,23,23,8 - LTEXT "Length",IDC_STATIC,13,36,23,8 -END - -IDD_PSEd_EmissionPanelPoint DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Point Properties",IDC_EmissionProperties,0,0, - 185,54 - LTEXT "No parameters to edit",IDC_STATIC,38,22,68,8 -END - -IDD_PSEd_VelocityPanelOrtho DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Ortho Velocity Properties",IDC_VelocityProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_OrthoXMin,22,20,26,14,ES_AUTOHSCROLL - LTEXT "X",IDC_STATIC,11,24,8,8 - EDITTEXT IDC_PSEd_OrthoXMax,51,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,29,10,12,8 - LTEXT "Max",IDC_STATIC,57,10,14,8 - LTEXT "Y",IDC_STATIC,11,39,8,8 - EDITTEXT IDC_PSEd_OrthoYMin,22,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OrthoYMax,51,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OrthoZMin,113,20,26,14,ES_AUTOHSCROLL - LTEXT "Z",IDC_STATIC,102,24,8,8 - EDITTEXT IDC_PSEd_OrthoZMax,142,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,120,10,12,8 - LTEXT "Max",IDC_STATIC,148,10,14,8 -END - -IDD_PSEd_VelocityPanelSphere DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Spherical Velocity Properties",IDC_VelocityProperties,0, - 0,185,54 - EDITTEXT IDC_PSEd_SphereRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,21,24,21,8 - EDITTEXT IDC_PSEd_SphereRadialMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelHemisphere DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Hemispherical Velocity Properties", - IDC_VelocityProperties,0,0,185,54 - EDITTEXT IDC_PSEd_HemisphereRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,21,24,21,8 - EDITTEXT IDC_PSEd_HemisphereRadialMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelCylinder DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Cylindrical Velocity Properties",IDC_VelocityProperties, - 0,0,185,54 - EDITTEXT IDC_PSEd_CylinderRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,23,24,21,8 - LTEXT "Orthogonal",IDC_STATIC,8,40,36,8 - EDITTEXT IDC_PSEd_CylinderRadialMax,76,20,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylinderNormalMin,47,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylinderNormalMax,76,36,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelOutward DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Outward Velocity Properties",IDC_VelocityProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_OutwardSpeedMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Major Axis",IDC_STATIC,12,24,33,8 - EDITTEXT IDC_PSEd_OutwardSpeedMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 - LTEXT "Minor Axis",IDC_STATIC,12,39,33,8 - EDITTEXT IDC_PSEd_OutwardOtherMin,47,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OutwardOtherMax,76,36,26,14,ES_AUTOHSCROLL -END - -IDD_PSEd_ParticlePanelDrawable DIALOG DISCARDABLE 0, 0, 186, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_PSEd_ParticleTypeDrawable,44,14,130,409,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Particle:",IDC_STATIC,12,16,26,8 - GROUPBOX "3-D Particle Parameters",IDC_STATIC,0,0,185,38 -END - -IDD_PSEd_ParticlePanelParticle DIALOG DISCARDABLE 0, 0, 186, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_PSEd_ParticleTypeParticle,44,14,130,409, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Particle:",IDC_STATIC,12,16,26,8 - GROUPBOX "2-D Particle Parameters",IDC_STATIC,0,0,185,38 -END - -IDD_PSEd_EditMoreParms DIALOGEX 0, 0, 265, 204 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT -CAPTION "More Parameters" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - EDITTEXT IDC_PSEd_SizeMin,5,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeMax,33,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,13,84,12,8 - LTEXT "Max",IDC_STATIC,41,84,14,8 - GROUPBOX "Start Size",IDC_STATIC,3,76,57,32 - EDITTEXT IDC_PSEd_BurstDelayMin,66,20,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BurstDelayMax,94,20,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,72,12,12,8 - LTEXT "Max",IDC_STATIC,100,12,14,8 - GROUPBOX "Burst Delay",IDC_STATIC,63,3,60,33 - EDITTEXT IDC_PSEd_InitialDelayMin,6,20,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_InitialDelayMax,34,20,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,12,12,12,8 - LTEXT "Max",IDC_STATIC,40,12,14,8 - GROUPBOX "Initial Delay",IDC_STATIC,3,3,60,33 - EDITTEXT IDC_PSEd_BurstCountMin,129,56,26,12,ES_AUTOHSCROLL | - WS_GROUP - EDITTEXT IDC_PSEd_BurstCountMax,157,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,135,48,12,8 - LTEXT "Max",IDC_STATIC,163,48,14,8 - GROUPBOX "Burst Count",IDC_STATIC,126,39,60,33 - EDITTEXT IDC_PSEd_DriftVelocityX,131,21,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_DriftVelocityY,159,21,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_DriftVelocityZ,188,21,24,12,ES_AUTOHSCROLL - CTEXT "X",IDC_STATIC,139,12,8,8 - CTEXT "Y",IDC_STATIC,166,12,8,8 - CTEXT "Z",IDC_STATIC,195,12,8,8 - GROUPBOX "Drift Velocity",IDC_STATIC,126,3,90,33 - EDITTEXT IDC_PSEd_ColorScaleMin,68,56,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_ColorScaleMax,94,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,75,48,12,8 - LTEXT "Max",IDC_STATIC,100,48,14,8 - GROUPBOX "Color Scale",IDC_STATIC,66,39,57,33 - COMBOBOX IDC_PSEd_SlaveSystem,136,117,111,263,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_PerParticleSystem,136,131,111,245, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Slave",IDC_STATIC,115,121,19,8 - LTEXT "Per-Particle",IDC_STATIC,97,134,37,8 - EDITTEXT IDC_PSEd_SlaveOffsetX,7,128,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SlaveOffsetY,34,128,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SlaveOffsetZ,61,128,26,12,ES_AUTOHSCROLL - CTEXT "X",IDC_STATIC,16,119,8,8 - CTEXT "Y",IDC_STATIC,43,119,8,8 - CTEXT "Z",IDC_STATIC,70,119,8,8 - GROUPBOX "Slave Offset",IDC_STATIC,3,111,87,36 - EDITTEXT IDC_PSEd_SystemLifetime,195,56,33,12,ES_AUTOHSCROLL - GROUPBOX "System Life",IDC_STATIC,189,39,60,33 - EDITTEXT IDC_PSEd_ParticleLifetimeMin,6,56,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_ParticleLifetimeMax,34,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,12,48,12,8 - LTEXT "Max",IDC_STATIC,40,48,14,8 - GROUPBOX "Particle Lifetime",IDC_STATIC,3,39,60,33 - EDITTEXT IDC_PSEd_SizeDampingMin,191,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeDampingMax,220,93,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,199,84,12,8 - LTEXT "Max",IDC_STATIC,227,84,14,8 - GROUPBOX "Size Damping",IDC_STATIC,189,75,60,33 - EDITTEXT IDC_PSEd_SizeRateMin,66,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeRateMax,94,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,72,84,12,8 - LTEXT "Max",IDC_STATIC,100,84,14,8 - GROUPBOX "Size Rate",IDC_STATIC,63,75,60,33 - EDITTEXT IDC_PSEd_StartSizeRateMin,128,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_StartSizeRateMax,156,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,135,84,12,8 - LTEXT "Max",IDC_STATIC,163,84,14,8 - GROUPBOX "Start Size Rate",IDC_STATIC,126,75,60,33 - GROUPBOX "Wind",IDC_STATIC,3,147,261,54 - EDITTEXT IDC_PSEd_WindAngleChangeMin,58,171,26,12,ES_AUTOHSCROLL - LTEXT "Angle Rate Min",IDC_STATIC,6,174,50,8 - GROUPBOX "Ping Pong Wind",IDC_STATIC,87,156,174,36 - LTEXT "Start Angle Min",IDC_STATIC,89,167,51,8 - LTEXT "Start Angle Max",IDC_STATIC,89,179,51,8 - EDITTEXT IDC_PSEd_WindPingPongStartAngleMin,143,165,28,12, - ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_WindPingPongStartAngleMax,143,177,28,12, - ES_AUTOHSCROLL - LTEXT "End Angle Min",IDC_STATIC,174,167,51,8 - LTEXT "End Angle Max",IDC_STATIC,174,179,49,8 - EDITTEXT IDC_PSEd_WindPingPongEndAngleMin,227,165,27,12, - ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_WindPingPongEndAngleMax,227,177,27,12, - ES_AUTOHSCROLL - COMBOBOX IDC_PSEd_WindMotion,30,156,48,141,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - GROUPBOX "Systems",IDC_STATIC,93,111,156,36 - LTEXT "Motion",IDC_STATIC,6,159,22,8 - EDITTEXT IDC_PSEd_WindAngleChangeMax,57,186,27,12,ES_AUTOHSCROLL - LTEXT "Angle Rate Max",IDC_STATIC,6,188,52,8 -END - -IDD_PSEd_EditSwitchesDialog DIALOG DISCARDABLE 0, 0, 191, 102 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Emission Switches" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "One Shot Emitter",IDC_PSEd_OneShot,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,27,166,10 - CONTROL "Hollow Emitter",IDC_PSEd_Hollow,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,40,166,10 - CONTROL "Align on XY plane",IDC_PSEd_GroundAligned,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,53,166,10 - CONTROL "Emit above ground only",IDC_PSEd_EmitAboveGroundOnly, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,166,10 - GROUPBOX "Emitter Properties",IDC_STATIC,7,8,177,87 - CONTROL "Particle Up towards emitter", - IDC_PSEd_ParticleUpTowardsEmitter,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,80,166,10 -END - -IDD_PSEd_ParticlePanelStreak DIALOG DISCARDABLE 0, 0, 185, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Streak Particle Parameters",IDC_STATIC,0,0,185,39 - COMBOBOX IDC_PSEd_ParticleTypeParticle,44,14,130,409, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Streak:",IDC_STATIC,12,16,24,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PSEd, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 208 - TOPMARGIN, 1 - BOTTOMMARGIN, 434 - END - - IDD_PSEd_EditColorAndAlpha, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 192 - TOPMARGIN, 7 - BOTTOMMARGIN, 179 - END - - IDD_PSEd_EditMoreParms, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 258 - TOPMARGIN, 8 - BOTTOMMARGIN, 197 - END - - IDD_PSEd_EditSwitchesDialog, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 184 - TOPMARGIN, 7 - BOTTOMMARGIN, 95 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_FileMenu MENU DISCARDABLE -BEGIN - POPUP "File" - BEGIN - MENUITEM "Reload Current System", ID_FILE_RELOADCURRENT - MENUITEM "Reload All", ID_FILE_RELOADALL, GRAYED - MENUITEM SEPARATOR - MENUITEM "Save Current", ID_FILE_SAVECURRENT, GRAYED - MENUITEM "Save All", ID_FILE_SAVEALL - MENUITEM SEPARATOR - MENUITEM "Reload Textures", ID_FILE_RELOADTEXTURES - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\ParticleEditor.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat b/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat deleted file mode 100644 index a6f4a3cd544..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat +++ /dev/null @@ -1 +0,0 @@ -@copy release\particleEditor.dll ..\..\..\Run \ No newline at end of file diff --git a/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat b/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat deleted file mode 100644 index 9e10f7a3981..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat +++ /dev/null @@ -1 +0,0 @@ -@copy debug\particleEditor.dll ..\..\..\Run \ No newline at end of file diff --git a/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 b/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 deleted file mode 100644 index a9778297b91..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// DEBUGWINDOW.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 458d51e38e1..bed8377715c 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -277,6 +277,40 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/SubsystemInterface.cpp", Game.CORE, "GameEngine/Source/Common/System/SubsystemInterface.cpp") #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ParticleSys.h", Game.CORE, "GameEngine/Include/GameClient/ParticleSys.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/System/ParticleSys.cpp", Game.CORE, "GameEngine/Source/GameClient/System/ParticleSys.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/res/ParticleEditor.rc2", Game.CORE, "Tools/ParticleEditor/res/ParticleEditor.rc2") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CButtonShowColor.cpp", Game.CORE, "Tools/ParticleEditor/CButtonShowColor.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CButtonShowColor.h", Game.CORE, "Tools/ParticleEditor/CButtonShowColor.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CColorAlphaDialog.cpp", Game.CORE, "Tools/ParticleEditor/CColorAlphaDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CColorAlphaDialog.h", Game.CORE, "Tools/ParticleEditor/CColorAlphaDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CParticleEditorPage.h", Game.CORE, "Tools/ParticleEditor/CParticleEditorPage.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CSwitchesDialog.cpp", Game.CORE, "Tools/ParticleEditor/CSwitchesDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CSwitchesDialog.h", Game.CORE, "Tools/ParticleEditor/CSwitchesDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/EmissionTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/EmissionTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/EmissionTypePanels.h", Game.CORE, "Tools/ParticleEditor/EmissionTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ISwapablePanel.h", Game.CORE, "Tools/ParticleEditor/ISwapablePanel.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/MoreParmsDialog.cpp", Game.CORE, "Tools/ParticleEditor/MoreParmsDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/MoreParmsDialog.h", Game.CORE, "Tools/ParticleEditor/MoreParmsDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.cpp", Game.CORE, "Tools/ParticleEditor/ParticleEditor.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.def", Game.CORE, "Tools/ParticleEditor/ParticleEditor.def") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.h", Game.CORE, "Tools/ParticleEditor/ParticleEditor.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.rc", Game.CORE, "Tools/ParticleEditor/ParticleEditor.rc") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorDialog.cpp", Game.CORE, "Tools/ParticleEditor/ParticleEditorDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorDialog.h", Game.CORE, "Tools/ParticleEditor/ParticleEditorDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorExport.h", Game.CORE, "Tools/ParticleEditor/ParticleEditorExport.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/ParticleTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleTypePanels.h", Game.CORE, "Tools/ParticleEditor/ParticleTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/post-build-Release.bat", Game.CORE, "Tools/ParticleEditor/post-build-Release.bat") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/post-build.bat", Game.CORE, "Tools/ParticleEditor/post-build.bat") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/Resource.h", Game.CORE, "Tools/ParticleEditor/Resource.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ShaderTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/ShaderTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ShaderTypePanels.h", Game.CORE, "Tools/ParticleEditor/ShaderTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/StdAfx.cpp", Game.CORE, "Tools/ParticleEditor/StdAfx.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/StdAfx.h", Game.CORE, "Tools/ParticleEditor/StdAfx.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/VelocityTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/VelocityTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/VelocityTypePanels.h", Game.CORE, "Tools/ParticleEditor/VelocityTypePanels.h") + return From 292c75568b205bdd394c27fff9b0d8a36e7d7259 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 29 Jan 2026 19:14:21 +0100 Subject: [PATCH 140/211] fix(radar): Fix Radar pixel color format for non A8R8B8G8 surfaces (#2170) --- .../Include/W3DDevice/Common/W3DRadar.h | 1 + .../W3DDevice/Common/System/W3DRadar.cpp | 51 ++++++---- .../Source/WWVegas/WW3D2/ww3dformat.cpp | 96 +++++++++++++++++++ .../Source/WWVegas/WW3D2/ww3dformat.h | 2 + 4 files changed, 132 insertions(+), 18 deletions(-) diff --git a/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h index 38d650e6a09..81d15815268 100644 --- a/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h +++ b/Core/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h @@ -110,6 +110,7 @@ class W3DRadar : public Radar SurfaceClass *m_shroudSurface; ///< surface to shroud texture void *m_shroudSurfaceBits; ///< shroud surface bits int m_shroudSurfacePitch; ///< shroud surface pitch + WW3DFormat m_shroudSurfaceFormat; ///< shroud surface format UnsignedInt m_shroudSurfacePixelSize; ///< shroud surface pixel size Int m_textureWidth; ///< width for all radar textures diff --git a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 065d725184d..62ffaea09b2 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -700,9 +700,11 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text Player *player = rts::getObservedOrLocalPlayer(); + SurfaceClass::SurfaceDescription surfaceDesc; + surface->Get_Description(surfaceDesc); int pitch; void *pBits = surface->Lock(&pitch); - const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + const unsigned int bytesPerPixel = Get_Bytes_Per_Pixel(surfaceDesc.Format); for( const RadarObject *rObj = listHead; rObj; rObj = rObj->friend_getNext() ) { @@ -718,7 +720,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text radarPoint.y = pos->y / (m_mapExtent.height() / RADAR_CELL_HEIGHT); // get the color we're going to draw in - Color c = rObj->getColor(); + Color argbColor = rObj->getColor(); // adjust the alpha for stealth units so they "fade/blink" on the radar for the controller // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY ) @@ -727,7 +729,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if( obj->testStatus( OBJECT_STATUS_STEALTHED ) ) { UnsignedByte r, g, b, a; - GameGetColorComponents( c, &r, &g, &b, &a ); + GameGetColorComponents( argbColor, &r, &g, &b, &a ); const UnsignedInt framesForTransition = LOGICFRAMES_PER_SECOND; const UnsignedByte minAlpha = 32; @@ -737,25 +739,27 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text a = REAL_TO_UNSIGNEDBYTE( ((alphaScale - 1.0f) * (255.0f - minAlpha)) + minAlpha ); else a = REAL_TO_UNSIGNEDBYTE( (alphaScale * (255.0f - minAlpha)) + minAlpha ); - c = GameMakeColor( r, g, b, a ); + argbColor = GameMakeColor( r, g, b, a ); } + const unsigned int pixelColor = ARGB_Color_To_WW3D_Color(surfaceDesc.Format, argbColor); + // draw the blip, but make sure the points are legal if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, pixelColor, bytesPerPixel, pBits, pitch ); radarPoint.y++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, pixelColor, bytesPerPixel, pBits, pitch ); radarPoint.x++; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, pixelColor, bytesPerPixel, pBits, pitch ); radarPoint.y--; if( legalRadarPoint( radarPoint.x, radarPoint.y ) ) - surface->Draw_Pixel( radarPoint.x, radarPoint.y, c, bytesPerPixel, pBits, pitch ); + surface->Draw_Pixel( radarPoint.x, radarPoint.y, pixelColor, bytesPerPixel, pBits, pitch ); } @@ -860,6 +864,7 @@ W3DRadar::W3DRadar( void ) m_shroudSurface = nullptr; m_shroudSurfaceBits = nullptr; m_shroudSurfacePitch = 0; + m_shroudSurfaceFormat = WW3D_FORMAT_UNKNOWN; m_shroudSurfacePixelSize = 0; m_textureWidth = RADAR_CELL_WIDTH; @@ -1078,9 +1083,11 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) Coord3D worldPoint; Bridge *bridge; + SurfaceClass::SurfaceDescription surfaceDesc; + surface->Get_Description(surfaceDesc); int pitch; void *pBits = surface->Lock(&pitch); - const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); + const unsigned int bytesPerPixel = Get_Bytes_Per_Pixel(surfaceDesc.Format); for( y = 0; y < m_textureHeight; y++ ) { @@ -1269,7 +1276,8 @@ void W3DRadar::buildTerrainTexture( TerrainLogic *terrain ) // draw the pixel for the terrain at this point, note that because of the orientation // of our world we draw it with positive y in the "up" direction - Color pixelColor = GameMakeColor( color.red * 255, color.green * 255, color.blue * 255, 255 ); + const Color argbColor = GameMakeColor( color.red * 255, color.green * 255, color.blue * 255, 255 ); + const unsigned int pixelColor = ARGB_Color_To_WW3D_Color(surfaceDesc.Format, argbColor); surface->Draw_Pixel( x, y, pixelColor, bytesPerPixel, pBits, pitch ); } @@ -1364,16 +1372,19 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting // This is expensive. SurfaceClass* surface = m_shroudTexture->Get_Surface_Level(); DEBUG_ASSERTCRASH( surface, ("W3DRadar: Can't get surface for Shroud texture") ); + SurfaceClass::SurfaceDescription surfaceDesc; + surface->Get_Description(surfaceDesc); int pitch; void *pBits = surface->Lock(&pitch); - const unsigned int bytesPerPixel = surface->Get_Bytes_Per_Pixel(); - const Color color = GameMakeColor( 0, 0, 0, alpha ); + const unsigned int bytesPerPixel = Get_Bytes_Per_Pixel(surfaceDesc.Format); + const Color argbColor = GameMakeColor( 0, 0, 0, alpha ); + const unsigned int pixelColor = ARGB_Color_To_WW3D_Color(surfaceDesc.Format, argbColor); for( Int y = radarMinY; y <= radarMaxY; ++y ) { for( Int x = radarMinX; x <= radarMaxX; ++x ) { - surface->Draw_Pixel( x, y, color, bytesPerPixel, pBits, pitch ); + surface->Draw_Pixel( x, y, pixelColor, bytesPerPixel, pBits, pitch ); } } @@ -1384,14 +1395,16 @@ void W3DRadar::setShroudLevel(Int shroudX, Int shroudY, CellShroudStatus setting { // This is cheap. DEBUG_ASSERTCRASH(m_shroudSurfaceBits != nullptr, ("W3DRadar::setShroudLevel: m_shroudSurfaceBits is not expected null")); + DEBUG_ASSERTCRASH(m_shroudSurfaceFormat != WW3D_FORMAT_UNKNOWN, ("W3DRadar::setShroudLevel: m_shroudSurfaceFormat is not expected UNKNOWN")); DEBUG_ASSERTCRASH(m_shroudSurfacePixelSize != 0, ("W3DRadar::setShroudLevel: m_shroudSurfacePixelSize is not expected 0")); - const Color color = GameMakeColor( 0, 0, 0, alpha ); + const Color argbColor = GameMakeColor( 0, 0, 0, alpha ); + const unsigned int pixelColor = ARGB_Color_To_WW3D_Color(m_shroudSurfaceFormat, argbColor); for( Int y = radarMinY; y <= radarMaxY; ++y ) { for( Int x = radarMinX; x <= radarMaxX; ++x ) { - m_shroudSurface->Draw_Pixel( x, y, color, m_shroudSurfacePixelSize, m_shroudSurfaceBits, m_shroudSurfacePitch ); + m_shroudSurface->Draw_Pixel( x, y, pixelColor, m_shroudSurfacePixelSize, m_shroudSurfaceBits, m_shroudSurfacePitch ); } } } @@ -1403,10 +1416,11 @@ void W3DRadar::beginSetShroudLevel() m_shroudSurface = m_shroudTexture->Get_Surface_Level(); DEBUG_ASSERTCRASH( m_shroudSurface != nullptr, ("W3DRadar::beginSetShroudLevel: Can't get surface for Shroud texture") ); - SurfaceClass::SurfaceDescription sd; - m_shroudSurface->Get_Description(sd); + SurfaceClass::SurfaceDescription surfaceDesc; + m_shroudSurface->Get_Description(surfaceDesc); m_shroudSurfaceBits = m_shroudSurface->Lock(&m_shroudSurfacePitch); - m_shroudSurfacePixelSize = Get_Bytes_Per_Pixel(sd.Format); + m_shroudSurfaceFormat = surfaceDesc.Format; + m_shroudSurfacePixelSize = Get_Bytes_Per_Pixel(surfaceDesc.Format); } void W3DRadar::endSetShroudLevel() @@ -1417,6 +1431,7 @@ void W3DRadar::endSetShroudLevel() m_shroudSurface->Unlock(); m_shroudSurfaceBits = nullptr; m_shroudSurfacePitch = 0; + m_shroudSurfaceFormat = WW3D_FORMAT_UNKNOWN; m_shroudSurfacePixelSize = 0; } REF_PTR_RELEASE(m_shroudSurface); diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp index accec5da22b..0c867868458 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp @@ -422,6 +422,102 @@ unsigned Get_Bytes_Per_Pixel(WW3DFormat format) return 0; } +unsigned ARGB_Color_To_WW3D_Color(WW3DFormat format, unsigned argb) +{ + unsigned a = (argb >> 24) & 0xFF; + unsigned r = (argb >> 16) & 0xFF; + unsigned g = (argb >> 8) & 0xFF; + unsigned b = (argb >> 0) & 0xFF; + + switch (format) + { + case WW3D_FORMAT_R8G8B8: + return (r << 16) | (g << 8) | b; + + case WW3D_FORMAT_A8R8G8B8: + return (a << 24) | (r << 16) | (g << 8) | b; + + case WW3D_FORMAT_X8R8G8B8: + return (0xFF << 24) | (r << 16) | (g << 8) | b; + + case WW3D_FORMAT_R5G6B5: + return ((r >> 3) << 11) | + ((g >> 2) << 5) | + ((b >> 3) << 0); + + case WW3D_FORMAT_X1R5G5B5: + return ( 1 << 15) | + ((r >> 3) << 10) | + ((g >> 3) << 5) | + ((b >> 3) << 0); + + case WW3D_FORMAT_A1R5G5B5: + return ((a >> 7) << 15) | + ((r >> 3) << 10) | + ((g >> 3) << 5) | + ((b >> 3) << 0); + + case WW3D_FORMAT_A4R4G4B4: + return ((a >> 4) << 12) | + ((r >> 4) << 8) | + ((g >> 4) << 4) | + ((b >> 4) << 0); + + case WW3D_FORMAT_R3G3B2: + return ((r >> 5) << 5) | + ((g >> 5) << 2) | + ((b >> 6) << 0); + + case WW3D_FORMAT_A8: + return a; + + case WW3D_FORMAT_A8R3G3B2: + return ( a << 8) | + ((r >> 5) << 5) | + ((g >> 5) << 2) | + ((b >> 6) << 0); + + case WW3D_FORMAT_X4R4G4B4: + return ( 0xF << 12) | + ((r >> 4) << 8) | + ((g >> 4) << 4) | + ((b >> 4) << 0); + + case WW3D_FORMAT_L8: + { + unsigned l = (r * 77 + g * 150 + b * 29) >> 8; + return l; + } + + case WW3D_FORMAT_A8L8: + { + unsigned l = (r * 77 + g * 150 + b * 29) >> 8; + return (a << 8) | l; + } + + case WW3D_FORMAT_A4L4: + { + unsigned l = (r * 77 + g * 150 + b * 29) >> 8; + return ((a >> 4) << 4) | (l >> 4); + } + + // Palettized, bump-map, and compressed formats + // cannot be represented by a single ARGB color + case WW3D_FORMAT_P8: + case WW3D_FORMAT_A8P8: + case WW3D_FORMAT_U8V8: + case WW3D_FORMAT_L6V5U5: + case WW3D_FORMAT_X8L8V8U8: + case WW3D_FORMAT_DXT1: + case WW3D_FORMAT_DXT2: + case WW3D_FORMAT_DXT3: + case WW3D_FORMAT_DXT4: + case WW3D_FORMAT_DXT5: + default: + return 0; + } +} + unsigned Get_Num_Depth_Bits(WW3DZFormat zformat) { switch (zformat) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.h b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.h index e9f9d898742..ade7aa7cbc7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.h @@ -195,6 +195,8 @@ WW3DFormat Get_Valid_Texture_Format(WW3DFormat format,bool is_compression_allowe unsigned Get_Bytes_Per_Pixel(WW3DFormat format); +unsigned ARGB_Color_To_WW3D_Color(WW3DFormat format, unsigned argb); + void Get_WW3D_Format_Name(WW3DFormat format, StringClass& name); void Get_WW3D_ZFormat_Name(WW3DZFormat format, StringClass& name); From 77474340668a6cc21b9ac656ca87a9d109cb209f Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 31 Jan 2026 06:18:37 +1100 Subject: [PATCH 141/211] tweak(jetaiupdate): Defer offensive commands for parked jets without ammo (#2174) --- .../Object/Update/AIUpdate/JetAIUpdate.cpp | 21 ++++++++++++++++++ .../Object/Update/AIUpdate/JetAIUpdate.cpp | 22 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 5e08e1cd8a0..8bdcdac3404 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2337,6 +2337,27 @@ void JetAIUpdate::aiDoCommand(const AICommandParms* parms) // don't need (or want) to take off for these break; +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @tweak Stubbjax 23/01/2026 Parked jets now defer offensive commands when out of ammo. + case AICMD_ATTACKMOVE_TO_POSITION: + case AICMD_ATTACK_AREA: + case AICMD_ATTACK_OBJECT: + case AICMD_ATTACK_POSITION: + case AICMD_ATTACK_TEAM: + case AICMD_FORCE_ATTACK_OBJECT: + case AICMD_GUARD_AREA: + case AICMD_GUARD_OBJECT: + case AICMD_GUARD_POSITION: + case AICMD_HUNT: + if (isOutOfSpecialReloadAmmo(getObject())) + { + setFlag(HAS_PENDING_COMMAND, true); + return; + } + + FALLTHROUGH; +#endif + case AICMD_ENTER: case AICMD_GET_REPAIRED: diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp index 101640d9cdd..323f54d08c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp @@ -2571,6 +2571,28 @@ void JetAIUpdate::aiDoCommand(const AICommandParms* parms) // don't need (or want) to take off for these break; +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @tweak Stubbjax 23/01/2026 Parked jets now defer offensive commands when out of ammo. + case AICMD_ATTACKMOVE_TO_POSITION: + case AICMD_ATTACK_AREA: + case AICMD_ATTACK_OBJECT: + case AICMD_ATTACK_POSITION: + case AICMD_ATTACK_TEAM: + case AICMD_FORCE_ATTACK_OBJECT: + case AICMD_GUARD_AREA: + case AICMD_GUARD_OBJECT: + case AICMD_GUARD_POSITION: + case AICMD_GUARD_RETALIATE: + case AICMD_HUNT: + if (isOutOfSpecialReloadAmmo()) + { + setFlag(HAS_PENDING_COMMAND, true); + return; + } + + FALLTHROUGH; +#endif + case AICMD_ENTER: case AICMD_GET_REPAIRED: From 002b8cbdf36ea47be9b26370e223bf529a880a32 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Fri, 30 Jan 2026 14:18:36 -0600 Subject: [PATCH 142/211] build(debug): Add CMake option RTS_DEBUG_CHEATS to enable debug cheats in release builds (#1842) --- Core/GameEngine/Include/Common/GameCommon.h | 2 -- cmake/config-debug.cmake | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Include/Common/GameCommon.h b/Core/GameEngine/Include/Common/GameCommon.h index 1e7c224fd5a..62c6c3429f0 100644 --- a/Core/GameEngine/Include/Common/GameCommon.h +++ b/Core/GameEngine/Include/Common/GameCommon.h @@ -47,8 +47,6 @@ #pragma once -#define DONT_ALLOW_DEBUG_CHEATS_IN_RELEASE ///< Take of the DONT to get cheats back in to release - //#define _CAMPEA_DEMO // ---------------------------------------------------------------------------------------------- diff --git a/cmake/config-debug.cmake b/cmake/config-debug.cmake index e9bb8f3ece9..13eececeeb8 100644 --- a/cmake/config-debug.cmake +++ b/cmake/config-debug.cmake @@ -10,6 +10,7 @@ set_property(CACHE RTS_DEBUG_STACKTRACE PROPERTY STRINGS DEFAULT ON OFF) set(RTS_DEBUG_PROFILE "DEFAULT" CACHE STRING "Enables debug profiling. When DEFAULT, this option is enabled with DEBUG or INTERNAL") set_property(CACHE RTS_DEBUG_PROFILE PROPERTY STRINGS DEFAULT ON OFF) +option(RTS_DEBUG_CHEATS "Enables debug cheats in release builds" OFF) option(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Includes normal debug log in crc log" OFF) option(RTS_DEBUG_MULTI_INSTANCE "Enables multi client instance support" OFF) @@ -35,10 +36,15 @@ define_debug_option(RTS_DEBUG_CRASHING DEBUG_CRASHING DISABLE_DEBUG_CRASHING define_debug_option(RTS_DEBUG_STACKTRACE DEBUG_STACKTRACE DISABLE_DEBUG_STACKTRACE DebugStacktrace "Build with Debug Stacktracing") define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE DebugProfile "Build with Debug Profiling") +add_feature_info(DebugCheats RTS_DEBUG_CHEATS "Build with Debug Cheats in release builds") add_feature_info(DebugIncludeDebugLogInCrcLog RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Build with Debug Logging in CRC log") add_feature_info(DebugMultiInstance RTS_DEBUG_MULTI_INSTANCE "Build with Multi Client Instance support") +if(RTS_DEBUG_CHEATS) + target_compile_definitions(core_config INTERFACE _ALLOW_DEBUG_CHEATS_IN_RELEASE) +endif() + if(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG) target_compile_definitions(core_config INTERFACE INCLUDE_DEBUG_LOG_IN_CRC_LOG) endif() From b009261f3fbb8d5648801c6043a15afc4fb26adf Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:53:02 +0000 Subject: [PATCH 143/211] bugfix(pathfinder): Fix some pinched cells being changed to impassable cells in internal_classifyObjectFootprint() (#2222) --- Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 2 ++ GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 7bed98dabdc..3d610929fce 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4093,6 +4093,7 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } +#if RETAIL_COMPATIBLE_PATHFINDING for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) @@ -4103,6 +4104,7 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } } +#endif // Expand building bounds 1 cell. for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index fea307e8310..bcb614f74df 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -4373,6 +4373,7 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } +#if RETAIL_COMPATIBLE_PATHFINDING for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) { for( i=cellBounds.lo.x; i<=cellBounds.hi.x; i++ ) @@ -4383,6 +4384,7 @@ void Pathfinder::internal_classifyObjectFootprint( Object *obj, Bool insert ) } } } +#endif // Expand building bounds 1 cell. for( j=cellBounds.lo.y; j<=cellBounds.hi.y; j++ ) From 15a06f59be6e79058d20d9dd8cb25c38516f261d Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 30 Jan 2026 22:38:27 +0100 Subject: [PATCH 144/211] unify(w3ddraw): Merge W3DModelDraw, W3DDependencyModelDraw code (#2225) --- .../GameEngine/Include/GameClient/Drawable.h | 9 ++ .../GameEngine/Source/GameClient/Drawable.cpp | 8 +- .../GameClient/Module/W3DModelDraw.h | 14 ++- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 22 +++++ .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 98 ++++++++++++++----- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 19 +--- 6 files changed, 129 insertions(+), 41 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/Drawable.h b/Generals/Code/GameEngine/Include/GameClient/Drawable.h index e74853b7ba2..2fa0fd40c63 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Drawable.h +++ b/Generals/Code/GameEngine/Include/GameClient/Drawable.h @@ -311,6 +311,8 @@ class Drawable : public Thing, TintEnvelope *getColorTintEnvelope( void ) { return m_colorTintEnvelope; } void setColorTintEnvelope( TintEnvelope &source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; } + void imitateStealthLook( Drawable& otherDraw ); + void setTerrainDecal(TerrainDecalType type); ///m_event; } + + Bool getReceivesDynamicLights( void ) { return m_receivesDynamicLights; }; + void setReceivesDynamicLights( Bool set ) { m_receivesDynamicLights = set; }; + protected: // snapshot methods @@ -688,6 +694,9 @@ class Drawable : public Thing, Bool m_hiddenByStealth; ///< drawable is hidden due to stealth Bool m_instanceIsIdentity; ///< If true, instance matrix can be skipped Bool m_drawableFullyObscuredByShroud; ///